@infrab4a/connect-angular 0.12.4 → 0.12.5

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 (47) hide show
  1. package/bundles/infrab4a-connect-angular.umd.js +1250 -1243
  2. package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
  3. package/esm2015/infrab4a-connect-angular.js +4 -4
  4. package/esm2015/lib/angular-connect.module.js +29 -29
  5. package/esm2015/lib/angular-firebase-auth.module.js +113 -113
  6. package/esm2015/lib/angular-firestore.module.js +336 -336
  7. package/esm2015/lib/consts/default-shop.const.js +1 -1
  8. package/esm2015/lib/consts/index.js +1 -1
  9. package/esm2015/lib/index.js +4 -4
  10. package/esm2015/lib/services/auth.service.js +41 -41
  11. package/esm2015/lib/services/cart.service.js +165 -165
  12. package/esm2015/lib/services/checkout-subscription.service.js +66 -95
  13. package/esm2015/lib/services/checkout.service.js +79 -79
  14. package/esm2015/lib/services/coupon.service.js +70 -51
  15. package/esm2015/lib/services/errors/group-invalid-coupon.error.js +7 -0
  16. package/esm2015/lib/services/errors/index.js +3 -2
  17. package/esm2015/lib/services/errors/invalid-coupon.error.js +6 -6
  18. package/esm2015/lib/services/index.js +6 -6
  19. package/esm2015/lib/services/order.service.js +31 -31
  20. package/esm2015/lib/services/types/index.js +2 -2
  21. package/esm2015/lib/services/types/required-checkout-data.type.js +1 -1
  22. package/esm2015/lib/services/types/required-checkout-subscription-data.type.js +1 -1
  23. package/esm2015/public-api.js +1 -1
  24. package/fesm2015/infrab4a-connect-angular.js +864 -867
  25. package/fesm2015/infrab4a-connect-angular.js.map +1 -1
  26. package/infrab4a-connect-angular.d.ts +5 -5
  27. package/lib/angular-connect.module.d.ts +12 -12
  28. package/lib/angular-firebase-auth.module.d.ts +10 -10
  29. package/lib/angular-firestore.module.d.ts +10 -10
  30. package/lib/consts/default-shop.const.d.ts +1 -1
  31. package/lib/consts/index.d.ts +1 -1
  32. package/lib/index.d.ts +4 -4
  33. package/lib/services/auth.service.d.ts +19 -19
  34. package/lib/services/cart.service.d.ts +41 -41
  35. package/lib/services/checkout-subscription.service.d.ts +17 -19
  36. package/lib/services/checkout.service.d.ts +22 -22
  37. package/lib/services/coupon.service.d.ts +14 -13
  38. package/lib/services/errors/group-invalid-coupon.error.d.ts +5 -0
  39. package/lib/services/errors/index.d.ts +2 -1
  40. package/lib/services/errors/invalid-coupon.error.d.ts +4 -4
  41. package/lib/services/index.d.ts +6 -6
  42. package/lib/services/order.service.d.ts +13 -13
  43. package/lib/services/types/index.d.ts +2 -2
  44. package/lib/services/types/required-checkout-data.type.d.ts +2 -2
  45. package/lib/services/types/required-checkout-subscription-data.type.d.ts +2 -2
  46. package/package.json +2 -2
  47. package/public-api.d.ts +1 -1
@@ -2,7 +2,7 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/fire/auth'), require('@infrab4a/connect'), require('js-cookie'), require('@angular/fire/firestore'), require('@angular/fire')) :
3
3
  typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/fire/auth', '@infrab4a/connect', 'js-cookie', '@angular/fire/firestore', '@angular/fire'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a["connect-angular"] = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.ng.fire.auth, global["@infrab4a/connect"], global["js-cookie"], global.ng.fire.firestore, global.ng.fire));
5
- })(this, (function (exports, i0, rxjs, operators, i1, i1$1, cookie, i1$2, fire) { 'use strict';
5
+ })(this, (function (exports, i0, rxjs, operators, i1, i2, cookie, i1$1, fire) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -26,1274 +26,1281 @@
26
26
 
27
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
28
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
29
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
30
30
  var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
31
- var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
31
+ var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
32
+
33
+ /*! *****************************************************************************
34
+ Copyright (c) Microsoft Corporation.
35
+
36
+ Permission to use, copy, modify, and/or distribute this software for any
37
+ purpose with or without fee is hereby granted.
32
38
 
33
- /*! *****************************************************************************
34
- Copyright (c) Microsoft Corporation.
35
-
36
- Permission to use, copy, modify, and/or distribute this software for any
37
- purpose with or without fee is hereby granted.
38
-
39
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
40
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
41
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
42
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
43
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
44
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45
- PERFORMANCE OF THIS SOFTWARE.
46
- ***************************************************************************** */
47
- /* global Reflect, Promise */
48
- var extendStatics = function (d, b) {
49
- extendStatics = Object.setPrototypeOf ||
50
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
51
- function (d, b) { for (var p in b)
52
- if (Object.prototype.hasOwnProperty.call(b, p))
53
- d[p] = b[p]; };
54
- return extendStatics(d, b);
55
- };
56
- function __extends(d, b) {
57
- if (typeof b !== "function" && b !== null)
58
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
59
- extendStatics(d, b);
60
- function __() { this.constructor = d; }
61
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
62
- }
63
- var __assign = function () {
64
- __assign = Object.assign || function __assign(t) {
65
- for (var s, i = 1, n = arguments.length; i < n; i++) {
66
- s = arguments[i];
67
- for (var p in s)
68
- if (Object.prototype.hasOwnProperty.call(s, p))
69
- t[p] = s[p];
70
- }
71
- return t;
72
- };
73
- return __assign.apply(this, arguments);
74
- };
75
- function __rest(s, e) {
76
- var t = {};
77
- for (var p in s)
78
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
79
- t[p] = s[p];
80
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
81
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
82
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
83
- t[p[i]] = s[p[i]];
84
- }
85
- return t;
86
- }
87
- function __decorate(decorators, target, key, desc) {
88
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
89
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
90
- r = Reflect.decorate(decorators, target, key, desc);
91
- else
92
- for (var i = decorators.length - 1; i >= 0; i--)
93
- if (d = decorators[i])
94
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
95
- return c > 3 && r && Object.defineProperty(target, key, r), r;
96
- }
97
- function __param(paramIndex, decorator) {
98
- return function (target, key) { decorator(target, key, paramIndex); };
99
- }
100
- function __metadata(metadataKey, metadataValue) {
101
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
102
- return Reflect.metadata(metadataKey, metadataValue);
103
- }
104
- function __awaiter(thisArg, _arguments, P, generator) {
105
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
106
- return new (P || (P = Promise))(function (resolve, reject) {
107
- function fulfilled(value) { try {
108
- step(generator.next(value));
109
- }
110
- catch (e) {
111
- reject(e);
112
- } }
113
- function rejected(value) { try {
114
- step(generator["throw"](value));
115
- }
116
- catch (e) {
117
- reject(e);
118
- } }
119
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
120
- step((generator = generator.apply(thisArg, _arguments || [])).next());
121
- });
122
- }
123
- function __generator(thisArg, body) {
124
- var _ = { label: 0, sent: function () { if (t[0] & 1)
125
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
126
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
127
- function verb(n) { return function (v) { return step([n, v]); }; }
128
- function step(op) {
129
- if (f)
130
- throw new TypeError("Generator is already executing.");
131
- while (_)
132
- try {
133
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
134
- return t;
135
- if (y = 0, t)
136
- op = [op[0] & 2, t.value];
137
- switch (op[0]) {
138
- case 0:
139
- case 1:
140
- t = op;
141
- break;
142
- case 4:
143
- _.label++;
144
- return { value: op[1], done: false };
145
- case 5:
146
- _.label++;
147
- y = op[1];
148
- op = [0];
149
- continue;
150
- case 7:
151
- op = _.ops.pop();
152
- _.trys.pop();
153
- continue;
154
- default:
155
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
156
- _ = 0;
157
- continue;
158
- }
159
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
160
- _.label = op[1];
161
- break;
162
- }
163
- if (op[0] === 6 && _.label < t[1]) {
164
- _.label = t[1];
165
- t = op;
166
- break;
167
- }
168
- if (t && _.label < t[2]) {
169
- _.label = t[2];
170
- _.ops.push(op);
171
- break;
172
- }
173
- if (t[2])
174
- _.ops.pop();
175
- _.trys.pop();
176
- continue;
177
- }
178
- op = body.call(thisArg, _);
179
- }
180
- catch (e) {
181
- op = [6, e];
182
- y = 0;
183
- }
184
- finally {
185
- f = t = 0;
186
- }
187
- if (op[0] & 5)
188
- throw op[1];
189
- return { value: op[0] ? op[1] : void 0, done: true };
190
- }
191
- }
192
- var __createBinding = Object.create ? (function (o, m, k, k2) {
193
- if (k2 === undefined)
194
- k2 = k;
195
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
196
- }) : (function (o, m, k, k2) {
197
- if (k2 === undefined)
198
- k2 = k;
199
- o[k2] = m[k];
200
- });
201
- function __exportStar(m, o) {
202
- for (var p in m)
203
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
204
- __createBinding(o, m, p);
205
- }
206
- function __values(o) {
207
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
208
- if (m)
209
- return m.call(o);
210
- if (o && typeof o.length === "number")
211
- return {
212
- next: function () {
213
- if (o && i >= o.length)
214
- o = void 0;
215
- return { value: o && o[i++], done: !o };
216
- }
217
- };
218
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
219
- }
220
- function __read(o, n) {
221
- var m = typeof Symbol === "function" && o[Symbol.iterator];
222
- if (!m)
223
- return o;
224
- var i = m.call(o), r, ar = [], e;
225
- try {
226
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
227
- ar.push(r.value);
228
- }
229
- catch (error) {
230
- e = { error: error };
231
- }
232
- finally {
233
- try {
234
- if (r && !r.done && (m = i["return"]))
235
- m.call(i);
236
- }
237
- finally {
238
- if (e)
239
- throw e.error;
240
- }
241
- }
242
- return ar;
243
- }
244
- /** @deprecated */
245
- function __spread() {
246
- for (var ar = [], i = 0; i < arguments.length; i++)
247
- ar = ar.concat(__read(arguments[i]));
248
- return ar;
249
- }
250
- /** @deprecated */
251
- function __spreadArrays() {
252
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
253
- s += arguments[i].length;
254
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
255
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
256
- r[k] = a[j];
257
- return r;
258
- }
259
- function __spreadArray(to, from, pack) {
260
- if (pack || arguments.length === 2)
261
- for (var i = 0, l = from.length, ar; i < l; i++) {
262
- if (ar || !(i in from)) {
263
- if (!ar)
264
- ar = Array.prototype.slice.call(from, 0, i);
265
- ar[i] = from[i];
266
- }
267
- }
268
- return to.concat(ar || Array.prototype.slice.call(from));
269
- }
270
- function __await(v) {
271
- return this instanceof __await ? (this.v = v, this) : new __await(v);
272
- }
273
- function __asyncGenerator(thisArg, _arguments, generator) {
274
- if (!Symbol.asyncIterator)
275
- throw new TypeError("Symbol.asyncIterator is not defined.");
276
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
277
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
278
- function verb(n) { if (g[n])
279
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
280
- function resume(n, v) { try {
281
- step(g[n](v));
282
- }
283
- catch (e) {
284
- settle(q[0][3], e);
285
- } }
286
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
287
- function fulfill(value) { resume("next", value); }
288
- function reject(value) { resume("throw", value); }
289
- function settle(f, v) { if (f(v), q.shift(), q.length)
290
- resume(q[0][0], q[0][1]); }
291
- }
292
- function __asyncDelegator(o) {
293
- var i, p;
294
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
295
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
296
- }
297
- function __asyncValues(o) {
298
- if (!Symbol.asyncIterator)
299
- throw new TypeError("Symbol.asyncIterator is not defined.");
300
- var m = o[Symbol.asyncIterator], i;
301
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
302
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
303
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
304
- }
305
- function __makeTemplateObject(cooked, raw) {
306
- if (Object.defineProperty) {
307
- Object.defineProperty(cooked, "raw", { value: raw });
308
- }
309
- else {
310
- cooked.raw = raw;
311
- }
312
- return cooked;
313
- }
314
- ;
315
- var __setModuleDefault = Object.create ? (function (o, v) {
316
- Object.defineProperty(o, "default", { enumerable: true, value: v });
317
- }) : function (o, v) {
318
- o["default"] = v;
319
- };
320
- function __importStar(mod) {
321
- if (mod && mod.__esModule)
322
- return mod;
323
- var result = {};
324
- if (mod != null)
325
- for (var k in mod)
326
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
327
- __createBinding(result, mod, k);
328
- __setModuleDefault(result, mod);
329
- return result;
330
- }
331
- function __importDefault(mod) {
332
- return (mod && mod.__esModule) ? mod : { default: mod };
333
- }
334
- function __classPrivateFieldGet(receiver, state, kind, f) {
335
- if (kind === "a" && !f)
336
- throw new TypeError("Private accessor was defined without a getter");
337
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
338
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
339
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
340
- }
341
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
342
- if (kind === "m")
343
- throw new TypeError("Private method is not writable");
344
- if (kind === "a" && !f)
345
- throw new TypeError("Private accessor was defined without a setter");
346
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
347
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
348
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
39
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
40
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
41
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
42
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
43
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
44
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45
+ PERFORMANCE OF THIS SOFTWARE.
46
+ ***************************************************************************** */
47
+ /* global Reflect, Promise */
48
+ var extendStatics = function (d, b) {
49
+ extendStatics = Object.setPrototypeOf ||
50
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
51
+ function (d, b) { for (var p in b)
52
+ if (Object.prototype.hasOwnProperty.call(b, p))
53
+ d[p] = b[p]; };
54
+ return extendStatics(d, b);
55
+ };
56
+ function __extends(d, b) {
57
+ if (typeof b !== "function" && b !== null)
58
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
59
+ extendStatics(d, b);
60
+ function __() { this.constructor = d; }
61
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
62
+ }
63
+ var __assign = function () {
64
+ __assign = Object.assign || function __assign(t) {
65
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
66
+ s = arguments[i];
67
+ for (var p in s)
68
+ if (Object.prototype.hasOwnProperty.call(s, p))
69
+ t[p] = s[p];
70
+ }
71
+ return t;
72
+ };
73
+ return __assign.apply(this, arguments);
74
+ };
75
+ function __rest(s, e) {
76
+ var t = {};
77
+ for (var p in s)
78
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
79
+ t[p] = s[p];
80
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
81
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
82
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
83
+ t[p[i]] = s[p[i]];
84
+ }
85
+ return t;
86
+ }
87
+ function __decorate(decorators, target, key, desc) {
88
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
89
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
90
+ r = Reflect.decorate(decorators, target, key, desc);
91
+ else
92
+ for (var i = decorators.length - 1; i >= 0; i--)
93
+ if (d = decorators[i])
94
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
95
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
96
+ }
97
+ function __param(paramIndex, decorator) {
98
+ return function (target, key) { decorator(target, key, paramIndex); };
99
+ }
100
+ function __metadata(metadataKey, metadataValue) {
101
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
102
+ return Reflect.metadata(metadataKey, metadataValue);
103
+ }
104
+ function __awaiter(thisArg, _arguments, P, generator) {
105
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
106
+ return new (P || (P = Promise))(function (resolve, reject) {
107
+ function fulfilled(value) { try {
108
+ step(generator.next(value));
109
+ }
110
+ catch (e) {
111
+ reject(e);
112
+ } }
113
+ function rejected(value) { try {
114
+ step(generator["throw"](value));
115
+ }
116
+ catch (e) {
117
+ reject(e);
118
+ } }
119
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
120
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
121
+ });
122
+ }
123
+ function __generator(thisArg, body) {
124
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
125
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
126
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
127
+ function verb(n) { return function (v) { return step([n, v]); }; }
128
+ function step(op) {
129
+ if (f)
130
+ throw new TypeError("Generator is already executing.");
131
+ while (_)
132
+ try {
133
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
134
+ return t;
135
+ if (y = 0, t)
136
+ op = [op[0] & 2, t.value];
137
+ switch (op[0]) {
138
+ case 0:
139
+ case 1:
140
+ t = op;
141
+ break;
142
+ case 4:
143
+ _.label++;
144
+ return { value: op[1], done: false };
145
+ case 5:
146
+ _.label++;
147
+ y = op[1];
148
+ op = [0];
149
+ continue;
150
+ case 7:
151
+ op = _.ops.pop();
152
+ _.trys.pop();
153
+ continue;
154
+ default:
155
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
156
+ _ = 0;
157
+ continue;
158
+ }
159
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
160
+ _.label = op[1];
161
+ break;
162
+ }
163
+ if (op[0] === 6 && _.label < t[1]) {
164
+ _.label = t[1];
165
+ t = op;
166
+ break;
167
+ }
168
+ if (t && _.label < t[2]) {
169
+ _.label = t[2];
170
+ _.ops.push(op);
171
+ break;
172
+ }
173
+ if (t[2])
174
+ _.ops.pop();
175
+ _.trys.pop();
176
+ continue;
177
+ }
178
+ op = body.call(thisArg, _);
179
+ }
180
+ catch (e) {
181
+ op = [6, e];
182
+ y = 0;
183
+ }
184
+ finally {
185
+ f = t = 0;
186
+ }
187
+ if (op[0] & 5)
188
+ throw op[1];
189
+ return { value: op[0] ? op[1] : void 0, done: true };
190
+ }
191
+ }
192
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
193
+ if (k2 === undefined)
194
+ k2 = k;
195
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
196
+ }) : (function (o, m, k, k2) {
197
+ if (k2 === undefined)
198
+ k2 = k;
199
+ o[k2] = m[k];
200
+ });
201
+ function __exportStar(m, o) {
202
+ for (var p in m)
203
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
204
+ __createBinding(o, m, p);
205
+ }
206
+ function __values(o) {
207
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
208
+ if (m)
209
+ return m.call(o);
210
+ if (o && typeof o.length === "number")
211
+ return {
212
+ next: function () {
213
+ if (o && i >= o.length)
214
+ o = void 0;
215
+ return { value: o && o[i++], done: !o };
216
+ }
217
+ };
218
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
219
+ }
220
+ function __read(o, n) {
221
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
222
+ if (!m)
223
+ return o;
224
+ var i = m.call(o), r, ar = [], e;
225
+ try {
226
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
227
+ ar.push(r.value);
228
+ }
229
+ catch (error) {
230
+ e = { error: error };
231
+ }
232
+ finally {
233
+ try {
234
+ if (r && !r.done && (m = i["return"]))
235
+ m.call(i);
236
+ }
237
+ finally {
238
+ if (e)
239
+ throw e.error;
240
+ }
241
+ }
242
+ return ar;
243
+ }
244
+ /** @deprecated */
245
+ function __spread() {
246
+ for (var ar = [], i = 0; i < arguments.length; i++)
247
+ ar = ar.concat(__read(arguments[i]));
248
+ return ar;
249
+ }
250
+ /** @deprecated */
251
+ function __spreadArrays() {
252
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
253
+ s += arguments[i].length;
254
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
255
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
256
+ r[k] = a[j];
257
+ return r;
258
+ }
259
+ function __spreadArray(to, from, pack) {
260
+ if (pack || arguments.length === 2)
261
+ for (var i = 0, l = from.length, ar; i < l; i++) {
262
+ if (ar || !(i in from)) {
263
+ if (!ar)
264
+ ar = Array.prototype.slice.call(from, 0, i);
265
+ ar[i] = from[i];
266
+ }
267
+ }
268
+ return to.concat(ar || Array.prototype.slice.call(from));
269
+ }
270
+ function __await(v) {
271
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
272
+ }
273
+ function __asyncGenerator(thisArg, _arguments, generator) {
274
+ if (!Symbol.asyncIterator)
275
+ throw new TypeError("Symbol.asyncIterator is not defined.");
276
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
277
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
278
+ function verb(n) { if (g[n])
279
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
280
+ function resume(n, v) { try {
281
+ step(g[n](v));
282
+ }
283
+ catch (e) {
284
+ settle(q[0][3], e);
285
+ } }
286
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
287
+ function fulfill(value) { resume("next", value); }
288
+ function reject(value) { resume("throw", value); }
289
+ function settle(f, v) { if (f(v), q.shift(), q.length)
290
+ resume(q[0][0], q[0][1]); }
291
+ }
292
+ function __asyncDelegator(o) {
293
+ var i, p;
294
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
295
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
296
+ }
297
+ function __asyncValues(o) {
298
+ if (!Symbol.asyncIterator)
299
+ throw new TypeError("Symbol.asyncIterator is not defined.");
300
+ var m = o[Symbol.asyncIterator], i;
301
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
302
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
303
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
304
+ }
305
+ function __makeTemplateObject(cooked, raw) {
306
+ if (Object.defineProperty) {
307
+ Object.defineProperty(cooked, "raw", { value: raw });
308
+ }
309
+ else {
310
+ cooked.raw = raw;
311
+ }
312
+ return cooked;
313
+ }
314
+ ;
315
+ var __setModuleDefault = Object.create ? (function (o, v) {
316
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
317
+ }) : function (o, v) {
318
+ o["default"] = v;
319
+ };
320
+ function __importStar(mod) {
321
+ if (mod && mod.__esModule)
322
+ return mod;
323
+ var result = {};
324
+ if (mod != null)
325
+ for (var k in mod)
326
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
327
+ __createBinding(result, mod, k);
328
+ __setModuleDefault(result, mod);
329
+ return result;
330
+ }
331
+ function __importDefault(mod) {
332
+ return (mod && mod.__esModule) ? mod : { default: mod };
333
+ }
334
+ function __classPrivateFieldGet(receiver, state, kind, f) {
335
+ if (kind === "a" && !f)
336
+ throw new TypeError("Private accessor was defined without a getter");
337
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
338
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
339
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
340
+ }
341
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
342
+ if (kind === "m")
343
+ throw new TypeError("Private method is not writable");
344
+ if (kind === "a" && !f)
345
+ throw new TypeError("Private accessor was defined without a setter");
346
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
347
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
348
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
349
349
  }
350
350
 
351
- var AuthService = /** @class */ (function () {
352
- function AuthService(angularFireAuth, userRepository) {
353
- this.angularFireAuth = angularFireAuth;
354
- this.userRepository = userRepository;
355
- }
356
- AuthService.prototype.getAuthstate = function () {
357
- var observables = [
358
- this.angularFireAuth.authState.pipe(operators.catchError(function () { return rxjs.of(null); })),
359
- this.getUser().pipe(operators.catchError(function () { return rxjs.of(null); })),
360
- ];
361
- return rxjs.combineLatest(observables).pipe(operators.map(function (_a) {
362
- var _b = __read(_a, 2), fireUser = _b[0], user = _b[1];
363
- return {
364
- user: user,
365
- isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
366
- };
367
- }));
368
- };
369
- AuthService.prototype.getUser = function () {
370
- var _this = this;
371
- return this.getFireUser().pipe(operators.map(function (user) { return user === null || user === void 0 ? void 0 : user.uid; }), operators.mergeMap(function (id) { return (id ? _this.userRepository.get({ id: id }) : rxjs.of(null)); }));
372
- };
373
- AuthService.prototype.getTokenId = function () {
374
- return this.angularFireAuth.idToken;
375
- };
376
- AuthService.prototype.getFireUser = function () {
377
- return this.angularFireAuth.user.pipe(operators.catchError(function () { return rxjs.of(null); }));
378
- };
379
- return AuthService;
380
- }());
381
- AuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, deps: [{ token: i1__namespace.AngularFireAuth }, { token: 'UserRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
382
- AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService });
383
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, decorators: [{
384
- type: i0.Injectable
385
- }], ctorParameters: function () {
386
- return [{ type: i1__namespace.AngularFireAuth }, { type: undefined, decorators: [{
387
- type: i0.Inject,
388
- args: ['UserRepository']
389
- }] }];
351
+ var AuthService = /** @class */ (function () {
352
+ function AuthService(angularFireAuth, userRepository) {
353
+ this.angularFireAuth = angularFireAuth;
354
+ this.userRepository = userRepository;
355
+ }
356
+ AuthService.prototype.getAuthstate = function () {
357
+ var observables = [
358
+ this.angularFireAuth.authState.pipe(operators.catchError(function () { return rxjs.of(null); })),
359
+ this.getUser().pipe(operators.catchError(function () { return rxjs.of(null); })),
360
+ ];
361
+ return rxjs.combineLatest(observables).pipe(operators.map(function (_a) {
362
+ var _b = __read(_a, 2), fireUser = _b[0], user = _b[1];
363
+ return {
364
+ user: user,
365
+ isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
366
+ };
367
+ }));
368
+ };
369
+ AuthService.prototype.getUser = function () {
370
+ var _this = this;
371
+ return this.getFireUser().pipe(operators.map(function (user) { return user === null || user === void 0 ? void 0 : user.uid; }), operators.mergeMap(function (id) { return (id ? _this.userRepository.get({ id: id }) : rxjs.of(null)); }));
372
+ };
373
+ AuthService.prototype.getTokenId = function () {
374
+ return this.angularFireAuth.idToken;
375
+ };
376
+ AuthService.prototype.getFireUser = function () {
377
+ return this.angularFireAuth.user.pipe(operators.catchError(function () { return rxjs.of(null); }));
378
+ };
379
+ return AuthService;
380
+ }());
381
+ AuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, deps: [{ token: i1__namespace.AngularFireAuth }, { token: 'UserRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
382
+ AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService });
383
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, decorators: [{
384
+ type: i0.Injectable
385
+ }], ctorParameters: function () {
386
+ return [{ type: i1__namespace.AngularFireAuth }, { type: undefined, decorators: [{
387
+ type: i0.Inject,
388
+ args: ['UserRepository']
389
+ }] }];
390
390
  } });
