@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.esm.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import 'reflect-metadata';
2
2
  import { __decorate, __metadata, __values, __spreadArray, __read, __extends, __rest } from 'tslib';
3
3
  import { plainToInstance, instanceToPlain, Type, Expose } from 'class-transformer';
4
- import { parseISO } from 'date-fns';
5
- export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
6
- import { isNil, isArray, first, last, flatten, compact, get, isString, each, unset, isObject, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, sortBy, omit } from 'lodash';
7
- export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
4
+ import { parseISO, format, startOfDay, endOfDay, subDays, addDays } from 'date-fns';
5
+ export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub, subDays } from 'date-fns';
6
+ import { isNil, isArray, first, last, flatten, compact, get, isString, each, unset, isObject, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
+ export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
8
8
  import { debug } from 'debug';
9
9
  import { CustomError } from 'ts-custom-error';
10
10
  import axios from 'axios';
@@ -13,6 +13,65 @@ import { collection, getDoc, doc, where, orderBy, getDocs, query, startAfter, st
13
13
  import { ref, uploadBytes } from 'firebase/storage';
14
14
  import { mutation, query as query$1 } from 'gql-query-builder';
15
15
 
16
+ var antifraudProviders;
17
+ (function (antifraudProviders) {
18
+ antifraudProviders["BANKSLIP"] = "bankSlip";
19
+ antifraudProviders["CARD"] = "card";
20
+ antifraudProviders["PIX"] = "pix";
21
+ antifraudProviders["POINTS"] = "glampoints";
22
+ })(antifraudProviders || (antifraudProviders = {}));
23
+
24
+ var paymentMethods;
25
+ (function (paymentMethods) {
26
+ paymentMethods["CARD"] = "card";
27
+ paymentMethods["BANKSLIP"] = "bankSlip";
28
+ paymentMethods["PIX"] = "pix";
29
+ paymentMethods["POINTS"] = "glampoints";
30
+ })(paymentMethods || (paymentMethods = {}));
31
+
32
+ var paymentProviders;
33
+ (function (paymentProviders) {
34
+ paymentProviders["PAGARME"] = "pagarMe";
35
+ paymentProviders["ADYEN"] = "adyen";
36
+ paymentProviders["GLAMPOINTS"] = "glampoints";
37
+ })(paymentProviders || (paymentProviders = {}));
38
+
39
+ class BasePaymentMethodFactory {
40
+ constructor(methods) {
41
+ this.methods = methods;
42
+ }
43
+ build(method) {
44
+ return this.methods[method];
45
+ }
46
+ }
47
+
48
+ class AdyenPaymentMethodFactory extends BasePaymentMethodFactory {
49
+ }
50
+
51
+ class AntifraudProviderFactory {
52
+ constructor(antifraudProviders) {
53
+ this.antifraudProviders = antifraudProviders;
54
+ }
55
+ build(provider) {
56
+ return this.antifraudProviders[provider];
57
+ }
58
+ }
59
+
60
+ class GlampointsPaymentMethodFactory extends BasePaymentMethodFactory {
61
+ }
62
+
63
+ class PagarmePaymentMethodFactory extends BasePaymentMethodFactory {
64
+ }
65
+
66
+ class PaymentProviderFactory {
67
+ constructor(paymentProviders) {
68
+ this.paymentProviders = paymentProviders;
69
+ }
70
+ build(provider) {
71
+ return this.paymentProviders[provider];
72
+ }
73
+ }
74
+
16
75
  class BaseModel {
17
76
  get identifier() {
18
77
  const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
@@ -231,7 +290,6 @@ var Where;
231
290
  Where["NOTLIKE"] = "not like";
232
291
  Where["ISNULL"] = "is null";
233
292
  Where["ISNOTNULL"] = "is not null";
234
- Where["IREGEX"] = "iregex";
235
293
  })(Where || (Where = {}));
236
294
 
237
295
  var UpdateOptionActions;
@@ -475,185 +533,184 @@ var PaymentType;
475
533
  PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
476
534
  })(PaymentType || (PaymentType = {}));
477
535
 
478
- var Plans;
479
- (function (Plans) {
480
- Plans["SELECT"] = "SELECT";
481
- Plans["PRIME"] = "PRIME";
482
- Plans["SELECT_MENSAL"] = "SELECT_MENSAL";
483
- Plans["PRIME_MENSAL"] = "PRIME_MENSAL";
484
- })(Plans || (Plans = {}));
485
-
486
536
  var Status;
487
537
  (function (Status) {
488
538
  Status["ACTIVE"] = "active";
489
539
  Status["CANCELLED"] = "Cancelado";
490
540
  })(Status || (Status = {}));
491
541
 
