@ordergroove/offers 2.21.4-alpha-PR-515-2.0 → 2.21.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/bundle-report.html +1 -1
- package/dist/examples.js +1672 -26
- package/dist/examples.js.map +1 -1
- package/dist/offers.js +2 -2
- package/dist/offers.js.map +1 -1
- package/package.json +2 -2
- package/src/core/__tests__/localStorage.spec.js +35 -1
- package/src/core/actions.js +3 -0
- package/src/core/localStorage.js +1 -1
package/dist/offers.js
CHANGED
|
@@ -144,7 +144,7 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
|
|
|
144
144
|
* subject to an additional IP rights grant found at
|
|
145
145
|
* http://polymer.github.io/PATENTS.txt
|
|
146
146
|
*/
|
|
147
|
-
(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const et={};class rt extends W{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const t=this.getStyles();if(Array.isArray(t)){const e=(t,r)=>t.reduceRight((t,r)=>Array.isArray(r)?e(r,t):(t.add(r),t),r),r=e(t,new Set),n=[];r.forEach(t=>n.unshift(t)),this._styles=n}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map(t=>{if(t instanceof CSSStyleSheet&&!Q){const e=Array.prototype.slice.call(t.cssRules).reduce((t,e)=>t+e.cssText,"");return new X(String(e),K)}return t})}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(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Q?this.renderRoot.adoptedStyleSheets=t.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map(t=>t.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){const e=this.render();super.update(t),e!==et&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)}))}render(){return et}}rt.finalized=!0,rt.render=(t,e,r)=>{if(!r||"object"!=typeof r||!r.scopeName)throw new Error("The `scopeName` option is required.");const n=r.scopeName,i=F.has(e),s=$&&11===e.nodeType&&!!e.host,a=s&&!z.has(n),c=a?document.createDocumentFragment():e;if(((t,e,r)=>{let n=F.get(e);void 0===n&&(o(e,e.firstChild),F.set(e,n=new P(Object.assign({templateFactory:R},r))),n.appendInto(e)),n.setValue(t),n.commit()})(t,c,Object.assign({templateFactory:B(n)},r)),a){const t=F.get(c);F.delete(c);const r=t.value instanceof _?t.value.template:void 0;H(n,c,r),o(e,e.firstChild),e.appendChild(c),F.set(e,t)}!i&&s&&window.ShadyCSS.styleElement(e.host)}},function(t,e,r){"use strict";function n(t,e){return t===e}function o(t,e,r){if(null===e||null===r||e.length!==r.length)return!1;for(var n=e.length,o=0;o<n;o++)if(!t(e[o],r[o]))return!1;return!0}function i(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every((function(t){return"function"==typeof t}))){var r=e.map((function(t){return typeof t})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return e}var s=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return function(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];var s=0,a=n.pop(),c=i(n),u=t.apply(void 0,[function(){return s++,a.apply(null,arguments)}].concat(r)),l=t((function(){for(var t=[],e=c.length,r=0;r<e;r++)t.push(c[r].apply(null,arguments));return u.apply(null,t)}));return l.resultFunc=a,l.dependencies=c,l.recomputations=function(){return s},l.resetRecomputations=function(){return s=0},l}}((function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=null,i=null;return function(){return o(e,r,arguments)||(i=t.apply(null,arguments)),r=arguments,i}}));var a=r(7),c=r.n(a),u=r(5);r.d(e,"c",(function(){return l})),r.d(e,"j",(function(){return d})),r.d(e,"a",(function(){return f})),r.d(e,"e",(function(){return g})),r.d(e,"i",(function(){return m})),r.d(e,"f",(function(){return y})),r.d(e,"h",(function(){return b})),r.d(e,"g",(function(){return v})),r.d(e,"d",(function(){return _})),r.d(e,"b",(function(){return w})),r.d(e,"k",(function(){return O})),c.a.Cache=Map;const l=(t,e)=>{if(t===e)return!0;if("object"==typeof t&&"object"==typeof e&&t&&e&&t.id===e.id){if(!Array.isArray(t.components)||!Array.isArray(e.components))return!0;if(function(t,e){if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}((t.components||[]).sort(),(e.components||[]).sort()))return!0}return!1},d=t=>t.optedin||[],p=t=>t.optedout||[],f=t=>t.autoshipByDefault||{},h=t=>t.defaultFrequencies||{},g=c()(t=>s(d,p,f,(e,r,n)=>{const o=e.find(e=>l(t,e));return o||!r.find(e=>l(t,e))&&(!(!t||!n[t.id])&&{id:t.id})}),t=>JSON.stringify(t)),m=c()(t=>s(d,e=>{const r=e.find(e=>l(t,e));return r||!1}),t=>JSON.stringify(t)),y=c()(t=>s(p,e=>e.find(e=>l(t,e)))),b=c()(t=>s(g(t),t=>t&&t.frequency||null)),v=c()(t=>s(h,e=>e[t]&&Object(u.e)(e[t])||null)),_=t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),w=(t,e,r,n)=>({[r]:e&&e.hasAttribute&&e.hasAttribute(_(r))&&e[r]||e.offer&&typeof("undefined"!==e.offer[r])&&e.offer[r]||t.config&&t.config[r]||n}),O=t=>({templates:t.templates||[]})},function(t,e,r){"use strict";r.r(e),r.d(e,"optinProduct",(function(){return s})),r.d(e,"optoutProduct",(function(){return a})),r.d(e,"productHasChangedComponents",(function(){return c})),r.d(e,"productChangeFrequency",(function(){return u})),r.d(e,"concludeUpsell",(function(){return l})),r.d(e,"setMerchantId",(function(){return d})),r.d(e,"createSessionId",(function(){return p})),r.d(e,"requestAuth",(function(){return f})),r.d(e,"authorize",(function(){return h})),r.d(e,"unauthorized",(function(){return g})),r.d(e,"setAuthUrl",(function(){return m})),r.d(e,"fetchDone",(function(){return y})),r.d(e,"fetchAuth",(function(){return b})),r.d(e,"requestOrders",(function(){return v})),r.d(e,"receiveOrders",(function(){return _})),r.d(e,"receiveItems",(function(){return w})),r.d(e,"fetchOrders",(function(){return O})),r.d(e,"setEnvironment",(function(){return S})),r.d(e,"requestSessionId",(function(){return x})),r.d(e,"receiveOffer",(function(){return E})),r.d(e,"fetchResponseError",(function(){return T})),r.d(e,"requestOffer",(function(){return C})),r.d(e,"fetchOffer",(function(){return P})),r.d(e,"checkout",(function(){return k})),r.d(e,"requestCreateOneTime",(function(){return j})),r.d(e,"receiveCreateOneTime",(function(){return A})),r.d(e,"requestConvertOneTimeToSubscription",(function(){return q})),r.d(e,"receiveConvertOneTime",(function(){return N})),r.d(e,"createIu",(function(){return I})),r.d(e,"setLocale",(function(){return R})),r.d(e,"setConfig",(function(){return L})),r.d(e,"addTemplate",(function(){return F})),r.d(e,"setTemplates",(function(){return U})),r.d(e,"setFirstOrderPlaceDate",(function(){return D})),r.d(e,"setProductToSubscribe",(function(){return M}));var n=r(15),o=r(0),i=r(5);const s=(t,e)=>({type:o.k,payload:{product:t,frequency:e}}),a=t=>({type:o.l,payload:{product:t}}),c=(t,e)=>({type:o.n,payload:{newProduct:t,product:e}}),u=(t,e)=>({type:o.m,payload:{product:t,frequency:e}}),l=t=>({type:o.d,payload:{product:t}}),d=t=>({type:o.E,payload:t}),p=t=>({type:o.f,payload:`${t}.${Math.floor(999999*Math.random())}.${Math.round((new Date).getTime()/1e3)}`}),f=t=>({type:o.s,payload:t}),h=(t,e,r,n)=>({type:o.b,payload:{public_id:t,sig_field:e,ts:r,sig:n}}),g=t=>({type:o.J,payload:t}),m=t=>({type:o.x,payload:t}),y=t=>({type:o.o,payload:t}),b=(t=n.resolveAuth)=>function(e,r){const{merchantId:n,authUrl:o}=r(),i=f(o);return e(i),t(o).then(({sig_field:t,ts:r,sig:o})=>e(h(n,t,r,o)),t=>e(g(t))).finally(()=>e(y(i)))},v=(t,e)=>({type:o.w,payload:{status:t,ordering:e}}),_=t=>({type:o.q,payload:t}),w=t=>({type:o.r,payload:t}),O=(t=1,e="place")=>function(r,n){const{environment:{legoUrl:o},auth:s}=n();if(!s)return r(g("No auth set."));const a=v(t,e);return r(a),i.a.fetchOrders(o,s,t,e).then(t=>{r(_(t));const e=(t.results[0]||{}).public_id;return e?i.a.fetchItems(o,s,e).then(t=>r(w(t))):null},t=>r(g(t))).finally(()=>r(y(a)))},S=t=>{switch(t){case"dev":return{type:o.z,payload:t};case"staging":return{type:o.B,payload:t};case"prod":return{type:o.A,payload:t};default:throw new Error(`${t} is not a supported environment`)}},x=()=>(t,e)=>{const{merchantId:r,sessionId:n}=e();return(!n||r&&!n.startsWith(r))&&t(p(r)),n},E=t=>({type:o.p,payload:t}),T=t=>({type:o.h,payload:t}),C=(t,e="pdp")=>({type:o.v,payload:{product:t,module:e}}),P=(t,e="pdp")=>function(r,n){const{merchantId:o,sessionId:s,environment:{apiUrl:a}}=n(),c=C(t,e);return r(c),i.a.fetchOffer(a,o,s,t,e).then(t=>r(E(t)),t=>r(T(t))).finally(()=>r(y(c)))},k=()=>({type:o.c}),j=(t,e,r,n)=>({type:o.u,payload:{product:t,order:e,quantity:r,offerId:n}}),A=t=>({type:o.g,payload:t}),q=(t,e)=>({type:o.t,payload:{item:t,frequency:e}}),N=(t,e)=>({type:o.e,payload:{response:t,product:e}}),I=(t,e,r,n=!1,o=null)=>function(s,a){const{auth:c,environment:{legoUrl:u},previewUpsellOffer:l,offerId:d}=a();if(!c)return s(g("No auth set."));const p=j(t,e,r,d);return s(p),(l?Promise.resolve({legoUrl:u,product:t,order:e,quantity:r,offer:d}):i.a.createOneTime(u,c,t.id,e,r,d)).then(e=>(s(A(e)),n?(s(q(e,o)),(l?Promise.resolve({item:e,frequency:o}):i.a.convertOneTimeToSubscription(u,c,e,o,d)).then(e=>s(N(e,t)),t=>s(T(t)))):e),t=>s(T(t))).finally(()=>s(y(p)))},R=t=>({type:o.D,payload:t}),L=t=>({type:o.y,payload:t}),F=(t,e,r)=>({type:o.a,payload:{selector:t,markup:e,config:r}}),U=t=>({type:o.I,payload:t}),D=(t,e)=>({type:o.C,payload:{product:t,firstOrderPlaceDate:e}}),M=(t,e)=>({type:o.H,payload:{product:t,productToSubscribe:e}})},function(t,e,r){"use strict";r.r(e),r.d(e,"resolveStore",(function(){return s})),r.d(e,"createRecalcProps",(function(){return a})),r.d(e,"connect",(function(){return c})),r.d(e,"setStore",(function(){return u})),r.d(e,"unsetStore",(function(){return l}));var n=r(12);let o=null;const i=t=>({dispatch:t}),s=t=>{if(!o)throw new Error("Missing redux store.");return o},a=(t,e)=>r=>{const{getState:n,dispatch:o}=s(r),i=t?t(n(),r):{},a=e(o,r);Object.assign(r,i,a)},c=(t,e=i)=>r=>{const i=a(t,"function"==typeof e?e:t=>Object(n.b)(e,t));return class extends r{get store(){return o}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=s(this).subscribe(()=>i(this)),i(this)}attributeChangedCallback(t,e,r){super.attributeChangedCallback&&super.attributeChangedCallback(t,e,r),this._storeUnsubscribe&&e!==r&&i(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},u=t=>{o=t},l=()=>{o=void 0};e.default=c},function(t,e,r){"use strict";r.d(e,"d",(function(){return m})),r.d(e,"b",(function(){return y})),r.d(e,"c",(function(){return v})),r.d(e,"e",(function(){return _})),r.d(e,"a",(function(){return w}));var n=r(7),o=r.n(n);const i=(...t)=>JSON.stringify(t),s=t=>(...e)=>fetch(...t(...e)).then(t=>t.json()),a=t=>(e,...r)=>{if(!e)throw Error("host required");const[n,o={}]=t(...r);return[`${e.replace(/\/+$/,"")}${n}`,o]},c=t=>(e,...r)=>{if(!e)throw Error("auth required");const[n,o={}]=t(...r);return[n,{...o,headers:{Authorization:JSON.stringify(e),...o.headers}}]},u=t=>(...e)=>{const[r,n={}]=t(...e);return[r,{method:"POST",...n,body:JSON.stringify(n.body),headers:{"Content-type":"application/json",...n.headers}}]},l=(t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([t,e])=>[t,encodeURIComponent(e)].join("=")).join("&"),d=t=>JSON.stringify([].concat(t).map(t=>"object"==typeof t?t.id:t).filter(t=>t)),p=o()(s(a((t,e,r,n="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");return[`/offer/${t}/${n}?${l([["session_id",e],["page_type",1],["p",d(r)],["module_view",JSON.stringify(["regular"])]])}`]})),i),f=o()(s(a(c((t=1,e="place")=>[`/orders/?${l([["status",t],["ordering",e]])}`]))),i),h=o()(s(a(c(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),i),g=s(a(c(u((t,e,r,n)=>{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(!n)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:n}}]})))),m=t=>{if("object"==typeof t)return{...t};const[e,r]=(t||"").split(/_/).map(t=>parseInt(t,10));return e&&r&&{every:e,every_period:r}},y=t=>t.match(/^\d+_\d$/),b=(t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),v=t=>[...new Set(t&&t.split(/\s+/))].filter(y).sort(b),_=t=>{if("object"==typeof t){const{every:e,period:r,every_period:n}=t;return`${e}_${r||n}`}return"string"==typeof t?t:""},w={fetchOffer:p,fetchOrders:f,fetchItems:h,createOneTime:g,convertOneTimeToSubscription:s(a(c(u((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");const n=m(e);if(!n)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...n}}]}))))}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"d",(function(){return s})),r.d(e,"b",(function(){return a}));r(1);const n=t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},o=t=>{let e=n(t);if(!e){const r=t.offer;r&&(e=n(r))}return e},i=t=>class extends t{get offer(){return(t=>{let e=t;for(;e;){if("OG-OFFER"===e.tagName)return e;e=11===e.nodeType?e.host:e.parentNode}})(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()}},s=t=>class extends(i(t)){get product(){return o(this)}},a=t=>class extends t{get childOptions(){return this._childOptions||{options:[]}}connectedCallback(){const t=[];let e=null;this.querySelectorAll("option").forEach(r=>{const n=(t=>{const e=String(t||"").trim().match(/(\d+)\s*([dwm])/);return e?`${e[1]}_${{d:1,w:2,m:3}[e[2]]}`:t})(r.value),o=r.innerText.trim();t.push({value:n,text:o}),!e&&r.selected&&(e=n)}),this._childOptions={options:t,isSelected:e},super.connectedCallback&&super.connectedCallback()}}},function(t,e,r){(function(e){var r=/^\[object .+?Constructor\]$/,n="object"==typeof e&&e&&e.Object===Object&&e,o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();var s,a=Array.prototype,c=Function.prototype,u=Object.prototype,l=i["__core-js_shared__"],d=(s=/[^.]+$/.exec(l&&l.keys&&l.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"",p=c.toString,f=u.hasOwnProperty,h=u.toString,g=RegExp("^"+p.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),m=a.splice,y=E(i,"Map"),b=E(Object,"create");function v(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function _(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function w(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function O(t,e){for(var r,n,o=t.length;o--;)if((r=t[o][0])===(n=e)||r!=r&&n!=n)return o;return-1}function S(t){return!(!C(t)||(e=t,d&&d in e))&&(function(t){var e=C(t)?h.call(t):"";return"[object Function]"==e||"[object GeneratorFunction]"==e}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?g:r).test(function(t){if(null!=t){try{return p.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function x(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function E(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return S(r)?r:void 0}function T(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s),s};return r.cache=new(T.Cache||w),r}function C(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}v.prototype.clear=function(){this.__data__=b?b(null):{}},v.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},v.prototype.get=function(t){var e=this.__data__;if(b){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return f.call(e,t)?e[t]:void 0},v.prototype.has=function(t){var e=this.__data__;return b?void 0!==e[t]:f.call(e,t)},v.prototype.set=function(t,e){return this.__data__[t]=b&&void 0===e?"__lodash_hash_undefined__":e,this},_.prototype.clear=function(){this.__data__=[]},_.prototype.delete=function(t){var e=this.__data__,r=O(e,t);return!(r<0)&&(r==e.length-1?e.pop():m.call(e,r,1),!0)},_.prototype.get=function(t){var e=this.__data__,r=O(e,t);return r<0?void 0:e[r][1]},_.prototype.has=function(t){return O(this.__data__,t)>-1},_.prototype.set=function(t,e){var r=this.__data__,n=O(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},w.prototype.clear=function(){this.__data__={hash:new v,map:new(y||_),string:new v}},w.prototype.delete=function(t){return x(this,t).delete(t)},w.prototype.get=function(t){return x(this,t).get(t)},w.prototype.has=function(t){return x(this,t).has(t)},w.prototype.set=function(t,e){return x(this,t).set(t,e),this},T.Cache=w,t.exports=T}).call(this,r(11))},function(t,e,r){"use strict";r.d(e,"c",(function(){return o})),r.d(e,"b",(function(){return i})),r.d(e,"d",(function(){return s})),r.d(e,"a",(function(){return a}));var n=r(5);const o={type:Object,converter:{toAttribute:t=>null==t?t:JSON.stringify(t),fromAttribute:t=>t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}},i={type:String,attribute:"default-frequency",converter:{fromAttribute:t=>t&&Object(n.b)(t)?t:null}},s={type:Boolean,attribute:!0,reflect:!0},a={type:Object,attribute:!1}},function(t,e,r){"use strict";r.r(e),r.d(e,"OptinStatus",(function(){return u})),r.d(e,"mapStateToProps",(function(){return l})),r.d(e,"ConnectedOptinStatus",(function(){return d}));var n=r(1),o=r(2),i=r(4),s=r(8),a=r(6),c=r(10);class u extends(Object(a.d)(c.a)){static get properties(){return{subscribed:s.d,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"}}}static get styles(){return n.b`
|
|
147
|
+
(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const et={};class rt extends W{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const t=this.getStyles();if(Array.isArray(t)){const e=(t,r)=>t.reduceRight((t,r)=>Array.isArray(r)?e(r,t):(t.add(r),t),r),r=e(t,new Set),n=[];r.forEach(t=>n.unshift(t)),this._styles=n}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map(t=>{if(t instanceof CSSStyleSheet&&!Q){const e=Array.prototype.slice.call(t.cssRules).reduce((t,e)=>t+e.cssText,"");return new X(String(e),K)}return t})}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(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?Q?this.renderRoot.adoptedStyleSheets=t.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map(t=>t.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){const e=this.render();super.update(t),e!==et&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)}))}render(){return et}}rt.finalized=!0,rt.render=(t,e,r)=>{if(!r||"object"!=typeof r||!r.scopeName)throw new Error("The `scopeName` option is required.");const n=r.scopeName,i=F.has(e),s=$&&11===e.nodeType&&!!e.host,a=s&&!z.has(n),c=a?document.createDocumentFragment():e;if(((t,e,r)=>{let n=F.get(e);void 0===n&&(o(e,e.firstChild),F.set(e,n=new P(Object.assign({templateFactory:R},r))),n.appendInto(e)),n.setValue(t),n.commit()})(t,c,Object.assign({templateFactory:B(n)},r)),a){const t=F.get(c);F.delete(c);const r=t.value instanceof _?t.value.template:void 0;H(n,c,r),o(e,e.firstChild),e.appendChild(c),F.set(e,t)}!i&&s&&window.ShadyCSS.styleElement(e.host)}},function(t,e,r){"use strict";function n(t,e){return t===e}function o(t,e,r){if(null===e||null===r||e.length!==r.length)return!1;for(var n=e.length,o=0;o<n;o++)if(!t(e[o],r[o]))return!1;return!0}function i(t){var e=Array.isArray(t[0])?t[0]:t;if(!e.every((function(t){return"function"==typeof t}))){var r=e.map((function(t){return typeof t})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return e}var s=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return function(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];var s=0,a=n.pop(),c=i(n),u=t.apply(void 0,[function(){return s++,a.apply(null,arguments)}].concat(r)),l=t((function(){for(var t=[],e=c.length,r=0;r<e;r++)t.push(c[r].apply(null,arguments));return u.apply(null,t)}));return l.resultFunc=a,l.dependencies=c,l.recomputations=function(){return s},l.resetRecomputations=function(){return s=0},l}}((function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=null,i=null;return function(){return o(e,r,arguments)||(i=t.apply(null,arguments)),r=arguments,i}}));var a=r(7),c=r.n(a),u=r(5);r.d(e,"c",(function(){return l})),r.d(e,"j",(function(){return d})),r.d(e,"a",(function(){return f})),r.d(e,"e",(function(){return g})),r.d(e,"i",(function(){return m})),r.d(e,"f",(function(){return y})),r.d(e,"h",(function(){return b})),r.d(e,"g",(function(){return v})),r.d(e,"d",(function(){return _})),r.d(e,"b",(function(){return w})),r.d(e,"k",(function(){return O})),c.a.Cache=Map;const l=(t,e)=>{if(t===e)return!0;if("object"==typeof t&&"object"==typeof e&&t&&e&&t.id===e.id){if(!Array.isArray(t.components)||!Array.isArray(e.components))return!0;if(function(t,e){if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}((t.components||[]).sort(),(e.components||[]).sort()))return!0}return!1},d=t=>t.optedin||[],p=t=>t.optedout||[],f=t=>t.autoshipByDefault||{},h=t=>t.defaultFrequencies||{},g=c()(t=>s(d,p,f,(e,r,n)=>{const o=e.find(e=>l(t,e));return o||!r.find(e=>l(t,e))&&(!(!t||!n[t.id])&&{id:t.id})}),t=>JSON.stringify(t)),m=c()(t=>s(d,e=>{const r=e.find(e=>l(t,e));return r||!1}),t=>JSON.stringify(t)),y=c()(t=>s(p,e=>e.find(e=>l(t,e)))),b=c()(t=>s(g(t),t=>t&&t.frequency||null)),v=c()(t=>s(h,e=>e[t]&&Object(u.e)(e[t])||null)),_=t=>t.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),w=(t,e,r,n)=>({[r]:e&&e.hasAttribute&&e.hasAttribute(_(r))&&e[r]||e.offer&&typeof("undefined"!==e.offer[r])&&e.offer[r]||t.config&&t.config[r]||n}),O=t=>({templates:t.templates||[]})},function(t,e,r){"use strict";r.r(e),r.d(e,"optinProduct",(function(){return s})),r.d(e,"optoutProduct",(function(){return a})),r.d(e,"productHasChangedComponents",(function(){return c})),r.d(e,"productChangeFrequency",(function(){return u})),r.d(e,"concludeUpsell",(function(){return l})),r.d(e,"setMerchantId",(function(){return d})),r.d(e,"createSessionId",(function(){return p})),r.d(e,"requestAuth",(function(){return f})),r.d(e,"authorize",(function(){return h})),r.d(e,"unauthorized",(function(){return g})),r.d(e,"setAuthUrl",(function(){return m})),r.d(e,"fetchDone",(function(){return y})),r.d(e,"fetchAuth",(function(){return b})),r.d(e,"requestOrders",(function(){return v})),r.d(e,"receiveOrders",(function(){return _})),r.d(e,"receiveItems",(function(){return w})),r.d(e,"fetchOrders",(function(){return O})),r.d(e,"setEnvironment",(function(){return S})),r.d(e,"requestSessionId",(function(){return x})),r.d(e,"receiveOffer",(function(){return E})),r.d(e,"fetchResponseError",(function(){return T})),r.d(e,"requestOffer",(function(){return C})),r.d(e,"fetchOffer",(function(){return P})),r.d(e,"checkout",(function(){return k})),r.d(e,"requestCreateOneTime",(function(){return j})),r.d(e,"receiveCreateOneTime",(function(){return A})),r.d(e,"requestConvertOneTimeToSubscription",(function(){return q})),r.d(e,"receiveConvertOneTime",(function(){return N})),r.d(e,"createIu",(function(){return I})),r.d(e,"setLocale",(function(){return R})),r.d(e,"setConfig",(function(){return L})),r.d(e,"addTemplate",(function(){return F})),r.d(e,"setTemplates",(function(){return U})),r.d(e,"setFirstOrderPlaceDate",(function(){return D})),r.d(e,"setProductToSubscribe",(function(){return M}));var n=r(15),o=r(0),i=r(5);const s=(t,e)=>({type:o.k,payload:{product:t,frequency:e}}),a=t=>({type:o.l,payload:{product:t}}),c=(t,e)=>({type:o.n,payload:{newProduct:t,product:e}}),u=(t,e)=>({type:o.m,payload:{product:t,frequency:e}}),l=t=>({type:o.d,payload:{product:t}}),d=t=>({type:o.E,payload:t}),p=t=>({type:o.f,payload:`${t}.${Math.floor(999999*Math.random())}.${Math.round((new Date).getTime()/1e3)}`}),f=t=>({type:o.s,payload:t}),h=(t,e,r,n)=>({type:o.b,payload:{public_id:t,sig_field:e,ts:r,sig:n}}),g=t=>({type:o.J,payload:t}),m=t=>({type:o.x,payload:t}),y=t=>({type:o.o,payload:t}),b=(t=n.resolveAuth)=>function(e,r){if(window.og&&window.og.previewMode)return e(g({message:"Offers are running in preview mode"}));const{merchantId:n,authUrl:o}=r(),i=f(o);return e(i),t(o).then(({sig_field:t,ts:r,sig:o})=>e(h(n,t,r,o)),t=>e(g(t))).finally(()=>e(y(i)))},v=(t,e)=>({type:o.w,payload:{status:t,ordering:e}}),_=t=>({type:o.q,payload:t}),w=t=>({type:o.r,payload:t}),O=(t=1,e="place")=>function(r,n){const{environment:{legoUrl:o},auth:s}=n();if(!s)return r(g("No auth set."));const a=v(t,e);return r(a),i.a.fetchOrders(o,s,t,e).then(t=>{r(_(t));const e=(t.results[0]||{}).public_id;return e?i.a.fetchItems(o,s,e).then(t=>r(w(t))):null},t=>r(g(t))).finally(()=>r(y(a)))},S=t=>{switch(t){case"dev":return{type:o.z,payload:t};case"staging":return{type:o.B,payload:t};case"prod":return{type:o.A,payload:t};default:throw new Error(`${t} is not a supported environment`)}},x=()=>(t,e)=>{const{merchantId:r,sessionId:n}=e();return(!n||r&&!n.startsWith(r))&&t(p(r)),n},E=t=>({type:o.p,payload:t}),T=t=>({type:o.h,payload:t}),C=(t,e="pdp")=>({type:o.v,payload:{product:t,module:e}}),P=(t,e="pdp")=>function(r,n){const{merchantId:o,sessionId:s,environment:{apiUrl:a}}=n(),c=C(t,e);return r(c),i.a.fetchOffer(a,o,s,t,e).then(t=>r(E(t)),t=>r(T(t))).finally(()=>r(y(c)))},k=()=>({type:o.c}),j=(t,e,r,n)=>({type:o.u,payload:{product:t,order:e,quantity:r,offerId:n}}),A=t=>({type:o.g,payload:t}),q=(t,e)=>({type:o.t,payload:{item:t,frequency:e}}),N=(t,e)=>({type:o.e,payload:{response:t,product:e}}),I=(t,e,r,n=!1,o=null)=>function(s,a){const{auth:c,environment:{legoUrl:u},previewUpsellOffer:l,offerId:d}=a();if(!c)return s(g("No auth set."));const p=j(t,e,r,d);return s(p),(l?Promise.resolve({legoUrl:u,product:t,order:e,quantity:r,offer:d}):i.a.createOneTime(u,c,t.id,e,r,d)).then(e=>(s(A(e)),n?(s(q(e,o)),(l?Promise.resolve({item:e,frequency:o}):i.a.convertOneTimeToSubscription(u,c,e,o,d)).then(e=>s(N(e,t)),t=>s(T(t)))):e),t=>s(T(t))).finally(()=>s(y(p)))},R=t=>({type:o.D,payload:t}),L=t=>({type:o.y,payload:t}),F=(t,e,r)=>({type:o.a,payload:{selector:t,markup:e,config:r}}),U=t=>({type:o.I,payload:t}),D=(t,e)=>({type:o.C,payload:{product:t,firstOrderPlaceDate:e}}),M=(t,e)=>({type:o.H,payload:{product:t,productToSubscribe:e}})},function(t,e,r){"use strict";r.r(e),r.d(e,"resolveStore",(function(){return s})),r.d(e,"createRecalcProps",(function(){return a})),r.d(e,"connect",(function(){return c})),r.d(e,"setStore",(function(){return u})),r.d(e,"unsetStore",(function(){return l}));var n=r(12);let o=null;const i=t=>({dispatch:t}),s=t=>{if(!o)throw new Error("Missing redux store.");return o},a=(t,e)=>r=>{const{getState:n,dispatch:o}=s(r),i=t?t(n(),r):{},a=e(o,r);Object.assign(r,i,a)},c=(t,e=i)=>r=>{const i=a(t,"function"==typeof e?e:t=>Object(n.b)(e,t));return class extends r{get store(){return o}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=s(this).subscribe(()=>i(this)),i(this)}attributeChangedCallback(t,e,r){super.attributeChangedCallback&&super.attributeChangedCallback(t,e,r),this._storeUnsubscribe&&e!==r&&i(this)}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}}},u=t=>{o=t},l=()=>{o=void 0};e.default=c},function(t,e,r){"use strict";r.d(e,"d",(function(){return m})),r.d(e,"b",(function(){return y})),r.d(e,"c",(function(){return v})),r.d(e,"e",(function(){return _})),r.d(e,"a",(function(){return w}));var n=r(7),o=r.n(n);const i=(...t)=>JSON.stringify(t),s=t=>(...e)=>fetch(...t(...e)).then(t=>t.json()),a=t=>(e,...r)=>{if(!e)throw Error("host required");const[n,o={}]=t(...r);return[`${e.replace(/\/+$/,"")}${n}`,o]},c=t=>(e,...r)=>{if(!e)throw Error("auth required");const[n,o={}]=t(...r);return[n,{...o,headers:{Authorization:JSON.stringify(e),...o.headers}}]},u=t=>(...e)=>{const[r,n={}]=t(...e);return[r,{method:"POST",...n,body:JSON.stringify(n.body),headers:{"Content-type":"application/json",...n.headers}}]},l=(t=[])=>(Array.isArray(t)?t:Object.entries(t)).map(([t,e])=>[t,encodeURIComponent(e)].join("=")).join("&"),d=t=>JSON.stringify([].concat(t).map(t=>"object"==typeof t?t.id:t).filter(t=>t)),p=o()(s(a((t,e,r,n="pdp")=>{if(!t)throw Error("merchantId required");if(!e)throw Error("sessionId required");if(!r)throw Error("product required");return[`/offer/${t}/${n}?${l([["session_id",e],["page_type",1],["p",d(r)],["module_view",JSON.stringify(["regular"])]])}`]})),i),f=o()(s(a(c((t=1,e="place")=>[`/orders/?${l([["status",t],["ordering",e]])}`]))),i),h=o()(s(a(c(t=>{if(!t)throw Error("orderId required");return[`/items/?order=${t}`]}))),i),g=s(a(c(u((t,e,r,n)=>{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(!n)throw Error("offer required");return["/items/iu/",{body:{product:t,order:e,quantity:r,offer:n}}]})))),m=t=>{if("object"==typeof t)return{...t};const[e,r]=(t||"").split(/_/).map(t=>parseInt(t,10));return e&&r&&{every:e,every_period:r}},y=t=>t.match(/^\d+_\d$/),b=(t,e)=>String.prototype.localeCompare.call(t&&t.split("_").reverse().join("_"),e&&e.split("_").reverse().join("_")),v=t=>[...new Set(t&&t.split(/\s+/))].filter(y).sort(b),_=t=>{if("object"==typeof t){const{every:e,period:r,every_period:n}=t;return`${e}_${r||n}`}return"string"==typeof t?t:""},w={fetchOffer:p,fetchOrders:f,fetchItems:h,createOneTime:g,convertOneTimeToSubscription:s(a(c(u((t,e,r)=>{if(!t)throw Error("item required");if(!e)throw Error("frequency required");const n=m(e);if(!n)throw Error("invalid frequency");return["/subscriptions/create_from_item/",{body:{item:t.public_id,offer:r,...n}}]}))))}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"d",(function(){return s})),r.d(e,"b",(function(){return a}));r(1);const n=t=>t.hasAttribute("product")&&{id:t.getAttribute("product"),...t.hasAttribute("product-components")&&{components:JSON.parse(t.getAttribute("product-components"))}},o=t=>{let e=n(t);if(!e){const r=t.offer;r&&(e=n(r))}return e},i=t=>class extends t{get offer(){return(t=>{let e=t;for(;e;){if("OG-OFFER"===e.tagName)return e;e=11===e.nodeType?e.host:e.parentNode}})(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()}},s=t=>class extends(i(t)){get product(){return o(this)}},a=t=>class extends t{get childOptions(){return this._childOptions||{options:[]}}connectedCallback(){const t=[];let e=null;this.querySelectorAll("option").forEach(r=>{const n=(t=>{const e=String(t||"").trim().match(/(\d+)\s*([dwm])/);return e?`${e[1]}_${{d:1,w:2,m:3}[e[2]]}`:t})(r.value),o=r.innerText.trim();t.push({value:n,text:o}),!e&&r.selected&&(e=n)}),this._childOptions={options:t,isSelected:e},super.connectedCallback&&super.connectedCallback()}}},function(t,e,r){(function(e){var r=/^\[object .+?Constructor\]$/,n="object"==typeof e&&e&&e.Object===Object&&e,o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();var s,a=Array.prototype,c=Function.prototype,u=Object.prototype,l=i["__core-js_shared__"],d=(s=/[^.]+$/.exec(l&&l.keys&&l.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"",p=c.toString,f=u.hasOwnProperty,h=u.toString,g=RegExp("^"+p.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),m=a.splice,y=E(i,"Map"),b=E(Object,"create");function v(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function _(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function w(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function O(t,e){for(var r,n,o=t.length;o--;)if((r=t[o][0])===(n=e)||r!=r&&n!=n)return o;return-1}function S(t){return!(!C(t)||(e=t,d&&d in e))&&(function(t){var e=C(t)?h.call(t):"";return"[object Function]"==e||"[object GeneratorFunction]"==e}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?g:r).test(function(t){if(null!=t){try{return p.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function x(t,e){var r,n,o=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function E(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return S(r)?r:void 0}function T(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return r.cache=i.set(o,s),s};return r.cache=new(T.Cache||w),r}function C(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}v.prototype.clear=function(){this.__data__=b?b(null):{}},v.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},v.prototype.get=function(t){var e=this.__data__;if(b){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return f.call(e,t)?e[t]:void 0},v.prototype.has=function(t){var e=this.__data__;return b?void 0!==e[t]:f.call(e,t)},v.prototype.set=function(t,e){return this.__data__[t]=b&&void 0===e?"__lodash_hash_undefined__":e,this},_.prototype.clear=function(){this.__data__=[]},_.prototype.delete=function(t){var e=this.__data__,r=O(e,t);return!(r<0)&&(r==e.length-1?e.pop():m.call(e,r,1),!0)},_.prototype.get=function(t){var e=this.__data__,r=O(e,t);return r<0?void 0:e[r][1]},_.prototype.has=function(t){return O(this.__data__,t)>-1},_.prototype.set=function(t,e){var r=this.__data__,n=O(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},w.prototype.clear=function(){this.__data__={hash:new v,map:new(y||_),string:new v}},w.prototype.delete=function(t){return x(this,t).delete(t)},w.prototype.get=function(t){return x(this,t).get(t)},w.prototype.has=function(t){return x(this,t).has(t)},w.prototype.set=function(t,e){return x(this,t).set(t,e),this},T.Cache=w,t.exports=T}).call(this,r(11))},function(t,e,r){"use strict";r.d(e,"c",(function(){return o})),r.d(e,"b",(function(){return i})),r.d(e,"d",(function(){return s})),r.d(e,"a",(function(){return a}));var n=r(5);const o={type:Object,converter:{toAttribute:t=>null==t?t:JSON.stringify(t),fromAttribute:t=>t&&t.match(/[{[]/)?JSON.parse(t):{id:t}}},i={type:String,attribute:"default-frequency",converter:{fromAttribute:t=>t&&Object(n.b)(t)?t:null}},s={type:Boolean,attribute:!0,reflect:!0},a={type:Object,attribute:!1}},function(t,e,r){"use strict";r.r(e),r.d(e,"OptinStatus",(function(){return u})),r.d(e,"mapStateToProps",(function(){return l})),r.d(e,"ConnectedOptinStatus",(function(){return d}));var n=r(1),o=r(2),i=r(4),s=r(8),a=r(6),c=r(10);class u extends(Object(a.d)(c.a)){static get properties(){return{subscribed:s.d,frequencyMatch:{type:Boolean,reflect:!0,attribute:"frequency-match"}}}static get styles(){return n.b`
|
|
148
148
|
:host {
|
|
149
149
|
cursor: default;
|
|
150
150
|
display: inline-block;
|
|
@@ -233,7 +233,7 @@ const Q=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShad
|
|
|
233
233
|
<slot name="frequency-mismatch"></slot>
|
|
234
234
|
`||""}
|
|
235
235
|
</span>
|
|
236
|
-
`}}const p=(t,e)=>({subscribed:Object(o.e)(e.product)(t),frequency:Object(o.h)(e.product)(t),productDefaultFrequency:Object(o.g)((e.product||{}).id)(t),...Object(o.b)(t,e,"frequencies",[]),...Object(o.b)(t,e,"defaultFrequency"),...Object(o.k)(t,e)}),f=Object(i.connect)(p)(d);e.default=f},function(t,e,r){"use strict";r.r(e),function(t){r.d(e,"STORE_ROOT",(function(){return s})),r.d(e,"safeParseState",(function(){return a})),r.d(e,"loadState",(function(){return u})),r.d(e,"serializeState",(function(){return l})),r.d(e,"saveState",(function(){return d})),r.d(e,"listenLocalStorageChanges",(function(){return p})),r.d(e,"clearState",(function(){return f}));var n=r(17),o=r(3),i=r(0);const s="OG_STATE",a=t=>{try{if(null===t)return;return JSON.parse(t)}catch(t){return}},c=()=>window.og&&window.og.previewMode,u=()=>c?{}:a(localStorage.getItem(s)),l=t=>!(!t||!t.sessionId)&&JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),d=t=>{if(c())return;const e=l(t);e&&localStorage.getItem(s)!==e&&localStorage.setItem(s,e)},p=e=>Object(n.throttle)(500,r=>{if(c())return;const{key:n,newValue:u}=r;n===s&&null===u?(e.dispatch({type:i.j}),t(()=>e.dispatch(Object(o.requestSessionId)()))):n===s&&e.dispatch({type:i.i,newValue:a(u)})}),f=()=>localStorage.removeItem(s)}.call(this,r(16).setImmediate)},function(t,e,r){window,t.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";r.r(e),r.d(e,"ogAuthRegExp",(function(){return n})),r.d(e,"readAuthCookie",(function(){return o})),r.d(e,"parseAuth",(function(){return i})),r.d(e,"iframeLoad",(function(){return s})),r.d(e,"isJsonResponse",(function(){return a})),r.d(e,"resolveAuth",(function(){return c}));const n=/^og_auth=/,o=(t=n)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(n,""),i=t=>{if("object"==typeof t)return t;const e=(t||"").split("|");return 3===e.length?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},s=t=>new Promise((e,r)=>{const n=document.createElement("iframe");n.style.setProperty("display","none","important"),document.body.appendChild(n),n.onload=e,n.onerror=r,n.src=t}),a=t=>-1!==(t.headers.get("content-type")||"").indexOf("application/json"),c=(t,e=o,r=s)=>Promise.resolve(e()||t&&"string"==typeof t&&fetch(t).then(n=>n.status>=200&&n.status<300?e()||(a(n)?n.json():Promise.resolve(r(t)).then(e)):null)).then(i).then(t=>null===t?Promise.reject(new Error("Unauthorized")):t);e.default=c}])},function(t,e,r){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new i(o.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new i(o.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(19),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(11))},function(t,e,r){!function(t){"use strict";function e(t,e,r,n){var o,i=!1,s=0;function a(){o&&clearTimeout(o)}function c(){for(var c=arguments.length,u=new Array(c),l=0;l<c;l++)u[l]=arguments[l];var d=this,p=Date.now()-s;function f(){s=Date.now(),r.apply(d,u)}function h(){o=void 0}i||(n&&!o&&f(),a(),void 0===n&&p>t?f():!0!==e&&(o=setTimeout(n?h:f,void 0===n?t-p:t)))}return"boolean"!=typeof e&&(n=r,r=e,e=void 0),c.cancel=function(){a(),i=!0},c}t.debounce=function(t,r,n){return void 0===n?e(t,r,!1):e(t,n,!1!==r)},t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})}(e)},,function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var n,o,i,s,a,c=1,u={},l=!1,d=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){h(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((i=new MessageChannel).port1.onmessage=function(t){h(t.data)},n=function(t){i.port2.postMessage(t)}):d&&"onreadystatechange"in d.createElement("script")?(o=d.documentElement,n=function(t){var e=d.createElement("script");e.onreadystatechange=function(){h(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):n=function(t){setTimeout(h,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&h(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(s+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var o={callback:t,args:e};return u[c]=o,n(c),c++},p.clearImmediate=f}function f(t){delete u[t]}function h(t){if(l)setTimeout(h,0,t);else{var e=u[t];if(e){l=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(void 0,r)}}(e)}finally{f(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,r(11),r(20))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,u=[],l=!1,d=-1;function p(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&f())}function f(){if(!l){var t=a(p);l=!0;for(var e=u.length;e;){for(c=u,u=[];++d<e;)c&&c[d].run();d=-1,e=u.length}c=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function g(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new h(t,e)),1!==u.length||l||a(f)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){const r={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"};t.exports=r},,function(t,e,r){"use strict";(function(t,n){var o,i=r(25);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:n;var s=Object(i.a)(o);e.a=s}).call(this,r(11),r(30)(t))},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return c})),r.d(e,"b",(function(){return u}));var n=r(17),o=r(0),i=(r(2),r(14));const s=e=>({payload:{product:{id:r,components:n}={}}={}}={})=>t(()=>((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})))("optin-changed",{productId:r,components:n,optedIn:e})),a=[{expressions:[({type:t}={})=>t===o.k,({type:t}={})=>t===o.m],fn:s(!0)},{expressions:[({type:t}={})=>t===o.l],fn:s(!1)}],c=t=>e=>r=>{const n=t.getState();a.forEach(t=>{t.expressions.some(t=>t(r,n))&&t.fn(r)}),e(r)},u=t=>e=>r=>{e(r);const s=Object(n.throttle)(500,()=>{Object(i.saveState)({...t.getState()})});r.type!==o.i&&s()}}).call(this,r(16).setImmediate)},function(t,e,r){"use strict";function n(t){var e,r=t.Symbol;return"function"==typeof r?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}r.d(e,"a",(function(){return n}))},function(t,e,r){const n=r(32),o=r(33),i=r(34);t.exports={parse:(t,e)=>{const r=n(t),s=o.PolishNotation(r),a=o.PolishGenerator(s),c=i.make(a);return i.nodeEvaluator(c,e)}}},,function(t,e,r){const{offersLiveEditor:n}=r(29),{setStore:o}=r(4),{getStore:i}=r(50),{listenLocalStorageChanges:s}=r(14),a=r(31),c=r(3),{ConnectedWhen:u}=r(51),{ConnectedOptinButton:l}=r(35),{ConnectedOptoutButton:d}=r(36),{ConnectedOptinSelect:p}=r(37),{ConnectedUpsellButton:f}=r(38),{ConnectedUpsellModal:h}=r(39),{ConnectedOptinToggle:g}=r(40),{ConnectedOptinStatus:m}=r(9),{ConnectedText:y}=r(41),{ConnectedIncentiveText:b}=r(42),{ConnectedSelectFrequency:v}=r(43),{ConnectedNextUpcomingOrder:_}=r(52),{ConnectedOffer:w}=r(44),{Modal:O}=r(45),{Select:S}=r(46),{Tooltip:x}=r(47),{ConnectedFrequencyStatus:E}=r(13);let T;r(48).enable();const C={setEnvironment:t=>(T.dispatch(c.setEnvironment(t)),C),setMerchantId:t=>(T.dispatch(c.setMerchantId(t)),C),setAuthUrl:t=>(T.dispatch(c.setAuthUrl(t)),C),getProductsForPurchasePost:(t=[])=>a.getProductsForPurchasePost(T.getState(),t),getOptins:(t=[])=>a.getProductsForPurchasePost(T.getState(),t),clear(){T.dispatch(c.checkout())},addOptinChangedCallback(t){"function"==typeof t&&document.addEventListener("optin-changed",e=>t(e.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",t=>t.stopPropagation(),!0)},register(){try{customElements.define("og-when",u),customElements.define("og-text",y),customElements.define("og-incentive-text",b),customElements.define("og-offer",w),customElements.define("og-select-frequency",v),customElements.define("og-optout-button",d),customElements.define("og-optin-toggle",g),customElements.define("og-optin-status",m),customElements.define("og-optin-button",l),customElements.define("og-optin-select",p),customElements.define("og-upsell-button",f),customElements.define("og-frequency-status",E),customElements.define("og-modal",O),customElements.define("og-select",S),customElements.define("og-tooltip",x),customElements.define("og-upsell-modal",h),customElements.define("og-next-upcoming-order",_)}catch(t){console.error(t)}C.register=()=>0},previewMode(t){return window.og=window.og||{},!1===t?delete window.og:window.og.previewMode=!0,this},initialize:(t,e,r)=>C.isReady?(console.warn("og.offers has been initialized already. Skipping."),C):(T=i(),o(T),t&&C.setMerchantId(t),e&&C.setEnvironment(e),r&&C.setAuthUrl(r),window.addEventListener("storage",s(T)),t&&e&&(T.dispatch(c.requestSessionId()),T.dispatch(c.fetchAuth()),C.register()),C.isReady=!0,C),config:t=>(T.dispatch(c.setConfig(t)),C),setLocale:t=>(T.dispatch(c.setLocale(t)),C),addTemplate:(t,e,r)=>(T.dispatch(c.addTemplate(t,e,r)),C),setTemplates:t=>(T.dispatch(c.setTemplates(t)),C),setPublicPath:t=>(r.p=t,C)};window.OG=window.OG||{},Object.assign(window.OG,C),Object.assign(C.initialize,C),n(),t.exports=C.initialize},function(t,e,r){window,t.exports=function(t){function e(e){for(var r,o,i=e[0],s=e[1],a=0,u=[];a<i.length;a++)o=i[a],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&u.push(n[o][0]),n[o]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(t[r]=s[r]);for(c&&c(e);u.length;)u.shift()()}var r={},n={0:0};function o(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.e=function(t){var e=[],r=n[t];if(0!==r)if(r)e.push(r[2]);else{var i=new Promise((function(e,o){r=n[t]=[e,o]}));e.push(r[2]=i);var s,a=document.createElement("script");a.charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.src=function(t){return o.p+""+t+".offers-live-editor.js"}(t);var c=new Error;s=function(e){a.onerror=a.onload=null,clearTimeout(u);var r=n[t];if(0!==r){if(r){var o=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;c.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",c.name="ChunkLoadError",c.type=o,c.request=i,r[1](c)}n[t]=void 0}};var u=setTimeout((function(){s({type:"timeout",target:a})}),12e4);a.onerror=a.onload=s,document.head.appendChild(a)}return Promise.all(e)},o.m=t,o.c=r,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="//static.ordergroove.com/@ordergroove/offers-live-editor/0.3.0/dist/",o.oe=function(t){throw console.error(t),t};var i=window.webpackJsonp=window.webpackJsonp||[],s=i.push.bind(i);i.push=e,i=i.slice();for(var a=0;a<i.length;a++)e(i[a]);var c=s;return o(o.s=0)}([function(t,e,r){"use strict";r.r(e),r.d(e,"offersLiveEditor",(function(){return s}));const n=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],o=t=>(e,r)=>{n.forEach(n=>t.postMessage({ogType:e,...r},n))};function i(t){const e=(t=>e=>t.indexOf(e.origin)>=0)(n),s=o(t.source);e(t)&&"READY"===t.data.ogType&&r.e(1).then(r.bind(null,2)).then(({initializeClient:t})=>{t(e,s),window.removeEventListener("message",i)})}function s(t=window.opener){t&&t!==window&&(window.addEventListener("message",i),o(t)("READY"))}e.default=s}])},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(t,e,r){"use strict";r.r(e),r.d(e,"getProductsForPurchasePost",(function(){return o}));var n=r(5);const o=(t={},e=[])=>(t.optedin||[]).map(e=>{const r={product:e.id,subscription_info:{components:e.components||[]},tracking_override:{offer:((t.productOffer||{})[e.id]||[])[0],...Object(n.d)(e.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[e.id]&&(r.subscription_info.first_order_place_date=t.firstOrderPlaceDate[e.id]),t.productToSubscribe&&t.productToSubscribe[e.id]&&(r.tracking_override.product=t.productToSubscribe[e.id]),r}).filter(t=>t.tracking_override.offer).filter(t=>e.length?e.includes(t.product):t);e.default={getProductsForPurchasePost:o}},function(t,e,r){const n=r(21);t.exports=t=>{let e="";const r=[];for(const o of t){const t=o.charCodeAt(0);switch(t){case n.PAR_OPEN:case n.PAR_CLOSE:case n.OP_NOT:case n.BINARY_AND:case n.BINARY_OR:e&&(r.push({type:n.LITERAL,value:e}),e=""),r.push({type:t,value:o});break;default:e+=o}}return e&&r.push({type:n.LITERAL,value:e}),r}},function(t,e,r){const n=r(21);t.exports={PolishNotation:t=>{const e=[],r=[];return t.forEach(t=>{switch(t.type){case n.LITERAL:e.unshift(t);break;case n.BINARY_AND:case n.BINARY_OR:case n.OP_NOT:case n.PAR_OPEN:r.push(t);break;case n.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==n.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===n.OP_NOT&&e.unshift(r.pop())}}),r.length&&[...r.reverse(),...e]||e},PolishGenerator:function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]}}},function(t,e,r){const n=r(21);class o{constructor(t,e,r,n){this.op=t,this.left=e,this.right=r,this.literal=n}isLeaf(){return this.op===n.LEAF}isAtomic(){return this.isLeaf()||this.op===n.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(t,e){return new o(n.BINARY_AND,t,e)}static CreateNot(t){return new o(n.OP_NOT,t)}static CreateOr(t,e){return new o(n.BINARY_OR,t,e)}static CreateLiteral(t){return new o(n.LEAF,null,null,t)}}const i=t=>{const e=t.next().value;switch(e.type){case n.LITERAL:return o.CreateLiteral(e.value);case n.OP_NOT:return o.CreateNot(i(t));case n.BINARY_AND:{const e=i(t),r=i(t);return o.CreateAnd(e,r)}case n.BINARY_OR:{const e=i(t),r=i(t);return o.CreateOr(e,r)}}return null},s=(t,e)=>t.isLeaf()?e(t.getLiteralValue()):t.op===n.OP_NOT?!s(t.left,e):t.op===n.BINARY_OR?s(t.left,e)||s(t.right,e):t.op===n.BINARY_AND?s(t.left,e)&&s(t.right,e):void 0;t.exports={make:i,nodeEvaluator:s}},function(t,e,r){"use strict";r.r(e),r.d(e,"OptinButton",(function(){return u})),r.d(e,"ConnectedOptinButton",(function(){return l}));var n=r(1),o=r(3),i=r(9),s=r(4),a=r(8),c=r(6);class u extends i.OptinStatus{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:a.b,optinButtonLabel:{type:String}}}handleClick(t){this.optinProduct(Object(c.a)(this),this.defaultFrequency),t.preventDefault()}render(){return n.c`
|
|
236
|
+
`}}const p=(t,e)=>({subscribed:Object(o.e)(e.product)(t),frequency:Object(o.h)(e.product)(t),productDefaultFrequency:Object(o.g)((e.product||{}).id)(t),...Object(o.b)(t,e,"frequencies",[]),...Object(o.b)(t,e,"defaultFrequency"),...Object(o.k)(t,e)}),f=Object(i.connect)(p)(d);e.default=f},function(t,e,r){"use strict";r.r(e),function(t){r.d(e,"STORE_ROOT",(function(){return s})),r.d(e,"safeParseState",(function(){return a})),r.d(e,"loadState",(function(){return u})),r.d(e,"serializeState",(function(){return l})),r.d(e,"saveState",(function(){return d})),r.d(e,"listenLocalStorageChanges",(function(){return p})),r.d(e,"clearState",(function(){return f}));var n=r(17),o=r(3),i=r(0);const s="OG_STATE",a=t=>{try{if(null===t)return;return JSON.parse(t)}catch(t){return}},c=()=>window.og&&window.og.previewMode,u=()=>c()?{}:a(localStorage.getItem(s)),l=t=>!(!t||!t.sessionId)&&JSON.stringify({sessionId:t.sessionId,optedin:t.optedin,optedout:t.optedout,productOffer:t.productOffer,firstOrderPlaceDate:t.firstOrderPlaceDate,productToSubscribe:t.productToSubscribe}),d=t=>{if(c())return;const e=l(t);e&&localStorage.getItem(s)!==e&&localStorage.setItem(s,e)},p=e=>Object(n.throttle)(500,r=>{if(c())return;const{key:n,newValue:u}=r;n===s&&null===u?(e.dispatch({type:i.j}),t(()=>e.dispatch(Object(o.requestSessionId)()))):n===s&&e.dispatch({type:i.i,newValue:a(u)})}),f=()=>localStorage.removeItem(s)}.call(this,r(16).setImmediate)},function(t,e,r){window,t.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";r.r(e),r.d(e,"ogAuthRegExp",(function(){return n})),r.d(e,"readAuthCookie",(function(){return o})),r.d(e,"parseAuth",(function(){return i})),r.d(e,"iframeLoad",(function(){return s})),r.d(e,"isJsonResponse",(function(){return a})),r.d(e,"resolveAuth",(function(){return c}));const n=/^og_auth=/,o=(t=n)=>(document.cookie.split(/;\s*/).find(e=>e.match(t))||"").replace(n,""),i=t=>{if("object"==typeof t)return t;const e=(t||"").split("|");return 3===e.length?{sig_field:e[0],ts:parseInt(e[1],10),sig:e[2]}:null},s=t=>new Promise((e,r)=>{const n=document.createElement("iframe");n.style.setProperty("display","none","important"),document.body.appendChild(n),n.onload=e,n.onerror=r,n.src=t}),a=t=>-1!==(t.headers.get("content-type")||"").indexOf("application/json"),c=(t,e=o,r=s)=>Promise.resolve(e()||t&&"string"==typeof t&&fetch(t).then(n=>n.status>=200&&n.status<300?e()||(a(n)?n.json():Promise.resolve(r(t)).then(e)):null)).then(i).then(t=>null===t?Promise.reject(new Error("Unauthorized")):t);e.default=c}])},function(t,e,r){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new i(o.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new i(o.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(19),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(11))},function(t,e,r){!function(t){"use strict";function e(t,e,r,n){var o,i=!1,s=0;function a(){o&&clearTimeout(o)}function c(){for(var c=arguments.length,u=new Array(c),l=0;l<c;l++)u[l]=arguments[l];var d=this,p=Date.now()-s;function f(){s=Date.now(),r.apply(d,u)}function h(){o=void 0}i||(n&&!o&&f(),a(),void 0===n&&p>t?f():!0!==e&&(o=setTimeout(n?h:f,void 0===n?t-p:t)))}return"boolean"!=typeof e&&(n=r,r=e,e=void 0),c.cancel=function(){a(),i=!0},c}t.debounce=function(t,r,n){return void 0===n?e(t,r,!1):e(t,n,!1!==r)},t.throttle=e,Object.defineProperty(t,"__esModule",{value:!0})}(e)},,function(t,e,r){(function(t,e){!function(t,r){"use strict";if(!t.setImmediate){var n,o,i,s,a,c=1,u={},l=!1,d=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){h(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?t.MessageChannel?((i=new MessageChannel).port1.onmessage=function(t){h(t.data)},n=function(t){i.port2.postMessage(t)}):d&&"onreadystatechange"in d.createElement("script")?(o=d.documentElement,n=function(t){var e=d.createElement("script");e.onreadystatechange=function(){h(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):n=function(t){setTimeout(h,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&h(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(s+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),r=0;r<e.length;r++)e[r]=arguments[r+1];var o={callback:t,args:e};return u[c]=o,n(c),c++},p.clearImmediate=f}function f(t){delete u[t]}function h(t){if(l)setTimeout(h,0,t);else{var e=u[t];if(e){l=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(void 0,r)}}(e)}finally{f(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,r(11),r(20))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,u=[],l=!1,d=-1;function p(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&f())}function f(){if(!l){var t=a(p);l=!0;for(var e=u.length;e;){for(c=u,u=[];++d<e;)c&&c[d].run();d=-1,e=u.length}c=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function g(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new h(t,e)),1!==u.length||l||a(f)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){const r={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"};t.exports=r},,function(t,e,r){"use strict";(function(t,n){var o,i=r(25);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:n;var s=Object(i.a)(o);e.a=s}).call(this,r(11),r(30)(t))},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return c})),r.d(e,"b",(function(){return u}));var n=r(17),o=r(0),i=(r(2),r(14));const s=e=>({payload:{product:{id:r,components:n}={}}={}}={})=>t(()=>((t,e,r=document)=>r.dispatchEvent(new CustomEvent(t,{detail:e})))("optin-changed",{productId:r,components:n,optedIn:e})),a=[{expressions:[({type:t}={})=>t===o.k,({type:t}={})=>t===o.m],fn:s(!0)},{expressions:[({type:t}={})=>t===o.l],fn:s(!1)}],c=t=>e=>r=>{const n=t.getState();a.forEach(t=>{t.expressions.some(t=>t(r,n))&&t.fn(r)}),e(r)},u=t=>e=>r=>{e(r);const s=Object(n.throttle)(500,()=>{Object(i.saveState)({...t.getState()})});r.type!==o.i&&s()}}).call(this,r(16).setImmediate)},function(t,e,r){"use strict";function n(t){var e,r=t.Symbol;return"function"==typeof r?r.observable?e=r.observable:(e=r("observable"),r.observable=e):e="@@observable",e}r.d(e,"a",(function(){return n}))},function(t,e,r){const n=r(32),o=r(33),i=r(34);t.exports={parse:(t,e)=>{const r=n(t),s=o.PolishNotation(r),a=o.PolishGenerator(s),c=i.make(a);return i.nodeEvaluator(c,e)}}},,function(t,e,r){const{offersLiveEditor:n}=r(29),{setStore:o}=r(4),{getStore:i}=r(50),{listenLocalStorageChanges:s}=r(14),a=r(31),c=r(3),{ConnectedWhen:u}=r(51),{ConnectedOptinButton:l}=r(35),{ConnectedOptoutButton:d}=r(36),{ConnectedOptinSelect:p}=r(37),{ConnectedUpsellButton:f}=r(38),{ConnectedUpsellModal:h}=r(39),{ConnectedOptinToggle:g}=r(40),{ConnectedOptinStatus:m}=r(9),{ConnectedText:y}=r(41),{ConnectedIncentiveText:b}=r(42),{ConnectedSelectFrequency:v}=r(43),{ConnectedNextUpcomingOrder:_}=r(52),{ConnectedOffer:w}=r(44),{Modal:O}=r(45),{Select:S}=r(46),{Tooltip:x}=r(47),{ConnectedFrequencyStatus:E}=r(13);let T;r(48).enable();const C={setEnvironment:t=>(T.dispatch(c.setEnvironment(t)),C),setMerchantId:t=>(T.dispatch(c.setMerchantId(t)),C),setAuthUrl:t=>(T.dispatch(c.setAuthUrl(t)),C),getProductsForPurchasePost:(t=[])=>a.getProductsForPurchasePost(T.getState(),t),getOptins:(t=[])=>a.getProductsForPurchasePost(T.getState(),t),clear(){T.dispatch(c.checkout())},addOptinChangedCallback(t){"function"==typeof t&&document.addEventListener("optin-changed",e=>t(e.detail))},disableOptinChangedCallbacks(){document.addEventListener("optin-changed",t=>t.stopPropagation(),!0)},register(){try{customElements.define("og-when",u),customElements.define("og-text",y),customElements.define("og-incentive-text",b),customElements.define("og-offer",w),customElements.define("og-select-frequency",v),customElements.define("og-optout-button",d),customElements.define("og-optin-toggle",g),customElements.define("og-optin-status",m),customElements.define("og-optin-button",l),customElements.define("og-optin-select",p),customElements.define("og-upsell-button",f),customElements.define("og-frequency-status",E),customElements.define("og-modal",O),customElements.define("og-select",S),customElements.define("og-tooltip",x),customElements.define("og-upsell-modal",h),customElements.define("og-next-upcoming-order",_)}catch(t){console.error(t)}C.register=()=>0},previewMode(t){return window.og=window.og||{},!1===t?delete window.og:window.og.previewMode=!0,this},initialize:(t,e,r)=>C.isReady?(console.warn("og.offers has been initialized already. Skipping."),C):(T=i(),o(T),t&&C.setMerchantId(t),e&&C.setEnvironment(e),r&&C.setAuthUrl(r),window.addEventListener("storage",s(T)),t&&e&&(T.dispatch(c.requestSessionId()),T.dispatch(c.fetchAuth()),C.register()),C.isReady=!0,C),config:t=>(T.dispatch(c.setConfig(t)),C),setLocale:t=>(T.dispatch(c.setLocale(t)),C),addTemplate:(t,e,r)=>(T.dispatch(c.addTemplate(t,e,r)),C),setTemplates:t=>(T.dispatch(c.setTemplates(t)),C),setPublicPath:t=>(r.p=t,C)};window.OG=window.OG||{},Object.assign(window.OG,C),Object.assign(C.initialize,C),n(),t.exports=C.initialize},function(t,e,r){window,t.exports=function(t){function e(e){for(var r,o,i=e[0],s=e[1],a=0,u=[];a<i.length;a++)o=i[a],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&u.push(n[o][0]),n[o]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(t[r]=s[r]);for(c&&c(e);u.length;)u.shift()()}var r={},n={0:0};function o(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.e=function(t){var e=[],r=n[t];if(0!==r)if(r)e.push(r[2]);else{var i=new Promise((function(e,o){r=n[t]=[e,o]}));e.push(r[2]=i);var s,a=document.createElement("script");a.charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.src=function(t){return o.p+""+t+".offers-live-editor.js"}(t);var c=new Error;s=function(e){a.onerror=a.onload=null,clearTimeout(u);var r=n[t];if(0!==r){if(r){var o=e&&("load"===e.type?"missing":e.type),i=e&&e.target&&e.target.src;c.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",c.name="ChunkLoadError",c.type=o,c.request=i,r[1](c)}n[t]=void 0}};var u=setTimeout((function(){s({type:"timeout",target:a})}),12e4);a.onerror=a.onload=s,document.head.appendChild(a)}return Promise.all(e)},o.m=t,o.c=r,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="//static.ordergroove.com/@ordergroove/offers-live-editor/0.3.0/dist/",o.oe=function(t){throw console.error(t),t};var i=window.webpackJsonp=window.webpackJsonp||[],s=i.push.bind(i);i.push=e,i=i.slice();for(var a=0;a<i.length;a++)e(i[a]);var c=s;return o(o.s=0)}([function(t,e,r){"use strict";r.r(e),r.d(e,"offersLiveEditor",(function(){return s}));const n=["https://rc3.ordergroove.com","https://rc3.stg.ordergroove.com","http://localhost:3000",window.location.origin],o=t=>(e,r)=>{n.forEach(n=>t.postMessage({ogType:e,...r},n))};function i(t){const e=(t=>e=>t.indexOf(e.origin)>=0)(n),s=o(t.source);e(t)&&"READY"===t.data.ogType&&r.e(1).then(r.bind(null,2)).then(({initializeClient:t})=>{t(e,s),window.removeEventListener("message",i)})}function s(t=window.opener){t&&t!==window&&(window.addEventListener("message",i),o(t)("READY"))}e.default=s}])},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(t,e,r){"use strict";r.r(e),r.d(e,"getProductsForPurchasePost",(function(){return o}));var n=r(5);const o=(t={},e=[])=>(t.optedin||[]).map(e=>{const r={product:e.id,subscription_info:{components:e.components||[]},tracking_override:{offer:((t.productOffer||{})[e.id]||[])[0],...Object(n.d)(e.frequency)}};return t.firstOrderPlaceDate&&t.firstOrderPlaceDate[e.id]&&(r.subscription_info.first_order_place_date=t.firstOrderPlaceDate[e.id]),t.productToSubscribe&&t.productToSubscribe[e.id]&&(r.tracking_override.product=t.productToSubscribe[e.id]),r}).filter(t=>t.tracking_override.offer).filter(t=>e.length?e.includes(t.product):t);e.default={getProductsForPurchasePost:o}},function(t,e,r){const n=r(21);t.exports=t=>{let e="";const r=[];for(const o of t){const t=o.charCodeAt(0);switch(t){case n.PAR_OPEN:case n.PAR_CLOSE:case n.OP_NOT:case n.BINARY_AND:case n.BINARY_OR:e&&(r.push({type:n.LITERAL,value:e}),e=""),r.push({type:t,value:o});break;default:e+=o}}return e&&r.push({type:n.LITERAL,value:e}),r}},function(t,e,r){const n=r(21);t.exports={PolishNotation:t=>{const e=[],r=[];return t.forEach(t=>{switch(t.type){case n.LITERAL:e.unshift(t);break;case n.BINARY_AND:case n.BINARY_OR:case n.OP_NOT:case n.PAR_OPEN:r.push(t);break;case n.PAR_CLOSE:for(;r.length&&r[r.length-1].type!==n.PAR_OPEN;)e.unshift(r.pop());r.pop(),r.length&&r[r.length-1].type===n.OP_NOT&&e.unshift(r.pop())}}),r.length&&[...r.reverse(),...e]||e},PolishGenerator:function*(t){for(let e=0;e<t.length-1;e++)yield t[e];return t[t.length-1]}}},function(t,e,r){const n=r(21);class o{constructor(t,e,r,n){this.op=t,this.left=e,this.right=r,this.literal=n}isLeaf(){return this.op===n.LEAF}isAtomic(){return this.isLeaf()||this.op===n.OP_NOT&&this.left.isLeaf()}getLiteralValue(){return this.literal}static CreateAnd(t,e){return new o(n.BINARY_AND,t,e)}static CreateNot(t){return new o(n.OP_NOT,t)}static CreateOr(t,e){return new o(n.BINARY_OR,t,e)}static CreateLiteral(t){return new o(n.LEAF,null,null,t)}}const i=t=>{const e=t.next().value;switch(e.type){case n.LITERAL:return o.CreateLiteral(e.value);case n.OP_NOT:return o.CreateNot(i(t));case n.BINARY_AND:{const e=i(t),r=i(t);return o.CreateAnd(e,r)}case n.BINARY_OR:{const e=i(t),r=i(t);return o.CreateOr(e,r)}}return null},s=(t,e)=>t.isLeaf()?e(t.getLiteralValue()):t.op===n.OP_NOT?!s(t.left,e):t.op===n.BINARY_OR?s(t.left,e)||s(t.right,e):t.op===n.BINARY_AND?s(t.left,e)&&s(t.right,e):void 0;t.exports={make:i,nodeEvaluator:s}},function(t,e,r){"use strict";r.r(e),r.d(e,"OptinButton",(function(){return u})),r.d(e,"ConnectedOptinButton",(function(){return l}));var n=r(1),o=r(3),i=r(9),s=r(4),a=r(8),c=r(6);class u extends i.OptinStatus{static get properties(){return{...super.properties,frequency:{type:String,reflect:!0},defaultFrequency:a.b,optinButtonLabel:{type:String}}}handleClick(t){this.optinProduct(Object(c.a)(this),this.defaultFrequency),t.preventDefault()}render(){return n.c`
|
|
237
237
|
<slot name="default">
|
|
238
238
|
<button id="action-trigger" class="btn radio ${this.subscribed?"active":""}"></button>
|
|
239
239
|
<label for="action-trigger">
|