@final-commerce/common 2.5.1-staging2.1 → 2.5.1

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
@@ -3003,9 +3003,7 @@ function buildGrid(rule, timeZone, from, to, now, busy = []) {
3003
3003
  const start = startAt.getTime();
3004
3004
  if (start < askedFrom || start >= askedTo) return false;
3005
3005
  if (start < notBefore || start > notAfter) return false;
3006
- return !blocked.some(
3007
- ({ from: blockFrom, to: blockTo }) => start < blockTo && bufferEndAt.getTime() > blockFrom
3008
- );
3006
+ return !blocked.some(({ from: blockFrom, to: blockTo }) => start < blockTo && bufferEndAt.getTime() > blockFrom);
3009
3007
  }).sort((first, second) => +first.startAt - +second.startAt);
3010
3008
  }
3011
3009
  function slotsForWindow(grid, startAt, endAt) {
@@ -3124,14 +3122,7 @@ function buildAvailability({
3124
3122
  for (const slot of slots2) {
3125
3123
  const { taken, foreignProductId } = occupancyIn(mine, productId, slot.startAt, slot.bufferEndAt, shared);
3126
3124
  const free = foreignProductId ? 0 : Math.max(capacity - taken, 0);
3127
- const entry = byInstant.get(+slot.startAt) ?? {
3128
- ...slot,
3129
- capacity: 0,
3130
- booked: 0,
3131
- free: 0,
3132
- resources: [],
3133
- dayKey: shopDayKey(slot.startAt, resource.timeZone)
3134
- };
3125
+ const entry = byInstant.get(+slot.startAt) ?? { ...slot, capacity: 0, booked: 0, free: 0, resources: [], dayKey: shopDayKey(slot.startAt, resource.timeZone) };
3135
3126
  entry.capacity += capacity;
3136
3127
  entry.booked += foreignProductId ? capacity : taken;
3137
3128
  entry.free += free;
@@ -3209,38 +3200,33 @@ var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
3209
3200
  function isAdyenRolloutCountry(alpha2) {
3210
3201
  return ADYEN_ROLLOUT_COUNTRY_CODES.has(alpha2);
3211
3202
  }
3212
- var ADYEN_STORE_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
3213
- function adyenStoreRequiresStateOrProvince(alpha2) {
3214
- return !!alpha2 && ADYEN_STORE_STATE_PROVINCE_COUNTRIES.has(alpha2);
3215
- }
3216
- var ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
3217
- function adyenLegalEntityRequiresStateOrProvince(alpha2) {
3218
- return !!alpha2 && ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES.has(alpha2);
3203
+ var AFFIRM_PRICE_PLANS = ["core", "standard", "signature"];
3204
+ function isAffirmPricePlan(value) {
3205
+ return typeof value === "string" && AFFIRM_PRICE_PLANS.includes(value);
3219
3206
  }
3220
- var ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES = /* @__PURE__ */ new Set(["CA"]);
3221
- function adyenSupportsTaxNumberAbsent(alpha2) {
3222
- return !!alpha2 && !ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES.has(alpha2);
3207
+ var AFFIRM_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
3208
+ function isAffirmCountry(alpha2) {
3209
+ return !!alpha2 && AFFIRM_COUNTRY_CODES.has(alpha2.toUpperCase());
3223
3210
  }
3224
- var ADYEN_TAX_NUMBER_FORMATS = {
3225
- CA: { pattern: /^\d{9}$/, length: 9 }
3211
+ var BNPL_METHOD_STATUS = {
3212
+ ACTIVE: "active",
3213
+ PENDING: "pending",
3214
+ UNAVAILABLE: "unavailable",
3215
+ UNKNOWN: "unknown"
3216
+ };
3217
+ var BNPL_SKIP_REASON = {
3218
+ PENDING: "pending",
3219
+ NO_SUPPORT_EMAIL: "no_support_email",
3220
+ NO_CURRENCY: "no_currency",
3221
+ NO_BUSINESS_LINE: "no_business_line"
3226
3222
  };
3227
- function adyenTaxNumberFormat(alpha2) {
3228
- return alpha2 ? ADYEN_TAX_NUMBER_FORMATS[alpha2] : void 0;
3229
- }
3230
- var ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
3231
- var ADYEN_JOB_TITLE_ASSOCIATION_TYPES = ["signatory", "uboThroughControl"];
3232
- function adyenRequiresJobTitle(associationType) {
3233
- return ADYEN_JOB_TITLE_ASSOCIATION_TYPES.includes(associationType);
3234
- }
3235
3223
  export {
3236
- ADYEN_JOB_TITLE_ASSOCIATION_TYPES,
3237
- ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES,
3238
- ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES,
3239
3224
  ADYEN_ROLLOUT_COUNTRY_CODES,
3240
- ADYEN_STORE_STATE_PROVINCE_COUNTRIES,
3241
- ADYEN_TAX_NUMBER_FORMATS,
3242
- ADYEN_TAX_NUMBER_MIN_LENGTH,
3225
+ AFFIRM_COUNTRY_CODES,
3226
+ AFFIRM_PRICE_PLANS,
3243
3227
  AttributeType,
3228
+ BNPL_METHOD_STATUS,
3229
+ BNPL_SKIP_REASON,
3244
3230
  BookingRatePeriod,
3245
3231
  BookingResourceKind,
3246
3232
  BookingResourceStatus,
@@ -3317,11 +3303,6 @@ export {
3317
3303
  TopMetericsSort,
3318
3304
  UserTypes,
3319
3305
  addAmounts,
3320
- adyenLegalEntityRequiresStateOrProvince,
3321
- adyenRequiresJobTitle,
3322
- adyenStoreRequiresStateOrProvince,
3323
- adyenSupportsTaxNumberAbsent,
3324
- adyenTaxNumberFormat,
3325
3306
  amountToString,
3326
3307
  assertUnitSane,
3327
3308
  availableIn,
@@ -3373,6 +3354,8 @@ export {
3373
3354
  holdExpiresAt,
3374
3355
  inferStatesFromLegacyStatus,
3375
3356
  isAdyenRolloutCountry,
3357
+ isAffirmCountry,
3358
+ isAffirmPricePlan,
3376
3359
  isConditionOperator,
3377
3360
  isFulfillmentState,
3378
3361
  isPaymentState,