@final-commerce/common 2.5.1-preprod.6 → 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.d.mts +1 -27
- package/dist/index.d.ts +1 -27
- package/dist/index.js +0 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -48
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +4 -31
- package/dist/pos-types/index.d.ts +4 -31
- package/dist/pos-types/index.js +0 -1
- package/dist/pos-types/index.js.map +1 -1
- package/dist/pos-types/index.mjs +0 -1
- package/dist/pos-types/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2492,51 +2492,6 @@ function inferStatesFromLegacyStatus(order) {
|
|
|
2492
2492
|
return { payment: "unpaid", fulfillment: "pending" };
|
|
2493
2493
|
}
|
|
2494
2494
|
|
|
2495
|
-
// order-state-machine/in-cart.ts
|
|
2496
|
-
function hasInCartFlag(order) {
|
|
2497
|
-
return order.inCart != null;
|
|
2498
|
-
}
|
|
2499
|
-
function isInCart(order) {
|
|
2500
|
-
if (order.inCart != null) return order.inCart.active === true;
|
|
2501
|
-
if (order.fulfillmentState) return order.fulfillmentState === "draft";
|
|
2502
|
-
return (order.status ?? "").trim().toLowerCase() === "in-cart";
|
|
2503
|
-
}
|
|
2504
|
-
|
|
2505
|
-
// order-state-machine/order-status.ts
|
|
2506
|
-
function validateOrderStatuses(statuses) {
|
|
2507
|
-
if (!Array.isArray(statuses)) {
|
|
2508
|
-
return [{ index: -1, field: "orderStatuses", message: "must be an array" }];
|
|
2509
|
-
}
|
|
2510
|
-
const errors = [];
|
|
2511
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2512
|
-
statuses.forEach((raw, index) => {
|
|
2513
|
-
const s = raw ?? {};
|
|
2514
|
-
const add = (field, message) => errors.push({ index, field, message });
|
|
2515
|
-
if (typeof s.id !== "string" || !s.id.trim()) add("id", "must be a non-empty string");
|
|
2516
|
-
else if (seen.has(s.id)) add("id", `duplicate id "${s.id}"`);
|
|
2517
|
-
else seen.add(s.id);
|
|
2518
|
-
if (typeof s.label !== "string" || !s.label.trim()) add("label", "must be a non-empty string");
|
|
2519
|
-
for (const field of ["color", "icon"]) {
|
|
2520
|
-
if (s[field] !== void 0 && typeof s[field] !== "string") add(field, "must be a string");
|
|
2521
|
-
}
|
|
2522
|
-
if (s.fulfillmentState !== void 0 && !(typeof s.fulfillmentState === "string" && isFulfillmentState(s.fulfillmentState))) {
|
|
2523
|
-
add("fulfillmentState", `"${String(s.fulfillmentState)}" is not a fulfillment state`);
|
|
2524
|
-
}
|
|
2525
|
-
if (s.requiresPaymentState !== void 0) {
|
|
2526
|
-
if (!Array.isArray(s.requiresPaymentState) || s.requiresPaymentState.length === 0) {
|
|
2527
|
-
add("requiresPaymentState", "must be a non-empty array of payment states");
|
|
2528
|
-
} else {
|
|
2529
|
-
for (const p of s.requiresPaymentState) {
|
|
2530
|
-
if (!(typeof p === "string" && isPaymentState(p))) {
|
|
2531
|
-
add("requiresPaymentState", `"${String(p)}" is not a payment state`);
|
|
2532
|
-
}
|
|
2533
|
-
}
|
|
2534
|
-
}
|
|
2535
|
-
}
|
|
2536
|
-
});
|
|
2537
|
-
return errors;
|
|
2538
|
-
}
|
|
2539
|
-
|
|
2540
2495
|
// order-state-machine/write-strategy.ts
|
|
2541
2496
|
var LegacyWriteStrategy = class {
|
|
2542
2497
|
applyState(_order) {
|
|
@@ -3396,7 +3351,6 @@ export {
|
|
|
3396
3351
|
getPricingRegionFromCountry,
|
|
3397
3352
|
getSettlementTotal,
|
|
3398
3353
|
getTotalCollected,
|
|
3399
|
-
hasInCartFlag,
|
|
3400
3354
|
holdExpiresAt,
|
|
3401
3355
|
inferStatesFromLegacyStatus,
|
|
3402
3356
|
isAdyenRolloutCountry,
|
|
@@ -3404,7 +3358,6 @@ export {
|
|
|
3404
3358
|
isAffirmPricePlan,
|
|
3405
3359
|
isConditionOperator,
|
|
3406
3360
|
isFulfillmentState,
|
|
3407
|
-
isInCart,
|
|
3408
3361
|
isPaymentState,
|
|
3409
3362
|
isSupportedCurrency,
|
|
3410
3363
|
isSystemFamilyCode,
|
|
@@ -3438,7 +3391,6 @@ export {
|
|
|
3438
3391
|
toMinorUnits,
|
|
3439
3392
|
validateConfig,
|
|
3440
3393
|
validateFragmentCompatibility,
|
|
3441
|
-
validateOrderStatuses,
|
|
3442
3394
|
violatesFinancialInvariant,
|
|
3443
3395
|
windowEndsAt,
|
|
3444
3396
|
withinPresence
|