@gr4vy/embed
Advanced tools
Comparing version 2.24.5 to 2.24.6
@@ -0,1 +1,13 @@ | ||
# v2.24.6 (Mon Nov 20 2023) | ||
#### 🔩 Dependency Updates | ||
- deps: upgrade lerna/typescript/jest [#170](https://github.com/gr4vy/gr4vy-embed/pull/170) ([@douglaseggleton](https://github.com/douglaseggleton)) | ||
#### Authors: 1 | ||
- Douglas Eggleton ([@douglaseggleton](https://github.com/douglaseggleton)) | ||
--- | ||
# v2.24.4 (Thu Nov 16 2023) | ||
@@ -2,0 +14,0 @@ |
@@ -22,6 +22,6 @@ "use strict"; | ||
window.ApplePaySession.STATUS_FAILURE = 0; | ||
mockSubjectManager = subjects_1.createSubjectManager(); | ||
mockSubjectManager = (0, subjects_1.createSubjectManager)(); | ||
}); | ||
test('should start a session with version 3 and session data', function () { | ||
apple_pay_1.createApplePayController(mockSubjectManager, 3); | ||
(0, apple_pay_1.createApplePayController)(mockSubjectManager, 3); | ||
mockSubjectManager.appleStartSession$.next({ foo: 'bar' }); | ||
@@ -36,3 +36,3 @@ jest.runAllTimers(); | ||
}); | ||
apple_pay_1.createApplePayController(mockSubjectManager, 3); | ||
(0, apple_pay_1.createApplePayController)(mockSubjectManager, 3); | ||
// assert | ||
@@ -49,3 +49,3 @@ var subscription = mockSubjectManager.appleSessionError$.subscribe(function () { | ||
test('should register an onvalidatemerchant callback', function (done) { | ||
apple_pay_1.createApplePayController(mockSubjectManager, 3); | ||
(0, apple_pay_1.createApplePayController)(mockSubjectManager, 3); | ||
mockSubjectManager.appleStartSession$.next({ foo: 'bar' }); | ||
@@ -64,3 +64,3 @@ // assert | ||
test('should register an onpaymentauthorized callback', function (done) { | ||
apple_pay_1.createApplePayController(mockSubjectManager, 3); | ||
(0, apple_pay_1.createApplePayController)(mockSubjectManager, 3); | ||
mockSubjectManager.appleStartSession$.next({ foo: 'bar' }); | ||
@@ -79,3 +79,3 @@ // assert | ||
test('should register an oncancel callback', function (done) { | ||
apple_pay_1.createApplePayController(mockSubjectManager, 3); | ||
(0, apple_pay_1.createApplePayController)(mockSubjectManager, 3); | ||
mockSubjectManager.appleStartSession$.next({ foo: 'bar' }); | ||
@@ -93,3 +93,3 @@ // assert | ||
test('should complete merchant validation', function () { | ||
apple_pay_1.createApplePayController(mockSubjectManager, 3); | ||
(0, apple_pay_1.createApplePayController)(mockSubjectManager, 3); | ||
mockSubjectManager.appleStartSession$.next({ foo: 'bar' }); | ||
@@ -101,3 +101,3 @@ mockSubjectManager.appleCompleteMerchantValidation$.next('test-data'); | ||
test('should complete a successful payment', function () { | ||
apple_pay_1.createApplePayController(mockSubjectManager, 3); | ||
(0, apple_pay_1.createApplePayController)(mockSubjectManager, 3); | ||
mockSubjectManager.appleStartSession$.next({ foo: 'bar' }); | ||
@@ -109,3 +109,3 @@ mockSubjectManager.appleCompletePayment$.next(true); | ||
test('should complete a failed payment', function () { | ||
apple_pay_1.createApplePayController(mockSubjectManager, 3); | ||
(0, apple_pay_1.createApplePayController)(mockSubjectManager, 3); | ||
mockSubjectManager.appleStartSession$.next({ foo: 'bar' }); | ||
@@ -117,3 +117,3 @@ mockSubjectManager.appleCompletePayment$.next(false); | ||
test('should abort an applepay session', function () { | ||
apple_pay_1.createApplePayController(mockSubjectManager, 3); | ||
(0, apple_pay_1.createApplePayController)(mockSubjectManager, 3); | ||
mockSubjectManager.appleStartSession$.next({ foo: 'bar' }); | ||
@@ -120,0 +120,0 @@ mockSubjectManager.appleAbortSession$.next(); |
@@ -21,3 +21,3 @@ "use strict"; | ||
ApplePaySession.supportsVersion = function (checkVersion) { return version >= checkVersion; }; | ||
var result = browser_support_1.browserSupportsApplePay(); | ||
var result = (0, browser_support_1.browserSupportsApplePay)(); | ||
expect(result).toBe(expected); | ||
@@ -38,3 +38,3 @@ }); | ||
}; | ||
var result = browser_support_1.detectSupportedVersion(); | ||
var result = (0, browser_support_1.detectSupportedVersion)(); | ||
expect(result).toBe(expected); | ||
@@ -41,0 +41,0 @@ }); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -31,11 +31,11 @@ "use strict"; | ||
var gr4vyId = setupConfig.gr4vyId, environment = setupConfig.environment, rest = __rest(setupConfig, ["gr4vyId", "environment"]); | ||
var channel = generate_channel_id_1.generateChannelId(); | ||
var channel = (0, generate_channel_id_1.generateChannelId)(); | ||
var environmentPrefix = environment === 'sandbox' ? 'sandbox.' : ''; | ||
var iframeHost = gr4vyId | ||
? "embed." + environmentPrefix + gr4vyId + ".gr4vy.app" | ||
? "embed.".concat(environmentPrefix).concat(gr4vyId, ".gr4vy.app") | ||
: setupConfig.iframeHost; | ||
var apiHost = gr4vyId | ||
? "api." + environmentPrefix + gr4vyId + ".gr4vy.app" | ||
? "api.".concat(environmentPrefix).concat(gr4vyId, ".gr4vy.app") | ||
: setupConfig.apiHost; | ||
var iframeUrl = utils_1.hostToUrl(iframeHost, setupConfig.secure); | ||
var iframeUrl = (0, utils_1.hostToUrl)(iframeHost, setupConfig.secure); | ||
var form = !(setupConfig.form instanceof Element) | ||
@@ -47,14 +47,11 @@ ? document.querySelector(setupConfig.form) | ||
: setupConfig.element; | ||
return __assign(__assign({ enableAnimations: false, separatePaymentOptions: false, requireSecurityCode: false, showDeleteButton: false, store: 'ask', display: 'all', apiHost: apiHost, apiUrl: utils_1.hostToUrl(apiHost, setupConfig.secure), gr4vyId: gr4vyId, | ||
iframeHost: iframeHost, | ||
iframeUrl: iframeUrl, iframeSrc: utils_1.appendUrlParams(iframeUrl, { | ||
parentUrl: document.location.protocol + "//" + document.location.host, | ||
font: ((_b = (_a = setupConfig.theme) === null || _a === void 0 ? void 0 : _a.fonts) === null || _b === void 0 ? void 0 : _b.body) ? encodeURIComponent(setupConfig.theme.fonts.body) | ||
return __assign(__assign({ enableAnimations: false, separatePaymentOptions: false, requireSecurityCode: false, showDeleteButton: false, store: 'ask', display: 'all', apiHost: apiHost, apiUrl: (0, utils_1.hostToUrl)(apiHost, setupConfig.secure), gr4vyId: gr4vyId, iframeHost: iframeHost, iframeUrl: iframeUrl, iframeSrc: (0, utils_1.appendUrlParams)(iframeUrl, { | ||
parentUrl: "".concat(document.location.protocol, "//").concat(document.location.host), | ||
font: ((_b = (_a = setupConfig.theme) === null || _a === void 0 ? void 0 : _a.fonts) === null || _b === void 0 ? void 0 : _b.body) | ||
? encodeURIComponent(setupConfig.theme.fonts.body) | ||
: undefined, | ||
channel: channel, | ||
}), channel: channel }, rest), { element: element, | ||
form: form, | ||
environment: environment, redirectMode: setupConfig.redirectMode || 'fallback' }); | ||
}), channel: channel }, rest), { element: element, form: form, environment: environment, redirectMode: setupConfig.redirectMode || 'fallback' }); | ||
}; | ||
exports.createConfig = createConfig; | ||
//# sourceMappingURL=create-config.js.map |
@@ -20,5 +20,6 @@ "use strict"; | ||
var mockForm = globalDocument.createElement('form'); | ||
beforeAll(function () { | ||
delete global.document; | ||
global.document = { | ||
var windowSpy; | ||
beforeEach(function () { | ||
windowSpy = jest.spyOn(global, 'document', 'get'); | ||
windowSpy.mockImplementation(function () { return ({ | ||
location: { | ||
@@ -35,7 +36,8 @@ protocol: 'https:', | ||
} | ||
return; | ||
}, | ||
}; | ||
}); }); | ||
}); | ||
afterAll(function () { | ||
global.document = globalDocument; | ||
afterEach(function () { | ||
windowSpy.mockRestore(); | ||
}); | ||
@@ -54,3 +56,3 @@ jest.mock('./utils/generate-channel-id'); | ||
test('default configuration', function () { | ||
expect(create_config_1.createConfig(setupConfig)).toEqual({ | ||
expect((0, create_config_1.createConfig)(setupConfig)).toEqual({ | ||
amount: 100, | ||
@@ -70,3 +72,3 @@ apiHost: 'api.test.gr4vy.app', | ||
redirectMode: 'fallback', | ||
iframeSrc: "https://embed.test.gr4vy.app/?parentUrl=https%3A%2F%2Ftest.com&channel=" + CHANNEL_ID, | ||
iframeSrc: "https://embed.test.gr4vy.app/?parentUrl=https%3A%2F%2Ftest.com&channel=".concat(CHANNEL_ID), | ||
store: 'ask', | ||
@@ -81,3 +83,3 @@ token: '123', | ||
test('should set url values based on a gr4vy id', function () { | ||
expect(create_config_1.createConfig(setupConfig)).toMatchObject({ | ||
expect((0, create_config_1.createConfig)(setupConfig)).toMatchObject({ | ||
apiHost: "api.test.gr4vy.app", | ||
@@ -87,7 +89,7 @@ apiUrl: "https://api.test.gr4vy.app", | ||
iframeUrl: "https://embed.test.gr4vy.app", | ||
iframeSrc: "https://embed.test.gr4vy.app/?parentUrl=https%3A%2F%2Ftest.com&channel=" + CHANNEL_ID, | ||
iframeSrc: "https://embed.test.gr4vy.app/?parentUrl=https%3A%2F%2Ftest.com&channel=".concat(CHANNEL_ID), | ||
}); | ||
}); | ||
test('should prefix URLs if for the sandbox environment', function () { | ||
expect(create_config_1.createConfig(__assign(__assign({}, setupConfig), { environment: 'sandbox' }))).toMatchObject({ | ||
expect((0, create_config_1.createConfig)(__assign(__assign({}, setupConfig), { environment: 'sandbox' }))).toMatchObject({ | ||
apiHost: "api.sandbox.test.gr4vy.app", | ||
@@ -97,7 +99,7 @@ apiUrl: "https://api.sandbox.test.gr4vy.app", | ||
iframeUrl: "https://embed.sandbox.test.gr4vy.app", | ||
iframeSrc: "https://embed.sandbox.test.gr4vy.app/?parentUrl=https%3A%2F%2Ftest.com&channel=" + CHANNEL_ID, | ||
iframeSrc: "https://embed.sandbox.test.gr4vy.app/?parentUrl=https%3A%2F%2Ftest.com&channel=".concat(CHANNEL_ID), | ||
}); | ||
}); | ||
test('should default store to "ask"', function () { | ||
expect(create_config_1.createConfig(setupConfig)).toMatchObject({ | ||
expect((0, create_config_1.createConfig)(setupConfig)).toMatchObject({ | ||
store: 'ask', | ||
@@ -107,3 +109,3 @@ }); | ||
test('should set the font in the iframeUrl', function () { | ||
expect(create_config_1.createConfig(__assign(__assign({}, setupConfig), { theme: { | ||
expect((0, create_config_1.createConfig)(__assign(__assign({}, setupConfig), { theme: { | ||
fonts: { | ||
@@ -113,5 +115,5 @@ body: 'Lato', | ||
} }))).toMatchObject({ | ||
iframeSrc: "https://embed.test.gr4vy.app/?parentUrl=https%3A%2F%2Ftest.com&font=Lato&channel=" + CHANNEL_ID, | ||
iframeSrc: "https://embed.test.gr4vy.app/?parentUrl=https%3A%2F%2Ftest.com&font=Lato&channel=".concat(CHANNEL_ID), | ||
}); | ||
}); | ||
//# sourceMappingURL=create-config.test.js.map |
import { SubjectManager } from 'subjects'; | ||
export declare type FormNapperInstance = { | ||
export type FormNapperInstance = { | ||
hijack: (fn: CallableFunction) => void; | ||
@@ -4,0 +4,0 @@ inject: (name: string, value: string) => void; |
@@ -14,6 +14,6 @@ "use strict"; | ||
document.body.append(form); | ||
subject = subjects_1.createSubjectManager(); | ||
subject = (0, subjects_1.createSubjectManager)(); | ||
}); | ||
it('should hijack the form and notify formSubmit$', function (done) { | ||
form_1.createFormController(form, null, subject, null); | ||
(0, form_1.createFormController)(form, null, subject, null); | ||
subject.formSubmit$.subscribe(function () { | ||
@@ -32,3 +32,3 @@ done(); | ||
it('should inject the transaction id', function () { | ||
form_1.createFormController(form, null, subject, null); | ||
(0, form_1.createFormController)(form, null, subject, null); | ||
subject.transactionCreated$.next({ id: '123', status: 'captured' }); | ||
@@ -42,3 +42,3 @@ jest.runAllTimers(); | ||
}; | ||
form_1.createFormController(form, null, subject, null); | ||
(0, form_1.createFormController)(form, null, subject, null); | ||
subject.transactionCreated$.next({ id: '123', status: 'captured' }); | ||
@@ -45,0 +45,0 @@ jest.runAllTimers(); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -23,3 +23,3 @@ "use strict"; | ||
if (frame.style.visibility === 'unset') { | ||
frame.style.height = height + "px"; | ||
frame.style.height = "".concat(height, "px"); | ||
} | ||
@@ -26,0 +26,0 @@ }); |
@@ -9,3 +9,3 @@ "use strict"; | ||
beforeEach(function () { | ||
subject = subjects_1.createSubjectManager(); | ||
subject = (0, subjects_1.createSubjectManager)(); | ||
}); | ||
@@ -15,3 +15,3 @@ test('should initialize a new iframe', function () { | ||
var frameElement = document.createElement('iframe'); | ||
frame_1.createFrameController(frameElement, iframeUrl, subject); | ||
(0, frame_1.createFrameController)(frameElement, iframeUrl, subject); | ||
expect(frameElement.getAttribute('src')).toEqual('http://localhost:8000'); | ||
@@ -27,3 +27,3 @@ expect(frameElement.getAttribute('title')).toEqual('Secure payment frame - Gr4vy'); | ||
var frameElement = document.createElement('iframe'); | ||
frame_1.createFrameController(frameElement, iframeUrl, subject); | ||
(0, frame_1.createFrameController)(frameElement, iframeUrl, subject); | ||
frameElement.style.visibility = 'unset'; | ||
@@ -38,3 +38,3 @@ expect(frameElement.style.height).toBe('0px'); | ||
var frameElement = document.createElement('iframe'); | ||
frame_1.createFrameController(frameElement, iframeUrl, subject); | ||
(0, frame_1.createFrameController)(frameElement, iframeUrl, subject); | ||
frameElement.style.visibility = 'hidden'; | ||
@@ -48,3 +48,3 @@ expect(frameElement.style.height).toBe('0px'); | ||
var frameElement = document.createElement('iframe'); | ||
frame_1.createFrameController(frameElement, iframeUrl, subject); | ||
(0, frame_1.createFrameController)(frameElement, iframeUrl, subject); | ||
subject.optionsLoaded$.next(true); | ||
@@ -51,0 +51,0 @@ jest.runAllTimers(); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -12,3 +12,3 @@ import { SetupConfig } from './types'; | ||
}; | ||
export declare type DynamicOptions = Pick<SetupConfig, 'externalIdentifier' | 'metadata' | 'token' | 'shippingDetailsId'>; | ||
export declare type EmbedInstance = ReturnType<typeof setup>; | ||
export type DynamicOptions = Pick<SetupConfig, 'externalIdentifier' | 'metadata' | 'token' | 'shippingDetailsId'>; | ||
export type EmbedInstance = ReturnType<typeof setup>; |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.gr4vy=n():e.gr4vy=n()}(this,(()=>(()=>{"use strict";var e={381:(e,n,t)=>{t.d(n,{Z:()=>a});var r=t(609),o=t.n(r)()((function(e){return e[1]}));o.push([e.id,".gr4vy__overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n max-height: 100vh;\n z-index: 100;\n transition: background-color 0.2s linear, max-height 0s linear;\n background: rgba(0, 0, 0, 0.8);\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.gr4vy__overlay--visible {\n -webkit-backdrop-filter: blur(2px);\n backdrop-filter: blur(2px);\n}\n\n.gr4vy__overlay__container {\n color: white;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,\n Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';\n font-size: 1rem;\n text-align: center;\n font-weight: bold;\n}\n\n.gr4vy__overlay__container > * + * {\n margin-top: 32px;\n}\n\n.gr4vy__overlay__notice > * + * {\n margin-top: 8px;\n}\n\n.gr4vy__overlay--hidden {\n max-height: 0;\n backdrop-filter: unset;\n background-color: rgba(0, 0, 0, 0);\n transition: background-color 0.2s linear, max-height 0s linear;\n transition-delay: 0s, 0.2s;\n overflow: hidden;\n}\n\n.gr4vy__overlay__link {\n font-weight: normal;\n text-decoration: underline;\n font-weight: normal;\n color: white;\n display: block;\n cursor: pointer;\n}\n\n.gr4vy__frame {\n height: 100vh;\n width: 100vw;\n}\n\n@media screen and (min-width: 500px) and (min-height: 350px) {\n .gr4vy__frame {\n height: 250px;\n width: 400px;\n }\n}\n\n@media screen and (min-width: 500px) and (min-height: 490px) {\n .gr4vy__frame {\n height: 390px;\n width: 400px;\n }\n}\n\n@media screen and (min-width: 700px) and (min-height: 500px) {\n .gr4vy__frame {\n height: 400px;\n width: 600px;\n }\n}\n\n@media screen and (min-width: 700px) and (min-height: 600px) {\n .gr4vy__frame {\n height: 500px;\n width: 600px;\n }\n}\n",""]);const a=o},514:(e,n,t)=>{t.d(n,{Z:()=>a});var r=t(609),o=t.n(r)()((function(e){return e[1]}));o.push([e.id,"@keyframes gr4vy-sweep {\n 0% {\n background-position: 0 0;\n }\n 100% {\n background-position: 600px 0;\n }\n}\n\n.gr4vy__skeleton {\n display: flex;\n border-bottom: var(--gr4vy-borderWidths-container, 1px) solid\n var(--gr4vy-colors-containerBorder, #f2f2f2);\n padding: 16px;\n}\n\n.gr4vy__skeleton:last-child {\n border-bottom: none;\n}\n\n.gr4vy__skeleton__radio {\n border-radius: 50%;\n height: 16px;\n width: 16px;\n margin-bottom: 4px;\n margin-top: 4px;\n background-color: var(--gr4vy-colors-containerBorder, #f2f2f2);\n}\n\n.gr4vy__skeleton__block {\n flex-grow: 1;\n height: 16px;\n background-image: linear-gradient(\n 90deg,\n var(--gr4vy-colors-containerBorder, #f2f2f2) 30%,\n var(--gr4vy-colors-containerBackground, #ffffff) 50%,\n var(--gr4vy-colors-containerBorder, #f2f2f2) 70%\n );\n background-size: 600px;\n margin-bottom: 4px;\n margin-top: 4px;\n margin-left: 16px;\n border-radius: var(--gr4vy-radii-input, 0);\n -webkit-animation: gr4vy-sweep 1s infinite cubic-bezier(0.2, 0.75, 0.77, 0.25);\n animation: gr4vy-sweep 1s infinite cubic-bezier(0.2, 0.75, 0.77, 0.25);\n}\n.gr4vy__container {\n border: var(--gr4vy-borderWidths-container, 1px) solid\n var(--gr4vy-colors-containerBorder, #f2f2f2);\n border-radius: var(--gr4vy-radii-container, 0);\n background: var(--gr4vy-colors-pageBackground, #ffffff);\n max-width: 480px;\n}\n",""]);const a=o},609:e=>{e.exports=function(e){var n=[];return n.toString=function(){return this.map((function(n){var t=e(n);return n[2]?"@media ".concat(n[2]," {").concat(t,"}"):t})).join("")},n.i=function(e,t,r){"string"==typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var a=0;a<this.length;a++){var i=this[a][0];null!=i&&(o[i]=!0)}for(var l=0;l<e.length;l++){var s=[].concat(e[l]);r&&o[s[0]]||(t&&(s[2]?s[2]="".concat(t," and ").concat(s[2]):s[2]=t),n.push(s))}},n}},88:(e,n,t)=>{function r(e){if(("string"==typeof e||e instanceof String)&&(e=document.getElementById(e)),!(e instanceof HTMLFormElement))throw new TypeError("FormNapper requires an HTMLFormElement element or the id string of one.");this.htmlForm=e}r.prototype.hijack=function(e){this.submitHandler||(this.submitHandler=function(n){n.preventDefault?n.preventDefault():n.returnValue=!1,e(n)},null!=t.g.addEventListener?this.htmlForm.addEventListener("submit",this.submitHandler,!1):null!=t.g.attachEvent?this.htmlForm.attachEvent("onsubmit",this.submitHandler):this.htmlForm.onsubmit=this.submitHandler)},r.prototype.inject=function(e,n){var t=this.htmlForm.querySelector('input[name="'+e+'"]');return null==t&&((t=document.createElement("input")).type="hidden",t.name=e,this.htmlForm.appendChild(t)),t.value=n,t},r.prototype.submit=function(){HTMLFormElement.prototype.submit.call(this.htmlForm)},r.prototype.detach=function(){this.submitHandler&&(null!=t.g.removeEventListener?this.htmlForm.removeEventListener("submit",this.submitHandler,!1):null!=t.g.detachEvent?this.htmlForm.detachEvent("onsubmit",this.submitHandler):this.htmlForm.onsubmit=null,delete this.submitHandler)},e.exports=r},496:(e,n,t)=>{t.r(n),t.d(n,{default:()=>g});var r=t(62),o=t.n(r),a=t(36),i=t.n(a),l=t(793),s=t.n(l),c=t(892),u=t.n(c),d=t(173),p=t.n(d),m=t(464),v=t.n(m),f=t(381),b={};b.styleTagTransform=v(),b.setAttributes=u(),b.insert=s().bind(null,"head"),b.domAPI=i(),b.insertStyleElement=p(),o()(f.Z,b);const g=f.Z&&f.Z.locals?f.Z.locals:void 0},796:(e,n,t)=>{t.r(n),t.d(n,{default:()=>g});var r=t(62),o=t.n(r),a=t(36),i=t.n(a),l=t(793),s=t.n(l),c=t(892),u=t.n(c),d=t(173),p=t.n(d),m=t(464),v=t.n(m),f=t(514),b={};b.styleTagTransform=v(),b.setAttributes=u(),b.insert=s().bind(null,"head"),b.domAPI=i(),b.insertStyleElement=p(),o()(f.Z,b);const g=f.Z&&f.Z.locals?f.Z.locals:void 0},62:e=>{var n=[];function t(e){for(var t=-1,r=0;r<n.length;r++)if(n[r].identifier===e){t=r;break}return t}function r(e,r){for(var a={},i=[],l=0;l<e.length;l++){var s=e[l],c=r.base?s[0]+r.base:s[0],u=a[c]||0,d="".concat(c," ").concat(u);a[c]=u+1;var p=t(d),m={css:s[1],media:s[2],sourceMap:s[3],supports:s[4],layer:s[5]};if(-1!==p)n[p].references++,n[p].updater(m);else{var v=o(m,r);r.byIndex=l,n.splice(l,0,{identifier:d,updater:v,references:1})}i.push(d)}return i}function o(e,n){var t=n.domAPI(n);return t.update(e),function(n){if(n){if(n.css===e.css&&n.media===e.media&&n.sourceMap===e.sourceMap&&n.supports===e.supports&&n.layer===e.layer)return;t.update(e=n)}else t.remove()}}e.exports=function(e,o){var a=r(e=e||[],o=o||{});return function(e){e=e||[];for(var i=0;i<a.length;i++){var l=t(a[i]);n[l].references--}for(var s=r(e,o),c=0;c<a.length;c++){var u=t(a[c]);0===n[u].references&&(n[u].updater(),n.splice(u,1))}a=s}}},793:e=>{var n={};e.exports=function(e,t){var r=function(e){if(void 0===n[e]){var t=document.querySelector(e);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(e){t=null}n[e]=t}return n[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(t)}},173:e=>{e.exports=function(e){var n=document.createElement("style");return e.setAttributes(n,e.attributes),e.insert(n,e.options),n}},892:(e,n,t)=>{e.exports=function(e){var n=t.nc;n&&e.setAttribute("nonce",n)}},36:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var n=e.insertStyleElement(e);return{update:function(t){!function(e,n,t){var r="";t.supports&&(r+="@supports (".concat(t.supports,") {")),t.media&&(r+="@media ".concat(t.media," {"));var o=void 0!==t.layer;o&&(r+="@layer".concat(t.layer.length>0?" ".concat(t.layer):""," {")),r+=t.css,o&&(r+="}"),t.media&&(r+="}"),t.supports&&(r+="}");var a=t.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),n.styleTagTransform(r,e,n.options)}(n,e,t)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)}}}},464:e=>{e.exports=function(e,n){if(n.styleSheet)n.styleSheet.cssText=e;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(e))}}}},n={};function t(r){var o=n[r];if(void 0!==o)return o.exports;var a=n[r]={id:r,exports:{}};return e[r](a,a.exports,t),a.exports}t.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},t.d=(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.nc=void 0;var r={};return(()=>{t.r(r),t.d(r,{optionKeys:()=>de,setup:()=>ve});var e=function(){var e=!1;try{e=window.ApplePaySession&&ApplePaySession.canMakePayments()&&ApplePaySession.supportsVersion(3)}catch(e){}return e},n=function(){return ApplePaySession.supportsVersion(5)?5:ApplePaySession.supportsVersion(4)?4:ApplePaySession.supportsVersion(3)?3:null},o=function(e,n){var t;e.appleStartSession$.subscribe((function(r){try{(t=new ApplePaySession(n,r)).onvalidatemerchant=function(n){e.appleValidateMerchant$.next(n.validationURL)},t.onpaymentauthorized=function(n){e.applePayAuthorized$.next(n.payment.token)},t.oncancel=function(){e.appleCancelSession$.next()},t.begin()}catch(n){e.appleSessionError$.next(null==n?void 0:n.message)}})),e.appleCompleteMerchantValidation$.subscribe((function(e){t.completeMerchantValidation(e)})),e.appleAbortSession$.subscribe((function(){var e;(null===(e=t)||void 0===e?void 0:e.abort)&&t.abort()})),e.appleCompletePayment$.subscribe((function(n){n?t.completePayment(ApplePaySession.STATUS_SUCCESS):t.completePayment(ApplePaySession.STATUS_FAILURE),e.appleCompleteSession$.next()}))},a=function(e,n){return n.reduce((function(n,t){return void 0!==e[t]&&null!==e[t]&&(n[t]=e[t]),n}),{})},i=function(e){return{current:e}},l=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=new URL("https://".concat(e));return n||(t.protocol="http"),t.toString().replace(/\/$/,"")};function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){u(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function u(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var d={debug:!1,level:"log"},p=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=c(c({},d),t),o=r.debug,a=r.level;o&&console[a]("Gr4vy - ".concat(e),n)},m=function(e,n,t){p(e,n,c(c({},t),{},{level:"warn"}))},v=function(e,n,t){return function(r){e===r.origin&&r.data.channel===n&&t(r.data)}},f=function(e,n){return function(t){e.includes(t.type)&&n(t)}};function b(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function g(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var y=function(e,n,t,r){return function(o){t.postMessage(function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?b(Object(t),!0).forEach((function(n){g(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({channel:n},o),e),r&&r(o)}},h=function(e){if(e.hasChildNodes())for(;e.firstChild;)e.removeChild(e.lastChild)},w=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#8b5a473ea2aa414f4e64e6aeb9dc7e7c6920714f";window.gr4vy||(window.gr4vy={version:{}}),window.gr4vy.version||(window.gr4vy.version={}),window.gr4vy.version[e]=n},O=["gr4vyId","environment"];function x(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function S(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?x(Object(t),!0).forEach((function(n){_(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):x(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function _(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var $,j,k=function(e){var n,t,r,o,a,i=e.gr4vyId,s=e.environment,c=function(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(e,O),u=(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(4)).join("").slice(0,32),d="sandbox"===s?"sandbox.":"",p=i?"embed.".concat(d).concat(i,".gr4vy.app"):e.iframeHost,m=i?"api.".concat(d).concat(i,".gr4vy.app"):e.apiHost,v=l(p,e.secure),f=e.form instanceof Element?e.form:document.querySelector(e.form),b=e.element instanceof Element?e.element:document.querySelector(e.element);return S(S({enableAnimations:!1,separatePaymentOptions:!1,requireSecurityCode:!1,showDeleteButton:!1,store:"ask",display:"all",apiHost:m,apiUrl:l(m,e.secure),gr4vyId:i,iframeHost:p,iframeUrl:v,iframeSrc:(r=v,o={parentUrl:"".concat(document.location.protocol,"//").concat(document.location.host),font:null!==(n=e.theme)&&void 0!==n&&null!==(t=n.fonts)&&void 0!==t&&t.body?encodeURIComponent(e.theme.fonts.body):void 0,channel:u},a=new URL(r),Object.keys(o).forEach((function(e){void 0!==o[e]&&a.searchParams.set(e,o[e])})),a.toString()),channel:u},c),{},{element:b,form:f,environment:s,redirectMode:e.redirectMode||"fallback"})},E=t(88),P=t.n(E),C=new Map,I=0,T=function(e,n,t,r){parseInt(e.dataset.formNapperId)>0&&(C.get(e.dataset.formNapperId).detach(),C.delete(e.dataset.formNapperId)),I+=1,e.dataset.formNapperId=String(I);var o=new(P())(e);C.set(I.toString(),o),o.hijack((function(){var e;"custom"===(null===(e=t.selectedOption$.value())||void 0===e?void 0:e.mode)?r({method:t.selectedOption$.value().method}):t.formSubmit$.next()})),t.transactionCreated$.subscribe((function(e){var t;return o.inject("gr4vy_transaction_id",e.id),o.inject("gr4vy_transaction_status",e.status),null!=e&&null!==(t=e.paymentMethod)&&void 0!==t&&t.id&&o.inject("gr4vy_transaction_payment_method_id",e.paymentMethod.id),"function"==typeof n?n(e):o.submit()}))},A=function(e,n,t){e.src=n,e.title="Secure payment frame - Gr4vy",e.style.visibility="hidden",e.style.display="none",e.style.width="100%",e.style.height="0px",e.style.border="0",e.style.overflow="hidden",e.setAttribute("frameBorder","0"),e.setAttribute("scrolling","no"),e.setAttribute("allowpaymentrequest","true"),e.setAttribute("sandbox","allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation-by-user-activation"),t.frameHeight$.subscribe((function(n){"unset"===e.style.visibility&&(e.style.height="".concat(n,"px"))})),t.optionsLoaded$.subscribe((function(){e.style.visibility="unset",e.style.display="unset"}))},q=!0,M=String.raw,F=function(e,n){q&&(t(496),q=!1),e.className="gr4vy__overlay gr4vy__overlay--hidden";var r=document.createElement("div"),o=document.createElement("div"),a=document.createElement("div");a.className="gr4vy__overlay__notice ",a.appendChild(r),a.appendChild(o);var i=document.createElement("div");i.className="gr4vy__overlay__link",i.addEventListener("click",(function(){return n.approvalLost$.next()}));var l=document.createElement("div");l.className="gr4vy__overlay__link",l.addEventListener("click",(function(){return n.approvalCancelled$.next()}));var s=document.createElement("div");s.className="gr4vy__overlay__container",e.appendChild(s);var c=function(e){return e.preventDefault(),n.approvalCancelled$.next(),e.returnValue=!0},u=function(){e.className="gr4vy__overlay gr4vy__overlay--hidden",h(s),window.removeEventListener("beforeunload",c)},d=function(){e.className="gr4vy__overlay gr4vy__overlay--visible",window.addEventListener("beforeunload",c)},p=function(e){var n=e.title,t=e.link,c=e.message,u=e.cancel;r.textContent=n,i.textContent=t,o.textContent=c,l.textContent=u,s.appendChild(a),s.appendChild(i),s.appendChild(l)};n.approvalStarted$.subscribe((function(){var e=n.mode$.value().overlay;p(e),d()})),n.approvalCompleted$.subscribe(u),n.approvalCancelled$.subscribe(u),n.transactionFailed$.subscribe(u),n.transactionCancelled$.subscribe(u),n.approvalUrl$.subscribe((function(e){var t,r,o,a;null!==(t=n.mode$.value())&&void 0!==t&&t.popup||(r=e,s.innerHTML=M($||(o=['\n <iframe\n src="','"\n frameborder="0"\n class="gr4vy__frame"\n allowtransparency="true"\n sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation-by-user-activation"\n ></iframe>\n '],a||(a=o.slice(0)),$=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(a)}}))),r),d())})),n.showOverlay$.subscribe((function(){var e=n.mode$.value().overlay;p(e),d()})),n.hideOverlay$.subscribe(u),n.transactionCreated$.subscribe(u)},L=String.raw,U=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i(),n=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;n.approvalStarted$.subscribe((function(){var o,a,i,l,s,c,u,d,p,m,v=n.mode$.value();e.current&&(null===(o=e.current)||void 0===o||o.stopCallback(),null===(a=e.current)||void 0===a||null===(i=a.popup)||void 0===i||i.close(),e.current=void 0),null!=v&&v.popup&&"fallback"===t&&(e.current=function(e,n,t,r){var o=open("","loading",e);o.document.write(n);var a,i,l,s=(a=function(){return o.closed},i=t,l=setInterval((function(){!0===a()&&(clearInterval(l),i())}),10),function(){return clearInterval(l)});return r&&setTimeout((function(){return o.close()}),r),{popup:o,stopCallback:s}}(function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window,r=t.innerWidth/2-e/2+t.screenLeft,o=t.innerHeight/2-n/2+t.screenTop;return"width=".concat(e,",height=").concat(n,",top=").concat(o,",left=").concat(r)}((null===(l=v.popup)||void 0===l?void 0:l.width)||500,(null===(s=v.popup)||void 0===s?void 0:s.height)||589),(c=n.mode$.value().popup,p=c.title,m=c.message,L(j||(u=["\n <html>\n <head>\n <title>","</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <style>\n html,\n body {\n margin: 0;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,\n Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n text-align: center;\n }\n .gr4vy__status {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n @keyframes gr4vy-sweep {\n 0% {\n background-position: 0 0;\n }\n 100% {\n background-position: 600px 0;\n }\n }\n\n .gr4vy__loading {\n height: 8px;\n background-image: linear-gradient(\n 90deg,\n #009cde 25%,\n #bee7fa 25%,\n #bee7fa 75%,\n #009cde 75%\n );\n background-size: 600px 8px;\n -webkit-animation: gr4vy-sweep 2s infinite\n cubic-bezier(0.2, 0.75, 0.77, 0.25);\n animation: gr4vy-sweep 2s infinite cubic-bezier(0.2, 0.75, 0.77, 0.25);\n }\n </style>\n </head>\n <div class=\"gr4vy__loading\"></div>\n <div class=\"gr4vy__status\">\n <p>","</p>\n </div>\n </html>\n"],d||(d=u.slice(0)),j=Object.freeze(Object.defineProperties(u,{raw:{value:Object.freeze(d)}}))),p,m)),(function(){return n.approvalCancelled$.next()}),r))})),n.approvalUrl$.subscribe((function(t){var r=n.mode$.value();null!=r&&r.popup&&(e.current?function(e,n){e.location.href=n}(e.current.popup,t):(n.hideOverlay$.next(),setTimeout((function(){return window.location.replace(t)}),0)))})),n.approvalLost$.subscribe((function(){e.current&&e.current.popup.focus()})),n.approvalCancelled$.subscribe((function(){var n;null===(n=e.current)||void 0===n||n.popup.close()})),n.approvalCompleted$.subscribe((function(){var n;null===(n=e.current)||void 0===n||n.popup.close()})),n.transactionFailed$.subscribe((function(){var n,t;null===(n=e.current)||void 0===n||n.stopCallback(),null===(t=e.current)||void 0===t||t.popup.close()})),n.formValidationFailed$.subscribe((function(){var n;null===(n=e.current)||void 0===n||n.popup.close()}))};function H(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var D=function(e,n){n.removeAttribute("style"),function(e){var n=[];return Object.keys(e).forEach((function(t){Object.keys(e[t]).forEach((function(r){n.push(["--gr4vy-".concat(t,"-").concat(r),"".concat(e[t][r])])}))})),n}(e).forEach((function(e){var t,r,o=(r=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,a=[],i=!0,l=!1;try{for(t=t.call(e);!(i=(r=t.next()).done)&&(a.push(r.value),!n||a.length!==n);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==t.return||t.return()}finally{if(l)throw o}}return a}}(t,r)||function(e,n){if(e){if("string"==typeof e)return H(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?H(e,n):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],i=o[1];return n.style.setProperty(a,i)}))};function z(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function V(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?z(Object(t),!0).forEach((function(n){B(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):z(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function B(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var N,R={none:"0",thin:"1px",thick:"2px"},Z={rounded:"4px",subtle:"2px",none:"0"},W=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(n).reduce((function(t,r){return V(V({},t),{},B({},r,e[n[r]]))}),{})},G=String.raw,J=!0,K=function(e,n,r){var o,a;J&&(t(796),J=!1),r&&D(function(e){var n={};return null!=e&&e.colors&&(n.colors=V({},e.colors)),null!=e&&e.borderWidths&&(n.borderWidths=W(R,V({},e.borderWidths))),null!=e&&e.radii&&(n.radii=W(Z,V({},e.radii))),n}(r),e),e.innerHTML=G(N||(o=['<div class="gr4vy__container">\n <div class="gr4vy__skeleton">\n <div class="gr4vy__skeleton__radio"></div>\n <div class="gr4vy__skeleton__block"></div>\n </div>\n <div class="gr4vy__skeleton">\n <div class="gr4vy__skeleton__radio"></div>\n <div class="gr4vy__skeleton__block"></div>\n </div>\n </div>'],a||(a=o.slice(0)),N=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(a)}})))),n.optionsLoaded$.subscribe((function(){return e.remove()}))},Q=function(e){var n=e,t=[];return{subscribe:function(e){var n=t.push(e);return{unsubscribe:function(){t.splice(n-1)}}},next:function(e){n=e,t.forEach((function(e){return setTimeout((function(){return e(n)}),0)}))},value:function(){return n}}},X=function(){var e={mode$:Q(),approvalUrl$:Q(),approvalStarted$:Q(),approvalCancelled$:Q(),approvalLost$:Q(),approvalCompleted$:Q(),frameHeight$:Q(0),optionsLoaded$:Q(!1),formSubmit$:Q(),submit$:Q(),transactionCreated$:Q(),beforeTransactionPending$:Q(),transactionFailed$:Q(),transactionCancelled$:Q(),appleStartSession$:Q(),appleValidateMerchant$:Q(),appleCompleteMerchantValidation$:Q(),applePayAuthorized$:Q(),appleCompletePayment$:Q(),appleAbortSession$:Q(),appleSessionError$:Q(),appleCancelSession$:Q(),appleCompleteSession$:Q(),googlePaySessionStarted$:Q(),googlePaySessionCompleted$:Q(),selectedOption$:Q(),showOverlay$:Q(),hideOverlay$:Q(),formValidationFailed$:Q()};return e.formSubmit$.subscribe((function(){var n;null!==(n=e.mode$.value())&&void 0!==n&&n.popup&&e.approvalStarted$.next()})),e.googlePaySessionStarted$.subscribe((function(){e.showOverlay$.next()})),e.googlePaySessionCompleted$.subscribe((function(){e.hideOverlay$.next()})),e.transactionCreated$.subscribe((function(){var n;null!==(n=e.mode$.value())&&void 0!==n&&n.popup&&e.approvalCompleted$.next()})),e},Y=function(e,n,t){n.submit$.subscribe((function(){var e;"custom"===(null===(e=n.selectedOption$.value())||void 0===e?void 0:e.mode)?t({method:n.selectedOption$.value().method}):n.formSubmit$.next()})),n.transactionCreated$.subscribe((function(n){e&&e(n)}))};function ee(e){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}var ne=function(e){var n=e.required,t=e.value;return!n&&[void 0,null].includes(t)},te=function(e){var n=e.argument,t=e.value,r=e.message,o=e.required,a=void 0===o||o,i=e.callback;if(t instanceof Element)return!0;var l=document.querySelector(t);return!(!ne({required:a,value:t})&&!l&&(ie({argument:n,message:"".concat(t," ").concat(r),callback:i}),1))},re=function(e){var n=e.argument,t=e.value,r=e.message,o=e.required,a=void 0===o||o,i=e.callback;if(ne({required:a,value:t}))return!0;var l=!1;try{l=t===new URL("http://".concat(t)).host}catch(e){}return l||ie({argument:n,message:"".concat(t," ").concat(r),callback:i}),l},oe=function(e){var n=e.argument,t=e.value,r=e.message,o=e.required,a=void 0===o||o,i=e.callback,l=Number(t),s=l>=0&&l<=99999999;return!(!ne({required:a,value:t})&&!s&&(ie({argument:n,message:"".concat(t," ").concat(r),callback:i}),1))},ae=function(e){var n=e.argument,t=e.value,r=e.message,o=e.type,a=e.required,i=void 0===a||a,l=e.callback,s=ee(t)===o;return!(!ne({required:i,value:t})&&!s&&(ie({argument:n,message:"".concat(t," ").concat(r),callback:l}),1))},ie=function(e){var n=e.argument,t=e.message,r=e.callback,o={code:"argumentError",argument:n,message:t};console.error("Gr4vy - Error",o),null==r||r("argumentError",o)},le=function(e){return te({argument:"element",value:e.element,message:"must be a valid HTML element",callback:e.onEvent})&&te({argument:"form",value:e.form,required:!1,message:"must be a valid HTML form element",callback:e.onEvent})&&ae({argument:"gr4vyId",value:e.gr4vyId,required:!e.iframeHost&&!e.apiHost,type:"string",message:"must be a valid gr4vyId or iframeHost/apiHost",callback:e.onEvent})&&re({argument:"iframeHost",value:e.iframeHost,required:!e.gr4vyId,message:"must be a valid hostname with an optional :port",callback:e.onEvent})&&re({argument:"apiHost",value:e.apiHost,message:"must be a valid hostname with an optional :port",required:!e.gr4vyId,callback:e.onEvent})&&(r=(t={argument:"intent",value:e.intent,message:"must be a valid intent",required:!1,callback:e.onEvent}).argument,a=t.message,l=void 0===(i=t.required)||i,s=t.callback,c="string"==typeof(o=t.value)&&["authorize","capture","approve"].includes(o),!(!ne({required:l,value:o})&&!c&&(ie({argument:r,message:"".concat(o," ").concat(a),callback:s}),1)))&&ae({argument:"onEvent",value:e.onEvent,type:"function",message:"must be a function",required:!1,callback:e.onEvent})&&ae({argument:"token",value:e.token,type:"string",message:"must be a string",callback:e.onEvent})&&ae({argument:"externalIdentifier",value:e.externalIdentifier,type:"string",message:"must be a string",required:!1,callback:e.onEvent})&&function(e){var n=e.argument,t=e.value,r=e.message,o=e.required,a=void 0===o||o,i=e.callback,l="string"==typeof t&&3===t.length;return!(!ne({required:a,value:t})&&!l&&(ie({argument:n,message:"".concat(t," ").concat(r),callback:i}),1))}({argument:"currency",value:e.currency,message:"must be a valid currency format",callback:e.onEvent})&&oe({argument:"amount",value:e.amount,message:"must be valid non-negative number",callback:e.onEvent})&&ae({argument:"debug",value:e.debug,type:"boolean",message:"must be a boolean",required:!1,callback:e.onEvent})&&ae({argument:"buyerExternalIdentifier",value:e.buyerExternalIdentifier,type:"string",message:"must be a string",required:!1,callback:e.onEvent})&&ae({argument:"buyerId",value:e.buyerId,type:"string",message:"must be a string",required:!1,callback:e.onEvent})&&ae({argument:"environment",value:e.environment,type:"string",message:'must be "production" or "sandbox"',required:!1,callback:e.onEvent})&&function(e){var n=e.argument,t=e.value,r=e.message,o=e.required,a=void 0===o||o,i=e.callback,l=[!0,!1,"ask"].includes(t);return!(!ne({required:a,value:t})&&!l&&(ie({argument:n,message:"".concat(t," ").concat(r),callback:i}),1))}({argument:"store",value:e.store,message:'must be true, false or "ask"',required:!1})&&ae({argument:"country",value:e.country,type:"string",message:"must be a string ISO country code",required:!0,callback:e.onEvent})&&ae({argument:"display",value:e.display,type:"string",message:'must be "storedOnly", "addOnly", "supportsTokenization" or "all"',required:!1})&&ae({argument:"metadata",value:e.metadata,type:"object",message:"must be an object",required:!1})&&ae({argument:"cartItems",value:e.cartItems,type:"object",message:"must be an array",required:!1})&&ae({argument:"statementDescriptor",value:e.statementDescriptor,type:"object",message:"must be an object",required:!1})&&ae({argument:"secure",value:e.secure,type:"boolean",message:"must be a boolean",required:!1})&&oe({argument:"popupTimeout",value:e.popupTimeout,message:"must be valid non-negative number",required:!1})&&ae({argument:"shippingDetailsId",value:e.shippingDetailsId,required:!1,type:"string",message:"must be a valid uuid"})&&(!!(n={argument:"shippingDetailsId",condition:!e.shippingDetailsId||!(!e.buyerId&&!e.buyerExternalIdentifier),message:"must be used with a buyerId or buyerExternalId"}).condition||(ie({argument:n.argument,message:n.message}),!1))&&ae({argument:"hasBeforeTransaction",value:e.onBeforeTransaction,required:!1,type:"function",message:"must be a valid function that returns a promise"})&&ae({argument:"merchantAccountId",value:e.merchantAccountId,message:"must be a string",required:!1,type:"string"})&&ae({argument:"billingAddressFields",value:e.billingAddressFields,type:"object",message:"must be an object",required:!1})&&ae({argument:"antiFraudFingerprint",value:e.antiFraudFingerprint,message:"must be a string",required:!1,type:"string"});var n,t,r,o,a,i,l,s,c};function se(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function ce(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?se(Object(t),!0).forEach((function(n){ue(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):se(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function ue(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var de=["amount","currency","intent","apiHost","gr4vyId","token","debug","externalIdentifier","buyerId","buyerExternalIdentifier","environment","store","country","theme","locale","display","apiUrl","customOptions","metadata","paymentSource","cartItems","statementDescriptor","requireSecurityCode","shippingDetailsId","connectionOptions","fullPageReturnUrl","showDeleteButton","merchantAccountId","billingAddressFields","antiFraudFingerprint","enableAnimations","separatePaymentOptions"],pe=new Map,me=0;function ve(t){if(le(t)){var r=k(t),l=X(),s=r.element.dataset.embedId;h(r.element),pe.has(s)&&pe.get(s)(),me+=1,r.element.dataset.embedId=me.toString();var c=document.createElement("div");K(c,l,r.theme);var u=document.createElement("div");F(u,l),r.form?T(r.form,r.onComplete,l,r.onCustomSubmit):Y(r.onComplete,l,r.onCustomSubmit),U(i(),l,r.redirectMode,r.popupTimeout);var d=document.createElement("iframe");A(d,r.iframeSrc,l);var b=e()?n():0;b&&o(l,b),r.element.append(u,c,d);var g=setTimeout((function(){m("Loading Embed UI failed or took too long. Please check that the `gr4vyId` and `environment` values are correct.",t,{debug:!0})}),3e3),O={modeUpdated:l.mode$.next,approvalUrl:l.approvalUrl$.next,resize:function(e){var n;return l.frameHeight$.next(null==e||null===(n=e.frame)||void 0===n?void 0:n.height)},optionsLoaded:l.optionsLoaded$.next,transactionCreated:l.transactionCreated$.next,transactionFailed:l.transactionFailed$.next,transactionCancelled:l.transactionCancelled$.next,appleStartSession:l.appleStartSession$.next,appleCompleteMerchantValidation:l.appleCompleteMerchantValidation$.next,appleCompletePayment:l.appleCompletePayment$.next,appleAbortSession:l.appleAbortSession$.next,googlePaySessionStarted:l.googlePaySessionStarted$.next,googlePaySessionCompleted:l.googlePaySessionCompleted$.next,frameReady:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).version;return e&&w("embed-ui",e),clearTimeout(g),x({type:"updateOptions",data:ce(ce({},a(r,de)),{},{supportedApplePayVersion:b,supportedGooglePayVersion:1,hasBeforeTransaction:"function"==typeof(null==r?void 0:r.onBeforeTransaction)})})},paymentMethodSelected:l.selectedOption$.next,scrollTo:function(e){var n=e.top;window.scrollTo({top:d.offsetTop+n,left:0,behavior:"smooth"})},beforeTransactionPending:l.beforeTransactionPending$.next,formValidationFailed:l.formValidationFailed$.next},x=y(r.iframeUrl,r.channel,d.contentWindow,(function(e){return p("Page emits",e,{debug:r.debug})})),S=v(r.iframeUrl,r.channel,(function(e){var n;p("Page received",e,{debug:r.debug}),["formUpdate","transactionCreated","transactionFailed","apiError","paymentMethodSelected","transactionCancelled","optionsLoaded"].includes(e.type)&&(null===(n=r.onEvent)||void 0===n||n.call(r,e.type,e.data)),O[e.type]&&O[e.type](e.data)})),_=v(r.apiUrl,r.channel,(function(e){d.contentWindow.postMessage(e,r.iframeUrl)})),$=v(r.iframeUrl,r.channel,f(["approvalErrored","transactionUpdated","approvalCancelled"],(function(e){return d.contentWindow.postMessage(e,r.iframeUrl)})));return l.formSubmit$.subscribe((function(){return x({type:"submitForm"})})),l.beforeTransactionPending$.subscribe((function(){if(null!=r&&r.onBeforeTransaction)return r.onBeforeTransaction(a(r,["metadata"])).then((function(){x({type:"beforeTransactionDone",data:a(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},["externalIdentifier","shippingDetailsId","metadata","token"])})})).catch((function(){x({type:"beforeTransactionError"})}))})),l.approvalCancelled$.subscribe((function(){return x({type:"approvalCancelled"})})),l.applePayAuthorized$.subscribe((function(e){return x({type:"applePayAuthorized",data:e})})),l.appleValidateMerchant$.subscribe((function(e){return x({type:"appleValidateMerchant",data:e})})),l.appleCancelSession$.subscribe((function(){return x({type:"appleCancelSession"})})),l.appleSessionError$.subscribe((function(e){return x({type:"appleSessionError",data:e})})),l.appleCompleteSession$.subscribe((function(){return x({type:"appleCompleteSession"})})),window.addEventListener("message",S),window.addEventListener("message",_),window.addEventListener("message",$),w("embed"),pe.set(me.toString(),(function(){window.removeEventListener("message",S),window.removeEventListener("message",_),window.removeEventListener("message",$)})),{submit:function(){l.formSubmit$.next()}}}}})(),r})())); | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.gr4vy=n():e.gr4vy=n()}(this,(()=>(()=>{"use strict";var e={381:(e,n,t)=>{t.d(n,{Z:()=>l});var r=t(601),o=t.n(r),a=t(609),i=t.n(a)()(o());i.push([e.id,".gr4vy__overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n max-height: 100vh;\n z-index: 100;\n transition: background-color 0.2s linear, max-height 0s linear;\n background: rgba(0, 0, 0, 0.8);\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.gr4vy__overlay--visible {\n -webkit-backdrop-filter: blur(2px);\n backdrop-filter: blur(2px);\n}\n\n.gr4vy__overlay__container {\n color: white;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,\n Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';\n font-size: 1rem;\n text-align: center;\n font-weight: bold;\n}\n\n.gr4vy__overlay__container > * + * {\n margin-top: 32px;\n}\n\n.gr4vy__overlay__notice > * + * {\n margin-top: 8px;\n}\n\n.gr4vy__overlay--hidden {\n max-height: 0;\n backdrop-filter: unset;\n background-color: rgba(0, 0, 0, 0);\n transition: background-color 0.2s linear, max-height 0s linear;\n transition-delay: 0s, 0.2s;\n overflow: hidden;\n}\n\n.gr4vy__overlay__link {\n font-weight: normal;\n text-decoration: underline;\n font-weight: normal;\n color: white;\n display: block;\n cursor: pointer;\n}\n\n.gr4vy__frame {\n height: 100vh;\n width: 100vw;\n}\n\n@media screen and (min-width: 500px) and (min-height: 350px) {\n .gr4vy__frame {\n height: 250px;\n width: 400px;\n }\n}\n\n@media screen and (min-width: 500px) and (min-height: 490px) {\n .gr4vy__frame {\n height: 390px;\n width: 400px;\n }\n}\n\n@media screen and (min-width: 700px) and (min-height: 500px) {\n .gr4vy__frame {\n height: 400px;\n width: 600px;\n }\n}\n\n@media screen and (min-width: 700px) and (min-height: 600px) {\n .gr4vy__frame {\n height: 500px;\n width: 600px;\n }\n}\n",""]);const l=i},514:(e,n,t)=>{t.d(n,{Z:()=>l});var r=t(601),o=t.n(r),a=t(609),i=t.n(a)()(o());i.push([e.id,"@keyframes gr4vy-sweep {\n 0% {\n background-position: 0 0;\n }\n 100% {\n background-position: 600px 0;\n }\n}\n\n.gr4vy__skeleton {\n display: flex;\n border-bottom: var(--gr4vy-borderWidths-container, 1px) solid\n var(--gr4vy-colors-containerBorder, #f2f2f2);\n padding: 16px;\n}\n\n.gr4vy__skeleton:last-child {\n border-bottom: none;\n}\n\n.gr4vy__skeleton__radio {\n border-radius: 50%;\n height: 16px;\n width: 16px;\n margin-bottom: 4px;\n margin-top: 4px;\n background-color: var(--gr4vy-colors-containerBorder, #f2f2f2);\n}\n\n.gr4vy__skeleton__block {\n flex-grow: 1;\n height: 16px;\n background-image: linear-gradient(\n 90deg,\n var(--gr4vy-colors-containerBorder, #f2f2f2) 30%,\n var(--gr4vy-colors-containerBackground, #ffffff) 50%,\n var(--gr4vy-colors-containerBorder, #f2f2f2) 70%\n );\n background-size: 600px;\n margin-bottom: 4px;\n margin-top: 4px;\n margin-left: 16px;\n border-radius: var(--gr4vy-radii-input, 0);\n -webkit-animation: gr4vy-sweep 1s infinite cubic-bezier(0.2, 0.75, 0.77, 0.25);\n animation: gr4vy-sweep 1s infinite cubic-bezier(0.2, 0.75, 0.77, 0.25);\n}\n.gr4vy__container {\n border: var(--gr4vy-borderWidths-container, 1px) solid\n var(--gr4vy-colors-containerBorder, #f2f2f2);\n border-radius: var(--gr4vy-radii-container, 0);\n background: var(--gr4vy-colors-pageBackground, #ffffff);\n max-width: 480px;\n}\n",""]);const l=i},609:e=>{e.exports=function(e){var n=[];return n.toString=function(){return this.map((function(n){var t="",r=void 0!==n[5];return n[4]&&(t+="@supports (".concat(n[4],") {")),n[2]&&(t+="@media ".concat(n[2]," {")),r&&(t+="@layer".concat(n[5].length>0?" ".concat(n[5]):""," {")),t+=e(n),r&&(t+="}"),n[2]&&(t+="}"),n[4]&&(t+="}"),t})).join("")},n.i=function(e,t,r,o,a){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(r)for(var l=0;l<this.length;l++){var s=this[l][0];null!=s&&(i[s]=!0)}for(var c=0;c<e.length;c++){var u=[].concat(e[c]);r&&i[u[0]]||(void 0!==a&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=a),t&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=t):u[2]=t),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),n.push(u))}},n}},601:e=>{e.exports=function(e){return e[1]}},88:(e,n,t)=>{function r(e){if(("string"==typeof e||e instanceof String)&&(e=document.getElementById(e)),!(e instanceof HTMLFormElement))throw new TypeError("FormNapper requires an HTMLFormElement element or the id string of one.");this.htmlForm=e}r.prototype.hijack=function(e){this.submitHandler||(this.submitHandler=function(n){n.preventDefault?n.preventDefault():n.returnValue=!1,e(n)},null!=t.g.addEventListener?this.htmlForm.addEventListener("submit",this.submitHandler,!1):null!=t.g.attachEvent?this.htmlForm.attachEvent("onsubmit",this.submitHandler):this.htmlForm.onsubmit=this.submitHandler)},r.prototype.inject=function(e,n){var t=this.htmlForm.querySelector('input[name="'+e+'"]');return null==t&&((t=document.createElement("input")).type="hidden",t.name=e,this.htmlForm.appendChild(t)),t.value=n,t},r.prototype.submit=function(){HTMLFormElement.prototype.submit.call(this.htmlForm)},r.prototype.detach=function(){this.submitHandler&&(null!=t.g.removeEventListener?this.htmlForm.removeEventListener("submit",this.submitHandler,!1):null!=t.g.detachEvent?this.htmlForm.detachEvent("onsubmit",this.submitHandler):this.htmlForm.onsubmit=null,delete this.submitHandler)},e.exports=r},496:(e,n,t)=>{t.r(n),t.d(n,{default:()=>g});var r=t(62),o=t.n(r),a=t(36),i=t.n(a),l=t(793),s=t.n(l),c=t(892),u=t.n(c),d=t(173),p=t.n(d),m=t(464),v=t.n(m),f=t(381),b={};b.styleTagTransform=v(),b.setAttributes=u(),b.insert=s().bind(null,"head"),b.domAPI=i(),b.insertStyleElement=p(),o()(f.Z,b);const g=f.Z&&f.Z.locals?f.Z.locals:void 0},796:(e,n,t)=>{t.r(n),t.d(n,{default:()=>g});var r=t(62),o=t.n(r),a=t(36),i=t.n(a),l=t(793),s=t.n(l),c=t(892),u=t.n(c),d=t(173),p=t.n(d),m=t(464),v=t.n(m),f=t(514),b={};b.styleTagTransform=v(),b.setAttributes=u(),b.insert=s().bind(null,"head"),b.domAPI=i(),b.insertStyleElement=p(),o()(f.Z,b);const g=f.Z&&f.Z.locals?f.Z.locals:void 0},62:e=>{var n=[];function t(e){for(var t=-1,r=0;r<n.length;r++)if(n[r].identifier===e){t=r;break}return t}function r(e,r){for(var a={},i=[],l=0;l<e.length;l++){var s=e[l],c=r.base?s[0]+r.base:s[0],u=a[c]||0,d="".concat(c," ").concat(u);a[c]=u+1;var p=t(d),m={css:s[1],media:s[2],sourceMap:s[3],supports:s[4],layer:s[5]};if(-1!==p)n[p].references++,n[p].updater(m);else{var v=o(m,r);r.byIndex=l,n.splice(l,0,{identifier:d,updater:v,references:1})}i.push(d)}return i}function o(e,n){var t=n.domAPI(n);return t.update(e),function(n){if(n){if(n.css===e.css&&n.media===e.media&&n.sourceMap===e.sourceMap&&n.supports===e.supports&&n.layer===e.layer)return;t.update(e=n)}else t.remove()}}e.exports=function(e,o){var a=r(e=e||[],o=o||{});return function(e){e=e||[];for(var i=0;i<a.length;i++){var l=t(a[i]);n[l].references--}for(var s=r(e,o),c=0;c<a.length;c++){var u=t(a[c]);0===n[u].references&&(n[u].updater(),n.splice(u,1))}a=s}}},793:e=>{var n={};e.exports=function(e,t){var r=function(e){if(void 0===n[e]){var t=document.querySelector(e);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(e){t=null}n[e]=t}return n[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(t)}},173:e=>{e.exports=function(e){var n=document.createElement("style");return e.setAttributes(n,e.attributes),e.insert(n,e.options),n}},892:(e,n,t)=>{e.exports=function(e){var n=t.nc;n&&e.setAttribute("nonce",n)}},36:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var n=e.insertStyleElement(e);return{update:function(t){!function(e,n,t){var r="";t.supports&&(r+="@supports (".concat(t.supports,") {")),t.media&&(r+="@media ".concat(t.media," {"));var o=void 0!==t.layer;o&&(r+="@layer".concat(t.layer.length>0?" ".concat(t.layer):""," {")),r+=t.css,o&&(r+="}"),t.media&&(r+="}"),t.supports&&(r+="}");var a=t.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),n.styleTagTransform(r,e,n.options)}(n,e,t)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)}}}},464:e=>{e.exports=function(e,n){if(n.styleSheet)n.styleSheet.cssText=e;else{for(;n.firstChild;)n.removeChild(n.firstChild);n.appendChild(document.createTextNode(e))}}}},n={};function t(r){var o=n[r];if(void 0!==o)return o.exports;var a=n[r]={id:r,exports:{}};return e[r](a,a.exports,t),a.exports}t.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},t.d=(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.nc=void 0;var r={};return(()=>{t.r(r),t.d(r,{optionKeys:()=>de,setup:()=>ve});var e=function(){var e=!1;try{e=window.ApplePaySession&&ApplePaySession.canMakePayments()&&ApplePaySession.supportsVersion(3)}catch(e){}return e},n=function(){return ApplePaySession.supportsVersion(5)?5:ApplePaySession.supportsVersion(4)?4:ApplePaySession.supportsVersion(3)?3:null},o=function(e,n){var t;e.appleStartSession$.subscribe((function(r){try{(t=new ApplePaySession(n,r)).onvalidatemerchant=function(n){e.appleValidateMerchant$.next(n.validationURL)},t.onpaymentauthorized=function(n){e.applePayAuthorized$.next(n.payment.token)},t.oncancel=function(){e.appleCancelSession$.next()},t.begin()}catch(n){e.appleSessionError$.next(null==n?void 0:n.message)}})),e.appleCompleteMerchantValidation$.subscribe((function(e){t.completeMerchantValidation(e)})),e.appleAbortSession$.subscribe((function(){var e;(null===(e=t)||void 0===e?void 0:e.abort)&&t.abort()})),e.appleCompletePayment$.subscribe((function(n){n?t.completePayment(ApplePaySession.STATUS_SUCCESS):t.completePayment(ApplePaySession.STATUS_FAILURE),e.appleCompleteSession$.next()}))},a=function(e,n){return n.reduce((function(n,t){return void 0!==e[t]&&null!==e[t]&&(n[t]=e[t]),n}),{})},i=function(e){return{current:e}},l=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=new URL("https://".concat(e));return n||(t.protocol="http"),t.toString().replace(/\/$/,"")};function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function c(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){u(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function u(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var d={debug:!1,level:"log"},p=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=c(c({},d),t),o=r.debug,a=r.level;o&&console[a]("Gr4vy - ".concat(e),n)},m=function(e,n,t){p(e,n,c(c({},t),{},{level:"warn"}))},v=function(e,n,t){return function(r){e===r.origin&&r.data.channel===n&&t(r.data)}},f=function(e,n){return function(t){e.includes(t.type)&&n(t)}};function b(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function g(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var y=function(e,n,t,r){return function(o){t.postMessage(function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?b(Object(t),!0).forEach((function(n){g(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({channel:n},o),e),r&&r(o)}},h=function(e){if(e.hasChildNodes())for(;e.firstChild;)e.removeChild(e.lastChild)},w=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#bd1a87bc4bac4de649e0a9deb8be5ecec7cb3fb5";window.gr4vy||(window.gr4vy={version:{}}),window.gr4vy.version||(window.gr4vy.version={}),window.gr4vy.version[e]=n},O=["gr4vyId","environment"];function x(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function S(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?x(Object(t),!0).forEach((function(n){_(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):x(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function _(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var $,j,k=function(e){var n,t,r,o,a,i=e.gr4vyId,s=e.environment,c=function(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)t=a[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(e,O),u=(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(4)).join("").slice(0,32),d="sandbox"===s?"sandbox.":"",p=i?"embed.".concat(d).concat(i,".gr4vy.app"):e.iframeHost,m=i?"api.".concat(d).concat(i,".gr4vy.app"):e.apiHost,v=l(p,e.secure),f=e.form instanceof Element?e.form:document.querySelector(e.form),b=e.element instanceof Element?e.element:document.querySelector(e.element);return S(S({enableAnimations:!1,separatePaymentOptions:!1,requireSecurityCode:!1,showDeleteButton:!1,store:"ask",display:"all",apiHost:m,apiUrl:l(m,e.secure),gr4vyId:i,iframeHost:p,iframeUrl:v,iframeSrc:(r=v,o={parentUrl:"".concat(document.location.protocol,"//").concat(document.location.host),font:null!==(n=e.theme)&&void 0!==n&&null!==(t=n.fonts)&&void 0!==t&&t.body?encodeURIComponent(e.theme.fonts.body):void 0,channel:u},a=new URL(r),Object.keys(o).forEach((function(e){void 0!==o[e]&&a.searchParams.set(e,o[e])})),a.toString()),channel:u},c),{},{element:b,form:f,environment:s,redirectMode:e.redirectMode||"fallback"})},E=t(88),P=t.n(E),C=new Map,I=0,T=function(e,n,t,r){parseInt(e.dataset.formNapperId)>0&&(C.get(e.dataset.formNapperId).detach(),C.delete(e.dataset.formNapperId)),I+=1,e.dataset.formNapperId=String(I);var o=new(P())(e);C.set(I.toString(),o),o.hijack((function(){var e;"custom"===(null===(e=t.selectedOption$.value())||void 0===e?void 0:e.mode)?r({method:t.selectedOption$.value().method}):t.formSubmit$.next()})),t.transactionCreated$.subscribe((function(e){var t;return o.inject("gr4vy_transaction_id",e.id),o.inject("gr4vy_transaction_status",e.status),null!=e&&null!==(t=e.paymentMethod)&&void 0!==t&&t.id&&o.inject("gr4vy_transaction_payment_method_id",e.paymentMethod.id),"function"==typeof n?n(e):o.submit()}))},A=function(e,n,t){e.src=n,e.title="Secure payment frame - Gr4vy",e.style.visibility="hidden",e.style.display="none",e.style.width="100%",e.style.height="0px",e.style.border="0",e.style.overflow="hidden",e.setAttribute("frameBorder","0"),e.setAttribute("scrolling","no"),e.setAttribute("allowpaymentrequest","true"),e.setAttribute("sandbox","allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation-by-user-activation"),t.frameHeight$.subscribe((function(n){"unset"===e.style.visibility&&(e.style.height="".concat(n,"px"))})),t.optionsLoaded$.subscribe((function(){e.style.visibility="unset",e.style.display="unset"}))},q=!0,M=String.raw,F=function(e,n){q&&(t(496),q=!1),e.className="gr4vy__overlay gr4vy__overlay--hidden";var r=document.createElement("div"),o=document.createElement("div"),a=document.createElement("div");a.className="gr4vy__overlay__notice ",a.appendChild(r),a.appendChild(o);var i=document.createElement("div");i.className="gr4vy__overlay__link",i.addEventListener("click",(function(){return n.approvalLost$.next()}));var l=document.createElement("div");l.className="gr4vy__overlay__link",l.addEventListener("click",(function(){return n.approvalCancelled$.next()}));var s=document.createElement("div");s.className="gr4vy__overlay__container",e.appendChild(s);var c=function(e){return e.preventDefault(),n.approvalCancelled$.next(),e.returnValue=!0},u=function(){e.className="gr4vy__overlay gr4vy__overlay--hidden",h(s),window.removeEventListener("beforeunload",c)},d=function(){e.className="gr4vy__overlay gr4vy__overlay--visible",window.addEventListener("beforeunload",c)},p=function(e){var n=e.title,t=e.link,c=e.message,u=e.cancel;r.textContent=n,i.textContent=t,o.textContent=c,l.textContent=u,s.appendChild(a),s.appendChild(i),s.appendChild(l)};n.approvalStarted$.subscribe((function(){var e=n.mode$.value().overlay;p(e),d()})),n.approvalCompleted$.subscribe(u),n.approvalCancelled$.subscribe(u),n.transactionFailed$.subscribe(u),n.transactionCancelled$.subscribe(u),n.approvalUrl$.subscribe((function(e){var t,r,o,a;null!==(t=n.mode$.value())&&void 0!==t&&t.popup||(r=e,s.innerHTML=M($||(o=['\n <iframe\n src="','"\n frameborder="0"\n class="gr4vy__frame"\n allowtransparency="true"\n sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation-by-user-activation"\n ></iframe>\n '],a||(a=o.slice(0)),$=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(a)}}))),r),d())})),n.showOverlay$.subscribe((function(){var e=n.mode$.value().overlay;p(e),d()})),n.hideOverlay$.subscribe(u),n.transactionCreated$.subscribe(u)},L=String.raw,U=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i(),n=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;n.approvalStarted$.subscribe((function(){var o,a,i,l,s,c,u,d,p,m,v=n.mode$.value();e.current&&(null===(o=e.current)||void 0===o||o.stopCallback(),null===(a=e.current)||void 0===a||null===(i=a.popup)||void 0===i||i.close(),e.current=void 0),null!=v&&v.popup&&"fallback"===t&&(e.current=function(e,n,t,r){var o=open("","loading",e);o.document.write(n);var a,i,l,s=(a=function(){return o.closed},i=t,l=setInterval((function(){!0===a()&&(clearInterval(l),i())}),10),function(){return clearInterval(l)});return r&&setTimeout((function(){return o.close()}),r),{popup:o,stopCallback:s}}(function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window,r=t.innerWidth/2-e/2+t.screenLeft,o=t.innerHeight/2-n/2+t.screenTop;return"width=".concat(e,",height=").concat(n,",top=").concat(o,",left=").concat(r)}((null===(l=v.popup)||void 0===l?void 0:l.width)||500,(null===(s=v.popup)||void 0===s?void 0:s.height)||589),(c=n.mode$.value().popup,p=c.title,m=c.message,L(j||(u=["\n <html>\n <head>\n <title>","</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <style>\n html,\n body {\n margin: 0;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,\n Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',\n 'Segoe UI Symbol';\n text-align: center;\n }\n .gr4vy__status {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n @keyframes gr4vy-sweep {\n 0% {\n background-position: 0 0;\n }\n 100% {\n background-position: 600px 0;\n }\n }\n\n .gr4vy__loading {\n height: 8px;\n background-image: linear-gradient(\n 90deg,\n #009cde 25%,\n #bee7fa 25%,\n #bee7fa 75%,\n #009cde 75%\n );\n background-size: 600px 8px;\n -webkit-animation: gr4vy-sweep 2s infinite\n cubic-bezier(0.2, 0.75, 0.77, 0.25);\n animation: gr4vy-sweep 2s infinite cubic-bezier(0.2, 0.75, 0.77, 0.25);\n }\n </style>\n </head>\n <div class=\"gr4vy__loading\"></div>\n <div class=\"gr4vy__status\">\n <p>","</p>\n </div>\n </html>\n"],d||(d=u.slice(0)),j=Object.freeze(Object.defineProperties(u,{raw:{value:Object.freeze(d)}}))),p,m)),(function(){return n.approvalCancelled$.next()}),r))})),n.approvalUrl$.subscribe((function(t){var r=n.mode$.value();null!=r&&r.popup&&(e.current?function(e,n){e.location.href=n}(e.current.popup,t):(n.hideOverlay$.next(),setTimeout((function(){return window.location.replace(t)}),0)))})),n.approvalLost$.subscribe((function(){e.current&&e.current.popup.focus()})),n.approvalCancelled$.subscribe((function(){var n;null===(n=e.current)||void 0===n||n.popup.close()})),n.approvalCompleted$.subscribe((function(){var n;null===(n=e.current)||void 0===n||n.popup.close()})),n.transactionFailed$.subscribe((function(){var n,t;null===(n=e.current)||void 0===n||n.stopCallback(),null===(t=e.current)||void 0===t||t.popup.close()})),n.formValidationFailed$.subscribe((function(){var n;null===(n=e.current)||void 0===n||n.popup.close()}))};function H(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}var D=function(e,n){n.removeAttribute("style"),function(e){var n=[];return Object.keys(e).forEach((function(t){Object.keys(e[t]).forEach((function(r){n.push(["--gr4vy-".concat(t,"-").concat(r),"".concat(e[t][r])])}))})),n}(e).forEach((function(e){var t,r,o=(r=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,a=[],i=!0,l=!1;try{for(t=t.call(e);!(i=(r=t.next()).done)&&(a.push(r.value),!n||a.length!==n);i=!0);}catch(e){l=!0,o=e}finally{try{i||null==t.return||t.return()}finally{if(l)throw o}}return a}}(t,r)||function(e,n){if(e){if("string"==typeof e)return H(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?H(e,n):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],i=o[1];return n.style.setProperty(a,i)}))};function z(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function V(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?z(Object(t),!0).forEach((function(n){B(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):z(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function B(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var N,R={none:"0",thin:"1px",thick:"2px"},Z={rounded:"4px",subtle:"2px",none:"0"},W=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(n).reduce((function(t,r){return V(V({},t),{},B({},r,e[n[r]]))}),{})},G=String.raw,J=!0,K=function(e,n,r){var o,a;J&&(t(796),J=!1),r&&D(function(e){var n={};return null!=e&&e.colors&&(n.colors=V({},e.colors)),null!=e&&e.borderWidths&&(n.borderWidths=W(R,V({},e.borderWidths))),null!=e&&e.radii&&(n.radii=W(Z,V({},e.radii))),n}(r),e),e.innerHTML=G(N||(o=['<div class="gr4vy__container">\n <div class="gr4vy__skeleton">\n <div class="gr4vy__skeleton__radio"></div>\n <div class="gr4vy__skeleton__block"></div>\n </div>\n <div class="gr4vy__skeleton">\n <div class="gr4vy__skeleton__radio"></div>\n <div class="gr4vy__skeleton__block"></div>\n </div>\n </div>'],a||(a=o.slice(0)),N=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(a)}})))),n.optionsLoaded$.subscribe((function(){return e.remove()}))},Q=function(e){var n=e,t=[];return{subscribe:function(e){var n=t.push(e);return{unsubscribe:function(){t.splice(n-1)}}},next:function(e){n=e,t.forEach((function(e){return setTimeout((function(){return e(n)}),0)}))},value:function(){return n}}},X=function(){var e={mode$:Q(),approvalUrl$:Q(),approvalStarted$:Q(),approvalCancelled$:Q(),approvalLost$:Q(),approvalCompleted$:Q(),frameHeight$:Q(0),optionsLoaded$:Q(!1),formSubmit$:Q(),submit$:Q(),transactionCreated$:Q(),beforeTransactionPending$:Q(),transactionFailed$:Q(),transactionCancelled$:Q(),appleStartSession$:Q(),appleValidateMerchant$:Q(),appleCompleteMerchantValidation$:Q(),applePayAuthorized$:Q(),appleCompletePayment$:Q(),appleAbortSession$:Q(),appleSessionError$:Q(),appleCancelSession$:Q(),appleCompleteSession$:Q(),googlePaySessionStarted$:Q(),googlePaySessionCompleted$:Q(),selectedOption$:Q(),showOverlay$:Q(),hideOverlay$:Q(),formValidationFailed$:Q()};return e.formSubmit$.subscribe((function(){var n;null!==(n=e.mode$.value())&&void 0!==n&&n.popup&&e.approvalStarted$.next()})),e.googlePaySessionStarted$.subscribe((function(){e.showOverlay$.next()})),e.googlePaySessionCompleted$.subscribe((function(){e.hideOverlay$.next()})),e.transactionCreated$.subscribe((function(){var n;null!==(n=e.mode$.value())&&void 0!==n&&n.popup&&e.approvalCompleted$.next()})),e},Y=function(e,n,t){n.submit$.subscribe((function(){var e;"custom"===(null===(e=n.selectedOption$.value())||void 0===e?void 0:e.mode)?t({method:n.selectedOption$.value().method}):n.formSubmit$.next()})),n.transactionCreated$.subscribe((function(n){e&&e(n)}))};function ee(e){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}var ne=function(e){var n=e.required,t=e.value;return!n&&[void 0,null].includes(t)},te=function(e){var n=e.argument,t=e.value,r=e.message,o=e.required,a=void 0===o||o,i=e.callback;if(t instanceof Element)return!0;var l=document.querySelector(t);return!(!ne({required:a,value:t})&&!l&&(ie({argument:n,message:"".concat(t," ").concat(r),callback:i}),1))},re=function(e){var n=e.argument,t=e.value,r=e.message,o=e.required,a=void 0===o||o,i=e.callback;if(ne({required:a,value:t}))return!0;var l=!1;try{l=t===new URL("http://".concat(t)).host}catch(e){}return l||ie({argument:n,message:"".concat(t," ").concat(r),callback:i}),l},oe=function(e){var n=e.argument,t=e.value,r=e.message,o=e.required,a=void 0===o||o,i=e.callback,l=Number(t),s=l>=0&&l<=99999999;return!(!ne({required:a,value:t})&&!s&&(ie({argument:n,message:"".concat(t," ").concat(r),callback:i}),1))},ae=function(e){var n=e.argument,t=e.value,r=e.message,o=e.type,a=e.required,i=void 0===a||a,l=e.callback,s=ee(t)===o;return!(!ne({required:i,value:t})&&!s&&(ie({argument:n,message:"".concat(t," ").concat(r),callback:l}),1))},ie=function(e){var n=e.argument,t=e.message,r=e.callback,o={code:"argumentError",argument:n,message:t};console.error("Gr4vy - Error",o),null==r||r("argumentError",o)},le=function(e){return te({argument:"element",value:e.element,message:"must be a valid HTML element",callback:e.onEvent})&&te({argument:"form",value:e.form,required:!1,message:"must be a valid HTML form element",callback:e.onEvent})&&ae({argument:"gr4vyId",value:e.gr4vyId,required:!e.iframeHost&&!e.apiHost,type:"string",message:"must be a valid gr4vyId or iframeHost/apiHost",callback:e.onEvent})&&re({argument:"iframeHost",value:e.iframeHost,required:!e.gr4vyId,message:"must be a valid hostname with an optional :port",callback:e.onEvent})&&re({argument:"apiHost",value:e.apiHost,message:"must be a valid hostname with an optional :port",required:!e.gr4vyId,callback:e.onEvent})&&(r=(t={argument:"intent",value:e.intent,message:"must be a valid intent",required:!1,callback:e.onEvent}).argument,a=t.message,l=void 0===(i=t.required)||i,s=t.callback,c="string"==typeof(o=t.value)&&["authorize","capture","approve"].includes(o),!(!ne({required:l,value:o})&&!c&&(ie({argument:r,message:"".concat(o," ").concat(a),callback:s}),1)))&&ae({argument:"onEvent",value:e.onEvent,type:"function",message:"must be a function",required:!1,callback:e.onEvent})&&ae({argument:"token",value:e.token,type:"string",message:"must be a string",callback:e.onEvent})&&ae({argument:"externalIdentifier",value:e.externalIdentifier,type:"string",message:"must be a string",required:!1,callback:e.onEvent})&&function(e){var n=e.argument,t=e.value,r=e.message,o=e.required,a=void 0===o||o,i=e.callback,l="string"==typeof t&&3===t.length;return!(!ne({required:a,value:t})&&!l&&(ie({argument:n,message:"".concat(t," ").concat(r),callback:i}),1))}({argument:"currency",value:e.currency,message:"must be a valid currency format",callback:e.onEvent})&&oe({argument:"amount",value:e.amount,message:"must be valid non-negative number",callback:e.onEvent})&&ae({argument:"debug",value:e.debug,type:"boolean",message:"must be a boolean",required:!1,callback:e.onEvent})&&ae({argument:"buyerExternalIdentifier",value:e.buyerExternalIdentifier,type:"string",message:"must be a string",required:!1,callback:e.onEvent})&&ae({argument:"buyerId",value:e.buyerId,type:"string",message:"must be a string",required:!1,callback:e.onEvent})&&ae({argument:"environment",value:e.environment,type:"string",message:'must be "production" or "sandbox"',required:!1,callback:e.onEvent})&&function(e){var n=e.argument,t=e.value,r=e.message,o=e.required,a=void 0===o||o,i=e.callback,l=[!0,!1,"ask"].includes(t);return!(!ne({required:a,value:t})&&!l&&(ie({argument:n,message:"".concat(t," ").concat(r),callback:i}),1))}({argument:"store",value:e.store,message:'must be true, false or "ask"',required:!1})&&ae({argument:"country",value:e.country,type:"string",message:"must be a string ISO country code",required:!0,callback:e.onEvent})&&ae({argument:"display",value:e.display,type:"string",message:'must be "storedOnly", "addOnly", "supportsTokenization" or "all"',required:!1})&&ae({argument:"metadata",value:e.metadata,type:"object",message:"must be an object",required:!1})&&ae({argument:"cartItems",value:e.cartItems,type:"object",message:"must be an array",required:!1})&&ae({argument:"statementDescriptor",value:e.statementDescriptor,type:"object",message:"must be an object",required:!1})&&ae({argument:"secure",value:e.secure,type:"boolean",message:"must be a boolean",required:!1})&&oe({argument:"popupTimeout",value:e.popupTimeout,message:"must be valid non-negative number",required:!1})&&ae({argument:"shippingDetailsId",value:e.shippingDetailsId,required:!1,type:"string",message:"must be a valid uuid"})&&(!!(n={argument:"shippingDetailsId",condition:!e.shippingDetailsId||!(!e.buyerId&&!e.buyerExternalIdentifier),message:"must be used with a buyerId or buyerExternalId"}).condition||(ie({argument:n.argument,message:n.message}),!1))&&ae({argument:"hasBeforeTransaction",value:e.onBeforeTransaction,required:!1,type:"function",message:"must be a valid function that returns a promise"})&&ae({argument:"merchantAccountId",value:e.merchantAccountId,message:"must be a string",required:!1,type:"string"})&&ae({argument:"billingAddressFields",value:e.billingAddressFields,type:"object",message:"must be an object",required:!1})&&ae({argument:"antiFraudFingerprint",value:e.antiFraudFingerprint,message:"must be a string",required:!1,type:"string"});var n,t,r,o,a,i,l,s,c};function se(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function ce(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?se(Object(t),!0).forEach((function(n){ue(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):se(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function ue(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var de=["amount","currency","intent","apiHost","gr4vyId","token","debug","externalIdentifier","buyerId","buyerExternalIdentifier","environment","store","country","theme","locale","display","apiUrl","customOptions","metadata","paymentSource","cartItems","statementDescriptor","requireSecurityCode","shippingDetailsId","connectionOptions","fullPageReturnUrl","showDeleteButton","merchantAccountId","billingAddressFields","antiFraudFingerprint","enableAnimations","separatePaymentOptions"],pe=new Map,me=0;function ve(t){if(le(t)){var r=k(t),l=X(),s=r.element.dataset.embedId;h(r.element),pe.has(s)&&pe.get(s)(),me+=1,r.element.dataset.embedId=me.toString();var c=document.createElement("div");K(c,l,r.theme);var u=document.createElement("div");F(u,l),r.form?T(r.form,r.onComplete,l,r.onCustomSubmit):Y(r.onComplete,l,r.onCustomSubmit),U(i(),l,r.redirectMode,r.popupTimeout);var d=document.createElement("iframe");A(d,r.iframeSrc,l);var b=e()?n():0;b&&o(l,b),r.element.append(u,c,d);var g=setTimeout((function(){m("Loading Embed UI failed or took too long. Please check that the `gr4vyId` and `environment` values are correct.",t,{debug:!0})}),3e3),O={modeUpdated:l.mode$.next,approvalUrl:l.approvalUrl$.next,resize:function(e){var n;return l.frameHeight$.next(null==e||null===(n=e.frame)||void 0===n?void 0:n.height)},optionsLoaded:l.optionsLoaded$.next,transactionCreated:l.transactionCreated$.next,transactionFailed:l.transactionFailed$.next,transactionCancelled:l.transactionCancelled$.next,appleStartSession:l.appleStartSession$.next,appleCompleteMerchantValidation:l.appleCompleteMerchantValidation$.next,appleCompletePayment:l.appleCompletePayment$.next,appleAbortSession:l.appleAbortSession$.next,googlePaySessionStarted:l.googlePaySessionStarted$.next,googlePaySessionCompleted:l.googlePaySessionCompleted$.next,frameReady:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).version;return e&&w("embed-ui",e),clearTimeout(g),x({type:"updateOptions",data:ce(ce({},a(r,de)),{},{supportedApplePayVersion:b,supportedGooglePayVersion:1,hasBeforeTransaction:"function"==typeof(null==r?void 0:r.onBeforeTransaction)})})},paymentMethodSelected:l.selectedOption$.next,scrollTo:function(e){var n=e.top;window.scrollTo({top:d.offsetTop+n,left:0,behavior:"smooth"})},beforeTransactionPending:l.beforeTransactionPending$.next,formValidationFailed:l.formValidationFailed$.next},x=y(r.iframeUrl,r.channel,d.contentWindow,(function(e){return p("Page emits",e,{debug:r.debug})})),S=v(r.iframeUrl,r.channel,(function(e){var n;p("Page received",e,{debug:r.debug}),["formUpdate","transactionCreated","transactionFailed","apiError","paymentMethodSelected","transactionCancelled","optionsLoaded"].includes(e.type)&&(null===(n=r.onEvent)||void 0===n||n.call(r,e.type,e.data)),O[e.type]&&O[e.type](e.data)})),_=v(r.apiUrl,r.channel,(function(e){d.contentWindow.postMessage(e,r.iframeUrl)})),$=v(r.iframeUrl,r.channel,f(["approvalErrored","transactionUpdated","approvalCancelled"],(function(e){return d.contentWindow.postMessage(e,r.iframeUrl)})));return l.formSubmit$.subscribe((function(){return x({type:"submitForm"})})),l.beforeTransactionPending$.subscribe((function(){if(null!=r&&r.onBeforeTransaction)return r.onBeforeTransaction(a(r,["metadata"])).then((function(){x({type:"beforeTransactionDone",data:a(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},["externalIdentifier","shippingDetailsId","metadata","token"])})})).catch((function(){x({type:"beforeTransactionError"})}))})),l.approvalCancelled$.subscribe((function(){return x({type:"approvalCancelled"})})),l.applePayAuthorized$.subscribe((function(e){return x({type:"applePayAuthorized",data:e})})),l.appleValidateMerchant$.subscribe((function(e){return x({type:"appleValidateMerchant",data:e})})),l.appleCancelSession$.subscribe((function(){return x({type:"appleCancelSession"})})),l.appleSessionError$.subscribe((function(e){return x({type:"appleSessionError",data:e})})),l.appleCompleteSession$.subscribe((function(){return x({type:"appleCompleteSession"})})),window.addEventListener("message",S),window.addEventListener("message",_),window.addEventListener("message",$),w("embed"),pe.set(me.toString(),(function(){window.removeEventListener("message",S),window.removeEventListener("message",_),window.removeEventListener("message",$)})),{submit:function(){l.formSubmit$.next()}}}}})(),r})())); |
@@ -44,3 +44,3 @@ "use strict"; | ||
validation_1.validate.mockReturnValue(true); | ||
_1.setup({ | ||
(0, _1.setup)({ | ||
element: "#app", | ||
@@ -60,3 +60,3 @@ form: "#form", | ||
validation_1.validate.mockReturnValue(true); | ||
_1.setup({ | ||
(0, _1.setup)({ | ||
element: document.querySelector('#app'), | ||
@@ -88,3 +88,3 @@ form: document.querySelector('#form'), | ||
validation_1.validate.mockReturnValue(false); | ||
_1.setup(invalidConfig); | ||
(0, _1.setup)(invalidConfig); | ||
expect(validation_1.validate).toHaveBeenCalledWith(invalidConfig); | ||
@@ -96,3 +96,3 @@ expect(form_1.createFormController).not.toHaveBeenCalled(); | ||
validation_1.validate.mockReturnValue(true); | ||
var embed = _1.setup({ | ||
var embed = (0, _1.setup)({ | ||
element: "#app", | ||
@@ -99,0 +99,0 @@ form: "#form", |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -39,3 +39,3 @@ "use strict"; | ||
element.className = 'gr4vy__overlay gr4vy__overlay--hidden'; | ||
utils_1.removeChildren(Container); | ||
(0, utils_1.removeChildren)(Container); | ||
window.removeEventListener('beforeunload', beforeUnloadHandler); | ||
@@ -42,0 +42,0 @@ }; |
@@ -9,3 +9,3 @@ "use strict"; | ||
beforeEach(function () { | ||
subject = subjects_1.createSubjectManager(); | ||
subject = (0, subjects_1.createSubjectManager)(); | ||
}); | ||
@@ -23,3 +23,3 @@ test('it should show the overlay when a popup is opened', function () { | ||
}); | ||
overlay_1.createOverlayController(overlay, subject); | ||
(0, overlay_1.createOverlayController)(overlay, subject); | ||
subject.approvalStarted$.next(); | ||
@@ -32,3 +32,3 @@ jest.runAllTimers(); | ||
overlay.className = 'gr4vy__overlay'; | ||
overlay_1.createOverlayController(overlay, subject); | ||
(0, overlay_1.createOverlayController)(overlay, subject); | ||
subject.approvalCompleted$.next(); | ||
@@ -40,3 +40,3 @@ expect(overlay.className).toEqual('gr4vy__overlay gr4vy__overlay--hidden'); | ||
overlay.className = 'gr4vy__overlay'; | ||
overlay_1.createOverlayController(overlay, subject); | ||
(0, overlay_1.createOverlayController)(overlay, subject); | ||
subject.transactionFailed$.next(); | ||
@@ -48,3 +48,3 @@ expect(overlay.className).toEqual('gr4vy__overlay gr4vy__overlay--hidden'); | ||
overlay.className = 'gr4vy__overlay gr4vy__overlay--hidden'; | ||
overlay_1.createOverlayController(overlay, subject); | ||
(0, overlay_1.createOverlayController)(overlay, subject); | ||
subject.approvalUrl$.next('https://approval.gr4vy.com'); | ||
@@ -60,3 +60,3 @@ jest.runAllTimers(); | ||
overlay.className = 'gr4vy__overlay gr4vy__overlay--hidden'; | ||
overlay_1.createOverlayController(overlay, subject); | ||
(0, overlay_1.createOverlayController)(overlay, subject); | ||
subject.approvalUrl$.next('https://approval.gr4vy.com'); | ||
@@ -63,0 +63,0 @@ jest.runAllTimers(); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
import { SubjectManager } from 'subjects'; | ||
import { Config } from 'types'; | ||
export declare const createPopupController: (popup: import("../utils").MutableRef<{ | ||
export declare const createPopupController: (popup: import("utils").MutableRef<{ | ||
popup: Window; | ||
stopCallback: () => void; | ||
}>, subject: SubjectManager, redirectMode: Config['redirectMode'], timeout?: number) => void; |
@@ -10,3 +10,3 @@ "use strict"; | ||
var createPopupController = function (popup, subject, redirectMode, timeout) { | ||
if (popup === void 0) { popup = utils_1.mutableRef(); } | ||
if (popup === void 0) { popup = (0, utils_1.mutableRef)(); } | ||
subject.approvalStarted$.subscribe(function () { | ||
@@ -22,3 +22,3 @@ var _a, _b, _c, _d, _e; | ||
if ((mode === null || mode === void 0 ? void 0 : mode.popup) && redirectMode === 'fallback') { | ||
popup.current = redirect_popup_1.openPopup(redirect_popup_1.popupFeatures(((_d = mode.popup) === null || _d === void 0 ? void 0 : _d.width) || DEFAULT_POPUP_WIDTH, ((_e = mode.popup) === null || _e === void 0 ? void 0 : _e.height) || DEFAULT_POPUP_HEIGHT), redirect_document_1.redirectDocument(subject.mode$.value().popup), function () { return subject.approvalCancelled$.next(); }, timeout); | ||
popup.current = (0, redirect_popup_1.openPopup)((0, redirect_popup_1.popupFeatures)(((_d = mode.popup) === null || _d === void 0 ? void 0 : _d.width) || DEFAULT_POPUP_WIDTH, ((_e = mode.popup) === null || _e === void 0 ? void 0 : _e.height) || DEFAULT_POPUP_HEIGHT), (0, redirect_document_1.redirectDocument)(subject.mode$.value().popup), function () { return subject.approvalCancelled$.next(); }, timeout); | ||
} | ||
@@ -31,3 +31,3 @@ }); | ||
if (popup.current) { | ||
redirect_popup_1.redirectPopup(popup.current.popup, url); | ||
(0, redirect_popup_1.redirectPopup)(popup.current.popup, url); | ||
} | ||
@@ -34,0 +34,0 @@ else { |
@@ -11,3 +11,3 @@ "use strict"; | ||
describe('registerSubscriptions', function () { | ||
var popup = utils_1.mutableRef(); | ||
var popup = (0, utils_1.mutableRef)(); | ||
var subject; | ||
@@ -19,7 +19,7 @@ beforeEach(function () { | ||
redirect_popup_1.popupFeatures.mockReset(); | ||
subject = subjects_1.createSubjectManager(); | ||
subject = (0, subjects_1.createSubjectManager)(); | ||
// setup | ||
popup.current = null; | ||
popup_1.createPopupController(popup, subject, 'fallback'); | ||
redirect_popup_1.popupFeatures.mockImplementation(function (width, height) { return "width=" + width + ",height=" + height; }); | ||
(0, popup_1.createPopupController)(popup, subject, 'fallback'); | ||
redirect_popup_1.popupFeatures.mockImplementation(function (width, height) { return "width=".concat(width, ",height=").concat(height); }); | ||
}); | ||
@@ -26,0 +26,0 @@ test('opens a popup when a transaction requires approval', function () { |
@@ -1,2 +0,2 @@ | ||
export declare type RedirectPopup = { | ||
export type RedirectPopup = { | ||
open: (onCloseCallback?: CallableFunction) => void; | ||
@@ -3,0 +3,0 @@ close: () => void; |
@@ -8,3 +8,3 @@ "use strict"; | ||
var top = _window.innerHeight / 2 - height / 2 + _window.screenTop; | ||
return "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left; | ||
return "width=".concat(width, ",height=").concat(height, ",top=").concat(top, ",left=").concat(left); | ||
}; | ||
@@ -25,3 +25,3 @@ exports.popupFeatures = popupFeatures; | ||
popup.document.write(html); | ||
var stopCallback = exports.waitForValue(function () { return popup.closed; }, true, onClose); | ||
var stopCallback = (0, exports.waitForValue)(function () { return popup.closed; }, true, onClose); | ||
if (timeout) { | ||
@@ -28,0 +28,0 @@ setTimeout(function () { return popup.close(); }, timeout); |
@@ -13,3 +13,3 @@ "use strict"; | ||
}; | ||
expect(redirect_popup_1.popupFeatures(500, 589, mockWindow)).toEqual('width=500,height=589,top=145.5,left=270'); | ||
expect((0, redirect_popup_1.popupFeatures)(500, 589, mockWindow)).toEqual('width=500,height=589,top=145.5,left=270'); | ||
}); | ||
@@ -20,3 +20,3 @@ }); | ||
var onClose = jest.fn(); | ||
redirect_popup_1.waitForValue(function () { return true; }, true, onClose); | ||
(0, redirect_popup_1.waitForValue)(function () { return true; }, true, onClose); | ||
jest.runOnlyPendingTimers(); | ||
@@ -27,3 +27,3 @@ expect(onClose).toHaveBeenCalled(); | ||
var onClose = jest.fn(); | ||
var stop = redirect_popup_1.waitForValue(function () { return true; }, false, onClose); | ||
var stop = (0, redirect_popup_1.waitForValue)(function () { return true; }, false, onClose); | ||
jest.runOnlyPendingTimers(); | ||
@@ -43,3 +43,3 @@ stop(); | ||
var onClose = jest.fn(); | ||
var popup = redirect_popup_1.openPopup('width=10,height=10', '<html>', onClose); | ||
var popup = (0, redirect_popup_1.openPopup)('width=10,height=10', '<html>', onClose); | ||
expect(global.open).toHaveBeenCalledTimes(1); | ||
@@ -60,3 +60,3 @@ expect(mockPopup.document.write).toHaveBeenCalledWith('<html>'); | ||
var onClose = jest.fn(); | ||
redirect_popup_1.openPopup('width=10,height=10', '<html>', onClose); | ||
(0, redirect_popup_1.openPopup)('width=10,height=10', '<html>', onClose); | ||
jest.runOnlyPendingTimers(); | ||
@@ -78,3 +78,3 @@ expect(onClose).not.toHaveBeenCalled(); | ||
global.open = jest.fn().mockReturnValue(mockPopup); | ||
redirect_popup_1.openPopup('width=10,height=10', '<html>', jest.fn(), 300); | ||
(0, redirect_popup_1.openPopup)('width=10,height=10', '<html>', jest.fn(), 300); | ||
expect(mockPopup.close).not.toHaveBeenCalled(); | ||
@@ -94,3 +94,3 @@ jest.advanceTimersByTime(300); | ||
global.open = jest.fn().mockReturnValue(mockPopup); | ||
redirect_popup_1.openPopup('width=10,height=10', '<html>', jest.fn(), undefined); | ||
(0, redirect_popup_1.openPopup)('width=10,height=10', '<html>', jest.fn(), undefined); | ||
jest.advanceTimersByTime(300); | ||
@@ -107,3 +107,3 @@ expect(mockPopup.close).not.toHaveBeenCalled(); | ||
}; | ||
redirect_popup_1.redirectPopup(mockPopup, 'bar'); | ||
(0, redirect_popup_1.redirectPopup)(mockPopup, 'bar'); | ||
expect(mockPopup.location.href).toBe('bar'); | ||
@@ -110,0 +110,0 @@ }); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -17,3 +17,3 @@ "use strict"; | ||
if (theme) { | ||
theme_1.injectThemeVariables(theme_1.createTheme(theme), element); | ||
(0, theme_1.injectThemeVariables)((0, theme_1.createTheme)(theme), element); | ||
} | ||
@@ -20,0 +20,0 @@ element.innerHTML = html(templateObject_1 || (templateObject_1 = __makeTemplateObject(["<div class=\"gr4vy__container\">\n <div class=\"gr4vy__skeleton\">\n <div class=\"gr4vy__skeleton__radio\"></div>\n <div class=\"gr4vy__skeleton__block\"></div>\n </div>\n <div class=\"gr4vy__skeleton\">\n <div class=\"gr4vy__skeleton__radio\"></div>\n <div class=\"gr4vy__skeleton__block\"></div>\n </div>\n </div>"], ["<div class=\"gr4vy__container\">\n <div class=\"gr4vy__skeleton\">\n <div class=\"gr4vy__skeleton__radio\"></div>\n <div class=\"gr4vy__skeleton__block\"></div>\n </div>\n <div class=\"gr4vy__skeleton\">\n <div class=\"gr4vy__skeleton__radio\"></div>\n <div class=\"gr4vy__skeleton__block\"></div>\n </div>\n </div>"]))); |
@@ -11,4 +11,4 @@ "use strict"; | ||
}; | ||
var subject = subjects_1.createSubjectManager(); | ||
skeleton_1.createSkeletonController(mockElement, subject, undefined); | ||
var subject = (0, subjects_1.createSubjectManager)(); | ||
(0, skeleton_1.createSkeletonController)(mockElement, subject, undefined); | ||
subject.optionsLoaded$.next(true); | ||
@@ -15,0 +15,0 @@ jest.runAllTimers(); |
@@ -273,2 +273,2 @@ /// <reference types="applepayjs" /> | ||
}; | ||
export declare type SubjectManager = ReturnType<typeof createSubjectManager>; | ||
export type SubjectManager = ReturnType<typeof createSubjectManager>; |
@@ -7,31 +7,31 @@ "use strict"; | ||
var subjects = { | ||
mode$: create_subject_1.createSubject(), | ||
approvalUrl$: create_subject_1.createSubject(), | ||
approvalStarted$: create_subject_1.createSubject(), | ||
approvalCancelled$: create_subject_1.createSubject(), | ||
approvalLost$: create_subject_1.createSubject(), | ||
approvalCompleted$: create_subject_1.createSubject(), | ||
frameHeight$: create_subject_1.createSubject(0), | ||
optionsLoaded$: create_subject_1.createSubject(false), | ||
formSubmit$: create_subject_1.createSubject(), | ||
submit$: create_subject_1.createSubject(), | ||
transactionCreated$: create_subject_1.createSubject(), | ||
beforeTransactionPending$: create_subject_1.createSubject(), | ||
transactionFailed$: create_subject_1.createSubject(), | ||
transactionCancelled$: create_subject_1.createSubject(), | ||
appleStartSession$: create_subject_1.createSubject(), | ||
appleValidateMerchant$: create_subject_1.createSubject(), | ||
appleCompleteMerchantValidation$: create_subject_1.createSubject(), | ||
applePayAuthorized$: create_subject_1.createSubject(), | ||
appleCompletePayment$: create_subject_1.createSubject(), | ||
appleAbortSession$: create_subject_1.createSubject(), | ||
appleSessionError$: create_subject_1.createSubject(), | ||
appleCancelSession$: create_subject_1.createSubject(), | ||
appleCompleteSession$: create_subject_1.createSubject(), | ||
googlePaySessionStarted$: create_subject_1.createSubject(), | ||
googlePaySessionCompleted$: create_subject_1.createSubject(), | ||
selectedOption$: create_subject_1.createSubject(), | ||
showOverlay$: create_subject_1.createSubject(), | ||
hideOverlay$: create_subject_1.createSubject(), | ||
formValidationFailed$: create_subject_1.createSubject(), | ||
mode$: (0, create_subject_1.createSubject)(), | ||
approvalUrl$: (0, create_subject_1.createSubject)(), | ||
approvalStarted$: (0, create_subject_1.createSubject)(), | ||
approvalCancelled$: (0, create_subject_1.createSubject)(), | ||
approvalLost$: (0, create_subject_1.createSubject)(), | ||
approvalCompleted$: (0, create_subject_1.createSubject)(), | ||
frameHeight$: (0, create_subject_1.createSubject)(0), | ||
optionsLoaded$: (0, create_subject_1.createSubject)(false), | ||
formSubmit$: (0, create_subject_1.createSubject)(), | ||
submit$: (0, create_subject_1.createSubject)(), | ||
transactionCreated$: (0, create_subject_1.createSubject)(), | ||
beforeTransactionPending$: (0, create_subject_1.createSubject)(), | ||
transactionFailed$: (0, create_subject_1.createSubject)(), | ||
transactionCancelled$: (0, create_subject_1.createSubject)(), | ||
appleStartSession$: (0, create_subject_1.createSubject)(), | ||
appleValidateMerchant$: (0, create_subject_1.createSubject)(), | ||
appleCompleteMerchantValidation$: (0, create_subject_1.createSubject)(), | ||
applePayAuthorized$: (0, create_subject_1.createSubject)(), | ||
appleCompletePayment$: (0, create_subject_1.createSubject)(), | ||
appleAbortSession$: (0, create_subject_1.createSubject)(), | ||
appleSessionError$: (0, create_subject_1.createSubject)(), | ||
appleCancelSession$: (0, create_subject_1.createSubject)(), | ||
appleCompleteSession$: (0, create_subject_1.createSubject)(), | ||
googlePaySessionStarted$: (0, create_subject_1.createSubject)(), | ||
googlePaySessionCompleted$: (0, create_subject_1.createSubject)(), | ||
selectedOption$: (0, create_subject_1.createSubject)(), | ||
showOverlay$: (0, create_subject_1.createSubject)(), | ||
hideOverlay$: (0, create_subject_1.createSubject)(), | ||
formValidationFailed$: (0, create_subject_1.createSubject)(), | ||
}; | ||
@@ -38,0 +38,0 @@ subjects.formSubmit$.subscribe(function () { |
@@ -7,3 +7,3 @@ "use strict"; | ||
beforeEach(function () { | ||
subject = subjects_1.createSubjectManager(); | ||
subject = (0, subjects_1.createSubjectManager)(); | ||
subject.formSubmit$.subscribe(function () { | ||
@@ -10,0 +10,0 @@ if (subject.mode$.value()) { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -8,3 +8,3 @@ "use strict"; | ||
beforeEach(function () { | ||
subject = subjects_1.createSubjectManager(); | ||
subject = (0, subjects_1.createSubjectManager)(); | ||
jest.useFakeTimers(); | ||
@@ -17,3 +17,3 @@ }); | ||
it('should call formSubmit$', function (done) { | ||
submit_1.createSubmitController(null, subject, null); | ||
(0, submit_1.createSubmitController)(null, subject, null); | ||
subject.formSubmit$.subscribe(function () { | ||
@@ -31,3 +31,3 @@ done(); | ||
var onCustomSubmit = jest.fn(); | ||
submit_1.createSubmitController(null, subject, onCustomSubmit); | ||
(0, submit_1.createSubmitController)(null, subject, onCustomSubmit); | ||
subject.submit$.next(); | ||
@@ -41,3 +41,3 @@ jest.runAllTimers(); | ||
var onComplete = jest.fn(); | ||
submit_1.createSubmitController(onComplete, subject, null); | ||
(0, submit_1.createSubmitController)(onComplete, subject, null); | ||
subject.transactionCreated$.next({ id: '123', status: 'captured' }); | ||
@@ -44,0 +44,0 @@ jest.runAllTimers(); |
@@ -1,5 +0,5 @@ | ||
declare type DeepPartial<T> = { | ||
type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]; | ||
}; | ||
export declare type ThemeOptions = { | ||
export type ThemeOptions = { | ||
borderWidths: Record<string, string>; | ||
@@ -6,0 +6,0 @@ colors: Record<string, string>; |
@@ -6,7 +6,7 @@ "use strict"; | ||
test('creates an empty theme', function () { | ||
var result = create_theme_1.createTheme(); | ||
var result = (0, create_theme_1.createTheme)(); | ||
expect(result).toEqual({}); | ||
}); | ||
test('includes custom colors', function () { | ||
var result = create_theme_1.createTheme({ | ||
var result = (0, create_theme_1.createTheme)({ | ||
colors: { | ||
@@ -19,3 +19,3 @@ primary: 'foo', | ||
test('resolves radii values', function () { | ||
var result = create_theme_1.createTheme({ | ||
var result = (0, create_theme_1.createTheme)({ | ||
radii: { | ||
@@ -32,3 +32,3 @@ container: 'rounded', | ||
test('set custom border widths', function () { | ||
var result = create_theme_1.createTheme({ | ||
var result = (0, create_theme_1.createTheme)({ | ||
borderWidths: { | ||
@@ -35,0 +35,0 @@ input: 'thin', |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -9,4 +9,4 @@ "use strict"; | ||
vars.push([ | ||
"--gr4vy-" + parentKey + "-" + childKey, | ||
"" + theme[parentKey][childKey], | ||
"--gr4vy-".concat(parentKey, "-").concat(childKey), | ||
"".concat(theme[parentKey][childKey]), | ||
]); | ||
@@ -21,3 +21,3 @@ }); | ||
element.removeAttribute('style'); | ||
exports.themeToVars(theme).forEach(function (_a) { | ||
(0, exports.themeToVars)(theme).forEach(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
@@ -24,0 +24,0 @@ return element.style.setProperty(key, value); |
@@ -5,3 +5,3 @@ "use strict"; | ||
test('themeToVars flattens a theme to an array of css variable tuples', function () { | ||
var result = utils_1.themeToVars({ | ||
var result = (0, utils_1.themeToVars)({ | ||
foo: { | ||
@@ -8,0 +8,0 @@ bar: 'test', |
/// <reference types="applepayjs" /> | ||
export declare type Config = { | ||
export type Config = { | ||
element: HTMLElement; | ||
@@ -59,3 +59,3 @@ form?: Element; | ||
}; | ||
export declare type BillingAddressFields = { | ||
export type BillingAddressFields = { | ||
address?: { | ||
@@ -74,3 +74,3 @@ houseNumberOrName?: boolean; | ||
}; | ||
export declare type CustomOption = { | ||
export type CustomOption = { | ||
method: string; | ||
@@ -81,3 +81,3 @@ label: string; | ||
}; | ||
export declare type Transaction = { | ||
export type Transaction = { | ||
id: string; | ||
@@ -89,3 +89,3 @@ status: string; | ||
}; | ||
export declare type SetupConfig = Omit<Config, 'iframeHost' | 'apiHost' | 'apiUrl' | 'iframeUrl' | 'channel' | 'element' | 'form' | 'iframeSrc'> & { | ||
export type SetupConfig = Omit<Config, 'iframeHost' | 'apiHost' | 'apiUrl' | 'iframeUrl' | 'channel' | 'element' | 'form' | 'iframeSrc'> & { | ||
gr4vyId?: string; | ||
@@ -98,5 +98,5 @@ iframeHost?: string; | ||
}; | ||
declare type BorderWidth = 'none' | 'thin' | 'thick'; | ||
declare type Radii = 'none' | 'subtle' | 'rounded'; | ||
export declare type ThemeOptions = { | ||
type BorderWidth = 'none' | 'thin' | 'thick'; | ||
type Radii = 'none' | 'subtle' | 'rounded'; | ||
export type ThemeOptions = { | ||
fonts?: { | ||
@@ -183,3 +183,3 @@ /** | ||
}; | ||
export declare type Message = { | ||
export type Message = { | ||
channel: string; | ||
@@ -273,6 +273,6 @@ data?: unknown; | ||
}); | ||
export declare type EmbedInstance = { | ||
export type EmbedInstance = { | ||
submit: () => void; | ||
}; | ||
export declare type CartItem = { | ||
export type CartItem = { | ||
name: string; | ||
@@ -290,3 +290,3 @@ quantity: number; | ||
}; | ||
export declare type StatementDescriptor = { | ||
export type StatementDescriptor = { | ||
name?: string; | ||
@@ -293,0 +293,0 @@ description?: string; |
@@ -5,3 +5,3 @@ "use strict"; | ||
test('should return a new frame host', function () { | ||
var frameUrl = append_url_params_1.appendUrlParams('http://localhost:8000', { | ||
var frameUrl = (0, append_url_params_1.appendUrlParams)('http://localhost:8000', { | ||
paramA: 'valueA', | ||
@@ -13,3 +13,3 @@ paramB: 'valueB', | ||
test('should not include a param if undefined', function () { | ||
var frameUrl = append_url_params_1.appendUrlParams('http://localhost:8000', { | ||
var frameUrl = (0, append_url_params_1.appendUrlParams)('http://localhost:8000', { | ||
paramA: 'valueA', | ||
@@ -21,3 +21,3 @@ paramB: undefined, | ||
test('should encode a url param', function () { | ||
var frameUrl = append_url_params_1.appendUrlParams('http://localhost:8000', { | ||
var frameUrl = (0, append_url_params_1.appendUrlParams)('http://localhost:8000', { | ||
url: 'http://test.url', | ||
@@ -24,0 +24,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
declare type Message = { | ||
type Message = { | ||
channel: string; | ||
@@ -3,0 +3,0 @@ type: string; |
@@ -10,3 +10,3 @@ "use strict"; | ||
var message = { type: 'testMessage', data: { foo: 'bar' } }; | ||
var dispatch = create_dispatch_1.createDispatch('my-origin', '123', windowMock, callback); | ||
var dispatch = (0, create_dispatch_1.createDispatch)('my-origin', '123', windowMock, callback); | ||
dispatch(message); | ||
@@ -13,0 +13,0 @@ expect(callback).toHaveBeenCalledWith(message); |
@@ -1,2 +0,2 @@ | ||
declare type Message = { | ||
type Message = { | ||
channel: string; | ||
@@ -3,0 +3,0 @@ type: string; |
@@ -7,3 +7,3 @@ "use strict"; | ||
var message = { channel: '123', type: 'testMessage', data: { foo: 'bar' } }; | ||
var handler = create_message_handler_1.createMessageHandler('my-origin', '123', callback); | ||
var handler = (0, create_message_handler_1.createMessageHandler)('my-origin', '123', callback); | ||
handler({ | ||
@@ -23,3 +23,3 @@ origin: 'my-origin', | ||
var callback = jest.fn(); | ||
var filterMessage = create_message_handler_1.filterByType(['foo'], callback); | ||
var filterMessage = (0, create_message_handler_1.filterByType)(['foo'], callback); | ||
filterMessage({ type: 'bar' }); | ||
@@ -26,0 +26,0 @@ expect(callback).not.toHaveBeenCalled(); |
@@ -6,3 +6,3 @@ "use strict"; | ||
test('subscribing to events', function (done) { | ||
var test$ = create_subject_1.createSubject(); | ||
var test$ = (0, create_subject_1.createSubject)(); | ||
test$.subscribe(function (value) { | ||
@@ -15,3 +15,3 @@ expect(value).toBe(123); | ||
test('value should return the last value', function () { | ||
var test$ = create_subject_1.createSubject(); | ||
var test$ = (0, create_subject_1.createSubject)(); | ||
test$.next(123); | ||
@@ -21,3 +21,3 @@ expect(test$.value()).toBe(123); | ||
test('unsubscribing from subject', function () { | ||
var test$ = create_subject_1.createSubject(); | ||
var test$ = (0, create_subject_1.createSubject)(); | ||
var value = 321; | ||
@@ -24,0 +24,0 @@ test$ |
@@ -6,4 +6,4 @@ "use strict"; | ||
test("should create a random channel ID", function () { | ||
var channel1 = generate_channel_id_1.generateChannelId(); | ||
var channel2 = generate_channel_id_1.generateChannelId(); | ||
var channel1 = (0, generate_channel_id_1.generateChannelId)(); | ||
var channel2 = (0, generate_channel_id_1.generateChannelId)(); | ||
expect(channel1).not.toEqual(channel2); | ||
@@ -16,3 +16,3 @@ expect(channel1).toHaveLength(32); | ||
global.crypto = null; | ||
expect(generate_channel_id_1.generateChannelId()).toBeDefined(); | ||
expect((0, generate_channel_id_1.generateChannelId)()).toBeDefined(); | ||
global.crypto = crypto; | ||
@@ -19,0 +19,0 @@ }); |
@@ -7,3 +7,3 @@ "use strict"; | ||
// default to a https host | ||
var url = new URL("https://" + host); | ||
var url = new URL("https://".concat(host)); | ||
if (!secure) { | ||
@@ -10,0 +10,0 @@ url.protocol = "http"; |
@@ -5,9 +5,9 @@ "use strict"; | ||
test('prepends http', function () { | ||
expect(host_to_url_1.hostToUrl('localhost:123', false)).toEqual('http://localhost:123'); | ||
expect(host_to_url_1.hostToUrl('127.0.0.1:123', false)).toEqual('http://127.0.0.1:123'); | ||
expect((0, host_to_url_1.hostToUrl)('localhost:123', false)).toEqual('http://localhost:123'); | ||
expect((0, host_to_url_1.hostToUrl)('127.0.0.1:123', false)).toEqual('http://127.0.0.1:123'); | ||
}); | ||
test('prepends https', function () { | ||
expect(host_to_url_1.hostToUrl('host.test:123')).toEqual('https://host.test:123'); | ||
expect(host_to_url_1.hostToUrl('host.test:123', true)).toEqual('https://host.test:123'); | ||
expect((0, host_to_url_1.hostToUrl)('host.test:123')).toEqual('https://host.test:123'); | ||
expect((0, host_to_url_1.hostToUrl)('host.test:123', true)).toEqual('https://host.test:123'); | ||
}); | ||
//# sourceMappingURL=host-to-url.test.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -1,2 +0,2 @@ | ||
declare type Options = { | ||
type Options = { | ||
debug?: boolean; | ||
@@ -3,0 +3,0 @@ level?: 'log' | 'warn'; |
@@ -26,9 +26,9 @@ "use strict"; | ||
} | ||
console[level]("Gr4vy - " + key, object); | ||
console[level]("Gr4vy - ".concat(key), object); | ||
}; | ||
exports.log = log; | ||
var warn = function (key, object, options) { | ||
exports.log(key, object, __assign(__assign({}, options), { level: 'warn' })); | ||
(0, exports.log)(key, object, __assign(__assign({}, options), { level: 'warn' })); | ||
}; | ||
exports.warn = warn; | ||
//# sourceMappingURL=logger.js.map |
@@ -16,14 +16,14 @@ "use strict"; | ||
test('expect it to log to console.log when debug config is set', function () { | ||
logger_1.log(key, data, { debug: true }); | ||
expect(logSpy).toHaveBeenCalledWith("Gr4vy - " + key, data); | ||
(0, logger_1.log)(key, data, { debug: true }); | ||
expect(logSpy).toHaveBeenCalledWith("Gr4vy - ".concat(key), data); | ||
}); | ||
test('expect it to skip logging if the debug value is not set', function () { | ||
logger_1.log(key, data); | ||
(0, logger_1.log)(key, data); | ||
expect(logSpy).not.toHaveBeenCalled(); | ||
}); | ||
test('expect it to use a different level of logging when set', function () { | ||
logger_1.log(key, data, { debug: true, level: 'warn' }); | ||
expect(warnSpy).toHaveBeenCalledWith("Gr4vy - " + key, data); | ||
(0, logger_1.log)(key, data, { debug: true, level: 'warn' }); | ||
expect(warnSpy).toHaveBeenCalledWith("Gr4vy - ".concat(key), data); | ||
}); | ||
}); | ||
//# sourceMappingURL=logger.test.js.map |
@@ -1,4 +0,4 @@ | ||
export declare type MutableRef<T> = { | ||
export type MutableRef<T> = { | ||
current: T; | ||
}; | ||
export declare const mutableRef: <T>(defaultValue?: T) => MutableRef<T>; |
@@ -10,3 +10,3 @@ "use strict"; | ||
}; | ||
expect(pick_1.pick(options, ['foo'])).toEqual({ foo: 'bar' }); | ||
expect((0, pick_1.pick)(options, ['foo'])).toEqual({ foo: 'bar' }); | ||
}); | ||
@@ -20,3 +20,3 @@ test("should not include keys with nullish values", function () { | ||
}; | ||
expect(pick_1.pick(options, ['foo', 'bar', 'baz', 'bop'])).toEqual({ | ||
expect((0, pick_1.pick)(options, ['foo', 'bar', 'baz', 'bop'])).toEqual({ | ||
foo: 'bar', | ||
@@ -23,0 +23,0 @@ bop: 0, |
@@ -1,2 +0,2 @@ | ||
declare type Package = 'embed' | 'embed-ui'; | ||
type Package = 'embed' | 'embed-ui'; | ||
declare global { | ||
@@ -3,0 +3,0 @@ interface Window { |
@@ -17,8 +17,8 @@ "use strict"; | ||
var element = document.querySelector(value); | ||
if (exports.canSkipValidation({ required: required, value: value }) || element) { | ||
if ((0, exports.canSkipValidation)({ required: required, value: value }) || element) { | ||
return true; | ||
} | ||
exports.emitArgumentError({ | ||
(0, exports.emitArgumentError)({ | ||
argument: argument, | ||
message: value + " " + message, | ||
message: "".concat(value, " ").concat(message), | ||
callback: callback, | ||
@@ -32,3 +32,3 @@ }); | ||
var argument = _a.argument, value = _a.value, message = _a.message, _b = _a.required, required = _b === void 0 ? true : _b, callback = _a.callback; | ||
if (exports.canSkipValidation({ required: required, value: value })) { | ||
if ((0, exports.canSkipValidation)({ required: required, value: value })) { | ||
return true; | ||
@@ -38,3 +38,3 @@ } | ||
try { | ||
var url = new URL("http://" + value); | ||
var url = new URL("http://".concat(value)); | ||
valid = value === url.host; | ||
@@ -46,5 +46,5 @@ } | ||
if (!valid) { | ||
exports.emitArgumentError({ | ||
(0, exports.emitArgumentError)({ | ||
argument: argument, | ||
message: value + " " + message, | ||
message: "".concat(value, " ").concat(message), | ||
callback: callback, | ||
@@ -61,8 +61,8 @@ }); | ||
var valid = number >= 0 && number <= 99999999; | ||
if (exports.canSkipValidation({ required: required, value: value }) || valid) { | ||
if ((0, exports.canSkipValidation)({ required: required, value: value }) || valid) { | ||
return true; | ||
} | ||
exports.emitArgumentError({ | ||
(0, exports.emitArgumentError)({ | ||
argument: argument, | ||
message: value + " " + message, | ||
message: "".concat(value, " ").concat(message), | ||
callback: callback, | ||
@@ -77,8 +77,8 @@ }); | ||
var valid = typeof value === 'string' && value.length === 3; | ||
if (exports.canSkipValidation({ required: required, value: value }) || valid) { | ||
if ((0, exports.canSkipValidation)({ required: required, value: value }) || valid) { | ||
return true; | ||
} | ||
exports.emitArgumentError({ | ||
(0, exports.emitArgumentError)({ | ||
argument: argument, | ||
message: value + " " + message, | ||
message: "".concat(value, " ").concat(message), | ||
callback: callback, | ||
@@ -93,8 +93,8 @@ }); | ||
['authorize', 'capture', 'approve'].includes(value); | ||
if (exports.canSkipValidation({ required: required, value: value }) || valid) { | ||
if ((0, exports.canSkipValidation)({ required: required, value: value }) || valid) { | ||
return true; | ||
} | ||
exports.emitArgumentError({ | ||
(0, exports.emitArgumentError)({ | ||
argument: argument, | ||
message: value + " " + message, | ||
message: "".concat(value, " ").concat(message), | ||
callback: callback, | ||
@@ -108,8 +108,8 @@ }); | ||
var valid = [true, false, 'ask'].includes(value); | ||
if (exports.canSkipValidation({ required: required, value: value }) || valid) { | ||
if ((0, exports.canSkipValidation)({ required: required, value: value }) || valid) { | ||
return true; | ||
} | ||
exports.emitArgumentError({ | ||
(0, exports.emitArgumentError)({ | ||
argument: argument, | ||
message: value + " " + message, | ||
message: "".concat(value, " ").concat(message), | ||
callback: callback, | ||
@@ -124,8 +124,8 @@ }); | ||
var valid = typeof value === type; | ||
if (exports.canSkipValidation({ required: required, value: value }) || valid) { | ||
if ((0, exports.canSkipValidation)({ required: required, value: value }) || valid) { | ||
return true; | ||
} | ||
exports.emitArgumentError({ | ||
(0, exports.emitArgumentError)({ | ||
argument: argument, | ||
message: value + " " + message, | ||
message: "".concat(value, " ").concat(message), | ||
callback: callback, | ||
@@ -141,3 +141,3 @@ }); | ||
} | ||
exports.emitArgumentError({ | ||
(0, exports.emitArgumentError)({ | ||
argument: argument, | ||
@@ -163,3 +163,3 @@ message: message, | ||
var validate = function (options) { | ||
return exports.validateHTMLElement({ | ||
return (0, exports.validateHTMLElement)({ | ||
argument: 'element', | ||
@@ -170,3 +170,3 @@ value: options.element, | ||
}) && | ||
exports.validateHTMLElement({ | ||
(0, exports.validateHTMLElement)({ | ||
argument: 'form', | ||
@@ -178,3 +178,3 @@ value: options.form, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'gr4vyId', | ||
@@ -187,3 +187,3 @@ value: options.gr4vyId, | ||
}) && | ||
exports.validateHost({ | ||
(0, exports.validateHost)({ | ||
argument: 'iframeHost', | ||
@@ -195,3 +195,3 @@ value: options.iframeHost, | ||
}) && | ||
exports.validateHost({ | ||
(0, exports.validateHost)({ | ||
argument: 'apiHost', | ||
@@ -203,3 +203,3 @@ value: options.apiHost, | ||
}) && | ||
exports.validateIntent({ | ||
(0, exports.validateIntent)({ | ||
argument: 'intent', | ||
@@ -211,3 +211,3 @@ value: options.intent, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'onEvent', | ||
@@ -220,3 +220,3 @@ value: options.onEvent, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'token', | ||
@@ -228,3 +228,3 @@ value: options.token, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'externalIdentifier', | ||
@@ -237,3 +237,3 @@ value: options.externalIdentifier, | ||
}) && | ||
exports.validateCurrency({ | ||
(0, exports.validateCurrency)({ | ||
argument: 'currency', | ||
@@ -244,3 +244,3 @@ value: options.currency, | ||
}) && | ||
exports.validateNumber({ | ||
(0, exports.validateNumber)({ | ||
argument: 'amount', | ||
@@ -251,3 +251,3 @@ value: options.amount, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'debug', | ||
@@ -260,3 +260,3 @@ value: options.debug, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'buyerExternalIdentifier', | ||
@@ -269,3 +269,3 @@ value: options.buyerExternalIdentifier, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'buyerId', | ||
@@ -278,3 +278,3 @@ value: options.buyerId, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'environment', | ||
@@ -287,3 +287,3 @@ value: options.environment, | ||
}) && | ||
exports.validateStore({ | ||
(0, exports.validateStore)({ | ||
argument: 'store', | ||
@@ -294,3 +294,3 @@ value: options.store, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'country', | ||
@@ -303,3 +303,3 @@ value: options.country, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'display', | ||
@@ -311,3 +311,3 @@ value: options.display, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'metadata', | ||
@@ -319,3 +319,3 @@ value: options.metadata, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'cartItems', | ||
@@ -327,3 +327,3 @@ value: options.cartItems, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'statementDescriptor', | ||
@@ -335,3 +335,3 @@ value: options.statementDescriptor, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'secure', | ||
@@ -343,3 +343,3 @@ value: options.secure, | ||
}) && | ||
exports.validateNumber({ | ||
(0, exports.validateNumber)({ | ||
argument: 'popupTimeout', | ||
@@ -350,3 +350,3 @@ value: options.popupTimeout, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'shippingDetailsId', | ||
@@ -358,3 +358,3 @@ value: options.shippingDetailsId, | ||
}) && | ||
exports.validateCondition({ | ||
(0, exports.validateCondition)({ | ||
argument: 'shippingDetailsId', | ||
@@ -366,3 +366,3 @@ condition: options.shippingDetailsId | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'hasBeforeTransaction', | ||
@@ -374,3 +374,3 @@ value: options.onBeforeTransaction, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'merchantAccountId', | ||
@@ -382,3 +382,3 @@ value: options.merchantAccountId, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'billingAddressFields', | ||
@@ -390,3 +390,3 @@ value: options.billingAddressFields, | ||
}) && | ||
exports.validateType({ | ||
(0, exports.validateType)({ | ||
argument: 'antiFraudFingerprint', | ||
@@ -393,0 +393,0 @@ value: options.antiFraudFingerprint, |
@@ -27,3 +27,3 @@ "use strict"; | ||
}); | ||
var valid = validation_1.validate({ | ||
var valid = (0, validation_1.validate)({ | ||
element: "#app", | ||
@@ -54,6 +54,6 @@ form: null, | ||
}; | ||
expect(validation_1.validate(options)).toBeTruthy(); | ||
expect(validation_1.validate(__assign(__assign({}, options), { shippingDetailsId: '123' }))).toBeFalsy(); | ||
expect(validation_1.validate(__assign(__assign({}, options), { shippingDetailsId: '123', buyerExternalIdentifier: '123' }))).toBeTruthy(); | ||
expect(validation_1.validate(__assign(__assign({}, options), { shippingDetailsId: '123', buyerId: '123' }))).toBeTruthy(); | ||
expect((0, validation_1.validate)(options)).toBeTruthy(); | ||
expect((0, validation_1.validate)(__assign(__assign({}, options), { shippingDetailsId: '123' }))).toBeFalsy(); | ||
expect((0, validation_1.validate)(__assign(__assign({}, options), { shippingDetailsId: '123', buyerExternalIdentifier: '123' }))).toBeTruthy(); | ||
expect((0, validation_1.validate)(__assign(__assign({}, options), { shippingDetailsId: '123', buyerId: '123' }))).toBeTruthy(); | ||
}); | ||
@@ -76,4 +76,4 @@ }); | ||
}; | ||
expect(validation_1.validate(options)).toBeTruthy(); | ||
expect(validation_1.validate(__assign(__assign({}, options), { onBeforeTransaction: true }))).toBeFalsy(); | ||
expect((0, validation_1.validate)(options)).toBeTruthy(); | ||
expect((0, validation_1.validate)(__assign(__assign({}, options), { onBeforeTransaction: true }))).toBeFalsy(); | ||
}); | ||
@@ -92,3 +92,3 @@ describe('emitArgumentError', function () { | ||
}; | ||
validation_1.emitArgumentError(options); | ||
(0, validation_1.emitArgumentError)(options); | ||
expect(options.callback).toHaveBeenCalledWith('argumentError', error); | ||
@@ -107,3 +107,3 @@ expect(errorSpy).toHaveBeenCalledWith('Gr4vy - Error', error); | ||
}; | ||
validation_1.emitArgumentError(options); | ||
(0, validation_1.emitArgumentError)(options); | ||
expect(errorSpy).toHaveBeenCalledWith('Gr4vy - Error', error); | ||
@@ -114,10 +114,10 @@ }); | ||
test('should return true if the value is not required and unset', function () { | ||
expect(validation_1.canSkipValidation({ required: false, value: null })).toEqual(true); | ||
expect(validation_1.canSkipValidation({ required: false, value: undefined })).toEqual(true); | ||
expect((0, validation_1.canSkipValidation)({ required: false, value: null })).toEqual(true); | ||
expect((0, validation_1.canSkipValidation)({ required: false, value: undefined })).toEqual(true); | ||
}); | ||
test('should return false if the value is not required and set', function () { | ||
expect(validation_1.canSkipValidation({ required: false, value: '' })).toEqual(false); | ||
expect((0, validation_1.canSkipValidation)({ required: false, value: '' })).toEqual(false); | ||
}); | ||
test('should return false if the value is not not required', function () { | ||
expect(validation_1.canSkipValidation({ required: true, value: '' })).toEqual(false); | ||
expect((0, validation_1.canSkipValidation)({ required: true, value: '' })).toEqual(false); | ||
}); | ||
@@ -137,3 +137,3 @@ }); | ||
var options = __assign(__assign({}, defaultOptions), { value: null, required: false, callback: jest.fn() }); | ||
var valid = validation_1.validateHTMLElement(options); | ||
var valid = (0, validation_1.validateHTMLElement)(options); | ||
expect(valid).toEqual(true); | ||
@@ -144,3 +144,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
var options = __assign(__assign({}, defaultOptions), { value: document.createElement('div'), callback: jest.fn() }); | ||
var valid = validation_1.validateHTMLElement(options); | ||
var valid = (0, validation_1.validateHTMLElement)(options); | ||
expect(valid).toEqual(true); | ||
@@ -154,3 +154,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
var options = __assign(__assign({}, defaultOptions), { value: '#app', callback: jest.fn() }); | ||
var valid = validation_1.validateHTMLElement(options); | ||
var valid = (0, validation_1.validateHTMLElement)(options); | ||
expect(valid).toEqual(true); | ||
@@ -164,3 +164,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
var options = __assign(__assign({}, defaultOptions), { value: '#app', callback: jest.fn() }); | ||
var valid = validation_1.validateHTMLElement(options); | ||
var valid = (0, validation_1.validateHTMLElement)(options); | ||
expect(valid).toEqual(false); | ||
@@ -183,3 +183,3 @@ expect(options.callback).toHaveBeenCalledWith('argumentError', argumentError); | ||
var options = __assign(__assign({}, defaultOptions), { value: null, required: false, callback: jest.fn() }); | ||
var valid = validation_1.validateHost(options); | ||
var valid = (0, validation_1.validateHost)(options); | ||
expect(valid).toEqual(true); | ||
@@ -190,3 +190,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
var options = __assign(__assign({}, defaultOptions), { value: 'localhost:8888', callback: jest.fn() }); | ||
var valid = validation_1.validateHost(options); | ||
var valid = (0, validation_1.validateHost)(options); | ||
expect(valid).toEqual(true); | ||
@@ -197,3 +197,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
var options = __assign(__assign({}, defaultOptions), { value: 'example.com', callback: jest.fn() }); | ||
var valid = validation_1.validateHost(options); | ||
var valid = (0, validation_1.validateHost)(options); | ||
expect(valid).toEqual(true); | ||
@@ -203,3 +203,3 @@ }); | ||
var options = __assign(__assign({}, defaultOptions), { value: 'example/8888', callback: jest.fn() }); | ||
var valid = validation_1.validateHost(options); | ||
var valid = (0, validation_1.validateHost)(options); | ||
expect(valid).toEqual(false); | ||
@@ -211,3 +211,3 @@ expect(options.callback).toHaveBeenCalledWith('argumentError', argumentError); | ||
var options = __assign(__assign({}, defaultOptions), { value: '///////', callback: jest.fn() }); | ||
var valid = validation_1.validateHost(options); | ||
var valid = (0, validation_1.validateHost)(options); | ||
expect(valid).toEqual(false); | ||
@@ -223,3 +223,3 @@ }); | ||
var options = __assign(__assign({}, defaultOptions), { value: null, required: false, callback: jest.fn() }); | ||
var valid = validation_1.validateNumber(options); | ||
var valid = (0, validation_1.validateNumber)(options); | ||
expect(valid).toEqual(true); | ||
@@ -230,3 +230,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
var options = __assign(__assign({}, defaultOptions), { value: 200, callback: jest.fn() }); | ||
var valid = validation_1.validateNumber(options); | ||
var valid = (0, validation_1.validateNumber)(options); | ||
expect(valid).toEqual(true); | ||
@@ -242,3 +242,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
}; | ||
var valid = validation_1.validateNumber(options); | ||
var valid = (0, validation_1.validateNumber)(options); | ||
expect(valid).toEqual(false); | ||
@@ -250,9 +250,9 @@ expect(options.callback).toHaveBeenCalledWith('argumentError', error); | ||
var options = __assign(__assign({}, defaultOptions), { value: -1, callback: jest.fn() }); | ||
var valid = validation_1.validateNumber(options); | ||
var valid = (0, validation_1.validateNumber)(options); | ||
expect(valid).toEqual(false); | ||
}); | ||
test('should return false if the number is too large', function () { | ||
var maxResult = validation_1.validateNumber(__assign(__assign({}, defaultOptions), { value: 99999999, callback: jest.fn() })); | ||
var maxResult = (0, validation_1.validateNumber)(__assign(__assign({}, defaultOptions), { value: 99999999, callback: jest.fn() })); | ||
expect(maxResult).toEqual(true); | ||
var aboveMaxResult = validation_1.validateNumber(__assign(__assign({}, defaultOptions), { value: 100000000, callback: jest.fn() })); | ||
var aboveMaxResult = (0, validation_1.validateNumber)(__assign(__assign({}, defaultOptions), { value: 100000000, callback: jest.fn() })); | ||
expect(aboveMaxResult).toEqual(false); | ||
@@ -262,3 +262,3 @@ }); | ||
var options = __assign(__assign({}, defaultOptions), { value: '0.1', callback: jest.fn() }); | ||
var valid = validation_1.validateNumber(options); | ||
var valid = (0, validation_1.validateNumber)(options); | ||
expect(valid).toEqual(true); | ||
@@ -274,3 +274,3 @@ }); | ||
var options = __assign(__assign({}, defaultOptions), { value: null, required: false, callback: jest.fn() }); | ||
var valid = validation_1.validateCurrency(options); | ||
var valid = (0, validation_1.validateCurrency)(options); | ||
expect(valid).toEqual(true); | ||
@@ -281,3 +281,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
var options = __assign(__assign({}, defaultOptions), { value: 'USD', callback: jest.fn() }); | ||
var valid = validation_1.validateCurrency(options); | ||
var valid = (0, validation_1.validateCurrency)(options); | ||
expect(valid).toEqual(true); | ||
@@ -293,3 +293,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
}; | ||
var valid = validation_1.validateCurrency(options); | ||
var valid = (0, validation_1.validateCurrency)(options); | ||
expect(valid).toEqual(false); | ||
@@ -301,3 +301,3 @@ expect(options.callback).toHaveBeenCalledWith('argumentError', error); | ||
var options = __assign(__assign({}, defaultOptions), { value: 'ABCD', callback: jest.fn() }); | ||
var valid = validation_1.validateNumber(options); | ||
var valid = (0, validation_1.validateNumber)(options); | ||
expect(valid).toEqual(false); | ||
@@ -314,3 +314,3 @@ }); | ||
var options = __assign(__assign({}, defaultOptions), { value: null, required: false, callback: jest.fn() }); | ||
var valid = validation_1.validateType(options); | ||
var valid = (0, validation_1.validateType)(options); | ||
expect(valid).toEqual(true); | ||
@@ -321,3 +321,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
var options = __assign(__assign({}, defaultOptions), { value: true, callback: jest.fn() }); | ||
var valid = validation_1.validateType(options); | ||
var valid = (0, validation_1.validateType)(options); | ||
expect(valid).toEqual(true); | ||
@@ -333,3 +333,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
}; | ||
var valid = validation_1.validateType(options); | ||
var valid = (0, validation_1.validateType)(options); | ||
expect(valid).toEqual(false); | ||
@@ -347,3 +347,3 @@ expect(options.callback).toHaveBeenCalledWith('argumentError', error); | ||
var options = __assign(__assign({}, defaultOptions), { value: null, required: false, callback: jest.fn() }); | ||
var valid = validation_1.validateIntent(options); | ||
var valid = (0, validation_1.validateIntent)(options); | ||
expect(valid).toEqual(true); | ||
@@ -356,3 +356,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
var options = __assign(__assign({}, defaultOptions), { value: value, callback: jest.fn() }); | ||
var valid = validation_1.validateIntent(__assign(__assign({}, defaultOptions), { value: 'authorize', callback: jest.fn() })); | ||
var valid = (0, validation_1.validateIntent)(__assign(__assign({}, defaultOptions), { value: 'authorize', callback: jest.fn() })); | ||
expect(valid).toEqual(true); | ||
@@ -369,3 +369,3 @@ expect(options.callback).not.toHaveBeenCalled(); | ||
}; | ||
var valid = validation_1.validateIntent(options); | ||
var valid = (0, validation_1.validateIntent)(options); | ||
expect(valid).toEqual(false); | ||
@@ -389,3 +389,3 @@ expect(options.callback).toHaveBeenCalledWith('argumentError', error); | ||
}; | ||
var valid = validation_1.validateStore(options); | ||
var valid = (0, validation_1.validateStore)(options); | ||
expect(valid).toEqual(false); | ||
@@ -408,3 +408,3 @@ expect(options.callback).toHaveBeenCalledWith('argumentError', error); | ||
}; | ||
var valid = validation_1.validateCondition(options); | ||
var valid = (0, validation_1.validateCondition)(options); | ||
expect(valid).toEqual(false); | ||
@@ -411,0 +411,0 @@ expect(errorSpy).toHaveBeenCalledWith('Gr4vy - Error', error); |
{ | ||
"name": "@gr4vy/embed", | ||
"version": "2.24.5", | ||
"version": "2.24.6", | ||
"description": "Embed a credit card form in your web app and store the card details, authorize the card, and capture a transaction.", | ||
@@ -37,3 +37,3 @@ "main": "lib/index", | ||
}, | ||
"gitHead": "8b5a473ea2aa414f4e64e6aeb9dc7e7c6920714f" | ||
"gitHead": "bd1a87bc4bac4de649e0a9deb8be5ecec7cb3fb5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
346650
3738