b23-lib 1.7.0 → 1.7.2

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 (127) hide show
  1. package/dist/Auth/index.d.mts +130 -0
  2. package/dist/Auth/index.d.ts +130 -0
  3. package/dist/Auth/index.js +2 -0
  4. package/dist/Auth/index.js.map +1 -0
  5. package/dist/Auth/index.mjs +2 -0
  6. package/dist/Auth/index.mjs.map +1 -0
  7. package/dist/Classes/Address.d.mts +142 -0
  8. package/dist/Classes/Address.d.ts +142 -0
  9. package/dist/Classes/Address.js +2 -0
  10. package/dist/Classes/Address.js.map +1 -0
  11. package/dist/Classes/Address.mjs +2 -0
  12. package/dist/Classes/Address.mjs.map +1 -0
  13. package/dist/Classes/Base.d.mts +98 -0
  14. package/dist/Classes/Base.d.ts +98 -0
  15. package/dist/Classes/Base.js +2 -0
  16. package/dist/Classes/Base.js.map +1 -0
  17. package/dist/Classes/Base.mjs +2 -0
  18. package/dist/Classes/Base.mjs.map +1 -0
  19. package/dist/Classes/Cart.d.mts +68 -0
  20. package/dist/Classes/Cart.d.ts +68 -0
  21. package/dist/Classes/Cart.js +2 -0
  22. package/dist/Classes/Cart.js.map +1 -0
  23. package/dist/Classes/Cart.mjs +2 -0
  24. package/dist/Classes/Cart.mjs.map +1 -0
  25. package/dist/Classes/Common.d.mts +75 -0
  26. package/dist/Classes/Common.d.ts +75 -0
  27. package/dist/Classes/Common.js +2 -0
  28. package/dist/Classes/Common.js.map +1 -0
  29. package/dist/Classes/Common.mjs +2 -0
  30. package/dist/Classes/Common.mjs.map +1 -0
  31. package/dist/Classes/Coupon.d.mts +142 -0
  32. package/dist/Classes/Coupon.d.ts +142 -0
  33. package/dist/Classes/Coupon.js +2 -0
  34. package/dist/Classes/Coupon.js.map +1 -0
  35. package/dist/Classes/Coupon.mjs +2 -0
  36. package/dist/Classes/Coupon.mjs.map +1 -0
  37. package/dist/Classes/Customer.d.mts +97 -0
  38. package/dist/Classes/Customer.d.ts +97 -0
  39. package/dist/Classes/Customer.js +2 -0
  40. package/dist/Classes/Customer.js.map +1 -0
  41. package/dist/Classes/Customer.mjs +2 -0
  42. package/dist/Classes/Customer.mjs.map +1 -0
  43. package/dist/Classes/CustomerAddress.d.mts +71 -0
  44. package/dist/Classes/CustomerAddress.d.ts +71 -0
  45. package/dist/Classes/CustomerAddress.js +2 -0
  46. package/dist/Classes/CustomerAddress.js.map +1 -0
  47. package/dist/Classes/CustomerAddress.mjs +2 -0
  48. package/dist/Classes/CustomerAddress.mjs.map +1 -0
  49. package/dist/Classes/Enum.d.mts +34 -0
  50. package/dist/Classes/Enum.d.ts +34 -0
  51. package/dist/Classes/Enum.js +2 -0
  52. package/dist/Classes/Enum.js.map +1 -0
  53. package/dist/Classes/Enum.mjs +2 -0
  54. package/dist/Classes/Enum.mjs.map +1 -0
  55. package/dist/Classes/ImageInfo.d.mts +92 -0
  56. package/dist/Classes/ImageInfo.d.ts +92 -0
  57. package/dist/Classes/ImageInfo.js +2 -0
  58. package/dist/Classes/ImageInfo.js.map +1 -0
  59. package/dist/Classes/ImageInfo.mjs +2 -0
  60. package/dist/Classes/ImageInfo.mjs.map +1 -0
  61. package/dist/Classes/LineItem.d.mts +124 -0
  62. package/dist/Classes/LineItem.d.ts +124 -0
  63. package/dist/Classes/LineItem.js +2 -0
  64. package/dist/Classes/LineItem.js.map +1 -0
  65. package/dist/Classes/LineItem.mjs +2 -0
  66. package/dist/Classes/LineItem.mjs.map +1 -0
  67. package/dist/Classes/Order.d.mts +83 -0
  68. package/dist/Classes/Order.d.ts +83 -0
  69. package/dist/Classes/Order.js +2 -0
  70. package/dist/Classes/Order.js.map +1 -0
  71. package/dist/Classes/Order.mjs +2 -0
  72. package/dist/Classes/Order.mjs.map +1 -0
  73. package/dist/Classes/Payment.d.mts +161 -0
  74. package/dist/Classes/Payment.d.ts +161 -0
  75. package/dist/Classes/Payment.js +2 -0
  76. package/dist/Classes/Payment.js.map +1 -0
  77. package/dist/Classes/Payment.mjs +2 -0
  78. package/dist/Classes/Payment.mjs.map +1 -0
  79. package/dist/Classes/Price.d.mts +70 -0
  80. package/dist/Classes/Price.d.ts +70 -0
  81. package/dist/Classes/Price.js +2 -0
  82. package/dist/Classes/Price.js.map +1 -0
  83. package/dist/Classes/Price.mjs +2 -0
  84. package/dist/Classes/Price.mjs.map +1 -0
  85. package/dist/Classes/Product.d.mts +209 -0
  86. package/dist/Classes/Product.d.ts +209 -0
  87. package/dist/Classes/Product.js +2 -0
  88. package/dist/Classes/Product.js.map +1 -0
  89. package/dist/Classes/Product.mjs +2 -0
  90. package/dist/Classes/Product.mjs.map +1 -0
  91. package/dist/Classes/ShoppingContainer.d.mts +194 -0
  92. package/dist/Classes/ShoppingContainer.d.ts +194 -0
  93. package/dist/Classes/ShoppingContainer.js +2 -0
  94. package/dist/Classes/ShoppingContainer.js.map +1 -0
  95. package/dist/Classes/ShoppingContainer.mjs +2 -0
  96. package/dist/Classes/ShoppingContainer.mjs.map +1 -0
  97. package/dist/Dynamodb/index.d.mts +58 -0
  98. package/dist/Dynamodb/index.d.ts +58 -0
  99. package/dist/Dynamodb/index.js +2 -0
  100. package/dist/Dynamodb/index.js.map +1 -0
  101. package/dist/Dynamodb/index.mjs +2 -0
  102. package/dist/Dynamodb/index.mjs.map +1 -0
  103. package/dist/chunk-4H4LJ3UL.mjs +2 -0
  104. package/dist/chunk-4H4LJ3UL.mjs.map +1 -0
  105. package/dist/chunk-65X54TKF.mjs +2 -0
  106. package/dist/chunk-65X54TKF.mjs.map +1 -0
  107. package/dist/chunk-763MN5XV.mjs +2 -0
  108. package/dist/chunk-763MN5XV.mjs.map +1 -0
  109. package/dist/chunk-CWKGR4AF.mjs +2 -0
  110. package/dist/chunk-CWKGR4AF.mjs.map +1 -0
  111. package/dist/chunk-DKI6BDWK.mjs +2 -0
  112. package/dist/chunk-DKI6BDWK.mjs.map +1 -0
  113. package/dist/chunk-SPLTJRHG.mjs +2 -0
  114. package/dist/chunk-SPLTJRHG.mjs.map +1 -0
  115. package/dist/chunk-T6IVHYQQ.mjs +2 -0
  116. package/dist/chunk-T6IVHYQQ.mjs.map +1 -0
  117. package/dist/chunk-T6YCHB3K.mjs +2 -0
  118. package/dist/chunk-T6YCHB3K.mjs.map +1 -0
  119. package/dist/chunk-WU6FFDBS.mjs +2 -0
  120. package/dist/chunk-WU6FFDBS.mjs.map +1 -0
  121. package/dist/index.d.mts +1 -624
  122. package/dist/index.d.ts +1 -624
  123. package/dist/index.js +2 -1
  124. package/dist/index.js.map +1 -1
  125. package/dist/index.mjs +2 -1
  126. package/dist/index.mjs.map +1 -1
  127. package/package.json +163 -1
