@final-commerce/common 2.11.1-online.8 → 2.11.1-online.9
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 +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +1 -0
- package/dist/pos-types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1805,6 +1805,31 @@ function lineStockMoves(item, quantity, reservations = []) {
|
|
|
1805
1805
|
});
|
|
1806
1806
|
}
|
|
1807
1807
|
|
|
1808
|
+
// utils/contact-keys.util.ts
|
|
1809
|
+
function emailKey(email) {
|
|
1810
|
+
const key = email?.trim().toLowerCase();
|
|
1811
|
+
return key && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(key) ? key : null;
|
|
1812
|
+
}
|
|
1813
|
+
function phoneKey(phone) {
|
|
1814
|
+
const raw = phone?.trim();
|
|
1815
|
+
if (!raw) return null;
|
|
1816
|
+
const digits = raw.replace(/\D/g, "");
|
|
1817
|
+
if (raw.startsWith("+")) return digits.length >= 8 && digits.length <= 15 ? `+${digits}` : null;
|
|
1818
|
+
if (digits.length === 10) return `+1${digits}`;
|
|
1819
|
+
if (digits.length === 11 && digits.startsWith("1")) return `+${digits}`;
|
|
1820
|
+
return null;
|
|
1821
|
+
}
|
|
1822
|
+
var CUSTOMER_CONTACT_VERIFIED = "CUSTOMER_CONTACT_VERIFIED";
|
|
1823
|
+
function sameContact(a, b, key) {
|
|
1824
|
+
return (key(a) ?? a?.trim().toLowerCase() ?? "") === (key(b) ?? b?.trim().toLowerCase() ?? "");
|
|
1825
|
+
}
|
|
1826
|
+
function verifiedContactChange(existing, change) {
|
|
1827
|
+
if (!existing.verifiedShopperAt) return null;
|
|
1828
|
+
if (change.email !== void 0 && !sameContact(existing.email, change.email, emailKey)) return "email";
|
|
1829
|
+
if (change.phone !== void 0 && !sameContact(existing.phone, change.phone, phoneKey)) return "phone";
|
|
1830
|
+
return null;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1808
1833
|
// units/family-code.ts
|
|
1809
1834
|
var MAX_SLUG_LENGTH = 32;
|
|
1810
1835
|
var FALLBACK_SLUG = "family";
|
|
@@ -4440,6 +4465,7 @@ export {
|
|
|
4440
4465
|
CONDITION_OPERATORS,
|
|
4441
4466
|
COUNTRY_CURRENCIES,
|
|
4442
4467
|
CURRENCY_CONFIG,
|
|
4468
|
+
CUSTOMER_CONTACT_VERIFIED,
|
|
4443
4469
|
CompanyType,
|
|
4444
4470
|
CurrencyCode,
|
|
4445
4471
|
CustomTableAvailability,
|
|
@@ -4581,6 +4607,7 @@ export {
|
|
|
4581
4607
|
deriveUnitId,
|
|
4582
4608
|
displayRuleMatchesPair,
|
|
4583
4609
|
divideAmount,
|
|
4610
|
+
emailKey,
|
|
4584
4611
|
evaluateCondition,
|
|
4585
4612
|
evaluateConditionSet,
|
|
4586
4613
|
extendPrice,
|
|
@@ -4644,6 +4671,7 @@ export {
|
|
|
4644
4671
|
parseAmountToMinorUnits,
|
|
4645
4672
|
parseCurrencyCode,
|
|
4646
4673
|
parseStripeCurrencyCode,
|
|
4674
|
+
phoneKey,
|
|
4647
4675
|
placeKey,
|
|
4648
4676
|
planWindow,
|
|
4649
4677
|
poolDemand,
|
|
@@ -4680,6 +4708,7 @@ export {
|
|
|
4680
4708
|
validateFragmentCompatibility,
|
|
4681
4709
|
validateOrderStatuses,
|
|
4682
4710
|
validateShippingZone,
|
|
4711
|
+
verifiedContactChange,
|
|
4683
4712
|
violatesFinancialInvariant,
|
|
4684
4713
|
windowEndsAt,
|
|
4685
4714
|
withinPresence
|