492
- class Payment extends BaseModel {
493
- static get identifiersFields() {
494
- return ['id'];
495
- }
542
+ class PaymentTransaction extends BaseModel {
496
543
  }
497
544
  __decorate([
498
545
  Expose({ name: 'refuse_reason' }),
499
546
  __metadata("design:type", String)
500
- ], Payment.prototype, "refuseReason", void 0);
547
+ ], PaymentTransaction.prototype, "refuseReason", void 0);
501
548
  __decorate([
502
549
  Expose({ name: 'status_reason' }),
503
550
  __metadata("design:type", String)
504
- ], Payment.prototype, "statusReason", void 0);
551
+ ], PaymentTransaction.prototype, "statusReason", void 0);
505
552
  __decorate([
506
553
  Expose({ name: 'acquirer_response_code' }),
507
554
  __metadata("design:type", String)
508
- ], Payment.prototype, "acquirerResponseCode", void 0);
555
+ ], PaymentTransaction.prototype, "acquirerResponseCode", void 0);
509
556
  __decorate([
510
557
  Expose({ name: 'acquirer_name' }),
511
558
  __metadata("design:type", String)
512
- ], Payment.prototype, "acquirerName", void 0);
559
+ ], PaymentTransaction.prototype, "acquirerName", void 0);
513
560
  __decorate([
514
561
  Expose({ name: 'acquirer_id' }),
515
562
  __metadata("design:type", String)
516
- ], Payment.prototype, "acquirerId", void 0);
563
+ ], PaymentTransaction.prototype, "acquirerId", void 0);
517
564
  __decorate([
518
565
  Expose({ name: 'authorization_code' }),
519
566
  __metadata("design:type", String)
520
- ], Payment.prototype, "authorizationCode", void 0);
567
+ ], PaymentTransaction.prototype, "authorizationCode", void 0);
521
568
  __decorate([
522
569
  Expose({ name: 'soft_descriptor' }),
523
570
  __metadata("design:type", String)
524
- ], Payment.prototype, "softDescriptor", void 0);
571
+ ], PaymentTransaction.prototype, "softDescriptor", void 0);
525
572
  __decorate([
526
573
  Expose({ name: 'date_created' }),
527
574
  __metadata("design:type", String)
528
- ], Payment.prototype, "dateCreated", void 0);
575
+ ], PaymentTransaction.prototype, "dateCreated", void 0);
529
576
  __decorate([
530
577
  Expose({ name: 'date_updated' }),
531
578
  __metadata("design:type", String)
532
- ], Payment.prototype, "dateUpdated", void 0);
579
+ ], PaymentTransaction.prototype, "dateUpdated", void 0);
533
580
  __decorate([
534
581
  Expose({ name: 'authorized_amount' }),
535
582
  __metadata("design:type", Number)
536
- ], Payment.prototype, "authorizedAmount", void 0);
583
+ ], PaymentTransaction.prototype, "authorizedAmount", void 0);
537
584
  __decorate([
538
585
  Expose({ name: 'paid_amount' }),
539
586
  __metadata("design:type", Number)
540
- ], Payment.prototype, "paidAmount", void 0);
587
+ ], PaymentTransaction.prototype, "paidAmount", void 0);
541
588
  __decorate([
542
589
  Expose({ name: 'refunded_amount' }),
543
590
  __metadata("design:type", Number)
544
- ], Payment.prototype, "refundedAmount", void 0);
591
+ ], PaymentTransaction.prototype, "refundedAmount", void 0);
545
592
  __decorate([
546
593
  Expose({ name: 'card_holder_name' }),
547
594
  __metadata("design:type", String)
548
- ], Payment.prototype, "cardHolderName", void 0);
595
+ ], PaymentTransaction.prototype, "cardHolderName", void 0);
549
596
  __decorate([
550
597
  Expose({ name: 'card_last_digits' }),
551
598
  __metadata("design:type", String)
552
- ], Payment.prototype, "cardLastDigits", void 0);
599
+ ], PaymentTransaction.prototype, "cardLastDigits", void 0);
553
600
  __decorate([
554
601
  Expose({ name: 'card_first_digits' }),
555
602
  __metadata("design:type", String)
556
- ], Payment.prototype, "cardFirstDigits", void 0);
603
+ ], PaymentTransaction.prototype, "cardFirstDigits", void 0);
557
604
  __decorate([
558
605
  Expose({ name: 'card_brand' }),
559
606
  __metadata("design:type", String)
560
- ], Payment.prototype, "cardBrand", void 0);
607
+ ], PaymentTransaction.prototype, "cardBrand", void 0);
561
608
  __decorate([
562
609
  Expose({ name: 'card_pin_mode' }),
563
610
  __metadata("design:type", String)
564
- ], Payment.prototype, "cardPinMode", void 0);
611
+ ], PaymentTransaction.prototype, "cardPinMode", void 0);
565
612
  __decorate([
566
613
  Expose({ name: 'card_magstripe_fallback' }),
567
614
  __metadata("design:type", Boolean)
568
- ], Payment.prototype, "cardMagstripeFallback", void 0);
615
+ ], PaymentTransaction.prototype, "cardMagstripeFallback", void 0);
569
616
  __decorate([
570
617
  Expose({ name: 'cvm_pin' }),
571
618
  __metadata("design:type", Boolean)
572
- ], Payment.prototype, "cvmPin", void 0);
619
+ ], PaymentTransaction.prototype, "cvmPin", void 0);
573
620
  __decorate([
574
621
  Expose({ name: 'postback_url' }),
575
622
  __metadata("design:type", String)
576
- ], Payment.prototype, "postbackUrl", void 0);
623
+ ], PaymentTransaction.prototype, "postbackUrl", void 0);
577
624
  __decorate([
578
625
  Expose({ name: 'payment_method' }),
579
626
  __metadata("design:type", String)
580
- ], Payment.prototype, "paymentMethod", void 0);
627
+ ], PaymentTransaction.prototype, "paymentMethod", void 0);
581
628
  __decorate([
582
629
  Expose({ name: 'capture_method' }),
583
630
  __metadata("design:type", String)
584
- ], Payment.prototype, "captureMethod", void 0);
631
+ ], PaymentTransaction.prototype, "captureMethod", void 0);
585
632
  __decorate([
586
633
  Expose({ name: 'antifraud_score' }),
587
634
  __metadata("design:type", String)
588
- ], Payment.prototype, "antifraudScore", void 0);
635
+ ], PaymentTransaction.prototype, "antifraudScore", void 0);
589
636
  __decorate([
590
637
  Expose({ name: 'boleto_url' }),
591
638
  __metadata("design:type", String)
592
- ], Payment.prototype, "boletoUrl", void 0);
639
+ ], PaymentTransaction.prototype, "boletoUrl", void 0);
593
640
  __decorate([
594
641
  Expose({ name: 'boleto_barcode' }),
595
642
  __metadata("design:type", String)
596
- ], Payment.prototype, "boletoBarcode", void 0);
643
+ ], PaymentTransaction.prototype, "boletoBarcode", void 0);
597
644
  __decorate([
598
645
  Expose({ name: 'boleto_expiration_date' }),
599
646
  __metadata("design:type", String)
600
- ], Payment.prototype, "boletoExpirationDate", void 0);
647
+ ], PaymentTransaction.prototype, "boletoExpirationDate", void 0);
601
648
  __decorate([
602
649
  Expose({ name: 'subscription_id' }),
603
650
  __metadata("design:type", String)
604
- ], Payment.prototype, "subscriptionId", void 0);
651
+ ], PaymentTransaction.prototype, "subscriptionId", void 0);
605
652
  __decorate([
606
653
  Expose({ name: 'split_rules' }),
607
654
  __metadata("design:type", String)
608
- ], Payment.prototype, "splitRules", void 0);
655
+ ], PaymentTransaction.prototype, "splitRules", void 0);
609
656
  __decorate([
610
657
  Expose({ name: 'antifraud_metadata' }),
611
658
  __metadata("design:type", Object)
612
- ], Payment.prototype, "antifraudMetadata", void 0);
659
+ ], PaymentTransaction.prototype, "antifraudMetadata", void 0);
613
660
  __decorate([
614
661
  Expose({ name: 'reference_key' }),
615
662
  __metadata("design:type", String)
616
- ], Payment.prototype, "referenceKey", void 0);
663
+ ], PaymentTransaction.prototype, "referenceKey", void 0);
617
664
  __decorate([
618
665
  Expose({ name: 'local_transaction_id' }),
619
666
  __metadata("design:type", String)
620
- ], Payment.prototype, "localTransactionId", void 0);
667
+ ], PaymentTransaction.prototype, "localTransactionId", void 0);
621
668
  __decorate([
622
669
  Expose({ name: 'local_time' }),
623
670
  __metadata("design:type", String)
624
- ], Payment.prototype, "localTime", void 0);
671
+ ], PaymentTransaction.prototype, "localTime", void 0);
625
672
  __decorate([
626
673
  Expose({ name: 'fraud_covered' }),
627
674
  __metadata("design:type", Boolean)
628
- ], Payment.prototype, "fraudCovered", void 0);
675
+ ], PaymentTransaction.prototype, "fraudCovered", void 0);
629
676
  __decorate([
630
677
  Expose({ name: 'fraud_reimbursed' }),
631
678
  __metadata("design:type", String)
632
- ], Payment.prototype, "fraudReimbursed", void 0);
679
+ ], PaymentTransaction.prototype, "fraudReimbursed", void 0);
633
680
  __decorate([
634
681
  Expose({ name: 'order_id' }),
635
682
  __metadata("design:type", String)
636
- ], Payment.prototype, "orderId", void 0);
683
+ ], PaymentTransaction.prototype, "orderId", void 0);
637
684
  __decorate([
638
685
  Expose({ name: 'risk_level' }),
639
686
  __metadata("design:type", String)
640
- ], Payment.prototype, "riskLevel", void 0);
687
+ ], PaymentTransaction.prototype, "riskLevel", void 0);
641
688
  __decorate([
642
689
  Expose({ name: 'receipt_url' }),
643
690
  __metadata("design:type", String)
644
- ], Payment.prototype, "receiptUrl", void 0);
691
+ ], PaymentTransaction.prototype, "receiptUrl", void 0);
645
692
  __decorate([
646
693
  Expose({ name: 'private_label' }),
647
694
  __metadata("design:type", String)
648
- ], Payment.prototype, "privateLabel", void 0);
695
+ ], PaymentTransaction.prototype, "privateLabel", void 0);
649
696
  __decorate([
650
697
  Expose({ name: 'pix_qr_code' }),
651
698
  __metadata("design:type", String)
652
- ], Payment.prototype, "pixQrCode", void 0);
699
+ ], PaymentTransaction.prototype, "pixQrCode", void 0);
653
700
  __decorate([
654
701
  Expose({ name: 'pix_expiration_date' }),
655
702
  __metadata("design:type", String)
656
- ], Payment.prototype, "pixExpirationDate", void 0);
703
+ ], PaymentTransaction.prototype, "pixExpirationDate", void 0);
704
+
705
+ class Payment extends BaseModel {
706
+ static get identifiersFields() {
707
+ return ['id'];
708
+ }
709
+ }
710
+ __decorate([
711
+ Type(() => PaymentTransaction),
712
+ __metadata("design:type", PaymentTransaction)
713
+ ], Payment.prototype, "transaction", void 0);
657
714
 
