@infrab4a/connect 4.1.2-beta.0 → 4.1.2-beta.10

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 (56) hide show
  1. package/index.cjs.js +842 -487
  2. package/index.esm.js +828 -488
  3. package/package.json +2 -1
  4. package/src/domain/general/index.d.ts +2 -0
  5. package/src/domain/general/models/index.d.ts +1 -0
  6. package/src/domain/general/models/sequences.d.ts +9 -0
  7. package/src/domain/general/repositories/index.d.ts +1 -0
  8. package/src/domain/general/repositories/sequences.repository.d.ts +4 -0
  9. package/src/domain/index.d.ts +4 -3
  10. package/src/domain/shop-settings/models/types/index.d.ts +0 -2
  11. package/src/domain/shop-settings/models/types/sections.type.d.ts +0 -3
  12. package/src/domain/shopping/enums/index.d.ts +2 -0
  13. package/src/domain/shopping/enums/payment-methods.enum.d.ts +5 -0
  14. package/src/domain/shopping/enums/payment-providers.enum.d.ts +4 -0
  15. package/src/domain/shopping/factories/adyen-payment-method.factory.d.ts +8 -0
  16. package/src/domain/shopping/factories/base-payment-method.factory.d.ts +7 -0
  17. package/src/domain/shopping/factories/glampoints-payment-method.factory.d.ts +8 -0
  18. package/src/domain/shopping/factories/index.d.ts +4 -0
  19. package/src/domain/shopping/factories/pagarme-payment-method.factory.d.ts +10 -0
  20. package/src/domain/shopping/factories/payment-provider.factory.d.ts +14 -0
  21. package/src/domain/shopping/index.d.ts +2 -0
  22. package/src/domain/shopping/interfaces/index.d.ts +6 -0
  23. package/src/domain/shopping/interfaces/payment-method-factory.interface.d.ts +14 -0
  24. package/src/domain/shopping/interfaces/payment-provider-bank-slip.interface.d.ts +5 -0
  25. package/src/domain/shopping/interfaces/payment-provider-card.interface.d.ts +6 -0
  26. package/src/domain/shopping/interfaces/payment-provider-glampoints.interface.d.ts +5 -0
  27. package/src/domain/shopping/interfaces/payment-provider-pix.interface.d.ts +5 -0
  28. package/src/domain/shopping/interfaces/payment-provider.interface.d.ts +6 -0
  29. package/src/domain/shopping/models/index.d.ts +3 -0
  30. package/src/domain/shopping/models/order-blocked.d.ts +26 -0
  31. package/src/domain/shopping/models/order.d.ts +2 -2
  32. package/src/domain/shopping/models/payment.d.ts +7 -61
  33. package/src/domain/shopping/models/payment.transaction.d.ts +66 -0
  34. package/src/domain/shopping/models/types/index.d.ts +4 -4
  35. package/src/domain/shopping/repositories/index.d.ts +1 -0
  36. package/src/domain/shopping/repositories/order-blocked.repository.d.ts +4 -0
  37. package/src/domain/shopping/services/adyen-card-payment.service.d.ts +28 -0
  38. package/src/domain/shopping/services/antifraude.service.d.ts +19 -0
  39. package/src/domain/shopping/services/glampoints-payment.service.d.ts +4 -0
  40. package/src/domain/shopping/services/index.d.ts +5 -0
  41. package/src/domain/shopping/services/pagarme-bank-slip-payment.service.d.ts +8 -0
  42. package/src/domain/shopping/services/pagarme-card-payment.service.d.ts +10 -0
  43. package/src/domain/shopping/services/pagarme-pix-payment.service.d.ts +8 -0
  44. package/src/domain/shopping/types/adyen-credentials.type.d.ts +6 -0
  45. package/src/domain/shopping/types/index.d.ts +5 -0
  46. package/src/domain/shopping/types/pagarme-credentials.type.d.ts +5 -0
  47. package/src/domain/shopping/types/payment-card-info.type.d.ts +4 -0
  48. package/src/domain/shopping/types/payment-method.type.d.ts +2 -0
  49. package/src/domain/shopping/types/payment-provider.type.d.ts +2 -0
  50. package/src/infra/firebase/firestore/repositories/general/index.d.ts +1 -0
  51. package/src/infra/firebase/firestore/repositories/general/sequences-firestore.repository.d.ts +7 -0
  52. package/src/infra/firebase/firestore/repositories/index.d.ts +3 -2
  53. package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +1 -0
  54. package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +7 -0
  55. package/src/domain/shop-settings/models/types/landing-page.d.ts +0 -8
  56. package/teste2.d.ts +0 -1
package/index.cjs.js CHANGED
@@ -3,13 +3,14 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('reflect-metadata');
6
- var classTransformer = require('class-transformer');
7
6
  var tslib_1 = require('tslib');
7
+ var classTransformer = require('class-transformer');
8
8
  var dateFns = require('date-fns');
9
9
  var lodash = require('lodash');
10
10
  var debug = require('debug');
11
11
  var tsCustomError = require('ts-custom-error');
12
12
  var axios = require('axios');
13
+ var moment = require('moment');
13
14
  var firestore = require('firebase/firestore');
14
15
  var auth = require('firebase/auth');
15
16
  var gqlQueryBuilder = require('gql-query-builder');
@@ -36,6 +37,34 @@ function _interopNamespace(e) {
36
37
 
37
38
  var tslib_1__namespace = /*#__PURE__*/_interopNamespace(tslib_1);
38
39
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
40
+ var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
41
+
42
+ class BasePaymentMethodFactory {
43
+ constructor(methods) {
44
+ this.methods = methods;
45
+ }
46
+ build(method) {
47
+ return this.methods[method];
48
+ }
49
+ }
50
+
51
+ class AdyenPaymentMethodFactory extends BasePaymentMethodFactory {
52
+ }
53
+
54
+ class GlampointsPaymentMethodFactory extends BasePaymentMethodFactory {
55
+ }
56
+
57
+ class PagarmePaymentMethodFactory extends BasePaymentMethodFactory {
58
+ }
59
+
60
+ class PaymentProviderFactory {
61
+ constructor(paymentProviders) {
62
+ this.paymentProviders = paymentProviders;
63
+ }
64
+ build(provider) {
65
+ return this.paymentProviders[provider];
66
+ }
67
+ }
39
68
 
40
69
  class BaseModel {
41
70
  get identifier() {
@@ -60,6 +89,181 @@ class BaseModel {
60
89
  }
61
90
  }
62
91
 
92
+ class Filter extends BaseModel {
93
+ static get identifiersFields() {
94
+ return ['id'];
95
+ }
96
+ }
97
+
98
+ class CategoryBase extends BaseModel {
99
+ static get identifiersFields() {
100
+ return ['id'];
101
+ }
102
+ }
103
+ tslib_1.__decorate([
104
+ classTransformer.Type(() => CategoryBase),
105
+ tslib_1.__metadata("design:type", CategoryBase)
106
+ ], CategoryBase.prototype, "parent", void 0);
107
+ tslib_1.__decorate([
108
+ classTransformer.Type(() => Filter),
109
+ tslib_1.__metadata("design:type", Array)
110
+ ], CategoryBase.prototype, "filters", void 0);
111
+
112
+ class CategoryForProduct extends CategoryBase {
113
+ static get identifiersFields() {
114
+ return ['id'];
115
+ }
116
+ }
117
+
118
+ class ProductBase extends BaseModel {
119
+ get evaluation() {
120
+ return {
121
+ reviews: this.reviews,
122
+ count: this.reviewsTotal,
123
+ rating: this.rate,
124
+ };
125
+ }
126
+ set evaluation(evaluation) {
127
+ if (!evaluation) {
128
+ this.reviews = null;
129
+ this.reviewsTotal = null;
130
+ this.rate = null;
131
+ return;
132
+ }
133
+ this.reviews = evaluation.reviews || this.reviews;
134
+ this.reviewsTotal = evaluation.count || this.reviewsTotal;
135
+ this.rate = evaluation.rating || this.rate;
136
+ }
137
+ static get identifiersFields() {
138
+ return ['id'];
139
+ }
140
+ }
141
+
142
+ class ProductForKit extends ProductBase {
143
+ static get identifiersFields() {
144
+ return ['id'];
145
+ }
146
+ }
147
+ tslib_1.__decorate([
148
+ classTransformer.Type(() => CategoryForProduct),
149
+ tslib_1.__metadata("design:type", CategoryForProduct)
150
+ ], ProductForKit.prototype, "category", void 0);
151
+
152
+ class KitProduct extends BaseModel {
153
+ static get identifiersFields() {
154
+ return ['productId', 'kitProductId'];
155
+ }
156
+ }
157
+ tslib_1.__decorate([
158
+ classTransformer.Type(() => ProductForKit),
159
+ tslib_1.__metadata("design:type", ProductForKit)
160
+ ], KitProduct.prototype, "kit", void 0);
161
+ tslib_1.__decorate([
162
+ classTransformer.Type(() => ProductForKit),
163
+ tslib_1.__metadata("design:type", ProductForKit)
164
+ ], KitProduct.prototype, "product", void 0);
165
+
166
+ class ProductForCategory extends ProductBase {
167
+ static get identifiersFields() {
168
+ return ['id'];
169
+ }
170
+ }
171
+ tslib_1.__decorate([
172
+ classTransformer.Type(() => KitProduct),
173
+ tslib_1.__metadata("design:type", Array)
174
+ ], ProductForCategory.prototype, "kitProducts", void 0);
175
+
176
+ class Category extends CategoryBase {
177
+ static get identifiersFields() {
178
+ return ['id'];
179
+ }
180
+ }
181
+ tslib_1.__decorate([
182
+ classTransformer.Type(() => ProductForCategory),
183
+ tslib_1.__metadata("design:type", Array)
184
+ ], Category.prototype, "childrenProducts", void 0);
185
+
186
+ class CategoryCollectionChildren extends BaseModel {
187
+ static get identifiersFields() {
188
+ return ['collectionId', 'categoryId'];
189
+ }
190
+ }
191
+ tslib_1.__decorate([
192
+ classTransformer.Type(() => CategoryCollectionChildren),
193
+ tslib_1.__metadata("design:type", CategoryCollectionChildren)
194
+ ], CategoryCollectionChildren.prototype, "parent", void 0);
195
+
196
+ class CategoryFilter extends BaseModel {
197
+ static get identifiersFields() {
198
+ return ['id'];
199
+ }
200
+ }
201
+ tslib_1.__decorate([
202
+ classTransformer.Type(() => Filter),
203
+ tslib_1.__metadata("design:type", Filter)
204
+ ], CategoryFilter.prototype, "filter", void 0);
205
+ tslib_1.__decorate([
206
+ classTransformer.Type(() => Category),
207
+ tslib_1.__metadata("design:type", Category)
208
+ ], CategoryFilter.prototype, "category", void 0);
209
+
210
+ exports.GenderDestination = void 0;
211
+ (function (GenderDestination) {
212
+ GenderDestination["FEMALE"] = "female";
213
+ GenderDestination["MALE"] = "male";
214
+ GenderDestination["UNISEX"] = "unisex";
215
+ })(exports.GenderDestination || (exports.GenderDestination = {}));
216
+
217
+ exports.Shops = void 0;
218
+ (function (Shops) {
219
+ Shops["MENSMARKET"] = "mensmarket";
220
+ Shops["GLAMSHOP"] = "Glamshop";
221
+ Shops["GLAMPOINTS"] = "Glampoints";
222
+ Shops["ALL"] = "ALL";
223
+ })(exports.Shops || (exports.Shops = {}));
224
+
225
+ class FilterOption extends BaseModel {
226
+ static get identifiersFields() {
227
+ return ['id'];
228
+ }
229
+ }
230
+
231
+ class Product extends ProductBase {
232
+ static get identifiersFields() {
233
+ return ['id'];
234
+ }
235
+ }
236
+ tslib_1.__decorate([
237
+ classTransformer.Type(() => CategoryForProduct),
238
+ tslib_1.__metadata("design:type", CategoryForProduct)
239
+ ], Product.prototype, "category", void 0);
240
+ tslib_1.__decorate([
241
+ classTransformer.Type(() => KitProduct),
242
+ tslib_1.__metadata("design:type", Array)
243
+ ], Product.prototype, "kitProducts", void 0);
244
+
245
+ class Variant extends BaseModel {
246
+ static get identifiersFields() {
247
+ return ['id', 'productId'];
248
+ }
249
+ }
250
+
251
+ class Wishlist extends Category {
252
+ static get identifiersFields() {
253
+ return ['id'];
254
+ }
255
+ }
256
+
257
+ class Buy2Win extends BaseModel {
258
+ static get identifiersFields() {
259
+ return ['id'];
260
+ }
261
+ }
262
+ tslib_1.__decorate([
263
+ classTransformer.Type(() => Category),
264
+ tslib_1.__metadata("design:type", Array)
265
+ ], Buy2Win.prototype, "categories", void 0);
266
+
63
267
  exports.Where = void 0;
64
268
  (function (Where) {
65
269
  Where["EQUALS"] = "==";
@@ -85,6 +289,18 @@ exports.UpdateOptionActions = void 0;
85
289
  UpdateOptionActions["NULL"] = "null";
86
290
  })(exports.UpdateOptionActions || (exports.UpdateOptionActions = {}));
87
291
 
292
+ class CampaignDashboard extends BaseModel {
293
+ static get identifiersFields() {
294
+ return ['id'];
295
+ }
296
+ }
297
+
298
+ class CampaignHashtag extends BaseModel {
299
+ static get identifiersFields() {
300
+ return ['id'];
301
+ }
302
+ }
303
+
88
304
  exports.AccessoryImportances = void 0;
89
305
  (function (AccessoryImportances) {
90
306
  AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
@@ -311,171 +527,178 @@ class Edition extends BaseModel {
311
527
  }
312
528
  }
313
529
 
314
- class Payment extends BaseModel {
315
- static get identifiersFields() {
316
- return ['id'];
317
- }
530
+ class PaymentTransaction extends BaseModel {
318
531
  }
319
532
  tslib_1.__decorate([
320
533
  classTransformer.Expose({ name: 'refuse_reason' }),
321
534
  tslib_1.__metadata("design:type", String)
322
- ], Payment.prototype, "refuseReason", void 0);
535
+ ], PaymentTransaction.prototype, "refuseReason", void 0);
323
536
  tslib_1.__decorate([
324
537
  classTransformer.Expose({ name: 'status_reason' }),
325
538
  tslib_1.__metadata("design:type", String)
326
- ], Payment.prototype, "statusReason", void 0);
539
+ ], PaymentTransaction.prototype, "statusReason", void 0);
327
540
  tslib_1.__decorate([
328
541
  classTransformer.Expose({ name: 'acquirer_response_code' }),
329
542
  tslib_1.__metadata("design:type", String)
330
- ], Payment.prototype, "acquirerResponseCode", void 0);
543
+ ], PaymentTransaction.prototype, "acquirerResponseCode", void 0);
331
544
  tslib_1.__decorate([
332
545
  classTransformer.Expose({ name: 'acquirer_name' }),
333
546
  tslib_1.__metadata("design:type", String)
334
- ], Payment.prototype, "acquirerName", void 0);
547
+ ], PaymentTransaction.prototype, "acquirerName", void 0);
335
548
  tslib_1.__decorate([
336
549
  classTransformer.Expose({ name: 'acquirer_id' }),
337
550
  tslib_1.__metadata("design:type", String)
338
- ], Payment.prototype, "acquirerId", void 0);
551
+ ], PaymentTransaction.prototype, "acquirerId", void 0);
339
552
  tslib_1.__decorate([
340
553
  classTransformer.Expose({ name: 'authorization_code' }),
341
554
  tslib_1.__metadata("design:type", String)
342
- ], Payment.prototype, "authorizationCode", void 0);
555
+ ], PaymentTransaction.prototype, "authorizationCode", void 0);
343
556
  tslib_1.__decorate([
344
557
  classTransformer.Expose({ name: 'soft_descriptor' }),
345
558
  tslib_1.__metadata("design:type", String)
346
- ], Payment.prototype, "softDescriptor", void 0);
559
+ ], PaymentTransaction.prototype, "softDescriptor", void 0);
347
560
  tslib_1.__decorate([
348
561
  classTransformer.Expose({ name: 'date_created' }),
349
562
  tslib_1.__metadata("design:type", String)
350
- ], Payment.prototype, "dateCreated", void 0);
563
+ ], PaymentTransaction.prototype, "dateCreated", void 0);
351
564
  tslib_1.__decorate([
352
565
  classTransformer.Expose({ name: 'date_updated' }),
353
566
  tslib_1.__metadata("design:type", String)
354
- ], Payment.prototype, "dateUpdated", void 0);
567
+ ], PaymentTransaction.prototype, "dateUpdated", void 0);
355
568
  tslib_1.__decorate([
356
569
  classTransformer.Expose({ name: 'authorized_amount' }),
357
570
  tslib_1.__metadata("design:type", Number)
358
- ], Payment.prototype, "authorizedAmount", void 0);
571
+ ], PaymentTransaction.prototype, "authorizedAmount", void 0);
359
572
  tslib_1.__decorate([
360
573
  classTransformer.Expose({ name: 'paid_amount' }),
361
574
  tslib_1.__metadata("design:type", Number)
362
- ], Payment.prototype, "paidAmount", void 0);
575
+ ], PaymentTransaction.prototype, "paidAmount", void 0);
363
576
  tslib_1.__decorate([
364
577
  classTransformer.Expose({ name: 'refunded_amount' }),
365
578
  tslib_1.__metadata("design:type", Number)
366
- ], Payment.prototype, "refundedAmount", void 0);
579
+ ], PaymentTransaction.prototype, "refundedAmount", void 0);
367
580
  tslib_1.__decorate([
368
581
  classTransformer.Expose({ name: 'card_holder_name' }),
369
582
  tslib_1.__metadata("design:type", String)
370
- ], Payment.prototype, "cardHolderName", void 0);
583
+ ], PaymentTransaction.prototype, "cardHolderName", void 0);
371
584
  tslib_1.__decorate([
372
585
  classTransformer.Expose({ name: 'card_last_digits' }),
373
586
  tslib_1.__metadata("design:type", String)
374
- ], Payment.prototype, "cardLastDigits", void 0);
587
+ ], PaymentTransaction.prototype, "cardLastDigits", void 0);
375
588
  tslib_1.__decorate([
376
589
  classTransformer.Expose({ name: 'card_first_digits' }),
377
590
  tslib_1.__metadata("design:type", String)
378
- ], Payment.prototype, "cardFirstDigits", void 0);
591
+ ], PaymentTransaction.prototype, "cardFirstDigits", void 0);
379
592
  tslib_1.__decorate([
380
593
  classTransformer.Expose({ name: 'card_brand' }),
381
594
  tslib_1.__metadata("design:type", String)
382
- ], Payment.prototype, "cardBrand", void 0);
595
+ ], PaymentTransaction.prototype, "cardBrand", void 0);
383
596
  tslib_1.__decorate([
384
597
  classTransformer.Expose({ name: 'card_pin_mode' }),
385
598
  tslib_1.__metadata("design:type", String)
386
- ], Payment.prototype, "cardPinMode", void 0);
599
+ ], PaymentTransaction.prototype, "cardPinMode", void 0);
387
600
  tslib_1.__decorate([
388
601
  classTransformer.Expose({ name: 'card_magstripe_fallback' }),
389
602
  tslib_1.__metadata("design:type", Boolean)
390
- ], Payment.prototype, "cardMagstripeFallback", void 0);
603
+ ], PaymentTransaction.prototype, "cardMagstripeFallback", void 0);
391
604
  tslib_1.__decorate([
392
605
  classTransformer.Expose({ name: 'cvm_pin' }),
393
606
  tslib_1.__metadata("design:type", Boolean)
394
- ], Payment.prototype, "cvmPin", void 0);
607
+ ], PaymentTransaction.prototype, "cvmPin", void 0);
395
608
  tslib_1.__decorate([
396
609
  classTransformer.Expose({ name: 'postback_url' }),
397
610
  tslib_1.__metadata("design:type", String)
398
- ], Payment.prototype, "postbackUrl", void 0);
611
+ ], PaymentTransaction.prototype, "postbackUrl", void 0);
399
612
  tslib_1.__decorate([
400
613
  classTransformer.Expose({ name: 'payment_method' }),
401
614
  tslib_1.__metadata("design:type", String)
402
- ], Payment.prototype, "paymentMethod", void 0);
615
+ ], PaymentTransaction.prototype, "paymentMethod", void 0);
403
616
  tslib_1.__decorate([
404
617
  classTransformer.Expose({ name: 'capture_method' }),
405
618
  tslib_1.__metadata("design:type", String)
406
- ], Payment.prototype, "captureMethod", void 0);
619
+ ], PaymentTransaction.prototype, "captureMethod", void 0);
407
620
  tslib_1.__decorate([
408
621
  classTransformer.Expose({ name: 'antifraud_score' }),
409
622
  tslib_1.__metadata("design:type", String)
410
- ], Payment.prototype, "antifraudScore", void 0);
623
+ ], PaymentTransaction.prototype, "antifraudScore", void 0);
411
624
  tslib_1.__decorate([
412
625
  classTransformer.Expose({ name: 'boleto_url' }),
413
626
  tslib_1.__metadata("design:type", String)
414
- ], Payment.prototype, "boletoUrl", void 0);
627
+ ], PaymentTransaction.prototype, "boletoUrl", void 0);
415
628
  tslib_1.__decorate([
416
629
  classTransformer.Expose({ name: 'boleto_barcode' }),
417
630
  tslib_1.__metadata("design:type", String)
418
- ], Payment.prototype, "boletoBarcode", void 0);
631
+ ], PaymentTransaction.prototype, "boletoBarcode", void 0);
419
632
  tslib_1.__decorate([
420
633
  classTransformer.Expose({ name: 'boleto_expiration_date' }),
421
634
  tslib_1.__metadata("design:type", String)
422
- ], Payment.prototype, "boletoExpirationDate", void 0);
635
+ ], PaymentTransaction.prototype, "boletoExpirationDate", void 0);
423
636
  tslib_1.__decorate([
424
637
  classTransformer.Expose({ name: 'subscription_id' }),
425
638
  tslib_1.__metadata("design:type", String)
426
- ], Payment.prototype, "subscriptionId", void 0);
639
+ ], PaymentTransaction.prototype, "subscriptionId", void 0);
427
640
  tslib_1.__decorate([
428
641
  classTransformer.Expose({ name: 'split_rules' }),
429
642
  tslib_1.__metadata("design:type", String)
430
- ], Payment.prototype, "splitRules", void 0);
643
+ ], PaymentTransaction.prototype, "splitRules", void 0);
431
644
  tslib_1.__decorate([
432
645
  classTransformer.Expose({ name: 'antifraud_metadata' }),
433
646
  tslib_1.__metadata("design:type", Object)
434
- ], Payment.prototype, "antifraudMetadata", void 0);
647
+ ], PaymentTransaction.prototype, "antifraudMetadata", void 0);
435
648
  tslib_1.__decorate([
436
649
  classTransformer.Expose({ name: 'reference_key' }),
437
650
  tslib_1.__metadata("design:type", String)
438
- ], Payment.prototype, "referenceKey", void 0);
651
+ ], PaymentTransaction.prototype, "referenceKey", void 0);
439
652
  tslib_1.__decorate([
440
653
  classTransformer.Expose({ name: 'local_transaction_id' }),
441
654
  tslib_1.__metadata("design:type", String)
442
- ], Payment.prototype, "localTransactionId", void 0);
655
+ ], PaymentTransaction.prototype, "localTransactionId", void 0);
443
656
  tslib_1.__decorate([
444
657
  classTransformer.Expose({ name: 'local_time' }),
445
658
  tslib_1.__metadata("design:type", String)
446
- ], Payment.prototype, "localTime", void 0);
659
+ ], PaymentTransaction.prototype, "localTime", void 0);
447
660
  tslib_1.__decorate([
448
661
  classTransformer.Expose({ name: 'fraud_covered' }),
449
662
  tslib_1.__metadata("design:type", Boolean)
450
- ], Payment.prototype, "fraudCovered", void 0);
663
+ ], PaymentTransaction.prototype, "fraudCovered", void 0);
451
664
  tslib_1.__decorate([
452
665
  classTransformer.Expose({ name: 'fraud_reimbursed' }),
453
666
  tslib_1.__metadata("design:type", String)
454
- ], Payment.prototype, "fraudReimbursed", void 0);
667
+ ], PaymentTransaction.prototype, "fraudReimbursed", void 0);
455
668
  tslib_1.__decorate([
456
669
  classTransformer.Expose({ name: 'order_id' }),
457
670
  tslib_1.__metadata("design:type", String)
458
- ], Payment.prototype, "orderId", void 0);
671
+ ], PaymentTransaction.prototype, "orderId", void 0);
459
672
  tslib_1.__decorate([
460
673
  classTransformer.Expose({ name: 'risk_level' }),
461
674
  tslib_1.__metadata("design:type", String)
462
- ], Payment.prototype, "riskLevel", void 0);
675
+ ], PaymentTransaction.prototype, "riskLevel", void 0);
463
676
  tslib_1.__decorate([
464
677
  classTransformer.Expose({ name: 'receipt_url' }),
465
678
  tslib_1.__metadata("design:type", String)
466
- ], Payment.prototype, "receiptUrl", void 0);
679
+ ], PaymentTransaction.prototype, "receiptUrl", void 0);
467
680
  tslib_1.__decorate([
468
681
  classTransformer.Expose({ name: 'private_label' }),
469
682
  tslib_1.__metadata("design:type", String)
470
- ], Payment.prototype, "privateLabel", void 0);
683
+ ], PaymentTransaction.prototype, "privateLabel", void 0);
471
684
  tslib_1.__decorate([
472
685
  classTransformer.Expose({ name: 'pix_qr_code' }),
473
686
  tslib_1.__metadata("design:type", String)
474
- ], Payment.prototype, "pixQrCode", void 0);
687
+ ], PaymentTransaction.prototype, "pixQrCode", void 0);
475
688
  tslib_1.__decorate([
476
689
  classTransformer.Expose({ name: 'pix_expiration_date' }),
477
690
  tslib_1.__metadata("design:type", String)
478
- ], Payment.prototype, "pixExpirationDate", void 0);
691
+ ], PaymentTransaction.prototype, "pixExpirationDate", void 0);
692
+
693
+ class Payment extends BaseModel {
694
+ static get identifiersFields() {
695
+ return ['id'];
696
+ }
697
+ }
698
+ tslib_1.__decorate([
699
+ classTransformer.Type(() => PaymentTransaction),
700
+ tslib_1.__metadata("design:type", PaymentTransaction)
701
+ ], Payment.prototype, "transaction", void 0);
479
702
 
480
703
  class SubscriptionPayment extends BaseModel {
481
704
  static get identifiersFields() {
@@ -1987,231 +2210,44 @@ class RecoveryPassword {
1987
2210
  }
1988
2211
  }
1989
2212
 
1990
- class Filter extends BaseModel {
2213
+ class LineItem extends Product {
2214
+ }
2215
+
2216
+ class ShippingMethod extends BaseModel {
1991
2217
  static get identifiersFields() {
1992
2218
  return ['id'];
1993
2219
  }
1994
2220
  }
1995
2221
 
1996
- class CategoryBase extends BaseModel {
2222
+ class Checkout extends BaseModel {
1997
2223
  static get identifiersFields() {
1998
2224
  return ['id'];
1999
2225
  }
2000
2226
  }
2001
2227
  tslib_1.__decorate([
2002
- classTransformer.Type(() => CategoryBase),
2003
- tslib_1.__metadata("design:type", CategoryBase)
2004
- ], CategoryBase.prototype, "parent", void 0);
2005
- tslib_1.__decorate([
2006
- classTransformer.Type(() => Filter),
2228
+ classTransformer.Type(() => LineItem),
2007
2229
  tslib_1.__metadata("design:type", Array)
2008
- ], CategoryBase.prototype, "filters", void 0);
2009
-
2010
- class CategoryForProduct extends CategoryBase {
2011
- static get identifiersFields() {
2012
- return ['id'];
2013
- }
2014
- }
2015
-
2016
- class ProductBase extends BaseModel {
2017
- get evaluation() {
2018
- return {
2019
- reviews: this.reviews,
2020
- count: this.reviewsTotal,
2021
- rating: this.rate,
2022
- };
2023
- }
2024
- set evaluation(evaluation) {
2025
- if (!evaluation) {
2026
- this.reviews = null;
2027
- this.reviewsTotal = null;
2028
- this.rate = null;
2029
- return;
2030
- }
2031
- this.reviews = evaluation.reviews || this.reviews;
2032
- this.reviewsTotal = evaluation.count || this.reviewsTotal;
2033
- this.rate = evaluation.rating || this.rate;
2034
- }
2035
- static get identifiersFields() {
2036
- return ['id'];
2037
- }
2038
- }
2039
-
2040
- class ProductForKit extends ProductBase {
2041
- static get identifiersFields() {
2042
- return ['id'];
2043
- }
2044
- }
2045
- tslib_1.__decorate([
2046
- classTransformer.Type(() => CategoryForProduct),
2047
- tslib_1.__metadata("design:type", CategoryForProduct)
2048
- ], ProductForKit.prototype, "category", void 0);
2049
-
2050
- class KitProduct extends BaseModel {
2051
- static get identifiersFields() {
2052
- return ['productId', 'kitProductId'];
2053
- }
2054
- }
2055
- tslib_1.__decorate([
2056
- classTransformer.Type(() => ProductForKit),
2057
- tslib_1.__metadata("design:type", ProductForKit)
2058
- ], KitProduct.prototype, "kit", void 0);
2059
- tslib_1.__decorate([
2060
- classTransformer.Type(() => ProductForKit),
2061
- tslib_1.__metadata("design:type", ProductForKit)
2062
- ], KitProduct.prototype, "product", void 0);
2063
-
2064
- class ProductForCategory extends ProductBase {
2065
- static get identifiersFields() {
2066
- return ['id'];
2067
- }
2068
- }
2069
- tslib_1.__decorate([
2070
- classTransformer.Type(() => KitProduct),
2071
- tslib_1.__metadata("design:type", Array)
2072
- ], ProductForCategory.prototype, "kitProducts", void 0);
2073
-
2074
- class Category extends CategoryBase {
2075
- static get identifiersFields() {
2076
- return ['id'];
2077
- }
2078
- }
2079
- tslib_1.__decorate([
2080
- classTransformer.Type(() => ProductForCategory),
2081
- tslib_1.__metadata("design:type", Array)
2082
- ], Category.prototype, "childrenProducts", void 0);
2083
-
2084
- class CategoryCollectionChildren extends BaseModel {
2085
- static get identifiersFields() {
2086
- return ['collectionId', 'categoryId'];
2087
- }
2088
- }
2089
- tslib_1.__decorate([
2090
- classTransformer.Type(() => CategoryCollectionChildren),
2091
- tslib_1.__metadata("design:type", CategoryCollectionChildren)
2092
- ], CategoryCollectionChildren.prototype, "parent", void 0);
2093
-
2094
- class CategoryFilter extends BaseModel {
2095
- static get identifiersFields() {
2096
- return ['id'];
2097
- }
2098
- }
2099
- tslib_1.__decorate([
2100
- classTransformer.Type(() => Filter),
2101
- tslib_1.__metadata("design:type", Filter)
2102
- ], CategoryFilter.prototype, "filter", void 0);
2103
- tslib_1.__decorate([
2104
- classTransformer.Type(() => Category),
2105
- tslib_1.__metadata("design:type", Category)
2106
- ], CategoryFilter.prototype, "category", void 0);
2107
-
2108
- exports.GenderDestination = void 0;
2109
- (function (GenderDestination) {
2110
- GenderDestination["FEMALE"] = "female";
2111
- GenderDestination["MALE"] = "male";
2112
- GenderDestination["UNISEX"] = "unisex";
2113
- })(exports.GenderDestination || (exports.GenderDestination = {}));
2114
-
2115
- exports.Shops = void 0;
2116
- (function (Shops) {
2117
- Shops["MENSMARKET"] = "mensmarket";
2118
- Shops["GLAMSHOP"] = "Glamshop";
2119
- Shops["GLAMPOINTS"] = "Glampoints";
2120
- Shops["ALL"] = "ALL";
2121
- })(exports.Shops || (exports.Shops = {}));
2122
-
2123
- class FilterOption extends BaseModel {
2124
- static get identifiersFields() {
2125
- return ['id'];
2126
- }
2127
- }
2128
-
2129
- class Product extends ProductBase {
2130
- static get identifiersFields() {
2131
- return ['id'];
2132
- }
2133
- }
2134
- tslib_1.__decorate([
2135
- classTransformer.Type(() => CategoryForProduct),
2136
- tslib_1.__metadata("design:type", CategoryForProduct)
2137
- ], Product.prototype, "category", void 0);
2138
- tslib_1.__decorate([
2139
- classTransformer.Type(() => KitProduct),
2140
- tslib_1.__metadata("design:type", Array)
2141
- ], Product.prototype, "kitProducts", void 0);
2142
-
2143
- class Variant extends BaseModel {
2144
- static get identifiersFields() {
2145
- return ['id', 'productId'];
2146
- }
2147
- }
2148
-
2149
- class Wishlist extends Category {
2150
- static get identifiersFields() {
2151
- return ['id'];
2152
- }
2153
- }
2154
-
2155
- class Buy2Win extends BaseModel {
2156
- static get identifiersFields() {
2157
- return ['id'];
2158
- }
2159
- }
2160
- tslib_1.__decorate([
2161
- classTransformer.Type(() => Category),
2162
- tslib_1.__metadata("design:type", Array)
2163
- ], Buy2Win.prototype, "categories", void 0);
2164
-
2165
- class CampaignDashboard extends BaseModel {
2166
- static get identifiersFields() {
2167
- return ['id'];
2168
- }
2169
- }
2170
-
2171
- class CampaignHashtag extends BaseModel {
2172
- static get identifiersFields() {
2173
- return ['id'];
2174
- }
2175
- }
2176
-
2177
- class LineItem extends Product {
2178
- }
2179
-
2180
- class ShippingMethod extends BaseModel {
2181
- static get identifiersFields() {
2182
- return ['id'];
2183
- }
2184
- }
2185
-
2186
- class Checkout extends BaseModel {
2187
- static get identifiersFields() {
2188
- return ['id'];
2189
- }
2190
- }
2191
- tslib_1.__decorate([
2192
- classTransformer.Type(() => LineItem),
2193
- tslib_1.__metadata("design:type", Array)
2194
- ], Checkout.prototype, "lineItems", void 0);
2195
- tslib_1.__decorate([
2196
- classTransformer.Type(() => User),
2197
- tslib_1.__metadata("design:type", User)
2198
- ], Checkout.prototype, "user", void 0);
2199
- tslib_1.__decorate([
2200
- classTransformer.Type(() => UserAddress),
2201
- tslib_1.__metadata("design:type", UserAddress)
2202
- ], Checkout.prototype, "shippingAddress", void 0);
2203
- tslib_1.__decorate([
2204
- classTransformer.Type(() => UserAddress),
2205
- tslib_1.__metadata("design:type", UserAddress)
2206
- ], Checkout.prototype, "billingAddress", void 0);
2207
- tslib_1.__decorate([
2208
- classTransformer.Type(() => ShippingMethod),
2209
- tslib_1.__metadata("design:type", ShippingMethod)
2210
- ], Checkout.prototype, "shipping", void 0);
2211
- tslib_1.__decorate([
2212
- classTransformer.Type(() => Coupon),
2213
- tslib_1.__metadata("design:type", Coupon)
2214
- ], Checkout.prototype, "coupon", void 0);
2230
+ ], Checkout.prototype, "lineItems", void 0);
2231
+ tslib_1.__decorate([
2232
+ classTransformer.Type(() => User),
2233
+ tslib_1.__metadata("design:type", User)
2234
+ ], Checkout.prototype, "user", void 0);
2235
+ tslib_1.__decorate([
2236
+ classTransformer.Type(() => UserAddress),
2237
+ tslib_1.__metadata("design:type", UserAddress)
2238
+ ], Checkout.prototype, "shippingAddress", void 0);
2239
+ tslib_1.__decorate([
2240
+ classTransformer.Type(() => UserAddress),
2241
+ tslib_1.__metadata("design:type", UserAddress)
2242
+ ], Checkout.prototype, "billingAddress", void 0);
2243
+ tslib_1.__decorate([
2244
+ classTransformer.Type(() => ShippingMethod),
2245
+ tslib_1.__metadata("design:type", ShippingMethod)
2246
+ ], Checkout.prototype, "shipping", void 0);
2247
+ tslib_1.__decorate([
2248
+ classTransformer.Type(() => Coupon),
2249
+ tslib_1.__metadata("design:type", Coupon)
2250
+ ], Checkout.prototype, "coupon", void 0);
2215
2251
 
2216
2252
  exports.OrderStatus = void 0;
2217
2253
  (function (OrderStatus) {
@@ -2228,10 +2264,16 @@ exports.OrderStatus = void 0;
2228
2264
  class Order extends Checkout {
2229
2265
  }
2230
2266
  tslib_1.__decorate([
2231
- classTransformer.Type(() => Payment),
2232
- tslib_1.__metadata("design:type", Payment)
2267
+ classTransformer.Type(() => PaymentTransaction),
2268
+ tslib_1.__metadata("design:type", PaymentTransaction)
2233
2269
  ], Order.prototype, "payment", void 0);
2234
2270
 
2271
+ class OrderBlocked extends BaseModel {
2272
+ static get identifiersFields() {
2273
+ return ['id'];
2274
+ }
2275
+ }
2276
+
2235
2277
  class CheckoutSubscription extends BaseModel {
2236
2278
  static get identifiersFields() {
2237
2279
  return ['id'];
@@ -2254,6 +2296,277 @@ tslib_1.__decorate([
2254
2296
  tslib_1.__metadata("design:type", Coupon)
2255
2297
  ], CheckoutSubscription.prototype, "coupon", void 0);
2256
2298
 
2299
+ class AdyenCardService {
2300
+ constructor(credentials) {
2301
+ this.credentials = credentials;
2302
+ }
2303
+ async pay(checkout, card) {
2304
+ try {
2305
+ const result = await axios__default["default"]({
2306
+ method: 'POST',
2307
+ url: this.credentials.URL_TRANSACTION,
2308
+ headers: {
2309
+ 'x-api-key': this.credentials.API_KEY,
2310
+ 'content-type': 'application/json',
2311
+ },
2312
+ data: this.createCardPayment(checkout, card),
2313
+ });
2314
+ if (result.data.resultCode !== 'Authorised') {
2315
+ this.checkoutAntiFraudService.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
2316
+ return Promise.reject(new Error(`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`));
2317
+ }
2318
+ const payment = {
2319
+ createdAt: new Date(),
2320
+ updatedAt: new Date(),
2321
+ userId: checkout.user.id,
2322
+ checkoutId: checkout.id,
2323
+ totalPrice: checkout.totalPrice,
2324
+ transaction: Object.assign(Object.assign({}, result.data), { status: 'paid' }),
2325
+ };
2326
+ return payment;
2327
+ }
2328
+ catch (error) { }
2329
+ }
2330
+ createCardPayment(checkout, card) {
2331
+ return {
2332
+ amount: {
2333
+ currency: 'BRL',
2334
+ value: ((checkout === null || checkout === void 0 ? void 0 : checkout.totalPrice) || 0) * 100,
2335
+ },
2336
+ paymentMethod: {
2337
+ type: 'scheme',
2338
+ storedPaymentMethodId: card.cardId,
2339
+ },
2340
+ reference: checkout.id,
2341
+ shopperInteraction: 'Ecommerce',
2342
+ merchantAccount: this.credentials.MERCHANT_ACCOUNT,
2343
+ shopperReference: checkout.user.id,
2344
+ recurringProcessingModel: 'CardOnFile',
2345
+ returnUrl: this.credentials.URL_POSTBACK,
2346
+ installments: {
2347
+ value: card.installments,
2348
+ },
2349
+ };
2350
+ }
2351
+ addCard() {
2352
+ throw new Error('Method not implemented.');
2353
+ }
2354
+ }
2355
+
2356
+ class GlampointsPaymentService {
2357
+ pay(checkout) {
2358
+ const payment = {
2359
+ createdAt: new Date(),
2360
+ updatedAt: new Date(),
2361
+ userId: checkout.user.id,
2362
+ checkoutId: checkout.id,
2363
+ totalPrice: checkout.totalPrice,
2364
+ transaction: {
2365
+ amount: 0,
2366
+ acquirerResponseCode: '0000',
2367
+ acquirerName: 'glampoints',
2368
+ authorizedAmount: 0,
2369
+ captureMethod: 'ecommerce',
2370
+ installments: 1,
2371
+ cost: 0,
2372
+ paidAmount: 0,
2373
+ paymentMethod: 'glampoints',
2374
+ referer: 'api_key',
2375
+ refundedAmount: 0,
2376
+ status: 'paid',
2377
+ statusReason: 'acquirer',
2378
+ },
2379
+ };
2380
+ return Promise.resolve(payment);
2381
+ }
2382
+ }
2383
+
2384
+ class PagarmeBankSlipService {
2385
+ constructor(credentials) {
2386
+ this.credentials = credentials;
2387
+ }
2388
+ async pay(checkout) {
2389
+ try {
2390
+ const result = await axios__default["default"]({
2391
+ method: 'POST',
2392
+ url: this.credentials.URL_TRANSACTION,
2393
+ data: this.createBoletoPayment(checkout),
2394
+ });
2395
+ if (result.data.status !== 'processing') {
2396
+ console.log('Erro ao gerar o boleto para o checkout: ');
2397
+ return Promise.reject(new Error(`Erro ao gerar o boleto para o checkout: ${checkout.id}`));
2398
+ }
2399
+ const payment = {
2400
+ createdAt: new Date(),
2401
+ updatedAt: new Date(),
2402
+ userId: checkout.user.id,
2403
+ checkoutId: checkout.id,
2404
+ totalPrice: checkout.totalPrice,
2405
+ transaction: result.data,
2406
+ };
2407
+ return payment;
2408
+ }
2409
+ catch (error) {
2410
+ console.log(error);
2411
+ }
2412
+ }
2413
+ createBoletoPayment(checkout) {
2414
+ return {
2415
+ api_key: this.credentials.API_KEY,
2416
+ amount: Math.floor(checkout.totalPrice * 100),
2417
+ boleto_rules: ['strict_expiration_date'],
2418
+ boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
2419
+ boleto_expiration_date: moment__namespace().add(3, 'day').format('YYYY-MM-DD'),
2420
+ payment_method: 'boleto',
2421
+ postback_url: this.credentials.URL_POSTBACK,
2422
+ customer: {
2423
+ external_id: checkout.user.id,
2424
+ type: 'individual',
2425
+ country: 'br',
2426
+ name: checkout.user.displayName,
2427
+ documents: [
2428
+ {
2429
+ type: 'cpf',
2430
+ number: checkout.user.cpf,
2431
+ },
2432
+ ],
2433
+ },
2434
+ };
2435
+ }
2436
+ }
2437
+
2438
+ class PagarmeCardService {
2439
+ constructor(credentials) {
2440
+ this.credentials = credentials;
2441
+ }
2442
+ async pay(checkout, card) {
2443
+ try {
2444
+ const result = await axios__default["default"]({
2445
+ method: 'POST',
2446
+ url: this.credentials.URL_TRANSACTION,
2447
+ data: this.createCardPayment(checkout, card),
2448
+ });
2449
+ if (result.data.status !== 'paid') {
2450
+ this.checkoutAntiFraudService.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
2451
+ return Promise.reject(new Error(`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`));
2452
+ }
2453
+ const payment = {
2454
+ createdAt: new Date(),
2455
+ updatedAt: new Date(),
2456
+ userId: checkout.user.id,
2457
+ checkoutId: checkout.id,
2458
+ totalPrice: checkout.totalPrice,
2459
+ transaction: result.data,
2460
+ };
2461
+ return payment;
2462
+ }
2463
+ catch (error) {
2464
+ console.log(error);
2465
+ }
2466
+ }
2467
+ addCard() {
2468
+ throw new Error('Method not implemented.');
2469
+ }
2470
+ createCardPayment(checkout, card) {
2471
+ var _a, _b, _c, _d, _e, _f;
2472
+ return {
2473
+ api_key: this.credentials.API_KEY,
2474
+ amount: Math.floor(checkout.totalPrice * 100),
2475
+ card_id: card.cardId,
2476
+ payment_method: 'credit_card',
2477
+ installments: card.installments,
2478
+ soft_descriptor: checkout.shop,
2479
+ customer: {
2480
+ external_id: checkout.user.id,
2481
+ name: checkout.user.displayName,
2482
+ type: 'individual',
2483
+ country: 'br',
2484
+ email: checkout.user.email,
2485
+ phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
2486
+ documents: [
2487
+ {
2488
+ type: 'cpf',
2489
+ number: checkout.user.cpf,
2490
+ },
2491
+ ],
2492
+ },
2493
+ billing: {
2494
+ name: checkout.user.displayName,
2495
+ address: {
2496
+ country: 'br',
2497
+ state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
2498
+ city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
2499
+ neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
2500
+ street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
2501
+ street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
2502
+ zipcode: checkout.billingAddress
2503
+ ? checkout.billingAddress.zip.replace('-', '')
2504
+ : (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
2505
+ },
2506
+ },
2507
+ items: checkout.lineItems.map((item) => {
2508
+ return {
2509
+ id: item.id,
2510
+ title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
2511
+ unit_price: Math.floor(item.pricePaid * 100),
2512
+ quantity: item.quantity,
2513
+ tangible: true,
2514
+ };
2515
+ }),
2516
+ };
2517
+ }
2518
+ }
2519
+
2520
+ class PagarmePixService {
2521
+ constructor(credentials) {
2522
+ this.credentials = credentials;
2523
+ }
2524
+ async pay(checkout) {
2525
+ try {
2526
+ const result = await axios__default["default"]({
2527
+ method: 'POST',
2528
+ url: this.credentials.URL_TRANSACTION,
2529
+ data: this.createPixPayment(checkout),
2530
+ });
2531
+ const payment = {
2532
+ createdAt: new Date(),
2533
+ updatedAt: new Date(),
2534
+ userId: checkout.user.id,
2535
+ checkoutId: checkout.id,
2536
+ totalPrice: checkout.totalPrice,
2537
+ transaction: result.data,
2538
+ };
2539
+ return payment;
2540
+ }
2541
+ catch (error) {
2542
+ console.log(error);
2543
+ }
2544
+ }
2545
+ createPixPayment(checkout) {
2546
+ return {
2547
+ payment_method: 'pix',
2548
+ amount: Math.floor(checkout.totalPrice * 100),
2549
+ api_key: this.credentials.API_KEY,
2550
+ postback_url: this.credentials.URL_POSTBACK,
2551
+ pix_expiration_date: moment__namespace().add(1, 'day').format('YYYY-MM-DD'),
2552
+ customer: {
2553
+ external_id: checkout.user.id,
2554
+ type: 'individual',
2555
+ country: 'br',
2556
+ name: checkout.user.displayName,
2557
+ email: checkout.user.email.trim(),
2558
+ phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
2559
+ documents: [
2560
+ {
2561
+ type: 'cpf',
2562
+ number: checkout.user.cpf,
2563
+ },
2564
+ ],
2565
+ },
2566
+ };
2567
+ }
2568
+ }
2569
+
2257
2570
  class RoundProductPricesHelper {
2258
2571
  static roundProductPrices(product) {
2259
2572
  product.price.price = Number(product.price.price.toFixed(2));
@@ -2268,6 +2581,12 @@ class RoundProductPricesHelper {
2268
2581
  }
2269
2582
  }
2270
2583
 
2584
+ class Sequence extends BaseModel {
2585
+ static get identifiersFields() {
2586
+ return ['id'];
2587
+ }
2588
+ }
2589
+
2271
2590
  exports.FilterType = void 0;
2272
2591
  (function (FilterType) {
2273
2592
  FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
@@ -2782,7 +3101,7 @@ const withFindFirestore = (MixinBase) => {
2782
3101
  const collection = this.collection(this.buildCollectionPathForFind(find.filters));
2783
3102
  const enableCount = (_b = (_a = find === null || find === void 0 ? void 0 : find.options) === null || _a === void 0 ? void 0 : _a.enableCount) !== null && _b !== void 0 ? _b : true;
2784
3103
  const intercepted = await ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.request) === null || _d === void 0 ? void 0 : _d.call(_c, { find }));
2785
- const { filters, limits, orderBy } = intercepted.find || find;
3104
+ const { filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
2786
3105
  const queries = this.makeFirestoreWhere(filters || {});
2787
3106
  const ordination = this.makeFirestoreOrderBy(filters, orderBy);
2788
3107
  const offsets = await this.defineLimits(filters, limits);
@@ -2940,139 +3259,6 @@ const withCrudFirestore = (MixinBase) => {
2940
3259
  };
2941
3260
  };
2942
3261
 
2943
- class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2944
- constructor({ firestore, interceptors }) {
2945
- super({
2946
- firestore,
2947
- collectionName: 'leads',
2948
- model: Lead,
2949
- interceptors,
2950
- });
2951
- }
2952
- }
2953
-
2954
- class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2955
- constructor({ firestore, interceptors }, parentRepository) {
2956
- super({
2957
- firestore,
2958
- collectionName: 'editions',
2959
- parentIdField: 'subscriptionId',
2960
- model: Edition,
2961
- interceptors,
2962
- });
2963
- this.parentRepository = parentRepository;
2964
- }
2965
- }
2966
-
2967
- class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2968
- constructor({ firestore, interceptors, }) {
2969
- super({
2970
- firestore,
2971
- collectionName: 'subscription',
2972
- model: Subscription,
2973
- interceptors,
2974
- });
2975
- }
2976
- }
2977
-
2978
- class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2979
- constructor({ firestore, interceptors }, parentRepository) {
2980
- super({
2981
- firestore,
2982
- collectionName: 'payments',
2983
- parentIdField: 'subscriptionId',
2984
- model: SubscriptionPayment,
2985
- interceptors,
2986
- });
2987
- this.parentRepository = parentRepository;
2988
- }
2989
- }
2990
-
2991
- class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2992
- constructor({ firestore, interceptors }, parentRepository) {
2993
- super({
2994
- firestore,
2995
- collectionName: 'address',
2996
- parentIdField: 'userId',
2997
- model: UserAddress,
2998
- interceptors,
2999
- });
3000
- this.parentRepository = parentRepository;
3001
- }
3002
- }
3003
-
3004
- class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3005
- constructor({ firestore, interceptors }, parentRepository) {
3006
- super({
3007
- firestore,
3008
- collectionName: 'CX',
3009
- parentIdField: 'userId',
3010
- model: BeautyProfile,
3011
- interceptors,
3012
- });
3013
- this.parentRepository = parentRepository;
3014
- }
3015
- }
3016
-
3017
- class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3018
- constructor({ firestore, interceptors }) {
3019
- super({
3020
- firestore,
3021
- collectionName: 'users',
3022
- model: User,
3023
- interceptors,
3024
- });
3025
- }
3026
- async get(identifiers) {
3027
- const user = await super.get({ id: identifiers.id });
3028
- user.beautyProfile = await this.getBeautyProfile(user.id);
3029
- user.isSubscriber = await this.checkIfIsSubscriber(user.id);
3030
- return user;
3031
- }
3032
- async checkIfExistsByField(field, value) {
3033
- const result = await this.find({ filters: { [field]: value } });
3034
- return result.count > 0;
3035
- }
3036
- buildModelInstance() {
3037
- const { fromFirestore, toFirestore } = super.buildModelInstance();
3038
- return {
3039
- toFirestore: (data) => {
3040
- const plain = toFirestore(data);
3041
- delete plain.isSubscriber;
3042
- return plain;
3043
- },
3044
- fromFirestore,
3045
- };
3046
- }
3047
- async getBeautyProfile(userId) {
3048
- const beautyProfile = await firestore.getDoc(firestore.doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
3049
- return beautyProfile.data();
3050
- }
3051
- async checkIfIsSubscriber(userId) {
3052
- const docs = await firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')));
3053
- return !!docs && !!docs.size;
3054
- }
3055
- buildBeautyProfileModelInstance() {
3056
- return {
3057
- toFirestore: (data) => data.toPlain(),
3058
- fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
3059
- };
3060
- }
3061
- }
3062
-
3063
- class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3064
- constructor({ firestore, interceptors }, parentRepository) {
3065
- super({
3066
- firestore,
3067
- collectionName: 'payment_method',
3068
- parentIdField: 'userId',
3069
- model: UserPaymentMethod,
3070
- interceptors,
3071
- });
3072
- this.parentRepository = parentRepository;
3073
- }
3074
- }
3075
-
3076
3262
  class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3077
3263
  constructor({ firestore, interceptors }) {
3078
3264
  super({
@@ -3158,55 +3344,150 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
3158
3344
  const { data: products } = await this.find();
3159
3345
  products.forEach((product) => {
3160
3346
  var _a;
3161
- if ([undefined, 0].includes((_a = product.reviews) === null || _a === void 0 ? void 0 : _a.length))
3162
- return;
3163
- const productInfo = {
3164
- productId: product.id,
3165
- productName: product.name,
3166
- productSku: product.sku,
3167
- };
3168
- this.reviews.pending = [];
3169
- this.reviews.approved = [];
3170
- this.reviews.rejected = [];
3171
- product.reviews.forEach((review) => {
3172
- if ([null, undefined].includes(review.status))
3173
- return this.reviews.pending.push(Object.assign(Object.assign({}, review), productInfo));
3174
- if (review.status === false)
3175
- return this.reviews.rejected.push(Object.assign(Object.assign({}, review), productInfo));
3176
- if (!!review.status)
3177
- return this.reviews.approved.push(Object.assign(Object.assign({}, review), productInfo));
3178
- return review;
3347
+ if ([undefined, 0].includes((_a = product.reviews) === null || _a === void 0 ? void 0 : _a.length))
3348
+ return;
3349
+ const productInfo = {
3350
+ productId: product.id,
3351
+ productName: product.name,
3352
+ productSku: product.sku,
3353
+ };
3354
+ this.reviews.pending = [];
3355
+ this.reviews.approved = [];
3356
+ this.reviews.rejected = [];
3357
+ product.reviews.forEach((review) => {
3358
+ if ([null, undefined].includes(review.status))
3359
+ return this.reviews.pending.push(Object.assign(Object.assign({}, review), productInfo));
3360
+ if (review.status === false)
3361
+ return this.reviews.rejected.push(Object.assign(Object.assign({}, review), productInfo));
3362
+ if (!!review.status)
3363
+ return this.reviews.approved.push(Object.assign(Object.assign({}, review), productInfo));
3364
+ return review;
3365
+ });
3366
+ });
3367
+ return this.reviews[status];
3368
+ }
3369
+ cleanShoppingCountFromIds() {
3370
+ return;
3371
+ }
3372
+ findCatalog(params) {
3373
+ return this.find(params);
3374
+ }
3375
+ }
3376
+
3377
+ class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3378
+ constructor({ firestore, interceptors }, parentRepository) {
3379
+ super({
3380
+ firestore,
3381
+ collectionName: 'variants',
3382
+ parentIdField: 'productId',
3383
+ model: Variant,
3384
+ interceptors,
3385
+ });
3386
+ this.parentRepository = parentRepository;
3387
+ }
3388
+ }
3389
+
3390
+ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3391
+ constructor({ firestore, interceptors }) {
3392
+ super({
3393
+ firestore,
3394
+ collectionName: 'subscriptionProducts',
3395
+ model: Product,
3396
+ interceptors,
3397
+ });
3398
+ }
3399
+ }
3400
+
3401
+ class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3402
+ constructor({ firestore, interceptors }) {
3403
+ super({
3404
+ firestore,
3405
+ collectionName: 'sequences',
3406
+ model: Sequence,
3407
+ interceptors,
3408
+ });
3409
+ }
3410
+ }
3411
+
3412
+ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3413
+ constructor({ firestore, interceptors }) {
3414
+ super({
3415
+ firestore,
3416
+ collectionName: 'dms',
3417
+ model: Home,
3418
+ interceptors,
3419
+ });
3420
+ this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
3421
+ var _a, _b, _c;
3422
+ return ({
3423
+ category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
3424
+ ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
3425
+ : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
3426
+ 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)) || [],
3427
+ });
3428
+ };
3429
+ this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
3430
+ var _a;
3431
+ return ({
3432
+ category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
3433
+ products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
3179
3434
  });
3180
- });
3181
- return this.reviews[status];
3435
+ };
3182
3436
  }
3183
- cleanShoppingCountFromIds() {
3184
- return;
3437
+ buildModelInstance() {
3438
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
3439
+ return {
3440
+ toFirestore: (data) => {
3441
+ const modifiedData = this.homeToFirestore(data);
3442
+ return toFirestore(modifiedData);
3443
+ },
3444
+ fromFirestore: (snap) => {
3445
+ const instance = fromFirestore(snap);
3446
+ return this.homeFromFirestore(instance);
3447
+ },
3448
+ };
3185
3449
  }
3186
- findCatalog(params) {
3187
- return this.find(params);
3450
+ homeToFirestore(home) {
3451
+ var _a, _b, _c, _d;
3452
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3453
+ home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
3454
+ home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
3455
+ home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
3456
+ }
3457
+ return home;
3458
+ }
3459
+ homeFromFirestore(home) {
3460
+ var _a;
3461
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3462
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
3463
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
3464
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
3465
+ home.data.createdAt =
3466
+ home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
3467
+ home.data.expiresAt =
3468
+ home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
3469
+ }
3470
+ return home;
3188
3471
  }
3189
3472
  }
3190
3473
 
3191
- class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3192
- constructor({ firestore, interceptors }, parentRepository) {
3474
+ class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3475
+ constructor({ firestore, interceptors }) {
3193
3476
  super({
3194
3477
  firestore,
3195
- collectionName: 'variants',
3196
- parentIdField: 'productId',
3197
- model: Variant,
3478
+ collectionName: 'shopMenus',
3479
+ model: ShopMenu,
3198
3480
  interceptors,
3199
3481
  });
3200
- this.parentRepository = parentRepository;
3201
3482
  }
3202
3483
  }
3203
3484
 
3204
- class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3205
- constructor({ firestore, interceptors }) {
3485
+ class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3486
+ constructor({ firestore, interceptors, }) {
3206
3487
  super({
3207
3488
  firestore,
3208
- collectionName: 'subscriptionProducts',
3209
- model: Product,
3489
+ collectionName: 'shopSettings',
3490
+ model: ShopSettings,
3210
3491
  interceptors,
3211
3492
  });
3212
3493
  }
@@ -3342,6 +3623,17 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
3342
3623
  }
3343
3624
  }
3344
3625
 
3626
+ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3627
+ constructor({ firestore, interceptors, }) {
3628
+ super({
3629
+ firestore,
3630
+ collectionName: 'paymentBlockedAttempts',
3631
+ model: OrderBlocked,
3632
+ interceptors,
3633
+ });
3634
+ }
3635
+ }
3636
+
3345
3637
  class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3346
3638
  constructor({ firestore, interceptors }) {
3347
3639
  super({
@@ -3364,87 +3656,136 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
3364
3656
  }
3365
3657
  }
3366
3658
 
3367
- class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3659
+ class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3368
3660
  constructor({ firestore, interceptors }) {
3369
3661
  super({
3370
3662
  firestore,
3371
- collectionName: 'dms',
3372
- model: Home,
3663
+ collectionName: 'leads',
3664
+ model: Lead,
3373
3665
  interceptors,
3374
3666
  });
3375
- this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
3376
- var _a, _b, _c;
3377
- return ({
3378
- category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
3379
- ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
3380
- : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
3381
- 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)) || [],
3382
- });
3383
- };
3384
- this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
3385
- var _a;
3386
- return ({
3387
- category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
3388
- products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
3389
- });
3390
- };
3391
3667
  }
3392
- buildModelInstance() {
3393
- const { fromFirestore, toFirestore } = super.buildModelInstance();
3394
- return {
3395
- toFirestore: (data) => {
3396
- const modifiedData = this.homeToFirestore(data);
3397
- return toFirestore(modifiedData);
3398
- },
3399
- fromFirestore: (snap) => {
3400
- const instance = fromFirestore(snap);
3401
- return this.homeFromFirestore(instance);
3402
- },
3403
- };
3668
+ }
3669
+
3670
+ class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3671
+ constructor({ firestore, interceptors }, parentRepository) {
3672
+ super({
3673
+ firestore,
3674
+ collectionName: 'editions',
3675
+ parentIdField: 'subscriptionId',
3676
+ model: Edition,
3677
+ interceptors,
3678
+ });
3679
+ this.parentRepository = parentRepository;
3404
3680
  }
3405
- homeToFirestore(home) {
3406
- var _a, _b, _c, _d;
3407
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3408
- home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
3409
- home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
3410
- home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
3411
- }
3412
- return home;
3681
+ }
3682
+
3683
+ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3684
+ constructor({ firestore, interceptors, }) {
3685
+ super({
3686
+ firestore,
3687
+ collectionName: 'subscription',
3688
+ model: Subscription,
3689
+ interceptors,
3690
+ });
3413
3691
  }
3414
- homeFromFirestore(home) {
3415
- var _a;
3416
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3417
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
3418
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
3419
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
3420
- home.data.createdAt =
3421
- home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
3422
- home.data.expiresAt =
3423
- home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
3424
- }
3425
- return home;
3692
+ }
3693
+
3694
+ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3695
+ constructor({ firestore, interceptors }, parentRepository) {
3696
+ super({
3697
+ firestore,
3698
+ collectionName: 'payments',
3699
+ parentIdField: 'subscriptionId',
3700
+ model: SubscriptionPayment,
3701
+ interceptors,
3702
+ });
3703
+ this.parentRepository = parentRepository;
3426
3704
  }
3427
3705
  }
3428
3706
 
3429
- class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3707
+ class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3708
+ constructor({ firestore, interceptors }, parentRepository) {
3709
+ super({
3710
+ firestore,
3711
+ collectionName: 'address',
3712
+ parentIdField: 'userId',
3713
+ model: UserAddress,
3714
+ interceptors,
3715
+ });
3716
+ this.parentRepository = parentRepository;
3717
+ }
3718
+ }
3719
+
3720
+ class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3721
+ constructor({ firestore, interceptors }, parentRepository) {
3722
+ super({
3723
+ firestore,
3724
+ collectionName: 'CX',
3725
+ parentIdField: 'userId',
3726
+ model: BeautyProfile,
3727
+ interceptors,
3728
+ });
3729
+ this.parentRepository = parentRepository;
3730
+ }
3731
+ }
3732
+
3733
+ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3430
3734
  constructor({ firestore, interceptors }) {
3431
3735
  super({
3432
3736
  firestore,
3433
- collectionName: 'shopMenus',
3434
- model: ShopMenu,
3737
+ collectionName: 'users',
3738
+ model: User,
3435
3739
  interceptors,
3436
3740
  });
3437
3741
  }
3742
+ async get(identifiers) {
3743
+ const user = await super.get({ id: identifiers.id });
3744
+ user.beautyProfile = await this.getBeautyProfile(user.id);
3745
+ user.isSubscriber = await this.checkIfIsSubscriber(user.id);
3746
+ return user;
3747
+ }
3748
+ async checkIfExistsByField(field, value) {
3749
+ const result = await this.find({ filters: { [field]: value } });
3750
+ return result.count > 0;
3751
+ }
3752
+ buildModelInstance() {
3753
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
3754
+ return {
3755
+ toFirestore: (data) => {
3756
+ const plain = toFirestore(data);
3757
+ delete plain.isSubscriber;
3758
+ return plain;
3759
+ },
3760
+ fromFirestore,
3761
+ };
3762
+ }
3763
+ async getBeautyProfile(userId) {
3764
+ const beautyProfile = await firestore.getDoc(firestore.doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
3765
+ return beautyProfile.data();
3766
+ }
3767
+ async checkIfIsSubscriber(userId) {
3768
+ const docs = await firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')));
3769
+ return !!docs && !!docs.size;
3770
+ }
3771
+ buildBeautyProfileModelInstance() {
3772
+ return {
3773
+ toFirestore: (data) => data.toPlain(),
3774
+ fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
3775
+ };
3776
+ }
3438
3777
  }
3439
3778
 
3440
- class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3441
- constructor({ firestore, interceptors, }) {
3779
+ class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3780
+ constructor({ firestore, interceptors }, parentRepository) {
3442
3781
  super({
3443
3782
  firestore,
3444
- collectionName: 'shopSettings',
3445
- model: ShopSettings,
3783
+ collectionName: 'payment_method',
3784
+ parentIdField: 'userId',
3785
+ model: UserPaymentMethod,
3446
3786
  interceptors,
3447
3787
  });
3788
+ this.parentRepository = parentRepository;
3448
3789
  }
3449
3790
  }
3450
3791
 
@@ -5647,6 +5988,8 @@ Object.defineProperty(exports, 'unset', {
5647
5988
  get: function () { return lodash.unset; }
5648
5989
  });
5649
5990
  exports.Address = Address;
5991
+ exports.AdyenCardService = AdyenCardService;
5992
+ exports.AdyenPaymentMethodFactory = AdyenPaymentMethodFactory;
5650
5993
  exports.Authentication = Authentication;
5651
5994
  exports.AuthenticationFirebaseAuthService = AuthenticationFirebaseAuthService;
5652
5995
  exports.AxiosAdapter = AxiosAdapter;
@@ -5686,6 +6029,8 @@ exports.Filter = Filter;
5686
6029
  exports.FilterHasuraGraphQLRepository = FilterHasuraGraphQLRepository;
5687
6030
  exports.FilterOption = FilterOption;
5688
6031
  exports.FilterOptionHasuraGraphQLRepository = FilterOptionHasuraGraphQLRepository;
6032
+ exports.GlampointsPaymentMethodFactory = GlampointsPaymentMethodFactory;
6033
+ exports.GlampointsPaymentService = GlampointsPaymentService;
5689
6034
  exports.Home = Home;
5690
6035
  exports.HomeFirestoreRepository = HomeFirestoreRepository;
5691
6036
  exports.InvalidArgumentError = InvalidArgumentError;
@@ -5699,9 +6044,17 @@ exports.Log = Log;
5699
6044
  exports.Logger = Logger;
5700
6045
  exports.NotFoundError = NotFoundError;
5701
6046
  exports.Order = Order;
6047
+ exports.OrderBlocked = OrderBlocked;
6048
+ exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
5702
6049
  exports.OrderFirestoreRepository = OrderFirestoreRepository;
6050
+ exports.PagarmeBankSlipService = PagarmeBankSlipService;
6051
+ exports.PagarmeCardService = PagarmeCardService;
6052
+ exports.PagarmePaymentMethodFactory = PagarmePaymentMethodFactory;
6053
+ exports.PagarmePixService = PagarmePixService;
5703
6054
  exports.Payment = Payment;
5704
6055
  exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
6056
+ exports.PaymentProviderFactory = PaymentProviderFactory;
6057
+ exports.PaymentTransaction = PaymentTransaction;
5705
6058
  exports.Product = Product;
5706
6059
  exports.ProductFirestoreRepository = ProductFirestoreRepository;
5707
6060
  exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
@@ -5714,6 +6067,8 @@ exports.Register = Register;
5714
6067
  exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
5715
6068
  exports.RequiredArgumentError = RequiredArgumentError;
5716
6069
  exports.RoundProductPricesHelper = RoundProductPricesHelper;
6070
+ exports.Sequence = Sequence;
6071
+ exports.SequenceFirestoreRepository = SequenceFirestoreRepository;
5717
6072
  exports.ShippingMethod = ShippingMethod;
5718
6073
  exports.ShopMenu = ShopMenu;
5719
6074
  exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;