@virex-tech/paywallo-sdk 2.0.0 → 2.0.2

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/dist/index.d.mts CHANGED
@@ -530,8 +530,8 @@ interface EventContext {
530
530
  * `lifecycle` (foreground/background/session), `onboarding`,
531
531
  * `notification`, `custom`.
532
532
  *
533
- * Both priorities post to `/api/v2/ingest/batch` (Phase 3.1 envelope) with
534
- * automatic fallback to `/api/v1/events/batch` when the V2 endpoint is
533
+ * Both priorities post to `/ingest/batch` (Phase 3.1 envelope) with
534
+ * automatic fallback to `/events/batch` when the V2 endpoint is
535
535
  * absent (old server) or rejects the request. `OfflineQueue` handles
536
536
  * network-failure durability for both queues via the `PostFn` injected by
537
537
  * `ApiClient.postWithQueue`.
package/dist/index.d.ts CHANGED
@@ -530,8 +530,8 @@ interface EventContext {
530
530
  * `lifecycle` (foreground/background/session), `onboarding`,
531
531
  * `notification`, `custom`.
532
532
  *
533
- * Both priorities post to `/api/v2/ingest/batch` (Phase 3.1 envelope) with
534
- * automatic fallback to `/api/v1/events/batch` when the V2 endpoint is
533
+ * Both priorities post to `/ingest/batch` (Phase 3.1 envelope) with
534
+ * automatic fallback to `/events/batch` when the V2 endpoint is
535
535
  * absent (old server) or rejects the request. `OfflineQueue` handles
536
536
  * network-failure durability for both queues via the `PostFn` injected by
537
537
  * `ApiClient.postWithQueue`.
package/dist/index.js CHANGED
@@ -1555,7 +1555,7 @@ var init_QueueProcessor = __esm({
1555
1555
  }
1556
1556
  const allItems = offlineQueue.getQueue();
1557
1557
  const eventItems = allItems.filter(
1558
- (i) => (i.url.includes("/api/v1/events") || i.url.includes("/api/v2/ingest")) && !i.url.includes("/batch")
1558
+ (i) => (i.url.includes("/events") || i.url.includes("/ingest")) && !i.url.includes("/batch")
1559
1559
  );
1560
1560
  const eventItemIds = new Set(eventItems.map((i) => i.id));
1561
1561
  const { processed: batchProcessed, failed: batchFailed, retryIds } = await this.processEventBatches(eventItems);
@@ -1595,7 +1595,7 @@ var init_QueueProcessor = __esm({
1595
1595
  const freshHeaders = this.config.getFreshHeaders?.() ?? {};
1596
1596
  const headers = { ...persistedHeaders, ...freshHeaders };
1597
1597
  this.log("Sending event batch", { size: batch.length, batchIndex: Math.floor(i / BATCH_SIZE) });
1598
- const response = await this.httpClient.request("/api/v1/events/batch", {
1598
+ const response = await this.httpClient.request("/sdk/events/batch", {
1599
1599
  method: "POST",
1600
1600
  body: { events: bodies },
1601
1601
  headers,
@@ -4243,7 +4243,7 @@ var init_InstallTracker = __esm({
4243
4243
  const baseUrl = apiClient.getBaseUrl();
4244
4244
  const appKey = apiClient.getAppKey();
4245
4245
  const referrer = await installReferrerManager.getReferrer();
4246
- await fetch(`${baseUrl}/api/v1/attribution/deferred-match/${appKey}`, {
4246
+ await fetch(`${baseUrl}/attribution/deferred-match/${appKey}`, {
4247
4247
  method: "POST",
4248
4248
  headers: { "Content-Type": "application/json", "X-App-Key": appKey },
4249
4249
  body: JSON.stringify({
@@ -4424,8 +4424,15 @@ var init_NativePushBridge = __esm({
4424
4424
  const mod = import_react_native17.NativeModules.PaywalloNotifications;
4425
4425
  if (!mod) return -1;
4426
4426
  const status = await mod.requestPermission(options ?? {});
4427
+ if (status === "granted" || status === "provisional") {
4428
+ try {
4429
+ await mod.registerForPush();
4430
+ } catch {
4431
+ }
4432
+ }
4427
4433
  return mapStatusToNumber(status);
4428
- } catch {
4434
+ } catch (err) {
4435
+ console.warn("[NativePushBridge] requestPermission error:", err instanceof Error ? err.message : String(err));
4429
4436
  return -1;
4430
4437
  }
4431
4438
  }
@@ -4502,17 +4509,13 @@ function getTimezone() {
4502
4509
  }
4503
4510
  }
4504
4511
  function detectPlatform() {
4505
- try {
4506
- const { Platform: Platform13 } = require("react-native");
4507
- return Platform13.OS === "ios" ? "ios" : "android";
4508
- } catch {
4509
- return "android";
4510
- }
4512
+ return import_react_native18.Platform.OS === "ios" ? "ios" : "android";
4511
4513
  }
4512
- var SEEN_MESSAGES_KEY, SEEN_TTL_MS, MAX_SEEN_SIZE, NotificationEventTracker;
4514
+ var import_react_native18, SEEN_MESSAGES_KEY, SEEN_TTL_MS, MAX_SEEN_SIZE, NotificationEventTracker;
4513
4515
  var init_NotificationEventTracker = __esm({
4514
4516
  "src/domains/notifications/NotificationEventTracker.ts"() {
4515
4517
  "use strict";
4518
+ import_react_native18 = require("react-native");
4516
4519
  SEEN_MESSAGES_KEY = "seen_messages";
4517
4520
  SEEN_TTL_MS = 60 * 60 * 1e3;
4518
4521
  MAX_SEEN_SIZE = 1e3;
@@ -4763,18 +4766,18 @@ function mapPermissionStatus(status) {
4763
4766
  }
4764
4767
  }
4765
4768
  function getPlatform() {
4766
- return import_react_native18.Platform;
4769
+ return import_react_native19.Platform;
4767
4770
  }
4768
4771
  function needsAndroidRuntimePermission(platform) {
4769
4772
  if (platform.OS !== "android") return false;
4770
4773
  const v = typeof platform.Version === "string" ? parseInt(platform.Version, 10) : platform.Version ?? 0;
4771
4774
  return Number.isFinite(v) && v >= ANDROID_TIRAMISU_API;
4772
4775
  }
4773
- var import_react_native18, AUTH_STATUS, ANDROID_TIRAMISU_API, PermissionManager;
4776
+ var import_react_native19, AUTH_STATUS, ANDROID_TIRAMISU_API, PermissionManager;
4774
4777
  var init_PermissionManager = __esm({
4775
4778
  "src/domains/notifications/PermissionManager.ts"() {
4776
4779
  "use strict";
4777
- import_react_native18 = require("react-native");
4780
+ import_react_native19 = require("react-native");
4778
4781
  AUTH_STATUS = {
4779
4782
  NOT_DETERMINED: -1,
4780
4783
  DENIED: 0,
@@ -4800,11 +4803,18 @@ var init_PermissionManager = __esm({
4800
4803
  const platform = this.platformOverride ?? getPlatform();
4801
4804
  if (this.debug) console.warn("[paywallo-push] platform detected:", platform.OS, "version:", String(platform.Version ?? "n/a"));
4802
4805
  if (platform.OS === "ios") {
4803
- if (this.debug) console.log("[paywallo-push] requestPermission iOS", options);
4804
- const raw2 = await this.bridge.requestPermission(options);
4805
- const status2 = mapPermissionStatus(raw2);
4806
- this.emitOsEvent(status2);
4807
- return status2;
4806
+ if (this.debug) console.warn("[paywallo-push] requestPermission iOS \u2014 calling bridge...");
4807
+ try {
4808
+ const raw2 = await this.bridge.requestPermission(options);
4809
+ if (this.debug) console.warn("[paywallo-push] bridge returned raw:", raw2);
4810
+ const status2 = mapPermissionStatus(raw2);
4811
+ if (this.debug) console.warn("[paywallo-push] mapped status:", status2);
4812
+ this.emitOsEvent(status2);
4813
+ return status2;
4814
+ } catch (err) {
4815
+ console.warn("[paywallo-push] requestPermission iOS CRASHED:", err instanceof Error ? err.message : String(err));
4816
+ throw err;
4817
+ }
4808
4818
  }
4809
4819
  if (!needsAndroidRuntimePermission(platform)) {
4810
4820
  if (this.debug) console.log("[paywallo-push] Android <13: auto-granted");
@@ -4984,12 +4994,7 @@ function mapPermissionStatus2(status) {
4984
4994
  }
4985
4995
  }
4986
4996
  function detectPlatform2() {
4987
- try {
4988
- const { Platform: Platform13 } = require("react-native");
4989
- return Platform13.OS === "ios" ? "ios" : "android";
4990
- } catch {
4991
- return "android";
4992
- }
4997
+ return import_react_native20.Platform.OS === "ios" ? "ios" : "android";
4993
4998
  }
4994
4999
  async function getAppVersion() {
4995
5000
  try {
@@ -5000,10 +5005,11 @@ async function getAppVersion() {
5000
5005
  return "unknown";
5001
5006
  }
5002
5007
  }
5003
- var AUTH_STATUS2, LOCALE_WHITELIST;
5008
+ var import_react_native20, AUTH_STATUS2, LOCALE_WHITELIST;
5004
5009
  var init_utils = __esm({
5005
5010
  "src/domains/notifications/utils.ts"() {
5006
5011
  "use strict";
5012
+ import_react_native20 = require("react-native");
5007
5013
  init_NotificationsError();
5008
5014
  AUTH_STATUS2 = {
5009
5015
  NOT_DETERMINED: -1,
@@ -5018,8 +5024,8 @@ var init_utils = __esm({
5018
5024
  // src/core/version.ts
5019
5025
  function resolveVersion() {
5020
5026
  try {
5021
- if ("2.0.0") {
5022
- return "2.0.0";
5027
+ if ("2.0.2") {
5028
+ return "2.0.2";
5023
5029
  }
5024
5030
  } catch {
5025
5031
  }
@@ -5100,7 +5106,7 @@ var init_TokenRegistration = __esm({
5100
5106
  init_utils();
5101
5107
  init_version();
5102
5108
  FCM_TOKEN_KEY = "@panel:push_token";
5103
- TOKEN_ENDPOINT = "/api/v2/push-tokens";
5109
+ TOKEN_ENDPOINT = "/push-tokens";
5104
5110
  }
5105
5111
  });
5106
5112
 
@@ -5297,14 +5303,23 @@ var init_NotificationsManager = __esm({
5297
5303
  }
5298
5304
  /** Requests OS permission and, on success, captures + registers the push token. */
5299
5305
  async requestPushPermission(options) {
5300
- const status = await this.permissionManager.requestPermission(options);
5301
- this.permissionStatus = status;
5302
- if (status === "granted" || status === "provisional") {
5303
- await this.captureAndRegisterToken();
5304
- } else if (this.debug) {
5305
- console.log("[Paywallo PUSH] permission not granted, skipping token register:", status);
5306
+ if (this.debug) console.warn("[Paywallo PUSH] requestPushPermission called");
5307
+ try {
5308
+ const status = await this.permissionManager.requestPermission(options);
5309
+ if (this.debug) console.warn("[Paywallo PUSH] permissionManager returned:", status);
5310
+ this.permissionStatus = status;
5311
+ if (status === "granted" || status === "provisional") {
5312
+ if (this.debug) console.warn("[Paywallo PUSH] permission granted \u2014 capturing token...");
5313
+ await this.captureAndRegisterToken();
5314
+ if (this.debug) console.warn("[Paywallo PUSH] token capture complete");
5315
+ } else {
5316
+ if (this.debug) console.warn("[Paywallo PUSH] permission not granted, skipping token register:", status);
5317
+ }
5318
+ return status;
5319
+ } catch (err) {
5320
+ console.warn("[Paywallo PUSH] requestPushPermission CRASHED:", err instanceof Error ? err.message : String(err));
5321
+ throw err;
5306
5322
  }
5307
- return status;
5308
5323
  }
5309
5324
  async captureAndRegisterToken() {
5310
5325
  await captureAndRegisterToken(
@@ -5736,7 +5751,7 @@ function deriveWebUrl(baseUrl) {
5736
5751
  }
5737
5752
  }
5738
5753
  function buildConditionalFlagUrl(baseUrl, flagKey, context) {
5739
- const url = new URL(`${baseUrl}/api/v1/conditional-flags/${flagKey}`);
5754
+ const url = new URL(`${baseUrl}/sdk/conditional-flags/${flagKey}`);
5740
5755
  if (context.platform) url.searchParams.set("platform", context.platform);
5741
5756
  if (context.appVersion) url.searchParams.set("appVersion", context.appVersion);
5742
5757
  if (context.country) url.searchParams.set("country", context.country);
@@ -5792,7 +5807,7 @@ async function getVariant(deps, flagKey, distinctId) {
5792
5807
  return persisted;
5793
5808
  }
5794
5809
  try {
5795
- const res = await deps.get(`/api/v1/flags/${flagKey}?distinctId=${encodeURIComponent(distinctId)}`);
5810
+ const res = await deps.get(`/sdk/flags/${flagKey}?distinctId=${encodeURIComponent(distinctId)}`);
5796
5811
  if (res.status === 404) {
5797
5812
  const v = { variant: null };
5798
5813
  deps.cache.setVariant(key, v, deps.cache.nullTTL);
@@ -5813,7 +5828,7 @@ async function getVariant(deps, flagKey, distinctId) {
5813
5828
  async function evaluateFlags(deps, keys, distinctId) {
5814
5829
  const query = keys.map(encodeURIComponent).join(",");
5815
5830
  try {
5816
- const res = await deps.httpClient.get(`/api/v1/flags/evaluate?keys=${query}`, {
5831
+ const res = await deps.httpClient.get(`/sdk/flags/evaluate?keys=${query}`, {
5817
5832
  headers: { "X-App-Key": deps.appKey, "x-distinct-id": distinctId }
5818
5833
  });
5819
5834
  if (!res.ok || typeof res.data !== "object" || res.data === null || Array.isArray(res.data)) return {};
@@ -5864,7 +5879,7 @@ var init_ApiClientFlags = __esm({
5864
5879
  // src/domains/iap/apiPurchaseMethods.ts
5865
5880
  async function validatePurchase(client, appKey, platform, receipt, productId, transactionId, priceLocal, currency, country, distinctId, paywallPlacement, variantKey) {
5866
5881
  const response = await client.post(
5867
- `/purchases/validate`,
5882
+ `/sdk/purchases/validate`,
5868
5883
  {
5869
5884
  platform,
5870
5885
  receipt,
@@ -5890,7 +5905,7 @@ async function validatePurchase(client, appKey, platform, receipt, productId, tr
5890
5905
  return response.data;
5891
5906
  }
5892
5907
  async function getSubscriptionStatus(client, baseUrl, appKey, distinctId) {
5893
- const url = new URL(`${baseUrl}/purchases/status`);
5908
+ const url = new URL(`${baseUrl}/sdk/purchases/status`);
5894
5909
  url.searchParams.set("distinctId", distinctId);
5895
5910
  const response = await client.get(url.toString());
5896
5911
  if (!response.ok) {
@@ -5900,7 +5915,7 @@ async function getSubscriptionStatus(client, baseUrl, appKey, distinctId) {
5900
5915
  }
5901
5916
  async function getEmergencyPaywall(client) {
5902
5917
  try {
5903
- const response = await client.get("/api/v1/emergency-paywall");
5918
+ const response = await client.get("/emergency-paywall");
5904
5919
  if (response.status === 404) return { enabled: false };
5905
5920
  return response.data;
5906
5921
  } catch {
@@ -5908,7 +5923,7 @@ async function getEmergencyPaywall(client) {
5908
5923
  }
5909
5924
  }
5910
5925
  async function getCampaignData(client, baseUrl, placement, distinctId, context) {
5911
- const url = new URL(`${baseUrl}/api/v1/campaigns/${placement}`);
5926
+ const url = new URL(`${baseUrl}/sdk/campaigns/${placement}`);
5912
5927
  url.searchParams.set("distinctId", distinctId);
5913
5928
  if (context) url.searchParams.set("context", JSON.stringify(context));
5914
5929
  const response = await client.get(url.toString());
@@ -6419,7 +6434,7 @@ function buildV2Envelope(events, providerContext) {
6419
6434
  };
6420
6435
  });
6421
6436
  if (context.sdk_version === void 0) context.sdk_version = SDK_VERSION;
6422
- if (context.platform === void 0) context.platform = import_react_native19.Platform.OS;
6437
+ if (context.platform === void 0) context.platform = import_react_native21.Platform.OS;
6423
6438
  if (context.distinct_id === void 0 && events.length > 0) {
6424
6439
  context.distinct_id = events[0].distinctId;
6425
6440
  }
@@ -6456,12 +6471,12 @@ function splitPayloadAndContext(properties) {
6456
6471
  }
6457
6472
  return { payload, promoted };
6458
6473
  }
6459
- var import_zod2, import_react_native19, v2EventSchema, v2ContextSchema, v2EnvelopeSchema, CONTEXT_KEY_ALIASES;
6474
+ var import_zod2, import_react_native21, v2EventSchema, v2ContextSchema, v2EnvelopeSchema, CONTEXT_KEY_ALIASES;
6460
6475
  var init_eventEnvelopeV2 = __esm({
6461
6476
  "src/core/eventEnvelopeV2.ts"() {
6462
6477
  "use strict";
6463
6478
  import_zod2 = require("zod");
6464
- import_react_native19 = require("react-native");
6479
+ import_react_native21 = require("react-native");
6465
6480
  init_version();
6466
6481
  init_uuid();
6467
6482
  init_eventFamilies();
@@ -6507,19 +6522,19 @@ var init_eventEnvelopeV2 = __esm({
6507
6522
  });
6508
6523
 
6509
6524
  // src/core/EventBatcher.ts
6510
- var import_react_native20, BATCH_MAX_SIZE, BATCH_FLUSH_MS, EVENT_NAME_REGEX, V2_BATCH_ENDPOINT, V1_BATCH_ENDPOINT, V1_SINGLE_ENDPOINT, EventBatcher;
6525
+ var import_react_native22, BATCH_MAX_SIZE, BATCH_FLUSH_MS, EVENT_NAME_REGEX, V2_BATCH_ENDPOINT, V1_BATCH_ENDPOINT, V1_SINGLE_ENDPOINT, EventBatcher;
6511
6526
  var init_EventBatcher = __esm({
6512
6527
  "src/core/EventBatcher.ts"() {
6513
6528
  "use strict";
6514
- import_react_native20 = require("react-native");
6529
+ import_react_native22 = require("react-native");
6515
6530
  init_events();
6516
6531
  init_eventEnvelopeV2();
6517
6532
  BATCH_MAX_SIZE = 25;
6518
6533
  BATCH_FLUSH_MS = 1e4;
6519
6534
  EVENT_NAME_REGEX = /^(\$[a-zA-Z0-9_]+|[a-z][a-z0-9_]*)$/;
6520
- V2_BATCH_ENDPOINT = "/api/v2/ingest/batch";
6521
- V1_BATCH_ENDPOINT = "/api/v1/events/batch";
6522
- V1_SINGLE_ENDPOINT = "/api/v1/events";
6535
+ V2_BATCH_ENDPOINT = "/ingest/batch";
6536
+ V1_BATCH_ENDPOINT = "/sdk/events/batch";
6537
+ V1_SINGLE_ENDPOINT = "/sdk/events";
6523
6538
  EventBatcher = class {
6524
6539
  constructor(post, debug = false, contextProvider = null) {
6525
6540
  this.criticalQueue = [];
@@ -6563,7 +6578,7 @@ var init_EventBatcher = __esm({
6563
6578
  const event = {
6564
6579
  eventName,
6565
6580
  distinctId,
6566
- properties: { ...properties, platform: import_react_native20.Platform.OS },
6581
+ properties: { ...properties, platform: import_react_native22.Platform.OS },
6567
6582
  timestamp: timestamp ?? Date.now(),
6568
6583
  environment: environment.toLowerCase()
6569
6584
  };
@@ -6646,8 +6661,8 @@ var init_EventBatcher = __esm({
6646
6661
  }
6647
6662
  }
6648
6663
  /**
6649
- * POST the batch with V2 envelope semantics. Tries `/api/v2/ingest/batch`
6650
- * first; on failure (404/network) falls back to `/api/v1/events/batch`
6664
+ * POST the batch with V2 envelope semantics. Tries `/ingest/batch`
6665
+ * first; on failure (404/network) falls back to `/events/batch`
6651
6666
  * with the legacy per-event shape for retrocompat.
6652
6667
  *
6653
6668
  * After a single V2 failure we flip `v2Disabled` and stop trying V2 for
@@ -6677,7 +6692,7 @@ var init_EventBatcher = __esm({
6677
6692
  this.v2Disabled = true;
6678
6693
  if (this.debug) {
6679
6694
  console.log(
6680
- `[Paywallo EVENTS] V2 ingest unavailable, falling back to /api/v1/events/batch:`,
6695
+ `[Paywallo EVENTS] V2 ingest unavailable, falling back to /events/batch:`,
6681
6696
  error
6682
6697
  );
6683
6698
  }
@@ -6730,11 +6745,11 @@ var init_ApiClientQueue = __esm({
6730
6745
  });
6731
6746
 
6732
6747
  // src/core/ApiClient.ts
6733
- var import_react_native21, ApiClient;
6748
+ var import_react_native23, ApiClient;
6734
6749
  var init_ApiClient = __esm({
6735
6750
  "src/core/ApiClient.ts"() {
6736
6751
  "use strict";
6737
- import_react_native21 = require("react-native");
6752
+ import_react_native23 = require("react-native");
6738
6753
  init_version();
6739
6754
  init_apiUrlUtils();
6740
6755
  init_ApiClientFlags();
@@ -6836,7 +6851,7 @@ var init_ApiClient = __esm({
6836
6851
  buildSdkHeaders() {
6837
6852
  return {
6838
6853
  "x-sdk-version": SDK_VERSION,
6839
- "x-sdk-platform": import_react_native21.Platform.OS,
6854
+ "x-sdk-platform": import_react_native23.Platform.OS,
6840
6855
  "x-sdk-environment": this.environment
6841
6856
  };
6842
6857
  }
@@ -6861,12 +6876,12 @@ var init_ApiClient = __esm({
6861
6876
  }
6862
6877
  async reportError(errorType, message, context) {
6863
6878
  try {
6864
- await this.post("/api/v1/sdk/errors", {
6879
+ await this.post("/sdk/errors", {
6865
6880
  errorType,
6866
6881
  message,
6867
6882
  context,
6868
6883
  sdkVersion: SDK_VERSION,
6869
- platform: import_react_native21.Platform.OS
6884
+ platform: import_react_native23.Platform.OS
6870
6885
  }, true);
6871
6886
  } catch (err) {
6872
6887
  if (this.debug) console.log("[Paywallo:ApiClient] reportError failed", err);
@@ -6889,8 +6904,8 @@ var init_ApiClient = __esm({
6889
6904
  isDebug: () => this.debug,
6890
6905
  post: (path, body, skipRetry) => this.post(path, body, skipRetry)
6891
6906
  },
6892
- "/api/v1/identify",
6893
- { distinctId, properties: properties ?? {}, email, platform: import_react_native21.Platform.OS, ...deviceId && { deviceId } },
6907
+ "/identify",
6908
+ { distinctId, properties: properties ?? {}, email, platform: import_react_native23.Platform.OS, ...deviceId && { deviceId } },
6894
6909
  "identify"
6895
6910
  );
6896
6911
  }
@@ -6905,7 +6920,7 @@ var init_ApiClient = __esm({
6905
6920
  const hit = this.cache.getPaywall(placement);
6906
6921
  if (hit !== void 0) return hit;
6907
6922
  try {
6908
- const res = await this.get(`/api/v1/paywalls/${placement}`);
6923
+ const res = await this.get(`/sdk/paywalls/${placement}`);
6909
6924
  if (res.status === 404) {
6910
6925
  this.cache.setPaywall(placement, null, this.cache.nullTTL);
6911
6926
  return null;
@@ -7332,17 +7347,14 @@ async function resolveSessionFlags(state, keys, apiClient, distinctId) {
7332
7347
  }
7333
7348
  }
7334
7349
  async function doInit(state, config) {
7335
- console.warn("[Paywallo INIT] starting... debug=" + String(config.debug) + " env=" + String(config.environment ?? "auto"));
7336
7350
  const environment = config.environment ?? (typeof __DEV__ !== "undefined" && __DEV__ ? "Sandbox" : "Production");
7337
7351
  const offlineQueueEnabled = config.offlineQueueEnabled !== false;
7338
- if (config.debug) console.warn("[Paywallo INIT] step 1: network + queue");
7339
7352
  await Promise.all([
7340
7353
  networkMonitor.initialize({ debug: config.debug }),
7341
7354
  offlineQueue.initialize({ debug: config.debug }).then(
7342
7355
  () => offlineQueue.clearItemsWithInvalidAppKey(config.appKey)
7343
7356
  )
7344
7357
  ]);
7345
- if (config.debug) console.warn("[Paywallo INIT] step 1 done");
7346
7358
  const apiClient = new ApiClient(
7347
7359
  config.appKey,
7348
7360
  config.apiUrl ?? DEFAULT_API_URL2,
@@ -7365,9 +7377,7 @@ async function doInit(state, config) {
7365
7377
  cacheTTL: config.subscriptionCacheTTL,
7366
7378
  debug: config.debug
7367
7379
  });
7368
- if (config.debug) console.warn("[Paywallo INIT] step 2: identity");
7369
7380
  await identityManager.initialize(apiClient, config.debug);
7370
- if (config.debug) console.warn("[Paywallo INIT] step 2 done");
7371
7381
  if (state.pendingIdentifies.length > 0) {
7372
7382
  for (const pending of state.pendingIdentifies) {
7373
7383
  try {
@@ -7410,22 +7420,18 @@ async function doInit(state, config) {
7410
7420
  ...attribution && Object.keys(attribution).length > 0 && { attribution }
7411
7421
  };
7412
7422
  });
7413
- if (config.debug) console.warn("[Paywallo INIT] step 3: session");
7414
7423
  await sessionManager.initialize(
7415
7424
  apiClient,
7416
7425
  config.sessionConfig,
7417
7426
  config.debug,
7418
7427
  () => identityManager.getDistinctId()
7419
7428
  );
7420
- if (config.debug) console.warn("[Paywallo INIT] step 3 done");
7421
7429
  const eventPipeline = createEventPipelineBridge(apiClient);
7422
7430
  onboardingManager.injectDeps({
7423
7431
  pipeline: eventPipeline,
7424
7432
  debug: config.debug
7425
7433
  });
7426
- if (config.debug) console.warn("[Paywallo INIT] step 4: notifications");
7427
7434
  setupNotifications(apiClient, config, environment, eventPipeline);
7428
- if (config.debug) console.warn("[Paywallo INIT] step 4 done");
7429
7435
  if (config.autoStartSession !== false) {
7430
7436
  sessionManager.startSession().catch((err) => {
7431
7437
  if (config.debug) console.warn("[Paywallo INIT] autoStart session error", err);
@@ -7736,29 +7742,23 @@ var init_PaywalloClient = __esm({
7736
7742
  }
7737
7743
  async init(config) {
7738
7744
  const s = this.state;
7739
- console.warn("[Paywallo SDK] init() called, debug=" + String(config.debug) + ", appKey=" + (config.appKey ? config.appKey.substring(0, 8) + "..." : "EMPTY"));
7740
7745
  if (!s.readyPromise) s.readyPromise = new Promise((resolve) => {
7741
7746
  s.resolveReady = resolve;
7742
7747
  });
7743
7748
  if (s.config && s.apiClient) {
7744
- console.warn("[Paywallo SDK] init() skipped \u2014 already initialized");
7745
7749
  return;
7746
7750
  }
7747
7751
  if (s.initPromise) {
7748
- console.warn("[Paywallo SDK] init() skipped \u2014 already in progress");
7749
7752
  await s.initPromise;
7750
7753
  return;
7751
7754
  }
7752
7755
  if (!config.appKey) throw new ClientError(CLIENT_ERROR_CODES.MISSING_APP_KEY, "appKey is required");
7753
7756
  s.pendingConfig = config;
7754
7757
  s.initAttempts = 0;
7755
- console.warn("[Paywallo SDK] init() calling initWithRetry...");
7756
7758
  s.initPromise = initWithRetry(s, config);
7757
7759
  try {
7758
7760
  await s.initPromise;
7759
- console.warn("[Paywallo SDK] init() completed successfully");
7760
7761
  } catch (error) {
7761
- console.warn("[Paywallo SDK] init() FAILED:", error instanceof Error ? error.message : String(error));
7762
7762
  s.initPromise = null;
7763
7763
  s.config = null;
7764
7764
  s.apiClient = null;
@@ -8371,7 +8371,7 @@ function useSubscription() {
8371
8371
 
8372
8372
  // src/PaywalloProvider.tsx
8373
8373
  var import_react21 = require("react");
8374
- var import_react_native22 = require("react-native");
8374
+ var import_react_native24 = require("react-native");
8375
8375
  init_paywall();
8376
8376
  init_paywall();
8377
8377
  init_paywall();
@@ -8890,8 +8890,8 @@ function PaywalloProvider({ children, config }) {
8890
8890
  });
8891
8891
  }, []);
8892
8892
  const { showingPreloadedWebView, presentPreloadedWebView, resolvePreloadedPaywall, handlePreloadedWebViewReady: baseHandlePreloadedWebViewReady, handlePreloadedClose: baseHandlePreloadedClose, setShowingPreloadedWebView, presentedAtRef } = usePaywallPresenter(preloadedWebView, setPreloadedWebView);
8893
- const SCREEN_HEIGHT = (0, import_react21.useMemo)(() => import_react_native22.Dimensions.get("window").height, []);
8894
- const slideAnim = (0, import_react21.useRef)(new import_react_native22.Animated.Value(SCREEN_HEIGHT)).current;
8893
+ const SCREEN_HEIGHT = (0, import_react21.useMemo)(() => import_react_native24.Dimensions.get("window").height, []);
8894
+ const slideAnim = (0, import_react21.useRef)(new import_react_native24.Animated.Value(SCREEN_HEIGHT)).current;
8895
8895
  const handlePreloadedWebViewReady = (0, import_react21.useCallback)(() => {
8896
8896
  if (PaywalloClient.getConfig()?.debug) {
8897
8897
  console.log(`[Paywallo WEBVIEW] loaded \u2014 placement: ${preloadedWebView?.placement}`);
@@ -8900,7 +8900,7 @@ function PaywalloProvider({ children, config }) {
8900
8900
  }, [preloadedWebView?.placement, baseHandlePreloadedWebViewReady]);
8901
8901
  const handlePreloadedClose = (0, import_react21.useCallback)(() => {
8902
8902
  const placement = preloadedWebView?.placement;
8903
- import_react_native22.Animated.timing(slideAnim, { toValue: SCREEN_HEIGHT, duration: 200, easing: import_react_native22.Easing.in(import_react_native22.Easing.cubic), useNativeDriver: true }).start(() => {
8903
+ import_react_native24.Animated.timing(slideAnim, { toValue: SCREEN_HEIGHT, duration: 200, easing: import_react_native24.Easing.in(import_react_native24.Easing.cubic), useNativeDriver: true }).start(() => {
8904
8904
  baseHandlePreloadedClose();
8905
8905
  if (placement) triggerRepreload(placement);
8906
8906
  });
@@ -9149,7 +9149,7 @@ function PaywalloProvider({ children, config }) {
9149
9149
  (0, import_react21.useLayoutEffect)(() => {
9150
9150
  if (showingPreloadedWebView) {
9151
9151
  slideAnim.setValue(SCREEN_HEIGHT);
9152
- import_react_native22.Animated.timing(slideAnim, { toValue: 0, duration: 200, easing: import_react_native22.Easing.out(import_react_native22.Easing.cubic), useNativeDriver: true }).start();
9152
+ import_react_native24.Animated.timing(slideAnim, { toValue: 0, duration: 200, easing: import_react_native24.Easing.out(import_react_native24.Easing.cubic), useNativeDriver: true }).start();
9153
9153
  }
9154
9154
  }, [showingPreloadedWebView, slideAnim, SCREEN_HEIGHT]);
9155
9155
  const preloadStyle = [
@@ -9159,7 +9159,7 @@ function PaywalloProvider({ children, config }) {
9159
9159
  ];
9160
9160
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PaywalloContext.Provider, { value: contextValue, children: [
9161
9161
  children,
9162
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PaywallErrorBoundary, { children: !!preloadedWebView?.craftData && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native22.Animated.View, { style: preloadStyle, pointerEvents: showingPreloadedWebView ? "auto" : "none", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
9162
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PaywallErrorBoundary, { children: !!preloadedWebView?.craftData && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native24.Animated.View, { style: preloadStyle, pointerEvents: showingPreloadedWebView ? "auto" : "none", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
9163
9163
  PaywallWebView,
9164
9164
  {
9165
9165
  paywallId: preloadedWebView.paywallId,
@@ -9190,7 +9190,7 @@ function PaywalloProvider({ children, config }) {
9190
9190
  ) })
9191
9191
  ] });
9192
9192
  }
9193
- var styles3 = import_react_native22.StyleSheet.create({
9193
+ var styles3 = import_react_native24.StyleSheet.create({
9194
9194
  preloadOverlay: { position: "absolute", top: 0, left: 0, right: 0, bottom: 0, backgroundColor: "#ffffff" },
9195
9195
  hidden: { zIndex: -1, opacity: 0, width: 1, height: 1, overflow: "hidden" },
9196
9196
  visible: { zIndex: 9999, opacity: 1 }