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

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 (97) hide show
  1. package/dist/applepay/applepay.d.ts +7 -22
  2. package/dist/applepay/applepay.js +21 -89
  3. package/dist/applepay/clients/apple-pay-client.d.ts +5 -9
  4. package/dist/applepay/clients/apple-pay-client.js +3 -9
  5. package/dist/applepay/clients/paynow-client.d.ts +2 -4
  6. package/dist/applepay/clients/paynow-client.js +7 -2
  7. package/dist/click_to_pay/index.js +0 -12
  8. package/dist/click_to_pay/types.d.ts +2 -11
  9. package/dist/local/fatzebra.js.map +1 -1
  10. package/dist/main.d.ts +0 -2
  11. package/dist/main.js +2 -24
  12. package/dist/paypal/paypal-button.d.ts +31 -0
  13. package/dist/paypal/paypal-button.js +199 -0
  14. package/dist/paypal/paypal-checkout.d.ts +21 -0
  15. package/dist/paypal/paypal-checkout.js +100 -0
  16. package/dist/paypal/types.d.ts +188 -0
  17. package/dist/paypal/types.js +5 -0
  18. package/dist/paypal/validation.d.ts +4 -0
  19. package/dist/paypal/validation.js +65 -0
  20. package/dist/react/index.d.ts +1 -2
  21. package/dist/react/index.js +1 -2
  22. package/dist/react/{applePayUrl.d.ts → url.d.ts} +2 -2
  23. package/dist/react/url.js +33 -0
  24. package/dist/react/useFatZebra.js +57 -8
  25. package/dist/shared/env.development.d.ts +3 -3
  26. package/dist/shared/env.development.js +3 -3
  27. package/dist/shared/envs/local.d.ts +3 -3
  28. package/dist/shared/envs/local.js +3 -3
  29. package/dist/shared/post-message-client.d.ts +0 -2
  30. package/dist/shared/post-message-client.js +1 -1
  31. package/dist/shared/types.d.ts +2 -14
  32. package/dist/shared/types.js +0 -2
  33. package/dist/src/paypal/paypal-button.js +311 -0
  34. package/dist/src/paypal/paypal-button.js.map +1 -0
  35. package/dist/src/paypal/paypal-button.test.js +41 -0
  36. package/dist/src/paypal/paypal-button.test.js.map +1 -0
  37. package/dist/src/paypal/paypal-checkout.js +111 -0
  38. package/dist/src/paypal/paypal-checkout.js.map +1 -0
  39. package/dist/src/paypal/paypal-checkout.test.js +167 -0
  40. package/dist/src/paypal/paypal-checkout.test.js.map +1 -0
  41. package/dist/src/paypal/types.js +9 -0
  42. package/dist/src/paypal/types.js.map +1 -0
  43. package/dist/src/paypal/validation.js +73 -0
  44. package/dist/src/paypal/validation.js.map +1 -0
  45. package/dist/src/react/{applePayUrl.js → url.js} +21 -7
  46. package/dist/src/react/url.js.map +1 -0
  47. package/dist/src/react/url.test.js +88 -0
  48. package/dist/src/react/url.test.js.map +1 -0
  49. package/dist/src/react/useFatZebra.js +56 -7
  50. package/dist/src/react/useFatZebra.js.map +1 -1
  51. package/dist/validation/schemas/click-to-pay/options.json +3 -30
  52. package/dist/version.d.ts +1 -1
  53. package/dist/version.js +1 -1
  54. package/package.json +2 -2
  55. package/.idea/fatzebra-js.iml +0 -12
  56. package/.idea/modules.xml +0 -8
  57. package/.idea/vcs.xml +0 -6
  58. package/dist/applepay/applepaymanager.d.ts +0 -28
  59. package/dist/applepay/applepaymanager.js +0 -115
  60. package/dist/applepay/types.d.ts +0 -15
  61. package/dist/applepay/types.js +0 -1
  62. package/dist/fatzebra.css +0 -91
  63. package/dist/local/fatzebra.js +0 -19565
  64. package/dist/production/fatzebra.css +0 -91
  65. package/dist/production/fatzebra.js +0 -2
  66. package/dist/react/ApplePay.d.ts +0 -9
  67. package/dist/react/ApplePay.js +0 -11
  68. package/dist/react/ApplePayButton.d.ts +0 -8
  69. package/dist/react/ApplePayButton.js +0 -18
  70. package/dist/react/applePayUrl.js +0 -19
  71. package/dist/react/useMessage.d.ts +0 -10
  72. package/dist/react/useMessage.js +0 -70
  73. package/dist/sandbox/fatzebra.css +0 -91
  74. package/dist/sandbox/fatzebra.js +0 -2
  75. package/dist/sandbox/fatzebra.js.LICENSE.txt +0 -1
  76. package/dist/src/applepay/applepaymanager.js +0 -279
  77. package/dist/src/applepay/applepaymanager.js.map +0 -1
  78. package/dist/src/react/ApplePayButton.js +0 -56
  79. package/dist/src/react/ApplePayButton.js.map +0 -1
  80. package/dist/src/react/applePayUrl.js.map +0 -1
  81. package/dist/src/react/applePayUrl.test.js +0 -57
  82. package/dist/src/react/applePayUrl.test.js.map +0 -1
  83. package/dist/src/react/useMessage.js +0 -140
  84. package/dist/src/react/useMessage.js.map +0 -1
  85. package/dist/src/react/useMessage.test.js +0 -222
  86. package/dist/src/react/useMessage.test.js.map +0 -1
  87. package/dist/src/validation/validators/apple-pay-load-params-button-validator.js +0 -19
  88. package/dist/src/validation/validators/apple-pay-load-params-button-validator.js.map +0 -1
  89. package/dist/staging/fatzebra.css +0 -91
  90. package/dist/staging/fatzebra.js +0 -19565
  91. package/dist/staging/fatzebra.js.map +0 -1
  92. package/dist/staging/index.html +0 -247
  93. package/dist/validation/schemas/applepay/load-params.json +0 -31
  94. package/dist/validation/schemas/applepay/options.json +0 -42
  95. package/dist/validation/schemas/applepay/payment-intent.json +0 -42
  96. package/dist/validation/validators/apple-pay-load-params-button-validator.d.ts +0 -3
  97. package/dist/validation/validators/apple-pay-load-params-button-validator.js +0 -12
