@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.d.mts CHANGED
@@ -166,6 +166,7 @@ interface PaywallConfig {
166
166
  content?: string | Record<string, unknown>;
167
167
  primaryProductId?: string;
168
168
  secondaryProductId?: string;
169
+ tertiaryProductId?: string;
169
170
  }
170
171
  interface PaywallBlockConfig {
171
172
  type: string;
@@ -1601,6 +1602,7 @@ interface PaywallContextValue {
1601
1602
  selectedProductId: string | null;
1602
1603
  primaryProductId: string | null;
1603
1604
  secondaryProductId: string | null;
1605
+ tertiaryProductId: string | null;
1604
1606
  currentNavigationIndex: number;
1605
1607
  currentTabIndex: number;
1606
1608
  trialEnabled: boolean;
@@ -1649,6 +1651,7 @@ interface PaywallModalProps {
1649
1651
  config: Record<string, unknown>;
1650
1652
  primaryProductId?: string;
1651
1653
  secondaryProductId?: string;
1654
+ tertiaryProductId?: string;
1652
1655
  };
1653
1656
  preloadedProducts?: Map<string, Product>;
1654
1657
  variantKey?: string;
@@ -1859,6 +1862,7 @@ interface VariableContext {
1859
1862
  selectedProductId?: string;
1860
1863
  primaryProductId?: string;
1861
1864
  secondaryProductId?: string;
1865
+ tertiaryProductId?: string;
1862
1866
  products: Map<string, Product>;
1863
1867
  customVariables?: Record<string, string>;
1864
1868
  deviceInfo?: {
package/dist/index.d.ts CHANGED
@@ -166,6 +166,7 @@ interface PaywallConfig {
166
166
  content?: string | Record<string, unknown>;
167
167
  primaryProductId?: string;
168
168
  secondaryProductId?: string;
169
+ tertiaryProductId?: string;
169
170
  }
170
171
  interface PaywallBlockConfig {
171
172
  type: string;
@@ -1601,6 +1602,7 @@ interface PaywallContextValue {
1601
1602
  selectedProductId: string | null;
1602
1603
  primaryProductId: string | null;
1603
1604
  secondaryProductId: string | null;
1605
+ tertiaryProductId: string | null;
1604
1606
  currentNavigationIndex: number;
1605
1607
  currentTabIndex: number;
1606
1608
  trialEnabled: boolean;
@@ -1649,6 +1651,7 @@ interface PaywallModalProps {
1649
1651
  config: Record<string, unknown>;
1650
1652
  primaryProductId?: string;
1651
1653
  secondaryProductId?: string;
1654
+ tertiaryProductId?: string;
1652
1655
  };
1653
1656
  preloadedProducts?: Map<string, Product>;
1654
1657
  variantKey?: string;
@@ -1859,6 +1862,7 @@ interface VariableContext {
1859
1862
  selectedProductId?: string;
1860
1863
  primaryProductId?: string;
1861
1864
  secondaryProductId?: string;
1865
+ tertiaryProductId?: string;
1862
1866
  products: Map<string, Product>;
1863
1867
  customVariables?: Record<string, string>;
1864
1868
  deviceInfo?: {
package/dist/index.js CHANGED
@@ -2386,8 +2386,8 @@ var init_NotificationHandlerSetup = __esm({
2386
2386
  // src/core/version.ts
2387
2387
  function resolveVersion() {
2388
2388
  try {
2389
- if ("2.2.7") {
2390
- return "2.2.7";
2389
+ if ("2.3.0") {
2390
+ return "2.3.0";
2391
2391
  }
2392
2392
  } catch {
2393
2393
  }
@@ -3403,6 +3403,7 @@ function buildPaywallInjectionScript(data) {
3403
3403
  products: data.products,
3404
3404
  primaryProductId: data.primaryProductId,
3405
3405
  secondaryProductId: data.secondaryProductId,
3406
+ tertiaryProductId: data.tertiaryProductId,
3406
3407
  currentLanguage: getCurrentLanguage(),
3407
3408
  defaultLanguage: getDefaultLanguage()
3408
3409
  }
@@ -3487,6 +3488,7 @@ function PaywallWebView({
3487
3488
  products,
3488
3489
  primaryProductId,
3489
3490
  secondaryProductId,
3491
+ tertiaryProductId,
3490
3492
  isPurchasing,
3491
3493
  webUrl: webUrlProp,
3492
3494
  onPurchase,
@@ -3558,10 +3560,11 @@ function PaywallWebView({
3558
3560
  craftData,
3559
3561
  products: Array.from(products.values()),
3560
3562
  primaryProductId,
3561
- secondaryProductId
3563
+ secondaryProductId,
3564
+ tertiaryProductId
3562
3565
  });
3563
3566
  injectScript(script);
3564
- }, [craftData, products, primaryProductId, secondaryProductId, injectScript]);
3567
+ }, [craftData, products, primaryProductId, secondaryProductId, tertiaryProductId, injectScript]);
3565
3568
  const processedIdsRef = (0, import_react4.useRef)(/* @__PURE__ */ new Set());
3566
3569
  const dedupeTimersRef = (0, import_react4.useRef)(/* @__PURE__ */ new Map());
3567
3570
  (0, import_react4.useEffect)(() => {
@@ -5507,7 +5510,8 @@ function usePaywallLoader(placement, visible, preloadedConfig, preloadedProducts
5507
5510
  placement: snap.placement,
5508
5511
  config: snap.config,
5509
5512
  primaryProductId: snap.primaryProductId,
5510
- secondaryProductId: snap.secondaryProductId
5513
+ secondaryProductId: snap.secondaryProductId,
5514
+ tertiaryProductId: snap.tertiaryProductId
5511
5515
  };
5512
5516
  } else {
5513
5517
  const fetched = await apiClient.getPaywall(placement);
@@ -5519,6 +5523,7 @@ function usePaywallLoader(placement, visible, preloadedConfig, preloadedProducts
5519
5523
  const productIds = [];
5520
5524
  if (config.primaryProductId) productIds.push(config.primaryProductId);
5521
5525
  if (config.secondaryProductId) productIds.push(config.secondaryProductId);
5526
+ if (config.tertiaryProductId) productIds.push(config.tertiaryProductId);
5522
5527
  const snapProducts = preloadedProductsRef.current;
5523
5528
  if (snapProducts && snapProducts.size > 0) {
5524
5529
  if (!cancelled) setProducts(snapProducts);
@@ -5702,6 +5707,7 @@ function PaywallModal({
5702
5707
  products,
5703
5708
  primaryProductId: paywallConfig.primaryProductId,
5704
5709
  secondaryProductId: paywallConfig.secondaryProductId,
5710
+ tertiaryProductId: paywallConfig.tertiaryProductId,
5705
5711
  isPurchasing,
5706
5712
  onReady: handleWebViewReady,
5707
5713
  onClose: handleClose,
@@ -5883,6 +5889,7 @@ var init_PaywallPreloadService = __esm({
5883
5889
  const productIds = [];
5884
5890
  if (config.primaryProductId) productIds.push(config.primaryProductId);
5885
5891
  if (config.secondaryProductId) productIds.push(config.secondaryProductId);
5892
+ if (config.tertiaryProductId) productIds.push(config.tertiaryProductId);
5886
5893
  if (productIds.length === 0) return /* @__PURE__ */ new Map();
5887
5894
  try {
5888
5895
  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 },
@@ -10553,7 +10563,8 @@ function PaywalloProvider({ children, config }) {
10553
10563
  placement: preloaded.config.placement,
10554
10564
  config: preloaded.config.config,
10555
10565
  primaryProductId: preloaded.config.primaryProductId,
10556
- secondaryProductId: preloaded.config.secondaryProductId
10566
+ secondaryProductId: preloaded.config.secondaryProductId,
10567
+ tertiaryProductId: preloaded.config.tertiaryProductId
10557
10568
  },
10558
10569
  preloadedProducts: preloaded.products
10559
10570
  }
@@ -10855,6 +10866,9 @@ function resolveProductsVariable(parts, context) {
10855
10866
  if (parts[1] === "secondary" && context.secondaryProductId) {
10856
10867
  return getProductVariable(context.products.get(context.secondaryProductId), parts[2]);
10857
10868
  }
10869
+ if (parts[1] === "tertiary" && context.tertiaryProductId) {
10870
+ return getProductVariable(context.products.get(context.tertiaryProductId), parts[2]);
10871
+ }
10858
10872
  if (parts[1] === "hasIntroductoryOffer") {
10859
10873
  return Array.from(context.products.values()).some((p) => p.introductoryPrice) ? "true" : "false";
10860
10874
  }