expo-superwall 1.0.9 → 1.0.10
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 +6 -0
- package/README.md +1 -1
- package/build/package.json +1 -1
- package/build/src/SuperwallExpoModule.d.ts +2 -1
- package/build/src/SuperwallExpoModule.d.ts.map +1 -1
- package/build/src/SuperwallExpoModule.js.map +1 -1
- package/build/src/compat/index.d.ts +2 -1
- package/build/src/compat/index.d.ts.map +1 -1
- package/build/src/compat/index.js +14 -13
- package/build/src/compat/index.js.map +1 -1
- package/build/src/index.d.ts +1 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +1 -1
- package/build/src/index.js.map +1 -1
- package/build/src/useSuperwall.d.ts +2 -1
- package/build/src/useSuperwall.d.ts.map +1 -1
- package/build/src/useSuperwall.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -340,7 +340,7 @@ The hook returns an object representing the Superwall store. If a `selector` fun
|
|
|
340
340
|
- `IdentifyOptions`:
|
|
341
341
|
- `restorePaywallAssignments?: boolean`: If true, restores paywall assignments from a previous session.
|
|
342
342
|
- `registerPlacement: (placement: string, params?: Record<string, any>, handlerId?: string | null) => Promise<void>`: Registers a placement. This may or may not present a paywall depending on campaign rules. `handlerId` is used internally by `usePlacement` to associate events.
|
|
343
|
-
- `getPresentationResult: (placement: string, params?: Record<string, any>) => Promise<
|
|
343
|
+
- `getPresentationResult: (placement: string, params?: Record<string, any>) => Promise<PresentationResult>`: Gets the presentation result for a given placement.
|
|
344
344
|
- `dismiss: () => Promise<void>`: Dismisses any currently presented paywall.
|
|
345
345
|
- `preloadAllPaywalls: () => Promise<void>`: Preloads all paywalls.
|
|
346
346
|
- `preloadPaywalls: (placements: string[]) => Promise<void>`: Preloads paywalls for the specified placement IDs.
|
package/build/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NativeModule } from "expo";
|
|
2
|
+
import type { PresentationResult } from "./compat/lib/PresentationResult";
|
|
2
3
|
import type { EntitlementsInfo, IntegrationAttributes, SuperwallExpoModuleEvents } from "./SuperwallExpoModule.types";
|
|
3
4
|
export type SubscriptionStatus = any;
|
|
4
5
|
declare class SuperwallExpoModule extends NativeModule<SuperwallExpoModuleEvents> {
|
|
@@ -27,7 +28,7 @@ declare class SuperwallExpoModule extends NativeModule<SuperwallExpoModuleEvents
|
|
|
27
28
|
didHandleCustomCallback(callbackId: string, status: string, data?: Record<string, any>): Promise<void>;
|
|
28
29
|
dismiss(): Promise<void>;
|
|
29
30
|
confirmAllAssignments(): Promise<any[]>;
|
|
30
|
-
getPresentationResult(placement: string, params?: Map<string, any> | Record<string, any>): Promise<
|
|
31
|
+
getPresentationResult(placement: string, params?: Map<string, any> | Record<string, any>): Promise<PresentationResult>;
|
|
31
32
|
getDeviceAttributes(): Promise<Record<string, any>>;
|
|
32
33
|
preloadPaywalls(placementNames: string[]): void;
|
|
33
34
|
preloadAllPaywalls(): void;
|
|
@@ -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,EACV,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,6BAA6B,CAAA;AAEpC,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,IAAI,GACxB,OAAO,CAAC,IA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CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC9C,OAAO,CAAC,kBAAkB,CAAC;IAE9B,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;IAEhC,wBAAwB,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1E,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5D;;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;
|
|
1
|
+
{"version":3,"file":"SuperwallExpoModule.js","sourceRoot":"","sources":["../../src/SuperwallExpoModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAA;AA6ExD,eAAe,mBAAmB,CAAsB,eAAe,CAAC,CAAA","sourcesContent":["import { NativeModule, requireNativeModule } from \"expo\"\nimport type { PresentationResult } from \"./compat/lib/PresentationResult\"\nimport type {\n EntitlementsInfo,\n IntegrationAttributes,\n SuperwallExpoModuleEvents,\n} 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<EntitlementsInfo>\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 | null>): 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 didHandleBackPressed(shouldConsume: boolean): void\n didHandleCustomCallback(\n callbackId: string,\n status: string,\n data?: Record<string, any>,\n ): Promise<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<PresentationResult>\n\n getDeviceAttributes(): Promise<Record<string, any>>\n\n preloadPaywalls(placementNames: string[]): void\n preloadAllPaywalls(): void\n\n setLogLevel(level: string): void\n\n setIntegrationAttributes(attributes: IntegrationAttributes): Promise<void>\n getIntegrationAttributes(): Promise<Record<string, string>>\n}\n\nexport default requireNativeModule<SuperwallExpoModule>(\"SuperwallExpo\")\n"]}
|
|
@@ -12,6 +12,7 @@ import { SubscriptionStatus } from "./lib/SubscriptionStatus";
|
|
|
12
12
|
import type { SuperwallDelegate } from "./lib/SuperwallDelegate";
|
|
13
13
|
import { type PartialSuperwallOptions } from "./lib/SuperwallOptions";
|
|
14
14
|
export { PaywallResult } from "./lib/PaywallResult";
|
|
15
|
+
export { PresentationResult, PresentationResultHoldout, PresentationResultNoAudienceMatch, PresentationResultPaywall, PresentationResultPaywallNotAvailable, PresentationResultPlacementNotFound, PresentationResultUserIsSubscribed, } from "./lib/PresentationResult";
|
|
15
16
|
export { ComputedPropertyRequest } from "./lib/ComputedPropertyRequest";
|
|
16
17
|
export { ConfigurationStatus } from "./lib/ConfigurationStatus";
|
|
17
18
|
export { EntitlementsInfo } from "./lib/EntitlementsInfo";
|
|
@@ -39,7 +40,7 @@ export { StoreTransaction } from "./lib/StoreTransaction";
|
|
|
39
40
|
export { SubscriptionStatus } from "./lib/SubscriptionStatus";
|
|
40
41
|
export { SuperwallDelegate } from "./lib/SuperwallDelegate";
|
|
41
42
|
export { EventType, SuperwallEventInfo } from "./lib/SuperwallEventInfo";
|
|
42
|
-
export { type PartialSuperwallOptions, SuperwallOptions, TestModeBehavior } from "./lib/SuperwallOptions";
|
|
43
|
+
export { type PartialSuperwallOptions, SuperwallOptions, TestModeBehavior, } from "./lib/SuperwallOptions";
|
|
43
44
|
export { Survey } from "./lib/Survey";
|
|
44
45
|
export { TriggerResult } from "./lib/TriggerResult";
|
|
45
46
|
interface UserAttributes {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","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;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAA;AAGlF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0B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SubscriptionStatus";
|
|
10
10
|
import { SuperwallEventInfo } from "./lib/SuperwallEventInfo";
|
|
11
11
|
import { SuperwallOptions } from "./lib/SuperwallOptions";
|
|
12
|
+
export { PresentationResult, PresentationResultHoldout, PresentationResultNoAudienceMatch, PresentationResultPaywall, PresentationResultPaywallNotAvailable, PresentationResultPlacementNotFound, PresentationResultUserIsSubscribed, } from "./lib/PresentationResult";
|
|
12
13
|
import { EventEmitter } from "expo";
|
|
13
14
|
import { version } from "../../package.json";
|
|
14
15
|
import SuperwallExpoModule from "../SuperwallExpoModule";
|
|
@@ -40,7 +41,7 @@ export { StoreTransaction } from "./lib/StoreTransaction";
|
|
|
40
41
|
export { SubscriptionStatus } from "./lib/SubscriptionStatus";
|
|
41
42
|
export { SuperwallDelegate } from "./lib/SuperwallDelegate";
|
|
42
43
|
export { EventType, SuperwallEventInfo } from "./lib/SuperwallEventInfo";
|
|
43
|
-
export { SuperwallOptions, TestModeBehavior } from "./lib/SuperwallOptions";
|
|
44
|
+
export { SuperwallOptions, TestModeBehavior, } from "./lib/SuperwallOptions";
|
|
44
45
|
export { Survey } from "./lib/Survey";
|
|
45
46
|
export { TriggerResult } from "./lib/TriggerResult";
|
|
46
47
|
export default class Superwall {
|
|
@@ -152,49 +153,49 @@ export default class Superwall {
|
|
|
152
153
|
});
|
|
153
154
|
// MARK: - SuperwallDelegate Listeners
|
|
154
155
|
SuperwallExpoModule.addListener("subscriptionStatusDidChange", async (data) => {
|
|
155
|
-
Superwall.delegate?.subscriptionStatusDidChange(data.from, data.to);
|
|
156
|
+
Superwall.delegate?.subscriptionStatusDidChange?.(data.from, data.to);
|
|
156
157
|
});
|
|
157
158
|
SuperwallExpoModule.addListener("handleSuperwallEvent", async (data) => {
|
|
158
159
|
const eventInfo = SuperwallEventInfo.fromJson(data.eventInfo);
|
|
159
|
-
Superwall.delegate?.handleSuperwallEvent(eventInfo);
|
|
160
|
+
Superwall.delegate?.handleSuperwallEvent?.(eventInfo);
|
|
160
161
|
});
|
|
161
162
|
SuperwallExpoModule.addListener("handleCustomPaywallAction", async (data) => {
|
|
162
163
|
const name = data.name;
|
|
163
|
-
Superwall.delegate?.handleCustomPaywallAction(name);
|
|
164
|
+
Superwall.delegate?.handleCustomPaywallAction?.(name);
|
|
164
165
|
});
|
|
165
166
|
SuperwallExpoModule.addListener("willDismissPaywall", async (data) => {
|
|
166
167
|
const info = PaywallInfo.fromJson(data.info);
|
|
167
|
-
Superwall.delegate?.willDismissPaywall(info);
|
|
168
|
+
Superwall.delegate?.willDismissPaywall?.(info);
|
|
168
169
|
});
|
|
169
170
|
SuperwallExpoModule.addListener("willPresentPaywall", async (data) => {
|
|
170
171
|
const info = PaywallInfo.fromJson(data.info);
|
|
171
|
-
Superwall.delegate?.willPresentPaywall(info);
|
|
172
|
+
Superwall.delegate?.willPresentPaywall?.(info);
|
|
172
173
|
});
|
|
173
174
|
SuperwallExpoModule.addListener("didDismissPaywall", async (data) => {
|
|
174
175
|
const info = PaywallInfo.fromJson(data.info);
|
|
175
|
-
Superwall.delegate?.didDismissPaywall(info);
|
|
176
|
+
Superwall.delegate?.didDismissPaywall?.(info);
|
|
176
177
|
});
|
|
177
178
|
SuperwallExpoModule.addListener("didPresentPaywall", async (data) => {
|
|
178
179
|
const info = PaywallInfo.fromJson(data.info);
|
|
179
|
-
Superwall.delegate?.didPresentPaywall(info);
|
|
180
|
+
Superwall.delegate?.didPresentPaywall?.(info);
|
|
180
181
|
});
|
|
181
182
|
SuperwallExpoModule.addListener("handleLog", async (data) => {
|
|
182
|
-
Superwall.delegate?.handleLog(data.level, data.scope, data.message || undefined, data.info, data.error);
|
|
183
|
+
Superwall.delegate?.handleLog?.(data.level, data.scope, data.message || undefined, data.info, data.error);
|
|
183
184
|
});
|
|
184
185
|
SuperwallExpoModule.addListener("paywallWillOpenDeepLink", async (data) => {
|
|
185
186
|
const url = new URL(data.url);
|
|
186
|
-
Superwall.delegate?.paywallWillOpenDeepLink(url);
|
|
187
|
+
Superwall.delegate?.paywallWillOpenDeepLink?.(url);
|
|
187
188
|
});
|
|
188
189
|
SuperwallExpoModule.addListener("paywallWillOpenURL", async (data) => {
|
|
189
190
|
const url = new URL(data.url);
|
|
190
|
-
Superwall.delegate?.paywallWillOpenURL(url);
|
|
191
|
+
Superwall.delegate?.paywallWillOpenURL?.(url);
|
|
191
192
|
});
|
|
192
193
|
SuperwallExpoModule.addListener("willRedeemLink", async () => {
|
|
193
|
-
Superwall.delegate?.willRedeemLink();
|
|
194
|
+
Superwall.delegate?.willRedeemLink?.();
|
|
194
195
|
});
|
|
195
196
|
SuperwallExpoModule.addListener("didRedeemLink", async (data) => {
|
|
196
197
|
const result = RedemptionResults.fromJson(data);
|
|
197
|
-
Superwall.delegate?.didRedeemLink(result);
|
|
198
|
+
Superwall.delegate?.didRedeemLink?.(result);
|
|
198
199
|
});
|
|
199
200
|
SuperwallExpoModule.addListener("subscriptionStatusDidChange", async (data) => {
|
|
200
201
|
this.subscriptionStatusEmitter.emit("change", data.to);
|
|
@@ -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;AAIvD,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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mBAAmB,CAAC,wBAAwB,EAAE,CAAA;IACvD,CAAC","sourcesContent":["import { Assignment } from \"./lib/Assigments\"\nimport { ConfigurationStatus } from \"./lib/ConfigurationStatus\"\nimport { EntitlementsInfo } from \"./lib/EntitlementsInfo\"\nimport { IdentityOptions } from \"./lib/IdentityOptions\"\nimport type { IntegrationAttributes } from \"./lib/IntegrationAttributes\"\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 PartialSuperwallOptions, SuperwallOptions } from \"./lib/SuperwallOptions\"\n\nexport { PaywallResult } from \"./lib/PaywallResult\"\n\nimport { EventEmitter } from \"expo\"\nimport { version } from \"../../package.json\"\nimport SuperwallExpoModule from \"../SuperwallExpoModule\"\nimport { filterUndefined } from \"../utils/filterUndefined\"\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 { StoreProduct } from \"./lib/StoreProduct\"\nexport { StoreTransaction } from \"./lib/StoreTransaction\"\nexport { SubscriptionStatus } from \"./lib/SubscriptionStatus\"\nexport { SuperwallDelegate } from \"./lib/SuperwallDelegate\"\nexport { EventType, SuperwallEventInfo } from \"./lib/SuperwallEventInfo\"\nexport { type PartialSuperwallOptions, SuperwallOptions, TestModeBehavior } from \"./lib/SuperwallOptions\"\nexport { Survey } from \"./lib/Survey\"\nexport { TriggerResult } from \"./lib/TriggerResult\"\n\ninterface UserAttributes {\n [key: string]: any | null\n}\n\nexport default class Superwall {\n static purchaseController?: PurchaseController\n private static delegate?: SuperwallDelegate\n private static onBackPressedCallback?: (paywallInfo: PaywallInfo) => boolean\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 SuperwallExpoModule.addListener(\"onCustomCallback\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n // Only respond if this handlerId belongs to the compat layer.\n // If not, another listener (e.g. hooks SDK) will handle it.\n if (!handler) return\n\n if (!handler.onCustomCallbackHandler) {\n SuperwallExpoModule.didHandleCustomCallback(data.callbackId, \"failure\", undefined)\n return\n }\n\n Promise.resolve(handler.onCustomCallbackHandler({ name: data.name, variables: data.variables })).then(\n (result) => {\n SuperwallExpoModule.didHandleCustomCallback(data.callbackId, result.status, result.data)\n },\n () => {\n SuperwallExpoModule.didHandleCustomCallback(data.callbackId, \"failure\", undefined)\n },\n )\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 SuperwallExpoModule.addListener(\"onBackPressed\", ({ paywallInfo }) => {\n const info = PaywallInfo.fromJson(paywallInfo)\n const shouldConsume = Superwall.onBackPressedCallback?.(info) ?? false\n SuperwallExpoModule.didHandleBackPressed(shouldConsume)\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 {PartialSuperwallOptions} [config.options] - An optional partial configuration object which allows you to customize\n * the appearance and behavior of the paywall. You can provide only the options you want to override from the defaults.\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?: PartialSuperwallOptions\n purchaseController?: PurchaseController\n completion?: () => void\n }): Promise<Superwall> {\n Superwall.purchaseController = purchaseController\n\n // Ensure options is always a SuperwallOptions instance with defaults\n const superwallOptions =\n options instanceof SuperwallOptions ? options : new SuperwallOptions(options)\n\n // Store the onBackPressed callback if provided\n if (superwallOptions.paywalls.onBackPressed) {\n Superwall.onBackPressedCallback = superwallOptions.paywalls.onBackPressed\n }\n\n await SuperwallExpoModule.configure(\n apiKey,\n superwallOptions.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(filterUndefined(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 /**\n * Sets attributes for third-party integrations.\n * @param attributes - Object mapping IntegrationAttribute string values to their IDs\n */\n async setIntegrationAttributes(attributes: IntegrationAttributes): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.setIntegrationAttributes(attributes)\n }\n\n /**\n * Gets the currently set integration attributes.\n * @returns Object mapping IntegrationAttribute string values to their IDs\n */\n async getIntegrationAttributes(): Promise<Record<string, string>> {\n await this.awaitConfig()\n return SuperwallExpoModule.getIntegrationAttributes()\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;AAIvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,C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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;IAED;;;OAGG;IACH,KAAK,CAAC,wBAAwB,CAAC,UAAiC;QAC9D,MAAM,IAAI,CAAC,WAAW,EAAE,CAAA;QACxB,MAAM,mBAAmB,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAA;IAChE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,wBAAwB;QAC5B,MAAM,IAAI,CAAC,WAAW,EAAE,CAAA;QACxB,OAAO,mBAAmB,CAAC,wBAAwB,EAAE,CAAA;IACvD,CAAC","sourcesContent":["import { Assignment } from \"./lib/Assigments\"\nimport { ConfigurationStatus } from \"./lib/ConfigurationStatus\"\nimport { EntitlementsInfo } from \"./lib/EntitlementsInfo\"\nimport { IdentityOptions } from \"./lib/IdentityOptions\"\nimport type { IntegrationAttributes } from \"./lib/IntegrationAttributes\"\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 PartialSuperwallOptions, SuperwallOptions } from \"./lib/SuperwallOptions\"\n\nexport { PaywallResult } from \"./lib/PaywallResult\"\nexport {\n PresentationResult,\n PresentationResultHoldout,\n PresentationResultNoAudienceMatch,\n PresentationResultPaywall,\n PresentationResultPaywallNotAvailable,\n PresentationResultPlacementNotFound,\n PresentationResultUserIsSubscribed,\n} from \"./lib/PresentationResult\"\n\nimport { EventEmitter } from \"expo\"\nimport { version } from \"../../package.json\"\nimport SuperwallExpoModule from \"../SuperwallExpoModule\"\nimport { filterUndefined } from \"../utils/filterUndefined\"\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 { StoreProduct } from \"./lib/StoreProduct\"\nexport { StoreTransaction } from \"./lib/StoreTransaction\"\nexport { SubscriptionStatus } from \"./lib/SubscriptionStatus\"\nexport { SuperwallDelegate } from \"./lib/SuperwallDelegate\"\nexport { EventType, SuperwallEventInfo } from \"./lib/SuperwallEventInfo\"\nexport {\n type PartialSuperwallOptions,\n SuperwallOptions,\n TestModeBehavior,\n} from \"./lib/SuperwallOptions\"\nexport { Survey } from \"./lib/Survey\"\nexport { TriggerResult } from \"./lib/TriggerResult\"\n\ninterface UserAttributes {\n [key: string]: any | null\n}\n\nexport default class Superwall {\n static purchaseController?: PurchaseController\n private static delegate?: SuperwallDelegate\n private static onBackPressedCallback?: (paywallInfo: PaywallInfo) => boolean\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 SuperwallExpoModule.addListener(\"onCustomCallback\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n // Only respond if this handlerId belongs to the compat layer.\n // If not, another listener (e.g. hooks SDK) will handle it.\n if (!handler) return\n\n if (!handler.onCustomCallbackHandler) {\n SuperwallExpoModule.didHandleCustomCallback(data.callbackId, \"failure\", undefined)\n return\n }\n\n Promise.resolve(\n handler.onCustomCallbackHandler({ name: data.name, variables: data.variables }),\n ).then(\n (result) => {\n SuperwallExpoModule.didHandleCustomCallback(data.callbackId, result.status, result.data)\n },\n () => {\n SuperwallExpoModule.didHandleCustomCallback(data.callbackId, \"failure\", undefined)\n },\n )\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 SuperwallExpoModule.addListener(\"onBackPressed\", ({ paywallInfo }) => {\n const info = PaywallInfo.fromJson(paywallInfo)\n const shouldConsume = Superwall.onBackPressedCallback?.(info) ?? false\n SuperwallExpoModule.didHandleBackPressed(shouldConsume)\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 {PartialSuperwallOptions} [config.options] - An optional partial configuration object which allows you to customize\n * the appearance and behavior of the paywall. You can provide only the options you want to override from the defaults.\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?: PartialSuperwallOptions\n purchaseController?: PurchaseController\n completion?: () => void\n }): Promise<Superwall> {\n Superwall.purchaseController = purchaseController\n\n // Ensure options is always a SuperwallOptions instance with defaults\n const superwallOptions =\n options instanceof SuperwallOptions ? options : new SuperwallOptions(options)\n\n // Store the onBackPressed callback if provided\n if (superwallOptions.paywalls.onBackPressed) {\n Superwall.onBackPressedCallback = superwallOptions.paywalls.onBackPressed\n }\n\n await SuperwallExpoModule.configure(\n apiKey,\n superwallOptions.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(filterUndefined(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 /**\n * Sets attributes for third-party integrations.\n * @param attributes - Object mapping IntegrationAttribute string values to their IDs\n */\n async setIntegrationAttributes(attributes: IntegrationAttributes): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.setIntegrationAttributes(attributes)\n }\n\n /**\n * Gets the currently set integration attributes.\n * @returns Object mapping IntegrationAttribute string values to their IDs\n */\n async getIntegrationAttributes(): Promise<Record<string, string>> {\n await this.awaitConfig()\n return SuperwallExpoModule.getIntegrationAttributes()\n }\n}\n"]}
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./CustomPurchaseControllerProvider";
|
|
2
|
-
export
|
|
2
|
+
export { PresentationResult, PresentationResultHoldout, PresentationResultNoAudienceMatch, PresentationResultPaywall, PresentationResultPaywallNotAvailable, PresentationResultPlacementNotFound, PresentationResultUserIsSubscribed, } from "./compat/lib/PresentationResult";
|
|
3
3
|
export * from "./components";
|
|
4
4
|
export { default as SuperwallExpoModule } from "./SuperwallExpoModule";
|
|
5
5
|
export type * from "./SuperwallExpoModule.types";
|
package/build/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,iCAAiC,EACjC,yBAAyB,EACzB,qCAAqC,EACrC,mCAAmC,EACnC,kCAAkC,GACnC,MAAM,iCAAiC,CAAA;AACxC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AACtE,mBAAmB,6BAA6B,CAAA;AAChD,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAE5D,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA"}
|
package/build/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./CustomPurchaseControllerProvider";
|
|
2
|
-
export
|
|
2
|
+
export { PresentationResult, PresentationResultHoldout, PresentationResultNoAudienceMatch, PresentationResultPaywall, PresentationResultPaywallNotAvailable, PresentationResultPlacementNotFound, PresentationResultUserIsSubscribed, } from "./compat/lib/PresentationResult";
|
|
3
3
|
export * from "./components";
|
|
4
4
|
export { default as SuperwallExpoModule } from "./SuperwallExpoModule";
|
|
5
5
|
export { DefaultSuperwallOptions } from "./SuperwallOptions";
|
package/build/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,iCAAiC,EACjC,yBAAyB,EACzB,qCAAqC,EACrC,mCAAmC,EACnC,kCAAkC,GACnC,MAAM,iCAAiC,CAAA;AACxC,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAYtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAE5D,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA","sourcesContent":["export * from \"./CustomPurchaseControllerProvider\"\nexport {\n PresentationResult,\n PresentationResultHoldout,\n PresentationResultNoAudienceMatch,\n PresentationResultPaywall,\n PresentationResultPaywallNotAvailable,\n PresentationResultPlacementNotFound,\n PresentationResultUserIsSubscribed,\n} from \"./compat/lib/PresentationResult\"\nexport * from \"./components\"\nexport { default as SuperwallExpoModule } from \"./SuperwallExpoModule\"\nexport type * from \"./SuperwallExpoModule.types\"\nexport type {\n LoggingOptions,\n NetworkEnvironment,\n PartialSuperwallOptions,\n PaywallOptions,\n RestoreFailed,\n SuperwallOptions,\n TestModeBehavior,\n TransactionBackgroundView,\n} from \"./SuperwallOptions\"\nexport { DefaultSuperwallOptions } from \"./SuperwallOptions\"\n\nexport * from \"./SuperwallProvider\"\nexport * from \"./usePlacement\"\nexport * from \"./useSuperwall\"\nexport * from \"./useSuperwallEvents\"\nexport * from \"./useUser\"\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PresentationResult } from "./compat/lib/PresentationResult";
|
|
1
2
|
import type { EntitlementsInfo, IntegrationAttributes, SubscriptionStatus } from "./SuperwallExpoModule.types";
|
|
2
3
|
import { type PartialSuperwallOptions } from "./SuperwallOptions";
|
|
3
4
|
/**
|
|
@@ -95,7 +96,7 @@ export interface SuperwallStore {
|
|
|
95
96
|
* @param params - Optional parameters for the placement.
|
|
96
97
|
* @returns A promise that resolves with the presentation result.
|
|
97
98
|
*/
|
|
98
|
-
getPresentationResult: (placement: string, params?: Record<string, any>) => Promise<
|
|
99
|
+
getPresentationResult: (placement: string, params?: Record<string, any>) => Promise<PresentationResult>;
|
|
99
100
|
/**
|
|
100
101
|
* Dismisses any currently presented Superwall paywall.
|
|
101
102
|
* @returns A promise that resolves when the dismissal is complete.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSuperwall.d.ts","sourceRoot":"","sources":["../../src/useSuperwall.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSuperwall.d.ts","sourceRoot":"","sources":["../../src/useSuperwall.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEzE,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAA2B,KAAK,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAG1F;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAA;IACjB,0GAA0G;IAC1G,sBAAsB,EAAE,MAAM,CAAA;IAC9B,qGAAqG;IACrG,IAAI,EAAE,MAAM,CAAA;IACZ,qFAAqF;IACrF,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAAA;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAE7B,4EAA4E;IAC5E,YAAY,EAAE,OAAO,CAAA;IACrB,gHAAgH;IAChH,SAAS,EAAE,OAAO,CAAA;IAClB,0EAA0E;IAC1E,oBAAoB,EAAE,OAAO,CAAA;IAE7B;;;OAGG;IACH,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IAEjC;;;;OAIG;IACH,IAAI,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IAE5B,mDAAmD;IACnD,kBAAkB,EAAE,kBAAkB,CAAA;IAOtC;;;;;;;OAOG;IACH,SAAS,EAAE,CACT,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,uBAAuB,GAAG;QAClC,uDAAuD;QACvD,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;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 {\n EntitlementsInfo,\n IntegrationAttributes,\n SubscriptionStatus,\n} from \"./SuperwallExpoModule.types\"\nimport { DefaultSuperwallOptions, type PartialSuperwallOptions } from \"./SuperwallOptions\"\nimport { filterUndefined } from \"./utils/filterUndefined\"\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 | null\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 * Contains error message if SDK configuration failed, `null` otherwise.\n * When this is set, the SDK is not configured and app should show error UI.\n */\n configurationError: string | null\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?: PartialSuperwallOptions & {\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 | null>) => 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 /**\n * Sets attributes for third-party integrations.\n * @param attributes - Object mapping IntegrationAttribute string values to their IDs\n * @returns A promise that resolves when attributes are set\n */\n setIntegrationAttributes: (attributes: IntegrationAttributes) => Promise<void>\n\n /**\n * Gets the currently set integration attributes.\n * @returns A promise that resolves with the current integration attributes\n */\n getIntegrationAttributes: () => Promise<Record<string, string>>\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 * Retrieves the user's entitlements from Superwall's servers.\n * This includes both active and inactive entitlements.\n * @returns A promise that resolves with the entitlements information.\n */\n getEntitlements: () => Promise<EntitlementsInfo>\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 configurationError: null,\n\n user: null,\n subscriptionStatus: {\n status: \"UNKNOWN\",\n },\n\n /* -------------------- Actions -------------------- */\n configure: async (apiKey, options) => {\n set({ isLoading: true, configurationError: null })\n\n try {\n const { manualPurchaseManagement, manualPurchaseManagment, ...restOptions } = options || {}\n\n // Support both spellings for backward compatibility\n const isManualPurchaseManagement =\n manualPurchaseManagement ?? manualPurchaseManagment ?? false\n\n // Deep merge partial options with defaults to ensure all required fields are present\n const mergedOptions = {\n ...DefaultSuperwallOptions,\n ...restOptions,\n paywalls: {\n ...DefaultSuperwallOptions.paywalls,\n ...restOptions.paywalls,\n restoreFailed: {\n ...DefaultSuperwallOptions.paywalls.restoreFailed,\n ...restOptions.paywalls?.restoreFailed,\n },\n },\n logging: {\n ...DefaultSuperwallOptions.logging,\n ...restOptions.logging,\n },\n }\n\n await SuperwallExpoModule.configure(\n apiKey,\n mergedOptions,\n isManualPurchaseManagement,\n pkg.version,\n )\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({\n isConfigured: true,\n isLoading: false,\n configurationError: null,\n user: currentUser as UserAttributes,\n subscriptionStatus,\n })\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n set({\n isLoading: false,\n configurationError: errorMessage,\n })\n // Don't throw - let developers handle via state or callback\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(filterUndefined(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 setIntegrationAttributes: async (attributes) => {\n await SuperwallExpoModule.setIntegrationAttributes(attributes)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n set({ user: currentUser as UserAttributes })\n },\n\n getIntegrationAttributes: async () => {\n return SuperwallExpoModule.getIntegrationAttributes()\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 getEntitlements: async () => {\n const entitlements = await SuperwallExpoModule.getEntitlements()\n return entitlements as EntitlementsInfo\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(\"[Superwall] 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 // Listen for configuration events\n subscriptions.push(\n SuperwallExpoModule.addListener(\"handleSuperwallEvent\", ({ eventInfo }) => {\n if (eventInfo.event.event === \"configFail\") {\n set({\n configurationError: \"Failed to load Superwall configuration\",\n isLoading: false,\n })\n } else if (eventInfo.event.event === \"configRefresh\") {\n // Clear any previous errors on successful refresh\n set({ configurationError: null })\n }\n }),\n )\n\n set({ listenersInitialized: true })\n console.log(\"[Superwall] Initialized listeners\", subscriptions.length)\n\n return (): void => {\n console.log(\"[Superwall] Cleaning up listeners\", subscriptions.length)\n // biome-ignore lint/suspicious/useIterableCallbackReturn: forEach is used for side effects only\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;AAEjC,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AAMvD,OAAO,EAAE,uBAAuB,EAAgC,MAAM,oBAAoB,CAAA;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAgMzD;;;;;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;IAC3B,kBAAkB,EAAE,IAAI;IAExB,IAAI,EAAE,IAAI;IACV,kBAAkB,EAAE;QAClB,MAAM,EAAE,SAAS;KAClB;IAED,uDAAuD;IACvD,SAAS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\nimport { useShallow } from \"zustand/shallow\"\nimport pkg from \"../package.json\"\nimport type { PresentationResult } from \"./compat/lib/PresentationResult\"\nimport SuperwallExpoModule from \"./SuperwallExpoModule\"\nimport type {\n EntitlementsInfo,\n IntegrationAttributes,\n SubscriptionStatus,\n} from \"./SuperwallExpoModule.types\"\nimport { DefaultSuperwallOptions, type PartialSuperwallOptions } from \"./SuperwallOptions\"\nimport { filterUndefined } from \"./utils/filterUndefined\"\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 | null\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 * Contains error message if SDK configuration failed, `null` otherwise.\n * When this is set, the SDK is not configured and app should show error UI.\n */\n configurationError: string | null\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?: PartialSuperwallOptions & {\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: (\n placement: string,\n params?: Record<string, any>,\n ) => Promise<PresentationResult>\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 | null>) => 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 /**\n * Sets attributes for third-party integrations.\n * @param attributes - Object mapping IntegrationAttribute string values to their IDs\n * @returns A promise that resolves when attributes are set\n */\n setIntegrationAttributes: (attributes: IntegrationAttributes) => Promise<void>\n\n /**\n * Gets the currently set integration attributes.\n * @returns A promise that resolves with the current integration attributes\n */\n getIntegrationAttributes: () => Promise<Record<string, string>>\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 * Retrieves the user's entitlements from Superwall's servers.\n * This includes both active and inactive entitlements.\n * @returns A promise that resolves with the entitlements information.\n */\n getEntitlements: () => Promise<EntitlementsInfo>\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 configurationError: null,\n\n user: null,\n subscriptionStatus: {\n status: \"UNKNOWN\",\n },\n\n /* -------------------- Actions -------------------- */\n configure: async (apiKey, options) => {\n set({ isLoading: true, configurationError: null })\n\n try {\n const { manualPurchaseManagement, manualPurchaseManagment, ...restOptions } = options || {}\n\n // Support both spellings for backward compatibility\n const isManualPurchaseManagement =\n manualPurchaseManagement ?? manualPurchaseManagment ?? false\n\n // Deep merge partial options with defaults to ensure all required fields are present\n const mergedOptions = {\n ...DefaultSuperwallOptions,\n ...restOptions,\n paywalls: {\n ...DefaultSuperwallOptions.paywalls,\n ...restOptions.paywalls,\n restoreFailed: {\n ...DefaultSuperwallOptions.paywalls.restoreFailed,\n ...restOptions.paywalls?.restoreFailed,\n },\n },\n logging: {\n ...DefaultSuperwallOptions.logging,\n ...restOptions.logging,\n },\n }\n\n await SuperwallExpoModule.configure(\n apiKey,\n mergedOptions,\n isManualPurchaseManagement,\n pkg.version,\n )\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({\n isConfigured: true,\n isLoading: false,\n configurationError: null,\n user: currentUser as UserAttributes,\n subscriptionStatus,\n })\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n set({\n isLoading: false,\n configurationError: errorMessage,\n })\n // Don't throw - let developers handle via state or callback\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(filterUndefined(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 setIntegrationAttributes: async (attributes) => {\n await SuperwallExpoModule.setIntegrationAttributes(attributes)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n set({ user: currentUser as UserAttributes })\n },\n\n getIntegrationAttributes: async () => {\n return SuperwallExpoModule.getIntegrationAttributes()\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 getEntitlements: async () => {\n const entitlements = await SuperwallExpoModule.getEntitlements()\n return entitlements as EntitlementsInfo\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(\"[Superwall] 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 // Listen for configuration events\n subscriptions.push(\n SuperwallExpoModule.addListener(\"handleSuperwallEvent\", ({ eventInfo }) => {\n if (eventInfo.event.event === \"configFail\") {\n set({\n configurationError: \"Failed to load Superwall configuration\",\n isLoading: false,\n })\n } else if (eventInfo.event.event === \"configRefresh\") {\n // Clear any previous errors on successful refresh\n set({ configurationError: null })\n }\n }),\n )\n\n set({ listenersInitialized: true })\n console.log(\"[Superwall] Initialized listeners\", subscriptions.length)\n\n return (): void => {\n console.log(\"[Superwall] Cleaning up listeners\", subscriptions.length)\n // biome-ignore lint/suspicious/useIterableCallbackReturn: forEach is used for side effects only\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"]}
|