@retaila/shared-types 1.1.5 → 1.1.7

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,201 @@ declare enum AccountDomainStatus {
319
320
  INACTIVE = "INACTIVE"
320
321
  }
321
322
 
323
+ /**
324
+ * Add an item to the cart
325
+ */
326
+ interface CartItemAddDto {
327
+ cartId: string;
328
+ productId: string;
329
+ variantId?: string;
330
+ quantity: number;
331
+ attributes?: {
332
+ [key: string]: string | number;
333
+ };
334
+ userEmail?: string;
335
+ userId?: string;
336
+ }
337
+ /**
338
+ * Update an item in the cart
339
+ */
340
+ interface CartItemUpdateDto {
341
+ cartId: string;
342
+ itemId: string;
343
+ quantity: number;
344
+ }
345
+ /**
346
+ * Remove an item from the cart
347
+ */
348
+ interface CartItemRemoveDto {
349
+ cartId: string;
350
+ itemId: string;
351
+ }
352
+ interface CartUpdateDto {
353
+ cartId: string;
354
+ customer: {
355
+ email: string;
356
+ };
357
+ delivery: {
358
+ type: 'shipping' | 'pickup';
359
+ deliveryOptionId?: string;
360
+ pickupBranchId?: string;
361
+ firstname: string;
362
+ lastname: string;
363
+ phone: {
364
+ countryCode: string;
365
+ national: string;
366
+ international: string;
367
+ type: string;
368
+ validated: boolean;
369
+ };
370
+ address: {
371
+ country: string;
372
+ department: string;
373
+ locality: string;
374
+ street: string;
375
+ complement?: string;
376
+ notes?: string;
377
+ postalCode: string;
378
+ mapPosition: {
379
+ lat: number;
380
+ lng: number;
381
+ };
382
+ };
383
+ };
384
+ billing: {
385
+ name: string;
386
+ address: string;
387
+ city: string;
388
+ department: string;
389
+ };
390
+ }
391
+ /**
392
+ * Confirm a cart
393
+ */
394
+ interface CartConfirmDto {
395
+ cartId: string;
396
+ }
397
+ /**
398
+ * Validation information for a cart item
399
+ */
400
+ interface CartItemValidation {
401
+ hasIssues: boolean;
402
+ issues: string[];
403
+ errorCode?: CartItemErrorCode;
404
+ currentPrice?: number;
405
+ availableStock?: number;
406
+ isProductActive?: boolean;
407
+ }
408
+ /**
409
+ * Error codes for cart items
410
+ */
411
+ declare enum CartItemErrorCode {
412
+ PRICE_INCREASED = "PRICE_INCREASED",// Precio aumentó
413
+ PRICE_DECREASED = "PRICE_DECREASED",// Precio disminuyó
414
+ PRODUCT_INACTIVE = "PRODUCT_INACTIVE",// Producto ya no está disponible
415
+ STOCK_INSUFFICIENT = "STOCK_INSUFFICIENT",// Stock insuficiente (hay algo disponible)
416
+ STOCK_UNAVAILABLE = "STOCK_UNAVAILABLE",// Sin stock (0 disponible)
417
+ VALIDATION_ERROR = "VALIDATION_ERROR"
418
+ }
419
+
420
+ /**
421
+ * Entidad Customer
422
+ * Cliente de la tienda
423
+ */
424
+
425
+ interface Customer {
426
+ id: string;
427
+ accountId: string;
428
+ firstName?: string;
429
+ lastName?: string;
430
+ email: string;
431
+ phone?: Phone;
432
+ status: CustomerStatus;
433
+ createdAt: Date;
434
+ updatedAt: Date;
435
+ deletedAt?: Date | null;
436
+ }
437
+ declare enum CustomerStatus {
438
+ ACTIVE = "ACTIVE",
439
+ INACTIVE = "INACTIVE",
440
+ BLACKLISTED = "BLACKLISTED",// e.g., for fraudulent activity
441
+ PENDING = "PENDING"
442
+ }
443
+
444
+ /**
445
+ * Register or update a customer
446
+ */
447
+ interface CustomerUpsertDto {
448
+ id?: string;
449
+ accountId: string;
450
+ firstName?: string;
451
+ lastName?: string;
452
+ email: string;
453
+ phone?: Phone;
454
+ }
455
+
456
+ /**
457
+ * Entidad Cart
458
+ * Define el carrito de compras de un cliente en el sitio web.
459
+ */
460
+ interface Cart {
461
+ id: string;
462
+ code: string;
463
+ customerId?: string;
464
+ sessionId?: string;
465
+ items: CartItem[];
466
+ subtotal: number;
467
+ total: number;
468
+ currency: string;
469
+ itemCount: number;
470
+ createdAt: Date;
471
+ updatedAt: Date;
472
+ status: CartStatus;
473
+ source: CartSource;
474
+ recoveryToken?: string;
475
+ customerNote?: string;
476
+ hasIssues: boolean;
477
+ issuesCount: number;
478
+ subtotalPrice?: number;
479
+ totalDiscounts?: number;
480
+ totalShippingPrice?: number;
481
+ totalTax?: number;
482
+ totalPrice?: number;
483
+ taxDetails?: any;
484
+ customer?: Customer | null;
485
+ }
486
+ interface CartItem {
487
+ id: string;
488
+ productId: string;
489
+ productVariantId: string;
490
+ name: string;
491
+ unitPrice: number;
492
+ quantity: number;
493
+ image?: string;
494
+ thumbnailUrl?: string;
495
+ sku?: string;
496
+ attributeDetails: CartItemAttributeDetail[];
497
+ validation?: CartItemValidation;
498
+ }
499
+ interface CartItemAttributeDetail {
500
+ name: string;
501
+ value: string;
502
+ type?: string;
503
+ }
504
+ declare enum CartStatus {
505
+ ACTIVE = "ACTIVE",
506
+ LOCKED = "LOCKED",
507
+ EXPIRED = "EXPIRED",
508
+ CONVERTED = "CONVERTED",
509
+ ABANDONED = "ABANDONED",
510
+ MERGED = "MERGED"
511
+ }
512
+ declare enum CartSource {
513
+ WEB = "WEB",
514
+ POS = "POS",
515
+ API = "API"
516
+ }
517
+
322
518
  /**
323
519
  * Entidad Order
324
520
  * Define la orden de compra de un cliente en el sitio web.
@@ -360,6 +556,8 @@ interface Order {
360
556
  cancelReason?: string;
361
557
  deletedAt?: Date;
362
558
  items?: OrderItem[];
559
+ customer?: Customer | null;
560
+ paymentMethodIntegration?: AccountIntegration | null;
363
561
  }
364
562
  interface OrderItem {
365
563
  id: string;
@@ -432,7 +630,7 @@ interface AdminOrderStatusChangeDto {
432
630
  status: OrderStatus;
433
631
  }
434
632
 
435
- declare enum TransactionStatus {
633
+ declare enum PaymentStatus {
436
634
  PENDING = "PENDING",// Pendiente
437
635
  PREAUTHORIZED = "PREAUTHORIZED",
438
636
  APPROVED = "APPROVED",// Pago aprobado online
@@ -467,12 +665,10 @@ interface Payment {
467
665
  amountRefunded: number;
468
666
  paidAt?: string | Date;
469
667
  refundedAt?: string | Date;
470
- status: TransactionStatus;
668
+ status: PaymentStatus;
471
669
  cardBrand?: string;
472
670
  cardLast4?: string;
473
- gatewayProvider?: string;
474
- gatewayMetadata?: Record<string, any>;
475
- paymentRedirectUrl?: string;
671
+ metadata?: Record<string, any>;
476
672
  demo: boolean;
477
673
  createdAt: string | Date;
478
674
  updatedAt: string | Date;
@@ -720,164 +916,4 @@ declare enum StorePageType {
720
916
  OTHER = "OTHER"
721
917
  }
722
918
 
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"
881
- }
882
-
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 };
919
+ 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, type StandardCategory, StandardCategoryStatus, type StatusChangeHistory, type StoreBanner, StoreBannerStatus, type StorePage, StorePageStatus, StorePageType, type ThemeConfig, getCurrencySymbol };