@infrab4a/connect 4.1.2-beta.9 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('reflect-metadata');
6
- var tslib_1 = require('tslib');
7
6
  var classTransformer = require('class-transformer');
7
+ var tslib_1 = require('tslib');
8
8
  var dateFns = require('date-fns');
9
9
  var lodash = require('lodash');
10
10
  var debug = require('debug');
@@ -60,181 +60,6 @@ class BaseModel {
60
60
  }
61
61
  }
62
62
 
63
- class Filter extends BaseModel {
64
- static get identifiersFields() {
65
- return ['id'];
66
- }
67
- }
68
-
69
- class CategoryBase extends BaseModel {
70
- static get identifiersFields() {
71
- return ['id'];
72
- }
73
- }
74
- tslib_1.__decorate([
75
- classTransformer.Type(() => CategoryBase),
76
- tslib_1.__metadata("design:type", CategoryBase)
77
- ], CategoryBase.prototype, "parent", void 0);
78
- tslib_1.__decorate([
79
- classTransformer.Type(() => Filter),
80
- tslib_1.__metadata("design:type", Array)
81
- ], CategoryBase.prototype, "filters", void 0);
82
-
83
- class CategoryForProduct extends CategoryBase {
84
- static get identifiersFields() {
85
- return ['id'];
86
- }
87
- }
88
-
89
- class ProductBase extends BaseModel {
90
- get evaluation() {
91
- return {
92
- reviews: this.reviews,
93
- count: this.reviewsTotal,
94
- rating: this.rate,
95
- };
96
- }
97
- set evaluation(evaluation) {
98
- if (!evaluation) {
99
- this.reviews = null;
100
- this.reviewsTotal = null;
101
- this.rate = null;
102
- return;
103
- }
104
- this.reviews = evaluation.reviews || this.reviews;
105
- this.reviewsTotal = evaluation.count || this.reviewsTotal;
106
- this.rate = evaluation.rating || this.rate;
107
- }
108
- static get identifiersFields() {
109
- return ['id'];
110
- }
111
- }
112
-
113
- class ProductForKit extends ProductBase {
114
- static get identifiersFields() {
115
- return ['id'];
116
- }
117
- }
118
- tslib_1.__decorate([
119
- classTransformer.Type(() => CategoryForProduct),
120
- tslib_1.__metadata("design:type", CategoryForProduct)
121
- ], ProductForKit.prototype, "category", void 0);
122
-
123
- class KitProduct extends BaseModel {
124
- static get identifiersFields() {
125
- return ['productId', 'kitProductId'];
126
- }
127
- }
128
- tslib_1.__decorate([
129
- classTransformer.Type(() => ProductForKit),
130
- tslib_1.__metadata("design:type", ProductForKit)
131
- ], KitProduct.prototype, "kit", void 0);
132
- tslib_1.__decorate([
133
- classTransformer.Type(() => ProductForKit),
134
- tslib_1.__metadata("design:type", ProductForKit)
135
- ], KitProduct.prototype, "product", void 0);
136
-
137
- class ProductForCategory extends ProductBase {
138
- static get identifiersFields() {
139
- return ['id'];
140
- }
141
- }
142
- tslib_1.__decorate([
143
- classTransformer.Type(() => KitProduct),
144
- tslib_1.__metadata("design:type", Array)
145
- ], ProductForCategory.prototype, "kitProducts", void 0);
146
-
147
- class Category extends CategoryBase {
148
- static get identifiersFields() {
149
- return ['id'];
150
- }
151
- }
152
- tslib_1.__decorate([
153
- classTransformer.Type(() => ProductForCategory),
154
- tslib_1.__metadata("design:type", Array)
155
- ], Category.prototype, "childrenProducts", void 0);
156
-
157
- class CategoryCollectionChildren extends BaseModel {
158
- static get identifiersFields() {
159
- return ['collectionId', 'categoryId'];
160
- }
161
- }
162
- tslib_1.__decorate([
163
- classTransformer.Type(() => CategoryCollectionChildren),
164
- tslib_1.__metadata("design:type", CategoryCollectionChildren)
165
- ], CategoryCollectionChildren.prototype, "parent", void 0);
166
-
167
- class CategoryFilter extends BaseModel {
168
- static get identifiersFields() {
169
- return ['id'];
170
- }
171
- }
172
- tslib_1.__decorate([
173
- classTransformer.Type(() => Filter),
174
- tslib_1.__metadata("design:type", Filter)
175
- ], CategoryFilter.prototype, "filter", void 0);
176
- tslib_1.__decorate([
177
- classTransformer.Type(() => Category),
178
- tslib_1.__metadata("design:type", Category)
179
- ], CategoryFilter.prototype, "category", void 0);
180
-
181
- exports.GenderDestination = void 0;
182
- (function (GenderDestination) {
183
- GenderDestination["FEMALE"] = "female";
184
- GenderDestination["MALE"] = "male";
185
- GenderDestination["UNISEX"] = "unisex";
186
- })(exports.GenderDestination || (exports.GenderDestination = {}));
187
-
188
- exports.Shops = void 0;
189
- (function (Shops) {
190
- Shops["MENSMARKET"] = "mensmarket";
191
- Shops["GLAMSHOP"] = "Glamshop";
192
- Shops["GLAMPOINTS"] = "Glampoints";
193
- Shops["ALL"] = "ALL";
194
- })(exports.Shops || (exports.Shops = {}));
195
-
196
- class FilterOption extends BaseModel {
197
- static get identifiersFields() {
198
- return ['id'];
199
- }
200
- }
201
-
202
- class Product extends ProductBase {
203
- static get identifiersFields() {
204
- return ['id'];
205
- }
206
- }
207
- tslib_1.__decorate([
208
- classTransformer.Type(() => CategoryForProduct),
209
- tslib_1.__metadata("design:type", CategoryForProduct)
210
- ], Product.prototype, "category", void 0);
211
- tslib_1.__decorate([
212
- classTransformer.Type(() => KitProduct),
213
- tslib_1.__metadata("design:type", Array)
214
- ], Product.prototype, "kitProducts", void 0);
215
-
216
- class Variant extends BaseModel {
217
- static get identifiersFields() {
218
- return ['id', 'productId'];
219
- }
220
- }
221
-
222
- class Wishlist extends Category {
223
- static get identifiersFields() {
224
- return ['id'];
225
- }
226
- }
227
-
228
- class Buy2Win extends BaseModel {
229
- static get identifiersFields() {
230
- return ['id'];
231
- }
232
- }
233
- tslib_1.__decorate([
234
- classTransformer.Type(() => Category),
235
- tslib_1.__metadata("design:type", Array)
236
- ], Buy2Win.prototype, "categories", void 0);
237
-
238
63
  exports.Where = void 0;
