expo-helium 3.0.7 → 3.0.14

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.
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Experiment allocation information types
3
+ */
4
+ /**
5
+ * Details about user hash bucketing for allocation
6
+ */
7
+ export interface HashDetails {
8
+ /**
9
+ * User hash bucket (1-100) - used for consistent allocation
10
+ */
11
+ hashedUserIdBucket1To100?: number;
12
+ /**
13
+ * User ID that was hashed for allocation
14
+ */
15
+ hashedUserId?: string;
16
+ /**
17
+ * Hash method used (e.g., "HASH_USER_ID", "HASH_HELIUM_PERSISTENT_ID")
18
+ */
19
+ hashMethod?: string;
20
+ }
21
+ /**
22
+ * Details about the chosen variant in an experiment
23
+ */
24
+ export interface VariantDetails {
25
+ /**
26
+ * Name or identifier of the allocation/variant (e.g., paywall template name)
27
+ */
28
+ allocationName?: string;
29
+ /**
30
+ * Unique identifier for this allocation (paywall UUID)
31
+ */
32
+ allocationId?: string;
33
+ /**
34
+ * Index of chosen variant (1 to len(variants))
35
+ */
36
+ allocationIndex?: number;
37
+ /**
38
+ * Additional allocation metadata as a dictionary
39
+ */
40
+ allocationMetadata?: Record<string, any>;
41
+ }
42
+ /**
43
+ * Complete experiment allocation information for a user
44
+ */
45
+ export interface ExperimentInfo {
46
+ /**
47
+ * Trigger name at which user was enrolled
48
+ */
49
+ trigger: string;
50
+ /**
51
+ * Experiment name
52
+ */
53
+ experimentName?: string;
54
+ /**
55
+ * Experiment ID
56
+ */
57
+ experimentId?: string;
58
+ /**
59
+ * Experiment type (e.g., "A/B/n test")
60
+ */
61
+ experimentType?: string;
62
+ /**
63
+ * Additional experiment metadata as a dictionary
64
+ */
65
+ experimentMetadata?: Record<string, any>;
66
+ /**
67
+ * When the experiment started (ISO8601 string)
68
+ */
69
+ startDate?: string;
70
+ /**
71
+ * When the experiment ends (ISO8601 string)
72
+ */
73
+ endDate?: string;
74
+ /**
75
+ * Audience ID that user matched
76
+ */
77
+ audienceId?: string;
78
+ /**
79
+ * Audience data as structured object
80
+ * Note: This may be returned as a string from native bridge, but will be parsed
81
+ */
82
+ audienceData?: Record<string, any> | string;
83
+ /**
84
+ * Details about the chosen variant
85
+ */
86
+ chosenVariantDetails?: VariantDetails;
87
+ /**
88
+ * Hash bucketing details
89
+ */
90
+ hashDetails?: HashDetails;
91
+ }
92
+ //# sourceMappingURL=HeliumExperimentInfo.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeliumExperimentInfo.types.d.ts","sourceRoot":"","sources":["../src/HeliumExperimentInfo.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEzC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;IAE5C;;OAEG;IACH,oBAAoB,CAAC,EAAE,cAAc,CAAC;IAEtC;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Experiment allocation information types
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=HeliumExperimentInfo.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeliumExperimentInfo.types.js","sourceRoot":"","sources":["../src/HeliumExperimentInfo.types.ts"],"names":[],"mappings":"AAAA;;GAEG","sourcesContent":["/**\n * Experiment allocation information types\n */\n\n/**\n * Details about user hash bucketing for allocation\n */\nexport interface HashDetails {\n /**\n * User hash bucket (1-100) - used for consistent allocation\n */\n hashedUserIdBucket1To100?: number;\n\n /**\n * User ID that was hashed for allocation\n */\n hashedUserId?: string;\n\n /**\n * Hash method used (e.g., \"HASH_USER_ID\", \"HASH_HELIUM_PERSISTENT_ID\")\n */\n hashMethod?: string;\n}\n\n/**\n * Details about the chosen variant in an experiment\n */\nexport interface VariantDetails {\n /**\n * Name or identifier of the allocation/variant (e.g., paywall template name)\n */\n allocationName?: string;\n\n /**\n * Unique identifier for this allocation (paywall UUID)\n */\n allocationId?: string;\n\n /**\n * Index of chosen variant (1 to len(variants))\n */\n allocationIndex?: number;\n\n /**\n * Additional allocation metadata as a dictionary\n */\n allocationMetadata?: Record<string, any>;\n}\n\n/**\n * Complete experiment allocation information for a user\n */\nexport interface ExperimentInfo {\n /**\n * Trigger name at which user was enrolled\n */\n trigger: string;\n\n /**\n * Experiment name\n */\n experimentName?: string;\n\n /**\n * Experiment ID\n */\n experimentId?: string;\n\n /**\n * Experiment type (e.g., \"A/B/n test\")\n */\n experimentType?: string;\n\n /**\n * Additional experiment metadata as a dictionary\n */\n experimentMetadata?: Record<string, any>;\n\n /**\n * When the experiment started (ISO8601 string)\n */\n startDate?: string;\n\n /**\n * When the experiment ends (ISO8601 string)\n */\n endDate?: string;\n\n /**\n * Audience ID that user matched\n */\n audienceId?: string;\n\n /**\n * Audience data as structured object\n * Note: This may be returned as a string from native bridge, but will be parsed\n */\n audienceData?: Record<string, any> | string;\n\n /**\n * Details about the chosen variant\n */\n chosenVariantDetails?: VariantDetails;\n\n /**\n * Hash bucketing details\n */\n hashDetails?: HashDetails;\n}\n"]}
@@ -8,7 +8,7 @@ export type HeliumPaywallSdkModuleEvents = {
8
8
  paywallEventHandlers: (params: HeliumPaywallEvent) => void;
9
9
  };
10
10
  export type HeliumPaywallEvent = {
11
- type: 'paywallOpen' | 'paywallClose' | 'paywallDismissed' | 'paywallOpenFailed' | 'paywallSkipped' | 'paywallButtonPressed' | 'productSelected' | 'purchasePressed' | 'purchaseSucceeded' | 'purchaseCancelled' | 'purchaseFailed' | 'purchaseRestored' | 'purchaseRestoreFailed' | 'purchasePending' | 'initializeStart' | 'paywallsDownloadSuccess' | 'paywallsDownloadError' | 'paywallWebViewRendered';
11
+ type: 'paywallOpen' | 'paywallClose' | 'paywallDismissed' | 'paywallOpenFailed' | 'paywallSkipped' | 'paywallButtonPressed' | 'productSelected' | 'purchasePressed' | 'purchaseSucceeded' | 'purchaseCancelled' | 'purchaseFailed' | 'purchaseRestored' | 'purchaseRestoreFailed' | 'purchasePending' | 'initializeStart' | 'paywallsDownloadSuccess' | 'paywallsDownloadError' | 'paywallWebViewRendered' | 'customPaywallAction' | 'userAllocated';
12
12
  triggerName?: string;
13
13
  paywallName?: string;
14
14
  /**
@@ -43,6 +43,9 @@ export type HeliumPaywallEvent = {
43
43
  * Unix timestamp in seconds
44
44
  */
45
45
  timestamp?: number;
46
+ paywallUnavailableReason?: string;
47
+ customPaywallActionName?: string;
48
+ customPaywallActionParams?: Record<string, any>;
46
49
  };
