@glomopay/react-native-sdk 4.0.0 → 4.1.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.
@@ -5,5 +5,8 @@
5
5
  */
6
6
  import React from "react";
7
7
  import { type GlomoCheckoutRef, type GlomoCheckoutProps } from "./types/checkout";
8
+ /**
9
+ * Internal props if provided, should be used for automated testing only
10
+ */
8
11
  export declare const GlomoCheckout: React.ForwardRefExoticComponent<GlomoCheckoutProps & React.RefAttributes<GlomoCheckoutRef>>;
9
12
  //# sourceMappingURL=glomo-checkout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"glomo-checkout.d.ts","sourceRoot":"","sources":["../src/glomo-checkout.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAsE,MAAM,OAAO,CAAC;AAG3F,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAqHlF,eAAO,MAAM,aAAa,6FAA2E,CAAC"}
1
+ {"version":3,"file":"glomo-checkout.d.ts","sourceRoot":"","sources":["../src/glomo-checkout.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAsE,MAAM,OAAO,CAAC;AAG3F,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAmC,MAAM,kBAAkB,CAAC;AA6HnH;;GAEG;AACH,eAAO,MAAM,aAAa,EAAyC,KAAK,CAAC,yBAAyB,CAC9F,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAC7D,CAAC"}
@@ -70,15 +70,15 @@ function GlomoCheckoutComponent(props, ref) {
70
70
  }, [orderType, hasUserJourneyCallback, passedProps.subscriptionId, passedProps.publicKey, devMode, mockMode]);
71
71
  // Delegating to the LRS checkout component once order type is resolved as LRS
72
72
  if (orderType === "lrs") {
73
- return (<glomo_lrs_checkout_1.GlomoLrsCheckout ref={innerLrsRef} server={passedProps.server} publicKey={passedProps.publicKey} orderId={passedProps.orderId} onPaymentSuccess={passedProps.onPaymentSuccess} onPaymentFailure={passedProps.onPaymentFailure} onConnectionError={passedProps.onConnectionError} onPaymentTerminate={passedProps.onPaymentTerminate} onSdkError={passedProps.onSdkError} devMode={passedProps.devMode}/>);
73
+ return (<glomo_lrs_checkout_1.GlomoLrsCheckout ref={innerLrsRef} server={passedProps.server} publicKey={passedProps.publicKey} orderId={passedProps.orderId} onPaymentSuccess={passedProps.onPaymentSuccess} onPaymentFailure={passedProps.onPaymentFailure} onConnectionError={passedProps.onConnectionError} onPaymentTerminate={passedProps.onPaymentTerminate} onSdkError={passedProps.onSdkError} devMode={passedProps.devMode} _testInjectionScript={props._testInjectionScript} _testCarouselInjectionScript={props._testCarouselInjectionScript} _onEducationCarouselStateChange={props._onEducationCarouselStateChange}/>);
74
74
  }
75
75
  // Delegating to the Standard checkout component once order type is resolved as Standard
76
76
  if (orderType === "standard") {
77
- return (<glomo_standard_checkout_1.GlomoStandardCheckout ref={innerStandardRef} server={passedProps.server} publicKey={passedProps.publicKey} orderId={passedProps.orderId} onPaymentSuccess={passedProps.onPaymentSuccess} onPaymentFailure={passedProps.onPaymentFailure} onConnectionError={passedProps.onConnectionError} onPaymentTerminate={passedProps.onPaymentTerminate} onSdkError={passedProps.onSdkError} onUserJourneyCompleted={passedProps.onUserJourneyCompleted} onUserRefusedCameraPermissions={passedProps.onUserRefusedCameraPermissions} devMode={passedProps.devMode}/>);
77
+ return (<glomo_standard_checkout_1.GlomoStandardCheckoutInternal ref={innerStandardRef} server={passedProps.server} publicKey={passedProps.publicKey} orderId={passedProps.orderId} onPaymentSuccess={passedProps.onPaymentSuccess} onPaymentFailure={passedProps.onPaymentFailure} onConnectionError={passedProps.onConnectionError} onPaymentTerminate={passedProps.onPaymentTerminate} onSdkError={passedProps.onSdkError} onUserJourneyCompleted={passedProps.onUserJourneyCompleted} onUserRefusedCameraPermissions={passedProps.onUserRefusedCameraPermissions} devMode={passedProps.devMode} _testInjectionScript={props._testInjectionScript}/>);
78
78
  }
79
79
  // Delegating to the Subscriptions checkout component when subscriptionId is provided (no API call)
80
80
  if (orderType === "subscriptions") {
81
- return (<glomo_subscriptions_checkout_1.GlomoSubscriptionsCheckout ref={innerSubscriptionsRef} server={passedProps.server} publicKey={passedProps.publicKey} subscriptionId={passedProps.subscriptionId} onPaymentSuccess={passedProps.onPaymentSuccess} onPaymentFailure={passedProps.onPaymentFailure} onConnectionError={passedProps.onConnectionError} onPaymentTerminate={passedProps.onPaymentTerminate} onSdkError={passedProps.onSdkError} onUserJourneyCompleted={passedProps.onUserJourneyCompleted} onUserRefusedCameraPermissions={passedProps.onUserRefusedCameraPermissions} devMode={passedProps.devMode}/>);
81
+ return (<glomo_subscriptions_checkout_1.GlomoSubscriptionsCheckout ref={innerSubscriptionsRef} server={passedProps.server} publicKey={passedProps.publicKey} subscriptionId={passedProps.subscriptionId} onPaymentSuccess={passedProps.onPaymentSuccess} onPaymentFailure={passedProps.onPaymentFailure} onConnectionError={passedProps.onConnectionError} onPaymentTerminate={passedProps.onPaymentTerminate} onSdkError={passedProps.onSdkError} onUserJourneyCompleted={passedProps.onUserJourneyCompleted} onUserRefusedCameraPermissions={passedProps.onUserRefusedCameraPermissions} devMode={passedProps.devMode} _testInjectionScript={props._testInjectionScript}/>);
82
82
  }