239
64
  (function (Where) {
240
65
  Where["EQUALS"] = "==";
@@ -260,18 +85,6 @@ exports.UpdateOptionActions = void 0;
260
85
  UpdateOptionActions["NULL"] = "null";
261
86
  })(exports.UpdateOptionActions || (exports.UpdateOptionActions = {}));
262
87
 
263
- class CampaignDashboard extends BaseModel {
264
- static get identifiersFields() {
265
- return ['id'];
266
- }
267
- }
268
-
269
- class CampaignHashtag extends BaseModel {
270
- static get identifiersFields() {
271
- return ['id'];
272
- }
273
- }
274
-
275
88
  exports.AccessoryImportances = void 0;
276
89
  (function (AccessoryImportances) {
277
90
  AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
@@ -498,178 +311,171 @@ class Edition extends BaseModel {
498
311
  }
499
312
  }
500
313
 
501
- class PaymentTransaction extends BaseModel {
314
+ class Payment extends BaseModel {
315
+ static get identifiersFields() {
316
+ return ['id'];
317
+ }
502
318
  }
503
319
  tslib_1.__decorate([
504
320
  classTransformer.Expose({ name: 'refuse_reason' }),
505
321
  tslib_1.__metadata("design:type", String)
506
- ], PaymentTransaction.prototype, "refuseReason", void 0);
322
+ ], Payment.prototype, "refuseReason", void 0);
507
323
  tslib_1.__decorate([
508
324
  classTransformer.Expose({ name: 'status_reason' }),
509
325
  tslib_1.__metadata("design:type", String)
510
- ], PaymentTransaction.prototype, "statusReason", void 0);
326
+ ], Payment.prototype, "statusReason", void 0);
511
327
  tslib_1.__decorate([
512
328
  classTransformer.Expose({ name: 'acquirer_response_code' }),
513
329
  tslib_1.__metadata("design:type", String)
514
- ], PaymentTransaction.prototype, "acquirerResponseCode", void 0);
330
+ ], Payment.prototype, "acquirerResponseCode", void 0);
515
331
  tslib_1.__decorate([
516
332
  classTransformer.Expose({ name: 'acquirer_name' }),
517
333
  tslib_1.__metadata("design:type", String)
518
- ], PaymentTransaction.prototype, "acquirerName", void 0);
334
+ ], Payment.prototype, "acquirerName", void 0);
519
335
  tslib_1.__decorate([
520
336
  classTransformer.Expose({ name: 'acquirer_id' }),
521
337
  tslib_1.__metadata("design:type", String)
522
- ], PaymentTransaction.prototype, "acquirerId", void 0);
338
+ ], Payment.prototype, "acquirerId", void 0);
523
339
  tslib_1.__decorate([
524
340
  classTransformer.Expose({ name: 'authorization_code' }),
525
341
  tslib_1.__metadata("design:type", String)
526
- ], PaymentTransaction.prototype, "authorizationCode", void 0);
342
+ ], Payment.prototype, "authorizationCode", void 0);
527
343
  tslib_1.__decorate([
528
344
  classTransformer.Expose({ name: 'soft_descriptor' }),
529
345
  tslib_1.__metadata("design:type", String)
530
- ], PaymentTransaction.prototype, "softDescriptor", void 0);
346
+ ], Payment.prototype, "softDescriptor", void 0);
531
347
  tslib_1.__decorate([
532
348
  classTransformer.Expose({ name: 'date_created' }),
533
349
  tslib_1.__metadata("design:type", String)
534
- ], PaymentTransaction.prototype, "dateCreated", void 0);
350
+ ], Payment.prototype, "dateCreated", void 0);
535
351
  tslib_1.__decorate([
536
352
  classTransformer.Expose({ name: 'date_updated' }),
537
353
  tslib_1.__metadata("design:type", String)
538
- ], PaymentTransaction.prototype, "dateUpdated", void 0);
354
+ ], Payment.prototype, "dateUpdated", void 0);
539
355
  tslib_1.__decorate([
540
356
  classTransformer.Expose({ name: 'authorized_amount' }),
541
357
  tslib_1.__metadata("design:type", Number)
542
- ], PaymentTransaction.prototype, "authorizedAmount", void 0);
358
+ ], Payment.prototype, "authorizedAmount", void 0);
543
359
  tslib_1.__decorate([
544
360
  classTransformer.Expose({ name: 'paid_amount' }),
545
361
  tslib_1.__metadata("design:type", Number)
546
- ], PaymentTransaction.prototype, "paidAmount", void 0);
362
+ ], Payment.prototype, "paidAmount", void 0);
547
363
  tslib_1.__decorate([
548
364
  classTransformer.Expose({ name: 'refunded_amount' }),
549
365
  tslib_1.__metadata("design:type", Number)
550
- ], PaymentTransaction.prototype, "refundedAmount", void 0);
366
+ ], Payment.prototype, "refundedAmount", void 0);
551
367
  tslib_1.__decorate([
552
368
  classTransformer.Expose({ name: 'card_holder_name' }),
553
369
  tslib_1.__metadata("design:type", String)
554
- ], PaymentTransaction.prototype, "cardHolderName", void 0);
370
+ ], Payment.prototype, "cardHolderName", void 0);
555
371
  tslib_1.__decorate([
556
372
  classTransformer.Expose({ name: 'card_last_digits' }),
557
373
  tslib_1.__metadata("design:type", String)
558
- ], PaymentTransaction.prototype, "cardLastDigits", void 0);
374
+ ], Payment.prototype, "cardLastDigits", void 0);
559
375
  tslib_1.__decorate([
560
376
  classTransformer.Expose({ name: 'card_first_digits' }),
561
377
  tslib_1.__metadata("design:type", String)
562
- ], PaymentTransaction.prototype, "cardFirstDigits", void 0);
378
+ ], Payment.prototype, "cardFirstDigits", void 0);
563
379
  tslib_1.__decorate([
564
380
  classTransformer.Expose({ name: 'card_brand' }),
565
381
  tslib_1.__metadata("design:type", String)
566
- ], PaymentTransaction.prototype, "cardBrand", void 0);
382
+ ], Payment.prototype, "cardBrand", void 0);
567
383
  tslib_1.__decorate([
568
384
  classTransformer.Expose({ name: 'card_pin_mode' }),
569
385
  tslib_1.__metadata("design:type", String)
570
- ], PaymentTransaction.prototype, "cardPinMode", void 0);
386
+ ], Payment.prototype, "cardPinMode", void 0);
571
387
  tslib_1.__decorate([
572
388
  classTransformer.Expose({ name: 'card_magstripe_fallback' }),
573
389
  tslib_1.__metadata("design:type", Boolean)
574
- ], PaymentTransaction.prototype, "cardMagstripeFallback", void 0);
390
+ ], Payment.prototype, "cardMagstripeFallback", void 0);
575
391
  tslib_1.__decorate([
576
392
  classTransformer.Expose({ name: 'cvm_pin' }),
577
393
  tslib_1.__metadata("design:type", Boolean)
578
- ], PaymentTransaction.prototype, "cvmPin", void 0);
394
+ ], Payment.prototype, "cvmPin", void 0);
579
395
  tslib_1.__decorate([
580
396
  classTransformer.Expose({ name: 'postback_url' }),
581
397
  tslib_1.__metadata("design:type", String)
582
- ], PaymentTransaction.prototype, "postbackUrl", void 0);
398
+ ], Payment.prototype, "postbackUrl", void 0);
583
399
  tslib_1.__decorate([
584
400
  classTransformer.Expose({ name: 'payment_method' }),
585
401
  tslib_1.__metadata("design:type", String)
586
- ], PaymentTransaction.prototype, "paymentMethod", void 0);
402
+ ], Payment.prototype, "paymentMethod", void 0);
587
403
  tslib_1.__decorate([
588
404
  classTransformer.Expose({ name: 'capture_method' }),
589
405
  tslib_1.__metadata("design:type", String)
590
- ], PaymentTransaction.prototype, "captureMethod", void 0);
406
+ ], Payment.prototype, "captureMethod", void 0);
591
407
  tslib_1.__decorate([
592
408
  classTransformer.Expose({ name: 'antifraud_score' }),
593
409
  tslib_1.__metadata("design:type", String)
594
- ], PaymentTransaction.prototype, "antifraudScore", void 0);
410
+ ], Payment.prototype, "antifraudScore", void 0);
595
411
  tslib_1.__decorate([
596
412
  classTransformer.Expose({ name: 'boleto_url' }),
597
413
  tslib_1.__metadata("design:type", String)
598
- ], PaymentTransaction.prototype, "boletoUrl", void 0);
414
+ ], Payment.prototype, "boletoUrl", void 0);
599
415
  tslib_1.__decorate([
600
416
  classTransformer.Expose({ name: 'boleto_barcode' }),
601
417
  tslib_1.__metadata("design:type", String)
602
- ], PaymentTransaction.prototype, "boletoBarcode", void 0);
418
+ ], Payment.prototype, "boletoBarcode", void 0);
603
419
  tslib_1.__decorate([
604
420
  classTransformer.Expose({ name: 'boleto_expiration_date' }),
605
421
  tslib_1.__metadata("design:type", String)
606
- ], PaymentTransaction.prototype, "boletoExpirationDate", void 0);
422
+ ], Payment.prototype, "boletoExpirationDate", void 0);
607
423
  tslib_1.__decorate([
608
424
  classTransformer.Expose({ name: 'subscription_id' }),
609
425
  tslib_1.__metadata("design:type", String)
610
- ], PaymentTransaction.prototype, "subscriptionId", void 0);
426
+ ], Payment.prototype, "subscriptionId", void 0);
611
427
  tslib_1.__decorate([
612
428
  classTransformer.Expose({ name: 'split_rules' }),
613
429
  tslib_1.__metadata("design:type", String)
614
- ], PaymentTransaction.prototype, "splitRules", void 0);
430
+ ], Payment.prototype, "splitRules", void 0);
615
431
  tslib_1.__decorate([
616
432
  classTransformer.Expose({ name: 'antifraud_metadata' }),
617
433
  tslib_1.__metadata("design:type", Object)
618
- ], PaymentTransaction.prototype, "antifraudMetadata", void 0);
434
+ ], Payment.prototype, "antifraudMetadata", void 0);
619
435
  tslib_1.__decorate([
620
436
  classTransformer.Expose({ name: 'reference_key' }),
621
437
  tslib_1.__metadata("design:type", String)
622
- ], PaymentTransaction.prototype, "referenceKey", void 0);
438
+ ], Payment.prototype, "referenceKey", void 0);
623
439
  tslib_1.__decorate([
624
440
  classTransformer.Expose({ name: 'local_transaction_id' }),
625
441
  tslib_1.__metadata("design:type", String)
626
- ], PaymentTransaction.prototype, "localTransactionId", void 0);
442
+ ], Payment.prototype, "localTransactionId", void 0);
627
443
  tslib_1.__decorate([
628
444
  classTransformer.Expose({ name: 'local_time' }),
629
445
  tslib_1.__metadata("design:type", String)
630
- ], PaymentTransaction.prototype, "localTime", void 0);
446
+ ], Payment.prototype, "localTime", void 0);
631
447
  tslib_1.__decorate([
632
448
  classTransformer.Expose({ name: 'fraud_covered' }),
633
449
  tslib_1.__metadata("design:type", Boolean)
634
- ], PaymentTransaction.prototype, "fraudCovered", void 0);
450
+ ], Payment.prototype, "fraudCovered", void 0);
635
451
  tslib_1.__decorate([
636
452
  classTransformer.Expose({ name: 'fraud_reimbursed' }),
637
453
  tslib_1.__metadata("design:type", String)
638
- ], PaymentTransaction.prototype, "fraudReimbursed", void 0);
454
+ ], Payment.prototype, "fraudReimbursed", void 0);
639
455
  tslib_1.__decorate([
640
456
  classTransformer.Expose({ name: 'order_id' }),
641
457
  tslib_1.__metadata("design:type", String)
642
- ], PaymentTransaction.prototype, "orderId", void 0);
458
+ ], Payment.prototype, "orderId", void 0);
643
459
  tslib_1.__decorate([
644
460
  classTransformer.Expose({ name: 'risk_level' }),
645
461
  tslib_1.__metadata("design:type", String)
646
- ], PaymentTransaction.prototype, "riskLevel", void 0);
462
+ ], Payment.prototype, "riskLevel", void 0);
647
463
  tslib_1.__decorate([
648
464
  classTransformer.Expose({ name: 'receipt_url' }),
649
465
  tslib_1.__metadata("design:type", String)
650
- ], PaymentTransaction.prototype, "receiptUrl", void 0);
466
+ ], Payment.prototype, "receiptUrl", void 0);
651
467
  tslib_1.__decorate([
652
468
  classTransformer.Expose({ name: 'private_label' }),
653
469
  tslib_1.__metadata("design:type", String)
654
- ], PaymentTransaction.prototype, "privateLabel", void 0);
470
+ ], Payment.prototype, "privateLabel", void 0);
655
471
  tslib_1.__decorate([
656
472
  classTransformer.Expose({ name: 'pix_qr_code' }),
657
473
  tslib_1.__metadata("design:type", String)
658
- ], PaymentTransaction.prototype, "pixQrCode", void 0);
474
+ ], Payment.prototype, "pixQrCode", void 0);
659
475
  tslib_1.__decorate([
660
476
  classTransformer.Expose({ name: 'pix_expiration_date' }),
661
477
  tslib_1.__metadata("design:type", String)
662
- ], PaymentTransaction.prototype, "pixExpirationDate", void 0);
663
-
664
- class Payment extends BaseModel {
665
- static get identifiersFields() {
666
- return ['id'];
667
- }
668
- }
669
- tslib_1.__decorate([
670
- classTransformer.Type(() => PaymentTransaction),
671
- tslib_1.__metadata("design:type", PaymentTransaction)
672
- ], Payment.prototype, "transaction", void 0);
478
+ ], Payment.prototype, "pixExpirationDate", void 0);
673
479
 
674
480
  class SubscriptionPayment extends BaseModel {
675
481
  static get identifiersFields() {
@@ -2181,73 +1987,254 @@ class RecoveryPassword {
2181
1987
  }
2182
1988
  }
2183
1989
 
2184
- class LineItem extends Product {
2185
- }
2186
-
2187
- class ShippingMethod extends BaseModel {
1990
+ class Filter extends BaseModel {
2188
1991
  static get identifiersFields() {
2189
1992
  return ['id'];
2190
1993
  }
2191
1994
  }
2192
1995
 
2193
- class Checkout extends BaseModel {
1996
+ class CategoryBase extends BaseModel {
2194
1997
  static get identifiersFields() {
2195
1998
  return ['id'];
2196
1999
  }
2197
2000
  }
2198
2001
  tslib_1.__decorate([
2199
- classTransformer.Type(() => LineItem),
2200
- tslib_1.__metadata("design:type", Array)
2201
- ], Checkout.prototype, "lineItems", void 0);
2202
- tslib_1.__decorate([
2203
- classTransformer.Type(() => User),
2204
- tslib_1.__metadata("design:type", User)
2205
- ], Checkout.prototype, "user", void 0);
2206
- tslib_1.__decorate([
2207
- classTransformer.Type(() => UserAddress),
2208
- tslib_1.__metadata("design:type", UserAddress)
2209
- ], Checkout.prototype, "shippingAddress", void 0);
2210
- tslib_1.__decorate([
2211
- classTransformer.Type(() => UserAddress),
2212
- tslib_1.__metadata("design:type", UserAddress)
2213
- ], Checkout.prototype, "billingAddress", void 0);
2214
- tslib_1.__decorate([
2215
- classTransformer.Type(() => ShippingMethod),
2216
- tslib_1.__metadata("design:type", ShippingMethod)
2217
- ], Checkout.prototype, "shipping", void 0);
2218
- tslib_1.__decorate([
2219
- classTransformer.Type(() => Coupon),
2220
- tslib_1.__metadata("design:type", Coupon)
2221
- ], Checkout.prototype, "coupon", void 0);
2222
-
2223
- exports.OrderStatus = void 0;
2224
- (function (OrderStatus) {
2225
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
2226
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
2227
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
2228
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
2229
- OrderStatus["ENVIADO"] = "Enviado";
2230
- OrderStatus["ENTREGUE"] = "Entregue";
2231
- OrderStatus["CANCELADO"] = "Cancelado";
2232
- OrderStatus["CREDIT_CARD"] = "credit_card";
2233
- })(exports.OrderStatus || (exports.OrderStatus = {}));
2234
-
2235
- class Order extends Checkout {
2236
- }
2002
+ classTransformer.Type(() => CategoryBase),
2003
+ tslib_1.__metadata("design:type", CategoryBase)
2004
+ ], CategoryBase.prototype, "parent", void 0);
2237
2005
  tslib_1.__decorate([
2238
- classTransformer.Type(() => PaymentTransaction),
2239
- tslib_1.__metadata("design:type", PaymentTransaction)
2240
- ], Order.prototype, "payment", void 0);
2006
+ classTransformer.Type(() => Filter),
2007
+ tslib_1.__metadata("design:type", Array)
2008
+ ], CategoryBase.prototype, "filters", void 0);
2241
2009
 
2242
- class OrderBlocked extends BaseModel {
2010
+ class CategoryForProduct extends CategoryBase {
2243
2011
  static get identifiersFields() {
2244
2012
  return ['id'];
2245
2013
  }
2246
2014
  }
2247
2015
 
2248
- class CheckoutSubscription extends BaseModel {
2249
- static get identifiersFields() {
2250
- return ['id'];
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);
2215
+
2216
+ exports.OrderStatus = void 0;
2217
+ (function (OrderStatus) {
2218
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
2219
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
2220
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
2221
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
2222
+ OrderStatus["ENVIADO"] = "Enviado";
2223
+ OrderStatus["ENTREGUE"] = "Entregue";
2224
+ OrderStatus["CANCELADO"] = "Cancelado";
2225
+ OrderStatus["CREDIT_CARD"] = "credit_card";
2226
+ })(exports.OrderStatus || (exports.OrderStatus = {}));
2227
+
2228
+ class Order extends Checkout {
2229
+ }
2230
+ tslib_1.__decorate([
2231
+ classTransformer.Type(() => Payment),
2232
+ tslib_1.__metadata("design:type", Payment)
2233
+ ], Order.prototype, "payment", void 0);
2234
+
2235
+ class CheckoutSubscription extends BaseModel {
2236
+ static get identifiersFields() {
2237
+ return ['id'];
2251
2238
  }
2252
2239
  }
2253
2240
  tslib_1.__decorate([
@@ -2281,12 +2268,6 @@ class RoundProductPricesHelper {
2281
2268
  }
2282
2269
  }
2283
2270
 
2284
- class Sequence extends BaseModel {
2285
- static get identifiersFields() {
2286
- return ['id'];
2287
- }
2288
- }
2289
-
2290
2271
  exports.FilterType = void 0;
2291
2272
  (function (FilterType) {
2292
2273
  FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
@@ -2557,18 +2538,7 @@ class ProductsIndex {
2557
2538
  must: {
2558
2539
  multi_match: {
2559
2540
  query: `${searchTerm}`,
2560
- type: 'bool_prefix',
2561
- fields: [
2562
- 'name',
2563
- 'name.folded',
2564
- 'name.search',
2565
- 'description',
2566
- 'description.search',
2567
- 'description.folded',
2568
- 'brand',
2569
- 'brand.search',
2570
- 'brand.folded',
2571
- ],
2541
+ fields: ['name', 'name.folded', 'name.search', 'description', 'brand'],
2572
2542
  fuzziness: 2,
2573
2543
  },
2574
2544
  },
@@ -2801,7 +2771,7 @@ const withFindFirestore = (MixinBase) => {
2801
2771
  const collection = this.collection(this.buildCollectionPathForFind(find.filters));
2802
2772
  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;
2803
2773
  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 }));
2804
- const { filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
2774
+ const { filters, limits, orderBy } = intercepted.find || find;
2805
2775
  const queries = this.makeFirestoreWhere(filters || {});
2806
2776
  const ordination = this.makeFirestoreOrderBy(filters, orderBy);
2807
2777
  const offsets = await this.defineLimits(filters, limits);
@@ -2959,25 +2929,158 @@ const withCrudFirestore = (MixinBase) => {
2959
2929
  };
2960
2930
  };
2961
2931
 
2962
- class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2932
+ class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2963
2933
  constructor({ firestore, interceptors }) {
2964
2934
  super({
2965
2935
  firestore,
2966
- collectionName: 'categories',
2967
- model: Category,
2936
+ collectionName: 'leads',
2937
+ model: Lead,
2968
2938
  interceptors,
2969
2939
  });
2970
2940
  }
2971
- async getCategoryBySlug(slug, shop) {
2972
- const categoryDocs = await firestore.getDocs(firestore.query(this.collection(this.collectionName), firestore.where('slug', '==', slug), firestore.where('shop', '==', shop), firestore.where('published', '==', true)));
2973
- if (categoryDocs.size > 1)
2974
- throw new DuplicatedResultsError('Query returned duplicated values');
2975
- if (categoryDocs.empty)
2976
- throw new NotFoundError(`Document with slug ${slug} not found`);
2977
- return categoryDocs.docs[0].data();
2941
+ }
2942
+
2943
+ class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2944
+ constructor({ firestore, interceptors }, parentRepository) {
2945
+ super({
2946
+ firestore,
2947
+ collectionName: 'editions',
2948
+ parentIdField: 'subscriptionId',
2949
+ model: Edition,
2950
+ interceptors,
2951
+ });
2952
+ this.parentRepository = parentRepository;
2978
2953
  }
2979
- async getCategoriesForHome(categoryIds, limit = 4, gender) {
2980
- const categorySnap = await firestore.getDocs(firestore.query(this.collection(this.collectionName), firestore.where('id', 'in', categoryIds.filter(Boolean)), firestore.where('published', '==', true)));
2954
+ }
2955
+
2956
+ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2957
+ constructor({ firestore, interceptors, }) {
2958
+ super({
2959
+ firestore,
2960
+ collectionName: 'subscription',
2961
+ model: Subscription,
2962
+ interceptors,
2963
+ });
2964
+ }
2965
+ }
2966
+
2967
+ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2968
+ constructor({ firestore, interceptors }, parentRepository) {
2969
+ super({
2970
+ firestore,
2971
+ collectionName: 'payments',
2972
+ parentIdField: 'subscriptionId',
2973
+ model: SubscriptionPayment,
2974
+ interceptors,
2975
+ });
2976
+ this.parentRepository = parentRepository;
2977
+ }
2978
+ }
2979
+
2980
+ class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2981
+ constructor({ firestore, interceptors }, parentRepository) {
2982
+ super({
2983
+ firestore,
2984
+ collectionName: 'address',
2985
+ parentIdField: 'userId',
2986
+ model: UserAddress,
2987
+ interceptors,
2988
+ });
2989
+ this.parentRepository = parentRepository;
2990
+ }
2991
+ }
2992
+
2993
+ class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2994
+ constructor({ firestore, interceptors }, parentRepository) {
2995
+ super({
2996
+ firestore,
2997
+ collectionName: 'CX',
2998
+ parentIdField: 'userId',
2999
+ model: BeautyProfile,
3000
+ interceptors,
3001
+ });
3002
+ this.parentRepository = parentRepository;
3003
+ }
3004
+ }
3005
+
3006
+ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3007
+ constructor({ firestore, interceptors }) {
3008
+ super({
3009
+ firestore,
3010
+ collectionName: 'users',
3011
+ model: User,
3012
+ interceptors,
3013
+ });
3014
+ }
3015
+ async get(identifiers) {
3016
+ const user = await super.get({ id: identifiers.id });
3017
+ user.beautyProfile = await this.getBeautyProfile(user.id);
3018
+ user.isSubscriber = await this.checkIfIsSubscriber(user.id);
3019
+ return user;
3020
+ }
3021
+ async checkIfExistsByField(field, value) {
3022
+ const result = await this.find({ filters: { [field]: value } });
3023
+ return result.count > 0;
3024
+ }
3025
+ buildModelInstance() {
3026
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
3027
+ return {
3028
+ toFirestore: (data) => {
3029
+ const plain = toFirestore(data);
3030
+ delete plain.isSubscriber;
3031
+ return plain;
3032
+ },
3033
+ fromFirestore,
3034
+ };
3035
+ }
3036
+ async getBeautyProfile(userId) {
3037
+ const beautyProfile = await firestore.getDoc(firestore.doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
3038
+ return beautyProfile.data();
3039
+ }
3040
+ async checkIfIsSubscriber(userId) {
3041
+ const docs = await firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')));
3042
+ return !!docs && !!docs.size;
3043
+ }
3044
+ buildBeautyProfileModelInstance() {
3045
+ return {
3046
+ toFirestore: (data) => data.toPlain(),
3047
+ fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
3048
+ };
3049
+ }
3050
+ }
3051
+
3052
+ class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3053
+ constructor({ firestore, interceptors }, parentRepository) {
3054
+ super({
3055
+ firestore,
3056
+ collectionName: 'payment_method',
3057
+ parentIdField: 'userId',
3058
+ model: UserPaymentMethod,
3059
+ interceptors,
3060
+ });
3061
+ this.parentRepository = parentRepository;
3062
+ }
3063
+ }
3064
+
3065
+ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3066
+ constructor({ firestore, interceptors }) {
3067
+ super({
3068
+ firestore,
3069
+ collectionName: 'categories',
3070
+ model: Category,
3071
+ interceptors,
3072
+ });
3073
+ }
3074
+ async getCategoryBySlug(slug, shop) {
3075
+ const categoryDocs = await firestore.getDocs(firestore.query(this.collection(this.collectionName), firestore.where('slug', '==', slug), firestore.where('shop', '==', shop), firestore.where('published', '==', true)));
3076
+ if (categoryDocs.size > 1)
3077
+ throw new DuplicatedResultsError('Query returned duplicated values');
3078
+ if (categoryDocs.empty)
3079
+ throw new NotFoundError(`Document with slug ${slug} not found`);
3080
+ return categoryDocs.docs[0].data();
3081
+ }
3082
+ async getCategoriesForHome(categoryIds, limit = 4, gender) {
3083
+ const categorySnap = await firestore.getDocs(firestore.query(this.collection(this.collectionName), firestore.where('id', 'in', categoryIds.filter(Boolean)), firestore.where('published', '==', true)));
2981
3084
  if (categorySnap.empty)
2982
3085
  throw new NotFoundError('Categories not found');
2983
3086
  const categories = categorySnap.docs.map((doc) => doc.data());
@@ -3098,101 +3201,6 @@ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpe
3098
3201
  }
3099
3202
  }
3100
3203
 
3101
- class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3102
- constructor({ firestore, interceptors }) {
3103
- super({
3104
- firestore,
3105
- collectionName: 'sequences',
3106
- model: Sequence,
3107
- interceptors,
3108
- });
3109
- }
3110
- }
3111
-
3112
- class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3113
- constructor({ firestore, interceptors }) {
3114
- super({
3115
- firestore,
3116
- collectionName: 'dms',
3117
- model: Home,
3118
- interceptors,
3119
- });
3120
- this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
3121
- var _a, _b, _c;
3122
- return ({
3123
- category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
3124
- ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
3125
- : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
3126
- 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)) || [],
3127
- });
3128
- };
3129
- this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
3130
- var _a;
3131
- return ({
3132
- category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
3133
- products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
3134
- });
3135
- };
3136
- }
3137
- buildModelInstance() {
3138
- const { fromFirestore, toFirestore } = super.buildModelInstance();
3139
- return {
3140
- toFirestore: (data) => {
3141
- const modifiedData = this.homeToFirestore(data);
3142
- return toFirestore(modifiedData);
3143
- },
3144
- fromFirestore: (snap) => {
3145
- const instance = fromFirestore(snap);
3146
- return this.homeFromFirestore(instance);
3147
- },
3148
- };
3149
- }
3150
- homeToFirestore(home) {
3151
- var _a, _b, _c, _d;
3152
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3153
- home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
3154
- home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
3155
- home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
3156
- }
3157
- return home;
3158
- }
3159
- homeFromFirestore(home) {
3160
- var _a;
3161
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3162
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
3163
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
3164
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
3165
- home.data.createdAt =
3166
- home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
3167
- home.data.expiresAt =
3168
- home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
3169
- }
3170
- return home;
3171
- }
3172
- }
3173
-
3174
- class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3175
- constructor({ firestore, interceptors }) {
3176
- super({
3177
- firestore,
3178
- collectionName: 'shopMenus',
3179
- model: ShopMenu,
3180
- interceptors,
3181
- });
3182
- }
3183
- }
3184
-
3185
- class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3186
- constructor({ firestore, interceptors, }) {
3187
- super({
3188
- firestore,
3189
- collectionName: 'shopSettings',
3190
- model: ShopSettings,
3191
- interceptors,
3192
- });
3193
- }
3194
- }
3195
-
3196
3204
  class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3197
3205
  constructor({ firestore, interceptors }) {
3198
3206
  super({
@@ -3323,17 +3331,6 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
3323
3331
  }
3324
3332
  }
3325
3333
 
3326
- class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3327
- constructor({ firestore, interceptors, }) {
3328
- super({
3329
- firestore,
3330
- collectionName: 'paymentBlockedAttempts',
3331
- model: OrderBlocked,
3332
- interceptors,
3333
- });
3334
- }
3335
- }
3336
-
3337
3334
  class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3338
3335
  constructor({ firestore, interceptors }) {
3339
3336
  super({
@@ -3356,136 +3353,87 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
3356
3353
  }
3357
3354
  }
3358
3355
 
3359
- class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3356
+ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3360
3357
  constructor({ firestore, interceptors }) {
3361
3358
  super({
3362
3359
  firestore,
3363
- collectionName: 'leads',
3364
- model: Lead,
3365
- interceptors,
3366
- });
3367
- }
3368
- }
3369
-
3370
- class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3371
- constructor({ firestore, interceptors }, parentRepository) {
3372
- super({
3373
- firestore,
3374
- collectionName: 'editions',
3375
- parentIdField: 'subscriptionId',
3376
- model: Edition,
3377
- interceptors,
3378
- });
3379
- this.parentRepository = parentRepository;
3380
- }
3381
- }
3382
-
3383
- class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3384
- constructor({ firestore, interceptors, }) {
3385
- super({
3386
- firestore,
3387
- collectionName: 'subscription',
3388
- model: Subscription,
3360
+ collectionName: 'dms',
3361
+ model: Home,
3389
3362
  interceptors,
3390
3363
  });
3364
+ this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
3365
+ var _a, _b, _c;
3366
+ return ({
3367
+ category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
3368
+ ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
3369
+ : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
3370
+ 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)) || [],
3371
+ });
3372
+ };
3373
+ this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
3374
+ var _a;
3375
+ return ({
3376
+ category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
3377
+ products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
3378
+ });
3379
+ };
3391
3380
  }
3392
- }
3393
-
3394
- class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3395
- constructor({ firestore, interceptors }, parentRepository) {
3396
- super({
3397
- firestore,
3398
- collectionName: 'payments',
3399
- parentIdField: 'subscriptionId',
3400
- model: SubscriptionPayment,
3401
- interceptors,
3402
- });
3403
- this.parentRepository = parentRepository;
3381
+ buildModelInstance() {
3382
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
3383
+ return {
3384
+ toFirestore: (data) => {
3385
+ const modifiedData = this.homeToFirestore(data);
3386
+ return toFirestore(modifiedData);
3387
+ },
3388
+ fromFirestore: (snap) => {
3389
+ const instance = fromFirestore(snap);
3390
+ return this.homeFromFirestore(instance);
3391
+ },
3392
+ };
3404
3393
  }
3405
- }
3406
-
3407
- class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3408
- constructor({ firestore, interceptors }, parentRepository) {
3409
- super({
3410
- firestore,
3411
- collectionName: 'address',
3412
- parentIdField: 'userId',
3413
- model: UserAddress,
3414
- interceptors,
3415
- });
3416
- this.parentRepository = parentRepository;
3394
+ homeToFirestore(home) {
3395
+ var _a, _b, _c, _d;
3396
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3397
+ home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
3398
+ home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
3399
+ home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
3400
+ }
3401
+ return home;
3417
3402
  }
3418
- }
3419
-
3420
- class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3421
- constructor({ firestore, interceptors }, parentRepository) {
3422
- super({
3423
- firestore,
3424
- collectionName: 'CX',
3425
- parentIdField: 'userId',
3426
- model: BeautyProfile,
3427
- interceptors,
3428
- });
3429
- this.parentRepository = parentRepository;
3403
+ homeFromFirestore(home) {
3404
+ var _a;
3405
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3406
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
3407
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
3408
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
3409
+ home.data.createdAt =
3410
+ home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
3411
+ home.data.expiresAt =
3412
+ home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
3413
+ }
3414
+ return home;
3430
3415
  }
3431
3416
  }
3432
3417
 
3433
- class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3418
+ class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3434
3419
  constructor({ firestore, interceptors }) {
3435
3420
  super({
3436
3421
  firestore,
3437
- collectionName: 'users',
3438
- model: User,
3422
+ collectionName: 'shopMenus',
3423
+ model: ShopMenu,
3439
3424
  interceptors,
3440
3425
  });
3441
3426
  }
3442
- async get(identifiers) {
3443
- const user = await super.get({ id: identifiers.id });
3444
- user.beautyProfile = await this.getBeautyProfile(user.id);
3445
- user.isSubscriber = await this.checkIfIsSubscriber(user.id);
3446
- return user;
3447
- }
3448
- async checkIfExistsByField(field, value) {
3449
- const result = await this.find({ filters: { [field]: value } });
3450
- return result.count > 0;
3451
- }
3452
- buildModelInstance() {
3453
- const { fromFirestore, toFirestore } = super.buildModelInstance();
3454
- return {
3455
- toFirestore: (data) => {
3456
- const plain = toFirestore(data);
3457
- delete plain.isSubscriber;
3458
- return plain;
3459
- },
3460
- fromFirestore,
3461
- };
3462
- }
3463
- async getBeautyProfile(userId) {
3464
- const beautyProfile = await firestore.getDoc(firestore.doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
3465
- return beautyProfile.data();
3466
- }
3467
- async checkIfIsSubscriber(userId) {
3468
- const docs = await firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')));
3469
- return !!docs && !!docs.size;
3470
- }
3471
- buildBeautyProfileModelInstance() {
3472
- return {
3473
- toFirestore: (data) => data.toPlain(),
3474
- fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
3475
- };
3476
- }
3477
3427
  }
3478
3428
 
3479
- class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3480
- constructor({ firestore, interceptors }, parentRepository) {
3429
+ class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3430
+ constructor({ firestore, interceptors, }) {
3481
3431
  super({
3482
3432
  firestore,
3483
- collectionName: 'payment_method',
3484
- parentIdField: 'userId',
3485
- model: UserPaymentMethod,
3433
+ collectionName: 'shopSettings',
3434
+ model: ShopSettings,
3486
3435
  interceptors,
3487
3436
  });
3488
- this.parentRepository = parentRepository;
3489
3437
  }
3490
3438
  }
3491
3439
 
@@ -5740,12 +5688,9 @@ exports.Log = Log;
5740
5688
  exports.Logger = Logger;
5741
5689
  exports.NotFoundError = NotFoundError;
5742
5690
  exports.Order = Order;
5743
- exports.OrderBlocked = OrderBlocked;
5744
- exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
5745
5691
  exports.OrderFirestoreRepository = OrderFirestoreRepository;
5746
5692
  exports.Payment = Payment;
5747
5693
  exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
5748
- exports.PaymentTransaction = PaymentTransaction;
5749
5694
  exports.Product = Product;
5750
5695
  exports.ProductFirestoreRepository = ProductFirestoreRepository;
5751
5696
  exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
@@ -5758,8 +5703,6 @@ exports.Register = Register;
5758
5703
  exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
5759
5704
  exports.RequiredArgumentError = RequiredArgumentError;
5760
5705
  exports.RoundProductPricesHelper = RoundProductPricesHelper;
5761
- exports.Sequence = Sequence;
5762
- exports.SequenceFirestoreRepository = SequenceFirestoreRepository;
5763
5706
  exports.ShippingMethod = ShippingMethod;
5764
5707
  exports.ShopMenu = ShopMenu;
5765
5708
  exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;