47
50
  export type DelegateActionEvent = {
48
51
  type: 'purchase' | 'restore';
@@ -61,6 +64,7 @@ export type HeliumPurchaseResult = {
61
64
  error?: string;
62
65
  };
63
66
  export type HeliumDownloadStatus = 'downloadSuccess' | 'downloadFailure' | 'inProgress' | 'notDownloadedYet';
67
+ export type HeliumLightDarkMode = 'light' | 'dark' | 'system';
64
68
  /** Interface for providing custom purchase handling logic. */
65
69
  export interface HeliumPurchaseConfig {
66
70
  makePurchase: (productId: string) => Promise<HeliumPurchaseResult>;
@@ -100,7 +104,10 @@ export type HeliumPaywallLoadingConfig = {
100
104
  export interface HeliumConfig {
101
105
  /** Your Helium API Key */
102
106
  apiKey: string;
103
- /** Configuration for handling purchases. Can be custom functions or a pre-built handler config. */
107
+ /**
108
+ * Configuration for handling purchases. Can be custom functions or a pre-built handler config.
109
+ * If not provided, Helium will handle purchases for you.
110
+ */
104
111
  purchaseConfig?: HeliumPurchaseConfig;
105
112
  /** Callback for receiving all Helium paywall events. */
106
113
  onHeliumPaywallEvent: (event: HeliumPaywallEvent) => void;
@@ -130,6 +137,8 @@ export type PresentUpsellParams = {
130
137
  onFallback?: () => void;
131
138
  eventHandlers?: PaywallEventHandlers;
132
139
  customPaywallTraits?: Record<string, any>;
140
+ /** Optional. If true, the paywall will not be shown if the user already has an entitlement for a product in the paywall. */
141
+ dontShowIfAlreadyEntitled?: boolean;
133
142
  };
134
143
  export interface PaywallInfo {
135
144
  paywallTemplateName: string;
@@ -140,6 +149,8 @@ export interface PaywallEventHandlers {
140
149
  onClose?: (event: PaywallCloseEvent) => void;
141
150
  onDismissed?: (event: PaywallDismissedEvent) => void;
142
151
  onPurchaseSucceeded?: (event: PurchaseSucceededEvent) => void;
152
+ onOpenFailed?: (event: PaywallOpenFailedEvent) => void;
153
+ onCustomPaywallAction?: (event: CustomPaywallActionEvent) => void;
143
154
  }
144
155
  export interface PaywallOpenEvent {
145
156
  type: 'paywallOpen';
@@ -167,6 +178,22 @@ export interface PurchaseSucceededEvent {
167
178
  paywallName: string;
168
179
  isSecondTry: boolean;
169
180
  }
181
+ export interface PaywallOpenFailedEvent {
182
+ type: 'paywallOpenFailed';
183
+ triggerName: string;
184
+ paywallName: string;
185
+ error: string;
186
+ paywallUnavailableReason?: string;
187
+ isSecondTry: boolean;
188
+ }
189
+ export interface CustomPaywallActionEvent {
190
+ type: 'customPaywallAction';
191
+ triggerName: string;
192
+ paywallName: string;
193
+ actionName: string;
194
+ params: Record<string, any>;
195
+ isSecondTry: boolean;
196
+ }
170
197
  export declare const HELIUM_CTA_NAMES: {
171
198
  SCHEDULE_CALL: string;
172
199
  SUBSCRIBE_BUTTON: string;
@@ -1 +1 @@
1
- {"version":3,"file":"HeliumPaywallSdk.types.d.ts","sourceRoot":"","sources":["../src/HeliumPaywallSdk.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,oBAAoB,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC3D,qBAAqB,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC7D,oBAAoB,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC5D,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,aAAa,GAAG,cAAc,GAAG,kBAAkB,GACvD,mBAAmB,GAAG,gBAAgB,GAAG,sBAAsB,GAC/D,iBAAiB,GAAG,iBAAiB,GAAG,mBAAmB,GAC3D,mBAAmB,GAAG,gBAAgB,GAAG,kBAAkB,GAC3D,uBAAuB,GAAG,iBAAiB,GAAG,iBAAiB,GAC/D,yBAAyB,GAAG,uBAAuB,GAAG,wBAAwB,CAAC;IACjF,WAAW,CAAC,EAAE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BAAkB,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,gBAAgB;;;CAG5B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"HeliumPaywallSdk.types.js","sourceRoot":"","sources":["../src/HeliumPaywallSdk.types.ts"],"names":[],"mappings":"AAgFA,sDAAsD;AACtD,MAAM,UAAU,0BAA0B,CAAC,SAG1C;IACC,OAAO;QACL,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;KAC7C,CAAC;AACJ,CAAC;AAkHD,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,aAAa,EAAE,eAAe;IAC9B,gBAAgB,EAAE,kBAAkB;CACrC,CAAA","sourcesContent":["import type { StyleProp, ViewStyle } from 'react-native';\n\nexport type OnLoadEventPayload = {\n url: string;\n};\n\nexport type HeliumPaywallSdkModuleEvents = {\n onHeliumPaywallEvent: (params: HeliumPaywallEvent) => void;\n onDelegateActionEvent: (params: DelegateActionEvent) => void;\n paywallEventHandlers: (params: HeliumPaywallEvent) => void;\n};\nexport type HeliumPaywallEvent = {\n type: 'paywallOpen' | 'paywallClose' | 'paywallDismissed' |\n 'paywallOpenFailed' | 'paywallSkipped' | 'paywallButtonPressed' |\n 'productSelected' | 'purchasePressed' | 'purchaseSucceeded' |\n 'purchaseCancelled' | 'purchaseFailed' | 'purchaseRestored' |\n 'purchaseRestoreFailed' | 'purchasePending' | 'initializeStart' |\n 'paywallsDownloadSuccess' | 'paywallsDownloadError' | 'paywallWebViewRendered';\n triggerName?: string;\n paywallName?: string;\n /**\n * @deprecated Use `paywallName` instead.\n */\n paywallTemplateName?: string;\n productId?: string;\n /**\n * @deprecated Use `productId` instead.\n */\n productKey?: string;\n buttonName?: string;\n /**\n * @deprecated Use `buttonName` instead.\n */\n ctaName?: string;\n configId?: string;\n numAttempts?: number;\n downloadTimeTakenMS?: number;\n webviewRenderTimeTakenMS?: number;\n imagesDownloadTimeTakenMS?: number;\n fontsDownloadTimeTakenMS?: number;\n bundleDownloadTimeMS?: number;\n dismissAll?: boolean;\n isSecondTry?: boolean;\n error?: string;\n /**\n * @deprecated Use `error` instead.\n */\n errorDescription?: string;\n /**\n * Unix timestamp in seconds\n */\n timestamp?: number;\n};\nexport type DelegateActionEvent = {\n type: 'purchase' | 'restore';\n productId?: string;\n};\n\nexport type HeliumPaywallSdkViewProps = {\n url: string;\n onLoad: (event: { nativeEvent: OnLoadEventPayload }) => void;\n style?: StyleProp<ViewStyle>;\n};\n\nexport type HeliumTransactionStatus = 'purchased' | 'failed' | 'cancelled' | 'pending' | 'restored';\nexport type HeliumPurchaseResult = {\n status: HeliumTransactionStatus;\n error?: string; // Optional error message\n};\nexport type HeliumDownloadStatus = 'downloadSuccess' | 'downloadFailure' | 'inProgress' | 'notDownloadedYet';\n\n// --- Purchase Configuration Types ---\n\n/** Interface for providing custom purchase handling logic. */\n\nexport interface HeliumPurchaseConfig {\n makePurchase: (productId: string) => Promise<HeliumPurchaseResult>;\n restorePurchases: () => Promise<boolean>;\n}\n\n// Helper function for creating Custom Purchase Config\nexport function createCustomPurchaseConfig(callbacks: {\n makePurchase: (productId: string) => Promise<HeliumPurchaseResult>;\n restorePurchases: () => Promise<boolean>;\n}): HeliumPurchaseConfig {\n return {\n makePurchase: callbacks.makePurchase,\n restorePurchases: callbacks.restorePurchases,\n };\n}\n\nexport type TriggerLoadingConfig = {\n /** Whether to show loading state for this trigger. Set to nil to use the global `useLoadingState` setting. */\n useLoadingState?: boolean;\n /** Maximum seconds to show loading for this trigger. Set to nil to use the global `loadingBudget` setting. */\n loadingBudget?: number;\n};\n\nexport type HeliumPaywallLoadingConfig = {\n /**\n * Whether to show a loading state while fetching paywall configuration.\n * When true, shows a loading view for up to `loadingBudget` seconds before falling back.\n * Default: true\n */\n useLoadingState?: boolean;\n /**\n * Maximum time (in seconds) to show the loading state before displaying fallback.\n * After this timeout, the fallback view will be shown even if the paywall is still downloading.\n * Default: 2.0 seconds\n */\n loadingBudget?: number;\n /**\n * Optional per-trigger loading configuration overrides.\n * Use this to customize loading behavior for specific triggers.\n * Keys are trigger names, values are TriggerLoadingConfig instances.\n * Example: Disable loading for \"onboarding\" trigger while keeping it for others.\n */\n perTriggerLoadingConfig?: Record<string, TriggerLoadingConfig>;\n};\n\nexport interface HeliumConfig {\n /** Your Helium API Key */\n apiKey: string;\n /** Configuration for handling purchases. Can be custom functions or a pre-built handler config. */\n purchaseConfig?: HeliumPurchaseConfig;\n /** Callback for receiving all Helium paywall events. */\n onHeliumPaywallEvent: (event: HeliumPaywallEvent) => void; // Still mandatory\n\n // Optional configurations\n /** Fallback bundle in the rare situation that paywall is not ready to be shown. Highly recommended. See docs at https://docs.tryhelium.com/guides/fallback-bundle#react-native */\n fallbackBundle?: object;\n /** Configure loading behavior for paywalls that are mid-download. */\n paywallLoadingConfig?: HeliumPaywallLoadingConfig;\n customUserId?: string;\n customAPIEndpoint?: string;\n customUserTraits?: Record<string, any>;\n revenueCatAppUserId?: string;\n}\n\nexport interface NativeHeliumConfig {\n apiKey: string;\n customUserId?: string;\n customAPIEndpoint?: string;\n customUserTraits?: Record<string, any>;\n revenueCatAppUserId?: string;\n fallbackBundleUrlString?: string;\n fallbackBundleString?: string;\n paywallLoadingConfig?: HeliumPaywallLoadingConfig;\n useDefaultDelegate?: boolean;\n}\n\nexport type PresentUpsellParams = {\n triggerName: string;\n /** Optional. This will be called when paywall fails to show due to an unsuccessful paywall download or if an invalid trigger is provided. */\n onFallback?: () => void;\n eventHandlers?: PaywallEventHandlers;\n customPaywallTraits?: Record<string, any>;\n};\n\nexport interface PaywallInfo {\n paywallTemplateName: string;\n shouldShow: boolean;\n}\n\n// Event handler types for per-presentation event handling\nexport interface PaywallEventHandlers {\n onOpen?: (event: PaywallOpenEvent) => void;\n onClose?: (event: PaywallCloseEvent) => void;\n onDismissed?: (event: PaywallDismissedEvent) => void;\n onPurchaseSucceeded?: (event: PurchaseSucceededEvent) => void;\n}\n\n// Typed event interfaces\nexport interface PaywallOpenEvent {\n type: 'paywallOpen';\n triggerName: string;\n paywallName: string;\n isSecondTry: boolean;\n viewType?: 'presented' | 'embedded' | 'triggered';\n}\n\nexport interface PaywallCloseEvent {\n type: 'paywallClose';\n triggerName: string;\n paywallName: string;\n isSecondTry: boolean;\n}\n\nexport interface PaywallDismissedEvent {\n type: 'paywallDismissed';\n triggerName: string;\n paywallName: string;\n isSecondTry: boolean;\n}\n\nexport interface PurchaseSucceededEvent {\n type: 'purchaseSucceeded';\n productId: string;\n triggerName: string;\n paywallName: string;\n isSecondTry: boolean;\n}\n\nexport const HELIUM_CTA_NAMES = {\n SCHEDULE_CALL: 'schedule_call',\n SUBSCRIBE_BUTTON: 'subscribe_button',\n}\n"]}
1
+ {"version":3,"file":"HeliumPaywallSdk.types.js","sourceRoot":"","sources":["../src/HeliumPaywallSdk.types.ts"],"names":[],"mappings":"AAqFA,sDAAsD;AACtD,MAAM,UAAU,0BAA0B,CAAC,SAG1C;IACC,OAAO;QACL,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,gBAAgB,EAAE,SAAS,CAAC,gBAAgB;KAC7C,CAAC;AACJ,CAAC;AA2ID,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,aAAa,EAAE,eAAe;IAC9B,gBAAgB,EAAE,kBAAkB;CACrC,CAAA","sourcesContent":["import type { StyleProp, ViewStyle } from 'react-native';\n\nexport type OnLoadEventPayload = {\n url: string;\n};\n\nexport type HeliumPaywallSdkModuleEvents = {\n onHeliumPaywallEvent: (params: HeliumPaywallEvent) => void;\n onDelegateActionEvent: (params: DelegateActionEvent) => void;\n paywallEventHandlers: (params: HeliumPaywallEvent) => void;\n};\nexport type HeliumPaywallEvent = {\n type: 'paywallOpen' | 'paywallClose' | 'paywallDismissed' |\n 'paywallOpenFailed' | 'paywallSkipped' | 'paywallButtonPressed' |\n 'productSelected' | 'purchasePressed' | 'purchaseSucceeded' |\n 'purchaseCancelled' | 'purchaseFailed' | 'purchaseRestored' |\n 'purchaseRestoreFailed' | 'purchasePending' | 'initializeStart' |\n 'paywallsDownloadSuccess' | 'paywallsDownloadError' | 'paywallWebViewRendered' |\n 'customPaywallAction' | 'userAllocated';\n triggerName?: string;\n paywallName?: string;\n /**\n * @deprecated Use `paywallName` instead.\n */\n paywallTemplateName?: string;\n productId?: string;\n /**\n * @deprecated Use `productId` instead.\n */\n productKey?: string;\n buttonName?: string;\n /**\n * @deprecated Use `buttonName` instead.\n */\n ctaName?: string;\n configId?: string;\n numAttempts?: number;\n downloadTimeTakenMS?: number;\n webviewRenderTimeTakenMS?: number;\n imagesDownloadTimeTakenMS?: number;\n fontsDownloadTimeTakenMS?: number;\n bundleDownloadTimeMS?: number;\n dismissAll?: boolean;\n isSecondTry?: boolean;\n error?: string;\n /**\n * @deprecated Use `error` instead.\n */\n errorDescription?: string;\n /**\n * Unix timestamp in seconds\n */\n timestamp?: number;\n paywallUnavailableReason?: string;\n customPaywallActionName?: string;\n customPaywallActionParams?: Record<string, any>;\n};\nexport type DelegateActionEvent = {\n type: 'purchase' | 'restore';\n productId?: string;\n};\n\nexport type HeliumPaywallSdkViewProps = {\n url: string;\n onLoad: (event: { nativeEvent: OnLoadEventPayload }) => void;\n style?: StyleProp<ViewStyle>;\n};\n\nexport type HeliumTransactionStatus = 'purchased' | 'failed' | 'cancelled' | 'pending' | 'restored';\nexport type HeliumPurchaseResult = {\n status: HeliumTransactionStatus;\n error?: string; // Optional error message\n};\nexport type HeliumDownloadStatus = 'downloadSuccess' | 'downloadFailure' | 'inProgress' | 'notDownloadedYet';\nexport type HeliumLightDarkMode = 'light' | 'dark' | 'system';\n\n// --- Purchase Configuration Types ---\n\n/** Interface for providing custom purchase handling logic. */\n\nexport interface HeliumPurchaseConfig {\n makePurchase: (productId: string) => Promise<HeliumPurchaseResult>;\n restorePurchases: () => Promise<boolean>;\n}\n\n// Helper function for creating Custom Purchase Config\nexport function createCustomPurchaseConfig(callbacks: {\n makePurchase: (productId: string) => Promise<HeliumPurchaseResult>;\n restorePurchases: () => Promise<boolean>;\n}): HeliumPurchaseConfig {\n return {\n makePurchase: callbacks.makePurchase,\n restorePurchases: callbacks.restorePurchases,\n };\n}\n\nexport type TriggerLoadingConfig = {\n /** Whether to show loading state for this trigger. Set to nil to use the global `useLoadingState` setting. */\n useLoadingState?: boolean;\n /** Maximum seconds to show loading for this trigger. Set to nil to use the global `loadingBudget` setting. */\n loadingBudget?: number;\n};\n\nexport type HeliumPaywallLoadingConfig = {\n /**\n * Whether to show a loading state while fetching paywall configuration.\n * When true, shows a loading view for up to `loadingBudget` seconds before falling back.\n * Default: true\n */\n useLoadingState?: boolean;\n /**\n * Maximum time (in seconds) to show the loading state before displaying fallback.\n * After this timeout, the fallback view will be shown even if the paywall is still downloading.\n * Default: 2.0 seconds\n */\n loadingBudget?: number;\n /**\n * Optional per-trigger loading configuration overrides.\n * Use this to customize loading behavior for specific triggers.\n * Keys are trigger names, values are TriggerLoadingConfig instances.\n * Example: Disable loading for \"onboarding\" trigger while keeping it for others.\n */\n perTriggerLoadingConfig?: Record<string, TriggerLoadingConfig>;\n};\n\nexport interface HeliumConfig {\n /** Your Helium API Key */\n apiKey: string;\n /**\n * Configuration for handling purchases. Can be custom functions or a pre-built handler config.\n * If not provided, Helium will handle purchases for you.\n */\n purchaseConfig?: HeliumPurchaseConfig;\n /** Callback for receiving all Helium paywall events. */\n onHeliumPaywallEvent: (event: HeliumPaywallEvent) => void; // Still mandatory\n\n // Optional configurations\n /** Fallback bundle in the rare situation that paywall is not ready to be shown. Highly recommended. See docs at https://docs.tryhelium.com/guides/fallback-bundle#react-native */\n fallbackBundle?: object;\n /** Configure loading behavior for paywalls that are mid-download. */\n paywallLoadingConfig?: HeliumPaywallLoadingConfig;\n customUserId?: string;\n customAPIEndpoint?: string;\n customUserTraits?: Record<string, any>;\n revenueCatAppUserId?: string;\n}\n\nexport interface NativeHeliumConfig {\n apiKey: string;\n customUserId?: string;\n customAPIEndpoint?: string;\n customUserTraits?: Record<string, any>;\n revenueCatAppUserId?: string;\n fallbackBundleUrlString?: string;\n fallbackBundleString?: string;\n paywallLoadingConfig?: HeliumPaywallLoadingConfig;\n useDefaultDelegate?: boolean;\n}\n\nexport type PresentUpsellParams = {\n triggerName: string;\n /** Optional. This will be called when paywall fails to show due to an unsuccessful paywall download or if an invalid trigger is provided. */\n onFallback?: () => void;\n eventHandlers?: PaywallEventHandlers;\n customPaywallTraits?: Record<string, any>;\n /** Optional. If true, the paywall will not be shown if the user already has an entitlement for a product in the paywall. */\n dontShowIfAlreadyEntitled?: boolean;\n};\n\nexport interface PaywallInfo {\n paywallTemplateName: string;\n shouldShow: boolean;\n}\n\n// Event handler types for per-presentation event handling\nexport interface PaywallEventHandlers {\n onOpen?: (event: PaywallOpenEvent) => void;\n onClose?: (event: PaywallCloseEvent) => void;\n onDismissed?: (event: PaywallDismissedEvent) => void;\n onPurchaseSucceeded?: (event: PurchaseSucceededEvent) => void;\n onOpenFailed?: (event: PaywallOpenFailedEvent) => void;\n onCustomPaywallAction?: (event: CustomPaywallActionEvent) => void;\n}\n\n// Typed event interfaces\nexport interface PaywallOpenEvent {\n type: 'paywallOpen';\n triggerName: string;\n paywallName: string;\n isSecondTry: boolean;\n viewType?: 'presented' | 'embedded' | 'triggered';\n}\n\nexport interface PaywallCloseEvent {\n type: 'paywallClose';\n triggerName: string;\n paywallName: string;\n isSecondTry: boolean;\n}\n\nexport interface PaywallDismissedEvent {\n type: 'paywallDismissed';\n triggerName: string;\n paywallName: string;\n isSecondTry: boolean;\n}\n\nexport interface PurchaseSucceededEvent {\n type: 'purchaseSucceeded';\n productId: string;\n triggerName: string;\n paywallName: string;\n isSecondTry: boolean;\n}\n\nexport interface PaywallOpenFailedEvent {\n type: 'paywallOpenFailed';\n triggerName: string;\n paywallName: string;\n error: string;\n paywallUnavailableReason?: string;\n isSecondTry: boolean;\n}\n\nexport interface CustomPaywallActionEvent {\n type: 'customPaywallAction';\n triggerName: string;\n paywallName: string;\n actionName: string;\n params: Record<string, any>;\n isSecondTry: boolean;\n}\n\nexport const HELIUM_CTA_NAMES = {\n SCHEDULE_CALL: 'schedule_call',\n SUBSCRIBE_BUTTON: 'subscribe_button',\n}\n"]}
@@ -1,29 +1,38 @@
1
1
  import { NativeModule } from "expo";
2
- import { HeliumDownloadStatus, HeliumPaywallSdkModuleEvents, HeliumTransactionStatus, NativeHeliumConfig } from "./HeliumPaywallSdk.types";
2
+ import { ExperimentInfo } from "./HeliumExperimentInfo.types";
3
+ import { HeliumDownloadStatus, HeliumLightDarkMode, HeliumPaywallSdkModuleEvents, HeliumTransactionStatus, NativeHeliumConfig } from "./HeliumPaywallSdk.types";
3
4
  interface PaywallInfoResult {
4
5
  errorMsg?: string;
5
6
  templateName?: string;
6
7
  shouldShow?: boolean;
7
8
  }
8
- interface CanPresentUpsellResult {
9
- canPresent?: boolean;
10
- reason?: string;
9
+ interface HasEntitlementResult {
10
+ hasEntitlement?: boolean;
11
+ }
12
+ interface ExperimentInfoResult extends Partial<ExperimentInfo> {
13
+ getExperimentInfoErrorMsg?: string;
11
14
  }
12
15
  declare class HeliumPaywallSdkModule extends NativeModule<HeliumPaywallSdkModuleEvents> {
13
16
  initialize(config: NativeHeliumConfig): void;
14
- presentUpsell(triggerName: string, customPaywallTraits?: Record<string, any>): void;
17
+ presentUpsell(triggerName: string, customPaywallTraits?: Record<string, any>, dontShowIfAlreadyEntitled?: boolean): void;
15
18
  hideUpsell(): void;
16
19
  hideAllUpsells(): void;
17
20
  getDownloadStatus(): HeliumDownloadStatus;
18
- canPresentUpsell(trigger: string): CanPresentUpsellResult;
19
21
  fallbackOpenOrCloseEvent(trigger: string, isOpen: boolean, viewType: string): void;
20
22
  handlePurchaseResult(statusString: HeliumTransactionStatus, errorMsg?: string): void;
21
23
  handleRestoreResult(success: boolean): void;
22
24
  getPaywallInfo(trigger: string): PaywallInfoResult;
23
25
  handleDeepLink(urlString: string): boolean;
24
26
  setRevenueCatAppUserId(rcAppUserId: string): void;
27
+ setCustomUserId(newUserId: string): void;
28
+ hasEntitlementForPaywall(trigger: string): Promise<HasEntitlementResult>;
25
29
  hasAnyActiveSubscription(): Promise<boolean>;
26
30
  hasAnyEntitlement(): Promise<boolean>;
31
+ resetHelium(): void;
32
+ setCustomRestoreFailedStrings(customTitle?: string, customMessage?: string, customCloseButtonText?: string): void;
33
+ disableRestoreFailedDialog(): void;
34
+ getExperimentInfoForTrigger(trigger: string): ExperimentInfoResult;
35
+ setLightDarkModeOverride(mode: HeliumLightDarkMode): void;
27
36
  }
28
37
  declare const _default: HeliumPaywallSdkModule;
29
38
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"HeliumPaywallSdkModule.d.ts","sourceRoot":"","sources":["../src/HeliumPaywallSdkModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EA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G,OAAO;IAE1C,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAEjD,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAExC,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAExE,wBAAwB,IAAI,OAAO,CAAC,OAAO,CAAC;IAE5C,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAErC,WAAW,IAAI,IAAI;IAEnB,6BAA6B,CAC3B,WAAW,CAAC,EAAE,MAAM,EACpB,aAAa,CAAC,EAAE,MAAM,EACtB,qBAAqB,CAAC,EAAE,MAAM,GAC7B,IAAI;IAEP,0BAA0B,IAAI,IAAI;IAElC,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB;IAElE,wBAAwB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI;CAC1D;;AAGD,wBAA+E"}
@@ -1 +1 @@
1
- {"version":3,"file":"HeliumPaywallSdkModule.js","sourceRoot":"","sources":["../src/HeliumPaywallSdkModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AA4DzD,yDAAyD;AACzD,eAAe,mBAAmB,CAAyB,kBAAkB,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from \"expo\";\n\nimport {\n HeliumDownloadStatus,\n HeliumPaywallSdkModuleEvents,\n HeliumTransactionStatus,\n NativeHeliumConfig,\n} from \"./HeliumPaywallSdk.types\";\n\ninterface PaywallInfoResult {\n errorMsg?: string;\n templateName?: string;\n shouldShow?: boolean;\n}\n\ninterface CanPresentUpsellResult {\n canPresent?: boolean;\n reason?: string;\n}\n\ndeclare class HeliumPaywallSdkModule extends NativeModule<HeliumPaywallSdkModuleEvents> {\n initialize(config: NativeHeliumConfig): void;\n\n presentUpsell(\n triggerName: string,\n customPaywallTraits?: Record<string, any>,\n ): void;\n\n hideUpsell(): void;\n\n hideAllUpsells(): void;\n\n getDownloadStatus(): HeliumDownloadStatus;\n\n canPresentUpsell(trigger: string): CanPresentUpsellResult;\n\n fallbackOpenOrCloseEvent(\n trigger: string,\n isOpen: boolean,\n viewType: string,\n ): void;\n\n handlePurchaseResult(\n statusString: HeliumTransactionStatus,\n errorMsg?: string,\n ): void;\n\n handleRestoreResult(success: boolean): void;\n\n getPaywallInfo(trigger: string): PaywallInfoResult;\n\n handleDeepLink(urlString: string): boolean;\n\n setRevenueCatAppUserId(rcAppUserId: string): void;\n\n hasAnyActiveSubscription(): Promise<boolean>;\n\n hasAnyEntitlement(): Promise<boolean>;\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<HeliumPaywallSdkModule>(\"HeliumPaywallSdk\");\n"]}
1
+ {"version":3,"file":"HeliumPaywallSdkModule.js","sourceRoot":"","sources":["../src/HeliumPaywallSdkModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAkFzD,yDAAyD;AACzD,eAAe,mBAAmB,CAAyB,kBAAkB,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from \"expo\";\n\nimport { ExperimentInfo } from \"./HeliumExperimentInfo.types\";\nimport {\n HeliumDownloadStatus,\n HeliumLightDarkMode,\n HeliumPaywallSdkModuleEvents,\n HeliumTransactionStatus,\n NativeHeliumConfig,\n} from \"./HeliumPaywallSdk.types\";\n\ninterface PaywallInfoResult {\n errorMsg?: string;\n templateName?: string;\n shouldShow?: boolean;\n}\n\ninterface HasEntitlementResult {\n hasEntitlement?: boolean;\n}\n\ninterface ExperimentInfoResult extends Partial<ExperimentInfo> {\n getExperimentInfoErrorMsg?: string;\n}\n\ndeclare class HeliumPaywallSdkModule extends NativeModule<HeliumPaywallSdkModuleEvents> {\n initialize(config: NativeHeliumConfig): void;\n\n presentUpsell(\n triggerName: string,\n customPaywallTraits?: Record<string, any>,\n dontShowIfAlreadyEntitled?: boolean,\n ): void;\n\n hideUpsell(): void;\n\n hideAllUpsells(): void;\n\n getDownloadStatus(): HeliumDownloadStatus;\n\n fallbackOpenOrCloseEvent(\n trigger: string,\n isOpen: boolean,\n viewType: string,\n ): void;\n\n handlePurchaseResult(\n statusString: HeliumTransactionStatus,\n errorMsg?: string,\n ): void;\n\n handleRestoreResult(success: boolean): void;\n\n getPaywallInfo(trigger: string): PaywallInfoResult;\n\n handleDeepLink(urlString: string): boolean;\n\n setRevenueCatAppUserId(rcAppUserId: string): void;\n\n setCustomUserId(newUserId: string): void;\n\n hasEntitlementForPaywall(trigger: string): Promise<HasEntitlementResult>;\n\n hasAnyActiveSubscription(): Promise<boolean>;\n\n hasAnyEntitlement(): Promise<boolean>;\n\n resetHelium(): void;\n\n setCustomRestoreFailedStrings(\n customTitle?: string,\n customMessage?: string,\n customCloseButtonText?: string,\n ): void;\n\n disableRestoreFailedDialog(): void;\n\n getExperimentInfoForTrigger(trigger: string): ExperimentInfoResult;\n\n setLightDarkModeOverride(mode: HeliumLightDarkMode): void;\n}\n\n// This call loads the native module object from the JSI.\nexport default requireNativeModule<HeliumPaywallSdkModule>(\"HeliumPaywallSdk\");\n"]}
package/build/index.d.ts CHANGED
@@ -1,12 +1,24 @@
1
1
  import { HeliumConfig, PaywallInfo, PresentUpsellParams } from "./HeliumPaywallSdk.types";
2
+ import { ExperimentInfo } from "./HeliumExperimentInfo.types";
2
3
  export { default } from './HeliumPaywallSdkModule';
3
4
  export * from './HeliumPaywallSdk.types';
5
+ export * from './HeliumExperimentInfo.types';
4
6
  export declare const initialize: (config: HeliumConfig) => void;
5
- export declare const presentUpsell: ({ triggerName, onFallback, eventHandlers, customPaywallTraits, }: PresentUpsellParams) => void;
7
+ export declare const presentUpsell: ({ triggerName, onFallback, eventHandlers, customPaywallTraits, dontShowIfAlreadyEntitled, }: PresentUpsellParams) => void;
6
8
  export declare const hideUpsell: () => void;
7
9
  export declare const hideAllUpsells: () => void;
8
10
  export declare const getDownloadStatus: () => import("./HeliumPaywallSdk.types").HeliumDownloadStatus;
9
11
  export declare const setRevenueCatAppUserId: (rcAppUserId: string) => void;
12
+ /**
13
+ * Set a custom user ID for the current user
14
+ */
15
+ export declare const setCustomUserId: (newUserId: string) => void;
16
+ /**
17
+ * Checks if the user has an active entitlement for any product attached to the paywall that will show for provided trigger.
18
+ * @param trigger The trigger name to check entitlement for
19
+ * @returns Promise resolving to true if entitled, false if not, or undefined if not known (i.e. the paywall is not downloaded yet)
20
+ */
21
+ export declare const hasEntitlementForPaywall: (trigger: string) => Promise<boolean | undefined>;
10
22
  /**
11
23
  * Checks if the user has any active subscription (including non-renewable)
12
24
  */
@@ -15,6 +27,32 @@ export declare const hasAnyActiveSubscription: () => Promise<boolean>;
15
27
  * Checks if the user has any entitlement
16
28
  */
17
29
  export declare const hasAnyEntitlement: () => Promise<boolean>;
30
+ /**
31
+ * Reset Helium entirely so you can call initialize again. Only for advanced use cases.
32
+ */
33
+ export declare const resetHelium: () => void;
34
+ /**
35
+ * Set custom strings to show in the dialog that Helium will display if a "Restore Purchases" action is not successful.
36
+ * Note that these strings will not be localized by Helium for you.
37
+ */
38
+ export declare const setCustomRestoreFailedStrings: (customTitle?: string, customMessage?: string, customCloseButtonText?: string) => void;
39
+ /**
40
+ * Disable the default dialog that Helium will display if a "Restore Purchases" action is not successful.
41
+ * You can handle this yourself if desired by listening for the PurchaseRestoreFailedEvent.
42
+ */
43
+ export declare const disableRestoreFailedDialog: () => void;
44
+ /**
45
+ * Override the light/dark mode for Helium paywalls
46
+ * @param mode The mode to set: 'light', 'dark', or 'system' (follows device setting)
47
+ */
48
+ export declare const setLightDarkModeOverride: (mode: import("./HeliumPaywallSdk.types").HeliumLightDarkMode) => void;
49
+ /**
50
+ * Get experiment allocation info for a specific trigger
51
+ *
52
+ * @param trigger The trigger name to get experiment info for
53
+ * @returns ExperimentInfo if the trigger has experiment data, undefined otherwise
54
+ */
55
+ export declare const getExperimentInfoForTrigger: (trigger: string) => ExperimentInfo | undefined;
18
56
  export declare const getPaywallInfo: (trigger: string) => PaywallInfo | undefined;
19
57
  export declare const handleDeepLink: (url: string | null) => boolean;
20
58
  export { createCustomPurchaseConfig, HELIUM_CTA_NAMES } from './HeliumPaywallSdk.types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAE8B,WAAW,EAAE,mBAAmB,EAC3E,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,cAAe,0BAA0B,CAAC;AAe1C,eAAO,MAAM,UAAU,GAAI,QAAQ,YAAY,SAmD9C,CAAC;AA6CF,eAAO,MAAM,aAAa,GAAI,kEAKG,mBAAmB,SAuBnD,CAAC;AA+DF,eAAO,MAAM,UAAU,YAAoC,CAAC;AAC5D,eAAO,MAAM,cAAc,YAAwC,CAAC;AACpE,eAAO,MAAM,iBAAiB,+DAA2C,CAAC;AAC1E,eAAO,MAAM,sBAAsB,+BAAgD,CAAC;AAEpF;;GAEG;AACH,eAAO,MAAM,wBAAwB,wBAAkD,CAAC;AAExF;;GAEG;AACH,eAAO,MAAM,iBAAiB,wBAA2C,CAAC;AAE1E,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,KAAG,WAAW,GAAG,SAc9D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,GAAG,IAAI,YAOhD,CAAC;AAmCF,OAAO,EAAC,0BAA0B,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAE8B,WAAW,EAAE,mBAAmB,EAC3E,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAK9D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,cAAe,0BAA0B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAe7C,eAAO,MAAM,UAAU,GAAI,QAAQ,YAAY,SAmD9C,CAAC;AA6CF,eAAO,MAAM,aAAa,GAAI,6FAMG,mBAAmB,SAYnD,CAAC;AAyFF,eAAO,MAAM,UAAU,YAAoC,CAAC;AAC5D,eAAO,MAAM,cAAc,YAAwC,CAAC;AACpE,eAAO,MAAM,iBAAiB,+DAA2C,CAAC;AAC1E,eAAO,MAAM,sBAAsB,+BAAgD,CAAC;AAEpF;;GAEG;AACH,eAAO,MAAM,eAAe,6BAAyC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAU,SAAS,MAAM,KAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAG3F,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,wBAAkD,CAAC;AAExF;;GAEG;AACH,eAAO,MAAM,iBAAiB,wBAA2C,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,WAAW,YAAqC,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,6BAA6B,wFAAuD,CAAC;AAElG;;;GAGG;AACH,eAAO,MAAM,0BAA0B,YAAoD,CAAC;AAE5F;;;GAGG;AACH,eAAO,MAAM,wBAAwB,wEAAkD,CAAC;AAExF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GAAI,SAAS,MAAM,KAAG,cAAc,GAAG,SAe9E,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,KAAG,WAAW,GAAG,SAc9D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,GAAG,IAAI,YAOhD,CAAC;AAmCF,OAAO,EAAC,0BAA0B,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC"}
package/build/index.js CHANGED
@@ -3,6 +3,7 @@ import * as ExpoFileSystem from 'expo-file-system';
3
3
  export { default } from './HeliumPaywallSdkModule';
4
4
  // export { default as HeliumPaywallSdkView } from './HeliumPaywallSdkView';
5
5
  export * from './HeliumPaywallSdk.types';
6
+ export * from './HeliumExperimentInfo.types';
6
7
  function addHeliumPaywallEventListener(listener) {
7
8
  return HeliumPaywallSdkModule.addListener('onHeliumPaywallEvent', listener);
8
9
  }
@@ -98,21 +99,14 @@ const nativeInitializeAsync = async (config) => {
98
99
  };
99
100
  let paywallEventHandlers;
100
101
  let presentOnFallback;
101
- export const presentUpsell = ({ triggerName, onFallback, eventHandlers, customPaywallTraits, }) => {
102
- const { canPresent, reason } = HeliumPaywallSdkModule.canPresentUpsell(triggerName);
103
- if (!canPresent) {
104
- console.log(`[Helium] Cannot present trigger "${triggerName}". Reason: ${reason}`);
105
- onFallback?.();
106
- HeliumPaywallSdkModule.fallbackOpenOrCloseEvent(triggerName, true, 'presented');
107
- return;
108
- }
102
+ export const presentUpsell = ({ triggerName, onFallback, eventHandlers, customPaywallTraits, dontShowIfAlreadyEntitled, }) => {
109
103
  try {
110
104
  paywallEventHandlers = eventHandlers;
111
105
  presentOnFallback = onFallback;
112
- HeliumPaywallSdkModule.presentUpsell(triggerName, convertBooleansToMarkers(customPaywallTraits));
106
+ HeliumPaywallSdkModule.presentUpsell(triggerName, convertBooleansToMarkers(customPaywallTraits), dontShowIfAlreadyEntitled);
113
107
  }
114
108
  catch (error) {
115
- console.log('Helium present error', error);
109
+ console.log('[Helium] presentUpsell error', error);
116
110
  paywallEventHandlers = undefined;
117
111
  presentOnFallback = undefined;
118
112
  onFallback?.();
@@ -156,6 +150,26 @@ function callPaywallEventHandlers(event) {
156
150
  isSecondTry: event.isSecondTry ?? false,
157
151
  });
158
152
  break;
153
+ case 'paywallOpenFailed':
154
+ paywallEventHandlers?.onOpenFailed?.({
155
+ type: 'paywallOpenFailed',
156
+ triggerName: event.triggerName ?? 'unknown',
157
+ paywallName: event.paywallName ?? 'unknown',
158
+ error: event.error ?? 'Unknown error',
159
+ paywallUnavailableReason: event.paywallUnavailableReason,
160
+ isSecondTry: event.isSecondTry ?? false,
161
+ });
162
+ break;
163
+ case 'customPaywallAction':
164
+ paywallEventHandlers?.onCustomPaywallAction?.({
165
+ type: 'customPaywallAction',
166
+ triggerName: event.triggerName ?? 'unknown',
167
+ paywallName: event.paywallName ?? 'unknown',
168
+ actionName: event.customPaywallActionName ?? 'unknown',
169
+ params: event.customPaywallActionParams ?? {},
170
+ isSecondTry: event.isSecondTry ?? false,
171
+ });
172
+ break;
159
173
  }
160
174
  }
161
175
  }
@@ -173,7 +187,13 @@ function handlePaywallEvent(event) {
173
187
  break;
174
188
  case 'paywallOpenFailed':
175
189
  paywallEventHandlers = undefined;
176
- presentOnFallback?.();
190
+ const unavailableReason = event.paywallUnavailableReason;
191
+ if (event.triggerName
192
+ && unavailableReason !== "alreadyPresented"
193
+ && unavailableReason !== "secondTryNoMatch") {
194
+ console.log('[Helium] paywall open failed', unavailableReason);
195
+ presentOnFallback?.();
196
+ }
177
197
  presentOnFallback = undefined;
178
198
  break;
179
199
  }
@@ -182,6 +202,19 @@ export const hideUpsell = HeliumPaywallSdkModule.hideUpsell;
182
202
  export const hideAllUpsells = HeliumPaywallSdkModule.hideAllUpsells;
183
203
  export const getDownloadStatus = HeliumPaywallSdkModule.getDownloadStatus;
184
204
  export const setRevenueCatAppUserId = HeliumPaywallSdkModule.setRevenueCatAppUserId;
205
+ /**
206
+ * Set a custom user ID for the current user
207
+ */
208
+ export const setCustomUserId = HeliumPaywallSdkModule.setCustomUserId;
209
+ /**
210
+ * Checks if the user has an active entitlement for any product attached to the paywall that will show for provided trigger.
211
+ * @param trigger The trigger name to check entitlement for
212
+ * @returns Promise resolving to true if entitled, false if not, or undefined if not known (i.e. the paywall is not downloaded yet)
213
+ */
214
+ export const hasEntitlementForPaywall = async (trigger) => {
215
+ const result = await HeliumPaywallSdkModule.hasEntitlementForPaywall(trigger);
216
+ return result?.hasEntitlement;
217
+ };
185
218
  /**
186
219
  * Checks if the user has any active subscription (including non-renewable)
187
220
  */
@@ -190,6 +223,47 @@ export const hasAnyActiveSubscription = HeliumPaywallSdkModule.hasAnyActiveSubsc
190
223
  * Checks if the user has any entitlement
191
224
  */
192
225
  export const hasAnyEntitlement = HeliumPaywallSdkModule.hasAnyEntitlement;
226
+ /**
227
+ * Reset Helium entirely so you can call initialize again. Only for advanced use cases.
228
+ */
229
+ export const resetHelium = HeliumPaywallSdkModule.resetHelium;
230
+ /**
231
+ * Set custom strings to show in the dialog that Helium will display if a "Restore Purchases" action is not successful.
232
+ * Note that these strings will not be localized by Helium for you.
233
+ */
234
+ export const setCustomRestoreFailedStrings = HeliumPaywallSdkModule.setCustomRestoreFailedStrings;
235
+ /**
236
+ * Disable the default dialog that Helium will display if a "Restore Purchases" action is not successful.
237
+ * You can handle this yourself if desired by listening for the PurchaseRestoreFailedEvent.
238
+ */
239
+ export const disableRestoreFailedDialog = HeliumPaywallSdkModule.disableRestoreFailedDialog;
240
+ /**
241
+ * Override the light/dark mode for Helium paywalls
242
+ * @param mode The mode to set: 'light', 'dark', or 'system' (follows device setting)
243
+ */
244
+ export const setLightDarkModeOverride = HeliumPaywallSdkModule.setLightDarkModeOverride;
245
+ /**
246
+ * Get experiment allocation info for a specific trigger
247
+ *
248
+ * @param trigger The trigger name to get experiment info for
249
+ * @returns ExperimentInfo if the trigger has experiment data, undefined otherwise
250
+ */
251
+ export const getExperimentInfoForTrigger = (trigger) => {
252
+ const result = HeliumPaywallSdkModule.getExperimentInfoForTrigger(trigger);
253
+ if (!result) {
254
+ console.log('[Helium] getExperimentInfoForTrigger unexpected error.');
255
+ return;
256
+ }
257
+ if (result.getExperimentInfoErrorMsg) {
258
+ return;
259
+ }
260
+ // Validate required field exists before casting
261
+ if (!result.trigger) {
262
+ console.log('[Helium] getExperimentInfoForTrigger returned data without required trigger field.');
263
+ return;
264
+ }
265
+ return result;
266
+ };
193
267
  export const getPaywallInfo = (trigger) => {
194
268
  const result = HeliumPaywallSdkModule.getPaywallInfo(trigger);
195
269
  if (!result) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../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liumPaywallEvent,\n NativeHeliumConfig, PaywallEventHandlers, PaywallInfo, PresentUpsellParams,\n} from \"./HeliumPaywallSdk.types\";\nimport HeliumPaywallSdkModule from \"./HeliumPaywallSdkModule\";\nimport { EventSubscription } from 'expo-modules-core';\nimport * as ExpoFileSystem from 'expo-file-system';\n\nexport { default } from './HeliumPaywallSdkModule';\n// export { default as HeliumPaywallSdkView } from './HeliumPaywallSdkView';\nexport * from './HeliumPaywallSdk.types';\n\nfunction addHeliumPaywallEventListener(listener: (event: HeliumPaywallEvent) => void): EventSubscription {\n return HeliumPaywallSdkModule.addListener('onHeliumPaywallEvent', listener);\n}\n\nfunction addDelegateActionEventListener(listener: (event: DelegateActionEvent) => void): EventSubscription {\n return HeliumPaywallSdkModule.addListener('onDelegateActionEvent', listener);\n}\n\nfunction addPaywallEventHandlersListener(listener: (event: HeliumPaywallEvent) => void): EventSubscription {\n return HeliumPaywallSdkModule.addListener('paywallEventHandlers', listener);\n}\n\nlet isInitialized = false;\nexport const initialize = (config: HeliumConfig) => {\n if (isInitialized) {\n return;\n }\n isInitialized = true;\n\n HeliumPaywallSdkModule.removeAllListeners('onHeliumPaywallEvent');\n HeliumPaywallSdkModule.removeAllListeners('onDelegateActionEvent');\n HeliumPaywallSdkModule.removeAllListeners('paywallEventHandlers');\n\n // Set up listener for paywall events\n addHeliumPaywallEventListener((event) => {\n handlePaywallEvent(event);\n config.onHeliumPaywallEvent(event);\n });\n\n // Set up delegate action listener for purchase and restore operations\n const purchaseConfig = config.purchaseConfig;\n if (purchaseConfig) {\n addDelegateActionEventListener(async (event) => {\n try {\n if (event.type === 'purchase') {\n if (event.productId) {\n const result = await purchaseConfig.makePurchase(event.productId);\n HeliumPaywallSdkModule.handlePurchaseResult(result.status, result.error);\n } else {\n HeliumPaywallSdkModule.handlePurchaseResult('failed', 'No product ID for purchase event.');\n }\n } else if (event.type === 'restore') {\n const success = await purchaseConfig.restorePurchases();\n HeliumPaywallSdkModule.handleRestoreResult(success);\n }\n } catch (error) {\n // Send failure result based on action type\n if (event.type === 'purchase') {\n console.log('[Helium] Unexpected error: ', error);\n HeliumPaywallSdkModule.handlePurchaseResult('failed');\n } else if (event.type === 'restore') {\n HeliumPaywallSdkModule.handleRestoreResult(false);\n }\n }\n });\n }\n\n addPaywallEventHandlersListener((event) => {\n callPaywallEventHandlers(event);\n });\n\n nativeInitializeAsync(config).catch(error => {\n console.error('[Helium] Initialization failed:', error);\n });\n};\n\nconst nativeInitializeAsync = async (config: HeliumConfig) => {\n let fallbackBundleUrlString;\n let fallbackBundleString;\n if (config.fallbackBundle) {\n try {\n const jsonContent = JSON.stringify(config.fallbackBundle);\n\n // Write to documents directory\n fallbackBundleUrlString = `${ExpoFileSystem.documentDirectory}helium-fallback.json`;\n // This is ASYNC but that's ok because helium initialize in swift code is async anyways.\n await ExpoFileSystem.writeAsStringAsync(\n fallbackBundleUrlString,\n jsonContent\n );\n } catch (error) {\n // Fallback to string approach if unexpected error occurs\n console.log(\n '[Helium] expo-file-system not available, attempting to pass fallback bundle as string.'\n );\n fallbackBundleString = JSON.stringify(config.fallbackBundle);\n }\n }\n\n\n // Create native config object\n const nativeConfig: NativeHeliumConfig = {\n apiKey: config.apiKey,\n customUserId: config.customUserId,\n customAPIEndpoint: config.customAPIEndpoint,\n customUserTraits: convertBooleansToMarkers(config.customUserTraits),\n revenueCatAppUserId: config.revenueCatAppUserId,\n fallbackBundleUrlString: fallbackBundleUrlString,\n fallbackBundleString: fallbackBundleString,\n paywallLoadingConfig: convertBooleansToMarkers(config.paywallLoadingConfig),\n useDefaultDelegate: !config.purchaseConfig,\n };\n\n // Initialize the native module\n HeliumPaywallSdkModule.initialize(nativeConfig);\n};\n\nlet paywallEventHandlers: PaywallEventHandlers | undefined;\nlet presentOnFallback: (() => void) | undefined;\nexport const presentUpsell = ({\n triggerName,\n onFallback,\n eventHandlers,\n customPaywallTraits,\n }: PresentUpsellParams) => {\n const {canPresent, reason} = HeliumPaywallSdkModule.canPresentUpsell(triggerName);\n\n if (!canPresent) {\n console.log(\n `[Helium] Cannot present trigger \"${triggerName}\". Reason: ${reason}`\n );\n onFallback?.();\n HeliumPaywallSdkModule.fallbackOpenOrCloseEvent(triggerName, true, 'presented');\n return;\n }\n\n try {\n paywallEventHandlers = eventHandlers;\n presentOnFallback = onFallback;\n HeliumPaywallSdkModule.presentUpsell(triggerName, convertBooleansToMarkers(customPaywallTraits));\n } catch (error) {\n console.log('Helium present error', error);\n paywallEventHandlers = undefined;\n presentOnFallback = undefined;\n onFallback?.();\n HeliumPaywallSdkModule.fallbackOpenOrCloseEvent(triggerName, true, 'presented');\n }\n};\n\nfunction callPaywallEventHandlers(event: HeliumPaywallEvent) {\n if (paywallEventHandlers) {\n switch (event.type) {\n case 'paywallOpen':\n paywallEventHandlers?.onOpen?.({\n type: 'paywallOpen',\n triggerName: event.triggerName ?? 'unknown',\n paywallName: event.paywallName ?? 'unknown',\n isSecondTry: event.isSecondTry ?? false,\n viewType: 'presented',\n });\n break;\n case 'paywallClose':\n paywallEventHandlers?.onClose?.({\n type: 'paywallClose',\n triggerName: event.triggerName ?? 'unknown',\n paywallName: event.paywallName ?? 'unknown',\n isSecondTry: event.isSecondTry ?? false,\n });\n break;\n case 'paywallDismissed':\n paywallEventHandlers?.onDismissed?.({\n type: 'paywallDismissed',\n triggerName: event.triggerName ?? 'unknown',\n paywallName: event.paywallName ?? 'unknown',\n isSecondTry: event.isSecondTry ?? false,\n });\n break;\n case 'purchaseSucceeded':\n paywallEventHandlers?.onPurchaseSucceeded?.({\n type: 'purchaseSucceeded',\n productId: event.productId ?? 'unknown',\n triggerName: event.triggerName ?? 'unknown',\n paywallName: event.paywallName ?? 'unknown',\n isSecondTry: event.isSecondTry ?? false,\n });\n break;\n }\n }\n}\n\nfunction handlePaywallEvent(event: HeliumPaywallEvent) {\n switch (event.type) {\n case 'paywallClose':\n if (!event.isSecondTry) {\n paywallEventHandlers = undefined;\n }\n presentOnFallback = undefined;\n break;\n case 'paywallSkipped':\n paywallEventHandlers = undefined;\n presentOnFallback = undefined;\n break;\n case 'paywallOpenFailed':\n paywallEventHandlers = undefined;\n presentOnFallback?.();\n presentOnFallback = undefined;\n break;\n }\n}\n\nexport const hideUpsell = HeliumPaywallSdkModule.hideUpsell;\nexport const hideAllUpsells = HeliumPaywallSdkModule.hideAllUpsells;\nexport const getDownloadStatus = HeliumPaywallSdkModule.getDownloadStatus;\nexport const setRevenueCatAppUserId = HeliumPaywallSdkModule.setRevenueCatAppUserId;\n\n/**\n * Checks if the user has any active subscription (including non-renewable)\n */\nexport const hasAnyActiveSubscription = HeliumPaywallSdkModule.hasAnyActiveSubscription;\n\n/**\n * Checks if the user has any entitlement\n */\nexport const hasAnyEntitlement = HeliumPaywallSdkModule.hasAnyEntitlement;\n\nexport const getPaywallInfo = (trigger: string): PaywallInfo | undefined => {\n const result = HeliumPaywallSdkModule.getPaywallInfo(trigger);\n if (!result) {\n console.log('[Helium] getPaywallInfo unexpected error.');\n return;\n }\n if (result.errorMsg) {\n console.log(`[Helium] ${result.errorMsg}`);\n return;\n }\n return {\n paywallTemplateName: result.templateName ?? 'unknown template',\n shouldShow: result.shouldShow ?? true,\n };\n};\n\nexport const handleDeepLink = (url: string | null) => {\n if (url) {\n const handled = HeliumPaywallSdkModule.handleDeepLink(url);\n console.log('[Helium] Handled deep link:', handled);\n return handled;\n }\n return false;\n};\n\n/**\n * Recursively converts boolean values to special marker strings to preserve\n * type information when passing through native bridge.\n *\n * Native bridge converts booleans to NSNumber (0/1), making them\n * indistinguishable from actual numeric values. This helper converts:\n * - true -> \"__helium_rn_bool_true__\"\n * - false -> \"__helium_rn_bool_false__\"\n * - All other values remain unchanged\n */\nfunction convertBooleansToMarkers(input: Record<string, any> | undefined): Record<string, any> | undefined {\n if (!input) return undefined;\n\n const result: Record<string, any> = {};\n for (const [key, value] of Object.entries(input)) {\n result[key] = convertValueBooleansToMarkers(value);\n }\n return result;\n}\n/**\n * Helper to recursively convert booleans in any value type\n */\nfunction convertValueBooleansToMarkers(value: any): any {\n if (typeof value === 'boolean') {\n return value ? \"__helium_rn_bool_true__\" : \"__helium_rn_bool_false__\";\n } else if (value && typeof value === 'object' && !Array.isArray(value)) {\n return convertBooleansToMarkers(value);\n } else if (value && Array.isArray(value)) {\n return value.map(convertValueBooleansToMarkers);\n }\n return value;\n}\n\nexport {createCustomPurchaseConfig, HELIUM_CTA_NAMES} from './HeliumPaywallSdk.types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,4EAA4E;AAC5E,cAAe,0BAA0B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAE7C,SAAS,6BAA6B,CAAC,QAA6C;IAClF,OAAO,sBAAsB,CAAC,WAAW,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,8BAA8B,CAAC,QAA8C;IACpF,OAAO,sBAAsB,CAAC,WAAW,CAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,+BAA+B,CAAC,QAA6C;IACpF,OAAO,sBAAsB,CAAC,WAAW,CAAC,sBAAsB,EAAE,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED,IAAI,aAAa,GAAG,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAoB,EAAE,EAAE;IACjD,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO;IACT,CAAC;IACD,aAAa,GAAG,IAAI,CAAC;IAErB,sBAAsB,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAC;IAClE,sBAAsB,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;IACnE,sBAAsB,CAAC,kBAAkB,CAAC,sBAAsB,CAA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C;IAE7B,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,MAAM,CAAC,GAAG,CAAC,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AACD;;GAEG;AACH,SAAS,6BAA6B,CAAC,KAAU;IAC/C,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,0BAA0B,CAAC;IACxE,CAAC;SAAM,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvE,OAAO,wBAAwB,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;SAAM,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,OAAO,EAAC,0BAA0B,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC","sourcesContent":["import {\n DelegateActionEvent,\n HeliumConfig,\n HeliumPaywallEvent,\n NativeHeliumConfig, PaywallEventHandlers, PaywallInfo, PresentUpsellParams,\n} from \"./HeliumPaywallSdk.types\";\nimport { ExperimentInfo } from \"./HeliumExperimentInfo.types\";\nimport HeliumPaywallSdkModule from \"./HeliumPaywallSdkModule\";\nimport { EventSubscription } from 'expo-modules-core';\nimport * as ExpoFileSystem from 'expo-file-system';\n\nexport { default } from './HeliumPaywallSdkModule';\n// export { default as HeliumPaywallSdkView } from './HeliumPaywallSdkView';\nexport * from './HeliumPaywallSdk.types';\nexport * from './HeliumExperimentInfo.types';\n\nfunction addHeliumPaywallEventListener(listener: (event: HeliumPaywallEvent) => void): EventSubscription {\n return HeliumPaywallSdkModule.addListener('onHeliumPaywallEvent', listener);\n}\n\nfunction addDelegateActionEventListener(listener: (event: DelegateActionEvent) => void): EventSubscription {\n return HeliumPaywallSdkModule.addListener('onDelegateActionEvent', listener);\n}\n\nfunction addPaywallEventHandlersListener(listener: (event: HeliumPaywallEvent) => void): EventSubscription {\n return HeliumPaywallSdkModule.addListener('paywallEventHandlers', listener);\n}\n\nlet isInitialized = false;\nexport const initialize = (config: HeliumConfig) => {\n if (isInitialized) {\n return;\n }\n isInitialized = true;\n\n HeliumPaywallSdkModule.removeAllListeners('onHeliumPaywallEvent');\n HeliumPaywallSdkModule.removeAllListeners('onDelegateActionEvent');\n HeliumPaywallSdkModule.removeAllListeners('paywallEventHandlers');\n\n // Set up listener for paywall events\n addHeliumPaywallEventListener((event) => {\n handlePaywallEvent(event);\n config.onHeliumPaywallEvent(event);\n });\n\n // Set up delegate action listener for purchase and restore operations\n const purchaseConfig = config.purchaseConfig;\n if (purchaseConfig) {\n addDelegateActionEventListener(async (event) => {\n try {\n if (event.type === 'purchase') {\n if (event.productId) {\n const result = await purchaseConfig.makePurchase(event.productId);\n HeliumPaywallSdkModule.handlePurchaseResult(result.status, result.error);\n } else {\n HeliumPaywallSdkModule.handlePurchaseResult('failed', 'No product ID for purchase event.');\n }\n } else if (event.type === 'restore') {\n const success = await purchaseConfig.restorePurchases();\n HeliumPaywallSdkModule.handleRestoreResult(success);\n }\n } catch (error) {\n // Send failure result based on action type\n if (event.type === 'purchase') {\n console.log('[Helium] Unexpected error: ', error);\n HeliumPaywallSdkModule.handlePurchaseResult('failed');\n } else if (event.type === 'restore') {\n HeliumPaywallSdkModule.handleRestoreResult(false);\n }\n }\n });\n }\n\n addPaywallEventHandlersListener((event) => {\n callPaywallEventHandlers(event);\n });\n\n nativeInitializeAsync(config).catch(error => {\n console.error('[Helium] Initialization failed:', error);\n });\n};\n\nconst nativeInitializeAsync = async (config: HeliumConfig) => {\n let fallbackBundleUrlString;\n let fallbackBundleString;\n if (config.fallbackBundle) {\n try {\n const jsonContent = JSON.stringify(config.fallbackBundle);\n\n // Write to documents directory\n fallbackBundleUrlString = `${ExpoFileSystem.documentDirectory}helium-fallback.json`;\n // This is ASYNC but that's ok because helium initialize in swift code is async anyways.\n await ExpoFileSystem.writeAsStringAsync(\n fallbackBundleUrlString,\n jsonContent\n );\n } catch (error) {\n // Fallback to string approach if unexpected error occurs\n console.log(\n '[Helium] expo-file-system not available, attempting to pass fallback bundle as string.'\n );\n fallbackBundleString = JSON.stringify(config.fallbackBundle);\n }\n }\n\n\n // Create native config object\n const nativeConfig: NativeHeliumConfig = {\n apiKey: config.apiKey,\n customUserId: config.customUserId,\n customAPIEndpoint: config.customAPIEndpoint,\n customUserTraits: convertBooleansToMarkers(config.customUserTraits),\n revenueCatAppUserId: config.revenueCatAppUserId,\n fallbackBundleUrlString: fallbackBundleUrlString,\n fallbackBundleString: fallbackBundleString,\n paywallLoadingConfig: convertBooleansToMarkers(config.paywallLoadingConfig),\n useDefaultDelegate: !config.purchaseConfig,\n };\n\n // Initialize the native module\n HeliumPaywallSdkModule.initialize(nativeConfig);\n};\n\nlet paywallEventHandlers: PaywallEventHandlers | undefined;\nlet presentOnFallback: (() => void) | undefined;\nexport const presentUpsell = ({\n triggerName,\n onFallback,\n eventHandlers,\n customPaywallTraits,\n dontShowIfAlreadyEntitled,\n }: PresentUpsellParams) => {\n try {\n paywallEventHandlers = eventHandlers;\n presentOnFallback = onFallback;\n HeliumPaywallSdkModule.presentUpsell(triggerName, convertBooleansToMarkers(customPaywallTraits), dontShowIfAlreadyEntitled);\n } catch (error) {\n console.log('[Helium] presentUpsell error', error);\n paywallEventHandlers = undefined;\n presentOnFallback = undefined;\n onFallback?.();\n HeliumPaywallSdkModule.fallbackOpenOrCloseEvent(triggerName, true, 'presented');\n }\n};\n\nfunction callPaywallEventHandlers(event: HeliumPaywallEvent) {\n if (paywallEventHandlers) {\n switch (event.type) {\n case 'paywallOpen':\n paywallEventHandlers?.onOpen?.({\n type: 'paywallOpen',\n triggerName: event.triggerName ?? 'unknown',\n paywallName: event.paywallName ?? 'unknown',\n isSecondTry: event.isSecondTry ?? false,\n viewType: 'presented',\n });\n break;\n case 'paywallClose':\n paywallEventHandlers?.onClose?.({\n type: 'paywallClose',\n triggerName: event.triggerName ?? 'unknown',\n paywallName: event.paywallName ?? 'unknown',\n isSecondTry: event.isSecondTry ?? false,\n });\n break;\n case 'paywallDismissed':\n paywallEventHandlers?.onDismissed?.({\n type: 'paywallDismissed',\n triggerName: event.triggerName ?? 'unknown',\n paywallName: event.paywallName ?? 'unknown',\n isSecondTry: event.isSecondTry ?? false,\n });\n break;\n case 'purchaseSucceeded':\n paywallEventHandlers?.onPurchaseSucceeded?.({\n type: 'purchaseSucceeded',\n productId: event.productId ?? 'unknown',\n triggerName: event.triggerName ?? 'unknown',\n paywallName: event.paywallName ?? 'unknown',\n isSecondTry: event.isSecondTry ?? false,\n });\n break;\n case 'paywallOpenFailed':\n paywallEventHandlers?.onOpenFailed?.({\n type: 'paywallOpenFailed',\n triggerName: event.triggerName ?? 'unknown',\n paywallName: event.paywallName ?? 'unknown',\n error: event.error ?? 'Unknown error',\n paywallUnavailableReason: event.paywallUnavailableReason,\n isSecondTry: event.isSecondTry ?? false,\n });\n break;\n case 'customPaywallAction':\n paywallEventHandlers?.onCustomPaywallAction?.({\n type: 'customPaywallAction',\n triggerName: event.triggerName ?? 'unknown',\n paywallName: event.paywallName ?? 'unknown',\n actionName: event.customPaywallActionName ?? 'unknown',\n params: event.customPaywallActionParams ?? {},\n isSecondTry: event.isSecondTry ?? false,\n });\n break;\n }\n }\n}\n\nfunction handlePaywallEvent(event: HeliumPaywallEvent) {\n switch (event.type) {\n case 'paywallClose':\n if (!event.isSecondTry) {\n paywallEventHandlers = undefined;\n }\n presentOnFallback = undefined;\n break;\n case 'paywallSkipped':\n paywallEventHandlers = undefined;\n presentOnFallback = undefined;\n break;\n case 'paywallOpenFailed':\n paywallEventHandlers = undefined;\n const unavailableReason = event.paywallUnavailableReason;\n if (event.triggerName\n && unavailableReason !== \"alreadyPresented\"\n && unavailableReason !== \"secondTryNoMatch\") {\n console.log('[Helium] paywall open failed', unavailableReason);\n presentOnFallback?.();\n }\n presentOnFallback = undefined;\n break;\n }\n}\n\nexport const hideUpsell = HeliumPaywallSdkModule.hideUpsell;\nexport const hideAllUpsells = HeliumPaywallSdkModule.hideAllUpsells;\nexport const getDownloadStatus = HeliumPaywallSdkModule.getDownloadStatus;\nexport const setRevenueCatAppUserId = HeliumPaywallSdkModule.setRevenueCatAppUserId;\n\n/**\n * Set a custom user ID for the current user\n */\nexport const setCustomUserId = HeliumPaywallSdkModule.setCustomUserId;\n\n/**\n * Checks if the user has an active entitlement for any product attached to the paywall that will show for provided trigger.\n * @param trigger The trigger name to check entitlement for\n * @returns Promise resolving to true if entitled, false if not, or undefined if not known (i.e. the paywall is not downloaded yet)\n */\nexport const hasEntitlementForPaywall = async (trigger: string): Promise<boolean | undefined> => {\n const result = await HeliumPaywallSdkModule.hasEntitlementForPaywall(trigger);\n return result?.hasEntitlement;\n};\n\n/**\n * Checks if the user has any active subscription (including non-renewable)\n */\nexport const hasAnyActiveSubscription = HeliumPaywallSdkModule.hasAnyActiveSubscription;\n\n/**\n * Checks if the user has any entitlement\n */\nexport const hasAnyEntitlement = HeliumPaywallSdkModule.hasAnyEntitlement;\n\n/**\n * Reset Helium entirely so you can call initialize again. Only for advanced use cases.\n */\nexport const resetHelium = HeliumPaywallSdkModule.resetHelium;\n\n/**\n * Set custom strings to show in the dialog that Helium will display if a \"Restore Purchases\" action is not successful.\n * Note that these strings will not be localized by Helium for you.\n */\nexport const setCustomRestoreFailedStrings = HeliumPaywallSdkModule.setCustomRestoreFailedStrings;\n\n/**\n * Disable the default dialog that Helium will display if a \"Restore Purchases\" action is not successful.\n * You can handle this yourself if desired by listening for the PurchaseRestoreFailedEvent.\n */\nexport const disableRestoreFailedDialog = HeliumPaywallSdkModule.disableRestoreFailedDialog;\n\n/**\n * Override the light/dark mode for Helium paywalls\n * @param mode The mode to set: 'light', 'dark', or 'system' (follows device setting)\n */\nexport const setLightDarkModeOverride = HeliumPaywallSdkModule.setLightDarkModeOverride;\n\n/**\n * Get experiment allocation info for a specific trigger\n *\n * @param trigger The trigger name to get experiment info for\n * @returns ExperimentInfo if the trigger has experiment data, undefined otherwise\n */\nexport const getExperimentInfoForTrigger = (trigger: string): ExperimentInfo | undefined => {\n const result = HeliumPaywallSdkModule.getExperimentInfoForTrigger(trigger);\n if (!result) {\n console.log('[Helium] getExperimentInfoForTrigger unexpected error.');\n return;\n }\n if (result.getExperimentInfoErrorMsg) {\n return;\n }\n // Validate required field exists before casting\n if (!result.trigger) {\n console.log('[Helium] getExperimentInfoForTrigger returned data without required trigger field.');\n return;\n }\n return result as ExperimentInfo;\n};\n\nexport const getPaywallInfo = (trigger: string): PaywallInfo | undefined => {\n const result = HeliumPaywallSdkModule.getPaywallInfo(trigger);\n if (!result) {\n console.log('[Helium] getPaywallInfo unexpected error.');\n return;\n }\n if (result.errorMsg) {\n console.log(`[Helium] ${result.errorMsg}`);\n return;\n }\n return {\n paywallTemplateName: result.templateName ?? 'unknown template',\n shouldShow: result.shouldShow ?? true,\n };\n};\n\nexport const handleDeepLink = (url: string | null) => {\n if (url) {\n const handled = HeliumPaywallSdkModule.handleDeepLink(url);\n console.log('[Helium] Handled deep link:', handled);\n return handled;\n }\n return false;\n};\n\n/**\n * Recursively converts boolean values to special marker strings to preserve\n * type information when passing through native bridge.\n *\n * Native bridge converts booleans to NSNumber (0/1), making them\n * indistinguishable from actual numeric values. This helper converts:\n * - true -> \"__helium_rn_bool_true__\"\n * - false -> \"__helium_rn_bool_false__\"\n * - All other values remain unchanged\n */\nfunction convertBooleansToMarkers(input: Record<string, any> | undefined): Record<string, any> | undefined {\n if (!input) return undefined;\n\n const result: Record<string, any> = {};\n for (const [key, value] of Object.entries(input)) {\n result[key] = convertValueBooleansToMarkers(value);\n }\n return result;\n}\n/**\n * Helper to recursively convert booleans in any value type\n */\nfunction convertValueBooleansToMarkers(value: any): any {\n if (typeof value === 'boolean') {\n return value ? \"__helium_rn_bool_true__\" : \"__helium_rn_bool_false__\";\n } else if (value && typeof value === 'object' && !Array.isArray(value)) {\n return convertBooleansToMarkers(value);\n } else if (value && Array.isArray(value)) {\n return value.map(convertValueBooleansToMarkers);\n }\n return value;\n}\n\nexport {createCustomPurchaseConfig, HELIUM_CTA_NAMES} from './HeliumPaywallSdk.types';\n"]}
@@ -19,7 +19,7 @@ Pod::Spec.new do |s|
19
19
  s.static_framework = true
20
20
 
21
21
  s.dependency 'ExpoModulesCore'
22
- s.dependency 'Helium', '3.0.6'
22
+ s.dependency 'Helium', '3.0.14'
23
23
 
24
24
  # Swift/Objective-C compatibility
25
25
  s.pod_target_xcconfig = {
@@ -28,11 +28,9 @@ struct PaywallInfoResult: Record {
28
28
  var shouldShow: Bool? = nil
29
29
  }
30
30
 
31
- struct CanPresentPaywallResult: Record {
31
+ struct HasEntitlementResult: Record {
32
32
  @Field
33
- var canPresent: Bool = false
34
- @Field
35
- var reason: String? = nil
33
+ var hasEntitlement: Bool? = nil
36
34
  }
37
35
 
38
36
  public class HeliumPaywallSdkModule: Module {
@@ -217,7 +215,7 @@ public class HeliumPaywallSdkModule: Module {
217
215
  continuation.resume(returning: success)
218
216
  }
219
217
 
220
- Function("presentUpsell") { (trigger: String, customPaywallTraits: [String: Any]?) in
218
+ Function("presentUpsell") { (trigger: String, customPaywallTraits: [String: Any]?, dontShowIfAlreadyEntitled: Bool?) in
221
219
  Helium.shared.presentUpsell(
222
220
  trigger: trigger,
223
221
  eventHandlers: PaywallEventHandlers.withHandlers(
@@ -232,9 +230,16 @@ public class HeliumPaywallSdkModule: Module {
232
230
  },
233
231
  onPurchaseSucceeded: { [weak self] event in
234
232
  self?.sendEvent("paywallEventHandlers", event.toDictionary())
233
+ },
234
+ onOpenFailed: { [weak self] event in
235
+ self?.sendEvent("paywallEventHandlers", event.toDictionary())
236
+ },
237
+ onCustomPaywallAction: { [weak self] event in
238
+ self?.sendEvent("paywallEventHandlers", event.toDictionary())
235
239
  }
236
240
  ),
237
- customPaywallTraits: convertMarkersToBooleans(customPaywallTraits)
241
+ customPaywallTraits: convertMarkersToBooleans(customPaywallTraits),
242
+ dontShowIfAlreadyEntitled: dontShowIfAlreadyEntitled ?? false
238
243
  )
239
244
  }
240
245
 
@@ -251,7 +256,7 @@ public class HeliumPaywallSdkModule: Module {
251
256
  }
252
257
 
253
258
  Function("fallbackOpenOrCloseEvent") { (trigger: String?, isOpen: Bool, viewType: String?) in
254
- HeliumPaywallDelegateWrapper.shared.onFallbackOpenCloseEvent(trigger: trigger, isOpen: isOpen, viewType: viewType)
259
+ HeliumPaywallDelegateWrapper.shared.onFallbackOpenCloseEvent(trigger: trigger, isOpen: isOpen, viewType: viewType, fallbackReason: .bridgingError)
255
260
  }
256
261
 
257
262
  Function("getPaywallInfo") { (trigger: String) in
@@ -270,46 +275,17 @@ public class HeliumPaywallSdkModule: Module {
270
275
  )
271
276
  }
272
277
 
273
- Function("canPresentUpsell") { (trigger: String) in
274
- // Check if paywalls are downloaded successfully
275
- let paywallsLoaded = Helium.shared.paywallsLoaded()
276
-
277
- // Check if trigger exists in fetched triggers
278
- let triggerNames = HeliumFetchedConfigManager.shared.getFetchedTriggerNames()
279
- let hasTrigger = triggerNames.contains(trigger)
280
-
281
- let canPresent: Bool
282
- let reason: String
283
-
284
- let useLoading = Helium.shared.loadingStateEnabledFor(trigger: trigger)
285
- let downloadInProgress = Helium.shared.getDownloadStatus() == .inProgress
286
-
287
- if paywallsLoaded && hasTrigger {
288
- // Normal case - paywall is ready
289
- canPresent = true
290
- reason = "ready"
291
- } else if downloadInProgress && useLoading {
292
- // Loading case - paywall still downloading
293
- canPresent = true
294
- reason = "loading"
295
- } else if HeliumFallbackViewManager.shared.getFallbackInfo(trigger: trigger) != nil {
296
- // Fallback is available (via downloaded bundle)
297
- canPresent = true
298
- reason = "fallback_ready"
299
- } else {
300
- // No paywall and no fallback bundle
301
- canPresent = false
302
- reason = !paywallsLoaded ? "download status - \(Helium.shared.getDownloadStatus().rawValue)" : "trigger_not_found"
303
- }
278
+ Function("setRevenueCatAppUserId") { (rcAppUserId: String) in
279
+ Helium.shared.setRevenueCatAppUserId(rcAppUserId)
280
+ }
304
281
 
305
- return CanPresentPaywallResult(
306
- canPresent: canPresent,
307
- reason: reason
308
- )
282
+ Function("setCustomUserId") { (newUserId: String) in
283
+ Helium.shared.overrideUserId(newUserId: newUserId)
309
284
  }
310
285
 
311
- Function("setRevenueCatAppUserId") { (rcAppUserId: String) in
312
- Helium.shared.setRevenueCatAppUserId(rcAppUserId)
286
+ AsyncFunction("hasEntitlementForPaywall") { (trigger: String) in
287
+ let hasEntitlement = await Helium.shared.hasEntitlementForPaywall(trigger: trigger)
288
+ return HasEntitlementResult(hasEntitlement: hasEntitlement)
313
289
  }
314
290
 
315
291
  AsyncFunction("hasAnyActiveSubscription") {
@@ -328,6 +304,54 @@ public class HeliumPaywallSdkModule: Module {
328
304
  return Helium.shared.handleDeepLink(url)
329
305
  }
330
306
 
307
+ Function("getExperimentInfoForTrigger") { (trigger: String) -> [String: Any] in
308
+ guard let experimentInfo = Helium.shared.getExperimentInfoForTrigger(trigger) else {
309
+ return ["getExperimentInfoErrorMsg": "No experiment info found for trigger: \(trigger)"]
310
+ }
311
+
312
+ // Convert ExperimentInfo to dictionary using JSONEncoder
313
+ let encoder = JSONEncoder()
314
+ guard let jsonData = try? encoder.encode(experimentInfo),
315
+ let dictionary = try? JSONSerialization.jsonObject(with: jsonData, options: []) as? [String: Any] else {
316
+ return ["getExperimentInfoErrorMsg": "Failed to serialize experiment info"]
317
+ }
318
+
319
+ // Return the dictionary directly - it contains all ExperimentInfo fields
320
+ return dictionary
321
+ }
322
+
323
+ Function("disableRestoreFailedDialog") {
324
+ Helium.restorePurchaseConfig.disableRestoreFailedDialog()
325
+ }
326
+
327
+ Function("setCustomRestoreFailedStrings") { (customTitle: String?, customMessage: String?, customCloseButtonText: String?) in
328
+ Helium.restorePurchaseConfig.setCustomRestoreFailedStrings(
329
+ customTitle: customTitle,
330
+ customMessage: customMessage,
331
+ customCloseButtonText: customCloseButtonText
332
+ )
333
+ }
334
+
335
+ Function("resetHelium") {
336
+ Helium.resetHelium()
337
+ }
338
+
339
+ Function("setLightDarkModeOverride") { (mode: String) in
340
+ let heliumMode: HeliumLightDarkMode
341
+ switch mode.lowercased() {
342
+ case "light":
343
+ heliumMode = .light
344
+ case "dark":
345
+ heliumMode = .dark
346
+ case "system":
347
+ heliumMode = .system
348
+ default:
349
+ print("[Helium] Invalid mode: \(mode), defaulting to system")
350
+ heliumMode = .system
351
+ }
352
+ Helium.shared.setLightDarkModeOverride(heliumMode)
353
+ }
354
+
331
355
  // Enables the module to be used as a native view. Definition components that are accepted as part of the
332
356
  // view definition: Prop, Events.
333
357
  View(HeliumPaywallSdkView.self) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-helium",
3
- "version": "3.0.7",
3
+ "version": "3.0.14",
4
4
  "description": "Helium paywalls expo sdk",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Experiment allocation information types
3
+ */
4
+
5
+ /**
6
+ * Details about user hash bucketing for allocation
7
+ */
8
+ export interface HashDetails {
9
+ /**
10
+ * User hash bucket (1-100) - used for consistent allocation
11
+ */
12
+ hashedUserIdBucket1To100?: number;
13
+
14
+ /**
15
+ * User ID that was hashed for allocation
16
+ */
17
+ hashedUserId?: string;
18
+
19
+ /**
20
+ * Hash method used (e.g., "HASH_USER_ID", "HASH_HELIUM_PERSISTENT_ID")
21
+ */
22
+ hashMethod?: string;
23
+ }
24
+
25
+ /**
26
+ * Details about the chosen variant in an experiment
27
+ */
28
+ export interface VariantDetails {
29
+ /**
30
+ * Name or identifier of the allocation/variant (e.g., paywall template name)
31
+ */
32
+ allocationName?: string;
33
+
34
+ /**
35
+ * Unique identifier for this allocation (paywall UUID)
36
+ */
37
+ allocationId?: string;
38
+
39
+ /**
40
+ * Index of chosen variant (1 to len(variants))
41
+ */
42
+ allocationIndex?: number;
43
+
44
+ /**
45
+ * Additional allocation metadata as a dictionary
46
+ */
47
+ allocationMetadata?: Record<string, any>;
48
+ }
49
+
50
+ /**
51
+ * Complete experiment allocation information for a user
52
+ */
53
+ export interface ExperimentInfo {
54
+ /**
55
+ * Trigger name at which user was enrolled
56
+ */
57
+ trigger: string;
58
+
59
+ /**
60
+ * Experiment name
61
+ */
62
+ experimentName?: string;
63
+
64
+ /**
65
+ * Experiment ID
66
+ */
67
+ experimentId?: string;
68
+
69
+ /**
70
+ * Experiment type (e.g., "A/B/n test")
71
+ */
72
+ experimentType?: string;
73
+
74
+ /**
75
+ * Additional experiment metadata as a dictionary
76
+ */
77
+ experimentMetadata?: Record<string, any>;
78
+
79
+ /**
80
+ * When the experiment started (ISO8601 string)
81
+ */
82
+ startDate?: string;
83
+
84
+ /**
85
+ * When the experiment ends (ISO8601 string)
86
+ */
87
+ endDate?: string;
88
+
89
+ /**
90
+ * Audience ID that user matched
91
+ */
92
+ audienceId?: string;
93
+
94
+ /**
95
+ * Audience data as structured object
96
+ * Note: This may be returned as a string from native bridge, but will be parsed
97
+ */
98
+ audienceData?: Record<string, any> | string;
99
+
100
+ /**
101
+ * Details about the chosen variant
102
+ */
103
+ chosenVariantDetails?: VariantDetails;
104
+
105
+ /**
106
+ * Hash bucketing details
107
+ */
108
+ hashDetails?: HashDetails;
109
+ }
@@ -15,7 +15,8 @@ export type HeliumPaywallEvent = {
15
15
  'productSelected' | 'purchasePressed' | 'purchaseSucceeded' |
16
16
  'purchaseCancelled' | 'purchaseFailed' | 'purchaseRestored' |
17
17
  'purchaseRestoreFailed' | 'purchasePending' | 'initializeStart' |
18
- 'paywallsDownloadSuccess' | 'paywallsDownloadError' | 'paywallWebViewRendered';
18
+ 'paywallsDownloadSuccess' | 'paywallsDownloadError' | 'paywallWebViewRendered' |
19
+ 'customPaywallAction' | 'userAllocated';
19
20
  triggerName?: string;
20
21
  paywallName?: string;
21
22
  /**
@@ -50,6 +51,9 @@ export type HeliumPaywallEvent = {
50
51
  * Unix timestamp in seconds
51
52
  */
52
53
  timestamp?: number;
54
+ paywallUnavailableReason?: string;
55
+ customPaywallActionName?: string;
56
+ customPaywallActionParams?: Record<string, any>;
53
57
  };
54
58
  export type DelegateActionEvent = {
55
59
  type: 'purchase' | 'restore';
@@ -68,6 +72,7 @@ export type HeliumPurchaseResult = {
68
72
  error?: string; // Optional error message
69
73
  };
70
74
  export type HeliumDownloadStatus = 'downloadSuccess' | 'downloadFailure' | 'inProgress' | 'notDownloadedYet';
75
+ export type HeliumLightDarkMode = 'light' | 'dark' | 'system';
71
76
 
72
77
  // --- Purchase Configuration Types ---
73
78
 
@@ -121,7 +126,10 @@ export type HeliumPaywallLoadingConfig = {
121
126
  export interface HeliumConfig {
122
127
  /** Your Helium API Key */
123
128
  apiKey: string;
124
- /** Configuration for handling purchases. Can be custom functions or a pre-built handler config. */
129
+ /**
130
+ * Configuration for handling purchases. Can be custom functions or a pre-built handler config.
131
+ * If not provided, Helium will handle purchases for you.
132
+ */
125
133
  purchaseConfig?: HeliumPurchaseConfig;
126
134
  /** Callback for receiving all Helium paywall events. */
127
135
  onHeliumPaywallEvent: (event: HeliumPaywallEvent) => void; // Still mandatory
@@ -155,6 +163,8 @@ export type PresentUpsellParams = {
155
163
  onFallback?: () => void;
156
164
  eventHandlers?: PaywallEventHandlers;
157
165
  customPaywallTraits?: Record<string, any>;
166
+ /** Optional. If true, the paywall will not be shown if the user already has an entitlement for a product in the paywall. */
167
+ dontShowIfAlreadyEntitled?: boolean;
158
168
  };
159
169
 
160
170
  export interface PaywallInfo {
@@ -168,6 +178,8 @@ export interface PaywallEventHandlers {
168
178
  onClose?: (event: PaywallCloseEvent) => void;
169
179
  onDismissed?: (event: PaywallDismissedEvent) => void;
170
180
  onPurchaseSucceeded?: (event: PurchaseSucceededEvent) => void;
181
+ onOpenFailed?: (event: PaywallOpenFailedEvent) => void;
182
+ onCustomPaywallAction?: (event: CustomPaywallActionEvent) => void;
171
183
  }
172
184
 
173
185
  // Typed event interfaces
@@ -201,6 +213,24 @@ export interface PurchaseSucceededEvent {
201
213
  isSecondTry: boolean;
202
214
  }
203
215
 
216
+ export interface PaywallOpenFailedEvent {
217
+ type: 'paywallOpenFailed';
218
+ triggerName: string;
219
+ paywallName: string;
220
+ error: string;
221
+ paywallUnavailableReason?: string;
222
+ isSecondTry: boolean;
223
+ }
224
+
225
+ export interface CustomPaywallActionEvent {
226
+ type: 'customPaywallAction';
227
+ triggerName: string;
228
+ paywallName: string;
229
+ actionName: string;
230
+ params: Record<string, any>;
231
+ isSecondTry: boolean;
232
+ }
233
+
204
234
  export const HELIUM_CTA_NAMES = {
205
235
  SCHEDULE_CALL: 'schedule_call',
206
236
  SUBSCRIBE_BUTTON: 'subscribe_button',
@@ -1,7 +1,9 @@
1
1
  import { NativeModule, requireNativeModule } from "expo";
2
2
 
3
+ import { ExperimentInfo } from "./HeliumExperimentInfo.types";
3
4
  import {
4
5
  HeliumDownloadStatus,
6
+ HeliumLightDarkMode,
5
7
  HeliumPaywallSdkModuleEvents,
6
8
  HeliumTransactionStatus,
7
9
  NativeHeliumConfig,
@@ -13,9 +15,12 @@ interface PaywallInfoResult {
13
15
  shouldShow?: boolean;
14
16
  }
15
17
 
16
- interface CanPresentUpsellResult {
17
- canPresent?: boolean;
18
- reason?: string;
18
+ interface HasEntitlementResult {
19
+ hasEntitlement?: boolean;
20
+ }
21
+
22
+ interface ExperimentInfoResult extends Partial<ExperimentInfo> {
23
+ getExperimentInfoErrorMsg?: string;
19
24
  }
20
25
 
21
26
  declare class HeliumPaywallSdkModule extends NativeModule<HeliumPaywallSdkModuleEvents> {
@@ -24,6 +29,7 @@ declare class HeliumPaywallSdkModule extends NativeModule<HeliumPaywallSdkModule
24
29
  presentUpsell(
25
30
  triggerName: string,
26
31
  customPaywallTraits?: Record<string, any>,
32
+ dontShowIfAlreadyEntitled?: boolean,
27
33
  ): void;
28
34
 
29
35
  hideUpsell(): void;
@@ -32,8 +38,6 @@ declare class HeliumPaywallSdkModule extends NativeModule<HeliumPaywallSdkModule
32
38
 
33
39
  getDownloadStatus(): HeliumDownloadStatus;
34
40
 
35
- canPresentUpsell(trigger: string): CanPresentUpsellResult;
36
-
37
41
  fallbackOpenOrCloseEvent(
38
42
  trigger: string,
39
43
  isOpen: boolean,
@@ -53,9 +57,27 @@ declare class HeliumPaywallSdkModule extends NativeModule<HeliumPaywallSdkModule
53
57
 
54
58
  setRevenueCatAppUserId(rcAppUserId: string): void;
55
59
 
60
+ setCustomUserId(newUserId: string): void;
61
+
62
+ hasEntitlementForPaywall(trigger: string): Promise<HasEntitlementResult>;
63
+
56
64
  hasAnyActiveSubscription(): Promise<boolean>;
57
65
 
58
66
  hasAnyEntitlement(): Promise<boolean>;
67
+
68
+ resetHelium(): void;
69
+
70
+ setCustomRestoreFailedStrings(
71
+ customTitle?: string,
72
+ customMessage?: string,
73
+ customCloseButtonText?: string,
74
+ ): void;
75
+
76
+ disableRestoreFailedDialog(): void;
77
+
78
+ getExperimentInfoForTrigger(trigger: string): ExperimentInfoResult;
79
+
80
+ setLightDarkModeOverride(mode: HeliumLightDarkMode): void;
59
81
  }
60
82
 
61
83
  // This call loads the native module object from the JSI.
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  HeliumPaywallEvent,
5
5
  NativeHeliumConfig, PaywallEventHandlers, PaywallInfo, PresentUpsellParams,
6
6
  } from "./HeliumPaywallSdk.types";
7
+ import { ExperimentInfo } from "./HeliumExperimentInfo.types";
7
8
  import HeliumPaywallSdkModule from "./HeliumPaywallSdkModule";
8
9
  import { EventSubscription } from 'expo-modules-core';
9
10
  import * as ExpoFileSystem from 'expo-file-system';
@@ -11,6 +12,7 @@ import * as ExpoFileSystem from 'expo-file-system';
11
12
  export { default } from './HeliumPaywallSdkModule';
12
13
  // export { default as HeliumPaywallSdkView } from './HeliumPaywallSdkView';
13
14
  export * from './HeliumPaywallSdk.types';
15
+ export * from './HeliumExperimentInfo.types';
14
16
 
15
17
  function addHeliumPaywallEventListener(listener: (event: HeliumPaywallEvent) => void): EventSubscription {
16
18
  return HeliumPaywallSdkModule.addListener('onHeliumPaywallEvent', listener);
@@ -126,24 +128,14 @@ export const presentUpsell = ({
126
128
  onFallback,
127
129
  eventHandlers,
128
130
  customPaywallTraits,
131
+ dontShowIfAlreadyEntitled,
129
132
  }: PresentUpsellParams) => {
130
- const {canPresent, reason} = HeliumPaywallSdkModule.canPresentUpsell(triggerName);
131
-
132
- if (!canPresent) {
133
- console.log(
134
- `[Helium] Cannot present trigger "${triggerName}". Reason: ${reason}`
135
- );
136
- onFallback?.();
137
- HeliumPaywallSdkModule.fallbackOpenOrCloseEvent(triggerName, true, 'presented');
138
- return;
139
- }
140
-
141
133
  try {
142
134
  paywallEventHandlers = eventHandlers;
143
135
  presentOnFallback = onFallback;
144
- HeliumPaywallSdkModule.presentUpsell(triggerName, convertBooleansToMarkers(customPaywallTraits));
136
+ HeliumPaywallSdkModule.presentUpsell(triggerName, convertBooleansToMarkers(customPaywallTraits), dontShowIfAlreadyEntitled);
145
137
  } catch (error) {
146
- console.log('Helium present error', error);
138
+ console.log('[Helium] presentUpsell error', error);
147
139
  paywallEventHandlers = undefined;
148
140
  presentOnFallback = undefined;
149
141
  onFallback?.();
@@ -188,6 +180,26 @@ function callPaywallEventHandlers(event: HeliumPaywallEvent) {
188
180
  isSecondTry: event.isSecondTry ?? false,
189
181
  });
190
182
  break;
183
+ case 'paywallOpenFailed':
184
+ paywallEventHandlers?.onOpenFailed?.({
185
+ type: 'paywallOpenFailed',
186
+ triggerName: event.triggerName ?? 'unknown',
187
+ paywallName: event.paywallName ?? 'unknown',
188
+ error: event.error ?? 'Unknown error',
189
+ paywallUnavailableReason: event.paywallUnavailableReason,
190
+ isSecondTry: event.isSecondTry ?? false,
191
+ });
192
+ break;
193
+ case 'customPaywallAction':
194
+ paywallEventHandlers?.onCustomPaywallAction?.({
195
+ type: 'customPaywallAction',
196
+ triggerName: event.triggerName ?? 'unknown',
197
+ paywallName: event.paywallName ?? 'unknown',
198
+ actionName: event.customPaywallActionName ?? 'unknown',
199
+ params: event.customPaywallActionParams ?? {},
200
+ isSecondTry: event.isSecondTry ?? false,
201
+ });
202
+ break;
191
203
  }
192
204
  }
193
205
  }
@@ -206,7 +218,13 @@ function handlePaywallEvent(event: HeliumPaywallEvent) {
206
218
  break;
207
219
  case 'paywallOpenFailed':
208
220
  paywallEventHandlers = undefined;
209
- presentOnFallback?.();
221
+ const unavailableReason = event.paywallUnavailableReason;
222
+ if (event.triggerName
223
+ && unavailableReason !== "alreadyPresented"
224
+ && unavailableReason !== "secondTryNoMatch") {
225
+ console.log('[Helium] paywall open failed', unavailableReason);
226
+ presentOnFallback?.();
227
+ }
210
228
  presentOnFallback = undefined;
211
229
  break;
212
230
  }
@@ -217,6 +235,21 @@ export const hideAllUpsells = HeliumPaywallSdkModule.hideAllUpsells;
217
235
  export const getDownloadStatus = HeliumPaywallSdkModule.getDownloadStatus;
218
236
  export const setRevenueCatAppUserId = HeliumPaywallSdkModule.setRevenueCatAppUserId;
219
237
 
238
+ /**
239
+ * Set a custom user ID for the current user
240
+ */
241
+ export const setCustomUserId = HeliumPaywallSdkModule.setCustomUserId;
242
+
243
+ /**
244
+ * Checks if the user has an active entitlement for any product attached to the paywall that will show for provided trigger.
245
+ * @param trigger The trigger name to check entitlement for
246
+ * @returns Promise resolving to true if entitled, false if not, or undefined if not known (i.e. the paywall is not downloaded yet)
247
+ */
248
+ export const hasEntitlementForPaywall = async (trigger: string): Promise<boolean | undefined> => {
249
+ const result = await HeliumPaywallSdkModule.hasEntitlementForPaywall(trigger);
250
+ return result?.hasEntitlement;
251
+ };
252
+
220
253
  /**
221
254
  * Checks if the user has any active subscription (including non-renewable)
222
255
  */
@@ -227,6 +260,52 @@ export const hasAnyActiveSubscription = HeliumPaywallSdkModule.hasAnyActiveSubsc
227
260
  */
228
261
  export const hasAnyEntitlement = HeliumPaywallSdkModule.hasAnyEntitlement;
229
262
 
263
+ /**
264
+ * Reset Helium entirely so you can call initialize again. Only for advanced use cases.
265
+ */
266
+ export const resetHelium = HeliumPaywallSdkModule.resetHelium;
267
+
268
+ /**
269
+ * Set custom strings to show in the dialog that Helium will display if a "Restore Purchases" action is not successful.
270
+ * Note that these strings will not be localized by Helium for you.
271
+ */
272
+ export const setCustomRestoreFailedStrings = HeliumPaywallSdkModule.setCustomRestoreFailedStrings;
273
+
274
+ /**
275
+ * Disable the default dialog that Helium will display if a "Restore Purchases" action is not successful.
276
+ * You can handle this yourself if desired by listening for the PurchaseRestoreFailedEvent.
277
+ */
278
+ export const disableRestoreFailedDialog = HeliumPaywallSdkModule.disableRestoreFailedDialog;
279
+
280
+ /**
281
+ * Override the light/dark mode for Helium paywalls
282
+ * @param mode The mode to set: 'light', 'dark', or 'system' (follows device setting)
283
+ */
284
+ export const setLightDarkModeOverride = HeliumPaywallSdkModule.setLightDarkModeOverride;
285
+
286
+ /**
287
+ * Get experiment allocation info for a specific trigger
288
+ *
289
+ * @param trigger The trigger name to get experiment info for
290
+ * @returns ExperimentInfo if the trigger has experiment data, undefined otherwise
291
+ */
292
+ export const getExperimentInfoForTrigger = (trigger: string): ExperimentInfo | undefined => {
293
+ const result = HeliumPaywallSdkModule.getExperimentInfoForTrigger(trigger);
294
+ if (!result) {
295
+ console.log('[Helium] getExperimentInfoForTrigger unexpected error.');
296
+ return;
297
+ }
298
+ if (result.getExperimentInfoErrorMsg) {
299
+ return;
300
+ }
301
+ // Validate required field exists before casting
302
+ if (!result.trigger) {
303
+ console.log('[Helium] getExperimentInfoForTrigger returned data without required trigger field.');
304
+ return;
305
+ }
306
+ return result as ExperimentInfo;
307
+ };
308
+
230
309
  export const getPaywallInfo = (trigger: string): PaywallInfo | undefined => {
231
310
  const result = HeliumPaywallSdkModule.getPaywallInfo(trigger);
232
311
  if (!result) {