b23-lib 1.12.0 → 2.0.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/README.md +0 -0
- package/dist/Auth/index.js +1 -1
- package/dist/Auth/index.js.map +1 -1
- package/dist/Auth/index.mjs +1 -1
- package/dist/Auth/index.mjs.map +1 -1
- package/dist/Classes/Address.d.mts +1 -1
- package/dist/Classes/Address.d.ts +1 -1
- package/dist/Classes/Address.js.map +1 -1
- package/dist/Classes/Address.mjs +1 -1
- package/dist/Classes/Base.d.mts +5 -5
- package/dist/Classes/Base.d.ts +5 -5
- package/dist/Classes/Base.js.map +1 -1
- package/dist/Classes/Base.mjs +1 -1
- package/dist/Classes/Cart.d.mts +27 -12
- package/dist/Classes/Cart.d.ts +27 -12
- package/dist/Classes/Cart.js +1 -1
- package/dist/Classes/Cart.js.map +1 -1
- package/dist/Classes/Cart.mjs +1 -1
- package/dist/Classes/Cart.mjs.map +1 -1
- package/dist/Classes/Common.d.mts +2 -93
- package/dist/Classes/Common.d.ts +2 -93
- package/dist/Classes/Coupon.d.mts +33 -15
- package/dist/Classes/Coupon.d.ts +33 -15
- package/dist/Classes/Coupon.js +1 -1
- package/dist/Classes/Coupon.js.map +1 -1
- package/dist/Classes/Coupon.mjs +1 -1
- package/dist/Classes/Customer.d.mts +2 -2
- package/dist/Classes/Customer.d.ts +2 -2
- package/dist/Classes/Customer.js.map +1 -1
- package/dist/Classes/Customer.mjs +1 -1
- package/dist/Classes/Customer.mjs.map +1 -1
- package/dist/Classes/CustomerAddress.d.mts +1 -1
- package/dist/Classes/CustomerAddress.d.ts +1 -1
- package/dist/Classes/CustomerAddress.js.map +1 -1
- package/dist/Classes/CustomerAddress.mjs +1 -1
- package/dist/Classes/Enum.d.mts +43 -2
- package/dist/Classes/Enum.d.ts +43 -2
- package/dist/Classes/Enum.js +1 -1
- package/dist/Classes/Enum.js.map +1 -1
- package/dist/Classes/Enum.mjs +1 -1
- package/dist/Classes/Error.d.mts +59 -0
- package/dist/Classes/Error.d.ts +59 -0
- package/dist/Classes/Error.js +2 -0
- package/dist/Classes/Error.js.map +1 -0
- package/dist/Classes/Error.mjs +2 -0
- package/dist/Classes/Error.mjs.map +1 -0
- package/dist/Classes/ImageInfo.js +1 -1
- package/dist/Classes/ImageInfo.js.map +1 -1
- package/dist/Classes/ImageInfo.mjs +1 -1
- package/dist/Classes/Inventory.d.mts +25 -6
- package/dist/Classes/Inventory.d.ts +25 -6
- package/dist/Classes/Inventory.js +1 -1
- package/dist/Classes/Inventory.js.map +1 -1
- package/dist/Classes/Inventory.mjs +1 -1
- package/dist/Classes/Inventory.mjs.map +1 -1
- package/dist/Classes/LineItem.d.mts +140 -58
- package/dist/Classes/LineItem.d.ts +140 -58
- package/dist/Classes/LineItem.js +1 -1
- package/dist/Classes/LineItem.js.map +1 -1
- package/dist/Classes/LineItem.mjs +1 -1
- package/dist/Classes/Order.d.mts +7 -51
- package/dist/Classes/Order.d.ts +7 -51
- package/dist/Classes/Order.js +1 -1
- package/dist/Classes/Order.js.map +1 -1
- package/dist/Classes/Order.mjs +1 -1
- package/dist/Classes/Order.mjs.map +1 -1
- package/dist/Classes/Payment.d.mts +4 -4
- package/dist/Classes/Payment.d.ts +4 -4
- package/dist/Classes/Payment.js.map +1 -1
- package/dist/Classes/Payment.mjs +1 -1
- package/dist/Classes/Payment.mjs.map +1 -1
- package/dist/Classes/Price.d.mts +1 -82
- package/dist/Classes/Price.d.ts +1 -82
- package/dist/Classes/Price.js +1 -1
- package/dist/Classes/Price.js.map +1 -1
- package/dist/Classes/Price.mjs +1 -1
- package/dist/Classes/Product.d.mts +103 -85
- package/dist/Classes/Product.d.ts +103 -85
- package/dist/Classes/Product.js +1 -1
- package/dist/Classes/Product.js.map +1 -1
- package/dist/Classes/Product.mjs +1 -1
- package/dist/Classes/Product.mjs.map +1 -1
- package/dist/Classes/ShoppingContainer.d.mts +79 -63
- package/dist/Classes/ShoppingContainer.d.ts +79 -63
- package/dist/Classes/ShoppingContainer.js +1 -1
- package/dist/Classes/ShoppingContainer.js.map +1 -1
- package/dist/Classes/ShoppingContainer.mjs +1 -1
- package/dist/Classes/TaxRule.d.mts +63 -0
- package/dist/Classes/TaxRule.d.ts +63 -0
- package/dist/Classes/TaxRule.js +2 -0
- package/dist/Classes/TaxRule.js.map +1 -0
- package/dist/Classes/TaxRule.mjs +2 -0
- package/dist/Classes/TaxRule.mjs.map +1 -0
- package/dist/Classes/TieredPrice.d.mts +75 -0
- package/dist/Classes/TieredPrice.d.ts +75 -0
- package/dist/Classes/TieredPrice.js +2 -0
- package/dist/Classes/TieredPrice.js.map +1 -0
- package/dist/Classes/TieredPrice.mjs +2 -0
- package/dist/Classes/TieredPrice.mjs.map +1 -0
- package/dist/Common-D-UoxwM0.d.ts +210 -0
- package/dist/Common-FbQ5-3QN.d.mts +210 -0
- package/dist/chunk-2SGUPNWZ.mjs +2 -0
- package/dist/chunk-2SGUPNWZ.mjs.map +1 -0
- package/dist/chunk-54RUAXYE.mjs +2 -0
- package/dist/chunk-54RUAXYE.mjs.map +1 -0
- package/dist/{chunk-ATUUYYQT.mjs → chunk-55SOBG62.mjs} +2 -2
- package/dist/chunk-55SOBG62.mjs.map +1 -0
- package/dist/{chunk-H5GPM4LA.mjs → chunk-5KD2EW7O.mjs} +2 -2
- package/dist/{chunk-H5GPM4LA.mjs.map → chunk-5KD2EW7O.mjs.map} +1 -1
- package/dist/chunk-72DR3HF2.mjs +2 -0
- package/dist/chunk-72DR3HF2.mjs.map +1 -0
- package/dist/chunk-AMIRIUMH.mjs +2 -0
- package/dist/chunk-AMIRIUMH.mjs.map +1 -0
- package/dist/chunk-CEGQFFYZ.mjs +2 -0
- package/dist/chunk-CEGQFFYZ.mjs.map +1 -0
- package/dist/chunk-EP7WVZXC.mjs +2 -0
- package/dist/chunk-EP7WVZXC.mjs.map +1 -0
- package/dist/chunk-KWH7GE23.mjs +2 -0
- package/dist/chunk-KWH7GE23.mjs.map +1 -0
- package/dist/chunk-LNIZAPER.mjs +2 -0
- package/dist/chunk-LNIZAPER.mjs.map +1 -0
- package/dist/chunk-NJKSUUOB.mjs +2 -0
- package/dist/chunk-NJKSUUOB.mjs.map +1 -0
- package/dist/chunk-NUTKOIGY.mjs +2 -0
- package/dist/chunk-NUTKOIGY.mjs.map +1 -0
- package/dist/chunk-RBROVHJ4.mjs +2 -0
- package/dist/chunk-RBROVHJ4.mjs.map +1 -0
- package/dist/index.d.mts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +35 -4
- package/dist/chunk-6PDP4ETM.mjs +0 -2
- package/dist/chunk-6PDP4ETM.mjs.map +0 -1
- package/dist/chunk-ATUUYYQT.mjs.map +0 -1
- package/dist/chunk-CKUUUEWT.mjs +0 -2
- package/dist/chunk-CKUUUEWT.mjs.map +0 -1
- package/dist/chunk-DKI6BDWK.mjs +0 -2
- package/dist/chunk-DKI6BDWK.mjs.map +0 -1
- package/dist/chunk-K3AXPTGG.mjs +0 -2
- package/dist/chunk-K3AXPTGG.mjs.map +0 -1
- package/dist/chunk-LMMJSJTO.mjs +0 -2
- package/dist/chunk-LMMJSJTO.mjs.map +0 -1
- package/dist/chunk-RWBNLNQ6.mjs +0 -2
- package/dist/chunk-RWBNLNQ6.mjs.map +0 -1
- package/dist/chunk-V4H3X4PI.mjs +0 -2
- package/dist/chunk-V4H3X4PI.mjs.map +0 -1
- package/dist/chunk-WOMA746Z.mjs +0 -2
- package/dist/chunk-WOMA746Z.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Classes/Base.ts","../../src/Classes/Address.ts","../../src/Classes/CustomerAddress.ts"],"names":["BaseModel","data","date","id","authType","requestId","lambdaName","fieldName","value","AddressModel","addressType","CustomerAddressModel","addressId","withId","acc","address","a","b","explicitDefault"],"mappings":"aA4BA,IAAqBA,EA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CAAA,wBAAA,EAA4BA,CAAQ,CAAA,oBAAA,EAC5E,CACA,CAAA,OAAIG,EACKA,CAAgB,CAAA,KAAA,GAGlB,IAAK,CAAA,YAAA,GAAe,IAAMH,CAAAA,CAAAA,EAAYA,EAAQ,oBAAqB,EAAC,GAAG,KAAM,EAAA,EAAK,IAC3F,CACF","file":"CustomerAddress.js","sourcesContent":["import { AuthType } from \"../Auth\";\r\nimport { ISODateTime } from \"./Common\";\r\n\r\nexport interface CustomFields {\r\n [key: string]: any;\r\n}\r\n\r\nexport type ModifiedBy = {\r\n id?: string;\r\n authType?: string;\r\n requestId?: string;\r\n lambdaName?: string;\r\n}\r\n\r\nexport type BaseAttributes = {\r\n customFields?: CustomFields;\r\n version?: number;\r\n createdAt?: ISODateTime;\r\n modifiedAt?: ISODateTime;\r\n modifiedBy?: ModifiedBy;\r\n};\r\n\r\nexport type BaseData = Required<BaseAttributes>;\r\n\r\n/**\r\n * Provides common foundational properties and methods for other data models.\r\n * Handles tracking of custom fields, versioning, and timestamps.\r\n */\r\nexport default class BaseModel {\r\n protected customFields: CustomFields;\r\n protected version: number;\r\n protected createdAt: ISODateTime;\r\n protected modifiedAt: ISODateTime;\r\n protected modifiedBy: ModifiedBy;\r\n\r\n /**\r\n * Creates an instance of BaseModel.\r\n * Initializes common properties like timestamps, version, and custom fields.\r\n * @param data - Optional initial attributes for the base model.\r\n * @param date - Optional date object to use for default timestamps (defaults to current time).\r\n */\r\n constructor(data: BaseAttributes, date: Date = new Date()) {\r\n this.customFields = { ...data.customFields };\r\n this.version = data.version ?? 1;\r\n this.createdAt = data.createdAt && !isNaN(Date.parse(data.createdAt))\r\n ?\r\n new Date(data.createdAt).toISOString()\r\n :\r\n date.toISOString();\r\n this.modifiedAt = data.modifiedAt && !isNaN(Date.parse(data.modifiedAt))\r\n ? new Date(data.modifiedAt).toISOString()\r\n : date.toISOString();\r\n\r\n this.modifiedBy = { ...data.modifiedBy };\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the base model's current state.\r\n * @returns BaseData object containing common properties.\r\n */\r\n getDetails(): BaseData {\r\n return {\r\n customFields: this.getAllCustomFields(), // Use getter to return a copy\r\n version: this.getVersion(),\r\n createdAt: this.getCreatedAt(),\r\n modifiedAt: this.getModifiedAt(),\r\n modifiedBy: this.getModifiedBy(),\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current version number of the model instance.\r\n * @returns The version number.\r\n */\r\n getVersion(): number {\r\n return this.version;\r\n }\r\n\r\n /**\r\n * Gets the creation timestamp as an ISO 8601 string.\r\n * @returns The creation timestamp string.\r\n */\r\n getCreatedAt(): string {\r\n return this.createdAt;\r\n }\r\n\r\n /**\r\n * Gets the creation timestamp as a Unix epoch time (milliseconds).\r\n * @returns The creation time in milliseconds since the epoch.\r\n */\r\n getCreatedAtTime(): number {\r\n return new Date(this.createdAt).getTime();\r\n }\r\n\r\n\r\n /**\r\n * Gets the last modification timestamp as an ISO 8601 string.\r\n * @returns The last modification timestamp string.\r\n */\r\n getModifiedAt(): string {\r\n return this.modifiedAt;\r\n }\r\n\r\n /**\r\n * Gets the last modification timestamp as a Unix epoch time (milliseconds).\r\n * @returns The last modification time in milliseconds since the epoch.\r\n */\r\n getModifiedAtTime(): number {\r\n return new Date(this.modifiedAt).getTime();\r\n }\r\n\r\n /**\r\n * Gets the identifier of the user or process that last modified the instance.\r\n * @returns\r\n */\r\n getModifiedBy(): ModifiedBy {\r\n return { ...this.modifiedBy };\r\n }\r\n\r\n /**\r\n * Sets the identifier of the user or process that last modified the instance.\r\n * @param modifiedBy - The identifier string.\r\n */\r\n setModifiedBy(id?: string, authType?: AuthType, requestId?: string, lambdaName?: string): void {\r\n this.modifiedBy = {\r\n id,\r\n authType,\r\n requestId,\r\n lambdaName,\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves the value of a specific custom field.\r\n * @param fieldName - The name (key) of the custom field to retrieve.\r\n * @returns The value of the custom field, or null if the field does not exist.\r\n */\r\n getCustomField(fieldName: string): any {\r\n return this.customFields[fieldName] ?? null;\r\n }\r\n\r\n /**\r\n * Sets the value of a specific custom field.\r\n * Also updates the modification timestamp and increments the version.\r\n * @param fieldName - The name (key) of the custom field to set.\r\n * @param value - The value to assign to the custom field.\r\n */\r\n setCustomField(fieldName: string, value: any): void {\r\n this.customFields[fieldName] = value;\r\n }\r\n\r\n /**\r\n * Retrieves a shallow copy of all custom fields associated with the instance.\r\n * @returns An object containing all custom fields.\r\n */\r\n getAllCustomFields(): CustomFields {\r\n return { ...this.customFields };\r\n }\r\n}\r\n","import BaseModel, { BaseAttributes } from \"./Base\";\r\n\r\nexport enum AddressType {\r\n BILLING = \"billing\",\r\n SHIPPING = \"shipping\",\r\n BILLING_AND_SHIPPING = \"billing&shipping\",\r\n NONE = \"none\",\r\n}\r\n\r\nexport type AddressAttributes = BaseAttributes & {\r\n id: string;\r\n firstName: string;\r\n lastName?: string;\r\n company?: string;\r\n phone: string;\r\n email: string;\r\n addressLine1: string;\r\n addressLine2?: string;\r\n city: string;\r\n postalCode: string\r\n state: string;\r\n country: string;\r\n isBillingAddress: boolean;\r\n isShippingAddress: boolean;\r\n};\r\n\r\nexport type AddressData = Required<AddressAttributes>;\r\n\r\n/**\r\n * Represents a physical address associated with a customer or order.\r\n * Handles both billing and shipping address types.\r\n */\r\nexport default class AddressModel extends BaseModel {\r\n protected id: string;\r\n protected firstName: string;\r\n protected lastName: string;\r\n protected company: string;\r\n protected phone: string;\r\n protected email: string;\r\n protected addressLine1: string;\r\n protected addressLine2: string;\r\n protected city: string;\r\n protected postalCode: string\r\n protected state: string;\r\n protected country: string;\r\n protected isBillingAddress: boolean;\r\n protected isShippingAddress: boolean;\r\n\r\n /**\r\n * Creates an instance of AddressModel.\r\n * @param data - The initial address attributes.\r\n * @param date - Optional date for setting creation/modification times (defaults to now).\r\n */\r\n constructor(data: AddressAttributes, date: Date = new Date()) {\r\n super(data, date);\r\n this.id = data.id;\r\n this.firstName = data.firstName;\r\n this.lastName = data.lastName || '';\r\n this.company = data.company || '';\r\n this.phone = data.phone;\r\n this.email = data.email;\r\n this.addressLine1 = data.addressLine1;\r\n this.addressLine2 = data.addressLine2 || '';\r\n this.city = data.city;\r\n this.postalCode = data.postalCode;\r\n this.state = data.state;\r\n this.country = data.country;\r\n this.isBillingAddress = data.isBillingAddress;\r\n this.isShippingAddress = data.isShippingAddress;\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the address's current state.\r\n * Includes all address fields and base model fields.\r\n * @returns AddressData object suitable for serialization or API responses.\r\n */\r\n getDetails(): AddressData {\r\n return {\r\n ...super.getDetails(),\r\n id: this.getId(),\r\n firstName: this.getFirstName(),\r\n lastName: this.getLastName(),\r\n company: this.getCompany(),\r\n phone: this.getPhone(),\r\n email: this.getEmail(),\r\n addressLine1: this.getAddressLine1(),\r\n addressLine2: this.getAddressLine2(),\r\n city: this.getCity(),\r\n postalCode: this.getPostalCode(),\r\n state: this.getState(),\r\n country: this.getCountry(),\r\n isBillingAddress: this.getIsBillingAddress(),\r\n isShippingAddress: this.getIsShippingAddress(),\r\n }\r\n }\r\n\r\n /**\r\n * Gets the unique identifier for the address.\r\n * @returns The address ID.\r\n */\r\n getId(): string {\r\n return this.id;\r\n }\r\n\r\n /**\r\n * Gets the first name associated with the address.\r\n * @returns The first name.\r\n */\r\n getFirstName(): string {\r\n return this.firstName;\r\n }\r\n\r\n /**\r\n * Gets the last name associated with the address.\r\n * @returns The last name.\r\n */\r\n getLastName(): string {\r\n return this.lastName;\r\n }\r\n\r\n /**\r\n * Gets the company name associated with the address.\r\n * @returns The company name.\r\n */\r\n getCompany(): string {\r\n return this.company;\r\n }\r\n\r\n /**\r\n * Gets the phone number associated with the address.\r\n * @returns The phone number.\r\n */\r\n getPhone(): string {\r\n return this.phone;\r\n }\r\n\r\n /**\r\n * Gets the email address associated with the address.\r\n * @returns The email address.\r\n */\r\n getEmail(): string {\r\n return this.email;\r\n }\r\n\r\n /**\r\n * Gets the primary address line (e.g., street address).\r\n * @returns The first address line.\r\n */\r\n getAddressLine1(): string {\r\n return this.addressLine1;\r\n }\r\n\r\n /**\r\n * Gets the secondary address line (e.g., apartment, suite).\r\n * Returns an empty string if not provided.\r\n * @returns The second address line or an empty string.\r\n */\r\n getAddressLine2(): string {\r\n return this.addressLine2;\r\n }\r\n\r\n /**\r\n * Gets the city name.\r\n * @returns The city.\r\n */\r\n getCity(): string {\r\n return this.city;\r\n }\r\n\r\n /**\r\n * Gets the postal code (e.g., ZIP code).\r\n * @returns The postal code.\r\n */\r\n getPostalCode(): string {\r\n return this.postalCode;\r\n }\r\n\r\n /**\r\n * Gets the state, province, or region.\r\n * @returns The state.\r\n */\r\n getState(): string {\r\n return this.state;\r\n }\r\n\r\n /**\r\n * Gets the country name or code.\r\n * @returns The country.\r\n */\r\n getCountry(): string {\r\n return this.country;\r\n }\r\n\r\n /**\r\n * Checks if this address is designated as a billing address.\r\n * @returns True if it's a billing address, false otherwise.\r\n */\r\n getIsBillingAddress(): boolean {\r\n return this.isBillingAddress;\r\n }\r\n\r\n /**\r\n * Checks if this address is designated as a shipping address.\r\n * @returns True if it's a shipping address, false otherwise.\r\n */\r\n getIsShippingAddress(): boolean {\r\n return this.isShippingAddress;\r\n }\r\n\r\n /**\r\n * Determines the type of the address based on its billing and shipping flags.\r\n * @returns The AddressType enum value representing the address's role.\r\n */\r\n getAddressType(): AddressType {\r\n if (this.isBillingAddress && this.isShippingAddress) {\r\n return AddressType.BILLING_AND_SHIPPING;\r\n } else if (this.isBillingAddress) {\r\n return AddressType.BILLING;\r\n } else if (this.isShippingAddress) {\r\n return AddressType.SHIPPING;\r\n } else {\r\n return AddressType.NONE;\r\n }\r\n }\r\n\r\n /**\r\n * Static method to check if a given AddressType includes shipping.\r\n * @param addressType - The address type to check.\r\n * @returns True if the type is SHIPPING or BILLING_AND_SHIPPING.\r\n */\r\n static checkIfShippingAddress(addressType: AddressType): boolean {\r\n return addressType === AddressType.SHIPPING || addressType === AddressType.BILLING_AND_SHIPPING;\r\n }\r\n\r\n /**\r\n * Static method to check if a given AddressType includes billing.\r\n * @param addressType - The address type to check.\r\n * @returns True if the type is BILLING or BILLING_AND_SHIPPING.\r\n */\r\n static checkIfBillingAddress(addressType: AddressType): boolean {\r\n return addressType === AddressType.BILLING || addressType === AddressType.BILLING_AND_SHIPPING;\r\n }\r\n}","import AddressModel, { AddressData } from \"./Address\";\r\nimport BaseModel, { BaseAttributes } from \"./Base\";\r\n\r\nexport type CustomerAddressAttributes = BaseAttributes & {\r\n id: string;\r\n addresses: { [key: string]: AddressData };\r\n defaultBillingAddressId?: string;\r\n defaultShippingAddressId?: string;\r\n}\r\n\r\ntype CustomerAddressWithoutDefaultAddress = Omit<CustomerAddressAttributes, 'defaultBillingAddressId' | 'defaultShippingAddressId'> & {\r\n defaultBillingAddressId: string | null;\r\n defaultShippingAddressId: string | null;\r\n};\r\nexport type CustomerAddressDataWithOutId = Required<Omit<CustomerAddressWithoutDefaultAddress, 'id'>>;\r\nexport type CustomerAddressData = Required<CustomerAddressWithoutDefaultAddress>;\r\n\r\n\r\nexport default class CustomerAddressModel extends BaseModel {\r\n protected id: string;\r\n protected addresses: { [key: string]: AddressModel };\r\n protected defaultBillingAddressId: string | null;\r\n protected defaultShippingAddressId: string | null;\r\n\r\n /**\r\n * Creates an instance of CustomerAddressModel.\r\n * Initializes the address list, sorting them by modification date (most recent first).\r\n * @param data - The initial attributes for the customer's addresses.\r\n * @param date - Optional date object for setting creation/modification times (defaults to now).\r\n */\r\n constructor(data: CustomerAddressAttributes, date: Date = new Date()) {\r\n super(data, date);\r\n this.id = data.id;\r\n this.addresses = { }\r\n \r\n Object.keys(data.addresses)\r\n .map((addressId: string) => this.addresses[addressId] = new AddressModel(data.addresses[addressId], date));\r\n\r\n this.defaultBillingAddressId = data.defaultBillingAddressId ?? null;\r\n this.defaultShippingAddressId = data.defaultShippingAddressId ?? null;\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the customer's addresses.\r\n * Can optionally exclude the customer address collection ID. Includes base model details.\r\n * @param withId - If true, includes the 'id' field of the CustomerAddressModel. Defaults to false.\r\n * @returns CustomerAddressData or CustomerAddressDataWithOutId object suitable for serialization.\r\n */\r\n getDetails(withId?: false): CustomerAddressDataWithOutId;\r\n getDetails(withId: true): CustomerAddressData;\r\n getDetails(withId: boolean = false): CustomerAddressData | CustomerAddressDataWithOutId {\r\n return {\r\n ...(withId ? { id: this.getId() } : {}),\r\n addresses: this.getAddresses().reduce((acc, address) => {\r\n acc[address.getId()] = address.getDetails();\r\n return acc;\r\n }, {} as Record<string, AddressData>),\r\n defaultBillingAddressId: this.getDefaultBillingAddressId(),\r\n defaultShippingAddressId: this.getDefaultShippingAddressId(),\r\n ...super.getDetails()\r\n }\r\n }\r\n \r\n getId(): string {\r\n return this.id;\r\n }\r\n\r\n /**\r\n * Gets the list of all associated address models, sorted by creation date (most recent first).\r\n * @returns An array of AddressModel instances.\r\n */\r\n getAddresses(): AddressModel[] {\r\n return Object.values(this.addresses)\r\n .sort((a, b) => b.getCreatedAtTime() - a.getCreatedAtTime());;\r\n }\r\n\r\n /**\r\n * Gets a filtered list of addresses designated as shipping addresses.\r\n * @returns An array of AddressModel instances marked as shipping addresses.\r\n */\r\n getShippingAddresses(): AddressModel[] {\r\n return this.getAddresses().filter((address) => address.getIsShippingAddress());\r\n }\r\n\r\n /**\r\n * Gets a filtered list of addresses designated as billing addresses.\r\n * @returns An array of AddressModel instances marked as billing addresses.\r\n */\r\n getBillingAddresses(): AddressModel[] {\r\n return this.getAddresses().filter((address) => address.getIsBillingAddress());\r\n }\r\n\r\n /**\r\n * Gets the ID of the default billing address.\r\n * If the stored default ID is invalid or doesn't correspond to a billing address,\r\n * it falls back to the most recently modified billing address.\r\n * @returns The ID of the default billing address, or null if no valid billing address exists.\r\n */\r\n getDefaultBillingAddressId(): string | null {\r\n const explicitDefault = this.getAddresses().find(\r\n (address) => address.getId() === this.defaultBillingAddressId && address.getIsBillingAddress()\r\n );\r\n if (explicitDefault) {\r\n return explicitDefault.getId();\r\n }\r\n // Fallback: Find the first address marked as billing (already sorted by most recent)\r\n return this.getAddresses().find((address) => address.getIsBillingAddress())?.getId() || null;\r\n }\r\n\r\n /**\r\n * Gets the ID of the default shipping address.\r\n * If the stored default ID is invalid or doesn't correspond to a shipping address,\r\n * it falls back to the most recently modified shipping address.\r\n * @returns The ID of the default shipping address, or null if no valid shipping address exists.\r\n */\r\n getDefaultShippingAddressId(): string | null {\r\n // Check if the explicitly set default exists, is valid, and is a shipping address\r\n const explicitDefault = this.getAddresses().find(\r\n (address) => address.getId() === this.defaultShippingAddressId && address.getIsShippingAddress()\r\n );\r\n if (explicitDefault) {\r\n return explicitDefault.getId();\r\n }\r\n // Fallback: Find the first address marked as shipping (already sorted by most recent)\r\n return this.getAddresses().find((address) => address.getIsShippingAddress())?.getId() || null;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Classes/Base.ts","../../src/Classes/Address.ts","../../src/Classes/CustomerAddress.ts"],"names":["BaseModel","data","date","id","authType","requestId","lambdaName","fieldName","value","AddressModel","addressType","CustomerAddressModel","addressId","withId","acc","address","a","b","explicitDefault"],"mappings":"aA4BA,IAAqBA,EAArB,KAA+B,CACnB,aACA,OACA,CAAA,SAAA,CACA,WACA,UAQV,CAAA,WAAA,CAAYC,CAAsBC,CAAAA,CAAAA,CAAa,IAAI,IAAQ,CAAA,CACzD,KAAK,YAAe,CAAA,CAAE,GAAGD,CAAK,CAAA,YAAa,CAC3C,CAAA,IAAA,CAAK,QAAUA,CAAK,CAAA,OAAA,EAAW,EAC/B,IAAK,CAAA,SAAA,CAAYA,EAAK,SAAa,EAAA,CAAC,KAAM,CAAA,IAAA,CAAK,MAAMA,CAAK,CAAA,SAAS,CAAC,CAElE,CAAA,IAAI,KAAKA,CAAK,CAAA,SAAS,CAAE,CAAA,WAAA,GAEzBC,CAAK,CAAA,WAAA,GACP,IAAK,CAAA,UAAA,CAAaD,EAAK,UAAc,EAAA,CAAC,KAAM,CAAA,IAAA,CAAK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,GAAqBD,CAAE,CAAA,gBAAA,EAAkB,CAC/D,CAMA,sBAAuC,CACrC,OAAO,KAAK,YAAa,EAAA,CAAE,OAAQD,CAAYA,EAAAA,CAAAA,CAAQ,oBAAqB,EAAC,CAC/E,CAMA,mBAAA,EAAsC,CACpC,OAAO,IAAA,CAAK,cAAe,CAAA,MAAA,CAAQA,CAAYA,EAAAA,CAAAA,CAAQ,qBAAqB,CAC9E,CAQA,0BAA4C,EAAA,CAC1C,IAAMG,CAAkB,CAAA,IAAA,CAAK,YAAa,EAAA,CAAE,KACzCH,CAAYA,EAAAA,CAAAA,CAAQ,OAAY,GAAA,IAAA,CAAK,yBAA2BA,CAAQ,CAAA,mBAAA,EAC3E,CACA,CAAA,OAAIG,EACKA,CAAgB,CAAA,KAAA,GAGlB,IAAK,CAAA,YAAA,GAAe,IAAMH,CAAAA,CAAAA,EAAYA,CAAQ,CAAA,mBAAA,EAAqB,CAAG,EAAA,KAAA,IAAW,IAC1F,CAQA,6BAA6C,CAE3C,IAAMG,CAAkB,CAAA,IAAA,CAAK,cAAe,CAAA,IAAA,CACzCH,GAAYA,CAAQ,CAAA,KAAA,KAAY,IAAK,CAAA,wBAAA,EAA4BA,CAAQ,CAAA,oBAAA,EAC5E,CACA,CAAA,OAAIG,EACKA,CAAgB,CAAA,KAAA,GAGlB,IAAK,CAAA,YAAA,GAAe,IAAMH,CAAAA,CAAAA,EAAYA,EAAQ,oBAAqB,EAAC,GAAG,KAAM,EAAA,EAAK,IAC3F,CACF","file":"CustomerAddress.js","sourcesContent":["import { AuthType } from \"../Auth\";\r\nimport { ISODateTimeUTC } from \"./Common\";\r\n\r\nexport interface CustomFields {\r\n [key: string]: any;\r\n}\r\n\r\nexport type ModifiedBy = {\r\n id?: string;\r\n authType?: string;\r\n requestId?: string;\r\n lambdaName?: string;\r\n}\r\n\r\nexport type BaseAttributes = {\r\n customFields?: CustomFields;\r\n version?: number;\r\n createdAt?: ISODateTimeUTC;\r\n modifiedAt?: ISODateTimeUTC;\r\n modifiedBy?: ModifiedBy;\r\n};\r\n\r\nexport type BaseData = Required<BaseAttributes>;\r\n\r\n/**\r\n * Provides common foundational properties and methods for other data models.\r\n * Handles tracking of custom fields, versioning, and timestamps.\r\n */\r\nexport default class BaseModel {\r\n protected customFields: CustomFields;\r\n protected version: number;\r\n protected createdAt: ISODateTimeUTC;\r\n protected modifiedAt: ISODateTimeUTC;\r\n protected modifiedBy: ModifiedBy;\r\n\r\n /**\r\n * Creates an instance of BaseModel.\r\n * Initializes common properties like timestamps, version, and custom fields.\r\n * @param data - Optional initial attributes for the base model.\r\n * @param date - Optional date object to use for default timestamps (defaults to current time).\r\n */\r\n constructor(data: BaseAttributes, date: Date = new Date()) {\r\n this.customFields = { ...data.customFields };\r\n this.version = data.version ?? 1;\r\n this.createdAt = data.createdAt && !isNaN(Date.parse(data.createdAt))\r\n ?\r\n new Date(data.createdAt).toISOString()\r\n :\r\n date.toISOString();\r\n this.modifiedAt = data.modifiedAt && !isNaN(Date.parse(data.modifiedAt))\r\n ? new Date(data.modifiedAt).toISOString()\r\n : date.toISOString();\r\n\r\n this.modifiedBy = { ...data.modifiedBy };\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the base model's current state.\r\n * @returns BaseData object containing common properties.\r\n */\r\n getDetails(): BaseData {\r\n return {\r\n customFields: this.getAllCustomFields(), // Use getter to return a copy\r\n version: this.getVersion(),\r\n createdAt: this.getCreatedAt(),\r\n modifiedAt: this.getModifiedAt(),\r\n modifiedBy: this.getModifiedBy(),\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current version number of the model instance.\r\n * @returns The version number.\r\n */\r\n getVersion(): number {\r\n return this.version;\r\n }\r\n\r\n /**\r\n * Gets the creation timestamp as an ISO 8601 string.\r\n * @returns The creation timestamp string.\r\n */\r\n getCreatedAt(): string {\r\n return this.createdAt;\r\n }\r\n\r\n /**\r\n * Gets the creation timestamp as a Unix epoch time (milliseconds).\r\n * @returns The creation time in milliseconds since the epoch.\r\n */\r\n getCreatedAtTime(): number {\r\n return new Date(this.createdAt).getTime();\r\n }\r\n\r\n\r\n /**\r\n * Gets the last modification timestamp as an ISO 8601 string.\r\n * @returns The last modification timestamp string.\r\n */\r\n getModifiedAt(): string {\r\n return this.modifiedAt;\r\n }\r\n\r\n /**\r\n * Gets the last modification timestamp as a Unix epoch time (milliseconds).\r\n * @returns The last modification time in milliseconds since the epoch.\r\n */\r\n getModifiedAtTime(): number {\r\n return new Date(this.modifiedAt).getTime();\r\n }\r\n\r\n /**\r\n * Gets the identifier of the user or process that last modified the instance.\r\n * @returns\r\n */\r\n getModifiedBy(): ModifiedBy {\r\n return { ...this.modifiedBy };\r\n }\r\n\r\n /**\r\n * Sets the identifier of the user or process that last modified the instance.\r\n * @param modifiedBy - The identifier string.\r\n */\r\n setModifiedBy(id?: string, authType?: AuthType, requestId?: string, lambdaName?: string): void {\r\n this.modifiedBy = {\r\n id,\r\n authType,\r\n requestId,\r\n lambdaName,\r\n };\r\n }\r\n\r\n /**\r\n * Retrieves the value of a specific custom field.\r\n * @param fieldName - The name (key) of the custom field to retrieve.\r\n * @returns The value of the custom field, or null if the field does not exist.\r\n */\r\n getCustomField(fieldName: string): any {\r\n return this.customFields[fieldName] ?? null;\r\n }\r\n\r\n /**\r\n * Sets the value of a specific custom field.\r\n * Also updates the modification timestamp and increments the version.\r\n * @param fieldName - The name (key) of the custom field to set.\r\n * @param value - The value to assign to the custom field.\r\n */\r\n setCustomField(fieldName: string, value: any): void {\r\n this.customFields[fieldName] = value;\r\n }\r\n\r\n /**\r\n * Retrieves a shallow copy of all custom fields associated with the instance.\r\n * @returns An object containing all custom fields.\r\n */\r\n getAllCustomFields(): CustomFields {\r\n return { ...this.customFields };\r\n }\r\n}\r\n","import BaseModel, { BaseAttributes } from \"./Base\";\r\n\r\nexport enum AddressType {\r\n BILLING = \"billing\",\r\n SHIPPING = \"shipping\",\r\n BILLING_AND_SHIPPING = \"billing&shipping\",\r\n NONE = \"none\",\r\n}\r\n\r\nexport type AddressAttributes = BaseAttributes & {\r\n id: string;\r\n firstName: string;\r\n lastName?: string;\r\n company?: string;\r\n phone: string;\r\n email: string;\r\n addressLine1: string;\r\n addressLine2?: string;\r\n city: string;\r\n postalCode: string\r\n state: string;\r\n country: string;\r\n isBillingAddress: boolean;\r\n isShippingAddress: boolean;\r\n};\r\n\r\nexport type AddressData = Required<AddressAttributes>;\r\n\r\n/**\r\n * Represents a physical address associated with a customer or order.\r\n * Handles both billing and shipping address types.\r\n */\r\nexport default class AddressModel extends BaseModel {\r\n protected id: string;\r\n protected firstName: string;\r\n protected lastName: string;\r\n protected company: string;\r\n protected phone: string;\r\n protected email: string;\r\n protected addressLine1: string;\r\n protected addressLine2: string;\r\n protected city: string;\r\n protected postalCode: string\r\n protected state: string;\r\n protected country: string;\r\n protected isBillingAddress: boolean;\r\n protected isShippingAddress: boolean;\r\n\r\n /**\r\n * Creates an instance of AddressModel.\r\n * @param data - The initial address attributes.\r\n * @param date - Optional date for setting creation/modification times (defaults to now).\r\n */\r\n constructor(data: AddressAttributes, date: Date = new Date()) {\r\n super(data, date);\r\n this.id = data.id;\r\n this.firstName = data.firstName;\r\n this.lastName = data.lastName || '';\r\n this.company = data.company || '';\r\n this.phone = data.phone;\r\n this.email = data.email;\r\n this.addressLine1 = data.addressLine1;\r\n this.addressLine2 = data.addressLine2 || '';\r\n this.city = data.city;\r\n this.postalCode = data.postalCode;\r\n this.state = data.state;\r\n this.country = data.country;\r\n this.isBillingAddress = data.isBillingAddress;\r\n this.isShippingAddress = data.isShippingAddress;\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the address's current state.\r\n * Includes all address fields and base model fields.\r\n * @returns AddressData object suitable for serialization or API responses.\r\n */\r\n getDetails(): AddressData {\r\n return {\r\n ...super.getDetails(),\r\n id: this.getId(),\r\n firstName: this.getFirstName(),\r\n lastName: this.getLastName(),\r\n company: this.getCompany(),\r\n phone: this.getPhone(),\r\n email: this.getEmail(),\r\n addressLine1: this.getAddressLine1(),\r\n addressLine2: this.getAddressLine2(),\r\n city: this.getCity(),\r\n postalCode: this.getPostalCode(),\r\n state: this.getState(),\r\n country: this.getCountry(),\r\n isBillingAddress: this.getIsBillingAddress(),\r\n isShippingAddress: this.getIsShippingAddress(),\r\n }\r\n }\r\n\r\n /**\r\n * Gets the unique identifier for the address.\r\n * @returns The address ID.\r\n */\r\n getId(): string {\r\n return this.id;\r\n }\r\n\r\n /**\r\n * Gets the first name associated with the address.\r\n * @returns The first name.\r\n */\r\n getFirstName(): string {\r\n return this.firstName;\r\n }\r\n\r\n /**\r\n * Gets the last name associated with the address.\r\n * @returns The last name.\r\n */\r\n getLastName(): string {\r\n return this.lastName;\r\n }\r\n\r\n /**\r\n * Gets the company name associated with the address.\r\n * @returns The company name.\r\n */\r\n getCompany(): string {\r\n return this.company;\r\n }\r\n\r\n /**\r\n * Gets the phone number associated with the address.\r\n * @returns The phone number.\r\n */\r\n getPhone(): string {\r\n return this.phone;\r\n }\r\n\r\n /**\r\n * Gets the email address associated with the address.\r\n * @returns The email address.\r\n */\r\n getEmail(): string {\r\n return this.email;\r\n }\r\n\r\n /**\r\n * Gets the primary address line (e.g., street address).\r\n * @returns The first address line.\r\n */\r\n getAddressLine1(): string {\r\n return this.addressLine1;\r\n }\r\n\r\n /**\r\n * Gets the secondary address line (e.g., apartment, suite).\r\n * Returns an empty string if not provided.\r\n * @returns The second address line or an empty string.\r\n */\r\n getAddressLine2(): string {\r\n return this.addressLine2;\r\n }\r\n\r\n /**\r\n * Gets the city name.\r\n * @returns The city.\r\n */\r\n getCity(): string {\r\n return this.city;\r\n }\r\n\r\n /**\r\n * Gets the postal code (e.g., ZIP code).\r\n * @returns The postal code.\r\n */\r\n getPostalCode(): string {\r\n return this.postalCode;\r\n }\r\n\r\n /**\r\n * Gets the state, province, or region.\r\n * @returns The state.\r\n */\r\n getState(): string {\r\n return this.state;\r\n }\r\n\r\n /**\r\n * Gets the country name or code.\r\n * @returns The country.\r\n */\r\n getCountry(): string {\r\n return this.country;\r\n }\r\n\r\n /**\r\n * Checks if this address is designated as a billing address.\r\n * @returns True if it's a billing address, false otherwise.\r\n */\r\n getIsBillingAddress(): boolean {\r\n return this.isBillingAddress;\r\n }\r\n\r\n /**\r\n * Checks if this address is designated as a shipping address.\r\n * @returns True if it's a shipping address, false otherwise.\r\n */\r\n getIsShippingAddress(): boolean {\r\n return this.isShippingAddress;\r\n }\r\n\r\n /**\r\n * Determines the type of the address based on its billing and shipping flags.\r\n * @returns The AddressType enum value representing the address's role.\r\n */\r\n getAddressType(): AddressType {\r\n if (this.isBillingAddress && this.isShippingAddress) {\r\n return AddressType.BILLING_AND_SHIPPING;\r\n } else if (this.isBillingAddress) {\r\n return AddressType.BILLING;\r\n } else if (this.isShippingAddress) {\r\n return AddressType.SHIPPING;\r\n } else {\r\n return AddressType.NONE;\r\n }\r\n }\r\n\r\n /**\r\n * Static method to check if a given AddressType includes shipping.\r\n * @param addressType - The address type to check.\r\n * @returns True if the type is SHIPPING or BILLING_AND_SHIPPING.\r\n */\r\n static checkIfShippingAddress(addressType: AddressType): boolean {\r\n return addressType === AddressType.SHIPPING || addressType === AddressType.BILLING_AND_SHIPPING;\r\n }\r\n\r\n /**\r\n * Static method to check if a given AddressType includes billing.\r\n * @param addressType - The address type to check.\r\n * @returns True if the type is BILLING or BILLING_AND_SHIPPING.\r\n */\r\n static checkIfBillingAddress(addressType: AddressType): boolean {\r\n return addressType === AddressType.BILLING || addressType === AddressType.BILLING_AND_SHIPPING;\r\n }\r\n}","import AddressModel, { AddressData } from \"./Address\";\r\nimport BaseModel, { BaseAttributes } from \"./Base\";\r\n\r\nexport type CustomerAddressAttributes = BaseAttributes & {\r\n id: string;\r\n addresses: { [key: string]: AddressData };\r\n defaultBillingAddressId?: string;\r\n defaultShippingAddressId?: string;\r\n}\r\n\r\ntype CustomerAddressWithoutDefaultAddress = Omit<CustomerAddressAttributes, 'defaultBillingAddressId' | 'defaultShippingAddressId'> & {\r\n defaultBillingAddressId: string | null;\r\n defaultShippingAddressId: string | null;\r\n};\r\nexport type CustomerAddressDataWithOutId = Required<Omit<CustomerAddressWithoutDefaultAddress, 'id'>>;\r\nexport type CustomerAddressData = Required<CustomerAddressWithoutDefaultAddress>;\r\n\r\n\r\nexport default class CustomerAddressModel extends BaseModel {\r\n protected id: string;\r\n protected addresses: { [key: string]: AddressModel };\r\n protected defaultBillingAddressId: string | null;\r\n protected defaultShippingAddressId: string | null;\r\n\r\n /**\r\n * Creates an instance of CustomerAddressModel.\r\n * Initializes the address list, sorting them by modification date (most recent first).\r\n * @param data - The initial attributes for the customer's addresses.\r\n * @param date - Optional date object for setting creation/modification times (defaults to now).\r\n */\r\n constructor(data: CustomerAddressAttributes, date: Date = new Date()) {\r\n super(data, date);\r\n this.id = data.id;\r\n this.addresses = { }\r\n \r\n Object.keys(data.addresses)\r\n .map((addressId: string) => this.addresses[addressId] = new AddressModel(data.addresses[addressId], date));\r\n\r\n this.defaultBillingAddressId = data.defaultBillingAddressId ?? null;\r\n this.defaultShippingAddressId = data.defaultShippingAddressId ?? null;\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the customer's addresses.\r\n * Can optionally exclude the customer address collection ID. Includes base model details.\r\n * @param withId - If true, includes the 'id' field of the CustomerAddressModel. Defaults to false.\r\n * @returns CustomerAddressData or CustomerAddressDataWithOutId object suitable for serialization.\r\n */\r\n getDetails(withId?: false): CustomerAddressDataWithOutId;\r\n getDetails(withId: true): CustomerAddressData;\r\n getDetails(withId: boolean = false): CustomerAddressData | CustomerAddressDataWithOutId {\r\n return {\r\n ...(withId ? { id: this.getId() } : {}),\r\n addresses: this.getAddresses().reduce((acc, address) => {\r\n acc[address.getId()] = address.getDetails();\r\n return acc;\r\n }, {} as Record<string, AddressData>),\r\n defaultBillingAddressId: this.getDefaultBillingAddressId(),\r\n defaultShippingAddressId: this.getDefaultShippingAddressId(),\r\n ...super.getDetails()\r\n }\r\n }\r\n \r\n getId(): string {\r\n return this.id;\r\n }\r\n\r\n /**\r\n * Gets the list of all associated address models, sorted by creation date (most recent first).\r\n * @returns An array of AddressModel instances.\r\n */\r\n getAddresses(): AddressModel[] {\r\n return Object.values(this.addresses)\r\n .sort((a, b) => b.getCreatedAtTime() - a.getCreatedAtTime());;\r\n }\r\n\r\n /**\r\n * Gets a filtered list of addresses designated as shipping addresses.\r\n * @returns An array of AddressModel instances marked as shipping addresses.\r\n */\r\n getShippingAddresses(): AddressModel[] {\r\n return this.getAddresses().filter((address) => address.getIsShippingAddress());\r\n }\r\n\r\n /**\r\n * Gets a filtered list of addresses designated as billing addresses.\r\n * @returns An array of AddressModel instances marked as billing addresses.\r\n */\r\n getBillingAddresses(): AddressModel[] {\r\n return this.getAddresses().filter((address) => address.getIsBillingAddress());\r\n }\r\n\r\n /**\r\n * Gets the ID of the default billing address.\r\n * If the stored default ID is invalid or doesn't correspond to a billing address,\r\n * it falls back to the most recently modified billing address.\r\n * @returns The ID of the default billing address, or null if no valid billing address exists.\r\n */\r\n getDefaultBillingAddressId(): string | null {\r\n const explicitDefault = this.getAddresses().find(\r\n (address) => address.getId() === this.defaultBillingAddressId && address.getIsBillingAddress()\r\n );\r\n if (explicitDefault) {\r\n return explicitDefault.getId();\r\n }\r\n // Fallback: Find the first address marked as billing (already sorted by most recent)\r\n return this.getAddresses().find((address) => address.getIsBillingAddress())?.getId() || null;\r\n }\r\n\r\n /**\r\n * Gets the ID of the default shipping address.\r\n * If the stored default ID is invalid or doesn't correspond to a shipping address,\r\n * it falls back to the most recently modified shipping address.\r\n * @returns The ID of the default shipping address, or null if no valid shipping address exists.\r\n */\r\n getDefaultShippingAddressId(): string | null {\r\n // Check if the explicitly set default exists, is valid, and is a shipping address\r\n const explicitDefault = this.getAddresses().find(\r\n (address) => address.getId() === this.defaultShippingAddressId && address.getIsShippingAddress()\r\n );\r\n if (explicitDefault) {\r\n return explicitDefault.getId();\r\n }\r\n // Fallback: Find the first address marked as shipping (already sorted by most recent)\r\n return this.getAddresses().find((address) => address.getIsShippingAddress())?.getId() || null;\r\n }\r\n}\r\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b}from'../chunk-
|
|
1
|
+
import {b}from'../chunk-5KD2EW7O.mjs';import {a}from'../chunk-55SOBG62.mjs';var t=class extends a{id;addresses;defaultBillingAddressId;defaultShippingAddressId;constructor(e,s=new Date){super(e,s),this.id=e.id,this.addresses={},Object.keys(e.addresses).map(d=>this.addresses[d]=new b(e.addresses[d],s)),this.defaultBillingAddressId=e.defaultBillingAddressId??null,this.defaultShippingAddressId=e.defaultShippingAddressId??null;}getDetails(e=!1){return {...e?{id:this.getId()}:{},addresses:this.getAddresses().reduce((s,d)=>(s[d.getId()]=d.getDetails(),s),{}),defaultBillingAddressId:this.getDefaultBillingAddressId(),defaultShippingAddressId:this.getDefaultShippingAddressId(),...super.getDetails()}}getId(){return this.id}getAddresses(){return Object.values(this.addresses).sort((e,s)=>s.getCreatedAtTime()-e.getCreatedAtTime())}getShippingAddresses(){return this.getAddresses().filter(e=>e.getIsShippingAddress())}getBillingAddresses(){return this.getAddresses().filter(e=>e.getIsBillingAddress())}getDefaultBillingAddressId(){let e=this.getAddresses().find(s=>s.getId()===this.defaultBillingAddressId&&s.getIsBillingAddress());return e?e.getId():this.getAddresses().find(s=>s.getIsBillingAddress())?.getId()||null}getDefaultShippingAddressId(){let e=this.getAddresses().find(s=>s.getId()===this.defaultShippingAddressId&&s.getIsShippingAddress());return e?e.getId():this.getAddresses().find(s=>s.getIsShippingAddress())?.getId()||null}};export{t as default};//# sourceMappingURL=CustomerAddress.mjs.map
|
|
2
2
|
//# sourceMappingURL=CustomerAddress.mjs.map
|
package/dist/Classes/Enum.d.mts
CHANGED
|
@@ -26,6 +26,9 @@ declare const CountryCurrencyMap: {
|
|
|
26
26
|
declare const CurrencySymbolMap: {
|
|
27
27
|
INR: string;
|
|
28
28
|
};
|
|
29
|
+
declare const CurrencyLocaleMap: {
|
|
30
|
+
INR: OperationalLocale;
|
|
31
|
+
};
|
|
29
32
|
/**
|
|
30
33
|
* Defines standard gender categories for product targeting.
|
|
31
34
|
*/
|
|
@@ -35,7 +38,45 @@ declare enum GenderCategory {
|
|
|
35
38
|
UNISEX = "Unisex",
|
|
36
39
|
KIDS = "Kids",
|
|
37
40
|
BOY = "Boy",
|
|
38
|
-
GIRL = "Girl"
|
|
41
|
+
GIRL = "Girl",
|
|
42
|
+
GENERAL = "General"
|
|
43
|
+
}
|
|
44
|
+
declare enum ImageCategory {
|
|
45
|
+
PRIMARY = "PRIMARY",
|
|
46
|
+
GALLERY = "GALLERY"
|
|
47
|
+
}
|
|
48
|
+
declare enum TaxCategory {
|
|
49
|
+
APPAREL = "apparel",
|
|
50
|
+
EXEMPT = "exempt"
|
|
51
|
+
}
|
|
52
|
+
declare enum TaxSystem {
|
|
53
|
+
GST = "GST"
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* LineItemState
|
|
57
|
+
*
|
|
58
|
+
* INITIAL: Item added to order, not yet processed.
|
|
59
|
+
* PROCESSING: Item is being prepared for shipment.
|
|
60
|
+
* SHIPPED: Item dispatched to customer.
|
|
61
|
+
* DELIVERED: Item delivered to customer.
|
|
62
|
+
* CANCELLED: Item cancelled before shipment or delivery.
|
|
63
|
+
* RETURN_REQUESTED: Customer requests to return item.
|
|
64
|
+
* RETURNED: Item received back from customer.
|
|
65
|
+
* REFUND_INITIATED: Refund initiated for item.
|
|
66
|
+
* REFUNDED: Refund processed for item.
|
|
67
|
+
* ON_HOLD: Item is paused due to payment, inventory, or other issues.
|
|
68
|
+
*/
|
|
69
|
+
declare enum LineItemState {
|
|
70
|
+
INITIAL = "INITIAL",
|
|
71
|
+
PROCESSING = "PROCESSING",
|
|
72
|
+
SHIPPED = "SHIPPED",
|
|
73
|
+
DELIVERED = "DELIVERED",
|
|
74
|
+
CANCELLED = "CANCELLED",
|
|
75
|
+
RETURN_REQUESTED = "RETURN_REQUESTED",
|
|
76
|
+
RETURNED = "RETURNED",
|
|
77
|
+
REFUND_INITIATED = "REFUND_INITIATED",
|
|
78
|
+
REFUNDED = "REFUNDED",
|
|
79
|
+
ON_HOLD = "ON_HOLD"
|
|
39
80
|
}
|
|
40
81
|
|
|
41
|
-
export { CountryCurrencyMap, CurrencySymbolMap, GenderCategory, LocaleCountryMap, LocaleLanguageMap, OperationalCountry, OperationalCountryCurrency, OperationalLanguage, OperationalLocale };
|
|
82
|
+
export { CountryCurrencyMap, CurrencyLocaleMap, CurrencySymbolMap, GenderCategory, ImageCategory, LineItemState, LocaleCountryMap, LocaleLanguageMap, OperationalCountry, OperationalCountryCurrency, OperationalLanguage, OperationalLocale, TaxCategory, TaxSystem };
|
package/dist/Classes/Enum.d.ts
CHANGED
|
@@ -26,6 +26,9 @@ declare const CountryCurrencyMap: {
|
|
|
26
26
|
declare const CurrencySymbolMap: {
|
|
27
27
|
INR: string;
|
|
28
28
|
};
|
|
29
|
+
declare const CurrencyLocaleMap: {
|
|
30
|
+
INR: OperationalLocale;
|
|
31
|
+
};
|
|
29
32
|
/**
|
|
30
33
|
* Defines standard gender categories for product targeting.
|
|
31
34
|
*/
|
|
@@ -35,7 +38,45 @@ declare enum GenderCategory {
|
|
|
35
38
|
UNISEX = "Unisex",
|
|
36
39
|
KIDS = "Kids",
|
|
37
40
|
BOY = "Boy",
|
|
38
|
-
GIRL = "Girl"
|
|
41
|
+
GIRL = "Girl",
|
|
42
|
+
GENERAL = "General"
|
|
43
|
+
}
|
|
44
|
+
declare enum ImageCategory {
|
|
45
|
+
PRIMARY = "PRIMARY",
|
|
46
|
+
GALLERY = "GALLERY"
|
|
47
|
+
}
|
|
48
|
+
declare enum TaxCategory {
|
|
49
|
+
APPAREL = "apparel",
|
|
50
|
+
EXEMPT = "exempt"
|
|
51
|
+
}
|
|
52
|
+
declare enum TaxSystem {
|
|
53
|
+
GST = "GST"
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* LineItemState
|
|
57
|
+
*
|
|
58
|
+
* INITIAL: Item added to order, not yet processed.
|
|
59
|
+
* PROCESSING: Item is being prepared for shipment.
|
|
60
|
+
* SHIPPED: Item dispatched to customer.
|
|
61
|
+
* DELIVERED: Item delivered to customer.
|
|
62
|
+
* CANCELLED: Item cancelled before shipment or delivery.
|
|
63
|
+
* RETURN_REQUESTED: Customer requests to return item.
|
|
64
|
+
* RETURNED: Item received back from customer.
|
|
65
|
+
* REFUND_INITIATED: Refund initiated for item.
|
|
66
|
+
* REFUNDED: Refund processed for item.
|
|
67
|
+
* ON_HOLD: Item is paused due to payment, inventory, or other issues.
|
|
68
|
+
*/
|
|
69
|
+
declare enum LineItemState {
|
|
70
|
+
INITIAL = "INITIAL",
|
|
71
|
+
PROCESSING = "PROCESSING",
|
|
72
|
+
SHIPPED = "SHIPPED",
|
|
73
|
+
DELIVERED = "DELIVERED",
|
|
74
|
+
CANCELLED = "CANCELLED",
|
|
75
|
+
RETURN_REQUESTED = "RETURN_REQUESTED",
|
|
76
|
+
RETURNED = "RETURNED",
|
|
77
|
+
REFUND_INITIATED = "REFUND_INITIATED",
|
|
78
|
+
REFUNDED = "REFUNDED",
|
|
79
|
+
ON_HOLD = "ON_HOLD"
|
|
39
80
|
}
|
|
40
81
|
|
|
41
|
-
export { CountryCurrencyMap, CurrencySymbolMap, GenderCategory, LocaleCountryMap, LocaleLanguageMap, OperationalCountry, OperationalCountryCurrency, OperationalLanguage, OperationalLocale };
|
|
82
|
+
export { CountryCurrencyMap, CurrencyLocaleMap, CurrencySymbolMap, GenderCategory, ImageCategory, LineItemState, LocaleCountryMap, LocaleLanguageMap, OperationalCountry, OperationalCountryCurrency, OperationalLanguage, OperationalLocale, TaxCategory, TaxSystem };
|
package/dist/Classes/Enum.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var p=(o=>(o.IN="IN",o))(p||{}),
|
|
1
|
+
'use strict';var p=(o=>(o.IN="IN",o))(p||{}),I=(o=>(o.INR="INR",o))(I||{}),r=(R=>(R["en-IN"]="en-IN",R["kn-IN"]="kn-IN",R))(r||{}),l=(n=>(n.en="en",n.kn="kn",n))(l||{}),A={"en-IN":"en","kn-IN":"kn"},x={"en-IN":"IN","kn-IN":"IN"},T={IN:"INR"},U={INR:"\u20B9"},M={INR:"en-IN"},u=(N=>(N.MALE="Male",N.FEMALE="Female",N.UNISEX="Unisex",N.KIDS="Kids",N.BOY="Boy",N.GIRL="Girl",N.GENERAL="General",N))(u||{}),D=(n=>(n.PRIMARY="PRIMARY",n.GALLERY="GALLERY",n))(D||{}),c=(n=>(n.APPAREL="apparel",n.EXEMPT="exempt",n))(c||{}),L=(o=>(o.GST="GST",o))(L||{}),a=(E=>(E.INITIAL="INITIAL",E.PROCESSING="PROCESSING",E.SHIPPED="SHIPPED",E.DELIVERED="DELIVERED",E.CANCELLED="CANCELLED",E.RETURN_REQUESTED="RETURN_REQUESTED",E.RETURNED="RETURNED",E.REFUND_INITIATED="REFUND_INITIATED",E.REFUNDED="REFUNDED",E.ON_HOLD="ON_HOLD",E))(a||{});exports.CountryCurrencyMap=T;exports.CurrencyLocaleMap=M;exports.CurrencySymbolMap=U;exports.GenderCategory=u;exports.ImageCategory=D;exports.LineItemState=a;exports.LocaleCountryMap=x;exports.LocaleLanguageMap=A;exports.OperationalCountry=p;exports.OperationalCountryCurrency=I;exports.OperationalLanguage=l;exports.OperationalLocale=r;exports.TaxCategory=c;exports.TaxSystem=L;//# sourceMappingURL=Enum.js.map
|
|
2
2
|
//# sourceMappingURL=Enum.js.map
|
package/dist/Classes/Enum.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Classes/Enum.ts"],"names":["OperationalCountry","OperationalCountryCurrency","OperationalLocale","OperationalLanguage","LocaleLanguageMap","LocaleCountryMap","CountryCurrencyMap","CurrencySymbolMap","GenderCategory"],"mappings":"aAGO,IAAKA,CACGA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,EAAK,CAAA,IAAA,CADRA,
|
|
1
|
+
{"version":3,"sources":["../../src/Classes/Enum.ts"],"names":["OperationalCountry","OperationalCountryCurrency","OperationalLocale","OperationalLanguage","LocaleLanguageMap","LocaleCountryMap","CountryCurrencyMap","CurrencySymbolMap","CurrencyLocaleMap","GenderCategory","ImageCategory","TaxCategory","TaxSystem","LineItemState"],"mappings":"aAGO,IAAKA,CACGA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,EAAK,CAAA,IAAA,CADRA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAIAC,CACGA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,GAAM,CAAA,KAAA,CADTA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAIAC,OACGA,CAAA,CAAA,OAAA,CAAA,CAAU,OACCA,CAAAA,CAAAA,CAAA,OAAU,CAAA,CAAA,OAAA,CAFxBA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAKAC,OACVA,CAAA,CAAA,EAAA,CAAK,IACLA,CAAAA,CAAAA,CAAA,EAAK,CAAA,IAAA,CAFKA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAKCC,EAAoE,CAC9E,OAAA,CAA6B,IAC7B,CAAA,OAAA,CAA6B,IAChC,CAAA,CAEaC,CAAkE,CAAA,CAC3E,QAA6B,IAC9B,CAAA,OAAA,CAA6B,IAChC,CAAA,CAKaC,CAAqB,CAAA,CAClB,EAAwB,CAAA,KACxC,EAEaC,CAAoB,CAAA,CAC9B,GAAiC,CAAA,QACpC,CAEaC,CAAAA,CAAAA,CAAoB,CAC9B,GAAA,CAAiC,OACpC,CAKYC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAA,CAAA,IAAA,CAAO,MACPA,CAAAA,CAAAA,CAAA,MAAS,CAAA,QAAA,CACTA,EAAA,MAAS,CAAA,QAAA,CACTA,CAAA,CAAA,IAAA,CAAO,MACPA,CAAAA,CAAAA,CAAA,GAAM,CAAA,KAAA,CACNA,CAAA,CAAA,IAAA,CAAO,MACPA,CAAAA,CAAAA,CAAA,OAAU,CAAA,SAAA,CAPAA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAUAC,OACVA,CAAA,CAAA,OAAA,CAAU,SACVA,CAAAA,CAAAA,CAAA,OAAU,CAAA,SAAA,CAFAA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAKAC,OACVA,CAAA,CAAA,OAAA,CAAU,SACVA,CAAAA,CAAAA,CAAA,MAAS,CAAA,QAAA,CAFCA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAKAC,OACVA,CAAA,CAAA,GAAA,CAAM,KADIA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAkBAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAA,CAAA,OAAA,CAAU,UACVA,CAAA,CAAA,UAAA,CAAa,YACbA,CAAAA,CAAAA,CAAA,OAAU,CAAA,SAAA,CACVA,CAAA,CAAA,SAAA,CAAY,YACZA,CAAA,CAAA,SAAA,CAAY,WACZA,CAAAA,CAAAA,CAAA,gBAAmB,CAAA,kBAAA,CACnBA,CAAA,CAAA,QAAA,CAAW,WACXA,CAAA,CAAA,gBAAA,CAAmB,kBACnBA,CAAAA,CAAAA,CAAA,QAAW,CAAA,UAAA,CACXA,CAAA,CAAA,OAAA,CAAU,UAVAA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA","file":"Enum.js","sourcesContent":["/**\r\n * Represents the countries where the application operates or products are available.\r\n */\r\nexport enum OperationalCountry {\r\n /** India */ IN = 'IN',\r\n}\r\n \r\nexport enum OperationalCountryCurrency {\r\n /** India */ INR = 'INR',\r\n}\r\n\r\nexport enum OperationalLocale {\r\n /** India */ 'en-IN' = 'en-IN',\r\n /** India ( Kannada) */ 'kn-IN' = 'kn-IN'\r\n}\r\n\r\nexport enum OperationalLanguage {\r\n en = 'en',\r\n kn = 'kn'\r\n}\r\n\r\nexport const LocaleLanguageMap: Record<OperationalLocale, OperationalLanguage> = {\r\n [OperationalLocale[\"en-IN\"]]: OperationalLanguage.en,\r\n [OperationalLocale[\"kn-IN\"]]: OperationalLanguage.kn,\r\n}\r\n\r\nexport const LocaleCountryMap: Record<OperationalLocale, OperationalCountry> = {\r\n [OperationalLocale[\"en-IN\"]]: OperationalCountry.IN,\r\n [OperationalLocale[\"kn-IN\"]]: OperationalCountry.IN,\r\n}\r\n\r\n/**\r\n * Defines the supported ISO 4217 currency codes as an enumeration.\r\n */\r\nexport const CountryCurrencyMap = {\r\n /** India */ [OperationalCountry.IN]: OperationalCountryCurrency.INR,\r\n};\r\n\r\nexport const CurrencySymbolMap = {\r\n [OperationalCountryCurrency.INR]: '₹',\r\n}\r\n\r\nexport const CurrencyLocaleMap = {\r\n [OperationalCountryCurrency.INR]: OperationalLocale[\"en-IN\"],\r\n}\r\n\r\n/**\r\n * Defines standard gender categories for product targeting.\r\n */\r\nexport enum GenderCategory {\r\n MALE = 'Male',\r\n FEMALE = 'Female',\r\n UNISEX = 'Unisex',\r\n KIDS = 'Kids',\r\n BOY = 'Boy',\r\n GIRL = 'Girl',\r\n GENERAL = 'General',\r\n}\r\n\r\nexport enum ImageCategory {\r\n PRIMARY = 'PRIMARY',\r\n GALLERY = 'GALLERY'\r\n}\r\n\r\nexport enum TaxCategory {\r\n APPAREL = 'apparel',\r\n EXEMPT = 'exempt'\r\n}\r\n\r\nexport enum TaxSystem {\r\n GST = 'GST',\r\n}\r\n\r\n/**\r\n * LineItemState\r\n * \r\n * INITIAL: Item added to order, not yet processed.\r\n * PROCESSING: Item is being prepared for shipment.\r\n * SHIPPED: Item dispatched to customer.\r\n * DELIVERED: Item delivered to customer.\r\n * CANCELLED: Item cancelled before shipment or delivery.\r\n * RETURN_REQUESTED: Customer requests to return item.\r\n * RETURNED: Item received back from customer.\r\n * REFUND_INITIATED: Refund initiated for item.\r\n * REFUNDED: Refund processed for item.\r\n * ON_HOLD: Item is paused due to payment, inventory, or other issues.\r\n */\r\nexport enum LineItemState {\r\n INITIAL = \"INITIAL\",\r\n PROCESSING = \"PROCESSING\",\r\n SHIPPED = \"SHIPPED\",\r\n DELIVERED = \"DELIVERED\",\r\n CANCELLED = \"CANCELLED\",\r\n RETURN_REQUESTED = \"RETURN_REQUESTED\",\r\n RETURNED = \"RETURNED\",\r\n REFUND_INITIATED = \"REFUND_INITIATED\",\r\n REFUNDED = \"REFUNDED\",\r\n ON_HOLD = \"ON_HOLD\",\r\n}"]}
|
package/dist/Classes/Enum.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{g as CountryCurrencyMap,h as CurrencySymbolMap,
|
|
1
|
+
export{g as CountryCurrencyMap,i as CurrencyLocaleMap,h as CurrencySymbolMap,j as GenderCategory,k as ImageCategory,n as LineItemState,f as LocaleCountryMap,e as LocaleLanguageMap,a as OperationalCountry,b as OperationalCountryCurrency,d as OperationalLanguage,c as OperationalLocale,l as TaxCategory,m as TaxSystem}from'../chunk-72DR3HF2.mjs';//# sourceMappingURL=Enum.mjs.map
|
|
2
2
|
//# sourceMappingURL=Enum.mjs.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
declare class LineItemNotFoundError extends Error {
|
|
2
|
+
constructor(lineItemId: string);
|
|
3
|
+
}
|
|
4
|
+
declare class DuplicateSizeError extends Error {
|
|
5
|
+
constructor(size: string);
|
|
6
|
+
}
|
|
7
|
+
declare class ProductMismatchError extends Error {
|
|
8
|
+
constructor(message?: string);
|
|
9
|
+
}
|
|
10
|
+
declare class ProductInactiveError extends Error {
|
|
11
|
+
constructor(message?: string);
|
|
12
|
+
}
|
|
13
|
+
declare class SelectionAttributeParseError extends Error {
|
|
14
|
+
constructor(message?: string);
|
|
15
|
+
}
|
|
16
|
+
declare class SizeMismatchError extends Error {
|
|
17
|
+
constructor(message?: string);
|
|
18
|
+
}
|
|
19
|
+
declare class PricingNotFoundError extends Error {
|
|
20
|
+
constructor(message?: string);
|
|
21
|
+
}
|
|
22
|
+
declare class InvalidTaxRuleError extends Error {
|
|
23
|
+
constructor(message?: string);
|
|
24
|
+
}
|
|
25
|
+
declare class InvalidTaxCategoryError extends Error {
|
|
26
|
+
constructor(message?: string);
|
|
27
|
+
}
|
|
28
|
+
declare class InvalidMinQuantityError extends Error {
|
|
29
|
+
constructor(message?: string);
|
|
30
|
+
}
|
|
31
|
+
declare class InvalidTieredPriceError extends Error {
|
|
32
|
+
constructor(message: string);
|
|
33
|
+
}
|
|
34
|
+
declare class InvalidQuantityError extends Error {
|
|
35
|
+
constructor(message?: string);
|
|
36
|
+
}
|
|
37
|
+
declare class NoApplicableTierError extends Error {
|
|
38
|
+
constructor(quantity: number);
|
|
39
|
+
}
|
|
40
|
+
declare class TaxSlabNotFoundError extends Error {
|
|
41
|
+
constructor(message?: string);
|
|
42
|
+
}
|
|
43
|
+
declare class InvalidPriceAmountError extends Error {
|
|
44
|
+
constructor(message?: string);
|
|
45
|
+
}
|
|
46
|
+
declare class InvalidCurrencyCodeError extends Error {
|
|
47
|
+
constructor(message?: string);
|
|
48
|
+
}
|
|
49
|
+
declare class CurrencyMismatchError extends Error {
|
|
50
|
+
constructor(message?: string);
|
|
51
|
+
}
|
|
52
|
+
declare class InvalidArgumentError extends Error {
|
|
53
|
+
constructor(message: string);
|
|
54
|
+
}
|
|
55
|
+
declare class InvalidImageSourceError extends Error {
|
|
56
|
+
constructor(message?: string);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { CurrencyMismatchError, DuplicateSizeError, InvalidArgumentError, InvalidCurrencyCodeError, InvalidImageSourceError, InvalidMinQuantityError, InvalidPriceAmountError, InvalidQuantityError, InvalidTaxCategoryError, InvalidTaxRuleError, InvalidTieredPriceError, LineItemNotFoundError, NoApplicableTierError, PricingNotFoundError, ProductInactiveError, ProductMismatchError, SelectionAttributeParseError, SizeMismatchError, TaxSlabNotFoundError };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
declare class LineItemNotFoundError extends Error {
|
|
2
|
+
constructor(lineItemId: string);
|
|
3
|
+
}
|
|
4
|
+
declare class DuplicateSizeError extends Error {
|
|
5
|
+
constructor(size: string);
|
|
6
|
+
}
|
|
7
|
+
declare class ProductMismatchError extends Error {
|
|
8
|
+
constructor(message?: string);
|
|
9
|
+
}
|
|
10
|
+
declare class ProductInactiveError extends Error {
|
|
11
|
+
constructor(message?: string);
|
|
12
|
+
}
|
|
13
|
+
declare class SelectionAttributeParseError extends Error {
|
|
14
|
+
constructor(message?: string);
|
|
15
|
+
}
|
|
16
|
+
declare class SizeMismatchError extends Error {
|
|
17
|
+
constructor(message?: string);
|
|
18
|
+
}
|
|
19
|
+
declare class PricingNotFoundError extends Error {
|
|
20
|
+
constructor(message?: string);
|
|
21
|
+
}
|
|
22
|
+
declare class InvalidTaxRuleError extends Error {
|
|
23
|
+
constructor(message?: string);
|
|
24
|
+
}
|
|
25
|
+
declare class InvalidTaxCategoryError extends Error {
|
|
26
|
+
constructor(message?: string);
|
|
27
|
+
}
|
|
28
|
+
declare class InvalidMinQuantityError extends Error {
|
|
29
|
+
constructor(message?: string);
|
|
30
|
+
}
|
|
31
|
+
declare class InvalidTieredPriceError extends Error {
|
|
32
|
+
constructor(message: string);
|
|
33
|
+
}
|
|
34
|
+
declare class InvalidQuantityError extends Error {
|
|
35
|
+
constructor(message?: string);
|
|
36
|
+
}
|
|
37
|
+
declare class NoApplicableTierError extends Error {
|
|
38
|
+
constructor(quantity: number);
|
|
39
|
+
}
|
|
40
|
+
declare class TaxSlabNotFoundError extends Error {
|
|
41
|
+
constructor(message?: string);
|
|
42
|
+
}
|
|
43
|
+
declare class InvalidPriceAmountError extends Error {
|
|
44
|
+
constructor(message?: string);
|
|
45
|
+
}
|
|
46
|
+
declare class InvalidCurrencyCodeError extends Error {
|
|
47
|
+
constructor(message?: string);
|
|
48
|
+
}
|
|
49
|
+
declare class CurrencyMismatchError extends Error {
|
|
50
|
+
constructor(message?: string);
|
|
51
|
+
}
|
|
52
|
+
declare class InvalidArgumentError extends Error {
|
|
53
|
+
constructor(message: string);
|
|
54
|
+
}
|
|
55
|
+
declare class InvalidImageSourceError extends Error {
|
|
56
|
+
constructor(message?: string);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { CurrencyMismatchError, DuplicateSizeError, InvalidArgumentError, InvalidCurrencyCodeError, InvalidImageSourceError, InvalidMinQuantityError, InvalidPriceAmountError, InvalidQuantityError, InvalidTaxCategoryError, InvalidTaxRuleError, InvalidTieredPriceError, LineItemNotFoundError, NoApplicableTierError, PricingNotFoundError, ProductInactiveError, ProductMismatchError, SelectionAttributeParseError, SizeMismatchError, TaxSlabNotFoundError };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var e=class extends Error{constructor(r){super(`Line item with ID '${r}' not found in the cart.`),this.name="LineItemNotFoundError";}},s=class extends Error{constructor(r){super(`Duplicate size found: ${r}`),this.name="DuplicateSizeError";}},n=class extends Error{constructor(r="Product and selection attributes do not match."){super(`ProductMismatch: ${r}`),this.name="ProductMismatchError";}},o=class extends Error{constructor(r="Product is not active."){super(`ProductInactive: ${r}`),this.name="ProductInactiveError";}},i=class extends Error{constructor(r="Failed to parse selection attributes key."){super(`SelectionAttributeParseError: ${r}`),this.name="SelectionAttributeParseError";}},a=class extends Error{constructor(r="Size does not match."){super(`SizeMismatch: ${r}`),this.name="SizeMismatchError";}},c=class extends Error{constructor(r="Pricing details not available for the product"){super(`NotFound: ${r}`),this.name="PricingNotFoundError";}},u=class extends Error{constructor(r="Tax rule category mismatch."){super(`InvalidTaxRule: ${r}`),this.name="InvalidTaxRuleError";}},p=class extends Error{constructor(r="Tax category is not valid."){super(`InvalidTaxCategory: ${r}`),this.name="InvalidTaxCategoryError";}},d=class extends Error{constructor(r="Minimum quantity must be greater than zero."){super(`InvalidMinQuantity: ${r}`),this.name="InvalidMinQuantityError";}},l=class extends Error{constructor(r){super(`InvalidTieredPrice: ${r}`),this.name="InvalidTieredPriceError";}},m=class extends Error{constructor(r="Quantity must be greater than zero."){super(`InvalidQuantity: ${r}`),this.name="InvalidQuantityError";}},x=class extends Error{constructor(r){super(`NoApplicableTier: Quantity ${r} does not meet the minimum purchase requirement.`),this.name="NoApplicableTierError";}},h=class extends Error{constructor(r="No applicable tax slab or multiple slabs found for the given unit price."){super(`TaxSlabNotFound: ${r}`),this.name="TaxSlabNotFoundError";}},g=class extends Error{constructor(r="Amount cannot be negative."){super(`InvalidAmount: ${r}`),this.name="InvalidPriceAmountError";}},E=class extends Error{constructor(r="Currency code is required."){super(`InvalidCurrency: ${r}`),this.name="InvalidCurrencyCodeError";}},$=class extends Error{constructor(r="Cannot perform operation on prices with different currencies."){super(`CurrencyMismatch: ${r}`),this.name="CurrencyMismatchError";}},v=class extends Error{constructor(r){super(`InvalidArgument: ${r}`),this.name="InvalidArgumentError";}},b=class extends Error{constructor(r="Invalid image source configuration."){super(`InvalidImageSource: ${r}`),this.name="InvalidImageSourceError";}};exports.CurrencyMismatchError=$;exports.DuplicateSizeError=s;exports.InvalidArgumentError=v;exports.InvalidCurrencyCodeError=E;exports.InvalidImageSourceError=b;exports.InvalidMinQuantityError=d;exports.InvalidPriceAmountError=g;exports.InvalidQuantityError=m;exports.InvalidTaxCategoryError=p;exports.InvalidTaxRuleError=u;exports.InvalidTieredPriceError=l;exports.LineItemNotFoundError=e;exports.NoApplicableTierError=x;exports.PricingNotFoundError=c;exports.ProductInactiveError=o;exports.ProductMismatchError=n;exports.SelectionAttributeParseError=i;exports.SizeMismatchError=a;exports.TaxSlabNotFoundError=h;//# sourceMappingURL=Error.js.map
|
|
2
|
+
//# sourceMappingURL=Error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Classes/Error.ts"],"names":["LineItemNotFoundError","lineItemId","DuplicateSizeError","size","ProductMismatchError","message","ProductInactiveError","SelectionAttributeParseError","SizeMismatchError","PricingNotFoundError","InvalidTaxRuleError","InvalidTaxCategoryError","InvalidMinQuantityError","InvalidTieredPriceError","InvalidQuantityError","NoApplicableTierError","quantity","TaxSlabNotFoundError","InvalidPriceAmountError","InvalidCurrencyCodeError","CurrencyMismatchError","InvalidArgumentError","InvalidImageSourceError"],"mappings":"aAAO,IAAMA,EAAN,cAAoC,KAAM,CAC7C,WAAA,CAAYC,EAAoB,CAC5B,KAAA,CAAM,CAAsBA,mBAAAA,EAAAA,CAAU,0BAA0B,CAChE,CAAA,IAAA,CAAK,KAAO,wBAChB,CACJ,EAEaC,CAAN,CAAA,cAAiC,KAAM,CAC1C,YAAYC,CAAc,CAAA,CACtB,KAAM,CAAA,CAAA,sBAAA,EAAyBA,CAAI,CAAE,CAAA,CAAA,CACrC,IAAK,CAAA,IAAA,CAAO,qBAChB,CACJ,CAAA,CAEaC,EAAN,cAAmC,KAAM,CAC5C,WAAYC,CAAAA,CAAAA,CAAkB,gDAAkD,CAAA,CAC5E,MAAM,CAAoBA,iBAAAA,EAAAA,CAAO,CAAE,CAAA,CAAA,CACnC,KAAK,IAAO,CAAA,uBAChB,CACJ,CAAA,CAEaC,EAAN,cAAmC,KAAM,CAC5C,WAAYD,CAAAA,CAAAA,CAAkB,yBAA0B,CACpD,KAAA,CAAM,CAAoBA,iBAAAA,EAAAA,CAAO,EAAE,CACnC,CAAA,IAAA,CAAK,IAAO,CAAA,uBAChB,CACJ,CAEaE,CAAAA,CAAAA,CAAN,cAA2C,KAAM,CACpD,WAAYF,CAAAA,CAAAA,CAAkB,4CAA6C,CACvE,KAAA,CAAM,iCAAiCA,CAAO,CAAA,CAAE,CAChD,CAAA,IAAA,CAAK,KAAO,+BAChB,CACJ,CAEaG,CAAAA,CAAAA,CAAN,cAAgC,KAAM,CACzC,WAAYH,CAAAA,CAAAA,CAAkB,uBAAwB,CAClD,KAAA,CAAM,iBAAiBA,CAAO,CAAA,CAAE,EAChC,IAAK,CAAA,IAAA,CAAO,oBAChB,CACJ,EAEaI,CAAN,CAAA,cAAmC,KAAM,CAC5C,YAAYJ,CAAkB,CAAA,+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,CACtG,MAAM,CAAoBA,iBAAAA,EAAAA,CAAO,CAAE,CAAA,CAAA,CACnC,KAAK,IAAO,CAAA,uBAChB,CACJ,CAEaa,CAAAA,CAAAA,CAAN,cAAsC,KAAM,CAC/C,WAAYb,CAAAA,CAAAA,CAAkB,6BAA8B,CACxD,KAAA,CAAM,CAAkBA,eAAAA,EAAAA,CAAO,EAAE,CACjC,CAAA,IAAA,CAAK,IAAO,CAAA,0BAChB,CACJ,CAEac,CAAAA,CAAAA,CAAN,cAAuC,KAAM,CAChD,YAAYd,CAAkB,CAAA,4BAAA,CAA8B,CACxD,KAAA,CAAM,oBAAoBA,CAAO,CAAA,CAAE,CACnC,CAAA,IAAA,CAAK,KAAO,2BAChB,CACJ,CAEae,CAAAA,CAAAA,CAAN,cAAoC,KAAM,CAC7C,YAAYf,CAAkB,CAAA,+DAAA,CAAiE,CAC3F,KAAM,CAAA,CAAA,kBAAA,EAAqBA,CAAO,CAAA,CAAE,EACpC,IAAK,CAAA,IAAA,CAAO,wBAChB,CACJ,EAEagB,CAAN,CAAA,cAAmC,KAAM,CAC5C,YAAYhB,CAAiB,CAAA,CACzB,MAAM,CAAoBA,iBAAAA,EAAAA,CAAO,EAAE,CACnC,CAAA,IAAA,CAAK,IAAO,CAAA,uBAChB,CACJ,CAEaiB,CAAAA,CAAAA,CAAN,cAAsC,KAAM,CAC/C,YAAYjB,CAAkB,CAAA,qCAAA,CAAuC,CACjE,KAAA,CAAM,uBAAuBA,CAAO,CAAA,CAAE,EACtC,IAAK,CAAA,IAAA,CAAO,0BAChB,CACJ","file":"Error.js","sourcesContent":["export class LineItemNotFoundError extends Error {\r\n constructor(lineItemId: string) {\r\n super(`Line item with ID '${lineItemId}' not found in the cart.`);\r\n this.name = 'LineItemNotFoundError';\r\n }\r\n}\r\n\r\nexport class DuplicateSizeError extends Error {\r\n constructor(size: string) {\r\n super(`Duplicate size found: ${size}`);\r\n this.name = 'DuplicateSizeError';\r\n }\r\n}\r\n\r\nexport class ProductMismatchError extends Error {\r\n constructor(message: string = \"Product and selection attributes do not match.\") {\r\n super(`ProductMismatch: ${message}`);\r\n this.name = 'ProductMismatchError';\r\n }\r\n}\r\n\r\nexport class ProductInactiveError extends Error {\r\n constructor(message: string = \"Product is not active.\") {\r\n super(`ProductInactive: ${message}`);\r\n this.name = 'ProductInactiveError';\r\n }\r\n}\r\n\r\nexport class SelectionAttributeParseError extends Error {\r\n constructor(message: string = \"Failed to parse selection attributes key.\") {\r\n super(`SelectionAttributeParseError: ${message}`);\r\n this.name = 'SelectionAttributeParseError';\r\n }\r\n}\r\n\r\nexport class SizeMismatchError extends Error {\r\n constructor(message: string = \"Size does not match.\") {\r\n super(`SizeMismatch: ${message}`);\r\n this.name = 'SizeMismatchError';\r\n }\r\n}\r\n\r\nexport class PricingNotFoundError extends Error {\r\n constructor(message: string = \"Pricing details not available for the product\") {\r\n super(`NotFound: ${message}`);\r\n this.name = 'PricingNotFoundError';\r\n }\r\n}\r\n\r\nexport class InvalidTaxRuleError extends Error {\r\n constructor(message: string = \"Tax rule category mismatch.\") {\r\n super(`InvalidTaxRule: ${message}`);\r\n this.name = 'InvalidTaxRuleError';\r\n }\r\n}\r\n\r\nexport class InvalidTaxCategoryError extends Error {\r\n constructor(message: string = \"Tax category is not valid.\") {\r\n super(`InvalidTaxCategory: ${message}`);\r\n this.name = 'InvalidTaxCategoryError';\r\n }\r\n}\r\n\r\nexport class InvalidMinQuantityError extends Error {\r\n constructor(message: string = \"Minimum quantity must be greater than zero.\") {\r\n super(`InvalidMinQuantity: ${message}`);\r\n this.name = 'InvalidMinQuantityError';\r\n }\r\n}\r\n\r\nexport class InvalidTieredPriceError extends Error {\r\n constructor(message: string) {\r\n super(`InvalidTieredPrice: ${message}`);\r\n this.name = 'InvalidTieredPriceError';\r\n }\r\n}\r\n\r\nexport class InvalidQuantityError extends Error {\r\n constructor(message: string = \"Quantity must be greater than zero.\") {\r\n super(`InvalidQuantity: ${message}`);\r\n this.name = 'InvalidQuantityError';\r\n }\r\n}\r\n\r\nexport class NoApplicableTierError extends Error {\r\n constructor(quantity: number) {\r\n super(`NoApplicableTier: Quantity ${quantity} does not meet the minimum purchase requirement.`);\r\n this.name = 'NoApplicableTierError';\r\n }\r\n}\r\n\r\nexport class TaxSlabNotFoundError extends Error {\r\n constructor(message: string = \"No applicable tax slab or multiple slabs found for the given unit price.\") {\r\n super(`TaxSlabNotFound: ${message}`);\r\n this.name = 'TaxSlabNotFoundError';\r\n }\r\n}\r\n\r\nexport class InvalidPriceAmountError extends Error {\r\n constructor(message: string = \"Amount cannot be negative.\") {\r\n super(`InvalidAmount: ${message}`);\r\n this.name = 'InvalidPriceAmountError';\r\n }\r\n}\r\n\r\nexport class InvalidCurrencyCodeError extends Error {\r\n constructor(message: string = \"Currency code is required.\") {\r\n super(`InvalidCurrency: ${message}`);\r\n this.name = 'InvalidCurrencyCodeError';\r\n }\r\n}\r\n\r\nexport class CurrencyMismatchError extends Error {\r\n constructor(message: string = \"Cannot perform operation on prices with different currencies.\") {\r\n super(`CurrencyMismatch: ${message}`);\r\n this.name = 'CurrencyMismatchError';\r\n }\r\n}\r\n\r\nexport class InvalidArgumentError extends Error {\r\n constructor(message: string) {\r\n super(`InvalidArgument: ${message}`);\r\n this.name = 'InvalidArgumentError';\r\n }\r\n}\r\n\r\nexport class InvalidImageSourceError extends Error {\r\n constructor(message: string = \"Invalid image source configuration.\") {\r\n super(`InvalidImageSource: ${message}`);\r\n this.name = 'InvalidImageSourceError';\r\n }\r\n}"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{q as CurrencyMismatchError,b as DuplicateSizeError,r as InvalidArgumentError,p as InvalidCurrencyCodeError,s as InvalidImageSourceError,j as InvalidMinQuantityError,o as InvalidPriceAmountError,l as InvalidQuantityError,i as InvalidTaxCategoryError,h as InvalidTaxRuleError,k as InvalidTieredPriceError,a as LineItemNotFoundError,m as NoApplicableTierError,g as PricingNotFoundError,d as ProductInactiveError,c as ProductMismatchError,e as SelectionAttributeParseError,f as SizeMismatchError,n as TaxSlabNotFoundError}from'../chunk-NJKSUUOB.mjs';//# sourceMappingURL=Error.mjs.map
|
|
2
|
+
//# sourceMappingURL=Error.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"Error.mjs"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var t=class extends Error{constructor(r="Invalid image source configuration."){super(`InvalidImageSource: ${r}`),this.name="InvalidImageSourceError";}};var a=(e=>(e.THUMBNAIL="thumbnail",e.SMALL="small",e.MEDIUM="medium",e.LARGE="large",e.ORIGINAL="original",e))(a||{}),s=class{sources;alt;order;label;constructor(r){if(this.sources={...r.sources},this.alt=r.alt,this.order=r.order,this.label=r.label,!this.sources.original)throw new t("ImageInfoModel cannot be created without an 'original' source URL.")}getSources(){return {...this.sources}}getSource(r){return this.sources[r]||this.sources.original}getAlt(){return this.alt}getOrder(){return this.order}getLabel(){return this.label}setAlt(r){this.alt=r;}setOrder(r){this.order=r;}setLabel(r){this.label=r;}setSource(r,n){if(n===void 0){if(r==="original")throw new t("Cannot remove the 'original' image source.");delete this.sources[r];}else this.sources[r]=n;}getDetails(){return {sources:this.getSources(),alt:this.getAlt(),order:this.getOrder(),label:this.getLabel()}}};exports.ImageResolution=a;exports.default=s;//# sourceMappingURL=ImageInfo.js.map
|
|
2
2
|
//# sourceMappingURL=ImageInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Classes/ImageInfo.ts"],"names":["ImageResolution","ImageInfoModel","data","resolutionKey","altText","order","label","url"],"mappings":"sEAAO,IAAKA,OACVA,CAAA,CAAA,SAAA,CAAY,WACZA,CAAAA,CAAAA,CAAA,MAAQ,OACRA,CAAAA,CAAAA,CAAA,MAAS,CAAA,QAAA,CACTA,EAAA,KAA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C1B,OAAO,CACL,QAAS,IAAK,CAAA,UAAA,EACd,CAAA,GAAA,CAAK,KAAK,MAAO,EAAA,CACjB,KAAO,CAAA,IAAA,CAAK,UACZ,CAAA,KAAA,CAAO,KAAK,QAAS,EACvB,CACF,CACF","file":"ImageInfo.js","sourcesContent":["export enum ImageResolution {\r\n THUMBNAIL = 'thumbnail',\r\n SMALL = 'small',\r\n MEDIUM = 'medium',\r\n LARGE = 'large',\r\n ORIGINAL = 'original',\r\n}\r\n\r\nexport type ImageInfoAttribute = {\r\n sources: { [key in ImageResolution]?: string } & { original: string };\r\n alt?: string;\r\n order?: number;\r\n label?: string;\r\n};\r\n\r\nexport type ImageInfoData = ImageInfoAttribute;\r\n\r\n/**\r\n * Represents and manages structured image data, including multiple resolutions.\r\n */\r\nexport default class ImageInfoModel {\r\n protected sources: { [key in ImageResolution]?: string } & { original: string };\r\n protected alt?: string;\r\n protected order?: number;\r\n protected label?: string;\r\n\r\n /**\r\n * Creates an instance of ImageInfoModel.\r\n * @param data - The initial image data.\r\n */\r\n constructor(data: ImageInfoAttribute) {\r\n this.sources = { ...data.sources };\r\n this.alt = data.alt;\r\n this.order = data.order;\r\n this.label = data.label;\r\n\r\n if (!this.sources.original) {\r\n throw (\"ImageInfoModel cannot be created without an 'original' source URL.\");\r\n }\r\n }\r\n\r\n /**\r\n * Gets the sources object containing URLs for different resolutions.\r\n * Returns a copy to prevent external modification.\r\n */\r\n getSources() {\r\n return { ...this.sources };\r\n }\r\n\r\n /**\r\n * Gets the URL for a specific resolution key.\r\n * @param resolutionKey - The key of the desired resolution (e.g., 'thumbnail', 'medium').\r\n * @returns The URL string if the key doesn't exist, otherwise original image URL will be returned.\r\n */\r\n getSource(resolutionKey: ImageResolution): string{\r\n return this.sources[resolutionKey] || this.sources.original;\r\n }\r\n\r\n /**\r\n * Gets the alternative text for the image.\r\n */\r\n getAlt(): string | undefined {\r\n return this.alt;\r\n }\r\n\r\n /**\r\n * Gets the display order number for the image.\r\n */\r\n getOrder(): number | undefined {\r\n return this.order;\r\n }\r\n\r\n /**\r\n * Gets the display label or caption for the image.\r\n */\r\n getLabel(): string | undefined {\r\n return this.label;\r\n }\r\n\r\n /**\r\n * Sets the alternative text for the image.\r\n * @param altText - The new alt text.\r\n */\r\n setAlt(altText: string | undefined): void {\r\n this.alt = altText;\r\n // Potentially add logic here to trigger updates if needed\r\n }\r\n\r\n /**\r\n * Sets the display order for the image.\r\n * @param order - The new order number.\r\n */\r\n setOrder(order: number | undefined): void {\r\n this.order = order;\r\n }\r\n\r\n /**\r\n * Sets the display label for the image.\r\n * @param label - The new label text.\r\n */\r\n setLabel(label: string | undefined): void {\r\n this.label = label;\r\n }\r\n\r\n /**\r\n * Updates or adds a URL for a specific resolution.\r\n * @param resolutionKey - The key of the resolution to update/add.\r\n * @param url - The URL for the resolution. Set to undefined to remove.\r\n */\r\n setSource(resolutionKey: ImageResolution, url: string | undefined): void {\r\n if (url === undefined) {\r\n // Prevent deleting the 'original' key if it's required\r\n if (resolutionKey === 'original') {\r\n throw (\"Cannot remove the 'original' image source.\");\r\n return;\r\n }\r\n delete this.sources[resolutionKey];\r\n } else {\r\n this.sources[resolutionKey] = url;\r\n }\r\n }\r\n\r\n /**\r\n * Returns a plain JavaScript object representation of the image info.\r\n */\r\n getDetails(): ImageInfoData {\r\n return {\r\n sources: this.getSources(),\r\n alt: this.getAlt(),\r\n order: this.getOrder(),\r\n label: this.getLabel(),\r\n };\r\n }\r\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Classes/Error.ts","../../src/Classes/ImageInfo.ts"],"names":["InvalidImageSourceError","message","ImageResolution","ImageInfoModel","data","resolutionKey","altText","order","label","url"],"mappings":"sEA8HO,IAAMA,EAAN,cAAsC,KAAM,CAC/C,WAAYC,CAAAA,CAAAA,CAAkB,sCAAuC,CACjE,KAAA,CAAM,uBAAuBA,CAAO,CAAA,CAAE,EACtC,IAAK,CAAA,IAAA,CAAO,0BAChB,CACJ,CAAA,KCnIYC,CACVA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K,QAAQK,CAAa,EACnC,MACE,IAAK,CAAA,OAAA,CAAQA,CAAa,CAAII,CAAAA,EAElC,CAKA,UAA4B,EAAA,CAC1B,OAAO,CACL,OAAA,CAAS,KAAK,UAAW,EAAA,CACzB,IAAK,IAAK,CAAA,MAAA,GACV,KAAO,CAAA,IAAA,CAAK,UACZ,CAAA,KAAA,CAAO,KAAK,QAAS,EACvB,CACF,CACF","file":"ImageInfo.js","sourcesContent":["export class LineItemNotFoundError extends Error {\r\n constructor(lineItemId: string) {\r\n super(`Line item with ID '${lineItemId}' not found in the cart.`);\r\n this.name = 'LineItemNotFoundError';\r\n }\r\n}\r\n\r\nexport class DuplicateSizeError extends Error {\r\n constructor(size: string) {\r\n super(`Duplicate size found: ${size}`);\r\n this.name = 'DuplicateSizeError';\r\n }\r\n}\r\n\r\nexport class ProductMismatchError extends Error {\r\n constructor(message: string = \"Product and selection attributes do not match.\") {\r\n super(`ProductMismatch: ${message}`);\r\n this.name = 'ProductMismatchError';\r\n }\r\n}\r\n\r\nexport class ProductInactiveError extends Error {\r\n constructor(message: string = \"Product is not active.\") {\r\n super(`ProductInactive: ${message}`);\r\n this.name = 'ProductInactiveError';\r\n }\r\n}\r\n\r\nexport class SelectionAttributeParseError extends Error {\r\n constructor(message: string = \"Failed to parse selection attributes key.\") {\r\n super(`SelectionAttributeParseError: ${message}`);\r\n this.name = 'SelectionAttributeParseError';\r\n }\r\n}\r\n\r\nexport class SizeMismatchError extends Error {\r\n constructor(message: string = \"Size does not match.\") {\r\n super(`SizeMismatch: ${message}`);\r\n this.name = 'SizeMismatchError';\r\n }\r\n}\r\n\r\nexport class PricingNotFoundError extends Error {\r\n constructor(message: string = \"Pricing details not available for the product\") {\r\n super(`NotFound: ${message}`);\r\n this.name = 'PricingNotFoundError';\r\n }\r\n}\r\n\r\nexport class InvalidTaxRuleError extends Error {\r\n constructor(message: string = \"Tax rule category mismatch.\") {\r\n super(`InvalidTaxRule: ${message}`);\r\n this.name = 'InvalidTaxRuleError';\r\n }\r\n}\r\n\r\nexport class InvalidTaxCategoryError extends Error {\r\n constructor(message: string = \"Tax category is not valid.\") {\r\n super(`InvalidTaxCategory: ${message}`);\r\n this.name = 'InvalidTaxCategoryError';\r\n }\r\n}\r\n\r\nexport class InvalidMinQuantityError extends Error {\r\n constructor(message: string = \"Minimum quantity must be greater than zero.\") {\r\n super(`InvalidMinQuantity: ${message}`);\r\n this.name = 'InvalidMinQuantityError';\r\n }\r\n}\r\n\r\nexport class InvalidTieredPriceError extends Error {\r\n constructor(message: string) {\r\n super(`InvalidTieredPrice: ${message}`);\r\n this.name = 'InvalidTieredPriceError';\r\n }\r\n}\r\n\r\nexport class InvalidQuantityError extends Error {\r\n constructor(message: string = \"Quantity must be greater than zero.\") {\r\n super(`InvalidQuantity: ${message}`);\r\n this.name = 'InvalidQuantityError';\r\n }\r\n}\r\n\r\nexport class NoApplicableTierError extends Error {\r\n constructor(quantity: number) {\r\n super(`NoApplicableTier: Quantity ${quantity} does not meet the minimum purchase requirement.`);\r\n this.name = 'NoApplicableTierError';\r\n }\r\n}\r\n\r\nexport class TaxSlabNotFoundError extends Error {\r\n constructor(message: string = \"No applicable tax slab or multiple slabs found for the given unit price.\") {\r\n super(`TaxSlabNotFound: ${message}`);\r\n this.name = 'TaxSlabNotFoundError';\r\n }\r\n}\r\n\r\nexport class InvalidPriceAmountError extends Error {\r\n constructor(message: string = \"Amount cannot be negative.\") {\r\n super(`InvalidAmount: ${message}`);\r\n this.name = 'InvalidPriceAmountError';\r\n }\r\n}\r\n\r\nexport class InvalidCurrencyCodeError extends Error {\r\n constructor(message: string = \"Currency code is required.\") {\r\n super(`InvalidCurrency: ${message}`);\r\n this.name = 'InvalidCurrencyCodeError';\r\n }\r\n}\r\n\r\nexport class CurrencyMismatchError extends Error {\r\n constructor(message: string = \"Cannot perform operation on prices with different currencies.\") {\r\n super(`CurrencyMismatch: ${message}`);\r\n this.name = 'CurrencyMismatchError';\r\n }\r\n}\r\n\r\nexport class InvalidArgumentError extends Error {\r\n constructor(message: string) {\r\n super(`InvalidArgument: ${message}`);\r\n this.name = 'InvalidArgumentError';\r\n }\r\n}\r\n\r\nexport class InvalidImageSourceError extends Error {\r\n constructor(message: string = \"Invalid image source configuration.\") {\r\n super(`InvalidImageSource: ${message}`);\r\n this.name = 'InvalidImageSourceError';\r\n }\r\n}","export enum ImageResolution {\r\n THUMBNAIL = 'thumbnail',\r\n SMALL = 'small',\r\n MEDIUM = 'medium',\r\n LARGE = 'large',\r\n ORIGINAL = 'original',\r\n}\r\n\r\nimport { InvalidImageSourceError } from \"./Error\";\r\n\r\nexport type ImageInfoAttribute = {\r\n sources: { [key in ImageResolution]?: string } & { original: string };\r\n alt?: string;\r\n order?: number;\r\n label?: string;\r\n};\r\n\r\nexport type ImageInfoData = ImageInfoAttribute;\r\n\r\n/**\r\n * Represents and manages structured image data, including multiple resolutions.\r\n */\r\nexport default class ImageInfoModel {\r\n protected sources: { [key in ImageResolution]?: string } & { original: string };\r\n protected alt?: string;\r\n protected order?: number;\r\n protected label?: string;\r\n\r\n /**\r\n * Creates an instance of ImageInfoModel.\r\n * @param data - The initial image data.\r\n */\r\n constructor(data: ImageInfoAttribute) {\r\n this.sources = { ...data.sources };\r\n this.alt = data.alt;\r\n this.order = data.order;\r\n this.label = data.label;\r\n\r\n if (!this.sources.original) {\r\n throw new InvalidImageSourceError(\"ImageInfoModel cannot be created without an 'original' source URL.\");\r\n }\r\n }\r\n\r\n /**\r\n * Gets the sources object containing URLs for different resolutions.\r\n * Returns a copy to prevent external modification.\r\n */\r\n getSources() {\r\n return { ...this.sources };\r\n }\r\n\r\n /**\r\n * Gets the URL for a specific resolution key.\r\n * @param resolutionKey - The key of the desired resolution (e.g., 'thumbnail', 'medium').\r\n * @returns The URL string if the key doesn't exist, otherwise original image URL will be returned.\r\n */\r\n getSource(resolutionKey: ImageResolution): string {\r\n return this.sources[resolutionKey] || this.sources.original;\r\n }\r\n\r\n /**\r\n * Gets the alternative text for the image.\r\n */\r\n getAlt(): string | undefined {\r\n return this.alt;\r\n }\r\n\r\n /**\r\n * Gets the display order number for the image.\r\n */\r\n getOrder(): number | undefined {\r\n return this.order;\r\n }\r\n\r\n /**\r\n * Gets the display label or caption for the image.\r\n */\r\n getLabel(): string | undefined {\r\n return this.label;\r\n }\r\n\r\n /**\r\n * Sets the alternative text for the image.\r\n * @param altText - The new alt text.\r\n */\r\n setAlt(altText: string | undefined): void {\r\n this.alt = altText;\r\n // Potentially add logic here to trigger updates if needed\r\n }\r\n\r\n /**\r\n * Sets the display order for the image.\r\n * @param order - The new order number.\r\n */\r\n setOrder(order: number | undefined): void {\r\n this.order = order;\r\n }\r\n\r\n /**\r\n * Sets the display label for the image.\r\n * @param label - The new label text.\r\n */\r\n setLabel(label: string | undefined): void {\r\n this.label = label;\r\n }\r\n\r\n /**\r\n * Updates or adds a URL for a specific resolution.\r\n * @param resolutionKey - The key of the resolution to update/add.\r\n * @param url - The URL for the resolution. Set to undefined to remove.\r\n */\r\n setSource(resolutionKey: ImageResolution, url: string | undefined): void {\r\n if (url === undefined) {\r\n // Prevent deleting the 'original' key if it's required\r\n if (resolutionKey === 'original') {\r\n throw new InvalidImageSourceError(\"Cannot remove the 'original' image source.\");\r\n }\r\n delete this.sources[resolutionKey];\r\n } else {\r\n this.sources[resolutionKey] = url;\r\n }\r\n }\r\n\r\n /**\r\n * Returns a plain JavaScript object representation of the image info.\r\n */\r\n getDetails(): ImageInfoData {\r\n return {\r\n sources: this.getSources(),\r\n alt: this.getAlt(),\r\n order: this.getOrder(),\r\n label: this.getLabel(),\r\n };\r\n }\r\n}"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as ImageResolution,b as default}from'../chunk-
|
|
1
|
+
export{a as ImageResolution,b as default}from'../chunk-NUTKOIGY.mjs';import'../chunk-NJKSUUOB.mjs';//# sourceMappingURL=ImageInfo.mjs.map
|
|
2
2
|
//# sourceMappingURL=ImageInfo.mjs.map
|
|
@@ -1,28 +1,47 @@
|
|
|
1
1
|
import BaseModel, { BaseAttributes, BaseData } from './Base.mjs';
|
|
2
|
-
import { CountryCode } from '
|
|
2
|
+
import { C as CountryCode } from '../Common-FbQ5-3QN.mjs';
|
|
3
|
+
import { SelectionAttributes } from './Product.mjs';
|
|
3
4
|
import '../Auth/index.mjs';
|
|
4
5
|
import './Enum.mjs';
|
|
6
|
+
import './ImageInfo.mjs';
|
|
7
|
+
import './TieredPrice.mjs';
|
|
5
8
|
|
|
6
9
|
type StockData = {
|
|
10
|
+
selectionAttribute: SelectionAttributes;
|
|
7
11
|
size: string;
|
|
8
12
|
available: number;
|
|
9
13
|
country: CountryCode;
|
|
10
14
|
};
|
|
11
15
|
type InventoryAttributes = BaseAttributes & {
|
|
12
16
|
productKey: string;
|
|
13
|
-
variantId: string;
|
|
14
17
|
stocks: StockData[];
|
|
15
18
|
};
|
|
16
19
|
type InventoryData = BaseData & InventoryAttributes;
|
|
17
20
|
declare class InventoryModel extends BaseModel {
|
|
18
21
|
protected productKey: string;
|
|
19
|
-
protected variantId: string;
|
|
20
22
|
protected stocks: StockData[];
|
|
23
|
+
/**
|
|
24
|
+
* Creates an instance of InventoryModel.
|
|
25
|
+
* @param data - The initial inventory attributes.
|
|
26
|
+
*/
|
|
21
27
|
constructor(data: InventoryAttributes);
|
|
28
|
+
/**
|
|
29
|
+
* Gets the product key associated with this inventory.
|
|
30
|
+
* @returns The product key string.
|
|
31
|
+
*/
|
|
22
32
|
getProductKey(): string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves stock information for a specific size and country.
|
|
35
|
+
* @param selectionAttribute - The selection attributes to filter by.
|
|
36
|
+
* @param size - The size to filter by.
|
|
37
|
+
* @param country - The country to filter by.
|
|
38
|
+
* @returns An array of StockData objects matching the specified criteria.
|
|
39
|
+
*/
|
|
40
|
+
getStockData(selectionAttribute?: SelectionAttributes, size?: string, country?: CountryCode): StockData[];
|
|
41
|
+
/**
|
|
42
|
+
* Gets a plain data object representing the inventory's current state.
|
|
43
|
+
* @returns InventoryData suitable for serialization.
|
|
44
|
+
*/
|
|
26
45
|
getDetails(): InventoryData;
|
|
27
46
|
}
|
|
28
47
|
|
|
@@ -1,28 +1,47 @@
|
|
|
1
1
|
import BaseModel, { BaseAttributes, BaseData } from './Base.js';
|
|
2
|
-
import { CountryCode } from '
|
|
2
|
+
import { C as CountryCode } from '../Common-D-UoxwM0.js';
|
|
3
|
+
import { SelectionAttributes } from './Product.js';
|
|
3
4
|
import '../Auth/index.js';
|
|
4
5
|
import './Enum.js';
|
|
6
|
+
import './ImageInfo.js';
|
|
7
|
+
import './TieredPrice.js';
|
|
5
8
|
|
|
6
9
|
type StockData = {
|
|
10
|
+
selectionAttribute: SelectionAttributes;
|
|
7
11
|
size: string;
|
|
8
12
|
available: number;
|
|
9
13
|
country: CountryCode;
|
|
10
14
|
};
|
|
11
15
|
type InventoryAttributes = BaseAttributes & {
|
|
12
16
|
productKey: string;
|
|
13
|
-
variantId: string;
|
|
14
17
|
stocks: StockData[];
|
|
15
18
|
};
|
|
16
19
|
type InventoryData = BaseData & InventoryAttributes;
|
|
17
20
|
declare class InventoryModel extends BaseModel {
|
|
18
21
|
protected productKey: string;
|
|
19
|
-
protected variantId: string;
|
|
20
22
|
protected stocks: StockData[];
|
|
23
|
+
/**
|
|
24
|
+
* Creates an instance of InventoryModel.
|
|
25
|
+
* @param data - The initial inventory attributes.
|
|
26
|
+
*/
|
|
21
27
|
constructor(data: InventoryAttributes);
|
|
28
|
+
/**
|
|
29
|
+
* Gets the product key associated with this inventory.
|
|
30
|
+
* @returns The product key string.
|
|
31
|
+
*/
|
|
22
32
|
getProductKey(): string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves stock information for a specific size and country.
|
|
35
|
+
* @param selectionAttribute - The selection attributes to filter by.
|
|
36
|
+
* @param size - The size to filter by.
|
|
37
|
+
* @param country - The country to filter by.
|
|
38
|
+
* @returns An array of StockData objects matching the specified criteria.
|
|
39
|
+
*/
|
|
40
|
+
getStockData(selectionAttribute?: SelectionAttributes, size?: string, country?: CountryCode): StockData[];
|
|
41
|
+
/**
|
|
42
|
+
* Gets a plain data object representing the inventory's current state.
|
|
43
|
+
* @returns InventoryData suitable for serialization.
|
|
44
|
+
*/
|
|
26
45
|
getDetails(): InventoryData;
|
|
27
46
|
}
|
|
28
47
|
|