expo-superwall 1.0.5 → 1.0.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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 6a8fea6: Fix compat event decoding for `paywallPreloadStart`.
8
+
9
+ ## 1.0.6
10
+
11
+ ### Patch Changes
12
+
13
+ - a343340: Prevent `configure()` from settling its Expo promise more than once during
14
+ native setup on iOS and Android. This avoids crashes such as
15
+ `PromiseAlreadySettledException` if the native SDK completion handler is
16
+ invoked more than once.
17
+
3
18
  ## 1.0.5
4
19
 
5
20
  ### Patch Changes
@@ -145,6 +145,7 @@ class SuperwallExpoModule : Module() {
145
145
  sdkVersion: String?,
146
146
  promise: Promise ->
147
147
  ioScope.launch {
148
+ val promiseSettled = java.util.concurrent.atomic.AtomicBoolean(false)
148
149
  try{
149
150
  val superwallOptions: SuperwallOptions = options?.let {
150
151
  superwallOptionsFromJson(options)
@@ -175,13 +176,17 @@ class SuperwallExpoModule : Module() {
175
176
  completion = {
176
177
  Superwall.instance.setPlatformWrapper("Expo", version = sdkVersion ?: "0.0.0")
177
178
  Superwall.instance.delegate = SuperwallDelegateBridge()
178
- promise.resolve(true)
179
+ if (promiseSettled.compareAndSet(false, true)) {
180
+ promise.resolve(true)
181
+ }
179
182
  }
180
183
  )
181
184
  } catch (error: Throwable) {
182
185
  error.printStackTrace()
183
- scope.launch {
184
- promise.reject(CodedException(error))
186
+ if (promiseSettled.compareAndSet(false, true)) {
187
+ scope.launch {
188
+ promise.reject(CodedException(error))
189
+ }
185
190
  }
186
191
  }
187
192
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-superwall",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Offical Expo Integration for Superwall",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",
@@ -59,6 +59,10 @@ export declare enum EventType {
59
59
  paywallProductsLoadStart = "paywallProductsLoadStart",
60
60
  paywallProductsLoadFail = "paywallProductsLoadFail",
61
61
  paywallProductsLoadComplete = "paywallProductsLoadComplete",
62
+ paywallWebviewProcessTerminated = "paywallWebviewProcessTerminated",
63
+ paywallProductsLoadMissingProducts = "paywallProductsLoadMissingProducts",
64
+ paywallPreloadStart = "paywallPreloadStart",
65
+ paywallPreloadComplete = "paywallPreloadComplete",
62
66
  paywallProductsLoadRetry = "paywallProductsLoadRetry",
63
67
  surveyResponse = "surveyResponse",
64
68
  paywallPresentationRequest = "paywallPresentationRequest",
@@ -124,6 +128,8 @@ export declare class SuperwallEvent {
124
128
  restoreType?: RestoreType;
125
129
  userAttributes?: Record<string, any>;
126
130
  audienceFilterParams?: Record<string, any>;
131
+ identifiers?: string[];
132
+ paywallCount?: number;
127
133
  count?: number;
128
134
  duration?: number;
129
135
  url?: string;
@@ -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,MAAM,EAAE,GAAG,CAAC,CAAA;gBAEhB,KAAK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AC,EAAE,MAAM,CAAA;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,YAAY,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,gCAAgC,CAAA;IACzC,MAAM,CAAC,EAAE,sCAAsC,CAAA;IAC/C,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC1C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAEtC,OAAO;IAsCP,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,cAAc;CA+O3C;AAED;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CAAA;AACvD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAA"}
@@ -64,6 +64,10 @@ export var EventType;
64
64
  EventType["paywallProductsLoadStart"] = "paywallProductsLoadStart";
65
65
  EventType["paywallProductsLoadFail"] = "paywallProductsLoadFail";
66
66
  EventType["paywallProductsLoadComplete"] = "paywallProductsLoadComplete";
67
+ EventType["paywallWebviewProcessTerminated"] = "paywallWebviewProcessTerminated";
68
+ EventType["paywallProductsLoadMissingProducts"] = "paywallProductsLoadMissingProducts";
69
+ EventType["paywallPreloadStart"] = "paywallPreloadStart";
70
+ EventType["paywallPreloadComplete"] = "paywallPreloadComplete";
67
71
  EventType["paywallProductsLoadRetry"] = "paywallProductsLoadRetry";
68
72
  EventType["surveyResponse"] = "surveyResponse";
69
73
  EventType["paywallPresentationRequest"] = "paywallPresentationRequest";
@@ -129,6 +133,8 @@ export class SuperwallEvent {
129
133
  restoreType;
130
134
  userAttributes;
131
135
  audienceFilterParams;
136
+ identifiers;
137
+ paywallCount;
132
138
  count;
133
139
  duration;
134
140
  url;
@@ -202,10 +208,24 @@ export class SuperwallEvent {
202
208
  case EventType.paywallWebviewLoadComplete:
203
209
  case EventType.paywallWebviewLoadTimeout:
204
210
  case EventType.paywallWebviewLoadFallback:
211
+ case EventType.paywallWebviewProcessTerminated:
205
212
  return new SuperwallEvent({
206
213
  type: eventType,
207
214
  paywallInfo: PaywallInfo.fromJson(json.paywallInfo),
208
215
  });
216
+ case EventType.paywallProductsLoadMissingProducts:
217
+ return new SuperwallEvent({
218
+ type: eventType,
219
+ triggeredEventName: json.triggeredEventName,
220
+ paywallInfo: PaywallInfo.fromJson(json.paywallInfo),
221
+ identifiers: json.identifiers,
222
+ });
223
+ case EventType.paywallPreloadStart:
224
+ case EventType.paywallPreloadComplete:
225
+ return new SuperwallEvent({
226
+ type: eventType,
227
+ paywallCount: json.paywallCount,
228
+ });
209
229
  case EventType.paywallWebviewLoadFail:
210
230
  return new SuperwallEvent({
211
231
  type: eventType,
@@ -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,E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,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,KAAK,SAAS,CAAC,mBAAmB,CAAC;YACnC,KAAK,SAAS,CAAC,oBAAoB,CAAC;YACpC,KAAK,SAAS,CAAC,sBAAsB,CAAC;YACtC,KAAK,SAAS,CAAC,kBAAkB;gBAC/B,OAAO,IAAI,cAAc,CAAC;oBACxB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC;iBACpD,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 testModeModalOpen = \"testModeModalOpen\",\n testModeModalClose = \"testModeModalClose\",\n stripeCheckoutStart = \"stripeCheckoutStart\",\n stripeCheckoutSubmit = \"stripeCheckoutSubmit\",\n stripeCheckoutComplete = \"stripeCheckoutComplete\",\n stripeCheckoutFail = \"stripeCheckoutFail\",\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 case EventType.testModeModalOpen:\n case EventType.testModeModalClose:\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 case EventType.stripeCheckoutStart:\n case EventType.stripeCheckoutSubmit:\n case EventType.stripeCheckoutComplete:\n case EventType.stripeCheckoutFail:\n return new SuperwallEvent({\n type: eventType,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\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"]}
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,SAiFX;AAjFD,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,CAAA;IACrB,wCAA2B,CA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C,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,KAAK,SAAS,CAAC,mBAAmB,CAAC;YACnC,KAAK,SAAS,CAAC,oBAAoB,CAAC;YACpC,KAAK,SAAS,CAAC,sBAAsB,CAAC;YACtC,KAAK,SAAS,CAAC,kBAAkB;gBAC/B,OAAO,IAAI,cAAc,CAAC;oBACxB,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC;iBACpD,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 paywallWebviewProcessTerminated = \"paywallWebviewProcessTerminated\",\n paywallProductsLoadMissingProducts = \"paywallProductsLoadMissingProducts\",\n paywallPreloadStart = \"paywallPreloadStart\",\n paywallPreloadComplete = \"paywallPreloadComplete\",\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 testModeModalOpen = \"testModeModalOpen\",\n testModeModalClose = \"testModeModalClose\",\n stripeCheckoutStart = \"stripeCheckoutStart\",\n stripeCheckoutSubmit = \"stripeCheckoutSubmit\",\n stripeCheckoutComplete = \"stripeCheckoutComplete\",\n stripeCheckoutFail = \"stripeCheckoutFail\",\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 identifiers?: string[]\n paywallCount?: number\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 identifiers?: string[]\n paywallCount?: number\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 case EventType.testModeModalOpen:\n case EventType.testModeModalClose:\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 case EventType.paywallWebviewProcessTerminated:\n return new SuperwallEvent({\n type: eventType,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n })\n case EventType.paywallProductsLoadMissingProducts:\n return new SuperwallEvent({\n type: eventType,\n triggeredEventName: json.triggeredEventName,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\n identifiers: json.identifiers,\n })\n case EventType.paywallPreloadStart:\n case EventType.paywallPreloadComplete:\n return new SuperwallEvent({\n type: eventType,\n paywallCount: json.paywallCount,\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 case EventType.stripeCheckoutStart:\n case EventType.stripeCheckoutSubmit:\n case EventType.stripeCheckoutComplete:\n case EventType.stripeCheckoutFail:\n return new SuperwallEvent({\n type: eventType,\n paywallInfo: PaywallInfo.fromJson(json.paywallInfo),\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"]}
@@ -1,6 +1,22 @@
1
1
  import ExpoModulesCore
2
2
  import SuperwallKit
3
3
 
4
+ /// Thread-safe boolean flag that can only be set once.
5
+ private final class AtomicFlag {
6
+ private var _value = false
7
+ private let lock = NSLock()
8
+
9
+ /// Sets the flag and returns the previous value.
10
+ /// Returns `false` on the first call, `true` on subsequent calls.
11
+ func testAndSet() -> Bool {
12
+ lock.lock()
13
+ defer { lock.unlock() }
14
+ let prev = _value
15
+ _value = true
16
+ return prev
17
+ }
18
+ }
19
+
4
20
  public class SuperwallExpoModule: Module {
5
21
  public static var shared: SuperwallExpoModule?
6
22
 
@@ -102,6 +118,8 @@ public class SuperwallExpoModule: Module {
102
118
  superwallOptions = SuperwallOptions.fromJson(options)
103
119
  }
104
120
 
121
+ let promiseSettled = AtomicFlag()
122
+
105
123
  Superwall.configure(
106
124
  apiKey: apiKey,
107
125
  purchaseController: usingPurchaseController ? purchaseController : nil,
@@ -112,7 +130,9 @@ public class SuperwallExpoModule: Module {
112
130
 
113
131
  Superwall.shared.setPlatformWrapper("Expo", version: sdkVersion ?? "0.0.0")
114
132
 
115
- promise.resolve(nil)
133
+ if promiseSettled.testAndSet() == false {
134
+ promise.resolve(nil)
135
+ }
116
136
  }
117
137
  )
118
138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-superwall",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Offical Expo Integration for Superwall",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",