@arc-publishing/sdk-commerce-sales
Version:
JS Commerce Sales SDK for working with Arc Commerce Sales API
1 lines • 110 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.CommerceSales=t():e.CommerceSales=t()}("undefined"!=typeof ArcSDK?ArcSDK:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/sdk-commerce-sales/",n(n.s=26)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.default=function(e){return r.__awaiter(this,void 0,void 0,(function(){var t;return r.__generator(this,(function(n){switch(n.label){case 0:return[4,e.text()];case 1:t=n.sent();try{return[2,JSON.parse(t)]}catch(n){return 2==(e.status/100|0)?[2,Promise.resolve({message:t})]:[2,Promise.resolve({code:e.status,message:t,httpStatus:e.status,error:!0})]}return[2]}}))}))}},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return a})),n.d(t,"__decorate",(function(){return s})),n.d(t,"__param",(function(){return u})),n.d(t,"__esDecorate",(function(){return c})),n.d(t,"__runInitializers",(function(){return d})),n.d(t,"__propKey",(function(){return l})),n.d(t,"__setFunctionName",(function(){return f})),n.d(t,"__metadata",(function(){return h})),n.d(t,"__awaiter",(function(){return _})),n.d(t,"__generator",(function(){return g})),n.d(t,"__createBinding",(function(){return p})),n.d(t,"__exportStar",(function(){return v})),n.d(t,"__values",(function(){return y})),n.d(t,"__read",(function(){return b})),n.d(t,"__spread",(function(){return m})),n.d(t,"__spreadArrays",(function(){return w})),n.d(t,"__spreadArray",(function(){return I})),n.d(t,"__await",(function(){return S})),n.d(t,"__asyncGenerator",(function(){return O})),n.d(t,"__asyncDelegator",(function(){return E})),n.d(t,"__asyncValues",(function(){return T})),n.d(t,"__makeTemplateObject",(function(){return P})),n.d(t,"__importStar",(function(){return D})),n.d(t,"__importDefault",(function(){return k})),n.d(t,"__classPrivateFieldGet",(function(){return R})),n.d(t,"__classPrivateFieldSet",(function(){return j})),n.d(t,"__classPrivateFieldIn",(function(){return G})),n.d(t,"__addDisposableResource",(function(){return M})),n.d(t,"__disposeResources",(function(){return N}));var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function a(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 i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function s(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t,n,r,i,o){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,u=r.kind,c="getter"===u?"get":"setter"===u?"set":"value",d=!t&&e?r.static?e:e.prototype:null,l=t||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),f=!1,h=n.length-1;h>=0;h--){var _={};for(var g in r)_[g]="access"===g?{}:r[g];for(var g in r.access)_.access[g]=r.access[g];_.addInitializer=function(e){if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(a(e||null))};var p=(0,n[h])("accessor"===u?{get:l.get,set:l.set}:l[c],_);if("accessor"===u){if(void 0===p)continue;if(null===p||"object"!=typeof p)throw new TypeError("Object expected");(s=a(p.get))&&(l.get=s),(s=a(p.set))&&(l.set=s),(s=a(p.init))&&i.unshift(s)}else(s=a(p))&&("field"===u?i.unshift(s):l[c]=s)}d&&Object.defineProperty(d,r.name,l),f=!0}function d(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function l(e){return"symbol"==typeof e?e:"".concat(e)}function f(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function _(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function g(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}var p=Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]};function v(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||p(t,e,n)}function y(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function b(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e}function w(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}function I(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function S(e){return this instanceof S?(this.v=e,this):new S(e)}function O(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||s(e,t)}))})}function s(e,t){try{(n=i[e](t)).value instanceof S?Promise.resolve(n.value.v).then(u,c):d(o[0][2],n)}catch(e){d(o[0][3],e)}var n}function u(e){s("next",e)}function c(e){s("throw",e)}function d(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function E(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:S(e[r](t)),done:!1}:i?i(t):t}:i}}function T(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=y(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var A=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function D(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&p(t,e,n);return A(t,e),t}function k(e){return e&&e.__esModule?e:{default:e}}function R(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function j(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}function G(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function M(e,t,n){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var r;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(void 0===r){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose]}if("function"!=typeof r)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}var L="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var r=new Error(n);return r.name="SuppressedError",r.error=e,r.suppressed=t,r};function N(e){function t(t){e.error=e.hasError?new L(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var r=e.stack.pop();try{var i=r.dispose&&r.dispose.call(r.value);if(r.async)return Promise.resolve(i).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}t.default={__extends:i,__assign:o,__rest:a,__decorate:s,__param:u,__metadata:h,__awaiter:_,__generator:g,__createBinding:p,__exportStar:v,__values:y,__read:b,__spread:m,__spreadArrays:w,__spreadArray:I,__await:S,__asyncGenerator:O,__asyncDelegator:E,__asyncValues:T,__makeTemplateObject:P,__importStar:D,__importDefault:k,__classPrivateFieldGet:R,__classPrivateFieldSet:j,__classPrivateFieldIn:G,__addDisposableResource:M,__disposeResources:N}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(3),o=n(29),a=r.__importStar(n(31)),s=r.__importDefault(n(19)),u=r.__importDefault(n(33)),c=r.__importDefault(n(34)),d=n(35),l=r.__importDefault(n(36)),f=r.__importDefault(n(37)),h=r.__importDefault(n(21)),_=r.__importDefault(n(22)),g=r.__importDefault(n(38)),p=r.__importDefault(n(39)),v=r.__importDefault(n(41)),y=n(42),b=r.__importDefault(n(43)),m=r.__importDefault(n(44)),w=r.__importDefault(n(45)),I=r.__importDefault(n(46)),S=r.__importDefault(n(47)),O=r.__importDefault(n(48)),E=n(17),T=r.__importStar(n(49)),P=n(50),A=r.__importDefault(n(51)),D=r.__importDefault(n(52)),k=r.__importDefault(n(53)),R=r.__importDefault(n(55)),j=r.__importStar(n(13)),G=r.__importDefault(n(57)),M=r.__importDefault(n(58)),L=r.__importDefault(n(59)),N=r.__importDefault(n(60)),C=r.__importDefault(n(61)),U=r.__importDefault(n(62)),x=r.__importDefault(n(63)),K=r.__importStar(n(10)),z=r.__importDefault(n(64)),F=r.__importDefault(n(65)),Y=r.__importDefault(n(66)),B=r.__importDefault(n(24)),J=r.__importDefault(n(67)),H=r.__importDefault(n(68)),W=r.__importDefault(n(16)),q=function(){function e(){}return Object.defineProperty(e,"userIdentity",{get:function(){return!this._userIdentity&&this._userIdentityStorage&&(this._userIdentity=JSON.parse(this._userIdentityStorage.getItem(i.IDENTITY_STORAGE_KEY)||"{}")),this._userIdentity},set:function(e){(0,o.shouldStorageChange)(this._userIdentityStorage,this._isSession,i.IDENTITY_STORAGE_KEY)&&(this._userIdentityStorage instanceof W.default&&this._userIdentityStorage.removeItem(i.IDENTITY_STORAGE_KEY),this._userIdentityStorage=(0,o.initStorage)(this._baseDomain,this._isSession)),e.uuid||e.accessToken||e.refreshToken||e.impersonator||this._userIdentityStorage.removeItem(i.IDENTITY_STORAGE_KEY),this._userIdentityStorage.setItem(i.IDENTITY_STORAGE_KEY,JSON.stringify(e)),this._userIdentity=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"userProfile",{get:function(){return this._userProfile||(this._userProfile=JSON.parse(this._selectedStorage.getItem(i.PROFILE_STORAGE_KEY)||null)),this._userProfile},set:function(e){var t,n;null===e&&this._selectedStorage.removeItem(i.PROFILE_STORAGE_KEY),(0,o.shouldStorageChange)(this._selectedStorage,this._isSession,i.PROFILE_STORAGE_KEY)&&(this._selectedStorage instanceof W.default&&this._selectedStorage.removeItem(i.PROFILE_STORAGE_KEY),this._selectedStorage=(0,o.initStorage)(this._baseDomain,this._isSession,null===(t=this._profileStorageOpt)||void 0===t?void 0:t.storageExp)),(null===(n=this._profileStorageOpt)||void 0===n?void 0:n.ignoreProfile)?this._selectedStorage.removeItem(i.PROFILE_STORAGE_KEY):this._selectedStorage.setItem(i.PROFILE_STORAGE_KEY,JSON.stringify(e)),this._userProfile=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"userSegments",{get:function(){return this._userSegments||(this._userSegments=JSON.parse(this._selectedStorage.getItem(i.USER_SEGMENTS_STORAGE_KEY)||null)),this._userSegments},set:function(e){this._selectedStorage.setItem(i.USER_SEGMENTS_STORAGE_KEY,JSON.stringify(e)),this._userSegments=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"configOptions",{get:function(){return this._configOptions},enumerable:!1,configurable:!0}),Object.defineProperty(e,"userSettings",{get:function(){return this._userSettings||this._userSettings||(this._userSettings=JSON.parse(this._selectedStorage.getItem(i.USER_SETTINGS_STORAGE_KEY)||null)),this._userSettings},set:function(e){null===e&&this._selectedStorage.removeItem(i.USER_SETTINGS_STORAGE_KEY),this._selectedStorage.setItem(i.USER_SETTINGS_STORAGE_KEY,JSON.stringify(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"baseDomain",{set:function(e){this._userIdentityStorage=(0,o.initStorage)(e),this._baseDomain=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,"ampReaderId",{get:function(){return this._ampReaderId||(this._ampReaderId=JSON.parse(this._selectedStorage.getItem(i.AMP_ID_STORAGE_KEY)||null)),this._ampReaderId},set:function(e){null==e?this._selectedStorage.removeItem(i.AMP_ID_STORAGE_KEY):e&&this._selectedStorage.setItem(i.AMP_ID_STORAGE_KEY,JSON.stringify(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e,"profileStorageOpt",{get:function(){return this._profileStorageOpt},set:function(e){e&&(this._profileStorageOpt=e)},enumerable:!1,configurable:!0}),e._version=n(69).version,e._userIdentityStorage=(0,o.initStorage)(),e._selectedStorage=(0,o.initStorage)(),e.apiOrigin="",e._baseDomain="",e._google={useCustomButton:!1},e._useCustomFBButton=!1,e.options=f.default,e.login=a.default,e.isLoggedIn=a.isLoggedIn,e.extendSession=d.extendSession,e.clearSession=l.default,e.heartbeat=d.heartbeat,e.logout=s.default,e.getUserSettings=P.getUserSettings,e.getUserProfile=g.default,e.getUserSegments=p.default,e.updateUserProfile=v.default,e.uploadAvatar=y.uploadAvatar,e.deleteAvatar=y.deleteAvatar,e.signUp=b.default,e.updatePassword=m.default,e.requestResetPassword=w.default,e.resetPassword=I.default,e.requestDeleteAccount=T.default,e.approveDeleteAccount=T.approveDeleteAccount,e.declineDeleteAccount=T.declineDeleteAccount,e.getConfig=E.getConfig,e.initFacebookLogin=R.default,e.facebookSignOn=x.default,e.initGoogleLogin=j.default,e.initGoogleAuthSDK=j.initGoogleAuthSDK,e.initGoogleAuth=j.initGoogleAuth,e.initiateOIDC=M.default,e.signInWithOIDC=L.default,e.signInWithOIDCPKCE=N.default,e.loginWithArcIdentityAsOIDCProvider=C.default,e.unlinkOIDC=U.default,e.googleSignOn=K.default,e.signInWithGoogle=z.default,e.initAppleSignOn=G.default,e.appleSignOn=F.default,e.requestMagicLink=u.default,e.redeemMagicLink=c.default,e.requestVerifyEmail=S.default,e.verifyEmail=O.default,e.listGdprReports=D.default,e.getGdprReport=k.default,e.getThirdPartyTokens=A.default,e.unlinkSocialIdentity=Y.default,e.requestOTALink=h.default,e.redeemOTALink=_.default,e.getSwgAccessToken=B.default,e.checkSwgLogin=J.default,e.relinkGoogleAccount=H.default,e.signOnSwgUser=K.signOnSwgUser,e}();t.default=q},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.USER_SEGMENTS_STORAGE_KEY=t.logPrefix=t.headers=t.AMP_ID_STORAGE_KEY=t.USER_SETTINGS_STORAGE_KEY=t.PROFILE_STORAGE_KEY_EXPIRED_TIME=t.PROFILE_STORAGE_KEY=t.IDENTITY_STORAGE_KEY=void 0,t.IDENTITY_STORAGE_KEY="ArcId.USER_INFO",t.PROFILE_STORAGE_KEY="ArcId.USER_PROFILE",t.PROFILE_STORAGE_KEY_EXPIRED_TIME="ArcId.USER_PROFILE_EXPIRED_TIME",t.USER_SETTINGS_STORAGE_KEY="ArcId.USER_SETTINGS",t.AMP_ID_STORAGE_KEY="ArcId.AMP_READER_ID",t.headers={"Content-Type":"application/json"},t.logPrefix="[Arc Identity SDK]",t.USER_SEGMENTS_STORAGE_KEY="ArcId.USER_SEGMENTS"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.default=function(e){return r.__awaiter(this,void 0,void 0,(function(){var t;return r.__generator(this,(function(n){switch(n.label){case 0:return[4,e.clone().text()];case 1:t=n.sent();try{return[2,JSON.parse(t)]}catch(n){return 2==(e.status/100|0)?[2,Promise.resolve({message:t})]:[2,Promise.resolve({code:e.status,message:t,httpStatus:e.status,error:!0})]}return[2]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAPIErrorResponse=void 0,t.isAPIErrorResponse=function(e){return void 0!==e.code&&void 0!==e.message}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isAPIErrorResponse=void 0,t.isAPIErrorResponse=function(e){return void 0!==e.code&&void 0!==e.message}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isUserIdentity=t.isUpdatePasswordSuccessResponse=void 0,t.isUpdatePasswordSuccessResponse=function(e){return void 0!==e.userName},t.isUserIdentity=function(e){return void 0!==e.uuid}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isFacebookLoginResponse=t.isGoogleCredentialResponse=t.isLegacyGoogleSetting=void 0,t.isLegacyGoogleSetting=function(e){return void 0!==e.auth2},t.isGoogleCredentialResponse=function(e){return void 0!==e.credential},t.isFacebookLoginResponse=function(e){return void 0!==e.status}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RecaptchaMethod=void 0;var r,i=n(1),o=i.__importDefault(n(2)),a=n(17);!function(e){e.SIGN_IN="SIGN_IN",e.SIGN_UP="SIGN_UP",e.MAGIC_LINK="MAGIC_LINK",e.RESET_PASSWORD="RESET_PASSWORD"}(r||(t.RecaptchaMethod=r={})),t.default=function(e,t){return i.__awaiter(this,void 0,void 0,(function(){var n;return i.__generator(this,(function(i){switch(i.label){case 0:return[4,o.default.getConfig()];case 1:if(n=i.sent(),(0,a.isConfigOptions)(n)&&(e===r.MAGIC_LINK&&n.magicLinkRecaptcha||e===r.SIGN_IN&&n.signinRecaptcha||e===r.SIGN_UP&&n.signupRecaptcha||e===r.RESET_PASSWORD&&n.resetPasswordRecaptcha)&&!t)throw{code:"130001",message:"Captcha token invalid"};return[2,!0]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.signOnSwgUser=t.googleSignOn=t.deprecationMessage=void 0;var r=n(1),i=n(11),o=n(8),a=n(13),s=r.__importDefault(n(2));t.deprecationMessage="Legacy Google Sign In will be deprecated on Dec 31, 2022. Use the new Arc Identity & Sign In With Google SDKs.";t.googleSignOn=function(e){return r.__awaiter(void 0,void 0,void 0,(function(){var n,i,c,d;return r.__generator(this,(function(r){switch(r.label){case 0:if(console.error(t.deprecationMessage),e)return[2,u(e)];r.label=1;case 1:return r.trys.push([1,7,,8]),(0,o.isLegacyGoogleSetting)(s.default._google)?s.default._google.authInstance?[3,3]:[4,(0,a.getGoogleAuthInstance)()]:[3,5];case 2:r.sent(),r.label=3;case 3:return(n=s.default._google.authInstance)&&n.isSignedIn.get()?[2,u(n.currentUser.get())]:[4,null===(d=s.default._google.authInstance)||void 0===d?void 0:d.signIn({prompt:"select_account"})];case 4:return i=r.sent(),[2,u(i)];case 5:throw c=new Error("[Arc Identity SDK] - This method will only work with the legacy Google Sign In. Discontinue use of this method."),console.error(c),c;case 6:return[3,8];case 7:throw r.sent();case 8:return[2]}}))}))};t.signOnSwgUser=function(e){var n=e.idToken,u=e.swgSubscriptionTokenResponse;return r.__awaiter(void 0,void 0,void 0,(function(){var e,c,d,l,f;return r.__generator(this,(function(r){switch(r.label){case 0:return console.error(t.deprecationMessage),n?[2,(0,i.socialLogin)("google",{credentials:n})]:[3,1];case 1:return u?(s.default.userIdentity={uuid:u.profileId,accessToken:u.accessToken,refreshToken:u.refreshToken},[2,s.default.heartbeat()]):[3,2];case 2:return[4,(0,a.getGoogleAuthInstance)()];case 3:if(r.sent(),(0,o.isLegacyGoogleSetting)(s.default._google)){if(null===(l=s.default._google.authInstance)||void 0===l?void 0:l.isSignedIn.get())return e=null===(f=s.default._google.authInstance)||void 0===f?void 0:f.currentUser.get(),c=e.getAuthResponse().id_token,[2,(0,i.socialLogin)("google",{credentials:c})];throw new Error("[Arc Identity SDK] - No google user logged in.")}throw d=new Error("[Arc Identity SDK] - This method will only work with the legacy Google Sign In. Discontinue use of this method."),console.error(d),d;case 4:return[2]}}))}))};var u=function(e){console.error(t.deprecationMessage);var n=e.getAuthResponse().id_token;if((0,o.isLegacyGoogleSetting)(s.default._google))return(0,i.socialLogin)("google",{credentials:n}).then((function(e){if((0,o.isLegacyGoogleSetting)(s.default._google))return s.default._google.onSuccess&&s.default._google.onSuccess(),e;throw new Error("[Arc Identity SDK] - This method will only work with the legacy Google Sign In. Discontinue use of this method.")})).catch((function(e){throw(0,o.isLegacyGoogleSetting)(s.default._google)?(s.default._google.onFailure&&s.default._google.onFailure(),e):new Error("[Arc Identity SDK] - This method will only work with the legacy Google Sign In. Discontinue use of this method.")}));throw new Error("[Arc Identity SDK] - This method will only work with the legacy Google Sign In. Discontinue use of this method.")};t.default=t.googleSignOn},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.socialLogin=void 0;var r=n(1),i=r.__importDefault(n(2)),o=n(7),a=n(3),s=r.__importDefault(n(4));t.socialLogin=function(e,t){return r.__awaiter(this,void 0,void 0,(function(){var n;return r.__generator(this,(function(u){switch(u.label){case 0:return n=r.__assign({},a.headers),i.default.userIdentity&&i.default.userIdentity.accessToken&&i.default.userIdentity.refreshToken?[4,i.default.heartbeat()]:[3,2];case 1:u.sent(),n.Authorization="Bearer ".concat(i.default.userIdentity.accessToken),u.label=2;case 2:return[2,fetch("".concat(i.default.apiOrigin,"/identity/public/v1/auth/login"),{method:"POST",headers:n,body:JSON.stringify(r.__assign(r.__assign({},t),{userName:"",grantType:e}))}).then(s.default).then((function(t){if((0,o.isUserIdentity)(t))return localStorage.removeItem(a.PROFILE_STORAGE_KEY_EXPIRED_TIME),i.default.userIdentity=t,window.postMessage({type:"ARC_LOGIN_SUCCESS",grantType:e},"*"),t;throw t}))]}}))}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSignUpResponse=t.isUserProfile=void 0,t.isUserProfile=function(e){return void 0!==e.uuid},t.isSignUpResponse=function(e){return void 0!==e.uuid}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initGoogleLogin=t.initGoogleAuthSDK=t.initGoogleAuth=t.getGoogleAuthInstance=t.loadGoogleAuthSDK=t.GOOGLE_SDK_URL=void 0;var r=n(1),i=n(10),o=n(8),a=r.__importDefault(n(2)),s=n(10);t.GOOGLE_SDK_URL="https://apis.google.com/js/platform.js";t.loadGoogleAuthSDK=function(e){return console.error(s.deprecationMessage),new Promise((function(n,i){return r.__awaiter(void 0,void 0,void 0,(function(){var s,u;return r.__generator(this,(function(c){switch(c.label){case 0:return document.querySelector('[src="'.concat(t.GOOGLE_SDK_URL,'"]'))?[3,1]:((s=document.createElement("script")).onload=function(){var t=this;window.gapi.load("auth2",(function(){return r.__awaiter(t,void 0,void 0,(function(){var t,s,u,c;return r.__generator(this,(function(d){switch(d.label){case 0:if(a.default._google=r.__assign(r.__assign({},a.default._google),{auth2:null!==(u=null===(s=window.gapi)||void 0===s?void 0:s.auth2)&&void 0!==u?u:(0,o.isLegacyGoogleSetting)(a.default._google)&&(null===(c=a.default._google)||void 0===c?void 0:c.auth2)}),!e)return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,e()];case 2:return d.sent(),[3,4];case 3:return t=d.sent(),[2,i(t)];case 4:return[2,n()]}}))}))}))},s.onerror=function(){i("[Arc Identity SDK] - Error loading Google SDK")},s.async=!0,s.src=t.GOOGLE_SDK_URL,document.head.appendChild(s),[3,7]);case 1:return window.gapi?window.gapi.auth2?[3,2]:(window.gapi.load("auth2",(function(){return r.__awaiter(void 0,void 0,void 0,(function(){var t;return r.__generator(this,(function(r){switch(r.label){case 0:if(!e)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e()];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),[2,i(t)];case 4:return[2,n()]}}))}))})),[3,7]):[2,i("[Arc Identity SDK] - Error loading Google SDK")];case 2:if(!e)return[3,6];c.label=3;case 3:return c.trys.push([3,5,,6]),[4,e()];case 4:return c.sent(),[3,6];case 5:return u=c.sent(),[2,i(u)];case 6:return[2,n()];case 7:return[2]}}))}))}))};t.getGoogleAuthInstance=function(){return console.error(s.deprecationMessage),new Promise((function(e,n){return r.__awaiter(void 0,void 0,void 0,(function(){var i;return r.__generator(this,(function(r){switch(r.label){case 0:return(0,o.isLegacyGoogleSetting)(a.default._google)?a.default._google.authInstance?(e(),[3,5]):[3,1]:[3,6];case 1:return a.default._google.auth2?(a.default._google.authInstance=a.default._google.auth2.getAuthInstance(),e(),[3,5]):[3,2];case 2:return r.trys.push([2,4,,5]),[4,(0,t.initGoogleAuthSDK)(a.default._google.clientId)];case 3:return r.sent(),e(),[3,5];case 4:return i=r.sent(),console.error("Error getting Google Auth instance."),n(i),[3,5];case 5:return[3,7];case 6:n("This method should only be used with the legacy Google Sign In. Migrate to the new Sign In With Google"),r.label=7;case 7:return[2]}}))}))}))};t.initGoogleAuth=function(e){return r.__awaiter(void 0,void 0,void 0,(function(){var t,n,i,u,c,d,l,f,h,_,g,p,v,y;return r.__generator(this,(function(b){switch(b.label){case 0:if(console.error(s.deprecationMessage),a.default._google=r.__assign(r.__assign({},a.default._google),{auth2:null!==(u=null===(i=window.gapi)||void 0===i?void 0:i.auth2)&&void 0!==u?u:(0,o.isLegacyGoogleSetting)(a.default._google)&&(null===(c=a.default._google)||void 0===c?void 0:c.auth2),clientId:null!=e?e:(0,o.isLegacyGoogleSetting)(a.default._google)?null===(d=a.default._google)||void 0===d?void 0:d.clientId:void 0}),!(null===(l=a.default._google)||void 0===l?void 0:l.auth2))throw new Error("[Arc Identity SDK] - Error loading Google SDK");return(null===(f=a.default._google)||void 0===f?void 0:f.clientId)||a.default.configOptions&&(!a.default.configOptions||a.default.configOptions.googleClientId)?[3,2]:[4,a.default.getConfig()];case 1:b.sent(),b.label=2;case 2:if(a.default._google.clientId=null!==(_=null===(h=a.default._google)||void 0===h?void 0:h.clientId)&&void 0!==_?_:null===(v=null===(p=null===(g=a.default.configOptions)||void 0===g?void 0:g.googleClientId)||void 0===p?void 0:p.split(","))||void 0===v?void 0:v[0],!a.default._google.clientId)throw new Error("[Arc Identity SDK] - Google Client ID not found, please add one in settings or explicitly pass one to the initGoogleLogin method.");try{(t=null!==(y=a.default._google.authInstance)&&void 0!==y?y:a.default._google.auth2.getAuthInstance())?a.default._google.authInstance=t:(n=a.default._google.auth2.init({client_id:"".concat(a.default._google.clientId.replace(".apps.googleusercontent.com",""),".apps.googleusercontent.com")}),a.default._google.authInstance=n)}catch(e){throw console.error("Error while initializing Google sdk:"),e}return[2]}}))}))};function u(e,n,u,c){var d,l;return void 0===e&&(e=""),void 0===n&&(n={width:240,height:50,longtitle:!0,theme:"dark",scope:["profile","email"]}),void 0===u&&(u="google-sign-in-button"),r.__awaiter(this,void 0,void 0,(function(){var f,h,_,g;return r.__generator(this,(function(p){switch(p.label){case 0:console.error(s.deprecationMessage),p.label=1;case 1:return p.trys.push([1,6,,7]),(0,o.isLegacyGoogleSetting)(a.default._google)?(e&&e!==a.default._google.clientId&&(a.default._google.clientId=e),a.default._google.auth2&&a.default._google.authInstance?[3,3]:[4,(0,t.initGoogleAuthSDK)(a.default._google.clientId)]):[3,4];case 2:p.sent(),p.label=3;case 3:if(!a.default._google.authInstance)throw new Error("[Arc Identity SDK] - Error initializing Google Auth2 SDK");return f=function(e){(0,i.googleSignOn)(e).then((function(){n&&"function"==typeof n.onSuccess&&n.onSuccess(e)}))},n&&"function"==typeof n.onSuccess&&(a.default._google.onSuccess=n.onSuccess,"function"==typeof n.onFailure&&(a.default._google.onFailure=n.onFailure)),c&&(a.default._google.useCustomButton=!0),!c&&n?(a.default._google.authInstance.attachClickHandler(u,{scope:(null!==(d=null==n?void 0:n.scope)&&void 0!==d?d:["profile","email"]).join(" "),prompt:"select_account"},f,n&&n.onFailure||console.error),h={width:240,height:50,longtitle:!0,theme:"dark"},_=r.__assign(r.__assign(r.__assign({},h),n),{scope:(null!==(l=null==n?void 0:n.scope)&&void 0!==l?l:["profile","email"]).join(" ")}),[2,window.gapi.signin2.render(u,_)]):[3,5];case 4:throw new Error("[Arc Identity SDK] - This method will only work with the legacy Google Sign In. Discontinue use of this method.");case 5:return[3,7];case 6:throw g=p.sent(),console.error("Error while initializing Google login:"),g;case 7:return[2]}}))}))}t.initGoogleAuthSDK=function(e){return r.__awaiter(void 0,void 0,void 0,(function(){var n,i;return r.__generator(this,(function(r){switch(r.label){case 0:if(console.error(s.deprecationMessage),!(0,o.isLegacyGoogleSetting)(a.default._google))return[3,5];e&&e!==(null===(i=a.default._google)||void 0===i?void 0:i.clientId)&&(a.default._google.clientId=e),n=a.default._google.clientId,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,(0,t.loadGoogleAuthSDK)((function(){return(0,t.initGoogleAuth)(n)}))];case 2:return r.sent(),[3,4];case 3:throw r.sent();case 4:return[3,6];case 5:throw new Error("This method should only be used with legacy Google Sign In. Discontinue use & migrate to new Sign In With Google");case 6:return[2]}}))}))},t.initGoogleLogin=u,t.default=u},function(e,t,n){"use strict";n.r(t);var r=n(25),i=n.n(r).a;var o={"Content-Type":"application/json"},a="[Arc Sales SDK]";function s(e){e?(ge.apiOrigin=e&&e.apiOrigin&&e.apiOrigin.replace(/\/$/,"")||ge.apiOrigin,e.Identity&&function(e){return!!e.heartbeat&&void 0===e._selectedStorage}(e.Identity)||e.Identity&&function(e){return!!e.heartbeat&&void 0!==e._selectedStorage}(e.Identity)?ge._Identity=e.Identity:(i.options({apiOrigin:ge.apiOrigin}),ge._Identity=i,console.warn("".concat(a," No Identity provided to Sales.options.")))):console.warn("".concat(a," No options specified when calling Sales.options"))}var u=function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function c(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 i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function d(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function l(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}Object.create;function f(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function h(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}Object.create;"function"==typeof SuppressedError&&SuppressedError;var _=n(5),g=n(0),p=n.n(g);function v(){return d(this,void 0,void 0,(function(){return l(this,(function(e){return ge._configOptions?[2,ge._configOptions]:[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/config"),{method:"GET",cache:"no-cache",headers:u({},o)}).then(p.a).then((function(e){if(Object(_.isAPIErrorResponse)(e))throw e;return ge._configOptions=e,e}))]}))}))}function y(e){return!!e.subscriptionID||0===e.subscriptionID}function b(e){return!!(null==e?void 0:e.subscriptionID)||0===(null==e?void 0:e.subscriptionID)}function m(e){return ge.subscriptions.find((function(t){return t.subscriptionID===e}))}function w(e,t){var n=e.find((function(e){return e.subscriptionID===t.subscriptionID})),r=e.filter((function(e){return e.subscriptionID!==t.subscriptionID})),i=u(u({},n),t);return h(h([],f(r),!1),[i],!1)}function I(e,t){return t.reduce((function(e,t){return w(e,t)}),e)}function S(e,t){return t.reduce((function(e,t){return function(e,t){var n=e.find((function(e){return e.subscriptionID===t.subscriptionID})),r=e.filter((function(e){return e.subscriptionID!==t.subscriptionID})),i=u(u({},n),t);return h(h([],f(r),!1),[i],!1)}(e,t)}),e)}function O(e,t){var n=e.find((function(e){return e.orderNumber===t.orderNumber})),r=e.filter((function(e){return e.orderNumber!==t.orderNumber})),i=u(u({},n),t);return h(h([],f(r),!1),[i],!1)}function E(e){return void 0===e&&(e={}),d(this,void 0,void 0,(function(){var t,n;return l(this,(function(r){switch(r.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:return t=r.sent(),n=u(u({},e),{headers:t?u(u({},e.headers),{Authorization:ge._Identity.userIdentity.accessToken}):u({},e.headers)}),t||(n=u(u({},n),{credentials:"include"})),[2,n]}}))}))}function T(e){var t={};return Object.keys(e).forEach((function(n){t[n]=e[n]||void 0})),t}function P(e,t,n){return d(this,void 0,void 0,(function(){var r;return l(this,(function(i){switch(i.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!i.sent())throw new Error("".concat(a," Missing or invalid jwt"));return r=JSON.stringify({reason:t,reasonCode:n}),[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/").concat(e,"/cancel"),{method:"PUT",headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o),body:r}).then(p.a).then((function(t){if(y(t)){var n=m(e);return ge.subscriptions=w(ge.subscriptions,u(u({},n),{subscriptionID:t.subscriptionID,status:3})),t}throw t}))]}}))}))}function A(){return d(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!e.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/allactive"),{method:"GET",headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o)}).then(p.a).then((function(e){if(Array.isArray(e)){var t=e.map((function(e){var t=e.statusID,n=c(e,["statusID"]);return u(u({},n),{status:t})}));return ge.subscriptions=I(ge.subscriptions,t),t}throw e}))]}}))}))}function D(){return d(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!e.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/all"),{method:"GET",headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o)}).then(p.a).then((function(e){if(Array.isArray(e)){var t=e.map((function(e){var t=e.statusID,n=c(e,["statusID"]);return u(u({},n),{status:t})}));return ge.subscriptions=I(ge.subscriptions,t),t}throw e}))]}}))}))}function k(e){return d(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!t.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/").concat(e,"/details"),{method:"GET",cache:"no-cache",headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o)}).then(p.a).then((function(e){if(b(e))return ge.subscriptions=w(ge.subscriptions,e),e;throw e}))]}}))}))}function R(e){return d(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!t.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/").concat(e,"/sharing"),{method:"GET",cache:"no-cache",headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o)}).then(p.a).then((function(e){if(t=e,Array.isArray(t.sharedSubscriptions))return ge.sharedSubscriptions=S(ge.sharedSubscriptions,e.sharedSubscriptions),e;throw e;var t}))]}}))}))}function j(e){return d(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!t.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/").concat(e,"/stopshare"),{method:"PUT",headers:{Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)}}).then(p.a).then((function(e){if(y(e))return ge.sharedSubscriptions=ge.sharedSubscriptions.filter((function(t){return t.subscriptionID!==e.subscriptionID})),e;throw e}))]}}))}))}function G(e,t){return d(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!n.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/").concat(e,"/share"),{method:"PUT",body:JSON.stringify({email:t}),headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o)}).then(p.a).then((function(e){if(void 0!==e.redeemCode)return e;throw e}))]}}))}))}function M(e){return d(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){switch(n.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!n.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/redeem"),{method:"POST",body:JSON.stringify({token:e}),headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o)}).then(p.a).then((function(e){return d(t,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return y(e)?[4,ge.getSubscriptionDetails(e.subscriptionID)]:[3,2];case 1:return t.sent(),[2,e];case 2:throw e}}))}))}))]}}))}))}function L(e){return d(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){switch(n.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!n.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v2/subscriptions/enterprise"),{method:"POST",body:JSON.stringify({nonce:e}),headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o)}).then(p.a).then((function(e){return d(t,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return y(e)?[4,ge.getSubscriptionDetails(e.subscriptionID)]:[3,2];case 1:return t.sent(),[2,e];case 2:throw e}}))}))}))]}}))}))}function N(e){return d(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!t.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/").concat(e,"/rescue"),{method:"PUT",headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o),body:JSON.stringify({})}).then(p.a).then((function(t){if(y(t)){var n=m(e);return ge.subscriptions=w(ge.subscriptions,u(u({},n),{subscriptionID:t.subscriptionID,status:1})),t}throw t}))]}}))}))}function C(e,t){return d(this,void 0,void 0,(function(){var n;return l(this,(function(r){switch(r.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!r.sent())throw new Error("".concat(a," Missing or invalid jwt"));return n=JSON.stringify({billingAddress:e,subscriptionID:t}),[2,ge.getSubscriptionDetails(t).then((function(e){if(b(e))return fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/address"),{method:"PUT",headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o),body:n}).then(p.a).then((function(n){if(n.country)return ge.subscriptions=w(ge.subscriptions,u(u({},e),{subscriptionID:t,billingAddress:n})),n;throw n}));throw e}))]}}))}))}function U(e,t){return d(this,void 0,void 0,(function(){return l(this,(function(n){switch(n.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!n.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/gift/").concat(e),{method:"PUT",body:JSON.stringify(t),headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o)}).then(p.a).then((function(e){if((t=e).subscriptionID&&void 0!==t.redeemCode)return e;throw e;var t}))]}}))}))}function x(e){return d(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){switch(n.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!n.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/subscription/gift/redeem"),{method:"POST",body:JSON.stringify({token:e}),headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o)}).then(p.a).then((function(e){return d(t,void 0,void 0,(function(){return l(this,(function(t){if(y(e))return[2,e];throw e}))}))}))]}}))}))}function K(e){return!!e.orderNumber}function z(e){return!!e.items}function F(e){return d(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!n.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[4,E({method:"GET",headers:o,cache:"no-cache"})];case 2:return t=n.sent(),[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/order/detail/").concat(e),t).then(p.a).then((function(e){if(K(e))return ge.orders=O(ge.orders,e),e;throw e}))]}}))}))}function Y(e,t,n){return void 0===e&&(e=0),void 0===t&&(t=10),void 0===n&&(n={}),d(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!r.sent())throw new Error("".concat(a," Missing or invalid jwt"));return[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/order/history?pageSize=").concat(t,"&start=").concat(e).concat(n.status?"&status=".concat(n.status):""),{method:"GET",cache:"no-cache",headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o)}).then(p.a).then((function(e){if(void 0!==(n=e).start&&Array.isArray(n.orders))return ge.orders=(t=ge.orders,e.orders.reduce((function(e,t){return O(e,t)}),t)),e;throw e;var t,n}))]}}))}))}function B(){return d(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:return[4,E({method:"GET",headers:o})];case 1:return e=t.sent(),[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/cart"),e).then(p.a).then((function(e){if(z(e))return ge.cart=e,e;throw e}))]}}))}))}var J=n(15),H=n.n(J);function W(e,t){return d(this,void 0,void 0,(function(){var n;return l(this,(function(r){switch(r.label){case 0:return[4,E({method:"POST",headers:o,body:JSON.stringify({items:e,billingAddress:t})})];case 1:return n=r.sent(),[2,H()(ge.apiOrigin,n).then((function(e){if(z(e))return ge.cart=e,e;throw e}))]}}))}))}function q(e){return ge._Identity.heartbeat().then((function(){return fetch("".concat(ge.apiOrigin,"/sales/public/v1/cart/item/").concat(e),{method:"DELETE",headers:u({Authorization:"Bearer ".concat(ge._Identity.userIdentity.accessToken)},o)})})).then(p.a).then((function(e){if(z(e))return ge.cart=e,e;throw e}))}function V(){return d(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:return[4,E({method:"DELETE",headers:o})];case 1:return e=t.sent(),[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/cart/clear"),e).then(p.a).then((function(e){if(z(e))return ge.cart=e,e;throw e}))]}}))}))}function X(e){return d(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,ge.getConfig()];case 1:if(t=n.sent(),void 0!==t.checkoutRecaptchaEnabled&&t.checkoutRecaptchaEnabled&&!e)throw{code:"130001",message:"Captcha token invalid"};return[2,!0]}}))}))}function Z(e,t,n,r,i,o,a,s){return d(this,void 0,void 0,(function(){return l(this,(function(u){return[2,$(n,e,t,r,i,o,a,s)]}))}))}function $(e,t,n,r,i,a,s,u){return d(this,void 0,void 0,(function(){var c=this;return l(this,(function(f){return[2,X(u).then((function(){return d(c,void 0,void 0,(function(){var c,d;return l(this,(function(l){switch(l.label){case 0:return c=JSON.stringify(T({email:t,phone:n,billingAddress:e,firstName:r,lastName:i,secondLastName:a,shippingAddress:s,"recaptcha-token":u})),[4,E({method:"POST",headers:o,body:c})];case 1:return d=l.sent(),[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/checkout/order"),d).then(p.a).then((function(e){if(K(e))return ge.currentOrder=e,e;throw e}))]}}))}))}))]}))}))}function Q(){return d(this,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:return[4,E({method:"GET",cache:"no-cache",headers:o})];case 1:return e=t.sent(),[2,fetch("".concat(ge.apiOrigin,"/sales/public/v1/checkout/payment/options"),e).then(p.a).then((function(e){if(Array.isArray(e))return ge._paymentOptions=e,e;throw e}))]}}))}))}function ee(){return d(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,ge._Identity.isLoggedIn()];case 1:if(!e.sent())thr