658
715
  class SubscriptionPayment extends BaseModel {
659
716
  static get identifiersFields() {
@@ -2152,10 +2209,16 @@ var OrderStatus;
2152
2209
  class Order extends Checkout {
2153
2210
  }
2154
2211
  __decorate([
2155
- Type(() => Payment),
2156
- __metadata("design:type", Payment)
2212
+ Type(() => PaymentTransaction),
2213
+ __metadata("design:type", PaymentTransaction)
2157
2214
  ], Order.prototype, "payment", void 0);
2158
2215
 
2216
+ class OrderBlocked extends BaseModel {
2217
+ static get identifiersFields() {
2218
+ return ['id'];
2219
+ }
2220
+ }
2221
+
2159
2222
  class CheckoutSubscription extends BaseModel {
2160
2223
  static get identifiersFields() {
2161
2224
  return ['id'];
@@ -2178,6 +2241,591 @@ __decorate([
2178
2241
  __metadata("design:type", Coupon)
2179
2242
  ], CheckoutSubscription.prototype, "coupon", void 0);
2180
2243
 
2244
+ class BusinessError extends CustomError {
2245
+ constructor(message, additionalData, type = '') {
2246
+ super(message);
2247
+ this.additionalData = additionalData;
2248
+ this.type = type;
2249
+ }
2250
+ }
2251
+
2252
+ class DuplicatedResultsError extends CustomError {
2253
+ constructor(message) {
2254
+ super(message);
2255
+ }
2256
+ }
2257
+
2258
+ class FraudValidationError extends CustomError {
2259
+ constructor(message, additionalData) {
2260
+ super(message);
2261
+ this.additionalData = additionalData;
2262
+ this.type = 'antifraud';
2263
+ }
2264
+ }
2265
+
2266
+ class InvalidArgumentError extends CustomError {
2267
+ constructor(message) {
2268
+ super(message);
2269
+ }
2270
+ }
2271
+
2272
+ class NotFoundError extends CustomError {
2273
+ constructor(message) {
2274
+ super(message);
2275
+ }
2276
+ }
2277
+
2278
+ class PaymentError extends CustomError {
2279
+ constructor(message, additionalData) {
2280
+ super(message);
2281
+ this.additionalData = additionalData;
2282
+ this.type = 'payment';
2283
+ }
2284
+ }
2285
+
2286
+ class RequiredArgumentError extends CustomError {
2287
+ constructor(args) {
2288
+ super(`Required arguments: ${args.join(', ')}`);
2289
+ this.args = args;
2290
+ this.arguments = args;
2291
+ }
2292
+ }
2293
+
2294
+ class StockLimitError extends BusinessError {
2295
+ constructor(message) {
2296
+ super(message);
2297
+ this.type = 'stock-limit';
2298
+ }
2299
+ }
2300
+
2301
+ class StockOutError extends BusinessError {
2302
+ constructor(message) {
2303
+ super(message);
2304
+ this.type = 'stock-out';
2305
+ }
2306
+ }
2307
+
2308
+ class AdyenCardService {
2309
+ constructor(credentials, paymentRepository, orderBlockedRepository) {
2310
+ this.credentials = credentials;
2311
+ this.paymentRepository = paymentRepository;
2312
+ this.orderBlockedRepository = orderBlockedRepository;
2313
+ }
2314
+ async pay(checkout, card) {
2315
+ try {
2316
+ const result = await axios({
2317
+ method: 'POST',
2318
+ url: this.credentials.URL_TRANSACTION,
2319
+ headers: {
2320
+ 'x-api-key': this.credentials.API_KEY,
2321
+ 'content-type': 'application/json',
2322
+ },
2323
+ data: this.createCardPayment(checkout, card),
2324
+ });
2325
+ if (result.data.resultCode !== 'Authorised') {
2326
+ this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
2327
+ 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`, {
2328
+ checkoutId: checkout.id,
2329
+ userEmail: checkout.user.email,
2330
+ info: result.data,
2331
+ }));
2332
+ }
2333
+ const payment = await this.paymentRepository.create(Payment.toInstance({
2334
+ createdAt: new Date(),
2335
+ updatedAt: new Date(),
2336
+ userId: checkout.user.id,
2337
+ checkoutId: checkout.id,
2338
+ totalPrice: checkout.totalPrice,
2339
+ paymentProvider: 'adyen',
2340
+ transaction: Object.assign(Object.assign({}, result.data), { status: 'paid' }),
2341
+ }));
2342
+ return payment;
2343
+ }
2344
+ catch (error) {
2345
+ 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', {
2346
+ checkoutId: checkout.id,
2347
+ userEmail: checkout.user.email,
2348
+ info: error.message,
2349
+ });
2350
+ }
2351
+ }
2352
+ createCardPayment(checkout, card) {
2353
+ return {
2354
+ amount: {
2355
+ currency: 'BRL',
2356
+ value: ((checkout === null || checkout === void 0 ? void 0 : checkout.totalPrice) || 0) * 100,
2357
+ },
2358
+ paymentMethod: {
2359
+ type: 'scheme',
2360
+ storedPaymentMethodId: card.cardId,
2361
+ },
2362
+ reference: checkout.id,
2363
+ shopperInteraction: 'Ecommerce',
2364
+ merchantAccount: this.credentials.MERCHANT_ACCOUNT,
2365
+ shopperReference: checkout.user.id,
2366
+ recurringProcessingModel: 'CardOnFile',
2367
+ returnUrl: this.credentials.URL_POSTBACK,
2368
+ installments: {
2369
+ value: card.installments,
2370
+ },
2371
+ };
2372
+ }
2373
+ addCard() {
2374
+ throw new Error('Method not implemented.');
2375
+ }
2376
+ }
2377
+
2378
+ class AntifraudBankSlipService {
2379
+ constructor(orderBlockedRepository) {
2380
+ this.orderBlockedRepository = orderBlockedRepository;
2381
+ this.MAX_ORDER_VALUE = 5000;
2382
+ }
2383
+ async validate(checkout) {
2384
+ var _a, _b;
2385
+ if (checkout.totalPrice && checkout.totalPrice > this.MAX_ORDER_VALUE && !((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber)) {
2386
+ await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Boleto not authorized', 'Boleto', 'day');
2387
+ throw new FraudValidationError('Boleto não autorizado para cliente não assinante', {
2388
+ checkoutId: checkout.id,
2389
+ userEmail: checkout.user.email,
2390
+ info: {
2391
+ isSubscriber: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.isSubscriber,
2392
+ subtotal: checkout.subTotalPrice,
2393
+ total: checkout.totalPrice,
2394
+ },
2395
+ });
2396
+ }
2397
+ return true;
2398
+ }
2399
+ }
2400
+
2401
+ class AntifraudCardService {
2402
+ constructor(orderRepository, orderBlockedRepository) {
2403
+ this.orderRepository = orderRepository;
2404
+ this.orderBlockedRepository = orderBlockedRepository;
2405
+ this.LIMIT_ORDERS_DAY = 2;
2406
+ this.LIMIT_ORDERS_WEEK = 7;
2407
+ this.LIMIT_BLOCKED_ORDERS_DAY = 5;
2408
+ }
2409
+ async validate(checkout, card) {
2410
+ var _a, _b;
2411
+ if (!(await this.verifyBlockedOrderAttempts(checkout, card)))
2412
+ throw new FraudValidationError('Cliente com mais de 5 compras negadas/bloqueadas no dia', {
2413
+ checkoutId: checkout.id,
2414
+ userEmail: checkout.user.email,
2415
+ info: {
2416
+ isSubscriber: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber,
2417
+ subtotal: checkout.subTotalPrice,
2418
+ total: checkout.totalPrice,
2419
+ },
2420
+ });
2421
+ if (!(await this.verifyDayAndWeekOrders(checkout, card)))
2422
+ throw new FraudValidationError('Cliente tentando comprar mais de 2 vezes no dia ou 7 vezes na semana', {
2423
+ checkoutId: checkout.id,
2424
+ userEmail: checkout.user.email,
2425
+ info: {
2426
+ isSubscriber: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.isSubscriber,
2427
+ subtotal: checkout.subTotalPrice,
2428
+ total: checkout.totalPrice,
2429
+ },
2430
+ });
2431
+ return true;
2432
+ }
2433
+ async verifyBlockedOrderAttempts(checkout, card) {
2434
+ var _a, _b, _c, _d;
2435
+ const day = `${format(new Date(), 'YYYY-MM-DD')}T00:00:00`;
2436
+ const endOfDay = `${format(new Date(), 'YYYY-MM-DD')}T23:59:59`;
2437
+ const ordersBlockedWithCpf = await this.orderBlockedRepository
2438
+ .find({
2439
+ filters: {
2440
+ customer: { cpf: { operator: Where.EQUALS, value: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf } },
2441
+ date: [
2442
+ { operator: Where.GTE, value: new Date(day) },
2443
+ { operator: Where.LTE, value: new Date(endOfDay) },
2444
+ ],
2445
+ },
2446
+ })
2447
+ .then((data) => data.data);
2448
+ const ordersBlockedWithEmail = await this.orderBlockedRepository
2449
+ .find({
2450
+ filters: {
2451
+ customer: { email: { operator: Where.EQUALS, value: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email } },
2452
+ date: [
2453
+ { operator: Where.GTE, value: new Date(day) },
2454
+ { operator: Where.LTE, value: new Date(endOfDay) },
2455
+ ],
2456
+ },
2457
+ })
2458
+ .then((data) => data.data);
2459
+ const ordersBlockedWithCep = await this.orderBlockedRepository
2460
+ .find({
2461
+ filters: {
2462
+ customer: { shippingAddress: { zip: { operator: Where.EQUALS, value: (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.zip } } },
2463
+ date: [
2464
+ { operator: Where.GTE, value: new Date(day) },
2465
+ { operator: Where.LTE, value: new Date(endOfDay) },
2466
+ ],
2467
+ },
2468
+ })
2469
+ .then((data) => data.data);
2470
+ const ordersBlockedWithPhone = await this.orderBlockedRepository
2471
+ .find({
2472
+ filters: {
2473
+ customer: { phoneNumber: { operator: Where.EQUALS, value: (_d = checkout.user) === null || _d === void 0 ? void 0 : _d.phone } },
2474
+ date: [
2475
+ { operator: Where.GTE, value: new Date(day) },
2476
+ { operator: Where.LTE, value: new Date(endOfDay) },
2477
+ ],
2478
+ },
2479
+ })
2480
+ .then((data) => data.data);
2481
+ const blockedUniqueEmails = ordersBlockedWithEmail.filter((e) => {
2482
+ var _a;
2483
+ return e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf);
2484
+ });
2485
+ const blockedUniqueCeps = ordersBlockedWithCep.filter((e) => {
2486
+ var _a, _b;
2487
+ 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);
2488
+ });
2489
+ const blockedUniquePhone = ordersBlockedWithPhone.filter((e) => {
2490
+ var _a, _b, _c, _d, _e, _f;
2491
+ return (e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf) &&
2492
+ e.customer.email !== ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email) &&
2493
+ ((_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()));
2494
+ });
2495
+ const blockedAttempts = ordersBlockedWithCpf
2496
+ .concat(blockedUniqueEmails)
2497
+ .concat(blockedUniqueCeps)
2498
+ .concat(blockedUniquePhone);
2499
+ if (blockedAttempts.length >= this.LIMIT_BLOCKED_ORDERS_DAY) {
2500
+ await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'More than 5 attempts have failed', 'Failed attempts', 'day', card || null);
2501
+ return false;
2502
+ }
2503
+ return true;
2504
+ }
2505
+ async verifyDayAndWeekOrders(checkout, card) {
2506
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2507
+ 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'));
2508
+ for (const key in ordersPerDay) {
2509
+ if (ordersPerDay[key] > this.LIMIT_ORDERS_DAY) {
2510
+ await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Order limit', key, 'day');
2511
+ return false;
2512
+ }
2513
+ }
2514
+ 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'));
2515
+ for (const key in ordersPerWeek) {
2516
+ if (ordersPerDay[key] > this.LIMIT_ORDERS_WEEK) {
2517
+ await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Order limit', key, 'week');
2518
+ return false;
2519
+ }
2520
+ }
2521
+ return true;
2522
+ }
2523
+ async validateOrdersByRange(cpf, email, phone, zip, card, range) {
2524
+ const ordersCpf = await this.countOrdersByField('user', 'cpf', cpf, range);
2525
+ const ordersByEmail = await this.countOrdersByField('user', 'email', email, range);
2526
+ const ordersByPhone = await this.countOrdersByField('user', 'phone', phone, range);
2527
+ const ordersByZip = await this.countOrdersByField('shippingAddress', 'zip', zip, range);
2528
+ return {
2529
+ cpf: ordersCpf,
2530
+ email: ordersByEmail,
2531
+ phone: ordersByPhone,
2532
+ zip: ordersByZip,
2533
+ };
2534
+ }
2535
+ async countOrdersByField(property, field, value, range) {
2536
+ const filters = {
2537
+ [property]: {
2538
+ [field]: value,
2539
+ },
2540
+ ['createdAt']: [
2541
+ { operator: Where.GTE, value: range.firstDate },
2542
+ { operator: Where.LTE, value: range.lastDate },
2543
+ ],
2544
+ };
2545
+ const docs = await (await this.orderRepository.find({ filters })).count;
2546
+ return docs;
2547
+ }
2548
+ getDateRange(range = 'day') {
2549
+ switch (range) {
2550
+ case 'day':
2551
+ return {
2552
+ firstDate: startOfDay(new Date()).getTime(),
2553
+ lastDate: endOfDay(new Date()).getTime(),
2554
+ };
2555
+ case 'week':
2556
+ return {
2557
+ firstDate: startOfDay(subDays(new Date(), 7)).getTime(),
2558
+ lastDate: endOfDay(new Date()).getTime(),
2559
+ };
2560
+ default:
2561
+ return {
2562
+ firstDate: startOfDay(new Date()).getTime(),
2563
+ lastDate: endOfDay(new Date()).getTime(),
2564
+ };
2565
+ }
2566
+ }
2567
+ }
2568
+
2569
+ class AntifraudGlampointsService {
2570
+ constructor() { }
2571
+ async validate(checkout) {
2572
+ return true;
2573
+ }
2574
+ }
2575
+
2576
+ class AntifraudPixService {
2577
+ constructor() { }
2578
+ async validate(checkout) {
2579
+ return true;
2580
+ }
2581
+ }
2582
+
2583
+ class GlampointsPaymentService {
2584
+ constructor(paymentRepository) {
2585
+ this.paymentRepository = paymentRepository;
2586
+ }
2587
+ async pay(checkout) {
2588
+ const payment = await this.paymentRepository.create(Payment.toInstance({
2589
+ createdAt: new Date(),
2590
+ updatedAt: new Date(),
2591
+ userId: checkout.user.id,
2592
+ checkoutId: checkout.id,
2593
+ totalPrice: checkout.totalPrice,
2594
+ paymentProvider: 'glampoints',
2595
+ transaction: {
2596
+ amount: 0,
2597
+ acquirerResponseCode: '0000',
2598
+ acquirerName: 'glampoints',
2599
+ authorizedAmount: 0,
2600
+ captureMethod: 'ecommerce',
2601
+ installments: 1,
2602
+ cost: 0,
2603
+ paidAmount: 0,
2604
+ paymentMethod: 'glampoints',
2605
+ referer: 'api_key',
2606
+ refundedAmount: 0,
2607
+ status: 'paid',
2608
+ statusReason: 'acquirer',
2609
+ },
2610
+ }));
2611
+ return payment;
2612
+ }
2613
+ }
2614
+
2615
+ class PagarmeBankSlipService {
2616
+ constructor(credentials, paymentRepository) {
2617
+ this.credentials = credentials;
2618
+ this.paymentRepository = paymentRepository;
2619
+ }
2620
+ async pay(checkout) {
2621
+ try {
2622
+ const result = await axios({
2623
+ method: 'POST',
2624
+ url: this.credentials.URL_TRANSACTION,
2625
+ data: this.createBoletoPayment(checkout),
2626
+ });
2627
+ if (result.data.status !== 'processing') {
2628
+ return Promise.reject(new PaymentError(`Houve uma falha ao gerar o boleto. Tente novamente`, {
2629
+ checkoutId: checkout.id,
2630
+ userEmail: checkout.user.email,
2631
+ info: result.data,
2632
+ }));
2633
+ }
2634
+ const payment = await this.paymentRepository.create(Payment.toInstance({
2635
+ createdAt: new Date(),
2636
+ updatedAt: new Date(),
2637
+ userId: checkout.user.id,
2638
+ checkoutId: checkout.id,
2639
+ totalPrice: checkout.totalPrice,
2640
+ paymentProvider: 'pagarMe',
2641
+ transaction: result.data,
2642
+ }));
2643
+ return payment;
2644
+ }
2645
+ catch (error) {
2646
+ throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
2647
+ checkoutId: checkout.id,
2648
+ userEmail: checkout.user.email,
2649
+ info: error.response.data,
2650
+ });
2651
+ }
2652
+ }
2653
+ createBoletoPayment(checkout) {
2654
+ return {
2655
+ api_key: this.credentials.API_KEY,
2656
+ amount: Math.floor(checkout.totalPrice * 100),
2657
+ boleto_rules: ['strict_expiration_date'],
2658
+ boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
2659
+ boleto_expiration_date: format(addDays(new Date(), 3), 'yyyy-MM-dd'),
2660
+ payment_method: 'boleto',
2661
+ postback_url: this.credentials.URL_POSTBACK,
2662
+ customer: {
2663
+ external_id: checkout.user.id,
2664
+ type: 'individual',
2665
+ country: 'br',
2666
+ name: checkout.user.displayName,
2667
+ documents: [
2668
+ {
2669
+ type: 'cpf',
2670
+ number: checkout.user.cpf,
2671
+ },
2672
+ ],
2673
+ },
2674
+ };
2675
+ }
2676
+ }
2677
+
2678
+ class PagarmeCardService {
2679
+ constructor(credentials, paymentRepository, orderBlockedRepository) {
2680
+ this.credentials = credentials;
2681
+ this.paymentRepository = paymentRepository;
2682
+ this.orderBlockedRepository = orderBlockedRepository;
2683
+ }
2684
+ async pay(checkout, card) {
2685
+ var _a;
2686
+ try {
2687
+ const result = await axios({
2688
+ method: 'POST',
2689
+ url: this.credentials.URL_TRANSACTION,
2690
+ data: this.createCardPayment(checkout, card),
2691
+ });
2692
+ if (result.data.status !== 'paid') {
2693
+ this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
2694
+ 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`, {
2695
+ checkoutId: checkout.id,
2696
+ userEmail: checkout.user.email,
2697
+ info: result.data,
2698
+ }));
2699
+ }
2700
+ const payment = await this.paymentRepository.create(Payment.toInstance({
2701
+ createdAt: new Date(),
2702
+ updatedAt: new Date(),
2703
+ userId: checkout.user.id,
2704
+ checkoutId: checkout.id,
2705
+ totalPrice: checkout.totalPrice,
2706
+ paymentProvider: 'pagarMe',
2707
+ transaction: result.data,
2708
+ }));
2709
+ return payment;
2710
+ }
2711
+ catch (error) {
2712
+ 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', {
2713
+ checkoutId: checkout.id,
2714
+ userEmail: checkout.user.email,
2715
+ info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
2716
+ });
2717
+ }
2718
+ }
2719
+ addCard() {
2720
+ throw new Error('Method not implemented.');
2721
+ }
2722
+ createCardPayment(checkout, card) {
2723
+ var _a, _b, _c, _d, _e, _f;
2724
+ return {
2725
+ api_key: this.credentials.API_KEY,
2726
+ amount: Math.floor(checkout.totalPrice * 100),
2727
+ card_id: card.cardId,
2728
+ payment_method: 'credit_card',
2729
+ installments: card.installments,
2730
+ soft_descriptor: checkout.shop,
2731
+ customer: {
2732
+ external_id: checkout.user.id,
2733
+ name: checkout.user.displayName,
2734
+ type: 'individual',
2735
+ country: 'br',
2736
+ email: checkout.user.email,
2737
+ phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
2738
+ documents: [
2739
+ {
2740
+ type: 'cpf',
2741
+ number: checkout.user.cpf,
2742
+ },
2743
+ ],
2744
+ },
2745
+ billing: {
2746
+ name: checkout.user.displayName,
2747
+ address: {
2748
+ country: 'br',
2749
+ state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
2750
+ city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
2751
+ neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
2752
+ street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
2753
+ street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
2754
+ zipcode: checkout.billingAddress
2755
+ ? checkout.billingAddress.zip.replace('-', '')
2756
+ : (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
2757
+ },
2758
+ },
2759
+ items: checkout.lineItems.map((item) => {
2760
+ return {
2761
+ id: item.id,
2762
+ title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
2763
+ unit_price: Math.floor(item.pricePaid * 100),
2764
+ quantity: item.quantity,
2765
+ tangible: true,
2766
+ };
2767
+ }),
2768
+ };
2769
+ }
2770
+ }
2771
+
2772
+ class PagarmePixService {
2773
+ constructor(credentials, paymentRepository) {
2774
+ this.credentials = credentials;
2775
+ this.paymentRepository = paymentRepository;
2776
+ }
2777
+ async pay(checkout) {
2778
+ var _a;
2779
+ try {
2780
+ const result = await axios({
2781
+ method: 'POST',
2782
+ url: this.credentials.URL_TRANSACTION,
2783
+ data: this.createPixPayment(checkout),
2784
+ });
2785
+ const payment = await this.paymentRepository.create(Payment.toInstance({
2786
+ createdAt: new Date(),
2787
+ updatedAt: new Date(),
2788
+ userId: checkout.user.id,
2789
+ checkoutId: checkout.id,
2790
+ totalPrice: checkout.totalPrice,
2791
+ paymentProvider: 'pagarMe',
2792
+ transaction: result.data,
2793
+ }));
2794
+ return payment;
2795
+ }
2796
+ catch (error) {
2797
+ throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
2798
+ checkoutId: checkout.id,
2799
+ userEmail: checkout.user.email,
2800
+ info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
2801
+ });
2802
+ }
2803
+ }
2804
+ createPixPayment(checkout) {
2805
+ return {
2806
+ payment_method: 'pix',
2807
+ amount: Math.floor(checkout.totalPrice * 100),
2808
+ api_key: this.credentials.API_KEY,
2809
+ postback_url: this.credentials.URL_POSTBACK,
2810
+ pix_expiration_date: format(addDays(new Date(), 1), 'yyyy-MM-dd'),
2811
+ customer: {
2812
+ external_id: checkout.user.id,
2813
+ type: 'individual',
2814
+ country: 'br',
2815
+ name: checkout.user.displayName,
2816
+ email: checkout.user.email.trim(),
2817
+ phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
2818
+ documents: [
2819
+ {
2820
+ type: 'cpf',
2821
+ number: checkout.user.cpf,
2822
+ },
2823
+ ],
2824
+ },
2825
+ };
2826
+ }
2827
+ }
2828
+
2181
2829
  class RoundProductPricesHelper {
2182
2830
  static roundProductPrices(product) {
2183
2831
  product.price.price = Number(product.price.price.toFixed(2));
@@ -2192,6 +2840,12 @@ class RoundProductPricesHelper {
2192
2840
  }
2193
2841
  }
2194
2842
 
2843
+ class Sequence extends BaseModel {
2844
+ static get identifiersFields() {
2845
+ return ['id'];
2846
+ }
2847
+ }
2848
+
2195
2849
  var FilterType;
2196
2850
  (function (FilterType) {
2197
2851
  FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
@@ -2330,32 +2984,6 @@ class ShopSettings extends BaseModel {
2330
2984
  }
2331
2985
  }
2332
2986
 
2333
- class InvalidArgumentError extends CustomError {
2334
- constructor(message) {
2335
- super(message);
2336
- }
2337
- }
2338
-
2339
- class RequiredArgumentError extends CustomError {
2340
- constructor(args) {
2341
- super(`Required arguments: ${args.join(', ')}`);
2342
- this.args = args;
2343
- this.arguments = args;
2344
- }
2345
- }
2346
-
2347
- class NotFoundError extends CustomError {
2348
- constructor(message) {
2349
- super(message);
2350
- }
2351
- }
2352
-
2353
- class DuplicatedResultsError extends CustomError {
2354
- constructor(message) {
2355
- super(message);
2356
- }
2357
- }
2358
-
2359
2987
  class AxiosAdapter {
2360
2988
  constructor(config) {
2361
2989
  this.config = config;
@@ -2457,37 +3085,21 @@ class ProductsIndex {
2457
3085
  _source: fields,
2458
3086
  query: {
2459
3087
  bool: {
2460
- should: [
2461
- {
2462
- multi_match: {
2463
- query: `${searchTerm}`,
2464
- fields: ['name', 'name.folded', 'name.search'],
2465
- operator: 'AND',
2466
- },
3088
+ must: {
3089
+ multi_match: {
3090
+ query: `${searchTerm}`,
3091
+ fields: ['name', 'name.folded', 'name.search', 'description', 'brand'],
3092
+ fuzziness: 2,
2467
3093
  },
2468
- {
2469
- match_phrase: {
2470
- name: {
2471
- query: `${searchTerm}`,
2472
- boost: 2,
2473
- },
2474
- },
2475
- },
2476
- {
2477
- match: {
2478
- brand: {
2479
- query: `${searchTerm}`,
2480
- },
2481
- },
2482
- },
2483
- {
2484
- multi_match: {
3094
+ },
3095
+ should: {
3096
+ match_phrase_prefix: {
3097
+ 'name.search': {
2485
3098
  query: `${searchTerm}`,
2486
- fields: ['name', 'name.folded', 'name.search'],
2487
- operator: 'OR',
3099
+ slop: 10,
2488
3100
  },
2489
3101
  },
2490
- ],
3102
+ },
2491
3103
  filter,
2492
3104
  },
2493
3105
  },
@@ -2936,161 +3548,6 @@ const withCrudFirestore = (MixinBase) => {
2936
3548
  };
2937
3549
  };
2938
3550
 
2939
- class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2940
- constructor({ firestore, interceptors }) {
2941
- super({
2942
- firestore,
2943
- collectionName: 'leads',
2944
- model: Lead,
2945
- interceptors,
2946
- });
2947
- }
2948
- }
2949
-
2950
- class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2951
- constructor({ firestore, interceptors }, parentRepository) {
2952
- super({
2953
- firestore,
2954
- collectionName: 'editions',
2955
- parentIdField: 'subscriptionId',
2956
- model: Edition,
2957
- interceptors,
2958
- });
2959
- this.parentRepository = parentRepository;
2960
- }
2961
- }
2962
-
2963
- class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2964
- constructor({ firestore, interceptors, }) {
2965
- super({
2966
- firestore,
2967
- collectionName: 'subscription',
2968
- model: Subscription,
2969
- interceptors,
2970
- });
2971
- }
2972
- }
2973
-
2974
- class SubscriptionMaterializationFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2975
- constructor({ firestore, interceptors }) {
2976
- super({
2977
- firestore,
2978
- collectionName: 'subscriptionMaterialization',
2979
- model: SubscriptionMaterialization,
2980
- interceptors,
2981
- });
2982
- }
2983
- }
2984
-
2985
- class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2986
- constructor({ firestore, interceptors }, parentRepository) {
2987
- super({
2988
- firestore,
2989
- collectionName: 'payments',
2990
- parentIdField: 'subscriptionId',
2991
- model: SubscriptionPayment,
2992
- interceptors,
2993
- });
2994
- this.parentRepository = parentRepository;
2995
- }
2996
- }
2997
-
2998
- class SubscriptionSummaryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2999
- constructor({ firestore, interceptors, }) {
3000
- super({
3001
- firestore,
3002
- collectionName: 'subscriptionSummary',
3003
- model: SubscriptionSummary,
3004
- interceptors,
3005
- });
3006
- }
3007
- }
3008
-
3009
- class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3010
- constructor({ firestore, interceptors }, parentRepository) {
3011
- super({
3012
- firestore,
3013
- collectionName: 'address',
3014
- parentIdField: 'userId',
3015
- model: UserAddress,
3016
- interceptors,
3017
- });
3018
- this.parentRepository = parentRepository;
3019
- }
3020
- }
3021
-
3022
- class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3023
- constructor({ firestore, interceptors }, parentRepository) {
3024
- super({
3025
- firestore,
3026
- collectionName: 'CX',
3027
- parentIdField: 'userId',
3028
- model: BeautyProfile,
3029
- interceptors,
3030
- });
3031
- this.parentRepository = parentRepository;
3032
- }
3033
- }
3034
-
3035
- class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3036
- constructor({ firestore, interceptors }) {
3037
- super({
3038
- firestore,
3039
- collectionName: 'users',
3040
- model: User,
3041
- interceptors,
3042
- });
3043
- }
3044
- async get(identifiers) {
3045
- const user = await super.get({ id: identifiers.id });
3046
- user.beautyProfile = await this.getBeautyProfile(user.id);
3047
- user.isSubscriber = await this.checkIfIsSubscriber(user.id);
3048
- return user;
3049
- }
3050
- async checkIfExistsByField(field, value) {
3051
- const result = await this.find({ filters: { [field]: value } });
3052
- return result.count > 0;
3053
- }
3054
- buildModelInstance() {
3055
- const { fromFirestore, toFirestore } = super.buildModelInstance();
3056
- return {
3057
- toFirestore: (data) => {
3058
- const plain = toFirestore(data);
3059
- delete plain.isSubscriber;
3060
- return plain;
3061
- },
3062
- fromFirestore,
3063
- };
3064
- }
3065
- async getBeautyProfile(userId) {
3066
- const beautyProfile = await getDoc(doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
3067
- return beautyProfile.data();
3068
- }
3069
- async checkIfIsSubscriber(userId) {
3070
- const docs = await getDocs(query(this.collection('subscription'), where('user.id', '==', userId), where('status', '==', 'active')));
3071
- return !!docs && !!docs.size;
3072
- }
3073
- buildBeautyProfileModelInstance() {
3074
- return {
3075
- toFirestore: (data) => data.toPlain(),
3076
- fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
3077
- };
3078
- }
3079
- }
3080
-
3081
- class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3082
- constructor({ firestore, interceptors }, parentRepository) {
3083
- super({
3084
- firestore,
3085
- collectionName: 'payment_method',
3086
- parentIdField: 'userId',
3087
- model: UserPaymentMethod,
3088
- interceptors,
3089
- });
3090
- this.parentRepository = parentRepository;
3091
- }
3092
- }
3093
-
3094
3551
  class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3095
