b23-lib 3.4.1 → 3.5.0

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 (109) 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 +1 -1
  26. package/dist/Classes/Customer.d.ts +1 -1
  27. package/dist/Classes/CustomerAddress.d.mts +1 -1
  28. package/dist/Classes/CustomerAddress.d.ts +1 -1
  29. package/dist/Classes/Enum.d.mts +23 -1
  30. package/dist/Classes/Enum.d.ts +23 -1
  31. package/dist/Classes/Enum.js +1 -1
  32. package/dist/Classes/Enum.js.map +1 -1
  33. package/dist/Classes/Enum.mjs +1 -1
  34. package/dist/Classes/Inventory.d.mts +1 -1
  35. package/dist/Classes/Inventory.d.ts +1 -1
  36. package/dist/Classes/Inventory.js +1 -1
  37. package/dist/Classes/Inventory.js.map +1 -1
  38. package/dist/Classes/Inventory.mjs +1 -1
  39. package/dist/Classes/Invoice.d.mts +5 -2
  40. package/dist/Classes/Invoice.d.ts +5 -2
  41. package/dist/Classes/Invoice.js +1 -1
  42. package/dist/Classes/Invoice.js.map +1 -1
  43. package/dist/Classes/Invoice.mjs +1 -1
  44. package/dist/Classes/Invoice.mjs.map +1 -1
  45. package/dist/Classes/LineItem.d.mts +1 -1
  46. package/dist/Classes/LineItem.d.ts +1 -1
  47. package/dist/Classes/LineItem.js +1 -1
  48. package/dist/Classes/LineItem.js.map +1 -1
  49. package/dist/Classes/LineItem.mjs +1 -1
  50. package/dist/Classes/Order.d.mts +1 -1
  51. package/dist/Classes/Order.d.ts +1 -1
  52. package/dist/Classes/Order.js +1 -1
  53. package/dist/Classes/Order.js.map +1 -1
  54. package/dist/Classes/Order.mjs +1 -1
  55. package/dist/Classes/Payment.d.mts +1 -1
  56. package/dist/Classes/Payment.d.ts +1 -1
  57. package/dist/Classes/Price.d.mts +1 -1
  58. package/dist/Classes/Price.d.ts +1 -1
  59. package/dist/Classes/Price.js +1 -1
  60. package/dist/Classes/Price.js.map +1 -1
  61. package/dist/Classes/Price.mjs +1 -1
  62. package/dist/Classes/Product.d.mts +1 -1
  63. package/dist/Classes/Product.d.ts +1 -1
  64. package/dist/Classes/Product.js +1 -1
  65. package/dist/Classes/Product.js.map +1 -1
  66. package/dist/Classes/Product.mjs +1 -1
  67. package/dist/Classes/ShoppingContainer.d.mts +1 -1
  68. package/dist/Classes/ShoppingContainer.d.ts +1 -1
  69. package/dist/Classes/ShoppingContainer.js +1 -1
  70. package/dist/Classes/ShoppingContainer.js.map +1 -1
  71. package/dist/Classes/ShoppingContainer.mjs +1 -1
  72. package/dist/Classes/TaxRule.d.mts +1 -1
  73. package/dist/Classes/TaxRule.d.ts +1 -1
  74. package/dist/Classes/TaxRule.js +1 -1
  75. package/dist/Classes/TaxRule.js.map +1 -1
  76. package/dist/Classes/TaxRule.mjs +1 -1
  77. package/dist/Classes/TieredPrice.d.mts +1 -1
  78. package/dist/Classes/TieredPrice.d.ts +1 -1
  79. package/dist/Classes/TieredPrice.js +1 -1
  80. package/dist/Classes/TieredPrice.js.map +1 -1
  81. package/dist/Classes/TieredPrice.mjs +1 -1
  82. package/dist/{Common-BPgGKaZC.d.ts → Common-BsfeCt6G.d.ts} +1 -0
  83. package/dist/{Common-DY253_Gs.d.mts → Common-Du2s_43h.d.mts} +1 -0
  84. package/dist/{chunk-MHLRJ4IJ.mjs → chunk-4G7JC2EH.mjs} +2 -2
  85. package/dist/{chunk-MHLRJ4IJ.mjs.map → chunk-4G7JC2EH.mjs.map} +1 -1
  86. package/dist/{chunk-LI5JQ6UC.mjs → chunk-6ZKMKSAG.mjs} +2 -2
  87. package/dist/{chunk-LI5JQ6UC.mjs.map → chunk-6ZKMKSAG.mjs.map} +1 -1
  88. package/dist/{chunk-2POPOJGE.mjs → chunk-JYCGENPD.mjs} +2 -2
  89. package/dist/{chunk-2POPOJGE.mjs.map → chunk-JYCGENPD.mjs.map} +1 -1
  90. package/dist/{chunk-FCRJAAPY.mjs → chunk-S6LR7AUZ.mjs} +2 -2
  91. package/dist/{chunk-FCRJAAPY.mjs.map → chunk-S6LR7AUZ.mjs.map} +1 -1
  92. package/dist/chunk-TPIIACE7.mjs +2 -0
  93. package/dist/chunk-TPIIACE7.mjs.map +1 -0
  94. package/dist/{chunk-B2VFJRLS.mjs → chunk-VEOX3TRL.mjs} +2 -2
  95. package/dist/{chunk-B2VFJRLS.mjs.map → chunk-VEOX3TRL.mjs.map} +1 -1
  96. package/dist/{chunk-G6LH7V5B.mjs → chunk-XTF6ND33.mjs} +2 -2
  97. package/dist/{chunk-G6LH7V5B.mjs.map → chunk-XTF6ND33.mjs.map} +1 -1
  98. package/dist/{chunk-SOZHGHMY.mjs → chunk-ZODPRQKQ.mjs} +2 -2
  99. package/dist/{chunk-SOZHGHMY.mjs.map → chunk-ZODPRQKQ.mjs.map} +1 -1
  100. package/dist/{chunk-RQ2FFWUW.mjs → chunk-ZZ4LIKSD.mjs} +2 -2
  101. package/dist/{chunk-RQ2FFWUW.mjs.map → chunk-ZZ4LIKSD.mjs.map} +1 -1
  102. package/dist/index.d.mts +1 -1
  103. package/dist/index.d.ts +1 -1
  104. package/dist/index.js +2 -2
  105. package/dist/index.js.map +1 -1
  106. package/dist/index.mjs +1 -1
  107. package/package.json +1 -1
  108. package/dist/chunk-QK4XJ3GB.mjs +0 -2
  109. package/dist/chunk-QK4XJ3GB.mjs.map +0 -1
@@ -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-DY253_Gs.mjs';
4
+ import '../Common-Du2s_43h.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-BPgGKaZC.js';
4
+ import '../Common-BsfeCt6G.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-DY253_Gs.mjs';
2
+ import { C as CountryCode } from '../Common-Du2s_43h.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-BPgGKaZC.js';
2
+ import { C as CountryCode } from '../Common-BsfeCt6G.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