@infrab4a/connect 4.2.4-beta.7 → 4.2.4
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 +1156 -1859
- package/index.esm.js +1029 -1695
- package/package.json +1 -1
- package/src/domain/index.d.ts +3 -4
- package/src/domain/shopping/index.d.ts +0 -4
- package/src/domain/shopping/models/index.d.ts +0 -3
- package/src/domain/shopping/models/order.d.ts +2 -2
- package/src/domain/shopping/models/payment.d.ts +61 -7
- package/src/domain/shopping/models/types/index.d.ts +4 -4
- package/src/domain/shopping/repositories/index.d.ts +0 -1
- package/src/infra/firebase/firestore/repositories/index.d.ts +2 -3
- package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +0 -1
- package/src/infra/hasura-graphql/repositories/catalog/wishlist-hasura-graphql.repository.d.ts +2 -1
- package/src/utils/index.d.ts +2 -2
- package/src/domain/general/index.d.ts +0 -2
- package/src/domain/general/models/index.d.ts +0 -1
- package/src/domain/general/models/sequences.d.ts +0 -9
- package/src/domain/general/repositories/index.d.ts +0 -1
- package/src/domain/general/repositories/sequences.repository.d.ts +0 -4
- package/src/domain/shopping/enums/index.d.ts +0 -2
- package/src/domain/shopping/enums/payment-methods.enum.d.ts +0 -6
- package/src/domain/shopping/enums/payment-providers.enum.d.ts +0 -5
- package/src/domain/shopping/factories/adyen-payment-method.factory.d.ts +0 -8
- package/src/domain/shopping/factories/base-payment-method.factory.d.ts +0 -7
- package/src/domain/shopping/factories/glampoints-payment-method.factory.d.ts +0 -8
- package/src/domain/shopping/factories/index.d.ts +0 -4
- package/src/domain/shopping/factories/pagarme-payment-method.factory.d.ts +0 -10
- package/src/domain/shopping/factories/payment-provider.factory.d.ts +0 -15
- package/src/domain/shopping/interfaces/index.d.ts +0 -5
- package/src/domain/shopping/interfaces/payment-method-factory.interface.d.ts +0 -14
- package/src/domain/shopping/interfaces/payment-provider-bank-slip.interface.d.ts +0 -5
- package/src/domain/shopping/interfaces/payment-provider-card.interface.d.ts +0 -7
- package/src/domain/shopping/interfaces/payment-provider-glampoints.interface.d.ts +0 -5
- package/src/domain/shopping/interfaces/payment-provider-pix.interface.d.ts +0 -5
- package/src/domain/shopping/models/order-blocked.d.ts +0 -26
- package/src/domain/shopping/models/payment.transaction.d.ts +0 -66
- package/src/domain/shopping/repositories/order-blocked.repository.d.ts +0 -4
- package/src/domain/shopping/services/adyen-card-payment.service.d.ts +0 -28
- package/src/domain/shopping/services/antifraude.service.d.ts +0 -19
- package/src/domain/shopping/services/glampoints-payment.service.d.ts +0 -4
- package/src/domain/shopping/services/index.d.ts +0 -6
- package/src/domain/shopping/services/pagarme-bank-slip-payment.service.d.ts +0 -8
- package/src/domain/shopping/services/pagarme-card-payment.service.d.ts +0 -10
- package/src/domain/shopping/services/pagarme-pix-payment.service.d.ts +0 -8
- package/src/domain/shopping/types/adyen-credentials.type.d.ts +0 -6
- package/src/domain/shopping/types/index.d.ts +0 -5
- package/src/domain/shopping/types/pagarme-credentials.type.d.ts +0 -5
- package/src/domain/shopping/types/payment-card-info.type.d.ts +0 -4
- package/src/domain/shopping/types/payment-method.type.d.ts +0 -2
- package/src/domain/shopping/types/payment-provider.type.d.ts +0 -2
- package/src/infra/firebase/firestore/repositories/general/index.d.ts +0 -1
- package/src/infra/firebase/firestore/repositories/general/sequences-firestore.repository.d.ts +0 -7
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +0 -7
package/index.cjs.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
require('reflect-metadata');
|
|
6
|
-
var tslib_1 = require('tslib');
|
|
7
6
|
var classTransformer = require('class-transformer');
|
|
7
|
+
var tslib = require('tslib');
|
|
8
8
|
var dateFns = require('date-fns');
|
|
9
9
|
var lodash = require('lodash');
|
|
10
10
|
var debug = require('debug');
|
|
@@ -16,69 +16,8 @@ var gqlQueryBuilder = require('gql-query-builder');
|
|
|
16
16
|
|
|
17
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
18
|
|
|
19
|
-
function _interopNamespace(e) {
|
|
20
|
-
if (e && e.__esModule) return e;
|
|
21
|
-
var n = Object.create(null);
|
|
22
|
-
if (e) {
|
|
23
|
-
Object.keys(e).forEach(function (k) {
|
|
24
|
-
if (k !== 'default') {
|
|
25
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () { return e[k]; }
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
n["default"] = e;
|
|
34
|
-
return Object.freeze(n);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
var tslib_1__namespace = /*#__PURE__*/_interopNamespace(tslib_1);
|
|
38
19
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
39
20
|
|
|
40
|
-
exports.PaymentMethods = void 0;
|
|
41
|
-
(function (PaymentMethods) {
|
|
42
|
-
PaymentMethods["CARD"] = "card";
|
|
43
|
-
PaymentMethods["BANKSLIP"] = "bankSlip";
|
|
44
|
-
PaymentMethods["PIX"] = "pix";
|
|
45
|
-
PaymentMethods["POINTS"] = "glampoints";
|
|
46
|
-
})(exports.PaymentMethods || (exports.PaymentMethods = {}));
|
|
47
|
-
|
|
48
|
-
exports.PaymentProviders = void 0;
|
|
49
|
-
(function (PaymentProviders) {
|
|
50
|
-
PaymentProviders["PAGARME"] = "pagarMe";
|
|
51
|
-
PaymentProviders["ADYEN"] = "adyen";
|
|
52
|
-
PaymentProviders["GLAMPOINTS"] = "glampoints";
|
|
53
|
-
})(exports.PaymentProviders || (exports.PaymentProviders = {}));
|
|
54
|
-
|
|
55
|
-
class BasePaymentMethodFactory {
|
|
56
|
-
constructor(methods) {
|
|
57
|
-
this.methods = methods;
|
|
58
|
-
}
|
|
59
|
-
build(method) {
|
|
60
|
-
return this.methods[method];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
class AdyenPaymentMethodFactory extends BasePaymentMethodFactory {
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
class GlampointsPaymentMethodFactory extends BasePaymentMethodFactory {
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
class PagarmePaymentMethodFactory extends BasePaymentMethodFactory {
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
class PaymentProviderFactory {
|
|
74
|
-
constructor(paymentProviders) {
|
|
75
|
-
this.paymentProviders = paymentProviders;
|
|
76
|
-
}
|
|
77
|
-
build(provider) {
|
|
78
|
-
return this.paymentProviders[provider];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
21
|
class BaseModel {
|
|
83
22
|
get identifier() {
|
|
84
23
|
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
@@ -102,187 +41,6 @@ class BaseModel {
|
|
|
102
41
|
}
|
|
103
42
|
}
|
|
104
43
|
|
|
105
|
-
class Filter extends BaseModel {
|
|
106
|
-
static get identifiersFields() {
|
|
107
|
-
return ['id'];
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
class CategoryBase extends BaseModel {
|
|
112
|
-
static get identifiersFields() {
|
|
113
|
-
return ['id'];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
tslib_1.__decorate([
|
|
117
|
-
classTransformer.Type(() => CategoryBase),
|
|
118
|
-
tslib_1.__metadata("design:type", CategoryBase)
|
|
119
|
-
], CategoryBase.prototype, "parent", void 0);
|
|
120
|
-
tslib_1.__decorate([
|
|
121
|
-
classTransformer.Type(() => Filter),
|
|
122
|
-
tslib_1.__metadata("design:type", Array)
|
|
123
|
-
], CategoryBase.prototype, "filters", void 0);
|
|
124
|
-
|
|
125
|
-
class CategoryForProduct extends CategoryBase {
|
|
126
|
-
static get identifiersFields() {
|
|
127
|
-
return ['id'];
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
class ProductBase extends BaseModel {
|
|
132
|
-
get evaluation() {
|
|
133
|
-
return {
|
|
134
|
-
reviews: this.reviews,
|
|
135
|
-
count: this.reviewsTotal,
|
|
136
|
-
rating: this.rate,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
set evaluation(evaluation) {
|
|
140
|
-
if (!evaluation) {
|
|
141
|
-
this.reviews = null;
|
|
142
|
-
this.reviewsTotal = null;
|
|
143
|
-
this.rate = null;
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
this.reviews = evaluation.reviews || this.reviews;
|
|
147
|
-
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
148
|
-
this.rate = evaluation.rating || this.rate;
|
|
149
|
-
}
|
|
150
|
-
static get identifiersFields() {
|
|
151
|
-
return ['id'];
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
class ProductForKit extends ProductBase {
|
|
156
|
-
static get identifiersFields() {
|
|
157
|
-
return ['id'];
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
tslib_1.__decorate([
|
|
161
|
-
classTransformer.Type(() => CategoryForProduct),
|
|
162
|
-
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
163
|
-
], ProductForKit.prototype, "category", void 0);
|
|
164
|
-
|
|
165
|
-
class KitProduct extends BaseModel {
|
|
166
|
-
static get identifiersFields() {
|
|
167
|
-
return ['productId', 'kitProductId'];
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
tslib_1.__decorate([
|
|
171
|
-
classTransformer.Type(() => ProductForKit),
|
|
172
|
-
tslib_1.__metadata("design:type", ProductForKit)
|
|
173
|
-
], KitProduct.prototype, "kit", void 0);
|
|
174
|
-
tslib_1.__decorate([
|
|
175
|
-
classTransformer.Type(() => ProductForKit),
|
|
176
|
-
tslib_1.__metadata("design:type", ProductForKit)
|
|
177
|
-
], KitProduct.prototype, "product", void 0);
|
|
178
|
-
|
|
179
|
-
class ProductForCategory extends ProductBase {
|
|
180
|
-
static get identifiersFields() {
|
|
181
|
-
return ['id'];
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
tslib_1.__decorate([
|
|
185
|
-
classTransformer.Type(() => KitProduct),
|
|
186
|
-
tslib_1.__metadata("design:type", Array)
|
|
187
|
-
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
188
|
-
|
|
189
|
-
class Category extends CategoryBase {
|
|
190
|
-
static get identifiersFields() {
|
|
191
|
-
return ['id'];
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
tslib_1.__decorate([
|
|
195
|
-
classTransformer.Type(() => ProductForCategory),
|
|
196
|
-
tslib_1.__metadata("design:type", Array)
|
|
197
|
-
], Category.prototype, "childrenProducts", void 0);
|
|
198
|
-
|
|
199
|
-
class CategoryCollectionChildren extends BaseModel {
|
|
200
|
-
static get identifiersFields() {
|
|
201
|
-
return ['collectionId', 'categoryId'];
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
tslib_1.__decorate([
|
|
205
|
-
classTransformer.Type(() => CategoryCollectionChildren),
|
|
206
|
-
tslib_1.__metadata("design:type", CategoryCollectionChildren)
|
|
207
|
-
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
208
|
-
|
|
209
|
-
class CategoryFilter extends BaseModel {
|
|
210
|
-
static get identifiersFields() {
|
|
211
|
-
return ['id'];
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
tslib_1.__decorate([
|
|
215
|
-
classTransformer.Type(() => Filter),
|
|
216
|
-
tslib_1.__metadata("design:type", Filter)
|
|
217
|
-
], CategoryFilter.prototype, "filter", void 0);
|
|
218
|
-
tslib_1.__decorate([
|
|
219
|
-
classTransformer.Type(() => Category),
|
|
220
|
-
tslib_1.__metadata("design:type", Category)
|
|
221
|
-
], CategoryFilter.prototype, "category", void 0);
|
|
222
|
-
|
|
223
|
-
exports.GenderDestination = void 0;
|
|
224
|
-
(function (GenderDestination) {
|
|
225
|
-
GenderDestination["FEMALE"] = "female";
|
|
226
|
-
GenderDestination["MALE"] = "male";
|
|
227
|
-
GenderDestination["UNISEX"] = "unisex";
|
|
228
|
-
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
229
|
-
|
|
230
|
-
exports.Shops = void 0;
|
|
231
|
-
(function (Shops) {
|
|
232
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
233
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
234
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
235
|
-
Shops["ALL"] = "ALL";
|
|
236
|
-
})(exports.Shops || (exports.Shops = {}));
|
|
237
|
-
|
|
238
|
-
class FilterOption extends BaseModel {
|
|
239
|
-
static get identifiersFields() {
|
|
240
|
-
return ['id'];
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
class Product extends ProductBase {
|
|
245
|
-
static get identifiersFields() {
|
|
246
|
-
return ['id'];
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
tslib_1.__decorate([
|
|
250
|
-
classTransformer.Type(() => CategoryForProduct),
|
|
251
|
-
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
252
|
-
], Product.prototype, "category", void 0);
|
|
253
|
-
tslib_1.__decorate([
|
|
254
|
-
classTransformer.Type(() => KitProduct),
|
|
255
|
-
tslib_1.__metadata("design:type", Array)
|
|
256
|
-
], Product.prototype, "kitProducts", void 0);
|
|
257
|
-
|
|
258
|
-
class ProductReviews extends BaseModel {
|
|
259
|
-
static get identifiersFields() {
|
|
260
|
-
return ['id'];
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
class Variant extends BaseModel {
|
|
265
|
-
static get identifiersFields() {
|
|
266
|
-
return ['id', 'productId'];
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
class Wishlist extends Category {
|
|
271
|
-
static get identifiersFields() {
|
|
272
|
-
return ['id'];
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
class Buy2Win extends BaseModel {
|
|
277
|
-
static get identifiersFields() {
|
|
278
|
-
return ['id'];
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
tslib_1.__decorate([
|
|
282
|
-
classTransformer.Type(() => Category),
|
|
283
|
-
tslib_1.__metadata("design:type", Array)
|
|
284
|
-
], Buy2Win.prototype, "categories", void 0);
|
|
285
|
-
|
|
286
44
|
exports.Where = void 0;
|
|
287
45
|
(function (Where) {
|
|
288
46
|
Where["EQUALS"] = "==";
|
|
@@ -308,18 +66,6 @@ exports.UpdateOptionActions = void 0;
|
|
|
308
66
|
UpdateOptionActions["NULL"] = "null";
|
|
309
67
|
})(exports.UpdateOptionActions || (exports.UpdateOptionActions = {}));
|
|
310
68
|
|
|
311
|
-
class CampaignDashboard extends BaseModel {
|
|
312
|
-
static get identifiersFields() {
|
|
313
|
-
return ['id'];
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
class CampaignHashtag extends BaseModel {
|
|
318
|
-
static get identifiersFields() {
|
|
319
|
-
return ['id'];
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
69
|
exports.AccessoryImportances = void 0;
|
|
324
70
|
(function (AccessoryImportances) {
|
|
325
71
|
AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
|
|
@@ -546,661 +292,577 @@ exports.Status = void 0;
|
|
|
546
292
|
Status["CANCELLED"] = "Cancelado";
|
|
547
293
|
})(exports.Status || (exports.Status = {}));
|
|
548
294
|
|
|
549
|
-
class
|
|
295
|
+
class Payment extends BaseModel {
|
|
296
|
+
static get identifiersFields() {
|
|
297
|
+
return ['id'];
|
|
298
|
+
}
|
|
550
299
|
}
|
|
551
|
-
|
|
300
|
+
tslib.__decorate([
|
|
552
301
|
classTransformer.Expose({ name: 'refuse_reason' }),
|
|
553
|
-
|
|
554
|
-
],
|
|
555
|
-
|
|
302
|
+
tslib.__metadata("design:type", String)
|
|
303
|
+
], Payment.prototype, "refuseReason", void 0);
|
|
304
|
+
tslib.__decorate([
|
|
556
305
|
classTransformer.Expose({ name: 'status_reason' }),
|
|
557
|
-
|
|
558
|
-
],
|
|
559
|
-
|
|
306
|
+
tslib.__metadata("design:type", String)
|
|
307
|
+
], Payment.prototype, "statusReason", void 0);
|
|
308
|
+
tslib.__decorate([
|
|
560
309
|
classTransformer.Expose({ name: 'acquirer_response_code' }),
|
|
561
|
-
|
|
562
|
-
],
|
|
563
|
-
|
|
310
|
+
tslib.__metadata("design:type", String)
|
|
311
|
+
], Payment.prototype, "acquirerResponseCode", void 0);
|
|
312
|
+
tslib.__decorate([
|
|
564
313
|
classTransformer.Expose({ name: 'acquirer_name' }),
|
|
565
|
-
|
|
566
|
-
],
|
|
567
|
-
|
|
314
|
+
tslib.__metadata("design:type", String)
|
|
315
|
+
], Payment.prototype, "acquirerName", void 0);
|
|
316
|
+
tslib.__decorate([
|
|
568
317
|
classTransformer.Expose({ name: 'acquirer_id' }),
|
|
569
|
-
|
|
570
|
-
],
|
|
571
|
-
|
|
318
|
+
tslib.__metadata("design:type", String)
|
|
319
|
+
], Payment.prototype, "acquirerId", void 0);
|
|
320
|
+
tslib.__decorate([
|
|
572
321
|
classTransformer.Expose({ name: 'authorization_code' }),
|
|
573
|
-
|
|
574
|
-
],
|
|
575
|
-
|
|
322
|
+
tslib.__metadata("design:type", String)
|
|
323
|
+
], Payment.prototype, "authorizationCode", void 0);
|
|
324
|
+
tslib.__decorate([
|
|
576
325
|
classTransformer.Expose({ name: 'soft_descriptor' }),
|
|
577
|
-
|
|
578
|
-
],
|
|
579
|
-
|
|
326
|
+
tslib.__metadata("design:type", String)
|
|
327
|
+
], Payment.prototype, "softDescriptor", void 0);
|
|
328
|
+
tslib.__decorate([
|
|
580
329
|
classTransformer.Expose({ name: 'date_created' }),
|
|
581
|
-
|
|
582
|
-
],
|
|
583
|
-
|
|
330
|
+
tslib.__metadata("design:type", String)
|
|
331
|
+
], Payment.prototype, "dateCreated", void 0);
|
|
332
|
+
tslib.__decorate([
|
|
584
333
|
classTransformer.Expose({ name: 'date_updated' }),
|
|
585
|
-
|
|
586
|
-
],
|
|
587
|
-
|
|
334
|
+
tslib.__metadata("design:type", String)
|
|
335
|
+
], Payment.prototype, "dateUpdated", void 0);
|
|
336
|
+
tslib.__decorate([
|
|
588
337
|
classTransformer.Expose({ name: 'authorized_amount' }),
|
|
589
|
-
|
|
590
|
-
],
|
|
591
|
-
|
|
338
|
+
tslib.__metadata("design:type", Number)
|
|
339
|
+
], Payment.prototype, "authorizedAmount", void 0);
|
|
340
|
+
tslib.__decorate([
|
|
592
341
|
classTransformer.Expose({ name: 'paid_amount' }),
|
|
593
|
-
|
|
594
|
-
],
|
|
595
|
-
|
|
342
|
+
tslib.__metadata("design:type", Number)
|
|
343
|
+
], Payment.prototype, "paidAmount", void 0);
|
|
344
|
+
tslib.__decorate([
|
|
596
345
|
classTransformer.Expose({ name: 'refunded_amount' }),
|
|
597
|
-
|
|
598
|
-
],
|
|
599
|
-
|
|
346
|
+
tslib.__metadata("design:type", Number)
|
|
347
|
+
], Payment.prototype, "refundedAmount", void 0);
|
|
348
|
+
tslib.__decorate([
|
|
600
349
|
classTransformer.Expose({ name: 'card_holder_name' }),
|
|
601
|
-
|
|
602
|
-
],
|
|
603
|
-
|
|
350
|
+
tslib.__metadata("design:type", String)
|
|
351
|
+
], Payment.prototype, "cardHolderName", void 0);
|
|
352
|
+
tslib.__decorate([
|
|
604
353
|
classTransformer.Expose({ name: 'card_last_digits' }),
|
|
605
|
-
|
|
606
|
-
],
|
|
607
|
-
|
|
354
|
+
tslib.__metadata("design:type", String)
|
|
355
|
+
], Payment.prototype, "cardLastDigits", void 0);
|
|
356
|
+
tslib.__decorate([
|
|
608
357
|
classTransformer.Expose({ name: 'card_first_digits' }),
|
|
609
|
-
|
|
610
|
-
],
|
|
611
|
-
|
|
358
|
+
tslib.__metadata("design:type", String)
|
|
359
|
+
], Payment.prototype, "cardFirstDigits", void 0);
|
|
360
|
+
tslib.__decorate([
|
|
612
361
|
classTransformer.Expose({ name: 'card_brand' }),
|
|
613
|
-
|
|
614
|
-
],
|
|
615
|
-
|
|
362
|
+
tslib.__metadata("design:type", String)
|
|
363
|
+
], Payment.prototype, "cardBrand", void 0);
|
|
364
|
+
tslib.__decorate([
|
|
616
365
|
classTransformer.Expose({ name: 'card_pin_mode' }),
|
|
617
|
-
|
|
618
|
-
],
|
|
619
|
-
|
|
366
|
+
tslib.__metadata("design:type", String)
|
|
367
|
+
], Payment.prototype, "cardPinMode", void 0);
|
|
368
|
+
tslib.__decorate([
|
|
620
369
|
classTransformer.Expose({ name: 'card_magstripe_fallback' }),
|
|
621
|
-
|
|
622
|
-
],
|
|
623
|
-
|
|
370
|
+
tslib.__metadata("design:type", Boolean)
|
|
371
|
+
], Payment.prototype, "cardMagstripeFallback", void 0);
|
|
372
|
+
tslib.__decorate([
|
|
624
373
|
classTransformer.Expose({ name: 'cvm_pin' }),
|
|
625
|
-
|
|
626
|
-
],
|
|
627
|
-
|
|
374
|
+
tslib.__metadata("design:type", Boolean)
|
|
375
|
+
], Payment.prototype, "cvmPin", void 0);
|
|
376
|
+
tslib.__decorate([
|
|
628
377
|
classTransformer.Expose({ name: 'postback_url' }),
|
|
629
|
-
|
|
630
|
-
],
|
|
631
|
-
|
|
378
|
+
tslib.__metadata("design:type", String)
|
|
379
|
+
], Payment.prototype, "postbackUrl", void 0);
|
|
380
|
+
tslib.__decorate([
|
|
632
381
|
classTransformer.Expose({ name: 'payment_method' }),
|
|
633
|
-
|
|
634
|
-
],
|
|
635
|
-
|
|
382
|
+
tslib.__metadata("design:type", String)
|
|
383
|
+
], Payment.prototype, "paymentMethod", void 0);
|
|
384
|
+
tslib.__decorate([
|
|
636
385
|
classTransformer.Expose({ name: 'capture_method' }),
|
|
637
|
-
|
|
638
|
-
],
|
|
639
|
-
|
|
386
|
+
tslib.__metadata("design:type", String)
|
|
387
|
+
], Payment.prototype, "captureMethod", void 0);
|
|
388
|
+
tslib.__decorate([
|
|
640
389
|
classTransformer.Expose({ name: 'antifraud_score' }),
|
|
641
|
-
|
|
642
|
-
],
|
|
643
|
-
|
|
390
|
+
tslib.__metadata("design:type", String)
|
|
391
|
+
], Payment.prototype, "antifraudScore", void 0);
|
|
392
|
+
tslib.__decorate([
|
|
644
393
|
classTransformer.Expose({ name: 'boleto_url' }),
|
|
645
|
-
|
|
646
|
-
],
|
|
647
|
-
|
|
394
|
+
tslib.__metadata("design:type", String)
|
|
395
|
+
], Payment.prototype, "boletoUrl", void 0);
|
|
396
|
+
tslib.__decorate([
|
|
648
397
|
classTransformer.Expose({ name: 'boleto_barcode' }),
|
|
649
|
-
|
|
650
|
-
],
|
|
651
|
-
|
|
398
|
+
tslib.__metadata("design:type", String)
|
|
399
|
+
], Payment.prototype, "boletoBarcode", void 0);
|
|
400
|
+
tslib.__decorate([
|
|
652
401
|
classTransformer.Expose({ name: 'boleto_expiration_date' }),
|
|
653
|
-
|
|
654
|
-
],
|
|
655
|
-
|
|
402
|
+
tslib.__metadata("design:type", String)
|
|
403
|
+
], Payment.prototype, "boletoExpirationDate", void 0);
|
|
404
|
+
tslib.__decorate([
|
|
656
405
|
classTransformer.Expose({ name: 'subscription_id' }),
|
|
657
|
-
|
|
658
|
-
],
|
|
659
|
-
|
|
406
|
+
tslib.__metadata("design:type", String)
|
|
407
|
+
], Payment.prototype, "subscriptionId", void 0);
|
|
408
|
+
tslib.__decorate([
|
|
660
409
|
classTransformer.Expose({ name: 'split_rules' }),
|
|
661
|
-
|
|
662
|
-
],
|
|
663
|
-
|
|
410
|
+
tslib.__metadata("design:type", String)
|
|
411
|
+
], Payment.prototype, "splitRules", void 0);
|
|
412
|
+
tslib.__decorate([
|
|
664
413
|
classTransformer.Expose({ name: 'antifraud_metadata' }),
|
|
665
|
-
|
|
666
|
-
],
|
|
667
|
-
|
|
414
|
+
tslib.__metadata("design:type", Object)
|
|
415
|
+
], Payment.prototype, "antifraudMetadata", void 0);
|
|
416
|
+
tslib.__decorate([
|
|
668
417
|
classTransformer.Expose({ name: 'reference_key' }),
|
|
669
|
-
|
|
670
|
-
],
|
|
671
|
-
|
|
418
|
+
tslib.__metadata("design:type", String)
|
|
419
|
+
], Payment.prototype, "referenceKey", void 0);
|
|
420
|
+
tslib.__decorate([
|
|
672
421
|
classTransformer.Expose({ name: 'local_transaction_id' }),
|
|
673
|
-
|
|
674
|
-
],
|
|
675
|
-
|
|
422
|
+
tslib.__metadata("design:type", String)
|
|
423
|
+
], Payment.prototype, "localTransactionId", void 0);
|
|
424
|
+
tslib.__decorate([
|
|
676
425
|
classTransformer.Expose({ name: 'local_time' }),
|
|
677
|
-
|
|
678
|
-
],
|
|
679
|
-
|
|
426
|
+
tslib.__metadata("design:type", String)
|
|
427
|
+
], Payment.prototype, "localTime", void 0);
|
|
428
|
+
tslib.__decorate([
|
|
680
429
|
classTransformer.Expose({ name: 'fraud_covered' }),
|
|
681
|
-
|
|
682
|
-
],
|
|
683
|
-
|
|
430
|
+
tslib.__metadata("design:type", Boolean)
|
|
431
|
+
], Payment.prototype, "fraudCovered", void 0);
|
|
432
|
+
tslib.__decorate([
|
|
684
433
|
classTransformer.Expose({ name: 'fraud_reimbursed' }),
|
|
685
|
-
|
|
686
|
-
],
|
|
687
|
-
|
|
434
|
+
tslib.__metadata("design:type", String)
|
|
435
|
+
], Payment.prototype, "fraudReimbursed", void 0);
|
|
436
|
+
tslib.__decorate([
|
|
688
437
|
classTransformer.Expose({ name: 'order_id' }),
|
|
689
|
-
|
|
690
|
-
],
|
|
691
|
-
|
|
438
|
+
tslib.__metadata("design:type", String)
|
|
439
|
+
], Payment.prototype, "orderId", void 0);
|
|
440
|
+
tslib.__decorate([
|
|
692
441
|
classTransformer.Expose({ name: 'risk_level' }),
|
|
693
|
-
|
|
694
|
-
],
|
|
695
|
-
|
|
442
|
+
tslib.__metadata("design:type", String)
|
|
443
|
+
], Payment.prototype, "riskLevel", void 0);
|
|
444
|
+
tslib.__decorate([
|
|
696
445
|
classTransformer.Expose({ name: 'receipt_url' }),
|
|
697
|
-
|
|
698
|
-
],
|
|
699
|
-
|
|
446
|
+
tslib.__metadata("design:type", String)
|
|
447
|
+
], Payment.prototype, "receiptUrl", void 0);
|
|
448
|
+
tslib.__decorate([
|
|
700
449
|
classTransformer.Expose({ name: 'private_label' }),
|
|
701
|
-
|
|
702
|
-
],
|
|
703
|
-
|
|
450
|
+
tslib.__metadata("design:type", String)
|
|
451
|
+
], Payment.prototype, "privateLabel", void 0);
|
|
452
|
+
tslib.__decorate([
|
|
704
453
|
classTransformer.Expose({ name: 'pix_qr_code' }),
|
|
705
|
-
|
|
706
|
-
],
|
|
707
|
-
|
|
454
|
+
tslib.__metadata("design:type", String)
|
|
455
|
+
], Payment.prototype, "pixQrCode", void 0);
|
|
456
|
+
tslib.__decorate([
|
|
708
457
|
classTransformer.Expose({ name: 'pix_expiration_date' }),
|
|
709
|
-
|
|
710
|
-
],
|
|
711
|
-
|
|
712
|
-
class Payment extends BaseModel {
|
|
713
|
-
static get identifiersFields() {
|
|
714
|
-
return ['id'];
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
tslib_1.__decorate([
|
|
718
|
-
classTransformer.Type(() => PaymentTransaction),
|
|
719
|
-
tslib_1.__metadata("design:type", PaymentTransaction)
|
|
720
|
-
], Payment.prototype, "transaction", void 0);
|
|
458
|
+
tslib.__metadata("design:type", String)
|
|
459
|
+
], Payment.prototype, "pixExpirationDate", void 0);
|
|
721
460
|
|
|
722
461
|
class SubscriptionPayment extends BaseModel {
|
|
723
462
|
static get identifiersFields() {
|
|
724
463
|
return ['id', 'subscriptionId'];
|
|
725
464
|
}
|
|
726
465
|
}
|
|
727
|
-
|
|
466
|
+
tslib.__decorate([
|
|
728
467
|
classTransformer.Type(() => Payment),
|
|
729
|
-
|
|
468
|
+
tslib.__metadata("design:type", Payment)
|
|
730
469
|
], SubscriptionPayment.prototype, "payment", void 0);
|
|
731
470
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
return typeof x === 'function';
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
738
|
-
var _enable_super_gross_mode_that_will_cause_bad_things = false;
|
|
739
|
-
var config = {
|
|
740
|
-
Promise: undefined,
|
|
741
|
-
set useDeprecatedSynchronousErrorHandling(value) {
|
|
742
|
-
if (value) {
|
|
743
|
-
var error = /*@__PURE__*/ new Error();
|
|
744
|
-
/*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
|
|
745
|
-
}
|
|
746
|
-
_enable_super_gross_mode_that_will_cause_bad_things = value;
|
|
747
|
-
},
|
|
748
|
-
get useDeprecatedSynchronousErrorHandling() {
|
|
749
|
-
return _enable_super_gross_mode_that_will_cause_bad_things;
|
|
750
|
-
},
|
|
751
|
-
};
|
|
752
|
-
|
|
753
|
-
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
754
|
-
function hostReportError(err) {
|
|
755
|
-
setTimeout(function () { throw err; }, 0);
|
|
471
|
+
function isFunction(value) {
|
|
472
|
+
return typeof value === 'function';
|
|
756
473
|
}
|
|
757
474
|
|
|
758
|
-
|
|
759
|
-
var
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
hostReportError(err);
|
|
768
|
-
}
|
|
769
|
-
},
|
|
770
|
-
complete: function () { }
|
|
771
|
-
};
|
|
772
|
-
|
|
773
|
-
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
774
|
-
var isArray = /*@__PURE__*/ (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })();
|
|
775
|
-
|
|
776
|
-
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
777
|
-
function isObject(x) {
|
|
778
|
-
return x !== null && typeof x === 'object';
|
|
475
|
+
function createErrorClass(createImpl) {
|
|
476
|
+
var _super = function (instance) {
|
|
477
|
+
Error.call(instance);
|
|
478
|
+
instance.stack = new Error().stack;
|
|
479
|
+
};
|
|
480
|
+
var ctorFunc = createImpl(_super);
|
|
481
|
+
ctorFunc.prototype = Object.create(Error.prototype);
|
|
482
|
+
ctorFunc.prototype.constructor = ctorFunc;
|
|
483
|
+
return ctorFunc;
|
|
779
484
|
}
|
|
780
485
|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
486
|
+
var UnsubscriptionError = createErrorClass(function (_super) {
|
|
487
|
+
return function UnsubscriptionErrorImpl(errors) {
|
|
488
|
+
_super(this);
|
|
489
|
+
this.message = errors
|
|
490
|
+
? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
|
|
491
|
+
: '';
|
|
787
492
|
this.name = 'UnsubscriptionError';
|
|
788
493
|
this.errors = errors;
|
|
789
|
-
|
|
494
|
+
};
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
function arrRemove(arr, item) {
|
|
498
|
+
if (arr) {
|
|
499
|
+
var index = arr.indexOf(item);
|
|
500
|
+
0 <= index && arr.splice(index, 1);
|
|
790
501
|
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
/** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_UnsubscriptionError PURE_IMPORTS_END */
|
|
797
|
-
var Subscription$1 = /*@__PURE__*/ (function () {
|
|
798
|
-
function Subscription(unsubscribe) {
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
var Subscription$1 = (function () {
|
|
505
|
+
function Subscription(initialTeardown) {
|
|
506
|
+
this.initialTeardown = initialTeardown;
|
|
799
507
|
this.closed = false;
|
|
800
|
-
this.
|
|
801
|
-
this.
|
|
802
|
-
if (unsubscribe) {
|
|
803
|
-
this._ctorUnsubscribe = true;
|
|
804
|
-
this._unsubscribe = unsubscribe;
|
|
805
|
-
}
|
|
508
|
+
this._parentage = null;
|
|
509
|
+
this._finalizers = null;
|
|
806
510
|
}
|
|
807
511
|
Subscription.prototype.unsubscribe = function () {
|
|
512
|
+
var e_1, _a, e_2, _b;
|
|
808
513
|
var errors;
|
|
809
|
-
if (this.closed) {
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
this._subscriptions = null;
|
|
816
|
-
if (_parentOrParents instanceof Subscription) {
|
|
817
|
-
_parentOrParents.remove(this);
|
|
818
|
-
}
|
|
819
|
-
else if (_parentOrParents !== null) {
|
|
820
|
-
for (var index = 0; index < _parentOrParents.length; ++index) {
|
|
821
|
-
var parent_1 = _parentOrParents[index];
|
|
822
|
-
parent_1.remove(this);
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
if (isFunction(_unsubscribe)) {
|
|
826
|
-
if (_ctorUnsubscribe) {
|
|
827
|
-
this._unsubscribe = undefined;
|
|
828
|
-
}
|
|
829
|
-
try {
|
|
830
|
-
_unsubscribe.call(this);
|
|
831
|
-
}
|
|
832
|
-
catch (e) {
|
|
833
|
-
errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
if (isArray(_subscriptions)) {
|
|
837
|
-
var index = -1;
|
|
838
|
-
var len = _subscriptions.length;
|
|
839
|
-
while (++index < len) {
|
|
840
|
-
var sub = _subscriptions[index];
|
|
841
|
-
if (isObject(sub)) {
|
|
514
|
+
if (!this.closed) {
|
|
515
|
+
this.closed = true;
|
|
516
|
+
var _parentage = this._parentage;
|
|
517
|
+
if (_parentage) {
|
|
518
|
+
this._parentage = null;
|
|
519
|
+
if (Array.isArray(_parentage)) {
|
|
842
520
|
try {
|
|
843
|
-
|
|
521
|
+
for (var _parentage_1 = tslib.__values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
|
|
522
|
+
var parent_1 = _parentage_1_1.value;
|
|
523
|
+
parent_1.remove(this);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
527
|
+
finally {
|
|
528
|
+
try {
|
|
529
|
+
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
|
|
530
|
+
}
|
|
531
|
+
finally { if (e_1) throw e_1.error; }
|
|
844
532
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
_parentage.remove(this);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
var initialFinalizer = this.initialTeardown;
|
|
539
|
+
if (isFunction(initialFinalizer)) {
|
|
540
|
+
try {
|
|
541
|
+
initialFinalizer();
|
|
542
|
+
}
|
|
543
|
+
catch (e) {
|
|
544
|
+
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
var _finalizers = this._finalizers;
|
|
548
|
+
if (_finalizers) {
|
|
549
|
+
this._finalizers = null;
|
|
550
|
+
try {
|
|
551
|
+
for (var _finalizers_1 = tslib.__values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
|
|
552
|
+
var finalizer = _finalizers_1_1.value;
|
|
553
|
+
try {
|
|
554
|
+
execFinalizer(finalizer);
|
|
849
555
|
}
|
|
850
|
-
|
|
851
|
-
errors
|
|
556
|
+
catch (err) {
|
|
557
|
+
errors = errors !== null && errors !== void 0 ? errors : [];
|
|
558
|
+
if (err instanceof UnsubscriptionError) {
|
|
559
|
+
errors = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(errors)), tslib.__read(err.errors));
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
errors.push(err);
|
|
563
|
+
}
|
|
852
564
|
}
|
|
853
565
|
}
|
|
854
566
|
}
|
|
567
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
568
|
+
finally {
|
|
569
|
+
try {
|
|
570
|
+
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
|
|
571
|
+
}
|
|
572
|
+
finally { if (e_2) throw e_2.error; }
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (errors) {
|
|
576
|
+
throw new UnsubscriptionError(errors);
|
|
855
577
|
}
|
|
856
|
-
}
|
|
857
|
-
if (errors) {
|
|
858
|
-
throw new UnsubscriptionError(errors);
|
|
859
578
|
}
|
|
860
579
|
};
|
|
861
580
|
Subscription.prototype.add = function (teardown) {
|
|
862
|
-
var
|
|
863
|
-
if (
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
else if (this.closed) {
|
|
874
|
-
subscription.unsubscribe();
|
|
875
|
-
return subscription;
|
|
876
|
-
}
|
|
877
|
-
else if (!(subscription instanceof Subscription)) {
|
|
878
|
-
var tmp = subscription;
|
|
879
|
-
subscription = new Subscription();
|
|
880
|
-
subscription._subscriptions = [tmp];
|
|
581
|
+
var _a;
|
|
582
|
+
if (teardown && teardown !== this) {
|
|
583
|
+
if (this.closed) {
|
|
584
|
+
execFinalizer(teardown);
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
if (teardown instanceof Subscription) {
|
|
588
|
+
if (teardown.closed || teardown._hasParent(this)) {
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
teardown._addParent(this);
|
|
881
592
|
}
|
|
882
|
-
|
|
883
|
-
default: {
|
|
884
|
-
throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
|
|
593
|
+
(this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
|
|
885
594
|
}
|
|
886
595
|
}
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
else {
|
|
901
|
-
return subscription;
|
|
902
|
-
}
|
|
903
|
-
var subscriptions = this._subscriptions;
|
|
904
|
-
if (subscriptions === null) {
|
|
905
|
-
this._subscriptions = [subscription];
|
|
596
|
+
};
|
|
597
|
+
Subscription.prototype._hasParent = function (parent) {
|
|
598
|
+
var _parentage = this._parentage;
|
|
599
|
+
return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
|
|
600
|
+
};
|
|
601
|
+
Subscription.prototype._addParent = function (parent) {
|
|
602
|
+
var _parentage = this._parentage;
|
|
603
|
+
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
604
|
+
};
|
|
605
|
+
Subscription.prototype._removeParent = function (parent) {
|
|
606
|
+
var _parentage = this._parentage;
|
|
607
|
+
if (_parentage === parent) {
|
|
608
|
+
this._parentage = null;
|
|
906
609
|
}
|
|
907
|
-
else {
|
|
908
|
-
|
|
610
|
+
else if (Array.isArray(_parentage)) {
|
|
611
|
+
arrRemove(_parentage, parent);
|
|
909
612
|
}
|
|
910
|
-
return subscription;
|
|
911
613
|
};
|
|
912
|
-
Subscription.prototype.remove = function (
|
|
913
|
-
var
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
subscriptions.splice(subscriptionIndex, 1);
|
|
918
|
-
}
|
|
614
|
+
Subscription.prototype.remove = function (teardown) {
|
|
615
|
+
var _finalizers = this._finalizers;
|
|
616
|
+
_finalizers && arrRemove(_finalizers, teardown);
|
|
617
|
+
if (teardown instanceof Subscription) {
|
|
618
|
+
teardown._removeParent(this);
|
|
919
619
|
}
|
|
920
620
|
};
|
|
921
|
-
Subscription.EMPTY = (function (
|
|
621
|
+
Subscription.EMPTY = (function () {
|
|
622
|
+
var empty = new Subscription();
|
|
922
623
|
empty.closed = true;
|
|
923
624
|
return empty;
|
|
924
|
-
}(
|
|
625
|
+
})();
|
|
925
626
|
return Subscription;
|
|
926
627
|
}());
|
|
927
|
-
|
|
928
|
-
|
|
628
|
+
var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
|
|
629
|
+
function isSubscription(value) {
|
|
630
|
+
return (value instanceof Subscription$1 ||
|
|
631
|
+
(value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
|
|
632
|
+
}
|
|
633
|
+
function execFinalizer(finalizer) {
|
|
634
|
+
if (isFunction(finalizer)) {
|
|
635
|
+
finalizer();
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
finalizer.unsubscribe();
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
var config = {
|
|
643
|
+
onUnhandledError: null,
|
|
644
|
+
onStoppedNotification: null,
|
|
645
|
+
Promise: undefined,
|
|
646
|
+
useDeprecatedSynchronousErrorHandling: false,
|
|
647
|
+
useDeprecatedNextContext: false,
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
var timeoutProvider = {
|
|
651
|
+
setTimeout: function (handler, timeout) {
|
|
652
|
+
var args = [];
|
|
653
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
654
|
+
args[_i - 2] = arguments[_i];
|
|
655
|
+
}
|
|
656
|
+
var delegate = timeoutProvider.delegate;
|
|
657
|
+
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
658
|
+
return delegate.setTimeout.apply(delegate, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
|
|
659
|
+
}
|
|
660
|
+
return setTimeout.apply(void 0, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
|
|
661
|
+
},
|
|
662
|
+
clearTimeout: function (handle) {
|
|
663
|
+
var delegate = timeoutProvider.delegate;
|
|
664
|
+
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
|
|
665
|
+
},
|
|
666
|
+
delegate: undefined,
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
function reportUnhandledError(err) {
|
|
670
|
+
timeoutProvider.setTimeout(function () {
|
|
671
|
+
{
|
|
672
|
+
throw err;
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function noop() { }
|
|
678
|
+
|
|
679
|
+
var context = null;
|
|
680
|
+
function errorContext(cb) {
|
|
681
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
682
|
+
var isRoot = !context;
|
|
683
|
+
if (isRoot) {
|
|
684
|
+
context = { errorThrown: false, error: null };
|
|
685
|
+
}
|
|
686
|
+
cb();
|
|
687
|
+
if (isRoot) {
|
|
688
|
+
var _a = context, errorThrown = _a.errorThrown, error = _a.error;
|
|
689
|
+
context = null;
|
|
690
|
+
if (errorThrown) {
|
|
691
|
+
throw error;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
cb();
|
|
697
|
+
}
|
|
929
698
|
}
|
|
930
699
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
? /*@__PURE__*/ Symbol('rxSubscriber')
|
|
935
|
-
: '@@rxSubscriber_' + /*@__PURE__*/ Math.random();
|
|
936
|
-
})();
|
|
937
|
-
|
|
938
|
-
/** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */
|
|
939
|
-
var Subscriber = /*@__PURE__*/ (function (_super) {
|
|
940
|
-
tslib_1__namespace.__extends(Subscriber, _super);
|
|
941
|
-
function Subscriber(destinationOrNext, error, complete) {
|
|
700
|
+
var Subscriber = (function (_super) {
|
|
701
|
+
tslib.__extends(Subscriber, _super);
|
|
702
|
+
function Subscriber(destination) {
|
|
942
703
|
var _this = _super.call(this) || this;
|
|
943
|
-
_this.syncErrorValue = null;
|
|
944
|
-
_this.syncErrorThrown = false;
|
|
945
|
-
_this.syncErrorThrowable = false;
|
|
946
704
|
_this.isStopped = false;
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
}
|
|
956
|
-
if (typeof destinationOrNext === 'object') {
|
|
957
|
-
if (destinationOrNext instanceof Subscriber) {
|
|
958
|
-
_this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
|
|
959
|
-
_this.destination = destinationOrNext;
|
|
960
|
-
destinationOrNext.add(_this);
|
|
961
|
-
}
|
|
962
|
-
else {
|
|
963
|
-
_this.syncErrorThrowable = true;
|
|
964
|
-
_this.destination = new SafeSubscriber(_this, destinationOrNext);
|
|
965
|
-
}
|
|
966
|
-
break;
|
|
967
|
-
}
|
|
968
|
-
default:
|
|
969
|
-
_this.syncErrorThrowable = true;
|
|
970
|
-
_this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
|
|
971
|
-
break;
|
|
705
|
+
if (destination) {
|
|
706
|
+
_this.destination = destination;
|
|
707
|
+
if (isSubscription(destination)) {
|
|
708
|
+
destination.add(_this);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
_this.destination = EMPTY_OBSERVER;
|
|
972
713
|
}
|
|
973
714
|
return _this;
|
|
974
715
|
}
|
|
975
|
-
Subscriber.prototype[rxSubscriber] = function () { return this; };
|
|
976
716
|
Subscriber.create = function (next, error, complete) {
|
|
977
|
-
|
|
978
|
-
subscriber.syncErrorThrowable = false;
|
|
979
|
-
return subscriber;
|
|
717
|
+
return new SafeSubscriber(next, error, complete);
|
|
980
718
|
};
|
|
981
719
|
Subscriber.prototype.next = function (value) {
|
|
982
|
-
if (
|
|
720
|
+
if (this.isStopped) ;
|
|
721
|
+
else {
|
|
983
722
|
this._next(value);
|
|
984
723
|
}
|
|
985
724
|
};
|
|
986
725
|
Subscriber.prototype.error = function (err) {
|
|
987
|
-
if (
|
|
726
|
+
if (this.isStopped) ;
|
|
727
|
+
else {
|
|
988
728
|
this.isStopped = true;
|
|
989
729
|
this._error(err);
|
|
990
730
|
}
|
|
991
731
|
};
|
|
992
732
|
Subscriber.prototype.complete = function () {
|
|
993
|
-
if (
|
|
733
|
+
if (this.isStopped) ;
|
|
734
|
+
else {
|
|
994
735
|
this.isStopped = true;
|
|
995
736
|
this._complete();
|
|
996
737
|
}
|
|
997
738
|
};
|
|
998
739
|
Subscriber.prototype.unsubscribe = function () {
|
|
999
|
-
if (this.closed) {
|
|
1000
|
-
|
|
740
|
+
if (!this.closed) {
|
|
741
|
+
this.isStopped = true;
|
|
742
|
+
_super.prototype.unsubscribe.call(this);
|
|
743
|
+
this.destination = null;
|
|
1001
744
|
}
|
|
1002
|
-
this.isStopped = true;
|
|
1003
|
-
_super.prototype.unsubscribe.call(this);
|
|
1004
745
|
};
|
|
1005
746
|
Subscriber.prototype._next = function (value) {
|
|
1006
747
|
this.destination.next(value);
|
|
1007
748
|
};
|
|
1008
749
|
Subscriber.prototype._error = function (err) {
|
|
1009
|
-
|
|
1010
|
-
|
|
750
|
+
try {
|
|
751
|
+
this.destination.error(err);
|
|
752
|
+
}
|
|
753
|
+
finally {
|
|
754
|
+
this.unsubscribe();
|
|
755
|
+
}
|
|
1011
756
|
};
|
|
1012
757
|
Subscriber.prototype._complete = function () {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
this.unsubscribe();
|
|
1020
|
-
this.closed = false;
|
|
1021
|
-
this.isStopped = false;
|
|
1022
|
-
this._parentOrParents = _parentOrParents;
|
|
1023
|
-
return this;
|
|
758
|
+
try {
|
|
759
|
+
this.destination.complete();
|
|
760
|
+
}
|
|
761
|
+
finally {
|
|
762
|
+
this.unsubscribe();
|
|
763
|
+
}
|
|
1024
764
|
};
|
|
1025
765
|
return Subscriber;
|
|
1026
766
|
}(Subscription$1));
|
|
1027
|
-
var
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
if (isFunction(observerOrNext)) {
|
|
1035
|
-
next = observerOrNext;
|
|
1036
|
-
}
|
|
1037
|
-
else if (observerOrNext) {
|
|
1038
|
-
next = observerOrNext.next;
|
|
1039
|
-
error = observerOrNext.error;
|
|
1040
|
-
complete = observerOrNext.complete;
|
|
1041
|
-
if (observerOrNext !== empty) {
|
|
1042
|
-
context = Object.create(observerOrNext);
|
|
1043
|
-
if (isFunction(context.unsubscribe)) {
|
|
1044
|
-
_this.add(context.unsubscribe.bind(context));
|
|
1045
|
-
}
|
|
1046
|
-
context.unsubscribe = _this.unsubscribe.bind(_this);
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
_this._context = context;
|
|
1050
|
-
_this._next = next;
|
|
1051
|
-
_this._error = error;
|
|
1052
|
-
_this._complete = complete;
|
|
1053
|
-
return _this;
|
|
767
|
+
var _bind = Function.prototype.bind;
|
|
768
|
+
function bind(fn, thisArg) {
|
|
769
|
+
return _bind.call(fn, thisArg);
|
|
770
|
+
}
|
|
771
|
+
var ConsumerObserver = (function () {
|
|
772
|
+
function ConsumerObserver(partialObserver) {
|
|
773
|
+
this.partialObserver = partialObserver;
|
|
1054
774
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
775
|
+
ConsumerObserver.prototype.next = function (value) {
|
|
776
|
+
var partialObserver = this.partialObserver;
|
|
777
|
+
if (partialObserver.next) {
|
|
778
|
+
try {
|
|
779
|
+
partialObserver.next(value);
|
|
1060
780
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
781
|
+
catch (error) {
|
|
782
|
+
handleUnhandledError(error);
|
|
1063
783
|
}
|
|
1064
784
|
}
|
|
1065
785
|
};
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
1072
|
-
this.__tryOrUnsub(this._error, err);
|
|
1073
|
-
this.unsubscribe();
|
|
1074
|
-
}
|
|
1075
|
-
else {
|
|
1076
|
-
this.__tryOrSetError(_parentSubscriber, this._error, err);
|
|
1077
|
-
this.unsubscribe();
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
else if (!_parentSubscriber.syncErrorThrowable) {
|
|
1081
|
-
this.unsubscribe();
|
|
1082
|
-
if (useDeprecatedSynchronousErrorHandling) {
|
|
1083
|
-
throw err;
|
|
1084
|
-
}
|
|
1085
|
-
hostReportError(err);
|
|
786
|
+
ConsumerObserver.prototype.error = function (err) {
|
|
787
|
+
var partialObserver = this.partialObserver;
|
|
788
|
+
if (partialObserver.error) {
|
|
789
|
+
try {
|
|
790
|
+
partialObserver.error(err);
|
|
1086
791
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
_parentSubscriber.syncErrorValue = err;
|
|
1090
|
-
_parentSubscriber.syncErrorThrown = true;
|
|
1091
|
-
}
|
|
1092
|
-
else {
|
|
1093
|
-
hostReportError(err);
|
|
1094
|
-
}
|
|
1095
|
-
this.unsubscribe();
|
|
792
|
+
catch (error) {
|
|
793
|
+
handleUnhandledError(error);
|
|
1096
794
|
}
|
|
1097
795
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
var _this = this;
|
|
1101
|
-
if (!this.isStopped) {
|
|
1102
|
-
var _parentSubscriber = this._parentSubscriber;
|
|
1103
|
-
if (this._complete) {
|
|
1104
|
-
var wrappedComplete = function () { return _this._complete.call(_this._context); };
|
|
1105
|
-
if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
1106
|
-
this.__tryOrUnsub(wrappedComplete);
|
|
1107
|
-
this.unsubscribe();
|
|
1108
|
-
}
|
|
1109
|
-
else {
|
|
1110
|
-
this.__tryOrSetError(_parentSubscriber, wrappedComplete);
|
|
1111
|
-
this.unsubscribe();
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
else {
|
|
1115
|
-
this.unsubscribe();
|
|
1116
|
-
}
|
|
796
|
+
else {
|
|
797
|
+
handleUnhandledError(err);
|
|
1117
798
|
}
|
|
1118
799
|
};
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
this.unsubscribe();
|
|
1125
|
-
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
1126
|
-
throw err;
|
|
800
|
+
ConsumerObserver.prototype.complete = function () {
|
|
801
|
+
var partialObserver = this.partialObserver;
|
|
802
|
+
if (partialObserver.complete) {
|
|
803
|
+
try {
|
|
804
|
+
partialObserver.complete();
|
|
1127
805
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
806
|
+
catch (error) {
|
|
807
|
+
handleUnhandledError(error);
|
|
1130
808
|
}
|
|
1131
809
|
}
|
|
1132
810
|
};
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
811
|
+
return ConsumerObserver;
|
|
812
|
+
}());
|
|
813
|
+
var SafeSubscriber = (function (_super) {
|
|
814
|
+
tslib.__extends(SafeSubscriber, _super);
|
|
815
|
+
function SafeSubscriber(observerOrNext, error, complete) {
|
|
816
|
+
var _this = _super.call(this) || this;
|
|
817
|
+
var partialObserver;
|
|
818
|
+
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
819
|
+
partialObserver = {
|
|
820
|
+
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
821
|
+
error: error !== null && error !== void 0 ? error : undefined,
|
|
822
|
+
complete: complete !== null && complete !== void 0 ? complete : undefined,
|
|
823
|
+
};
|
|
1139
824
|
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
return
|
|
825
|
+
else {
|
|
826
|
+
var context_1;
|
|
827
|
+
if (_this && config.useDeprecatedNextContext) {
|
|
828
|
+
context_1 = Object.create(observerOrNext);
|
|
829
|
+
context_1.unsubscribe = function () { return _this.unsubscribe(); };
|
|
830
|
+
partialObserver = {
|
|
831
|
+
next: observerOrNext.next && bind(observerOrNext.next, context_1),
|
|
832
|
+
error: observerOrNext.error && bind(observerOrNext.error, context_1),
|
|
833
|
+
complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
|
|
834
|
+
};
|
|
1145
835
|
}
|
|
1146
836
|
else {
|
|
1147
|
-
|
|
1148
|
-
return true;
|
|
837
|
+
partialObserver = observerOrNext;
|
|
1149
838
|
}
|
|
1150
839
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
var _parentSubscriber = this._parentSubscriber;
|
|
1155
|
-
this._context = null;
|
|
1156
|
-
this._parentSubscriber = null;
|
|
1157
|
-
_parentSubscriber.unsubscribe();
|
|
1158
|
-
};
|
|
840
|
+
_this.destination = new ConsumerObserver(partialObserver);
|
|
841
|
+
return _this;
|
|
842
|
+
}
|
|
1159
843
|
return SafeSubscriber;
|
|
1160
844
|
}(Subscriber));
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
while (observer) {
|
|
1165
|
-
var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped;
|
|
1166
|
-
if (closed_1 || isStopped) {
|
|
1167
|
-
return false;
|
|
1168
|
-
}
|
|
1169
|
-
else if (destination && destination instanceof Subscriber) {
|
|
1170
|
-
observer = destination;
|
|
1171
|
-
}
|
|
1172
|
-
else {
|
|
1173
|
-
observer = null;
|
|
1174
|
-
}
|
|
845
|
+
function handleUnhandledError(error) {
|
|
846
|
+
{
|
|
847
|
+
reportUnhandledError(error);
|
|
1175
848
|
}
|
|
1176
|
-
return true;
|
|
1177
849
|
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
function toSubscriber(nextOrObserver, error, complete) {
|
|
1181
|
-
if (nextOrObserver) {
|
|
1182
|
-
if (nextOrObserver instanceof Subscriber) {
|
|
1183
|
-
return nextOrObserver;
|
|
1184
|
-
}
|
|
1185
|
-
if (nextOrObserver[rxSubscriber]) {
|
|
1186
|
-
return nextOrObserver[rxSubscriber]();
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
if (!nextOrObserver && !error && !complete) {
|
|
1190
|
-
return new Subscriber(empty);
|
|
1191
|
-
}
|
|
1192
|
-
return new Subscriber(nextOrObserver, error, complete);
|
|
850
|
+
function defaultErrorHandler(err) {
|
|
851
|
+
throw err;
|
|
1193
852
|
}
|
|
853
|
+
var EMPTY_OBSERVER = {
|
|
854
|
+
closed: true,
|
|
855
|
+
next: noop,
|
|
856
|
+
error: defaultErrorHandler,
|
|
857
|
+
complete: noop,
|
|
858
|
+
};
|
|
1194
859
|
|
|
1195
|
-
|
|
1196
|
-
var observable = /*@__PURE__*/ (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })();
|
|
860
|
+
var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
|
|
1197
861
|
|
|
1198
|
-
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
1199
862
|
function identity(x) {
|
|
1200
863
|
return x;
|
|
1201
864
|
}
|
|
1202
865
|
|
|
1203
|
-
/** PURE_IMPORTS_START _identity PURE_IMPORTS_END */
|
|
1204
866
|
function pipeFromArray(fns) {
|
|
1205
867
|
if (fns.length === 0) {
|
|
1206
868
|
return identity;
|
|
@@ -1213,10 +875,8 @@ function pipeFromArray(fns) {
|
|
|
1213
875
|
};
|
|
1214
876
|
}
|
|
1215
877
|
|
|
1216
|
-
|
|
1217
|
-
var Observable = /*@__PURE__*/ (function () {
|
|
878
|
+
var Observable = (function () {
|
|
1218
879
|
function Observable(subscribe) {
|
|
1219
|
-
this._isScalar = false;
|
|
1220
880
|
if (subscribe) {
|
|
1221
881
|
this._subscribe = subscribe;
|
|
1222
882
|
}
|
|
@@ -1228,64 +888,52 @@ var Observable = /*@__PURE__*/ (function () {
|
|
|
1228
888
|
return observable;
|
|
1229
889
|
};
|
|
1230
890
|
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
|
|
1231
|
-
var
|
|
1232
|
-
var
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
throw sink.syncErrorValue;
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
return sink;
|
|
891
|
+
var _this = this;
|
|
892
|
+
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
|
|
893
|
+
errorContext(function () {
|
|
894
|
+
var _a = _this, operator = _a.operator, source = _a.source;
|
|
895
|
+
subscriber.add(operator
|
|
896
|
+
?
|
|
897
|
+
operator.call(subscriber, source)
|
|
898
|
+
: source
|
|
899
|
+
?
|
|
900
|
+
_this._subscribe(subscriber)
|
|
901
|
+
:
|
|
902
|
+
_this._trySubscribe(subscriber));
|
|
903
|
+
});
|
|
904
|
+
return subscriber;
|
|
1250
905
|
};
|
|
1251
906
|
Observable.prototype._trySubscribe = function (sink) {
|
|
1252
907
|
try {
|
|
1253
908
|
return this._subscribe(sink);
|
|
1254
909
|
}
|
|
1255
910
|
catch (err) {
|
|
1256
|
-
|
|
1257
|
-
sink.syncErrorThrown = true;
|
|
1258
|
-
sink.syncErrorValue = err;
|
|
1259
|
-
}
|
|
1260
|
-
if (canReportError(sink)) {
|
|
1261
|
-
sink.error(err);
|
|
1262
|
-
}
|
|
1263
|
-
else {
|
|
1264
|
-
console.warn(err);
|
|
1265
|
-
}
|
|
911
|
+
sink.error(err);
|
|
1266
912
|
}
|
|
1267
913
|
};
|
|
1268
914
|
Observable.prototype.forEach = function (next, promiseCtor) {
|
|
1269
915
|
var _this = this;
|
|
1270
916
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
1271
917
|
return new promiseCtor(function (resolve, reject) {
|
|
1272
|
-
var
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
}
|
|
1277
|
-
catch (err) {
|
|
1278
|
-
reject(err);
|
|
1279
|
-
if (subscription) {
|
|
1280
|
-
subscription.unsubscribe();
|
|
918
|
+
var subscriber = new SafeSubscriber({
|
|
919
|
+
next: function (value) {
|
|
920
|
+
try {
|
|
921
|
+
next(value);
|
|
1281
922
|
}
|
|
1282
|
-
|
|
1283
|
-
|
|
923
|
+
catch (err) {
|
|
924
|
+
reject(err);
|
|
925
|
+
subscriber.unsubscribe();
|
|
926
|
+
}
|
|
927
|
+
},
|
|
928
|
+
error: reject,
|
|
929
|
+
complete: resolve,
|
|
930
|
+
});
|
|
931
|
+
_this.subscribe(subscriber);
|
|
1284
932
|
});
|
|
1285
933
|
};
|
|
1286
934
|
Observable.prototype._subscribe = function (subscriber) {
|
|
1287
|
-
var
|
|
1288
|
-
return source
|
|
935
|
+
var _a;
|
|
936
|
+
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
|
|
1289
937
|
};
|
|
1290
938
|
Observable.prototype[observable] = function () {
|
|
1291
939
|
return this;
|
|
@@ -1295,9 +943,6 @@ var Observable = /*@__PURE__*/ (function () {
|
|
|
1295
943
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1296
944
|
operations[_i] = arguments[_i];
|
|
1297
945
|
}
|
|
1298
|
-
if (operations.length === 0) {
|
|
1299
|
-
return this;
|
|
1300
|
-
}
|
|
1301
946
|
return pipeFromArray(operations)(this);
|
|
1302
947
|
};
|
|
1303
948
|
Observable.prototype.toPromise = function (promiseCtor) {
|
|
@@ -1305,7 +950,7 @@ var Observable = /*@__PURE__*/ (function () {
|
|
|
1305
950
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
1306
951
|
return new promiseCtor(function (resolve, reject) {
|
|
1307
952
|
var value;
|
|
1308
|
-
_this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
953
|
+
_this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
1309
954
|
});
|
|
1310
955
|
};
|
|
1311
956
|
Observable.create = function (subscribe) {
|
|
@@ -1314,155 +959,139 @@ var Observable = /*@__PURE__*/ (function () {
|
|
|
1314
959
|
return Observable;
|
|
1315
960
|
}());
|
|
1316
961
|
function getPromiseCtor(promiseCtor) {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
962
|
+
var _a;
|
|
963
|
+
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
964
|
+
}
|
|
965
|
+
function isObserver(value) {
|
|
966
|
+
return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
|
|
967
|
+
}
|
|
968
|
+
function isSubscriber(value) {
|
|
969
|
+
return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
|
|
1324
970
|
}
|
|
1325
971
|
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
Error.call(this);
|
|
1330
|
-
this.message = 'object unsubscribed';
|
|
972
|
+
var ObjectUnsubscribedError = createErrorClass(function (_super) {
|
|
973
|
+
return function ObjectUnsubscribedErrorImpl() {
|
|
974
|
+
_super(this);
|
|
1331
975
|
this.name = 'ObjectUnsubscribedError';
|
|
1332
|
-
|
|
1333
|
-
}
|
|
1334
|
-
ObjectUnsubscribedErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);
|
|
1335
|
-
return ObjectUnsubscribedErrorImpl;
|
|
1336
|
-
})();
|
|
1337
|
-
var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl;
|
|
1338
|
-
|
|
1339
|
-
/** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */
|
|
1340
|
-
var SubjectSubscription = /*@__PURE__*/ (function (_super) {
|
|
1341
|
-
tslib_1__namespace.__extends(SubjectSubscription, _super);
|
|
1342
|
-
function SubjectSubscription(subject, subscriber) {
|
|
1343
|
-
var _this = _super.call(this) || this;
|
|
1344
|
-
_this.subject = subject;
|
|
1345
|
-
_this.subscriber = subscriber;
|
|
1346
|
-
_this.closed = false;
|
|
1347
|
-
return _this;
|
|
1348
|
-
}
|
|
1349
|
-
SubjectSubscription.prototype.unsubscribe = function () {
|
|
1350
|
-
if (this.closed) {
|
|
1351
|
-
return;
|
|
1352
|
-
}
|
|
1353
|
-
this.closed = true;
|
|
1354
|
-
var subject = this.subject;
|
|
1355
|
-
var observers = subject.observers;
|
|
1356
|
-
this.subject = null;
|
|
1357
|
-
if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
|
|
1358
|
-
return;
|
|
1359
|
-
}
|
|
1360
|
-
var subscriberIndex = observers.indexOf(this.subscriber);
|
|
1361
|
-
if (subscriberIndex !== -1) {
|
|
1362
|
-
observers.splice(subscriberIndex, 1);
|
|
1363
|
-
}
|
|
976
|
+
this.message = 'object unsubscribed';
|
|
1364
977
|
};
|
|
1365
|
-
|
|
1366
|
-
}(Subscription$1));
|
|
978
|
+
});
|
|
1367
979
|
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
tslib_1__namespace.__extends(SubjectSubscriber, _super);
|
|
1371
|
-
function SubjectSubscriber(destination) {
|
|
1372
|
-
var _this = _super.call(this, destination) || this;
|
|
1373
|
-
_this.destination = destination;
|
|
1374
|
-
return _this;
|
|
1375
|
-
}
|
|
1376
|
-
return SubjectSubscriber;
|
|
1377
|
-
}(Subscriber));
|
|
1378
|
-
var Subject = /*@__PURE__*/ (function (_super) {
|
|
1379
|
-
tslib_1__namespace.__extends(Subject, _super);
|
|
980
|
+
var Subject = (function (_super) {
|
|
981
|
+
tslib.__extends(Subject, _super);
|
|
1380
982
|
function Subject() {
|
|
1381
983
|
var _this = _super.call(this) || this;
|
|
1382
|
-
_this.observers = [];
|
|
1383
984
|
_this.closed = false;
|
|
985
|
+
_this.currentObservers = null;
|
|
986
|
+
_this.observers = [];
|
|
1384
987
|
_this.isStopped = false;
|
|
1385
988
|
_this.hasError = false;
|
|
1386
989
|
_this.thrownError = null;
|
|
1387
990
|
return _this;
|
|
1388
991
|
}
|
|
1389
|
-
Subject.prototype[rxSubscriber] = function () {
|
|
1390
|
-
return new SubjectSubscriber(this);
|
|
1391
|
-
};
|
|
1392
992
|
Subject.prototype.lift = function (operator) {
|
|
1393
993
|
var subject = new AnonymousSubject(this, this);
|
|
1394
994
|
subject.operator = operator;
|
|
1395
995
|
return subject;
|
|
1396
996
|
};
|
|
1397
|
-
Subject.prototype.
|
|
997
|
+
Subject.prototype._throwIfClosed = function () {
|
|
1398
998
|
if (this.closed) {
|
|
1399
999
|
throw new ObjectUnsubscribedError();
|
|
1400
1000
|
}
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1001
|
+
};
|
|
1002
|
+
Subject.prototype.next = function (value) {
|
|
1003
|
+
var _this = this;
|
|
1004
|
+
errorContext(function () {
|
|
1005
|
+
var e_1, _a;
|
|
1006
|
+
_this._throwIfClosed();
|
|
1007
|
+
if (!_this.isStopped) {
|
|
1008
|
+
if (!_this.currentObservers) {
|
|
1009
|
+
_this.currentObservers = Array.from(_this.observers);
|
|
1010
|
+
}
|
|
1011
|
+
try {
|
|
1012
|
+
for (var _b = tslib.__values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1013
|
+
var observer = _c.value;
|
|
1014
|
+
observer.next(value);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1018
|
+
finally {
|
|
1019
|
+
try {
|
|
1020
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1021
|
+
}
|
|
1022
|
+
finally { if (e_1) throw e_1.error; }
|
|
1023
|
+
}
|
|
1407
1024
|
}
|
|
1408
|
-
}
|
|
1025
|
+
});
|
|
1409
1026
|
};
|
|
1410
1027
|
Subject.prototype.error = function (err) {
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
}
|
|
1423
|
-
this.observers.length = 0;
|
|
1028
|
+
var _this = this;
|
|
1029
|
+
errorContext(function () {
|
|
1030
|
+
_this._throwIfClosed();
|
|
1031
|
+
if (!_this.isStopped) {
|
|
1032
|
+
_this.hasError = _this.isStopped = true;
|
|
1033
|
+
_this.thrownError = err;
|
|
1034
|
+
var observers = _this.observers;
|
|
1035
|
+
while (observers.length) {
|
|
1036
|
+
observers.shift().error(err);
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1424
1040
|
};
|
|
1425
1041
|
Subject.prototype.complete = function () {
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1042
|
+
var _this = this;
|
|
1043
|
+
errorContext(function () {
|
|
1044
|
+
_this._throwIfClosed();
|
|
1045
|
+
if (!_this.isStopped) {
|
|
1046
|
+
_this.isStopped = true;
|
|
1047
|
+
var observers = _this.observers;
|
|
1048
|
+
while (observers.length) {
|
|
1049
|
+
observers.shift().complete();
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1437
1053
|
};
|
|
1438
1054
|
Subject.prototype.unsubscribe = function () {
|
|
1439
|
-
this.isStopped = true;
|
|
1440
|
-
this.
|
|
1441
|
-
this.observers = null;
|
|
1055
|
+
this.isStopped = this.closed = true;
|
|
1056
|
+
this.observers = this.currentObservers = null;
|
|
1442
1057
|
};
|
|
1058
|
+
Object.defineProperty(Subject.prototype, "observed", {
|
|
1059
|
+
get: function () {
|
|
1060
|
+
var _a;
|
|
1061
|
+
return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
1062
|
+
},
|
|
1063
|
+
enumerable: false,
|
|
1064
|
+
configurable: true
|
|
1065
|
+
});
|
|
1443
1066
|
Subject.prototype._trySubscribe = function (subscriber) {
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
}
|
|
1447
|
-
else {
|
|
1448
|
-
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
1449
|
-
}
|
|
1067
|
+
this._throwIfClosed();
|
|
1068
|
+
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
1450
1069
|
};
|
|
1451
1070
|
Subject.prototype._subscribe = function (subscriber) {
|
|
1452
|
-
|
|
1453
|
-
|
|
1071
|
+
this._throwIfClosed();
|
|
1072
|
+
this._checkFinalizedStatuses(subscriber);
|
|
1073
|
+
return this._innerSubscribe(subscriber);
|
|
1074
|
+
};
|
|
1075
|
+
Subject.prototype._innerSubscribe = function (subscriber) {
|
|
1076
|
+
var _this = this;
|
|
1077
|
+
var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
|
|
1078
|
+
if (hasError || isStopped) {
|
|
1079
|
+
return EMPTY_SUBSCRIPTION;
|
|
1454
1080
|
}
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1081
|
+
this.currentObservers = null;
|
|
1082
|
+
observers.push(subscriber);
|
|
1083
|
+
return new Subscription$1(function () {
|
|
1084
|
+
_this.currentObservers = null;
|
|
1085
|
+
arrRemove(observers, subscriber);
|
|
1086
|
+
});
|
|
1087
|
+
};
|
|
1088
|
+
Subject.prototype._checkFinalizedStatuses = function (subscriber) {
|
|
1089
|
+
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
|
|
1090
|
+
if (hasError) {
|
|
1091
|
+
subscriber.error(thrownError);
|
|
1458
1092
|
}
|
|
1459
|
-
else if (
|
|
1093
|
+
else if (isStopped) {
|
|
1460
1094
|
subscriber.complete();
|
|
1461
|
-
return Subscription$1.EMPTY;
|
|
1462
|
-
}
|
|
1463
|
-
else {
|
|
1464
|
-
this.observers.push(subscriber);
|
|
1465
|
-
return new SubjectSubscription(this, subscriber);
|
|
1466
1095
|
}
|
|
1467
1096
|
};
|
|
1468
1097
|
Subject.prototype.asObservable = function () {
|
|
@@ -1475,8 +1104,8 @@ var Subject = /*@__PURE__*/ (function (_super) {
|
|
|
1475
1104
|
};
|
|
1476
1105
|
return Subject;
|
|
1477
1106
|
}(Observable));
|
|
1478
|
-
var AnonymousSubject =
|
|
1479
|
-
|
|
1107
|
+
var AnonymousSubject = (function (_super) {
|
|
1108
|
+
tslib.__extends(AnonymousSubject, _super);
|
|
1480
1109
|
function AnonymousSubject(destination, source) {
|
|
1481
1110
|
var _this = _super.call(this) || this;
|
|
1482
1111
|
_this.destination = destination;
|
|
@@ -1484,31 +1113,20 @@ var AnonymousSubject = /*@__PURE__*/ (function (_super) {
|
|
|
1484
1113
|
return _this;
|
|
1485
1114
|
}
|
|
1486
1115
|
AnonymousSubject.prototype.next = function (value) {
|
|
1487
|
-
var
|
|
1488
|
-
|
|
1489
|
-
destination.next(value);
|
|
1490
|
-
}
|
|
1116
|
+
var _a, _b;
|
|
1117
|
+
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
1491
1118
|
};
|
|
1492
1119
|
AnonymousSubject.prototype.error = function (err) {
|
|
1493
|
-
var
|
|
1494
|
-
|
|
1495
|
-
this.destination.error(err);
|
|
1496
|
-
}
|
|
1120
|
+
var _a, _b;
|
|
1121
|
+
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
|
|
1497
1122
|
};
|
|
1498
1123
|
AnonymousSubject.prototype.complete = function () {
|
|
1499
|
-
var
|
|
1500
|
-
|
|
1501
|
-
this.destination.complete();
|
|
1502
|
-
}
|
|
1124
|
+
var _a, _b;
|
|
1125
|
+
(_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
1503
1126
|
};
|
|
1504
1127
|
AnonymousSubject.prototype._subscribe = function (subscriber) {
|
|
1505
|
-
var
|
|
1506
|
-
|
|
1507
|
-
return this.source.subscribe(subscriber);
|
|
1508
|
-
}
|
|
1509
|
-
else {
|
|
1510
|
-
return Subscription$1.EMPTY;
|
|
1511
|
-
}
|
|
1128
|
+
var _a, _b;
|
|
1129
|
+
return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
|
|
1512
1130
|
};
|
|
1513
1131
|
return AnonymousSubject;
|
|
1514
1132
|
}(Subject));
|
|
@@ -2069,9 +1687,9 @@ class User extends BaseModel {
|
|
|
2069
1687
|
return ['id'];
|
|
2070
1688
|
}
|
|
2071
1689
|
}
|
|
2072
|
-
|
|
1690
|
+
tslib.__decorate([
|
|
2073
1691
|
classTransformer.Type(() => BeautyProfile),
|
|
2074
|
-
|
|
1692
|
+
tslib.__metadata("design:type", BeautyProfile)
|
|
2075
1693
|
], User.prototype, "beautyProfile", void 0);
|
|
2076
1694
|
|
|
2077
1695
|
class Address extends BaseModel {
|
|
@@ -2091,181 +1709,225 @@ class Subscription extends BaseModel {
|
|
|
2091
1709
|
return ['id'];
|
|
2092
1710
|
}
|
|
2093
1711
|
}
|
|
2094
|
-
|
|
1712
|
+
tslib.__decorate([
|
|
2095
1713
|
classTransformer.Type(() => User),
|
|
2096
|
-
|
|
1714
|
+
tslib.__metadata("design:type", User)
|
|
2097
1715
|
], Subscription.prototype, "user", void 0);
|
|
2098
|
-
|
|
1716
|
+
tslib.__decorate([
|
|
2099
1717
|
classTransformer.Type(() => SubscriptionPlan),
|
|
2100
|
-
|
|
1718
|
+
tslib.__metadata("design:type", SubscriptionPlan)
|
|
2101
1719
|
], Subscription.prototype, "subscriptionPlan", void 0);
|
|
2102
|
-
|
|
1720
|
+
tslib.__decorate([
|
|
2103
1721
|
classTransformer.Type(() => UserAddress),
|
|
2104
|
-
|
|
1722
|
+
tslib.__metadata("design:type", UserAddress)
|
|
2105
1723
|
], Subscription.prototype, "shippingAddress", void 0);
|
|
2106
|
-
|
|
1724
|
+
tslib.__decorate([
|
|
2107
1725
|
classTransformer.Type(() => UserAddress),
|
|
2108
|
-
|
|
1726
|
+
tslib.__metadata("design:type", UserAddress)
|
|
2109
1727
|
], Subscription.prototype, "billingAddress", void 0);
|
|
2110
|
-
|
|
1728
|
+
tslib.__decorate([
|
|
2111
1729
|
classTransformer.Type(() => Coupon),
|
|
2112
|
-
|
|
1730
|
+
tslib.__metadata("design:type", Coupon)
|
|
2113
1731
|
], Subscription.prototype, "coupon", void 0);
|
|
2114
|
-
|
|
1732
|
+
tslib.__decorate([
|
|
2115
1733
|
classTransformer.Type(() => Edition),
|
|
2116
|
-
|
|
1734
|
+
tslib.__metadata("design:type", Array)
|
|
2117
1735
|
], Subscription.prototype, "editions", void 0);
|
|
2118
|
-
|
|
1736
|
+
tslib.__decorate([
|
|
2119
1737
|
classTransformer.Type(() => SubscriptionPayment),
|
|
2120
|
-
|
|
1738
|
+
tslib.__metadata("design:type", Array)
|
|
2121
1739
|
], Subscription.prototype, "payment", void 0);
|
|
2122
1740
|
|
|
2123
|
-
class
|
|
2124
|
-
static get identifiersFields() {
|
|
2125
|
-
return ['id'];
|
|
2126
|
-
}
|
|
2127
|
-
}
|
|
2128
|
-
tslib_1.__decorate([
|
|
2129
|
-
classTransformer.Type(() => User),
|
|
2130
|
-
tslib_1.__metadata("design:type", User)
|
|
2131
|
-
], SubscriptionMaterialization.prototype, "user", void 0);
|
|
2132
|
-
tslib_1.__decorate([
|
|
2133
|
-
classTransformer.Type(() => SubscriptionPlan),
|
|
2134
|
-
tslib_1.__metadata("design:type", SubscriptionPlan)
|
|
2135
|
-
], SubscriptionMaterialization.prototype, "subscriptionPlan", void 0);
|
|
2136
|
-
tslib_1.__decorate([
|
|
2137
|
-
classTransformer.Type(() => UserAddress),
|
|
2138
|
-
tslib_1.__metadata("design:type", UserAddress)
|
|
2139
|
-
], SubscriptionMaterialization.prototype, "shippingAddress", void 0);
|
|
2140
|
-
tslib_1.__decorate([
|
|
2141
|
-
classTransformer.Type(() => UserAddress),
|
|
2142
|
-
tslib_1.__metadata("design:type", UserAddress)
|
|
2143
|
-
], SubscriptionMaterialization.prototype, "billingAddress", void 0);
|
|
2144
|
-
tslib_1.__decorate([
|
|
2145
|
-
classTransformer.Type(() => Coupon),
|
|
2146
|
-
tslib_1.__metadata("design:type", Coupon)
|
|
2147
|
-
], SubscriptionMaterialization.prototype, "coupon", void 0);
|
|
2148
|
-
tslib_1.__decorate([
|
|
2149
|
-
classTransformer.Type(() => Edition),
|
|
2150
|
-
tslib_1.__metadata("design:type", Array)
|
|
2151
|
-
], SubscriptionMaterialization.prototype, "editions", void 0);
|
|
2152
|
-
tslib_1.__decorate([
|
|
2153
|
-
classTransformer.Type(() => SubscriptionPayment),
|
|
2154
|
-
tslib_1.__metadata("design:type", SubscriptionPayment)
|
|
2155
|
-
], SubscriptionMaterialization.prototype, "payment", void 0);
|
|
2156
|
-
|
|
2157
|
-
class SubscriptionSummary extends BaseModel {
|
|
1741
|
+
class Filter extends BaseModel {
|
|
2158
1742
|
static get identifiersFields() {
|
|
2159
1743
|
return ['id'];
|
|
2160
1744
|
}
|
|
2161
1745
|
}
|
|
2162
1746
|
|
|
2163
|
-
class
|
|
1747
|
+
class CategoryBase extends BaseModel {
|
|
2164
1748
|
static get identifiersFields() {
|
|
2165
|
-
return ['id'
|
|
1749
|
+
return ['id'];
|
|
2166
1750
|
}
|
|
2167
|
-
}
|
|
1751
|
+
}
|
|
1752
|
+
tslib.__decorate([
|
|
1753
|
+
classTransformer.Type(() => CategoryBase),
|
|
1754
|
+
tslib.__metadata("design:type", CategoryBase)
|
|
1755
|
+
], CategoryBase.prototype, "parent", void 0);
|
|
1756
|
+
tslib.__decorate([
|
|
1757
|
+
classTransformer.Type(() => Filter),
|
|
1758
|
+
tslib.__metadata("design:type", Array)
|
|
1759
|
+
], CategoryBase.prototype, "filters", void 0);
|
|
2168
1760
|
|
|
2169
|
-
class
|
|
1761
|
+
class CategoryForProduct extends CategoryBase {
|
|
2170
1762
|
static get identifiersFields() {
|
|
2171
1763
|
return ['id'];
|
|
2172
1764
|
}
|
|
2173
1765
|
}
|
|
2174
1766
|
|
|
2175
|
-
class
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
(function (SignInMethods) {
|
|
2183
|
-
SignInMethods["EMAIL_PASSWORD"] = "email_password";
|
|
2184
|
-
SignInMethods["GOOGLE"] = "google";
|
|
2185
|
-
})(exports.SignInMethods || (exports.SignInMethods = {}));
|
|
2186
|
-
class Authentication {
|
|
2187
|
-
constructor(authService, userRepository) {
|
|
2188
|
-
this.authService = authService;
|
|
2189
|
-
this.userRepository = userRepository;
|
|
2190
|
-
}
|
|
2191
|
-
async signIn({ email, password }, signInMethod) {
|
|
2192
|
-
const method = this.getServiceByMethod(signInMethod);
|
|
2193
|
-
const userAuth = await this.authService[method]({ email, password });
|
|
2194
|
-
const user = this.userRepository.get({ id: userAuth.id });
|
|
2195
|
-
if (!lodash.isNil(user))
|
|
2196
|
-
return user;
|
|
2197
|
-
if (/^.+@b4a.com.br$/.test(userAuth.email))
|
|
2198
|
-
return this.createsUserByCredential(userAuth);
|
|
2199
|
-
throw new UnauthorizedError('Invalid credentials');
|
|
1767
|
+
class ProductBase extends BaseModel {
|
|
1768
|
+
get evaluation() {
|
|
1769
|
+
return {
|
|
1770
|
+
reviews: this.reviews,
|
|
1771
|
+
count: this.reviewsTotal,
|
|
1772
|
+
rating: this.rate,
|
|
1773
|
+
};
|
|
2200
1774
|
}
|
|
2201
|
-
|
|
2202
|
-
|
|
1775
|
+
set evaluation(evaluation) {
|
|
1776
|
+
if (!evaluation) {
|
|
1777
|
+
this.reviews = null;
|
|
1778
|
+
this.reviewsTotal = null;
|
|
1779
|
+
this.rate = null;
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
this.reviews = evaluation.reviews || this.reviews;
|
|
1783
|
+
this.reviewsTotal = evaluation.count || this.reviewsTotal;
|
|
1784
|
+
this.rate = evaluation.rating || this.rate;
|
|
2203
1785
|
}
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
|
|
2207
|
-
const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
|
|
2208
|
-
lastName, acceptsNewsletter: false, area: exports.Area.Transactional, officePosition: exports.OfficePosition.Intern, type: exports.UserType.Collaborator }));
|
|
2209
|
-
return this.userRepository.create(person);
|
|
1786
|
+
static get identifiersFields() {
|
|
1787
|
+
return ['id'];
|
|
2210
1788
|
}
|
|
2211
1789
|
}
|
|
2212
1790
|
|
|
2213
|
-
class
|
|
2214
|
-
|
|
2215
|
-
|
|
1791
|
+
class ProductForKit extends ProductBase {
|
|
1792
|
+
static get identifiersFields() {
|
|
1793
|
+
return ['id'];
|
|
2216
1794
|
}
|
|
2217
|
-
}
|
|
1795
|
+
}
|
|
1796
|
+
tslib.__decorate([
|
|
1797
|
+
classTransformer.Type(() => CategoryForProduct),
|
|
1798
|
+
tslib.__metadata("design:type", CategoryForProduct)
|
|
1799
|
+
], ProductForKit.prototype, "category", void 0);
|
|
2218
1800
|
|
|
2219
|
-
class
|
|
2220
|
-
|
|
2221
|
-
|
|
1801
|
+
class KitProduct extends BaseModel {
|
|
1802
|
+
static get identifiersFields() {
|
|
1803
|
+
return ['productId', 'kitProductId'];
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
tslib.__decorate([
|
|
1807
|
+
classTransformer.Type(() => ProductForKit),
|
|
1808
|
+
tslib.__metadata("design:type", ProductForKit)
|
|
1809
|
+
], KitProduct.prototype, "kit", void 0);
|
|
1810
|
+
tslib.__decorate([
|
|
1811
|
+
classTransformer.Type(() => ProductForKit),
|
|
1812
|
+
tslib.__metadata("design:type", ProductForKit)
|
|
1813
|
+
], KitProduct.prototype, "product", void 0);
|
|
1814
|
+
|
|
1815
|
+
class ProductForCategory extends ProductBase {
|
|
1816
|
+
static get identifiersFields() {
|
|
1817
|
+
return ['id'];
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
tslib.__decorate([
|
|
1821
|
+
classTransformer.Type(() => KitProduct),
|
|
1822
|
+
tslib.__metadata("design:type", Array)
|
|
1823
|
+
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
1824
|
+
|
|
1825
|
+
class Category extends CategoryBase {
|
|
1826
|
+
static get identifiersFields() {
|
|
1827
|
+
return ['id'];
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
tslib.__decorate([
|
|
1831
|
+
classTransformer.Type(() => ProductForCategory),
|
|
1832
|
+
tslib.__metadata("design:type", Array)
|
|
1833
|
+
], Category.prototype, "childrenProducts", void 0);
|
|
1834
|
+
|
|
1835
|
+
class CategoryCollectionChildren extends BaseModel {
|
|
1836
|
+
static get identifiersFields() {
|
|
1837
|
+
return ['collectionId', 'categoryId'];
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
tslib.__decorate([
|
|
1841
|
+
classTransformer.Type(() => CategoryCollectionChildren),
|
|
1842
|
+
tslib.__metadata("design:type", CategoryCollectionChildren)
|
|
1843
|
+
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
1844
|
+
|
|
1845
|
+
class CategoryFilter extends BaseModel {
|
|
1846
|
+
static get identifiersFields() {
|
|
1847
|
+
return ['id'];
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
tslib.__decorate([
|
|
1851
|
+
classTransformer.Type(() => Filter),
|
|
1852
|
+
tslib.__metadata("design:type", Filter)
|
|
1853
|
+
], CategoryFilter.prototype, "filter", void 0);
|
|
1854
|
+
tslib.__decorate([
|
|
1855
|
+
classTransformer.Type(() => Category),
|
|
1856
|
+
tslib.__metadata("design:type", Category)
|
|
1857
|
+
], CategoryFilter.prototype, "category", void 0);
|
|
1858
|
+
|
|
1859
|
+
exports.GenderDestination = void 0;
|
|
1860
|
+
(function (GenderDestination) {
|
|
1861
|
+
GenderDestination["FEMALE"] = "female";
|
|
1862
|
+
GenderDestination["MALE"] = "male";
|
|
1863
|
+
GenderDestination["UNISEX"] = "unisex";
|
|
1864
|
+
})(exports.GenderDestination || (exports.GenderDestination = {}));
|
|
1865
|
+
|
|
1866
|
+
exports.Shops = void 0;
|
|
1867
|
+
(function (Shops) {
|
|
1868
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
1869
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
1870
|
+
Shops["GLAMPOINTS"] = "Glampoints";
|
|
1871
|
+
Shops["ALL"] = "ALL";
|
|
1872
|
+
})(exports.Shops || (exports.Shops = {}));
|
|
1873
|
+
|
|
1874
|
+
class FilterOption extends BaseModel {
|
|
1875
|
+
static get identifiersFields() {
|
|
1876
|
+
return ['id'];
|
|
2222
1877
|
}
|
|
2223
1878
|
}
|
|
2224
1879
|
|
|
2225
|
-
class
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
this.userRepository = userRepository;
|
|
1880
|
+
class Product extends ProductBase {
|
|
1881
|
+
static get identifiersFields() {
|
|
1882
|
+
return ['id'];
|
|
2229
1883
|
}
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
displayName,
|
|
2244
|
-
phone: params.phone,
|
|
2245
|
-
password: params.password,
|
|
2246
|
-
});
|
|
2247
|
-
delete params.password;
|
|
2248
|
-
const user = await this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email,
|
|
2249
|
-
displayName, type: exports.UserType.B2C, dateCreated: new Date(), dateModified: new Date() }));
|
|
2250
|
-
return user;
|
|
1884
|
+
}
|
|
1885
|
+
tslib.__decorate([
|
|
1886
|
+
classTransformer.Type(() => CategoryForProduct),
|
|
1887
|
+
tslib.__metadata("design:type", CategoryForProduct)
|
|
1888
|
+
], Product.prototype, "category", void 0);
|
|
1889
|
+
tslib.__decorate([
|
|
1890
|
+
classTransformer.Type(() => KitProduct),
|
|
1891
|
+
tslib.__metadata("design:type", Array)
|
|
1892
|
+
], Product.prototype, "kitProducts", void 0);
|
|
1893
|
+
|
|
1894
|
+
class ProductReviews extends BaseModel {
|
|
1895
|
+
static get identifiersFields() {
|
|
1896
|
+
return ['id'];
|
|
2251
1897
|
}
|
|
2252
1898
|
}
|
|
2253
1899
|
|
|
2254
|
-
class
|
|
2255
|
-
|
|
2256
|
-
|
|
1900
|
+
class Variant extends BaseModel {
|
|
1901
|
+
static get identifiersFields() {
|
|
1902
|
+
return ['id', 'productId'];
|
|
2257
1903
|
}
|
|
2258
|
-
|
|
2259
|
-
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
class Wishlist extends Category {
|
|
1907
|
+
static get identifiersFields() {
|
|
1908
|
+
return ['id'];
|
|
2260
1909
|
}
|
|
2261
1910
|
}
|
|
2262
1911
|
|
|
2263
|
-
class
|
|
2264
|
-
|
|
2265
|
-
|
|
1912
|
+
class Buy2Win extends BaseModel {
|
|
1913
|
+
static get identifiersFields() {
|
|
1914
|
+
return ['id'];
|
|
2266
1915
|
}
|
|
2267
|
-
|
|
2268
|
-
|
|
1916
|
+
}
|
|
1917
|
+
tslib.__decorate([
|
|
1918
|
+
classTransformer.Type(() => Category),
|
|
1919
|
+
tslib.__metadata("design:type", Array)
|
|
1920
|
+
], Buy2Win.prototype, "categories", void 0);
|
|
1921
|
+
|
|
1922
|
+
class CampaignDashboard extends BaseModel {
|
|
1923
|
+
static get identifiersFields() {
|
|
1924
|
+
return ['id'];
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
class CampaignHashtag extends BaseModel {
|
|
1929
|
+
static get identifiersFields() {
|
|
1930
|
+
return ['id'];
|
|
2269
1931
|
}
|
|
2270
1932
|
}
|
|
2271
1933
|
|
|
@@ -2283,29 +1945,29 @@ class Checkout extends BaseModel {
|
|
|
2283
1945
|
return ['id'];
|
|
2284
1946
|
}
|
|
2285
1947
|
}
|
|
2286
|
-
|
|
1948
|
+
tslib.__decorate([
|
|
2287
1949
|
classTransformer.Type(() => LineItem),
|
|
2288
|
-
|
|
1950
|
+
tslib.__metadata("design:type", Array)
|
|
2289
1951
|
], Checkout.prototype, "lineItems", void 0);
|
|
2290
|
-
|
|
1952
|
+
tslib.__decorate([
|
|
2291
1953
|
classTransformer.Type(() => User),
|
|
2292
|
-
|
|
1954
|
+
tslib.__metadata("design:type", User)
|
|
2293
1955
|
], Checkout.prototype, "user", void 0);
|
|
2294
|
-
|
|
1956
|
+
tslib.__decorate([
|
|
2295
1957
|
classTransformer.Type(() => UserAddress),
|
|
2296
|
-
|
|
1958
|
+
tslib.__metadata("design:type", UserAddress)
|
|
2297
1959
|
], Checkout.prototype, "shippingAddress", void 0);
|
|
2298
|
-
|
|
1960
|
+
tslib.__decorate([
|
|
2299
1961
|
classTransformer.Type(() => UserAddress),
|
|
2300
|
-
|
|
1962
|
+
tslib.__metadata("design:type", UserAddress)
|
|
2301
1963
|
], Checkout.prototype, "billingAddress", void 0);
|
|
2302
|
-
|
|
1964
|
+
tslib.__decorate([
|
|
2303
1965
|
classTransformer.Type(() => ShippingMethod),
|
|
2304
|
-
|
|
1966
|
+
tslib.__metadata("design:type", ShippingMethod)
|
|
2305
1967
|
], Checkout.prototype, "shipping", void 0);
|
|
2306
|
-
|
|
1968
|
+
tslib.__decorate([
|
|
2307
1969
|
classTransformer.Type(() => Coupon),
|
|
2308
|
-
|
|
1970
|
+
tslib.__metadata("design:type", Coupon)
|
|
2309
1971
|
], Checkout.prototype, "coupon", void 0);
|
|
2310
1972
|
|
|
2311
1973
|
exports.OrderStatus = void 0;
|
|
@@ -2322,516 +1984,179 @@ exports.OrderStatus = void 0;
|
|
|
2322
1984
|
|
|
2323
1985
|
class Order extends Checkout {
|
|
2324
1986
|
}
|
|
2325
|
-
|
|
2326
|
-
classTransformer.Type(() =>
|
|
2327
|
-
|
|
1987
|
+
tslib.__decorate([
|
|
1988
|
+
classTransformer.Type(() => Payment),
|
|
1989
|
+
tslib.__metadata("design:type", Payment)
|
|
2328
1990
|
], Order.prototype, "payment", void 0);
|
|
2329
1991
|
|
|
2330
|
-
class OrderBlocked extends BaseModel {
|
|
2331
|
-
static get identifiersFields() {
|
|
2332
|
-
return ['id'];
|
|
2333
|
-
}
|
|
2334
|
-
}
|
|
2335
|
-
|
|
2336
1992
|
class CheckoutSubscription extends BaseModel {
|
|
2337
1993
|
static get identifiersFields() {
|
|
2338
1994
|
return ['id'];
|
|
2339
1995
|
}
|
|
2340
1996
|
}
|
|
2341
|
-
|
|
1997
|
+
tslib.__decorate([
|
|
2342
1998
|
classTransformer.Type(() => UserAddress),
|
|
2343
|
-
|
|
1999
|
+
tslib.__metadata("design:type", UserAddress)
|
|
2344
2000
|
], CheckoutSubscription.prototype, "shippingAddress", void 0);
|
|
2345
|
-
|
|
2001
|
+
tslib.__decorate([
|
|
2346
2002
|
classTransformer.Type(() => UserAddress),
|
|
2347
|
-
|
|
2003
|
+
tslib.__metadata("design:type", UserAddress)
|
|
2348
2004
|
], CheckoutSubscription.prototype, "billingAddress", void 0);
|
|
2349
|
-
|
|
2005
|
+
tslib.__decorate([
|
|
2350
2006
|
classTransformer.Type(() => SubscriptionPlan),
|
|
2351
|
-
|
|
2007
|
+
tslib.__metadata("design:type", SubscriptionPlan)
|
|
2352
2008
|
], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
|
|
2353
|
-
|
|
2009
|
+
tslib.__decorate([
|
|
2354
2010
|
classTransformer.Type(() => Coupon),
|
|
2355
|
-
|
|
2011
|
+
tslib.__metadata("design:type", Coupon)
|
|
2356
2012
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
2357
2013
|
|
|
2358
|
-
class
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
}
|
|
2362
|
-
async pay(checkout, card) {
|
|
2363
|
-
try {
|
|
2364
|
-
const result = await axios__default["default"]({
|
|
2365
|
-
method: 'POST',
|
|
2366
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2367
|
-
headers: {
|
|
2368
|
-
'x-api-key': this.credentials.API_KEY,
|
|
2369
|
-
'content-type': 'application/json',
|
|
2370
|
-
},
|
|
2371
|
-
data: this.createCardPayment(checkout, card),
|
|
2372
|
-
});
|
|
2373
|
-
if (result.data.resultCode !== 'Authorised') {
|
|
2374
|
-
this.checkoutAntiFraudService.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2375
|
-
return Promise.reject(new Error(`Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito`));
|
|
2376
|
-
}
|
|
2377
|
-
const payment = {
|
|
2378
|
-
createdAt: new Date(),
|
|
2379
|
-
updatedAt: new Date(),
|
|
2380
|
-
userId: checkout.user.id,
|
|
2381
|
-
checkoutId: checkout.id,
|
|
2382
|
-
totalPrice: checkout.totalPrice,
|
|
2383
|
-
transaction: Object.assign(Object.assign({}, result.data), { status: 'paid' }),
|
|
2384
|
-
};
|
|
2385
|
-
return payment;
|
|
2386
|
-
}
|
|
2387
|
-
catch (error) { }
|
|
2388
|
-
}
|
|
2389
|
-
createCardPayment(checkout, card) {
|
|
2390
|
-
return {
|
|
2391
|
-
amount: {
|
|
2392
|
-
currency: 'BRL',
|
|
2393
|
-
value: ((checkout === null || checkout === void 0 ? void 0 : checkout.totalPrice) || 0) * 100,
|
|
2394
|
-
},
|
|
2395
|
-
paymentMethod: {
|
|
2396
|
-
type: 'scheme',
|
|
2397
|
-
storedPaymentMethodId: card.cardId,
|
|
2398
|
-
},
|
|
2399
|
-
reference: checkout.id,
|
|
2400
|
-
shopperInteraction: 'Ecommerce',
|
|
2401
|
-
merchantAccount: this.credentials.MERCHANT_ACCOUNT,
|
|
2402
|
-
shopperReference: checkout.user.id,
|
|
2403
|
-
recurringProcessingModel: 'CardOnFile',
|
|
2404
|
-
returnUrl: this.credentials.URL_POSTBACK,
|
|
2405
|
-
installments: {
|
|
2406
|
-
value: card.installments,
|
|
2407
|
-
},
|
|
2408
|
-
};
|
|
2014
|
+
class SubscriptionMaterialization extends BaseModel {
|
|
2015
|
+
static get identifiersFields() {
|
|
2016
|
+
return ['id'];
|
|
2409
2017
|
}
|
|
2410
|
-
|
|
2411
|
-
|
|
2018
|
+
}
|
|
2019
|
+
tslib.__decorate([
|
|
2020
|
+
classTransformer.Type(() => User),
|
|
2021
|
+
tslib.__metadata("design:type", User)
|
|
2022
|
+
], SubscriptionMaterialization.prototype, "user", void 0);
|
|
2023
|
+
tslib.__decorate([
|
|
2024
|
+
classTransformer.Type(() => SubscriptionPlan),
|
|
2025
|
+
tslib.__metadata("design:type", SubscriptionPlan)
|
|
2026
|
+
], SubscriptionMaterialization.prototype, "subscriptionPlan", void 0);
|
|
2027
|
+
tslib.__decorate([
|
|
2028
|
+
classTransformer.Type(() => UserAddress),
|
|
2029
|
+
tslib.__metadata("design:type", UserAddress)
|
|
2030
|
+
], SubscriptionMaterialization.prototype, "shippingAddress", void 0);
|
|
2031
|
+
tslib.__decorate([
|
|
2032
|
+
classTransformer.Type(() => UserAddress),
|
|
2033
|
+
tslib.__metadata("design:type", UserAddress)
|
|
2034
|
+
], SubscriptionMaterialization.prototype, "billingAddress", void 0);
|
|
2035
|
+
tslib.__decorate([
|
|
2036
|
+
classTransformer.Type(() => Coupon),
|
|
2037
|
+
tslib.__metadata("design:type", Coupon)
|
|
2038
|
+
], SubscriptionMaterialization.prototype, "coupon", void 0);
|
|
2039
|
+
tslib.__decorate([
|
|
2040
|
+
classTransformer.Type(() => Edition),
|
|
2041
|
+
tslib.__metadata("design:type", Array)
|
|
2042
|
+
], SubscriptionMaterialization.prototype, "editions", void 0);
|
|
2043
|
+
tslib.__decorate([
|
|
2044
|
+
classTransformer.Type(() => SubscriptionPayment),
|
|
2045
|
+
tslib.__metadata("design:type", SubscriptionPayment)
|
|
2046
|
+
], SubscriptionMaterialization.prototype, "payment", void 0);
|
|
2047
|
+
|
|
2048
|
+
class SubscriptionSummary extends BaseModel {
|
|
2049
|
+
static get identifiersFields() {
|
|
2050
|
+
return ['id'];
|
|
2412
2051
|
}
|
|
2413
2052
|
}
|
|
2414
2053
|
|
|
2415
|
-
class
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2419
|
-
this.LIMIT_ORDERS_DAY = 2;
|
|
2420
|
-
this.LIMIT_ORDERS_WEEK = 7;
|
|
2421
|
-
this.LIMIT_BLOCKED_ORDERS_DAY = 5;
|
|
2054
|
+
class UserPaymentMethod extends BaseModel {
|
|
2055
|
+
static get identifiersFields() {
|
|
2056
|
+
return ['id', 'userId'];
|
|
2422
2057
|
}
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
if (boleto && !this.verifyBoletoOrder(checkout))
|
|
2429
|
-
return false;
|
|
2430
|
-
if (card && !(await this.verifyBlockedOrderAttempts(checkout, card)))
|
|
2431
|
-
return false;
|
|
2432
|
-
if (card && !(await this.verifyDayAndWeekOrders(checkout, card)))
|
|
2433
|
-
return false;
|
|
2434
|
-
return true;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
class Lead extends BaseModel {
|
|
2061
|
+
static get identifiersFields() {
|
|
2062
|
+
return ['id'];
|
|
2435
2063
|
}
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
user: checkout.user.id,
|
|
2442
|
-
coupon: (_b = checkout.coupon) === null || _b === void 0 ? void 0 : _b.nickname,
|
|
2443
|
-
})}`);
|
|
2444
|
-
return false;
|
|
2445
|
-
}
|
|
2446
|
-
return true;
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
class UnauthorizedError extends tsCustomError.CustomError {
|
|
2067
|
+
constructor(message) {
|
|
2068
|
+
super(message);
|
|
2447
2069
|
}
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
if (ordersPerDay[key] > this.LIMIT_ORDERS_WEEK) {
|
|
2460
|
-
await this.createBlockedOrderOrPayment(checkout, 'Order limit', key, 'week');
|
|
2461
|
-
return false;
|
|
2462
|
-
}
|
|
2463
|
-
}
|
|
2464
|
-
return true;
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
exports.SignInMethods = void 0;
|
|
2073
|
+
(function (SignInMethods) {
|
|
2074
|
+
SignInMethods["EMAIL_PASSWORD"] = "email_password";
|
|
2075
|
+
SignInMethods["GOOGLE"] = "google";
|
|
2076
|
+
})(exports.SignInMethods || (exports.SignInMethods = {}));
|
|
2077
|
+
class Authentication {
|
|
2078
|
+
constructor(authService, userRepository) {
|
|
2079
|
+
this.authService = authService;
|
|
2080
|
+
this.userRepository = userRepository;
|
|
2465
2081
|
}
|
|
2466
|
-
async
|
|
2467
|
-
const
|
|
2468
|
-
const
|
|
2469
|
-
const
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
zip: ordersByZip,
|
|
2476
|
-
};
|
|
2082
|
+
async signIn({ email, password }, signInMethod) {
|
|
2083
|
+
const method = this.getServiceByMethod(signInMethod);
|
|
2084
|
+
const userAuth = await this.authService[method]({ email, password });
|
|
2085
|
+
const user = this.userRepository.get({ id: userAuth.id });
|
|
2086
|
+
if (!lodash.isNil(user))
|
|
2087
|
+
return user;
|
|
2088
|
+
if (/^.+@b4a.com.br$/.test(userAuth.email))
|
|
2089
|
+
return this.createsUserByCredential(userAuth);
|
|
2090
|
+
throw new UnauthorizedError('Invalid credentials');
|
|
2477
2091
|
}
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
[property]: {
|
|
2481
|
-
[field]: value,
|
|
2482
|
-
},
|
|
2483
|
-
['createdAt']: [
|
|
2484
|
-
{ operator: exports.Where.GTE, value: range.firstDate },
|
|
2485
|
-
{ operator: exports.Where.LTE, value: range.lastDate },
|
|
2486
|
-
],
|
|
2487
|
-
};
|
|
2488
|
-
const docs = await (await this.orderRepository.find({ filters })).count;
|
|
2489
|
-
return docs;
|
|
2092
|
+
getServiceByMethod(signInMethod) {
|
|
2093
|
+
return signInMethod === exports.SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
|
|
2490
2094
|
}
|
|
2491
|
-
async
|
|
2095
|
+
async createsUserByCredential(user) {
|
|
2492
2096
|
var _a;
|
|
2493
|
-
const
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
}
|
|
2498
|
-
return true;
|
|
2499
|
-
}
|
|
2500
|
-
async verifyBlockedOrderAttempts(checkout, card) {
|
|
2501
|
-
var _a, _b, _c, _d;
|
|
2502
|
-
const day = `${dateFns.format(new Date(), 'YYYY-MM-DD')}T00:00:00`;
|
|
2503
|
-
const endOfDay = `${dateFns.format(new Date(), 'YYYY-MM-DD')}T23:59:59`;
|
|
2504
|
-
const ordersBlockedWithCpf = await this.orderBlockedRepository
|
|
2505
|
-
.find({
|
|
2506
|
-
filters: {
|
|
2507
|
-
customer: { cpf: { operator: exports.Where.EQUALS, value: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf } },
|
|
2508
|
-
date: [
|
|
2509
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2510
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2511
|
-
],
|
|
2512
|
-
},
|
|
2513
|
-
})
|
|
2514
|
-
.then((data) => data.data);
|
|
2515
|
-
const ordersBlockedWithEmail = await this.orderBlockedRepository
|
|
2516
|
-
.find({
|
|
2517
|
-
filters: {
|
|
2518
|
-
customer: { email: { operator: exports.Where.EQUALS, value: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email } },
|
|
2519
|
-
date: [
|
|
2520
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2521
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2522
|
-
],
|
|
2523
|
-
},
|
|
2524
|
-
})
|
|
2525
|
-
.then((data) => data.data);
|
|
2526
|
-
const ordersBlockedWithCep = await this.orderBlockedRepository
|
|
2527
|
-
.find({
|
|
2528
|
-
filters: {
|
|
2529
|
-
customer: { shippingAddress: { zip: { operator: exports.Where.EQUALS, value: (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.zip } } },
|
|
2530
|
-
date: [
|
|
2531
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2532
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2533
|
-
],
|
|
2534
|
-
},
|
|
2535
|
-
})
|
|
2536
|
-
.then((data) => data.data);
|
|
2537
|
-
const ordersBlockedWithPhone = await this.orderBlockedRepository
|
|
2538
|
-
.find({
|
|
2539
|
-
filters: {
|
|
2540
|
-
customer: { phoneNumber: { operator: exports.Where.EQUALS, value: (_d = checkout.user) === null || _d === void 0 ? void 0 : _d.phone } },
|
|
2541
|
-
date: [
|
|
2542
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2543
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2544
|
-
],
|
|
2545
|
-
},
|
|
2546
|
-
})
|
|
2547
|
-
.then((data) => data.data);
|
|
2548
|
-
const blockedUniqueEmails = ordersBlockedWithEmail.filter((e) => {
|
|
2549
|
-
var _a;
|
|
2550
|
-
return e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf);
|
|
2551
|
-
});
|
|
2552
|
-
const blockedUniqueCeps = ordersBlockedWithCep.filter((e) => {
|
|
2553
|
-
var _a, _b;
|
|
2554
|
-
return e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf) && e.customer.email !== ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email);
|
|
2555
|
-
});
|
|
2556
|
-
const blockedUniquePhone = ordersBlockedWithPhone.filter((e) => {
|
|
2557
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2558
|
-
return (e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf) &&
|
|
2559
|
-
e.customer.email !== ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email) &&
|
|
2560
|
-
((_d = (_c = e.customer.shippingAddress) === null || _c === void 0 ? void 0 : _c.zip) === null || _d === void 0 ? void 0 : _d.toString()) !== ((_f = (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.zip) === null || _f === void 0 ? void 0 : _f.toString()));
|
|
2561
|
-
});
|
|
2562
|
-
const blockedAttempts = ordersBlockedWithCpf
|
|
2563
|
-
.concat(blockedUniqueEmails)
|
|
2564
|
-
.concat(blockedUniqueCeps)
|
|
2565
|
-
.concat(blockedUniquePhone);
|
|
2566
|
-
if (blockedAttempts.length >= this.LIMIT_BLOCKED_ORDERS_DAY) {
|
|
2567
|
-
await this.createBlockedOrderOrPayment(checkout, 'More than 5 attempts have failed', 'Failed attempts', 'day', card || null);
|
|
2568
|
-
return false;
|
|
2569
|
-
}
|
|
2570
|
-
return true;
|
|
2571
|
-
}
|
|
2572
|
-
async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
|
|
2573
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2574
|
-
const paymentBlocked = {
|
|
2575
|
-
customer: {
|
|
2576
|
-
name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
|
|
2577
|
-
cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
|
|
2578
|
-
id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
|
|
2579
|
-
email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
|
|
2580
|
-
phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
|
|
2581
|
-
isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
|
|
2582
|
-
subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
|
|
2583
|
-
shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
|
|
2584
|
-
},
|
|
2585
|
-
blockType,
|
|
2586
|
-
limiteRange,
|
|
2587
|
-
type,
|
|
2588
|
-
card,
|
|
2589
|
-
checkout: {
|
|
2590
|
-
id: checkout.id,
|
|
2591
|
-
shop: checkout.shop,
|
|
2592
|
-
total: checkout.totalPrice,
|
|
2593
|
-
},
|
|
2594
|
-
date: new Date(),
|
|
2595
|
-
};
|
|
2596
|
-
await this.orderBlockedRepository.create(paymentBlocked);
|
|
2597
|
-
}
|
|
2598
|
-
getDateRange(range = 'day') {
|
|
2599
|
-
switch (range) {
|
|
2600
|
-
case 'day':
|
|
2601
|
-
return {
|
|
2602
|
-
firstDate: dateFns.startOfDay(new Date()).getTime(),
|
|
2603
|
-
lastDate: dateFns.endOfDay(new Date()).getTime(),
|
|
2604
|
-
};
|
|
2605
|
-
case 'week':
|
|
2606
|
-
return {
|
|
2607
|
-
firstDate: dateFns.startOfDay(dateFns.subDays(new Date(), 7)).getTime(),
|
|
2608
|
-
lastDate: dateFns.endOfDay(new Date()).getTime(),
|
|
2609
|
-
};
|
|
2610
|
-
default:
|
|
2611
|
-
return {
|
|
2612
|
-
firstDate: dateFns.startOfDay(new Date()).getTime(),
|
|
2613
|
-
lastDate: dateFns.endOfDay(new Date()).getTime(),
|
|
2614
|
-
};
|
|
2615
|
-
}
|
|
2616
|
-
}
|
|
2617
|
-
formatZip(zip) {
|
|
2618
|
-
if (zip.length === 8)
|
|
2619
|
-
return zip.substring(0, 5) + '-' + zip.substring(5, 8);
|
|
2620
|
-
return zip;
|
|
2097
|
+
const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
|
|
2098
|
+
const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
|
|
2099
|
+
lastName, acceptsNewsletter: false, area: exports.Area.Transactional, officePosition: exports.OfficePosition.Intern, type: exports.UserType.Collaborator }));
|
|
2100
|
+
return this.userRepository.create(person);
|
|
2621
2101
|
}
|
|
2622
2102
|
}
|
|
2623
2103
|
|
|
2624
|
-
class
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
createdAt: new Date(),
|
|
2628
|
-
updatedAt: new Date(),
|
|
2629
|
-
userId: checkout.user.id,
|
|
2630
|
-
checkoutId: checkout.id,
|
|
2631
|
-
totalPrice: checkout.totalPrice,
|
|
2632
|
-
transaction: {
|
|
2633
|
-
amount: 0,
|
|
2634
|
-
acquirerResponseCode: '0000',
|
|
2635
|
-
acquirerName: 'glampoints',
|
|
2636
|
-
authorizedAmount: 0,
|
|
2637
|
-
captureMethod: 'ecommerce',
|
|
2638
|
-
installments: 1,
|
|
2639
|
-
cost: 0,
|
|
2640
|
-
paidAmount: 0,
|
|
2641
|
-
paymentMethod: 'glampoints',
|
|
2642
|
-
referer: 'api_key',
|
|
2643
|
-
refundedAmount: 0,
|
|
2644
|
-
status: 'paid',
|
|
2645
|
-
statusReason: 'acquirer',
|
|
2646
|
-
},
|
|
2647
|
-
};
|
|
2648
|
-
return Promise.resolve(payment);
|
|
2104
|
+
class UserAlreadyRegisteredError extends tsCustomError.CustomError {
|
|
2105
|
+
constructor(message) {
|
|
2106
|
+
super(message);
|
|
2649
2107
|
}
|
|
2650
2108
|
}
|
|
2651
2109
|
|
|
2652
|
-
class
|
|
2653
|
-
constructor(
|
|
2654
|
-
|
|
2655
|
-
}
|
|
2656
|
-
async pay(checkout) {
|
|
2657
|
-
try {
|
|
2658
|
-
const result = await axios__default["default"]({
|
|
2659
|
-
method: 'POST',
|
|
2660
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2661
|
-
data: this.createBoletoPayment(checkout),
|
|
2662
|
-
});
|
|
2663
|
-
if (result.data.status !== 'processing') {
|
|
2664
|
-
console.log('Erro ao gerar o boleto para o checkout: ');
|
|
2665
|
-
return Promise.reject(new Error(`Erro ao gerar o boleto para o checkout: ${checkout.id}`));
|
|
2666
|
-
}
|
|
2667
|
-
const payment = {
|
|
2668
|
-
createdAt: new Date(),
|
|
2669
|
-
updatedAt: new Date(),
|
|
2670
|
-
userId: checkout.user.id,
|
|
2671
|
-
checkoutId: checkout.id,
|
|
2672
|
-
totalPrice: checkout.totalPrice,
|
|
2673
|
-
transaction: result.data,
|
|
2674
|
-
};
|
|
2675
|
-
return payment;
|
|
2676
|
-
}
|
|
2677
|
-
catch (error) {
|
|
2678
|
-
console.log(error);
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
createBoletoPayment(checkout) {
|
|
2682
|
-
return {
|
|
2683
|
-
api_key: this.credentials.API_KEY,
|
|
2684
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
2685
|
-
boleto_rules: ['strict_expiration_date'],
|
|
2686
|
-
boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
|
|
2687
|
-
boleto_expiration_date: dateFns.format(dateFns.addDays(new Date(), 3), 'yyyy-MM-dd'),
|
|
2688
|
-
payment_method: 'boleto',
|
|
2689
|
-
postback_url: this.credentials.URL_POSTBACK,
|
|
2690
|
-
customer: {
|
|
2691
|
-
external_id: checkout.user.id,
|
|
2692
|
-
type: 'individual',
|
|
2693
|
-
country: 'br',
|
|
2694
|
-
name: checkout.user.displayName,
|
|
2695
|
-
documents: [
|
|
2696
|
-
{
|
|
2697
|
-
type: 'cpf',
|
|
2698
|
-
number: checkout.user.cpf,
|
|
2699
|
-
},
|
|
2700
|
-
],
|
|
2701
|
-
},
|
|
2702
|
-
};
|
|
2110
|
+
class WeakPasswordError extends tsCustomError.CustomError {
|
|
2111
|
+
constructor(message = 'Weak password') {
|
|
2112
|
+
super(message);
|
|
2703
2113
|
}
|
|
2704
2114
|
}
|
|
2705
2115
|
|
|
2706
|
-
class
|
|
2707
|
-
constructor(
|
|
2708
|
-
this.
|
|
2709
|
-
|
|
2710
|
-
async pay(checkout, card) {
|
|
2711
|
-
try {
|
|
2712
|
-
const result = await axios__default["default"]({
|
|
2713
|
-
method: 'POST',
|
|
2714
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2715
|
-
data: this.createCardPayment(checkout, card),
|
|
2716
|
-
});
|
|
2717
|
-
if (result.data.status !== 'paid') {
|
|
2718
|
-
this.checkoutAntiFraudService.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2719
|
-
return Promise.reject(new Error(`Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito`));
|
|
2720
|
-
}
|
|
2721
|
-
const payment = {
|
|
2722
|
-
createdAt: new Date(),
|
|
2723
|
-
updatedAt: new Date(),
|
|
2724
|
-
userId: checkout.user.id,
|
|
2725
|
-
checkoutId: checkout.id,
|
|
2726
|
-
totalPrice: checkout.totalPrice,
|
|
2727
|
-
transaction: result.data,
|
|
2728
|
-
};
|
|
2729
|
-
return payment;
|
|
2730
|
-
}
|
|
2731
|
-
catch (error) {
|
|
2732
|
-
console.log(error);
|
|
2733
|
-
}
|
|
2734
|
-
}
|
|
2735
|
-
addCard() {
|
|
2736
|
-
throw new Error('Method not implemented.');
|
|
2116
|
+
class Register {
|
|
2117
|
+
constructor(registerService, userRepository) {
|
|
2118
|
+
this.registerService = registerService;
|
|
2119
|
+
this.userRepository = userRepository;
|
|
2737
2120
|
}
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
],
|
|
2760
|
-
},
|
|
2761
|
-
billing: {
|
|
2762
|
-
name: checkout.user.displayName,
|
|
2763
|
-
address: {
|
|
2764
|
-
country: 'br',
|
|
2765
|
-
state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
|
|
2766
|
-
city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
|
|
2767
|
-
neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
|
|
2768
|
-
street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
|
|
2769
|
-
street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
|
|
2770
|
-
zipcode: checkout.billingAddress
|
|
2771
|
-
? checkout.billingAddress.zip.replace('-', '')
|
|
2772
|
-
: (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
|
|
2773
|
-
},
|
|
2774
|
-
},
|
|
2775
|
-
items: checkout.lineItems.map((item) => {
|
|
2776
|
-
return {
|
|
2777
|
-
id: item.id,
|
|
2778
|
-
title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
|
|
2779
|
-
unit_price: Math.floor(item.pricePaid * 100),
|
|
2780
|
-
quantity: item.quantity,
|
|
2781
|
-
tangible: true,
|
|
2782
|
-
};
|
|
2783
|
-
}),
|
|
2784
|
-
};
|
|
2121
|
+
async register(params) {
|
|
2122
|
+
const email = params.email.toLocaleLowerCase();
|
|
2123
|
+
const displayName = `${params.firstName} ${params.lastName}`;
|
|
2124
|
+
if (await this.userRepository.checkIfExistsByField('cpf', params.cpf))
|
|
2125
|
+
throw new UserAlreadyRegisteredError(`Usuário com CPF ${params.cpf} já registrado.`);
|
|
2126
|
+
if (await this.userRepository.checkIfExistsByField('email', params.email))
|
|
2127
|
+
throw new UserAlreadyRegisteredError(`Usuário com e-mail ${params.email} já registrado.`);
|
|
2128
|
+
const auth = await this.registerService.register({
|
|
2129
|
+
birthday: params.birthday,
|
|
2130
|
+
email,
|
|
2131
|
+
firstName: params.firstName,
|
|
2132
|
+
lastName: params.lastName,
|
|
2133
|
+
cpf: params.cpf,
|
|
2134
|
+
displayName,
|
|
2135
|
+
phone: params.phone,
|
|
2136
|
+
password: params.password,
|
|
2137
|
+
});
|
|
2138
|
+
delete params.password;
|
|
2139
|
+
const user = await this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email,
|
|
2140
|
+
displayName, type: exports.UserType.B2C, dateCreated: new Date(), dateModified: new Date() }));
|
|
2141
|
+
return user;
|
|
2785
2142
|
}
|
|
2786
2143
|
}
|
|
2787
2144
|
|
|
2788
|
-
class
|
|
2789
|
-
constructor(
|
|
2790
|
-
this.
|
|
2145
|
+
class SignOut {
|
|
2146
|
+
constructor(authService) {
|
|
2147
|
+
this.authService = authService;
|
|
2791
2148
|
}
|
|
2792
|
-
async
|
|
2793
|
-
|
|
2794
|
-
const result = await axios__default["default"]({
|
|
2795
|
-
method: 'POST',
|
|
2796
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2797
|
-
data: this.createPixPayment(checkout),
|
|
2798
|
-
});
|
|
2799
|
-
const payment = {
|
|
2800
|
-
createdAt: new Date(),
|
|
2801
|
-
updatedAt: new Date(),
|
|
2802
|
-
userId: checkout.user.id,
|
|
2803
|
-
checkoutId: checkout.id,
|
|
2804
|
-
totalPrice: checkout.totalPrice,
|
|
2805
|
-
transaction: result.data,
|
|
2806
|
-
};
|
|
2807
|
-
return payment;
|
|
2808
|
-
}
|
|
2809
|
-
catch (error) {
|
|
2810
|
-
console.log(error);
|
|
2811
|
-
}
|
|
2149
|
+
async signOut() {
|
|
2150
|
+
await this.authService.signOut();
|
|
2812
2151
|
}
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
external_id: checkout.user.id,
|
|
2822
|
-
type: 'individual',
|
|
2823
|
-
country: 'br',
|
|
2824
|
-
name: checkout.user.displayName,
|
|
2825
|
-
email: checkout.user.email.trim(),
|
|
2826
|
-
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
2827
|
-
documents: [
|
|
2828
|
-
{
|
|
2829
|
-
type: 'cpf',
|
|
2830
|
-
number: checkout.user.cpf,
|
|
2831
|
-
},
|
|
2832
|
-
],
|
|
2833
|
-
},
|
|
2834
|
-
};
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
class RecoveryPassword {
|
|
2155
|
+
constructor(authService) {
|
|
2156
|
+
this.authService = authService;
|
|
2157
|
+
}
|
|
2158
|
+
async sendEmail(email) {
|
|
2159
|
+
await this.authService.sendPasswordResetEmail(email);
|
|
2835
2160
|
}
|
|
2836
2161
|
}
|
|
2837
2162
|
|
|
@@ -2849,12 +2174,6 @@ class RoundProductPricesHelper {
|
|
|
2849
2174
|
}
|
|
2850
2175
|
}
|
|
2851
2176
|
|
|
2852
|
-
class Sequence extends BaseModel {
|
|
2853
|
-
static get identifiersFields() {
|
|
2854
|
-
return ['id'];
|
|
2855
|
-
}
|
|
2856
|
-
}
|
|
2857
|
-
|
|
2858
2177
|
exports.FilterType = void 0;
|
|
2859
2178
|
(function (FilterType) {
|
|
2860
2179
|
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
@@ -3149,7 +2468,7 @@ class ProductsIndex {
|
|
|
3149
2468
|
}
|
|
3150
2469
|
async save(product) {
|
|
3151
2470
|
try {
|
|
3152
|
-
const { createdAt, updatedAt, kitProducts } = product, data =
|
|
2471
|
+
const { createdAt, updatedAt, kitProducts } = product, data = tslib.__rest(product, ["createdAt", "updatedAt", "kitProducts"]);
|
|
3153
2472
|
this.adapter.save(this.index, data);
|
|
3154
2473
|
}
|
|
3155
2474
|
catch (error) {
|
|
@@ -3514,6 +2833,161 @@ const withCrudFirestore = (MixinBase) => {
|
|
|
3514
2833
|
};
|
|
3515
2834
|
};
|
|
3516
2835
|
|
|
2836
|
+
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2837
|
+
constructor({ firestore, interceptors }) {
|
|
2838
|
+
super({
|
|
2839
|
+
firestore,
|
|
2840
|
+
collectionName: 'leads',
|
|
2841
|
+
model: Lead,
|
|
2842
|
+
interceptors,
|
|
2843
|
+
});
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2848
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
2849
|
+
super({
|
|
2850
|
+
firestore,
|
|
2851
|
+
collectionName: 'editions',
|
|
2852
|
+
parentIdField: 'subscriptionId',
|
|
2853
|
+
model: Edition,
|
|
2854
|
+
interceptors,
|
|
2855
|
+
});
|
|
2856
|
+
this.parentRepository = parentRepository;
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2861
|
+
constructor({ firestore, interceptors, }) {
|
|
2862
|
+
super({
|
|
2863
|
+
firestore,
|
|
2864
|
+
collectionName: 'subscription',
|
|
2865
|
+
model: Subscription,
|
|
2866
|
+
interceptors,
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
|
|
2871
|
+
class SubscriptionMaterializationFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2872
|
+
constructor({ firestore, interceptors }) {
|
|
2873
|
+
super({
|
|
2874
|
+
firestore,
|
|
2875
|
+
collectionName: 'subscriptionMaterialization',
|
|
2876
|
+
model: SubscriptionMaterialization,
|
|
2877
|
+
interceptors,
|
|
2878
|
+
});
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2882
|
+
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2883
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
2884
|
+
super({
|
|
2885
|
+
firestore,
|
|
2886
|
+
collectionName: 'payments',
|
|
2887
|
+
parentIdField: 'subscriptionId',
|
|
2888
|
+
model: SubscriptionPayment,
|
|
2889
|
+
interceptors,
|
|
2890
|
+
});
|
|
2891
|
+
this.parentRepository = parentRepository;
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
class SubscriptionSummaryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2896
|
+
constructor({ firestore, interceptors, }) {
|
|
2897
|
+
super({
|
|
2898
|
+
firestore,
|
|
2899
|
+
collectionName: 'subscriptionSummary',
|
|
2900
|
+
model: SubscriptionSummary,
|
|
2901
|
+
interceptors,
|
|
2902
|
+
});
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
|
|
2906
|
+
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2907
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
2908
|
+
super({
|
|
2909
|
+
firestore,
|
|
2910
|
+
collectionName: 'address',
|
|
2911
|
+
parentIdField: 'userId',
|
|
2912
|
+
model: UserAddress,
|
|
2913
|
+
interceptors,
|
|
2914
|
+
});
|
|
2915
|
+
this.parentRepository = parentRepository;
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2920
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
2921
|
+
super({
|
|
2922
|
+
firestore,
|
|
2923
|
+
collectionName: 'CX',
|
|
2924
|
+
parentIdField: 'userId',
|
|
2925
|
+
model: BeautyProfile,
|
|
2926
|
+
interceptors,
|
|
2927
|
+
});
|
|
2928
|
+
this.parentRepository = parentRepository;
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
2933
|
+
constructor({ firestore, interceptors }) {
|
|
2934
|
+
super({
|
|
2935
|
+
firestore,
|
|
2936
|
+
collectionName: 'users',
|
|
2937
|
+
model: User,
|
|
2938
|
+
interceptors,
|
|
2939
|
+
});
|
|
2940
|
+
}
|
|
2941
|
+
async get(identifiers) {
|
|
2942
|
+
const user = await super.get({ id: identifiers.id });
|
|
2943
|
+
user.beautyProfile = await this.getBeautyProfile(user.id);
|
|
2944
|
+
user.isSubscriber = await this.checkIfIsSubscriber(user.id);
|
|
2945
|
+
return user;
|
|
2946
|
+
}
|
|
2947
|
+
async checkIfExistsByField(field, value) {
|
|
2948
|
+
const result = await this.find({ filters: { [field]: value } });
|
|
2949
|
+
return result.count > 0;
|
|
2950
|
+
}
|
|
2951
|
+
buildModelInstance() {
|
|
2952
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
2953
|
+
return {
|
|
2954
|
+
toFirestore: (data) => {
|
|
2955
|
+
const plain = toFirestore(data);
|
|
2956
|
+
delete plain.isSubscriber;
|
|
2957
|
+
return plain;
|
|
2958
|
+
},
|
|
2959
|
+
fromFirestore,
|
|
2960
|
+
};
|
|
2961
|
+
}
|
|
2962
|
+
async getBeautyProfile(userId) {
|
|
2963
|
+
const beautyProfile = await firestore.getDoc(firestore.doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
|
|
2964
|
+
return beautyProfile.data();
|
|
2965
|
+
}
|
|
2966
|
+
async checkIfIsSubscriber(userId) {
|
|
2967
|
+
const docs = await firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')));
|
|
2968
|
+
return !!docs && !!docs.size;
|
|
2969
|
+
}
|
|
2970
|
+
buildBeautyProfileModelInstance() {
|
|
2971
|
+
return {
|
|
2972
|
+
toFirestore: (data) => data.toPlain(),
|
|
2973
|
+
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
2974
|
+
};
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2979
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
2980
|
+
super({
|
|
2981
|
+
firestore,
|
|
2982
|
+
collectionName: 'payment_method',
|
|
2983
|
+
parentIdField: 'userId',
|
|
2984
|
+
model: UserPaymentMethod,
|
|
2985
|
+
interceptors,
|
|
2986
|
+
});
|
|
2987
|
+
this.parentRepository = parentRepository;
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
|
|
3517
2991
|
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3518
2992
|
constructor({ firestore, interceptors }) {
|
|
3519
2993
|
super({
|
|
@@ -3617,132 +3091,37 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3617
3091
|
if (!!review.status)
|
|
3618
3092
|
return this.reviews.approved.push(Object.assign(Object.assign({}, review), productInfo));
|
|
3619
3093
|
return review;
|
|
3620
|
-
});
|
|
3621
|
-
});
|
|
3622
|
-
return this.reviews[status];
|
|
3623
|
-
}
|
|
3624
|
-
cleanShoppingCountFromIds() {
|
|
3625
|
-
return;
|
|
3626
|
-
}
|
|
3627
|
-
findCatalog(params) {
|
|
3628
|
-
return this.find(params);
|
|
3629
|
-
}
|
|
3630
|
-
}
|
|
3631
|
-
|
|
3632
|
-
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3633
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
3634
|
-
super({
|
|
3635
|
-
firestore,
|
|
3636
|
-
collectionName: 'variants',
|
|
3637
|
-
parentIdField: 'productId',
|
|
3638
|
-
model: Variant,
|
|
3639
|
-
interceptors,
|
|
3640
|
-
});
|
|
3641
|
-
this.parentRepository = parentRepository;
|
|
3642
|
-
}
|
|
3643
|
-
}
|
|
3644
|
-
|
|
3645
|
-
class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3646
|
-
constructor({ firestore, interceptors }) {
|
|
3647
|
-
super({
|
|
3648
|
-
firestore,
|
|
3649
|
-
collectionName: 'subscriptionProducts',
|
|
3650
|
-
model: Product,
|
|
3651
|
-
interceptors,
|
|
3652
|
-
});
|
|
3653
|
-
}
|
|
3654
|
-
}
|
|
3655
|
-
|
|
3656
|
-
class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3657
|
-
constructor({ firestore, interceptors }) {
|
|
3658
|
-
super({
|
|
3659
|
-
firestore,
|
|
3660
|
-
collectionName: 'sequences',
|
|
3661
|
-
model: Sequence,
|
|
3662
|
-
interceptors,
|
|
3663
|
-
});
|
|
3664
|
-
}
|
|
3665
|
-
}
|
|
3666
|
-
|
|
3667
|
-
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3668
|
-
constructor({ firestore, interceptors }) {
|
|
3669
|
-
super({
|
|
3670
|
-
firestore,
|
|
3671
|
-
collectionName: 'dms',
|
|
3672
|
-
model: Home,
|
|
3673
|
-
interceptors,
|
|
3674
|
-
});
|
|
3675
|
-
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
3676
|
-
var _a, _b, _c;
|
|
3677
|
-
return ({
|
|
3678
|
-
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
3679
|
-
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
3680
|
-
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
3681
|
-
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)) || [],
|
|
3682
|
-
});
|
|
3683
|
-
};
|
|
3684
|
-
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
3685
|
-
var _a;
|
|
3686
|
-
return ({
|
|
3687
|
-
category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
|
|
3688
|
-
products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
|
|
3689
|
-
});
|
|
3690
|
-
};
|
|
3691
|
-
}
|
|
3692
|
-
buildModelInstance() {
|
|
3693
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3694
|
-
return {
|
|
3695
|
-
toFirestore: (data) => {
|
|
3696
|
-
const modifiedData = this.homeToFirestore(data);
|
|
3697
|
-
return toFirestore(modifiedData);
|
|
3698
|
-
},
|
|
3699
|
-
fromFirestore: (snap) => {
|
|
3700
|
-
const instance = fromFirestore(snap);
|
|
3701
|
-
return this.homeFromFirestore(instance);
|
|
3702
|
-
},
|
|
3703
|
-
};
|
|
3094
|
+
});
|
|
3095
|
+
});
|
|
3096
|
+
return this.reviews[status];
|
|
3704
3097
|
}
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3708
|
-
home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
|
|
3709
|
-
home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
|
|
3710
|
-
home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
|
|
3711
|
-
}
|
|
3712
|
-
return home;
|
|
3098
|
+
cleanShoppingCountFromIds() {
|
|
3099
|
+
return;
|
|
3713
3100
|
}
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3717
|
-
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
3718
|
-
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
3719
|
-
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
3720
|
-
home.data.createdAt =
|
|
3721
|
-
home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
3722
|
-
home.data.expiresAt =
|
|
3723
|
-
home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
3724
|
-
}
|
|
3725
|
-
return home;
|
|
3101
|
+
findCatalog(params) {
|
|
3102
|
+
return this.find(params);
|
|
3726
3103
|
}
|
|
3727
3104
|
}
|
|
3728
3105
|
|
|
3729
|
-
class
|
|
3730
|
-
constructor({ firestore, interceptors }) {
|
|
3106
|
+
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3107
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3731
3108
|
super({
|
|
3732
3109
|
firestore,
|
|
3733
|
-
collectionName: '
|
|
3734
|
-
|
|
3110
|
+
collectionName: 'variants',
|
|
3111
|
+
parentIdField: 'productId',
|
|
3112
|
+
model: Variant,
|
|
3735
3113
|
interceptors,
|
|
3736
3114
|
});
|
|
3115
|
+
this.parentRepository = parentRepository;
|
|
3737
3116
|
}
|
|
3738
3117
|
}
|
|
3739
3118
|
|
|
3740
|
-
class
|
|
3741
|
-
constructor({ firestore, interceptors
|
|
3119
|
+
class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3120
|
+
constructor({ firestore, interceptors }) {
|
|
3742
3121
|
super({
|
|
3743
3122
|
firestore,
|
|
3744
|
-
collectionName: '
|
|
3745
|
-
model:
|
|
3123
|
+
collectionName: 'subscriptionProducts',
|
|
3124
|
+
model: Product,
|
|
3746
3125
|
interceptors,
|
|
3747
3126
|
});
|
|
3748
3127
|
}
|
|
@@ -3878,17 +3257,6 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3878
3257
|
}
|
|
3879
3258
|
}
|
|
3880
3259
|
|
|
3881
|
-
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3882
|
-
constructor({ firestore, interceptors, }) {
|
|
3883
|
-
super({
|
|
3884
|
-
firestore,
|
|
3885
|
-
collectionName: 'paymentBlockedAttempts',
|
|
3886
|
-
model: OrderBlocked,
|
|
3887
|
-
interceptors,
|
|
3888
|
-
});
|
|
3889
|
-
}
|
|
3890
|
-
}
|
|
3891
|
-
|
|
3892
3260
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3893
3261
|
constructor({ firestore, interceptors }) {
|
|
3894
3262
|
super({
|
|
@@ -3911,158 +3279,87 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
|
|
|
3911
3279
|
}
|
|
3912
3280
|
}
|
|
3913
3281
|
|
|
3914
|
-
class
|
|
3915
|
-
constructor({ firestore, interceptors }) {
|
|
3916
|
-
super({
|
|
3917
|
-
firestore,
|
|
3918
|
-
collectionName: 'leads',
|
|
3919
|
-
model: Lead,
|
|
3920
|
-
interceptors,
|
|
3921
|
-
});
|
|
3922
|
-
}
|
|
3923
|
-
}
|
|
3924
|
-
|
|
3925
|
-
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3926
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
3927
|
-
super({
|
|
3928
|
-
firestore,
|
|
3929
|
-
collectionName: 'editions',
|
|
3930
|
-
parentIdField: 'subscriptionId',
|
|
3931
|
-
model: Edition,
|
|
3932
|
-
interceptors,
|
|
3933
|
-
});
|
|
3934
|
-
this.parentRepository = parentRepository;
|
|
3935
|
-
}
|
|
3936
|
-
}
|
|
3937
|
-
|
|
3938
|
-
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3939
|
-
constructor({ firestore, interceptors, }) {
|
|
3940
|
-
super({
|
|
3941
|
-
firestore,
|
|
3942
|
-
collectionName: 'subscription',
|
|
3943
|
-
model: Subscription,
|
|
3944
|
-
interceptors,
|
|
3945
|
-
});
|
|
3946
|
-
}
|
|
3947
|
-
}
|
|
3948
|
-
|
|
3949
|
-
class SubscriptionMaterializationFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3282
|
+
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3950
3283
|
constructor({ firestore, interceptors }) {
|
|
3951
3284
|
super({
|
|
3952
3285
|
firestore,
|
|
3953
|
-
collectionName: '
|
|
3954
|
-
model:
|
|
3955
|
-
interceptors,
|
|
3956
|
-
});
|
|
3957
|
-
}
|
|
3958
|
-
}
|
|
3959
|
-
|
|
3960
|
-
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3961
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
3962
|
-
super({
|
|
3963
|
-
firestore,
|
|
3964
|
-
collectionName: 'payments',
|
|
3965
|
-
parentIdField: 'subscriptionId',
|
|
3966
|
-
model: SubscriptionPayment,
|
|
3286
|
+
collectionName: 'dms',
|
|
3287
|
+
model: Home,
|
|
3967
3288
|
interceptors,
|
|
3968
3289
|
});
|
|
3969
|
-
this.
|
|
3290
|
+
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
3291
|
+
var _a, _b, _c;
|
|
3292
|
+
return ({
|
|
3293
|
+
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
3294
|
+
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
3295
|
+
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
3296
|
+
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)) || [],
|
|
3297
|
+
});
|
|
3298
|
+
};
|
|
3299
|
+
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
3300
|
+
var _a;
|
|
3301
|
+
return ({
|
|
3302
|
+
category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
|
|
3303
|
+
products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
|
|
3304
|
+
});
|
|
3305
|
+
};
|
|
3970
3306
|
}
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3307
|
+
buildModelInstance() {
|
|
3308
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3309
|
+
return {
|
|
3310
|
+
toFirestore: (data) => {
|
|
3311
|
+
const modifiedData = this.homeToFirestore(data);
|
|
3312
|
+
return toFirestore(modifiedData);
|
|
3313
|
+
},
|
|
3314
|
+
fromFirestore: (snap) => {
|
|
3315
|
+
const instance = fromFirestore(snap);
|
|
3316
|
+
return this.homeFromFirestore(instance);
|
|
3317
|
+
},
|
|
3318
|
+
};
|
|
3981
3319
|
}
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
model: UserAddress,
|
|
3991
|
-
interceptors,
|
|
3992
|
-
});
|
|
3993
|
-
this.parentRepository = parentRepository;
|
|
3320
|
+
homeToFirestore(home) {
|
|
3321
|
+
var _a, _b, _c, _d;
|
|
3322
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3323
|
+
home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
|
|
3324
|
+
home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
|
|
3325
|
+
home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
|
|
3326
|
+
}
|
|
3327
|
+
return home;
|
|
3994
3328
|
}
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
}
|
|
4006
|
-
|
|
3329
|
+
homeFromFirestore(home) {
|
|
3330
|
+
var _a;
|
|
3331
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3332
|
+
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
3333
|
+
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
3334
|
+
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
3335
|
+
home.data.createdAt =
|
|
3336
|
+
home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
3337
|
+
home.data.expiresAt =
|
|
3338
|
+
home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
3339
|
+
}
|
|
3340
|
+
return home;
|
|
4007
3341
|
}
|
|
4008
3342
|
}
|
|
4009
3343
|
|
|
4010
|
-
class
|
|
3344
|
+
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4011
3345
|
constructor({ firestore, interceptors }) {
|
|
4012
3346
|
super({
|
|
4013
3347
|
firestore,
|
|
4014
|
-
collectionName: '
|
|
4015
|
-
model:
|
|
3348
|
+
collectionName: 'shopMenus',
|
|
3349
|
+
model: ShopMenu,
|
|
4016
3350
|
interceptors,
|
|
4017
3351
|
});
|
|
4018
3352
|
}
|
|
4019
|
-
async get(identifiers) {
|
|
4020
|
-
const user = await super.get({ id: identifiers.id });
|
|
4021
|
-
user.beautyProfile = await this.getBeautyProfile(user.id);
|
|
4022
|
-
user.isSubscriber = await this.checkIfIsSubscriber(user.id);
|
|
4023
|
-
return user;
|
|
4024
|
-
}
|
|
4025
|
-
async checkIfExistsByField(field, value) {
|
|
4026
|
-
const result = await this.find({ filters: { [field]: value } });
|
|
4027
|
-
return result.count > 0;
|
|
4028
|
-
}
|
|
4029
|
-
buildModelInstance() {
|
|
4030
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
4031
|
-
return {
|
|
4032
|
-
toFirestore: (data) => {
|
|
4033
|
-
const plain = toFirestore(data);
|
|
4034
|
-
delete plain.isSubscriber;
|
|
4035
|
-
return plain;
|
|
4036
|
-
},
|
|
4037
|
-
fromFirestore,
|
|
4038
|
-
};
|
|
4039
|
-
}
|
|
4040
|
-
async getBeautyProfile(userId) {
|
|
4041
|
-
const beautyProfile = await firestore.getDoc(firestore.doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
|
|
4042
|
-
return beautyProfile.data();
|
|
4043
|
-
}
|
|
4044
|
-
async checkIfIsSubscriber(userId) {
|
|
4045
|
-
const docs = await firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')));
|
|
4046
|
-
return !!docs && !!docs.size;
|
|
4047
|
-
}
|
|
4048
|
-
buildBeautyProfileModelInstance() {
|
|
4049
|
-
return {
|
|
4050
|
-
toFirestore: (data) => data.toPlain(),
|
|
4051
|
-
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
4052
|
-
};
|
|
4053
|
-
}
|
|
4054
3353
|
}
|
|
4055
3354
|
|
|
4056
|
-
class
|
|
4057
|
-
constructor({ firestore, interceptors }
|
|
3355
|
+
class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3356
|
+
constructor({ firestore, interceptors, }) {
|
|
4058
3357
|
super({
|
|
4059
3358
|
firestore,
|
|
4060
|
-
collectionName: '
|
|
4061
|
-
|
|
4062
|
-
model: UserPaymentMethod,
|
|
3359
|
+
collectionName: 'shopSettings',
|
|
3360
|
+
model: ShopSettings,
|
|
4063
3361
|
interceptors,
|
|
4064
3362
|
});
|
|
4065
|
-
this.parentRepository = parentRepository;
|
|
4066
3363
|
}
|
|
4067
3364
|
}
|
|
4068
3365
|
|
|
@@ -4770,20 +4067,20 @@ class CategoryHasuraGraphQL extends Category {
|
|
|
4770
4067
|
|
|
4771
4068
|
class ProductHasuraGraphQL extends Product {
|
|
4772
4069
|
}
|
|
4773
|
-
|
|
4070
|
+
tslib.__decorate([
|
|
4774
4071
|
classTransformer.Type(() => KitProductHasuraGraphQL),
|
|
4775
|
-
|
|
4072
|
+
tslib.__metadata("design:type", Array)
|
|
4776
4073
|
], ProductHasuraGraphQL.prototype, "kitProducts", void 0);
|
|
4777
4074
|
|
|
4778
4075
|
class KitProductHasuraGraphQL extends KitProduct {
|
|
4779
4076
|
}
|
|
4780
|
-
|
|
4077
|
+
tslib.__decorate([
|
|
4781
4078
|
classTransformer.Type(() => ProductHasuraGraphQL),
|
|
4782
|
-
|
|
4079
|
+
tslib.__metadata("design:type", ProductHasuraGraphQL)
|
|
4783
4080
|
], KitProductHasuraGraphQL.prototype, "kit", void 0);
|
|
4784
|
-
|
|
4081
|
+
tslib.__decorate([
|
|
4785
4082
|
classTransformer.Type(() => ProductHasuraGraphQL),
|
|
4786
|
-
|
|
4083
|
+
tslib.__metadata("design:type", ProductHasuraGraphQL)
|
|
4787
4084
|
], KitProductHasuraGraphQL.prototype, "product", void 0);
|
|
4788
4085
|
|
|
4789
4086
|
class VariantHasuraGraphQL extends Variant {
|
|
@@ -5025,7 +4322,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5025
4322
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
5026
4323
|
}
|
|
5027
4324
|
async create(params) {
|
|
5028
|
-
const { metadata } = params, data =
|
|
4325
|
+
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
5029
4326
|
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
|
|
5030
4327
|
}
|
|
5031
4328
|
async get(identifiers) {
|
|
@@ -5035,7 +4332,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5035
4332
|
: super.get(identifiers);
|
|
5036
4333
|
}
|
|
5037
4334
|
async update(params) {
|
|
5038
|
-
const { products, id: checkId, metadata, filters } = params, data =
|
|
4335
|
+
const { products, id: checkId, metadata, filters } = params, data = tslib.__rest(params, ["products", "id", "metadata", "filters"]);
|
|
5039
4336
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
5040
4337
|
const id = await this.getId(plainData.id);
|
|
5041
4338
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: false }));
|
|
@@ -5158,18 +4455,24 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5158
4455
|
const plainData = this.paramsToPlain({ products });
|
|
5159
4456
|
if (!plainData.products || plainData.products.length <= 0)
|
|
5160
4457
|
return [];
|
|
4458
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
5161
4459
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5162
4460
|
where: {
|
|
5163
4461
|
type: 'category_product_bool_exp',
|
|
5164
4462
|
required: true,
|
|
5165
|
-
value: {
|
|
4463
|
+
value: {
|
|
4464
|
+
category_id: { _eq: categoryId },
|
|
4465
|
+
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
4466
|
+
},
|
|
5166
4467
|
},
|
|
5167
4468
|
});
|
|
5168
4469
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5169
4470
|
objects: {
|
|
5170
4471
|
type: '[category_product_insert_input!]',
|
|
5171
4472
|
required: true,
|
|
5172
|
-
value: plainData.products
|
|
4473
|
+
value: plainData.products
|
|
4474
|
+
.filter((productId) => !category.products.includes(productId))
|
|
4475
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
5173
4476
|
},
|
|
5174
4477
|
});
|
|
5175
4478
|
return plainData.products;
|
|
@@ -5207,15 +4510,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5207
4510
|
},
|
|
5208
4511
|
})
|
|
5209
4512
|
.then((res) => res.data);
|
|
5210
|
-
const currentFiltersId = currentFilters.map((f) => f.
|
|
4513
|
+
const currentFiltersId = currentFilters.map((f) => f.filterId);
|
|
5211
4514
|
const filtersUpdatedId = filters.value.map((f) => f.id);
|
|
5212
4515
|
const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
|
|
5213
4516
|
const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
|
|
5214
4517
|
for (const filter of filterToBeDeleted) {
|
|
5215
4518
|
const index = currentFilters.findIndex((f) => f.id == filter);
|
|
5216
|
-
if (index != -1)
|
|
4519
|
+
if (index != -1)
|
|
5217
4520
|
currentFilters.splice(index, 1);
|
|
5218
|
-
}
|
|
5219
4521
|
await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
|
|
5220
4522
|
}
|
|
5221
4523
|
for (const filter of filterToBeInserted) {
|
|
@@ -5287,7 +4589,7 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
5287
4589
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
5288
4590
|
}
|
|
5289
4591
|
async update(params) {
|
|
5290
|
-
const { options } = params, data =
|
|
4592
|
+
const { options } = params, data = tslib.__rest(params, ["options"]);
|
|
5291
4593
|
const filter = await super.update(data);
|
|
5292
4594
|
filter.options = await this.updateOptions(+data.id, { options });
|
|
5293
4595
|
return filter;
|
|
@@ -5564,7 +4866,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5564
4866
|
];
|
|
5565
4867
|
}
|
|
5566
4868
|
async create(params) {
|
|
5567
|
-
const { metadata } = params, data =
|
|
4869
|
+
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
5568
4870
|
const product = await super.create(lodash.omit(Object.assign(Object.assign({}, data), { metadata: metadata || { description: null, title: null } }), ['reviews']));
|
|
5569
4871
|
try {
|
|
5570
4872
|
product.reviews = data.reviews && (await this.updateReviews(+product.id, data));
|
|
@@ -5587,7 +4889,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5587
4889
|
}
|
|
5588
4890
|
async find(params) {
|
|
5589
4891
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
5590
|
-
const _o = params || {}, { filters, fields } = _o, options =
|
|
4892
|
+
const _o = params || {}, { filters, fields } = _o, options = tslib.__rest(_o, ["filters", "fields"]);
|
|
5591
4893
|
const bindFields = fields ||
|
|
5592
4894
|
this.fields
|
|
5593
4895
|
.map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
|
|
@@ -5625,7 +4927,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5625
4927
|
return product;
|
|
5626
4928
|
}
|
|
5627
4929
|
async update(params) {
|
|
5628
|
-
const { categories, kitProducts, reviews, id: checkId, rate, metadata } = params, data =
|
|
4930
|
+
const { categories, kitProducts, reviews, id: checkId, rate, metadata } = params, data = tslib.__rest(params, ["categories", "kitProducts", "reviews", "id", "rate", "metadata"]);
|
|
5629
4931
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
5630
4932
|
const id = await this.getId(plainData.id);
|
|
5631
4933
|
const product = await super.update(Object.assign({ id }, data));
|
|
@@ -5670,11 +4972,15 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5670
4972
|
const plainData = this.paramsToPlain({ categories });
|
|
5671
4973
|
if (!plainData.categories || plainData.categories.length <= 0)
|
|
5672
4974
|
return [];
|
|
4975
|
+
const product = await this.get({ id: productId.toString() });
|
|
5673
4976
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5674
4977
|
where: {
|
|
5675
4978
|
type: 'category_product_bool_exp',
|
|
5676
4979
|
required: true,
|
|
5677
|
-
value: {
|
|
4980
|
+
value: {
|
|
4981
|
+
product_id: { _eq: productId },
|
|
4982
|
+
category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
|
|
4983
|
+
},
|
|
5678
4984
|
},
|
|
5679
4985
|
});
|
|
5680
4986
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
@@ -5945,11 +5251,11 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5945
5251
|
return variant;
|
|
5946
5252
|
}
|
|
5947
5253
|
async find(params) {
|
|
5948
|
-
const _a = params || {}, { filters } = _a, options =
|
|
5254
|
+
const _a = params || {}, { filters } = _a, options = tslib.__rest(_a, ["filters"]);
|
|
5949
5255
|
return super.find(Object.assign(Object.assign({}, options), { filters: Object.assign({ productId: { operator: exports.Where.ISNOTNULL } }, filters) }));
|
|
5950
5256
|
}
|
|
5951
5257
|
async update(params) {
|
|
5952
|
-
const { productId, id: checkId } = params, data =
|
|
5258
|
+
const { productId, id: checkId } = params, data = tslib.__rest(params, ["productId", "id"]);
|
|
5953
5259
|
const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
|
|
5954
5260
|
const id = await this.getId(dataWithProductId.id);
|
|
5955
5261
|
const product = await super.update(Object.assign({ id }, data));
|
|
@@ -6057,7 +5363,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6057
5363
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
6058
5364
|
}
|
|
6059
5365
|
async create(params) {
|
|
6060
|
-
const { metadata } = params, data =
|
|
5366
|
+
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
6061
5367
|
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
|
|
6062
5368
|
}
|
|
6063
5369
|
async get(identifiers) {
|
|
@@ -6066,8 +5372,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6066
5372
|
throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
|
|
6067
5373
|
return data;
|
|
6068
5374
|
}
|
|
5375
|
+
async find(params) {
|
|
5376
|
+
const { filters } = params, rest = tslib.__rest(params, ["filters"]);
|
|
5377
|
+
return await super.find(Object.assign(Object.assign({}, rest), { filters: Object.assign(Object.assign({}, filters), { isWishlist: { operator: exports.Where.EQUALS, value: true } }) }));
|
|
5378
|
+
}
|
|
6069
5379
|
async update(params) {
|
|
6070
|
-
const { products, id: checkId, metadata, filters } = params, data =
|
|
5380
|
+
const { products, id: checkId, metadata, filters } = params, data = tslib.__rest(params, ["products", "id", "metadata", "filters"]);
|
|
6071
5381
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
6072
5382
|
const id = plainData.id;
|
|
6073
5383
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
|
|
@@ -6124,19 +5434,25 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6124
5434
|
const plainData = this.paramsToPlain({ products });
|
|
6125
5435
|
if (!plainData.products || plainData.products.length <= 0)
|
|
6126
5436
|
return [];
|
|
5437
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
5438
|
+
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
6127
5439
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
6128
5440
|
where: {
|
|
6129
5441
|
type: 'category_product_bool_exp',
|
|
6130
5442
|
required: true,
|
|
6131
|
-
value: {
|
|
5443
|
+
value: {
|
|
5444
|
+
category_id: { _eq: categoryId },
|
|
5445
|
+
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
5446
|
+
},
|
|
6132
5447
|
},
|
|
6133
5448
|
});
|
|
6134
|
-
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
6135
5449
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
6136
5450
|
objects: {
|
|
6137
5451
|
type: '[category_product_insert_input!]',
|
|
6138
5452
|
required: true,
|
|
6139
|
-
value: plainData.products
|
|
5453
|
+
value: plainData.products
|
|
5454
|
+
.filter((productId) => !category.products.includes(productId))
|
|
5455
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
6140
5456
|
},
|
|
6141
5457
|
});
|
|
6142
5458
|
return plainData.products;
|
|
@@ -6235,10 +5551,6 @@ Object.defineProperty(exports, 'sub', {
|
|
|
6235
5551
|
enumerable: true,
|
|
6236
5552
|
get: function () { return dateFns.sub; }
|
|
6237
5553
|
});
|
|
6238
|
-
Object.defineProperty(exports, 'subDays', {
|
|
6239
|
-
enumerable: true,
|
|
6240
|
-
get: function () { return dateFns.subDays; }
|
|
6241
|
-
});
|
|
6242
5554
|
Object.defineProperty(exports, 'chunk', {
|
|
6243
5555
|
enumerable: true,
|
|
6244
5556
|
get: function () { return lodash.chunk; }
|
|
@@ -6308,8 +5620,6 @@ Object.defineProperty(exports, 'unset', {
|
|
|
6308
5620
|
get: function () { return lodash.unset; }
|
|
6309
5621
|
});
|
|
6310
5622
|
exports.Address = Address;
|
|
6311
|
-
exports.AdyenCardService = AdyenCardService;
|
|
6312
|
-
exports.AdyenPaymentMethodFactory = AdyenPaymentMethodFactory;
|
|
6313
5623
|
exports.Authentication = Authentication;
|
|
6314
5624
|
exports.AuthenticationFirebaseAuthService = AuthenticationFirebaseAuthService;
|
|
6315
5625
|
exports.AxiosAdapter = AxiosAdapter;
|
|
@@ -6334,7 +5644,6 @@ exports.CategoryFirestoreRepository = CategoryFirestoreRepository;
|
|
|
6334
5644
|
exports.CategoryHasuraGraphQL = CategoryHasuraGraphQL;
|
|
6335
5645
|
exports.CategoryHasuraGraphQLRepository = CategoryHasuraGraphQLRepository;
|
|
6336
5646
|
exports.Checkout = Checkout;
|
|
6337
|
-
exports.CheckoutAntiFraudService = CheckoutAntiFraudService;
|
|
6338
5647
|
exports.CheckoutFirestoreRepository = CheckoutFirestoreRepository;
|
|
6339
5648
|
exports.CheckoutSubscription = CheckoutSubscription;
|
|
6340
5649
|
exports.CheckoutSubscriptionFirestoreRepository = CheckoutSubscriptionFirestoreRepository;
|
|
@@ -6350,8 +5659,6 @@ exports.Filter = Filter;
|
|
|
6350
5659
|
exports.FilterHasuraGraphQLRepository = FilterHasuraGraphQLRepository;
|
|
6351
5660
|
exports.FilterOption = FilterOption;
|
|
6352
5661
|
exports.FilterOptionHasuraGraphQLRepository = FilterOptionHasuraGraphQLRepository;
|
|
6353
|
-
exports.GlampointsPaymentMethodFactory = GlampointsPaymentMethodFactory;
|
|
6354
|
-
exports.GlampointsPaymentService = GlampointsPaymentService;
|
|
6355
5662
|
exports.Home = Home;
|
|
6356
5663
|
exports.HomeFirestoreRepository = HomeFirestoreRepository;
|
|
6357
5664
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
@@ -6365,17 +5672,9 @@ exports.Log = Log;
|
|
|
6365
5672
|
exports.Logger = Logger;
|
|
6366
5673
|
exports.NotFoundError = NotFoundError;
|
|
6367
5674
|
exports.Order = Order;
|
|
6368
|
-
exports.OrderBlocked = OrderBlocked;
|
|
6369
|
-
exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
|
|
6370
5675
|
exports.OrderFirestoreRepository = OrderFirestoreRepository;
|
|
6371
|
-
exports.PagarmeBankSlipService = PagarmeBankSlipService;
|
|
6372
|
-
exports.PagarmeCardService = PagarmeCardService;
|
|
6373
|
-
exports.PagarmePaymentMethodFactory = PagarmePaymentMethodFactory;
|
|
6374
|
-
exports.PagarmePixService = PagarmePixService;
|
|
6375
5676
|
exports.Payment = Payment;
|
|
6376
5677
|
exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|
|
6377
|
-
exports.PaymentProviderFactory = PaymentProviderFactory;
|
|
6378
|
-
exports.PaymentTransaction = PaymentTransaction;
|
|
6379
5678
|
exports.Product = Product;
|
|
6380
5679
|
exports.ProductFirestoreRepository = ProductFirestoreRepository;
|
|
6381
5680
|
exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
|
|
@@ -6390,8 +5689,6 @@ exports.Register = Register;
|
|
|
6390
5689
|
exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
|
|
6391
5690
|
exports.RequiredArgumentError = RequiredArgumentError;
|
|
6392
5691
|
exports.RoundProductPricesHelper = RoundProductPricesHelper;
|
|
6393
|
-
exports.Sequence = Sequence;
|
|
6394
|
-
exports.SequenceFirestoreRepository = SequenceFirestoreRepository;
|
|
6395
5692
|
exports.ShippingMethod = ShippingMethod;
|
|
6396
5693
|
exports.ShopMenu = ShopMenu;
|
|
6397
5694
|
exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;
|