3552
  constructor({ firestore, interceptors }) {
3096
3553
  super({
@@ -3163,9 +3620,6 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
3163
3620
  });
3164
3621
  this.reviews = {};
3165
3622
  }
3166
- fetchProductReviews(filters) {
3167
- throw new Error('Method not implemented.');
3168
- }
3169
3623
  async getBySlug(slug) {
3170
3624
  var _a;
3171
3625
  const result = await this.find({
@@ -3207,30 +3661,122 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
3207
3661
  findCatalog(params) {
3208
3662
  return this.find(params);
3209
3663
  }
3210
- async fetchPaginatedReviews() {
3211
- return Promise.resolve([]);
3664
+ }
3665
+
3666
+ class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3667
+ constructor({ firestore, interceptors }, parentRepository) {
3668
+ super({
3669
+ firestore,
3670
+ collectionName: 'variants',
3671
+ parentIdField: 'productId',
3672
+ model: Variant,
3673
+ interceptors,
3674
+ });
3675
+ this.parentRepository = parentRepository;
3676
+ }
3677
+ }
3678
+
3679
+ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3680
+ constructor({ firestore, interceptors }) {
3681
+ super({
3682
+ firestore,
3683
+ collectionName: 'subscriptionProducts',
3684
+ model: Product,
3685
+ interceptors,
3686
+ });
3687
+ }
3688
+ }
3689
+
3690
+ class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3691
+ constructor({ firestore, interceptors }) {
3692
+ super({
3693
+ firestore,
3694
+ collectionName: 'sequences',
3695
+ model: Sequence,
3696
+ interceptors,
3697
+ });
3698
+ }
3699
+ }
3700
+
3701
+ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3702
+ constructor({ firestore, interceptors }) {
3703
+ super({
3704
+ firestore,
3705
+ collectionName: 'dms',
3706
+ model: Home,
3707
+ interceptors,
3708
+ });
3709
+ this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
3710
+ var _a, _b, _c;
3711
+ return ({
3712
+ category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
3713
+ ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
3714
+ : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
3715
+ 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)) || [],
3716
+ });
3717
+ };
3718
+ this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
3719
+ var _a;
3720
+ return ({
3721
+ category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
3722
+ products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
3723
+ });
3724
+ };
3725
+ }
3726
+ buildModelInstance() {
3727
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
3728
+ return {
3729
+ toFirestore: (data) => {
3730
+ const modifiedData = this.homeToFirestore(data);
3731
+ return toFirestore(modifiedData);
3732
+ },
3733
+ fromFirestore: (snap) => {
3734
+ const instance = fromFirestore(snap);
3735
+ return this.homeFromFirestore(instance);
3736
+ },
3737
+ };
3738
+ }
3739
+ homeToFirestore(home) {
3740
+ var _a, _b, _c, _d;
3741
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3742
+ home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
3743
+ home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
3744
+ home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
3745
+ }
3746
+ return home;
3747
+ }
3748
+ homeFromFirestore(home) {
3749
+ var _a;
3750
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3751
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
3752
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
3753
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
3754
+ home.data.createdAt =
3755
+ home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
3756
+ home.data.expiresAt =
3757
+ home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
3758
+ }
3759
+ return home;
3212
3760
  }