83
83
  /**
84
84
  * No modal for detecting state - avoids iOS pageSheet conflict where
@@ -87,5 +87,8 @@ function GlomoCheckoutComponent(props, ref) {
87
87
  */
88
88
  return null;
89
89
  }
90
+ /**
91
+ * Internal props if provided, should be used for automated testing only
92
+ */
90
93
  exports.GlomoCheckout = (0, react_1.forwardRef)(GlomoCheckoutComponent);
91
94
  exports.GlomoCheckout.displayName = "GlomoCheckout";
@@ -5,6 +5,9 @@ import { type SdkError } from "./utils/analytics";
5
5
  export interface GlomoLrsCheckoutProps extends UseLrsCheckoutOptions {
6
6
  visible?: boolean;
7
7
  onSdkError: (error: Array<SdkError>) => void;
8
+ _testInjectionScript?: string;
9
+ _testCarouselInjectionScript?: string;
10
+ _onEducationCarouselStateChange?: (state: string) => void;
8
11
  }
9
12
  export interface GlomoLrsCheckoutRef {
10
13
  start: () => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"glomo-lrs-checkout.d.ts","sourceRoot":"","sources":["../src/glomo-lrs-checkout.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAE1C,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAkB,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxG,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAChE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;CAChD;AAED,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,iBAAiB,CAAC;CACtC;AA2WD,eAAO,MAAM,gBAAgB,mGAAoF,CAAC"}
1
+ {"version":3,"file":"glomo-lrs-checkout.d.ts","sourceRoot":"","sources":["../src/glomo-lrs-checkout.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAE1C,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAkB,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxG,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAChE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IAC7C,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,+BAA+B,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7D;AAED,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,iBAAiB,CAAC;CACtC;AA+WD,eAAO,MAAM,gBAAgB,mGAAoF,CAAC"}
@@ -59,7 +59,7 @@ const validation_1 = require("./utils/validation");
59
59
  *
60
60
  * @param visible - Advanced: If provided, the component visibility will be controlled by the visible prop. Otherwise, the component will be controlled internally by the SDK.
61
61
  */
62
- function GlomoLrsCheckoutComponent({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, devMode = false, visible: controlledVisible, }, ref) {
62
+ function GlomoLrsCheckoutComponent({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, devMode = false, visible: controlledVisible, _testInjectionScript, _testCarouselInjectionScript, _onEducationCarouselStateChange, }, ref) {
63
63
  // Computing mockMode based on the publicKey prefix
64
64
  const mockMode = (0, react_1.useMemo)(() => {
65
65
  var _a;
@@ -79,7 +79,7 @@ function GlomoLrsCheckoutComponent({ server, publicKey, orderId, onPaymentSucces
79
79
  onPaymentTerminate,
80
80
  onSdkError,
81
81
  devMode,
82
- }, mockMode);
82
+ }, mockMode, { _testInjectionScript, _testCarouselInjectionScript, _onEducationCarouselStateChange });
83
83
  // Exposing the start() and getStatus() methods via the ref
84
84
  (0, react_1.useImperativeHandle)(ref, () => ({
85
85
  start,
@@ -10,6 +10,7 @@ import { type CheckoutAnalyticsTrackers } from "./utils/analytics";
10
10
  export interface GlomoStandardCheckoutInternalProps extends GlomoStandardCheckoutProps {
11
11
  _analyticsTrackers?: CheckoutAnalyticsTrackers;
12
12
  _skipOrderIdValidation?: boolean;
13
+ _testInjectionScript?: string;
13
14
  }
14
15
  /**
15
16
  * Widening the internal type to GlomoStandardCheckoutInternalProps for internal SDK use,
@@ -1 +1 @@
1
- {"version":3,"file":"glomo-standard-checkout.d.ts","sourceRoot":"","sources":["../src/glomo-standard-checkout.tsx"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAC3G,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAGnE;;;;GAIG;AACH,MAAM,WAAW,kCAAmC,SAAQ,0BAA0B;IAClF,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;IAC/C,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACpC;AA+PD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAiD,KAAK,CAAC,yBAAyB,CAC9G,0BAA0B,GAAG,KAAK,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAC7E,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,qHAEzC,CAAC"}
1
+ {"version":3,"file":"glomo-standard-checkout.d.ts","sourceRoot":"","sources":["../src/glomo-standard-checkout.tsx"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C,OAAO,KAAmD,MAAM,OAAO,CAAC;AAKxE,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAC3G,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAGnE;;;;GAIG;AACH,MAAM,WAAW,kCAAmC,SAAQ,0BAA0B;IAClF,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;IAC/C,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAgQD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAiD,KAAK,CAAC,yBAAyB,CAC9G,0BAA0B,GAAG,KAAK,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAC7E,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,qHAEzC,CAAC"}
@@ -57,7 +57,7 @@ const validation_1 = require("./utils/validation");
57
57
  * @param ref - The ref for the component
58
58
  * @param devMode - Turn on to see all logs, warnings, and errors in the console. Off by default
59
59
  */
60
- function GlomoStandardCheckoutComponent({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, onUserJourneyCompleted, onUserRefusedCameraPermissions, devMode = false, _analyticsTrackers, _skipOrderIdValidation, }, ref) {
60
+ function GlomoStandardCheckoutComponent({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, onUserJourneyCompleted, onUserRefusedCameraPermissions, devMode = false, _analyticsTrackers, _skipOrderIdValidation, _testInjectionScript, }, ref) {
61
61
  // Computing mockMode based on the publicKey prefix
62
62
  const mockMode = (0, react_1.useMemo)(() => {
63
63
  var _a;
@@ -79,7 +79,7 @@ function GlomoStandardCheckoutComponent({ server, publicKey, orderId, onPaymentS
79
79
  onUserJourneyCompleted,
80
80
  onUserRefusedCameraPermissions,
81
81
  devMode,
82
- }, mockMode, { analyticsTrackers: _analyticsTrackers, _skipOrderIdValidation });
82
+ }, mockMode, { analyticsTrackers: _analyticsTrackers, _skipOrderIdValidation, _testInjectionScript });
83
83
  // Exposing the start() and getStatus() methods via the ref
84
84
  (0, react_1.useImperativeHandle)(ref, () => ({
85
85
  start,
@@ -35,6 +35,15 @@ export interface GlomoCheckoutRef {
35
35
  start: () => Promise<boolean>;
36
36
  getStatus: () => CheckoutStatus;
37
37
  }
38
+ /**
39
+ * Internal-only props for automated testing
40
+ */
41
+ export interface GlomoCheckoutInternalProps {
42
+ _testInjectionScript?: string;
43
+ _testCarouselInjectionScript?: string;
44
+ _forceOrderType?: "standard" | "lrs";
45
+ _onEducationCarouselStateChange?: (state: string) => void;
46
+ }
38
47
  /** Shared callback and configuration props for the unified checkout component */
39
48
  interface GlomoCheckoutBaseProps {
40
49
  server?: GlomoServer;
@@ -1 +1 @@
1
- {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/types/checkout.ts"],"names":[],"mappings":"AAAA,oDAAoD;AAEpD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,uFAAuF;AACvF,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,oBAAY,oBAAoB;IAC5B,uBAAuB,4BAA4B;IACnD,sBAAsB,2BAA2B;CACpD;AAED,0DAA0D;AAC1D,MAAM,WAAW,gCAAgC;IAC7C,WAAW,EAAE,oBAAoB,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,sEAAsE;AACtE,MAAM,MAAM,cAAc,GACpB,OAAO,GACP,sBAAsB,GACtB,qBAAqB,GACrB,oBAAoB,GACpB,gBAAgB,GAChB,mBAAmB,GACnB,yBAAyB,GACzB,wBAAwB,CAAC;AAE/B;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,SAAS,EAAE,MAAM,cAAc,CAAC;CACnC;AAED,iFAAiF;AACjF,UAAU,sBAAsB;IAC5B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC1D,gBAAgB,EAAE,CAAC,OAAO,EAA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C;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC"}
@@ -16,6 +16,8 @@ export interface GlomoSubscriptionsCheckoutProps {
16
16
  onUserJourneyCompleted?: (payload: GlomoUserJourneyCompletedPayload) => void;
17
17
  onUserRefusedCameraPermissions?: () => void;
18
18
  devMode?: boolean;
19
+ /** Internal prop for automated tests - forwarded to GlomoStandardCheckoutInternal via rest spread */
20
+ _testInjectionScript?: string;
19
21
  }
20
22
  /**
21
23
  * Ref handle for the subscriptions checkout component.
@@ -1 +1 @@
1
- {"version":3,"file":"subscriptions-checkout.d.ts","sourceRoot":"","sources":["../../src/types/subscriptions-checkout.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAE3D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAC9F,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,qDAAqD;AACrD,MAAM,WAAW,+BAA+B;IAC5C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC1D,gBAAgB,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC1D,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,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AAC,EAAE,MAAM,IAAI,CAAC;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qGAAqG;IACrG,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC1C,KAAK,EAAE,MAAM,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,sBAAsB,CAAC;CAC3C"}
@@ -2,7 +2,7 @@
2
2
  * Unified wrapper hook - detects order type (LRS vs Standard) via the order API
3
3
  * and delegates to the appropriate inner checkout hook once resolved.
4
4
  */
5
- import { type GlomoCheckoutProps, type CheckoutStatus } from "./types/checkout";
5
+ import { type GlomoCheckoutProps, type GlomoCheckoutInternalProps, type CheckoutStatus } from "./types/checkout";
6
6
  import { type GlomoLrsCheckoutRef } from "./glomo-lrs-checkout";
7
7
  import { type GlomoStandardCheckoutRef } from "./types/standard-checkout";
8
8
  import { type GlomoSubscriptionsCheckoutRef } from "./types/subscriptions-checkout";
@@ -47,7 +47,7 @@ export interface UseGlomoCheckoutInternalReturn {
47
47
  * ```
48
48
  */
49
49
  export declare function useGlomoCheckout(props: GlomoCheckoutProps): UseGlomoCheckoutReturn;
50
- export declare function useGlomoCheckout(props: GlomoCheckoutProps, internalOptions: {
50
+ export declare function useGlomoCheckout(props: GlomoCheckoutProps & GlomoCheckoutInternalProps, internalOptions: {
51
51
  _suppressDeprecationWarning: true;
52
52
  }): UseGlomoCheckoutInternalReturn;
53
53
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"use-glomo-checkout.d.ts","sourceRoot":"","sources":["../src/use-glomo-checkout.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAA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AChE,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,KAAK,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAE,KAAK,SAAS,EAAkB,MAAM,+BAA+B,CAAC;AAU/E,kDAAkD;AAClD,KAAK,iBAAiB,GAAG,SAAS,GAAG,eAAe,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACnC,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,SAAS,EAAE,MAAM,cAAc,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,8BAA8B;IAC3C,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,SAAS,EAAE,MAAM,cAAc,CAAC;IAChC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAClD,gBAAgB,EAAE,KAAK,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;IAC5D,qBAAqB,EAAE,KAAK,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAAC;IACtE,KAAK,EAAE,kBAAkB,CAAC;CAC7B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,sBAAsB,CAAC;AACpF,wBAAgB,gBAAgB,CAC5B,KAAK,EAAE,kBAAkB,GAAG,0BAA0B,EACtD,eAAe,EAAE;IAAE,2BAA2B,EAAE,IAAI,CAAA;CAAE,GACvD,8BAA8B,CAAC"}
@@ -11,7 +11,7 @@ const validation_1 = require("./utils/validation");
11
11
  const analytics_1 = require("./utils/analytics");
12
12
  function useGlomoCheckout(props, internalOptions) {
13
13
  var _a, _b;
14
- const { server, publicKey, orderId, subscriptionId, onSdkError, devMode = false } = props;
14
+ const { server, publicKey, orderId, subscriptionId, onSdkError, devMode = false, _forceOrderType } = props;
15
15
  // Order type resolved from the API - null until detection completes
16
16
  const [orderType, setOrderType] = (0, react_1.useState)(null);
17
17
  // Whether order type detection is in progress
@@ -153,6 +153,27 @@ function useGlomoCheckout(props, internalOptions) {
153
153
  }
154
154
  return false;
155
155
  }
156
+ /**
157
+ * Bypassing the fetchOrderType API call
158
+ * and using the provided order type directly,
159
+ * if _forceOrderType is set.
160
+ *
161
+ * This is ONLY meant to be used by automated testing harnesses,
162
+ * to simulate a checkout without actual API calls.
163
+ *
164
+ * Only available in __DEV__ builds (debug)
165
+ */
166
+ if (__DEV__ && _forceOrderType) {
167
+ ++fetchGenerationRef.current;
168
+ if (devMode) {
169
+ console.log(`[Glomo-RN-SDK] Forcing order type: ${_forceOrderType}`);
170
+ }
171
+ setOrderType(_forceOrderType);
172
+ return new Promise((resolve) => {
173
+ pendingStartResolveRef.current = resolve;
174
+ pendingStartRef.current = true;
175
+ });
176
+ }
156
177
  // Detecting order type via the API
157
178
  setDetecting(true);
158
179
  const thisGeneration = ++fetchGenerationRef.current;
@@ -189,7 +210,7 @@ function useGlomoCheckout(props, internalOptions) {
189
210
  pendingStartResolveRef.current = resolve;
190
211
  pendingStartRef.current = true;
191
212
  });
192
- }, [devMode, publicKey, orderId, subscriptionId, server, onSdkError, propsError]);
213
+ }, [devMode, publicKey, orderId, subscriptionId, server, onSdkError, propsError, _forceOrderType]);
193
214
  /**
194
215
  * Auto-starting the inner component after order type is resolved and the component has rendered.
195
216
  * The pendingStartRef bridges the async gap: start() sets it, and this effect fires after
@@ -67,6 +67,14 @@ export interface UseLrsCheckoutReturn {
67
67
  injectedFlow?: string;
68
68
  injectedEducationCarousel?: string;
69
69
  }
70
- /** The main SDK hook for the GlomoPay LRS Checkout flow */
71
- export declare function useLrsCheckout({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, devMode, }: UseLrsCheckoutOptions, mockMode: boolean): UseLrsCheckoutReturn;
70
+ /**
71
+ * The main SDK hook for the GlomoPay LRS Checkout flow
72
+ * Internal options meant to simulate an LRS checkout are for automated tests only.
73
+ */
74
+ export interface UseLrsCheckoutInternalOptions {
75
+ _testInjectionScript?: string;
76
+ _testCarouselInjectionScript?: string;
77
+ _onEducationCarouselStateChange?: (state: string) => void;
78
+ }
79
+ export declare function useLrsCheckout({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, devMode, }: UseLrsCheckoutOptions, mockMode: boolean, internalOptions?: UseLrsCheckoutInternalOptions): UseLrsCheckoutReturn;
72
80
  //# sourceMappingURL=use-lrs-checkout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-lrs-checkout.d.ts","sourceRoot":"","sources":["../src/use-lrs-checkout.tsx"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAItG,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAGtE,OAAO,EAcH,KAAK,QAAQ,EAChB,MAAM,mBAAmB,CAAC;AAE3B,4BAA4B;AAC5B,MAAM,MAAM,iBAAiB,GAEvB,OAAO,GAGP,qBAAqB,GAGrB,oBAAoB,GAGpB,gBAAgB,GAGhB,mBAAmB;AAErB;;;GAGG;GACD,yBAAyB,GACzB,wBAAwB,CAAC;AAE/B;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,YAAY,CAAC;AAE9D,qDAAqD;AACrD,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED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QAAQ,EAAE,OAAO,EACjB,eAAe,CAAC,EAAE,6BAA6B,GAChD,oBAAoB,CA23BtB"}
@@ -10,8 +10,7 @@ const base_1 = require("./config/base");
10
10
  const validation_1 = require("./utils/validation");
11
11
  const device_compliance_1 = require("./utils/device-compliance");
12
12
  const analytics_1 = require("./utils/analytics");
13
- /** The main SDK hook for the GlomoPay LRS Checkout flow */
14
- function useLrsCheckout({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, devMode = false, }, mockMode) {
13
+ function useLrsCheckout({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, devMode = false, }, mockMode, internalOptions) {
15
14
  // Refs for the WebViews
16
15
  const mainWebViewRef = (0, react_1.useRef)(null);
17
16
  const flowWebViewRef = (0, react_1.useRef)(null);
@@ -86,7 +85,17 @@ function useLrsCheckout({ server, publicKey, orderId, onPaymentSuccess, onPaymen
86
85
  const [showCheckout, setShowCheckout] = (0, react_1.useState)(false);
87
86
  const [showFlowWebView, setShowFlowWebView] = (0, react_1.useState)(false);
88
87
  const [flowWebViewUrl, setFlowWebViewUrl] = (0, react_1.useState)("");
89
- const [educationCarouselState, setEducationCarouselState] = (0, react_1.useState)("pending");
88
+ const [educationCarouselState, setEducationCarouselStateRaw] = (0, react_1.useState)("pending");
89
+ /** Wrapping the raw state setter to also fire the internal test callback */
90
+ const testCarouselCallbackRef = (0, react_1.useRef)(internalOptions === null || internalOptions === void 0 ? void 0 : internalOptions._onEducationCarouselStateChange);
91
+ testCarouselCallbackRef.current = internalOptions === null || internalOptions === void 0 ? void 0 : internalOptions._onEducationCarouselStateChange;
92
+ const setEducationCarouselState = (0, react_1.useCallback)((nextState) => {
93
+ var _a;
94
+ setEducationCarouselStateRaw(nextState);
95
+ if (__DEV__) {
96
+ (_a = testCarouselCallbackRef.current) === null || _a === void 0 ? void 0 : _a.call(testCarouselCallbackRef, nextState);
97
+ }
98
+ }, []);
90
99
  (0, react_1.useEffect)(() => {
91
100
  if (devMode) {
92
101
  console.log(`[Glomo-RN-SDK LRS] Carousel state snapshot: status=${status}, showCheckout=${showCheckout}, showFlowWebView=${showFlowWebView}, flowWebViewUrl=${flowWebViewUrl || "<empty>"}, educationCarouselState=${educationCarouselState}, educationCarouselUrl=${educationCarouselUrl || "<empty>"}`);
@@ -683,8 +692,12 @@ function useLrsCheckout({ server, publicKey, orderId, onPaymentSuccess, onPaymen
683
692
  handleNavigationStateChange,
684
693
  handleModalBackButton,
685
694
  handleFlowBack,
686
- injectedMain: index_1.InjectionScripts.main,
695
+ injectedMain: __DEV__ && (internalOptions === null || internalOptions === void 0 ? void 0 : internalOptions._testInjectionScript)
696
+ ? index_1.InjectionScripts.main + internalOptions._testInjectionScript
697
+ : index_1.InjectionScripts.main,
687
698
  injectedFlow: index_1.InjectionScripts.flow,
688
- injectedEducationCarousel: index_1.InjectionScripts.educationCarousel,
699
+ injectedEducationCarousel: __DEV__ && (internalOptions === null || internalOptions === void 0 ? void 0 : internalOptions._testCarouselInjectionScript)
700
+ ? index_1.InjectionScripts.educationCarousel + internalOptions._testCarouselInjectionScript
701
+ : index_1.InjectionScripts.educationCarousel,
689
702
  };
690
703
  }
@@ -64,6 +64,7 @@ export interface UseStandardCheckoutReturn {
64
64
  export interface UseStandardCheckoutInternalOptions {
65
65
  analyticsTrackers?: CheckoutAnalyticsTrackers;
66
66
  _skipOrderIdValidation?: boolean;
67
+ _testInjectionScript?: string;
67
68
  }
68
69
  /** The main SDK hook for the GlomoPay Standard Checkout flow */
69
70
  export declare function useStandardCheckout({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, onUserJourneyCompleted, onUserRefusedCameraPermissions, devMode, }: UseStandardCheckoutOptions, mockMode: boolean, internalOptions?: UseStandardCheckoutInternalOptions): UseStandardCheckoutReturn;
@@ -1 +1 @@
1
- {"version":3,"file":"use-standard-checkout.d.ts","sourceRoot":"","sources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A;KAAE,CAAC,KAC7F,IAAI,CAAC;IACV,eAAe,EAAE,CAAC,cAAc,EAAE,oBAAoB,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAC9G,2BAA2B,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACnE,uBAAuB,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACrE,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAClC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,kCAAkC;IAC/C,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;IAC9C,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,gEAAgE;AAChE,wBAAgB,mBAAmB,CAC/B,EACI,MAAM,EACN,SAAS,EACT,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACtB,8BAA8B,EAC9B,OAAe,GAClB,EAAE,0BAA0B,EAC7B,QAAQ,EAAE,OAAO,EACjB,eAAe,CAAC,EAAE,kCAAkC,GACrD,yBAAyB,CA8gC3B"}
@@ -815,7 +815,9 @@ function useStandardCheckout({ server, publicKey, orderId, onPaymentSuccess, onP
815
815
  handleNavigationStateChange,
816
816
  handleModalBackButton,
817
817
  handleFlowBack,
818
- injectedMain: index_1.InjectionScripts.standard,
818
+ injectedMain: __DEV__ && (internalOptions === null || internalOptions === void 0 ? void 0 : internalOptions._testInjectionScript)
819
+ ? index_1.InjectionScripts.standard + internalOptions._testInjectionScript
820
+ : index_1.InjectionScripts.standard,
819
821
  injectedFlow: index_1.InjectionScripts.flow,
820
822
  };
821
823
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glomopay/react-native-sdk",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "The React Native SDK for GlomoPay",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
@@ -23,7 +23,9 @@
23
23
  "prettier:format": "prettier --write \"**/*.{js,ts,jsx,tsx,json}\"",
24
24
  "lint": "eslint src/",
25
25
  "clean": "rm -rf lib",
26
- "prepublishOnly": "npm run clean && tsc --noEmit && npm run build"
26
+ "prepublishOnly": "npm run clean && tsc --noEmit && npm run build",
27
+ "ci:e2e-android": "cd testing && npm run ci:e2e-android",
28
+ "ci:e2e-ios": "cd testing && npm run ci:e2e-ios"
27
29
  },
28
30
  "repository": {
29
31
  "type": "git",
@@ -7,13 +7,16 @@
7
7
  import React, { useImperativeHandle, useRef, useEffect, useMemo, forwardRef } from "react";
8
8
 
9
9
  import { useGlomoCheckout, type UseGlomoCheckoutInternalReturn } from "./use-glomo-checkout";
10
- import { type GlomoCheckoutRef, type GlomoCheckoutProps } from "./types/checkout";
10
+ import { type GlomoCheckoutRef, type GlomoCheckoutProps, type GlomoCheckoutInternalProps } from "./types/checkout";
11
11
  import { trackUseOfUnsupportedFunctionality } from "./utils/analytics";
12
12
  import { GlomoLrsCheckout } from "./glomo-lrs-checkout";
13
- import { GlomoStandardCheckout } from "./glomo-standard-checkout";
13
+ import { GlomoStandardCheckoutInternal as GlomoStandardCheckout } from "./glomo-standard-checkout";
14
14
  import { GlomoSubscriptionsCheckout } from "./glomo-subscriptions-checkout";
15
15
 
16
- function GlomoCheckoutComponent(props: GlomoCheckoutProps, ref: React.ForwardedRef<GlomoCheckoutRef>) {
16
+ function GlomoCheckoutComponent(
17
+ props: GlomoCheckoutProps & GlomoCheckoutInternalProps,
18
+ ref: React.ForwardedRef<GlomoCheckoutRef>
19
+ ) {
17
20
  // useGlomoCheckout handles order type detection and exposes start/getStatus for the ref
18
21
  const {
19
22
  orderType,
@@ -72,6 +75,9 @@ function GlomoCheckoutComponent(props: GlomoCheckoutProps, ref: React.ForwardedR
72
75
  onPaymentTerminate={passedProps.onPaymentTerminate}
73
76
  onSdkError={passedProps.onSdkError}
74
77
  devMode={passedProps.devMode}
78
+ _testInjectionScript={props._testInjectionScript}
79
+ _testCarouselInjectionScript={props._testCarouselInjectionScript}
80
+ _onEducationCarouselStateChange={props._onEducationCarouselStateChange}
75
81
  />
76
82
  );
77
83
  }
@@ -92,6 +98,7 @@ function GlomoCheckoutComponent(props: GlomoCheckoutProps, ref: React.ForwardedR
92
98
  onUserJourneyCompleted={passedProps.onUserJourneyCompleted}
93
99
  onUserRefusedCameraPermissions={passedProps.onUserRefusedCameraPermissions}
94
100
  devMode={passedProps.devMode}
101
+ _testInjectionScript={props._testInjectionScript}
95
102
  />
96
103
  );
97
104
  }
@@ -112,6 +119,7 @@ function GlomoCheckoutComponent(props: GlomoCheckoutProps, ref: React.ForwardedR
112
119
  onUserJourneyCompleted={passedProps.onUserJourneyCompleted}
113
120
  onUserRefusedCameraPermissions={passedProps.onUserRefusedCameraPermissions}
114
121
  devMode={passedProps.devMode}
122
+ _testInjectionScript={props._testInjectionScript}
115
123
  />
116
124
  );
117
125
  }
@@ -124,6 +132,11 @@ function GlomoCheckoutComponent(props: GlomoCheckoutProps, ref: React.ForwardedR
124
132
  return null;
125
133
  }
126
134
 
127
- export const GlomoCheckout = forwardRef<GlomoCheckoutRef, GlomoCheckoutProps>(GlomoCheckoutComponent);
135
+ /**
136
+ * Internal props if provided, should be used for automated testing only
137
+ */
138
+ export const GlomoCheckout = forwardRef(GlomoCheckoutComponent) as React.ForwardRefExoticComponent<
139
+ GlomoCheckoutProps & React.RefAttributes<GlomoCheckoutRef>
140
+ >;
128
141
 
129
142
  GlomoCheckout.displayName = "GlomoCheckout";
@@ -11,6 +11,9 @@ import { isValidUrl } from "./utils/validation";
11
11
  export interface GlomoLrsCheckoutProps extends UseLrsCheckoutOptions {
12
12
  visible?: boolean;
13
13
  onSdkError: (error: Array<SdkError>) => void;
14
+ _testInjectionScript?: string;
15
+ _testCarouselInjectionScript?: string;
16
+ _onEducationCarouselStateChange?: (state: string) => void;
14
17
  }
15
18
 
16
19
  export interface GlomoLrsCheckoutRef {
@@ -49,6 +52,9 @@ function GlomoLrsCheckoutComponent(
49
52
  onSdkError,
50
53
  devMode = false,
51
54
  visible: controlledVisible,
55
+ _testInjectionScript,
56
+ _testCarouselInjectionScript,
57
+ _onEducationCarouselStateChange,
52
58
  }: GlomoLrsCheckoutProps,
53
59
  ref: React.ForwardedRef<GlomoLrsCheckoutRef>
54
60
  ) {
@@ -98,7 +104,8 @@ function GlomoLrsCheckoutComponent(
98
104
  onSdkError,
99
105
  devMode,
100
106
  },
101
- mockMode
107
+ mockMode,
108
+ { _testInjectionScript, _testCarouselInjectionScript, _onEducationCarouselStateChange }
102
109
  );
103
110
 
104
111
  // Exposing the start() and getStatus() methods via the ref
@@ -17,6 +17,7 @@ import { isValidUrl } from "./utils/validation";
17
17
  export interface GlomoStandardCheckoutInternalProps extends GlomoStandardCheckoutProps {
18
18
  _analyticsTrackers?: CheckoutAnalyticsTrackers;
19
19
  _skipOrderIdValidation?: boolean;
20
+ _testInjectionScript?: string;
20
21
  }
21
22
 
22
23
  /**
@@ -51,6 +52,7 @@ function GlomoStandardCheckoutComponent(
51
52
  devMode = false,
52
53
  _analyticsTrackers,
53
54
  _skipOrderIdValidation,
55
+ _testInjectionScript,
54
56
  }: GlomoStandardCheckoutInternalProps,
55
57
  ref: React.ForwardedRef<GlomoStandardCheckoutRef>
56
58
  ) {
@@ -99,7 +101,7 @@ function GlomoStandardCheckoutComponent(
99
101
  devMode,
100
102
  },
101
103
  mockMode,
102
- { analyticsTrackers: _analyticsTrackers, _skipOrderIdValidation }
104
+ { analyticsTrackers: _analyticsTrackers, _skipOrderIdValidation, _testInjectionScript }
103
105
  );
104
106
 
105
107
  // Exposing the start() and getStatus() methods via the ref
@@ -50,6 +50,16 @@ export interface GlomoCheckoutRef {
50
50
  getStatus: () => CheckoutStatus;
51
51
  }
52
52
 
53
+ /**
54
+ * Internal-only props for automated testing
55
+ */
56
+ export interface GlomoCheckoutInternalProps {
57
+ _testInjectionScript?: string;
58
+ _testCarouselInjectionScript?: string;
59
+ _forceOrderType?: "standard" | "lrs";
60
+ _onEducationCarouselStateChange?: (state: string) => void;
61
+ }
62
+
53
63
  /** Shared callback and configuration props for the unified checkout component */
54
64
  interface GlomoCheckoutBaseProps {
55
65
  server?: GlomoServer;
@@ -18,6 +18,8 @@ export interface GlomoSubscriptionsCheckoutProps {
18
18
  onUserJourneyCompleted?: (payload: GlomoUserJourneyCompletedPayload) => void;
19
19
  onUserRefusedCameraPermissions?: () => void;
20
20
  devMode?: boolean;
21
+ /** Internal prop for automated tests - forwarded to GlomoStandardCheckoutInternal via rest spread */
22
+ _testInjectionScript?: string;
21
23
  }
22
24
 
23
25
  /**
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { useState, useRef, useCallback, useEffect } from "react";
7
7
 
8
- import { type GlomoCheckoutProps, type CheckoutStatus } from "./types/checkout";
8
+ import { type GlomoCheckoutProps, type GlomoCheckoutInternalProps, type CheckoutStatus } from "./types/checkout";
9
9
  import { type GlomoLrsCheckoutRef } from "./glomo-lrs-checkout";
10
10
  import { type GlomoStandardCheckoutRef } from "./types/standard-checkout";
11
11
  import { type GlomoSubscriptionsCheckoutRef } from "./types/subscriptions-checkout";
@@ -63,14 +63,14 @@ export interface UseGlomoCheckoutInternalReturn {
63
63
  */
64
64
  export function useGlomoCheckout(props: GlomoCheckoutProps): UseGlomoCheckoutReturn;
65
65
  export function useGlomoCheckout(
66
- props: GlomoCheckoutProps,
66
+ props: GlomoCheckoutProps & GlomoCheckoutInternalProps,
67
67
  internalOptions: { _suppressDeprecationWarning: true }
68
68
  ): UseGlomoCheckoutInternalReturn;
69
69
  export function useGlomoCheckout(
70
- props: GlomoCheckoutProps,
70
+ props: GlomoCheckoutProps & GlomoCheckoutInternalProps,
71
71
  internalOptions?: { _suppressDeprecationWarning?: boolean }
72
72
  ): UseGlomoCheckoutInternalReturn {
73
- const { server, publicKey, orderId, subscriptionId, onSdkError, devMode = false } = props;
73
+ const { server, publicKey, orderId, subscriptionId, onSdkError, devMode = false, _forceOrderType } = props;
74
74
 
75
75
  // Order type resolved from the API - null until detection completes
76
76
  const [orderType, setOrderType] = useState<ExtendedOrderType | null>(null);
@@ -248,6 +248,31 @@ export function useGlomoCheckout(
248
248
  return false;
249
249
  }
250
250
 
251
+ /**
252
+ * Bypassing the fetchOrderType API call
253
+ * and using the provided order type directly,
254
+ * if _forceOrderType is set.
255
+ *
256
+ * This is ONLY meant to be used by automated testing harnesses,
257
+ * to simulate a checkout without actual API calls.
258
+ *
259
+ * Only available in __DEV__ builds (debug)
260
+ */
261
+ if (__DEV__ && _forceOrderType) {
262
+ ++fetchGenerationRef.current;
263
+
264
+ if (devMode) {
265
+ console.log(`[Glomo-RN-SDK] Forcing order type: ${_forceOrderType}`);
266
+ }
267
+
268
+ setOrderType(_forceOrderType);
269
+
270
+ return new Promise<boolean>((resolve) => {
271
+ pendingStartResolveRef.current = resolve;
272
+ pendingStartRef.current = true;
273
+ });
274
+ }
275
+
251
276
  // Detecting order type via the API
252
277
  setDetecting(true);
253
278
  const thisGeneration = ++fetchGenerationRef.current;
@@ -294,7 +319,7 @@ export function useGlomoCheckout(
294
319
  pendingStartResolveRef.current = resolve;
295
320
  pendingStartRef.current = true;
296
321
  });
297
- }, [devMode, publicKey, orderId, subscriptionId, server, onSdkError, propsError]);
322
+ }, [devMode, publicKey, orderId, subscriptionId, server, onSdkError, propsError, _forceOrderType]);
298
323
 
299
324
  /**
300
325
  * Auto-starting the inner component after order type is resolved and the component has rendered.
@@ -106,7 +106,16 @@ export interface UseLrsCheckoutReturn {
106
106
  injectedEducationCarousel?: string;
107
107
  }
108
108
 
109
- /** The main SDK hook for the GlomoPay LRS Checkout flow */
109
+ /**
110
+ * The main SDK hook for the GlomoPay LRS Checkout flow
111
+ * Internal options meant to simulate an LRS checkout are for automated tests only.
112
+ */
113
+ export interface UseLrsCheckoutInternalOptions {
114
+ _testInjectionScript?: string;
115
+ _testCarouselInjectionScript?: string;
116
+ _onEducationCarouselStateChange?: (state: string) => void;
117
+ }
118
+
110
119
  export function useLrsCheckout(
111
120
  {
112
121
  server,
@@ -119,7 +128,8 @@ export function useLrsCheckout(
119
128
  onSdkError,
120
129
  devMode = false,
121
130
  }: UseLrsCheckoutOptions,
122
- mockMode: boolean
131
+ mockMode: boolean,
132
+ internalOptions?: UseLrsCheckoutInternalOptions
123
133
  ): UseLrsCheckoutReturn {
124
134
  // Refs for the WebViews
125
135
  const mainWebViewRef = useRef<WebView>(null);
@@ -208,7 +218,18 @@ export function useLrsCheckout(
208
218
 
209
219
  const [showFlowWebView, setShowFlowWebView] = useState(false);
210
220
  const [flowWebViewUrl, setFlowWebViewUrl] = useState<string>("");
211
- const [educationCarouselState, setEducationCarouselState] = useState<EducationCarouselState>("pending");
221
+ const [educationCarouselState, setEducationCarouselStateRaw] = useState<EducationCarouselState>("pending");
222
+
223
+ /** Wrapping the raw state setter to also fire the internal test callback */
224
+ const testCarouselCallbackRef = useRef(internalOptions?._onEducationCarouselStateChange);
225
+ testCarouselCallbackRef.current = internalOptions?._onEducationCarouselStateChange;
226
+
227
+ const setEducationCarouselState = useCallback((nextState: EducationCarouselState) => {
228
+ setEducationCarouselStateRaw(nextState);
229
+ if (__DEV__) {
230
+ testCarouselCallbackRef.current?.(nextState);
231
+ }
232
+ }, []);
212
233
 
213
234
  useEffect(() => {
214
235
  if (devMode) {
@@ -990,8 +1011,14 @@ export function useLrsCheckout(
990
1011
  handleNavigationStateChange,
991
1012
  handleModalBackButton,
992
1013
  handleFlowBack,
993
- injectedMain: InjectionScripts.main,
1014
+ injectedMain:
1015
+ __DEV__ && internalOptions?._testInjectionScript
1016
+ ? InjectionScripts.main + internalOptions._testInjectionScript
1017
+ : InjectionScripts.main,
994
1018
  injectedFlow: InjectionScripts.flow,
995
- injectedEducationCarousel: InjectionScripts.educationCarousel,
1019
+ injectedEducationCarousel:
1020
+ __DEV__ && internalOptions?._testCarouselInjectionScript
1021
+ ? InjectionScripts.educationCarousel + internalOptions._testCarouselInjectionScript
1022
+ : InjectionScripts.educationCarousel,
996
1023
  };
997
1024
  }
@@ -69,6 +69,7 @@ export interface UseStandardCheckoutReturn {
69
69
  export interface UseStandardCheckoutInternalOptions {
70
70
  analyticsTrackers?: CheckoutAnalyticsTrackers;
71
71
  _skipOrderIdValidation?: boolean;
72
+ _testInjectionScript?: string;
72
73
  }
73
74
 
74
75
  /** The main SDK hook for the GlomoPay Standard Checkout flow */
@@ -1120,7 +1121,10 @@ export function useStandardCheckout(
1120
1121
  handleNavigationStateChange,
1121
1122
  handleModalBackButton,
1122
1123
  handleFlowBack,
1123
- injectedMain: InjectionScripts.standard,
1124
+ injectedMain:
1125
+ __DEV__ && internalOptions?._testInjectionScript
1126
+ ? InjectionScripts.standard + internalOptions._testInjectionScript
1127
+ : InjectionScripts.standard,
1124
1128
  injectedFlow: InjectionScripts.flow,
1125
1129
  };
1126
1130
  }