expo-superwall 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.7
4
+
5
+ ### Patch Changes
6
+
7
+ - adccfe4: Update Android SDK to 2.5.4 and iOS to 4.8.2
8
+
3
9
  ## 0.2.6
4
10
 
5
11
  ### Patch Changes
@@ -43,7 +43,7 @@ android {
43
43
  }
44
44
 
45
45
  dependencies {
46
- implementation "com.superwall.sdk:superwall-android:2.5.1"
47
- implementation 'com.android.billingclient:billing:6.1.0'
46
+ implementation "com.superwall.sdk:superwall-android:2.5.4"
47
+ implementation 'com.android.billingclient:billing:8.0.0'
48
48
  implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2'
49
- }
49
+ }
@@ -98,6 +98,14 @@ class SuperwallEvent {
98
98
  map["event"] = "userAttributes"
99
99
  map["attributes"] = superwallPlacement.attributes
100
100
  }
101
+ is SuperwallEvent.IntegrationProps -> {
102
+ map["event"] = "integration_attributes"
103
+ map["audienceFilterParams"] = superwallPlacement.audienceFilterParams
104
+ }
105
+ is SuperwallEvent.IntegrationAttributes -> {
106
+ map["event"] = "integration_attributes"
107
+ map["audienceFilterParams"] = superwallPlacement.audienceFilterParams
108
+ }
101
109
  is SuperwallEvent.NonRecurringProductPurchase -> {
102
110
  map["event"] = "nonRecurringProductPurchase"
103
111
  map["product"] = superwallPlacement.product.toJson()
@@ -127,6 +135,9 @@ class SuperwallEvent {
127
135
  is SuperwallEvent.PaywallWebviewLoadFail -> {
128
136
  map["event"] = "paywallWebviewLoadFail"
129
137
  map["paywallInfo"] = superwallPlacement.paywallInfo.toJson()
138
+ superwallPlacement.errorMessage?.let {
139
+ map["errorMessage"] = it.toString()
140
+ }
130
141
  }
131
142
  is SuperwallEvent.PaywallWebviewLoadComplete -> {
132
143
  map["event"] = "paywallWebviewLoadComplete"
@@ -145,6 +156,9 @@ class SuperwallEvent {
145
156
  map["event"] = "paywallProductsLoadFail"
146
157
  map["triggeredPlacementName"] = superwallPlacement.triggeredPlacementName ?: ""
147
158
  map["paywallInfo"] = superwallPlacement.paywallInfo.toJson()
159
+ superwallPlacement.errorMessage?.let {
160
+ map["errorMessage"] = it
161
+ }
148
162
  }
149
163
  is SuperwallEvent.PaywallProductsLoadComplete -> {
150
164
  map["event"] = "paywallProductsLoadComplete"
@@ -193,10 +207,35 @@ class SuperwallEvent {
193
207
  }
194
208
  is SuperwallEvent.ShimmerViewComplete -> {
195
209
  map["event"] = "shimmerViewComplete"
210
+ map["duration"] = superwallPlacement.duration
196
211
  }
197
212
  is SuperwallEvent.ShimmerViewStart -> {
198
213
  map["event"] = "shimmerViewStart"
199
214
  }
215
+ is SuperwallEvent.RedemptionComplete -> {
216
+ map["event"] = "redemptionComplete"
217
+ }
218
+ is SuperwallEvent.RedemptionFail -> {
219
+ map["event"] = "redemptionFail"
220
+ }
221
+ is SuperwallEvent.RedemptionStart -> {
222
+ map["event"] = "redemptionStart"
223
+ }
224
+ is SuperwallEvent.EnrichmentStart -> {
225
+ map["event"] = "enrichmentStart"
226
+ }
227
+ is SuperwallEvent.EnrichmentFail -> {
228
+ map["event"] = "enrichmentFail"
229
+ }
230
+ is SuperwallEvent.EnrichmentComplete -> {
231
+ map["event"] = "enrichmentComplete"
232
+ map["userEnrichment"] = superwallPlacement.userEnrichment
233
+ map["deviceEnrichment"] = superwallPlacement.deviceEnrichment
234
+ }
235
+ is SuperwallEvent.ReviewRequested -> {
236
+ map["event"] = "reviewRequested"
237
+ map["count"] = superwallPlacement.count
238
+ }
200
239
  else -> {}
201
240
  }
202
241
  return map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-superwall",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Offical Expo Integration for Superwall",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",
@@ -84,6 +84,12 @@ export declare enum EventType {
84
84
  enrichmentStart = "enrichmentStart",
85
85
  enrichmentComplete = "enrichmentComplete",
86
86
  enrichmentFail = "enrichmentFail",
87
+ integrationAttributes = "integrationAttributes",
88
+ expressionResult = "expressionResult",
89
+ reviewRequested = "reviewRequested",
90
+ reviewGranted = "reviewGranted",
91
+ reviewDenied = "reviewDenied",
92
+ paywallResourceLoadFail = "paywallResourceLoadFail",
87
93
  networkDecodingFail = "networkDecodingFail",
88
94
  handleLog = "handleLog"
89
95
  }
@@ -111,6 +117,13 @@ export declare class SuperwallEvent {
111
117
  reason?: PaywallPresentationRequestStatusReason;
112
118
  restoreType?: RestoreType;
113
119
  userAttributes?: Record<string, any>;
120
+ audienceFilterParams?: Record<string, any>;
121
+ count?: number;
122
+ duration?: number;
123
+ url?: string;
124
+ errorMessage?: string;
125
+ userEnrichment?: Record<string, any>;
126
+ deviceEnrichment?: Record<string, any>;
114
127
  private constructor();
115
128
  static fromJson(json: any): SuperwallEvent;
116
129
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SuperwallEventInfo.d.ts","sourceRoot":"","sources":["../../../../src/compat/lib/SuperwallEventInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EACL,gCAAgC,EAChC,sCAAsC,EACvC,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,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,qBAAa,kBAAkB;IAC7B,KAAK,EAAE,cAAc,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,M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sBAAsB,GAAG,kBAAkB,CAAA;AACvD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAA"}
@@ -89,6 +89,12 @@ export var EventType;
89
89
  EventType["enrichmentStart"] = "enrichmentStart";
90
90
  EventType["enrichmentComplete"] = "enrichmentComplete";
91
91
  EventType["enrichmentFail"] = "enrichmentFail";
92
+ EventType["integrationAttributes"] = "integrationAttributes";
93
+ EventType["expressionResult"] = "expressionResult";
94
+ EventType["reviewRequested"] = "reviewRequested";
95
+ EventType["reviewGranted"] = "reviewGranted";
96
+ EventType["reviewDenied"] = "reviewDenied";
97
+ EventType["paywallResourceLoadFail"] = "paywallResourceLoadFail";
92
98
  EventType["networkDecodingFail"] = "networkDecodingFail";
93
99
  EventType["handleLog"] = "handleLog";
94
100
  })(EventType || (EventType = {}));
@@ -116,6 +122,13 @@ export class SuperwallEvent {
116
122
  reason;
117
123
  restoreType;
118
124
  userAttributes;
125
+ audienceFilterParams;
126
+ count;
127
+ duration;
128
+ url;
129
+ errorMessage;
130
+ userEnrichment;
131
+ deviceEnrichment;
119
132
  constructor(options) {
120
133
  Object.assign(this, options);
121
134
  }
@@ -142,11 +155,16 @@ export class SuperwallEvent {
142
155
  case EventType.errorThrown:
143
156
  case EventType.confirmAllAssignments:
144
157
  case EventType.shimmerViewStart:
145
- case EventType.shimmerViewComplete:
146
158
  case EventType.subscriptionStatusDidChange:
147
159
  case EventType.enrichmentFail:
148
160
  case EventType.networkDecodingFail:
161
+ case EventType.expressionResult:
149
162
  return new SuperwallEvent({ type: eventType });
163
+ case EventType.shimmerViewComplete:
164
+ return new SuperwallEvent({
165
+ type: eventType,
166
+ duration: json.duration,
167
+ });
150
168
  case EventType.restoreFail:
151
169
  return new SuperwallEvent({
152
170
  type: eventType,
@@ -173,7 +191,6 @@ export class SuperwallEvent {
173
191
  case EventType.paywallDecline:
174
192
  case EventType.transactionRestore: // Note: transactionRestore was duplicated, keeping one
175
193
  case EventType.paywallWebviewLoadStart:
176
- case EventType.paywallWebviewLoadFail:
177
194
  case EventType.paywallWebviewLoadComplete:
178
195
  case EventType.paywallWebviewLoadTimeout:
179
196
  case EventType.paywallWebviewLoadFallback:
@@ -181,6 +198,12 @@ export class SuperwallEvent {
181
198
  type: eventType,
182
199
  paywallInfo: PaywallInfo.fromJson(json.paywallInfo),
183
200
  });
201
+ case EventType.paywallWebviewLoadFail:
202
+ return new SuperwallEvent({
203
+ type: eventType,
204
+ paywallInfo: PaywallInfo.fromJson(json.paywallInfo),
205
+ errorMessage: json.errorMessage,
206
+ });
184
207
  case EventType.transactionStart:
185
208
  case EventType.transactionAbandon:
186
209
  case EventType.subscriptionStart:
@@ -224,12 +247,17 @@ export class SuperwallEvent {
224
247
  });
225
248
  case EventType.paywallResponseLoadComplete:
226
249
  case EventType.paywallProductsLoadStart:
227
- case EventType.paywallProductsLoadFail:
228
250
  case EventType.paywallProductsLoadComplete:
229
251
  return new SuperwallEvent({
230
252
  type: eventType,
231
253
  triggeredEventName: json.triggeredEventName, // Assuming this should be based on json.paywallInfo or similar
232
254
  });
255
+ case EventType.paywallProductsLoadFail:
256
+ return new SuperwallEvent({
257
+ type: eventType,
258
+ triggeredEventName: json.triggeredEventName,
259
+ errorMessage: json.errorMessage,
260
+ });
233
261
  case EventType.paywallProductsLoadRetry:
234
262
  return new SuperwallEvent({
235
263
  type: eventType,
@@ -290,8 +318,26 @@ export class SuperwallEvent {
290
318
  case EventType.enrichmentComplete:
291
319
  return new SuperwallEvent({
292
320
  type: eventType,
293
- userAttributes: json.userEnrichment, // Assuming these are the correct json keys
294
- deviceAttributes: json.deviceEnrichment,
321
+ userEnrichment: json.userEnrichment,
322
+ deviceEnrichment: json.deviceEnrichment,
323
+ });
324
+ case EventType.integrationAttributes:
325
+ return new SuperwallEvent({
326
+ type: eventType,
327
+ audienceFilterParams: json.audienceFilterParams,
328
+ });
329
+ case EventType.reviewRequested:
330
+ case EventType.reviewGranted:
331
+ case EventType.reviewDenied:
332
+ return new SuperwallEvent({
333
+ type: eventType,
334
+ count: json.count,
335
+ });
336
+ case EventType.paywallResourceLoadFail:
337
+ return new SuperwallEvent({
338
+ type: eventType,
339
+ url: json.url,
340
+ error: json.error,
295
341
  });
296
342
  default:
297
343
  console.warn(`Unhandled event type in SuperwallEvent.fromJson: ${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,CAAN,IAAY,SAiEX;AAjED,WAAY,SAAS;IACnB,oCAAuB,CAAA;IACvB,4CAA+B,CAAA;IAC/B,gCAAmB,CAAA;IACnB,oCAAuB,CAAA;IACvB,4CAA+B,CAAA;IAC/B,sCAAyB,CAAA;IACzB,0CAA6B,CAAA;IAC7B,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AAE,SAAS,EAAE,CAAC,CAAA;YAChD,KAAK,SAAS,CAAC,kBAAkB;gBAC/B,OAAO,IAAI,cAAc,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA,CAAC,kCAAkC;YACnF,KAAK,SAAS,CAAC,cAAc;gBAC3B,OAAO,IAAI,cAAc,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA,CAAC,6BAA6B;YAC9E,KAAK,SAAS,CAAC,eAAe;gBAC5B,OAAO,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,EAAE,2CAA2C;oBAChF,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;iBACxC,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 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\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 }) {\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.shimmerViewComplete:\n case EventType.subscriptionStatusDidChange:\n case EventType.enrichmentFail:\n case EventType.networkDecodingFail:\n return new SuperwallEvent({ type: eventType })\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.paywallWebviewLoadFail:\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.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.paywallProductsLoadFail:\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.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 userAttributes: json.userEnrichment, // Assuming these are the correct json keys\n deviceAttributes: json.deviceEnrichment,\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":[],"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,CAAN,IAAY,SAuEX;AAvED,WAAY,SAAS;IACnB,oCAAuB,CAAA;IACvB,4CAA+B,CAAA;IAC/B,gCAAmB,CAAA;IACnB,oCAAuB,CAAA;IACvB,4CAA+B,CAAA;IAC/B,sCAAyB,CAAA;IACzB,0CAA6B,CAAA;IAC7B,kDAAqC,CAAA;IACrC,wEAA2D,CAAA;IAC3D,kCAAqB,CAAA;IACrB,kCAAqB,CAA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AAE,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"]}
@@ -212,6 +212,19 @@ extension SuperwallEvent {
212
212
  return json
213
213
  case .enrichmentFail:
214
214
  return ["event": "enrichmentFail"]
215
+ case .paywallProductsLoadMissingProducts(let triggeredEventName, let paywallInfo, let identifiers):
216
+ return [
217
+ "event": "paywallProductsLoadMissingProducts",
218
+ "triggeredEventName": triggeredEventName ?? "",
219
+ "paywallInfo": paywallInfo.toJson(),
220
+ "identifiers": Array(identifiers)
221
+ ]
222
+ case .networkDecodingFail:
223
+ return ["event": "networkDecodingFail"]
224
+ case .integrationAttributes(let attributes):
225
+ return ["event": "integrationAttributes", "attributes": attributes]
226
+ case .reviewRequested(let count):
227
+ return ["event": "reviewRequested", "count": count]
215
228
  default:
216
229
  return ["event": "unknown"]
217
230
  }
@@ -19,7 +19,7 @@ Pod::Spec.new do |s|
19
19
  s.static_framework = true
20
20
 
21
21
  s.dependency 'ExpoModulesCore'
22
- s.dependency "SuperwallKit", '4.5.2'
22
+ s.dependency "SuperwallKit", '4.8.2'
23
23
 
24
24
 
25
25
  # Swift/Objective-C compatibility
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-superwall",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Offical Expo Integration for Superwall",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",