@final-commerce/common 2.4.1-online.1 → 2.4.1-staging2.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.mjs CHANGED
@@ -200,7 +200,6 @@ var OrderPlatform = /* @__PURE__ */ ((OrderPlatform2) => {
200
200
  OrderPlatform2["POS"] = "in-store";
201
201
  OrderPlatform2["WOO_COMMERCE"] = "woo-commerce";
202
202
  OrderPlatform2["PUBLIC_API"] = "public-api";
203
- OrderPlatform2["ONLINE_STORE"] = "online-store";
204
203
  return OrderPlatform2;
205
204
  })(OrderPlatform || {});
206
205
  var CustomerPlatform = /* @__PURE__ */ ((CustomerPlatform2) => {
@@ -3003,7 +3002,9 @@ function buildGrid(rule, timeZone, from, to, now, busy = []) {
3003
3002
  const start = startAt.getTime();
3004
3003
  if (start < askedFrom || start >= askedTo) return false;
3005
3004
  if (start < notBefore || start > notAfter) return false;
3006
- return !blocked.some(({ from: blockFrom, to: blockTo }) => start < blockTo && bufferEndAt.getTime() > blockFrom);
3005
+ return !blocked.some(
3006
+ ({ from: blockFrom, to: blockTo }) => start < blockTo && bufferEndAt.getTime() > blockFrom
3007
+ );
3007
3008
  }).sort((first, second) => +first.startAt - +second.startAt);
3008
3009
  }
