@retaila/shared-types 1.1.6 → 1.1.8

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 CHANGED
@@ -187,6 +187,7 @@ interface AccountIntegration {
187
187
  updatedAt: Date;
188
188
  deletedAt?: Date | null;
189
189
  integration: Integration;
190
+ settings: Record<string, any>;
190
191
  }
191
192
 
192
193
  /**
@@ -319,6 +320,42 @@ declare enum AccountDomainStatus {
319
320
  INACTIVE = "INACTIVE"
320
321
  }
321
322
 
323
+ /**
324
+ * Entidad Customer
325
+ * Cliente de la tienda
326
+ */
327
+
328
+ interface Customer {
329
+ id: string;
330
+ accountId: string;
331
+ firstName?: string;
332
+ lastName?: string;
333
+ email: string;
334
+ phone?: Phone;
335
+ status: CustomerStatus;
336
+ createdAt: Date;
337
+ updatedAt: Date;
338
+ deletedAt?: Date | null;
339
+ }
340
+ declare enum CustomerStatus {
341
+ ACTIVE = "ACTIVE",
342
+ INACTIVE = "INACTIVE",
343
+ BLACKLISTED = "BLACKLISTED",// e.g., for fraudulent activity
344
+ PENDING = "PENDING"
345
+ }
346
+
347
+ /**
348
+ * Register or update a customer
349
+ */
350
+ interface CustomerUpsertDto {
351
+ id?: string;
352
+ accountId: string;
353
+ firstName?: string;
354
+ lastName?: string;
355
+ email: string;
356
+ phone?: Phone;
357
+ }
358
+
322
359
  /**
323
360
  * Entidad Order
324
361
  * Define la orden de compra de un cliente en el sitio web.
@@ -353,6 +390,7 @@ interface Order {
353
390
  customerNote?: string;
354
391
  internalNote?: string;
355
392
  source: OrderSource;
393
+ sourceAccountDomainId?: string;
356
394
  demo: boolean;
357
395
  createdAt: Date;
358
396
  updatedAt: Date;
@@ -360,6 +398,9 @@ interface Order {
360
398
  cancelReason?: string;
361
399
  deletedAt?: Date;
362
400
  items?: OrderItem[];
401
+ customer?: Customer | null;
402
+ paymentMethodIntegration?: AccountIntegration | null;
403
+ accountDomain?: AccountDomain;
363
404
  }
364
405
  interface OrderItem {
365
406
  id: string;
@@ -432,7 +473,170 @@ interface AdminOrderStatusChangeDto {
432
473
  status: OrderStatus;
433
474
  }
434
475
 
435
- declare enum TransactionStatus {
476
+ /**
477
+ * Add an item to the cart
478
+ */
479
+ interface CartItemAddDto {
480
+ cartId: string;
481
+ productId: string;
482
+ variantId?: string;
483
+ quantity: number;
484
+ attributes?: {
485
+ [key: string]: string | number;
486
+ };
487
+ userEmail?: string;
488
+ userId?: string;
489
+ }
490
+ /**
491
+ * Update an item in the cart
492
+ */
493
+ interface CartItemUpdateDto {
494
+ cartId: string;
495
+ itemId: string;
496
+ quantity: number;
497
+ }
498
+ /**
499
+ * Remove an item from the cart
500
+ */
501
+ interface CartItemRemoveDto {
502
+ cartId: string;
503
+ itemId: string;
504
+ }
505
+ interface CartUpdateDto {
506
+ cartId: string;
507
+ source: OrderSource;
508
+ sourceUrl?: string;
509
+ customer: {
510
+ email: string;
511
+ };
512
+ delivery: {
513
+ type: 'shipping' | 'pickup';
514
+ deliveryOptionId?: string;
515
+ pickupBranchId?: string;
516
+ firstname: string;
517
+ lastname: string;
518
+ phone: {
519
+ countryCode: string;
520
+ national: string;
521
+ international: string;
522
+ type: string;
523
+ validated: boolean;
524
+ };
525
+ address: {
526
+ country: string;
527
+ department: string;
528
+ locality: string;
529
+ street: string;
530
+ complement?: string;
531
+ notes?: string;
532
+ postalCode: string;
533
+ mapPosition: {
534
+ lat: number;
535
+ lng: number;
536
+ };
537
+ };
538
+ };
539
+ billing: {
540
+ name: string;
541
+ address: string;
542
+ city: string;
543
+ department: string;
544
+ };
545
+ }
546
+ /**
547
+ * Confirm a cart
548
+ */
549
+ interface CartConfirmDto {
550
+ cartId: string;
551
+ }
552
+ /**
553
+ * Validation information for a cart item
554
+ */
555
+ interface CartItemValidation {
556
+ hasIssues: boolean;
557
+ issues: string[];
558
+ errorCode?: CartItemErrorCode;
559
+ currentPrice?: number;
560
+ availableStock?: number;
561
+ isProductActive?: boolean;
562
+ }
563
+ /**
564
+ * Error codes for cart items
565
+ */
566
+ declare enum CartItemErrorCode {
567
+ PRICE_INCREASED = "PRICE_INCREASED",// Precio aumentó
568
+ PRICE_DECREASED = "PRICE_DECREASED",// Precio disminuyó
569
+ PRODUCT_INACTIVE = "PRODUCT_INACTIVE",// Producto ya no está disponible
570
+ STOCK_INSUFFICIENT = "STOCK_INSUFFICIENT",// Stock insuficiente (hay algo disponible)
571
+ STOCK_UNAVAILABLE = "STOCK_UNAVAILABLE",// Sin stock (0 disponible)
572
+ VALIDATION_ERROR = "VALIDATION_ERROR"
573
+ }
574
+
575
+ /**
576
+ * Entidad Cart
577
+ * Define el carrito de compras de un cliente en el sitio web.
578
+ */
579
+ interface Cart {
580
+ id: string;
581
+ code: string;
582
+ customerId?: string;
583
+ sessionId?: string;
584
+ items: CartItem[];
585
+ subtotal: number;
586
+ total: number;
587
+ currency: string;
588
+ itemCount: number;
589
+ createdAt: Date;
590
+ updatedAt: Date;
591
+ status: CartStatus;
592
+ source: CartSource;
593
+ sourceAccountDomainId?: string;
594
+ recoveryToken?: string;
595
+ customerNote?: string;
596
+ hasIssues: boolean;
597
+ issuesCount: number;
598
+ subtotalPrice?: number;
599
+ totalDiscounts?: number;
600
+ totalShippingPrice?: number;
601
+ totalTax?: number;
602
+ totalPrice?: number;
603
+ taxDetails?: any;
604
+ customer?: Customer | null;
605
+ accountDomain?: AccountDomain;
606
+ }
607
+ interface CartItem {
608
+ id: string;
609
+ productId: string;
610
+ productVariantId: string;
611
+ name: string;
612
+ unitPrice: number;
613
+ quantity: number;
614
+ image?: string;
615
+ thumbnailUrl?: string;
616
+ sku?: string;
617
+ attributeDetails: CartItemAttributeDetail[];
618
+ validation?: CartItemValidation;
619
+ }
620
+ interface CartItemAttributeDetail {
621
+ name: string;
622
+ value: string;
623
+ type?: string;
624
+ }
625
+ declare enum CartStatus {
626
+ ACTIVE = "ACTIVE",
627
+ LOCKED = "LOCKED",
628
+ EXPIRED = "EXPIRED",
629
+ CONVERTED = "CONVERTED",
630
+ ABANDONED = "ABANDONED",
631
+ MERGED = "MERGED"
632
+ }
633
+ declare enum CartSource {
634
+ WEB = "WEB",
635
+ POS = "POS",
636
+ API = "API"
637
+ }
638
+
639
+ declare enum PaymentStatus {
436
640
  PENDING = "PENDING",// Pendiente
437
641
  PREAUTHORIZED = "PREAUTHORIZED",
438
642
  APPROVED = "APPROVED",// Pago aprobado online
@@ -467,12 +671,10 @@ interface Payment {
467
671
  amountRefunded: number;
468
672
  paidAt?: string | Date;
469
673
  refundedAt?: string | Date;
470
- status: TransactionStatus;
674
+ status: PaymentStatus;
471
675
  cardBrand?: string;
472
676
  cardLast4?: string;
473
- gatewayProvider?: string;
474
- gatewayMetadata?: Record<string, any>;
475
- paymentRedirectUrl?: string;
677
+ metadata?: Record<string, any>;
476
678
  demo: boolean;
477
679
  createdAt: string | Date;
478
680
  updatedAt: string | Date;
@@ -720,164 +922,9 @@ declare enum StorePageType {
720
922
  OTHER = "OTHER"
721
923
  }
722
924
 
723
- /**
724
- * Add an item to the cart
725
- */
726
- interface CartItemAddDto {
727
- cartId: string;
728
- productId: string;
729
- variantId?: string;
730
- quantity: number;
731
- attributes?: {
732
- [key: string]: string | number;
733
- };
734
- userEmail?: string;
735
- userId?: string;
736
- }
737
- /**
738
- * Update an item in the cart
739
- */
740
- interface CartItemUpdateDto {
741
- cartId: string;
742
- itemId: string;
743
- quantity: number;
744
- }
745
- /**
746
- * Remove an item from the cart
747
- */
748
- interface CartItemRemoveDto {
749
- cartId: string;
750
- itemId: string;
751
- }
752
- interface CartUpdateDto {
753
- cartId: string;
754
- customer: {
755
- email: string;
756
- };
757
- delivery: {
758
- type: 'shipping' | 'pickup';
759
- deliveryOptionId?: string;
760
- pickupBranchId?: string;
761
- firstname: string;
762
- lastname: string;
763
- phone: {
764
- countryCode: string;
765
- national: string;
766
- international: string;
767
- type: string;
768
- validated: boolean;
769
- };
770
- address: {
771
- country: string;
772
- department: string;
773
- locality: string;
774
- street: string;
775
- complement?: string;
776
- notes?: string;
777
- postalCode: string;
778
- mapPosition: {
779
- lat: number;
780
- lng: number;
781
- };
782
- };
783
- };
784
- billing: {
785
- name: string;
786
- address: string;
787
- city: string;
788
- department: string;
789
- };
790
- }
791
- /**
792
- * Confirm a cart
793
- */
794
- interface CartConfirmDto {
795
- cartId: string;
796
- }
797
- /**
798
- * Validation information for a cart item
799
- */
800
- interface CartItemValidation {
801
- hasIssues: boolean;
802
- issues: string[];
803
- errorCode?: CartItemErrorCode;
804
- currentPrice?: number;
805
- availableStock?: number;
806
- isProductActive?: boolean;
807
- }
808
- /**
809
- * Error codes for cart items
810
- */
811
- declare enum CartItemErrorCode {
812
- PRICE_INCREASED = "PRICE_INCREASED",// Precio aumentó
813
- PRICE_DECREASED = "PRICE_DECREASED",// Precio disminuyó
814
- PRODUCT_INACTIVE = "PRODUCT_INACTIVE",// Producto ya no está disponible
815
- STOCK_INSUFFICIENT = "STOCK_INSUFFICIENT",// Stock insuficiente (hay algo disponible)
816
- STOCK_UNAVAILABLE = "STOCK_UNAVAILABLE",// Sin stock (0 disponible)
817
- VALIDATION_ERROR = "VALIDATION_ERROR"
818
- }
819
-
820
- /**
821
- * Entidad Cart
822
- * Define el carrito de compras de un cliente en el sitio web.
823
- */
824
- interface Cart {
825
- id: string;
826
- code: string;
827
- customerId?: string;
828
- sessionId?: string;
829
- items: CartItem[];
830
- subtotal: number;
831
- total: number;
832
- currency: string;
833
- itemCount: number;
834
- createdAt: Date;
835
- updatedAt: Date;
836
- status: CartStatus;
837
- source: CartSource;
838
- recoveryToken?: string;
839
- userEmail?: string;
840
- userId?: string;
841
- customerNote?: string;
842
- hasIssues: boolean;
843
- issuesCount: number;
844
- subtotalPrice?: number;
845
- totalDiscounts?: number;
846
- totalShippingPrice?: number;
847
- totalTax?: number;
848
- totalPrice?: number;
849
- taxDetails?: any;
850
- }
851
- interface CartItem {
852
- id: string;
853
- productId: string;
854
- productVariantId: string;
855
- name: string;
856
- unitPrice: number;
857
- quantity: number;
858
- image?: string;
859
- thumbnailUrl?: string;
860
- sku?: string;
861
- attributeDetails: CartItemAttributeDetail[];
862
- validation?: CartItemValidation;
863
- }
864
- interface CartItemAttributeDetail {
865
- name: string;
866
- value: string;
867
- type?: string;
868
- }
869
- declare enum CartStatus {
870
- ACTIVE = "ACTIVE",
871
- LOCKED = "LOCKED",
872
- EXPIRED = "EXPIRED",
873
- CONVERTED = "CONVERTED",
874
- ABANDONED = "ABANDONED",
875
- MERGED = "MERGED"
876
- }
877
- declare enum CartSource {
878
- WEB = "WEB",
879
- POS = "POS",
880
- API = "API"
925
+ declare enum PubSubTopics {
926
+ ORDER_PLACED = "order-placed",
927
+ NOTIFICATION_CREATED = "notification-created"
881
928
  }
882
929
 
883
- export { type Account, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, AccountStatus, type Address, type AdminOrderStatusChangeDto, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, type Cart, type CartConfirmDto, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, CartSource, CartStatus, type CartUpdateDto, Currency, type Integration, IntegrationCategory, IntegrationStatus, type MapPosition, type Media, MediaType, type Order, type OrderCreateFromCartDto, OrderDeliveryType, OrderFulfillmentStatus, type OrderItem, OrderPaymentStatus, OrderSource, OrderStatus, type Payment, PaymentMethodType, type Phone, type Product, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StoreBanner, StoreBannerStatus, type StorePage, StorePageStatus, StorePageType, type ThemeConfig, TransactionStatus, getCurrencySymbol };
930
+ export { type Account, type AccountBranch, type AccountBranchSchedule, AccountBranchScheduleDay, AccountBranchScheduleStatus, AccountBranchStatus, type AccountDeliveryOption, type AccountDeliveryOptionCalculatedCost, AccountDeliveryOptionPriceLogic, AccountDeliveryOptionStatus, type AccountDeliveryOptionZone, AccountDeliveryOptionZoneStatus, type AccountDomain, AccountDomainStatus, type AccountIntegration, type AccountIntegrationConfigDTO, AccountIntegrationConnectionStatus, AccountIntegrationEnvironment, AccountIntegrationStatus, AccountStatus, type Address, type AdminOrderStatusChangeDto, type BaseEntity, type BaseEntityWithAccount, type BaseEntityWithAccountAndUser, type BaseEntityWithUser, type Cart, type CartConfirmDto, type CartItem, type CartItemAddDto, type CartItemAttributeDetail, CartItemErrorCode, type CartItemRemoveDto, type CartItemUpdateDto, type CartItemValidation, CartSource, CartStatus, type CartUpdateDto, Currency, type Customer, CustomerStatus, type CustomerUpsertDto, type Integration, IntegrationCategory, IntegrationStatus, type MapPosition, type Media, MediaType, type Order, type OrderCreateFromCartDto, OrderDeliveryType, OrderFulfillmentStatus, type OrderItem, OrderPaymentStatus, OrderSource, OrderStatus, type Payment, PaymentMethodType, PaymentStatus, type Phone, type Product, type ProductAttribute, type ProductAttributeOption, ProductAttributeStatus, ProductAttributeType, type ProductCategory, ProductCategoryStatus, ProductStatus, ProductType, type ProductVariant, PubSubTopics, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StoreBanner, StoreBannerStatus, type StorePage, StorePageStatus, StorePageType, type ThemeConfig, getCurrencySymbol };