@infrab4a/connect 4.3.10-beta.2 → 4.4.0-beta.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.
Files changed (85) hide show
  1. package/index.cjs.js +1031 -449
  2. package/index.esm.js +1008 -450
  3. package/package.json +2 -2
  4. package/src/domain/catalog/models/types/shop-price.type.d.ts +0 -1
  5. package/src/domain/catalog/repositories/product.repository.d.ts +1 -14
  6. package/src/domain/general/index.d.ts +2 -0
  7. package/src/domain/general/models/index.d.ts +1 -0
  8. package/src/domain/general/models/sequences.d.ts +9 -0
  9. package/src/domain/general/repositories/index.d.ts +1 -0
  10. package/src/domain/general/repositories/sequences.repository.d.ts +4 -0
  11. package/src/domain/generic/repository/enums/where.enum.d.ts +1 -2
  12. package/src/domain/generic/repository/types/repository-find-filters.type.d.ts +0 -2
  13. package/src/domain/shop-settings/models/shop-settings.d.ts +0 -1
  14. package/src/domain/shopping/enums/antifraud-providers.enum.d.ts +6 -0
  15. package/src/domain/shopping/enums/index.d.ts +3 -0
  16. package/src/domain/shopping/enums/payment-methods.enum.d.ts +6 -0
  17. package/src/domain/shopping/enums/payment-providers.enum.d.ts +5 -0
  18. package/src/domain/shopping/factories/adyen-payment-method.factory.d.ts +8 -0
  19. package/src/domain/shopping/factories/antifraud-provider.factory.d.ts +15 -0
  20. package/src/domain/shopping/factories/base-payment-method.factory.d.ts +7 -0
  21. package/src/domain/shopping/factories/glampoints-payment-method.factory.d.ts +8 -0
  22. package/src/domain/shopping/factories/index.d.ts +5 -0
  23. package/src/domain/shopping/factories/pagarme-payment-method.factory.d.ts +10 -0
  24. package/src/domain/shopping/factories/payment-provider.factory.d.ts +15 -0
  25. package/src/domain/shopping/index.d.ts +5 -0
  26. package/src/domain/shopping/interfaces/antifraud-method-factory.interface.d.ts +11 -0
  27. package/src/domain/shopping/interfaces/antifraud-provider.interface.d.ts +5 -0
  28. package/src/domain/shopping/interfaces/index.d.ts +7 -0
  29. package/src/domain/shopping/interfaces/payment-method-factory.interface.d.ts +14 -0
  30. package/src/domain/shopping/interfaces/payment-provider-bank-slip.interface.d.ts +5 -0
  31. package/src/domain/shopping/interfaces/payment-provider-card.interface.d.ts +7 -0
  32. package/src/domain/shopping/interfaces/payment-provider-glampoints.interface.d.ts +5 -0
  33. package/src/domain/shopping/interfaces/payment-provider-pix.interface.d.ts +5 -0
  34. package/src/domain/shopping/models/index.d.ts +2 -0
  35. package/src/domain/shopping/models/order-blocked.d.ts +26 -0
  36. package/src/domain/shopping/models/order.d.ts +2 -2
  37. package/src/domain/shopping/models/payment-transaction.d.ts +66 -0
  38. package/src/domain/shopping/models/payment.d.ts +10 -62
  39. package/src/domain/shopping/models/subscription/checkout.d.ts +0 -1
  40. package/src/domain/shopping/models/types/index.d.ts +4 -4
  41. package/src/domain/shopping/repositories/index.d.ts +1 -0
  42. package/src/domain/shopping/repositories/order-blocked.repository.d.ts +6 -0
  43. package/src/domain/shopping/services/adyen-card-payment.service.d.ts +13 -0
  44. package/src/domain/shopping/services/antifraud-bankslip.service.d.ts +9 -0
  45. package/src/domain/shopping/services/antifraud-card.service.d.ts +18 -0
  46. package/src/domain/shopping/services/antifraud-glampoints.service.d.ts +6 -0
  47. package/src/domain/shopping/services/antifraud-pix.service.d.ts +6 -0
  48. package/src/domain/shopping/services/glampoints-payment.service.d.ts +8 -0
  49. package/src/domain/shopping/services/index.d.ts +9 -0
  50. package/src/domain/shopping/services/pagarme-bank-slip-payment.service.d.ts +11 -0
  51. package/src/domain/shopping/services/pagarme-card-payment.service.d.ts +13 -0
  52. package/src/domain/shopping/services/pagarme-pix-payment.service.d.ts +11 -0
  53. package/src/domain/shopping/types/adyen-credentials.type.d.ts +6 -0
  54. package/src/domain/shopping/types/antifraud-provider.type.d.ts +2 -0
  55. package/src/domain/shopping/types/index.d.ts +6 -0
  56. package/src/domain/shopping/types/pagarme-credentials.type.d.ts +5 -0
  57. package/src/domain/shopping/types/payment-card-info.type.d.ts +4 -0
  58. package/src/domain/shopping/types/payment-method.type.d.ts +2 -0
  59. package/src/domain/shopping/types/payment-provider.type.d.ts +2 -0
  60. package/src/domain/users/models/subscription/enums/index.d.ts +0 -1
  61. package/src/domain/users/models/subscription/index.d.ts +0 -1
  62. package/src/domain/users/models/subscription/subscription-summary.d.ts +6 -10
  63. package/src/errors/business.error.d.ts +7 -0
  64. package/src/errors/fraud-validation.error.d.ts +7 -0
  65. package/src/errors/index.d.ts +7 -2
  66. package/src/errors/payment.error.d.ts +7 -0
  67. package/src/errors/stock-limit.error.d.ts +4 -0
  68. package/src/errors/stock-out.error.d.ts +4 -0
  69. package/src/errors/types/checkout-additional-data-erro.type.d.ts +5 -0
  70. package/src/errors/types/index.d.ts +1 -0
  71. package/src/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +1 -1
  72. package/src/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +1 -3
  73. package/src/infra/firebase/firestore/repositories/general/index.d.ts +1 -0
  74. package/src/infra/firebase/firestore/repositories/general/sequences-firestore.repository.d.ts +7 -0
  75. package/src/infra/firebase/firestore/repositories/index.d.ts +3 -2
  76. package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +1 -0
  77. package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +9 -0
  78. package/src/infra/firebase/storage/firebase-file-uploader.service.d.ts +2 -2
  79. package/src/infra/hasura-graphql/enums/hasura-graphql-where.enum.d.ts +1 -4
  80. package/src/infra/hasura-graphql/mixins/helpers/filter-option.helper.d.ts +0 -2
  81. package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +0 -2
  82. package/src/utils/index.d.ts +3 -3
  83. package/src/domain/users/models/subscription/enums/plans.enum.d.ts +0 -6
  84. package/src/domain/users/models/subscription/types/index.d.ts +0 -1
  85. package/src/domain/users/models/subscription/types/plan.type.d.ts +0 -2
package/index.cjs.js CHANGED
@@ -19,6 +19,65 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
19
19
 
20
20
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
21
21
 
22
+ exports.antifraudProviders = void 0;
23
+ (function (antifraudProviders) {
24
+ antifraudProviders["BANKSLIP"] = "bankSlip";
25
+ antifraudProviders["CARD"] = "card";
26
+ antifraudProviders["PIX"] = "pix";
27
+ antifraudProviders["POINTS"] = "glampoints";
28
+ })(exports.antifraudProviders || (exports.antifraudProviders = {}));
29
+
30
+ exports.paymentMethods = void 0;
31
+ (function (paymentMethods) {
32
+ paymentMethods["CARD"] = "card";
33
+ paymentMethods["BANKSLIP"] = "bankSlip";
34
+ paymentMethods["PIX"] = "pix";
35
+ paymentMethods["POINTS"] = "glampoints";
36
+ })(exports.paymentMethods || (exports.paymentMethods = {}));
37
+
38
+ exports.paymentProviders = void 0;
39
+ (function (paymentProviders) {
40
+ paymentProviders["PAGARME"] = "pagarMe";
41
+ paymentProviders["ADYEN"] = "adyen";
42
+ paymentProviders["GLAMPOINTS"] = "glampoints";
43
+ })(exports.paymentProviders || (exports.paymentProviders = {}));
44
+
45
+ class BasePaymentMethodFactory {
46
+ constructor(methods) {
47
+ this.methods = methods;
48
+ }
49
+ build(method) {
50
+ return this.methods[method];
51
+ }
52
+ }
53
+
54
+ class AdyenPaymentMethodFactory extends BasePaymentMethodFactory {
55
+ }
56
+
57
+ class AntifraudProviderFactory {
58
+ constructor(antifraudProviders) {
59
+ this.antifraudProviders = antifraudProviders;
60
+ }
61
+ build(provider) {
62
+ return this.antifraudProviders[provider];
63
+ }
64
+ }
65
+
66
+ class GlampointsPaymentMethodFactory extends BasePaymentMethodFactory {
67
+ }
68
+
69
+ class PagarmePaymentMethodFactory extends BasePaymentMethodFactory {
70
+ }
71
+
72
+ class PaymentProviderFactory {
73
+ constructor(paymentProviders) {
74
+ this.paymentProviders = paymentProviders;
75
+ }
76
+ build(provider) {
77
+ return this.paymentProviders[provider];
78
+ }
79
+ }
80
+
22
81
  class BaseModel {
23
82
  get identifier() {
24
83
  const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
@@ -237,7 +296,6 @@ exports.Where = void 0;
237
296
  Where["NOTLIKE"] = "not like";
238
297
  Where["ISNULL"] = "is null";
239
298
  Where["ISNOTNULL"] = "is not null";
240
- Where["IREGEX"] = "iregex";
241
299
  })(exports.Where || (exports.Where = {}));
242
300
 
243
301
  exports.UpdateOptionActions = void 0;
@@ -481,185 +539,184 @@ exports.PaymentType = void 0;
481
539
  PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
482
540
  })(exports.PaymentType || (exports.PaymentType = {}));
483
541
 
484
- exports.Plans = void 0;
485
- (function (Plans) {
486
- Plans["SELECT"] = "SELECT";
487
- Plans["PRIME"] = "PRIME";
488
- Plans["SELECT_MENSAL"] = "SELECT_MENSAL";
489
- Plans["PRIME_MENSAL"] = "PRIME_MENSAL";
490
- })(exports.Plans || (exports.Plans = {}));
491
-
492
542
  exports.Status = void 0;
493
543
  (function (Status) {
494
544
  Status["ACTIVE"] = "active";
495
545
  Status["CANCELLED"] = "Cancelado";
496
546
  })(exports.Status || (exports.Status = {}));
497
547
 
498
- class Payment extends BaseModel {
499
- static get identifiersFields() {
500
- return ['id'];
501
- }
548
+ class PaymentTransaction extends BaseModel {
502
549
  }
503
550
  tslib.__decorate([
504
551
  classTransformer.Expose({ name: 'refuse_reason' }),
505
552
  tslib.__metadata("design:type", String)
506
- ], Payment.prototype, "refuseReason", void 0);
553
+ ], PaymentTransaction.prototype, "refuseReason", void 0);
507
554
  tslib.__decorate([
508
555
  classTransformer.Expose({ name: 'status_reason' }),
509
556
  tslib.__metadata("design:type", String)
510
- ], Payment.prototype, "statusReason", void 0);
557
+ ], PaymentTransaction.prototype, "statusReason", void 0);
511
558
  tslib.__decorate([
512
559
  classTransformer.Expose({ name: 'acquirer_response_code' }),
513
560
  tslib.__metadata("design:type", String)
514
- ], Payment.prototype, "acquirerResponseCode", void 0);
561
+ ], PaymentTransaction.prototype, "acquirerResponseCode", void 0);
515
562
  tslib.__decorate([
516
563
  classTransformer.Expose({ name: 'acquirer_name' }),
517
564
  tslib.__metadata("design:type", String)
518
- ], Payment.prototype, "acquirerName", void 0);
565
+ ], PaymentTransaction.prototype, "acquirerName", void 0);
519
566
  tslib.__decorate([
520
567
  classTransformer.Expose({ name: 'acquirer_id' }),
521
568
  tslib.__metadata("design:type", String)
522
- ], Payment.prototype, "acquirerId", void 0);
569
+ ], PaymentTransaction.prototype, "acquirerId", void 0);
523
570
  tslib.__decorate([
524
571
  classTransformer.Expose({ name: 'authorization_code' }),
525
572
  tslib.__metadata("design:type", String)
526
- ], Payment.prototype, "authorizationCode", void 0);
573
+ ], PaymentTransaction.prototype, "authorizationCode", void 0);
527
574
  tslib.__decorate([
528
575
  classTransformer.Expose({ name: 'soft_descriptor' }),
529
576
  tslib.__metadata("design:type", String)
530
- ], Payment.prototype, "softDescriptor", void 0);
577
+ ], PaymentTransaction.prototype, "softDescriptor", void 0);
531
578
  tslib.__decorate([
532
579
  classTransformer.Expose({ name: 'date_created' }),
533
580
  tslib.__metadata("design:type", String)
534
- ], Payment.prototype, "dateCreated", void 0);
581
+ ], PaymentTransaction.prototype, "dateCreated", void 0);
535
582
  tslib.__decorate([
536
583
  classTransformer.Expose({ name: 'date_updated' }),
537
584
  tslib.__metadata("design:type", String)
538
- ], Payment.prototype, "dateUpdated", void 0);
585
+ ], PaymentTransaction.prototype, "dateUpdated", void 0);
539
586
  tslib.__decorate([
540
587
  classTransformer.Expose({ name: 'authorized_amount' }),
541
588
  tslib.__metadata("design:type", Number)
542
- ], Payment.prototype, "authorizedAmount", void 0);
589
+ ], PaymentTransaction.prototype, "authorizedAmount", void 0);
543
590
  tslib.__decorate([
544
591
  classTransformer.Expose({ name: 'paid_amount' }),
545
592
  tslib.__metadata("design:type", Number)
546
- ], Payment.prototype, "paidAmount", void 0);
593
+ ], PaymentTransaction.prototype, "paidAmount", void 0);
547
594
  tslib.__decorate([
548
595
  classTransformer.Expose({ name: 'refunded_amount' }),
549
596
  tslib.__metadata("design:type", Number)
550
- ], Payment.prototype, "refundedAmount", void 0);
597
+ ], PaymentTransaction.prototype, "refundedAmount", void 0);
551
598
  tslib.__decorate([
552
599
  classTransformer.Expose({ name: 'card_holder_name' }),
553
600
  tslib.__metadata("design:type", String)
554
- ], Payment.prototype, "cardHolderName", void 0);
601
+ ], PaymentTransaction.prototype, "cardHolderName", void 0);
555
602
  tslib.__decorate([
556
603
  classTransformer.Expose({ name: 'card_last_digits' }),
557
604
  tslib.__metadata("design:type", String)
558
- ], Payment.prototype, "cardLastDigits", void 0);
605
+ ], PaymentTransaction.prototype, "cardLastDigits", void 0);
559
606
  tslib.__decorate([
560
607
  classTransformer.Expose({ name: 'card_first_digits' }),
561
608
  tslib.__metadata("design:type", String)
562
- ], Payment.prototype, "cardFirstDigits", void 0);
609
+ ], PaymentTransaction.prototype, "cardFirstDigits", void 0);
563
610
  tslib.__decorate([
564
611
  classTransformer.Expose({ name: 'card_brand' }),
565
612
  tslib.__metadata("design:type", String)
566
- ], Payment.prototype, "cardBrand", void 0);
613
+ ], PaymentTransaction.prototype, "cardBrand", void 0);
567
614
  tslib.__decorate([
568
615
  classTransformer.Expose({ name: 'card_pin_mode' }),
569
616
  tslib.__metadata("design:type", String)
570
- ], Payment.prototype, "cardPinMode", void 0);
617
+ ], PaymentTransaction.prototype, "cardPinMode", void 0);
571
618
  tslib.__decorate([
572
619
  classTransformer.Expose({ name: 'card_magstripe_fallback' }),
573
620
  tslib.__metadata("design:type", Boolean)
574
- ], Payment.prototype, "cardMagstripeFallback", void 0);
621
+ ], PaymentTransaction.prototype, "cardMagstripeFallback", void 0);
575
622
  tslib.__decorate([
576
623
  classTransformer.Expose({ name: 'cvm_pin' }),
577
624
  tslib.__metadata("design:type", Boolean)
578
- ], Payment.prototype, "cvmPin", void 0);
625
+ ], PaymentTransaction.prototype, "cvmPin", void 0);
579
626
  tslib.__decorate([
580
627
  classTransformer.Expose({ name: 'postback_url' }),
581
628
  tslib.__metadata("design:type", String)
582
- ], Payment.prototype, "postbackUrl", void 0);
629
+ ], PaymentTransaction.prototype, "postbackUrl", void 0);
583
630
  tslib.__decorate([
584
631
  classTransformer.Expose({ name: 'payment_method' }),
585
632
  tslib.__metadata("design:type", String)
586
- ], Payment.prototype, "paymentMethod", void 0);
633
+ ], PaymentTransaction.prototype, "paymentMethod", void 0);
587
634
  tslib.__decorate([
588
635
  classTransformer.Expose({ name: 'capture_method' }),
589
636
  tslib.__metadata("design:type", String)
590
- ], Payment.prototype, "captureMethod", void 0);
637
+ ], PaymentTransaction.prototype, "captureMethod", void 0);
591
638
  tslib.__decorate([
592
639
  classTransformer.Expose({ name: 'antifraud_score' }),
593
640
  tslib.__metadata("design:type", String)
594
- ], Payment.prototype, "antifraudScore", void 0);
641
+ ], PaymentTransaction.prototype, "antifraudScore", void 0);
595
642
  tslib.__decorate([
596
643
  classTransformer.Expose({ name: 'boleto_url' }),
597
644
  tslib.__metadata("design:type", String)
598
- ], Payment.prototype, "boletoUrl", void 0);
645
+ ], PaymentTransaction.prototype, "boletoUrl", void 0);
599
646
  tslib.__decorate([
600
647
  classTransformer.Expose({ name: 'boleto_barcode' }),
601
648
  tslib.__metadata("design:type", String)
602
- ], Payment.prototype, "boletoBarcode", void 0);
649
+ ], PaymentTransaction.prototype, "boletoBarcode", void 0);
603
650
  tslib.__decorate([
604
651
  classTransformer.Expose({ name: 'boleto_expiration_date' }),
605
652
  tslib.__metadata("design:type", String)
606
- ], Payment.prototype, "boletoExpirationDate", void 0);
653
+ ], PaymentTransaction.prototype, "boletoExpirationDate", void 0);
607
654
  tslib.__decorate([
608
655
  classTransformer.Expose({ name: 'subscription_id' }),
609
656
  tslib.__metadata("design:type", String)
610
- ], Payment.prototype, "subscriptionId", void 0);
657
+ ], PaymentTransaction.prototype, "subscriptionId", void 0);
611
658
  tslib.__decorate([
612
659
  classTransformer.Expose({ name: 'split_rules' }),
613
660
  tslib.__metadata("design:type", String)
614
- ], Payment.prototype, "splitRules", void 0);
661
+ ], PaymentTransaction.prototype, "splitRules", void 0);
615
662
  tslib.__decorate([
616
663
  classTransformer.Expose({ name: 'antifraud_metadata' }),
617
664
  tslib.__metadata("design:type", Object)
618
- ], Payment.prototype, "antifraudMetadata", void 0);
665
+ ], PaymentTransaction.prototype, "antifraudMetadata", void 0);
619
666
  tslib.__decorate([
620
667
  classTransformer.Expose({ name: 'reference_key' }),
621
668
  tslib.__metadata("design:type", String)
622
- ], Payment.prototype, "referenceKey", void 0);
669
+ ], PaymentTransaction.prototype, "referenceKey", void 0);
623
670
  tslib.__decorate([
624
671
  classTransformer.Expose({ name: 'local_transaction_id' }),
625
672
  tslib.__metadata("design:type", String)
626
- ], Payment.prototype, "localTransactionId", void 0);
673
+ ], PaymentTransaction.prototype, "localTransactionId", void 0);
627
674
  tslib.__decorate([
628
675
  classTransformer.Expose({ name: 'local_time' }),
629
676
  tslib.__metadata("design:type", String)
630
- ], Payment.prototype, "localTime", void 0);
677
+ ], PaymentTransaction.prototype, "localTime", void 0);
631
678
  tslib.__decorate([
632
679
  classTransformer.Expose({ name: 'fraud_covered' }),
633
680
  tslib.__metadata("design:type", Boolean)
634
- ], Payment.prototype, "fraudCovered", void 0);
681
+ ], PaymentTransaction.prototype, "fraudCovered", void 0);
635
682
  tslib.__decorate([
636
683
  classTransformer.Expose({ name: 'fraud_reimbursed' }),
637
684
  tslib.__metadata("design:type", String)
638
- ], Payment.prototype, "fraudReimbursed", void 0);
685
+ ], PaymentTransaction.prototype, "fraudReimbursed", void 0);
639
686
  tslib.__decorate([
640
687
  classTransformer.Expose({ name: 'order_id' }),
641
688
  tslib.__metadata("design:type", String)
642
- ], Payment.prototype, "orderId", void 0);
689
+ ], PaymentTransaction.prototype, "orderId", void 0);
643
690
  tslib.__decorate([
644
691
  classTransformer.Expose({ name: 'risk_level' }),
645
692
  tslib.__metadata("design:type", String)
646
- ], Payment.prototype, "riskLevel", void 0);
693
+ ], PaymentTransaction.prototype, "riskLevel", void 0);
647
694
  tslib.__decorate([
648
695
  classTransformer.Expose({ name: 'receipt_url' }),
649
696
  tslib.__metadata("design:type", String)
650
- ], Payment.prototype, "receiptUrl", void 0);
697
+ ], PaymentTransaction.prototype, "receiptUrl", void 0);
651
698
  tslib.__decorate([
652
699
  classTransformer.Expose({ name: 'private_label' }),
653
700
  tslib.__metadata("design:type", String)
654
- ], Payment.prototype, "privateLabel", void 0);
701
+ ], PaymentTransaction.prototype, "privateLabel", void 0);
655
702
  tslib.__decorate([
656
703
  classTransformer.Expose({ name: 'pix_qr_code' }),
657
704
  tslib.__metadata("design:type", String)
658
- ], Payment.prototype, "pixQrCode", void 0);
705
+ ], PaymentTransaction.prototype, "pixQrCode", void 0);
659
706
  tslib.__decorate([
660
707
  classTransformer.Expose({ name: 'pix_expiration_date' }),
661
708
  tslib.__metadata("design:type", String)
662
- ], Payment.prototype, "pixExpirationDate", void 0);
709
+ ], PaymentTransaction.prototype, "pixExpirationDate", void 0);
710
+
711
+ class Payment extends BaseModel {
712
+ static get identifiersFields() {
713
+ return ['id'];
714
+ }
715
+ }
716
+ tslib.__decorate([
717
+ classTransformer.Type(() => PaymentTransaction),
718
+ tslib.__metadata("design:type", PaymentTransaction)
719
+ ], Payment.prototype, "transaction", void 0);
663
720
 
