@infrab4a/connect 4.2.0-beta.6 → 4.2.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.cjs.js +1026 -773
- package/index.esm.js +865 -636
- package/package.json +1 -1
- package/src/domain/catalog/models/index.d.ts +1 -0
- package/src/domain/catalog/models/product-reviews.d.ts +20 -0
- package/src/domain/catalog/models/types/shop-description.type.d.ts +1 -0
- package/src/domain/catalog/repositories/index.d.ts +1 -0
- package/src/domain/catalog/repositories/product-reviews.repository.d.ts +6 -0
- package/src/domain/shop-settings/models/types/index.d.ts +0 -3
- package/src/domain/shop-settings/models/types/sections.type.d.ts +0 -6
- package/src/domain/users/models/subscription/index.d.ts +3 -1
- package/src/domain/users/models/subscription/subscription-materialization.d.ts +31 -0
- package/src/domain/users/models/subscription/subscription-summary.d.ts +11 -0
- package/src/domain/users/models/subscription/subscription.d.ts +1 -0
- package/src/domain/users/repositories/index.d.ts +7 -5
- package/src/domain/users/repositories/subscription-materialization.repository.d.ts +4 -0
- package/src/domain/users/repositories/subscription-summary.repository.d.ts +4 -0
- package/src/infra/firebase/firestore/repositories/users/index.d.ts +2 -0
- package/src/infra/firebase/firestore/repositories/users/subscription-materialization-firestore.repository.d.ts +7 -0
- package/src/infra/firebase/firestore/repositories/users/subscription-summary-firestore.repository.d.ts +7 -0
- package/src/infra/hasura-graphql/repositories/catalog/index.d.ts +1 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-review-hasura-graphql.repository.d.ts +12 -0
- package/src/domain/shop-settings/models/types/brands-carousel.type.d.ts +0 -3
- package/src/domain/shop-settings/models/types/landing-page.d.ts +0 -8
- package/src/domain/shop-settings/models/types/promotion-page.d.ts +0 -10
package/index.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
require('reflect-metadata');
|
|
6
6
|
var classTransformer = require('class-transformer');
|
|
7
|
-
var
|
|
7
|
+
var tslib_1 = require('tslib');
|
|
8
8
|
var dateFns = require('date-fns');
|
|
9
9
|
var lodash = require('lodash');
|
|
10
10
|
var debug = require('debug');
|
|
@@ -16,6 +16,25 @@ var gqlQueryBuilder = require('gql-query-builder');
|
|
|
16
16
|
|
|
17
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
18
|
|
|
19
|
+
function _interopNamespace(e) {
|
|
20
|
+
if (e && e.__esModule) return e;
|
|
21
|
+
var n = Object.create(null);
|
|
22
|
+
if (e) {
|
|
23
|
+
Object.keys(e).forEach(function (k) {
|
|
24
|
+
if (k !== 'default') {
|
|
25
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return e[k]; }
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
n["default"] = e;
|
|
34
|
+
return Object.freeze(n);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var tslib_1__namespace = /*#__PURE__*/_interopNamespace(tslib_1);
|
|
19
38
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
20
39
|
|
|
21
40
|
class BaseModel {
|
|
@@ -262,6 +281,12 @@ exports.UserType = void 0;
|
|
|
262
281
|
UserType["Influencer"] = "Influencer";
|
|
263
282
|
})(exports.UserType || (exports.UserType = {}));
|
|
264
283
|
|
|
284
|
+
class Edition extends BaseModel {
|
|
285
|
+
static get identifiersFields() {
|
|
286
|
+
return ['id', 'subscriptionId'];
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
265
290
|
exports.BillingStatus = void 0;
|
|
266
291
|
(function (BillingStatus) {
|
|
267
292
|
BillingStatus["PAYED"] = "PAGO";
|
|
@@ -286,176 +311,170 @@ exports.Status = void 0;
|
|
|
286
311
|
Status["CANCELLED"] = "Cancelado";
|
|
287
312
|
})(exports.Status || (exports.Status = {}));
|
|
288
313
|
|
|
289
|
-
class Edition extends BaseModel {
|
|
290
|
-
static get identifiersFields() {
|
|
291
|
-
return ['id', 'subscriptionId'];
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
314
|
class Payment extends BaseModel {
|
|
296
315
|
static get identifiersFields() {
|
|
297
316
|
return ['id'];
|
|
298
317
|
}
|
|
299
318
|
}
|
|
300
|
-
|
|
319
|
+
tslib_1.__decorate([
|
|
301
320
|
classTransformer.Expose({ name: 'refuse_reason' }),
|
|
302
|
-
|
|
321
|
+
tslib_1.__metadata("design:type", String)
|
|
303
322
|
], Payment.prototype, "refuseReason", void 0);
|
|
304
|
-
|
|
323
|
+
tslib_1.__decorate([
|
|
305
324
|
classTransformer.Expose({ name: 'status_reason' }),
|
|
306
|
-
|
|
325
|
+
tslib_1.__metadata("design:type", String)
|
|
307
326
|
], Payment.prototype, "statusReason", void 0);
|
|
308
|
-
|
|
327
|
+
tslib_1.__decorate([
|
|
309
328
|
classTransformer.Expose({ name: 'acquirer_response_code' }),
|
|
310
|
-
|
|
329
|
+
tslib_1.__metadata("design:type", String)
|
|
311
330
|
], Payment.prototype, "acquirerResponseCode", void 0);
|
|
312
|
-
|
|
331
|
+
tslib_1.__decorate([
|
|
313
332
|
classTransformer.Expose({ name: 'acquirer_name' }),
|
|
314
|
-
|
|
333
|
+
tslib_1.__metadata("design:type", String)
|
|
315
334
|
], Payment.prototype, "acquirerName", void 0);
|
|
316
|
-
|
|
335
|
+
tslib_1.__decorate([
|
|
317
336
|
classTransformer.Expose({ name: 'acquirer_id' }),
|
|
318
|
-
|
|
337
|
+
tslib_1.__metadata("design:type", String)
|
|
319
338
|
], Payment.prototype, "acquirerId", void 0);
|
|
320
|
-
|
|
339
|
+
tslib_1.__decorate([
|
|
321
340
|
classTransformer.Expose({ name: 'authorization_code' }),
|
|
322
|
-
|
|
341
|
+
tslib_1.__metadata("design:type", String)
|
|
323
342
|
], Payment.prototype, "authorizationCode", void 0);
|
|
324
|
-
|
|
343
|
+
tslib_1.__decorate([
|
|
325
344
|
classTransformer.Expose({ name: 'soft_descriptor' }),
|
|
326
|
-
|
|
345
|
+
tslib_1.__metadata("design:type", String)
|
|
327
346
|
], Payment.prototype, "softDescriptor", void 0);
|
|
328
|
-
|
|
347
|
+
tslib_1.__decorate([
|
|
329
348
|
classTransformer.Expose({ name: 'date_created' }),
|
|
330
|
-
|
|
349
|
+
tslib_1.__metadata("design:type", String)
|
|
331
350
|
], Payment.prototype, "dateCreated", void 0);
|
|
332
|
-
|
|
351
|
+
tslib_1.__decorate([
|
|
333
352
|
classTransformer.Expose({ name: 'date_updated' }),
|
|
334
|
-
|
|
353
|
+
tslib_1.__metadata("design:type", String)
|
|
335
354
|
], Payment.prototype, "dateUpdated", void 0);
|
|
336
|
-
|
|
355
|
+
tslib_1.__decorate([
|
|
337
356
|
classTransformer.Expose({ name: 'authorized_amount' }),
|
|
338
|
-
|
|
357
|
+
tslib_1.__metadata("design:type", Number)
|
|
339
358
|
], Payment.prototype, "authorizedAmount", void 0);
|
|
340
|
-
|
|
359
|
+
tslib_1.__decorate([
|
|
341
360
|
classTransformer.Expose({ name: 'paid_amount' }),
|
|
342
|
-
|
|
361
|
+
tslib_1.__metadata("design:type", Number)
|
|
343
362
|
], Payment.prototype, "paidAmount", void 0);
|
|
344
|
-
|
|
363
|
+
tslib_1.__decorate([
|
|
345
364
|
classTransformer.Expose({ name: 'refunded_amount' }),
|
|
346
|
-
|
|
365
|
+
tslib_1.__metadata("design:type", Number)
|
|
347
366
|
], Payment.prototype, "refundedAmount", void 0);
|
|
348
|
-
|
|
367
|
+
tslib_1.__decorate([
|
|
349
368
|
classTransformer.Expose({ name: 'card_holder_name' }),
|
|
350
|
-
|
|
369
|
+
tslib_1.__metadata("design:type", String)
|
|
351
370
|
], Payment.prototype, "cardHolderName", void 0);
|
|
352
|
-
|
|
371
|
+
tslib_1.__decorate([
|
|
353
372
|
classTransformer.Expose({ name: 'card_last_digits' }),
|
|
354
|
-
|
|
373
|
+
tslib_1.__metadata("design:type", String)
|
|
355
374
|
], Payment.prototype, "cardLastDigits", void 0);
|
|
356
|
-
|
|
375
|
+
tslib_1.__decorate([
|
|
357
376
|
classTransformer.Expose({ name: 'card_first_digits' }),
|
|
358
|
-
|
|
377
|
+
tslib_1.__metadata("design:type", String)
|
|
359
378
|
], Payment.prototype, "cardFirstDigits", void 0);
|
|
360
|
-
|
|
379
|
+
tslib_1.__decorate([
|
|
361
380
|
classTransformer.Expose({ name: 'card_brand' }),
|
|
362
|
-
|
|
381
|
+
tslib_1.__metadata("design:type", String)
|
|
363
382
|
], Payment.prototype, "cardBrand", void 0);
|
|
364
|
-
|
|
383
|
+
tslib_1.__decorate([
|
|
365
384
|
classTransformer.Expose({ name: 'card_pin_mode' }),
|
|
366
|
-
|
|
385
|
+
tslib_1.__metadata("design:type", String)
|
|
367
386
|
], Payment.prototype, "cardPinMode", void 0);
|
|
368
|
-
|
|
387
|
+
tslib_1.__decorate([
|
|
369
388
|
classTransformer.Expose({ name: 'card_magstripe_fallback' }),
|
|
370
|
-
|
|
389
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
371
390
|
], Payment.prototype, "cardMagstripeFallback", void 0);
|
|
372
|
-
|
|
391
|
+
tslib_1.__decorate([
|
|
373
392
|
classTransformer.Expose({ name: 'cvm_pin' }),
|
|
374
|
-
|
|
393
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
375
394
|
], Payment.prototype, "cvmPin", void 0);
|
|
376
|
-
|
|
395
|
+
tslib_1.__decorate([
|
|
377
396
|
classTransformer.Expose({ name: 'postback_url' }),
|
|
378
|
-
|
|
397
|
+
tslib_1.__metadata("design:type", String)
|
|
379
398
|
], Payment.prototype, "postbackUrl", void 0);
|
|
380
|
-
|
|
399
|
+
tslib_1.__decorate([
|
|
381
400
|
classTransformer.Expose({ name: 'payment_method' }),
|
|
382
|
-
|
|
401
|
+
tslib_1.__metadata("design:type", String)
|
|
383
402
|
], Payment.prototype, "paymentMethod", void 0);
|
|
384
|
-
|
|
403
|
+
tslib_1.__decorate([
|
|
385
404
|
classTransformer.Expose({ name: 'capture_method' }),
|
|
386
|
-
|
|
405
|
+
tslib_1.__metadata("design:type", String)
|
|
387
406
|
], Payment.prototype, "captureMethod", void 0);
|
|
388
|
-
|
|
407
|
+
tslib_1.__decorate([
|
|
389
408
|
classTransformer.Expose({ name: 'antifraud_score' }),
|
|
390
|
-
|
|
409
|
+
tslib_1.__metadata("design:type", String)
|
|
391
410
|
], Payment.prototype, "antifraudScore", void 0);
|
|
392
|
-
|
|
411
|
+
tslib_1.__decorate([
|
|
393
412
|
classTransformer.Expose({ name: 'boleto_url' }),
|
|
394
|
-
|
|
413
|
+
tslib_1.__metadata("design:type", String)
|
|
395
414
|
], Payment.prototype, "boletoUrl", void 0);
|
|
396
|
-
|
|
415
|
+
tslib_1.__decorate([
|
|
397
416
|
classTransformer.Expose({ name: 'boleto_barcode' }),
|
|
398
|
-
|
|
417
|
+
tslib_1.__metadata("design:type", String)
|
|
399
418
|
], Payment.prototype, "boletoBarcode", void 0);
|
|
400
|
-
|
|
419
|
+
tslib_1.__decorate([
|
|
401
420
|
classTransformer.Expose({ name: 'boleto_expiration_date' }),
|
|
402
|
-
|
|
421
|
+
tslib_1.__metadata("design:type", String)
|
|
403
422
|
], Payment.prototype, "boletoExpirationDate", void 0);
|
|
404
|
-
|
|
423
|
+
tslib_1.__decorate([
|
|
405
424
|
classTransformer.Expose({ name: 'subscription_id' }),
|
|
406
|
-
|
|
425
|
+
tslib_1.__metadata("design:type", String)
|
|
407
426
|
], Payment.prototype, "subscriptionId", void 0);
|
|
408
|
-
|
|
427
|
+
tslib_1.__decorate([
|
|
409
428
|
classTransformer.Expose({ name: 'split_rules' }),
|
|
410
|
-
|
|
429
|
+
tslib_1.__metadata("design:type", String)
|
|
411
430
|
], Payment.prototype, "splitRules", void 0);
|
|
412
|
-
|
|
431
|
+
tslib_1.__decorate([
|
|
413
432
|
classTransformer.Expose({ name: 'antifraud_metadata' }),
|
|
414
|
-
|
|
433
|
+
tslib_1.__metadata("design:type", Object)
|
|
415
434
|
], Payment.prototype, "antifraudMetadata", void 0);
|
|
416
|
-
|
|
435
|
+
tslib_1.__decorate([
|
|
417
436
|
classTransformer.Expose({ name: 'reference_key' }),
|
|
418
|
-
|
|
437
|
+
tslib_1.__metadata("design:type", String)
|
|
419
438
|
], Payment.prototype, "referenceKey", void 0);
|
|
420
|
-
|
|
439
|
+
tslib_1.__decorate([
|
|
421
440
|
classTransformer.Expose({ name: 'local_transaction_id' }),
|
|
422
|
-
|
|
441
|
+
tslib_1.__metadata("design:type", String)
|
|
423
442
|
], Payment.prototype, "localTransactionId", void 0);
|
|
424
|
-
|
|
443
|
+
tslib_1.__decorate([
|
|
425
444
|
classTransformer.Expose({ name: 'local_time' }),
|
|
426
|
-
|
|
445
|
+
tslib_1.__metadata("design:type", String)
|
|
427
446
|
], Payment.prototype, "localTime", void 0);
|
|
428
|
-
|
|
447
|
+
tslib_1.__decorate([
|
|
429
448
|
classTransformer.Expose({ name: 'fraud_covered' }),
|
|
430
|
-
|
|
449
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
431
450
|
], Payment.prototype, "fraudCovered", void 0);
|
|
432
|
-
|
|
451
|
+
tslib_1.__decorate([
|
|
433
452
|
classTransformer.Expose({ name: 'fraud_reimbursed' }),
|
|
434
|
-
|
|
453
|
+
tslib_1.__metadata("design:type", String)
|
|
435
454
|
], Payment.prototype, "fraudReimbursed", void 0);
|
|
436
|
-
|
|
455
|
+
tslib_1.__decorate([
|
|
437
456
|
classTransformer.Expose({ name: 'order_id' }),
|
|
438
|
-
|
|
457
|
+
tslib_1.__metadata("design:type", String)
|
|
439
458
|
], Payment.prototype, "orderId", void 0);
|
|
440
|
-
|
|
459
|
+
tslib_1.__decorate([
|
|
441
460
|
classTransformer.Expose({ name: 'risk_level' }),
|
|
442
|
-
|
|
461
|
+
tslib_1.__metadata("design:type", String)
|
|
443
462
|
], Payment.prototype, "riskLevel", void 0);
|
|
444
|
-
|
|
463
|
+
tslib_1.__decorate([
|
|
445
464
|
classTransformer.Expose({ name: 'receipt_url' }),
|
|
446
|
-
|
|
465
|
+
tslib_1.__metadata("design:type", String)
|
|
447
466
|
], Payment.prototype, "receiptUrl", void 0);
|
|
448
|
-
|
|
467
|
+
tslib_1.__decorate([
|
|
449
468
|
classTransformer.Expose({ name: 'private_label' }),
|
|
450
|
-
|
|
469
|
+
tslib_1.__metadata("design:type", String)
|
|
451
470
|
], Payment.prototype, "privateLabel", void 0);
|
|
452
|
-
|
|
471
|
+
tslib_1.__decorate([
|
|
453
472
|
classTransformer.Expose({ name: 'pix_qr_code' }),
|
|
454
|
-
|
|
473
|
+
tslib_1.__metadata("design:type", String)
|
|
455
474
|
], Payment.prototype, "pixQrCode", void 0);
|
|
456
|
-
|
|
475
|
+
tslib_1.__decorate([
|
|
457
476
|
classTransformer.Expose({ name: 'pix_expiration_date' }),
|
|
458
|
-
|
|
477
|
+
tslib_1.__metadata("design:type", String)
|
|
459
478
|
], Payment.prototype, "pixExpirationDate", void 0);
|
|
460
479
|
|
|
461
480
|
class SubscriptionPayment extends BaseModel {
|
|
@@ -463,406 +482,483 @@ class SubscriptionPayment extends BaseModel {
|
|
|
463
482
|
return ['id', 'subscriptionId'];
|
|
464
483
|
}
|
|
465
484
|
}
|
|
466
|
-
|
|
485
|
+
tslib_1.__decorate([
|
|
467
486
|
classTransformer.Type(() => Payment),
|
|
468
|
-
|
|
487
|
+
tslib_1.__metadata("design:type", Payment)
|
|
469
488
|
], SubscriptionPayment.prototype, "payment", void 0);
|
|
470
489
|
|
|
471
|
-
|
|
472
|
-
|
|
490
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
491
|
+
function isFunction(x) {
|
|
492
|
+
return typeof x === 'function';
|
|
473
493
|
}
|
|
474
494
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
495
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
496
|
+
var _enable_super_gross_mode_that_will_cause_bad_things = false;
|
|
497
|
+
var config = {
|
|
498
|
+
Promise: undefined,
|
|
499
|
+
set useDeprecatedSynchronousErrorHandling(value) {
|
|
500
|
+
if (value) {
|
|
501
|
+
var error = /*@__PURE__*/ new Error();
|
|
502
|
+
/*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
|
|
503
|
+
}
|
|
504
|
+
_enable_super_gross_mode_that_will_cause_bad_things = value;
|
|
505
|
+
},
|
|
506
|
+
get useDeprecatedSynchronousErrorHandling() {
|
|
507
|
+
return _enable_super_gross_mode_that_will_cause_bad_things;
|
|
508
|
+
},
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
512
|
+
function hostReportError(err) {
|
|
513
|
+
setTimeout(function () { throw err; }, 0);
|
|
484
514
|
}
|
|
485
515
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
516
|
+
/** PURE_IMPORTS_START _config,_util_hostReportError PURE_IMPORTS_END */
|
|
517
|
+
var empty = {
|
|
518
|
+
closed: true,
|
|
519
|
+
next: function (value) { },
|
|
520
|
+
error: function (err) {
|
|
521
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
522
|
+
throw err;
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
hostReportError(err);
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
complete: function () { }
|
|
529
|
+
};
|
|
496
530
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
531
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
532
|
+
var isArray = /*@__PURE__*/ (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })();
|
|
533
|
+
|
|
534
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
535
|
+
function isObject(x) {
|
|
536
|
+
return x !== null && typeof x === 'object';
|
|
502
537
|
}
|
|
503
538
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
539
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
540
|
+
var UnsubscriptionErrorImpl = /*@__PURE__*/ (function () {
|
|
541
|
+
function UnsubscriptionErrorImpl(errors) {
|
|
542
|
+
Error.call(this);
|
|
543
|
+
this.message = errors ?
|
|
544
|
+
errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ') : '';
|
|
545
|
+
this.name = 'UnsubscriptionError';
|
|
546
|
+
this.errors = errors;
|
|
547
|
+
return this;
|
|
548
|
+
}
|
|
549
|
+
UnsubscriptionErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);
|
|
550
|
+
return UnsubscriptionErrorImpl;
|
|
551
|
+
})();
|
|
552
|
+
var UnsubscriptionError = UnsubscriptionErrorImpl;
|
|
553
|
+
|
|
554
|
+
/** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_UnsubscriptionError PURE_IMPORTS_END */
|
|
555
|
+
var Subscription$1 = /*@__PURE__*/ (function () {
|
|
556
|
+
function Subscription(unsubscribe) {
|
|
507
557
|
this.closed = false;
|
|
508
|
-
this.
|
|
509
|
-
this.
|
|
558
|
+
this._parentOrParents = null;
|
|
559
|
+
this._subscriptions = null;
|
|
560
|
+
if (unsubscribe) {
|
|
561
|
+
this._ctorUnsubscribe = true;
|
|
562
|
+
this._unsubscribe = unsubscribe;
|
|
563
|
+
}
|
|
510
564
|
}
|
|
511
565
|
Subscription.prototype.unsubscribe = function () {
|
|
512
|
-
var e_1, _a, e_2, _b;
|
|
513
566
|
var errors;
|
|
514
|
-
if (
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
try {
|
|
529
|
-
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
|
|
530
|
-
}
|
|
531
|
-
finally { if (e_1) throw e_1.error; }
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
else {
|
|
535
|
-
_parentage.remove(this);
|
|
536
|
-
}
|
|
567
|
+
if (this.closed) {
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
|
|
571
|
+
this.closed = true;
|
|
572
|
+
this._parentOrParents = null;
|
|
573
|
+
this._subscriptions = null;
|
|
574
|
+
if (_parentOrParents instanceof Subscription) {
|
|
575
|
+
_parentOrParents.remove(this);
|
|
576
|
+
}
|
|
577
|
+
else if (_parentOrParents !== null) {
|
|
578
|
+
for (var index = 0; index < _parentOrParents.length; ++index) {
|
|
579
|
+
var parent_1 = _parentOrParents[index];
|
|
580
|
+
parent_1.remove(this);
|
|
537
581
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
catch (e) {
|
|
544
|
-
errors = e instanceof UnsubscriptionError ? e.errors : [e];
|
|
545
|
-
}
|
|
582
|
+
}
|
|
583
|
+
if (isFunction(_unsubscribe)) {
|
|
584
|
+
if (_ctorUnsubscribe) {
|
|
585
|
+
this._unsubscribe = undefined;
|
|
546
586
|
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
587
|
+
try {
|
|
588
|
+
_unsubscribe.call(this);
|
|
589
|
+
}
|
|
590
|
+
catch (e) {
|
|
591
|
+
errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
if (isArray(_subscriptions)) {
|
|
595
|
+
var index = -1;
|
|
596
|
+
var len = _subscriptions.length;
|
|
597
|
+
while (++index < len) {
|
|
598
|
+
var sub = _subscriptions[index];
|
|
599
|
+
if (isObject(sub)) {
|
|
600
|
+
try {
|
|
601
|
+
sub.unsubscribe();
|
|
602
|
+
}
|
|
603
|
+
catch (e) {
|
|
604
|
+
errors = errors || [];
|
|
605
|
+
if (e instanceof UnsubscriptionError) {
|
|
606
|
+
errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
|
|
555
607
|
}
|
|
556
|
-
|
|
557
|
-
errors
|
|
558
|
-
if (err instanceof UnsubscriptionError) {
|
|
559
|
-
errors = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(errors)), tslib.__read(err.errors));
|
|
560
|
-
}
|
|
561
|
-
else {
|
|
562
|
-
errors.push(err);
|
|
563
|
-
}
|
|
608
|
+
else {
|
|
609
|
+
errors.push(e);
|
|
564
610
|
}
|
|
565
611
|
}
|
|
566
612
|
}
|
|
567
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
568
|
-
finally {
|
|
569
|
-
try {
|
|
570
|
-
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
|
|
571
|
-
}
|
|
572
|
-
finally { if (e_2) throw e_2.error; }
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
if (errors) {
|
|
576
|
-
throw new UnsubscriptionError(errors);
|
|
577
613
|
}
|
|
578
614
|
}
|
|
615
|
+
if (errors) {
|
|
616
|
+
throw new UnsubscriptionError(errors);
|
|
617
|
+
}
|
|
579
618
|
};
|
|
580
619
|
Subscription.prototype.add = function (teardown) {
|
|
581
|
-
var
|
|
582
|
-
if (teardown
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
620
|
+
var subscription = teardown;
|
|
621
|
+
if (!teardown) {
|
|
622
|
+
return Subscription.EMPTY;
|
|
623
|
+
}
|
|
624
|
+
switch (typeof teardown) {
|
|
625
|
+
case 'function':
|
|
626
|
+
subscription = new Subscription(teardown);
|
|
627
|
+
case 'object':
|
|
628
|
+
if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
|
|
629
|
+
return subscription;
|
|
630
|
+
}
|
|
631
|
+
else if (this.closed) {
|
|
632
|
+
subscription.unsubscribe();
|
|
633
|
+
return subscription;
|
|
634
|
+
}
|
|
635
|
+
else if (!(subscription instanceof Subscription)) {
|
|
636
|
+
var tmp = subscription;
|
|
637
|
+
subscription = new Subscription();
|
|
638
|
+
subscription._subscriptions = [tmp];
|
|
592
639
|
}
|
|
593
|
-
|
|
640
|
+
break;
|
|
641
|
+
default: {
|
|
642
|
+
throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
|
|
594
643
|
}
|
|
595
644
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
|
|
600
|
-
};
|
|
601
|
-
Subscription.prototype._addParent = function (parent) {
|
|
602
|
-
var _parentage = this._parentage;
|
|
603
|
-
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
604
|
-
};
|
|
605
|
-
Subscription.prototype._removeParent = function (parent) {
|
|
606
|
-
var _parentage = this._parentage;
|
|
607
|
-
if (_parentage === parent) {
|
|
608
|
-
this._parentage = null;
|
|
645
|
+
var _parentOrParents = subscription._parentOrParents;
|
|
646
|
+
if (_parentOrParents === null) {
|
|
647
|
+
subscription._parentOrParents = this;
|
|
609
648
|
}
|
|
610
|
-
else if (
|
|
611
|
-
|
|
649
|
+
else if (_parentOrParents instanceof Subscription) {
|
|
650
|
+
if (_parentOrParents === this) {
|
|
651
|
+
return subscription;
|
|
652
|
+
}
|
|
653
|
+
subscription._parentOrParents = [_parentOrParents, this];
|
|
654
|
+
}
|
|
655
|
+
else if (_parentOrParents.indexOf(this) === -1) {
|
|
656
|
+
_parentOrParents.push(this);
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
return subscription;
|
|
660
|
+
}
|
|
661
|
+
var subscriptions = this._subscriptions;
|
|
662
|
+
if (subscriptions === null) {
|
|
663
|
+
this._subscriptions = [subscription];
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
subscriptions.push(subscription);
|
|
612
667
|
}
|
|
668
|
+
return subscription;
|
|
613
669
|
};
|
|
614
|
-
Subscription.prototype.remove = function (
|
|
615
|
-
var
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
670
|
+
Subscription.prototype.remove = function (subscription) {
|
|
671
|
+
var subscriptions = this._subscriptions;
|
|
672
|
+
if (subscriptions) {
|
|
673
|
+
var subscriptionIndex = subscriptions.indexOf(subscription);
|
|
674
|
+
if (subscriptionIndex !== -1) {
|
|
675
|
+
subscriptions.splice(subscriptionIndex, 1);
|
|
676
|
+
}
|
|
619
677
|
}
|
|
620
678
|
};
|
|
621
|
-
Subscription.EMPTY = (function () {
|
|
622
|
-
var empty = new Subscription();
|
|
679
|
+
Subscription.EMPTY = (function (empty) {
|
|
623
680
|
empty.closed = true;
|
|
624
681
|
return empty;
|
|
625
|
-
}
|
|
682
|
+
}(new Subscription()));
|
|
626
683
|
return Subscription;
|
|
627
684
|
}());
|
|
628
|
-
|
|
629
|
-
function
|
|
630
|
-
return (value instanceof Subscription$1 ||
|
|
631
|
-
(value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
|
|
632
|
-
}
|
|
633
|
-
function execFinalizer(finalizer) {
|
|
634
|
-
if (isFunction(finalizer)) {
|
|
635
|
-
finalizer();
|
|
636
|
-
}
|
|
637
|
-
else {
|
|
638
|
-
finalizer.unsubscribe();
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
var config = {
|
|
643
|
-
onUnhandledError: null,
|
|
644
|
-
onStoppedNotification: null,
|
|
645
|
-
Promise: undefined,
|
|
646
|
-
useDeprecatedSynchronousErrorHandling: false,
|
|
647
|
-
useDeprecatedNextContext: false,
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
var timeoutProvider = {
|
|
651
|
-
setTimeout: function (handler, timeout) {
|
|
652
|
-
var args = [];
|
|
653
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
654
|
-
args[_i - 2] = arguments[_i];
|
|
655
|
-
}
|
|
656
|
-
var delegate = timeoutProvider.delegate;
|
|
657
|
-
if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
|
|
658
|
-
return delegate.setTimeout.apply(delegate, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
|
|
659
|
-
}
|
|
660
|
-
return setTimeout.apply(void 0, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
|
|
661
|
-
},
|
|
662
|
-
clearTimeout: function (handle) {
|
|
663
|
-
var delegate = timeoutProvider.delegate;
|
|
664
|
-
return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
|
|
665
|
-
},
|
|
666
|
-
delegate: undefined,
|
|
667
|
-
};
|
|
668
|
-
|
|
669
|
-
function reportUnhandledError(err) {
|
|
670
|
-
timeoutProvider.setTimeout(function () {
|
|
671
|
-
{
|
|
672
|
-
throw err;
|
|
673
|
-
}
|
|
674
|
-
});
|
|
685
|
+
function flattenUnsubscriptionErrors(errors) {
|
|
686
|
+
return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []);
|
|
675
687
|
}
|
|
676
688
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
var _a = context, errorThrown = _a.errorThrown, error = _a.error;
|
|
689
|
-
context = null;
|
|
690
|
-
if (errorThrown) {
|
|
691
|
-
throw error;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
else {
|
|
696
|
-
cb();
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
var Subscriber = (function (_super) {
|
|
701
|
-
tslib.__extends(Subscriber, _super);
|
|
702
|
-
function Subscriber(destination) {
|
|
689
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
690
|
+
var rxSubscriber = /*@__PURE__*/ (function () {
|
|
691
|
+
return typeof Symbol === 'function'
|
|
692
|
+
? /*@__PURE__*/ Symbol('rxSubscriber')
|
|
693
|
+
: '@@rxSubscriber_' + /*@__PURE__*/ Math.random();
|
|
694
|
+
})();
|
|
695
|
+
|
|
696
|
+
/** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */
|
|
697
|
+
var Subscriber = /*@__PURE__*/ (function (_super) {
|
|
698
|
+
tslib_1__namespace.__extends(Subscriber, _super);
|
|
699
|
+
function Subscriber(destinationOrNext, error, complete) {
|
|
703
700
|
var _this = _super.call(this) || this;
|
|
701
|
+
_this.syncErrorValue = null;
|
|
702
|
+
_this.syncErrorThrown = false;
|
|
703
|
+
_this.syncErrorThrowable = false;
|
|
704
704
|
_this.isStopped = false;
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
705
|
+
switch (arguments.length) {
|
|
706
|
+
case 0:
|
|
707
|
+
_this.destination = empty;
|
|
708
|
+
break;
|
|
709
|
+
case 1:
|
|
710
|
+
if (!destinationOrNext) {
|
|
711
|
+
_this.destination = empty;
|
|
712
|
+
break;
|
|
713
|
+
}
|
|
714
|
+
if (typeof destinationOrNext === 'object') {
|
|
715
|
+
if (destinationOrNext instanceof Subscriber) {
|
|
716
|
+
_this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
|
|
717
|
+
_this.destination = destinationOrNext;
|
|
718
|
+
destinationOrNext.add(_this);
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
_this.syncErrorThrowable = true;
|
|
722
|
+
_this.destination = new SafeSubscriber(_this, destinationOrNext);
|
|
723
|
+
}
|
|
724
|
+
break;
|
|
725
|
+
}
|
|
726
|
+
default:
|
|
727
|
+
_this.syncErrorThrowable = true;
|
|
728
|
+
_this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
|
|
729
|
+
break;
|
|
713
730
|
}
|
|
714
731
|
return _this;
|
|
715
732
|
}
|
|
733
|
+
Subscriber.prototype[rxSubscriber] = function () { return this; };
|
|
716
734
|
Subscriber.create = function (next, error, complete) {
|
|
717
|
-
|
|
735
|
+
var subscriber = new Subscriber(next, error, complete);
|
|
736
|
+
subscriber.syncErrorThrowable = false;
|
|
737
|
+
return subscriber;
|
|
718
738
|
};
|
|
719
739
|
Subscriber.prototype.next = function (value) {
|
|
720
|
-
if (this.isStopped)
|
|
721
|
-
else {
|
|
740
|
+
if (!this.isStopped) {
|
|
722
741
|
this._next(value);
|
|
723
742
|
}
|
|
724
743
|
};
|
|
725
744
|
Subscriber.prototype.error = function (err) {
|
|
726
|
-
if (this.isStopped)
|
|
727
|
-
else {
|
|
745
|
+
if (!this.isStopped) {
|
|
728
746
|
this.isStopped = true;
|
|
729
747
|
this._error(err);
|
|
730
748
|
}
|
|
731
749
|
};
|
|
732
750
|
Subscriber.prototype.complete = function () {
|
|
733
|
-
if (this.isStopped)
|
|
734
|
-
else {
|
|
751
|
+
if (!this.isStopped) {
|
|
735
752
|
this.isStopped = true;
|
|
736
753
|
this._complete();
|
|
737
754
|
}
|
|
738
755
|
};
|
|
739
756
|
Subscriber.prototype.unsubscribe = function () {
|
|
740
|
-
if (
|
|
741
|
-
|
|
742
|
-
_super.prototype.unsubscribe.call(this);
|
|
743
|
-
this.destination = null;
|
|
757
|
+
if (this.closed) {
|
|
758
|
+
return;
|
|
744
759
|
}
|
|
760
|
+
this.isStopped = true;
|
|
761
|
+
_super.prototype.unsubscribe.call(this);
|
|
745
762
|
};
|
|
746
763
|
Subscriber.prototype._next = function (value) {
|
|
747
764
|
this.destination.next(value);
|
|
748
765
|
};
|
|
749
766
|
Subscriber.prototype._error = function (err) {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}
|
|
753
|
-
finally {
|
|
754
|
-
this.unsubscribe();
|
|
755
|
-
}
|
|
767
|
+
this.destination.error(err);
|
|
768
|
+
this.unsubscribe();
|
|
756
769
|
};
|
|
757
770
|
Subscriber.prototype._complete = function () {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
771
|
+
this.destination.complete();
|
|
772
|
+
this.unsubscribe();
|
|
773
|
+
};
|
|
774
|
+
Subscriber.prototype._unsubscribeAndRecycle = function () {
|
|
775
|
+
var _parentOrParents = this._parentOrParents;
|
|
776
|
+
this._parentOrParents = null;
|
|
777
|
+
this.unsubscribe();
|
|
778
|
+
this.closed = false;
|
|
779
|
+
this.isStopped = false;
|
|
780
|
+
this._parentOrParents = _parentOrParents;
|
|
781
|
+
return this;
|
|
764
782
|
};
|
|
765
783
|
return Subscriber;
|
|
766
784
|
}(Subscription$1));
|
|
767
|
-
var
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
785
|
+
var SafeSubscriber = /*@__PURE__*/ (function (_super) {
|
|
786
|
+
tslib_1__namespace.__extends(SafeSubscriber, _super);
|
|
787
|
+
function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
|
|
788
|
+
var _this = _super.call(this) || this;
|
|
789
|
+
_this._parentSubscriber = _parentSubscriber;
|
|
790
|
+
var next;
|
|
791
|
+
var context = _this;
|
|
792
|
+
if (isFunction(observerOrNext)) {
|
|
793
|
+
next = observerOrNext;
|
|
794
|
+
}
|
|
795
|
+
else if (observerOrNext) {
|
|
796
|
+
next = observerOrNext.next;
|
|
797
|
+
error = observerOrNext.error;
|
|
798
|
+
complete = observerOrNext.complete;
|
|
799
|
+
if (observerOrNext !== empty) {
|
|
800
|
+
context = Object.create(observerOrNext);
|
|
801
|
+
if (isFunction(context.unsubscribe)) {
|
|
802
|
+
_this.add(context.unsubscribe.bind(context));
|
|
803
|
+
}
|
|
804
|
+
context.unsubscribe = _this.unsubscribe.bind(_this);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
_this._context = context;
|
|
808
|
+
_this._next = next;
|
|
809
|
+
_this._error = error;
|
|
810
|
+
_this._complete = complete;
|
|
811
|
+
return _this;
|
|
774
812
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
813
|
+
SafeSubscriber.prototype.next = function (value) {
|
|
814
|
+
if (!this.isStopped && this._next) {
|
|
815
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
816
|
+
if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
817
|
+
this.__tryOrUnsub(this._next, value);
|
|
780
818
|
}
|
|
781
|
-
|
|
782
|
-
|
|
819
|
+
else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
|
|
820
|
+
this.unsubscribe();
|
|
783
821
|
}
|
|
784
822
|
}
|
|
785
823
|
};
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
824
|
+
SafeSubscriber.prototype.error = function (err) {
|
|
825
|
+
if (!this.isStopped) {
|
|
826
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
827
|
+
var useDeprecatedSynchronousErrorHandling = config.useDeprecatedSynchronousErrorHandling;
|
|
828
|
+
if (this._error) {
|
|
829
|
+
if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
830
|
+
this.__tryOrUnsub(this._error, err);
|
|
831
|
+
this.unsubscribe();
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
this.__tryOrSetError(_parentSubscriber, this._error, err);
|
|
835
|
+
this.unsubscribe();
|
|
836
|
+
}
|
|
791
837
|
}
|
|
792
|
-
|
|
793
|
-
|
|
838
|
+
else if (!_parentSubscriber.syncErrorThrowable) {
|
|
839
|
+
this.unsubscribe();
|
|
840
|
+
if (useDeprecatedSynchronousErrorHandling) {
|
|
841
|
+
throw err;
|
|
842
|
+
}
|
|
843
|
+
hostReportError(err);
|
|
844
|
+
}
|
|
845
|
+
else {
|
|
846
|
+
if (useDeprecatedSynchronousErrorHandling) {
|
|
847
|
+
_parentSubscriber.syncErrorValue = err;
|
|
848
|
+
_parentSubscriber.syncErrorThrown = true;
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
hostReportError(err);
|
|
852
|
+
}
|
|
853
|
+
this.unsubscribe();
|
|
794
854
|
}
|
|
795
855
|
}
|
|
796
|
-
|
|
797
|
-
|
|
856
|
+
};
|
|
857
|
+
SafeSubscriber.prototype.complete = function () {
|
|
858
|
+
var _this = this;
|
|
859
|
+
if (!this.isStopped) {
|
|
860
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
861
|
+
if (this._complete) {
|
|
862
|
+
var wrappedComplete = function () { return _this._complete.call(_this._context); };
|
|
863
|
+
if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
|
|
864
|
+
this.__tryOrUnsub(wrappedComplete);
|
|
865
|
+
this.unsubscribe();
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
this.__tryOrSetError(_parentSubscriber, wrappedComplete);
|
|
869
|
+
this.unsubscribe();
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
else {
|
|
873
|
+
this.unsubscribe();
|
|
874
|
+
}
|
|
798
875
|
}
|
|
799
876
|
};
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
877
|
+
SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
|
|
878
|
+
try {
|
|
879
|
+
fn.call(this._context, value);
|
|
880
|
+
}
|
|
881
|
+
catch (err) {
|
|
882
|
+
this.unsubscribe();
|
|
883
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
884
|
+
throw err;
|
|
805
885
|
}
|
|
806
|
-
|
|
807
|
-
|
|
886
|
+
else {
|
|
887
|
+
hostReportError(err);
|
|
808
888
|
}
|
|
809
889
|
}
|
|
810
890
|
};
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
tslib.__extends(SafeSubscriber, _super);
|
|
815
|
-
function SafeSubscriber(observerOrNext, error, complete) {
|
|
816
|
-
var _this = _super.call(this) || this;
|
|
817
|
-
var partialObserver;
|
|
818
|
-
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
819
|
-
partialObserver = {
|
|
820
|
-
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
821
|
-
error: error !== null && error !== void 0 ? error : undefined,
|
|
822
|
-
complete: complete !== null && complete !== void 0 ? complete : undefined,
|
|
823
|
-
};
|
|
891
|
+
SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
|
|
892
|
+
if (!config.useDeprecatedSynchronousErrorHandling) {
|
|
893
|
+
throw new Error('bad call');
|
|
824
894
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
|
|
834
|
-
};
|
|
895
|
+
try {
|
|
896
|
+
fn.call(this._context, value);
|
|
897
|
+
}
|
|
898
|
+
catch (err) {
|
|
899
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
900
|
+
parent.syncErrorValue = err;
|
|
901
|
+
parent.syncErrorThrown = true;
|
|
902
|
+
return true;
|
|
835
903
|
}
|
|
836
904
|
else {
|
|
837
|
-
|
|
905
|
+
hostReportError(err);
|
|
906
|
+
return true;
|
|
838
907
|
}
|
|
839
908
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
909
|
+
return false;
|
|
910
|
+
};
|
|
911
|
+
SafeSubscriber.prototype._unsubscribe = function () {
|
|
912
|
+
var _parentSubscriber = this._parentSubscriber;
|
|
913
|
+
this._context = null;
|
|
914
|
+
this._parentSubscriber = null;
|
|
915
|
+
_parentSubscriber.unsubscribe();
|
|
916
|
+
};
|
|
843
917
|
return SafeSubscriber;
|
|
844
918
|
}(Subscriber));
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
919
|
+
|
|
920
|
+
/** PURE_IMPORTS_START _Subscriber PURE_IMPORTS_END */
|
|
921
|
+
function canReportError(observer) {
|
|
922
|
+
while (observer) {
|
|
923
|
+
var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped;
|
|
924
|
+
if (closed_1 || isStopped) {
|
|
925
|
+
return false;
|
|
926
|
+
}
|
|
927
|
+
else if (destination && destination instanceof Subscriber) {
|
|
928
|
+
observer = destination;
|
|
929
|
+
}
|
|
930
|
+
else {
|
|
931
|
+
observer = null;
|
|
932
|
+
}
|
|
848
933
|
}
|
|
934
|
+
return true;
|
|
849
935
|
}
|
|
850
|
-
|
|
851
|
-
|
|
936
|
+
|
|
937
|
+
/** PURE_IMPORTS_START _Subscriber,_symbol_rxSubscriber,_Observer PURE_IMPORTS_END */
|
|
938
|
+
function toSubscriber(nextOrObserver, error, complete) {
|
|
939
|
+
if (nextOrObserver) {
|
|
940
|
+
if (nextOrObserver instanceof Subscriber) {
|
|
941
|
+
return nextOrObserver;
|
|
942
|
+
}
|
|
943
|
+
if (nextOrObserver[rxSubscriber]) {
|
|
944
|
+
return nextOrObserver[rxSubscriber]();
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
if (!nextOrObserver && !error && !complete) {
|
|
948
|
+
return new Subscriber(empty);
|
|
949
|
+
}
|
|
950
|
+
return new Subscriber(nextOrObserver, error, complete);
|
|
852
951
|
}
|
|
853
|
-
var EMPTY_OBSERVER = {
|
|
854
|
-
closed: true,
|
|
855
|
-
next: noop,
|
|
856
|
-
error: defaultErrorHandler,
|
|
857
|
-
complete: noop,
|
|
858
|
-
};
|
|
859
952
|
|
|
860
|
-
|
|
953
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
954
|
+
var observable = /*@__PURE__*/ (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })();
|
|
861
955
|
|
|
956
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
862
957
|
function identity(x) {
|
|
863
958
|
return x;
|
|
864
959
|
}
|
|
865
960
|
|
|
961
|
+
/** PURE_IMPORTS_START _identity PURE_IMPORTS_END */
|
|
866
962
|
function pipeFromArray(fns) {
|
|
867
963
|
if (fns.length === 0) {
|
|
868
964
|
return identity;
|
|
@@ -875,8 +971,10 @@ function pipeFromArray(fns) {
|
|
|
875
971
|
};
|
|
876
972
|
}
|
|
877
973
|
|
|
878
|
-
|
|
974
|
+
/** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */
|
|
975
|
+
var Observable = /*@__PURE__*/ (function () {
|
|
879
976
|
function Observable(subscribe) {
|
|
977
|
+
this._isScalar = false;
|
|
880
978
|
if (subscribe) {
|
|
881
979
|
this._subscribe = subscribe;
|
|
882
980
|
}
|
|
@@ -888,52 +986,64 @@ var Observable = (function () {
|
|
|
888
986
|
return observable;
|
|
889
987
|
};
|
|
890
988
|
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
|
|
891
|
-
var
|
|
892
|
-
var
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
:
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
989
|
+
var operator = this.operator;
|
|
990
|
+
var sink = toSubscriber(observerOrNext, error, complete);
|
|
991
|
+
if (operator) {
|
|
992
|
+
sink.add(operator.call(sink, this.source));
|
|
993
|
+
}
|
|
994
|
+
else {
|
|
995
|
+
sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
|
|
996
|
+
this._subscribe(sink) :
|
|
997
|
+
this._trySubscribe(sink));
|
|
998
|
+
}
|
|
999
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
1000
|
+
if (sink.syncErrorThrowable) {
|
|
1001
|
+
sink.syncErrorThrowable = false;
|
|
1002
|
+
if (sink.syncErrorThrown) {
|
|
1003
|
+
throw sink.syncErrorValue;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
return sink;
|
|
905
1008
|
};
|
|
906
1009
|
Observable.prototype._trySubscribe = function (sink) {
|
|
907
1010
|
try {
|
|
908
1011
|
return this._subscribe(sink);
|
|
909
1012
|
}
|
|
910
1013
|
catch (err) {
|
|
911
|
-
|
|
1014
|
+
if (config.useDeprecatedSynchronousErrorHandling) {
|
|
1015
|
+
sink.syncErrorThrown = true;
|
|
1016
|
+
sink.syncErrorValue = err;
|
|
1017
|
+
}
|
|
1018
|
+
if (canReportError(sink)) {
|
|
1019
|
+
sink.error(err);
|
|
1020
|
+
}
|
|
1021
|
+
else {
|
|
1022
|
+
console.warn(err);
|
|
1023
|
+
}
|
|
912
1024
|
}
|
|
913
1025
|
};
|
|
914
1026
|
Observable.prototype.forEach = function (next, promiseCtor) {
|
|
915
1027
|
var _this = this;
|
|
916
1028
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
917
1029
|
return new promiseCtor(function (resolve, reject) {
|
|
918
|
-
var
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1030
|
+
var subscription;
|
|
1031
|
+
subscription = _this.subscribe(function (value) {
|
|
1032
|
+
try {
|
|
1033
|
+
next(value);
|
|
1034
|
+
}
|
|
1035
|
+
catch (err) {
|
|
1036
|
+
reject(err);
|
|
1037
|
+
if (subscription) {
|
|
1038
|
+
subscription.unsubscribe();
|
|
926
1039
|
}
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
complete: resolve,
|
|
930
|
-
});
|
|
931
|
-
_this.subscribe(subscriber);
|
|
1040
|
+
}
|
|
1041
|
+
}, reject, resolve);
|
|
932
1042
|
});
|
|
933
1043
|
};
|
|
934
1044
|
Observable.prototype._subscribe = function (subscriber) {
|
|
935
|
-
var
|
|
936
|
-
return
|
|
1045
|
+
var source = this.source;
|
|
1046
|
+
return source && source.subscribe(subscriber);
|
|
937
1047
|
};
|
|
938
1048
|
Observable.prototype[observable] = function () {
|
|
939
1049
|
return this;
|
|
@@ -943,6 +1053,9 @@ var Observable = (function () {
|
|
|
943
1053
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
944
1054
|
operations[_i] = arguments[_i];
|
|
945
1055
|
}
|
|
1056
|
+
if (operations.length === 0) {
|
|
1057
|
+
return this;
|
|
1058
|
+
}
|
|
946
1059
|
return pipeFromArray(operations)(this);
|
|
947
1060
|
};
|
|
948
1061
|
Observable.prototype.toPromise = function (promiseCtor) {
|
|
@@ -950,7 +1063,7 @@ var Observable = (function () {
|
|
|
950
1063
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
951
1064
|
return new promiseCtor(function (resolve, reject) {
|
|
952
1065
|
var value;
|
|
953
|
-
_this.subscribe(function (x) { return
|
|
1066
|
+
_this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
|
|
954
1067
|
});
|
|
955
1068
|
};
|
|
956
1069
|
Observable.create = function (subscribe) {
|
|
@@ -959,139 +1072,155 @@ var Observable = (function () {
|
|
|
959
1072
|
return Observable;
|
|
960
1073
|
}());
|
|
961
1074
|
function getPromiseCtor(promiseCtor) {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
|
|
1075
|
+
if (!promiseCtor) {
|
|
1076
|
+
promiseCtor = config.Promise || Promise;
|
|
1077
|
+
}
|
|
1078
|
+
if (!promiseCtor) {
|
|
1079
|
+
throw new Error('no Promise impl found');
|
|
1080
|
+
}
|
|
1081
|
+
return promiseCtor;
|
|
970
1082
|
}
|
|
971
1083
|
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
this
|
|
1084
|
+
/** PURE_IMPORTS_START PURE_IMPORTS_END */
|
|
1085
|
+
var ObjectUnsubscribedErrorImpl = /*@__PURE__*/ (function () {
|
|
1086
|
+
function ObjectUnsubscribedErrorImpl() {
|
|
1087
|
+
Error.call(this);
|
|
976
1088
|
this.message = 'object unsubscribed';
|
|
1089
|
+
this.name = 'ObjectUnsubscribedError';
|
|
1090
|
+
return this;
|
|
1091
|
+
}
|
|
1092
|
+
ObjectUnsubscribedErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);
|
|
1093
|
+
return ObjectUnsubscribedErrorImpl;
|
|
1094
|
+
})();
|
|
1095
|
+
var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl;
|
|
1096
|
+
|
|
1097
|
+
/** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */
|
|
1098
|
+
var SubjectSubscription = /*@__PURE__*/ (function (_super) {
|
|
1099
|
+
tslib_1__namespace.__extends(SubjectSubscription, _super);
|
|
1100
|
+
function SubjectSubscription(subject, subscriber) {
|
|
1101
|
+
var _this = _super.call(this) || this;
|
|
1102
|
+
_this.subject = subject;
|
|
1103
|
+
_this.subscriber = subscriber;
|
|
1104
|
+
_this.closed = false;
|
|
1105
|
+
return _this;
|
|
1106
|
+
}
|
|
1107
|
+
SubjectSubscription.prototype.unsubscribe = function () {
|
|
1108
|
+
if (this.closed) {
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
this.closed = true;
|
|
1112
|
+
var subject = this.subject;
|
|
1113
|
+
var observers = subject.observers;
|
|
1114
|
+
this.subject = null;
|
|
1115
|
+
if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
var subscriberIndex = observers.indexOf(this.subscriber);
|
|
1119
|
+
if (subscriberIndex !== -1) {
|
|
1120
|
+
observers.splice(subscriberIndex, 1);
|
|
1121
|
+
}
|
|
977
1122
|
};
|
|
978
|
-
|
|
1123
|
+
return SubjectSubscription;
|
|
1124
|
+
}(Subscription$1));
|
|
979
1125
|
|
|
980
|
-
|
|
981
|
-
|
|
1126
|
+
/** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */
|
|
1127
|
+
var SubjectSubscriber = /*@__PURE__*/ (function (_super) {
|
|
1128
|
+
tslib_1__namespace.__extends(SubjectSubscriber, _super);
|
|
1129
|
+
function SubjectSubscriber(destination) {
|
|
1130
|
+
var _this = _super.call(this, destination) || this;
|
|
1131
|
+
_this.destination = destination;
|
|
1132
|
+
return _this;
|
|
1133
|
+
}
|
|
1134
|
+
return SubjectSubscriber;
|
|
1135
|
+
}(Subscriber));
|
|
1136
|
+
var Subject = /*@__PURE__*/ (function (_super) {
|
|
1137
|
+
tslib_1__namespace.__extends(Subject, _super);
|
|
982
1138
|
function Subject() {
|
|
983
1139
|
var _this = _super.call(this) || this;
|
|
984
|
-
_this.closed = false;
|
|
985
|
-
_this.currentObservers = null;
|
|
986
1140
|
_this.observers = [];
|
|
1141
|
+
_this.closed = false;
|
|
987
1142
|
_this.isStopped = false;
|
|
988
1143
|
_this.hasError = false;
|
|
989
1144
|
_this.thrownError = null;
|
|
990
1145
|
return _this;
|
|
991
1146
|
}
|
|
1147
|
+
Subject.prototype[rxSubscriber] = function () {
|
|
1148
|
+
return new SubjectSubscriber(this);
|
|
1149
|
+
};
|
|
992
1150
|
Subject.prototype.lift = function (operator) {
|
|
993
1151
|
var subject = new AnonymousSubject(this, this);
|
|
994
1152
|
subject.operator = operator;
|
|
995
1153
|
return subject;
|
|
996
1154
|
};
|
|
997
|
-
Subject.prototype.
|
|
1155
|
+
Subject.prototype.next = function (value) {
|
|
998
1156
|
if (this.closed) {
|
|
999
1157
|
throw new ObjectUnsubscribedError();
|
|
1000
1158
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
var
|
|
1006
|
-
|
|
1007
|
-
if (!_this.isStopped) {
|
|
1008
|
-
if (!_this.currentObservers) {
|
|
1009
|
-
_this.currentObservers = Array.from(_this.observers);
|
|
1010
|
-
}
|
|
1011
|
-
try {
|
|
1012
|
-
for (var _b = tslib.__values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1013
|
-
var observer = _c.value;
|
|
1014
|
-
observer.next(value);
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1018
|
-
finally {
|
|
1019
|
-
try {
|
|
1020
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1021
|
-
}
|
|
1022
|
-
finally { if (e_1) throw e_1.error; }
|
|
1023
|
-
}
|
|
1159
|
+
if (!this.isStopped) {
|
|
1160
|
+
var observers = this.observers;
|
|
1161
|
+
var len = observers.length;
|
|
1162
|
+
var copy = observers.slice();
|
|
1163
|
+
for (var i = 0; i < len; i++) {
|
|
1164
|
+
copy[i].next(value);
|
|
1024
1165
|
}
|
|
1025
|
-
}
|
|
1166
|
+
}
|
|
1026
1167
|
};
|
|
1027
1168
|
Subject.prototype.error = function (err) {
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
}
|
|
1169
|
+
if (this.closed) {
|
|
1170
|
+
throw new ObjectUnsubscribedError();
|
|
1171
|
+
}
|
|
1172
|
+
this.hasError = true;
|
|
1173
|
+
this.thrownError = err;
|
|
1174
|
+
this.isStopped = true;
|
|
1175
|
+
var observers = this.observers;
|
|
1176
|
+
var len = observers.length;
|
|
1177
|
+
var copy = observers.slice();
|
|
1178
|
+
for (var i = 0; i < len; i++) {
|
|
1179
|
+
copy[i].error(err);
|
|
1180
|
+
}
|
|
1181
|
+
this.observers.length = 0;
|
|
1040
1182
|
};
|
|
1041
1183
|
Subject.prototype.complete = function () {
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1184
|
+
if (this.closed) {
|
|
1185
|
+
throw new ObjectUnsubscribedError();
|
|
1186
|
+
}
|
|
1187
|
+
this.isStopped = true;
|
|
1188
|
+
var observers = this.observers;
|
|
1189
|
+
var len = observers.length;
|
|
1190
|
+
var copy = observers.slice();
|
|
1191
|
+
for (var i = 0; i < len; i++) {
|
|
1192
|
+
copy[i].complete();
|
|
1193
|
+
}
|
|
1194
|
+
this.observers.length = 0;
|
|
1053
1195
|
};
|
|
1054
1196
|
Subject.prototype.unsubscribe = function () {
|
|
1055
|
-
this.isStopped =
|
|
1056
|
-
this.
|
|
1197
|
+
this.isStopped = true;
|
|
1198
|
+
this.closed = true;
|
|
1199
|
+
this.observers = null;
|
|
1057
1200
|
};
|
|
1058
|
-
Object.defineProperty(Subject.prototype, "observed", {
|
|
1059
|
-
get: function () {
|
|
1060
|
-
var _a;
|
|
1061
|
-
return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
1062
|
-
},
|
|
1063
|
-
enumerable: false,
|
|
1064
|
-
configurable: true
|
|
1065
|
-
});
|
|
1066
1201
|
Subject.prototype._trySubscribe = function (subscriber) {
|
|
1067
|
-
this.
|
|
1068
|
-
|
|
1202
|
+
if (this.closed) {
|
|
1203
|
+
throw new ObjectUnsubscribedError();
|
|
1204
|
+
}
|
|
1205
|
+
else {
|
|
1206
|
+
return _super.prototype._trySubscribe.call(this, subscriber);
|
|
1207
|
+
}
|
|
1069
1208
|
};
|
|
1070
1209
|
Subject.prototype._subscribe = function (subscriber) {
|
|
1071
|
-
this.
|
|
1072
|
-
|
|
1073
|
-
return this._innerSubscribe(subscriber);
|
|
1074
|
-
};
|
|
1075
|
-
Subject.prototype._innerSubscribe = function (subscriber) {
|
|
1076
|
-
var _this = this;
|
|
1077
|
-
var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
|
|
1078
|
-
if (hasError || isStopped) {
|
|
1079
|
-
return EMPTY_SUBSCRIPTION;
|
|
1210
|
+
if (this.closed) {
|
|
1211
|
+
throw new ObjectUnsubscribedError();
|
|
1080
1212
|
}
|
|
1081
|
-
this.
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
_this.currentObservers = null;
|
|
1085
|
-
arrRemove(observers, subscriber);
|
|
1086
|
-
});
|
|
1087
|
-
};
|
|
1088
|
-
Subject.prototype._checkFinalizedStatuses = function (subscriber) {
|
|
1089
|
-
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
|
|
1090
|
-
if (hasError) {
|
|
1091
|
-
subscriber.error(thrownError);
|
|
1213
|
+
else if (this.hasError) {
|
|
1214
|
+
subscriber.error(this.thrownError);
|
|
1215
|
+
return Subscription$1.EMPTY;
|
|
1092
1216
|
}
|
|
1093
|
-
else if (isStopped) {
|
|
1217
|
+
else if (this.isStopped) {
|
|
1094
1218
|
subscriber.complete();
|
|
1219
|
+
return Subscription$1.EMPTY;
|
|
1220
|
+
}
|
|
1221
|
+
else {
|
|
1222
|
+
this.observers.push(subscriber);
|
|
1223
|
+
return new SubjectSubscription(this, subscriber);
|
|
1095
1224
|
}
|
|
1096
1225
|
};
|
|
1097
1226
|
Subject.prototype.asObservable = function () {
|
|
@@ -1104,8 +1233,8 @@ var Subject = (function (_super) {
|
|
|
1104
1233
|
};
|
|
1105
1234
|
return Subject;
|
|
1106
1235
|
}(Observable));
|
|
1107
|
-
var AnonymousSubject = (function (_super) {
|
|
1108
|
-
|
|
1236
|
+
var AnonymousSubject = /*@__PURE__*/ (function (_super) {
|
|
1237
|
+
tslib_1__namespace.__extends(AnonymousSubject, _super);
|
|
1109
1238
|
function AnonymousSubject(destination, source) {
|
|
1110
1239
|
var _this = _super.call(this) || this;
|
|
1111
1240
|
_this.destination = destination;
|
|
@@ -1113,20 +1242,31 @@ var AnonymousSubject = (function (_super) {
|
|
|
1113
1242
|
return _this;
|
|
1114
1243
|
}
|
|
1115
1244
|
AnonymousSubject.prototype.next = function (value) {
|
|
1116
|
-
var
|
|
1117
|
-
|
|
1245
|
+
var destination = this.destination;
|
|
1246
|
+
if (destination && destination.next) {
|
|
1247
|
+
destination.next(value);
|
|
1248
|
+
}
|
|
1118
1249
|
};
|
|
1119
1250
|
AnonymousSubject.prototype.error = function (err) {
|
|
1120
|
-
var
|
|
1121
|
-
|
|
1251
|
+
var destination = this.destination;
|
|
1252
|
+
if (destination && destination.error) {
|
|
1253
|
+
this.destination.error(err);
|
|
1254
|
+
}
|
|
1122
1255
|
};
|
|
1123
1256
|
AnonymousSubject.prototype.complete = function () {
|
|
1124
|
-
var
|
|
1125
|
-
|
|
1257
|
+
var destination = this.destination;
|
|
1258
|
+
if (destination && destination.complete) {
|
|
1259
|
+
this.destination.complete();
|
|
1260
|
+
}
|
|
1126
1261
|
};
|
|
1127
1262
|
AnonymousSubject.prototype._subscribe = function (subscriber) {
|
|
1128
|
-
var
|
|
1129
|
-
|
|
1263
|
+
var source = this.source;
|
|
1264
|
+
if (source) {
|
|
1265
|
+
return this.source.subscribe(subscriber);
|
|
1266
|
+
}
|
|
1267
|
+
else {
|
|
1268
|
+
return Subscription$1.EMPTY;
|
|
1269
|
+
}
|
|
1130
1270
|
};
|
|
1131
1271
|
return AnonymousSubject;
|
|
1132
1272
|
}(Subject));
|
|
@@ -1654,199 +1794,90 @@ class Coupon extends BaseModel {
|
|
|
1654
1794
|
}
|
|
1655
1795
|
}
|
|
1656
1796
|
|
|
1657
|
-
class SubscriptionPlan extends BaseModel {
|
|
1658
|
-
static get identifiersFields() {
|
|
1659
|
-
return ['id'];
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
class BeautyProfile extends BaseModel {
|
|
1664
|
-
toPlain() {
|
|
1665
|
-
const plain = super.toPlain();
|
|
1666
|
-
delete plain.id;
|
|
1667
|
-
return plain;
|
|
1668
|
-
}
|
|
1669
|
-
static get identifiersFields() {
|
|
1670
|
-
return ['id', 'userId'];
|
|
1671
|
-
}
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
class User extends BaseModel {
|
|
1675
|
-
static toInstance(data) {
|
|
1676
|
-
const instance = super.toInstance(data);
|
|
1677
|
-
if (!lodash.isNil(data.firstName))
|
|
1678
|
-
instance.displayName = `${data.firstName}${!lodash.isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
|
|
1679
|
-
return instance;
|
|
1680
|
-
}
|
|
1681
|
-
toPlain() {
|
|
1682
|
-
const plain = super.toPlain();
|
|
1683
|
-
delete plain.beautyProfile;
|
|
1684
|
-
return plain;
|
|
1685
|
-
}
|
|
1686
|
-
static get identifiersFields() {
|
|
1687
|
-
return ['id'];
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
tslib.__decorate([
|
|
1691
|
-
classTransformer.Type(() => BeautyProfile),
|
|
1692
|
-
tslib.__metadata("design:type", BeautyProfile)
|
|
1693
|
-
], User.prototype, "beautyProfile", void 0);
|
|
1694
|
-
|
|
1695
|
-
class Address extends BaseModel {
|
|
1696
|
-
static get identifiersFields() {
|
|
1697
|
-
return ['id'];
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
|
|
1701
|
-
class UserAddress extends Address {
|
|
1702
|
-
static get identifiersFields() {
|
|
1703
|
-
return ['id', 'userId'];
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
class Subscription extends BaseModel {
|
|
1708
|
-
static get identifiersFields() {
|
|
1709
|
-
return ['id'];
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
tslib.__decorate([
|
|
1713
|
-
classTransformer.Type(() => User),
|
|
1714
|
-
tslib.__metadata("design:type", User)
|
|
1715
|
-
], Subscription.prototype, "user", void 0);
|
|
1716
|
-
tslib.__decorate([
|
|
1717
|
-
classTransformer.Type(() => SubscriptionPlan),
|
|
1718
|
-
tslib.__metadata("design:type", SubscriptionPlan)
|
|
1719
|
-
], Subscription.prototype, "subscriptionPlan", void 0);
|
|
1720
|
-
tslib.__decorate([
|
|
1721
|
-
classTransformer.Type(() => UserAddress),
|
|
1722
|
-
tslib.__metadata("design:type", UserAddress)
|
|
1723
|
-
], Subscription.prototype, "shippingAddress", void 0);
|
|
1724
|
-
tslib.__decorate([
|
|
1725
|
-
classTransformer.Type(() => UserAddress),
|
|
1726
|
-
tslib.__metadata("design:type", UserAddress)
|
|
1727
|
-
], Subscription.prototype, "billingAddress", void 0);
|
|
1728
|
-
tslib.__decorate([
|
|
1729
|
-
classTransformer.Type(() => Coupon),
|
|
1730
|
-
tslib.__metadata("design:type", Coupon)
|
|
1731
|
-
], Subscription.prototype, "coupon", void 0);
|
|
1732
|
-
tslib.__decorate([
|
|
1733
|
-
classTransformer.Type(() => Edition),
|
|
1734
|
-
tslib.__metadata("design:type", Array)
|
|
1735
|
-
], Subscription.prototype, "editions", void 0);
|
|
1736
|
-
tslib.__decorate([
|
|
1737
|
-
classTransformer.Type(() => SubscriptionPayment),
|
|
1738
|
-
tslib.__metadata("design:type", Array)
|
|
1739
|
-
], Subscription.prototype, "payment", void 0);
|
|
1740
|
-
|
|
1741
|
-
class UserPaymentMethod extends BaseModel {
|
|
1742
|
-
static get identifiersFields() {
|
|
1743
|
-
return ['id', 'userId'];
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
class Lead extends BaseModel {
|
|
1748
|
-
static get identifiersFields() {
|
|
1749
|
-
return ['id'];
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
|
|
1753
|
-
class UnauthorizedError extends tsCustomError.CustomError {
|
|
1754
|
-
constructor(message) {
|
|
1755
|
-
super(message);
|
|
1756
|
-
}
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
exports.SignInMethods = void 0;
|
|
1760
|
-
(function (SignInMethods) {
|
|
1761
|
-
SignInMethods["EMAIL_PASSWORD"] = "email_password";
|
|
1762
|
-
SignInMethods["GOOGLE"] = "google";
|
|
1763
|
-
})(exports.SignInMethods || (exports.SignInMethods = {}));
|
|
1764
|
-
class Authentication {
|
|
1765
|
-
constructor(authService, userRepository) {
|
|
1766
|
-
this.authService = authService;
|
|
1767
|
-
this.userRepository = userRepository;
|
|
1768
|
-
}
|
|
1769
|
-
async signIn({ email, password }, signInMethod) {
|
|
1770
|
-
const method = this.getServiceByMethod(signInMethod);
|
|
1771
|
-
const userAuth = await this.authService[method]({ email, password });
|
|
1772
|
-
const user = this.userRepository.get({ id: userAuth.id });
|
|
1773
|
-
if (!lodash.isNil(user))
|
|
1774
|
-
return user;
|
|
1775
|
-
if (/^.+@b4a.com.br$/.test(userAuth.email))
|
|
1776
|
-
return this.createsUserByCredential(userAuth);
|
|
1777
|
-
throw new UnauthorizedError('Invalid credentials');
|
|
1778
|
-
}
|
|
1779
|
-
getServiceByMethod(signInMethod) {
|
|
1780
|
-
return signInMethod === exports.SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
|
|
1781
|
-
}
|
|
1782
|
-
async createsUserByCredential(user) {
|
|
1783
|
-
var _a;
|
|
1784
|
-
const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
|
|
1785
|
-
const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
|
|
1786
|
-
lastName, acceptsNewsletter: false, area: exports.Area.Transactional, officePosition: exports.OfficePosition.Intern, type: exports.UserType.Collaborator }));
|
|
1787
|
-
return this.userRepository.create(person);
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
class UserAlreadyRegisteredError extends tsCustomError.CustomError {
|
|
1792
|
-
constructor(message) {
|
|
1793
|
-
super(message);
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
class WeakPasswordError extends tsCustomError.CustomError {
|
|
1798
|
-
constructor(message = 'Weak password') {
|
|
1799
|
-
super(message);
|
|
1797
|
+
class SubscriptionPlan extends BaseModel {
|
|
1798
|
+
static get identifiersFields() {
|
|
1799
|
+
return ['id'];
|
|
1800
1800
|
}
|
|
1801
1801
|
}
|
|
1802
1802
|
|
|
1803
|
-
class
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1803
|
+
class BeautyProfile extends BaseModel {
|
|
1804
|
+
toPlain() {
|
|
1805
|
+
const plain = super.toPlain();
|
|
1806
|
+
delete plain.id;
|
|
1807
|
+
return plain;
|
|
1807
1808
|
}
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
const displayName = `${params.firstName} ${params.lastName}`;
|
|
1811
|
-
if (await this.userRepository.checkIfExistsByField('cpf', params.cpf))
|
|
1812
|
-
throw new UserAlreadyRegisteredError(`Usuário com CPF ${params.cpf} já registrado.`);
|
|
1813
|
-
if (await this.userRepository.checkIfExistsByField('email', params.email))
|
|
1814
|
-
throw new UserAlreadyRegisteredError(`Usuário com e-mail ${params.email} já registrado.`);
|
|
1815
|
-
const auth = await this.registerService.register({
|
|
1816
|
-
birthday: params.birthday,
|
|
1817
|
-
email,
|
|
1818
|
-
firstName: params.firstName,
|
|
1819
|
-
lastName: params.lastName,
|
|
1820
|
-
cpf: params.cpf,
|
|
1821
|
-
displayName,
|
|
1822
|
-
phone: params.phone,
|
|
1823
|
-
password: params.password,
|
|
1824
|
-
});
|
|
1825
|
-
delete params.password;
|
|
1826
|
-
const user = await this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email,
|
|
1827
|
-
displayName, type: exports.UserType.B2C, dateCreated: new Date(), dateModified: new Date() }));
|
|
1828
|
-
return user;
|
|
1809
|
+
static get identifiersFields() {
|
|
1810
|
+
return ['id', 'userId'];
|
|
1829
1811
|
}
|
|
1830
1812
|
}
|
|
1831
1813
|
|
|
1832
|
-
class
|
|
1833
|
-
|
|
1834
|
-
|
|
1814
|
+
class User extends BaseModel {
|
|
1815
|
+
static toInstance(data) {
|
|
1816
|
+
const instance = super.toInstance(data);
|
|
1817
|
+
if (!lodash.isNil(data.firstName))
|
|
1818
|
+
instance.displayName = `${data.firstName}${!lodash.isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
|
|
1819
|
+
return instance;
|
|
1835
1820
|
}
|
|
1836
|
-
|
|
1837
|
-
|
|
1821
|
+
toPlain() {
|
|
1822
|
+
const plain = super.toPlain();
|
|
1823
|
+
delete plain.beautyProfile;
|
|
1824
|
+
return plain;
|
|
1838
1825
|
}
|
|
1839
|
-
|
|
1826
|
+
static get identifiersFields() {
|
|
1827
|
+
return ['id'];
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
tslib_1.__decorate([
|
|
1831
|
+
classTransformer.Type(() => BeautyProfile),
|
|
1832
|
+
tslib_1.__metadata("design:type", BeautyProfile)
|
|
1833
|
+
], User.prototype, "beautyProfile", void 0);
|
|
1840
1834
|
|
|
1841
|
-
class
|
|
1842
|
-
|
|
1843
|
-
|
|
1835
|
+
class Address extends BaseModel {
|
|
1836
|
+
static get identifiersFields() {
|
|
1837
|
+
return ['id'];
|
|
1844
1838
|
}
|
|
1845
|
-
|
|
1846
|
-
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
class UserAddress extends Address {
|
|
1842
|
+
static get identifiersFields() {
|
|
1843
|
+
return ['id', 'userId'];
|
|
1847
1844
|
}
|
|
1848
1845
|
}
|
|
1849
1846
|
|
|
1847
|
+
class Subscription extends BaseModel {
|
|
1848
|
+
static get identifiersFields() {
|
|
1849
|
+
return ['id'];
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
tslib_1.__decorate([
|
|
1853
|
+
classTransformer.Type(() => User),
|
|
1854
|
+
tslib_1.__metadata("design:type", User)
|
|
1855
|
+
], Subscription.prototype, "user", void 0);
|
|
1856
|
+
tslib_1.__decorate([
|
|
1857
|
+
classTransformer.Type(() => SubscriptionPlan),
|
|
1858
|
+
tslib_1.__metadata("design:type", SubscriptionPlan)
|
|
1859
|
+
], Subscription.prototype, "subscriptionPlan", void 0);
|
|
1860
|
+
tslib_1.__decorate([
|
|
1861
|
+
classTransformer.Type(() => UserAddress),
|
|
1862
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
1863
|
+
], Subscription.prototype, "shippingAddress", void 0);
|
|
1864
|
+
tslib_1.__decorate([
|
|
1865
|
+
classTransformer.Type(() => UserAddress),
|
|
1866
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
1867
|
+
], Subscription.prototype, "billingAddress", void 0);
|
|
1868
|
+
tslib_1.__decorate([
|
|
1869
|
+
classTransformer.Type(() => Coupon),
|
|
1870
|
+
tslib_1.__metadata("design:type", Coupon)
|
|
1871
|
+
], Subscription.prototype, "coupon", void 0);
|
|
1872
|
+
tslib_1.__decorate([
|
|
1873
|
+
classTransformer.Type(() => Edition),
|
|
1874
|
+
tslib_1.__metadata("design:type", Array)
|
|
1875
|
+
], Subscription.prototype, "editions", void 0);
|
|
1876
|
+
tslib_1.__decorate([
|
|
1877
|
+
classTransformer.Type(() => SubscriptionPayment),
|
|
1878
|
+
tslib_1.__metadata("design:type", Array)
|
|
1879
|
+
], Subscription.prototype, "payment", void 0);
|
|
1880
|
+
|
|
1850
1881
|
class Filter extends BaseModel {
|
|
1851
1882
|
static get identifiersFields() {
|
|
1852
1883
|
return ['id'];
|
|
@@ -1858,13 +1889,13 @@ class CategoryBase extends BaseModel {
|
|
|
1858
1889
|
return ['id'];
|
|
1859
1890
|
}
|
|
1860
1891
|
}
|
|
1861
|
-
|
|
1892
|
+
tslib_1.__decorate([
|
|
1862
1893
|
classTransformer.Type(() => CategoryBase),
|
|
1863
|
-
|
|
1894
|
+
tslib_1.__metadata("design:type", CategoryBase)
|
|
1864
1895
|
], CategoryBase.prototype, "parent", void 0);
|
|
1865
|
-
|
|
1896
|
+
tslib_1.__decorate([
|
|
1866
1897
|
classTransformer.Type(() => Filter),
|
|
1867
|
-
|
|
1898
|
+
tslib_1.__metadata("design:type", Array)
|
|
1868
1899
|
], CategoryBase.prototype, "filters", void 0);
|
|
1869
1900
|
|
|
1870
1901
|
class CategoryForProduct extends CategoryBase {
|
|
@@ -1902,9 +1933,9 @@ class ProductForKit extends ProductBase {
|
|
|
1902
1933
|
return ['id'];
|
|
1903
1934
|
}
|
|
1904
1935
|
}
|
|
1905
|
-
|
|
1936
|
+
tslib_1.__decorate([
|
|
1906
1937
|
classTransformer.Type(() => CategoryForProduct),
|
|
1907
|
-
|
|
1938
|
+
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
1908
1939
|
], ProductForKit.prototype, "category", void 0);
|
|
1909
1940
|
|
|
1910
1941
|
class KitProduct extends BaseModel {
|
|
@@ -1912,13 +1943,13 @@ class KitProduct extends BaseModel {
|
|
|
1912
1943
|
return ['productId', 'kitProductId'];
|
|
1913
1944
|
}
|
|
1914
1945
|
}
|
|
1915
|
-
|
|
1946
|
+
tslib_1.__decorate([
|
|
1916
1947
|
classTransformer.Type(() => ProductForKit),
|
|
1917
|
-
|
|
1948
|
+
tslib_1.__metadata("design:type", ProductForKit)
|
|
1918
1949
|
], KitProduct.prototype, "kit", void 0);
|
|
1919
|
-
|
|
1950
|
+
tslib_1.__decorate([
|
|
1920
1951
|
classTransformer.Type(() => ProductForKit),
|
|
1921
|
-
|
|
1952
|
+
tslib_1.__metadata("design:type", ProductForKit)
|
|
1922
1953
|
], KitProduct.prototype, "product", void 0);
|
|
1923
1954
|
|
|
1924
1955
|
class ProductForCategory extends ProductBase {
|
|
@@ -1926,9 +1957,9 @@ class ProductForCategory extends ProductBase {
|
|
|
1926
1957
|
return ['id'];
|
|
1927
1958
|
}
|
|
1928
1959
|
}
|
|
1929
|
-
|
|
1960
|
+
tslib_1.__decorate([
|
|
1930
1961
|
classTransformer.Type(() => KitProduct),
|
|
1931
|
-
|
|
1962
|
+
tslib_1.__metadata("design:type", Array)
|
|
1932
1963
|
], ProductForCategory.prototype, "kitProducts", void 0);
|
|
1933
1964
|
|
|
1934
1965
|
class Category extends CategoryBase {
|
|
@@ -1936,9 +1967,9 @@ class Category extends CategoryBase {
|
|
|
1936
1967
|
return ['id'];
|
|
1937
1968
|
}
|
|
1938
1969
|
}
|
|
1939
|
-
|
|
1970
|
+
tslib_1.__decorate([
|
|
1940
1971
|
classTransformer.Type(() => ProductForCategory),
|
|
1941
|
-
|
|
1972
|
+
tslib_1.__metadata("design:type", Array)
|
|
1942
1973
|
], Category.prototype, "childrenProducts", void 0);
|
|
1943
1974
|
|
|
1944
1975
|
class CategoryCollectionChildren extends BaseModel {
|
|
@@ -1946,9 +1977,9 @@ class CategoryCollectionChildren extends BaseModel {
|
|
|
1946
1977
|
return ['collectionId', 'categoryId'];
|
|
1947
1978
|
}
|
|
1948
1979
|
}
|
|
1949
|
-
|
|
1980
|
+
tslib_1.__decorate([
|
|
1950
1981
|
classTransformer.Type(() => CategoryCollectionChildren),
|
|
1951
|
-
|
|
1982
|
+
tslib_1.__metadata("design:type", CategoryCollectionChildren)
|
|
1952
1983
|
], CategoryCollectionChildren.prototype, "parent", void 0);
|
|
1953
1984
|
|
|
1954
1985
|
class CategoryFilter extends BaseModel {
|
|
@@ -1956,13 +1987,13 @@ class CategoryFilter extends BaseModel {
|
|
|
1956
1987
|
return ['id'];
|
|
1957
1988
|
}
|
|
1958
1989
|
}
|
|
1959
|
-
|
|
1990
|
+
tslib_1.__decorate([
|
|
1960
1991
|
classTransformer.Type(() => Filter),
|
|
1961
|
-
|
|
1992
|
+
tslib_1.__metadata("design:type", Filter)
|
|
1962
1993
|
], CategoryFilter.prototype, "filter", void 0);
|
|
1963
|
-
|
|
1994
|
+
tslib_1.__decorate([
|
|
1964
1995
|
classTransformer.Type(() => Category),
|
|
1965
|
-
|
|
1996
|
+
tslib_1.__metadata("design:type", Category)
|
|
1966
1997
|
], CategoryFilter.prototype, "category", void 0);
|
|
1967
1998
|
|
|
1968
1999
|
exports.GenderDestination = void 0;
|
|
@@ -1991,15 +2022,21 @@ class Product extends ProductBase {
|
|
|
1991
2022
|
return ['id'];
|
|
1992
2023
|
}
|
|
1993
2024
|
}
|
|
1994
|
-
|
|
2025
|
+
tslib_1.__decorate([
|
|
1995
2026
|
classTransformer.Type(() => CategoryForProduct),
|
|
1996
|
-
|
|
2027
|
+
tslib_1.__metadata("design:type", CategoryForProduct)
|
|
1997
2028
|
], Product.prototype, "category", void 0);
|
|
1998
|
-
|
|
2029
|
+
tslib_1.__decorate([
|
|
1999
2030
|
classTransformer.Type(() => KitProduct),
|
|
2000
|
-
|
|
2031
|
+
tslib_1.__metadata("design:type", Array)
|
|
2001
2032
|
], Product.prototype, "kitProducts", void 0);
|
|
2002
2033
|
|
|
2034
|
+
class ProductReviews extends BaseModel {
|
|
2035
|
+
static get identifiersFields() {
|
|
2036
|
+
return ['id'];
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2003
2040
|
class Variant extends BaseModel {
|
|
2004
2041
|
static get identifiersFields() {
|
|
2005
2042
|
return ['id', 'productId'];
|
|
@@ -2017,9 +2054,9 @@ class Buy2Win extends BaseModel {
|
|
|
2017
2054
|
return ['id'];
|
|
2018
2055
|
}
|
|
2019
2056
|
}
|
|
2020
|
-
|
|
2057
|
+
tslib_1.__decorate([
|
|
2021
2058
|
classTransformer.Type(() => Category),
|
|
2022
|
-
|
|
2059
|
+
tslib_1.__metadata("design:type", Array)
|
|
2023
2060
|
], Buy2Win.prototype, "categories", void 0);
|
|
2024
2061
|
|
|
2025
2062
|
class CampaignDashboard extends BaseModel {
|
|
@@ -2048,29 +2085,29 @@ class Checkout extends BaseModel {
|
|
|
2048
2085
|
return ['id'];
|
|
2049
2086
|
}
|
|
2050
2087
|
}
|
|
2051
|
-
|
|
2088
|
+
tslib_1.__decorate([
|
|
2052
2089
|
classTransformer.Type(() => LineItem),
|
|
2053
|
-
|
|
2090
|
+
tslib_1.__metadata("design:type", Array)
|
|
2054
2091
|
], Checkout.prototype, "lineItems", void 0);
|
|
2055
|
-
|
|
2092
|
+
tslib_1.__decorate([
|
|
2056
2093
|
classTransformer.Type(() => User),
|
|
2057
|
-
|
|
2094
|
+
tslib_1.__metadata("design:type", User)
|
|
2058
2095
|
], Checkout.prototype, "user", void 0);
|
|
2059
|
-
|
|
2096
|
+
tslib_1.__decorate([
|
|
2060
2097
|
classTransformer.Type(() => UserAddress),
|
|
2061
|
-
|
|
2098
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2062
2099
|
], Checkout.prototype, "shippingAddress", void 0);
|
|
2063
|
-
|
|
2100
|
+
tslib_1.__decorate([
|
|
2064
2101
|
classTransformer.Type(() => UserAddress),
|
|
2065
|
-
|
|
2102
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2066
2103
|
], Checkout.prototype, "billingAddress", void 0);
|
|
2067
|
-
|
|
2104
|
+
tslib_1.__decorate([
|
|
2068
2105
|
classTransformer.Type(() => ShippingMethod),
|
|
2069
|
-
|
|
2106
|
+
tslib_1.__metadata("design:type", ShippingMethod)
|
|
2070
2107
|
], Checkout.prototype, "shipping", void 0);
|
|
2071
|
-
|
|
2108
|
+
tslib_1.__decorate([
|
|
2072
2109
|
classTransformer.Type(() => Coupon),
|
|
2073
|
-
|
|
2110
|
+
tslib_1.__metadata("design:type", Coupon)
|
|
2074
2111
|
], Checkout.prototype, "coupon", void 0);
|
|
2075
2112
|
|
|
2076
2113
|
exports.OrderStatus = void 0;
|
|
@@ -2087,9 +2124,9 @@ exports.OrderStatus = void 0;
|
|
|
2087
2124
|
|
|
2088
2125
|
class Order extends Checkout {
|
|
2089
2126
|
}
|
|
2090
|
-
|
|
2127
|
+
tslib_1.__decorate([
|
|
2091
2128
|
classTransformer.Type(() => Payment),
|
|
2092
|
-
|
|
2129
|
+
tslib_1.__metadata("design:type", Payment)
|
|
2093
2130
|
], Order.prototype, "payment", void 0);
|
|
2094
2131
|
|
|
2095
2132
|
class CheckoutSubscription extends BaseModel {
|
|
@@ -2097,23 +2134,172 @@ class CheckoutSubscription extends BaseModel {
|
|
|
2097
2134
|
return ['id'];
|
|
2098
2135
|
}
|
|
2099
2136
|
}
|
|
2100
|
-
|
|
2137
|
+
tslib_1.__decorate([
|
|
2101
2138
|
classTransformer.Type(() => UserAddress),
|
|
2102
|
-
|
|
2139
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2103
2140
|
], CheckoutSubscription.prototype, "shippingAddress", void 0);
|
|
2104
|
-
|
|
2141
|
+
tslib_1.__decorate([
|
|
2105
2142
|
classTransformer.Type(() => UserAddress),
|
|
2106
|
-
|
|
2143
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2107
2144
|
], CheckoutSubscription.prototype, "billingAddress", void 0);
|
|
2108
|
-
|
|
2145
|
+
tslib_1.__decorate([
|
|
2109
2146
|
classTransformer.Type(() => SubscriptionPlan),
|
|
2110
|
-
|
|
2147
|
+
tslib_1.__metadata("design:type", SubscriptionPlan)
|
|
2111
2148
|
], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
|
|
2112
|
-
|
|
2149
|
+
tslib_1.__decorate([
|
|
2113
2150
|
classTransformer.Type(() => Coupon),
|
|
2114
|
-
|
|
2151
|
+
tslib_1.__metadata("design:type", Coupon)
|
|
2115
2152
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
2116
2153
|
|
|
2154
|
+
class SubscriptionMaterialization extends BaseModel {
|
|
2155
|
+
static get identifiersFields() {
|
|
2156
|
+
return ['id'];
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
tslib_1.__decorate([
|
|
2160
|
+
classTransformer.Type(() => User),
|
|
2161
|
+
tslib_1.__metadata("design:type", User)
|
|
2162
|
+
], SubscriptionMaterialization.prototype, "user", void 0);
|
|
2163
|
+
tslib_1.__decorate([
|
|
2164
|
+
classTransformer.Type(() => SubscriptionPlan),
|
|
2165
|
+
tslib_1.__metadata("design:type", SubscriptionPlan)
|
|
2166
|
+
], SubscriptionMaterialization.prototype, "subscriptionPlan", void 0);
|
|
2167
|
+
tslib_1.__decorate([
|
|
2168
|
+
classTransformer.Type(() => UserAddress),
|
|
2169
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2170
|
+
], SubscriptionMaterialization.prototype, "shippingAddress", void 0);
|
|
2171
|
+
tslib_1.__decorate([
|
|
2172
|
+
classTransformer.Type(() => UserAddress),
|
|
2173
|
+
tslib_1.__metadata("design:type", UserAddress)
|
|
2174
|
+
], SubscriptionMaterialization.prototype, "billingAddress", void 0);
|
|
2175
|
+
tslib_1.__decorate([
|
|
2176
|
+
classTransformer.Type(() => Coupon),
|
|
2177
|
+
tslib_1.__metadata("design:type", Coupon)
|
|
2178
|
+
], SubscriptionMaterialization.prototype, "coupon", void 0);
|
|
2179
|
+
tslib_1.__decorate([
|
|
2180
|
+
classTransformer.Type(() => Edition),
|
|
2181
|
+
tslib_1.__metadata("design:type", Array)
|
|
2182
|
+
], SubscriptionMaterialization.prototype, "editions", void 0);
|
|
2183
|
+
tslib_1.__decorate([
|
|
2184
|
+
classTransformer.Type(() => SubscriptionPayment),
|
|
2185
|
+
tslib_1.__metadata("design:type", SubscriptionPayment)
|
|
2186
|
+
], SubscriptionMaterialization.prototype, "payment", void 0);
|
|
2187
|
+
|
|
2188
|
+
class SubscriptionSummary extends BaseModel {
|
|
2189
|
+
static get identifiersFields() {
|
|
2190
|
+
return ['id'];
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
|
|
2194
|
+
class UserPaymentMethod extends BaseModel {
|
|
2195
|
+
static get identifiersFields() {
|
|
2196
|
+
return ['id', 'userId'];
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
class Lead extends BaseModel {
|
|
2201
|
+
static get identifiersFields() {
|
|
2202
|
+
return ['id'];
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
class UnauthorizedError extends tsCustomError.CustomError {
|
|
2207
|
+
constructor(message) {
|
|
2208
|
+
super(message);
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
exports.SignInMethods = void 0;
|
|
2213
|
+
(function (SignInMethods) {
|
|
2214
|
+
SignInMethods["EMAIL_PASSWORD"] = "email_password";
|
|
2215
|
+
SignInMethods["GOOGLE"] = "google";
|
|
2216
|
+
})(exports.SignInMethods || (exports.SignInMethods = {}));
|
|
2217
|
+
class Authentication {
|
|
2218
|
+
constructor(authService, userRepository) {
|
|
2219
|
+
this.authService = authService;
|
|
2220
|
+
this.userRepository = userRepository;
|
|
2221
|
+
}
|
|
2222
|
+
async signIn({ email, password }, signInMethod) {
|
|
2223
|
+
const method = this.getServiceByMethod(signInMethod);
|
|
2224
|
+
const userAuth = await this.authService[method]({ email, password });
|
|
2225
|
+
const user = this.userRepository.get({ id: userAuth.id });
|
|
2226
|
+
if (!lodash.isNil(user))
|
|
2227
|
+
return user;
|
|
2228
|
+
if (/^.+@b4a.com.br$/.test(userAuth.email))
|
|
2229
|
+
return this.createsUserByCredential(userAuth);
|
|
2230
|
+
throw new UnauthorizedError('Invalid credentials');
|
|
2231
|
+
}
|
|
2232
|
+
getServiceByMethod(signInMethod) {
|
|
2233
|
+
return signInMethod === exports.SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
|
|
2234
|
+
}
|
|
2235
|
+
async createsUserByCredential(user) {
|
|
2236
|
+
var _a;
|
|
2237
|
+
const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
|
|
2238
|
+
const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
|
|
2239
|
+
lastName, acceptsNewsletter: false, area: exports.Area.Transactional, officePosition: exports.OfficePosition.Intern, type: exports.UserType.Collaborator }));
|
|
2240
|
+
return this.userRepository.create(person);
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
class UserAlreadyRegisteredError extends tsCustomError.CustomError {
|
|
2245
|
+
constructor(message) {
|
|
2246
|
+
super(message);
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
class WeakPasswordError extends tsCustomError.CustomError {
|
|
2251
|
+
constructor(message = 'Weak password') {
|
|
2252
|
+
super(message);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
class Register {
|
|
2257
|
+
constructor(registerService, userRepository) {
|
|
2258
|
+
this.registerService = registerService;
|
|
2259
|
+
this.userRepository = userRepository;
|
|
2260
|
+
}
|
|
2261
|
+
async register(params) {
|
|
2262
|
+
const email = params.email.toLocaleLowerCase();
|
|
2263
|
+
const displayName = `${params.firstName} ${params.lastName}`;
|
|
2264
|
+
if (await this.userRepository.checkIfExistsByField('cpf', params.cpf))
|
|
2265
|
+
throw new UserAlreadyRegisteredError(`Usuário com CPF ${params.cpf} já registrado.`);
|
|
2266
|
+
if (await this.userRepository.checkIfExistsByField('email', params.email))
|
|
2267
|
+
throw new UserAlreadyRegisteredError(`Usuário com e-mail ${params.email} já registrado.`);
|
|
2268
|
+
const auth = await this.registerService.register({
|
|
2269
|
+
birthday: params.birthday,
|
|
2270
|
+
email,
|
|
2271
|
+
firstName: params.firstName,
|
|
2272
|
+
lastName: params.lastName,
|
|
2273
|
+
cpf: params.cpf,
|
|
2274
|
+
displayName,
|
|
2275
|
+
phone: params.phone,
|
|
2276
|
+
password: params.password,
|
|
2277
|
+
});
|
|
2278
|
+
delete params.password;
|
|
2279
|
+
const user = await this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email,
|
|
2280
|
+
displayName, type: exports.UserType.B2C, dateCreated: new Date(), dateModified: new Date() }));
|
|
2281
|
+
return user;
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
class SignOut {
|
|
2286
|
+
constructor(authService) {
|
|
2287
|
+
this.authService = authService;
|
|
2288
|
+
}
|
|
2289
|
+
async signOut() {
|
|
2290
|
+
await this.authService.signOut();
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
class RecoveryPassword {
|
|
2295
|
+
constructor(authService) {
|
|
2296
|
+
this.authService = authService;
|
|
2297
|
+
}
|
|
2298
|
+
async sendEmail(email) {
|
|
2299
|
+
await this.authService.sendPasswordResetEmail(email);
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2117
2303
|
class RoundProductPricesHelper {
|
|
2118
2304
|
static roundProductPrices(product) {
|
|
2119
2305
|
product.price.price = Number(product.price.price.toFixed(2));
|
|
@@ -2422,7 +2608,7 @@ class ProductsIndex {
|
|
|
2422
2608
|
}
|
|
2423
2609
|
async save(product) {
|
|
2424
2610
|
try {
|
|
2425
|
-
const { createdAt, updatedAt, kitProducts } = product, data =
|
|
2611
|
+
const { createdAt, updatedAt, kitProducts } = product, data = tslib_1.__rest(product, ["createdAt", "updatedAt", "kitProducts"]);
|
|
2426
2612
|
this.adapter.save(this.index, data);
|
|
2427
2613
|
}
|
|
2428
2614
|
catch (error) {
|
|
@@ -2822,6 +3008,17 @@ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(with
|
|
|
2822
3008
|
}
|
|
2823
3009
|
}
|
|
2824
3010
|
|
|
3011
|
+
class SubscriptionMaterializationFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3012
|
+
constructor({ firestore, interceptors }) {
|
|
3013
|
+
super({
|
|
3014
|
+
firestore,
|
|
3015
|
+
collectionName: 'subscriptionMaterialization',
|
|
3016
|
+
model: SubscriptionMaterialization,
|
|
3017
|
+
interceptors,
|
|
3018
|
+
});
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
|
|
2825
3022
|
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2826
3023
|
constructor({ firestore, interceptors }, parentRepository) {
|
|
2827
3024
|
super({
|
|
@@ -2835,6 +3032,17 @@ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudF
|
|
|
2835
3032
|
}
|
|
2836
3033
|
}
|
|
2837
3034
|
|
|
3035
|
+
class SubscriptionSummaryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3036
|
+
constructor({ firestore, interceptors, }) {
|
|
3037
|
+
super({
|
|
3038
|
+
firestore,
|
|
3039
|
+
collectionName: 'subscriptionSummary',
|
|
3040
|
+
model: SubscriptionSummary,
|
|
3041
|
+
interceptors,
|
|
3042
|
+
});
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
|
|
2838
3046
|
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
2839
3047
|
constructor({ firestore, interceptors }, parentRepository) {
|
|
2840
3048
|
super({
|
|
@@ -3999,20 +4207,20 @@ class CategoryHasuraGraphQL extends Category {
|
|
|
3999
4207
|
|
|
4000
4208
|
class ProductHasuraGraphQL extends Product {
|
|
4001
4209
|
}
|
|
4002
|
-
|
|
4210
|
+
tslib_1.__decorate([
|
|
4003
4211
|
classTransformer.Type(() => KitProductHasuraGraphQL),
|
|
4004
|
-
|
|
4212
|
+
tslib_1.__metadata("design:type", Array)
|
|
4005
4213
|
], ProductHasuraGraphQL.prototype, "kitProducts", void 0);
|
|
4006
4214
|
|
|
4007
4215
|
class KitProductHasuraGraphQL extends KitProduct {
|
|
4008
4216
|
}
|
|
4009
|
-
|
|
4217
|
+
tslib_1.__decorate([
|
|
4010
4218
|
classTransformer.Type(() => ProductHasuraGraphQL),
|
|
4011
|
-
|
|
4219
|
+
tslib_1.__metadata("design:type", ProductHasuraGraphQL)
|
|
4012
4220
|
], KitProductHasuraGraphQL.prototype, "kit", void 0);
|
|
4013
|
-
|
|
4221
|
+
tslib_1.__decorate([
|
|
4014
4222
|
classTransformer.Type(() => ProductHasuraGraphQL),
|
|
4015
|
-
|
|
4223
|
+
tslib_1.__metadata("design:type", ProductHasuraGraphQL)
|
|
4016
4224
|
], KitProductHasuraGraphQL.prototype, "product", void 0);
|
|
4017
4225
|
|
|
4018
4226
|
class VariantHasuraGraphQL extends Variant {
|
|
@@ -4254,7 +4462,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4254
4462
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
4255
4463
|
}
|
|
4256
4464
|
async create(params) {
|
|
4257
|
-
const { metadata } = params, data =
|
|
4465
|
+
const { metadata } = params, data = tslib_1.__rest(params, ["metadata"]);
|
|
4258
4466
|
return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
|
|
4259
4467
|
}
|
|
4260
4468
|
async get(identifiers) {
|
|
@@ -4264,7 +4472,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
4264
4472
|
: super.get(identifiers);
|
|
4265
4473
|
}
|
|
4266
4474
|
async update(params) {
|
|
4267
|
-
const { products, id: checkId, metadata, filters } = params, data =
|
|
4475
|
+
const { products, id: checkId, metadata, filters } = params, data = tslib_1.__rest(params, ["products", "id", "metadata", "filters"]);
|
|
4268
4476
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
4269
4477
|
const id = await this.getId(plainData.id);
|
|
4270
4478
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: false }));
|
|
@@ -4516,7 +4724,7 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
|
|
|
4516
4724
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
4517
4725
|
}
|
|
4518
4726
|
async update(params) {
|
|
4519
|
-
const { options } = params, data =
|
|
4727
|
+
const { options } = params, data = tslib_1.__rest(params, ["options"]);
|
|
4520
4728
|
const filter = await super.update(data);
|
|
4521
4729
|
filter.options = await this.updateOptions(+data.id, { options });
|
|
4522
4730
|
return filter;
|
|
@@ -4652,9 +4860,10 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4652
4860
|
howToUse: data.how_to_use,
|
|
4653
4861
|
brand: data.brand_description,
|
|
4654
4862
|
ingredients: data.ingredients,
|
|
4863
|
+
purpose: data.purpose,
|
|
4655
4864
|
}),
|
|
4656
4865
|
bindFindFilter: (filters) => {
|
|
4657
|
-
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((filters === null || filters === void 0 ? void 0 : filters.description) && { description: filters.description })), (filters.differentials && { differentials: filters.differentials })), (filters.whoMustUse && {
|
|
4866
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((filters === null || filters === void 0 ? void 0 : filters.description) && { description: filters.description })), (filters.differentials && { differentials: filters.differentials })), (filters.whoMustUse && {
|
|
4658
4867
|
who_must_use: filters.whoMustUse,
|
|
4659
4868
|
})), (filters.howToUse && {
|
|
4660
4869
|
how_to_use: filters.howToUse,
|
|
@@ -4662,11 +4871,13 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4662
4871
|
brand_description: filters.brand,
|
|
4663
4872
|
})), (filters.ingredients && {
|
|
4664
4873
|
ingredients: filters.ingredients,
|
|
4874
|
+
})), (filters.purpose && {
|
|
4875
|
+
purpose: filters.purpose,
|
|
4665
4876
|
}));
|
|
4666
4877
|
},
|
|
4667
|
-
bindPersistData: (descriptionData) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((descriptionData === null || descriptionData === void 0 ? void 0 : descriptionData.description) && { description: descriptionData.description })), (descriptionData.differentials && { differentials: descriptionData.differentials })), (descriptionData.whoMustUse && {
|
|
4878
|
+
bindPersistData: (descriptionData) => (Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((descriptionData === null || descriptionData === void 0 ? void 0 : descriptionData.description) && { description: descriptionData.description })), (descriptionData.differentials && { differentials: descriptionData.differentials })), (descriptionData.whoMustUse && {
|
|
4668
4879
|
who_must_use: descriptionData.whoMustUse,
|
|
4669
|
-
})), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand })), (descriptionData.ingredients && { ingredients: descriptionData.ingredients }))),
|
|
4880
|
+
})), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand })), (descriptionData.ingredients && { ingredients: descriptionData.ingredients })), (descriptionData.purpose && { purpose: descriptionData.purpose }))),
|
|
4670
4881
|
},
|
|
4671
4882
|
},
|
|
4672
4883
|
{ differentials: { columnName: 'differentials' } },
|
|
@@ -4674,6 +4885,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4674
4885
|
{ howToUse: { columnName: 'how_to_use' } },
|
|
4675
4886
|
{ brandDescription: { columnName: 'brand_description' } },
|
|
4676
4887
|
{ ingredients: { columnName: 'ingredients' } },
|
|
4888
|
+
{ purpose: { columnName: 'purpose' } },
|
|
4677
4889
|
{ hasVariants: { columnName: 'has_variants' } },
|
|
4678
4890
|
{
|
|
4679
4891
|
images: {
|
|
@@ -4789,7 +5001,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4789
5001
|
];
|
|
4790
5002
|
}
|
|
4791
5003
|
async create(params) {
|
|
4792
|
-
const { metadata } = params, data =
|
|
5004
|
+
const { metadata } = params, data = tslib_1.__rest(params, ["metadata"]);
|
|
4793
5005
|
const product = await super.create(lodash.omit(Object.assign(Object.assign({}, data), { metadata: metadata || { description: null, title: null } }), ['reviews']));
|
|
4794
5006
|
try {
|
|
4795
5007
|
product.reviews = data.reviews && (await this.updateReviews(+product.id, data));
|
|
@@ -4812,7 +5024,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4812
5024
|
}
|
|
4813
5025
|
async find(params) {
|
|
4814
5026
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
4815
|
-
const _o = params || {}, { filters, fields } = _o, options =
|
|
5027
|
+
const _o = params || {}, { filters, fields } = _o, options = tslib_1.__rest(_o, ["filters", "fields"]);
|
|
4816
5028
|
const bindFields = fields ||
|
|
4817
5029
|
this.fields
|
|
4818
5030
|
.map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
|
|
@@ -4850,7 +5062,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
4850
5062
|
return product;
|
|
4851
5063
|
}
|
|
4852
5064
|
async update(params) {
|
|
4853
|
-
const { categories, kitProducts, reviews, id: checkId, rate, metadata } = params, data =
|
|
5065
|
+
const { categories, kitProducts, reviews, id: checkId, rate, metadata } = params, data = tslib_1.__rest(params, ["categories", "kitProducts", "reviews", "id", "rate", "metadata"]);
|
|
4854
5066
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
4855
5067
|
const id = await this.getId(plainData.id);
|
|
4856
5068
|
const product = await super.update(Object.assign({ id }, data));
|
|
@@ -5057,6 +5269,41 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5057
5269
|
}
|
|
5058
5270
|
}
|
|
5059
5271
|
|
|
5272
|
+
class ProductReviewsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5273
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
5274
|
+
super({
|
|
5275
|
+
tableName: 'product_review',
|
|
5276
|
+
model: ProductReviews,
|
|
5277
|
+
endpoint,
|
|
5278
|
+
authOptions,
|
|
5279
|
+
interceptors,
|
|
5280
|
+
fields: [
|
|
5281
|
+
'id',
|
|
5282
|
+
{ productId: { columnName: 'product_id' } },
|
|
5283
|
+
'shop',
|
|
5284
|
+
'rate',
|
|
5285
|
+
'author',
|
|
5286
|
+
'email',
|
|
5287
|
+
'location',
|
|
5288
|
+
'review',
|
|
5289
|
+
'status',
|
|
5290
|
+
'title',
|
|
5291
|
+
{ personId: { columnName: 'person_id' } },
|
|
5292
|
+
'points',
|
|
5293
|
+
{ orderId: { columnName: 'order_id' } },
|
|
5294
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
5295
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
5296
|
+
],
|
|
5297
|
+
});
|
|
5298
|
+
}
|
|
5299
|
+
aproveReview(id) {
|
|
5300
|
+
return this.update({ id, status: true });
|
|
5301
|
+
}
|
|
5302
|
+
disaproveReview(id) {
|
|
5303
|
+
return this.update({ id, status: false });
|
|
5304
|
+
}
|
|
5305
|
+
}
|
|
5306
|
+
|
|
5060
5307
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5061
5308
|
constructor({ endpoint, authOptions, interceptors, }) {
|
|
5062
5309
|
super({
|
|
@@ -5135,11 +5382,11 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5135
5382
|
return variant;
|
|
5136
5383
|
}
|
|
5137
5384
|
async find(params) {
|
|
5138
|
-
const _a = params || {}, { filters } = _a, options =
|
|
5385
|
+
const _a = params || {}, { filters } = _a, options = tslib_1.__rest(_a, ["filters"]);
|
|
5139
5386
|
return super.find(Object.assign(Object.assign({}, options), { filters: Object.assign({ productId: { operator: exports.Where.ISNOTNULL } }, filters) }));
|
|
5140
5387
|
}
|
|
5141
5388
|
async update(params) {
|
|
5142
|
-
const { productId, id: checkId } = params, data =
|
|
5389
|
+
const { productId, id: checkId } = params, data = tslib_1.__rest(params, ["productId", "id"]);
|
|
5143
5390
|
const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
|
|
5144
5391
|
const id = await this.getId(dataWithProductId.id);
|
|
5145
5392
|
const product = await super.update(Object.assign({ id }, data));
|
|
@@ -5247,7 +5494,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5247
5494
|
this.categoryFilterRepository = categoryFilterRepository;
|
|
5248
5495
|
}
|
|
5249
5496
|
async create(params) {
|
|
5250
|
-
const { metadata } = params, data =
|
|
5497
|
+
const { metadata } = params, data = tslib_1.__rest(params, ["metadata"]);
|
|
5251
5498
|
return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
|
|
5252
5499
|
}
|
|
5253
5500
|
async get(identifiers) {
|
|
@@ -5257,7 +5504,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5257
5504
|
return data;
|
|
5258
5505
|
}
|
|
5259
5506
|
async update(params) {
|
|
5260
|
-
const { products, id: checkId, metadata, filters } = params, data =
|
|
5507
|
+
const { products, id: checkId, metadata, filters } = params, data = tslib_1.__rest(params, ["products", "id", "metadata", "filters"]);
|
|
5261
5508
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
5262
5509
|
const id = plainData.id;
|
|
5263
5510
|
const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
|
|
@@ -5553,6 +5800,8 @@ exports.Product = Product;
|
|
|
5553
5800
|
exports.ProductFirestoreRepository = ProductFirestoreRepository;
|
|
5554
5801
|
exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
|
|
5555
5802
|
exports.ProductHasuraGraphQLRepository = ProductHasuraGraphQLRepository;
|
|
5803
|
+
exports.ProductReviews = ProductReviews;
|
|
5804
|
+
exports.ProductReviewsHasuraGraphQLRepository = ProductReviewsHasuraGraphQLRepository;
|
|
5556
5805
|
exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
|
|
5557
5806
|
exports.ProductsIndex = ProductsIndex;
|
|
5558
5807
|
exports.RecoveryPassword = RecoveryPassword;
|
|
@@ -5570,11 +5819,15 @@ exports.SignOut = SignOut;
|
|
|
5570
5819
|
exports.Subscription = Subscription;
|
|
5571
5820
|
exports.SubscriptionEditionFirestoreRepository = SubscriptionEditionFirestoreRepository;
|
|
5572
5821
|
exports.SubscriptionFirestoreRepository = SubscriptionFirestoreRepository;
|
|
5822
|
+
exports.SubscriptionMaterialization = SubscriptionMaterialization;
|
|
5823
|
+
exports.SubscriptionMaterializationFirestoreRepository = SubscriptionMaterializationFirestoreRepository;
|
|
5573
5824
|
exports.SubscriptionPayment = SubscriptionPayment;
|
|
5574
5825
|
exports.SubscriptionPaymentFirestoreRepository = SubscriptionPaymentFirestoreRepository;
|
|
5575
5826
|
exports.SubscriptionPlan = SubscriptionPlan;
|
|
5576
5827
|
exports.SubscriptionPlanFirestoreRepository = SubscriptionPlanFirestoreRepository;
|
|
5577
5828
|
exports.SubscriptionProductFirestoreRepository = SubscriptionProductFirestoreRepository;
|
|
5829
|
+
exports.SubscriptionSummary = SubscriptionSummary;
|
|
5830
|
+
exports.SubscriptionSummaryFirestoreRepository = SubscriptionSummaryFirestoreRepository;
|
|
5578
5831
|
exports.Trace = Trace;
|
|
5579
5832
|
exports.UnauthorizedError = UnauthorizedError;
|
|
5580
5833
|
exports.User = User;
|