expo-superwall 0.8.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/android/src/main/java/expo/modules/superwallexpo/json/SuperwallOptions.kt +4 -1
- package/build/package.json +2 -2
- package/build/src/SuperwallOptions.d.ts +44 -2
- package/build/src/SuperwallOptions.d.ts.map +1 -1
- package/build/src/SuperwallOptions.js +4 -1
- package/build/src/SuperwallOptions.js.map +1 -1
- package/build/src/SuperwallProvider.js +5 -5
- package/build/src/SuperwallProvider.js.map +1 -1
- package/build/src/compat/lib/SuperwallEventInfo.js +1 -1
- package/build/src/compat/lib/SuperwallEventInfo.js.map +1 -1
- package/build/src/compat/lib/SuperwallOptions.d.ts +22 -1
- package/build/src/compat/lib/SuperwallOptions.d.ts.map +1 -1
- package/build/src/compat/lib/SuperwallOptions.js +26 -2
- package/build/src/compat/lib/SuperwallOptions.js.map +1 -1
- package/build/src/useSuperwall.js +3 -3
- package/build/src/useSuperwall.js.map +1 -1
- package/ios/Json/SuperwallOptions+Json.swift +6 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 197c0c8: Add missing SDK configuration options from native iOS and Android SDKs:
|
|
8
|
+
|
|
9
|
+
- `shouldObservePurchases` (iOS & Android): Observe purchases made outside of Superwall
|
|
10
|
+
- `shouldBypassAppTransactionCheck` (iOS only): Disables app transaction check on SDK launch
|
|
11
|
+
- `maxConfigRetryCount` (iOS only): Number of retry attempts for config fetch (default: 6)
|
|
12
|
+
- `useMockReviews` (Android only): Enable mock review functionality
|
|
13
|
+
|
|
14
|
+
Also fixes `enableExperimentalDeviceVariables` not being passed to the Android native SDK.
|
|
15
|
+
|
|
16
|
+
**Breaking change**: Removed deprecated `collectAdServicesAttribution` option (AdServices attribution is now collected automatically by the native iOS SDK).
|
|
17
|
+
|
|
3
18
|
## 0.8.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -12,7 +12,10 @@ fun superwallOptionsFromJson(json: Map<String, Any?>): SuperwallOptions {
|
|
|
12
12
|
options.localeIdentifier = json["localeIdentifier"] as String?
|
|
13
13
|
options.isExternalDataCollectionEnabled = (json["isExternalDataCollectionEnabled"] as Boolean?)?:true
|
|
14
14
|
options.isGameControllerEnabled = (json["isGameControllerEnabled"] as Boolean?)?:false
|
|
15
|
-
|
|
15
|
+
options.passIdentifiersToPlayStore = (json["passIdentifiersToPlayStore"] as Boolean?)?:false
|
|
16
|
+
options.enableExperimentalDeviceVariables = (json["enableExperimentalDeviceVariables"] as Boolean?)?:false
|
|
17
|
+
options.shouldObservePurchases = (json["shouldObservePurchases"] as Boolean?)?:false
|
|
18
|
+
options.useMockReviews = (json["useMockReviews"] as Boolean?)?:false
|
|
16
19
|
|
|
17
20
|
val networkEnvironment = when (json["networkEnvironment"] as String?) {
|
|
18
21
|
"release" -> SuperwallOptions.NetworkEnvironment.Release()
|
package/build/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-superwall",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Offical Expo Integration for Superwall",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"types": "build/src/index.d.ts",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
],
|
|
71
71
|
"packageManager": "yarn@4.7.0",
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"zustand": "^5.0.
|
|
73
|
+
"zustand": "^5.0.9"
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -67,11 +67,32 @@ export interface SuperwallOptions {
|
|
|
67
67
|
localeIdentifier?: string;
|
|
68
68
|
isGameControllerEnabled: boolean;
|
|
69
69
|
logging: LoggingOptions;
|
|
70
|
-
collectAdServicesAttribution: boolean;
|
|
71
70
|
passIdentifiersToPlayStore: boolean;
|
|
72
71
|
storeKitVersion?: "STOREKIT1" | "STOREKIT2";
|
|
73
72
|
enableExperimentalDeviceVariables: boolean;
|
|
74
73
|
manualPurchaseManagement: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Observe purchases made outside of Superwall. When true, Superwall will observe
|
|
76
|
+
* StoreKit/Play Store transactions and report them. Defaults to false.
|
|
77
|
+
* @platform iOS and Android
|
|
78
|
+
*/
|
|
79
|
+
shouldObservePurchases: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Disables the app transaction check on SDK launch. Defaults to false.
|
|
82
|
+
* @platform iOS only
|
|
83
|
+
*/
|
|
84
|
+
shouldBypassAppTransactionCheck: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Number of times the SDK will attempt to get the Superwall configuration after
|
|
87
|
+
* a network failure before it times out. Defaults to 6.
|
|
88
|
+
* @platform iOS only
|
|
89
|
+
*/
|
|
90
|
+
maxConfigRetryCount: number;
|
|
91
|
+
/**
|
|
92
|
+
* Enable mock review functionality. Defaults to false.
|
|
93
|
+
* @platform Android only
|
|
94
|
+
*/
|
|
95
|
+
useMockReviews: boolean;
|
|
75
96
|
}
|
|
76
97
|
/**
|
|
77
98
|
* @category Types
|
|
@@ -87,11 +108,32 @@ export interface PartialSuperwallOptions {
|
|
|
87
108
|
localeIdentifier?: string;
|
|
88
109
|
isGameControllerEnabled?: boolean;
|
|
89
110
|
logging?: Partial<LoggingOptions>;
|
|
90
|
-
collectAdServicesAttribution?: boolean;
|
|
91
111
|
passIdentifiersToPlayStore?: boolean;
|
|
92
112
|
storeKitVersion?: "STOREKIT1" | "STOREKIT2";
|
|
93
113
|
enableExperimentalDeviceVariables?: boolean;
|
|
94
114
|
manualPurchaseManagement?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Observe purchases made outside of Superwall. When true, Superwall will observe
|
|
117
|
+
* StoreKit/Play Store transactions and report them. Defaults to false.
|
|
118
|
+
* @platform iOS and Android
|
|
119
|
+
*/
|
|
120
|
+
shouldObservePurchases?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Disables the app transaction check on SDK launch. Defaults to false.
|
|
123
|
+
* @platform iOS only
|
|
124
|
+
*/
|
|
125
|
+
shouldBypassAppTransactionCheck?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Number of times the SDK will attempt to get the Superwall configuration after
|
|
128
|
+
* a network failure before it times out. Defaults to 6.
|
|
129
|
+
* @platform iOS only
|
|
130
|
+
*/
|
|
131
|
+
maxConfigRetryCount?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Enable mock review functionality. Defaults to false.
|
|
134
|
+
* @platform Android only
|
|
135
|
+
*/
|
|
136
|
+
useMockReviews?: boolean;
|
|
95
137
|
}
|
|
96
138
|
/**
|
|
97
139
|
* @category Models
|
|
@@ -1 +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,GACvB,QAAQ,GACR,SAAS,GACT,eAAe,GACf,iBAAiB,GACjB,iBAAiB,GACjB,YAAY,GACZ,UAAU,GACV,eAAe,GACf,qBAAqB,GACrB,qBAAqB,GACrB,uBAAuB,GACvB,OAAO,GACP,KAAK,CAAA;AAET;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,kBAAkB,GAAG,WAAW,CAAA;AAE7E;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GA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E,OAAO,CAAA;IACxC;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAA;IAC3B;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAA;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG;QACnC,aAAa,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;KACvC,CAAA;IACD,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;IACvC,+BAA+B,CAAC,EAAE,OAAO,CAAA;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IACjC,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC,eAAe,CAAC,EAAE,WAAW,GAAG,WAAW,CAAA;IAC3C,iCAAiC,CAAC,EAAE,OAAO,CAAA;IAC3C,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC;;;OAGG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAA;IACzC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBA4BrC,CAAA"}
|
|
@@ -24,9 +24,12 @@ export const DefaultSuperwallOptions = {
|
|
|
24
24
|
level: "info",
|
|
25
25
|
scopes: ["all"],
|
|
26
26
|
},
|
|
27
|
-
collectAdServicesAttribution: false,
|
|
28
27
|
passIdentifiersToPlayStore: false,
|
|
29
28
|
enableExperimentalDeviceVariables: false,
|
|
30
29
|
manualPurchaseManagement: false,
|
|
30
|
+
shouldObservePurchases: false,
|
|
31
|
+
shouldBypassAppTransactionCheck: false,
|
|
32
|
+
maxConfigRetryCount: 6,
|
|
33
|
+
useMockReviews: false,
|
|
31
34
|
};
|
|
32
35
|
//# sourceMappingURL=SuperwallOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperwallOptions.js","sourceRoot":"","sources":["../../src/SuperwallOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SuperwallOptions.js","sourceRoot":"","sources":["../../src/SuperwallOptions.ts"],"names":[],"mappings":"AAwKA;;;;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;QACpC,sCAAsC,EAAE,KAAK;KAC9C;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,0BAA0B,EAAE,KAAK;IACjC,iCAAiC,EAAE,KAAK;IACxC,wBAAwB,EAAE,KAAK;IAC/B,sBAAsB,EAAE,KAAK;IAC7B,+BAA+B,EAAE,KAAK;IACtC,mBAAmB,EAAE,CAAC;IACtB,cAAc,EAAE,KAAK;CACtB,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 shouldShowWebPurchaseConfirmationAlert: boolean\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 passIdentifiersToPlayStore: boolean\n storeKitVersion?: \"STOREKIT1\" | \"STOREKIT2\"\n enableExperimentalDeviceVariables: boolean\n manualPurchaseManagement: boolean\n /**\n * Observe purchases made outside of Superwall. When true, Superwall will observe\n * StoreKit/Play Store transactions and report them. Defaults to false.\n * @platform iOS and Android\n */\n shouldObservePurchases: boolean\n /**\n * Disables the app transaction check on SDK launch. Defaults to false.\n * @platform iOS only\n */\n shouldBypassAppTransactionCheck: boolean\n /**\n * Number of times the SDK will attempt to get the Superwall configuration after\n * a network failure before it times out. Defaults to 6.\n * @platform iOS only\n */\n maxConfigRetryCount: number\n /**\n * Enable mock review functionality. Defaults to false.\n * @platform Android only\n */\n useMockReviews: boolean\n}\n\n/**\n * @category Types\n * @since 0.2.8\n * Deep partial type for SuperwallOptions, allowing partial configuration at any nesting level.\n */\nexport interface PartialSuperwallOptions {\n paywalls?: Partial<PaywallOptions> & {\n restoreFailed?: Partial<RestoreFailed>\n }\n networkEnvironment?: NetworkEnvironment\n isExternalDataCollectionEnabled?: boolean\n localeIdentifier?: string\n isGameControllerEnabled?: boolean\n logging?: Partial<LoggingOptions>\n passIdentifiersToPlayStore?: boolean\n storeKitVersion?: \"STOREKIT1\" | \"STOREKIT2\"\n enableExperimentalDeviceVariables?: boolean\n manualPurchaseManagement?: boolean\n /**\n * Observe purchases made outside of Superwall. When true, Superwall will observe\n * StoreKit/Play Store transactions and report them. Defaults to false.\n * @platform iOS and Android\n */\n shouldObservePurchases?: boolean\n /**\n * Disables the app transaction check on SDK launch. Defaults to false.\n * @platform iOS only\n */\n shouldBypassAppTransactionCheck?: boolean\n /**\n * Number of times the SDK will attempt to get the Superwall configuration after\n * a network failure before it times out. Defaults to 6.\n * @platform iOS only\n */\n maxConfigRetryCount?: number\n /**\n * Enable mock review functionality. Defaults to false.\n * @platform Android only\n */\n useMockReviews?: 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 shouldShowWebPurchaseConfirmationAlert: false,\n },\n networkEnvironment: \"release\",\n isExternalDataCollectionEnabled: true,\n isGameControllerEnabled: false,\n logging: {\n level: \"info\",\n scopes: [\"all\"],\n },\n passIdentifiersToPlayStore: false,\n enableExperimentalDeviceVariables: false,\n manualPurchaseManagement: false,\n shouldObservePurchases: false,\n shouldBypassAppTransactionCheck: false,\n maxConfigRetryCount: 6,\n useMockReviews: false,\n}\n"]}
|
|
@@ -60,7 +60,7 @@ export function SuperwallProvider({ apiKeys, options, children, onConfigurationE
|
|
|
60
60
|
const apiKey = apiKeys[Platform.OS];
|
|
61
61
|
if (!apiKey) {
|
|
62
62
|
const error = new Error(`No API key provided for platform ${Platform.OS}`);
|
|
63
|
-
console.error("Superwall
|
|
63
|
+
console.error("[Superwall] Configure failed", error);
|
|
64
64
|
onConfigurationError?.(error);
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
@@ -95,23 +95,23 @@ export function SuperwallProvider({ apiKeys, options, children, onConfigurationE
|
|
|
95
95
|
const url = await Linking.getInitialURL();
|
|
96
96
|
if (url && !isExpoDeepLink(url) && !isExpoPlatformUrl(url)) {
|
|
97
97
|
SuperwallExpoModule.handleDeepLink(url).catch((error) => {
|
|
98
|
-
console.debug("Superwall
|
|
98
|
+
console.debug("[Superwall] Non-Superwall deep link ignored", url, error);
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
catch (error) {
|
|
103
|
-
console.debug("Superwall
|
|
103
|
+
console.debug("[Superwall] Failed to get initial URL", error);
|
|
104
104
|
}
|
|
105
105
|
deepLinkEventHandlerRef.current = Linking.addEventListener("url", (event) => {
|
|
106
106
|
if (!isExpoDeepLink(event.url) && !isExpoPlatformUrl(event.url)) {
|
|
107
107
|
SuperwallExpoModule.handleDeepLink(event.url).catch((error) => {
|
|
108
|
-
console.debug("Superwall
|
|
108
|
+
console.debug("[Superwall] Non-Superwall deep link ignored", event.url, error);
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
};
|
|
113
113
|
handleDeepLink().catch((error) => {
|
|
114
|
-
console.error("Superwall
|
|
114
|
+
console.error("[Superwall] Deep link setup failed", error);
|
|
115
115
|
});
|
|
116
116
|
return () => {
|
|
117
117
|
if (deepLinkEventHandlerRef.current) {
|
|
@@ -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;AAEvD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAuBpE;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,CAAC,GAAW,EAAW,EAAE;IAC9C,MAAM,EAAE,GAAG,gCAAgC,CAAA;IAC3C,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACrB,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAW,EAAE;IACjD,MAAM,EAAE,GAAG,oCAAoC,CAAA;IAC/C,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACrB,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,OAAO,EACP,OAAO,EACP,QAAQ,EACR,oBAAoB,GACG;IACvB,MAAM,uBAAuB,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAA;IACjE,MAAM,+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BAAuB,CAAC,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBAC1E,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;oBAChE,mBAAmB,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;wBAC5D,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;oBAChF,CAAC,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAA;QAED,cAAc,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YAC/B,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAA;QAC5D,CAAC,CAAC,CAAA;QAEF,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 { PartialSuperwallOptions } 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?: PartialSuperwallOptions & {\n /** @deprecated Use manualPurchaseManagement instead */\n manualPurchaseManagment?: boolean\n }\n /** App content to render once configured */\n children: ReactNode\n /**\n * Optional callback invoked when SDK configuration fails.\n * Use this to track errors, show custom UI, or implement retry logic.\n * @param error - The error that occurred during configuration\n */\n onConfigurationError?: (error: Error) => void\n}\n\n/**\n * Checks if a URL is an Expo deep link scheme.\n * Matches expo://, exp://, or exp+{slug}:// schemes.\n *\n * @param url - The URL string to check\n * @returns true if the URL is an Expo deep link scheme, false otherwise\n */\nconst isExpoDeepLink = (url: string): boolean => {\n const re = /^(?:expo|exp\\+[^:]+|exp):\\/\\//i\n return re.test(url)\n}\n\n/**\n * Checks if a URL is an Expo platform URL (expo.dev domain).\n *\n * @param url - The URL string to check\n * @returns true if the URL is an Expo platform URL, false otherwise\n */\nconst isExpoPlatformUrl = (url: string): boolean => {\n const re = /^https?:\\/\\/(?:www\\.)?expo\\.dev\\//i\n return re.test(url)\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 children,\n onConfigurationError,\n}: SuperwallProviderProps) {\n const deepLinkEventHandlerRef = useRef<EmitterSubscription>(null)\n const isUsingCustomPurchaseController = !!useCustomPurchaseController()\n\n const { isConfigured, isLoading, configure, configurationError } = useSuperwallStore(\n useShallow((state) => ({\n isConfigured: state.isConfigured,\n isLoading: state.isLoading,\n configure: state.configure,\n configurationError: state.configurationError,\n })),\n )\n\n useEffect(() => {\n if (!isConfigured && !isLoading && !configurationError) {\n const apiKey = apiKeys[Platform.OS as keyof typeof apiKeys]\n if (!apiKey) {\n const error = new Error(`No API key provided for platform ${Platform.OS}`)\n console.error(\"[Superwall] Configure failed\", error)\n onConfigurationError?.(error)\n return\n }\n\n configure(apiKey, {\n ...options,\n manualPurchaseManagement: isUsingCustomPurchaseController,\n })\n }\n }, [\n isConfigured,\n isUsingCustomPurchaseController,\n isLoading,\n configurationError,\n apiKeys,\n options,\n configure,\n onConfigurationError,\n ])\n\n // Notify callback when configuration error changes\n useEffect(() => {\n if (configurationError && onConfigurationError) {\n onConfigurationError(new Error(configurationError))\n }\n }, [configurationError, onConfigurationError])\n\n useEffect(() => {\n const cleanup = useSuperwallStore.getState()._initListeners()\n\n return cleanup\n }, [])\n\n useEffect(() => {\n const handleDeepLink = async () => {\n try {\n const url = await Linking.getInitialURL()\n if (url && !isExpoDeepLink(url) && !isExpoPlatformUrl(url)) {\n SuperwallExpoModule.handleDeepLink(url).catch((error) => {\n console.debug(\"[Superwall] Non-Superwall deep link ignored\", url, error)\n })\n }\n } catch (error) {\n console.debug(\"[Superwall] Failed to get initial URL\", error)\n }\n\n deepLinkEventHandlerRef.current = Linking.addEventListener(\"url\", (event) => {\n if (!isExpoDeepLink(event.url) && !isExpoPlatformUrl(event.url)) {\n SuperwallExpoModule.handleDeepLink(event.url).catch((error) => {\n console.debug(\"[Superwall] Non-Superwall deep link ignored\", event.url, error)\n })\n }\n })\n }\n\n handleDeepLink().catch((error) => {\n console.error(\"[Superwall] Deep link setup failed\", error)\n })\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"]}
|
|
@@ -340,7 +340,7 @@ export class SuperwallEvent {
|
|
|
340
340
|
error: json.error,
|
|
341
341
|
});
|
|
342
342
|
default:
|
|
343
|
-
console.warn(`Unhandled event type in SuperwallEvent.fromJson: ${json.event}`);
|
|
343
|
+
console.warn(`[Superwall] Unhandled event type in SuperwallEvent.fromJson: ${json.event}`);
|
|
344
344
|
return new SuperwallEvent({ type: eventType }); // Fallback for unhandled but known types
|
|
345
345
|
// For truly unknown types, an error might be more appropriate:
|
|
346
346
|
// throw new Error(`Invalid event type: ${json.event}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperwallEventInfo.js","sourceRoot":"","sources":["../../../../src/compat/lib/SuperwallEventInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EACL,gCAAgC,EAChC,sCAAsC,GACvC,MAAM,oCAAoC,CAAA;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAC7B,KAAK,CAAgB;IACrB,MAAM,CAAsB;IAE5B,YAAY,KAAqB,EAAE,MAA4B;QAC7D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAS;QACvB,OAAO,IAAI,kBAAkB,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACjF,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,CAA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AO,IAAI,cAAc,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;YAChD,KAAK,SAAS,CAAC,SAAS,EAAE,iCAAiC;gBACzD,OAAO,IAAI,cAAc,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;YAChD,KAAK,SAAS,CAAC,kBAAkB;gBAC/B,OAAO,IAAI,cAAc,CAAC;oBACxB,IAAI,EAAE,SAAS;oBACf,cAAc,EAAE,IAAI,CAAC,cAAc;oBACnC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;iBACxC,CAAC,CAAA;YACJ,KAAK,SAAS,CAAC,qBAAqB;gBAClC,OAAO,IAAI,cAAc,CAAC;oBACxB,IAAI,EAAE,SAAS;oBACf,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;iBAChD,CAAC,CAAA;YACJ,KAAK,SAAS,CAAC,eAAe,CAAC;YAC/B,KAAK,SAAS,CAAC,aAAa,CAAC;YAC7B,KAAK,SAAS,CAAC,YAAY;gBACzB,OAAO,IAAI,cAAc,CAAC;oBACxB,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE,IAAI,CAAC,KAAK;iBAClB,CAAC,CAAA;YACJ,KAAK,SAAS,CAAC,uBAAuB;gBACpC,OAAO,IAAI,cAAc,CAAC;oBACxB,IAAI,EAAE,SAAS;oBACf,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,KAAK,EAAE,IAAI,CAAC,KAAK;iBAClB,CAAC,CAAA;YACJ;gBACE,OAAO,CAAC,IAAI,CAAC,oDAAoD,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;gBAC9E,OAAO,IAAI,cAAc,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA,CAAC,yCAAyC;YAC1F,+DAA+D;YAC/D,wDAAwD;QAC1D,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { Entitlement } from \"./Entitlement\"\nimport { PaywallInfo } from \"./PaywallInfo\"\nimport {\n PaywallPresentationRequestStatus,\n PaywallPresentationRequestStatusReason,\n} from \"./PaywallPresentationRequestStatus\"\nimport type { RestoreType } from \"./RestoreType\"\nimport { StoreProduct } from \"./StoreProduct\"\nimport { StoreTransaction } from \"./StoreTransaction\"\nimport type { SubscriptionStatus } from \"./SubscriptionStatus\"\nimport { Survey, SurveyOption } from \"./Survey\"\nimport { TriggerResult } from \"./TriggerResult\"\n\n/**\n * @category Events\n * @since 0.0.15\n * Contains information about a Superwall event.\n */\nexport class SuperwallEventInfo {\n event: SuperwallEvent\n params?: Record<string, any>\n\n constructor(event: SuperwallEvent, params?: Record<string, any>) {\n this.event = event\n this.params = params\n }\n\n static fromJson(json: any): SuperwallEventInfo {\n return new SuperwallEventInfo(SuperwallEvent.fromJson(json.event), json.params)\n }\n}\n\n/**\n * @category Enums\n * @since 0.0.15\n * Enum representing the types of Superwall events.\n */\nexport enum EventType {\n firstSeen = \"firstSeen\",\n configRefresh = \"configRefresh\",\n appOpen = \"appOpen\",\n appLaunch = \"appLaunch\",\n identityAlias = \"identityAlias\",\n appInstall = \"appInstall\",\n sessionStart = \"sessionStart\",\n deviceAttributes = \"deviceAttributes\",\n subscriptionStatusDidChange = \"subscriptionStatusDidChange\",\n appClose = \"appClose\",\n deepLink = \"deepLink\",\n triggerFire = \"triggerFire\",\n paywallOpen = \"paywallOpen\",\n paywallClose = \"paywallClose\",\n paywallDecline = \"paywallDecline\",\n transactionStart = \"transactionStart\",\n transactionFail = \"transactionFail\",\n transactionAbandon = \"transactionAbandon\",\n transactionComplete = \"transactionComplete\",\n subscriptionStart = \"subscriptionStart\",\n freeTrialStart = \"freeTrialStart\",\n transactionRestore = \"transactionRestore\",\n transactionTimeout = \"transactionTimeout\",\n userAttributes = \"userAttributes\",\n nonRecurringProductPurchase = \"nonRecurringProductPurchase\",\n paywallResponseLoadStart = \"paywallResponseLoadStart\",\n paywallResponseLoadNotFound = \"paywallResponseLoadNotFound\",\n paywallResponseLoadFail = \"paywallResponseLoadFail\",\n paywallResponseLoadComplete = \"paywallResponseLoadComplete\",\n paywallWebviewLoadStart = \"paywallWebviewLoadStart\",\n paywallWebviewLoadFail = \"paywallWebviewLoadFail\",\n paywallWebviewLoadComplete = \"paywallWebviewLoadComplete\",\n paywallWebviewLoadTimeout = \"paywallWebviewLoadTimeout\",\n paywallWebviewLoadFallback = \"paywallWebviewLoadFallback\",\n paywallProductsLoadStart = \"paywallProductsLoadStart\",\n paywallProductsLoadFail = \"paywallProductsLoadFail\",\n paywallProductsLoadComplete = \"paywallProductsLoadComplete\",\n paywallProductsLoadRetry = \"paywallProductsLoadRetry\",\n surveyResponse = \"surveyResponse\",\n paywallPresentationRequest = \"paywallPresentationRequest\",\n touchesBegan = \"touchesBegan\",\n surveyClose = \"surveyClose\",\n reset = \"reset\",\n restoreStart = \"restoreStart\",\n restoreComplete = \"restoreComplete\",\n restoreFail = \"restoreFail\",\n configAttributes = \"configAttributes\",\n customPlacement = \"customPlacement\",\n errorThrown = \"errorThrown\",\n confirmAllAssignments = \"confirmAllAssignments\",\n configFail = \"configFail\",\n adServicesTokenRequestStart = \"adServicesTokenRequestStart\",\n adServicesTokenRequestFail = \"adServicesTokenRequestFail\",\n adServicesTokenRequestComplete = \"adServicesTokenRequestComplete\",\n shimmerViewStart = \"shimmerViewStart\",\n shimmerViewComplete = \"shimmerViewComplete\",\n redemptionStart = \"redemptionStart\",\n redemptionComplete = \"redemptionComplete\",\n redemptionFail = \"redemptionFail\",\n enrichmentStart = \"enrichmentStart\",\n enrichmentComplete = \"enrichmentComplete\",\n enrichmentFail = \"enrichmentFail\",\n integrationAttributes = \"integrationAttributes\",\n expressionResult = \"expressionResult\",\n reviewRequested = \"reviewRequested\",\n reviewGranted = \"reviewGranted\", \n reviewDenied = \"reviewDenied\",\n paywallResourceLoadFail = \"paywallResourceLoadFail\",\n networkDecodingFail = \"networkDecodingFail\",\n handleLog = \"handleLog\",\n}\n\n/**\n * @category Events\n * @since 0.0.15\n * Represents a Superwall event with its associated data.\n */\nexport class SuperwallEvent {\n type: EventType | undefined\n placementName?: string\n deviceAttributes?: Record<string, any>\n deepLinkUrl?: string\n result?: TriggerResult\n paywallInfo?: PaywallInfo\n transaction?: StoreTransaction\n product?: StoreProduct\n error?: string\n message?: string\n triggeredEventName?: string\n survey?: Survey\n selectedOption?: SurveyOption\n customResponse?: string\n status?: PaywallPresentationRequestStatus\n reason?: PaywallPresentationRequestStatusReason\n restoreType?: RestoreType\n userAttributes?: Record<string, any>\n audienceFilterParams?: Record<string, any>\n count?: number\n duration?: number\n url?: string\n errorMessage?: string\n userEnrichment?: Record<string, any>\n deviceEnrichment?: Record<string, any>\n\n private constructor(options: {\n type: EventType\n placementName?: string\n deviceAttributes?: Record<string, any>\n deepLinkUrl?: string\n result?: TriggerResult\n paywallInfo?: PaywallInfo\n transaction?: StoreTransaction\n product?: StoreProduct\n error?: string\n message?: string\n triggeredEventName?: string\n survey?: Survey\n selectedOption?: SurveyOption\n customResponse?: string\n status?: PaywallPresentationRequestStatus\n reason?: PaywallPresentationRequestStatusReason\n restoreType?: RestoreType\n userAttributes?: Record<string, any>\n attempt?: number\n name?: string\n params?: Record<string, any>\n token?: string\n from?: { status: SubscriptionStatus; entitlements: Entitlement[] }\n to?: { status: SubscriptionStatus; entitlements: Entitlement[] }\n audienceFilterParams?: Record<string, any>\n count?: number\n duration?: number\n url?: string\n errorMessage?: string\n userEnrichment?: Record<string, any>\n deviceEnrichment?: Record<string, any>\n }) {\n Object.assign(this, options)\n }\n\n static fromJson(json: any): SuperwallEvent {\n const eventType = EventType[json.event as keyof typeof EventType]\n\n // Example for one case, replicate logic for other cases as needed\n switch (eventType) {\n case EventType.configRefresh:\n case EventType.firstSeen:\n case EventType.appOpen:\n case EventType.appLaunch:\n case EventType.identityAlias:\n case EventType.appInstall:\n case EventType.sessionStart:\n case EventType.appClose:\n case EventType.touchesBegan:\n case EventType.surveyClose:\n case EventType.reset:\n case EventType.restoreStart:\n case EventType.restoreComplete:\n case EventType.configAttributes:\n case EventType.configFail:\n case EventType.adServicesTokenRequestStart:\n case EventType.errorThrown:\n case EventType.confirmAllAssignments:\n case EventType.shimmerViewStart:\n case EventType.subscriptionStatusDidChange:\n case EventType.enrichmentFail:\n case EventType.networkDecodingFail:\n case EventType.expressionResult:\n return new SuperwallEvent({ type: eventType })\n case EventType.shimmerViewComplete:\n return new SuperwallEvent({\n type: eventType,\n duration: json.duration,\n })\n case EventType.restoreFail:\n return new SuperwallEvent({\n type: eventType,\n message: json.message,\n })\n case EventType.deviceAttributes:\n return new SuperwallEvent({\n type: eventType,\n deviceAttributes: json.attributes,\n })\n case EventType.deepLink:\n return new SuperwallEvent({\n type: eventType,\n deepLinkUrl: json.url,\n })\n case EventType.triggerFire:\n return new SuperwallEvent({\n type: eventType,\n placementName: eventType, // TODO: This seems incorrect, should be json.eventName or similar\n result: TriggerResult.fromJson(json.result),\n })\n case EventType.paywallOpen:\n case EventType.paywallClose:\n case EventType.paywallDecline:\n case EventType.transactionRestore: // Note: transactionRestore was duplicated, keeping one\n case EventType.paywallWebviewLoadStart:\n case EventType.paywallWebviewLoadComplete:\n case EventType.paywallWebviewLoadTimeout:\n case EventType.paywallWebviewLoadFallback:\n return new SuperwallEvent({\n type: eventType,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n case EventType.paywallWebviewLoadFail:\n return new SuperwallEvent({\n type: eventType,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n errorMessage: json.errorMessage,\n })\n case EventType.transactionStart:\n case EventType.transactionAbandon:\n case EventType.subscriptionStart:\n case EventType.freeTrialStart:\n case EventType.nonRecurringProductPurchase:\n return new SuperwallEvent({\n type: eventType,\n product: StoreProduct.fromJson(json.product),\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n case EventType.transactionFail:\n return new SuperwallEvent({\n type: eventType,\n error: json.error,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n case EventType.transactionComplete:\n return new SuperwallEvent({\n type: eventType,\n transaction: json.transaction ? StoreTransaction.fromJson(json.transaction) : undefined,\n product: StoreProduct.fromJson(json.product),\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n // case EventType.transactionRestore: // Already handled above\n // return new SuperwallEvent({\n // type: eventType,\n // restoreType: RestoreType.fromJson(json.restoreType),\n // paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n // });\n case EventType.userAttributes:\n return new SuperwallEvent({\n type: eventType,\n userAttributes: json.attributes,\n })\n case EventType.paywallResponseLoadStart:\n case EventType.paywallResponseLoadNotFound:\n case EventType.paywallResponseLoadFail:\n return new SuperwallEvent({\n type: eventType,\n triggeredEventName: json.triggeredEventName,\n })\n case EventType.paywallResponseLoadComplete:\n case EventType.paywallProductsLoadStart:\n case EventType.paywallProductsLoadComplete:\n return new SuperwallEvent({\n type: eventType,\n triggeredEventName: json.triggeredEventName, // Assuming this should be based on json.paywallInfo or similar\n })\n case EventType.paywallProductsLoadFail:\n return new SuperwallEvent({\n type: eventType,\n triggeredEventName: json.triggeredEventName,\n errorMessage: json.errorMessage,\n })\n case EventType.paywallProductsLoadRetry:\n return new SuperwallEvent({\n type: eventType,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n triggeredEventName: json.triggeredEventName,\n attempt: json.attempt,\n })\n case EventType.surveyResponse:\n return new SuperwallEvent({\n type: eventType,\n survey: Survey.fromJson(json.survey),\n selectedOption: SurveyOption.fromJson(json.selectedOption),\n customResponse: json.customResponse,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n case EventType.paywallPresentationRequest:\n return new SuperwallEvent({\n type: eventType,\n status: PaywallPresentationRequestStatus.fromJson(json.status),\n reason: json.reason\n ? PaywallPresentationRequestStatusReason.fromJson(json.reason)\n : undefined,\n })\n case EventType.customPlacement:\n return new SuperwallEvent({\n type: eventType,\n name: json.name,\n params: json.params,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n case EventType.adServicesTokenRequestFail:\n return new SuperwallEvent({\n type: eventType,\n error: json.error,\n })\n case EventType.adServicesTokenRequestComplete:\n return new SuperwallEvent({\n type: eventType,\n token: json.token,\n })\n case EventType.transactionTimeout:\n return new SuperwallEvent({\n type: eventType,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n // case EventType.shimmerViewComplete: // Already handled\n // return new SuperwallEvent({ type: eventType });\n case EventType.redemptionStart:\n return new SuperwallEvent({ type: eventType })\n case EventType.redemptionComplete:\n return new SuperwallEvent({ type: eventType }) // Potentially add redemption info\n case EventType.redemptionFail:\n return new SuperwallEvent({ type: eventType }) // Potentially add error info\n case EventType.enrichmentStart:\n return new SuperwallEvent({ type: eventType })\n case EventType.handleLog: // Consider adding log parameters\n return new SuperwallEvent({ type: eventType })\n case EventType.enrichmentComplete:\n return new SuperwallEvent({\n type: eventType,\n userEnrichment: json.userEnrichment,\n deviceEnrichment: json.deviceEnrichment,\n })\n case EventType.integrationAttributes:\n return new SuperwallEvent({\n type: eventType,\n audienceFilterParams: json.audienceFilterParams,\n })\n case EventType.reviewRequested:\n case EventType.reviewGranted:\n case EventType.reviewDenied:\n return new SuperwallEvent({\n type: eventType,\n count: json.count,\n })\n case EventType.paywallResourceLoadFail:\n return new SuperwallEvent({\n type: eventType,\n url: json.url,\n error: json.error,\n })\n default:\n console.warn(`Unhandled event type in SuperwallEvent.fromJson: ${json.event}`)\n return new SuperwallEvent({ type: eventType }) // Fallback for unhandled but known types\n // For truly unknown types, an error might be more appropriate:\n // throw new Error(`Invalid event type: ${json.event}`);\n }\n }\n}\n\n/**\n * @category Types\n * @since 0.0.15\n * Alias for SuperwallEventInfo, representing information about a Superwall placement.\n */\nexport type SuperwallPlacementInfo = SuperwallEventInfo\n/**\n * @category Types\n * @since 0.0.15\n * Alias for SuperwallEvent, representing a Superwall placement event.\n */\nexport type SuperwallPlacement = SuperwallEvent\n"]}
|
|
1
|
+
{"version":3,"file":"SuperwallEventInfo.js","sourceRoot":"","sources":["../../../../src/compat/lib/SuperwallEventInfo.ts"],"names":[],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AAI,CAAC,oBAAoB;iBAChD,CAAC,CAAA;YACJ,KAAK,SAAS,CAAC,eAAe,CAAC;YAC/B,KAAK,SAAS,CAAC,aAAa,CAAC;YAC7B,KAAK,SAAS,CAAC,YAAY;gBACzB,OAAO,IAAI,cAAc,CAAC;oBACxB,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE,IAAI,CAAC,KAAK;iBAClB,CAAC,CAAA;YACJ,KAAK,SAAS,CAAC,uBAAuB;gBACpC,OAAO,IAAI,cAAc,CAAC;oBACxB,IAAI,EAAE,SAAS;oBACf,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,KAAK,EAAE,IAAI,CAAC,KAAK;iBAClB,CAAC,CAAA;YACJ;gBACE,OAAO,CAAC,IAAI,CAAC,gEAAgE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;gBAC1F,OAAO,IAAI,cAAc,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA,CAAC,yCAAyC;YAC1F,+DAA+D;YAC/D,wDAAwD;QAC1D,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { Entitlement } from \"./Entitlement\"\nimport { PaywallInfo } from \"./PaywallInfo\"\nimport {\n PaywallPresentationRequestStatus,\n PaywallPresentationRequestStatusReason,\n} from \"./PaywallPresentationRequestStatus\"\nimport type { RestoreType } from \"./RestoreType\"\nimport { StoreProduct } from \"./StoreProduct\"\nimport { StoreTransaction } from \"./StoreTransaction\"\nimport type { SubscriptionStatus } from \"./SubscriptionStatus\"\nimport { Survey, SurveyOption } from \"./Survey\"\nimport { TriggerResult } from \"./TriggerResult\"\n\n/**\n * @category Events\n * @since 0.0.15\n * Contains information about a Superwall event.\n */\nexport class SuperwallEventInfo {\n event: SuperwallEvent\n params?: Record<string, any>\n\n constructor(event: SuperwallEvent, params?: Record<string, any>) {\n this.event = event\n this.params = params\n }\n\n static fromJson(json: any): SuperwallEventInfo {\n return new SuperwallEventInfo(SuperwallEvent.fromJson(json.event), json.params)\n }\n}\n\n/**\n * @category Enums\n * @since 0.0.15\n * Enum representing the types of Superwall events.\n */\nexport enum EventType {\n firstSeen = \"firstSeen\",\n configRefresh = \"configRefresh\",\n appOpen = \"appOpen\",\n appLaunch = \"appLaunch\",\n identityAlias = \"identityAlias\",\n appInstall = \"appInstall\",\n sessionStart = \"sessionStart\",\n deviceAttributes = \"deviceAttributes\",\n subscriptionStatusDidChange = \"subscriptionStatusDidChange\",\n appClose = \"appClose\",\n deepLink = \"deepLink\",\n triggerFire = \"triggerFire\",\n paywallOpen = \"paywallOpen\",\n paywallClose = \"paywallClose\",\n paywallDecline = \"paywallDecline\",\n transactionStart = \"transactionStart\",\n transactionFail = \"transactionFail\",\n transactionAbandon = \"transactionAbandon\",\n transactionComplete = \"transactionComplete\",\n subscriptionStart = \"subscriptionStart\",\n freeTrialStart = \"freeTrialStart\",\n transactionRestore = \"transactionRestore\",\n transactionTimeout = \"transactionTimeout\",\n userAttributes = \"userAttributes\",\n nonRecurringProductPurchase = \"nonRecurringProductPurchase\",\n paywallResponseLoadStart = \"paywallResponseLoadStart\",\n paywallResponseLoadNotFound = \"paywallResponseLoadNotFound\",\n paywallResponseLoadFail = \"paywallResponseLoadFail\",\n paywallResponseLoadComplete = \"paywallResponseLoadComplete\",\n paywallWebviewLoadStart = \"paywallWebviewLoadStart\",\n paywallWebviewLoadFail = \"paywallWebviewLoadFail\",\n paywallWebviewLoadComplete = \"paywallWebviewLoadComplete\",\n paywallWebviewLoadTimeout = \"paywallWebviewLoadTimeout\",\n paywallWebviewLoadFallback = \"paywallWebviewLoadFallback\",\n paywallProductsLoadStart = \"paywallProductsLoadStart\",\n paywallProductsLoadFail = \"paywallProductsLoadFail\",\n paywallProductsLoadComplete = \"paywallProductsLoadComplete\",\n paywallProductsLoadRetry = \"paywallProductsLoadRetry\",\n surveyResponse = \"surveyResponse\",\n paywallPresentationRequest = \"paywallPresentationRequest\",\n touchesBegan = \"touchesBegan\",\n surveyClose = \"surveyClose\",\n reset = \"reset\",\n restoreStart = \"restoreStart\",\n restoreComplete = \"restoreComplete\",\n restoreFail = \"restoreFail\",\n configAttributes = \"configAttributes\",\n customPlacement = \"customPlacement\",\n errorThrown = \"errorThrown\",\n confirmAllAssignments = \"confirmAllAssignments\",\n configFail = \"configFail\",\n adServicesTokenRequestStart = \"adServicesTokenRequestStart\",\n adServicesTokenRequestFail = \"adServicesTokenRequestFail\",\n adServicesTokenRequestComplete = \"adServicesTokenRequestComplete\",\n shimmerViewStart = \"shimmerViewStart\",\n shimmerViewComplete = \"shimmerViewComplete\",\n redemptionStart = \"redemptionStart\",\n redemptionComplete = \"redemptionComplete\",\n redemptionFail = \"redemptionFail\",\n enrichmentStart = \"enrichmentStart\",\n enrichmentComplete = \"enrichmentComplete\",\n enrichmentFail = \"enrichmentFail\",\n integrationAttributes = \"integrationAttributes\",\n expressionResult = \"expressionResult\",\n reviewRequested = \"reviewRequested\",\n reviewGranted = \"reviewGranted\", \n reviewDenied = \"reviewDenied\",\n paywallResourceLoadFail = \"paywallResourceLoadFail\",\n networkDecodingFail = \"networkDecodingFail\",\n handleLog = \"handleLog\",\n}\n\n/**\n * @category Events\n * @since 0.0.15\n * Represents a Superwall event with its associated data.\n */\nexport class SuperwallEvent {\n type: EventType | undefined\n placementName?: string\n deviceAttributes?: Record<string, any>\n deepLinkUrl?: string\n result?: TriggerResult\n paywallInfo?: PaywallInfo\n transaction?: StoreTransaction\n product?: StoreProduct\n error?: string\n message?: string\n triggeredEventName?: string\n survey?: Survey\n selectedOption?: SurveyOption\n customResponse?: string\n status?: PaywallPresentationRequestStatus\n reason?: PaywallPresentationRequestStatusReason\n restoreType?: RestoreType\n userAttributes?: Record<string, any>\n audienceFilterParams?: Record<string, any>\n count?: number\n duration?: number\n url?: string\n errorMessage?: string\n userEnrichment?: Record<string, any>\n deviceEnrichment?: Record<string, any>\n\n private constructor(options: {\n type: EventType\n placementName?: string\n deviceAttributes?: Record<string, any>\n deepLinkUrl?: string\n result?: TriggerResult\n paywallInfo?: PaywallInfo\n transaction?: StoreTransaction\n product?: StoreProduct\n error?: string\n message?: string\n triggeredEventName?: string\n survey?: Survey\n selectedOption?: SurveyOption\n customResponse?: string\n status?: PaywallPresentationRequestStatus\n reason?: PaywallPresentationRequestStatusReason\n restoreType?: RestoreType\n userAttributes?: Record<string, any>\n attempt?: number\n name?: string\n params?: Record<string, any>\n token?: string\n from?: { status: SubscriptionStatus; entitlements: Entitlement[] }\n to?: { status: SubscriptionStatus; entitlements: Entitlement[] }\n audienceFilterParams?: Record<string, any>\n count?: number\n duration?: number\n url?: string\n errorMessage?: string\n userEnrichment?: Record<string, any>\n deviceEnrichment?: Record<string, any>\n }) {\n Object.assign(this, options)\n }\n\n static fromJson(json: any): SuperwallEvent {\n const eventType = EventType[json.event as keyof typeof EventType]\n\n // Example for one case, replicate logic for other cases as needed\n switch (eventType) {\n case EventType.configRefresh:\n case EventType.firstSeen:\n case EventType.appOpen:\n case EventType.appLaunch:\n case EventType.identityAlias:\n case EventType.appInstall:\n case EventType.sessionStart:\n case EventType.appClose:\n case EventType.touchesBegan:\n case EventType.surveyClose:\n case EventType.reset:\n case EventType.restoreStart:\n case EventType.restoreComplete:\n case EventType.configAttributes:\n case EventType.configFail:\n case EventType.adServicesTokenRequestStart:\n case EventType.errorThrown:\n case EventType.confirmAllAssignments:\n case EventType.shimmerViewStart:\n case EventType.subscriptionStatusDidChange:\n case EventType.enrichmentFail:\n case EventType.networkDecodingFail:\n case EventType.expressionResult:\n return new SuperwallEvent({ type: eventType })\n case EventType.shimmerViewComplete:\n return new SuperwallEvent({\n type: eventType,\n duration: json.duration,\n })\n case EventType.restoreFail:\n return new SuperwallEvent({\n type: eventType,\n message: json.message,\n })\n case EventType.deviceAttributes:\n return new SuperwallEvent({\n type: eventType,\n deviceAttributes: json.attributes,\n })\n case EventType.deepLink:\n return new SuperwallEvent({\n type: eventType,\n deepLinkUrl: json.url,\n })\n case EventType.triggerFire:\n return new SuperwallEvent({\n type: eventType,\n placementName: eventType, // TODO: This seems incorrect, should be json.eventName or similar\n result: TriggerResult.fromJson(json.result),\n })\n case EventType.paywallOpen:\n case EventType.paywallClose:\n case EventType.paywallDecline:\n case EventType.transactionRestore: // Note: transactionRestore was duplicated, keeping one\n case EventType.paywallWebviewLoadStart:\n case EventType.paywallWebviewLoadComplete:\n case EventType.paywallWebviewLoadTimeout:\n case EventType.paywallWebviewLoadFallback:\n return new SuperwallEvent({\n type: eventType,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n case EventType.paywallWebviewLoadFail:\n return new SuperwallEvent({\n type: eventType,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n errorMessage: json.errorMessage,\n })\n case EventType.transactionStart:\n case EventType.transactionAbandon:\n case EventType.subscriptionStart:\n case EventType.freeTrialStart:\n case EventType.nonRecurringProductPurchase:\n return new SuperwallEvent({\n type: eventType,\n product: StoreProduct.fromJson(json.product),\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n case EventType.transactionFail:\n return new SuperwallEvent({\n type: eventType,\n error: json.error,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n case EventType.transactionComplete:\n return new SuperwallEvent({\n type: eventType,\n transaction: json.transaction ? StoreTransaction.fromJson(json.transaction) : undefined,\n product: StoreProduct.fromJson(json.product),\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n // case EventType.transactionRestore: // Already handled above\n // return new SuperwallEvent({\n // type: eventType,\n // restoreType: RestoreType.fromJson(json.restoreType),\n // paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n // });\n case EventType.userAttributes:\n return new SuperwallEvent({\n type: eventType,\n userAttributes: json.attributes,\n })\n case EventType.paywallResponseLoadStart:\n case EventType.paywallResponseLoadNotFound:\n case EventType.paywallResponseLoadFail:\n return new SuperwallEvent({\n type: eventType,\n triggeredEventName: json.triggeredEventName,\n })\n case EventType.paywallResponseLoadComplete:\n case EventType.paywallProductsLoadStart:\n case EventType.paywallProductsLoadComplete:\n return new SuperwallEvent({\n type: eventType,\n triggeredEventName: json.triggeredEventName, // Assuming this should be based on json.paywallInfo or similar\n })\n case EventType.paywallProductsLoadFail:\n return new SuperwallEvent({\n type: eventType,\n triggeredEventName: json.triggeredEventName,\n errorMessage: json.errorMessage,\n })\n case EventType.paywallProductsLoadRetry:\n return new SuperwallEvent({\n type: eventType,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n triggeredEventName: json.triggeredEventName,\n attempt: json.attempt,\n })\n case EventType.surveyResponse:\n return new SuperwallEvent({\n type: eventType,\n survey: Survey.fromJson(json.survey),\n selectedOption: SurveyOption.fromJson(json.selectedOption),\n customResponse: json.customResponse,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n case EventType.paywallPresentationRequest:\n return new SuperwallEvent({\n type: eventType,\n status: PaywallPresentationRequestStatus.fromJson(json.status),\n reason: json.reason\n ? PaywallPresentationRequestStatusReason.fromJson(json.reason)\n : undefined,\n })\n case EventType.customPlacement:\n return new SuperwallEvent({\n type: eventType,\n name: json.name,\n params: json.params,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n case EventType.adServicesTokenRequestFail:\n return new SuperwallEvent({\n type: eventType,\n error: json.error,\n })\n case EventType.adServicesTokenRequestComplete:\n return new SuperwallEvent({\n type: eventType,\n token: json.token,\n })\n case EventType.transactionTimeout:\n return new SuperwallEvent({\n type: eventType,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n // case EventType.shimmerViewComplete: // Already handled\n // return new SuperwallEvent({ type: eventType });\n case EventType.redemptionStart:\n return new SuperwallEvent({ type: eventType })\n case EventType.redemptionComplete:\n return new SuperwallEvent({ type: eventType }) // Potentially add redemption info\n case EventType.redemptionFail:\n return new SuperwallEvent({ type: eventType }) // Potentially add error info\n case EventType.enrichmentStart:\n return new SuperwallEvent({ type: eventType })\n case EventType.handleLog: // Consider adding log parameters\n return new SuperwallEvent({ type: eventType })\n case EventType.enrichmentComplete:\n return new SuperwallEvent({\n type: eventType,\n userEnrichment: json.userEnrichment,\n deviceEnrichment: json.deviceEnrichment,\n })\n case EventType.integrationAttributes:\n return new SuperwallEvent({\n type: eventType,\n audienceFilterParams: json.audienceFilterParams,\n })\n case EventType.reviewRequested:\n case EventType.reviewGranted:\n case EventType.reviewDenied:\n return new SuperwallEvent({\n type: eventType,\n count: json.count,\n })\n case EventType.paywallResourceLoadFail:\n return new SuperwallEvent({\n type: eventType,\n url: json.url,\n error: json.error,\n })\n default:\n console.warn(`[Superwall] Unhandled event type in SuperwallEvent.fromJson: ${json.event}`)\n return new SuperwallEvent({ type: eventType }) // Fallback for unhandled but known types\n // For truly unknown types, an error might be more appropriate:\n // throw new Error(`Invalid event type: ${json.event}`);\n }\n }\n}\n\n/**\n * @category Types\n * @since 0.0.15\n * Alias for SuperwallEventInfo, representing information about a Superwall placement.\n */\nexport type SuperwallPlacementInfo = SuperwallEventInfo\n/**\n * @category Types\n * @since 0.0.15\n * Alias for SuperwallEvent, representing a Superwall placement event.\n */\nexport type SuperwallPlacement = SuperwallEvent\n"]}
|
|
@@ -33,10 +33,31 @@ export declare class SuperwallOptions {
|
|
|
33
33
|
localeIdentifier?: string;
|
|
34
34
|
isGameControllerEnabled: boolean;
|
|
35
35
|
logging: LoggingOptions;
|
|
36
|
-
collectAdServicesAttribution: boolean;
|
|
37
36
|
passIdentifiersToPlayStore: boolean;
|
|
38
37
|
storeKitVersion?: "STOREKIT1" | "STOREKIT2";
|
|
39
38
|
enableExperimentalDeviceVariables: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Observe purchases made outside of Superwall. When true, Superwall will observe
|
|
41
|
+
* StoreKit/Play Store transactions and report them. Defaults to false.
|
|
42
|
+
* @platform iOS and Android
|
|
43
|
+
*/
|
|
44
|
+
shouldObservePurchases: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Disables the app transaction check on SDK launch. Defaults to false.
|
|
47
|
+
* @platform iOS only
|
|
48
|
+
*/
|
|
49
|
+
shouldBypassAppTransactionCheck: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Number of times the SDK will attempt to get the Superwall configuration after
|
|
52
|
+
* a network failure before it times out. Defaults to 6.
|
|
53
|
+
* @platform iOS only
|
|
54
|
+
*/
|
|
55
|
+
maxConfigRetryCount: number;
|
|
56
|
+
/**
|
|
57
|
+
* Enable mock review functionality. Defaults to false.
|
|
58
|
+
* @platform Android only
|
|
59
|
+
*/
|
|
60
|
+
useMockReviews: boolean;
|
|
40
61
|
constructor(init?: Partial<SuperwallOptions>);
|
|
41
62
|
toJson(): object;
|
|
42
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperwallOptions.d.ts","sourceRoot":"","sources":["../../../../src/compat/lib/SuperwallOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAajD;;;;GAIG;AACH,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,gBAAgB,qBAAqB;IACrC,SAAS,cAAc;CACxB;AAED;;;;GAIG;AACH,qBAAa,cAAc;IACzB,KAAK,EAAE,QAAQ,CAAgB;IAC/B,MAAM,EAAE,QAAQ,EAAE,CAAiB;IAEnC,MAAM,IAAI,MAAM;CAMjB;AAED;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B,QAAQ,EAAE,cAAc,CAAuB;IAC/C,kBAAkB,EAAE,kBAAkB,CAA6B;IACnE,+BAA+B,UAAO;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,uBAAuB,UAAQ;IAC/B,OAAO,EAAE,cAAc,CAAuB;IAC9C,
|
|
1
|
+
{"version":3,"file":"SuperwallOptions.d.ts","sourceRoot":"","sources":["../../../../src/compat/lib/SuperwallOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAajD;;;;GAIG;AACH,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,gBAAgB,qBAAqB;IACrC,SAAS,cAAc;CACxB;AAED;;;;GAIG;AACH,qBAAa,cAAc;IACzB,KAAK,EAAE,QAAQ,CAAgB;IAC/B,MAAM,EAAE,QAAQ,EAAE,CAAiB;IAEnC,MAAM,IAAI,MAAM;CAMjB;AAED;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B,QAAQ,EAAE,cAAc,CAAuB;IAC/C,kBAAkB,EAAE,kBAAkB,CAA6B;IACnE,+BAA+B,UAAO;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,uBAAuB,UAAQ;IAC/B,OAAO,EAAE,cAAc,CAAuB;IAC9C,0BAA0B,UAAQ;IAClC,eAAe,CAAC,EAAE,WAAW,GAAG,WAAW,CAAA;IAC3C,iCAAiC,UAAQ;IACzC;;;;OAIG;IACH,sBAAsB,UAAQ;IAC9B;;;OAGG;IACH,+BAA+B,UAAQ;IACvC;;;;OAIG;IACH,mBAAmB,SAAI;IACvB;;;OAGG;IACH,cAAc,UAAQ;gBAEV,IAAI,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC;IAwB5C,MAAM,IAAI,MAAM;CAmBjB"}
|
|
@@ -47,10 +47,31 @@ export class SuperwallOptions {
|
|
|
47
47
|
localeIdentifier;
|
|
48
48
|
isGameControllerEnabled = false;
|
|
49
49
|
logging = new LoggingOptions();
|
|
50
|
-
collectAdServicesAttribution = false;
|
|
51
50
|
passIdentifiersToPlayStore = false;
|
|
52
51
|
storeKitVersion;
|
|
53
52
|
enableExperimentalDeviceVariables = false;
|
|
53
|
+
/**
|
|
54
|
+
* Observe purchases made outside of Superwall. When true, Superwall will observe
|
|
55
|
+
* StoreKit/Play Store transactions and report them. Defaults to false.
|
|
56
|
+
* @platform iOS and Android
|
|
57
|
+
*/
|
|
58
|
+
shouldObservePurchases = false;
|
|
59
|
+
/**
|
|
60
|
+
* Disables the app transaction check on SDK launch. Defaults to false.
|
|
61
|
+
* @platform iOS only
|
|
62
|
+
*/
|
|
63
|
+
shouldBypassAppTransactionCheck = false;
|
|
64
|
+
/**
|
|
65
|
+
* Number of times the SDK will attempt to get the Superwall configuration after
|
|
66
|
+
* a network failure before it times out. Defaults to 6.
|
|
67
|
+
* @platform iOS only
|
|
68
|
+
*/
|
|
69
|
+
maxConfigRetryCount = 6;
|
|
70
|
+
/**
|
|
71
|
+
* Enable mock review functionality. Defaults to false.
|
|
72
|
+
* @platform Android only
|
|
73
|
+
*/
|
|
74
|
+
useMockReviews = false;
|
|
54
75
|
constructor(init) {
|
|
55
76
|
if (init) {
|
|
56
77
|
if (init.paywalls) {
|
|
@@ -84,10 +105,13 @@ export class SuperwallOptions {
|
|
|
84
105
|
localeIdentifier: this.localeIdentifier,
|
|
85
106
|
isGameControllerEnabled: this.isGameControllerEnabled,
|
|
86
107
|
logging: this.logging.toJson(),
|
|
87
|
-
collectAdServicesAttribution: this.collectAdServicesAttribution,
|
|
88
108
|
passIdentifiersToPlayStore: this.passIdentifiersToPlayStore,
|
|
89
109
|
storeKitVersion: this.storeKitVersion,
|
|
90
110
|
enableExperimentalDeviceVariables: this.enableExperimentalDeviceVariables,
|
|
111
|
+
shouldObservePurchases: this.shouldObservePurchases,
|
|
112
|
+
shouldBypassAppTransactionCheck: this.shouldBypassAppTransactionCheck,
|
|
113
|
+
maxConfigRetryCount: this.maxConfigRetryCount,
|
|
114
|
+
useMockReviews: this.useMockReviews,
|
|
91
115
|
});
|
|
92
116
|
}
|
|
93
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperwallOptions.js","sourceRoot":"","sources":["../../../../src/compat/lib/SuperwallOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAA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uBAAuB;YACrD,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YAC9B,0BAA0B,EAAE,IAAI,CAAC,0BAA0B;YAC3D,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,iCAAiC,EAAE,IAAI,CAAC,iCAAiC;YACzE,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,+BAA+B,EAAE,IAAI,CAAC,+BAA+B;YACrE,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;YAC7C,cAAc,EAAE,IAAI,CAAC,cAAc;SACpC,CAAC,CAAA;IACJ,CAAC;CACF","sourcesContent":["import { LogLevel } from \"./LogLevel\"\nimport { LogScope } from \"./LogScope\"\nimport { PaywallOptions } from \"./PaywallOptions\"\n\n/**\n * Helper function to remove undefined values from an object.\n * This is necessary for Android compatibility as the Expo bridge\n * cannot convert undefined to Kotlin types.\n */\nfunction filterUndefined<T extends Record<string, any>>(obj: T): Partial<T> {\n return Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined),\n ) as Partial<T>\n}\n\n/**\n * @category Enums\n * @since 0.0.15\n * Defines the network environment for Superwall.\n */\nexport enum NetworkEnvironment {\n Release = \"release\",\n ReleaseCandidate = \"releaseCandidate\",\n Developer = \"developer\",\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Options for configuring logging behavior.\n */\nexport class LoggingOptions {\n level: LogLevel = LogLevel.Info\n scopes: LogScope[] = [LogScope.All]\n\n toJson(): object {\n return filterUndefined({\n level: this.level,\n scopes: this.scopes,\n })\n }\n}\n\n/**\n * @category Models\n * @since 0.0.15\n * Options for configuring the Superwall SDK.\n */\nexport class SuperwallOptions {\n paywalls: PaywallOptions = new PaywallOptions()\n networkEnvironment: NetworkEnvironment = NetworkEnvironment.Release\n isExternalDataCollectionEnabled = true\n localeIdentifier?: string\n isGameControllerEnabled = false\n logging: LoggingOptions = new LoggingOptions()\n passIdentifiersToPlayStore = false\n storeKitVersion?: \"STOREKIT1\" | \"STOREKIT2\"\n enableExperimentalDeviceVariables = false\n /**\n * Observe purchases made outside of Superwall. When true, Superwall will observe\n * StoreKit/Play Store transactions and report them. Defaults to false.\n * @platform iOS and Android\n */\n shouldObservePurchases = false\n /**\n * Disables the app transaction check on SDK launch. Defaults to false.\n * @platform iOS only\n */\n shouldBypassAppTransactionCheck = false\n /**\n * Number of times the SDK will attempt to get the Superwall configuration after\n * a network failure before it times out. Defaults to 6.\n * @platform iOS only\n */\n maxConfigRetryCount = 6\n /**\n * Enable mock review functionality. Defaults to false.\n * @platform Android only\n */\n useMockReviews = false\n\n constructor(init?: Partial<SuperwallOptions>) {\n if (init) {\n if (init.paywalls) {\n this.paywalls = new PaywallOptions(init.paywalls) // Pass init.paywalls to PaywallOptions constructor\n }\n if (init.logging) {\n // Ensure logging is always a LoggingOptions instance\n this.logging =\n init.logging instanceof LoggingOptions\n ? init.logging\n : Object.assign(new LoggingOptions(), init.logging)\n }\n // Assign other properties, excluding nested objects\n // biome-ignore lint/correctness/noUnusedVariables: Extracted to exclude from spread\n const { paywalls, logging, ...restInit } = init\n Object.assign(this, restInit)\n if (paywalls && !init.paywalls) {\n // if paywalls was in init but not used for constructor\n this.paywalls = new PaywallOptions(paywalls)\n }\n }\n }\n\n // You can add methods to this class if needed\n toJson(): object {\n // Method to serialize class instance to a plain object, useful when passing to native code\n // Filter out undefined values to prevent Android Expo bridge conversion errors\n return filterUndefined({\n paywalls: this.paywalls.toJson(),\n networkEnvironment: this.networkEnvironment,\n isExternalDataCollectionEnabled: this.isExternalDataCollectionEnabled,\n localeIdentifier: this.localeIdentifier,\n isGameControllerEnabled: this.isGameControllerEnabled,\n logging: this.logging.toJson(),\n passIdentifiersToPlayStore: this.passIdentifiersToPlayStore,\n storeKitVersion: this.storeKitVersion,\n enableExperimentalDeviceVariables: this.enableExperimentalDeviceVariables,\n shouldObservePurchases: this.shouldObservePurchases,\n shouldBypassAppTransactionCheck: this.shouldBypassAppTransactionCheck,\n maxConfigRetryCount: this.maxConfigRetryCount,\n useMockReviews: this.useMockReviews,\n })\n }\n}\n"]}
|
|
@@ -131,7 +131,7 @@ export const useSuperwallStore = create((set, get) => ({
|
|
|
131
131
|
_initListeners: () => {
|
|
132
132
|
// Use get() to read the state from within the store
|
|
133
133
|
if (get().listenersInitialized) {
|
|
134
|
-
console.warn("Listeners already initialized. Skipping.");
|
|
134
|
+
console.warn("[Superwall] Listeners already initialized. Skipping.");
|
|
135
135
|
return () => { }; // Return no-op cleanup
|
|
136
136
|
}
|
|
137
137
|
const subscriptions = [];
|
|
@@ -152,9 +152,9 @@ export const useSuperwallStore = create((set, get) => ({
|
|
|
152
152
|
}
|
|
153
153
|
}));
|
|
154
154
|
set({ listenersInitialized: true });
|
|
155
|
-
console.log("Initialized listeners", subscriptions.length);
|
|
155
|
+
console.log("[Superwall] Initialized listeners", subscriptions.length);
|
|
156
156
|
return () => {
|
|
157
|
-
console.log("Cleaning up listeners", subscriptions.length);
|
|
157
|
+
console.log("[Superwall] Cleaning up listeners", subscriptions.length);
|
|
158
158
|
// biome-ignore lint/suspicious/useIterableCallbackReturn: forEach is used for side effects only
|
|
159
159
|
subscriptions.forEach((s) => s.remove());
|
|
160
160
|
// Reset the state on cleanup
|
|
@@ -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;AAMvD,OAAO,EAAE,uBAAuB,EAAgC,MAAM,oBAAoB,CAAA;AA6L1F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAiB,CAAC,GAAG,E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AC,KAAqB,EAAE,EAAE,CAAC,KAAqB,CAAA;IACjE,6DAA6D;IAC7D,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;AACtE,CAAC","sourcesContent":["import { createContext, useContext } from \"react\"\nimport { create } from \"zustand\"\nimport { useShallow } from \"zustand/shallow\"\nimport pkg from \"../package.json\"\nimport SuperwallExpoModule from \"./SuperwallExpoModule\"\nimport type {\n EntitlementsInfo,\n IntegrationAttributes,\n SubscriptionStatus,\n} from \"./SuperwallExpoModule.types\"\nimport { DefaultSuperwallOptions, type PartialSuperwallOptions } from \"./SuperwallOptions\"\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 * Contains error message if SDK configuration failed, `null` otherwise.\n * When this is set, the SDK is not configured and app should show error UI.\n */\n configurationError: string | null\n\n /**\n * The current user's attributes.\n * `null` if no user is identified or after `reset` is called.\n * `undefined` initially before any user data is fetched or set.\n */\n user?: UserAttributes | null\n\n /** The current subscription status of the user. */\n subscriptionStatus: SubscriptionStatus\n\n /* -------------------- Internal -------------------- */\n // Internal listener references for cleanup handled inside Provider effect.\n // Not reactive, so we store outside Zustand state to avoid unnecessary rerenders.\n\n /* -------------------- Actions -------------------- */\n /**\n * Configures the Superwall SDK with the provided API key and options.\n * This must be called before most other SDK functions can be used.\n * @param apiKey - Your Superwall API key.\n * @param options - Optional configuration settings for the SDK.\n * @returns A promise that resolves when configuration is complete.\n * @internal\n */\n configure: (\n apiKey: string,\n options?: PartialSuperwallOptions & {\n /** @deprecated Use manualPurchaseManagement instead */\n manualPurchaseManagment?: boolean\n },\n ) => Promise<void>\n /**\n * Identifies the current user with a unique ID.\n * @param userId - The unique identifier for the user.\n * @param options - Optional parameters for identification.\n * @returns A promise that resolves when identification is complete.\n */\n identify: (userId: string, options?: IdentifyOptions) => Promise<void>\n /**\n * Resets the user's identity and clears all user-specific data, effectively logging them out.\n * @internal\n */\n reset: () => Promise<void>\n\n /**\n * Registers a placement to potentially show a paywall.\n * The decision to show a paywall is determined by campaign rules and user assignments on the Superwall dashboard.\n * @param placement - The ID of the placement to register.\n * @param params - Optional parameters to pass with the placement.\n * @param handlerId - An optional identifier used to associate specific event handlers (e.g., from `usePlacement`). Defaults to \"default\".\n * @returns A promise that resolves when the placement registration is complete.\n */\n registerPlacement: (\n placement: string,\n params?: Record<string, any>,\n handlerId?: string | null,\n ) => Promise<void>\n /**\n * Retrieves the presentation result for a given placement.\n * This can be used to understand what would happen if a placement were to be registered, without actually registering it.\n * @param placement - The ID of the placement.\n * @param params - Optional parameters for the placement.\n * @returns A promise that resolves with the presentation result.\n */\n getPresentationResult: (placement: string, params?: Record<string, any>) => Promise<any>\n /**\n * Dismisses any currently presented Superwall paywall.\n * @returns A promise that resolves when the dismissal is complete.\n */\n dismiss: () => Promise<void>\n\n /**\n * Preloads all paywalls configured in your Superwall dashboard.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadAllPaywalls: () => Promise<void>\n /**\n * Preloads specific paywalls.\n * @param placements - An array of placement IDs for which to preload paywalls.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadPaywalls: (placements: string[]) => Promise<void>\n\n /**\n * Sets custom attributes for the current user.\n * @param attrs - An object containing the attributes to set.\n * @returns A promise that resolves when attributes are set.\n */\n setUserAttributes: (attrs: Record<string, any>) => Promise<void>\n /**\n * Retrieves the current user's attributes.\n * @returns A promise that resolves with the user's attributes.\n */\n getUserAttributes: () => Promise<Record<string, any>>\n\n /**\n * Sets the logging level for the Superwall SDK.\n * @param level - The desired log level (e.g., \"debug\", \"info\", \"warn\", \"error\", \"none\").\n * @returns A promise that resolves when the log level is set.\n */\n setLogLevel: (level: string) => Promise<void>\n\n /**\n * Sets attributes for third-party integrations.\n * @param attributes - Object mapping IntegrationAttribute string values to their IDs\n * @returns A promise that resolves when attributes are set\n */\n setIntegrationAttributes: (attributes: IntegrationAttributes) => Promise<void>\n\n /**\n * Gets the currently set integration attributes.\n * @returns A promise that resolves with the current integration attributes\n */\n getIntegrationAttributes: () => Promise<Record<string, string>>\n\n /* -------------------- Listener helpers -------------------- */\n /**\n * Initializes native event listeners for the SDK.\n * This is typically called internally by the `SuperwallProvider`.\n * @returns A cleanup function to remove the listeners.\n * @internal\n */\n _initListeners: () => () => void\n\n setSubscriptionStatus: (status: SubscriptionStatus) => Promise<void>\n\n getDeviceAttributes: () => Promise<Record<string, any>>\n\n /**\n * Retrieves the user's entitlements from Superwall's servers.\n * This includes both active and inactive entitlements.\n * @returns A promise that resolves with the entitlements information.\n */\n getEntitlements: () => Promise<EntitlementsInfo>\n}\n\n/**\n * @category Store\n * @since 0.0.15\n * Zustand store for Superwall SDK state and actions.\n * @internal\n */\nexport const useSuperwallStore = create<SuperwallStore>((set, get) => ({\n /* -------------------- State -------------------- */\n isConfigured: false,\n isLoading: false,\n listenersInitialized: false,\n configurationError: null,\n\n user: null,\n subscriptionStatus: {\n status: \"UNKNOWN\",\n },\n\n /* -------------------- Actions -------------------- */\n configure: async (apiKey, options) => {\n set({ isLoading: true, configurationError: null })\n\n try {\n const { manualPurchaseManagement, manualPurchaseManagment, ...restOptions } = options || {}\n\n // Support both spellings for backward compatibility\n const isManualPurchaseManagement =\n manualPurchaseManagement ?? manualPurchaseManagment ?? false\n\n // Deep merge partial options with defaults to ensure all required fields are present\n const mergedOptions = {\n ...DefaultSuperwallOptions,\n ...restOptions,\n paywalls: {\n ...DefaultSuperwallOptions.paywalls,\n ...restOptions.paywalls,\n restoreFailed: {\n ...DefaultSuperwallOptions.paywalls.restoreFailed,\n ...restOptions.paywalls?.restoreFailed,\n },\n },\n logging: {\n ...DefaultSuperwallOptions.logging,\n ...restOptions.logging,\n },\n }\n\n await SuperwallExpoModule.configure(\n apiKey,\n mergedOptions,\n isManualPurchaseManagement,\n pkg.version,\n )\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({\n isConfigured: true,\n isLoading: false,\n configurationError: null,\n user: currentUser as UserAttributes,\n subscriptionStatus,\n })\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n set({\n isLoading: false,\n configurationError: errorMessage,\n })\n // Don't throw - let developers handle via state or callback\n }\n },\n identify: async (userId, options) => {\n await SuperwallExpoModule.identify(userId, options)\n\n // TODO: Instead of setting users after identify, we should set this based on an event\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n const [currentUser, subscriptionStatus] = await Promise.all([\n SuperwallExpoModule.getUserAttributes(),\n SuperwallExpoModule.getSubscriptionStatus(),\n ])\n\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n },\n reset: async () => {\n await SuperwallExpoModule.reset()\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n },\n registerPlacement: async (placement, params, handlerId = \"default\") => {\n await SuperwallExpoModule.registerPlacement(placement, params, handlerId)\n },\n getPresentationResult: async (placement, params) => {\n return SuperwallExpoModule.getPresentationResult(placement, params)\n },\n dismiss: async () => {\n await SuperwallExpoModule.dismiss()\n },\n preloadAllPaywalls: async () => {\n SuperwallExpoModule.preloadAllPaywalls()\n },\n preloadPaywalls: async (placements) => {\n SuperwallExpoModule.preloadPaywalls(placements)\n },\n setUserAttributes: async (attrs) => {\n await SuperwallExpoModule.setUserAttributes(attrs)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n set({ user: currentUser as UserAttributes })\n },\n getUserAttributes: async () => {\n const attributes = await SuperwallExpoModule.getUserAttributes()\n set({ user: attributes as UserAttributes })\n return attributes\n },\n setLogLevel: async (level) => {\n SuperwallExpoModule.setLogLevel(level)\n },\n\n setIntegrationAttributes: async (attributes) => {\n await SuperwallExpoModule.setIntegrationAttributes(attributes)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n set({ user: currentUser as UserAttributes })\n },\n\n getIntegrationAttributes: async () => {\n return SuperwallExpoModule.getIntegrationAttributes()\n },\n\n setSubscriptionStatus: async (status) => {\n await SuperwallExpoModule.setSubscriptionStatus(status)\n },\n getDeviceAttributes: async () => {\n const attributes = await SuperwallExpoModule.getDeviceAttributes()\n return attributes\n },\n getEntitlements: async () => {\n const entitlements = await SuperwallExpoModule.getEntitlements()\n return entitlements as EntitlementsInfo\n },\n\n /* -------------------- Listener helpers -------------------- */\n _initListeners: (): (() => void) => {\n // Use get() to read the state from within the store\n if (get().listenersInitialized) {\n console.warn(\"Listeners already initialized. Skipping.\")\n return () => {} // Return no-op cleanup\n }\n\n const subscriptions: { remove: () => void }[] = []\n\n subscriptions.push(\n SuperwallExpoModule.addListener(\n \"subscriptionStatusDidChange\",\n ({ to }: { to: SubscriptionStatus }) => {\n set({ subscriptionStatus: to })\n },\n ),\n )\n\n // Listen for configuration events\n subscriptions.push(\n SuperwallExpoModule.addListener(\"handleSuperwallEvent\", ({ eventInfo }) => {\n if (eventInfo.event.event === \"configFail\") {\n set({\n configurationError: \"Failed to load Superwall configuration\",\n isLoading: false,\n })\n } else if (eventInfo.event.event === \"configRefresh\") {\n // Clear any previous errors on successful refresh\n set({ configurationError: null })\n }\n }),\n )\n\n set({ listenersInitialized: true })\n console.log(\"Initialized listeners\", subscriptions.length)\n\n return (): void => {\n console.log(\"Cleaning up listeners\", subscriptions.length)\n // biome-ignore lint/suspicious/useIterableCallbackReturn: forEach is used for side effects only\n subscriptions.forEach((s) => s.remove())\n // Reset the state on cleanup\n set({ listenersInitialized: false })\n }\n },\n}))\n\n/**\n * @category Store\n * @since 0.0.15\n * Public interface for the Superwall store, excluding internal methods.\n */\nexport type PublicSuperwallStore = Omit<SuperwallStore, \"configure\" | \"reset\" | \"_initListeners\">\n\nexport const SuperwallContext = createContext<boolean>(false)\n\n/**\n * @category Hooks\n * @since 0.0.15\n * Core React hook for interacting with the Superwall SDK.\n *\n * This hook provides access to the Superwall store, which includes SDK state\n * (like configuration status, user information, subscription status) and actions\n * (like `identify`, `reset`, `registerPlacement`).\n *\n * It must be used within a component that is a descendant of `<SuperwallProvider />`.\n *\n * @template T - Optional type parameter for the selected state. Defaults to the entire `PublicSuperwallStore`.\n * @param selector - An optional function to select a specific slice of the store's state.\n * This is useful for performance optimization, as components will only re-render\n * if the selected part of the state changes. Uses shallow equality checking\n * via `zustand/shallow`. If omitted, the entire store is returned.\n * @returns The selected slice of the Superwall store state, or the entire store if no selector is provided.\n * @throws Error if used outside of a `SuperwallProvider`.\n *\n * @example\n * // Get the entire store\n * const superwall = useSuperwall();\n * console.log(superwall.isConfigured);\n * superwall.identify(\"user_123\");\n *\n * @example\n * // Select specific state properties\n * const { user, subscriptionStatus } = useSuperwall(state => ({\n * user: state.user,\n * subscriptionStatus: state.subscriptionStatus,\n * }));\n * console.log(user?.appUserId, subscriptionStatus?.status);\n */\nexport function useSuperwall<T = PublicSuperwallStore>(selector?: (state: SuperwallStore) => T): T {\n const inProvider = useContext(SuperwallContext)\n if (!inProvider) {\n throw new Error(\"useSuperwall must be used within a SuperwallProvider\")\n }\n\n const identity = (state: SuperwallStore) => state as unknown as T\n // biome-ignore lint/correctness/useHookAtTopLevel: good here\n return useSuperwallStore(selector ? useShallow(selector) : identity)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useSuperwall.js","sourceRoot":"","sources":["../../src/useSuperwall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,GAAG,MAAM,iBAAiB,CAAA;AACjC,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AAMvD,OAAO,EAAE,uBAAuB,EAAgC,MAAM,oBAAoB,CAAA;AA6L1F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACrE,qDAAqD;IACrD,YAAY,EAAE,KAAK;IACnB,SAAS,EAAE,KAAK;IAChB,oBAAoB,EAAE,KAAK;IAC3B,kBAAkB,EAAE,IAAI;IAExB,IAAI,EAAE,IAAI;IACV,kBAAkB,EAAE;QAClB,MAAM,EAAE,SAAS;KAClB;IAED,uDAAuD;IACvD,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QACnC,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAA;QAElD,IAAI,CAAC;YACH,MAAM,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,IAAI,EAAE,CAAA;YAE3F,oDAAoD;YACpD,MAAM,0BAA0B,GAC9B,wBAAwB,IAAI,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E,OAAO,GAAS,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;YACtE,gGAAgG;YAChG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAA;YACxC,6BAA6B;YAC7B,GAAG,CAAC,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAA;QACtC,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAC,CAAA;AASH,MAAM,CAAC,MAAM,gBAAgB,GAAG,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 {\n EntitlementsInfo,\n IntegrationAttributes,\n SubscriptionStatus,\n} from \"./SuperwallExpoModule.types\"\nimport { DefaultSuperwallOptions, type PartialSuperwallOptions } 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 * Contains error message if SDK configuration failed, `null` otherwise.\n * When this is set, the SDK is not configured and app should show error UI.\n */\n configurationError: string | null\n\n /**\n * The current user's attributes.\n * `null` if no user is identified or after `reset` is called.\n * `undefined` initially before any user data is fetched or set.\n */\n user?: UserAttributes | null\n\n /** The current subscription status of the user. */\n subscriptionStatus: SubscriptionStatus\n\n /* -------------------- Internal -------------------- */\n // Internal listener references for cleanup handled inside Provider effect.\n // Not reactive, so we store outside Zustand state to avoid unnecessary rerenders.\n\n /* -------------------- Actions -------------------- */\n /**\n * Configures the Superwall SDK with the provided API key and options.\n * This must be called before most other SDK functions can be used.\n * @param apiKey - Your Superwall API key.\n * @param options - Optional configuration settings for the SDK.\n * @returns A promise that resolves when configuration is complete.\n * @internal\n */\n configure: (\n apiKey: string,\n options?: PartialSuperwallOptions & {\n /** @deprecated Use manualPurchaseManagement instead */\n manualPurchaseManagment?: boolean\n },\n ) => Promise<void>\n /**\n * Identifies the current user with a unique ID.\n * @param userId - The unique identifier for the user.\n * @param options - Optional parameters for identification.\n * @returns A promise that resolves when identification is complete.\n */\n identify: (userId: string, options?: IdentifyOptions) => Promise<void>\n /**\n * Resets the user's identity and clears all user-specific data, effectively logging them out.\n * @internal\n */\n reset: () => Promise<void>\n\n /**\n * Registers a placement to potentially show a paywall.\n * The decision to show a paywall is determined by campaign rules and user assignments on the Superwall dashboard.\n * @param placement - The ID of the placement to register.\n * @param params - Optional parameters to pass with the placement.\n * @param handlerId - An optional identifier used to associate specific event handlers (e.g., from `usePlacement`). Defaults to \"default\".\n * @returns A promise that resolves when the placement registration is complete.\n */\n registerPlacement: (\n placement: string,\n params?: Record<string, any>,\n handlerId?: string | null,\n ) => Promise<void>\n /**\n * Retrieves the presentation result for a given placement.\n * This can be used to understand what would happen if a placement were to be registered, without actually registering it.\n * @param placement - The ID of the placement.\n * @param params - Optional parameters for the placement.\n * @returns A promise that resolves with the presentation result.\n */\n getPresentationResult: (placement: string, params?: Record<string, any>) => Promise<any>\n /**\n * Dismisses any currently presented Superwall paywall.\n * @returns A promise that resolves when the dismissal is complete.\n */\n dismiss: () => Promise<void>\n\n /**\n * Preloads all paywalls configured in your Superwall dashboard.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadAllPaywalls: () => Promise<void>\n /**\n * Preloads specific paywalls.\n * @param placements - An array of placement IDs for which to preload paywalls.\n * @returns A promise that resolves when preloading is complete.\n */\n preloadPaywalls: (placements: string[]) => Promise<void>\n\n /**\n * Sets custom attributes for the current user.\n * @param attrs - An object containing the attributes to set.\n * @returns A promise that resolves when attributes are set.\n */\n setUserAttributes: (attrs: Record<string, any>) => Promise<void>\n /**\n * Retrieves the current user's attributes.\n * @returns A promise that resolves with the user's attributes.\n */\n getUserAttributes: () => Promise<Record<string, any>>\n\n /**\n * Sets the logging level for the Superwall SDK.\n * @param level - The desired log level (e.g., \"debug\", \"info\", \"warn\", \"error\", \"none\").\n * @returns A promise that resolves when the log level is set.\n */\n setLogLevel: (level: string) => Promise<void>\n\n /**\n * Sets attributes for third-party integrations.\n * @param attributes - Object mapping IntegrationAttribute string values to their IDs\n * @returns A promise that resolves when attributes are set\n */\n setIntegrationAttributes: (attributes: IntegrationAttributes) => Promise<void>\n\n /**\n * Gets the currently set integration attributes.\n * @returns A promise that resolves with the current integration attributes\n */\n getIntegrationAttributes: () => Promise<Record<string, string>>\n\n /* -------------------- Listener helpers -------------------- */\n /**\n * Initializes native event listeners for the SDK.\n * This is typically called internally by the `SuperwallProvider`.\n * @returns A cleanup function to remove the listeners.\n * @internal\n */\n _initListeners: () => () => void\n\n setSubscriptionStatus: (status: SubscriptionStatus) => Promise<void>\n\n getDeviceAttributes: () => Promise<Record<string, any>>\n\n /**\n * Retrieves the user's entitlements from Superwall's servers.\n * This includes both active and inactive entitlements.\n * @returns A promise that resolves with the entitlements information.\n */\n getEntitlements: () => Promise<EntitlementsInfo>\n}\n\n/**\n * @category Store\n * @since 0.0.15\n * Zustand store for Superwall SDK state and actions.\n * @internal\n */\nexport const useSuperwallStore = create<SuperwallStore>((set, get) => ({\n /* -------------------- State -------------------- */\n isConfigured: false,\n isLoading: false,\n listenersInitialized: false,\n configurationError: null,\n\n user: null,\n subscriptionStatus: {\n status: \"UNKNOWN\",\n },\n\n /* -------------------- Actions -------------------- */\n configure: async (apiKey, options) => {\n set({ isLoading: true, configurationError: null })\n\n try {\n const { manualPurchaseManagement, manualPurchaseManagment, ...restOptions } = options || {}\n\n // Support both spellings for backward compatibility\n const isManualPurchaseManagement =\n manualPurchaseManagement ?? manualPurchaseManagment ?? false\n\n // Deep merge partial options with defaults to ensure all required fields are present\n const mergedOptions = {\n ...DefaultSuperwallOptions,\n ...restOptions,\n paywalls: {\n ...DefaultSuperwallOptions.paywalls,\n ...restOptions.paywalls,\n restoreFailed: {\n ...DefaultSuperwallOptions.paywalls.restoreFailed,\n ...restOptions.paywalls?.restoreFailed,\n },\n },\n logging: {\n ...DefaultSuperwallOptions.logging,\n ...restOptions.logging,\n },\n }\n\n await SuperwallExpoModule.configure(\n apiKey,\n mergedOptions,\n isManualPurchaseManagement,\n pkg.version,\n )\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({\n isConfigured: true,\n isLoading: false,\n configurationError: null,\n user: currentUser as UserAttributes,\n subscriptionStatus,\n })\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n set({\n isLoading: false,\n configurationError: errorMessage,\n })\n // Don't throw - let developers handle via state or callback\n }\n },\n identify: async (userId, options) => {\n await SuperwallExpoModule.identify(userId, options)\n\n // TODO: Instead of setting users after identify, we should set this based on an event\n await new Promise((resolve) => setTimeout(resolve, 0))\n\n const [currentUser, subscriptionStatus] = await Promise.all([\n SuperwallExpoModule.getUserAttributes(),\n SuperwallExpoModule.getSubscriptionStatus(),\n ])\n\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n },\n reset: async () => {\n await SuperwallExpoModule.reset()\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n const subscriptionStatus = await SuperwallExpoModule.getSubscriptionStatus()\n\n set({ user: currentUser as UserAttributes, subscriptionStatus })\n },\n registerPlacement: async (placement, params, handlerId = \"default\") => {\n await SuperwallExpoModule.registerPlacement(placement, params, handlerId)\n },\n getPresentationResult: async (placement, params) => {\n return SuperwallExpoModule.getPresentationResult(placement, params)\n },\n dismiss: async () => {\n await SuperwallExpoModule.dismiss()\n },\n preloadAllPaywalls: async () => {\n SuperwallExpoModule.preloadAllPaywalls()\n },\n preloadPaywalls: async (placements) => {\n SuperwallExpoModule.preloadPaywalls(placements)\n },\n setUserAttributes: async (attrs) => {\n await SuperwallExpoModule.setUserAttributes(attrs)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n set({ user: currentUser as UserAttributes })\n },\n getUserAttributes: async () => {\n const attributes = await SuperwallExpoModule.getUserAttributes()\n set({ user: attributes as UserAttributes })\n return attributes\n },\n setLogLevel: async (level) => {\n SuperwallExpoModule.setLogLevel(level)\n },\n\n setIntegrationAttributes: async (attributes) => {\n await SuperwallExpoModule.setIntegrationAttributes(attributes)\n\n const currentUser = await SuperwallExpoModule.getUserAttributes()\n set({ user: currentUser as UserAttributes })\n },\n\n getIntegrationAttributes: async () => {\n return SuperwallExpoModule.getIntegrationAttributes()\n },\n\n setSubscriptionStatus: async (status) => {\n await SuperwallExpoModule.setSubscriptionStatus(status)\n },\n getDeviceAttributes: async () => {\n const attributes = await SuperwallExpoModule.getDeviceAttributes()\n return attributes\n },\n getEntitlements: async () => {\n const entitlements = await SuperwallExpoModule.getEntitlements()\n return entitlements as EntitlementsInfo\n },\n\n /* -------------------- Listener helpers -------------------- */\n _initListeners: (): (() => void) => {\n // Use get() to read the state from within the store\n if (get().listenersInitialized) {\n console.warn(\"[Superwall] Listeners already initialized. Skipping.\")\n return () => {} // Return no-op cleanup\n }\n\n const subscriptions: { remove: () => void }[] = []\n\n subscriptions.push(\n SuperwallExpoModule.addListener(\n \"subscriptionStatusDidChange\",\n ({ to }: { to: SubscriptionStatus }) => {\n set({ subscriptionStatus: to })\n },\n ),\n )\n\n // Listen for configuration events\n subscriptions.push(\n SuperwallExpoModule.addListener(\"handleSuperwallEvent\", ({ eventInfo }) => {\n if (eventInfo.event.event === \"configFail\") {\n set({\n configurationError: \"Failed to load Superwall configuration\",\n isLoading: false,\n })\n } else if (eventInfo.event.event === \"configRefresh\") {\n // Clear any previous errors on successful refresh\n set({ configurationError: null })\n }\n }),\n )\n\n set({ listenersInitialized: true })\n console.log(\"[Superwall] Initialized listeners\", subscriptions.length)\n\n return (): void => {\n console.log(\"[Superwall] Cleaning up listeners\", subscriptions.length)\n // biome-ignore lint/suspicious/useIterableCallbackReturn: forEach is used for side effects only\n subscriptions.forEach((s) => s.remove())\n // Reset the state on cleanup\n set({ listenersInitialized: false })\n }\n },\n}))\n\n/**\n * @category Store\n * @since 0.0.15\n * Public interface for the Superwall store, excluding internal methods.\n */\nexport type PublicSuperwallStore = Omit<SuperwallStore, \"configure\" | \"reset\" | \"_initListeners\">\n\nexport const SuperwallContext = createContext<boolean>(false)\n\n/**\n * @category Hooks\n * @since 0.0.15\n * Core React hook for interacting with the Superwall SDK.\n *\n * This hook provides access to the Superwall store, which includes SDK state\n * (like configuration status, user information, subscription status) and actions\n * (like `identify`, `reset`, `registerPlacement`).\n *\n * It must be used within a component that is a descendant of `<SuperwallProvider />`.\n *\n * @template T - Optional type parameter for the selected state. Defaults to the entire `PublicSuperwallStore`.\n * @param selector - An optional function to select a specific slice of the store's state.\n * This is useful for performance optimization, as components will only re-render\n * if the selected part of the state changes. Uses shallow equality checking\n * via `zustand/shallow`. If omitted, the entire store is returned.\n * @returns The selected slice of the Superwall store state, or the entire store if no selector is provided.\n * @throws Error if used outside of a `SuperwallProvider`.\n *\n * @example\n * // Get the entire store\n * const superwall = useSuperwall();\n * console.log(superwall.isConfigured);\n * superwall.identify(\"user_123\");\n *\n * @example\n * // Select specific state properties\n * const { user, subscriptionStatus } = useSuperwall(state => ({\n * user: state.user,\n * subscriptionStatus: state.subscriptionStatus,\n * }));\n * console.log(user?.appUserId, subscriptionStatus?.status);\n */\nexport function useSuperwall<T = PublicSuperwallStore>(selector?: (state: SuperwallStore) => T): T {\n const inProvider = useContext(SuperwallContext)\n if (!inProvider) {\n throw new Error(\"useSuperwall must be used within a SuperwallProvider\")\n }\n\n const identity = (state: SuperwallStore) => state as unknown as T\n // biome-ignore lint/correctness/useHookAtTopLevel: good here\n return useSuperwallStore(selector ? useShallow(selector) : identity)\n}\n"]}
|
|
@@ -19,6 +19,9 @@ extension SuperwallOptions {
|
|
|
19
19
|
let storeKitVersion = dictionary["storeKitVersion"] as? String
|
|
20
20
|
let enableExperimentalDeviceVariables =
|
|
21
21
|
dictionary["enableExperimentalDeviceVariables"] as? Bool ?? false
|
|
22
|
+
let shouldObservePurchases = dictionary["shouldObservePurchases"] as? Bool ?? false
|
|
23
|
+
let shouldBypassAppTransactionCheck = dictionary["shouldBypassAppTransactionCheck"] as? Bool ?? false
|
|
24
|
+
let maxConfigRetryCount = dictionary["maxConfigRetryCount"] as? Int ?? 6
|
|
22
25
|
|
|
23
26
|
let superwallOptions = SuperwallOptions()
|
|
24
27
|
superwallOptions.paywalls = paywalls
|
|
@@ -31,6 +34,9 @@ extension SuperwallOptions {
|
|
|
31
34
|
superwallOptions.storeKitVersion = storeKitVersion == "STOREKIT1" ? .storeKit1 : .storeKit2
|
|
32
35
|
}
|
|
33
36
|
superwallOptions.enableExperimentalDeviceVariables = enableExperimentalDeviceVariables
|
|
37
|
+
superwallOptions.shouldObservePurchases = shouldObservePurchases
|
|
38
|
+
superwallOptions.shouldBypassAppTransactionCheck = shouldBypassAppTransactionCheck
|
|
39
|
+
superwallOptions.maxConfigRetryCount = maxConfigRetryCount
|
|
34
40
|
|
|
35
41
|
return superwallOptions
|
|
36
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-superwall",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Offical Expo Integration for Superwall",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"types": "build/src/index.d.ts",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
],
|
|
71
71
|
"packageManager": "yarn@4.7.0",
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"zustand": "^5.0.
|
|
73
|
+
"zustand": "^5.0.9"
|
|
74
74
|
}
|
|
75
75
|
}
|