@final-commerce/common 2.11.1-online.1 → 2.11.1-online.3

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
@@ -4210,6 +4210,54 @@ function registrationPlacesByKind(rates) {
4210
4210
  return places;
4211
4211
  }
4212
4212
 
4213
+ // tax/exceptions.ts
4214
+ var TaxExceptionSource = /* @__PURE__ */ ((TaxExceptionSource2) => {
4215
+ TaxExceptionSource2["PRODUCT"] = "product";
4216
+ TaxExceptionSource2["CATEGORY"] = "category";
4217
+ return TaxExceptionSource2;
4218
+ })(TaxExceptionSource || {});
4219
+ var TAX_EXCEPTION_REASON_MAX = 200;
4220
+
4221
+ // shopper/types.ts
4222
+ var SHOPPER_CONSENT_SOURCES = ["checkout", "my-account", "store-account"];
4223
+ var SHOPPER_RETURN_METHODS = ["mail", "in-store"];
4224
+ var SHOPPER_ERROR_CODES = {
4225
+ ORDER_NOT_FOUND: "ORDER_NOT_FOUND",
4226
+ RETURN_ALREADY_REQUESTED: "RETURN_ALREADY_REQUESTED",
4227
+ RETURN_NOT_ALLOWED: "RETURN_NOT_ALLOWED",
4228
+ STORE_HAS_NO_SUPPORT_EMAIL: "STORE_HAS_NO_SUPPORT_EMAIL",
4229
+ TOO_MANY_ADDRESSES: "TOO_MANY_ADDRESSES",
4230
+ STORE_NOT_LINKED: "STORE_NOT_LINKED",
4231
+ STORED_METHOD_NOT_FOUND: "STORED_METHOD_NOT_FOUND"
4232
+ };
4233
+
4234
+ // shopper/email.ts
4235
+ function normalizeShopperEmail(email) {
4236
+ if (typeof email !== "string") return null;
4237
+ const value = email.trim().toLowerCase();
4238
+ return /^[^\s@]+@[^\s@]+$/.test(value) ? value : null;
4239
+ }
4240
+
4241
+ // shopper/card.ts
4242
+ function cardFromProcessorData(processorData) {
4243
+ if (typeof processorData !== "string" || !processorData) return {};
4244
+ let data;
4245
+ try {
4246
+ data = JSON.parse(processorData);
4247
+ } catch {
4248
+ return {};
4249
+ }
4250
+ if (!data || typeof data !== "object") return {};
4251
+ const fields = new Map(Object.entries(data));
4252
+ const text = (...keys) => keys.map((key) => fields.get(key)).find((value) => typeof value === "string" && !!value.trim());
4253
+ const brand = text("Brand", "brand")?.trim();
4254
+ const digits = text("Card Number", "card", "card_number")?.replace(/\D/g, "");
4255
+ return {
4256
+ ...brand ? { cardBrand: brand.charAt(0).toUpperCase() + brand.slice(1) } : {},
4257
+ ...digits && digits.length >= 4 ? { cardLastFour: digits.slice(-4) } : {}
4258
+ };
4259
+ }
4260
+
4213
4261
  // constants/adyen.constants.ts
4214
4262
  var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
4215
4263
  function isAdyenRolloutCountry(alpha2) {
@@ -4391,6 +4439,9 @@ export {
4391
4439
  ResidualStatus,
4392
4440
  ResourceAvailabilityState,
4393
4441
  SHIPPING_COUNTRIES,
4442
+ SHOPPER_CONSENT_SOURCES,
4443
+ SHOPPER_ERROR_CODES,
4444
+ SHOPPER_RETURN_METHODS,
4394
4445
  STANDARD_TAX_TYPE,
4395
4446
  STATE_SCHEMA,
4396
4447
  STRIPE_SUPPORTED_COUNTRIES,
@@ -4409,6 +4460,8 @@ export {
4409
4460
  StationStatus,
4410
4461
  StripeCurrencyCode,
4411
4462
  StripeStatus,
4463
+ TAX_EXCEPTION_REASON_MAX,
4464
+ TaxExceptionSource,
4412
4465
  TaxRegistrationKind,
4413
4466
  TaxSource,
4414
4467
  TaxWarningCode,
@@ -4440,6 +4493,7 @@ export {
4440
4493
  buildResolvedConfig,
4441
4494
  calculatePercentage,
4442
4495
  canTransition,
4496
+ cardFromProcessorData,
4443
4497
  cheapestCompositeItem,
4444
4498
  cheapestCompositePrice,
4445
4499
  compositeItemCost,
@@ -4514,6 +4568,7 @@ export {
4514
4568
  normalizeMongoIdString,
4515
4569
  normalizePostCode,
4516
4570
  normalizeProvince,
4571
+ normalizeShopperEmail,
4517
4572
  occupancyIn,
4518
4573
  orderAssignments,
4519
4574
  parseAmountToMinorUnits,