@infrab4a/connect 4.1.2-beta.5 → 4.1.2-beta.7

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.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'reflect-metadata';
2
- import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transformer';
3
2
  import * as tslib_1 from 'tslib';
4
3
  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,6 +36,181 @@ 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
+
39
214
  var Where;
40
215
  (function (Where) {
41
216
  Where["EQUALS"] = "==";
@@ -61,6 +236,18 @@ var UpdateOptionActions;
61
236
  UpdateOptionActions["NULL"] = "null";
62
237
  })(UpdateOptionActions || (UpdateOptionActions = {}));
63
238
 
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
+
64
251
  var AccessoryImportances;
65
252
  (function (AccessoryImportances) {
66
253
  AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
@@ -287,7 +474,7 @@ class Edition extends BaseModel {
287
474
  }
288
475
  }
289
476
 
290
- class Payment extends BaseModel {
477
+ class Transaction extends BaseModel {
291
478
  static get identifiersFields() {
292
479
  return ['id'];
293
480
  }
@@ -295,163 +482,173 @@ class Payment extends BaseModel {
295
482
  __decorate([
296
483
  Expose({ name: 'refuse_reason' }),
297
484
  __metadata("design:type", String)
298
- ], Payment.prototype, "refuseReason", void 0);
485
+ ], Transaction.prototype, "refuseReason", void 0);
299
486
  __decorate([
300
487
  Expose({ name: 'status_reason' }),
301
488
  __metadata("design:type", String)
302
- ], Payment.prototype, "statusReason", void 0);
489
+ ], Transaction.prototype, "statusReason", void 0);
303
490
  __decorate([
304
491
  Expose({ name: 'acquirer_response_code' }),
305
492
  __metadata("design:type", String)
306
- ], Payment.prototype, "acquirerResponseCode", void 0);
493
+ ], Transaction.prototype, "acquirerResponseCode", void 0);
307
494
  __decorate([
308
495
  Expose({ name: 'acquirer_name' }),
309
496
  __metadata("design:type", String)
310
- ], Payment.prototype, "acquirerName", void 0);
497
+ ], Transaction.prototype, "acquirerName", void 0);
311
498
  __decorate([
312
499
  Expose({ name: 'acquirer_id' }),
313
500
  __metadata("design:type", String)
314
- ], Payment.prototype, "acquirerId", void 0);
501
+ ], Transaction.prototype, "acquirerId", void 0);
315
502
  __decorate([
316
503
  Expose({ name: 'authorization_code' }),
317
504
  __metadata("design:type", String)
318
- ], Payment.prototype, "authorizationCode", void 0);
505
+ ], Transaction.prototype, "authorizationCode", void 0);
319
506
  __decorate([
320
507
  Expose({ name: 'soft_descriptor' }),
321
508
  __metadata("design:type", String)
322
- ], Payment.prototype, "softDescriptor", void 0);
509
+ ], Transaction.prototype, "softDescriptor", void 0);
323
510
  __decorate([
324
511
  Expose({ name: 'date_created' }),
325
512
  __metadata("design:type", String)
326
- ], Payment.prototype, "dateCreated", void 0);
513
+ ], Transaction.prototype, "dateCreated", void 0);
327
514
  __decorate([
328
515
  Expose({ name: 'date_updated' }),
329
516
  __metadata("design:type", String)
330
- ], Payment.prototype, "dateUpdated", void 0);
517
+ ], Transaction.prototype, "dateUpdated", void 0);
331
518
  __decorate([
332
519
  Expose({ name: 'authorized_amount' }),
333
520
  __metadata("design:type", Number)
334
- ], Payment.prototype, "authorizedAmount", void 0);
521
+ ], Transaction.prototype, "authorizedAmount", void 0);
335
522
  __decorate([
336
523
  Expose({ name: 'paid_amount' }),
337
524
  __metadata("design:type", Number)
338
- ], Payment.prototype, "paidAmount", void 0);
525
+ ], Transaction.prototype, "paidAmount", void 0);
339
526
  __decorate([
340
527
  Expose({ name: 'refunded_amount' }),
341
528
  __metadata("design:type", Number)
342
- ], Payment.prototype, "refundedAmount", void 0);
529
+ ], Transaction.prototype, "refundedAmount", void 0);
343
530
  __decorate([
344
531
  Expose({ name: 'card_holder_name' }),
345
532
  __metadata("design:type", String)
346
- ], Payment.prototype, "cardHolderName", void 0);
533
+ ], Transaction.prototype, "cardHolderName", void 0);
347
534
  __decorate([
348
535
  Expose({ name: 'card_last_digits' }),
349
536
  __metadata("design:type", String)
350
- ], Payment.prototype, "cardLastDigits", void 0);
537
+ ], Transaction.prototype, "cardLastDigits", void 0);
351
538
  __decorate([
352
539
  Expose({ name: 'card_first_digits' }),
353
540
  __metadata("design:type", String)
354
- ], Payment.prototype, "cardFirstDigits", void 0);
541
+ ], Transaction.prototype, "cardFirstDigits", void 0);
355
542
  __decorate([
356
543
  Expose({ name: 'card_brand' }),
357
544
  __metadata("design:type", String)
358
- ], Payment.prototype, "cardBrand", void 0);
545
+ ], Transaction.prototype, "cardBrand", void 0);
359
546
  __decorate([
360
547
  Expose({ name: 'card_pin_mode' }),
361
548
  __metadata("design:type", String)
362
- ], Payment.prototype, "cardPinMode", void 0);
549
+ ], Transaction.prototype, "cardPinMode", void 0);
363
550
  __decorate([
364
551
  Expose({ name: 'card_magstripe_fallback' }),
365
552
  __metadata("design:type", Boolean)
366
- ], Payment.prototype, "cardMagstripeFallback", void 0);
553
+ ], Transaction.prototype, "cardMagstripeFallback", void 0);
367
554
  __decorate([
368
555
  Expose({ name: 'cvm_pin' }),
369
556
  __metadata("design:type", Boolean)
370
- ], Payment.prototype, "cvmPin", void 0);
557
+ ], Transaction.prototype, "cvmPin", void 0);
371
558
  __decorate([
372
559
  Expose({ name: 'postback_url' }),
373
560
  __metadata("design:type", String)
374
- ], Payment.prototype, "postbackUrl", void 0);
561
+ ], Transaction.prototype, "postbackUrl", void 0);
375
562
  __decorate([
376
563
  Expose({ name: 'payment_method' }),
377
564
  __metadata("design:type", String)
378
- ], Payment.prototype, "paymentMethod", void 0);
565
+ ], Transaction.prototype, "paymentMethod", void 0);
379
566
  __decorate([
380
567
  Expose({ name: 'capture_method' }),
381
568
  __metadata("design:type", String)
382
- ], Payment.prototype, "captureMethod", void 0);
569
+ ], Transaction.prototype, "captureMethod", void 0);
383
570
  __decorate([
384
571
  Expose({ name: 'antifraud_score' }),
385
572
  __metadata("design:type", String)
386
- ], Payment.prototype, "antifraudScore", void 0);
573
+ ], Transaction.prototype, "antifraudScore", void 0);
387
574
  __decorate([
388
575
  Expose({ name: 'boleto_url' }),
389
576
  __metadata("design:type", String)
390
- ], Payment.prototype, "boletoUrl", void 0);
577
+ ], Transaction.prototype, "boletoUrl", void 0);
391
578
  __decorate([
392
579
  Expose({ name: 'boleto_barcode' }),
393
580
  __metadata("design:type", String)
394
- ], Payment.prototype, "boletoBarcode", void 0);
581
+ ], Transaction.prototype, "boletoBarcode", void 0);
395
582
  __decorate([
396
583
  Expose({ name: 'boleto_expiration_date' }),
397
584
  __metadata("design:type", String)
398
- ], Payment.prototype, "boletoExpirationDate", void 0);
585
+ ], Transaction.prototype, "boletoExpirationDate", void 0);
399
586
  __decorate([
400
587
  Expose({ name: 'subscription_id' }),
401
588
  __metadata("design:type", String)
402
- ], Payment.prototype, "subscriptionId", void 0);
589
+ ], Transaction.prototype, "subscriptionId", void 0);
403
590
  __decorate([
404
591
  Expose({ name: 'split_rules' }),
405
592
  __metadata("design:type", String)
406
- ], Payment.prototype, "splitRules", void 0);
593
+ ], Transaction.prototype, "splitRules", void 0);
407
594
  __decorate([
408
595
  Expose({ name: 'antifraud_metadata' }),
409
596
  __metadata("design:type", Object)
410
- ], Payment.prototype, "antifraudMetadata", void 0);
597
+ ], Transaction.prototype, "antifraudMetadata", void 0);
411
598
  __decorate([
412
599
  Expose({ name: 'reference_key' }),
413
600
  __metadata("design:type", String)
414
- ], Payment.prototype, "referenceKey", void 0);
601
+ ], Transaction.prototype, "referenceKey", void 0);
415
602
  __decorate([
416
603
  Expose({ name: 'local_transaction_id' }),
417
604
  __metadata("design:type", String)
418
- ], Payment.prototype, "localTransactionId", void 0);
605
+ ], Transaction.prototype, "localTransactionId", void 0);
419
606
  __decorate([
420
607
  Expose({ name: 'local_time' }),
421
608
  __metadata("design:type", String)
422
- ], Payment.prototype, "localTime", void 0);
609
+ ], Transaction.prototype, "localTime", void 0);
423
610
  __decorate([
424
611
  Expose({ name: 'fraud_covered' }),
425
612
  __metadata("design:type", Boolean)
426
- ], Payment.prototype, "fraudCovered", void 0);
613
+ ], Transaction.prototype, "fraudCovered", void 0);
427
614
  __decorate([
428
615
  Expose({ name: 'fraud_reimbursed' }),
429
616
  __metadata("design:type", String)
430
- ], Payment.prototype, "fraudReimbursed", void 0);
617
+ ], Transaction.prototype, "fraudReimbursed", void 0);
431
618
  __decorate([
432
619
  Expose({ name: 'order_id' }),
433
620
  __metadata("design:type", String)
434
- ], Payment.prototype, "orderId", void 0);
621
+ ], Transaction.prototype, "orderId", void 0);
435
622
  __decorate([
436
623
  Expose({ name: 'risk_level' }),
437
624
  __metadata("design:type", String)
438
- ], Payment.prototype, "riskLevel", void 0);
625
+ ], Transaction.prototype, "riskLevel", void 0);
439
626
  __decorate([
440
627
  Expose({ name: 'receipt_url' }),
441
628
  __metadata("design:type", String)
442
- ], Payment.prototype, "receiptUrl", void 0);
629
+ ], Transaction.prototype, "receiptUrl", void 0);
443
630
  __decorate([
444
631
  Expose({ name: 'private_label' }),
445
632
  __metadata("design:type", String)
446
- ], Payment.prototype, "privateLabel", void 0);
633
+ ], Transaction.prototype, "privateLabel", void 0);
447
634
  __decorate([
448
635
  Expose({ name: 'pix_qr_code' }),
449
636
  __metadata("design:type", String)
450
- ], Payment.prototype, "pixQrCode", void 0);
637
+ ], Transaction.prototype, "pixQrCode", void 0);
451
638
  __decorate([
452
639
  Expose({ name: 'pix_expiration_date' }),
453
640
  __metadata("design:type", String)
454
- ], Payment.prototype, "pixExpirationDate", void 0);
641
+ ], Transaction.prototype, "pixExpirationDate", void 0);
642
+
643
+ class Payment extends BaseModel {
644
+ static get identifiersFields() {
645
+ return ['id'];
646
+ }
647
+ }
648
+ __decorate([
649
+ Type(() => Transaction),
650
+ __metadata("design:type", Transaction)
651
+ ], Payment.prototype, "transaction", void 0);
455
652
 
456
653
  class SubscriptionPayment extends BaseModel {
457
654
  static get identifiersFields() {
@@ -1963,251 +2160,70 @@ class RecoveryPassword {
1963
2160
  }
1964
2161
  }
1965
2162
 
1966
- class Filter extends BaseModel {
2163
+ class LineItem extends Product {
2164
+ }
2165
+
2166
+ class ShippingMethod extends BaseModel {
1967
2167
  static get identifiersFields() {
1968
2168
  return ['id'];
1969
2169
  }
1970
2170
  }
1971
2171
 
1972
- class CategoryBase extends BaseModel {
2172
+ class Checkout extends BaseModel {
1973
2173
  static get identifiersFields() {
1974
2174
  return ['id'];
1975
2175
  }
1976
2176
  }
1977
2177
  __decorate([
1978
- Type(() => CategoryBase),
1979
- __metadata("design:type", CategoryBase)
1980
- ], CategoryBase.prototype, "parent", void 0);
1981
- __decorate([
1982
- Type(() => Filter),
2178
+ Type(() => LineItem),
1983
2179
  __metadata("design:type", Array)
1984
- ], CategoryBase.prototype, "filters", void 0);
2180
+ ], Checkout.prototype, "lineItems", void 0);
2181
+ __decorate([
2182
+ Type(() => User),
2183
+ __metadata("design:type", User)
2184
+ ], Checkout.prototype, "user", void 0);
2185
+ __decorate([
2186
+ Type(() => UserAddress),
2187
+ __metadata("design:type", UserAddress)
2188
+ ], Checkout.prototype, "shippingAddress", void 0);
2189
+ __decorate([
2190
+ Type(() => UserAddress),
2191
+ __metadata("design:type", UserAddress)
2192
+ ], Checkout.prototype, "billingAddress", void 0);
2193
+ __decorate([
2194
+ Type(() => ShippingMethod),
2195
+ __metadata("design:type", ShippingMethod)
2196
+ ], Checkout.prototype, "shipping", void 0);
2197
+ __decorate([
2198
+ Type(() => Coupon),
2199
+ __metadata("design:type", Coupon)
2200
+ ], Checkout.prototype, "coupon", void 0);
1985
2201
 
1986
- class CategoryForProduct extends CategoryBase {
2202
+ var OrderStatus;
2203
+ (function (OrderStatus) {
2204
+ OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
2205
+ OrderStatus["EM_PREPARO"] = "Preparando pedido";
2206
+ OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
2207
+ OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
2208
+ OrderStatus["ENVIADO"] = "Enviado";
2209
+ OrderStatus["ENTREGUE"] = "Entregue";
2210
+ OrderStatus["CANCELADO"] = "Cancelado";
2211
+ OrderStatus["CREDIT_CARD"] = "credit_card";
2212
+ })(OrderStatus || (OrderStatus = {}));
2213
+
2214
+ class Order extends Checkout {
2215
+ }
2216
+ __decorate([
2217
+ Type(() => Payment),
2218
+ __metadata("design:type", Payment)
2219
+ ], Order.prototype, "payment", void 0);
2220
+
2221
+ class OrderBlocked extends BaseModel {
1987
2222
  static get identifiersFields() {
1988
2223
  return ['id'];
1989
2224
  }
1990
2225
  }
1991
2226
 
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
2227
  class CheckoutSubscription extends BaseModel {
2212
2228
  static get identifiersFields() {
2213
2229
  return ['id'];
@@ -2244,6 +2260,12 @@ class RoundProductPricesHelper {
2244
2260
  }
2245
2261
  }
2246
2262
 
2263
+ class Sequence extends BaseModel {
2264
+ static get identifiersFields() {
2265
+ return ['id'];
2266
+ }
2267
+ }
2268
+
2247
2269
  var FilterType;
2248
2270
  (function (FilterType) {
2249
2271
  FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
@@ -2758,7 +2780,7 @@ const withFindFirestore = (MixinBase) => {
2758
2780
  const collection = this.collection(this.buildCollectionPathForFind(find.filters));
2759
2781
  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;
2760
2782
  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 }));
2761
- const { filters, limits, orderBy } = intercepted.find || find;
2783
+ const { filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
2762
2784
  const queries = this.makeFirestoreWhere(filters || {});
2763
2785
  const ordination = this.makeFirestoreOrderBy(filters, orderBy);
2764
2786
  const offsets = await this.defineLimits(filters, limits);
@@ -2916,155 +2938,22 @@ const withCrudFirestore = (MixinBase) => {
2916
2938
  };
2917
2939
  };
2918
2940
 
2919
- class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2941
+ class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2920
2942
  constructor({ firestore, interceptors }) {
2921
2943
  super({
2922
2944
  firestore,
2923
- collectionName: 'leads',
2924
- model: Lead,
2925
- interceptors,
2926
- });
2927
- }
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,
2945
+ collectionName: 'categories',
2946
+ model: Category,
2937
2947
  interceptors,
2938
2948
  });
2939
- this.parentRepository = parentRepository;
2940
2949
  }
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();
2950
+ async getCategoryBySlug(slug, shop) {
2951
+ const categoryDocs = await getDocs(query(this.collection(this.collectionName), where('slug', '==', slug), where('shop', '==', shop), where('published', '==', true)));
2952
+ if (categoryDocs.size > 1)
2953
+ throw new DuplicatedResultsError('Query returned duplicated values');
2954
+ if (categoryDocs.empty)
2955
+ throw new NotFoundError(`Document with slug ${slug} not found`);
2956
+ return categoryDocs.docs[0].data();
3068
2957
  }
3069
2958
  async getCategoriesForHome(categoryIds, limit = 4, gender) {
3070
2959
  const categorySnap = await getDocs(query(this.collection(this.collectionName), where('id', 'in', categoryIds.filter(Boolean)), where('published', '==', true)));
@@ -3188,6 +3077,101 @@ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpe
3188
3077
  }
3189
3078
  }
3190
3079
 
3080
+ class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3081
+ constructor({ firestore, interceptors }) {
3082
+ super({
3083
+ firestore,
3084
+ collectionName: 'sequences',
3085
+ model: Sequence,
3086
+ interceptors,
3087
+ });
3088
+ }
3089
+ }
3090
+
3091
+ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3092
+ constructor({ firestore, interceptors }) {
3093
+ super({
3094
+ firestore,
3095
+ collectionName: 'dms',
3096
+ model: Home,
3097
+ interceptors,
3098
+ });
3099
+ this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
3100
+ var _a, _b, _c;
3101
+ return ({
3102
+ category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
3103
+ ? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
3104
+ : homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
3105
+ 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)) || [],
3106
+ });
3107
+ };
3108
+ this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
3109
+ var _a;
3110
+ return ({
3111
+ category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
3112
+ products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
3113
+ });
3114
+ };
3115
+ }
3116
+ buildModelInstance() {
3117
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
3118
+ return {
3119
+ toFirestore: (data) => {
3120
+ const modifiedData = this.homeToFirestore(data);
3121
+ return toFirestore(modifiedData);
3122
+ },
3123
+ fromFirestore: (snap) => {
3124
+ const instance = fromFirestore(snap);
3125
+ return this.homeFromFirestore(instance);
3126
+ },
3127
+ };
3128
+ }
3129
+ homeToFirestore(home) {
3130
+ var _a, _b, _c, _d;
3131
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3132
+ home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
3133
+ home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
3134
+ home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
3135
+ }
3136
+ return home;
3137
+ }
3138
+ homeFromFirestore(home) {
3139
+ var _a;
3140
+ if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
3141
+ home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
3142
+ home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
3143
+ home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
3144
+ home.data.createdAt =
3145
+ home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
3146
+ home.data.expiresAt =
3147
+ home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
3148
+ }
3149
+ return home;
3150
+ }
3151
+ }
3152
+
3153
+ class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3154
+ constructor({ firestore, interceptors }) {
3155
+ super({
3156
+ firestore,
3157
+ collectionName: 'shopMenus',
3158
+ model: ShopMenu,
3159
+ interceptors,
3160
+ });
3161
+ }
3162
+ }
3163
+
3164
+ class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3165
+ constructor({ firestore, interceptors, }) {
3166
+ super({
3167
+ firestore,
3168
+ collectionName: 'shopSettings',
3169
+ model: ShopSettings,
3170
+ interceptors,
3171
+ });
3172
+ }
3173
+ }
3174
+
3191
3175
  class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3192
3176
  constructor({ firestore, interceptors }) {
3193
3177
  super({
@@ -3318,6 +3302,17 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
3318
3302
  }
3319
3303
  }
3320
3304
 
3305
+ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3306
+ constructor({ firestore, interceptors, }) {
3307
+ super({
3308
+ firestore,
3309
+ collectionName: 'paymentBlockedAttempts',
3310
+ model: OrderBlocked,
3311
+ interceptors,
3312
+ });
3313
+ }
3314
+ }
3315
+
3321
3316
  class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3322
3317
  constructor({ firestore, interceptors }) {
3323
3318
  super({
@@ -3340,87 +3335,136 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
3340
3335
  }
3341
3336
  }
3342
3337
 
3343
- class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3338
+ class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3344
3339
  constructor({ firestore, interceptors }) {
3345
3340
  super({
3346
3341
  firestore,
3347
- collectionName: 'dms',
3348
- model: Home,
3342
+ collectionName: 'leads',
3343
+ model: Lead,
3349
3344
  interceptors,
3350
3345
  });
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
3346
  }
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
- };
3347
+ }
3348
+
3349
+ class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3350
+ constructor({ firestore, interceptors }, parentRepository) {
3351
+ super({
3352
+ firestore,
3353
+ collectionName: 'editions',
3354
+ parentIdField: 'subscriptionId',
3355
+ model: Edition,
3356
+ interceptors,
3357
+ });
3358
+ this.parentRepository = parentRepository;
3380
3359
  }
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;
3360
+ }
3361
+
3362
+ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3363
+ constructor({ firestore, interceptors, }) {
3364
+ super({
3365
+ firestore,
3366
+ collectionName: 'subscription',
3367
+ model: Subscription,
3368
+ interceptors,
3369
+ });
3389
3370
  }
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;
3371
+ }
3372
+
3373
+ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3374
+ constructor({ firestore, interceptors }, parentRepository) {
3375
+ super({
3376
+ firestore,
3377
+ collectionName: 'payments',
3378
+ parentIdField: 'subscriptionId',
3379
+ model: SubscriptionPayment,
3380
+ interceptors,
3381
+ });
3382
+ this.parentRepository = parentRepository;
3402
3383
  }
3403
3384
  }
3404
3385
 
3405
- class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3386
+ class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3387
+ constructor({ firestore, interceptors }, parentRepository) {
3388
+ super({
3389
+ firestore,
3390
+ collectionName: 'address',
3391
+ parentIdField: 'userId',
3392
+ model: UserAddress,
3393
+ interceptors,
3394
+ });
3395
+ this.parentRepository = parentRepository;
3396
+ }
3397
+ }
3398
+
3399
+ class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3400
+ constructor({ firestore, interceptors }, parentRepository) {
3401
+ super({
3402
+ firestore,
3403
+ collectionName: 'CX',
3404
+ parentIdField: 'userId',
3405
+ model: BeautyProfile,
3406
+ interceptors,
3407
+ });
3408
+ this.parentRepository = parentRepository;
3409
+ }
3410
+ }
3411
+
3412
+ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3406
3413
  constructor({ firestore, interceptors }) {
3407
3414
  super({
3408
3415
  firestore,
3409
- collectionName: 'shopMenus',
3410
- model: ShopMenu,
3416
+ collectionName: 'users',
3417
+ model: User,
3411
3418
  interceptors,
3412
3419
  });
3413
3420
  }
3421
+ async get(identifiers) {
3422
+ const user = await super.get({ id: identifiers.id });
3423
+ user.beautyProfile = await this.getBeautyProfile(user.id);
3424
+ user.isSubscriber = await this.checkIfIsSubscriber(user.id);
3425
+ return user;
3426
+ }
3427
+ async checkIfExistsByField(field, value) {
3428
+ const result = await this.find({ filters: { [field]: value } });
3429
+ return result.count > 0;
3430
+ }
3431
+ buildModelInstance() {
3432
+ const { fromFirestore, toFirestore } = super.buildModelInstance();
3433
+ return {
3434
+ toFirestore: (data) => {
3435
+ const plain = toFirestore(data);
3436
+ delete plain.isSubscriber;
3437
+ return plain;
3438
+ },
3439
+ fromFirestore,
3440
+ };
3441
+ }
3442
+ async getBeautyProfile(userId) {
3443
+ const beautyProfile = await getDoc(doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
3444
+ return beautyProfile.data();
3445
+ }
3446
+ async checkIfIsSubscriber(userId) {
3447
+ const docs = await getDocs(query(this.collection('subscription'), where('user.id', '==', userId), where('status', '==', 'active')));
3448
+ return !!docs && !!docs.size;
3449
+ }
3450
+ buildBeautyProfileModelInstance() {
3451
+ return {
3452
+ toFirestore: (data) => data.toPlain(),
3453
+ fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
3454
+ };
3455
+ }
3414
3456
  }
3415
3457
 
3416
- class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3417
- constructor({ firestore, interceptors, }) {
3458
+ class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
3459
+ constructor({ firestore, interceptors }, parentRepository) {
3418
3460
  super({
3419
3461
  firestore,
3420
- collectionName: 'shopSettings',
3421
- model: ShopSettings,
3462
+ collectionName: 'payment_method',
3463
+ parentIdField: 'userId',
3464
+ model: UserPaymentMethod,
3422
3465
  interceptors,
3423
3466
  });
3467
+ this.parentRepository = parentRepository;
3424
3468
  }
3425
3469
  }
3426
3470
 
@@ -5510,4 +5554,4 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5510
5554
  }
5511
5555
  }
5512
5556
 
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 };
5557
+ 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, 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 };