@infrab4a/connect 4.1.2-beta.0 → 4.1.2-beta.1
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 +471 -433
- package/index.esm.js +468 -434
- package/package.json +1 -1
- 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/shop-settings/models/types/index.d.ts +0 -2
- package/src/domain/shop-settings/models/types/sections.type.d.ts +0 -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/src/domain/shop-settings/models/types/landing-page.d.ts +0 -8
- package/teste2.d.ts +0 -1
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";
|
|
@@ -1963,254 +2150,73 @@ class RecoveryPassword {
|
|
|
1963
2150
|
}
|
|
1964
2151
|
}
|
|
1965
2152
|
|
|
1966
|
-
class
|
|
2153
|
+
class LineItem extends Product {
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
class ShippingMethod extends BaseModel {
|
|
1967
2157
|
static get identifiersFields() {
|
|
1968
2158
|
return ['id'];
|
|
1969
2159
|
}
|
|
1970
2160
|
}
|
|
1971
2161
|
|
|
1972
|
-
class
|
|
2162
|
+
class Checkout extends BaseModel {
|
|
1973
2163
|
static get identifiersFields() {
|
|
1974
2164
|
return ['id'];
|
|
1975
2165
|
}
|
|
1976
2166
|
}
|
|
1977
2167
|
__decorate([
|
|
1978
|
-
Type(() =>
|
|
1979
|
-
__metadata("design:type", CategoryBase)
|
|
1980
|
-
], CategoryBase.prototype, "parent", void 0);
|
|
1981
|
-
__decorate([
|
|
1982
|
-
Type(() => Filter),
|
|
2168
|
+
Type(() => LineItem),
|
|
1983
2169
|
__metadata("design:type", Array)
|
|
1984
|
-
],
|
|
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);
|
|
1985
2191
|
|
|
1986
|
-
|
|
2192
|
+
var OrderStatus;
|
|
2193
|
+
(function (OrderStatus) {
|
|
2194
|
+
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
2195
|
+
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
2196
|
+
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
2197
|
+
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
2198
|
+
OrderStatus["ENVIADO"] = "Enviado";
|
|
2199
|
+
OrderStatus["ENTREGUE"] = "Entregue";
|
|
2200
|
+
OrderStatus["CANCELADO"] = "Cancelado";
|
|
2201
|
+
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
2202
|
+
})(OrderStatus || (OrderStatus = {}));
|
|
2203
|
+
|
|
2204
|
+
class Order extends Checkout {
|
|
2205
|
+
}
|
|
2206
|
+
__decorate([
|
|
2207
|
+
Type(() => Payment),
|
|
2208
|
+
__metadata("design:type", Payment)
|
|
2209
|
+
], Order.prototype, "payment", void 0);
|
|
2210
|
+
|
|
2211
|
+
class OrderBlocked extends BaseModel {
|
|
1987
2212
|
static get identifiersFields() {
|
|
1988
2213
|
return ['id'];
|
|
1989
2214
|
}
|
|
1990
2215
|
}
|
|
1991
2216
|
|
|
1992
|
-
class
|
|
1993
|
-
get
|
|
1994
|
-
return
|
|
1995
|
-
reviews: this.reviews,
|
|
1996
|
-
count: this.reviewsTotal,
|
|
1997
|
-
rating: this.rate,
|
|
1998
|
-
};
|
|
1999
|
-
}
|
|
2000
|
-
set evaluation(evaluation) {
|
|
2001
|
-
if (!evaluation) {
|
|
2002
|
-
this.reviews = null;
|
|
2003
|
-
this.reviewsTotal = null;
|
|
2004
|
-
this.rate = null;
|
|
2005
|
-
return;
|
|
2006
|
-
}
|
|
2007
|
-
this.reviews = evaluation.reviews || this.reviews;
|
|
2008
|
-
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
2009
|
-
this.rate = evaluation.rating || this.rate;
|
|
2010
|
-
}
|
|
2011
|
-
static get identifiersFields() {
|
|
2012
|
-
return ['id'];
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
class ProductForKit extends ProductBase {
|
|
2017
|
-
static get identifiersFields() {
|
|
2018
|
-
return ['id'];
|
|
2019
|
-
}
|
|
2020
|
-
}
|
|
2021
|
-
__decorate([
|
|
2022
|
-
Type(() => CategoryForProduct),
|
|
2023
|
-
__metadata("design:type", CategoryForProduct)
|
|
2024
|
-
], ProductForKit.prototype, "category", void 0);
|
|
2025
|
-
|
|
2026
|
-
class KitProduct extends BaseModel {
|
|
2027
|
-
static get identifiersFields() {
|
|
2028
|
-
return ['productId', 'kitProductId'];
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
__decorate([
|
|
2032
|
-
Type(() => ProductForKit),
|
|
2033
|
-
__metadata("design:type", ProductForKit)
|
|
2034
|
-
], KitProduct.prototype, "kit", void 0);
|
|
2035
|
-
__decorate([
|
|
2036
|
-
Type(() => ProductForKit),
|
|
2037
|
-
__metadata("design:type", ProductForKit)
|
|
2038
|
-
], KitProduct.prototype, "product", void 0);
|
|
2039
|
-
|
|
2040
|
-
class ProductForCategory extends ProductBase {
|
|
2041
|
-
static get identifiersFields() {
|
|
2042
|
-
return ['id'];
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
__decorate([
|
|
2046
|
-
Type(() => KitProduct),
|
|
2047
|
-
__metadata("design:type", Array)
|
|
2048
|
-
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
2049
|
-
|
|
2050
|
-
class Category extends CategoryBase {
|
|
2051
|
-
static get identifiersFields() {
|
|
2052
|
-
return ['id'];
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
__decorate([
|
|
2056
|
-
Type(() => ProductForCategory),
|
|
2057
|
-
__metadata("design:type", Array)
|
|
2058
|
-
], Category.prototype, "childrenProducts", void 0);
|
|
2059
|
-
|
|
2060
|
-
class CategoryCollectionChildren extends BaseModel {
|
|
2061
|
-
static get identifiersFields() {
|
|
2062
|
-
return ['collectionId', 'categoryId'];
|
|
2063
|
-
}
|
|
2064
|
-
}
|
|
2065
|
-
__decorate([
|
|
2066
|
-
Type(() => CategoryCollectionChildren),
|
|
2067
|
-
__metadata("design:type", CategoryCollectionChildren)
|
|
2068
|
-
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
2069
|
-
|
|
2070
|
-
class CategoryFilter extends BaseModel {
|
|
2071
|
-
static get identifiersFields() {
|
|
2072
|
-
return ['id'];
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
__decorate([
|
|
2076
|
-
Type(() => Filter),
|
|
2077
|
-
__metadata("design:type", Filter)
|
|
2078
|
-
], CategoryFilter.prototype, "filter", void 0);
|
|
2079
|
-
__decorate([
|
|
2080
|
-
Type(() => Category),
|
|
2081
|
-
__metadata("design:type", Category)
|
|
2082
|
-
], CategoryFilter.prototype, "category", void 0);
|
|
2083
|
-
|
|
2084
|
-
var GenderDestination;
|
|
2085
|
-
(function (GenderDestination) {
|
|
2086
|
-
GenderDestination["FEMALE"] = "female";
|
|
2087
|
-
GenderDestination["MALE"] = "male";
|
|
2088
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
2089
|
-
})(GenderDestination || (GenderDestination = {}));
|
|
2090
|
-
|
|
2091
|
-
var Shops;
|
|
2092
|
-
(function (Shops) {
|
|
2093
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
2094
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
2095
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
2096
|
-
Shops["ALL"] = "ALL";
|
|
2097
|
-
})(Shops || (Shops = {}));
|
|
2098
|
-
|
|
2099
|
-
class FilterOption extends BaseModel {
|
|
2100
|
-
static get identifiersFields() {
|
|
2101
|
-
return ['id'];
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
|
|
2105
|
-
class Product extends ProductBase {
|
|
2106
|
-
static get identifiersFields() {
|
|
2107
|
-
return ['id'];
|
|
2108
|
-
}
|
|
2109
|
-
}
|
|
2110
|
-
__decorate([
|
|
2111
|
-
Type(() => CategoryForProduct),
|
|
2112
|
-
__metadata("design:type", CategoryForProduct)
|
|
2113
|
-
], Product.prototype, "category", void 0);
|
|
2114
|
-
__decorate([
|
|
2115
|
-
Type(() => KitProduct),
|
|
2116
|
-
__metadata("design:type", Array)
|
|
2117
|
-
], Product.prototype, "kitProducts", void 0);
|
|
2118
|
-
|
|
2119
|
-
class Variant extends BaseModel {
|
|
2120
|
-
static get identifiersFields() {
|
|
2121
|
-
return ['id', 'productId'];
|
|
2122
|
-
}
|
|
2123
|
-
}
|
|
2124
|
-
|
|
2125
|
-
class Wishlist extends Category {
|
|
2126
|
-
static get identifiersFields() {
|
|
2127
|
-
return ['id'];
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
class Buy2Win extends BaseModel {
|
|
2132
|
-
static get identifiersFields() {
|
|
2133
|
-
return ['id'];
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
__decorate([
|
|
2137
|
-
Type(() => Category),
|
|
2138
|
-
__metadata("design:type", Array)
|
|
2139
|
-
], Buy2Win.prototype, "categories", void 0);
|
|
2140
|
-
|
|
2141
|
-
class CampaignDashboard extends BaseModel {
|
|
2142
|
-
static get identifiersFields() {
|
|
2143
|
-
return ['id'];
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
|
-
class CampaignHashtag extends BaseModel {
|
|
2148
|
-
static get identifiersFields() {
|
|
2149
|
-
return ['id'];
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
|
|
2153
|
-
class LineItem extends Product {
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
|
-
class ShippingMethod extends BaseModel {
|
|
2157
|
-
static get identifiersFields() {
|
|
2158
|
-
return ['id'];
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
class Checkout extends BaseModel {
|
|
2163
|
-
static get identifiersFields() {
|
|
2164
|
-
return ['id'];
|
|
2165
|
-
}
|
|
2166
|
-
}
|
|
2167
|
-
__decorate([
|
|
2168
|
-
Type(() => LineItem),
|
|
2169
|
-
__metadata("design:type", Array)
|
|
2170
|
-
], Checkout.prototype, "lineItems", void 0);
|
|
2171
|
-
__decorate([
|
|
2172
|
-
Type(() => User),
|
|
2173
|
-
__metadata("design:type", User)
|
|
2174
|
-
], Checkout.prototype, "user", void 0);
|
|
2175
|
-
__decorate([
|
|
2176
|
-
Type(() => UserAddress),
|
|
2177
|
-
__metadata("design:type", UserAddress)
|
|
2178
|
-
], Checkout.prototype, "shippingAddress", void 0);
|
|
2179
|
-
__decorate([
|
|
2180
|
-
Type(() => UserAddress),
|
|
2181
|
-
__metadata("design:type", UserAddress)
|
|
2182
|
-
], Checkout.prototype, "billingAddress", void 0);
|
|
2183
|
-
__decorate([
|
|
2184
|
-
Type(() => ShippingMethod),
|
|
2185
|
-
__metadata("design:type", ShippingMethod)
|
|
2186
|
-
], Checkout.prototype, "shipping", void 0);
|
|
2187
|
-
__decorate([
|
|
2188
|
-
Type(() => Coupon),
|
|
2189
|
-
__metadata("design:type", Coupon)
|
|
2190
|
-
], Checkout.prototype, "coupon", void 0);
|
|
2191
|
-
|
|
2192
|
-
var OrderStatus;
|
|
2193
|
-
(function (OrderStatus) {
|
|
2194
|
-
OrderStatus["AGUARDANDO_PAGAMENTO"] = "Aguardando pagamento";
|
|
2195
|
-
OrderStatus["EM_PREPARO"] = "Preparando pedido";
|
|
2196
|
-
OrderStatus["NF_EMITIDA"] = "Nota Fiscal Emitida";
|
|
2197
|
-
OrderStatus["AGUARDANDO_ENVIO"] = "Aguardando Transaportadora";
|
|
2198
|
-
OrderStatus["ENVIADO"] = "Enviado";
|
|
2199
|
-
OrderStatus["ENTREGUE"] = "Entregue";
|
|
2200
|
-
OrderStatus["CANCELADO"] = "Cancelado";
|
|
2201
|
-
OrderStatus["CREDIT_CARD"] = "credit_card";
|
|
2202
|
-
})(OrderStatus || (OrderStatus = {}));
|
|
2203
|
-
|
|
2204
|
-
class Order extends Checkout {
|
|
2205
|
-
}
|
|
2206
|
-
__decorate([
|
|
2207
|
-
Type(() => Payment),
|
|
2208
|
-
__metadata("design:type", Payment)
|
|
2209
|
-
], Order.prototype, "payment", void 0);
|
|
2210
|
-
|
|
2211
|
-
class CheckoutSubscription extends BaseModel {
|
|
2212
|
-
static get identifiersFields() {
|
|
2213
|
-
return ['id'];
|
|
2217
|
+
class CheckoutSubscription extends BaseModel {
|
|
2218
|
+
static get identifiersFields() {
|
|
2219
|
+
return ['id'];
|
|
2214
2220
|
}
|
|
2215
2221
|
}
|
|
2216
2222
|
__decorate([
|
|
@@ -2244,6 +2250,12 @@ class RoundProductPricesHelper {
|
|
|
2244
2250
|
}
|
|
2245
2251
|
}
|
|
2246
2252
|
|
|
2253
|
+
class Sequence extends BaseModel {
|
|
2254
|
+
static get identifiersFields() {
|
|
2255
|
+
return ['id'];
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2247
2259
|
var FilterType;
|
|
2248
2260
|
(function (FilterType) {
|
|
2249
2261
|
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
@@ -2916,155 +2928,22 @@ const withCrudFirestore = (MixinBase) => {
|
|
|
2916
2928
|
};
|
|
2917
2929
|
};
|
|
2918
2930
|
|
|
2919
|
-
class
|
|
2931
|
+
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2920
2932
|
constructor({ firestore, interceptors }) {
|
|
2921
2933
|
super({
|
|
2922
2934
|
firestore,
|
|
2923
|
-
collectionName: '
|
|
2924
|
-
model:
|
|
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,
|
|
2935
|
+
collectionName: 'categories',
|
|
2936
|
+
model: Category,
|
|
2937
2937
|
interceptors,
|
|
2938
2938
|
});
|
|
2939
|
-
this.parentRepository = parentRepository;
|
|
2940
2939
|
}
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
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();
|
|
2940
|
+
async getCategoryBySlug(slug, shop) {
|
|
2941
|
+
const categoryDocs = await getDocs(query(this.collection(this.collectionName), where('slug', '==', slug), where('shop', '==', shop), where('published', '==', true)));
|
|
2942
|
+
if (categoryDocs.size > 1)
|
|
2943
|
+
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
2944
|
+
if (categoryDocs.empty)
|
|
2945
|
+
throw new NotFoundError(`Document with slug ${slug} not found`);
|
|
2946
|
+
return categoryDocs.docs[0].data();
|
|
3068
2947
|
}
|
|
3069
2948
|
async getCategoriesForHome(categoryIds, limit = 4, gender) {
|
|
3070
2949
|
const categorySnap = await getDocs(query(this.collection(this.collectionName), where('id', 'in', categoryIds.filter(Boolean)), where('published', '==', true)));
|
|
@@ -3188,6 +3067,101 @@ class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpe
|
|
|
3188
3067
|
}
|
|
3189
3068
|
}
|
|
3190
3069
|
|
|
3070
|
+
class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3071
|
+
constructor({ firestore, interceptors }) {
|
|
3072
|
+
super({
|
|
3073
|
+
firestore,
|
|
3074
|
+
collectionName: 'sequences',
|
|
3075
|
+
model: Sequence,
|
|
3076
|
+
interceptors,
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3082
|
+
constructor({ firestore, interceptors }) {
|
|
3083
|
+
super({
|
|
3084
|
+
firestore,
|
|
3085
|
+
collectionName: 'dms',
|
|
3086
|
+
model: Home,
|
|
3087
|
+
interceptors,
|
|
3088
|
+
});
|
|
3089
|
+
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
3090
|
+
var _a, _b, _c;
|
|
3091
|
+
return ({
|
|
3092
|
+
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
3093
|
+
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
3094
|
+
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
3095
|
+
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)) || [],
|
|
3096
|
+
});
|
|
3097
|
+
};
|
|
3098
|
+
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
3099
|
+
var _a;
|
|
3100
|
+
return ({
|
|
3101
|
+
category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
|
|
3102
|
+
products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
|
|
3103
|
+
});
|
|
3104
|
+
};
|
|
3105
|
+
}
|
|
3106
|
+
buildModelInstance() {
|
|
3107
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3108
|
+
return {
|
|
3109
|
+
toFirestore: (data) => {
|
|
3110
|
+
const modifiedData = this.homeToFirestore(data);
|
|
3111
|
+
return toFirestore(modifiedData);
|
|
3112
|
+
},
|
|
3113
|
+
fromFirestore: (snap) => {
|
|
3114
|
+
const instance = fromFirestore(snap);
|
|
3115
|
+
return this.homeFromFirestore(instance);
|
|
3116
|
+
},
|
|
3117
|
+
};
|
|
3118
|
+
}
|
|
3119
|
+
homeToFirestore(home) {
|
|
3120
|
+
var _a, _b, _c, _d;
|
|
3121
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3122
|
+
home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
|
|
3123
|
+
home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
|
|
3124
|
+
home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
|
|
3125
|
+
}
|
|
3126
|
+
return home;
|
|
3127
|
+
}
|
|
3128
|
+
homeFromFirestore(home) {
|
|
3129
|
+
var _a;
|
|
3130
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3131
|
+
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
3132
|
+
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
3133
|
+
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
3134
|
+
home.data.createdAt =
|
|
3135
|
+
home.data.createdAt instanceof Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
3136
|
+
home.data.expiresAt =
|
|
3137
|
+
home.data.expiresAt instanceof Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
3138
|
+
}
|
|
3139
|
+
return home;
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3142
|
+
|
|
3143
|
+
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3144
|
+
constructor({ firestore, interceptors }) {
|
|
3145
|
+
super({
|
|
3146
|
+
firestore,
|
|
3147
|
+
collectionName: 'shopMenus',
|
|
3148
|
+
model: ShopMenu,
|
|
3149
|
+
interceptors,
|
|
3150
|
+
});
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
|
|
3154
|
+
class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3155
|
+
constructor({ firestore, interceptors, }) {
|
|
3156
|
+
super({
|
|
3157
|
+
firestore,
|
|
3158
|
+
collectionName: 'shopSettings',
|
|
3159
|
+
model: ShopSettings,
|
|
3160
|
+
interceptors,
|
|
3161
|
+
});
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3191
3165
|
class Buy2WinFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3192
3166
|
constructor({ firestore, interceptors }) {
|
|
3193
3167
|
super({
|
|
@@ -3318,6 +3292,17 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3318
3292
|
}
|
|
3319
3293
|
}
|
|
3320
3294
|
|
|
3295
|
+
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3296
|
+
constructor({ firestore, interceptors, }) {
|
|
3297
|
+
super({
|
|
3298
|
+
firestore,
|
|
3299
|
+
collectionName: 'paymentBlockedAttempts',
|
|
3300
|
+
model: OrderBlocked,
|
|
3301
|
+
interceptors,
|
|
3302
|
+
});
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3321
3306
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3322
3307
|
constructor({ firestore, interceptors }) {
|
|
3323
3308
|
super({
|
|
@@ -3340,87 +3325,136 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
|
|
|
3340
3325
|
}
|
|
3341
3326
|
}
|
|
3342
3327
|
|
|
3343
|
-
class
|
|
3328
|
+
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3344
3329
|
constructor({ firestore, interceptors }) {
|
|
3345
3330
|
super({
|
|
3346
3331
|
firestore,
|
|
3347
|
-
collectionName: '
|
|
3348
|
-
model:
|
|
3332
|
+
collectionName: 'leads',
|
|
3333
|
+
model: Lead,
|
|
3349
3334
|
interceptors,
|
|
3350
3335
|
});
|
|
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
3336
|
}
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3340
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3341
|
+
super({
|
|
3342
|
+
firestore,
|
|
3343
|
+
collectionName: 'editions',
|
|
3344
|
+
parentIdField: 'subscriptionId',
|
|
3345
|
+
model: Edition,
|
|
3346
|
+
interceptors,
|
|
3347
|
+
});
|
|
3348
|
+
this.parentRepository = parentRepository;
|
|
3380
3349
|
}
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3350
|
+
}
|
|
3351
|
+
|
|
3352
|
+
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3353
|
+
constructor({ firestore, interceptors, }) {
|
|
3354
|
+
super({
|
|
3355
|
+
firestore,
|
|
3356
|
+
collectionName: 'subscription',
|
|
3357
|
+
model: Subscription,
|
|
3358
|
+
interceptors,
|
|
3359
|
+
});
|
|
3389
3360
|
}
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
}
|
|
3401
|
-
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3364
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3365
|
+
super({
|
|
3366
|
+
firestore,
|
|
3367
|
+
collectionName: 'payments',
|
|
3368
|
+
parentIdField: 'subscriptionId',
|
|
3369
|
+
model: SubscriptionPayment,
|
|
3370
|
+
interceptors,
|
|
3371
|
+
});
|
|
3372
|
+
this.parentRepository = parentRepository;
|
|
3402
3373
|
}
|
|
3403
3374
|
}
|
|
3404
3375
|
|
|
3405
|
-
class
|
|
3376
|
+
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3377
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3378
|
+
super({
|
|
3379
|
+
firestore,
|
|
3380
|
+
collectionName: 'address',
|
|
3381
|
+
parentIdField: 'userId',
|
|
3382
|
+
model: UserAddress,
|
|
3383
|
+
interceptors,
|
|
3384
|
+
});
|
|
3385
|
+
this.parentRepository = parentRepository;
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
|
|
3389
|
+
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3390
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3391
|
+
super({
|
|
3392
|
+
firestore,
|
|
3393
|
+
collectionName: 'CX',
|
|
3394
|
+
parentIdField: 'userId',
|
|
3395
|
+
model: BeautyProfile,
|
|
3396
|
+
interceptors,
|
|
3397
|
+
});
|
|
3398
|
+
this.parentRepository = parentRepository;
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3406
3403
|
constructor({ firestore, interceptors }) {
|
|
3407
3404
|
super({
|
|
3408
3405
|
firestore,
|
|
3409
|
-
collectionName: '
|
|
3410
|
-
model:
|
|
3406
|
+
collectionName: 'users',
|
|
3407
|
+
model: User,
|
|
3411
3408
|
interceptors,
|
|
3412
3409
|
});
|
|
3413
3410
|
}
|
|
3411
|
+
async get(identifiers) {
|
|
3412
|
+
const user = await super.get({ id: identifiers.id });
|
|
3413
|
+
user.beautyProfile = await this.getBeautyProfile(user.id);
|
|
3414
|
+
user.isSubscriber = await this.checkIfIsSubscriber(user.id);
|
|
3415
|
+
return user;
|
|
3416
|
+
}
|
|
3417
|
+
async checkIfExistsByField(field, value) {
|
|
3418
|
+
const result = await this.find({ filters: { [field]: value } });
|
|
3419
|
+
return result.count > 0;
|
|
3420
|
+
}
|
|
3421
|
+
buildModelInstance() {
|
|
3422
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3423
|
+
return {
|
|
3424
|
+
toFirestore: (data) => {
|
|
3425
|
+
const plain = toFirestore(data);
|
|
3426
|
+
delete plain.isSubscriber;
|
|
3427
|
+
return plain;
|
|
3428
|
+
},
|
|
3429
|
+
fromFirestore,
|
|
3430
|
+
};
|
|
3431
|
+
}
|
|
3432
|
+
async getBeautyProfile(userId) {
|
|
3433
|
+
const beautyProfile = await getDoc(doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
|
|
3434
|
+
return beautyProfile.data();
|
|
3435
|
+
}
|
|
3436
|
+
async checkIfIsSubscriber(userId) {
|
|
3437
|
+
const docs = await getDocs(query(this.collection('subscription'), where('user.id', '==', userId), where('status', '==', 'active')));
|
|
3438
|
+
return !!docs && !!docs.size;
|
|
3439
|
+
}
|
|
3440
|
+
buildBeautyProfileModelInstance() {
|
|
3441
|
+
return {
|
|
3442
|
+
toFirestore: (data) => data.toPlain(),
|
|
3443
|
+
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
3444
|
+
};
|
|
3445
|
+
}
|
|
3414
3446
|
}
|
|
3415
3447
|
|
|
3416
|
-
class
|
|
3417
|
-
constructor({ firestore, interceptors,
|
|
3448
|
+
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3449
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3418
3450
|
super({
|
|
3419
3451
|
firestore,
|
|
3420
|
-
collectionName: '
|
|
3421
|
-
|
|
3452
|
+
collectionName: 'payment_method',
|
|
3453
|
+
parentIdField: 'userId',
|
|
3454
|
+
model: UserPaymentMethod,
|
|
3422
3455
|
interceptors,
|
|
3423
3456
|
});
|
|
3457
|
+
this.parentRepository = parentRepository;
|
|
3424
3458
|
}
|
|
3425
3459
|
}
|
|
3426
3460
|
|
|
@@ -5510,4 +5544,4 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5510
5544
|
}
|
|
5511
5545
|
}
|
|
5512
5546
|
|
|
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 };
|
|
5547
|
+
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 };
|