b23-lib 1.6.2 → 1.7.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.
- package/dist/index.d.mts +439 -1
- package/dist/index.d.ts +439 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -422,4 +422,442 @@ declare const Logger: {
|
|
|
422
422
|
inspect: (context: any) => string;
|
|
423
423
|
};
|
|
424
424
|
|
|
425
|
-
|
|
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 };
|