@infrab4a/connect 4.2.4-beta.8 → 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 -1860
- package/index.esm.js +1029 -1696
- 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,517 +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
|
-
var _a;
|
|
2712
|
-
try {
|
|
2713
|
-
const result = await axios__default["default"]({
|
|
2714
|
-
method: 'POST',
|
|
2715
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2716
|
-
data: this.createCardPayment(checkout, card),
|
|
2717
|
-
});
|
|
2718
|
-
if (result.data.status !== 'paid') {
|
|
2719
|
-
this.checkoutAntiFraudService.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2720
|
-
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`));
|
|
2721
|
-
}
|
|
2722
|
-
const payment = {
|
|
2723
|
-
createdAt: new Date(),
|
|
2724
|
-
updatedAt: new Date(),
|
|
2725
|
-
userId: checkout.user.id,
|
|
2726
|
-
checkoutId: checkout.id,
|
|
2727
|
-
totalPrice: checkout.totalPrice,
|
|
2728
|
-
transaction: result.data,
|
|
2729
|
-
};
|
|
2730
|
-
return payment;
|
|
2731
|
-
}
|
|
2732
|
-
catch (error) {
|
|
2733
|
-
console.log('Error Pagarme card request', JSON.stringify((_a = error.response) === null || _a === void 0 ? void 0 : _a.data));
|
|
2734
|
-
}
|
|
2735
|
-
}
|
|
2736
|
-
addCard() {
|
|
2737
|
-
throw new Error('Method not implemented.');
|
|
2116
|
+
class Register {
|
|
2117
|
+
constructor(registerService, userRepository) {
|
|
2118
|
+
this.registerService = registerService;
|
|
2119
|
+
this.userRepository = userRepository;
|
|
2738
2120
|
}
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
],
|
|
2761
|
-
},
|
|
2762
|
-
billing: {
|
|
2763
|
-
name: checkout.user.displayName,
|
|
2764
|
-
address: {
|
|
2765
|
-
country: 'br',
|
|
2766
|
-
state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
|
|
2767
|
-
city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
|
|
2768
|
-
neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
|
|
2769
|
-
street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
|
|
2770
|
-
street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
|
|
2771
|
-
zipcode: checkout.billingAddress
|
|
2772
|
-
? checkout.billingAddress.zip.replace('-', '')
|
|
2773
|
-
: (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
|
|
2774
|
-
},
|
|
2775
|
-
},
|
|
2776
|
-
items: checkout.lineItems.map((item) => {
|
|
2777
|
-
return {
|
|
2778
|
-
id: item.id,
|
|
2779
|
-
title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
|
|
2780
|
-
unit_price: Math.floor(item.pricePaid * 100),
|
|
2781
|
-
quantity: item.quantity,
|
|
2782
|
-
tangible: true,
|
|
2783
|
-
};
|
|
2784
|
-
}),
|
|
2785
|
-
};
|
|
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;
|
|
2786
2142
|
}
|
|
2787
2143
|
}
|
|
2788
2144
|
|
|
2789
|
-
class
|
|
2790
|
-
constructor(
|
|
2791
|
-
this.
|
|
2145
|
+
class SignOut {
|
|
2146
|
+
constructor(authService) {
|
|
2147
|
+
this.authService = authService;
|
|
2792
2148
|
}
|
|
2793
|
-
async
|
|
2794
|
-
|
|
2795
|
-
const result = await axios__default["default"]({
|
|
2796
|
-
method: 'POST',
|
|
2797
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2798
|
-
data: this.createPixPayment(checkout),
|
|
2799
|
-
});
|
|
2800
|
-
const payment = {
|
|
2801
|
-
createdAt: new Date(),
|
|
2802
|
-
updatedAt: new Date(),
|
|
2803
|
-
userId: checkout.user.id,
|
|
2804
|
-
checkoutId: checkout.id,
|
|
2805
|
-
totalPrice: checkout.totalPrice,
|
|
2806
|
-
transaction: result.data,
|
|
2807
|
-
};
|
|
2808
|
-
return payment;
|
|
2809
|
-
}
|
|
2810
|
-
catch (error) {
|
|
2811
|
-
console.log(error);
|
|
2812
|
-
}
|
|
2149
|
+
async signOut() {
|
|
2150
|
+
await this.authService.signOut();
|
|
2813
2151
|
}
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
external_id: checkout.user.id,
|
|
2823
|
-
type: 'individual',
|
|
2824
|
-
country: 'br',
|
|
2825
|
-
name: checkout.user.displayName,
|
|
2826
|
-
email: checkout.user.email.trim(),
|
|
2827
|
-
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
2828
|
-
documents: [
|
|
2829
|
-
{
|
|
2830
|
-
type: 'cpf',
|
|
2831
|
-
number: checkout.user.cpf,
|
|
2832
|
-
},
|
|
2833
|
-
],
|
|
2834
|
-
},
|
|
2835
|
-
};
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2154
|
+
class RecoveryPassword {
|
|
2155
|
+
constructor(authService) {
|
|
2156
|
+
this.authService = authService;
|
|
2157
|
+
}
|
|
2158
|
+
async sendEmail(email) {
|
|
2159
|
+
await this.authService.sendPasswordResetEmail(email);
|
|
2836
2160
|
}
|
|
2837
2161
|
}
|
|
2838
2162
|
|
|
@@ -2850,12 +2174,6 @@ class RoundProductPricesHelper {
|
|
|
2850
2174
|
}
|
|
2851
2175
|
}
|
|
2852
2176
|
|
|
2853
|
-
class Sequence extends BaseModel {
|
|
2854
|
-
static get identifiersFields() {
|
|
2855
|
-
return ['id'];
|
|
2856
|
-
}
|
|
2857
|
-
}
|
|
2858
|
-
|
|
2859
2177
|
exports.FilterType = void 0;
|
|
2860
2178
|
(function (FilterType) {
|
|
2861
2179
|
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
@@ -3150,7 +2468,7 @@ class ProductsIndex {
|
|
|
3150
2468
|
}
|
|
3151
2469
|
async save(product) {
|
|
3152
2470
|
try {
|
|
3153
|
-
const { createdAt, updatedAt, kitProducts } = product, data =
|
|
2471
|
+
const { createdAt, updatedAt, kitProducts } = product, data = tslib.__rest(product, ["createdAt", "updatedAt", "kitProducts"]);
|
|
3154
2472
|
this.adapter.save(this.index, data);
|
|
3155
2473
|
}
|
|
3156
2474
|
catch (error) {
|
|
@@ -3515,6 +2833,161 @@ const withCrudFirestore = (MixinBase) => {
|
|
|
3515
2833
|
};
|
|
3516
2834
|
};
|
|
3517
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
|
+
|
|
3518
2991
|
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3519
2992
|
constructor({ firestore, interceptors }) {
|
|
3520
2993
|
super({
|
|
@@ -3618,132 +3091,37 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3618
3091
|
if (!!review.status)
|
|
3619
3092
|
return this.reviews.approved.push(Object.assign(Object.assign({}, review), productInfo));
|
|
3620
3093
|
return review;
|
|
3621
|
-
});
|
|
3622
|
-
});
|
|
3623
|
-
return this.reviews[status];
|
|
3624
|
-
}
|
|
3625
|
-
cleanShoppingCountFromIds() {
|
|
3626
|
-
return;
|
|
3627
|
-
}
|
|
3628
|
-
findCatalog(params) {
|
|
3629
|
-
return this.find(params);
|
|
3630
|
-
}
|
|
3631
|
-
}
|
|
3632
|
-
|
|
3633
|
-
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3634
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
3635
|
-
super({
|
|
3636
|
-
firestore,
|
|
3637
|
-
collectionName: 'variants',
|
|
3638
|
-
parentIdField: 'productId',
|
|
3639
|
-
model: Variant,
|
|
3640
|
-
interceptors,
|
|
3641
|
-
});
|
|
3642
|
-
this.parentRepository = parentRepository;
|
|
3643
|
-
}
|
|
3644
|
-
}
|
|
3645
|
-
|
|
3646
|
-
class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3647
|
-
constructor({ firestore, interceptors }) {
|
|
3648
|
-
super({
|
|
3649
|
-
firestore,
|
|
3650
|
-
collectionName: 'subscriptionProducts',
|
|
3651
|
-
model: Product,
|
|
3652
|
-
interceptors,
|
|
3653
|
-
});
|
|
3654
|
-
}
|
|
3655
|
-
}
|
|
3656
|
-
|
|
3657
|
-
class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3658
|
-
constructor({ firestore, interceptors }) {
|
|
3659
|
-
super({
|
|
3660
|
-
firestore,
|
|
3661
|
-
collectionName: 'sequences',
|
|
3662
|
-
model: Sequence,
|
|
3663
|
-
interceptors,
|
|
3664
|
-
});
|
|
3665
|
-
}
|
|
3666
|
-
}
|
|
3667
|
-
|
|
3668
|
-
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3669
|
-
constructor({ firestore, interceptors }) {
|
|
3670
|
-
super({
|
|
3671
|
-
firestore,
|
|
3672
|
-
collectionName: 'dms',
|
|
3673
|
-
model: Home,
|
|
3674
|
-
interceptors,
|
|
3675
|
-
});
|
|
3676
|
-
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
3677
|
-
var _a, _b, _c;
|
|
3678
|
-
return ({
|
|
3679
|
-
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
3680
|
-
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
3681
|
-
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
3682
|
-
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)) || [],
|
|
3683
|
-
});
|
|
3684
|
-
};
|
|
3685
|
-
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
3686
|
-
var _a;
|
|
3687
|
-
return ({
|
|
3688
|
-
category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
|
|
3689
|
-
products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
|
|
3690
|
-
});
|
|
3691
|
-
};
|
|
3692
|
-
}
|
|
3693
|
-
buildModelInstance() {
|
|
3694
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3695
|
-
return {
|
|
3696
|
-
toFirestore: (data) => {
|
|
3697
|
-
const modifiedData = this.homeToFirestore(data);
|
|
3698
|
-
return toFirestore(modifiedData);
|
|
3699
|
-
},
|
|
3700
|
-
fromFirestore: (snap) => {
|
|
3701
|
-
const instance = fromFirestore(snap);
|
|
3702
|
-
return this.homeFromFirestore(instance);
|
|
3703
|
-
},
|
|
3704
|
-
};
|
|
3094
|
+
});
|
|
3095
|
+
});
|
|
3096
|
+
return this.reviews[status];
|
|
3705
3097
|
}
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3709
|
-
home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
|
|
3710
|
-
home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
|
|
3711
|
-
home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
|
|
3712
|
-
}
|
|
3713
|
-
return home;
|
|
3098
|
+
cleanShoppingCountFromIds() {
|
|
3099
|
+
return;
|
|
3714
3100
|
}
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3718
|
-
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
3719
|
-
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
3720
|
-
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
3721
|
-
home.data.createdAt =
|
|
3722
|
-
home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
3723
|
-
home.data.expiresAt =
|
|
3724
|
-
home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
3725
|
-
}
|
|
3726
|
-
return home;
|
|
3101
|
+
findCatalog(params) {
|
|
3102
|
+
return this.find(params);
|
|
3727
3103
|
}
|
|
3728
3104
|
}
|
|
3729
3105
|
|
|
3730
|
-
class
|
|
3731
|
-
constructor({ firestore, interceptors }) {
|
|
3106
|
+
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3107
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3732
3108
|
super({
|
|
3733
3109
|
firestore,
|
|
3734
|
-
collectionName: '
|
|
3735
|
-
|
|
3110
|
+
collectionName: 'variants',
|
|
3111
|
+
parentIdField: 'productId',
|
|
3112
|
+
model: Variant,
|
|
3736
3113
|
interceptors,
|
|
3737
3114
|
});
|
|
3115
|
+
this.parentRepository = parentRepository;
|
|
3738
3116
|
}
|
|
3739
3117
|
}
|
|
3740
3118
|
|
|
3741
|
-
class
|
|
3742
|
-
constructor({ firestore, interceptors
|
|
3119
|
+
class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3120
|
+
constructor({ firestore, interceptors }) {
|
|
3743
3121
|
super({
|
|
3744
3122
|
firestore,
|
|
3745
|
-
collectionName: '
|
|
3746
|
-
model:
|
|
3123
|
+
collectionName: 'subscriptionProducts',
|
|
3124
|
+
model: Product,
|
|
3747
3125
|
interceptors,
|
|
3748
3126
|
});
|
|
3749
3127
|
}
|
|
@@ -3879,17 +3257,6 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
3879
3257
|
}
|
|
3880
3258
|
}
|
|
3881
3259
|
|
|
3882
|
-
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3883
|
-
constructor({ firestore, interceptors, }) {
|
|
3884
|
-
super({
|
|
3885
|
-
firestore,
|
|
3886
|
-
collectionName: 'paymentBlockedAttempts',
|
|
3887
|
-
model: OrderBlocked,
|
|
3888
|
-
interceptors,
|
|
3889
|
-
});
|
|
3890
|
-
}
|
|
3891
|
-
}
|
|
3892
|
-
|
|
3893
3260
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3894
3261
|
constructor({ firestore, interceptors }) {
|
|
3895
3262
|
super({
|
|
@@ -3912,158 +3279,87 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
|
|
|
3912
3279
|
}
|
|
3913
3280
|
}
|
|
3914
3281
|
|
|
3915
|
-
class
|
|
3916
|
-
constructor({ firestore, interceptors }) {
|
|
3917
|
-
super({
|
|
3918
|
-
firestore,
|
|
3919
|
-
collectionName: 'leads',
|
|
3920
|
-
model: Lead,
|
|
3921
|
-
interceptors,
|
|
3922
|
-
});
|
|
3923
|
-
}
|
|
3924
|
-
}
|
|
3925
|
-
|
|
3926
|
-
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3927
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
3928
|
-
super({
|
|
3929
|
-
firestore,
|
|
3930
|
-
collectionName: 'editions',
|
|
3931
|
-
parentIdField: 'subscriptionId',
|
|
3932
|
-
model: Edition,
|
|
3933
|
-
interceptors,
|
|
3934
|
-
});
|
|
3935
|
-
this.parentRepository = parentRepository;
|
|
3936
|
-
}
|
|
3937
|
-
}
|
|
3938
|
-
|
|
3939
|
-
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3940
|
-
constructor({ firestore, interceptors, }) {
|
|
3941
|
-
super({
|
|
3942
|
-
firestore,
|
|
3943
|
-
collectionName: 'subscription',
|
|
3944
|
-
model: Subscription,
|
|
3945
|
-
interceptors,
|
|
3946
|
-
});
|
|
3947
|
-
}
|
|
3948
|
-
}
|
|
3949
|
-
|
|
3950
|
-
class SubscriptionMaterializationFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3282
|
+
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3951
3283
|
constructor({ firestore, interceptors }) {
|
|
3952
3284
|
super({
|
|
3953
3285
|
firestore,
|
|
3954
|
-
collectionName: '
|
|
3955
|
-
model:
|
|
3956
|
-
interceptors,
|
|
3957
|
-
});
|
|
3958
|
-
}
|
|
3959
|
-
}
|
|
3960
|
-
|
|
3961
|
-
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3962
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
3963
|
-
super({
|
|
3964
|
-
firestore,
|
|
3965
|
-
collectionName: 'payments',
|
|
3966
|
-
parentIdField: 'subscriptionId',
|
|
3967
|
-
model: SubscriptionPayment,
|
|
3286
|
+
collectionName: 'dms',
|
|
3287
|
+
model: Home,
|
|
3968
3288
|
interceptors,
|
|
3969
3289
|
});
|
|
3970
|
-
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
|
+
};
|
|
3971
3306
|
}
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
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
|
+
};
|
|
3982
3319
|
}
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
model: UserAddress,
|
|
3992
|
-
interceptors,
|
|
3993
|
-
});
|
|
3994
|
-
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;
|
|
3995
3328
|
}
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
}
|
|
4007
|
-
|
|
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;
|
|
4008
3341
|
}
|
|
4009
3342
|
}
|
|
4010
3343
|
|
|
4011
|
-
class
|
|
3344
|
+
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4012
3345
|
constructor({ firestore, interceptors }) {
|
|
4013
3346
|
super({
|
|
4014
3347
|
firestore,
|
|
4015
|
-
collectionName: '
|
|
4016
|
-
model:
|
|
3348
|
+
collectionName: 'shopMenus',
|
|
3349
|
+
model: ShopMenu,
|
|
4017
3350
|
interceptors,
|
|
4018
3351
|
});
|
|
4019
3352
|
}
|
|
4020
|
-
async get(identifiers) {
|
|
4021
|
-
const user = await super.get({ id: identifiers.id });
|
|
4022
|
-
user.beautyProfile = await this.getBeautyProfile(user.id);
|
|
4023
|
-
user.isSubscriber = await this.checkIfIsSubscriber(user.id);
|
|
4024
|
-
return user;
|
|
4025
|
-
}
|
|
4026
|
-
async checkIfExistsByField(field, value) {
|
|
4027
|
-
const result = await this.find({ filters: { [field]: value } });
|
|
4028
|
-
return result.count > 0;
|
|
4029
|
-
}
|
|
4030
|
-
buildModelInstance() {
|
|
4031
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
4032
|
-
return {
|
|
4033
|
-
toFirestore: (data) => {
|
|
4034
|
-
const plain = toFirestore(data);
|
|
4035
|
-
delete plain.isSubscriber;
|
|
4036
|
-
return plain;
|
|
4037
|
-
},
|
|
4038
|
-
fromFirestore,
|
|
4039
|
-
};
|
|
4040
|
-
}
|
|
4041
|
-
async getBeautyProfile(userId) {
|
|
4042
|
-
const beautyProfile = await firestore.getDoc(firestore.doc(this.collection(`${this.collectionName}/${userId}/CX`).withConverter(this.buildBeautyProfileModelInstance()), 'beautyProfile'));
|
|
4043
|
-
return beautyProfile.data();
|
|
4044
|
-
}
|
|
4045
|
-
async checkIfIsSubscriber(userId) {
|
|
4046
|
-
const docs = await firestore.getDocs(firestore.query(this.collection('subscription'), firestore.where('user.id', '==', userId), firestore.where('status', '==', 'active')));
|
|
4047
|
-
return !!docs && !!docs.size;
|
|
4048
|
-
}
|
|
4049
|
-
buildBeautyProfileModelInstance() {
|
|
4050
|
-
return {
|
|
4051
|
-
toFirestore: (data) => data.toPlain(),
|
|
4052
|
-
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
4053
|
-
};
|
|
4054
|
-
}
|
|
4055
3353
|
}
|
|
4056
3354
|
|
|
4057
|
-
class
|
|
4058
|
-
constructor({ firestore, interceptors }
|
|
3355
|
+
class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3356
|
+
constructor({ firestore, interceptors, }) {
|
|
4059
3357
|
super({
|
|
4060
3358
|
firestore,
|
|
4061
|
-
collectionName: '
|
|
4062
|
-
|
|
4063
|
-
model: UserPaymentMethod,
|
|
3359
|
+
collectionName: 'shopSettings',
|
|
3360
|
+
model: ShopSettings,
|
|
4064
3361
|
interceptors,
|
|
4065
3362
|
});
|
|
4066
|
-
this.parentRepository = parentRepository;
|
|
4067
3363
|
}
|
|
4068
3364
|
}
|
|
4069
3365
|
|
|
@@ -4771,20 +4067,20 @@ class CategoryHasuraGraphQL extends Category {
|
|
|
4771
4067
|
|
|
4772
4068
|
class ProductHasuraGraphQL extends Product {
|
|
4773
4069
|
}
|
|
4774
|
-
|
|
4070
|
+
tslib.__decorate([
|
|
4775
4071
|
classTransformer.Type(() => KitProductHasuraGraphQL),
|
|
4776
|
-
|
|
4072
|
+
tslib.__metadata("design:type", Array)
|
|
4777
4073
|
], ProductHasuraGraphQL.prototype, "kitProducts", void 0);
|
|
4778
4074
|
|
|
4779
4075
|
class KitProductHasuraGraphQL extends KitProduct {
|
|
4780
4076
|
}
|
|
4781
|
-
|
|
4077
|
+
tslib.__decorate([
|
|
4782
4078
|
classTransformer.Type(() => ProductHasuraGraphQL),
|
|
4783
|
-
|
|
4079
|
+
tslib.__metadata("design:type", ProductHasuraGraphQL)
|
|
4784
4080
|
], KitProductHasuraGraphQL.prototype, "kit", void 0);
|
|
4785
|
-
|
|
4081
|
+
tslib.__decorate([
|
|
4786
4082
|
classTransformer.Type(() => ProductHasuraGraphQL),
|
|
4787
|
-
|
|
4083
|
+
tslib.__metadata("design:type", ProductHasuraGraphQL)
|
|
4788
4084
|
], KitProductHasuraGraphQL.prototype, "product", void 0);
|
|
4789
4085
|
|
|
4790
4086
|
class VariantHasuraGraphQL extends Variant {
|
|
@@ -5026,7 +4322,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5026
4322
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
5027
4323
|
}
|
|
5028
4324
|
async create(params) {
|
|
5029
|
-
const { metadata } = params, data =
|
|
4325
|
+
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
5030
4326
|
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
|
|
5031
4327
|
}
|
|
5032
4328
|
async get(identifiers) {
|
|
@@ -5036,7 +4332,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5036
4332
|
: super.get(identifiers);
|
|
5037
4333
|
}
|
|
5038
4334
|
async update(params) {
|
|
5039
|
-
const { products, id: checkId, metadata, filters } = params, data =
|
|
4335
|
+
const { products, id: checkId, metadata, filters } = params, data = tslib.__rest(params, ["products", "id", "metadata", "filters"]);
|
|
5040
4336
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
5041
4337
|
const id = await this.getId(plainData.id);
|
|
5042
4338
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: false }));
|
|
@@ -5159,18 +4455,24 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5159
4455
|
const plainData = this.paramsToPlain({ products });
|
|
5160
4456
|
if (!plainData.products || plainData.products.length <= 0)
|
|
5161
4457
|
return [];
|
|
4458
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
5162
4459
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5163
4460
|
where: {
|
|
5164
4461
|
type: 'category_product_bool_exp',
|
|
5165
4462
|
required: true,
|
|
5166
|
-
value: {
|
|
4463
|
+
value: {
|
|
4464
|
+
category_id: { _eq: categoryId },
|
|
4465
|
+
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
4466
|
+
},
|
|
5167
4467
|
},
|
|
5168
4468
|
});
|
|
5169
4469
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5170
4470
|
objects: {
|
|
5171
4471
|
type: '[category_product_insert_input!]',
|
|
5172
4472
|
required: true,
|
|
5173
|
-
value: plainData.products
|
|
4473
|
+
value: plainData.products
|
|
4474
|
+
.filter((productId) => !category.products.includes(productId))
|
|
4475
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
5174
4476
|
},
|
|
5175
4477
|
});
|
|
5176
4478
|
return plainData.products;
|
|
@@ -5208,15 +4510,14 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5208
4510
|
},
|
|
5209
4511
|
})
|
|
5210
4512
|
.then((res) => res.data);
|
|
5211
|
-
const currentFiltersId = currentFilters.map((f) => f.
|
|
4513
|
+
const currentFiltersId = currentFilters.map((f) => f.filterId);
|
|
5212
4514
|
const filtersUpdatedId = filters.value.map((f) => f.id);
|
|
5213
4515
|
const filterToBeDeleted = currentFiltersId.filter((c) => !filtersUpdatedId.includes(c));
|
|
5214
4516
|
const filterToBeInserted = filtersUpdatedId.filter((c) => !currentFiltersId.includes(c));
|
|
5215
4517
|
for (const filter of filterToBeDeleted) {
|
|
5216
4518
|
const index = currentFilters.findIndex((f) => f.id == filter);
|
|
5217
|
-
if (index != -1)
|
|
4519
|
+
if (index != -1)
|
|
5218
4520
|
currentFilters.splice(index, 1);
|
|
5219
|
-
}
|
|
5220
4521
|
await this.categoryFilterRepository.deleteByCategoryAndFilter(categoryId, filter);
|
|
5221
4522
|
}
|
|
5222
4523
|
for (const filter of filterToBeInserted) {
|
|
@@ -5288,7 +4589,7 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
5288
4589
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
5289
4590
|
}
|
|
5290
4591
|
async update(params) {
|
|
5291
|
-
const { options } = params, data =
|
|
4592
|
+
const { options } = params, data = tslib.__rest(params, ["options"]);
|
|
5292
4593
|
const filter = await super.update(data);
|
|
5293
4594
|
filter.options = await this.updateOptions(+data.id, { options });
|
|
5294
4595
|
return filter;
|
|
@@ -5565,7 +4866,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5565
4866
|
];
|
|
5566
4867
|
}
|
|
5567
4868
|
async create(params) {
|
|
5568
|
-
const { metadata } = params, data =
|
|
4869
|
+
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
5569
4870
|
const product = await super.create(lodash.omit(Object.assign(Object.assign({}, data), { metadata: metadata || { description: null, title: null } }), ['reviews']));
|
|
5570
4871
|
try {
|
|
5571
4872
|
product.reviews = data.reviews && (await this.updateReviews(+product.id, data));
|
|
@@ -5588,7 +4889,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5588
4889
|
}
|
|
5589
4890
|
async find(params) {
|
|
5590
4891
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
5591
|
-
const _o = params || {}, { filters, fields } = _o, options =
|
|
4892
|
+
const _o = params || {}, { filters, fields } = _o, options = tslib.__rest(_o, ["filters", "fields"]);
|
|
5592
4893
|
const bindFields = fields ||
|
|
5593
4894
|
this.fields
|
|
5594
4895
|
.map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
|
|
@@ -5626,7 +4927,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5626
4927
|
return product;
|
|
5627
4928
|
}
|
|
5628
4929
|
async update(params) {
|
|
5629
|
-
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"]);
|
|
5630
4931
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
5631
4932
|
const id = await this.getId(plainData.id);
|
|
5632
4933
|
const product = await super.update(Object.assign({ id }, data));
|
|
@@ -5671,11 +4972,15 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5671
4972
|
const plainData = this.paramsToPlain({ categories });
|
|
5672
4973
|
if (!plainData.categories || plainData.categories.length <= 0)
|
|
5673
4974
|
return [];
|
|
4975
|
+
const product = await this.get({ id: productId.toString() });
|
|
5674
4976
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5675
4977
|
where: {
|
|
5676
4978
|
type: 'category_product_bool_exp',
|
|
5677
4979
|
required: true,
|
|
5678
|
-
value: {
|
|
4980
|
+
value: {
|
|
4981
|
+
product_id: { _eq: productId },
|
|
4982
|
+
category_id: { _in: product.categories.filter((categoryId) => !plainData.categories.includes(categoryId)) },
|
|
4983
|
+
},
|
|
5679
4984
|
},
|
|
5680
4985
|
});
|
|
5681
4986
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
@@ -5946,11 +5251,11 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5946
5251
|
return variant;
|
|
5947
5252
|
}
|
|
5948
5253
|
async find(params) {
|
|
5949
|
-
const _a = params || {}, { filters } = _a, options =
|
|
5254
|
+
const _a = params || {}, { filters } = _a, options = tslib.__rest(_a, ["filters"]);
|
|
5950
5255
|
return super.find(Object.assign(Object.assign({}, options), { filters: Object.assign({ productId: { operator: exports.Where.ISNOTNULL } }, filters) }));
|
|
5951
5256
|
}
|
|
5952
5257
|
async update(params) {
|
|
5953
|
-
const { productId, id: checkId } = params, data =
|
|
5258
|
+
const { productId, id: checkId } = params, data = tslib.__rest(params, ["productId", "id"]);
|
|
5954
5259
|
const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
|
|
5955
5260
|
const id = await this.getId(dataWithProductId.id);
|
|
5956
5261
|
const product = await super.update(Object.assign({ id }, data));
|
|
@@ -6058,7 +5363,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6058
5363
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
6059
5364
|
}
|
|
6060
5365
|
async create(params) {
|
|
6061
|
-
const { metadata } = params, data =
|
|
5366
|
+
const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
|
|
6062
5367
|
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
|
|
6063
5368
|
}
|
|
6064
5369
|
async get(identifiers) {
|
|
@@ -6067,8 +5372,12 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6067
5372
|
throw new NotFoundError(`Category with id ${identifiers.id} is not a wishlist`);
|
|
6068
5373
|
return data;
|
|
6069
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
|
+
}
|
|
6070
5379
|
async update(params) {
|
|
6071
|
-
const { products, id: checkId, metadata, filters } = params, data =
|
|
5380
|
+
const { products, id: checkId, metadata, filters } = params, data = tslib.__rest(params, ["products", "id", "metadata", "filters"]);
|
|
6072
5381
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
6073
5382
|
const id = plainData.id;
|
|
6074
5383
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
|
|
@@ -6125,19 +5434,25 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
6125
5434
|
const plainData = this.paramsToPlain({ products });
|
|
6126
5435
|
if (!plainData.products || plainData.products.length <= 0)
|
|
6127
5436
|
return [];
|
|
5437
|
+
const category = await this.get({ id: categoryId.toString() });
|
|
5438
|
+
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
6128
5439
|
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
6129
5440
|
where: {
|
|
6130
5441
|
type: 'category_product_bool_exp',
|
|
6131
5442
|
required: true,
|
|
6132
|
-
value: {
|
|
5443
|
+
value: {
|
|
5444
|
+
category_id: { _eq: categoryId },
|
|
5445
|
+
product_id: { _in: category.products.filter((productId) => !plainData.products.includes(productId)) },
|
|
5446
|
+
},
|
|
6133
5447
|
},
|
|
6134
5448
|
});
|
|
6135
|
-
await this.categoryFilterRepository.deleteByCategory(categoryId);
|
|
6136
5449
|
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
6137
5450
|
objects: {
|
|
6138
5451
|
type: '[category_product_insert_input!]',
|
|
6139
5452
|
required: true,
|
|
6140
|
-
value: plainData.products
|
|
5453
|
+
value: plainData.products
|
|
5454
|
+
.filter((productId) => !category.products.includes(productId))
|
|
5455
|
+
.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
6141
5456
|
},
|
|
6142
5457
|
});
|
|
6143
5458
|
return plainData.products;
|
|
@@ -6236,10 +5551,6 @@ Object.defineProperty(exports, 'sub', {
|
|
|
6236
5551
|
enumerable: true,
|
|
6237
5552
|
get: function () { return dateFns.sub; }
|
|
6238
5553
|
});
|
|
6239
|
-
Object.defineProperty(exports, 'subDays', {
|
|
6240
|
-
enumerable: true,
|
|
6241
|
-
get: function () { return dateFns.subDays; }
|
|
6242
|
-
});
|
|
6243
5554
|
Object.defineProperty(exports, 'chunk', {
|
|
6244
5555
|
enumerable: true,
|
|
6245
5556
|
get: function () { return lodash.chunk; }
|
|
@@ -6309,8 +5620,6 @@ Object.defineProperty(exports, 'unset', {
|
|
|
6309
5620
|
get: function () { return lodash.unset; }
|
|
6310
5621
|
});
|
|
6311
5622
|
exports.Address = Address;
|
|
6312
|
-
exports.AdyenCardService = AdyenCardService;
|
|
6313
|
-
exports.AdyenPaymentMethodFactory = AdyenPaymentMethodFactory;
|
|
6314
5623
|
exports.Authentication = Authentication;
|
|
6315
5624
|
exports.AuthenticationFirebaseAuthService = AuthenticationFirebaseAuthService;
|
|
6316
5625
|
exports.AxiosAdapter = AxiosAdapter;
|
|
@@ -6335,7 +5644,6 @@ exports.CategoryFirestoreRepository = CategoryFirestoreRepository;
|
|
|
6335
5644
|
exports.CategoryHasuraGraphQL = CategoryHasuraGraphQL;
|
|
6336
5645
|
exports.CategoryHasuraGraphQLRepository = CategoryHasuraGraphQLRepository;
|
|
6337
5646
|
exports.Checkout = Checkout;
|
|
6338
|
-
exports.CheckoutAntiFraudService = CheckoutAntiFraudService;
|
|
6339
5647
|
exports.CheckoutFirestoreRepository = CheckoutFirestoreRepository;
|
|
6340
5648
|
exports.CheckoutSubscription = CheckoutSubscription;
|
|
6341
5649
|
exports.CheckoutSubscriptionFirestoreRepository = CheckoutSubscriptionFirestoreRepository;
|
|
@@ -6351,8 +5659,6 @@ exports.Filter = Filter;
|
|
|
6351
5659
|
exports.FilterHasuraGraphQLRepository = FilterHasuraGraphQLRepository;
|
|
6352
5660
|
exports.FilterOption = FilterOption;
|
|
6353
5661
|
exports.FilterOptionHasuraGraphQLRepository = FilterOptionHasuraGraphQLRepository;
|
|
6354
|
-
exports.GlampointsPaymentMethodFactory = GlampointsPaymentMethodFactory;
|
|
6355
|
-
exports.GlampointsPaymentService = GlampointsPaymentService;
|
|
6356
5662
|
exports.Home = Home;
|
|
6357
5663
|
exports.HomeFirestoreRepository = HomeFirestoreRepository;
|
|
6358
5664
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
@@ -6366,17 +5672,9 @@ exports.Log = Log;
|
|
|
6366
5672
|
exports.Logger = Logger;
|
|
6367
5673
|
exports.NotFoundError = NotFoundError;
|
|
6368
5674
|
exports.Order = Order;
|
|
6369
|
-
exports.OrderBlocked = OrderBlocked;
|
|
6370
|
-
exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
|
|
6371
5675
|
exports.OrderFirestoreRepository = OrderFirestoreRepository;
|
|
6372
|
-
exports.PagarmeBankSlipService = PagarmeBankSlipService;
|
|
6373
|
-
exports.PagarmeCardService = PagarmeCardService;
|
|
6374
|
-
exports.PagarmePaymentMethodFactory = PagarmePaymentMethodFactory;
|
|
6375
|
-
exports.PagarmePixService = PagarmePixService;
|
|
6376
5676
|
exports.Payment = Payment;
|
|
6377
5677
|
exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|
|
6378
|
-
exports.PaymentProviderFactory = PaymentProviderFactory;
|
|
6379
|
-
exports.PaymentTransaction = PaymentTransaction;
|
|
6380
5678
|
exports.Product = Product;
|
|
6381
5679
|
exports.ProductFirestoreRepository = ProductFirestoreRepository;
|
|
6382
5680
|
exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
|
|
@@ -6391,8 +5689,6 @@ exports.Register = Register;
|
|
|
6391
5689
|
exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
|
|
6392
5690
|
exports.RequiredArgumentError = RequiredArgumentError;
|
|
6393
5691
|
exports.RoundProductPricesHelper = RoundProductPricesHelper;
|
|
6394
|
-
exports.Sequence = Sequence;
|
|
6395
|
-
exports.SequenceFirestoreRepository = SequenceFirestoreRepository;
|
|
6396
5692
|
exports.ShippingMethod = ShippingMethod;
|
|
6397
5693
|
exports.ShopMenu = ShopMenu;
|
|
6398
5694
|
exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;
|