b23-lib 3.4.2 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/Auth/index.js +1 -1
  2. package/dist/Auth/index.js.map +1 -1
  3. package/dist/Auth/index.mjs +1 -1
  4. package/dist/Classes/Address.d.mts +1 -1
  5. package/dist/Classes/Address.d.ts +1 -1
  6. package/dist/Classes/Base.d.mts +1 -1
  7. package/dist/Classes/Base.d.ts +1 -1
  8. package/dist/Classes/Cart.d.mts +1 -1
  9. package/dist/Classes/Cart.d.ts +1 -1
  10. package/dist/Classes/Cart.js +1 -1
  11. package/dist/Classes/Cart.js.map +1 -1
  12. package/dist/Classes/Cart.mjs +1 -1
  13. package/dist/Classes/Charge.d.mts +1 -1
  14. package/dist/Classes/Charge.d.ts +1 -1
  15. package/dist/Classes/Charge.js +1 -1
  16. package/dist/Classes/Charge.js.map +1 -1
  17. package/dist/Classes/Charge.mjs +1 -1
  18. package/dist/Classes/Common.d.mts +1 -1
  19. package/dist/Classes/Common.d.ts +1 -1
  20. package/dist/Classes/Coupon.d.mts +1 -1
  21. package/dist/Classes/Coupon.d.ts +1 -1
  22. package/dist/Classes/Coupon.js +1 -1
  23. package/dist/Classes/Coupon.js.map +1 -1
  24. package/dist/Classes/Coupon.mjs +1 -1
  25. package/dist/Classes/Customer.d.mts +4 -4
  26. package/dist/Classes/Customer.d.ts +4 -4
  27. package/dist/Classes/Customer.js +1 -1
  28. package/dist/Classes/Customer.js.map +1 -1
  29. package/dist/Classes/Customer.mjs.map +1 -1
  30. package/dist/Classes/CustomerAddress.d.mts +1 -1
  31. package/dist/Classes/CustomerAddress.d.ts +1 -1
  32. package/dist/Classes/Enum.d.mts +23 -1
  33. package/dist/Classes/Enum.d.ts +23 -1
  34. package/dist/Classes/Enum.js +1 -1
  35. package/dist/Classes/Enum.js.map +1 -1
  36. package/dist/Classes/Enum.mjs +1 -1
  37. package/dist/Classes/Inventory.d.mts +1 -1
  38. package/dist/Classes/Inventory.d.ts +1 -1
  39. package/dist/Classes/Inventory.js +1 -1
  40. package/dist/Classes/Inventory.js.map +1 -1
  41. package/dist/Classes/Inventory.mjs +1 -1
  42. package/dist/Classes/Invoice.d.mts +5 -2
  43. package/dist/Classes/Invoice.d.ts +5 -2
  44. package/dist/Classes/Invoice.js +1 -1
  45. package/dist/Classes/Invoice.js.map +1 -1
  46. package/dist/Classes/Invoice.mjs +1 -1
  47. package/dist/Classes/Invoice.mjs.map +1 -1
  48. package/dist/Classes/LineItem.d.mts +1 -1
  49. package/dist/Classes/LineItem.d.ts +1 -1
  50. package/dist/Classes/LineItem.js +1 -1
  51. package/dist/Classes/LineItem.js.map +1 -1
  52. package/dist/Classes/LineItem.mjs +1 -1
  53. package/dist/Classes/Order.d.mts +1 -1
  54. package/dist/Classes/Order.d.ts +1 -1
  55. package/dist/Classes/Order.js +1 -1
  56. package/dist/Classes/Order.js.map +1 -1
  57. package/dist/Classes/Order.mjs +1 -1
  58. package/dist/Classes/Payment.d.mts +1 -1
  59. package/dist/Classes/Payment.d.ts +1 -1
  60. package/dist/Classes/Price.d.mts +1 -1
  61. package/dist/Classes/Price.d.ts +1 -1
  62. package/dist/Classes/Price.js +1 -1
  63. package/dist/Classes/Price.js.map +1 -1
  64. package/dist/Classes/Price.mjs +1 -1
  65. package/dist/Classes/Product.d.mts +1 -1
  66. package/dist/Classes/Product.d.ts +1 -1
  67. package/dist/Classes/Product.js +1 -1
  68. package/dist/Classes/Product.js.map +1 -1
  69. package/dist/Classes/Product.mjs +1 -1
  70. package/dist/Classes/ShoppingContainer.d.mts +1 -1
  71. package/dist/Classes/ShoppingContainer.d.ts +1 -1
  72. package/dist/Classes/ShoppingContainer.js +1 -1
  73. package/dist/Classes/ShoppingContainer.js.map +1 -1
  74. package/dist/Classes/ShoppingContainer.mjs +1 -1
  75. package/dist/Classes/TaxRule.d.mts +1 -1
  76. package/dist/Classes/TaxRule.d.ts +1 -1
  77. package/dist/Classes/TaxRule.js +1 -1
  78. package/dist/Classes/TaxRule.js.map +1 -1
  79. package/dist/Classes/TaxRule.mjs +1 -1
  80. package/dist/Classes/TieredPrice.d.mts +1 -1
  81. package/dist/Classes/TieredPrice.d.ts +1 -1
  82. package/dist/Classes/TieredPrice.js +1 -1
  83. package/dist/Classes/TieredPrice.js.map +1 -1
  84. package/dist/Classes/TieredPrice.mjs +1 -1
  85. package/dist/{Common-Du2s_43h.d.mts → Common-CJ_dZU3n.d.mts} +6 -1
  86. package/dist/{Common-BsfeCt6G.d.ts → Common-D01ijYt3.d.ts} +6 -1
  87. package/dist/{chunk-MHLRJ4IJ.mjs → chunk-4G7JC2EH.mjs} +2 -2
  88. package/dist/{chunk-MHLRJ4IJ.mjs.map → chunk-4G7JC2EH.mjs.map} +1 -1
  89. package/dist/{chunk-LI5JQ6UC.mjs → chunk-6ZKMKSAG.mjs} +2 -2
  90. package/dist/{chunk-LI5JQ6UC.mjs.map → chunk-6ZKMKSAG.mjs.map} +1 -1
  91. package/dist/{chunk-RQ2FFWUW.mjs → chunk-G4AM63RT.mjs} +2 -2
  92. package/dist/{chunk-RQ2FFWUW.mjs.map → chunk-G4AM63RT.mjs.map} +1 -1
  93. package/dist/{chunk-2POPOJGE.mjs → chunk-O6EVIZAP.mjs} +2 -2
  94. package/dist/{chunk-2POPOJGE.mjs.map → chunk-O6EVIZAP.mjs.map} +1 -1
  95. package/dist/{chunk-FCRJAAPY.mjs → chunk-S6LR7AUZ.mjs} +2 -2
  96. package/dist/{chunk-FCRJAAPY.mjs.map → chunk-S6LR7AUZ.mjs.map} +1 -1
  97. package/dist/chunk-TPIIACE7.mjs +2 -0
  98. package/dist/chunk-TPIIACE7.mjs.map +1 -0
  99. package/dist/{chunk-B2VFJRLS.mjs → chunk-VEOX3TRL.mjs} +2 -2
  100. package/dist/{chunk-B2VFJRLS.mjs.map → chunk-VEOX3TRL.mjs.map} +1 -1
  101. package/dist/{chunk-G6LH7V5B.mjs → chunk-XTF6ND33.mjs} +2 -2
  102. package/dist/{chunk-G6LH7V5B.mjs.map → chunk-XTF6ND33.mjs.map} +1 -1
  103. package/dist/{chunk-SOZHGHMY.mjs → chunk-ZODPRQKQ.mjs} +2 -2
  104. package/dist/{chunk-SOZHGHMY.mjs.map → chunk-ZODPRQKQ.mjs.map} +1 -1
  105. package/dist/index.d.mts +5 -1
  106. package/dist/index.d.ts +5 -1
  107. package/dist/index.js +2 -2
  108. package/dist/index.js.map +1 -1
  109. package/dist/index.mjs +1 -1
  110. package/dist/index.mjs.map +1 -1
  111. package/package.json +1 -1
  112. package/dist/chunk-QK4XJ3GB.mjs +0 -2
  113. package/dist/chunk-QK4XJ3GB.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import BaseModel, { BaseAttributes, BaseData } from './Base.mjs';
2
+ import { E as E164Phone } from '../Common-CJ_dZU3n.mjs';
2
3
  import '../Auth/index.mjs';
3
- import '../Common-Du2s_43h.mjs';
4
4
  import './Enum.mjs';
5
5
 
