@opexa/portal-sdk 0.53.4 → 0.53.6

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.cjs CHANGED
@@ -5528,6 +5528,37 @@ function addHours(date, hours) {
5528
5528
  return result;
5529
5529
  }
5530
5530
 
5531
+ // src/sdk/utils.ts
5532
+ function getLocaleByCurrency(currency) {
5533
+ if (currency === "INR") return "en-IN";
5534
+ if (currency === "MYR") return "en-MY";
5535
+ if (currency === "IDR") return "en-ID";
5536
+ if (currency === "USD") return "en-US";
5537
+ return "en-PH";
5538
+ }
5539
+ function getAreaCodeByLocale(locale) {
5540
+ if (locale === "en-IN") return "+91";
5541
+ if (locale === "en-MY") return "+60";
5542
+ if (locale === "en-ID") return "+62";
5543
+ if (locale === "en-US") return "+1";
5544
+ return "+63";
5545
+ }
5546
+ function addAreaCode(mobileNumber, locale) {
5547
+ const areaCode = getAreaCodeByLocale(locale);
5548
+ if (mobileNumber.startsWith(areaCode)) return mobileNumber;
5549
+ if (mobileNumber.startsWith(areaCode.substring(1))) return `+${mobileNumber}`;
5550
+ if (mobileNumber.startsWith("0"))
5551
+ return `${areaCode}${mobileNumber.substring(1)}`;
5552
+ return `${areaCode}${mobileNumber}`;
5553
+ }
5554
+ function parseFbCxd(input) {
5555
+ const fbMatch = input.match(/(\d+_\d+).*fb\./);
5556
+ if (!fbMatch) return null;
5557
+ const cxd = fbMatch[1];
5558
+ const fbAdditionalCxd = input.split(cxd)[1].slice(1);
5559
+ return { cxd, fbAdditionalCxd };
5560
+ }
5561
+
5531
5562
  // src/sdk/cellexpert-manager.ts
5532
5563
  var CXD_STORAGE_KEY = "sdk/cxd";
5533
5564
  var CellexpertManager = class {
@@ -5550,7 +5581,7 @@ var CellexpertManager = class {
5550
5581
  }
5551
5582
  const n = /* @__PURE__ */ new Date();
5552
5583
  const o = JSON.stringify({
5553
- value,
5584
+ value: parseFbCxd(value)?.cxd ?? value,
5554
5585
  expiresAt: subMinutes(addHours(n, 6), 2).getTime()
5555
5586
  });
5556
5587
  localStorage.setItem(CXD_STORAGE_KEY, o);
@@ -6416,30 +6447,6 @@ function parseDecimal(value, fallback) {
6416
6447
  return fallback;
6417
6448
  }
6418
6449
 
6419
- // src/sdk/utils.ts
6420
- function getLocaleByCurrency(currency) {
6421
- if (currency === "INR") return "en-IN";
6422
- if (currency === "MYR") return "en-MY";
6423
- if (currency === "IDR") return "en-ID";
6424
- if (currency === "USD") return "en-US";
6425
- return "en-PH";
6426
- }
6427
- function getAreaCodeByLocale(locale) {
6428
- if (locale === "en-IN") return "+91";
6429
- if (locale === "en-MY") return "+60";
6430
- if (locale === "en-ID") return "+62";
6431
- if (locale === "en-US") return "+1";
6432
- return "+63";
6433
- }
6434
- function addAreaCode(mobileNumber, locale) {
6435
- const areaCode = getAreaCodeByLocale(locale);
6436
- if (mobileNumber.startsWith(areaCode)) return mobileNumber;
6437
- if (mobileNumber.startsWith(areaCode.substring(1))) return `+${mobileNumber}`;
6438
- if (mobileNumber.startsWith("0"))
6439
- return `${areaCode}${mobileNumber.substring(1)}`;
6440
- return `${areaCode}${mobileNumber}`;
6441
- }
6442
-
6443
6450
  // src/sdk/transformer.ts
6444
6451
  var IMAGE_CACHE_ID = "3".padStart(8, "0");
6445
6452
  var Transformer = class {