UrCustomHUB - Arizona State Collection: Craft, Immerse, and Express Your Creativity

$25.99
Tax Included
Size : 3'
Tools() : With Tools
Quantity
const addToCartText = "Add to cart"; SPZCore.Dom.waitForChild( document.body, () => !!document.querySelector('[data-click="addToCart"], [role="addToCart"]'), () => { const addToCartEle = window.SPZCore.Dom.scopedQuerySelector( document.body, '[data-click="addToCart"], [role="addToCart"]' ); const getContentChild_ = function(el) { if(el) { const childs = el.childNodes; for (let i = childs.length - 1; i >= 0; i--) { const child = childs[i]; if (child.getAttribute && child.getAttribute('role') === 'content') { return child; } } } return; } const changeAddToCartText = function(text) { const contentEle = getContentChild_(addToCartEle); if(contentEle){ const addToCartChilds = addToCartEle.childNodes; for (let i = addToCartChilds.length - 1; i >= 0; i--) { const child = addToCartChilds[i]; if (typeof child.getAttribute !== 'function' || (child.getAttribute('role') !== 'content' && child.getAttribute('role') !== 'loading')) { addToCartEle.removeChild(child); } } }else{ addToCartEle.innerHTML = addToCartText; } } changeAddToCartText(addToCartText); } );
const SITE = (window.C_SETTINGS && window.C_SETTINGS.routes && window.C_SETTINGS.routes.root) || ''; const PRODUCT_PLAN_INFO_URL = `${SITE}/api/storefront/selling_plans/product_plan_info/:product_id`; const { i18nProductDetail, i18nProduct } = JSON.parse( document.querySelector('#i18n-json').textContent ); const currentI18nProduct = i18nProductDetail || i18nProduct; class SpzCustomSubscription extends SPZ.BaseElement { constructor(element) { super(element); this.productPlanInfo = null; this.cycle = null; this.optionid_ = null; this.form_ = null; this.variantId_ = null; this.variantChangeData = null; this.cycleList = [1,2]; this.productId = this.element.getAttribute('productId'); this.initialCycle = this.element.getAttribute('cycles'); this.noPlanShowTitle = JSON.parse(this.element.getAttribute('noPlanShowTitle')); } get initIsCycleSubscribe() { if(this.initialCycle == 2) { return true; } if(this.initialCycle == 1) { return false; } return null; } get productInfo() { let pJson = document.querySelector('#product-json'); if (pJson) { return JSON.parse(pJson.innerHTML); }else if(typeof $ === 'function' && typeof $(document).data === 'function') { return $(document).data('djproduct'); } return null; } get hasSKU() { if(this.productPlanInfo?.sku) { return true; } return false } get hasSPU() { if(this.productPlanInfo?.spu) { return true; } return false } get originalPrice() { if(!this.variantChangeData?.selected?.price){ return ''; }; return this.variantChangeData.selected.price; } get defaultPlanData() { if (!this.productPlanInfo) { return {}; } let planInfo = {}; if(this.hasSPU && this.productPlanInfo?.spu[this.productId]) { planInfo = this.productPlanInfo.spu[this.productId]; }else if(this.hasSKU && this.productPlanInfo?.sku[this.variantId_]) { planInfo = this.productPlanInfo.sku[this.variantId_]; } return planInfo; } get defaultCycle_() { if(!this.defaultPlanData) { return null; } return this.defaultPlanData.cycles; } get defaultOption_() { if(!this.defaultPlanData) { return null; } return this.defaultPlanData.selected_selling_plan_option_id; } get isCycleSubscribe() { if(this.cycle === 2) { return true; } if(this.cycle === 1) { return false; } return null; } get currentOption_() { if(!this.isCycleSubscribe){ return null; } if(!this.optionId_) { return this.defaultOption_; } return this.optionId_; } get currentPlanData() { if(!this.defaultPlanData) { return {}; } let result = Object.assign({},this.defaultPlanData); if(result.selected_selling_plan_option_id !== this.optionId_) { result.selected_selling_plan_option_id = this.optionId_; result.selling_plan_options = result.selling_plan_options.map(item => { return { ...item, selected_enabled: item.selling_plan_option_id === result.selected_selling_plan_option_id } }) } if (result.cycles !== this.cycle) { result.cycles = this.cycle; } return result; } fetchData_(product_id) { return SPZServices.xhrFor(this.win).fetchJson(PRODUCT_PLAN_INFO_URL.replace(/:product_id/gi, product_id)) .then((data) => { this.productPlanInfo = data; } ); } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } mountCallback() { console.log('subsciption-mountCallback'); this.initVariantId(); if(!!this.variantId_) { this.track_('product_view', this.initIsCycleSubscribe); } this.getElement_(); Promise.all([this.productInfoReady_(), this.fetchData_(this.productId)]).then(() => { this.init_(); this.initActions_(); this.showPlan_(false); if(!!this.variantId_){ this.changeBuyNowText(); this.dispatchSubScribeIdChange_(); } }); } productInfoReady_() { if(this.productInfo) { return Promise.resolve(); } SPZUtils.Event.listen(document,'load',()=> { if(this.productInfo) { return Promise.resolve(); }else{ return Promise.reject(); } }) } getElement_() { this.titleEle = SPZCore.Dom.scopedQuerySelector(document.body, '[role="plugin-subscription-title"]'); this.noPlanTipsEle = SPZCore.Dom.scopedQuerySelector(this.element, '[role="plugin-subscription-plan-tips"]'); this.noPaymentTipsEle = SPZCore.Dom.scopedQuerySelector(this.element, '[role="plugin-subscription-payment-tips"]'); this.renderEle = SPZCore.Dom.scopedQuerySelector(this.element, '[role="plugin-subscription-content-render"]'); this.productEle = SPZCore.Dom.scopedQuerySelector(document.body, '[data-section-type="product"], [data-section-type="product_detail"], [data-section-type="product_club"]') this.buyNowEle = SPZCore.Dom.scopedQuerySelector(this.productEle, '[data-click="submit"], [role="buyNow"]'); this.addToCartEle = SPZCore.Dom.scopedQuerySelector(this.productEle, '[data-click="addToCart"], [role="addToCart"]'); } init_() { this.cycle = this.defaultCycle_; this.optionId_ = this.defaultOption_; this.variantChangeData = this.productInfo; } initVariantId() { const formData = this.getFormData(); if (formData) { if(formData['variant_id'] && formData['variant_id'] !== 'undefined') { this.variantId_ = formData['variant_id']; }else{ this.variantId_ = '' } }else if(this.productInfo?.selected?.id){ this.variantId_ = this.productInfo.selected.id }else{ this.variantId_ = '' } } getFormData() { this.form_ = this.element.closest('form'); if(!this.form_) { return null; } const result = { quantity: 1, }; const formData = new FormData(this.form_); const formDataKey = formData.keys(); for (const key of formDataKey) { result[key] = formData.get(key); } return result; } showPlan_(rerender = false) { if (!this.variantId_) { return this.hide_(); } if (rerender) { this.renderPlan_(); } } renderPlan_() { if (Object.keys(this.currentPlanData).length === 0) { this.showNoPlanTips_(true); this.showNoPaymentTips_(false); this.showRender_(false); if(this.noPlanShowTitle) { this.showTitle_(true); }else{ this.showTitle_(false); } return; } this.showRender_(true); this.showNoPaymentTips_(true); this.showTitle_(true); this.showNoPlanTips_(false); const selectedPlanItem = this.currentPlanData.selling_plan_options.filter((item) => item.selected_enabled === true)[0]; SPZ.whenApiDefined(this.renderEle).then((apis) => { apis.render({ ...this.currentPlanData, originalPrice: this.originalPrice, selectedPlanItem }, false); }); } showTitle_(visible = true) { if(this.titleEle) { this.titleEle.toggleAttribute('hide', !visible); } } showNoPlanTips_(visible = true) { if(this.noPlanTipsEle) { this.noPlanTipsEle.toggleAttribute('hide', !visible); } } showNoPaymentTips_(visible = true) { if(this.noPaymentTipsEle){ this.noPaymentTipsEle.toggleAttribute('hide', !visible); } } showRender_(visible = true) { if(this.renderEle){ this.renderEle.toggleAttribute('hide', !visible); } } hide_() { this.showTitle_(false); this.element.toggleAttribute('hide', true); } show_() { this.showTitle_(true); this.element.toggleAttribute('hide', false); } dispatchSubScribeIdChange_() { this.dispatchEvent_('payment_ec_refresh', { sources: 'subscription' }); } dispatchEvent_(name, data) { const event = SPZUtils.Event.create(this.win, name, data, { bubbles: true }); this.element.dispatchEvent(event); } initActions_() { this.onVariantChange_(); this.element.addEventListener('change', (e) => { if(e.target?.role === 'plugin-subscription-option-selector') { this.onOptionChange_(e.target.value); } if(e.target?.role === 'plugin-subscription-option-card') { this.changeCardOption_(e.target.value); } }); this.registerAction( 'changeCycle', (invocation) => this.onCycleChange_(invocation.args?.selectedOptions[0]) ); this.registerAction('subscribeChange', (invocation) => { this.dispatchSubScribeIdChange_(invocation.args); }); this.addToCartEle.addEventListener('click', () => { this.track_('add_to_cart'); }); this.buyNowEle.addEventListener('click', () => { this.track_('add_to_cart'); }); this.submitInterrapt(); } onVariantChange_() { SPZUtils.Event.listen(document, 'dj.variantChange', (e) => { if(this.variantId_ === e.detail?.selected?.id) { return; } if(!this.variantId_ && e.detail?.selected?.id) { this.show_(); } this.variantId_ = e.detail.selected?.id; this.optionId_ = this.defaultOption_; this.cycle = this.defaultCycle_; this.variantChangeData = Object.assign(this.variantChangeData, e.detail); this.changeBuyNowText(); this.changeAddToCartText(e.detail); this.showPlan_(true); this.track_('product_view'); }); } onOptionChange_(op, render = true) { this.optionId_ = op; this.changeBuyNowText(); if(render) { this.showPlan_(true); } } onCycleChange_(val, render = true) { const cy = Number(val); if (this.cycleList.includes(cy)) { this.cycle = cy; this.changeBuyNowText(); if(render) { this.showPlan_(true); } } } submitInterrapt() { if(!this.form_) { window.djInterceptors.request.use((config) => { if(config?.url === '/api/cart') { return this.addToCartRequestData_(config); } if(config?.url === '/api/checkout/order') { return this.checkoutOrderRequestData_(config); } }) } } addToCartRequestData_(config) { const cartConfig = { ...config }; const hasProductId = cartConfig?.body?.product_id; const hasVariantId = cartConfig?.body?.variant_id; if(cartConfig?.method == 'POST' && hasProductId && hasVariantId) { if (!cartConfig.body.properties) { cartConfig.body.properties = {}; } if(this.currentOption_) { cartConfig.body.properties = { ...cartConfig.body.properties, _selling_plan_option_id: this.currentOption_ } } } return cartConfig; } checkoutOrderRequestData_(config) { const orderConfig = { ...config }; const hasVariantId = orderConfig?.body?.line_items[0]?.variant_id; if(orderConfig?.method == 'POST' && hasVariantId) { if (!orderConfig.body.line_items[0].properties) { orderConfig.body.line_items[0].properties = {}; } if(this.currentOption_) { orderConfig.body.line_items[0].properties = { ...orderConfig.body.line_items[0].properties, _selling_plan_option_id: this.currentOption_ } } } return orderConfig; } changeCardOption_(val) { const oneTimeInputEle = document.querySelector('.one-time [role=plugin-subscription-option-card]'); if(val == 0) { this.onCycleChange_(1, true); oneTimeInputEle.toggleAttribute('disabled',true); return; } oneTimeInputEle.toggleAttribute('disabled',false); this.onCycleChange_(2, false); this.onOptionChange_(val, true); } getContentChild_(el) { if(el) { const childs = el.childNodes; for (let i = childs.length - 1; i >= 0; i--) { const child = childs[i]; if (child.getAttribute && child.getAttribute('role') === 'content') { return child; } } } return; } changeBuyNowText() { let buyNowText = currentI18nProduct.buy_now; let subscribeText = "Subscribe"; const contentEle = this.getContentChild_(this.buyNowEle); // 1. 有role="content"的元素,替换role="content"的元素 if(contentEle) { contentEle.innerHTML = this.isCycleSubscribe ? subscribeText : buyNowText; }else{ // 2. 不存在role="content"的元素,直接替换文本 this.buyNowEle.innerHTML = this.isCycleSubscribe ? this.buyNowEle.innerHTML.replace(buyNowText, subscribeText) : this.buyNowEle.innerHTML.replace(subscribeText, buyNowText); } } changeAddToCartText(data) { const contentEle = this.getContentChild_(this.addToCartEle); // 1. 有role="content"的元素,移除role不等于content和loading的元素 if(contentEle) { const addToCartChilds = this.addToCartEle.childNodes; for (let i = addToCartChilds.length - 1; i >= 0; i--) { const child = addToCartChilds[i]; // 移除元素(role不等于content和loading) if (typeof child.getAttribute !== 'function' || (child.getAttribute('role') !== 'content' && child.getAttribute('role') !== 'loading')) { this.addToCartEle.removeChild(child); } } }else{ // 2. 不存在role="content"的元素,直接替换文本 const addToCartText = this.getAddToCartText_(data); this.addToCartEle.innerHTML = addToCartText; } } getAddToCartText_(data) { const selected = data?.selected; const productAvailable = data?.product?.available; const variantAvailable = data?.selected?.available; const variantId = data?.selected?.id; let text = currentI18nProduct.add_to_cart; if (!productAvailable) { text = currentI18nProduct.sold_out; } if (selected && !variantId) { text = currentI18nProduct.unavailable; } if (productAvailable && selected && variantId && !variantAvailable) { text = currentI18nProduct.sold_out; } return text; } track_(eventName, optionSelected = this.isCycleSubscribe) { if(window && window.sa && typeof window.sa.registerExtraInfo === 'function') { window.sa.registerExtraInfo(eventName, { function_name: "product_subscription", module: "apps", option_selected: optionSelected }, optionSelected === null); } } } SPZ.defineElement('spz-custom-subscription', SpzCustomSubscription);
Purchase options:
One-Time Purchase
$25.99
Subscribe
Skip ,modify or cancel any time
Tax Included
Secure Payments
Sustainably Made
Worldwide Shipping
Embroidery Journey Rankings

Explore Our Embroidery Series

Whether you are just starting out or looking to challenge yourself with more complex projects, we have a series tailored for every skill level. Discover the perfect kit to enhance your embroidery journey:

  • Beginner Embroidery Basics: Ideal for newcomers, explore fundamental techniques with easy-to-follow patterns. Explore Beginner Basics

  • Advanced Embroidery Techniques: Ready to advance? Dive into more sophisticated projects and refine your skills. Explore Advanced Techniques

  • Master Embroidery Crafts: For those who have mastered advanced techniques, these kits offer complex patterns that challenge and inspire. Explore Master Crafts

  • Ultimate Embroidery Artisan: Attain the pinnacle of embroidery craftsmanship with our most intricate and demanding designs. Explore Ultimate Artisan

Each link can be customized to direct customers to the respective series page, enabling easy navigation and encouraging exploration of your product range.

Embroidery FAQs

Frequently Asked Questions

I’ve never embroidered before. Can I still do this?

Absolutely! Our kits are designed with beginners in mind. Every kit comes with step-by-step instructions to guide you. If you've never used a needle and thread, it might take a little time to get comfortable, but don't worry. Just keep your thread length under 18 inches to avoid tangling, and make sure to pull the thread all the way through. Start with the simple straight stitches recommended in the guide, and as you get more comfortable, you can build on the skills you’ve learned.

What can I do with my finished project?

There are so many ways to showcase your work! You can leave it in the hoop and hang it up, or get a frame with a circular cutout and glass cover for a polished look. Personally, I love finishing the design in a nice hoop and displaying it on a plate stand or a small easel. It's perfect for adding a personal touch to styled spaces around the house.

Will the printed pattern wash out when I clean the finished embroidery?

Yes, the printed design on our fabric will disappear when exposed to high heat, such as from an iron, or when washed. This allows for a cleaner, professional presentation of your finished piece. However, we recommend avoiding heat or washing the fabric until your embroidery is fully complete to ensure the pattern stays visible as you work.

What’s the difference between your kits and water-soluble fabric products?

Our water-soluble fabric products are designed for more experienced embroiderers who want greater creative freedom. Unlike the kits, which come with instructions, fabric prints, and all the tools you need, the water-soluble fabric gives you the flexibility to stitch your designs onto any material, such as backpacks or tablecloths. These products do not include instructions or tools, but you can purchase the necessary items separately.

Do you offer downloadable PDF patterns?

Currently, we do not offer PDF patterns. Our products are designed as physical kits to give you a complete and enjoyable hands-on crafting experience.

I see an option to add scissors and a needle minder to my order. Do I really need these?

You don’t necessarily need the needle minder, but it’s a helpful accessory. It attaches to your work in progress with a magnet and keeps your needle in place when you need to put it down. As for scissors, you will need them, but any small scissors you already have will work. Our scissors are the perfect size for fitting inside the storage tin that comes with each kit, and having an extra pair is always handy if you're working on multiple projects.

Description

The State Collection: Craft, Immerse, and Express Your Creativity

For more embroidery options, please visit our DIY Embroidery Collection

For more state embroidery options, please visit our State EmbroiderEase

Introducing the State Collection, our exquisite line of water-soluble embroidery kits crafted for the creative spirit in everyone. Choose from a charming array of state-themed designs and bring a personal touch to your garments with ease.

Distinct Features of Our State EmbroiderEase Embroidery Kit:

  • DIY Personalization: Delight in the art of embroidery as you stitch the iconic outline of your state and its state flower onto your clothing, creating a custom piece that showcases your love for the State.

  • Water-Soluble Innovation: Our revolutionary water-soluble fabric allows you to easily dissolve away the base material, leaving only your beautiful embroidery intact on your fabric of choice.

  • Varied Size Options: Available in three sizes—3 inches, 5 inches, and 7 inches—this kit provides flexibility for your project needs.

  • High-Quality Threads: Each kit comes with premium threads in a variety of colors, ensuring your embroidered designs are vibrant and long-lasting.

Your Kit, Your Story:

  • Crafting Made Simple: Transform your apparel with a few simple stitches and a dip in water for embroidery that's uniquely yours.

  • Gift of Handmade Charm: Present a heartfelt gift that’s enjoyable to make and even more special to receive, perfect for friends and loved ones who share your connection to your state.

Ideal For:

  • Individuals seeking a creative outlet and a unique way to personalize their wardrobe with a nod to your state.
  • Meaningful gifts that engage and inspire, allowing the recipient to craft their own narrative.
  • DIY enthusiasts who appreciate the simplicity and beauty of hand-stitched designs.

Note: Each State EmbroiderEase kit includes only the water-soluble fabric. Tools (threads, needles and hoop) are not included and should be sourced separately. Our water-soluble embroidery fabric products are designed to let users create their own unique designs, encouraging creativity by allowing users to experiment with different stitches and thread colors to craft one-of-a-kind pieces.

Stitch It, Soak It, Showcase It:

Embrace the chance to wear your art on your sleeve (quite literally!). The EmbroiderEase Collection invites you to make a statement with your clothing, turning everyday items into canvases for your creativity.

Eco-Friendly Fabric, Sustainable Choice:

Our water-soluble fabric products are crafted using an innovative blend of PVA (Polyvinyl Alcohol) and corn starch. This combination merges the durability of synthetic polymers with the eco-friendly nature of natural materials, ensuring our products are not only high-performing but also kind to the environment.

We Support Your Craft:

At Service@UrCustomHUB.com, we stand by to support your embroidery journey. Whether you're stitching your first pattern or adding to your collection of custom apparel, we're here to ensure your project is a success.

Discover Monthly Embroidery Delights – Join the Journey!

Embroidery Journey Monthly Subscription Plan – Enrich Your Life with Threads and Needles

  • Creative Space for Handicraft Lovers

    • Embark on a journey of beauty, art, and personal growth with our DIY Embroidery Kit Monthly Subscription.
  • Monthly Surprises, Endless Creativity

    • Receive a curated embroidery package at the start of each month.
    • Each kit is selected from over 200 exquisite top-selling designs, blending modern trends with timeless classics.
  • Unbeatable Value, Exclusive Experience

    • Enjoy each embroidery kit at just 50% of its retail price—more quality crafting for less!
  • Flexible Subscription, Total Control

    • Cancel or change your plan anytime, hassle-free.
  • Seasonal Blooms, Warm Companions

  • Holiday Specials, Shared Joy

  • Birthday Delights, Personalized Treats

    • Share your birthday with us and receive a personalized gift as a token of our appreciation.
  • 24/7 Dedicated Customer Service

    • Our customer support team is here for you around the clock, ensuring your satisfaction.
  • Start Your Embroidery Journey Today!

    • Join our community of passionate crafters and enrich your life through the art of embroidery.
    • Build your skills, decorate your home, and create meaningful, handcrafted gifts.

Need Assistance?

  • Contact us at service@urcustomhub.com for help or to customize your Christmas embroidery kit. We ensure a merry and bright crafting experience!
class SpzSmartBlockComponent extends SPZ.BaseElement { constructor(element) { super(element); this.templates_ = null; this.container_ = null; this.i18n_ = {}; this.config_ = {}; this.show_type_ = 3; this.product_resource_id_ = ''; this.collection_resource_id_ = ''; this.cart_items_ = []; this.customer_id_ = ''; this.order_id_ = ''; } static deferredMount() { return false; } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } buildCallback() { const template_type = window.SHOPLAZZA.meta.page.template_type; if (template_type === 1) { this.show_type_ = 3; this.product_resource_id_ = window.SHOPLAZZA.meta.page.resource_id; } else if (template_type === 2) { this.show_type_ = 4; this.collection_resource_id_ = window.SHOPLAZZA.meta.page.resource_id; } else if (template_type === 15){ this.show_type_ = 5; } else if (template_type === 13){ this.show_type_ = 6; } else if (template_type === 20){ this.show_type_ = 7; this.customer_id_ = window.SHOPLAZZA.customer.customer_id; } else if (template_type === 35){ this.show_type_ = 8; this.order_id_ = window.location.pathname.split('/').pop(); } this.templates_ = SPZServices.templatesForDoc(this.element); this.setAction_(); } mountCallback() { console.log('appzebu smart mounted'); const that = this; const themeName = window.SHOPLAZZA.theme.merchant_theme_name; const isGeek = /Geek/.test(themeName); this.fetchRules().then((res) => { if (res && res.rules && res.rules.length) { const blockEl = document.getElementById('smart_recommend_block'); SPZ.whenApiDefined(blockEl).then((api) => { api.render({data: res}, true).then(() => { if (isGeek && that.show_type_ === 6) { blockEl.querySelector('.plugin_container_wrpper').style.padding = '30px 0'; } const recommendStyle = document.createElement('style'); recommendStyle.innerHTML = ` .plugin__recommend_container,.app-recommend-card { display: none !important; } `; document.head.appendChild(recommendStyle); const fetchList = []; res.rules.forEach((rule) => { fetchList.push(this.fetchRuleProductList(rule.id)); }); const fetchAll = Promise.all(fetchList); fetchAll.then((p_res) => { res.rules.forEach((rule, index) => { rule.products = p_res[index] && p_res[index].products; const ruleEl = document.getElementById('smart_recommend_rule_' + rule.id); SPZ.whenApiDefined(ruleEl).then((api) => { api.render({data: rule}, true).then(() => { that.impressListen(`#smart_recommend_rule_ul_${rule.id}`, function(){ that.trackRuleImpress(rule); }); const btnElList = document.querySelectorAll(`#smart_recommend_rule_ul_${rule.id} button`); btnElList.forEach((btnEl) => { if (btnEl && rule.config && rule.config.quick_shop_button_bg_color && rule.config.quick_shop_button_text_color) { btnEl.style.backgroundColor = rule.config.quick_shop_button_bg_color; btnEl.style.color = rule.config.quick_shop_button_text_color; } }) }); }); }); }); }) }) } else { if (window.top !== window.self) { const template_type = window.SHOPLAZZA.meta.page.template_type; const holderEl = document.getElementById('smart_recommend_preview_no_data_placeholder'); SPZ.whenApiDefined(holderEl).then((api) => { api.render({data: { isCart: template_type === 13, isCollection: template_type === 2, isProduct: template_type === 1, isIndex: template_type === 15 }}, true); }); } } }); } setAction_() { this.registerAction('quickShop', (data) => { const that = this; const product_id = data.args.product_id; const productIndex = data.args.productIndex; const rule_id = data.args.rule_id; const ssp = data.args.ssp; const scm = data.args.scm; const cfb = data.args.cfb; const ifb = data.args.ifb; const modalRender = document.getElementById('smart_recommend_product_modal_render'); if (product_id) { this.fetchProductData(product_id).then((res) => { const product = res.products && res.products.length && res.products[0] || {}; product.cfb = cfb; product.ifb = ifb; SPZ.whenApiDefined(modalRender).then((api) => { api.render({product: product, productIndex: productIndex, rule_id: rule_id, ssp: ssp, scm: scm, show_type: that.show_type_}, true).then(() => { const modalEl = document.getElementById('smart_recommend_product_modal'); SPZ.whenApiDefined(modalEl).then((modal) => { that.impressListen('#smart_recommend_product_modal', function(){ that.trackQuickShop({ rule_id: rule_id, product_id: product_id }); }); modal.open(); }); const formEl = document.getElementById('smart_recommend_product_form'); SPZ.whenApiDefined(formEl).then((form) => { form.setProduct(product); }); const variantEl = document.getElementById('smart_recommend_product_variants'); SPZ.whenApiDefined(variantEl).then((variant) => { variant.handleRender(product); }); }); }) }); } }); this.registerAction('handleScroll', (data) => { this.directTo(data.args.rule_id, data.args.direction); }); this.registerAction('handleProductChange', (data) => { const variant = data.args.data.variant; const product = data.args.data.product; const imageRenderEl = document.getElementById('smart_recommend_product_image'); SPZ.whenApiDefined(imageRenderEl).then((api) => { api.render({ variant: variant, product: product }, true); }); }); this.registerAction('handleAtcSuccess', (detail) => { const data = detail.args; data.data.product = data.data.product || {}; data.data.variant = data.data.variant || {}; const product_id = data.data.product.id; const product_title = data.data.product.title; const variant_id = data.data.variant.id; const price = data.data.variant.price; const rule_id = data.rule_id; const aid = `smart_recommend.${this.show_type_}.${rule_id}`; const ifb = data.data.product.ifb; const cfb = data.data.product.cfb; const ssp = data.ssp; const scm = data.scm; const spm = `smart_recommend_${this.show_type_}.${data.spmIndex}`; const params = { id: product_id, product_id: product_id, number: 1, name: product_title, variant_id: variant_id, childrenId: variant_id, item_price: price, source: 'add_to_cart', _extra: { aid: aid, ifb: ifb, cfb: cfb, scm: scm, spm: `..${window.SHOPLAZZA.meta.page.template_name}.${spm}`, ssp: ssp, } }; this.tranckAddToCart(params); }); this.registerAction('addATCHook', (data) => { const params = data.args; const spm = `smart_recommend_${this.show_type_}.${params.spmIndex}`; this.myInterceptor_ = window.djInterceptors && window.djInterceptors.track.use({ event: 'dj.addToCart', params: { aid: `smart_recommend.${this.show_type_}.` + params.rule_id, ssp: params.ssp, scm: params.scm, cfb: params.cfb, spm: `..${window.SHOPLAZZA.meta.page.template_name}.${spm}`, }, once: true }); }); } tranckAddToCart(detail) { if (window.$) { window.$(document.body).trigger('dj.addToCart', detail); } } fetchRules() { const payload = { show_type: this.show_type_, }; let that = this; if (this.show_type_ === 6) { let line_items = []; return this.fetchCart().then((res) => { if (res && res.cart && res.cart.line_items) { line_items = res.cart.line_items.map((item) => { return { product_id: item.product_id, variant_id: item.variant_id, quantity: item.quantity, price: item.price } }); } payload.line_items = line_items; that.cart_items_ = line_items; return that.fetchRulesRequest(payload); }); } else { if (this.show_type_ === 3) { payload.line_items = [{ product_id: this.product_resource_id_ }]; } else if (this.show_type_ === 4) { payload.collection_id = this.collection_resource_id_; } else if (this.show_type_ === 7) { payload.customer_id = this.customer_id_; } else if (this.show_type_ === 8) { payload.order_id = this.order_id_; } return this.fetchRulesRequest(payload); } } fetchRulesRequest(payload) { return fetch(window.SHOPLAZZA.routes.root + "/api/possum/recommend_query", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).then(function(res){ if(res.ok){ return res.json(); } }); } fetchCart() { return fetch(`/api/cart/cart-select?r=${Math.random().toString(36).slice(-4)}`) .then((res) => { if (res.ok) { return res.json(); } }); } fetchRuleProductList(rule_id) { const payload = { page: 1, limit: 100, fields: ["title", "url", "image", "min_price_variant.price", "min_price_variant.compare_at_price"], rule_id: rule_id, }; if (this.show_type_ === 3) { payload.line_items = [{ product_id: this.product_resource_id_ }]; } else if (this.show_type_ === 4) { payload.collection_id = this.collection_resource_id_; } else if (this.show_type_ === 6) { payload.line_items = this.cart_items_; } else if (this.show_type_ === 7) { payload.customer_id = this.customer_id_; } else if (this.show_type_ === 8) { payload.order_id = this.order_id_; } return fetch(window.SHOPLAZZA.routes.root + "/api/possum/recommend_products", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).then(function(res){ if(res.ok){ return res.json(); } }).catch(function(err){ console.log(err); }); } fetchProductData(product_id) { return fetch(window.SHOPLAZZA.routes.root + "/api/possum/products", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ product_ids: [product_id], fields: [ "images", "options", "min_price_variant", "variants"] }) }).then(function(res){ if(res.ok){ return res.json(); } }).catch(function(err){ console.log(err); const loadingEl = document.getElementById('smart_recommend_loading'); if (loadingEl) { loadingEl.style.display = 'none'; } }); } getStyle(ele, style) { if (!ele) return; if (window.getComputedStyle) { return window.getComputedStyle(ele)[style]; } return ele.currentStyle[style]; } directTo(id, direction) { const scrollElement = document.getElementById(`smart_recommend_rule_ul_${id}`); const blockWidth = parseInt(this.getStyle(scrollElement, 'width')); const scrollLength = (blockWidth * 0.19 - 12) * 5; const scrollPoint = scrollElement.scrollWidth - scrollElement.clientWidth; if (!scrollElement) return; if (direction === 'left') { if (document.dir === 'rtl') { scrollElement.scrollTo({ left: Math.abs(scrollElement.scrollLeft) >= scrollPoint - 100 ? 0 : scrollElement.scrollLeft - scrollLength, behavior: 'smooth' }); return; } scrollElement.scrollTo({ left: Math.max(scrollElement.scrollLeft - scrollLength, 0), behavior: 'smooth' }); } else { if (document.dir === 'rtl') { scrollElement.scrollTo({ left: Math.abs(scrollElement.scrollLeft) >= scrollPoint + 100 ? 0 : scrollElement.scrollLeft + scrollLength, behavior: 'smooth' }); return; } scrollElement.scrollTo({ left: scrollElement.scrollLeft >= scrollPoint - 100 ? 0 : scrollElement.scrollLeft + scrollLength, behavior: 'smooth' }); } } trackRuleImpress(rule) { if (window.sa && window.sa.track) { window.sa.track("plugin_common", { plugin_name: "upsell", event_type: "impressions", rule_id: rule.id, ssp: rule.ssp, scm: rule.scm, show_type: this.show_type_, support_app_block: window.SHOPLAZZA.theme.support_app_block }); window.sa.track("module_impressions", { aid: `smart_recommend.${this.show_type_}.${rule.id}`, support_app_block: window.SHOPLAZZA.theme.support_app_block }); } } trackQuickShop(data) { window.sa && sa.track && sa.track("plugin_common", { plugin_name: "upsell", event_type: "quick_shop", rule_id: data.rule_id, product_id: data.product_id, show_type: this.show_type_, }); } impressListen(selector, cb) { const el = document.querySelector(selector); const onImpress = (e) => { if (e) { e.stopPropagation(); } cb(); }; if (el && !el.getAttribute('imprsd')) { el.addEventListener('impress', onImpress) } else if (el) { onImpress(); } } } SPZ.defineElement('spz-custom-smart-block', SpzSmartBlockComponent);
Customer Reviews

Here are what our customers say.

Write a Review
Customer Reviews
Wow you reached the bottom
Newest
Most liked
Highest ratings
Lowest ratings
×
class SpzCustomFileUpload extends SPZ.BaseElement { constructor(element) { super(element); this.uploadCount_ = 0; this.fileList_ = []; } buildCallback() { this.action = SPZServices.actionServiceForDoc(this.element); this.registerAction('upload', (data) => { this.handleFileUpload_(data.event?.detail?.data || []); }); this.registerAction('delete', (data) => { this.handleFileDelete_(data?.args?.data); }); this.registerAction('preview', (data) => { this.handleFilePreview_(data?.args?.data); }); this.registerAction('limit', (data) => { this.handleFileLimit_(); }); this.registerAction('sizeLimit', (data) => { this.handleFileSizeLimit_(); }); } isLayoutSupported(layout) { return layout == SPZCore.Layout.LOGIC; } setData_(count, file) { this.uploadCount_ = count; this.fileList_ = file; } handleFileUpload_(data) { data.forEach(i => { if(this.fileList_.some(j => j.url === i.url)) return; this.fileList_.push(i); }) this.uploadCount_++; sessionStorage.setItem('fileList', JSON.stringify(this.fileList_)); this.triggerEvent_("handleFileUpload", { count: this.uploadCount_, files: this.fileList_}); if(this.fileList_.length >= 5){ document.querySelector('#review_upload').style.display = 'none'; } if(this.fileList_.length > 0){ document.querySelector('.apps-reviews-write-anonymous-box').style.marginTop = '8px'; } } handleFileDelete_(index) { this.fileList_.splice(index, 1); this.uploadCount_--; sessionStorage.setItem('fileList', JSON.stringify(this.fileList_)); this.triggerEvent_("handleFileDelete", { count: this.uploadCount_, files: this.fileList_}); document.querySelector('#review_upload').style.display = 'block'; if(this.fileList_?.length === 0){ document.querySelector('.apps-reviews-write-anonymous-box').style.marginTop = '132px'; } } handleFilePreview_(index) { const finalPreviewData = this.fileList_[index]; const filePreviewModal = document.getElementById('filePreviewModal'); const fullScreenVideo = document.getElementById('fullScreenVideo'); const fullScreenImage = document.getElementById('fullScreenImage'); const previewModalClose = document.getElementById('previewModalClose'); const previewLoading = document.getElementById('previewLoading'); filePreviewModal.style.display = 'block'; previewLoading.style.display = 'flex'; if(finalPreviewData?.type === 'video'){ const media = this.mediaParse_(this.fileList_[index]?.url); fullScreenVideo.addEventListener('canplaythrough', function() { previewLoading.style.display = 'none'; }); fullScreenImage.src = ''; fullScreenImage.style.display = 'none'; fullScreenVideo.style.display = 'block'; fullScreenVideo.src = media.mp4 || ''; } else { fullScreenImage.onload = function() { previewLoading.style.display = 'none'; }; fullScreenVideo.src = ''; fullScreenVideo.style.display = 'none'; fullScreenImage.style.display = 'block'; fullScreenImage.src = finalPreviewData.url; } previewModalClose.addEventListener('click', function() { filePreviewModal.style.display = 'none'; }); } handleFileLimit_() { alert(window.AppReviewsLocale.comment_file_limit || 'please do not upload files more than 5'); this.triggerEvent_("handleFileLimit"); } handleFileSizeLimit_() { alert(window.AppReviewsLocale.comment_file_size_limit || 'File size does not exceed 10M'); } clear(){ this.fileList_ = []; this.uploadCount_ = 0; sessionStorage.setItem('fileList', JSON.stringify(this.fileList_)); this.triggerEvent_("handleClear", { count: this.uploadCount_, files: this.fileList_}); document.querySelector('#review_upload').style.display = 'block'; } mediaParse_(url) { var result = {}; try { url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (str, key, value) { try { result[key] = decodeURIComponent(value); } catch (e) { result[key] = value; } }); result.preview_image = url.split('?')[0]; } catch (e) {}; return result; } triggerEvent_(name, data) { const event = SPZUtils.Event.create(this.win, name, data); this.action.trigger(this.element, name, event); } } SPZ.defineElement('spz-custom-file-upload', SpzCustomFileUpload);
The review would not show in product details on storefront since it does not support to.