@bigcommerce/checkout-sdk 1.275.1 → 1.276.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/checkout-button.d.ts +1 -0
- package/dist/checkout-button.js +1 -1
- package/dist/checkout-button.js.map +1 -1
- package/dist/checkout-button.umd.js +1 -1
- package/dist/checkout-button.umd.js.map +1 -1
- package/dist/checkout-sdk.d.ts +9 -1
- package/dist/checkout-sdk.js +1 -1
- package/dist/checkout-sdk.js.map +1 -1
- package/dist/checkout-sdk.umd.js +1 -1
- package/dist/checkout-sdk.umd.js.map +1 -1
- package/dist/embedded-checkout.js +1 -1
- package/dist/internal-mappers.d.ts +1 -1
- package/docs/README.md +1 -0
- package/docs/interfaces/BaseCheckoutButtonInitializeOptions.md +4 -0
- package/docs/interfaces/DisplaySettings.md +15 -0
- package/docs/interfaces/MolliePaymentInitializeOptions.md +21 -0
- package/docs/interfaces/Order.md +1 -1
- package/docs/interfaces/StoreConfig.md +7 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{"use strict";var t={780:t=>{t.exports=require("iframe-resizer")},252:t=>{t.exports=require("iframe-resizer/js/iframeResizer.contentWindow")}},e={};function o(r){var n=e[r];if(void 0!==n)return n.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{o.r(r),o.d(r,{createEmbeddedCheckoutMessenger:()=>T,embedCheckout:()=>x});const t=require("@bigcommerce/request-sender"),e=require("tslib"),n=function(t){function o(e){var o,r,n=this.constructor,i=t.call(this,e||"An unexpected error has occurred.")||this;return i.name="StandardError",i.type="standard",o=i,r=n.prototype,Object.setPrototypeOf?Object.setPrototypeOf(o,r):o.__proto__=r,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(i,n):i.stack=new Error(i.message).stack,i}return(0,e.__extends)(o,t),o}(Error),i=function(t){function o(e){var o=t.call(this,e||"Invalid arguments have been provided.")||this;return o.name="InvalidArgumentError",o.type="invalid_argument",o}return(0,e.__extends)(o,t),o}(n);function s(t){if(!/^(https?:)?\/\//.test(t))throw new i("The provided URL must be absolute.");var e=document.createElement("a");e.href=t;var o=e.port&&-1!==t.indexOf(e.hostname+":"+e.port)?e.port:"";return{hash:e.hash,hostname:e.hostname,href:e.href,origin:e.protocol+"//"+e.hostname+(o?":"+o:""),pathname:e.pathname,port:o,protocol:e.protocol,search:e.search}}const a=function(t,o,r){return o&&r?c(0,o,r):function(t){var o=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return(0,e.__extends)(o,t),o}(t);return Object.getOwnPropertyNames(t.prototype).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t.prototype,e);r&&"constructor"!==e&&Object.defineProperty(o.prototype,e,c(t.prototype,e,r))})),o}(t)};function c(t,o,r){if("function"!=typeof r.value)return r;var n=r.value;return{get:function(){var t=n.bind(this);return Object.defineProperty(this,o,(0,e.__assign)((0,e.__assign)({},r),{value:t})),t},set:function(t){n=t}}}function d(t,e){return t.type===e}const u=function(){function t(t){var e;this._sourceOrigins=[s(t).origin,(e=s(t),s(0===e.hostname.indexOf("www")?e.href:e.href.replace(e.hostname,"www."+e.hostname))).origin],this._isListening=!1,this._listeners={}}return t.prototype.listen=function(){this._isListening||(this._isListening=!0,window.addEventListener("message",this._handleMessage))},t.prototype.stopListen=function(){this._isListening&&(this._isListening=!1,window.removeEventListener("message",this._handleMessage))},t.prototype.addListener=function(t,e){var o=this._listeners[t];o||(this._listeners[t]=o=[]),-1===o.indexOf(e)&&o.push(e)},t.prototype.removeListener=function(t,e){var o=this._listeners[t];if(o){var r=o.indexOf(e);r>=0&&o.splice(r,1)}},t.prototype.trigger=function(t){var e=this._listeners[t.type];e&&e.forEach((function(e){return e(t)}))},t.prototype._handleMessage=function(t){-1!==this._sourceOrigins.indexOf(t.origin)&&d(t.data,t.data.type)&&this.trigger(t.data)},(0,e.__decorate)([a],t.prototype,"_handleMessage",null),t}(),p=require("rxjs"),h=require("rxjs/operators"),l=function(){function t(t,e){this._targetWindow=e,this._targetOrigin="*"===t?"*":s(t).origin}return t.prototype.post=function(t,e){var o=this,r=this._targetWindow;if(window!==r){if(!r)throw new Error("Unable to post message because target window is not set.");var n=e&&(0,p.fromEvent)(window,"message").pipe((0,h.filter)((function(t){return t.origin===o._targetOrigin&&d(t.data,t.data.type)&&-1!==[e.successType,e.errorType].indexOf(t.data.type)})),(0,h.map)((function(t){if(e.errorType===t.data.type)throw t.data;return t.data})),(0,h.take)(1)).toPromise();return r.postMessage(t,this._targetOrigin),n}},t.prototype.setTarget=function(t){this._targetWindow=t},t}();var m={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},f="embedded-checkout-loading-indicator-rotation";const y=function(){function t(t){this._styles=(0,e.__assign)((0,e.__assign)({},m),t&&t.styles),this._defineAnimation(),this._container=this._buildContainer(),this._indicator=this._buildIndicator(),this._container.appendChild(this._indicator)}return t.prototype.show=function(t){if(t){var e=document.getElementById(t);if(!e)throw new Error("Unable to attach the loading indicator because the parent ID is not valid.");e.appendChild(this._container)}this._container.style.visibility="visible",this._container.style.opacity="1"},t.prototype.hide=function(){var t=this,e=function(){t._container.style.visibility="hidden",t._container.removeEventListener("transitionend",e)};this._container.addEventListener("transitionend",e),this._container.style.opacity="0"},t.prototype._buildContainer=function(){var t=document.createElement("div");return t.style.display="block",t.style.bottom="0",t.style.left="0",t.style.height="100%",t.style.width="100%",t.style.position="absolute",t.style.right="0",t.style.top="0",t.style.transition="all 250ms ease-out",t.style.opacity="0",t},t.prototype._buildIndicator=function(){var t=document.createElement("div");return t.style.display="block",t.style.width=this._styles.size+"px",t.style.height=this._styles.size+"px",t.style.borderRadius=this._styles.size+"px",t.style.border="solid 1px",t.style.borderColor=this._styles.backgroundColor+" "+this._styles.backgroundColor+" "+this._styles.color+" "+this._styles.color,t.style.margin="0 auto",t.style.position="absolute",t.style.left="0",t.style.right="0",t.style.top="50%",t.style.transform="translateY(-50%) rotate(0deg)",t.style.transformStyle="preserve-3d",t.style.animation=f+" 500ms infinite cubic-bezier(0.69, 0.31, 0.56, 0.83)",t},t.prototype._defineAnimation=function(){if(!document.getElementById(f)){var t=document.createElement("style");t.id=f,document.head.appendChild(t),t.sheet instanceof CSSStyleSheet&&t.sheet.insertRule("\n @keyframes "+f+" {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n ",0)}},t}(),_=require("local-storage-fallback");var g=o.n(_);const v=function(){function t(t){this._namespace=t}return t.prototype.getItem=function(t){var e=g().getItem(this.withNamespace(t));if(null===e)return null;try{return JSON.parse(e)}catch(e){return this.removeItem(this.withNamespace(t)),null}},t.prototype.getItemOnce=function(t){var e=this.getItem(t);return this.removeItem(t),e},t.prototype.setItem=function(t,e){return g().setItem(this.withNamespace(t),JSON.stringify(e))},t.prototype.removeItem=function(t){return g().removeItem(this.withNamespace(t))},t.prototype.withNamespace=function(t){return this._namespace+"."+t},t}();var w;!function(t){t.CheckoutComplete="CHECKOUT_COMPLETE",t.CheckoutError="CHECKOUT_ERROR",t.CheckoutLoaded="CHECKOUT_LOADED",t.FrameError="FRAME_ERROR",t.FrameLoaded="FRAME_LOADED",t.SignedOut="SIGNED_OUT"}(w||(w={}));var b={body:{},headers:{},status:0};const E=function(t){function o(e){var o=t.call(this,e,{message:e.body.title})||this;return o.name="InvalidLoginTokenError",o.type="invalid_login_token",o}return(0,e.__extends)(o,t),o}(function(t){function o(e,o){var r=void 0===o?{}:o,n=r.message,i=r.errors,s=this,a=e||b,c=a.body,d=a.headers,u=a.status;return(s=t.call(this,n||"An unexpected error has occurred.")||this).name="RequestError",s.type="request",s.body=c,s.headers=d,s.status=u,s.errors=i||[],s}return(0,e.__extends)(o,t),o}(n));var C;!function(t){t.MissingContainer="missing_container",t.MissingContent="missing_content",t.UnknownError="unknown_error"}(C||(C={}));const L=function(t){function o(e,o){void 0===o&&(o=C.UnknownError);var r=t.call(this,e||"Unable to embed the checkout form.")||this;return r.subtype=o,r.name="NotEmbeddableError",r.type="not_embeddable",r}return(0,e.__extends)(o,t),o}(n);var O;!function(t){t.StyleConfigured="STYLE_CONFIGURED"}(O||(O={}));var k="isCookieAllowed",I="lastAllowCookieAttempt";const S=function(){function t(t,e,o,r,n,i,s,a){var c=this;this._iframeCreator=t,this._messageListener=e,this._messagePoster=o,this._loadingIndicator=r,this._requestSender=n,this._storage=i,this._location=s,this._options=a,this._isAttached=!1,this._options.onComplete&&this._messageListener.addListener(w.CheckoutComplete,this._options.onComplete),this._options.onError&&this._messageListener.addListener(w.CheckoutError,this._options.onError),this._options.onLoad&&this._messageListener.addListener(w.CheckoutLoaded,this._options.onLoad),this._options.onFrameLoad&&this._messageListener.addListener(w.FrameLoaded,this._options.onFrameLoad),this._options.onSignOut&&this._messageListener.addListener(w.SignedOut,this._options.onSignOut),this._messageListener.addListener(w.FrameLoaded,(function(){return c._configureStyles()}))}return t.prototype.attach=function(){var t=this;return this._isAttached?Promise.resolve(this):(this._isAttached=!0,this._messageListener.listen(),this._loadingIndicator.show(this._options.containerId),this._allowCookie().then((function(){return t._attemptLogin()})).then((function(e){return t._iframeCreator.createFrame(e,t._options.containerId)})).then((function(e){t._iframe=e,t._configureStyles(),t._loadingIndicator.hide()})).catch((function(e){return t._isAttached=!1,t._retryAllowCookie(e).catch((function(){throw t._messageListener.trigger({type:w.FrameError,payload:e}),t._loadingIndicator.hide(),e}))})).then((function(){return t})))},t.prototype.detach=function(){this._isAttached&&(this._isAttached=!1,this._messageListener.stopListen(),this._iframe&&this._iframe.parentNode&&(this._iframe.parentNode.removeChild(this._iframe),this._iframe.iFrameResizer.close()))},t.prototype._configureStyles=function(){this._iframe&&this._iframe.contentWindow&&this._options.styles&&(this._messagePoster.setTarget(this._iframe.contentWindow),this._messagePoster.post({type:O.StyleConfigured,payload:this._options.styles}))},t.prototype._attemptLogin=function(){return/^\/login\/token/.test(s(this._options.url).pathname)?this._requestSender.post(this._options.url).then((function(t){return t.body.redirectUrl})).catch((function(t){return Promise.reject(new E(t))})):Promise.resolve(this._options.url)},t.prototype._allowCookie=function(){if(this._storage.getItem(k))return Promise.resolve();this._storage.setItem(k,!0),this._storage.setItem(I,Date.now());var t=s(this._options.url).origin+"/embedded-checkout/allow-cookie?returnUrl="+encodeURIComponent(this._location.href);return document.body.style.visibility="hidden",this._location.replace(t),new Promise((function(){}))},t.prototype._retryAllowCookie=function(t){var e=Number(this._storage.getItem(I));return(!e||Date.now()-e>6e5)&&t instanceof L&&t.subtype===C.MissingContent?(this._storage.removeItem(I),this._storage.removeItem(k),this._allowCookie()):Promise.reject()},(0,e.__decorate)([a],t)}(),M=function(){function t(t){this._options=t}return t.prototype.createFrame=function(t,e){var o=document.getElementById(e),r=(this._options||{}).timeout,n=void 0===r?6e4:r;if(!o)throw new L("Unable to embed the iframe because the container element could not be found.",C.MissingContainer);var i=document.createElement("iframe");return i.src=t,i.style.border="none",i.style.display="none",i.style.width="100%",i.allowPaymentRequest=!0,o.appendChild(i),this._toResizableFrame(i,n).catch((function(t){throw o.removeChild(i),t}))},t.prototype._toResizableFrame=function(t,e){return new Promise((function(r,n){var i=window.setTimeout((function(){n(new L("Unable to embed the iframe because the content could not be loaded."))}),e),a=function(e){var i,a;if(e.origin===s(t.src).origin&&(d(e.data,w.FrameError)&&(c(),n(new L(e.data.payload.message,C.MissingContent))),d(e.data,w.FrameLoaded))){t.style.display="";var u=(i={scrolling:!1,sizeWidth:!1,heightCalculationMethod:e.data.payload&&e.data.payload.contentId?"taggedElement":"lowestElement"},a=t,(0,o(780).iframeResizer)(i,a));c(),r(u[u.length-1])}},c=function(){window.removeEventListener("message",a),window.clearTimeout(i)};window.addEventListener("message",a)}))},t}();function x(e){var o=s(e.url).origin;return new S(new M,new u(o),new l(o),new y({styles:e.styles&&e.styles.loadingIndicator}),(0,t.createRequestSender)(),new v("BigCommerce.EmbeddedCheckout"),window.location,e).attach()}function P(t){if(t.payload&&t.payload.contentId){var e=document.getElementById(t.payload.contentId);e&&!e.hasAttribute("data-iframe-height")&&e.setAttribute("data-iframe-height","")}}function F(t){return"string"==typeof t.message&&"string"==typeof t.type&&("string"==typeof t.subtype||!t.subtype)&&t instanceof Error}const A=function(){function t(t,e,o,r){void 0===r&&(r={}),this._messageListener=t,this._messagePoster=e,this._untargetedMessagePoster=o,this._messageHandlers=r,this._messageListener.listen()}return t.prototype.postComplete=function(){var t={type:w.CheckoutComplete};this._postMessage(t)},t.prototype.postError=function(t){var e={type:w.CheckoutError,payload:this._transformError(t)};this._postMessage(e)},t.prototype.postFrameError=function(t){var e={type:w.FrameError,payload:this._transformError(t)};this._postMessage(e,{untargeted:!0})},t.prototype.postFrameLoaded=function(t){var e={type:w.FrameLoaded,payload:t};this._postMessage(e)},t.prototype.postLoaded=function(){var t={type:w.CheckoutLoaded};this._postMessage(t)},t.prototype.postSignedOut=function(){var t={type:w.SignedOut};this._postMessage(t)},t.prototype.receiveStyles=function(t){this._messageListener.addListener(O.StyleConfigured,(function(e){var o=e.payload;t(o)}))},t.prototype._postMessage=function(t,e){if(this._notifyMessageHandlers(t),e&&e.untargeted)return this._untargetedMessagePoster.post(t);this._messagePoster.post(t)},t.prototype._notifyMessageHandlers=function(t){var e=this;Object.keys(this._messageHandlers).forEach((function(o){if(t.type===o){var r=e._messageHandlers[o];r&&r.call(null,t)}}))},t.prototype._transformError=function(t){return{message:t.message,type:F(t)?t.type:void 0,subtype:F(t)?t.subtype:void 0}},(0,e.__decorate)([a],t)}(),R=function(){function t(){}return t.prototype.postComplete=function(){},t.prototype.postError=function(){},t.prototype.postFrameError=function(){},t.prototype.postFrameLoaded=function(){},t.prototype.postLoaded=function(){},t.prototype.postSignedOut=function(){},t.prototype.receiveStyles=function(){},(0,e.__decorate)([a],t)}();function T(t){var e;o(252);var r=t.parentWindow||window.parent;return window===r?new R:new A(new u(t.parentOrigin),new l(t.parentOrigin,r),new l("*",r),((e={})[w.FrameLoaded]=P,e))}})(),module.exports=r})();
|
|
1
|
+
(()=>{"use strict";var t={780:t=>{t.exports=require("iframe-resizer")},444:t=>{t.exports=require("iframe-resizer/js/iframeResizer.contentWindow")}},e={};function o(r){var n=e[r];if(void 0!==n)return n.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,o),i.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{o.r(r),o.d(r,{createEmbeddedCheckoutMessenger:()=>T,embedCheckout:()=>x});const t=require("@bigcommerce/request-sender"),e=require("tslib"),n=function(t){function o(e){var o,r,n=this.constructor,i=t.call(this,e||"An unexpected error has occurred.")||this;return i.name="StandardError",i.type="standard",o=i,r=n.prototype,Object.setPrototypeOf?Object.setPrototypeOf(o,r):o.__proto__=r,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(i,n):i.stack=new Error(i.message).stack,i}return(0,e.__extends)(o,t),o}(Error),i=function(t){function o(e){var o=t.call(this,e||"Invalid arguments have been provided.")||this;return o.name="InvalidArgumentError",o.type="invalid_argument",o}return(0,e.__extends)(o,t),o}(n);function s(t){if(!/^(https?:)?\/\//.test(t))throw new i("The provided URL must be absolute.");var e=document.createElement("a");e.href=t;var o=e.port&&-1!==t.indexOf(e.hostname+":"+e.port)?e.port:"";return{hash:e.hash,hostname:e.hostname,href:e.href,origin:e.protocol+"//"+e.hostname+(o?":"+o:""),pathname:e.pathname,port:o,protocol:e.protocol,search:e.search}}const a=function(t,o,r){return o&&r?c(0,o,r):function(t){var o=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return(0,e.__extends)(o,t),o}(t);return Object.getOwnPropertyNames(t.prototype).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t.prototype,e);r&&"constructor"!==e&&Object.defineProperty(o.prototype,e,c(t.prototype,e,r))})),o}(t)};function c(t,o,r){if("function"!=typeof r.value)return r;var n=r.value;return{get:function(){var t=n.bind(this);return Object.defineProperty(this,o,(0,e.__assign)((0,e.__assign)({},r),{value:t})),t},set:function(t){n=t}}}function d(t,e){return t.type===e}const u=function(){function t(t){var e;this._sourceOrigins=[s(t).origin,(e=s(t),s(0===e.hostname.indexOf("www")?e.href:e.href.replace(e.hostname,"www."+e.hostname))).origin],this._isListening=!1,this._listeners={}}return t.prototype.listen=function(){this._isListening||(this._isListening=!0,window.addEventListener("message",this._handleMessage))},t.prototype.stopListen=function(){this._isListening&&(this._isListening=!1,window.removeEventListener("message",this._handleMessage))},t.prototype.addListener=function(t,e){var o=this._listeners[t];o||(this._listeners[t]=o=[]),-1===o.indexOf(e)&&o.push(e)},t.prototype.removeListener=function(t,e){var o=this._listeners[t];if(o){var r=o.indexOf(e);r>=0&&o.splice(r,1)}},t.prototype.trigger=function(t){var e=this._listeners[t.type];e&&e.forEach((function(e){return e(t)}))},t.prototype._handleMessage=function(t){-1!==this._sourceOrigins.indexOf(t.origin)&&d(t.data,t.data.type)&&this.trigger(t.data)},(0,e.__decorate)([a],t.prototype,"_handleMessage",null),t}(),p=require("rxjs"),h=require("rxjs/operators"),l=function(){function t(t,e){this._targetWindow=e,this._targetOrigin="*"===t?"*":s(t).origin}return t.prototype.post=function(t,e){var o=this,r=this._targetWindow;if(window!==r){if(!r)throw new Error("Unable to post message because target window is not set.");var n=e&&(0,p.fromEvent)(window,"message").pipe((0,h.filter)((function(t){return t.origin===o._targetOrigin&&d(t.data,t.data.type)&&-1!==[e.successType,e.errorType].indexOf(t.data.type)})),(0,h.map)((function(t){if(e.errorType===t.data.type)throw t.data;return t.data})),(0,h.take)(1)).toPromise();return r.postMessage(t,this._targetOrigin),n}},t.prototype.setTarget=function(t){this._targetWindow=t},t}();var m={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},f="embedded-checkout-loading-indicator-rotation";const y=function(){function t(t){this._styles=(0,e.__assign)((0,e.__assign)({},m),t&&t.styles),this._defineAnimation(),this._container=this._buildContainer(),this._indicator=this._buildIndicator(),this._container.appendChild(this._indicator)}return t.prototype.show=function(t){if(t){var e=document.getElementById(t);if(!e)throw new Error("Unable to attach the loading indicator because the parent ID is not valid.");e.appendChild(this._container)}this._container.style.visibility="visible",this._container.style.opacity="1"},t.prototype.hide=function(){var t=this,e=function(){t._container.style.visibility="hidden",t._container.removeEventListener("transitionend",e)};this._container.addEventListener("transitionend",e),this._container.style.opacity="0"},t.prototype._buildContainer=function(){var t=document.createElement("div");return t.style.display="block",t.style.bottom="0",t.style.left="0",t.style.height="100%",t.style.width="100%",t.style.position="absolute",t.style.right="0",t.style.top="0",t.style.transition="all 250ms ease-out",t.style.opacity="0",t},t.prototype._buildIndicator=function(){var t=document.createElement("div");return t.style.display="block",t.style.width=this._styles.size+"px",t.style.height=this._styles.size+"px",t.style.borderRadius=this._styles.size+"px",t.style.border="solid 1px",t.style.borderColor=this._styles.backgroundColor+" "+this._styles.backgroundColor+" "+this._styles.color+" "+this._styles.color,t.style.margin="0 auto",t.style.position="absolute",t.style.left="0",t.style.right="0",t.style.top="50%",t.style.transform="translateY(-50%) rotate(0deg)",t.style.transformStyle="preserve-3d",t.style.animation=f+" 500ms infinite cubic-bezier(0.69, 0.31, 0.56, 0.83)",t},t.prototype._defineAnimation=function(){if(!document.getElementById(f)){var t=document.createElement("style");t.id=f,document.head.appendChild(t),t.sheet instanceof CSSStyleSheet&&t.sheet.insertRule("\n @keyframes "+f+" {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n ",0)}},t}(),_=require("local-storage-fallback");var g=o.n(_);const v=function(){function t(t){this._namespace=t}return t.prototype.getItem=function(t){var e=g().getItem(this.withNamespace(t));if(null===e)return null;try{return JSON.parse(e)}catch(e){return this.removeItem(this.withNamespace(t)),null}},t.prototype.getItemOnce=function(t){var e=this.getItem(t);return this.removeItem(t),e},t.prototype.setItem=function(t,e){return g().setItem(this.withNamespace(t),JSON.stringify(e))},t.prototype.removeItem=function(t){return g().removeItem(this.withNamespace(t))},t.prototype.withNamespace=function(t){return this._namespace+"."+t},t}();var w;!function(t){t.CheckoutComplete="CHECKOUT_COMPLETE",t.CheckoutError="CHECKOUT_ERROR",t.CheckoutLoaded="CHECKOUT_LOADED",t.FrameError="FRAME_ERROR",t.FrameLoaded="FRAME_LOADED",t.SignedOut="SIGNED_OUT"}(w||(w={}));var b={body:{},headers:{},status:0};const E=function(t){function o(e){var o=t.call(this,e,{message:e.body.title})||this;return o.name="InvalidLoginTokenError",o.type="invalid_login_token",o}return(0,e.__extends)(o,t),o}(function(t){function o(e,o){var r=void 0===o?{}:o,n=r.message,i=r.errors,s=this,a=e||b,c=a.body,d=a.headers,u=a.status;return(s=t.call(this,n||"An unexpected error has occurred.")||this).name="RequestError",s.type="request",s.body=c,s.headers=d,s.status=u,s.errors=i||[],s}return(0,e.__extends)(o,t),o}(n));var C;!function(t){t.MissingContainer="missing_container",t.MissingContent="missing_content",t.UnknownError="unknown_error"}(C||(C={}));const L=function(t){function o(e,o){void 0===o&&(o=C.UnknownError);var r=t.call(this,e||"Unable to embed the checkout form.")||this;return r.subtype=o,r.name="NotEmbeddableError",r.type="not_embeddable",r}return(0,e.__extends)(o,t),o}(n);var O;!function(t){t.StyleConfigured="STYLE_CONFIGURED"}(O||(O={}));var k="isCookieAllowed",I="lastAllowCookieAttempt";const S=function(){function t(t,e,o,r,n,i,s,a){var c=this;this._iframeCreator=t,this._messageListener=e,this._messagePoster=o,this._loadingIndicator=r,this._requestSender=n,this._storage=i,this._location=s,this._options=a,this._isAttached=!1,this._options.onComplete&&this._messageListener.addListener(w.CheckoutComplete,this._options.onComplete),this._options.onError&&this._messageListener.addListener(w.CheckoutError,this._options.onError),this._options.onLoad&&this._messageListener.addListener(w.CheckoutLoaded,this._options.onLoad),this._options.onFrameLoad&&this._messageListener.addListener(w.FrameLoaded,this._options.onFrameLoad),this._options.onSignOut&&this._messageListener.addListener(w.SignedOut,this._options.onSignOut),this._messageListener.addListener(w.FrameLoaded,(function(){return c._configureStyles()}))}return t.prototype.attach=function(){var t=this;return this._isAttached?Promise.resolve(this):(this._isAttached=!0,this._messageListener.listen(),this._loadingIndicator.show(this._options.containerId),this._allowCookie().then((function(){return t._attemptLogin()})).then((function(e){return t._iframeCreator.createFrame(e,t._options.containerId)})).then((function(e){t._iframe=e,t._configureStyles(),t._loadingIndicator.hide()})).catch((function(e){return t._isAttached=!1,t._retryAllowCookie(e).catch((function(){throw t._messageListener.trigger({type:w.FrameError,payload:e}),t._loadingIndicator.hide(),e}))})).then((function(){return t})))},t.prototype.detach=function(){this._isAttached&&(this._isAttached=!1,this._messageListener.stopListen(),this._iframe&&this._iframe.parentNode&&(this._iframe.parentNode.removeChild(this._iframe),this._iframe.iFrameResizer.close()))},t.prototype._configureStyles=function(){this._iframe&&this._iframe.contentWindow&&this._options.styles&&(this._messagePoster.setTarget(this._iframe.contentWindow),this._messagePoster.post({type:O.StyleConfigured,payload:this._options.styles}))},t.prototype._attemptLogin=function(){return/^\/login\/token/.test(s(this._options.url).pathname)?this._requestSender.post(this._options.url).then((function(t){return t.body.redirectUrl})).catch((function(t){return Promise.reject(new E(t))})):Promise.resolve(this._options.url)},t.prototype._allowCookie=function(){if(this._storage.getItem(k))return Promise.resolve();this._storage.setItem(k,!0),this._storage.setItem(I,Date.now());var t=s(this._options.url).origin+"/embedded-checkout/allow-cookie?returnUrl="+encodeURIComponent(this._location.href);return document.body.style.visibility="hidden",this._location.replace(t),new Promise((function(){}))},t.prototype._retryAllowCookie=function(t){var e=Number(this._storage.getItem(I));return(!e||Date.now()-e>6e5)&&t instanceof L&&t.subtype===C.MissingContent?(this._storage.removeItem(I),this._storage.removeItem(k),this._allowCookie()):Promise.reject()},(0,e.__decorate)([a],t)}(),M=function(){function t(t){this._options=t}return t.prototype.createFrame=function(t,e){var o=document.getElementById(e),r=(this._options||{}).timeout,n=void 0===r?6e4:r;if(!o)throw new L("Unable to embed the iframe because the container element could not be found.",C.MissingContainer);var i=document.createElement("iframe");return i.src=t,i.style.border="none",i.style.display="none",i.style.width="100%",i.allowPaymentRequest=!0,o.appendChild(i),this._toResizableFrame(i,n).catch((function(t){throw o.removeChild(i),t}))},t.prototype._toResizableFrame=function(t,e){return new Promise((function(r,n){var i=window.setTimeout((function(){n(new L("Unable to embed the iframe because the content could not be loaded."))}),e),a=function(e){var i,a;if(e.origin===s(t.src).origin&&(d(e.data,w.FrameError)&&(c(),n(new L(e.data.payload.message,C.MissingContent))),d(e.data,w.FrameLoaded))){t.style.display="";var u=(i={scrolling:!1,sizeWidth:!1,heightCalculationMethod:e.data.payload&&e.data.payload.contentId?"taggedElement":"lowestElement"},a=t,(0,o(780).iframeResizer)(i,a));c(),r(u[u.length-1])}},c=function(){window.removeEventListener("message",a),window.clearTimeout(i)};window.addEventListener("message",a)}))},t}();function x(e){var o=s(e.url).origin;return new S(new M,new u(o),new l(o),new y({styles:e.styles&&e.styles.loadingIndicator}),(0,t.createRequestSender)(),new v("BigCommerce.EmbeddedCheckout"),window.location,e).attach()}function P(t){if(t.payload&&t.payload.contentId){var e=document.getElementById(t.payload.contentId);e&&!e.hasAttribute("data-iframe-height")&&e.setAttribute("data-iframe-height","")}}function F(t){return"string"==typeof t.message&&"string"==typeof t.type&&("string"==typeof t.subtype||!t.subtype)&&t instanceof Error}const A=function(){function t(t,e,o,r){void 0===r&&(r={}),this._messageListener=t,this._messagePoster=e,this._untargetedMessagePoster=o,this._messageHandlers=r,this._messageListener.listen()}return t.prototype.postComplete=function(){var t={type:w.CheckoutComplete};this._postMessage(t)},t.prototype.postError=function(t){var e={type:w.CheckoutError,payload:this._transformError(t)};this._postMessage(e)},t.prototype.postFrameError=function(t){var e={type:w.FrameError,payload:this._transformError(t)};this._postMessage(e,{untargeted:!0})},t.prototype.postFrameLoaded=function(t){var e={type:w.FrameLoaded,payload:t};this._postMessage(e)},t.prototype.postLoaded=function(){var t={type:w.CheckoutLoaded};this._postMessage(t)},t.prototype.postSignedOut=function(){var t={type:w.SignedOut};this._postMessage(t)},t.prototype.receiveStyles=function(t){this._messageListener.addListener(O.StyleConfigured,(function(e){var o=e.payload;t(o)}))},t.prototype._postMessage=function(t,e){if(this._notifyMessageHandlers(t),e&&e.untargeted)return this._untargetedMessagePoster.post(t);this._messagePoster.post(t)},t.prototype._notifyMessageHandlers=function(t){var e=this;Object.keys(this._messageHandlers).forEach((function(o){if(t.type===o){var r=e._messageHandlers[o];r&&r.call(null,t)}}))},t.prototype._transformError=function(t){return{message:t.message,type:F(t)?t.type:void 0,subtype:F(t)?t.subtype:void 0}},(0,e.__decorate)([a],t)}(),R=function(){function t(){}return t.prototype.postComplete=function(){},t.prototype.postError=function(){},t.prototype.postFrameError=function(){},t.prototype.postFrameLoaded=function(){},t.prototype.postLoaded=function(){},t.prototype.postSignedOut=function(){},t.prototype.receiveStyles=function(){},(0,e.__decorate)([a],t)}();function T(t){var e;o(444);var r=t.parentWindow||window.parent;return window===r?new R:new A(new u(t.parentOrigin),new l(t.parentOrigin,r),new l("*",r),((e={})[w.FrameLoaded]=P,e))}})(),module.exports=r})();
|
|
2
2
|
//# sourceMappingURL=embedded-checkout.js.map
|
|
@@ -571,7 +571,7 @@ declare interface Order {
|
|
|
571
571
|
billingAddress: BillingAddress;
|
|
572
572
|
cartId: string;
|
|
573
573
|
coupons: Coupon[];
|
|
574
|
-
consignments: OrderConsignment
|
|
574
|
+
consignments: OrderConsignment;
|
|
575
575
|
currency: Currency;
|
|
576
576
|
customerCanBeCreated: boolean;
|
|
577
577
|
customerId: number;
|
package/docs/README.md
CHANGED
|
@@ -191,6 +191,7 @@
|
|
|
191
191
|
- [DigitalRiverElementClasses](interfaces/DigitalRiverElementClasses.md)
|
|
192
192
|
- [DigitalRiverPaymentInitializeOptions](interfaces/DigitalRiverPaymentInitializeOptions.md)
|
|
193
193
|
- [Discount](interfaces/Discount.md)
|
|
194
|
+
- [DisplaySettings](interfaces/DisplaySettings.md)
|
|
194
195
|
- [EmbeddedCheckoutCompleteEvent](interfaces/EmbeddedCheckoutCompleteEvent.md)
|
|
195
196
|
- [EmbeddedCheckoutError](interfaces/EmbeddedCheckoutError.md)
|
|
196
197
|
- [EmbeddedCheckoutErrorEvent](interfaces/EmbeddedCheckoutErrorEvent.md)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[@bigcommerce/checkout-sdk](../README.md) / DisplaySettings
|
|
2
|
+
|
|
3
|
+
# Interface: DisplaySettings
|
|
4
|
+
|
|
5
|
+
## Table of contents
|
|
6
|
+
|
|
7
|
+
### Properties
|
|
8
|
+
|
|
9
|
+
- [hidePriceFromGuests](DisplaySettings.md#hidepricefromguests)
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
### hidePriceFromGuests
|
|
14
|
+
|
|
15
|
+
• **hidePriceFromGuests**: `boolean`
|
|
@@ -36,6 +36,11 @@ service.initializePayment({
|
|
|
36
36
|
- [containerId](MolliePaymentInitializeOptions.md#containerid)
|
|
37
37
|
- [form](MolliePaymentInitializeOptions.md#form)
|
|
38
38
|
- [styles](MolliePaymentInitializeOptions.md#styles)
|
|
39
|
+
- [unsupportedMethodMessage](MolliePaymentInitializeOptions.md#unsupportedmethodmessage)
|
|
40
|
+
|
|
41
|
+
### Methods
|
|
42
|
+
|
|
43
|
+
- [disableButton](MolliePaymentInitializeOptions.md#disablebutton)
|
|
39
44
|
|
|
40
45
|
## Properties
|
|
41
46
|
|
|
@@ -94,3 +99,19 @@ ___
|
|
|
94
99
|
• **styles**: `object`
|
|
95
100
|
|
|
96
101
|
A set of styles required for the mollie components
|
|
102
|
+
|
|
103
|
+
___
|
|
104
|
+
|
|
105
|
+
### unsupportedMethodMessage
|
|
106
|
+
|
|
107
|
+
• `Optional` **unsupportedMethodMessage**: `string`
|
|
108
|
+
|
|
109
|
+
## Methods
|
|
110
|
+
|
|
111
|
+
### disableButton
|
|
112
|
+
|
|
113
|
+
▸ **disableButton**(): `void`
|
|
114
|
+
|
|
115
|
+
#### Returns
|
|
116
|
+
|
|
117
|
+
`void`
|
package/docs/interfaces/Order.md
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
- [checkoutSettings](StoreConfig.md#checkoutsettings)
|
|
11
11
|
- [currency](StoreConfig.md#currency)
|
|
12
12
|
- [displayDateFormat](StoreConfig.md#displaydateformat)
|
|
13
|
+
- [displaySettings](StoreConfig.md#displaysettings)
|
|
13
14
|
- [formFields](StoreConfig.md#formfields)
|
|
14
15
|
- [imageDirectory](StoreConfig.md#imagedirectory)
|
|
15
16
|
- [inputDateFormat](StoreConfig.md#inputdateformat)
|
|
@@ -46,6 +47,12 @@ ___
|
|
|
46
47
|
|
|
47
48
|
___
|
|
48
49
|
|
|
50
|
+
### displaySettings
|
|
51
|
+
|
|
52
|
+
• **displaySettings**: [`DisplaySettings`](DisplaySettings.md)
|
|
53
|
+
|
|
54
|
+
___
|
|
55
|
+
|
|
49
56
|
### formFields
|
|
50
57
|
|
|
51
58
|
• **formFields**: [`FormFields`](FormFields.md)
|