@classytic/cart 1.1.0 → 1.1.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/{define-cart-Cr9VMeVc.mjs → define-cart-CYkjJdC7.mjs} +11 -0
- package/dist/domain/index.d.mts +4 -4
- package/dist/domain/saga/index.d.mts +1 -1
- package/dist/engine/index.d.mts +1 -1
- package/dist/engine/index.mjs +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +2 -2
- package/dist/{internal-event-bus-BA-WrtE0.d.mts → internal-event-bus-Ci5Zpoqu.d.mts} +2 -2
- package/dist/{kind-registry-DFvNDb81.d.mts → kind-registry-BkYl0cjc.d.mts} +1 -1
- package/dist/kinds/index.d.mts +1 -1
- package/dist/kinds/index.mjs +1 -1
- package/dist/{line-kind-BW2zLNSr.d.mts → line-kind-kYeQzpCy.d.mts} +17 -0
- package/dist/{reservation.entity-BEeYbRUY.d.mts → reservation.entity-CLRqLD6X.d.mts} +2 -2
- package/dist/{state-transitions-BQ2Nhxnb.d.mts → state-transitions-B_ozUaqV.d.mts} +1 -1
- package/dist/{variant.kind-CClf8MTF.d.mts → variant.kind-BVmeGR6G.d.mts} +1 -1
- package/dist/{variant.kind-NmWSslu-.mjs → variant.kind-CquIUes6.mjs} +18 -0
- package/package.json +1 -1
|
@@ -190,6 +190,17 @@ const lineDisplaySubSchema = new Schema({
|
|
|
190
190
|
type: Schema.Types.Mixed,
|
|
191
191
|
default: null
|
|
192
192
|
},
|
|
193
|
+
/**
|
|
194
|
+
* Per-unit shipping weight. Declared here or mongoose strips it — the failure
|
|
195
|
+
* this repo has paid for with `stockTracked`, `monetizationKind` and the order
|
|
196
|
+
* `payment` block. NO `default: 0`: absent must stay distinguishable from
|
|
197
|
+
* weightless, because a weight-tiered delivery zone prices the cheapest step
|
|
198
|
+
* for a zero and under-charges every unweighed cart.
|
|
199
|
+
*/
|
|
200
|
+
weightGrams: {
|
|
201
|
+
type: Number,
|
|
202
|
+
default: null
|
|
203
|
+
},
|
|
193
204
|
capturedAt: {
|
|
194
205
|
type: Date,
|
|
195
206
|
default: () => /* @__PURE__ */ new Date()
|
package/dist/domain/index.d.mts
CHANGED
|
@@ -4,10 +4,10 @@ import { S as CartEvents, _ as CartEventMeta, a as OutboxErrorInfo, b as CartEve
|
|
|
4
4
|
import { a as CartEventRegistry, c as defineCartEvent, d as EventValidationResult, f as EventValidator, i as CartEventDefinitionInput, l as EventSchema, n as cartEventsByName, o as PayloadOf, r as CartEventDefinition, s as createCartEventRegistry, t as cartEventDefinitions, u as EventSchemaProperty } from "../cart-event-catalog-Cokx0iOw.mjs";
|
|
5
5
|
import "./events/index.mjs";
|
|
6
6
|
import { C as OperationContext, E as PricingSnapshot, S as BridgeStatus, T as PricedLine, _ as CartSnapshot, a as ShippingQuote, c as TaxBridge, d as InventoryBridge, f as ReservationRef, g as AdjustmentSpec, h as ProductSummary, i as ShippingMethod, l as TaxCalculationRequest, m as CatalogBridge, n as systemClock, o as ShippingQuoteRequest, p as ReservationRequest, r as ShippingBridge, s as TaxBreakdown, t as ClockPort, u as TaxCalculationResult, v as PromotionResult, x as BridgeRef, y as PromotionsBridge } from "../clock.port-DrSBrsit.mjs";
|
|
7
|
-
import { a as Adjustment, i as Checkout, n as IdempotencyRecord, r as Draft, t as Reservation } from "../reservation.entity-
|
|
8
|
-
import { a as SagaStepFn, c as CheckoutStepNumber, i as SagaDependencies, n as CHECKOUT_STATE_TRANSITIONS, o as CheckoutFlowState, r as isLegalCheckoutTransition, s as CheckoutStep, t as CHECKOUT_MACHINE } from "../state-transitions-
|
|
9
|
-
import { a as RevalidationResult, c as ValidityPolicy, i as LineLike, l as LineDisplay, n as KindContext, o as StaleBehavior, r as LineKind, s as StaleTrigger, t as KindBridges } from "../line-kind-
|
|
10
|
-
import { a as IdempotencyReplay, c as LineItem, i as IdempotencyIdentity, n as createKindRegistry, o as OperationName, r as CART_REF_NEW, s as TotalsSnapshot, t as KindRegistry } from "../kind-registry-
|
|
7
|
+
import { a as Adjustment, i as Checkout, n as IdempotencyRecord, r as Draft, t as Reservation } from "../reservation.entity-CLRqLD6X.mjs";
|
|
8
|
+
import { a as SagaStepFn, c as CheckoutStepNumber, i as SagaDependencies, n as CHECKOUT_STATE_TRANSITIONS, o as CheckoutFlowState, r as isLegalCheckoutTransition, s as CheckoutStep, t as CHECKOUT_MACHINE } from "../state-transitions-B_ozUaqV.mjs";
|
|
9
|
+
import { a as RevalidationResult, c as ValidityPolicy, i as LineLike, l as LineDisplay, n as KindContext, o as StaleBehavior, r as LineKind, s as StaleTrigger, t as KindBridges } from "../line-kind-kYeQzpCy.mjs";
|
|
10
|
+
import { a as IdempotencyReplay, c as LineItem, i as IdempotencyIdentity, n as createKindRegistry, o as OperationName, r as CART_REF_NEW, s as TotalsSnapshot, t as KindRegistry } from "../kind-registry-BkYl0cjc.mjs";
|
|
11
11
|
import { n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "../id.port-DzgWy8sy.mjs";
|
|
12
12
|
import "./ports/index.mjs";
|
|
13
13
|
import "./saga/index.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SagaStepFn, c as CheckoutStepNumber, i as SagaDependencies, n as CHECKOUT_STATE_TRANSITIONS, o as CheckoutFlowState, r as isLegalCheckoutTransition, s as CheckoutStep, t as CHECKOUT_MACHINE } from "../../state-transitions-
|
|
1
|
+
import { a as SagaStepFn, c as CheckoutStepNumber, i as SagaDependencies, n as CHECKOUT_STATE_TRANSITIONS, o as CheckoutFlowState, r as isLegalCheckoutTransition, s as CheckoutStep, t as CHECKOUT_MACHINE } from "../../state-transitions-B_ozUaqV.mjs";
|
|
2
2
|
export { CHECKOUT_MACHINE, CHECKOUT_STATE_TRANSITIONS, type CheckoutFlowState, CheckoutStep, type CheckoutStepNumber, type SagaDependencies, type SagaStepFn, isLegalCheckoutTransition };
|
package/dist/engine/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CartConfigShape, cartConfigSchema, checkoutConfigSchema, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema } from "./cart-config.schema.mjs";
|
|
2
|
-
import { a as defineCart, c as CartEngine, d as CartShape, f as ResolvedCartConfig, i as createCartDomain, l as CartLogger, n as CartBlueprint, o as CartBridges, r as CartDomainRuntime, s as CartDomain, t as InProcessCartEventBus, u as CartRuntime } from "../internal-event-bus-
|
|
2
|
+
import { a as defineCart, c as CartEngine, d as CartShape, f as ResolvedCartConfig, i as createCartDomain, l as CartLogger, n as CartBlueprint, o as CartBridges, r as CartDomainRuntime, s as CartDomain, t as InProcessCartEventBus, u as CartRuntime } from "../internal-event-bus-Ci5Zpoqu.mjs";
|
|
3
3
|
export { type CartBlueprint, type CartBridges, type CartConfigShape, type CartDomain, type CartDomainRuntime, type CartEngine, type CartLogger, type CartRuntime, type CartShape, InProcessCartEventBus, type ResolvedCartConfig, cartConfigSchema, checkoutConfigSchema, createCartDomain, defineCart, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema };
|
package/dist/engine/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as defineCart, r as InProcessCartEventBus, t as createCartDomain } from "../define-cart-
|
|
1
|
+
import { n as defineCart, r as InProcessCartEventBus, t as createCartDomain } from "../define-cart-CYkjJdC7.mjs";
|
|
2
2
|
import { cartConfigSchema, checkoutConfigSchema, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema } from "./cart-config.schema.mjs";
|
|
3
3
|
export { InProcessCartEventBus, cartConfigSchema, checkoutConfigSchema, createCartDomain, defineCart, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema };
|
package/dist/index.d.mts
CHANGED
|
@@ -3,14 +3,14 @@ import { n as DraftStatus, r as ReservationStatus, t as CheckoutState } from "./
|
|
|
3
3
|
import { S as CartEvents, _ as CartEventMeta, a as OutboxErrorInfo, b as CartEventName, c as OutboxFailureDecision, d as OutboxStore, f as OutboxStoreWriteOptions, g as CartEventAggregate, h as CartDomainEvent, i as OutboxClaimOptions, l as OutboxFailurePolicy, m as CartAggregateType, n as MemoryOutboxStore, o as OutboxFailOptions, p as OutboxWriteOptions, r as OutboxAcknowledgeOptions, s as OutboxFailureContext, t as InvalidOutboxEventError, u as OutboxOwnershipError, v as createCartEvent, x as CartEventPayload, y as CartEventMap } from "./outbox-store-Br7MHuOz.mjs";
|
|
4
4
|
import { a as CartEventRegistry, c as defineCartEvent, d as EventValidationResult, f as EventValidator, i as CartEventDefinitionInput, l as EventSchema, n as cartEventsByName, o as PayloadOf, r as CartEventDefinition, s as createCartEventRegistry, t as cartEventDefinitions, u as EventSchemaProperty } from "./cart-event-catalog-Cokx0iOw.mjs";
|
|
5
5
|
import { C as OperationContext, E as PricingSnapshot, S as BridgeStatus, T as PricedLine, _ as CartSnapshot, a as ShippingQuote, b as Address, c as TaxBridge, d as InventoryBridge, f as ReservationRef, g as AdjustmentSpec, h as ProductSummary, i as ShippingMethod, l as TaxCalculationRequest, m as CatalogBridge, n as systemClock, o as ShippingQuoteRequest, p as ReservationRequest, r as ShippingBridge, s as TaxBreakdown, t as ClockPort, u as TaxCalculationResult, v as PromotionResult, w as PENDING_EVENTS, x as BridgeRef, y as PromotionsBridge } from "./clock.port-DrSBrsit.mjs";
|
|
6
|
-
import { a as Adjustment, i as Checkout, n as IdempotencyRecord, r as Draft, t as Reservation } from "./reservation.entity-
|
|
7
|
-
import { a as SagaStepFn, c as CheckoutStepNumber, i as SagaDependencies, n as CHECKOUT_STATE_TRANSITIONS, o as CheckoutFlowState, r as isLegalCheckoutTransition, s as CheckoutStep } from "./state-transitions-
|
|
8
|
-
import { a as RevalidationResult, c as ValidityPolicy, i as LineLike, l as LineDisplay, n as KindContext, o as StaleBehavior, r as LineKind, s as StaleTrigger, t as KindBridges } from "./line-kind-
|
|
9
|
-
import { a as IdempotencyReplay, c as LineItem, i as IdempotencyIdentity, n as createKindRegistry, o as OperationName, r as CART_REF_NEW, s as TotalsSnapshot, t as KindRegistry } from "./kind-registry-
|
|
6
|
+
import { a as Adjustment, i as Checkout, n as IdempotencyRecord, r as Draft, t as Reservation } from "./reservation.entity-CLRqLD6X.mjs";
|
|
7
|
+
import { a as SagaStepFn, c as CheckoutStepNumber, i as SagaDependencies, n as CHECKOUT_STATE_TRANSITIONS, o as CheckoutFlowState, r as isLegalCheckoutTransition, s as CheckoutStep } from "./state-transitions-B_ozUaqV.mjs";
|
|
8
|
+
import { a as RevalidationResult, c as ValidityPolicy, i as LineLike, l as LineDisplay, n as KindContext, o as StaleBehavior, r as LineKind, s as StaleTrigger, t as KindBridges } from "./line-kind-kYeQzpCy.mjs";
|
|
9
|
+
import { a as IdempotencyReplay, c as LineItem, i as IdempotencyIdentity, n as createKindRegistry, o as OperationName, r as CART_REF_NEW, s as TotalsSnapshot, t as KindRegistry } from "./kind-registry-BkYl0cjc.mjs";
|
|
10
10
|
import { n as createCounterIdPort, r as cryptoIdPort, t as IdPort } from "./id.port-DzgWy8sy.mjs";
|
|
11
11
|
import { CartConfigShape, cartConfigSchema, checkoutConfigSchema, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema } from "./engine/cart-config.schema.mjs";
|
|
12
|
-
import { A as buildReservationSchema, C as DraftRepositoryDeps, D as DefineCartModelsConfig, E as CartModels, F as CheckoutDocument, I as buildCheckoutSchema, M as buildIdempotencySchema, N as DraftDocument, O as defineCartModels, P as buildDraftSchema, S as DraftRepository, T as CartModelName, _ as ReservationRepository, a as defineCart, b as CheckoutRepositoryDeps, c as CartEngine, d as CartShape, f as ResolvedCartConfig, g as createCartRepositories, h as CreateCartRepositoriesConfig, i as createCartDomain, j as IdempotencyDocument, k as ReservationDocument, l as CartLogger, m as CartRepositoryPluginBundle, n as CartBlueprint, o as CartBridges, p as CartRepositories, r as CartDomainRuntime, s as CartDomain, t as InProcessCartEventBus, u as CartRuntime, v as IdempotencyRepository, w as CartEventPublisherDeps, x as DEFAULT_STALE_OPEN_CHECKOUT_MS, y as CheckoutRepository } from "./internal-event-bus-
|
|
13
|
-
import { a as timeslotKind, c as skuKind, d as serviceFeeKind, f as serviceFeePayloadSchema, g as bundlePayloadSchema, h as bundleKind, i as TimeslotPayload, l as skuPayloadSchema, m as BundlePayload, n as variantKind, o as timeslotPayloadSchema, p as BundleComponent, r as variantPayloadSchema, s as SkuPayload, t as VariantPayload, u as ServiceFeePayload } from "./variant.kind-
|
|
12
|
+
import { A as buildReservationSchema, C as DraftRepositoryDeps, D as DefineCartModelsConfig, E as CartModels, F as CheckoutDocument, I as buildCheckoutSchema, M as buildIdempotencySchema, N as DraftDocument, O as defineCartModels, P as buildDraftSchema, S as DraftRepository, T as CartModelName, _ as ReservationRepository, a as defineCart, b as CheckoutRepositoryDeps, c as CartEngine, d as CartShape, f as ResolvedCartConfig, g as createCartRepositories, h as CreateCartRepositoriesConfig, i as createCartDomain, j as IdempotencyDocument, k as ReservationDocument, l as CartLogger, m as CartRepositoryPluginBundle, n as CartBlueprint, o as CartBridges, p as CartRepositories, r as CartDomainRuntime, s as CartDomain, t as InProcessCartEventBus, u as CartRuntime, v as IdempotencyRepository, w as CartEventPublisherDeps, x as DEFAULT_STALE_OPEN_CHECKOUT_MS, y as CheckoutRepository } from "./internal-event-bus-Ci5Zpoqu.mjs";
|
|
13
|
+
import { a as timeslotKind, c as skuKind, d as serviceFeeKind, f as serviceFeePayloadSchema, g as bundlePayloadSchema, h as bundleKind, i as TimeslotPayload, l as skuPayloadSchema, m as BundlePayload, n as variantKind, o as timeslotPayloadSchema, p as BundleComponent, r as variantPayloadSchema, s as SkuPayload, t as VariantPayload, u as ServiceFeePayload } from "./variant.kind-BVmeGR6G.mjs";
|
|
14
14
|
import { Money, Money as Money$1, addMoney, fromMajor, money, multiplyMoney, subtractMoney, sumMoney, toMajor } from "@classytic/primitives/money";
|
|
15
15
|
import { DomainEvent, EventHandler, EventTransport, EventTransport as EventTransport$1, PublishManyResult } from "@classytic/primitives/events";
|
|
16
16
|
import { CurrencyCode } from "@classytic/primitives/currency";
|
package/dist/index.mjs
CHANGED
|
@@ -7,10 +7,10 @@ import { t as StateTransitionError } from "./state-transition.error-BssJiRoW.mjs
|
|
|
7
7
|
import { n as CartEvents, t as createCartEvent } from "./domain-event-DBFsiHNJ.mjs";
|
|
8
8
|
import { a as cartEventsByName, i as cartEventDefinitions, n as MemoryOutboxStore, o as createCartEventRegistry, r as OutboxOwnershipError, s as defineCartEvent, t as InvalidOutboxEventError } from "./outbox-store-DLxCPOUN.mjs";
|
|
9
9
|
import { n as cryptoIdPort, r as systemClock, t as createCounterIdPort } from "./id.port-DYAnXbfV.mjs";
|
|
10
|
-
import { _ as PENDING_EVENTS, a as ReservationRepository, c as runPricing, d as defineCartModels, f as buildReservationSchema, g as flushPending, h as buildCheckoutSchema, i as createCartRepositories, l as CheckoutRepository, m as buildDraftSchema, n as defineCart, o as IdempotencyRepository, p as buildIdempotencySchema, r as InProcessCartEventBus, s as DraftRepository, t as createCartDomain, u as DEFAULT_STALE_OPEN_CHECKOUT_MS } from "./define-cart-
|
|
10
|
+
import { _ as PENDING_EVENTS, a as ReservationRepository, c as runPricing, d as defineCartModels, f as buildReservationSchema, g as flushPending, h as buildCheckoutSchema, i as createCartRepositories, l as CheckoutRepository, m as buildDraftSchema, n as defineCart, o as IdempotencyRepository, p as buildIdempotencySchema, r as InProcessCartEventBus, s as DraftRepository, t as createCartDomain, u as DEFAULT_STALE_OPEN_CHECKOUT_MS } from "./define-cart-CYkjJdC7.mjs";
|
|
11
11
|
import { t as createKindRegistry } from "./kind-registry-DQYqRQZU.mjs";
|
|
12
12
|
import { i as CheckoutStep, n as CHECKOUT_STATE_TRANSITIONS, r as isLegalCheckoutTransition } from "./state-transitions-wunwhjap.mjs";
|
|
13
|
-
import { a as skuKind, c as serviceFeePayloadSchema, i as timeslotPayloadSchema, l as bundleKind, n as variantPayloadSchema, o as skuPayloadSchema, r as timeslotKind, s as serviceFeeKind, t as variantKind, u as bundlePayloadSchema } from "./variant.kind-
|
|
13
|
+
import { a as skuKind, c as serviceFeePayloadSchema, i as timeslotPayloadSchema, l as bundleKind, n as variantPayloadSchema, o as skuPayloadSchema, r as timeslotKind, s as serviceFeeKind, t as variantKind, u as bundlePayloadSchema } from "./variant.kind-CquIUes6.mjs";
|
|
14
14
|
import { cartConfigSchema, checkoutConfigSchema, idempotencyConfigSchema, reservationConfigSchema, scopeConfigSchema } from "./engine/cart-config.schema.mjs";
|
|
15
15
|
import { addMoney, fromMajor, money, multiplyMoney, subtractMoney, sumMoney, toMajor } from "@classytic/primitives/money";
|
|
16
16
|
//#region src/services/abandonment.service.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { b as CartEventName, d as OutboxStore, h as CartDomainEvent, x as CartEventPayload } from "./outbox-store-Br7MHuOz.mjs";
|
|
2
2
|
import { C as OperationContext, c as TaxBridge, d as InventoryBridge, m as CatalogBridge, r as ShippingBridge, t as ClockPort, y as PromotionsBridge } from "./clock.port-DrSBrsit.mjs";
|
|
3
|
-
import { l as LineDisplay, r as LineKind } from "./line-kind-
|
|
4
|
-
import { c as LineItem, i as IdempotencyIdentity, t as KindRegistry } from "./kind-registry-
|
|
3
|
+
import { l as LineDisplay, r as LineKind } from "./line-kind-kYeQzpCy.mjs";
|
|
4
|
+
import { c as LineItem, i as IdempotencyIdentity, t as KindRegistry } from "./kind-registry-BkYl0cjc.mjs";
|
|
5
5
|
import { t as IdPort } from "./id.port-DzgWy8sy.mjs";
|
|
6
6
|
import { CartConfigShape } from "./engine/cart-config.schema.mjs";
|
|
7
7
|
import { Money } from "@classytic/primitives/money";
|
package/dist/kinds/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as timeslotKind, c as skuKind, d as serviceFeeKind, f as serviceFeePayloadSchema, g as bundlePayloadSchema, h as bundleKind, i as TimeslotPayload, l as skuPayloadSchema, m as BundlePayload, n as variantKind, o as timeslotPayloadSchema, p as BundleComponent, r as variantPayloadSchema, s as SkuPayload, t as VariantPayload, u as ServiceFeePayload } from "../variant.kind-
|
|
1
|
+
import { a as timeslotKind, c as skuKind, d as serviceFeeKind, f as serviceFeePayloadSchema, g as bundlePayloadSchema, h as bundleKind, i as TimeslotPayload, l as skuPayloadSchema, m as BundlePayload, n as variantKind, o as timeslotPayloadSchema, p as BundleComponent, r as variantPayloadSchema, s as SkuPayload, t as VariantPayload, u as ServiceFeePayload } from "../variant.kind-BVmeGR6G.mjs";
|
|
2
2
|
export { type BundleComponent, type BundlePayload, type ServiceFeePayload, type SkuPayload, type TimeslotPayload, type VariantPayload, bundleKind, bundlePayloadSchema, serviceFeeKind, serviceFeePayloadSchema, skuKind, skuPayloadSchema, timeslotKind, timeslotPayloadSchema, variantKind, variantPayloadSchema };
|
package/dist/kinds/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as skuKind, c as serviceFeePayloadSchema, i as timeslotPayloadSchema, l as bundleKind, n as variantPayloadSchema, o as skuPayloadSchema, r as timeslotKind, s as serviceFeeKind, t as variantKind, u as bundlePayloadSchema } from "../variant.kind-
|
|
1
|
+
import { a as skuKind, c as serviceFeePayloadSchema, i as timeslotPayloadSchema, l as bundleKind, n as variantPayloadSchema, o as skuPayloadSchema, r as timeslotKind, s as serviceFeeKind, t as variantKind, u as bundlePayloadSchema } from "../variant.kind-CquIUes6.mjs";
|
|
2
2
|
export { bundleKind, bundlePayloadSchema, serviceFeeKind, serviceFeePayloadSchema, skuKind, skuPayloadSchema, timeslotKind, timeslotPayloadSchema, variantKind, variantPayloadSchema };
|
|
@@ -39,6 +39,23 @@ interface LineDisplay {
|
|
|
39
39
|
variantLabel?: string;
|
|
40
40
|
/** Compare-at price for strikethrough display. */
|
|
41
41
|
compareAtPrice?: Money;
|
|
42
|
+
/**
|
|
43
|
+
* Per-unit shipping weight in GRAMS, captured with the rest of the snapshot.
|
|
44
|
+
*
|
|
45
|
+
* Unlike the cosmetic fields around it, this one feeds a PRICE: a checkout
|
|
46
|
+
* pricing delivery by weight tiers sums `weightGrams x quantity` across the
|
|
47
|
+
* cart, and without it every cart looks unweighable and falls back to the flat
|
|
48
|
+
* charge. Carried here so a cart can be priced with no catalog round-trip per
|
|
49
|
+
* line — the whole point of this snapshot.
|
|
50
|
+
*
|
|
51
|
+
* Display drift is tolerated for name and image; for this the SERVER re-derives
|
|
52
|
+
* it at placement from the order's own line snapshot, so a stale or tampered
|
|
53
|
+
* value can never become the charged amount.
|
|
54
|
+
*
|
|
55
|
+
* Absent means UNWEIGHED, never zero — a zone with weight steps must fall back
|
|
56
|
+
* to its flat charge rather than price the cheapest step.
|
|
57
|
+
*/
|
|
58
|
+
weightGrams?: number;
|
|
42
59
|
/**
|
|
43
60
|
* Timestamp when this snapshot was captured. The UI may show a "refresh"
|
|
44
61
|
* affordance if the snapshot is older than some threshold.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as DraftStatus, r as ReservationStatus, t as CheckoutState } from "./cart-status.vo-BoVPaSXX.mjs";
|
|
2
2
|
import { E as PricingSnapshot, g as AdjustmentSpec } from "./clock.port-DrSBrsit.mjs";
|
|
3
|
-
import { o as CheckoutFlowState } from "./state-transitions-
|
|
4
|
-
import { a as IdempotencyReplay, c as LineItem, o as OperationName } from "./kind-registry-
|
|
3
|
+
import { o as CheckoutFlowState } from "./state-transitions-B_ozUaqV.mjs";
|
|
4
|
+
import { a as IdempotencyReplay, c as LineItem, o as OperationName } from "./kind-registry-BkYl0cjc.mjs";
|
|
5
5
|
import { Money } from "@classytic/primitives/money";
|
|
6
6
|
//#region src/domain/entities/adjustment.entity.d.ts
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as CheckoutState } from "./cart-status.vo-BoVPaSXX.mjs";
|
|
2
2
|
import { C as OperationContext, t as ClockPort } from "./clock.port-DrSBrsit.mjs";
|
|
3
|
-
import { t as KindBridges } from "./line-kind-
|
|
3
|
+
import { t as KindBridges } from "./line-kind-kYeQzpCy.mjs";
|
|
4
4
|
import { t as IdPort } from "./id.port-DzgWy8sy.mjs";
|
|
5
5
|
//#region src/domain/saga/saga-steps.d.ts
|
|
6
6
|
/**
|
|
@@ -256,6 +256,15 @@ const skuKind = {
|
|
|
256
256
|
slug: product.slug,
|
|
257
257
|
variantLabel: product.variantLabel,
|
|
258
258
|
compareAtPrice: product.compareAtPrice,
|
|
259
|
+
/**
|
|
260
|
+
* From the catalog bridge, which has carried `weightGrams` all along — the
|
|
261
|
+
* snapshot simply never captured it, so every checkout pricing delivery by
|
|
262
|
+
* weight saw an unweighable cart and fell back to the flat charge.
|
|
263
|
+
*
|
|
264
|
+
* Emitted only when real and positive: absent means unweighed, and a zero
|
|
265
|
+
* would select the cheapest weight step instead of the safe fallback.
|
|
266
|
+
*/
|
|
267
|
+
...typeof product.weightGrams === "number" && product.weightGrams > 0 ? { weightGrams: product.weightGrams } : {},
|
|
259
268
|
capturedAt: ctx.clock?.now() ?? /* @__PURE__ */ new Date()
|
|
260
269
|
};
|
|
261
270
|
}
|
|
@@ -428,6 +437,15 @@ const variantKind = {
|
|
|
428
437
|
slug: product.slug,
|
|
429
438
|
variantLabel: product.variantLabel,
|
|
430
439
|
compareAtPrice: product.compareAtPrice,
|
|
440
|
+
/**
|
|
441
|
+
* From the catalog bridge, which has carried `weightGrams` all along — the
|
|
442
|
+
* snapshot simply never captured it, so every checkout pricing delivery by
|
|
443
|
+
* weight saw an unweighable cart and fell back to the flat charge.
|
|
444
|
+
*
|
|
445
|
+
* Emitted only when real and positive: absent means unweighed, and a zero
|
|
446
|
+
* would select the cheapest weight step instead of the safe fallback.
|
|
447
|
+
*/
|
|
448
|
+
...typeof product.weightGrams === "number" && product.weightGrams > 0 ? { weightGrams: product.weightGrams } : {},
|
|
431
449
|
capturedAt: ctx.clock?.now() ?? /* @__PURE__ */ new Date()
|
|
432
450
|
};
|
|
433
451
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/cart",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Framework-agnostic universal cart engine for commerce — drafts, checkouts, reservations, the LineKind strategy, and a disciplined finalization saga. Powered by MongoDB via @classytic/mongokit. Zero framework deps — usable from Arc, Express, Nest, Next.js, or raw Node.",
|
|
5
5
|
"author": "Classytic",
|
|
6
6
|
"type": "module",
|