const startTimeStoreKey = 'calamus-start-time-1643548'; const typeStoreKey = 'calamus-discount-type-1643548'; const DISCOUNT_TYPE = { AMOUNT: 'amount', DISCOUNT: 'discount', }; const RESTART_TYPE = { AFTER_12_HOUR: 'after_12_hour', NOW: 'now', }; const SITE = (window.C_SETTINGS && window.C_SETTINGS.routes && window.C_SETTINGS.routes.root) || ''; let callingType = 'init'; const request = (url) => { return fetch(SITE + url) .then((res) => res.json()) .then((data) => data); }; const getItem = (key) => localStorage.getItem(key); const setItem = (key, value) => localStorage.setItem(key, value); const setStartTime = (startTime) => setItem(startTimeStoreKey, startTime); const getStartTime = () => { let startTime = Number(getItem(startTimeStoreKey)); if (!startTime) { startTime = Date.now(); setStartTime(startTime); } return startTime; }; const getDiffTime = (duration, startTime) => { if (startTime) { setStartTime(startTime); } else { startTime = getStartTime(); } const durationMs = duration * 60 * 1000; const diffTime = startTime + durationMs - Date.now(); return diffTime; }; const getType = () => getItem(typeStoreKey); const setType = (type) => setItem(typeStoreKey, type); const cartRequestFunc = () => request('/api/cart'); const countdownRequest = request('/api/cart_countdown_settings/detail'); const getAllRequest = () => { return Promise.all([ cartRequestFunc(), countdownRequest ]).then(([cartResult, countdownResult]) => { const cartData = cartResult && cartResult.cart; const countdownData = countdownResult && countdownResult.data; if (!cartData || !countdownData || !countdownData.enabled) { return [null, null]; } return [cartData, countdownData]; }); }; const handleRestartTime = ( duration, diffTime, type) => { if (diffTime > 0) { return diffTime; } if (type == RESTART_TYPE.NOW) { return getDiffTime(duration, Date.now()); } else if (type == RESTART_TYPE.AFTER_12_HOUR) { const TWELVE_HOUR_MILLISECONDS = 12 * 60 * 60 * 1000; const restartTimeCondition = TWELVE_HOUR_MILLISECONDS + diffTime < 0; if (restartTimeCondition) { return getDiffTime(duration, Date.now()); } } return diffTime; }; const getRenderData = (cartData, countdownData, callingType = 'init') => { const linePrice = Number(cartData.line_price) || 0; const totalDiscount = Number(cartData.total_discount) || 0; const discountAmount = totalDiscount; const discountPercent = parseInt(totalDiscount / linePrice * 100 * 10) / 10; const commonSetting = countdownData.common_setting || {}; const discountSetting = countdownData.discount_setting || {}; const discountCondition = (discountSetting && discountSetting.condition) || {}; const discountType = discountCondition.type; const discountValue = discountCondition.value; let hasDiscount = false; if ( countdownData.discount_enabled && ( (discountType === DISCOUNT_TYPE.AMOUNT && discountAmount > discountValue) || (discountType === DISCOUNT_TYPE.DISCOUNT && discountPercent > discountValue) ) ) { hasDiscount = true; } const currentType = hasDiscount ? DISCOUNT_TYPE.DISCOUNT : DISCOUNT_TYPE.AMOUNT; const type = getType(); setType(currentType); if (currentType !== type) { setStartTime(Date.now()); } const duration = countdownData.duration; const restartType = countdownData.restart_type; let diffTime = getDiffTime(/* Seconds */ duration); if (diffTime <= 0 && callingType === 'init') { diffTime = handleRestartTime(duration, diffTime, restartType); } const isOnGoing = diffTime > 0; const renderData = hasDiscount ? discountSetting : commonSetting; return Object.assign( renderData, { isOnGoing, hasDiscount, diffTime, discountType, discountAmount, discountPercent, } ); }; function getData() { return getAllRequest().then(([cartData, countdownData]) => { const itemCount = cartData && cartData.item_count; if (!cartData || !countdownData || itemCount <= 0) { return Promise.resolve({ result: null }); } return Promise.resolve({ result: getRenderData(cartData, countdownData, callingType) }).then((data) => { callingType = 'rerender'; return data; }); }); } exportFunction('getData', getData);
Short-sleeved new leopard print round neck waist skirt for women

Short-sleeved new leopard print round neck waist skirt for women

color

Please select a color

size

Please select a size

Quantity

Free shipping
LOW STOCK ORDER YOUR'S NOW.

Price

$39.62 $19.81
Save $19.81
/** @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-1539149753700').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);