391
391
 
392
392
  var DEFAULT_SHOP = 'DEFAULT_SHOP';
393
393
 
394
- var InvalidCouponError = /** @class */ (function (_super) {
395
- __extends(InvalidCouponError, _super);
396
- function InvalidCouponError(message) {
397
- var _this = _super.call(this, message) || this;
398
- _this.message = message;
399
- return _this;
400
- }
401
- return InvalidCouponError;
394
+ var InvalidCouponError = /** @class */ (function (_super) {
395
+ __extends(InvalidCouponError, _super);
396
+ function InvalidCouponError(message) {
397
+ var _this = _super.call(this, message) || this;
398
+ _this.message = message;
399
+ return _this;
400
+ }
401
+ return InvalidCouponError;
402
+ }(Error));
403
+
404
+ var GroupInvalidCouponError = /** @class */ (function (_super) {
405
+ __extends(GroupInvalidCouponError, _super);
406
+ function GroupInvalidCouponError(errors) {
407
+ var _this = _super.call(this, 'Many coupon errors throw') || this;
408
+ _this.errors = errors;
409
+ return _this;
410
+ }
411
+ return GroupInvalidCouponError;
402
412
  }(Error));
403
413
 
404
- var CouponService = /** @class */ (function () {
405
- function CouponService(couponRepository, defaultShop) {
406
- this.couponRepository = couponRepository;
407
- this.defaultShop = defaultShop;
408
- this.emailIsFromCollaborator = function (userEmail) { return !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g)); };
409
- }
410
- CouponService.prototype.checkCoupon = function (nickname, userEmail) {
411
- var _this = this;
412
- return rxjs.from(this.couponRepository.find([
413
- {
414
- nickname: { operator: i1$1.Where.EQUALS, value: nickname },
415
- shopAvailability: { operator: i1$1.Where.EQUALS, value: this.defaultShop },
416
- },
417
- ])).pipe(operators.concatMap(function (coupons) { return coupons.count < 1 ? rxjs.throwError(function () { return new i1$1.NotFoundError('Coupon not found'); }) : rxjs.of(coupons.data[0]); }), operators.concatMap(function (coupon) { return i1$1.FinancialCoupon.isFinancialCoupon(coupon) && _this.isValidCoupon(coupon, userEmail)
418
- ? rxjs.of(coupon)
419
- : rxjs.throwError(function () { return new InvalidCouponError('Coupon is not valid'); }); }));
420
- };
421
- CouponService.prototype.isValidCoupon = function (coupon, userEmail) {
422
- if (coupon.checkoutType !== i1$1.CheckoutTypes.ECOMMERCE)
423
- throw new InvalidCouponError('Coupon is not ecommerce valid');
424
- if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === i1$1.Exclusivities.COLLABORATORS)
425
- throw new InvalidCouponError('User is not a collaborator');
426
- if (coupon.exclusivityType === i1$1.Exclusivities.SPECIFIC_USER && coupon.recipient !== userEmail)
427
- throw new InvalidCouponError('Coupon is not valid for user');
428
- if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) < new Date())
429
- throw new InvalidCouponError('Coupon is expired');
430
- return true;
431
- };
432
- return CouponService;
433
- }());
434
- CouponService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
435
- CouponService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, providedIn: 'root' });
436
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, decorators: [{
437
- type: i0.Injectable,
438
- args: [{
439
- providedIn: 'root',
440
- }]
441
- }], ctorParameters: function () {
442
- return [{ type: undefined, decorators: [{
443
- type: i0.Inject,
444
- args: ['CouponRepository']
445
- }] }, { type: i1__namespace$1.Shops, decorators: [{
446
- type: i0.Inject,
447
- args: [DEFAULT_SHOP]
448
- }] }];
414
+ var CouponService = /** @class */ (function () {
415
+ function CouponService(couponRepository, defaultShop) {
416
+ var _this = this;
417
+ this.couponRepository = couponRepository;
418
+ this.defaultShop = defaultShop;
419
+ this.emailIsFromCollaborator = function (userEmail) { return !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g)); };
420
+ this.separateValidCoupons = function (coupons, userEmail) { return coupons
421
+ .map(function (coupon) {
422
+ try {
423
+ if (!i2.FinancialCoupon.isFinancialCoupon(coupon))
424
+ throw new InvalidCouponError('Coupon is not valid');
425
+ if (_this.isValidCoupon(coupon, userEmail))
426
+ return coupon;
427
+ }
428
+ catch (error) {
429
+ return error;
430
+ }
431
+ })
432
+ .reduce(function (current, coupon) { return (Object.assign(Object.assign({}, current), (i2.FinancialCoupon.isFinancialCoupon(coupon)
433
+ ? { valids: __spreadArray(__spreadArray([], __read(current.valids)), [coupon]) }
434
+ : { invalids: __spreadArray(__spreadArray([], __read(current.invalids)), [coupon]) }))); }, {
435
+ valids: [],
436
+ invalids: [],
437
+ }); };
438
+ }
439
+ CouponService.prototype.checkCoupon = function (nickname, userEmail, checkoutType) {
440
+ var _this = this;
441
+ return rxjs.from(this.couponRepository.find([
442
+ {
443
+ nickname: { operator: i2.Where.EQUALS, value: nickname },
444
+ shopAvailability: { operator: i2.Where.EQUALS, value: this.defaultShop },
445
+ checkoutType: { operator: i2.Where.EQUALS, value: checkoutType },
446
+ },
447
+ ])).pipe(operators.concatMap(function (coupons) { return coupons.count < 1 ? rxjs.throwError(function () { return new i2.NotFoundError('Coupon not found'); }) : rxjs.of(coupons.data); }), operators.map(function (coupons) { return _this.separateValidCoupons(coupons, userEmail); }), operators.map(function (_a) {
448
+ var valids = _a.valids, invalids = _a.invalids;
449
+ if (!valids.length)
450
+ throw new GroupInvalidCouponError(invalids);
451
+ return valids;
452
+ }));
453
+ };
454
+ CouponService.prototype.isValidCoupon = function (coupon, userEmail) {
455
+ if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === i2.Exclusivities.COLLABORATORS)
456
+ throw new InvalidCouponError('User is not a collaborator');
457
+ if (coupon.exclusivityType === i2.Exclusivities.SPECIFIC_USER && coupon.recipient !== userEmail)
458
+ throw new InvalidCouponError('Coupon is not valid for user');
459
+ if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) < new Date())
460
+ throw new InvalidCouponError('Coupon is expired');
461
+ return true;
462
+ };
463
+ return CouponService;
464
+ }());
465
+ CouponService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
466
+ CouponService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, providedIn: 'root' });
467
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, decorators: [{
468
+ type: i0.Injectable,
469
+ args: [{
470
+ providedIn: 'root',
471
+ }]
472
+ }], ctorParameters: function () {
473
+ return [{ type: undefined, decorators: [{
474
+ type: i0.Inject,
475
+ args: ['CouponRepository']
476
+ }] }, { type: i2__namespace.Shops, decorators: [{
477
+ type: i0.Inject,
478
+ args: [DEFAULT_SHOP]
479
+ }] }];
449
480
  } });
450
481
 
451
- var CheckoutService = /** @class */ (function () {
452
- function CheckoutService(couponService, checkoutRepository, orderRepository, userRepository, defaultShop) {
453
- this.couponService = couponService;
454
- this.checkoutRepository = checkoutRepository;
455
- this.orderRepository = orderRepository;
456
- this.userRepository = userRepository;
457
- this.defaultShop = defaultShop;
458
- }
459
- CheckoutService.prototype.getCheckout = function (checkoutData) {
460
- var checkoutId = cookie__default["default"].get('checkoutId');
461
- if (!i1$1.isNil(checkoutId))
462
- return rxjs.from(this.checkoutRepository.get({ id: checkoutId }));
463
- return rxjs.from(this.createCheckout(checkoutData));
464
- };
465
- CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
466
- var _this = this;
467
- return rxjs.from(this.checkoutRepository.get({ id: checkoutId })).pipe(operators.concatMap(function (checkout) { var _a; return ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.user) === null || _a === void 0 ? void 0 : _a.id) ? rxjs.of(checkout.user) : rxjs.from(_this.userRepository.get({ id: checkout.user.id })); }), operators.concatMap(function (user) { return rxjs.of(user) || rxjs.throwError(function () { return new i1$1.NotFoundError('User is not found'); }); }));
468
- };
469
- CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
470
- return rxjs.from(this.checkoutRepository.update(i1$1.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
471
- };
472
- CheckoutService.prototype.updateCheckoutUser = function (checkout) {
473
- return rxjs.from(this.checkoutRepository.update(i1$1.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
474
- };
475
- CheckoutService.prototype.clearCheckoutFromSession = function () {
476
- cookie__default["default"].remove('checkoutId');
477
- return rxjs.of();
478
- };
479
- CheckoutService.prototype.checkCoupon = function (nickname) {
480
- var _this = this;
481
- return this.getCheckout().pipe(operators.concatMap(function (checkout) {
482
- var _a;
483
- return _this.couponService.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email).pipe(operators.concatMap(function (coupon) {
484
- var _a, _b;
485
- return !!((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email)
486
- ? rxjs.from(_this.orderRepository.find([{ user: { email: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email }, coupon: { id: coupon.id } }])).pipe(operators.concatMap(function (orders) {
487
- if (orders.data.length >= (coupon.useLimit || Infinity))
488
- return rxjs.throwError(function () { return new Error('Coupon is already applied'); });
489
- return rxjs.of(coupon);
490
- }))
491
- : rxjs.of(coupon);
492
- }));
493
- }));
494
- };
495
- CheckoutService.prototype.createCheckout = function (checkoutData) {
496
- return __awaiter(this, void 0, void 0, function () {
497
- var checkout;
498
- return __generator(this, function (_c) {
499
- switch (_c.label) {
500
- case 0: return [4 /*yield*/, this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, i1$1.Checkout.toInstance(i1$1.pick(checkoutData, ['user', 'shop'])).toPlain()), { shop: (checkoutData === null || checkoutData === void 0 ? void 0 : checkoutData.shop) || this.defaultShop }))];
501
- case 1:
502
- checkout = _c.sent();
503
- cookie__default["default"].set('checkoutId', checkout.id);
504
- return [2 /*return*/, checkout];
505
- }
506
- });
507
- });
508
- };
509
- return CheckoutService;
510
- }());
511
- CheckoutService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, deps: [{ token: CouponService }, { token: 'CheckoutRepository' }, { token: 'OrderRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
512
- CheckoutService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService });
513
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, decorators: [{
514
- type: i0.Injectable
515
- }], ctorParameters: function () {
516
- return [{ type: CouponService }, { type: undefined, decorators: [{
517
- type: i0.Inject,
518
- args: ['CheckoutRepository']
519
- }] }, { type: undefined, decorators: [{
520
- type: i0.Inject,
521
- args: ['OrderRepository']
522
- }] }, { type: undefined, decorators: [{
523
- type: i0.Inject,
524
- args: ['UserRepository']
525
- }] }, { type: i1__namespace$1.Shops, decorators: [{
526
- type: i0.Inject,
527
- args: [DEFAULT_SHOP]
528
- }] }];
482
+ var CheckoutService = /** @class */ (function () {
483
+ function CheckoutService(couponService, checkoutRepository, orderRepository, userRepository, defaultShop) {
484
+ this.couponService = couponService;
485
+ this.checkoutRepository = checkoutRepository;
486
+ this.orderRepository = orderRepository;
487
+ this.userRepository = userRepository;
488
+ this.defaultShop = defaultShop;
489
+ }
490
+ CheckoutService.prototype.getCheckout = function (checkoutData) {
491
+ var checkoutId = cookie__default["default"].get('checkoutId');
492
+ if (!i2.isNil(checkoutId))
493
+ return rxjs.from(this.checkoutRepository.get({ id: checkoutId }));
494
+ return rxjs.from(this.createCheckout(checkoutData));
495
+ };
496
+ CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
497
+ var _this = this;
498
+ return rxjs.from(this.checkoutRepository.get({ id: checkoutId })).pipe(operators.concatMap(function (checkout) { var _a; return ((_a = checkout === null || checkout === void 0 ? void 0 : checkout.user) === null || _a === void 0 ? void 0 : _a.id) ? rxjs.of(checkout.user) : rxjs.from(_this.userRepository.get({ id: checkout.user.id })); }), operators.concatMap(function (user) { return rxjs.of(user) || rxjs.throwError(function () { return new i2.NotFoundError('User is not found'); }); }));
499
+ };
500
+ CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
501
+ return rxjs.from(this.checkoutRepository.update(i2.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
502
+ };
503
+ CheckoutService.prototype.updateCheckoutUser = function (checkout) {
504
+ return rxjs.from(this.checkoutRepository.update(i2.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
505
+ };
506
+ CheckoutService.prototype.clearCheckoutFromSession = function () {
507
+ cookie__default["default"].remove('checkoutId');
508
+ return rxjs.of();
509
+ };
510
+ CheckoutService.prototype.checkCoupon = function (nickname) {
511
+ var _this = this;
512
+ return this.getCheckout().pipe(operators.concatMap(function (checkout) {
513
+ var _a;
514
+ return _this.couponService.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email, i2.CheckoutTypes.ECOMMERCE).pipe(operators.concatMap(function (coupons) { return rxjs.of(coupons.shift()); }), operators.concatMap(function (coupon) {
515
+ var _a, _b;
516
+ return !!((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email)
517
+ ? rxjs.from(_this.orderRepository.find([{ user: { email: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email }, coupon: { id: coupon.id } }])).pipe(operators.concatMap(function (orders) {
518
+ if (orders.data.length >= (coupon.useLimit || Infinity))
519
+ return rxjs.throwError(function () { return new Error('Coupon is already applied'); });
520
+ return rxjs.of(coupon);
521
+ }))
522
+ : rxjs.of(coupon);
523
+ }));
524
+ }));
525
+ };
526
+ CheckoutService.prototype.createCheckout = function (checkoutData) {
527
+ return __awaiter(this, void 0, void 0, function () {
528
+ var checkout;
529
+ return __generator(this, function (_c) {
530
+ switch (_c.label) {
531
+ case 0: return [4 /*yield*/, this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, i2.Checkout.toInstance(i2.pick(checkoutData, ['user', 'shop'])).toPlain()), { shop: (checkoutData === null || checkoutData === void 0 ? void 0 : checkoutData.shop) || this.defaultShop }))];
532
+ case 1:
533
+ checkout = _c.sent();
534
+ cookie__default["default"].set('checkoutId', checkout.id);
535
+ return [2 /*return*/, checkout];
536
+ }
537
+ });
538
+ });
539
+ };
540
+ return CheckoutService;
541
+ }());
542
+ CheckoutService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, deps: [{ token: CouponService }, { token: 'CheckoutRepository' }, { token: 'OrderRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
543
+ CheckoutService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService });
544
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, decorators: [{
545
+ type: i0.Injectable
546
+ }], ctorParameters: function () {
547
+ return [{ type: CouponService }, { type: undefined, decorators: [{
548
+ type: i0.Inject,
549
+ args: ['CheckoutRepository']
550
+ }] }, { type: undefined, decorators: [{
551
+ type: i0.Inject,
552
+ args: ['OrderRepository']
553
+ }] }, { type: undefined, decorators: [{
554
+ type: i0.Inject,
555
+ args: ['UserRepository']
556
+ }] }, { type: i2__namespace.Shops, decorators: [{
557
+ type: i0.Inject,
558
+ args: [DEFAULT_SHOP]
559
+ }] }];
529
560
  } });