3009
3010
  function slotsForWindow(grid, startAt, endAt) {
@@ -3122,7 +3123,14 @@ function buildAvailability({
3122
3123
  for (const slot of slots2) {
3123
3124
  const { taken, foreignProductId } = occupancyIn(mine, productId, slot.startAt, slot.bufferEndAt, shared);
3124
3125
  const free = foreignProductId ? 0 : Math.max(capacity - taken, 0);
3125
- const entry = byInstant.get(+slot.startAt) ?? { ...slot, capacity: 0, booked: 0, free: 0, resources: [], dayKey: shopDayKey(slot.startAt, resource.timeZone) };
3126
+ const entry = byInstant.get(+slot.startAt) ?? {
3127
+ ...slot,
3128
+ capacity: 0,
3129
+ booked: 0,
3130
+ free: 0,
3131
+ resources: [],
3132
+ dayKey: shopDayKey(slot.startAt, resource.timeZone)
3133
+ };
3126
3134
  entry.capacity += capacity;
3127
3135
  entry.booked += foreignProductId ? capacity : taken;
3128
3136
  entry.free += free;
@@ -3200,30 +3208,37 @@ var ADYEN_ROLLOUT_COUNTRY_CODES = /* @__PURE__ */ new Set(["CA"]);
3200
3208
  function isAdyenRolloutCountry(alpha2) {
3201
3209
  return ADYEN_ROLLOUT_COUNTRY_CODES.has(alpha2);
3202
3210
  }
3203
- var AFFIRM_PRICE_PLANS = ["core", "standard", "signature"];
3204
- function isAffirmPricePlan(value) {
3205
- return typeof value === "string" && AFFIRM_PRICE_PLANS.includes(value);
3211
+ var ADYEN_STORE_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
3212
+ function adyenStoreRequiresStateOrProvince(alpha2) {
3213
+ return !!alpha2 && ADYEN_STORE_STATE_PROVINCE_COUNTRIES.has(alpha2);
3214
+ }
3215
+ var ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES = /* @__PURE__ */ new Set(["AU", "BR", "CA", "IN", "MX", "NZ", "US"]);
3216
+ function adyenLegalEntityRequiresStateOrProvince(alpha2) {
3217
+ return !!alpha2 && ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES.has(alpha2);
3218
+ }
3219
+ var ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES = /* @__PURE__ */ new Set(["CA"]);
3220
+ function adyenSupportsTaxNumberAbsent(alpha2) {
3221
+ return !!alpha2 && !ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES.has(alpha2);
3222
+ }
3223
+ var ADYEN_TAX_NUMBER_FORMATS = {
3224
+ CA: { pattern: /^\d{9}$/, length: 9 }
3225
+ };
3226
+ function adyenTaxNumberFormat(alpha2) {
3227
+ return alpha2 ? ADYEN_TAX_NUMBER_FORMATS[alpha2] : void 0;
3228
+ }
3229
+ var ADYEN_TAX_NUMBER_MIN_LENGTH = 5;
3230
+ var ADYEN_JOB_TITLE_ASSOCIATION_TYPES = ["signatory", "uboThroughControl"];
3231
+ function adyenRequiresJobTitle(associationType) {
3232
+ return ADYEN_JOB_TITLE_ASSOCIATION_TYPES.includes(associationType);
3206
3233
  }
3207
-
3208
- // pos-types/active/ProcessorType.ts
3209
- var ProcessorType = /* @__PURE__ */ ((ProcessorType2) => {
3210
- ProcessorType2["FINAL_PAY"] = "Terminal";
3211
- ProcessorType2["TAP_TO_PAY"] = "TapToPay";
3212
- ProcessorType2["MOTO"] = "Moto";
3213
- ProcessorType2["CLOUD"] = "Cloud";
3214
- ProcessorType2["BLUETOOTH"] = "Bluetooth";
3215
- ProcessorType2["CASH"] = "Cash";
3216
- ProcessorType2["CUSTOM_PAY"] = "CustomPay";
3217
- ProcessorType2["VENDARA"] = "Vendara";
3218
- ProcessorType2["REDEEM"] = "Redeem";
3219
- ProcessorType2["INTEGRATION"] = "Integration";
3220
- ProcessorType2["PAYMENT_LINK"] = "PaymentLink";
3221
- ProcessorType2["ONLINE_PAYMENT"] = "OnlinePayment";
3222
- return ProcessorType2;
3223
- })(ProcessorType || {});
3224
3234
  export {
3235
+ ADYEN_JOB_TITLE_ASSOCIATION_TYPES,
3236
+ ADYEN_LEGAL_ENTITY_STATE_PROVINCE_COUNTRIES,
3237
+ ADYEN_NO_TAX_NUMBER_ABSENT_COUNTRIES,
3225
3238
  ADYEN_ROLLOUT_COUNTRY_CODES,
3226
- AFFIRM_PRICE_PLANS,
3239
+ ADYEN_STORE_STATE_PROVINCE_COUNTRIES,
3240
+ ADYEN_TAX_NUMBER_FORMATS,
3241
+ ADYEN_TAX_NUMBER_MIN_LENGTH,
3227
3242
  AttributeType,
3228
3243
  BookingRatePeriod,
3229
3244
  BookingResourceKind,
@@ -3276,7 +3291,6 @@ export {
3276
3291
  PricingLevel,
3277
3292
  PricingPlanEnum,
3278
3293
  PricingRegionEnum,
3279
- ProcessorType,
3280
3294
  ProductStatus,
3281
3295
  ProductType,
3282
3296
  PublicationAvailability,
@@ -3302,6 +3316,11 @@ export {
3302
3316
  TopMetericsSort,
3303
3317
  UserTypes,
3304
3318
  addAmounts,
3319
+ adyenLegalEntityRequiresStateOrProvince,
3320
+ adyenRequiresJobTitle,
3321
+ adyenStoreRequiresStateOrProvince,
3322
+ adyenSupportsTaxNumberAbsent,
3323
+ adyenTaxNumberFormat,
3305
3324
  amountToString,
3306
3325
  assertUnitSane,
3307
3326
  availableIn,
@@ -3353,7 +3372,6 @@ export {
3353
3372
  holdExpiresAt,
3354
3373
  inferStatesFromLegacyStatus,
3355
3374
  isAdyenRolloutCountry,
3356
- isAffirmPricePlan,
3357
3375
  isConditionOperator,
3358
3376
  isFulfillmentState,
3359
3377
  isPaymentState,