@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.
Files changed (25) hide show
  1. package/index.cjs.js +1026 -773
  2. package/index.esm.js +865 -636
  3. package/package.json +1 -1
  4. package/src/domain/catalog/models/index.d.ts +1 -0
  5. package/src/domain/catalog/models/product-reviews.d.ts +20 -0
  6. package/src/domain/catalog/models/types/shop-description.type.d.ts +1 -0
  7. package/src/domain/catalog/repositories/index.d.ts +1 -0
  8. package/src/domain/catalog/repositories/product-reviews.repository.d.ts +6 -0
  9. package/src/domain/shop-settings/models/types/index.d.ts +0 -3
  10. package/src/domain/shop-settings/models/types/sections.type.d.ts +0 -6
  11. package/src/domain/users/models/subscription/index.d.ts +3 -1
  12. package/src/domain/users/models/subscription/subscription-materialization.d.ts +31 -0
  13. package/src/domain/users/models/subscription/subscription-summary.d.ts +11 -0
  14. package/src/domain/users/models/subscription/subscription.d.ts +1 -0
  15. package/src/domain/users/repositories/index.d.ts +7 -5
  16. package/src/domain/users/repositories/subscription-materialization.repository.d.ts +4 -0
  17. package/src/domain/users/repositories/subscription-summary.repository.d.ts +4 -0
  18. package/src/infra/firebase/firestore/repositories/users/index.d.ts +2 -0
  19. package/src/infra/firebase/firestore/repositories/users/subscription-materialization-firestore.repository.d.ts +7 -0
  20. package/src/infra/firebase/firestore/repositories/users/subscription-summary-firestore.repository.d.ts +7 -0
  21. package/src/infra/hasura-graphql/repositories/catalog/index.d.ts +1 -0
  22. package/src/infra/hasura-graphql/repositories/catalog/product-review-hasura-graphql.repository.d.ts +12 -0
  23. package/src/domain/shop-settings/models/types/brands-carousel.type.d.ts +0 -3
  24. package/src/domain/shop-settings/models/types/landing-page.d.ts +0 -8
  25. package/src/domain/shop-settings/models/types/promotion-page.d.ts +0 -10
package/index.esm.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import 'reflect-metadata';
2
2
  import { plainToInstance, instanceToPlain, Expose, Type } from 'class-transformer';
3
- import { __decorate, __metadata, __values, __spreadArray, __read, __extends, __rest } from 'tslib';
3
+ import * as tslib_1 from 'tslib';
4
+ import { __decorate, __metadata, __rest } from 'tslib';
4
5
  import { parseISO } from 'date-fns';
5
6
  export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
6
- import { isNil, isArray, first, last, flatten, compact, get, isString, each, unset, isObject, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
+ import { isNil, isArray as isArray$1, first, last, flatten, compact, get, isString, each, unset, isObject as isObject$1, set, isNumber, isEmpty, chunk, isDate, isBoolean, isInteger, isNaN as isNaN$1, omit } from 'lodash';
7
8
  export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, unset } from 'lodash';
8
9
  import { debug } from 'debug';
9
10
  import { CustomError } from 'ts-custom-error';
@@ -256,6 +257,12 @@ var UserType;
256
257
  UserType["Influencer"] = "Influencer";
257
258
  })(UserType || (UserType = {}));
258
259
 
260
+ class Edition extends BaseModel {
261
+ static get identifiersFields() {
262
+ return ['id', 'subscriptionId'];
263
+ }
264
+ }
265
+
259
266
  var BillingStatus;
260
267
  (function (BillingStatus) {
261
268
  BillingStatus["PAYED"] = "PAGO";
@@ -280,12 +287,6 @@ var Status;
280
287
  Status["CANCELLED"] = "Cancelado";
281
288
  })(Status || (Status = {}));
282
289
 