3213
3761
  }
3214
3762
 
3215
- class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3216
- constructor({ firestore, interceptors }, parentRepository) {
3763
+ class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3764
+ constructor({ firestore, interceptors }) {
3217
3765
  super({
3218
3766
  firestore,
3219
- collectionName: 'variants',
3220
- parentIdField: 'productId',
3221
- model: Variant,
3767
+ collectionName: 'shopMenus',
3768
+ model: ShopMenu,
3222
3769
  interceptors,
3223
3770
  });
3224
- this.parentRepository = parentRepository;
3225
3771
  }
3226
3772
  }
3227
3773
 
3228
- class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3229
- constructor({ firestore, interceptors }) {
3774
+ class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3775
+ constructor({ firestore, interceptors, }) {
3230
3776
  super({
3231
3777
  firestore,
3232
- collectionName: 'subscriptionProducts',
3233
- model: Product,
3778
+ collectionName: 'shopSettings',
3779
+ model: ShopSettings,
3234
3780
  interceptors,
3235
3781
  });
3236
3782
  }
@@ -3366,6 +3912,47 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
3366
3912
  }
3367
3913
  }
3368
3914
 
3915
+ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3916
+ constructor({ firestore, interceptors, }) {
3917
+ super({
3918
+ firestore,
3919
+ collectionName: 'paymentBlockedAttempts',
3920
+ model: OrderBlocked,
3921
+ interceptors,
3922
+ });
3923
+ }
3924
+ async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
3925
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3926
+ return this.create(OrderBlocked.toInstance({
3927
+ customer: {
3928
+ name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
3929
+ cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
3930
+ id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
3931
+ email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
3932
+ phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
3933
+ isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
3934
+ subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
3935
+ shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
3936
+ },
3937
+ blockType,
3938
+ limiteRange,
3939
+ type,
3940
+ card,
3941
+ checkout: {
3942
+ id: checkout.id,
3943
+ shop: checkout.shop,
3944
+ total: checkout.totalPrice,
3945
+ },
3946
+ date: new Date(),
3947
+ }));
3948
+ }
3949
+ formatZip(zip) {
3950
+ if (zip.length === 8)
3951
+ return zip.substring(0, 5) + '-' + zip.substring(5, 8);
3952
+ return zip;
3953
+ }
3954
+ }
3955
+
3369
3956
  class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3370
3957
  constructor({ firestore, interceptors }) {
3371
3958
  super({
@@ -3388,87 +3975,158 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
3388
3975
  }
3389
3976
  }
3390
3977
 
3391
- class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3978
+ class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3392
3979
  constructor({ firestore, interceptors }) {
3393
3980
  super({
3394
3981
  firestore,
3395
- collectionName: 'dms',
3396
- model: Home,
3982
+ collectionName: 'leads',
3983
+ model: Lead,
3397
3984
  interceptors,
3398
3985
  });
3399
- this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
3400
- var _a, _b, _c;
3401
- return ({
3402
- category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
3403
- ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
3404
- : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
3405
- 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)) || [],
3406
- });
3407
- };
3408
- this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
3409
- var _a;
3410
- return ({
3411
- category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
3412
- products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
3413
- });
3414
- };
3415
- }
3416
- buildModelInstance() {
3417
- const { fromFirestore, toFirestore } = super.buildModelInstance();
3418
- return {
3419
- toFirestore: (data) => {
3420
- const modifiedData = this.homeToFirestore(data);
3421
- return toFirestore(modifiedData);
3422
- },
3423
- fromFirestore: (snap) => {
3424
- const instance = fromFirestore(snap);
3425
- return this.homeFromFirestore(instance);
3426
- },
3427
- };
3428
3986
  }