@@ -1,9 +0,0 @@
1
- import React, { HTMLProps } from "react";
2
- import * as FatZebra from "../shared/types";
3
- type FrameProps = {
4
- handlers: FatZebra.Handlers;
5
- config: FatZebra.PaymentConfig;
6
- iframeProps?: HTMLProps<HTMLIFrameElement>;
7
- };
8
- declare const ApplePay: ({ handlers, config, iframeProps }: FrameProps) => React.JSX.Element;
9
- export default ApplePay;
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import useFatZebra from "./useFatZebra";
3
- const ApplePay = ({ handlers, config, iframeProps }) => {
4
- const { applePayUrl } = useFatZebra({
5
- config: Object.assign(Object.assign({}, config), { options: Object.assign(Object.assign({}, config.options), { applepay: true }) }),
6
- handlers: handlers,
7
- });
8
- return (React.createElement("div", null,
9
- React.createElement("iframe", Object.assign({ src: applePayUrl, allow: "payment", "data-test-id": "apple-pay", title: "apple-pay-button" }, iframeProps))));
10
- };
11
- export default ApplePay;
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import * as FatZebra from "../shared/types";
3
- type FrameProps = {
4
- handlers: FatZebra.Handlers;
5
- config: FatZebra.PaymentConfig;
6
- };
7
- declare const ApplePayButton: ({ handlers, config }: FrameProps) => React.JSX.Element;
8
- export default ApplePayButton;
@@ -1,18 +0,0 @@
1
- import React, { useEffect } from "react";
2
- import { ApplePay } from "../applepay";
3
- import useMessage from "./useMessage";
4
- const ApplePayButton = ({ handlers, config }) => {
5
- useMessage({
6
- paymentIntent: config.paymentIntent,
7
- handlers: handlers,
8
- });
9
- useEffect(() => {
10
- new ApplePay(config).load({
11
- containerId: 'applePayButton',
12
- paymentIntent: config.paymentIntent,
13
- options: config.options
14
- });
15
- }, []);
16
- return React.createElement("div", { id: "applePayButton", style: { height: '100%', width: '100%' } });
17
- };
18
- export default ApplePayButton;
@@ -1,19 +0,0 @@
1
- import { parseTemplate } from 'url-template';
2
- import env, { Environment } from "../shared/env";
3
- const generateApplePayUrl = (values, environment) => {
4
- const queryParts = [
5
- "applepay"
6
- ];
7
- const environmentConfig = env[environment || Environment.sandbox];
8
- const urlTemplate = parseTemplate(`${environmentConfig.payNowUrl}/sdk/{merchant}/{reference}/{currency}/{amount}/{verification}{?${queryParts.join(",")}}`);
9
- const url = urlTemplate.expand({
10
- merchant: values.merchant,
11
- reference: values.reference,
12
- currency: values.currency,
13
- amount: values.amount,
14
- verification: values.hash,
15
- applepay: values.applepay
16
- });
17
- return url;
18
- };
19
- export { generateApplePayUrl };
@@ -1,10 +0,0 @@
1
- import * as FatZebra from "../shared/types";
2
- import Sca from "../sca";
3
- type UseMessageProps = {
4
- paymentIntent: FatZebra.PaymentIntent;
5
- handlers: FatZebra.Handlers;
6
- options?: FatZebra.OptionalUrlValues;
7
- sca?: InstanceType<typeof Sca>;
8
- };
9
- declare const useMessage: ({ paymentIntent, options, handlers, sca }: UseMessageProps) => void;
10
- export default useMessage;
@@ -1,70 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { useEffect } from 'react';
11
- import * as FatZebra from "../shared/types";
12
- const useMessage = ({ paymentIntent, options, handlers, sca }) => {
13
- const emit = (event, data) => {
14
- const handler = handlers[event];
15
- if (handler) {
16
- handler(new CustomEvent(event, { detail: data }));
17
- }
18
- };
19
- const handleTokenizeCardResponse = (data) => __awaiter(void 0, void 0, void 0, function* () {
20
- if (data.errors) {
21
- emit(FatZebra.PublicEvent.TOKENIZATION_ERROR, {
22
- message: "Card tokenization failed.",
23
- errors: data.errors,
24
- data: null,
25
- });
26
- return;
27
- }
28
- else {
29
- emit(FatZebra.PublicEvent.TOKENIZATION_SUCCESS, {
30
- message: "Card tokenization success.",
31
- data,
32
- });
33
- }
34
- if (options && sca && options.sca_enabled) {
35
- yield sca.run({ paymentIntent, bin: data.bin, cardToken: data.token });
36
- }
37
- });
38
- const messageHandler = (event) => __awaiter(void 0, void 0, void 0, function* () {
39
- if (event.data &&
40
- event.data.source &&
41
- event.data.source.includes("react-devtools"))
42
- return;
43
- if (event.data.subject === FatZebra.BridgeEvent.BIN_LOOKUP)
44
- return;
45
- if (event.data.subject === FatZebra.BridgeEvent.FORM_VALIDATION_ERROR) {
46
- emit(FatZebra.PublicEvent.FORM_VALIDATION_ERROR, {
47
- errors: event.data.data,
48
- data: null,
49
- });
50
- return;
51
- }
52
- if (event.data.subject === FatZebra.BridgeEvent.FORM_VALIDATION_SUCCESS) {
53
- emit(FatZebra.PublicEvent.FORM_VALIDATION_SUCCESS, {
54
- errors: event.data.data,
55
- data: null,
56
- });
57
- return;
58
- }
59
- if (event.data.subject === FatZebra.BridgeEvent.TOKENIZE_CARD_RESPONSE) {
60
- yield handleTokenizeCardResponse(event.data.data);
61
- }
62
- });
63
- useEffect(() => {
64
- window.addEventListener("message", messageHandler);
65
- return () => {
66
- window.removeEventListener("message", messageHandler);
67
- };
68
- }, [paymentIntent]);
69
- };
70
- export default useMessage;
@@ -1,91 +0,0 @@
1
- .checkout-button-wrapper {
2
- display: flex;
3
- justify-content: center;
4
- align-items: center;
5
- height: 200px;
6
- }
7
-
8
- .iframe-checkout {
9
- flex: 1;
10
- border: none;
11
- width: 100%;
12
- height: 100%;
13
- min-height: 0;
14
- overflow: auto;
15
- -webkit-overflow-scrolling: touch;
16
- }
17
-
18
- .iframe-foreground,
19
- .iframe-background {
20
- top: 0;
21
- left: 0;
22
- right: 0;
23
- bottom: 0;
24
- flex-direction: column;
25
- }
26
-
27
- .iframe-foreground,
28
- .iframe-background {
29
- position: fixed;
30
- }
31
-
32
- .iframe-foreground {
33
- z-index: -1;
34
- }
35
-
36
- .iframe-background {
37
- background: rgba(0, 0, 0, 0.5);
38
- }
39
-
40
- .iframe-foreground {
41
- flex-grow: 1;
42
- top: auto;
43
- width: 100%;
44
- max-width: 480px;
45
- height: 80vh;
46
- background-color: #ffffff;
47
- border-radius: 25px 25px 0 0;
48
- }
49
-
50
- .slide-in .iframe-foreground {
51
- transform: translateY(100vh);
52
- transition: transform 0.4s ease, z-index 0.3s ease 0.4s;
53
- z-index: -1;
54
- }
55
-
56
- .slide-in .iframe-background {
57
- opacity: 0;
58
- z-index: -1;
59
- transition: opacity 0.3s ease, z-index 0.3s ease 0.3s;
60
- }
61
-
62
- .slide-in.show .iframe-foreground {
63
- transform: none;
64
- transition: transform 0.4s ease;
65
- z-index: 100;
66
- }
67
-
68
- .slide-in.show .iframe-background {
69
- opacity: 1;
70
- z-index: 0;
71
- transition: opacity 0.3s ease;
72
- }
73
-
74
- @media only screen and (min-width: 480px) {
75
- .iframe-foreground {
76
- margin: 0 auto;
77
- }
78
- }
79
-
80
- @media only screen and (min-width: 768px) {
81
- .iframe-foreground {
82
- margin: 0;
83
- width: 400px;
84
- height: 100vh;
85
- left: 0;
86
- }
87
-
88
- .slide-in .iframe-foreground {
89
- transform: translateX(-400px);
90
- }
91
- }