@ordergroove/offers 2.24.3 → 2.25.0
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 +19 -0
- package/dist/bundle-report.html +99 -98
- package/dist/examples.js +9 -9
- package/dist/examples.js.map +2 -2
- package/dist/offers.js +159 -144
- package/dist/offers.js.map +3 -3
- package/examples/index.js +10 -1
- package/package.json +4 -4
- package/src/__tests__/offers.spec.js +100 -5
- package/src/components/Offer.js +10 -1
- package/src/components/Price.js +54 -0
- package/src/components/__tests__/OG.fspec.js +2 -2
- package/src/components/__tests__/Price.fspec.js +43 -0
- package/src/core/actions.js +7 -4
- package/src/core/constants.js +1 -0
- package/src/core/reducer.js +10 -0
- package/src/index.js +187 -150
- package/src/init-func-tests.js +1 -1
- package/src/init-test.js +2 -2
package/dist/offers.js
CHANGED
|
@@ -8,10 +8,108 @@ else {
|
|
|
8
8
|
window.og['offers'] = factory();
|
|
9
9
|
}
|
|
10
10
|
})(()=>{
|
|
11
|
-
var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.defineProperties,Ma=Object.getOwnPropertyDescriptor,Va=Object.getOwnPropertyDescriptors,$a=Object.getOwnPropertyNames,Lo=Object.getOwnPropertySymbols,Ba=Object.getPrototypeOf,jo=Object.prototype.hasOwnProperty,Ha=Object.prototype.propertyIsEnumerable;var Mo=(t,e,r)=>e in t?Re(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,l=(t,e)=>{for(var r in e||(e={}))jo.call(e,r)&&Mo(t,r,e[r]);if(Lo)for(var r of Lo(e))Ha.call(e,r)&&Mo(t,r,e[r]);return t},m=(t,e)=>ja(t,Va(e)),Vo=t=>Re(t,"__esModule",{value:!0}),n=(t,e)=>Re(t,"name",{value:e,configurable:!0}),he=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var p=(t,e)=>()=>(t&&(e=t(t=0)),e);var X=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),x=(t,e)=>{Vo(t);for(var r in e)Re(t,r,{get:e[r],enumerable:!0})},za=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of $a(e))!jo.call(t,o)&&o!=="default"&&Re(t,o,{get:()=>e[o],enumerable:!(r=Ma(e,o))||r.enumerable});return t},Ae=t=>za(Vo(Re(t!=null?La(Ba(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Wo={};x(Wo,{default:()=>oc,offersLiveEditor:()=>kr});function Nr(t){let e=rc(zo),r=Go(t.source);e(t)&&t.data.ogType==="READY"&&Promise.resolve().then(()=>tc(Xa("//static.ordergroove.com/@ordergroove/offers-live-editor/0.4.0/dist/client.js"))).then(({initializeClient:o})=>{o(e,r),window.removeEventListener("message",Nr)})}function kr(t=window.opener){t&&t!==window&&(window.addEventListener("message",Nr),Go(t)("READY"))}var Ga,Ze,Wa,Ya,$o,Qa,Bo,Ja,Ho,Ka,Za,St,Xa,ec,tc,rc,zo,Go,oc,Yo=p(()=>{Ga=Object.create,Ze=Object.defineProperty,Wa=Object.getOwnPropertyDescriptor,Ya=Object.getOwnPropertyNames,$o=Object.getOwnPropertySymbols,Qa=Object.getPrototypeOf,Bo=Object.prototype.hasOwnProperty,Ja=Object.prototype.propertyIsEnumerable,Ho=n((t,e,r)=>e in t?Ze(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"d"),Ka=n((t,e)=>{for(var r in e||(e={}))Bo.call(e,r)&&Ho(t,r,e[r]);if($o)for(var r of $o(e))Ja.call(e,r)&&Ho(t,r,e[r]);return t},"c"),Za=n(t=>Ze(t,"__esModule",{value:!0}),"E"),St=n((t,e)=>Ze(t,"name",{value:e,configurable:!0}),"r"),Xa=(t=>typeof he!="undefined"?he:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof he!="undefined"?he:e)[r]}):t)(function(t){if(typeof he!="undefined")return he.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')}),ec=n((t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ya(e))!Bo.call(t,o)&&o!=="default"&&Ze(t,o,{get:()=>e[o],enumerable:!(r=Wa(e,o))||r.enumerable});return t},"x"),tc=n(t=>ec(Za(Ze(t!=null?Ga(Qa(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),"v"),rc=St(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),zo=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Go=St(t=>(e,r)=>{zo.forEach(o=>t.postMessage(Ka({ogType:e},r),o))},"createBroadcastMessage");n(Nr,"f");St(Nr,"handleReady");n(kr,"I");St(kr,"offersLiveEditor");oc=kr});function qr(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}var Qo=p(()=>{n(qr,"symbolObservablePonyfill")});var Ne,nc,Ir,Jo=p(()=>{Qo();typeof self!="undefined"?Ne=self:typeof window!="undefined"||typeof window!="undefined"?Ne=window:typeof module!="undefined"?Ne=module:Ne=Function("return this")();nc=qr(Ne),Ir=nc});function sc(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function Dr(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r=="undefined"&&(r=e,e=void 0),typeof r!="undefined"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(Dr)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var s=t,i=e,a=[],c=a,u=!1;function h(){c===a&&(c=a.slice())}n(h,"ensureCanMutateNextListeners");function _(){if(u)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}n(_,"getState");function f(g){if(typeof g!="function")throw new Error("Expected the listener to be a function.");if(u)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var P=!0;return h(),c.push(g),n(function(){if(!!P){if(u)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");P=!1,h();var S=c.indexOf(g);c.splice(S,1),a=null}},"unsubscribe")}n(f,"subscribe");function b(g){if(!sc(g))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof g.type=="undefined")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(u)throw new Error("Reducers may not dispatch actions.");try{u=!0,i=s(i,g)}finally{u=!1}for(var P=a=c,R=0;R<P.length;R++){var S=P[R];S()}return g}n(b,"dispatch");function w(g){if(typeof g!="function")throw new Error("Expected the nextReducer to be a function.");s=g,b({type:Xe.REPLACE})}n(w,"replaceReducer");function E(){var g,P=f;return g={subscribe:n(function(S){if(typeof S!="object"||S===null)throw new TypeError("Expected the observer to be an object.");function A(){S.next&&S.next(_())}n(A,"observeState"),A();var Fa=P(A);return{unsubscribe:Fa}},"subscribe")},g[Ir]=function(){return this},g}return n(E,"observable"),b({type:Xe.INIT}),o={dispatch:b,subscribe:f,getState:_,replaceReducer:w},o[Ir]=E,o}function ic(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function ac(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:Xe.INIT});if(typeof o=="undefined")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:Xe.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+Xe.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}function Ko(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var s=e[o];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,c;try{ac(r)}catch(u){c=u}return n(function(h,_){if(h===void 0&&(h={}),c)throw c;if(!1)var f;for(var b=!1,w={},E=0;E<i.length;E++){var g=i[E],P=r[g],R=h[g],S=P(R,_);if(typeof S=="undefined"){var A=ic(g,_);throw new Error(A)}w[g]=S,b=b||S!==R}return b=b||i.length!==Object.keys(h).length,b?w:h},"combination")}function Zo(t,e){return function(){return e(t.apply(this,arguments))}}function Xo(t,e){if(typeof t=="function")return Zo(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var s=t[o];typeof s=="function"&&(r[o]=Zo(s,e))}return r}function cc(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function en(t,e){var r=Object.keys(t);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(t)),e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r}function lc(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?en(r,!0).forEach(function(o){cc(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):en(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}function Fr(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(o){return o}:e.length===1?e[0]:e.reduce(function(o,s){return function(){return o(s.apply(void 0,arguments))}})}function tn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),i=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:s.getState,dispatch:n(function(){return i.apply(void 0,arguments)},"dispatch")},c=e.map(function(u){return u(a)});return i=Fr.apply(void 0,c)(s.dispatch),lc({},s,{dispatch:i})}}}var Ur,Xe,vt=p(()=>{Jo();Ur=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),Xe={INIT:"@@redux/INIT"+Ur(),REPLACE:"@@redux/REPLACE"+Ur(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ur()},"PROBE_UNKNOWN_ACTION")};n(sc,"isPlainObject");n(Dr,"createStore");n(ic,"getUndefinedStateErrorMessage");n(ac,"assertReducerShape");n(Ko,"combineReducers");n(Zo,"bindActionCreator");n(Xo,"bindActionCreators");n(cc,"_defineProperty");n(en,"ownKeys");n(lc,"_objectSpread2");n(Fr,"compose");n(tn,"applyMiddleware")});var on={};x(on,{connect:()=>y,createRecalcProps:()=>rn,default:()=>fc,resolveStore:()=>Lr,setStore:()=>pc,unsetStore:()=>dc});var et,uc,Lr,rn,y,pc,dc,fc,N=p(()=>{vt();et=null,uc=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Lr=n(t=>{if(!et)throw new Error("Missing redux store.");return et},"resolveStore"),rn=n((t,e)=>r=>{let{getState:o,dispatch:s}=Lr(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),y=n((t,e=uc)=>r=>{let s=rn(t,typeof e=="function"?e:i=>Xo(e,i));return class extends r{get store(){return et}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Lr(this).subscribe(()=>s(this)),s(this)}attributeChangedCallback(i,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(i,a,c),this._storeUnsubscribe&&a!==c&&s(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),pc=n(t=>{et=t},"setStore"),dc=n(()=>{et=void 0},"unsetStore"),fc=y});function nn(t){var e=n(function(o){var s=o.dispatch,i=o.getState;return function(a){return function(c){return typeof c=="function"?c(s,i,t):a(c)}}},"middleware");return e}var sn,an,cn=p(()=>{n(nn,"createThunkMiddleware");sn=nn();sn.withExtraArgument=nn;an=sn});var ee,te,re,wt,ln,F,tt,Ot,Tt,un,Ct,ke,pn,Pt,Rt,dn,At,Nt,kt,fn,hn,qt,mn,It,qe,gn,Ut,Dt,rt,ot,Ft,Lt,me,oe,jt,Mt,Ie=p(()=>{ee="OPTIN_PRODUCT",te="OPTOUT_PRODUCT",re="PRODUCT_CHANGE_FREQUENCY",wt="SET_MERCHANT_ID",ln="REQUEST_OFFER",F="RECEIVE_OFFER",tt="PRODUCT_HAS_CHANGED",Ot="CREATED_SESSION_ID",Tt="SET_AUTH_URL",un="REQUEST_AUTH",Ct="AUTHORIZE",ke="UNAUTHORIZED",pn="REQUEST_ORDERS",Pt="RECEIVE_ORDERS",Rt="RECEIVE_ORDER_ITEMS",dn="FETCH_RESPONSE_ERROR",At="SET_ENVIRONMENT_STAGING",Nt="SET_ENVIRONMENT_DEV",kt="SET_ENVIRONMENT_PROD",fn="CONCLUDE_UPSELL",hn="REQUEST_CREATE_IU_ORDER",qt="CREATE_ONE_TIME",mn="REQUEST_CONVERT_ONE_TIME",It="CONVERT_ONE_TIME",qe="CHECKOUT",gn="RECEIVE_FETCH",Ut="SET_LOCALE",Dt="SET_CONFIG",rt="SET_PREVIEW_STANDARD_OFFER",ot="SET_PREVIEW_UPSELL_OFFER",Ft="ADD_TEMPLATE",Lt="SET_TEMPLATES",me="LOCAL_STORAGE_CHANGE",oe="LOCAL_STORAGE_CLEAR",jt="SET_FIRST_ORDER_PLACE_DATE",Mt="SET_PRODUCT_TO_SUBSCRIBE"});function hc(t,e){return t===e}function mc(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,s=0;s<o;s++)if(!t(e[s],r[s]))return!1;return!0}function gc(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:hc,r=null,o=null;return function(){return mc(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}function yc(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}function bc(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var s=arguments.length,i=Array(s),a=0;a<s;a++)i[a]=arguments[a];var c=0,u=i.pop(),h=yc(i),_=t.apply(void 0,[function(){return c++,u.apply(null,arguments)}].concat(r)),f=t(function(){for(var b=[],w=h.length,E=0;E<w;E++)b.push(h[E].apply(null,arguments));return _.apply(null,b)});return f.resultFunc=u,f.dependencies=h,f.recomputations=function(){return c},f.resetRecomputations=function(){return c=0},f}}var Ue,yn=p(()=>{n(hc,"defaultEqualityCheck");n(mc,"areArgumentsShallowlyEqual");n(gc,"defaultMemoize");n(yc,"getDependencies");n(bc,"createSelectorCreator");Ue=bc(gc)});var Bt=X((np,On)=>{var _c="Expected a function",bn="__lodash_hash_undefined__",xc="[object Function]",Ec="[object GeneratorFunction]",Sc=/[\\^$.*+?()[\]{}|]/g,vc=/^\[object .+?Constructor\]$/,wc=typeof window=="object"&&window&&window.Object===Object&&window,Oc=typeof self=="object"&&self&&self.Object===Object&&self,_n=wc||Oc||Function("return this")();function Tc(t,e){return t==null?void 0:t[e]}n(Tc,"getValue");function Cc(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}n(Cc,"isHostObject");var Pc=Array.prototype,Rc=Function.prototype,xn=Object.prototype,jr=_n["__core-js_shared__"],En=function(){var t=/[^.]+$/.exec(jr&&jr.keys&&jr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Sn=Rc.toString,Mr=xn.hasOwnProperty,Ac=xn.toString,Nc=RegExp("^"+Sn.call(Mr).replace(Sc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kc=Pc.splice,qc=vn(_n,"Map"),nt=vn(Object,"create");function ge(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(ge,"Hash");function Ic(){this.__data__=nt?nt(null):{}}n(Ic,"hashClear");function Uc(t){return this.has(t)&&delete this.__data__[t]}n(Uc,"hashDelete");function Dc(t){var e=this.__data__;if(nt){var r=e[t];return r===bn?void 0:r}return Mr.call(e,t)?e[t]:void 0}n(Dc,"hashGet");function Fc(t){var e=this.__data__;return nt?e[t]!==void 0:Mr.call(e,t)}n(Fc,"hashHas");function Lc(t,e){var r=this.__data__;return r[t]=nt&&e===void 0?bn:e,this}n(Lc,"hashSet");ge.prototype.clear=Ic;ge.prototype.delete=Uc;ge.prototype.get=Dc;ge.prototype.has=Fc;ge.prototype.set=Lc;function De(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(De,"ListCache");function jc(){this.__data__=[]}n(jc,"listCacheClear");function Mc(t){var e=this.__data__,r=Vt(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():kc.call(e,r,1),!0}n(Mc,"listCacheDelete");function Vc(t){var e=this.__data__,r=Vt(e,t);return r<0?void 0:e[r][1]}n(Vc,"listCacheGet");function $c(t){return Vt(this.__data__,t)>-1}n($c,"listCacheHas");function Bc(t,e){var r=this.__data__,o=Vt(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(Bc,"listCacheSet");De.prototype.clear=jc;De.prototype.delete=Mc;De.prototype.get=Vc;De.prototype.has=$c;De.prototype.set=Bc;function ye(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(ye,"MapCache");function Hc(){this.__data__={hash:new ge,map:new(qc||De),string:new ge}}n(Hc,"mapCacheClear");function zc(t){return $t(this,t).delete(t)}n(zc,"mapCacheDelete");function Gc(t){return $t(this,t).get(t)}n(Gc,"mapCacheGet");function Wc(t){return $t(this,t).has(t)}n(Wc,"mapCacheHas");function Yc(t,e){return $t(this,t).set(t,e),this}n(Yc,"mapCacheSet");ye.prototype.clear=Hc;ye.prototype.delete=zc;ye.prototype.get=Gc;ye.prototype.has=Wc;ye.prototype.set=Yc;function Vt(t,e){for(var r=t.length;r--;)if(Xc(t[r][0],e))return r;return-1}n(Vt,"assocIndexOf");function Qc(t){if(!wn(t)||Kc(t))return!1;var e=el(t)||Cc(t)?Nc:vc;return e.test(Zc(t))}n(Qc,"baseIsNative");function $t(t,e){var r=t.__data__;return Jc(e)?r[typeof e=="string"?"string":"hash"]:r.map}n($t,"getMapData");function vn(t,e){var r=Tc(t,e);return Qc(r)?r:void 0}n(vn,"getNative");function Jc(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(Jc,"isKeyable");function Kc(t){return!!En&&En in t}n(Kc,"isMasked");function Zc(t){if(t!=null){try{return Sn.call(t)}catch(e){}try{return t+""}catch(e){}}return""}n(Zc,"toSource");function Vr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(_c);var r=n(function(){var o=arguments,s=e?e.apply(this,o):o[0],i=r.cache;if(i.has(s))return i.get(s);var a=t.apply(this,o);return r.cache=i.set(s,a),a},"memoized");return r.cache=new(Vr.Cache||ye),r}n(Vr,"memoize");Vr.Cache=ye;function Xc(t,e){return t===e||t!==t&&e!==e}n(Xc,"eq");function el(t){var e=wn(t)?Ac.call(t):"";return e==xc||e==Ec}n(el,"isFunction");function wn(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(wn,"isObject");On.exports=Vr});var qn={};x(qn,{api:()=>ne,compareFrequencies:()=>Nn,convertOneTimeToSubscription:()=>kn,createOneTime:()=>An,default:()=>rl,fetchItems:()=>Rn,fetchOffer:()=>Cn,fetchOrders:()=>Pn,isFrequencyValid:()=>zt,parseFrequenciesList:()=>zr,parseFrequency:()=>je,stringifyFrequencies:()=>tl,stringifyFrequency:()=>Me,toProductId:()=>Tn,toQuery:()=>Hr,withAuth:()=>st,withFetchJson:()=>Fe,withHost:()=>Le,withJsonBody:()=>Br});var Ht,$r,Fe,Le,st,Br,Hr,Tn,Cn,Pn,Rn,An,je,zt,Nn,zr,tl,Me,kn,ne,rl,se=p(()=>{Ht=Ae(Bt()),$r=n((...t)=>JSON.stringify(t),"memoizeKey"),Fe=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Le=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),st=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,s={}]=t(...r);return[o,m(l({},s),{headers:l({Authorization:JSON.stringify(e)},s.headers)})]},"withAuth"),Br=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,m(l({method:"POST"},o),{body:JSON.stringify(o.body),headers:l({"Content-type":"application/json"},o.headers)})]},"withJsonBody"),Hr=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),Tn=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),Cn=(0,Ht.default)(Fe(Le((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=Hr([["session_id",e],["page_type",1],["p",Tn(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),$r),Pn=(0,Ht.default)(Fe(Le(st((t=1,e="place")=>[`/orders/?${Hr([["status",t],["ordering",e]])}`]))),$r),Rn=(0,Ht.default)(Fe(Le(st(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),$r),An=Fe(Le(st(Br((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),je=n(t=>{if(typeof t=="object")return l({},t);let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),zt=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),Nn=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),zr=n(t=>[...new Set(t&&t.split(/\s+/))].filter(zt).sort(Nn),"parseFrequenciesList"),tl=n(t=>t==null?t:t.join(" "),"stringifyFrequencies"),Me=n(t=>{if(typeof t=="object"){let{every:e,period:r,every_period:o}=t;return`${e}_${r||o}`}return typeof t=="string"?t:""},"stringifyFrequency"),kn=Fe(Le(st(Br((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=je(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:l({item:t.public_id,offer:r},o)}]})))),ne={fetchOffer:Cn,fetchOrders:Pn,fetchItems:Rn,createOneTime:An,convertOneTimeToSubscription:kn},rl=ne});function ol(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var be,q,Gt,In,Gr,nl,W,Un,Dn,ie,Wt,Wr,Y,Ve,Q=p(()=>{yn();be=Ae(Bt());se();be.default.Cache=Map;n(ol,"arraysEqual");q=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||ol((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),Gt=n(t=>t.optedin||[],"optedinSelector"),In=n(t=>t.optedout||[],"optedoutSelector"),Gr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),nl=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),W=(0,be.default)(t=>Ue(Gt,In,Gr,(e,r,o)=>{let s=e.find(i=>q(t,i));return s||(r.find(i=>q(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),Un=(0,be.default)(t=>Ue(Gt,e=>{let r=e.find(o=>q(t,o));return r||!1}),t=>JSON.stringify(t)),Dn=(0,be.default)(t=>Ue(In,e=>e.find(r=>q(t,r)))),ie=(0,be.default)(t=>Ue(W(t),e=>e&&e.frequency||null)),Wt=(0,be.default)(t=>Ue(nl,e=>e[t]&&Me(e[t])||null)),Wr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),Y=n((t,e,r,o)=>({[r]:e&&e.hasAttribute&&e.hasAttribute(Wr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||t.config&&t.config[r]||o}),"configSelector"),Ve=n(t=>({templates:t.templates||[]}),"templatesSelector")});var cs={};x(cs,{auth:()=>zn,authUrl:()=>Wn,autoshipByDefault:()=>ss,autoshipEligible:()=>Mn,config:()=>rs,default:()=>Yr,defaultFrequencies:()=>is,eligibilityGroups:()=>$n,environment:()=>es,firstOrderPlaceDate:()=>Zn,frequency:()=>sl,inStock:()=>Vn,incentives:()=>Hn,locale:()=>ts,merchantId:()=>Gn,nextUpcomingOrder:()=>jn,offer:()=>Yn,offerId:()=>Qn,optedin:()=>Fn,optedout:()=>Ln,previewStandardOffer:()=>os,previewUpsellOffer:()=>ns,productOffer:()=>Kn,productToSubscribe:()=>Xn,sessionId:()=>Jn,templates:()=>as});var Fn,Ln,jn,Mn,Vn,$n,Bn,Hn,sl,zn,Gn,Wn,Yn,Qn,Jn,Kn,Zn,Xn,es,ts,rs,os,ns,ss,is,as,Yr,Qr=p(()=>{vt();Ie();Q();se();Fn=n((t=[],e)=>{switch(e.type){case oe:return[];case me:return e.newValue?e.newValue.optedin:t;case ee:case re:let[[r],o]=t.reduce((s,i)=>s[q(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat(m(l(l({},r),e.payload.product),{frequency:e.payload.frequency}));case te:return t.filter(s=>!q(e.payload.product,s));case tt:return t.map(s=>q(e.payload.product,s)?l(l({},s),e.payload.newProduct):s);case It:return t.filter(s=>!q(e.payload.product,s));case qe:return[];default:return t}},"optedin"),Ln=n((t=[],e)=>{switch(e.type){case oe:return[];case me:return e.newValue?e.newValue.optedout:t;case ee:case re:return t.filter(s=>!q(e.payload.product,s));case te:let[[r],o]=t.reduce((s,i)=>s[q(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat(m(l(l({},r),e.payload.product),{frequency:e.payload.frequency}));case tt:return t.map(s=>q(e.payload.product,s)?l(l({},s),e.payload.newProduct):s);case qe:return[];default:return t}},"optedout"),jn=n((t={},{type:e,payload:r})=>{switch(e){case Pt:return r&&r.count>0?l(l({},t),r.results[0]&&m(l({},r.results[0]),{place:new Date(Date.parse(r.results[0].place.replace(/-/gi,"/")))})):t;case Rt:return m(l({},t),{products:(r.results||[]).map(o=>o.product)});case qt:return l(m(l(l({},t),r),{public_id:r.order}),r.product&&{products:(t.products||[]).concat(r.product)});default:return t}},"nextUpcomingOrder"),Mn=n((t={},e)=>{switch(e.type){case F:return l(l({},t),e.payload.autoship);default:return t}},"autoshipEligible"),Vn=n((t={},e)=>{switch(e.type){case F:return l(l({},t),e.payload.in_stock);default:return t}},"inStock"),$n=n((t={},e)=>{switch(e.type){case F:return l(l({},t),e.payload.eligibility_groups);default:return t}},"eligibilityGroups"),Bn=n((t,e)=>t.map(r=>m(l({},e[r]),{id:[r][0]})),"mapIncentive"),Hn=n((t={},e)=>{switch(e.type){case F:return l(l({},t),[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>m(l({},r),{[o]:Object.entries(e.payload.incentives).filter(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>m(l({},s),{initial:[...s.initial||[],...Bn(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...Bn(a,e.payload.incentives_display)]}),{})}),{}));default:return t}},"incentives"),sl=n((t={},e)=>{switch(e.type){case ee:case re:return m(l({},t),{[e.payload.product]:e.payload.frequency});case te:return m(l({},t),{[e.payload.product]:void 0});default:return t}},"frequency"),zn=n((t=!1,e)=>{switch(e.type){case Ct:return l({},e.payload);case ke:return!1;default:return t}},"auth"),Gn=n((t="",e)=>{switch(e.type){case wt:return e.payload;default:return t}},"merchantId"),Wn=n((t=null,e)=>{switch(e.type){case Tt:return e.payload;default:return t}},"authUrl"),Yn=n((t={},e)=>{switch(e.type){case F:return l(m(l({},t),{offerId:(e.payload.module_view||{}).regular}),e.payload.modifiers);default:return t}},"offer"),Qn=n((t="",e)=>{switch(e.type){case F:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Jn=n((t=null,e)=>{switch(e.type){case oe:return null;case Ot:return e.payload;default:return t}},"sessionId"),Kn=n((t={},e)=>{switch(e.type){case F:return l(l({},t),Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>l(l({},r),o)));case qe:return{};default:return t}},"productOffer"),Zn=n((t={},e)=>{switch(e.type){case jt:return m(l({},t),{[e.payload.product]:e.payload.firstOrderPlaceDate});default:return t}},"firstOrderPlaceDate"),Xn=n((t={},e)=>{switch(e.type){case Mt:return m(l({},t),{[e.payload.product]:e.payload.productToSubscribe});default:return t}},"productToSubscribe"),es=n((t={},e)=>{switch(e.type){case At:return m(l({},t),{name:"staging",apiUrl:"https://staging.om.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"});case Nt:return m(l({},t),{name:"dev",apiUrl:"https://dev.om.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"});case kt:return m(l({},t),{name:"prod",apiUrl:"https://om.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"});default:return t}},"environment"),ts=n((t={offerOptInLabel:"Subscribe and Save",offerIncentiveText:"Save {{ogIncentive DiscountPercent}} when you subscribe",offerOptOutLabel:"Deliver one-time only",offerEveryLabel:"Delivery Every",offerTooltipTrigger:"[?]",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"\u2022",optoutButtonLabel:"\u2022",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"\u2022",upsellButtonLabel:"Add item to order on ",upsellButtonPrefix:"",upsellModalContent:"Some upsell modal content",upsellModalOptInLabel:"Subscribe",upsellModalOptOutLabel:"Purchase one time",upsellModalTitle:"Impulse Upsell",upsellModalConfirmLabel:"Ok",upsellModalCancelLabel:"Cancel",defaultFrequencyCopy:"(Most Popular)",frequencyPeriods:{"1":"day","2":"week","3":"month"}},e)=>{switch(e.type){case Ut:return l(l({},t),e.payload);default:return t}},"locale"),rs=n((t={frequencies:["1_2","1_2","1_3"],offerType:"radio"},e)=>{switch(e.type){case Dt:return m(l(l({},t),e.payload),{defaultFrequency:e.payload.defaultFrequency?Me(e.payload.defaultFrequency):t.defaultFrequency,frequencies:e.payload.frequencies?e.payload.frequencies.map(Me):t.frequencies});default:return t}},"config"),os=n((t=!1,e)=>{switch(e.type){case rt:return e.payload;default:return t}},"previewStandardOffer"),ns=n((t=!1,e)=>{switch(e.type){case ot:return e.payload;default:return t}},"previewUpsellOffer"),ss=n((t=[],e)=>{switch(e.type){case F:return l(l({},t),e.payload.autoship_by_default);default:return t}},"autoshipByDefault"),is=n((t=[],e)=>{switch(e.type){case F:return l(l({},t),e.payload.default_frequencies);default:return t}},"defaultFrequencies"),as=n((t=[],e)=>{switch(e.type){case Lt:return[...e.payload||[]];case Ft:return[e.payload,...t];default:return t}},"templates"),Yr=Ko({environment:es,optedin:Fn,optedout:Ln,merchantId:Gn,offer:Yn,offerId:Qn,productOffer:Kn,sessionId:Jn,inStock:Vn,eligibilityGroups:$n,autoshipByDefault:ss,autoshipEligible:Mn,incentives:Hn,nextUpcomingOrder:jn,auth:zn,authUrl:Wn,locale:ts,config:rs,previewStandardOffer:os,previewUpsellOffer:ns,templates:as,defaultFrequencies:is,firstOrderPlaceDate:Zn,productToSubscribe:Xn})});var Jr=X((Yt,ls)=>{(function(t,e){typeof Yt=="object"&&typeof ls!="undefined"?e(Yt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(Yt,function(t){"use strict";function e(o,s,i,a){var c,u=!1,h=0;function _(){c&&clearTimeout(c)}n(_,"clearExistingTimeout");function f(){_(),u=!0}n(f,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function b(){for(var w=arguments.length,E=new Array(w),g=0;g<w;g++)E[g]=arguments[g];var P=this,R=Date.now()-h;if(u)return;function S(){h=Date.now(),i.apply(P,E)}n(S,"exec");function A(){c=void 0}n(A,"clear"),a&&!c&&S(),_(),a===void 0&&R>o?S():s!==!0&&(c=setTimeout(a?A:S,a===void 0?o-R:o))}return n(b,"wrapper"),b.cancel=f,b}n(e,"throttle");function r(o,s,i){return i===void 0?e(o,s,!1):e(o,i,s!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var us,il,al,cl,ll,ps,ds=p(()=>{us=/^og_auth=/,il=n((t=us)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(us,""),"s"),al=n(t=>{if(typeof t=="object")return t;let e=(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"i"),cl=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),ll=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"c"),ps=n((t,e=il,r=cl)=>Promise.resolve(e()||t&&typeof t=="string"&&fetch(t).then(o=>o.status>=200&&o.status<300?e()||(ll(o)?o.json():Promise.resolve(r(t)).then(e)):null)).then(al).then(o=>o===null?Promise.reject(new Error("Unauthorized")):o),"l")});var Es={};x(Es,{addTemplate:()=>yl,authorize:()=>Qt,checkout:()=>hl,concludeUpsell:()=>Zr,createIu:()=>to,createSessionId:()=>fs,fetchAuth:()=>dl,fetchDone:()=>at,fetchOffer:()=>eo,fetchOrders:()=>ct,fetchResponseError:()=>Zt,optinProduct:()=>J,optoutProduct:()=>_e,productChangeFrequency:()=>it,productHasChangedComponents:()=>Kr,receiveConvertOneTime:()=>xs,receiveCreateOneTime:()=>bs,receiveItems:()=>Kt,receiveOffer:()=>xe,receiveOrders:()=>Jt,requestAuth:()=>hs,requestConvertOneTimeToSubscription:()=>_s,requestCreateOneTime:()=>ys,requestOffer:()=>gs,requestOrders:()=>ms,requestSessionId:()=>Xr,setAuthUrl:()=>pl,setConfig:()=>gl,setEnvironment:()=>fl,setFirstOrderPlaceDate:()=>ro,setLocale:()=>ml,setMerchantId:()=>ul,setProductToSubscribe:()=>oo,setTemplates:()=>bl,unauthorized:()=>ae});var J,_e,Kr,it,Zr,ul,fs,hs,Qt,ae,pl,at,dl,ms,Jt,Kt,ct,fl,Xr,xe,Zt,gs,eo,hl,ys,bs,_s,xs,to,ml,gl,yl,bl,ro,oo,I=p(()=>{ds();Ie();se();J=n((t,e)=>({type:ee,payload:{product:t,frequency:e}}),"optinProduct"),_e=n(t=>({type:te,payload:{product:t}}),"optoutProduct"),Kr=n((t,e)=>({type:tt,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),it=n((t,e)=>({type:re,payload:{product:t,frequency:e}}),"productChangeFrequency"),Zr=n(t=>({type:fn,payload:{product:t}}),"concludeUpsell"),ul=n(t=>({type:wt,payload:t}),"setMerchantId"),fs=n(t=>({type:Ot,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),hs=n(t=>({type:un,payload:t}),"requestAuth"),Qt=n((t,e,r,o)=>({type:Ct,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),ae=n(t=>({type:ke,payload:t}),"unauthorized"),pl=n(t=>({type:Tt,payload:t}),"setAuthUrl"),at=n(t=>({type:gn,payload:t}),"fetchDone"),dl=n((t=ps)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(ae({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=hs(i);return r(a),t(i).then(({sig_field:c,ts:u,sig:h})=>r(Qt(s,c,u,h)),c=>r(ae(c))).finally(()=>r(at(a)))},"fetchAuthThunk"),"fetchAuth"),ms=n((t,e)=>({type:pn,payload:{status:t,ordering:e}}),"requestOrders"),Jt=n(t=>({type:Pt,payload:t}),"receiveOrders"),Kt=n(t=>({type:Rt,payload:t}),"receiveItems"),ct=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(ae("No auth set."));let c=ms(t,e);return o(c),ne.fetchOrders(i,a,t,e).then(u=>{o(Jt(u));let h=(u.results[0]||{}).public_id;return h?ne.fetchItems(i,a,h).then(_=>o(Kt(_))):null},u=>o(ae(u))).finally(()=>o(at(c)))},"fetchOrdersThunk"),"fetchOrders"),fl=n(t=>{switch(t){case"dev":return{type:Nt,payload:t};case"staging":return{type:At,payload:t};case"prod":return{type:kt,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Xr=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(fs(r)),o},"requestSessionId"),xe=n(t=>({type:F,payload:t}),"receiveOffer"),Zt=n(t=>({type:dn,payload:t}),"fetchResponseError"),gs=n((t,e="pdp")=>({type:ln,payload:{product:t,module:e}}),"requestOffer"),eo=n((t,e="pdp")=>n(function(o,s){let{merchantId:i,sessionId:a,environment:{apiUrl:c}}=s(),u=gs(t,e);return o(u),ne.fetchOffer(c,i,a,t,e).then(h=>o(xe(h)),h=>o(Zt(h))).finally(()=>o(at(u)))},"fetchOfferThunk"),"fetchOffer"),hl=n(()=>({type:qe}),"checkout"),ys=n((t,e,r,o)=>({type:hn,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),bs=n(t=>({type:qt,payload:t}),"receiveCreateOneTime"),_s=n((t,e)=>({type:mn,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),xs=n((t,e)=>({type:It,payload:{response:t,product:e}}),"receiveConvertOneTime"),to=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:u,environment:{legoUrl:h},previewUpsellOffer:_,offerId:f}=c();if(!u)return a(ae("No auth set."));let b=ys(t,e,r,f);return a(b),(_?Promise.resolve({legoUrl:h,product:t,order:e,quantity:r,offer:f}):ne.createOneTime(h,u,t.id,e,r,f)).then(w=>(a(bs(w)),o?(a(_s(w,s)),(_?Promise.resolve({item:w,frequency:s}):ne.convertOneTimeToSubscription(h,u,w,s,f)).then(E=>a(xs(E,t)),E=>a(Zt(E)))):w),w=>a(Zt(w))).finally(()=>a(at(b)))},"createIuThunk"),"createIu"),ml=n(t=>({type:Ut,payload:t}),"setLocale"),gl=n(t=>({type:Dt,payload:t}),"setConfig"),yl=n((t,e,r)=>({type:Ft,payload:{selector:t,markup:e,config:r}}),"addTemplate"),bl=n(t=>({type:Lt,payload:t}),"setTemplates"),ro=n((t,e)=>({type:jt,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),oo=n((t,e)=>({type:Mt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var ws={};x(ws,{STORE_ROOT:()=>Ee,clearState:()=>xl,listenLocalStorageChanges:()=>_l,loadState:()=>io,safeParseState:()=>no,saveState:()=>ao,serializeState:()=>vs});var Ss,Ee,no,so,io,vs,ao,_l,xl,Xt=p(()=>{Ss=Ae(Jr());I();Ie();Ee="OG_STATE",no=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch(e){return}},"safeParseState"),so=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),io=n(()=>so()?{}:no(localStorage.getItem(Ee)),"loadState"),vs=n(t=>!t||!t.sessionId?!1:JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),"serializeState"),ao=n(t=>{if(so())return;let e=vs(t);e&&localStorage.getItem(Ee)!==e&&localStorage.setItem(Ee,e)},"saveState"),_l=n(t=>(0,Ss.throttle)(500,e=>{if(so())return;let{key:r,newValue:o}=e;r===Ee&&o===null?(t.dispatch({type:oe}),setTimeout(()=>t.dispatch(Xr()),0)):r===Ee&&t.dispatch({type:me,newValue:no(o)})}),"listenLocalStorageChanges"),xl=n(()=>localStorage.removeItem(Ee),"clearState")});var Os,El,Ts,Sl,Cs,Ps,Rs=p(()=>{Os=Ae(Jr());Ie();Q();Xt();El=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),Ts=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>El("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),Sl=[{expressions:[({type:t}={})=>t===ee,({type:t}={})=>t===re],fn:Ts(!0)},{expressions:[({type:t}={})=>t===te],fn:Ts(!1)}],Cs=n(t=>e=>r=>{let o=t.getState();Sl.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),Ps=n(t=>e=>r=>{e(r);let o=(0,Os.throttle)(500,()=>{ao(l({},t.getState()))});r.type!==me&&o()},"localStorageMiddleware")});var Ns={};x(Ns,{default:()=>vl,getStore:()=>As});function As(){if(window.og&&window.og.store)return window.og.store;let t=window.og&&window.og.previewMode,e=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):Fr,r=[an,Cs];t||r.push(Ps);let o=e(tn(...r)),s=Dr(Yr,t?{}:io(),o);return window.og=window.og||{},window.og.store=s,s}var vl,ks=p(()=>{vt();cn();Qr();Xt();Rs();n(As,"getStore");vl=As});var Is={};x(Is,{default:()=>wl,getProductsForPurchasePost:()=>qs});var qs,wl,Us=p(()=>{se();qs=n((t={},e=[])=>(t.optedin||[]).map(r=>{let o={product:r.id,subscription_info:{components:r.components||[]},tracking_override:l({offer:((t.productOffer||{})[r.id]||[])[0]},je(r.frequency))};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[r.id]&&(o.subscription_info.first_order_place_date=t.firstOrderPlaceDate[r.id]),t.productToSubscribe&&t.productToSubscribe[r.id]&&(o.tracking_override.product=t.productToSubscribe[r.id]),o}).filter(r=>r.tracking_override.offer).filter(r=>e.length?e.includes(r.product):r),"getProductsForPurchasePost"),wl={getProductsForPurchasePost:qs}});var co,Se,ve=p(()=>{co=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,Se=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var L,lo,Ds,$e,we,Fs,lt,H,er,ce=p(()=>{L=`{{lit-${String(Math.random()).slice(2)}}}`,lo=`<!--${L}-->`,Ds=new RegExp(`${L}|${lo}`),$e="$lit$",we=class{constructor(e,r){this.parts=[],this.element=r;let o=[],s=[],i=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,u=0,{strings:h,values:{length:_}}=e;for(;u<_;){let f=i.nextNode();if(f===null){i.currentNode=s.pop();continue}if(c++,f.nodeType===1){if(f.hasAttributes()){let b=f.attributes,{length:w}=b,E=0;for(let g=0;g<w;g++)Fs(b[g].name,$e)&&E++;for(;E-- >0;){let g=h[u],P=er.exec(g)[2],R=P.toLowerCase()+$e,S=f.getAttribute(R);f.removeAttribute(R);let A=S.split(Ds);this.parts.push({type:"attribute",index:c,name:P,strings:A}),u+=A.length-1}}f.tagName==="TEMPLATE"&&(s.push(f),i.currentNode=f.content)}else if(f.nodeType===3){let b=f.data;if(b.indexOf(L)>=0){let w=f.parentNode,E=b.split(Ds),g=E.length-1;for(let P=0;P<g;P++){let R,S=E[P];if(S==="")R=H();else{let A=er.exec(S);A!==null&&Fs(A[2],$e)&&(S=S.slice(0,A.index)+A[1]+A[2].slice(0,-$e.length)+A[3]),R=document.createTextNode(S)}w.insertBefore(R,f),this.parts.push({type:"node",index:++c})}E[g]===""?(w.insertBefore(H(),f),o.push(f)):f.data=E[g],u+=g}}else if(f.nodeType===8)if(f.data===L){let b=f.parentNode;(f.previousSibling===null||c===a)&&(c++,b.insertBefore(H(),f)),a=c,this.parts.push({type:"node",index:c}),f.nextSibling===null?f.data="":(o.push(f),c--),u++}else{let b=-1;for(;(b=f.data.indexOf(L,b+1))!==-1;)this.parts.push({type:"node",index:-1}),u++}}for(let f of o)f.parentNode.removeChild(f)}};n(we,"Template");Fs=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),lt=n(t=>t.index!==-1,"isTemplatePartActive"),H=n(()=>document.createComment(""),"createMarker"),er=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function po(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,uo,null,!1),i=ut(o),a=o[i],c=-1,u=0,h=[],_=null;for(;s.nextNode();){c++;let f=s.currentNode;for(f.previousSibling===_&&(_=null),e.has(f)&&(h.push(f),_===null&&(_=f)),_!==null&&u++;a!==void 0&&a.index===c;)a.index=_!==null?-1:a.index-u,i=ut(o,i),a=o[i]}h.forEach(f=>f.parentNode.removeChild(f))}function Ls(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,uo,null,!1),a=ut(s),c=0,u=-1;for(;i.nextNode();)for(u++,i.currentNode===r&&(c=Ol(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===u;){if(c>0){for(;a!==-1;)s[a].index+=c,a=ut(s,a);return}a=ut(s,a)}}var uo,Ol,ut,js=p(()=>{ce();uo=133;n(po,"removeNodesFromTemplate");Ol=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,uo,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),ut=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(lt(o))return r}return-1},"nextActiveIndexInTemplateParts");n(Ls,"insertNodeIntoTemplate")});var Tl,Oe,fo=p(()=>{Tl=new WeakMap,Oe=n(t=>typeof t=="function"&&Tl.has(t),"isDirective")});var U,tr,ho=p(()=>{U={},tr={}});var le,rr=p(()=>{ve();ce();le=class{constructor(e,r,o){this.__parts=[],this.template=e,this.processor=r,this.options=o}update(e){let r=0;for(let o of this.__parts)o!==void 0&&o.setValue(e[r]),r++;for(let o of this.__parts)o!==void 0&&o.commit()}_clone(){let e=co?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,s=document.createTreeWalker(e,133,null,!1),i=0,a=0,c,u=s.nextNode();for(;i<o.length;){if(c=o[i],!lt(c)){this.__parts.push(void 0),i++;continue}for(;a<c.index;)a++,u.nodeName==="TEMPLATE"&&(r.push(u),s.currentNode=u.content),(u=s.nextNode())===null&&(s.currentNode=r.pop(),u=s.nextNode());if(c.type==="node"){let h=this.processor.handleTextExpression(this.options);h.insertAfterNode(u.previousSibling),this.__parts.push(h)}else this.__parts.push(...this.processor.handleAttributeExpressions(u,c.name,c.strings,this.options));i++}return co&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(le,"TemplateInstance")});var Ms,Pl,K,or=p(()=>{ve();ce();Ms=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),Pl=` ${L} `,K=class{constructor(e,r,o,s){this.strings=e,this.values=r,this.type=o,this.processor=s}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let s=0;s<e;s++){let i=this.strings[s],a=i.lastIndexOf("<!--");o=(a>-1||o)&&i.indexOf("-->",a+1)===-1;let c=er.exec(i);c===null?r+=i+(o?Pl:lo):r+=i.substr(0,c.index)+c[1]+c[2]+$e+c[3]+L}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Ms!==void 0&&(r=Ms.createHTML(r)),e.innerHTML=r,e}};n(K,"TemplateResult")});var nr,sr,Be,pt,Z,dt,ft,ir,Vs,ht,Rl,ar=p(()=>{fo();ve();ho();rr();or();ce();nr=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),sr=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Be=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let s=0;s<o.length-1;s++)this.parts[s]=this._createPart()}_createPart(){return new pt(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let i=o[0].value;if(typeof i=="symbol")return String(i);if(typeof i=="string"||!sr(i))return i}let s="";for(let i=0;i<r;i++){s+=e[i];let a=o[i];if(a!==void 0){let c=a.value;if(nr(c)||!sr(c))s+=typeof c=="string"?c:String(c);else for(let u of c)s+=typeof u=="string"?u:String(u)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Be,"AttributeCommitter");pt=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==U&&(!nr(e)||e!==this.value)&&(this.value=e,Oe(e)||(this.committer.dirty=!0))}commit(){for(;Oe(this.value);){let e=this.value;this.value=U,e(this)}this.value!==U&&this.committer.commit()}};n(pt,"AttributePart");Z=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(H()),this.endNode=e.appendChild(H())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=H()),e.__insert(this.endNode=H())}insertAfterPart(e){e.__insert(this.startNode=H()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;Oe(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=U,r(this)}let e=this.__pendingValue;e!==U&&(nr(e)?e!==this.value&&this.__commitText(e):e instanceof K?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):sr(e)?this.__commitIterable(e):e===tr?(this.value=tr,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){let r=this.startNode.nextSibling;e=e==null?"":e;let o=typeof e=="string"?e:String(e);r===this.endNode.previousSibling&&r.nodeType===3?r.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){let r=this.options.templateFactory(e);if(this.value instanceof le&&this.value.template===r)this.value.update(e.values);else{let o=new le(r,e.processor,this.options),s=o._clone();o.update(e.values),this.__commitNode(s),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,s;for(let i of e)s=r[o],s===void 0&&(s=new Z(this.options),r.push(s),o===0?s.appendIntoPart(this):s.insertAfterPart(r[o-1])),s.setValue(i),s.commit(),o++;o<r.length&&(r.length=o,this.clear(s&&s.endNode))}clear(e=this.startNode){Se(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(Z,"NodePart");dt=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;Oe(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=U,r(this)}if(this.__pendingValue===U)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=U}};n(dt,"BooleanAttributePart");ft=class extends Be{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new ir(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(ft,"PropertyCommitter");ir=class extends pt{};n(ir,"PropertyPart");Vs=!1;(()=>{try{let t={get capture(){return Vs=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();ht=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=s=>this.handleEvent(s)}setValue(e){this.__pendingValue=e}commit(){for(;Oe(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=U,i(this)}if(this.__pendingValue===U)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),s=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=Rl(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=U}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(ht,"EventPart");Rl=n(t=>t&&(Vs?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function mo(t){let e=Te.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},Te.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(L);return r=e.keyString.get(o),r===void 0&&(r=new we(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var Te,cr=p(()=>{ce();n(mo,"templateFactory");Te=new Map});var ue,go,yo=p(()=>{ve();ar();cr();ue=new WeakMap,go=n((t,e,r)=>{let o=ue.get(e);o===void 0&&(Se(e,e.firstChild),ue.set(e,o=new Z(Object.assign({templateFactory:mo},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var lr,bo,_o=p(()=>{ar();lr=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new ft(e,r.slice(1),o).parts:i==="@"?[new ht(e,r.slice(1),s.eventContext)]:i==="?"?[new dt(e,r.slice(1),o)]:new Be(e,r,o).parts}handleTextExpression(e){return new Z(e)}};n(lr,"DefaultTemplateProcessor");bo=new lr});var d,xo=p(()=>{_o();or();_o();fo();ve();ho();ar();yo();cr();rr();or();ce();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");d=n((t,...e)=>new K(t,e,"html",bo),"html")});var Bs,ur,Nl,kl,ql,Hs,Il,zs,Gs=p(()=>{ve();js();yo();cr();rr();ce();xo();Bs=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),ur=!0;typeof window.ShadyCSS=="undefined"?ur=!1:typeof window.ShadyCSS.prepareTemplateDom=="undefined"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),ur=!1);Nl=n(t=>e=>{let r=Bs(e.type,t),o=Te.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},Te.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(L);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();ur&&window.ShadyCSS.prepareTemplateDom(a,t),s=new we(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),kl=["html","svg"],ql=n(t=>{kl.forEach(e=>{let r=Te.get(Bs(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:s}}=o,i=new Set;Array.from(s.querySelectorAll("style")).forEach(a=>{i.add(a)}),po(o,i)})})},"removeStylesFromLitTemplates"),Hs=new Set,Il=n((t,e,r)=>{Hs.add(t);let o=r?r.element:document.createElement("template"),s=e.querySelectorAll("style"),{length:i}=s;if(i===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let h=0;h<i;h++){let _=s[h];_.parentNode.removeChild(_),a.textContent+=_.textContent}ql(t);let c=o.content;r?Ls(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let u=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&u!==null)e.insertBefore(u.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let h=new Set;h.add(a),po(r,h)}},"prepareTemplateStyles"),zs=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=ue.has(e),i=ur&&e.nodeType===11&&!!e.host,a=i&&!Hs.has(o),c=a?document.createDocumentFragment():e;if(go(t,c,Object.assign({templateFactory:Nl(o)},r)),a){let u=ue.get(c);ue.delete(c);let h=u.value instanceof le?u.value.template:void 0;Il(o,c,h),Se(e,e.firstChild),e.appendChild(c),ue.set(e,u)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var Ws,Eo,Ys,So,vo,wo,Oo,To,Co,mt,Po=p(()=>{window.JSCompiler_renameProperty=(t,e)=>t;Eo={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return t!==null;case Number:return t===null?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},Ys=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),So={attribute:!0,type:String,converter:Eo,reflect:!1,hasChanged:Ys},vo=1,wo=1<<2,Oo=1<<3,To=1<<4,Co="finalized",mt=class extends HTMLElement{constructor(){super();this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let s=this._attributeNameForProperty(o,r);s!==void 0&&(this._attributeToPropertyMap.set(s,o),e.push(s))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=So){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,s=this.getPropertyDescriptor(e,o,r);s!==void 0&&Object.defineProperty(this.prototype,e,s)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(s){let i=this[e];this[r]=s,this.requestUpdateInternal(e,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||So}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(Co)||e.finalize(),this[Co]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){let r=this.properties,o=[...Object.getOwnPropertyNames(r),...typeof Object.getOwnPropertySymbols=="function"?Object.getOwnPropertySymbols(r):[]];for(let s of o)this.createProperty(s,r[s])}}static _attributeNameForProperty(e,r){let o=r.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}static _valueHasChanged(e,r,o=Ys){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||Eo,i=typeof s=="function"?s:s.fromAttribute;return i?i(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,s=r.converter;return(s&&s.toAttribute||Eo.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,r)=>{if(this.hasOwnProperty(r)){let o=this[r];delete this[r],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(r,o)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,r)=>this[r]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){this._enableUpdatingResolver!==void 0&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,r,o){r!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,r,o=So){let s=this.constructor,i=s._attributeNameForProperty(e,o);if(i!==void 0){let a=s._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Oo,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~Oo}}_attributeToProperty(e,r){if(this._updateState&Oo)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|To,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~To}}requestUpdateInternal(e,r,o){let s=!0;if(e!==void 0){let i=this.constructor;o=o||i.getPropertyOptions(e),i._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&To)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):s=!1}!this._hasRequestedUpdate&&s&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|wo;try{await this._updatePromise}catch(r){}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&wo}get hasUpdated(){return this._updateState&vo}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1,r=this._changedProperties;try{e=this.shouldUpdate(r),e?this.update(r):this._markUpdated()}catch(o){throw e=!1,this._markUpdated(),o}e&&(this._updateState&vo||(this._updateState=this._updateState|vo,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~wo}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(mt,"UpdatingElement");Ws=Co;mt[Ws]=!0});var Qs,Td,Js=p(()=>{Qs=Element.prototype,Td=Qs.msMatchesSelector||Qs.webkitMatchesSelector});var pr,Ro,gt,Ks,Ul,C,Ao=p(()=>{pr=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ro=Symbol(),gt=class{constructor(e,r){if(r!==Ro)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(pr?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(gt,"CSSResult");Ks=n(t=>new gt(String(t),Ro),"unsafeCSS"),Ul=n(t=>{if(t instanceof gt)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
|
|
12
|
-
take care to ensure page security.`)},"textFromCSSResult"),
|
|
11
|
+
var lib=(()=>{var ci=Object.create;var xe=Object.defineProperty,li=Object.defineProperties,ui=Object.getOwnPropertyDescriptor,pi=Object.getOwnPropertyDescriptors,di=Object.getOwnPropertyNames,_o=Object.getOwnPropertySymbols,fi=Object.getPrototypeOf,xo=Object.prototype.hasOwnProperty,hi=Object.prototype.propertyIsEnumerable;var Eo=(t,e,r)=>e in t?xe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,l=(t,e)=>{for(var r in e||(e={}))xo.call(e,r)&&Eo(t,r,e[r]);if(_o)for(var r of _o(e))hi.call(e,r)&&Eo(t,r,e[r]);return t},h=(t,e)=>li(t,pi(e)),So=t=>xe(t,"__esModule",{value:!0}),n=(t,e)=>xe(t,"name",{value:e,configurable:!0}),ne=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var w=(t,e)=>()=>(t&&(e=t(t=0)),e);var se=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),or=(t,e)=>{So(t);for(var r in e)xe(t,r,{get:e[r],enumerable:!0})},mi=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of di(e))!xo.call(t,o)&&o!=="default"&&xe(t,o,{get:()=>e[o],enumerable:!(r=ui(e,o))||r.enumerable});return t},Ee=t=>mi(So(xe(t!=null?ci(fi(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var ie,ae,ce,at,Lo,D,Le,ct,lt,jo,ut,ve,Mo,pt,dt,Vo,ft,ht,mt,$o,Bo,gt,Ho,yt,we,zo,bt,_t,je,Me,xt,Et,le,Y,St,vt,wt,ue=w(()=>{ie="OPTIN_PRODUCT",ae="OPTOUT_PRODUCT",ce="PRODUCT_CHANGE_FREQUENCY",at="SET_MERCHANT_ID",Lo="REQUEST_OFFER",D="RECEIVE_OFFER",Le="PRODUCT_HAS_CHANGED",ct="CREATED_SESSION_ID",lt="SET_AUTH_URL",jo="REQUEST_AUTH",ut="AUTHORIZE",ve="UNAUTHORIZED",Mo="REQUEST_ORDERS",pt="RECEIVE_ORDERS",dt="RECEIVE_ORDER_ITEMS",Vo="FETCH_RESPONSE_ERROR",ft="SET_ENVIRONMENT_STAGING",ht="SET_ENVIRONMENT_DEV",mt="SET_ENVIRONMENT_PROD",$o="CONCLUDE_UPSELL",Bo="REQUEST_CREATE_IU_ORDER",gt="CREATE_ONE_TIME",Ho="REQUEST_CONVERT_ONE_TIME",yt="CONVERT_ONE_TIME",we="CHECKOUT",zo="RECEIVE_FETCH",bt="SET_LOCALE",_t="SET_CONFIG",je="SET_PREVIEW_STANDARD_OFFER",Me="SET_PREVIEW_UPSELL_OFFER",xt="ADD_TEMPLATE",Et="SET_TEMPLATES",le="LOCAL_STORAGE_CHANGE",Y="LOCAL_STORAGE_CLEAR",St="SET_FIRST_ORDER_PLACE_DATE",vt="SET_PRODUCT_TO_SUBSCRIBE",wt="RECEIVE_PRODUCT_PLANS"});var Ct=se((gl,Xo)=>{var Mi="Expected a function",Go="__lodash_hash_undefined__",Vi="[object Function]",$i="[object GeneratorFunction]",Bi=/[\\^$.*+?()[\]{}|]/g,Hi=/^\[object .+?Constructor\]$/,zi=typeof window=="object"&&window&&window.Object===Object&&window,Gi=typeof self=="object"&&self&&self.Object===Object&&self,Wo=zi||Gi||Function("return this")();function Wi(t,e){return t==null?void 0:t[e]}n(Wi,"getValue");function Yi(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch(r){}return e}n(Yi,"isHostObject");var Qi=Array.prototype,Ji=Function.prototype,Yo=Object.prototype,pr=Wo["__core-js_shared__"],Qo=function(){var t=/[^.]+$/.exec(pr&&pr.keys&&pr.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Jo=Ji.toString,dr=Yo.hasOwnProperty,Ki=Yo.toString,Zi=RegExp("^"+Jo.call(dr).replace(Bi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xi=Qi.splice,ea=Ko(Wo,"Map"),Ve=Ko(Object,"create");function pe(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(pe,"Hash");function ta(){this.__data__=Ve?Ve(null):{}}n(ta,"hashClear");function ra(t){return this.has(t)&&delete this.__data__[t]}n(ra,"hashDelete");function oa(t){var e=this.__data__;if(Ve){var r=e[t];return r===Go?void 0:r}return dr.call(e,t)?e[t]:void 0}n(oa,"hashGet");function na(t){var e=this.__data__;return Ve?e[t]!==void 0:dr.call(e,t)}n(na,"hashHas");function sa(t,e){var r=this.__data__;return r[t]=Ve&&e===void 0?Go:e,this}n(sa,"hashSet");pe.prototype.clear=ta;pe.prototype.delete=ra;pe.prototype.get=oa;pe.prototype.has=na;pe.prototype.set=sa;function Te(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(Te,"ListCache");function ia(){this.__data__=[]}n(ia,"listCacheClear");function aa(t){var e=this.__data__,r=Ot(e,t);if(r<0)return!1;var o=e.length-1;return r==o?e.pop():Xi.call(e,r,1),!0}n(aa,"listCacheDelete");function ca(t){var e=this.__data__,r=Ot(e,t);return r<0?void 0:e[r][1]}n(ca,"listCacheGet");function la(t){return Ot(this.__data__,t)>-1}n(la,"listCacheHas");function ua(t,e){var r=this.__data__,o=Ot(r,t);return o<0?r.push([t,e]):r[o][1]=e,this}n(ua,"listCacheSet");Te.prototype.clear=ia;Te.prototype.delete=aa;Te.prototype.get=ca;Te.prototype.has=la;Te.prototype.set=ua;function de(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var o=t[e];this.set(o[0],o[1])}}n(de,"MapCache");function pa(){this.__data__={hash:new pe,map:new(ea||Te),string:new pe}}n(pa,"mapCacheClear");function da(t){return Tt(this,t).delete(t)}n(da,"mapCacheDelete");function fa(t){return Tt(this,t).get(t)}n(fa,"mapCacheGet");function ha(t){return Tt(this,t).has(t)}n(ha,"mapCacheHas");function ma(t,e){return Tt(this,t).set(t,e),this}n(ma,"mapCacheSet");de.prototype.clear=pa;de.prototype.delete=da;de.prototype.get=fa;de.prototype.has=ha;de.prototype.set=ma;function Ot(t,e){for(var r=t.length;r--;)if(xa(t[r][0],e))return r;return-1}n(Ot,"assocIndexOf");function ga(t){if(!Zo(t)||ba(t))return!1;var e=Ea(t)||Yi(t)?Zi:Hi;return e.test(_a(t))}n(ga,"baseIsNative");function Tt(t,e){var r=t.__data__;return ya(e)?r[typeof e=="string"?"string":"hash"]:r.map}n(Tt,"getMapData");function Ko(t,e){var r=Wi(t,e);return ga(r)?r:void 0}n(Ko,"getNative");function ya(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}n(ya,"isKeyable");function ba(t){return!!Qo&&Qo in t}n(ba,"isMasked");function _a(t){if(t!=null){try{return Jo.call(t)}catch(e){}try{return t+""}catch(e){}}return""}n(_a,"toSource");function fr(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Mi);var r=n(function(){var o=arguments,s=e?e.apply(this,o):o[0],i=r.cache;if(i.has(s))return i.get(s);var a=t.apply(this,o);return r.cache=i.set(s,a),a},"memoized");return r.cache=new(fr.Cache||de),r}n(fr,"memoize");fr.Cache=de;function xa(t,e){return t===e||t!==t&&e!==e}n(xa,"eq");function Ea(t){var e=Zo(t)?Ki.call(t):"";return e==Vi||e==$i}n(Ea,"isFunction");function Zo(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}n(Zo,"isObject");Xo.exports=fr});var Pt,hr,$e,Be,Rt,en,tn,Sa,va,wa,Oa,Ta,He,mr,Ca,rn,ze,Pa,Q,J=w(()=>{Pt=Ee(Ct()),hr=n((...t)=>JSON.stringify(t),"memoizeKey"),$e=n(t=>(...e)=>fetch(...t(...e)).then(r=>r.json()),"withFetchJson"),Be=n(t=>(e,...r)=>{if(!e)throw Error("host required");let[o,s={}]=t(...r);return[`${e.replace(/\/+$/,"")}${o}`,s]},"withHost"),Rt=n(t=>(e,...r)=>{if(!e)throw Error("auth required");let[o,s={}]=t(...r);return[o,h(l({},s),{headers:l({Authorization:JSON.stringify(e)},s.headers)})]},"withAuth"),en=n(t=>(...e)=>{let[r,o={}]=t(...e);return[r,h(l({method:"POST"},o),{body:JSON.stringify(o.body),headers:l({"Content-type":"application/json"},o.headers)})]},"withJsonBody"),tn=n((t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([e,r])=>[e,encodeURIComponent(r)].join("=")).join("&"),"toQuery"),Sa=n(t=>JSON.stringify([].concat(t).map(e=>typeof e=="object"?e.id:e).filter(e=>e)),"toProductId"),va=(0,Pt.default)($e(Be((t,e,r,o="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");let s=tn([["session_id",e],["page_type",1],["p",Sa(r)],["module_view",JSON.stringify(["regular"])]]);return[`/offer/${t}/${o}?${s}`]})),hr),wa=(0,Pt.default)($e(Be(Rt((t=1,e="place")=>[`/orders/?${tn([["status",t],["ordering",e]])}`]))),hr),Oa=(0,Pt.default)($e(Be(Rt(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),hr),Ta=$e(Be(Rt(en((t,e,r,o)=>{if(!t)throw Error("product required");if(!e)throw Error("order required");if(!r)throw Error("quantity required");if(r<=0)throw Error("quantity must be greater or equal than one");if(!o)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:o}}]})))),He=n(t=>{if(typeof t=="object")return l({},t);let[e,r]=(t||"").split(/_/).map(o=>parseInt(o,10));return e&&r&&{every:e,every_period:r}},"parseFrequency"),mr=n(t=>t.match(/^\d+_\d$/),"isFrequencyValid"),Ca=n((t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),"compareFrequencies"),rn=n(t=>[...new Set(t&&t.split(/\s+/))].filter(mr).sort(Ca),"parseFrequenciesList"),ze=n(t=>{if(typeof t=="object"){let{every:e,period:r,every_period:o}=t;return`${e}_${r||o}`}return typeof t=="string"?t:""},"stringifyFrequency"),Pa=$e(Be(Rt(en((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");let o=He(e);if(!o)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:l({item:t.public_id,offer:r},o)}]})))),Q={fetchOffer:va,fetchOrders:wa,fetchItems:Oa,createOneTime:Ta,convertOneTimeToSubscription:Pa}});var _r=se((kt,ln)=>{(function(t,e){typeof kt=="object"&&typeof ln!="undefined"?e(kt):typeof define=="function"&&define.amd?define(["exports"],e):(t=t||self,e(t.throttleDebounce={}))})(kt,function(t){"use strict";function e(o,s,i,a){var c,u=!1,f=0;function b(){c&&clearTimeout(c)}n(b,"clearExistingTimeout");function d(){b(),u=!0}n(d,"cancel"),typeof s!="boolean"&&(a=i,i=s,s=void 0);function y(){for(var v=arguments.length,_=new Array(v),m=0;m<v;m++)_[m]=arguments[m];var C=this,P=Date.now()-f;if(u)return;function x(){f=Date.now(),i.apply(C,_)}n(x,"exec");function A(){c=void 0}n(A,"clear"),a&&!c&&x(),b(),a===void 0&&P>o?x():s!==!0&&(c=setTimeout(a?A:x,a===void 0?o-P:o))}return n(y,"wrapper"),y.cancel=d,y}n(e,"throttle");function r(o,s,i){return i===void 0?e(o,s,!1):e(o,i,s!==!1)}n(r,"debounce"),t.debounce=r,t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})})});var un,tc,rc,oc,nc,pn,dn=w(()=>{un=/^og_auth=/,tc=n((t=un)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(un,""),"s"),rc=n(t=>{if(typeof t=="object")return t;let e=(t||"").split("|");return e.length===3?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},"i"),oc=n(t=>new Promise((e,r)=>{let o=document.createElement("iframe");o.style.setProperty("display","none","important"),document.body.appendChild(o),o.onload=e,o.onerror=r,o.src=t}),"p"),nc=n(t=>(t.headers.get("content-type")||"").indexOf("application/json")!==-1,"c"),pn=n((t,e=tc,r=oc)=>Promise.resolve(e()||t&&typeof t=="string"&&fetch(t).then(o=>o.status>=200&&o.status<300?e()||(nc(o)?o.json():Promise.resolve(r(t)).then(e)):null)).then(rc).then(o=>o===null?Promise.reject(new Error("Unauthorized")):o),"l")});var K,Pe,fn,It,hn,mn,sc,ic,xr,Z,gn,qt,yn,ac,Er,Sr,Ut,vr,Dt,Re,wr,cc,bn,_n,lc,uc,pc,dc,xn,En,Sn,vn,wn,On,Tn,I=w(()=>{dn();ue();J();K=n((t,e)=>({type:ie,payload:{product:t,frequency:e}}),"optinProduct"),Pe=n(t=>({type:ae,payload:{product:t}}),"optoutProduct"),fn=n((t,e)=>({type:Le,payload:{newProduct:t,product:e}}),"productHasChangedComponents"),It=n((t,e)=>({type:ce,payload:{product:t,frequency:e}}),"productChangeFrequency"),hn=n(t=>({type:$o,payload:{product:t}}),"concludeUpsell"),mn=n(t=>({type:at,payload:t}),"setMerchantId"),sc=n(t=>({type:ct,payload:`${t}.${Math.floor(Math.random()*999999)}.${Math.round(new Date().getTime()/1e3)}`}),"createSessionId"),ic=n(t=>({type:jo,payload:t}),"requestAuth"),xr=n((t,e,r,o)=>({type:ut,payload:{public_id:t,sig_field:e,ts:r,sig:o}}),"authorize"),Z=n(t=>({type:ve,payload:t}),"unauthorized"),gn=n(t=>({type:lt,payload:t}),"setAuthUrl"),qt=n(t=>({type:zo,payload:t}),"fetchDone"),yn=n((t=pn)=>n(function(r,o){if(window.og&&window.og.previewMode)return r(Z({message:"Offers are running in preview mode"}));let{merchantId:s,authUrl:i}=o(),a=ic(i);return r(a),t(i).then(({sig_field:c,ts:u,sig:f})=>r(xr(s,c,u,f)),c=>r(Z(c))).finally(()=>r(qt(a)))},"fetchAuthThunk"),"fetchAuth"),ac=n((t,e)=>({type:Mo,payload:{status:t,ordering:e}}),"requestOrders"),Er=n(t=>({type:pt,payload:t}),"receiveOrders"),Sr=n(t=>({type:dt,payload:t}),"receiveItems"),Ut=n((t=1,e="place")=>n(function(o,s){let{environment:{legoUrl:i},auth:a}=s();if(!a)return o(Z("No auth set."));let c=ac(t,e);return o(c),Q.fetchOrders(i,a,t,e).then(u=>{if(u.results){o(Er(u));let f=(u.results[0]||{}).public_id;if(f)return Q.fetchItems(i,a,f).then(b=>o(Sr(b)))}return o(Z(u.detail)),null},u=>o(Z(u))).finally(()=>o(qt(c)))},"fetchOrdersThunk"),"fetchOrders"),vr=n(t=>{switch(t){case"dev":return{type:ht,payload:t};case"staging":return{type:ft,payload:t};case"prod":return{type:mt,payload:t};default:throw new Error(`${t} is not a supported environment`)}},"setEnvironment"),Dt=n(()=>(t,e)=>{let{merchantId:r,sessionId:o}=e();return(!o||r&&!o.startsWith(r))&&t(sc(r)),o},"requestSessionId"),Re=n(t=>({type:D,payload:t}),"receiveOffer"),wr=n(t=>({type:Vo,payload:t}),"fetchResponseError"),cc=n((t,e="pdp")=>({type:Lo,payload:{product:t,module:e}}),"requestOffer"),bn=n((t,e="pdp")=>n(function(o,s){let{merchantId:i,sessionId:a,environment:{apiUrl:c}}=s(),u=cc(t,e);return o(u),Q.fetchOffer(c,i,a,t,e).then(f=>o(Re(f)),f=>o(wr(f))).finally(()=>o(qt(u)))},"fetchOfferThunk"),"fetchOffer"),_n=n(()=>({type:we}),"checkout"),lc=n((t,e,r,o)=>({type:Bo,payload:{product:t,order:e,quantity:r,offerId:o}}),"requestCreateOneTime"),uc=n(t=>({type:gt,payload:t}),"receiveCreateOneTime"),pc=n((t,e)=>({type:Ho,payload:{item:t,frequency:e}}),"requestConvertOneTimeToSubscription"),dc=n((t,e)=>({type:yt,payload:{response:t,product:e}}),"receiveConvertOneTime"),xn=n((t,e,r,o=!1,s=null)=>n(function(a,c){let{auth:u,environment:{legoUrl:f},previewUpsellOffer:b,offerId:d}=c();if(!u)return a(Z("No auth set."));let y=lc(t,e,r,d);return a(y),(b?Promise.resolve({legoUrl:f,product:t,order:e,quantity:r,offer:d}):Q.createOneTime(f,u,t.id,e,r,d)).then(v=>(a(uc(v)),o?(a(pc(v,s)),(b?Promise.resolve({item:v,frequency:s}):Q.convertOneTimeToSubscription(f,u,v,s,d)).then(_=>a(dc(_,t)),_=>a(wr(_)))):v),v=>a(wr(v))).finally(()=>a(qt(y)))},"createIuThunk"),"createIu"),En=n(t=>({type:bt,payload:t}),"setLocale"),Sn=n(t=>({type:_t,payload:t}),"setConfig"),vn=n((t,e,r)=>({type:xt,payload:{selector:t,markup:e,config:r}}),"addTemplate"),wn=n(t=>({type:Et,payload:t}),"setTemplates"),On=n((t,e)=>({type:St,payload:{product:t,firstOrderPlaceDate:e}}),"setFirstOrderPlaceDate"),Tn=n((t,e)=>({type:vt,payload:{product:t,productToSubscribe:e}}),"setProductToSubscribe")});var Cr,he,me=w(()=>{Cr=typeof window!="undefined"&&window.customElements!=null&&window.customElements.polyfillWrapFlushCallback!==void 0,he=n((t,e,r=null)=>{for(;e!==r;){let o=e.nextSibling;t.removeChild(e),e=o}},"removeNodes")});var F,Pr,Fn,Ae,ge,Ln,We,$,Ft,X=w(()=>{F=`{{lit-${String(Math.random()).slice(2)}}}`,Pr=`<!--${F}-->`,Fn=new RegExp(`${F}|${Pr}`),Ae="$lit$",ge=class{constructor(e,r){this.parts=[],this.element=r;let o=[],s=[],i=document.createTreeWalker(r.content,133,null,!1),a=0,c=-1,u=0,{strings:f,values:{length:b}}=e;for(;u<b;){let d=i.nextNode();if(d===null){i.currentNode=s.pop();continue}if(c++,d.nodeType===1){if(d.hasAttributes()){let y=d.attributes,{length:v}=y,_=0;for(let m=0;m<v;m++)Ln(y[m].name,Ae)&&_++;for(;_-- >0;){let m=f[u],C=Ft.exec(m)[2],P=C.toLowerCase()+Ae,x=d.getAttribute(P);d.removeAttribute(P);let A=x.split(Fn);this.parts.push({type:"attribute",index:c,name:C,strings:A}),u+=A.length-1}}d.tagName==="TEMPLATE"&&(s.push(d),i.currentNode=d.content)}else if(d.nodeType===3){let y=d.data;if(y.indexOf(F)>=0){let v=d.parentNode,_=y.split(Fn),m=_.length-1;for(let C=0;C<m;C++){let P,x=_[C];if(x==="")P=$();else{let A=Ft.exec(x);A!==null&&Ln(A[2],Ae)&&(x=x.slice(0,A.index)+A[1]+A[2].slice(0,-Ae.length)+A[3]),P=document.createTextNode(x)}v.insertBefore(P,d),this.parts.push({type:"node",index:++c})}_[m]===""?(v.insertBefore($(),d),o.push(d)):d.data=_[m],u+=m}}else if(d.nodeType===8)if(d.data===F){let y=d.parentNode;(d.previousSibling===null||c===a)&&(c++,y.insertBefore($(),d)),a=c,this.parts.push({type:"node",index:c}),d.nextSibling===null?d.data="":(o.push(d),c--),u++}else{let y=-1;for(;(y=d.data.indexOf(F,y+1))!==-1;)this.parts.push({type:"node",index:-1}),u++}}for(let d of o)d.parentNode.removeChild(d)}};n(ge,"Template");Ln=n((t,e)=>{let r=t.length-e.length;return r>=0&&t.slice(r)===e},"endsWith"),We=n(t=>t.index!==-1,"isTemplatePartActive"),$=n(()=>document.createComment(""),"createMarker"),Ft=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/});function Ar(t,e){let{element:{content:r},parts:o}=t,s=document.createTreeWalker(r,Rr,null,!1),i=Ye(o),a=o[i],c=-1,u=0,f=[],b=null;for(;s.nextNode();){c++;let d=s.currentNode;for(d.previousSibling===b&&(b=null),e.has(d)&&(f.push(d),b===null&&(b=d)),b!==null&&u++;a!==void 0&&a.index===c;)a.index=b!==null?-1:a.index-u,i=Ye(o,i),a=o[i]}f.forEach(d=>d.parentNode.removeChild(d))}function jn(t,e,r=null){let{element:{content:o},parts:s}=t;if(r==null){o.appendChild(e);return}let i=document.createTreeWalker(o,Rr,null,!1),a=Ye(s),c=0,u=-1;for(;i.nextNode();)for(u++,i.currentNode===r&&(c=gc(e),r.parentNode.insertBefore(e,r));a!==-1&&s[a].index===u;){if(c>0){for(;a!==-1;)s[a].index+=c,a=Ye(s,a);return}a=Ye(s,a)}}var Rr,gc,Ye,Mn=w(()=>{X();Rr=133;n(Ar,"removeNodesFromTemplate");gc=n(t=>{let e=t.nodeType===11?0:1,r=document.createTreeWalker(t,Rr,null,!1);for(;r.nextNode();)e++;return e},"countNodes"),Ye=n((t,e=-1)=>{for(let r=e+1;r<t.length;r++){let o=t[r];if(We(o))return r}return-1},"nextActiveIndexInTemplateParts");n(jn,"insertNodeIntoTemplate")});var yc,ye,Nr=w(()=>{yc=new WeakMap,ye=n(t=>typeof t=="function"&&yc.has(t),"isDirective")});var q,Lt,kr=w(()=>{q={},Lt={}});var ee,jt=w(()=>{me();X();ee=class{constructor(e,r,o){this.__parts=[],this.template=e,this.processor=r,this.options=o}update(e){let r=0;for(let o of this.__parts)o!==void 0&&o.setValue(e[r]),r++;for(let o of this.__parts)o!==void 0&&o.commit()}_clone(){let e=Cr?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),r=[],o=this.template.parts,s=document.createTreeWalker(e,133,null,!1),i=0,a=0,c,u=s.nextNode();for(;i<o.length;){if(c=o[i],!We(c)){this.__parts.push(void 0),i++;continue}for(;a<c.index;)a++,u.nodeName==="TEMPLATE"&&(r.push(u),s.currentNode=u.content),(u=s.nextNode())===null&&(s.currentNode=r.pop(),u=s.nextNode());if(c.type==="node"){let f=this.processor.handleTextExpression(this.options);f.insertAfterNode(u.previousSibling),this.__parts.push(f)}else this.__parts.push(...this.processor.handleAttributeExpressions(u,c.name,c.strings,this.options));i++}return Cr&&(document.adoptNode(e),customElements.upgrade(e)),e}};n(ee,"TemplateInstance")});var Vn,_c,z,Mt=w(()=>{me();X();Vn=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),_c=` ${F} `,z=class{constructor(e,r,o,s){this.strings=e,this.values=r,this.type=o,this.processor=s}getHTML(){let e=this.strings.length-1,r="",o=!1;for(let s=0;s<e;s++){let i=this.strings[s],a=i.lastIndexOf("<!--");o=(a>-1||o)&&i.indexOf("-->",a+1)===-1;let c=Ft.exec(i);c===null?r+=i+(o?_c:Pr):r+=i.substr(0,c.index)+c[1]+c[2]+Ae+c[3]+F}return r+=this.strings[e],r}getTemplateElement(){let e=document.createElement("template"),r=this.getHTML();return Vn!==void 0&&(r=Vn.createHTML(r)),e.innerHTML=r,e}};n(z,"TemplateResult")});var Vt,$t,Ne,Qe,G,Je,Ke,Bt,$n,Ze,xc,Ht=w(()=>{Nr();me();kr();jt();Mt();X();Vt=n(t=>t===null||!(typeof t=="object"||typeof t=="function"),"isPrimitive"),$t=n(t=>Array.isArray(t)||!!(t&&t[Symbol.iterator]),"isIterable"),Ne=class{constructor(e,r,o){this.dirty=!0,this.element=e,this.name=r,this.strings=o,this.parts=[];for(let s=0;s<o.length-1;s++)this.parts[s]=this._createPart()}_createPart(){return new Qe(this)}_getValue(){let e=this.strings,r=e.length-1,o=this.parts;if(r===1&&e[0]===""&&e[1]===""){let i=o[0].value;if(typeof i=="symbol")return String(i);if(typeof i=="string"||!$t(i))return i}let s="";for(let i=0;i<r;i++){s+=e[i];let a=o[i];if(a!==void 0){let c=a.value;if(Vt(c)||!$t(c))s+=typeof c=="string"?c:String(c);else for(let u of c)s+=typeof u=="string"?u:String(u)}}return s+=e[r],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}};n(Ne,"AttributeCommitter");Qe=class{constructor(e){this.value=void 0,this.committer=e}setValue(e){e!==q&&(!Vt(e)||e!==this.value)&&(this.value=e,ye(e)||(this.committer.dirty=!0))}commit(){for(;ye(this.value);){let e=this.value;this.value=q,e(this)}this.value!==q&&this.committer.commit()}};n(Qe,"AttributePart");G=class{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild($()),this.endNode=e.appendChild($())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=$()),e.__insert(this.endNode=$())}insertAfterPart(e){e.__insert(this.startNode=$()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(this.startNode.parentNode===null)return;for(;ye(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=q,r(this)}let e=this.__pendingValue;e!==q&&(Vt(e)?e!==this.value&&this.__commitText(e):e instanceof z?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):$t(e)?this.__commitIterable(e):e===Lt?(this.value=Lt,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){let r=this.startNode.nextSibling;e=e==null?"":e;let o=typeof e=="string"?e:String(e);r===this.endNode.previousSibling&&r.nodeType===3?r.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){let r=this.options.templateFactory(e);if(this.value instanceof ee&&this.value.template===r)this.value.update(e.values);else{let o=new ee(r,e.processor,this.options),s=o._clone();o.update(e.values),this.__commitNode(s),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());let r=this.value,o=0,s;for(let i of e)s=r[o],s===void 0&&(s=new G(this.options),r.push(s),o===0?s.appendIntoPart(this):s.insertAfterPart(r[o-1])),s.setValue(i),s.commit(),o++;o<r.length&&(r.length=o,this.clear(s&&s.endNode))}clear(e=this.startNode){he(this.startNode.parentNode,e.nextSibling,this.endNode)}};n(G,"NodePart");Je=class{constructor(e,r,o){if(this.value=void 0,this.__pendingValue=void 0,o.length!==2||o[0]!==""||o[1]!=="")throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=r,this.strings=o}setValue(e){this.__pendingValue=e}commit(){for(;ye(this.__pendingValue);){let r=this.__pendingValue;this.__pendingValue=q,r(this)}if(this.__pendingValue===q)return;let e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=q}};n(Je,"BooleanAttributePart");Ke=class extends Ne{constructor(e,r,o){super(e,r,o);this.single=o.length===2&&o[0]===""&&o[1]===""}_createPart(){return new Bt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}};n(Ke,"PropertyCommitter");Bt=class extends Qe{};n(Bt,"PropertyPart");$n=!1;(()=>{try{let t={get capture(){return $n=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();Ze=class{constructor(e,r,o){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=r,this.eventContext=o,this.__boundHandleEvent=s=>this.handleEvent(s)}setValue(e){this.__pendingValue=e}commit(){for(;ye(this.__pendingValue);){let i=this.__pendingValue;this.__pendingValue=q,i(this)}if(this.__pendingValue===q)return;let e=this.__pendingValue,r=this.value,o=e==null||r!=null&&(e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive),s=e!=null&&(r==null||o);o&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=xc(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=q}handleEvent(e){typeof this.value=="function"?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}};n(Ze,"EventPart");xc=n(t=>t&&($n?{capture:t.capture,passive:t.passive,once:t.once}:t.capture),"getOptions")});function Ir(t){let e=be.get(t.type);e===void 0&&(e={stringsArray:new WeakMap,keyString:new Map},be.set(t.type,e));let r=e.stringsArray.get(t.strings);if(r!==void 0)return r;let o=t.strings.join(F);return r=e.keyString.get(o),r===void 0&&(r=new ge(t,t.getTemplateElement()),e.keyString.set(o,r)),e.stringsArray.set(t.strings,r),r}var be,zt=w(()=>{X();n(Ir,"templateFactory");be=new Map});var te,qr,Ur=w(()=>{me();Ht();zt();te=new WeakMap,qr=n((t,e,r)=>{let o=te.get(e);o===void 0&&(he(e,e.firstChild),te.set(e,o=new G(Object.assign({templateFactory:Ir},r))),o.appendInto(e)),o.setValue(t),o.commit()},"render")});var Gt,Dr,Fr=w(()=>{Ht();Gt=class{handleAttributeExpressions(e,r,o,s){let i=r[0];return i==="."?new Ke(e,r.slice(1),o).parts:i==="@"?[new Ze(e,r.slice(1),s.eventContext)]:i==="?"?[new Je(e,r.slice(1),o)]:new Ne(e,r,o).parts}handleTextExpression(e){return new G(e)}};n(Gt,"DefaultTemplateProcessor");Dr=new Gt});var p,Lr=w(()=>{Fr();Mt();Fr();Nr();me();kr();Ht();Ur();zt();jt();Mt();X();typeof window!="undefined"&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0");p=n((t,...e)=>new z(t,e,"html",Dr),"html")});var Hn,Wt,Sc,vc,wc,zn,Oc,Gn,Wn=w(()=>{me();Mn();Ur();zt();jt();X();Lr();Hn=n((t,e)=>`${t}--${e}`,"getTemplateCacheKey"),Wt=!0;typeof window.ShadyCSS=="undefined"?Wt=!1:typeof window.ShadyCSS.prepareTemplateDom=="undefined"&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Wt=!1);Sc=n(t=>e=>{let r=Hn(e.type,t),o=be.get(r);o===void 0&&(o={stringsArray:new WeakMap,keyString:new Map},be.set(r,o));let s=o.stringsArray.get(e.strings);if(s!==void 0)return s;let i=e.strings.join(F);if(s=o.keyString.get(i),s===void 0){let a=e.getTemplateElement();Wt&&window.ShadyCSS.prepareTemplateDom(a,t),s=new ge(e,a),o.keyString.set(i,s)}return o.stringsArray.set(e.strings,s),s},"shadyTemplateFactory"),vc=["html","svg"],wc=n(t=>{vc.forEach(e=>{let r=be.get(Hn(e,t));r!==void 0&&r.keyString.forEach(o=>{let{element:{content:s}}=o,i=new Set;Array.from(s.querySelectorAll("style")).forEach(a=>{i.add(a)}),Ar(o,i)})})},"removeStylesFromLitTemplates"),zn=new Set,Oc=n((t,e,r)=>{zn.add(t);let o=r?r.element:document.createElement("template"),s=e.querySelectorAll("style"),{length:i}=s;if(i===0){window.ShadyCSS.prepareTemplateStyles(o,t);return}let a=document.createElement("style");for(let f=0;f<i;f++){let b=s[f];b.parentNode.removeChild(b),a.textContent+=b.textContent}wc(t);let c=o.content;r?jn(r,a,c.firstChild):c.insertBefore(a,c.firstChild),window.ShadyCSS.prepareTemplateStyles(o,t);let u=c.querySelector("style");if(window.ShadyCSS.nativeShadow&&u!==null)e.insertBefore(u.cloneNode(!0),e.firstChild);else if(r){c.insertBefore(a,c.firstChild);let f=new Set;f.add(a),Ar(r,f)}},"prepareTemplateStyles"),Gn=n((t,e,r)=>{if(!r||typeof r!="object"||!r.scopeName)throw new Error("The `scopeName` option is required.");let o=r.scopeName,s=te.has(e),i=Wt&&e.nodeType===11&&!!e.host,a=i&&!zn.has(o),c=a?document.createDocumentFragment():e;if(qr(t,c,Object.assign({templateFactory:Sc(o)},r)),a){let u=te.get(c);te.delete(c);let f=u.value instanceof ee?u.value.template:void 0;Oc(o,c,f),he(e,e.firstChild),e.appendChild(c),te.set(e,u)}!s&&i&&window.ShadyCSS.styleElement(e.host)},"render")});var Yn,jr,Qn,Mr,Vr,$r,Br,Hr,zr,Xe,Gr=w(()=>{window.JSCompiler_renameProperty=(t,e)=>t;jr={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return t!==null;case Number:return t===null?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},Qn=n((t,e)=>e!==t&&(e===e||t===t),"notEqual"),Mr={attribute:!0,type:String,converter:jr,reflect:!1,hasChanged:Qn},Vr=1,$r=1<<2,Br=1<<3,Hr=1<<4,zr="finalized",Xe=class extends HTMLElement{constructor(){super();this.initialize()}static get observedAttributes(){this.finalize();let e=[];return this._classProperties.forEach((r,o)=>{let s=this._attributeNameForProperty(o,r);s!==void 0&&(this._attributeToPropertyMap.set(s,o),e.push(s))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;let e=Object.getPrototypeOf(this)._classProperties;e!==void 0&&e.forEach((r,o)=>this._classProperties.set(o,r))}}static createProperty(e,r=Mr){if(this._ensureClassProperties(),this._classProperties.set(e,r),r.noAccessor||this.prototype.hasOwnProperty(e))return;let o=typeof e=="symbol"?Symbol():`__${e}`,s=this.getPropertyDescriptor(e,o,r);s!==void 0&&Object.defineProperty(this.prototype,e,s)}static getPropertyDescriptor(e,r,o){return{get(){return this[r]},set(s){let i=this[e];this[r]=s,this.requestUpdateInternal(e,i,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||Mr}static finalize(){let e=Object.getPrototypeOf(this);if(e.hasOwnProperty(zr)||e.finalize(),this[zr]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){let r=this.properties,o=[...Object.getOwnPropertyNames(r),...typeof Object.getOwnPropertySymbols=="function"?Object.getOwnPropertySymbols(r):[]];for(let s of o)this.createProperty(s,r[s])}}static _attributeNameForProperty(e,r){let o=r.attribute;return o===!1?void 0:typeof o=="string"?o:typeof e=="string"?e.toLowerCase():void 0}static _valueHasChanged(e,r,o=Qn){return o(e,r)}static _propertyValueFromAttribute(e,r){let o=r.type,s=r.converter||jr,i=typeof s=="function"?s:s.fromAttribute;return i?i(e,o):e}static _propertyValueToAttribute(e,r){if(r.reflect===void 0)return;let o=r.type,s=r.converter;return(s&&s.toAttribute||jr.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,r)=>{if(this.hasOwnProperty(r)){let o=this[r];delete this[r],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(r,o)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,r)=>this[r]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){this._enableUpdatingResolver!==void 0&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,r,o){r!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,r,o=Mr){let s=this.constructor,i=s._attributeNameForProperty(e,o);if(i!==void 0){let a=s._propertyValueToAttribute(r,o);if(a===void 0)return;this._updateState=this._updateState|Br,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._updateState=this._updateState&~Br}}_attributeToProperty(e,r){if(this._updateState&Br)return;let o=this.constructor,s=o._attributeToPropertyMap.get(e);if(s!==void 0){let i=o.getPropertyOptions(s);this._updateState=this._updateState|Hr,this[s]=o._propertyValueFromAttribute(r,i),this._updateState=this._updateState&~Hr}}requestUpdateInternal(e,r,o){let s=!0;if(e!==void 0){let i=this.constructor;o=o||i.getPropertyOptions(e),i._valueHasChanged(this[e],r,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,r),o.reflect===!0&&!(this._updateState&Hr)&&(this._reflectingProperties===void 0&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):s=!1}!this._hasRequestedUpdate&&s&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,r){return this.requestUpdateInternal(e,r),this.updateComplete}async _enqueueUpdate(){this._updateState=this._updateState|$r;try{await this._updatePromise}catch(r){}let e=this.performUpdate();return e!=null&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return this._updateState&$r}get hasUpdated(){return this._updateState&Vr}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1,r=this._changedProperties;try{e=this.shouldUpdate(r),e?this.update(r):this._markUpdated()}catch(o){throw e=!1,this._markUpdated(),o}e&&(this._updateState&Vr||(this._updateState=this._updateState|Vr,this.firstUpdated(r)),this.updated(r))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~$r}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){this._reflectingProperties!==void 0&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((r,o)=>this._propertyToAttribute(o,this[o],r)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}};n(Xe,"UpdatingElement");Yn=zr;Xe[Yn]=!0});var Jn,Hu,Kn=w(()=>{Jn=Element.prototype,Hu=Jn.msMatchesSelector||Jn.webkitMatchesSelector});var Yt,Wr,et,Zn,Tc,T,Yr=w(()=>{Yt=window.ShadowRoot&&(window.ShadyCSS===void 0||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Wr=Symbol(),et=class{constructor(e,r){if(r!==Wr)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return this._styleSheet===void 0&&(Yt?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}};n(et,"CSSResult");Zn=n(t=>new et(String(t),Wr),"unsafeCSS"),Tc=n(t=>{if(t instanceof et)return t.cssText;if(typeof t=="number")return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but
|
|
12
|
+
take care to ensure page security.`)},"textFromCSSResult"),T=n((t,...e)=>{let r=e.reduce((o,s,i)=>o+Tc(s)+t[i+1],t[0]);return new et(r,Wr)},"css")});var Xn,S,O=w(()=>{Wn();Gr();Gr();Kn();Lr();Yr();Yr();(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");Xn={},S=class extends Xe{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;let e=this.getStyles();if(Array.isArray(e)){let r=n((i,a)=>i.reduceRight((c,u)=>Array.isArray(u)?r(u,c):(c.add(u),c),a),"addStyles"),o=r(e,new Set),s=[];o.forEach(i=>s.unshift(i)),this._styles=s}else this._styles=e===void 0?[]:[e];this._styles=this._styles.map(r=>{if(r instanceof CSSStyleSheet&&!Yt){let o=Array.prototype.slice.call(r.cssRules).reduce((s,i)=>s+i.cssText,"");return Zn(o)}return r})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){let e=this.constructor._styles;e.length!==0&&(window.ShadyCSS!==void 0&&!window.ShadyCSS.nativeShadow?window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(r=>r.cssText),this.localName):Yt?this.renderRoot.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):this._needsShimAdoptedStyleSheets=!0)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&window.ShadyCSS!==void 0&&window.ShadyCSS.styleElement(this)}update(e){let r=this.render();super.update(e),r!==Xn&&this.constructor.render(r,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(o=>{let s=document.createElement("style");s.textContent=o.cssText,this.renderRoot.appendChild(s)}))}render(){return Xn}};n(S,"LitElement");S.finalized=!0;S.render=Gn});var Qt=se((tp,es)=>{var Cc={PAR_OPEN:"(".charCodeAt(0),PAR_CLOSE:")".charCodeAt(0),OP_NOT:"!".charCodeAt(0),BINARY_AND:"&".charCodeAt(0),BINARY_OR:"|".charCodeAt(0),LITERAL:"LITERAL",END:"END",LEAF:"LEAF",ATOMIC:"ATOMIC"};es.exports=Cc});var rs=se((rp,ts)=>{var _e=Qt(),Pc=n(t=>{let e="",r=[];for(let o of t){let s=o.charCodeAt(0);switch(s){case _e.PAR_OPEN:case _e.PAR_CLOSE:case _e.OP_NOT:case _e.BINARY_AND:case _e.BINARY_OR:e&&(r.push({type:_e.LITERAL,value:e}),e=""),r.push({type:s,value:o});break;default:e+=o}}return e&&r.push({type:_e.LITERAL,value:e}),r},"Tokenizer");ts.exports=Pc});var ns=se((op,os)=>{var re=Qt(),Rc=n(t=>{let e=[],r=[];return t.forEach(s=>{switch(s.type){case re.LITERAL:e.unshift(s);break;case re.BINARY_AND:case re.BINARY_OR:case re.OP_NOT:case re.PAR_OPEN:r.push(s);break;case re.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==re.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===re.OP_NOT&&e.unshift(r.pop());break;default:break}}),r.length&&[...r.reverse(),...e]||e},"PolishNotation"),Ac=n(function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]},"PolishGenerator");os.exports={PolishNotation:Rc,PolishGenerator:Ac}});var is=se((np,ss)=>{var U=Qt(),j=class{constructor(e,r,o,s){this.op=e,this.left=r,this.right=o,this.literal=s}isLeaf(){return this.op===U.LEAF}isAtomic(){return this.isLeaf()||this.op===U.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(e,r){return new j(U.BINARY_AND,e,r)}static CreateNot(e){return new j(U.OP_NOT,e)}static CreateOr(e,r){return new j(U.BINARY_OR,e,r)}static CreateLiteral(e){return new j(U.LEAF,null,null,e)}};n(j,"ExpNode");var ke=n(t=>{let e=t.next().value;switch(e.type){case U.LITERAL:return j.CreateLiteral(e.value);case U.OP_NOT:return j.CreateNot(ke(t));case U.BINARY_AND:{let r=ke(t),o=ke(t);return j.CreateAnd(r,o)}case U.BINARY_OR:{let r=ke(t),o=ke(t);return j.CreateOr(r,o)}}return null},"make"),Ie=n((t,e)=>{if(t.isLeaf())return e(t.getLiteralValue());if(t.op===U.OP_NOT)return!Ie(t.left,e);if(t.op===U.BINARY_OR)return Ie(t.left,e)||Ie(t.right,e);if(t.op===U.BINARY_AND)return Ie(t.left,e)&&Ie(t.right,e)},"nodeEvaluator");ss.exports={make:ke,nodeEvaluator:Ie}});var us=se((sp,ls)=>{var Nc=rs(),as=ns(),cs=is(),kc=n((t,e)=>{let r=Nc(t),o=as.PolishNotation(r),s=as.PolishGenerator(o),i=cs.make(s);return cs.nodeEvaluator(i,e)},"parse");ls.exports={parse:kc}});var Vs={};or(Vs,{TestWizard:()=>rr,default:()=>Xc});var rr,Xc,$s=w(()=>{O();I();rr=class extends S{static get styles(){return T`
|
|
13
|
+
:host {
|
|
14
|
+
position: fixed;
|
|
15
|
+
top: 5em;
|
|
16
|
+
right: 5em;
|
|
17
|
+
background-color: rgba(255, 255, 255, 0.7);
|
|
18
|
+
width: 400px;
|
|
19
|
+
padding: 1em;
|
|
20
|
+
border-radius: 5px;
|
|
21
|
+
border: 1px solid #ccc;
|
|
22
|
+
box-shadow: 2px 2px 0 0 #000;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
button {
|
|
26
|
+
margin: 0 0.5em 0.5em;
|
|
27
|
+
background-color: gray;
|
|
28
|
+
color: white;
|
|
29
|
+
border: 0;
|
|
30
|
+
border-radius: 3px;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
padding: 0.5em;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
button.primary {
|
|
36
|
+
background-color: blue;
|
|
37
|
+
padding: 1em;
|
|
38
|
+
color: white;
|
|
39
|
+
border: 0;
|
|
40
|
+
border-radius: 3px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
button[disabled] {
|
|
44
|
+
background-color: #777;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
div {
|
|
48
|
+
margin-bottom: 0.5em;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.message {
|
|
52
|
+
margin-left: 0.5em;
|
|
53
|
+
margin: 1em;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.success {
|
|
57
|
+
color: green;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.error {
|
|
61
|
+
color: red;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.warning {
|
|
65
|
+
color: orange;
|
|
66
|
+
}
|
|
67
|
+
a {
|
|
68
|
+
color: white;
|
|
69
|
+
}
|
|
70
|
+
`}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),s=r.getAttribute("product"),i=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(s,i).concat(this.getOfferRequestMessages(s,o)),product:s};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],s=r.autoshipEligible[e],i=[];return e&&o===!1&&i.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&s===!1&&i.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&s===null&&i.push({name:"This product does not exist in our database",type:"error"}),i}resultsCodeBlock(){return this.results.length===0?p`
|
|
71
|
+
<div class="message error">No offer element found on the page</div>
|
|
72
|
+
`:this.results.map((e,r)=>p`
|
|
73
|
+
<div>For offer tag with product = "${e.product}"</div>
|
|
74
|
+
${e.messages.map(o=>p`
|
|
75
|
+
<div class="message ${o.type}">
|
|
76
|
+
${o.name}
|
|
77
|
+
</div>
|
|
78
|
+
`)}
|
|
79
|
+
<button @click=${this.toggleProductFlags(r,{})}>
|
|
80
|
+
Set inStock and eligible
|
|
81
|
+
</button>
|
|
82
|
+
<br />
|
|
83
|
+
<button @click=${this.toggleProductFlags(r,{inStock:!1})}>
|
|
84
|
+
Set to not inStock
|
|
85
|
+
</button>
|
|
86
|
+
<br />
|
|
87
|
+
<button @click=${this.toggleProductFlags(r,{autoship:!1})}>
|
|
88
|
+
Set to not eligible
|
|
89
|
+
</button>
|
|
90
|
+
<br />
|
|
91
|
+
<button @click=${this.toggleProductFlags(r,{autoship:!1,inStock:!1})}>
|
|
92
|
+
Set to not eligible and not in stock
|
|
93
|
+
</button>
|
|
94
|
+
<br />
|
|
95
|
+
<button @click=${this.toggleUpsellPreview(r)}>
|
|
96
|
+
Toggle upsell/regular in this offer
|
|
97
|
+
</button>
|
|
98
|
+
<br />
|
|
99
|
+
<button @click=${this.toggleUpsellNextOrder(r)}>
|
|
100
|
+
upsell product is in next order
|
|
101
|
+
</button>
|
|
102
|
+
<br />
|
|
103
|
+
`)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:s=["subscription","upsell"]}){return i=>{i.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(Re({in_stock:{[c]:r},eligibility_groups:{[c]:s},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],s=o.product.id;r.preventDefault(),o.store.dispatch(Sr({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:s,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return p`
|
|
104
|
+
<div>
|
|
105
|
+
${this.testsRan?this.resultsCodeBlock():p`
|
|
106
|
+
<div>Click the button to run tests</div>
|
|
107
|
+
`}
|
|
108
|
+
<button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
|
|
109
|
+
</div>
|
|
110
|
+
`}};n(rr,"TestWizard");Xc=rr});var ol={};or(ol,{addOptinChangedCallback:()=>Ks,addTemplate:()=>oi,clear:()=>Js,config:()=>ti,default:()=>rl,disableOptinChangedCallbacks:()=>Zs,getOptins:()=>Qs,getProductsForPurchasePost:()=>Ys,initialize:()=>bo,offers:()=>E,previewMode:()=>ei,register:()=>Xs,resolveSettings:()=>ii,setAuthUrl:()=>Ws,setEnvironment:()=>zs,setLocale:()=>ri,setMerchantId:()=>Gs,setPublicPath:()=>si,setTemplates:()=>ni});var gi=Object.create,De=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,bi=Object.getOwnPropertyNames,vo=Object.getOwnPropertySymbols,_i=Object.getPrototypeOf,wo=Object.prototype.hasOwnProperty,xi=Object.prototype.propertyIsEnumerable,Oo=n((t,e,r)=>e in t?De(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"d"),Ei=n((t,e)=>{for(var r in e||(e={}))wo.call(e,r)&&Oo(t,r,e[r]);if(vo)for(var r of vo(e))xi.call(e,r)&&Oo(t,r,e[r]);return t},"c"),Si=n(t=>De(t,"__esModule",{value:!0}),"E"),st=n((t,e)=>De(t,"name",{value:e,configurable:!0}),"r"),vi=(t=>typeof ne!="undefined"?ne:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof ne!="undefined"?ne:e)[r]}):t)(function(t){if(typeof ne!="undefined")return ne.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')}),wi=n((t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of bi(e))!wo.call(t,o)&&o!=="default"&&De(t,o,{get:()=>e[o],enumerable:!(r=yi(e,o))||r.enumerable});return t},"x"),Oi=n(t=>wi(Si(De(t!=null?gi(_i(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),"v"),Ti=st(t=>e=>t.indexOf(e.origin)>=0,"createIsMessageAllowed"),To=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],Co=st(t=>(e,r)=>{To.forEach(o=>t.postMessage(Ei({ogType:e},r),o))},"createBroadcastMessage");function nr(t){let e=Ti(To),r=Co(t.source);e(t)&&t.data.ogType==="READY"&&Promise.resolve().then(()=>Oi(vi("//static.ordergroove.com/@ordergroove/offers-live-editor/0.4.1/dist/client.js"))).then(({initializeClient:o})=>{o(e,r),window.removeEventListener("message",nr)})}n(nr,"f");st(nr,"handleReady");function sr(t=window.opener){t&&t!==window&&(window.addEventListener("message",nr),Co(t)("READY"))}n(sr,"I");st(sr,"offersLiveEditor");function ir(t){var e,r=t.Symbol;return typeof r=="function"?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}n(ir,"symbolObservablePonyfill");var Se;typeof self!="undefined"?Se=self:typeof window!="undefined"||typeof window!="undefined"?Se=window:typeof module!="undefined"?Se=module:Se=Function("return this")();var Ci=ir(Se),ar=Ci;var cr=n(function(){return Math.random().toString(36).substring(7).split("").join(".")},"randomString"),Fe={INIT:"@@redux/INIT"+cr(),REPLACE:"@@redux/REPLACE"+cr(),PROBE_UNKNOWN_ACTION:n(function(){return"@@redux/PROBE_UNKNOWN_ACTION"+cr()},"PROBE_UNKNOWN_ACTION")};function Pi(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}n(Pi,"isPlainObject");function lr(t,e,r){var o;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if(typeof e=="function"&&typeof r=="undefined"&&(r=e,e=void 0),typeof r!="undefined"){if(typeof r!="function")throw new Error("Expected the enhancer to be a function.");return r(lr)(t,e)}if(typeof t!="function")throw new Error("Expected the reducer to be a function.");var s=t,i=e,a=[],c=a,u=!1;function f(){c===a&&(c=a.slice())}n(f,"ensureCanMutateNextListeners");function b(){if(u)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}n(b,"getState");function d(m){if(typeof m!="function")throw new Error("Expected the listener to be a function.");if(u)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var C=!0;return f(),c.push(m),n(function(){if(!!C){if(u)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");C=!1,f();var x=c.indexOf(m);c.splice(x,1),a=null}},"unsubscribe")}n(d,"subscribe");function y(m){if(!Pi(m))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof m.type=="undefined")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(u)throw new Error("Reducers may not dispatch actions.");try{u=!0,i=s(i,m)}finally{u=!1}for(var C=a=c,P=0;P<C.length;P++){var x=C[P];x()}return m}n(y,"dispatch");function v(m){if(typeof m!="function")throw new Error("Expected the nextReducer to be a function.");s=m,y({type:Fe.REPLACE})}n(v,"replaceReducer");function _(){var m,C=d;return m={subscribe:n(function(x){if(typeof x!="object"||x===null)throw new TypeError("Expected the observer to be an object.");function A(){x.next&&x.next(b())}n(A,"observeState"),A();var ai=C(A);return{unsubscribe:ai}},"subscribe")},m[ar]=function(){return this},m}return n(_,"observable"),y({type:Fe.INIT}),o={dispatch:y,subscribe:d,getState:b,replaceReducer:v},o[ar]=_,o}n(lr,"createStore");function Ri(t,e){var r=e&&e.type,o=r&&'action "'+String(r)+'"'||"an action";return"Given "+o+', reducer "'+t+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}n(Ri,"getUndefinedStateErrorMessage");function Ai(t){Object.keys(t).forEach(function(e){var r=t[e],o=r(void 0,{type:Fe.INIT});if(typeof o=="undefined")throw new Error('Reducer "'+e+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:Fe.PROBE_UNKNOWN_ACTION()})=="undefined")throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+Fe.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}n(Ai,"assertReducerShape");function Po(t){for(var e=Object.keys(t),r={},o=0;o<e.length;o++){var s=e[o];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,c;try{Ai(r)}catch(u){c=u}return n(function(f,b){if(f===void 0&&(f={}),c)throw c;if(!1)var d;for(var y=!1,v={},_=0;_<i.length;_++){var m=i[_],C=r[m],P=f[m],x=C(P,b);if(typeof x=="undefined"){var A=Ri(m,b);throw new Error(A)}v[m]=x,y=y||x!==P}return y=y||i.length!==Object.keys(f).length,y?v:f},"combination")}n(Po,"combineReducers");function Ro(t,e){return function(){return e(t.apply(this,arguments))}}n(Ro,"bindActionCreator");function Ao(t,e){if(typeof t=="function")return Ro(t,e);if(typeof t!="object"||t===null)throw new Error("bindActionCreators expected an object or a function, instead received "+(t===null?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var o in t){var s=t[o];typeof s=="function"&&(r[o]=Ro(s,e))}return r}n(Ao,"bindActionCreators");function Ni(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}n(Ni,"_defineProperty");function No(t,e){var r=Object.keys(t);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(t)),e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r}n(No,"ownKeys");function ki(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?No(r,!0).forEach(function(o){Ni(t,o,r[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):No(r).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(r,o))})}return t}n(ki,"_objectSpread2");function ur(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(o){return o}:e.length===1?e[0]:e.reduce(function(o,s){return function(){return o(s.apply(void 0,arguments))}})}n(ur,"compose");function ko(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(o){return function(){var s=o.apply(void 0,arguments),i=n(function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},"dispatch"),a={getState:s.getState,dispatch:n(function(){return i.apply(void 0,arguments)},"dispatch")},c=e.map(function(u){return u(a)});return i=ur.apply(void 0,c)(s.dispatch),ki({},s,{dispatch:i})}}}n(ko,"applyMiddleware");var it=null,Ii=n(t=>({dispatch:t}),"defaultMapDispatchToProps"),Io=n(t=>{if(!it)throw new Error("Missing redux store.");return it},"resolveStore"),qi=n((t,e)=>r=>{let{getState:o,dispatch:s}=Io(r),i=t?t(o(),r):{},a=e(s,r);Object.assign(r,i,a)},"createRecalcProps"),g=n((t,e=Ii)=>r=>{let s=qi(t,typeof e=="function"?e:i=>Ao(e,i));return class extends r{get store(){return it}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=Io(this).subscribe(()=>s(this)),s(this)}attributeChangedCallback(i,a,c){super.attributeChangedCallback&&super.attributeChangedCallback(i,a,c),this._storeUnsubscribe&&a!==c&&s(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},"connect"),qo=n(t=>{it=t},"setStore");function Uo(t){var e=n(function(o){var s=o.dispatch,i=o.getState;return function(a){return function(c){return typeof c=="function"?c(s,i,t):a(c)}}},"middleware");return e}n(Uo,"createThunkMiddleware");var Do=Uo();Do.withExtraArgument=Uo;var Fo=Do;ue();function Ui(t,e){return t===e}n(Ui,"defaultEqualityCheck");function Di(t,e,r){if(e===null||r===null||e.length!==r.length)return!1;for(var o=e.length,s=0;s<o;s++)if(!t(e[s],r[s]))return!1;return!0}n(Di,"areArgumentsShallowlyEqual");function Fi(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ui,r=null,o=null;return function(){return Di(e,r,arguments)||(o=t.apply(null,arguments)),r=arguments,o}}n(Fi,"defaultMemoize");function Li(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every(function(o){return typeof o=="function"})){var r=e.map(function(o){return typeof o}).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, "+("instead received the following types: ["+r+"]"))}return e}n(Li,"getDependencies");function ji(t){for(var e=arguments.length,r=Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return function(){for(var s=arguments.length,i=Array(s),a=0;a<s;a++)i[a]=arguments[a];var c=0,u=i.pop(),f=Li(i),b=t.apply(void 0,[function(){return c++,u.apply(null,arguments)}].concat(r)),d=t(function(){for(var y=[],v=f.length,_=0;_<v;_++)y.push(f[_].apply(null,arguments));return b.apply(null,y)});return d.resultFunc=u,d.dependencies=f,d.recomputations=function(){return c},d.resetRecomputations=function(){return c=0},d}}n(ji,"createSelectorCreator");var Oe=ji(Fi);var fe=Ee(Ct());J();fe.default.Cache=Map;function Ra(t,e){if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}n(Ra,"arraysEqual");var N=n((t,e)=>!!(t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&t.id===e.id&&(!(Array.isArray(t.components)&&Array.isArray(e.components))||Ra((t.components||[]).sort(),(e.components||[]).sort()))),"isSameProduct"),At=n(t=>t.optedin||[],"optedinSelector"),on=n(t=>t.optedout||[],"optedoutSelector"),gr=n(t=>t.autoshipByDefault||{},"autoshipSelector"),Aa=n(t=>t.defaultFrequencies||{},"defaultFrequenciesSelector"),B=(0,fe.default)(t=>Oe(At,on,gr,(e,r,o)=>{let s=e.find(i=>N(t,i));return s||(r.find(i=>N(t,i))?!1:t&&o[t.id]?{id:t.id}:!1)}),t=>JSON.stringify(t)),nn=(0,fe.default)(t=>Oe(At,e=>{let r=e.find(o=>N(t,o));return r||!1}),t=>JSON.stringify(t)),sn=(0,fe.default)(t=>Oe(on,e=>e.find(r=>N(t,r))));var V=(0,fe.default)(t=>Oe(B(t),e=>e&&e.frequency||null)),Nt=(0,fe.default)(t=>Oe(Aa,e=>e[t]&&ze(e[t])||null)),yr=n(t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),"kebabCase"),H=n((t,e,r,o)=>({[r]:e&&e.hasAttribute&&e.hasAttribute(yr(r))&&e[r]||e.offer&&typeof(e.offer[r]!=="undefined")&&e.offer[r]||t.config&&t.config[r]||o}),"configSelector"),Ce=n(t=>({templates:t.templates||[]}),"templatesSelector");J();var Na=n((t=[],e)=>{switch(e.type){case Y:return[];case le:return e.newValue?e.newValue.optedin:t;case ie:case ce:let[[r],o]=t.reduce((s,i)=>s[N(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat(h(l(l({},r),e.payload.product),{frequency:e.payload.frequency}));case ae:return t.filter(s=>!N(e.payload.product,s));case Le:return t.map(s=>N(e.payload.product,s)?l(l({},s),e.payload.newProduct):s);case yt:return t.filter(s=>!N(e.payload.product,s));case we:return[];default:return t}},"optedin"),ka=n((t=[],e)=>{switch(e.type){case Y:return[];case le:return e.newValue?e.newValue.optedout:t;case ie:case ce:return t.filter(s=>!N(e.payload.product,s));case ae:let[[r],o]=t.reduce((s,i)=>s[N(e.payload.product,i)?0:1].push(i)&&s,[[],[]]);return(o||[]).concat(h(l(l({},r),e.payload.product),{frequency:e.payload.frequency}));case Le:return t.map(s=>N(e.payload.product,s)?l(l({},s),e.payload.newProduct):s);case we:return[];default:return t}},"optedout"),Ia=n((t={},{type:e,payload:r})=>{switch(e){case pt:return r&&r.count>0?l(l({},t),r.results[0]&&h(l({},r.results[0]),{place:new Date(Date.parse(r.results[0].place.replace(/-/gi,"/")))})):t;case dt:return h(l({},t),{products:(r.results||[]).map(o=>o.product)});case gt:return l(h(l(l({},t),r),{public_id:r.order}),r.product&&{products:(t.products||[]).concat(r.product)});default:return t}},"nextUpcomingOrder"),qa=n((t={},e)=>{switch(e.type){case D:return l(l({},t),e.payload.autoship);default:return t}},"autoshipEligible"),Ua=n((t={},e)=>{switch(e.type){case D:return l(l({},t),e.payload.in_stock);default:return t}},"inStock"),Da=n((t={},e)=>{switch(e.type){case D:return l(l({},t),e.payload.eligibility_groups);default:return t}},"eligibilityGroups"),an=n((t,e)=>t.map(r=>h(l({},e[r]),{id:[r][0]})),"mapIncentive"),Fa=n((t={},e)=>{switch(e.type){case D:return l(l({},t),[...new Set(Object.keys(e.payload.incentives||{}))].reduce((r,o)=>h(l({},r),{[o]:Object.entries(e.payload.incentives).filter(([s])=>s===o).reduce((s,[,{initial:i,ongoing:a}])=>h(l({},s),{initial:[...s.initial||[],...an(i,e.payload.incentives_display)],ongoing:[...s.ongoing||[],...an(a,e.payload.incentives_display)]}),{})}),{}));default:return t}},"incentives");var La=n((t=!1,e)=>{switch(e.type){case ut:return l({},e.payload);case ve:return!1;default:return t}},"auth"),ja=n((t="",e)=>{switch(e.type){case at:return e.payload;default:return t}},"merchantId"),Ma=n((t=null,e)=>{switch(e.type){case lt:return e.payload;default:return t}},"authUrl"),Va=n((t={},e)=>{switch(e.type){case D:return l(h(l({},t),{offerId:(e.payload.module_view||{}).regular}),e.payload.modifiers);default:return t}},"offer"),$a=n((t="",e)=>{switch(e.type){case D:return(e.payload.module_view||{}).regular||"";default:return t}},"offerId"),Ba=n((t=null,e)=>{switch(e.type){case Y:return null;case ct:return e.payload;default:return t}},"sessionId"),Ha=n((t={},e)=>{switch(e.type){case D:return l(l({},t),Object.entries(e.payload.autoship).map(([r])=>({[r]:Object.keys(e.payload.modifiers)})).reduce((r,o)=>l(l({},r),o)));case we:return{};default:return t}},"productOffer"),za=n((t={},e)=>{switch(e.type){case St:return h(l({},t),{[e.payload.product]:e.payload.firstOrderPlaceDate});default:return t}},"firstOrderPlaceDate"),Ga=n((t={},e)=>{switch(e.type){case vt:return h(l({},t),{[e.payload.product]:e.payload.productToSubscribe});default:return t}},"productToSubscribe"),br=n((t={},e)=>{switch(e.type){case ft:return h(l({},t),{name:"staging",apiUrl:"https://staging.om.ordergroove.com",legoUrl:"https://staging.restapi.ordergroove.com"});case ht:return h(l({},t),{name:"dev",apiUrl:"https://dev.om.ordergroove.com",legoUrl:"https://dev.restapi.ordergroove.com"});case mt:return h(l({},t),{name:"prod",apiUrl:"https://om.ordergroove.com",legoUrl:"https://restapi.ordergroove.com"});default:return t}},"environment"),Wa=n((t={offerOptInLabel:"Subscribe and Save",offerIncentiveText:"Save {{ogIncentive DiscountPercent}} when you subscribe",offerOptOutLabel:"Deliver one-time only",offerEveryLabel:"Delivery Every",offerTooltipTrigger:"[?]",offerTooltipContent:"Seems this is a great subscription offering. Many fun details about this program exist.",optinButtonLabel:"\u2022",optoutButtonLabel:"\u2022",optinStatusOptedInLabel:"You're opted in!",optinStatusOptedOutLabel:"You're not opted in.",optinToggleLabel:"\u2022",upsellButtonLabel:"Add item to order on ",upsellButtonPrefix:"",upsellModalContent:"Some upsell modal content",upsellModalOptInLabel:"Subscribe",upsellModalOptOutLabel:"Purchase one time",upsellModalTitle:"Impulse Upsell",upsellModalConfirmLabel:"Ok",upsellModalCancelLabel:"Cancel",defaultFrequencyCopy:"(Most Popular)",frequencyPeriods:{"1":"day","2":"week","3":"month"}},e)=>{switch(e.type){case bt:return l(l({},t),e.payload);default:return t}},"locale"),Ya=n((t={frequencies:["1_2","1_2","1_3"],offerType:"radio"},e)=>{switch(e.type){case _t:return h(l(l({},t),e.payload),{defaultFrequency:e.payload.defaultFrequency?ze(e.payload.defaultFrequency):t.defaultFrequency,frequencies:e.payload.frequencies?e.payload.frequencies.map(ze):t.frequencies});default:return t}},"config"),Qa=n((t=!1,e)=>{switch(e.type){case je:return e.payload;default:return t}},"previewStandardOffer"),Ja=n((t=!1,e)=>{switch(e.type){case Me:return e.payload;default:return t}},"previewUpsellOffer"),Ka=n((t=[],e)=>{switch(e.type){case D:return l(l({},t),e.payload.autoship_by_default);default:return t}},"autoshipByDefault"),Za=n((t=[],e)=>{switch(e.type){case D:return l(l({},t),e.payload.default_frequencies);default:return t}},"defaultFrequencies"),Xa=n((t=[],e)=>{switch(e.type){case Et:return[...e.payload||[]];case xt:return[e.payload,...t];default:return t}},"templates"),ec=n((t={},e)=>{switch(e.type){case wt:return l({},e.payload);default:return t}},"productPlans"),cn=Po({productPlans:ec,environment:br,optedin:Na,optedout:ka,merchantId:ja,offer:Va,offerId:$a,productOffer:Ha,sessionId:Ba,inStock:Ua,eligibilityGroups:Da,autoshipByDefault:Ka,autoshipEligible:qa,incentives:Fa,nextUpcomingOrder:Ia,auth:La,authUrl:Ma,locale:Wa,config:Ya,previewStandardOffer:Qa,previewUpsellOffer:Ja,templates:Xa,defaultFrequencies:Za,firstOrderPlaceDate:za,productToSubscribe:Ga});var Cn=Ee(_r());I();ue();var Ge="OG_STATE",Pn=n(t=>{try{return t===null?void 0:JSON.parse(t)}catch(e){return}},"safeParseState"),Or=n(()=>window.og&&window.og.previewMode,"isPreviewMode"),Rn=n(()=>Or()?{}:Pn(localStorage.getItem(Ge)),"loadState"),fc=n(t=>!t||!t.sessionId?!1:JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),"serializeState"),An=n(t=>{if(Or())return;let e=fc(t);e&&localStorage.getItem(Ge)!==e&&localStorage.setItem(Ge,e)},"saveState"),Nn=n(t=>(0,Cn.throttle)(500,e=>{if(Or())return;let{key:r,newValue:o}=e;r===Ge&&o===null?(t.dispatch({type:Y}),setTimeout(()=>t.dispatch(Dt()),0)):r===Ge&&t.dispatch({type:le,newValue:Pn(o)})}),"listenLocalStorageChanges");var kn=Ee(_r());ue();var hc=n((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})),"dispatchEvent"),In=n(t=>({payload:{product:{id:e,components:r}={}}={}}={})=>setTimeout(()=>hc("optin-changed",{productId:e,components:r,optedIn:t}),0),"dispatchOptinChangedEvent"),mc=[{expressions:[({type:t}={})=>t===ie,({type:t}={})=>t===ce],fn:In(!0)},{expressions:[({type:t}={})=>t===ae],fn:In(!1)}],qn=n(t=>e=>r=>{let o=t.getState();mc.forEach(s=>{s.expressions.some(i=>i(r,o))&&s.fn(r)}),e(r)},"dispatchMiddleware"),Un=n(t=>e=>r=>{e(r);let o=(0,kn.throttle)(500,()=>{An(l({},t.getState()))});r.type!==le&&o()},"localStorageMiddleware");function Dn(){if(window.og&&window.og.store)return window.og.store;let t=window.og&&window.og.previewMode,e=typeof window=="object"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}):ur,r=[Fo,qn];t||r.push(Un);let o=e(ko(...r)),s=lr(cn,t?{}:Rn(),o);return window.og=window.og||{},window.og.store=s,s}n(Dn,"getStore");J();var Tr=n((t={},e=[])=>(t.optedin||[]).map(r=>{let o={product:r.id,subscription_info:{components:r.components||[]},tracking_override:l({offer:((t.productOffer||{})[r.id]||[])[0]},He(r.frequency))};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[r.id]&&(o.subscription_info.first_order_place_date=t.firstOrderPlaceDate[r.id]),t.productToSubscribe&&t.productToSubscribe[r.id]&&(o.tracking_override.product=t.productToSubscribe[r.id]),o}).filter(r=>r.tracking_override.offer).filter(r=>e.length?e.includes(r.product):r),"getProductsForPurchasePost");I();O();var bs=Ee(us());O();var Ic=n(t=>{let e=String(t||"").trim().match(/(\d+)\s*([dwm])/);return e?`${e[1]}_${{d:1,w:2,m:3}[e[2]]}`:t},"sanitizeFrequencyString"),ps=n(t=>t.hasAttribute("product")&&l({id:t.getAttribute("product")},t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}),"buildProduct");var Qr=n(t=>{let e=ps(t);if(!e){let r=t.offer;r&&(e=ps(r))}return e},"resolveProduct"),qc=n(t=>{let e=t;for(;e;){if(e.tagName==="OG-OFFER")return e;e=e.nodeType===11?e.host:e.parentNode}},"resolveOffer"),Jr=n(t=>class extends t{get offer(){return qc(this)}connectedCallback(){super.connectedCallback(),this.offersChangeTemplate=this.offersChangeTemplate.bind(this),this.offer&&this.offer.addEventListener("template-changed",this.offersChangeTemplate)}disconnectedCallback(){super.disconnectedCallback(),this.offer&&this.offer.removeEventListener("template-changed",this.offersChangeTemplate)}offersChangeTemplate(){this._enqueueUpdate()}},"withOfferTemplate"),k=n(t=>class extends Jr(t){get product(){return Qr(this)}},"withProduct"),Jt=n(t=>class extends t{get childOptions(){return this._childOptions||{options:[]}}connectedCallback(){let e=[],r=null;this.querySelectorAll("option").forEach(o=>{let s=Ic(o.value),i=o.innerText.trim();e.push({value:s,text:i}),!r&&o.selected&&(r=s)}),this._childOptions={options:e,isSelected:r},super.connectedCallback&&super.connectedCallback()}},"withChildOptions");var Kt={};or(Kt,{eligibilityGroups:()=>hs,eligible:()=>ds,hasUpcomingOrder:()=>gs,hasUpsellGroup:()=>ms,inStock:()=>Kr,regularEligible:()=>Fc,subscribed:()=>Uc,subscriptionEligible:()=>fs,upcomingOrderContainsProduct:()=>Dc,upsellEligible:()=>ys});var Kr=n((t,e)=>(t.inStock||{})[(e.product||{}).id],"inStock"),ds=n((t,e)=>(t.autoshipEligible||{})[(e.product||{}).id]||!1,"eligible"),fs=n((t,e)=>(t.offerId&&t.offerId!=="0"||!1)&&ds(t,e)&&Kr(t,e),"subscriptionEligible"),hs=n((t,e)=>(t.eligibilityGroups||{})[(e.product||{}).id]||null,"eligibilityGroups"),ms=n((t,e)=>{let r=hs(t,e);return r===null||!!r.find(o=>o==="upsell"||o==="impulse_upsell")},"hasUpsellGroup"),Uc=n((t,e)=>nn(e.product)(t),"subscribed"),gs=n(t=>!!(t.nextUpcomingOrder&&t.nextUpcomingOrder.public_id),"hasUpcomingOrder"),Dc=n((t,e)=>(t.nextUpcomingOrder&&t.nextUpcomingOrder.products||[]).includes((e.product||{}).id),"upcomingOrderContainsProduct"),ys=n((t,e)=>t.offerId&&t.offerId!=="0"&&t.auth&&Kr(t,e)&&gs(t)&&ms(t,e),"upsellEligible"),Fc=n((t,e)=>fs(t,e)&&!ys(t,e),"regularEligible");var Lc=n(t=>t.replace(/(\r\n|\n|\r|\s)+/gm,""),"removeWhitespace"),Zr=class extends k(S){static get properties(){return h(l({},super.properties),{state:{type:Object,attribute:!1},test:{type:String}})}render(){return this.test&&bs.default.parse(Lc(this.test),r=>Kt[r]&&Kt[r](this.state,this))?p`
|
|
13
111
|
<slot></slot>
|
|
14
|
-
`:
|
|
112
|
+
`:p``}shouldUpdate(e){return e.size&&this.product&&this.product.id in this.state.autoshipEligible&&this.product.id in this.state.inStock}};n(Zr,"When");var jc=n(t=>({state:t}),"mapStateToProps"),_s=g(jc)(Zr);O();I();O();J();var xs={type:Object,converter:{toAttribute(t){return t==null?t:JSON.stringify(t)},fromAttribute(t){return t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}}},oe={type:String,attribute:"default-frequency",converter:{fromAttribute(t){return t&&mr(t)?t:null}}},Zt={type:Boolean,attribute:!0,reflect:!0},qe={type:Object,attribute:!1};O();var Mc=n(t=>class extends t{getOption(e,r=e){let o=yr(e);if(this.hasAttribute(o)){let s=this.getAttribute(o);return s.toString().toLowerCase()==="true"?!0:s.toString().toLowerCase()==="false"?!1:s}if(this.template&&this.template.config&&typeof this.template.config[r]!="undefined")return this.template.config[r];if(this.config&&typeof this.config[r]!="undefined")return this.config[r]}applyTemplate(e){this.template=e;let r=typeof e.markup=="undefined"?this.constructor.initialTemplate:e.markup;r&&this._templateMarkup!==r&&(this._templateMarkup=r,this.innerHTML=r)}refreshTemplate(){if(this._templates&&this._templates.length){let e=this._templates.find(({selector:r})=>{try{return this.matches(r)}catch(o){return!1}});this.applyTemplate(e||{})}}set templates(e){this._templates=e,this.refreshTemplate()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.constructor.initialTemplate&&!this.innerHTML.trim()&&(this.innerHTML=this.constructor.initialTemplate)}},"withTemplate"),L=Mc(S);var M=class extends k(L){static get properties(){return{subscribed:Zt,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"}}}static get styles(){return T`
|
|
15
113
|
:host {
|
|
16
114
|
cursor: default;
|
|
17
115
|
display: inline-block;
|
|
@@ -64,18 +162,18 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
64
162
|
text-align: center;
|
|
65
163
|
overflow: visible;
|
|
66
164
|
}
|
|
67
|
-
`}constructor(){super();this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?
|
|
165
|
+
`}constructor(){super();this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("subscribed")&&(this.frequencyMatch=this.frequency===this.defaultFrequency)}handleClick(){}render(){return this.subscribed&&!this.defaultFrequency?p`
|
|
68
166
|
<slot name="subscribed"></slot>
|
|
69
167
|
<slot name="frequency-mismatch"></slot>
|
|
70
|
-
`:this.subscribed&&this.defaultFrequency===this.frequency?
|
|
168
|
+
`:this.subscribed&&this.defaultFrequency===this.frequency?p`
|
|
71
169
|
<slot name="subscribed"></slot>
|
|
72
170
|
<slot name="frequency-match"></slot>
|
|
73
|
-
`:this.subscribed&&this.defaultFrequency!==this.frequency?
|
|
171
|
+
`:this.subscribed&&this.defaultFrequency!==this.frequency?p`
|
|
74
172
|
<slot name="subscribed"></slot>
|
|
75
173
|
<slot name="frequency-mismatch"></slot>
|
|
76
|
-
`:
|
|
174
|
+
`:p`
|
|
77
175
|
<slot name="not-subscribed"></slot>
|
|
78
|
-
`}};n(M,"OptinStatus");
|
|
176
|
+
`}};n(M,"OptinStatus");var W=n((t,e={})=>l(l({subscribed:B(e.product)(t),frequency:V(e.product)(t)},H(t,e,"defaultFrequency")),Ce(t,e)),"mapStateToProps"),Es=g(W)(M);var Xr=class extends M{static get properties(){return h(l({},super.properties),{frequency:{type:String,reflect:!0},defaultFrequency:oe,optinButtonLabel:{type:String}})}handleClick(e){this.optinProduct(Qr(this),this.defaultFrequency),e.preventDefault()}render(){return p`
|
|
79
177
|
<slot name="default">
|
|
80
178
|
<button id="action-trigger" class="btn radio ${this.subscribed?"active":""}"></button>
|
|
81
179
|
<label for="action-trigger">
|
|
@@ -84,7 +182,7 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
84
182
|
</slot>
|
|
85
183
|
</label>
|
|
86
184
|
</slot>
|
|
87
|
-
`}};n(
|
|
185
|
+
`}};n(Xr,"OptinButton");var Ss=g(W,{optinProduct:K})(Xr);O();I();var eo=class extends M{static get properties(){return h(l({},super.properties),{label:{type:String}})}handleClick(e){this.optoutProduct(this.product),e.preventDefault()}render(){return p`
|
|
88
186
|
<slot name="default">
|
|
89
187
|
<button id="action-trigger" class="btn radio ${this.subscribed?"":"active"}"></button>
|
|
90
188
|
<label for="action-trigger">
|
|
@@ -93,32 +191,32 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
93
191
|
</slot>
|
|
94
192
|
</label>
|
|
95
193
|
</slot>
|
|
96
|
-
`}};n(
|
|
194
|
+
`}};n(eo,"OptoutButton");var vs=g(W,{optoutProduct:Pe})(eo);O();I();O();J();var tt=n((t,e)=>{let{every:r,every_period:o}=He(t);return p`
|
|
97
195
|
${r}
|
|
98
196
|
<og-text key="frequencyPeriods" variant="${o}" pluralize="${r}"></og-text>
|
|
99
|
-
${e&&e===t?
|
|
197
|
+
${e&&e===t?p`
|
|
100
198
|
<og-text key="defaultFrequencyCopy"></og-text>
|
|
101
199
|
`:""}
|
|
102
|
-
`},"frequencyText"),
|
|
200
|
+
`},"frequencyText"),rt=class extends k(L){static get properties(){return h(l({},super.properties),{disabled:{type:Boolean},subscribed:Zt,frequency:{type:String},defaultFrequency:oe,productDefaultFrequency:{type:String},frequencies:{converter:{fromAttribute:rn}}})}static get styles(){return T`
|
|
103
201
|
:host[hidden] {
|
|
104
202
|
display: none;
|
|
105
203
|
}
|
|
106
204
|
:host {
|
|
107
205
|
display: inline-block;
|
|
108
206
|
}
|
|
109
|
-
`}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return
|
|
207
|
+
`}constructor(){super();this.frequencies=[]}render(){let e=this.frequency||this.defaultFrequency;return p`
|
|
110
208
|
<span>
|
|
111
|
-
${this.subscribed&&
|
|
112
|
-
<slot name="subscribed">${
|
|
209
|
+
${this.subscribed&&p`
|
|
210
|
+
<slot name="subscribed">${tt(e)} </slot>
|
|
113
211
|
`||""}
|
|
114
|
-
${!this.subscribed&&
|
|
212
|
+
${!this.subscribed&&p`
|
|
115
213
|
<slot name="not-subscribed"></slot>
|
|
116
214
|
`||""}
|
|
117
|
-
${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&
|
|
215
|
+
${this.subscribed&&this.defaultFrequency&&this.defaultFrequency!==this.frequency&&p`
|
|
118
216
|
<slot name="frequency-mismatch"></slot>
|
|
119
217
|
`||""}
|
|
120
218
|
</span>
|
|
121
|
-
`}};n(
|
|
219
|
+
`}};n(rt,"FrequencyStatus");var ot=n((t,e)=>l(l(l({subscribed:B(e.product)(t),frequency:V(e.product)(t),productDefaultFrequency:Nt((e.product||{}).id)(t)},H(t,e,"frequencies",[])),H(t,e,"defaultFrequency")),Ce(t,e)),"mapStateToProps"),ws=g(ot)(rt);var to=class extends Jt(M){static get properties(){return h(l({},super.properties),{frequencies:{type:Array,attribute:!1},frequency:{type:String},defaultFrequency:oe})}static get styles(){return T`
|
|
122
220
|
:host {
|
|
123
221
|
display: inline-block;
|
|
124
222
|
cursor: pointer;
|
|
@@ -128,26 +226,26 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
128
226
|
border-width: var(--og-select-border-width, 1px);
|
|
129
227
|
box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
|
|
130
228
|
}
|
|
131
|
-
`}get isSelected(){return this.subscribed?this.frequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product):this.productChangeFrequency(this.product,e)}render(){let{options:e,isSelected:r}=this.childOptions,o=e;return e.length||(o=[{value:"optedOut",text:
|
|
229
|
+
`}get isSelected(){return this.subscribed?this.frequency:"optedOut"}onOptinChange(e){e==="optedOut"?this.optoutProduct(this.product):this.productChangeFrequency(this.product,e)}render(){let{options:e,isSelected:r}=this.childOptions,o=e;return e.length||(o=[{value:"optedOut",text:p`
|
|
132
230
|
<og-text key="offerOptOutLabel"></og-text>
|
|
133
|
-
`},...(this.frequencies||[]).map(s=>({value:s,text:
|
|
231
|
+
`},...(this.frequencies||[]).map(s=>({value:s,text:tt(s,this.defaultFrequency)}))]),p`
|
|
134
232
|
<og-select
|
|
135
233
|
.options="${o}"
|
|
136
234
|
.selected="${r}"
|
|
137
235
|
.onChange="${({target:{value:s}})=>this.onOptinChange(s)}"
|
|
138
236
|
></og-select>
|
|
139
|
-
`}};n(
|
|
237
|
+
`}};n(to,"OptinSelect");var Os=g((t,e)=>l(l({},W(t,e)),ot(t,e)),{productChangeFrequency:It,optoutProduct:Pe})(to);O();I();var ro=class extends k(L){static get styles(){return T`
|
|
140
238
|
:host[hidden] {
|
|
141
239
|
display: none;
|
|
142
240
|
}
|
|
143
241
|
:host {
|
|
144
242
|
display: inline-block;
|
|
145
243
|
}
|
|
146
|
-
`}static get properties(){return
|
|
244
|
+
`}static get properties(){return h(l({},super.properties),{upcomingOrderDate:{type:String,attribute:!1},auth:qe,isPreview:{type:Boolean,attribute:!1},target:{type:String}})}constructor(){super();this.fetchOrders=()=>0,this.addEventListener("click",this.handleClick.bind(this))}updated(e){e.has("auth")&&this.auth&&!this.upcomingOrderDate&&!this.isPreview&&this.fetchOrders()}handleClick(){let e;if(!this.target&&this.offer)e=this.offer.querySelector("og-upsell-modal"),e||(e=this.offer.shadowRoot.querySelector("og-upsell-modal"));else if(this.target)e=document.querySelector(this.target);else throw Error("You must specify a target attribute or place this element as child of og-offer");e&&e.setAttribute("show",!0)}render(){return p`
|
|
147
245
|
<slot>
|
|
148
246
|
<og-next-upcoming-order></og-next-upcoming-order>
|
|
149
247
|
</slot>
|
|
150
|
-
`}};n(
|
|
248
|
+
`}};n(ro,"UpsellButton");var Vc=n(t=>({isPreview:t.previewUpsellOffer}),"mapStateToProps"),Ts=g(Vc,{fetchOrders:Ut})(ro);O();I();var oo=class extends k(L){static get properties(){return h(l({},super.properties),{defaultFrequency:oe,auth:qe,subscribed:{type:Boolean,attribute:!1},frequency:{type:String,attribute:!1},nextUpcomingOrder:{type:Object,attribute:!1},show:{type:Boolean,attribute:"show"},offerId:{type:String}})}constructor(){super();this.createIu=()=>0,this.concludeUpsell=()=>0}render(){return p`
|
|
151
249
|
<og-modal ?show=${this.show} @close=${()=>this.close()} @confirm=${()=>this.confirm()}>
|
|
152
250
|
<div slot="content">
|
|
153
251
|
<slot>
|
|
@@ -185,7 +283,7 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
185
283
|
</slot>
|
|
186
284
|
</span>
|
|
187
285
|
</og-modal>
|
|
188
|
-
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(
|
|
286
|
+
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let e=this.querySelector("og-select-frequency");return e?e.defaultFrequency:this._defaultFrequency}confirm(){this.createIu(this.product,this.nextUpcomingOrder.public_id,1,this.subscribed,this.frequency||this.defaultFrequency),this.close()}close(){this.concludeUpsell(),this.removeAttribute("show")}};n(oo,"UpsellModal");var $c=n((t,e)=>h(l({auth:t.auth,offerId:t.offerId,subscribed:B(e.product)(t),frequency:V(e.product)(t)},H(t,e,"defaultFrequency")),{nextUpcomingOrder:t.previewUpsellOffer?{public_id:"preview-order-id"}:t.nextUpcomingOrder,isPreview:t.previewUpsellOffer}),"mapStateToProps"),Cs=g($c,{concludeUpsell:hn,createIu:xn})(oo);O();I();var no=class extends M{static get properties(){return h(l({},super.properties),{frequency:{type:String}})}handleClick(e){this.subscribed?this.optoutProduct(this.product):this.optinProduct(this.product,this.frequency||this.defaultFrequency),e.preventDefault()}render(){return p`
|
|
189
287
|
<slot name="default">
|
|
190
288
|
<button id="action-trigger" class="btn checkbox ${this.subscribed?"active":""}"></button>
|
|
191
289
|
<label for="action-trigger">
|
|
@@ -194,13 +292,13 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
194
292
|
></slot>
|
|
195
293
|
</label>
|
|
196
294
|
</slot>
|
|
197
|
-
`}};n(
|
|
295
|
+
`}};n(no,"OptinToggle");var Ps=g(W,{optoutProduct:Pe,optinProduct:K})(no);O();var Bc=n((t,e)=>`${t}${parseInt(e,10)>1?"s":""}`,"pluralize"),so=class extends Jr(S){static get properties(){return{pluralize:{type:Number},variant:{type:Number},i18n:{type:Object,attribute:!1},locale:{type:Object,attribute:!1},key:{type:String}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._textOverride=this.innerText.trim()}getText(){return this._textOverride?this._textOverride:this.getPluralizedText(this.getVariantText(this.key))}getVariantText(e){let r=l(l({},this.i18n),this.offer&&this.offer.locale),o=typeof r[e]!="undefined"?r[e]:"";return typeof this.variant=="undefined"?o:o[this.variant]}getPluralizedText(e){return typeof this.pluralize=="undefined"?e:e&&Bc(e,this.pluralize)}render(){return p`
|
|
198
296
|
${this.getText()}
|
|
199
|
-
`}};n(
|
|
200
|
-
${this.label} ${s?
|
|
201
|
-
`}renderFallback(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing";return
|
|
202
|
-
${
|
|
203
|
-
`}};n(
|
|
297
|
+
`}};n(so,"Text");var Hc=n(t=>({i18n:t.locale||{}}),"mapStateToProps"),Rs=g(Hc)(so);O();var Ue=class{constructor(e){this.value=e,this.className="DiscountAmount"}toString(){return`${this.value}`}};n(Ue,"DiscountAmount");var nt=class extends Ue{constructor(e){super(e);this.className="DiscountPercent"}toString(){return`${super.toString()}%`}};n(nt,"DiscountPercent");var io=class extends nt{constructor(e){super(e);this.className="ShippingDiscountPercent"}toString(){return this.value===100?"free shipping":super.toString()}};n(io,"ShippingDiscountPercent");var ao="Discount Percent",co="Discount Amount",As="total_price",Ns="shipping_total",ks="sub_total",lo=n(({field:t,object:e,type:r,value:o})=>{let i=[[new nt(o),{field:As,object:"item",type:ao}],[new Ue(o),{field:As,object:"item",type:co}],[new io(o),{field:Ns,object:"order",type:ao}],[new Ue(o),{field:Ns,object:"order",type:co}],[new nt(o),{field:ks,object:"order",type:ao}],[new Ue(o),{field:ks,object:"order",type:co}]].find(([,a])=>a.field===t&&a.object===e&&a.type===r);return i&&i[0]},"discountBuilder");function zc(t){return!(lo(t).className!==this.incentiveClass||this.incentiveValue&&this.incentiveValue.toString()!==t.value.toString())}n(zc,"filterIncentives");var uo=class extends k(S){static get properties(){return h(l({},super.properties),{incentives:{type:Object,attribute:!1},from:{type:String},label:{type:String},initial:{type:Boolean,default:!1},value:{type:Number}})}createRenderRoot(){return this}render(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing",s=(this.incentives[o]||[]).find(zc.bind({incentiveClass:e,incentiveValue:r}));return p`
|
|
298
|
+
${this.label} ${s?lo(s):this.renderFallback()}
|
|
299
|
+
`}renderFallback(){let e=this.from,r=this.value,o=this.initial?"initial":"ongoing";return p`
|
|
300
|
+
${lo({field:"sub_total",object:"order",type:"Discount Percent",value:this.value})}
|
|
301
|
+
`}};n(uo,"IncentiveText");var Gc=n((t,e)=>({incentives:(t.incentives||{})[e&&e.product&&e.product.id]||{}}),"mapStateToProps"),Is=g(Gc)(uo);O();I();var po=class extends Jt(rt){static get properties(){return h(l({},super.properties),{defaultText:{type:String,attribute:"default-text"}})}static get styles(){return T`
|
|
204
302
|
:host {
|
|
205
303
|
display: inline-block;
|
|
206
304
|
cursor: pointer;
|
|
@@ -211,15 +309,15 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
211
309
|
box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);
|
|
212
310
|
z-index: 1;
|
|
213
311
|
}
|
|
214
|
-
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let{options:e,isSelected:r}=this.childOptions;return this.productDefaultFrequency?this.productDefaultFrequency:r||(e.length?e[0].value:this._defaultFrequency)}get currentFrequency(){return this.frequency||this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){let{options:e}=this.childOptions;e.length||(e=(this.frequencies||[]).map(o=>({value:o,text:
|
|
312
|
+
`}set defaultFrequency(e){this._defaultFrequency=e}get defaultFrequency(){let{options:e,isSelected:r}=this.childOptions;return this.productDefaultFrequency?this.productDefaultFrequency:r||(e.length?e[0].value:this._defaultFrequency)}get currentFrequency(){return this.frequency||this.defaultFrequency}productChangeFrequency(e,r){this.frequency=r}render(){let{options:e}=this.childOptions;e.length||(e=(this.frequencies||[]).map(o=>({value:o,text:tt(o,this.defaultFrequency)})));let r=this.defaultFrequency;return e=e.map(({text:o,value:s})=>({text:s===r?`${o} ${(this.defaultText||"").trim()}`.trim():o,value:s})),p`
|
|
215
313
|
<og-select
|
|
216
314
|
.options="${e}"
|
|
217
315
|
.selected="${this.currentFrequency}"
|
|
218
316
|
.onChange="${({target:{value:o}})=>{this.productChangeFrequency(this.product,o)}}"
|
|
219
317
|
></og-select>
|
|
220
|
-
`}};n(
|
|
221
|
-
${
|
|
222
|
-
`}};n(
|
|
318
|
+
`}};n(po,"SelectFrequency");var qs=g(ot,{productChangeFrequency:It})(po);O();var Wc={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 Us=n((t,e)=>t instanceof Date?(e||"").toString().replace(/\{\{([-\w]+)\}\}/g,r=>{let o=r.replace(/[{}]/g,""),s=Wc[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 fo=class extends S{static get properties(){return{value:{type:String,reflect:!0},format:{type:String}}}createRenderRoot(){return this}render(){return p`
|
|
319
|
+
${Us(this.value,this.format||"{{month-long}} {{day}}, {{year-numeric}}")}
|
|
320
|
+
`}};n(fo,"FormattedDate");var Yc=n(t=>({value:t.previewUpsellOffer?new Date:t.nextUpcomingOrder.place}),"mapStateToProps"),Ds=g(Yc)(fo);O();var js=Ee(Ct());I();ue();var Fs=n((t,e)=>n(async function(o){await o({type:je,payload:t}),await o({type:ve}),await o(Re({in_stock:{[e]:!0},eligibility_groups:{[e]:["subscription","upsell"]},result:"success",autoship:{[e]:!0},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"]}}}))},"setPreviewStandardOfferThunk"),"setPreviewStandardOffer"),Qc=n((t,e)=>n(async function(o,s){await o({type:Me,payload:t});let{merchantId:i}=s();t?(await o(Re({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},modifiers:{}})),await o(Er({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 o(xr(i,"sig_field","ts","sig"))):await o(Z())},"setPreviewUpsellOfferThunk"),"setPreviewUpsellOffer"),Ls=n((t,e,r)=>async function(o,s){switch(await o({type:Y}),await o({type:je,payload:!1}),await o({type:Me,payload:!1}),t){case"regular":o(Fs(!0,r.product.id));break;case"upsell":o(Qc(!0,r.product.id));break;case"subscribed":o(Fs(!0,r.product.id)),o(K(r.product,"2_2"));break;default:}},"setPreview");I();var Jc=n((...t)=>JSON.stringify(t),"memoizeKey"),Kc=(0,js.default)((t,e)=>Object.assign({components:e},t),Jc),ho=class extends L{static get properties(){return h(l({},super.properties),{config:{type:Object,attribute:!1},product:xs,productComponents:{type:Array,attribute:"product-components"},offerId:{type:String,attribute:!1},auth:qe,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}})}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 T`
|
|
223
321
|
:host[hidden] {
|
|
224
322
|
display: none;
|
|
225
323
|
}
|
|
@@ -288,13 +386,22 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
288
386
|
`}static get initialTemplate(){return`
|
|
289
387
|
<og-when test="regularEligible">
|
|
290
388
|
<div>
|
|
389
|
+
|
|
291
390
|
<og-optout-button>
|
|
292
391
|
<og-text key="offerOptOutLabel"></og-text>
|
|
293
392
|
</og-optout-button>
|
|
294
393
|
</div>
|
|
295
394
|
<div>
|
|
296
395
|
<og-optin-button>
|
|
297
|
-
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
<og-price discount>
|
|
399
|
+
<span slot="prepend">Subscribe and get</span>
|
|
400
|
+
<span slot="append">off</span>
|
|
401
|
+
</og-price>
|
|
402
|
+
<og-price regular></og-price>
|
|
403
|
+
<og-price subscription></og-price>
|
|
404
|
+
|
|
298
405
|
</og-optin-button>
|
|
299
406
|
<og-tooltip placement="bottom">
|
|
300
407
|
<div slot="trigger">
|
|
@@ -358,9 +465,9 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
358
465
|
The product is in your next upcomming order
|
|
359
466
|
</og-when>
|
|
360
467
|
</og-when>
|
|
361
|
-
`}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:r}=e;this.locale=r;let o=new CustomEvent("template-changed");this.dispatchEvent(o)}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&&this.fetchOffer(this.product.id),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=
|
|
468
|
+
`}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:r}=e;this.locale=r;let o=new CustomEvent("template-changed");this.dispatchEvent(o)}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&&this.fetchOffer(this.product.id),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=Kc(this.product,this.productComponents),o=Object.assign({},this.product,{components:e.get("productComponents")});N(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.product.id&&this.optinProduct&&!(this.optedin||[]).find(r=>N(r,this.product))&&this.optinProduct(l(l({},this.product),this.productComponents.length&&{components:this.productComponents}),this.defaultFrequency)}get isPreview(){return this.preview}render(){return p`
|
|
362
469
|
<slot></slot>
|
|
363
|
-
`}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(
|
|
470
|
+
`}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(ho,"Offer");var Zc=n((t,e)=>l(h(l(l({config:t.config,auth:t.auth,offerId:((t.productOffer||{})[(e.product||{}).id]||[])[0],productFrequency:V(e.product)(t),productDefaultFrequency:Nt((e.product||{}).id)(t)},H(t,e,"autoshipByDefault",gr(t)[(e.product||{}).id])),sn(e.product)(t)&&{autoshipByDefault:!1}),{optedin:At(t),subscribed:B(e.product)(t)}),Ce(t)),"mapStateToProps"),Ms=g(Zc,{fetchOffer:bn,fetchOrders:Ut,productHasChangedComponents:fn,optinProduct:K,setFirstOrderPlaceDate:On,setProductToSubscribe:Tn,setPreview:Ls})(ho);O();var Xt=class extends S{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 T`
|
|
364
471
|
:host[hidden] {
|
|
365
472
|
display: none;
|
|
366
473
|
}
|
|
@@ -472,7 +579,7 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
472
579
|
.btn {
|
|
473
580
|
cursor: pointer;
|
|
474
581
|
}
|
|
475
|
-
`}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?
|
|
582
|
+
`}close(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("close"))}confirm(){this.removeAttribute("show"),this.dispatchEvent(new CustomEvent("confirm"))}get confirmButton(){return this.showConfirmButton?p`
|
|
476
583
|
<span @click="${()=>this.confirm()}">
|
|
477
584
|
<slot name="confirm" class="btn">
|
|
478
585
|
<button class="og-modal__btn og-modal__btn-primary og-modal__confirm" @click="${()=>this.confirm()}">
|
|
@@ -480,7 +587,7 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
480
587
|
</button>
|
|
481
588
|
</slot>
|
|
482
589
|
</span>
|
|
483
|
-
`:
|
|
590
|
+
`:p``}get cancelButton(){return this.showCancelButton?p`
|
|
484
591
|
<span @click="${()=>this.close()}" class="btn">
|
|
485
592
|
<slot name="cancel">
|
|
486
593
|
<button class="og-modal__btn og-modal__cancel" @click="${()=>this.close()}">
|
|
@@ -488,7 +595,7 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
488
595
|
</button>
|
|
489
596
|
</slot>
|
|
490
597
|
</span>
|
|
491
|
-
`:
|
|
598
|
+
`:p``}render(){return this.show?p`
|
|
492
599
|
<div class="og-modal is-open" aria-hidden="true">
|
|
493
600
|
<div class="og-modal__overlay" tabindex="-1">
|
|
494
601
|
<div class="og-modal__container" role="dialog" aria-modal="true">
|
|
@@ -507,7 +614,7 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
507
614
|
</div>
|
|
508
615
|
</div>
|
|
509
616
|
</div>
|
|
510
|
-
`:
|
|
617
|
+
`:p``}};n(Xt,"Modal");O();var er=class extends S{static get styles(){return T`
|
|
511
618
|
:host {
|
|
512
619
|
display: inline-block;
|
|
513
620
|
color: inherit;
|
|
@@ -566,9 +673,9 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
566
673
|
line-height: 0.2em;
|
|
567
674
|
transform: scaleY(0.5);
|
|
568
675
|
}
|
|
569
|
-
`}static get properties(){return{options:{type:Array},selected:{type:String}}}render(){return
|
|
676
|
+
`}static get properties(){return{options:{type:Array},selected:{type:String}}}render(){return p`
|
|
570
677
|
<select @change="${this.onChange}" .value="${this.selected}">
|
|
571
|
-
${this.options.map(e=>
|
|
678
|
+
${this.options.map(e=>p`
|
|
572
679
|
<option value="${e.value}" ?selected=${this.selected===e.value}>${e.text}</option>
|
|
573
680
|
`)}
|
|
574
681
|
</select>
|
|
@@ -577,7 +684,7 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
577
684
|
<path d="M10.5 15l7.5 7.5 7.5-7.5z" />
|
|
578
685
|
<path d="M0 0h36v36h-36z" fill="none" />
|
|
579
686
|
</svg> -->
|
|
580
|
-
`}};n(
|
|
687
|
+
`}};n(er,"Select");O();var tr=class extends S{static get properties(){return{placement:{type:String,default:"bottom"}}}static get styles(){return T`
|
|
581
688
|
:host[hidden] {
|
|
582
689
|
display: none;
|
|
583
690
|
}
|
|
@@ -726,7 +833,7 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
726
833
|
pointer-events: auto;
|
|
727
834
|
transform: translateY(0px);
|
|
728
835
|
}
|
|
729
|
-
`}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){let r=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),o=this.shadowRoot.querySelector(".content"),s=o.getBoundingClientRect();!this.placement||this.placement==="top"||this.placement==="bottom"?o.style.left=`${(-1*s.width+r.width)/2}px`:(this.placement==="left"||this.placement==="right")&&(o.style.top=`${(-1*s.height+r.height)/2}px`)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return
|
|
836
|
+
`}connectedCallback(){super.connectedCallback(),this.showTooltip=this.showTooltip.bind(this),this.addEventListener("mouseenter",this.showTooltip)}showTooltip(){let r=this.shadowRoot.querySelector(".trigger").getBoundingClientRect(),o=this.shadowRoot.querySelector(".content"),s=o.getBoundingClientRect();!this.placement||this.placement==="top"||this.placement==="bottom"?o.style.left=`${(-1*s.width+r.width)/2}px`:(this.placement==="left"||this.placement==="right")&&(o.style.top=`${(-1*s.height+r.height)/2}px`)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("mouseenter",this.showTooltip),this.removeEventListener("mouseout",this.hideTooltip)}render(){return p`
|
|
730
837
|
<span class="tooltip">
|
|
731
838
|
<span class="trigger">
|
|
732
839
|
<slot name="trigger">
|
|
@@ -739,104 +846,12 @@ var lib=(()=>{var La=Object.create;var Re=Object.defineProperty,ja=Object.define
|
|
|
739
846
|
</slot>
|
|
740
847
|
</div>
|
|
741
848
|
</span>
|
|
742
|
-
`}};n(
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
padding: 1em;
|
|
750
|
-
border-radius: 5px;
|
|
751
|
-
border: 1px solid #ccc;
|
|
752
|
-
box-shadow: 2px 2px 0 0 #000;
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
button {
|
|
756
|
-
margin: 0 0.5em 0.5em;
|
|
757
|
-
background-color: gray;
|
|
758
|
-
color: white;
|
|
759
|
-
border: 0;
|
|
760
|
-
border-radius: 3px;
|
|
761
|
-
cursor: pointer;
|
|
762
|
-
padding: 0.5em;
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
button.primary {
|
|
766
|
-
background-color: blue;
|
|
767
|
-
padding: 1em;
|
|
768
|
-
color: white;
|
|
769
|
-
border: 0;
|
|
770
|
-
border-radius: 3px;
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
button[disabled] {
|
|
774
|
-
background-color: #777;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
div {
|
|
778
|
-
margin-bottom: 0.5em;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
.message {
|
|
782
|
-
margin-left: 0.5em;
|
|
783
|
-
margin: 1em;
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
.success {
|
|
787
|
-
color: green;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
.error {
|
|
791
|
-
color: red;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
.warning {
|
|
795
|
-
color: orange;
|
|
796
|
-
}
|
|
797
|
-
a {
|
|
798
|
-
color: white;
|
|
799
|
-
}
|
|
800
|
-
`}runTests(){this.results=[],this.disabled=!0,this.requestUpdate(),document.querySelectorAll("og-offer").forEach(r=>{let o=r.store.getState(),s=r.getAttribute("product"),i=r.getAttribute("location"),a={messages:this.getOfferAttributeMessages(s,i).concat(this.getOfferRequestMessages(s,o)),product:s};this.results.push(a)}),this.testsRan=!0,this.disabled=!1,this.requestUpdate()}getOfferAttributeMessages(e,r){let o=[];return e||o.push({name:"Offer element found but missing product attribute",type:"error"}),r||o.push({name:"Offer element found but missing location attribute",type:"warning"}),e&&r&&o.push({name:"Offer element found and properly tagged",type:"success"}),o}getOfferRequestMessages(e,r){let o=r.inStock[e],s=r.autoshipEligible[e],i=[];return e&&o===!1&&i.push({name:"This product is marked as out of stock in the OG database",type:"warning"}),e&&s===!1&&i.push({name:"This product is not eligible for autoship",type:"warning"}),e&&o===null&&s===null&&i.push({name:"This product does not exist in our database",type:"error"}),i}resultsCodeBlock(){return this.results.length===0?d`
|
|
801
|
-
<div class="message error">No offer element found on the page</div>
|
|
802
|
-
`:this.results.map((e,r)=>d`
|
|
803
|
-
<div>For offer tag with product = "${e.product}"</div>
|
|
804
|
-
${e.messages.map(o=>d`
|
|
805
|
-
<div class="message ${o.type}">
|
|
806
|
-
${o.name}
|
|
807
|
-
</div>
|
|
808
|
-
`)}
|
|
809
|
-
<button @click=${this.toggleProductFlags(r,{})}>
|
|
810
|
-
Set inStock and eligible
|
|
811
|
-
</button>
|
|
812
|
-
<br />
|
|
813
|
-
<button @click=${this.toggleProductFlags(r,{inStock:!1})}>
|
|
814
|
-
Set to not inStock
|
|
815
|
-
</button>
|
|
816
|
-
<br />
|
|
817
|
-
<button @click=${this.toggleProductFlags(r,{autoship:!1})}>
|
|
818
|
-
Set to not eligible
|
|
819
|
-
</button>
|
|
820
|
-
<br />
|
|
821
|
-
<button @click=${this.toggleProductFlags(r,{autoship:!1,inStock:!1})}>
|
|
822
|
-
Set to not eligible and not in stock
|
|
823
|
-
</button>
|
|
824
|
-
<br />
|
|
825
|
-
<button @click=${this.toggleUpsellPreview(r)}>
|
|
826
|
-
Toggle upsell/regular in this offer
|
|
827
|
-
</button>
|
|
828
|
-
<br />
|
|
829
|
-
<button @click=${this.toggleUpsellNextOrder(r)}>
|
|
830
|
-
upsell product is in next order
|
|
831
|
-
</button>
|
|
832
|
-
<br />
|
|
833
|
-
`)}toggleUpsellPreview(e){return r=>{r.preventDefault();let o=document.querySelectorAll("og-offer")[e];o.getAttribute("preview-upsell-offer")?o.removeAttribute("preview-upsell-offer"):o.setAttribute("preview-upsell-offer",!0),this.runTests()}}toggleProductFlags(e,{inStock:r=!0,autoship:o=!0,groups:s=["subscription","upsell"]}){return i=>{i.preventDefault();let a=document.querySelectorAll("og-offer")[e],c=a.product.id;a.store.dispatch(xe({in_stock:{[c]:r},eligibility_groups:{[c]:s},result:"success",autoship:{[c]:o},module_view:{regular:"58a01e9aacbe40389b5c7325d79091bb"},modifiers:{},incentives_display:{"47c01e9aacbe40389b5c7325d79091aa":{field:"sub_total",object:"order",type:"Discount Percent",value:5},e6534b9d877f41e586c37b7d8abc3a58:{field:"total_price",object:"item",type:"Discount Percent",value:5},f35e842710b24929922db4a529eecd40:{field:"total_price",object:"item",type:"Discount Percent",value:10},"5be321d7c17f4e18a757212b9a20bfcc":{field:"total_price",object:"item",type:"Discount Percent",value:1}},incentives:{[c]:{initial:["5be321d7c17f4e18a757212b9a20bfcc"],ongoing:["e6534b9d877f41e586c37b7d8abc3a58","47c01e9aacbe40389b5c7325d79091aa","f35e842710b24929922db4a529eecd40"]}}})),this.runTests()}}toggleUpsellNextOrder(e){return r=>{let o=document.querySelectorAll("og-offer")[e],s=o.product.id;r.preventDefault(),o.store.dispatch(Kt({count:1,next:null,previous:null,results:[{order:"24d50352579511ea806cbc764e100cfd",offer:null,subscription:"8a076b7a0ea011e7a5bcbc764e105eda",product:s,components:[],quantity:1,public_id:"24d6901e579511ea806cbc764e100cfd",product_attribute:null,price:"14.99",extra_cost:"0.00",total_price:"13.49",one_time:!1,frozen:!1,first_placed:null}]})),this.runTests()}}render(){return d`
|
|
834
|
-
<div>
|
|
835
|
-
${this.testsRan?this.resultsCodeBlock():d`
|
|
836
|
-
<div>Click the button to run tests</div>
|
|
837
|
-
`}
|
|
838
|
-
<button ?disabled=${this.disabled} @click="${this.runTests.bind(this)}" class="primary">Run Test</button>
|
|
839
|
-
</div>
|
|
840
|
-
`}};n(Rr,"TestWizard");xu=Rr});function Fo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,Eu);let e=document.createElement(t);document.body.appendChild(e)}var Eu,Na=p(()=>{({TestWizard:Eu}=(Aa(),Ra));n(Fo,"default")});var qa={};x(qa,{default:()=>Su,enable:()=>ka,keys:()=>Ar});var Ar,ka,Su,Ia=p(()=>{Na();Ar=[79,71,68,69,86],ka=n(()=>{if(window.OG_OFFERS_TEST_MODE_ENABLE)return;window.OG_OFFERS_TEST_MODE_ENABLE=!0;let t=0;document.addEventListener("keyup",async function(e){if(e.which===Ar[t]){let o=Ar[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=Ar.length&&Fo()}else t=0},!1)},"enable"),Su=ka});var Wu=X((Th,Da)=>{var{offersLiveEditor:vu}=(Yo(),Wo),{setStore:wu}=(N(),on),{getStore:Ou}=(ks(),Ns),{listenLocalStorageChanges:Tu}=(Xt(),ws),Ua=(Us(),Is),B=(I(),Es),{ConnectedWhen:Cu}=(vi(),Si),{ConnectedOptinButton:Pu}=(Ri(),Pi),{ConnectedOptoutButton:Ru}=(ki(),Ni),{ConnectedOptinSelect:Au}=(Fi(),Di),{ConnectedUpsellButton:Nu}=(Mi(),ji),{ConnectedUpsellModal:ku}=(Bi(),$i),{ConnectedOptinToggle:qu}=(Gi(),zi),{ConnectedOptinStatus:Iu}=(Ye(),Ti),{ConnectedText:Uu}=(Ki(),Ji),{ConnectedIncentiveText:Du}=(sa(),na),{ConnectedSelectFrequency:Fu}=(ca(),aa),{ConnectedNextUpcomingOrder:Lu}=(fa(),da),{ConnectedOffer:ju}=(Sa(),Ea),{Modal:Mu}=(wa(),va),{Select:Vu}=(Ta(),Oa),{Tooltip:$u}=(Pa(),Ca),{ConnectedFrequencyStatus:Bu}=(_r(),Ii),Hu=(Ia(),qa),{default:zu}=(se(),qn),{environment:Gu}=(Qr(),cs);Hu.enable();var k,T={setEnvironment(t){return k.dispatch(B.setEnvironment(t)),T},setMerchantId(t){return k.dispatch(B.setMerchantId(t)),T},setAuthUrl(t){return k.dispatch(B.setAuthUrl(t)),T},getProductsForPurchasePost(t=[]){return Ua.getProductsForPurchasePost(k.getState(),t)},getOptins(t=[]){return Ua.getProductsForPurchasePost(k.getState(),t)},clear(){k.dispatch(B.checkout())},addOptinChangedCallback(t){typeof t=="function"&&document.addEventListener("optin-changed",e=>t(e.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",t=>t.stopPropagation(),!0)},register(){try{customElements.define("og-when",Cu),customElements.define("og-text",Uu),customElements.define("og-incentive-text",Du),customElements.define("og-offer",ju),customElements.define("og-select-frequency",Fu),customElements.define("og-optout-button",Ru),customElements.define("og-optin-toggle",qu),customElements.define("og-optin-status",Iu),customElements.define("og-optin-button",Pu),customElements.define("og-optin-select",Au),customElements.define("og-upsell-button",Nu),customElements.define("og-frequency-status",Bu),customElements.define("og-modal",Mu),customElements.define("og-select",Vu),customElements.define("og-tooltip",$u),customElements.define("og-upsell-modal",ku),customElements.define("og-next-upcoming-order",Lu)}catch(t){console.log("this?",t)}T.register=()=>0},previewMode(t){return window.og=window.og||{},t===!1?delete window.og:window.og.previewMode=!0,this},initialize(t,e,r){if(T.isReady)return console.warn("og.offers has been initialized already. Skipping."),T;k=Ou();let o=window.og_settings;if(t&&e&&o){let s=[];o.product?s.push(o.product):o.cart&&Array.isArray(o.cart.products)&&(s=s.concat(o.cart.products));let{apiUrl:i}=Gu({},B.setEnvironment(e)),{sessionId:a}=k.getState();a&&s.forEach(c=>zu.fetchOffer(i,t,a,`${c}`,"pdp"))}return wu(k),t&&T.setMerchantId(t),e&&T.setEnvironment(e),r&&T.setAuthUrl(r),window.addEventListener("storage",Tu(k)),t&&e&&(k.dispatch(B.requestSessionId()),k.dispatch(B.fetchAuth()),T.register()),T.isReady=!0,T},config(t){return k.dispatch(B.setConfig(t)),T},setLocale(t){return k.dispatch(B.setLocale(t)),T},addTemplate(t,e,r){return k.dispatch(B.addTemplate(t,e,r)),T},setTemplates(t){return k.dispatch(B.setTemplates(t)),T},setPublicPath(t){return T}};window.OG=window.OG||{};Object.assign(window.OG,T);Object.assign(T.initialize,T);vu();Da.exports=T.initialize});return Wu();})();
|
|
849
|
+
`}};n(tr,"Tooltip");var{TestWizard:el}=($s(),Vs);function mo(){let t="og-test-wizard";customElements.get(t)||customElements.define(t,el);let e=document.createElement(t);document.body.appendChild(e)}n(mo,"default");var go=[79,71,68,69,86],Bs=n(()=>{if(window.OG_OFFERS_TEST_MODE_ENABLE)return;window.OG_OFFERS_TEST_MODE_ENABLE=!0;let t=0;document.addEventListener("keyup",async function(e){if(e.which===go[t]){let o=go[t];setTimeout(function(){t<=o&&(t=0)},5e3),t+=1,t>=go.length&&mo()}else t=0},!1)},"enable");J();ue();O();var yo=class extends k(L){static get properties(){return h(l({},super.properties),{regular:{type:Boolean,reflect:!0},subscription:{type:Boolean,reflect:!0},discount:{type:Boolean,reflect:!0},frequency:{type:Object},productPlans:{type:Object}})}get value(){let e=this.frequency||this.offer&&this.offer.defaultFrequency,o=(this.productPlans[this.product.id]||{})[e]||[];if(!o)return"";let[s,i,a]=o;return a===s?"":this.regular?s:this.discount?i:a}render(){let e=this.value;return e?p`
|
|
850
|
+
<slot name="prepend"></slot>
|
|
851
|
+
${e}
|
|
852
|
+
<slot name="append"></slot>
|
|
853
|
+
`:p`
|
|
854
|
+
<slot></slot>
|
|
855
|
+
`}};n(yo,"Price");var tl=n((t,e)=>({productPlans:t.productPlans,frequency:V(e.product)(t)}),"mapStateToProps"),Hs=g(tl)(yo);Bs();var R,E={};function zs(t){return R.dispatch(vr(t)),E}n(zs,"setEnvironment");function Gs(t){return R.dispatch(mn(t)),E}n(Gs,"setMerchantId");function Ws(t){return R.dispatch(gn(t)),E}n(Ws,"setAuthUrl");function Ys(t=[]){return Tr(R.getState(),t)}n(Ys,"getProductsForPurchasePost");function Qs(t=[]){return Tr(R.getState(),t)}n(Qs,"getOptins");function Js(){R.dispatch(_n())}n(Js,"clear");function Ks(t){typeof t=="function"&&document.addEventListener("optin-changed",e=>t(e.detail))}n(Ks,"addOptinChangedCallback");function Zs(){document.addEventListener("optin-changed",t=>t.stopPropagation(),!0)}n(Zs,"disableOptinChangedCallbacks");function Xs(){try{customElements.define("og-when",_s),customElements.define("og-text",Rs),customElements.define("og-incentive-text",Is),customElements.define("og-offer",Ms),customElements.define("og-select-frequency",qs),customElements.define("og-optout-button",vs),customElements.define("og-optin-toggle",Ps),customElements.define("og-optin-status",Es),customElements.define("og-optin-button",Ss),customElements.define("og-optin-select",Os),customElements.define("og-upsell-button",Ts),customElements.define("og-frequency-status",ws),customElements.define("og-modal",Xt),customElements.define("og-select",er),customElements.define("og-tooltip",tr),customElements.define("og-upsell-modal",Cs),customElements.define("og-next-upcoming-order",Ds),customElements.define("og-price",Hs)}catch(t){console.warn(t)}E.register=()=>0}n(Xs,"register");function ei(t){return window.og=window.og||{},t===!1?delete window.og:window.og.previewMode=!0,this}n(ei,"previewMode");function ti(t){return R.dispatch(Sn(t)),E}n(ti,"config");function ri(t){return R.dispatch(En(t)),E}n(ri,"setLocale");function oi(t,e,r){return R.dispatch(vn(t,e,r)),E}n(oi,"addTemplate");function ni(t){return R.dispatch(wn(t)),E}n(ni,"setTemplates");function si(t){return E}n(si,"setPublicPath");function ii(t,e,r,o=R){if(t&&e&&r){let s=[];r.product?s.push(r.product):r.cart&&Array.isArray(r.cart.products)&&(s=s.concat(r.cart.products));let{apiUrl:i}=br({},vr(e)),{sessionId:a}=o.getState();a&&s.forEach(c=>{Q.fetchOffer(i,t,a,`${c}`,"pdp")}),r.product_discounts&&typeof r.product_discounts=="object"&&o.dispatch({type:wt,payload:r.product_discounts})}}n(ii,"resolveSettings");function bo(t,e,r){return E.isReady?(console.warn("og.offers has been initialized already. Skipping."),E):(R=Dn(),E.store=R,E.resolveSettings(t,e,window.og_settings,R),qo(R),t&&E.setMerchantId(t),e&&E.setEnvironment(e),r&&E.setAuthUrl(r),window.addEventListener("storage",Nn(R)),t&&e&&(R.dispatch(Dt()),R.dispatch(yn()),E.register()),E.isReady=!0,E)}n(bo,"initialize");var rl=bo;Object.assign(E,{setEnvironment:zs,setMerchantId:Gs,setAuthUrl:Ws,getProductsForPurchasePost:Ys,getOptins:Qs,clear:Js,addOptinChangedCallback:Ks,disableOptinChangedCallbacks:Zs,register:Xs,previewMode:ei,config:ti,setLocale:ri,addTemplate:oi,setTemplates:ni,setPublicPath:si,resolveSettings:ii,initialize:bo});window.OG=window.OG||{};Object.assign(window.OG,E);Object.assign(E.initialize,E);sr();return ol;})();
|
|
841
856
|
; return lib; });
|
|
842
857
|
//# sourceMappingURL=offers.js.map
|