expo-superwall 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 889aaf7: fix: improve custom purchase type handling
8
+ - 56a72c9: Bump Android version to 2.6.3
9
+ - 465a215: Exposes Product identifier in Redemption Info
10
+
11
+ ## 0.5.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 8c2c14f: User identification and attribute operations are now non-blocking async calls, preventing UI freezes while ensuring proper state synchronization
16
+
17
+ Thanks to @gursheyss for the PR #90
18
+
3
19
  ## 0.4.1
4
20
 
5
21
  ### Patch Changes
@@ -43,7 +43,7 @@ android {
43
43
  }
44
44
 
45
45
  dependencies {
46
- implementation "com.superwall.sdk:superwall-android:2.6.1"
46
+ implementation "com.superwall.sdk:superwall-android:2.6.3"
47
47
  implementation 'com.android.billingclient:billing:8.0.0'
48
48
  implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2'
49
49
  }
@@ -106,17 +106,27 @@ class SuperwallExpoModule : Module() {
106
106
  return@Function applicationInfo?.metaData?.getString("SUPERWALL_API_KEY")
107
107
  }
108
108
 
109
- Function("identify") { userId: String, options: Map<String, Any>? ->
110
- try {
111
- val options = options?.let { identityOptionsFromJson(options) }
112
- Superwall.instance.identify(userId = userId, options = options)
113
- } catch (error: Exception) {
114
- error.printStackTrace()
109
+ AsyncFunction("identify") { userId: String, options: Map<String, Any>?, promise: Promise ->
110
+ scope.launch {
111
+ try {
112
+ val identityOptions = options?.let { identityOptionsFromJson(it) }
113
+ Superwall.instance.identify(userId = userId, options = identityOptions)
114
+ promise.resolve(null)
115
+ } catch (error: Exception) {
116
+ promise.reject(CodedException(error))
117
+ }
115
118
  }
116
119
  }
117
120
 
118
- Function("reset") {
119
- Superwall.instance.reset()
121
+ AsyncFunction("reset") { promise: Promise ->
122
+ scope.launch {
123
+ try {
124
+ Superwall.instance.reset()
125
+ promise.resolve(null)
126
+ } catch (error: Exception) {
127
+ promise.reject(CodedException(error))
128
+ }
129
+ }
120
130
  }
121
131
 
122
132
  AsyncFunction("configure") {
@@ -260,27 +270,34 @@ class SuperwallExpoModule : Module() {
260
270
  }
261
271
  }
262
272
 
263
- Function("setSubscriptionStatus") { status: Map<String,Any> ->
264
- val statusString = (status["status"] as? String)?.uppercase() ?: "UNKNOWN"
265
- val subscriptionStatus: SubscriptionStatus
266
-
267
- when (statusString) {
268
- "UNKNOWN" -> subscriptionStatus = SubscriptionStatus.Unknown
269
- "INACTIVE" -> subscriptionStatus = SubscriptionStatus.Inactive
270
- "ACTIVE" -> {
271
- val entitlementsArray = status["entitlements"] as? List<Map<String, Any>>
272
- val entitlementsSet: Set<Entitlement> = entitlementsArray?.map { item ->
273
- val id = item["id"] as? String
274
- id?.let { Entitlement(id = it) }
275
- }?.filterNotNull()?.toSet() ?: emptySet()
276
- subscriptionStatus = SubscriptionStatus.Active(entitlementsSet)
273
+ AsyncFunction("setSubscriptionStatus") { status: Map<String,Any>, promise: Promise ->
274
+ scope.launch {
275
+ try {
276
+ val statusString = (status["status"] as? String)?.uppercase() ?: "UNKNOWN"
277
+ val subscriptionStatus: SubscriptionStatus
278
+
279
+ when (statusString) {
280
+ "UNKNOWN" -> subscriptionStatus = SubscriptionStatus.Unknown
281
+ "INACTIVE" -> subscriptionStatus = SubscriptionStatus.Inactive
282
+ "ACTIVE" -> {
283
+ val entitlementsArray = status["entitlements"] as? List<Map<String, Any>>
284
+ val entitlementsSet: Set<Entitlement> = entitlementsArray?.map { item ->
285
+ val id = item["id"] as? String
286
+ id?.let { Entitlement(id = it) }
287
+ }?.filterNotNull()?.toSet() ?: emptySet()
288
+ subscriptionStatus = SubscriptionStatus.Active(entitlementsSet)
289
+ }
290
+ else -> subscriptionStatus = SubscriptionStatus.Unknown
291
+ }
292
+
293
+ Superwall.instance.setSubscriptionStatus(subscriptionStatus)
294
+ promise.resolve(null)
295
+ } catch (error: Exception) {
296
+ promise.reject(CodedException(error))
277
297
  }
278
- else -> subscriptionStatus = SubscriptionStatus.Unknown
279
298
  }
280
-
281
- Superwall.instance.setSubscriptionStatus(subscriptionStatus)
282
299
  }
283
-
300
+
284
301
  Function("setInterfaceStyle") { style: String? ->
285
302
  var interfaceStyle: InterfaceStyle? = style?.let { interfaceStyleFromString(it) }
286
303
  Superwall.instance.setInterfaceStyle(interfaceStyle)
@@ -303,8 +320,15 @@ class SuperwallExpoModule : Module() {
303
320
  }
304
321
 
305
322
 
306
- Function("setUserAttributes") { userAttributes: Map<String, Any> ->
307
- Superwall.instance.setUserAttributes(userAttributes)
323
+ AsyncFunction("setUserAttributes") { userAttributes: Map<String, Any>, promise: Promise ->
324
+ scope.launch {
325
+ try {
326
+ Superwall.instance.setUserAttributes(userAttributes)
327
+ promise.resolve(null)
328
+ } catch (error: Exception) {
329
+ promise.reject(CodedException(error))
330
+ }
331
+ }
308
332
  }
309
333
 
310
334
  AsyncFunction("handleDeepLink") { url: String, promise: Promise ->
@@ -132,5 +132,6 @@ private fun RedemptionResult.PaywallInfo.toJson(): Map<String, Any> {
132
132
 
133
133
  map["variantId"] = this.variantId
134
134
  map["experimentId"] = this.experimentId
135
+ map["productIdentifier"] = this.productIdentifier
135
136
  return map
136
137
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-superwall",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "description": "Offical Expo Integration for Superwall",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"CustomPurchaseControllerProvider.d.ts","sourceRoot":"","sources":["../../src/CustomPurchaseControllerProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAKnE;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC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AU,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAA;IAC7E,iBAAiB,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAA;CAC5D;AAED;;;GAGG;AACH,MAAM,WAAW,qCAAqC;IACpD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,EAAE,+BAA+B,CAAA;CAC5C;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gCAAgC,GAAI,2BAG9C,qCAAqC,gCAyCvC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,8CAIvC,CAAA"}
@@ -21,9 +21,10 @@ export const CustomPurchaseControllerProvider = ({ children, controller, }) => {
21
21
  onPurchase: async (params) => {
22
22
  try {
23
23
  const result = await controller.onPurchase(params);
24
+ const type = result?.type ?? "purchased";
24
25
  SuperwallExpoModule.didPurchase({
25
- type: result?.type ?? "purchased",
26
- error: result?.type === "failed" ? (result?.error || "Unknown error") : result?.error,
26
+ type,
27
+ ...(type === "failed" && { error: result?.error || "Unknown error" }),
27
28
  });
28
29
  }
29
30
  catch (error) {
@@ -36,9 +37,10 @@ export const CustomPurchaseControllerProvider = ({ children, controller, }) => {
36
37
  onPurchaseRestore: async () => {
37
38
  try {
38
39
  const result = await controller.onPurchaseRestore();
40
+ const resultType = result?.type ?? "restored";
39
41
  SuperwallExpoModule.didRestore({
40
- result: result?.type ?? "restored",
41
- errorMessage: result?.type === "failed" ? (result?.error || "Unknown error") : result?.error,
42
+ result: resultType,
43
+ ...(resultType === "failed" && { errorMessage: result?.error || "Unknown error" }),
42
44
  });
43
45
  }
44
46
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"CustomPurchaseControllerProvider.js","sourceRoot":"","sources":["../../src/CustomPurchaseControllerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO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K;iBAC7F,CAAC,CAAA;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,mBAAmB,CAAC,UAAU,CAAC;oBAC7B,MAAM,EAAE,QAAQ;oBAChB,YAAY,EAAE,KAAK,EAAE,OAAO,IAAI,eAAe;iBAChD,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAA;IAEF,OAAO,CACL,CAAC,+BAA+B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAC1D;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,+BAA+B,CAAC,QAAQ,CAAC,CAC5C,CAAA;AACH,CAAC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,MAAM,OAAO,GAAG,UAAU,CAAC,+BAA+B,CAAC,CAAA;IAE3D,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import { createContext, useContext } from \"react\"\nimport SuperwallExpoModule from \"./SuperwallExpoModule\"\nimport type { OnPurchaseParams } from \"./SuperwallExpoModule.types\"\nimport { useSuperwallEvents } from \"./useSuperwallEvents\"\n\nconst customPurchaseControllerContext = createContext<CustomPurchaseControllerContext | null>(null)\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n */\nexport type PurchaseResult = {\n type: \"cancelled\" | \"failed\" | \"purchased\" | \"pending\"\n error?: string\n}\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n */\nexport type RestoreResult = {\n type: \"restored\" | \"failed\"\n error?: string\n}\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n */\nexport interface CustomPurchaseControllerContext {\n onPurchase: (params: OnPurchaseParams) => Promise<PurchaseResult | undefined>\n onPurchaseRestore: () => Promise<RestoreResult | undefined>\n}\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n */\nexport interface CustomPurchaseControllerProviderProps {\n children: React.ReactNode\n controller: CustomPurchaseControllerContext\n}\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n * Provider component for custom purchase controller logic.\n *\n * This component allows you to integrate your own purchase handling logic\n * with the Superwall SDK. It listens for purchase and restore events from\n * Superwall and delegates them to the provided `controller`.\n *\n * @param props - The properties for the CustomPurchaseControllerProvider.\n * @param props.children - The child components that will be wrapped by this provider.\n * @param props.controller - An object implementing the `CustomPurchaseControllerContext`\n * interface, which defines how to handle purchases and restores.\n */\nexport const CustomPurchaseControllerProvider = ({\n children,\n controller,\n}: CustomPurchaseControllerProviderProps) => {\n useSuperwallEvents({\n onPurchase: async (params) => {\n try {\n const result = await controller.onPurchase(params)\n\n SuperwallExpoModule.didPurchase({\n type: result?.type ?? \"purchased\",\n error: result?.type === \"failed\" ? (result?.error || \"Unknown error\") : result?.error,\n })\n } catch (error: any) {\n SuperwallExpoModule.didPurchase({\n type: \"failed\",\n error: error?.message || \"Unknown error\",\n })\n }\n },\n onPurchaseRestore: async () => {\n try {\n const result = await controller.onPurchaseRestore()\n\n SuperwallExpoModule.didRestore({\n result: result?.type ?? \"restored\",\n errorMessage: result?.type === \"failed\" ? (result?.error || \"Unknown error\") : result?.error,\n })\n } catch (error: any) {\n SuperwallExpoModule.didRestore({\n result: \"failed\",\n errorMessage: error?.message || \"Unknown error\",\n })\n }\n },\n })\n\n return (\n <customPurchaseControllerContext.Provider value={controller}>\n {children}\n </customPurchaseControllerContext.Provider>\n )\n}\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n * Hook to access the custom purchase controller context.\n *\n * This hook provides access to the `controller` object that was passed\n * to the `CustomPurchaseControllerProvider`. It can be used by child\n * components to trigger purchase or restore flows using the custom logic.\n *\n * @returns The `CustomPurchaseControllerContext` object, or `null` if not\n * used within a `CustomPurchaseControllerProvider`.\n */\nexport const useCustomPurchaseController = () => {\n const context = useContext(customPurchaseControllerContext)\n\n return context\n}\n"]}
1
+ {"version":3,"file":"CustomPurchaseControllerProvider.js","sourceRoot":"","sources":["../../src/CustomPurchaseControllerProvider.tsx"],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AAE,MAAM,EAAE,KAAK,IAAI,eAAe,EAAE,CAAC;iBACnF,CAAC,CAAA;YACJ,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,mBAAmB,CAAC,UAAU,CAAC;oBAC7B,MAAM,EAAE,QAAQ;oBAChB,YAAY,EAAE,KAAK,EAAE,OAAO,IAAI,eAAe;iBAChD,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAA;IAEF,OAAO,CACL,CAAC,+BAA+B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAC1D;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,+BAA+B,CAAC,QAAQ,CAAC,CAC5C,CAAA;AACH,CAAC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,MAAM,OAAO,GAAG,UAAU,CAAC,+BAA+B,CAAC,CAAA;IAE3D,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA","sourcesContent":["import { createContext, useContext } from \"react\"\nimport SuperwallExpoModule from \"./SuperwallExpoModule\"\nimport type { OnPurchaseParams } from \"./SuperwallExpoModule.types\"\nimport { useSuperwallEvents } from \"./useSuperwallEvents\"\n\nconst customPurchaseControllerContext = createContext<CustomPurchaseControllerContext | null>(null)\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n */\nexport type PurchaseResult = {\n type: \"cancelled\" | \"failed\" | \"purchased\" | \"pending\"\n error?: string\n}\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n */\nexport type RestoreResult = {\n type: \"restored\" | \"failed\"\n error?: string\n}\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n */\nexport interface CustomPurchaseControllerContext {\n onPurchase: (params: OnPurchaseParams) => Promise<PurchaseResult | undefined>\n onPurchaseRestore: () => Promise<RestoreResult | undefined>\n}\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n */\nexport interface CustomPurchaseControllerProviderProps {\n children: React.ReactNode\n controller: CustomPurchaseControllerContext\n}\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n * Provider component for custom purchase controller logic.\n *\n * This component allows you to integrate your own purchase handling logic\n * with the Superwall SDK. It listens for purchase and restore events from\n * Superwall and delegates them to the provided `controller`.\n *\n * @param props - The properties for the CustomPurchaseControllerProvider.\n * @param props.children - The child components that will be wrapped by this provider.\n * @param props.controller - An object implementing the `CustomPurchaseControllerContext`\n * interface, which defines how to handle purchases and restores.\n */\nexport const CustomPurchaseControllerProvider = ({\n children,\n controller,\n}: CustomPurchaseControllerProviderProps) => {\n useSuperwallEvents({\n onPurchase: async (params) => {\n try {\n const result = await controller.onPurchase(params)\n const type = result?.type ?? \"purchased\"\n\n SuperwallExpoModule.didPurchase({\n type,\n ...(type === \"failed\" && { error: result?.error || \"Unknown error\" }),\n })\n } catch (error: any) {\n SuperwallExpoModule.didPurchase({\n type: \"failed\",\n error: error?.message || \"Unknown error\",\n })\n }\n },\n onPurchaseRestore: async () => {\n try {\n const result = await controller.onPurchaseRestore()\n const resultType = result?.type ?? \"restored\"\n\n SuperwallExpoModule.didRestore({\n result: resultType,\n ...(resultType === \"failed\" && { errorMessage: result?.error || \"Unknown error\" }),\n })\n } catch (error: any) {\n SuperwallExpoModule.didRestore({\n result: \"failed\",\n errorMessage: error?.message || \"Unknown error\",\n })\n }\n },\n })\n\n return (\n <customPurchaseControllerContext.Provider value={controller}>\n {children}\n </customPurchaseControllerContext.Provider>\n )\n}\n\n/**\n * @category Purchase Controller\n * @since 0.0.15\n * Hook to access the custom purchase controller context.\n *\n * This hook provides access to the `controller` object that was passed\n * to the `CustomPurchaseControllerProvider`. It can be used by child\n * components to trigger purchase or restore flows using the custom logic.\n *\n * @returns The `CustomPurchaseControllerContext` object, or `null` if not\n * used within a `CustomPurchaseControllerProvider`.\n */\nexport const useCustomPurchaseController = () => {\n const context = useContext(customPurchaseControllerContext)\n\n return context\n}\n"]}
@@ -6,15 +6,15 @@ declare class SuperwallExpoModule extends NativeModule<SuperwallExpoModuleEvents
6
6
  registerPlacement(placement: string, params?: Map<string, any> | Record<string, any>, handlerId?: string | null): Promise<void>;
7
7
  configure(apiKey: string, options?: Map<string, any> | Record<string, any>, usingPurchaseController?: boolean, sdkVersion?: string): Promise<void>;
8
8
  getConfigurationStatus(): Promise<string>;
9
- identify(userId: string, options?: Map<string, any> | Record<string, any> | null): void;
10
- reset(): void;
9
+ identify(userId: string, options?: Map<string, any> | Record<string, any> | null): Promise<void>;
10
+ reset(): Promise<void>;
11
11
  getAssignments(): Promise<any[]>;
12
12
  getEntitlements(): Promise<any>;
13
13
  getSubscriptionStatus(): Promise<SubscriptionStatus>;
14
- setSubscriptionStatus(status: Record<string, any>): void;
14
+ setSubscriptionStatus(status: Record<string, any>): Promise<void>;
15
15
  setInterfaceStyle(style?: string): void;
16
16
  getUserAttributes(): Promise<Record<string, any>>;
17
- setUserAttributes(userAttributes: Record<string, any>): void;
17
+ setUserAttributes(userAttributes: Record<string, any>): Promise<void>;
18
18
  handleDeepLink(url: string): Promise<boolean>;
19
19
  didPurchase(result: {
20
20
  type: "cancelled" | "purchased" | "pending";
@@ -1 +1 @@
1
- {"version":3,"file":"SuperwallExpoModule.d.ts","sourceRoot":"","sources":["../../src/SuperwallExpoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAA;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAE5E,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAA;AAEpC,OAAO,OAAO,mBAAoB,SAAQ,YAAY,CAAC,yBAAyB,CAAC;IAC/E,SAAS,IAAI,MAAM;IACnB,iBAAiB,CACf,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/C,SAAS,CAAC,EAAE,MAAM,GAAG,IAA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,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC9C,OAAO,CAAC,GAAG,CAAC;IAEf,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnD,eAAe,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,IAAI;IAC/C,kBAAkB,IAAI,IAAI;IAE1B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CACjC;;AAED,wBAAwE"}
@@ -1 +1 @@
1
- {"version":3,"file":"SuperwallExpoModule.js","sourceRoot":"","sources":["../../src/SuperwallExpoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAA;AA+DxD,eAAe,mBAAmB,CAAsB,eAAe,CAAC,CAAA","sourcesContent":["import { NativeModule, requireNativeModule } from \"expo\"\nimport type { SuperwallExpoModuleEvents } from \"./SuperwallExpoModule.types\"\n\nexport type SubscriptionStatus = any\n\ndeclare class SuperwallExpoModule extends NativeModule<SuperwallExpoModuleEvents> {\n getApiKey(): string\n registerPlacement(\n placement: string,\n params?: Map<string, any> | Record<string, any>,\n handlerId?: string | null,\n ): Promise<void>\n\n configure(\n apiKey: string,\n options?: Map<string, any> | Record<string, any>,\n usingPurchaseController?: boolean,\n sdkVersion?: string,\n ): Promise<void>\n\n getConfigurationStatus(): Promise<string>\n\n identify(userId: string, options?: Map<string, any> | Record<string, any> | null): void\n reset(): void\n\n getAssignments(): Promise<any[]>\n getEntitlements(): Promise<any>\n getSubscriptionStatus(): Promise<SubscriptionStatus>\n setSubscriptionStatus(status: Record<string, any>): void\n\n setInterfaceStyle(style?: string): void\n\n getUserAttributes(): Promise<Record<string, any>>\n setUserAttributes(userAttributes: Record<string, any>): void\n\n handleDeepLink(url: string): Promise<boolean>\n\n didPurchase(\n result:\n | { type: \"cancelled\" | \"purchased\" | \"pending\" }\n | {\n type: \"failed\"\n error?: string\n },\n ): void\n didRestore(result: Record<string, any>): void\n\n dismiss(): Promise<void>\n confirmAllAssignments(): Promise<any[]>\n\n getPresentationResult(\n placement: string,\n params?: Map<string, any> | Record<string, any>,\n ): Promise<any>\n\n getDeviceAttributes(): Promise<Record<string, any>>\n\n preloadPaywalls(placementNames: string[]): void\n preloadAllPaywalls(): void\n\n setLogLevel(level: string): void\n}\n\nexport default requireNativeModule<SuperwallExpoModule>(\"SuperwallExpo\")\n"]}
1
+ {"version":3,"file":"SuperwallExpoModule.js","sourceRoot":"","sources":["../../src/SuperwallExpoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAA;AA+DxD,eAAe,mBAAmB,CAAsB,eAAe,CAAC,CAAA","sourcesContent":["import { NativeModule, requireNativeModule } from \"expo\"\nimport type { SuperwallExpoModuleEvents } from \"./SuperwallExpoModule.types\"\n\nexport type SubscriptionStatus = any\n\ndeclare class SuperwallExpoModule extends NativeModule<SuperwallExpoModuleEvents> {\n getApiKey(): string\n registerPlacement(\n placement: string,\n params?: Map<string, any> | Record<string, any>,\n handlerId?: string | null,\n ): Promise<void>\n\n configure(\n apiKey: string,\n options?: Map<string, any> | Record<string, any>,\n usingPurchaseController?: boolean,\n sdkVersion?: string,\n ): Promise<void>\n\n getConfigurationStatus(): Promise<string>\n\n identify(userId: string, options?: Map<string, any> | Record<string, any> | null): Promise<void>\n reset(): Promise<void>\n\n getAssignments(): Promise<any[]>\n getEntitlements(): Promise<any>\n getSubscriptionStatus(): Promise<SubscriptionStatus>\n setSubscriptionStatus(status: Record<string, any>): Promise<void>\n\n setInterfaceStyle(style?: string): void\n\n getUserAttributes(): Promise<Record<string, any>>\n setUserAttributes(userAttributes: Record<string, any>): Promise<void>\n\n handleDeepLink(url: string): Promise<boolean>\n\n didPurchase(\n result:\n | { type: \"cancelled\" | \"purchased\" | \"pending\" }\n | {\n type: \"failed\"\n error?: string\n },\n ): void\n didRestore(result: Record<string, any>): void\n\n dismiss(): Promise<void>\n confirmAllAssignments(): Promise<any[]>\n\n getPresentationResult(\n placement: string,\n params?: Map<string, any> | Record<string, any>,\n ): Promise<any>\n\n getDeviceAttributes(): Promise<Record<string, any>>\n\n preloadPaywalls(placementNames: string[]): void\n preloadAllPaywalls(): void\n\n setLogLevel(level: string): void\n}\n\nexport default requireNativeModule<SuperwallExpoModule>(\"SuperwallExpo\")\n"]}
@@ -234,7 +234,7 @@ export default class Superwall {
234
234
  async identify({ userId, options, }) {
235
235
  await this.awaitConfig();
236
236
  const serializedOptions = options ? options.toJson() : new IdentityOptions().toJson();
237
- SuperwallExpoModule.identify(userId, serializedOptions);
237
+ await SuperwallExpoModule.identify(userId, serializedOptions);
238
238
  }
239
239
  /**
240
240
  * Resets the `userId`, on-device paywall assignments, and data stored by Superwall.
@@ -521,7 +521,7 @@ export default class Superwall {
521
521
  */
522
522
  async setUserAttributes(userAttributes) {
523
523
  await this.awaitConfig();
524
- SuperwallExpoModule.setUserAttributes(userAttributes);
524
+ await SuperwallExpoModule.setUserAttributes(userAttributes);
525
525
  }
526
526
  /**
527
527
  * Dismisses the presented paywall, if one exists.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/compat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,QAAQ,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO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;;;;;;;;;OAWG;IACH,KAAK,CAAC,eAAe,CAAC,cAA2B;QAC/C,MAAM,IAAI,CAAC,WAAW,EAAE,CAAA;QACxB,MAAM,mBAAmB,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAA;IACvE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,KAAK,CAAC,iBAAiB,CAAC,cAA8B;QACpD,MAAM,IAAI,CAAC,WAAW,EAAE,CAAA;QACxB,mBAAmB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAA;IACvD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,mBAAmB,CAAC,OAAO,EAAE,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAe;QAC/B,MAAM,mBAAmB,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;IACzD,CAAC","sourcesContent":["import { Assignment } from \"./lib/Assigments\"\nimport { ConfigurationStatus } from \"./lib/ConfigurationStatus\"\nimport { EntitlementsInfo } from \"./lib/EntitlementsInfo\"\nimport { IdentityOptions } from \"./lib/IdentityOptions\"\nimport type { InterfaceStyle } from \"./lib/InterfaceStyle\"\nimport type { LogLevel } from \"./lib/LogLevel\"\nimport { PaywallInfo } from \"./lib/PaywallInfo\"\nimport type { PaywallPresentationHandler } from \"./lib/PaywallPresentationHandler\"\nimport { fromJson as paywallResultFromJson } from \"./lib/PaywallResult\"\nimport { PaywallSkippedReason } from \"./lib/PaywallSkippedReason\"\nimport type { PresentationResult } from \"./lib/PresentationResult\"\nimport type { PurchaseController } from \"./lib/PurchaseController\"\nimport { RedemptionResults } from \"./lib/RedemptionResults\"\nimport { SubscriptionStatus } from \"./lib/SubscriptionStatus\"\nimport type { SuperwallDelegate } from \"./lib/SuperwallDelegate\"\nimport { SuperwallEventInfo } from \"./lib/SuperwallEventInfo\"\nimport type { SuperwallOptions } from \"./lib/SuperwallOptions\"\n\nexport { PaywallResult } from \"./lib/PaywallResult\"\n\nimport { EventEmitter } from \"expo\"\nimport { version } from \"../../package.json\"\nimport SuperwallExpoModule from \"../SuperwallExpoModule\"\n\nexport { ComputedPropertyRequest } from \"./lib/ComputedPropertyRequest\"\nexport { ConfigurationStatus } from \"./lib/ConfigurationStatus\"\nexport { EntitlementsInfo } from \"./lib/EntitlementsInfo\"\nexport { Experiment } from \"./lib/Experiment\"\nexport { FeatureGatingBehavior } from \"./lib/FeatureGatingBehavior\"\nexport { IdentityOptions } from \"./lib/IdentityOptions\"\nexport { InterfaceStyle } from \"./lib/InterfaceStyle\"\nexport { LocalNotification } from \"./lib/LocalNotification\"\nexport { LogLevel } from \"./lib/LogLevel\"\nexport { LogScope } from \"./lib/LogScope\"\nexport { PaywallCloseReason } from \"./lib/PaywallCloseReason\"\nexport { PaywallInfo } from \"./lib/PaywallInfo\"\nexport {\n PaywallOptions,\n TransactionBackgroundView,\n} from \"./lib/PaywallOptions\"\nexport { PaywallPresentationHandler } from \"./lib/PaywallPresentationHandler\"\nexport { PaywallPresentationRequestStatus } from \"./lib/PaywallPresentationRequestStatus\"\nexport {\n PaywallSkippedReason,\n PaywallSkippedReasonHoldout,\n PaywallSkippedReasonNoAudienceMatch,\n PaywallSkippedReasonPlacementNotFound,\n PaywallSkippedReasonUserIsSubscribed,\n} from \"./lib/PaywallSkippedReason\"\nexport { Product } from \"./lib/Product\"\nexport { PurchaseController } from \"./lib/PurchaseController\"\nexport {\n PurchaseResult,\n PurchaseResultCancelled,\n PurchaseResultFailed,\n PurchaseResultPending,\n PurchaseResultPurchased,\n} from \"./lib/PurchaseResult\"\nexport * from \"./lib/RedemptionResults\"\nexport { RestorationResult } from \"./lib/RestorationResult\"\nexport { RestoreType } from \"./lib/RestoreType\"\nexport { StoreTransaction } from \"./lib/StoreTransaction\"\nexport { SubscriptionStatus } from \"./lib/SubscriptionStatus\"\nexport { SuperwallDelegate } from \"./lib/SuperwallDelegate\"\nexport { EventType, SuperwallEventInfo } from \"./lib/SuperwallEventInfo\"\nexport { SuperwallOptions } from \"./lib/SuperwallOptions\"\nexport { Survey } from \"./lib/Survey\"\nexport { TriggerResult } from \"./lib/TriggerResult\"\n\ninterface UserAttributes {\n [key: string]: any\n}\n\nexport default class Superwall {\n static purchaseController?: PurchaseController\n private static delegate?: SuperwallDelegate\n private static _superwall = new Superwall()\n\n private static configEmitter = new EventEmitter<{\n configured: (isConfigured: boolean) => void\n }>()\n private static didConfigure = false\n private presentationHandlers: Map<string, PaywallPresentationHandler> = new Map()\n subscriptionStatusEmitter = new EventEmitter<{\n change: (status: SubscriptionStatus) => void\n }>()\n\n private static setDidConfigure(didConfigure: boolean) {\n Superwall.didConfigure = didConfigure\n // Emit an event when the bridged state is true\n if (didConfigure) {\n Superwall.configEmitter.emit(\"configured\", didConfigure)\n }\n }\n\n private async awaitConfig(): Promise<void> {\n if (Superwall.didConfigure) {\n return\n }\n\n await new Promise<void>((resolve) => {\n Superwall.configEmitter.addListener(\"configured\", () => {\n resolve()\n })\n })\n }\n\n private constructor() {\n SuperwallExpoModule.addListener(\"onPurchase\", async (data) => {\n if (data.platform === \"ios\") {\n const purchaseResult = await Superwall.purchaseController?.purchaseFromAppStore(\n data.productId,\n )\n if (purchaseResult == null) {\n return\n }\n await SuperwallExpoModule.didPurchase(purchaseResult.toJSON())\n return\n }\n\n if (data.platform === \"android\") {\n const purchaseResult = await Superwall.purchaseController?.purchaseFromGooglePlay(\n data.productId,\n data.basePlanId,\n data.offerId,\n )\n if (purchaseResult == null) {\n return\n }\n await SuperwallExpoModule.didPurchase(purchaseResult.toJSON())\n }\n })\n\n SuperwallExpoModule.addListener(\"onPurchaseRestore\", async () => {\n const restorationResult = await Superwall.purchaseController?.restorePurchases()\n if (restorationResult == null) {\n return\n }\n await SuperwallExpoModule.didRestore(restorationResult.toJson())\n })\n\n SuperwallExpoModule.addListener(\"onPaywallPresent\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n if (!handler || !handler.onPresentHandler) {\n return\n }\n\n const paywallInfo = PaywallInfo.fromJson(data.paywallInfoJson)\n handler.onPresentHandler(paywallInfo)\n })\n SuperwallExpoModule.addListener(\"onPaywallDismiss\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onDismissHandler) {\n return\n }\n\n const info = PaywallInfo.fromJson(data.paywallInfoJson)\n const result = paywallResultFromJson(data.result)\n handler.onDismissHandler(info, result)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallError\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onErrorHandler) {\n return\n }\n\n handler.onErrorHandler(data.errorString)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallSkip\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onSkipHandler) {\n return\n }\n\n const skippedReason = PaywallSkippedReason.fromJson(data.skippedReason)\n handler.onSkipHandler(skippedReason)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallPresent\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onPresentHandler) {\n return\n }\n\n const info = PaywallInfo.fromJson(data.paywallInfoJson)\n handler.onPresentHandler(info)\n })\n\n // MARK: - SuperwallDelegate Listeners\n SuperwallExpoModule.addListener(\"subscriptionStatusDidChange\", async (data) => {\n Superwall.delegate?.subscriptionStatusDidChange(data.from, data.to)\n })\n\n SuperwallExpoModule.addListener(\"handleSuperwallEvent\", async (data) => {\n const eventInfo = SuperwallEventInfo.fromJson(data.eventInfo)\n Superwall.delegate?.handleSuperwallEvent(eventInfo)\n })\n\n SuperwallExpoModule.addListener(\"handleCustomPaywallAction\", async (data) => {\n const name = data.name\n Superwall.delegate?.handleCustomPaywallAction(name)\n })\n\n SuperwallExpoModule.addListener(\"willDismissPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.willDismissPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"willPresentPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.willPresentPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"didDismissPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.didDismissPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"didPresentPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.didPresentPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"handleLog\", async (data) => {\n Superwall.delegate?.handleLog(\n data.level,\n data.scope,\n data.message || undefined,\n data.info,\n data.error,\n )\n })\n\n SuperwallExpoModule.addListener(\"paywallWillOpenDeepLink\", async (data) => {\n const url = new URL(data.url)\n Superwall.delegate?.paywallWillOpenDeepLink(url)\n })\n\n SuperwallExpoModule.addListener(\"paywallWillOpenURL\", async (data) => {\n const url = new URL(data.url)\n Superwall.delegate?.paywallWillOpenURL(url)\n })\n\n SuperwallExpoModule.addListener(\"willRedeemLink\", async () => {\n Superwall.delegate?.willRedeemLink()\n })\n\n SuperwallExpoModule.addListener(\"didRedeemLink\", async (data) => {\n const result = RedemptionResults.fromJson(data)\n Superwall.delegate?.didRedeemLink(result)\n })\n\n SuperwallExpoModule.addListener(\"subscriptionStatusDidChange\", async (data) => {\n this.subscriptionStatusEmitter.emit(\"change\", data.to)\n })\n }\n\n /**\n * Returns the configured shared instance of `Superwall`.\n *\n * **Warning:** You must call {@link Superwall.configure} to initialize `Superwall`\n * before accessing this shared instance.\n *\n * @returns {Superwall} The shared `Superwall` instance.\n */\n static get shared(): Superwall {\n return Superwall._superwall\n }\n\n /**\n * Configures a shared instance of `Superwall` for use throughout your app.\n *\n * Call this as soon as your app starts to initialize the Superwall SDK.\n * Check out [Configuring the SDK](https://docs.superwall.com/docs/configuring-the-sdk) for information about how to configure the SDK.\n *\n * @param {object} config - Configuration object.\n * @param {string} config.apiKey - Your lib API Key that you can get from the Superwall dashboard settings.\n * If you don't have an account, you can [sign up for free](https://superwall.com/sign-up).\n * @param {SuperwallOptions} [config.options] - An optional object which allows you to customize the appearance and behavior\n * of the paywall.\n * @param {PurchaseController} [config.purchaseController] - An optional object that conforms to `PurchaseController`.\n * Implement this if you'd like to handle all subscription-related logic yourself. You'll need to also set the `subscriptionStatus`\n * every time the user's entitlements change. You can read more about that in [Purchases and Subscription Status](https://docs.superwall.com/docs/advanced-configuration).\n * If omitted, Superwall will handle all subscription-related logic itself.\n * @param {() => void} [config.completion] - An optional completion handler that lets you know when Superwall has finished configuring.\n *\n * @returns {Promise<Superwall>} The configured `Superwall` instance.\n */\n static async configure({\n apiKey,\n options,\n purchaseController,\n completion,\n }: {\n apiKey: string\n options?: SuperwallOptions\n purchaseController?: PurchaseController\n completion?: () => void\n }): Promise<Superwall> {\n Superwall.purchaseController = purchaseController\n await SuperwallExpoModule.configure(\n apiKey,\n options?.toJson(),\n !!purchaseController,\n `${version}compat`,\n )\n\n completion?.()\n\n Superwall.setDidConfigure(true)\n\n return Superwall._superwall\n }\n\n /**\n * Creates an account with Superwall by linking the provided `userId` to Superwall's automatically generated alias.\n *\n * Call this function as soon as you have a valid `userId`.\n *\n * @param {Object} config - The identification configuration object.\n * @param {string} config.userId - Your user's unique identifier as defined by your backend system.\n * @param {IdentityOptions} [config.options] - An optional {@link IdentityOptions} object. You can set the\n * {@link IdentityOptions.restorePaywallAssignments} property to `true` to instruct the SDK to wait to restore paywall assignments\n * from the server before presenting any paywalls. This option should be used only in advanced cases\n * (e.g., when users frequently switch accounts or reinstall the app).\n *\n * @returns {Promise<void>} A promise that resolves once the identification process is complete.\n */\n async identify({\n userId,\n options,\n }: {\n userId: string\n options?: IdentityOptions\n }): Promise<void> {\n await this.awaitConfig()\n const serializedOptions = options ? options.toJson() : new IdentityOptions().toJson()\n SuperwallExpoModule.identify(userId, serializedOptions)\n }\n\n /**\n * Resets the `userId`, on-device paywall assignments, and data stored by Superwall.\n *\n * @returns {Promise<void>} A promise that resolves once reset is complete.\n */\n async reset(): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.reset()\n }\n\n /**\n * Handles a deep link.\n *\n * @param {string} url - The deep link to handle.\n * @returns {Promise<Boolean>} A promise that resolves to a boolean indicating whether the deep link was handled.\n */\n async handleDeepLink(url: string): Promise<boolean> {\n await this.awaitConfig()\n return await SuperwallExpoModule.handleDeepLink(url)\n }\n\n /**\n * Registers a placement to access a feature.\n *\n * When the placement is added to a campaign on the [Superwall Dashboard](https://superwall.com/dashboard),\n * it can trigger a paywall if the following conditions are met:\n * - The provided placement is included in a campaign on the Superwall Dashboard.\n * - The user matches an audience filter defined in the campaign.\n * - The user does not have an active subscription.\n *\n * Before using this method, ensure you have created a campaign and added the placement on the\n * [Superwall Dashboard](https://superwall.com/dashboard).\n *\n * The displayed paywall is determined by the audience filters set in the campaign.\n * Once a user is assigned a paywall within an audience, that paywall will continue to be shown unless\n * you remove it from the audience or reset the paywall assignments.\n *\n * @param {string} [params.placement] - The name of the placement to register.\n * @param {Map<string, any> | Record<string, any>} [params.params] - Optional parameters to pass with your placement.\n * These parameters can be referenced within the audience filters of your campaign. Keys beginning with `$`\n * are reserved for Superwall and will be omitted. Values can be any JSON-encodable value, URL, or Date.\n * Arrays and dictionaries are not supported and will be dropped.\n * @param {PaywallPresentationHandler} [params.handler] - An optional handler that receives status updates\n * about the paywall presentation.\n * @param {() => void} [params.feature] - An optional callback that will be executed after registration completes.\n * If provided, this callback will be executed after the registration process completes successfully.\n * If not provided, you can chain a `.then()` block to the returned promise to execute your feature logic.\n *\n * @returns {Promise<void>} if [feature] is provided this promise resolves when register is executed, otherwise a promise that resolves when register completes successfully after which you can chain a `.then()` block to execute your feature logic.\n *\n * @remarks\n * This behavior is remotely configurable via the [Superwall Dashboard](https://superwall.com/dashboard):\n *\n * - For _Non Gated_ paywalls, the feature block is executed when the paywall is dismissed or if the user is already paying.\n * - For _Gated_ paywalls, the feature block is executed only if the user is already paying or if they begin paying.\n * - If no paywall is configured, the feature block is executed immediately.\n * - If no feature block is provided, the returned promise will resolve when registration completes.\n * - If a feature block is provided, the returned promise will always resolve after the feature block is executed.\n * Note: The feature block will not be executed if an error occurs during registration. Such errors can be detected via the\n * `handler`.\n *\n * @example\n * // Using the feature callback:\n * Superwall.register({\n * placement: \"somePlacement\",\n * feature: () => {\n * console.log(\"Feature logic executed after registration\");\n * }\n * });\n *\n * // Alternatively, chaining feature logic after registration:\n * Superwall.register({ placement: \"somePlacement\" })\n * .then(() => {\n * // Execute your feature logic here after registration.\n * console.log(\"Placement registered, now executing feature logic.\");\n * })\n */\n async register(params: {\n placement: string\n params?: Map<string, any> | Record<string, any>\n handler?: PaywallPresentationHandler\n feature?: () => void\n }): Promise<void> {\n await this.awaitConfig()\n let handlerId: string | null = null\n\n if (params.handler) {\n const uuid = (+new Date() * Math.random()).toString(36)\n this.presentationHandlers.set(uuid, params.handler)\n handlerId = uuid\n }\n\n let paramsObject = {}\n if (params.params) {\n paramsObject =\n params.params instanceof Map ? Object.fromEntries(params.params) : params.params\n }\n\n if (params.feature) {\n return await SuperwallExpoModule.registerPlacement(\n params.placement,\n paramsObject,\n handlerId,\n ).then(() => {\n params.feature!() //TODO: This is wrong, the feature should be executed only if the native SDK calls the feature block\n // not after awaiting the promise\n })\n }\n\n return SuperwallExpoModule.registerPlacement(params.placement, paramsObject, handlerId)\n }\n\n /**\n * Confirms all experiment assignments and returns them in an array.\n *\n * Note that the assignments may differ when a placement is registered due to changes\n * in user, placement, or device parameters used in audience filters.\n *\n * @returns {Promise<Assignment[]>} A promise that resolves to an array of {@link Assignment} objects.\n */\n async confirmAllAssignments(): Promise<Assignment[]> {\n await this.awaitConfig()\n const assignments = await SuperwallExpoModule.confirmAllAssignments()\n return assignments.map((assignment: any) => Assignment.fromJson(assignment))\n }\n\n /**\n * Gets all the experiment assignments and returns them in an array.\n *\n * This method tracks the {@link SuperwallEvent.getAssignments} event in the delegate.\n *\n * Note that the assignments may differ when a placement is registered due to changes\n * in user, placement, or device parameters used in audience filters.\n *\n * @returns {Promise<Assignment[]>} A promise that resolves to an array of {@link Assignment} objects.\n */\n async getAssignments(): Promise<Assignment[]> {\n await this.awaitConfig()\n const assignments = await SuperwallExpoModule.getAssignments()\n return assignments.map((assignment: any) => Assignment.fromJson(assignment))\n }\n\n /**\n * Preemptively gets the result of registering a placement.\n *\n * This helps you determine whether a particular placement will present a paywall in the future.\n * Note that this method does not present a paywall. To present a paywall, use the `register` function.\n *\n * @param {Object} options - Options for obtaining the presentation result.\n * @param {string} options.placement - The name of the placement you want to register.\n * @param {Map<string, any>} [options.params] - Optional parameters to pass with your placement.\n *\n * @returns {Promise<PresentationResult>} A promise that resolves to a {@link PresentationResult} indicating the result of registering the placement.\n */\n async getPresentationResult({\n placement,\n params,\n }: {\n placement: string\n params?: Map<string, any>\n }): Promise<PresentationResult> {\n await this.awaitConfig()\n let paramsObject = {}\n if (params) {\n paramsObject = Object.fromEntries(params)\n }\n return await SuperwallExpoModule.getPresentationResult(placement, paramsObject)\n }\n\n /**\n * Retrieves the current configuration status of the Superwall SDK.\n *\n * This function returns a promise that resolves to the current configuration status,\n * indicating whether the SDK has finished configuring. Initially, the status is\n * {@link ConfigurationStatus.PENDING}. Once the configuration completes successfully, it\n * changes to {@link ConfigurationStatus.CONFIGURED}. If the configuration fails, the status\n * will be {@link ConfigurationStatus.FAILED}.\n *\n * @returns {Promise<ConfigurationStatus>} A promise that resolves with the current configuration status.\n */\n async getConfigurationStatus(): Promise<ConfigurationStatus> {\n const configurationStatusString = await SuperwallExpoModule.getConfigurationStatus()\n return ConfigurationStatus.fromString(configurationStatusString)\n }\n\n /**\n * Retrieves the entitlements tied to the device.\n *\n * @returns {Promise<EntitlementsInfo>} A promise that resolves to an {@link EntitlementsInfo} object.\n */\n async getEntitlements(): Promise<EntitlementsInfo> {\n await this.awaitConfig()\n const entitlementsJson = await SuperwallExpoModule.getEntitlements()\n return EntitlementsInfo.fromObject(entitlementsJson)\n }\n\n /**\n * Sets the subscription status of the user.\n *\n * When using a PurchaseController, you must call this method to update the user's subscription status.\n * Alternatively, you can implement the {@link SuperwallDelegate.subscriptionStatusDidChange} delegate callback to receive notifications\n * whenever the subscription status changes.\n *\n * @param {SubscriptionStatus} status - The new subscription status.\n *\n * @returns {Promise<void>} A promise that resolves once the subscription status has been updated.\n */\n async setSubscriptionStatus(status: SubscriptionStatus): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.setSubscriptionStatus(status)\n }\n\n async getSubscriptionStatus(): Promise<SubscriptionStatus> {\n await this.awaitConfig()\n const subscriptionStatusData = await SuperwallExpoModule.getSubscriptionStatus()\n return SubscriptionStatus.fromJson(subscriptionStatusData)\n }\n /**\n * Sets the user interface style, which overrides the system setting.\n *\n * Provide a value of type {@link InterfaceStyle} to explicitly set the interface style.\n * Pass `null` to revert back to the system's default interface style.\n *\n * @param {InterfaceStyle | null} style - The desired interface style, or `null` to use the system setting.\n *\n * @returns {Promise<void>} A promise that resolves once the interface style has been updated.\n */\n async setInterfaceStyle(style: InterfaceStyle | null): Promise<void> {\n await SuperwallExpoModule.setInterfaceStyle(style?.toString())\n }\n\n /**\n * Sets the delegate that handles Superwall lifecycle events.\n *\n * @param {SuperwallDelegate | undefined} delegate - An object implementing the {@link SuperwallDelegate} interface,\n * or `undefined` to remove the current delegate.\n *\n * @returns {Promise<void>} A promise that resolves once the delegate has been updated.\n */\n async setDelegate(delegate: SuperwallDelegate | undefined): Promise<void> {\n await this.awaitConfig()\n Superwall.delegate = delegate\n }\n\n /**\n * Retrieves the user attributes, set using {@link setUserAttributes}.\n *\n * @returns {Promise<UserAttributes>} A promise that resolves with an object representing the user's attributes.\n */\n async getUserAttributes(): Promise<UserAttributes> {\n await this.awaitConfig()\n const userAttributes: UserAttributes = await SuperwallExpoModule.getUserAttributes()\n return userAttributes\n }\n\n /**\n * Preloads all paywalls that the user may see based on campaigns and placements in your Superwall dashboard.\n *\n * To use this, first set `PaywallOptions.shouldPreload` to `false` when configuring the SDK.\n * Then call this function when you want preloading to begin.\n *\n * Note: This method will not reload any paywalls that have already been preloaded via {@link preloadPaywalls}.\n *\n * @returns {Promise<void>} A promise that resolves once the preloading process has been initiated.\n */\n async preloadAllPaywalls(): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.preloadAllPaywalls()\n }\n\n /**\n * Preloads paywalls for specific placements.\n *\n * To use this method, first ensure that {@link PaywallOptions.shouldPreload} is set to `false` when configuring the SDK.\n * Then call this function when you want to initiate preloading for selected placements.\n *\n * Note: This will not reload any paywalls you've already preloaded.\n *\n * @param {Set<string>} placementNames - A set of placement names whose paywalls you want to preload.\n *\n * @returns {Promise<void>} A promise that resolves once the preloading process has been initiated.\n */\n async preloadPaywalls(placementNames: Set<string>): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.preloadPaywalls(Array.from(placementNames))\n }\n\n /**\n * Sets user attributes for use in paywalls and on the Superwall dashboard.\n *\n * If an attribute already exists, its value will be overwritten while other attributes remain unchanged.\n * This is useful for analytics and campaign audience filters you may define in the Superwall Dashboard.\n *\n * **Note:** These attributes should not be used as a source of truth for sensitive information.\n *\n * For example, after retrieving your user's data:\n *\n * ```ts\n * const attributes: UserAttributes = {\n * name: user.name,\n * apnsToken: user.apnsTokenString,\n * email: user.email,\n * username: user.username,\n * profilePic: user.profilePicUrl,\n * }\n * await Superwall.setUserAttributes(attributes)\n * ```\n *\n * See [Setting User Attributes](https://docs.superwall.com/docs/setting-user-properties) for more information.\n *\n * @param {UserAttributes} userAttributes - An object containing custom attributes to store for the user.\n * Values can be any JSON-encodable value, URLs, or Dates. Keys beginning with `$` are reserved for Superwall and will be dropped.\n * Arrays and dictionaries as values are not supported and will be omitted.\n *\n * @returns {Promise<void>} A promise that resolves once the user attributes have been updated.\n */\n async setUserAttributes(userAttributes: UserAttributes): Promise<void> {\n await this.awaitConfig()\n SuperwallExpoModule.setUserAttributes(userAttributes)\n }\n\n /**\n * Dismisses the presented paywall, if one exists.\n *\n * @returns {Promise<void>} A promise that resolves once the paywall has been dismissed,\n * or immediately if no paywall was active.\n */\n async dismiss(): Promise<void> {\n await SuperwallExpoModule.dismiss()\n }\n\n async setLogLevel(level: LogLevel): Promise<void> {\n await SuperwallExpoModule.setLogLevel(level.toString())\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/compat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,QAAQ,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAK7D,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,mBAAmB,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACv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CAAC","sourcesContent":["import { Assignment } from \"./lib/Assigments\"\nimport { ConfigurationStatus } from \"./lib/ConfigurationStatus\"\nimport { EntitlementsInfo } from \"./lib/EntitlementsInfo\"\nimport { IdentityOptions } from \"./lib/IdentityOptions\"\nimport type { InterfaceStyle } from \"./lib/InterfaceStyle\"\nimport type { LogLevel } from \"./lib/LogLevel\"\nimport { PaywallInfo } from \"./lib/PaywallInfo\"\nimport type { PaywallPresentationHandler } from \"./lib/PaywallPresentationHandler\"\nimport { fromJson as paywallResultFromJson } from \"./lib/PaywallResult\"\nimport { PaywallSkippedReason } from \"./lib/PaywallSkippedReason\"\nimport type { PresentationResult } from \"./lib/PresentationResult\"\nimport type { PurchaseController } from \"./lib/PurchaseController\"\nimport { RedemptionResults } from \"./lib/RedemptionResults\"\nimport { SubscriptionStatus } from \"./lib/SubscriptionStatus\"\nimport type { SuperwallDelegate } from \"./lib/SuperwallDelegate\"\nimport { SuperwallEventInfo } from \"./lib/SuperwallEventInfo\"\nimport type { SuperwallOptions } from \"./lib/SuperwallOptions\"\n\nexport { PaywallResult } from \"./lib/PaywallResult\"\n\nimport { EventEmitter } from \"expo\"\nimport { version } from \"../../package.json\"\nimport SuperwallExpoModule from \"../SuperwallExpoModule\"\n\nexport { ComputedPropertyRequest } from \"./lib/ComputedPropertyRequest\"\nexport { ConfigurationStatus } from \"./lib/ConfigurationStatus\"\nexport { EntitlementsInfo } from \"./lib/EntitlementsInfo\"\nexport { Experiment } from \"./lib/Experiment\"\nexport { FeatureGatingBehavior } from \"./lib/FeatureGatingBehavior\"\nexport { IdentityOptions } from \"./lib/IdentityOptions\"\nexport { InterfaceStyle } from \"./lib/InterfaceStyle\"\nexport { LocalNotification } from \"./lib/LocalNotification\"\nexport { LogLevel } from \"./lib/LogLevel\"\nexport { LogScope } from \"./lib/LogScope\"\nexport { PaywallCloseReason } from \"./lib/PaywallCloseReason\"\nexport { PaywallInfo } from \"./lib/PaywallInfo\"\nexport {\n PaywallOptions,\n TransactionBackgroundView,\n} from \"./lib/PaywallOptions\"\nexport { PaywallPresentationHandler } from \"./lib/PaywallPresentationHandler\"\nexport { PaywallPresentationRequestStatus } from \"./lib/PaywallPresentationRequestStatus\"\nexport {\n PaywallSkippedReason,\n PaywallSkippedReasonHoldout,\n PaywallSkippedReasonNoAudienceMatch,\n PaywallSkippedReasonPlacementNotFound,\n PaywallSkippedReasonUserIsSubscribed,\n} from \"./lib/PaywallSkippedReason\"\nexport { Product } from \"./lib/Product\"\nexport { PurchaseController } from \"./lib/PurchaseController\"\nexport {\n PurchaseResult,\n PurchaseResultCancelled,\n PurchaseResultFailed,\n PurchaseResultPending,\n PurchaseResultPurchased,\n} from \"./lib/PurchaseResult\"\nexport * from \"./lib/RedemptionResults\"\nexport { RestorationResult } from \"./lib/RestorationResult\"\nexport { RestoreType } from \"./lib/RestoreType\"\nexport { StoreTransaction } from \"./lib/StoreTransaction\"\nexport { SubscriptionStatus } from \"./lib/SubscriptionStatus\"\nexport { SuperwallDelegate } from \"./lib/SuperwallDelegate\"\nexport { EventType, SuperwallEventInfo } from \"./lib/SuperwallEventInfo\"\nexport { SuperwallOptions } from \"./lib/SuperwallOptions\"\nexport { Survey } from \"./lib/Survey\"\nexport { TriggerResult } from \"./lib/TriggerResult\"\n\ninterface UserAttributes {\n [key: string]: any\n}\n\nexport default class Superwall {\n static purchaseController?: PurchaseController\n private static delegate?: SuperwallDelegate\n private static _superwall = new Superwall()\n\n private static configEmitter = new EventEmitter<{\n configured: (isConfigured: boolean) => void\n }>()\n private static didConfigure = false\n private presentationHandlers: Map<string, PaywallPresentationHandler> = new Map()\n subscriptionStatusEmitter = new EventEmitter<{\n change: (status: SubscriptionStatus) => void\n }>()\n\n private static setDidConfigure(didConfigure: boolean) {\n Superwall.didConfigure = didConfigure\n // Emit an event when the bridged state is true\n if (didConfigure) {\n Superwall.configEmitter.emit(\"configured\", didConfigure)\n }\n }\n\n private async awaitConfig(): Promise<void> {\n if (Superwall.didConfigure) {\n return\n }\n\n await new Promise<void>((resolve) => {\n Superwall.configEmitter.addListener(\"configured\", () => {\n resolve()\n })\n })\n }\n\n private constructor() {\n SuperwallExpoModule.addListener(\"onPurchase\", async (data) => {\n if (data.platform === \"ios\") {\n const purchaseResult = await Superwall.purchaseController?.purchaseFromAppStore(\n data.productId,\n )\n if (purchaseResult == null) {\n return\n }\n await SuperwallExpoModule.didPurchase(purchaseResult.toJSON())\n return\n }\n\n if (data.platform === \"android\") {\n const purchaseResult = await Superwall.purchaseController?.purchaseFromGooglePlay(\n data.productId,\n data.basePlanId,\n data.offerId,\n )\n if (purchaseResult == null) {\n return\n }\n await SuperwallExpoModule.didPurchase(purchaseResult.toJSON())\n }\n })\n\n SuperwallExpoModule.addListener(\"onPurchaseRestore\", async () => {\n const restorationResult = await Superwall.purchaseController?.restorePurchases()\n if (restorationResult == null) {\n return\n }\n await SuperwallExpoModule.didRestore(restorationResult.toJson())\n })\n\n SuperwallExpoModule.addListener(\"onPaywallPresent\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n if (!handler || !handler.onPresentHandler) {\n return\n }\n\n const paywallInfo = PaywallInfo.fromJson(data.paywallInfoJson)\n handler.onPresentHandler(paywallInfo)\n })\n SuperwallExpoModule.addListener(\"onPaywallDismiss\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onDismissHandler) {\n return\n }\n\n const info = PaywallInfo.fromJson(data.paywallInfoJson)\n const result = paywallResultFromJson(data.result)\n handler.onDismissHandler(info, result)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallError\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onErrorHandler) {\n return\n }\n\n handler.onErrorHandler(data.errorString)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallSkip\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onSkipHandler) {\n return\n }\n\n const skippedReason = PaywallSkippedReason.fromJson(data.skippedReason)\n handler.onSkipHandler(skippedReason)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallPresent\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onPresentHandler) {\n return\n }\n\n const info = PaywallInfo.fromJson(data.paywallInfoJson)\n handler.onPresentHandler(info)\n })\n\n // MARK: - SuperwallDelegate Listeners\n SuperwallExpoModule.addListener(\"subscriptionStatusDidChange\", async (data) => {\n Superwall.delegate?.subscriptionStatusDidChange(data.from, data.to)\n })\n\n SuperwallExpoModule.addListener(\"handleSuperwallEvent\", async (data) => {\n const eventInfo = SuperwallEventInfo.fromJson(data.eventInfo)\n Superwall.delegate?.handleSuperwallEvent(eventInfo)\n })\n\n SuperwallExpoModule.addListener(\"handleCustomPaywallAction\", async (data) => {\n const name = data.name\n Superwall.delegate?.handleCustomPaywallAction(name)\n })\n\n SuperwallExpoModule.addListener(\"willDismissPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.willDismissPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"willPresentPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.willPresentPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"didDismissPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.didDismissPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"didPresentPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.didPresentPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"handleLog\", async (data) => {\n Superwall.delegate?.handleLog(\n data.level,\n data.scope,\n data.message || undefined,\n data.info,\n data.error,\n )\n })\n\n SuperwallExpoModule.addListener(\"paywallWillOpenDeepLink\", async (data) => {\n const url = new URL(data.url)\n Superwall.delegate?.paywallWillOpenDeepLink(url)\n })\n\n SuperwallExpoModule.addListener(\"paywallWillOpenURL\", async (data) => {\n const url = new URL(data.url)\n Superwall.delegate?.paywallWillOpenURL(url)\n })\n\n SuperwallExpoModule.addListener(\"willRedeemLink\", async () => {\n Superwall.delegate?.willRedeemLink()\n })\n\n SuperwallExpoModule.addListener(\"didRedeemLink\", async (data) => {\n const result = RedemptionResults.fromJson(data)\n Superwall.delegate?.didRedeemLink(result)\n })\n\n SuperwallExpoModule.addListener(\"subscriptionStatusDidChange\", async (data) => {\n this.subscriptionStatusEmitter.emit(\"change\", data.to)\n })\n }\n\n /**\n * Returns the configured shared instance of `Superwall`.\n *\n * **Warning:** You must call {@link Superwall.configure} to initialize `Superwall`\n * before accessing this shared instance.\n *\n * @returns {Superwall} The shared `Superwall` instance.\n */\n static get shared(): Superwall {\n return Superwall._superwall\n }\n\n /**\n * Configures a shared instance of `Superwall` for use throughout your app.\n *\n * Call this as soon as your app starts to initialize the Superwall SDK.\n * Check out [Configuring the SDK](https://docs.superwall.com/docs/configuring-the-sdk) for information about how to configure the SDK.\n *\n * @param {object} config - Configuration object.\n * @param {string} config.apiKey - Your lib API Key that you can get from the Superwall dashboard settings.\n * If you don't have an account, you can [sign up for free](https://superwall.com/sign-up).\n * @param {SuperwallOptions} [config.options] - An optional object which allows you to customize the appearance and behavior\n * of the paywall.\n * @param {PurchaseController} [config.purchaseController] - An optional object that conforms to `PurchaseController`.\n * Implement this if you'd like to handle all subscription-related logic yourself. You'll need to also set the `subscriptionStatus`\n * every time the user's entitlements change. You can read more about that in [Purchases and Subscription Status](https://docs.superwall.com/docs/advanced-configuration).\n * If omitted, Superwall will handle all subscription-related logic itself.\n * @param {() => void} [config.completion] - An optional completion handler that lets you know when Superwall has finished configuring.\n *\n * @returns {Promise<Superwall>} The configured `Superwall` instance.\n */\n static async configure({\n apiKey,\n options,\n purchaseController,\n completion,\n }: {\n apiKey: string\n options?: SuperwallOptions\n purchaseController?: PurchaseController\n completion?: () => void\n }): Promise<Superwall> {\n Superwall.purchaseController = purchaseController\n await SuperwallExpoModule.configure(\n apiKey,\n options?.toJson(),\n !!purchaseController,\n `${version}compat`,\n )\n\n completion?.()\n\n Superwall.setDidConfigure(true)\n\n return Superwall._superwall\n }\n\n /**\n * Creates an account with Superwall by linking the provided `userId` to Superwall's automatically generated alias.\n *\n * Call this function as soon as you have a valid `userId`.\n *\n * @param {Object} config - The identification configuration object.\n * @param {string} config.userId - Your user's unique identifier as defined by your backend system.\n * @param {IdentityOptions} [config.options] - An optional {@link IdentityOptions} object. You can set the\n * {@link IdentityOptions.restorePaywallAssignments} property to `true` to instruct the SDK to wait to restore paywall assignments\n * from the server before presenting any paywalls. This option should be used only in advanced cases\n * (e.g., when users frequently switch accounts or reinstall the app).\n *\n * @returns {Promise<void>} A promise that resolves once the identification process is complete.\n */\n async identify({\n userId,\n options,\n }: {\n userId: string\n options?: IdentityOptions\n }): Promise<void> {\n await this.awaitConfig()\n const serializedOptions = options ? options.toJson() : new IdentityOptions().toJson()\n await SuperwallExpoModule.identify(userId, serializedOptions)\n }\n\n /**\n * Resets the `userId`, on-device paywall assignments, and data stored by Superwall.\n *\n * @returns {Promise<void>} A promise that resolves once reset is complete.\n */\n async reset(): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.reset()\n }\n\n /**\n * Handles a deep link.\n *\n * @param {string} url - The deep link to handle.\n * @returns {Promise<Boolean>} A promise that resolves to a boolean indicating whether the deep link was handled.\n */\n async handleDeepLink(url: string): Promise<boolean> {\n await this.awaitConfig()\n return await SuperwallExpoModule.handleDeepLink(url)\n }\n\n /**\n * Registers a placement to access a feature.\n *\n * When the placement is added to a campaign on the [Superwall Dashboard](https://superwall.com/dashboard),\n * it can trigger a paywall if the following conditions are met:\n * - The provided placement is included in a campaign on the Superwall Dashboard.\n * - The user matches an audience filter defined in the campaign.\n * - The user does not have an active subscription.\n *\n * Before using this method, ensure you have created a campaign and added the placement on the\n * [Superwall Dashboard](https://superwall.com/dashboard).\n *\n * The displayed paywall is determined by the audience filters set in the campaign.\n * Once a user is assigned a paywall within an audience, that paywall will continue to be shown unless\n * you remove it from the audience or reset the paywall assignments.\n *\n * @param {string} [params.placement] - The name of the placement to register.\n * @param {Map<string, any> | Record<string, any>} [params.params] - Optional parameters to pass with your placement.\n * These parameters can be referenced within the audience filters of your campaign. Keys beginning with `$`\n * are reserved for Superwall and will be omitted. Values can be any JSON-encodable value, URL, or Date.\n * Arrays and dictionaries are not supported and will be dropped.\n * @param {PaywallPresentationHandler} [params.handler] - An optional handler that receives status updates\n * about the paywall presentation.\n * @param {() => void} [params.feature] - An optional callback that will be executed after registration completes.\n * If provided, this callback will be executed after the registration process completes successfully.\n * If not provided, you can chain a `.then()` block to the returned promise to execute your feature logic.\n *\n * @returns {Promise<void>} if [feature] is provided this promise resolves when register is executed, otherwise a promise that resolves when register completes successfully after which you can chain a `.then()` block to execute your feature logic.\n *\n * @remarks\n * This behavior is remotely configurable via the [Superwall Dashboard](https://superwall.com/dashboard):\n *\n * - For _Non Gated_ paywalls, the feature block is executed when the paywall is dismissed or if the user is already paying.\n * - For _Gated_ paywalls, the feature block is executed only if the user is already paying or if they begin paying.\n * - If no paywall is configured, the feature block is executed immediately.\n * - If no feature block is provided, the returned promise will resolve when registration completes.\n * - If a feature block is provided, the returned promise will always resolve after the feature block is executed.\n * Note: The feature block will not be executed if an error occurs during registration. Such errors can be detected via the\n * `handler`.\n *\n * @example\n * // Using the feature callback:\n * Superwall.register({\n * placement: \"somePlacement\",\n * feature: () => {\n * console.log(\"Feature logic executed after registration\");\n * }\n * });\n *\n * // Alternatively, chaining feature logic after registration:\n * Superwall.register({ placement: \"somePlacement\" })\n * .then(() => {\n * // Execute your feature logic here after registration.\n * console.log(\"Placement registered, now executing feature logic.\");\n * })\n */\n async register(params: {\n placement: string\n params?: Map<string, any> | Record<string, any>\n handler?: PaywallPresentationHandler\n feature?: () => void\n }): Promise<void> {\n await this.awaitConfig()\n let handlerId: string | null = null\n\n if (params.handler) {\n const uuid = (+new Date() * Math.random()).toString(36)\n this.presentationHandlers.set(uuid, params.handler)\n handlerId = uuid\n }\n\n let paramsObject = {}\n if (params.params) {\n paramsObject =\n params.params instanceof Map ? Object.fromEntries(params.params) : params.params\n }\n\n if (params.feature) {\n return await SuperwallExpoModule.registerPlacement(\n params.placement,\n paramsObject,\n handlerId,\n ).then(() => {\n params.feature!() //TODO: This is wrong, the feature should be executed only if the native SDK calls the feature block\n // not after awaiting the promise\n })\n }\n\n return SuperwallExpoModule.registerPlacement(params.placement, paramsObject, handlerId)\n }\n\n /**\n * Confirms all experiment assignments and returns them in an array.\n *\n * Note that the assignments may differ when a placement is registered due to changes\n * in user, placement, or device parameters used in audience filters.\n *\n * @returns {Promise<Assignment[]>} A promise that resolves to an array of {@link Assignment} objects.\n */\n async confirmAllAssignments(): Promise<Assignment[]> {\n await this.awaitConfig()\n const assignments = await SuperwallExpoModule.confirmAllAssignments()\n return assignments.map((assignment: any) => Assignment.fromJson(assignment))\n }\n\n /**\n * Gets all the experiment assignments and returns them in an array.\n *\n * This method tracks the {@link SuperwallEvent.getAssignments} event in the delegate.\n *\n * Note that the assignments may differ when a placement is registered due to changes\n * in user, placement, or device parameters used in audience filters.\n *\n * @returns {Promise<Assignment[]>} A promise that resolves to an array of {@link Assignment} objects.\n */\n async getAssignments(): Promise<Assignment[]> {\n await this.awaitConfig()\n const assignments = await SuperwallExpoModule.getAssignments()\n return assignments.map((assignment: any) => Assignment.fromJson(assignment))\n }\n\n /**\n * Preemptively gets the result of registering a placement.\n *\n * This helps you determine whether a particular placement will present a paywall in the future.\n * Note that this method does not present a paywall. To present a paywall, use the `register` function.\n *\n * @param {Object} options - Options for obtaining the presentation result.\n * @param {string} options.placement - The name of the placement you want to register.\n * @param {Map<string, any>} [options.params] - Optional parameters to pass with your placement.\n *\n * @returns {Promise<PresentationResult>} A promise that resolves to a {@link PresentationResult} indicating the result of registering the placement.\n */\n async getPresentationResult({\n placement,\n params,\n }: {\n placement: string\n params?: Map<string, any>\n }): Promise<PresentationResult> {\n await this.awaitConfig()\n let paramsObject = {}\n if (params) {\n paramsObject = Object.fromEntries(params)\n }\n return await SuperwallExpoModule.getPresentationResult(placement, paramsObject)\n }\n\n /**\n * Retrieves the current configuration status of the Superwall SDK.\n *\n * This function returns a promise that resolves to the current configuration status,\n * indicating whether the SDK has finished configuring. Initially, the status is\n * {@link ConfigurationStatus.PENDING}. Once the configuration completes successfully, it\n * changes to {@link ConfigurationStatus.CONFIGURED}. If the configuration fails, the status\n * will be {@link ConfigurationStatus.FAILED}.\n *\n * @returns {Promise<ConfigurationStatus>} A promise that resolves with the current configuration status.\n */\n async getConfigurationStatus(): Promise<ConfigurationStatus> {\n const configurationStatusString = await SuperwallExpoModule.getConfigurationStatus()\n return ConfigurationStatus.fromString(configurationStatusString)\n }\n\n /**\n * Retrieves the entitlements tied to the device.\n *\n * @returns {Promise<EntitlementsInfo>} A promise that resolves to an {@link EntitlementsInfo} object.\n */\n async getEntitlements(): Promise<EntitlementsInfo> {\n await this.awaitConfig()\n const entitlementsJson = await SuperwallExpoModule.getEntitlements()\n return EntitlementsInfo.fromObject(entitlementsJson)\n }\n\n /**\n * Sets the subscription status of the user.\n *\n * When using a PurchaseController, you must call this method to update the user's subscription status.\n * Alternatively, you can implement the {@link SuperwallDelegate.subscriptionStatusDidChange} delegate callback to receive notifications\n * whenever the subscription status changes.\n *\n * @param {SubscriptionStatus} status - The new subscription status.\n *\n * @returns {Promise<void>} A promise that resolves once the subscription status has been updated.\n */\n async setSubscriptionStatus(status: SubscriptionStatus): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.setSubscriptionStatus(status)\n }\n\n async getSubscriptionStatus(): Promise<SubscriptionStatus> {\n await this.awaitConfig()\n const subscriptionStatusData = await SuperwallExpoModule.getSubscriptionStatus()\n return SubscriptionStatus.fromJson(subscriptionStatusData)\n }\n /**\n * Sets the user interface style, which overrides the system setting.\n *\n * Provide a value of type {@link InterfaceStyle} to explicitly set the interface style.\n * Pass `null` to revert back to the system's default interface style.\n *\n * @param {InterfaceStyle | null} style - The desired interface style, or `null` to use the system setting.\n *\n * @returns {Promise<void>} A promise that resolves once the interface style has been updated.\n */\n async setInterfaceStyle(style: InterfaceStyle | null): Promise<void> {\n await SuperwallExpoModule.setInterfaceStyle(style?.toString())\n }\n\n /**\n * Sets the delegate that handles Superwall lifecycle events.\n *\n * @param {SuperwallDelegate | undefined} delegate - An object implementing the {@link SuperwallDelegate} interface,\n * or `undefined` to remove the current delegate.\n *\n * @returns {Promise<void>} A promise that resolves once the delegate has been updated.\n */\n async setDelegate(delegate: SuperwallDelegate | undefined): Promise<void> {\n await this.awaitConfig()\n Superwall.delegate = delegate\n }\n\n /**\n * Retrieves the user attributes, set using {@link setUserAttributes}.\n *\n * @returns {Promise<UserAttributes>} A promise that resolves with an object representing the user's attributes.\n */\n async getUserAttributes(): Promise<UserAttributes> {\n await this.awaitConfig()\n const userAttributes: UserAttributes = await SuperwallExpoModule.getUserAttributes()\n return userAttributes\n }\n\n /**\n * Preloads all paywalls that the user may see based on campaigns and placements in your Superwall dashboard.\n *\n * To use this, first set `PaywallOptions.shouldPreload` to `false` when configuring the SDK.\n * Then call this function when you want preloading to begin.\n *\n * Note: This method will not reload any paywalls that have already been preloaded via {@link preloadPaywalls}.\n *\n * @returns {Promise<void>} A promise that resolves once the preloading process has been initiated.\n */\n async preloadAllPaywalls(): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.preloadAllPaywalls()\n }\n\n /**\n * Preloads paywalls for specific placements.\n *\n * To use this method, first ensure that {@link PaywallOptions.shouldPreload} is set to `false` when configuring the SDK.\n * Then call this function when you want to initiate preloading for selected placements.\n *\n * Note: This will not reload any paywalls you've already preloaded.\n *\n * @param {Set<string>} placementNames - A set of placement names whose paywalls you want to preload.\n *\n * @returns {Promise<void>} A promise that resolves once the preloading process has been initiated.\n */\n async preloadPaywalls(placementNames: Set<string>): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.preloadPaywalls(Array.from(placementNames))\n }\n\n /**\n * Sets user attributes for use in paywalls and on the Superwall dashboard.\n *\n * If an attribute already exists, its value will be overwritten while other attributes remain unchanged.\n * This is useful for analytics and campaign audience filters you may define in the Superwall Dashboard.\n *\n * **Note:** These attributes should not be used as a source of truth for sensitive information.\n *\n * For example, after retrieving your user's data:\n *\n * ```ts\n * const attributes: UserAttributes = {\n * name: user.name,\n * apnsToken: user.apnsTokenString,\n * email: user.email,\n * username: user.username,\n * profilePic: user.profilePicUrl,\n * }\n * await Superwall.setUserAttributes(attributes)\n * ```\n *\n * See [Setting User Attributes](https://docs.superwall.com/docs/setting-user-properties) for more information.\n *\n * @param {UserAttributes} userAttributes - An object containing custom attributes to store for the user.\n * Values can be any JSON-encodable value, URLs, or Dates. Keys beginning with `$` are reserved for Superwall and will be dropped.\n * Arrays and dictionaries as values are not supported and will be omitted.\n *\n * @returns {Promise<void>} A promise that resolves once the user attributes have been updated.\n */\n async setUserAttributes(userAttributes: UserAttributes): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.setUserAttributes(userAttributes)\n }\n\n /**\n * Dismisses the presented paywall, if one exists.\n *\n * @returns {Promise<void>} A promise that resolves once the paywall has been dismissed,\n * or immediately if no paywall was active.\n */\n async dismiss(): Promise<void> {\n await SuperwallExpoModule.dismiss()\n }\n\n async setLogLevel(level: LogLevel): Promise<void> {\n await SuperwallExpoModule.setLogLevel(level.toString())\n }\n}\n"]}
@@ -81,6 +81,8 @@ export interface PaywallInfo {
81
81
  variantId: string;
82
82
  /** The ID of the experiment that the paywall belongs to */
83
83
  experimentId: string;
84
+ /** The product identifier that the user purchased */
85
+ productIdentifier?: string;
84
86
  }
85
87
  /**
86
88
  * @category Models
@@ -1 +1 @@
1
- {"version":3,"file":"RedemptionResults.d.ts","sourceRoot":"","sources":["../../../../src/compat/lib/RedemptionResults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,wBAAwB;IACxB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;GA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;AACH,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,SAAS,EAAE,SAAS,CAAA;IACpB,sCAAsC;IACtC,aAAa,EAAE,aAAa,CAAA;IAC5B,0EAA0E;IAC1E,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,iDAAiD;IACjD,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GACxB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,cAAc,CAAA;CAAE,GACnE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GACnD;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GAClE;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACxC;IACE,MAAM,EAAE,sBAAsB,CAAA;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,cAAc,CAAA;CAC/B,CAAA;AAEL;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,gBAAgB;IAgD5C,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAsBlC,OAAO,CAAC,MAAM,CAAC,cAAc;IAmB7B,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAajC,OAAO,CAAC,MAAM,CAAC,qBAAqB;CAWrC"}
@@ -65,6 +65,7 @@ export class RedemptionResults {
65
65
  placementParams: json.paywallInfo.placementParams || {},
66
66
  variantId: json.paywallInfo.variantId,
67
67
  experimentId: json.paywallInfo.experimentId,
68
+ productIdentifier: json.paywallInfo.productIdentifier || undefined
68
69
  };
69
70
  }
70
71
  return result;
@@ -1 +1 @@
1
- {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qB,CAAC,IAAI,CAAC,gBAAgB,CAAC;SACjF,CAAA;QAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QAC3B,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,IAAS;QAC5C,IAAI,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5B,OAAO;gBACL,KAAK,EAAE,QAAQ;gBACf,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,IAAI,EAAE;aACxD,CAAA;QACH,CAAC;QAED,OAAO,EAAE,GAAG,IAAI,EAAE,CAAA;IACpB,CAAC;CACF","sourcesContent":["/**\n * RedemptionResult and related types\n * Corresponds to the Swift RedemptionResult enum and its associated types\n */\n\nimport { Entitlement } from \"./Entitlement\"\n\n/**\n * @category Models\n * @since 0.0.15\n * Information about an error that occurred during code redemption\n */\nexport interface ErrorInfo {\n /** The error message */\n message: string\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Information about an expired redemption code\n */\nexport interface ExpiredCodeInfo {\n /** Whether the redemption email was resent */\n resent: boolean\n /** Optional obfuscated email address that the redemption email was sent to */\n obfuscatedEmail?: string\n}\n\n/**\n * @category Types\n * @since 0.0.15\n * Represents the ownership of a redemption code\n */\nexport type Ownership =\n | { type: \"APP_USER\"; appUserId: string }\n | { type: \"DEVICE\"; deviceId: string }\n\n/**\n * @category Types\n * @since 0.0.15\n * Store identifiers for the purchase\n */\nexport type StoreIdentifiers =\n | {\n store: \"STRIPE\"\n stripeCustomerId: string\n stripeSubscriptionIds: string[]\n }\n | {\n store: \"PADDLE\"\n paddleCustomerId: string\n paddleSubscriptionIds: string[]\n }\n | { store: string; [key: string]: any } // For unknown store types\n\n/**\n * @category Models\n * @since 0.0.15\n * Information about the purchaser\n */\nexport interface PurchaserInfo {\n /** The app user ID of the purchaser */\n appUserId: string\n /** The email address of the purchaser (optional) */\n email?: string\n /** The identifiers for the store the purchase was made from */\n storeIdentifiers: StoreIdentifiers\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Information about the paywall the purchase was made from\n */\nexport interface PaywallInfo {\n /** The identifier of the paywall */\n identifier: string\n /** The name of the placement */\n placementName: string\n /** The params of the placement */\n placementParams: Record<string, any>\n /** The ID of the paywall variant */\n variantId: string\n /** The ID of the experiment that the paywall belongs to */\n experimentId: string\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Information about a successful redemption\n */\nexport interface RedemptionInfo {\n /** The ownership of the code */\n ownership: Ownership\n /** Information about the purchaser */\n purchaserInfo: PurchaserInfo\n /** Information about the paywall the purchase was made from (optional) */\n paywallInfo?: PaywallInfo\n /** The entitlements granted by the redemption */\n entitlements: Entitlement[]\n}\n\n/**\n * @category Types\n * @since 0.0.15\n * The result of redeeming a code via web checkout\n */\nexport type RedemptionResult =\n | { status: \"SUCCESS\"; code: string; redemptionInfo: RedemptionInfo }\n | { status: \"ERROR\"; code: string; error: ErrorInfo }\n | { status: \"CODE_EXPIRED\"; code: string; expired: ExpiredCodeInfo }\n | { status: \"INVALID_CODE\"; code: string }\n | {\n status: \"EXPIRED_SUBSCRIPTION\"\n code: string\n redemptionInfo: RedemptionInfo\n }\n\n/**\n * @category Utils\n * @since 0.0.15\n * Static methods for working with RedemptionResult\n */\nexport class RedemptionResults {\n static fromJson(json: any): RedemptionResult {\n const { status, code } = json\n\n switch (status) {\n case \"SUCCESS\":\n return {\n status,\n code,\n redemptionInfo: RedemptionResults.parseRedemptionInfo(json.redemptionInfo),\n }\n\n case \"ERROR\":\n return {\n status,\n code,\n error: {\n message: json.error.message,\n },\n }\n\n case \"CODE_EXPIRED\":\n return {\n status,\n code,\n expired: {\n resent: json.expired.resent,\n obfuscatedEmail: json.expired.obfuscatedEmail,\n },\n }\n\n case \"INVALID_CODE\":\n return {\n status,\n code,\n }\n\n case \"EXPIRED_SUBSCRIPTION\":\n return {\n status,\n code,\n redemptionInfo: RedemptionResults.parseRedemptionInfo(json.redemptionInfo),\n }\n\n default:\n throw new Error(`Unknown RedemptionResult status: ${status}`)\n }\n }\n\n private static parseRedemptionInfo(json: any): RedemptionInfo {\n const result: RedemptionInfo = {\n ownership: RedemptionResults.parseOwnership(json.ownership),\n purchaserInfo: RedemptionResults.parsePurchaserInfo(json.purchaserInfo),\n entitlements: Array.isArray(json.entitlements)\n ? json.entitlements.map((e: any) => Entitlement.fromJson(e))\n : [],\n }\n\n if (json.paywallInfo) {\n result.paywallInfo = {\n identifier: json.paywallInfo.identifier,\n placementName: json.paywallInfo.placementName,\n placementParams: json.paywallInfo.placementParams || {},\n variantId: json.paywallInfo.variantId,\n experimentId: json.paywallInfo.experimentId,\n }\n }\n\n return result\n }\n private static parseOwnership(json: any): Ownership {\n switch (json.type) {\n case \"APP_USER\":\n return {\n type: \"APP_USER\",\n appUserId: json.appUserId,\n }\n\n case \"DEVICE\":\n return {\n type: \"DEVICE\",\n deviceId: json.deviceId,\n }\n\n default:\n throw new Error(`Unknown ownership type: ${json.type}`)\n }\n }\n\n private static parsePurchaserInfo(json: any): PurchaserInfo {\n const result: PurchaserInfo = {\n appUserId: json.appUserId,\n storeIdentifiers: RedemptionResults.parseStoreIdentifiers(json.storeIdentifiers),\n }\n\n if (json.email) {\n result.email = json.email\n }\n\n return result\n }\n\n private static parseStoreIdentifiers(json: any): StoreIdentifiers {\n if (json.store === \"STRIPE\") {\n return {\n store: \"STRIPE\",\n stripeCustomerId: json.stripeCustomerId,\n stripeSubscriptionIds: json.stripeSubscriptionIds || [],\n }\n }\n\n return { ...json }\n }\n}\n"]}
1
+ {"version":3,"file":"RedemptionResults.js","sourceRoot":"","sources":["../../../../src/compat/lib/RedemptionResults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAqH3C;;;;GAIG;AACH,MAAM,OAAO,iBAA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,IAAI,CAAC,KAAK,CAAA;QAC3B,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,IAAS;QAC5C,IAAI,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5B,OAAO;gBACL,KAAK,EAAE,QAAQ;gBACf,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,qBAAqB,EAAE,IAAI,CAAC,qBAAqB,IAAI,EAAE;aACxD,CAAA;QACH,CAAC;QAED,OAAO,EAAE,GAAG,IAAI,EAAE,CAAA;IACpB,CAAC;CACF","sourcesContent":["/**\n * RedemptionResult and related types\n * Corresponds to the Swift RedemptionResult enum and its associated types\n */\n\nimport { Entitlement } from \"./Entitlement\"\n\n/**\n * @category Models\n * @since 0.0.15\n * Information about an error that occurred during code redemption\n */\nexport interface ErrorInfo {\n /** The error message */\n message: string\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Information about an expired redemption code\n */\nexport interface ExpiredCodeInfo {\n /** Whether the redemption email was resent */\n resent: boolean\n /** Optional obfuscated email address that the redemption email was sent to */\n obfuscatedEmail?: string\n}\n\n/**\n * @category Types\n * @since 0.0.15\n * Represents the ownership of a redemption code\n */\nexport type Ownership =\n | { type: \"APP_USER\"; appUserId: string }\n | { type: \"DEVICE\"; deviceId: string }\n\n/**\n * @category Types\n * @since 0.0.15\n * Store identifiers for the purchase\n */\nexport type StoreIdentifiers =\n | {\n store: \"STRIPE\"\n stripeCustomerId: string\n stripeSubscriptionIds: string[]\n }\n | {\n store: \"PADDLE\"\n paddleCustomerId: string\n paddleSubscriptionIds: string[]\n }\n | { store: string; [key: string]: any } // For unknown store types\n\n/**\n * @category Models\n * @since 0.0.15\n * Information about the purchaser\n */\nexport interface PurchaserInfo {\n /** The app user ID of the purchaser */\n appUserId: string\n /** The email address of the purchaser (optional) */\n email?: string\n /** The identifiers for the store the purchase was made from */\n storeIdentifiers: StoreIdentifiers\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Information about the paywall the purchase was made from\n */\nexport interface PaywallInfo {\n /** The identifier of the paywall */\n identifier: string\n /** The name of the placement */\n placementName: string\n /** The params of the placement */\n placementParams: Record<string, any>\n /** The ID of the paywall variant */\n variantId: string\n /** The ID of the experiment that the paywall belongs to */\n experimentId: string\n /** The product identifier that the user purchased */\n productIdentifier?: string \n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Information about a successful redemption\n */\nexport interface RedemptionInfo {\n /** The ownership of the code */\n ownership: Ownership\n /** Information about the purchaser */\n purchaserInfo: PurchaserInfo\n /** Information about the paywall the purchase was made from (optional) */\n paywallInfo?: PaywallInfo\n /** The entitlements granted by the redemption */\n entitlements: Entitlement[]\n}\n\n/**\n * @category Types\n * @since 0.0.15\n * The result of redeeming a code via web checkout\n */\nexport type RedemptionResult =\n | { status: \"SUCCESS\"; code: string; redemptionInfo: RedemptionInfo }\n | { status: \"ERROR\"; code: string; error: ErrorInfo }\n | { status: \"CODE_EXPIRED\"; code: string; expired: ExpiredCodeInfo }\n | { status: \"INVALID_CODE\"; code: string }\n | {\n status: \"EXPIRED_SUBSCRIPTION\"\n code: string\n redemptionInfo: RedemptionInfo\n }\n\n/**\n * @category Utils\n * @since 0.0.15\n * Static methods for working with RedemptionResult\n */\nexport class RedemptionResults {\n static fromJson(json: any): RedemptionResult {\n const { status, code } = json\n\n switch (status) {\n case \"SUCCESS\":\n return {\n status,\n code,\n redemptionInfo: RedemptionResults.parseRedemptionInfo(json.redemptionInfo),\n }\n\n case \"ERROR\":\n return {\n status,\n code,\n error: {\n message: json.error.message,\n },\n }\n\n case \"CODE_EXPIRED\":\n return {\n status,\n code,\n expired: {\n resent: json.expired.resent,\n obfuscatedEmail: json.expired.obfuscatedEmail,\n },\n }\n\n case \"INVALID_CODE\":\n return {\n status,\n code,\n }\n\n case \"EXPIRED_SUBSCRIPTION\":\n return {\n status,\n code,\n redemptionInfo: RedemptionResults.parseRedemptionInfo(json.redemptionInfo),\n }\n\n default:\n throw new Error(`Unknown RedemptionResult status: ${status}`)\n }\n }\n\n private static parseRedemptionInfo(json: any): RedemptionInfo {\n const result: RedemptionInfo = {\n ownership: RedemptionResults.parseOwnership(json.ownership),\n purchaserInfo: RedemptionResults.parsePurchaserInfo(json.purchaserInfo),\n entitlements: Array.isArray(json.entitlements)\n ? json.entitlements.map((e: any) => Entitlement.fromJson(e))\n : [],\n }\n\n if (json.paywallInfo) {\n result.paywallInfo = {\n identifier: json.paywallInfo.identifier,\n placementName: json.paywallInfo.placementName,\n placementParams: json.paywallInfo.placementParams || {},\n variantId: json.paywallInfo.variantId,\n experimentId: json.paywallInfo.experimentId,\n productIdentifier: json.paywallInfo.productIdentifier || undefined\n }\n }\n\n return result\n }\n private static parseOwnership(json: any): Ownership {\n switch (json.type) {\n case \"APP_USER\":\n return {\n type: \"APP_USER\",\n appUserId: json.appUserId,\n }\n\n case \"DEVICE\":\n return {\n type: \"DEVICE\",\n deviceId: json.deviceId,\n }\n\n default:\n throw new Error(`Unknown ownership type: ${json.type}`)\n }\n }\n\n private static parsePurchaserInfo(json: any): PurchaserInfo {\n const result: PurchaserInfo = {\n appUserId: json.appUserId,\n storeIdentifiers: RedemptionResults.parseStoreIdentifiers(json.storeIdentifiers),\n }\n\n if (json.email) {\n result.email = json.email\n }\n\n return result\n }\n\n private static parseStoreIdentifiers(json: any): StoreIdentifiers {\n if (json.store === \"STRIPE\") {\n return {\n store: \"STRIPE\",\n stripeCustomerId: json.stripeCustomerId,\n stripeSubscriptionIds: json.stripeSubscriptionIds || [],\n }\n }\n\n return { ...json }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useSuperwall.d.ts","sourceRoot":"","sources":["../../src/useSuperwall.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D;;;;GAIG;AACH,MAAM,WA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C,CAAA;IAEpE,mBAAmB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;CACxD;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,6EAuH3B,CAAA;AAEH;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,OAAO,GAAG,gBAAgB,CAAC,CAAA;AAEjG,eAAO,MAAM,gBAAgB,kCAAgC,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,YAAY,CAAC,CAAC,GAAG,oBAAoB,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,CAAC,GAAG,CAAC,CASjG"}
@@ -35,16 +35,17 @@ export const useSuperwallStore = create((set, get) => ({
35
35
  });
36
36
  },
37
37
  identify: async (userId, options) => {
38
- SuperwallExpoModule.identify(userId, options);
38
+ await SuperwallExpoModule.identify(userId, options);
39
39
  // TODO: Instead of setting users after identify, we should set this based on an event
40
- setTimeout(async () => {
41
- const currentUser = await SuperwallExpoModule.getUserAttributes();
42
- const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus();
43
- set({ user: currentUser, subscriptionStatus });
44
- }, 0);
40
+ await new Promise((resolve) => setTimeout(resolve, 0));
41
+ const [currentUser, subscriptionStatus] = await Promise.all([
42
+ SuperwallExpoModule.getUserAttributes(),
43
+ SuperwallExpoModule.getSubscriptionStatus(),
44
+ ]);
45
+ set({ user: currentUser, subscriptionStatus });
45
46
  },
46
47
  reset: async () => {
47
- SuperwallExpoModule.reset();
48
+ await SuperwallExpoModule.reset();
48
49
  const currentUser = await SuperwallExpoModule.getUserAttributes();
49
50
  const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus();
50
51
  set({ user: currentUser, subscriptionStatus });
@@ -65,7 +66,7 @@ export const useSuperwallStore = create((set, get) => ({
65
66
  SuperwallExpoModule.preloadPaywalls(placements);
66
67
  },
67
68
  setUserAttributes: async (attrs) => {
68
- SuperwallExpoModule.setUserAttributes(attrs);
69
+ await SuperwallExpoModule.setUserAttributes(attrs);
69
70
  const currentUser = await SuperwallExpoModule.getUserAttributes();
70
71
  set({ user: currentUser });
71
72
  },
@@ -78,7 +79,7 @@ export const useSuperwallStore = create((set, get) => ({
78
79
  SuperwallExpoModule.setLogLevel(level);
79
80
  },
80
81
  setSubscriptionStatus: async (status) => {
81
- SuperwallExpoModule.setSubscriptionStatus(status);
82
+ await SuperwallExpoModule.setSubscriptionStatus(status);
82
83
  },
83
84
  getDeviceAttributes: async () => {
84
85
  const attributes = await SuperwallExpoModule.getDeviceAttributes();
@@ -1 +1 @@
1
- {"version":3,"file":"useSuperwall.js","sourceRoot":"","sources":["../../src/useSuperwall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,GAAG,MAAM,iBAAiB,CAAA;AACjC,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AAqKvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACrE,qDAAqD;IACrD,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,KAAK;IAChB,oBAAoB,EAAE,KAAK;IAE3B,IAAI,EAAE,IAAI;IACV,kBAAkB,EAAE;QAClB,MAAM,EAAE,SAAS;KAClB;IAED,uDAAuD;IACvD,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QACnC,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACxB,MAAM,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,GAAG,W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;;;;GAgCG;AACH,MAAM,UAAU,YAAY,CAA2B,QAAuC;IAC5F,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAC/C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IAED,MAAM,QAAQ,GAAG,CAAC,KAAqB,EAAE,EAAE,CAAC,KAAqB,CAAA;IACjE,6DAA6D;IAC7D,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;AACtE,CAAC","sourcesContent":["import { createContext, useContext } from \"react\"\nimport { create } from \"zustand\"\nimport { useShallow } from \"zustand/shallow\"\nimport pkg from \"../package.json\"\nimport SuperwallExpoModule from \"./SuperwallExpoModule\"\nimport type { SubscriptionStatus } from \"./SuperwallExpoModule.types\"\nimport type { SuperwallOptions } from \"./SuperwallOptions\"\n\n/**\n * @category Models\n * @since 0.0.15\n * Interface representing the attributes of a user.\n */\nexport interface UserAttributes {\n /** The user's alias ID, if set. */\n aliasId: string\n /** The user's application-specific user ID. */\n appUserId: string\n /** The ISO 8601 date string representation of when the application was installed on the user's device. */\n applicationInstalledAt: string\n /** A seed value associated with the user, used for consistent variant assignments in experiments. */\n seed: number\n /** Allows for custom attributes to be set for the user. These can be of any type. */\n [key: string]: any\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Options for the `identify` method.\n */\nexport interface IdentifyOptions {\n /**\n * Determines whether to restore paywall assignments from a previous session for the identified user.\n * If `true`, the SDK attempts to restore the assignments. Defaults to `false`.\n */\n restorePaywallAssignments?: boolean\n}\n\n/**\n * @category Store\n * @since 0.0.15\n * Defines the structure of the Superwall store, including its state and actions.\n * This store is managed by Zustand.\n */\nexport interface SuperwallStore {\n /* -------------------- State -------------------- */\n /** Indicates whether the Superwall SDK has been successfully configured. */\n isConfigured: boolean\n /** Indicates whether the SDK is currently performing a loading operation (e.g., configuring, fetching data). */\n isLoading: boolean\n /** Indicates whether the native event listeners have been initialized. */\n listenersInitialized: boolean\n\n /**\n * The current user's attributes.\n * `null` if no user is identified or after `reset` is called.\n * `undefined` initially before any user data is fetched or set.\n */\n user?: UserAttributes | null\n\n /** The current subscription status of the user. */\n subscriptionStatus: SubscriptionStatus\n\n /* -------------------- Internal -------------------- */\n // Internal listener references for cleanup handled inside Provider effect.\n // Not reactive, so we store outside Zustand state to avoid unnecessary rerenders.\n\n /* -------------------- Actions -------------------- */\n /**\n * Configures the Superwall SDK with the provided API key and options.\n * This must be called before most other SDK functions can be used.\n * @param apiKey - Your Superwall API key.\n * @param options - Optional configuration settings for the SDK.\n * @returns A promise that resolves when configuration is complete.\n * @internal\n */\n configure: (\n apiKey: string,\n options?: Partial<SuperwallOptions> & {\n /** @deprecated Use manualPurchaseManagement instead */\n manualPurchaseManagment?: boolean\n },\n ) => Promise<void>\n /**\n * Identifies the current user with a unique ID.\n * @param userId - The unique identifier for the user.\n * @param options - Optional parameters for identification.\n * @returns A promise that resolves when identification is complete.\n */\n identify: (userId: string, options?: IdentifyOptions) => Promise<void>\n /**\n * Resets the user's identity and clears all user-specific data, effectively logging them out.\n * @internal\n */\n reset: () => Promise<void>\n\n /**\n * Registers a placement to potentially show a paywall.\n * The decision to show a paywall is determined by campaign rules and user assignments on the Superwall dashboard.\n * @param placement - The ID of the placement to register.\n * @param params - Optional parameters to pass with the placement.\n * @param handlerId - An optional identifier used to associate specific event handlers (e.g., from `usePlacement`). Defaults to \"default\".\n * @returns A promise that resolves when the placement registration is complete.\n */\n registerPlacement: (\n placement: string,\n params?: Record<string, any>,\n handlerId?: string | null,\n ) => Promise<void>\n /**\n * Retrieves the presentation result for a given placement.\n * This can be used to understand what would happen if a placement were to be registered, without actually registering it.\n * @param placement - The ID of the placement.\n * @param params - Optional parameters for the placement.\n * @returns A promise that resolves with the presentation result.\n */\n getPresentationResult: (placement: string, params?: Record<string, any>) => Promise<any>\n /**\n * Dismisses any currently presented Superwall paywall.\n * @returns A promise that resolves when the dismissal is complete.\n */\n dismiss: () => Promise<void>\n\n /**\n * Preloads all paywalls configured in your Superwall dashboard.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadAllPaywalls: () => Promise<void>\n /**\n * Preloads specific paywalls.\n * @param placements - An array of placement IDs for which to preload paywalls.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadPaywalls: (placements: string[]) => Promise<void>\n\n /**\n * Sets custom attributes for the current user.\n * @param attrs - An object containing the attributes to set.\n * @returns A promise that resolves when attributes are set.\n */\n setUserAttributes: (attrs: Record<string, any>) => Promise<void>\n /**\n * Retrieves the current user's attributes.\n * @returns A promise that resolves with the user's attributes.\n */\n getUserAttributes: () => Promise<Record<string, any>>\n\n /**\n * Sets the logging level for the Superwall SDK.\n * @param level - The desired log level (e.g., \"debug\", \"info\", \"warn\", \"error\", \"none\").\n * @returns A promise that resolves when the log level is set.\n */\n setLogLevel: (level: string) => Promise<void>\n\n /* -------------------- Listener helpers -------------------- */\n /**\n * Initializes native event listeners for the SDK.\n * This is typically called internally by the `SuperwallProvider`.\n * @returns A cleanup function to remove the listeners.\n * @internal\n */\n _initListeners: () => () => void\n\n setSubscriptionStatus: (status: SubscriptionStatus) => Promise<void>\n\n getDeviceAttributes: () => Promise<Record<string, any>>\n}\n\n/**\n * @category Store\n * @since 0.0.15\n * Zustand store for Superwall SDK state and actions.\n * @internal\n */\nexport const useSuperwallStore = create<SuperwallStore>((set, get) => ({\n /* -------------------- State -------------------- */\n isConfigured: false,\n isLoading: false,\n listenersInitialized: false,\n\n user: null,\n subscriptionStatus: {\n status: \"UNKNOWN\",\n },\n\n /* -------------------- Actions -------------------- */\n configure: async (apiKey, options) => {\n set({ isLoading: true })\n const { manualPurchaseManagement, manualPurchaseManagment, ...restOptions } = options || {}\n\n // Support both spellings for backward compatibility\n const isManualPurchaseManagement = manualPurchaseManagement ?? manualPurchaseManagment ?? false\n\n await SuperwallExpoModule.configure(apiKey, restOptions, isManualPurchaseManagement, pkg.version)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({\n isConfigured: true,\n isLoading: false,\n user: currentUser as UserAttributes,\n subscriptionStatus,\n })\n },\n identify: async (userId, options) => {\n SuperwallExpoModule.identify(userId, options)\n\n // TODO: Instead of setting users after identify, we should set this based on an event\n setTimeout(async () => {\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n }, 0)\n },\n reset: async () => {\n SuperwallExpoModule.reset()\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n },\n registerPlacement: async (placement, params, handlerId = \"default\") => {\n await SuperwallExpoModule.registerPlacement(placement, params, handlerId)\n },\n getPresentationResult: async (placement, params) => {\n return SuperwallExpoModule.getPresentationResult(placement, params)\n },\n dismiss: async () => {\n await SuperwallExpoModule.dismiss()\n },\n preloadAllPaywalls: async () => {\n SuperwallExpoModule.preloadAllPaywalls()\n },\n preloadPaywalls: async (placements) => {\n SuperwallExpoModule.preloadPaywalls(placements)\n },\n setUserAttributes: async (attrs) => {\n SuperwallExpoModule.setUserAttributes(attrs)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n set({ user: currentUser as UserAttributes })\n },\n getUserAttributes: async () => {\n const attributes = await SuperwallExpoModule.getUserAttributes()\n set({ user: attributes as UserAttributes })\n return attributes\n },\n setLogLevel: async (level) => {\n SuperwallExpoModule.setLogLevel(level)\n },\n\n setSubscriptionStatus: async (status) => {\n SuperwallExpoModule.setSubscriptionStatus(status)\n },\n getDeviceAttributes: async () => {\n const attributes = await SuperwallExpoModule.getDeviceAttributes()\n return attributes\n },\n\n /* -------------------- Listener helpers -------------------- */\n _initListeners: (): (() => void) => {\n // Use get() to read the state from within the store\n if (get().listenersInitialized) {\n console.warn(\"Listeners already initialized. Skipping.\")\n return () => {} // Return no-op cleanup\n }\n\n const subscriptions: { remove: () => void }[] = []\n\n subscriptions.push(\n SuperwallExpoModule.addListener(\n \"subscriptionStatusDidChange\",\n ({ to }: { to: SubscriptionStatus }) => {\n set({ subscriptionStatus: to })\n },\n ),\n )\n\n set({ listenersInitialized: true })\n console.log(\"Initialized listeners\", subscriptions.length)\n\n return (): void => {\n console.log(\"Cleaning up listeners\", subscriptions.length)\n subscriptions.forEach((s) => s.remove())\n // Reset the state on cleanup\n set({ listenersInitialized: false })\n }\n },\n}))\n\n/**\n * @category Store\n * @since 0.0.15\n * Public interface for the Superwall store, excluding internal methods.\n */\nexport type PublicSuperwallStore = Omit<SuperwallStore, \"configure\" | \"reset\" | \"_initListeners\">\n\nexport const SuperwallContext = createContext<boolean>(false)\n\n/**\n * @category Hooks\n * @since 0.0.15\n * Core React hook for interacting with the Superwall SDK.\n *\n * This hook provides access to the Superwall store, which includes SDK state\n * (like configuration status, user information, subscription status) and actions\n * (like `identify`, `reset`, `registerPlacement`).\n *\n * It must be used within a component that is a descendant of `<SuperwallProvider />`.\n *\n * @template T - Optional type parameter for the selected state. Defaults to the entire `PublicSuperwallStore`.\n * @param selector - An optional function to select a specific slice of the store's state.\n * This is useful for performance optimization, as components will only re-render\n * if the selected part of the state changes. Uses shallow equality checking\n * via `zustand/shallow`. If omitted, the entire store is returned.\n * @returns The selected slice of the Superwall store state, or the entire store if no selector is provided.\n * @throws Error if used outside of a `SuperwallProvider`.\n *\n * @example\n * // Get the entire store\n * const superwall = useSuperwall();\n * console.log(superwall.isConfigured);\n * superwall.identify(\"user_123\");\n *\n * @example\n * // Select specific state properties\n * const { user, subscriptionStatus } = useSuperwall(state => ({\n * user: state.user,\n * subscriptionStatus: state.subscriptionStatus,\n * }));\n * console.log(user?.appUserId, subscriptionStatus?.status);\n */\nexport function useSuperwall<T = PublicSuperwallStore>(selector?: (state: SuperwallStore) => T): T {\n const inProvider = useContext(SuperwallContext)\n if (!inProvider) {\n throw new Error(\"useSuperwall must be used within a SuperwallProvider\")\n }\n\n const identity = (state: SuperwallStore) => state as unknown as T\n // biome-ignore lint/correctness/useHookAtTopLevel: good here\n return useSuperwallStore(selector ? useShallow(selector) : identity)\n}\n"]}
1
+ {"version":3,"file":"useSuperwall.js","sourceRoot":"","sources":["../../src/useSuperwall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,GAAG,MAAM,iBAAiB,CAAA;AACjC,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AAqKvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACrE,qDAAqD;IACrD,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,KAAK;IAChB,oBAAoB,EAAE,KAAK;IAE3B,IAAI,EAAE,IAAI;IACV,kBAAkB,EAAE;QAClB,MAAM,EAAE,SAAS;KAClB;IAED,uDAAuD;IACvD,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QACnC,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACxB,MAAM,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;QAE3F,oDAAoD;QACpD,MAAM,0BAA0B,GAAG,wBAAwB,IAAI,uBAAuB,IAAI,KAAK,CAAA;QAE/F,MAAM,mBAAmB,CAAC,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,0BAA0B,EAAE,GAAG,CAAC,OAAO,CAAC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UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IAED,MAAM,QAAQ,GAAG,CAAC,KAAqB,EAAE,EAAE,CAAC,KAAqB,CAAA;IACjE,6DAA6D;IAC7D,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;AACtE,CAAC","sourcesContent":["import { createContext, useContext } from \"react\"\nimport { create } from \"zustand\"\nimport { useShallow } from \"zustand/shallow\"\nimport pkg from \"../package.json\"\nimport SuperwallExpoModule from \"./SuperwallExpoModule\"\nimport type { SubscriptionStatus } from \"./SuperwallExpoModule.types\"\nimport type { SuperwallOptions } from \"./SuperwallOptions\"\n\n/**\n * @category Models\n * @since 0.0.15\n * Interface representing the attributes of a user.\n */\nexport interface UserAttributes {\n /** The user's alias ID, if set. */\n aliasId: string\n /** The user's application-specific user ID. */\n appUserId: string\n /** The ISO 8601 date string representation of when the application was installed on the user's device. */\n applicationInstalledAt: string\n /** A seed value associated with the user, used for consistent variant assignments in experiments. */\n seed: number\n /** Allows for custom attributes to be set for the user. These can be of any type. */\n [key: string]: any\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Options for the `identify` method.\n */\nexport interface IdentifyOptions {\n /**\n * Determines whether to restore paywall assignments from a previous session for the identified user.\n * If `true`, the SDK attempts to restore the assignments. Defaults to `false`.\n */\n restorePaywallAssignments?: boolean\n}\n\n/**\n * @category Store\n * @since 0.0.15\n * Defines the structure of the Superwall store, including its state and actions.\n * This store is managed by Zustand.\n */\nexport interface SuperwallStore {\n /* -------------------- State -------------------- */\n /** Indicates whether the Superwall SDK has been successfully configured. */\n isConfigured: boolean\n /** Indicates whether the SDK is currently performing a loading operation (e.g., configuring, fetching data). */\n isLoading: boolean\n /** Indicates whether the native event listeners have been initialized. */\n listenersInitialized: boolean\n\n /**\n * The current user's attributes.\n * `null` if no user is identified or after `reset` is called.\n * `undefined` initially before any user data is fetched or set.\n */\n user?: UserAttributes | null\n\n /** The current subscription status of the user. */\n subscriptionStatus: SubscriptionStatus\n\n /* -------------------- Internal -------------------- */\n // Internal listener references for cleanup handled inside Provider effect.\n // Not reactive, so we store outside Zustand state to avoid unnecessary rerenders.\n\n /* -------------------- Actions -------------------- */\n /**\n * Configures the Superwall SDK with the provided API key and options.\n * This must be called before most other SDK functions can be used.\n * @param apiKey - Your Superwall API key.\n * @param options - Optional configuration settings for the SDK.\n * @returns A promise that resolves when configuration is complete.\n * @internal\n */\n configure: (\n apiKey: string,\n options?: Partial<SuperwallOptions> & {\n /** @deprecated Use manualPurchaseManagement instead */\n manualPurchaseManagment?: boolean\n },\n ) => Promise<void>\n /**\n * Identifies the current user with a unique ID.\n * @param userId - The unique identifier for the user.\n * @param options - Optional parameters for identification.\n * @returns A promise that resolves when identification is complete.\n */\n identify: (userId: string, options?: IdentifyOptions) => Promise<void>\n /**\n * Resets the user's identity and clears all user-specific data, effectively logging them out.\n * @internal\n */\n reset: () => Promise<void>\n\n /**\n * Registers a placement to potentially show a paywall.\n * The decision to show a paywall is determined by campaign rules and user assignments on the Superwall dashboard.\n * @param placement - The ID of the placement to register.\n * @param params - Optional parameters to pass with the placement.\n * @param handlerId - An optional identifier used to associate specific event handlers (e.g., from `usePlacement`). Defaults to \"default\".\n * @returns A promise that resolves when the placement registration is complete.\n */\n registerPlacement: (\n placement: string,\n params?: Record<string, any>,\n handlerId?: string | null,\n ) => Promise<void>\n /**\n * Retrieves the presentation result for a given placement.\n * This can be used to understand what would happen if a placement were to be registered, without actually registering it.\n * @param placement - The ID of the placement.\n * @param params - Optional parameters for the placement.\n * @returns A promise that resolves with the presentation result.\n */\n getPresentationResult: (placement: string, params?: Record<string, any>) => Promise<any>\n /**\n * Dismisses any currently presented Superwall paywall.\n * @returns A promise that resolves when the dismissal is complete.\n */\n dismiss: () => Promise<void>\n\n /**\n * Preloads all paywalls configured in your Superwall dashboard.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadAllPaywalls: () => Promise<void>\n /**\n * Preloads specific paywalls.\n * @param placements - An array of placement IDs for which to preload paywalls.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadPaywalls: (placements: string[]) => Promise<void>\n\n /**\n * Sets custom attributes for the current user.\n * @param attrs - An object containing the attributes to set.\n * @returns A promise that resolves when attributes are set.\n */\n setUserAttributes: (attrs: Record<string, any>) => Promise<void>\n /**\n * Retrieves the current user's attributes.\n * @returns A promise that resolves with the user's attributes.\n */\n getUserAttributes: () => Promise<Record<string, any>>\n\n /**\n * Sets the logging level for the Superwall SDK.\n * @param level - The desired log level (e.g., \"debug\", \"info\", \"warn\", \"error\", \"none\").\n * @returns A promise that resolves when the log level is set.\n */\n setLogLevel: (level: string) => Promise<void>\n\n /* -------------------- Listener helpers -------------------- */\n /**\n * Initializes native event listeners for the SDK.\n * This is typically called internally by the `SuperwallProvider`.\n * @returns A cleanup function to remove the listeners.\n * @internal\n */\n _initListeners: () => () => void\n\n setSubscriptionStatus: (status: SubscriptionStatus) => Promise<void>\n\n getDeviceAttributes: () => Promise<Record<string, any>>\n}\n\n/**\n * @category Store\n * @since 0.0.15\n * Zustand store for Superwall SDK state and actions.\n * @internal\n */\nexport const useSuperwallStore = create<SuperwallStore>((set, get) => ({\n /* -------------------- State -------------------- */\n isConfigured: false,\n isLoading: false,\n listenersInitialized: false,\n\n user: null,\n subscriptionStatus: {\n status: \"UNKNOWN\",\n },\n\n /* -------------------- Actions -------------------- */\n configure: async (apiKey, options) => {\n set({ isLoading: true })\n const { manualPurchaseManagement, manualPurchaseManagment, ...restOptions } = options || {}\n\n // Support both spellings for backward compatibility\n const isManualPurchaseManagement = manualPurchaseManagement ?? manualPurchaseManagment ?? false\n\n await SuperwallExpoModule.configure(apiKey, restOptions, isManualPurchaseManagement, pkg.version)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({\n isConfigured: true,\n isLoading: false,\n user: currentUser as UserAttributes,\n subscriptionStatus,\n })\n },\n identify: async (userId, options) => {\n await SuperwallExpoModule.identify(userId, options)\n\n // TODO: Instead of setting users after identify, we should set this based on an event\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n const [currentUser, subscriptionStatus] = await Promise.all([\n SuperwallExpoModule.getUserAttributes(),\n SuperwallExpoModule.getSubscriptionStatus(),\n ])\n\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n },\n reset: async () => {\n await SuperwallExpoModule.reset()\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n },\n registerPlacement: async (placement, params, handlerId = \"default\") => {\n await SuperwallExpoModule.registerPlacement(placement, params, handlerId)\n },\n getPresentationResult: async (placement, params) => {\n return SuperwallExpoModule.getPresentationResult(placement, params)\n },\n dismiss: async () => {\n await SuperwallExpoModule.dismiss()\n },\n preloadAllPaywalls: async () => {\n SuperwallExpoModule.preloadAllPaywalls()\n },\n preloadPaywalls: async (placements) => {\n SuperwallExpoModule.preloadPaywalls(placements)\n },\n setUserAttributes: async (attrs) => {\n await SuperwallExpoModule.setUserAttributes(attrs)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n set({ user: currentUser as UserAttributes })\n },\n getUserAttributes: async () => {\n const attributes = await SuperwallExpoModule.getUserAttributes()\n set({ user: attributes as UserAttributes })\n return attributes\n },\n setLogLevel: async (level) => {\n SuperwallExpoModule.setLogLevel(level)\n },\n\n setSubscriptionStatus: async (status) => {\n await SuperwallExpoModule.setSubscriptionStatus(status)\n },\n getDeviceAttributes: async () => {\n const attributes = await SuperwallExpoModule.getDeviceAttributes()\n return attributes\n },\n\n /* -------------------- Listener helpers -------------------- */\n _initListeners: (): (() => void) => {\n // Use get() to read the state from within the store\n if (get().listenersInitialized) {\n console.warn(\"Listeners already initialized. Skipping.\")\n return () => {} // Return no-op cleanup\n }\n\n const subscriptions: { remove: () => void }[] = []\n\n subscriptions.push(\n SuperwallExpoModule.addListener(\n \"subscriptionStatusDidChange\",\n ({ to }: { to: SubscriptionStatus }) => {\n set({ subscriptionStatus: to })\n },\n ),\n )\n\n set({ listenersInitialized: true })\n console.log(\"Initialized listeners\", subscriptions.length)\n\n return (): void => {\n console.log(\"Cleaning up listeners\", subscriptions.length)\n subscriptions.forEach((s) => s.remove())\n // Reset the state on cleanup\n set({ listenersInitialized: false })\n }\n },\n}))\n\n/**\n * @category Store\n * @since 0.0.15\n * Public interface for the Superwall store, excluding internal methods.\n */\nexport type PublicSuperwallStore = Omit<SuperwallStore, \"configure\" | \"reset\" | \"_initListeners\">\n\nexport const SuperwallContext = createContext<boolean>(false)\n\n/**\n * @category Hooks\n * @since 0.0.15\n * Core React hook for interacting with the Superwall SDK.\n *\n * This hook provides access to the Superwall store, which includes SDK state\n * (like configuration status, user information, subscription status) and actions\n * (like `identify`, `reset`, `registerPlacement`).\n *\n * It must be used within a component that is a descendant of `<SuperwallProvider />`.\n *\n * @template T - Optional type parameter for the selected state. Defaults to the entire `PublicSuperwallStore`.\n * @param selector - An optional function to select a specific slice of the store's state.\n * This is useful for performance optimization, as components will only re-render\n * if the selected part of the state changes. Uses shallow equality checking\n * via `zustand/shallow`. If omitted, the entire store is returned.\n * @returns The selected slice of the Superwall store state, or the entire store if no selector is provided.\n * @throws Error if used outside of a `SuperwallProvider`.\n *\n * @example\n * // Get the entire store\n * const superwall = useSuperwall();\n * console.log(superwall.isConfigured);\n * superwall.identify(\"user_123\");\n *\n * @example\n * // Select specific state properties\n * const { user, subscriptionStatus } = useSuperwall(state => ({\n * user: state.user,\n * subscriptionStatus: state.subscriptionStatus,\n * }));\n * console.log(user?.appUserId, subscriptionStatus?.status);\n */\nexport function useSuperwall<T = PublicSuperwallStore>(selector?: (state: SuperwallStore) => T): T {\n const inProvider = useContext(SuperwallContext)\n if (!inProvider) {\n throw new Error(\"useSuperwall must be used within a SuperwallProvider\")\n }\n\n const identity = (state: SuperwallStore) => state as unknown as T\n // biome-ignore lint/correctness/useHookAtTopLevel: good here\n return useSuperwallStore(selector ? useShallow(selector) : identity)\n}\n"]}
@@ -70,13 +70,19 @@ public class SuperwallExpoModule: Module {
70
70
  return Bundle.main.object(forInfoDictionaryKey: "SUPERWALL_API_KEY") as? String
71
71
  }
72
72
 
73
- Function("identify") { (userId: String, options: [String: Any]?) in
74
- let options = IdentityOptions.fromJson(options)
75
- Superwall.shared.identify(userId: userId, options: options)
73
+ AsyncFunction("identify") { (userId: String, options: [String: Any]?, promise: Promise) in
74
+ DispatchQueue.main.async {
75
+ let identityOptions = IdentityOptions.fromJson(options)
76
+ Superwall.shared.identify(userId: userId, options: identityOptions)
77
+ promise.resolve(nil)
78
+ }
76
79
  }
77
80
 
78
- Function("reset") {
79
- Superwall.shared.reset()
81
+ AsyncFunction("reset") { (promise: Promise) in
82
+ DispatchQueue.main.async {
83
+ Superwall.shared.reset()
84
+ promise.resolve(nil)
85
+ }
80
86
  }
81
87
 
82
88
  AsyncFunction("configure") {
@@ -201,36 +207,39 @@ public class SuperwallExpoModule: Module {
201
207
  promise.resolve(subscriptionStatus.toJson())
202
208
  }
203
209
 
204
- Function("setSubscriptionStatus") { (status: [String: Any]) in
205
- let statusString = (status["status"] as? String)?.uppercased() ?? "UNKNOWN"
206
- let subscriptionStatus: SubscriptionStatus
207
-
208
- print("Setting subscription status to: \(statusString)")
209
-
210
- switch statusString {
211
- case "UNKNOWN":
212
- subscriptionStatus = .unknown
213
- case "INACTIVE":
214
- subscriptionStatus = .inactive
215
- case "ACTIVE":
216
- if let entitlementsArray = status["entitlements"] as? [[String: Any]] {
217
- let entitlementsSet: Set<Entitlement> = Set(
218
- entitlementsArray.compactMap { item in
219
- if let id = item["id"] as? String {
220
- return Entitlement(id: id)
221
- }
222
- return nil
223
- }
224
- )
225
- subscriptionStatus = .active(entitlementsSet)
226
- } else {
210
+ AsyncFunction("setSubscriptionStatus") { (status: [String: Any], promise: Promise) in
211
+ DispatchQueue.main.async {
212
+ let statusString = (status["status"] as? String)?.uppercased() ?? "UNKNOWN"
213
+ let subscriptionStatus: SubscriptionStatus
214
+
215
+ print("Setting subscription status to: \(statusString)")
216
+
217
+ switch statusString {
218
+ case "UNKNOWN":
219
+ subscriptionStatus = .unknown
220
+ case "INACTIVE":
227
221
  subscriptionStatus = .inactive
222
+ case "ACTIVE":
223
+ if let entitlementsArray = status["entitlements"] as? [[String: Any]] {
224
+ let entitlementsSet: Set<Entitlement> = Set(
225
+ entitlementsArray.compactMap { item in
226
+ if let id = item["id"] as? String {
227
+ return Entitlement(id: id)
228
+ }
229
+ return nil
230
+ }
231
+ )
232
+ subscriptionStatus = .active(entitlementsSet)
233
+ } else {
234
+ subscriptionStatus = .inactive
235
+ }
236
+ default:
237
+ subscriptionStatus = .unknown
228
238
  }
229
- default:
230
- subscriptionStatus = .unknown
231
- }
232
239
 
233
- Superwall.shared.subscriptionStatus = subscriptionStatus
240
+ Superwall.shared.subscriptionStatus = subscriptionStatus
241
+ promise.resolve(nil)
242
+ }
234
243
  }
235
244
 
236
245
  Function("setInterfaceStyle") { (style: String?) in
@@ -250,8 +259,11 @@ public class SuperwallExpoModule: Module {
250
259
  return await Superwall.shared.getDeviceAttributes()
251
260
  }
252
261
 
253
- Function("setUserAttributes") { (userAttributes: [String: Any]) in
254
- Superwall.shared.setUserAttributes(userAttributes)
262
+ AsyncFunction("setUserAttributes") { (userAttributes: [String: Any], promise: Promise) in
263
+ DispatchQueue.main.async {
264
+ Superwall.shared.setUserAttributes(userAttributes)
265
+ promise.resolve(nil)
266
+ }
255
267
  }
256
268
 
257
269
  AsyncFunction("handleDeepLink") { (url: String, promise: Promise) in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-superwall",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "description": "Offical Expo Integration for Superwall",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",