b23-lib 1.7.29 → 1.7.31

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Classes/Order.ts"],"names":["OrderState","OrderLineItemState","OrderModel","BaseShoppingContainerModel","data","date","item","currentStateMap","lineItemId","LineItemNotFoundError"],"mappings":"8RAMO,IAAKA,CACVA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,MAAS,CAAA,QAAA,CACTA,CAAA,CAAA,eAAA,CAAkB,iBAClBA,CAAAA,CAAAA,CAAA,UAAa,CAAA,YAAA,CACbA,CAAA,CAAA,OAAA,CAAU,SACVA,CAAAA,CAAAA,CAAA,iBAAoB,CAAA,mBAAA,CACpBA,CAAA,CAAA,SAAA,CAAY,WACZA,CAAAA,CAAAA,CAAA,SAAY,CAAA,WAAA,CACZA,CAAA,CAAA,QAAA,CAAW,UACXA,CAAAA,CAAAA,CAAA,QAAW,CAAA,UAAA,CATDA,OAAA,EAYAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAA,CAAA,OAAA,CAAU,SACVA,CAAAA,CAAAA,CAAA,UAAa,CAAA,YAAA,CACbA,CAAA,CAAA,OAAA,CAAU,SACVA,CAAAA,CAAAA,CAAA,SAAY,CAAA,WAAA,CACZA,CAAA,CAAA,SAAA,CAAY,YALFA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAuCSC,CAArB,CAAA,cAAwCC,CAA2B,CACvD,WACA,CAAA,MAAA,CACA,aACA,CAAA,UAAA,CACA,KACA,CAAA,gBAAA,CAQV,WAAYC,CAAAA,CAAAA,CAAuBC,CAAa,CAAA,IAAI,KAAQ,CAC1D,KAAA,CAAMD,CAAMC,CAAAA,CAAI,CAChB,CAAA,IAAA,CAAK,WAAcD,CAAAA,CAAAA,CAAK,WACxB,CAAA,IAAA,CAAK,MAASA,CAAAA,CAAAA,CAAK,M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A,CAE5C,OAAO,IAAA,CAAK,gBAAiBA,CAAAA,CAAU,CAAE,CAAA,KAC3C,CAOA,UAAA,EAAwB,CACtB,OAAO,CACL,GAAG,KAAA,CAAM,UAAW,EAAA,CACpB,WAAa,CAAA,IAAA,CAAK,cAAe,EAAA,CACjC,UAAY,CAAA,IAAA,CAAK,aAAc,EAAA,CAC/B,aAAe,CAAA,IAAA,CAAK,kBACpB,CAAA,eAAA,CAAiB,IAAK,CAAA,kBAAA,EAAqB,CAAA,UAAA,EAC3C,CAAA,cAAA,CAAgB,IAAK,CAAA,iBAAA,EAAoB,CAAA,UAAA,EACzC,CAAA,MAAA,CAAQ,IAAK,CAAA,SAAA,GACb,aAAe,CAAA,IAAA,CAAK,gBAAiB,EAAA,CACrC,UAAY,CAAA,IAAA,CAAK,aAAc,EAAA,CAC/B,KAAO,CAAA,IAAA,CAAK,QAAS,EAAA,CACrB,gBAAkB,CAAA,IAAA,CAAK,oBAAqB,EAC9C,CACF,CACF","file":"Order.mjs","sourcesContent":["import AddressModel, { AddressData } from \"./Address\";\r\nimport { LineItemNotFoundError } from \"./Cart\";\r\nimport { ISODateTime } from \"./Common\";\r\nimport { PaymentStatus } from \"./Payment\";\r\nimport BaseShoppingContainerModel, { BaseShoppingContainerAttributes, BaseShoppingContainerData, ShoppingContainerTotal } from \"./ShoppingContainer\";\r\n\r\nexport enum OrderState {\r\n PLACED = \"PLACED\",\r\n PENDING_PAYMENT = \"PENDING_PAYMENT\",\r\n PROCESSING = \"PROCESSING\",\r\n SHIPPED = \"SHIPPED\",\r\n PARTIALLY_SHIPPED = \"PARTIALLY_SHIPPED\",\r\n DELIVERED = \"DELIVERED\",\r\n CANCELLED = \"CANCELLED\",\r\n RETURNED = \"RETURNED\",\r\n REFUNDED = \"REFUNDED\",\r\n}\r\n\r\nexport enum OrderLineItemState {\r\n INITIAL = \"INITIAL\",\r\n PROCESSING = \"PROCESSING\",\r\n SHIPPED = \"SHIPPED\",\r\n DELIVERED = \"DELIVERED\",\r\n CANCELLED = \"CANCELLED\",\r\n}\r\n\r\nexport type OrderLineItemStateMap = Record<string, {\r\n state:OrderLineItemState;\r\n reason?: string;\r\n transitionAt: ISODateTime;\r\n}>;\r\n\r\n/**\r\n * Input attributes for creating an OrderModel.\r\n * Extends CartAttributes but requires/adds order-specific fields.\r\n */\r\nexport type OrderAttributes = Omit<BaseShoppingContainerAttributes, 'anonymousId'> & {\r\n customerId: string;\r\n customerEmail: string;\r\n shippingAddress: AddressData;\r\n billingAddress: AddressData;\r\n anonymousId?: string;\r\n total: Required<ShoppingContainerTotal>;\r\n orderNumber: string;\r\n cartId: string;\r\n paymentStatus: PaymentStatus;\r\n holdReason?: string;\r\n state: OrderState;\r\n lineItemStateMap?: OrderLineItemStateMap;\r\n};\r\n\r\n/**\r\n * Output data structure for an OrderModel.\r\n */\r\nexport type OrderData = BaseShoppingContainerData & OrderAttributes;\r\n\r\n\r\nexport default class OrderModel extends BaseShoppingContainerModel {\r\n protected orderNumber: string;\r\n protected cartId: string;\r\n protected paymentStatus: PaymentStatus;\r\n protected holdReason: string;\r\n protected state: OrderState;\r\n protected lineItemStateMap: OrderLineItemStateMap;\r\n\r\n /**\r\n * Creates an instance of OrderModel.\r\n * @param data - The initial order attributes, including cart data.\r\n * @param date - Optional date for setting creation/modification times (defaults to now).\r\n * @param config - Optional cart configuration (might be less relevant for orders).\r\n */\r\n constructor(data: OrderAttributes, date: Date = new Date()) {\r\n super(data, date);\r\n this.orderNumber = data.orderNumber;\r\n this.cartId = data.cartId;\r\n this.paymentStatus = data.paymentStatus;\r\n this.holdReason = data.holdReason || '';\r\n this.state = data.state;\r\n \r\n this.lineItemStateMap = {};\r\n data.lineItems.forEach(item => {\r\n const currentStateMap = this.lineItemStateMap[item.id];\r\n \r\n this.lineItemStateMap[item.id] = {\r\n state: currentStateMap?.state || OrderLineItemState.INITIAL,\r\n reason: currentStateMap?.reason || '',\r\n transitionAt: currentStateMap?.transitionAt || this.createdAt,\r\n };\r\n });\r\n }\r\n\r\n /**\r\n * Gets the customer ID associated with this order.\r\n * Overrides the base method to guarantee a non-undefined return type for orders.\r\n * @returns The customer ID string.\r\n */\r\n public getCustomerId(): string {\r\n return this.customerId as string;\r\n }\r\n\r\n /**\r\n * Gets the customer email associated with this order.\r\n * Overrides the base method to guarantee a non-undefined return type for orders.\r\n * @returns The customer email string.\r\n */\r\n public getCustomerEmail(): string {\r\n return this.customerEmail as string;\r\n }\r\n\r\n /**\r\n * Gets the shipping address associated with the order.\r\n * Overrides the base method to guarantee a non-null return type for orders.\r\n * @returns An AddressModel instance for the shipping address.\r\n */\r\n public getShippingAddress(): AddressModel {\r\n return this.shippingAddress as AddressModel;\r\n }\r\n\r\n /**\r\n * Gets the billing address associated with the order.\r\n * Overrides the base method to guarantee a non-null return type for orders.\r\n * @returns An AddressModel instance for the billing address.\r\n */\r\n public getBillingAddress(): AddressModel {\r\n return this.billingAddress as AddressModel;\r\n }\r\n\r\n\r\n /**\r\n * Gets the user-facing order number.\r\n * @returns The order number string.\r\n */\r\n public getOrderNumber(): string {\r\n return this.orderNumber;\r\n }\r\n\r\n /**\r\n * Gets the ID of the cart from which this order was created.\r\n * @returns The cart ID string.\r\n */\r\n public getCartId(): string {\r\n return this.cartId;\r\n }\r\n\r\n /**\r\n * Gets the current payment status of the order.\r\n * @returns The PaymentStatus enum value.\r\n */\r\n public getPaymentStatus(): PaymentStatus {\r\n return this.paymentStatus;\r\n }\r\n\r\n /**\r\n * Gets the reason why the order might be on hold, if any.\r\n * @returns The hold reason string (empty if not on hold or no reason specified).\r\n */\r\n public getHoldReason(): string {\r\n return this.holdReason;\r\n }\r\n\r\n /**\r\n * Gets the current state of the order (e.g., PROCESSING, SHIPPED).\r\n * @returns The OrderState enum value.\r\n */\r\n public getState(): OrderState {\r\n return this.state;\r\n }\r\n\r\n /**\r\n * Gets the map tracking the state of each line item in the order.\r\n * The keys are line item IDs, and the values contain the state, reason, and transition timestamp.\r\n * @returns The OrderLineItemStateMap.\r\n */\r\n public getLineItemsStateMap(): OrderLineItemStateMap {\r\n return { ...this.lineItemStateMap };\r\n }\r\n\r\n /**\r\n * Gets the current state of a specific line item within the order.\r\n * @param lineItemId - The ID of the line item whose state is requested.\r\n * @returns The OrderLineItemState enum value for the specified line item.\r\n * @throws {LineItemNotFoundError} If no line item with the given ID exists in the order's state map.\r\n */\r\n public getLineItemState(lineItemId: string): OrderLineItemState {\r\n if (!this.lineItemStateMap[lineItemId]){\r\n throw new LineItemNotFoundError(lineItemId)\r\n }\r\n return this.lineItemStateMap[lineItemId].state;\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the order's current state.\r\n * Includes all cart details plus order-specific information.\r\n * @returns OrderData object suitable for serialization or API responses.\r\n */\r\n getDetails(): OrderData {\r\n return {\r\n ...super.getDetails(),\r\n orderNumber: this.getOrderNumber(),\r\n customerId: this.getCustomerId(),\r\n customerEmail: this.getCustomerEmail(),\r\n shippingAddress: this.getShippingAddress().getDetails(),\r\n billingAddress: this.getBillingAddress().getDetails(),\r\n cartId: this.getCartId(),\r\n paymentStatus: this.getPaymentStatus(),\r\n holdReason: this.getHoldReason(),\r\n state: this.getState(),\r\n lineItemStateMap: this.getLineItemsStateMap()\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"sources":["../../src/Classes/Order.ts"],"names":["OrderState","OrderLineItemState","OrderModel","BaseShoppingContainerModel","data","date","item","currentStateMap","lineItemId","LineItemNotFoundError"],"mappings":"8RAMO,IAAKA,CACVA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,MAAS,CAAA,QAAA,CACTA,CAAA,CAAA,eAAA,CAAkB,iBAClBA,CAAAA,CAAAA,CAAA,UAAa,CAAA,YAAA,CACbA,CAAA,CAAA,OAAA,CAAU,SACVA,CAAAA,CAAAA,CAAA,SAAY,CAAA,WAAA,CACZA,CAAA,CAAA,SAAA,CAAY,WACZA,CAAAA,CAAAA,CAAA,QAAW,CAAA,UAAA,CACXA,CAAA,CAAA,QAAA,CA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,oBAAqB,EAC9C,CACF,CACF","file":"Order.mjs","sourcesContent":["import AddressModel, { AddressData } from \"./Address\";\r\nimport { LineItemNotFoundError } from \"./Cart\";\r\nimport { ISODateTime } from \"./Common\";\r\nimport { PaymentStatus } from \"./Payment\";\r\nimport BaseShoppingContainerModel, { BaseShoppingContainerAttributes, BaseShoppingContainerData, ShoppingContainerTotal } from \"./ShoppingContainer\";\r\n\r\nexport enum OrderState {\r\n PLACED = \"PLACED\",\r\n PENDING_PAYMENT = \"PENDING_PAYMENT\",\r\n PROCESSING = \"PROCESSING\",\r\n SHIPPED = \"SHIPPED\",\r\n DELIVERED = \"DELIVERED\",\r\n CANCELLED = \"CANCELLED\",\r\n RETURNED = \"RETURNED\",\r\n REFUNDED = \"REFUNDED\",\r\n COMPLETED = \"COMPLETED\",\r\n}\r\n\r\nexport enum OrderLineItemState {\r\n INITIAL = \"INITIAL\",\r\n PROCESSING = \"PROCESSING\",\r\n SHIPPED = \"SHIPPED\",\r\n DELIVERED = \"DELIVERED\",\r\n CANCELLED = \"CANCELLED\",\r\n}\r\n\r\nexport type OrderLineItemStateMap = Record<string, {\r\n state:OrderLineItemState;\r\n reason?: string;\r\n transitionAt: ISODateTime;\r\n}>;\r\n\r\n/**\r\n * Input attributes for creating an OrderModel.\r\n * Extends CartAttributes but requires/adds order-specific fields.\r\n */\r\nexport type OrderAttributes = Omit<BaseShoppingContainerAttributes, 'anonymousId'> & {\r\n customerId: string;\r\n customerEmail: string;\r\n shippingAddress: AddressData;\r\n billingAddress: AddressData;\r\n anonymousId?: string;\r\n total: Required<ShoppingContainerTotal>;\r\n orderNumber: string;\r\n cartId: string;\r\n paymentStatus: PaymentStatus;\r\n holdReason?: string;\r\n state: OrderState;\r\n lineItemStateMap?: OrderLineItemStateMap;\r\n};\r\n\r\n/**\r\n * Output data structure for an OrderModel.\r\n */\r\nexport type OrderData = BaseShoppingContainerData & OrderAttributes;\r\n\r\n\r\nexport default class OrderModel extends BaseShoppingContainerModel {\r\n protected orderNumber: string;\r\n protected cartId: string;\r\n protected paymentStatus: PaymentStatus;\r\n protected holdReason: string;\r\n protected state: OrderState;\r\n protected lineItemStateMap: OrderLineItemStateMap;\r\n\r\n /**\r\n * Creates an instance of OrderModel.\r\n * @param data - The initial order attributes, including cart data.\r\n * @param date - Optional date for setting creation/modification times (defaults to now).\r\n * @param config - Optional cart configuration (might be less relevant for orders).\r\n */\r\n constructor(data: OrderAttributes, date: Date = new Date()) {\r\n super(data, date);\r\n this.orderNumber = data.orderNumber;\r\n this.cartId = data.cartId;\r\n this.paymentStatus = data.paymentStatus;\r\n this.holdReason = data.holdReason || '';\r\n this.state = data.state;\r\n \r\n this.lineItemStateMap = {};\r\n data.lineItems.forEach(item => {\r\n const currentStateMap = this.lineItemStateMap[item.id];\r\n \r\n this.lineItemStateMap[item.id] = {\r\n state: currentStateMap?.state || OrderLineItemState.INITIAL,\r\n reason: currentStateMap?.reason || '',\r\n transitionAt: currentStateMap?.transitionAt || this.createdAt,\r\n };\r\n });\r\n }\r\n\r\n /**\r\n * Gets the customer ID associated with this order.\r\n * Overrides the base method to guarantee a non-undefined return type for orders.\r\n * @returns The customer ID string.\r\n */\r\n public getCustomerId(): string {\r\n return this.customerId as string;\r\n }\r\n\r\n /**\r\n * Gets the customer email associated with this order.\r\n * Overrides the base method to guarantee a non-undefined return type for orders.\r\n * @returns The customer email string.\r\n */\r\n public getCustomerEmail(): string {\r\n return this.customerEmail as string;\r\n }\r\n\r\n /**\r\n * Gets the shipping address associated with the order.\r\n * Overrides the base method to guarantee a non-null return type for orders.\r\n * @returns An AddressModel instance for the shipping address.\r\n */\r\n public getShippingAddress(): AddressModel {\r\n return this.shippingAddress as AddressModel;\r\n }\r\n\r\n /**\r\n * Gets the billing address associated with the order.\r\n * Overrides the base method to guarantee a non-null return type for orders.\r\n * @returns An AddressModel instance for the billing address.\r\n */\r\n public getBillingAddress(): AddressModel {\r\n return this.billingAddress as AddressModel;\r\n }\r\n\r\n\r\n /**\r\n * Gets the user-facing order number.\r\n * @returns The order number string.\r\n */\r\n public getOrderNumber(): string {\r\n return this.orderNumber;\r\n }\r\n\r\n /**\r\n * Gets the ID of the cart from which this order was created.\r\n * @returns The cart ID string.\r\n */\r\n public getCartId(): string {\r\n return this.cartId;\r\n }\r\n\r\n /**\r\n * Gets the current payment status of the order.\r\n * @returns The PaymentStatus enum value.\r\n */\r\n public getPaymentStatus(): PaymentStatus {\r\n return this.paymentStatus;\r\n }\r\n\r\n /**\r\n * Gets the reason why the order might be on hold, if any.\r\n * @returns The hold reason string (empty if not on hold or no reason specified).\r\n */\r\n public getHoldReason(): string {\r\n return this.holdReason;\r\n }\r\n\r\n /**\r\n * Gets the current state of the order (e.g., PROCESSING, SHIPPED).\r\n * @returns The OrderState enum value.\r\n */\r\n public getState(): OrderState {\r\n return this.state;\r\n }\r\n\r\n /**\r\n * Gets the map tracking the state of each line item in the order.\r\n * The keys are line item IDs, and the values contain the state, reason, and transition timestamp.\r\n * @returns The OrderLineItemStateMap.\r\n */\r\n public getLineItemsStateMap(): OrderLineItemStateMap {\r\n return { ...this.lineItemStateMap };\r\n }\r\n\r\n /**\r\n * Gets the current state of a specific line item within the order.\r\n * @param lineItemId - The ID of the line item whose state is requested.\r\n * @returns The OrderLineItemState enum value for the specified line item.\r\n * @throws {LineItemNotFoundError} If no line item with the given ID exists in the order's state map.\r\n */\r\n public getLineItemState(lineItemId: string): OrderLineItemState {\r\n if (!this.lineItemStateMap[lineItemId]){\r\n throw new LineItemNotFoundError(lineItemId)\r\n }\r\n return this.lineItemStateMap[lineItemId].state;\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the order's current state.\r\n * Includes all cart details plus order-specific information.\r\n * @returns OrderData object suitable for serialization or API responses.\r\n */\r\n getDetails(): OrderData {\r\n return {\r\n ...super.getDetails(),\r\n orderNumber: this.getOrderNumber(),\r\n customerId: this.getCustomerId(),\r\n customerEmail: this.getCustomerEmail(),\r\n shippingAddress: this.getShippingAddress().getDetails(),\r\n billingAddress: this.getBillingAddress().getDetails(),\r\n cartId: this.getCartId(),\r\n paymentStatus: this.getPaymentStatus(),\r\n holdReason: this.getHoldReason(),\r\n state: this.getState(),\r\n lineItemStateMap: this.getLineItemsStateMap()\r\n }\r\n }\r\n}\r\n"]}
@@ -1,2 +1,2 @@
1
- export{a as default}from'../chunk-R75WJOXO.mjs';import'../chunk-WU6FFDBS.mjs';import'../chunk-GCT7VOSM.mjs';import'../chunk-65X54TKF.mjs';import'../chunk-DKI6BDWK.mjs';import'../chunk-HTJJLLGW.mjs';import'../chunk-DM2BJMLJ.mjs';import'../chunk-ATUUYYQT.mjs';//# sourceMappingURL=ShoppingContainer.mjs.map
1
+ export{a as default}from'../chunk-R75WJOXO.mjs';import'../chunk-WU6FFDBS.mjs';import'../chunk-DKI6BDWK.mjs';import'../chunk-GCT7VOSM.mjs';import'../chunk-65X54TKF.mjs';import'../chunk-HTJJLLGW.mjs';import'../chunk-DM2BJMLJ.mjs';import'../chunk-ATUUYYQT.mjs';//# sourceMappingURL=ShoppingContainer.mjs.map
2
2
  //# sourceMappingURL=ShoppingContainer.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "b23-lib",
3
- "version": "1.7.29",
3
+ "version": "1.7.31",
4
4
  "description": "This repo hold common classes, type and util functiona",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",