664
721
  class SubscriptionPayment extends BaseModel {
665
722
  static get identifiersFields() {
@@ -2158,10 +2215,16 @@ exports.OrderStatus = void 0;
2158
2215
  class Order extends Checkout {
2159
2216
  }
2160
2217
  tslib.__decorate([
2161
- classTransformer.Type(() => Payment),
2162
- tslib.__metadata("design:type", Payment)
2218
+ classTransformer.Type(() => PaymentTransaction),
2219
+ tslib.__metadata("design:type", PaymentTransaction)
2163
2220
  ], Order.prototype, "payment", void 0);
2164
2221
 
2222
+ class OrderBlocked extends BaseModel {
2223
+ static get identifiersFields() {
2224
+ return ['id'];
2225
+ }
2226
+ }
2227
+
2165
2228
  class CheckoutSubscription extends BaseModel {
2166
2229
  static get identifiersFields() {
2167
2230
  return ['id'];
@@ -2184,6 +2247,591 @@ tslib.__decorate([
2184
2247
  tslib.__metadata("design:type", Coupon)
2185
2248
  ], CheckoutSubscription.prototype, "coupon", void 0);
2186
2249
 
2250
+ class BusinessError extends tsCustomError.CustomError {
2251
+ constructor(message, additionalData, type = '') {
2252
+ super(message);
2253
+ this.additionalData = additionalData;
2254
+ this.type = type;
2255
+ }
2256
+ }
2257
+
2258
+ class DuplicatedResultsError extends tsCustomError.CustomError {
2259
+ constructor(message) {
2260
+ super(message);
2261
+ }
2262
+ }
2263
+
2264
+ class FraudValidationError extends tsCustomError.CustomError {
2265
+ constructor(message, additionalData) {
2266
+ super(message);
2267
+ this.additionalData = additionalData;
2268
+ this.type = 'antifraud';
2269
+ }
2270
+ }
2271
+
2272
+ class InvalidArgumentError extends tsCustomError.CustomError {
2273
+ constructor(message) {
2274
+ super(message);
2275
+ }
2276
+ }
2277
+
2278
+ class NotFoundError extends tsCustomError.CustomError {
2279
+ constructor(message) {
2280
+ super(message);
2281
+ }
2282
+ }
2283
+
2284
+ class PaymentError extends tsCustomError.CustomError {
2285
+ constructor(message, additionalData) {
2286
+ super(message);
2287
+ this.additionalData = additionalData;
2288
+ this.type = 'payment';
2289
+ }
2290
+ }
2291
+
2292
+ class RequiredArgumentError extends tsCustomError.CustomError {
2293
+ constructor(args) {
2294
+ super(`Required arguments: ${args.join(', ')}`);
2295
+ this.args = args;
2296
+ this.arguments = args;
2297
+ }
2298
+ }
2299
+
2300
+ class StockLimitError extends BusinessError {
2301
+ constructor(message) {
2302
+ super(message);
2303
+ this.type = 'stock-limit';
2304
+ }
2305
+ }
2306
+
2307
+ class StockOutError extends BusinessError {
2308
+ constructor(message) {
2309
+ super(message);
2310
+ this.type = 'stock-out';
2311
+ }
2312
+ }
2313
+
2314
+ class AdyenCardService {
2315
+ constructor(credentials, paymentRepository, orderBlockedRepository) {
2316
+ this.credentials = credentials;
2317
+ this.paymentRepository = paymentRepository;
2318
+ this.orderBlockedRepository = orderBlockedRepository;
2319
+ }
2320
+ async pay(checkout, card) {
2321
+ try {
2322
+ const result = await axios__default["default"]({
2323
+ method: 'POST',
2324
+ url: this.credentials.URL_TRANSACTION,
2325
+ headers: {
2326
+ 'x-api-key': this.credentials.API_KEY,
2327
+ 'content-type': 'application/json',
2328
+ },
2329
+ data: this.createCardPayment(checkout, card),
2330
+ });
2331
+ if (result.data.resultCode !== 'Authorised') {
2332
+ this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
2333
+ return Promise.reject(new PaymentError(`Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito`, {
2334
+ checkoutId: checkout.id,
2335
+ userEmail: checkout.user.email,
2336
+ info: result.data,
2337
+ }));
2338
+ }
2339
+ const payment = await this.paymentRepository.create(Payment.toInstance({
2340
+ createdAt: new Date(),
2341
+ updatedAt: new Date(),
2342
+ userId: checkout.user.id,
2343
+ checkoutId: checkout.id,
2344
+ totalPrice: checkout.totalPrice,
2345
+ paymentProvider: 'adyen',
2346
+ transaction: Object.assign(Object.assign({}, result.data), { status: 'paid' }),
2347
+ }));
2348
+ return payment;
2349
+ }
2350
+ catch (error) {
2351
+ throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
2352
+ checkoutId: checkout.id,
2353
+ userEmail: checkout.user.email,
2354
+ info: error.message,
2355
+ });
2356
+ }
2357
+ }
2358
+ createCardPayment(checkout, card) {
2359
+ return {
2360
+ amount: {
2361
+ currency: 'BRL',
2362
+ value: ((checkout === null || checkout === void 0 ? void 0 : checkout.totalPrice) || 0) * 100,
2363
+ },
2364
+ paymentMethod: {
2365
+ type: 'scheme',
2366
+ storedPaymentMethodId: card.cardId,
2367
+ },
2368
+ reference: checkout.id,
2369
+ shopperInteraction: 'Ecommerce',
2370
+ merchantAccount: this.credentials.MERCHANT_ACCOUNT,
2371
+ shopperReference: checkout.user.id,
2372
+ recurringProcessingModel: 'CardOnFile',
2373
+ returnUrl: this.credentials.URL_POSTBACK,
2374
+ installments: {
2375
+ value: card.installments,
2376
+ },
2377
+ };
2378
+ }
2379
+ addCard() {
2380
+ throw new Error('Method not implemented.');
2381
+ }
2382
+ }
2383
+
2384
+ class AntifraudBankSlipService {
2385
+ constructor(orderBlockedRepository) {
2386
+ this.orderBlockedRepository = orderBlockedRepository;
2387
+ this.MAX_ORDER_VALUE = 5000;
2388
+ }
2389
+ async validate(checkout) {
2390
+ var _a, _b;
2391
+ if (checkout.totalPrice && checkout.totalPrice > this.MAX_ORDER_VALUE && !((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber)) {
2392
+ await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Boleto not authorized', 'Boleto', 'day');
2393
+ throw new FraudValidationError('Boleto não autorizado para cliente não assinante', {
2394
+ checkoutId: checkout.id,
2395
+ userEmail: checkout.user.email,
2396
+ info: {
2397
+ isSubscriber: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.isSubscriber,
2398
+ subtotal: checkout.subTotalPrice,
2399
+ total: checkout.totalPrice,
2400
+ },
2401
+ });
2402
+ }
2403
+ return true;
2404
+ }
2405
+ }
2406
+
2407
+ class AntifraudCardService {
2408
+ constructor(orderRepository, orderBlockedRepository) {
2409
+ this.orderRepository = orderRepository;
2410
+ this.orderBlockedRepository = orderBlockedRepository;
2411
+ this.LIMIT_ORDERS_DAY = 2;
2412
+ this.LIMIT_ORDERS_WEEK = 7;
2413
+ this.LIMIT_BLOCKED_ORDERS_DAY = 5;
2414
+ }
2415
+ async validate(checkout, card) {
2416
+ var _a, _b;
2417
+ if (!(await this.verifyBlockedOrderAttempts(checkout, card)))
2418
+ throw new FraudValidationError('Cliente com mais de 5 compras negadas/bloqueadas no dia', {
2419
+ checkoutId: checkout.id,
2420
+ userEmail: checkout.user.email,
2421
+ info: {
2422
+ isSubscriber: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber,
2423
+ subtotal: checkout.subTotalPrice,
2424
+ total: checkout.totalPrice,
2425
+ },
2426
+ });
2427
+ if (!(await this.verifyDayAndWeekOrders(checkout, card)))
2428
+ throw new FraudValidationError('Cliente tentando comprar mais de 2 vezes no dia ou 7 vezes na semana', {
2429
+ checkoutId: checkout.id,
2430
+ userEmail: checkout.user.email,
2431
+ info: {
2432
+ isSubscriber: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.isSubscriber,
2433
+ subtotal: checkout.subTotalPrice,
2434
+ total: checkout.totalPrice,
2435
+ },
2436
+ });
2437
+ return true;
2438
+ }
2439
+ async verifyBlockedOrderAttempts(checkout, card) {
2440
+ var _a, _b, _c, _d;
2441
+ const day = `${dateFns.format(new Date(), 'YYYY-MM-DD')}T00:00:00`;
2442
+ const endOfDay = `${dateFns.format(new Date(), 'YYYY-MM-DD')}T23:59:59`;
2443
+ const ordersBlockedWithCpf = await this.orderBlockedRepository
2444
+ .find({
2445
+ filters: {
2446
+ customer: { cpf: { operator: exports.Where.EQUALS, value: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf } },
2447
+ date: [
2448
+ { operator: exports.Where.GTE, value: new Date(day) },
2449
+ { operator: exports.Where.LTE, value: new Date(endOfDay) },
2450
+ ],
2451
+ },
2452
+ })
2453
+ .then((data) => data.data);
2454
+ const ordersBlockedWithEmail = await this.orderBlockedRepository
2455
+ .find({
2456
+ filters: {
2457
+ customer: { email: { operator: exports.Where.EQUALS, value: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email } },
2458
+ date: [
2459
+ { operator: exports.Where.GTE, value: new Date(day) },
2460
+ { operator: exports.Where.LTE, value: new Date(endOfDay) },
2461
+ ],
2462
+ },
2463
+ })
2464
+ .then((data) => data.data);
2465
+ const ordersBlockedWithCep = await this.orderBlockedRepository
2466
+ .find({
2467
+ filters: {
2468
+ customer: { shippingAddress: { zip: { operator: exports.Where.EQUALS, value: (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.zip } } },
2469
+ date: [
2470
+ { operator: exports.Where.GTE, value: new Date(day) },
2471
+ { operator: exports.Where.LTE, value: new Date(endOfDay) },
2472
+ ],
2473
+ },
2474
+ })
2475
+ .then((data) => data.data);
2476
+ const ordersBlockedWithPhone = await this.orderBlockedRepository
2477
+ .find({
2478
+ filters: {
2479
+ customer: { phoneNumber: { operator: exports.Where.EQUALS, value: (_d = checkout.user) === null || _d === void 0 ? void 0 : _d.phone } },
2480
+ date: [
2481
+ { operator: exports.Where.GTE, value: new Date(day) },
2482
+ { operator: exports.Where.LTE, value: new Date(endOfDay) },
2483
+ ],
2484
+ },
2485
+ })
2486
+ .then((data) => data.data);
2487
+ const blockedUniqueEmails = ordersBlockedWithEmail.filter((e) => {
2488
+ var _a;
2489
+ return e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf);
2490
+ });
2491
+ const blockedUniqueCeps = ordersBlockedWithCep.filter((e) => {
2492
+ var _a, _b;
2493
+ return e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf) && e.customer.email !== ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email);
2494
+ });
2495
+ const blockedUniquePhone = ordersBlockedWithPhone.filter((e) => {
2496
+ var _a, _b, _c, _d, _e, _f;
2497
+ return (e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf) &&
2498
+ e.customer.email !== ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email) &&
2499
+ ((_d = (_c = e.customer.shippingAddress) === null || _c === void 0 ? void 0 : _c.zip) === null || _d === void 0 ? void 0 : _d.toString()) !== ((_f = (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.zip) === null || _f === void 0 ? void 0 : _f.toString()));
2500
+ });
2501
+ const blockedAttempts = ordersBlockedWithCpf
2502
+ .concat(blockedUniqueEmails)
2503
+ .concat(blockedUniqueCeps)
2504
+ .concat(blockedUniquePhone);
2505
+ if (blockedAttempts.length >= this.LIMIT_BLOCKED_ORDERS_DAY) {
2506
+ await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'More than 5 attempts have failed', 'Failed attempts', 'day', card || null);
2507
+ return false;
2508
+ }
2509
+ return true;
2510
+ }
2511
+ async verifyDayAndWeekOrders(checkout, card) {
2512
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2513
+ const ordersPerDay = await this.validateOrdersByRange((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf, (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email, (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.phone, (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.zip, card, this.getDateRange('day'));
2514
+ for (const key in ordersPerDay) {
2515
+ if (ordersPerDay[key] > this.LIMIT_ORDERS_DAY) {
2516
+ await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Order limit', key, 'day');
2517
+ return false;
2518
+ }
2519
+ }
2520
+ const ordersPerWeek = await this.validateOrdersByRange((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.cpf, (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.email, (_g = checkout.user) === null || _g === void 0 ? void 0 : _g.phone, (_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip, card, this.getDateRange('week'));
2521
+ for (const key in ordersPerWeek) {
2522
+ if (ordersPerDay[key] > this.LIMIT_ORDERS_WEEK) {
2523
+ await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Order limit', key, 'week');
2524
+ return false;
2525
+ }
2526
+ }
2527
+ return true;
2528
+ }
2529
+ async validateOrdersByRange(cpf, email, phone, zip, card, range) {
2530
+ const ordersCpf = await this.countOrdersByField('user', 'cpf', cpf, range);
2531
+ const ordersByEmail = await this.countOrdersByField('user', 'email', email, range);
2532
+ const ordersByPhone = await this.countOrdersByField('user', 'phone', phone, range);
2533
+ const ordersByZip = await this.countOrdersByField('shippingAddress', 'zip', zip, range);
2534
+ return {
2535
+ cpf: ordersCpf,
2536
+ email: ordersByEmail,
2537
+ phone: ordersByPhone,
2538
+ zip: ordersByZip,
2539
+ };
2540
+ }
2541
+ async countOrdersByField(property, field, value, range) {
2542
+ const filters = {
2543
+ [property]: {
2544
+ [field]: value,
2545
+ },
2546
+ ['createdAt']: [
2547
+ { operator: exports.Where.GTE, value: range.firstDate },
2548
+ { operator: exports.Where.LTE, value: range.lastDate },
2549
+ ],
2550
+ };
2551
+ const docs = await (await this.orderRepository.find({ filters })).count;
2552
+ return docs;
2553
+ }
2554
+ getDateRange(range = 'day') {
2555
+ switch (range) {
2556
+ case 'day':
2557
+ return {
2558
+ firstDate: dateFns.startOfDay(new Date()).getTime(),
2559
+ lastDate: dateFns.endOfDay(new Date()).getTime(),
2560
+ };
2561
+ case 'week':
2562
+ return {
2563
+ firstDate: dateFns.startOfDay(dateFns.subDays(new Date(), 7)).getTime(),
2564
+ lastDate: dateFns.endOfDay(new Date()).getTime(),
2565
+ };
2566
+ default:
2567
+ return {
2568
+ firstDate: dateFns.startOfDay(new Date()).getTime(),
2569
+ lastDate: dateFns.endOfDay(new Date()).getTime(),
2570
+ };
2571
+ }
2572
+ }
2573
+ }
2574
+
2575
+ class AntifraudGlampointsService {
2576
+ constructor() { }
2577
+ async validate(checkout) {
2578
+ return true;
2579
+ }
2580
+ }
2581
+
2582
+ class AntifraudPixService {
2583
+ constructor() { }
2584
+ async validate(checkout) {
2585
+ return true;
2586
+ }
2587
+ }
2588
+
2589
+ class GlampointsPaymentService {
2590
+ constructor(paymentRepository) {
2591
+ this.paymentRepository = paymentRepository;
2592
+ }
2593
+ async pay(checkout) {
2594
+ const payment = await this.paymentRepository.create(Payment.toInstance({
2595
+ createdAt: new Date(),
2596
+ updatedAt: new Date(),
2597
+ userId: checkout.user.id,
2598
+ checkoutId: checkout.id,
2599
+ totalPrice: checkout.totalPrice,
2600
+ paymentProvider: 'glampoints',
2601
+ transaction: {
2602
+ amount: 0,
2603
+ acquirerResponseCode: '0000',
2604
+ acquirerName: 'glampoints',
2605
+ authorizedAmount: 0,
2606
+ captureMethod: 'ecommerce',
2607
+ installments: 1,
2608
+ cost: 0,
2609
+ paidAmount: 0,
2610
+ paymentMethod: 'glampoints',
2611
+ referer: 'api_key',
2612
+ refundedAmount: 0,
2613
+ status: 'paid',
2614
+ statusReason: 'acquirer',
2615
+ },
2616
+ }));
2617
+ return payment;
2618
+ }
2619
+ }
2620
+
2621
+ class PagarmeBankSlipService {
2622
+ constructor(credentials, paymentRepository) {
2623
+ this.credentials = credentials;
2624
+ this.paymentRepository = paymentRepository;
2625
+ }
2626
+ async pay(checkout) {
2627
+ try {
2628
+ const result = await axios__default["default"]({
2629
+ method: 'POST',
2630
+ url: this.credentials.URL_TRANSACTION,
2631
+ data: this.createBoletoPayment(checkout),
2632
+ });
2633
+ if (result.data.status !== 'processing') {
2634
+ return Promise.reject(new PaymentError(`Houve uma falha ao gerar o boleto. Tente novamente`, {
2635
+ checkoutId: checkout.id,
2636
+ userEmail: checkout.user.email,
2637
+ info: result.data,
2638
+ }));
2639
+ }
2640
+ const payment = await this.paymentRepository.create(Payment.toInstance({
2641
+ createdAt: new Date(),
2642
+ updatedAt: new Date(),
2643
+ userId: checkout.user.id,
2644
+ checkoutId: checkout.id,
2645
+ totalPrice: checkout.totalPrice,
2646
+ paymentProvider: 'pagarMe',
2647
+ transaction: result.data,
2648
+ }));
2649
+ return payment;
2650
+ }
2651
+ catch (error) {
2652
+ throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
2653
+ checkoutId: checkout.id,
2654
+ userEmail: checkout.user.email,
2655
+ info: error.response.data,
2656
+ });
2657
+ }
2658
+ }
2659
+ createBoletoPayment(checkout) {
2660
+ return {
2661
+ api_key: this.credentials.API_KEY,
2662
+ amount: Math.floor(checkout.totalPrice * 100),
2663
+ boleto_rules: ['strict_expiration_date'],
2664
+ boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
2665
+ boleto_expiration_date: dateFns.format(dateFns.addDays(new Date(), 3), 'yyyy-MM-dd'),
2666
+ payment_method: 'boleto',
2667
+ postback_url: this.credentials.URL_POSTBACK,
2668
+ customer: {
2669
+ external_id: checkout.user.id,
2670
+ type: 'individual',
2671
+ country: 'br',
2672
+ name: checkout.user.displayName,
2673
+ documents: [
2674
+ {
2675
+ type: 'cpf',
2676
+ number: checkout.user.cpf,
2677
+ },
2678
+ ],
2679
+ },
2680
+ };
2681
+ }
2682
+ }
2683
+
2684
+ class PagarmeCardService {
2685
+ constructor(credentials, paymentRepository, orderBlockedRepository) {
2686
+ this.credentials = credentials;
2687
+ this.paymentRepository = paymentRepository;
2688
+ this.orderBlockedRepository = orderBlockedRepository;
2689
+ }
2690
+ async pay(checkout, card) {
2691
+ var _a;
2692
+ try {
2693
+ const result = await axios__default["default"]({
2694
+ method: 'POST',
2695
+ url: this.credentials.URL_TRANSACTION,
2696
+ data: this.createCardPayment(checkout, card),
2697
+ });
2698
+ if (result.data.status !== 'paid') {
2699
+ this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
2700
+ return Promise.reject(new PaymentError(`Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito`, {
2701
+ checkoutId: checkout.id,
2702
+ userEmail: checkout.user.email,
2703
+ info: result.data,
2704
+ }));
2705
+ }
2706
+ const payment = await this.paymentRepository.create(Payment.toInstance({
2707
+ createdAt: new Date(),
2708
+ updatedAt: new Date(),
2709
+ userId: checkout.user.id,
2710
+ checkoutId: checkout.id,
2711
+ totalPrice: checkout.totalPrice,
2712
+ paymentProvider: 'pagarMe',
2713
+ transaction: result.data,
2714
+ }));
2715
+ return payment;
2716
+ }
2717
+ catch (error) {
2718
+ throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
2719
+ checkoutId: checkout.id,
2720
+ userEmail: checkout.user.email,
2721
+ info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
2722
+ });
2723
+ }
2724
+ }
2725
+ addCard() {
2726
+ throw new Error('Method not implemented.');
2727
+ }
2728
+ createCardPayment(checkout, card) {
2729
+ var _a, _b, _c, _d, _e, _f;
2730
+ return {
2731
+ api_key: this.credentials.API_KEY,
2732
+ amount: Math.floor(checkout.totalPrice * 100),
2733
+ card_id: card.cardId,
2734
+ payment_method: 'credit_card',
2735
+ installments: card.installments,
2736
+ soft_descriptor: checkout.shop,
2737
+ customer: {
2738
+ external_id: checkout.user.id,
2739
+ name: checkout.user.displayName,
2740
+ type: 'individual',
2741
+ country: 'br',
2742
+ email: checkout.user.email,
2743
+ phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
2744
+ documents: [
2745
+ {
2746
+ type: 'cpf',
2747
+ number: checkout.user.cpf,
2748
+ },
2749
+ ],
2750
+ },
2751
+ billing: {
2752
+ name: checkout.user.displayName,
2753
+ address: {
2754
+ country: 'br',
2755
+ state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
2756
+ city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
2757
+ neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
2758
+ street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
2759
+ street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
2760
+ zipcode: checkout.billingAddress
2761
+ ? checkout.billingAddress.zip.replace('-', '')
2762
+ : (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
2763
+ },
2764
+ },
2765
+ items: checkout.lineItems.map((item) => {
2766
+ return {
2767
+ id: item.id,
2768
+ title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
2769
+ unit_price: Math.floor(item.pricePaid * 100),
2770
+ quantity: item.quantity,
2771
+ tangible: true,
2772
+ };
2773
+ }),
2774
+ };
2775
+ }
2776
+ }
2777
+
2778
+ class PagarmePixService {
2779
+ constructor(credentials, paymentRepository) {
2780
+ this.credentials = credentials;
2781
+ this.paymentRepository = paymentRepository;
2782
+ }
2783
+ async pay(checkout) {
2784
+ var _a;
2785
+ try {
2786
+ const result = await axios__default["default"]({
2787
+ method: 'POST',
2788
+ url: this.credentials.URL_TRANSACTION,
2789
+ data: this.createPixPayment(checkout),
2790
+ });
2791
+ const payment = await this.paymentRepository.create(Payment.toInstance({
2792
+ createdAt: new Date(),
2793
+ updatedAt: new Date(),
2794
+ userId: checkout.user.id,
2795
+ checkoutId: checkout.id,
2796
+ totalPrice: checkout.totalPrice,
2797
+ paymentProvider: 'pagarMe',
2798
+ transaction: result.data,
2799
+ }));
2800
+ return payment;
2801
+ }
2802
+ catch (error) {
2803
+ throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
2804
+ checkoutId: checkout.id,
2805
+ userEmail: checkout.user.email,
2806
+ info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
2807
+ });
2808
+ }
2809
+ }
2810
+ createPixPayment(checkout) {
2811
+ return {
2812
+ payment_method: 'pix',
2813
+ amount: Math.floor(checkout.totalPrice * 100),
2814
+ api_key: this.credentials.API_KEY,
2815
+ postback_url: this.credentials.URL_POSTBACK,
2816
+ pix_expiration_date: dateFns.format(dateFns.addDays(new Date(), 1), 'yyyy-MM-dd'),
2817
+ customer: {
2818
+ external_id: checkout.user.id,
2819
+ type: 'individual',
2820
+ country: 'br',
2821
+ name: checkout.user.displayName,
2822
+ email: checkout.user.email.trim(),
2823
+ phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
2824
+ documents: [
2825
+ {
2826
+ type: 'cpf',
2827
+ number: checkout.user.cpf,
2828
+ },
2829
+ ],
2830
+ },
2831
+ };
2832
+ }
2833
+ }
2834
+
2187
2835
  class RoundProductPricesHelper {
2188
2836
  static roundProductPrices(product) {
2189
2837
  product.price.price = Number(product.price.price.toFixed(2));
@@ -2198,6 +2846,12 @@ class RoundProductPricesHelper {
2198
2846
  }
2199
2847
  }
2200
2848
 
2849
+ class Sequence extends BaseModel {
2850
+ static get identifiersFields() {
2851
+ return ['id'];
2852
+ }
2853
+ }
2854
+
2201
2855
  exports.FilterType = void 0;
2202
2856
  (function (FilterType) {
2203
2857
  FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
@@ -2336,32 +2990,6 @@ class ShopSettings extends BaseModel {
2336
2990
  }
2337
2991
  }
2338
2992
 
2339
- class InvalidArgumentError extends tsCustomError.CustomError {
2340
- constructor(message) {
2341
- super(message);
2342
- }
2343
- }
2344
-
2345
- class RequiredArgumentError extends tsCustomError.CustomError {
2346
- constructor(args) {
2347
- super(`Required arguments: ${args.join(', ')}`);
2348
- this.args = args;
2349
- this.arguments = args;
2350
- }
2351
- }
2352
-
2353
- class NotFoundError extends tsCustomError.CustomError {
2354
- constructor(message) {
2355
- super(message);
2356
- }
2357
- }
2358
-
2359
- class DuplicatedResultsError extends tsCustomError.CustomError {
2360
- constructor(message) {
2361
- super(message);
2362
- }
2363
- }
2364
-
2365
2993
  class AxiosAdapter {
2366
2994
  constructor(config) {
2367
2995
  this.config = config;
@@ -2463,37 +3091,21 @@ class ProductsIndex {
2463
3091
  _source: fields,
2464
3092
  query: {
2465
3093
  bool: {
2466
- should: [
2467
- {
2468
- multi_match: {
2469
- query: `${searchTerm}`,
2470
- fields: ['name', 'name.folded', 'name.search'],
2471
- operator: 'AND',
2472
- },
2473
- },
2474
- {
2475
- match_phrase: {
2476
- name: {
2477
- query: `${searchTerm}`,
2478
- boost: 2,
2479
- },
2480
- },
3094
+ must: {
3095
+ multi_match: {
3096
+ query: `${searchTerm}`,
3097
+ fields: ['name', 'name.folded', 'name.search', 'description', 'brand'],
3098
+ fuzziness: 2,
2481
3099
  },
2482
- {
2483
- match: {
2484
- brand: {
2485
- query: `${searchTerm}`,
2486
- },
2487
- },
2488
- },
2489
- {
2490
- multi_match: {
3100
+ },
3101
+ should: {
3102
+ match_phrase_prefix: {
3103
+ 'name.search': {
2491
3104
  query: `${searchTerm}`,
2492
- fields: ['name', 'name.folded', 'name.search'],
2493
- operator: 'OR',
3105
+ slop: 10,
2494
3106
  },
2495
3107
  },
2496
- ],
3108
+ },
2497
3109
  filter,
2498
3110
  },
2499
3111
  },
@@ -2942,161 +3554,6 @@ const withCrudFirestore = (MixinBase) => {
2942
3554
  };
2943
3555
  };
2944
3556
 
2945
- class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2946
- constructor({ firestore, interceptors }) {
2947
- super({
2948
- firestore,
2949
- collectionName: 'leads',
2950
- model: Lead,
2951
- interceptors,
2952
- });
2953
- }
2954
- }
2955
-
2956
- class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2957
- constructor({ firestore, interceptors }, parentRepository) {
2958
- super({
2959
- firestore,
2960
- collectionName: 'editions',
2961
- parentIdField: 'subscriptionId',
2962
- model: Edition,
2963
- interceptors,
2964
- });
2965
- this.parentRepository = parentRepository;
2966
- }
2967
- }
2968
-
2969
- class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2970
- constructor({ firestore, interceptors, }) {
2971
- super({
2972
- firestore,
2973
- collectionName: 'subscription',
2974
- model: Subscription,
2975
- interceptors,
2976
- });
2977
- }
2978
- }
2979
-
2980
- class SubscriptionMaterializationFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2981
- constructor({ firestore, interceptors }) {
2982
- super({
2983
- firestore,
2984
- collectionName: 'subscriptionMaterialization',
2985
- model: SubscriptionMaterialization,
2986
- interceptors,
2987
- });
2988
- }
2989
- }
2990
-
2991
- class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2992
- constructor({ firestore, interceptors }, parentRepository) {
2993
- super({
2994
- firestore,
2995
- collectionName: 'payments',
2996
- parentIdField: 'subscriptionId',
2997
- model: SubscriptionPayment,
2998
- interceptors,
2999
- });
3000
- this.parentRepository = parentRepository;
3001
- }
3002
- }
3003
-
3004
- class SubscriptionSummaryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3005
- constructor({ firestore, interceptors, }) {
3006
- super({
3007
- firestore,
3008
- collectionName: 'subscriptionSummary',
3009
- model: SubscriptionSummary,
3010
- interceptors,
3011
- });
3012
- }
3013
- }
3014
-
3015
- class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3016
- constructor({ firestore, interceptors }, parentRepository) {
3017
- super({
3018
- firestore,
3019
- collectionName: 'address',
3020
- parentIdField: 'userId',
3021
- model: UserAddress,
3022
- interceptors,
3023
- });
3024
- this.parentRepository = parentRepository;
3025
- }
3026
- }
3027
-
3028
- class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3029
- constructor({ firestore, interceptors }, parentRepository) {
3030
- super({
3031
- firestore,
3032
- collectionName: 'CX',
3033
- parentIdField: 'userId',
3034
- model: BeautyProfile,
3035
- interceptors,
3036
- });
3037
- this.parentRepository = parentRepository;
3038
- }
3039
- }
3040
-
3041
- class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3042
- constructor({ firestore, interceptors }) {
3043
- super({
3044
- firestore,
3045
- collectionName: 'users',
3046
- model: User,
3047
- interceptors,
3048
- });
3049
- }
3050
- async get(identifiers) {
3051
- const user = await super.get({ id: identifiers.id });
3052
- user.beautyProfile = await this.getBeautyProfile(user.id);
3053
- user.isSubscriber = await this.checkIfIsSubscriber(user.id);
3054
- return user;
3055
- }
3056
- async checkIfExistsByField(field, value) {
3057
- const result = await this.find({ filters: { [field]: value } });
3058
- return result.count > 0;
3059
- }
3060
- buildModelInstance() {
3061
- const { fromFirestore, toFirestore } = super.buildModelInstance();
3062
- return {
3063
- toFirestore: (data) => {
3064
- const plain = toFirestore(data);
3065
- delete plain.isSubscriber;
3066
- return plain;
3067
- },
3068
- fromFirestore,
3069
- };
3070
- }
3071
- async getBeautyProfile(userId) {
3072
- const beautyProfile = await firestore.getDoc(firestore.doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
3073
- return beautyProfile.data();
3074
- }
3075
- async checkIfIsSubscriber(userId) {
3076
- const docs = await firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')));
3077
- return !!docs && !!docs.size;
3078
- }
3079
- buildBeautyProfileModelInstance() {
3080
- return {
3081
- toFirestore: (data) => data.toPlain(),
3082
- fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
3083
- };
3084
- }
3085
- }
3086
-
3087
- class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3088
- constructor({ firestore, interceptors }, parentRepository) {
3089
- super({
3090
- firestore,
3091
- collectionName: 'payment_method',
3092
- parentIdField: 'userId',
3093
- model: UserPaymentMethod,
3094
- interceptors,
3095
- });
3096
- this.parentRepository = parentRepository;
3097
- }
3098
- }
3099
-
3100
3557
  class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3101
