@dintero/checkout-web-sdk 0.0.17 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/.github/dependabot.yml +10 -0
  2. package/.github/workflows/{blank.yml → build.yml} +6 -5
  3. package/.github/workflows/release.yml +34 -0
  4. package/.releaserc.json +11 -0
  5. package/README.md +52 -15
  6. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/base.css +0 -0
  7. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/block-navigation.js +0 -0
  8. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/checkout.ts.html +50 -5
  9. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/createIframeAsync.ts.html +15 -15
  10. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/favicon.png +0 -0
  11. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/index.html +40 -40
  12. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/index.ts.html +144 -30
  13. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/prettify.css +0 -0
  14. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/prettify.js +0 -0
  15. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/sort-arrow-sprite.png +0 -0
  16. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/sorter.js +0 -0
  17. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/subscribe.ts.html +55 -25
  18. package/coverage/{Chrome Headless 80.0.3987.0 (Mac OS 10.15.7) → Chrome Headless 80.0.3987.0 (Linux x86_64)}/html/url.ts.html +18 -12
  19. package/dist/declarations/package.d.ts +3 -0
  20. package/dist/declarations/src/checkout.d.ts +13 -2
  21. package/dist/declarations/src/index.d.ts +3 -1
  22. package/dist/declarations/src/subscribe.d.ts +5 -1
  23. package/dist/declarations/src/url.d.ts +1 -0
  24. package/dist/dintero-checkout-web-sdk.cjs.dev.js +50 -11
  25. package/dist/dintero-checkout-web-sdk.cjs.prod.js +50 -11
  26. package/dist/dintero-checkout-web-sdk.esm.js +50 -11
  27. package/dist/dintero-checkout-web-sdk.umd.min.js +1 -1
  28. package/dist/dintero-checkout-web-sdk.umd.min.js.map +1 -1
  29. package/package.json +49 -46
  30. package/coverage/Chrome Headless 80.0.3987.0 (Mac OS 10.15.7)/html/checkout-web-sdk.ts.html +0 -938
  31. package/coverage/Chrome Headless 80.0.3987.0 (Mac OS 10.15.7)/html/dintero-checkout-web-sdk.ts.html +0 -908
