@infrab4a/connect 4.1.2-beta.9 → 4.1.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/index.cjs.js +482 -528
  2. package/index.esm.js +483 -524
  3. package/package.json +1 -1
  4. package/src/domain/index.d.ts +3 -4
  5. package/src/domain/shop-settings/models/types/index.d.ts +2 -0
  6. package/src/domain/shop-settings/models/types/landing-page.d.ts +8 -0
  7. package/src/domain/shop-settings/models/types/sections.type.d.ts +3 -0
  8. package/src/domain/shopping/models/index.d.ts +0 -2
  9. package/src/domain/shopping/models/order.d.ts +2 -2
  10. package/src/domain/shopping/models/payment.d.ts +61 -7
  11. package/src/domain/shopping/repositories/index.d.ts +0 -1
  12. package/src/infra/firebase/firestore/repositories/index.d.ts +2 -3
  13. package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +0 -1
  14. package/teste2.d.ts +1 -0
  15. package/src/domain/general/index.d.ts +0 -2
  16. package/src/domain/general/models/index.d.ts +0 -1
  17. package/src/domain/general/models/sequences.d.ts +0 -9
  18. package/src/domain/general/repositories/index.d.ts +0 -1
  19. package/src/domain/general/repositories/sequences.repository.d.ts +0 -4
  20. package/src/domain/shopping/models/order-blocked.d.ts +0 -26
  21. package/src/domain/shopping/models/payment.transaction.d.ts +0 -66
  22. package/src/domain/shopping/repositories/order-blocked.repository.d.ts +0 -4
  23. package/src/infra/firebase/firestore/repositories/general/index.d.ts +0 -1
  24. package/src/infra/firebase/firestore/repositories/general/sequences-firestore.repository.d.ts +0 -7
  25. package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +0 -7
package/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'reflect-metadata';
2
+ import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transformer';
2
3
  import * as tslib_1 from 'tslib';
3
4
  import { __decorate, __metadata, __rest } from 'tslib';
4
- import { plainToInstance, instanceToPlain, Type, Expose } from 'class-transformer';
5
5
  import { parseISO } from 'date-fns';
6
6
  export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
7
7
  import { isNil, isArray as isArray$1, first, last, flatten, compact, get, isString, each, unset, isObject as isObject$1, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
@@ -36,181 +36,6 @@ class BaseModel {
36
36
  }
37
37
  }
38
38
 
39
- class Filter extends BaseModel {
40
- static get identifiersFields() {
41
- return ['id'];
42
- }
43
- }
44
-
45
- class CategoryBase extends BaseModel {
46
- static get identifiersFields() {
47
- return ['id'];
48
- }
49
- }
50
- __decorate([
51
- Type(() => CategoryBase),
52
- __metadata("design:type", CategoryBase)
53
- ], CategoryBase.prototype, "parent", void 0);
54
- __decorate([
55
- Type(() => Filter),
56
- __metadata("design:type", Array)
57
- ], CategoryBase.prototype, "filters", void 0);
58
-
59
- class CategoryForProduct extends CategoryBase {
60
- static get identifiersFields() {
61
- return ['id'];
62
- }
63
- }
64
-
65
- class ProductBase extends BaseModel {
66
- get evaluation() {
67
- return {
68
- reviews: this.reviews,
69
- count: this.reviewsTotal,
70
- rating: this.rate,
71
- };
72
- }
73
- set evaluation(evaluation) {
74
- if (!evaluation) {
75
- this.reviews = null;
76
- this.reviewsTotal = null;
77
- this.rate = null;
78
- return;
79
- }
80
- this.reviews = evaluation.reviews || this.reviews;
81
- this.reviewsTotal = evaluation.count || this.reviewsTotal;
82
- this.rate = evaluation.rating || this.rate;
83
- }
84
- static get identifiersFields() {
85
- return ['id'];
86
- }
87
- }
88
-
89
- class ProductForKit extends ProductBase {
90
- static get identifiersFields() {
91
- return ['id'];
92
- }
93
- }
94
- __decorate([
95
- Type(() => CategoryForProduct),
96
- __metadata("design:type", CategoryForProduct)
97
- ], ProductForKit.prototype, "category", void 0);
98
-
99
- class KitProduct extends BaseModel {
100
- static get identifiersFields() {
101
- return ['productId', 'kitProductId'];
102
- }
103
- }
104
- __decorate([
105
- Type(() => ProductForKit),
106
- __metadata("design:type", ProductForKit)
107
- ], KitProduct.prototype, "kit", void 0);
108
- __decorate([
109
- Type(() => ProductForKit),
110
- __metadata("design:type", ProductForKit)
111
- ], KitProduct.prototype, "product", void 0);
112
-
113
- class ProductForCategory extends ProductBase {
114
- static get identifiersFields() {
115
- return ['id'];
116
- }
117
- }
118
- __decorate([
119
- Type(() => KitProduct),
120
- __metadata("design:type", Array)
121
- ], ProductForCategory.prototype, "kitProducts", void 0);
122
-
123
- class Category extends CategoryBase {
124
- static get identifiersFields() {
125
- return ['id'];
126
- }
127
- }
128
- __decorate([
129
- Type(() => ProductForCategory),
130
- __metadata("design:type", Array)
131
- ], Category.prototype, "childrenProducts", void 0);
132
-
133
- class CategoryCollectionChildren extends BaseModel {
134
- static get identifiersFields() {
135
- return ['collectionId', 'categoryId'];
136
- }
137
- }
138
- __decorate([
139
- Type(() => CategoryCollectionChildren),
140
- __metadata("design:type", CategoryCollectionChildren)
141
- ], CategoryCollectionChildren.prototype, "parent", void 0);
142
-
143
- class CategoryFilter extends BaseModel {
144
- static get identifiersFields() {
145
- return ['id'];
146
- }
147
- }
148
- __decorate([
149
- Type(() => Filter),
150
- __metadata("design:type", Filter)
151
- ], CategoryFilter.prototype, "filter", void 0);
152
- __decorate([
153
- Type(() => Category),
154
- __metadata("design:type", Category)
155
- ], CategoryFilter.prototype, "category", void 0);
156
-
157
- var GenderDestination;
158
- (function (GenderDestination) {
159
- GenderDestination["FEMALE"] = "female";
160
- GenderDestination["MALE"] = "male";
161
- GenderDestination["UNISEX"] = "unisex";
162
- })(GenderDestination || (GenderDestination = {}));
163
-
164
- var Shops;
165
- (function (Shops) {
166
- Shops["MENSMARKET"] = "mensmarket";
167
- Shops["GLAMSHOP"] = "Glamshop";
168
- Shops["GLAMPOINTS"] = "Glampoints";
169
- Shops["ALL"] = "ALL";
170
- })(Shops || (Shops = {}));
171
-
172
- class FilterOption extends BaseModel {
173
- static get identifiersFields() {
174
- return ['id'];
175
- }
176
- }
177
-
178
- class Product extends ProductBase {
179
- static get identifiersFields() {
180
- return ['id'];
181
- }
182
- }
183
- __decorate([
184
- Type(() => CategoryForProduct),
185
- __metadata("design:type", CategoryForProduct)
186
- ], Product.prototype, "category", void 0);
187
- __decorate([
188
- Type(() => KitProduct),
189
- __metadata("design:type", Array)
190
- ], Product.prototype, "kitProducts", void 0);
191
-
192
- class Variant extends BaseModel {
193
- static get identifiersFields() {
194
- return ['id', 'productId'];
195
- }
196
- }
197
-
198
- class Wishlist extends Category {
199
- static get identifiersFields() {
200
- return ['id'];
201
- }
202
- }
203
-
204
- class Buy2Win extends BaseModel {
205
- static get identifiersFields() {
206
- return ['id'];
207
- }
208
- }
209
- __decorate([
210
- Type(() => Category),
211
- __metadata("design:type", Array)
212
- ], Buy2Win.prototype, "categories", void 0);
213
-
214
39
  var Where;