530
561
 
531
- var CartService = /** @class */ (function () {
532
- function CartService(authService, checkoutService, defaultShop) {
533
- var _this = this;
534
- this.authService = authService;
535
- this.checkoutService = checkoutService;
536
- this.defaultShop = defaultShop;
537
- this.cartSubject = new rxjs.Subject();
538
- this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i1$1.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
539
- var _a;
540
- var items = [];
541
- var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.sku; }).indexOf(lineItem.sku);
542
- if (index > -1) {
543
- checkoutLoaded.lineItems[index].quantity += quantity;
544
- checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
545
- }
546
- else
547
- checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
548
- return _this.checkoutService
549
- .updateCheckoutLineItems(checkoutLoaded)
550
- .pipe(operators.map(function (updatedCheckout) { return _this.generateCartObject(updatedCheckout.lineItems); }));
551
- })); };
552
- this.generateCartObject = function (items) {
553
- var cart = {};
554
- items === null || items === void 0 ? void 0 : items.forEach(function (item) {
555
- var _a;
556
- return (cart[item.sku] = i1$1.LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.sku] || item)), { quantity: (((_a = cart[item.sku]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })));
557
- });
558
- return cart;
559
- };
560
- this.buildLineItem = function (_f) {
561
- var checkout = _f.checkout, item = _f.item, quantity = _f.quantity;
562
- var _a, _b, _c, _d, _e;
563
- item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; })) === null || _b === void 0 ? void 0 : _b.quantity) || 0;
564
- if (_this.checkMaxStock(item, quantity || 0))
565
- throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
566
- var image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
567
- var id = item.id, name = item.name, brand = item.brand, slug = item.slug, stock = item.stock, price = item.price, weight = item.weight, categories = item.categories, sku = item.sku;
568
- var isGift = item.isGift || null;
569
- var pricePaid = _this.getProductPrice({
570
- product: item,
571
- shop: checkout.shop || _this.defaultShop,
572
- isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
573
- });
574
- return i1$1.LineItem.toInstance({
575
- id: id,
576
- name: name,
577
- brand: brand,
578
- slug: slug,
579
- sku: sku,
580
- stock: stock,
581
- price: price,
582
- image: image,
583
- weight: weight,
584
- quantity: (item.quantity || 0) + (quantity || 0),
585
- pricePaid: pricePaid,
586
- categories: categories,
587
- isGift: isGift,
588
- costPrice: item === null || item === void 0 ? void 0 : item.costPrice,
589
- });
590
- };
591
- this.getProductPrice = function (_f) {
592
- var product = _f.product, shop = _f.shop, isSubscriber = _f.isSubscriber;
593
- var info = product.getInfoByShop(shop);
594
- if (product.isGift)
595
- return 0;
596
- return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
597
- };
598
- this.checkMaxStock = function (item, quantity) {
599
- var _a;
600
- var maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
601
- var currentItemAmount = item.quantity || 0;
602
- return currentItemAmount + quantity > maxStock;
603
- };
604
- }
605
- CartService.prototype.addItem = function (item, quantity) {
606
- var _this = this;
607
- if (quantity === void 0) { quantity = 1; }
608
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) { return ({
609
- checkout: checkout,
610
- lineItem: _this.buildLineItem({ checkout: checkout, item: item, quantity: quantity || 1 }),
611
- }); }), operators.concatMap(function (_f) {
612
- var checkout = _f.checkout, lineItem = _f.lineItem;
613
- return _this.updateLineItemInCart(lineItem, quantity || 1, checkout);
614
- }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
615
- };
616
- CartService.prototype.decreaseItem = function (item) {
617
- var _this = this;
618
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
619
- var _a;
620
- var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; });
621
- if (!i1$1.isNil(checkoutItem))
622
- checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
623
- return checkout;
624
- }), operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
625
- };
626
- CartService.prototype.getCart = function (checkout) {
627
- var _this = this;
628
- this.buildCartFromCheckout(checkout).subscribe(function (cart) { return _this.cartSubject.next(cart); });
629
- return this.cartSubject;
630
- };
631
- /**
632
- * @deprecated The method should not be used
633
- */
634
- CartService.prototype.getDiscount = function (coupon) {
635
- switch (coupon.type) {
636
- case i1$1.CouponTypes.FINANCIAL:
637
- return this.getFinancialDiscount(coupon);
638
- case i1$1.CouponTypes.PRODUCT:
639
- return function (subTotalPrice) { return subTotalPrice; };
640
- case i1$1.CouponTypes.GIFTCARD:
641
- return this.getFinancialDiscount(coupon);
642
- case i1$1.CouponTypes.VOUCHER:
643
- return function (subTotalPrice) { return subTotalPrice; };
644
- }
645
- };
646
- /**
647
- * @deprecated The method should not be used
648
- */
649
- CartService.prototype.getVariantPriceDiscount = function (item, shop) {
650
- return this.authService.getUser().pipe(operators.concatMap(function (user) { return rxjs.iif(function () { return user.isSubscriber && !!item.getInfoByShop(shop).subscriberPrice; }, rxjs.of(item.getInfoByShop(shop).subscriberPrice), rxjs.of(item.getInfoByShop(shop).price)); }), operators.catchError(function () { return rxjs.of(item.getInfoByShop(shop).price); }));
651
- };
652
- CartService.prototype.removeItem = function (item) {
653
- var _this = this;
654
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
655
- var index = checkout.lineItems.findIndex(function (lineItem) { return lineItem.sku === item.sku; });
656
- if (index >= 0)
657
- checkout.lineItems.splice(index, 1);
658
- return checkout;
659
- }), operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
660
- };
661
- CartService.prototype.updateUserCart = function (user) {
662
- var _this = this;
663
- return this.checkoutService.getCheckout().pipe(operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutUser(i1$1.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user: user }))); }), operators.concatMap(function (checkout) {
664
- var _a;
665
- return _this.checkoutService.updateCheckoutLineItems(i1$1.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: ((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (item) { return _this.buildLineItem({ checkout: checkout, item: item }); })) || [] })));
666
- }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
667
- };
668
- CartService.prototype.clearCart = function () {
669
- var _this = this;
670
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
671
- _this.checkoutService.clearCheckoutFromSession();
672
- return checkout;
673
- }), operators.concatMap(function (oldCheckout) { return _this.buildCartFromCheckout(oldCheckout); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
674
- };
675
- CartService.prototype.buildCartFromCheckout = function (checkoutData) {
676
- var _this = this;
677
- return this.checkoutService.getCheckout(checkoutData).pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.concatMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
678
- };
679
- CartService.prototype.getFinancialDiscount = function (coupon) {
680
- return function (subTotalPrice) {
681
- if (i1$1.FinancialCoupon.isFinancialCoupon(coupon))
682
- switch (coupon.subtype) {
683
- case i1$1.CouponSubtypes.ABSOLUTE:
684
- return subTotalPrice - coupon.discount * 100;
685
- case i1$1.CouponSubtypes.PERCENTAGE:
686
- return subTotalPrice * (1 - coupon.discount / 100);
687
- }
688
- };
689
- };
690
- return CartService;
691
- }());
692
- CartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
693
- CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService });
694
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, decorators: [{
695
- type: i0.Injectable
696
- }], ctorParameters: function () {
697
- return [{ type: AuthService }, { type: CheckoutService }, { type: i1__namespace$1.Shops, decorators: [{
698
- type: i0.Inject,
699
- args: [DEFAULT_SHOP]
700
- }] }];
562
+ var CartService = /** @class */ (function () {
563
+ function CartService(authService, checkoutService, defaultShop) {
564
+ var _this = this;
565
+ this.authService = authService;
566
+ this.checkoutService = checkoutService;
567
+ this.defaultShop = defaultShop;
568
+ this.cartSubject = new rxjs.Subject();
569
+ this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i2.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
570
+ var _a;
571
+ var items = [];
572
+ var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.sku; }).indexOf(lineItem.sku);
573
+ if (index > -1) {
574
+ checkoutLoaded.lineItems[index].quantity += quantity;
575
+ checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
576
+ }
577
+ else
578
+ checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
579
+ return _this.checkoutService
580
+ .updateCheckoutLineItems(checkoutLoaded)
581
+ .pipe(operators.map(function (updatedCheckout) { return _this.generateCartObject(updatedCheckout.lineItems); }));
582
+ })); };
583
+ this.generateCartObject = function (items) {
584
+ var cart = {};
585
+ items === null || items === void 0 ? void 0 : items.forEach(function (item) {
586
+ var _a;
587
+ return (cart[item.sku] = i2.LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.sku] || item)), { quantity: (((_a = cart[item.sku]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })));
588
+ });
589
+ return cart;
590
+ };
591
+ this.buildLineItem = function (_f) {
592
+ var checkout = _f.checkout, item = _f.item, quantity = _f.quantity;
593
+ var _a, _b, _c, _d, _e;
594
+ item.quantity = (item === null || item === void 0 ? void 0 : item.quantity) || ((_b = (_a = checkout === null || checkout === void 0 ? void 0 : checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; })) === null || _b === void 0 ? void 0 : _b.quantity) || 0;
595
+ if (_this.checkMaxStock(item, quantity || 0))
596
+ throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
597
+ var image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
598
+ var id = item.id, name = item.name, brand = item.brand, slug = item.slug, stock = item.stock, price = item.price, weight = item.weight, categories = item.categories, sku = item.sku;
599
+ var isGift = item.isGift || null;
600
+ var pricePaid = _this.getProductPrice({
601
+ product: item,
602
+ shop: checkout.shop || _this.defaultShop,
603
+ isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
604
+ });
605
+ return i2.LineItem.toInstance({
606
+ id: id,
607
+ name: name,
608
+ brand: brand,
609
+ slug: slug,
610
+ sku: sku,
611
+ stock: stock,
612
+ price: price,
613
+ image: image,
614
+ weight: weight,
615
+ quantity: (item.quantity || 0) + (quantity || 0),
616
+ pricePaid: pricePaid,
617
+ categories: categories,
618
+ isGift: isGift,
619
+ costPrice: item === null || item === void 0 ? void 0 : item.costPrice,
620
+ });
621
+ };
622
+ this.getProductPrice = function (_f) {
623
+ var product = _f.product, shop = _f.shop, isSubscriber = _f.isSubscriber;
624
+ var info = product.getInfoByShop(shop);
625
+ if (product.isGift)
626
+ return 0;
627
+ return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
628
+ };
629
+ this.checkMaxStock = function (item, quantity) {
630
+ var _a;
631
+ var maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
632
+ var currentItemAmount = item.quantity || 0;
633
+ return currentItemAmount + quantity > maxStock;
634
+ };
635
+ }
636
+ CartService.prototype.addItem = function (item, quantity) {
637
+ var _this = this;
638
+ if (quantity === void 0) { quantity = 1; }
639
+ return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) { return ({
640
+ checkout: checkout,
641
+ lineItem: _this.buildLineItem({ checkout: checkout, item: item, quantity: quantity || 1 }),
642
+ }); }), operators.concatMap(function (_f) {
643
+ var checkout = _f.checkout, lineItem = _f.lineItem;
644
+ return _this.updateLineItemInCart(lineItem, quantity || 1, checkout);
645
+ }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
646
+ };
647
+ CartService.prototype.decreaseItem = function (item) {
648
+ var _this = this;
649
+ return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
650
+ var _a;
651
+ var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; });
652
+ if (!i2.isNil(checkoutItem))
653
+ checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
654
+ return checkout;
655
+ }), operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
656
+ };
657
+ CartService.prototype.getCart = function (checkout) {
658
+ var _this = this;
659
+ this.buildCartFromCheckout(checkout).subscribe(function (cart) { return _this.cartSubject.next(cart); });
660
+ return this.cartSubject;
661
+ };
662
+ /**
663
+ * @deprecated The method should not be used
664
+ */
665
+ CartService.prototype.getDiscount = function (coupon) {
666
+ switch (coupon.type) {
667
+ case i2.CouponTypes.FINANCIAL:
668
+ return this.getFinancialDiscount(coupon);
669
+ case i2.CouponTypes.PRODUCT:
670
+ return function (subTotalPrice) { return subTotalPrice; };
671
+ case i2.CouponTypes.GIFTCARD:
672
+ return this.getFinancialDiscount(coupon);
673
+ case i2.CouponTypes.VOUCHER:
674
+ return function (subTotalPrice) { return subTotalPrice; };
675
+ }
676
+ };
677
+ /**
678
+ * @deprecated The method should not be used
679
+ */
680
+ CartService.prototype.getVariantPriceDiscount = function (item, shop) {
681
+ return this.authService.getUser().pipe(operators.concatMap(function (user) { return rxjs.iif(function () { return user.isSubscriber && !!item.getInfoByShop(shop).subscriberPrice; }, rxjs.of(item.getInfoByShop(shop).subscriberPrice), rxjs.of(item.getInfoByShop(shop).price)); }), operators.catchError(function () { return rxjs.of(item.getInfoByShop(shop).price); }));
682
+ };
683
+ CartService.prototype.removeItem = function (item) {
684
+ var _this = this;
685
+ return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
686
+ var index = checkout.lineItems.findIndex(function (lineItem) { return lineItem.sku === item.sku; });
687
+ if (index >= 0)
688
+ checkout.lineItems.splice(index, 1);
689
+ return checkout;
690
+ }), operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
691
+ };
692
+ CartService.prototype.updateUserCart = function (user) {
693
+ var _this = this;
694
+ return this.checkoutService.getCheckout().pipe(operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutUser(i2.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user: user }))); }), operators.concatMap(function (checkout) {
695
+ var _a;
696
+ return _this.checkoutService.updateCheckoutLineItems(i2.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { lineItems: ((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (item) { return _this.buildLineItem({ checkout: checkout, item: item }); })) || [] })));
697
+ }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
698
+ };
699
+ CartService.prototype.clearCart = function () {
700
+ var _this = this;
701
+ return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
702
+ _this.checkoutService.clearCheckoutFromSession();
703
+ return checkout;
704
+ }), operators.concatMap(function (oldCheckout) { return _this.buildCartFromCheckout(oldCheckout); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
705
+ };
706
+ CartService.prototype.buildCartFromCheckout = function (checkoutData) {
707
+ var _this = this;
708
+ return this.checkoutService.getCheckout(checkoutData).pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.concatMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
709
+ };
710
+ CartService.prototype.getFinancialDiscount = function (coupon) {
711
+ return function (subTotalPrice) {
712
+ if (i2.FinancialCoupon.isFinancialCoupon(coupon))
713
+ switch (coupon.subtype) {
714
+ case i2.CouponSubtypes.ABSOLUTE:
715
+ return subTotalPrice - coupon.discount * 100;
716
+ case i2.CouponSubtypes.PERCENTAGE:
717
+ return subTotalPrice * (1 - coupon.discount / 100);
718
+ }
719
+ };
720
+ };
721
+ return CartService;
722
+ }());
723
+ CartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
724
+ CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService });
725
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, decorators: [{
726
+ type: i0.Injectable
727
+ }], ctorParameters: function () {
728
+ return [{ type: AuthService }, { type: CheckoutService }, { type: i2__namespace.Shops, decorators: [{
729
+ type: i0.Inject,
730
+ args: [DEFAULT_SHOP]
731
+ }] }];
701
732
  } });
702
733
 
703
- var CheckoutSubscriptionService = /** @class */ (function () {
704
- function CheckoutSubscriptionService(checkoutSubscriptionRepository, couponRepository, subscriptionRepository, defaultShop) {
705
- this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
706
- this.couponRepository = couponRepository;
707
- this.subscriptionRepository = subscriptionRepository;
708
- this.defaultShop = defaultShop;
709
- this.emailIsFromCollaborator = function (userEmail) { return !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g)); };
710
- }
711
- CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
712
- var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
713
- if (!i1$1.isNil(checkoutId))
714
- return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
715
- return rxjs.from(this.createCheckoutSubscription(checkoutData));
716
- };
717
- CheckoutSubscriptionService.prototype.createCheckoutSubscription = function (checkoutData) {
718
- return __awaiter(this, void 0, void 0, function () {
719
- var checkout;
720
- return __generator(this, function (_a) {
721
- switch (_a.label) {
722
- case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i1$1.CheckoutSubscription.toInstance(i1$1.pick(checkoutData, ['user', 'shop'])).toPlain()))];
723
- case 1:
724
- checkout = _a.sent();
725
- cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
726
- return [2 /*return*/, checkout];
727
- }
728
- });
729
- });
730
- };
731
- CheckoutSubscriptionService.prototype.clearCheckoutSubscriptionFromSession = function () {
732
- cookie__default["default"].remove('checkoutSubscriptionId');
733
- return rxjs.of();
734
- };
735
- CheckoutSubscriptionService.prototype.checkCoupon = function (nickname, userEmail) {
736
- var _this = this;
737
- return rxjs.forkJoin([
738
- this.couponRepository.find([
739
- {
740
- nickname: { operator: i1$1.Where.EQUALS, value: nickname },
741
- shopAvailability: { operator: i1$1.Where.EQUALS, value: this.defaultShop },
742
- },
743
- ]),
744
- this.subscriptionRepository.find([
745
- {
746
- coupon: {
747
- nickname: {
748
- operator: i1$1.Where.EQUALS, value: nickname
749
- }
750
- }
751
- }
752
- ])
753
- ]).pipe(operators.concatMap(function (results) {
754
- var _a = __read(results, 2), coupons = _a[0], subscriptions = _a[1];
755
- if (coupons.count < 1) {
756
- return rxjs.throwError(function () { return new i1$1.NotFoundError('Coupon not found'); });
757
- }
758
- else if (coupons.data[0].useLimit && subscriptions.count >= coupons.data[0].useLimit) {
759
- return rxjs.throwError(function () { return new i1$1.NotFoundError('Coupon not found'); });
760
- }
761
- return rxjs.of(coupons.data[0]);
762
- }), operators.concatMap(function (coupon) { return i1$1.FinancialCoupon.isFinancialCoupon(coupon) && _this.isValidCoupon(coupon, userEmail)
763
- ? rxjs.of(coupon)
764
- : rxjs.throwError(function () { return new InvalidCouponError('Coupon is not valid'); }); }));
765
- };
766
- CheckoutSubscriptionService.prototype.isValidCoupon = function (coupon, userEmail) {
767
- if (+coupon.checkoutType !== i1$1.CheckoutTypes.SUBSCRIPTION)
768
- throw new InvalidCouponError('Coupon is not subscription valid');
769
- if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === i1$1.Exclusivities.COLLABORATORS)
770
- throw new InvalidCouponError('User is not a collaborator');
771
- if (coupon.exclusivityType === i1$1.Exclusivities.SPECIFIC_USER && coupon.recipient !== userEmail)
772
- throw new InvalidCouponError('Coupon is not valid for user');
773
- if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) < new Date())
774
- throw new InvalidCouponError('Coupon is expired');
775
- return true;
776
- };
777
- return CheckoutSubscriptionService;
778
- }());
779
- CheckoutSubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: 'CouponRepository' }, { token: 'SubscriptionRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
780
- CheckoutSubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService });
781
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, decorators: [{
782
- type: i0.Injectable
783
- }], ctorParameters: function () {
784
- return [{ type: undefined, decorators: [{
785
- type: i0.Inject,
786
- args: ['CheckoutSubscriptionRepository']
787
- }] }, { type: undefined, decorators: [{
788
- type: i0.Inject,
789
- args: ['CouponRepository']
790
- }] }, { type: undefined, decorators: [{
791
- type: i0.Inject,
792
- args: ['SubscriptionRepository']
793
- }] }, { type: i1__namespace$1.Shops, decorators: [{
794
- type: i0.Inject,
795
- args: [DEFAULT_SHOP]
796
- }] }];
734
+ var CheckoutSubscriptionService = /** @class */ (function () {
735
+ function CheckoutSubscriptionService(checkoutSubscriptionRepository, couponService) {
736
+ var _this = this;
737
+ this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
738
+ this.couponService = couponService;
739
+ this.checkCouponsWithCheckout = function (coupons, checkout) { return rxjs.forkJoin(coupons.map(function (coupon) {
740
+ var _a;
741
+ return rxjs.from(_this.checkoutSubscriptionRepository.find([
742
+ { user: { email: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email }, coupon: { id: coupon.id } },
743
+ ])).pipe(operators.map(function (subscriptions) { return ({ coupon: coupon, subscriptions: subscriptions }); }));
744
+ })).pipe(operators.map(function (results) { return results.map(function (_b) {
745
+ var coupon = _b.coupon, subscriptions = _b.subscriptions;
746
+ if (subscriptions.data.length >= (coupon.useLimit || Infinity))
747
+ return new InvalidCouponError('Coupon is already applied');
748
+ return coupon;
749
+ }); }), operators.map(function (validatedCoupons) { return ({
750
+ valids: validatedCoupons.filter(function (coupon) { return i2.FinancialCoupon.isFinancialCoupon(coupon); }),
751
+ invalids: validatedCoupons.filter(function (coupon) { return coupon instanceof InvalidCouponError; }),
752
+ }); }), operators.concatMap(function (_b) {
753
+ var valids = _b.valids, invalids = _b.invalids;
754
+ return valids.length ? rxjs.of(valids) : rxjs.throwError(new GroupInvalidCouponError(invalids));
755
+ })); };
756
+ }
757
+ CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
758
+ var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
759
+ if (!i2.isNil(checkoutId))
760
+ return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
761
+ return rxjs.from(this.createCheckoutSubscription(checkoutData));
762
+ };
763
+ CheckoutSubscriptionService.prototype.createCheckoutSubscription = function (checkoutData) {
764
+ return __awaiter(this, void 0, void 0, function () {
765
+ var checkout;
766
+ return __generator(this, function (_b) {
767
+ switch (_b.label) {
768
+ case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i2.CheckoutSubscription.toInstance(i2.pick(checkoutData, ['user', 'shop'])).toPlain()))];
769
+ case 1:
770
+ checkout = _b.sent();
771
+ cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
772
+ return [2 /*return*/, checkout];
773
+ }
774
+ });
775
+ });
776
+ };
777
+ CheckoutSubscriptionService.prototype.clearCheckoutSubscriptionFromSession = function () {
778
+ cookie__default["default"].remove('checkoutSubscriptionId');
779
+ return rxjs.of();
780
+ };
781
+ CheckoutSubscriptionService.prototype.checkCoupon = function (nickname, userEmail) {
782
+ var _this = this;
783
+ return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService.checkCoupon(nickname, userEmail, i2.CheckoutTypes.SUBSCRIPTION).pipe(operators.concatMap(function (coupons) {
784
+ var couponsWithSamePlan = coupons.filter(function (coupon) { return checkout.subscriptionPlan.name === coupon.plan; });
785
+ var couponsWithNoPlan = coupons.filter(function (coupon) { return !coupon.plan; });
786
+ if (couponsWithSamePlan.length > 0)
787
+ return rxjs.of(couponsWithSamePlan);
788
+ if (couponsWithNoPlan.length > 0)
789
+ return rxjs.of(couponsWithNoPlan);
790
+ throw new Error("Coupon subscription plan is invalid.");
791
+ }), operators.concatMap(function (coupons) { var _a; return !!((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email) ? _this.checkCouponsWithCheckout(coupons, checkout) : rxjs.of(coupons); }), operators.map(function (validatedCoupons) { return validatedCoupons.shift(); })); }));
792
+ };
793
+ return CheckoutSubscriptionService;
794
+ }());
795
+ CheckoutSubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: CouponService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
796
+ CheckoutSubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService });
797
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, decorators: [{
798
+ type: i0.Injectable
799
+ }], ctorParameters: function () {
800
+ return [{ type: undefined, decorators: [{
801
+ type: i0.Inject,
802
+ args: ['CheckoutSubscriptionRepository']
803
+ }] }, { type: CouponService }];
797
804
  } });
798
805
 
799
- var OrderService = /** @class */ (function () {
800
- function OrderService(angularFirestore, orderRepository) {
801
- this.angularFirestore = angularFirestore;
802
- this.orderRepository = orderRepository;
803
- this.orderSubject = new rxjs.Subject();
804
- }
805
- OrderService.prototype.getOrder = function (id) {
806
- var _this = this;
807
- this.angularFirestore
808
- .doc(this.orderRepository.collectionName + "/" + id)
809
- .valueChanges()
810
- .pipe(operators.map(function (doc) { return i1$1.Order.toInstance(doc); }))
811
- .subscribe(function (doc) { return _this.orderSubject.next(doc); });
812
- return this.orderSubject;
813
- };
814
- return OrderService;
815
- }());
816
- OrderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, deps: [{ token: i1__namespace$2.AngularFirestore }, { token: 'OrderRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
817
- OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
818
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
819
- type: i0.Injectable
820
- }], ctorParameters: function () {
821
- return [{ type: i1__namespace$2.AngularFirestore }, { type: i1__namespace$1.OrderFirestoreRepository, decorators: [{
822
- type: i0.Inject,
823
- args: ['OrderRepository']
824
- }] }];
806
+ var OrderService = /** @class */ (function () {
807
+ function OrderService(angularFirestore, orderRepository) {
808
+ this.angularFirestore = angularFirestore;
809
+ this.orderRepository = orderRepository;
810
+ this.orderSubject = new rxjs.Subject();
811
+ }
812
+ OrderService.prototype.getOrder = function (id) {
813
+ var _this = this;
814
+ this.angularFirestore
815
+ .doc(this.orderRepository.collectionName + "/" + id)
816
+ .valueChanges()
817
+ .pipe(operators.map(function (doc) { return i2.Order.toInstance(doc); }))
818
+ .subscribe(function (doc) { return _this.orderSubject.next(doc); });
819
+ return this.orderSubject;
820
+ };
821
+ return OrderService;
822
+ }());
823
+ OrderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, deps: [{ token: i1__namespace$1.AngularFirestore }, { token: 'OrderRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
824
+ OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
825
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
826
+ type: i0.Injectable
827
+ }], ctorParameters: function () {
828
+ return [{ type: i1__namespace$1.AngularFirestore }, { type: i2__namespace.OrderFirestoreRepository, decorators: [{
829
+ type: i0.Inject,
830
+ args: ['OrderRepository']
831
+ }] }];
825
832
  } });
826
833
 
827
- var AngularFirebaseAuthModule = /** @class */ (function () {
828
- function AngularFirebaseAuthModule() {
829
- }
830
- AngularFirebaseAuthModule.initializeApp = function (options, nameOrConfig) {
831
- return {
832
- ngModule: AngularFirebaseAuthModule,
833
- providers: [
834
- { provide: fire.FIREBASE_OPTIONS, useValue: options },
835
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
836
- ],
837
- };
838
- };
839
- return AngularFirebaseAuthModule;
840
- }());
841
- AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
842
- AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [fire.AngularFireModule] });
843
- AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
844
- {
845
- provide: 'Authentication',
846
- useFactory: function (authenticationService, userRepository) {
847
- return new i1$1.Authentication(authenticationService, userRepository);
848
- },
849
- deps: ['AuthenticationService', 'UserRepository'],
850
- },
851
- {
852
- provide: 'AuthenticationService',
853
- useFactory: function (angularFireAuth) {
854
- return new i1$1.AuthenticationFirebaseAuthService(angularFireAuth);
855
- },
856
- deps: [i1.AngularFireAuth],
857
- },
858
- {
859
- provide: 'Register',
860
- useFactory: function (registerService, userRepository) {
861
- return new i1$1.Register(registerService, userRepository);
862
- },
863
- deps: ['RegisterService', 'UserRepository'],
864
- },
865
- {
866
- provide: 'RegisterService',
867
- useFactory: function (angularFireAuth) {
868
- return new i1$1.RegisterFirebaseAuthService(angularFireAuth);
869
- },
870
- deps: [i1.AngularFireAuth],
871
- },
872
- {
873
- provide: 'SignOut',
874
- useFactory: function (authenticationService) {
875
- return new i1$1.SignOut(authenticationService);
876
- },
877
- deps: ['AuthenticationService'],
878
- },
879
- {
880
- provide: 'RecoveryPassword',
881
- useFactory: function (authenticationService) {
882
- return new i1$1.RecoveryPassword(authenticationService);
883
- },
884
- deps: ['AuthenticationService'],
885
- },
886
- ], imports: [[fire.AngularFireModule]] });
887
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
888
- type: i0.NgModule,
889
- args: [{
890
- imports: [fire.AngularFireModule],
891
- providers: [
892
- {
893
- provide: 'Authentication',
894
- useFactory: function (authenticationService, userRepository) {
895
- return new i1$1.Authentication(authenticationService, userRepository);
896
- },
897
- deps: ['AuthenticationService', 'UserRepository'],
898
- },
899
- {
900
- provide: 'AuthenticationService',
901
- useFactory: function (angularFireAuth) {
902
- return new i1$1.AuthenticationFirebaseAuthService(angularFireAuth);
903
- },
904
- deps: [i1.AngularFireAuth],
905
- },
906
- {
907
- provide: 'Register',
908
- useFactory: function (registerService, userRepository) {
909
- return new i1$1.Register(registerService, userRepository);
910
- },
911
- deps: ['RegisterService', 'UserRepository'],
912
- },
913
- {
914
- provide: 'RegisterService',
915
- useFactory: function (angularFireAuth) {
916
- return new i1$1.RegisterFirebaseAuthService(angularFireAuth);
917
- },
918
- deps: [i1.AngularFireAuth],
919
- },
920
- {
921
- provide: 'SignOut',
922
- useFactory: function (authenticationService) {
923
- return new i1$1.SignOut(authenticationService);
924
- },
925
- deps: ['AuthenticationService'],
926
- },
927
- {
928
- provide: 'RecoveryPassword',
929
- useFactory: function (authenticationService) {
930
- return new i1$1.RecoveryPassword(authenticationService);
931
- },
932
- deps: ['AuthenticationService'],
933
- },
934
- ],
935
- }]
834
+ var AngularFirebaseAuthModule = /** @class */ (function () {
835
+ function AngularFirebaseAuthModule() {
836
+ }
837
+ AngularFirebaseAuthModule.initializeApp = function (options, nameOrConfig) {
838
+ return {
839
+ ngModule: AngularFirebaseAuthModule,
840
+ providers: [
841
+ { provide: fire.FIREBASE_OPTIONS, useValue: options },
842
+ { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
843
+ ],
844
+ };
845
+ };
846
+ return AngularFirebaseAuthModule;
847
+ }());
848
+ AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
849
+ AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [fire.AngularFireModule] });
850
+ AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
851
+ {
852
+ provide: 'Authentication',
853
+ useFactory: function (authenticationService, userRepository) {
854
+ return new i2.Authentication(authenticationService, userRepository);
855
+ },
856
+ deps: ['AuthenticationService', 'UserRepository'],
857
+ },
858
+ {
859
+ provide: 'AuthenticationService',
860
+ useFactory: function (angularFireAuth) {
861
+ return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
862
+ },
863
+ deps: [i1.AngularFireAuth],
864
+ },
865
+ {
866
+ provide: 'Register',
867
+ useFactory: function (registerService, userRepository) {
868
+ return new i2.Register(registerService, userRepository);
869
+ },
870
+ deps: ['RegisterService', 'UserRepository'],
871
+ },
872
+ {
873
+ provide: 'RegisterService',
874
+ useFactory: function (angularFireAuth) {
875
+ return new i2.RegisterFirebaseAuthService(angularFireAuth);
876
+ },
877
+ deps: [i1.AngularFireAuth],
878
+ },
879
+ {
880
+ provide: 'SignOut',
881
+ useFactory: function (authenticationService) {
882
+ return new i2.SignOut(authenticationService);
883
+ },
884
+ deps: ['AuthenticationService'],
885
+ },
886
+ {
887
+ provide: 'RecoveryPassword',
888
+ useFactory: function (authenticationService) {
889
+ return new i2.RecoveryPassword(authenticationService);
890
+ },
891
+ deps: ['AuthenticationService'],
892
+ },
893
+ ], imports: [[fire.AngularFireModule]] });
894
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
895
+ type: i0.NgModule,
896
+ args: [{
897
+ imports: [fire.AngularFireModule],
898
+ providers: [
899
+ {
900
+ provide: 'Authentication',
901
+ useFactory: function (authenticationService, userRepository) {
902
+ return new i2.Authentication(authenticationService, userRepository);
903
+ },
904
+ deps: ['AuthenticationService', 'UserRepository'],
905
+ },
906
+ {
907
+ provide: 'AuthenticationService',
908
+ useFactory: function (angularFireAuth) {
909
+ return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
910
+ },
911
+ deps: [i1.AngularFireAuth],
912
+ },
913
+ {
914
+ provide: 'Register',
915
+ useFactory: function (registerService, userRepository) {
916
+ return new i2.Register(registerService, userRepository);
917
+ },
918
+ deps: ['RegisterService', 'UserRepository'],
919
+ },
920
+ {
921
+ provide: 'RegisterService',
922
+ useFactory: function (angularFireAuth) {
923
+ return new i2.RegisterFirebaseAuthService(angularFireAuth);
924
+ },
925
+ deps: [i1.AngularFireAuth],
926
+ },
927
+ {
928
+ provide: 'SignOut',
929
+ useFactory: function (authenticationService) {
930
+ return new i2.SignOut(authenticationService);
931
+ },
932
+ deps: ['AuthenticationService'],
933
+ },
934
+ {
935
+ provide: 'RecoveryPassword',
936
+ useFactory: function (authenticationService) {
937
+ return new i2.RecoveryPassword(authenticationService);
938
+ },
939
+ deps: ['AuthenticationService'],
940
+ },
941
+ ],
942
+ }]
936
943
  }] });
937
944
 
938
- var AngularFirestoreModule = /** @class */ (function () {
939
- function AngularFirestoreModule() {
940
- }
941
- AngularFirestoreModule.initializeApp = function (options, nameOrConfig) {
942
- return {
943
- ngModule: AngularFirestoreModule,
944
- providers: [
945
- { provide: fire.FIREBASE_OPTIONS, useValue: options },
946
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
947
- ],
948
- };
949
- };
950
- return AngularFirestoreModule;
951
- }());
952
- AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
953
- AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, imports: [fire.AngularFireModule] });
954
- AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
955
- {
956
- provide: 'BeautyProfileRepository',
957
- useFactory: function (firestore, userRepository) {
958
- return new i1$1.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
959
- },
960
- deps: [i1$2.AngularFirestore, 'UserRepository'],
961
- },
962
- {
963
- provide: 'Buy2WinRepository',
964
- useFactory: function (firestore) {
965
- return new i1$1.Buy2WinFirestoreRepository(firestore.firestore);
966
- },
967
- deps: [i1$2.AngularFirestore],
968
- },
969
- {
970
- provide: 'CategoryRepository',
971
- useFactory: function (firestore) {
972
- return new i1$1.CategoryFirestoreRepository(firestore.firestore);
973
- },
974
- deps: [i1$2.AngularFirestore],
975
- },
976
- {
977
- provide: 'CheckoutRepository',
978
- useFactory: function (firestore) {
979
- return new i1$1.CheckoutFirestoreRepository(firestore.firestore);
980
- },
981
- deps: [i1$2.AngularFirestore],
982
- },
983
- {
984
- provide: 'CheckoutSubscriptionRepository',
985
- useFactory: function (firestore) {
986
- return new i1$1.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
987
- },
988
- deps: [i1$2.AngularFirestore],
989
- },
990
- {
991
- provide: 'CouponRepository',
992
- useFactory: function (firestore) {
993
- return new i1$1.CouponFirestoreRepository(firestore.firestore);
994
- },
995
- deps: [i1$2.AngularFirestore],
996
- },
997
- {
998
- provide: 'EditionRepository',
999
- useFactory: function (firestore, subscriptionRepository) {
1000
- return new i1$1.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1001
- },
1002
- deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
1003
- },
1004
- {
1005
- provide: 'HomeRepository',
1006
- useFactory: function (firestore) {
1007
- return new i1$1.HomeFirestoreRepository(firestore.firestore);
1008
- },
1009
- deps: [i1$2.AngularFirestore],
1010
- },
1011
- {
1012
- provide: 'LeadRepository',
1013
- useFactory: function (firestore) {
1014
- return new i1$1.LeadFirestoreRepository(firestore.firestore);
1015
- },
1016
- deps: [i1$2.AngularFirestore],
1017
- },
1018
- {
1019
- provide: 'LegacyOrderRepository',
1020
- useFactory: function (firestore) {
1021
- return new i1$1.LegacyOrderFirestoreRepository(firestore.firestore);
1022
- },
1023
- deps: [i1$2.AngularFirestore],
1024
- },
1025
- {
1026
- provide: 'ShopMenuRepository',
1027
- useFactory: function (firestore) {
1028
- return new i1$1.ShopMenuFirestoreRepository(firestore.firestore);
1029
- },
1030
- deps: [i1$2.AngularFirestore],
1031
- },
1032
- {
1033
- provide: 'OrderRepository',
1034
- useFactory: function (firestore) {
1035
- return new i1$1.OrderFirestoreRepository(firestore.firestore);
1036
- },
1037
- deps: [i1$2.AngularFirestore],
1038
- },
1039
- {
1040
- provide: 'PaymentRepository',
1041
- useFactory: function (firestore) {
1042
- return new i1$1.PaymentFirestoreRepository(firestore.firestore);
1043
- },
1044
- deps: [i1$2.AngularFirestore],
1045
- },
1046
- {
1047
- provide: 'ProductRepository',
1048
- useFactory: function (firestore) {
1049
- return new i1$1.ProductFirestoreRepository(firestore.firestore);
1050
- },
1051
- deps: [i1$2.AngularFirestore],
1052
- },
1053
- {
1054
- provide: 'SubscriptionPaymentRepository',
1055
- useFactory: function (firestore, subscriptionRepository) {
1056
- return new i1$1.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1057
- },
1058
- deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
1059
- },
1060
- {
1061
- provide: 'SubscriptionPlanRepository',
1062
- useFactory: function (firestore) {
1063
- return new i1$1.SubscriptionPlanFirestoreRepository(firestore.firestore);
1064
- },
1065
- deps: [i1$2.AngularFirestore],
1066
- },
1067
- {
1068
- provide: 'SubscriptionProductRepository',
1069
- useFactory: function (firestore) {
1070
- return new i1$1.SubscriptionProductFirestoreRepository(firestore.firestore);
1071
- },
1072
- deps: [i1$2.AngularFirestore],
1073
- },
1074
- {
1075
- provide: 'SubscriptionRepository',
1076
- useFactory: function (firestore) {
1077
- return new i1$1.SubscriptionFirestoreRepository(firestore.firestore);
1078
- },
1079
- deps: [i1$2.AngularFirestore],
1080
- },
1081
- {
1082
- provide: 'UserRepository',
1083
- useFactory: function (firestore) {
1084
- return new i1$1.UserFirestoreRepository(firestore.firestore);
1085
- },
1086
- deps: [i1$2.AngularFirestore],
1087
- },
1088
- {
1089
- provide: 'UserAddressRepository',
1090
- useFactory: function (firestore, userRepository) {
1091
- return new i1$1.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1092
- },
1093
- deps: [i1$2.AngularFirestore, 'UserRepository'],
1094
- },
1095
- {
1096
- provide: 'UserPaymentMethodRepository',
1097
- useFactory: function (firestore, userRepository) {
1098
- return new i1$1.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1099
- },
1100
- deps: [i1$2.AngularFirestore, 'UserRepository'],
1101
- },
1102
- {
1103
- provide: 'VariantRepository',
1104
- useFactory: function (firestore, productRepository) {
1105
- return new i1$1.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1106
- },
1107
- deps: [i1$2.AngularFirestore, 'ProductRepository'],
1108
- },
1109
- ], imports: [[fire.AngularFireModule]] });
1110
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
1111
- type: i0.NgModule,
1112
- args: [{
1113
- imports: [fire.AngularFireModule],
1114
- providers: [
1115
- {
1116
- provide: 'BeautyProfileRepository',
1117
- useFactory: function (firestore, userRepository) {
1118
- return new i1$1.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1119
- },
1120
- deps: [i1$2.AngularFirestore, 'UserRepository'],
1121
- },
1122
- {
1123
- provide: 'Buy2WinRepository',
1124
- useFactory: function (firestore) {
1125
- return new i1$1.Buy2WinFirestoreRepository(firestore.firestore);
1126
- },
1127
- deps: [i1$2.AngularFirestore],
1128
- },
1129
- {
1130
- provide: 'CategoryRepository',
1131
- useFactory: function (firestore) {
1132
- return new i1$1.CategoryFirestoreRepository(firestore.firestore);
1133
- },
1134
- deps: [i1$2.AngularFirestore],
1135
- },
1136
- {
1137
- provide: 'CheckoutRepository',
1138
- useFactory: function (firestore) {
1139
- return new i1$1.CheckoutFirestoreRepository(firestore.firestore);
1140
- },
1141
- deps: [i1$2.AngularFirestore],
1142
- },
1143
- {
1144
- provide: 'CheckoutSubscriptionRepository',
1145
- useFactory: function (firestore) {
1146
- return new i1$1.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1147
- },
1148
- deps: [i1$2.AngularFirestore],
1149
- },
1150
- {
1151
- provide: 'CouponRepository',
1152
- useFactory: function (firestore) {
1153
- return new i1$1.CouponFirestoreRepository(firestore.firestore);
1154
- },
1155
- deps: [i1$2.AngularFirestore],
1156
- },
1157
- {
1158
- provide: 'EditionRepository',
1159
- useFactory: function (firestore, subscriptionRepository) {
1160
- return new i1$1.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1161
- },
1162
- deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
1163
- },
1164
- {
1165
- provide: 'HomeRepository',
1166
- useFactory: function (firestore) {
1167
- return new i1$1.HomeFirestoreRepository(firestore.firestore);
1168
- },
1169
- deps: [i1$2.AngularFirestore],
1170
- },
1171
- {
1172
- provide: 'LeadRepository',
1173
- useFactory: function (firestore) {
1174
- return new i1$1.LeadFirestoreRepository(firestore.firestore);
1175
- },
1176
- deps: [i1$2.AngularFirestore],
1177
- },
1178
- {
1179
- provide: 'LegacyOrderRepository',
1180
- useFactory: function (firestore) {
1181
- return new i1$1.LegacyOrderFirestoreRepository(firestore.firestore);
1182
- },
1183
- deps: [i1$2.AngularFirestore],
1184
- },
1185
- {
1186
- provide: 'ShopMenuRepository',
1187
- useFactory: function (firestore) {
1188
- return new i1$1.ShopMenuFirestoreRepository(firestore.firestore);
1189
- },
1190
- deps: [i1$2.AngularFirestore],
1191
- },
1192
- {
1193
- provide: 'OrderRepository',
1194
- useFactory: function (firestore) {
1195
- return new i1$1.OrderFirestoreRepository(firestore.firestore);
1196
- },
1197
- deps: [i1$2.AngularFirestore],
1198
- },
1199
- {
1200
- provide: 'PaymentRepository',
1201
- useFactory: function (firestore) {
1202
- return new i1$1.PaymentFirestoreRepository(firestore.firestore);
1203
- },
1204
- deps: [i1$2.AngularFirestore],
1205
- },
1206
- {
1207
- provide: 'ProductRepository',
1208
- useFactory: function (firestore) {
1209
- return new i1$1.ProductFirestoreRepository(firestore.firestore);
1210
- },
1211
- deps: [i1$2.AngularFirestore],
1212
- },
1213
- {
1214
- provide: 'SubscriptionPaymentRepository',
1215
- useFactory: function (firestore, subscriptionRepository) {
1216
- return new i1$1.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1217
- },
1218
- deps: [i1$2.AngularFirestore, 'SubscriptionRepository'],
1219
- },
1220
- {
1221
- provide: 'SubscriptionPlanRepository',
1222
- useFactory: function (firestore) {
1223
- return new i1$1.SubscriptionPlanFirestoreRepository(firestore.firestore);
1224
- },
1225
- deps: [i1$2.AngularFirestore],
1226
- },
1227
- {
1228
- provide: 'SubscriptionProductRepository',
1229
- useFactory: function (firestore) {
1230
- return new i1$1.SubscriptionProductFirestoreRepository(firestore.firestore);
1231
- },
1232
- deps: [i1$2.AngularFirestore],
1233
- },
1234
- {
1235
- provide: 'SubscriptionRepository',
1236
- useFactory: function (firestore) {
1237
- return new i1$1.SubscriptionFirestoreRepository(firestore.firestore);
1238
- },
1239
- deps: [i1$2.AngularFirestore],
1240
- },
1241
- {
1242
- provide: 'UserRepository',
1243
- useFactory: function (firestore) {
1244
- return new i1$1.UserFirestoreRepository(firestore.firestore);
1245
- },
1246
- deps: [i1$2.AngularFirestore],
1247
- },
1248
- {
1249
- provide: 'UserAddressRepository',
1250
- useFactory: function (firestore, userRepository) {
1251
- return new i1$1.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1252
- },
1253
- deps: [i1$2.AngularFirestore, 'UserRepository'],
1254
- },
1255
- {
1256
- provide: 'UserPaymentMethodRepository',
1257
- useFactory: function (firestore, userRepository) {
1258
- return new i1$1.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1259
- },
1260
- deps: [i1$2.AngularFirestore, 'UserRepository'],
1261
- },
1262
- {
1263
- provide: 'VariantRepository',
1264
- useFactory: function (firestore, productRepository) {
1265
- return new i1$1.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1266
- },
1267
- deps: [i1$2.AngularFirestore, 'ProductRepository'],
1268
- },
1269
- ],
1270
- }]
945
+ var AngularFirestoreModule = /** @class */ (function () {
946
+ function AngularFirestoreModule() {
947
+ }
948
+ AngularFirestoreModule.initializeApp = function (options, nameOrConfig) {
949
+ return {
950
+ ngModule: AngularFirestoreModule,
951
+ providers: [
952
+ { provide: fire.FIREBASE_OPTIONS, useValue: options },
953
+ { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
954
+ ],
955
+ };
956
+ };
957
+ return AngularFirestoreModule;
958
+ }());
959
+ AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
960
+ AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, imports: [fire.AngularFireModule] });
961
+ AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
962
+ {
963
+ provide: 'BeautyProfileRepository',
964
+ useFactory: function (firestore, userRepository) {
965
+ return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
966
+ },
967
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
968
+ },
969
+ {
970
+ provide: 'Buy2WinRepository',
971
+ useFactory: function (firestore) {
972
+ return new i2.Buy2WinFirestoreRepository(firestore.firestore);
973
+ },
974
+ deps: [i1$1.AngularFirestore],
975
+ },
976
+ {
977
+ provide: 'CategoryRepository',
978
+ useFactory: function (firestore) {
979
+ return new i2.CategoryFirestoreRepository(firestore.firestore);
980
+ },
981
+ deps: [i1$1.AngularFirestore],
982
+ },
983
+ {
984
+ provide: 'CheckoutRepository',
985
+ useFactory: function (firestore) {
986
+ return new i2.CheckoutFirestoreRepository(firestore.firestore);
987
+ },
988
+ deps: [i1$1.AngularFirestore],
989
+ },
990
+ {
991
+ provide: 'CheckoutSubscriptionRepository',
992
+ useFactory: function (firestore) {
993
+ return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
994
+ },
995
+ deps: [i1$1.AngularFirestore],
996
+ },
997
+ {
998
+ provide: 'CouponRepository',
999
+ useFactory: function (firestore) {
1000
+ return new i2.CouponFirestoreRepository(firestore.firestore);
1001
+ },
1002
+ deps: [i1$1.AngularFirestore],
1003
+ },
1004
+ {
1005
+ provide: 'EditionRepository',
1006
+ useFactory: function (firestore, subscriptionRepository) {
1007
+ return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1008
+ },
1009
+ deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1010
+ },
1011
+ {
1012
+ provide: 'HomeRepository',
1013
+ useFactory: function (firestore) {
1014
+ return new i2.HomeFirestoreRepository(firestore.firestore);
1015
+ },
1016
+ deps: [i1$1.AngularFirestore],
1017
+ },
1018
+ {
1019
+ provide: 'LeadRepository',
1020
+ useFactory: function (firestore) {
1021
+ return new i2.LeadFirestoreRepository(firestore.firestore);
1022
+ },
1023
+ deps: [i1$1.AngularFirestore],
1024
+ },
1025
+ {
1026
+ provide: 'LegacyOrderRepository',
1027
+ useFactory: function (firestore) {
1028
+ return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
1029
+ },
1030
+ deps: [i1$1.AngularFirestore],
1031
+ },
1032
+ {
1033
+ provide: 'ShopMenuRepository',
1034
+ useFactory: function (firestore) {
1035
+ return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1036
+ },
1037
+ deps: [i1$1.AngularFirestore],
1038
+ },
1039
+ {
1040
+ provide: 'OrderRepository',
1041
+ useFactory: function (firestore) {
1042
+ return new i2.OrderFirestoreRepository(firestore.firestore);
1043
+ },
1044
+ deps: [i1$1.AngularFirestore],
1045
+ },
1046
+ {
1047
+ provide: 'PaymentRepository',
1048
+ useFactory: function (firestore) {
1049
+ return new i2.PaymentFirestoreRepository(firestore.firestore);
1050
+ },
1051
+ deps: [i1$1.AngularFirestore],
1052
+ },
1053
+ {
1054
+ provide: 'ProductRepository',
1055
+ useFactory: function (firestore) {
1056
+ return new i2.ProductFirestoreRepository(firestore.firestore);
1057
+ },
1058
+ deps: [i1$1.AngularFirestore],
1059
+ },
1060
+ {
1061
+ provide: 'SubscriptionPaymentRepository',
1062
+ useFactory: function (firestore, subscriptionRepository) {
1063
+ return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1064
+ },
1065
+ deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1066
+ },
1067
+ {
1068
+ provide: 'SubscriptionPlanRepository',
1069
+ useFactory: function (firestore) {
1070
+ return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1071
+ },
1072
+ deps: [i1$1.AngularFirestore],
1073
+ },
1074
+ {
1075
+ provide: 'SubscriptionProductRepository',
1076
+ useFactory: function (firestore) {
1077
+ return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1078
+ },
1079
+ deps: [i1$1.AngularFirestore],
1080
+ },
1081
+ {
1082
+ provide: 'SubscriptionRepository',
1083
+ useFactory: function (firestore) {
1084
+ return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1085
+ },
1086
+ deps: [i1$1.AngularFirestore],
1087
+ },
1088
+ {
1089
+ provide: 'UserRepository',
1090
+ useFactory: function (firestore) {
1091
+ return new i2.UserFirestoreRepository(firestore.firestore);
1092
+ },
1093
+ deps: [i1$1.AngularFirestore],
1094
+ },
1095
+ {
1096
+ provide: 'UserAddressRepository',
1097
+ useFactory: function (firestore, userRepository) {
1098
+ return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1099
+ },
1100
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
1101
+ },
1102
+ {
1103
+ provide: 'UserPaymentMethodRepository',
1104
+ useFactory: function (firestore, userRepository) {
1105
+ return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1106
+ },
1107
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
1108
+ },
1109
+ {
1110
+ provide: 'VariantRepository',
1111
+ useFactory: function (firestore, productRepository) {
1112
+ return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1113
+ },
1114
+ deps: [i1$1.AngularFirestore, 'ProductRepository'],
1115
+ },
1116
+ ], imports: [[fire.AngularFireModule]] });
1117
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
1118
+ type: i0.NgModule,
1119
+ args: [{
1120
+ imports: [fire.AngularFireModule],
1121
+ providers: [
1122
+ {
1123
+ provide: 'BeautyProfileRepository',
1124
+ useFactory: function (firestore, userRepository) {
1125
+ return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1126
+ },
1127
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
1128
+ },
1129
+ {
1130
+ provide: 'Buy2WinRepository',
1131
+ useFactory: function (firestore) {
1132
+ return new i2.Buy2WinFirestoreRepository(firestore.firestore);
1133
+ },
1134
+ deps: [i1$1.AngularFirestore],
1135
+ },
1136
+ {
1137
+ provide: 'CategoryRepository',
1138
+ useFactory: function (firestore) {
1139
+ return new i2.CategoryFirestoreRepository(firestore.firestore);
1140
+ },
1141
+ deps: [i1$1.AngularFirestore],
1142
+ },
1143
+ {
1144
+ provide: 'CheckoutRepository',
1145
+ useFactory: function (firestore) {
1146
+ return new i2.CheckoutFirestoreRepository(firestore.firestore);
1147
+ },
1148
+ deps: [i1$1.AngularFirestore],
1149
+ },
1150
+ {
1151
+ provide: 'CheckoutSubscriptionRepository',
1152
+ useFactory: function (firestore) {
1153
+ return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1154
+ },
1155
+ deps: [i1$1.AngularFirestore],
1156
+ },
1157
+ {
1158
+ provide: 'CouponRepository',
1159
+ useFactory: function (firestore) {
1160
+ return new i2.CouponFirestoreRepository(firestore.firestore);
1161
+ },
1162
+ deps: [i1$1.AngularFirestore],
1163
+ },
1164
+ {
1165
+ provide: 'EditionRepository',
1166
+ useFactory: function (firestore, subscriptionRepository) {
1167
+ return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1168
+ },
1169
+ deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1170
+ },
1171
+ {
1172
+ provide: 'HomeRepository',
1173
+ useFactory: function (firestore) {
1174
+ return new i2.HomeFirestoreRepository(firestore.firestore);
1175
+ },
1176
+ deps: [i1$1.AngularFirestore],
1177
+ },
1178
+ {
1179
+ provide: 'LeadRepository',
1180
+ useFactory: function (firestore) {
1181
+ return new i2.LeadFirestoreRepository(firestore.firestore);
1182
+ },
1183
+ deps: [i1$1.AngularFirestore],
1184
+ },
1185
+ {
1186
+ provide: 'LegacyOrderRepository',
1187
+ useFactory: function (firestore) {
1188
+ return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
1189
+ },
1190
+ deps: [i1$1.AngularFirestore],
1191
+ },
1192
+ {
1193
+ provide: 'ShopMenuRepository',
1194
+ useFactory: function (firestore) {
1195
+ return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1196
+ },
1197
+ deps: [i1$1.AngularFirestore],
1198
+ },
1199
+ {
1200
+ provide: 'OrderRepository',
1201
+ useFactory: function (firestore) {
1202
+ return new i2.OrderFirestoreRepository(firestore.firestore);
1203
+ },
1204
+ deps: [i1$1.AngularFirestore],
1205
+ },
1206
+ {
1207
+ provide: 'PaymentRepository',
1208
+ useFactory: function (firestore) {
1209
+ return new i2.PaymentFirestoreRepository(firestore.firestore);
1210
+ },
1211
+ deps: [i1$1.AngularFirestore],
1212
+ },
1213
+ {
1214
+ provide: 'ProductRepository',
1215
+ useFactory: function (firestore) {
1216
+ return new i2.ProductFirestoreRepository(firestore.firestore);
1217
+ },
1218
+ deps: [i1$1.AngularFirestore],
1219
+ },
1220
+ {
1221
+ provide: 'SubscriptionPaymentRepository',
1222
+ useFactory: function (firestore, subscriptionRepository) {
1223
+ return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1224
+ },
1225
+ deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1226
+ },
1227
+ {
1228
+ provide: 'SubscriptionPlanRepository',
1229
+ useFactory: function (firestore) {
1230
+ return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1231
+ },
1232
+ deps: [i1$1.AngularFirestore],
1233
+ },
1234
+ {
1235
+ provide: 'SubscriptionProductRepository',
1236
+ useFactory: function (firestore) {
1237
+ return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1238
+ },
1239
+ deps: [i1$1.AngularFirestore],
1240
+ },
1241
+ {
1242
+ provide: 'SubscriptionRepository',
1243
+ useFactory: function (firestore) {
1244
+ return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1245
+ },
1246
+ deps: [i1$1.AngularFirestore],
1247
+ },
1248
+ {
1249
+ provide: 'UserRepository',
1250
+ useFactory: function (firestore) {
1251
+ return new i2.UserFirestoreRepository(firestore.firestore);
1252
+ },
1253
+ deps: [i1$1.AngularFirestore],
1254
+ },
1255
+ {
1256
+ provide: 'UserAddressRepository',
1257
+ useFactory: function (firestore, userRepository) {
1258
+ return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1259
+ },
1260
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
1261
+ },
1262
+ {
1263
+ provide: 'UserPaymentMethodRepository',
1264
+ useFactory: function (firestore, userRepository) {
1265
+ return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1266
+ },
1267
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
1268
+ },
1269
+ {
1270
+ provide: 'VariantRepository',
1271
+ useFactory: function (firestore, productRepository) {
1272
+ return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1273
+ },
1274
+ deps: [i1$1.AngularFirestore, 'ProductRepository'],
1275
+ },
1276
+ ],
1277
+ }]
1271
1278
  }] });
