@kachingappz/bundles-js 1.1.3 → 1.1.5

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.
@@ -21,7 +21,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
21
21
  }
22
22
  }
23
23
  }
24
- `,{variables:{type:n,cursor:i}});for(let e of t.metaobjects.nodes){let t=e.fields.find(e=>e.key===`settings`);t?.value&&r.push(JSON.parse(t.value))}if(!t.metaobjects.pageInfo.hasNextPage)break;i=t.metaobjects.pageInfo.endCursor}return r},p=async(e,{country:t,language:n,blockVisibility:r,excludedProductGIDs:i,selectedProductGIDs:a,selectedCollectionGIDs:o,limit:s=1e3})=>{switch(r){case`selected-products`:return a.slice(0,s);case`all-products`:case`excluded-products`:{let a=l({country:t,language:n}),o=[],c=null;for(;o.length<s;){let t=Math.min(s-o.length,250),n=await e.query(`
24
+ `,{variables:{type:n,cursor:i}});for(let e of t.metaobjects.nodes){let t=e.fields.find(e=>e.key===`settings`);t?.value&&r.push(JSON.parse(t.value))}if(!t.metaobjects.pageInfo.hasNextPage)break;i=t.metaobjects.pageInfo.endCursor}return r};[`primaryBackground`,`secondaryBackground`,`primaryText`,`secondaryText`,`border`,`overlay`,`primaryAccent`,`primaryAccentText`,`badgeBackground`,`badgeText`,`error`].map(e=>`brand_${e}`);var p=function(e){return e.QuantityBreak=`quantity-break`,e.Bxgy=`bxgy`,e.Bundle=`bundle`,e.MixAndMatch=`mix-and-match`,e.Sku=`sku`,e}({}),m=async(e,{country:t,language:n,blockVisibility:r,excludedProductGIDs:i,selectedProductGIDs:a,selectedCollectionGIDs:o,limit:s=1e3})=>{switch(r){case`selected-products`:return a.slice(0,s);case`all-products`:case`excluded-products`:{let a=l({country:t,language:n}),o=[],c=null;for(;o.length<s;){let t=Math.min(s-o.length,250),n=await e.query(`
25
25
  query FetchProductGIDs($limit: Int!, $cursor: String) ${a} {
26
26
  products(first: $limit, after: $cursor) {
27
27
  nodes {
@@ -45,7 +45,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
45
45
  }
46
46
  }
47
47
  }
48
- `,{variables:{collectionGIDs:o,limit:Math.min(s,250)}})).nodes.filter(e=>e!==null).flatMap(e=>e.products.nodes.map(e=>e.id));return Array.from(new Set(i)).slice(0,s)}}},m=`
48
+ `,{variables:{collectionGIDs:o,limit:Math.min(s,250)}})).nodes.filter(e=>e!==null).flatMap(e=>e.products.nodes.map(e=>e.id));return Array.from(new Set(i)).slice(0,s)}}},h=`
49
49
  id
50
50
  availableForSale
51
51
  price {
@@ -88,8 +88,8 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
88
88
  }
89
89
  }
90
90
  quantityAvailable @include(if: $includeAvailableQuantity)
91
- `,h=async(e,{country:t,language:n,productIds:r,includeSellingPlans:i=!0,includeAvailableQuantity:a=!0,includeProductRating:o=!1,useExternalMetafieldNamespace:s=!1,batchSize:c=250,onBatchError:u,variantImageTransform:d={maxWidth:200,maxHeight:200}})=>{if(!r.length)return[];let f=r.map(e=>typeof e==`string`&&e.startsWith(`gid://`)?e:`gid://shopify/Product/${e}`),p=l({country:t,language:n}),h=`
92
- query FetchProducts($productGIDs: [ID!]!, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $includeProductRating: Boolean!, $metafieldNamespace: String!, $variantImageTransform: ImageTransformInput) ${p} {
91
+ `,g=async(e,{country:t,language:n,productIds:r,includeSellingPlans:i=!0,includeAvailableQuantity:a=!0,includeProductRating:o=!1,includeProductSubtitle:s=!1,productSubtitleMetafield:c=`descriptors.subtitle`,useExternalMetafieldNamespace:u=!1,batchSize:d=250,onBatchError:f,variantImageTransform:p={maxWidth:200,maxHeight:200}})=>{if(!r.length)return[];let m=r.map(e=>typeof e==`string`&&e.startsWith(`gid://`)?e:`gid://shopify/Product/${e}`),g=l({country:t,language:n}),y=`
92
+ query FetchProducts($productGIDs: [ID!]!, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $includeProductRating: Boolean!, $includeProductSubtitle: Boolean!, $subtitleNamespace: String!, $subtitleKey: String!, $metafieldNamespace: String!, $variantImageTransform: ImageTransformInput) ${g} {
93
93
  shop {
94
94
  currencyRateConstant: metafield(namespace: $metafieldNamespace, key: "currency_rate_constant") {
95
95
  value
@@ -123,7 +123,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
123
123
  }
124
124
  variants(first: 250) {
125
125
  nodes {
126
- ${m}
126
+ ${h}
127
127
  }
128
128
  }
129
129
  collections(first: 50) {
@@ -149,6 +149,9 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
149
149
  reviewsRatingCount: metafield(namespace: "reviews", key: "rating_count") @include(if: $includeProductRating) {
150
150
  value
151
151
  }
152
+ subtitle: metafield(namespace: $subtitleNamespace, key: $subtitleKey) @include(if: $includeProductSubtitle) {
153
+ value
154
+ }
152
155
  requiresSellingPlan
153
156
  sellingPlanGroups(first: 100) @include(if: $includeSellingPlans) {
154
157
  nodes {
@@ -181,12 +184,12 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
181
184
  }
182
185
  }
183
186
  }
184
- `,v=s?`app--2935586817--kaching_bundles`:`$app:kaching_bundles`,y=[],b=Math.min(c,250);for(let e=0;e<f.length;e+=b)y.push(f.slice(e,e+b));let x=1,S=async t=>{let n=await e.query(h,{variables:{productGIDs:t,includeSellingPlans:i,includeAvailableQuantity:a,includeProductRating:o,metafieldNamespace:v,variantImageTransform:d}});return n.shop.currencyRateConstant&&(x=JSON.parse(n.shop.currencyRateConstant.value).amount/1e6),n},C;if(u){let e=await Promise.allSettled(y.map(S));for(let t of e)t.status===`rejected`&&u(t.reason instanceof Error?t.reason:Error(String(t.reason)));C=e.filter(e=>e.status===`fulfilled`).flatMap(e=>e.value.nodes)}else C=(await Promise.all(y.map(S))).flatMap(e=>e.nodes);let w=C.filter(e=>e!=null);if(u){let t=await Promise.allSettled(w.map(async t=>_(await g(e,t,{includeSellingPlans:i,includeAvailableQuantity:a,variantImageTransform:d},p),e.shopifyDomain,x))),n=[];for(let e of t)e.status===`fulfilled`?n.push(e.value):u(e.reason instanceof Error?e.reason:Error(String(e.reason)));return n}return(await Promise.all(w.map(t=>g(e,t,{includeSellingPlans:i,includeAvailableQuantity:a,variantImageTransform:d},p)))).map(t=>_(t,e.shopifyDomain,x))},g=async(e,t,n,r=``)=>{if(t.variants.nodes.length<250)return t;let i=new Set,a=[],o=[],s=async s=>{let c=!0,l=null;for(;c;){let{nodes:u,pageInfo:d}=(await e.query(`
187
+ `,b=u?`app--2935586817--kaching_bundles`:`$app:kaching_bundles`,x=c.indexOf(`.`),S=c.slice(0,x),C=c.slice(x+1),w=[],T=Math.min(d,250);for(let e=0;e<m.length;e+=T)w.push(m.slice(e,e+T));let E=1,D=async t=>{let n=await e.query(y,{variables:{productGIDs:t,includeSellingPlans:i,includeAvailableQuantity:a,includeProductRating:o,includeProductSubtitle:s,subtitleNamespace:S,subtitleKey:C,metafieldNamespace:b,variantImageTransform:p}});return n.shop.currencyRateConstant&&(E=JSON.parse(n.shop.currencyRateConstant.value).amount/1e6),n},O;if(f){let e=await Promise.allSettled(w.map(D));for(let t of e)t.status===`rejected`&&f(t.reason instanceof Error?t.reason:Error(String(t.reason)));O=e.filter(e=>e.status===`fulfilled`).flatMap(e=>e.value.nodes)}else O=(await Promise.all(w.map(D))).flatMap(e=>e.nodes);let k=O.filter(e=>e!=null);if(f){let t=await Promise.allSettled(k.map(async t=>v(await _(e,t,{includeSellingPlans:i,includeAvailableQuantity:a,variantImageTransform:p},g),e.shopifyDomain,E))),n=[];for(let e of t)e.status===`fulfilled`?n.push(e.value):f(e.reason instanceof Error?e.reason:Error(String(e.reason)));return n}return(await Promise.all(k.map(t=>_(e,t,{includeSellingPlans:i,includeAvailableQuantity:a,variantImageTransform:p},g)))).map(t=>v(t,e.shopifyDomain,E))},_=async(e,t,n,r=``)=>{if(t.variants.nodes.length<250)return t;let i=new Set,a=[],o=[],s=async s=>{let c=!0,l=null;for(;c;){let{nodes:u,pageInfo:d}=(await e.query(`
185
188
  query($productGID: ID!, $cursor: String, $reverse: Boolean, $includeSellingPlans: Boolean!, $includeAvailableQuantity: Boolean!, $variantImageTransform: ImageTransformInput) ${r} {
186
189
  product(id: $productGID) {
187
190
  variants(first: 250, after: $cursor, reverse: $reverse) {
188
191
  nodes {
189
- ${m}
192
+ ${h}
190
193
  }
191
194
  pageInfo {
192
195
  endCursor
@@ -195,7 +198,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
195
198
  }
196
199
  }
197
200
  }
198
- `,{variables:{productGID:t.id,cursor:l,reverse:s,...n}})).product.variants;for(let e of u){if(i.has(e.id)){c=!1;break}i.add(e.id),s?o.push(e):a.push(e)}d.hasNextPage||(c=!1),l=d.endCursor}};return await Promise.all([s(!1),s(!0)]),t.variants.nodes=[...a,...o.reverse()],t},_=(e,t,n)=>{let r=e.variants.nodes.map(({unitPriceMeasurement:e,...t})=>({id:Number(t.id.split(`/`).pop()),availableForSale:t.availableForSale,price:Math.round(Number(t.price.amount)*100),compareAtPrice:t.compareAtPrice?Math.round(Number(t.compareAtPrice.amount)*100):null,options:t.selectedOptions.map(e=>e.value),imageId:t.image?Number(t.image.id.split(`/`).pop()):null,image:t.image?.url||null,sellingPlans:t.sellingPlanAllocations?.nodes.map(e=>({id:Number(e.sellingPlan.id.split(`/`).pop()),price:e.priceAdjustments.length>0?Math.round(Number(e.priceAdjustments[0].price.amount)*100):Math.round(Number(t.price.amount)*100),compareAtPrice:e.priceAdjustments.length>0?Math.round(Number(e.priceAdjustments[0].compareAtPrice.amount)*100):Math.round(Number(t.price.amount)*100),perDeliveryPrice:e.priceAdjustments.length>0?Math.round(Number(e.priceAdjustments[0].perDeliveryPrice.amount)*100):Math.round(Number(t.price.amount)*100)}))||[],inventoryManagement:null,inventoryPolicy:null,inventoryQuantity:t.quantityAvailable??null,unitPriceMeasurement:e?.quantityUnit&&e?.referenceUnit?{quantityValue:e.quantityValue,quantityUnit:e.quantityUnit.toLowerCase(),referenceValue:e.referenceValue,referenceUnit:e.referenceUnit.toLowerCase()}:null})),i=e.options.map((e,t)=>{let n=e.optionValues.map(e=>({id:Number(e.id.split(`/`).pop()),defaultName:e.name,name:e.name,swatch:{color:e.swatch?.color||null,image:e.swatch?.image?.previewImage?.url||null}}));return{defaultName:e.name,name:e.name,position:t+1,optionValues:b(n,t,r)}}),a=e=>{let t=e.priceAdjustments[0];if(!t)return null;let n=t.adjustmentValue;switch(n.__typename){case`SellingPlanPercentagePriceAdjustment`:return{type:`percentage`,value:n.adjustmentPercentage};case`SellingPlanFixedAmountPriceAdjustment`:return{type:`fixed_amount`,value:o(n.adjustmentAmount.amount)};case`SellingPlanFixedPriceAdjustment`:return{type:`price`,value:o(n.price.amount)};default:throw Error(`Unknown price adjustment type: ${n.__typename}`)}},o=e=>n===1?Number(e)*100:Math.round(Number(e)*100*n),s=e.sellingPlanGroups?.nodes.flatMap(e=>e.sellingPlans.nodes.map(e=>({id:Number(e.id.split(`/`).pop()),name:e.name,priceAdjustment:a(e)})))||[],c=e.variants.nodes.some(e=>e.requiresComponents);return{id:Number(e.id.split(`/`).pop()),handle:e.handle,url:e.onlineStoreUrl||`https://${t}/products/${e.handle}`,availableForSale:e.availableForSale,createdAt:e.createdAt,title:e.title,image:e.featuredImage?.url||null,collectionIds:e.collections.nodes.map(e=>Number(e.id.split(`/`).pop())),options:i,selectedVariantId:Number(e.variants.nodes[0].id.split(`/`).pop()),variants:r,requiresSellingPlan:e.requiresSellingPlan,sellingPlans:s,isNativeBundle:c,metafields:{text:e.metafield?.value||null,text2:e.metafield2?.value||null,text3:e.metafield3?.value||null,text4:e.metafield4?.value||null},rating:v(e.reviewsRating,e.reviewsRatingCount)}},v=(e,t)=>{if(!e)return null;let n=y(e.value);if(n===null)return null;let r=Number(t?.value);return{value:n,count:Number.isInteger(r)&&r>0?r:null}},y=e=>{try{let{value:t,scale_max:n}=JSON.parse(e),r=Number(t)/Number(n)*5;return Number.isFinite(r)&&r>0?Math.min(5,r):null}catch{return null}},b=(e,t,n)=>e.filter(e=>n.filter(n=>n.options[t]===e.name).length>0),x=`app--2935586817`,S=async(e,{language:t,country:r,useExternalMetafieldNamespace:i})=>{let a=i?`${x}--kaching_bundles`:`$app:kaching_bundles`,o=i?x:`$app`,s=l({country:r}),{localization:{country:{currency:{isoCode:c}}},shop:{moneyFormat:u,paymentSettings:{currencyCode:d},currencyRateConstant:f,primaryDomain:p,settingsMetafield:m}}=await e.query(`
201
+ `,{variables:{productGID:t.id,cursor:l,reverse:s,...n}})).product.variants;for(let e of u){if(i.has(e.id)){c=!1;break}i.add(e.id),s?o.push(e):a.push(e)}d.hasNextPage||(c=!1),l=d.endCursor}};return await Promise.all([s(!1),s(!0)]),t.variants.nodes=[...a,...o.reverse()],t},v=(e,t,n)=>{let r=e.variants.nodes.map(({unitPriceMeasurement:e,...t})=>({id:Number(t.id.split(`/`).pop()),availableForSale:t.availableForSale,price:Math.round(Number(t.price.amount)*100),compareAtPrice:t.compareAtPrice?Math.round(Number(t.compareAtPrice.amount)*100):null,options:t.selectedOptions.map(e=>e.value),imageId:t.image?Number(t.image.id.split(`/`).pop()):null,image:t.image?.url||null,sellingPlans:t.sellingPlanAllocations?.nodes.map(e=>({id:Number(e.sellingPlan.id.split(`/`).pop()),price:e.priceAdjustments.length>0?Math.round(Number(e.priceAdjustments[0].price.amount)*100):Math.round(Number(t.price.amount)*100),compareAtPrice:e.priceAdjustments.length>0?Math.round(Number(e.priceAdjustments[0].compareAtPrice.amount)*100):Math.round(Number(t.price.amount)*100),perDeliveryPrice:e.priceAdjustments.length>0?Math.round(Number(e.priceAdjustments[0].perDeliveryPrice.amount)*100):Math.round(Number(t.price.amount)*100)}))||[],inventoryManagement:null,inventoryPolicy:null,inventoryQuantity:t.quantityAvailable??null,unitPriceMeasurement:e?.quantityUnit&&e?.referenceUnit?{quantityValue:e.quantityValue,quantityUnit:e.quantityUnit.toLowerCase(),referenceValue:e.referenceValue,referenceUnit:e.referenceUnit.toLowerCase()}:null})),i=e.options.map((e,t)=>{let n=e.optionValues.map(e=>({id:Number(e.id.split(`/`).pop()),defaultName:e.name,name:e.name,swatch:{color:e.swatch?.color||null,image:e.swatch?.image?.previewImage?.url||null}}));return{defaultName:e.name,name:e.name,position:t+1,optionValues:x(n,t,r)}}),a=e=>{let t=e.priceAdjustments[0];if(!t)return null;let n=t.adjustmentValue;switch(n.__typename){case`SellingPlanPercentagePriceAdjustment`:return{type:`percentage`,value:n.adjustmentPercentage};case`SellingPlanFixedAmountPriceAdjustment`:return{type:`fixed_amount`,value:o(n.adjustmentAmount.amount)};case`SellingPlanFixedPriceAdjustment`:return{type:`price`,value:o(n.price.amount)};default:throw Error(`Unknown price adjustment type: ${n.__typename}`)}},o=e=>n===1?Number(e)*100:Math.round(Number(e)*100*n),s=e.sellingPlanGroups?.nodes.flatMap(e=>e.sellingPlans.nodes.map(e=>({id:Number(e.id.split(`/`).pop()),name:e.name,priceAdjustment:a(e)})))||[],c=e.variants.nodes.some(e=>e.requiresComponents);return{id:Number(e.id.split(`/`).pop()),handle:e.handle,url:e.onlineStoreUrl||`https://${t}/products/${e.handle}`,availableForSale:e.availableForSale,createdAt:e.createdAt,title:e.title,image:e.featuredImage?.url||null,collectionIds:e.collections.nodes.map(e=>Number(e.id.split(`/`).pop())),options:i,selectedVariantId:Number(e.variants.nodes[0].id.split(`/`).pop()),variants:r,requiresSellingPlan:e.requiresSellingPlan,sellingPlans:s,isNativeBundle:c,metafields:{text:e.metafield?.value||null,text2:e.metafield2?.value||null,text3:e.metafield3?.value||null,text4:e.metafield4?.value||null},rating:y(e.reviewsRating,e.reviewsRatingCount),subtitle:e.subtitle?.value||null}},y=(e,t)=>{if(!e)return null;let n=b(e.value);if(n===null)return null;let r=Number(t?.value);return{value:n,count:Number.isInteger(r)&&r>0?r:null}},b=e=>{try{let{value:t,scale_max:n}=JSON.parse(e),r=Number(t)/Number(n)*5;return Number.isFinite(r)&&r>0?Math.min(5,r):null}catch{return null}},x=(e,t,n)=>e.filter(e=>n.filter(n=>n.options[t]===e.name).length>0),S=`app--2935586817`,C=async(e,{language:t,country:r,useExternalMetafieldNamespace:i})=>{let a=i?`${S}--kaching_bundles`:`$app:kaching_bundles`,o=i?S:`$app`,s=l({country:r}),{localization:{country:{currency:{isoCode:c}}},shop:{moneyFormat:u,paymentSettings:{currencyCode:d},currencyRateConstant:f,primaryDomain:p,settingsMetafield:m}}=await e.query(`
199
202
  query config($metafieldNamespace: String!, $settingsNamespace: String!) ${s} {
200
203
  localization {
201
204
  country {
@@ -220,7 +223,7 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
220
223
  }
221
224
  }
222
225
  }
223
- `,{variables:{metafieldNamespace:a,settingsNamespace:o}}),h=c===d?u:n(c,{language:t,country:r}),g=f?C(f.value):1,_=m?JSON.parse(m.value):null,v=_?.feature_flags??{},y=_?.custom_selectors??{};return{shopifyDomain:p.host,moneyFormat:h,locale:t?.toLowerCase()||`en`,liquidLocale:t?.toLowerCase()||`en`,country:r??`US`,currencyRate:g,marketId:0,productId:null,storefrontAccessToken:_?.storefront_access_token??null,includeSellingPlans:_?.include_selling_plans??!1,includeAvailableQuantity:_?.include_available_quantity??!1,customApiHost:_?.custom_api_host??null,keepQuantityInput:_?.keep_quantity_input??!1,ignoreDeselect:_?.ignore_deselect??!1,ignoreUnitPrice:_?.ignore_unit_price??!1,requireCustomerLogin:_?.require_customer_login??!1,abTestsRunning:_?.ab_tests_running??!1,webPixel:_?.web_pixel??!1,b2bCustomer:!1,isLoggedIn:!1,preview:!1,previewAlerts:!1,previewScratchOff:!1,defaultTranslations:{"system.out_of_stock":`Out of stock`,"system.invalid_variant":`Invalid variant`,"system.unavailable_option_value":`Unavailable option value`,"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:y.quantity??null,addToCartButton:y.add_to_cart_button??null,variantPicker:y.variant_picker??null,price:y.price??null,priceCompare:y.price_compare??null},shopCustomStyles:_?.shop_custom_styles??``,featureFlags:v,brandColors:_?.brand_colors??null}},C=e=>JSON.parse(e).amount/1e6,w=async(e,t,n=200)=>{let r=[...new Set(t.filter(Boolean).filter(e=>!e.startsWith(`placeholder`)))];if(r.length===0)return[];let i=[];for(let e=0;e<r.length;e+=250)i.push(r.slice(e,e+250));return(await Promise.all(i.map(t=>e.query(`
226
+ `,{variables:{metafieldNamespace:a,settingsNamespace:o}}),h=c===d?u:n(c,{language:t,country:r}),g=f?w(f.value):1,_=m?JSON.parse(m.value):null,v=_?.feature_flags??{},y=_?.custom_selectors??{};return{shopifyDomain:p.host,moneyFormat:h,locale:t?.toLowerCase()||`en`,liquidLocale:t?.toLowerCase()||`en`,country:r??`US`,currencyRate:g,marketId:0,productId:null,storefrontAccessToken:_?.storefront_access_token??null,includeSellingPlans:_?.include_selling_plans??!1,includeAvailableQuantity:_?.include_available_quantity??!1,customApiHost:_?.custom_api_host??null,keepQuantityInput:_?.keep_quantity_input??!1,ignoreDeselect:_?.ignore_deselect??!1,ignoreUnitPrice:_?.ignore_unit_price??!1,requireCustomerLogin:_?.require_customer_login??!1,abTestsRunning:_?.ab_tests_running??!1,webPixel:_?.web_pixel??!1,b2bCustomer:!1,isLoggedIn:!1,preview:!1,previewAlerts:!1,previewScratchOff:!1,defaultTranslations:{"system.out_of_stock":`Out of stock`,"system.invalid_variant":`Invalid variant`,"system.unavailable_option_value":`Unavailable option value`,"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:y.quantity??null,addToCartButton:y.add_to_cart_button??null,variantPicker:y.variant_picker??null,price:y.price??null,priceCompare:y.price_compare??null},shopCustomStyles:_?.shop_custom_styles??``,featureFlags:v,brandColors:_?.brand_colors??null}},w=e=>JSON.parse(e).amount/1e6,T=async(e,t,n=200)=>{let r=[...new Set(t.filter(Boolean).filter(e=>!e.startsWith(`placeholder`)))];if(r.length===0)return[];let i=[];for(let e=0;e<r.length;e+=250)i.push(r.slice(e,e+250));return(await Promise.all(i.map(t=>e.query(`
224
227
  query FetchMediaImages($mediaImageIds: [ID!]!, $size: Int!) {
225
228
  nodes(ids: $mediaImageIds) {
226
229
  ... on MediaImage {
@@ -231,5 +234,5 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
231
234
  }
232
235
  }
233
236
  }
234
- `,{variables:{mediaImageIds:t,size:n}})))).flatMap(e=>e.nodes).flatMap(e=>e?.image?[{gid:e.id,url:e.image.url}]:[])};[`primaryBackground`,`secondaryBackground`,`primaryText`,`secondaryText`,`border`,`overlay`,`primaryAccent`,`primaryAccentText`,`badgeBackground`,`badgeText`,`error`].map(e=>`brand_${e}`);var T=function(e){return e.QuantityBreak=`quantity-break`,e.Bxgy=`bxgy`,e.Bundle=`bundle`,e.MixAndMatch=`mix-and-match`,e.Sku=`sku`,e}({}),E=e=>[...ee(e),...te(e),...ne(e),...re(e),...ie(e),...ae(e),...oe(e),...se(e),...ce(e),...D(e),...O(e),...k(e),...A(e)].filter(e=>e!=null&&!e.includes(`placeholder`)),ee=e=>e.dealBars.flatMap(e=>[e.mediaImageGID,e.badgeImageGID]).filter(e=>e!=null),te=e=>e.dealBars.flatMap(e=>e.dealBarType===T.Bundle?e.bundleProducts.map(e=>e.mediaImageGID):[]).filter(e=>e!=null),ne=e=>e.dealBars.map(({freeGifts:e})=>(e||[]).map(e=>e.mediaImageGID)).reduce((e,t)=>e.concat(t),[]).filter(e=>e!=null),re=e=>e.dealBars.flatMap(({multipleGiftsSelectors:e})=>(e||[]).map(e=>e.mediaImageGID)).filter(e=>e!=null),ie=e=>e.dealBars.map(({upsells:e})=>(e||[]).map(e=>e.mediaImageGID)).reduce((e,t)=>e.concat(t),[]).filter(e=>e!=null),ae=e=>e.swatchOptions?e.swatchOptions.reduce((e,t)=>{let n=t.images.map(e=>e.mediaImageGID).filter(e=>e!=null);return[...e,...n]},[]):[],oe=e=>{if(!e.collectionBreaksEnabled||!e.collectionBreaks)return[];let t=e.collectionBreaks.mediaImageGID;return t?[t]:[]},se=e=>e.progressiveGifts?[...e.progressiveGifts.gifts?.map(e=>e.mediaImageGID)||[],e.progressiveGifts.style?.lockedMediaImageGID,e.progressiveGifts.dealBarStyle?.lockedMediaImageGID].filter(e=>e!=null):[],ce=e=>!e.checkboxUpsellsEnabled||!e.checkboxUpsells?[]:e.checkboxUpsells.upsells.flatMap(e=>[e.mediaImageGID,e.badgeImageGID]).filter(e=>e!=null),D=e=>e.dealBars.map(e=>e.productPersonalisation?.mediaImageGID).filter(e=>e!=null),O=e=>{let t=e.dealBars.map(e=>e.highlights?.customIconGID).filter(e=>e!=null),n=e.subscriptions?.highlights?.customIconGID;return n?[...t,n]:t},k=e=>(e.badges||[]).flatMap(e=>e.badgeType===`custom`&&e.imageGID?[e.imageGID]:[]),A=e=>!e.savingsSummaryEnabled||!e.savingsSummary?[]:e.savingsSummary.customIconGID?[e.savingsSummary.customIconGID]:[],j=e=>{let t=[...M(e),...N(e),...P(e),...F(e),...I(e),...L(e),...R(e),...z(e)];return Array.from(new Set(t.filter(e=>e!=null)))},M=e=>e.dealBars.flatMap(({freeGifts:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null),N=e=>e.dealBars.flatMap(({multipleGiftsSelectors:e})=>e?e.flatMap(e=>e.products?e.products.map(e=>e.id):[]):[]).filter(e=>e!=null),P=e=>e.progressiveGiftsEnabled&&e.progressiveGifts?.gifts.map(e=>e.productGID).filter(e=>e!=null)||[],F=e=>e.dealBars.flatMap(({upsells:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null),I=e=>e.dealBars.filter(e=>e.dealBarType===T.Bundle).flatMap(({bundleProducts:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null).filter(e=>e!=="default"),L=e=>e.dealBars.filter(e=>e.dealBarType===T.MixAndMatch).flatMap(({bundleProducts:e})=>e?e.flatMap(e=>[e.productGID,...e.selectedProducts?.map(e=>e.id)??[]]):[]).filter(e=>e!=null).filter(e=>e!=="default"),R=e=>!e.checkboxUpsellsEnabled||!e.checkboxUpsells?[]:e.checkboxUpsells.upsells.map(e=>e.productGID).filter(e=>e!=null),z=e=>e.dealBars.filter(e=>e.dealBarType===T.Sku).flatMap(({productGID:e})=>e?[e]:[]),B=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}},V=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 B({status:e.status,operationName:t,graphqlErrors:[]})}if(!e.ok||r.data===null||r.data===void 0)throw new B({status:e.status,operationName:t,graphqlErrors:(r.errors??[]).map(({message:e})=>e).filter(Boolean)});return r.data},H=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}`),V(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)}},U=(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},W=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});return o=o.filter(e=>e.availableForSale),o},G=({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.`},r=e?le(e):void 0;return{...n,...r?.system,...r?.dealBlocks[t]}},le=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=K(e);return n.find(e=>K(e.locale)===r)?.translations},K=e=>e.toLowerCase().replace(/_/g,`-`),ue=`2026-07`,de=async(e,{productId:t,dealBlockId:n,country:r=void 0,language:i=void 0})=>{try{let a=[Number(t.split(`/`).pop())],o=new fe(e);r||=o.i18n?.country,i||=o.i18n?.language;let s=await S(o,{language:i,country:r,useExternalMetafieldNamespace:!0});o.shopifyDomain=s.shopifyDomain;let c=s.storefrontAccessToken?new H(s.shopifyDomain,s.storefrontAccessToken):o,[l,d]=await Promise.all([h(c,{country:r,language:i,productIds:a,useExternalMetafieldNamespace:!0}),u(c,{useExternalMetafieldNamespace:!0,useMetaobjects:s.featureFlags.storefront_metaobjects})]),f=l[0];if(!f)return null;let p=U(d,f),m;if(n?(m=p.find(e=>e.id===n||e.nanoId===n),m||=p[0]):m=p[0],!m)return null;let g=E(m),_=j(m),[v,y,b,x]=await Promise.all([h(c,{country:r,language:i,productIds:_,useExternalMetafieldNamespace:!0}),w(c,g,300),W(c,m,{country:r,language:i}),G({language:i,dealBlockId:m.id})]);return{product:f,dealBlock:m,config:s,otherProducts:v,mediaImages:y,collectionBreaksProducts:b??[],translations:x}}catch(e){return console.error(e),null}},fe=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(`
235
- `));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/${ue}/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}},pe=de,q=`kaching-bundles-block`,J=1e4,me=`https://bundles-integrations-dev.kachingappz.dev/kaching-bundles-block.js`,he=`https://bundles-integrations.kachingappz.app/kaching-bundles-block.js`,Y=new WeakSet,ge=async e=>{let t=e.document;if(!e.customElements.get(q)){if(Y.has(t))return X(e,q);Y.add(t);try{await ye(e)}catch(e){throw Y.delete(t),e}}},_e=()=>typeof window<`u`&&window.__KACHING_DEV__!==void 0,ve=()=>_e()?me:he,ye=e=>{let t=e.document;return new Promise((n,r)=>{let i=ve();if(t.querySelector(`script[src="${i}"]`)){X(e,q).then(n).catch(r);return}let a=t.createElement(`script`);a.src=i,a.onload=()=>X(e,q).then(n).catch(r),a.onerror=()=>r(Error(`Failed to load script`)),t.head.appendChild(a)})},X=(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 ${J}ms`)),J))]).then(()=>n()).catch(r)});[`primaryBackground`,`secondaryBackground`,`primaryText`,`secondaryText`,`border`,`overlay`,`primaryAccent`,`primaryAccentText`,`badgeBackground`,`badgeText`,`error`].map(e=>`brand_${e}`);var Z=function(e){return e.QuantityBreak=`quantity-break`,e.Bxgy=`bxgy`,e.Bundle=`bundle`,e.MixAndMatch=`mix-and-match`,e.Sku=`sku`,e}({}),Q=`a-f\\d`,be=`#?[${Q}]{3}[${Q}]?`,xe=`#?[${Q}]{6}([${Q}]{2})?`,Se=RegExp(`[^#${Q}]`,`gi`),Ce=RegExp(`^${be}$|^${xe}$`,`i`);function $(e,t={}){if(typeof e!=`string`||Se.test(e)||!Ce.test(e))throw TypeError(`Expected a valid hex string`);e=e.replace(/^#/,``);let n=1;e.length===8&&(n=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),e.length===4&&(n=Number.parseInt(e.slice(3,4).repeat(2),16)/255,e=e.slice(0,3)),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);let r=Number.parseInt(e,16),i=r>>16,a=r>>8&255,o=r&255,s=typeof t.alpha==`number`?t.alpha:n;return t.format===`array`?[i,a,o,s]:t.format===`css`?`rgb(${i} ${a} ${o}${s===1?``:` / ${Number((s*100).toFixed(2))}%`})`:{red:i,green:a,blue:o,alpha:s}}var we=({price:e})=>({id:123,handle:`123`,url:null,availableForSale:!0,requiresSellingPlan:!1,title:``,image:null,selectedVariantId:456,collectionIds:[],options:[],sellingPlans:[],variants:[{id:456,availableForSale:!0,price:Math.round((e??10)*100),compareAtPrice:null,options:[],imageId:null,image:null,sellingPlans:[],inventoryManagement:null,inventoryPolicy:null,inventoryQuantity:50,unitPriceMeasurement:null}],metafields:{text:null,text2:null,text3:null,text4:null},isNativeBundle:!1}),Te=()=>({shopifyDomain:``,moneyFormat:"${{amount_with_comma_separator}}",locale:`en`,liquidLocale:`en`,country:`US`,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:!1,previewAlerts:!1,previewScratchOff:!1,currencyRate:1,defaultTranslations:{"system.out_of_stock":``,"system.invalid_variant":``,"system.unavailable_option_value":``,"system.confirm":``,"system.cancel":``,"system.free":``,"system.search":``,"system.quantity":``,"system.subscription_plan":``,"system.remove":``,"system.sort_by":``,"system.sort_relevance":``,"system.sort_newest_first":``,"system.sort_price_low_to_high":``,"system.sort_price_high_to_low":``,"system.no_results_found":``,"system.no_results_description":``,"system.clear_search":``,"system.no_products_available":``,"system.original_price":``,"system.price":``,"system.letters_only":``,"system.numbers_only":``},customSelectors:{quantity:null,addToCartButton:null,variantPicker:null},shopCustomStyles:``,featureFlags:{}}),Ee=({color:e,cornerRadius:t})=>{let n={id:`123`,nanoId:`123`,blockName:`Bundle`,discountName:``,blockTitle:`BUNDLE & SAVE`,blockLayout:`vertical`,blockVisibility:`all-products`,marketId:null,currency:null,excludedProductIds:[],excludedCollectionIds:[],selectedProductIds:[],selectedCollectionIds:[],excludeB2bCustomers:!1,excludePos:!1,startTimestamp:175811496e4,endTimestamp:null,differentVariantsEnabled:!0,hideVariantPicker:!1,showPricesPerItem:!1,showBothPrices:!1,useProductCompareAtPrice:!0,showPricesWithoutDecimals:!1,priceRounding:!1,priceRoundingPrecision:`.00`,updateNativePrice:!1,updateNativePriceType:`item`,skipCart:!1,showVariantsForSingleQuantity:!0,preselectedDealBarId:`1f-9`,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,lowStockAlertEnabled:!1,lowStockAlert:null,dealBars:[{id:`PfFU`,dealBarType:Z.QuantityBreak,title:`1 pack`,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},{id:`1f-9`,dealBarType:Z.QuantityBreak,title:`2 pack`,subtitle:`You save {{saved_percentage}}`,label:`SAVE {{saved_total}}`,quantity:2,discountType:`percentage`,discountValue:`15`,badgeStyle:`most-popular`,badgeText:``,badgeImageGID:null,mediaImageGID:null,freeGifts:[],multipleGiftsSelectors:[],upsells:[],showAsSoldOutEnabled:!1,showAsSoldOut:null,productPersonalisation:null}],badgesEnabled:!0,badges:[{id:`bdg1`,attachedTo:{type:`dealBar`,dealBarId:`1f-9`},text:`MOST POPULAR`,colors:null,badgeType:`most-popular`,size:90}],cornerRadius:t??8,spacing:1,colors:{background:{red:255,green:255,blue:255,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:238,green:238,blue:238,alpha:1},label:{red:0,green:0,blue:0,alpha:1},badgeBackground:{red:255,green:17,blue:17,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:`regular`},freeGift:{size:`13`,style:`bold`},upsell:{size:`13`,style:`bold`},unitLabel:{size:`14`,style:`regular`}},swatchOptions:[],swatchSize:18,swatchShape:`circle`,imageSize:48,imageCornerRadius:6};return e!==void 0&&(n.colors.border={...$(e),alpha:1}),n},De=({data:n,selectedVariantId:r,preview:i,onLinesChange:a,targetWindow:o})=>{let s=(0,e.useRef)(null),[c,l]=(0,e.useState)(!1),u=(0,e.useRef)(!1);(0,e.useEffect)(()=>{s.current&&!c&&(async()=>{await ge(o??window),l(!0)})()},[c,o]),(0,e.useEffect)(()=>{let e=s.current;if(!c||!e)return;let t=()=>{let t=e.items().map(e=>({merchandiseId:`gid://shopify/ProductVariant/${e.id}`,quantity:e.quantity,attributes:Object.entries(e.properties).map(([e,t])=>({key:e,value:String(t)})),sellingPlanId:e.selling_plan?`gid://shopify/SellingPlan/${e.selling_plan}`:void 0}));a?.(t)};return u.current||=(typeof e.items==`function`?t():e.addEventListener(`kaching-bundles-block-loaded`,t),!0),e.addEventListener(`variants-changed`,t),()=>{e.removeEventListener(`kaching-bundles-block-loaded`,t),e.removeEventListener(`variants-changed`,t)}},[c,a]);let d=n?ke(n,r):i?Ae(i):null;return Oe(()=>{let e=s.current;if(e&&d)for(let[t,n]of Object.entries(d.jsonAttributes))e.getAttribute(t)!==n&&e.setAttribute(t,n)}),d?(0,t.jsx)(`kaching-bundles-block`,{ref:s,"deal-block-id":d.dealBlockId,...d.jsonAttributes,"current-variant-id":d.currentVariantId}):null},Oe=typeof window>`u`?e.useEffect:e.useLayoutEffect,ke=({config:e,dealBlock:t,product:n,otherProducts:r,mediaImages:i,collectionBreaksProducts:a,translations:o},s)=>({dealBlockId:t.id,currentVariantId:s?s.split(`/`).pop():String(n.variants[0].id),jsonAttributes:{config:JSON.stringify(e),"deal-block":JSON.stringify(t),"media-images":JSON.stringify(i),product:JSON.stringify(n),"other-products":JSON.stringify(r),"collection-breaks-products":JSON.stringify(a),translations:JSON.stringify(o)}}),Ae=({cornerRadius:e,color:t,price:n})=>{let r=we({price:n}),i=Te(),a=Ee({color:t,cornerRadius:e});return{dealBlockId:a.id,currentVariantId:String(r.variants[0].id),jsonAttributes:{config:JSON.stringify(i),"deal-block":JSON.stringify(a),"media-images":JSON.stringify([]),product:JSON.stringify(r),"other-products":JSON.stringify([]),"collection-breaks-products":JSON.stringify([]),translations:JSON.stringify({})}}};exports.KachingBundle=De,exports.fetchKachingBundlesData=pe;
237
+ `,{variables:{mediaImageIds:t,size:n}})))).flatMap(e=>e.nodes).flatMap(e=>e?.image?[{gid:e.id,url:e.image.url}]:[])},E=e=>[...D(e),...O(e),...k(e),...A(e),...ee(e),...te(e),...ne(e),...re(e),...ie(e),...ae(e),...oe(e),...se(e),...ce(e)].filter(e=>e!=null&&!e.includes(`placeholder`)),D=e=>e.dealBars.flatMap(e=>[e.mediaImageGID,e.badgeImageGID]).filter(e=>e!=null),O=e=>e.dealBars.flatMap(e=>e.dealBarType===p.Bundle?e.bundleProducts.map(e=>e.mediaImageGID):[]).filter(e=>e!=null),k=e=>e.dealBars.map(({freeGifts:e})=>(e||[]).map(e=>e.mediaImageGID)).reduce((e,t)=>e.concat(t),[]).filter(e=>e!=null),A=e=>e.dealBars.flatMap(({multipleGiftsSelectors:e})=>(e||[]).map(e=>e.mediaImageGID)).filter(e=>e!=null),ee=e=>e.dealBars.map(({upsells:e})=>(e||[]).map(e=>e.mediaImageGID)).reduce((e,t)=>e.concat(t),[]).filter(e=>e!=null),te=e=>e.swatchOptions?e.swatchOptions.reduce((e,t)=>{let n=t.images.map(e=>e.mediaImageGID).filter(e=>e!=null);return[...e,...n]},[]):[],ne=e=>{if(!e.collectionBreaksEnabled||!e.collectionBreaks)return[];let t=e.collectionBreaks.mediaImageGID;return t?[t]:[]},re=e=>e.progressiveGifts?[...e.progressiveGifts.gifts?.map(e=>e.mediaImageGID)||[],e.progressiveGifts.style?.lockedMediaImageGID,e.progressiveGifts.dealBarStyle?.lockedMediaImageGID].filter(e=>e!=null):[],ie=e=>!e.checkboxUpsellsEnabled||!e.checkboxUpsells?[]:e.checkboxUpsells.upsells.flatMap(e=>[e.mediaImageGID,e.badgeImageGID]).filter(e=>e!=null),ae=e=>e.dealBars.map(e=>e.productPersonalisation?.mediaImageGID).filter(e=>e!=null),oe=e=>{let t=e.dealBars.map(e=>e.highlights?.customIconGID).filter(e=>e!=null),n=e.subscriptions?.highlights?.customIconGID;return n?[...t,n]:t},se=e=>(e.badges||[]).flatMap(e=>e.badgeType===`custom`&&e.imageGID?[e.imageGID]:[]),ce=e=>!e.savingsSummaryEnabled||!e.savingsSummary?[]:e.savingsSummary.customIconGID?[e.savingsSummary.customIconGID]:[],le=e=>{let t=[...ue(e),...j(e),...M(e),...N(e),...P(e),...F(e),...I(e),...L(e)];return Array.from(new Set(t.filter(e=>e!=null)))},ue=e=>e.dealBars.flatMap(({freeGifts:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null),j=e=>e.dealBars.flatMap(({multipleGiftsSelectors:e})=>e?e.flatMap(e=>e.products?e.products.map(e=>e.id):[]):[]).filter(e=>e!=null),M=e=>e.progressiveGiftsEnabled&&e.progressiveGifts?.gifts.map(e=>e.productGID).filter(e=>e!=null)||[],N=e=>e.dealBars.flatMap(({upsells:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null),P=e=>e.dealBars.filter(e=>e.dealBarType===p.Bundle).flatMap(({bundleProducts:e})=>e?e.map(e=>e.productGID):[]).filter(e=>e!=null).filter(e=>e!=="default"),F=e=>e.dealBars.filter(e=>e.dealBarType===p.MixAndMatch).flatMap(({bundleProducts:e})=>e?e.flatMap(e=>[e.productGID,...e.selectedProducts?.map(e=>e.id)??[]]):[]).filter(e=>e!=null).filter(e=>e!=="default"),I=e=>!e.checkboxUpsellsEnabled||!e.checkboxUpsells?[]:e.checkboxUpsells.upsells.map(e=>e.productGID).filter(e=>e!=null),L=e=>e.dealBars.filter(e=>e.dealBarType===p.Sku).flatMap(({productGID:e})=>e?[e]:[]),R=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}},z=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 R({status:e.status,operationName:t,graphqlErrors:[]})}if(!e.ok||r.data===null||r.data===void 0)throw new R({status:e.status,operationName:t,graphqlErrors:(r.errors??[]).map(({message:e})=>e).filter(Boolean)});return r.data},B=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}`),z(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)}},V=(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},H=async(e,t,{country:n,language:r})=>{let i=t.collectionBreaks;if(!t.collectionBreaksEnabled||!i)return;let a;a=i.visibility===`deal-products`?await m(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 m(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 g(e,{country:n,language:r,productIds:a.map(e=>Number(e.split(`/`).pop())),useExternalMetafieldNamespace:!0});return o=o.filter(e=>e.availableForSale),o},U=({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.`},r=e?de(e):void 0;return{...n,...r?.system,...r?.dealBlocks[t]}},de=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=W(e);return n.find(e=>W(e.locale)===r)?.translations},W=e=>e.toLowerCase().replace(/_/g,`-`),fe=`2026-07`,pe=async(e,{productId:t,dealBlockId:n,country:r=void 0,language:i=void 0})=>{try{let a=[Number(t.split(`/`).pop())],o=new me(e);r||=o.i18n?.country,i||=o.i18n?.language;let s=await C(o,{language:i,country:r,useExternalMetafieldNamespace:!0});o.shopifyDomain=s.shopifyDomain;let c=s.storefrontAccessToken?new B(s.shopifyDomain,s.storefrontAccessToken):o,[l,d]=await Promise.all([g(c,{country:r,language:i,productIds:a,useExternalMetafieldNamespace:!0}),u(c,{useExternalMetafieldNamespace:!0,useMetaobjects:s.featureFlags.storefront_metaobjects})]),f=l[0];if(!f)return null;let p=V(d,f),m;if(n?(m=p.find(e=>e.id===n||e.nanoId===n),m||=p[0]):m=p[0],!m)return null;let h=E(m),_=le(m),[v,y,b,x]=await Promise.all([g(c,{country:r,language:i,productIds:_,useExternalMetafieldNamespace:!0}),T(c,h,300),H(c,m,{country:r,language:i}),U({language:i,dealBlockId:m.id})]);return{product:f,dealBlock:m,config:s,otherProducts:v,mediaImages:y,collectionBreaksProducts:b??[],translations:x}}catch(e){return console.error(e),null}},me=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(`
238
+ `));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/${fe}/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}},he=pe,G=`kaching-bundles-block`,K=1e4,q=`/kaching-bundles-block.js`,ge=`https://bundles-integrations-dev.kachingappz.dev/kaching-bundles-block.js`,_e=`https://bundles-integrations.kachingappz.app/kaching-bundles-block.js`,J=new WeakSet,ve=async e=>{let t=e.document;if(!e.customElements.get(G)){if(J.has(t))return X(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()?ge:_e,xe=async e=>{let t=e.document,n=be();if(t.querySelector(`script[src="${n}"]`))return X(e,G);let r=Se(t);if(r&&await we(t,r))return X(e,G);let i=t.createElement(`script`);return i.src=n,await Y(t,i),X(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}},we=async(e,t)=>{let n=e.createElement(`script`);n.type=`module`,n.setAttribute(`crossorigin`,`anonymous`),n.src=t;try{return await Y(e,n),!0}catch{return n.remove(),!1}},Y=(e,t)=>new Promise((n,r)=>{t.onload=()=>n(),t.onerror=()=>r(Error(`Failed to load script`)),e.head.appendChild(t)}),X=(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 Z=function(e){return e.QuantityBreak=`quantity-break`,e.Bxgy=`bxgy`,e.Bundle=`bundle`,e.MixAndMatch=`mix-and-match`,e.Sku=`sku`,e}({}),Q=`a-f\\d`,Te=`#?[${Q}]{3}[${Q}]?`,Ee=`#?[${Q}]{6}([${Q}]{2})?`,De=RegExp(`[^#${Q}]`,`gi`),Oe=RegExp(`^${Te}$|^${Ee}$`,`i`);function ke(e,t={}){if(typeof e!=`string`||De.test(e)||!Oe.test(e))throw TypeError(`Expected a valid hex string`);e=e.replace(/^#/,``);let n=1;e.length===8&&(n=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),e.length===4&&(n=Number.parseInt(e.slice(3,4).repeat(2),16)/255,e=e.slice(0,3)),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);let r=Number.parseInt(e,16),i=r>>16,a=r>>8&255,o=r&255,s=typeof t.alpha==`number`?t.alpha:n;return t.format===`array`?[i,a,o,s]:t.format===`css`?`rgb(${i} ${a} ${o}${s===1?``:` / ${Number((s*100).toFixed(2))}%`})`:{red:i,green:a,blue:o,alpha:s}}var Ae=({price:e})=>({id:123,handle:`123`,url:null,availableForSale:!0,requiresSellingPlan:!1,title:``,image:null,selectedVariantId:456,collectionIds:[],options:[],sellingPlans:[],variants:[{id:456,availableForSale:!0,price:Math.round((e??10)*100),compareAtPrice:null,options:[],imageId:null,image:null,sellingPlans:[],inventoryManagement:null,inventoryPolicy:null,inventoryQuantity:50,unitPriceMeasurement:null}],metafields:{text:null,text2:null,text3:null,text4:null},isNativeBundle:!1}),$=()=>({shopifyDomain:``,moneyFormat:"${{amount_with_comma_separator}}",locale:`en`,liquidLocale:`en`,country:`US`,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:!1,previewAlerts:!1,previewScratchOff:!1,currencyRate:1,defaultTranslations:{"system.out_of_stock":``,"system.invalid_variant":``,"system.unavailable_option_value":``,"system.confirm":``,"system.cancel":``,"system.free":``,"system.search":``,"system.quantity":``,"system.subscription_plan":``,"system.remove":``,"system.sort_by":``,"system.sort_relevance":``,"system.sort_newest_first":``,"system.sort_price_low_to_high":``,"system.sort_price_high_to_low":``,"system.no_results_found":``,"system.no_results_description":``,"system.clear_search":``,"system.no_products_available":``,"system.original_price":``,"system.price":``,"system.letters_only":``,"system.numbers_only":``},customSelectors:{quantity:null,addToCartButton:null,variantPicker:null},shopCustomStyles:``,featureFlags:{}}),je=({color:e,cornerRadius:t})=>{let n={id:`123`,nanoId:`123`,blockName:`Bundle`,discountName:``,blockTitle:`BUNDLE & SAVE`,blockLayout:`vertical`,blockVisibility:`all-products`,marketId:null,currency:null,excludedProductIds:[],excludedCollectionIds:[],selectedProductIds:[],selectedCollectionIds:[],excludeB2bCustomers:!1,excludePos:!1,startTimestamp:175811496e4,endTimestamp:null,differentVariantsEnabled:!0,hideVariantPicker:!1,showPricesPerItem:!1,showBothPrices:!1,useProductCompareAtPrice:!0,showPricesWithoutDecimals:!1,priceRounding:!1,priceRoundingPrecision:`.00`,updateNativePrice:!1,updateNativePriceType:`item`,skipCart:!1,showVariantsForSingleQuantity:!0,preselectedDealBarId:`1f-9`,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,lowStockAlertEnabled:!1,lowStockAlert:null,dealBars:[{id:`PfFU`,dealBarType:Z.QuantityBreak,title:`1 pack`,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},{id:`1f-9`,dealBarType:Z.QuantityBreak,title:`2 pack`,subtitle:`You save {{saved_percentage}}`,label:`SAVE {{saved_total}}`,quantity:2,discountType:`percentage`,discountValue:`15`,badgeStyle:`most-popular`,badgeText:``,badgeImageGID:null,mediaImageGID:null,freeGifts:[],multipleGiftsSelectors:[],upsells:[],showAsSoldOutEnabled:!1,showAsSoldOut:null,productPersonalisation:null}],badgesEnabled:!0,badges:[{id:`bdg1`,attachedTo:{type:`dealBar`,dealBarId:`1f-9`},text:`MOST POPULAR`,colors:null,badgeType:`most-popular`,size:90}],cornerRadius:t??8,spacing:1,colors:{background:{red:255,green:255,blue:255,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:238,green:238,blue:238,alpha:1},label:{red:0,green:0,blue:0,alpha:1},badgeBackground:{red:255,green:17,blue:17,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:`regular`},freeGift:{size:`13`,style:`bold`},upsell:{size:`13`,style:`bold`},unitLabel:{size:`14`,style:`regular`}},swatchOptions:[],swatchSize:18,swatchShape:`circle`,imageSize:48,imageCornerRadius:6};return e!==void 0&&(n.colors.border={...ke(e),alpha:1}),n},Me=({data:n,selectedVariantId:r,preview:i,onLinesChange:a,targetWindow:o})=>{let s=(0,e.useRef)(null),[c,l]=(0,e.useState)(!1),u=(0,e.useRef)(!1);(0,e.useEffect)(()=>{s.current&&!c&&(async()=>{await ve(o??window),l(!0)})()},[c,o]),(0,e.useEffect)(()=>{let e=s.current;if(!c||!e)return;let t=()=>{let t=e.items().map(e=>({merchandiseId:`gid://shopify/ProductVariant/${e.id}`,quantity:e.quantity,attributes:Object.entries(e.properties).map(([e,t])=>({key:e,value:String(t)})),sellingPlanId:e.selling_plan?`gid://shopify/SellingPlan/${e.selling_plan}`:void 0}));a?.(t)};return u.current||=(typeof e.items==`function`?t():e.addEventListener(`kaching-bundles-block-loaded`,t),!0),e.addEventListener(`variants-changed`,t),()=>{e.removeEventListener(`kaching-bundles-block-loaded`,t),e.removeEventListener(`variants-changed`,t)}},[c,a]);let d=n?Pe(n,r):i?Fe(i):null;return Ne(()=>{let e=s.current;if(e&&d)for(let[t,n]of Object.entries(d.jsonAttributes))e.getAttribute(t)!==n&&e.setAttribute(t,n)}),d?(0,t.jsx)(`kaching-bundles-block`,{ref:s,"deal-block-id":d.dealBlockId,...d.jsonAttributes,"current-variant-id":d.currentVariantId}):null},Ne=typeof window>`u`?e.useEffect:e.useLayoutEffect,Pe=({config:e,dealBlock:t,product:n,otherProducts:r,mediaImages:i,collectionBreaksProducts:a,translations:o},s)=>({dealBlockId:t.id,currentVariantId:s?s.split(`/`).pop():String(n.variants[0].id),jsonAttributes:{config:JSON.stringify(e),"deal-block":JSON.stringify(t),"media-images":JSON.stringify(i),product:JSON.stringify(n),"other-products":JSON.stringify(r),"collection-breaks-products":JSON.stringify(a),translations:JSON.stringify(o)}}),Fe=({cornerRadius:e,color:t,price:n})=>{let r=Ae({price:n}),i=$(),a=je({color:t,cornerRadius:e});return{dealBlockId:a.id,currentVariantId:String(r.variants[0].id),jsonAttributes:{config:JSON.stringify(i),"deal-block":JSON.stringify(a),"media-images":JSON.stringify([]),product:JSON.stringify(r),"other-products":JSON.stringify([]),"collection-breaks-products":JSON.stringify([]),translations:JSON.stringify({})}}};exports.KachingBundle=Me,exports.fetchKachingBundlesData=he;
@@ -66,6 +66,7 @@ declare interface BaseDealBar {
66
66
  freeGiftsSummary?: FreeGiftsSummary | null;
67
67
  multipleGiftsSelectors?: MultipleGiftsSelector[];
68
68
  upsells: Upsell[];
69
+ sectionsOrder?: DealBarSection[];
69
70
  productPersonalisation: ProductPersonalisation | null;
70
71
  highlights?: Highlights | null;
71
72
  sellingPlanEnabled?: boolean;
@@ -98,7 +99,7 @@ declare type BrandColorKey = (typeof BRAND_COLOR_KEYS)[number];
98
99
 
99
100
  declare type BrandColors = Record<BrandColorKey, string>;
100
101
 
101
- declare interface BundleDealBar extends BaseDealBar, ShowAsSoldOutFeature, RequireVariantSelectionFeature {
102
+ declare interface BundleDealBar extends BaseDealBar, ShowAsSoldOutFeature {
102
103
  dealBarType: DealBarType.Bundle;
103
104
  layout?: "horizontal" | "vertical";
104
105
  quantitySelector: boolean;
@@ -119,7 +120,7 @@ declare interface BundleProduct {
119
120
  hidePrice?: boolean;
120
121
  }
121
122
 
122
- declare interface BxgyDealBar extends BaseDealBar, ShowAsSoldOutFeature, RequireVariantSelectionFeature {
123
+ declare interface BxgyDealBar extends BaseDealBar, ShowAsSoldOutFeature {
123
124
  dealBarType: DealBarType.Bxgy;
124
125
  buyQuantity: number;
125
126
  buyDiscountType?: DiscountType;
@@ -260,6 +261,8 @@ declare type DealBarProgressiveGiftStyle = {
260
261
  lockedMediaImageGID: string | null;
261
262
  };
262
263
 
264
+ declare type DealBarSection = (typeof DEFAULT_DEAL_BAR_SECTIONS_ORDER)[number];
265
+
263
266
  declare enum DealBarType {
264
267
  QuantityBreak = "quantity-break",
265
268
  Bxgy = "bxgy",
@@ -297,6 +300,7 @@ declare type DealBlock = {
297
300
  startTimestamp: number;
298
301
  endTimestamp: number | null;
299
302
  differentVariantsEnabled: boolean;
303
+ requireVariantSelectionEnabled?: boolean;
300
304
  hideVariantPicker: boolean;
301
305
  disableVariantOptionSync?: boolean;
302
306
  hideUnavailableOptions?: boolean;
@@ -404,6 +408,8 @@ declare type DealBlock = {
404
408
  lowStockAlert: LowStockAlert | null;
405
409
  };
406
410
 
411
+ declare const DEFAULT_DEAL_BAR_SECTIONS_ORDER: readonly ["upsells", "freeGifts", "multipleGiftsSelectors"];
412
+
407
413
  declare type DefaultSortOption = "relevance" | "newest-first" | "price-low-to-high" | "price-high-to-low";
408
414
 
409
415
  declare type DiscountType = "default" | "percentage" | "amount" | "specific";
@@ -433,6 +439,7 @@ declare type FreeGift = {
433
439
  text: string;
434
440
  imageSize: number;
435
441
  quantity: number;
442
+ matchQuantityWithDealBar?: boolean;
436
443
  showPrice: boolean;
437
444
  includeInCompareAt?: boolean;
438
445
  applyOnlyForSubscriptions: boolean;
@@ -466,6 +473,7 @@ declare interface GlobalConfig {
466
473
  ignoreUnitPrice: boolean;
467
474
  requireCustomerLogin: boolean;
468
475
  abTestsRunning: boolean;
476
+ cartKachingSessionId?: string | null;
469
477
  webPixel: boolean;
470
478
  b2bCustomer: boolean;
471
479
  isLoggedIn: boolean;
@@ -581,6 +589,47 @@ declare interface GlobalConfig {
581
589
  "system.deal_page_rating_count_other"?: string;
582
590
  "system.deal_page_rating_count_few"?: string;
583
591
  "system.deal_page_rating_count_many"?: string;
592
+ "system.deal_page_gift_badge_shipping"?: string;
593
+ "system.deal_page_gift_badge_one"?: string;
594
+ "system.deal_page_gift_badge_other"?: string;
595
+ "system.deal_page_gift_badge_few"?: string;
596
+ "system.deal_page_gift_badge_many"?: string;
597
+ "system.deal_page_gifts_title"?: string;
598
+ "system.deal_page_your_gifts_title"?: string;
599
+ "system.deal_page_free_shipping"?: string;
600
+ "system.deal_page_gift_unlocks_at_one"?: string;
601
+ "system.deal_page_gift_unlocks_at_other"?: string;
602
+ "system.deal_page_gift_unlocks_at_few"?: string;
603
+ "system.deal_page_gift_unlocks_at_many"?: string;
604
+ "system.deal_page_choose_option"?: string;
605
+ "system.deal_page_change"?: string;
606
+ "system.deal_page_choose_gift_option"?: string;
607
+ "system.deal_page_your_gifts_row_one"?: string;
608
+ "system.deal_page_your_gifts_row_other"?: string;
609
+ "system.deal_page_your_gifts_row_few"?: string;
610
+ "system.deal_page_your_gifts_row_many"?: string;
611
+ "system.deal_page_free"?: string;
612
+ "system.deal_page_gift_count_one"?: string;
613
+ "system.deal_page_gift_count_other"?: string;
614
+ "system.deal_page_gift_count_few"?: string;
615
+ "system.deal_page_gift_count_many"?: string;
616
+ "system.deal_page_percentage_gifts_unlocked"?: string;
617
+ "system.deal_page_box_of_gifts"?: string;
618
+ "system.deal_page_gifts_unlocked"?: string;
619
+ "system.deal_page_gift_phrase_shipping"?: string;
620
+ "system.deal_page_gift_phrase_one"?: string;
621
+ "system.deal_page_gift_phrase_other"?: string;
622
+ "system.deal_page_gift_phrase_few"?: string;
623
+ "system.deal_page_gift_phrase_many"?: string;
624
+ "system.deal_page_nudge_start_offer_one"?: string;
625
+ "system.deal_page_nudge_start_offer_other"?: string;
626
+ "system.deal_page_nudge_start_offer_few"?: string;
627
+ "system.deal_page_nudge_start_offer_many"?: string;
628
+ "system.deal_page_nudge_more_offer_one"?: string;
629
+ "system.deal_page_nudge_more_offer_other"?: string;
630
+ "system.deal_page_nudge_more_offer_few"?: string;
631
+ "system.deal_page_nudge_more_offer_many"?: string;
632
+ "system.deal_page_offer_with_gifts"?: string;
584
633
  "system.deal_page_promotion_percentage"?: string;
585
634
  };
586
635
  customSelectors: {
@@ -592,12 +641,13 @@ declare interface GlobalConfig {
592
641
  label?: string | null;
593
642
  };
594
643
  featureFlags: {
644
+ analytics_tracking_disabled?: boolean;
595
645
  atc_total_price?: boolean;
596
646
  cart_change_response_rewrite?: boolean;
597
647
  cart_interceptor_dedupe_disabled?: boolean;
598
648
  debug_cart_add?: boolean;
599
649
  disable_nested_cart_lines?: boolean;
600
- early_fetch_override?: boolean;
650
+ early_xhr_wrapper?: boolean;
601
651
  hide_missing_variants?: boolean;
602
652
  initialize_with_form_variant?: boolean;
603
653
  intercept_cart_request?: boolean;
@@ -722,7 +772,7 @@ declare interface MixAndMatchChooseProductModal {
722
772
  buttonText: string;
723
773
  }
724
774
 
725
- declare interface MixAndMatchDealBar extends BaseDealBar, ShowAsSoldOutFeature, RequireVariantSelectionFeature {
775
+ declare interface MixAndMatchDealBar extends BaseDealBar, ShowAsSoldOutFeature {
726
776
  dealBarType: DealBarType.MixAndMatch;
727
777
  discountType: DiscountType;
728
778
  discountValue: string | number;
@@ -789,6 +839,7 @@ declare interface Product {
789
839
  text4: string | null;
790
840
  };
791
841
  rating?: ProductRating | null;
842
+ subtitle?: string | null;
792
843
  }
793
844
 
794
845
  declare interface ProductOption {
@@ -834,6 +885,8 @@ declare type ProgressiveGift = {
834
885
  mediaImageGID: string | null;
835
886
  unlockAtBar: number;
836
887
  unlockAtBarOnly?: boolean;
888
+ unlockAtScope?: "and-higher" | "only" | "custom";
889
+ unlockDealBarIds?: string[];
837
890
  label: string;
838
891
  labelCrossedOut: string;
839
892
  title: string;
@@ -885,7 +938,7 @@ declare type ProgressiveGiftsStyle = {
885
938
  lockedMediaImageGID: string | null;
886
939
  };
887
940
 
888
- declare interface QuantityBreakDealBar extends BaseDealBar, ShowAsSoldOutFeature, RequireVariantSelectionFeature {
941
+ declare interface QuantityBreakDealBar extends BaseDealBar, ShowAsSoldOutFeature {
889
942
  dealBarType?: DealBarType.QuantityBreak;
890
943
  quantity: number | string;
891
944
  discountType: DiscountType;
@@ -904,10 +957,6 @@ declare type RequireItemSelectionAlert = {
904
957
  backgroundColor: Color;
905
958
  };
906
959
 
907
- declare interface RequireVariantSelectionFeature {
908
- requireVariantSelectionEnabled?: boolean;
909
- }
910
-
911
960
  declare type SavingsSummary = {
912
961
  title: string;
913
962
  backgroundColor: Color;