@final-commerce/common 2.11.1-online.1 → 2.11.1-online.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 +132 -1
- package/dist/index.d.ts +132 -1
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -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
|
@@ -4210,6 +4210,46 @@ function registrationPlacesByKind(rates) {
|
|
|
4210
4210
|
return places;
|
|
4211
4211
|
}
|
|
4212
4212
|
|
|
4213
|
+
// shopper/types.ts
|
|
4214
|
+
var SHOPPER_CONSENT_SOURCES = ["checkout", "my-account", "store-account"];
|
|
4215
|
+
var SHOPPER_RETURN_METHODS = ["mail", "in-store"];
|
|
4216
|
+
var SHOPPER_ERROR_CODES = {
|
|
4217
|
+
ORDER_NOT_FOUND: "ORDER_NOT_FOUND",
|
|
4218
|
+
RETURN_ALREADY_REQUESTED: "RETURN_ALREADY_REQUESTED",
|
|
4219
|
+
RETURN_NOT_ALLOWED: "RETURN_NOT_ALLOWED",
|
|
4220
|
+
STORE_HAS_NO_SUPPORT_EMAIL: "STORE_HAS_NO_SUPPORT_EMAIL",
|
|
4221
|
+
TOO_MANY_ADDRESSES: "TOO_MANY_ADDRESSES",
|
|
4222
|
+
STORE_NOT_LINKED: "STORE_NOT_LINKED",
|
|
4223
|
+
STORED_METHOD_NOT_FOUND: "STORED_METHOD_NOT_FOUND"
|
|
4224
|
+
};
|
|
4225
|
+
|
|
4226
|
+
// shopper/email.ts
|
|
4227
|
+
function normalizeShopperEmail(email) {
|
|
4228
|
+
if (typeof email !== "string") return null;
|
|
4229
|
+
const value = email.trim().toLowerCase();
|
|
4230
|
+
return /^[^\s@]+@[^\s@]+$/.test(value) ? value : null;
|
|
4231
|
+
}
|
|
4232
|
+
|
|
4233
|
+
// shopper/card.ts
|
|
4234
|
+
function cardFromProcessorData(processorData) {
|
|
4235
|
+
if (typeof processorData !== "string" || !processorData) return {};
|
|
4236
|
+
let data;
|
|
4237
|
+
try {
|
|
4238
|
+
data = JSON.parse(processorData);
|
|
4239
|
+
} catch {
|
|
4240
|
+
return {};
|
|
4241
|
+
}
|
|
4242
|
+
if (!data || typeof data !== "object") return {};
|
|
4243
|
+
const fields = new Map(Object.entries(data));
|
|
4244
|
+
const text = (...keys) => keys.map((key) => fields.get(key)).find((value) => typeof value === "string" && !!value.trim());
|
|
4245
|
+
const brand = text("Brand", "brand")?.trim();
|
|
4246
|
+
const digits = text("Card Number", "card", "card_number")?.replace(/\D/g, "");
|
|
4247
|
+
return {
|
|
4248
|
+
...brand ? { cardBrand: brand.charAt(0).toUpperCase() + brand.slice(1) } : {},
|
|
4249
|
+
...digits && digits.length >= 4 ? { cardLastFour: digits.slice(-4) } : {}
|
|
4250
|
+
};
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4213
4253
|
// constants/adyen.constants.ts
|
|
4214
4254
|
var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
|
|
4215
4255
|
function isAdyenRolloutCountry(alpha2) {
|
|
@@ -4391,6 +4431,9 @@ export {
|
|
|
4391
4431
|
ResidualStatus,
|
|
4392
4432
|
ResourceAvailabilityState,
|
|
4393
4433
|
SHIPPING_COUNTRIES,
|
|
4434
|
+
SHOPPER_CONSENT_SOURCES,
|
|
4435
|
+
SHOPPER_ERROR_CODES,
|
|
4436
|
+
SHOPPER_RETURN_METHODS,
|
|
4394
4437
|
STANDARD_TAX_TYPE,
|
|
4395
4438
|
STATE_SCHEMA,
|
|
4396
4439
|
STRIPE_SUPPORTED_COUNTRIES,
|
|
@@ -4440,6 +4483,7 @@ export {
|
|
|
4440
4483
|
buildResolvedConfig,
|
|
4441
4484
|
calculatePercentage,
|
|
4442
4485
|
canTransition,
|
|
4486
|
+
cardFromProcessorData,
|
|
4443
4487
|
cheapestCompositeItem,
|
|
4444
4488
|
cheapestCompositePrice,
|
|
4445
4489
|
compositeItemCost,
|
|
@@ -4514,6 +4558,7 @@ export {
|
|
|
4514
4558
|
normalizeMongoIdString,
|
|
4515
4559
|
normalizePostCode,
|
|
4516
4560
|
normalizeProvince,
|
|
4561
|
+
normalizeShopperEmail,
|
|
4517
4562
|
occupancyIn,
|
|
4518
4563
|
orderAssignments,
|
|
4519
4564
|
parseAmountToMinorUnits,
|