1272
1279
 
1273
- var AngularConnectModule = /** @class */ (function () {
1274
- function AngularConnectModule() {
1275
- }
1276
- AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
1277
- return {
1278
- ngModule: AngularConnectModule,
1279
- providers: __spreadArray(__spreadArray(__spreadArray([], __read((i1$1.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i1$1.isNil(options) ? [] : [{ provide: fire.FIREBASE_OPTIONS, useValue: options }]))), __read((i1$1.isNil(options) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))),
1280
- };
1281
- };
1282
- return AngularConnectModule;
1283
- }());
1284
- AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1285
- AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule] });
1286
- AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, OrderService], imports: [[fire.AngularFireModule, AngularFirestoreModule]] });
1287
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
1288
- type: i0.NgModule,
1289
- args: [{
1290
- imports: [fire.AngularFireModule, AngularFirestoreModule],
1291
- providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, OrderService],
1292
- }]
1280
+ var AngularConnectModule = /** @class */ (function () {
1281
+ function AngularConnectModule() {
1282
+ }
1283
+ AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
1284
+ return {
1285
+ ngModule: AngularConnectModule,
1286
+ providers: __spreadArray(__spreadArray(__spreadArray([], __read((i2.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i2.isNil(options) ? [] : [{ provide: fire.FIREBASE_OPTIONS, useValue: options }]))), __read((i2.isNil(options) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))),
1287
+ };
1288
+ };
1289
+ return AngularConnectModule;
1290
+ }());
1291
+ AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1292
+ AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule] });
1293
+ AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, OrderService], imports: [[fire.AngularFireModule, AngularFirestoreModule]] });
1294
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
1295
+ type: i0.NgModule,
1296
+ args: [{
1297
+ imports: [fire.AngularFireModule, AngularFirestoreModule],
1298
+ providers: [AuthService, CartService, CheckoutService, CheckoutSubscriptionService, CouponService, OrderService],
1299
+ }]
1293
1300
  }] });
1294
1301
 
1295
- /**
1296
- * Generated bundle index. Do not edit.
1302
+ /**
1303
+ * Generated bundle index. Do not edit.
1297
1304
  */
1298
1305
 
1299
1306
  exports.AngularConnectModule = AngularConnectModule;