@infrab4a/connect 4.3.0-beta.0 → 4.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js 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 tslib = require('tslib');
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 {
@@ -297,165 +316,165 @@ class Payment extends BaseModel {
297
316
  return ['id'];
298
317
  }
299
318
  }
300
- tslib.__decorate([
319
+ tslib_1.__decorate([
301
320
  classTransformer.Expose({ name: 'refuse_reason' }),
302
- tslib.__metadata("design:type", String)
321
+ tslib_1.__metadata("design:type", String)
303
322
  ], Payment.prototype, "refuseReason", void 0);
304
- tslib.__decorate([
323
+ tslib_1.__decorate([
305
324
  classTransformer.Expose({ name: 'status_reason' }),
306
- tslib.__metadata("design:type", String)
325
+ tslib_1.__metadata("design:type", String)
307
326
  ], Payment.prototype, "statusReason", void 0);
308
- tslib.__decorate([
327
+ tslib_1.__decorate([
309
328
  classTransformer.Expose({ name: 'acquirer_response_code' }),
310
- tslib.__metadata("design:type", String)
329
+ tslib_1.__metadata("design:type", String)
311
330
  ], Payment.prototype, "acquirerResponseCode", void 0);
312
- tslib.__decorate([
331
+ tslib_1.__decorate([
313
332
  classTransformer.Expose({ name: 'acquirer_name' }),
314
- tslib.__metadata("design:type", String)
333
+ tslib_1.__metadata("design:type", String)
315
334
  ], Payment.prototype, "acquirerName", void 0);
316
- tslib.__decorate([
335
+ tslib_1.__decorate([
317
336
  classTransformer.Expose({ name: 'acquirer_id' }),
318
- tslib.__metadata("design:type", String)
337
+ tslib_1.__metadata("design:type", String)
319
338
  ], Payment.prototype, "acquirerId", void 0);
320
- tslib.__decorate([
339
+ tslib_1.__decorate([
321
340
  classTransformer.Expose({ name: 'authorization_code' }),
322
- tslib.__metadata("design:type", String)
341
+ tslib_1.__metadata("design:type", String)
323
342
  ], Payment.prototype, "authorizationCode", void 0);
324
- tslib.__decorate([
343
+ tslib_1.__decorate([
325
344
  classTransformer.Expose({ name: 'soft_descriptor' }),
326
- tslib.__metadata("design:type", String)
345
+ tslib_1.__metadata("design:type", String)
327
346
  ], Payment.prototype, "softDescriptor", void 0);
328
- tslib.__decorate([
347
+ tslib_1.__decorate([
329
348
  classTransformer.Expose({ name: 'date_created' }),
330
- tslib.__metadata("design:type", String)
349
+ tslib_1.__metadata("design:type", String)
331
350
  ], Payment.prototype, "dateCreated", void 0);
332
- tslib.__decorate([
351
+ tslib_1.__decorate([
333
352
  classTransformer.Expose({ name: 'date_updated' }),
334
- tslib.__metadata("design:type", String)
353
+ tslib_1.__metadata("design:type", String)
335
354
  ], Payment.prototype, "dateUpdated", void 0);
336
- tslib.__decorate([
355
+ tslib_1.__decorate([
337
356
  classTransformer.Expose({ name: 'authorized_amount' }),
338
- tslib.__metadata("design:type", Number)
357
+ tslib_1.__metadata("design:type", Number)
339
358
  ], Payment.prototype, "authorizedAmount", void 0);
340
- tslib.__decorate([
359
+ tslib_1.__decorate([
341
360
  classTransformer.Expose({ name: 'paid_amount' }),
342
- tslib.__metadata("design:type", Number)
361
+ tslib_1.__metadata("design:type", Number)
343
362
  ], Payment.prototype, "paidAmount", void 0);
344
- tslib.__decorate([
363
+ tslib_1.__decorate([
345
364
  classTransformer.Expose({ name: 'refunded_amount' }),
346
- tslib.__metadata("design:type", Number)
365
+ tslib_1.__metadata("design:type", Number)
347
366
  ], Payment.prototype, "refundedAmount", void 0);
348
- tslib.__decorate([
367
+ tslib_1.__decorate([
349
368
  classTransformer.Expose({ name: 'card_holder_name' }),
350
- tslib.__metadata("design:type", String)
369
+ tslib_1.__metadata("design:type", String)
351
370
  ], Payment.prototype, "cardHolderName", void 0);
352
- tslib.__decorate([
371
+ tslib_1.__decorate([
353
372
  classTransformer.Expose({ name: 'card_last_digits' }),
354
- tslib.__metadata("design:type", String)
373
+ tslib_1.__metadata("design:type", String)
355
374
  ], Payment.prototype, "cardLastDigits", void 0);
356
- tslib.__decorate([
375
+ tslib_1.__decorate([
357
376
  classTransformer.Expose({ name: 'card_first_digits' }),
358
- tslib.__metadata("design:type", String)
377
+ tslib_1.__metadata("design:type", String)
359
378
  ], Payment.prototype, "cardFirstDigits", void 0);
360
- tslib.__decorate([
379
+ tslib_1.__decorate([
361
380
  classTransformer.Expose({ name: 'card_brand' }),
362
- tslib.__metadata("design:type", String)
381
+ tslib_1.__metadata("design:type", String)
363
382
  ], Payment.prototype, "cardBrand", void 0);
364
- tslib.__decorate([
383
+ tslib_1.__decorate([
365
384
  classTransformer.Expose({ name: 'card_pin_mode' }),
366
- tslib.__metadata("design:type", String)
385
+ tslib_1.__metadata("design:type", String)
367
386
  ], Payment.prototype, "cardPinMode", void 0);
368
- tslib.__decorate([
387
+ tslib_1.__decorate([
369
388
  classTransformer.Expose({ name: 'card_magstripe_fallback' }),
370
- tslib.__metadata("design:type", Boolean)
389
+ tslib_1.__metadata("design:type", Boolean)
371
390
  ], Payment.prototype, "cardMagstripeFallback", void 0);
372
- tslib.__decorate([
391
+ tslib_1.__decorate([
373
392
  classTransformer.Expose({ name: 'cvm_pin' }),
374
- tslib.__metadata("design:type", Boolean)
393
+ tslib_1.__metadata("design:type", Boolean)
375
394
  ], Payment.prototype, "cvmPin", void 0);
376
- tslib.__decorate([
395
+ tslib_1.__decorate([
377
396
  classTransformer.Expose({ name: 'postback_url' }),
378
- tslib.__metadata("design:type", String)
397
+ tslib_1.__metadata("design:type", String)
379
398
  ], Payment.prototype, "postbackUrl", void 0);
380
- tslib.__decorate([
399
+ tslib_1.__decorate([
381
400
  classTransformer.Expose({ name: 'payment_method' }),
382
- tslib.__metadata("design:type", String)
401
+ tslib_1.__metadata("design:type", String)
383
402
  ], Payment.prototype, "paymentMethod", void 0);
384
- tslib.__decorate([
403
+ tslib_1.__decorate([
385
404
  classTransformer.Expose({ name: 'capture_method' }),
386
- tslib.__metadata("design:type", String)
405
+ tslib_1.__metadata("design:type", String)
387
406
  ], Payment.prototype, "captureMethod", void 0);
388
- tslib.__decorate([
407
+ tslib_1.__decorate([
389
408
  classTransformer.Expose({ name: 'antifraud_score' }),
390
- tslib.__metadata("design:type", String)
409
+ tslib_1.__metadata("design:type", String)
391
410
  ], Payment.prototype, "antifraudScore", void 0);
392
- tslib.__decorate([
411
+ tslib_1.__decorate([
393
412
  classTransformer.Expose({ name: 'boleto_url' }),
394
- tslib.__metadata("design:type", String)
413
+ tslib_1.__metadata("design:type", String)
395
414
  ], Payment.prototype, "boletoUrl", void 0);
396
- tslib.__decorate([
415
+ tslib_1.__decorate([
397
416
  classTransformer.Expose({ name: 'boleto_barcode' }),
398
- tslib.__metadata("design:type", String)
417
+ tslib_1.__metadata("design:type", String)
399
418
  ], Payment.prototype, "boletoBarcode", void 0);
400
- tslib.__decorate([
419
+ tslib_1.__decorate([
401
420
  classTransformer.Expose({ name: 'boleto_expiration_date' }),
402
- tslib.__metadata("design:type", String)
421
+ tslib_1.__metadata("design:type", String)
403
422
  ], Payment.prototype, "boletoExpirationDate", void 0);
404
- tslib.__decorate([
423
+ tslib_1.__decorate([
405
424
  classTransformer.Expose({ name: 'subscription_id' }),
406
- tslib.__metadata("design:type", String)
425
+ tslib_1.__metadata("design:type", String)
407
426
  ], Payment.prototype, "subscriptionId", void 0);
408
- tslib.__decorate([
427
+ tslib_1.__decorate([
409
428
  classTransformer.Expose({ name: 'split_rules' }),
410
- tslib.__metadata("design:type", String)
429
+ tslib_1.__metadata("design:type", String)
411
430
  ], Payment.prototype, "splitRules", void 0);
412
- tslib.__decorate([
431
+ tslib_1.__decorate([
413
432
  classTransformer.Expose({ name: 'antifraud_metadata' }),
414
- tslib.__metadata("design:type", Object)
433
+ tslib_1.__metadata("design:type", Object)
415
434
  ], Payment.prototype, "antifraudMetadata", void 0);
416
- tslib.__decorate([
435
+ tslib_1.__decorate([
417
436
  classTransformer.Expose({ name: 'reference_key' }),
418
- tslib.__metadata("design:type", String)
437
+ tslib_1.__metadata("design:type", String)
419
438
  ], Payment.prototype, "referenceKey", void 0);
420
- tslib.__decorate([
439
+ tslib_1.__decorate([
421
440
  classTransformer.Expose({ name: 'local_transaction_id' }),
422
- tslib.__metadata("design:type", String)
441
+ tslib_1.__metadata("design:type", String)
423
442
  ], Payment.prototype, "localTransactionId", void 0);
424
- tslib.__decorate([
443
+ tslib_1.__decorate([
425
444
  classTransformer.Expose({ name: 'local_time' }),
426
- tslib.__metadata("design:type", String)
445
+ tslib_1.__metadata("design:type", String)
427
446
  ], Payment.prototype, "localTime", void 0);
428
- tslib.__decorate([
447
+ tslib_1.__decorate([
429
448
  classTransformer.Expose({ name: 'fraud_covered' }),
430
- tslib.__metadata("design:type", Boolean)
449
+ tslib_1.__metadata("design:type", Boolean)
431
450
  ], Payment.prototype, "fraudCovered", void 0);
432
- tslib.__decorate([
451
+ tslib_1.__decorate([
433
452
  classTransformer.Expose({ name: 'fraud_reimbursed' }),
434
- tslib.__metadata("design:type", String)
453
+ tslib_1.__metadata("design:type", String)
435
454
  ], Payment.prototype, "fraudReimbursed", void 0);
436
- tslib.__decorate([
455
+ tslib_1.__decorate([
437
456
  classTransformer.Expose({ name: 'order_id' }),
438
- tslib.__metadata("design:type", String)
457
+ tslib_1.__metadata("design:type", String)
439
458
  ], Payment.prototype, "orderId", void 0);
440
- tslib.__decorate([
459
+ tslib_1.__decorate([
441
460
  classTransformer.Expose({ name: 'risk_level' }),
442
- tslib.__metadata("design:type", String)
461
+ tslib_1.__metadata("design:type", String)
443
462
  ], Payment.prototype, "riskLevel", void 0);
444
- tslib.__decorate([
463
+ tslib_1.__decorate([
445
464
  classTransformer.Expose({ name: 'receipt_url' }),
446
- tslib.__metadata("design:type", String)
465
+ tslib_1.__metadata("design:type", String)
447
466
  ], Payment.prototype, "receiptUrl", void 0);
448
- tslib.__decorate([
467
+ tslib_1.__decorate([
449
468
  classTransformer.Expose({ name: 'private_label' }),
450
- tslib.__metadata("design:type", String)
469
+ tslib_1.__metadata("design:type", String)
451
470
  ], Payment.prototype, "privateLabel", void 0);
452
- tslib.__decorate([
471
+ tslib_1.__decorate([
453
472
  classTransformer.Expose({ name: 'pix_qr_code' }),
454
- tslib.__metadata("design:type", String)
473
+ tslib_1.__metadata("design:type", String)
455
474
  ], Payment.prototype, "pixQrCode", void 0);
456
- tslib.__decorate([
475
+ tslib_1.__decorate([
457
476
  classTransformer.Expose({ name: 'pix_expiration_date' }),
458
- tslib.__metadata("design:type", String)
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
- tslib.__decorate([
485
+ tslib_1.__decorate([
467
486
  classTransformer.Type(() => Payment),
468
- tslib.__metadata("design:type", Payment)
487
+ tslib_1.__metadata("design:type", Payment)
469
488
  ], SubscriptionPayment.prototype, "payment", void 0);
470
489
 
471
- function isFunction(value) {
472
- return typeof value === 'function';
490
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
491
+ function isFunction(x) {
492
+ return typeof x === 'function';
473
493
  }
474
494
 
475
- function createErrorClass(createImpl) {
476
- var _super = function (instance) {
477
- Error.call(instance);
478
- instance.stack = new Error().stack;
479
- };
480
- var ctorFunc = createImpl(_super);
481
- ctorFunc.prototype = Object.create(Error.prototype);
482
- ctorFunc.prototype.constructor = ctorFunc;
483
- return ctorFunc;
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
- var UnsubscriptionError = createErrorClass(function (_super) {
487
- return function UnsubscriptionErrorImpl(errors) {
488
- _super(this);
489
- this.message = errors
490
- ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
491
- : '';
492
- this.name = 'UnsubscriptionError';
493
- this.errors = errors;
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
- function arrRemove(arr, item) {
498
- if (arr) {
499
- var index = arr.indexOf(item);
500
- 0 <= index && arr.splice(index, 1);
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
- var Subscription$1 = (function () {
505
- function Subscription(initialTeardown) {
506
- this.initialTeardown = initialTeardown;
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._parentage = null;
509
- this._finalizers = null;
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 (!this.closed) {
515
- this.closed = true;
516
- var _parentage = this._parentage;
517
- if (_parentage) {
518
- this._parentage = null;
519
- if (Array.isArray(_parentage)) {
520
- try {
521
- for (var _parentage_1 = tslib.__values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
522
- var parent_1 = _parentage_1_1.value;
523
- parent_1.remove(this);
524
- }
525
- }
526
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
527
- finally {
528
- try {
529
- if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
530
- }
531
- finally { if (e_1) throw e_1.error; }
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
- var initialFinalizer = this.initialTeardown;
539
- if (isFunction(initialFinalizer)) {
540
- try {
541
- initialFinalizer();
542
- }
543
- catch (e) {
544
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
545
- }
582
+ }
583
+ if (isFunction(_unsubscribe)) {
584
+ if (_ctorUnsubscribe) {
585
+ this._unsubscribe = undefined;
546
586
  }
547
- var _finalizers = this._finalizers;
548
- if (_finalizers) {
549
- this._finalizers = null;
550
- try {
551
- for (var _finalizers_1 = tslib.__values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
552
- var finalizer = _finalizers_1_1.value;
553
- try {
554
- execFinalizer(finalizer);
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
- catch (err) {
557
- errors = errors !== null && errors !== void 0 ? errors : [];
558
- if (err instanceof UnsubscriptionError) {
559
- errors = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(errors)), tslib.__read(err.errors));
560
- }
561
- else {
562
- errors.push(err);
563
- }
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 _a;
582
- if (teardown && teardown !== this) {
583
- if (this.closed) {
584
- execFinalizer(teardown);
585
- }
586
- else {
587
- if (teardown instanceof Subscription) {
588
- if (teardown.closed || teardown._hasParent(this)) {
589
- return;
590
- }
591
- teardown._addParent(this);
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;
592
634
  }
593
- (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
635
+ else if (!(subscription instanceof Subscription)) {
636
+ var tmp = subscription;
637
+ subscription = new Subscription();
638
+ subscription._subscriptions = [tmp];
639
+ }
640
+ break;
641
+ default: {
642
+ throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
594
643
  }
595
644
  }
596
- };
597
- Subscription.prototype._hasParent = function (parent) {
598
- var _parentage = this._parentage;
599
- return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
600
- };
601
- Subscription.prototype._addParent = function (parent) {
602
- var _parentage = this._parentage;
603
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
604
- };
605
- Subscription.prototype._removeParent = function (parent) {
606
- var _parentage = this._parentage;
607
- if (_parentage === parent) {
608
- this._parentage = null;
645
+ var _parentOrParents = subscription._parentOrParents;
646
+ if (_parentOrParents === null) {
647
+ subscription._parentOrParents = this;
609
648
  }
610
- else if (Array.isArray(_parentage)) {
611
- arrRemove(_parentage, parent);
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];
612
664
  }
665
+ else {
666
+ subscriptions.push(subscription);
667
+ }
668
+ return subscription;
613
669
  };
614
- Subscription.prototype.remove = function (teardown) {
615
- var _finalizers = this._finalizers;
616
- _finalizers && arrRemove(_finalizers, teardown);
617
- if (teardown instanceof Subscription) {
618
- teardown._removeParent(this);
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
- var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
629
- function isSubscription(value) {
630
- return (value instanceof Subscription$1 ||
631
- (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
632
- }
633
- function execFinalizer(finalizer) {
634
- if (isFunction(finalizer)) {
635
- finalizer();
636
- }
637
- else {
638
- finalizer.unsubscribe();
639
- }
640
- }
641
-
642
- var config = {
643
- onUnhandledError: null,
644
- onStoppedNotification: null,
645
- Promise: undefined,
646
- useDeprecatedSynchronousErrorHandling: false,
647
- useDeprecatedNextContext: false,
648
- };
649
-
650
- var timeoutProvider = {
651
- setTimeout: function (handler, timeout) {
652
- var args = [];
653
- for (var _i = 2; _i < arguments.length; _i++) {
654
- args[_i - 2] = arguments[_i];
655
- }
656
- var delegate = timeoutProvider.delegate;
657
- if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
658
- return delegate.setTimeout.apply(delegate, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
659
- }
660
- return setTimeout.apply(void 0, tslib.__spreadArray([handler, timeout], tslib.__read(args)));
661
- },
662
- clearTimeout: function (handle) {
663
- var delegate = timeoutProvider.delegate;
664
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
665
- },
666
- delegate: undefined,
667
- };
668
-
669
- function reportUnhandledError(err) {
670
- timeoutProvider.setTimeout(function () {
671
- {
672
- throw err;
673
- }
674
- });
675
- }
676
-
677
- function noop() { }
678
-
679
- var context = null;
680
- function errorContext(cb) {
681
- if (config.useDeprecatedSynchronousErrorHandling) {
682
- var isRoot = !context;
683
- if (isRoot) {
684
- context = { errorThrown: false, error: null };
685
- }
686
- cb();
687
- if (isRoot) {
688
- var _a = context, errorThrown = _a.errorThrown, error = _a.error;
689
- context = null;
690
- if (errorThrown) {
691
- throw error;
692
- }
693
- }
694
- }
695
- else {
696
- cb();
697
- }
685
+ function flattenUnsubscriptionErrors(errors) {
686
+ return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []);
698
687
  }
699
688
 
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
- if (destination) {
706
- _this.destination = destination;
707
- if (isSubscription(destination)) {
708
- destination.add(_this);
709
- }
710
- }
711
- else {
712
- _this.destination = EMPTY_OBSERVER;
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
- return new SafeSubscriber(next, error, complete);
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 (!this.closed) {
741
- this.isStopped = true;
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
- try {
751
- this.destination.error(err);
752
- }
753
- finally {
754
- this.unsubscribe();
755
- }
767
+ this.destination.error(err);
768
+ this.unsubscribe();
756
769
  };
757
770
  Subscriber.prototype._complete = function () {
758
- try {
759
- this.destination.complete();
760
- }
761
- finally {
762
- this.unsubscribe();
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 _bind = Function.prototype.bind;
768
- function bind(fn, thisArg) {
769
- return _bind.call(fn, thisArg);
770
- }
771
- var ConsumerObserver = (function () {
772
- function ConsumerObserver(partialObserver) {
773
- this.partialObserver = partialObserver;
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
- ConsumerObserver.prototype.next = function (value) {
776
- var partialObserver = this.partialObserver;
777
- if (partialObserver.next) {
778
- try {
779
- partialObserver.next(value);
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
- catch (error) {
782
- handleUnhandledError(error);
819
+ else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
820
+ this.unsubscribe();
783
821
  }
784
822
  }
785
823
  };
786
- ConsumerObserver.prototype.error = function (err) {
787
- var partialObserver = this.partialObserver;
788
- if (partialObserver.error) {
789
- try {
790
- partialObserver.error(err);
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
+ }
837
+ }
838
+ else if (!_parentSubscriber.syncErrorThrowable) {
839
+ this.unsubscribe();
840
+ if (useDeprecatedSynchronousErrorHandling) {
841
+ throw err;
842
+ }
843
+ hostReportError(err);
791
844
  }
792
- catch (error) {
793
- handleUnhandledError(error);
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
- else {
797
- handleUnhandledError(err);
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
- ConsumerObserver.prototype.complete = function () {
801
- var partialObserver = this.partialObserver;
802
- if (partialObserver.complete) {
803
- try {
804
- partialObserver.complete();
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
- catch (error) {
807
- handleUnhandledError(error);
886
+ else {
887
+ hostReportError(err);
808
888
  }
809
889
  }
810
890
  };
811
- return ConsumerObserver;
812
- }());
813
- var SafeSubscriber = (function (_super) {
814
- tslib.__extends(SafeSubscriber, _super);
815
- function SafeSubscriber(observerOrNext, error, complete) {
816
- var _this = _super.call(this) || this;
817
- var partialObserver;
818
- if (isFunction(observerOrNext) || !observerOrNext) {
819
- partialObserver = {
820
- next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
821
- error: error !== null && error !== void 0 ? error : undefined,
822
- complete: complete !== null && complete !== void 0 ? complete : undefined,
823
- };
891
+ SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
892
+ if (!config.useDeprecatedSynchronousErrorHandling) {
893
+ throw new Error('bad call');
824
894
  }
825
- else {
826
- var context_1;
827
- if (_this && config.useDeprecatedNextContext) {
828
- context_1 = Object.create(observerOrNext);
829
- context_1.unsubscribe = function () { return _this.unsubscribe(); };
830
- partialObserver = {
831
- next: observerOrNext.next && bind(observerOrNext.next, context_1),
832
- error: observerOrNext.error && bind(observerOrNext.error, context_1),
833
- complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
834
- };
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
- partialObserver = observerOrNext;
905
+ hostReportError(err);
906
+ return true;
838
907
  }
839
908
  }
840
- _this.destination = new ConsumerObserver(partialObserver);
841
- return _this;
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
- function handleUnhandledError(error) {
846
- {
847
- reportUnhandledError(error);
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
- function defaultErrorHandler(err) {
851
- throw err;
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
- var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
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
- var Observable = (function () {
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 _this = this;
892
- var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
893
- errorContext(function () {
894
- var _a = _this, operator = _a.operator, source = _a.source;
895
- subscriber.add(operator
896
- ?
897
- operator.call(subscriber, source)
898
- : source
899
- ?
900
- _this._subscribe(subscriber)
901
- :
902
- _this._trySubscribe(subscriber));
903
- });
904
- return subscriber;
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
- sink.error(err);
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 subscriber = new SafeSubscriber({
919
- next: function (value) {
920
- try {
921
- next(value);
922
- }
923
- catch (err) {
924
- reject(err);
925
- subscriber.unsubscribe();
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
- error: reject,
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 _a;
936
- return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
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 (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
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
- var _a;
963
- return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
964
- }
965
- function isObserver(value) {
966
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
967
- }
968
- function isSubscriber(value) {
969
- return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
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
- var ObjectUnsubscribedError = createErrorClass(function (_super) {
973
- return function ObjectUnsubscribedErrorImpl() {
974
- _super(this);
975
- this.name = 'ObjectUnsubscribedError';
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
- var Subject = (function (_super) {
981
- tslib.__extends(Subject, _super);
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._throwIfClosed = function () {
1155
+ Subject.prototype.next = function (value) {
998
1156
  if (this.closed) {
999
1157
  throw new ObjectUnsubscribedError();
1000
1158
  }
1001
- };
1002
- Subject.prototype.next = function (value) {
1003
- var _this = this;
1004
- errorContext(function () {
1005
- var e_1, _a;
1006
- _this._throwIfClosed();
1007
- if (!_this.isStopped) {
1008
- if (!_this.currentObservers) {
1009
- _this.currentObservers = Array.from(_this.observers);
1010
- }
1011
- try {
1012
- for (var _b = tslib.__values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
1013
- var observer = _c.value;
1014
- observer.next(value);
1015
- }
1016
- }
1017
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1018
- finally {
1019
- try {
1020
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1021
- }
1022
- finally { if (e_1) throw e_1.error; }
1023
- }
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
- var _this = this;
1029
- errorContext(function () {
1030
- _this._throwIfClosed();
1031
- if (!_this.isStopped) {
1032
- _this.hasError = _this.isStopped = true;
1033
- _this.thrownError = err;
1034
- var observers = _this.observers;
1035
- while (observers.length) {
1036
- observers.shift().error(err);
1037
- }
1038
- }
1039
- });
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
- var _this = this;
1043
- errorContext(function () {
1044
- _this._throwIfClosed();
1045
- if (!_this.isStopped) {
1046
- _this.isStopped = true;
1047
- var observers = _this.observers;
1048
- while (observers.length) {
1049
- observers.shift().complete();
1050
- }
1051
- }
1052
- });
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 = this.closed = true;
1056
- this.observers = this.currentObservers = null;
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._throwIfClosed();
1068
- return _super.prototype._trySubscribe.call(this, subscriber);
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._throwIfClosed();
1072
- this._checkFinalizedStatuses(subscriber);
1073
- return this._innerSubscribe(subscriber);
1074
- };
1075
- Subject.prototype._innerSubscribe = function (subscriber) {
1076
- var _this = this;
1077
- var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
1078
- if (hasError || isStopped) {
1079
- return EMPTY_SUBSCRIPTION;
1210
+ if (this.closed) {
1211
+ throw new ObjectUnsubscribedError();
1080
1212
  }
1081
- this.currentObservers = null;
1082
- observers.push(subscriber);
1083
- return new Subscription$1(function () {
1084
- _this.currentObservers = null;
1085
- arrRemove(observers, subscriber);
1086
- });
1087
- };
1088
- Subject.prototype._checkFinalizedStatuses = function (subscriber) {
1089
- var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
1090
- if (hasError) {
1091
- subscriber.error(thrownError);
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
- tslib.__extends(AnonymousSubject, _super);
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 _a, _b;
1117
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
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 _a, _b;
1121
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
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 _a, _b;
1125
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
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 _a, _b;
1129
- return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
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));
@@ -1687,9 +1827,9 @@ class User extends BaseModel {
1687
1827
  return ['id'];
1688
1828
  }
1689
1829
  }
1690
- tslib.__decorate([
1830
+ tslib_1.__decorate([
1691
1831
  classTransformer.Type(() => BeautyProfile),
1692
- tslib.__metadata("design:type", BeautyProfile)
1832
+ tslib_1.__metadata("design:type", BeautyProfile)
1693
1833
  ], User.prototype, "beautyProfile", void 0);
1694
1834
 
1695
1835
  class Address extends BaseModel {
@@ -1709,33 +1849,33 @@ class Subscription extends BaseModel {
1709
1849
  return ['id'];
1710
1850
  }
1711
1851
  }
1712
- tslib.__decorate([
1852
+ tslib_1.__decorate([
1713
1853
  classTransformer.Type(() => User),
1714
- tslib.__metadata("design:type", User)
1854
+ tslib_1.__metadata("design:type", User)
1715
1855
  ], Subscription.prototype, "user", void 0);
1716
- tslib.__decorate([
1856
+ tslib_1.__decorate([
1717
1857
  classTransformer.Type(() => SubscriptionPlan),
1718
- tslib.__metadata("design:type", SubscriptionPlan)
1858
+ tslib_1.__metadata("design:type", SubscriptionPlan)
1719
1859
  ], Subscription.prototype, "subscriptionPlan", void 0);
1720
- tslib.__decorate([
1860
+ tslib_1.__decorate([
1721
1861
  classTransformer.Type(() => UserAddress),
1722
- tslib.__metadata("design:type", UserAddress)
1862
+ tslib_1.__metadata("design:type", UserAddress)
1723
1863
  ], Subscription.prototype, "shippingAddress", void 0);
1724
- tslib.__decorate([
1864
+ tslib_1.__decorate([
1725
1865
  classTransformer.Type(() => UserAddress),
1726
- tslib.__metadata("design:type", UserAddress)
1866
+ tslib_1.__metadata("design:type", UserAddress)
1727
1867
  ], Subscription.prototype, "billingAddress", void 0);
1728
- tslib.__decorate([
1868
+ tslib_1.__decorate([
1729
1869
  classTransformer.Type(() => Coupon),
1730
- tslib.__metadata("design:type", Coupon)
1870
+ tslib_1.__metadata("design:type", Coupon)
1731
1871
  ], Subscription.prototype, "coupon", void 0);
1732
- tslib.__decorate([
1872
+ tslib_1.__decorate([
1733
1873
  classTransformer.Type(() => Edition),
1734
- tslib.__metadata("design:type", Array)
1874
+ tslib_1.__metadata("design:type", Array)
1735
1875
  ], Subscription.prototype, "editions", void 0);
1736
- tslib.__decorate([
1876
+ tslib_1.__decorate([
1737
1877
  classTransformer.Type(() => SubscriptionPayment),
1738
- tslib.__metadata("design:type", Array)
1878
+ tslib_1.__metadata("design:type", Array)
1739
1879
  ], Subscription.prototype, "payment", void 0);
1740
1880
 
1741
1881
  class Filter extends BaseModel {
@@ -1749,13 +1889,13 @@ class CategoryBase extends BaseModel {
1749
1889
  return ['id'];
1750
1890
  }
1751
1891
  }
1752
- tslib.__decorate([
1892
+ tslib_1.__decorate([
1753
1893
  classTransformer.Type(() => CategoryBase),
1754
- tslib.__metadata("design:type", CategoryBase)
1894
+ tslib_1.__metadata("design:type", CategoryBase)
1755
1895
  ], CategoryBase.prototype, "parent", void 0);
1756
- tslib.__decorate([
1896
+ tslib_1.__decorate([
1757
1897
  classTransformer.Type(() => Filter),
1758
- tslib.__metadata("design:type", Array)
1898
+ tslib_1.__metadata("design:type", Array)
1759
1899
  ], CategoryBase.prototype, "filters", void 0);
1760
1900
 
1761
1901
  class CategoryForProduct extends CategoryBase {
@@ -1793,9 +1933,9 @@ class ProductForKit extends ProductBase {
1793
1933
  return ['id'];
1794
1934
  }
1795
1935
  }
1796
- tslib.__decorate([
1936
+ tslib_1.__decorate([
1797
1937
  classTransformer.Type(() => CategoryForProduct),
1798
- tslib.__metadata("design:type", CategoryForProduct)
1938
+ tslib_1.__metadata("design:type", CategoryForProduct)
1799
1939
  ], ProductForKit.prototype, "category", void 0);
1800
1940
 
1801
1941
  class KitProduct extends BaseModel {
@@ -1803,13 +1943,13 @@ class KitProduct extends BaseModel {
1803
1943
  return ['productId', 'kitProductId'];
1804
1944
  }
1805
1945
  }
1806
- tslib.__decorate([
1946
+ tslib_1.__decorate([
1807
1947
  classTransformer.Type(() => ProductForKit),
1808
- tslib.__metadata("design:type", ProductForKit)
1948
+ tslib_1.__metadata("design:type", ProductForKit)
1809
1949
  ], KitProduct.prototype, "kit", void 0);
1810
- tslib.__decorate([
1950
+ tslib_1.__decorate([
1811
1951
  classTransformer.Type(() => ProductForKit),
1812
- tslib.__metadata("design:type", ProductForKit)
1952
+ tslib_1.__metadata("design:type", ProductForKit)
1813
1953
  ], KitProduct.prototype, "product", void 0);
1814
1954
 
1815
1955
  class ProductForCategory extends ProductBase {
@@ -1817,9 +1957,9 @@ class ProductForCategory extends ProductBase {
1817
1957
  return ['id'];
1818
1958
  }
1819
1959
  }
1820
- tslib.__decorate([
1960
+ tslib_1.__decorate([
1821
1961
  classTransformer.Type(() => KitProduct),
1822
- tslib.__metadata("design:type", Array)
1962
+ tslib_1.__metadata("design:type", Array)
1823
1963
  ], ProductForCategory.prototype, "kitProducts", void 0);
1824
1964
 
1825
1965
  class Category extends CategoryBase {
@@ -1827,9 +1967,9 @@ class Category extends CategoryBase {
1827
1967
  return ['id'];
1828
1968
  }
1829
1969
  }
1830
- tslib.__decorate([
1970
+ tslib_1.__decorate([
1831
1971
  classTransformer.Type(() => ProductForCategory),
1832
- tslib.__metadata("design:type", Array)
1972
+ tslib_1.__metadata("design:type", Array)
1833
1973
  ], Category.prototype, "childrenProducts", void 0);
1834
1974
 
1835
1975
  class CategoryCollectionChildren extends BaseModel {
@@ -1837,9 +1977,9 @@ class CategoryCollectionChildren extends BaseModel {
1837
1977
  return ['collectionId', 'categoryId'];
1838
1978
  }
1839
1979
  }
1840
- tslib.__decorate([
1980
+ tslib_1.__decorate([
1841
1981
  classTransformer.Type(() => CategoryCollectionChildren),
1842
- tslib.__metadata("design:type", CategoryCollectionChildren)
1982
+ tslib_1.__metadata("design:type", CategoryCollectionChildren)
1843
1983
  ], CategoryCollectionChildren.prototype, "parent", void 0);
1844
1984
 
1845
1985
  class CategoryFilter extends BaseModel {
@@ -1847,13 +1987,13 @@ class CategoryFilter extends BaseModel {
1847
1987
  return ['id'];
1848
1988
  }
1849
1989
  }
1850
- tslib.__decorate([
1990
+ tslib_1.__decorate([
1851
1991
  classTransformer.Type(() => Filter),
1852
- tslib.__metadata("design:type", Filter)
1992
+ tslib_1.__metadata("design:type", Filter)
1853
1993
  ], CategoryFilter.prototype, "filter", void 0);
1854
- tslib.__decorate([
1994
+ tslib_1.__decorate([
1855
1995
  classTransformer.Type(() => Category),
1856
- tslib.__metadata("design:type", Category)
1996
+ tslib_1.__metadata("design:type", Category)
1857
1997
  ], CategoryFilter.prototype, "category", void 0);
1858
1998
 
1859
1999
  exports.GenderDestination = void 0;
@@ -1882,21 +2022,15 @@ class Product extends ProductBase {
1882
2022
  return ['id'];
1883
2023
  }
1884
2024
  }
1885
- tslib.__decorate([
2025
+ tslib_1.__decorate([
1886
2026
  classTransformer.Type(() => CategoryForProduct),
1887
- tslib.__metadata("design:type", CategoryForProduct)
2027
+ tslib_1.__metadata("design:type", CategoryForProduct)
1888
2028
  ], Product.prototype, "category", void 0);
1889
- tslib.__decorate([
2029
+ tslib_1.__decorate([
1890
2030
  classTransformer.Type(() => KitProduct),
1891
- tslib.__metadata("design:type", Array)
2031
+ tslib_1.__metadata("design:type", Array)
1892
2032
  ], Product.prototype, "kitProducts", void 0);
1893
2033
 
1894
- class ProductReviews extends BaseModel {
1895
- static get identifiersFields() {
1896
- return ['id'];
1897
- }
1898
- }
1899
-
1900
2034
  class Variant extends BaseModel {
1901
2035
  static get identifiersFields() {
1902
2036
  return ['id', 'productId'];
@@ -1914,9 +2048,9 @@ class Buy2Win extends BaseModel {
1914
2048
  return ['id'];
1915
2049
  }
1916
2050
  }
1917
- tslib.__decorate([
2051
+ tslib_1.__decorate([
1918
2052
  classTransformer.Type(() => Category),
1919
- tslib.__metadata("design:type", Array)
2053
+ tslib_1.__metadata("design:type", Array)
1920
2054
  ], Buy2Win.prototype, "categories", void 0);
1921
2055
 
1922
2056
  class CampaignDashboard extends BaseModel {
@@ -1945,29 +2079,29 @@ class Checkout extends BaseModel {
1945
2079
  return ['id'];
1946
2080
  }
1947
2081
  }
1948
- tslib.__decorate([
2082
+ tslib_1.__decorate([
1949
2083
  classTransformer.Type(() => LineItem),
1950
- tslib.__metadata("design:type", Array)
2084
+ tslib_1.__metadata("design:type", Array)
1951
2085
  ], Checkout.prototype, "lineItems", void 0);
1952
- tslib.__decorate([
2086
+ tslib_1.__decorate([
1953
2087
  classTransformer.Type(() => User),
1954
- tslib.__metadata("design:type", User)
2088
+ tslib_1.__metadata("design:type", User)
1955
2089
  ], Checkout.prototype, "user", void 0);
1956
- tslib.__decorate([
2090
+ tslib_1.__decorate([
1957
2091
  classTransformer.Type(() => UserAddress),
1958
- tslib.__metadata("design:type", UserAddress)
2092
+ tslib_1.__metadata("design:type", UserAddress)
1959
2093
  ], Checkout.prototype, "shippingAddress", void 0);
1960
- tslib.__decorate([
2094
+ tslib_1.__decorate([
1961
2095
  classTransformer.Type(() => UserAddress),
1962
- tslib.__metadata("design:type", UserAddress)
2096
+ tslib_1.__metadata("design:type", UserAddress)
1963
2097
  ], Checkout.prototype, "billingAddress", void 0);
1964
- tslib.__decorate([
2098
+ tslib_1.__decorate([
1965
2099
  classTransformer.Type(() => ShippingMethod),
1966
- tslib.__metadata("design:type", ShippingMethod)
2100
+ tslib_1.__metadata("design:type", ShippingMethod)
1967
2101
  ], Checkout.prototype, "shipping", void 0);
1968
- tslib.__decorate([
2102
+ tslib_1.__decorate([
1969
2103
  classTransformer.Type(() => Coupon),
1970
- tslib.__metadata("design:type", Coupon)
2104
+ tslib_1.__metadata("design:type", Coupon)
1971
2105
  ], Checkout.prototype, "coupon", void 0);
1972
2106
 
1973
2107
  exports.OrderStatus = void 0;
@@ -1984,9 +2118,9 @@ exports.OrderStatus = void 0;
1984
2118
 
1985
2119
  class Order extends Checkout {
1986
2120
  }
1987
- tslib.__decorate([
2121
+ tslib_1.__decorate([
1988
2122
  classTransformer.Type(() => Payment),
1989
- tslib.__metadata("design:type", Payment)
2123
+ tslib_1.__metadata("design:type", Payment)
1990
2124
  ], Order.prototype, "payment", void 0);
1991
2125
 
1992
2126
  class CheckoutSubscription extends BaseModel {
@@ -1994,21 +2128,21 @@ class CheckoutSubscription extends BaseModel {
1994
2128
  return ['id'];
1995
2129
  }
1996
2130
  }
1997
- tslib.__decorate([
2131
+ tslib_1.__decorate([
1998
2132
  classTransformer.Type(() => UserAddress),
1999
- tslib.__metadata("design:type", UserAddress)
2133
+ tslib_1.__metadata("design:type", UserAddress)
2000
2134
  ], CheckoutSubscription.prototype, "shippingAddress", void 0);
2001
- tslib.__decorate([
2135
+ tslib_1.__decorate([
2002
2136
  classTransformer.Type(() => UserAddress),
2003
- tslib.__metadata("design:type", UserAddress)
2137
+ tslib_1.__metadata("design:type", UserAddress)
2004
2138
  ], CheckoutSubscription.prototype, "billingAddress", void 0);
2005
- tslib.__decorate([
2139
+ tslib_1.__decorate([
2006
2140
  classTransformer.Type(() => SubscriptionPlan),
2007
- tslib.__metadata("design:type", SubscriptionPlan)
2141
+ tslib_1.__metadata("design:type", SubscriptionPlan)
2008
2142
  ], CheckoutSubscription.prototype, "subscriptionPlan", void 0);
2009
- tslib.__decorate([
2143
+ tslib_1.__decorate([
2010
2144
  classTransformer.Type(() => Coupon),
2011
- tslib.__metadata("design:type", Coupon)
2145
+ tslib_1.__metadata("design:type", Coupon)
2012
2146
  ], CheckoutSubscription.prototype, "coupon", void 0);
2013
2147
 
2014
2148
  class SubscriptionMaterialization extends BaseModel {
@@ -2016,33 +2150,33 @@ class SubscriptionMaterialization extends BaseModel {
2016
2150
  return ['id'];
2017
2151
  }
2018
2152
  }
2019
- tslib.__decorate([
2153
+ tslib_1.__decorate([
2020
2154
  classTransformer.Type(() => User),
2021
- tslib.__metadata("design:type", User)
2155
+ tslib_1.__metadata("design:type", User)
2022
2156
  ], SubscriptionMaterialization.prototype, "user", void 0);
2023
- tslib.__decorate([
2157
+ tslib_1.__decorate([
2024
2158
  classTransformer.Type(() => SubscriptionPlan),
2025
- tslib.__metadata("design:type", SubscriptionPlan)
2159
+ tslib_1.__metadata("design:type", SubscriptionPlan)
2026
2160
  ], SubscriptionMaterialization.prototype, "subscriptionPlan", void 0);
2027
- tslib.__decorate([
2161
+ tslib_1.__decorate([
2028
2162
  classTransformer.Type(() => UserAddress),
2029
- tslib.__metadata("design:type", UserAddress)
2163
+ tslib_1.__metadata("design:type", UserAddress)
2030
2164
  ], SubscriptionMaterialization.prototype, "shippingAddress", void 0);
2031
- tslib.__decorate([
2165
+ tslib_1.__decorate([
2032
2166
  classTransformer.Type(() => UserAddress),
2033
- tslib.__metadata("design:type", UserAddress)
2167
+ tslib_1.__metadata("design:type", UserAddress)
2034
2168
  ], SubscriptionMaterialization.prototype, "billingAddress", void 0);
2035
- tslib.__decorate([
2169
+ tslib_1.__decorate([
2036
2170
  classTransformer.Type(() => Coupon),
2037
- tslib.__metadata("design:type", Coupon)
2171
+ tslib_1.__metadata("design:type", Coupon)
2038
2172
  ], SubscriptionMaterialization.prototype, "coupon", void 0);
2039
- tslib.__decorate([
2173
+ tslib_1.__decorate([
2040
2174
  classTransformer.Type(() => Edition),
2041
- tslib.__metadata("design:type", Array)
2175
+ tslib_1.__metadata("design:type", Array)
2042
2176
  ], SubscriptionMaterialization.prototype, "editions", void 0);
2043
- tslib.__decorate([
2177
+ tslib_1.__decorate([
2044
2178
  classTransformer.Type(() => SubscriptionPayment),
2045
- tslib.__metadata("design:type", SubscriptionPayment)
2179
+ tslib_1.__metadata("design:type", SubscriptionPayment)
2046
2180
  ], SubscriptionMaterialization.prototype, "payment", void 0);
2047
2181
 
2048
2182
  class SubscriptionSummary extends BaseModel {
@@ -2468,7 +2602,7 @@ class ProductsIndex {
2468
2602
  }
2469
2603
  async save(product) {
2470
2604
  try {
2471
- const { createdAt, updatedAt, kitProducts } = product, data = tslib.__rest(product, ["createdAt", "updatedAt", "kitProducts"]);
2605
+ const { createdAt, updatedAt, kitProducts } = product, data = tslib_1.__rest(product, ["createdAt", "updatedAt", "kitProducts"]);
2472
2606
  this.adapter.save(this.index, data);
2473
2607
  }
2474
2608
  catch (error) {
@@ -4067,20 +4201,20 @@ class CategoryHasuraGraphQL extends Category {
4067
4201
 
4068
4202
  class ProductHasuraGraphQL extends Product {
4069
4203
  }
4070
- tslib.__decorate([
4204
+ tslib_1.__decorate([
4071
4205
  classTransformer.Type(() => KitProductHasuraGraphQL),
4072
- tslib.__metadata("design:type", Array)
4206
+ tslib_1.__metadata("design:type", Array)
4073
4207
  ], ProductHasuraGraphQL.prototype, "kitProducts", void 0);
4074
4208
 
4075
4209
  class KitProductHasuraGraphQL extends KitProduct {
4076
4210
  }
4077
- tslib.__decorate([
4211
+ tslib_1.__decorate([
4078
4212
  classTransformer.Type(() => ProductHasuraGraphQL),
4079
- tslib.__metadata("design:type", ProductHasuraGraphQL)
4213
+ tslib_1.__metadata("design:type", ProductHasuraGraphQL)
4080
4214
  ], KitProductHasuraGraphQL.prototype, "kit", void 0);
4081
- tslib.__decorate([
4215
+ tslib_1.__decorate([
4082
4216
  classTransformer.Type(() => ProductHasuraGraphQL),
4083
- tslib.__metadata("design:type", ProductHasuraGraphQL)
4217
+ tslib_1.__metadata("design:type", ProductHasuraGraphQL)
4084
4218
  ], KitProductHasuraGraphQL.prototype, "product", void 0);
4085
4219
 
4086
4220
  class VariantHasuraGraphQL extends Variant {
@@ -4322,7 +4456,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4322
4456
  this.categoryFilterRepository = categoryFilterRepository;
4323
4457
  }
4324
4458
  async create(params) {
4325
- const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
4459
+ const { metadata } = params, data = tslib_1.__rest(params, ["metadata"]);
4326
4460
  return super.create(Object.assign(Object.assign({}, data), { isWishlist: false, metadata: metadata || { description: null, title: null } }));
4327
4461
  }
4328
4462
  async get(identifiers) {
@@ -4332,7 +4466,7 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
4332
4466
  : super.get(identifiers);
4333
4467
  }
4334
4468
  async update(params) {
4335
- const { products, id: checkId, metadata, filters } = params, data = tslib.__rest(params, ["products", "id", "metadata", "filters"]);
4469
+ const { products, id: checkId, metadata, filters } = params, data = tslib_1.__rest(params, ["products", "id", "metadata", "filters"]);
4336
4470
  const plainData = this.paramsToPlain({ id: checkId });
4337
4471
  const id = await this.getId(plainData.id);
4338
4472
  const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: false }));
@@ -4584,7 +4718,7 @@ class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGrap
4584
4718
  this.categoryFilterRepository = categoryFilterRepository;
4585
4719
  }
4586
4720
  async update(params) {
4587
- const { options } = params, data = tslib.__rest(params, ["options"]);
4721
+ const { options } = params, data = tslib_1.__rest(params, ["options"]);
4588
4722
  const filter = await super.update(data);
4589
4723
  filter.options = await this.updateOptions(+data.id, { options });
4590
4724
  return filter;
@@ -4720,10 +4854,9 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4720
4854
  howToUse: data.how_to_use,
4721
4855
  brand: data.brand_description,
4722
4856
  ingredients: data.ingredients,
4723
- purpose: data.purpose,
4724
4857
  }),
4725
4858
  bindFindFilter: (filters) => {
4726
- 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 && {
4859
+ 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 && {
4727
4860
  who_must_use: filters.whoMustUse,
4728
4861
  })), (filters.howToUse && {
4729
4862
  how_to_use: filters.howToUse,
@@ -4731,13 +4864,11 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4731
4864
  brand_description: filters.brand,
4732
4865
  })), (filters.ingredients && {
4733
4866
  ingredients: filters.ingredients,
4734
- })), (filters.purpose && {
4735
- purpose: filters.purpose,
4736
4867
  }));
4737
4868
  },
4738
- 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 && {
4869
+ 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 && {
4739
4870
  who_must_use: descriptionData.whoMustUse,
4740
- })), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand })), (descriptionData.ingredients && { ingredients: descriptionData.ingredients })), (descriptionData.purpose && { purpose: descriptionData.purpose }))),
4871
+ })), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand })), (descriptionData.ingredients && { ingredients: descriptionData.ingredients }))),
4741
4872
  },
4742
4873
  },
4743
4874
  { differentials: { columnName: 'differentials' } },
@@ -4745,7 +4876,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4745
4876
  { howToUse: { columnName: 'how_to_use' } },
4746
4877
  { brandDescription: { columnName: 'brand_description' } },
4747
4878
  { ingredients: { columnName: 'ingredients' } },
4748
- { purpose: { columnName: 'purpose' } },
4749
4879
  { hasVariants: { columnName: 'has_variants' } },
4750
4880
  {
4751
4881
  images: {
@@ -4861,7 +4991,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4861
4991
  ];
4862
4992
  }
4863
4993
  async create(params) {
4864
- const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
4994
+ const { metadata } = params, data = tslib_1.__rest(params, ["metadata"]);
4865
4995
  const product = await super.create(lodash.omit(Object.assign(Object.assign({}, data), { metadata: metadata || { description: null, title: null } }), ['reviews']));
4866
4996
  try {
4867
4997
  product.reviews = data.reviews && (await this.updateReviews(+product.id, data));
@@ -4884,7 +5014,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4884
5014
  }
4885
5015
  async find(params) {
4886
5016
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
4887
- const _o = params || {}, { filters, fields } = _o, options = tslib.__rest(_o, ["filters", "fields"]);
5017
+ const _o = params || {}, { filters, fields } = _o, options = tslib_1.__rest(_o, ["filters", "fields"]);
4888
5018
  const bindFields = fields ||
4889
5019
  this.fields
4890
5020
  .map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
@@ -4922,7 +5052,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4922
5052
  return product;
4923
5053
  }
4924
5054
  async update(params) {
4925
- const { categories, kitProducts, reviews, id: checkId, rate, metadata } = params, data = tslib.__rest(params, ["categories", "kitProducts", "reviews", "id", "rate", "metadata"]);
5055
+ const { categories, kitProducts, reviews, id: checkId, rate, metadata } = params, data = tslib_1.__rest(params, ["categories", "kitProducts", "reviews", "id", "rate", "metadata"]);
4926
5056
  const plainData = this.paramsToPlain({ id: checkId });
4927
5057
  const id = await this.getId(plainData.id);
4928
5058
  const product = await super.update(Object.assign({ id }, data));
@@ -5129,41 +5259,6 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5129
5259
  }
5130
5260
  }
5131
5261
 
5132
- class ProductReviewsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5133
- constructor({ endpoint, authOptions, interceptors, }) {
5134
- super({
5135
- tableName: 'product_review',
5136
- model: ProductReviews,
5137
- endpoint,
5138
- authOptions,
5139
- interceptors,
5140
- fields: [
5141
- 'id',
5142
- { productId: { columnName: 'product_id' } },
5143
- 'shop',
5144
- 'rate',
5145
- 'author',
5146
- 'email',
5147
- 'location',
5148
- 'review',
5149
- 'status',
5150
- 'title',
5151
- { personId: { columnName: 'person_id' } },
5152
- 'points',
5153
- { orderId: { columnName: 'order_id' } },
5154
- { createdAt: { columnName: 'created_at' } },
5155
- { updatedAt: { columnName: 'updated_at' } },
5156
- ],
5157
- });
5158
- }
5159
- aproveReview(id) {
5160
- return this.update({ id, status: true });
5161
- }
5162
- disaproveReview(id) {
5163
- return this.update({ id, status: false });
5164
- }
5165
- }
5166
-
5167
5262
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5168
5263
  constructor({ endpoint, authOptions, interceptors, }) {
5169
5264
  super({
@@ -5242,11 +5337,11 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5242
5337
  return variant;
5243
5338
  }
5244
5339
  async find(params) {
5245
- const _a = params || {}, { filters } = _a, options = tslib.__rest(_a, ["filters"]);
5340
+ const _a = params || {}, { filters } = _a, options = tslib_1.__rest(_a, ["filters"]);
5246
5341
  return super.find(Object.assign(Object.assign({}, options), { filters: Object.assign({ productId: { operator: exports.Where.ISNOTNULL } }, filters) }));
5247
5342
  }
5248
5343
  async update(params) {
5249
- const { productId, id: checkId } = params, data = tslib.__rest(params, ["productId", "id"]);
5344
+ const { productId, id: checkId } = params, data = tslib_1.__rest(params, ["productId", "id"]);
5250
5345
  const dataWithProductId = this.paramsToPlain({ id: checkId, productId });
5251
5346
  const id = await this.getId(dataWithProductId.id);
5252
5347
  const product = await super.update(Object.assign({ id }, data));
@@ -5354,7 +5449,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5354
5449
  this.categoryFilterRepository = categoryFilterRepository;
5355
5450
  }
5356
5451
  async create(params) {
5357
- const { metadata } = params, data = tslib.__rest(params, ["metadata"]);
5452
+ const { metadata } = params, data = tslib_1.__rest(params, ["metadata"]);
5358
5453
  return super.create(Object.assign(Object.assign({}, data), { isWishlist: true, isCollection: true, brandCategory: false, metadata: metadata || { description: data.description, title: data.name } }));
5359
5454
  }
5360
5455
  async get(identifiers) {
@@ -5364,7 +5459,7 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5364
5459
  return data;
5365
5460
  }
5366
5461
  async update(params) {
5367
- const { products, id: checkId, metadata, filters } = params, data = tslib.__rest(params, ["products", "id", "metadata", "filters"]);
5462
+ const { products, id: checkId, metadata, filters } = params, data = tslib_1.__rest(params, ["products", "id", "metadata", "filters"]);
5368
5463
  const plainData = this.paramsToPlain({ id: checkId });
5369
5464
  const id = plainData.id;
5370
5465
  const category = await super.update(Object.assign(Object.assign({ id }, data), { isWishlist: true, isCollection: true, brandCategory: false }));
@@ -5660,8 +5755,6 @@ exports.Product = Product;
5660
5755
  exports.ProductFirestoreRepository = ProductFirestoreRepository;
5661
5756
  exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
5662
5757
  exports.ProductHasuraGraphQLRepository = ProductHasuraGraphQLRepository;
5663
- exports.ProductReviews = ProductReviews;
5664
- exports.ProductReviewsHasuraGraphQLRepository = ProductReviewsHasuraGraphQLRepository;
5665
5758
  exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
5666
5759
  exports.ProductsIndex = ProductsIndex;
5667
5760
  exports.RecoveryPassword = RecoveryPassword;