expo-superwall 0.2.2 → 0.2.4
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 +12 -0
- package/build/package.json +1 -1
- package/build/src/SuperwallOptions.d.ts +81 -0
- package/build/src/SuperwallOptions.d.ts.map +1 -0
- package/build/src/SuperwallOptions.js +31 -0
- package/build/src/SuperwallOptions.js.map +1 -0
- package/build/src/SuperwallProvider.d.ts +5 -1
- package/build/src/SuperwallProvider.d.ts.map +1 -1
- package/build/src/SuperwallProvider.js +1 -1
- package/build/src/SuperwallProvider.js.map +1 -1
- package/build/src/compat/index.d.ts +1 -0
- package/build/src/compat/index.d.ts.map +1 -1
- package/build/src/compat/index.js +1 -0
- package/build/src/compat/index.js.map +1 -1
- package/build/src/useSuperwall.d.ts +4 -3
- package/build/src/useSuperwall.d.ts.map +1 -1
- package/build/src/useSuperwall.js +4 -2
- package/build/src/useSuperwall.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c274e6a: Add typed SuperwallOptions and fix mispelled option name
|
|
8
|
+
|
|
9
|
+
## 0.2.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- f9372f1: Exposes StoreTransaction in /compat
|
|
14
|
+
|
|
3
15
|
## 0.2.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/build/package.json
CHANGED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category Types
|
|
3
|
+
* @since 0.0.15
|
|
4
|
+
* Defines the log levels for the SDK.
|
|
5
|
+
*/
|
|
6
|
+
export type LogLevel = "debug" | "info" | "warn" | "error" | "none";
|
|
7
|
+
/**
|
|
8
|
+
* @category Types
|
|
9
|
+
* @since 0.0.15
|
|
10
|
+
* Defines the scopes for logging within the SDK.
|
|
11
|
+
*/
|
|
12
|
+
export type LogScope = "localizationManager" | "bounceButton" | "coreData" | "configManager" | "identityManager" | "debugManager" | "debugViewController" | "localizationViewController" | "gameControllerManager" | "device" | "network" | "paywallEvents" | "productsManager" | "storeKitManager" | "placements" | "receipts" | "superwallCore" | "paywallPresentation" | "paywallTransactions" | "paywallViewController" | "cache" | "all";
|
|
13
|
+
/**
|
|
14
|
+
* @category Types
|
|
15
|
+
* @since 0.0.15
|
|
16
|
+
* Defines the network environment for Superwall.
|
|
17
|
+
*/
|
|
18
|
+
export type NetworkEnvironment = "release" | "releaseCandidate" | "developer";
|
|
19
|
+
/**
|
|
20
|
+
* @category Types
|
|
21
|
+
* @since 0.0.15
|
|
22
|
+
* Defines the different types of views that can appear behind Apple's payment sheet during a transaction.
|
|
23
|
+
*/
|
|
24
|
+
export type TransactionBackgroundView = "spinner" | "none";
|
|
25
|
+
/**
|
|
26
|
+
* @category Models
|
|
27
|
+
* @since 0.0.15
|
|
28
|
+
* Defines the messaging of the alert presented to the user when restoring a transaction fails.
|
|
29
|
+
*/
|
|
30
|
+
export interface RestoreFailed {
|
|
31
|
+
title: string;
|
|
32
|
+
message: string;
|
|
33
|
+
closeButtonTitle: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @category Models
|
|
37
|
+
* @since 0.0.15
|
|
38
|
+
* Options for configuring logging behavior.
|
|
39
|
+
*/
|
|
40
|
+
export interface LoggingOptions {
|
|
41
|
+
level: LogLevel;
|
|
42
|
+
scopes: LogScope[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @category Models
|
|
46
|
+
* @since 0.0.15
|
|
47
|
+
* Options for configuring the appearance and behavior of paywalls.
|
|
48
|
+
*/
|
|
49
|
+
export interface PaywallOptions {
|
|
50
|
+
isHapticFeedbackEnabled: boolean;
|
|
51
|
+
restoreFailed: RestoreFailed;
|
|
52
|
+
shouldShowPurchaseFailureAlert: boolean;
|
|
53
|
+
shouldPreload: boolean;
|
|
54
|
+
automaticallyDismiss: boolean;
|
|
55
|
+
transactionBackgroundView: TransactionBackgroundView;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @category Models
|
|
59
|
+
* @since 0.0.15
|
|
60
|
+
* Options for configuring the Superwall SDK.
|
|
61
|
+
*/
|
|
62
|
+
export interface SuperwallOptions {
|
|
63
|
+
paywalls: PaywallOptions;
|
|
64
|
+
networkEnvironment: NetworkEnvironment;
|
|
65
|
+
isExternalDataCollectionEnabled: boolean;
|
|
66
|
+
localeIdentifier?: string;
|
|
67
|
+
isGameControllerEnabled: boolean;
|
|
68
|
+
logging: LoggingOptions;
|
|
69
|
+
collectAdServicesAttribution: boolean;
|
|
70
|
+
passIdentifiersToPlayStore: boolean;
|
|
71
|
+
storeKitVersion?: "STOREKIT1" | "STOREKIT2";
|
|
72
|
+
enableExperimentalDeviceVariables: boolean;
|
|
73
|
+
manualPurchaseManagement: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @category Models
|
|
77
|
+
* @since 0.0.15
|
|
78
|
+
* Default options for the Superwall SDK.
|
|
79
|
+
*/
|
|
80
|
+
export declare const DefaultSuperwallOptions: SuperwallOptions;
|
|
81
|
+
//# sourceMappingURL=SuperwallOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuperwallOptions.d.ts","sourceRoot":"","sources":["../../src/SuperwallOptions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAEnE;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAChB,qBAAqB,GACrB,cAAc,GACd,UAAU,GACV,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,qBAAqB,GACrB,4BAA4B,GAC5B,uBAAuB,GACv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AClC;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAwBrC,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category Models
|
|
3
|
+
* @since 0.0.15
|
|
4
|
+
* Default options for the Superwall SDK.
|
|
5
|
+
*/
|
|
6
|
+
export const DefaultSuperwallOptions = {
|
|
7
|
+
paywalls: {
|
|
8
|
+
isHapticFeedbackEnabled: true,
|
|
9
|
+
restoreFailed: {
|
|
10
|
+
title: "No Subscription Found",
|
|
11
|
+
message: "We couldn't find an active subscription for your account.",
|
|
12
|
+
closeButtonTitle: "Okay",
|
|
13
|
+
},
|
|
14
|
+
shouldShowPurchaseFailureAlert: true,
|
|
15
|
+
shouldPreload: false,
|
|
16
|
+
automaticallyDismiss: true,
|
|
17
|
+
transactionBackgroundView: "spinner",
|
|
18
|
+
},
|
|
19
|
+
networkEnvironment: "release",
|
|
20
|
+
isExternalDataCollectionEnabled: true,
|
|
21
|
+
isGameControllerEnabled: false,
|
|
22
|
+
logging: {
|
|
23
|
+
level: "info",
|
|
24
|
+
scopes: ["all"],
|
|
25
|
+
},
|
|
26
|
+
collectAdServicesAttribution: false,
|
|
27
|
+
passIdentifiersToPlayStore: false,
|
|
28
|
+
enableExperimentalDeviceVariables: false,
|
|
29
|
+
manualPurchaseManagement: false,
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=SuperwallOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuperwallOptions.js","sourceRoot":"","sources":["../../src/SuperwallOptions.ts"],"names":[],"mappings":"AAwGA;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAqB;IACvD,QAAQ,EAAE;QACR,uBAAuB,EAAE,IAAI;QAC7B,aAAa,EAAE;YACb,KAAK,EAAE,uBAAuB;YAC9B,OAAO,EAAE,2DAA2D;YACpE,gBAAgB,EAAE,MAAM;SACzB;QACD,8BAA8B,EAAE,IAAI;QACpC,aAAa,EAAE,KAAK;QACpB,oBAAoB,EAAE,IAAI;QAC1B,yBAAyB,EAAE,SAAS;KACrC;IACD,kBAAkB,EAAE,SAAS;IAC7B,+BAA+B,EAAE,IAAI;IACrC,uBAAuB,EAAE,KAAK;IAC9B,OAAO,EAAE;QACP,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,CAAC,KAAK,CAAC;KAChB;IACD,4BAA4B,EAAE,KAAK;IACnC,0BAA0B,EAAE,KAAK;IACjC,iCAAiC,EAAE,KAAK;IACxC,wBAAwB,EAAE,KAAK;CAChC,CAAA","sourcesContent":["/**\n * @category Types\n * @since 0.0.15\n * Defines the log levels for the SDK.\n */\nexport type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\" | \"none\"\n\n/**\n * @category Types\n * @since 0.0.15\n * Defines the scopes for logging within the SDK.\n */\nexport type LogScope = \n | \"localizationManager\"\n | \"bounceButton\"\n | \"coreData\"\n | \"configManager\"\n | \"identityManager\"\n | \"debugManager\"\n | \"debugViewController\"\n | \"localizationViewController\"\n | \"gameControllerManager\"\n | \"device\"\n | \"network\"\n | \"paywallEvents\"\n | \"productsManager\"\n | \"storeKitManager\"\n | \"placements\"\n | \"receipts\"\n | \"superwallCore\"\n | \"paywallPresentation\"\n | \"paywallTransactions\"\n | \"paywallViewController\"\n | \"cache\"\n | \"all\"\n\n/**\n * @category Types\n * @since 0.0.15\n * Defines the network environment for Superwall.\n */\nexport type NetworkEnvironment = \"release\" | \"releaseCandidate\" | \"developer\"\n\n/**\n * @category Types\n * @since 0.0.15\n * Defines the different types of views that can appear behind Apple's payment sheet during a transaction.\n */\nexport type TransactionBackgroundView = \"spinner\" | \"none\"\n\n/**\n * @category Models\n * @since 0.0.15\n * Defines the messaging of the alert presented to the user when restoring a transaction fails.\n */\nexport interface RestoreFailed {\n title: string\n message: string\n closeButtonTitle: string\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Options for configuring logging behavior.\n */\nexport interface LoggingOptions {\n level: LogLevel\n scopes: LogScope[]\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Options for configuring the appearance and behavior of paywalls.\n */\nexport interface PaywallOptions {\n isHapticFeedbackEnabled: boolean\n restoreFailed: RestoreFailed\n shouldShowPurchaseFailureAlert: boolean\n shouldPreload: boolean\n automaticallyDismiss: boolean\n transactionBackgroundView: TransactionBackgroundView\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Options for configuring the Superwall SDK.\n */\nexport interface SuperwallOptions {\n paywalls: PaywallOptions\n networkEnvironment: NetworkEnvironment\n isExternalDataCollectionEnabled: boolean\n localeIdentifier?: string\n isGameControllerEnabled: boolean\n logging: LoggingOptions\n collectAdServicesAttribution: boolean\n passIdentifiersToPlayStore: boolean\n storeKitVersion?: \"STOREKIT1\" | \"STOREKIT2\"\n enableExperimentalDeviceVariables: boolean\n manualPurchaseManagement: boolean\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Default options for the Superwall SDK.\n */\nexport const DefaultSuperwallOptions: SuperwallOptions = {\n paywalls: {\n isHapticFeedbackEnabled: true,\n restoreFailed: {\n title: \"No Subscription Found\",\n message: \"We couldn't find an active subscription for your account.\",\n closeButtonTitle: \"Okay\",\n },\n shouldShowPurchaseFailureAlert: true,\n shouldPreload: false,\n automaticallyDismiss: true,\n transactionBackgroundView: \"spinner\",\n },\n networkEnvironment: \"release\",\n isExternalDataCollectionEnabled: true,\n isGameControllerEnabled: false,\n logging: {\n level: \"info\",\n scopes: [\"all\"],\n },\n collectAdServicesAttribution: false,\n passIdentifiersToPlayStore: false,\n enableExperimentalDeviceVariables: false,\n manualPurchaseManagement: false,\n}"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
import type { SuperwallOptions } from "./SuperwallOptions";
|
|
2
3
|
interface SuperwallProviderProps {
|
|
3
4
|
/** Your Superwall API key */
|
|
4
5
|
apiKeys: {
|
|
@@ -6,7 +7,10 @@ interface SuperwallProviderProps {
|
|
|
6
7
|
ios?: string;
|
|
7
8
|
};
|
|
8
9
|
/** Optional configuration options passed to the native SDK */
|
|
9
|
-
options?:
|
|
10
|
+
options?: Partial<SuperwallOptions> & {
|
|
11
|
+
/** @deprecated Use manualPurchaseManagement instead */
|
|
12
|
+
manualPurchaseManagment?: boolean;
|
|
13
|
+
};
|
|
10
14
|
/** App content to render once configured */
|
|
11
15
|
children: ReactNode;
|
|
12
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperwallProvider.d.ts","sourceRoot":"","sources":["../../src/SuperwallProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"SuperwallProvider.d.ts","sourceRoot":"","sources":["../../src/SuperwallProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAA;AAKzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG1D,UAAU,sBAAsB;IAC9B,6BAA6B;IAC7B,OAAO,EAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,GAAG,CAAC,EAAE,MAAM,CAAA;KACb,CAAA;IACD,8DAA8D;IAC9D,OAAO,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG;QACpC,uDAAuD;QACvD,uBAAuB,CAAC,EAAE,OAAO,CAAA;KAClC,CAAA;IACD,4CAA4C;IAC5C,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,OAAO,EAEP,QAAQ,GACT,EAAE,sBAAsB,+BAyDxB"}
|
|
@@ -41,7 +41,7 @@ export function SuperwallProvider({ apiKeys, options, children, }) {
|
|
|
41
41
|
}
|
|
42
42
|
configure(apiKey, {
|
|
43
43
|
...options,
|
|
44
|
-
|
|
44
|
+
manualPurchaseManagement: isUsingCustomPurchaseController,
|
|
45
45
|
}).catch((err) => {
|
|
46
46
|
console.error("Superwall configure failed", err);
|
|
47
47
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperwallProvider.js","sourceRoot":"","sources":["../../src/SuperwallProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,EAA4B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"SuperwallProvider.js","sourceRoot":"","sources":["../../src/SuperwallProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,EAA4B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAiBpE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,OAAO,EACP,OAAO,EAEP,QAAQ,GACe;IACvB,MAAM,uBAAuB,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAA;IACjE,MAAM,+BAA+B,GAAG,CAAC,CAAC,2BAA2B,EAAE,CAAA;IAEvE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,iBAAiB,CAC9D,UAAU,CAAC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EF,uBAAuB,CAAC,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBAC1E,mBAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC/C,CAAC,CAAC,CAAA;QACJ,CAAC,CAAA;QAED,cAAc,EAAE,CAAA;QAEhB,OAAO,GAAG,EAAE;YACV,IAAI,uBAAuB,CAAC,OAAO,EAAE,CAAC;gBACpC,uBAAuB,CAAC,OAAO,CAAC,MAAM,EAAE,CAAA;YAC1C,CAAC;QACH,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAA;AACvF,CAAC","sourcesContent":["import { type ReactNode, useEffect, useRef } from \"react\"\nimport { type EmitterSubscription, Linking, Platform } from \"react-native\"\nimport { useShallow } from \"zustand/shallow\"\nimport { useCustomPurchaseController } from \"./CustomPurchaseControllerProvider\"\nimport SuperwallExpoModule from \"./SuperwallExpoModule\"\nimport type { SuperwallOptions } from \"./SuperwallOptions\"\nimport { SuperwallContext, useSuperwallStore } from \"./useSuperwall\"\n\ninterface SuperwallProviderProps {\n /** Your Superwall API key */\n apiKeys: {\n android?: string\n ios?: string\n }\n /** Optional configuration options passed to the native SDK */\n options?: Partial<SuperwallOptions> & {\n /** @deprecated Use manualPurchaseManagement instead */\n manualPurchaseManagment?: boolean\n }\n /** App content to render once configured */\n children: ReactNode\n}\n\n/**\n * @category Providers\n * @since 0.0.15\n * Main provider component for the Superwall SDK.\n *\n * This component initializes the Superwall SDK with your API key and configuration options.\n * It should wrap the root of your application or the part of your app that requires Superwall functionality.\n * It also sets up necessary event listeners for the SDK.\n *\n * @param props - The properties for the SuperwallProvider.\n * @param props.apiKeys - An object containing your Superwall API keys for Android and iOS.\n * @param props.options - Optional configuration options to pass to the native Superwall SDK.\n * @param props.children - The child components of your application that will have access to Superwall features.\n *\n * Example:\n * ```tsx\n * <SuperwallProvider apiKeys={{ ios: \"YOUR_IOS_API_KEY\", android: \"YOUR_ANDROID_API_KEY\" }}>\n * <App />\n * </SuperwallProvider>\n * ```\n */\nexport function SuperwallProvider({\n apiKeys,\n options,\n\n children,\n}: SuperwallProviderProps) {\n const deepLinkEventHandlerRef = useRef<EmitterSubscription>(null)\n const isUsingCustomPurchaseController = !!useCustomPurchaseController()\n\n const { isConfigured, isLoading, configure } = useSuperwallStore(\n useShallow((state) => ({\n isConfigured: state.isConfigured,\n isLoading: state.isLoading,\n configure: state.configure,\n })),\n )\n\n useEffect(() => {\n if (!isConfigured && !isLoading) {\n const apiKey = apiKeys[Platform.OS as keyof typeof apiKeys]\n if (!apiKey) {\n throw new Error(`No API key provided for platform ${Platform.OS}`)\n }\n\n configure(apiKey, {\n ...options,\n manualPurchaseManagement: isUsingCustomPurchaseController,\n }).catch((err) => {\n console.error(\"Superwall configure failed\", err)\n })\n }\n }, [isConfigured, isUsingCustomPurchaseController, isLoading, apiKeys, options, configure])\n\n useEffect(() => {\n const cleanup = useSuperwallStore.getState()._initListeners()\n\n return cleanup\n }, [])\n\n useEffect(() => {\n const handleDeepLink = async () => {\n await Linking.getInitialURL().then((url) => {\n if (url) {\n SuperwallExpoModule.handleDeepLink(url)\n }\n })\n\n deepLinkEventHandlerRef.current = Linking.addEventListener(\"url\", (event) => {\n SuperwallExpoModule.handleDeepLink(event.url)\n })\n }\n\n handleDeepLink()\n\n return () => {\n if (deepLinkEventHandlerRef.current) {\n deepLinkEventHandlerRef.current.remove()\n }\n }\n }, [])\n\n return <SuperwallContext.Provider value={true}>{children}</SuperwallContext.Provider>\n}\n"]}
|
|
@@ -33,6 +33,7 @@ export { PurchaseResult, PurchaseResultCancelled, PurchaseResultFailed, Purchase
|
|
|
33
33
|
export * from "./lib/RedemptionResults";
|
|
34
34
|
export { RestorationResult } from "./lib/RestorationResult";
|
|
35
35
|
export { RestoreType } from "./lib/RestoreType";
|
|
36
|
+
export { StoreTransaction } from "./lib/StoreTransaction";
|
|
36
37
|
export { SubscriptionStatus } from "./lib/SubscriptionStatus";
|
|
37
38
|
export { SuperwallDelegate } from "./lib/SuperwallDelegate";
|
|
38
39
|
export { EventType, SuperwallEventInfo } from "./lib/SuperwallEventInfo";
|
|
@@ -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,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,0BAA0B,CAAA;AAElE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAMnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAA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CAAA;KAC1B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAS/B;;;;;;;;;;OAUG;IACG,sBAAsB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAK5D;;;;OAIG;IACG,eAAe,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAMlD;;;;;;;;;;OAUG;IACG,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhE,qBAAqB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAK1D;;;;;;;;;OASG;IACG,iBAAiB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE;;;;;;;OAOG;IACG,WAAW,CAAC,QAAQ,EAAE,iBAAiB,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzE;;;;OAIG;IACG,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC;IAMlD;;;;;;;;;OASG;IACG,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKzC;;;;;;;;;;;OAWG;IACG,eAAe,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,iBAAiB,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtE;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlD"}
|
|
@@ -33,6 +33,7 @@ export { PurchaseResult, PurchaseResultCancelled, PurchaseResultFailed, Purchase
|
|
|
33
33
|
export * from "./lib/RedemptionResults";
|
|
34
34
|
export { RestorationResult } from "./lib/RestorationResult";
|
|
35
35
|
export { RestoreType } from "./lib/RestoreType";
|
|
36
|
+
export { StoreTransaction } from "./lib/StoreTransaction";
|
|
36
37
|
export { SubscriptionStatus } from "./lib/SubscriptionStatus";
|
|
37
38
|
export { SuperwallDelegate } from "./lib/SuperwallDelegate";
|
|
38
39
|
export { EventType, SuperwallEventInfo } from "./lib/SuperwallEventInfo";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/compat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,QAAQ,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAK7D,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,mBAAmB,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAA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\nimport { ConfigurationStatus } from \"./lib/ConfigurationStatus\"\nimport { EntitlementsInfo } from \"./lib/EntitlementsInfo\"\nimport { IdentityOptions } from \"./lib/IdentityOptions\"\nimport type { InterfaceStyle } from \"./lib/InterfaceStyle\"\nimport type { LogLevel } from \"./lib/LogLevel\"\nimport { PaywallInfo } from \"./lib/PaywallInfo\"\nimport type { PaywallPresentationHandler } from \"./lib/PaywallPresentationHandler\"\nimport { fromJson as paywallResultFromJson } from \"./lib/PaywallResult\"\nimport { PaywallSkippedReason } from \"./lib/PaywallSkippedReason\"\nimport type { PresentationResult } from \"./lib/PresentationResult\"\nimport type { PurchaseController } from \"./lib/PurchaseController\"\nimport { RedemptionResults } from \"./lib/RedemptionResults\"\nimport { SubscriptionStatus } from \"./lib/SubscriptionStatus\"\nimport type { SuperwallDelegate } from \"./lib/SuperwallDelegate\"\nimport { SuperwallEventInfo } from \"./lib/SuperwallEventInfo\"\nimport type { SuperwallOptions } from \"./lib/SuperwallOptions\"\n\nexport { PaywallResult } from \"./lib/PaywallResult\"\n\nimport { EventEmitter } from \"expo\"\nimport { version } from \"../../package.json\"\nimport SuperwallExpoModule from \"../SuperwallExpoModule\"\n\nexport { ComputedPropertyRequest } from \"./lib/ComputedPropertyRequest\"\nexport { ConfigurationStatus } from \"./lib/ConfigurationStatus\"\nexport { EntitlementsInfo } from \"./lib/EntitlementsInfo\"\nexport { Experiment } from \"./lib/Experiment\"\nexport { FeatureGatingBehavior } from \"./lib/FeatureGatingBehavior\"\nexport { IdentityOptions } from \"./lib/IdentityOptions\"\nexport { InterfaceStyle } from \"./lib/InterfaceStyle\"\nexport { LocalNotification } from \"./lib/LocalNotification\"\nexport { LogLevel } from \"./lib/LogLevel\"\nexport { LogScope } from \"./lib/LogScope\"\nexport { PaywallCloseReason } from \"./lib/PaywallCloseReason\"\nexport { PaywallInfo } from \"./lib/PaywallInfo\"\nexport {\n PaywallOptions,\n TransactionBackgroundView,\n} from \"./lib/PaywallOptions\"\nexport { PaywallPresentationHandler } from \"./lib/PaywallPresentationHandler\"\nexport { PaywallPresentationRequestStatus } from \"./lib/PaywallPresentationRequestStatus\"\nexport {\n PaywallSkippedReason,\n PaywallSkippedReasonHoldout,\n PaywallSkippedReasonNoAudienceMatch,\n PaywallSkippedReasonPlacementNotFound,\n PaywallSkippedReasonUserIsSubscribed,\n} from \"./lib/PaywallSkippedReason\"\nexport { Product } from \"./lib/Product\"\nexport { PurchaseController } from \"./lib/PurchaseController\"\nexport {\n PurchaseResult,\n PurchaseResultCancelled,\n PurchaseResultFailed,\n PurchaseResultPending,\n PurchaseResultPurchased,\n PurchaseResultRestored,\n} from \"./lib/PurchaseResult\"\nexport * from \"./lib/RedemptionResults\"\nexport { RestorationResult } from \"./lib/RestorationResult\"\nexport { RestoreType } from \"./lib/RestoreType\"\nexport { SubscriptionStatus } from \"./lib/SubscriptionStatus\"\nexport { SuperwallDelegate } from \"./lib/SuperwallDelegate\"\nexport { EventType, SuperwallEventInfo } from \"./lib/SuperwallEventInfo\"\nexport { SuperwallOptions } from \"./lib/SuperwallOptions\"\nexport { Survey } from \"./lib/Survey\"\nexport { TriggerResult } from \"./lib/TriggerResult\"\n\ninterface UserAttributes {\n [key: string]: any\n}\n\nexport default class Superwall {\n static purchaseController?: PurchaseController\n private static delegate?: SuperwallDelegate\n private static _superwall = new Superwall()\n\n private static configEmitter = new EventEmitter<{\n configured: (isConfigured: boolean) => void\n }>()\n private static didConfigure = false\n private presentationHandlers: Map<string, PaywallPresentationHandler> = new Map()\n subscriptionStatusEmitter = new EventEmitter<{\n change: (status: SubscriptionStatus) => void\n }>()\n\n private static setDidConfigure(didConfigure: boolean) {\n Superwall.didConfigure = didConfigure\n // Emit an event when the bridged state is true\n if (didConfigure) {\n Superwall.configEmitter.emit(\"configured\", didConfigure)\n }\n }\n\n private async awaitConfig(): Promise<void> {\n if (Superwall.didConfigure) {\n return\n }\n\n await new Promise<void>((resolve) => {\n Superwall.configEmitter.addListener(\"configured\", () => {\n resolve()\n })\n })\n }\n\n private constructor() {\n SuperwallExpoModule.addListener(\"onPurchase\", async (data) => {\n if (data.platform === \"ios\") {\n const purchaseResult = await Superwall.purchaseController?.purchaseFromAppStore(\n data.productId,\n )\n if (purchaseResult == null) {\n return\n }\n await SuperwallExpoModule.didPurchase(purchaseResult.toJSON())\n return\n }\n\n if (data.platform === \"android\") {\n const purchaseResult = await Superwall.purchaseController?.purchaseFromGooglePlay(\n data.productId,\n data.basePlanId,\n data.offerId,\n )\n if (purchaseResult == null) {\n return\n }\n await SuperwallExpoModule.didPurchase(purchaseResult.toJSON())\n }\n })\n\n SuperwallExpoModule.addListener(\"onPurchaseRestore\", async () => {\n const restorationResult = await Superwall.purchaseController?.restorePurchases()\n if (restorationResult == null) {\n return\n }\n await SuperwallExpoModule.didRestore(restorationResult.toJson())\n })\n\n SuperwallExpoModule.addListener(\"onPaywallPresent\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n if (!handler || !handler.onPresentHandler) {\n return\n }\n\n const paywallInfo = PaywallInfo.fromJson(data.paywallInfoJson)\n handler.onPresentHandler(paywallInfo)\n })\n SuperwallExpoModule.addListener(\"onPaywallDismiss\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onDismissHandler) {\n return\n }\n\n const info = PaywallInfo.fromJson(data.paywallInfoJson)\n const result = paywallResultFromJson(data.result)\n handler.onDismissHandler(info, result)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallError\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onErrorHandler) {\n return\n }\n\n handler.onErrorHandler(data.errorString)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallSkip\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onSkipHandler) {\n return\n }\n\n const skippedReason = PaywallSkippedReason.fromJson(data.skippedReason)\n handler.onSkipHandler(skippedReason)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallPresent\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onPresentHandler) {\n return\n }\n\n const info = PaywallInfo.fromJson(data.paywallInfoJson)\n handler.onPresentHandler(info)\n })\n\n // MARK: - SuperwallDelegate Listeners\n SuperwallExpoModule.addListener(\"subscriptionStatusDidChange\", async (data) => {\n Superwall.delegate?.subscriptionStatusDidChange(data.from, data.to)\n })\n\n SuperwallExpoModule.addListener(\"handleSuperwallEvent\", async (data) => {\n const eventInfo = SuperwallEventInfo.fromJson(data.eventInfo)\n Superwall.delegate?.handleSuperwallEvent(eventInfo)\n })\n\n SuperwallExpoModule.addListener(\"handleCustomPaywallAction\", async (data) => {\n const name = data.name\n Superwall.delegate?.handleCustomPaywallAction(name)\n })\n\n SuperwallExpoModule.addListener(\"willDismissPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.willDismissPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"willPresentPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.willPresentPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"didDismissPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.didDismissPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"didPresentPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.didPresentPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"handleLog\", async (data) => {\n Superwall.delegate?.handleLog(\n data.level,\n data.scope,\n data.message || undefined,\n data.info,\n data.error,\n )\n })\n\n SuperwallExpoModule.addListener(\"paywallWillOpenDeepLink\", async (data) => {\n const url = new URL(data.url)\n Superwall.delegate?.paywallWillOpenDeepLink(url)\n })\n\n SuperwallExpoModule.addListener(\"paywallWillOpenURL\", async (data) => {\n const url = new URL(data.url)\n Superwall.delegate?.paywallWillOpenURL(url)\n })\n\n SuperwallExpoModule.addListener(\"willRedeemLink\", async () => {\n Superwall.delegate?.willRedeemLink()\n })\n\n SuperwallExpoModule.addListener(\"didRedeemLink\", async (data) => {\n const result = RedemptionResults.fromJson(data)\n Superwall.delegate?.didRedeemLink(result)\n })\n\n SuperwallExpoModule.addListener(\"subscriptionStatusDidChange\", async (data) => {\n this.subscriptionStatusEmitter.emit(\"change\", data.to)\n })\n }\n\n /**\n * Returns the configured shared instance of `Superwall`.\n *\n * **Warning:** You must call {@link Superwall.configure} to initialize `Superwall`\n * before accessing this shared instance.\n *\n * @returns {Superwall} The shared `Superwall` instance.\n */\n static get shared(): Superwall {\n return Superwall._superwall\n }\n\n /**\n * Configures a shared instance of `Superwall` for use throughout your app.\n *\n * Call this as soon as your app starts to initialize the Superwall SDK.\n * Check out [Configuring the SDK](https://docs.superwall.com/docs/configuring-the-sdk) for information about how to configure the SDK.\n *\n * @param {object} config - Configuration object.\n * @param {string} config.apiKey - Your lib API Key that you can get from the Superwall dashboard settings.\n * If you don't have an account, you can [sign up for free](https://superwall.com/sign-up).\n * @param {SuperwallOptions} [config.options] - An optional object which allows you to customize the appearance and behavior\n * of the paywall.\n * @param {PurchaseController} [config.purchaseController] - An optional object that conforms to `PurchaseController`.\n * Implement this if you'd like to handle all subscription-related logic yourself. You'll need to also set the `subscriptionStatus`\n * every time the user's entitlements change. You can read more about that in [Purchases and Subscription Status](https://docs.superwall.com/docs/advanced-configuration).\n * If omitted, Superwall will handle all subscription-related logic itself.\n * @param {() => void} [config.completion] - An optional completion handler that lets you know when Superwall has finished configuring.\n *\n * @returns {Promise<Superwall>} The configured `Superwall` instance.\n */\n static async configure({\n apiKey,\n options,\n purchaseController,\n completion,\n }: {\n apiKey: string\n options?: SuperwallOptions\n purchaseController?: PurchaseController\n completion?: () => void\n }): Promise<Superwall> {\n Superwall.purchaseController = purchaseController\n await SuperwallExpoModule.configure(\n apiKey,\n options?.toJson(),\n !!purchaseController,\n `${version}compat`,\n )\n\n completion?.()\n\n Superwall.setDidConfigure(true)\n\n return Superwall._superwall\n }\n\n /**\n * Creates an account with Superwall by linking the provided `userId` to Superwall's automatically generated alias.\n *\n * Call this function as soon as you have a valid `userId`.\n *\n * @param {Object} config - The identification configuration object.\n * @param {string} config.userId - Your user's unique identifier as defined by your backend system.\n * @param {IdentityOptions} [config.options] - An optional {@link IdentityOptions} object. You can set the\n * {@link IdentityOptions.restorePaywallAssignments} property to `true` to instruct the SDK to wait to restore paywall assignments\n * from the server before presenting any paywalls. This option should be used only in advanced cases\n * (e.g., when users frequently switch accounts or reinstall the app).\n *\n * @returns {Promise<void>} A promise that resolves once the identification process is complete.\n */\n async identify({\n userId,\n options,\n }: {\n userId: string\n options?: IdentityOptions\n }): Promise<void> {\n await this.awaitConfig()\n const serializedOptions = options ? options.toJson() : new IdentityOptions().toJson()\n SuperwallExpoModule.identify(userId, serializedOptions)\n }\n\n /**\n * Resets the `userId`, on-device paywall assignments, and data stored by Superwall.\n *\n * @returns {Promise<void>} A promise that resolves once reset is complete.\n */\n async reset(): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.reset()\n }\n\n /**\n * Handles a deep link.\n *\n * @param {string} url - The deep link to handle.\n * @returns {Promise<Boolean>} A promise that resolves to a boolean indicating whether the deep link was handled.\n */\n async handleDeepLink(url: string): Promise<boolean> {\n await this.awaitConfig()\n return await SuperwallExpoModule.handleDeepLink(url)\n }\n\n /**\n * Registers a placement to access a feature.\n *\n * When the placement is added to a campaign on the [Superwall Dashboard](https://superwall.com/dashboard),\n * it can trigger a paywall if the following conditions are met:\n * - The provided placement is included in a campaign on the Superwall Dashboard.\n * - The user matches an audience filter defined in the campaign.\n * - The user does not have an active subscription.\n *\n * Before using this method, ensure you have created a campaign and added the placement on the\n * [Superwall Dashboard](https://superwall.com/dashboard).\n *\n * The displayed paywall is determined by the audience filters set in the campaign.\n * Once a user is assigned a paywall within an audience, that paywall will continue to be shown unless\n * you remove it from the audience or reset the paywall assignments.\n *\n * @param {string} [params.placement] - The name of the placement to register.\n * @param {Map<string, any> | Record<string, any>} [params.params] - Optional parameters to pass with your placement.\n * These parameters can be referenced within the audience filters of your campaign. Keys beginning with `$`\n * are reserved for Superwall and will be omitted. Values can be any JSON-encodable value, URL, or Date.\n * Arrays and dictionaries are not supported and will be dropped.\n * @param {PaywallPresentationHandler} [params.handler] - An optional handler that receives status updates\n * about the paywall presentation.\n * @param {() => void} [params.feature] - An optional callback that will be executed after registration completes.\n * If provided, this callback will be executed after the registration process completes successfully.\n * If not provided, you can chain a `.then()` block to the returned promise to execute your feature logic.\n *\n * @returns {Promise<void>} if [feature] is provided this promise resolves when register is executed, otherwise a promise that resolves when register completes successfully after which you can chain a `.then()` block to execute your feature logic.\n *\n * @remarks\n * This behavior is remotely configurable via the [Superwall Dashboard](https://superwall.com/dashboard):\n *\n * - For _Non Gated_ paywalls, the feature block is executed when the paywall is dismissed or if the user is already paying.\n * - For _Gated_ paywalls, the feature block is executed only if the user is already paying or if they begin paying.\n * - If no paywall is configured, the feature block is executed immediately.\n * - If no feature block is provided, the returned promise will resolve when registration completes.\n * - If a feature block is provided, the returned promise will always resolve after the feature block is executed.\n * Note: The feature block will not be executed if an error occurs during registration. Such errors can be detected via the\n * `handler`.\n *\n * @example\n * // Using the feature callback:\n * Superwall.register({\n * placement: \"somePlacement\",\n * feature: () => {\n * console.log(\"Feature logic executed after registration\");\n * }\n * });\n *\n * // Alternatively, chaining feature logic after registration:\n * Superwall.register({ placement: \"somePlacement\" })\n * .then(() => {\n * // Execute your feature logic here after registration.\n * console.log(\"Placement registered, now executing feature logic.\");\n * })\n */\n async register(params: {\n placement: string\n params?: Map<string, any> | Record<string, any>\n handler?: PaywallPresentationHandler\n feature?: () => void\n }): Promise<void> {\n await this.awaitConfig()\n let handlerId: string | null = null\n\n if (params.handler) {\n const uuid = (+new Date() * Math.random()).toString(36)\n this.presentationHandlers.set(uuid, params.handler)\n handlerId = uuid\n }\n\n let paramsObject = {}\n if (params.params) {\n paramsObject =\n params.params instanceof Map ? Object.fromEntries(params.params) : params.params\n }\n\n if (params.feature) {\n return await SuperwallExpoModule.registerPlacement(\n params.placement,\n paramsObject,\n handlerId,\n ).then(() => {\n params.feature!() //TODO: This is wrong, the feature should be executed only if the native SDK calls the feature block\n // not after awaiting the promise\n })\n }\n\n return SuperwallExpoModule.registerPlacement(params.placement, paramsObject, handlerId)\n }\n\n /**\n * Confirms all experiment assignments and returns them in an array.\n *\n * Note that the assignments may differ when a placement is registered due to changes\n * in user, placement, or device parameters used in audience filters.\n *\n * @returns {Promise<Assignment[]>} A promise that resolves to an array of {@link Assignment} objects.\n */\n async confirmAllAssignments(): Promise<Assignment[]> {\n await this.awaitConfig()\n const assignments = await SuperwallExpoModule.confirmAllAssignments()\n return assignments.map((assignment: any) => Assignment.fromJson(assignment))\n }\n\n /**\n * Gets all the experiment assignments and returns them in an array.\n *\n * This method tracks the {@link SuperwallEvent.getAssignments} event in the delegate.\n *\n * Note that the assignments may differ when a placement is registered due to changes\n * in user, placement, or device parameters used in audience filters.\n *\n * @returns {Promise<Assignment[]>} A promise that resolves to an array of {@link Assignment} objects.\n */\n async getAssignments(): Promise<Assignment[]> {\n await this.awaitConfig()\n const assignments = await SuperwallExpoModule.getAssignments()\n return assignments.map((assignment: any) => Assignment.fromJson(assignment))\n }\n\n /**\n * Preemptively gets the result of registering a placement.\n *\n * This helps you determine whether a particular placement will present a paywall in the future.\n * Note that this method does not present a paywall. To present a paywall, use the `register` function.\n *\n * @param {Object} options - Options for obtaining the presentation result.\n * @param {string} options.placement - The name of the placement you want to register.\n * @param {Map<string, any>} [options.params] - Optional parameters to pass with your placement.\n *\n * @returns {Promise<PresentationResult>} A promise that resolves to a {@link PresentationResult} indicating the result of registering the placement.\n */\n async getPresentationResult({\n placement,\n params,\n }: {\n placement: string\n params?: Map<string, any>\n }): Promise<PresentationResult> {\n await this.awaitConfig()\n let paramsObject = {}\n if (params) {\n paramsObject = Object.fromEntries(params)\n }\n return await SuperwallExpoModule.getPresentationResult(placement, paramsObject)\n }\n\n /**\n * Retrieves the current configuration status of the Superwall SDK.\n *\n * This function returns a promise that resolves to the current configuration status,\n * indicating whether the SDK has finished configuring. Initially, the status is\n * {@link ConfigurationStatus.PENDING}. Once the configuration completes successfully, it\n * changes to {@link ConfigurationStatus.CONFIGURED}. If the configuration fails, the status\n * will be {@link ConfigurationStatus.FAILED}.\n *\n * @returns {Promise<ConfigurationStatus>} A promise that resolves with the current configuration status.\n */\n async getConfigurationStatus(): Promise<ConfigurationStatus> {\n const configurationStatusString = await SuperwallExpoModule.getConfigurationStatus()\n return ConfigurationStatus.fromString(configurationStatusString)\n }\n\n /**\n * Retrieves the entitlements tied to the device.\n *\n * @returns {Promise<EntitlementsInfo>} A promise that resolves to an {@link EntitlementsInfo} object.\n */\n async getEntitlements(): Promise<EntitlementsInfo> {\n await this.awaitConfig()\n const entitlementsJson = await SuperwallExpoModule.getEntitlements()\n return EntitlementsInfo.fromObject(entitlementsJson)\n }\n\n /**\n * Sets the subscription status of the user.\n *\n * When using a PurchaseController, you must call this method to update the user's subscription status.\n * Alternatively, you can implement the {@link SuperwallDelegate.subscriptionStatusDidChange} delegate callback to receive notifications\n * whenever the subscription status changes.\n *\n * @param {SubscriptionStatus} status - The new subscription status.\n *\n * @returns {Promise<void>} A promise that resolves once the subscription status has been updated.\n */\n async setSubscriptionStatus(status: SubscriptionStatus): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.setSubscriptionStatus(status)\n }\n\n async getSubscriptionStatus(): Promise<SubscriptionStatus> {\n await this.awaitConfig()\n const subscriptionStatusData = await SuperwallExpoModule.getSubscriptionStatus()\n return SubscriptionStatus.fromJson(subscriptionStatusData)\n }\n /**\n * Sets the user interface style, which overrides the system setting.\n *\n * Provide a value of type {@link InterfaceStyle} to explicitly set the interface style.\n * Pass `null` to revert back to the system's default interface style.\n *\n * @param {InterfaceStyle | null} style - The desired interface style, or `null` to use the system setting.\n *\n * @returns {Promise<void>} A promise that resolves once the interface style has been updated.\n */\n async setInterfaceStyle(style: InterfaceStyle | null): Promise<void> {\n await SuperwallExpoModule.setInterfaceStyle(style?.toString())\n }\n\n /**\n * Sets the delegate that handles Superwall lifecycle events.\n *\n * @param {SuperwallDelegate | undefined} delegate - An object implementing the {@link SuperwallDelegate} interface,\n * or `undefined` to remove the current delegate.\n *\n * @returns {Promise<void>} A promise that resolves once the delegate has been updated.\n */\n async setDelegate(delegate: SuperwallDelegate | undefined): Promise<void> {\n await this.awaitConfig()\n Superwall.delegate = delegate\n }\n\n /**\n * Retrieves the user attributes, set using {@link setUserAttributes}.\n *\n * @returns {Promise<UserAttributes>} A promise that resolves with an object representing the user's attributes.\n */\n async getUserAttributes(): Promise<UserAttributes> {\n await this.awaitConfig()\n const userAttributes: UserAttributes = await SuperwallExpoModule.getUserAttributes()\n return userAttributes\n }\n\n /**\n * Preloads all paywalls that the user may see based on campaigns and placements in your Superwall dashboard.\n *\n * To use this, first set `PaywallOptions.shouldPreload` to `false` when configuring the SDK.\n * Then call this function when you want preloading to begin.\n *\n * Note: This method will not reload any paywalls that have already been preloaded via {@link preloadPaywalls}.\n *\n * @returns {Promise<void>} A promise that resolves once the preloading process has been initiated.\n */\n async preloadAllPaywalls(): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.preloadAllPaywalls()\n }\n\n /**\n * Preloads paywalls for specific placements.\n *\n * To use this method, first ensure that {@link PaywallOptions.shouldPreload} is set to `false` when configuring the SDK.\n * Then call this function when you want to initiate preloading for selected placements.\n *\n * Note: This will not reload any paywalls you've already preloaded.\n *\n * @param {Set<string>} placementNames - A set of placement names whose paywalls you want to preload.\n *\n * @returns {Promise<void>} A promise that resolves once the preloading process has been initiated.\n */\n async preloadPaywalls(placementNames: Set<string>): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.preloadPaywalls(Array.from(placementNames))\n }\n\n /**\n * Sets user attributes for use in paywalls and on the Superwall dashboard.\n *\n * If an attribute already exists, its value will be overwritten while other attributes remain unchanged.\n * This is useful for analytics and campaign audience filters you may define in the Superwall Dashboard.\n *\n * **Note:** These attributes should not be used as a source of truth for sensitive information.\n *\n * For example, after retrieving your user's data:\n *\n * ```ts\n * const attributes: UserAttributes = {\n * name: user.name,\n * apnsToken: user.apnsTokenString,\n * email: user.email,\n * username: user.username,\n * profilePic: user.profilePicUrl,\n * }\n * await Superwall.setUserAttributes(attributes)\n * ```\n *\n * See [Setting User Attributes](https://docs.superwall.com/docs/setting-user-properties) for more information.\n *\n * @param {UserAttributes} userAttributes - An object containing custom attributes to store for the user.\n * Values can be any JSON-encodable value, URLs, or Dates. Keys beginning with `$` are reserved for Superwall and will be dropped.\n * Arrays and dictionaries as values are not supported and will be omitted.\n *\n * @returns {Promise<void>} A promise that resolves once the user attributes have been updated.\n */\n async setUserAttributes(userAttributes: UserAttributes): Promise<void> {\n await this.awaitConfig()\n SuperwallExpoModule.setUserAttributes(userAttributes)\n }\n\n /**\n * Dismisses the presented paywall, if one exists.\n *\n * @returns {Promise<void>} A promise that resolves once the paywall has been dismissed,\n * or immediately if no paywall was active.\n */\n async dismiss(): Promise<void> {\n await SuperwallExpoModule.dismiss()\n }\n\n async setLogLevel(level: LogLevel): Promise<void> {\n await SuperwallExpoModule.setLogLevel(level.toString())\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/compat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,QAAQ,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,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WG;IACH,KAAK,CAAC,eAAe,CAAC,cAA2B;QAC/C,MAAM,IAAI,CAAC,WAAW,EAAE,CAAA;QACxB,MAAM,mBAAmB,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAA;IACvE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,KAAK,CAAC,iBAAiB,CAAC,cAA8B;QACpD,MAAM,IAAI,CAAC,WAAW,EAAE,CAAA;QACxB,mBAAmB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAA;IACvD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,mBAAmB,CAAC,OAAO,EAAE,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAe;QAC/B,MAAM,mBAAmB,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;IACzD,CAAC","sourcesContent":["import { Assignment } from \"./lib/Assigments\"\nimport { ConfigurationStatus } from \"./lib/ConfigurationStatus\"\nimport { EntitlementsInfo } from \"./lib/EntitlementsInfo\"\nimport { IdentityOptions } from \"./lib/IdentityOptions\"\nimport type { InterfaceStyle } from \"./lib/InterfaceStyle\"\nimport type { LogLevel } from \"./lib/LogLevel\"\nimport { PaywallInfo } from \"./lib/PaywallInfo\"\nimport type { PaywallPresentationHandler } from \"./lib/PaywallPresentationHandler\"\nimport { fromJson as paywallResultFromJson } from \"./lib/PaywallResult\"\nimport { PaywallSkippedReason } from \"./lib/PaywallSkippedReason\"\nimport type { PresentationResult } from \"./lib/PresentationResult\"\nimport type { PurchaseController } from \"./lib/PurchaseController\"\nimport { RedemptionResults } from \"./lib/RedemptionResults\"\nimport { SubscriptionStatus } from \"./lib/SubscriptionStatus\"\nimport type { SuperwallDelegate } from \"./lib/SuperwallDelegate\"\nimport { SuperwallEventInfo } from \"./lib/SuperwallEventInfo\"\nimport type { SuperwallOptions } from \"./lib/SuperwallOptions\"\n\nexport { PaywallResult } from \"./lib/PaywallResult\"\n\nimport { EventEmitter } from \"expo\"\nimport { version } from \"../../package.json\"\nimport SuperwallExpoModule from \"../SuperwallExpoModule\"\n\nexport { ComputedPropertyRequest } from \"./lib/ComputedPropertyRequest\"\nexport { ConfigurationStatus } from \"./lib/ConfigurationStatus\"\nexport { EntitlementsInfo } from \"./lib/EntitlementsInfo\"\nexport { Experiment } from \"./lib/Experiment\"\nexport { FeatureGatingBehavior } from \"./lib/FeatureGatingBehavior\"\nexport { IdentityOptions } from \"./lib/IdentityOptions\"\nexport { InterfaceStyle } from \"./lib/InterfaceStyle\"\nexport { LocalNotification } from \"./lib/LocalNotification\"\nexport { LogLevel } from \"./lib/LogLevel\"\nexport { LogScope } from \"./lib/LogScope\"\nexport { PaywallCloseReason } from \"./lib/PaywallCloseReason\"\nexport { PaywallInfo } from \"./lib/PaywallInfo\"\nexport {\n PaywallOptions,\n TransactionBackgroundView,\n} from \"./lib/PaywallOptions\"\nexport { PaywallPresentationHandler } from \"./lib/PaywallPresentationHandler\"\nexport { PaywallPresentationRequestStatus } from \"./lib/PaywallPresentationRequestStatus\"\nexport {\n PaywallSkippedReason,\n PaywallSkippedReasonHoldout,\n PaywallSkippedReasonNoAudienceMatch,\n PaywallSkippedReasonPlacementNotFound,\n PaywallSkippedReasonUserIsSubscribed,\n} from \"./lib/PaywallSkippedReason\"\nexport { Product } from \"./lib/Product\"\nexport { PurchaseController } from \"./lib/PurchaseController\"\nexport {\n PurchaseResult,\n PurchaseResultCancelled,\n PurchaseResultFailed,\n PurchaseResultPending,\n PurchaseResultPurchased,\n PurchaseResultRestored,\n} from \"./lib/PurchaseResult\"\nexport * from \"./lib/RedemptionResults\"\nexport { RestorationResult } from \"./lib/RestorationResult\"\nexport { RestoreType } from \"./lib/RestoreType\"\nexport { StoreTransaction } from \"./lib/StoreTransaction\"\nexport { SubscriptionStatus } from \"./lib/SubscriptionStatus\"\nexport { SuperwallDelegate } from \"./lib/SuperwallDelegate\"\nexport { EventType, SuperwallEventInfo } from \"./lib/SuperwallEventInfo\"\nexport { SuperwallOptions } from \"./lib/SuperwallOptions\"\nexport { Survey } from \"./lib/Survey\"\nexport { TriggerResult } from \"./lib/TriggerResult\"\n\ninterface UserAttributes {\n [key: string]: any\n}\n\nexport default class Superwall {\n static purchaseController?: PurchaseController\n private static delegate?: SuperwallDelegate\n private static _superwall = new Superwall()\n\n private static configEmitter = new EventEmitter<{\n configured: (isConfigured: boolean) => void\n }>()\n private static didConfigure = false\n private presentationHandlers: Map<string, PaywallPresentationHandler> = new Map()\n subscriptionStatusEmitter = new EventEmitter<{\n change: (status: SubscriptionStatus) => void\n }>()\n\n private static setDidConfigure(didConfigure: boolean) {\n Superwall.didConfigure = didConfigure\n // Emit an event when the bridged state is true\n if (didConfigure) {\n Superwall.configEmitter.emit(\"configured\", didConfigure)\n }\n }\n\n private async awaitConfig(): Promise<void> {\n if (Superwall.didConfigure) {\n return\n }\n\n await new Promise<void>((resolve) => {\n Superwall.configEmitter.addListener(\"configured\", () => {\n resolve()\n })\n })\n }\n\n private constructor() {\n SuperwallExpoModule.addListener(\"onPurchase\", async (data) => {\n if (data.platform === \"ios\") {\n const purchaseResult = await Superwall.purchaseController?.purchaseFromAppStore(\n data.productId,\n )\n if (purchaseResult == null) {\n return\n }\n await SuperwallExpoModule.didPurchase(purchaseResult.toJSON())\n return\n }\n\n if (data.platform === \"android\") {\n const purchaseResult = await Superwall.purchaseController?.purchaseFromGooglePlay(\n data.productId,\n data.basePlanId,\n data.offerId,\n )\n if (purchaseResult == null) {\n return\n }\n await SuperwallExpoModule.didPurchase(purchaseResult.toJSON())\n }\n })\n\n SuperwallExpoModule.addListener(\"onPurchaseRestore\", async () => {\n const restorationResult = await Superwall.purchaseController?.restorePurchases()\n if (restorationResult == null) {\n return\n }\n await SuperwallExpoModule.didRestore(restorationResult.toJson())\n })\n\n SuperwallExpoModule.addListener(\"onPaywallPresent\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n if (!handler || !handler.onPresentHandler) {\n return\n }\n\n const paywallInfo = PaywallInfo.fromJson(data.paywallInfoJson)\n handler.onPresentHandler(paywallInfo)\n })\n SuperwallExpoModule.addListener(\"onPaywallDismiss\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onDismissHandler) {\n return\n }\n\n const info = PaywallInfo.fromJson(data.paywallInfoJson)\n const result = paywallResultFromJson(data.result)\n handler.onDismissHandler(info, result)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallError\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onErrorHandler) {\n return\n }\n\n handler.onErrorHandler(data.errorString)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallSkip\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onSkipHandler) {\n return\n }\n\n const skippedReason = PaywallSkippedReason.fromJson(data.skippedReason)\n handler.onSkipHandler(skippedReason)\n })\n\n SuperwallExpoModule.addListener(\"onPaywallPresent\", (data) => {\n const handler = this.presentationHandlers.get(data.handlerId)\n\n if (!handler || !handler.onPresentHandler) {\n return\n }\n\n const info = PaywallInfo.fromJson(data.paywallInfoJson)\n handler.onPresentHandler(info)\n })\n\n // MARK: - SuperwallDelegate Listeners\n SuperwallExpoModule.addListener(\"subscriptionStatusDidChange\", async (data) => {\n Superwall.delegate?.subscriptionStatusDidChange(data.from, data.to)\n })\n\n SuperwallExpoModule.addListener(\"handleSuperwallEvent\", async (data) => {\n const eventInfo = SuperwallEventInfo.fromJson(data.eventInfo)\n Superwall.delegate?.handleSuperwallEvent(eventInfo)\n })\n\n SuperwallExpoModule.addListener(\"handleCustomPaywallAction\", async (data) => {\n const name = data.name\n Superwall.delegate?.handleCustomPaywallAction(name)\n })\n\n SuperwallExpoModule.addListener(\"willDismissPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.willDismissPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"willPresentPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.willPresentPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"didDismissPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.didDismissPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"didPresentPaywall\", async (data) => {\n const info = PaywallInfo.fromJson(data.info)\n Superwall.delegate?.didPresentPaywall(info)\n })\n\n SuperwallExpoModule.addListener(\"handleLog\", async (data) => {\n Superwall.delegate?.handleLog(\n data.level,\n data.scope,\n data.message || undefined,\n data.info,\n data.error,\n )\n })\n\n SuperwallExpoModule.addListener(\"paywallWillOpenDeepLink\", async (data) => {\n const url = new URL(data.url)\n Superwall.delegate?.paywallWillOpenDeepLink(url)\n })\n\n SuperwallExpoModule.addListener(\"paywallWillOpenURL\", async (data) => {\n const url = new URL(data.url)\n Superwall.delegate?.paywallWillOpenURL(url)\n })\n\n SuperwallExpoModule.addListener(\"willRedeemLink\", async () => {\n Superwall.delegate?.willRedeemLink()\n })\n\n SuperwallExpoModule.addListener(\"didRedeemLink\", async (data) => {\n const result = RedemptionResults.fromJson(data)\n Superwall.delegate?.didRedeemLink(result)\n })\n\n SuperwallExpoModule.addListener(\"subscriptionStatusDidChange\", async (data) => {\n this.subscriptionStatusEmitter.emit(\"change\", data.to)\n })\n }\n\n /**\n * Returns the configured shared instance of `Superwall`.\n *\n * **Warning:** You must call {@link Superwall.configure} to initialize `Superwall`\n * before accessing this shared instance.\n *\n * @returns {Superwall} The shared `Superwall` instance.\n */\n static get shared(): Superwall {\n return Superwall._superwall\n }\n\n /**\n * Configures a shared instance of `Superwall` for use throughout your app.\n *\n * Call this as soon as your app starts to initialize the Superwall SDK.\n * Check out [Configuring the SDK](https://docs.superwall.com/docs/configuring-the-sdk) for information about how to configure the SDK.\n *\n * @param {object} config - Configuration object.\n * @param {string} config.apiKey - Your lib API Key that you can get from the Superwall dashboard settings.\n * If you don't have an account, you can [sign up for free](https://superwall.com/sign-up).\n * @param {SuperwallOptions} [config.options] - An optional object which allows you to customize the appearance and behavior\n * of the paywall.\n * @param {PurchaseController} [config.purchaseController] - An optional object that conforms to `PurchaseController`.\n * Implement this if you'd like to handle all subscription-related logic yourself. You'll need to also set the `subscriptionStatus`\n * every time the user's entitlements change. You can read more about that in [Purchases and Subscription Status](https://docs.superwall.com/docs/advanced-configuration).\n * If omitted, Superwall will handle all subscription-related logic itself.\n * @param {() => void} [config.completion] - An optional completion handler that lets you know when Superwall has finished configuring.\n *\n * @returns {Promise<Superwall>} The configured `Superwall` instance.\n */\n static async configure({\n apiKey,\n options,\n purchaseController,\n completion,\n }: {\n apiKey: string\n options?: SuperwallOptions\n purchaseController?: PurchaseController\n completion?: () => void\n }): Promise<Superwall> {\n Superwall.purchaseController = purchaseController\n await SuperwallExpoModule.configure(\n apiKey,\n options?.toJson(),\n !!purchaseController,\n `${version}compat`,\n )\n\n completion?.()\n\n Superwall.setDidConfigure(true)\n\n return Superwall._superwall\n }\n\n /**\n * Creates an account with Superwall by linking the provided `userId` to Superwall's automatically generated alias.\n *\n * Call this function as soon as you have a valid `userId`.\n *\n * @param {Object} config - The identification configuration object.\n * @param {string} config.userId - Your user's unique identifier as defined by your backend system.\n * @param {IdentityOptions} [config.options] - An optional {@link IdentityOptions} object. You can set the\n * {@link IdentityOptions.restorePaywallAssignments} property to `true` to instruct the SDK to wait to restore paywall assignments\n * from the server before presenting any paywalls. This option should be used only in advanced cases\n * (e.g., when users frequently switch accounts or reinstall the app).\n *\n * @returns {Promise<void>} A promise that resolves once the identification process is complete.\n */\n async identify({\n userId,\n options,\n }: {\n userId: string\n options?: IdentityOptions\n }): Promise<void> {\n await this.awaitConfig()\n const serializedOptions = options ? options.toJson() : new IdentityOptions().toJson()\n SuperwallExpoModule.identify(userId, serializedOptions)\n }\n\n /**\n * Resets the `userId`, on-device paywall assignments, and data stored by Superwall.\n *\n * @returns {Promise<void>} A promise that resolves once reset is complete.\n */\n async reset(): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.reset()\n }\n\n /**\n * Handles a deep link.\n *\n * @param {string} url - The deep link to handle.\n * @returns {Promise<Boolean>} A promise that resolves to a boolean indicating whether the deep link was handled.\n */\n async handleDeepLink(url: string): Promise<boolean> {\n await this.awaitConfig()\n return await SuperwallExpoModule.handleDeepLink(url)\n }\n\n /**\n * Registers a placement to access a feature.\n *\n * When the placement is added to a campaign on the [Superwall Dashboard](https://superwall.com/dashboard),\n * it can trigger a paywall if the following conditions are met:\n * - The provided placement is included in a campaign on the Superwall Dashboard.\n * - The user matches an audience filter defined in the campaign.\n * - The user does not have an active subscription.\n *\n * Before using this method, ensure you have created a campaign and added the placement on the\n * [Superwall Dashboard](https://superwall.com/dashboard).\n *\n * The displayed paywall is determined by the audience filters set in the campaign.\n * Once a user is assigned a paywall within an audience, that paywall will continue to be shown unless\n * you remove it from the audience or reset the paywall assignments.\n *\n * @param {string} [params.placement] - The name of the placement to register.\n * @param {Map<string, any> | Record<string, any>} [params.params] - Optional parameters to pass with your placement.\n * These parameters can be referenced within the audience filters of your campaign. Keys beginning with `$`\n * are reserved for Superwall and will be omitted. Values can be any JSON-encodable value, URL, or Date.\n * Arrays and dictionaries are not supported and will be dropped.\n * @param {PaywallPresentationHandler} [params.handler] - An optional handler that receives status updates\n * about the paywall presentation.\n * @param {() => void} [params.feature] - An optional callback that will be executed after registration completes.\n * If provided, this callback will be executed after the registration process completes successfully.\n * If not provided, you can chain a `.then()` block to the returned promise to execute your feature logic.\n *\n * @returns {Promise<void>} if [feature] is provided this promise resolves when register is executed, otherwise a promise that resolves when register completes successfully after which you can chain a `.then()` block to execute your feature logic.\n *\n * @remarks\n * This behavior is remotely configurable via the [Superwall Dashboard](https://superwall.com/dashboard):\n *\n * - For _Non Gated_ paywalls, the feature block is executed when the paywall is dismissed or if the user is already paying.\n * - For _Gated_ paywalls, the feature block is executed only if the user is already paying or if they begin paying.\n * - If no paywall is configured, the feature block is executed immediately.\n * - If no feature block is provided, the returned promise will resolve when registration completes.\n * - If a feature block is provided, the returned promise will always resolve after the feature block is executed.\n * Note: The feature block will not be executed if an error occurs during registration. Such errors can be detected via the\n * `handler`.\n *\n * @example\n * // Using the feature callback:\n * Superwall.register({\n * placement: \"somePlacement\",\n * feature: () => {\n * console.log(\"Feature logic executed after registration\");\n * }\n * });\n *\n * // Alternatively, chaining feature logic after registration:\n * Superwall.register({ placement: \"somePlacement\" })\n * .then(() => {\n * // Execute your feature logic here after registration.\n * console.log(\"Placement registered, now executing feature logic.\");\n * })\n */\n async register(params: {\n placement: string\n params?: Map<string, any> | Record<string, any>\n handler?: PaywallPresentationHandler\n feature?: () => void\n }): Promise<void> {\n await this.awaitConfig()\n let handlerId: string | null = null\n\n if (params.handler) {\n const uuid = (+new Date() * Math.random()).toString(36)\n this.presentationHandlers.set(uuid, params.handler)\n handlerId = uuid\n }\n\n let paramsObject = {}\n if (params.params) {\n paramsObject =\n params.params instanceof Map ? Object.fromEntries(params.params) : params.params\n }\n\n if (params.feature) {\n return await SuperwallExpoModule.registerPlacement(\n params.placement,\n paramsObject,\n handlerId,\n ).then(() => {\n params.feature!() //TODO: This is wrong, the feature should be executed only if the native SDK calls the feature block\n // not after awaiting the promise\n })\n }\n\n return SuperwallExpoModule.registerPlacement(params.placement, paramsObject, handlerId)\n }\n\n /**\n * Confirms all experiment assignments and returns them in an array.\n *\n * Note that the assignments may differ when a placement is registered due to changes\n * in user, placement, or device parameters used in audience filters.\n *\n * @returns {Promise<Assignment[]>} A promise that resolves to an array of {@link Assignment} objects.\n */\n async confirmAllAssignments(): Promise<Assignment[]> {\n await this.awaitConfig()\n const assignments = await SuperwallExpoModule.confirmAllAssignments()\n return assignments.map((assignment: any) => Assignment.fromJson(assignment))\n }\n\n /**\n * Gets all the experiment assignments and returns them in an array.\n *\n * This method tracks the {@link SuperwallEvent.getAssignments} event in the delegate.\n *\n * Note that the assignments may differ when a placement is registered due to changes\n * in user, placement, or device parameters used in audience filters.\n *\n * @returns {Promise<Assignment[]>} A promise that resolves to an array of {@link Assignment} objects.\n */\n async getAssignments(): Promise<Assignment[]> {\n await this.awaitConfig()\n const assignments = await SuperwallExpoModule.getAssignments()\n return assignments.map((assignment: any) => Assignment.fromJson(assignment))\n }\n\n /**\n * Preemptively gets the result of registering a placement.\n *\n * This helps you determine whether a particular placement will present a paywall in the future.\n * Note that this method does not present a paywall. To present a paywall, use the `register` function.\n *\n * @param {Object} options - Options for obtaining the presentation result.\n * @param {string} options.placement - The name of the placement you want to register.\n * @param {Map<string, any>} [options.params] - Optional parameters to pass with your placement.\n *\n * @returns {Promise<PresentationResult>} A promise that resolves to a {@link PresentationResult} indicating the result of registering the placement.\n */\n async getPresentationResult({\n placement,\n params,\n }: {\n placement: string\n params?: Map<string, any>\n }): Promise<PresentationResult> {\n await this.awaitConfig()\n let paramsObject = {}\n if (params) {\n paramsObject = Object.fromEntries(params)\n }\n return await SuperwallExpoModule.getPresentationResult(placement, paramsObject)\n }\n\n /**\n * Retrieves the current configuration status of the Superwall SDK.\n *\n * This function returns a promise that resolves to the current configuration status,\n * indicating whether the SDK has finished configuring. Initially, the status is\n * {@link ConfigurationStatus.PENDING}. Once the configuration completes successfully, it\n * changes to {@link ConfigurationStatus.CONFIGURED}. If the configuration fails, the status\n * will be {@link ConfigurationStatus.FAILED}.\n *\n * @returns {Promise<ConfigurationStatus>} A promise that resolves with the current configuration status.\n */\n async getConfigurationStatus(): Promise<ConfigurationStatus> {\n const configurationStatusString = await SuperwallExpoModule.getConfigurationStatus()\n return ConfigurationStatus.fromString(configurationStatusString)\n }\n\n /**\n * Retrieves the entitlements tied to the device.\n *\n * @returns {Promise<EntitlementsInfo>} A promise that resolves to an {@link EntitlementsInfo} object.\n */\n async getEntitlements(): Promise<EntitlementsInfo> {\n await this.awaitConfig()\n const entitlementsJson = await SuperwallExpoModule.getEntitlements()\n return EntitlementsInfo.fromObject(entitlementsJson)\n }\n\n /**\n * Sets the subscription status of the user.\n *\n * When using a PurchaseController, you must call this method to update the user's subscription status.\n * Alternatively, you can implement the {@link SuperwallDelegate.subscriptionStatusDidChange} delegate callback to receive notifications\n * whenever the subscription status changes.\n *\n * @param {SubscriptionStatus} status - The new subscription status.\n *\n * @returns {Promise<void>} A promise that resolves once the subscription status has been updated.\n */\n async setSubscriptionStatus(status: SubscriptionStatus): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.setSubscriptionStatus(status)\n }\n\n async getSubscriptionStatus(): Promise<SubscriptionStatus> {\n await this.awaitConfig()\n const subscriptionStatusData = await SuperwallExpoModule.getSubscriptionStatus()\n return SubscriptionStatus.fromJson(subscriptionStatusData)\n }\n /**\n * Sets the user interface style, which overrides the system setting.\n *\n * Provide a value of type {@link InterfaceStyle} to explicitly set the interface style.\n * Pass `null` to revert back to the system's default interface style.\n *\n * @param {InterfaceStyle | null} style - The desired interface style, or `null` to use the system setting.\n *\n * @returns {Promise<void>} A promise that resolves once the interface style has been updated.\n */\n async setInterfaceStyle(style: InterfaceStyle | null): Promise<void> {\n await SuperwallExpoModule.setInterfaceStyle(style?.toString())\n }\n\n /**\n * Sets the delegate that handles Superwall lifecycle events.\n *\n * @param {SuperwallDelegate | undefined} delegate - An object implementing the {@link SuperwallDelegate} interface,\n * or `undefined` to remove the current delegate.\n *\n * @returns {Promise<void>} A promise that resolves once the delegate has been updated.\n */\n async setDelegate(delegate: SuperwallDelegate | undefined): Promise<void> {\n await this.awaitConfig()\n Superwall.delegate = delegate\n }\n\n /**\n * Retrieves the user attributes, set using {@link setUserAttributes}.\n *\n * @returns {Promise<UserAttributes>} A promise that resolves with an object representing the user's attributes.\n */\n async getUserAttributes(): Promise<UserAttributes> {\n await this.awaitConfig()\n const userAttributes: UserAttributes = await SuperwallExpoModule.getUserAttributes()\n return userAttributes\n }\n\n /**\n * Preloads all paywalls that the user may see based on campaigns and placements in your Superwall dashboard.\n *\n * To use this, first set `PaywallOptions.shouldPreload` to `false` when configuring the SDK.\n * Then call this function when you want preloading to begin.\n *\n * Note: This method will not reload any paywalls that have already been preloaded via {@link preloadPaywalls}.\n *\n * @returns {Promise<void>} A promise that resolves once the preloading process has been initiated.\n */\n async preloadAllPaywalls(): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.preloadAllPaywalls()\n }\n\n /**\n * Preloads paywalls for specific placements.\n *\n * To use this method, first ensure that {@link PaywallOptions.shouldPreload} is set to `false` when configuring the SDK.\n * Then call this function when you want to initiate preloading for selected placements.\n *\n * Note: This will not reload any paywalls you've already preloaded.\n *\n * @param {Set<string>} placementNames - A set of placement names whose paywalls you want to preload.\n *\n * @returns {Promise<void>} A promise that resolves once the preloading process has been initiated.\n */\n async preloadPaywalls(placementNames: Set<string>): Promise<void> {\n await this.awaitConfig()\n await SuperwallExpoModule.preloadPaywalls(Array.from(placementNames))\n }\n\n /**\n * Sets user attributes for use in paywalls and on the Superwall dashboard.\n *\n * If an attribute already exists, its value will be overwritten while other attributes remain unchanged.\n * This is useful for analytics and campaign audience filters you may define in the Superwall Dashboard.\n *\n * **Note:** These attributes should not be used as a source of truth for sensitive information.\n *\n * For example, after retrieving your user's data:\n *\n * ```ts\n * const attributes: UserAttributes = {\n * name: user.name,\n * apnsToken: user.apnsTokenString,\n * email: user.email,\n * username: user.username,\n * profilePic: user.profilePicUrl,\n * }\n * await Superwall.setUserAttributes(attributes)\n * ```\n *\n * See [Setting User Attributes](https://docs.superwall.com/docs/setting-user-properties) for more information.\n *\n * @param {UserAttributes} userAttributes - An object containing custom attributes to store for the user.\n * Values can be any JSON-encodable value, URLs, or Dates. Keys beginning with `$` are reserved for Superwall and will be dropped.\n * Arrays and dictionaries as values are not supported and will be omitted.\n *\n * @returns {Promise<void>} A promise that resolves once the user attributes have been updated.\n */\n async setUserAttributes(userAttributes: UserAttributes): Promise<void> {\n await this.awaitConfig()\n SuperwallExpoModule.setUserAttributes(userAttributes)\n }\n\n /**\n * Dismisses the presented paywall, if one exists.\n *\n * @returns {Promise<void>} A promise that resolves once the paywall has been dismissed,\n * or immediately if no paywall was active.\n */\n async dismiss(): Promise<void> {\n await SuperwallExpoModule.dismiss()\n }\n\n async setLogLevel(level: LogLevel): Promise<void> {\n await SuperwallExpoModule.setLogLevel(level.toString())\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SubscriptionStatus } from "./SuperwallExpoModule.types";
|
|
2
|
+
import type { SuperwallOptions } from "./SuperwallOptions";
|
|
2
3
|
/**
|
|
3
4
|
* @category Models
|
|
4
5
|
* @since 0.0.15
|
|
@@ -57,10 +58,10 @@ export interface SuperwallStore {
|
|
|
57
58
|
* @returns A promise that resolves when configuration is complete.
|
|
58
59
|
* @internal
|
|
59
60
|
*/
|
|
60
|
-
configure: (apiKey: string, options?: {
|
|
61
|
+
configure: (apiKey: string, options?: Partial<SuperwallOptions> & {
|
|
62
|
+
/** @deprecated Use manualPurchaseManagement instead */
|
|
61
63
|
manualPurchaseManagment?: boolean;
|
|
62
|
-
|
|
63
|
-
} & Record<string, any>) => Promise<void>;
|
|
64
|
+
}) => Promise<void>;
|
|
64
65
|
/**
|
|
65
66
|
* Identifies the current user with a unique ID.
|
|
66
67
|
* @param userId - The unique identifier for the user.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSuperwall.d.ts","sourceRoot":"","sources":["../../src/useSuperwall.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"useSuperwall.d.ts","sourceRoot":"","sources":["../../src/useSuperwall.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,+CAA+C;IAC/C,SAA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AAC,KAAK,EAAE,cAAc,KAAK,CAAC,GAAG,CAAC,CASjG"}
|
|
@@ -21,8 +21,10 @@ export const useSuperwallStore = create((set, get) => ({
|
|
|
21
21
|
/* -------------------- Actions -------------------- */
|
|
22
22
|
configure: async (apiKey, options) => {
|
|
23
23
|
set({ isLoading: true });
|
|
24
|
-
const { manualPurchaseManagment, ...restOptions } = options || {};
|
|
25
|
-
|
|
24
|
+
const { manualPurchaseManagement, manualPurchaseManagment, ...restOptions } = options || {};
|
|
25
|
+
// Support both spellings for backward compatibility
|
|
26
|
+
const isManualPurchaseManagement = manualPurchaseManagement ?? manualPurchaseManagment ?? false;
|
|
27
|
+
await SuperwallExpoModule.configure(apiKey, restOptions, isManualPurchaseManagement, pkg.version);
|
|
26
28
|
const currentUser = await SuperwallExpoModule.getUserAttributes();
|
|
27
29
|
const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus();
|
|
28
30
|
set({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSuperwall.js","sourceRoot":"","sources":["../../src/useSuperwall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,GAAG,MAAM,iBAAiB,CAAA;AACjC,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AAoKvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACrE,qDAAqD;IACrD,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,KAAK;IAChB,oBAAoB,EAAE,KAAK;IAE3B,IAAI,EAAE,IAAI;IACV,kBAAkB,EAAE;QAClB,MAAM,EAAE,SAAS;KAClB;IAED,uDAAuD;IACvD,SAAS,EAAE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G,aAAa,CAAU,KAAK,CAAC,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,YAAY,CAA2B,QAAuC;IAC5F,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAA;IAC/C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IAED,MAAM,QAAQ,GAAG,CAAC,KAAqB,EAAE,EAAE,CAAC,KAAqB,CAAA;IACjE,6DAA6D;IAC7D,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;AACtE,CAAC","sourcesContent":["import { createContext, useContext } from \"react\"\nimport { create } from \"zustand\"\nimport { useShallow } from \"zustand/shallow\"\nimport pkg from \"../package.json\"\nimport SuperwallExpoModule from \"./SuperwallExpoModule\"\nimport type { SubscriptionStatus } from \"./SuperwallExpoModule.types\"\n\n/**\n * @category Models\n * @since 0.0.15\n * Interface representing the attributes of a user.\n */\nexport interface UserAttributes {\n /** The user's alias ID, if set. */\n aliasId: string\n /** The user's application-specific user ID. */\n appUserId: string\n /** The ISO 8601 date string representation of when the application was installed on the user's device. */\n applicationInstalledAt: string\n /** A seed value associated with the user, used for consistent variant assignments in experiments. */\n seed: number\n /** Allows for custom attributes to be set for the user. These can be of any type. */\n [key: string]: any\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Options for the `identify` method.\n */\nexport interface IdentifyOptions {\n /**\n * Determines whether to restore paywall assignments from a previous session for the identified user.\n * If `true`, the SDK attempts to restore the assignments. Defaults to `false`.\n */\n restorePaywallAssignments?: boolean\n}\n\n/**\n * @category Store\n * @since 0.0.15\n * Defines the structure of the Superwall store, including its state and actions.\n * This store is managed by Zustand.\n */\nexport interface SuperwallStore {\n /* -------------------- State -------------------- */\n /** Indicates whether the Superwall SDK has been successfully configured. */\n isConfigured: boolean\n /** Indicates whether the SDK is currently performing a loading operation (e.g., configuring, fetching data). */\n isLoading: boolean\n /** Indicates whether the native event listeners have been initialized. */\n listenersInitialized: boolean\n\n /**\n * The current user's attributes.\n * `null` if no user is identified or after `reset` is called.\n * `undefined` initially before any user data is fetched or set.\n */\n user?: UserAttributes | null\n\n /** The current subscription status of the user. */\n subscriptionStatus: SubscriptionStatus\n\n /* -------------------- Internal -------------------- */\n // Internal listener references for cleanup handled inside Provider effect.\n // Not reactive, so we store outside Zustand state to avoid unnecessary rerenders.\n\n /* -------------------- Actions -------------------- */\n /**\n * Configures the Superwall SDK with the provided API key and options.\n * This must be called before most other SDK functions can be used.\n * @param apiKey - Your Superwall API key.\n * @param options - Optional configuration settings for the SDK.\n * @returns A promise that resolves when configuration is complete.\n * @internal\n */\n configure: (\n apiKey: string,\n options?: {\n manualPurchaseManagment?: boolean\n enableExperimentalDeviceVariables?: boolean\n } & Record<string, any>,\n ) => Promise<void>\n /**\n * Identifies the current user with a unique ID.\n * @param userId - The unique identifier for the user.\n * @param options - Optional parameters for identification.\n * @returns A promise that resolves when identification is complete.\n */\n identify: (userId: string, options?: IdentifyOptions) => Promise<void>\n /**\n * Resets the user's identity and clears all user-specific data, effectively logging them out.\n * @internal\n */\n reset: () => Promise<void>\n\n /**\n * Registers a placement to potentially show a paywall.\n * The decision to show a paywall is determined by campaign rules and user assignments on the Superwall dashboard.\n * @param placement - The ID of the placement to register.\n * @param params - Optional parameters to pass with the placement.\n * @param handlerId - An optional identifier used to associate specific event handlers (e.g., from `usePlacement`). Defaults to \"default\".\n * @returns A promise that resolves when the placement registration is complete.\n */\n registerPlacement: (\n placement: string,\n params?: Record<string, any>,\n handlerId?: string | null,\n ) => Promise<void>\n /**\n * Retrieves the presentation result for a given placement.\n * This can be used to understand what would happen if a placement were to be registered, without actually registering it.\n * @param placement - The ID of the placement.\n * @param params - Optional parameters for the placement.\n * @returns A promise that resolves with the presentation result.\n */\n getPresentationResult: (placement: string, params?: Record<string, any>) => Promise<any>\n /**\n * Dismisses any currently presented Superwall paywall.\n * @returns A promise that resolves when the dismissal is complete.\n */\n dismiss: () => Promise<void>\n\n /**\n * Preloads all paywalls configured in your Superwall dashboard.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadAllPaywalls: () => Promise<void>\n /**\n * Preloads specific paywalls.\n * @param placements - An array of placement IDs for which to preload paywalls.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadPaywalls: (placements: string[]) => Promise<void>\n\n /**\n * Sets custom attributes for the current user.\n * @param attrs - An object containing the attributes to set.\n * @returns A promise that resolves when attributes are set.\n */\n setUserAttributes: (attrs: Record<string, any>) => Promise<void>\n /**\n * Retrieves the current user's attributes.\n * @returns A promise that resolves with the user's attributes.\n */\n getUserAttributes: () => Promise<Record<string, any>>\n\n /**\n * Sets the logging level for the Superwall SDK.\n * @param level - The desired log level (e.g., \"debug\", \"info\", \"warn\", \"error\", \"none\").\n * @returns A promise that resolves when the log level is set.\n */\n setLogLevel: (level: string) => Promise<void>\n\n /* -------------------- Listener helpers -------------------- */\n /**\n * Initializes native event listeners for the SDK.\n * This is typically called internally by the `SuperwallProvider`.\n * @returns A cleanup function to remove the listeners.\n * @internal\n */\n _initListeners: () => () => void\n\n setSubscriptionStatus: (status: SubscriptionStatus) => Promise<void>\n\n getDeviceAttributes: () => Promise<Record<string, any>>\n}\n\n/**\n * @category Store\n * @since 0.0.15\n * Zustand store for Superwall SDK state and actions.\n * @internal\n */\nexport const useSuperwallStore = create<SuperwallStore>((set, get) => ({\n /* -------------------- State -------------------- */\n isConfigured: false,\n isLoading: false,\n listenersInitialized: false,\n\n user: null,\n subscriptionStatus: {\n status: \"UNKNOWN\",\n },\n\n /* -------------------- Actions -------------------- */\n configure: async (apiKey, options) => {\n set({ isLoading: true })\n const { manualPurchaseManagment, ...restOptions } = options || {}\n\n await SuperwallExpoModule.configure(apiKey, restOptions, !!manualPurchaseManagment, pkg.version)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({\n isConfigured: true,\n isLoading: false,\n user: currentUser as UserAttributes,\n subscriptionStatus,\n })\n },\n identify: async (userId, options) => {\n SuperwallExpoModule.identify(userId, options)\n\n // TODO: Instead of setting users after identify, we should set this based on an event\n setTimeout(async () => {\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n }, 0)\n },\n reset: async () => {\n SuperwallExpoModule.reset()\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n },\n registerPlacement: async (placement, params, handlerId = \"default\") => {\n await SuperwallExpoModule.registerPlacement(placement, params, handlerId)\n },\n getPresentationResult: async (placement, params) => {\n return SuperwallExpoModule.getPresentationResult(placement, params)\n },\n dismiss: async () => {\n await SuperwallExpoModule.dismiss()\n },\n preloadAllPaywalls: async () => {\n SuperwallExpoModule.preloadAllPaywalls()\n },\n preloadPaywalls: async (placements) => {\n SuperwallExpoModule.preloadPaywalls(placements)\n },\n setUserAttributes: async (attrs) => {\n SuperwallExpoModule.setUserAttributes(attrs)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n set({ user: currentUser as UserAttributes })\n },\n getUserAttributes: async () => {\n const attributes = await SuperwallExpoModule.getUserAttributes()\n set({ user: attributes as UserAttributes })\n return attributes\n },\n setLogLevel: async (level) => {\n SuperwallExpoModule.setLogLevel(level)\n },\n\n setSubscriptionStatus: async (status) => {\n SuperwallExpoModule.setSubscriptionStatus(status)\n },\n getDeviceAttributes: async () => {\n const attributes = await SuperwallExpoModule.getDeviceAttributes()\n return attributes\n },\n\n /* -------------------- Listener helpers -------------------- */\n _initListeners: (): (() => void) => {\n // Use get() to read the state from within the store\n if (get().listenersInitialized) {\n console.warn(\"Listeners already initialized. Skipping.\")\n return () => {} // Return no-op cleanup\n }\n\n const subscriptions: { remove: () => void }[] = []\n\n subscriptions.push(\n SuperwallExpoModule.addListener(\n \"subscriptionStatusDidChange\",\n ({ to }: { to: SubscriptionStatus }) => {\n set({ subscriptionStatus: to })\n },\n ),\n )\n\n set({ listenersInitialized: true })\n console.log(\"Initialized listeners\", subscriptions.length)\n\n return (): void => {\n console.log(\"Cleaning up listeners\", subscriptions.length)\n subscriptions.forEach((s) => s.remove())\n // Reset the state on cleanup\n set({ listenersInitialized: false })\n }\n },\n}))\n\n/**\n * @category Store\n * @since 0.0.15\n * Public interface for the Superwall store, excluding internal methods.\n */\nexport type PublicSuperwallStore = Omit<SuperwallStore, \"configure\" | \"reset\" | \"_initListeners\">\n\nexport const SuperwallContext = createContext<boolean>(false)\n\n/**\n * @category Hooks\n * @since 0.0.15\n * Core React hook for interacting with the Superwall SDK.\n *\n * This hook provides access to the Superwall store, which includes SDK state\n * (like configuration status, user information, subscription status) and actions\n * (like `identify`, `reset`, `registerPlacement`).\n *\n * It must be used within a component that is a descendant of `<SuperwallProvider />`.\n *\n * @template T - Optional type parameter for the selected state. Defaults to the entire `PublicSuperwallStore`.\n * @param selector - An optional function to select a specific slice of the store's state.\n * This is useful for performance optimization, as components will only re-render\n * if the selected part of the state changes. Uses shallow equality checking\n * via `zustand/shallow`. If omitted, the entire store is returned.\n * @returns The selected slice of the Superwall store state, or the entire store if no selector is provided.\n * @throws Error if used outside of a `SuperwallProvider`.\n *\n * @example\n * // Get the entire store\n * const superwall = useSuperwall();\n * console.log(superwall.isConfigured);\n * superwall.identify(\"user_123\");\n *\n * @example\n * // Select specific state properties\n * const { user, subscriptionStatus } = useSuperwall(state => ({\n * user: state.user,\n * subscriptionStatus: state.subscriptionStatus,\n * }));\n * console.log(user?.appUserId, subscriptionStatus?.status);\n */\nexport function useSuperwall<T = PublicSuperwallStore>(selector?: (state: SuperwallStore) => T): T {\n const inProvider = useContext(SuperwallContext)\n if (!inProvider) {\n throw new Error(\"useSuperwall must be used within a SuperwallProvider\")\n }\n\n const identity = (state: SuperwallStore) => state as unknown as T\n // biome-ignore lint/correctness/useHookAtTopLevel: good here\n return useSuperwallStore(selector ? useShallow(selector) : identity)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useSuperwall.js","sourceRoot":"","sources":["../../src/useSuperwall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,GAAG,MAAM,iBAAiB,CAAA;AACjC,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AAqKvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACrE,qDAAqD;IACrD,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,KAAK;IAChB,oBAAoB,EAAE,KAAK;IAE3B,IAAI,EAAE,IAAI;IACV,kBAAkB,EAAE;QAClB,MAAM,EAAE,SAAS;KAClB;IAED,uDAAuD;IACvD,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QACnC,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACxB,MAAM,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;QAE3F,oDAAoD;QACpD,MAAM,0BAA0B,GAAG,wBAAwB,IAAI,uBAAuB,IAAI,KAAK,CAAA;QAE/F,MAAM,mBAAmB,CAAC,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,0BAA0B,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;QAEjG,MAAM,WAAW,GAAG,MAAM,mBAAmB,CA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;IACjE,6DAA6D;IAC7D,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;AACtE,CAAC","sourcesContent":["import { createContext, useContext } from \"react\"\nimport { create } from \"zustand\"\nimport { useShallow } from \"zustand/shallow\"\nimport pkg from \"../package.json\"\nimport SuperwallExpoModule from \"./SuperwallExpoModule\"\nimport type { SubscriptionStatus } from \"./SuperwallExpoModule.types\"\nimport type { SuperwallOptions } from \"./SuperwallOptions\"\n\n/**\n * @category Models\n * @since 0.0.15\n * Interface representing the attributes of a user.\n */\nexport interface UserAttributes {\n /** The user's alias ID, if set. */\n aliasId: string\n /** The user's application-specific user ID. */\n appUserId: string\n /** The ISO 8601 date string representation of when the application was installed on the user's device. */\n applicationInstalledAt: string\n /** A seed value associated with the user, used for consistent variant assignments in experiments. */\n seed: number\n /** Allows for custom attributes to be set for the user. These can be of any type. */\n [key: string]: any\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Options for the `identify` method.\n */\nexport interface IdentifyOptions {\n /**\n * Determines whether to restore paywall assignments from a previous session for the identified user.\n * If `true`, the SDK attempts to restore the assignments. Defaults to `false`.\n */\n restorePaywallAssignments?: boolean\n}\n\n/**\n * @category Store\n * @since 0.0.15\n * Defines the structure of the Superwall store, including its state and actions.\n * This store is managed by Zustand.\n */\nexport interface SuperwallStore {\n /* -------------------- State -------------------- */\n /** Indicates whether the Superwall SDK has been successfully configured. */\n isConfigured: boolean\n /** Indicates whether the SDK is currently performing a loading operation (e.g., configuring, fetching data). */\n isLoading: boolean\n /** Indicates whether the native event listeners have been initialized. */\n listenersInitialized: boolean\n\n /**\n * The current user's attributes.\n * `null` if no user is identified or after `reset` is called.\n * `undefined` initially before any user data is fetched or set.\n */\n user?: UserAttributes | null\n\n /** The current subscription status of the user. */\n subscriptionStatus: SubscriptionStatus\n\n /* -------------------- Internal -------------------- */\n // Internal listener references for cleanup handled inside Provider effect.\n // Not reactive, so we store outside Zustand state to avoid unnecessary rerenders.\n\n /* -------------------- Actions -------------------- */\n /**\n * Configures the Superwall SDK with the provided API key and options.\n * This must be called before most other SDK functions can be used.\n * @param apiKey - Your Superwall API key.\n * @param options - Optional configuration settings for the SDK.\n * @returns A promise that resolves when configuration is complete.\n * @internal\n */\n configure: (\n apiKey: string,\n options?: Partial<SuperwallOptions> & {\n /** @deprecated Use manualPurchaseManagement instead */\n manualPurchaseManagment?: boolean\n },\n ) => Promise<void>\n /**\n * Identifies the current user with a unique ID.\n * @param userId - The unique identifier for the user.\n * @param options - Optional parameters for identification.\n * @returns A promise that resolves when identification is complete.\n */\n identify: (userId: string, options?: IdentifyOptions) => Promise<void>\n /**\n * Resets the user's identity and clears all user-specific data, effectively logging them out.\n * @internal\n */\n reset: () => Promise<void>\n\n /**\n * Registers a placement to potentially show a paywall.\n * The decision to show a paywall is determined by campaign rules and user assignments on the Superwall dashboard.\n * @param placement - The ID of the placement to register.\n * @param params - Optional parameters to pass with the placement.\n * @param handlerId - An optional identifier used to associate specific event handlers (e.g., from `usePlacement`). Defaults to \"default\".\n * @returns A promise that resolves when the placement registration is complete.\n */\n registerPlacement: (\n placement: string,\n params?: Record<string, any>,\n handlerId?: string | null,\n ) => Promise<void>\n /**\n * Retrieves the presentation result for a given placement.\n * This can be used to understand what would happen if a placement were to be registered, without actually registering it.\n * @param placement - The ID of the placement.\n * @param params - Optional parameters for the placement.\n * @returns A promise that resolves with the presentation result.\n */\n getPresentationResult: (placement: string, params?: Record<string, any>) => Promise<any>\n /**\n * Dismisses any currently presented Superwall paywall.\n * @returns A promise that resolves when the dismissal is complete.\n */\n dismiss: () => Promise<void>\n\n /**\n * Preloads all paywalls configured in your Superwall dashboard.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadAllPaywalls: () => Promise<void>\n /**\n * Preloads specific paywalls.\n * @param placements - An array of placement IDs for which to preload paywalls.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadPaywalls: (placements: string[]) => Promise<void>\n\n /**\n * Sets custom attributes for the current user.\n * @param attrs - An object containing the attributes to set.\n * @returns A promise that resolves when attributes are set.\n */\n setUserAttributes: (attrs: Record<string, any>) => Promise<void>\n /**\n * Retrieves the current user's attributes.\n * @returns A promise that resolves with the user's attributes.\n */\n getUserAttributes: () => Promise<Record<string, any>>\n\n /**\n * Sets the logging level for the Superwall SDK.\n * @param level - The desired log level (e.g., \"debug\", \"info\", \"warn\", \"error\", \"none\").\n * @returns A promise that resolves when the log level is set.\n */\n setLogLevel: (level: string) => Promise<void>\n\n /* -------------------- Listener helpers -------------------- */\n /**\n * Initializes native event listeners for the SDK.\n * This is typically called internally by the `SuperwallProvider`.\n * @returns A cleanup function to remove the listeners.\n * @internal\n */\n _initListeners: () => () => void\n\n setSubscriptionStatus: (status: SubscriptionStatus) => Promise<void>\n\n getDeviceAttributes: () => Promise<Record<string, any>>\n}\n\n/**\n * @category Store\n * @since 0.0.15\n * Zustand store for Superwall SDK state and actions.\n * @internal\n */\nexport const useSuperwallStore = create<SuperwallStore>((set, get) => ({\n /* -------------------- State -------------------- */\n isConfigured: false,\n isLoading: false,\n listenersInitialized: false,\n\n user: null,\n subscriptionStatus: {\n status: \"UNKNOWN\",\n },\n\n /* -------------------- Actions -------------------- */\n configure: async (apiKey, options) => {\n set({ isLoading: true })\n const { manualPurchaseManagement, manualPurchaseManagment, ...restOptions } = options || {}\n\n // Support both spellings for backward compatibility\n const isManualPurchaseManagement = manualPurchaseManagement ?? manualPurchaseManagment ?? false\n\n await SuperwallExpoModule.configure(apiKey, restOptions, isManualPurchaseManagement, pkg.version)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({\n isConfigured: true,\n isLoading: false,\n user: currentUser as UserAttributes,\n subscriptionStatus,\n })\n },\n identify: async (userId, options) => {\n SuperwallExpoModule.identify(userId, options)\n\n // TODO: Instead of setting users after identify, we should set this based on an event\n setTimeout(async () => {\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n }, 0)\n },\n reset: async () => {\n SuperwallExpoModule.reset()\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n },\n registerPlacement: async (placement, params, handlerId = \"default\") => {\n await SuperwallExpoModule.registerPlacement(placement, params, handlerId)\n },\n getPresentationResult: async (placement, params) => {\n return SuperwallExpoModule.getPresentationResult(placement, params)\n },\n dismiss: async () => {\n await SuperwallExpoModule.dismiss()\n },\n preloadAllPaywalls: async () => {\n SuperwallExpoModule.preloadAllPaywalls()\n },\n preloadPaywalls: async (placements) => {\n SuperwallExpoModule.preloadPaywalls(placements)\n },\n setUserAttributes: async (attrs) => {\n SuperwallExpoModule.setUserAttributes(attrs)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n set({ user: currentUser as UserAttributes })\n },\n getUserAttributes: async () => {\n const attributes = await SuperwallExpoModule.getUserAttributes()\n set({ user: attributes as UserAttributes })\n return attributes\n },\n setLogLevel: async (level) => {\n SuperwallExpoModule.setLogLevel(level)\n },\n\n setSubscriptionStatus: async (status) => {\n SuperwallExpoModule.setSubscriptionStatus(status)\n },\n getDeviceAttributes: async () => {\n const attributes = await SuperwallExpoModule.getDeviceAttributes()\n return attributes\n },\n\n /* -------------------- Listener helpers -------------------- */\n _initListeners: (): (() => void) => {\n // Use get() to read the state from within the store\n if (get().listenersInitialized) {\n console.warn(\"Listeners already initialized. Skipping.\")\n return () => {} // Return no-op cleanup\n }\n\n const subscriptions: { remove: () => void }[] = []\n\n subscriptions.push(\n SuperwallExpoModule.addListener(\n \"subscriptionStatusDidChange\",\n ({ to }: { to: SubscriptionStatus }) => {\n set({ subscriptionStatus: to })\n },\n ),\n )\n\n set({ listenersInitialized: true })\n console.log(\"Initialized listeners\", subscriptions.length)\n\n return (): void => {\n console.log(\"Cleaning up listeners\", subscriptions.length)\n subscriptions.forEach((s) => s.remove())\n // Reset the state on cleanup\n set({ listenersInitialized: false })\n }\n },\n}))\n\n/**\n * @category Store\n * @since 0.0.15\n * Public interface for the Superwall store, excluding internal methods.\n */\nexport type PublicSuperwallStore = Omit<SuperwallStore, \"configure\" | \"reset\" | \"_initListeners\">\n\nexport const SuperwallContext = createContext<boolean>(false)\n\n/**\n * @category Hooks\n * @since 0.0.15\n * Core React hook for interacting with the Superwall SDK.\n *\n * This hook provides access to the Superwall store, which includes SDK state\n * (like configuration status, user information, subscription status) and actions\n * (like `identify`, `reset`, `registerPlacement`).\n *\n * It must be used within a component that is a descendant of `<SuperwallProvider />`.\n *\n * @template T - Optional type parameter for the selected state. Defaults to the entire `PublicSuperwallStore`.\n * @param selector - An optional function to select a specific slice of the store's state.\n * This is useful for performance optimization, as components will only re-render\n * if the selected part of the state changes. Uses shallow equality checking\n * via `zustand/shallow`. If omitted, the entire store is returned.\n * @returns The selected slice of the Superwall store state, or the entire store if no selector is provided.\n * @throws Error if used outside of a `SuperwallProvider`.\n *\n * @example\n * // Get the entire store\n * const superwall = useSuperwall();\n * console.log(superwall.isConfigured);\n * superwall.identify(\"user_123\");\n *\n * @example\n * // Select specific state properties\n * const { user, subscriptionStatus } = useSuperwall(state => ({\n * user: state.user,\n * subscriptionStatus: state.subscriptionStatus,\n * }));\n * console.log(user?.appUserId, subscriptionStatus?.status);\n */\nexport function useSuperwall<T = PublicSuperwallStore>(selector?: (state: SuperwallStore) => T): T {\n const inProvider = useContext(SuperwallContext)\n if (!inProvider) {\n throw new Error(\"useSuperwall must be used within a SuperwallProvider\")\n }\n\n const identity = (state: SuperwallStore) => state as unknown as T\n // biome-ignore lint/correctness/useHookAtTopLevel: good here\n return useSuperwallStore(selector ? useShallow(selector) : identity)\n}\n"]}
|