package/dist/index.d.mts CHANGED
@@ -1,61 +1,3 @@
1
- import * as _aws_sdk_util_dynamodb from '@aws-sdk/util-dynamodb';
2
- import { marshall } from '@aws-sdk/util-dynamodb';
3
- import { AttributeValue, ReturnItemCollectionMetrics, ReturnValue, ReturnValuesOnConditionCheckFailure, TransactWriteItem } from '@aws-sdk/client-dynamodb';
4
- import * as jose from 'jose';
5
-
6
- declare class DynamoDBUtility {
7
- private client;
8
- private returnItemCollectionMetrics;
9
- private logCapacity;
10
- private region;
11
- marshall: typeof marshall;
12
- unmarshall: (data: Record<string, AttributeValue> | AttributeValue, options?: _aws_sdk_util_dynamodb.unmarshallOptions) => Record<string, _aws_sdk_util_dynamodb.NativeAttributeValue>;
13
- ReturnValue: {
14
- readonly ALL_NEW: "ALL_NEW";
15
- readonly ALL_OLD: "ALL_OLD";
16
- readonly NONE: "NONE";
17
- readonly UPDATED_NEW: "UPDATED_NEW";
18
- readonly UPDATED_OLD: "UPDATED_OLD";
19
- };
20
- ReturnItemCollectionMetrics: {
21
- readonly NONE: "NONE";
22
- readonly SIZE: "SIZE";
23
- };
24
- ReturnValuesOnConditionCheckFailure: {
25
- readonly ALL_OLD: "ALL_OLD";
26
- readonly NONE: "NONE";
27
- };
28
- constructor({ region, returnItemCollectionMetrics, logCapacity }: {
29
- region: string;
30
- returnItemCollectionMetrics: ReturnItemCollectionMetrics;
31
- logCapacity: boolean;
32
- });
33
- private log;
34
- putItem(TableName: string, item: object, condition: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, ReturnValues?: ReturnValue, ReturnValuesOnFailure?: ReturnValuesOnConditionCheckFailure): Promise<Record<string, any>>;
35
- transactWriteItems(transactItems: TransactWriteItem[]): Promise<void>;
36
- getItem(TableName: string, key: object, consistent?: boolean, projection?: string, attributeName?: Record<string, string>): Promise<Record<string, any>>;
37
- batchGetItem(TableName: string, keys: object[], consistent?: boolean, projection?: string, attributeName?: Record<string, string>): Promise<Record<string, any>[]>;
38
- queryItems(TableName: string, keyCondition: string, consistent?: boolean, projection?: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, lastEvaluatedKey?: Record<string, AttributeValue>): Promise<{
39
- items: Record<string, any>[];
40
- lastEvaluatedKey: Record<string, AttributeValue> | undefined;
41
- }>;
42
- scanItems(TableName: string, filterExpression?: string, consistent?: boolean, projection?: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, lastEvaluatedKey?: Record<string, AttributeValue>): Promise<{
43
- items: Record<string, any>[];
44
- lastEvaluatedKey: Record<string, AttributeValue> | undefined;
45
- }>;
46
- partiQL(statement: string, parameter?: AttributeValue[], nextToken?: string, consistent?: boolean): Promise<{
47
- Items: Record<string, any>[];
48
- nextToken: string | undefined;
49
- lastEvaluatedKey: Record<string, AttributeValue> | undefined;
50
- }>;
51
- updateItem(TableName: string, key: object, condition: string, update: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, ReturnValues?: ReturnValue, ReturnValuesOnFailure?: ReturnValuesOnConditionCheckFailure): Promise<Record<string, any>>;
52
- deleteItem(TableName: string, key: object, condition: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, ReturnValues?: ReturnValue, ReturnValuesOnFailure?: ReturnValuesOnConditionCheckFailure): Promise<Record<string, any>>;
53
- getItemByIndex(TableName: string, index: string, keyCondition: string, consistent?: boolean, projection?: string, attributeName?: Record<string, string>, attributeValue?: Record<string, AttributeValue>, lastEvaluatedKey?: Record<string, AttributeValue>): Promise<{
54
- Items: Record<string, any>[];
55
- lastEvaluatedKey: Record<string, AttributeValue> | undefined;
56
- }>;
57
- }
58
-
59
1
  declare const Schema: {
60
2
  getStandardSchemaDefinition(): {
61
3
  $id: string;
@@ -236,133 +178,6 @@ declare const Schema: {
236
178
  };
237
179
  };
238
180
 
239
- type StringifiedJSONArray = string;
240
- interface AuthUtilityConfig {
241
- maxTokenAge: string;
242
- userPrivateKeys: StringifiedJSONArray;
243
- userPublicKeys: StringifiedJSONArray;
244
- anonymousPrivateKeys: StringifiedJSONArray;
245
- anonymousPublicKeys: StringifiedJSONArray;
246
- systemPrivateKeys: StringifiedJSONArray;
247
- systemPublicKeys: StringifiedJSONArray;
248
- adminPrivateKeys: StringifiedJSONArray;
249
- adminPublicKeys: StringifiedJSONArray;
250
- }
251
- declare const DefaultAuthUtilityConfig: Readonly<AuthUtilityConfig>;
252
- type AuthTokenType = 'Anon' | 'User' | 'System' | 'Admin' | 'CDN';
253
- interface AuthMiddlewareConfig {
254
- allowAnonymous: boolean;
255
- allowSystem: boolean;
256
- allowUser: boolean;
257
- allowCDN: boolean;
258
- }
259
- declare const DefaultAuthMiddlewareConfig: Readonly<AuthMiddlewareConfig>;
260
- /**
261
- * A utility class for JWT authentication and authorization.
262
- */
263
- declare class AuthUtility {
264
- private maxTokenAge;
265
- private userPrivateKeys;
266
- private userPublicKeys;
267
- private anonymousPrivateKeys;
268
- private anonymousPublicKeys;
269
- private systemPrivateKeys;
270
- private systemPublicKeys;
271
- private adminPrivateKeys;
272
- private adminPublicKeys;
273
- /**
274
- * Initializes the AuthUtility class with a configuration.
275
- * @param config The configuration for the utility (optional).
276
- */
277
- constructor(config?: Partial<AuthUtilityConfig>);
278
- /**
279
- * Logs warnings if the number of keys exceeds recommended limits.
280
- */
281
- private logWarnings;
282
- private createSignedJWT;
283
- private verifySignedJWT;
284
- /**
285
- * Creates an anonymous token with the given ID and additional data.
286
- *
287
- * @param id - The unique identifier for the token. Must be a valid UUID.
288
- * @param additionalData - Optional additional data to include in the token payload.
289
- * @returns A promise that resolves to the signed JWT as a string.
290
- * @throws Will throw an error if no anonymous private keys are found or if the ID is not a valid UUID.
291
- */
292
- createAnonymousToken(id: string, additionalData?: object): Promise<string>;
293
- /**
294
- * Verifies an anonymous token by checking its signature and payload type.
295
- *
296
- * @param token - The JWT token to be verified.
297
- * @returns The payload of the verified token.
298
- * @throws Will throw an error if no anonymous public keys are found or if the token type is invalid.
299
- */
300
- verifyAnonymousToken(token: string): Promise<jose.JWTPayload>;
301
- /**
302
- * Creates a signed JWT token for a user.
303
- *
304
- * @param id - The UUID of the user.
305
- * @param additionalData - Optional additional data to include in the token payload.
306
- * @returns A promise that resolves to the signed JWT token as a string.
307
- * @throws Will throw an error if no user private keys are found or if the provided id is not a valid UUID.
308
- */
309
- createUserToken(id: string, additionalData?: object): Promise<string>;
310
- /**
311
- * Verifies the provided user token by checking its signature and payload.
312
- *
313
- * @param token - The JWT token to be verified.
314
- * @returns The payload of the verified token if valid.
315
- * @throws Will throw an error if no user public keys are found or if the token type is invalid.
316
- */
317
- verifyUserToken(token: string): Promise<jose.JWTPayload>;
318
- /**
319
- * Creates a signed JWT (JSON Web Token) for a system with the given ID and optional additional data.
320
- *
321
- * @param id - The unique identifier for the system.
322
- * @param additionalData - Optional additional data to include in the token payload.
323
- * @returns A promise that resolves to the signed JWT as a string.
324
- * @throws Will throw an error if no system private keys are found.
325
- */
326
- createSystemToken(id: string, additionalData?: object): Promise<string>;
327
- /**
328
- * Verifies a system token by checking its signature and payload type.
329
- *
330
- * @param token - The JWT token to be verified.
331
- * @returns The payload of the verified token.
332
- * @throws Will throw an error if no system public keys are found or if the token type is not 'System'.
333
- */
334
- verifySystemToken(token: string): Promise<jose.JWTPayload>;
335
- /**
336
- * Creates a signed JWT token for an admin user.
337
- *
338
- * @param email - The email of the admin user.
339
- * @param additionalData - Optional additional data to include in the token payload.
340
- * @returns A promise that resolves to the signed JWT token string.
341
- * @throws Will throw an error if no admin private keys are found or if the provided id is not a valid UUID.
342
- */
343
- createAdminToken(email: string, verifier: string, additionalData?: object): Promise<string>;
344
- /**
345
- * Verifies the provided admin token by checking its signature and payload.
346
- * Ensures that the token is signed with one of the known admin public keys
347
- * and that the payload type is 'Admin'.
348
- *
349
- * @param token - The JWT token to be verified.
350
- * @param permissions - The permissions required for the admin user.
351
- * @param authenticate - Whether to authenticate the token with the verifier.
352
- * @returns The payload of the verified token.
353
- * @throws Will throw an error if no admin public keys are found or if the token is invalid or if the admin doesn't have proper permissions.
354
- */
355
- verifyAdminToken(token: string, permissions: string[], authenticate: boolean): Promise<jose.JWTPayload>;
356
- /**
357
- * Middleware function to handle authentication based on different token types.
358
- * It verifies the token and sets the authentication details in the response locals.
359
- *
360
- * @param {Partial<AuthMiddlewareConfig>} [config=DefaultAuthMiddlewareConfig] - Configuration object to customize the middleware behavior.
361
- * @returns Middleware function to handle authentication.
362
- */
363
- AuthMiddleware(config?: Partial<AuthMiddlewareConfig>, permissions?: string[]): (req: any, res: any, next: any) => Promise<void>;
364
- }
365
-
366
181
  declare const Utils: {
367
182
  isUUID: (value: string) => boolean;
368
183
  isEmail: (value: string) => boolean;
@@ -422,442 +237,4 @@ declare const Logger: {
422
237
  inspect: (context: any) => string;
423
238
  };
424
239
 
425
- /**
426
- * Represents the countries where the application operates or products are available.
427
- */
428
- declare enum OperationalCountry {
429
- /** India */ IN = "IN"
430
- }
431
- declare enum OperationalCountryCurrency {
432
- /** India */ INR = "INR"
433
- }
434
- declare enum OperationalLocale {
435
- /** India */ 'en-IN' = "en-IN"
436
- }
437
- /**
438
- * Defines the supported ISO 4217 currency codes as an enumeration.
439
- */
440
- declare const CountryCurrencyMap: {
441
- /** India */ IN: OperationalCountryCurrency;
442
- };
443
- declare const CurrencySymbolMap: {
444
- INR: string;
445
- };
446
- /**
447
- * Defines standard gender categories for product targeting.
448
- */
449
- declare enum GenderCategory {
450
- MALE = "Male",
451
- FEMALE = "Female",
452
- UNISEX = "Unisex",
453
- KIDS = "Kids",
454
- BOY = "Boy",
455
- GIRL = "Girl"
456
- }
457
-
458
- /**
459
- * Represents a ISO 3166-1 alpha-2 country code (e.g., 'US', 'IN').
460
- */
461
- type CountryCode = keyof typeof OperationalCountry;
462
- /**
463
- * Represents a ISO 4217 currency code (e.g., 'INR', 'USD').
464
- */
465
- type CurrencyCode = keyof typeof OperationalCountryCurrency;
466
- /**
467
- * /**
468
- * Represents a string that can be localized into multiple languages.
469
- * The 'en' property is mandatory and serves as the default English translation.
470
- * Additional properties can be added for other locales using their respective locale codes.
471
- */
472
- type LocalizedString = {
473
- en: string;
474
- } & {
475
- [locale in LocaleCode]?: string;
476
- };
477
- /**
478
- * Represents a BCP 47 language tag (e.g., 'en-US', 'fr-FR').
479
- * Used to identify languages and regional variations.
480
- */
481
- type LocaleCode = keyof typeof OperationalLocale;
482
- /**
483
- * Represents a pricing tier based on a minimum purchase quantity.
484
- */
485
- type PriceTier = {
486
- /** The minimum quantity required to achieve this unit price. */
487
- minQuantity: number;
488
- /** The price per unit at this quantity tier. */
489
- unitPrice: number;
490
- currency: CurrencyCode;
491
- country: CountryCode;
492
- };
493
- /**
494
- * Represents the base price information for a single unit in a specific country.
495
- */
496
- type BasePrice = {
497
- /** Enforces that this price is for a single unit. */
498
- minQuantity: 1;
499
- /** The price per unit. */
500
- unitPrice: number;
501
- currency: CurrencyCode;
502
- country: CountryCode;
503
- };
504
- type BasePriceList = BasePrice[];
505
- type PriceTierList = PriceTier[];
506
- type Color = {
507
- name: string;
508
- hex?: string;
509
- };
510
- /**
511
- * Represents a date and time string formatted according to the ISO 8601 standard.
512
- * Example: "2023-10-27T10:30:00Z"
513
- */
514
- type ISODateTime = string;
515
- type RegionalPrice = {
516
- country: CountryCode;
517
- currency: CurrencyCode;
518
- price: number;
519
- };
520
- type RegionalPriceList = RegionalPrice[];
521
- interface ShippingDetails {
522
- shippingMethodId?: string;
523
- shippingMethodName?: string | LocalizedString;
524
- carrier?: string;
525
- estimatedCost?: number;
526
- estimatedDeliveryBy?: ISODateTime | null;
527
- deliveryInstructions?: string | null;
528
- }
529
-
530
- interface CustomFields {
531
- [key: string]: any;
532
- }
533
- type BaseAttributes = {
534
- customFields?: CustomFields;
535
- version?: number;
536
- createdAt?: ISODateTime;
537
- modifiedAt?: ISODateTime;
538
- modifiedBy?: string;
539
- };
540
- type BaseData = {
541
- customFields: CustomFields;
542
- version: number;
543
- createdAt: ISODateTime;
544
- modifiedAt: ISODateTime;
545
- modifiedBy: string;
546
- };
547
-
548
- declare enum AddressType {
549
- BILLING = "billing",
550
- SHIPPING = "shipping",
551
- BILLING_AND_SHIPPING = "billing&shipping",
552
- NONE = "none"
553
- }
554
- type AddressAttributes = BaseAttributes & {
555
- id: string;
556
- firstName: string;
557
- lastName: string;
558
- phone: string;
559
- email: string;
560
- addressLine1: string;
561
- addressLine2?: string;
562
- city: string;
563
- postalCode: string;
564
- state: string;
565
- country: string;
566
- isBillingAddress: boolean;
567
- isShippingAddress: boolean;
568
- };
569
- type AddressData = Required<AddressAttributes>;
570
-
571
- declare enum ImageResolution {
572
- THUMBNAIL = "thumbnail",
573
- SMALL = "small",
574
- MEDIUM = "medium",
575
- LARGE = "large",
576
- ORIGINAL = "original"
577
- }
578
- type ImageInfoAttribute = {
579
- sources: {
580
- [key in ImageResolution]?: string;
581
- } & {
582
- original: string;
583
- };
584
- alt?: string;
585
- order?: number;
586
- label?: string;
587
- };
588
- type ImageInfoData = ImageInfoAttribute;
589
-
590
- type SubItem = {
591
- size: string;
592
- quantity: number;
593
- };
594
- type LineItemAttributes = {
595
- id: string;
596
- productKey: string;
597
- variantId: string;
598
- name: LocalizedString;
599
- attributes: {
600
- color: Color;
601
- };
602
- primaryImage: ImageInfoData;
603
- subItems: SubItem[];
604
- basePrice: BasePrice;
605
- priceTiers: PriceTier[];
606
- };
607
- type LineItemData = LineItemAttributes & {
608
- totalQuantity: number;
609
- priceTotals: {
610
- subtotal: number;
611
- mrpTotal: number;
612
- };
613
- };
614
-
615
- declare enum CouponType {
616
- COUPON = "coupon",
617
- AUTOMATIC = "automatic"
618
- }
619
- declare enum CouponDiscountMethod {
620
- FLAT = "flat",
621
- PERCENTAGE = "percentage"
622
- }
623
- declare enum CouponCategory {
624
- SHIPPING = "SHIPPING",
625
- CUSTOMER = "CUSTOMER"
626
- }
627
- declare enum ApplicableTo {
628
- ALL = "all",
629
- FTB = "ftb"
630
- }
631
- type CouponAttribute = BaseAttributes & {
632
- couponCode: string;
633
- name: LocalizedString;
634
- description: LocalizedString;
635
- type: CouponType;
636
- customerId?: string;
637
- validFrom: ISODateTime;
638
- validTo: ISODateTime;
639
- minCartValue: RegionalPriceList;
640
- maxCartDiscount: RegionalPriceList;
641
- discountMethod: CouponDiscountMethod;
642
- percentageValue?: number;
643
- applicableTo: ApplicableTo;
644
- category: CouponCategory;
645
- };
646
- type CouponData = Required<CouponAttribute>;
647
-
648
- type BaseShoppingContainerAttributes = BaseAttributes & {
649
- id: string;
650
- customerId?: string;
651
- customerEmail?: string;
652
- anonymousId?: string;
653
- lineItems: LineItemData[];
654
- shippingDetails: ShippingDetails | null;
655
- shippingAddress?: AddressData | null;
656
- billingAddress?: AddressData | null;
657
- coupons?: CouponData[];
658
- total?: {
659
- shipping?: number;
660
- effectiveShipping?: number;
661
- subtotal?: number;
662
- mrpTotal?: number;
663
- couponTotal?: {
664
- [key: string]: number;
665
- };
666
- grandTotal?: number;
667
- };
668
- country: CountryCode;
669
- currency: CurrencyCode;
670
- locale: LocaleCode;
671
- };
672
- type BaseShoppingContainerData = Omit<BaseShoppingContainerAttributes, 'coupons' | 'total'> & BaseData & {
673
- coupons: CouponData[];
674
- total: {
675
- shipping: number;
676
- effectiveShipping: number;
677
- subtotal: number;
678
- mrpTotal: number;
679
- couponTotal: {
680
- [key: string]: number;
681
- };
682
- grandTotal: number;
683
- };
684
- };
685
-
686
- declare enum CartState {
687
- ACTIVE = "ACTIVE",
688
- FROZEN = "FROZEN",
689
- MERGED = "MERGED",
690
- ORDERED = "ORDERED"
691
- }
692
- declare class LineItemNotFoundError extends Error {
693
- constructor(lineItemId: string);
694
- }
695
- /**
696
- * Input attributes for creating or updating a CartModel.
697
- */
698
- type CartAttributes = BaseShoppingContainerAttributes & {
699
- state: CartState;
700
- expireAt: number;
701
- };
702
- type CartData = BaseShoppingContainerData & {
703
- state: CartState;
704
- expireAt: number;
705
- };
706
- type CartConfig = {
707
- expiresAtInSeconds: number;
708
- };
709
- declare const DEFAULT_CART_CONFIG: CartConfig;
710
-
711
- declare enum CustomerStatus {
712
- CREATED = "CREATED",
713
- REGISTERED_USER = "REGISTERED_USER",
714
- ACTIVATED_USER = "ACTIVATED_USER",
715
- EMAIL_OTP = "EMAIL_OTP",
716
- EMAIL_PASSWORD = "EMAIL_PASSWORD",
717
- PHONE_OTP = "PHONE_OTP"
718
- }
719
- type CustomerAttributes = BaseAttributes & {
720
- id: string;
721
- email: string;
722
- phone: string;
723
- firstName: string;
724
- lastName: string;
725
- isEmailVerified?: boolean;
726
- customerStatus?: Set<CustomerStatus>;
727
- };
728
- type CustomerDataWithArrayStatus = Omit<CustomerAttributes, 'customerStatus'> & BaseData & {
729
- customerStatus: CustomerStatus[];
730
- };
731
- type CustomerData = Required<CustomerDataWithArrayStatus>;
732
- type CustomerDataWithOutId = Omit<CustomerData, 'id'>;
733
-
734
- type CustomerAddressAttributes = BaseAttributes & {
735
- id: string;
736
- addresses: AddressData[];
737
- defaultBillingAddressId: string;
738
- defaultShippingAddressId: string;
739
- };
740
- type CustomerAddressWithoutDefaultAddress = Omit<CustomerAddressAttributes, 'addresses' | 'defaultBillingAddressId' | 'defaultShippingAddressId'> & {
741
- addresses: AddressData[];
742
- defaultBillingAddressId: string | null;
743
- defaultShippingAddressId: string | null;
744
- };
745
- type CustomerAddressDataWithOutId = Required<Omit<CustomerAddressWithoutDefaultAddress, 'id'>>;
746
- type CustomerAddressData = Required<CustomerAddressWithoutDefaultAddress>;
747
-
748
- declare enum PaymentStatus {
749
- PENDING = "PENDING",
750
- AUTHORIZED = "AUTHORIZED",
751
- CAPTURED = "CAPTURED",
752
- FAILED = "FAILED",
753
- REFUNDED = "REFUNDED",
754
- PARTIALLY_REFUNDED = "PARTIALLY_REFUNDED"
755
- }
756
- declare enum PaymentMode {
757
- PAY_LATER = "PAY_LATER",
758
- CARD = "CARD",
759
- CASH = "CASH",
760
- NET_BANKING = "NET_BANKING",
761
- WALLET = "WALLET",
762
- COD = "COD",
763
- UNKNOWN = "UNKNOWN"
764
- }
765
- /**
766
- * Input attributes for creating or updating a PaymentModel.
767
- */
768
- type PaymentAttributes = BaseAttributes & {
769
- txnId: string;
770
- externalId?: string;
771
- orderNumber: string;
772
- customerId: string;
773
- status: PaymentStatus;
774
- subStatus?: string;
775
- amount: number;
776
- currency: CurrencyCode;
777
- paymentMode: PaymentMode;
778
- gatewayResponse?: string;
779
- gatewayErrorCode?: string;
780
- gatewayErrorMessage?: string;
781
- amountRefunded?: number;
782
- cardLast4?: string;
783
- cardBrand?: string;
784
- transactionAt: ISODateTime;
785
- };
786
- /**
787
- * Output data structure for a PaymentModel.
788
- * Excludes potentially large or sensitive fields by default.
789
- */
790
- type PaymentData = Omit<PaymentAttributes, 'gatewayResponse' | 'gatewayErrorMessage'> & BaseData;
791
-
792
- declare enum OrderState {
793
- PENDING_PAYMENT = "PENDING_PAYMENT",
794
- PROCESSING = "PROCESSING",
795
- SHIPPED = "SHIPPED",
796
- PARTIALLY_SHIPPED = "PARTIALLY_SHIPPED",
797
- DELIVERED = "DELIVERED",
798
- CANCELLED = "CANCELLED",
799
- RETURNED = "RETURNED",
800
- REFUNDED = "REFUNDED"
801
- }
802
- /**
803
- * Input attributes for creating an OrderModel.
804
- * Extends CartAttributes but requires/adds order-specific fields.
805
- */
806
- type OrderAttributes = Required<Omit<BaseShoppingContainerAttributes, 'anonymousId'>> & {
807
- anonymousId?: string;
808
- orderNumber: string;
809
- cartId: string;
810
- paymentStatus: PaymentStatus;
811
- holdReason?: string;
812
- state: OrderState;
813
- };
814
- /**
815
- * Output data structure for an OrderModel.
816
- */
817
- type OrderData = BaseShoppingContainerData & OrderAttributes;
818
-
819
- type ProductVariantIdentifier = {
820
- key: string;
821
- variantId: string;
822
- };
823
- type ProductHashKey = {
824
- id: string;
825
- variantId: string;
826
- };
827
- type ProductAttributes = BaseAttributes & {
828
- id: string;
829
- key: string;
830
- variantId: string;
831
- name: LocalizedString;
832
- description: LocalizedString;
833
- slug: LocalizedString;
834
- brand: string;
835
- basePrices: BasePriceList;
836
- priceTiers: PriceTierList;
837
- attributes: {
838
- color: Color;
839
- sizes: string[];
840
- };
841
- primaryImage: ImageInfoData;
842
- additionalImages?: ImageInfoData[];
843
- isActive: boolean;
844
- targetGender: GenderCategory;
845
- categories: string[];
846
- specifications: {
847
- [locale: string]: {
848
- [key: string]: string | string[];
849
- };
850
- };
851
- searchTags?: string[];
852
- };
853
- type ProductData = Required<ProductAttributes>;
854
- type ProductSpecification = {
855
- [key: string]: string | string[];
856
- };
857
- type LocalizedProductSpecification = {
858
- en: ProductSpecification;
859
- } & {
860
- [locale in LocaleCode]?: ProductSpecification;
861
- };
862
-
863
- export { type AddressAttributes, type AddressData, AddressType, ApplicableTo, type AuthMiddlewareConfig, type AuthTokenType, AuthUtility, type AuthUtilityConfig, type BaseAttributes, type BaseData, type BasePrice, type BasePriceList, type BaseShoppingContainerAttributes, type BaseShoppingContainerData, type CartAttributes, type CartConfig, type CartData, CartState, type Color, type CountryCode, CountryCurrencyMap, type CouponAttribute, CouponCategory, type CouponData, CouponDiscountMethod, CouponType, type CurrencyCode, CurrencySymbolMap, type CustomFields, type CustomerAddressAttributes, type CustomerAddressData, type CustomerAddressDataWithOutId, type CustomerAttributes, type CustomerData, type CustomerDataWithOutId, CustomerStatus, DEFAULT_CART_CONFIG, DefaultAuthMiddlewareConfig, DefaultAuthUtilityConfig, DynamoDBUtility as DynamoDB, type ErrorType, Fetch, GenderCategory, type ISODateTime, type ImageInfoAttribute, type ImageInfoData, ImageResolution, type LineItemAttributes, type LineItemData, LineItemNotFoundError, type LocaleCode, type LocalizedProductSpecification, type LocalizedString, Logger, OperationalCountry, OperationalCountryCurrency, OperationalLocale, type OrderAttributes, type OrderData, OrderState, type PaymentAttributes, type PaymentData, PaymentMode, PaymentStatus, type PriceTier, type PriceTierList, type ProductAttributes, type ProductData, type ProductHashKey, type ProductSpecification, type ProductVariantIdentifier, type RegionalPrice, type RegionalPriceList, ResponseUtility, Schema, type ShippingDetails, type SubItem, type SuccessType, Utils };
240
+ export { type ErrorType, Fetch, Logger, ResponseUtility, Schema, type SuccessType, Utils };