shopeasy-sdk 1.0.2 → 1.0.3

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.cts CHANGED
@@ -19,6 +19,13 @@ interface Wallet {
19
19
  createdAt: Date;
20
20
  updatedAt: Date;
21
21
  }
22
+ interface CreateWalletArgs {
23
+ userId: string;
24
+ apiKey?: string;
25
+ gatewayProvider?: GatewayProvider;
26
+ gatewayConfig?: Record<string, unknown>;
27
+ isActive?: boolean;
28
+ }
22
29
  interface UpdateWalletArgs {
23
30
  userId: string;
24
31
  data: {
@@ -59,6 +66,7 @@ interface ConfigDraftSetArgs {
59
66
  guildId: string;
60
67
  data: ConfigUpdateArgs["data"];
61
68
  }
69
+ type paymentProvider = "mercadoPago" | "pixManual";
62
70
  type ActionPermission = "manage_products" | "manage_carts" | "manage_config" | "view_orders" | "process_payments" | "manager_payments" | "manage_roles" | "manager_bot" | "full_access";
63
71
  type RolePermissionsMap = Record<string, ActionPermission[]>;
64
72
  interface Config {
@@ -88,6 +96,7 @@ interface Config {
88
96
  updatedAt: Date;
89
97
  guild?: Guild$1;
90
98
  }
99
+ type ConfigDraft = Partial<Omit<Config, "id">> | null;
91
100
  interface ConfigUpdateArgs {
92
101
  guildId: string;
93
102
  data: Omit<Partial<Config>, "id" | "guildId">;
@@ -154,6 +163,9 @@ interface PlanStatus {
154
163
  expireAt?: Date;
155
164
  daysUntilExpire?: number;
156
165
  }
166
+ interface MarkAlertBody {
167
+ daysUntilExpire: number;
168
+ }
157
169
  interface MarkAlertResponse {
158
170
  success: boolean;
159
171
  message: string;
@@ -173,15 +185,6 @@ interface ProductGetByReference {
173
185
  reference: string;
174
186
  guildId: string;
175
187
  }
176
- interface SaleProduct$1 {
177
- id: string;
178
- saleId: string;
179
- productid: string;
180
- guildId: string;
181
- valueTotal: number;
182
- quantiy: number;
183
- product?: Product;
184
- }
185
188
  interface GenerateProductArgs {
186
189
  guildId: string;
187
190
  productId: string;
@@ -220,7 +223,7 @@ interface Product {
220
223
  coupon?: boolean;
221
224
  colorHex?: string | null;
222
225
  guild?: Guild | null;
223
- sales?: SaleProduct$1[];
226
+ sales?: SaleProduct[];
224
227
  catalogs?: string[];
225
228
  }
226
229
  interface ProduductDraftSetArgs {
@@ -243,6 +246,7 @@ interface ProductUpdateArgs {
243
246
  id: string;
244
247
  data: Omit<Partial<Product>, "id" | "reference">;
245
248
  }
249
+ type ProductDraft = Partial<Omit<Product, "id" | "reference">> | null;
246
250
 
247
251
  interface Guild {
248
252
  id: string;
@@ -283,6 +287,7 @@ interface CustomerUpdateArgs {
283
287
  id: string;
284
288
  data: Omit<Partial<Customer>, "id" | "userId" | "guildId">;
285
289
  }
290
+ type CustomerDraft = Partial<Omit<Customer, "id" | "userId" | "guildId">> | null;
286
291
 
287
292
  interface SaleCreateArgs {
288
293
  userId: string;
@@ -361,6 +366,17 @@ interface PaymentConfig {
361
366
  walletApiKey?: string;
362
367
  chavePixchavePixStaticQrCode: boolean;
363
368
  }
369
+ interface CreatePaymentConfigArgs {
370
+ guildId: string;
371
+ provider?: PaymentProvider;
372
+ mercadoPagoToken?: string;
373
+ efiBankToken?: string;
374
+ chavePix?: string;
375
+ chavePixType?: "CPF" | "EMAIL" | "ALEATORIA" | "NUMERO";
376
+ chavePixName?: string;
377
+ chavePixCity?: string;
378
+ chavePixchavePixStaticQrCode: boolean;
379
+ }
364
380
  interface UpdatePaymentConfigArgs {
365
381
  guildId: string;
366
382
  data: {
@@ -424,6 +440,7 @@ interface Image {
424
440
  expiresIn: number;
425
441
  }
426
442
  type imageCreate = Omit<Image, "id">;
443
+ type ImageUpdate = Omit<Image, "id" | "guildId">;
427
444
 
428
445
  type CouponStatus = "ACTIVED" | "DEACTIVATED" | "EXPIRED";
429
446
  interface Coupon {
@@ -463,6 +480,7 @@ interface CouponUpdateArgs {
463
480
  id: string;
464
481
  data: Omit<Partial<Coupon>, "id" | "reference">;
465
482
  }
483
+ type CouponDraft = Partial<Omit<Coupon, "id" | "reference">> | null;
466
484
 
467
485
  type CatalogStatus = "ACTIVED" | "DEACTIVATED" | "BANNED";
468
486
  interface CatalogProduct {
@@ -503,6 +521,7 @@ interface CatalogUpdateArgs {
503
521
  id: string;
504
522
  data: Omit<Partial<Catalog>, "id" | "reference" | "guild" | "products">;
505
523
  }
524
+ type CatalogDraft = Partial<Omit<Catalog, "id" | "reference" | "guild" | "products">> | null;
506
525
  interface CatalogDraftSetArgs {
507
526
  id: string;
508
527
  userId: string;
@@ -591,6 +610,190 @@ interface CartGetArgs {
591
610
  guildId: string;
592
611
  }
593
612
 
613
+ /**
614
+ * Tipos de chave PIX aceitos pela A-TOS
615
+ */
616
+ type AtosPixKeyType = "TELEF" | "EMAIL" | "CNPJ" | "CPF" | "CHAVE";
617
+ /**
618
+ * Recipient types:
619
+ * 0 → divide lucro (não altera valor)
620
+ * 1 → comissão percentual (antes dos sócios)
621
+ * 2 → soma no valor cobrado (taxas / upsell)
622
+ */
623
+ type AtosRecipientType = 0 | 1 | 2;
624
+ /**
625
+ * Type 2 → valor fixo que SOMA ao valor cobrado
626
+ */
627
+ interface AtosRecipientType2 {
628
+ id: string;
629
+ type: 2;
630
+ amount: number;
631
+ percentage?: never;
632
+ }
633
+ /**
634
+ * Type 1 → comissão percentual (antes dos sócios)
635
+ */
636
+ interface AtosRecipientType1 {
637
+ id: string;
638
+ type: 1;
639
+ percentage: number;
640
+ amount?: never;
641
+ }
642
+ /**
643
+ * Type 0 → divisão de lucro entre sócios / owner
644
+ */
645
+ interface AtosRecipientType0 {
646
+ id: string;
647
+ type: 0;
648
+ percentage: number;
649
+ amount?: never;
650
+ }
651
+ /**
652
+ * Union final de recipients (INPUT)
653
+ */
654
+ type AtosRecipient = AtosRecipientType0 | AtosRecipientType1 | AtosRecipientType2;
655
+ interface AtosCreatePixPaymentInput {
656
+ amount: number;
657
+ fee_to_customer?: boolean;
658
+ shop: {
659
+ /** ID lógico do servidor / loja */
660
+ id: string;
661
+ /** Nome do servidor / loja */
662
+ name: string;
663
+ /** Wallet / owner que receberá o saldo */
664
+ owner_id: string;
665
+ };
666
+ items: {
667
+ id: string;
668
+ name: string;
669
+ quantity: number;
670
+ }[];
671
+ customer: {
672
+ id: string;
673
+ name: string;
674
+ };
675
+ seller: {
676
+ /** CPF ou CNPJ do titular da API Key */
677
+ national_registration: string;
678
+ national_registration_name: string;
679
+ };
680
+ recipients?: AtosRecipient[];
681
+ overwrite_webhook_url?: string;
682
+ }
683
+ interface AtosCreatePixPaymentResponse {
684
+ id: string;
685
+ amount: number;
686
+ status: string;
687
+ qr_code?: string;
688
+ qr_code_image_url?: string;
689
+ }
690
+ /**
691
+ * Recipient retornado pelo gateway
692
+ */
693
+ interface AtosRecipientResponse {
694
+ id: string;
695
+ type: AtosRecipientType;
696
+ percentage: number | null;
697
+ amount: number;
698
+ available_at: string | null;
699
+ }
700
+ /**
701
+ * Shop retornado
702
+ */
703
+ interface AtosShopResponse {
704
+ id: string;
705
+ name: string;
706
+ owner_id: string;
707
+ created_at: string | null;
708
+ }
709
+ /**
710
+ * Item retornado
711
+ */
712
+ interface AtosItemResponse {
713
+ id: string;
714
+ name: string;
715
+ quantity: number;
716
+ }
717
+ /**
718
+ * Customer retornado
719
+ */
720
+ interface AtosCustomerResponse {
721
+ id: string;
722
+ name: string;
723
+ cpf: string | null;
724
+ email: string | null;
725
+ ip: string | null;
726
+ }
727
+ interface AtosCreatePixPaymentFullResponse {
728
+ id: string;
729
+ shop: AtosShopResponse;
730
+ status: "pending" | "paid" | "expired" | "refunded";
731
+ amount: number;
732
+ recipients: AtosRecipientResponse[];
733
+ items: AtosItemResponse[];
734
+ customer: AtosCustomerResponse;
735
+ /** Código PIX (copia e cola) */
736
+ data: string;
737
+ payer: unknown | null;
738
+ /** Data de expiração do PIX */
739
+ expire_at: string;
740
+ created_at: string;
741
+ infraction: unknown | null;
742
+ end2end_id: string | null;
743
+ receipt_file_url: string | null;
744
+ custom_message: string | null;
745
+ withdrawn: boolean;
746
+ withdraw_id: string | null;
747
+ kyc_validated: boolean;
748
+ /** Identificador interno do gateway */
749
+ identifier: string;
750
+ }
751
+ interface AtosRefundResponse {
752
+ success?: boolean;
753
+ status?: string;
754
+ }
755
+ interface AtosWithdrawInput {
756
+ /** Wallet / owner que está sacando */
757
+ withdraw_user_id: string;
758
+ pixKey: string;
759
+ pixKeyType: AtosPixKeyType;
760
+ baasPostbackUrl: string;
761
+ }
762
+ interface AtosWithdrawResponse {
763
+ id: string;
764
+ status: string;
765
+ }
766
+ interface AtosBalanceResponse {
767
+ balance: number;
768
+ }
769
+
770
+ interface Bot {
771
+ id: string;
772
+ hostingId: string | null;
773
+ status: "AVAILABLE" | "IN_USE" | "GRACE";
774
+ currentPlanId: string | null;
775
+ deployedAt: string | null;
776
+ lastUsedAt: string | null;
777
+ createdAt: string;
778
+ updatedAt: string;
779
+ }
780
+ interface BotStatus {
781
+ running: boolean;
782
+ restarted?: boolean;
783
+ status: string;
784
+ usage: {
785
+ cpu: string;
786
+ ram: string;
787
+ network: string;
788
+ storage: string;
789
+ };
790
+ }
791
+ interface BotDeploy {
792
+ message: string;
793
+ bot: Bot;
794
+ hostingId: string;
795
+ }
796
+
594
797
  declare function cartWillExpire(cart: Cart): Promise<void>;
595
798
  declare function cartAntiFakeVerify(configs: Config, member: GuildMember): boolean;
596
799
  declare function cartVerifyPermission(cart: Cart, member: GuildMember, configs: Config): boolean;
@@ -751,7 +954,7 @@ declare class ShopEasySdk {
751
954
  create(args: SaleCreateArgs): Promise<Sale>;
752
955
  getById(id: string): Promise<Sale | null>;
753
956
  getAllByGuild(guildId: string): Promise<Sale[]>;
754
- saleProductGet(id: string): Promise<SaleProduct$1 | null>;
957
+ saleProductGet(id: string): Promise<SaleProduct | null>;
755
958
  delete(id: string): Promise<void>;
756
959
  };
757
960
  tokens: {
@@ -771,3 +974,4 @@ declare class ShopEasySdk {
771
974
  }
772
975
 
773
976
  export { ShopEasySdk, cartAntiFakeVerify, cartCalculeTotal, cartVerifyAproved, cartVerifyPermission, cartWillExpire, formatDecimalToNumber, formatNumberToDecimal, formatPrice, formatRelativeTime, hasPermission, pixUtils };
977
+ export type { ActionPermission, AtosBalanceResponse, AtosCreatePixPaymentFullResponse, AtosCreatePixPaymentInput, AtosCreatePixPaymentResponse, AtosCustomerResponse, AtosItemResponse, AtosPixKeyType, AtosRecipient, AtosRecipientResponse, AtosRecipientType, AtosRecipientType0, AtosRecipientType1, AtosRecipientType2, AtosRefundResponse, AtosShopResponse, AtosWithdrawInput, AtosWithdrawResponse, Bot, BotDeploy, BotStatus, Cart, CartDraft, CartDraftProduct, CartGetArgs, CartProduct, CartStatus, CartUpdateArgs, Catalog, CatalogCreateArgs, CatalogDraft, CatalogDraftGetArgs, CatalogDraftSetArgs, CatalogProduct, CatalogStatus, CatalogUpdateArgs, CheckExpirationsResponse, Config, ConfigDraft, ConfigDraftGetArgs, ConfigDraftSetArgs, ConfigUpdateArgs, Coupon, CouponCreateArgs, CouponDraft, CouponDraftGetArgs, CouponDraftSetArgs, CouponStatus, CouponUpdateArgs, CreateCartArgs, CreateCartProduct, CreatePaymentConfigArgs, CreateWalletArgs, Customer, CustomerCreateArgs, CustomerDraft, CustomerDraftGetArgs, CustomerDraftSetArgs, CustomerUpdateArgs, EfiPixCreateResponse, ExpiredPlansResponse, ExpiringPlan, GatewayProvider, GenerateProductArgs, Image, ImageUpdate, MarkAlertBody, MarkAlertResponse, Order, OrderCreate, OrderCustomer, OrderPayment, OrderProduct, PaymentConfig, PaymentProvider, Plan, PlanNeedingAlert, PlanStatus, PlanSubscriptionCreateArgs, PlanType, PlansNeedingAlertResponse, Product, ProductCreateArgs, ProductDraft, ProductGetByReference, ProductId, ProductMode, ProductStatus, ProductStockPushArgs, ProductUpdateArgs, ProduductDraftGetArgs, ProduductDraftSetArgs, RolePermissionsMap, Sale, SaleCreateArgs, SaleProduct, SaleProductCreateArgs, StockMode, Token, TokenUpdateArgs, UpdateCartData, UpdatePaymentConfigArgs, UpdateWalletArgs, Wallet, imageCreate, paymentProvider };
package/dist/index.d.mts CHANGED
@@ -19,6 +19,13 @@ interface Wallet {
19
19
  createdAt: Date;
20
20
  updatedAt: Date;
21
21
  }
22
+ interface CreateWalletArgs {
23
+ userId: string;
24
+ apiKey?: string;
25
+ gatewayProvider?: GatewayProvider;
26
+ gatewayConfig?: Record<string, unknown>;
27
+ isActive?: boolean;
28
+ }
22
29
  interface UpdateWalletArgs {
23
30
  userId: string;
24
31
  data: {
@@ -59,6 +66,7 @@ interface ConfigDraftSetArgs {
59
66
  guildId: string;
60
67
  data: ConfigUpdateArgs["data"];
61
68
  }
69
+ type paymentProvider = "mercadoPago" | "pixManual";
62
70
  type ActionPermission = "manage_products" | "manage_carts" | "manage_config" | "view_orders" | "process_payments" | "manager_payments" | "manage_roles" | "manager_bot" | "full_access";
63
71
  type RolePermissionsMap = Record<string, ActionPermission[]>;
64
72
  interface Config {
@@ -88,6 +96,7 @@ interface Config {
88
96
  updatedAt: Date;
89
97
  guild?: Guild$1;
90
98
  }
99
+ type ConfigDraft = Partial<Omit<Config, "id">> | null;
91
100
  interface ConfigUpdateArgs {
92
101
  guildId: string;
93
102
  data: Omit<Partial<Config>, "id" | "guildId">;
@@ -154,6 +163,9 @@ interface PlanStatus {
154
163
  expireAt?: Date;
155
164
  daysUntilExpire?: number;
156
165
  }
166
+ interface MarkAlertBody {
167
+ daysUntilExpire: number;
168
+ }
157
169
  interface MarkAlertResponse {
158
170
  success: boolean;
159
171
  message: string;
@@ -173,15 +185,6 @@ interface ProductGetByReference {
173
185
  reference: string;
174
186
  guildId: string;
175
187
  }
176
- interface SaleProduct$1 {
177
- id: string;
178
- saleId: string;
179
- productid: string;
180
- guildId: string;
181
- valueTotal: number;
182
- quantiy: number;
183
- product?: Product;
184
- }
185
188
  interface GenerateProductArgs {
186
189
  guildId: string;
187
190
  productId: string;
@@ -220,7 +223,7 @@ interface Product {
220
223
  coupon?: boolean;
221
224
  colorHex?: string | null;
222
225
  guild?: Guild | null;
223
- sales?: SaleProduct$1[];
226
+ sales?: SaleProduct[];
224
227
  catalogs?: string[];
225
228
  }
226
229
  interface ProduductDraftSetArgs {
@@ -243,6 +246,7 @@ interface ProductUpdateArgs {
243
246
  id: string;
244
247
  data: Omit<Partial<Product>, "id" | "reference">;
245
248
  }
249
+ type ProductDraft = Partial<Omit<Product, "id" | "reference">> | null;
246
250
 
247
251
  interface Guild {
248
252
  id: string;
@@ -283,6 +287,7 @@ interface CustomerUpdateArgs {
283
287
  id: string;
284
288
  data: Omit<Partial<Customer>, "id" | "userId" | "guildId">;
285
289
  }
290
+ type CustomerDraft = Partial<Omit<Customer, "id" | "userId" | "guildId">> | null;
286
291
 
287
292
  interface SaleCreateArgs {
288
293
  userId: string;
@@ -361,6 +366,17 @@ interface PaymentConfig {
361
366
  walletApiKey?: string;
362
367
  chavePixchavePixStaticQrCode: boolean;
363
368
  }
369
+ interface CreatePaymentConfigArgs {
370
+ guildId: string;
371
+ provider?: PaymentProvider;
372
+ mercadoPagoToken?: string;
373
+ efiBankToken?: string;
374
+ chavePix?: string;
375
+ chavePixType?: "CPF" | "EMAIL" | "ALEATORIA" | "NUMERO";
376
+ chavePixName?: string;
377
+ chavePixCity?: string;
378
+ chavePixchavePixStaticQrCode: boolean;
379
+ }
364
380
  interface UpdatePaymentConfigArgs {
365
381
  guildId: string;
366
382
  data: {
@@ -424,6 +440,7 @@ interface Image {
424
440
  expiresIn: number;
425
441
  }
426
442
  type imageCreate = Omit<Image, "id">;
443
+ type ImageUpdate = Omit<Image, "id" | "guildId">;
427
444
 
428
445
  type CouponStatus = "ACTIVED" | "DEACTIVATED" | "EXPIRED";
429
446
  interface Coupon {
@@ -463,6 +480,7 @@ interface CouponUpdateArgs {
463
480
  id: string;
464
481
  data: Omit<Partial<Coupon>, "id" | "reference">;
465
482
  }
483
+ type CouponDraft = Partial<Omit<Coupon, "id" | "reference">> | null;
466
484
 
467
485
  type CatalogStatus = "ACTIVED" | "DEACTIVATED" | "BANNED";
468
486
  interface CatalogProduct {
@@ -503,6 +521,7 @@ interface CatalogUpdateArgs {
503
521
  id: string;
504
522
  data: Omit<Partial<Catalog>, "id" | "reference" | "guild" | "products">;
505
523
  }
524
+ type CatalogDraft = Partial<Omit<Catalog, "id" | "reference" | "guild" | "products">> | null;
506
525
  interface CatalogDraftSetArgs {
507
526
  id: string;
508
527
  userId: string;
@@ -591,6 +610,190 @@ interface CartGetArgs {
591
610
  guildId: string;
592
611
  }
593
612
 
613
+ /**
614
+ * Tipos de chave PIX aceitos pela A-TOS
615
+ */
616
+ type AtosPixKeyType = "TELEF" | "EMAIL" | "CNPJ" | "CPF" | "CHAVE";
617
+ /**
618
+ * Recipient types:
619
+ * 0 → divide lucro (não altera valor)
620
+ * 1 → comissão percentual (antes dos sócios)
621
+ * 2 → soma no valor cobrado (taxas / upsell)
622
+ */
623
+ type AtosRecipientType = 0 | 1 | 2;
624
+ /**
625
+ * Type 2 → valor fixo que SOMA ao valor cobrado
626
+ */
627
+ interface AtosRecipientType2 {
628
+ id: string;
629
+ type: 2;
630
+ amount: number;
631
+ percentage?: never;
632
+ }
633
+ /**
634
+ * Type 1 → comissão percentual (antes dos sócios)
635
+ */
636
+ interface AtosRecipientType1 {
637
+ id: string;
638
+ type: 1;
639
+ percentage: number;
640
+ amount?: never;
641
+ }
642
+ /**
643
+ * Type 0 → divisão de lucro entre sócios / owner
644
+ */
645
+ interface AtosRecipientType0 {
646
+ id: string;
647
+ type: 0;
648
+ percentage: number;
649
+ amount?: never;
650
+ }
651
+ /**
652
+ * Union final de recipients (INPUT)
653
+ */
654
+ type AtosRecipient = AtosRecipientType0 | AtosRecipientType1 | AtosRecipientType2;
655
+ interface AtosCreatePixPaymentInput {
656
+ amount: number;
657
+ fee_to_customer?: boolean;
658
+ shop: {
659
+ /** ID lógico do servidor / loja */
660
+ id: string;
661
+ /** Nome do servidor / loja */
662
+ name: string;
663
+ /** Wallet / owner que receberá o saldo */
664
+ owner_id: string;
665
+ };
666
+ items: {
667
+ id: string;
668
+ name: string;
669
+ quantity: number;
670
+ }[];
671
+ customer: {
672
+ id: string;
673
+ name: string;
674
+ };
675
+ seller: {
676
+ /** CPF ou CNPJ do titular da API Key */
677
+ national_registration: string;
678
+ national_registration_name: string;
679
+ };
680
+ recipients?: AtosRecipient[];
681
+ overwrite_webhook_url?: string;
682
+ }
683
+ interface AtosCreatePixPaymentResponse {
684
+ id: string;
685
+ amount: number;
686
+ status: string;
687
+ qr_code?: string;
688
+ qr_code_image_url?: string;
689
+ }
690
+ /**
691
+ * Recipient retornado pelo gateway
692
+ */
693
+ interface AtosRecipientResponse {
694
+ id: string;
695
+ type: AtosRecipientType;
696
+ percentage: number | null;
697
+ amount: number;
698
+ available_at: string | null;
699
+ }
700
+ /**
701
+ * Shop retornado
702
+ */
703
+ interface AtosShopResponse {
704
+ id: string;
705
+ name: string;
706
+ owner_id: string;
707
+ created_at: string | null;
708
+ }
709
+ /**
710
+ * Item retornado
711
+ */
712
+ interface AtosItemResponse {
713
+ id: string;
714
+ name: string;
715
+ quantity: number;
716
+ }
717
+ /**
718
+ * Customer retornado
719
+ */
720
+ interface AtosCustomerResponse {
721
+ id: string;
722
+ name: string;
723
+ cpf: string | null;
724
+ email: string | null;
725
+ ip: string | null;
726
+ }
727
+ interface AtosCreatePixPaymentFullResponse {
728
+ id: string;
729
+ shop: AtosShopResponse;
730
+ status: "pending" | "paid" | "expired" | "refunded";
731
+ amount: number;
732
+ recipients: AtosRecipientResponse[];
733
+ items: AtosItemResponse[];
734
+ customer: AtosCustomerResponse;
735
+ /** Código PIX (copia e cola) */
736
+ data: string;
737
+ payer: unknown | null;
738
+ /** Data de expiração do PIX */
739
+ expire_at: string;
740
+ created_at: string;
741
+ infraction: unknown | null;
742
+ end2end_id: string | null;
743
+ receipt_file_url: string | null;
744
+ custom_message: string | null;
745
+ withdrawn: boolean;
746
+ withdraw_id: string | null;
747
+ kyc_validated: boolean;
748
+ /** Identificador interno do gateway */
749
+ identifier: string;
750
+ }
751
+ interface AtosRefundResponse {
752
+ success?: boolean;
753
+ status?: string;
754
+ }
755
+ interface AtosWithdrawInput {
756
+ /** Wallet / owner que está sacando */
757
+ withdraw_user_id: string;
758
+ pixKey: string;
759
+ pixKeyType: AtosPixKeyType;
760
+ baasPostbackUrl: string;
761
+ }
762
+ interface AtosWithdrawResponse {
763
+ id: string;
764
+ status: string;
765
+ }
766
+ interface AtosBalanceResponse {
767
+ balance: number;
768
+ }
769
+
770
+ interface Bot {
771
+ id: string;
772
+ hostingId: string | null;
773
+ status: "AVAILABLE" | "IN_USE" | "GRACE";
774
+ currentPlanId: string | null;
775
+ deployedAt: string | null;
776
+ lastUsedAt: string | null;
777
+ createdAt: string;
778
+ updatedAt: string;
779
+ }
780
+ interface BotStatus {
781
+ running: boolean;
782
+ restarted?: boolean;
783
+ status: string;
784
+ usage: {
785
+ cpu: string;
786
+ ram: string;
787
+ network: string;
788
+ storage: string;
789
+ };
790
+ }
791
+ interface BotDeploy {
792
+ message: string;
793
+ bot: Bot;
794
+ hostingId: string;
795
+ }
796
+
594
797
  declare function cartWillExpire(cart: Cart): Promise<void>;
595
798
  declare function cartAntiFakeVerify(configs: Config, member: GuildMember): boolean;
596
799
  declare function cartVerifyPermission(cart: Cart, member: GuildMember, configs: Config): boolean;
@@ -751,7 +954,7 @@ declare class ShopEasySdk {
751
954
  create(args: SaleCreateArgs): Promise<Sale>;
752
955
  getById(id: string): Promise<Sale | null>;
753
956
  getAllByGuild(guildId: string): Promise<Sale[]>;
754
- saleProductGet(id: string): Promise<SaleProduct$1 | null>;
957
+ saleProductGet(id: string): Promise<SaleProduct | null>;
755
958
  delete(id: string): Promise<void>;
756
959
  };
757
960
  tokens: {
@@ -771,3 +974,4 @@ declare class ShopEasySdk {
771
974
  }
772
975
 
773
976
  export { ShopEasySdk, cartAntiFakeVerify, cartCalculeTotal, cartVerifyAproved, cartVerifyPermission, cartWillExpire, formatDecimalToNumber, formatNumberToDecimal, formatPrice, formatRelativeTime, hasPermission, pixUtils };
977
+ export type { ActionPermission, AtosBalanceResponse, AtosCreatePixPaymentFullResponse, AtosCreatePixPaymentInput, AtosCreatePixPaymentResponse, AtosCustomerResponse, AtosItemResponse, AtosPixKeyType, AtosRecipient, AtosRecipientResponse, AtosRecipientType, AtosRecipientType0, AtosRecipientType1, AtosRecipientType2, AtosRefundResponse, AtosShopResponse, AtosWithdrawInput, AtosWithdrawResponse, Bot, BotDeploy, BotStatus, Cart, CartDraft, CartDraftProduct, CartGetArgs, CartProduct, CartStatus, CartUpdateArgs, Catalog, CatalogCreateArgs, CatalogDraft, CatalogDraftGetArgs, CatalogDraftSetArgs, CatalogProduct, CatalogStatus, CatalogUpdateArgs, CheckExpirationsResponse, Config, ConfigDraft, ConfigDraftGetArgs, ConfigDraftSetArgs, ConfigUpdateArgs, Coupon, CouponCreateArgs, CouponDraft, CouponDraftGetArgs, CouponDraftSetArgs, CouponStatus, CouponUpdateArgs, CreateCartArgs, CreateCartProduct, CreatePaymentConfigArgs, CreateWalletArgs, Customer, CustomerCreateArgs, CustomerDraft, CustomerDraftGetArgs, CustomerDraftSetArgs, CustomerUpdateArgs, EfiPixCreateResponse, ExpiredPlansResponse, ExpiringPlan, GatewayProvider, GenerateProductArgs, Image, ImageUpdate, MarkAlertBody, MarkAlertResponse, Order, OrderCreate, OrderCustomer, OrderPayment, OrderProduct, PaymentConfig, PaymentProvider, Plan, PlanNeedingAlert, PlanStatus, PlanSubscriptionCreateArgs, PlanType, PlansNeedingAlertResponse, Product, ProductCreateArgs, ProductDraft, ProductGetByReference, ProductId, ProductMode, ProductStatus, ProductStockPushArgs, ProductUpdateArgs, ProduductDraftGetArgs, ProduductDraftSetArgs, RolePermissionsMap, Sale, SaleCreateArgs, SaleProduct, SaleProductCreateArgs, StockMode, Token, TokenUpdateArgs, UpdateCartData, UpdatePaymentConfigArgs, UpdateWalletArgs, Wallet, imageCreate, paymentProvider };
package/dist/index.d.ts CHANGED
@@ -19,6 +19,13 @@ interface Wallet {
19
19
  createdAt: Date;
20
20
  updatedAt: Date;
21
21
  }
22
+ interface CreateWalletArgs {
23
+ userId: string;
24
+ apiKey?: string;
25
+ gatewayProvider?: GatewayProvider;
26
+ gatewayConfig?: Record<string, unknown>;
27
+ isActive?: boolean;
28
+ }
22
29
  interface UpdateWalletArgs {
23
30
  userId: string;
24
31
  data: {
@@ -59,6 +66,7 @@ interface ConfigDraftSetArgs {
59
66
  guildId: string;
60
67
  data: ConfigUpdateArgs["data"];
61
68
  }
69
+ type paymentProvider = "mercadoPago" | "pixManual";
62
70
  type ActionPermission = "manage_products" | "manage_carts" | "manage_config" | "view_orders" | "process_payments" | "manager_payments" | "manage_roles" | "manager_bot" | "full_access";
63
71
  type RolePermissionsMap = Record<string, ActionPermission[]>;
64
72
  interface Config {
@@ -88,6 +96,7 @@ interface Config {
88
96
  updatedAt: Date;
89
97
  guild?: Guild$1;
90
98
  }
99
+ type ConfigDraft = Partial<Omit<Config, "id">> | null;
91
100
  interface ConfigUpdateArgs {
92
101
  guildId: string;
93
102
  data: Omit<Partial<Config>, "id" | "guildId">;
@@ -154,6 +163,9 @@ interface PlanStatus {
154
163
  expireAt?: Date;
155
164
  daysUntilExpire?: number;
156
165
  }
166
+ interface MarkAlertBody {
167
+ daysUntilExpire: number;
168
+ }
157
169
  interface MarkAlertResponse {
158
170
  success: boolean;
159
171
  message: string;
@@ -173,15 +185,6 @@ interface ProductGetByReference {
173
185
  reference: string;
174
186
  guildId: string;
175
187
  }
176
- interface SaleProduct$1 {
177
- id: string;
178
- saleId: string;
179
- productid: string;
180
- guildId: string;
181
- valueTotal: number;
182
- quantiy: number;
183
- product?: Product;
184
- }
185
188
  interface GenerateProductArgs {
186
189
  guildId: string;
187
190
  productId: string;
@@ -220,7 +223,7 @@ interface Product {
220
223
  coupon?: boolean;
221
224
  colorHex?: string | null;
222
225
  guild?: Guild | null;
223
- sales?: SaleProduct$1[];
226
+ sales?: SaleProduct[];
224
227
  catalogs?: string[];
225
228
  }
226
229
  interface ProduductDraftSetArgs {
@@ -243,6 +246,7 @@ interface ProductUpdateArgs {
243
246
  id: string;
244
247
  data: Omit<Partial<Product>, "id" | "reference">;
245
248
  }
249
+ type ProductDraft = Partial<Omit<Product, "id" | "reference">> | null;
246
250
 
247
251
  interface Guild {
248
252
  id: string;
@@ -283,6 +287,7 @@ interface CustomerUpdateArgs {
283
287
  id: string;
284
288
  data: Omit<Partial<Customer>, "id" | "userId" | "guildId">;
285
289
  }
290
+ type CustomerDraft = Partial<Omit<Customer, "id" | "userId" | "guildId">> | null;
286
291
 
287
292
  interface SaleCreateArgs {
288
293
  userId: string;
@@ -361,6 +366,17 @@ interface PaymentConfig {
361
366
  walletApiKey?: string;
362
367
  chavePixchavePixStaticQrCode: boolean;
363
368
  }
369
+ interface CreatePaymentConfigArgs {
370
+ guildId: string;
371
+ provider?: PaymentProvider;
372
+ mercadoPagoToken?: string;
373
+ efiBankToken?: string;
374
+ chavePix?: string;
375
+ chavePixType?: "CPF" | "EMAIL" | "ALEATORIA" | "NUMERO";
376
+ chavePixName?: string;
377
+ chavePixCity?: string;
378
+ chavePixchavePixStaticQrCode: boolean;
379
+ }
364
380
  interface UpdatePaymentConfigArgs {
365
381
  guildId: string;
366
382
  data: {
@@ -424,6 +440,7 @@ interface Image {
424
440
  expiresIn: number;
425
441
  }
426
442
  type imageCreate = Omit<Image, "id">;
443
+ type ImageUpdate = Omit<Image, "id" | "guildId">;
427
444
 
428
445
  type CouponStatus = "ACTIVED" | "DEACTIVATED" | "EXPIRED";
429
446
  interface Coupon {
@@ -463,6 +480,7 @@ interface CouponUpdateArgs {
463
480
  id: string;
464
481
  data: Omit<Partial<Coupon>, "id" | "reference">;
465
482
  }
483
+ type CouponDraft = Partial<Omit<Coupon, "id" | "reference">> | null;
466
484
 
467
485
  type CatalogStatus = "ACTIVED" | "DEACTIVATED" | "BANNED";
468
486
  interface CatalogProduct {
@@ -503,6 +521,7 @@ interface CatalogUpdateArgs {
503
521
  id: string;
504
522
  data: Omit<Partial<Catalog>, "id" | "reference" | "guild" | "products">;
505
523
  }
524
+ type CatalogDraft = Partial<Omit<Catalog, "id" | "reference" | "guild" | "products">> | null;
506
525
  interface CatalogDraftSetArgs {
507
526
  id: string;
508
527
  userId: string;
@@ -591,6 +610,190 @@ interface CartGetArgs {
591
610
  guildId: string;
592
611
  }
593
612
 
613
+ /**
614
+ * Tipos de chave PIX aceitos pela A-TOS
615
+ */
616
+ type AtosPixKeyType = "TELEF" | "EMAIL" | "CNPJ" | "CPF" | "CHAVE";
617
+ /**
618
+ * Recipient types:
619
+ * 0 → divide lucro (não altera valor)
620
+ * 1 → comissão percentual (antes dos sócios)
621
+ * 2 → soma no valor cobrado (taxas / upsell)
622
+ */
623
+ type AtosRecipientType = 0 | 1 | 2;
624
+ /**
625
+ * Type 2 → valor fixo que SOMA ao valor cobrado
626
+ */
627
+ interface AtosRecipientType2 {
628
+ id: string;
629
+ type: 2;
630
+ amount: number;
631
+ percentage?: never;
632
+ }
633
+ /**
634
+ * Type 1 → comissão percentual (antes dos sócios)
635
+ */
636
+ interface AtosRecipientType1 {
637
+ id: string;
638
+ type: 1;
639
+ percentage: number;
640
+ amount?: never;
641
+ }
642
+ /**
643
+ * Type 0 → divisão de lucro entre sócios / owner
644
+ */
645
+ interface AtosRecipientType0 {
646
+ id: string;
647
+ type: 0;
648
+ percentage: number;
649
+ amount?: never;
650
+ }
651
+ /**
652
+ * Union final de recipients (INPUT)
653
+ */
654
+ type AtosRecipient = AtosRecipientType0 | AtosRecipientType1 | AtosRecipientType2;
655
+ interface AtosCreatePixPaymentInput {
656
+ amount: number;
657
+ fee_to_customer?: boolean;
658
+ shop: {
659
+ /** ID lógico do servidor / loja */
660
+ id: string;
661
+ /** Nome do servidor / loja */
662
+ name: string;
663
+ /** Wallet / owner que receberá o saldo */
664
+ owner_id: string;
665
+ };
666
+ items: {
667
+ id: string;
668
+ name: string;
669
+ quantity: number;
670
+ }[];
671
+ customer: {
672
+ id: string;
673
+ name: string;
674
+ };
675
+ seller: {
676
+ /** CPF ou CNPJ do titular da API Key */
677
+ national_registration: string;
678
+ national_registration_name: string;
679
+ };
680
+ recipients?: AtosRecipient[];
681
+ overwrite_webhook_url?: string;
682
+ }
683
+ interface AtosCreatePixPaymentResponse {
684
+ id: string;
685
+ amount: number;
686
+ status: string;
687
+ qr_code?: string;
688
+ qr_code_image_url?: string;
689
+ }
690
+ /**
691
+ * Recipient retornado pelo gateway
692
+ */
693
+ interface AtosRecipientResponse {
694
+ id: string;
695
+ type: AtosRecipientType;
696
+ percentage: number | null;
697
+ amount: number;
698
+ available_at: string | null;
699
+ }
700
+ /**
701
+ * Shop retornado
702
+ */
703
+ interface AtosShopResponse {
704
+ id: string;
705
+ name: string;
706
+ owner_id: string;
707
+ created_at: string | null;
708
+ }
709
+ /**
710
+ * Item retornado
711
+ */
712
+ interface AtosItemResponse {
713
+ id: string;
714
+ name: string;
715
+ quantity: number;
716
+ }
717
+ /**
718
+ * Customer retornado
719
+ */
720
+ interface AtosCustomerResponse {
721
+ id: string;
722
+ name: string;
723
+ cpf: string | null;
724
+ email: string | null;
725
+ ip: string | null;
726
+ }
727
+ interface AtosCreatePixPaymentFullResponse {
728
+ id: string;
729
+ shop: AtosShopResponse;
730
+ status: "pending" | "paid" | "expired" | "refunded";
731
+ amount: number;
732
+ recipients: AtosRecipientResponse[];
733
+ items: AtosItemResponse[];
734
+ customer: AtosCustomerResponse;
735
+ /** Código PIX (copia e cola) */
736
+ data: string;
737
+ payer: unknown | null;
738
+ /** Data de expiração do PIX */
739
+ expire_at: string;
740
+ created_at: string;
741
+ infraction: unknown | null;
742
+ end2end_id: string | null;
743
+ receipt_file_url: string | null;
744
+ custom_message: string | null;
745
+ withdrawn: boolean;
746
+ withdraw_id: string | null;
747
+ kyc_validated: boolean;
748
+ /** Identificador interno do gateway */
749
+ identifier: string;
750
+ }
751
+ interface AtosRefundResponse {
752
+ success?: boolean;
753
+ status?: string;
754
+ }
755
+ interface AtosWithdrawInput {
756
+ /** Wallet / owner que está sacando */
757
+ withdraw_user_id: string;
758
+ pixKey: string;
759
+ pixKeyType: AtosPixKeyType;
760
+ baasPostbackUrl: string;
761
+ }
762
+ interface AtosWithdrawResponse {
763
+ id: string;
764
+ status: string;
765
+ }
766
+ interface AtosBalanceResponse {
767
+ balance: number;
768
+ }
769
+
770
+ interface Bot {
771
+ id: string;
772
+ hostingId: string | null;
773
+ status: "AVAILABLE" | "IN_USE" | "GRACE";
774
+ currentPlanId: string | null;
775
+ deployedAt: string | null;
776
+ lastUsedAt: string | null;
777
+ createdAt: string;
778
+ updatedAt: string;
779
+ }
780
+ interface BotStatus {
781
+ running: boolean;
782
+ restarted?: boolean;
783
+ status: string;
784
+ usage: {
785
+ cpu: string;
786
+ ram: string;
787
+ network: string;
788
+ storage: string;
789
+ };
790
+ }
791
+ interface BotDeploy {
792
+ message: string;
793
+ bot: Bot;
794
+ hostingId: string;
795
+ }
796
+
594
797
  declare function cartWillExpire(cart: Cart): Promise<void>;
595
798
  declare function cartAntiFakeVerify(configs: Config, member: GuildMember): boolean;
596
799
  declare function cartVerifyPermission(cart: Cart, member: GuildMember, configs: Config): boolean;
@@ -751,7 +954,7 @@ declare class ShopEasySdk {
751
954
  create(args: SaleCreateArgs): Promise<Sale>;
752
955
  getById(id: string): Promise<Sale | null>;
753
956
  getAllByGuild(guildId: string): Promise<Sale[]>;
754
- saleProductGet(id: string): Promise<SaleProduct$1 | null>;
957
+ saleProductGet(id: string): Promise<SaleProduct | null>;
755
958
  delete(id: string): Promise<void>;
756
959
  };
757
960
  tokens: {
@@ -771,3 +974,4 @@ declare class ShopEasySdk {
771
974
  }
772
975
 
773
976
  export { ShopEasySdk, cartAntiFakeVerify, cartCalculeTotal, cartVerifyAproved, cartVerifyPermission, cartWillExpire, formatDecimalToNumber, formatNumberToDecimal, formatPrice, formatRelativeTime, hasPermission, pixUtils };
977
+ export type { ActionPermission, AtosBalanceResponse, AtosCreatePixPaymentFullResponse, AtosCreatePixPaymentInput, AtosCreatePixPaymentResponse, AtosCustomerResponse, AtosItemResponse, AtosPixKeyType, AtosRecipient, AtosRecipientResponse, AtosRecipientType, AtosRecipientType0, AtosRecipientType1, AtosRecipientType2, AtosRefundResponse, AtosShopResponse, AtosWithdrawInput, AtosWithdrawResponse, Bot, BotDeploy, BotStatus, Cart, CartDraft, CartDraftProduct, CartGetArgs, CartProduct, CartStatus, CartUpdateArgs, Catalog, CatalogCreateArgs, CatalogDraft, CatalogDraftGetArgs, CatalogDraftSetArgs, CatalogProduct, CatalogStatus, CatalogUpdateArgs, CheckExpirationsResponse, Config, ConfigDraft, ConfigDraftGetArgs, ConfigDraftSetArgs, ConfigUpdateArgs, Coupon, CouponCreateArgs, CouponDraft, CouponDraftGetArgs, CouponDraftSetArgs, CouponStatus, CouponUpdateArgs, CreateCartArgs, CreateCartProduct, CreatePaymentConfigArgs, CreateWalletArgs, Customer, CustomerCreateArgs, CustomerDraft, CustomerDraftGetArgs, CustomerDraftSetArgs, CustomerUpdateArgs, EfiPixCreateResponse, ExpiredPlansResponse, ExpiringPlan, GatewayProvider, GenerateProductArgs, Image, ImageUpdate, MarkAlertBody, MarkAlertResponse, Order, OrderCreate, OrderCustomer, OrderPayment, OrderProduct, PaymentConfig, PaymentProvider, Plan, PlanNeedingAlert, PlanStatus, PlanSubscriptionCreateArgs, PlanType, PlansNeedingAlertResponse, Product, ProductCreateArgs, ProductDraft, ProductGetByReference, ProductId, ProductMode, ProductStatus, ProductStockPushArgs, ProductUpdateArgs, ProduductDraftGetArgs, ProduductDraftSetArgs, RolePermissionsMap, Sale, SaleCreateArgs, SaleProduct, SaleProductCreateArgs, StockMode, Token, TokenUpdateArgs, UpdateCartData, UpdatePaymentConfigArgs, UpdateWalletArgs, Wallet, imageCreate, paymentProvider };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopeasy-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "SDK oficial para integração com a API ShopEasy",
5
5
  "license": "ISC",
6
6
  "author": "jeanbrnd",