283
- class Edition extends BaseModel {
284
- static get identifiersFields() {
285
- return ['id', 'subscriptionId'];
286
- }
287
- }
288
-
289
290
  class Payment extends BaseModel {
290
291
  static get identifiersFields() {
291
292
  return ['id'];
@@ -462,401 +463,478 @@ __decorate([
462
463
  __metadata("design:type", Payment)
463
464
  ], SubscriptionPayment.prototype, "payment", void 0);
464
465
 
465
- function isFunction(value) {
466
- return typeof value === 'function';
466
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
467
+ function isFunction(x) {
468
+ return typeof x === 'function';
467
469
  }
468
470
 
469
- function createErrorClass(createImpl) {
470
- var _super = function (instance) {
471
- Error.call(instance);
472
- instance.stack = new Error().stack;
473
- };
474
- var ctorFunc = createImpl(_super);
475
- ctorFunc.prototype = Object.create(Error.prototype);
476
- ctorFunc.prototype.constructor = ctorFunc;
477
- return ctorFunc;
471
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
472
+ var _enable_super_gross_mode_that_will_cause_bad_things = false;
473
+ var config = {
474
+ Promise: undefined,
475
+ set useDeprecatedSynchronousErrorHandling(value) {
476
+ if (value) {
477
+ var error = /*@__PURE__*/ new Error();
478
+ /*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
479
+ }
480
+ _enable_super_gross_mode_that_will_cause_bad_things = value;
481
+ },
482
+ get useDeprecatedSynchronousErrorHandling() {
483
+ return _enable_super_gross_mode_that_will_cause_bad_things;
484
+ },
485
+ };
486
+
487
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
488
+ function hostReportError(err) {
489
+ setTimeout(function () { throw err; }, 0);
478
490
  }
479
491
 
480
- var UnsubscriptionError = createErrorClass(function (_super) {
481
- return function UnsubscriptionErrorImpl(errors) {
482
- _super(this);
483
- this.message = errors
484
- ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
485
- : '';
486
- this.name = 'UnsubscriptionError';
487
- this.errors = errors;
488
- };
489
- });
492
+ /** PURE_IMPORTS_START _config,_util_hostReportError PURE_IMPORTS_END */
493
+ var empty = {
494
+ closed: true,
495
+ next: function (value) { },
496
+ error: function (err) {
497
+ if (config.useDeprecatedSynchronousErrorHandling) {
498
+ throw err;
499
+ }
500
+ else {
501
+ hostReportError(err);
502
+ }
503
+ },
504
+ complete: function () { }
505
+ };
490
506
 
491
- function arrRemove(arr, item) {
492
- if (arr) {
493
- var index = arr.indexOf(item);
494
- 0 <= index && arr.splice(index, 1);
495
- }
507
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
508
+ var isArray = /*@__PURE__*/ (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })();
509
+
510
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
511
+ function isObject(x) {
512
+ return x !== null && typeof x === 'object';
496
513
  }
497
514
 
498
- var Subscription$1 = (function () {
499
- function Subscription(initialTeardown) {
500
- this.initialTeardown = initialTeardown;
515
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
516
+ var UnsubscriptionErrorImpl = /*@__PURE__*/ (function () {
517
+ function UnsubscriptionErrorImpl(errors) {
518
+ Error.call(this);
519
+ this.message = errors ?
520
+ errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ') : '';
521
+ this.name = 'UnsubscriptionError';
522
+ this.errors = errors;
523
+ return this;
524
+ }
525
+ UnsubscriptionErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);
526
+ return UnsubscriptionErrorImpl;
527
+ })();
528
+ var UnsubscriptionError = UnsubscriptionErrorImpl;
529
+
530
+ /** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_UnsubscriptionError PURE_IMPORTS_END */
531
+ var Subscription$1 = /*@__PURE__*/ (function () {
532
+ function Subscription(unsubscribe) {
501
533
  this.closed = false;
502
- this._parentage = null;
503
- this._finalizers = null;
534
+ this._parentOrParents = null;
535
+ this._subscriptions = null;
536
+ if (unsubscribe) {
537
+ this._ctorUnsubscribe = true;
538
+ this._unsubscribe = unsubscribe;
539
+ }
504
540
  }
505
541
  Subscription.prototype.unsubscribe = function () {
506
- var e_1, _a, e_2, _b;
507
542
  var errors;
508
- if (!this.closed) {
509
- this.closed = true;
510
- var _parentage = this._parentage;
511
- if (_parentage) {
512
- this._parentage = null;
513
- if (Array.isArray(_parentage)) {
514
- try {
515
- for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
516
- var parent_1 = _parentage_1_1.value;
517
- parent_1.remove(this);
518
- }
519
- }
520
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
521
- finally {
522
- try {
523
- if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
524
- }
525
- finally { if (e_1) throw e_1.error; }
526
- }
527
- }
528
- else {
529
- _parentage.remove(this);
530
- }
543
+ if (this.closed) {
544
+ return;
545
+ }
546
+ var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
547
+ this.closed = true;
548
+ this._parentOrParents = null;
549
+ this._subscriptions = null;
550
+ if (_parentOrParents instanceof Subscription) {
551
+ _parentOrParents.remove(this);
552
+ }
553
+ else if (_parentOrParents !== null) {
554
+ for (var index = 0; index < _parentOrParents.length; ++index) {
555
+ var parent_1 = _parentOrParents[index];
556
+ parent_1.remove(this);
531
557
  }
532
- var initialFinalizer = this.initialTeardown;
533
- if (isFunction(initialFinalizer)) {
534
- try {
535
- initialFinalizer();
536
- }
537
- catch (e) {
538
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
539
- }
558
+ }
559
+ if (isFunction(_unsubscribe)) {
560
+ if (_ctorUnsubscribe) {
561
+ this._unsubscribe = undefined;
540
562
  }
541
- var _finalizers = this._finalizers;
542
- if (_finalizers) {
543
- this._finalizers = null;
544
- try {
545
- for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
546
- var finalizer = _finalizers_1_1.value;
547
- try {
548
- execFinalizer(finalizer);
563
+ try {
564
+ _unsubscribe.call(this);
565
+ }
566
+ catch (e) {
567
+ errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
568
+ }
569
+ }
570
+ if (isArray(_subscriptions)) {
571
+ var index = -1;
572
+ var len = _subscriptions.length;
573
+ while (++index < len) {
574
+ var sub = _subscriptions[index];
575
+ if (isObject(sub)) {
576
+ try {
577
+ sub.unsubscribe();
578
+ }
579
+ catch (e) {
580
+ errors = errors || [];
581
+ if (e instanceof UnsubscriptionError) {
582
+ errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
549
583
  }
550
- catch (err) {
551
- errors = errors !== null && errors !== void 0 ? errors : [];
552
- if (err instanceof UnsubscriptionError) {
553
- errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
554
- }
555
- else {
556
- errors.push(err);
557
- }
584
+ else {
585
+ errors.push(e);
558
586
  }
559
587
  }
560
588
  }
561
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
562
- finally {
563
- try {
564
- if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
565
- }
566
- finally { if (e_2) throw e_2.error; }
567
- }
568
- }
569
- if (errors) {
570
- throw new UnsubscriptionError(errors);
571
589
  }
572
590
  }
591
+ if (errors) {
592
+ throw new UnsubscriptionError(errors);
593
+ }
573
594
  };
574
595
  Subscription.prototype.add = function (teardown) {
575
- var _a;
576
- if (teardown && teardown !== this) {
577
- if (this.closed) {
578
- execFinalizer(teardown);
579
- }
580
- else {
581
- if (teardown instanceof Subscription) {
582
- if (teardown.closed || teardown._hasParent(this)) {
583
- return;
584
- }
585
- teardown._addParent(this);
596
+ var subscription = teardown;
597
+ if (!teardown) {
598
+ return Subscription.EMPTY;
599
+ }
600
+ switch (typeof teardown) {
601
+ case 'function':
602
+ subscription = new Subscription(teardown);
603
+ case 'object':
604
+ if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
605
+ return subscription;
606
+ }
607
+ else if (this.closed) {
608
+ subscription.unsubscribe();
609
+ return subscription;
610
+ }
611
+ else if (!(subscription instanceof Subscription)) {
612
+ var tmp = subscription;
613
+ subscription = new Subscription();
614
+ subscription._subscriptions = [tmp];
586
615
  }
587
- (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
616
+ break;
617
+ default: {
618
+ throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
588
619
  }
589
620
  }
590
- };
591
- Subscription.prototype._hasParent = function (parent) {
592
- var _parentage = this._parentage;
593
- return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
594
- };
595
- Subscription.prototype._addParent = function (parent) {
596
- var _parentage = this._parentage;
597
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
598
- };
599
- Subscription.prototype._removeParent = function (parent) {
600
- var _parentage = this._parentage;
601
- if (_parentage === parent) {
602
- this._parentage = null;
621
+ var _parentOrParents = subscription._parentOrParents;
622
+ if (_parentOrParents === null) {
623
+ subscription._parentOrParents = this;
624
+ }
625
+ else if (_parentOrParents instanceof Subscription) {
626
+ if (_parentOrParents === this) {
627
+ return subscription;
628
+ }
629
+ subscription._parentOrParents = [_parentOrParents, this];
630
+ }
631
+ else if (_parentOrParents.indexOf(this) === -1) {
632
+ _parentOrParents.push(this);
633
+ }
634
+ else {
635
+ return subscription;
636
+ }
637
+ var subscriptions = this._subscriptions;
638
+ if (subscriptions === null) {
639
+ this._subscriptions = [subscription];
603
640
  }
604
- else if (Array.isArray(_parentage)) {
605
- arrRemove(_parentage, parent);
641
+ else {
642
+ subscriptions.push(subscription);
606
643
  }
644
+ return subscription;
607
645
  };
608
- Subscription.prototype.remove = function (teardown) {
609
- var _finalizers = this._finalizers;
610
- _finalizers && arrRemove(_finalizers, teardown);
611
- if (teardown instanceof Subscription) {
612
- teardown._removeParent(this);
646
+ Subscription.prototype.remove = function (subscription) {
647
+ var subscriptions = this._subscriptions;
648
+ if (subscriptions) {
649
+ var subscriptionIndex = subscriptions.indexOf(subscription);
650
+ if (subscriptionIndex !== -1) {
651
+ subscriptions.splice(subscriptionIndex, 1);
652
+ }
613
653
  }
614
654
  };
615
- Subscription.EMPTY = (function () {
616
- var empty = new Subscription();
655
+ Subscription.EMPTY = (function (empty) {
617
656
  empty.closed = true;
618
657
  return empty;
619
- })();
658
+ }(new Subscription()));
620
659
  return Subscription;
621
660
  }());
622
- var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
623
- function isSubscription(value) {
624
- return (value instanceof Subscription$1 ||
625
- (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
626
- }
627
- function execFinalizer(finalizer) {
628
- if (isFunction(finalizer)) {
629
- finalizer();
630
- }
631
- else {
632
- finalizer.unsubscribe();
633
- }
661
+ function flattenUnsubscriptionErrors(errors) {
662
+ return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []);
634
663
  }
635
664
 
636
- var config = {
637
- onUnhandledError: null,
638
- onStoppedNotification: null,
639
- Promise: undefined,
640
- useDeprecatedSynchronousErrorHandling: false,
641
- useDeprecatedNextContext: false,
642
- };
643
-
644
- var timeoutProvider = {
645
- setTimeout: function (handler, timeout) {
646
- var args = [];
647
- for (var _i = 2; _i < arguments.length; _i++) {
648
- args[_i - 2] = arguments[_i];
649
- }
650
- var delegate = timeoutProvider.delegate;
651
- if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
652
- return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
653
- }
654
- return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
655
- },
656
- clearTimeout: function (handle) {
657
- var delegate = timeoutProvider.delegate;
658
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
659
- },
660
- delegate: undefined,
661
- };
662
-
663
- function reportUnhandledError(err) {
664
- timeoutProvider.setTimeout(function () {
665
- {
666
- throw err;
667
- }
668
- });
669
- }
670
-
671
- function noop() { }
672
-
673
- var context = null;
674
- function errorContext(cb) {
675
- if (config.useDeprecatedSynchronousErrorHandling) {
676
- var isRoot = !context;
677
- if (isRoot) {
678
- context = { errorThrown: false, error: null };
679
- }
680
- cb();
681
- if (isRoot) {
682
- var _a = context, errorThrown = _a.errorThrown, error = _a.error;
683
- context = null;
684
- if (errorThrown) {
685
- throw error;
686
- }
687
- }
688
- }
689
- else {
690
- cb();
691
- }
692
- }
693
-
694
- var Subscriber = (function (_super) {
695
- __extends(Subscriber, _super);
696
- function Subscriber(destination) {
665
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
666
+ var rxSubscriber = /*@__PURE__*/ (function () {
667
+ return typeof Symbol === 'function'
668
+ ? /*@__PURE__*/ Symbol('rxSubscriber')
669
+ : '@@rxSubscriber_' + /*@__PURE__*/ Math.random();
670
+ })();
671
+
672
+ /** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */
673
+ var Subscriber = /*@__PURE__*/ (function (_super) {
674
+ tslib_1.__extends(Subscriber, _super);
675
+ function Subscriber(destinationOrNext, error, complete) {
697
676
  var _this = _super.call(this) || this;
677
+ _this.syncErrorValue = null;
678
+ _this.syncErrorThrown = false;
679
+ _this.syncErrorThrowable = false;
698
680
  _this.isStopped = false;
699
- if (destination) {
700
- _this.destination = destination;
701
- if (isSubscription(destination)) {
702
- destination.add(_this);
703
- }
704
- }
705
- else {
706
- _this.destination = EMPTY_OBSERVER;
681
+ switch (arguments.length) {
682
+ case 0:
683
+ _this.destination = empty;
684
+ break;
685
+ case 1:
686
+ if (!destinationOrNext) {
687
+ _this.destination = empty;
688
+ break;
689
+ }
690
+ if (typeof destinationOrNext === 'object') {
691
+ if (destinationOrNext instanceof Subscriber) {
692
+ _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
693
+ _this.destination = destinationOrNext;
694
+ destinationOrNext.add(_this);
695
+ }
696
+ else {
697
+ _this.syncErrorThrowable = true;
698
+ _this.destination = new SafeSubscriber(_this, destinationOrNext);
699
+ }
700
+ break;
701
+ }
702
+ default:
703
+ _this.syncErrorThrowable = true;
704
+ _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
705
+ break;
707
706
  }
708
707
  return _this;
709
708
  }
709
+ Subscriber.prototype[rxSubscriber] = function () { return this; };
710
710
  Subscriber.create = function (next, error, complete) {
711
- return new SafeSubscriber(next, error, complete);
711
+ var subscriber = new Subscriber(next, error, complete);
712
+ subscriber.syncErrorThrowable = false;
713
+ return subscriber;
712
714
  };
713
715
  Subscriber.prototype.next = function (value) {
714
- if (this.isStopped) ;
715
- else {
716
+ if (!this.isStopped) {
716
717
  this._next(value);
717
718
  }
718
719
  };
719
720
  Subscriber.prototype.error = function (err) {
720
- if (this.isStopped) ;
721
- else {
721
+ if (!this.isStopped) {
722
722
  this.isStopped = true;
723
723
  this._error(err);
724
724
  }
725
725
  };
726
726
  Subscriber.prototype.complete = function () {
727
- if (this.isStopped) ;
728
- else {
727
+ if (!this.isStopped) {
729
728
  this.isStopped = true;
730
729
  this._complete();
731
730
  }
732
731
  };
733
732
  Subscriber.prototype.unsubscribe = function () {
734
- if (!this.closed) {
735
- this.isStopped = true;
736
- _super.prototype.unsubscribe.call(this);
737
- this.destination = null;
733
+ if (this.closed) {
734
+ return;
738
735
  }
736
+ this.isStopped = true;
737
+ _super.prototype.unsubscribe.call(this);
739
738
  };
740
739
  Subscriber.prototype._next = function (value) {
741
740
  this.destination.next(value);
742
741
  };
743
742
  Subscriber.prototype._error = function (err) {
744
- try {
745
- this.destination.error(err);
746
- }
747
- finally {
748
- this.unsubscribe();
749
- }
743
+ this.destination.error(err);
744
+ this.unsubscribe();
750
745
  };
751
746
  Subscriber.prototype._complete = function () {
752
- try {
753
- this.destination.complete();
754
- }
755
- finally {
756
- this.unsubscribe();
757
- }
747
+ this.destination.complete();
748
+ this.unsubscribe();
749
+ };
750
+ Subscriber.prototype._unsubscribeAndRecycle = function () {
751
+ var _parentOrParents = this._parentOrParents;
752
+ this._parentOrParents = null;
753
+ this.unsubscribe();
754
+ this.closed = false;
755
+ this.isStopped = false;
756
+ this._parentOrParents = _parentOrParents;
757
+ return this;
758
758
  };
759
759
  return Subscriber;
760
760
  }(Subscription$1));
761
- var _bind = Function.prototype.bind;
762
- function bind(fn, thisArg) {
763
- return _bind.call(fn, thisArg);
764
- }
765
- var ConsumerObserver = (function () {
766
- function ConsumerObserver(partialObserver) {
767
- this.partialObserver = partialObserver;
761
+ var SafeSubscriber = /*@__PURE__*/ (function (_super) {
762
+ tslib_1.__extends(SafeSubscriber, _super);
763
+ function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
764
+ var _this = _super.call(this) || this;
765
+ _this._parentSubscriber = _parentSubscriber;
766
+ var next;
767
+ var context = _this;
768
+ if (isFunction(observerOrNext)) {
769
+ next = observerOrNext;
770
+ }
771
+ else if (observerOrNext) {
772
+ next = observerOrNext.next;
773
+ error = observerOrNext.error;
774
+ complete = observerOrNext.complete;
775
+ if (observerOrNext !== empty) {
776
+ context = Object.create(observerOrNext);
777
+ if (isFunction(context.unsubscribe)) {
778
+ _this.add(context.unsubscribe.bind(context));
779
+ }
780
+ context.unsubscribe = _this.unsubscribe.bind(_this);
781
+ }
782
+ }
783
+ _this._context = context;
784
+ _this._next = next;
785
+ _this._error = error;
786
+ _this._complete = complete;
787
+ return _this;
768
788
  }
769
- ConsumerObserver.prototype.next = function (value) {
770
- var partialObserver = this.partialObserver;
771
- if (partialObserver.next) {
772
- try {
773
- partialObserver.next(value);
789
+ SafeSubscriber.prototype.next = function (value) {
790
+ if (!this.isStopped && this._next) {
791
+ var _parentSubscriber = this._parentSubscriber;
792
+ if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
793
+ this.__tryOrUnsub(this._next, value);
774
794
  }
775
- catch (error) {
776
- handleUnhandledError(error);
795
+ else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
796
+ this.unsubscribe();
777
797
  }
778
798
  }
779
799
  };
780
- ConsumerObserver.prototype.error = function (err) {
781
- var partialObserver = this.partialObserver;
782
- if (partialObserver.error) {
783
- try {
784
- partialObserver.error(err);
800
+ SafeSubscriber.prototype.error = function (err) {
801
+ if (!this.isStopped) {
802
+ var _parentSubscriber = this._parentSubscriber;
803
+ var useDeprecatedSynchronousErrorHandling = config.useDeprecatedSynchronousErrorHandling;
804
+ if (this._error) {
805
+ if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
806
+ this.__tryOrUnsub(this._error, err);
807
+ this.unsubscribe();
808
+ }
809
+ else {
810
+ this.__tryOrSetError(_parentSubscriber, this._error, err);
811
+ this.unsubscribe();
812
+ }
813
+ }
814
+ else if (!_parentSubscriber.syncErrorThrowable) {
815
+ this.unsubscribe();
816
+ if (useDeprecatedSynchronousErrorHandling) {
817
+ throw err;
818
+ }
819
+ hostReportError(err);
785
820
  }
786
- catch (error) {
787
- handleUnhandledError(error);
821
+ else {
822
+ if (useDeprecatedSynchronousErrorHandling) {
823
+ _parentSubscriber.syncErrorValue = err;
824
+ _parentSubscriber.syncErrorThrown = true;
825
+ }
826
+ else {
827
+ hostReportError(err);
828
+ }
829
+ this.unsubscribe();
788
830
  }
789
831
  }
790
- else {
791
- handleUnhandledError(err);
832
+ };
833
+ SafeSubscriber.prototype.complete = function () {
834
+ var _this = this;
835
+ if (!this.isStopped) {
836
+ var _parentSubscriber = this._parentSubscriber;
837
+ if (this._complete) {
838
+ var wrappedComplete = function () { return _this._complete.call(_this._context); };
839
+ if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
840
+ this.__tryOrUnsub(wrappedComplete);
841
+ this.unsubscribe();
842
+ }
843
+ else {
844
+ this.__tryOrSetError(_parentSubscriber, wrappedComplete);
845
+ this.unsubscribe();
846
+ }
847
+ }
848
+ else {
849
+ this.unsubscribe();
850
+ }
792
851
  }
793
852
  };
794
- ConsumerObserver.prototype.complete = function () {
795
- var partialObserver = this.partialObserver;
796
- if (partialObserver.complete) {
797
- try {
798
- partialObserver.complete();
853
+ SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
854
+ try {
855
+ fn.call(this._context, value);
856
+ }
857
+ catch (err) {
858
+ this.unsubscribe();
859
+ if (config.useDeprecatedSynchronousErrorHandling) {
860
+ throw err;
799
861
  }
800
- catch (error) {
801
- handleUnhandledError(error);
862
+ else {
863
+ hostReportError(err);
802
864
  }
803
865
  }
804
866
  };
805
- return ConsumerObserver;
806
- }());
807
- var SafeSubscriber = (function (_super) {
808
- __extends(SafeSubscriber, _super);
809
- function SafeSubscriber(observerOrNext, error, complete) {
810
- var _this = _super.call(this) || this;
811
- var partialObserver;
812
- if (isFunction(observerOrNext) || !observerOrNext) {
813
- partialObserver = {
814
- next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
815
- error: error !== null && error !== void 0 ? error : undefined,
816
- complete: complete !== null && complete !== void 0 ? complete : undefined,
817
- };
867
+ SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
868
+ if (!config.useDeprecatedSynchronousErrorHandling) {
869
+ throw new Error('bad call');
818
870
  }
819
- else {
820
- var context_1;
821
- if (_this && config.useDeprecatedNextContext) {
822
- context_1 = Object.create(observerOrNext);
823
- context_1.unsubscribe = function () { return _this.unsubscribe(); };
824
- partialObserver = {
825
- next: observerOrNext.next && bind(observerOrNext.next, context_1),
826
- error: observerOrNext.error && bind(observerOrNext.error, context_1),
827
- complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
828
- };
871
+ try {
872
+ fn.call(this._context, value);
873
+ }
874
+ catch (err) {
875
+ if (config.useDeprecatedSynchronousErrorHandling) {
876
+ parent.syncErrorValue = err;
877
+ parent.syncErrorThrown = true;
878
+ return true;
829
879
  }
830
880
  else {
831
- partialObserver = observerOrNext;
881
+ hostReportError(err);
882
+ return true;
832
883
  }
833
884
  }
834
- _this.destination = new ConsumerObserver(partialObserver);
835
- return _this;
836
- }
885
+ return false;
886
+ };
887
+ SafeSubscriber.prototype._unsubscribe = function () {
888
+ var _parentSubscriber = this._parentSubscriber;
889
+ this._context = null;
890
+ this._parentSubscriber = null;
891
+ _parentSubscriber.unsubscribe();
892
+ };
837
893
  return SafeSubscriber;
838
894
  }(Subscriber));
839
- function handleUnhandledError(error) {
840
- {
841
- reportUnhandledError(error);
895
+
896
+ /** PURE_IMPORTS_START _Subscriber PURE_IMPORTS_END */
897
+ function canReportError(observer) {
898
+ while (observer) {
899
+ var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped;
900
+ if (closed_1 || isStopped) {
901
+ return false;
902
+ }
903
+ else if (destination && destination instanceof Subscriber) {
904
+ observer = destination;
905
+ }
906
+ else {
907
+ observer = null;
908
+ }
842
909
  }
910
+ return true;
843
911
  }
844
- function defaultErrorHandler(err) {
845
- throw err;
912
+
913
+ /** PURE_IMPORTS_START _Subscriber,_symbol_rxSubscriber,_Observer PURE_IMPORTS_END */
914
+ function toSubscriber(nextOrObserver, error, complete) {
915
+ if (nextOrObserver) {
916
+ if (nextOrObserver instanceof Subscriber) {
917
+ return nextOrObserver;
918
+ }
919
+ if (nextOrObserver[rxSubscriber]) {
920
+ return nextOrObserver[rxSubscriber]();
921
+ }
922
+ }
923
+ if (!nextOrObserver && !error && !complete) {
924
+ return new Subscriber(empty);
925
+ }
926
+ return new Subscriber(nextOrObserver, error, complete);
846
927
  }
847
- var EMPTY_OBSERVER = {
848
- closed: true,
849
- next: noop,
850
- error: defaultErrorHandler,
851
- complete: noop,
852
- };
853
928
 
854
- var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
929
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
930
+ var observable = /*@__PURE__*/ (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })();
855
931
 
932
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
856
933
  function identity(x) {
857
934
  return x;
858
935
  }
859
936
 
937
+ /** PURE_IMPORTS_START _identity PURE_IMPORTS_END */
860
938
  function pipeFromArray(fns) {
861
939
  if (fns.length === 0) {
862
940
  return identity;
@@ -869,8 +947,10 @@ function pipeFromArray(fns) {
869
947
  };
870
948
  }
871
949
 
872
- var Observable = (function () {
950
+ /** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */
951
+ var Observable = /*@__PURE__*/ (function () {
873
952
  function Observable(subscribe) {
953
+ this._isScalar = false;
874
954
  if (subscribe) {
875
955
  this._subscribe = subscribe;
876
956
  }
@@ -882,52 +962,64 @@ var Observable = (function () {
882
962
  return observable;
883
963
  };
884
964
  Observable.prototype.subscribe = function (observerOrNext, error, complete) {
885
- var _this = this;
886
- var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
887
- errorContext(function () {
888
- var _a = _this, operator = _a.operator, source = _a.source;
889
- subscriber.add(operator
890
- ?
891
- operator.call(subscriber, source)
892
- : source
893
- ?
894
- _this._subscribe(subscriber)
895
- :
896
- _this._trySubscribe(subscriber));
897
- });
898
- return subscriber;
965
+ var operator = this.operator;
966
+ var sink = toSubscriber(observerOrNext, error, complete);
967
+ if (operator) {
968
+ sink.add(operator.call(sink, this.source));
969
+ }
970
+ else {
971
+ sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
972
+ this._subscribe(sink) :
973
+ this._trySubscribe(sink));
974
+ }
975
+ if (config.useDeprecatedSynchronousErrorHandling) {
976
+ if (sink.syncErrorThrowable) {
977
+ sink.syncErrorThrowable = false;
978
+ if (sink.syncErrorThrown) {
979
+ throw sink.syncErrorValue;
980
+ }
981
+ }
982
+ }
983
+ return sink;
899
984
  };
900
985
  Observable.prototype._trySubscribe = function (sink) {
901
986
  try {
902
987
  return this._subscribe(sink);
903
988
  }
904
989
  catch (err) {
905
- sink.error(err);
990
+ if (config.useDeprecatedSynchronousErrorHandling) {
991
+ sink.syncErrorThrown = true;
992
+ sink.syncErrorValue = err;
993
+ }
994
+ if (canReportError(sink)) {
995
+ sink.error(err);
996
+ }
997
+ else {
998
+ console.warn(err);
999
+ }
906
1000
  }
907
1001
  };
908
1002
  Observable.prototype.forEach = function (next, promiseCtor) {
909
1003
  var _this = this;
910
1004
  promiseCtor = getPromiseCtor(promiseCtor);
911
1005
  return new promiseCtor(function (resolve, reject) {
912
- var subscriber = new SafeSubscriber({
913
- next: function (value) {
914
- try {
915
- next(value);
916
- }
917
- catch (err) {
918
- reject(err);
919
- subscriber.unsubscribe();
1006
+ var subscription;
1007
+ subscription = _this.subscribe(function (value) {
1008
+ try {
1009
+ next(value);
1010
+ }
1011
+ catch (err) {
1012
+ reject(err);
1013
+ if (subscription) {
1014
+ subscription.unsubscribe();
920
1015
  }
921
- },
922
- error: reject,
923
- complete: resolve,
924
- });
925
- _this.subscribe(subscriber);
1016
+ }
1017
+ }, reject, resolve);
926
1018
  });
927
1019
  };
928
1020
  Observable.prototype._subscribe = function (subscriber) {
929
- var _a;
930
- return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
1021
+ var source = this.source;
1022
+ return source && source.subscribe(subscriber);
931
1023
  };
932
1024
  Observable.prototype[observable] = function () {
933
1025
  return this;
@@ -937,6 +1029,9 @@ var Observable = (function () {
937
1029
  for (var _i = 0; _i < arguments.length; _i++) {
938
1030
  operations[_i] = arguments[_i];
939
1031
  }
1032
+ if (operations.length === 0) {
1033
+ return this;
1034
+ }
940
1035
  return pipeFromArray(operations)(this);
941
1036
  };
942
1037
  Observable.prototype.toPromise = function (promiseCtor) {
@@ -944,7 +1039,7 @@ var Observable = (function () {
944
1039
  promiseCtor = getPromiseCtor(promiseCtor);
945
1040
  return new promiseCtor(function (resolve, reject) {
946
1041
  var value;
947
- _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
1042
+ _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
948
1043
  });
949
1044
  };
950
1045
  Observable.create = function (subscribe) {
@@ -953,139 +1048,155 @@ var Observable = (function () {
953
1048
  return Observable;
954
1049
  }());
955
1050
  function getPromiseCtor(promiseCtor) {
956
- var _a;
957
- return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
958
- }
959
- function isObserver(value) {
960
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
961
- }
962
- function isSubscriber(value) {
963
- return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
1051
+ if (!promiseCtor) {
1052
+ promiseCtor = config.Promise || Promise;
1053
+ }
1054
+ if (!promiseCtor) {
1055
+ throw new Error('no Promise impl found');
1056
+ }
1057
+ return promiseCtor;
964
1058
  }
965
1059
 
966
- var ObjectUnsubscribedError = createErrorClass(function (_super) {
967
- return function ObjectUnsubscribedErrorImpl() {
968
- _super(this);
969
- this.name = 'ObjectUnsubscribedError';
1060
+ /** PURE_IMPORTS_START PURE_IMPORTS_END */
1061
+ var ObjectUnsubscribedErrorImpl = /*@__PURE__*/ (function () {
1062
+ function ObjectUnsubscribedErrorImpl() {
1063
+ Error.call(this);
970
1064
  this.message = 'object unsubscribed';
1065
+ this.name = 'ObjectUnsubscribedError';
1066
+ return this;
1067
+ }
1068
+ ObjectUnsubscribedErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);
1069
+ return ObjectUnsubscribedErrorImpl;
1070
+ })();
1071
+ var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl;
1072
+
1073
+ /** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */
1074
+ var SubjectSubscription = /*@__PURE__*/ (function (_super) {
1075
+ tslib_1.__extends(SubjectSubscription, _super);
1076
+ function SubjectSubscription(subject, subscriber) {
1077
+ var _this = _super.call(this) || this;
1078
+ _this.subject = subject;
1079
+ _this.subscriber = subscriber;
1080
+ _this.closed = false;
1081
+ return _this;
1082
+ }
1083
+ SubjectSubscription.prototype.unsubscribe = function () {
1084
+ if (this.closed) {
1085
+ return;
1086
+ }
1087
+ this.closed = true;
1088
+ var subject = this.subject;
1089
+ var observers = subject.observers;
1090
+ this.subject = null;
1091
+ if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
1092
+ return;
1093
+ }
1094
+ var subscriberIndex = observers.indexOf(this.subscriber);
1095
+ if (subscriberIndex !== -1) {
1096
+ observers.splice(subscriberIndex, 1);
1097
+ }
971
1098
  };
972
- });
1099
+ return SubjectSubscription;
1100
+ }(Subscription$1));
973
1101
 
974
- var Subject = (function (_super) {
975
- __extends(Subject, _super);
1102
+ /** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */
1103
+ var SubjectSubscriber = /*@__PURE__*/ (function (_super) {
1104
+ tslib_1.__extends(SubjectSubscriber, _super);
1105
+ function SubjectSubscriber(destination) {
1106
+ var _this = _super.call(this, destination) || this;
1107
+ _this.destination = destination;
1108
+ return _this;
1109
+ }
1110
+ return SubjectSubscriber;
1111
+ }(Subscriber));
1112
+ var Subject = /*@__PURE__*/ (function (_super) {
1113
+ tslib_1.__extends(Subject, _super);
976
1114
  function Subject() {
977
1115
  var _this = _super.call(this) || this;
978
- _this.closed = false;
979
- _this.currentObservers = null;
980
1116
  _this.observers = [];
1117
+ _this.closed = false;
981
1118
  _this.isStopped = false;
982
1119
  _this.hasError = false;
983
1120
  _this.thrownError = null;
984
1121
  return _this;
985
1122
  }
1123
+ Subject.prototype[rxSubscriber] = function () {
1124
+ return new SubjectSubscriber(this);
1125
+ };
986
1126
  Subject.prototype.lift = function (operator) {
987
1127
  var subject = new AnonymousSubject(this, this);
988
1128
  subject.operator = operator;
989
1129
  return subject;
990
1130
  };
991
- Subject.prototype._throwIfClosed = function () {
1131
+ Subject.prototype.next = function (value) {
992
1132
  if (this.closed) {
993
1133
  throw new ObjectUnsubscribedError();
994
1134
  }
995
- };
996
- Subject.prototype.next = function (value) {
997
- var _this = this;
998
- errorContext(function () {
999
- var e_1, _a;
1000
- _this._throwIfClosed();
1001
- if (!_this.isStopped) {
1002
- if (!_this.currentObservers) {
1003
- _this.currentObservers = Array.from(_this.observers);
1004
- }
1005
- try {
1006
- for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
1007
- var observer = _c.value;
1008
- observer.next(value);
1009
- }
1010
- }
1011
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1012
- finally {
1013
- try {
1014
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1015
- }
1016
- finally { if (e_1) throw e_1.error; }
1017
- }
1135
+ if (!this.isStopped) {
1136
+ var observers = this.observers;
1137
+ var len = observers.length;
1138
+ var copy = observers.slice();
1139
+ for (var i = 0; i < len; i++) {
1140
+ copy[i].next(value);
1018
1141
  }
1019
- });
1142
+ }
1020
1143
  };
1021
1144
  Subject.prototype.error = function (err) {
1022
- var _this = this;
1023
- errorContext(function () {
1024
- _this._throwIfClosed();
1025
- if (!_this.isStopped) {
1026
- _this.hasError = _this.isStopped = true;
1027
- _this.thrownError = err;
1028
- var observers = _this.observers;
1029
- while (observers.length) {
1030
- observers.shift().error(err);
1031
- }
1032
- }
1033
- });
1145
+ if (this.closed) {
1146
+ throw new ObjectUnsubscribedError();
1147
+ }
1148
+ this.hasError = true;
1149
+ this.thrownError = err;
1150
+ this.isStopped = true;
1151
+ var observers = this.observers;
1152
+ var len = observers.length;
1153
+ var copy = observers.slice();
1154
+ for (var i = 0; i < len; i++) {
1155
+ copy[i].error(err);
1156
+ }
1157
+ this.observers.length = 0;
1034
1158
  };
1035
1159
  Subject.prototype.complete = function () {
1036
- var _this = this;
1037
- errorContext(function () {
1038
- _this._throwIfClosed();
1039
- if (!_this.isStopped) {
1040
- _this.isStopped = true;
1041
- var observers = _this.observers;
1042
- while (observers.length) {
1043
- observers.shift().complete();
1044
- }
1045
- }
1046
- });
1160
+ if (this.closed) {
1161
+ throw new ObjectUnsubscribedError();
1162
+ }
1163
+ this.isStopped = true;
1164
+ var observers = this.observers;
1165
+ var len = observers.length;
1166
+ var copy = observers.slice();
1167
+ for (var i = 0; i < len; i++) {
1168
+ copy[i].complete();
1169
+ }
1170
+ this.observers.length = 0;
1047
1171
  };
1048
1172
  Subject.prototype.unsubscribe = function () {
1049
- this.isStopped = this.closed = true;
1050
- this.observers = this.currentObservers = null;
1173
+ this.isStopped = true;
1174
+ this.closed = true;
1175
+ this.observers = null;
1051
1176
  };
1052
- Object.defineProperty(Subject.prototype, "observed", {
1053
- get: function () {
1054
- var _a;
1055
- return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
1056
- },
1057
- enumerable: false,
1058
- configurable: true
1059
- });
1060
1177
  Subject.prototype._trySubscribe = function (subscriber) {
1061
- this._throwIfClosed();
1062
- return _super.prototype._trySubscribe.call(this, subscriber);
1178
+ if (this.closed) {
1179
+ throw new ObjectUnsubscribedError();
1180
+ }
1181
+ else {
1182
+ return _super.prototype._trySubscribe.call(this, subscriber);
1183
+ }
1063
1184
  };
1064
1185
  Subject.prototype._subscribe = function (subscriber) {
1065
- this._throwIfClosed();
1066
- this._checkFinalizedStatuses(subscriber);
1067
- return this._innerSubscribe(subscriber);
1068
- };
1069
- Subject.prototype._innerSubscribe = function (subscriber) {
1070
- var _this = this;
1071
- var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
1072
- if (hasError || isStopped) {
1073
- return EMPTY_SUBSCRIPTION;
1186
+ if (this.closed) {
1187
+ throw new ObjectUnsubscribedError();
1074
1188
  }
1075
- this.currentObservers = null;
1076
- observers.push(subscriber);
1077
- return new Subscription$1(function () {
1078
- _this.currentObservers = null;
1079
- arrRemove(observers, subscriber);
1080
- });
1081
- };
1082
- Subject.prototype._checkFinalizedStatuses = function (subscriber) {
1083
- var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
1084
- if (hasError) {
1085
- subscriber.error(thrownError);
1189
+ else if (this.hasError) {
1190
+ subscriber.error(this.thrownError);
1191
+ return Subscription$1.EMPTY;
1086
1192
  }
1087
- else if (isStopped) {
1193
+ else if (this.isStopped) {
1088
1194
  subscriber.complete();
1195
+ return Subscription$1.EMPTY;
1196
+ }
1197
+ else {
1198
+ this.observers.push(subscriber);
1199
+ return new SubjectSubscription(this, subscriber);
1089
1200
  }
1090
1201
  };
1091
1202
  Subject.prototype.asObservable = function () {
@@ -1098,8 +1209,8 @@ var Subject = (function (_super) {
1098
1209
  };
1099
1210
  return Subject;
1100
1211
  }(Observable));
1101
- var AnonymousSubject = (function (_super) {
1102
- __extends(AnonymousSubject, _super);
1212
+ var AnonymousSubject = /*@__PURE__*/ (function (_super) {
1213
+ tslib_1.__extends(AnonymousSubject, _super);
1103
1214
  function AnonymousSubject(destination, source) {
1104
1215
  var _this = _super.call(this) || this;
1105
1216
  _this.destination = destination;
@@ -1107,20 +1218,31 @@ var AnonymousSubject = (function (_super) {
1107
1218
  return _this;
1108
1219
  }
1109
1220
  AnonymousSubject.prototype.next = function (value) {
1110
- var _a, _b;
1111
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
1221
+ var destination = this.destination;
1222
+ if (destination && destination.next) {
1223
+ destination.next(value);
1224
+ }
1112
1225
  };
1113
1226
  AnonymousSubject.prototype.error = function (err) {
1114
- var _a, _b;
1115
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
1227
+ var destination = this.destination;
1228
+ if (destination && destination.error) {
1229
+ this.destination.error(err);
1230
+ }
1116
1231
  };
1117
1232
  AnonymousSubject.prototype.complete = function () {
1118
- var _a, _b;
1119
- (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
1233
+ var destination = this.destination;
1234
+ if (destination && destination.complete) {
1235
+ this.destination.complete();
1236
+ }
1120
1237
  };
1121
1238
  AnonymousSubject.prototype._subscribe = function (subscriber) {
1122
- var _a, _b;
1123
- return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
1239
+ var source = this.source;
1240
+ if (source) {
1241
+ return this.source.subscribe(subscriber);
1242
+ }
1243
+ else {
1244
+ return Subscription$1.EMPTY;
1245
+ }
1124
1246
  };
1125
1247
  return AnonymousSubject;
1126
1248
  }(Subject));
@@ -1162,11 +1284,11 @@ class ReflectHelper {
1162
1284
  }
1163
1285
  static first({ key, target, property, own = true }) {
1164
1286
  const values = ReflectHelper.get({ key, target, property, own });
1165
- return isArray(values) ? first(values) : values;
1287
+ return isArray$1(values) ? first(values) : values;
1166
1288
  }
1167
1289
  static last({ key, target, property, own = true }) {
1168
1290
  const values = ReflectHelper.get({ key, target, property, own });
1169
- return isArray(values) ? last(values) : values;
1291
+ return isArray$1(values) ? last(values) : values;
1170
1292
  }
1171
1293
  static set({ key, target, property, value, propertyDescriptor }) {
1172
1294
  Reflect.defineMetadata(key, value, target, property);
@@ -1192,7 +1314,7 @@ class ReflectHelper {
1192
1314
  const values = target[property];
1193
1315
  let value = values.value;
1194
1316
  const propertyDescriptor = values.propertyDescriptor;
1195
- if (!isArray(value))
1317
+ if (!isArray$1(value))
1196
1318
  value = [value];
1197
1319
  return flatten(value.map((val) => {
1198
1320
  return {
@@ -1656,191 +1778,82 @@ class SubscriptionPlan extends BaseModel {
1656
1778
 
1657
1779
  class BeautyProfile extends BaseModel {
1658
1780
  toPlain() {
1659
- const plain = super.toPlain();
1660
- delete plain.id;
1661
- return plain;
1662
- }
1663
- static get identifiersFields() {
1664
- return ['id', 'userId'];
1665
- }
1666
- }
1667
-
1668
- class User extends BaseModel {
1669
- static toInstance(data) {
1670
- const instance = super.toInstance(data);
1671
- if (!isNil(data.firstName))
1672
- instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
1673
- return instance;
1674
- }
1675
- toPlain() {
1676
- const plain = super.toPlain();
1677
- delete plain.beautyProfile;
1678
- return plain;
1679
- }
1680
- static get identifiersFields() {
1681
- return ['id'];
1682
- }
1683
- }
1684
- __decorate([
1685
- Type(() => BeautyProfile),
1686
- __metadata("design:type", BeautyProfile)
1687
- ], User.prototype, "beautyProfile", void 0);
1688
-
1689
- class Address extends BaseModel {
1690
- static get identifiersFields() {
1691
- return ['id'];
1692
- }
1693
- }
1694
-
1695
- class UserAddress extends Address {
1696
- static get identifiersFields() {
1697
- return ['id', 'userId'];
1698
- }
1699
- }
1700
-
1701
- class Subscription extends BaseModel {
1702
- static get identifiersFields() {
1703
- return ['id'];
1704
- }
1705
- }
1706
- __decorate([
1707
- Type(() => User),
1708
- __metadata("design:type", User)
1709
- ], Subscription.prototype, "user", void 0);
1710
- __decorate([
1711
- Type(() => SubscriptionPlan),
1712
- __metadata("design:type", SubscriptionPlan)
1713
- ], Subscription.prototype, "subscriptionPlan", void 0);
1714
- __decorate([
1715
- Type(() => UserAddress),
1716
- __metadata("design:type", UserAddress)
1717
- ], Subscription.prototype, "shippingAddress", void 0);
1718
- __decorate([
1719
- Type(() => UserAddress),
1720
- __metadata("design:type", UserAddress)
1721
- ], Subscription.prototype, "billingAddress", void 0);
1722
- __decorate([
1723
- Type(() => Coupon),
1724
- __metadata("design:type", Coupon)
1725
- ], Subscription.prototype, "coupon", void 0);
1726
- __decorate([
1727
- Type(() => Edition),
1728
- __metadata("design:type", Array)
1729
- ], Subscription.prototype, "editions", void 0);
1730
- __decorate([
1731
- Type(() => SubscriptionPayment),
1732
- __metadata("design:type", Array)
1733
- ], Subscription.prototype, "payment", void 0);
1734
-
1735
- class UserPaymentMethod extends BaseModel {
1736
- static get identifiersFields() {
1737
- return ['id', 'userId'];
1738
- }
1739
- }
1740
-
1741
- class Lead extends BaseModel {
1742
- static get identifiersFields() {
1743
- return ['id'];
1744
- }
1745
- }
1746
-
1747
- class UnauthorizedError extends CustomError {
1748
- constructor(message) {
1749
- super(message);
1750
- }
1751
- }
1752
-
1753
- var SignInMethods;
1754
- (function (SignInMethods) {
1755
- SignInMethods["EMAIL_PASSWORD"] = "email_password";
1756
- SignInMethods["GOOGLE"] = "google";
1757
- })(SignInMethods || (SignInMethods = {}));
1758
- class Authentication {
1759
- constructor(authService, userRepository) {
1760
- this.authService = authService;
1761
- this.userRepository = userRepository;
1762
- }
1763
- async signIn({ email, password }, signInMethod) {
1764
- const method = this.getServiceByMethod(signInMethod);
1765
- const userAuth = await this.authService[method]({ email, password });
1766
- const user = this.userRepository.get({ id: userAuth.id });
1767
- if (!isNil(user))
1768
- return user;
1769
- if (/^.+@b4a.com.br$/.test(userAuth.email))
1770
- return this.createsUserByCredential(userAuth);
1771
- throw new UnauthorizedError('Invalid credentials');
1772
- }
1773
- getServiceByMethod(signInMethod) {
1774
- return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
1775
- }
1776
- async createsUserByCredential(user) {
1777
- var _a;
1778
- const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
1779
- const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
1780
- lastName, acceptsNewsletter: false, area: Area.Transactional, officePosition: OfficePosition.Intern, type: UserType.Collaborator }));
1781
- return this.userRepository.create(person);
1782
- }
1783
- }
1784
-
1785
- class UserAlreadyRegisteredError extends CustomError {
1786
- constructor(message) {
1787
- super(message);
1788
- }
1789
- }
1790
-
1791
- class WeakPasswordError extends CustomError {
1792
- constructor(message = 'Weak password') {
1793
- super(message);
1794
- }
1795
- }
1796
-
1797
- class Register {
1798
- constructor(registerService, userRepository) {
1799
- this.registerService = registerService;
1800
- this.userRepository = userRepository;
1801
- }
1802
- async register(params) {
1803
- const email = params.email.toLocaleLowerCase();
1804
- const displayName = `${params.firstName} ${params.lastName}`;
1805
- if (await this.userRepository.checkIfExistsByField('cpf', params.cpf))
1806
- throw new UserAlreadyRegisteredError(`Usuário com CPF ${params.cpf} já registrado.`);
1807
- if (await this.userRepository.checkIfExistsByField('email', params.email))
1808
- throw new UserAlreadyRegisteredError(`Usuário com e-mail ${params.email} já registrado.`);
1809
- const auth = await this.registerService.register({
1810
- birthday: params.birthday,
1811
- email,
1812
- firstName: params.firstName,
1813
- lastName: params.lastName,
1814
- cpf: params.cpf,
1815
- displayName,
1816
- phone: params.phone,
1817
- password: params.password,
1818
- });
1819
- delete params.password;
1820
- const user = await this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email,
1821
- displayName, type: UserType.B2C, dateCreated: new Date(), dateModified: new Date() }));
1822
- return user;
1781
+ const plain = super.toPlain();
1782
+ delete plain.id;
1783
+ return plain;
1784
+ }
1785
+ static get identifiersFields() {
1786
+ return ['id', 'userId'];
1823
1787
  }
1824
1788
  }
1825
1789
 
1826
- class SignOut {
1827
- constructor(authService) {
1828
- this.authService = authService;
1790
+ class User extends BaseModel {
1791
+ static toInstance(data) {
1792
+ const instance = super.toInstance(data);
1793
+ if (!isNil(data.firstName))
1794
+ instance.displayName = `${data.firstName}${!isNil(data.lastName) ? ` ${data.lastName}` : ''}`;
1795
+ return instance;
1829
1796
  }
1830
- async signOut() {
1831
- await this.authService.signOut();
1797
+ toPlain() {
1798
+ const plain = super.toPlain();
1799
+ delete plain.beautyProfile;
1800
+ return plain;
1832
1801
  }
1833
- }
1802
+ static get identifiersFields() {
1803
+ return ['id'];
1804
+ }
1805
+ }
1806
+ __decorate([
1807
+ Type(() => BeautyProfile),
1808
+ __metadata("design:type", BeautyProfile)
1809
+ ], User.prototype, "beautyProfile", void 0);
1834
1810
 
1835
- class RecoveryPassword {
1836
- constructor(authService) {
1837
- this.authService = authService;
1811
+ class Address extends BaseModel {
1812
+ static get identifiersFields() {
1813
+ return ['id'];
1838
1814
  }
1839
- async sendEmail(email) {
1840
- await this.authService.sendPasswordResetEmail(email);
1815
+ }
1816
+
1817
+ class UserAddress extends Address {
1818
+ static get identifiersFields() {
1819
+ return ['id', 'userId'];
1841
1820
  }
1842
1821
  }
1843
1822
 
1823
+ class Subscription extends BaseModel {
1824
+ static get identifiersFields() {
1825
+ return ['id'];
1826
+ }
1827
+ }
1828
+ __decorate([
1829
+ Type(() => User),
1830
+ __metadata("design:type", User)
1831
+ ], Subscription.prototype, "user", void 0);
1832
+ __decorate([
1833
+ Type(() => SubscriptionPlan),
1834
+ __metadata("design:type", SubscriptionPlan)
1835
+ ], Subscription.prototype, "subscriptionPlan", void 0);
1836
+ __decorate([
1837
+ Type(() => UserAddress),
1838
+ __metadata("design:type", UserAddress)
1839
+ ], Subscription.prototype, "shippingAddress", void 0);
1840
+ __decorate([
1841
+ Type(() => UserAddress),
1842
+ __metadata("design:type", UserAddress)
1843
+ ], Subscription.prototype, "billingAddress", void 0);
1844
+ __decorate([
1845
+ Type(() => Coupon),
1846
+ __metadata("design:type", Coupon)
1847
+ ], Subscription.prototype, "coupon", void 0);
1848
+ __decorate([
1849
+ Type(() => Edition),
1850
+ __metadata("design:type", Array)
1851
+ ], Subscription.prototype, "editions", void 0);
1852
+ __decorate([
1853
+ Type(() => SubscriptionPayment),
1854
+ __metadata("design:type", Array)
1855
+ ], Subscription.prototype, "payment", void 0);
1856
+
1844
1857
  class Filter extends BaseModel {
1845
1858
  static get identifiersFields() {
1846
1859
  return ['id'];
@@ -1994,6 +2007,12 @@ __decorate([
1994
2007
  __metadata("design:type", Array)
1995
2008
  ], Product.prototype, "kitProducts", void 0);
1996
2009
 
2010
+ class ProductReviews extends BaseModel {
2011
+ static get identifiersFields() {
2012
+ return ['id'];
2013
+ }
2014
+ }
2015
+
1997
2016
  class Variant extends BaseModel {
1998
2017
  static get identifiersFields() {
1999
2018
  return ['id', 'productId'];
@@ -2108,6 +2127,155 @@ __decorate([
2108
2127
  __metadata("design:type", Coupon)
2109
2128
  ], CheckoutSubscription.prototype, "coupon", void 0);
2110
2129
 
2130
+ class SubscriptionMaterialization extends BaseModel {
2131
+ static get identifiersFields() {
2132
+ return ['id'];
2133
+ }
2134
+ }
2135
+ __decorate([
2136
+ Type(() => User),
2137
+ __metadata("design:type", User)
2138
+ ], SubscriptionMaterialization.prototype, "user", void 0);
2139
+ __decorate([
2140
+ Type(() => SubscriptionPlan),
2141
+ __metadata("design:type", SubscriptionPlan)
2142
+ ], SubscriptionMaterialization.prototype, "subscriptionPlan", void 0);
2143
+ __decorate([
2144
+ Type(() => UserAddress),
2145
+ __metadata("design:type", UserAddress)
2146
+ ], SubscriptionMaterialization.prototype, "shippingAddress", void 0);
2147
+ __decorate([
2148
+ Type(() => UserAddress),
2149
+ __metadata("design:type", UserAddress)
2150
+ ], SubscriptionMaterialization.prototype, "billingAddress", void 0);
2151
+ __decorate([
2152
+ Type(() => Coupon),
2153
+ __metadata("design:type", Coupon)
2154
+ ], SubscriptionMaterialization.prototype, "coupon", void 0);
2155
+ __decorate([
2156
+ Type(() => Edition),
2157
+ __metadata("design:type", Array)
2158
+ ], SubscriptionMaterialization.prototype, "editions", void 0);
2159
+ __decorate([
2160
+ Type(() => SubscriptionPayment),
2161
+ __metadata("design:type", SubscriptionPayment)
2162
+ ], SubscriptionMaterialization.prototype, "payment", void 0);
2163
+
2164
+ class SubscriptionSummary extends BaseModel {
2165
+ static get identifiersFields() {
2166
+ return ['id'];
2167
+ }
2168
+ }
2169
+
2170
+ class UserPaymentMethod extends BaseModel {
2171
+ static get identifiersFields() {
2172
+ return ['id', 'userId'];
2173
+ }
2174
+ }
2175
+
2176
+ class Lead extends BaseModel {
2177
+ static get identifiersFields() {
2178
+ return ['id'];
2179
+ }
2180
+ }
2181
+
2182
+ class UnauthorizedError extends CustomError {
2183
+ constructor(message) {
2184
+ super(message);
2185
+ }
2186
+ }
2187
+
2188
+ var SignInMethods;
2189
+ (function (SignInMethods) {
2190
+ SignInMethods["EMAIL_PASSWORD"] = "email_password";
2191
+ SignInMethods["GOOGLE"] = "google";
2192
+ })(SignInMethods || (SignInMethods = {}));
2193
+ class Authentication {
2194
+ constructor(authService, userRepository) {
2195
+ this.authService = authService;
2196
+ this.userRepository = userRepository;
2197
+ }
2198
+ async signIn({ email, password }, signInMethod) {
2199
+ const method = this.getServiceByMethod(signInMethod);
2200
+ const userAuth = await this.authService[method]({ email, password });
2201
+ const user = this.userRepository.get({ id: userAuth.id });
2202
+ if (!isNil(user))
2203
+ return user;
2204
+ if (/^.+@b4a.com.br$/.test(userAuth.email))
2205
+ return this.createsUserByCredential(userAuth);
2206
+ throw new UnauthorizedError('Invalid credentials');
2207
+ }
2208
+ getServiceByMethod(signInMethod) {
2209
+ return signInMethod === SignInMethods.EMAIL_PASSWORD ? 'signInWithEmailAndPassword' : 'signInWithGoogle';
2210
+ }
2211
+ async createsUserByCredential(user) {
2212
+ var _a;
2213
+ const [firstName, lastName] = (_a = user.displayName) === null || _a === void 0 ? void 0 : _a.split(/\s/);
2214
+ const person = User.toInstance(Object.assign(Object.assign({}, user), { cpf: '', birthday: new Date(), firstName,
2215
+ lastName, acceptsNewsletter: false, area: Area.Transactional, officePosition: OfficePosition.Intern, type: UserType.Collaborator }));
2216
+ return this.userRepository.create(person);
2217
+ }
2218
+ }
2219
+
2220
+ class UserAlreadyRegisteredError extends CustomError {
2221
+ constructor(message) {
2222
+ super(message);
2223
+ }
2224
+ }
2225
+
2226
+ class WeakPasswordError extends CustomError {
2227
+ constructor(message = 'Weak password') {
2228
+ super(message);
2229
+ }
2230
+ }
2231
+
2232
+ class Register {
2233
+ constructor(registerService, userRepository) {
2234
+ this.registerService = registerService;
2235
+ this.userRepository = userRepository;
2236
+ }
2237
+ async register(params) {
2238
+ const email = params.email.toLocaleLowerCase();
2239
+ const displayName = `${params.firstName} ${params.lastName}`;
2240
+ if (await this.userRepository.checkIfExistsByField('cpf', params.cpf))
2241
+ throw new UserAlreadyRegisteredError(`Usuário com CPF ${params.cpf} já registrado.`);
2242
+ if (await this.userRepository.checkIfExistsByField('email', params.email))
2243
+ throw new UserAlreadyRegisteredError(`Usuário com e-mail ${params.email} já registrado.`);
2244
+ const auth = await this.registerService.register({
2245
+ birthday: params.birthday,
2246
+ email,
2247
+ firstName: params.firstName,
2248
+ lastName: params.lastName,
2249
+ cpf: params.cpf,
2250
+ displayName,
2251
+ phone: params.phone,
2252
+ password: params.password,
2253
+ });
2254
+ delete params.password;
2255
+ const user = await this.userRepository.create(Object.assign(Object.assign({}, params), { id: auth.id, email,
2256
+ displayName, type: UserType.B2C, dateCreated: new Date(), dateModified: new Date() }));
2257
+ return user;
2258
+ }
2259
+ }
2260
+
2261
+ class SignOut {
2262
+ constructor(authService) {
2263
+ this.authService = authService;
2264
+ }
2265
+ async signOut() {
2266
+ await this.authService.signOut();
2267
+ }
2268
+ }
2269
+
2270
+ class RecoveryPassword {
2271
+ constructor(authService) {
2272
+ this.authService = authService;
2273
+ }
2274
+ async sendEmail(email) {
2275
+ await this.authService.sendPasswordResetEmail(email);
2276
+ }
2277
+ }
2278
+
2111
2279
  class RoundProductPricesHelper {
2112
2280
  static roundProductPrices(product) {
2113
2281
  product.price.price = Number(product.price.price.toFixed(2));
@@ -2468,7 +2636,7 @@ const withFirestore = (MixinBase) => {
2468
2636
  if (iteratee(v, k)) {
2469
2637
  unset(value, k);
2470
2638
  }
2471
- else if (isObject(v)) {
2639
+ else if (isObject$1(v)) {
2472
2640
  omitByRecursivelyInPlace(v, iteratee);
2473
2641
  }
2474
2642
  });
@@ -2598,7 +2766,7 @@ const withFindFirestore = (MixinBase) => {
2598
2766
  (this.fields[firestoreFieldName] === FirestoreFieldType.Array ||
2599
2767
  !this.fields[firestoreFieldName]))
2600
2768
  return [where(firestoreFieldName, 'array-contains', options.value)];
2601
- if (isObject(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value)) {
2769
+ if (isObject$1(options) && isNil(options === null || options === void 0 ? void 0 : options.operator) && isNil(options === null || options === void 0 ? void 0 : options.value)) {
2602
2770
  return Object.keys(options).reduce((queries, key) => [
2603
2771
  ...queries,
2604
2772
  ...this.buildWhereSentence(`${fieldName.toString()}.${key}`, is(options)[key]),
@@ -2816,6 +2984,17 @@ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(with
2816
2984
  }
2817
2985
  }
2818
2986
 
2987
+ class SubscriptionMaterializationFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
2988
+ constructor({ firestore, interceptors }) {
2989
+ super({
2990
+ firestore,
2991
+ collectionName: 'subscriptionMaterialization',
2992
+ model: SubscriptionMaterialization,
2993
+ interceptors,
2994
+ });
2995
+ }
2996
+ }
2997
+
2819
2998
  class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2820
2999
  constructor({ firestore, interceptors }, parentRepository) {
2821
3000
  super({
@@ -2829,6 +3008,17 @@ class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudF
2829
3008
  }
2830
3009
  }
2831
3010
 
3011
+ class SubscriptionSummaryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
3012
+ constructor({ firestore, interceptors, }) {
3013
+ super({
3014
+ firestore,
3015
+ collectionName: 'subscriptionSummary',
3016
+ model: SubscriptionSummary,
3017
+ interceptors,
3018
+ });
3019
+ }
3020
+ }
3021
+
2832
3022
  class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
2833
3023
  constructor({ firestore, interceptors }, parentRepository) {
2834
3024
  super({
@@ -3364,7 +3554,7 @@ AttributeOptionHelper.FindByAttribute = (attributeName, fields) => {
3364
3554
  var _a;
3365
3555
  if (fields.includes(attributeName))
3366
3556
  return { columnName: attributeName.toString(), attributeName, to: (value) => value, from: (value) => value };
3367
- const field = fields.find((columnOption) => isObject(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
3557
+ const field = fields.find((columnOption) => isObject$1(columnOption) && Object.keys(columnOption).includes(attributeName.toString()));
3368
3558
  const fieldOption = (_a = is(field)) === null || _a === void 0 ? void 0 : _a[attributeName];
3369
3559
  if (isNil(fieldOption))
3370
3560
  return { columnName: attributeName.toString(), attributeName };
@@ -3377,7 +3567,7 @@ AttributeOptionHelper.FindColumnOptionFromList = (columnName, fields) => {
3377
3567
  if (fields.includes(columnName))
3378
3568
  return { columnName, attributeName: columnName };
3379
3569
  const field = is(fields.find((field) => {
3380
- if (!isObject(field))
3570
+ if (!isObject$1(field))
3381
3571
  return false;
3382
3572
  const columnOption = Object.values(field).find((option) => AttributeOptionHelper.CheckIsColumnOption(option) && option.columnName === columnName ? option : {});
3383
3573
  return AttributeOptionHelper.CheckIsColumnOption(columnOption) && (columnOption === null || columnOption === void 0 ? void 0 : columnOption.columnName) === columnName;
@@ -3453,7 +3643,7 @@ BindFilterQueryHelper.MakeGraphQLWhere = (filter, fields) => Object.keys(filter)
3453
3643
  BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
3454
3644
  const fieldSentenceOptions = AttributeOptionHelper.FindByAttribute(field, fields);
3455
3645
  const isNestedField = !Array.isArray(options) &&
3456
- isObject(options) &&
3646
+ isObject$1(options) &&
3457
3647
  isNil(options === null || options === void 0 ? void 0 : options.operator) &&
3458
3648
  isNil(options === null || options === void 0 ? void 0 : options.value) &&
3459
3649
  isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to);
@@ -3468,7 +3658,7 @@ BindFilterQueryHelper.BuildWhereSentence = (field, options, fields) => {
3468
3658
  return {
3469
3659
  [fieldSentenceOptions.fields[0]]: BindFilterQueryHelper.BuildOperatorSentence(options, fieldSentenceOptions),
3470
3660
  };
3471
- if (!Array.isArray(options) && isObject(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
3661
+ if (!Array.isArray(options) && isObject$1(options) && !FilterOptionHelper.CheckIfIsFilterOption(options))
3472
3662
  options = Object.values(options)[0];
3473
3663
  return Array.isArray(options)
3474
3664
  ? options.reduce((whereSentence, option) => (Object.assign(Object.assign({}, whereSentence), BindFilterQueryHelper.BuildOperatorSentence(option, fieldSentenceOptions))), {})
@@ -3518,7 +3708,7 @@ GraphQLFieldHelper.ConvertFieldValueFrom = (data, fields) => Object.keys(data).r
3518
3708
  return Object.assign(Object.assign({}, result), { [attributeName]: from
3519
3709
  ? from(data[columnName], data)
3520
3710
  : is(data[columnName]).map((value) => GraphQLFieldHelper.ConvertFieldValueFrom(is(value), attributeFields)) });
3521
- if (isObject(data[columnName]))
3711
+ if (isObject$1(data[columnName]))
3522
3712
  return Object.assign(Object.assign({}, result), { [attributeName]: !!from
3523
3713
  ? from(data[columnName])
3524
3714
  : GraphQLFieldHelper.ConvertFieldValueFrom(is(data[columnName]), attributeFields) });
@@ -3545,13 +3735,13 @@ GraphQLFieldHelper.ConvertFieldValueTo = (instance, fields, update = false) => {
3545
3735
  return Object.assign(Object.assign({}, object), { [foreignColumnName]: (_a = data[attributeName]) === null || _a === void 0 ? void 0 : _a[current] });
3546
3736
  }, Object.assign({}, result));
3547
3737
  if (update &&
3548
- isObject(data[attributeName]) &&
3738
+ isObject$1(data[attributeName]) &&
3549
3739
  !isNil(attributeFields) &&
3550
3740
  !isDate(data[attributeName]))
3551
3741
  return result;
3552
3742
  if (!!columnName &&
3553
3743
  Array.isArray(attributeFields) &&
3554
- isObject(data[attributeName])) {
3744
+ isObject$1(data[attributeName])) {
3555
3745
  const converted = !isNil(columnName) && to
3556
3746
  ? to(instance[attributeName], instance)
3557
3747
  : data[attributeName];
@@ -4646,9 +4836,10 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4646
4836
  howToUse: data.how_to_use,
4647
4837
  brand: data.brand_description,
4648
4838
  ingredients: data.ingredients,
4839
+ purpose: data.purpose,
4649
4840
  }),
4650
4841
  bindFindFilter: (filters) => {
4651
- 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 && {
4842
+ 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 && {
4652
4843
  who_must_use: filters.whoMustUse,
4653
4844
  })), (filters.howToUse && {
4654
4845
  how_to_use: filters.howToUse,
@@ -4656,11 +4847,13 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4656
4847
  brand_description: filters.brand,
4657
4848
  })), (filters.ingredients && {
4658
4849
  ingredients: filters.ingredients,
4850
+ })), (filters.purpose && {
4851
+ purpose: filters.purpose,
4659
4852
  }));
4660
4853
  },
4661
- 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 && {
4854
+ 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 && {
4662
4855
  who_must_use: descriptionData.whoMustUse,
4663
- })), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand })), (descriptionData.ingredients && { ingredients: descriptionData.ingredients }))),
4856
+ })), (descriptionData.howToUse && { how_to_use: descriptionData.howToUse })), (descriptionData.brand && { brand_description: descriptionData.brand })), (descriptionData.ingredients && { ingredients: descriptionData.ingredients })), (descriptionData.purpose && { purpose: descriptionData.purpose }))),
4664
4857
  },
4665
4858
  },
4666
4859
  { differentials: { columnName: 'differentials' } },
@@ -4668,6 +4861,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
4668
4861
  { howToUse: { columnName: 'how_to_use' } },
4669
4862
  { brandDescription: { columnName: 'brand_description' } },
4670
4863
  { ingredients: { columnName: 'ingredients' } },
4864
+ { purpose: { columnName: 'purpose' } },
4671
4865
  { hasVariants: { columnName: 'has_variants' } },
4672
4866
  {
4673
4867
  images: {
@@ -5051,6 +5245,41 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
5051
5245
  }
5052
5246
  }
5053
5247
 
5248
+ class ProductReviewsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5249
+ constructor({ endpoint, authOptions, interceptors, }) {
5250
+ super({
5251
+ tableName: 'product_review',
5252
+ model: ProductReviews,
5253
+ endpoint,
5254
+ authOptions,
5255
+ interceptors,
5256
+ fields: [
5257
+ 'id',
5258
+ { productId: { columnName: 'product_id' } },
5259
+ 'shop',
5260
+ 'rate',
5261
+ 'author',
5262
+ 'email',
5263
+ 'location',
5264
+ 'review',
5265
+ 'status',
5266
+ 'title',
5267
+ { personId: { columnName: 'person_id' } },
5268
+ 'points',
5269
+ { orderId: { columnName: 'order_id' } },
5270
+ { createdAt: { columnName: 'created_at' } },
5271
+ { updatedAt: { columnName: 'updated_at' } },
5272
+ ],
5273
+ });
5274
+ }
5275
+ aproveReview(id) {
5276
+ return this.update({ id, status: true });
5277
+ }
5278
+ disaproveReview(id) {
5279
+ return this.update({ id, status: false });
5280
+ }
5281
+ }
5282
+
5054
5283
  class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
5055
5284
  constructor({ endpoint, authOptions, interceptors, }) {
5056
5285
  super({
@@ -5375,4 +5604,4 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
5375
5604
  }
5376
5605
  }
5377
5606
 
5378
- export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
5607
+ export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };