@fat-zebra/sdk 1.5.5-beta.0 → 1.5.6

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 (78) hide show
  1. package/dist/applepay/applepay.js +10 -0
  2. package/dist/applepay/clients/apple-pay-client.js +1 -1
  3. package/dist/click_to_pay/index.d.ts +1 -0
  4. package/dist/click_to_pay/index.js +27 -5
  5. package/dist/click_to_pay/types.d.ts +1 -0
  6. package/dist/hpp/hpp.js +1 -0
  7. package/dist/local/fatzebra.js.map +1 -1
  8. package/dist/main.js +3 -3
  9. package/dist/paypal/paypal-button.d.ts +31 -0
  10. package/dist/paypal/paypal-button.js +199 -0
  11. package/dist/paypal/paypal-checkout.d.ts +21 -0
  12. package/dist/paypal/paypal-checkout.js +100 -0
  13. package/dist/paypal/types.d.ts +188 -0
  14. package/dist/paypal/types.js +5 -0
  15. package/dist/paypal/validation.d.ts +4 -0
  16. package/dist/paypal/validation.js +65 -0
  17. package/dist/react/{applePayUrl.d.ts → url.d.ts} +2 -2
  18. package/dist/react/url.js +33 -0
  19. package/dist/sandbox/fatzebra.js +1 -1
  20. package/dist/sandbox/fatzebra.js.LICENSE.txt +1 -1
  21. package/dist/sca/index.js +4 -2
  22. package/dist/sca/scenarios/enrollment.js +2 -2
  23. package/dist/sca/scenarios/validation.js +3 -3
  24. package/dist/sca/types.d.ts +2 -0
  25. package/dist/shared/event-manager.d.ts +1 -1
  26. package/dist/shared/types.d.ts +16 -3
  27. package/dist/shared/types.js +9 -1
  28. package/dist/src/paypal/paypal-button.js +311 -0
  29. package/dist/src/paypal/paypal-button.js.map +1 -0
  30. package/dist/src/paypal/paypal-button.test.js +41 -0
  31. package/dist/src/paypal/paypal-button.test.js.map +1 -0
  32. package/dist/src/paypal/paypal-checkout.js +111 -0
  33. package/dist/src/paypal/paypal-checkout.js.map +1 -0
  34. package/dist/src/paypal/paypal-checkout.test.js +167 -0
  35. package/dist/src/paypal/paypal-checkout.test.js.map +1 -0
  36. package/dist/src/paypal/types.js +9 -0
  37. package/dist/src/paypal/types.js.map +1 -0
  38. package/dist/src/paypal/validation.js +73 -0
  39. package/dist/src/paypal/validation.js.map +1 -0
  40. package/dist/src/react/{applePayUrl.js → url.js} +21 -7
  41. package/dist/src/react/url.js.map +1 -0
  42. package/dist/src/react/url.test.js +88 -0
  43. package/dist/src/react/url.test.js.map +1 -0
  44. package/dist/src/react/useFatZebra.js +56 -7
  45. package/dist/src/react/useFatZebra.js.map +1 -1
  46. package/dist/validation/schemas/applepay/options.json +73 -0
  47. package/dist/validation/schemas/click-to-pay/options.json +3 -0
  48. package/dist/version.d.ts +1 -1
  49. package/dist/version.js +1 -1
  50. package/package.json +3 -2
  51. package/.idea/fatzebra-js.iml +0 -12
  52. package/.idea/modules.xml +0 -8
  53. package/.idea/vcs.xml +0 -6
  54. package/dist/applepay/applepaymanager.d.ts +0 -28
  55. package/dist/applepay/applepaymanager.js +0 -115
  56. package/dist/local/fatzebra.js +0 -19565
  57. package/dist/production/fatzebra.css +0 -91
  58. package/dist/production/fatzebra.js +0 -2
  59. package/dist/react/ApplePay.d.ts +0 -9
  60. package/dist/react/ApplePay.js +0 -11
  61. package/dist/react/applePayUrl.js +0 -19
  62. package/dist/src/applepay/applepaymanager.js +0 -279
  63. package/dist/src/applepay/applepaymanager.js.map +0 -1
  64. package/dist/src/react/ApplePayButton.js +0 -56
  65. package/dist/src/react/ApplePayButton.js.map +0 -1
  66. package/dist/src/react/applePayUrl.js.map +0 -1
  67. package/dist/src/react/applePayUrl.test.js +0 -57
  68. package/dist/src/react/applePayUrl.test.js.map +0 -1
  69. package/dist/src/react/useMessage.js +0 -140
  70. package/dist/src/react/useMessage.js.map +0 -1
  71. package/dist/src/react/useMessage.test.js +0 -222
  72. package/dist/src/react/useMessage.test.js.map +0 -1
  73. package/dist/src/validation/validators/apple-pay-load-params-button-validator.js +0 -19
  74. package/dist/src/validation/validators/apple-pay-load-params-button-validator.js.map +0 -1
  75. package/dist/staging/fatzebra.css +0 -91
  76. package/dist/staging/fatzebra.js +0 -19565
  77. package/dist/staging/fatzebra.js.map +0 -1
  78. package/dist/staging/index.html +0 -247
@@ -32,6 +32,7 @@ export class ApplePay {
32
32
  this.iframe.setAttribute("src", applePayUrl);
33
33
  this.iframe.setAttribute("height", '100%');
34
34
  this.iframe.setAttribute("width", '100%');
35
+ this.iframe.setAttribute('allow', 'payment');
35
36
  this.postMessageClient = new PostMessageClient({
36
37
  channel,
37
38
  target: this.iframe,
@@ -60,6 +61,15 @@ export class ApplePay {
60
61
  if (options === null || options === void 0 ? void 0 : options.allowed_card_types) {
61
62
  query.append('allowed_card_types', options.allowed_card_types.toString());
62
63
  }
64
+ if (options === null || options === void 0 ? void 0 : options.apple_button_type) {
65
+ query.append('apple_button_type', options.apple_button_type.toString());
66
+ }
67
+ if (options === null || options === void 0 ? void 0 : options.apple_button_style) {
68
+ query.append('apple_button_style', options.apple_button_style.toString());
69
+ }
70
+ if (options === null || options === void 0 ? void 0 : options.apple_button_locale) {
71
+ query.append('apple_button_locale', options.apple_button_locale.toString());
72
+ }
63
73
  query.append('domain_name', this.domain_name);
64
74
  return `${base}?${query.toString()}`;
65
75
  }
@@ -30,6 +30,6 @@ const getEligibility = () => {
30
30
  return window.ApplePaySession && window.ApplePaySession.canMakePayments();
31
31
  };
32
32
  const createSession = (payload) => __awaiter(void 0, void 0, void 0, function* () {
33
- return yield new window.ApplePaySession(2, payload);
33
+ return yield new window.ApplePaySession(14, payload);
34
34
  });
35
35
  export { createSession, getEligibility, MerchantCapability, SupportedNetwork, };
@@ -22,6 +22,7 @@ declare class ClickToPay {
22
22
  private options;
23
23
  constructor(config: ClickToPayModuleConfig);
24
24
  load(config: ClickToPayLoadParams): void;
25
+ addMRTListener: (mrt: string) => void;
25
26
  getPayNowUrl(options?: {
26
27
  [key: string]: any;
27
28
  }): string;
@@ -1,5 +1,5 @@
1
1
  import { PostMessageClient } from "../shared/post-message-client";
2
- import { BridgeEvent, PublicEvent } from "../shared/types";
2
+ import { BridgeEvent, Channel, PublicEvent } from "../shared/types";
3
3
  import * as util from '../shared/util';
4
4
  import { emit } from "../shared/event-manager";
5
5
  export const CLICK_TO_PAY_DEFAULT_OPTIONS = {
@@ -8,13 +8,23 @@ export const CLICK_TO_PAY_DEFAULT_OPTIONS = {
8
8
  };
9
9
  class ClickToPay {
10
10
  constructor(config) {
11
+ this.addMRTListener = (mrt) => {
12
+ const handlers = {};
13
+ handlers[BridgeEvent.CLICK_TO_PAY_REQUEST_MRT] = (data) => {
14
+ const message = {
15
+ channel: Channel.CLICK_TO_PAY,
16
+ subject: BridgeEvent.CLICK_TO_PAY_RETURN_MRT,
17
+ data: {
18
+ mrt
19
+ },
20
+ };
21
+ this.postMessageClient.send(message);
22
+ };
23
+ this.postMessageClient.setEventListeners(handlers);
24
+ };
11
25
  this.paymentIntent = config.paymentIntent;
12
26
  this.username = config.username;
13
27
  this.test = config.test;
14
- this.postMessageClient = new PostMessageClient({
15
- channel: 'click_to_pay',
16
- target: this.iframe
17
- });
18
28
  }
19
29
  load(config) {
20
30
  this.options = config.options;
@@ -22,6 +32,12 @@ class ClickToPay {
22
32
  document.getElementById(config.containerId).appendChild(this.iframe);
23
33
  const payNowUrl = this.getPayNowUrl(config.options);
24
34
  this.iframe.setAttribute("src", payNowUrl);
35
+ this.postMessageClient = new PostMessageClient({
36
+ channel: Channel.CLICK_TO_PAY,
37
+ target: this.iframe
38
+ });
39
+ // Adding this before other crossframe event listener setup as we miss handling the MRT request event if we wait for this.iframe.onload to trigger
40
+ this.addMRTListener(this.options.mrt);
25
41
  this.iframe.onload = () => {
26
42
  this.setCrossFramesEventListeners();
27
43
  };
@@ -93,6 +109,12 @@ class ClickToPay {
93
109
  data
94
110
  });
95
111
  };
112
+ handlers[PublicEvent.CLICK_TO_PAY_MRT] = (data) => {
113
+ emit(PublicEvent.CLICK_TO_PAY_MRT, {
114
+ message: 'MRT created.',
115
+ data
116
+ });
117
+ };
96
118
  this.postMessageClient.setEventListeners(handlers);
97
119
  }
98
120
  purchase() {
@@ -13,6 +13,7 @@ interface ClickToPayOptions {
13
13
  sharedData?: string;
14
14
  submitPaymentButtonText?: string;
15
15
  tokenizeOnly?: boolean;
16
+ mrt?: string;
16
17
  }
17
18
  interface HppClickToPayParams {
18
19
  containerId: string;
package/dist/hpp/hpp.js CHANGED
@@ -31,6 +31,7 @@ class Hpp {
31
31
  this.iframe.onload = () => {
32
32
  this.setCrossFramesEventListeners();
33
33
  this.setPublicEventListeners();
34
+ emit(PublicEvent.HPP_READY);
34
35
  };
35
36
  };
36
37
  const payNowUrl = this.getPayNowUrl(config.options);