@@ -13,6 +13,7 @@ declare const _exports: {
13
13
  scripts: {
14
14
  build: string;
15
15
  test: string;
16
+ "semantic-release": string;
16
17
  };
17
18
  private: boolean;
18
19
  repository: {
@@ -29,6 +30,7 @@ declare const _exports: {
29
30
  "@babel/preset-env": string;
30
31
  "@babel/preset-typescript": string;
31
32
  "@preconstruct/cli": string;
33
+ "@semantic-release/git": string;
32
34
  chai: string;
33
35
  karma: string;
34
36
  "karma-chai": string;
@@ -39,6 +41,7 @@ declare const _exports: {
39
41
  prettier: string;
40
42
  puppeteer: string;
41
43
  rollup: string;
44
+ "semantic-release": string;
42
45
  sinon: string;
43
46
  typescript: string;
44
47
  };
@@ -9,7 +9,8 @@ export declare enum CheckoutEvents {
9
9
  SessionPaymentError = "SessionPaymentError",
10
10
  SessionLocked = "SessionLocked",
11
11
  SessionLockFailed = "SessionLockFailed",
12
- ActivePaymentProductType = "ActivePaymentProductType"
12
+ ActivePaymentProductType = "ActivePaymentProductType",
13
+ ValidateSession = "ValidateSession"
13
14
  }
14
15
  export declare enum InternalCheckoutEvents {
15
16
  HeightChanged = "HeightChanged",
@@ -53,10 +54,20 @@ export declare type ActivePaymentProductType = {
53
54
  type: CheckoutEvents.ActivePaymentProductType;
54
55
  payment_product_type: string | undefined;
55
56
  };
57
+ export declare type ValidateSession = {
58
+ type: CheckoutEvents.ValidateSession;
59
+ session: Session;
60
+ callback: (result: SessionValidationCallback) => void;
61
+ };
62
+ export interface SessionValidationCallback {
63
+ success: boolean;
64
+ clientValidationError?: string;
65
+ }
66
+ export declare type WrappedValidateSession = Pick<ValidateSession, "type" | "session">;
56
67
  export declare type SessionPayment = SessionPaymentAuthorized | SessionPaymentOnHold;
57
68
  export declare type SessionPaymentError = {
58
69
  type: CheckoutEvents.SessionPaymentError;
59
70
  error: string;
60
71
  href: string;
61
72
  };
62
- export declare type SessionEvent = SessionNotFound | SessionLoaded | SessionUpdated | SessionCancel | SessionPaymentOnHold | SessionPaymentAuthorized | SessionPaymentError | SessionLocked | SessionLockFailed | ActivePaymentProductType;
73
+ export declare type SessionEvent = SessionNotFound | SessionLoaded | SessionUpdated | SessionCancel | SessionPaymentOnHold | SessionPaymentAuthorized | SessionPaymentError | SessionLocked | SessionLockFailed | ActivePaymentProductType | WrappedValidateSession;
@@ -1,5 +1,5 @@
1
1
  import "native-promise-only";
2
- import { SessionNotFound, SessionLoaded, SessionUpdated, SessionCancel, SessionPaymentOnHold, SessionPaymentAuthorized, SessionPaymentError, SessionLocked, SessionLockFailed, ActivePaymentProductType } from "./checkout";
2
+ import { SessionNotFound, SessionLoaded, SessionUpdated, SessionCancel, SessionPaymentOnHold, SessionPaymentAuthorized, SessionPaymentError, SessionLocked, SessionLockFailed, ActivePaymentProductType, ValidateSession, SessionValidationCallback } from "./checkout";
3
3
  export interface DinteroCheckoutInstance {
4
4
  /**
5
5
  * Remove iframe and all event listeners.
@@ -10,6 +10,7 @@ export interface DinteroCheckoutInstance {
10
10
  lockSession: () => void;
11
11
  refreshSession: () => void;
12
12
  setActivePaymentProductType: (paymentProductType: string) => void;
13
+ submitValidationResult: (result: SessionValidationCallback) => void;
13
14
  }
14
15
  export interface DinteroCheckoutOptions {
15
16
  sid: string;
@@ -30,6 +31,7 @@ export interface DinteroEmbedCheckoutOptions extends DinteroCheckoutOptions {
30
31
  onSessionLocked?: (event: SessionLocked, checkout: DinteroCheckoutInstance) => void;
31
32
  onSessionLockFailed?: (event: SessionLockFailed, checkout: DinteroCheckoutInstance) => void;
32
33
  onActivePaymentType?: (event: ActivePaymentProductType, checkout: DinteroCheckoutInstance) => void;
34
+ onValidateSession?: (event: ValidateSession, checkout: DinteroCheckoutInstance, callback: (result: SessionValidationCallback) => void) => void;
33
35
  }
34
36
  /**
35
37
  * Show a dintero payment session in an embedded iframe.
@@ -1,4 +1,4 @@
1
- import { CheckoutEvents, InternalCheckoutEvents, SessionEvent } from "./checkout";
1
+ import { CheckoutEvents, InternalCheckoutEvents, SessionEvent, SessionValidationCallback } from "./checkout";
2
2
  import { DinteroCheckoutInstance } from ".";
3
3
  /**
4
4
  * Unsubscribe handler from event(s).
@@ -21,6 +21,10 @@ export declare type Subscription = {
21
21
  * Post a SessionLock-event to the checkout iframe.
22
22
  */
23
23
  export declare const postSessionLock: (iframe: HTMLIFrameElement, sid: string) => void;
24
+ /**
25
+ * Post the validation result to the checkout iframe
26
+ */
27
+ export declare const postValidationResult: (iframe: HTMLIFrameElement, sid: string, result: SessionValidationCallback) => void;
24
28
  /**
25
29
  * Post RefreshSession-event to the checkout iframe.
26
30
  */
@@ -11,5 +11,6 @@ export interface SessionUrlOptions {
11
11
  endpoint: string;
12
12
  language: string | undefined;
13
13
  ui?: "fullscreen" | "inline";
14
+ shouldCallValidateSession: boolean;
14
15
  }
15
16
  export declare const getSessionUrl: (options: SessionUrlOptions) => string;
@@ -6,7 +6,7 @@ require('native-promise-only');
6
6
 
7
7
  var pkg = {
8
8
  name: "@dintero/checkout-web-sdk",
9
- version: "0.0.17",
9
+ version: "0.0.0-development",
10
10
  description: "Dintero Checkout SDK for web frontends",
11
11
  main: "dist/dintero-checkout-web-sdk.cjs.js",
12
12
  module: "dist/dintero-checkout-web-sdk.esm.js",
@@ -18,12 +18,13 @@ var pkg = {
18
18
  },
19
19
  scripts: {
20
20
  build: "preconstruct build",
21
- test: "karma start"
21
+ test: "karma start",
22
+ "semantic-release": "semantic-release"
22
23
  },
23
24
  "private": false,
24
25
  repository: {
25
26
  type: "git",
26
- url: "git+https://github.com/Dintero/Dintero.Checkout.Web.SDK.git"
27
+ url: "https://github.com/Dintero/Dintero.Checkout.Web.SDK.git"
27
28
  },
28
29
  homepage: "https://github.com/Dintero/Dintero.Checkout.Web.SDK#readme",
29
30
  author: "Sven Nicolai Viig <sven@dintero.com> (http://dintero.com)",
@@ -35,8 +36,9 @@ var pkg = {
35
36
  "@babel/preset-env": "^7.14.1",
36
37
  "@babel/preset-typescript": "^7.13.0",
37
38
  "@preconstruct/cli": "^2.1.0",
39
+ "@semantic-release/git": "^10.0.1",
38
40
  chai: "^4.2.0",
39
- karma: "^5.1.1",
41
+ karma: "^6.3.14",
40
42
  "karma-chai": "^0.1.0",
41
43
  "karma-chrome-launcher": "^3.1.0",
42
44
  "karma-mocha": "^2.0.1",
@@ -45,6 +47,7 @@ var pkg = {
45
47
  prettier: "^1.19.1",
46
48
  puppeteer: "^2.1.0",
47
49
  rollup: "^1.30.1",
50
+ "semantic-release": "^19.0.2",
48
51
  sinon: "^8.1.1",
49
52
  typescript: "^4.2.4"
50
53
  },
@@ -66,6 +69,7 @@ let CheckoutEvents;
66
69
  CheckoutEvents["SessionLocked"] = "SessionLocked";
67
70
  CheckoutEvents["SessionLockFailed"] = "SessionLockFailed";
68
71
  CheckoutEvents["ActivePaymentProductType"] = "ActivePaymentProductType";
72
+ CheckoutEvents["ValidateSession"] = "ValidateSession";
69
73
  })(CheckoutEvents || (CheckoutEvents = {}));
70
74
 
71
75
  let InternalCheckoutEvents;
@@ -92,7 +96,8 @@ const getSessionUrl = options => {
92
96
  sid,
93
97
  endpoint,
94
98
  language,
95
- ui
99
+ ui,
100
+ shouldCallValidateSession
96
101
  } = options;
97
102
 
98
103
  if (!endpoint) {
@@ -103,7 +108,8 @@ const getSessionUrl = options => {
103
108
  let languageParam = language ? `language=${language}` : "";
104
109
  let uiParam = ui ? `ui=${ui}` : "";
105
110
  let sdk = `sdk=${pkg.version}`;
106
- const params = [languageParam, uiParam, sdk].filter(x => x).join("&");
111
+ let validate = shouldCallValidateSession ? `client_side_validation=true` : undefined;
112
+ const params = [languageParam, uiParam, sdk, validate].filter(x => x).join("&");
107
113
  return `${endpoint}/v1/view/${sid}${params ? "?" + params : ""}`;
108
114
  };
109
115
 
@@ -182,6 +188,19 @@ const postSessionLock = (iframe, sid) => {
182
188
  }, "*");
183
189
  }
184
190
  };
191
+ /**
192
+ * Post the validation result to the checkout iframe
193
+ */
194
+
195
+ const postValidationResult = (iframe, sid, result) => {
196
+ if (iframe.contentWindow) {
197
+ iframe.contentWindow.postMessage({
198
+ type: "ValidationResult",
199
+ sid,
200
+ ...result
201
+ }, "*");
202
+ }
203
+ };
185
204
  /**
186
205
  * Post RefreshSession-event to the checkout iframe.
187
206
  */
@@ -307,18 +326,20 @@ const embed = async options => {
307
326
  onSessionNotFound,
308
327
  onSessionLocked,
309
328
  onSessionLockFailed,
310
- onActivePaymentType
329
+ onActivePaymentType,
330
+ onValidateSession
311
331
  } = options;
312
332
  const subscriptions = []; // Create iframe
313
333
 
314
334
  const {
315
335
  iframe,
316
336
  initiate
317
- } = await createIframeAsync(container, endpoint, getSessionUrl({
337
+ } = createIframeAsync(container, endpoint, getSessionUrl({
318
338
  sid,
319
339
  endpoint,
320
340
  language,
321
- ui: "inline"
341
+ ui: "inline",
342
+ shouldCallValidateSession: onValidateSession !== undefined
322
343
  }));
323
344
  /**
324
345
  * Function that removes the iframe and all event listeners.
@@ -344,6 +365,16 @@ const embed = async options => {
344
365
 
345
366
  const setActivePaymentProductType = paymentProductType => {
346
367
  postActivePaymentProductType(iframe, sid, paymentProductType);
368
+ };
369
+
370
+ const submitValidationResult = result => {
371
+ postValidationResult(iframe, sid, result);
372
+ };
373
+
374
+ const wrappedOnValidateSession = (event, checkout) => {
375
+ if (onValidateSession) {
376
+ onValidateSession(event, checkout, submitValidationResult);
377
+ }
347
378
  }; // Create checkout object that wraps the destroy function.
348
379
 
349
380
 
@@ -353,7 +384,8 @@ const embed = async options => {
353
384
  language,
354
385
  lockSession,
355
386
  refreshSession,
356
- setActivePaymentProductType
387
+ setActivePaymentProductType,
388
+ submitValidationResult
357
389
  }; // Add event handlers (or in some cases add a fallback href handler).
358
390
 
359
391
  [{
@@ -389,6 +421,12 @@ const embed = async options => {
389
421
  }, {
390
422
  handler: onActivePaymentType,
391
423
  eventTypes: [CheckoutEvents.ActivePaymentProductType]
424
+ }, {
425
+ handler: onActivePaymentType,
426
+ eventTypes: [CheckoutEvents.ActivePaymentProductType]
427
+ }, {
428
+ handler: wrappedOnValidateSession,
429
+ eventTypes: [CheckoutEvents.ValidateSession]
392
430
  }].forEach(({
393
431
  handler,
394
432
  eventTypes
@@ -422,7 +460,8 @@ const redirect = options => {
422
460
  windowLocationAssign(getSessionUrl({
423
461
  sid,
424
462
  endpoint,
425
- language
463
+ language,
464
+ shouldCallValidateSession: false
426
465
  }));
427
466
  };
428
467
 
@@ -6,7 +6,7 @@ require('native-promise-only');
6
6
 
7
7
  var pkg = {
8
8
  name: "@dintero/checkout-web-sdk",
9
- version: "0.0.17",
9
+ version: "0.0.0-development",
10
10
  description: "Dintero Checkout SDK for web frontends",
11
11
  main: "dist/dintero-checkout-web-sdk.cjs.js",
12
12
  module: "dist/dintero-checkout-web-sdk.esm.js",
@@ -18,12 +18,13 @@ var pkg = {
18
18
  },
19
19
  scripts: {
20
20
  build: "preconstruct build",
21
- test: "karma start"
21
+ test: "karma start",
22
+ "semantic-release": "semantic-release"
22
23
  },
23
24
  "private": false,
24
25
  repository: {
25
26
  type: "git",
26
- url: "git+https://github.com/Dintero/Dintero.Checkout.Web.SDK.git"
27
+ url: "https://github.com/Dintero/Dintero.Checkout.Web.SDK.git"
27
28
  },
28
29
  homepage: "https://github.com/Dintero/Dintero.Checkout.Web.SDK#readme",
29
30
  author: "Sven Nicolai Viig <sven@dintero.com> (http://dintero.com)",
@@ -35,8 +36,9 @@ var pkg = {
35
36
  "@babel/preset-env": "^7.14.1",
36
37
  "@babel/preset-typescript": "^7.13.0",
37
38
  "@preconstruct/cli": "^2.1.0",
39
+ "@semantic-release/git": "^10.0.1",
38
40
  chai: "^4.2.0",
39
- karma: "^5.1.1",
41
+ karma: "^6.3.14",
40
42
  "karma-chai": "^0.1.0",
41
43
  "karma-chrome-launcher": "^3.1.0",
42
44
  "karma-mocha": "^2.0.1",
@@ -45,6 +47,7 @@ var pkg = {
45
47
  prettier: "^1.19.1",
46
48
  puppeteer: "^2.1.0",
47
49
  rollup: "^1.30.1",
50
+ "semantic-release": "^19.0.2",
48
51
  sinon: "^8.1.1",
49
52
  typescript: "^4.2.4"
50
53
  },
@@ -66,6 +69,7 @@ let CheckoutEvents;
66
69
  CheckoutEvents["SessionLocked"] = "SessionLocked";
67
70
  CheckoutEvents["SessionLockFailed"] = "SessionLockFailed";
68
71
  CheckoutEvents["ActivePaymentProductType"] = "ActivePaymentProductType";
72
+ CheckoutEvents["ValidateSession"] = "ValidateSession";
69
73
  })(CheckoutEvents || (CheckoutEvents = {}));
70
74
 
71
75
  let InternalCheckoutEvents;
@@ -92,7 +96,8 @@ const getSessionUrl = options => {
92
96
  sid,
93
97
  endpoint,
94
98
  language,
95
- ui
99
+ ui,
100
+ shouldCallValidateSession
96
101
  } = options;
97
102
 
98
103
  if (!endpoint) {
@@ -103,7 +108,8 @@ const getSessionUrl = options => {
103
108
  let languageParam = language ? `language=${language}` : "";
104
109
  let uiParam = ui ? `ui=${ui}` : "";
105
110
  let sdk = `sdk=${pkg.version}`;
106
- const params = [languageParam, uiParam, sdk].filter(x => x).join("&");
111
+ let validate = shouldCallValidateSession ? `client_side_validation=true` : undefined;
112
+ const params = [languageParam, uiParam, sdk, validate].filter(x => x).join("&");
107
113
  return `${endpoint}/v1/view/${sid}${params ? "?" + params : ""}`;
108
114
  };
109
115
 
@@ -182,6 +188,19 @@ const postSessionLock = (iframe, sid) => {
182
188
  }, "*");
183
189
  }
184
190
  };
191
+ /**
192
+ * Post the validation result to the checkout iframe
193
+ */
194
+
195
+ const postValidationResult = (iframe, sid, result) => {
196
+ if (iframe.contentWindow) {
197
+ iframe.contentWindow.postMessage({
198
+ type: "ValidationResult",
199
+ sid,
200
+ ...result
201
+ }, "*");
202
+ }
203
+ };
185
204
  /**
186
205
  * Post RefreshSession-event to the checkout iframe.
187
206
  */
@@ -307,18 +326,20 @@ const embed = async options => {
307
326
  onSessionNotFound,
308
327
  onSessionLocked,
309
328
  onSessionLockFailed,
310
- onActivePaymentType
329
+ onActivePaymentType,
330
+ onValidateSession
311
331
  } = options;
312
332
  const subscriptions = []; // Create iframe
313
333
 
314
334
  const {
315
335
  iframe,
316
336
  initiate
317
- } = await createIframeAsync(container, endpoint, getSessionUrl({
337
+ } = createIframeAsync(container, endpoint, getSessionUrl({
318
338
  sid,
319
339
  endpoint,
320
340
  language,
321
- ui: "inline"
341
+ ui: "inline",
342
+ shouldCallValidateSession: onValidateSession !== undefined
322
343
  }));
323
344
  /**
324
345
  * Function that removes the iframe and all event listeners.
@@ -344,6 +365,16 @@ const embed = async options => {
344
365
 
345
366
  const setActivePaymentProductType = paymentProductType => {
346
367
  postActivePaymentProductType(iframe, sid, paymentProductType);
368
+ };
369
+
370
+ const submitValidationResult = result => {
371
+ postValidationResult(iframe, sid, result);
372
+ };
373
+
374
+ const wrappedOnValidateSession = (event, checkout) => {
375
+ if (onValidateSession) {
376
+ onValidateSession(event, checkout, submitValidationResult);
377
+ }
347
378
  }; // Create checkout object that wraps the destroy function.
348
379
 
349
380
 
@@ -353,7 +384,8 @@ const embed = async options => {
353
384
  language,
354
385
  lockSession,
355
386
  refreshSession,
356
- setActivePaymentProductType
387
+ setActivePaymentProductType,
388
+ submitValidationResult
357
389
  }; // Add event handlers (or in some cases add a fallback href handler).
358
390
 
359
391
  [{
@@ -389,6 +421,12 @@ const embed = async options => {
389
421
  }, {
390
422
  handler: onActivePaymentType,
391
423
  eventTypes: [CheckoutEvents.ActivePaymentProductType]
424
+ }, {
425
+ handler: onActivePaymentType,
426
+ eventTypes: [CheckoutEvents.ActivePaymentProductType]
427
+ }, {
428
+ handler: wrappedOnValidateSession,
429
+ eventTypes: [CheckoutEvents.ValidateSession]
392
430
  }].forEach(({
393
431
  handler,
394
432
  eventTypes
@@ -422,7 +460,8 @@ const redirect = options => {
422
460
  windowLocationAssign(getSessionUrl({
423
461
  sid,
424
462
  endpoint,
425
- language
463
+ language,
464
+ shouldCallValidateSession: false
426
465
  }));
427
466
  };
428
467
 
@@ -2,7 +2,7 @@ import 'native-promise-only';
2
2
 
3
3
  var pkg = {
4
4
  name: "@dintero/checkout-web-sdk",
5
- version: "0.0.17",
5
+ version: "0.0.0-development",
6
6
  description: "Dintero Checkout SDK for web frontends",
7
7
  main: "dist/dintero-checkout-web-sdk.cjs.js",
8
8
  module: "dist/dintero-checkout-web-sdk.esm.js",
@@ -14,12 +14,13 @@ var pkg = {
14
14
  },
15
15
  scripts: {
16
16
  build: "preconstruct build",
17
- test: "karma start"
17
+ test: "karma start",
18
+ "semantic-release": "semantic-release"
18
19
  },
19
20
  "private": false,
20
21
  repository: {
21
22
  type: "git",
22
- url: "git+https://github.com/Dintero/Dintero.Checkout.Web.SDK.git"
23
+ url: "https://github.com/Dintero/Dintero.Checkout.Web.SDK.git"
23
24
  },
24
25
  homepage: "https://github.com/Dintero/Dintero.Checkout.Web.SDK#readme",
25
26
  author: "Sven Nicolai Viig <sven@dintero.com> (http://dintero.com)",
@@ -31,8 +32,9 @@ var pkg = {
31
32
  "@babel/preset-env": "^7.14.1",
32
33
  "@babel/preset-typescript": "^7.13.0",
33
34
  "@preconstruct/cli": "^2.1.0",
35
+ "@semantic-release/git": "^10.0.1",
34
36
  chai: "^4.2.0",
35
- karma: "^5.1.1",
37
+ karma: "^6.3.14",
36
38
  "karma-chai": "^0.1.0",
37
39
  "karma-chrome-launcher": "^3.1.0",
38
40
  "karma-mocha": "^2.0.1",
@@ -41,6 +43,7 @@ var pkg = {
41
43
  prettier: "^1.19.1",
42
44
  puppeteer: "^2.1.0",
43
45
  rollup: "^1.30.1",
46
+ "semantic-release": "^19.0.2",
44
47
  sinon: "^8.1.1",
45
48
  typescript: "^4.2.4"
46
49
  },
@@ -62,6 +65,7 @@ let CheckoutEvents;
62
65
  CheckoutEvents["SessionLocked"] = "SessionLocked";
63
66
  CheckoutEvents["SessionLockFailed"] = "SessionLockFailed";
64
67
  CheckoutEvents["ActivePaymentProductType"] = "ActivePaymentProductType";
68
+ CheckoutEvents["ValidateSession"] = "ValidateSession";
65
69
  })(CheckoutEvents || (CheckoutEvents = {}));
66
70
 
67
71
  let InternalCheckoutEvents;
@@ -88,7 +92,8 @@ const getSessionUrl = options => {
88
92
  sid,
89
93
  endpoint,
90
94
  language,
91
- ui
95
+ ui,
96
+ shouldCallValidateSession
92
97
  } = options;
93
98
 
94
99
  if (!endpoint) {
@@ -99,7 +104,8 @@ const getSessionUrl = options => {
99
104
  let languageParam = language ? `language=${language}` : "";
100
105
  let uiParam = ui ? `ui=${ui}` : "";
101
106
  let sdk = `sdk=${pkg.version}`;
102
- const params = [languageParam, uiParam, sdk].filter(x => x).join("&");
107
+ let validate = shouldCallValidateSession ? `client_side_validation=true` : undefined;
108
+ const params = [languageParam, uiParam, sdk, validate].filter(x => x).join("&");
103
109
  return `${endpoint}/v1/view/${sid}${params ? "?" + params : ""}`;
104
110
  };
105
111
 
@@ -178,6 +184,19 @@ const postSessionLock = (iframe, sid) => {
178
184
  }, "*");
179
185
  }
180
186
  };
187
+ /**
188
+ * Post the validation result to the checkout iframe
189
+ */
190
+
191
+ const postValidationResult = (iframe, sid, result) => {
192
+ if (iframe.contentWindow) {
193
+ iframe.contentWindow.postMessage({
194
+ type: "ValidationResult",
195
+ sid,
196
+ ...result
197
+ }, "*");
198
+ }
199
+ };
181
200
  /**
182
201
  * Post RefreshSession-event to the checkout iframe.
183
202
  */
@@ -303,18 +322,20 @@ const embed = async options => {
303
322
  onSessionNotFound,
304
323
  onSessionLocked,
305
324
  onSessionLockFailed,
306
- onActivePaymentType
325
+ onActivePaymentType,
326
+ onValidateSession
307
327
  } = options;
308
328
  const subscriptions = []; // Create iframe
309
329
 
310
330
  const {
311
331
  iframe,
312
332
  initiate
313
- } = await createIframeAsync(container, endpoint, getSessionUrl({
333
+ } = createIframeAsync(container, endpoint, getSessionUrl({
314
334
  sid,
315
335
  endpoint,
316
336
  language,
317
- ui: "inline"
337
+ ui: "inline",
338
+ shouldCallValidateSession: onValidateSession !== undefined
318
339
  }));
319
340
  /**
320
341
  * Function that removes the iframe and all event listeners.
@@ -340,6 +361,16 @@ const embed = async options => {
340
361
 
341
362
  const setActivePaymentProductType = paymentProductType => {
342
363
  postActivePaymentProductType(iframe, sid, paymentProductType);
364
+ };
365
+
366
+ const submitValidationResult = result => {
367
+ postValidationResult(iframe, sid, result);
368
+ };
369
+
370
+ const wrappedOnValidateSession = (event, checkout) => {
371
+ if (onValidateSession) {
372
+ onValidateSession(event, checkout, submitValidationResult);
373
+ }
343
374
  }; // Create checkout object that wraps the destroy function.
344
375
 
345
376
 
@@ -349,7 +380,8 @@ const embed = async options => {
349
380
  language,
350
381
  lockSession,
351
382
  refreshSession,
352
- setActivePaymentProductType
383
+ setActivePaymentProductType,
384
+ submitValidationResult
353
385
  }; // Add event handlers (or in some cases add a fallback href handler).
354
386
 
355
387
  [{
@@ -385,6 +417,12 @@ const embed = async options => {
385
417
  }, {
386
418
  handler: onActivePaymentType,
387
419
  eventTypes: [CheckoutEvents.ActivePaymentProductType]
420
+ }, {
421
+ handler: onActivePaymentType,
422
+ eventTypes: [CheckoutEvents.ActivePaymentProductType]
423
+ }, {
424
+ handler: wrappedOnValidateSession,
425
+ eventTypes: [CheckoutEvents.ValidateSession]
388
426
  }].forEach(({
389
427
  handler,
390
428
  eventTypes
@@ -418,7 +456,8 @@ const redirect = options => {
418
456
  windowLocationAssign(getSessionUrl({
419
457
  sid,
420
458
  endpoint,
421
- language
459
+ language,
460
+ shouldCallValidateSession: false
422
461
  }));
423
462
  };
424
463
 
@@ -3,5 +3,5 @@
3
3
  v0.8.1 (c) Kyle Simpson
4
4
  MIT License: http://getify.mit-license.org
5
5
  */
6
- var t,o,i;i=function(){var e,n,t,o=Object.prototype.toString,i="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,n,t,o){return Object.defineProperty(e,n,{value:t,writable:!0,configurable:!1!==o})}}catch(n){e=function(e,n,t){return e[n]=t,e}}function r(e,o){t.add(e,o),n||(n=i(t.drain))}function s(e){var n,t=typeof e;return null==e||"object"!=t&&"function"!=t||(n=e.then),"function"==typeof n&&n}function a(){for(var e=0;e<this.chain.length;e++)c(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function c(e,n,t){var o,i;try{!1===n?t.reject(e.msg):(o=!0===n?e.msg:n.call(void 0,e.msg))===t.promise?t.reject(TypeError("Promise-chain cycle")):(i=s(o))?i.call(o,t.resolve,t.reject):t.resolve(o)}catch(e){t.reject(e)}}function d(e){var n,t=this;if(!t.triggered){t.triggered=!0,t.def&&(t=t.def);try{(n=s(e))?r((function(){var o=new l(t);try{n.call(e,(function(){d.apply(o,arguments)}),(function(){u.apply(o,arguments)}))}catch(e){u.call(o,e)}})):(t.msg=e,t.state=1,t.chain.length>0&&r(a,t))}catch(e){u.call(new l(t),e)}}}function u(e){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=e,n.state=2,n.chain.length>0&&r(a,n))}function f(e,n,t,o){for(var i=0;i<n.length;i++)!function(i){e.resolve(n[i]).then((function(e){t(i,e)}),o)}(i)}function l(e){this.def=e,this.triggered=!1}function h(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function p(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var n=new h(this);this.then=function(e,t){var o={success:"function"!=typeof e||e,failure:"function"==typeof t&&t};return o.promise=new this.constructor((function(e,n){if("function"!=typeof e||"function"!=typeof n)throw TypeError("Not a function");o.resolve=e,o.reject=n})),n.chain.push(o),0!==n.state&&r(a,n),o.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,(function(e){d.call(n,e)}),(function(e){u.call(n,e)}))}catch(e){u.call(n,e)}}t=function(){var e,t,o;function i(e,n){this.fn=e,this.self=n,this.next=void 0}return{add:function(n,r){o=new i(n,r),t?t.next=o:e=o,t=o,o=void 0},drain:function(){var o=e;for(e=t=n=void 0;o;)o.fn.call(o.self),o=o.next}}}();var y=e({},"constructor",p,!1);return p.prototype=y,e(y,"__NPO__",0,!1),e(p,"resolve",(function(e){return e&&"object"==typeof e&&1===e.__NPO__?e:new this((function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");n(e)}))})),e(p,"reject",(function(e){return new this((function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");t(e)}))})),e(p,"all",(function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):0===e.length?n.resolve([]):new n((function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");var i=e.length,r=Array(i),s=0;f(n,e,(function(e,n){r[e]=n,++s===i&&t(r)}),o)}))})),e(p,"race",(function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):new n((function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");f(n,e,(function(e,n){t(n)}),o)}))})),p},(o=n)[t="Promise"]=o[t]||i(),e.exports&&(e.exports=o[t])}));var t="0.0.17";let o,i;!function(e){e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentOnHold="SessionPaymentOnHold",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError",e.SessionLocked="SessionLocked",e.SessionLockFailed="SessionLockFailed",e.ActivePaymentProductType="ActivePaymentProductType"}(o||(o={})),function(e){e.HeightChanged="HeightChanged",e.LanguageChanged="LanguageChanged"}(i||(i={}));const r=e=>{window.location.assign(e)},s=e=>{const{sid:n,endpoint:o,language:i,ui:r}=e;if(!o)throw new Error("Invalid endpoint");const s=[i?`language=${i}`:"",r?`ui=${r}`:"",`sdk=${t}`].filter((e=>e)).join("&");return`${o}/v1/view/${n}${s?"?"+s:""}`},a=e=>{e.href&&r(e.href)},c=(e,n)=>{(e.height||0===e.height)&&n.iframe.setAttribute("style",`width:100%; height:${e.height}px;`)},d=(e,n)=>{e.language&&(n.language=e.language)},u=(e,n,i)=>(e,r)=>{const s=["sid","merchant_reference","transaction_id","error"].map((n=>[n,e[n]]));e.type!==o.SessionCancel||e.error||s.push(["error","cancelled"]),s.push(["language",r.language]),s.push(["sdk",t]);const a=s.filter((([e,n])=>n)).map((([e,n])=>`${e}=${n}`)).join("&");r.iframe.setAttribute("src",`${n}/embedResult/?${a}`),i(e,r)};e.embed=async e=>{const{container:n,sid:t,language:r,endpoint:f="https://checkout.dintero.com",onSession:l,onSessionCancel:h,onPayment:p,onPaymentAuthorized:y,onPaymentError:g,onSessionNotFound:m,onSessionLocked:v,onSessionLockFailed:w,onActivePaymentType:S}=e,T=[],{iframe:b,initiate:P}=await((e,n,t)=>{if(!e||!e.appendChild)throw new Error("Invalid container");const o=document.createElement("iframe");return o.setAttribute("frameborder","0"),o.setAttribute("allowTransparency","true"),o.setAttribute("style","width:100%; height:0;"),o.setAttribute("sandbox","allow-scripts allow-forms allow-same-origin allow-popups"),o.setAttribute("importance","high"),o.setAttribute("src",t),{iframe:o,initiate:async()=>new Promise(((n,t)=>{o.onload=()=>n(),o.onerror=()=>t(),e.appendChild(o)}))}})(n,0,s({sid:t,endpoint:f,language:r,ui:"inline"})),E={destroy:()=>{b&&(T.forEach((e=>e.unsubscribe())),b.parentElement&&n.removeChild(b))},iframe:b,language:r,lockSession:()=>{((e,n)=>{e.contentWindow&&e.contentWindow.postMessage({type:"LockSession",sid:n},"*")})(b,t)},refreshSession:()=>{((e,n)=>{e.contentWindow&&e.contentWindow.postMessage({type:"RefreshSession",sid:n},"*")})(b,t)},setActivePaymentProductType:e=>{((e,n,t)=>{e.contentWindow&&e.contentWindow.postMessage({type:"SetActivePaymentProductType",sid:n,payment_product_type:t},"*")})(b,t,e)}};return[{handler:d,eventTypes:[i.LanguageChanged]},{handler:c,eventTypes:[i.HeightChanged]},{handler:l,eventTypes:[o.SessionLoaded,o.SessionUpdated]},{eventTypes:[o.SessionPaymentOnHold],handler:p?u(0,f,p):a},{eventTypes:[o.SessionPaymentAuthorized],handler:y||p?u(0,f,y||p):a},{handler:h?u(0,f,h):a,eventTypes:[o.SessionCancel]},{handler:g?u(0,f,g):a,eventTypes:[o.SessionPaymentError]},{handler:m,eventTypes:[o.SessionNotFound]},{handler:v,eventTypes:[o.SessionLocked]},{handler:w,eventTypes:[o.SessionLockFailed]},{handler:S,eventTypes:[o.ActivePaymentProductType]}].forEach((({handler:e,eventTypes:n})=>{e&&T.push((e=>{const{sid:n,endpoint:t,handler:o,eventTypes:i,checkout:r}=e,s=e=>{const s=e.origin===t,a=e.source===r.iframe.contentWindow,c=e.data&&e.data.sid===n,d=-1!==i.indexOf(e.data&&e.data.type);s&&a&&c&&d&&(((e,n)=>{n.data.mid&&e.contentWindow&&e.contentWindow.postMessage({ack:n.data.mid},n.origin||"*")})(r.iframe,e),o(e.data,r))};return window.addEventListener("message",s,!1),{unsubscribe:()=>{window.removeEventListener("message",s,!1)}}})({sid:t,endpoint:f,handler:e,eventTypes:n,checkout:E}))})),await P(),E},e.redirect=e=>{const{sid:n,language:t,endpoint:o="https://checkout.dintero.com"}=e;r(s({sid:n,endpoint:o,language:t}))},Object.defineProperty(e,"__esModule",{value:!0})}));
6
+ var t,o,i;i=function(){var e,n,t,o=Object.prototype.toString,i="undefined"!=typeof setImmediate?function(e){return setImmediate(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,n,t,o){return Object.defineProperty(e,n,{value:t,writable:!0,configurable:!1!==o})}}catch(n){e=function(e,n,t){return e[n]=t,e}}function r(e,o){t.add(e,o),n||(n=i(t.drain))}function s(e){var n,t=typeof e;return null==e||"object"!=t&&"function"!=t||(n=e.then),"function"==typeof n&&n}function a(){for(var e=0;e<this.chain.length;e++)c(this,1===this.state?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function c(e,n,t){var o,i;try{!1===n?t.reject(e.msg):(o=!0===n?e.msg:n.call(void 0,e.msg))===t.promise?t.reject(TypeError("Promise-chain cycle")):(i=s(o))?i.call(o,t.resolve,t.reject):t.resolve(o)}catch(e){t.reject(e)}}function d(e){var n,t=this;if(!t.triggered){t.triggered=!0,t.def&&(t=t.def);try{(n=s(e))?r((function(){var o=new f(t);try{n.call(e,(function(){d.apply(o,arguments)}),(function(){u.apply(o,arguments)}))}catch(e){u.call(o,e)}})):(t.msg=e,t.state=1,t.chain.length>0&&r(a,t))}catch(e){u.call(new f(t),e)}}}function u(e){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=e,n.state=2,n.chain.length>0&&r(a,n))}function l(e,n,t,o){for(var i=0;i<n.length;i++)!function(i){e.resolve(n[i]).then((function(e){t(i,e)}),o)}(i)}function f(e){this.def=e,this.triggered=!1}function h(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function p(e){if("function"!=typeof e)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var n=new h(this);this.then=function(e,t){var o={success:"function"!=typeof e||e,failure:"function"==typeof t&&t};return o.promise=new this.constructor((function(e,n){if("function"!=typeof e||"function"!=typeof n)throw TypeError("Not a function");o.resolve=e,o.reject=n})),n.chain.push(o),0!==n.state&&r(a,n),o.promise},this.catch=function(e){return this.then(void 0,e)};try{e.call(void 0,(function(e){d.call(n,e)}),(function(e){u.call(n,e)}))}catch(e){u.call(n,e)}}t=function(){var e,t,o;function i(e,n){this.fn=e,this.self=n,this.next=void 0}return{add:function(n,r){o=new i(n,r),t?t.next=o:e=o,t=o,o=void 0},drain:function(){var o=e;for(e=t=n=void 0;o;)o.fn.call(o.self),o=o.next}}}();var y=e({},"constructor",p,!1);return p.prototype=y,e(y,"__NPO__",0,!1),e(p,"resolve",(function(e){return e&&"object"==typeof e&&1===e.__NPO__?e:new this((function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");n(e)}))})),e(p,"reject",(function(e){return new this((function(n,t){if("function"!=typeof n||"function"!=typeof t)throw TypeError("Not a function");t(e)}))})),e(p,"all",(function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):0===e.length?n.resolve([]):new n((function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");var i=e.length,r=Array(i),s=0;l(n,e,(function(e,n){r[e]=n,++s===i&&t(r)}),o)}))})),e(p,"race",(function(e){var n=this;return"[object Array]"!=o.call(e)?n.reject(TypeError("Not an array")):new n((function(t,o){if("function"!=typeof t||"function"!=typeof o)throw TypeError("Not a function");l(n,e,(function(e,n){t(n)}),o)}))})),p},(o=n)[t="Promise"]=o[t]||i(),e.exports&&(e.exports=o[t])}));var t="0.0.0-development";let o,i;!function(e){e.SessionNotFound="SessionNotFound",e.SessionLoaded="SessionLoaded",e.SessionUpdated="SessionUpdated",e.SessionCancel="SessionCancel",e.SessionPaymentOnHold="SessionPaymentOnHold",e.SessionPaymentAuthorized="SessionPaymentAuthorized",e.SessionPaymentError="SessionPaymentError",e.SessionLocked="SessionLocked",e.SessionLockFailed="SessionLockFailed",e.ActivePaymentProductType="ActivePaymentProductType",e.ValidateSession="ValidateSession"}(o||(o={})),function(e){e.HeightChanged="HeightChanged",e.LanguageChanged="LanguageChanged"}(i||(i={}));const r=e=>{window.location.assign(e)},s=e=>{const{sid:n,endpoint:o,language:i,ui:r,shouldCallValidateSession:s}=e;if(!o)throw new Error("Invalid endpoint");const a=[i?`language=${i}`:"",r?`ui=${r}`:"",`sdk=${t}`,s?"client_side_validation=true":void 0].filter((e=>e)).join("&");return`${o}/v1/view/${n}${a?"?"+a:""}`},a=e=>{e.href&&r(e.href)},c=(e,n)=>{(e.height||0===e.height)&&n.iframe.setAttribute("style",`width:100%; height:${e.height}px;`)},d=(e,n)=>{e.language&&(n.language=e.language)},u=(e,n,i)=>(e,r)=>{const s=["sid","merchant_reference","transaction_id","error"].map((n=>[n,e[n]]));e.type!==o.SessionCancel||e.error||s.push(["error","cancelled"]),s.push(["language",r.language]),s.push(["sdk",t]);const a=s.filter((([e,n])=>n)).map((([e,n])=>`${e}=${n}`)).join("&");r.iframe.setAttribute("src",`${n}/embedResult/?${a}`),i(e,r)};e.embed=async e=>{const{container:n,sid:t,language:r,endpoint:l="https://checkout.dintero.com",onSession:f,onSessionCancel:h,onPayment:p,onPaymentAuthorized:y,onPaymentError:g,onSessionNotFound:m,onSessionLocked:v,onSessionLockFailed:w,onActivePaymentType:S,onValidateSession:T}=e,b=[],{iframe:P,initiate:_}=((e,n,t)=>{if(!e||!e.appendChild)throw new Error("Invalid container");const o=document.createElement("iframe");return o.setAttribute("frameborder","0"),o.setAttribute("allowTransparency","true"),o.setAttribute("style","width:100%; height:0;"),o.setAttribute("sandbox","allow-scripts allow-forms allow-same-origin allow-popups"),o.setAttribute("importance","high"),o.setAttribute("src",t),{iframe:o,initiate:async()=>new Promise(((n,t)=>{o.onload=()=>n(),o.onerror=()=>t(),e.appendChild(o)}))}})(n,0,s({sid:t,endpoint:l,language:r,ui:"inline",shouldCallValidateSession:void 0!==T})),E=e=>{((e,n,t)=>{e.contentWindow&&e.contentWindow.postMessage({type:"ValidationResult",sid:n,...t},"*")})(P,t,e)},A={destroy:()=>{P&&(b.forEach((e=>e.unsubscribe())),P.parentElement&&n.removeChild(P))},iframe:P,language:r,lockSession:()=>{((e,n)=>{e.contentWindow&&e.contentWindow.postMessage({type:"LockSession",sid:n},"*")})(P,t)},refreshSession:()=>{((e,n)=>{e.contentWindow&&e.contentWindow.postMessage({type:"RefreshSession",sid:n},"*")})(P,t)},setActivePaymentProductType:e=>{((e,n,t)=>{e.contentWindow&&e.contentWindow.postMessage({type:"SetActivePaymentProductType",sid:n,payment_product_type:t},"*")})(P,t,e)},submitValidationResult:E};return[{handler:d,eventTypes:[i.LanguageChanged]},{handler:c,eventTypes:[i.HeightChanged]},{handler:f,eventTypes:[o.SessionLoaded,o.SessionUpdated]},{eventTypes:[o.SessionPaymentOnHold],handler:p?u(0,l,p):a},{eventTypes:[o.SessionPaymentAuthorized],handler:y||p?u(0,l,y||p):a},{handler:h?u(0,l,h):a,eventTypes:[o.SessionCancel]},{handler:g?u(0,l,g):a,eventTypes:[o.SessionPaymentError]},{handler:m,eventTypes:[o.SessionNotFound]},{handler:v,eventTypes:[o.SessionLocked]},{handler:w,eventTypes:[o.SessionLockFailed]},{handler:S,eventTypes:[o.ActivePaymentProductType]},{handler:S,eventTypes:[o.ActivePaymentProductType]},{handler:(e,n)=>{T&&T(e,n,E)},eventTypes:[o.ValidateSession]}].forEach((({handler:e,eventTypes:n})=>{e&&b.push((e=>{const{sid:n,endpoint:t,handler:o,eventTypes:i,checkout:r}=e,s=e=>{const s=e.origin===t,a=e.source===r.iframe.contentWindow,c=e.data&&e.data.sid===n,d=-1!==i.indexOf(e.data&&e.data.type);s&&a&&c&&d&&(((e,n)=>{n.data.mid&&e.contentWindow&&e.contentWindow.postMessage({ack:n.data.mid},n.origin||"*")})(r.iframe,e),o(e.data,r))};return window.addEventListener("message",s,!1),{unsubscribe:()=>{window.removeEventListener("message",s,!1)}}})({sid:t,endpoint:l,handler:e,eventTypes:n,checkout:A}))})),await _(),A},e.redirect=e=>{const{sid:n,language:t,endpoint:o="https://checkout.dintero.com"}=e;r(s({sid:n,endpoint:o,language:t,shouldCallValidateSession:!1}))},Object.defineProperty(e,"__esModule",{value:!0})}));
7
7
  //# sourceMappingURL=dintero-checkout-web-sdk.umd.min.js.map