@bigcommerce/checkout-sdk 1.817.0 → 1.818.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/dist/cjs/checkout-button.js +1 -1
- package/dist/cjs/checkout-sdk-essential.js +1 -1
- package/dist/cjs/checkout-sdk.js +1 -1
- package/dist/cjs/hosted-form-v2-iframe-host.js +1 -1
- package/dist/cjs/integrations/amazon-pay.js +1 -1
- package/dist/cjs/integrations/bigcommerce-payments.js +1 -1
- package/dist/cjs/integrations/braintree.js +1 -1
- package/dist/cjs/integrations/google-pay.js +1 -1
- package/dist/cjs/integrations/klarna.js +1 -1
- package/dist/cjs/integrations/paypal-commerce.js +1 -1
- package/dist/cjs/integrations/paypal-express.js +1 -1
- package/dist/cjs/integrations/zip.js +1 -1
- package/dist/esm/checkout-button.js +1 -1
- package/dist/esm/checkout-sdk-essential.js +1 -1
- package/dist/esm/checkout-sdk.js +1 -1
- package/dist/esm/hosted-form-v2-iframe-host.js +1 -1
- package/dist/esm/integrations/amazon-pay.js +1 -1
- package/dist/esm/integrations/bigcommerce-payments.js +1 -1
- package/dist/esm/integrations/braintree.js +1 -1
- package/dist/esm/integrations/google-pay.js +1 -1
- package/dist/esm/integrations/klarna.js +1 -1
- package/dist/esm/integrations/paypal-commerce.js +1 -1
- package/dist/esm/integrations/paypal-express.js +1 -1
- package/dist/esm/integrations/zip.js +1 -1
- package/dist/types/checkout-sdk.d.ts +71 -1
- package/docs/README.md +3 -1
- package/docs/interfaces/BraintreeCreditCardPaymentInitializeOptions.md +140 -0
- package/docs/interfaces/WithBraintreeCreditCardPaymentInitializeOptions.md +17 -0
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see zip.js.LICENSE.txt */
|
|
2
|
-
(()=>{var e={35:(e,t,n)=>{e=n.nmd(e);var r="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",s="[object Function]",a="[object Object]",c=/^\[object .+?Constructor\]$/,u=/^(?:0|[1-9]\d*)$/,p={};p["[object Float32Array]"]=p["[object Float64Array]"]=p["[object Int8Array]"]=p["[object Int16Array]"]=p["[object Int32Array]"]=p["[object Uint8Array]"]=p["[object Uint8ClampedArray]"]=p["[object Uint16Array]"]=p["[object Uint32Array]"]=!0,p[i]=p["[object Array]"]=p["[object ArrayBuffer]"]=p["[object Boolean]"]=p["[object DataView]"]=p["[object Date]"]=p["[object Error]"]=p[s]=p["[object Map]"]=p["[object Number]"]=p[a]=p["[object RegExp]"]=p["[object Set]"]=p["[object String]"]=p["[object WeakMap]"]=!1;var f,l,d,h="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,y="object"==typeof self&&self&&self.Object===Object&&self,g=h||y||Function("return this")(),v=t&&!t.nodeType&&t,b=v&&e&&!e.nodeType&&e,m=b&&b.exports===v,_=m&&h.process,j=function(){try{return b&&b.require&&b.require("util").types||_&&_.binding&&_.binding("util")}catch(e){}}(),w=j&&j.isTypedArray,O=Array.prototype,R=Function.prototype,C=Object.prototype,M=g["__core-js_shared__"],P=R.toString,S=C.hasOwnProperty,x=(f=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+f:"",A=C.toString,T=P.call(Object),I=RegExp("^"+P.call(S).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),E=m?g.Buffer:void 0,U=g.Symbol,k=g.Uint8Array,q=(E&&E.allocUnsafe,l=Object.getPrototypeOf,d=Object,function(e){return l(d(e))}),z=Object.create,F=C.propertyIsEnumerable,B=O.splice,D=U?U.toStringTag:void 0,N=function(){try{var e=ae(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),H=E?E.isBuffer:void 0,$=Math.max,J=Date.now,L=ae(g,"Map"),G=ae(Object,"create"),K=function(){function e(){}return function(t){if(!me(t))return{};if(z)return z(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function X(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function V(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Z(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function W(e){var t=this.__data__=new V(e);this.size=t.size}function Q(e,t,n){(void 0!==n&&!le(e[t],n)||void 0===n&&!(t in e))&&te(e,t,n)}function Y(e,t,n){var r=e[t];S.call(e,t)&&le(r,n)&&(void 0!==n||t in e)||te(e,t,n)}function ee(e,t){for(var n=e.length;n--;)if(le(e[n][0],t))return n;return-1}function te(e,t,n){"__proto__"==t&&N?N(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}X.prototype.clear=function(){this.__data__=G?G(null):{},this.size=0},X.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},X.prototype.get=function(e){var t=this.__data__;if(G){var n=t[e];return n===r?void 0:n}return S.call(t,e)?t[e]:void 0},X.prototype.has=function(e){var t=this.__data__;return G?void 0!==t[e]:S.call(t,e)},X.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=G&&void 0===t?r:t,this},V.prototype.clear=function(){this.__data__=[],this.size=0},V.prototype.delete=function(e){var t=this.__data__,n=ee(t,e);return!(n<0||(n==t.length-1?t.pop():B.call(t,n,1),--this.size,0))},V.prototype.get=function(e){var t=this.__data__,n=ee(t,e);return n<0?void 0:t[n][1]},V.prototype.has=function(e){return ee(this.__data__,e)>-1},V.prototype.set=function(e,t){var n=this.__data__,r=ee(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Z.prototype.clear=function(){this.size=0,this.__data__={hash:new X,map:new(L||V),string:new X}},Z.prototype.delete=function(e){var t=se(this,e).delete(e);return this.size-=t?1:0,t},Z.prototype.get=function(e){return se(this,e).get(e)},Z.prototype.has=function(e){return se(this,e).has(e)},Z.prototype.set=function(e,t){var n=se(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},W.prototype.clear=function(){this.__data__=new V,this.size=0},W.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},W.prototype.get=function(e){return this.__data__.get(e)},W.prototype.has=function(e){return this.__data__.has(e)},W.prototype.set=function(e,t){var n=this.__data__;if(n instanceof V){var r=n.__data__;if(!L||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Z(r)}return n.set(e,t),this.size=n.size,this};function ne(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":D&&D in Object(e)?function(e){var t=S.call(e,D),n=e[D];try{e[D]=void 0;var r=!0}catch(e){}var o=A.call(e);return r&&(t?e[D]=n:delete e[D]),o}(e):function(e){return A.call(e)}(e)}function re(e){return _e(e)&&ne(e)==i}function oe(e,t,n,r,o){e!==t&&function(e,t,n){for(var r=-1,o=Object(e),i=n(e),s=i.length;s--;){var a=i[++r];if(!1===t(o[a],a,o))break}}(t,function(i,s){if(o||(o=new W),me(i))!function(e,t,n,r,o,i,s){var c=pe(e,n),u=pe(t,n),p=s.get(u);if(p)Q(e,n,p);else{var f,l,d,h,y,g=i?i(c,u,n+"",e,t,s):void 0,v=void 0===g;if(v){var b=he(u),m=!b&&ge(u),_=!b&&!m&&je(u);g=u,b||m||_?he(c)?g=c:_e(y=c)&&ye(y)?g=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(c):m?(v=!1,g=function(e){return e.slice()}(u)):_?(v=!1,h=new(d=(f=u).buffer).constructor(d.byteLength),new k(h).set(new k(d)),l=h,g=new f.constructor(l,f.byteOffset,f.length)):g=[]:function(e){if(!_e(e)||ne(e)!=a)return!1;var t=q(e);if(null===t)return!0;var n=S.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&P.call(n)==T}(u)||de(u)?(g=c,de(c)?g=function(e){return function(e,t,n){var r=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var s=t[o],a=void 0;void 0===a&&(a=e[s]),r?te(n,s,a):Y(n,s,a)}return n}(e,we(e))}(c):me(c)&&!ve(c)||(g=function(e){return"function"!=typeof e.constructor||ue(e)?{}:K(q(e))}(u))):v=!1}v&&(s.set(u,g),o(g,u,r,i,s),s.delete(u)),Q(e,n,g)}}(e,t,s,n,oe,r,o);else{var c=r?r(pe(e,s),i,s+"",e,t,o):void 0;void 0===c&&(c=i),Q(e,s,c)}},we)}var ie=N?function(e,t){return N(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:Ce;function se(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function ae(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!me(e)||function(e){return!!x&&x in e}(e))&&(ve(e)?I:c).test(function(e){if(null!=e){try{return P.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}(n)?n:void 0}function ce(e,t){var n=typeof e;return!!(t=null==t?o:t)&&("number"==n||"symbol"!=n&&u.test(e))&&e>-1&&e%1==0&&e<t}function ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||C)}function pe(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var fe=function(e){var t=0,n=0;return function(){var r=J(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(ie);function le(e,t){return e===t||e!=e&&t!=t}var de=re(function(){return arguments}())?re:function(e){return _e(e)&&S.call(e,"callee")&&!F.call(e,"callee")},he=Array.isArray;function ye(e){return null!=e&&be(e.length)&&!ve(e)}var ge=H||function(){return!1};function ve(e){if(!me(e))return!1;var t=ne(e);return t==s||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function be(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}function me(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function _e(e){return null!=e&&"object"==typeof e}var je=w?function(e){return function(t){return e(t)}}(w):function(e){return _e(e)&&be(e.length)&&!!p[ne(e)]};function we(e){return ye(e)?function(e,t){var n=he(e),r=!n&&de(e),o=!n&&!r&&ge(e),i=!n&&!r&&!o&&je(e),s=n||r||o||i,a=s?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=a.length;for(var u in e)!t&&!S.call(e,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ce(u,c))||a.push(u);return a}(e,!0):function(e){if(!me(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=ue(e),n=[];for(var r in e)("constructor"!=r||!t&&S.call(e,r))&&n.push(r);return n}(e)}var Oe,Re=(Oe=function(e,t,n){oe(e,t,n)},function(e,t){return fe(function(e,t,n){return t=$(void 0===t?e.length-1:t,0),function(){for(var r=arguments,o=-1,i=$(r.length-t,0),s=Array(i);++o<i;)s[o]=r[t+o];o=-1;for(var a=Array(t+1);++o<t;)a[o]=r[o];return a[t]=n(s),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,a)}}(e,t,Ce),e+"")}(function(e,t){var n=-1,r=t.length,o=r>1?t[r-1]:void 0,i=r>2?t[2]:void 0;for(o=Oe.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(e,t,n){if(!me(n))return!1;var r=typeof t;return!!("number"==r?ye(n)&&ce(t,n.length):"string"==r&&t in n)&&le(n[t],e)}(t[0],t[1],i)&&(o=r<3?void 0:o,r=1),e=Object(e);++n<r;){var s=t[n];s&&Oe(e,s,n)}return e}));function Ce(e){return e}e.exports=Re},168:e=>{var t;t=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({path:"/"},o.defaults,i)).expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var s=JSON.stringify(n);/^[\{\[]/.test(s)&&(n=s)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var c in i)i[c]&&(a+="; "+c,!0!==i[c]&&(a+="="+i[c].split(";")[0]));return document.cookie=t+"="+n+a}}function s(e,n){if("undefined"!=typeof document){for(var o={},i=document.cookie?document.cookie.split("; "):[],s=0;s<i.length;s++){var a=i[s].split("="),c=a.slice(1).join("=");n||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var u=t(a[0]);if(c=(r.read||r)(c,u)||t(c),n)try{c=JSON.parse(c)}catch(e){}if(o[u]=c,e===u)break}catch(e){}}return e?o[e]:o}}return o.set=i,o.get=function(e){return s(e,!1)},o.getJSON=function(e){return s(e,!0)},o.remove=function(t,n){i(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}(function(){})},"function"==typeof define&&define.amd&&define(t),e.exports=t()},803:e=>{"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}},1915:e=>{"use strict";var t="%[a-f0-9]{2}",n=new RegExp("("+t+")|([^%]+?)","gi"),r=new RegExp("("+t+")+","gi");function o(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],o(n),o(r))}function i(e){try{return decodeURIComponent(e)}catch(i){for(var t=e.match(n)||[],r=1;r<t.length;r++)t=(e=o(t,r).join("")).match(n)||[];return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=r.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var o=i(n[0]);o!==n[0]&&(t[n[0]]=o)}n=r.exec(e)}t["%C2"]="�";for(var s=Object.keys(t),a=0;a<s.length;a++){var c=s[a];e=e.replace(new RegExp(c,"g"),t[c])}return e}(e)}}},4475:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var i,s,a=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var u in i=Object(arguments[c]))n.call(i,u)&&(a[u]=i[u]);if(t){s=t(i);for(var p=0;p<s.length;p++)r.call(i,s[p])&&(a[s[p]]=i[s[p]])}}return a}},5889:(e,t,n)=>{"use strict";var r=n(803),o=n(4475);n(1915);function i(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}t.As=function(e,t){!1===(t=o({encode:!0,strict:!0,arrayFormat:"none"},t)).sort&&(t.sort=function(){});var n=function(e){switch(e.arrayFormat){case"index":return function(t,n,r){return null===n?[i(t,e),"[",r,"]"].join(""):[i(t,e),"[",i(r,e),"]=",i(n,e)].join("")};case"bracket":return function(t,n){return null===n?i(t,e):[i(t,e),"[]=",i(n,e)].join("")};default:return function(t,n){return null===n?i(t,e):[i(t,e),"=",i(n,e)].join("")}}}(t);return e?Object.keys(e).sort(t.sort).map(function(r){var o=e[r];if(void 0===o)return"";if(null===o)return i(r,t);if(Array.isArray(o)){var s=[];return o.slice().forEach(function(e){void 0!==e&&s.push(n(r,e,s.length))}),s.join("&")}return i(r,t)+"="+i(o,t)}).filter(function(e){return e.length>0}).join("&"):""}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r](i,i.exports,n),i.loaded=!0,i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";n.r(r),n.d(r,{createZipPaymentStrategy:()=>C});var e=n(168),t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)},o=/application\/(\w+\+)?json/,i=/application\/x-www-form-urlencoded/;const s=function(){function e(){}return e.prototype.toRequestBody=function(e){var t,n=e.headers?this._getHeader(e.headers,"Content-Type"):"";if(e.body){if(o.test(n))return JSON.stringify(e.body);if(i.test(n))return"object"!=typeof(t=e.body)||null===t?t:Object.keys(t).filter(function(e){return void 0!==t[e]}).map(function(e){var n=t[e];return"string"==typeof n?e+"="+encodeURIComponent(n):e+"="+encodeURIComponent(JSON.stringify(n)||"")}).join("&")}return e.body},e.prototype.toResponse=function(e){var t=this._parseResponseHeaders(e.getAllResponseHeaders());return{body:this._parseResponseBody("response"in e?e.response:e.responseText,t),headers:t,status:e.status,statusText:e.statusText}},e.prototype._parseResponseBody=function(e,t){var n=this._getHeader(t,"Content-Type");return e&&o.test(n)?JSON.parse(e):e},e.prototype._parseResponseHeaders=function(e){return(e?e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/):[]).reduce(function(e,n){var r,o=n.split(":"),i=(o.shift()||"").trim();return i?t(t({},e),((r={})[i.toLowerCase()]=o.join(":").trim(),r)):e},{})},e.prototype._getHeader=function(e,t){return e&&t&&(e[t]||e[t.toLowerCase()])||""},e}();var a=n(5889);const c=function(){function e(){}return e.prototype.createRequest=function(e,t){var n=new XMLHttpRequest;return this._configureRequest(n,e,t),n},e.prototype._configureRequest=function(e,t,n){void 0===n&&(n={}),e.open(n.method||"GET",this._formatUrl(t,n.params,n.encodeParams),!0),n.headers&&this._configureRequestHeaders(e,n.headers),"boolean"==typeof n.credentials&&(e.withCredentials=n.credentials),"number"==typeof n.timeout&&(e.timeout=n.timeout)},e.prototype._configureRequestHeaders=function(e,t){Object.keys(t).filter(function(e){return null!==t[e]}).forEach(function(n){e.setRequestHeader(n,t[n])})},e.prototype._formatUrl=function(e,t,n){return void 0===n&&(n=!0),t&&0!==Object.keys(t).length?e+"?"+a.As(t,{encode:n}):e},e}();var u=n(35),p=n.n(u),f=function(){function e(){this._cache={}}return e.prototype.read=function(e,t){var n=this.getKey(e,t.params);return this._cache[n]||null},e.prototype.write=function(e,t,n){var r=this.getKey(e,t.params);this._cache[r]=n},e.prototype.getKey=function(e,t){return void 0===t&&(t={}),0===Object.keys(t).length?e:e+"?"+a.As(t)},e}();const l=function(){function e(e){var t=this;this._delay=e,this._resolve=function(){},this._promise=new Promise(function(e){t._resolve=e})}return e.prototype.onComplete=function(e){this._promise.then(e)},e.prototype.complete=function(){this._resolve(),this._timeoutToken&&window.clearTimeout(this._timeoutToken)},e.prototype.start=function(){var e=this;this._delay&&(this._timeoutToken=window.setTimeout(function(){return e.complete()},this._delay))},e}(),d=function(){function e(e,t,n,r){void 0===r&&(r={}),this._requestFactory=e,this._payloadTransformer=t,this._cookie=n,this._options=r,this._cache=this._options.cache||new f}return e.prototype.sendRequest=function(e,t){var n=this,r=this._mergeDefaultOptions(e,t),o=this._getCachedRequest(e,r);if(o)return Promise.resolve(o);var i=this._requestFactory.createRequest(this._prependHost(e),r);return new Promise(function(t,o){var s,a=function(){var s=n._payloadTransformer.toResponse(i);s.status>=200&&s.status<300?(n._cacheRequest(e,r,s),t(s)):o(s)};i.onload=a,i.onerror=a,i.onabort=a,i.ontimeout=a,r.timeout instanceof l&&(r.timeout.onComplete(function(){return i.abort()}),r.timeout.start()),!(s=r.timeout)||"object"!=typeof s&&"function"!=typeof s||"function"!=typeof s.then||r.timeout.then(function(){return i.abort()}),i.send(n._payloadTransformer.toRequestBody(r))})},e.prototype.get=function(e,n){return this.sendRequest(e,t(t({},n),{method:"GET"}))},e.prototype.post=function(e,n){return this.sendRequest(e,t(t({},n),{method:"POST"}))},e.prototype.put=function(e,n){return this.sendRequest(e,t(t({},n),{method:"PUT"}))},e.prototype.patch=function(e,n){return this.sendRequest(e,t(t({},n),{method:"PATCH"}))},e.prototype.delete=function(e,n){return this.sendRequest(e,t(t({},n),{method:"DELETE"}))},e.prototype._mergeDefaultOptions=function(e,t){var n={credentials:!0,encodeParams:!0,headers:{Accept:"application/json, text/plain, */*"},method:"GET"},r=this._cookie.get("XSRF-TOKEN");return r&&n.headers&&!this._isAssetRequest(e,t)&&this._isLocalRequest(e)&&(n.headers["X-XSRF-TOKEN"]=r),t&&t.body&&n.headers&&(n.headers["Content-Type"]="application/json"),p()({},n,t)},e.prototype._prependHost=function(e){return!this._options.host||/^https?:\/\//.test(e)?e:this._options.host.replace(/\/$/,"")+"/"+e.replace(/^\//,"")},e.prototype._shouldCacheRequest=function(e){return"GET"===(e.method||"GET").toUpperCase()&&Boolean(e.cache)},e.prototype._getCachedRequest=function(e,t){return this._shouldCacheRequest(t)?this._cache.read(e,t):null},e.prototype._cacheRequest=function(e,t,n){this._shouldCacheRequest(t)&&this._cache.write(e,t,n)},e.prototype._isAssetRequest=function(e,t){return(!t||!t.method||"GET"===t.method.toUpperCase())&&/\.(png|gif|jpe?g|css|js|json|svg|html?)$/.test(e.split("?")[0])},e.prototype._isLocalRequest=function(e){return!!e.match(new RegExp("^(https?:)?//"+window.location.hostname))||!e.match(new RegExp("^(https?:)?//"))},e}();var h;!function(e){e.Json="application/json",e.JsonV1="application/vnd.bc.v1+json"}(h||(h={}));const y=h,g={"X-Checkout-SDK-Version":"1.817.0"};var v;class b{constructor(e){this._requestSender=e}saveExternalId(e,t){return n=this,r=void 0,i=function*(){const n=`/api/storefront/payment/${e}/save-external-id`,r={headers:Object.assign({Accept:y.JsonV1,"X-API-INTERNAL":"This API endpoint is for internal use only and may change in the future"},g),body:{externalId:t,provider:e}};yield this._requestSender.post(n,r)},new((o=void 0)||(o=Promise))(function(e,t){function s(e){try{c(i.next(e))}catch(e){t(e)}}function a(e){try{c(i.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o(function(e){e(n)})).then(s,a)}c((i=i.apply(n,r||[])).next())});var n,r,o,i}}class m extends Error{constructor(e){var t;super(e||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",t=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}class _ extends m{constructor(e){super(e||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class j extends _{constructor(e){let t="Unable to submit payment for the order because the payload is invalid.";e&&(t=`${t} Make sure the following fields are provided correctly: ${e.join(", ")}.`),super(t),this.name="PaymentArgumentInvalidError"}}!function(e){e[e.MissingBillingAddress=0]="MissingBillingAddress",e[e.MissingCart=1]="MissingCart",e[e.MissingCheckout=2]="MissingCheckout",e[e.MissingConsignments=3]="MissingConsignments",e[e.MissingCustomer=4]="MissingCustomer",e[e.MissingCheckoutConfig=5]="MissingCheckoutConfig",e[e.MissingOrder=6]="MissingOrder",e[e.MissingOrderConfig=7]="MissingOrderConfig",e[e.MissingOrderId=8]="MissingOrderId",e[e.MissingPayment=9]="MissingPayment",e[e.MissingPaymentId=10]="MissingPaymentId",e[e.MissingPaymentInstrument=11]="MissingPaymentInstrument",e[e.MissingPaymentMethod=12]="MissingPaymentMethod",e[e.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",e[e.MissingPaymentStatus=14]="MissingPaymentStatus",e[e.MissingPaymentToken=15]="MissingPaymentToken",e[e.MissingShippingAddress=16]="MissingShippingAddress"}(v||(v={}));class w extends m{constructor(e){super(function(e){switch(e){case v.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case v.MissingCart:return"Unable to proceed because cart data is unavailable.";case v.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case v.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case v.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case v.MissingCheckoutConfig:case v.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case v.MissingOrder:return"Unable to proceed because order data is unavailable.";case v.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case v.MissingPayment:return"Unable to proceed because payment data is unavailable.";case v.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case v.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case v.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}class O extends m{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}class R{constructor(e,t){this.paymentIntegrationService=e,this.storefrontPaymentRequestSender=t}initialize(){return Promise.resolve()}execute(e,t){return n=this,r=void 0,i=function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["payment"]);if(!n)throw new j(["payment"]);const{methodId:o}=n,{getPaymentMethodOrThrow:i}=yield this.paymentIntegrationService.loadPaymentMethod(o,t),{clientToken:s,initializationData:a}=i(o),c=null==a?void 0:a.redirectUrl;if(!s||!c)throw new w(v.MissingPaymentMethod);const{id:u}=JSON.parse(s);if(!u)throw new w(v.MissingPaymentToken);const{isStoreCreditApplied:p}=this.paymentIntegrationService.getState().getCheckoutOrThrow();yield this.paymentIntegrationService.applyStoreCredit(p),yield this.paymentIntegrationService.initializePayment(o,{useStoreCredit:p}),yield this.paymentIntegrationService.submitOrder(r,t),yield this._prepareForReferredRegistration(o,u);try{yield this.paymentIntegrationService.submitPayment({methodId:o,paymentData:{nonce:u}})}catch(e){if((e=>"object"==typeof e&&null!==e&&"body"in e)(e)&&"additional_action_required"===e.body.status)return new Promise(()=>window.location.replace(c));throw e}},new((o=void 0)||(o=Promise))(function(e,t){function s(e){try{c(i.next(e))}catch(e){t(e)}}function a(e){try{c(i.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o(function(e){e(n)})).then(s,a)}c((i=i.apply(n,r||[])).next())});var n,r,o,i}finalize(){return Promise.reject(new O)}deinitialize(){return Promise.resolve()}_prepareForReferredRegistration(e,t){return this.storefrontPaymentRequestSender.saveExternalId(e,t)}}const C=Object.assign(t=>{const{getHost:n}=t.getState(),r=(o={host:n()},new d(new c,new s,e,o));var o;const i=new b(r);return new R(t,i)},{resolveIds:[{id:"zip"},{id:"quadpay"}]})})(),module.exports=r})();
|
|
2
|
+
(()=>{var e={35:(e,t,n)=>{e=n.nmd(e);var r="__lodash_hash_undefined__",o=9007199254740991,i="[object Arguments]",s="[object Function]",a="[object Object]",c=/^\[object .+?Constructor\]$/,u=/^(?:0|[1-9]\d*)$/,p={};p["[object Float32Array]"]=p["[object Float64Array]"]=p["[object Int8Array]"]=p["[object Int16Array]"]=p["[object Int32Array]"]=p["[object Uint8Array]"]=p["[object Uint8ClampedArray]"]=p["[object Uint16Array]"]=p["[object Uint32Array]"]=!0,p[i]=p["[object Array]"]=p["[object ArrayBuffer]"]=p["[object Boolean]"]=p["[object DataView]"]=p["[object Date]"]=p["[object Error]"]=p[s]=p["[object Map]"]=p["[object Number]"]=p[a]=p["[object RegExp]"]=p["[object Set]"]=p["[object String]"]=p["[object WeakMap]"]=!1;var f,l,d,h="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,y="object"==typeof self&&self&&self.Object===Object&&self,g=h||y||Function("return this")(),v=t&&!t.nodeType&&t,b=v&&e&&!e.nodeType&&e,m=b&&b.exports===v,_=m&&h.process,j=function(){try{return b&&b.require&&b.require("util").types||_&&_.binding&&_.binding("util")}catch(e){}}(),w=j&&j.isTypedArray,O=Array.prototype,R=Function.prototype,C=Object.prototype,M=g["__core-js_shared__"],P=R.toString,S=C.hasOwnProperty,x=(f=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+f:"",A=C.toString,T=P.call(Object),I=RegExp("^"+P.call(S).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),E=m?g.Buffer:void 0,U=g.Symbol,k=g.Uint8Array,q=(E&&E.allocUnsafe,l=Object.getPrototypeOf,d=Object,function(e){return l(d(e))}),z=Object.create,F=C.propertyIsEnumerable,B=O.splice,D=U?U.toStringTag:void 0,N=function(){try{var e=ae(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),H=E?E.isBuffer:void 0,$=Math.max,J=Date.now,L=ae(g,"Map"),G=ae(Object,"create"),K=function(){function e(){}return function(t){if(!me(t))return{};if(z)return z(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function X(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function V(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Z(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function W(e){var t=this.__data__=new V(e);this.size=t.size}function Q(e,t,n){(void 0!==n&&!le(e[t],n)||void 0===n&&!(t in e))&&te(e,t,n)}function Y(e,t,n){var r=e[t];S.call(e,t)&&le(r,n)&&(void 0!==n||t in e)||te(e,t,n)}function ee(e,t){for(var n=e.length;n--;)if(le(e[n][0],t))return n;return-1}function te(e,t,n){"__proto__"==t&&N?N(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}X.prototype.clear=function(){this.__data__=G?G(null):{},this.size=0},X.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},X.prototype.get=function(e){var t=this.__data__;if(G){var n=t[e];return n===r?void 0:n}return S.call(t,e)?t[e]:void 0},X.prototype.has=function(e){var t=this.__data__;return G?void 0!==t[e]:S.call(t,e)},X.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=G&&void 0===t?r:t,this},V.prototype.clear=function(){this.__data__=[],this.size=0},V.prototype.delete=function(e){var t=this.__data__,n=ee(t,e);return!(n<0||(n==t.length-1?t.pop():B.call(t,n,1),--this.size,0))},V.prototype.get=function(e){var t=this.__data__,n=ee(t,e);return n<0?void 0:t[n][1]},V.prototype.has=function(e){return ee(this.__data__,e)>-1},V.prototype.set=function(e,t){var n=this.__data__,r=ee(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Z.prototype.clear=function(){this.size=0,this.__data__={hash:new X,map:new(L||V),string:new X}},Z.prototype.delete=function(e){var t=se(this,e).delete(e);return this.size-=t?1:0,t},Z.prototype.get=function(e){return se(this,e).get(e)},Z.prototype.has=function(e){return se(this,e).has(e)},Z.prototype.set=function(e,t){var n=se(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},W.prototype.clear=function(){this.__data__=new V,this.size=0},W.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},W.prototype.get=function(e){return this.__data__.get(e)},W.prototype.has=function(e){return this.__data__.has(e)},W.prototype.set=function(e,t){var n=this.__data__;if(n instanceof V){var r=n.__data__;if(!L||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Z(r)}return n.set(e,t),this.size=n.size,this};function ne(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":D&&D in Object(e)?function(e){var t=S.call(e,D),n=e[D];try{e[D]=void 0;var r=!0}catch(e){}var o=A.call(e);return r&&(t?e[D]=n:delete e[D]),o}(e):function(e){return A.call(e)}(e)}function re(e){return _e(e)&&ne(e)==i}function oe(e,t,n,r,o){e!==t&&function(e,t,n){for(var r=-1,o=Object(e),i=n(e),s=i.length;s--;){var a=i[++r];if(!1===t(o[a],a,o))break}}(t,function(i,s){if(o||(o=new W),me(i))!function(e,t,n,r,o,i,s){var c=pe(e,n),u=pe(t,n),p=s.get(u);if(p)Q(e,n,p);else{var f,l,d,h,y,g=i?i(c,u,n+"",e,t,s):void 0,v=void 0===g;if(v){var b=he(u),m=!b&&ge(u),_=!b&&!m&&je(u);g=u,b||m||_?he(c)?g=c:_e(y=c)&&ye(y)?g=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(c):m?(v=!1,g=function(e){return e.slice()}(u)):_?(v=!1,h=new(d=(f=u).buffer).constructor(d.byteLength),new k(h).set(new k(d)),l=h,g=new f.constructor(l,f.byteOffset,f.length)):g=[]:function(e){if(!_e(e)||ne(e)!=a)return!1;var t=q(e);if(null===t)return!0;var n=S.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&P.call(n)==T}(u)||de(u)?(g=c,de(c)?g=function(e){return function(e,t,n){var r=!n;n||(n={});for(var o=-1,i=t.length;++o<i;){var s=t[o],a=void 0;void 0===a&&(a=e[s]),r?te(n,s,a):Y(n,s,a)}return n}(e,we(e))}(c):me(c)&&!ve(c)||(g=function(e){return"function"!=typeof e.constructor||ue(e)?{}:K(q(e))}(u))):v=!1}v&&(s.set(u,g),o(g,u,r,i,s),s.delete(u)),Q(e,n,g)}}(e,t,s,n,oe,r,o);else{var c=r?r(pe(e,s),i,s+"",e,t,o):void 0;void 0===c&&(c=i),Q(e,s,c)}},we)}var ie=N?function(e,t){return N(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:Ce;function se(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function ae(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!me(e)||function(e){return!!x&&x in e}(e))&&(ve(e)?I:c).test(function(e){if(null!=e){try{return P.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}(n)?n:void 0}function ce(e,t){var n=typeof e;return!!(t=null==t?o:t)&&("number"==n||"symbol"!=n&&u.test(e))&&e>-1&&e%1==0&&e<t}function ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||C)}function pe(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var fe=function(e){var t=0,n=0;return function(){var r=J(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(ie);function le(e,t){return e===t||e!=e&&t!=t}var de=re(function(){return arguments}())?re:function(e){return _e(e)&&S.call(e,"callee")&&!F.call(e,"callee")},he=Array.isArray;function ye(e){return null!=e&&be(e.length)&&!ve(e)}var ge=H||function(){return!1};function ve(e){if(!me(e))return!1;var t=ne(e);return t==s||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function be(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=o}function me(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function _e(e){return null!=e&&"object"==typeof e}var je=w?function(e){return function(t){return e(t)}}(w):function(e){return _e(e)&&be(e.length)&&!!p[ne(e)]};function we(e){return ye(e)?function(e,t){var n=he(e),r=!n&&de(e),o=!n&&!r&&ge(e),i=!n&&!r&&!o&&je(e),s=n||r||o||i,a=s?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=a.length;for(var u in e)!t&&!S.call(e,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ce(u,c))||a.push(u);return a}(e,!0):function(e){if(!me(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=ue(e),n=[];for(var r in e)("constructor"!=r||!t&&S.call(e,r))&&n.push(r);return n}(e)}var Oe,Re=(Oe=function(e,t,n){oe(e,t,n)},function(e,t){return fe(function(e,t,n){return t=$(void 0===t?e.length-1:t,0),function(){for(var r=arguments,o=-1,i=$(r.length-t,0),s=Array(i);++o<i;)s[o]=r[t+o];o=-1;for(var a=Array(t+1);++o<t;)a[o]=r[o];return a[t]=n(s),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,a)}}(e,t,Ce),e+"")}(function(e,t){var n=-1,r=t.length,o=r>1?t[r-1]:void 0,i=r>2?t[2]:void 0;for(o=Oe.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(e,t,n){if(!me(n))return!1;var r=typeof t;return!!("number"==r?ye(n)&&ce(t,n.length):"string"==r&&t in n)&&le(n[t],e)}(t[0],t[1],i)&&(o=r<3?void 0:o,r=1),e=Object(e);++n<r;){var s=t[n];s&&Oe(e,s,n)}return e}));function Ce(e){return e}e.exports=Re},168:e=>{var t;t=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({path:"/"},o.defaults,i)).expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var s=JSON.stringify(n);/^[\{\[]/.test(s)&&(n=s)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var a="";for(var c in i)i[c]&&(a+="; "+c,!0!==i[c]&&(a+="="+i[c].split(";")[0]));return document.cookie=t+"="+n+a}}function s(e,n){if("undefined"!=typeof document){for(var o={},i=document.cookie?document.cookie.split("; "):[],s=0;s<i.length;s++){var a=i[s].split("="),c=a.slice(1).join("=");n||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var u=t(a[0]);if(c=(r.read||r)(c,u)||t(c),n)try{c=JSON.parse(c)}catch(e){}if(o[u]=c,e===u)break}catch(e){}}return e?o[e]:o}}return o.set=i,o.get=function(e){return s(e,!1)},o.getJSON=function(e){return s(e,!0)},o.remove=function(t,n){i(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}(function(){})},"function"==typeof define&&define.amd&&define(t),e.exports=t()},803:e=>{"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}},1915:e=>{"use strict";var t="%[a-f0-9]{2}",n=new RegExp("("+t+")|([^%]+?)","gi"),r=new RegExp("("+t+")+","gi");function o(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],o(n),o(r))}function i(e){try{return decodeURIComponent(e)}catch(i){for(var t=e.match(n)||[],r=1;r<t.length;r++)t=(e=o(t,r).join("")).match(n)||[];return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=r.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var o=i(n[0]);o!==n[0]&&(t[n[0]]=o)}n=r.exec(e)}t["%C2"]="�";for(var s=Object.keys(t),a=0;a<s.length;a++){var c=s[a];e=e.replace(new RegExp(c,"g"),t[c])}return e}(e)}}},4475:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var i,s,a=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var u in i=Object(arguments[c]))n.call(i,u)&&(a[u]=i[u]);if(t){s=t(i);for(var p=0;p<s.length;p++)r.call(i,s[p])&&(a[s[p]]=i[s[p]])}}return a}},5889:(e,t,n)=>{"use strict";var r=n(803),o=n(4475);n(1915);function i(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}t.As=function(e,t){!1===(t=o({encode:!0,strict:!0,arrayFormat:"none"},t)).sort&&(t.sort=function(){});var n=function(e){switch(e.arrayFormat){case"index":return function(t,n,r){return null===n?[i(t,e),"[",r,"]"].join(""):[i(t,e),"[",i(r,e),"]=",i(n,e)].join("")};case"bracket":return function(t,n){return null===n?i(t,e):[i(t,e),"[]=",i(n,e)].join("")};default:return function(t,n){return null===n?i(t,e):[i(t,e),"=",i(n,e)].join("")}}}(t);return e?Object.keys(e).sort(t.sort).map(function(r){var o=e[r];if(void 0===o)return"";if(null===o)return i(r,t);if(Array.isArray(o)){var s=[];return o.slice().forEach(function(e){void 0!==e&&s.push(n(r,e,s.length))}),s.join("&")}return i(r,t)+"="+i(o,t)}).filter(function(e){return e.length>0}).join("&"):""}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r](i,i.exports,n),i.loaded=!0,i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";n.r(r),n.d(r,{createZipPaymentStrategy:()=>C});var e=n(168),t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)},o=/application\/(\w+\+)?json/,i=/application\/x-www-form-urlencoded/;const s=function(){function e(){}return e.prototype.toRequestBody=function(e){var t,n=e.headers?this._getHeader(e.headers,"Content-Type"):"";if(e.body){if(o.test(n))return JSON.stringify(e.body);if(i.test(n))return"object"!=typeof(t=e.body)||null===t?t:Object.keys(t).filter(function(e){return void 0!==t[e]}).map(function(e){var n=t[e];return"string"==typeof n?e+"="+encodeURIComponent(n):e+"="+encodeURIComponent(JSON.stringify(n)||"")}).join("&")}return e.body},e.prototype.toResponse=function(e){var t=this._parseResponseHeaders(e.getAllResponseHeaders());return{body:this._parseResponseBody("response"in e?e.response:e.responseText,t),headers:t,status:e.status,statusText:e.statusText}},e.prototype._parseResponseBody=function(e,t){var n=this._getHeader(t,"Content-Type");return e&&o.test(n)?JSON.parse(e):e},e.prototype._parseResponseHeaders=function(e){return(e?e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/):[]).reduce(function(e,n){var r,o=n.split(":"),i=(o.shift()||"").trim();return i?t(t({},e),((r={})[i.toLowerCase()]=o.join(":").trim(),r)):e},{})},e.prototype._getHeader=function(e,t){return e&&t&&(e[t]||e[t.toLowerCase()])||""},e}();var a=n(5889);const c=function(){function e(){}return e.prototype.createRequest=function(e,t){var n=new XMLHttpRequest;return this._configureRequest(n,e,t),n},e.prototype._configureRequest=function(e,t,n){void 0===n&&(n={}),e.open(n.method||"GET",this._formatUrl(t,n.params,n.encodeParams),!0),n.headers&&this._configureRequestHeaders(e,n.headers),"boolean"==typeof n.credentials&&(e.withCredentials=n.credentials),"number"==typeof n.timeout&&(e.timeout=n.timeout)},e.prototype._configureRequestHeaders=function(e,t){Object.keys(t).filter(function(e){return null!==t[e]}).forEach(function(n){e.setRequestHeader(n,t[n])})},e.prototype._formatUrl=function(e,t,n){return void 0===n&&(n=!0),t&&0!==Object.keys(t).length?e+"?"+a.As(t,{encode:n}):e},e}();var u=n(35),p=n.n(u),f=function(){function e(){this._cache={}}return e.prototype.read=function(e,t){var n=this.getKey(e,t.params);return this._cache[n]||null},e.prototype.write=function(e,t,n){var r=this.getKey(e,t.params);this._cache[r]=n},e.prototype.getKey=function(e,t){return void 0===t&&(t={}),0===Object.keys(t).length?e:e+"?"+a.As(t)},e}();const l=function(){function e(e){var t=this;this._delay=e,this._resolve=function(){},this._promise=new Promise(function(e){t._resolve=e})}return e.prototype.onComplete=function(e){this._promise.then(e)},e.prototype.complete=function(){this._resolve(),this._timeoutToken&&window.clearTimeout(this._timeoutToken)},e.prototype.start=function(){var e=this;this._delay&&(this._timeoutToken=window.setTimeout(function(){return e.complete()},this._delay))},e}(),d=function(){function e(e,t,n,r){void 0===r&&(r={}),this._requestFactory=e,this._payloadTransformer=t,this._cookie=n,this._options=r,this._cache=this._options.cache||new f}return e.prototype.sendRequest=function(e,t){var n=this,r=this._mergeDefaultOptions(e,t),o=this._getCachedRequest(e,r);if(o)return Promise.resolve(o);var i=this._requestFactory.createRequest(this._prependHost(e),r);return new Promise(function(t,o){var s,a=function(){var s=n._payloadTransformer.toResponse(i);s.status>=200&&s.status<300?(n._cacheRequest(e,r,s),t(s)):o(s)};i.onload=a,i.onerror=a,i.onabort=a,i.ontimeout=a,r.timeout instanceof l&&(r.timeout.onComplete(function(){return i.abort()}),r.timeout.start()),!(s=r.timeout)||"object"!=typeof s&&"function"!=typeof s||"function"!=typeof s.then||r.timeout.then(function(){return i.abort()}),i.send(n._payloadTransformer.toRequestBody(r))})},e.prototype.get=function(e,n){return this.sendRequest(e,t(t({},n),{method:"GET"}))},e.prototype.post=function(e,n){return this.sendRequest(e,t(t({},n),{method:"POST"}))},e.prototype.put=function(e,n){return this.sendRequest(e,t(t({},n),{method:"PUT"}))},e.prototype.patch=function(e,n){return this.sendRequest(e,t(t({},n),{method:"PATCH"}))},e.prototype.delete=function(e,n){return this.sendRequest(e,t(t({},n),{method:"DELETE"}))},e.prototype._mergeDefaultOptions=function(e,t){var n={credentials:!0,encodeParams:!0,headers:{Accept:"application/json, text/plain, */*"},method:"GET"},r=this._cookie.get("XSRF-TOKEN");return r&&n.headers&&!this._isAssetRequest(e,t)&&this._isLocalRequest(e)&&(n.headers["X-XSRF-TOKEN"]=r),t&&t.body&&n.headers&&(n.headers["Content-Type"]="application/json"),p()({},n,t)},e.prototype._prependHost=function(e){return!this._options.host||/^https?:\/\//.test(e)?e:this._options.host.replace(/\/$/,"")+"/"+e.replace(/^\//,"")},e.prototype._shouldCacheRequest=function(e){return"GET"===(e.method||"GET").toUpperCase()&&Boolean(e.cache)},e.prototype._getCachedRequest=function(e,t){return this._shouldCacheRequest(t)?this._cache.read(e,t):null},e.prototype._cacheRequest=function(e,t,n){this._shouldCacheRequest(t)&&this._cache.write(e,t,n)},e.prototype._isAssetRequest=function(e,t){return(!t||!t.method||"GET"===t.method.toUpperCase())&&/\.(png|gif|jpe?g|css|js|json|svg|html?)$/.test(e.split("?")[0])},e.prototype._isLocalRequest=function(e){return!!e.match(new RegExp("^(https?:)?//"+window.location.hostname))||!e.match(new RegExp("^(https?:)?//"))},e}();var h;!function(e){e.Json="application/json",e.JsonV1="application/vnd.bc.v1+json"}(h||(h={}));const y=h,g={"X-Checkout-SDK-Version":"1.818.0"};var v;class b{constructor(e){this._requestSender=e}saveExternalId(e,t){return n=this,r=void 0,i=function*(){const n=`/api/storefront/payment/${e}/save-external-id`,r={headers:Object.assign({Accept:y.JsonV1,"X-API-INTERNAL":"This API endpoint is for internal use only and may change in the future"},g),body:{externalId:t,provider:e}};yield this._requestSender.post(n,r)},new((o=void 0)||(o=Promise))(function(e,t){function s(e){try{c(i.next(e))}catch(e){t(e)}}function a(e){try{c(i.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o(function(e){e(n)})).then(s,a)}c((i=i.apply(n,r||[])).next())});var n,r,o,i}}class m extends Error{constructor(e){var t;super(e||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",t=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}class _ extends m{constructor(e){super(e||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class j extends _{constructor(e){let t="Unable to submit payment for the order because the payload is invalid.";e&&(t=`${t} Make sure the following fields are provided correctly: ${e.join(", ")}.`),super(t),this.name="PaymentArgumentInvalidError"}}!function(e){e[e.MissingBillingAddress=0]="MissingBillingAddress",e[e.MissingCart=1]="MissingCart",e[e.MissingCheckout=2]="MissingCheckout",e[e.MissingConsignments=3]="MissingConsignments",e[e.MissingCustomer=4]="MissingCustomer",e[e.MissingCheckoutConfig=5]="MissingCheckoutConfig",e[e.MissingOrder=6]="MissingOrder",e[e.MissingOrderConfig=7]="MissingOrderConfig",e[e.MissingOrderId=8]="MissingOrderId",e[e.MissingPayment=9]="MissingPayment",e[e.MissingPaymentId=10]="MissingPaymentId",e[e.MissingPaymentInstrument=11]="MissingPaymentInstrument",e[e.MissingPaymentMethod=12]="MissingPaymentMethod",e[e.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",e[e.MissingPaymentStatus=14]="MissingPaymentStatus",e[e.MissingPaymentToken=15]="MissingPaymentToken",e[e.MissingShippingAddress=16]="MissingShippingAddress"}(v||(v={}));class w extends m{constructor(e){super(function(e){switch(e){case v.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case v.MissingCart:return"Unable to proceed because cart data is unavailable.";case v.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case v.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case v.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case v.MissingCheckoutConfig:case v.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case v.MissingOrder:return"Unable to proceed because order data is unavailable.";case v.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case v.MissingPayment:return"Unable to proceed because payment data is unavailable.";case v.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case v.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case v.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}class O extends m{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}class R{constructor(e,t){this.paymentIntegrationService=e,this.storefrontPaymentRequestSender=t}initialize(){return Promise.resolve()}execute(e,t){return n=this,r=void 0,i=function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["payment"]);if(!n)throw new j(["payment"]);const{methodId:o}=n,{getPaymentMethodOrThrow:i}=yield this.paymentIntegrationService.loadPaymentMethod(o,t),{clientToken:s,initializationData:a}=i(o),c=null==a?void 0:a.redirectUrl;if(!s||!c)throw new w(v.MissingPaymentMethod);const{id:u}=JSON.parse(s);if(!u)throw new w(v.MissingPaymentToken);const{isStoreCreditApplied:p}=this.paymentIntegrationService.getState().getCheckoutOrThrow();yield this.paymentIntegrationService.applyStoreCredit(p),yield this.paymentIntegrationService.initializePayment(o,{useStoreCredit:p}),yield this.paymentIntegrationService.submitOrder(r,t),yield this._prepareForReferredRegistration(o,u);try{yield this.paymentIntegrationService.submitPayment({methodId:o,paymentData:{nonce:u}})}catch(e){if((e=>"object"==typeof e&&null!==e&&"body"in e)(e)&&"additional_action_required"===e.body.status)return new Promise(()=>window.location.replace(c));throw e}},new((o=void 0)||(o=Promise))(function(e,t){function s(e){try{c(i.next(e))}catch(e){t(e)}}function a(e){try{c(i.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o(function(e){e(n)})).then(s,a)}c((i=i.apply(n,r||[])).next())});var n,r,o,i}finalize(){return Promise.reject(new O)}deinitialize(){return Promise.resolve()}_prepareForReferredRegistration(e,t){return this.storefrontPaymentRequestSender.saveExternalId(e,t)}}const C=Object.assign(t=>{const{getHost:n}=t.getState(),r=(o={host:n()},new d(new c,new s,e,o));var o;const i=new b(r);return new R(t,i)},{resolveIds:[{id:"zip"},{id:"quadpay"}]})})(),module.exports=r})();
|
|
3
3
|
//# sourceMappingURL=zip.js.map
|