6
6
  declare enum CustomerStatus {
@@ -15,7 +15,7 @@ declare enum CustomerStatus {
15
15
  type CustomerAttributes = BaseAttributes & {
16
16
  id: string;
17
17
  email: string;
18
- phone?: string;
18
+ phone?: E164Phone;
19
19
  firstName: string;
20
20
  lastName: string;
21
21
  company?: string;
@@ -26,7 +26,7 @@ type CustomerDataWithArrayStatus = Omit<CustomerAttributes, 'customerStatus'> &
26
26
  customerStatus: CustomerStatus[];
27
27
  };
28
28
  type CustomerData = Required<Omit<CustomerDataWithArrayStatus, 'phone'>> & {
29
- phone?: string;
29
+ phone?: E164Phone;
30
30
  };
31
31
  type CustomerDataWithOutId = Omit<CustomerData, 'id'>;
32
32
  /**
@@ -35,7 +35,7 @@ type CustomerDataWithOutId = Omit<CustomerData, 'id'>;
35
35
  declare class CustomerModel extends BaseModel {
36
36
  protected id: string;
37
37
  protected email: string;
38
- protected phone?: string;
38
+ protected phone?: E164Phone;
39
39
  protected firstName: string;
40
40
  protected lastName: string;
41
41
  protected company: string;
@@ -1,6 +1,6 @@
1
1
  import BaseModel, { BaseAttributes, BaseData } from './Base.js';
2
+ import { E as E164Phone } from '../Common-D01ijYt3.js';
2
3
  import '../Auth/index.js';
3
- import '../Common-BsfeCt6G.js';
4
4
  import './Enum.js';
5
5
 
6
6
  declare enum CustomerStatus {
@@ -15,7 +15,7 @@ declare enum CustomerStatus {
15
15
  type CustomerAttributes = BaseAttributes & {
16
16
  id: string;
17
17
  email: string;
18
- phone?: string;
18
+ phone?: E164Phone;
19
19
  firstName: string;
20
20
  lastName: string;
21
21
  company?: string;
@@ -26,7 +26,7 @@ type CustomerDataWithArrayStatus = Omit<CustomerAttributes, 'customerStatus'> &
26
26
  customerStatus: CustomerStatus[];
27
27
  };
28
28
  type CustomerData = Required<Omit<CustomerDataWithArrayStatus, 'phone'>> & {
29
- phone?: string;
29
+ phone?: E164Phone;
30
30
  };
31
31
  type CustomerDataWithOutId = Omit<CustomerData, 'id'>;
32
32
  /**
@@ -35,7 +35,7 @@ type CustomerDataWithOutId = Omit<CustomerData, 'id'>;
35
35
  declare class CustomerModel extends BaseModel {
36
36
  protected id: string;
37
37
  protected email: string;
38
- protected phone?: string;
38
+ protected phone?: E164Phone;
39
39
  protected firstName: string;
40
40
  protected lastName: string;
41
41
  protected company: string;
@@ -1,2 +1,2 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var m=r=>structuredClone(r),o=class{customFields;constructor(t,e=new Date){this.customFields={...t.customFields};}getCustomField(t){let e=this.customFields[t];return e==null?e:m(e)}setCustomField(t,e){this.customFields[t]=e;}getAllCustomFields(){return m(this.customFields)}},s=class extends o{version;createdAt;modifiedAt;modifiedBy;constructor(t,e=new Date){super(t),this.version=t.version??1,this.createdAt=t.createdAt&&!isNaN(Date.parse(t.createdAt))?new Date(t.createdAt).toISOString():e.toISOString(),this.modifiedAt=t.modifiedAt&&!isNaN(Date.parse(t.modifiedAt))?new Date(t.modifiedAt).toISOString():e.toISOString(),this.modifiedBy={...t.modifiedBy};}getDetails(){return {customFields:this.getAllCustomFields(),version:this.getVersion(),createdAt:this.getCreatedAt(),modifiedAt:this.getModifiedAt(),modifiedBy:this.getModifiedBy()}}getVersion(){return this.version}getCreatedAt(){return this.createdAt}getCreatedAtTime(){return new Date(this.createdAt).getTime()}getModifiedAt(){return this.modifiedAt}getModifiedAtTime(){return new Date(this.modifiedAt).getTime()}getModifiedBy(){return {...this.modifiedBy}}setModifiedBy(t,e,u,n){this.modifiedBy={id:t,authType:e,requestId:u,lambdaName:n};}};var g=(i=>(i.CREATED="CREATED",i.REGISTERED_USER="REGISTERED_USER",i.ACTIVATED_USER="ACTIVATED_USER",i.EMAIL_OTP="EMAIL_OTP",i.EMAIL_PASSWORD="EMAIL_PASSWORD",i.PHONE_OTP="PHONE_OTP",i.GOOGLE_AUTH="GOOGLE_AUTH",i))(g||{}),a=class extends s{id;email;phone;firstName;lastName;company;isEmailVerified;customerStatus;constructor(t,e=new Date){super(t,e),this.id=t.id,this.email=t.email,this.phone=t.phone,this.firstName=t.firstName,this.lastName=t.lastName,this.company=t.company??"",this.isEmailVerified=t.isEmailVerified??!1,this.customerStatus=new Set([...t.customerStatus?Array.from(t.customerStatus):[],"CREATED"]);}getDetails(t=!1){return {...super.getDetails(),...t?{id:this.getId()}:{},email:this.getEmail(),phone:this.getPhone(),firstName:this.getFirstName(),lastName:this.getLastName(),company:this.getCompany(),isEmailVerified:this.getIsEmailVerified(),customerStatus:this.getCustomerStatus()}}getId(){return this.id}getEmail(){return this.email}getPhone(){return this.phone}getFirstName(){return this.firstName}getLastName(){return this.lastName}getCompany(){return this.company}getIsEmailVerified(){return this.isEmailVerified}getCustomerStatus(){return Array.from(this.customerStatus)}hasCustomerStatus(t){return this.customerStatus.has(t)}};exports.CustomerStatus=g;exports.default=a;//# sourceMappingURL=Customer.js.map
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var m=r=>structuredClone(r),o=class{customFields;constructor(t,e=new Date){this.customFields={...t.customFields};}getCustomField(t){let e=this.customFields[t];return e==null?e:m(e)}setCustomField(t,e){this.customFields[t]=e;}getAllCustomFields(){return m(this.customFields)}},s=class extends o{version;createdAt;modifiedAt;modifiedBy;constructor(t,e=new Date){super(t),this.version=t.version??1,this.createdAt=t.createdAt&&!isNaN(Date.parse(t.createdAt))?new Date(t.createdAt).toISOString():e.toISOString(),this.modifiedAt=t.modifiedAt&&!isNaN(Date.parse(t.modifiedAt))?new Date(t.modifiedAt).toISOString():e.toISOString(),this.modifiedBy={...t.modifiedBy};}getDetails(){return {customFields:this.getAllCustomFields(),version:this.getVersion(),createdAt:this.getCreatedAt(),modifiedAt:this.getModifiedAt(),modifiedBy:this.getModifiedBy()}}getVersion(){return this.version}getCreatedAt(){return this.createdAt}getCreatedAtTime(){return new Date(this.createdAt).getTime()}getModifiedAt(){return this.modifiedAt}getModifiedAtTime(){return new Date(this.modifiedAt).getTime()}getModifiedBy(){return {...this.modifiedBy}}setModifiedBy(t,e,u,n){this.modifiedBy={id:t,authType:e,requestId:u,lambdaName:n};}};var h=(i=>(i.CREATED="CREATED",i.REGISTERED_USER="REGISTERED_USER",i.ACTIVATED_USER="ACTIVATED_USER",i.EMAIL_OTP="EMAIL_OTP",i.EMAIL_PASSWORD="EMAIL_PASSWORD",i.PHONE_OTP="PHONE_OTP",i.GOOGLE_AUTH="GOOGLE_AUTH",i))(h||{}),a=class extends s{id;email;phone;firstName;lastName;company;isEmailVerified;customerStatus;constructor(t,e=new Date){super(t,e),this.id=t.id,this.email=t.email,this.phone=t.phone,this.firstName=t.firstName,this.lastName=t.lastName,this.company=t.company??"",this.isEmailVerified=t.isEmailVerified??!1,this.customerStatus=new Set([...t.customerStatus?Array.from(t.customerStatus):[],"CREATED"]);}getDetails(t=!1){return {...super.getDetails(),...t?{id:this.getId()}:{},email:this.getEmail(),phone:this.getPhone(),firstName:this.getFirstName(),lastName:this.getLastName(),company:this.getCompany(),isEmailVerified:this.getIsEmailVerified(),customerStatus:this.getCustomerStatus()}}getId(){return this.id}getEmail(){return this.email}getPhone(){return this.phone}getFirstName(){return this.firstName}getLastName(){return this.lastName}getCompany(){return this.company}getIsEmailVerified(){return this.isEmailVerified}getCustomerStatus(){return Array.from(this.customerStatus)}hasCustomerStatus(t){return this.customerStatus.has(t)}};exports.CustomerStatus=h;exports.default=a;//# sourceMappingURL=Customer.js.map
2
2
  //# sourceMappingURL=Customer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Classes/Base.ts","../../src/Classes/Customer.ts"],"names":["deepClone","obj","CustomFieldModel","data","date","fieldName","value","BaseModel","id","authType","requestId","lambdaName","CustomerStatus","CustomerModel","withId","customerStatus"],"mappings":"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","file":"Customer.js","sourcesContent":["import { AuthType } from \"../Auth\";\nimport { ISODateTimeUTC, Prettify } from \"./Common\";\n\nconst deepClone = <T>(obj: T): T => structuredClone(obj);\n\r\nexport interface CustomFields {\r\n [key: string]: any;\r\n}\r\n\r\nexport type CustomFieldAttributes = {\r\n customFields?: CustomFields;\r\n}\r\n\r\nexport class CustomFieldModel {\r\n protected customFields: CustomFields;\r\n constructor(data: CustomFieldAttributes, date: Date = new Date()) {\r\n this.customFields = { ...data.customFields };\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 {\n const value = this.customFields[fieldName];\n if (value === undefined || value === null) return value;\n return deepClone(value);\n }\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 {\n return deepClone(this.customFields);\n }\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 = Prettify<CustomFieldAttributes & {\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 extends CustomFieldModel {\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 super(data);\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","import BaseModel, { BaseAttributes, BaseData } from \"./Base\";\r\n\r\nexport enum CustomerStatus {\r\n CREATED = \"CREATED\",\r\n REGISTERED_USER = \"REGISTERED_USER\",\r\n ACTIVATED_USER = \"ACTIVATED_USER\",\r\n EMAIL_OTP = \"EMAIL_OTP\",\r\n EMAIL_PASSWORD = \"EMAIL_PASSWORD\",\r\n PHONE_OTP = \"PHONE_OTP\",\r\n GOOGLE_AUTH = \"GOOGLE_AUTH\"\r\n}\r\n\r\nexport type CustomerAttributes = BaseAttributes & {\r\n id: string;\r\n email: string;\r\n phone?: string;\r\n firstName: string;\r\n lastName: string;\r\n company?: string;\r\n isEmailVerified?: boolean;\r\n customerStatus?: Set<CustomerStatus>;\r\n};\r\n\r\n\r\ntype CustomerDataWithArrayStatus = Omit<CustomerAttributes, 'customerStatus'> & BaseData & { customerStatus: CustomerStatus[]; }\r\nexport type CustomerData = Required<Omit<CustomerDataWithArrayStatus, 'phone'>> & { phone?: string };\r\nexport type CustomerDataWithOutId = Omit<CustomerData, 'id'>;\r\n\r\n/**\r\n * Represents a customer entity, managing customer information and status.\r\n */\r\nexport default class CustomerModel extends BaseModel {\r\n protected id: string;\r\n protected email: string;\r\n protected phone?: string;\r\n protected firstName: string;\r\n protected lastName: string;\r\n protected company: string;\r\n protected isEmailVerified: boolean;\r\n protected customerStatus: Set<CustomerStatus>;\r\n\r\n /**\r\n * Creates an instance of CustomerModel.\r\n * Initializes customer properties and ensures the CREATED status is always present.\r\n * @param data - The initial attributes for the customer.\r\n * @param date - Optional date object for setting creation/modification times (defaults to now).\r\n */\r\n constructor(data: CustomerAttributes, date: Date = new Date()) {\r\n super(data, date);\r\n this.id = data.id;\r\n this.email = data.email;\r\n this.phone = data.phone;\r\n this.firstName = data.firstName;\r\n this.lastName = data.lastName;\r\n this.company = data.company ?? '';\r\n this.isEmailVerified = data.isEmailVerified ?? false;\r\n this.customerStatus = new Set<CustomerStatus>(\r\n [...(data.customerStatus ? Array.from<CustomerStatus>(data.customerStatus) : []), CustomerStatus.CREATED]\r\n );\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the customer's current state.\r\n * Can optionally exclude the customer ID. Includes base model details.\r\n * @param withId - If true, includes the 'id' field. Defaults to false.\r\n * @returns CustomerData or CustomerDataWithOutId object suitable for serialization.\r\n */\r\n getDetails(withId?: false): CustomerDataWithOutId;\r\n getDetails(withId: true): CustomerData;\r\n getDetails(withId: boolean = false): CustomerData | CustomerDataWithOutId {\r\n return {\r\n ...super.getDetails(),\r\n ...(withId ? { id: this.getId() } : {}),\r\n email: this.getEmail(),\r\n phone: this.getPhone(),\r\n firstName: this.getFirstName(),\r\n lastName: this.getLastName(),\r\n company: this.getCompany(),\r\n isEmailVerified: this.getIsEmailVerified(),\r\n customerStatus: this.getCustomerStatus()\r\n };\r\n }\r\n\r\n /**\r\n * Gets the unique identifier for the customer.\r\n * @returns The customer ID.\r\n */\r\n getId(): string {\r\n return this.id;\r\n }\r\n\r\n /**\r\n * Gets the email address of the customer.\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 phone number of the customer.\r\n * @returns The phone number.\r\n */\r\n getPhone(): string | undefined {\r\n return this.phone;\r\n }\r\n\r\n\r\n /**\r\n * Gets the first name of the customer.\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 /**\r\n * Gets the last name of the customer.\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 customer.\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 * Checks if the customer's email address has been verified.\r\n * @returns True if the email is verified, false otherwise.\r\n */\r\n getIsEmailVerified(): boolean {\r\n return this.isEmailVerified;\r\n }\r\n\r\n\r\n /**\r\n * Gets the customer's current statuses as an array.\r\n * @returns An array of CustomerStatus enum values.\r\n */\r\n getCustomerStatus(): CustomerStatus[] {\r\n return Array.from(this.customerStatus);\r\n }\r\n\r\n /**\r\n * Checks if the customer has a specific status.\r\n * Note: This method currently returns void. It should likely return boolean.\r\n * @param customerStatus - The status to check for.\r\n * @returns True if the status exists, false otherwise.\r\n */\r\n hasCustomerStatus(customerStatus: CustomerStatus): boolean {\r\n return this.customerStatus.has(customerStatus);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"sources":["../../src/Classes/Base.ts","../../src/Classes/Customer.ts"],"names":["deepClone","obj","CustomFieldModel","data","date","fieldName","value","BaseModel","id","authType","requestId","lambdaName","CustomerStatus","CustomerModel","withId","customerStatus"],"mappings":"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","file":"Customer.js","sourcesContent":["import { AuthType } from \"../Auth\";\nimport { ISODateTimeUTC, Prettify } from \"./Common\";\n\nconst deepClone = <T>(obj: T): T => structuredClone(obj);\n\r\nexport interface CustomFields {\r\n [key: string]: any;\r\n}\r\n\r\nexport type CustomFieldAttributes = {\r\n customFields?: CustomFields;\r\n}\r\n\r\nexport class CustomFieldModel {\r\n protected customFields: CustomFields;\r\n constructor(data: CustomFieldAttributes, date: Date = new Date()) {\r\n this.customFields = { ...data.customFields };\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 {\n const value = this.customFields[fieldName];\n if (value === undefined || value === null) return value;\n return deepClone(value);\n }\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 {\n return deepClone(this.customFields);\n }\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 = Prettify<CustomFieldAttributes & {\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 extends CustomFieldModel {\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 super(data);\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","import BaseModel, { BaseAttributes, BaseData } from \"./Base\";\r\nimport { E164Phone } from \"./Common\";\r\n\r\nexport enum CustomerStatus {\r\n CREATED = \"CREATED\",\r\n REGISTERED_USER = \"REGISTERED_USER\",\r\n ACTIVATED_USER = \"ACTIVATED_USER\",\r\n EMAIL_OTP = \"EMAIL_OTP\",\r\n EMAIL_PASSWORD = \"EMAIL_PASSWORD\",\r\n PHONE_OTP = \"PHONE_OTP\",\r\n GOOGLE_AUTH = \"GOOGLE_AUTH\"\r\n}\r\n\r\nexport type CustomerAttributes = BaseAttributes & {\r\n id: string;\r\n email: string;\r\n phone?: E164Phone;\r\n firstName: string;\r\n lastName: string;\r\n company?: string;\r\n isEmailVerified?: boolean;\r\n customerStatus?: Set<CustomerStatus>;\r\n};\r\n\r\n\r\ntype CustomerDataWithArrayStatus = Omit<CustomerAttributes, 'customerStatus'> & BaseData & { customerStatus: CustomerStatus[]; }\r\nexport type CustomerData = Required<Omit<CustomerDataWithArrayStatus, 'phone'>> & { phone?: E164Phone };\r\nexport type CustomerDataWithOutId = Omit<CustomerData, 'id'>;\r\n\r\n/**\r\n * Represents a customer entity, managing customer information and status.\r\n */\r\nexport default class CustomerModel extends BaseModel {\r\n protected id: string;\r\n protected email: string;\r\n protected phone?: E164Phone;\r\n protected firstName: string;\r\n protected lastName: string;\r\n protected company: string;\r\n protected isEmailVerified: boolean;\r\n protected customerStatus: Set<CustomerStatus>;\r\n\r\n /**\r\n * Creates an instance of CustomerModel.\r\n * Initializes customer properties and ensures the CREATED status is always present.\r\n * @param data - The initial attributes for the customer.\r\n * @param date - Optional date object for setting creation/modification times (defaults to now).\r\n */\r\n constructor(data: CustomerAttributes, date: Date = new Date()) {\r\n super(data, date);\r\n this.id = data.id;\r\n this.email = data.email;\r\n this.phone = data.phone;\r\n this.firstName = data.firstName;\r\n this.lastName = data.lastName;\r\n this.company = data.company ?? '';\r\n this.isEmailVerified = data.isEmailVerified ?? false;\r\n this.customerStatus = new Set<CustomerStatus>(\r\n [...(data.customerStatus ? Array.from<CustomerStatus>(data.customerStatus) : []), CustomerStatus.CREATED]\r\n );\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the customer's current state.\r\n * Can optionally exclude the customer ID. Includes base model details.\r\n * @param withId - If true, includes the 'id' field. Defaults to false.\r\n * @returns CustomerData or CustomerDataWithOutId object suitable for serialization.\r\n */\r\n getDetails(withId?: false): CustomerDataWithOutId;\r\n getDetails(withId: true): CustomerData;\r\n getDetails(withId: boolean = false): CustomerData | CustomerDataWithOutId {\r\n return {\r\n ...super.getDetails(),\r\n ...(withId ? { id: this.getId() } : {}),\r\n email: this.getEmail(),\r\n phone: this.getPhone(),\r\n firstName: this.getFirstName(),\r\n lastName: this.getLastName(),\r\n company: this.getCompany(),\r\n isEmailVerified: this.getIsEmailVerified(),\r\n customerStatus: this.getCustomerStatus()\r\n };\r\n }\r\n\r\n /**\r\n * Gets the unique identifier for the customer.\r\n * @returns The customer ID.\r\n */\r\n getId(): string {\r\n return this.id;\r\n }\r\n\r\n /**\r\n * Gets the email address of the customer.\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 phone number of the customer.\r\n * @returns The phone number.\r\n */\r\n getPhone(): string | undefined {\r\n return this.phone;\r\n }\r\n\r\n\r\n /**\r\n * Gets the first name of the customer.\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 /**\r\n * Gets the last name of the customer.\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 customer.\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 * Checks if the customer's email address has been verified.\r\n * @returns True if the email is verified, false otherwise.\r\n */\r\n getIsEmailVerified(): boolean {\r\n return this.isEmailVerified;\r\n }\r\n\r\n\r\n /**\r\n * Gets the customer's current statuses as an array.\r\n * @returns An array of CustomerStatus enum values.\r\n */\r\n getCustomerStatus(): CustomerStatus[] {\r\n return Array.from(this.customerStatus);\r\n }\r\n\r\n /**\r\n * Checks if the customer has a specific status.\r\n * Note: This method currently returns void. It should likely return boolean.\r\n * @param customerStatus - The status to check for.\r\n * @returns True if the status exists, false otherwise.\r\n */\r\n hasCustomerStatus(customerStatus: CustomerStatus): boolean {\r\n return this.customerStatus.has(customerStatus);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Classes/Customer.ts"],"names":["CustomerStatus","CustomerModel","BaseModel","data","date","withId","customerStatus"],"mappings":"sCAEYA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,OAAU,CAAA,SAAA,CACVA,EAAA,eAAkB,CAAA,iBAAA,CAClBA,CAAA,CAAA,cAAA,CAAiB,gBACjBA,CAAAA,CAAAA,CAAA,UAAY,WACZA,CAAAA,CAAAA,CAAA,eAAiB,gBACjBA,CAAAA,CAAAA,CAAA,UAAY,WACZA,CAAAA,CAAAA,CAAA,WAAc,CAAA,aAAA,CAPJA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CA6BSC,EAArB,cAA2CC,CAAU,CACzC,EACA,CAAA,KAAA,CACA,MACA,SACA,CAAA,QAAA,CACA,OACA,CAAA,eAAA,CACA,cAQV,CAAA,WAAA,CAAYC,EAA0BC,CAAa,CAAA,IAAI,KAAQ,CAC7D,KAAA,CAAMD,EAAMC,CAAI,CAAA,CAChB,IAAK,CAAA,EAAA,CAAKD,CAAK,CAAA,EAAA,CACf,KAAK,KAAQA,CAAAA,CAAAA,CAAK,MAClB,IAAK,CAAA,KAAA,CAAQA,EAAK,KAClB,CAAA,IAAA,CAAK,SAAYA,CAAAA,CAAAA,CAAK,SACtB,CAAA,IAAA,CAAK,SAAWA,CAAK,CAAA,QAAA,CACrB,KAAK,OAAUA,CAAAA,CAAAA,CAAK,SAAW,EAC/B,CAAA,IAAA,CAAK,eAAkBA,CAAAA,CAAAA,CAAK,eAAmB,EAAA,CAAA,CAAA,CAC/C,KAAK,cAAiB,CAAA,IAAI,IACxB,CAAC,GAAIA,EAAK,cAAiB,CAAA,KAAA,CAAM,IAAqBA,CAAAA,CAAAA,CAAK,cAAc,CAAA,CAAI,EAAK,CAAA,SAAsB,CAC1G,EACF,CAUA,WAAWE,CAAkB,CAAA,CAAA,CAAA,CAA6C,CACxE,OAAO,CACL,GAAG,MAAM,UAAW,EAAA,CACpB,GAAIA,CAAS,CAAA,CAAE,GAAI,IAAK,CAAA,KAAA,EAAQ,CAAA,CAAI,EAAC,CACrC,MAAO,IAAK,CAAA,QAAA,GACZ,KAAO,CAAA,IAAA,CAAK,UACZ,CAAA,SAAA,CAAW,IAAK,CAAA,YAAA,EAChB,CAAA,QAAA,CAAU,KAAK,WAAY,EAAA,CAC3B,QAAS,IAAK,CAAA,UAAA,GACd,eAAiB,CAAA,IAAA,CAAK,kBAAmB,EAAA,CACzC,cAAgB,CAAA,IAAA,CAAK,mBACvB,CACF,CAMA,KAAgB,EAAA,CACd,OAAO,IAAK,CAAA,EACd,CAMA,QAAA,EAAmB,CACjB,OAAO,KAAK,KACd,CAMA,UAA+B,CAC7B,OAAO,KAAK,KACd,CAOA,YAAuB,EAAA,CACrB,OAAO,IAAA,CAAK,SACd,CAOA,WAAA,EAAsB,CACpB,OAAO,IAAA,CAAK,QACd,CAMA,UAAA,EAAqB,CACnB,OAAO,IAAK,CAAA,OACd,CAMA,kBAA8B,EAAA,CAC5B,OAAO,IAAK,CAAA,eACd,CAOA,iBAAsC,EAAA,CACpC,OAAO,KAAA,CAAM,IAAK,CAAA,IAAA,CAAK,cAAc,CACvC,CAQA,iBAAkBC,CAAAA,CAAAA,CAAyC,CACzD,OAAO,KAAK,cAAe,CAAA,GAAA,CAAIA,CAAc,CAC/C,CACF","file":"Customer.mjs","sourcesContent":["import BaseModel, { BaseAttributes, BaseData } from \"./Base\";\r\n\r\nexport enum CustomerStatus {\r\n CREATED = \"CREATED\",\r\n REGISTERED_USER = \"REGISTERED_USER\",\r\n ACTIVATED_USER = \"ACTIVATED_USER\",\r\n EMAIL_OTP = \"EMAIL_OTP\",\r\n EMAIL_PASSWORD = \"EMAIL_PASSWORD\",\r\n PHONE_OTP = \"PHONE_OTP\",\r\n GOOGLE_AUTH = \"GOOGLE_AUTH\"\r\n}\r\n\r\nexport type CustomerAttributes = BaseAttributes & {\r\n id: string;\r\n email: string;\r\n phone?: string;\r\n firstName: string;\r\n lastName: string;\r\n company?: string;\r\n isEmailVerified?: boolean;\r\n customerStatus?: Set<CustomerStatus>;\r\n};\r\n\r\n\r\ntype CustomerDataWithArrayStatus = Omit<CustomerAttributes, 'customerStatus'> & BaseData & { customerStatus: CustomerStatus[]; }\r\nexport type CustomerData = Required<Omit<CustomerDataWithArrayStatus, 'phone'>> & { phone?: string };\r\nexport type CustomerDataWithOutId = Omit<CustomerData, 'id'>;\r\n\r\n/**\r\n * Represents a customer entity, managing customer information and status.\r\n */\r\nexport default class CustomerModel extends BaseModel {\r\n protected id: string;\r\n protected email: string;\r\n protected phone?: string;\r\n protected firstName: string;\r\n protected lastName: string;\r\n protected company: string;\r\n protected isEmailVerified: boolean;\r\n protected customerStatus: Set<CustomerStatus>;\r\n\r\n /**\r\n * Creates an instance of CustomerModel.\r\n * Initializes customer properties and ensures the CREATED status is always present.\r\n * @param data - The initial attributes for the customer.\r\n * @param date - Optional date object for setting creation/modification times (defaults to now).\r\n */\r\n constructor(data: CustomerAttributes, date: Date = new Date()) {\r\n super(data, date);\r\n this.id = data.id;\r\n this.email = data.email;\r\n this.phone = data.phone;\r\n this.firstName = data.firstName;\r\n this.lastName = data.lastName;\r\n this.company = data.company ?? '';\r\n this.isEmailVerified = data.isEmailVerified ?? false;\r\n this.customerStatus = new Set<CustomerStatus>(\r\n [...(data.customerStatus ? Array.from<CustomerStatus>(data.customerStatus) : []), CustomerStatus.CREATED]\r\n );\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the customer's current state.\r\n * Can optionally exclude the customer ID. Includes base model details.\r\n * @param withId - If true, includes the 'id' field. Defaults to false.\r\n * @returns CustomerData or CustomerDataWithOutId object suitable for serialization.\r\n */\r\n getDetails(withId?: false): CustomerDataWithOutId;\r\n getDetails(withId: true): CustomerData;\r\n getDetails(withId: boolean = false): CustomerData | CustomerDataWithOutId {\r\n return {\r\n ...super.getDetails(),\r\n ...(withId ? { id: this.getId() } : {}),\r\n email: this.getEmail(),\r\n phone: this.getPhone(),\r\n firstName: this.getFirstName(),\r\n lastName: this.getLastName(),\r\n company: this.getCompany(),\r\n isEmailVerified: this.getIsEmailVerified(),\r\n customerStatus: this.getCustomerStatus()\r\n };\r\n }\r\n\r\n /**\r\n * Gets the unique identifier for the customer.\r\n * @returns The customer ID.\r\n */\r\n getId(): string {\r\n return this.id;\r\n }\r\n\r\n /**\r\n * Gets the email address of the customer.\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 phone number of the customer.\r\n * @returns The phone number.\r\n */\r\n getPhone(): string | undefined {\r\n return this.phone;\r\n }\r\n\r\n\r\n /**\r\n * Gets the first name of the customer.\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 /**\r\n * Gets the last name of the customer.\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 customer.\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 * Checks if the customer's email address has been verified.\r\n * @returns True if the email is verified, false otherwise.\r\n */\r\n getIsEmailVerified(): boolean {\r\n return this.isEmailVerified;\r\n }\r\n\r\n\r\n /**\r\n * Gets the customer's current statuses as an array.\r\n * @returns An array of CustomerStatus enum values.\r\n */\r\n getCustomerStatus(): CustomerStatus[] {\r\n return Array.from(this.customerStatus);\r\n }\r\n\r\n /**\r\n * Checks if the customer has a specific status.\r\n * Note: This method currently returns void. It should likely return boolean.\r\n * @param customerStatus - The status to check for.\r\n * @returns True if the status exists, false otherwise.\r\n */\r\n hasCustomerStatus(customerStatus: CustomerStatus): boolean {\r\n return this.customerStatus.has(customerStatus);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"sources":["../../src/Classes/Customer.ts"],"names":["CustomerStatus","CustomerModel","BaseModel","data","date","withId","customerStatus"],"mappings":"sCAGYA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,OAAU,CAAA,SAAA,CACVA,EAAA,eAAkB,CAAA,iBAAA,CAClBA,CAAA,CAAA,cAAA,CAAiB,gBACjBA,CAAAA,CAAAA,CAAA,UAAY,WACZA,CAAAA,CAAAA,CAAA,eAAiB,gBACjBA,CAAAA,CAAAA,CAAA,UAAY,WACZA,CAAAA,CAAAA,CAAA,WAAc,CAAA,aAAA,CAPJA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CA6BSC,EAArB,cAA2CC,CAAU,CACzC,EACA,CAAA,KAAA,CACA,MACA,SACA,CAAA,QAAA,CACA,OACA,CAAA,eAAA,CACA,cAQV,CAAA,WAAA,CAAYC,EAA0BC,CAAa,CAAA,IAAI,KAAQ,CAC7D,KAAA,CAAMD,EAAMC,CAAI,CAAA,CAChB,IAAK,CAAA,EAAA,CAAKD,CAAK,CAAA,EAAA,CACf,KAAK,KAAQA,CAAAA,CAAAA,CAAK,MAClB,IAAK,CAAA,KAAA,CAAQA,EAAK,KAClB,CAAA,IAAA,CAAK,SAAYA,CAAAA,CAAAA,CAAK,SACtB,CAAA,IAAA,CAAK,SAAWA,CAAK,CAAA,QAAA,CACrB,KAAK,OAAUA,CAAAA,CAAAA,CAAK,SAAW,EAC/B,CAAA,IAAA,CAAK,eAAkBA,CAAAA,CAAAA,CAAK,eAAmB,EAAA,CAAA,CAAA,CAC/C,KAAK,cAAiB,CAAA,IAAI,IACxB,CAAC,GAAIA,EAAK,cAAiB,CAAA,KAAA,CAAM,IAAqBA,CAAAA,CAAAA,CAAK,cAAc,CAAA,CAAI,EAAK,CAAA,SAAsB,CAC1G,EACF,CAUA,WAAWE,CAAkB,CAAA,CAAA,CAAA,CAA6C,CACxE,OAAO,CACL,GAAG,MAAM,UAAW,EAAA,CACpB,GAAIA,CAAS,CAAA,CAAE,GAAI,IAAK,CAAA,KAAA,EAAQ,CAAA,CAAI,EAAC,CACrC,MAAO,IAAK,CAAA,QAAA,GACZ,KAAO,CAAA,IAAA,CAAK,UACZ,CAAA,SAAA,CAAW,IAAK,CAAA,YAAA,EAChB,CAAA,QAAA,CAAU,KAAK,WAAY,EAAA,CAC3B,QAAS,IAAK,CAAA,UAAA,GACd,eAAiB,CAAA,IAAA,CAAK,kBAAmB,EAAA,CACzC,cAAgB,CAAA,IAAA,CAAK,mBACvB,CACF,CAMA,KAAgB,EAAA,CACd,OAAO,IAAK,CAAA,EACd,CAMA,QAAA,EAAmB,CACjB,OAAO,KAAK,KACd,CAMA,UAA+B,CAC7B,OAAO,KAAK,KACd,CAOA,YAAuB,EAAA,CACrB,OAAO,IAAA,CAAK,SACd,CAOA,WAAA,EAAsB,CACpB,OAAO,IAAA,CAAK,QACd,CAMA,UAAA,EAAqB,CACnB,OAAO,IAAK,CAAA,OACd,CAMA,kBAA8B,EAAA,CAC5B,OAAO,IAAK,CAAA,eACd,CAOA,iBAAsC,EAAA,CACpC,OAAO,KAAA,CAAM,IAAK,CAAA,IAAA,CAAK,cAAc,CACvC,CAQA,iBAAkBC,CAAAA,CAAAA,CAAyC,CACzD,OAAO,KAAK,cAAe,CAAA,GAAA,CAAIA,CAAc,CAC/C,CACF","file":"Customer.mjs","sourcesContent":["import BaseModel, { BaseAttributes, BaseData } from \"./Base\";\r\nimport { E164Phone } from \"./Common\";\r\n\r\nexport enum CustomerStatus {\r\n CREATED = \"CREATED\",\r\n REGISTERED_USER = \"REGISTERED_USER\",\r\n ACTIVATED_USER = \"ACTIVATED_USER\",\r\n EMAIL_OTP = \"EMAIL_OTP\",\r\n EMAIL_PASSWORD = \"EMAIL_PASSWORD\",\r\n PHONE_OTP = \"PHONE_OTP\",\r\n GOOGLE_AUTH = \"GOOGLE_AUTH\"\r\n}\r\n\r\nexport type CustomerAttributes = BaseAttributes & {\r\n id: string;\r\n email: string;\r\n phone?: E164Phone;\r\n firstName: string;\r\n lastName: string;\r\n company?: string;\r\n isEmailVerified?: boolean;\r\n customerStatus?: Set<CustomerStatus>;\r\n};\r\n\r\n\r\ntype CustomerDataWithArrayStatus = Omit<CustomerAttributes, 'customerStatus'> & BaseData & { customerStatus: CustomerStatus[]; }\r\nexport type CustomerData = Required<Omit<CustomerDataWithArrayStatus, 'phone'>> & { phone?: E164Phone };\r\nexport type CustomerDataWithOutId = Omit<CustomerData, 'id'>;\r\n\r\n/**\r\n * Represents a customer entity, managing customer information and status.\r\n */\r\nexport default class CustomerModel extends BaseModel {\r\n protected id: string;\r\n protected email: string;\r\n protected phone?: E164Phone;\r\n protected firstName: string;\r\n protected lastName: string;\r\n protected company: string;\r\n protected isEmailVerified: boolean;\r\n protected customerStatus: Set<CustomerStatus>;\r\n\r\n /**\r\n * Creates an instance of CustomerModel.\r\n * Initializes customer properties and ensures the CREATED status is always present.\r\n * @param data - The initial attributes for the customer.\r\n * @param date - Optional date object for setting creation/modification times (defaults to now).\r\n */\r\n constructor(data: CustomerAttributes, date: Date = new Date()) {\r\n super(data, date);\r\n this.id = data.id;\r\n this.email = data.email;\r\n this.phone = data.phone;\r\n this.firstName = data.firstName;\r\n this.lastName = data.lastName;\r\n this.company = data.company ?? '';\r\n this.isEmailVerified = data.isEmailVerified ?? false;\r\n this.customerStatus = new Set<CustomerStatus>(\r\n [...(data.customerStatus ? Array.from<CustomerStatus>(data.customerStatus) : []), CustomerStatus.CREATED]\r\n );\r\n }\r\n\r\n /**\r\n * Gets a plain data object representing the customer's current state.\r\n * Can optionally exclude the customer ID. Includes base model details.\r\n * @param withId - If true, includes the 'id' field. Defaults to false.\r\n * @returns CustomerData or CustomerDataWithOutId object suitable for serialization.\r\n */\r\n getDetails(withId?: false): CustomerDataWithOutId;\r\n getDetails(withId: true): CustomerData;\r\n getDetails(withId: boolean = false): CustomerData | CustomerDataWithOutId {\r\n return {\r\n ...super.getDetails(),\r\n ...(withId ? { id: this.getId() } : {}),\r\n email: this.getEmail(),\r\n phone: this.getPhone(),\r\n firstName: this.getFirstName(),\r\n lastName: this.getLastName(),\r\n company: this.getCompany(),\r\n isEmailVerified: this.getIsEmailVerified(),\r\n customerStatus: this.getCustomerStatus()\r\n };\r\n }\r\n\r\n /**\r\n * Gets the unique identifier for the customer.\r\n * @returns The customer ID.\r\n */\r\n getId(): string {\r\n return this.id;\r\n }\r\n\r\n /**\r\n * Gets the email address of the customer.\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 phone number of the customer.\r\n * @returns The phone number.\r\n */\r\n getPhone(): string | undefined {\r\n return this.phone;\r\n }\r\n\r\n\r\n /**\r\n * Gets the first name of the customer.\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 /**\r\n * Gets the last name of the customer.\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 customer.\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 * Checks if the customer's email address has been verified.\r\n * @returns True if the email is verified, false otherwise.\r\n */\r\n getIsEmailVerified(): boolean {\r\n return this.isEmailVerified;\r\n }\r\n\r\n\r\n /**\r\n * Gets the customer's current statuses as an array.\r\n * @returns An array of CustomerStatus enum values.\r\n */\r\n getCustomerStatus(): CustomerStatus[] {\r\n return Array.from(this.customerStatus);\r\n }\r\n\r\n /**\r\n * Checks if the customer has a specific status.\r\n * Note: This method currently returns void. It should likely return boolean.\r\n * @param customerStatus - The status to check for.\r\n * @returns True if the status exists, false otherwise.\r\n */\r\n hasCustomerStatus(customerStatus: CustomerStatus): boolean {\r\n return this.customerStatus.has(customerStatus);\r\n }\r\n}\r\n"]}
@@ -1,7 +1,7 @@
1
1
  import AddressModel, { AddressData } from './Address.mjs';
2
2
  import BaseModel, { BaseAttributes } from './Base.mjs';
3
3
  import '../Auth/index.mjs';
4
- import '../Common-Du2s_43h.mjs';
4
+ import '../Common-CJ_dZU3n.mjs';
5
5
  import './Enum.mjs';
6
6
 
7
7
  type CustomerAddressAttributes = BaseAttributes & {
@@ -1,7 +1,7 @@
1
1
  import AddressModel, { AddressData } from './Address.js';
2
2
  import BaseModel, { BaseAttributes } from './Base.js';
3
3
  import '../Auth/index.js';
4
- import '../Common-BsfeCt6G.js';
4
+ import '../Common-D01ijYt3.js';
5
5
  import './Enum.js';
6
6
 
7
7
  type CustomerAddressAttributes = BaseAttributes & {
@@ -78,9 +78,31 @@ declare enum LineItemState {
78
78
  CANCELLED = "CANCELLED",
79
79
  RETURN_REQUESTED = "RETURN_REQUESTED",
80
80
  RETURNED = "RETURNED",
81
+ UNDELIVERED = "UNDELIVERED",
81
82
  REFUND_INITIATED = "REFUND_INITIATED",
82
83
  REFUNDED = "REFUNDED",
83
84
  ON_HOLD = "ON_HOLD"
84
85
  }
86
+ /**
87
+ * InvoiceState defines the lifecycle of a financial document.
88
+ */
89
+ declare enum InvoiceState {
90
+ /** Preliminary document being drafted; has no legal or financial impact yet. */
91
+ DRAFT = "DRAFT",
92
+ /** Legally finalized document sent to the customer; tax and revenue are recognized. */
93
+ ISSUED = "ISSUED",
94
+ /**
95
+ * Cancelled before the document became legally effective or reached the customer.
96
+ * Used for Failed Deliveries (RTO) where the invoice was not yet reported to GST portals.
97
+ */
98
+ VOIDED = "VOIDED",
99
+ /**
100
+ * Officially reversed due to a sales return or refund after the document was legally finalized.
101
+ * Marks that the tax liability of this invoice has been nullified elsewhere.
102
+ */
103
+ CREDITED = "CREDITED",
104
+ /** Marked once the invoice has been officially filed with tax authorities (e.g. GSTR-1). */
105
+ REPORTED = "REPORTED"
106
+ }
85
107
 
86
- export { ChargeImpact, ChargeType, CountryCurrencyMap, CurrencyLocaleMap, CurrencySymbolMap, GenderCategory, ImageCategory, LineItemState, LocaleCountryMap, LocaleLanguageMap, OperationalCountry, OperationalCountryCurrency, OperationalLanguage, OperationalLocale, TaxSystem };
108
+ export { ChargeImpact, ChargeType, CountryCurrencyMap, CurrencyLocaleMap, CurrencySymbolMap, GenderCategory, ImageCategory, InvoiceState, LineItemState, LocaleCountryMap, LocaleLanguageMap, OperationalCountry, OperationalCountryCurrency, OperationalLanguage, OperationalLocale, TaxSystem };
@@ -78,9 +78,31 @@ declare enum LineItemState {
78
78
  CANCELLED = "CANCELLED",
79
79
  RETURN_REQUESTED = "RETURN_REQUESTED",
80
80
  RETURNED = "RETURNED",
81
+ UNDELIVERED = "UNDELIVERED",
81
82
  REFUND_INITIATED = "REFUND_INITIATED",
82
83
  REFUNDED = "REFUNDED",
83
84
  ON_HOLD = "ON_HOLD"
84
85
  }
86
+ /**
87
+ * InvoiceState defines the lifecycle of a financial document.
88
+ */
89
+ declare enum InvoiceState {
90
+ /** Preliminary document being drafted; has no legal or financial impact yet. */
91
+ DRAFT = "DRAFT",
92
+ /** Legally finalized document sent to the customer; tax and revenue are recognized. */
93
+ ISSUED = "ISSUED",
94
+ /**
95
+ * Cancelled before the document became legally effective or reached the customer.
96
+ * Used for Failed Deliveries (RTO) where the invoice was not yet reported to GST portals.
97
+ */
98
+ VOIDED = "VOIDED",
99
+ /**
100
+ * Officially reversed due to a sales return or refund after the document was legally finalized.
101
+ * Marks that the tax liability of this invoice has been nullified elsewhere.
102
+ */
103
+ CREDITED = "CREDITED",
104
+ /** Marked once the invoice has been officially filed with tax authorities (e.g. GSTR-1). */
105
+ REPORTED = "REPORTED"
106
+ }
85
107
 
86
- export { ChargeImpact, ChargeType, CountryCurrencyMap, CurrencyLocaleMap, CurrencySymbolMap, GenderCategory, ImageCategory, LineItemState, LocaleCountryMap, LocaleLanguageMap, OperationalCountry, OperationalCountryCurrency, OperationalLanguage, OperationalLocale, TaxSystem };
108
+ export { ChargeImpact, ChargeType, CountryCurrencyMap, CurrencyLocaleMap, CurrencySymbolMap, GenderCategory, ImageCategory, InvoiceState, LineItemState, LocaleCountryMap, LocaleLanguageMap, OperationalCountry, OperationalCountryCurrency, OperationalLanguage, OperationalLocale, TaxSystem };
@@ -1,2 +1,2 @@
1
- 'use strict';var I=(n=>(n.IN="IN",n))(I||{}),D=(n=>(n.INR="INR",n))(D||{}),p=(R=>(R["en-IN"]="en-IN",R["kn-IN"]="kn-IN",R))(p||{}),r=(E=>(E.en="en",E.kn="kn",E))(r||{}),U={"en-IN":"en","kn-IN":"kn"},x={"en-IN":"IN","kn-IN":"IN"},a={IN:"INR"},M={INR:"\u20B9"},P={INR:"en-IN"},l=(o=>(o.MALE="Male",o.FEMALE="Female",o.UNISEX="Unisex",o.KIDS="Kids",o.BOY="Boy",o.GIRL="Girl",o.GENERAL="General",o))(l||{}),u=(E=>(E.PRIMARY="PRIMARY",E.GALLERY="GALLERY",E))(u||{}),A=(E=>(E.SHIPPING="SHIPPING",E.ADJUSTMENT="ADJUSTMENT",E))(A||{}),T=(E=>(E.ADD="ADD",E.SUBTRACT="SUBTRACT",E))(T||{}),c=(n=>(n.GST="GST",n))(c||{}),L=(N=>(N.INITIAL="INITIAL",N.PROCESSING="PROCESSING",N.SHIPPED="SHIPPED",N.DELIVERED="DELIVERED",N.CANCELLED="CANCELLED",N.RETURN_REQUESTED="RETURN_REQUESTED",N.RETURNED="RETURNED",N.REFUND_INITIATED="REFUND_INITIATED",N.REFUNDED="REFUNDED",N.ON_HOLD="ON_HOLD",N))(L||{});exports.ChargeImpact=T;exports.ChargeType=A;exports.CountryCurrencyMap=a;exports.CurrencyLocaleMap=P;exports.CurrencySymbolMap=M;exports.GenderCategory=l;exports.ImageCategory=u;exports.LineItemState=L;exports.LocaleCountryMap=x;exports.LocaleLanguageMap=U;exports.OperationalCountry=I;exports.OperationalCountryCurrency=D;exports.OperationalLanguage=r;exports.OperationalLocale=p;exports.TaxSystem=c;//# sourceMappingURL=Enum.js.map
1
+ 'use strict';var I=(R=>(R.IN="IN",R))(I||{}),p=(R=>(R.INR="INR",R))(p||{}),r=(n=>(n["en-IN"]="en-IN",n["kn-IN"]="kn-IN",n))(r||{}),u=(E=>(E.en="en",E.kn="kn",E))(u||{}),c={"en-IN":"en","kn-IN":"kn"},M={"en-IN":"IN","kn-IN":"IN"},C={IN:"INR"},a={INR:"\u20B9"},F={INR:"en-IN"},T=(N=>(N.MALE="Male",N.FEMALE="Female",N.UNISEX="Unisex",N.KIDS="Kids",N.BOY="Boy",N.GIRL="Girl",N.GENERAL="General",N))(T||{}),l=(E=>(E.PRIMARY="PRIMARY",E.GALLERY="GALLERY",E))(l||{}),O=(E=>(E.SHIPPING="SHIPPING",E.ADJUSTMENT="ADJUSTMENT",E))(O||{}),A=(E=>(E.ADD="ADD",E.SUBTRACT="SUBTRACT",E))(A||{}),U=(R=>(R.GST="GST",R))(U||{}),L=(D=>(D.INITIAL="INITIAL",D.PROCESSING="PROCESSING",D.SHIPPED="SHIPPED",D.DELIVERED="DELIVERED",D.CANCELLED="CANCELLED",D.RETURN_REQUESTED="RETURN_REQUESTED",D.RETURNED="RETURNED",D.UNDELIVERED="UNDELIVERED",D.REFUND_INITIATED="REFUND_INITIATED",D.REFUNDED="REFUNDED",D.ON_HOLD="ON_HOLD",D))(L||{}),x=(o=>(o.DRAFT="DRAFT",o.ISSUED="ISSUED",o.VOIDED="VOIDED",o.CREDITED="CREDITED",o.REPORTED="REPORTED",o))(x||{});exports.ChargeImpact=A;exports.ChargeType=O;exports.CountryCurrencyMap=C;exports.CurrencyLocaleMap=F;exports.CurrencySymbolMap=a;exports.GenderCategory=T;exports.ImageCategory=l;exports.InvoiceState=x;exports.LineItemState=L;exports.LocaleCountryMap=M;exports.LocaleLanguageMap=c;exports.OperationalCountry=I;exports.OperationalCountryCurrency=p;exports.OperationalLanguage=u;exports.OperationalLocale=r;exports.TaxSystem=U;//# sourceMappingURL=Enum.js.map
2
2
  //# sourceMappingURL=Enum.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Classes/Enum.ts"],"names":["OperationalCountry","OperationalCountryCurrency","OperationalLocale","OperationalLanguage","LocaleLanguageMap","LocaleCountryMap","CountryCurrencyMap","CurrencySymbolMap","CurrencyLocaleMap","GenderCategory","ImageCategory","ChargeType","ChargeImpact","TaxSystem","LineItemState"],"mappings":"aAGO,IAAKA,CACGA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,EAAK,CAAA,IAAA,CADRA,OAAA,EAIAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACGA,CAAA,CAAA,GAAA,CAAM,KADTA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAIAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACGA,EAAA,OAAU,CAAA,CAAA,OAAA,CACCA,CAAA,CAAA,OAAA,CAAA,CAAU,OAFxBA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAKAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,EAAK,CAAA,IAAA,CACLA,CAAA,CAAA,EAAA,CAAK,KAFKA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAKCC,CAAoE,CAAA,CAC9E,QAA6B,IAC7B,CAAA,OAAA,CAA6B,IAChC,CAAA,CAEaC,CAAkE,CAAA,CAC5E,OAA6B,CAAA,IAAA,CAC7B,QAA6B,IAChC,CAAA,CAKaC,CAAqB,CAAA,CACnB,GAAwB,KACvC,CAAA,CAEaC,CAAoB,CAAA,CAC9B,IAAiC,QACpC,CAAA,CAEaC,CAAoB,CAAA,CAC9B,GAAiC,CAAA,OACpC,CAKYC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,IAAO,CAAA,MAAA,CACPA,CAAA,CAAA,MAAA,CAAS,SACTA,CAAA,CAAA,MAAA,CAAS,QACTA,CAAAA,CAAAA,CAAA,KAAO,MACPA,CAAAA,CAAAA,CAAA,GAAM,CAAA,KAAA,CACNA,CAAA,CAAA,IAAA,CAAO,MACPA,CAAAA,CAAAA,CAAA,QAAU,SAPAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAUAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,OAAU,CAAA,SAAA,CACVA,CAAA,CAAA,OAAA,CAAU,UAFAA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAKAC,CACVA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,QAAW,CAAA,UAAA,CACXA,CAAA,CAAA,UAAA,CAAa,aAFHA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAKAC,CACRA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,IAAM,KACNA,CAAAA,CAAAA,CAAA,QAAW,CAAA,UAAA,CAFHA,OAAA,EAKAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAA,CAAA,GAAA,CAAM,KADIA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,EAkBAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,EAAA,OAAU,CAAA,SAAA,CACVA,CAAA,CAAA,UAAA,CAAa,aACbA,CAAA,CAAA,OAAA,CAAU,SACVA,CAAAA,CAAAA,CAAA,UAAY,WACZA,CAAAA,CAAAA,CAAA,SAAY,CAAA,WAAA,CACZA,CAAA,CAAA,gBAAA,CAAmB,kBACnBA,CAAAA,CAAAA,CAAA,SAAW,UACXA,CAAAA,CAAAA,CAAA,gBAAmB,CAAA,kBAAA,CACnBA,EAAA,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 ChargeType {\r\n SHIPPING = 'SHIPPING',\r\n ADJUSTMENT = 'ADJUSTMENT'\r\n}\r\n\r\nexport enum ChargeImpact {\r\n ADD = \"ADD\",\r\n SUBTRACT = \"SUBTRACT\",\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}"]}
1
+ {"version":3,"sources":["../../src/Classes/Enum.ts"],"names":["OperationalCountry","OperationalCountryCurrency","OperationalLocale","OperationalLanguage","LocaleLanguageMap","LocaleCountryMap","CountryCurrencyMap","CurrencySymbolMap","CurrencyLocaleMap","GenderCategory","ImageCategory","ChargeType","ChargeImpact","TaxSystem","LineItemState","InvoiceState"],"mappings":"aAGO,IAAKA,OACGA,CAAA,CAAA,EAAA,CAAK,IADRA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAIAC,CACGA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,GAAM,CAAA,KAAA,CADTA,OAAA,EAIAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACGA,EAAA,OAAU,CAAA,CAAA,OAAA,CACCA,EAAA,OAAU,CAAA,CAAA,OAAA,CAFxBA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAKAC,OACVA,CAAA,CAAA,EAAA,CAAK,KACLA,CAAA,CAAA,EAAA,CAAK,KAFKA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAKCC,CAAoE,CAAA,CAC9E,QAA6B,IAC7B,CAAA,OAAA,CAA6B,IAChC,CAEaC,CAAAA,CAAAA,CAAkE,CAC5E,OAA6B,CAAA,IAAA,CAC7B,OAA6B,CAAA,IAChC,EAKaC,CAAqB,CAAA,CACnB,EAAwB,CAAA,KACvC,EAEaC,CAAoB,CAAA,CAC9B,GAAiC,CAAA,QACpC,EAEaC,CAAoB,CAAA,CAC9B,IAAiC,OACpC,CAAA,CAKYC,OACVA,CAAA,CAAA,IAAA,CAAO,MACPA,CAAAA,CAAAA,CAAA,OAAS,QACTA,CAAAA,CAAAA,CAAA,OAAS,QACTA,CAAAA,CAAAA,CAAA,KAAO,MACPA,CAAAA,CAAAA,CAAA,GAAM,CAAA,KAAA,CACNA,EAAA,IAAO,CAAA,MAAA,CACPA,EAAA,OAAU,CAAA,SAAA,CAPAA,OAAA,EAUAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACVA,CAAA,CAAA,OAAA,CAAU,UACVA,CAAA,CAAA,OAAA,CAAU,SAFAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAKAC,CACVA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,QAAW,CAAA,UAAA,CACXA,EAAA,UAAa,CAAA,YAAA,CAFHA,OAAA,EAKAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GACRA,EAAA,GAAM,CAAA,KAAA,CACNA,CAAA,CAAA,QAAA,CAAW,WAFHA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAKAC,OACVA,CAAA,CAAA,GAAA,CAAM,MADIA,CAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAkBAC,CACVA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,CAAA,QAAU,SACVA,CAAAA,CAAAA,CAAA,WAAa,YACbA,CAAAA,CAAAA,CAAA,QAAU,SACVA,CAAAA,CAAAA,CAAA,SAAY,CAAA,WAAA,CACZA,EAAA,SAAY,CAAA,WAAA,CACZA,CAAA,CAAA,gBAAA,CAAmB,mBACnBA,CAAA,CAAA,QAAA,CAAW,UACXA,CAAAA,CAAAA,CAAA,YAAc,aACdA,CAAAA,CAAAA,CAAA,iBAAmB,kBACnBA,CAAAA,CAAAA,CAAA,SAAW,UACXA,CAAAA,CAAAA,CAAA,OAAU,CAAA,SAAA,CAXAA,OAAA,EAgBAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAEVA,EAAA,KAAQ,CAAA,OAAA,CAGRA,EAAA,MAAS,CAAA,QAAA,CAMTA,CAAA,CAAA,MAAA,CAAS,SAMTA,CAAA,CAAA,QAAA,CAAW,WAGXA,CAAA,CAAA,QAAA,CAAW,WApBDA,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 ChargeType {\r\n SHIPPING = 'SHIPPING',\r\n ADJUSTMENT = 'ADJUSTMENT'\r\n}\r\n\r\nexport enum ChargeImpact {\r\n ADD = \"ADD\",\r\n SUBTRACT = \"SUBTRACT\",\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 UNDELIVERED = \"UNDELIVERED\",\r\n REFUND_INITIATED = \"REFUND_INITIATED\",\r\n REFUNDED = \"REFUNDED\",\r\n ON_HOLD = \"ON_HOLD\",\r\n}\r\n/**\r\n * InvoiceState defines the lifecycle of a financial document.\r\n */\r\nexport enum InvoiceState {\r\n /** Preliminary document being drafted; has no legal or financial impact yet. */\r\n DRAFT = \"DRAFT\",\r\n\r\n /** Legally finalized document sent to the customer; tax and revenue are recognized. */\r\n ISSUED = \"ISSUED\",\r\n\r\n /** \r\n * Cancelled before the document became legally effective or reached the customer.\r\n * Used for Failed Deliveries (RTO) where the invoice was not yet reported to GST portals.\r\n */\r\n VOIDED = \"VOIDED\",\r\n\r\n /**\r\n * Officially reversed due to a sales return or refund after the document was legally finalized.\r\n * Marks that the tax liability of this invoice has been nullified elsewhere.\r\n */\r\n CREDITED = \"CREDITED\",\r\n \r\n /** Marked once the invoice has been officially filed with tax authorities (e.g. GSTR-1). */\r\n REPORTED = \"REPORTED\"\r\n}\r\n"]}
@@ -1,2 +1,2 @@
1
- export{m as ChargeImpact,l as ChargeType,g as CountryCurrencyMap,i as CurrencyLocaleMap,h as CurrencySymbolMap,j as GenderCategory,k as ImageCategory,o as LineItemState,f as LocaleCountryMap,e as LocaleLanguageMap,a as OperationalCountry,b as OperationalCountryCurrency,d as OperationalLanguage,c as OperationalLocale,n as TaxSystem}from'../chunk-QK4XJ3GB.mjs';//# sourceMappingURL=Enum.mjs.map
1
+ export{m as ChargeImpact,l as ChargeType,g as CountryCurrencyMap,i as CurrencyLocaleMap,h as CurrencySymbolMap,j as GenderCategory,k as ImageCategory,p as InvoiceState,o as LineItemState,f as LocaleCountryMap,e as LocaleLanguageMap,a as OperationalCountry,b as OperationalCountryCurrency,d as OperationalLanguage,c as OperationalLocale,n as TaxSystem}from'../chunk-TPIIACE7.mjs';//# sourceMappingURL=Enum.mjs.map
2
2
  //# sourceMappingURL=Enum.mjs.map
@@ -1,5 +1,5 @@
1
1
  import BaseModel, { BaseAttributes, BaseData } from './Base.mjs';
2
- import { C as CountryCode } from '../Common-Du2s_43h.mjs';
2
+ import { C as CountryCode } from '../Common-CJ_dZU3n.mjs';
3
3
  import { SelectionAttributes } from './Product.mjs';
4
4
  import '../Auth/index.mjs';
5
5
  import './Enum.mjs';
@@ -1,5 +1,5 @@
1
1
  import BaseModel, { BaseAttributes, BaseData } from './Base.js';
2
- import { C as CountryCode } from '../Common-BsfeCt6G.js';
2
+ import { C as CountryCode } from '../Common-D01ijYt3.js';
3
3
  import { SelectionAttributes } from './Product.js';
4
4
  import '../Auth/index.js';
5
5
  import './Enum.js';
@@ -1,2 +1,2 @@
1
- 'use strict';var Z=require('crypto');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Z__default=/*#__PURE__*/_interopDefault(Z);var w=new Uint8Array(256),D=w.length;function $(){return D>w.length-16&&(Z__default.default.randomFillSync(w),D=0),w.slice(D,D+=16)}var K=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function J(r){return typeof r=="string"&&K.test(r)}var Q=J;var c=[];for(let r=0;r<256;++r)c.push((r+256).toString(16).slice(1));function T(r,e=0){return c[r[e+0]]+c[r[e+1]]+c[r[e+2]]+c[r[e+3]]+"-"+c[r[e+4]]+c[r[e+5]]+"-"+c[r[e+6]]+c[r[e+7]]+"-"+c[r[e+8]]+c[r[e+9]]+"-"+c[r[e+10]]+c[r[e+11]]+c[r[e+12]]+c[r[e+13]]+c[r[e+14]]+c[r[e+15]]}function X(r){if(!Q(r))throw TypeError("Invalid UUID");let e,t=new Uint8Array(16);return t[0]=(e=parseInt(r.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=e&255,t[4]=(e=parseInt(r.slice(9,13),16))>>>8,t[5]=e&255,t[6]=(e=parseInt(r.slice(14,18),16))>>>8,t[7]=e&255,t[8]=(e=parseInt(r.slice(19,23),16))>>>8,t[9]=e&255,t[10]=(e=parseInt(r.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=e&255,t}var V=X;function W(r){r=unescape(encodeURIComponent(r));let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t));return e}var _="6ba7b810-9dad-11d1-80b4-00c04fd430c8",ee="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function k(r,e,t){function i(n,s,l,y){var u;if(typeof n=="string"&&(n=W(n)),typeof s=="string"&&(s=V(s)),((u=s)===null||u===void 0?void 0:u.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let d=new Uint8Array(16+n.length);if(d.set(s),d.set(n,s.length),d=t(d),d[6]=d[6]&15|e,d[8]=d[8]&63|128,l){y=y||0;for(let S=0;S<16;++S)l[y+S]=d[S];return l}return T(d)}try{i.name=r;}catch{}return i.DNS=_,i.URL=ee,i}var F={randomUUID:Z__default.default.randomUUID};function re(r,e,t){if(F.randomUUID&&!e&&!r)return F.randomUUID();r=r||{};let i=r.random||(r.rng||$)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let n=0;n<16;++n)e[t+n]=i[n];return e}return T(i)}var z=re;function ne(r){return Array.isArray(r)?r=Buffer.from(r):typeof r=="string"&&(r=Buffer.from(r,"utf8")),Z__default.default.createHash("sha1").update(r).digest()}var G=ne;var se=k("v5",80,G),B=se;var j=r=>structuredClone(r),O=class{customFields;constructor(e,t=new Date){this.customFields={...e.customFields};}getCustomField(e){let t=this.customFields[e];return t==null?t:j(t)}setCustomField(e,t){this.customFields[e]=t;}getAllCustomFields(){return j(this.customFields)}},f=class extends O{version;createdAt;modifiedAt;modifiedBy;constructor(e,t=new Date){super(e),this.version=e.version??1,this.createdAt=e.createdAt&&!isNaN(Date.parse(e.createdAt))?new Date(e.createdAt).toISOString():t.toISOString(),this.modifiedAt=e.modifiedAt&&!isNaN(Date.parse(e.modifiedAt))?new Date(e.modifiedAt).toISOString():t.toISOString(),this.modifiedBy={...e.modifiedBy};}getDetails(){return {customFields:this.getAllCustomFields(),version:this.getVersion(),createdAt:this.getCreatedAt(),modifiedAt:this.getModifiedAt(),modifiedBy:this.getModifiedBy()}}getVersion(){return this.version}getCreatedAt(){return this.createdAt}getCreatedAtTime(){return new Date(this.createdAt).getTime()}getModifiedAt(){return this.modifiedAt}getModifiedAtTime(){return new Date(this.modifiedAt).getTime()}getModifiedBy(){return {...this.modifiedBy}}setModifiedBy(e,t,i,n){this.modifiedBy={id:e,authType:t,requestId:i,lambdaName:n};}};var b={"en-IN":"en","kn-IN":"kn"};var H={INR:"\u20B9"},Y={INR:"en-IN"};var M=class extends Error{constructor(e){super(`Duplicate selection attribute found: ${e}`),this.name="DuplicateSelectionAttributeError";}};var p=class extends Error{constructor(e="Failed to parse selection attributes key."){super(`SelectionAttributeParseError: ${e}`),this.name="SelectionAttributeParseError";}};var v=class extends Error{constructor(e="Tax category is not valid."){super(`InvalidTaxCategory: ${e}`),this.name="InvalidTaxCategoryError";}},E=class extends Error{constructor(e="Minimum quantity must be greater than zero."){super(`InvalidMinQuantity: ${e}`),this.name="InvalidMinQuantityError";}},L=class extends Error{constructor(e){super(`InvalidTieredPrice: ${e}`),this.name="InvalidTieredPriceError";}},N=class extends Error{constructor(e="Quantity must be greater than zero."){super(`InvalidQuantity: ${e}`),this.name="InvalidQuantityError";}},R=class extends Error{constructor(e){super(`NoApplicableTier: Quantity ${e} does not meet the minimum purchase requirement.`),this.name="NoApplicableTierError";}};var C=class extends Error{constructor(e="Amount cannot be negative."){super(`InvalidAmount: ${e}`),this.name="InvalidPriceAmountError";}},A=class extends Error{constructor(e="Currency code is required."){super(`InvalidCurrency: ${e}`),this.name="InvalidCurrencyCodeError";}},m=class extends Error{constructor(e="Cannot perform operation on prices with different currencies."){super(`CurrencyMismatch: ${e}`),this.name="CurrencyMismatchError";}},g=class extends Error{constructor(e){super(`InvalidArgument: ${e}`),this.name="InvalidArgumentError";}},P=class extends Error{constructor(e="Invalid image source configuration."){super(`InvalidImageSource: ${e}`),this.name="InvalidImageSourceError";}};var x=class{sources;alt;order;label;constructor(e){if(this.sources={...e.sources},this.alt=e.alt,this.order=e.order,this.label=e.label,!this.sources.original)throw new P("ImageInfoModel cannot be created without an 'original' source URL.")}getSources(){return {...this.sources}}getSource(e){return this.sources[e]||this.sources.original}getAlt(){return this.alt}getOrder(){return this.order}getLabel(){return this.label}setAlt(e){this.alt=e;}setOrder(e){this.order=e;}setLabel(e){this.label=e;}setSource(e,t){if(t===void 0){if(e==="original")throw new P("Cannot remove the 'original' image source.");delete this.sources[e];}else this.sources[e]=t;}getDetails(){return {sources:this.getSources(),alt:this.getAlt(),order:this.getOrder(),label:this.getLabel()}}};var I=class r{#e;amount;currency;constructor(e){if(this.#e="PriceModel",e.amount<0)throw new C("Amount cannot be negative.");if(!e.currency)throw new A("Currency code is required.");this.currency=e.currency,this.amount=parseFloat(e.amount.toFixed(r.getPrecisionPlaces(this.currency)));}get kind(){return this.#e}static isPriceModel(e){return typeof e=="object"&&e!==null&&e.kind==="PriceModel"}getCurrency(){return this.currency}getAmount(){return this.amount}getDetails(){return {amount:this.amount,currency:this.currency}}getPreciseAmount(e){return parseFloat(e.toFixed(r.getPrecisionPlaces(this.currency)))}compareTo(e){if(r.isPriceModel(e)){if(this.currency!==e.getCurrency())throw new m("Cannot compare prices in different currencies.")}else throw new g("Must be a PriceModel instance.");return this.getPreciseAmount(this.amount-e.getAmount())}add(e){if(r.isPriceModel(e)){if(this.currency!==e.getCurrency())throw new m("Cannot add prices in different currencies.")}else throw new g("Must be a PriceModel instance.");return new r({amount:this.getPreciseAmount(this.amount+e.getAmount()),currency:this.currency})}subtract(e){if(r.isPriceModel(e)){if(this.currency!==e.getCurrency())throw new m("Cannot subtract prices in different currencies.")}else throw new g("Must be a PriceModel instance.");return new r({amount:this.getPreciseAmount(this.amount-e.getAmount()),currency:this.currency})}multiply(e){if(r.isPriceModel(e)){if(this.currency!==e.getCurrency())throw new m("Cannot multiply prices in different currencies.");return new r({amount:this.getPreciseAmount(this.amount*e.getAmount()),currency:this.currency})}else if(typeof e=="number"&&e>=0)return new r({amount:this.getPreciseAmount(this.amount*e),currency:this.currency});throw new g("Must be a non-negative number.")}divide(e){if(r.isPriceModel(e)){if(this.currency!==e.getCurrency())throw new m("Cannot divide prices in different currencies.");return new r({amount:this.getPreciseAmount(this.amount/e.getAmount()),currency:this.currency})}else if(typeof e=="number"&&e>0)return new r({amount:this.getPreciseAmount(this.amount/e),currency:this.currency});throw new g("Must be a positive number.")}min(...e){if(e.length===0)throw new g("Must provide at least one PriceModel.");return e.reduce((t,i)=>{if(r.isPriceModel(i)){if(t.getCurrency()!==i.getCurrency())throw new m("Cannot compare prices in different currencies.")}else throw new g("Must be a PriceModel instance.");return t.compareTo(i)<0?t:i},this)}max(...e){if(e.length===0)throw new g("Must provide at least one PriceModel.");return e.reduce((t,i)=>{if(r.isPriceModel(i)){if(t.getCurrency()!==i.getCurrency())throw new m("Cannot compare prices in different currencies.")}else throw new g("Must be a PriceModel instance.");return t.compareTo(i)>0?t:i},this)}zero(){return new r({currency:this.currency,amount:0})}isZero(){return this.amount===0}round(){return new r({currency:this.currency,amount:this.getRoundedAmount()})}getRoundedAmount(){return r.getRoundedAmount(this.amount,this.currency)}getFormattedString(){return r.getFormattedString(this.amount,this.currency)}toString(){return this.getFormattedString()}static getFormattedString(e,t,i={displayAsInteger:!1,style:"currency",currencyDisplay:"symbol"}){let n=Y[t];if(!t||!n)throw new A("Invalid currency code for formatting.");let s=e,l=i.displayAsInteger?0:r.getDecimalPlaces(t),y={style:i.style??"currency",currency:t,signDisplay:"never",currencyDisplay:i.currencyDisplay,minimumFractionDigits:l,maximumFractionDigits:l};i.displayAsInteger&&(s=Math.ceil(s));try{return new Intl.NumberFormat(n,y).format(s)}catch(u){return console.error(`Error formatting price for currency "${t}" and locale "${n}":`,u),`${H[t]??t} ${r.addThousandSeparators(s.toFixed(l))}`}}static getDecimalPlaces(e){switch(e){case"INR":default:return 2}}static getPrecisionPlaces(e){switch(e){case"INR":default:return 6}}static addThousandSeparators(e){let t=e.split("."),i=t[0],n=t.length>1?"."+t[1]:"";return i.replace(/\B(?=(\d{3})+(?!\d))/g,",")+n}static getRoundedAmount(e,t){if(e<0)throw new C("Amount cannot be negative for rounding.");if(t===void 0)throw new A("Invalid currency code for rounding.");let i=r.getDecimalPlaces(t),n=Math.pow(10,i);return Math.round(e*n)/n}};var U=class{baseUnitPrice;taxCategory;tiers;constructor(e){let t=new I(e.baseUnitPrice);if(!e.taxCategory)throw new v;let i=(e.tiers??[]).map(u=>({minQuantity:u.minQuantity,unitPrice:new I(u.unitPrice)})).sort((u,d)=>u.minQuantity-d.minQuantity);if(i.some(u=>u.minQuantity<=0))throw new E;let s=i.some(u=>u.unitPrice.getCurrency()!==t.getCurrency()),l=i.some((u,d)=>d>0&&u.unitPrice.compareTo(i[d-1].unitPrice)>0),y=i[0]?.unitPrice.compareTo(t)>0;if(s||l||y)throw new L("Tiers must share the same currency and must not increase in unit price.");this.baseUnitPrice=t,this.taxCategory=e.taxCategory,this.tiers=i;}getBaseUnitPrice(){return this.baseUnitPrice}getTaxCategory(){return this.taxCategory}getTiers(){return this.tiers.map(e=>({minQuantity:e.minQuantity,unitPrice:e.unitPrice}))}getDetails(){return {baseUnitPrice:this.baseUnitPrice.getDetails(),taxCategory:this.taxCategory,tiers:this.tiers.map(e=>({minQuantity:e.minQuantity,unitPrice:e.unitPrice.getDetails()}))}}getApplicableTier(e){if(e<=0)throw new N;for(let t=this.tiers.length-1;t>=0;t--)if(e>=this.tiers[t].minQuantity){let i=this.tiers[t];return {minQuantity:i.minQuantity,unitPrice:i.unitPrice}}throw new R(e)}getMinQuantity(){return this.tiers[0]?.minQuantity??1}getMaxDiscountPercent(){if(!this.tiers.length)return 0;let e=this.tiers[this.tiers.length-1].unitPrice.getAmount(),t=this.baseUnitPrice.getAmount();return (t-e)/t*100}};var h=class r extends f{id;key;name;description;slug;brand;pricing;variants;targetGender;attributes;specifications;categories;isActive;searchTags;static productKeyRegex=/^(?!\s)(?!.*\s$)[A-Z0-9-]{4,16}$/;static productSKURegex=/^(?!\s)(?!.*\s$)[A-Z0-9-]{4,16}$/;static generateSelectionAttributesKey(e){if(typeof e!="object")throw new p("Selection attributes must be an object");return Object.keys(e).filter(i=>e[i]!==void 0&&i.toLowerCase()!=="size").sort().map(i=>e[i].name?`${i}:c+${e[i].name}`:`${i}:${e[i]}`).join("|").toLowerCase()}static parseSelectionAttributesKey(e){try{let t={},i=e.split("|");for(let n of i){let[s,l]=n.split(":");l.startsWith("c+")?t[s]={name:l.slice(2)}:t[s]=l;}return t}catch(t){throw new p(t?.message)}}constructor(e,t=new Date){super(e,t),this.id=e.id,this.key=e.key,this.name={...e.name},this.description={...e.description},this.slug={...e.slug},this.brand=e.brand,this.pricing=Object.keys(e.pricing).reduce((n,s)=>(e.pricing[s]&&(n[s]=new U(e.pricing[s])),n),{}),this.targetGender=e.targetGender,this.attributes=a.deepClone(e.attributes),this.specifications=a.deepClone(e.specifications),this.categories=a.deepClone(e.categories);let i=new Set;this.variants=(e.variants||[]).map(n=>{if(!n.selectionAttributes||typeof n.selectionAttributes!="object")throw new p("Selection attributes are required");this.checkSelectionAttributes(n.selectionAttributes);let s=r.generateSelectionAttributesKey(n.selectionAttributes);if(i.has(s))throw new M(s);return i.add(s),{sku:n.sku,selectionAttributes:n.selectionAttributes,images:{primary:new x(n.images.primary),gallery:(n.images.gallery||[]).map(l=>new x(l))}}}),this.isActive=e.isActive,this.searchTags=e.searchTags?a.deepClone(e.searchTags):{en:[]};}getId(){return this.id}getKey(){return this.key}getName(e){return e?this.name[e]??this.name[b[e]]??this.name.en:a.deepClone(this.name)}getDescription(e){return e?this.description[e]??this.description[b[e]]??this.description.en:a.deepClone(this.description)}getSlug(e){return e?this.slug[e]??this.slug[b[e]]??this.slug.en:a.deepClone(this.slug)}getBrand(){return this.brand}getPriceDetails(e){return e?this.pricing[e]??null:{...this.pricing}}getAttributes(){return a.deepClone(this.attributes)}getVariants(){return this.variants.map(e=>({sku:e.sku,selectionAttributes:a.deepClone(e.selectionAttributes),images:{primary:e.images.primary,gallery:[...e.images.gallery]}}))}getImagesBySelectionAttributes(e){let t=r.generateSelectionAttributesKey(e),i=this.variants.find(n=>r.generateSelectionAttributesKey(n.selectionAttributes)===t);return i?{primary:i.images.primary,gallery:[...i.images.gallery]}:null}getImages(e,t){switch(t){case"PRIMARY":return this.getImagesBySelectionAttributes(e)?.primary??this.variants[0]?.images?.primary;case"GALLERY":return this.getImagesBySelectionAttributes(e)?.gallery??[];default:return this.getImagesBySelectionAttributes(e)??{primary:this.variants[0]?.images?.primary,gallery:[]}}}getIsActive(){return this.isActive}getTargetGender(){return this.targetGender}getCategories(){return a.deepClone(this.categories)}getSpecifications(e){return e?a.deepClone(this.specifications[e]??this.specifications[b[e]]??this.specifications.en):a.deepClone(this.specifications)}getSearchTags(e){return e?a.deepClone(this.searchTags[e]??this.searchTags[b[e]]??this.searchTags.en):a.deepClone(this.searchTags)}getDetails(){let e=super.getDetails();return {id:this.getId(),key:this.getKey(),name:this.getName(),description:this.getDescription(),slug:this.getSlug(),brand:this.getBrand(),pricing:Object.keys(this.pricing).reduce((t,i)=>(this.pricing[i]&&(t[i]=this.pricing[i]?.getDetails()),t),{}),attributes:this.getAttributes(),variants:this.variants.map(t=>({sku:t.sku,selectionAttributes:a.deepClone(t.selectionAttributes),images:{primary:t.images.primary.getDetails(),gallery:t.images.gallery.map(i=>i.getDetails())}})),isActive:this.getIsActive(),targetGender:this.getTargetGender(),categories:this.getCategories(),specifications:this.getSpecifications(),searchTags:this.getSearchTags(),...e}}checkSelectionAttributes(e){if(!e||typeof e!="object")throw new p("Selection attributes are required");Object.keys(this.attributes).forEach(t=>{if(t.toLowerCase()==="size")return;let i=this.attributes[t],n=e[t];if(n===void 0)throw new p(`Selection attribute '${t}' is missing`);if(typeof i=="string"){if(typeof n!="string"||i!==n)throw new p(`Selection attribute '${t}' is invalid`)}else if(Array.isArray(i)){if(i.length>0&&typeof i[0]=="string"){if(typeof n!="string"||!i.includes(n))throw new p(`Selection attribute '${t}' is invalid`)}else if(typeof n!="object"||!("name"in n)||i.findIndex(s=>s.name===n.name)<0)throw new p(`Selection attribute '${t}' is invalid`)}});}validateSelectionAttribute(e){let t=r.generateSelectionAttributesKey(e);return this.variants.some(i=>r.generateSelectionAttributesKey(i.selectionAttributes)===t)}validateSize(e){return this.attributes.size.includes(e)}};var oe={isUUID:r=>/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r),isEmail:r=>/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(r),isURL:r=>/^(http|https):\/\/[^ "]+$/.test(r),generateUUID:(r,e)=>e&&r?B(r,e):z(),generateSearchId:(r,e)=>`${r}#${h.generateSelectionAttributesKey(e)}`,getKeyfromSearchId:r=>{let[e,t]=r.split("#");return {key:e,selectionAttributes:h.parseSelectionAttributesKey(t)}},deepClone(r){return structuredClone(r)}},a=oe;var q=class extends f{productKey;stocks;constructor(e,t=new Date){super(e,t),this.productKey=e.productKey,this.stocks=e.stocks.map(i=>({selectionAttributes:a.deepClone(i.selectionAttributes),size:i.size,available:i.available,country:i.country}));}getProductKey(){return this.productKey}getStockData(e,t,i){let n=e?h.generateSelectionAttributesKey(e):void 0;return this.stocks.filter(s=>!(n&&h.generateSelectionAttributesKey(s.selectionAttributes)!==n||t&&s.size!==t||i&&s.country!==i)).map(s=>({selectionAttributes:a.deepClone(s.selectionAttributes),size:s.size,available:s.available,country:s.country}))}getDetails(){return {...super.getDetails(),productKey:this.getProductKey(),stocks:this.getStockData()}}};exports.InventoryModel=q;//# sourceMappingURL=Inventory.js.map
1
+ 'use strict';var Z=require('crypto');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Z__default=/*#__PURE__*/_interopDefault(Z);var w=new Uint8Array(256),S=w.length;function $(){return S>w.length-16&&(Z__default.default.randomFillSync(w),S=0),w.slice(S,S+=16)}var K=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function J(r){return typeof r=="string"&&K.test(r)}var V=J;var c=[];for(let r=0;r<256;++r)c.push((r+256).toString(16).slice(1));function T(r,e=0){return c[r[e+0]]+c[r[e+1]]+c[r[e+2]]+c[r[e+3]]+"-"+c[r[e+4]]+c[r[e+5]]+"-"+c[r[e+6]]+c[r[e+7]]+"-"+c[r[e+8]]+c[r[e+9]]+"-"+c[r[e+10]]+c[r[e+11]]+c[r[e+12]]+c[r[e+13]]+c[r[e+14]]+c[r[e+15]]}function X(r){if(!V(r))throw TypeError("Invalid UUID");let e,t=new Uint8Array(16);return t[0]=(e=parseInt(r.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=e&255,t[4]=(e=parseInt(r.slice(9,13),16))>>>8,t[5]=e&255,t[6]=(e=parseInt(r.slice(14,18),16))>>>8,t[7]=e&255,t[8]=(e=parseInt(r.slice(19,23),16))>>>8,t[9]=e&255,t[10]=(e=parseInt(r.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=e&255,t}var Q=X;function W(r){r=unescape(encodeURIComponent(r));let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t));return e}var _="6ba7b810-9dad-11d1-80b4-00c04fd430c8",ee="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function F(r,e,t){function i(n,s,l,y){var u;if(typeof n=="string"&&(n=W(n)),typeof s=="string"&&(s=Q(s)),((u=s)===null||u===void 0?void 0:u.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let d=new Uint8Array(16+n.length);if(d.set(s),d.set(n,s.length),d=t(d),d[6]=d[6]&15|e,d[8]=d[8]&63|128,l){y=y||0;for(let D=0;D<16;++D)l[y+D]=d[D];return l}return T(d)}try{i.name=r;}catch{}return i.DNS=_,i.URL=ee,i}var k={randomUUID:Z__default.default.randomUUID};function re(r,e,t){if(k.randomUUID&&!e&&!r)return k.randomUUID();r=r||{};let i=r.random||(r.rng||$)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let n=0;n<16;++n)e[t+n]=i[n];return e}return T(i)}var z=re;function ne(r){return Array.isArray(r)?r=Buffer.from(r):typeof r=="string"&&(r=Buffer.from(r,"utf8")),Z__default.default.createHash("sha1").update(r).digest()}var G=ne;var se=F("v5",80,G),B=se;var j=r=>structuredClone(r),O=class{customFields;constructor(e,t=new Date){this.customFields={...e.customFields};}getCustomField(e){let t=this.customFields[e];return t==null?t:j(t)}setCustomField(e,t){this.customFields[e]=t;}getAllCustomFields(){return j(this.customFields)}},f=class extends O{version;createdAt;modifiedAt;modifiedBy;constructor(e,t=new Date){super(e),this.version=e.version??1,this.createdAt=e.createdAt&&!isNaN(Date.parse(e.createdAt))?new Date(e.createdAt).toISOString():t.toISOString(),this.modifiedAt=e.modifiedAt&&!isNaN(Date.parse(e.modifiedAt))?new Date(e.modifiedAt).toISOString():t.toISOString(),this.modifiedBy={...e.modifiedBy};}getDetails(){return {customFields:this.getAllCustomFields(),version:this.getVersion(),createdAt:this.getCreatedAt(),modifiedAt:this.getModifiedAt(),modifiedBy:this.getModifiedBy()}}getVersion(){return this.version}getCreatedAt(){return this.createdAt}getCreatedAtTime(){return new Date(this.createdAt).getTime()}getModifiedAt(){return this.modifiedAt}getModifiedAtTime(){return new Date(this.modifiedAt).getTime()}getModifiedBy(){return {...this.modifiedBy}}setModifiedBy(e,t,i,n){this.modifiedBy={id:e,authType:t,requestId:i,lambdaName:n};}};var b={"en-IN":"en","kn-IN":"kn"};var H={INR:"\u20B9"},Y={INR:"en-IN"};var E=class extends Error{constructor(e){super(`Duplicate selection attribute found: ${e}`),this.name="DuplicateSelectionAttributeError";}};var p=class extends Error{constructor(e="Failed to parse selection attributes key."){super(`SelectionAttributeParseError: ${e}`),this.name="SelectionAttributeParseError";}};var M=class extends Error{constructor(e="Tax category is not valid."){super(`InvalidTaxCategory: ${e}`),this.name="InvalidTaxCategoryError";}},v=class extends Error{constructor(e="Minimum quantity must be greater than zero."){super(`InvalidMinQuantity: ${e}`),this.name="InvalidMinQuantityError";}},L=class extends Error{constructor(e){super(`InvalidTieredPrice: ${e}`),this.name="InvalidTieredPriceError";}},R=class extends Error{constructor(e="Quantity must be greater than zero."){super(`InvalidQuantity: ${e}`),this.name="InvalidQuantityError";}},N=class extends Error{constructor(e){super(`NoApplicableTier: Quantity ${e} does not meet the minimum purchase requirement.`),this.name="NoApplicableTierError";}};var C=class extends Error{constructor(e="Amount cannot be negative."){super(`InvalidAmount: ${e}`),this.name="InvalidPriceAmountError";}},A=class extends Error{constructor(e="Currency code is required."){super(`InvalidCurrency: ${e}`),this.name="InvalidCurrencyCodeError";}},m=class extends Error{constructor(e="Cannot perform operation on prices with different currencies."){super(`CurrencyMismatch: ${e}`),this.name="CurrencyMismatchError";}},g=class extends Error{constructor(e){super(`InvalidArgument: ${e}`),this.name="InvalidArgumentError";}},P=class extends Error{constructor(e="Invalid image source configuration."){super(`InvalidImageSource: ${e}`),this.name="InvalidImageSourceError";}};var x=class{sources;alt;order;label;constructor(e){if(this.sources={...e.sources},this.alt=e.alt,this.order=e.order,this.label=e.label,!this.sources.original)throw new P("ImageInfoModel cannot be created without an 'original' source URL.")}getSources(){return {...this.sources}}getSource(e){return this.sources[e]||this.sources.original}getAlt(){return this.alt}getOrder(){return this.order}getLabel(){return this.label}setAlt(e){this.alt=e;}setOrder(e){this.order=e;}setLabel(e){this.label=e;}setSource(e,t){if(t===void 0){if(e==="original")throw new P("Cannot remove the 'original' image source.");delete this.sources[e];}else this.sources[e]=t;}getDetails(){return {sources:this.getSources(),alt:this.getAlt(),order:this.getOrder(),label:this.getLabel()}}};var I=class r{#e;amount;currency;constructor(e){if(this.#e="PriceModel",e.amount<0)throw new C("Amount cannot be negative.");if(!e.currency)throw new A("Currency code is required.");this.currency=e.currency,this.amount=parseFloat(e.amount.toFixed(r.getPrecisionPlaces(this.currency)));}get kind(){return this.#e}static isPriceModel(e){return typeof e=="object"&&e!==null&&e.kind==="PriceModel"}getCurrency(){return this.currency}getAmount(){return this.amount}getDetails(){return {amount:this.amount,currency:this.currency}}getPreciseAmount(e){return parseFloat(e.toFixed(r.getPrecisionPlaces(this.currency)))}compareTo(e){if(r.isPriceModel(e)){if(this.currency!==e.getCurrency())throw new m("Cannot compare prices in different currencies.")}else throw new g("Must be a PriceModel instance.");return this.getPreciseAmount(this.amount-e.getAmount())}add(e){if(r.isPriceModel(e)){if(this.currency!==e.getCurrency())throw new m("Cannot add prices in different currencies.")}else throw new g("Must be a PriceModel instance.");return new r({amount:this.getPreciseAmount(this.amount+e.getAmount()),currency:this.currency})}subtract(e){if(r.isPriceModel(e)){if(this.currency!==e.getCurrency())throw new m("Cannot subtract prices in different currencies.")}else throw new g("Must be a PriceModel instance.");return new r({amount:this.getPreciseAmount(this.amount-e.getAmount()),currency:this.currency})}multiply(e){if(r.isPriceModel(e)){if(this.currency!==e.getCurrency())throw new m("Cannot multiply prices in different currencies.");return new r({amount:this.getPreciseAmount(this.amount*e.getAmount()),currency:this.currency})}else if(typeof e=="number"&&e>=0)return new r({amount:this.getPreciseAmount(this.amount*e),currency:this.currency});throw new g("Must be a non-negative number.")}divide(e){if(r.isPriceModel(e)){if(this.currency!==e.getCurrency())throw new m("Cannot divide prices in different currencies.");return new r({amount:this.getPreciseAmount(this.amount/e.getAmount()),currency:this.currency})}else if(typeof e=="number"&&e>0)return new r({amount:this.getPreciseAmount(this.amount/e),currency:this.currency});throw new g("Must be a positive number.")}min(...e){if(e.length===0)throw new g("Must provide at least one PriceModel.");return e.reduce((t,i)=>{if(r.isPriceModel(i)){if(t.getCurrency()!==i.getCurrency())throw new m("Cannot compare prices in different currencies.")}else throw new g("Must be a PriceModel instance.");return t.compareTo(i)<0?t:i},this)}max(...e){if(e.length===0)throw new g("Must provide at least one PriceModel.");return e.reduce((t,i)=>{if(r.isPriceModel(i)){if(t.getCurrency()!==i.getCurrency())throw new m("Cannot compare prices in different currencies.")}else throw new g("Must be a PriceModel instance.");return t.compareTo(i)>0?t:i},this)}zero(){return new r({currency:this.currency,amount:0})}isZero(){return this.amount===0}round(){return new r({currency:this.currency,amount:this.getRoundedAmount()})}getRoundedAmount(){return r.getRoundedAmount(this.amount,this.currency)}getFormattedString(){return r.getFormattedString(this.amount,this.currency)}toString(){return this.getFormattedString()}static getFormattedString(e,t,i={displayAsInteger:!1,style:"currency",currencyDisplay:"symbol"}){let n=Y[t];if(!t||!n)throw new A("Invalid currency code for formatting.");let s=e,l=i.displayAsInteger?0:r.getDecimalPlaces(t),y={style:i.style??"currency",currency:t,signDisplay:"never",currencyDisplay:i.currencyDisplay,minimumFractionDigits:l,maximumFractionDigits:l};i.displayAsInteger&&(s=Math.ceil(s));try{return new Intl.NumberFormat(n,y).format(s)}catch(u){return console.error(`Error formatting price for currency "${t}" and locale "${n}":`,u),`${H[t]??t} ${r.addThousandSeparators(s.toFixed(l))}`}}static getDecimalPlaces(e){switch(e){case"INR":default:return 2}}static getPrecisionPlaces(e){switch(e){case"INR":default:return 6}}static addThousandSeparators(e){let t=e.split("."),i=t[0],n=t.length>1?"."+t[1]:"";return i.replace(/\B(?=(\d{3})+(?!\d))/g,",")+n}static getRoundedAmount(e,t){if(e<0)throw new C("Amount cannot be negative for rounding.");if(t===void 0)throw new A("Invalid currency code for rounding.");let i=r.getDecimalPlaces(t),n=Math.pow(10,i);return Math.round(e*n)/n}};var U=class{baseUnitPrice;taxCategory;tiers;constructor(e){let t=new I(e.baseUnitPrice);if(!e.taxCategory)throw new M;let i=(e.tiers??[]).map(u=>({minQuantity:u.minQuantity,unitPrice:new I(u.unitPrice)})).sort((u,d)=>u.minQuantity-d.minQuantity);if(i.some(u=>u.minQuantity<=0))throw new v;let s=i.some(u=>u.unitPrice.getCurrency()!==t.getCurrency()),l=i.some((u,d)=>d>0&&u.unitPrice.compareTo(i[d-1].unitPrice)>0),y=i[0]?.unitPrice.compareTo(t)>0;if(s||l||y)throw new L("Tiers must share the same currency and must not increase in unit price.");this.baseUnitPrice=t,this.taxCategory=e.taxCategory,this.tiers=i;}getBaseUnitPrice(){return this.baseUnitPrice}getTaxCategory(){return this.taxCategory}getTiers(){return this.tiers.map(e=>({minQuantity:e.minQuantity,unitPrice:e.unitPrice}))}getDetails(){return {baseUnitPrice:this.baseUnitPrice.getDetails(),taxCategory:this.taxCategory,tiers:this.tiers.map(e=>({minQuantity:e.minQuantity,unitPrice:e.unitPrice.getDetails()}))}}getApplicableTier(e){if(e<=0)throw new R;for(let t=this.tiers.length-1;t>=0;t--)if(e>=this.tiers[t].minQuantity){let i=this.tiers[t];return {minQuantity:i.minQuantity,unitPrice:i.unitPrice}}throw new N(e)}getMinQuantity(){return this.tiers[0]?.minQuantity??1}getMaxDiscountPercent(){if(!this.tiers.length)return 0;let e=this.tiers[this.tiers.length-1].unitPrice.getAmount(),t=this.baseUnitPrice.getAmount();return (t-e)/t*100}};var h=class r extends f{id;key;name;description;slug;brand;pricing;variants;targetGender;attributes;specifications;categories;isActive;searchTags;static productKeyRegex=/^(?!\s)(?!.*\s$)[A-Z0-9-]{4,16}$/;static productSKURegex=/^(?!\s)(?!.*\s$)[A-Z0-9-]{4,16}$/;static generateSelectionAttributesKey(e){if(typeof e!="object")throw new p("Selection attributes must be an object");return Object.keys(e).filter(i=>e[i]!==void 0&&i.toLowerCase()!=="size").sort().map(i=>e[i].name?`${i}:c+${e[i].name}`:`${i}:${e[i]}`).join("|").toLowerCase()}static parseSelectionAttributesKey(e){try{let t={},i=e.split("|");for(let n of i){let[s,l]=n.split(":");l.startsWith("c+")?t[s]={name:l.slice(2)}:t[s]=l;}return t}catch(t){throw new p(t?.message)}}constructor(e,t=new Date){super(e,t),this.id=e.id,this.key=e.key,this.name={...e.name},this.description={...e.description},this.slug={...e.slug},this.brand=e.brand,this.pricing=Object.keys(e.pricing).reduce((n,s)=>(e.pricing[s]&&(n[s]=new U(e.pricing[s])),n),{}),this.targetGender=e.targetGender,this.attributes=a.deepClone(e.attributes),this.specifications=a.deepClone(e.specifications),this.categories=a.deepClone(e.categories);let i=new Set;this.variants=(e.variants||[]).map(n=>{if(!n.selectionAttributes||typeof n.selectionAttributes!="object")throw new p("Selection attributes are required");this.checkSelectionAttributes(n.selectionAttributes);let s=r.generateSelectionAttributesKey(n.selectionAttributes);if(i.has(s))throw new E(s);return i.add(s),{sku:n.sku,selectionAttributes:n.selectionAttributes,images:{primary:new x(n.images.primary),gallery:(n.images.gallery||[]).map(l=>new x(l))}}}),this.isActive=e.isActive,this.searchTags=e.searchTags?a.deepClone(e.searchTags):{en:[]};}getId(){return this.id}getKey(){return this.key}getName(e){return e?this.name[e]??this.name[b[e]]??this.name.en:a.deepClone(this.name)}getDescription(e){return e?this.description[e]??this.description[b[e]]??this.description.en:a.deepClone(this.description)}getSlug(e){return e?this.slug[e]??this.slug[b[e]]??this.slug.en:a.deepClone(this.slug)}getBrand(){return this.brand}getPriceDetails(e){return e?this.pricing[e]??null:{...this.pricing}}getAttributes(){return a.deepClone(this.attributes)}getVariants(){return this.variants.map(e=>({sku:e.sku,selectionAttributes:a.deepClone(e.selectionAttributes),images:{primary:e.images.primary,gallery:[...e.images.gallery]}}))}getImagesBySelectionAttributes(e){let t=r.generateSelectionAttributesKey(e),i=this.variants.find(n=>r.generateSelectionAttributesKey(n.selectionAttributes)===t);return i?{primary:i.images.primary,gallery:[...i.images.gallery]}:null}getImages(e,t){switch(t){case"PRIMARY":return this.getImagesBySelectionAttributes(e)?.primary??this.variants[0]?.images?.primary;case"GALLERY":return this.getImagesBySelectionAttributes(e)?.gallery??[];default:return this.getImagesBySelectionAttributes(e)??{primary:this.variants[0]?.images?.primary,gallery:[]}}}getIsActive(){return this.isActive}getTargetGender(){return this.targetGender}getCategories(){return a.deepClone(this.categories)}getSpecifications(e){return e?a.deepClone(this.specifications[e]??this.specifications[b[e]]??this.specifications.en):a.deepClone(this.specifications)}getSearchTags(e){return e?a.deepClone(this.searchTags[e]??this.searchTags[b[e]]??this.searchTags.en):a.deepClone(this.searchTags)}getDetails(){let e=super.getDetails();return {id:this.getId(),key:this.getKey(),name:this.getName(),description:this.getDescription(),slug:this.getSlug(),brand:this.getBrand(),pricing:Object.keys(this.pricing).reduce((t,i)=>(this.pricing[i]&&(t[i]=this.pricing[i]?.getDetails()),t),{}),attributes:this.getAttributes(),variants:this.variants.map(t=>({sku:t.sku,selectionAttributes:a.deepClone(t.selectionAttributes),images:{primary:t.images.primary.getDetails(),gallery:t.images.gallery.map(i=>i.getDetails())}})),isActive:this.getIsActive(),targetGender:this.getTargetGender(),categories:this.getCategories(),specifications:this.getSpecifications(),searchTags:this.getSearchTags(),...e}}checkSelectionAttributes(e){if(!e||typeof e!="object")throw new p("Selection attributes are required");Object.keys(this.attributes).forEach(t=>{if(t.toLowerCase()==="size")return;let i=this.attributes[t],n=e[t];if(n===void 0)throw new p(`Selection attribute '${t}' is missing`);if(typeof i=="string"){if(typeof n!="string"||i!==n)throw new p(`Selection attribute '${t}' is invalid`)}else if(Array.isArray(i)){if(i.length>0&&typeof i[0]=="string"){if(typeof n!="string"||!i.includes(n))throw new p(`Selection attribute '${t}' is invalid`)}else if(typeof n!="object"||!("name"in n)||i.findIndex(s=>s.name===n.name)<0)throw new p(`Selection attribute '${t}' is invalid`)}});}validateSelectionAttribute(e){let t=r.generateSelectionAttributesKey(e);return this.variants.some(i=>r.generateSelectionAttributesKey(i.selectionAttributes)===t)}validateSize(e){return this.attributes.size.includes(e)}};var oe={isUUID:r=>/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r),isEmail:r=>/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(r),isURL:r=>/^(http|https):\/\/[^ "]+$/.test(r),generateUUID:(r,e)=>e&&r?B(r,e):z(),generateSearchId:(r,e)=>`${r}#${h.generateSelectionAttributesKey(e)}`,getKeyfromSearchId:r=>{let[e,t]=r.split("#");return {key:e,selectionAttributes:h.parseSelectionAttributesKey(t)}},deepClone(r){return structuredClone(r)}},a=oe;var q=class extends f{productKey;stocks;constructor(e,t=new Date){super(e,t),this.productKey=e.productKey,this.stocks=e.stocks.map(i=>({selectionAttributes:a.deepClone(i.selectionAttributes),size:i.size,available:i.available,country:i.country}));}getProductKey(){return this.productKey}getStockData(e,t,i){let n=e?h.generateSelectionAttributesKey(e):void 0;return this.stocks.filter(s=>!(n&&h.generateSelectionAttributesKey(s.selectionAttributes)!==n||t&&s.size!==t||i&&s.country!==i)).map(s=>({selectionAttributes:a.deepClone(s.selectionAttributes),size:s.size,available:s.available,country:s.country}))}getDetails(){return {...super.getDetails(),productKey:this.getProductKey(),stocks:this.getStockData()}}};exports.InventoryModel=q;//# sourceMappingURL=Inventory.js.map
2
2
  //# sourceMappingURL=Inventory.js.map