Buy $69.98 Free shipping

🤠Cowboy Wireless LED Party HatšŸ˜

$29.99
$38.99
Save $9.00
const TAG = "spz-custom-product-automatic"; class SpzCustomProductAutomatic extends SPZ.BaseElement { constructor(element) { super(element); this.variant_id = '160707f5-4478-4f37-8a8c-08ca3b23ffd6'; 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 = 'ee99c894-2163-4a7d-82e7-b36b7bf9a2fc'; 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 == 'ee99c894-2163-4a7d-82e7-b36b7bf9a2fc' && 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 = 'ee99c894-2163-4a7d-82e7-b36b7bf9a2fc'; 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);
class SpzCustomDiscountFlashsale extends SPZ.BaseElement { constructor(element) { super(element); this.xhr_ = SPZServices.xhrFor(this.win); this.getFlashSaleApi = "\/api\/storefront\/promotion\/flashsale\/display_setting\/product_setting"; this.timer = null; this.variantId = "160707f5-4478-4f37-8a8c-08ca3b23ffd6"; // äæƒé”€ę“»åŠØę•°ę® this.flashsaleData = {} } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } buildCallback() { this.templates_ = SPZServices.templatesForDoc(); this.viewport_ = this.getViewport(); // ęŒ‚č½½bind函数 解决thisęŒ‡å‘é—®é¢˜ this.render = this.render.bind(this); this.resize = this.resize.bind(this); this.switchVariant = this.switchVariant.bind(this); } mountCallback() { // čŽ·å–ę•°ę® this.getData(); this.element.onclick = (e) => { const cur = this.win.document.querySelector(".app_discount_flashsale_desc"); const setting = this.flashsaleData.product_setting; const landingUrl = `/promotions/discount-default/${this.flashsaleData.discount_info.id}`; const finalUrl = appDiscountUtils.resolveDiscountHref(setting, landingUrl); if (finalUrl && appDiscountUtils.inProductBody(this.element) && e.target !== cur) { this.win.open(finalUrl, '_blank', 'noopener'); } } // ē»‘å®š this.viewport_.onResize(this.resize); // ē›‘å¬å­ę¬¾å¼åˆ‡ę¢ļ¼Œé‡ę–°ęø²ęŸ“ this.win.document.addEventListener('dj.variantChange', this.switchVariant); } unmountCallback() { // 解绑 this.viewport_.removeResize(this.resize); this.win.document.removeEventListener('dj.variantChange', this.switchVariant); // ęø…é™¤å®šę—¶å™Ø if (this.timer) { clearTimeout(this.timer); this.timer = null; } } resize() { if (this.timer) { clearTimeout(this.timer) this.timer = null; } this.timer = setTimeout(() => { this.render(); }, 200) } switchVariant(event) { const variant = event.detail.selected; if (variant.product_id == 'ee99c894-2163-4a7d-82e7-b36b7bf9a2fc' && variant.id != this.variantId) { this.variantId = variant.id; this.getData(); } } getData() { const reqBody = { product_id: "ee99c894-2163-4a7d-82e7-b36b7bf9a2fc", product_type: "default", variant_id: this.variantId } this.flashsaleData = {}; this.win.fetch(this.getFlashSaleApi, { method: "POST", body: JSON.stringify(reqBody), headers: { "Content-Type": "application/json" } }).then(async (response) => { if (response.ok) { this.flashsaleData = await response.json(); this.render(); } else { this.clearDom(); } }).catch(err => { this.clearDom(); }); } clearDom() { const children = this.element.querySelector('*:not(template)'); children && SPZCore.Dom.removeElement(children); } render() { this.templates_ .findAndRenderTemplate(this.element, { isMobile: appDiscountUtils.judgeMobile(), isRTL: appDiscountUtils.judgeRTL(), inProductDetail: appDiscountUtils.inProductBody(this.element), flashsaleData: this.flashsaleData, image_domain: this.win.SHOPLAZZA.image_domain, }) .then((el) => { this.clearDom(); this.element.appendChild(el); }) } } SPZ.defineElement('spz-custom-discount-flashsale', SpzCustomDiscountFlashsale);
Color
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-1651799308132').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

šŸ˜So cool!!! This shiny light up Cowboy Hat is a fun party accessory! šŸŽ‰

It has mesmerising two tone colour so in the light it will shine differently depending on the angle.Ā 


Plus when the lights are out, you can turn on the neon lights to keep the party going!Ā 

Has 3 light modes! Ā  Still, Fast Flashing, Slow Flashing.

Battery pack is attached at the top of the hat (inside) and will sit on top of your head when worn.Ā 

SPECIFICATIONS:

  • Power supply by 2 AA batteries (battery not included in package)
  • Material:Ā EVA+luminous wire+circuit board
  • Size:Average size, approximately 38x34x14CM

PACKAGE INCLUDES:

  • 1*Cowboy Wireless LED Party Hat*1

NOTES:

  • Please allow slight measurement deviations due to manual measurement.
  • Due to the different display and lighting effects, the actual color of the item may be slightly different from the color displayed in the picture.