@virex-tech/paywallo-sdk 2.2.7 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2370,8 +2370,8 @@ var init_NotificationHandlerSetup = __esm({
2370
2370
  // src/core/version.ts
2371
2371
  function resolveVersion() {
2372
2372
  try {
2373
- if ("2.2.7") {
2374
- return "2.2.7";
2373
+ if ("2.3.0") {
2374
+ return "2.3.0";
2375
2375
  }
2376
2376
  } catch {
2377
2377
  }
@@ -3387,6 +3387,7 @@ function buildPaywallInjectionScript(data) {
3387
3387
  products: data.products,
3388
3388
  primaryProductId: data.primaryProductId,
3389
3389
  secondaryProductId: data.secondaryProductId,
3390
+ tertiaryProductId: data.tertiaryProductId,
3390
3391
  currentLanguage: getCurrentLanguage(),
3391
3392
  defaultLanguage: getDefaultLanguage()
3392
3393
  }
@@ -3485,6 +3486,7 @@ function PaywallWebView({
3485
3486
  products,
3486
3487
  primaryProductId,
3487
3488
  secondaryProductId,
3489
+ tertiaryProductId,
3488
3490
  isPurchasing,
3489
3491
  webUrl: webUrlProp,
3490
3492
  onPurchase,
@@ -3556,10 +3558,11 @@ function PaywallWebView({
3556
3558
  craftData,
3557
3559
  products: Array.from(products.values()),
3558
3560
  primaryProductId,
3559
- secondaryProductId
3561
+ secondaryProductId,
3562
+ tertiaryProductId
3560
3563
  });
3561
3564
  injectScript(script);
3562
- }, [craftData, products, primaryProductId, secondaryProductId, injectScript]);
3565
+ }, [craftData, products, primaryProductId, secondaryProductId, tertiaryProductId, injectScript]);
3563
3566
  const processedIdsRef = useRef2(/* @__PURE__ */ new Set());
3564
3567
  const dedupeTimersRef = useRef2(/* @__PURE__ */ new Map());
3565
3568
  useEffect2(() => {
@@ -5502,7 +5505,8 @@ function usePaywallLoader(placement, visible, preloadedConfig, preloadedProducts
5502
5505
  placement: snap.placement,
5503
5506
  config: snap.config,
5504
5507
  primaryProductId: snap.primaryProductId,
5505
- secondaryProductId: snap.secondaryProductId
5508
+ secondaryProductId: snap.secondaryProductId,
5509
+ tertiaryProductId: snap.tertiaryProductId
5506
5510
  };
5507
5511
  } else {
5508
5512
  const fetched = await apiClient.getPaywall(placement);
@@ -5514,6 +5518,7 @@ function usePaywallLoader(placement, visible, preloadedConfig, preloadedProducts
5514
5518
  const productIds = [];
5515
5519
  if (config.primaryProductId) productIds.push(config.primaryProductId);
5516
5520
  if (config.secondaryProductId) productIds.push(config.secondaryProductId);
5521
+ if (config.tertiaryProductId) productIds.push(config.tertiaryProductId);
5517
5522
  const snapProducts = preloadedProductsRef.current;
5518
5523
  if (snapProducts && snapProducts.size > 0) {
5519
5524
  if (!cancelled) setProducts(snapProducts);
@@ -5707,6 +5712,7 @@ function PaywallModal({
5707
5712
  products,
5708
5713
  primaryProductId: paywallConfig.primaryProductId,
5709
5714
  secondaryProductId: paywallConfig.secondaryProductId,
5715
+ tertiaryProductId: paywallConfig.tertiaryProductId,
5710
5716
  isPurchasing,
5711
5717
  onReady: handleWebViewReady,
5712
5718
  onClose: handleClose,
@@ -5885,6 +5891,7 @@ var init_PaywallPreloadService = __esm({
5885
5891
  const productIds = [];
5886
5892
  if (config.primaryProductId) productIds.push(config.primaryProductId);
5887
5893
  if (config.secondaryProductId) productIds.push(config.secondaryProductId);
5894
+ if (config.tertiaryProductId) productIds.push(config.tertiaryProductId);
5888
5895
  if (productIds.length === 0) return /* @__PURE__ */ new Map();
5889
5896
  try {
5890
5897
  const loaded = await getIAPService().loadProducts(productIds);
@@ -8102,6 +8109,8 @@ var init_ApiClient = __esm({
8102
8109
  }
8103
8110
  }
8104
8111
  const attribution = Object.keys(rawAttribution).length > 0 ? rawAttribution : void 0;
8112
+ const rawUserId = properties?.["userId"];
8113
+ const externalUserId = typeof rawUserId === "string" && rawUserId.length > 0 ? rawUserId : void 0;
8105
8114
  await postWithQueue(
8106
8115
  {
8107
8116
  isOfflineQueueEnabled: () => this.offlineQueueEnabled,
@@ -8112,6 +8121,7 @@ var init_ApiClient = __esm({
8112
8121
  "/sdk/identity/identify",
8113
8122
  {
8114
8123
  distinct_id: distinctId,
8124
+ ...externalUserId && { external_user_id: externalUserId },
8115
8125
  traits,
8116
8126
  ...attribution && { attribution },
8117
8127
  ...deviceId && { deviceId },
@@ -10475,7 +10485,8 @@ function PaywalloProvider({ children, config }) {
10475
10485
  placement: preloaded.config.placement,
10476
10486
  config: preloaded.config.config,
10477
10487
  primaryProductId: preloaded.config.primaryProductId,
10478
- secondaryProductId: preloaded.config.secondaryProductId
10488
+ secondaryProductId: preloaded.config.secondaryProductId,
10489
+ tertiaryProductId: preloaded.config.tertiaryProductId
10479
10490
  },
10480
10491
  preloadedProducts: preloaded.products
10481
10492
  }
@@ -10777,6 +10788,9 @@ function resolveProductsVariable(parts, context) {
10777
10788
  if (parts[1] === "secondary" && context.secondaryProductId) {
10778
10789
  return getProductVariable(context.products.get(context.secondaryProductId), parts[2]);
10779
10790
  }
10791
+ if (parts[1] === "tertiary" && context.tertiaryProductId) {
10792
+ return getProductVariable(context.products.get(context.tertiaryProductId), parts[2]);
10793
+ }
10780
10794
  if (parts[1] === "hasIntroductoryOffer") {
10781
10795
  return Array.from(context.products.values()).some((p) => p.introductoryPrice) ? "true" : "false";
10782
10796
  }