@ordergroove/offers 2.27.15 → 2.27.16
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.
- package/CHANGELOG.md +11 -0
- package/dist/bundle-report.html +7 -7
- package/dist/examples.js +9 -9
- package/dist/examples.js.map +2 -2
- package/dist/offers.js +3 -3
- package/dist/offers.js.map +2 -2
- package/examples/index.js +20 -1
- package/package.json +2 -2
- package/src/components/Offer.js +4 -2
- package/src/shopify/shopifyMiddleware.ts +23 -6
package/dist/offers.js
CHANGED
|
@@ -354,7 +354,7 @@ var lib=(()=>{var $i=Object.create;var Ge=Object.defineProperty;var Hi=Object.ge
|
|
|
354
354
|
></og-select>
|
|
355
355
|
`}};n(Ro,"SelectFrequency");var ui=g(mt,{productChangeFrequency:Gt})(Ro);O();var Yc={day:{day:"2-digit"},"day-numeric":{day:"numeric"},"day-short":{weekday:"short"},"day-long":{weekday:"long"},month:{month:"2-digit"},"month-numeric":{month:"numeric"},"month-short":{month:"short"},"month-long":{month:"long"},year:{year:"2-digit"},"year-numeric":{year:"numeric"}};var pi=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=Yc[o];if(typeof s=="undefined")return o;let a=new Intl.DateTimeFormat("en-us",s).formatToParts(t),[{value:c}]=a;return c}):t,"formatDate");var Ao=class extends T{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return p`
|
|
356
356
|
${pi(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
|
|
357
|
-
`}};n(Ao,"FormattedDate");var Jc=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),di=g(Jc)(Ao);O();var mi=ee(Ke());N();V();var fi=n((t,e,r)=>n(async function(s){await s({type:Ye,payload:t}),await s({type:Ce}),await s(qe({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),Qc=n((t,e,r)=>n(async function(s,i){await s({type:Je,payload:t});let{merchantId:a}=i();t?(await s(qe({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{}},r)),await s(Ur({count:1,next:null,previous:null,results:[{merchant:"0e5de2bedc5e11e3a2e4bc764e106cf4",customer:"TestCust",payment:"e98e789aba0111e9b90fbc764e107990",shipping_address:"b3a5816ae59611e78937bc764e1043b0",public_id:"23322d4a83eb11ea9a1ebc764e101db1",sub_total:"206.98",tax_total:"0.00",shipping_total:"10.00",discount_total:"0.00",total:"216.98",created:"2020-04-21 11:14:11",place:"2020-06-24 00:00:00",cancelled:null,tries:0,generic_error_count:0,status:1,type:1,order_merchant_id:null,rejected_message:null,extra_data:null,locked:!1,oos_free_shipping:!1}]})),await s(nt(a,"sig_field","ts","sig"))):await s(ie())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),hi=n((t,e,r)=>async function(o,s){switch(await o({type:te}),await o({type:Ye,payload:!1}),await o({type:Je,payload:!1}),t){case"regular":o(fi(!0,r.product.id,r));break;case"upsell":o(Qc(!0,r.product.id,r));break;case"subscribed":o(fi(!0,r.product.id,r)),o(se(r.product,"2_2"));break;default:}},"setPreview");N();$();V();var Kc=n((...t)=>JSON.stringify(t),"memoizeKey"),Zc=(0,mi.default)((t,e)=>Object.assign({components:e},t),Kc),No=class extends M{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:Qs,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:Ve,preview:{type:String,attribute:"preview",reflect:"true"},location:{type:String},autoshipByDefault:{type:Boolean,attribute:"autoship-by-default"},productDefaultFrequency:{type:String,attribute:!1},locale:{type:Object,attribute:!0},firstOrderPlaceDate:{type:String,attribute:"first-order-place-date"},productToSubscribe:{type:String,attribute:"product-to-subscribe"},subscribed:{type:Boolean,reflect:!0},frequency:{type:String,reflect:!0},productFrequency:{type:String},isCart:{type:Boolean,attribute:"cart"},optedin:{type:Object}}}firstUpdated(){let e=Array.from(this.getAttributeNames()).find(r=>r.startsWith("preview-"));e==="preview-standard-offer"?this.preview="regular":e==="preview-upsell-offer"?this.preview="upsell":e==="preview-subscribed-offer"&&(this.preview="subscribed")}static get styles(){return v`
|
|
357
|
+
`}};n(Ao,"FormattedDate");var Jc=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),di=g(Jc)(Ao);O();var mi=ee(Ke());N();V();var fi=n((t,e,r)=>n(async function(s){await s({type:Ye,payload:t}),await s({type:Ce}),await s(qe({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:10},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[e]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}},r))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),Qc=n((t,e,r)=>n(async function(s,i){await s({type:Je,payload:t});let{merchantId:a}=i();t?(await s(qe({in_stock:{[e]:!0},module_view:{regular:"096135e6650111e9a444bc764e106cf4"},default_frequencies:{[e]:{every:1,every_period:3}},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},autoship_by_default:{[e]:!1},modifiers:{}},r)),await s(Ur({count:1,next:null,previous:null,results:[{merchant:"0e5de2bedc5e11e3a2e4bc764e106cf4",customer:"TestCust",payment:"e98e789aba0111e9b90fbc764e107990",shipping_address:"b3a5816ae59611e78937bc764e1043b0",public_id:"23322d4a83eb11ea9a1ebc764e101db1",sub_total:"206.98",tax_total:"0.00",shipping_total:"10.00",discount_total:"0.00",total:"216.98",created:"2020-04-21 11:14:11",place:"2020-06-24 00:00:00",cancelled:null,tries:0,generic_error_count:0,status:1,type:1,order_merchant_id:null,rejected_message:null,extra_data:null,locked:!1,oos_free_shipping:!1}]})),await s(nt(a,"sig_field","ts","sig"))):await s(ie())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),hi=n((t,e,r)=>async function(o,s){switch(await o({type:te}),await o({type:Ye,payload:!1}),await o({type:Je,payload:!1}),t){case"regular":o(fi(!0,r.product.id,r));break;case"upsell":o(Qc(!0,r.product.id,r));break;case"subscribed":o(fi(!0,r.product.id,r)),o(se(r.product,"2_2"));break;default:}},"setPreview");N();$();V();var Kc=n((...t)=>JSON.stringify(t),"memoizeKey"),Zc=(0,mi.default)((t,e)=>Object.assign({components:e},t),Kc),No=class extends M{static get properties(){return{...super.properties,config:{type:Object,attribute:!1},product:Qs,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:Ve,preview:{type:String,attribute:"preview",reflect:"true"},location:{type:String},autoshipByDefault:{type:Boolean,attribute:"autoship-by-default"},productDefaultFrequency:{type:String,attribute:!1},locale:{type:Object,attribute:!0},firstOrderPlaceDate:{type:String,attribute:"first-order-place-date"},productToSubscribe:{type:String,attribute:"product-to-subscribe"},subscribed:{type:Boolean,reflect:!0},frequency:{type:String,reflect:!0},productFrequency:{type:String},isCart:{type:Boolean,attribute:"cart"},optedin:{type:Object},variationId:{type:String}}}firstUpdated(){let e=Array.from(this.getAttributeNames()).find(r=>r.startsWith("preview-"));e==="preview-standard-offer"?this.preview="regular":e==="preview-upsell-offer"?this.preview="upsell":e==="preview-subscribed-offer"&&(this.preview="subscribed")}static get styles(){return v`
|
|
358
358
|
:host[hidden] {
|
|
359
359
|
display: none;
|
|
360
360
|
}
|
|
@@ -502,7 +502,7 @@ var lib=(()=>{var $i=Object.create;var Ge=Object.defineProperty;var Hi=Object.ge
|
|
|
502
502
|
</og-when>
|
|
503
503
|
</og-when>
|
|
504
504
|
|
|
505
|
-
`}constructor(){super();this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{locale:
|
|
505
|
+
`}constructor(){super();this.module="pdp",this.product={},this.productComponents=[],this.fetchOffer=()=>0,this.fetchOrders=()=>0,this.productHasChangedComponents=()=>0,this.setFirstOrderPlaceDate=()=>0,this.setProductToSubscribe=()=>0,this.productChangeFrequency=()=>0}applyTemplate(e){super.applyTemplate(e);let{id:r,locale:o}=e;this.variationId=r,this.locale=o;let s=new CustomEvent("template-changed");this.dispatchEvent(s)}updated(e){if(e.has("preview")&&this.setPreview(this.preview,e.get("preview"),this),this.frequency=this.defaultFrequency,e.has("product")&&this.product.id&&!this.isPreview&&rt(()=>this.fetchOffer(this.product.id,he,this)),e.has("firstOrderPlaceDate")&&this.product.id&&!this.isPreview&&this.setFirstOrderPlaceDate(this.product.id,this.firstOrderPlaceDate),e.has("productToSubscribe")&&this.product.id&&!this.isPreview&&this.setProductToSubscribe(this.product.id,this.productToSubscribe),e.has("auth")&&this.auth&&!this.isPreview&&this.fetchOrders(),e.has("productComponents")){let r=Zc(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});A(r,o)||this.productHasChangedComponents(r,o)}(e.has("offerId")||e.has("autoshipByDefault")||e.has("location")||e.has("product"))&&this.offerId&&this.autoshipByDefault&&(this.location==="cart"||this.isCart)&&this.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>A(r,this.product))&&this.optinProduct({...this.product,...this.productComponents.length&&{components:this.productComponents}},this.defaultFrequency,this)}get isPreview(){return this.preview||window.og.previewMode}render(){return p`
|
|
506
506
|
<slot></slot>
|
|
507
507
|
`}get defaultFrequency(){let e=this.productFrequency||this.productDefaultFrequency;if(e)return e;let r=this.querySelector("og-select-frequency");return r&&r.currentFrequency?r.currentFrequency:this.getOption("defaultFrequency")}};n(No,"Offer");var Xc=n((t,e)=>({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:W(e.product)(t),productDefaultFrequency:Zt((e.product||{}).id)(t),...H(t,e,"autoshipByDefault",Mr(t)[(e.product||{}).id]),...Kt(e.product)(t)&&{autoshipByDefault:!1},optedin:Jt(t),subscribed:Q(e.product)(t),...De(t)}),"mapStateToProps"),gi=g(Xc,{fetchOffer:$n,fetchOrders:Wt,productHasChangedComponents:Fn,optinProduct:se,setFirstOrderPlaceDate:Jn,setProductToSubscribe:Qn,setPreview:hi})(No);O();var yr=class extends T{constructor(){super();this.showCancelButton=!0,this.showConfirmButton=!0}static get properties(){return{title:{type:String,attribute:!1},content:{type:String,attribute:!1},confirmText:{type:String,attribute:!1},cancelText:{type:String,attribute:!1},showCancelButton:{type:Boolean},showConfirmButton:{type:Boolean},show:{type:Boolean,attribute:"show"}}}static get styles(){return v`
|
|
508
508
|
:host[hidden] {
|
|
@@ -879,6 +879,6 @@ var lib=(()=>{var $i=Object.create;var Ge=Object.defineProperty;var Hi=Object.ge
|
|
|
879
879
|
<slot name="append"></slot>
|
|
880
880
|
`:p`
|
|
881
881
|
<slot name="fallback"></slot>
|
|
882
|
-
`}};n(Ko,"Price");var ul=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:W(e.product)(t)}},"mapStateToProps"),Si=g(ul)(Ko);$();function Zo(t){_i(),ds(t);try{customElements.define("og-when",Js),customElements.define("og-text",si),customElements.define("og-incentive-text",li),customElements.define("og-offer",gi),customElements.define("og-select-frequency",ui),customElements.define("og-optout-button",Xs),customElements.define("og-optin-toggle",ni),customElements.define("og-optin-status",Ks),customElements.define("og-optin-button",Zs),customElements.define("og-optin-select",ti),customElements.define("og-upsell-button",ri),customElements.define("og-frequency-status",ei),customElements.define("og-modal",yr),customElements.define("og-select",br),customElements.define("og-tooltip",_r),customElements.define("og-upsell-modal",oi),customElements.define("og-next-upcoming-order",di),customElements.define("og-price",Si)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(Fr(o)),this},setMerchantId(o){return t.dispatch(jn(o)),this},setAuthUrl(o){return t.dispatch(Mn(o)),this},getProductsForPurchasePost(o=[]){return Hr(t.getState(),o)},getOptins(o=[]){return Hr(t.getState(),o)},clear(){t.dispatch(Hn())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",s=>o(s.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(zn(o)),this},setLocale(o){return t.dispatch(Gn(o)),this},addTemplate(o,s,i){return t.dispatch(Wn(o,s,i)),this},setTemplates(o){return t.dispatch(Yn(o)),this},setPublicPath(o){return this},resolveSettings(o,s,i,a=t){if(o&&s&&i){let c=[];i.product?c.push(i.product):i.cart&&Array.isArray(i.cart.products)&&(c=c.concat(i.cart.products));let{apiUrl:l}=yt({},Fr(s)),{sessionId:d}=a.getState();d&&c.forEach(f=>{let u=R(f);oe.fetchOffer(l,o,d,`${u}`,he)}),i.product_discounts&&typeof i.product_discounts=="object"&&a.dispatch({type:J,payload:i.product_discounts})}},initialize(o,s,i){var c,l;e||r.resolveSettings(o,s,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),s&&s!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(s),i&&r.setAuthUrl(i),e?console.warn("og.offers has been initialized already. Skipping."):(window.addEventListener("storage",ts(t)),t.dispatch(Yt())),arguments.length===3&&(((l=t.getState().auth)==null?void 0:l.ts)||t.dispatch(Vn())),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),$r(window.opener,r),r}n(Zo,"makeApi");V();$();var Be=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),pl=n(t=>`${t}%`,"percentage"),dl=n(t=>{var r,o;let e="";return((r=t.price_adjustments[0])==null?void 0:r.value_type)==="percentage"?e=pl(t.price_adjustments[0].value):((o=t.price_adjustments[0])==null?void 0:o.value)?e=Be(t.price_adjustments[0].value):t.compare_at_price&&(e=Be(t.compare_at_price-t.price)),e?[Be(t.compare_at_price),e,Be(t.price)]:[Be(t.price),"",Be(t.price)]},"mapSellingPlanToDiscount"),Ti=n((t,e,r)=>{let o=Object.keys(t).filter(s=>s.startsWith(e.toString()));return o.length?{...t,...o.reduce((s,i)=>({...s,[i]:r}),{})}:t},"overrideLineKey"),vi=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name==="Subscribe and Save"),"getOGSellingPlanGroup"),fl=n((t,e)=>({...Ti(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Oi=n((t,[e])=>({...t,[e]:!0}),"productTrue"),wi=n((t,e)=>{var r;return{...t,[e.selling_plan_id||((r=e.selling_plan)==null?void 0:r.id)]:dl(e)}},"sellingPlanAllocationsReducer"),Ci=n((t,e)=>{let r=R(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),hl=n((t={},e)=>{if(J===e.type)return Object.entries(e.payload).reduce(Oi,t);if(re===e.type){let{payload:r}=e;return r.items.reduce(Ci,t)}if(z===e.type){let{payload:r}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,s)=>{var i,a;return{...Ti(o,s.id,((i=s.selling_plan_allocations)==null?void 0:i.length)>0),[s.id]:((a=s.selling_plan_allocations)==null?void 0:a.length)>0}},t)}return t},"autoshipEligible");function ml(t){let e=["day","week","month"].findIndex(o=>t.toLowerCase().includes(o))+1,r=(t.match(/(\d+)/)||["",1])[1];return r&&e?`${r}_${e}`:null}n(ml,"textToFreq");var gl=n((t={frequencies:[],offerType:"radio"},e)=>{var r,o,s,i;if(J===e.type){let a=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:a}}if(z===e.type){let a=e.payload,c=vi(a),l=(r=c==null?void 0:c.selling_plans)==null?void 0:r.map(({id:d})=>`${d}`);if(l==null?void 0:l.length){let d=(o=c==null?void 0:c.selling_plans)==null?void 0:o.map(({options:u})=>u||[]).flat().map(({value:u})=>ml(u)),f=((i=(s=c.options)==null?void 0:s[0])==null?void 0:i.values)||l;return{...t,defaultFrequency:l[0],frequenciesEveryPeriod:d,frequencies:l,frequenciesText:f}}}return t},"config"),yl=n((t={},e)=>{if(J===e.type)return Object.entries(e.payload).reduce(Oi,t);if(re===e.type)return e.payload.items.reduce(Ci,t);if(z===e.type){let r=e.payload;return[r,...r==null?void 0:r.variants].reduce(fl,t)||t}return t},"inStock"),bl=n((t={},e)=>t,"offer"),_l=n((t="",e)=>"native-shopify-offer","offerId"),El=n((t=[],e)=>{var r;if(re===e.type){let o=e.payload;return t.filter(s=>!s.id.includes(":")).concat(o.items.reduce((s,i)=>i.selling_plan_allocation?[...s,{id:i.key,frequency:`${i.selling_plan_allocation.selling_plan.id}`}]:s,[]))}if(P===e.type){let{autoship:o,autoship_by_default:s,in_stock:i,offer:a}=e.payload;return Object.keys(o).reduce((c,l)=>c.concat(!c.some(d=>d.id===l)&&o[l]&&s[l]&&i[l]?{id:l,frequency:a.defaultFrequency}:[]),t)}if(z===e.type){let o=e.payload.variants.map(a=>a.id).map(a=>`${a}`),s=vi(e.payload),i=(r=s==null?void 0:s.selling_plans)==null?void 0:r.map(({id:a})=>`${a}`);return t.map(a=>({...a,frequency:o.some(c=>c===a.id)&&!i.some(c=>c===a.frequency)?i[0]:a.frequency}))}return qo(t,e)},"optedin"),xl=n((t={},e)=>t,"productOffer"),Sl=n((t={},e)=>{if(z===e.type){let r=e.payload;return[r,...r==null?void 0:r.variants].reduce((o,s)=>{var i;return{...o,[s.id]:(i=s.selling_plan_allocations)==null?void 0:i.reduce(wi,{})}},t)||t}return re===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?{...o,[s.key]:wi({},s.selling_plan_allocation)}:o,t)||t:J===e.type?{...e.payload}:t},"productPlans"),Pi=bt({auth:jo,authUrl:Vo,autoshipByDefault:Yo,autoshipEligible:hl,config:gl,defaultFrequencies:Jo,eligibilityGroups:Fo,environment:yt,firstOrderPlaceDate:Ho,incentives:Lo,inStock:yl,locale:Go,merchantId:Mo,nextUpcomingOrder:Do,offer:bl,offerId:_l,optedin:El,optedout:Uo,previewStandardOffer:zo,previewUpsellOffer:Wo,productOffer:xl,productPlans:Sl,productToSubscribe:Bo,sessionId:$o,templates:Qo});var Ri=ee(Ke()),Ai=ee(Et());V();$();var Ui,Di,Ni=((Di=(Ui=window.Shopify)==null?void 0:Ui.routes)==null?void 0:Di.root)||"/",Tl="/cart",vl=`${Ni}cart.js`,Ol=`${Ni}products/`,ki=(0,Ai.debounce)(100,!1,function(t,e){let{id:r}=Object.fromEntries([...new FormData(t).entries()]);r?e.setAttribute("product",r):e.removeAttribute("product")});async function wl(t,e){let r=Cl();if(r)try{t.dispatch({type:z,payload:await qi(r)})}catch(s){console.warn("OG: Unable to fetch product details for PDP",s)}let o=e.closest("form");if(!o){let s=e.parentElement;for(;s&&(o=s.querySelector('form[action$="/cart/add"]'),!(o||s.tagName.toLowerCase()==="body"));)s=s.parentElement}o?(o.addEventListener("change",i=>ki(o,e)),new MutationObserver(()=>ki(o,e)).observe(o,{subtree:!0,childList:!0})):console.info("no /cart/add form found for og-offer",e)}n(wl,"setupPdp");var Ii=n(async()=>await(await fetch(vl)).json(),"getCart");function Cl(){return[()=>{var t,e;return(((e=(t=document.querySelector('[href$=".oembed"]'))==null?void 0:t.getAttribute("href"))==null?void 0:e.match(/\/([^\/]+)\.oembed$/))||[])[1]},()=>{var t,e;return(document.querySelector('meta[property="og:type"][content="product"]')&&((e=(t=document.querySelector('meta[property="og:url"][content]'))==null?void 0:t.getAttribute("content"))==null?void 0:e.match(/\/([^\/]+)$/))||[])[1]},()=>{var t;return(t=[...document.querySelectorAll("[type$=json]")].map(e=>JSON.parse(e.textContent||"{}")).find(e=>e.handle&&e.price))==null?void 0:t.handle}].reduce((t,e)=>t||e(),"")}n(Cl,"guessProductHandle");var qi=(0,Ri.default)(async t=>(await fetch(`${Ol}${t}.js`)).json());async function Pl(t,e){let r=await Ii(),{items:o}=r;t.dispatch({type:re,payload:r});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:a})=>a))).map(qi))).forEach(a=>t.dispatch({type:z,payload:a}))}n(Pl,"setupCart");async function Rl(t,e){var i,a;let r=t.payload.offer,o=t.payload.frequency||null,s=Al(t);if(!(r==null?void 0:r.isCart)){r&&Nl(r.product.id,s[0],s[1]);return}try{r.style.pointerEvents="none",r.style.opacity=".7";let c=r.closest(".shopify-section"),l=((c==null?void 0:c.id.match(/^shopify-section-(.+)/))||[])[1],d=t.payload.product.id,f=await Ii(),u=(i=f==null?void 0:f.items)==null?void 0:i.findIndex(L=>L.key===d),m=f.items[u],_=m.quantity,b=R(d),h=await fetch("/cart/change.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:d,quantity:_,attributes:Object.fromEntries([s]),properties:m.properties,selling_plan:o||null,sections:l?[l]:void 0})});if(h.status!==200)throw new Error("Cart not updated");let x=await h.json(),w=f.items.length===x.items.length?x.items[u].key:(a=x.items.find(L=>L.quantity===_&&L.product_id===b&&(!o&&!L.selling_plan_allocation||(L==null?void 0:L.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;w&&r.setAttribute("product",w),e.dispatch({type:re,payload:x});let y=new CustomEvent(Sn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(y),y.defaultPrevented)return;let C=x.sections;if(C&&l in C){let L=C[l],en=new DOMParser().parseFromString(L.toString()||"","text/html").getElementById("shopify-section-"+l);en&&(c.innerHTML=en.innerHTML)}else window.location.pathname.startsWith(Tl)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Rl,"synchronizeCartOptin");function Al(t){var i;let e=t.payload.product.id;if(!e)return[];let r=`og__${Math.ceil(new Date().getTime()/1e3)}`,o=((i=t.payload.offer)==null?void 0:i.location)||"",s=[e,t.type.toLowerCase(),o];switch(t.type){case we:case q:s.push("");break;case I:case U:s.push(t.payload.frequency);break;default:return[]}return[r,s.join(",")]}n(Al,"getTrackingEvent");function Nl(t,e,r){let o=`[name="id"][value="${t}"]`,s=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let i=document.querySelectorAll(o);i.length||(i=document.querySelectorAll(s)),[...i].forEach(a=>{let c=a.form,l=c==null?void 0:c.querySelector(`[name="${e}"]`);l||(l=document.createElement("input"),l.type="hidden",l.name=`attributes[${e}]`,c==null||c.appendChild(l)),l.value=r})}n(Nl,"updateTrackingInputs");function kl(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}n(kl,"getOrCreateHidden");function Il(t,e){[...document.querySelectorAll("[name=id]")].forEach(r=>{var a;let o=r.value,i=(a=Qt({id:o})(t.getState()))==null?void 0:a.frequency;kl(r.form,"selling_plan",i)})}n(Il,"synchronizeSellingPlan");function Xo(t){return e=>r=>{var o;switch(r.type){case I:case q:case U:break;case we:((o=r.payload.offer)==null?void 0:o.isCart)?Pl(t,r.payload.offer):wl(t,r.payload.offer);break;default:}switch(e(r),r.type){case I:case q:case U:Rl(r,t);case we:case P:case z:Il(t,r.payload.offer);break;default:}}}n(Xo,"shopifyMiddleware");Bt();$();N();$();var ql="/apps/subscriptions/auth/",Fi="og_auth_begin",Ul="og_auth_end",Dl=n(t=>{let[e,r,o,s]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:s}},"parseIntegrationTempAuth");async function Li({store:t}){var s;let[e]=qr(),r=ot(),o=(r==null?void 0:r.dataset.customer)?Dl(r.dataset.customer):(s=window.ogShopifyConfig)==null?void 0:s.customer;if(o){let i=await Ll(o);if(i){let[a,c,l]=i.split("|");t.dispatch(nt(e,a,Number(c),l))}}else Un("og_auth")}n(Li,"authorizeShopifyCustomer");async function Fl(t){try{let r=await(await fetch(`${ql}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Fi);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Fi.length,r.lastIndexOf(Ul)))}catch(e){console.error(e)}}n(Fl,"fetchOGSignature");async function Ll(t){let e=Dn("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:s}=await Fl(t);if(!r)return"";let i=new Date,a=btoa(s);i.setTime(i.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${i.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(Ll,"getOrCreateAuthCookie");var Mi,ji=cs(...((Mi=Ne)==null?void 0:Mi.shopify_selling_plans)?[Pi,Xo]:[xi]),E=Zo(ji),jl=E.isReady,Ml=E.addOptinChangedCallback,Vl=E.addTemplate,$l=E.clear,Hl=E.config,Bl=E.disableOptinChangedCallbacks,Gl=E.getOptins,zl=E.getProductsForPurchasePost,Wl=E.initialize,Yl=E.previewMode,Jl=E.register,Ql=E.resolveSettings,Kl=E.setAuthUrl,Zl=E.setEnvironment,Xl=E.setLocale,eu=E.setMerchantId,tu=E.setPublicPath,ru=E.setTemplates,ou=E.setupCart,nu=E.setupProduct,su=E.setupProducts;var iu=E.initialize;rt(()=>qn(E));var Vi;((Vi=Ne)==null?void 0:Vi.shopify_selling_plans)&&rt(()=>Li(E));return au;})();
|
|
882
|
+
`}};n(Ko,"Price");var ul=n((t,e)=>{var r;return{productPlans:t.productPlans,configDefaultFrequency:(r=t.config)==null?void 0:r.defaultFrequency,frequency:W(e.product)(t)}},"mapStateToProps"),Si=g(ul)(Ko);$();function Zo(t){_i(),ds(t);try{customElements.define("og-when",Js),customElements.define("og-text",si),customElements.define("og-incentive-text",li),customElements.define("og-offer",gi),customElements.define("og-select-frequency",ui),customElements.define("og-optout-button",Xs),customElements.define("og-optin-toggle",ni),customElements.define("og-optin-status",Ks),customElements.define("og-optin-button",Zs),customElements.define("og-optin-select",ti),customElements.define("og-upsell-button",ri),customElements.define("og-frequency-status",ei),customElements.define("og-modal",yr),customElements.define("og-select",br),customElements.define("og-tooltip",_r),customElements.define("og-upsell-modal",oi),customElements.define("og-next-upcoming-order",di),customElements.define("og-price",Si)}catch{console.info("OG WebComponents already registered, skipping.")}let e=!1,r={store:t,isReady:()=>e,setEnvironment(o){return t.dispatch(Fr(o)),this},setMerchantId(o){return t.dispatch(jn(o)),this},setAuthUrl(o){return t.dispatch(Mn(o)),this},getProductsForPurchasePost(o=[]){return Hr(t.getState(),o)},getOptins(o=[]){return Hr(t.getState(),o)},clear(){t.dispatch(Hn())},addOptinChangedCallback(o){typeof o=="function"&&document.addEventListener("optin-changed",s=>o(s.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",o=>o.stopPropagation(),!0)},register(){},previewMode(o){return window.og=window.og||{},o===!1?delete window.og:window.og.previewMode=!0,this},config(o){return t.dispatch(zn(o)),this},setLocale(o){return t.dispatch(Gn(o)),this},addTemplate(o,s,i){return t.dispatch(Wn(o,s,i)),this},setTemplates(o){return t.dispatch(Yn(o)),this},setPublicPath(o){return this},resolveSettings(o,s,i,a=t){if(o&&s&&i){let c=[];i.product?c.push(i.product):i.cart&&Array.isArray(i.cart.products)&&(c=c.concat(i.cart.products));let{apiUrl:l}=yt({},Fr(s)),{sessionId:d}=a.getState();d&&c.forEach(f=>{let u=R(f);oe.fetchOffer(l,o,d,`${u}`,he)}),i.product_discounts&&typeof i.product_discounts=="object"&&a.dispatch({type:J,payload:i.product_discounts})}},initialize(o,s,i){var c,l;e||r.resolveSettings(o,s,window.og_settings,t);let a=t.getState();return o&&o!==a.merchantId&&r.setMerchantId(o),s&&s!==((c=a.environment)==null?void 0:c.name)&&r.setEnvironment(s),i&&r.setAuthUrl(i),e?console.warn("og.offers has been initialized already. Skipping."):(window.addEventListener("storage",ts(t)),t.dispatch(Yt())),arguments.length===3&&(((l=t.getState().auth)==null?void 0:l.ts)||t.dispatch(Vn())),e=!0,this}};return window.OG=window.OG||{},Object.assign(window.OG,r),Object.assign(r.initialize,r),$r(window.opener,r),r}n(Zo,"makeApi");V();$();var Be=n(t=>t===null?"":`$${t.toString().replace(/(\d\d)$/,".$1")}`,"money"),pl=n(t=>`${t}%`,"percentage"),dl=n(t=>{var r,o;let e="";return((r=t.price_adjustments[0])==null?void 0:r.value_type)==="percentage"?e=pl(t.price_adjustments[0].value):((o=t.price_adjustments[0])==null?void 0:o.value)?e=Be(t.price_adjustments[0].value):t.compare_at_price&&(e=Be(t.compare_at_price-t.price)),e?[Be(t.compare_at_price),e,Be(t.price)]:[Be(t.price),"",Be(t.price)]},"mapSellingPlanToDiscount"),Ti=n((t,e,r)=>{let o=Object.keys(t).filter(s=>s.startsWith(e.toString()));return o.length?{...t,...o.reduce((s,i)=>({...s,[i]:r}),{})}:t},"overrideLineKey"),vi=n(t=>t==null?void 0:t.selling_plan_groups.find(r=>r.name==="Subscribe and Save"),"getOGSellingPlanGroup"),fl=n((t,e)=>({...Ti(t,e.id,e.available),[e.id]:e.available}),"productOrVariantInStockReducer"),Oi=n((t,[e])=>({...t,[e]:!0}),"productTrue"),wi=n((t,e)=>{var r;return{...t,[e.selling_plan_id||((r=e.selling_plan)==null?void 0:r.id)]:dl(e)}},"sellingPlanAllocationsReducer"),Ci=n((t,e)=>{let r=R(e.key);return{...t,[e.key]:t[r]||null}},"reduceProductCartLine"),hl=n((t={},e)=>{if(J===e.type)return Object.entries(e.payload).reduce(Oi,t);if(re===e.type){let{payload:r}=e;return r.items.reduce(Ci,t)}if(z===e.type){let{payload:r}=e;return[r,...(r==null?void 0:r.variants)||[]].reduce((o,s)=>{var i,a;return{...Ti(o,s.id,((i=s.selling_plan_allocations)==null?void 0:i.length)>0),[s.id]:((a=s.selling_plan_allocations)==null?void 0:a.length)>0}},t)}return t},"autoshipEligible");function ml(t){let e=["day","week","month"].findIndex(o=>t.toLowerCase().includes(o))+1,r=(t.match(/(\d+)/)||["",1])[1];return r&&e?`${r}_${e}`:null}n(ml,"textToFreq");var gl=n((t={frequencies:[],offerType:"radio"},e)=>{var r,o,s,i;if(J===e.type){let a=[...new Set(Object.values(e.payload).map(Object.keys).flat())];return{...t,frequencies:a}}if(z===e.type){let a=e.payload,c=vi(a),l=(r=c==null?void 0:c.selling_plans)==null?void 0:r.map(({id:d})=>`${d}`);if(l==null?void 0:l.length){let d=(o=c==null?void 0:c.selling_plans)==null?void 0:o.map(({options:u})=>u||[]).flat().map(({value:u})=>ml(u)),f=((i=(s=c.options)==null?void 0:s[0])==null?void 0:i.values)||l;return{...t,defaultFrequency:l[0],frequenciesEveryPeriod:d,frequencies:l,frequenciesText:f}}}return t},"config"),yl=n((t={},e)=>{if(J===e.type)return Object.entries(e.payload).reduce(Oi,t);if(re===e.type)return e.payload.items.reduce(Ci,t);if(z===e.type){let r=e.payload;return[r,...r==null?void 0:r.variants].reduce(fl,t)||t}return t},"inStock"),bl=n((t={},e)=>t,"offer"),_l=n((t="",e)=>"native-shopify-offer","offerId"),El=n((t=[],e)=>{var r;if(re===e.type){let o=e.payload;return t.filter(s=>!s.id.includes(":")).concat(o.items.reduce((s,i)=>i.selling_plan_allocation?[...s,{id:i.key,frequency:`${i.selling_plan_allocation.selling_plan.id}`}]:s,[]))}if(P===e.type){let{autoship:o,autoship_by_default:s,in_stock:i,offer:a}=e.payload;return Object.keys(o).reduce((c,l)=>c.concat(!c.some(d=>d.id===l)&&o[l]&&s[l]&&i[l]?{id:l,frequency:a.defaultFrequency}:[]),t)}if(z===e.type){let o=e.payload.variants.map(a=>a.id).map(a=>`${a}`),s=vi(e.payload),i=(r=s==null?void 0:s.selling_plans)==null?void 0:r.map(({id:a})=>`${a}`);return t.map(a=>({...a,frequency:o.some(c=>c===a.id)&&!i.some(c=>c===a.frequency)?i[0]:a.frequency}))}return qo(t,e)},"optedin"),xl=n((t={},e)=>t,"productOffer"),Sl=n((t={},e)=>{if(z===e.type){let r=e.payload;return[r,...r==null?void 0:r.variants].reduce((o,s)=>{var i;return{...o,[s.id]:(i=s.selling_plan_allocations)==null?void 0:i.reduce(wi,{})}},t)||t}return re===e.type?e.payload.items.reduce((o,s)=>s.selling_plan_allocation?{...o,[s.key]:wi({},s.selling_plan_allocation)}:o,t)||t:J===e.type?{...e.payload}:t},"productPlans"),Pi=bt({auth:jo,authUrl:Vo,autoshipByDefault:Yo,autoshipEligible:hl,config:gl,defaultFrequencies:Jo,eligibilityGroups:Fo,environment:yt,firstOrderPlaceDate:Ho,incentives:Lo,inStock:yl,locale:Go,merchantId:Mo,nextUpcomingOrder:Do,offer:bl,offerId:_l,optedin:El,optedout:Uo,previewStandardOffer:zo,previewUpsellOffer:Wo,productOffer:xl,productPlans:Sl,productToSubscribe:Bo,sessionId:$o,templates:Qo});var Ri=ee(Ke()),Ai=ee(Et());V();$();var Ui,Di,Ni=((Di=(Ui=window.Shopify)==null?void 0:Ui.routes)==null?void 0:Di.root)||"/",Tl="/cart",vl=`${Ni}cart.js`,Ol=`${Ni}products/`,ki=(0,Ai.debounce)(100,!1,function(t,e){let{id:r}=Object.fromEntries([...new FormData(t).entries()]);r?e.setAttribute("product",r):e.removeAttribute("product")});async function wl(t,e){let r=Cl();if(r)try{t.dispatch({type:z,payload:await qi(r)})}catch(s){console.warn("OG: Unable to fetch product details for PDP",s)}let o=e.closest("form");if(!o){let s=e.parentElement;for(;s&&(o=s.querySelector('form[action$="/cart/add"]'),!(o||s.tagName.toLowerCase()==="body"));)s=s.parentElement}o?(o.addEventListener("change",i=>ki(o,e)),new MutationObserver(()=>ki(o,e)).observe(o,{subtree:!0,childList:!0})):console.info("no /cart/add form found for og-offer",e)}n(wl,"setupPdp");var Ii=n(async()=>await(await fetch(vl)).json(),"getCart");function Cl(){return[()=>{var t,e;return(((e=(t=document.querySelector('[href$=".oembed"]'))==null?void 0:t.getAttribute("href"))==null?void 0:e.match(/\/([^\/]+)\.oembed$/))||[])[1]},()=>{var t,e;return(document.querySelector('meta[property="og:type"][content="product"]')&&((e=(t=document.querySelector('meta[property="og:url"][content]'))==null?void 0:t.getAttribute("content"))==null?void 0:e.match(/\/([^\/]+)$/))||[])[1]},()=>{var t;return(t=[...document.querySelectorAll("[type$=json]")].map(e=>JSON.parse(e.textContent||"{}")).find(e=>e.handle&&e.price))==null?void 0:t.handle}].reduce((t,e)=>t||e(),"")}n(Cl,"guessProductHandle");var qi=(0,Ri.default)(async t=>(await fetch(`${Ol}${t}.js`)).json());async function Pl(t,e){let r=await Ii(),{items:o}=r;t.dispatch({type:re,payload:r});let s=Number(e.product.id);s<=o.length&&e.setAttribute("product",o[s-1].key),(await Promise.all(Array.from(new Set(o.map(({handle:a})=>a))).map(qi))).forEach(a=>t.dispatch({type:z,payload:a}))}n(Pl,"setupCart");async function Rl(t,e){var i,a;let r=t.payload.offer,o=t.payload.frequency||null,s=Al(t);if(!(r==null?void 0:r.isCart)){r&&Nl(r.product.id,s[0],s[1]);return}try{r.style.pointerEvents="none",r.style.opacity=".7";let c=r.closest(".shopify-section"),l=((c==null?void 0:c.id.match(/^shopify-section-(.+)/))||[])[1],d=t.payload.product.id,f=await Ii(),u=(i=f==null?void 0:f.items)==null?void 0:i.findIndex(L=>L.key===d),m=f.items[u],_=m.quantity,b=R(d),h=await fetch("/cart/change.js",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:d,quantity:_,attributes:Object.fromEntries([s]),properties:m.properties,selling_plan:o||null,sections:l?[l]:void 0})});if(h.status!==200)throw new Error("Cart not updated");let x=await h.json(),w=f.items.length===x.items.length?x.items[u].key:(a=x.items.find(L=>L.quantity===_&&L.product_id===b&&(!o&&!L.selling_plan_allocation||(L==null?void 0:L.selling_plan_allocation.selling_plan.id)===o)))==null?void 0:a.key;w&&r.setAttribute("product",w),e.dispatch({type:re,payload:x});let y=new CustomEvent(Sn,{bubbles:!0,cancelable:!0});if(r.dispatchEvent(y),y.defaultPrevented)return;let C=x.sections;if(C&&l in C){let L=C[l],en=new DOMParser().parseFromString(L.toString()||"","text/html").getElementById("shopify-section-"+l);en&&(c.innerHTML=en.innerHTML)}else window.location.pathname.startsWith(Tl)&&window.location.reload()}catch(c){console.log("OG Error updating cart",c)}finally{r.style.pointerEvents="auto",r.style.opacity="1"}}n(Rl,"synchronizeCartOptin");function Al(t){var a,c;let e=t.payload.product.id;if(!e)return[];let r=`og__${Math.ceil(new Date().getTime()/1e3)}`,o=((a=t.payload.offer)==null?void 0:a.location)||"",s=((c=t.payload.offer)==null?void 0:c.variationId)||"",i=[e,t.type.toLowerCase(),o];switch(t.type){case we:case q:i.push(""),i.push(s);break;case I:case U:i.push(t.payload.frequency),i.push(s);break;default:return[]}return[r,i.join(",")]}n(Al,"getTrackingEvent");function Nl(t,e,r){let o=`[name="id"][value="${t}"]`,s=`form[action="/cart/add"] option[value="${t}"]`;if(!e)return;let i=document.querySelectorAll(o);i.length||(i=document.querySelectorAll(s)),[...i].forEach(a=>{let c=a.form,l=c==null?void 0:c.querySelector(`[name="${e}"]`);l||(l=document.createElement("input"),l.type="hidden",l.name=`attributes[${e}]`,c==null||c.appendChild(l)),l.value=r})}n(Nl,"updateTrackingInputs");function kl(t,e,r){let o=t.querySelector(`[name="${e}"]`);if(o&&!r){o.remove();return}!o&&r&&(o=document.createElement("input"),o.type="hidden",o.name=e,t.appendChild(o)),o&&(o.value=r)}n(kl,"getOrCreateHidden");function Il(t,e){[...document.querySelectorAll("[name=id]")].forEach(r=>{var a;let o=r.value,i=(a=Qt({id:o})(t.getState()))==null?void 0:a.frequency;kl(r.form,"selling_plan",i)})}n(Il,"synchronizeSellingPlan");function Xo(t){return e=>r=>{var o;switch(r.type){case I:case q:case U:break;case we:((o=r.payload.offer)==null?void 0:o.isCart)?Pl(t,r.payload.offer):wl(t,r.payload.offer);break;default:}switch(e(r),r.type){case I:case q:case U:Rl(r,t);case we:case P:case z:Il(t,r.payload.offer);break;default:}}}n(Xo,"shopifyMiddleware");Bt();$();N();$();var ql="/apps/subscriptions/auth/",Fi="og_auth_begin",Ul="og_auth_end",Dl=n(t=>{let[e,r,o,s]=atob(t).split("|");return{id:e,signature:o,timestamp:r,email:s}},"parseIntegrationTempAuth");async function Li({store:t}){var s;let[e]=qr(),r=ot(),o=(r==null?void 0:r.dataset.customer)?Dl(r.dataset.customer):(s=window.ogShopifyConfig)==null?void 0:s.customer;if(o){let i=await Ll(o);if(i){let[a,c,l]=i.split("|");t.dispatch(nt(e,a,Number(c),l))}}else Un("og_auth")}n(Li,"authorizeShopifyCustomer");async function Fl(t){try{let r=await(await fetch(`${ql}?customer=${t.id}&customer_signature=${t.signature}&customer_timestamp=${t.timestamp}`)).text(),o=r.lastIndexOf(Fi);if(o<0)throw"Invalid response from OG auth endpoint";return JSON.parse(r.substring(o+Fi.length,r.lastIndexOf(Ul)))}catch(e){console.error(e)}}n(Fl,"fetchOGSignature");async function Ll(t){let e=Dn("og_auth");if(e)return e;let{customerId:r,timestamp:o,signature:s}=await Fl(t);if(!r)return"";let i=new Date,a=btoa(s);i.setTime(i.getTime()+2*60*60*1e3);let c=`${r}|${o}|${a};expires=${i.toUTCString()}`;return document.cookie=`og_auth=${c};secure;path=/`,c}n(Ll,"getOrCreateAuthCookie");var Mi,ji=cs(...((Mi=Ne)==null?void 0:Mi.shopify_selling_plans)?[Pi,Xo]:[xi]),E=Zo(ji),jl=E.isReady,Ml=E.addOptinChangedCallback,Vl=E.addTemplate,$l=E.clear,Hl=E.config,Bl=E.disableOptinChangedCallbacks,Gl=E.getOptins,zl=E.getProductsForPurchasePost,Wl=E.initialize,Yl=E.previewMode,Jl=E.register,Ql=E.resolveSettings,Kl=E.setAuthUrl,Zl=E.setEnvironment,Xl=E.setLocale,eu=E.setMerchantId,tu=E.setPublicPath,ru=E.setTemplates,ou=E.setupCart,nu=E.setupProduct,su=E.setupProducts;var iu=E.initialize;rt(()=>qn(E));var Vi;((Vi=Ne)==null?void 0:Vi.shopify_selling_plans)&&rt(()=>Li(E));return au;})();
|
|
883
883
|
; return lib; });
|
|
884
884
|
//# sourceMappingURL=offers.js.map
|