215
40
  (function (Where) {
216
41
  Where["EQUALS"] = "==";
@@ -236,18 +61,6 @@ var UpdateOptionActions;
236
61
  UpdateOptionActions["NULL"] = "null";
237
62
  })(UpdateOptionActions || (UpdateOptionActions = {}));
238
63
 
239
- class CampaignDashboard extends BaseModel {
240
- static get identifiersFields() {
241
- return ['id'];
242
- }
243
- }
244
-
245
- class CampaignHashtag extends BaseModel {
246
- static get identifiersFields() {
247
- return ['id'];
248
- }
249
- }
250
-
251
64
  var AccessoryImportances;
252
65
  (function (AccessoryImportances) {
253
66
  AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
@@ -474,178 +287,171 @@ class Edition extends BaseModel {
474
287
  }
475
288
  }
476
289
 
477
- class PaymentTransaction extends BaseModel {
290
+ class Payment extends BaseModel {
291
+ static get identifiersFields() {
292
+ return ['id'];
293
+ }
478
294
  }
479
295
  __decorate([
480
296
  Expose({ name: 'refuse_reason' }),
481
297
  __metadata("design:type", String)
482
- ], PaymentTransaction.prototype, "refuseReason", void 0);
298
+ ], Payment.prototype, "refuseReason", void 0);
483
299
  __decorate([
484
300
  Expose({ name: 'status_reason' }),
485
301
  __metadata("design:type", String)
486
- ], PaymentTransaction.prototype, "statusReason", void 0);
302
+ ], Payment.prototype, "statusReason", void 0);
487
303
  __decorate([
488
304
  Expose({ name: 'acquirer_response_code' }),
489
305
  __metadata("design:type", String)
490
- ], PaymentTransaction.prototype, "acquirerResponseCode", void 0);
306
+ ], Payment.prototype, "acquirerResponseCode", void 0);
491
307
  __decorate([
492
308
  Expose({ name: 'acquirer_name' }),
493
309
  __metadata("design:type", String)
494
- ], PaymentTransaction.prototype, "acquirerName", void 0);
310
+ ], Payment.prototype, "acquirerName", void 0);
495
311
  __decorate([
496
312
  Expose({ name: 'acquirer_id' }),
497
313
  __metadata("design:type", String)
498
- ], PaymentTransaction.prototype, "acquirerId", void 0);
314
+ ], Payment.prototype, "acquirerId", void 0);
499
315
  __decorate([
500
316
  Expose({ name: 'authorization_code' }),
501
317
  __metadata("design:type", String)
502
- ], PaymentTransaction.prototype, "authorizationCode", void 0);
318
+ ], Payment.prototype, "authorizationCode", void 0);
503
319
  __decorate([
504
320
  Expose({ name: 'soft_descriptor' }),
505
321
  __metadata("design:type", String)
506
- ], PaymentTransaction.prototype, "softDescriptor", void 0);
322
+ ], Payment.prototype, "softDescriptor", void 0);
507
323
  __decorate([
508
324
  Expose({ name: 'date_created' }),
509
325
  __metadata("design:type", String)
510
- ], PaymentTransaction.prototype, "dateCreated", void 0);
326
+ ], Payment.prototype, "dateCreated", void 0);
511
327
  __decorate([
512
328
  Expose({ name: 'date_updated' }),
513
329
  __metadata("design:type", String)
514
- ], PaymentTransaction.prototype, "dateUpdated", void 0);
330
+ ], Payment.prototype, "dateUpdated", void 0);
515
331
  __decorate([
516
332
  Expose({ name: 'authorized_amount' }),
517
333
  __metadata("design:type", Number)
518
- ], PaymentTransaction.prototype, "authorizedAmount", void 0);
334
+ ], Payment.prototype, "authorizedAmount", void 0);
519
335
  __decorate([
520
336
  Expose({ name: 'paid_amount' }),
521
337
  __metadata("design:type", Number)
522
- ], PaymentTransaction.prototype, "paidAmount", void 0);
338
+ ], Payment.prototype, "paidAmount", void 0);
523
339
  __decorate([
524
340
  Expose({ name: 'refunded_amount' }),
525
341
  __metadata("design:type", Number)
526
- ], PaymentTransaction.prototype, "refundedAmount", void 0);
342
+ ], Payment.prototype, "refundedAmount", void 0);
527
343
  __decorate([
528
344
  Expose({ name: 'card_holder_name' }),
529
345
  __metadata("design:type", String)
530
- ], PaymentTransaction.prototype, "cardHolderName", void 0);
346
+ ], Payment.prototype, "cardHolderName", void 0);
531
347
  __decorate([
532
348
  Expose({ name: 'card_last_digits' }),
533
349
  __metadata("design:type", String)
534
- ], PaymentTransaction.prototype, "cardLastDigits", void 0);
350
+ ], Payment.prototype, "cardLastDigits", void 0);
535
351
  __decorate([
536
352
  Expose({ name: 'card_first_digits' }),
537
353
  __metadata("design:type", String)
538
- ], PaymentTransaction.prototype, "cardFirstDigits", void 0);
354
+ ], Payment.prototype, "cardFirstDigits", void 0);
539
355
  __decorate([
540
356
  Expose({ name: 'card_brand' }),
541
357
  __metadata("design:type", String)
542
- ], PaymentTransaction.prototype, "cardBrand", void 0);
358
+ ], Payment.prototype, "cardBrand", void 0);
543
359
  __decorate([
544
360
  Expose({ name: 'card_pin_mode' }),
545
361
  __metadata("design:type", String)
546
- ], PaymentTransaction.prototype, "cardPinMode", void 0);
362
+ ], Payment.prototype, "cardPinMode", void 0);
547
363
  __decorate([
548
364
  Expose({ name: 'card_magstripe_fallback' }),
549
365
  __metadata("design:type", Boolean)
550
- ], PaymentTransaction.prototype, "cardMagstripeFallback", void 0);
366
+ ], Payment.prototype, "cardMagstripeFallback", void 0);
551
367
  __decorate([
552
368
  Expose({ name: 'cvm_pin' }),
553
369
  __metadata("design:type", Boolean)
554
- ], PaymentTransaction.prototype, "cvmPin", void 0);
370
+ ], Payment.prototype, "cvmPin", void 0);
555
371
  __decorate([
556
372
  Expose({ name: 'postback_url' }),
557
373
  __metadata("design:type", String)
558
- ], PaymentTransaction.prototype, "postbackUrl", void 0);
374
+ ], Payment.prototype, "postbackUrl", void 0);
559
375
  __decorate([
560
376
  Expose({ name: 'payment_method' }),
561
377
  __metadata("design:type", String)
562
- ], PaymentTransaction.prototype, "paymentMethod", void 0);
378
+ ], Payment.prototype, "paymentMethod", void 0);
563
379
  __decorate([
564
380
  Expose({ name: 'capture_method' }),
565
381
  __metadata("design:type", String)
566
- ], PaymentTransaction.prototype, "captureMethod", void 0);
382
+ ], Payment.prototype, "captureMethod", void 0);
567
383
  __decorate([
568
384
  Expose({ name: 'antifraud_score' }),
569
385
  __metadata("design:type", String)
570
- ], PaymentTransaction.prototype, "antifraudScore", void 0);
386
+ ], Payment.prototype, "antifraudScore", void 0);
571
387
  __decorate([
572
388
  Expose({ name: 'boleto_url' }),
573
389
  __metadata("design:type", String)
574
- ], PaymentTransaction.prototype, "boletoUrl", void 0);
390
+ ], Payment.prototype, "boletoUrl", void 0);
575
391
  __decorate([
576
392
  Expose({ name: 'boleto_barcode' }),
577
393
  __metadata("design:type", String)
578
- ], PaymentTransaction.prototype, "boletoBarcode", void 0);
394
+ ], Payment.prototype, "boletoBarcode", void 0);
579
395
  __decorate([
580
396
  Expose({ name: 'boleto_expiration_date' }),
581
397
  __metadata("design:type", String)
582
- ], PaymentTransaction.prototype, "boletoExpirationDate", void 0);
398
+ ], Payment.prototype, "boletoExpirationDate", void 0);
583
399
  __decorate([
584
400
  Expose({ name: 'subscription_id' }),
585
401
  __metadata("design:type", String)
586
- ], PaymentTransaction.prototype, "subscriptionId", void 0);
402
+ ], Payment.prototype, "subscriptionId", void 0);
587
403
  __decorate([
588
404
  Expose({ name: 'split_rules' }),
589
405
  __metadata("design:type", String)
590
- ], PaymentTransaction.prototype, "splitRules", void 0);
406
+ ], Payment.prototype, "splitRules", void 0);
591
407
  __decorate([
592
408
  Expose({ name: 'antifraud_metadata' }),
593
409
  __metadata("design:type", Object)
594
- ], PaymentTransaction.prototype, "antifraudMetadata", void 0);
410
+ ], Payment.prototype, "antifraudMetadata", void 0);
595
411
  __decorate([
596
412
  Expose({ name: 'reference_key' }),
597
413
  __metadata("design:type", String)
598
- ], PaymentTransaction.prototype, "referenceKey", void 0);
414
+ ], Payment.prototype, "referenceKey", void 0);
599
415
  __decorate([
600
416
  Expose({ name: 'local_transaction_id' }),
601
417
  __metadata("design:type", String)
602
- ], PaymentTransaction.prototype, "localTransactionId", void 0);
418
+ ], Payment.prototype, "localTransactionId", void 0);
603
419
  __decorate([
604
420
  Expose({ name: 'local_time' }),
605
421
  __metadata("design:type", String)
606
- ], PaymentTransaction.prototype, "localTime", void 0);
422
+ ], Payment.prototype, "localTime", void 0);
607
423
  __decorate([
608
424
  Expose({ name: 'fraud_covered' }),
609
425
  __metadata("design:type", Boolean)
610
- ], PaymentTransaction.prototype, "fraudCovered", void 0);
426
+ ], Payment.prototype, "fraudCovered", void 0);
611
427
  __decorate([
612
428
  Expose({ name: 'fraud_reimbursed' }),
613
429
  __metadata("design:type", String)
614
- ], PaymentTransaction.prototype, "fraudReimbursed", void 0);
430
+ ], Payment.prototype, "fraudReimbursed", void 0);
615
431
  __decorate([
616
432
  Expose({ name: 'order_id' }),
617
433
  __metadata("design:type", String)
618
- ], PaymentTransaction.prototype, "orderId", void 0);
434
+ ], Payment.prototype, "orderId", void 0);
619
435
  __decorate([
620
436
  Expose({ name: 'risk_level' }),
621
437
  __metadata("design:type", String)
622
- ], PaymentTransaction.prototype, "riskLevel", void 0);
438
+ ], Payment.prototype, "riskLevel", void 0);
623
439
  __decorate([
624
440
  Expose({ name: 'receipt_url' }),
625
441
  __metadata("design:type", String)
626
- ], PaymentTransaction.prototype, "receiptUrl", void 0);
442
+ ], Payment.prototype, "receiptUrl", void 0);
627
443
  __decorate([
628
444
  Expose({ name: 'private_label' }),
629
445
  __metadata("design:type", String)
630
- ], PaymentTransaction.prototype, "privateLabel", void 0);
446
+ ], Payment.prototype, "privateLabel", void 0);
631
447
  __decorate([
632
448
  Expose({ name: 'pix_qr_code' }),
633
449
  __metadata("design:type", String)
634
- ], PaymentTransaction.prototype, "pixQrCode", void 0);
450
+ ], Payment.prototype, "pixQrCode", void 0);
635
451
  __decorate([
636
452
  Expose({ name: 'pix_expiration_date' }),
637
453
  __metadata("design:type", String)
638
- ], PaymentTransaction.prototype, "pixExpirationDate", void 0);
639
-
640
- class Payment extends BaseModel {
641
- static get identifiersFields() {
642
- return ['id'];
643
- }
644
- }
645
- __decorate([
646
- Type(() => PaymentTransaction),
647
- __metadata("design:type", PaymentTransaction)
648
- ], Payment.prototype, "transaction", void 0);
454
+ ], Payment.prototype, "pixExpirationDate", void 0);
649
455
 
650
456
  class SubscriptionPayment extends BaseModel {
651
457
  static get identifiersFields() {
@@ -2157,75 +1963,256 @@ class RecoveryPassword {
2157
1963
  }
2158
1964
  }
2159
1965
 
2160
- class LineItem extends Product {
2161
- }
2162
-
2163
- class ShippingMethod extends BaseModel {
1966
+ class Filter extends BaseModel {
2164
1967
  static get identifiersFields() {
2165
1968
  return ['id'];
2166
1969
  }
2167
1970
  }
2168
1971
 
2169
- class Checkout extends BaseModel {
1972
+ class CategoryBase extends BaseModel {
2170
1973
  static get identifiersFields() {
2171
1974
  return ['id'];
2172
1975
  }
2173
1976
  }
2174
1977
  __decorate([
2175
- Type(() => LineItem),
2176
- __metadata("design:type", Array)
2177
- ], Checkout.prototype, "lineItems", void 0);
2178
- __decorate([
2179
- Type(() => User),
2180
- __metadata("design:type", User)
2181
- ], Checkout.prototype, "user", void 0);
2182
- __decorate([
2183
- Type(() => UserAddress),
2184
- __metadata("design:type", UserAddress)
2185
- ], Checkout.prototype, "shippingAddress", void 0);
2186
- __decorate([
2187
- Type(() => UserAddress),
2188
- __metadata("design:type", UserAddress)
2189
- ], Checkout.prototype, "billingAddress", void 0);
2190
- __decorate([
2191
- Type(() => ShippingMethod),
2192
- __metadata("design:type", ShippingMethod)
2193
- ], Checkout.prototype, "shipping", void 0);
2194
- __decorate([
2195
- Type(() => Coupon),
2196
- __metadata("design:type", Coupon)
2197
- ], Checkout.prototype, "coupon", void 0);
2198
-
2199
- var OrderStatus;
2200
- (function (OrderStatus) {
2201
- OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
2202
- OrderStatus["EM_PREPARO"] = "Preparando pedido";
2203
- OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
2204
- OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
2205
- OrderStatus["ENVIADO"] = "Enviado";
2206
- OrderStatus["ENTREGUE"] = "Entregue";
2207
- OrderStatus["CANCELADO"] = "Cancelado";
2208
- OrderStatus["CREDIT_CARD"] = "credit_card";
2209
- })(OrderStatus || (OrderStatus = {}));
2210
-
2211
- class Order extends Checkout {
2212
- }
1978
+ Type(() => CategoryBase),
1979
+ __metadata("design:type", CategoryBase)
1980
+ ], CategoryBase.prototype, "parent", void 0);
2213
1981
  __decorate([
2214
- Type(() => PaymentTransaction),
2215
- __metadata("design:type", PaymentTransaction)
2216
- ], Order.prototype, "payment", void 0);
1982
+ Type(() => Filter),
1983
+ __metadata("design:type", Array)
1984
+ ], CategoryBase.prototype, "filters", void 0);
2217
1985
 
2218
- class OrderBlocked extends BaseModel {
1986
+ class CategoryForProduct extends CategoryBase {
2219
1987
  static get identifiersFields() {
2220
1988
  return ['id'];
2221
1989
  }
2222
1990
  }
2223
1991
 
2224
- class CheckoutSubscription extends BaseModel {
2225
- static get identifiersFields() {
2226
- return ['id'];
2227
- }
2228
- }
1992
+ class ProductBase extends BaseModel {
1993
+ get evaluation() {
1994
+ return {
1995
+ reviews: this.reviews,
1996
+ count: this.reviewsTotal,
1997
+ rating: this.rate,
1998
+ };
1999
+ }
2000
+ set evaluation(evaluation) {
2001
+ if (!evaluation) {
2002
+ this.reviews = null;
2003
+ this.reviewsTotal = null;
2004
+ this.rate = null;
2005
+ return;
2006
+ }
2007
+ this.reviews = evaluation.reviews || this.reviews;
2008
+ this.reviewsTotal = evaluation.count || this.reviewsTotal;
2009
+ this.rate = evaluation.rating || this.rate;
2010
+ }
2011
+ static get identifiersFields() {
2012
+ return ['id'];
2013
+ }
2014
+ }
2015
+
2016
+ class ProductForKit extends ProductBase {
2017
+ static get identifiersFields() {
2018
+ return ['id'];
2019
+ }
2020
+ }
2021
+ __decorate([
2022
+ Type(() => CategoryForProduct),
2023
+ __metadata("design:type", CategoryForProduct)
2024
+ ], ProductForKit.prototype, "category", void 0);
2025
+
2026
+ class KitProduct extends BaseModel {
2027
+ static get identifiersFields() {
2028
+ return ['productId', 'kitProductId'];
2029
+ }
2030
+ }
2031
+ __decorate([
2032
+ Type(() => ProductForKit),
2033
+ __metadata("design:type", ProductForKit)
2034
+ ], KitProduct.prototype, "kit", void 0);
2035
+ __decorate([
2036
+ Type(() => ProductForKit),
2037
+ __metadata("design:type", ProductForKit)
2038
+ ], KitProduct.prototype, "product", void 0);
2039
+
2040
+ class ProductForCategory extends ProductBase {
2041
+ static get identifiersFields() {
2042
+ return ['id'];
2043
+ }
2044
+ }
2045
+ __decorate([
2046
+ Type(() => KitProduct),
2047
+ __metadata("design:type", Array)
2048
+ ], ProductForCategory.prototype, "kitProducts", void 0);
2049
+
2050
+ class Category extends CategoryBase {
2051
+ static get identifiersFields() {
2052
+ return ['id'];
2053
+ }
2054
+ }
2055
+ __decorate([
2056
+ Type(() => ProductForCategory),
2057
+ __metadata("design:type", Array)
2058
+ ], Category.prototype, "childrenProducts", void 0);
2059
+
2060
+ class CategoryCollectionChildren extends BaseModel {
2061
+ static get identifiersFields() {
2062
+ return ['collectionId', 'categoryId'];
2063
+ }
2064
+ }
2065
+ __decorate([
2066
+ Type(() => CategoryCollectionChildren),
2067
+ __metadata("design:type", CategoryCollectionChildren)
2068
+ ], CategoryCollectionChildren.prototype, "parent", void 0);
2069
+
2070
+ class CategoryFilter extends BaseModel {
2071
+ static get identifiersFields() {
2072
+ return ['id'];
2073
+ }
2074
+ }
2075
+ __decorate([
2076
+ Type(() => Filter),
2077
+ __metadata("design:type", Filter)
2078
+ ], CategoryFilter.prototype, "filter", void 0);
2079
+ __decorate([
2080
+ Type(() => Category),
2081
+ __metadata("design:type", Category)
2082
+ ], CategoryFilter.prototype, "category", void 0);
2083
+
2084
+ var GenderDestination;
2085
+ (function (GenderDestination) {
2086
+ GenderDestination["FEMALE"] = "female";
2087
+ GenderDestination["MALE"] = "male";
2088
+ GenderDestination["UNISEX"] = "unisex";
2089
+ })(GenderDestination || (GenderDestination = {}));
2090
+
2091
+ var Shops;
2092
+ (function (Shops) {
2093
+ Shops["MENSMARKET"] = "mensmarket";
2094
+ Shops["GLAMSHOP"] = "Glamshop";
2095
+ Shops["GLAMPOINTS"] = "Glampoints";
2096
+ Shops["ALL"] = "ALL";
2097
+ })(Shops || (Shops = {}));
2098
+
2099
+ class FilterOption extends BaseModel {
2100
+ static get identifiersFields() {
2101
+ return ['id'];
2102
+ }
2103
+ }
2104
+
2105
+ class Product extends ProductBase {
2106
+ static get identifiersFields() {
2107
+ return ['id'];
2108
+ }
2109
+ }
2110
+ __decorate([
2111
+ Type(() => CategoryForProduct),
2112
+ __metadata("design:type", CategoryForProduct)
2113
+ ], Product.prototype, "category", void 0);
2114
+ __decorate([
2115
+ Type(() => KitProduct),
2116
+ __metadata("design:type", Array)
2117
+ ], Product.prototype, "kitProducts", void 0);
2118
+
2119
+ class Variant extends BaseModel {
2120
+ static get identifiersFields() {
2121
+ return ['id', 'productId'];
2122
+ }
2123
+ }
2124
+
2125
+ class Wishlist extends Category {
2126
+ static get identifiersFields() {
2127
+ return ['id'];
2128
+ }
2129
+ }
2130
+
2131
+ class Buy2Win extends BaseModel {
2132
+ static get identifiersFields() {
2133
+ return ['id'];
2134
+ }
2135
+ }
2136
+ __decorate([
2137
+ Type(() => Category),
2138
+ __metadata("design:type", Array)
2139
+ ], Buy2Win.prototype, "categories", void 0);
2140
+
2141
+ class CampaignDashboard extends BaseModel {
2142
+ static get identifiersFields() {
2143
+ return ['id'];
2144
+ }
2145
+ }
2146
+
2147
+ class CampaignHashtag extends BaseModel {
2148
+ static get identifiersFields() {
2149
+ return ['id'];
2150
+ }
2151
+ }
2152
+
2153
+ class LineItem extends Product {
2154
+ }
2155
+
2156
+ class ShippingMethod extends BaseModel {
2157
+ static get identifiersFields() {
2158
+ return ['id'];
2159
+ }
2160
+ }
2161
+
2162
+ class Checkout extends BaseModel {
2163
+ static get identifiersFields() {
2164
+ return ['id'];
2165
+ }
2166
+ }
2167
+ __decorate([
2168
+ Type(() => LineItem),
2169
+ __metadata("design:type", Array)
2170
+ ], Checkout.prototype, "lineItems", void 0);
2171
+ __decorate([
2172
+ Type(() => User),
2173
+ __metadata("design:type", User)
2174
+ ], Checkout.prototype, "user", void 0);
2175
+ __decorate([
2176
+ Type(() => UserAddress),
2177
+ __metadata("design:type", UserAddress)
2178
+ ], Checkout.prototype, "shippingAddress", void 0);
2179
+ __decorate([
2180
+ Type(() => UserAddress),
2181
+ __metadata("design:type", UserAddress)
2182
+ ], Checkout.prototype, "billingAddress", void 0);
2183
+ __decorate([
2184
+ Type(() => ShippingMethod),
2185
+ __metadata("design:type", ShippingMethod)
2186
+ ], Checkout.prototype, "shipping", void 0);
2187
+ __decorate([
2188
+ Type(() => Coupon),
2189
+ __metadata("design:type", Coupon)
2190
+ ], Checkout.prototype, "coupon", void 0);
2191
+
2192
+ var OrderStatus;
2193
+ (function (OrderStatus) {
2194
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
2195
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
2196
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
2197
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
2198
+ OrderStatus["ENVIADO"] = "Enviado";
2199
+ OrderStatus["ENTREGUE"] = "Entregue";
2200
+ OrderStatus["CANCELADO"] = "Cancelado";
2201
+ OrderStatus["CREDIT_CARD"] = "credit_card";
2202
+ })(OrderStatus || (OrderStatus = {}));
2203
+
2204
+ class Order extends Checkout {
2205
+ }
2206
+ __decorate([
2207
+ Type(() => Payment),
2208
+ __metadata("design:type", Payment)
2209
+ ], Order.prototype, "payment", void 0);
2210
+
2211
+ class CheckoutSubscription extends BaseModel {
2212
+ static get identifiersFields() {
2213
+ return ['id'];
2214
+ }
2215
+ }
2229
2216
  __decorate([
2230
2217
  Type(() => UserAddress),
2231
2218
  __metadata("design:type", UserAddress)
@@ -2257,12 +2244,6 @@ class RoundProductPricesHelper {
2257
2244
  }
2258
2245
  }
2259
2246
 
2260
- class Sequence extends BaseModel {
2261
- static get identifiersFields() {
2262
- return ['id'];
2263
- }
2264
- }
2265
-
2266
2247
  var FilterType;
2267
2248
  (function (FilterType) {
2268
2249
  FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
@@ -2777,7 +2758,7 @@ const withFindFirestore = (MixinBase) => {
2777
2758
  const collection = this.collection(this.buildCollectionPathForFind(find.filters));
2778
2759
  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;
2779
2760
  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 }));
2780
- const { filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
2761
+ const { filters, limits, orderBy } = intercepted.find || find;
2781
2762
  const queries = this.makeFirestoreWhere(filters || {});
2782
2763
  const ordination = this.makeFirestoreOrderBy(filters, orderBy);
2783
2764
  const offsets = await this.defineLimits(filters, limits);
@@ -2935,25 +2916,158 @@ const withCrudFirestore = (MixinBase) => {
2935
2916
  };
2936
2917
  };
2937
2918
 
2938
- class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2919
+ class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2939
2920
  constructor({ firestore, interceptors }) {
2940
2921
  super({
2941
2922
  firestore,
2942
- collectionName: 'categories',
2943
- model: Category,
2923
+ collectionName: 'leads',
2924
+ model: Lead,
2944
2925
  interceptors,
2945
2926
  });
2946
2927
  }
2947
- async getCategoryBySlug(slug, shop) {
2948
- const categoryDocs = await getDocs(query(this.collection(this.collectionName), where('slug', '==', slug), where('shop', '==', shop), where('published', '==', true)));
2949
- if (categoryDocs.size > 1)
2950
- throw new DuplicatedResultsError('Query returned duplicated values');
2951
- if (categoryDocs.empty)
2952
- throw new NotFoundError(`Document with slug ${slug} not found`);
2953
- return categoryDocs.docs[0].data();
2928
+ }
2929
+
2930
+ class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2931
+ constructor({ firestore, interceptors }, parentRepository) {
2932
+ super({
2933
+ firestore,
2934
+ collectionName: 'editions',
2935
+ parentIdField: 'subscriptionId',
2936
+ model: Edition,
2937
+ interceptors,
2938
+ });
2939
+ this.parentRepository = parentRepository;
2954
2940
  }
2955
- async getCategoriesForHome(categoryIds, limit = 4, gender) {
2956
- const categorySnap = await getDocs(query(this.collection(this.collectionName), where('id', 'in', categoryIds.filter(Boolean)), where('published', '==', true)));
2941
+ }
2942
+
2943
+ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2944
+ constructor({ firestore, interceptors, }) {
2945
+ super({
2946
+ firestore,
2947
+ collectionName: 'subscription',
2948
+ model: Subscription,
2949
+ interceptors,
2950
+ });
2951
+ }
2952
+ }
2953
+
2954
+ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2955
+ constructor({ firestore, interceptors }, parentRepository) {
2956
+ super({
2957
+ firestore,
2958
+ collectionName: 'payments',
2959
+ parentIdField: 'subscriptionId',
2960
+ model: SubscriptionPayment,
2961
+ interceptors,
2962
+ });
2963
+ this.parentRepository = parentRepository;
2964
+ }
2965
+ }
2966
+
2967
+ class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2968
+ constructor({ firestore, interceptors }, parentRepository) {
2969
+ super({
2970
+ firestore,
2971
+ collectionName: 'address',
2972
+ parentIdField: 'userId',
2973
+ model: UserAddress,
2974
+ interceptors,
2975
+ });
2976
+ this.parentRepository = parentRepository;
2977
+ }
2978
+ }
2979
+
2980
+ class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2981
+ constructor({ firestore, interceptors }, parentRepository) {
2982
+ super({
2983
+ firestore,
2984
+ collectionName: 'CX',
2985
+ parentIdField: 'userId',
2986
+ model: BeautyProfile,
2987
+ interceptors,
2988
+ });
2989
+ this.parentRepository = parentRepository;
2990
+ }
2991
+ }
2992
+
2993
+ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2994
+ constructor({ firestore, interceptors }) {
2995
+ super({
2996
+ firestore,
2997
+ collectionName: 'users',
2998
+ model: User,
2999
+ interceptors,
3000
+ });
3001
+ }
3002
+ async get(identifiers) {
3003
+ const user = await super.get({ id: identifiers.id });
3004
+ user.beautyProfile = await this.getBeautyProfile(user.id);
3005
+ user.isSubscriber = await this.checkIfIsSubscriber(user.id);
3006
+ return user;
3007
+ }
3008
+ async checkIfExistsByField(field, value) {
3009
+ const result = await this.find({ filters: { [field]: value } });
3010
+ return result.count > 0;
3011
+ }
3012
+ buildModelInstance() {
3013
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
3014
+ return {
3015
+ toFirestore: (data) => {
3016
+ const plain = toFirestore(data);
3017
+ delete plain.isSubscriber;
3018
+ return plain;
3019
+ },
3020
+ fromFirestore,
3021
+ };
3022
+ }
3023
+ async getBeautyProfile(userId) {
3024
+ const beautyProfile = await getDoc(doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
3025
+ return beautyProfile.data();
3026
+ }
3027
+ async checkIfIsSubscriber(userId) {
3028
+ const docs = await getDocs(query(this.collection('subscription'), where('user.id', '==', userId), where('status', '==', 'active')));
3029
+ return !!docs && !!docs.size;
3030
+ }
3031
+ buildBeautyProfileModelInstance() {
3032
+ return {
3033
+ toFirestore: (data) => data.toPlain(),
3034
+ fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
3035
+ };
3036
+ }
3037
+ }
3038
+
3039
+ class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3040
+ constructor({ firestore, interceptors }, parentRepository) {
3041
+ super({
3042
+ firestore,
3043
+ collectionName: 'payment_method',
3044
+ parentIdField: 'userId',
3045
+ model: UserPaymentMethod,
3046
+ interceptors,
3047
+ });
3048
+ this.parentRepository = parentRepository;
3049
+ }
3050
+ }
3051
+
3052
+ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3053
+ constructor({ firestore, interceptors }) {
3054
+ super({
3055
+ firestore,
3056
+ collectionName: 'categories',
3057
+ model: Category,
3058
+ interceptors,
3059
+ });
3060
+ }
3061
+ async getCategoryBySlug(slug, shop) {
3062
+ const categoryDocs = await getDocs(query(this.collection(this.collectionName), where('slug', '==', slug), where('shop', '==', shop), where('published', '==', true)));
3063
+ if (categoryDocs.size > 1)
3064
+ throw new DuplicatedResultsError('Query returned duplicated values');
3065
+ if (categoryDocs.empty)
3066
+ throw new NotFoundError(`Document with slug ${slug} not found`);
3067
+ return categoryDocs.docs[0].data();
3068
+ }
3069
+ async getCategoriesForHome(categoryIds, limit = 4, gender) {
3070
+ const categorySnap = await getDocs(query(this.collection(this.collectionName), where('id', 'in', categoryIds.filter(Boolean)), where('published', '==', true)));
2957
3071
  if (categorySnap.empty)
2958
3072
  throw new NotFoundError('Categories not found');
2959
3073
  const categories = categorySnap.docs.map((doc) => doc.data());
@@ -3074,101 +3188,6 @@ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpe
3074
3188
  }
3075
3189
  }
3076
3190
 
3077
- class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3078
- constructor({ firestore, interceptors }) {
3079
- super({
3080
- firestore,
3081
- collectionName: 'sequences',
3082
- model: Sequence,
3083
- interceptors,
3084
- });
3085
- }
3086
- }
3087
-
3088
- class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3089
- constructor({ firestore, interceptors }) {
3090
- super({
3091
- firestore,
3092
- collectionName: 'dms',
3093
- model: Home,
3094
- interceptors,
3095
- });
3096
- this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
3097
- var _a, _b, _c;
3098
- return ({
3099
- category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
3100
- ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
3101
- : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
3102
- 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)) || [],
3103
- });
3104
- };
3105
- this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
3106
- var _a;
3107
- return ({
3108
- category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
3109
- products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
3110
- });
3111
- };
3112
- }
3113
- buildModelInstance() {
3114
- const { fromFirestore, toFirestore } = super.buildModelInstance();
3115
- return {
3116
- toFirestore: (data) => {
3117
- const modifiedData = this.homeToFirestore(data);
3118
- return toFirestore(modifiedData);
3119
- },
3120
- fromFirestore: (snap) => {
3121
- const instance = fromFirestore(snap);
3122
- return this.homeFromFirestore(instance);
3123
- },
3124
- };
3125
- }
3126
- homeToFirestore(home) {
3127
- var _a, _b, _c, _d;
3128
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3129
- home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
3130
- home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
3131
- home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
3132
- }
3133
- return home;
3134
- }
3135
- homeFromFirestore(home) {
3136
- var _a;
3137
- if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3138
- home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
3139
- home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
3140
- home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
3141
- home.data.createdAt =
3142
- home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
3143
- home.data.expiresAt =
3144
- home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
3145
- }
3146
- return home;
3147
- }
3148
- }
3149
-
3150
- class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3151
- constructor({ firestore, interceptors }) {
3152
- super({
3153
- firestore,
3154
- collectionName: 'shopMenus',
3155
- model: ShopMenu,
3156
- interceptors,
3157
- });
3158
- }
3159
- }
3160
-
3161
- class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3162
- constructor({ firestore, interceptors, }) {
3163
- super({
3164
- firestore,
3165
- collectionName: 'shopSettings',
3166
- model: ShopSettings,
3167
- interceptors,
3168
- });
3169
- }
3170
- }
3171
-
3172
3191
  class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3173
3192
  constructor({ firestore, interceptors }) {
3174
3193
  super({
@@ -3299,17 +3318,6 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
3299
3318
  }
3300
3319
  }
3301
3320
 
3302
- class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3303
- constructor({ firestore, interceptors, }) {
3304
- super({
3305
- firestore,
3306
- collectionName: 'paymentBlockedAttempts',
3307
- model: OrderBlocked,
3308
- interceptors,
3309
- });
3310
- }
3311
- }
3312
-
3313
3321
  class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3314
3322
  constructor({ firestore, interceptors }) {
3315
3323
  super({
@@ -3332,136 +3340,87 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
3332
3340
  }
3333
3341
  }
3334
3342
 
3335
- class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3343
+ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3336
3344
  constructor({ firestore, interceptors }) {
3337
3345
  super({
3338
3346
  firestore,
3339
- collectionName: 'leads',
3340
- model: Lead,
3341
- interceptors,
3342
- });
3343
- }
3344
- }
3345
-
3346
- class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3347
- constructor({ firestore, interceptors }, parentRepository) {
3348
- super({
3349
- firestore,
3350
- collectionName: 'editions',
3351
- parentIdField: 'subscriptionId',
3352
- model: Edition,
3353
- interceptors,
3354
- });
3355
- this.parentRepository = parentRepository;
3356
- }
3357
- }
3358
-
3359
- class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3360
- constructor({ firestore, interceptors, }) {
3361
- super({
3362
- firestore,
3363
- collectionName: 'subscription',
3364
- model: Subscription,
3347
+ collectionName: 'dms',
3348
+ model: Home,
3365
3349
  interceptors,
3366
3350
  });
3351
+ this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
3352
+ var _a, _b, _c;
3353
+ return ({
3354
+ category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
3355
+ ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
3356
+ : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
3357
+ 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)) || [],
3358
+ });
3359
+ };
3360
+ this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
3361
+ var _a;
3362
+ return ({
3363
+ category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
3364
+ products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
3365
+ });
3366
+ };
3367
3367
  }
3368
- }
3369
-
3370
- class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3371
- constructor({ firestore, interceptors }, parentRepository) {
3372
- super({
3373
- firestore,
3374
- collectionName: 'payments',
3375
- parentIdField: 'subscriptionId',
3376
- model: SubscriptionPayment,
3377
- interceptors,
3378
- });
3379
- this.parentRepository = parentRepository;
3368
+ buildModelInstance() {
3369
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
3370
+ return {
3371
+ toFirestore: (data) => {
3372
+ const modifiedData = this.homeToFirestore(data);
3373
+ return toFirestore(modifiedData);
3374
+ },
3375
+ fromFirestore: (snap) => {
3376
+ const instance = fromFirestore(snap);
3377
+ return this.homeFromFirestore(instance);
3378
+ },
3379
+ };
3380
3380
  }
3381
- }
3382
-
3383
- class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3384
- constructor({ firestore, interceptors }, parentRepository) {
3385
- super({
3386
- firestore,
3387
- collectionName: 'address',
3388
- parentIdField: 'userId',
3389
- model: UserAddress,
3390
- interceptors,
3391
- });
3392
- this.parentRepository = parentRepository;
3381
+ homeToFirestore(home) {
3382
+ var _a, _b, _c, _d;
3383
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3384
+ home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
3385
+ home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
3386
+ home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
3387
+ }
3388
+ return home;
3393
3389
  }
3394
- }
3395
-
3396
- class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3397
- constructor({ firestore, interceptors }, parentRepository) {
3398
- super({
3399
- firestore,
3400
- collectionName: 'CX',
3401
- parentIdField: 'userId',
3402
- model: BeautyProfile,
3403
- interceptors,
3404
- });
3405
- this.parentRepository = parentRepository;
3390
+ homeFromFirestore(home) {
3391
+ var _a;
3392
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3393
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
3394
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
3395
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
3396
+ home.data.createdAt =
3397
+ home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
3398
+ home.data.expiresAt =
3399
+ home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
3400
+ }
3401
+ return home;
3406
3402
  }
3407
3403
  }
3408
3404
 
3409
- class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3405
+ class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3410
3406
  constructor({ firestore, interceptors }) {
3411
3407
  super({
3412
3408
  firestore,
3413
- collectionName: 'users',
3414
- model: User,
3409
+ collectionName: 'shopMenus',
3410
+ model: ShopMenu,
3415
3411
  interceptors,
3416
3412
  });
3417
3413
  }
3418
- async get(identifiers) {
3419
- const user = await super.get({ id: identifiers.id });
3420
- user.beautyProfile = await this.getBeautyProfile(user.id);
3421
- user.isSubscriber = await this.checkIfIsSubscriber(user.id);
3422
- return user;
3423
- }
3424
- async checkIfExistsByField(field, value) {
3425
- const result = await this.find({ filters: { [field]: value } });
3426
- return result.count > 0;
3427
- }
3428
- buildModelInstance() {
3429
- const { fromFirestore, toFirestore } = super.buildModelInstance();
3430
- return {
3431
- toFirestore: (data) => {
3432
- const plain = toFirestore(data);
3433
- delete plain.isSubscriber;
3434
- return plain;
3435
- },
3436
- fromFirestore,
3437
- };
3438
- }
3439
- async getBeautyProfile(userId) {
3440
- const beautyProfile = await getDoc(doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
3441
- return beautyProfile.data();
3442
- }
3443
- async checkIfIsSubscriber(userId) {
3444
- const docs = await getDocs(query(this.collection('subscription'), where('user.id', '==', userId), where('status', '==', 'active')));
3445
- return !!docs && !!docs.size;
3446
- }
3447
- buildBeautyProfileModelInstance() {
3448
- return {
3449
- toFirestore: (data) => data.toPlain(),
3450
- fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
3451
- };
3452
- }
3453
3414
  }
3454
3415
 
3455
- class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3456
- constructor({ firestore, interceptors }, parentRepository) {
3416
+ class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3417
+ constructor({ firestore, interceptors, }) {
3457
3418
  super({
3458
3419
  firestore,
3459
- collectionName: 'payment_method',
3460
- parentIdField: 'userId',
3461
- model: UserPaymentMethod,
3420
+ collectionName: 'shopSettings',
3421
+ model: ShopSettings,
3462
3422
  interceptors,
3463
3423
  });
3464
- this.parentRepository = parentRepository;
3465
3424
  }
3466
3425
  }
3467
3426
 
@@ -5551,4 +5510,4 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5551
5510
  }
5552
5511
  }
5553
5512
 
5554
- export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentTransaction, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
5513
+ export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };