@glomopay/react-native-sdk 4.1.0 → 5.0.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.
- package/CHANGELOG.md +29 -0
- package/MIGRATION.md +112 -0
- package/README.md +173 -36
- package/lib/bridge/file-input-handler.d.ts +25 -0
- package/lib/bridge/file-input-handler.d.ts.map +1 -0
- package/lib/bridge/file-input-handler.js +38 -0
- package/lib/bridge/file-save-handler.d.ts +32 -0
- package/lib/bridge/file-save-handler.d.ts.map +1 -0
- package/lib/bridge/file-save-handler.js +92 -0
- package/lib/bridge/message-router.d.ts +44 -0
- package/lib/bridge/message-router.d.ts.map +1 -0
- package/lib/bridge/message-router.js +48 -0
- package/lib/bridge/payment-payload.d.ts +18 -0
- package/lib/bridge/payment-payload.d.ts.map +1 -0
- package/lib/bridge/payment-payload.js +31 -0
- package/lib/capabilities/file-save.d.ts +40 -0
- package/lib/capabilities/file-save.d.ts.map +1 -0
- package/lib/capabilities/file-save.js +101 -0
- package/lib/capabilities/index.d.ts +22 -0
- package/lib/capabilities/index.d.ts.map +1 -0
- package/lib/capabilities/index.js +34 -0
- package/lib/capabilities/use-capability-reporting.d.ts +24 -0
- package/lib/capabilities/use-capability-reporting.d.ts.map +1 -0
- package/lib/capabilities/use-capability-reporting.js +44 -0
- package/lib/config/base.d.ts +12 -0
- package/lib/config/base.d.ts.map +1 -1
- package/lib/config/base.js +13 -1
- package/lib/glomo-checkout.d.ts +6 -1
- package/lib/glomo-checkout.d.ts.map +1 -1
- package/lib/glomo-checkout.js +11 -5
- package/lib/glomo-lrs-checkout.d.ts.map +1 -1
- package/lib/glomo-lrs-checkout.js +33 -10
- package/lib/glomo-standard-checkout.d.ts +3 -1
- package/lib/glomo-standard-checkout.d.ts.map +1 -1
- package/lib/glomo-standard-checkout.js +21 -13
- package/lib/glomo-subscriptions-checkout.d.ts.map +1 -1
- package/lib/glomo-subscriptions-checkout.js +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -3
- package/lib/injections/index.d.ts +24 -0
- package/lib/injections/index.d.ts.map +1 -1
- package/lib/injections/index.js +41 -0
- package/lib/injections/webview-flow.injection.d.ts.map +1 -1
- package/lib/injections/webview-flow.injection.js +76 -0
- package/lib/injections/webview-main.injection.d.ts.map +1 -1
- package/lib/injections/webview-main.injection.js +31 -0
- package/lib/injections/webview-standard.injection.d.ts.map +1 -1
- package/lib/injections/webview-standard.injection.js +31 -0
- package/lib/services/file-saver.d.ts +109 -0
- package/lib/services/file-saver.d.ts.map +1 -0
- package/lib/services/file-saver.js +416 -0
- package/lib/types/checkout.d.ts +58 -6
- package/lib/types/checkout.d.ts.map +1 -1
- package/lib/types/checkout.js +24 -2
- package/lib/types/standard-checkout.d.ts +6 -6
- package/lib/types/standard-checkout.d.ts.map +1 -1
- package/lib/types/subscriptions-checkout.d.ts +3 -3
- package/lib/types/subscriptions-checkout.d.ts.map +1 -1
- package/lib/use-glomo-checkout.js +2 -2
- package/lib/use-lrs-checkout.d.ts +9 -5
- package/lib/use-lrs-checkout.d.ts.map +1 -1
- package/lib/use-lrs-checkout.js +317 -171
- package/lib/use-standard-checkout.d.ts +17 -13
- package/lib/use-standard-checkout.d.ts.map +1 -1
- package/lib/use-standard-checkout.js +281 -207
- package/lib/utils/analytics.d.ts +177 -51
- package/lib/utils/analytics.d.ts.map +1 -1
- package/lib/utils/analytics.js +299 -81
- package/lib/utils/device-compliance.d.ts +57 -12
- package/lib/utils/device-compliance.d.ts.map +1 -1
- package/lib/utils/device-compliance.js +101 -37
- package/lib/utils/event-projections.d.ts +56 -0
- package/lib/utils/event-projections.d.ts.map +1 -0
- package/lib/utils/event-projections.js +42 -0
- package/lib/utils/file-metadata.d.ts +52 -0
- package/lib/utils/file-metadata.d.ts.map +1 -0
- package/lib/utils/file-metadata.js +134 -0
- package/lib/utils/use-sdk-session.d.ts +12 -0
- package/lib/utils/use-sdk-session.d.ts.map +1 -0
- package/lib/utils/use-sdk-session.js +37 -0
- package/lib/utils/validation.d.ts +37 -3
- package/lib/utils/validation.d.ts.map +1 -1
- package/lib/utils/validation.js +64 -8
- package/lib/webview/capability-props.d.ts +27 -0
- package/lib/webview/capability-props.d.ts.map +1 -0
- package/lib/webview/capability-props.js +61 -0
- package/lib/webview/use-permission-request.d.ts +33 -0
- package/lib/webview/use-permission-request.d.ts.map +1 -0
- package/lib/webview/use-permission-request.js +89 -0
- package/package.json +10 -2
- package/src/bridge/file-input-handler.ts +66 -0
- package/src/bridge/file-save-handler.ts +141 -0
- package/src/bridge/message-router.ts +92 -0
- package/src/bridge/payment-payload.ts +31 -0
- package/src/capabilities/file-save.ts +124 -0
- package/src/capabilities/index.ts +34 -0
- package/src/capabilities/use-capability-reporting.ts +55 -0
- package/src/config/base.ts +13 -0
- package/src/glomo-checkout.tsx +11 -7
- package/src/glomo-lrs-checkout.tsx +41 -26
- package/src/glomo-standard-checkout.tsx +31 -34
- package/src/glomo-subscriptions-checkout.tsx +1 -0
- package/src/index.ts +4 -2
- package/src/injections/index.ts +43 -0
- package/src/injections/webview-flow.injection.ts +76 -0
- package/src/injections/webview-main.injection.ts +31 -0
- package/src/injections/webview-standard.injection.ts +31 -0
- package/src/services/file-saver.ts +497 -0
- package/src/types/checkout.ts +62 -6
- package/src/types/standard-checkout.ts +6 -6
- package/src/types/subscriptions-checkout.ts +7 -3
- package/src/use-glomo-checkout.tsx +2 -2
- package/src/use-lrs-checkout.tsx +656 -365
- package/src/use-standard-checkout.tsx +728 -466
- package/src/utils/analytics.ts +422 -117
- package/src/utils/device-compliance.ts +148 -38
- package/src/utils/event-projections.ts +74 -0
- package/src/utils/file-metadata.ts +140 -0
- package/src/utils/use-sdk-session.ts +41 -0
- package/src/utils/validation.ts +70 -10
- package/src/webview/capability-props.ts +86 -0
- package/src/webview/use-permission-request.ts +114 -0
- package/src/jail-monkey.d.ts +0 -19
|
@@ -3,17 +3,10 @@ import React from "react";
|
|
|
3
3
|
import { type NativeSyntheticEvent } from "react-native";
|
|
4
4
|
import { type WebViewNavigation, type WebViewMessageEvent, type WebView } from "react-native-webview";
|
|
5
5
|
import { type GlomoServer } from "./config/base";
|
|
6
|
-
import { type
|
|
7
|
-
import { type
|
|
6
|
+
import { type WebViewPermissionRequest } from "./webview/use-permission-request";
|
|
7
|
+
import { type SdkError, type FlowType, type CheckoutAnalyticsTrackers } from "./utils/analytics";
|
|
8
|
+
import { type GlomoTerminationPayload, type GlomoUserJourneyCompletedPayload } from "./types/checkout";
|
|
8
9
|
import { type StandardCheckoutStatus, type GlomoStandardCheckoutPayload } from "./types/standard-checkout";
|
|
9
|
-
/** Android-only WebView permission request, not yet in react-native-webview type definitions */
|
|
10
|
-
export interface WebViewPermissionRequest {
|
|
11
|
-
nativeEvent: {
|
|
12
|
-
resources: string[];
|
|
13
|
-
};
|
|
14
|
-
grant: (resources: string[]) => void;
|
|
15
|
-
deny: () => void;
|
|
16
|
-
}
|
|
17
10
|
/** The options for the useStandardCheckout hook */
|
|
18
11
|
export interface UseStandardCheckoutOptions {
|
|
19
12
|
server?: GlomoServer;
|
|
@@ -22,10 +15,10 @@ export interface UseStandardCheckoutOptions {
|
|
|
22
15
|
onPaymentSuccess: (payload: GlomoStandardCheckoutPayload) => void;
|
|
23
16
|
onPaymentFailure: (payload: GlomoStandardCheckoutPayload) => void;
|
|
24
17
|
onConnectionError?: (error: unknown) => void;
|
|
25
|
-
onPaymentTerminate?: () => void;
|
|
18
|
+
onPaymentTerminate?: (payload: GlomoTerminationPayload) => void;
|
|
26
19
|
onSdkError: (error: Array<SdkError>) => void;
|
|
27
20
|
onUserJourneyCompleted?: (payload: GlomoUserJourneyCompletedPayload) => void;
|
|
28
|
-
|
|
21
|
+
onUserRefusedDevicePermissions?: () => void;
|
|
29
22
|
devMode?: boolean;
|
|
30
23
|
}
|
|
31
24
|
/** The return values for the useStandardCheckout hook */
|
|
@@ -63,9 +56,20 @@ export interface UseStandardCheckoutReturn {
|
|
|
63
56
|
*/
|
|
64
57
|
export interface UseStandardCheckoutInternalOptions {
|
|
65
58
|
analyticsTrackers?: CheckoutAnalyticsTrackers;
|
|
59
|
+
/**
|
|
60
|
+
* Which flow this hook is serving, for the telemetry that is not routed through
|
|
61
|
+
* analyticsTrackers.
|
|
62
|
+
*
|
|
63
|
+
* The tracker map cannot answer this: its whole purpose is that the caller picks a set of
|
|
64
|
+
* flow-specific functions, so a flow-indifferent event has nothing to look up there. File saves
|
|
65
|
+
* are the first of those - the capability is advertised to every WebView regardless of flow -
|
|
66
|
+
* and putting them in the map would re-couple a capability to a flow, which is the thing v5
|
|
67
|
+
* exists to undo.
|
|
68
|
+
*/
|
|
69
|
+
flowType?: FlowType;
|
|
66
70
|
_skipOrderIdValidation?: boolean;
|
|
67
71
|
_testInjectionScript?: string;
|
|
68
72
|
}
|
|
69
73
|
/** The main SDK hook for the GlomoPay Standard Checkout flow */
|
|
70
|
-
export declare function useStandardCheckout({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, onUserJourneyCompleted,
|
|
74
|
+
export declare function useStandardCheckout({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, onUserJourneyCompleted, onUserRefusedDevicePermissions, devMode, }: UseStandardCheckoutOptions, mockMode: boolean, internalOptions?: UseStandardCheckoutInternalOptions): UseStandardCheckoutReturn;
|
|
71
75
|
//# sourceMappingURL=use-standard-checkout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-standard-checkout.d.ts","sourceRoot":"","sources":["../src/use-standard-checkout.tsx"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,
|
|
1
|
+
{"version":3,"file":"use-standard-checkout.d.ts","sourceRoot":"","sources":["../src/use-standard-checkout.tsx"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,OAAO,KAA4D,MAAM,OAAO,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