3558
  constructor({ firestore, interceptors }) {
3102
3559
  super({
@@ -3169,9 +3626,6 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
3169
3626
  });
3170
3627
  this.reviews = {};
3171
3628
  }
3172
- fetchProductReviews(filters) {
3173
- throw new Error('Method not implemented.');
3174
- }
3175
3629
  async getBySlug(slug) {
3176
3630
  var _a;
3177
3631
  const result = await this.find({
@@ -3213,30 +3667,122 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
3213
3667
  findCatalog(params) {
3214
3668
  return this.find(params);
3215
3669
  }
3216
- async fetchPaginatedReviews() {
3217
- return Promise.resolve([]);
3670
+ }
3671
+
3672
+ class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3673
+ constructor({ firestore, interceptors }, parentRepository) {
3674
+ super({
3675
+ firestore,
3676
+ collectionName: 'variants',
3677
+ parentIdField: 'productId',
3678
+ model: Variant,
3679
+ interceptors,
3680
+ });
3681
+ this.parentRepository = parentRepository;
3682
+ }
3683
+ }
3684
+
3685
+ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3686
+ constructor({ firestore, interceptors }) {
3687
+ super({
3688
+ firestore,
3689
+ collectionName: 'subscriptionProducts',
3690
+ model: Product,
3691
+ interceptors,
3692
+ });
3693
+ }
3694
+ }
3695
+
3696
+ class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3697
+ constructor({ firestore, interceptors }) {
3698
+ super({
3699
+ firestore,
3700
+ collectionName: 'sequences',
3701
+ model: Sequence,
3702
+ interceptors,
3703
+ });
3704
+ }
3705
+ }
3706
+
3707
+ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3708
+ constructor({ firestore, interceptors }) {
3709
+ super({
3710
+ firestore,
3711
+ collectionName: 'dms',
3712
+ model: Home,
3713
+ interceptors,
3714
+ });
3715
+ this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
3716
+ var _a, _b, _c;
3717
+ return ({
3718
+ category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
3719
+ ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
3720
+ : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
3721
+ products: ((_c = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.products) === null || _c === void 0 ? void 0 : _c.map((product) => ((product === null || product === void 0 ? void 0 : product.toPlain) ? product === null || product === void 0 ? void 0 : product.toPlain() : product)).filter(Boolean)) || [],
3722
+ });
3723
+ };
3724
+ this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
3725
+ var _a;
3726
+ return ({
3727
+ category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
3728
+ products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
3729
+ });
3730
+ };
3731
+ }
3732
+ buildModelInstance() {
3733
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
3734
+ return {
3735
+ toFirestore: (data) => {
3736
+ const modifiedData = this.homeToFirestore(data);
3737
+ return toFirestore(modifiedData);
3738
+ },
3739
+ fromFirestore: (snap) => {
3740
+ const instance = fromFirestore(snap);
3741
+ return this.homeFromFirestore(instance);
3742
+ },
3743
+ };
3744
+ }
3745
+ homeToFirestore(home) {
3746
+ var _a, _b, _c, _d;
3747
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3748
+ home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
3749
+ home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
3750
+ home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
3751
+ }
3752
+ return home;
3753
+ }
3754
+ homeFromFirestore(home) {
3755
+ var _a;
3756
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3757
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
3758
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
3759
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
3760
+ home.data.createdAt =
3761
+ home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
3762
+ home.data.expiresAt =
3763
+ home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
3764
+ }
3765
+ return home;
3218
3766
  }
3219
3767
  }
3220
3768
 
3221
- class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3222
- constructor({ firestore, interceptors }, parentRepository) {
3769
+ class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3770
+ constructor({ firestore, interceptors }) {
3223
3771
  super({
3224
3772
  firestore,
3225
- collectionName: 'variants',
3226
- parentIdField: 'productId',
3227
- model: Variant,
3773
+ collectionName: 'shopMenus',
3774
+ model: ShopMenu,
3228
3775
  interceptors,
3229
3776
  });
3230
- this.parentRepository = parentRepository;
3231
3777
  }
3232
3778
  }
3233
3779
 
3234
- class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3235
- constructor({ firestore, interceptors }) {
3780
+ class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3781
+ constructor({ firestore, interceptors, }) {
3236
3782
  super({
3237
3783
  firestore,
3238
- collectionName: 'subscriptionProducts',
3239
- model: Product,
3784
+ collectionName: 'shopSettings',
3785
+ model: ShopSettings,
3240
3786
  interceptors,
3241
3787
  });
3242
3788
  }
@@ -3372,6 +3918,47 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
3372
3918
  }
3373
3919
  }
3374
3920
 
3921
+ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3922
+ constructor({ firestore, interceptors, }) {
3923
+ super({
3924
+ firestore,
3925
+ collectionName: 'paymentBlockedAttempts',
3926
+ model: OrderBlocked,
3927
+ interceptors,
3928
+ });
3929
+ }
3930
+ async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
3931
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3932
+ return this.create(OrderBlocked.toInstance({
3933
+ customer: {
3934
+ name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
3935
+ cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
3936
+ id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
3937
+ email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
3938
+ phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
3939
+ isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
3940
+ subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
3941
+ shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
3942
+ },
3943
+ blockType,
3944
+ limiteRange,
3945
+ type,
3946
+ card,
3947
+ checkout: {
3948
+ id: checkout.id,
3949
+ shop: checkout.shop,
3950
+ total: checkout.totalPrice,
3951
+ },
3952
+ date: new Date(),
3953
+ }));
3954
+ }
3955
+ formatZip(zip) {
3956
+ if (zip.length === 8)
3957
+ return zip.substring(0, 5) + '-' + zip.substring(5, 8);
3958
+ return zip;
3959
+ }
3960
+ }
3961
+
3375
3962
  class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3376
3963
  constructor({ firestore, interceptors }) {
3377
3964
  super({
@@ -3394,87 +3981,158 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
3394
3981
  }
3395
3982
  }
3396
3983
 
3397
- class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3984
+ class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3398
3985
  constructor({ firestore, interceptors }) {
3399
3986
  super({
3400
3987
  firestore,
3401
- collectionName: 'dms',
3402
- model: Home,
3988
+ collectionName: 'leads',
3989
+ model: Lead,
3403
3990
  interceptors,
3404
3991
  });
3405
- this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
3406
- var _a, _b, _c;
3407
- return ({
3408
- category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
3409
- ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
3410
- : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
3411
- products: ((_c = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.products) === null || _c === void 0 ? void 0 : _c.map((product) => ((product === null || product === void 0 ? void 0 : product.toPlain) ? product === null || product === void 0 ? void 0 : product.toPlain() : product)).filter(Boolean)) || [],
3412
- });
3413
- };
3414
- this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
3415
- var _a;
3416
- return ({
3417
- category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
3418
- products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
3419
- });
3420
- };
3421
- }
3422
- buildModelInstance() {
3423
- const { fromFirestore, toFirestore } = super.buildModelInstance();
3424
- return {
3425
- toFirestore: (data) => {
3426
- const modifiedData = this.homeToFirestore(data);
3427
- return toFirestore(modifiedData);
3428
- },
3429
- fromFirestore: (snap) => {
3430
- const instance = fromFirestore(snap);
3431
- return this.homeFromFirestore(instance);
3432
- },
3433
- };
3434
3992
  }
3435
- homeToFirestore(home) {
3436
- var _a, _b, _c, _d;
3437
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3438
- home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
3439
- home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
3440
- home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
3441
- }
3442
- return home;
3993
+ }
3994
+
3995
+ class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3996
+ constructor({ firestore, interceptors }, parentRepository) {
3997
+ super({
3998
+ firestore,
3999
+ collectionName: 'editions',
4000
+ parentIdField: 'subscriptionId',
4001
+ model: Edition,
4002
+ interceptors,
4003
+ });
4004
+ this.parentRepository = parentRepository;
3443
4005
  }
3444
- homeFromFirestore(home) {
3445
- var _a;
3446
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3447
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
3448
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
3449
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
3450
- home.data.createdAt =
3451
- home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
3452
- home.data.expiresAt =
3453
- home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
3454
- }
3455
- return home;
4006
+ }
4007
+
4008
+ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4009
+ constructor({ firestore, interceptors, }) {
4010
+ super({
4011
+ firestore,
4012
+ collectionName: 'subscription',
4013
+ model: Subscription,
4014
+ interceptors,
4015
+ });
3456
4016
  }
3457
4017
  }
3458
4018
 
3459
- class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4019
+ class SubscriptionMaterializationFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3460
4020
  constructor({ firestore, interceptors }) {
3461
4021
  super({
3462
4022
  firestore,
3463
- collectionName: 'shopMenus',
3464
- model: ShopMenu,
4023
+ collectionName: 'subscriptionMaterialization',
4024
+ model: SubscriptionMaterialization,
3465
4025
  interceptors,
3466
4026
  });
3467
4027
  }
3468
4028
  }
3469
4029
 
3470
- class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4030
+ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
4031
+ constructor({ firestore, interceptors }, parentRepository) {
4032
+ super({
4033
+ firestore,
4034
+ collectionName: 'payments',
4035
+ parentIdField: 'subscriptionId',
4036
+ model: SubscriptionPayment,
4037
+ interceptors,
4038
+ });
4039
+ this.parentRepository = parentRepository;
4040
+ }
4041
+ }
4042
+
4043
+ class SubscriptionSummaryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3471
4044
  constructor({ firestore, interceptors, }) {
3472
4045
  super({
3473
4046
  firestore,
3474
- collectionName: 'shopSettings',
3475
- model: ShopSettings,
4047
+ collectionName: 'subscriptionSummary',
4048
+ model: SubscriptionSummary,
4049
+ interceptors,
4050
+ });
4051
+ }
4052
+ }
4053
+
4054
+ class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
4055
+ constructor({ firestore, interceptors }, parentRepository) {
4056
+ super({
4057
+ firestore,
4058
+ collectionName: 'address',
4059
+ parentIdField: 'userId',
4060
+ model: UserAddress,
4061
+ interceptors,
4062
+ });
4063
+ this.parentRepository = parentRepository;
4064
+ }
4065
+ }
4066
+
4067
+ class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
4068
+ constructor({ firestore, interceptors }, parentRepository) {
4069
+ super({
4070
+ firestore,
4071
+ collectionName: 'CX',
4072
+ parentIdField: 'userId',
4073
+ model: BeautyProfile,
4074
+ interceptors,
4075
+ });
4076
+ this.parentRepository = parentRepository;
4077
+ }
4078
+ }
4079
+
4080
+ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4081
+ constructor({ firestore, interceptors }) {
4082
+ super({
4083
+ firestore,
4084
+ collectionName: 'users',
4085
+ model: User,
4086
+ interceptors,
4087
+ });
4088
+ }
4089
+ async get(identifiers) {
4090
+ const user = await super.get({ id: identifiers.id });
4091
+ user.beautyProfile = await this.getBeautyProfile(user.id);
4092
+ user.isSubscriber = await this.checkIfIsSubscriber(user.id);
4093
+ return user;
4094
+ }
4095
+ async checkIfExistsByField(field, value) {
4096
+ const result = await this.find({ filters: { [field]: value } });
4097
+ return result.count > 0;
4098
+ }
4099
+ buildModelInstance() {
4100
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
4101
+ return {
4102
+ toFirestore: (data) => {
4103
+ const plain = toFirestore(data);
4104
+ delete plain.isSubscriber;
4105
+ return plain;
4106
+ },
4107
+ fromFirestore,
4108
+ };
4109
+ }
4110
+ async getBeautyProfile(userId) {
4111
+ const beautyProfile = await firestore.getDoc(firestore.doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
4112
+ return beautyProfile.data();
4113
+ }
4114
+ async checkIfIsSubscriber(userId) {
4115
+ const docs = await firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')));
4116
+ return !!docs && !!docs.size;
4117
+ }
4118
+ buildBeautyProfileModelInstance() {
4119
+ return {
4120
+ toFirestore: (data) => data.toPlain(),
4121
+ fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
4122
+ };
4123
+ }
4124
+ }
4125
+
4126
+ class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
4127
+ constructor({ firestore, interceptors }, parentRepository) {
4128
+ super({
4129
+ firestore,
4130
+ collectionName: 'payment_method',
4131
+ parentIdField: 'userId',
4132
+ model: UserPaymentMethod,
3476
4133
  interceptors,
3477
4134
  });
4135
+ this.parentRepository = parentRepository;
3478
4136
  }
3479
4137
  }
3480
4138
 
@@ -3530,14 +4188,11 @@ var HasuraGraphQLWhere;
3530
4188
  HasuraGraphQLWhere["LT"] = "_lt";
3531
4189
  HasuraGraphQLWhere["LTE"] = "_lte";
3532
4190
  HasuraGraphQLWhere["LIKE"] = "_like";
3533
- HasuraGraphQLWhere["ILIKE"] = "_ilike";
3534
4191
  HasuraGraphQLWhere["NOTLIKE"] = "_nlike";
3535
4192
  HasuraGraphQLWhere["ISNULL"] = "_is_null";
3536
4193
  HasuraGraphQLWhere["ISNOTNULL"] = "_is_null";
3537
4194
  HasuraGraphQLWhere["JSON_CONTAINS"] = "_contains";
3538
4195
  HasuraGraphQLWhere["JSON_HAS_KEYS_ANY"] = "_has_keys_any";
3539
- HasuraGraphQLWhere["IREGEX"] = "_iregex";
3540
- HasuraGraphQLWhere["REGEX"] = "_regex";
3541
4196
  })(HasuraGraphQLWhere || (HasuraGraphQLWhere = {}));
3542
4197
 
3543
4198
  var HasuraGraphQLColumnType;
@@ -3568,47 +4223,9 @@ FilterOptionHelper.GetValueFromFilter = (filter, fieldOption) => {
3568
4223
  : (value) => filter.operator === exports.Where.LIKE && !Array.isArray(filter.value) && value.indexOf('%') < 0
3569
4224
  ? `%${value}%`
3570
4225
  : value;
3571
- const converterResult = Array.isArray(filter.value) && !fieldOption.fields && [exports.Where.IN, exports.Where.NOTIN].includes(filter.operator)
4226
+ return Array.isArray(filter.value) && !fieldOption.fields && [exports.Where.IN, exports.Where.NOTIN].includes(filter.operator)
3572
4227
  ? filter.value.map((fieldValue) => converter(fieldValue))
3573
4228
  : converter(filter.value);
3574
- const newValue = filter.ignoreCase && !filter.ignoreAccent && !Array.isArray(filter.value) && converterResult.indexOf('%') < 0
3575
- ? `%${converterResult}%`
3576
- : converterResult;
3577
- return filter.ignoreAccent && !Array.isArray(filter.value)
3578
- ? FilterOptionHelper.buildInsensitiveSentence(newValue)
3579
- : newValue;
3580
- };
3581
- FilterOptionHelper.buildInsensitiveSentence = (value) => {
3582
- const valueWithoutAccents = FilterOptionHelper.removeAccents(value);
3583
- let result = '';
3584
- for (const char of valueWithoutAccents) {
3585
- const allCharOptions = [];
3586
- if (['a', 'e', 'i', 'o', 'u', 'c', 'A', 'E', 'I', 'O', 'U', 'C'].includes(char)) {
3587
- const charOptions = {
3588
- a: ['á', 'â', 'ã', 'à', 'a'],
3589
- e: ['é', 'ê', 'ẽ', 'è', 'e'],
3590
- i: ['í', 'î', 'ĩ', 'ì', 'i'],
3591
- o: ['ó', 'ô', 'õ', 'ò', 'o'],
3592
- u: ['ú', 'û', 'ũ', 'ù', 'u'],
3593
- c: ['ç', 'c'],
3594
- A: ['Á', 'Â', 'Ã', 'À', 'A'],
3595
- E: ['É', 'Ê', 'Ẽ', 'È', 'E'],
3596
- I: ['Í', 'Î', 'Ĩ', 'Ì', 'I'],
3597
- O: ['Ó', 'Ô', 'Õ', 'Ò', 'O'],
3598
- U: ['Ú', 'Û', 'Ũ', 'Ù', 'U'],
3599
- C: ['Ç', 'C'],
3600
- };
3601
- allCharOptions.push(...charOptions[char]);
3602
- result += `[${allCharOptions.join('')}]`;
3603
- }
3604
- else {
3605
- result += char;
3606
- }
3607
- }
3608
- return result;
3609
- };
3610
- FilterOptionHelper.removeAccents = (text) => {
3611
- return text.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
3612
4229
  };
3613
4230
 
3614
4231
  class BindFilterQueryHelper {
@@ -3652,14 +4269,8 @@ BindFilterQueryHelper.BuildOperatorSentence = (options, fieldOption) => ({
3652
4269
  BindFilterQueryHelper.GetHasuraOperator = (options, fieldOption) => FilterOptionHelper.CheckIfIsFilterOption(options)
3653
4270
  ? fieldOption.type === HasuraGraphQLColumnType.Jsonb
3654
4271
  ? BindFilterQueryHelper.GetHasuraJsonbOperator(options)
3655
- : options.operator === exports.Where.LIKE && options.ignoreCase && options.ignoreAccent
3656
- ? HasuraGraphQLWhere.IREGEX
3657
- : options.operator === exports.Where.LIKE && options.ignoreAccent
3658
- ? HasuraGraphQLWhere.REGEX
3659
- : options.operator === exports.Where.LIKE && options.ignoreCase
3660
- ? HasuraGraphQLWhere.ILIKE
3661
- : HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator ===
3662
- Object.keys(exports.Where).find((operator) => exports.Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))]
4272
+ : HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator ===
4273
+ Object.keys(exports.Where).find((operator) => exports.Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))]
3663
4274
  : HasuraGraphQLWhere.EQUALS;
3664
4275
  BindFilterQueryHelper.GetHasuraJsonbOperator = (options) => options.operator === exports.Where.IN
3665
4276
  ? HasuraGraphQLWhere.JSON_CONTAINS
@@ -4393,11 +5004,10 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4393
5004
  {
4394
5005
  products: {
4395
5006
  columnName: 'products',
4396
- fields: ['product_id', 'order'],
4397
- from: (value) => lodash.sortBy(value, (row) => row.order).map((product) => product.product_id.toString()),
4398
- to: (productIds) => productIds.map((productId, index) => ({
5007
+ fields: ['product_id'],
5008
+ from: (value) => value.map((product) => product.product_id.toString()),
5009
+ to: (productIds) => productIds.map((productId) => ({
4399
5010
  product_id: +productId,
4400
- order: ++index,
4401
5011
  })),
4402
5012
  },
4403
5013
  },
@@ -4582,28 +5192,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4582
5192
  .map((productId) => ({ category_id: categoryId, product_id: productId })),
4583
5193
  },
4584
5194
  });
4585
- const productsOrder = products.map((product, index) => {
4586
- return {
4587
- id: product,
4588
- order: index,
4589
- };
4590
- });
4591
- const updateQueries = productsOrder.map((product) => ({
4592
- where: {
4593
- category_id: { _eq: category.id },
4594
- product_id: { _eq: product.id },
4595
- },
4596
- _set: {
4597
- order: product.order,
4598
- },
4599
- }));
4600
- await this.mutation('update_category_product_many', ['affected_rows'], {
4601
- updates: {
4602
- value: updateQueries,
4603
- type: '[category_product_updates!]',
4604
- required: true,
4605
- },
4606
- });
4607
5195
  return plainData.products;
4608
5196
  }
4609
5197
  async updateMetadata(categoryId, { metadata }) {
@@ -4901,28 +5489,22 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4901
5489
  price,
4902
5490
  fullPrice: data.full_price,
4903
5491
  subscriberDiscountPercentage: data.subscriber_discount_percentage,
4904
- fullPriceDiscountPercentage: data.full_price_discount_percentage,
4905
5492
  subscriberPrice: data.subscriber_price,
4906
5493
  }),
4907
5494
  bindFindFilter: (filters) => {
4908
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (((filters === null || filters === void 0 ? void 0 : filters.price) || (filters === null || filters === void 0 ? void 0 : filters.price) === 0) && { price: filters.price })), ((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice })), ((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
5495
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, (((filters === null || filters === void 0 ? void 0 : filters.price) || (filters === null || filters === void 0 ? void 0 : filters.price) === 0) && { price: filters.price })), ((filters.fullPrice || filters.fullPrice === 0) && { full_price: filters.fullPrice })), ((filters.subscriberDiscountPercentage || filters.subscriberDiscountPercentage === 0) && {
4909
5496
  subscriber_discount_percentage: filters.subscriberDiscountPercentage,
4910
5497
  })), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
4911
5498
  subscriber_price: filters.subscriberPrice,
4912
- })), ((filters.fullPriceDiscountPercentage || filters.fullPriceDiscountPercentage === 0) && {
4913
- full_price_discount_percentage: filters.fullPriceDiscountPercentage,
4914
5499
  }));
4915
5500
  },
4916
- bindPersistData: (priceData) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) >= 0 && { price: priceData.price })), (priceData.fullPrice >= 0 && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage >= 0 && {
5501
+ bindPersistData: (priceData) => (Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) >= 0 && { price: priceData.price })), (priceData.fullPrice >= 0 && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage >= 0 && {
4917
5502
  subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
4918
- })), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice })), (priceData.fullPriceDiscountPercentage >= 0 && {
4919
- full_price_discount_percentage: priceData.fullPriceDiscountPercentage,
4920
- }))),
5503
+ })), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }))),
4921
5504
  },
4922
5505
  },
4923
5506
  { fullPrice: { columnName: 'full_price' } },
4924
5507
  { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
4925
- { fullPriceDiscountPercentage: { columnName: 'full_price_discount_percentage' } },
4926
5508
  { subscriberPrice: { columnName: 'subscriber_price' } },
4927
5509
  'published',
4928
5510
  'sku',
@@ -5072,30 +5654,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5072
5654
  product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
5073
5655
  return product;
5074
5656
  }
5075
- async fetchProductReviews() {
5076
- let data = [];
5077
- let count = 0;
5078
- let offset = 0;
5079
- const limit = 500;
5080
- do {
5081
- const result = await super.find(Object.assign({ fields: ['id', 'name', 'sku', 'reviews'] }, ({
5082
- limits: {
5083
- offset,
5084
- limit,
5085
- },
5086
- })));
5087
- data = data.concat(result.data);
5088
- count = result.data.length;
5089
- offset += limit;
5090
- } while (count === limit);
5091
- return data.reduce((reviews, product) => [
5092
- ...reviews,
5093
- ...product.reviews.map((review) => (Object.assign(Object.assign({}, review), { reviewStatus: this.getReviewStatus(review), productId: product.id, productName: product.name, productSku: product.sku }))),
5094
- ], []);
5095
- }
5096
- getReviewStatus(review) {
5097
- return review.status === true ? 'approved' : review.status === false ? 'rejected' : 'pending';
5098
- }
5099
5657
  async fetchReviews(status) {
5100
5658
  const reviewsExpression = {
5101
5659
  status: status === 'pending'
@@ -5714,6 +6272,10 @@ Object.defineProperty(exports, 'sub', {
5714
6272
  enumerable: true,
5715
6273
  get: function () { return dateFns.sub; }
5716
6274
  });
6275
+ Object.defineProperty(exports, 'subDays', {
6276
+ enumerable: true,
6277
+ get: function () { return dateFns.subDays; }
6278
+ });
5717
6279
  Object.defineProperty(exports, 'chunk', {
5718
6280
  enumerable: true,
5719
6281
  get: function () { return lodash.chunk; }
@@ -5778,15 +6340,18 @@ Object.defineProperty(exports, 'set', {
5778
6340
  enumerable: true,
5779
6341
  get: function () { return lodash.set; }
5780
6342
  });
5781
- Object.defineProperty(exports, 'sortBy', {
5782
- enumerable: true,
5783
- get: function () { return lodash.sortBy; }
5784
- });
5785
6343
  Object.defineProperty(exports, 'unset', {
5786
6344
  enumerable: true,
5787
6345
  get: function () { return lodash.unset; }
5788
6346
  });
5789
6347
  exports.Address = Address;
6348
+ exports.AdyenCardService = AdyenCardService;
6349
+ exports.AdyenPaymentMethodFactory = AdyenPaymentMethodFactory;
6350
+ exports.AntifraudBankSlipService = AntifraudBankSlipService;
6351
+ exports.AntifraudCardService = AntifraudCardService;
6352
+ exports.AntifraudGlampointsService = AntifraudGlampointsService;
6353
+ exports.AntifraudPixService = AntifraudPixService;
6354
+ exports.AntifraudProviderFactory = AntifraudProviderFactory;
5790
6355
  exports.Authentication = Authentication;
5791
6356
  exports.AuthenticationFirebaseAuthService = AuthenticationFirebaseAuthService;
5792
6357
  exports.AxiosAdapter = AxiosAdapter;
@@ -5794,6 +6359,7 @@ exports.Base = Base;
5794
6359
  exports.BaseModel = BaseModel;
5795
6360
  exports.BeautyProfile = BeautyProfile;
5796
6361
  exports.BeautyQuestionsHelper = BeautyQuestionsHelper;
6362
+ exports.BusinessError = BusinessError;
5797
6363
  exports.Buy2Win = Buy2Win;
5798
6364
  exports.Buy2WinFirestoreRepository = Buy2WinFirestoreRepository;
5799
6365
  exports.Campaign = Campaign;
@@ -5827,6 +6393,9 @@ exports.FilterHasuraGraphQLRepository = FilterHasuraGraphQLRepository;
5827
6393
  exports.FilterOption = FilterOption;
5828
6394
  exports.FilterOptionHasuraGraphQLRepository = FilterOptionHasuraGraphQLRepository;
5829
6395
  exports.FirebaseFileUploaderService = FirebaseFileUploaderService;
6396
+ exports.FraudValidationError = FraudValidationError;
6397
+ exports.GlampointsPaymentMethodFactory = GlampointsPaymentMethodFactory;
6398
+ exports.GlampointsPaymentService = GlampointsPaymentService;
5830
6399
  exports.Home = Home;
5831
6400
  exports.HomeFirestoreRepository = HomeFirestoreRepository;
5832
6401
  exports.InvalidArgumentError = InvalidArgumentError;
@@ -5840,9 +6409,18 @@ exports.Log = Log;
5840
6409
  exports.Logger = Logger;
5841
6410
  exports.NotFoundError = NotFoundError;
5842
6411
  exports.Order = Order;
6412
+ exports.OrderBlocked = OrderBlocked;
6413
+ exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
5843
6414
  exports.OrderFirestoreRepository = OrderFirestoreRepository;
6415
+ exports.PagarmeBankSlipService = PagarmeBankSlipService;
6416
+ exports.PagarmeCardService = PagarmeCardService;
6417
+ exports.PagarmePaymentMethodFactory = PagarmePaymentMethodFactory;
6418
+ exports.PagarmePixService = PagarmePixService;
5844
6419
  exports.Payment = Payment;
6420
+ exports.PaymentError = PaymentError;
5845
6421
  exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
6422
+ exports.PaymentProviderFactory = PaymentProviderFactory;
6423
+ exports.PaymentTransaction = PaymentTransaction;
5846
6424
  exports.Product = Product;
5847
6425
  exports.ProductFirestoreRepository = ProductFirestoreRepository;
5848
6426
  exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
@@ -5857,12 +6435,16 @@ exports.Register = Register;
5857
6435
  exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
5858
6436
  exports.RequiredArgumentError = RequiredArgumentError;
5859
6437
  exports.RoundProductPricesHelper = RoundProductPricesHelper;
6438
+ exports.Sequence = Sequence;
6439
+ exports.SequenceFirestoreRepository = SequenceFirestoreRepository;
5860
6440
  exports.ShippingMethod = ShippingMethod;
5861
6441
  exports.ShopMenu = ShopMenu;
5862
6442
  exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;
5863
6443
  exports.ShopSettings = ShopSettings;
5864
6444
  exports.ShopSettingsFirestoreRepository = ShopSettingsFirestoreRepository;
5865
6445
  exports.SignOut = SignOut;
6446
+ exports.StockLimitError = StockLimitError;
6447
+ exports.StockOutError = StockOutError;
5866
6448
  exports.Subscription = Subscription;
5867
6449
  exports.SubscriptionEditionFirestoreRepository = SubscriptionEditionFirestoreRepository;
5868
6450
  exports.SubscriptionFirestoreRepository = SubscriptionFirestoreRepository;