@fat-zebra/sdk 1.5.8-beta.3 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +9 -3
- package/dist/applepay/applepay.js +6 -31
- package/dist/applepay/clients/paynow-client.js +1 -1
- package/dist/main.js +3 -3
- package/dist/production/fatzebra.js +7 -1
- package/dist/production/fatzebra.js.LICENSE.txt +1 -3
- package/dist/react/useNotification.d.ts +11 -0
- package/dist/react/useNotification.js +26 -0
- package/dist/sandbox/fatzebra.js +7 -1
- package/dist/sandbox/fatzebra.js.LICENSE.txt +1 -1
- package/dist/sca/index.js +2 -2
- package/dist/sca/scenarios/enrollment.js +2 -2
- package/dist/sca/scenarios/validation.js +3 -3
- package/dist/staging/fatzebra.js +198 -89
- package/dist/staging/fatzebra.js.map +1 -1
- package/dist/validation/schemas/click-to-pay/load-params.json +2 -2
- package/dist/validation/schemas/hpp-load-params.json +2 -2
- package/dist/validation/schemas/payment-intent.json +0 -3
- package/dist/validation/schemas/payment-method.json +17 -49
- package/dist/validation/validation-helper.js +2 -1
- package/dist/validation/validators/apple-pay-load-params-button-validator.d.ts +1 -2
- package/dist/validation/validators/apple-pay-load-params-button-validator.js +1 -2
- package/dist/validation/validators/click-to-pay-load-params-validator.d.ts +1 -2
- package/dist/validation/validators/click-to-pay-load-params-validator.js +1 -2
- package/dist/validation/validators/hpp-load-params-validator.d.ts +1 -2
- package/dist/validation/validators/hpp-load-params-validator.js +5 -4
- package/dist/validation/validators/verify-card-params-validator.d.ts +1 -2
- package/dist/validation/validators/verify-card-params-validator.js +5 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Environment } from "../shared/env";
|
|
2
|
+
import { PublicEvent } from "../shared/types";
|
|
3
|
+
type UseMessageProps = {
|
|
4
|
+
username: string;
|
|
5
|
+
environment: Environment;
|
|
6
|
+
subscriptions: Array<PublicEvent>;
|
|
7
|
+
};
|
|
8
|
+
declare const useNotification: ({ username, environment, subscriptions }: UseMessageProps) => {
|
|
9
|
+
events: any[];
|
|
10
|
+
};
|
|
11
|
+
export default useNotification;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import FatZebra from "../main";
|
|
3
|
+
import { Environment } from "../shared/env";
|
|
4
|
+
const useNotification = ({ username, environment, subscriptions }) => {
|
|
5
|
+
const [events, setEvents] = useState([]);
|
|
6
|
+
// Generic handler for all events
|
|
7
|
+
const handleEvent = (event) => {
|
|
8
|
+
console.log("this is the event", event);
|
|
9
|
+
if (event === null || event === void 0 ? void 0 : event.type) {
|
|
10
|
+
setEvents((prev) => [...prev, event]);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const fz = new FatZebra({ username, test: environment === Environment.test });
|
|
15
|
+
subscriptions.forEach((event) => {
|
|
16
|
+
fz.on(event, handleEvent);
|
|
17
|
+
});
|
|
18
|
+
return () => {
|
|
19
|
+
subscriptions.forEach((event) => {
|
|
20
|
+
fz.off(event, handleEvent); // if off is supported with a handler ref
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
}, [username, environment, subscriptions]);
|
|
24
|
+
return { events };
|
|
25
|
+
};
|
|
26
|
+
export default useNotification;
|