@kachingappz/bundles-js 1.1.9 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -266,5 +266,5 @@ var BundlesJs=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Mo
266
266
  }
267
267
  }
268
268
  }
269
- `,{variables:{collectionGIDs:i}});return[...new Set(o.nodes.filter(e=>e!==null).flatMap(e=>e.products.nodes).filter(e=>!e.variants.nodes.some(e=>e.requiresComponents)).map(e=>e.id))]},O=e=>[...k(e),...A(e),...j(e),...M(e),...N(e),...ee(e),...te(e),...ne(e),...re(e),...ie(e),...ae(e),...oe(e),...se(e)].filter(e=>e!=null&&!e.includes(`placeholder`)),k=e=>e.dealBars.flatMap(e=>[e.mediaImageGID,e.badgeImageGID]).filter(e=>e!=null),A=e=>e.dealBars.flatMap(e=>e.dealBarType===f.Bundle?e.bundleProducts.map(e=>e.mediaImageGID):[]).filter(e=>e!=null),j=e=>e.dealBars.map(({freeGifts:e})=>(e||[]).map(e=>e.mediaImageGID)).reduce((e,t)=>e.concat(t),[]).filter(e=>e!=null),M=e=>e.dealBars.flatMap(({multipleGiftsSelectors:e})=>(e||[]).map(e=>e.mediaImageGID)).filter(e=>e!=null),N=e=>e.dealBars.map(({upsells:e})=>(e||[]).map(e=>e.mediaImageGID)).reduce((e,t)=>e.concat(t),[]).filter(e=>e!=null),ee=e=>e.swatchOptions?e.swatchOptions.reduce((e,t)=>{let n=t.images.map(e=>e.mediaImageGID).filter(e=>e!=null);return[...e,...n]},[]):[],te=e=>{if(!e.collectionBreaksEnabled||!e.collectionBreaks)return[];let t=e.collectionBreaks.mediaImageGID;return t?[t]:[]},ne=e=>e.progressiveGifts?[...e.progressiveGifts.gifts?.map(e=>e.mediaImageGID)||[],e.progressiveGifts.style?.lockedMediaImageGID,e.progressiveGifts.dealBarStyle?.lockedMediaImageGID].filter(e=>e!=null):[],re=e=>!e.checkboxUpsellsEnabled||!e.checkboxUpsells?[]:e.checkboxUpsells.upsells.flatMap(e=>[e.mediaImageGID,e.badgeImageGID]).filter(e=>e!=null),ie=e=>e.dealBars.map(e=>e.productPersonalisation?.mediaImageGID).filter(e=>e!=null),ae=e=>{let t=e.dealBars.map(e=>e.highlights?.customIconGID).filter(e=>e!=null),n=e.subscriptions?.highlights?.customIconGID;return n?[...t,n]:t},oe=e=>(e.badges||[]).flatMap(e=>e.badgeType===`custom`&&e.imageGID?[e.imageGID]:[]),se=e=>!e.savingsSummaryEnabled||!e.savingsSummary?[]:e.savingsSummary.customIconGID?[e.savingsSummary.customIconGID]:[],ce=(e,{includeMixAndMatchSwapProducts:t=!0}={})=>{let n=[...le(e),...ue(e),...de(e),...P(e),...F(e),...I(e,t),...L(e),...R(e)];return Array.from(new Set(n.filter(e=>e!=null)))},le=e=>e.dealBars.flatMap(({freeGifts:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null),ue=e=>e.dealBars.flatMap(({multipleGiftsSelectors:e})=>e?e.flatMap(e=>e.products?e.products.map(e=>e.id):[]):[]).filter(e=>e!=null),de=e=>e.progressiveGiftsEnabled&&e.progressiveGifts?.gifts.map(e=>e.productGID).filter(e=>e!=null)||[],P=e=>e.dealBars.flatMap(({upsells:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null),F=e=>e.dealBars.filter(e=>e.dealBarType===f.Bundle).flatMap(({bundleProducts:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null).filter(e=>e!=="default"),I=(e,t)=>e.dealBars.filter(e=>e.dealBarType===f.MixAndMatch).flatMap(({bundleProducts:e})=>e?e.flatMap(e=>[e.productGID,...t?e.selectedProducts?.map(e=>e.id)??[]:[]]):[]).filter(e=>e!=null).filter(e=>e!=="default"),L=e=>!e.checkboxUpsellsEnabled||!e.checkboxUpsells?[]:e.checkboxUpsells.upsells.map(e=>e.productGID).filter(e=>e!=null),R=e=>e.dealBars.filter(e=>e.dealBarType===f.Sku).flatMap(({productGID:e})=>e?[e]:[]),z=class extends Error{constructor({status:e,operationName:t,graphqlErrors:n}){let r=n.length?`: ${n.join(`; `)}`:``;super(`Storefront API ${t??`query`} failed (HTTP ${e})${r}`),this.name=`StorefrontApiError`,this.status=e,this.operationName=t,this.graphqlErrors=n}},B=async(e,t)=>{let n=await e.text();if(!n)throw Error(`Empty graphql response`);let r;try{r=JSON.parse(n)}catch(n){throw e.ok?n:new z({status:e.status,operationName:t,graphqlErrors:[]})}if(!e.ok||r.data===null||r.data===void 0)throw new z({status:e.status,operationName:t,graphqlErrors:(r.errors??[]).map(({message:e})=>e).filter(Boolean)});return r.data},V=class{constructor(e,t){this.storefrontApiVersion=`2026-07`,this.storefrontAccessToken=t,this.shopifyDomain=e}async query(e,t){let n=t?.variables??{},r=`https://${this.shopifyDomain}/api/${this.storefrontApiVersion}/graphql.json`,i=e.match(/query\s+(\w+)/)?.[1];return i&&(r+=`?operation_name=${i}`),B(await fetch(r,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Shopify-Storefront-Access-Token":this.storefrontAccessToken},body:JSON.stringify({query:e,variables:n})}),i)}},H=(e,t)=>{let n=[],r=e.filter(e=>e.blockVisibility===`selected-products`);for(let e of r)e.selectedProductIds.map(Number).includes(t.id)&&n.push(e);let i=e.filter(e=>e.blockVisibility===`selected-collections`);for(let e of i)t.collectionIds.some(t=>e.selectedCollectionIds.map(Number).includes(t))&&n.push(e);let a=e.filter(e=>e.blockVisibility===`excluded-products`);for(let e of a)!e.excludedProductIds.map(Number).includes(t.id)&&!(e.excludedCollectionIds||[]).some(e=>t.collectionIds.includes(e))&&n.push(e);let o=e.filter(e=>e.blockVisibility===`all-products`);for(let e of o)n.push(e);return n},fe=async(e,t,{country:n,language:r})=>{let i=t.collectionBreaks;if(!t.collectionBreaksEnabled||!i)return;let a;a=i.visibility===`deal-products`?await p(e,{country:n,language:r,blockVisibility:t.blockVisibility,excludedProductGIDs:(t.excludedProductIds||[]).map(e=>`gid://shopify/Product/${e}`),selectedProductGIDs:(t.selectedProductIds||[]).map(e=>`gid://shopify/Product/${e}`),selectedCollectionGIDs:(t.selectedCollectionIds||[]).map(e=>`gid://shopify/Collection/${e}`)}):await p(e,{country:n,language:r,blockVisibility:i.visibility,excludedProductGIDs:(i.excludedProducts||[]).map(({id:e})=>e),selectedProductGIDs:(i.selectedProducts||[]).map(({id:e})=>e),selectedCollectionGIDs:(i.selectedCollections||[]).map(({id:e})=>e)});let o=await h(e,{country:n,language:r,productIds:a.map(e=>Number(e.split(`/`).pop())),useExternalMetafieldNamespace:!0}),s=i.visibility===`deal-products`&&t.blockVisibility===`excluded-products`;return o=o.filter(e=>e.availableForSale&&(!s||H([t],e).length>0)),o},pe=({language:e,dealBlockId:t})=>{let n={"system.out_of_stock":`There's not enough items in our stock, please select smaller bundle.`,"system.invalid_variant":`Sorry, this is not currently available.`,"system.unavailable_option_value":`Unavailable`,"system.confirm":`Confirm`,"system.cancel":`Cancel`,"system.free":`FREE`,"system.search":`Search`,"system.quantity":`Quantity`,"system.subscription_plan":`Subscription plan`,"system.remove":`Remove`,"system.sort_by":`Sort by`,"system.sort_relevance":`Relevance`,"system.sort_newest_first":`Newest first`,"system.sort_price_low_to_high":`Price: Low → High`,"system.sort_price_high_to_low":`Price: High → Low`,"system.no_results_found":`No results found`,"system.no_results_description":`We can't find any item matching your search.`,"system.clear_search":`Clear search`,"system.no_products_available":`No products available`,"system.original_price":`Original price:`,"system.price":`Price:`,"system.letters_only":`Only letters are allowed.`,"system.numbers_only":`Only numbers are allowed.`,"system.personalisation_required_alert":`Please add personalisation for every item to continue.`,"system.gifts_required_alert":`Please choose your free gifts`},r=e?me(e):void 0;return{...n,...r?.system,...r?.dealBlocks[t]}},me=e=>{if(typeof document>`u`)return;let t=document.querySelector(`script#kaching-bundles-translations`);if(!t?.textContent)return;let n;try{n=JSON.parse(t.textContent)}catch{return}let r=U(e);return n.find(e=>U(e.locale)===r)?.translations},U=e=>e.toLowerCase().replace(/_/g,`-`),he=`2026-07`,W=async(e,{productId:t,dealBlockId:n,abTestVariantId:r,country:i=void 0,language:a=void 0})=>{try{let o=[Number(t.split(`/`).pop())],s=new ge(e);i||=s.i18n?.country,a||=s.i18n?.language;let c=await C(s,{language:a,country:i,useExternalMetafieldNamespace:!0});s.shopifyDomain=c.shopifyDomain;let u=c.storefrontAccessToken?new V(c.shopifyDomain,c.storefrontAccessToken):s,[d,f]=await Promise.all([h(u,{country:i,language:a,productIds:o,useExternalMetafieldNamespace:!0}),l(u,{useExternalMetafieldNamespace:!0,useMetaobjects:c.featureFlags.storefront_metaobjects})]),p=d[0];if(!p)return null;let m=H(f,p),g=n?m.filter(e=>e.id===n||e.nanoId===n):m,_=(r?g.find(e=>e.abTestVariantId===r):void 0)??g[0]??m[0];if(!_)return null;let v=O(_),[y,b,x,S]=await Promise.all([(async()=>{let e=[];try{e=await D(u,{dealBlock:_,country:i,language:a})}catch(e){console.error(e)}return h(u,{country:i,language:a,productIds:[...new Set([...ce(_),...e])],useExternalMetafieldNamespace:!0})})(),T(u,v,300),fe(u,_,{country:i,language:a}),pe({language:a,dealBlockId:_.id})]);return{product:p,dealBlock:_,config:c,otherProducts:y,mediaImages:b,collectionBreaksProducts:x??[],translations:S}}catch(e){return console.error(e),null}},ge=class{constructor(e){this.storefront=e,this.shopifyDomain=``}async query(e,t){if(`query`in this.storefront&&`i18n`in this.storefront)return await this.storefront.query(e,t);if(`graphql`in this.storefront){let n=await this.storefront.graphql(e,t);if(n.errors?.length)throw Error(n.errors.map(e=>e.message).join(`
270
- `));return n.data}if(`request`in this.storefront)return(await this.storefront.request(e,t)).data;if(`shopifyDomain`in this.storefront&&`storefrontAccessToken`in this.storefront){let n=await fetch(`https://${this.storefront.shopifyDomain}/api/${he}/graphql.json`,{body:JSON.stringify({query:e,variables:t?.variables}),headers:{"Content-Type":`application/json`,"X-Shopify-Storefront-Access-Token":this.storefront.storefrontAccessToken},method:`POST`});if(!n.ok)throw Error(n.statusText);return(await n.json()).data}{let n=await fetch(this.storefront.getStorefrontApiUrl(),{body:JSON.stringify({query:e,variables:t?.variables}),headers:this.storefront.getPublicTokenHeaders(),method:`POST`});if(!n.ok)throw Error(n.statusText);return(await n.json()).data}}get i18n(){if(`i18n`in this.storefront)return this.storefront.i18n}},G=`kaching-bundles-block`,K=1e4,q=`/kaching-bundles-block.js`,_e=`https://bundles-integrations-dev.kachingappz.dev/kaching-bundles-block.js`,ve=`https://bundles-integrations.kachingappz.app/kaching-bundles-block.js`,J=new WeakSet,Y=async e=>{let t=e.document;if(!e.customElements.get(G)){if(J.has(t))return Q(e,G);J.add(t);try{await xe(e)}catch(e){throw J.delete(t),e}}},ye=()=>typeof window<`u`&&window.__KACHING_DEV__!==void 0,be=()=>ye()?_e:ve,xe=async e=>{let t=e.document,n=be();if(t.querySelector(`script[src="${n}"]`))return Q(e,G);let r=Se(t);if(r&&await X(t,r))return Q(e,G);let i=t.createElement(`script`);return i.src=n,await Z(t,i),Q(e,G)},Se=e=>{let t=e.querySelectorAll(`link[rel="modulepreload"][href$="${q}"]`);return Array.from(t,e=>e.href).find(Ce)},Ce=e=>{try{return new URL(e).pathname.endsWith(q)}catch{return!1}},X=async(e,t)=>{let n=e.createElement(`script`);n.type=`module`,n.setAttribute(`crossorigin`,`anonymous`),n.src=t;try{return await Z(e,n),!0}catch{return n.remove(),!1}},Z=(e,t)=>new Promise((n,r)=>{t.onload=()=>n(),t.onerror=()=>r(Error(`Failed to load script`)),e.head.appendChild(t)}),Q=(e,t)=>new Promise((n,r)=>{e.customElements.get(t)?n():Promise.race([e.customElements.whenDefined(t),new Promise((e,n)=>setTimeout(()=>n(Error(`Custom element "${t}" failed to register within ${K}ms`)),K))]).then(()=>n()).catch(r)});[`primaryBackground`,`secondaryBackground`,`primaryText`,`secondaryText`,`border`,`overlay`,`primaryAccent`,`primaryAccentText`,`badgeBackground`,`badgeText`,`error`].map(e=>`brand_${e}`);var $=function(e){return e.QuantityBreak=`quantity-break`,e.Bxgy=`bxgy`,e.Bundle=`bundle`,e.MixAndMatch=`mix-and-match`,e.Sku=`sku`,e}({}),we={config:{shopifyDomain:``,moneyFormat:"${{amount}}",locale:`en`,country:`US`,currencyRate:1,marketId:0,productId:null,storefrontAccessToken:null,includeSellingPlans:!1,includeAvailableQuantity:!1,customApiHost:null,keepQuantityInput:!1,ignoreDeselect:!1,ignoreUnitPrice:!1,requireCustomerLogin:!1,abTestsRunning:!1,webPixel:!1,b2bCustomer:!1,isLoggedIn:!1,preview:!0,previewAlerts:!1,previewScratchOff:!1,defaultTranslations:{"system.out_of_stock":`There's not enough items in our stock, please select smaller bundle.`,"system.invalid_variant":`Sorry, this is not currently available.`,"system.unavailable_option_value":`Unavailable`,"system.confirm":`Confirm`,"system.cancel":`Cancel`,"system.free":`FREE`,"system.search":`Search`,"system.quantity":`Quantity`,"system.subscription_plan":`Subscription plan`,"system.remove":`Remove`,"system.sort_by":`Sort by`,"system.sort_relevance":`Relevance`,"system.sort_newest_first":`Newest first`,"system.sort_price_low_to_high":`Price: Low → High`,"system.sort_price_high_to_low":`Price: High → Low`,"system.no_results_found":`No results found`,"system.no_results_description":`We can't find any item matching your search.`,"system.clear_search":`Clear search`,"system.no_products_available":`No products available`,"system.original_price":`Original price:`,"system.price":`Price:`,"system.letters_only":`Only letters are allowed.`,"system.numbers_only":`Only numbers are allowed.`},customSelectors:{quantity:null,addToCartButton:null,variantPicker:null,price:null,priceCompare:null},featureFlags:{},shopCustomStyles:``},dealBlock:{id:`example`,nanoId:`example`,blockName:`Bundle`,discountName:``,blockTitle:`BUNDLE & SAVE`,blockLayout:`vertical`,blockVisibility:`all-products`,marketId:null,currency:null,excludeB2bCustomers:!1,excludePos:!1,startTimestamp:0,endTimestamp:null,differentVariantsEnabled:!0,hideVariantPicker:!0,disableVariantOptionSync:!1,hideUnavailableOptions:!1,showPricesPerItem:!1,showBothPrices:!1,unitLabel:``,useProductCompareAtPrice:!0,showPricesWithoutDecimals:!1,priceRounding:!1,priceRoundingPrecision:`.00`,updateNativePrice:!1,updateNativePriceType:`item`,skipCart:!1,showVariantsForSingleQuantity:!1,preselectedDealBarId:`duo`,cornerRadius:16,spacing:1,selectedProductIds:[],selectedCollectionIds:[],excludedProductIds:[],excludedCollectionIds:[],colors:{background:{red:245,green:245,blue:245,alpha:1},selectedBackground:{red:255,green:255,blue:255,alpha:1},border:{red:0,green:0,blue:0,alpha:1},blockTitle:{red:0,green:0,blue:0,alpha:1},title:{red:0,green:0,blue:0,alpha:1},subtitle:{red:85,green:85,blue:85,alpha:1},price:{red:0,green:0,blue:0,alpha:1},fullPrice:{red:85,green:85,blue:85,alpha:1},labelBackground:{red:171,green:239,blue:198,alpha:1},label:{red:0,green:0,blue:0,alpha:1},badgeBackground:{red:0,green:0,blue:0,alpha:1},badgeText:{red:255,green:255,blue:255,alpha:1},freeGiftBackground:{red:0,green:0,blue:0,alpha:.3},freeGiftText:{red:0,green:0,blue:0,alpha:1},freeGiftSelectedBackground:{red:0,green:0,blue:0,alpha:1},freeGiftSelectedText:{red:255,green:255,blue:255,alpha:1},upsellBackground:{red:0,green:0,blue:0,alpha:.2},upsellText:{red:0,green:0,blue:0,alpha:1},upsellSelectedBackground:{red:0,green:0,blue:0,alpha:.2},upsellSelectedText:{red:0,green:0,blue:0,alpha:1}},fonts:{blockTitle:{size:`14`,style:`bold`},title:{size:`20`,style:`bold`},subtitle:{size:`14`,style:`regular`},label:{size:`12`,style:`bold`},freeGift:{size:`13`,style:`bold`},upsell:{size:`13`,style:`bold`},unitLabel:{size:`14`,style:`regular`}},dealBars:[{id:`single`,dealBarType:$.QuantityBreak,quantitySelector:!1,title:`Single`,subtitle:`Standard price`,label:``,quantity:1,discountType:`default`,discountValue:``,badgeStyle:`simple`,badgeText:``,badgeImageGID:null,mediaImageGID:null,freeGifts:[],multipleGiftsSelectors:[],upsells:[],showAsSoldOutEnabled:!1,showAsSoldOut:null,productPersonalisation:null,highlights:null,sellingPlanEnabled:!1,sellingPlanGid:null,subscriptionMode:`customer-choice`},{id:`duo`,dealBarType:$.QuantityBreak,quantitySelector:!1,title:`Duo`,subtitle:`You save 20%`,label:`SAVE $32`,quantity:2,discountType:`percentage`,discountValue:`20`,badgeStyle:`most-popular`,badgeText:``,badgeImageGID:null,mediaImageGID:null,freeGifts:[],multipleGiftsSelectors:[],upsells:[],showAsSoldOutEnabled:!1,showAsSoldOut:null,productPersonalisation:null,highlights:null,sellingPlanEnabled:!1,sellingPlanGid:null,subscriptionMode:`customer-choice`},{id:`trio`,dealBarType:$.QuantityBreak,quantitySelector:!1,title:`Trio`,subtitle:`You save 25%`,label:`SAVE $60`,quantity:3,discountType:`percentage`,discountValue:`25`,badgeStyle:`simple`,badgeText:``,badgeImageGID:null,mediaImageGID:null,freeGifts:[],multipleGiftsSelectors:[],upsells:[],showAsSoldOutEnabled:!1,showAsSoldOut:null,productPersonalisation:null,highlights:null,sellingPlanEnabled:!1,sellingPlanGid:null,subscriptionMode:`customer-choice`}],badgesEnabled:!0,badges:[{id:`bdg1`,attachedTo:{type:`dealBar`,dealBarId:`duo`},text:`MOST POPULAR`,colors:null,badgeType:`most-popular`,size:90}],swatchOptions:[],swatchSize:18,swatchShape:`circle`,imageSize:48,imageCornerRadius:6,defaultVariantsV2:[],collectionBreaksEnabled:!1,collectionBreaks:null,chooseProductModal:null,timerEnabled:!1,timer:null,subscriptionsEnabled:!1,subscriptions:null,stickyAtcEnabled:!1,stickyAtc:null,progressiveGiftsEnabled:!1,progressiveGifts:null,checkboxUpsellsEnabled:!1,checkboxUpsells:null,customStylesEnabled:!1,shopCustomStyles:``,customStyles:``,lowStockAlertEnabled:!1,lowStockAlert:null},product:{id:1,handle:`example-product`,url:null,availableForSale:!0,title:`Example product`,image:null,collectionIds:[],options:[],selectedVariantId:1,variants:[{id:1,availableForSale:!0,price:8e3,compareAtPrice:null,options:[`Default Title`],imageId:null,image:null,unitPriceMeasurement:null,sellingPlans:[],inventoryManagement:null,inventoryPolicy:null,inventoryQuantity:50}],metafields:{text:null,text2:null,text3:null,text4:null},requiresSellingPlan:!1,sellingPlans:[],isNativeBundle:!1},otherProducts:[],mediaImages:[],collectionBreaksProducts:[],translations:{}},Te=class extends HTMLElement{constructor(...e){super(...e),this.innerElement=null,this.handleItemsChanged=null,this.initializeId=0}static get observedAttributes(){return[`selected-variant-id`,`product-id`,`country`,`language`]}async connectedCallback(){await this.initialize()}async initialize(){let e=++this.initializeId;if(this.cleanup(),this.hasAttribute(`demo`)){if(await Y(window),e!==this.initializeId)return;this.renderInnerElement(we);return}let t=this.getAttribute(`shop-domain`),n=this.getAttribute(`storefront-token`),r=this.getAttribute(`product-id`);if(!t||!n||!r)return;let[i]=await Promise.all([W({shopifyDomain:t,storefrontAccessToken:n},{productId:r,dealBlockId:this.getAttribute(`deal-block-id`)??void 0,abTestVariantId:this.getAttribute(`ab-test-variant-id`)??void 0,country:this.getAttribute(`country`)?.toUpperCase()??void 0,language:this.getAttribute(`language`)?.toUpperCase()??void 0}),Y(window)]);i&&e===this.initializeId&&this.renderInnerElement(i)}renderInnerElement(e){let{config:t,dealBlock:n,product:r,otherProducts:i,mediaImages:a,collectionBreaksProducts:o,translations:s}=e;this.innerElement=document.createElement(`kaching-bundles-block`),this.innerElement.setAttribute(`deal-block-id`,n.id),this.innerElement.setAttribute(`config`,JSON.stringify(t)),this.innerElement.setAttribute(`deal-block`,JSON.stringify(n)),this.innerElement.setAttribute(`media-images`,JSON.stringify(a??[])),this.innerElement.setAttribute(`product`,JSON.stringify(r)),this.innerElement.setAttribute(`other-products`,JSON.stringify(i??[])),this.innerElement.setAttribute(`collection-breaks-products`,JSON.stringify(o??[])),this.innerElement.setAttribute(`translations`,JSON.stringify(s??{}));let c=this.getAttribute(`selected-variant-id`);this.innerElement.setAttribute(`current-variant-id`,String(c?c.split(`/`).pop():r.variants[0].id)),this.hasAttribute(`compact`)&&this.innerElement.setAttribute(`compact`,``);let l=this.innerElement,u=()=>{if(this.innerElement!==l)return;let e=l.items();e&&this.dispatchEvent(new CustomEvent(`items-changed`,{detail:{items:e},bubbles:!0}))};this.handleItemsChanged=e=>{e.stopPropagation(),u()};let d=this.handleItemsChanged;l.addEventListener(`kaching-bundles-block-loaded`,()=>{this.innerElement===l&&(l.addEventListener(`items-changed`,d),this.dispatchEvent(new CustomEvent(`loaded`,{bubbles:!0})))},{once:!0}),this.appendChild(this.innerElement)}cleanup(){this.handleItemsChanged&&this.innerElement&&(this.innerElement.removeEventListener(`items-changed`,this.handleItemsChanged),this.handleItemsChanged=null),this.innerElement&&=(this.innerElement.remove(),null)}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&(e===`product-id`||e===`country`||e===`language`?this.initialize():e===`selected-variant-id`&&this.innerElement&&n&&this.innerElement.setAttribute(`current-variant-id`,n.includes(`/`)?String(n.split(`/`).pop()):n))}items(){return this.innerElement?this.innerElement.items():[]}disconnectedCallback(){this.cleanup(),this.initializeId++}};return customElements.define(`kaching-bundle-component`,Te),e.fetchKachingBundlesData=W,e})({});
269
+ `,{variables:{collectionGIDs:i}});return[...new Set(o.nodes.filter(e=>e!==null).flatMap(e=>e.products.nodes).filter(e=>!e.variants.nodes.some(e=>e.requiresComponents)).map(e=>e.id))]},O=e=>[...k(e),...A(e),...j(e),...M(e),...N(e),...ee(e),...te(e),...ne(e),...re(e),...ie(e),...ae(e),...oe(e),...se(e)].filter(e=>e!=null&&!e.includes(`placeholder`)),k=e=>e.dealBars.flatMap(e=>[e.mediaImageGID,e.badgeImageGID]).filter(e=>e!=null),A=e=>e.dealBars.flatMap(e=>e.dealBarType===f.Bundle?e.bundleProducts.map(e=>e.mediaImageGID):[]).filter(e=>e!=null),j=e=>e.dealBars.map(({freeGifts:e})=>(e||[]).map(e=>e.mediaImageGID)).reduce((e,t)=>e.concat(t),[]).filter(e=>e!=null),M=e=>e.dealBars.flatMap(({multipleGiftsSelectors:e})=>(e||[]).map(e=>e.mediaImageGID)).filter(e=>e!=null),N=e=>e.dealBars.map(({upsells:e})=>(e||[]).map(e=>e.mediaImageGID)).reduce((e,t)=>e.concat(t),[]).filter(e=>e!=null),ee=e=>e.swatchOptions?e.swatchOptions.reduce((e,t)=>{let n=t.images.map(e=>e.mediaImageGID).filter(e=>e!=null);return[...e,...n]},[]):[],te=e=>{if(!e.collectionBreaksEnabled||!e.collectionBreaks)return[];let t=e.collectionBreaks.mediaImageGID;return t?[t]:[]},ne=e=>e.progressiveGifts?[...e.progressiveGifts.gifts?.map(e=>e.mediaImageGID)||[],e.progressiveGifts.style?.lockedMediaImageGID,e.progressiveGifts.dealBarStyle?.lockedMediaImageGID].filter(e=>e!=null):[],re=e=>!e.checkboxUpsellsEnabled||!e.checkboxUpsells?[]:e.checkboxUpsells.upsells.flatMap(e=>[e.mediaImageGID,e.badgeImageGID]).filter(e=>e!=null),ie=e=>e.dealBars.map(e=>e.productPersonalisation?.mediaImageGID).filter(e=>e!=null),ae=e=>{let t=e.dealBars.map(e=>e.highlights?.customIconGID).filter(e=>e!=null),n=e.subscriptions?.highlights?.customIconGID;return n?[...t,n]:t},oe=e=>(e.badges||[]).flatMap(e=>e.badgeType===`custom`&&e.imageGID?[e.imageGID]:[]),se=e=>!e.savingsSummaryEnabled||!e.savingsSummary?[]:e.savingsSummary.customIconGID?[e.savingsSummary.customIconGID]:[],ce=(e,{includeMixAndMatchSwapProducts:t=!0}={})=>{let n=[...le(e),...ue(e),...de(e),...fe(e),...pe(e),...P(e,t),...F(e),...I(e)];return Array.from(new Set(n.filter(e=>e!=null)))},le=e=>e.dealBars.flatMap(({freeGifts:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null),ue=e=>e.dealBars.flatMap(({multipleGiftsSelectors:e})=>e?e.flatMap(e=>e.products?e.products.map(e=>e.id):[]):[]).filter(e=>e!=null),de=e=>e.progressiveGiftsEnabled&&e.progressiveGifts?.gifts.map(e=>e.productGID).filter(e=>e!=null)||[],fe=e=>e.dealBars.flatMap(({upsells:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null),pe=e=>e.dealBars.filter(e=>e.dealBarType===f.Bundle).flatMap(({bundleProducts:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null).filter(e=>e!=="default"),P=(e,t)=>e.dealBars.filter(e=>e.dealBarType===f.MixAndMatch).flatMap(({bundleProducts:e})=>e?e.flatMap(e=>[e.productGID,...t?e.selectedProducts?.map(e=>e.id)??[]:[]]):[]).filter(e=>e!=null).filter(e=>e!=="default"),F=e=>!e.checkboxUpsellsEnabled||!e.checkboxUpsells?[]:e.checkboxUpsells.upsells.map(e=>e.productGID).filter(e=>e!=null),I=e=>e.dealBars.filter(e=>e.dealBarType===f.Sku).flatMap(({productGID:e})=>e?[e]:[]),L=class extends Error{constructor({status:e,operationName:t,graphqlErrors:n}){let r=n.length?`: ${n.join(`; `)}`:``;super(`Storefront API ${t??`query`} failed (HTTP ${e})${r}`),this.name=`StorefrontApiError`,this.status=e,this.operationName=t,this.graphqlErrors=n}},R=async(e,t)=>{let n=await e.text();if(!n)throw Error(`Empty graphql response`);let r;try{r=JSON.parse(n)}catch(n){throw e.ok?n:new L({status:e.status,operationName:t,graphqlErrors:[]})}if(!e.ok||r.data===null||r.data===void 0)throw new L({status:e.status,operationName:t,graphqlErrors:(r.errors??[]).map(({message:e})=>e).filter(Boolean)});return r.data},z=class{constructor(e,t){this.storefrontApiVersion=`2026-07`,this.storefrontAccessToken=t,this.shopifyDomain=e}async query(e,t){let n=t?.variables??{},r=`https://${this.shopifyDomain}/api/${this.storefrontApiVersion}/graphql.json`,i=e.match(/query\s+(\w+)/)?.[1];return i&&(r+=`?operation_name=${i}`),R(await fetch(r,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Shopify-Storefront-Access-Token":this.storefrontAccessToken},body:JSON.stringify({query:e,variables:n})}),i)}},B=(e,t)=>{let n=[],r=e.filter(e=>e.blockVisibility===`selected-products`);for(let e of r)e.selectedProductIds.map(Number).includes(t.id)&&n.push(e);let i=e.filter(e=>e.blockVisibility===`selected-collections`);for(let e of i)t.collectionIds.some(t=>e.selectedCollectionIds.map(Number).includes(t))&&n.push(e);let a=e.filter(e=>e.blockVisibility===`excluded-products`);for(let e of a)!e.excludedProductIds.map(Number).includes(t.id)&&!(e.excludedCollectionIds||[]).some(e=>t.collectionIds.includes(e))&&n.push(e);let o=e.filter(e=>e.blockVisibility===`all-products`);for(let e of o)n.push(e);return n};[`primaryBackground`,`secondaryBackground`,`primaryText`,`secondaryText`,`border`,`overlay`,`primaryAccent`,`primaryAccentText`,`badgeBackground`,`badgeText`,`error`].map(e=>`brand_${e}`);var V=function(e){return e.QuantityBreak=`quantity-break`,e.Bxgy=`bxgy`,e.Bundle=`bundle`,e.MixAndMatch=`mix-and-match`,e.Sku=`sku`,e}({}),me=async(e,t,{country:n,language:r})=>{let i=t.collectionBreaks;if(!t.collectionBreaksEnabled||!i)return;let a;a=i.visibility===`deal-products`?await p(e,{country:n,language:r,blockVisibility:t.blockVisibility,excludedProductGIDs:(t.excludedProductIds||[]).map(e=>`gid://shopify/Product/${e}`),selectedProductGIDs:(t.selectedProductIds||[]).map(e=>`gid://shopify/Product/${e}`),selectedCollectionGIDs:(t.selectedCollectionIds||[]).map(e=>`gid://shopify/Collection/${e}`)}):await p(e,{country:n,language:r,blockVisibility:i.visibility,excludedProductGIDs:(i.excludedProducts||[]).map(({id:e})=>e),selectedProductGIDs:(i.selectedProducts||[]).map(({id:e})=>e),selectedCollectionGIDs:(i.selectedCollections||[]).map(({id:e})=>e)});let o=await h(e,{country:n,language:r,productIds:a.map(e=>Number(e.split(`/`).pop())),useExternalMetafieldNamespace:!0}),s=i.visibility===`deal-products`&&t.blockVisibility===`excluded-products`;return o=o.filter(e=>e.availableForSale&&(!s||B([t],e).length>0)),o},he=({language:e,dealBlockId:t})=>{let n={"system.out_of_stock":`There's not enough items in our stock, please select smaller bundle.`,"system.invalid_variant":`Sorry, this is not currently available.`,"system.unavailable_option_value":`Unavailable`,"system.confirm":`Confirm`,"system.cancel":`Cancel`,"system.free":`FREE`,"system.search":`Search`,"system.quantity":`Quantity`,"system.subscription_plan":`Subscription plan`,"system.remove":`Remove`,"system.sort_by":`Sort by`,"system.sort_relevance":`Relevance`,"system.sort_newest_first":`Newest first`,"system.sort_price_low_to_high":`Price: Low → High`,"system.sort_price_high_to_low":`Price: High → Low`,"system.no_results_found":`No results found`,"system.no_results_description":`We can't find any item matching your search.`,"system.clear_search":`Clear search`,"system.no_products_available":`No products available`,"system.original_price":`Original price:`,"system.price":`Price:`,"system.letters_only":`Only letters are allowed.`,"system.numbers_only":`Only numbers are allowed.`,"system.personalisation_required_alert":`Please add personalisation for every item to continue.`,"system.gifts_required_alert":`Please choose your free gifts`},r=e?ge(e):void 0;return{...n,...r?.system,...r?.dealBlocks[t]}},ge=e=>{if(typeof document>`u`)return;let t=document.querySelector(`script#kaching-bundles-translations`);if(!t?.textContent)return;let n;try{n=JSON.parse(t.textContent)}catch{return}let r=H(e);return n.find(e=>H(e.locale)===r)?.translations},H=e=>e.toLowerCase().replace(/_/g,`-`),_e=`2026-07`,U=async(e,{productId:t,dealBlockId:n,abTestVariantId:r,country:i=void 0,language:a=void 0})=>{try{let o=[Number(t.split(`/`).pop())],s=new Se(e);i||=s.i18n?.country,a||=s.i18n?.language;let c=await C(s,{language:a,country:i,useExternalMetafieldNamespace:!0});s.shopifyDomain=c.shopifyDomain;let u=c.storefrontAccessToken?new z(c.shopifyDomain,c.storefrontAccessToken):s,[d,f]=await Promise.all([h(u,{country:i,language:a,productIds:o,useExternalMetafieldNamespace:!0}),l(u,{useExternalMetafieldNamespace:!0,useMetaobjects:c.featureFlags.storefront_metaobjects})]),p=d[0];if(!p)return null;let m=B(f,p),g=n?m.filter(e=>e.id===n||e.nanoId===n):m,_=(r?g.find(e=>e.abTestVariantId===r):void 0)??g[0]??m[0];if(!_)return null;let v=ce(_,{includeMixAndMatchSwapProducts:!1}),y=ve(u,_,{otherProductGIDs:v,country:i,language:a}),[b,x,S]=await Promise.all([h(u,{country:i,language:a,productIds:v,useExternalMetafieldNamespace:!0}),T(u,O(_),300),he({language:a,dealBlockId:_.id})]);return{data:{config:c,dealBlock:_,product:p,otherProducts:b,mediaImages:x,translations:S},modalProducts:y}}catch(e){return console.error(e),null}},ve=async(e,t,n)=>{let[r,i]=await Promise.all([ye(e,t,n),xe(e,t,n)]);return{mixAndMatchSwapProducts:r,collectionBreaksProducts:i}},ye=async(e,t,{otherProductGIDs:n,country:r,language:i})=>{try{let a=[];try{a=await D(e,{dealBlock:t,country:r,language:i})}catch(e){console.error(e)}let o=new Set(n),s=[...new Set([...be(t),...a])].filter(e=>!o.has(e));return s.length?await h(e,{country:r,language:i,productIds:s,useExternalMetafieldNamespace:!0}):[]}catch(e){return console.error(e),[]}},be=e=>e.dealBars.flatMap(e=>e.dealBarType===V.MixAndMatch?e.bundleProducts.flatMap(e=>(e.selectedProducts??[]).map(e=>e.id)):[]),xe=async(e,t,{country:n,language:r})=>{try{return await me(e,t,{country:n,language:r})??[]}catch(e){return console.error(e),[]}},Se=class{constructor(e){this.storefront=e,this.shopifyDomain=``}async query(e,t){if(`query`in this.storefront&&`i18n`in this.storefront)return await this.storefront.query(e,t);if(`graphql`in this.storefront){let n=await this.storefront.graphql(e,t);if(n.errors?.length)throw Error(n.errors.map(e=>e.message).join(`
270
+ `));return n.data}if(`request`in this.storefront)return(await this.storefront.request(e,t)).data;if(`shopifyDomain`in this.storefront&&`storefrontAccessToken`in this.storefront){let n=await fetch(`https://${this.storefront.shopifyDomain}/api/${_e}/graphql.json`,{body:JSON.stringify({query:e,variables:t?.variables}),headers:{"Content-Type":`application/json`,"X-Shopify-Storefront-Access-Token":this.storefront.storefrontAccessToken},method:`POST`});if(!n.ok)throw Error(n.statusText);return(await n.json()).data}{let n=await fetch(this.storefront.getStorefrontApiUrl(),{body:JSON.stringify({query:e,variables:t?.variables}),headers:this.storefront.getPublicTokenHeaders(),method:`POST`});if(!n.ok)throw Error(n.statusText);return(await n.json()).data}}get i18n(){if(`i18n`in this.storefront)return this.storefront.i18n}},W=`kaching-bundles-block`,G=1e4,K=`/kaching-bundles-block.js`,Ce=`https://bundles-integrations-dev.kachingappz.dev/kaching-bundles-block.js`,we=`https://bundles-integrations.kachingappz.app/kaching-bundles-block.js`,q=new WeakSet,J=async e=>{let t=e.document;if(!e.customElements.get(W)){if(q.has(t))return Z(e,W);q.add(t);try{await Ee(e)}catch(e){throw q.delete(t),e}}},Y=()=>typeof window<`u`&&window.__KACHING_DEV__!==void 0,Te=()=>Y()?Ce:we,Ee=async e=>{let t=e.document,n=Te();if(t.querySelector(`script[src="${n}"]`))return Z(e,W);let r=De(t);if(r&&await ke(t,r))return Z(e,W);let i=t.createElement(`script`);return i.src=n,await X(t,i),Z(e,W)},De=e=>{let t=e.querySelectorAll(`link[rel="modulepreload"][href$="${K}"]`);return Array.from(t,e=>e.href).find(Oe)},Oe=e=>{try{return new URL(e).pathname.endsWith(K)}catch{return!1}},ke=async(e,t)=>{let n=e.createElement(`script`);n.type=`module`,n.setAttribute(`crossorigin`,`anonymous`),n.src=t;try{return await X(e,n),!0}catch{return n.remove(),!1}},X=(e,t)=>new Promise((n,r)=>{t.onload=()=>n(),t.onerror=()=>r(Error(`Failed to load script`)),e.head.appendChild(t)}),Z=(e,t)=>new Promise((n,r)=>{e.customElements.get(t)?n():Promise.race([e.customElements.whenDefined(t),new Promise((e,n)=>setTimeout(()=>n(Error(`Custom element "${t}" failed to register within ${G}ms`)),G))]).then(()=>n()).catch(r)}),Q={config:{shopifyDomain:``,moneyFormat:"${{amount}}",locale:`en`,country:`US`,currencyRate:1,marketId:0,productId:null,storefrontAccessToken:null,includeSellingPlans:!1,includeAvailableQuantity:!1,customApiHost:null,keepQuantityInput:!1,ignoreDeselect:!1,ignoreUnitPrice:!1,requireCustomerLogin:!1,abTestsRunning:!1,webPixel:!1,b2bCustomer:!1,isLoggedIn:!1,preview:!0,previewAlerts:!1,previewScratchOff:!1,defaultTranslations:{"system.out_of_stock":`There's not enough items in our stock, please select smaller bundle.`,"system.invalid_variant":`Sorry, this is not currently available.`,"system.unavailable_option_value":`Unavailable`,"system.confirm":`Confirm`,"system.cancel":`Cancel`,"system.free":`FREE`,"system.search":`Search`,"system.quantity":`Quantity`,"system.subscription_plan":`Subscription plan`,"system.remove":`Remove`,"system.sort_by":`Sort by`,"system.sort_relevance":`Relevance`,"system.sort_newest_first":`Newest first`,"system.sort_price_low_to_high":`Price: Low → High`,"system.sort_price_high_to_low":`Price: High → Low`,"system.no_results_found":`No results found`,"system.no_results_description":`We can't find any item matching your search.`,"system.clear_search":`Clear search`,"system.no_products_available":`No products available`,"system.original_price":`Original price:`,"system.price":`Price:`,"system.letters_only":`Only letters are allowed.`,"system.numbers_only":`Only numbers are allowed.`},customSelectors:{quantity:null,addToCartButton:null,variantPicker:null,price:null,priceCompare:null},featureFlags:{},shopCustomStyles:``},dealBlock:{id:`example`,nanoId:`example`,blockName:`Bundle`,discountName:``,blockTitle:`BUNDLE & SAVE`,blockLayout:`vertical`,blockVisibility:`all-products`,marketId:null,currency:null,excludeB2bCustomers:!1,excludePos:!1,startTimestamp:0,endTimestamp:null,differentVariantsEnabled:!0,hideVariantPicker:!0,disableVariantOptionSync:!1,hideUnavailableOptions:!1,showPricesPerItem:!1,showBothPrices:!1,unitLabel:``,useProductCompareAtPrice:!0,showPricesWithoutDecimals:!1,priceRounding:!1,priceRoundingPrecision:`.00`,updateNativePrice:!1,updateNativePriceType:`item`,skipCart:!1,showVariantsForSingleQuantity:!1,preselectedDealBarId:`duo`,cornerRadius:16,spacing:1,selectedProductIds:[],selectedCollectionIds:[],excludedProductIds:[],excludedCollectionIds:[],colors:{background:{red:245,green:245,blue:245,alpha:1},selectedBackground:{red:255,green:255,blue:255,alpha:1},border:{red:0,green:0,blue:0,alpha:1},blockTitle:{red:0,green:0,blue:0,alpha:1},title:{red:0,green:0,blue:0,alpha:1},subtitle:{red:85,green:85,blue:85,alpha:1},price:{red:0,green:0,blue:0,alpha:1},fullPrice:{red:85,green:85,blue:85,alpha:1},labelBackground:{red:171,green:239,blue:198,alpha:1},label:{red:0,green:0,blue:0,alpha:1},badgeBackground:{red:0,green:0,blue:0,alpha:1},badgeText:{red:255,green:255,blue:255,alpha:1},freeGiftBackground:{red:0,green:0,blue:0,alpha:.3},freeGiftText:{red:0,green:0,blue:0,alpha:1},freeGiftSelectedBackground:{red:0,green:0,blue:0,alpha:1},freeGiftSelectedText:{red:255,green:255,blue:255,alpha:1},upsellBackground:{red:0,green:0,blue:0,alpha:.2},upsellText:{red:0,green:0,blue:0,alpha:1},upsellSelectedBackground:{red:0,green:0,blue:0,alpha:.2},upsellSelectedText:{red:0,green:0,blue:0,alpha:1}},fonts:{blockTitle:{size:`14`,style:`bold`},title:{size:`20`,style:`bold`},subtitle:{size:`14`,style:`regular`},label:{size:`12`,style:`bold`},freeGift:{size:`13`,style:`bold`},upsell:{size:`13`,style:`bold`},unitLabel:{size:`14`,style:`regular`}},dealBars:[{id:`single`,dealBarType:V.QuantityBreak,quantitySelector:!1,title:`Single`,subtitle:`Standard price`,label:``,quantity:1,discountType:`default`,discountValue:``,badgeStyle:`simple`,badgeText:``,badgeImageGID:null,mediaImageGID:null,freeGifts:[],multipleGiftsSelectors:[],upsells:[],showAsSoldOutEnabled:!1,showAsSoldOut:null,productPersonalisation:null,highlights:null,sellingPlanEnabled:!1,sellingPlanGid:null,subscriptionMode:`customer-choice`},{id:`duo`,dealBarType:V.QuantityBreak,quantitySelector:!1,title:`Duo`,subtitle:`You save 20%`,label:`SAVE $32`,quantity:2,discountType:`percentage`,discountValue:`20`,badgeStyle:`most-popular`,badgeText:``,badgeImageGID:null,mediaImageGID:null,freeGifts:[],multipleGiftsSelectors:[],upsells:[],showAsSoldOutEnabled:!1,showAsSoldOut:null,productPersonalisation:null,highlights:null,sellingPlanEnabled:!1,sellingPlanGid:null,subscriptionMode:`customer-choice`},{id:`trio`,dealBarType:V.QuantityBreak,quantitySelector:!1,title:`Trio`,subtitle:`You save 25%`,label:`SAVE $60`,quantity:3,discountType:`percentage`,discountValue:`25`,badgeStyle:`simple`,badgeText:``,badgeImageGID:null,mediaImageGID:null,freeGifts:[],multipleGiftsSelectors:[],upsells:[],showAsSoldOutEnabled:!1,showAsSoldOut:null,productPersonalisation:null,highlights:null,sellingPlanEnabled:!1,sellingPlanGid:null,subscriptionMode:`customer-choice`}],badgesEnabled:!0,badges:[{id:`bdg1`,attachedTo:{type:`dealBar`,dealBarId:`duo`},text:`MOST POPULAR`,colors:null,badgeType:`most-popular`,size:90}],swatchOptions:[],swatchSize:18,swatchShape:`circle`,imageSize:48,imageCornerRadius:6,defaultVariantsV2:[],collectionBreaksEnabled:!1,collectionBreaks:null,chooseProductModal:null,timerEnabled:!1,timer:null,subscriptionsEnabled:!1,subscriptions:null,stickyAtcEnabled:!1,stickyAtc:null,progressiveGiftsEnabled:!1,progressiveGifts:null,checkboxUpsellsEnabled:!1,checkboxUpsells:null,customStylesEnabled:!1,shopCustomStyles:``,customStyles:``,lowStockAlertEnabled:!1,lowStockAlert:null},product:{id:1,handle:`example-product`,url:null,availableForSale:!0,title:`Example product`,image:null,collectionIds:[],options:[],selectedVariantId:1,variants:[{id:1,availableForSale:!0,price:8e3,compareAtPrice:null,options:[`Default Title`],imageId:null,image:null,unitPriceMeasurement:null,sellingPlans:[],inventoryManagement:null,inventoryPolicy:null,inventoryQuantity:50}],metafields:{text:null,text2:null,text3:null,text4:null},requiresSellingPlan:!1,sellingPlans:[],isNativeBundle:!1},otherProducts:[],mixAndMatchSwapProducts:[],mediaImages:[],collectionBreaksProducts:[],translations:{}},Ae=async(e,t)=>{try{let n=await U(e,t);if(!n)return null;let{config:r,dealBlock:i,product:a,otherProducts:o,mediaImages:s,translations:c}=n.data,{mixAndMatchSwapProducts:l,collectionBreaksProducts:u}=await n.modalProducts;return{config:r,dealBlock:i,product:a,otherProducts:o,mixAndMatchSwapProducts:l,mediaImages:s,collectionBreaksProducts:u,translations:c}}catch(e){return console.error(e),null}},je=class extends HTMLElement{constructor(...e){super(...e),this.innerElement=null,this.handleItemsChanged=null,this.initializeId=0}static get observedAttributes(){return[`selected-variant-id`,`product-id`,`country`,`language`]}async connectedCallback(){await this.initialize()}async initialize(){let e=++this.initializeId;if(this.cleanup(),this.hasAttribute(`demo`)){if(await J(window),e!==this.initializeId)return;$(this.renderInnerElement(Q),Q);return}let t=this.getAttribute(`shop-domain`),n=this.getAttribute(`storefront-token`),r=this.getAttribute(`product-id`);if(!t||!n||!r)return;let[i]=await Promise.all([U({shopifyDomain:t,storefrontAccessToken:n},{productId:r,dealBlockId:this.getAttribute(`deal-block-id`)??void 0,abTestVariantId:this.getAttribute(`ab-test-variant-id`)??void 0,country:this.getAttribute(`country`)?.toUpperCase()??void 0,language:this.getAttribute(`language`)?.toUpperCase()??void 0}),J(window)]);if(!i||e!==this.initializeId)return;let a=this.renderInnerElement(i.data),o=await i.modalProducts;e===this.initializeId&&this.innerElement===a&&$(a,o)}renderInnerElement(e){let{config:t,dealBlock:n,product:r,otherProducts:i,mediaImages:a,translations:o}=e;this.innerElement=document.createElement(`kaching-bundles-block`),this.innerElement.setAttribute(`deal-block-id`,n.id),this.innerElement.setAttribute(`config`,JSON.stringify(t)),this.innerElement.setAttribute(`deal-block`,JSON.stringify(n)),this.innerElement.setAttribute(`media-images`,JSON.stringify(a??[])),this.innerElement.setAttribute(`product`,JSON.stringify(r)),this.innerElement.setAttribute(`other-products`,JSON.stringify(i??[])),this.innerElement.setAttribute(`translations`,JSON.stringify(o??{}));let s=this.getAttribute(`selected-variant-id`);this.innerElement.setAttribute(`current-variant-id`,String(s?s.split(`/`).pop():r.variants[0].id)),this.hasAttribute(`compact`)&&this.innerElement.setAttribute(`compact`,``);let c=this.innerElement,l=()=>{if(this.innerElement!==c)return;let e=c.items();e&&this.dispatchEvent(new CustomEvent(`items-changed`,{detail:{items:e},bubbles:!0}))};this.handleItemsChanged=e=>{e.stopPropagation(),l()};let u=this.handleItemsChanged;return c.addEventListener(`kaching-bundles-block-loaded`,()=>{this.innerElement===c&&(c.addEventListener(`items-changed`,u),this.dispatchEvent(new CustomEvent(`loaded`,{bubbles:!0})))},{once:!0}),this.appendChild(c),c}cleanup(){this.handleItemsChanged&&this.innerElement&&(this.innerElement.removeEventListener(`items-changed`,this.handleItemsChanged),this.handleItemsChanged=null),this.innerElement&&=(this.innerElement.remove(),null)}attributeChangedCallback(e,t,n){t!==n&&this.isConnected&&(e===`product-id`||e===`country`||e===`language`?this.initialize():e===`selected-variant-id`&&this.innerElement&&n&&this.innerElement.setAttribute(`current-variant-id`,n.includes(`/`)?String(n.split(`/`).pop()):n))}items(){return this.innerElement?this.innerElement.items():[]}disconnectedCallback(){this.cleanup(),this.initializeId++}},$=(e,{mixAndMatchSwapProducts:t,collectionBreaksProducts:n})=>{t.length&&e.setAttribute(`mix-and-match-swap-products`,JSON.stringify(t)),e.setAttribute(`collection-breaks-products`,JSON.stringify(n))};return customElements.define(`kaching-bundle-component`,je),e.fetchKachingBundlesData=Ae,e})({});
package/dist/index.d.ts CHANGED
@@ -413,13 +413,7 @@ declare type DefaultSortOption = "relevance" | "newest-first" | "price-low-to-hi
413
413
 
414
414
  declare type DiscountType = "default" | "percentage" | "amount" | "specific";
415
415
 
416
- export declare const fetchKachingBundlesData: (storefront: HydrogenV2Storefront | HydrogenStorefrontClient | ReactHydrogenStorefront | ShopifyStorefrontApiClient | StorefrontCredentials, { productId, dealBlockId, abTestVariantId, country, language, }: {
417
- productId: string;
418
- dealBlockId?: string;
419
- abTestVariantId?: string;
420
- country?: string;
421
- language?: string;
422
- }) => Promise<KachingBundlesData | null>;
416
+ export declare const fetchKachingBundlesData: (storefront: KachingBundlesStorefront, options: KachingBundlesDataOptions) => Promise<KachingBundlesData | null>;
423
417
 
424
418
  declare type Font = {
425
419
  size: string | number;
@@ -725,6 +719,7 @@ export declare interface KachingBundlesData {
725
719
  dealBlock: DealBlock;
726
720
  product: Product;
727
721
  otherProducts: Product[];
722
+ mixAndMatchSwapProducts: Product[];
728
723
  mediaImages: {
729
724
  gid: string;
730
725
  url: string;
@@ -735,6 +730,16 @@ export declare interface KachingBundlesData {
735
730
  };
736
731
  }
737
732
 
733
+ declare interface KachingBundlesDataOptions {
734
+ productId: string;
735
+ dealBlockId?: string;
736
+ abTestVariantId?: string;
737
+ country?: string;
738
+ language?: string;
739
+ }
740
+
741
+ declare type KachingBundlesStorefront = HydrogenV2Storefront | HydrogenStorefrontClient | ReactHydrogenStorefront | ShopifyStorefrontApiClient | StorefrontCredentials;
742
+
738
743
  declare type LowStockAlert = {
739
744
  threshold: number;
740
745
  message: string;
package/dist/index.js CHANGED
@@ -567,70 +567,70 @@ var x = "app--2935586817", S = async (t, { language: n, country: r, useExternalM
567
567
  ...j(e),
568
568
  ...M(e),
569
569
  ...N(e),
570
+ ...ee(e),
571
+ ...te(e),
570
572
  ...P(e),
571
573
  ...F(e),
572
574
  ...I(e),
573
575
  ...L(e),
574
- ...R(e),
575
- ...z(e),
576
- ...B(e)
576
+ ...R(e)
577
577
  ].filter((e) => e != null && !e.includes("placeholder")), O = (e) => e.dealBars.flatMap((e) => [e.mediaImageGID, e.badgeImageGID]).filter((e) => e != null), k = (e) => e.dealBars.flatMap((e) => e.dealBarType === d.Bundle ? e.bundleProducts.map((e) => e.mediaImageGID) : []).filter((e) => e != null), A = (e) => e.dealBars.map(({ freeGifts: e }) => (e || []).map((e) => e.mediaImageGID)).reduce((e, t) => e.concat(t), []).filter((e) => e != null), j = (e) => e.dealBars.flatMap(({ multipleGiftsSelectors: e }) => (e || []).map((e) => e.mediaImageGID)).filter((e) => e != null), M = (e) => e.dealBars.map(({ upsells: e }) => (e || []).map((e) => e.mediaImageGID)).reduce((e, t) => e.concat(t), []).filter((e) => e != null), N = (e) => e.swatchOptions ? e.swatchOptions.reduce((e, t) => {
578
578
  let n = t.images.map((e) => e.mediaImageGID).filter((e) => e != null);
579
579
  return [...e, ...n];
580
- }, []) : [], P = (e) => {
580
+ }, []) : [], ee = (e) => {
581
581
  if (!e.collectionBreaksEnabled || !e.collectionBreaks) return [];
582
582
  let t = e.collectionBreaks.mediaImageGID;
583
583
  return t ? [t] : [];
584
- }, F = (e) => e.progressiveGifts ? [
584
+ }, te = (e) => e.progressiveGifts ? [
585
585
  ...e.progressiveGifts.gifts?.map((e) => e.mediaImageGID) || [],
586
586
  e.progressiveGifts.style?.lockedMediaImageGID,
587
587
  e.progressiveGifts.dealBarStyle?.lockedMediaImageGID
588
- ].filter((e) => e != null) : [], I = (e) => !e.checkboxUpsellsEnabled || !e.checkboxUpsells ? [] : e.checkboxUpsells.upsells.flatMap((e) => [e.mediaImageGID, e.badgeImageGID]).filter((e) => e != null), L = (e) => e.dealBars.map((e) => e.productPersonalisation?.mediaImageGID).filter((e) => e != null), R = (e) => {
588
+ ].filter((e) => e != null) : [], P = (e) => !e.checkboxUpsellsEnabled || !e.checkboxUpsells ? [] : e.checkboxUpsells.upsells.flatMap((e) => [e.mediaImageGID, e.badgeImageGID]).filter((e) => e != null), F = (e) => e.dealBars.map((e) => e.productPersonalisation?.mediaImageGID).filter((e) => e != null), I = (e) => {
589
589
  let t = e.dealBars.map((e) => e.highlights?.customIconGID).filter((e) => e != null), n = e.subscriptions?.highlights?.customIconGID;
590
590
  return n ? [...t, n] : t;
591
- }, z = (e) => (e.badges || []).flatMap((e) => e.badgeType === "custom" && e.imageGID ? [e.imageGID] : []), B = (e) => !e.savingsSummaryEnabled || !e.savingsSummary ? [] : e.savingsSummary.customIconGID ? [e.savingsSummary.customIconGID] : [], V = (e, { includeMixAndMatchSwapProducts: t = !0 } = {}) => {
591
+ }, L = (e) => (e.badges || []).flatMap((e) => e.badgeType === "custom" && e.imageGID ? [e.imageGID] : []), R = (e) => !e.savingsSummaryEnabled || !e.savingsSummary ? [] : e.savingsSummary.customIconGID ? [e.savingsSummary.customIconGID] : [], z = (e, { includeMixAndMatchSwapProducts: t = !0 } = {}) => {
592
592
  let n = [
593
+ ...B(e),
594
+ ...V(e),
593
595
  ...H(e),
594
596
  ...U(e),
595
597
  ...W(e),
596
- ...G(e),
598
+ ...G(e, t),
597
599
  ...K(e),
598
- ...q(e, t),
599
- ...J(e),
600
- ...Y(e)
600
+ ...q(e)
601
601
  ];
602
602
  return Array.from(new Set(n.filter((e) => e != null)));
603
- }, H = (e) => e.dealBars.flatMap(({ freeGifts: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null), U = (e) => e.dealBars.flatMap(({ multipleGiftsSelectors: e }) => e ? e.flatMap((e) => e.products ? e.products.map((e) => e.id) : []) : []).filter((e) => e != null), W = (e) => e.progressiveGiftsEnabled && e.progressiveGifts?.gifts.map((e) => e.productGID).filter((e) => e != null) || [], G = (e) => e.dealBars.flatMap(({ upsells: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null), K = (e) => e.dealBars.filter((e) => e.dealBarType === d.Bundle).flatMap(({ bundleProducts: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null).filter((e) => e !== "default"), q = (e, t) => e.dealBars.filter((e) => e.dealBarType === d.MixAndMatch).flatMap(({ bundleProducts: e }) => e ? e.flatMap((e) => [e.productGID, ...t ? e.selectedProducts?.map((e) => e.id) ?? [] : []]) : []).filter((e) => e != null).filter((e) => e !== "default"), J = (e) => !e.checkboxUpsellsEnabled || !e.checkboxUpsells ? [] : e.checkboxUpsells.upsells.map((e) => e.productGID).filter((e) => e != null), Y = (e) => e.dealBars.filter((e) => e.dealBarType === d.Sku).flatMap(({ productGID: e }) => e ? [e] : []), X = class extends Error {
603
+ }, B = (e) => e.dealBars.flatMap(({ freeGifts: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null), V = (e) => e.dealBars.flatMap(({ multipleGiftsSelectors: e }) => e ? e.flatMap((e) => e.products ? e.products.map((e) => e.id) : []) : []).filter((e) => e != null), H = (e) => e.progressiveGiftsEnabled && e.progressiveGifts?.gifts.map((e) => e.productGID).filter((e) => e != null) || [], U = (e) => e.dealBars.flatMap(({ upsells: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null), W = (e) => e.dealBars.filter((e) => e.dealBarType === d.Bundle).flatMap(({ bundleProducts: e }) => e ? e.map((e) => e.productGID) : []).filter((e) => e != null).filter((e) => e !== "default"), G = (e, t) => e.dealBars.filter((e) => e.dealBarType === d.MixAndMatch).flatMap(({ bundleProducts: e }) => e ? e.flatMap((e) => [e.productGID, ...t ? e.selectedProducts?.map((e) => e.id) ?? [] : []]) : []).filter((e) => e != null).filter((e) => e !== "default"), K = (e) => !e.checkboxUpsellsEnabled || !e.checkboxUpsells ? [] : e.checkboxUpsells.upsells.map((e) => e.productGID).filter((e) => e != null), q = (e) => e.dealBars.filter((e) => e.dealBarType === d.Sku).flatMap(({ productGID: e }) => e ? [e] : []), J = class extends Error {
604
604
  constructor({ status: e, operationName: t, graphqlErrors: n }) {
605
605
  let r = n.length ? `: ${n.join("; ")}` : "";
606
606
  super(`Storefront API ${t ?? "query"} failed (HTTP ${e})${r}`), this.name = "StorefrontApiError", this.status = e, this.operationName = t, this.graphqlErrors = n;
607
607
  }
608
- }, Z = async (e, t) => {
608
+ }, Y = async (e, t) => {
609
609
  let n = await e.text();
610
610
  if (!n) throw Error("Empty graphql response");
611
611
  let r;
612
612
  try {
613
613
  r = JSON.parse(n);
614
614
  } catch (n) {
615
- throw e.ok ? n : new X({
615
+ throw e.ok ? n : new J({
616
616
  status: e.status,
617
617
  operationName: t,
618
618
  graphqlErrors: []
619
619
  });
620
620
  }
621
- if (!e.ok || r.data === null || r.data === void 0) throw new X({
621
+ if (!e.ok || r.data === null || r.data === void 0) throw new J({
622
622
  status: e.status,
623
623
  operationName: t,
624
624
  graphqlErrors: (r.errors ?? []).map(({ message: e }) => e).filter(Boolean)
625
625
  });
626
626
  return r.data;
627
- }, ee = class {
627
+ }, X = class {
628
628
  constructor(e, t) {
629
629
  this.storefrontApiVersion = "2026-07", this.storefrontAccessToken = t, this.shopifyDomain = e;
630
630
  }
631
631
  async query(e, t) {
632
632
  let n = t?.variables ?? {}, r = `https://${this.shopifyDomain}/api/${this.storefrontApiVersion}/graphql.json`, i = e.match(/query\s+(\w+)/)?.[1];
633
- return i && (r += `?operation_name=${i}`), Z(await fetch(r, {
633
+ return i && (r += `?operation_name=${i}`), Y(await fetch(r, {
634
634
  method: "POST",
635
635
  headers: {
636
636
  "Content-Type": "application/json",
@@ -642,7 +642,7 @@ var x = "app--2935586817", S = async (t, { language: n, country: r, useExternalM
642
642
  })
643
643
  }), i);
644
644
  }
645
- }, Q = (e, t) => {
645
+ }, Z = (e, t) => {
646
646
  let n = [], r = e.filter((e) => e.blockVisibility === "selected-products");
647
647
  for (let e of r) e.selectedProductIds.map(Number).includes(t.id) && n.push(e);
648
648
  let i = e.filter((e) => e.blockVisibility === "selected-collections");
@@ -652,7 +652,23 @@ var x = "app--2935586817", S = async (t, { language: n, country: r, useExternalM
652
652
  let o = e.filter((e) => e.blockVisibility === "all-products");
653
653
  for (let e of o) n.push(e);
654
654
  return n;
655
- }, te = async (e, t, { country: n, language: r }) => {
655
+ };
656
+ [
657
+ "primaryBackground",
658
+ "secondaryBackground",
659
+ "primaryText",
660
+ "secondaryText",
661
+ "border",
662
+ "overlay",
663
+ "primaryAccent",
664
+ "primaryAccentText",
665
+ "badgeBackground",
666
+ "badgeText",
667
+ "error"
668
+ ].map((e) => `brand_${e}`);
669
+ var ne = /* @__PURE__ */ function(e) {
670
+ return e.QuantityBreak = "quantity-break", e.Bxgy = "bxgy", e.Bundle = "bundle", e.MixAndMatch = "mix-and-match", e.Sku = "sku", e;
671
+ }({}), re = async (e, t, { country: n, language: r }) => {
656
672
  let i = t.collectionBreaks;
657
673
  if (!t.collectionBreaksEnabled || !i) return;
658
674
  let a;
@@ -677,8 +693,8 @@ var x = "app--2935586817", S = async (t, { language: n, country: r, useExternalM
677
693
  productIds: a.map((e) => Number(e.split("/").pop())),
678
694
  useExternalMetafieldNamespace: !0
679
695
  }), s = i.visibility === "deal-products" && t.blockVisibility === "excluded-products";
680
- return o = o.filter((e) => e.availableForSale && (!s || Q([t], e).length > 0)), o;
681
- }, ne = ({ language: e, dealBlockId: t }) => {
696
+ return o = o.filter((e) => e.availableForSale && (!s || Z([t], e).length > 0)), o;
697
+ }, ie = ({ language: e, dealBlockId: t }) => {
682
698
  let n = {
683
699
  "system.out_of_stock": "There's not enough items in our stock, please select smaller bundle.",
684
700
  "system.invalid_variant": "Sorry, this is not currently available.",
@@ -705,13 +721,13 @@ var x = "app--2935586817", S = async (t, { language: n, country: r, useExternalM
705
721
  "system.numbers_only": "Only numbers are allowed.",
706
722
  "system.personalisation_required_alert": "Please add personalisation for every item to continue.",
707
723
  "system.gifts_required_alert": "Please choose your free gifts"
708
- }, r = e ? re(e) : void 0;
724
+ }, r = e ? ae(e) : void 0;
709
725
  return {
710
726
  ...n,
711
727
  ...r?.system,
712
728
  ...r?.dealBlocks[t]
713
729
  };
714
- }, re = (e) => {
730
+ }, ae = (e) => {
715
731
  if (typeof document > "u") return;
716
732
  let t = document.querySelector("script#kaching-bundles-translations");
717
733
  if (!t?.textContent) return;
@@ -721,11 +737,11 @@ var x = "app--2935586817", S = async (t, { language: n, country: r, useExternalM
721
737
  } catch {
722
738
  return;
723
739
  }
724
- let r = $(e);
725
- return n.find((e) => $(e.locale) === r)?.translations;
726
- }, $ = (e) => e.toLowerCase().replace(/_/g, "-"), ie = "2026-07", ae = async (e, { productId: t, dealBlockId: n, abTestVariantId: r, country: i = void 0, language: a = void 0 }) => {
740
+ let r = Q(e);
741
+ return n.find((e) => Q(e.locale) === r)?.translations;
742
+ }, Q = (e) => e.toLowerCase().replace(/_/g, "-"), oe = "2026-07", $ = async (e, { productId: t, dealBlockId: n, abTestVariantId: r, country: i = void 0, language: a = void 0 }) => {
727
743
  try {
728
- let o = [Number(t.split("/").pop())], s = new oe(e);
744
+ let o = [Number(t.split("/").pop())], s = new de(e);
729
745
  i ||= s.i18n?.country, a ||= s.i18n?.language;
730
746
  let l = await S(s, {
731
747
  language: a,
@@ -733,7 +749,7 @@ var x = "app--2935586817", S = async (t, { language: n, country: r, useExternalM
733
749
  useExternalMetafieldNamespace: !0
734
750
  });
735
751
  s.shopifyDomain = l.shopifyDomain;
736
- let u = l.storefrontAccessToken ? new ee(l.shopifyDomain, l.storefrontAccessToken) : s, [d, f] = await Promise.all([m(u, {
752
+ let u = l.storefrontAccessToken ? new X(l.shopifyDomain, l.storefrontAccessToken) : s, [d, f] = await Promise.all([m(u, {
737
753
  country: i,
738
754
  language: a,
739
755
  productIds: o,
@@ -743,50 +759,77 @@ var x = "app--2935586817", S = async (t, { language: n, country: r, useExternalM
743
759
  useMetaobjects: l.featureFlags.storefront_metaobjects
744
760
  })]), p = d[0];
745
761
  if (!p) return null;
746
- let h = Q(f, p), g = n ? h.filter((e) => e.id === n || e.nanoId === n) : h, _ = (r ? g.find((e) => e.abTestVariantId === r) : void 0) ?? g[0] ?? h[0];
762
+ let h = Z(f, p), g = n ? h.filter((e) => e.id === n || e.nanoId === n) : h, _ = (r ? g.find((e) => e.abTestVariantId === r) : void 0) ?? g[0] ?? h[0];
747
763
  if (!_) return null;
748
- let v = D(_), [y, b, x, C] = await Promise.all([
749
- (async () => {
750
- let e = [];
751
- try {
752
- e = await E(u, {
753
- dealBlock: _,
754
- country: i,
755
- language: a
756
- });
757
- } catch (e) {
758
- console.error(e);
759
- }
760
- return m(u, {
761
- country: i,
762
- language: a,
763
- productIds: [.../* @__PURE__ */ new Set([...V(_), ...e])],
764
- useExternalMetafieldNamespace: !0
765
- });
766
- })(),
767
- w(u, v, 300),
768
- te(u, _, {
764
+ let v = z(_, { includeMixAndMatchSwapProducts: !1 }), y = se(u, _, {
765
+ otherProductGIDs: v,
766
+ country: i,
767
+ language: a
768
+ }), [b, x, C] = await Promise.all([
769
+ m(u, {
769
770
  country: i,
770
- language: a
771
+ language: a,
772
+ productIds: v,
773
+ useExternalMetafieldNamespace: !0
771
774
  }),
772
- ne({
775
+ w(u, D(_), 300),
776
+ ie({
773
777
  language: a,
774
778
  dealBlockId: _.id
775
779
  })
776
780
  ]);
777
781
  return {
778
- product: p,
779
- dealBlock: _,
780
- config: l,
781
- otherProducts: y,
782
- mediaImages: b,
783
- collectionBreaksProducts: x ?? [],
784
- translations: C
782
+ data: {
783
+ config: l,
784
+ dealBlock: _,
785
+ product: p,
786
+ otherProducts: b,
787
+ mediaImages: x,
788
+ translations: C
789
+ },
790
+ modalProducts: y
785
791
  };
786
792
  } catch (e) {
787
793
  return console.error(e), null;
788
794
  }
789
- }, oe = class {
795
+ }, se = async (e, t, n) => {
796
+ let [r, i] = await Promise.all([ce(e, t, n), ue(e, t, n)]);
797
+ return {
798
+ mixAndMatchSwapProducts: r,
799
+ collectionBreaksProducts: i
800
+ };
801
+ }, ce = async (e, t, { otherProductGIDs: n, country: r, language: i }) => {
802
+ try {
803
+ let a = [];
804
+ try {
805
+ a = await E(e, {
806
+ dealBlock: t,
807
+ country: r,
808
+ language: i
809
+ });
810
+ } catch (e) {
811
+ console.error(e);
812
+ }
813
+ let o = new Set(n), s = [.../* @__PURE__ */ new Set([...le(t), ...a])].filter((e) => !o.has(e));
814
+ return s.length ? await m(e, {
815
+ country: r,
816
+ language: i,
817
+ productIds: s,
818
+ useExternalMetafieldNamespace: !0
819
+ }) : [];
820
+ } catch (e) {
821
+ return console.error(e), [];
822
+ }
823
+ }, le = (e) => e.dealBars.flatMap((e) => e.dealBarType === ne.MixAndMatch ? e.bundleProducts.flatMap((e) => (e.selectedProducts ?? []).map((e) => e.id)) : []), ue = async (e, t, { country: n, language: r }) => {
824
+ try {
825
+ return await re(e, t, {
826
+ country: n,
827
+ language: r
828
+ }) ?? [];
829
+ } catch (e) {
830
+ return console.error(e), [];
831
+ }
832
+ }, de = class {
790
833
  constructor(e) {
791
834
  this.storefront = e, this.shopifyDomain = "";
792
835
  }
@@ -799,7 +842,7 @@ var x = "app--2935586817", S = async (t, { language: n, country: r, useExternalM
799
842
  }
800
843
  if ("request" in this.storefront) return (await this.storefront.request(e, t)).data;
801
844
  if ("shopifyDomain" in this.storefront && "storefrontAccessToken" in this.storefront) {
802
- let n = await fetch(`https://${this.storefront.shopifyDomain}/api/${ie}/graphql.json`, {
845
+ let n = await fetch(`https://${this.storefront.shopifyDomain}/api/${oe}/graphql.json`, {
803
846
  body: JSON.stringify({
804
847
  query: e,
805
848
  variables: t?.variables
@@ -829,5 +872,23 @@ var x = "app--2935586817", S = async (t, { language: n, country: r, useExternalM
829
872
  get i18n() {
830
873
  if ("i18n" in this.storefront) return this.storefront.i18n;
831
874
  }
875
+ }, fe = async (e, t) => {
876
+ try {
877
+ let n = await $(e, t);
878
+ if (!n) return null;
879
+ let { config: r, dealBlock: i, product: a, otherProducts: o, mediaImages: s, translations: c } = n.data, { mixAndMatchSwapProducts: l, collectionBreaksProducts: u } = await n.modalProducts;
880
+ return {
881
+ config: r,
882
+ dealBlock: i,
883
+ product: a,
884
+ otherProducts: o,
885
+ mixAndMatchSwapProducts: l,
886
+ mediaImages: s,
887
+ collectionBreaksProducts: u,
888
+ translations: c
889
+ };
890
+ } catch (e) {
891
+ return console.error(e), null;
892
+ }
832
893
  };
833
- export { ae as fetchKachingBundlesData };
894
+ export { fe as fetchKachingBundlesData };
@@ -413,13 +413,7 @@ declare type DefaultSortOption = "relevance" | "newest-first" | "price-low-to-hi
413
413
 
414
414
  declare type DiscountType = "default" | "percentage" | "amount" | "specific";
415
415
 
416
- export declare const fetchKachingBundlesData: (storefront: HydrogenV2Storefront | HydrogenStorefrontClient | ReactHydrogenStorefront | ShopifyStorefrontApiClient | StorefrontCredentials, { productId, dealBlockId, abTestVariantId, country, language, }: {
417
- productId: string;
418
- dealBlockId?: string;
419
- abTestVariantId?: string;
420
- country?: string;
421
- language?: string;
422
- }) => Promise<KachingBundlesData | null>;
416
+ export declare const fetchKachingBundlesData: (storefront: KachingBundlesStorefront, options: KachingBundlesDataOptions) => Promise<KachingBundlesData | null>;
423
417
 
424
418
  declare type Font = {
425
419
  size: string | number;
@@ -725,6 +719,7 @@ export declare interface KachingBundlesData {
725
719
  dealBlock: DealBlock;
726
720
  product: Product;
727
721
  otherProducts: Product[];
722
+ mixAndMatchSwapProducts: Product[];
728
723
  mediaImages: {
729
724
  gid: string;
730
725
  url: string;
@@ -735,6 +730,16 @@ export declare interface KachingBundlesData {
735
730
  };
736
731
  }
737
732
 
733
+ declare interface KachingBundlesDataOptions {
734
+ productId: string;
735
+ dealBlockId?: string;
736
+ abTestVariantId?: string;
737
+ country?: string;
738
+ language?: string;
739
+ }
740
+
741
+ declare type KachingBundlesStorefront = HydrogenV2Storefront | HydrogenStorefrontClient | ReactHydrogenStorefront | ShopifyStorefrontApiClient | StorefrontCredentials;
742
+
738
743
  declare type LowStockAlert = {
739
744
  threshold: number;
740
745
  message: string;