๐ŸŽ„๐ŸŽ6-Pack Solar Christmas Decorative Lights

$34.99
const TAG = "spz-custom-product-automatic"; class SpzCustomProductAutomatic extends SPZ.BaseElement { constructor(element) { super(element); this.variant_id = '2b41be7b-e17b-4d89-ab2a-f3f3b9e1e9b7'; this.isRTL = SPZ.win.document.dir === 'rtl'; this.isAddingToCart_ = false; // ๅŠ ่ดญไธญ็Šถๆ€ } static deferredMount() { return false; } buildCallback() { this.action_ = SPZServices.actionServiceForDoc(this.element); this.templates_ = SPZServices.templatesForDoc(this.element); this.xhr_ = SPZServices.xhrFor(this.win); this.setupAction_(); this.viewport_ = this.getViewport(); } mountCallback() { this.init(); // ็›‘ๅฌไบ‹ไปถ this.bindEvent_(); } async init() { this.handleFitTheme(); const data = await this.getDiscountList(); this.renderApiData_(data); } async getDiscountList() { const productId = '01329157-be57-42f2-8147-a987d9deff79'; const variantId = this.variant_id; const productType = 'default'; const reqBody = { product_id: productId, variant_id: variantId, discount_method: "DM_AUTOMATIC", customer: { customer_id: window.C_SETTINGS.customer.customer_id, email: window.C_SETTINGS.customer.customer_email }, product_type: productType } const url = `/api/storefront/promotion/display_setting/text/list`; const data = await this.xhr_.fetchJson(url, { method: "post", body: reqBody }).then(res => { return res; }).catch(err => { this.setContainerDisabled(false); }) return data; } async renderDiscountList() { this.setContainerDisabled(true); const data = await this.getDiscountList(); this.setContainerDisabled(false); // ้‡ๆ–ฐๆธฒๆŸ“ ๆŠ–ๅŠจ้—ฎ้ข˜ๅค„็† this.renderApiData_(data); } clearDom() { const children = this.element.querySelector('*:not(template)'); children && SPZCore.Dom.removeElement(children); } async renderApiData_(data) { const parentDiv = document.querySelector('.automatic_discount_container'); const newTplDom = await this.getRenderTemplate(data); if (parentDiv) { parentDiv.innerHTML = ''; parentDiv.appendChild(newTplDom); } else { console.log('automatic_discount_container is null'); } } doRender_(data) { const renderData = data || {}; return this.templates_ .findAndRenderTemplate(this.element, renderData) .then((el) => { this.clearDom(); this.element.appendChild(el); }); } async getRenderTemplate(data) { const renderData = data || {}; return this.templates_ .findAndRenderTemplate(this.element, { ...renderData, isRTL: this.isRTL }) .then((el) => { this.clearDom(); return el; }); } setContainerDisabled(isDisable) { const automaticDiscountEl = document.querySelector('.automatic_discount_container_outer'); if(isDisable) { automaticDiscountEl.setAttribute('disabled', ''); } else { automaticDiscountEl.removeAttribute('disabled'); } } // ็ป‘ๅฎšไบ‹ไปถ bindEvent_() { window.addEventListener('click', (e) => { let containerNodes = document.querySelectorAll(".automatic-container .panel"); let bool; Array.from(containerNodes).forEach((node) => { if(node.contains(e.target)){ bool = true; } }) // ๆ˜ฏๅฆpopover้ขๆฟ็‚นๅ‡ป่Œƒๅ›ด if (bool) { return; } if(e.target.classList.contains('drowdown-icon') || e.target.parentNode.classList.contains('drowdown-icon')){ return; } const nodes = document.querySelectorAll('.automatic-container'); Array.from(nodes).forEach((node) => { node.classList.remove('open-dropdown'); }) // ๅ…ผๅฎนไธป้ข˜ this.toggleProductSticky(true); }) // ็›‘ๅฌๅ˜ไฝ“ๅ˜ๅŒ– document.addEventListener('dj.variantChange', async(event) => { // ้‡ๆ–ฐๆธฒๆŸ“ const variant = event.detail.selected; if (variant.product_id == '01329157-be57-42f2-8147-a987d9deff79' && variant.id != this.variant_id) { this.variant_id = variant.id; this.renderDiscountList(); } }); } // ๅ…ผๅฎนไธป้ข˜ handleFitTheme() { // top ๅฑžๆ€งๅฝฑๅ“ๆŠ–ๅŠจ let productInfoEl = null; if (window.SHOPLAZZA.theme.merchant_theme_name === 'Wind' || window.SHOPLAZZA.theme.merchant_theme_name === 'Flash') { productInfoEl = document.querySelector('.product-info-body .product-sticky-container'); } else if (window.SHOPLAZZA.theme.merchant_theme_name === 'Hero') { productInfoEl = document.querySelector('.product__info-wrapper .properties-content'); } if(productInfoEl){ productInfoEl.classList.add('force-top-auto'); } } // ๅ…ผๅฎน wind/flash /hero ไธป้ข˜ (stickyๅฑžๆ€งๅฝฑๅ“ popover ๅฑ‚็บงๅฑ•็คบ, ไผš่ขซๅ…ถไป–ๅ…ƒ็ด ่ฆ†็›–) toggleProductSticky(isSticky) { let productInfoEl = null; if (window.SHOPLAZZA.theme.merchant_theme_name === 'Wind' || window.SHOPLAZZA.theme.merchant_theme_name === 'Flash') { productInfoEl = document.querySelector('.product-info-body .product-sticky-container'); } else if (window.SHOPLAZZA.theme.merchant_theme_name === 'Hero') { productInfoEl = document.querySelector('.product__info-wrapper .properties-content'); } if(productInfoEl){ if(isSticky) { // ่ฟ˜ๅŽŸ่ฏฅไธป้ข˜ๅŽŸๆœ‰็š„stickyๅฑžๆ€งๅ€ผ productInfoEl.classList.remove('force-position-static'); return; } productInfoEl.classList.toggle('force-position-static'); } } setupAction_() { this.registerAction('handleDropdown', (invocation) => { const discount_id = invocation.args.discount_id; const nodes = document.querySelectorAll('.automatic-container'); Array.from(nodes).forEach((node) => { if(node.getAttribute('id') != `automatic-${discount_id}`) { node.classList.remove('open-dropdown'); } }) const $discount_item = document.querySelector(`#automatic-${discount_id}`); $discount_item && $discount_item.classList.toggle('open-dropdown'); // ๅ…ผๅฎนไธป้ข˜ this.toggleProductSticky(); }); // ๅŠ ่ดญไบ‹ไปถ this.registerAction('handleAddToCart', (invocation) => { // ้˜ปๆญขไบ‹ไปถๅ†’ๆณก const event = invocation.event; if (event) { event.stopPropagation(); event.preventDefault(); } // ๅฆ‚ๆžœๆญฃๅœจๅŠ ่ดญไธญ๏ผŒ็›ดๆŽฅ่ฟ”ๅ›ž if (this.isAddingToCart_) { return; } const quantity = invocation.args.quantity || 1; this.addToCart(quantity); }); } // ๅŠ ่ดญๆ–นๆณ• async addToCart(quantity) { // ่ฎพ็ฝฎๅŠ ่ดญไธญ็Šถๆ€ this.isAddingToCart_ = true; const productId = '01329157-be57-42f2-8147-a987d9deff79'; const variantId = this.variant_id; const url = '/api/cart'; const reqBody = { product_id: productId, variant_id: variantId, quantity: quantity }; try { const data = await this.xhr_.fetchJson(url, { method: 'POST', body: reqBody }); // ่งฆๅ‘ๅŠ ่ดญๆˆๅŠŸๆ็คบ this.triggerAddToCartToast_(); return data; } catch (error) { error.then(err=>{ this.showToast_(err?.message || err?.errors?.[0] || 'Unknown error'); }) } finally { // ๆ— ่ฎบๆˆๅŠŸๅคฑ่ดฅ๏ผŒ้ƒฝ้‡็ฝฎๅŠ ่ดญ็Šถๆ€ this.isAddingToCart_ = false; } } showToast_(message) { const toastEl = document.querySelector("#apps-match-drawer-add_to_cart_toast"); if (toastEl) { SPZ.whenApiDefined(toastEl).then((apis) => { apis.showToast(message); }); } } // ่งฆๅ‘ๅŠ ่ดญๆˆๅŠŸๆ็คบ triggerAddToCartToast_() { // ๅฆ‚ๆžœไธป้ข˜ๆœ‰่‡ชๅทฑ็š„ๅŠ ่ดญๆ็คบ๏ผŒๅˆ™ไธๆ˜พ็คบ const themeAddToCartToastEl = document.querySelector('#add-cart-event-proxy'); if (themeAddToCartToastEl) return; // ๆ˜พ็คบๅบ”็”จ็š„ๅŠ ่ดญๆˆๅŠŸๆ็คบ this.showToast_("Added successfully"); } triggerEvent_(name, data) { const event = SPZUtils.Event.create(this.win, `${ TAG }.${ name }`, data || {}); this.action_.trigger(this.element, name, event); } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } } SPZ.defineElement(TAG, SpzCustomProductAutomatic);
class SpzCustomDiscountBundle extends SPZ.BaseElement { constructor(element) { super(element); } isLayoutSupported(layout) { return layout == SPZCore.Layout.LOGIC; } mountCallback() { // ๅŒไธ€้กตๅฏ่ƒฝๆœ‰ๅคšไธช block ๅ„่‡ชๆธฒๆŸ“ๆœฌ snippet๏ผŒๅฏผ่‡ด้€ป่พ‘ๅ…ƒ็ด  spz-custom-discount-toast(#appsAddCartToastFunc) ้‡ๅคใ€‚ // ไป…ไฟ็•™ DOM ไธญ็ฌฌไธ€ไธชๅฎžไพ‹๏ผŒๅ…ถไฝ™้‡ๅคๅฎžไพ‹็งป้™ค่‡ช่บซ๏ผŒไฟ่ฏ้€ป่พ‘ๅ…ƒ็ด ๅŠๅ…ถ action ๅผ•็”จ(appsAddCartToastFunc)ๅ”ฏไธ€ใ€‚ const funcs = document.querySelectorAll('#appsAddCartToastFunc'); if (funcs.length > 1 && this.element !== funcs[0]) { this.element.remove(); return; } // ๅ…จๅฑ€ๆŠ˜ๆ‰ฃ toast ็š„ๅผนๅ‡บ็‚นๅˆ†ๆ•ฃๅœจๅคšไธชๆจกๆฟ/็ป„ไปถ้‡Œ๏ผˆๅซๅฃฐๆ˜Žๅผ @atcError๏ผ‰๏ผŒๆ— ๆณ•้€ไธ€ๅœจๅผนๅ‡บๅ‰ๅ‰็ฝฎ๏ผŒ // ๆ•…ๆŒ‚่ฝฝๆ—ถๅน‚็ญ‰ๅœฐๅŽป้‡ๅนถๆŒ‚ๅˆฐ body๏ผ›ๅŠ ่ดญ toast ๆ”นไธบๅผนๅ‡บๅ‰ๆŒ‰้œ€ๅŽป้‡๏ผˆ่ง showAddToCartToast๏ผ‰ this.ensureSingleToastInBody_('cart_match_discount_toast_wrap'); } unmountCallback() {} // ๅŒไธ€้กต้ขๅฏ่ƒฝๆœ‰ๅคšไธช block ๅ„่‡ชๆธฒๆŸ“ๆœฌ toast snippet๏ผˆๅฆ‚ๅ•†่ฏฆ็š„ discount_automatic + ่ดญ็‰ฉ่ฝฆๆŠฝๅฑ‰้‡Œ็š„ๆŠ˜ๆ‰ฃๆจชๅน…๏ผ‰๏ผŒ // ๅฏผ่‡ด toast ๅค–ๅฑ‚ๅ‡บ็Žฐ้‡ๅค idใ€‚้‡ๅค id ไธ‹ getElementById/querySelector ๅŠ SPZ ๅŠจไฝœๅผ•็”จ้ƒฝๅชๅ‘ฝไธญ็ฌฌไธ€ไธช๏ผŒ // ไธ”่ขซๅ…ณ่ฟ›ๆŠฝๅฑ‰็š„้‚ฃไปฝไผš่ขซๆŠฝๅฑ‰็š„ transform/overflow ่ฃๅ‰ช/้”™ไฝใ€‚่ฟ™้‡ŒๅœจๆŒ‚่ฝฝๆ—ถๅน‚็ญ‰ๅŽป้‡๏ผš // ๅชไฟ็•™ไธ€ไปฝใ€็งป้™คๅคšไฝ™็š„๏ผŒๅนถๆŠŠไฟ็•™็š„ๆŒ‚ๅˆฐ body๏ผˆbody ๆ˜ฏ position:fixed ๆœ€ๅฎ‰ๅ…จ็š„่ฝ็‚น๏ผŒ้ฟๅ…่ขซไปปไฝ•็ฅ–ๅ…ˆ่ฃๅ‰ช๏ผ‰ใ€‚ๅฏๅๅค่ฐƒ็”จใ€‚ ensureSingleToastInBody_(id) { const els = Array.from(document.querySelectorAll('#' + id)); if (!els.length) return; els.slice(1).forEach((el) => el.remove()); const keep = els[0]; if (keep.parentNode !== document.body) { document.body.appendChild(keep); } } // ไธป้ข˜่ดญ็‰ฉ่ฝฆๆŠฝๅฑ‰ๆ˜ฏๅฆๆ‰“ๅผ€ isInCartDrawer_() { return !!document.querySelector('[data-section-type="cart_drawer"] spz-sidebar[open]'); } setupAction_() { this.registerAction('showAddToCartToast', () => { // ๆŠฝๅฑ‰ๅ†…ๅŠ ่ดญ๏ผšไธป้ข˜ๆœฌๅฐฑไธไผšๆœ‰ๅŠ ่ดญๆ•ˆๆžœ๏ผŒ็ปŸไธ€ๅผนๆ’ไปถ่‡ชๅทฑ็š„ toast // ้žๆŠฝๅฑ‰๏ผšไธป้ข˜ๆœ‰ๅŠ ่ดญไปฃ็†ๅˆ™ๆฒฟ็”จไธป้ข˜ๅŠ ่ดญๆ•ˆๆžœ๏ผŒๅฆๅˆ™ๆ’ไปถๅ…œๅบ• const proxyEl = document.getElementById('add-cart-event-proxy'); const inDrawer = this.isInCartDrawer_(); if (!inDrawer && proxyEl) { return; } // ๅผนๅ‡บๅ‰ๆŒ‰้œ€ๅŽป้‡ๅนถๆŒ‚ๅˆฐ body๏ผˆๅน‚็ญ‰๏ผ‰๏ผŒ้ฟๅ…้‡ๅค id ๅ‘ฝไธญ้”™ๅฏน่ฑกๆˆ–่ขซๆŠฝๅฑ‰่ฃๅ‰ช/้”™ไฝ this.ensureSingleToastInBody_('apps_add_cart_toast_wrap'); const toastEl = document.querySelector('#apps-match-drawer-add_to_cart_toast') SPZ.whenApiDefined(toastEl).then((apis) => { apis.showToast("Added successfully"); }); }); } buildCallback() { this.setupAction_(); }; } SPZ.defineElement('spz-custom-discount-toast', SpzCustomDiscountBundle);
Style:  # 01
Power Source:  Solar
Quantity
/** @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);

Description

FEATURES

SOLAR & BATTERY POWER OPTIONS - Sunny or shady, these lights have you covered. The solar version charges during the day and lights up automatically at night, saving electricity and standing up to any weather. The battery-powered option works anywhere, even indoors or in low-light areas, and its waterproof battery box keeps everything safe from rain or dew.

EFFORTLESS INSTALLATION - No tools, no hassle. Just push the stakes into your lawn, flower pot, or even cracks in walls, and youโ€™re done. First-timers can have it ready in seconds. Itโ€™s a fast and easy way to bring holiday magic to every corner of your home and yard.

SOFT, COZY GLOW -ย These lights provide practical night lighting while adding a festive glow. Their warm, cozy light brightens paths and gardens without harsh glare, creating a welcoming, magical atmosphere for evenings outdoors.

BRING FESTIVE CHEER -ย Turn any backyard, patio, or indoor nook into a holiday wonderland. With classic Christmas shapes and soft, warm lighting, these lights instantly create a joyful, cozy winter scene.

ADORABLE DESIGN & PERFECT FOR GIFTING - Featuring Santa, reindeer, snowflakes, and Christmas trees, each light brings the holiday spirit to life. Perfect for your home and as a cheerful gift for friends or family, they combine charm and function in one.

SPECIFICATION

Color: As Shown

Power: 5 W

Protection Rating: IP65

Package Includes:ย 1* Warm Glow Festive Garden Stake Lights

NOTES

Intended for decorative use only, not as main lighting.

Please allow 2-3cm error due to manual measurement. Please make sure you do not mind before purchasing.