| 3XL |
94 |
37.0 |
129 |
50.8 |
/** @private {string} */
class SpzCustomAnchorScroll extends SPZ.BaseElement {
static deferredMount() {
return false;
}
constructor(element) {
super(element);
/** @private {Element} */
this.scrollableContainer_ = null;
}
isLayoutSupported(layout) {
return layout == SPZCore.Layout.LOGIC;
}
buildCallback() {
this.viewport_ = this.getViewport();
this.initActions_();
}
setTarget(containerId, targetId) {
this.containerId = '#' + containerId;
this.targetId = '#' + targetId;
}
scrollToTarget() {
const container = document.querySelector(this.containerId);
const target = container.querySelector(this.targetId);
const {scrollTop} = container;
const eleOffsetTop = this.getOffsetTop_(target, container);
this.viewport_
.interpolateScrollIntoView_(
container,
scrollTop,
scrollTop + eleOffsetTop
);
}
initActions_() {
this.registerAction(
'scrollToTarget',
(invocation) => this.scrollToTarget(invocation?.caller)
);
this.registerAction(
'setTarget',
(invocation) => this.setTarget(invocation?.args?.containerId, invocation?.args?.targetId)
);
}
/**
* @param {Element} element
* @param {Element} container
* @return {number}
* @private
*/
getOffsetTop_(element, container) {
if (!element./*OK*/ getClientRects().length) {
return 0;
}
const rect = element./*OK*/ getBoundingClientRect();
if (rect.width || rect.height) {
return rect.top - container./*OK*/ getBoundingClientRect().top;
}
return rect.top;
}
}
SPZ.defineElement('spz-custom-anchor-scroll', SpzCustomAnchorScroll);
const STRENGTHEN_TRUST_URL = "/api/strengthen_trust/settings";
class SpzCustomStrengthenTrust extends SPZ.BaseElement {
constructor(element) {
super(element);
this.renderElement_ = null;
}
isLayoutSupported(layout) {
return layout == SPZCore.Layout.CONTAINER;
}
buildCallback() {
this.xhr_ = SPZServices.xhrFor(this.win);
const renderId = this.element.getAttribute('render-id');
SPZCore.Dom.waitForChild(
document.body,
() => !!document.getElementById(renderId),
() => {
this.renderElement_ = SPZCore.Dom.scopedQuerySelector(
document.body,
`#${renderId}`
);
if (this.renderElement_) {
this.render_();
}
this.registerAction('track', (invocation) => {
this.track_(invocation.args);
});
}
);
}
render_() {
this.fetchData_().then((data) => {
if (!data) {
return;
}
SPZ.whenApiDefined(this.renderElement_).then((apis) => {
apis?.render(data);
document.querySelector('#strengthen-trust-render-1779181026469').addEventListener('click',(event)=>{
if(event.target.nodeName == 'A'){
this.track_({type: 'trust_content_click'});
}
})
});
});
}
track_(data = {}) {
const track = window.sa && window.sa.track;
if (!track) {
return;
}
track('trust_enhancement_event', data);
}
parseJSON_(string) {
let result = {};
try {
result = JSON.parse(string);
} catch (e) {}
return result;
}
fetchData_() {
return this.xhr_
.fetchJson(STRENGTHEN_TRUST_URL)
.then((responseData) => {
if (!responseData || !responseData.data) {
return null;
}
const data = responseData.data;
const moduleSettings = (data.module_settings || []).reduce((result, moduleSetting) => {
return result.concat(Object.assign(moduleSetting, {
logos: (moduleSetting.logos || []).map((item) => {
return moduleSetting.logos_type == 'custom' ? this.parseJSON_(item) : item;
})
}));
}, []);
return Object.assign(data, {
module_settings: moduleSettings,
isEditor: window.self !== window.top,
});
});
}
}
SPZ.defineElement('spz-custom-strengthen-trust', SpzCustomStrengthenTrust);
${data.module_title}
To display this card to customers, you need to go to "Booster & Store Conversion" to turn on the trust enhancement feature.
${item.content.replaceAll("{store_name}","Tymviajeros")}
To display this card to customers, you need to go to "Booster & Store Conversion" to turn on the trust enhancement feature.
Your shopping bag is empty
-
*${item.quantity}
${item.item_text}
${discount_item.title}
(-)
${ data.originData.message }
${function () {
if (!data.originData) return "";
let {
apply_scenario,
discount_info,
landing_page_info,
threshold_category
} = data.originData;
const progressDom = ``;
const { mobile_layout, show_add_to_cart, show_discount_label } = landing_page_info.product_display;
const isBXGY = discount_info.discount_type === "DT_CODE_BXGY";
const buyProductsDom = `
`;
const obtainProductsDom = `
`;
const is_obtain = threshold_category === 'THRESHOLD_CATEGORY_OBTAIN_PRODUCT' ? 'active' : '';
const tabsDom = `
${function(){
let liDom = '';
const items = [
{
text: landing_page_info.product.buy_product.text,
class: "",
value: 1
},
{
text: landing_page_info.product.obtain_product.text,
class: "cart-coupon-code-modal-tab__obtain",
value: 2,
is_obtain
}
];
for (item of items) {
liDom += `
- ${ item.text }
`
}
return liDom;
}()}
${buyProductsDom}
${obtainProductsDom}
`;
return `
${progressDom}
${isBXGY ? tabsDom : ` ${buyProductsDom} `}
`
}()}
const TAG = 'spz-custom-cart-coupon-code-utils';
class SpzCustomCartCouponCodeUtils extends SPZ.BaseElement {
constructor(element) {
super(element);
}
static deferredMount() {
return false;
}
isLayoutSupported(layout) {
return layout == SPZCore.Layout.LOGIC;
}
buildCallback() {
this.action_ = SPZServices.actionServiceForDoc(this.element);
this.registerAction('setSideBarHeight', this.setSideBarHeight_.bind(this));
window.addEventListener('resize', this.setSideBarHeight_.bind(this));
}
setSideBarHeight_() {
const $sideBar = document.querySelector('#cart-coupon-code-modal');
if (!$sideBar) return;
const windowHeight = window.innerHeight;
$sideBar.style.setProperty('max-height', windowHeight * 0.9 + 'px', 'important');
}
}
SPZ.defineElement(TAG, SpzCustomCartCouponCodeUtils);
${function(){
const settings_product_image_hover_on = true;
const variantShowLimit = 4;
const private_id = 'product-tmpl-' + Math.random().toFixed(6).slice(-6);
const product_variants = data.variants || [];
const product_id = data.id;
const images = data.images || [];
const image = data.image || {};
const imageWidth = image.width;
let imageHeight = image.height;
const price = Number(data.price_min);
let compareAtPrice = Number(data.compare_at_price);
const type = data.type;
const isMock = data.isMock;
let product_image_hover_on = false;
for (item of product_variants) {
const vcap = Number(item.compare_at_price);
if (item.price == price && vcap > compareAtPrice) {
compareAtPrice = vcap;
}
}
let second_image = null;
if (settings_product_image_hover_on) {
for (img of images.slice(1)) {
if (img.src && img.src.indexOf('video=') === -1) {
second_image = img;
product_image_hover_on = true;
break;
}
}
}
const sold_label_on = !data.available;
let sale_label_on = false;
if (compareAtPrice > price && data.available) {
sale_label_on = true;
}
const diffPrice = compareAtPrice - price;
return `
${data.available ?
`
` : ''}
`;
}()}
const carousel = document.getElementById('marketing-quick-view-images');
const selector = document.getElementById('marketing-quick-view-thumb-images');
const resizeObserver = new ResizeObserver(entries => {
for (let entry of entries) {
const { height } = entry.contentRect;
selector.style.height = height + 'px';
}
});
resizeObserver.observe(carousel);
${function(){
const variantsNamesSet = new Set(data.options.map((opt) => opt.name.toLowerCase()) || []);
const handleName = (name) => name.replace(/\/|\\|\s|\'|\"|`|\<|\>/g, '');
const mouseoutevent = data.options.map((opt) => `@${handleName(opt.name)}Mouseout="qv-selected-render-${opt.id}.rerender(data=event,redo=true);"`).join(' ');
const mouseoverevent = data.options.map((opt) => `@${handleName(opt.name)}Mouseover="qv-selected-render-${opt.id}.rerender(data=event,redo=true);"`).join(' ');
const variants = data?.variants?.map((item) => item.image.path) || [];
const productData = data;
const images = data.images;
const selectedVariant = data.variants.find(v => v.available) || data.variants[0];
const selectedIndex = !!selectedVariant ? images.findIndex(img => img.src === (selectedVariant.image && selectedVariant.image.src)) : 0;
const initialSlide = selectedIndex === -1 ? 0 : selectedIndex;
return `
${images.map((image, index) => `
`).join('')}
${images.map(image => `
`).join('')}
${images.length > 1 ? `
` : ''}
`
}()}
${function(){
return (data.product.options || []).map((option, index) => {
const optionName = option.name || '';
const optionId = option.id || '';
return `
`
}).join('')
}()}
${function(){
const { currentOptName, originData: { selectData, value } } = data;
const optionValue = selectData ? selectData[currentOptName].value[0] : value;
return `${optionValue}`
}()}
${function(){
const productData = data.product;
const selectedVariant = productData.variants.find(v => v.available) || productData.variants[0];
const product_options = productData.options.filter(Boolean) || [];
const handleName = (name) => name.replace(/\/|\\|\s|\'|\"|`|\<|\>/g, '');
const mouseoutevent = productData.options.map((opt) => `@${handleName(opt.name)}Mouseout="qs-selected-render-${opt.id}.rerender(data=event,redo=true);"`).join(' ');
const mouseoverevent = productData.options.map((opt) => `@${handleName(opt.name)}Mouseover="qs-selected-render-${opt.id}.rerender(data=event,redo=true);"`).join(' ');
return `
` }()}
${function(){
return (data.product.options || []).map((option, index) => {
const optionName = option.name || '';
const optionId = option.id || '';
return `
`
}).join('')
}()}
${function(){
const { currentOptName, originData: { selectData, value } } = data;
const optionValue = selectData ? selectData[currentOptName].value[0] : value;
return `${optionValue}`
}()}
const TAG = 'spz-custom-marketing-utils';
class SpzCustomMarketingUtils extends SPZ.BaseElement {
constructor(element) {
super(element);
}
static deferredMount() {
return false;
}
isLayoutSupported(layout) {
return layout == SPZCore.Layout.LOGIC;
}
buildCallback() {
this.registerAction('addToCartTrigger', (invocation) => {
window.$ && $(document).trigger('dj.common.cart.change');
window.$ && $(document).trigger('dj.addToCart', invocation.event.detail);
})
}
}
SPZ.defineElement(TAG, SpzCustomMarketingUtils);
${function(){
if (data.status === 'APPLY_STATUS_SUCCESS' || !data.message) {
return ``
}
return `
${data.originData.message}
Add
`
}()}
${data.map( item => {
return `
`
}).join('')}
${data.map( item => {
return `
`
}).join('')}
${function(){
const code_data = data.originData.list;
if (!code_data || !code_data.length) return '';
const recommendDom = `
Recommend discount codes
`;
const discountCodeListDom = code_data.map( item => {
item.end_at = item.end_at == -1 ? item.end_at : item.end_at * 1000;
item.start_at *= 1000;
return `
`
}).join('');
return `
${discountCodeListDom}
`
}()}
${function() {
const textArray = ("Save {{save_amount}}").split(/\{\{\s*save_amount\}\}/);
if (textArray.length > 0 && textArray.length < 2) {
textArray.push('');
}
return textArray.map((text, index) => {
if (index == 0) {
return `${text}`;
}
return `
${text}
`;
}).join('');
}()}
${function() {
const textArray = ("Save {{save_amount}}").split(/\{\{\s*save_amount\}\}/);
if (textArray.length > 0 && textArray.length < 2) {
textArray.push('');
}
return textArray.map((text, index) => {
if (index == 0) {
return `${text}`;
}
return `
${text}
`;
}).join('');
}()}
-
${discount_application.title}:
-
${data.invalid_msg}
Taxes and shipping calculated at checkout
${data.invalid_msg}
${function() {
const textArray = ("Save {{save_amount}}").split(/\{\{\s*save_amount\}\}/);
if (textArray.length > 0 && textArray.length < 2) {
textArray.push('');
}
return textArray.map((text, index) => {
if (index == 0) {
return `${text}`;
}
return `
${text}
`;
}).join('');
}()}
${function() {
const textArray = ("Save {{save_amount}}").split(/\{\{\s*save_amount\}\}/);
if (textArray.length > 0 && textArray.length < 2) {
textArray.push('');
}
return textArray.map((text, index) => {
if (index == 0) {
return `${text}`;
}
return `
${text}
`;
}).join('');
}()}
${function() {
const textArray = ("Save {{save_amount}}").split(/\{\{\s*save_amount\}\}/);
if (textArray.length > 0 && textArray.length < 2) {
textArray.push('');
}
return textArray.map((text, index) => {
if (index == 0) {
return `${text}`;
}
return `
${text}
`;
}).join('');
}()}
-
${discount_application.title}:
-
${data.invalid_msg}
Taxes and shipping calculated at checkout
-
Subtotal:
-
${discount_application.title}:
-
Taxes and shipping calculated at checkout
${function(){
console.log('quick-shop-render',data);
const productData = data.product;
let product_change_event = '',
mouse_over_event = ' ';
mouse_out_event = '';
const product_options = productData.options.filter(Boolean) || [];
const selectedVariant = productData.variants.find(v => v.available) || productData.variants[0];
const statusLan = ((selectedVariant && !selectedVariant.available) || (!selectedVariant && !productData.available)) ?
"Sold out" :
"Add to cart";
return `
`
}()}
${function(){
const currentSelectVariant = data.variant;
const defaultVariant = (data.product && data.product.variants && data.product.variants[0]);
const variantData = currentSelectVariant || defaultVariant || data;
const retail_price = variantData.retail_price || 0;
return `
`
}()}
${function(){
const wholesale_enabled = false;
const qty = data.quantity || 1;
const currentSelectVariant = data.variant;
const defaultVariant = (data.product && data.product.variants && data.product.variants[0]);
const productVariant = {"id":"6bad69a8-4adf-4c42-bc5e-de40da2b03c1","product_id":"eb335084-a5df-4ac0-9ca4-e76fd72d1b56","title":"black-XS(US 4\/UK 8\/EU 36)","weight_unit":"kg","inventory_quantity":10000,"sku":"A2026072402-black-XS(US 4\/UK 8\/EU 36)-A0013095","barcode":"","position":1,"option1":"black","option2":"XS(US 4\/UK 8\/EU 36)","option3":"","note":"","image":{"src":"\/\/img.staticdj.com\/f44800792f2fe9b7719f7ce5c54ed2f0.jpg","path":"f44800792f2fe9b7719f7ce5c54ed2f0.jpg","width":720,"height":1280,"alt":"","aspect_ratio":0.5625},"wholesale_price":[{"price":34.39,"min_quantity":1}],"weight":"0.6","compare_at_price":"52.99","price":"34.39","retail_price":"52.99","available":true,"url":"\/products\/rhinestone-cutout-wide-leg-jeans?variant=6bad69a8-4adf-4c42-bc5e-de40da2b03c1","available_quantity":999999999,"options":[{"name":"Color","value":"black"},{"name":"Size","value":"XS(US 4\/UK 8\/EU 36)"}],"off_ratio":"35","flashsale_info":{"variant_id":"6bad69a8-4adf-4c42-bc5e-de40da2b03c1","product_id":"","quantity":0,"discount_id":"","limit_time":0,"limit_buy":0,"user_limit_buy":0,"discount_sales":0,"discount_sales_rate":"","discount_stock":0,"ends_at":0,"starts_at":0,"allow_oversold":"","allocation_method":"","price":"34.39","compare_at_price":"","discount_price":"34.39","customary_saved_price":"","customary_off_ratio":"","discount_saved_price":"","discount_off_ratio":"35","use_before_price":false,"before_price":"","title":"","properties":"","color_setting_promotional_copy":"","discount_quantity":0,"is_need_split":false},"sales":0};
const variantData = currentSelectVariant || defaultVariant || productVariant;
const wholesale_price = variantData.wholesale_price || [];
if(wholesale_enabled && wholesale_price.length > 0) {
let wholesaleIndex = wholesale_price.findIndex(item => {
return item.min_quantity > qty;
});
if(wholesaleIndex < 0){
wholesaleIndex = wholesale_price.length - 1;
}else if(wholesaleIndex > 0){
wholesaleIndex = wholesaleIndex - 1;
}
const wholesalePrice = wholesale_price[wholesaleIndex] || '';
return `
`
}else {
const price = variantData && variantData.price;
return price != undefined ? ` ` : '';
}
}()}
${function(){
const optionName = option.name || '';
const optionId = option.id || '';
let isThumbImage = !!option.showThumbImage;
const thumbStyle = "image_with_text";
const variantType = "button";
const isSelected = (value) => {
const selected = (data.selectedOptions || []).find(v => v.name === optionName);
return selected && selected.value.length && selected.value[0] == value;
};
const getThumbImage = (value) => {
const options = data.product.options || [];
const option = options.find(o => o.name === optionName);
if (option.thumbImages) {
const thumbImage = option.thumbImages.find(t => t.value === value);
if (thumbImage && thumbImage.image) {
return {
src: thumbImage.image.src,
alt: thumbImage.image.alt
};
}
}
return {src: '', alt: ''};
};
return `
`
}()}
${data.value}
|