3429
- homeToFirestore(home) {
3430
- var _a, _b, _c, _d;
3431
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3432
- home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
3433
- home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
3434
- home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
3435
- }
3436
- return home;
3987
+ }
3988
+
3989
+ class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3990
+ constructor({ firestore, interceptors }, parentRepository) {
3991
+ super({
3992
+ firestore,
3993
+ collectionName: 'editions',
3994
+ parentIdField: 'subscriptionId',
3995
+ model: Edition,
3996
+ interceptors,
3997
+ });
3998
+ this.parentRepository = parentRepository;
3437
3999
  }
3438
- homeFromFirestore(home) {
3439
- var _a;
3440
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3441
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
3442
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
3443
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
3444
- home.data.createdAt =
3445
- home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
3446
- home.data.expiresAt =
3447
- home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
3448
- }
3449
- return home;
4000
+ }
4001
+
4002
+ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4003
+ constructor({ firestore, interceptors, }) {
4004
+ super({
4005
+ firestore,
4006
+ collectionName: 'subscription',
4007
+ model: Subscription,
4008
+ interceptors,
4009
+ });
3450
4010
  }
3451
4011
  }
3452
4012
 
3453
- class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4013
+ class SubscriptionMaterializationFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3454
4014
  constructor({ firestore, interceptors }) {
3455
4015
  super({
3456
4016
  firestore,
3457
- collectionName: 'shopMenus',
3458
- model: ShopMenu,
4017
+ collectionName: 'subscriptionMaterialization',
4018
+ model: SubscriptionMaterialization,
3459
4019
  interceptors,
3460
4020
  });
3461
4021
  }
3462
4022
  }
3463
4023
 
3464
- class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4024
+ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
4025
+ constructor({ firestore, interceptors }, parentRepository) {
4026
+ super({
4027
+ firestore,
4028
+ collectionName: 'payments',
4029
+ parentIdField: 'subscriptionId',
4030
+ model: SubscriptionPayment,
4031
+ interceptors,
4032
+ });
4033
+ this.parentRepository = parentRepository;
4034
+ }
4035
+ }
4036
+
4037
+ class SubscriptionSummaryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3465
4038
  constructor({ firestore, interceptors, }) {
3466
4039
  super({
3467
4040
  firestore,
3468
- collectionName: 'shopSettings',
3469
- model: ShopSettings,
4041
+ collectionName: 'subscriptionSummary',
4042
+ model: SubscriptionSummary,
4043
+ interceptors,
4044
+ });
4045
+ }
4046
+ }
4047
+
4048
+ class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
4049
+ constructor({ firestore, interceptors }, parentRepository) {
4050
+ super({
4051
+ firestore,
4052
+ collectionName: 'address',
4053
+ parentIdField: 'userId',
4054
+ model: UserAddress,
4055
+ interceptors,
4056
+ });
4057
+ this.parentRepository = parentRepository;
4058
+ }
4059
+ }
4060
+
4061
+ class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
4062
+ constructor({ firestore, interceptors }, parentRepository) {
4063
+ super({
4064
+ firestore,
4065
+ collectionName: 'CX',
4066
+ parentIdField: 'userId',
4067
+ model: BeautyProfile,
4068
+ interceptors,
4069
+ });
4070
+ this.parentRepository = parentRepository;
4071
+ }
4072
+ }
4073
+
4074
+ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
4075
+ constructor({ firestore, interceptors }) {
4076
+ super({
4077
+ firestore,
4078
+ collectionName: 'users',
4079
+ model: User,
4080
+ interceptors,
4081
+ });
4082
+ }
4083
+ async get(identifiers) {
4084
+ const user = await super.get({ id: identifiers.id });
4085
+ user.beautyProfile = await this.getBeautyProfile(user.id);
4086
+ user.isSubscriber = await this.checkIfIsSubscriber(user.id);
4087
+ return user;
4088
+ }
4089
+ async checkIfExistsByField(field, value) {
4090
+ const result = await this.find({ filters: { [field]: value } });
4091
+ return result.count > 0;
4092
+ }
4093
+ buildModelInstance() {
4094
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
4095
+ return {
4096
+ toFirestore: (data) => {
4097
+ const plain = toFirestore(data);
4098
+ delete plain.isSubscriber;
4099
+ return plain;
4100
+ },
4101
+ fromFirestore,
4102
+ };
4103
+ }
4104
+ async getBeautyProfile(userId) {
4105
+ const beautyProfile = await getDoc(doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
4106
+ return beautyProfile.data();
4107
+ }
4108
+ async checkIfIsSubscriber(userId) {
4109
+ const docs = await getDocs(query(this.collection('subscription'), where('user.id', '==', userId), where('status', '==', 'active')));
4110
+ return !!docs && !!docs.size;
4111
+ }
4112
+ buildBeautyProfileModelInstance() {
4113
+ return {
4114
+ toFirestore: (data) => data.toPlain(),
4115
+ fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
4116
+ };
4117
+ }
4118
+ }
4119
+
4120
+ class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
4121
+ constructor({ firestore, interceptors }, parentRepository) {
4122
+ super({
4123
+ firestore,
4124
+ collectionName: 'payment_method',
4125
+ parentIdField: 'userId',
4126
+ model: UserPaymentMethod,
3470
4127
  interceptors,
3471
4128
  });
4129
+ this.parentRepository = parentRepository;
3472
4130
  }
3473
4131
  }
3474
4132
 
@@ -3524,14 +4182,11 @@ var HasuraGraphQLWhere;
3524
4182
  HasuraGraphQLWhere["LT"] = "_lt";
3525
4183
  HasuraGraphQLWhere["LTE"] = "_lte";
3526
4184
  HasuraGraphQLWhere["LIKE"] = "_like";
3527
- HasuraGraphQLWhere["ILIKE"] = "_ilike";
3528
4185
  HasuraGraphQLWhere["NOTLIKE"] = "_nlike";
3529
4186
  HasuraGraphQLWhere["ISNULL"] = "_is_null";
3530
4187
  HasuraGraphQLWhere["ISNOTNULL"] = "_is_null";
3531
4188
  HasuraGraphQLWhere["JSON_CONTAINS"] = "_contains";
3532
4189
  HasuraGraphQLWhere["JSON_HAS_KEYS_ANY"] = "_has_keys_any";
3533
- HasuraGraphQLWhere["IREGEX"] = "_iregex";
3534
- HasuraGraphQLWhere["REGEX"] = "_regex";
3535
4190
  })(HasuraGraphQLWhere || (HasuraGraphQLWhere = {}));
3536
4191
 
3537
4192
  var HasuraGraphQLColumnType;
@@ -3562,47 +4217,9 @@ FilterOptionHelper.GetValueFromFilter = (filter, fieldOption) => {
3562
4217
  : (value) => filter.operator === Where.LIKE && !Array.isArray(filter.value) && value.indexOf('%') < 0
3563
4218
  ? `%${value}%`
3564
4219
  : value;
3565
- const converterResult = Array.isArray(filter.value) && !fieldOption.fields && [Where.IN, Where.NOTIN].includes(filter.operator)
4220
+ return Array.isArray(filter.value) && !fieldOption.fields && [Where.IN, Where.NOTIN].includes(filter.operator)
3566
4221
  ? filter.value.map((fieldValue) => converter(fieldValue))
3567
4222
  : converter(filter.value);
3568
- const newValue = filter.ignoreCase && !filter.ignoreAccent && !Array.isArray(filter.value) && converterResult.indexOf('%') < 0
3569
- ? `%${converterResult}%`
3570
- : converterResult;
3571
- return filter.ignoreAccent && !Array.isArray(filter.value)
3572
- ? FilterOptionHelper.buildInsensitiveSentence(newValue)
3573
- : newValue;
3574
- };
3575
- FilterOptionHelper.buildInsensitiveSentence = (value) => {
3576
- const valueWithoutAccents = FilterOptionHelper.removeAccents(value);
3577
- let result = '';
3578
- for (const char of valueWithoutAccents) {
3579
- const allCharOptions = [];
3580
- if (['a', 'e', 'i', 'o', 'u', 'c', 'A', 'E', 'I', 'O', 'U', 'C'].includes(char)) {
3581
- const charOptions = {
3582
- a: ['á', 'â', 'ã', 'à', 'a'],
3583
- e: ['é', 'ê', 'ẽ', 'è', 'e'],
3584
- i: ['í', 'î', 'ĩ', 'ì', 'i'],
3585
- o: ['ó', 'ô', 'õ', 'ò', 'o'],
3586
- u: ['ú', 'û', 'ũ', 'ù', 'u'],
3587
- c: ['ç', 'c'],
3588
- A: ['Á', 'Â', 'Ã', 'À', 'A'],
3589
- E: ['É', 'Ê', 'Ẽ', 'È', 'E'],
3590
- I: ['Í', 'Î', 'Ĩ', 'Ì', 'I'],
3591
- O: ['Ó', 'Ô', 'Õ', 'Ò', 'O'],
3592
- U: ['Ú', 'Û', 'Ũ', 'Ù', 'U'],
3593
- C: ['Ç', 'C'],
3594
- };
3595
- allCharOptions.push(...charOptions[char]);
3596
- result += `[${allCharOptions.join('')}]`;
3597
- }
3598
- else {
3599
- result += char;
3600
- }
3601
- }
3602
- return result;
3603
- };
3604
- FilterOptionHelper.removeAccents = (text) => {
3605
- return text.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
3606
4223
  };
3607
4224
 
3608
4225
  class BindFilterQueryHelper {
@@ -3646,14 +4263,8 @@ BindFilterQueryHelper.BuildOperatorSentence = (options, fieldOption) => ({
3646
4263
  BindFilterQueryHelper.GetHasuraOperator = (options, fieldOption) => FilterOptionHelper.CheckIfIsFilterOption(options)
3647
4264
  ? fieldOption.type === HasuraGraphQLColumnType.Jsonb
3648
4265
  ? BindFilterQueryHelper.GetHasuraJsonbOperator(options)
3649
- : options.operator === Where.LIKE && options.ignoreCase && options.ignoreAccent
3650
- ? HasuraGraphQLWhere.IREGEX
3651
- : options.operator === Where.LIKE && options.ignoreAccent
3652
- ? HasuraGraphQLWhere.REGEX
3653
- : options.operator === Where.LIKE && options.ignoreCase
3654
- ? HasuraGraphQLWhere.ILIKE
3655
- : HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator ===
3656
- Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))]
4266
+ : HasuraGraphQLWhere[Object.keys(HasuraGraphQLWhere).find((graphQLOperator) => graphQLOperator ===
4267
+ Object.keys(Where).find((operator) => Where[operator] === (options === null || options === void 0 ? void 0 : options.operator)))]
3657
4268
  : HasuraGraphQLWhere.EQUALS;
3658
4269
  BindFilterQueryHelper.GetHasuraJsonbOperator = (options) => options.operator === Where.IN
3659
4270
  ? HasuraGraphQLWhere.JSON_CONTAINS
@@ -4387,11 +4998,10 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4387
4998
  {
4388
4999
  products: {
4389
5000
  columnName: 'products',
4390
- fields: ['product_id', 'order'],
4391
- from: (value) => sortBy(value, (row) => row.order).map((product) => product.product_id.toString()),
4392
- to: (productIds) => productIds.map((productId, index) => ({
5001
+ fields: ['product_id'],
5002
+ from: (value) => value.map((product) => product.product_id.toString()),
5003
+ to: (productIds) => productIds.map((productId) => ({
4393
5004
  product_id: +productId,
4394
- order: ++index,
4395
5005
  })),
4396
5006
  },
4397
5007
  },
@@ -4576,28 +5186,6 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4576
5186
  .map((productId) => ({ category_id: categoryId, product_id: productId })),
4577
5187
  },
4578
5188
  });
4579
- const productsOrder = products.map((product, index) => {
4580
- return {
4581
- id: product,
4582
- order: index,
4583
- };
4584
- });
4585
- const updateQueries = productsOrder.map((product) => ({
4586
- where: {
4587
- category_id: { _eq: category.id },
4588
- product_id: { _eq: product.id },
4589
- },
4590
- _set: {
4591
- order: product.order,
4592
- },
4593
- }));
4594
- await this.mutation('update_category_product_many', ['affected_rows'], {
4595
- updates: {
4596
- value: updateQueries,
4597
- type: '[category_product_updates!]',
4598
- required: true,
4599
- },
4600
- });
4601
5189
  return plainData.products;
4602
5190
  }
4603
5191
  async updateMetadata(categoryId, { metadata }) {
@@ -4895,28 +5483,22 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4895
5483
  price,
4896
5484
  fullPrice: data.full_price,
4897
5485
  subscriberDiscountPercentage: data.subscriber_discount_percentage,
4898
- fullPriceDiscountPercentage: data.full_price_discount_percentage,
4899
5486
  subscriberPrice: data.subscriber_price,
4900
5487
  }),
4901
5488
  bindFindFilter: (filters) => {
4902
- 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) && {
5489
+ 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) && {
4903
5490
  subscriber_discount_percentage: filters.subscriberDiscountPercentage,
4904
5491
  })), ((filters.subscriberPrice || filters.subscriberPrice === 0) && {
4905
5492
  subscriber_price: filters.subscriberPrice,
4906
- })), ((filters.fullPriceDiscountPercentage || filters.fullPriceDiscountPercentage === 0) && {
4907
- full_price_discount_percentage: filters.fullPriceDiscountPercentage,
4908
5493
  }));
4909
5494
  },
4910
- 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 && {
5495
+ 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 && {
4911
5496
  subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
4912
- })), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice })), (priceData.fullPriceDiscountPercentage >= 0 && {
4913
- full_price_discount_percentage: priceData.fullPriceDiscountPercentage,
4914
- }))),
5497
+ })), (priceData.subscriberPrice >= 0 && { subscriber_price: priceData.subscriberPrice }))),
4915
5498
  },
4916
5499
  },
4917
5500
  { fullPrice: { columnName: 'full_price' } },
4918
5501
  { subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
4919
- { fullPriceDiscountPercentage: { columnName: 'full_price_discount_percentage' } },
4920
5502
  { subscriberPrice: { columnName: 'subscriber_price' } },
4921
5503
  'published',
4922
5504
  'sku',
@@ -5066,30 +5648,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5066
5648
  product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
5067
5649
  return product;
5068
5650
  }
5069
- async fetchProductReviews() {
5070
- let data = [];
5071
- let count = 0;
5072
- let offset = 0;
5073
- const limit = 500;
5074
- do {
5075
- const result = await super.find(Object.assign({ fields: ['id', 'name', 'sku', 'reviews'] }, ({
5076
- limits: {
5077
- offset,
5078
- limit,
5079
- },
5080
- })));
5081
- data = data.concat(result.data);
5082
- count = result.data.length;
5083
- offset += limit;
5084
- } while (count === limit);
5085
- return data.reduce((reviews, product) => [
5086
- ...reviews,
5087
- ...product.reviews.map((review) => (Object.assign(Object.assign({}, review), { reviewStatus: this.getReviewStatus(review), productId: product.id, productName: product.name, productSku: product.sku }))),
5088
- ], []);
5089
- }
5090
- getReviewStatus(review) {
5091
- return review.status === true ? 'approved' : review.status === false ? 'rejected' : 'pending';
5092
- }
5093
5651
  async fetchReviews(status) {
5094
5652
  const reviewsExpression = {
5095
5653
  status: status === 'pending'
@@ -5664,4 +6222,4 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5664
6222
  }
5665
6223
  }
5666
6224
 
5667
- export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
6225
+ export { AccessoryImportances, Address, AdyenCardService, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BusinessError, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderFirestoreRepository, OrderStatus, PagarmeBankSlipService, PagarmeCardService, PagarmePaymentMethodFactory, PagarmePixService, Payment, PaymentError, PaymentFirestoreRepository, PaymentProviderFactory, PaymentTransaction, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, antifraudProviders, is, isDebuggable, isUUID, parseDateTime, paymentMethods, paymentProviders, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };