@infrab4a/connect 4.1.2-beta.4 → 4.1.2-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +472 -434
- package/index.esm.js +469 -435
- package/package.json +2 -2
- package/src/domain/general/index.d.ts +2 -0
- package/src/domain/general/models/index.d.ts +1 -0
- package/src/domain/general/models/sequences.d.ts +9 -0
- package/src/domain/general/repositories/index.d.ts +1 -0
- package/src/domain/general/repositories/sequences.repository.d.ts +4 -0
- package/src/domain/index.d.ts +4 -3
- package/src/domain/shopping/models/index.d.ts +1 -0
- package/src/domain/shopping/models/order-blocked.d.ts +26 -0
- package/src/domain/shopping/repositories/index.d.ts +1 -0
- package/src/domain/shopping/repositories/order-blocked.repository.d.ts +4 -0
- package/src/infra/firebase/firestore/repositories/general/index.d.ts +1 -0
- package/src/infra/firebase/firestore/repositories/general/sequences-firestore.repository.d.ts +7 -0
- package/src/infra/firebase/firestore/repositories/index.d.ts +3 -2
- package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +1 -0
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +7 -0
- package/teste2.d.ts +0 -1
package/index.cjs.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('reflect-metadata');
|
|
6
|
-
var classTransformer = require('class-transformer');
|
|
7
6
|
var tslib_1 = require('tslib');
|
|
7
|
+
var classTransformer = require('class-transformer');
|
|
8
8
|
var dateFns = require('date-fns');
|
|
9
9
|
var lodash = require('lodash');
|
|
10
10
|
var debug = require('debug');
|
|
@@ -60,6 +60,181 @@ class BaseModel {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
class Filter extends BaseModel {
|
|
64
|
+
static get identifiersFields() {
|
|
65
|
+
return ['id'];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
class CategoryBase extends BaseModel {
|
|
70
|
+
static get identifiersFields() {
|
|
71
|
+
return ['id'];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
tslib_1.__decorate([
|
|
75
|
+
classTransformer.Type(() => CategoryBase),
|
|
76
|
+
tslib_1.__metadata("design:type", CategoryBase)
|
|
77
|
+
], CategoryBase.prototype, "parent", void 0);
|
|
78
|
+
tslib_1.__decorate([
|
|
79
|
+
classTransformer.Type(() => Filter),
|
|
80
|
+
tslib_1.__metadata("design:type", Array)
|
|
81
|
+
], CategoryBase.prototype, "filters", void 0);
|
|
82
|
+
|
|
83
|
+
class CategoryForProduct extends CategoryBase {
|
|
84
|
+
static get identifiersFields() {
|
|
85
|
+
return ['id'];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
class ProductBase extends BaseModel {
|
|
90
|
+
get evaluation() {
|
|
91
|
+
return {
|
|
92
|
+
reviews: this.reviews,
|
|
93
|
+
count: this.reviewsTotal,
|
|
94
|
+
rating: this.rate,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
set evaluation(evaluation) {
|
|
98
|
+
if (!evaluation) {
|
|
99
|
+
this.reviews = null;
|
|
100
|
+
this.reviewsTotal = null;
|
|
101
|
+
this.rate = null;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
this.reviews = evaluation.reviews || this.reviews;
|
|
105
|
+
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
106
|
+
this.rate = evaluation.rating || this.rate;
|
|
107
|
+
}
|
|
108
|
+
static get identifiersFields() {
|
|
109
|
+
return ['id'];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
class ProductForKit extends ProductBase {
|
|
114
|
+
static get identifiersFields() {
|
|
115
|
+
return ['id'];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
tslib_1.__decorate([
|
|
119
|
+
classTransformer.Type(() => CategoryForProduct),
|
|
120
|
+
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
121
|
+
], ProductForKit.prototype, "category", void 0);
|
|
122
|
+
|
|
123
|
+
class KitProduct extends BaseModel {
|
|
124
|
+
static get identifiersFields() {
|
|
125
|
+
return ['productId', 'kitProductId'];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
tslib_1.__decorate([
|
|
129
|
+
classTransformer.Type(() => ProductForKit),
|
|
130
|
+
tslib_1.__metadata("design:type", ProductForKit)
|
|
131
|
+
], KitProduct.prototype, "kit", void 0);
|
|
132
|
+
tslib_1.__decorate([
|
|
133
|
+
classTransformer.Type(() => ProductForKit),
|
|
134
|
+
tslib_1.__metadata("design:type", ProductForKit)
|
|
135
|
+
], KitProduct.prototype, "product", void 0);
|
|
136
|
+
|
|
137
|
+
class ProductForCategory extends ProductBase {
|
|
138
|
+
static get identifiersFields() {
|
|
139
|
+
return ['id'];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
tslib_1.__decorate([
|
|
143
|
+
classTransformer.Type(() => KitProduct),
|
|
144
|
+
tslib_1.__metadata("design:type", Array)
|
|
145
|
+
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
146
|
+
|
|
147
|
+
class Category extends CategoryBase {
|
|
148
|
+
static get identifiersFields() {
|
|
149
|
+
return ['id'];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
tslib_1.__decorate([
|
|
153
|
+
classTransformer.Type(() => ProductForCategory),
|
|
154
|
+
tslib_1.__metadata("design:type", Array)
|
|
155
|
+
], Category.prototype, "childrenProducts", void 0);
|
|
156
|
+
|
|
157
|
+
class CategoryCollectionChildren extends BaseModel {
|
|
158
|
+
static get identifiersFields() {
|
|
159
|
+
return ['collectionId', 'categoryId'];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
tslib_1.__decorate([
|
|
163
|
+
classTransformer.Type(() => CategoryCollectionChildren),
|
|
164
|
+
tslib_1.__metadata("design:type", CategoryCollectionChildren)
|
|
165
|
+
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
166
|
+
|
|
167
|
+
class CategoryFilter extends BaseModel {
|
|
168
|
+
static get identifiersFields() {
|
|
169
|
+
return ['id'];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
tslib_1.__decorate([
|
|
173
|
+
classTransformer.Type(() => Filter),
|
|
174
|
+
tslib_1.__metadata("design:type", Filter)
|
|
175
|
+
], CategoryFilter.prototype, "filter", void 0);
|
|
176
|
+
tslib_1.__decorate([
|
|
177
|
+
classTransformer.Type(() => Category),
|
|
178
|
+
tslib_1.__metadata("design:type", Category)
|
|
179
|
+
], CategoryFilter.prototype, "category", void 0);
|
|
180
|
+
|
|
181
|
+
exports.GenderDestination = void 0;
|
|
182
|
+
(function (GenderDestination) {
|
|
183
|
+
GenderDestination["FEMALE"] = "female";
|
|
184
|
+
GenderDestination["MALE"] = "male";
|
|
185
|
+
GenderDestination["UNISEX"] = "unisex";
|
|
186
|
+
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
187
|
+
|
|
188
|
+
exports.Shops = void 0;
|
|
189
|
+
(function (Shops) {
|
|
190
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
191
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
192
|
+
Shops["GLAMPOINTS"] = "Glampoints";
|
|
193
|
+
Shops["ALL"] = "ALL";
|
|
194
|
+
})(exports.Shops || (exports.Shops = {}));
|
|
195
|
+
|
|
196
|
+
class FilterOption extends BaseModel {
|
|
197
|
+
static get identifiersFields() {
|
|
198
|
+
return ['id'];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
class Product extends ProductBase {
|
|
203
|
+
static get identifiersFields() {
|
|
204
|
+
return ['id'];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
tslib_1.__decorate([
|
|
208
|
+
classTransformer.Type(() => CategoryForProduct),
|
|
209
|
+
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
210
|
+
], Product.prototype, "category", void 0);
|
|
211
|
+
tslib_1.__decorate([
|
|
212
|
+
classTransformer.Type(() => KitProduct),
|
|
213
|
+
tslib_1.__metadata("design:type", Array)
|
|
214
|
+
], Product.prototype, "kitProducts", void 0);
|
|
215
|
+
|
|
216
|
+
class Variant extends BaseModel {
|
|
217
|
+
static get identifiersFields() {
|
|
218
|
+
return ['id', 'productId'];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
class Wishlist extends Category {
|
|
223
|
+
static get identifiersFields() {
|
|
224
|
+
return ['id'];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
class Buy2Win extends BaseModel {
|
|
229
|
+
static get identifiersFields() {
|
|
230
|
+
return ['id'];
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
tslib_1.__decorate([
|
|
234
|
+
classTransformer.Type(() => Category),
|
|
235
|
+
tslib_1.__metadata("design:type", Array)
|
|
236
|
+
], Buy2Win.prototype, "categories", void 0);
|
|
237
|
+
|
|
63
238
|
exports.Where = void 0;
|
|
64
239
|
(function (Where) {
|
|
65
240
|
Where["EQUALS"] = "==";
|
|
@@ -85,6 +260,18 @@ exports.UpdateOptionActions = void 0;
|
|
|
85
260
|
UpdateOptionActions["NULL"] = "null";
|
|
86
261
|
})(exports.UpdateOptionActions || (exports.UpdateOptionActions = {}));
|
|
87
262
|
|
|
263
|
+
class CampaignDashboard extends BaseModel {
|
|
264
|
+
static get identifiersFields() {
|
|
265
|
+
return ['id'];
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
class CampaignHashtag extends BaseModel {
|
|
270
|
+
static get identifiersFields() {
|
|
271
|
+
return ['id'];
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
88
275
|
exports.AccessoryImportances = void 0;
|
|
89
276
|
(function (AccessoryImportances) {
|
|
90
277
|
AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
|
|
@@ -1987,254 +2174,73 @@ class RecoveryPassword {
|
|
|
1987
2174
|
}
|
|
1988
2175
|
}
|
|
1989
2176
|
|
|
1990
|
-
class
|
|
2177
|
+
class LineItem extends Product {
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
class ShippingMethod extends BaseModel {
|
|
1991
2181
|
static get identifiersFields() {
|
|
1992
2182
|
return ['id'];
|
|
1993
2183
|
}
|
|
1994
2184
|
}
|
|
1995
2185
|
|
|
1996
|
-
class
|
|
2186
|
+
class Checkout extends BaseModel {
|
|
1997
2187
|
static get identifiersFields() {
|
|
1998
2188
|
return ['id'];
|
|
1999
2189
|
}
|
|
2000
2190
|
}
|
|
2001
2191
|
tslib_1.__decorate([
|
|
2002
|
-
classTransformer.Type(() =>
|
|
2003
|
-
tslib_1.__metadata("design:type", CategoryBase)
|
|
2004
|
-
], CategoryBase.prototype, "parent", void 0);
|
|
2005
|
-
tslib_1.__decorate([
|
|
2006
|
-
classTransformer.Type(() => Filter),
|
|
2192
|
+
classTransformer.Type(() => LineItem),
|
|
2007
2193
|
tslib_1.__metadata("design:type", Array)
|
|
2008
|
-
],
|
|
2194
|
+
], Checkout.prototype, "lineItems", void 0);
|
|
2195
|
+
tslib_1.__decorate([
|
|
2196
|
+
classTransformer.Type(() => User),
|
|
2197
|
+
tslib_1.__metadata("design:type", User)
|
|
2198
|
+
], Checkout.prototype, "user", void 0);
|
|
2199
|
+
tslib_1.__decorate([
|
|
2200
|
+
classTransformer.Type(() => UserAddress),
|
|
2201
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2202
|
+
], Checkout.prototype, "shippingAddress", void 0);
|
|
2203
|
+
tslib_1.__decorate([
|
|
2204
|
+
classTransformer.Type(() => UserAddress),
|
|
2205
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2206
|
+
], Checkout.prototype, "billingAddress", void 0);
|
|
2207
|
+
tslib_1.__decorate([
|
|
2208
|
+
classTransformer.Type(() => ShippingMethod),
|
|
2209
|
+
tslib_1.__metadata("design:type", ShippingMethod)
|
|
2210
|
+
], Checkout.prototype, "shipping", void 0);
|
|
2211
|
+
tslib_1.__decorate([
|
|
2212
|
+
classTransformer.Type(() => Coupon),
|
|
2213
|
+
tslib_1.__metadata("design:type", Coupon)
|
|
2214
|
+
], Checkout.prototype, "coupon", void 0);
|
|
2009
2215
|
|
|
2010
|
-
|
|
2216
|
+
exports.OrderStatus = void 0;
|
|
2217
|
+
(function (OrderStatus) {
|
|
2218
|
+
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
2219
|
+
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
2220
|
+
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
2221
|
+
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
2222
|
+
OrderStatus["ENVIADO"] = "Enviado";
|
|
2223
|
+
OrderStatus["ENTREGUE"] = "Entregue";
|
|
2224
|
+
OrderStatus["CANCELADO"] = "Cancelado";
|
|
2225
|
+
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
2226
|
+
})(exports.OrderStatus || (exports.OrderStatus = {}));
|
|
2227
|
+
|
|
2228
|
+
class Order extends Checkout {
|
|
2229
|
+
}
|
|
2230
|
+
tslib_1.__decorate([
|
|
2231
|
+
classTransformer.Type(() => Payment),
|
|
2232
|
+
tslib_1.__metadata("design:type", Payment)
|
|
2233
|
+
], Order.prototype, "payment", void 0);
|
|
2234
|
+
|
|
2235
|
+
class OrderBlocked extends BaseModel {
|
|
2011
2236
|
static get identifiersFields() {
|
|
2012
2237
|
return ['id'];
|
|
2013
2238
|
}
|
|
2014
2239
|
}
|
|
2015
2240
|
|
|
2016
|
-
class
|
|
2017
|
-
get
|
|
2018
|
-
return
|
|
2019
|
-
reviews: this.reviews,
|
|
2020
|
-
count: this.reviewsTotal,
|
|
2021
|
-
rating: this.rate,
|
|
2022
|
-
};
|
|
2023
|
-
}
|
|
2024
|
-
set evaluation(evaluation) {
|
|
2025
|
-
if (!evaluation) {
|
|
2026
|
-
this.reviews = null;
|
|
2027
|
-
this.reviewsTotal = null;
|
|
2028
|
-
this.rate = null;
|
|
2029
|
-
return;
|
|
2030
|
-
}
|
|
2031
|
-
this.reviews = evaluation.reviews || this.reviews;
|
|
2032
|
-
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
2033
|
-
this.rate = evaluation.rating || this.rate;
|
|
2034
|
-
}
|
|
2035
|
-
static get identifiersFields() {
|
|
2036
|
-
return ['id'];
|
|
2037
|
-
}
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
class ProductForKit extends ProductBase {
|
|
2041
|
-
static get identifiersFields() {
|
|
2042
|
-
return ['id'];
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
tslib_1.__decorate([
|
|
2046
|
-
classTransformer.Type(() => CategoryForProduct),
|
|
2047
|
-
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
2048
|
-
], ProductForKit.prototype, "category", void 0);
|
|
2049
|
-
|
|
2050
|
-
class KitProduct extends BaseModel {
|
|
2051
|
-
static get identifiersFields() {
|
|
2052
|
-
return ['productId', 'kitProductId'];
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
tslib_1.__decorate([
|
|
2056
|
-
classTransformer.Type(() => ProductForKit),
|
|
2057
|
-
tslib_1.__metadata("design:type", ProductForKit)
|
|
2058
|
-
], KitProduct.prototype, "kit", void 0);
|
|
2059
|
-
tslib_1.__decorate([
|
|
2060
|
-
classTransformer.Type(() => ProductForKit),
|
|
2061
|
-
tslib_1.__metadata("design:type", ProductForKit)
|
|
2062
|
-
], KitProduct.prototype, "product", void 0);
|
|
2063
|
-
|
|
2064
|
-
class ProductForCategory extends ProductBase {
|
|
2065
|
-
static get identifiersFields() {
|
|
2066
|
-
return ['id'];
|
|
2067
|
-
}
|
|
2068
|
-
}
|
|
2069
|
-
tslib_1.__decorate([
|
|
2070
|
-
classTransformer.Type(() => KitProduct),
|
|
2071
|
-
tslib_1.__metadata("design:type", Array)
|
|
2072
|
-
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
2073
|
-
|
|
2074
|
-
class Category extends CategoryBase {
|
|
2075
|
-
static get identifiersFields() {
|
|
2076
|
-
return ['id'];
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
tslib_1.__decorate([
|
|
2080
|
-
classTransformer.Type(() => ProductForCategory),
|
|
2081
|
-
tslib_1.__metadata("design:type", Array)
|
|
2082
|
-
], Category.prototype, "childrenProducts", void 0);
|
|
2083
|
-
|
|
2084
|
-
class CategoryCollectionChildren extends BaseModel {
|
|
2085
|
-
static get identifiersFields() {
|
|
2086
|
-
return ['collectionId', 'categoryId'];
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
tslib_1.__decorate([
|
|
2090
|
-
classTransformer.Type(() => CategoryCollectionChildren),
|
|
2091
|
-
tslib_1.__metadata("design:type", CategoryCollectionChildren)
|
|
2092
|
-
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
2093
|
-
|
|
2094
|
-
class CategoryFilter extends BaseModel {
|
|
2095
|
-
static get identifiersFields() {
|
|
2096
|
-
return ['id'];
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
|
-
tslib_1.__decorate([
|
|
2100
|
-
classTransformer.Type(() => Filter),
|
|
2101
|
-
tslib_1.__metadata("design:type", Filter)
|
|
2102
|
-
], CategoryFilter.prototype, "filter", void 0);
|
|
2103
|
-
tslib_1.__decorate([
|
|
2104
|
-
classTransformer.Type(() => Category),
|
|
2105
|
-
tslib_1.__metadata("design:type", Category)
|
|
2106
|
-
], CategoryFilter.prototype, "category", void 0);
|
|
2107
|
-
|
|
2108
|
-
exports.GenderDestination = void 0;
|
|
2109
|
-
(function (GenderDestination) {
|
|
2110
|
-
GenderDestination["FEMALE"] = "female";
|
|
2111
|
-
GenderDestination["MALE"] = "male";
|
|
2112
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
2113
|
-
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
2114
|
-
|
|
2115
|
-
exports.Shops = void 0;
|
|
2116
|
-
(function (Shops) {
|
|
2117
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
2118
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
2119
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
2120
|
-
Shops["ALL"] = "ALL";
|
|
2121
|
-
})(exports.Shops || (exports.Shops = {}));
|
|
2122
|
-
|
|
2123
|
-
class FilterOption extends BaseModel {
|
|
2124
|
-
static get identifiersFields() {
|
|
2125
|
-
return ['id'];
|
|
2126
|
-
}
|
|
2127
|
-
}
|
|
2128
|
-
|
|
2129
|
-
class Product extends ProductBase {
|
|
2130
|
-
static get identifiersFields() {
|
|
2131
|
-
return ['id'];
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
tslib_1.__decorate([
|
|
2135
|
-
classTransformer.Type(() => CategoryForProduct),
|
|
2136
|
-
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
2137
|
-
], Product.prototype, "category", void 0);
|
|
2138
|
-
tslib_1.__decorate([
|
|
2139
|
-
classTransformer.Type(() => KitProduct),
|
|
2140
|
-
tslib_1.__metadata("design:type", Array)
|
|
2141
|
-
], Product.prototype, "kitProducts", void 0);
|
|
2142
|
-
|
|
2143
|
-
class Variant extends BaseModel {
|
|
2144
|
-
static get identifiersFields() {
|
|
2145
|
-
return ['id', 'productId'];
|
|
2146
|
-
}
|
|
2147
|
-
}
|
|
2148
|
-
|
|
2149
|
-
class Wishlist extends Category {
|
|
2150
|
-
static get identifiersFields() {
|
|
2151
|
-
return ['id'];
|
|
2152
|
-
}
|
|
2153
|
-
}
|
|
2154
|
-
|
|
2155
|
-
class Buy2Win extends BaseModel {
|
|
2156
|
-
static get identifiersFields() {
|
|
2157
|
-
return ['id'];
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
tslib_1.__decorate([
|
|
2161
|
-
classTransformer.Type(() => Category),
|
|
2162
|
-
tslib_1.__metadata("design:type", Array)
|
|
2163
|
-
], Buy2Win.prototype, "categories", void 0);
|
|
2164
|
-
|
|
2165
|
-
class CampaignDashboard extends BaseModel {
|
|
2166
|
-
static get identifiersFields() {
|
|
2167
|
-
return ['id'];
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
|
|
2171
|
-
class CampaignHashtag extends BaseModel {
|
|
2172
|
-
static get identifiersFields() {
|
|
2173
|
-
return ['id'];
|
|
2174
|
-
}
|
|
2175
|
-
}
|
|
2176
|
-
|
|
2177
|
-
class LineItem extends Product {
|
|
2178
|
-
}
|
|
2179
|
-
|
|
2180
|
-
class ShippingMethod extends BaseModel {
|
|
2181
|
-
static get identifiersFields() {
|
|
2182
|
-
return ['id'];
|
|
2183
|
-
}
|
|
2184
|
-
}
|
|
2185
|
-
|
|
2186
|
-
class Checkout extends BaseModel {
|
|
2187
|
-
static get identifiersFields() {
|
|
2188
|
-
return ['id'];
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
tslib_1.__decorate([
|
|
2192
|
-
classTransformer.Type(() => LineItem),
|
|
2193
|
-
tslib_1.__metadata("design:type", Array)
|
|
2194
|
-
], Checkout.prototype, "lineItems", void 0);
|
|
2195
|
-
tslib_1.__decorate([
|
|
2196
|
-
classTransformer.Type(() => User),
|
|
2197
|
-
tslib_1.__metadata("design:type", User)
|
|
2198
|
-
], Checkout.prototype, "user", void 0);
|
|
2199
|
-
tslib_1.__decorate([
|
|
2200
|
-
classTransformer.Type(() => UserAddress),
|
|
2201
|
-
tslib_1.__metadata("design:type", UserAddress)
|
|
2202
|
-
], Checkout.prototype, "shippingAddress", void 0);
|
|
2203
|
-
tslib_1.__decorate([
|
|
2204
|
-
classTransformer.Type(() => UserAddress),
|
|
2205
|
-
tslib_1.__metadata("design:type", UserAddress)
|
|
2206
|
-
], Checkout.prototype, "billingAddress", void 0);
|
|
2207
|
-
tslib_1.__decorate([
|
|
2208
|
-
classTransformer.Type(() => ShippingMethod),
|
|
2209
|
-
tslib_1.__metadata("design:type", ShippingMethod)
|
|
2210
|
-
], Checkout.prototype, "shipping", void 0);
|
|
2211
|
-
tslib_1.__decorate([
|
|
2212
|
-
classTransformer.Type(() => Coupon),
|
|
2213
|
-
tslib_1.__metadata("design:type", Coupon)
|
|
2214
|
-
], Checkout.prototype, "coupon", void 0);
|
|
2215
|
-
|
|
2216
|
-
exports.OrderStatus = void 0;
|
|
2217
|
-
(function (OrderStatus) {
|
|
2218
|
-
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
2219
|
-
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
2220
|
-
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
2221
|
-
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
2222
|
-
OrderStatus["ENVIADO"] = "Enviado";
|
|
2223
|
-
OrderStatus["ENTREGUE"] = "Entregue";
|
|
2224
|
-
OrderStatus["CANCELADO"] = "Cancelado";
|
|
2225
|
-
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
2226
|
-
})(exports.OrderStatus || (exports.OrderStatus = {}));
|
|
2227
|
-
|
|
2228
|
-
class Order extends Checkout {
|
|
2229
|
-
}
|
|
2230
|
-
tslib_1.__decorate([
|
|
2231
|
-
classTransformer.Type(() => Payment),
|
|
2232
|
-
tslib_1.__metadata("design:type", Payment)
|
|
2233
|
-
], Order.prototype, "payment", void 0);
|
|
2234
|
-
|
|
2235
|
-
class CheckoutSubscription extends BaseModel {
|
|
2236
|
-
static get identifiersFields() {
|
|
2237
|
-
return ['id'];
|
|
2241
|
+
class CheckoutSubscription extends BaseModel {
|
|
2242
|
+
static get identifiersFields() {
|
|
2243
|
+
return ['id'];
|
|
2238
2244
|
}
|
|
2239
2245
|
}
|
|
2240
2246
|
tslib_1.__decorate([
|
|
@@ -2268,6 +2274,12 @@ class RoundProductPricesHelper {
|
|
|
2268
2274
|
}
|
|
2269
2275
|
}
|
|
2270
2276
|
|
|
2277
|
+
class Sequence extends BaseModel {
|
|
2278
|
+
static get identifiersFields() {
|
|
2279
|
+
return ['id'];
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2271
2283
|
exports.FilterType = void 0;
|
|
2272
2284
|
(function (FilterType) {
|
|
2273
2285
|
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
@@ -2782,7 +2794,7 @@ const withFindFirestore = (MixinBase) => {
|
|
|
2782
2794
|
const collection = this.collection(this.buildCollectionPathForFind(find.filters));
|
|
2783
2795
|
const enableCount = (_b = (_a = find === null || find === void 0 ? void 0 : find.options) === null || _a === void 0 ? void 0 : _a.enableCount) !== null && _b !== void 0 ? _b : true;
|
|
2784
2796
|
const intercepted = await ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.request) === null || _d === void 0 ? void 0 : _d.call(_c, { find }));
|
|
2785
|
-
const { filters, limits, orderBy } = intercepted.find || find;
|
|
2797
|
+
const { filters, limits, orderBy } = (intercepted === null || intercepted === void 0 ? void 0 : intercepted.find) || find;
|
|
2786
2798
|
const queries = this.makeFirestoreWhere(filters || {});
|
|
2787
2799
|
const ordination = this.makeFirestoreOrderBy(filters, orderBy);
|
|
2788
2800
|
const offsets = await this.defineLimits(filters, limits);
|
|
@@ -2940,155 +2952,22 @@ const withCrudFirestore = (MixinBase) => {
|
|
|
2940
2952
|
};
|
|
2941
2953
|
};
|
|
2942
2954
|
|
|
2943
|
-
class
|
|
2955
|
+
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2944
2956
|
constructor({ firestore, interceptors }) {
|
|
2945
2957
|
super({
|
|
2946
2958
|
firestore,
|
|
2947
|
-
collectionName: '
|
|
2948
|
-
model:
|
|
2949
|
-
interceptors,
|
|
2950
|
-
});
|
|
2951
|
-
}
|
|
2952
|
-
}
|
|
2953
|
-
|
|
2954
|
-
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2955
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
2956
|
-
super({
|
|
2957
|
-
firestore,
|
|
2958
|
-
collectionName: 'editions',
|
|
2959
|
-
parentIdField: 'subscriptionId',
|
|
2960
|
-
model: Edition,
|
|
2959
|
+
collectionName: 'categories',
|
|
2960
|
+
model: Category,
|
|
2961
2961
|
interceptors,
|
|
2962
2962
|
});
|
|
2963
|
-
this.parentRepository = parentRepository;
|
|
2964
2963
|
}
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
model: Subscription,
|
|
2973
|
-
interceptors,
|
|
2974
|
-
});
|
|
2975
|
-
}
|
|
2976
|
-
}
|
|
2977
|
-
|
|
2978
|
-
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2979
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
2980
|
-
super({
|
|
2981
|
-
firestore,
|
|
2982
|
-
collectionName: 'payments',
|
|
2983
|
-
parentIdField: 'subscriptionId',
|
|
2984
|
-
model: SubscriptionPayment,
|
|
2985
|
-
interceptors,
|
|
2986
|
-
});
|
|
2987
|
-
this.parentRepository = parentRepository;
|
|
2988
|
-
}
|
|
2989
|
-
}
|
|
2990
|
-
|
|
2991
|
-
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2992
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
2993
|
-
super({
|
|
2994
|
-
firestore,
|
|
2995
|
-
collectionName: 'address',
|
|
2996
|
-
parentIdField: 'userId',
|
|
2997
|
-
model: UserAddress,
|
|
2998
|
-
interceptors,
|
|
2999
|
-
});
|
|
3000
|
-
this.parentRepository = parentRepository;
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3003
|
-
|
|
3004
|
-
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3005
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
3006
|
-
super({
|
|
3007
|
-
firestore,
|
|
3008
|
-
collectionName: 'CX',
|
|
3009
|
-
parentIdField: 'userId',
|
|
3010
|
-
model: BeautyProfile,
|
|
3011
|
-
interceptors,
|
|
3012
|
-
});
|
|
3013
|
-
this.parentRepository = parentRepository;
|
|
3014
|
-
}
|
|
3015
|
-
}
|
|
3016
|
-
|
|
3017
|
-
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3018
|
-
constructor({ firestore, interceptors }) {
|
|
3019
|
-
super({
|
|
3020
|
-
firestore,
|
|
3021
|
-
collectionName: 'users',
|
|
3022
|
-
model: User,
|
|
3023
|
-
interceptors,
|
|
3024
|
-
});
|
|
3025
|
-
}
|
|
3026
|
-
async get(identifiers) {
|
|
3027
|
-
const user = await super.get({ id: identifiers.id });
|
|
3028
|
-
user.beautyProfile = await this.getBeautyProfile(user.id);
|
|
3029
|
-
user.isSubscriber = await this.checkIfIsSubscriber(user.id);
|
|
3030
|
-
return user;
|
|
3031
|
-
}
|
|
3032
|
-
async checkIfExistsByField(field, value) {
|
|
3033
|
-
const result = await this.find({ filters: { [field]: value } });
|
|
3034
|
-
return result.count > 0;
|
|
3035
|
-
}
|
|
3036
|
-
buildModelInstance() {
|
|
3037
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3038
|
-
return {
|
|
3039
|
-
toFirestore: (data) => {
|
|
3040
|
-
const plain = toFirestore(data);
|
|
3041
|
-
delete plain.isSubscriber;
|
|
3042
|
-
return plain;
|
|
3043
|
-
},
|
|
3044
|
-
fromFirestore,
|
|
3045
|
-
};
|
|
3046
|
-
}
|
|
3047
|
-
async getBeautyProfile(userId) {
|
|
3048
|
-
const beautyProfile = await firestore.getDoc(firestore.doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
|
|
3049
|
-
return beautyProfile.data();
|
|
3050
|
-
}
|
|
3051
|
-
async checkIfIsSubscriber(userId) {
|
|
3052
|
-
const docs = await firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')));
|
|
3053
|
-
return !!docs && !!docs.size;
|
|
3054
|
-
}
|
|
3055
|
-
buildBeautyProfileModelInstance() {
|
|
3056
|
-
return {
|
|
3057
|
-
toFirestore: (data) => data.toPlain(),
|
|
3058
|
-
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
3059
|
-
};
|
|
3060
|
-
}
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
|
-
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3064
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
3065
|
-
super({
|
|
3066
|
-
firestore,
|
|
3067
|
-
collectionName: 'payment_method',
|
|
3068
|
-
parentIdField: 'userId',
|
|
3069
|
-
model: UserPaymentMethod,
|
|
3070
|
-
interceptors,
|
|
3071
|
-
});
|
|
3072
|
-
this.parentRepository = parentRepository;
|
|
3073
|
-
}
|
|
3074
|
-
}
|
|
3075
|
-
|
|
3076
|
-
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3077
|
-
constructor({ firestore, interceptors }) {
|
|
3078
|
-
super({
|
|
3079
|
-
firestore,
|
|
3080
|
-
collectionName: 'categories',
|
|
3081
|
-
model: Category,
|
|
3082
|
-
interceptors,
|
|
3083
|
-
});
|
|
3084
|
-
}
|
|
3085
|
-
async getCategoryBySlug(slug, shop) {
|
|
3086
|
-
const categoryDocs = await firestore.getDocs(firestore.query(this.collection(this.collectionName), firestore.where('slug', '==', slug), firestore.where('shop', '==', shop), firestore.where('published', '==', true)));
|
|
3087
|
-
if (categoryDocs.size > 1)
|
|
3088
|
-
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
3089
|
-
if (categoryDocs.empty)
|
|
3090
|
-
throw new NotFoundError(`Document with slug ${slug} not found`);
|
|
3091
|
-
return categoryDocs.docs[0].data();
|
|
2964
|
+
async getCategoryBySlug(slug, shop) {
|
|
2965
|
+
const categoryDocs = await firestore.getDocs(firestore.query(this.collection(this.collectionName), firestore.where('slug', '==', slug), firestore.where('shop', '==', shop), firestore.where('published', '==', true)));
|
|
2966
|
+
if (categoryDocs.size > 1)
|
|
2967
|
+
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
2968
|
+
if (categoryDocs.empty)
|
|
2969
|
+
throw new NotFoundError(`Document with slug ${slug} not found`);
|
|
2970
|
+
return categoryDocs.docs[0].data();
|
|
3092
2971
|
}
|
|
3093
2972
|
async getCategoriesForHome(categoryIds, limit = 4, gender) {
|
|
3094
2973
|
const categorySnap = await firestore.getDocs(firestore.query(this.collection(this.collectionName), firestore.where('id', 'in', categoryIds.filter(Boolean)), firestore.where('published', '==', true)));
|
|
@@ -3212,6 +3091,101 @@ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpe
|
|
|
3212
3091
|
}
|
|
3213
3092
|
}
|
|
3214
3093
|
|
|
3094
|
+
class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3095
|
+
constructor({ firestore, interceptors }) {
|
|
3096
|
+
super({
|
|
3097
|
+
firestore,
|
|
3098
|
+
collectionName: 'sequences',
|
|
3099
|
+
model: Sequence,
|
|
3100
|
+
interceptors,
|
|
3101
|
+
});
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3106
|
+
constructor({ firestore, interceptors }) {
|
|
3107
|
+
super({
|
|
3108
|
+
firestore,
|
|
3109
|
+
collectionName: 'dms',
|
|
3110
|
+
model: Home,
|
|
3111
|
+
interceptors,
|
|
3112
|
+
});
|
|
3113
|
+
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
3114
|
+
var _a, _b, _c;
|
|
3115
|
+
return ({
|
|
3116
|
+
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
3117
|
+
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
3118
|
+
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
3119
|
+
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)) || [],
|
|
3120
|
+
});
|
|
3121
|
+
};
|
|
3122
|
+
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
3123
|
+
var _a;
|
|
3124
|
+
return ({
|
|
3125
|
+
category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
|
|
3126
|
+
products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
|
|
3127
|
+
});
|
|
3128
|
+
};
|
|
3129
|
+
}
|
|
3130
|
+
buildModelInstance() {
|
|
3131
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3132
|
+
return {
|
|
3133
|
+
toFirestore: (data) => {
|
|
3134
|
+
const modifiedData = this.homeToFirestore(data);
|
|
3135
|
+
return toFirestore(modifiedData);
|
|
3136
|
+
},
|
|
3137
|
+
fromFirestore: (snap) => {
|
|
3138
|
+
const instance = fromFirestore(snap);
|
|
3139
|
+
return this.homeFromFirestore(instance);
|
|
3140
|
+
},
|
|
3141
|
+
};
|
|
3142
|
+
}
|
|
3143
|
+
homeToFirestore(home) {
|
|
3144
|
+
var _a, _b, _c, _d;
|
|
3145
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3146
|
+
home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
|
|
3147
|
+
home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
|
|
3148
|
+
home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
|
|
3149
|
+
}
|
|
3150
|
+
return home;
|
|
3151
|
+
}
|
|
3152
|
+
homeFromFirestore(home) {
|
|
3153
|
+
var _a;
|
|
3154
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3155
|
+
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
3156
|
+
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
3157
|
+
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
3158
|
+
home.data.createdAt =
|
|
3159
|
+
home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
3160
|
+
home.data.expiresAt =
|
|
3161
|
+
home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
3162
|
+
}
|
|
3163
|
+
return home;
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3168
|
+
constructor({ firestore, interceptors }) {
|
|
3169
|
+
super({
|
|
3170
|
+
firestore,
|
|
3171
|
+
collectionName: 'shopMenus',
|
|
3172
|
+
model: ShopMenu,
|
|
3173
|
+
interceptors,
|
|
3174
|
+
});
|
|
3175
|
+
}
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3179
|
+
constructor({ firestore, interceptors, }) {
|
|
3180
|
+
super({
|
|
3181
|
+
firestore,
|
|
3182
|
+
collectionName: 'shopSettings',
|
|
3183
|
+
model: ShopSettings,
|
|
3184
|
+
interceptors,
|
|
3185
|
+
});
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
|
|
3215
3189
|
class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3216
3190
|
constructor({ firestore, interceptors }) {
|
|
3217
3191
|
super({
|
|
@@ -3342,6 +3316,17 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3342
3316
|
}
|
|
3343
3317
|
}
|
|
3344
3318
|
|
|
3319
|
+
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3320
|
+
constructor({ firestore, interceptors, }) {
|
|
3321
|
+
super({
|
|
3322
|
+
firestore,
|
|
3323
|
+
collectionName: 'paymentBlockedAttempts',
|
|
3324
|
+
model: OrderBlocked,
|
|
3325
|
+
interceptors,
|
|
3326
|
+
});
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
|
|
3345
3330
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3346
3331
|
constructor({ firestore, interceptors }) {
|
|
3347
3332
|
super({
|
|
@@ -3364,87 +3349,136 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
|
|
|
3364
3349
|
}
|
|
3365
3350
|
}
|
|
3366
3351
|
|
|
3367
|
-
class
|
|
3352
|
+
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3368
3353
|
constructor({ firestore, interceptors }) {
|
|
3369
3354
|
super({
|
|
3370
3355
|
firestore,
|
|
3371
|
-
collectionName: '
|
|
3372
|
-
model:
|
|
3356
|
+
collectionName: 'leads',
|
|
3357
|
+
model: Lead,
|
|
3373
3358
|
interceptors,
|
|
3374
3359
|
});
|
|
3375
|
-
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
3376
|
-
var _a, _b, _c;
|
|
3377
|
-
return ({
|
|
3378
|
-
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
3379
|
-
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
3380
|
-
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
3381
|
-
products: ((_c = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.products) === null || _c === void 0 ? void 0 : _c.map((product) => ((product === null || product === void 0 ? void 0 : product.toPlain) ? product === null || product === void 0 ? void 0 : product.toPlain() : product)).filter(Boolean)) || [],
|
|
3382
|
-
});
|
|
3383
|
-
};
|
|
3384
|
-
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
3385
|
-
var _a;
|
|
3386
|
-
return ({
|
|
3387
|
-
category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
|
|
3388
|
-
products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
|
|
3389
|
-
});
|
|
3390
|
-
};
|
|
3391
3360
|
}
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3364
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3365
|
+
super({
|
|
3366
|
+
firestore,
|
|
3367
|
+
collectionName: 'editions',
|
|
3368
|
+
parentIdField: 'subscriptionId',
|
|
3369
|
+
model: Edition,
|
|
3370
|
+
interceptors,
|
|
3371
|
+
});
|
|
3372
|
+
this.parentRepository = parentRepository;
|
|
3404
3373
|
}
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3376
|
+
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3377
|
+
constructor({ firestore, interceptors, }) {
|
|
3378
|
+
super({
|
|
3379
|
+
firestore,
|
|
3380
|
+
collectionName: 'subscription',
|
|
3381
|
+
model: Subscription,
|
|
3382
|
+
interceptors,
|
|
3383
|
+
});
|
|
3413
3384
|
}
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
}
|
|
3425
|
-
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3387
|
+
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3388
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3389
|
+
super({
|
|
3390
|
+
firestore,
|
|
3391
|
+
collectionName: 'payments',
|
|
3392
|
+
parentIdField: 'subscriptionId',
|
|
3393
|
+
model: SubscriptionPayment,
|
|
3394
|
+
interceptors,
|
|
3395
|
+
});
|
|
3396
|
+
this.parentRepository = parentRepository;
|
|
3426
3397
|
}
|
|
3427
3398
|
}
|
|
3428
3399
|
|
|
3429
|
-
class
|
|
3400
|
+
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3401
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3402
|
+
super({
|
|
3403
|
+
firestore,
|
|
3404
|
+
collectionName: 'address',
|
|
3405
|
+
parentIdField: 'userId',
|
|
3406
|
+
model: UserAddress,
|
|
3407
|
+
interceptors,
|
|
3408
|
+
});
|
|
3409
|
+
this.parentRepository = parentRepository;
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
|
|
3413
|
+
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3414
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3415
|
+
super({
|
|
3416
|
+
firestore,
|
|
3417
|
+
collectionName: 'CX',
|
|
3418
|
+
parentIdField: 'userId',
|
|
3419
|
+
model: BeautyProfile,
|
|
3420
|
+
interceptors,
|
|
3421
|
+
});
|
|
3422
|
+
this.parentRepository = parentRepository;
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3430
3427
|
constructor({ firestore, interceptors }) {
|
|
3431
3428
|
super({
|
|
3432
3429
|
firestore,
|
|
3433
|
-
collectionName: '
|
|
3434
|
-
model:
|
|
3430
|
+
collectionName: 'users',
|
|
3431
|
+
model: User,
|
|
3435
3432
|
interceptors,
|
|
3436
3433
|
});
|
|
3437
3434
|
}
|
|
3435
|
+
async get(identifiers) {
|
|
3436
|
+
const user = await super.get({ id: identifiers.id });
|
|
3437
|
+
user.beautyProfile = await this.getBeautyProfile(user.id);
|
|
3438
|
+
user.isSubscriber = await this.checkIfIsSubscriber(user.id);
|
|
3439
|
+
return user;
|
|
3440
|
+
}
|
|
3441
|
+
async checkIfExistsByField(field, value) {
|
|
3442
|
+
const result = await this.find({ filters: { [field]: value } });
|
|
3443
|
+
return result.count > 0;
|
|
3444
|
+
}
|
|
3445
|
+
buildModelInstance() {
|
|
3446
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3447
|
+
return {
|
|
3448
|
+
toFirestore: (data) => {
|
|
3449
|
+
const plain = toFirestore(data);
|
|
3450
|
+
delete plain.isSubscriber;
|
|
3451
|
+
return plain;
|
|
3452
|
+
},
|
|
3453
|
+
fromFirestore,
|
|
3454
|
+
};
|
|
3455
|
+
}
|
|
3456
|
+
async getBeautyProfile(userId) {
|
|
3457
|
+
const beautyProfile = await firestore.getDoc(firestore.doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
|
|
3458
|
+
return beautyProfile.data();
|
|
3459
|
+
}
|
|
3460
|
+
async checkIfIsSubscriber(userId) {
|
|
3461
|
+
const docs = await firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')));
|
|
3462
|
+
return !!docs && !!docs.size;
|
|
3463
|
+
}
|
|
3464
|
+
buildBeautyProfileModelInstance() {
|
|
3465
|
+
return {
|
|
3466
|
+
toFirestore: (data) => data.toPlain(),
|
|
3467
|
+
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
3468
|
+
};
|
|
3469
|
+
}
|
|
3438
3470
|
}
|
|
3439
3471
|
|
|
3440
|
-
class
|
|
3441
|
-
constructor({ firestore, interceptors,
|
|
3472
|
+
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3473
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3442
3474
|
super({
|
|
3443
3475
|
firestore,
|
|
3444
|
-
collectionName: '
|
|
3445
|
-
|
|
3476
|
+
collectionName: 'payment_method',
|
|
3477
|
+
parentIdField: 'userId',
|
|
3478
|
+
model: UserPaymentMethod,
|
|
3446
3479
|
interceptors,
|
|
3447
3480
|
});
|
|
3481
|
+
this.parentRepository = parentRepository;
|
|
3448
3482
|
}
|
|
3449
3483
|
}
|
|
3450
3484
|
|
|
@@ -5699,6 +5733,8 @@ exports.Log = Log;
|
|
|
5699
5733
|
exports.Logger = Logger;
|
|
5700
5734
|
exports.NotFoundError = NotFoundError;
|
|
5701
5735
|
exports.Order = Order;
|
|
5736
|
+
exports.OrderBlocked = OrderBlocked;
|
|
5737
|
+
exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
|
|
5702
5738
|
exports.OrderFirestoreRepository = OrderFirestoreRepository;
|
|
5703
5739
|
exports.Payment = Payment;
|
|
5704
5740
|
exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|
|
@@ -5714,6 +5750,8 @@ exports.Register = Register;
|
|
|
5714
5750
|
exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
|
|
5715
5751
|
exports.RequiredArgumentError = RequiredArgumentError;
|
|
5716
5752
|
exports.RoundProductPricesHelper = RoundProductPricesHelper;
|
|
5753
|
+
exports.Sequence = Sequence;
|
|
5754
|
+
exports.SequenceFirestoreRepository = SequenceFirestoreRepository;
|
|
5717
5755
|
exports.ShippingMethod = ShippingMethod;
|
|
5718
5756
|
exports.ShopMenu = ShopMenu;
|
|
5719
5757
|
exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;
|