@infrab4a/connect 4.24.0-beta.0 → 4.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import 'reflect-metadata';
2
- import { __decorate, __metadata, __values, __spreadArray, __read, __extends, __rest } from 'tslib';
2
+ import { __values, __spreadArray, __read, __extends, __decorate, __metadata, __rest } from 'tslib';
3
3
  import { plainToInstance, instanceToPlain, Type } from 'class-transformer';
4
4
  import { parseISO, format, startOfDay, endOfDay, subDays, addDays } from 'date-fns';
5
5
  export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub, subDays } from 'date-fns';
@@ -97,1230 +97,684 @@ class PaymentProviderFactory {
97
97
  }
98
98
  }
99
99
 
100
- class BaseModel {
101
- get identifier() {
102
- const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
103
- const data = this;
104
- return fields.reduce((object, field) => (Object.assign(Object.assign({}, object), { [field]: data[field] })), {});
105
- }
106
- get identifiersFields() {
107
- return this.constructor.identifiersFields;
108
- }
109
- constructor(args) {
110
- Object.assign(this, args);
111
- }
112
- static toInstance(data) {
113
- return plainToInstance(this, data || {});
114
- }
115
- static isModel(value) {
116
- return value instanceof this;
117
- }
118
- toPlain() {
119
- return instanceToPlain(this);
120
- }
121
- }
122
-
123
- var GenderDestination;
124
- (function (GenderDestination) {
125
- GenderDestination["FEMALE"] = "female";
126
- GenderDestination["MALE"] = "male";
127
- GenderDestination["UNISEX"] = "unisex";
128
- })(GenderDestination || (GenderDestination = {}));
129
-
130
- var ProductLabelEnum;
131
- (function (ProductLabelEnum) {
132
- ProductLabelEnum["ON_SALE"] = "on-sale";
133
- ProductLabelEnum["OUTLET"] = "outlet";
134
- ProductLabelEnum["LAST_UNITS"] = "last-units";
135
- ProductLabelEnum["GLAMSTAR"] = "glamstar";
136
- })(ProductLabelEnum || (ProductLabelEnum = {}));
137
-
138
- var Shops;
139
- (function (Shops) {
140
- Shops["MENSMARKET"] = "mensmarket";
141
- Shops["GLAMSHOP"] = "Glamshop";
142
- Shops["GLAMPOINTS"] = "Glampoints";
143
- Shops["ALL"] = "ALL";
144
- })(Shops || (Shops = {}));
145
-
146
- var WishlistLogType;
147
- (function (WishlistLogType) {
148
- WishlistLogType["CREATE"] = "create";
149
- WishlistLogType["UPDATE"] = "update";
150
- WishlistLogType["DELETE"] = "delete";
151
- WishlistLogType["ADD_PRODUCT"] = "add_product";
152
- WishlistLogType["REMOVE_PRODUCT"] = "remove_product";
153
- })(WishlistLogType || (WishlistLogType = {}));
154
-
155
- class Category extends BaseModel {
156
- static get identifiersFields() {
157
- return ['id'];
158
- }
159
- get glamImages() {
160
- return this.images && this.images[Shops.GLAMSHOP]
161
- ? this.images[Shops.GLAMSHOP]
162
- : {
163
- brandBanner: null,
164
- brandBannerMobile: null,
165
- image: null,
166
- };
167
- }
168
- get mensImages() {
169
- return this.images && this.images[Shops.MENSMARKET]
170
- ? this.images[Shops.MENSMARKET]
171
- : {
172
- brandBanner: null,
173
- brandBannerMobile: null,
174
- image: null,
175
- };
176
- }
177
- get glamMetadata() {
178
- return this.metadatas.find((metadata) => metadata.shop === Shops.GLAMSHOP);
179
- }
180
- get mensMetadata() {
181
- return this.metadatas.find((metadata) => metadata.shop === Shops.MENSMARKET);
182
- }
183
- getMostRelevantByShop(shop) {
184
- return this.mostRelevants && this.mostRelevants[shop] ? this.mostRelevants[shop] : [];
185
- }
186
- }
187
- __decorate([
188
- Type(() => Category),
189
- __metadata("design:type", Category)
190
- ], Category.prototype, "parent", void 0);
191
- __decorate([
192
- Type(() => require('./product')['Product']),
193
- __metadata("design:type", Array)
194
- ], Category.prototype, "childrenProducts", void 0);
195
- __decorate([
196
- Type(() => require('./filter')['Filter']),
197
- __metadata("design:type", Array)
198
- ], Category.prototype, "filters", void 0);
199
-
200
- class CategoryCollectionChildren extends BaseModel {
201
- static get identifiersFields() {
202
- return ['collectionId', 'categoryId'];
203
- }
204
- }
205
- __decorate([
206
- Type(() => CategoryCollectionChildren),
207
- __metadata("design:type", CategoryCollectionChildren)
208
- ], CategoryCollectionChildren.prototype, "parent", void 0);
209
-
210
- class Filter extends BaseModel {
211
- static get identifiersFields() {
212
- return ['id'];
213
- }
100
+ /**
101
+ * Este arquivo define funções para resolver dependências circulares
102
+ * em ambiente ESM, onde não podemos usar require()
103
+ */
104
+ // Armazenamento global para classes registradas
105
+ const registry = new Map();
106
+ // Registrar uma classe na resolução de dependências circulares
107
+ function registerClass(name, classConstructor) {
108
+ registry.set(name, classConstructor);
214
109
  }
215
- __decorate([
216
- Type(() => Category),
217
- __metadata("design:type", Array)
218
- ], Filter.prototype, "categories", void 0);
219
-
220
- class CategoryFilter extends BaseModel {
221
- static get identifiersFields() {
222
- return ['id'];
223
- }
110
+ // Obter uma classe registrada
111
+ function getClass(name) {
112
+ return registry.get(name);
224
113
  }
225
- __decorate([
226
- Type(() => Filter),
227
- __metadata("design:type", Filter)
228
- ], CategoryFilter.prototype, "filter", void 0);
229
- __decorate([
230
- Type(() => Category),
231
- __metadata("design:type", Category)
232
- ], CategoryFilter.prototype, "category", void 0);
233
-
234
- class CategoryProduct extends BaseModel {
235
- static get identifiersFields() {
236
- return ['categoryId', 'productId'];
237
- }
238
- }
239
-
240
- class FilterOption extends BaseModel {
241
- static get identifiersFields() {
242
- return ['id'];
243
- }
114
+ // Função de resolução para class-transformer
115
+ function resolveClass(name) {
116
+ return () => {
117
+ // Forçamos o retorno de uma função que retorna a classe
118
+ // ao invés da classe diretamente para evitar problemas com o decorator
119
+ return getClass(name);
120
+ };
244
121
  }
245
122
 
246
- class KitProduct extends BaseModel {
247
- static get identifiersFields() {
248
- return ['productId', 'kitProductId'];
249
- }
250
- }
251
- __decorate([
252
- Type(() => require('./product')['Product']),
253
- __metadata("design:type", Function)
254
- ], KitProduct.prototype, "kit", void 0);
255
- __decorate([
256
- Type(() => require('./product')['Product']),
257
- __metadata("design:type", Function)
258
- ], KitProduct.prototype, "product", void 0);
259
-
260
- class ProductReview extends BaseModel {
261
- static get identifiersFields() {
262
- return ['id'];
263
- }
123
+ function isFunction(value) {
124
+ return typeof value === 'function';
264
125
  }
265
126
 
266
- class ProductBase extends BaseModel {
267
- get evaluation() {
268
- return {
269
- reviews: this.reviews,
270
- count: this.reviewsTotal,
271
- rating: this.rate,
272
- };
273
- }
274
- set evaluation(evaluation) {
275
- if (!evaluation) {
276
- this.reviews = null;
277
- this.reviewsTotal = null;
278
- this.rate = null;
279
- return;
280
- }
281
- this.reviews = evaluation.reviews || this.reviews;
282
- this.reviewsTotal = evaluation.count || this.reviewsTotal;
283
- this.rate = evaluation.rating || this.rate;
284
- }
285
- static get identifiersFields() {
286
- return ['id'];
287
- }
288
- }
289
- __decorate([
290
- Type(() => Category),
291
- __metadata("design:type", Category)
292
- ], ProductBase.prototype, "category", void 0);
293
- __decorate([
294
- Type(() => KitProduct),
295
- __metadata("design:type", Array)
296
- ], ProductBase.prototype, "kitProducts", void 0);
297
- __decorate([
298
- Type(() => ProductReview),
299
- __metadata("design:type", Array)
300
- ], ProductBase.prototype, "reviews", void 0);
301
-
302
- class Variant extends ProductBase {
303
- static get identifiersFields() {
304
- return ['id', 'productId'];
305
- }
127
+ function createErrorClass(createImpl) {
128
+ var _super = function (instance) {
129
+ Error.call(instance);
130
+ instance.stack = new Error().stack;
131
+ };
132
+ var ctorFunc = createImpl(_super);
133
+ ctorFunc.prototype = Object.create(Error.prototype);
134
+ ctorFunc.prototype.constructor = ctorFunc;
135
+ return ctorFunc;
306
136
  }
307
137
 
308
- class Product extends ProductBase {
309
- }
310
- __decorate([
311
- Type(() => Variant),
312
- __metadata("design:type", Array)
313
- ], Product.prototype, "variants", void 0);
314
-
315
- class ProductErrors extends BaseModel {
316
- static get identifiersFields() {
317
- return ['productId', 'source', 'error'];
318
- }
319
- getProductId() {
320
- return this.product.productId || this.product.id;
321
- }
322
- }
323
- __decorate([
324
- Type((type) => (+type.object.product.productId ? Variant : Product)),
325
- __metadata("design:type", Object)
326
- ], ProductErrors.prototype, "product", void 0);
327
-
328
- class ProductStockNotification extends BaseModel {
329
- static get identifiersFields() {
330
- return ['id'];
331
- }
332
- }
138
+ var UnsubscriptionError = createErrorClass(function (_super) {
139
+ return function UnsubscriptionErrorImpl(errors) {
140
+ _super(this);
141
+ this.message = errors
142
+ ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
143
+ : '';
144
+ this.name = 'UnsubscriptionError';
145
+ this.errors = errors;
146
+ };
147
+ });
333
148
 
334
- class Wishlist extends Category {
335
- static get identifiersFields() {
336
- return ['id'];
337
- }
149
+ function arrRemove(arr, item) {
150
+ if (arr) {
151
+ var index = arr.indexOf(item);
152
+ 0 <= index && arr.splice(index, 1);
153
+ }
338
154
  }
339
155
 
340
- class Buy2Win extends BaseModel {
341
- static get identifiersFields() {
342
- return ['id'];
343
- }
344
- }
345
- __decorate([
346
- Type(() => Category),
347
- __metadata("design:type", Array)
348
- ], Buy2Win.prototype, "categories", void 0);
156
+ var Subscription$1 = (function () {
157
+ function Subscription(initialTeardown) {
158
+ this.initialTeardown = initialTeardown;
159
+ this.closed = false;
160
+ this._parentage = null;
161
+ this._finalizers = null;
162
+ }
163
+ Subscription.prototype.unsubscribe = function () {
164
+ var e_1, _a, e_2, _b;
165
+ var errors;
166
+ if (!this.closed) {
167
+ this.closed = true;
168
+ var _parentage = this._parentage;
169
+ if (_parentage) {
170
+ this._parentage = null;
171
+ if (Array.isArray(_parentage)) {
172
+ try {
173
+ for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
174
+ var parent_1 = _parentage_1_1.value;
175
+ parent_1.remove(this);
176
+ }
177
+ }
178
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
179
+ finally {
180
+ try {
181
+ if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
182
+ }
183
+ finally { if (e_1) throw e_1.error; }
184
+ }
185
+ }
186
+ else {
187
+ _parentage.remove(this);
188
+ }
189
+ }
190
+ var initialFinalizer = this.initialTeardown;
191
+ if (isFunction(initialFinalizer)) {
192
+ try {
193
+ initialFinalizer();
194
+ }
195
+ catch (e) {
196
+ errors = e instanceof UnsubscriptionError ? e.errors : [e];
197
+ }
198
+ }
199
+ var _finalizers = this._finalizers;
200
+ if (_finalizers) {
201
+ this._finalizers = null;
202
+ try {
203
+ for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
204
+ var finalizer = _finalizers_1_1.value;
205
+ try {
206
+ execFinalizer(finalizer);
207
+ }
208
+ catch (err) {
209
+ errors = errors !== null && errors !== void 0 ? errors : [];
210
+ if (err instanceof UnsubscriptionError) {
211
+ errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
212
+ }
213
+ else {
214
+ errors.push(err);
215
+ }
216
+ }
217
+ }
218
+ }
219
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
220
+ finally {
221
+ try {
222
+ if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
223
+ }
224
+ finally { if (e_2) throw e_2.error; }
225
+ }
226
+ }
227
+ if (errors) {
228
+ throw new UnsubscriptionError(errors);
229
+ }
230
+ }
231
+ };
232
+ Subscription.prototype.add = function (teardown) {
233
+ var _a;
234
+ if (teardown && teardown !== this) {
235
+ if (this.closed) {
236
+ execFinalizer(teardown);
237
+ }
238
+ else {
239
+ if (teardown instanceof Subscription) {
240
+ if (teardown.closed || teardown._hasParent(this)) {
241
+ return;
242
+ }
243
+ teardown._addParent(this);
244
+ }
245
+ (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
246
+ }
247
+ }
248
+ };
249
+ Subscription.prototype._hasParent = function (parent) {
250
+ var _parentage = this._parentage;
251
+ return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
252
+ };
253
+ Subscription.prototype._addParent = function (parent) {
254
+ var _parentage = this._parentage;
255
+ this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
256
+ };
257
+ Subscription.prototype._removeParent = function (parent) {
258
+ var _parentage = this._parentage;
259
+ if (_parentage === parent) {
260
+ this._parentage = null;
261
+ }
262
+ else if (Array.isArray(_parentage)) {
263
+ arrRemove(_parentage, parent);
264
+ }
265
+ };
266
+ Subscription.prototype.remove = function (teardown) {
267
+ var _finalizers = this._finalizers;
268
+ _finalizers && arrRemove(_finalizers, teardown);
269
+ if (teardown instanceof Subscription) {
270
+ teardown._removeParent(this);
271
+ }
272
+ };
273
+ Subscription.EMPTY = (function () {
274
+ var empty = new Subscription();
275
+ empty.closed = true;
276
+ return empty;
277
+ })();
278
+ return Subscription;
279
+ }());
280
+ var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
281
+ function isSubscription(value) {
282
+ return (value instanceof Subscription$1 ||
283
+ (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
284
+ }
285
+ function execFinalizer(finalizer) {
286
+ if (isFunction(finalizer)) {
287
+ finalizer();
288
+ }
289
+ else {
290
+ finalizer.unsubscribe();
291
+ }
292
+ }
349
293
 
350
- var Where;
351
- (function (Where) {
352
- Where["EQUALS"] = "==";
353
- Where["NOTEQUALS"] = "!=";
354
- Where["GT"] = ">";
355
- Where["GTE"] = ">=";
356
- Where["IN"] = "in";
357
- Where["NOTIN"] = "not in";
358
- Where["LT"] = "<";
359
- Where["LTE"] = "<=";
360
- Where["LIKE"] = "like";
361
- Where["NOTLIKE"] = "not like";
362
- Where["ISNULL"] = "is null";
363
- Where["ISNOTNULL"] = "is not null";
364
- Where["IREGEX"] = "iregex";
365
- })(Where || (Where = {}));
294
+ var config = {
295
+ onUnhandledError: null,
296
+ onStoppedNotification: null,
297
+ Promise: undefined,
298
+ useDeprecatedSynchronousErrorHandling: false,
299
+ useDeprecatedNextContext: false,
300
+ };
366
301
 
367
- var UpdateOptionActions;
368
- (function (UpdateOptionActions) {
369
- UpdateOptionActions["UPDATE"] = "update";
370
- UpdateOptionActions["MERGE"] = "merge";
371
- UpdateOptionActions["REMOVE"] = "remove";
372
- UpdateOptionActions["REMOVE_FIELD"] = "removeField";
373
- UpdateOptionActions["NULL"] = "null";
374
- })(UpdateOptionActions || (UpdateOptionActions = {}));
302
+ var timeoutProvider = {
303
+ setTimeout: function (handler, timeout) {
304
+ var args = [];
305
+ for (var _i = 2; _i < arguments.length; _i++) {
306
+ args[_i - 2] = arguments[_i];
307
+ }
308
+ var delegate = timeoutProvider.delegate;
309
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
310
+ return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
311
+ }
312
+ return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
313
+ },
314
+ clearTimeout: function (handle) {
315
+ var delegate = timeoutProvider.delegate;
316
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
317
+ },
318
+ delegate: undefined,
319
+ };
375
320
 
376
- class CampaignDashboard extends BaseModel {
377
- static get identifiersFields() {
378
- return ['id'];
379
- }
321
+ function reportUnhandledError(err) {
322
+ timeoutProvider.setTimeout(function () {
323
+ {
324
+ throw err;
325
+ }
326
+ });
380
327
  }
381
328
 
382
- class CampaignHashtag extends BaseModel {
383
- static get identifiersFields() {
384
- return ['id'];
385
- }
386
- }
329
+ function noop() { }
387
330
 
388
- class BeautyProfile extends BaseModel {
389
- toPlain() {
390
- const plain = super.toPlain();
391
- delete plain.id;
392
- return plain;
393
- }
394
- static get identifiersFields() {
395
- return ['id', 'userId'];
396
- }
331
+ var context = null;
332
+ function errorContext(cb) {
333
+ if (config.useDeprecatedSynchronousErrorHandling) {
334
+ var isRoot = !context;
335
+ if (isRoot) {
336
+ context = { errorThrown: false, error: null };
337
+ }
338
+ cb();
339
+ if (isRoot) {
340
+ var _a = context, errorThrown = _a.errorThrown, error = _a.error;
341
+ context = null;
342
+ if (errorThrown) {
343
+ throw error;
344
+ }
345
+ }
346
+ }
347
+ else {
348
+ cb();
349
+ }
397
350
  }
398
351
 
399
- var AccessoryImportances;
400
- (function (AccessoryImportances) {
401
- AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
402
- AccessoryImportances["LIKE_RARELY_USE"] = "Gosto, mas uso poucos";
403
- AccessoryImportances["LIKE_ALWAYS_FOLLOW_FASHION"] = "Gosto muito de acess\u00F3rios e sempre procuro acompanhar a moda";
404
- })(AccessoryImportances || (AccessoryImportances = {}));
405
-
406
- var Area;
407
- (function (Area) {
408
- Area["GP"] = "Geral";
409
- Area["CRM"] = "CRM";
410
- Area["MediaProd"] = "Media Production";
411
- Area["Tech"] = "Tecnologia";
412
- Area["Transactional"] = "Transacional";
413
- Area["Operations"] = "Opera\u00E7\u00F5es";
414
- Area["Sales"] = "Comercial";
415
- Area["Finantial"] = "Financeiro";
416
- Area["HR"] = "RH";
417
- })(Area || (Area = {}));
418
-
419
- var BeardProblems;
420
- (function (BeardProblems) {
421
- BeardProblems["NO_PROBLEMS"] = "Sem problemas";
422
- BeardProblems["DRY"] = "Barba Seca";
423
- BeardProblems["OILY"] = "Barba Oleaosa";
424
- BeardProblems["DANCRUFF"] = "Barba com Caspa";
425
- BeardProblems["INGROWN_HAIRS"] = "P\u00EAlos Encravados";
426
- BeardProblems["DOESNT_GROW"] = "N\u00E3o Cresce";
427
- BeardProblems["SPARSE_BEARD"] = "Barba Rala";
428
- })(BeardProblems || (BeardProblems = {}));
429
-
430
- var BeardSizes;
431
- (function (BeardSizes) {
432
- BeardSizes["BIG"] = "Grande";
433
- BeardSizes["MEDIUM"] = "M\u00E9dia";
434
- BeardSizes["SHORT"] = "Curta";
435
- BeardSizes["MUSTACHE"] = "Bigode";
436
- BeardSizes["NOTHING"] = "Sem Barba";
437
- })(BeardSizes || (BeardSizes = {}));
438
-
439
- var BeautyProductImportances;
440
- (function (BeautyProductImportances) {
441
- BeautyProductImportances["KNOW_LITTLE_ABOUT"] = "Conhe\u00E7o bem pouco de produtos de beleza e rotinas de cuidados";
442
- BeautyProductImportances["ALREADY_BOUGHT_NOTHING_SPECIALIZED"] = "J\u00E1 comprei alguns produtos b\u00E1sicos para cuidar de mim, mas nada muito especializado";
443
- BeautyProductImportances["GOOD_CARE_MYSELF"] = "Me considero um homem que se cuida bem. Conhe\u00E7o sobre produtos especializados e me preocupo em ter uma rotina de cuidados";
444
- BeautyProductImportances["PERSONAL_CARE_EXPERT"] = "Sou um expert em cuidados pessoais";
445
- })(BeautyProductImportances || (BeautyProductImportances = {}));
446
-
447
- var BodyProblems;
448
- (function (BodyProblems) {
449
- BodyProblems["NO_WORRIES"] = "Sem preocupa\u00E7\u00F5es";
450
- BodyProblems["FLACCIDITY"] = "Flacidez";
451
- BodyProblems["LOCALIZED_FAT"] = "Gordura Localizada";
452
- BodyProblems["STRETCH_MARKS"] = "Estrias";
453
- BodyProblems["SENSITIVE_SKIN"] = "Pele Sens\u00EDvel";
454
- BodyProblems["DRY_SKIN"] = "Pele Seca";
455
- BodyProblems["OILY_ACNE"] = "Oleosa/Acne";
456
- BodyProblems["SKIN_FRECKLES"] = "Pele com Sardas";
457
- BodyProblems["PHOTOSENSITIVE_SKIN"] = "Pele Fotossens\u00EDvel";
458
- })(BodyProblems || (BodyProblems = {}));
459
-
460
- var BodyShapes;
461
- (function (BodyShapes) {
462
- BodyShapes["LEAN"] = "Magro";
463
- BodyShapes["REGULAR"] = "Regular";
464
- BodyShapes["OVERWEIGHT"] = "Acima do Peso";
465
- BodyShapes["ATHLETIC"] = "Atl\u00E9tico";
466
- BodyShapes["MUSCULAR"] = "Musculoso";
467
- })(BodyShapes || (BodyShapes = {}));
468
-
469
- var BodyTattoos;
470
- (function (BodyTattoos) {
471
- BodyTattoos["NONE"] = "Nenhuma";
472
- BodyTattoos["HAS_DOESNT_CARE"] = "Tenho mas n\u00E3o cuido";
473
- BodyTattoos["HAS_CARE_LOT"] = "Tenho e cuido bastante";
474
- })(BodyTattoos || (BodyTattoos = {}));
352
+ var Subscriber = (function (_super) {
353
+ __extends(Subscriber, _super);
354
+ function Subscriber(destination) {
355
+ var _this = _super.call(this) || this;
356
+ _this.isStopped = false;
357
+ if (destination) {
358
+ _this.destination = destination;
359
+ if (isSubscription(destination)) {
360
+ destination.add(_this);
361
+ }
362
+ }
363
+ else {
364
+ _this.destination = EMPTY_OBSERVER;
365
+ }
366
+ return _this;
367
+ }
368
+ Subscriber.create = function (next, error, complete) {
369
+ return new SafeSubscriber(next, error, complete);
370
+ };
371
+ Subscriber.prototype.next = function (value) {
372
+ if (this.isStopped) ;
373
+ else {
374
+ this._next(value);
375
+ }
376
+ };
377
+ Subscriber.prototype.error = function (err) {
378
+ if (this.isStopped) ;
379
+ else {
380
+ this.isStopped = true;
381
+ this._error(err);
382
+ }
383
+ };
384
+ Subscriber.prototype.complete = function () {
385
+ if (this.isStopped) ;
386
+ else {
387
+ this.isStopped = true;
388
+ this._complete();
389
+ }
390
+ };
391
+ Subscriber.prototype.unsubscribe = function () {
392
+ if (!this.closed) {
393
+ this.isStopped = true;
394
+ _super.prototype.unsubscribe.call(this);
395
+ this.destination = null;
396
+ }
397
+ };
398
+ Subscriber.prototype._next = function (value) {
399
+ this.destination.next(value);
400
+ };
401
+ Subscriber.prototype._error = function (err) {
402
+ try {
403
+ this.destination.error(err);
404
+ }
405
+ finally {
406
+ this.unsubscribe();
407
+ }
408
+ };
409
+ Subscriber.prototype._complete = function () {
410
+ try {
411
+ this.destination.complete();
412
+ }
413
+ finally {
414
+ this.unsubscribe();
415
+ }
416
+ };
417
+ return Subscriber;
418
+ }(Subscription$1));
419
+ var _bind = Function.prototype.bind;
420
+ function bind(fn, thisArg) {
421
+ return _bind.call(fn, thisArg);
422
+ }
423
+ var ConsumerObserver = (function () {
424
+ function ConsumerObserver(partialObserver) {
425
+ this.partialObserver = partialObserver;
426
+ }
427
+ ConsumerObserver.prototype.next = function (value) {
428
+ var partialObserver = this.partialObserver;
429
+ if (partialObserver.next) {
430
+ try {
431
+ partialObserver.next(value);
432
+ }
433
+ catch (error) {
434
+ handleUnhandledError(error);
435
+ }
436
+ }
437
+ };
438
+ ConsumerObserver.prototype.error = function (err) {
439
+ var partialObserver = this.partialObserver;
440
+ if (partialObserver.error) {
441
+ try {
442
+ partialObserver.error(err);
443
+ }
444
+ catch (error) {
445
+ handleUnhandledError(error);
446
+ }
447
+ }
448
+ else {
449
+ handleUnhandledError(err);
450
+ }
451
+ };
452
+ ConsumerObserver.prototype.complete = function () {
453
+ var partialObserver = this.partialObserver;
454
+ if (partialObserver.complete) {
455
+ try {
456
+ partialObserver.complete();
457
+ }
458
+ catch (error) {
459
+ handleUnhandledError(error);
460
+ }
461
+ }
462
+ };
463
+ return ConsumerObserver;
464
+ }());
465
+ var SafeSubscriber = (function (_super) {
466
+ __extends(SafeSubscriber, _super);
467
+ function SafeSubscriber(observerOrNext, error, complete) {
468
+ var _this = _super.call(this) || this;
469
+ var partialObserver;
470
+ if (isFunction(observerOrNext) || !observerOrNext) {
471
+ partialObserver = {
472
+ next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
473
+ error: error !== null && error !== void 0 ? error : undefined,
474
+ complete: complete !== null && complete !== void 0 ? complete : undefined,
475
+ };
476
+ }
477
+ else {
478
+ var context_1;
479
+ if (_this && config.useDeprecatedNextContext) {
480
+ context_1 = Object.create(observerOrNext);
481
+ context_1.unsubscribe = function () { return _this.unsubscribe(); };
482
+ partialObserver = {
483
+ next: observerOrNext.next && bind(observerOrNext.next, context_1),
484
+ error: observerOrNext.error && bind(observerOrNext.error, context_1),
485
+ complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
486
+ };
487
+ }
488
+ else {
489
+ partialObserver = observerOrNext;
490
+ }
491
+ }
492
+ _this.destination = new ConsumerObserver(partialObserver);
493
+ return _this;
494
+ }
495
+ return SafeSubscriber;
496
+ }(Subscriber));
497
+ function handleUnhandledError(error) {
498
+ {
499
+ reportUnhandledError(error);
500
+ }
501
+ }
502
+ function defaultErrorHandler(err) {
503
+ throw err;
504
+ }
505
+ var EMPTY_OBSERVER = {
506
+ closed: true,
507
+ next: noop,
508
+ error: defaultErrorHandler,
509
+ complete: noop,
510
+ };
475
511
 
476
- var FaceSkinOilinesses;
477
- (function (FaceSkinOilinesses) {
478
- FaceSkinOilinesses["DRY"] = "Seca";
479
- FaceSkinOilinesses["OILY"] = "Oleaosa";
480
- FaceSkinOilinesses["MIXED"] = "Mista";
481
- FaceSkinOilinesses["NORMAL"] = "Normal";
482
- FaceSkinOilinesses["DONT_KNOW"] = "Eu n\u00E3o sei como dizer";
483
- })(FaceSkinOilinesses || (FaceSkinOilinesses = {}));
512
+ var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
484
513
 
485
- var FaceSkinProblems;
486
- (function (FaceSkinProblems) {
487
- FaceSkinProblems["NO_PROBLEMS"] = "Sem problemas";
488
- FaceSkinProblems["DARK_CIRCLES"] = "Olheiras";
489
- FaceSkinProblems["WRINKLES"] = "Rugas";
490
- FaceSkinProblems["BLACKHEADS_PIMPLES"] = "Cravos e Espinhas";
491
- FaceSkinProblems["STAINS"] = "Manchas";
492
- FaceSkinProblems["FRECKLES"] = "Sardas";
493
- FaceSkinProblems["SENSITIVE"] = "Sens\u00EDvel";
494
- FaceSkinProblems["PHOTOSENSITIVE"] = "Fotossens\u00EDvel";
495
- })(FaceSkinProblems || (FaceSkinProblems = {}));
514
+ function identity(x) {
515
+ return x;
516
+ }
496
517
 
497
- var FaceSkinTones;
498
- (function (FaceSkinTones) {
499
- FaceSkinTones["VERY_CLEAR"] = "Muito Clara";
500
- FaceSkinTones["CLEAR"] = "Clara";
501
- FaceSkinTones["MEDIUM_LIGHT"] = "Clara M\u00E9dia";
502
- FaceSkinTones["MEDIUM_DARK"] = "Escura M\u00E9dia";
503
- FaceSkinTones["DARK"] = "Escura";
504
- FaceSkinTones["VERY_DARK"] = "Muito Escura";
505
- })(FaceSkinTones || (FaceSkinTones = {}));
518
+ function pipeFromArray(fns) {
519
+ if (fns.length === 0) {
520
+ return identity;
521
+ }
522
+ if (fns.length === 1) {
523
+ return fns[0];
524
+ }
525
+ return function piped(input) {
526
+ return fns.reduce(function (prev, fn) { return fn(prev); }, input);
527
+ };
528
+ }
506
529
 
507
- var FamilyIncomes;
508
- (function (FamilyIncomes) {
509
- FamilyIncomes["UNTIL_3000"] = "At\u00E9 R$3.000";
510
- FamilyIncomes["SINCE_3001_TO_7000"] = "De R$3.001 a R$7.000";
511
- FamilyIncomes["SINCE_7001_TO_10000"] = "De R$7.001 a R$10.000";
512
- FamilyIncomes["SINCE_10001_TO_15000"] = "De R$10.001 a R$15.000";
513
- FamilyIncomes["GRAN_THAN_15000"] = "Mais de R$15.000";
514
- FamilyIncomes["NOW_ANSWER"] = "Prefiro nao responder";
515
- })(FamilyIncomes || (FamilyIncomes = {}));
516
-
517
- var FragranceImportances;
518
- (function (FragranceImportances) {
519
- FragranceImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
520
- FragranceImportances["LIKE_ALWAYS_USE_SAME"] = "Gosto de perfumes, mas uso sempre os mesmos";
521
- FragranceImportances["LIKE_INNOVATE"] = "Gosto de inovar e conhecer novas fragr\u00E2ncias";
522
- })(FragranceImportances || (FragranceImportances = {}));
523
-
524
- var HairColors;
525
- (function (HairColors) {
526
- HairColors["BLACK"] = "Preto";
527
- HairColors["DARK_BROWN"] = "Castanho Escuro";
528
- HairColors["LIGHT_BROWN"] = "Castanho Claro";
529
- HairColors["DARK_BLONDE"] = "Loiro Escuro";
530
- HairColors["LIGHT_BLONDE"] = "Loiro Claro";
531
- HairColors["WHITE_GRAY"] = "Branco/Grisalho";
532
- HairColors["REDHEAD"] = "Ruivo";
533
- HairColors["OTHER"] = "RuiOutroo";
534
- })(HairColors || (HairColors = {}));
535
-
536
- var HairProblems;
537
- (function (HairProblems) {
538
- HairProblems["NO_PROBLEMS"] = "Sem problemas";
539
- HairProblems["DANCRUFF"] = "Caspa";
540
- HairProblems["LOSS"] = "Queda";
541
- HairProblems["OILY"] = "Oleosidade";
542
- HairProblems["DRYNESS"] = "Ressecamento";
543
- HairProblems["CHEMICAL"] = "Quimica";
544
- HairProblems["WHITE_HAIR"] = "Cabelos Brancos";
545
- HairProblems["REBEL_WIRES"] = "Fios Rebeldes";
546
- })(HairProblems || (HairProblems = {}));
547
-
548
- var HairStrands;
549
- (function (HairStrands) {
550
- HairStrands["NORMAL"] = "Fio Normal";
551
- HairStrands["DRY"] = "Fio Seco";
552
- HairStrands["OILY"] = "Fio Oleoso";
553
- HairStrands["MIXED"] = "Fio Misto";
554
- HairStrands["FINE"] = "Fio Fino";
555
- HairStrands["THICK"] = "Fio Grosso";
556
- })(HairStrands || (HairStrands = {}));
557
-
558
- var HairTypes;
559
- (function (HairTypes) {
560
- HairTypes["Smooth"] = "Liso";
561
- HairTypes["WAVY"] = "Ondulado";
562
- HairTypes["CURLY"] = "Cacheado";
563
- HairTypes["FRIZZY"] = "Crespo";
564
- HairTypes["BALD"] = "Sou careca";
565
- })(HairTypes || (HairTypes = {}));
566
-
567
- var OfficePosition;
568
- (function (OfficePosition) {
569
- OfficePosition["Intern"] = "Estagi\u00E1rio";
570
- OfficePosition["Analyst"] = "Analista";
571
- OfficePosition["Manager"] = "Gerente";
572
- OfficePosition["Director"] = "Diretor";
573
- })(OfficePosition || (OfficePosition = {}));
574
-
575
- var PersonTypes;
576
- (function (PersonTypes) {
577
- PersonTypes["GLAMGIRL"] = "glamgirl";
578
- PersonTypes["BFLU"] = "bflu";
579
- PersonTypes["NONE"] = "none";
580
- })(PersonTypes || (PersonTypes = {}));
581
-
582
- var ProductSpents;
583
- (function (ProductSpents) {
584
- ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
585
- ProductSpents["SINCE_51_TO_100"] = "De R$51 a R$100";
586
- ProductSpents["SINCE_101_TO_200"] = "De R$101 a R$200";
587
- ProductSpents["SINCE_201_TO_300"] = "De R$201 a R$300";
588
- ProductSpents["GRAN_THAN_300"] = "Mais de R$300";
589
- ProductSpents["NOW_ANSWER"] = "Prefiro nao responder";
590
- })(ProductSpents || (ProductSpents = {}));
591
-
592
- var UserType;
593
- (function (UserType) {
594
- UserType["B2C"] = "Cliente Transacional";
595
- UserType["GlamGirl"] = "Glamgirl";
596
- UserType["MensBoy"] = "Mensboy";
597
- UserType["B2B"] = "Company";
598
- UserType["Collaborator"] = "Funcion\u00E1rio";
599
- UserType["Influencer"] = "Influencer";
600
- })(UserType || (UserType = {}));
601
-
602
- class Lead extends BaseModel {
603
- static get identifiersFields() {
604
- return ['id'];
605
- }
530
+ var Observable = (function () {
531
+ function Observable(subscribe) {
532
+ if (subscribe) {
533
+ this._subscribe = subscribe;
534
+ }
535
+ }
536
+ Observable.prototype.lift = function (operator) {
537
+ var observable = new Observable();
538
+ observable.source = this;
539
+ observable.operator = operator;
540
+ return observable;
541
+ };
542
+ Observable.prototype.subscribe = function (observerOrNext, error, complete) {
543
+ var _this = this;
544
+ var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
545
+ errorContext(function () {
546
+ var _a = _this, operator = _a.operator, source = _a.source;
547
+ subscriber.add(operator
548
+ ?
549
+ operator.call(subscriber, source)
550
+ : source
551
+ ?
552
+ _this._subscribe(subscriber)
553
+ :
554
+ _this._trySubscribe(subscriber));
555
+ });
556
+ return subscriber;
557
+ };
558
+ Observable.prototype._trySubscribe = function (sink) {
559
+ try {
560
+ return this._subscribe(sink);
561
+ }
562
+ catch (err) {
563
+ sink.error(err);
564
+ }
565
+ };
566
+ Observable.prototype.forEach = function (next, promiseCtor) {
567
+ var _this = this;
568
+ promiseCtor = getPromiseCtor(promiseCtor);
569
+ return new promiseCtor(function (resolve, reject) {
570
+ var subscriber = new SafeSubscriber({
571
+ next: function (value) {
572
+ try {
573
+ next(value);
574
+ }
575
+ catch (err) {
576
+ reject(err);
577
+ subscriber.unsubscribe();
578
+ }
579
+ },
580
+ error: reject,
581
+ complete: resolve,
582
+ });
583
+ _this.subscribe(subscriber);
584
+ });
585
+ };
586
+ Observable.prototype._subscribe = function (subscriber) {
587
+ var _a;
588
+ return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
589
+ };
590
+ Observable.prototype[observable] = function () {
591
+ return this;
592
+ };
593
+ Observable.prototype.pipe = function () {
594
+ var operations = [];
595
+ for (var _i = 0; _i < arguments.length; _i++) {
596
+ operations[_i] = arguments[_i];
597
+ }
598
+ return pipeFromArray(operations)(this);
599
+ };
600
+ Observable.prototype.toPromise = function (promiseCtor) {
601
+ var _this = this;
602
+ promiseCtor = getPromiseCtor(promiseCtor);
603
+ return new promiseCtor(function (resolve, reject) {
604
+ var value;
605
+ _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
606
+ });
607
+ };
608
+ Observable.create = function (subscribe) {
609
+ return new Observable(subscribe);
610
+ };
611
+ return Observable;
612
+ }());
613
+ function getPromiseCtor(promiseCtor) {
614
+ var _a;
615
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
606
616
  }
607
-
608
- class Edition extends BaseModel {
609
- static get identifiersFields() {
610
- return ['id', 'subscriptionId'];
611
- }
617
+ function isObserver(value) {
618
+ return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
612
619
  }
613
-
614
- var BillingStatus;
615
- (function (BillingStatus) {
616
- BillingStatus["PAYED"] = "PAGO";
617
- })(BillingStatus || (BillingStatus = {}));
618
-
619
- var EditionStatus;
620
- (function (EditionStatus) {
621
- EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
622
- EditionStatus["SHIPPED"] = "Enviado";
623
- })(EditionStatus || (EditionStatus = {}));
624
-
625
- var PaymentType;
626
- (function (PaymentType) {
627
- PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
628
- PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
629
- PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
630
- })(PaymentType || (PaymentType = {}));
631
-
632
- var Plans;
633
- (function (Plans) {
634
- Plans["SELECT"] = "SELECT";
635
- Plans["PRIME"] = "PRIME";
636
- Plans["SELECT_MENSAL"] = "SELECT_MENSAL";
637
- Plans["PRIME_MENSAL"] = "PRIME_MENSAL";
638
- })(Plans || (Plans = {}));
639
-
640
- var Status;
641
- (function (Status) {
642
- Status["ACTIVE"] = "active";
643
- Status["CANCELLED"] = "Cancelado";
644
- })(Status || (Status = {}));
645
-
646
- class PaymentTransaction extends BaseModel {
620
+ function isSubscriber(value) {
621
+ return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
647
622
  }
648
623
 
649
- class Payment extends BaseModel {
650
- static get identifiersFields() {
651
- return ['id'];
652
- }
653
- }
654
- __decorate([
655
- Type(() => PaymentTransaction),
656
- __metadata("design:type", PaymentTransaction)
657
- ], Payment.prototype, "transaction", void 0);
658
-
659
- class SubscriptionPayment extends BaseModel {
660
- static get identifiersFields() {
661
- return ['id', 'subscriptionId'];
662
- }
663
- }
664
- __decorate([
665
- Type(() => Payment),
666
- __metadata("design:type", Payment)
667
- ], SubscriptionPayment.prototype, "payment", void 0);
668
-
669
- function isFunction(value) {
670
- return typeof value === 'function';
671
- }
624
+ var ObjectUnsubscribedError = createErrorClass(function (_super) {
625
+ return function ObjectUnsubscribedErrorImpl() {
626
+ _super(this);
627
+ this.name = 'ObjectUnsubscribedError';
628
+ this.message = 'object unsubscribed';
629
+ };
630
+ });
672
631
 
673
- function createErrorClass(createImpl) {
674
- var _super = function (instance) {
675
- Error.call(instance);
676
- instance.stack = new Error().stack;
632
+ var Subject = (function (_super) {
633
+ __extends(Subject, _super);
634
+ function Subject() {
635
+ var _this = _super.call(this) || this;
636
+ _this.closed = false;
637
+ _this.currentObservers = null;
638
+ _this.observers = [];
639
+ _this.isStopped = false;
640
+ _this.hasError = false;
641
+ _this.thrownError = null;
642
+ return _this;
643
+ }
644
+ Subject.prototype.lift = function (operator) {
645
+ var subject = new AnonymousSubject(this, this);
646
+ subject.operator = operator;
647
+ return subject;
677
648
  };
678
- var ctorFunc = createImpl(_super);
679
- ctorFunc.prototype = Object.create(Error.prototype);
680
- ctorFunc.prototype.constructor = ctorFunc;
681
- return ctorFunc;
682
- }
683
-
684
- var UnsubscriptionError = createErrorClass(function (_super) {
685
- return function UnsubscriptionErrorImpl(errors) {
686
- _super(this);
687
- this.message = errors
688
- ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
689
- : '';
690
- this.name = 'UnsubscriptionError';
691
- this.errors = errors;
649
+ Subject.prototype._throwIfClosed = function () {
650
+ if (this.closed) {
651
+ throw new ObjectUnsubscribedError();
652
+ }
692
653
  };
693
- });
694
-
695
- function arrRemove(arr, item) {
696
- if (arr) {
697
- var index = arr.indexOf(item);
698
- 0 <= index && arr.splice(index, 1);
699
- }
700
- }
701
-
702
- var Subscription$1 = (function () {
703
- function Subscription(initialTeardown) {
704
- this.initialTeardown = initialTeardown;
705
- this.closed = false;
706
- this._parentage = null;
707
- this._finalizers = null;
708
- }
709
- Subscription.prototype.unsubscribe = function () {
710
- var e_1, _a, e_2, _b;
711
- var errors;
712
- if (!this.closed) {
713
- this.closed = true;
714
- var _parentage = this._parentage;
715
- if (_parentage) {
716
- this._parentage = null;
717
- if (Array.isArray(_parentage)) {
718
- try {
719
- for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
720
- var parent_1 = _parentage_1_1.value;
721
- parent_1.remove(this);
722
- }
723
- }
724
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
725
- finally {
726
- try {
727
- if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
728
- }
729
- finally { if (e_1) throw e_1.error; }
730
- }
731
- }
732
- else {
733
- _parentage.remove(this);
734
- }
735
- }
736
- var initialFinalizer = this.initialTeardown;
737
- if (isFunction(initialFinalizer)) {
738
- try {
739
- initialFinalizer();
740
- }
741
- catch (e) {
742
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
654
+ Subject.prototype.next = function (value) {
655
+ var _this = this;
656
+ errorContext(function () {
657
+ var e_1, _a;
658
+ _this._throwIfClosed();
659
+ if (!_this.isStopped) {
660
+ if (!_this.currentObservers) {
661
+ _this.currentObservers = Array.from(_this.observers);
743
662
  }
744
- }
745
- var _finalizers = this._finalizers;
746
- if (_finalizers) {
747
- this._finalizers = null;
748
663
  try {
749
- for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
750
- var finalizer = _finalizers_1_1.value;
751
- try {
752
- execFinalizer(finalizer);
753
- }
754
- catch (err) {
755
- errors = errors !== null && errors !== void 0 ? errors : [];
756
- if (err instanceof UnsubscriptionError) {
757
- errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
758
- }
759
- else {
760
- errors.push(err);
761
- }
762
- }
664
+ for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
665
+ var observer = _c.value;
666
+ observer.next(value);
763
667
  }
764
668
  }
765
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
669
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
766
670
  finally {
767
671
  try {
768
- if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
672
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
769
673
  }
770
- finally { if (e_2) throw e_2.error; }
674
+ finally { if (e_1) throw e_1.error; }
771
675
  }
772
676
  }
773
- if (errors) {
774
- throw new UnsubscriptionError(errors);
775
- }
776
- }
677
+ });
777
678
  };
778
- Subscription.prototype.add = function (teardown) {
779
- var _a;
780
- if (teardown && teardown !== this) {
781
- if (this.closed) {
782
- execFinalizer(teardown);
679
+ Subject.prototype.error = function (err) {
680
+ var _this = this;
681
+ errorContext(function () {
682
+ _this._throwIfClosed();
683
+ if (!_this.isStopped) {
684
+ _this.hasError = _this.isStopped = true;
685
+ _this.thrownError = err;
686
+ var observers = _this.observers;
687
+ while (observers.length) {
688
+ observers.shift().error(err);
689
+ }
783
690
  }
784
- else {
785
- if (teardown instanceof Subscription) {
786
- if (teardown.closed || teardown._hasParent(this)) {
787
- return;
788
- }
789
- teardown._addParent(this);
691
+ });
692
+ };
693
+ Subject.prototype.complete = function () {
694
+ var _this = this;
695
+ errorContext(function () {
696
+ _this._throwIfClosed();
697
+ if (!_this.isStopped) {
698
+ _this.isStopped = true;
699
+ var observers = _this.observers;
700
+ while (observers.length) {
701
+ observers.shift().complete();
790
702
  }
791
- (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
792
703
  }
793
- }
704
+ });
794
705
  };
795
- Subscription.prototype._hasParent = function (parent) {
796
- var _parentage = this._parentage;
797
- return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
706
+ Subject.prototype.unsubscribe = function () {
707
+ this.isStopped = this.closed = true;
708
+ this.observers = this.currentObservers = null;
798
709
  };
799
- Subscription.prototype._addParent = function (parent) {
800
- var _parentage = this._parentage;
801
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
710
+ Object.defineProperty(Subject.prototype, "observed", {
711
+ get: function () {
712
+ var _a;
713
+ return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
714
+ },
715
+ enumerable: false,
716
+ configurable: true
717
+ });
718
+ Subject.prototype._trySubscribe = function (subscriber) {
719
+ this._throwIfClosed();
720
+ return _super.prototype._trySubscribe.call(this, subscriber);
802
721
  };
803
- Subscription.prototype._removeParent = function (parent) {
804
- var _parentage = this._parentage;
805
- if (_parentage === parent) {
806
- this._parentage = null;
807
- }
808
- else if (Array.isArray(_parentage)) {
809
- arrRemove(_parentage, parent);
810
- }
722
+ Subject.prototype._subscribe = function (subscriber) {
723
+ this._throwIfClosed();
724
+ this._checkFinalizedStatuses(subscriber);
725
+ return this._innerSubscribe(subscriber);
811
726
  };
812
- Subscription.prototype.remove = function (teardown) {
813
- var _finalizers = this._finalizers;
814
- _finalizers && arrRemove(_finalizers, teardown);
815
- if (teardown instanceof Subscription) {
816
- teardown._removeParent(this);
727
+ Subject.prototype._innerSubscribe = function (subscriber) {
728
+ var _this = this;
729
+ var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
730
+ if (hasError || isStopped) {
731
+ return EMPTY_SUBSCRIPTION;
817
732
  }
733
+ this.currentObservers = null;
734
+ observers.push(subscriber);
735
+ return new Subscription$1(function () {
736
+ _this.currentObservers = null;
737
+ arrRemove(observers, subscriber);
738
+ });
818
739
  };
819
- Subscription.EMPTY = (function () {
820
- var empty = new Subscription();
821
- empty.closed = true;
822
- return empty;
823
- })();
824
- return Subscription;
825
- }());
826
- var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
827
- function isSubscription(value) {
828
- return (value instanceof Subscription$1 ||
829
- (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
830
- }
831
- function execFinalizer(finalizer) {
832
- if (isFunction(finalizer)) {
833
- finalizer();
834
- }
835
- else {
836
- finalizer.unsubscribe();
837
- }
838
- }
839
-
840
- var config = {
841
- onUnhandledError: null,
842
- onStoppedNotification: null,
843
- Promise: undefined,
844
- useDeprecatedSynchronousErrorHandling: false,
845
- useDeprecatedNextContext: false,
846
- };
847
-
848
- var timeoutProvider = {
849
- setTimeout: function (handler, timeout) {
850
- var args = [];
851
- for (var _i = 2; _i < arguments.length; _i++) {
852
- args[_i - 2] = arguments[_i];
740
+ Subject.prototype._checkFinalizedStatuses = function (subscriber) {
741
+ var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
742
+ if (hasError) {
743
+ subscriber.error(thrownError);
853
744
  }
854
- var delegate = timeoutProvider.delegate;
855
- if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
856
- return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
857
- }
858
- return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
859
- },
860
- clearTimeout: function (handle) {
861
- var delegate = timeoutProvider.delegate;
862
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
863
- },
864
- delegate: undefined,
865
- };
866
-
867
- function reportUnhandledError(err) {
868
- timeoutProvider.setTimeout(function () {
869
- {
870
- throw err;
871
- }
872
- });
873
- }
874
-
875
- function noop() { }
876
-
877
- var context = null;
878
- function errorContext(cb) {
879
- if (config.useDeprecatedSynchronousErrorHandling) {
880
- var isRoot = !context;
881
- if (isRoot) {
882
- context = { errorThrown: false, error: null };
883
- }
884
- cb();
885
- if (isRoot) {
886
- var _a = context, errorThrown = _a.errorThrown, error = _a.error;
887
- context = null;
888
- if (errorThrown) {
889
- throw error;
890
- }
891
- }
892
- }
893
- else {
894
- cb();
895
- }
896
- }
897
-
898
- var Subscriber = (function (_super) {
899
- __extends(Subscriber, _super);
900
- function Subscriber(destination) {
901
- var _this = _super.call(this) || this;
902
- _this.isStopped = false;
903
- if (destination) {
904
- _this.destination = destination;
905
- if (isSubscription(destination)) {
906
- destination.add(_this);
907
- }
908
- }
909
- else {
910
- _this.destination = EMPTY_OBSERVER;
911
- }
912
- return _this;
913
- }
914
- Subscriber.create = function (next, error, complete) {
915
- return new SafeSubscriber(next, error, complete);
916
- };
917
- Subscriber.prototype.next = function (value) {
918
- if (this.isStopped) ;
919
- else {
920
- this._next(value);
921
- }
922
- };
923
- Subscriber.prototype.error = function (err) {
924
- if (this.isStopped) ;
925
- else {
926
- this.isStopped = true;
927
- this._error(err);
928
- }
929
- };
930
- Subscriber.prototype.complete = function () {
931
- if (this.isStopped) ;
932
- else {
933
- this.isStopped = true;
934
- this._complete();
935
- }
936
- };
937
- Subscriber.prototype.unsubscribe = function () {
938
- if (!this.closed) {
939
- this.isStopped = true;
940
- _super.prototype.unsubscribe.call(this);
941
- this.destination = null;
942
- }
943
- };
944
- Subscriber.prototype._next = function (value) {
945
- this.destination.next(value);
946
- };
947
- Subscriber.prototype._error = function (err) {
948
- try {
949
- this.destination.error(err);
950
- }
951
- finally {
952
- this.unsubscribe();
953
- }
954
- };
955
- Subscriber.prototype._complete = function () {
956
- try {
957
- this.destination.complete();
958
- }
959
- finally {
960
- this.unsubscribe();
961
- }
962
- };
963
- return Subscriber;
964
- }(Subscription$1));
965
- var _bind = Function.prototype.bind;
966
- function bind(fn, thisArg) {
967
- return _bind.call(fn, thisArg);
968
- }
969
- var ConsumerObserver = (function () {
970
- function ConsumerObserver(partialObserver) {
971
- this.partialObserver = partialObserver;
972
- }
973
- ConsumerObserver.prototype.next = function (value) {
974
- var partialObserver = this.partialObserver;
975
- if (partialObserver.next) {
976
- try {
977
- partialObserver.next(value);
978
- }
979
- catch (error) {
980
- handleUnhandledError(error);
981
- }
745
+ else if (isStopped) {
746
+ subscriber.complete();
982
747
  }
983
748
  };
984
- ConsumerObserver.prototype.error = function (err) {
985
- var partialObserver = this.partialObserver;
986
- if (partialObserver.error) {
987
- try {
988
- partialObserver.error(err);
989
- }
990
- catch (error) {
991
- handleUnhandledError(error);
992
- }
993
- }
994
- else {
995
- handleUnhandledError(err);
996
- }
749
+ Subject.prototype.asObservable = function () {
750
+ var observable = new Observable();
751
+ observable.source = this;
752
+ return observable;
997
753
  };
998
- ConsumerObserver.prototype.complete = function () {
999
- var partialObserver = this.partialObserver;
1000
- if (partialObserver.complete) {
1001
- try {
1002
- partialObserver.complete();
1003
- }
1004
- catch (error) {
1005
- handleUnhandledError(error);
1006
- }
1007
- }
754
+ Subject.create = function (destination, source) {
755
+ return new AnonymousSubject(destination, source);
1008
756
  };
1009
- return ConsumerObserver;
1010
- }());
1011
- var SafeSubscriber = (function (_super) {
1012
- __extends(SafeSubscriber, _super);
1013
- function SafeSubscriber(observerOrNext, error, complete) {
757
+ return Subject;
758
+ }(Observable));
759
+ var AnonymousSubject = (function (_super) {
760
+ __extends(AnonymousSubject, _super);
761
+ function AnonymousSubject(destination, source) {
1014
762
  var _this = _super.call(this) || this;
1015
- var partialObserver;
1016
- if (isFunction(observerOrNext) || !observerOrNext) {
1017
- partialObserver = {
1018
- next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
1019
- error: error !== null && error !== void 0 ? error : undefined,
1020
- complete: complete !== null && complete !== void 0 ? complete : undefined,
1021
- };
1022
- }
1023
- else {
1024
- var context_1;
1025
- if (_this && config.useDeprecatedNextContext) {
1026
- context_1 = Object.create(observerOrNext);
1027
- context_1.unsubscribe = function () { return _this.unsubscribe(); };
1028
- partialObserver = {
1029
- next: observerOrNext.next && bind(observerOrNext.next, context_1),
1030
- error: observerOrNext.error && bind(observerOrNext.error, context_1),
1031
- complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
1032
- };
1033
- }
1034
- else {
1035
- partialObserver = observerOrNext;
1036
- }
1037
- }
1038
- _this.destination = new ConsumerObserver(partialObserver);
763
+ _this.destination = destination;
764
+ _this.source = source;
1039
765
  return _this;
1040
766
  }
1041
- return SafeSubscriber;
1042
- }(Subscriber));
1043
- function handleUnhandledError(error) {
1044
- {
1045
- reportUnhandledError(error);
1046
- }
1047
- }
1048
- function defaultErrorHandler(err) {
1049
- throw err;
1050
- }
1051
- var EMPTY_OBSERVER = {
1052
- closed: true,
1053
- next: noop,
1054
- error: defaultErrorHandler,
1055
- complete: noop,
1056
- };
1057
-
1058
- var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
1059
-
1060
- function identity(x) {
1061
- return x;
1062
- }
1063
-
1064
- function pipeFromArray(fns) {
1065
- if (fns.length === 0) {
1066
- return identity;
1067
- }
1068
- if (fns.length === 1) {
1069
- return fns[0];
1070
- }
1071
- return function piped(input) {
1072
- return fns.reduce(function (prev, fn) { return fn(prev); }, input);
767
+ AnonymousSubject.prototype.next = function (value) {
768
+ var _a, _b;
769
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
1073
770
  };
1074
- }
1075
-
1076
- var Observable = (function () {
1077
- function Observable(subscribe) {
1078
- if (subscribe) {
1079
- this._subscribe = subscribe;
1080
- }
1081
- }
1082
- Observable.prototype.lift = function (operator) {
1083
- var observable = new Observable();
1084
- observable.source = this;
1085
- observable.operator = operator;
1086
- return observable;
771
+ AnonymousSubject.prototype.error = function (err) {
772
+ var _a, _b;
773
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
1087
774
  };
1088
- Observable.prototype.subscribe = function (observerOrNext, error, complete) {
1089
- var _this = this;
1090
- var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
1091
- errorContext(function () {
1092
- var _a = _this, operator = _a.operator, source = _a.source;
1093
- subscriber.add(operator
1094
- ?
1095
- operator.call(subscriber, source)
1096
- : source
1097
- ?
1098
- _this._subscribe(subscriber)
1099
- :
1100
- _this._trySubscribe(subscriber));
1101
- });
1102
- return subscriber;
1103
- };
1104
- Observable.prototype._trySubscribe = function (sink) {
1105
- try {
1106
- return this._subscribe(sink);
1107
- }
1108
- catch (err) {
1109
- sink.error(err);
1110
- }
1111
- };
1112
- Observable.prototype.forEach = function (next, promiseCtor) {
1113
- var _this = this;
1114
- promiseCtor = getPromiseCtor(promiseCtor);
1115
- return new promiseCtor(function (resolve, reject) {
1116
- var subscriber = new SafeSubscriber({
1117
- next: function (value) {
1118
- try {
1119
- next(value);
1120
- }
1121
- catch (err) {
1122
- reject(err);
1123
- subscriber.unsubscribe();
1124
- }
1125
- },
1126
- error: reject,
1127
- complete: resolve,
1128
- });
1129
- _this.subscribe(subscriber);
1130
- });
1131
- };
1132
- Observable.prototype._subscribe = function (subscriber) {
1133
- var _a;
1134
- return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
1135
- };
1136
- Observable.prototype[observable] = function () {
1137
- return this;
1138
- };
1139
- Observable.prototype.pipe = function () {
1140
- var operations = [];
1141
- for (var _i = 0; _i < arguments.length; _i++) {
1142
- operations[_i] = arguments[_i];
1143
- }
1144
- return pipeFromArray(operations)(this);
1145
- };
1146
- Observable.prototype.toPromise = function (promiseCtor) {
1147
- var _this = this;
1148
- promiseCtor = getPromiseCtor(promiseCtor);
1149
- return new promiseCtor(function (resolve, reject) {
1150
- var value;
1151
- _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
1152
- });
1153
- };
1154
- Observable.create = function (subscribe) {
1155
- return new Observable(subscribe);
1156
- };
1157
- return Observable;
1158
- }());
1159
- function getPromiseCtor(promiseCtor) {
1160
- var _a;
1161
- return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
1162
- }
1163
- function isObserver(value) {
1164
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
1165
- }
1166
- function isSubscriber(value) {
1167
- return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
1168
- }
1169
-
1170
- var ObjectUnsubscribedError = createErrorClass(function (_super) {
1171
- return function ObjectUnsubscribedErrorImpl() {
1172
- _super(this);
1173
- this.name = 'ObjectUnsubscribedError';
1174
- this.message = 'object unsubscribed';
1175
- };
1176
- });
1177
-
1178
- var Subject = (function (_super) {
1179
- __extends(Subject, _super);
1180
- function Subject() {
1181
- var _this = _super.call(this) || this;
1182
- _this.closed = false;
1183
- _this.currentObservers = null;
1184
- _this.observers = [];
1185
- _this.isStopped = false;
1186
- _this.hasError = false;
1187
- _this.thrownError = null;
1188
- return _this;
1189
- }
1190
- Subject.prototype.lift = function (operator) {
1191
- var subject = new AnonymousSubject(this, this);
1192
- subject.operator = operator;
1193
- return subject;
1194
- };
1195
- Subject.prototype._throwIfClosed = function () {
1196
- if (this.closed) {
1197
- throw new ObjectUnsubscribedError();
1198
- }
1199
- };
1200
- Subject.prototype.next = function (value) {
1201
- var _this = this;
1202
- errorContext(function () {
1203
- var e_1, _a;
1204
- _this._throwIfClosed();
1205
- if (!_this.isStopped) {
1206
- if (!_this.currentObservers) {
1207
- _this.currentObservers = Array.from(_this.observers);
1208
- }
1209
- try {
1210
- for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
1211
- var observer = _c.value;
1212
- observer.next(value);
1213
- }
1214
- }
1215
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1216
- finally {
1217
- try {
1218
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1219
- }
1220
- finally { if (e_1) throw e_1.error; }
1221
- }
1222
- }
1223
- });
1224
- };
1225
- Subject.prototype.error = function (err) {
1226
- var _this = this;
1227
- errorContext(function () {
1228
- _this._throwIfClosed();
1229
- if (!_this.isStopped) {
1230
- _this.hasError = _this.isStopped = true;
1231
- _this.thrownError = err;
1232
- var observers = _this.observers;
1233
- while (observers.length) {
1234
- observers.shift().error(err);
1235
- }
1236
- }
1237
- });
1238
- };
1239
- Subject.prototype.complete = function () {
1240
- var _this = this;
1241
- errorContext(function () {
1242
- _this._throwIfClosed();
1243
- if (!_this.isStopped) {
1244
- _this.isStopped = true;
1245
- var observers = _this.observers;
1246
- while (observers.length) {
1247
- observers.shift().complete();
1248
- }
1249
- }
1250
- });
1251
- };
1252
- Subject.prototype.unsubscribe = function () {
1253
- this.isStopped = this.closed = true;
1254
- this.observers = this.currentObservers = null;
1255
- };
1256
- Object.defineProperty(Subject.prototype, "observed", {
1257
- get: function () {
1258
- var _a;
1259
- return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
1260
- },
1261
- enumerable: false,
1262
- configurable: true
1263
- });
1264
- Subject.prototype._trySubscribe = function (subscriber) {
1265
- this._throwIfClosed();
1266
- return _super.prototype._trySubscribe.call(this, subscriber);
1267
- };
1268
- Subject.prototype._subscribe = function (subscriber) {
1269
- this._throwIfClosed();
1270
- this._checkFinalizedStatuses(subscriber);
1271
- return this._innerSubscribe(subscriber);
1272
- };
1273
- Subject.prototype._innerSubscribe = function (subscriber) {
1274
- var _this = this;
1275
- var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
1276
- if (hasError || isStopped) {
1277
- return EMPTY_SUBSCRIPTION;
1278
- }
1279
- this.currentObservers = null;
1280
- observers.push(subscriber);
1281
- return new Subscription$1(function () {
1282
- _this.currentObservers = null;
1283
- arrRemove(observers, subscriber);
1284
- });
1285
- };
1286
- Subject.prototype._checkFinalizedStatuses = function (subscriber) {
1287
- var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
1288
- if (hasError) {
1289
- subscriber.error(thrownError);
1290
- }
1291
- else if (isStopped) {
1292
- subscriber.complete();
1293
- }
1294
- };
1295
- Subject.prototype.asObservable = function () {
1296
- var observable = new Observable();
1297
- observable.source = this;
1298
- return observable;
1299
- };
1300
- Subject.create = function (destination, source) {
1301
- return new AnonymousSubject(destination, source);
1302
- };
1303
- return Subject;
1304
- }(Observable));
1305
- var AnonymousSubject = (function (_super) {
1306
- __extends(AnonymousSubject, _super);
1307
- function AnonymousSubject(destination, source) {
1308
- var _this = _super.call(this) || this;
1309
- _this.destination = destination;
1310
- _this.source = source;
1311
- return _this;
1312
- }
1313
- AnonymousSubject.prototype.next = function (value) {
1314
- var _a, _b;
1315
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
1316
- };
1317
- AnonymousSubject.prototype.error = function (err) {
1318
- var _a, _b;
1319
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
1320
- };
1321
- AnonymousSubject.prototype.complete = function () {
1322
- var _a, _b;
1323
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
775
+ AnonymousSubject.prototype.complete = function () {
776
+ var _a, _b;
777
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
1324
778
  };
1325
779
  AnonymousSubject.prototype._subscribe = function (subscriber) {
1326
780
  var _a, _b;
@@ -1341,437 +795,1010 @@ class ReflectHelper {
1341
795
  static get items() {
1342
796
  return this._items;
1343
797
  }
1344
- static get keys() {
1345
- return Object.keys(ReflectHelper.items);
798
+ static get keys() {
799
+ return Object.keys(ReflectHelper.items);
800
+ }
801
+ static has(key, target, property) {
802
+ return (!isNil(key) &&
803
+ !isNil(ReflectHelper.items[key]) &&
804
+ (isNil(target) ||
805
+ (!isNil(ReflectHelper.items[key][target]) &&
806
+ (isNil(property) || !isNil(ReflectHelper.items[key][target][String(property)])))));
807
+ }
808
+ static get({ key, target, property, own = true }) {
809
+ try {
810
+ if (own) {
811
+ return Reflect.getOwnMetadata(key, target, property) || null;
812
+ }
813
+ else {
814
+ return Reflect.getMetadata(key, target, property) || null;
815
+ }
816
+ }
817
+ catch (_err) {
818
+ return null;
819
+ }
820
+ }
821
+ static first({ key, target, property, own = true }) {
822
+ const values = ReflectHelper.get({ key, target, property, own });
823
+ return isArray(values) ? first(values) : values;
824
+ }
825
+ static last({ key, target, property, own = true }) {
826
+ const values = ReflectHelper.get({ key, target, property, own });
827
+ return isArray(values) ? last(values) : values;
828
+ }
829
+ static set({ key, target, property, value, propertyDescriptor }) {
830
+ Reflect.defineMetadata(key, value, target, property);
831
+ ReflectHelper.put({ key, target, property, value, propertyDescriptor });
832
+ }
833
+ static add({ key, target, property, value, propertyDescriptor }) {
834
+ let values = ReflectHelper.get({ key, target, property }) || new Array();
835
+ if (!Array.isArray(values))
836
+ values = [values];
837
+ values.push(value);
838
+ ReflectHelper.set({ key, target, property, value: values, propertyDescriptor });
839
+ }
840
+ static all({ key }) {
841
+ const items = ReflectHelper.items[key] || {};
842
+ return flatten(Object.keys(items).map((item) => flatten(this.allFrom(key, items[item]))));
843
+ }
844
+ static allFrom(key, target) {
845
+ return Object.keys(target)
846
+ .filter((property) => property !== 'object')
847
+ .map((property) => this.allValuesFrom(key, target, property));
848
+ }
849
+ static allValuesFrom(key, target, property) {
850
+ const values = target[property];
851
+ let value = values.value;
852
+ const propertyDescriptor = values.propertyDescriptor;
853
+ if (!isArray(value))
854
+ value = [value];
855
+ return flatten(value.map((val) => {
856
+ return {
857
+ key,
858
+ target: target.object,
859
+ property,
860
+ value: val,
861
+ propertyDescriptor,
862
+ };
863
+ }));
864
+ }
865
+ static delete({ key, target, property }) {
866
+ Reflect.deleteMetadata(key, target, property);
867
+ return ReflectHelper.remove(key, target, property);
868
+ }
869
+ static clear(key) {
870
+ if (!key) {
871
+ ReflectHelper.keys.forEach((storedKey) => {
872
+ ReflectHelper.clear(storedKey);
873
+ });
874
+ }
875
+ else {
876
+ if (ReflectHelper.keys.includes(key)) {
877
+ Object.values(ReflectHelper.items[key]).forEach((target) => {
878
+ if (ReflectHelper.has(key, target)) {
879
+ Object.values(ReflectHelper.items[key][target.toString()]).forEach((property) => {
880
+ ReflectHelper.delete({
881
+ key,
882
+ target: target.object,
883
+ property: String(property),
884
+ });
885
+ ReflectHelper.remove(key, target, String(property));
886
+ });
887
+ }
888
+ ReflectHelper.delete({ key, target: target.object });
889
+ ReflectHelper.remove(key, target);
890
+ });
891
+ }
892
+ }
893
+ }
894
+ static getType({ target, propertyKey }) {
895
+ return Reflect.getMetadata('design:type', target, propertyKey);
896
+ }
897
+ static getReturntype({ target, propertyKey }) {
898
+ return Reflect.getMetadata('design:returntype', target, propertyKey);
899
+ }
900
+ static getAllMethods(target) {
901
+ const props = [];
902
+ let obj = target;
903
+ do {
904
+ props.push(...Object.getOwnPropertyNames(obj));
905
+ } while ((obj = Object.getPrototypeOf(obj)));
906
+ return props.sort().filter((e, i, arr) => {
907
+ if ([
908
+ '__defineGetter__',
909
+ '__defineSetter__',
910
+ '__lookupGetter__',
911
+ '__lookupSetter__',
912
+ 'constructor',
913
+ 'hasOwnProperty',
914
+ 'isPrototypeOf',
915
+ 'propertyIsEnumerable',
916
+ 'toLocaleString',
917
+ 'toString',
918
+ 'valueOf',
919
+ ].includes(e))
920
+ return false;
921
+ if (e != arr[i + 1] && typeof target[e] === 'function')
922
+ return true;
923
+ });
924
+ }
925
+ static put({ key, target, property, value, propertyDescriptor }) {
926
+ const index = target.constructor.name;
927
+ ReflectHelper.items[key] = ReflectHelper.items[key] || {};
928
+ ReflectHelper.items[key][index] = ReflectHelper.items[key][index] || {};
929
+ ReflectHelper.items[key][index].object = target;
930
+ if (isNil(property)) {
931
+ ReflectHelper.items[key][index].value = {
932
+ value,
933
+ propertyDescriptor,
934
+ };
935
+ }
936
+ else {
937
+ ReflectHelper.items[key][index][String(property)] = ReflectHelper.items[key][index][String(property)] || {};
938
+ ReflectHelper.items[key][index][String(property)] = {
939
+ value,
940
+ propertyDescriptor,
941
+ };
942
+ }
943
+ }
944
+ static remove(key, target, property) {
945
+ if (ReflectHelper.has(key, target, property))
946
+ return delete ReflectHelper.items[key][target][String(property)];
947
+ else if (ReflectHelper.has(key, target))
948
+ return delete ReflectHelper.items[key][target];
949
+ else if (ReflectHelper.has(key))
950
+ return delete ReflectHelper.items[key];
951
+ else
952
+ return false;
953
+ }
954
+ }
955
+ ReflectHelper._items = {};
956
+
957
+ class DebugDecoratorHelper {
958
+ static set(target, options) {
959
+ ReflectHelper.add({
960
+ key: DebugDecoratorHelper.DebugNamingMetadataKey,
961
+ target,
962
+ value: options,
963
+ });
964
+ }
965
+ static get(target) {
966
+ return ReflectHelper.first({
967
+ key: DebugDecoratorHelper.DebugNamingMetadataKey,
968
+ target,
969
+ });
970
+ }
971
+ }
972
+ DebugDecoratorHelper.DebugNamingMetadataKey = 'model:naming:decorator';
973
+
974
+ class ClassNameHelper {
975
+ static get(clazz) {
976
+ if (!clazz)
977
+ return null;
978
+ const prototype = Object.getPrototypeOf(clazz);
979
+ const names = compact([
980
+ get(clazz, 'constructor.name'),
981
+ get(prototype, 'constructor.name'),
982
+ get(prototype, '__proto__.constructor.name'),
983
+ ]);
984
+ return names.find((name) => name !== 'class_1');
985
+ }
986
+ }
987
+
988
+ const isDebuggable = (object) => {
989
+ return 'debug' in object;
990
+ };
991
+ class DebugHelper {
992
+ static namespacesFor(target) {
993
+ if (isNil(target))
994
+ return [];
995
+ const decorator = DebugDecoratorHelper.get(Object.getPrototypeOf(target));
996
+ const namespaces = get(decorator, 'namespaces', []);
997
+ const name = get(decorator, 'name', ClassNameHelper.get(target));
998
+ return [...namespaces, name];
999
+ }
1000
+ static as(...namespaces) {
1001
+ return new DebugHelper(...namespaces);
1002
+ }
1003
+ static for(target, ...namespaces) {
1004
+ const targetNamespaces = this.namespacesFor(target);
1005
+ return new DebugHelper(...targetNamespaces, ...namespaces);
1006
+ }
1007
+ static from(target, ...namespaces) {
1008
+ if (this.isDebuggable(target)) {
1009
+ const debug = target.debug;
1010
+ if (namespaces)
1011
+ debug.push(...namespaces);
1012
+ return debug;
1013
+ }
1014
+ return DebugHelper.for(target, ...namespaces);
1015
+ }
1016
+ static clonedFrom(target, ...namespaces) {
1017
+ if (this.isDebuggable(target)) {
1018
+ namespaces.push(...target.debug.entries);
1019
+ }
1020
+ else if (!isNil(target)) {
1021
+ namespaces.push(...this.namespacesFor(target));
1022
+ }
1023
+ return DebugHelper.for(target, ...namespaces);
1024
+ }
1025
+ static clone(target, ...namespaces) {
1026
+ let original;
1027
+ if (this.isDebuggable(target)) {
1028
+ original = target.debug;
1029
+ namespaces.push(...original.entries);
1030
+ }
1031
+ return {
1032
+ original,
1033
+ debug: DebugHelper.for(target, ...namespaces),
1034
+ };
1035
+ }
1036
+ static replace(target, attrs) {
1037
+ if (this.isDebuggable(target))
1038
+ target.debug = attrs.with;
1039
+ }
1040
+ static mock(target, ...namespaces) {
1041
+ const { original, debug } = DebugHelper.clone(target, ...namespaces);
1042
+ DebugHelper.replace(target, { with: debug });
1043
+ return { original, debug };
1044
+ }
1045
+ constructor(...namespace) {
1046
+ this.namespaces = new Set();
1047
+ this.push(...namespace);
1048
+ }
1049
+ get entries() {
1050
+ return Array.from(get(this, 'namespaces', []));
1051
+ }
1052
+ get namespace() {
1053
+ return compact(flatten(this.entries)).join(':');
1054
+ }
1055
+ log(message, ...args) {
1056
+ this.logger(JSON.stringify(message), ...args.map((element) => JSON.stringify(element)));
1057
+ DebugHelper.logs$.next({ namespace: this.namespace, message, args });
1058
+ return this;
1059
+ }
1060
+ trace(message, ...args) {
1061
+ this.logger.extend(DebugNamespaces.TRACE)(message, ...args);
1062
+ DebugHelper.traces$.next({ namespace: this.namespace, message, args });
1063
+ return this;
1064
+ }
1065
+ error(error, ...args) {
1066
+ this.logger.extend(DebugNamespaces.ERROR)(JSON.stringify(error), ...args.map((element) => JSON.stringify(element)));
1067
+ DebugHelper.errors$.next({ namespace: this.namespace, error, args });
1068
+ return this;
1069
+ }
1070
+ build() {
1071
+ this.logger = Logger;
1072
+ this.tracer = Logger;
1073
+ this.err = Logger;
1074
+ this.entries.forEach((namespace) => {
1075
+ this.logger = this.logger.extend(namespace);
1076
+ this.tracer = this.tracer.extend(namespace);
1077
+ this.err = this.err.extend(namespace);
1078
+ });
1079
+ return this;
1080
+ }
1081
+ with(...namespace) {
1082
+ return new DebugHelper(...this.entries, ...namespace);
1083
+ }
1084
+ push(...namespace) {
1085
+ if (namespace) {
1086
+ namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.add(item));
1087
+ }
1088
+ return this.build();
1089
+ }
1090
+ unshift(...namespace) {
1091
+ if (namespace) {
1092
+ return this.reset(...namespace, ...this.entries);
1093
+ }
1094
+ return this;
1095
+ }
1096
+ reset(...namespace) {
1097
+ this.namespaces = new Set(flatten(compact(namespace)));
1098
+ return this.build();
1346
1099
  }
1347
- static has(key, target, property) {
1348
- return (!isNil(key) &&
1349
- !isNil(ReflectHelper.items[key]) &&
1350
- (isNil(target) ||
1351
- (!isNil(ReflectHelper.items[key][target]) &&
1352
- (isNil(property) || !isNil(ReflectHelper.items[key][target][String(property)])))));
1100
+ startWith(...namespace) {
1101
+ const current = this.namespaces;
1102
+ this.namespaces = new Set(flatten([compact(namespace), ...current]));
1103
+ return this.build();
1353
1104
  }
1354
- static get({ key, target, property, own = true }) {
1105
+ shift() {
1106
+ const list = this.entries;
1107
+ list.shift();
1108
+ return this.reset(...list);
1109
+ }
1110
+ pop() {
1111
+ const list = this.entries;
1112
+ list.pop();
1113
+ return this.reset(...list);
1114
+ }
1115
+ clear() {
1116
+ return this.reset();
1117
+ }
1118
+ remove(...namespace) {
1119
+ if (namespace) {
1120
+ namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.delete(item));
1121
+ }
1122
+ return this.build();
1123
+ }
1124
+ puts(...args) {
1125
+ return [`[${this.namespace}]`, ...args].join(' ');
1126
+ }
1127
+ }
1128
+ DebugHelper.logs$ = new Subject();
1129
+ DebugHelper.traces$ = new Subject();
1130
+ DebugHelper.errors$ = new Subject();
1131
+ DebugHelper.isDebuggable = isDebuggable;
1132
+
1133
+ function Debug(opts) {
1134
+ return function (target) {
1135
+ DebugDecoratorHelper.set(target.prototype, opts);
1136
+ };
1137
+ }
1138
+
1139
+ const ASYNC_IDENTIFIER = 'async';
1140
+ function Log(options = {}) {
1141
+ return Trace(Object.assign({ level: 'log' }, options));
1142
+ }
1143
+ function Trace(options = {}) {
1144
+ return function (target, propertyKey, propertyDescriptor) {
1145
+ const method = propertyDescriptor.value;
1146
+ const isPromise = method.toString().includes(ASYNC_IDENTIFIER);
1147
+ const args = {
1148
+ options,
1149
+ method,
1150
+ target,
1151
+ propertyKey,
1152
+ propertyDescriptor,
1153
+ };
1154
+ propertyDescriptor.value = isPromise ? promiseTracer(args) : functionTracer(args);
1155
+ return propertyDescriptor;
1156
+ };
1157
+ }
1158
+ const traceCall = function ({ target, propertyKey, propertyDescriptor, args }) {
1159
+ if (!target.debug)
1160
+ target.debug = DebugHelper.for(target, propertyKey);
1161
+ return target.debug.push(propertyKey).trace('called', { target, propertyKey, propertyDescriptor, args });
1162
+ };
1163
+ const promiseTracer = function ({ options, method, propertyKey, propertyDescriptor }) {
1164
+ return function (...args) {
1165
+ return new Promise((resolve, reject) => {
1166
+ const debug = traceCall({ target: this, propertyDescriptor, propertyKey, args });
1167
+ return method
1168
+ .apply(this, args)
1169
+ .then((result) => {
1170
+ if (options.callbackFn) {
1171
+ options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
1172
+ }
1173
+ if (get(options, 'level', '') === 'log') {
1174
+ debug.log({ req: args, res: result === undefined ? 'void' : result });
1175
+ }
1176
+ return resolve(result);
1177
+ })
1178
+ .catch((error) => {
1179
+ debug.error({ req: args, res: error, stack: error.stack });
1180
+ return reject(error);
1181
+ });
1182
+ });
1183
+ };
1184
+ };
1185
+ const functionTracer = function ({ options, target, method, propertyKey, propertyDescriptor, }) {
1186
+ return function (...args) {
1187
+ const debug = traceCall({ target: this || target, propertyDescriptor, propertyKey, args });
1188
+ let result;
1355
1189
  try {
1356
- if (own) {
1357
- return Reflect.getOwnMetadata(key, target, property) || null;
1358
- }
1359
- else {
1360
- return Reflect.getMetadata(key, target, property) || null;
1190
+ result = method.apply(this, args);
1191
+ if (options.callbackFn)
1192
+ options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
1193
+ if (get(options, 'level', '') === 'log') {
1194
+ debug.log({ req: args, res: result === undefined ? 'void' : result });
1361
1195
  }
1196
+ return result;
1362
1197
  }
1363
- catch (_err) {
1364
- return null;
1198
+ catch (error) {
1199
+ if (error instanceof Error)
1200
+ debug.error({ req: args, res: error, stack: error.stack });
1201
+ throw error;
1365
1202
  }
1203
+ };
1204
+ };
1205
+
1206
+ function is(value) {
1207
+ return value;
1208
+ }
1209
+
1210
+ const isUUID = (value) => isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value);
1211
+
1212
+ class Base {
1213
+ constructor(...args) {
1214
+ Object.assign(this, ...args);
1366
1215
  }
1367
- static first({ key, target, property, own = true }) {
1368
- const values = ReflectHelper.get({ key, target, property, own });
1369
- return isArray(values) ? first(values) : values;
1370
- }
1371
- static last({ key, target, property, own = true }) {
1372
- const values = ReflectHelper.get({ key, target, property, own });
1373
- return isArray(values) ? last(values) : values;
1374
- }
1375
- static set({ key, target, property, value, propertyDescriptor }) {
1376
- Reflect.defineMetadata(key, value, target, property);
1377
- ReflectHelper.put({ key, target, property, value, propertyDescriptor });
1216
+ }
1217
+
1218
+ const parseDateTime = (value) => {
1219
+ if (!isString(value))
1220
+ return value;
1221
+ if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
1222
+ !/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T\d{2}:\d{2}:\d{2}/.test(value))
1223
+ return value;
1224
+ const date = parseISO(value);
1225
+ if (isNaN(date.getTime()))
1226
+ return value;
1227
+ return date;
1228
+ };
1229
+
1230
+ class BaseModel {
1231
+ get identifier() {
1232
+ const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
1233
+ const data = this;
1234
+ return fields.reduce((object, field) => (Object.assign(Object.assign({}, object), { [field]: data[field] })), {});
1378
1235
  }
1379
- static add({ key, target, property, value, propertyDescriptor }) {
1380
- let values = ReflectHelper.get({ key, target, property }) || new Array();
1381
- if (!Array.isArray(values))
1382
- values = [values];
1383
- values.push(value);
1384
- ReflectHelper.set({ key, target, property, value: values, propertyDescriptor });
1236
+ get identifiersFields() {
1237
+ return this.constructor.identifiersFields;
1385
1238
  }
1386
- static all({ key }) {
1387
- const items = ReflectHelper.items[key] || {};
1388
- return flatten(Object.keys(items).map((item) => flatten(this.allFrom(key, items[item]))));
1239
+ constructor(args) {
1240
+ Object.assign(this, args);
1389
1241
  }
1390
- static allFrom(key, target) {
1391
- return Object.keys(target)
1392
- .filter((property) => property !== 'object')
1393
- .map((property) => this.allValuesFrom(key, target, property));
1242
+ static toInstance(data) {
1243
+ return plainToInstance(this, data || {});
1394
1244
  }
1395
- static allValuesFrom(key, target, property) {
1396
- const values = target[property];
1397
- let value = values.value;
1398
- const propertyDescriptor = values.propertyDescriptor;
1399
- if (!isArray(value))
1400
- value = [value];
1401
- return flatten(value.map((val) => {
1402
- return {
1403
- key,
1404
- target: target.object,
1405
- property,
1406
- value: val,
1407
- propertyDescriptor,
1408
- };
1409
- }));
1245
+ static isModel(value) {
1246
+ return value instanceof this;
1410
1247
  }
1411
- static delete({ key, target, property }) {
1412
- Reflect.deleteMetadata(key, target, property);
1413
- return ReflectHelper.remove(key, target, property);
1248
+ toPlain() {
1249
+ return instanceToPlain(this);
1414
1250
  }
1415
- static clear(key) {
1416
- if (!key) {
1417
- ReflectHelper.keys.forEach((storedKey) => {
1418
- ReflectHelper.clear(storedKey);
1419
- });
1420
- }
1421
- else {
1422
- if (ReflectHelper.keys.includes(key)) {
1423
- Object.values(ReflectHelper.items[key]).forEach((target) => {
1424
- if (ReflectHelper.has(key, target)) {
1425
- Object.values(ReflectHelper.items[key][target.toString()]).forEach((property) => {
1426
- ReflectHelper.delete({
1427
- key,
1428
- target: target.object,
1429
- property: String(property),
1430
- });
1431
- ReflectHelper.remove(key, target, String(property));
1432
- });
1433
- }
1434
- ReflectHelper.delete({ key, target: target.object });
1435
- ReflectHelper.remove(key, target);
1436
- });
1437
- }
1438
- }
1251
+ }
1252
+
1253
+ var GenderDestination;
1254
+ (function (GenderDestination) {
1255
+ GenderDestination["FEMALE"] = "female";
1256
+ GenderDestination["MALE"] = "male";
1257
+ GenderDestination["UNISEX"] = "unisex";
1258
+ })(GenderDestination || (GenderDestination = {}));
1259
+
1260
+ var ProductLabelEnum;
1261
+ (function (ProductLabelEnum) {
1262
+ ProductLabelEnum["ON_SALE"] = "on-sale";
1263
+ ProductLabelEnum["OUTLET"] = "outlet";
1264
+ ProductLabelEnum["LAST_UNITS"] = "last-units";
1265
+ ProductLabelEnum["GLAMSTAR"] = "glamstar";
1266
+ })(ProductLabelEnum || (ProductLabelEnum = {}));
1267
+
1268
+ var Shops;
1269
+ (function (Shops) {
1270
+ Shops["MENSMARKET"] = "mensmarket";
1271
+ Shops["GLAMSHOP"] = "Glamshop";
1272
+ Shops["GLAMPOINTS"] = "Glampoints";
1273
+ Shops["ALL"] = "ALL";
1274
+ })(Shops || (Shops = {}));
1275
+
1276
+ var WishlistLogType;
1277
+ (function (WishlistLogType) {
1278
+ WishlistLogType["CREATE"] = "create";
1279
+ WishlistLogType["UPDATE"] = "update";
1280
+ WishlistLogType["DELETE"] = "delete";
1281
+ WishlistLogType["ADD_PRODUCT"] = "add_product";
1282
+ WishlistLogType["REMOVE_PRODUCT"] = "remove_product";
1283
+ })(WishlistLogType || (WishlistLogType = {}));
1284
+
1285
+ class Category extends BaseModel {
1286
+ static get identifiersFields() {
1287
+ return ['id'];
1439
1288
  }
1440
- static getType({ target, propertyKey }) {
1441
- return Reflect.getMetadata('design:type', target, propertyKey);
1289
+ get glamImages() {
1290
+ return this.images && this.images[Shops.GLAMSHOP]
1291
+ ? this.images[Shops.GLAMSHOP]
1292
+ : {
1293
+ brandBanner: null,
1294
+ brandBannerMobile: null,
1295
+ image: null,
1296
+ };
1442
1297
  }
1443
- static getReturntype({ target, propertyKey }) {
1444
- return Reflect.getMetadata('design:returntype', target, propertyKey);
1298
+ get mensImages() {
1299
+ return this.images && this.images[Shops.MENSMARKET]
1300
+ ? this.images[Shops.MENSMARKET]
1301
+ : {
1302
+ brandBanner: null,
1303
+ brandBannerMobile: null,
1304
+ image: null,
1305
+ };
1445
1306
  }
1446
- static getAllMethods(target) {
1447
- const props = [];
1448
- let obj = target;
1449
- do {
1450
- props.push(...Object.getOwnPropertyNames(obj));
1451
- } while ((obj = Object.getPrototypeOf(obj)));
1452
- return props.sort().filter((e, i, arr) => {
1453
- if ([
1454
- '__defineGetter__',
1455
- '__defineSetter__',
1456
- '__lookupGetter__',
1457
- '__lookupSetter__',
1458
- 'constructor',
1459
- 'hasOwnProperty',
1460
- 'isPrototypeOf',
1461
- 'propertyIsEnumerable',
1462
- 'toLocaleString',
1463
- 'toString',
1464
- 'valueOf',
1465
- ].includes(e))
1466
- return false;
1467
- if (e != arr[i + 1] && typeof target[e] === 'function')
1468
- return true;
1469
- });
1307
+ get glamMetadata() {
1308
+ return this.metadatas.find((metadata) => metadata.shop === Shops.GLAMSHOP);
1470
1309
  }
1471
- static put({ key, target, property, value, propertyDescriptor }) {
1472
- const index = target.constructor.name;
1473
- ReflectHelper.items[key] = ReflectHelper.items[key] || {};
1474
- ReflectHelper.items[key][index] = ReflectHelper.items[key][index] || {};
1475
- ReflectHelper.items[key][index].object = target;
1476
- if (isNil(property)) {
1477
- ReflectHelper.items[key][index].value = {
1478
- value,
1479
- propertyDescriptor,
1480
- };
1481
- }
1482
- else {
1483
- ReflectHelper.items[key][index][String(property)] = ReflectHelper.items[key][index][String(property)] || {};
1484
- ReflectHelper.items[key][index][String(property)] = {
1485
- value,
1486
- propertyDescriptor,
1487
- };
1488
- }
1310
+ get mensMetadata() {
1311
+ return this.metadatas.find((metadata) => metadata.shop === Shops.MENSMARKET);
1489
1312
  }
1490
- static remove(key, target, property) {
1491
- if (ReflectHelper.has(key, target, property))
1492
- return delete ReflectHelper.items[key][target][String(property)];
1493
- else if (ReflectHelper.has(key, target))
1494
- return delete ReflectHelper.items[key][target];
1495
- else if (ReflectHelper.has(key))
1496
- return delete ReflectHelper.items[key];
1497
- else
1498
- return false;
1313
+ getMostRelevantByShop(shop) {
1314
+ return this.mostRelevants && this.mostRelevants[shop] ? this.mostRelevants[shop] : [];
1499
1315
  }
1500
1316
  }
1501
- ReflectHelper._items = {};
1317
+ __decorate([
1318
+ Type(() => Category),
1319
+ __metadata("design:type", Category)
1320
+ ], Category.prototype, "parent", void 0);
1321
+ __decorate([
1322
+ Type(resolveClass('Product')),
1323
+ __metadata("design:type", Array)
1324
+ ], Category.prototype, "childrenProducts", void 0);
1325
+ __decorate([
1326
+ Type(resolveClass('Filter')),
1327
+ __metadata("design:type", Array)
1328
+ ], Category.prototype, "filters", void 0);
1329
+ registerClass('Category', Category);
1502
1330
 
1503
- class DebugDecoratorHelper {
1504
- static set(target, options) {
1505
- ReflectHelper.add({
1506
- key: DebugDecoratorHelper.DebugNamingMetadataKey,
1507
- target,
1508
- value: options,
1509
- });
1510
- }
1511
- static get(target) {
1512
- return ReflectHelper.first({
1513
- key: DebugDecoratorHelper.DebugNamingMetadataKey,
1514
- target,
1515
- });
1331
+ class CategoryCollectionChildren extends BaseModel {
1332
+ static get identifiersFields() {
1333
+ return ['collectionId', 'categoryId'];
1516
1334
  }
1517
1335
  }
1518
- DebugDecoratorHelper.DebugNamingMetadataKey = 'model:naming:decorator';
1336
+ __decorate([
1337
+ Type(() => CategoryCollectionChildren),
1338
+ __metadata("design:type", CategoryCollectionChildren)
1339
+ ], CategoryCollectionChildren.prototype, "parent", void 0);
1519
1340
 
1520
- class ClassNameHelper {
1521
- static get(clazz) {
1522
- if (!clazz)
1523
- return null;
1524
- const prototype = Object.getPrototypeOf(clazz);
1525
- const names = compact([
1526
- get(clazz, 'constructor.name'),
1527
- get(prototype, 'constructor.name'),
1528
- get(prototype, '__proto__.constructor.name'),
1529
- ]);
1530
- return names.find((name) => name !== 'class_1');
1341
+ class Filter extends BaseModel {
1342
+ static get identifiersFields() {
1343
+ return ['id'];
1531
1344
  }
1532
- }
1345
+ }
1346
+ __decorate([
1347
+ Type(() => Category),
1348
+ __metadata("design:type", Array)
1349
+ ], Filter.prototype, "categories", void 0);
1350
+ registerClass('Filter', Filter);
1533
1351
 
1534
- const isDebuggable = (object) => {
1535
- return 'debug' in object;
1536
- };
1537
- class DebugHelper {
1538
- static namespacesFor(target) {
1539
- if (isNil(target))
1540
- return [];
1541
- const decorator = DebugDecoratorHelper.get(Object.getPrototypeOf(target));
1542
- const namespaces = get(decorator, 'namespaces', []);
1543
- const name = get(decorator, 'name', ClassNameHelper.get(target));
1544
- return [...namespaces, name];
1352
+ class CategoryFilter extends BaseModel {
1353
+ static get identifiersFields() {
1354
+ return ['id'];
1545
1355
  }
1546
- static as(...namespaces) {
1547
- return new DebugHelper(...namespaces);
1356
+ }
1357
+ __decorate([
1358
+ Type(() => Filter),
1359
+ __metadata("design:type", Filter)
1360
+ ], CategoryFilter.prototype, "filter", void 0);
1361
+ __decorate([
1362
+ Type(() => Category),
1363
+ __metadata("design:type", Category)
1364
+ ], CategoryFilter.prototype, "category", void 0);
1365
+
1366
+ class CategoryProduct extends BaseModel {
1367
+ static get identifiersFields() {
1368
+ return ['categoryId', 'productId'];
1548
1369
  }
1549
- static for(target, ...namespaces) {
1550
- const targetNamespaces = this.namespacesFor(target);
1551
- return new DebugHelper(...targetNamespaces, ...namespaces);
1370
+ }
1371
+
1372
+ class FilterOption extends BaseModel {
1373
+ static get identifiersFields() {
1374
+ return ['id'];
1552
1375
  }
1553
- static from(target, ...namespaces) {
1554
- if (this.isDebuggable(target)) {
1555
- const debug = target.debug;
1556
- if (namespaces)
1557
- debug.push(...namespaces);
1558
- return debug;
1559
- }
1560
- return DebugHelper.for(target, ...namespaces);
1376
+ }
1377
+
1378
+ class KitProduct extends BaseModel {
1379
+ static get identifiersFields() {
1380
+ return ['productId', 'kitProductId'];
1561
1381
  }
1562
- static clonedFrom(target, ...namespaces) {
1563
- if (this.isDebuggable(target)) {
1564
- namespaces.push(...target.debug.entries);
1565
- }
1566
- else if (!isNil(target)) {
1567
- namespaces.push(...this.namespacesFor(target));
1568
- }
1569
- return DebugHelper.for(target, ...namespaces);
1382
+ }
1383
+ __decorate([
1384
+ Type(resolveClass('Product')),
1385
+ __metadata("design:type", Function)
1386
+ ], KitProduct.prototype, "kit", void 0);
1387
+ __decorate([
1388
+ Type(resolveClass('Product')),
1389
+ __metadata("design:type", Function)
1390
+ ], KitProduct.prototype, "product", void 0);
1391
+ registerClass('KitProduct', KitProduct);
1392
+
1393
+ class ProductReview extends BaseModel {
1394
+ static get identifiersFields() {
1395
+ return ['id'];
1570
1396
  }
1571
- static clone(target, ...namespaces) {
1572
- let original;
1573
- if (this.isDebuggable(target)) {
1574
- original = target.debug;
1575
- namespaces.push(...original.entries);
1576
- }
1397
+ }
1398
+
1399
+ class ProductBase extends BaseModel {
1400
+ get evaluation() {
1577
1401
  return {
1578
- original,
1579
- debug: DebugHelper.for(target, ...namespaces),
1402
+ reviews: this.reviews,
1403
+ count: this.reviewsTotal,
1404
+ rating: this.rate,
1580
1405
  };
1581
1406
  }
1582
- static replace(target, attrs) {
1583
- if (this.isDebuggable(target))
1584
- target.debug = attrs.with;
1585
- }
1586
- static mock(target, ...namespaces) {
1587
- const { original, debug } = DebugHelper.clone(target, ...namespaces);
1588
- DebugHelper.replace(target, { with: debug });
1589
- return { original, debug };
1590
- }
1591
- constructor(...namespace) {
1592
- this.namespaces = new Set();
1593
- this.push(...namespace);
1594
- }
1595
- get entries() {
1596
- return Array.from(get(this, 'namespaces', []));
1597
- }
1598
- get namespace() {
1599
- return compact(flatten(this.entries)).join(':');
1600
- }
1601
- log(message, ...args) {
1602
- this.logger(JSON.stringify(message), ...args.map((element) => JSON.stringify(element)));
1603
- DebugHelper.logs$.next({ namespace: this.namespace, message, args });
1604
- return this;
1605
- }
1606
- trace(message, ...args) {
1607
- this.logger.extend(DebugNamespaces.TRACE)(message, ...args);
1608
- DebugHelper.traces$.next({ namespace: this.namespace, message, args });
1609
- return this;
1610
- }
1611
- error(error, ...args) {
1612
- this.logger.extend(DebugNamespaces.ERROR)(JSON.stringify(error), ...args.map((element) => JSON.stringify(element)));
1613
- DebugHelper.errors$.next({ namespace: this.namespace, error, args });
1614
- return this;
1407
+ set evaluation(evaluation) {
1408
+ if (!evaluation) {
1409
+ this.reviews = null;
1410
+ this.reviewsTotal = null;
1411
+ this.rate = null;
1412
+ return;
1413
+ }
1414
+ this.reviews = evaluation.reviews || this.reviews;
1415
+ this.reviewsTotal = evaluation.count || this.reviewsTotal;
1416
+ this.rate = evaluation.rating || this.rate;
1615
1417
  }
1616
- build() {
1617
- this.logger = Logger;
1618
- this.tracer = Logger;
1619
- this.err = Logger;
1620
- this.entries.forEach((namespace) => {
1621
- this.logger = this.logger.extend(namespace);
1622
- this.tracer = this.tracer.extend(namespace);
1623
- this.err = this.err.extend(namespace);
1624
- });
1625
- return this;
1418
+ static get identifiersFields() {
1419
+ return ['id'];
1626
1420
  }
1627
- with(...namespace) {
1628
- return new DebugHelper(...this.entries, ...namespace);
1421
+ }
1422
+ __decorate([
1423
+ Type(() => Category),
1424
+ __metadata("design:type", Category)
1425
+ ], ProductBase.prototype, "category", void 0);
1426
+ __decorate([
1427
+ Type(() => KitProduct),
1428
+ __metadata("design:type", Array)
1429
+ ], ProductBase.prototype, "kitProducts", void 0);
1430
+ __decorate([
1431
+ Type(() => ProductReview),
1432
+ __metadata("design:type", Array)
1433
+ ], ProductBase.prototype, "reviews", void 0);
1434
+
1435
+ class Variant extends ProductBase {
1436
+ static get identifiersFields() {
1437
+ return ['id', 'productId'];
1629
1438
  }
1630
- push(...namespace) {
1631
- if (namespace) {
1632
- namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.add(item));
1633
- }
1634
- return this.build();
1439
+ }
1440
+
1441
+ class Product extends ProductBase {
1442
+ }
1443
+ __decorate([
1444
+ Type(() => Variant),
1445
+ __metadata("design:type", Array)
1446
+ ], Product.prototype, "variants", void 0);
1447
+ registerClass('Product', Product);
1448
+
1449
+ class ProductErrors extends BaseModel {
1450
+ static get identifiersFields() {
1451
+ return ['productId', 'source', 'error'];
1635
1452
  }
1636
- unshift(...namespace) {
1637
- if (namespace) {
1638
- return this.reset(...namespace, ...this.entries);
1639
- }
1640
- return this;
1453
+ getProductId() {
1454
+ return this.product instanceof Product ? this.product.id.toString() : this.product.productId.toString();
1641
1455
  }
1642
- reset(...namespace) {
1643
- this.namespaces = new Set(flatten(compact(namespace)));
1644
- return this.build();
1456
+ }
1457
+ __decorate([
1458
+ Type((type) => (+type.object.product.productId ? Variant : Product)),
1459
+ __metadata("design:type", Object)
1460
+ ], ProductErrors.prototype, "product", void 0);
1461
+
1462
+ class ProductStockNotification extends BaseModel {
1463
+ static get identifiersFields() {
1464
+ return ['id'];
1645
1465
  }
1646
- startWith(...namespace) {
1647
- const current = this.namespaces;
1648
- this.namespaces = new Set(flatten([compact(namespace), ...current]));
1649
- return this.build();
1466
+ }
1467
+
1468
+ class Wishlist extends Category {
1469
+ static get identifiersFields() {
1470
+ return ['id'];
1650
1471
  }
1651
- shift() {
1652
- const list = this.entries;
1653
- list.shift();
1654
- return this.reset(...list);
1472
+ }
1473
+
1474
+ class Buy2Win extends BaseModel {
1475
+ static get identifiersFields() {
1476
+ return ['id'];
1655
1477
  }
1656
- pop() {
1657
- const list = this.entries;
1658
- list.pop();
1659
- return this.reset(...list);
1478
+ }
1479
+ __decorate([
1480
+ Type(() => Category),
1481
+ __metadata("design:type", Array)
1482
+ ], Buy2Win.prototype, "categories", void 0);
1483
+
1484
+ var Where;
1485
+ (function (Where) {
1486
+ Where["EQUALS"] = "==";
1487
+ Where["NOTEQUALS"] = "!=";
1488
+ Where["GT"] = ">";
1489
+ Where["GTE"] = ">=";
1490
+ Where["IN"] = "in";
1491
+ Where["NOTIN"] = "not in";
1492
+ Where["LT"] = "<";
1493
+ Where["LTE"] = "<=";
1494
+ Where["LIKE"] = "like";
1495
+ Where["NOTLIKE"] = "not like";
1496
+ Where["ISNULL"] = "is null";
1497
+ Where["ISNOTNULL"] = "is not null";
1498
+ Where["IREGEX"] = "iregex";
1499
+ })(Where || (Where = {}));
1500
+
1501
+ var UpdateOptionActions;
1502
+ (function (UpdateOptionActions) {
1503
+ UpdateOptionActions["UPDATE"] = "update";
1504
+ UpdateOptionActions["MERGE"] = "merge";
1505
+ UpdateOptionActions["REMOVE"] = "remove";
1506
+ UpdateOptionActions["REMOVE_FIELD"] = "removeField";
1507
+ UpdateOptionActions["NULL"] = "null";
1508
+ })(UpdateOptionActions || (UpdateOptionActions = {}));
1509
+
1510
+ class CampaignDashboard extends BaseModel {
1511
+ static get identifiersFields() {
1512
+ return ['id'];
1660
1513
  }
1661
- clear() {
1662
- return this.reset();
1514
+ }
1515
+
1516
+ class CampaignHashtag extends BaseModel {
1517
+ static get identifiersFields() {
1518
+ return ['id'];
1663
1519
  }
1664
- remove(...namespace) {
1665
- if (namespace) {
1666
- namespace.filter((item) => Boolean(item)).forEach((item) => this.namespaces.delete(item));
1667
- }
1668
- return this.build();
1520
+ }
1521
+
1522
+ class BeautyProfile extends BaseModel {
1523
+ toPlain() {
1524
+ const plain = super.toPlain();
1525
+ delete plain.id;
1526
+ return plain;
1669
1527
  }
1670
- puts(...args) {
1671
- return [`[${this.namespace}]`, ...args].join(' ');
1528
+ static get identifiersFields() {
1529
+ return ['id', 'userId'];
1530
+ }
1531
+ }
1532
+
1533
+ var AccessoryImportances;
1534
+ (function (AccessoryImportances) {
1535
+ AccessoryImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
1536
+ AccessoryImportances["LIKE_RARELY_USE"] = "Gosto, mas uso poucos";
1537
+ AccessoryImportances["LIKE_ALWAYS_FOLLOW_FASHION"] = "Gosto muito de acess\u00F3rios e sempre procuro acompanhar a moda";
1538
+ })(AccessoryImportances || (AccessoryImportances = {}));
1539
+
1540
+ var Area;
1541
+ (function (Area) {
1542
+ Area["GP"] = "Geral";
1543
+ Area["CRM"] = "CRM";
1544
+ Area["MediaProd"] = "Media Production";
1545
+ Area["Tech"] = "Tecnologia";
1546
+ Area["Transactional"] = "Transacional";
1547
+ Area["Operations"] = "Opera\u00E7\u00F5es";
1548
+ Area["Sales"] = "Comercial";
1549
+ Area["Finantial"] = "Financeiro";
1550
+ Area["HR"] = "RH";
1551
+ })(Area || (Area = {}));
1552
+
1553
+ var BeardProblems;
1554
+ (function (BeardProblems) {
1555
+ BeardProblems["NO_PROBLEMS"] = "Sem problemas";
1556
+ BeardProblems["DRY"] = "Barba Seca";
1557
+ BeardProblems["OILY"] = "Barba Oleaosa";
1558
+ BeardProblems["DANCRUFF"] = "Barba com Caspa";
1559
+ BeardProblems["INGROWN_HAIRS"] = "P\u00EAlos Encravados";
1560
+ BeardProblems["DOESNT_GROW"] = "N\u00E3o Cresce";
1561
+ BeardProblems["SPARSE_BEARD"] = "Barba Rala";
1562
+ })(BeardProblems || (BeardProblems = {}));
1563
+
1564
+ var BeardSizes;
1565
+ (function (BeardSizes) {
1566
+ BeardSizes["BIG"] = "Grande";
1567
+ BeardSizes["MEDIUM"] = "M\u00E9dia";
1568
+ BeardSizes["SHORT"] = "Curta";
1569
+ BeardSizes["MUSTACHE"] = "Bigode";
1570
+ BeardSizes["NOTHING"] = "Sem Barba";
1571
+ })(BeardSizes || (BeardSizes = {}));
1572
+
1573
+ var BeautyProductImportances;
1574
+ (function (BeautyProductImportances) {
1575
+ BeautyProductImportances["KNOW_LITTLE_ABOUT"] = "Conhe\u00E7o bem pouco de produtos de beleza e rotinas de cuidados";
1576
+ BeautyProductImportances["ALREADY_BOUGHT_NOTHING_SPECIALIZED"] = "J\u00E1 comprei alguns produtos b\u00E1sicos para cuidar de mim, mas nada muito especializado";
1577
+ BeautyProductImportances["GOOD_CARE_MYSELF"] = "Me considero um homem que se cuida bem. Conhe\u00E7o sobre produtos especializados e me preocupo em ter uma rotina de cuidados";
1578
+ BeautyProductImportances["PERSONAL_CARE_EXPERT"] = "Sou um expert em cuidados pessoais";
1579
+ })(BeautyProductImportances || (BeautyProductImportances = {}));
1580
+
1581
+ var BodyProblems;
1582
+ (function (BodyProblems) {
1583
+ BodyProblems["NO_WORRIES"] = "Sem preocupa\u00E7\u00F5es";
1584
+ BodyProblems["FLACCIDITY"] = "Flacidez";
1585
+ BodyProblems["LOCALIZED_FAT"] = "Gordura Localizada";
1586
+ BodyProblems["STRETCH_MARKS"] = "Estrias";
1587
+ BodyProblems["SENSITIVE_SKIN"] = "Pele Sens\u00EDvel";
1588
+ BodyProblems["DRY_SKIN"] = "Pele Seca";
1589
+ BodyProblems["OILY_ACNE"] = "Oleosa/Acne";
1590
+ BodyProblems["SKIN_FRECKLES"] = "Pele com Sardas";
1591
+ BodyProblems["PHOTOSENSITIVE_SKIN"] = "Pele Fotossens\u00EDvel";
1592
+ })(BodyProblems || (BodyProblems = {}));
1593
+
1594
+ var BodyShapes;
1595
+ (function (BodyShapes) {
1596
+ BodyShapes["LEAN"] = "Magro";
1597
+ BodyShapes["REGULAR"] = "Regular";
1598
+ BodyShapes["OVERWEIGHT"] = "Acima do Peso";
1599
+ BodyShapes["ATHLETIC"] = "Atl\u00E9tico";
1600
+ BodyShapes["MUSCULAR"] = "Musculoso";
1601
+ })(BodyShapes || (BodyShapes = {}));
1602
+
1603
+ var BodyTattoos;
1604
+ (function (BodyTattoos) {
1605
+ BodyTattoos["NONE"] = "Nenhuma";
1606
+ BodyTattoos["HAS_DOESNT_CARE"] = "Tenho mas n\u00E3o cuido";
1607
+ BodyTattoos["HAS_CARE_LOT"] = "Tenho e cuido bastante";
1608
+ })(BodyTattoos || (BodyTattoos = {}));
1609
+
1610
+ var FaceSkinOilinesses;
1611
+ (function (FaceSkinOilinesses) {
1612
+ FaceSkinOilinesses["DRY"] = "Seca";
1613
+ FaceSkinOilinesses["OILY"] = "Oleaosa";
1614
+ FaceSkinOilinesses["MIXED"] = "Mista";
1615
+ FaceSkinOilinesses["NORMAL"] = "Normal";
1616
+ FaceSkinOilinesses["DONT_KNOW"] = "Eu n\u00E3o sei como dizer";
1617
+ })(FaceSkinOilinesses || (FaceSkinOilinesses = {}));
1618
+
1619
+ var FaceSkinProblems;
1620
+ (function (FaceSkinProblems) {
1621
+ FaceSkinProblems["NO_PROBLEMS"] = "Sem problemas";
1622
+ FaceSkinProblems["DARK_CIRCLES"] = "Olheiras";
1623
+ FaceSkinProblems["WRINKLES"] = "Rugas";
1624
+ FaceSkinProblems["BLACKHEADS_PIMPLES"] = "Cravos e Espinhas";
1625
+ FaceSkinProblems["STAINS"] = "Manchas";
1626
+ FaceSkinProblems["FRECKLES"] = "Sardas";
1627
+ FaceSkinProblems["SENSITIVE"] = "Sens\u00EDvel";
1628
+ FaceSkinProblems["PHOTOSENSITIVE"] = "Fotossens\u00EDvel";
1629
+ })(FaceSkinProblems || (FaceSkinProblems = {}));
1630
+
1631
+ var FaceSkinTones;
1632
+ (function (FaceSkinTones) {
1633
+ FaceSkinTones["VERY_CLEAR"] = "Muito Clara";
1634
+ FaceSkinTones["CLEAR"] = "Clara";
1635
+ FaceSkinTones["MEDIUM_LIGHT"] = "Clara M\u00E9dia";
1636
+ FaceSkinTones["MEDIUM_DARK"] = "Escura M\u00E9dia";
1637
+ FaceSkinTones["DARK"] = "Escura";
1638
+ FaceSkinTones["VERY_DARK"] = "Muito Escura";
1639
+ })(FaceSkinTones || (FaceSkinTones = {}));
1640
+
1641
+ var FamilyIncomes;
1642
+ (function (FamilyIncomes) {
1643
+ FamilyIncomes["UNTIL_3000"] = "At\u00E9 R$3.000";
1644
+ FamilyIncomes["SINCE_3001_TO_7000"] = "De R$3.001 a R$7.000";
1645
+ FamilyIncomes["SINCE_7001_TO_10000"] = "De R$7.001 a R$10.000";
1646
+ FamilyIncomes["SINCE_10001_TO_15000"] = "De R$10.001 a R$15.000";
1647
+ FamilyIncomes["GRAN_THAN_15000"] = "Mais de R$15.000";
1648
+ FamilyIncomes["NOW_ANSWER"] = "Prefiro nao responder";
1649
+ })(FamilyIncomes || (FamilyIncomes = {}));
1650
+
1651
+ var FragranceImportances;
1652
+ (function (FragranceImportances) {
1653
+ FragranceImportances["NOT_INTERESTED"] = "N\u00E3o tenho interesse";
1654
+ FragranceImportances["LIKE_ALWAYS_USE_SAME"] = "Gosto de perfumes, mas uso sempre os mesmos";
1655
+ FragranceImportances["LIKE_INNOVATE"] = "Gosto de inovar e conhecer novas fragr\u00E2ncias";
1656
+ })(FragranceImportances || (FragranceImportances = {}));
1657
+
1658
+ var HairColors;
1659
+ (function (HairColors) {
1660
+ HairColors["BLACK"] = "Preto";
1661
+ HairColors["DARK_BROWN"] = "Castanho Escuro";
1662
+ HairColors["LIGHT_BROWN"] = "Castanho Claro";
1663
+ HairColors["DARK_BLONDE"] = "Loiro Escuro";
1664
+ HairColors["LIGHT_BLONDE"] = "Loiro Claro";
1665
+ HairColors["WHITE_GRAY"] = "Branco/Grisalho";
1666
+ HairColors["REDHEAD"] = "Ruivo";
1667
+ HairColors["OTHER"] = "RuiOutroo";
1668
+ })(HairColors || (HairColors = {}));
1669
+
1670
+ var HairProblems;
1671
+ (function (HairProblems) {
1672
+ HairProblems["NO_PROBLEMS"] = "Sem problemas";
1673
+ HairProblems["DANCRUFF"] = "Caspa";
1674
+ HairProblems["LOSS"] = "Queda";
1675
+ HairProblems["OILY"] = "Oleosidade";
1676
+ HairProblems["DRYNESS"] = "Ressecamento";
1677
+ HairProblems["CHEMICAL"] = "Quimica";
1678
+ HairProblems["WHITE_HAIR"] = "Cabelos Brancos";
1679
+ HairProblems["REBEL_WIRES"] = "Fios Rebeldes";
1680
+ })(HairProblems || (HairProblems = {}));
1681
+
1682
+ var HairStrands;
1683
+ (function (HairStrands) {
1684
+ HairStrands["NORMAL"] = "Fio Normal";
1685
+ HairStrands["DRY"] = "Fio Seco";
1686
+ HairStrands["OILY"] = "Fio Oleoso";
1687
+ HairStrands["MIXED"] = "Fio Misto";
1688
+ HairStrands["FINE"] = "Fio Fino";
1689
+ HairStrands["THICK"] = "Fio Grosso";
1690
+ })(HairStrands || (HairStrands = {}));
1691
+
1692
+ var HairTypes;
1693
+ (function (HairTypes) {
1694
+ HairTypes["Smooth"] = "Liso";
1695
+ HairTypes["WAVY"] = "Ondulado";
1696
+ HairTypes["CURLY"] = "Cacheado";
1697
+ HairTypes["FRIZZY"] = "Crespo";
1698
+ HairTypes["BALD"] = "Sou careca";
1699
+ })(HairTypes || (HairTypes = {}));
1700
+
1701
+ var OfficePosition;
1702
+ (function (OfficePosition) {
1703
+ OfficePosition["Intern"] = "Estagi\u00E1rio";
1704
+ OfficePosition["Analyst"] = "Analista";
1705
+ OfficePosition["Manager"] = "Gerente";
1706
+ OfficePosition["Director"] = "Diretor";
1707
+ })(OfficePosition || (OfficePosition = {}));
1708
+
1709
+ var PersonTypes;
1710
+ (function (PersonTypes) {
1711
+ PersonTypes["GLAMGIRL"] = "glamgirl";
1712
+ PersonTypes["BFLU"] = "bflu";
1713
+ PersonTypes["NONE"] = "none";
1714
+ })(PersonTypes || (PersonTypes = {}));
1715
+
1716
+ var ProductSpents;
1717
+ (function (ProductSpents) {
1718
+ ProductSpents["UNTIL_50"] = "At\u00E9 R$50";
1719
+ ProductSpents["SINCE_51_TO_100"] = "De R$51 a R$100";
1720
+ ProductSpents["SINCE_101_TO_200"] = "De R$101 a R$200";
1721
+ ProductSpents["SINCE_201_TO_300"] = "De R$201 a R$300";
1722
+ ProductSpents["GRAN_THAN_300"] = "Mais de R$300";
1723
+ ProductSpents["NOW_ANSWER"] = "Prefiro nao responder";
1724
+ })(ProductSpents || (ProductSpents = {}));
1725
+
1726
+ var UserType;
1727
+ (function (UserType) {
1728
+ UserType["B2C"] = "Cliente Transacional";
1729
+ UserType["GlamGirl"] = "Glamgirl";
1730
+ UserType["MensBoy"] = "Mensboy";
1731
+ UserType["B2B"] = "Company";
1732
+ UserType["Collaborator"] = "Funcion\u00E1rio";
1733
+ UserType["Influencer"] = "Influencer";
1734
+ })(UserType || (UserType = {}));
1735
+
1736
+ class Lead extends BaseModel {
1737
+ static get identifiersFields() {
1738
+ return ['id'];
1672
1739
  }
1673
- }
1674
- DebugHelper.logs$ = new Subject();
1675
- DebugHelper.traces$ = new Subject();
1676
- DebugHelper.errors$ = new Subject();
1677
- DebugHelper.isDebuggable = isDebuggable;
1740
+ }
1678
1741
 
1679
- function Debug(opts) {
1680
- return function (target) {
1681
- DebugDecoratorHelper.set(target.prototype, opts);
1682
- };
1742
+ class Edition extends BaseModel {
1743
+ static get identifiersFields() {
1744
+ return ['id', 'subscriptionId'];
1745
+ }
1683
1746
  }
1684
1747
 
1685
- const ASYNC_IDENTIFIER = 'async';
1686
- function Log(options = {}) {
1687
- return Trace(Object.assign({ level: 'log' }, options));
1688
- }
1689
- function Trace(options = {}) {
1690
- return function (target, propertyKey, propertyDescriptor) {
1691
- const method = propertyDescriptor.value;
1692
- const isPromise = method.toString().includes(ASYNC_IDENTIFIER);
1693
- const args = {
1694
- options,
1695
- method,
1696
- target,
1697
- propertyKey,
1698
- propertyDescriptor,
1699
- };
1700
- propertyDescriptor.value = isPromise ? promiseTracer(args) : functionTracer(args);
1701
- return propertyDescriptor;
1702
- };
1703
- }
1704
- const traceCall = function ({ target, propertyKey, propertyDescriptor, args }) {
1705
- if (!target.debug)
1706
- target.debug = DebugHelper.for(target, propertyKey);
1707
- return target.debug.push(propertyKey).trace('called', { target, propertyKey, propertyDescriptor, args });
1708
- };
1709
- const promiseTracer = function ({ options, method, propertyKey, propertyDescriptor }) {
1710
- return function (...args) {
1711
- return new Promise((resolve, reject) => {
1712
- const debug = traceCall({ target: this, propertyDescriptor, propertyKey, args });
1713
- return method
1714
- .apply(this, args)
1715
- .then((result) => {
1716
- if (options.callbackFn) {
1717
- options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
1718
- }
1719
- if (get(options, 'level', '') === 'log') {
1720
- debug.log({ req: args, res: result === undefined ? 'void' : result });
1721
- }
1722
- return resolve(result);
1723
- })
1724
- .catch((error) => {
1725
- debug.error({ req: args, res: error, stack: error.stack });
1726
- return reject(error);
1727
- });
1728
- });
1729
- };
1730
- };
1731
- const functionTracer = function ({ options, target, method, propertyKey, propertyDescriptor, }) {
1732
- return function (...args) {
1733
- const debug = traceCall({ target: this || target, propertyDescriptor, propertyKey, args });
1734
- let result;
1735
- try {
1736
- result = method.apply(this, args);
1737
- if (options.callbackFn)
1738
- options.callbackFn({ target: this, result, args, namespace: [propertyKey] });
1739
- if (get(options, 'level', '') === 'log') {
1740
- debug.log({ req: args, res: result === undefined ? 'void' : result });
1741
- }
1742
- return result;
1743
- }
1744
- catch (error) {
1745
- if (error instanceof Error)
1746
- debug.error({ req: args, res: error, stack: error.stack });
1747
- throw error;
1748
- }
1749
- };
1750
- };
1748
+ var BillingStatus;
1749
+ (function (BillingStatus) {
1750
+ BillingStatus["PAYED"] = "PAGO";
1751
+ })(BillingStatus || (BillingStatus = {}));
1751
1752
 
1752
- function is(value) {
1753
- return value;
1754
- }
1753
+ var EditionStatus;
1754
+ (function (EditionStatus) {
1755
+ EditionStatus["ALLOCATION_WAITING"] = "Aguardando aloca\u00E7\u00E3o";
1756
+ EditionStatus["SHIPPED"] = "Enviado";
1757
+ })(EditionStatus || (EditionStatus = {}));
1755
1758
 
1756
- const isUUID = (value) => isString(value) && /[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(value);
1759
+ var PaymentType;
1760
+ (function (PaymentType) {
1761
+ PaymentType["AQUISITION"] = "Aquisi\u00E7\u00E3o";
1762
+ PaymentType["RENEWAL"] = "Renova\u00E7\u00E3o";
1763
+ PaymentType["FREIGHT"] = "mudan\u00E7a de endere\u00E7o, Frete";
1764
+ })(PaymentType || (PaymentType = {}));
1757
1765
 
1758
- class Base {
1759
- constructor(...args) {
1760
- Object.assign(this, ...args);
1761
- }
1766
+ var Plans;
1767
+ (function (Plans) {
1768
+ Plans["SELECT"] = "SELECT";
1769
+ Plans["PRIME"] = "PRIME";
1770
+ Plans["SELECT_MENSAL"] = "SELECT_MENSAL";
1771
+ Plans["PRIME_MENSAL"] = "PRIME_MENSAL";
1772
+ })(Plans || (Plans = {}));
1773
+
1774
+ var Status;
1775
+ (function (Status) {
1776
+ Status["ACTIVE"] = "active";
1777
+ Status["CANCELLED"] = "Cancelado";
1778
+ })(Status || (Status = {}));
1779
+
1780
+ class PaymentTransaction extends BaseModel {
1762
1781
  }
1763
1782
 
1764
- const parseDateTime = (value) => {
1765
- if (!isString(value))
1766
- return value;
1767
- if (!/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test(value) &&
1768
- !/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T\d{2}:\d{2}:\d{2}/.test(value))
1769
- return value;
1770
- const date = parseISO(value);
1771
- if (isNaN(date.getTime()))
1772
- return value;
1773
- return date;
1774
- };
1783
+ class Payment extends BaseModel {
1784
+ static get identifiersFields() {
1785
+ return ['id'];
1786
+ }
1787
+ }
1788
+ __decorate([
1789
+ Type(() => PaymentTransaction),
1790
+ __metadata("design:type", PaymentTransaction)
1791
+ ], Payment.prototype, "transaction", void 0);
1792
+
1793
+ class SubscriptionPayment extends BaseModel {
1794
+ static get identifiersFields() {
1795
+ return ['id', 'subscriptionId'];
1796
+ }
1797
+ }
1798
+ __decorate([
1799
+ Type(() => Payment),
1800
+ __metadata("design:type", Payment)
1801
+ ], SubscriptionPayment.prototype, "payment", void 0);
1775
1802
 
1776
1803
  class Coupon extends BaseModel {
1777
1804
  get isInfluencer() {
@@ -5006,9 +5033,6 @@ __decorate([
5006
5033
  __metadata("design:type", Product)
5007
5034
  ], KitProductHasuraGraphQL.prototype, "product", void 0);
5008
5035
 
5009
- class ProductErrorsHasuraGraphQL extends ProductErrors {
5010
- }
5011
-
5012
5036
  class ProductHasuraGraphQL extends Product {
5013
5037
  }
5014
5038
  __decorate([
@@ -5019,6 +5043,13 @@ __decorate([
5019
5043
  class VariantHasuraGraphQL extends Variant {
5020
5044
  }
5021
5045
 
5046
+ class ProductErrorsHasuraGraphQL extends ProductErrors {
5047
+ }
5048
+ __decorate([
5049
+ Type((type) => (+type.object.product.productId ? VariantHasuraGraphQL : ProductHasuraGraphQL)),
5050
+ __metadata("design:type", Object)
5051
+ ], ProductErrorsHasuraGraphQL.prototype, "product", void 0);
5052
+
5022
5053
  class CategoryCollectionChildrenHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5023
5054
  constructor({ endpoint, authOptions, interceptors, }) {
5024
5055
  super({
@@ -7385,4 +7416,4 @@ class ProductsVertexSearch {
7385
7416
  }
7386
7417
  }
7387
7418
 
7388
- export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
7419
+ export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };