@infrab4a/connect-angular 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/bundles/infrab4a-connect-angular.umd.js +1380 -1379
  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 +46 -46
  5. package/esm2015/lib/angular-firebase-auth.module.js +113 -113
  6. package/esm2015/lib/angular-firestore.module.js +337 -337
  7. package/esm2015/lib/consts/default-shop.const.js +2 -2
  8. package/esm2015/lib/consts/index.js +2 -2
  9. package/esm2015/lib/index.js +5 -5
  10. package/esm2015/lib/services/auth.service.js +42 -42
  11. package/esm2015/lib/services/cart.service.js +166 -166
  12. package/esm2015/lib/services/checkout-subscription.service.js +68 -68
  13. package/esm2015/lib/services/checkout.service.js +79 -79
  14. package/esm2015/lib/services/coupon.service.js +70 -70
  15. package/esm2015/lib/services/errors/group-invalid-coupon.error.js +7 -7
  16. package/esm2015/lib/services/errors/index.js +3 -3
  17. package/esm2015/lib/services/errors/invalid-coupon.error.js +7 -7
  18. package/esm2015/lib/services/home-shop.service.js +107 -106
  19. package/esm2015/lib/services/index.js +8 -8
  20. package/esm2015/lib/services/order.service.js +32 -32
  21. package/esm2015/lib/services/types/index.js +3 -3
  22. package/esm2015/lib/services/types/required-checkout-data.type.js +2 -2
  23. package/esm2015/lib/services/types/required-checkout-subscription-data.type.js +2 -2
  24. package/esm2015/public-api.js +2 -2
  25. package/fesm2015/infrab4a-connect-angular.js +974 -973
  26. package/fesm2015/infrab4a-connect-angular.js.map +1 -1
  27. package/infrab4a-connect-angular.d.ts +5 -5
  28. package/lib/angular-connect.module.d.ts +12 -12
  29. package/lib/angular-firebase-auth.module.d.ts +10 -10
  30. package/lib/angular-firestore.module.d.ts +10 -10
  31. package/lib/consts/default-shop.const.d.ts +1 -1
  32. package/lib/consts/index.d.ts +1 -1
  33. package/lib/index.d.ts +4 -4
  34. package/lib/services/auth.service.d.ts +19 -19
  35. package/lib/services/cart.service.d.ts +41 -41
  36. package/lib/services/checkout-subscription.service.d.ts +18 -18
  37. package/lib/services/checkout.service.d.ts +22 -22
  38. package/lib/services/coupon.service.d.ts +14 -14
  39. package/lib/services/errors/group-invalid-coupon.error.d.ts +5 -5
  40. package/lib/services/errors/index.d.ts +2 -2
  41. package/lib/services/errors/invalid-coupon.error.d.ts +4 -4
  42. package/lib/services/home-shop.service.d.ts +24 -24
  43. package/lib/services/index.d.ts +7 -7
  44. package/lib/services/order.service.d.ts +13 -13
  45. package/lib/services/types/index.d.ts +2 -2
  46. package/lib/services/types/required-checkout-data.type.d.ts +2 -2
  47. package/lib/services/types/required-checkout-subscription-data.type.d.ts +2 -2
  48. package/package.json +1 -1
  49. package/public-api.d.ts +1 -1
@@ -30,1413 +30,1414 @@
30
30
  var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
31
31
  var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
32
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.
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;
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;
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
402
  }(Error));
403
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;
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;
412
412
  }(Error));
413
413
 
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
- }] }];
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
+ }] }];
480
480
  } });
481
481
 
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
- }] }];
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
+ }] }];
560
560
  } });
561
561
 
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
- }] }];
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
+ }] }];
732
732
  } });
733
733
 
734
- var CheckoutSubscriptionService = /** @class */ (function () {
735
- function CheckoutSubscriptionService(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
736
- var _this = this;
737
- this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
738
- this.subscriptionRepository = subscriptionRepository;
739
- this.couponService = couponService;
740
- this.checkCouponsWithCheckout = function (coupons, checkout) { return rxjs.forkJoin(coupons.map(function (coupon) {
741
- var _a;
742
- return rxjs.from(_this.subscriptionRepository.find([{ user: { email: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email }, coupon: { id: coupon.id } }])).pipe(operators.map(function (subscriptions) { return ({ coupon: coupon, subscriptions: subscriptions }); }));
743
- })).pipe(operators.map(function (results) { return results.map(function (_b) {
744
- var coupon = _b.coupon, subscriptions = _b.subscriptions;
745
- if (subscriptions.data.length >= (coupon.useLimit || Infinity))
746
- return new InvalidCouponError('Coupon is already applied');
747
- return coupon;
748
- }); }), operators.map(function (validatedCoupons) { return ({
749
- valids: validatedCoupons.filter(function (coupon) { return i2.FinancialCoupon.isFinancialCoupon(coupon); }),
750
- invalids: validatedCoupons.filter(function (coupon) { return coupon instanceof InvalidCouponError; }),
751
- }); }), operators.concatMap(function (_b) {
752
- var valids = _b.valids, invalids = _b.invalids;
753
- return valids.length ? rxjs.of(valids) : rxjs.throwError(new GroupInvalidCouponError(invalids));
754
- })); };
755
- }
756
- CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
757
- var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
758
- if (!i2.isNil(checkoutId))
759
- return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
760
- return rxjs.from(this.createCheckoutSubscription(checkoutData));
761
- };
762
- CheckoutSubscriptionService.prototype.createCheckoutSubscription = function (checkoutData) {
763
- return __awaiter(this, void 0, void 0, function () {
764
- var checkout;
765
- return __generator(this, function (_b) {
766
- switch (_b.label) {
767
- case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i2.CheckoutSubscription.toInstance(i2.pick(checkoutData, ['user', 'shop'])).toPlain()))];
768
- case 1:
769
- checkout = _b.sent();
770
- cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
771
- return [2 /*return*/, checkout];
772
- }
773
- });
774
- });
775
- };
776
- CheckoutSubscriptionService.prototype.clearCheckoutSubscriptionFromSession = function () {
777
- cookie__default["default"].remove('checkoutSubscriptionId');
778
- return rxjs.of();
779
- };
780
- CheckoutSubscriptionService.prototype.checkCoupon = function (nickname, userEmail) {
781
- var _this = this;
782
- return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService.checkCoupon(nickname, userEmail, i2.CheckoutTypes.SUBSCRIPTION).pipe(operators.concatMap(function (coupons) {
783
- var couponsWithSamePlan = coupons.filter(function (coupon) { return checkout.subscriptionPlan.name === coupon.plan; });
784
- var couponsWithNoPlan = coupons.filter(function (coupon) { return !coupon.plan; });
785
- if (couponsWithSamePlan.length > 0)
786
- return rxjs.of(couponsWithSamePlan);
787
- if (couponsWithNoPlan.length > 0)
788
- return rxjs.of(couponsWithNoPlan);
789
- throw new Error("Coupon subscription plan is invalid.");
790
- }), 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(); })); }));
791
- };
792
- return CheckoutSubscriptionService;
793
- }());
794
- CheckoutSubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: 'SubscriptionRepository' }, { token: CouponService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
795
- CheckoutSubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService });
796
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, decorators: [{
797
- type: i0.Injectable
798
- }], ctorParameters: function () {
799
- return [{ type: undefined, decorators: [{
800
- type: i0.Inject,
801
- args: ['CheckoutSubscriptionRepository']
802
- }] }, { type: undefined, decorators: [{
803
- type: i0.Inject,
804
- args: ['SubscriptionRepository']
805
- }] }, { type: CouponService }];
734
+ var CheckoutSubscriptionService = /** @class */ (function () {
735
+ function CheckoutSubscriptionService(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
736
+ var _this = this;
737
+ this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
738
+ this.subscriptionRepository = subscriptionRepository;
739
+ this.couponService = couponService;
740
+ this.checkCouponsWithCheckout = function (coupons, checkout) { return rxjs.forkJoin(coupons.map(function (coupon) {
741
+ var _a;
742
+ return rxjs.from(_this.subscriptionRepository.find([{ user: { email: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email }, coupon: { id: coupon.id } }])).pipe(operators.map(function (subscriptions) { return ({ coupon: coupon, subscriptions: subscriptions }); }));
743
+ })).pipe(operators.map(function (results) { return results.map(function (_b) {
744
+ var coupon = _b.coupon, subscriptions = _b.subscriptions;
745
+ if (subscriptions.data.length >= (coupon.useLimit || Infinity))
746
+ return new InvalidCouponError('Coupon is already applied');
747
+ return coupon;
748
+ }); }), operators.map(function (validatedCoupons) { return ({
749
+ valids: validatedCoupons.filter(function (coupon) { return i2.FinancialCoupon.isFinancialCoupon(coupon); }),
750
+ invalids: validatedCoupons.filter(function (coupon) { return coupon instanceof InvalidCouponError; }),
751
+ }); }), operators.concatMap(function (_b) {
752
+ var valids = _b.valids, invalids = _b.invalids;
753
+ return valids.length ? rxjs.of(valids) : rxjs.throwError(new GroupInvalidCouponError(invalids));
754
+ })); };
755
+ }
756
+ CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
757
+ var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
758
+ if (!i2.isNil(checkoutId))
759
+ return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
760
+ return rxjs.from(this.createCheckoutSubscription(checkoutData));
761
+ };
762
+ CheckoutSubscriptionService.prototype.createCheckoutSubscription = function (checkoutData) {
763
+ return __awaiter(this, void 0, void 0, function () {
764
+ var checkout;
765
+ return __generator(this, function (_b) {
766
+ switch (_b.label) {
767
+ case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i2.CheckoutSubscription.toInstance(i2.pick(checkoutData, ['user', 'shop'])).toPlain()))];
768
+ case 1:
769
+ checkout = _b.sent();
770
+ cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
771
+ return [2 /*return*/, checkout];
772
+ }
773
+ });
774
+ });
775
+ };
776
+ CheckoutSubscriptionService.prototype.clearCheckoutSubscriptionFromSession = function () {
777
+ cookie__default["default"].remove('checkoutSubscriptionId');
778
+ return rxjs.of();
779
+ };
780
+ CheckoutSubscriptionService.prototype.checkCoupon = function (nickname, userEmail) {
781
+ var _this = this;
782
+ return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService.checkCoupon(nickname, userEmail, i2.CheckoutTypes.SUBSCRIPTION).pipe(operators.concatMap(function (coupons) {
783
+ var couponsWithSamePlan = coupons.filter(function (coupon) { return checkout.subscriptionPlan.name === coupon.plan; });
784
+ var couponsWithNoPlan = coupons.filter(function (coupon) { return !coupon.plan; });
785
+ if (couponsWithSamePlan.length > 0)
786
+ return rxjs.of(couponsWithSamePlan);
787
+ if (couponsWithNoPlan.length > 0)
788
+ return rxjs.of(couponsWithNoPlan);
789
+ throw new Error("Coupon subscription plan is invalid.");
790
+ }), 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(); })); }));
791
+ };
792
+ return CheckoutSubscriptionService;
793
+ }());
794
+ CheckoutSubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: 'SubscriptionRepository' }, { token: CouponService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
795
+ CheckoutSubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService });
796
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, decorators: [{
797
+ type: i0.Injectable
798
+ }], ctorParameters: function () {
799
+ return [{ type: undefined, decorators: [{
800
+ type: i0.Inject,
801
+ args: ['CheckoutSubscriptionRepository']
802
+ }] }, { type: undefined, decorators: [{
803
+ type: i0.Inject,
804
+ args: ['SubscriptionRepository']
805
+ }] }, { type: CouponService }];
806
806
  } });
807
807
 
808
- var OrderService = /** @class */ (function () {
809
- function OrderService(angularFirestore, orderRepository) {
810
- this.angularFirestore = angularFirestore;
811
- this.orderRepository = orderRepository;
812
- this.orderSubject = new rxjs.Subject();
813
- }
814
- OrderService.prototype.getOrder = function (id) {
815
- var _this = this;
816
- this.angularFirestore
817
- .doc(this.orderRepository.collectionName + "/" + id)
818
- .valueChanges()
819
- .pipe(operators.map(function (doc) { return i2.Order.toInstance(doc); }))
820
- .subscribe(function (doc) { return _this.orderSubject.next(doc); });
821
- return this.orderSubject;
822
- };
823
- return OrderService;
824
- }());
825
- 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 });
826
- OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
827
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
828
- type: i0.Injectable
829
- }], ctorParameters: function () {
830
- return [{ type: i1__namespace$1.AngularFirestore }, { type: i2__namespace.OrderFirestoreRepository, decorators: [{
831
- type: i0.Inject,
832
- args: ['OrderRepository']
833
- }] }];
808
+ var OrderService = /** @class */ (function () {
809
+ function OrderService(angularFirestore, orderRepository) {
810
+ this.angularFirestore = angularFirestore;
811
+ this.orderRepository = orderRepository;
812
+ this.orderSubject = new rxjs.Subject();
813
+ }
814
+ OrderService.prototype.getOrder = function (id) {
815
+ var _this = this;
816
+ this.angularFirestore
817
+ .doc(this.orderRepository.collectionName + "/" + id)
818
+ .valueChanges()
819
+ .pipe(operators.map(function (doc) { return i2.Order.toInstance(doc); }))
820
+ .subscribe(function (doc) { return _this.orderSubject.next(doc); });
821
+ return this.orderSubject;
822
+ };
823
+ return OrderService;
824
+ }());
825
+ 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 });
826
+ OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
827
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
828
+ type: i0.Injectable
829
+ }], ctorParameters: function () {
830
+ return [{ type: i1__namespace$1.AngularFirestore }, { type: i2__namespace.OrderFirestoreRepository, decorators: [{
831
+ type: i0.Inject,
832
+ args: ['OrderRepository']
833
+ }] }];
834
834
  } });
835
835
 
836
- var HomeShopService = /** @class */ (function () {
837
- function HomeShopService(categoryRepository, homeRepository, productRepository, defaultShop) {
838
- this.categoryRepository = categoryRepository;
839
- this.homeRepository = homeRepository;
840
- this.productRepository = productRepository;
841
- this.defaultShop = defaultShop;
842
- this.buildCategoryGroupWithRequiredData = function (group) { return ({
843
- category: i2.Category.toInstance(i2.pick(group.category.toPlain(), ['id', 'name', 'slug', 'conditions'])),
844
- products: group.products.map(function (product) { return i2.Product.toInstance(i2.pick(product.toPlain(), [
845
- 'id',
846
- 'price',
847
- 'reviews',
848
- 'hasVariants',
849
- 'slug',
850
- 'sku',
851
- 'stock',
852
- 'costPrice',
853
- 'images',
854
- 'miniatures',
855
- ])); }),
856
- }); };
857
- }
858
- Object.defineProperty(HomeShopService.prototype, "homeId", {
859
- get: function () {
860
- if (this.defaultShop === i2.Shops.GLAMSHOP)
861
- return 'glamshop';
862
- if (this.defaultShop === i2.Shops.MENSMARKET)
863
- return 'mens_market';
864
- return null;
865
- },
866
- enumerable: false,
867
- configurable: true
868
- });
869
- HomeShopService.prototype.getHomeData = function () {
870
- var _this = this;
871
- return this.getHomeConfiguration().pipe(operators.tap(function (home) { var _a; return console.log((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt); }), operators.map(function (home) { var _a; return (((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt) > new Date() ? home : null); }), operators.concatMap(function (home) { return home
872
- ? rxjs.of(home)
873
- : rxjs.forkJoin([_this.getDiscoverProducts(), _this.getFeaturedProducts(), _this.getVerticalProducts()]).pipe(operators.map(function (_b) {
874
- var _c = __read(_b, 3), discoverProducts = _c[0], featuredProducts = _c[1], verticalProducts = _c[2];
875
- return ({
876
- discoverProducts: discoverProducts,
877
- featuredProducts: featuredProducts,
878
- verticalProducts: verticalProducts,
879
- });
880
- }), operators.concatMap(function (data) { return _this.saveHomeData(data); })); }));
881
- };
882
- HomeShopService.prototype.getBanners = function (type) {
883
- return this.getHomeConfiguration().pipe(operators.map(function (home) {
884
- if (type === 'brand')
885
- return home.brandsCarousel;
886
- if (type === 'buyToWin')
887
- return [home.buyToWinBanner];
888
- if (type === 'block')
889
- return home.blockBanners;
890
- if (type === 'blog')
891
- return [home.blogBanner];
892
- }));
893
- };
894
- HomeShopService.prototype.getDiscoverProducts = function () {
895
- var _this = this;
896
- return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.from(_this.categoryRepository.getCategoriesForHome(home.discoverCategories)).pipe(operators.map(function (groups) { return groups.map(_this.buildCategoryGroupWithRequiredData); })); }));
897
- };
898
- HomeShopService.prototype.getFeaturedProducts = function () {
899
- var _this = this;
900
- return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.from(_this.categoryRepository.getCategoriesForHome(home.featuredCategories)).pipe(operators.map(function (groups) { return groups.map(_this.buildCategoryGroupWithRequiredData); })); }));
901
- };
902
- HomeShopService.prototype.getVerticalProducts = function () {
903
- var _this = this;
904
- return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.forkJoin(home.verticalCarousels.map(function (id) { return rxjs.forkJoin([
905
- _this.categoryRepository.get({ id: id }),
906
- _this.productRepository.find([{ categories: { operator: i2.Where.LIKE, value: [id] } }], { limit: 12 }),
907
- ]).pipe(operators.map(function (_b) {
908
- var _c = __read(_b, 2), category = _c[0], products = _c[1];
909
- return ({ category: category, products: products.data });
910
- }), operators.map(_this.buildCategoryGroupWithRequiredData)); })); }));
911
- };
912
- HomeShopService.prototype.getHomeConfiguration = function () {
913
- var _this = this;
914
- return rxjs.of(this.homeConfiguration).pipe(operators.concatMap(function (home) { return home
915
- ? rxjs.of(home)
916
- : !_this.homeId
917
- ? rxjs.throwError(new i2.RequiredArgumentError(['homeId']))
918
- : rxjs.from(_this.homeRepository.get({ id: _this.homeId })).pipe(operators.tap(function (homeLoaded) { return (_this.homeConfiguration = homeLoaded); })); }));
919
- };
920
- HomeShopService.prototype.saveHomeData = function (homeData) {
921
- var _this = this;
922
- var data = {
923
- createdAt: new Date(),
924
- expiresAt: i2.add(new Date(), { hours: 1 }),
925
- data: homeData,
926
- };
927
- return rxjs.from(this.homeRepository.update({
928
- id: this.homeId,
929
- data: data,
930
- })).pipe(operators.tap(function () { return (_this.homeConfiguration.data = data); }), operators.map(function () { return _this.homeConfiguration; }));
931
- };
932
- return HomeShopService;
933
- }());
934
- HomeShopService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService, deps: [{ token: 'CategoryRepository' }, { token: 'HomeRepository' }, { token: 'ProductRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
935
- HomeShopService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService });
936
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService, decorators: [{
937
- type: i0.Injectable
938
- }], ctorParameters: function () {
939
- return [{ type: undefined, decorators: [{
940
- type: i0.Inject,
941
- args: ['CategoryRepository']
942
- }] }, { type: undefined, decorators: [{
943
- type: i0.Inject,
944
- args: ['HomeRepository']
945
- }] }, { type: undefined, decorators: [{
946
- type: i0.Inject,
947
- args: ['ProductRepository']
948
- }] }, { type: i2__namespace.Shops, decorators: [{
949
- type: i0.Inject,
950
- args: [DEFAULT_SHOP]
951
- }] }];
836
+ var HomeShopService = /** @class */ (function () {
837
+ function HomeShopService(categoryRepository, homeRepository, productRepository, defaultShop) {
838
+ this.categoryRepository = categoryRepository;
839
+ this.homeRepository = homeRepository;
840
+ this.productRepository = productRepository;
841
+ this.defaultShop = defaultShop;
842
+ this.buildCategoryGroupWithRequiredData = function (group) { return ({
843
+ category: i2.Category.toInstance(i2.pick(group.category.toPlain(), ['id', 'name', 'slug', 'conditions'])),
844
+ products: group.products.map(function (product) { return i2.Product.toInstance(i2.pick(product.toPlain(), [
845
+ 'id',
846
+ 'price',
847
+ 'reviews',
848
+ 'hasVariants',
849
+ 'slug',
850
+ 'sku',
851
+ 'stock',
852
+ 'costPrice',
853
+ 'images',
854
+ 'miniatures',
855
+ 'name',
856
+ ])); }),
857
+ }); };
858
+ }
859
+ Object.defineProperty(HomeShopService.prototype, "homeId", {
860
+ get: function () {
861
+ if (this.defaultShop === i2.Shops.GLAMSHOP)
862
+ return 'glamshop';
863
+ if (this.defaultShop === i2.Shops.MENSMARKET)
864
+ return 'mens_market';
865
+ return null;
866
+ },
867
+ enumerable: false,
868
+ configurable: true
869
+ });
870
+ HomeShopService.prototype.getHomeData = function () {
871
+ var _this = this;
872
+ return this.getHomeConfiguration().pipe(operators.tap(function (home) { var _a; return console.log((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt); }), operators.map(function (home) { var _a; return (((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt) > new Date() ? home : null); }), operators.concatMap(function (home) { return home
873
+ ? rxjs.of(home)
874
+ : rxjs.forkJoin([_this.getDiscoverProducts(), _this.getFeaturedProducts(), _this.getVerticalProducts()]).pipe(operators.map(function (_b) {
875
+ var _c = __read(_b, 3), discoverProducts = _c[0], featuredProducts = _c[1], verticalProducts = _c[2];
876
+ return ({
877
+ discoverProducts: discoverProducts,
878
+ featuredProducts: featuredProducts,
879
+ verticalProducts: verticalProducts,
880
+ });
881
+ }), operators.concatMap(function (data) { return _this.saveHomeData(data); })); }));
882
+ };
883
+ HomeShopService.prototype.getBanners = function (type) {
884
+ return this.getHomeConfiguration().pipe(operators.map(function (home) {
885
+ if (type === 'brand')
886
+ return home.brandsCarousel;
887
+ if (type === 'buyToWin')
888
+ return [home.buyToWinBanner];
889
+ if (type === 'block')
890
+ return home.blockBanners;
891
+ if (type === 'blog')
892
+ return [home.blogBanner];
893
+ }));
894
+ };
895
+ HomeShopService.prototype.getDiscoverProducts = function () {
896
+ var _this = this;
897
+ return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.from(_this.categoryRepository.getCategoriesForHome(home.discoverCategories)).pipe(operators.map(function (groups) { return groups.map(_this.buildCategoryGroupWithRequiredData); })); }));
898
+ };
899
+ HomeShopService.prototype.getFeaturedProducts = function () {
900
+ var _this = this;
901
+ return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.from(_this.categoryRepository.getCategoriesForHome(home.featuredCategories)).pipe(operators.map(function (groups) { return groups.map(_this.buildCategoryGroupWithRequiredData); })); }));
902
+ };
903
+ HomeShopService.prototype.getVerticalProducts = function () {
904
+ var _this = this;
905
+ return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.forkJoin(home.verticalCarousels.map(function (id) { return rxjs.forkJoin([
906
+ _this.categoryRepository.get({ id: id }),
907
+ _this.productRepository.find([{ categories: { operator: i2.Where.LIKE, value: [id] } }], { limit: 12 }),
908
+ ]).pipe(operators.map(function (_b) {
909
+ var _c = __read(_b, 2), category = _c[0], products = _c[1];
910
+ return ({ category: category, products: products.data });
911
+ }), operators.map(_this.buildCategoryGroupWithRequiredData)); })); }));
912
+ };
913
+ HomeShopService.prototype.getHomeConfiguration = function () {
914
+ var _this = this;
915
+ return rxjs.of(this.homeConfiguration).pipe(operators.concatMap(function (home) { return home
916
+ ? rxjs.of(home)
917
+ : !_this.homeId
918
+ ? rxjs.throwError(new i2.RequiredArgumentError(['homeId']))
919
+ : rxjs.from(_this.homeRepository.get({ id: _this.homeId })).pipe(operators.tap(function (homeLoaded) { return (_this.homeConfiguration = homeLoaded); })); }));
920
+ };
921
+ HomeShopService.prototype.saveHomeData = function (homeData) {
922
+ var _this = this;
923
+ var data = {
924
+ createdAt: new Date(),
925
+ expiresAt: i2.add(new Date(), { hours: 1 }),
926
+ data: homeData,
927
+ };
928
+ return rxjs.from(this.homeRepository.update({
929
+ id: this.homeId,
930
+ data: data,
931
+ })).pipe(operators.tap(function () { return (_this.homeConfiguration.data = data); }), operators.map(function () { return _this.homeConfiguration; }));
932
+ };
933
+ return HomeShopService;
934
+ }());
935
+ HomeShopService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService, deps: [{ token: 'CategoryRepository' }, { token: 'HomeRepository' }, { token: 'ProductRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
936
+ HomeShopService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService });
937
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService, decorators: [{
938
+ type: i0.Injectable
939
+ }], ctorParameters: function () {
940
+ return [{ type: undefined, decorators: [{
941
+ type: i0.Inject,
942
+ args: ['CategoryRepository']
943
+ }] }, { type: undefined, decorators: [{
944
+ type: i0.Inject,
945
+ args: ['HomeRepository']
946
+ }] }, { type: undefined, decorators: [{
947
+ type: i0.Inject,
948
+ args: ['ProductRepository']
949
+ }] }, { type: i2__namespace.Shops, decorators: [{
950
+ type: i0.Inject,
951
+ args: [DEFAULT_SHOP]
952
+ }] }];
952
953
  } });
953
954
 
954
- var AngularFirebaseAuthModule = /** @class */ (function () {
955
- function AngularFirebaseAuthModule() {
956
- }
957
- AngularFirebaseAuthModule.initializeApp = function (options, nameOrConfig) {
958
- return {
959
- ngModule: AngularFirebaseAuthModule,
960
- providers: [
961
- { provide: fire.FIREBASE_OPTIONS, useValue: options },
962
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
963
- ],
964
- };
965
- };
966
- return AngularFirebaseAuthModule;
967
- }());
968
- AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
969
- AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [fire.AngularFireModule] });
970
- AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
971
- {
972
- provide: 'Authentication',
973
- useFactory: function (authenticationService, userRepository) {
974
- return new i2.Authentication(authenticationService, userRepository);
975
- },
976
- deps: ['AuthenticationService', 'UserRepository'],
977
- },
978
- {
979
- provide: 'AuthenticationService',
980
- useFactory: function (angularFireAuth) {
981
- return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
982
- },
983
- deps: [i1.AngularFireAuth],
984
- },
985
- {
986
- provide: 'Register',
987
- useFactory: function (registerService, userRepository) {
988
- return new i2.Register(registerService, userRepository);
989
- },
990
- deps: ['RegisterService', 'UserRepository'],
991
- },
992
- {
993
- provide: 'RegisterService',
994
- useFactory: function (angularFireAuth) {
995
- return new i2.RegisterFirebaseAuthService(angularFireAuth);
996
- },
997
- deps: [i1.AngularFireAuth],
998
- },
999
- {
1000
- provide: 'SignOut',
1001
- useFactory: function (authenticationService) {
1002
- return new i2.SignOut(authenticationService);
1003
- },
1004
- deps: ['AuthenticationService'],
1005
- },
1006
- {
1007
- provide: 'RecoveryPassword',
1008
- useFactory: function (authenticationService) {
1009
- return new i2.RecoveryPassword(authenticationService);
1010
- },
1011
- deps: ['AuthenticationService'],
1012
- },
1013
- ], imports: [[fire.AngularFireModule]] });
1014
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
1015
- type: i0.NgModule,
1016
- args: [{
1017
- imports: [fire.AngularFireModule],
1018
- providers: [
1019
- {
1020
- provide: 'Authentication',
1021
- useFactory: function (authenticationService, userRepository) {
1022
- return new i2.Authentication(authenticationService, userRepository);
1023
- },
1024
- deps: ['AuthenticationService', 'UserRepository'],
1025
- },
1026
- {
1027
- provide: 'AuthenticationService',
1028
- useFactory: function (angularFireAuth) {
1029
- return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
1030
- },
1031
- deps: [i1.AngularFireAuth],
1032
- },
1033
- {
1034
- provide: 'Register',
1035
- useFactory: function (registerService, userRepository) {
1036
- return new i2.Register(registerService, userRepository);
1037
- },
1038
- deps: ['RegisterService', 'UserRepository'],
1039
- },
1040
- {
1041
- provide: 'RegisterService',
1042
- useFactory: function (angularFireAuth) {
1043
- return new i2.RegisterFirebaseAuthService(angularFireAuth);
1044
- },
1045
- deps: [i1.AngularFireAuth],
1046
- },
1047
- {
1048
- provide: 'SignOut',
1049
- useFactory: function (authenticationService) {
1050
- return new i2.SignOut(authenticationService);
1051
- },
1052
- deps: ['AuthenticationService'],
1053
- },
1054
- {
1055
- provide: 'RecoveryPassword',
1056
- useFactory: function (authenticationService) {
1057
- return new i2.RecoveryPassword(authenticationService);
1058
- },
1059
- deps: ['AuthenticationService'],
1060
- },
1061
- ],
1062
- }]
955
+ var AngularFirebaseAuthModule = /** @class */ (function () {
956
+ function AngularFirebaseAuthModule() {
957
+ }
958
+ AngularFirebaseAuthModule.initializeApp = function (options, nameOrConfig) {
959
+ return {
960
+ ngModule: AngularFirebaseAuthModule,
961
+ providers: [
962
+ { provide: fire.FIREBASE_OPTIONS, useValue: options },
963
+ { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
964
+ ],
965
+ };
966
+ };
967
+ return AngularFirebaseAuthModule;
968
+ }());
969
+ AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
970
+ AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [fire.AngularFireModule] });
971
+ AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
972
+ {
973
+ provide: 'Authentication',
974
+ useFactory: function (authenticationService, userRepository) {
975
+ return new i2.Authentication(authenticationService, userRepository);
976
+ },
977
+ deps: ['AuthenticationService', 'UserRepository'],
978
+ },
979
+ {
980
+ provide: 'AuthenticationService',
981
+ useFactory: function (angularFireAuth) {
982
+ return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
983
+ },
984
+ deps: [i1.AngularFireAuth],
985
+ },
986
+ {
987
+ provide: 'Register',
988
+ useFactory: function (registerService, userRepository) {
989
+ return new i2.Register(registerService, userRepository);
990
+ },
991
+ deps: ['RegisterService', 'UserRepository'],
992
+ },
993
+ {
994
+ provide: 'RegisterService',
995
+ useFactory: function (angularFireAuth) {
996
+ return new i2.RegisterFirebaseAuthService(angularFireAuth);
997
+ },
998
+ deps: [i1.AngularFireAuth],
999
+ },
1000
+ {
1001
+ provide: 'SignOut',
1002
+ useFactory: function (authenticationService) {
1003
+ return new i2.SignOut(authenticationService);
1004
+ },
1005
+ deps: ['AuthenticationService'],
1006
+ },
1007
+ {
1008
+ provide: 'RecoveryPassword',
1009
+ useFactory: function (authenticationService) {
1010
+ return new i2.RecoveryPassword(authenticationService);
1011
+ },
1012
+ deps: ['AuthenticationService'],
1013
+ },
1014
+ ], imports: [[fire.AngularFireModule]] });
1015
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
1016
+ type: i0.NgModule,
1017
+ args: [{
1018
+ imports: [fire.AngularFireModule],
1019
+ providers: [
1020
+ {
1021
+ provide: 'Authentication',
1022
+ useFactory: function (authenticationService, userRepository) {
1023
+ return new i2.Authentication(authenticationService, userRepository);
1024
+ },
1025
+ deps: ['AuthenticationService', 'UserRepository'],
1026
+ },
1027
+ {
1028
+ provide: 'AuthenticationService',
1029
+ useFactory: function (angularFireAuth) {
1030
+ return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
1031
+ },
1032
+ deps: [i1.AngularFireAuth],
1033
+ },
1034
+ {
1035
+ provide: 'Register',
1036
+ useFactory: function (registerService, userRepository) {
1037
+ return new i2.Register(registerService, userRepository);
1038
+ },
1039
+ deps: ['RegisterService', 'UserRepository'],
1040
+ },
1041
+ {
1042
+ provide: 'RegisterService',
1043
+ useFactory: function (angularFireAuth) {
1044
+ return new i2.RegisterFirebaseAuthService(angularFireAuth);
1045
+ },
1046
+ deps: [i1.AngularFireAuth],
1047
+ },
1048
+ {
1049
+ provide: 'SignOut',
1050
+ useFactory: function (authenticationService) {
1051
+ return new i2.SignOut(authenticationService);
1052
+ },
1053
+ deps: ['AuthenticationService'],
1054
+ },
1055
+ {
1056
+ provide: 'RecoveryPassword',
1057
+ useFactory: function (authenticationService) {
1058
+ return new i2.RecoveryPassword(authenticationService);
1059
+ },
1060
+ deps: ['AuthenticationService'],
1061
+ },
1062
+ ],
1063
+ }]
1063
1064
  }] });
1064
1065
 
1065
- var AngularFirestoreModule = /** @class */ (function () {
1066
- function AngularFirestoreModule() {
1067
- }
1068
- AngularFirestoreModule.initializeApp = function (options, nameOrConfig) {
1069
- return {
1070
- ngModule: AngularFirestoreModule,
1071
- providers: [
1072
- { provide: fire.FIREBASE_OPTIONS, useValue: options },
1073
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
1074
- ],
1075
- };
1076
- };
1077
- return AngularFirestoreModule;
1078
- }());
1079
- AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1080
- AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, imports: [fire.AngularFireModule] });
1081
- AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
1082
- {
1083
- provide: 'BeautyProfileRepository',
1084
- useFactory: function (firestore, userRepository) {
1085
- return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1086
- },
1087
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1088
- },
1089
- {
1090
- provide: 'Buy2WinRepository',
1091
- useFactory: function (firestore) {
1092
- return new i2.Buy2WinFirestoreRepository(firestore.firestore);
1093
- },
1094
- deps: [i1$1.AngularFirestore],
1095
- },
1096
- {
1097
- provide: 'CategoryRepository',
1098
- useFactory: function (firestore) {
1099
- return new i2.CategoryFirestoreRepository(firestore.firestore);
1100
- },
1101
- deps: [i1$1.AngularFirestore],
1102
- },
1103
- {
1104
- provide: 'CheckoutRepository',
1105
- useFactory: function (firestore) {
1106
- return new i2.CheckoutFirestoreRepository(firestore.firestore);
1107
- },
1108
- deps: [i1$1.AngularFirestore],
1109
- },
1110
- {
1111
- provide: 'CheckoutSubscriptionRepository',
1112
- useFactory: function (firestore) {
1113
- return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1114
- },
1115
- deps: [i1$1.AngularFirestore],
1116
- },
1117
- {
1118
- provide: 'CouponRepository',
1119
- useFactory: function (firestore) {
1120
- return new i2.CouponFirestoreRepository(firestore.firestore);
1121
- },
1122
- deps: [i1$1.AngularFirestore],
1123
- },
1124
- {
1125
- provide: 'EditionRepository',
1126
- useFactory: function (firestore, subscriptionRepository) {
1127
- return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1128
- },
1129
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1130
- },
1131
- {
1132
- provide: 'HomeRepository',
1133
- useFactory: function (firestore) {
1134
- return new i2.HomeFirestoreRepository(firestore.firestore);
1135
- },
1136
- deps: [i1$1.AngularFirestore],
1137
- },
1138
- {
1139
- provide: 'LeadRepository',
1140
- useFactory: function (firestore) {
1141
- return new i2.LeadFirestoreRepository(firestore.firestore);
1142
- },
1143
- deps: [i1$1.AngularFirestore],
1144
- },
1145
- {
1146
- provide: 'LegacyOrderRepository',
1147
- useFactory: function (firestore) {
1148
- return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
1149
- },
1150
- deps: [i1$1.AngularFirestore],
1151
- },
1152
- {
1153
- provide: 'ShopMenuRepository',
1154
- useFactory: function (firestore) {
1155
- return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1156
- },
1157
- deps: [i1$1.AngularFirestore],
1158
- },
1159
- {
1160
- provide: 'OrderRepository',
1161
- useFactory: function (firestore) {
1162
- return new i2.OrderFirestoreRepository(firestore.firestore);
1163
- },
1164
- deps: [i1$1.AngularFirestore],
1165
- },
1166
- {
1167
- provide: 'PaymentRepository',
1168
- useFactory: function (firestore) {
1169
- return new i2.PaymentFirestoreRepository(firestore.firestore);
1170
- },
1171
- deps: [i1$1.AngularFirestore],
1172
- },
1173
- {
1174
- provide: 'ProductRepository',
1175
- useFactory: function (firestore) {
1176
- return new i2.ProductFirestoreRepository(firestore.firestore);
1177
- },
1178
- deps: [i1$1.AngularFirestore],
1179
- },
1180
- {
1181
- provide: 'SubscriptionPaymentRepository',
1182
- useFactory: function (firestore, subscriptionRepository) {
1183
- return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1184
- },
1185
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1186
- },
1187
- {
1188
- provide: 'SubscriptionPlanRepository',
1189
- useFactory: function (firestore) {
1190
- return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1191
- },
1192
- deps: [i1$1.AngularFirestore],
1193
- },
1194
- {
1195
- provide: 'SubscriptionProductRepository',
1196
- useFactory: function (firestore) {
1197
- return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1198
- },
1199
- deps: [i1$1.AngularFirestore],
1200
- },
1201
- {
1202
- provide: 'SubscriptionRepository',
1203
- useFactory: function (firestore) {
1204
- return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1205
- },
1206
- deps: [i1$1.AngularFirestore],
1207
- },
1208
- {
1209
- provide: 'UserRepository',
1210
- useFactory: function (firestore) {
1211
- return new i2.UserFirestoreRepository(firestore.firestore);
1212
- },
1213
- deps: [i1$1.AngularFirestore],
1214
- },
1215
- {
1216
- provide: 'UserAddressRepository',
1217
- useFactory: function (firestore, userRepository) {
1218
- return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1219
- },
1220
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1221
- },
1222
- {
1223
- provide: 'UserPaymentMethodRepository',
1224
- useFactory: function (firestore, userRepository) {
1225
- return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1226
- },
1227
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1228
- },
1229
- {
1230
- provide: 'VariantRepository',
1231
- useFactory: function (firestore, productRepository) {
1232
- return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1233
- },
1234
- deps: [i1$1.AngularFirestore, 'ProductRepository'],
1235
- },
1236
- ], imports: [[fire.AngularFireModule]] });
1237
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
1238
- type: i0.NgModule,
1239
- args: [{
1240
- imports: [fire.AngularFireModule],
1241
- providers: [
1242
- {
1243
- provide: 'BeautyProfileRepository',
1244
- useFactory: function (firestore, userRepository) {
1245
- return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1246
- },
1247
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1248
- },
1249
- {
1250
- provide: 'Buy2WinRepository',
1251
- useFactory: function (firestore) {
1252
- return new i2.Buy2WinFirestoreRepository(firestore.firestore);
1253
- },
1254
- deps: [i1$1.AngularFirestore],
1255
- },
1256
- {
1257
- provide: 'CategoryRepository',
1258
- useFactory: function (firestore) {
1259
- return new i2.CategoryFirestoreRepository(firestore.firestore);
1260
- },
1261
- deps: [i1$1.AngularFirestore],
1262
- },
1263
- {
1264
- provide: 'CheckoutRepository',
1265
- useFactory: function (firestore) {
1266
- return new i2.CheckoutFirestoreRepository(firestore.firestore);
1267
- },
1268
- deps: [i1$1.AngularFirestore],
1269
- },
1270
- {
1271
- provide: 'CheckoutSubscriptionRepository',
1272
- useFactory: function (firestore) {
1273
- return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1274
- },
1275
- deps: [i1$1.AngularFirestore],
1276
- },
1277
- {
1278
- provide: 'CouponRepository',
1279
- useFactory: function (firestore) {
1280
- return new i2.CouponFirestoreRepository(firestore.firestore);
1281
- },
1282
- deps: [i1$1.AngularFirestore],
1283
- },
1284
- {
1285
- provide: 'EditionRepository',
1286
- useFactory: function (firestore, subscriptionRepository) {
1287
- return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1288
- },
1289
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1290
- },
1291
- {
1292
- provide: 'HomeRepository',
1293
- useFactory: function (firestore) {
1294
- return new i2.HomeFirestoreRepository(firestore.firestore);
1295
- },
1296
- deps: [i1$1.AngularFirestore],
1297
- },
1298
- {
1299
- provide: 'LeadRepository',
1300
- useFactory: function (firestore) {
1301
- return new i2.LeadFirestoreRepository(firestore.firestore);
1302
- },
1303
- deps: [i1$1.AngularFirestore],
1304
- },
1305
- {
1306
- provide: 'LegacyOrderRepository',
1307
- useFactory: function (firestore) {
1308
- return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
1309
- },
1310
- deps: [i1$1.AngularFirestore],
1311
- },
1312
- {
1313
- provide: 'ShopMenuRepository',
1314
- useFactory: function (firestore) {
1315
- return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1316
- },
1317
- deps: [i1$1.AngularFirestore],
1318
- },
1319
- {
1320
- provide: 'OrderRepository',
1321
- useFactory: function (firestore) {
1322
- return new i2.OrderFirestoreRepository(firestore.firestore);
1323
- },
1324
- deps: [i1$1.AngularFirestore],
1325
- },
1326
- {
1327
- provide: 'PaymentRepository',
1328
- useFactory: function (firestore) {
1329
- return new i2.PaymentFirestoreRepository(firestore.firestore);
1330
- },
1331
- deps: [i1$1.AngularFirestore],
1332
- },
1333
- {
1334
- provide: 'ProductRepository',
1335
- useFactory: function (firestore) {
1336
- return new i2.ProductFirestoreRepository(firestore.firestore);
1337
- },
1338
- deps: [i1$1.AngularFirestore],
1339
- },
1340
- {
1341
- provide: 'SubscriptionPaymentRepository',
1342
- useFactory: function (firestore, subscriptionRepository) {
1343
- return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1344
- },
1345
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1346
- },
1347
- {
1348
- provide: 'SubscriptionPlanRepository',
1349
- useFactory: function (firestore) {
1350
- return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1351
- },
1352
- deps: [i1$1.AngularFirestore],
1353
- },
1354
- {
1355
- provide: 'SubscriptionProductRepository',
1356
- useFactory: function (firestore) {
1357
- return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1358
- },
1359
- deps: [i1$1.AngularFirestore],
1360
- },
1361
- {
1362
- provide: 'SubscriptionRepository',
1363
- useFactory: function (firestore) {
1364
- return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1365
- },
1366
- deps: [i1$1.AngularFirestore],
1367
- },
1368
- {
1369
- provide: 'UserRepository',
1370
- useFactory: function (firestore) {
1371
- return new i2.UserFirestoreRepository(firestore.firestore);
1372
- },
1373
- deps: [i1$1.AngularFirestore],
1374
- },
1375
- {
1376
- provide: 'UserAddressRepository',
1377
- useFactory: function (firestore, userRepository) {
1378
- return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1379
- },
1380
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1381
- },
1382
- {
1383
- provide: 'UserPaymentMethodRepository',
1384
- useFactory: function (firestore, userRepository) {
1385
- return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1386
- },
1387
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1388
- },
1389
- {
1390
- provide: 'VariantRepository',
1391
- useFactory: function (firestore, productRepository) {
1392
- return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1393
- },
1394
- deps: [i1$1.AngularFirestore, 'ProductRepository'],
1395
- },
1396
- ],
1397
- }]
1066
+ var AngularFirestoreModule = /** @class */ (function () {
1067
+ function AngularFirestoreModule() {
1068
+ }
1069
+ AngularFirestoreModule.initializeApp = function (options, nameOrConfig) {
1070
+ return {
1071
+ ngModule: AngularFirestoreModule,
1072
+ providers: [
1073
+ { provide: fire.FIREBASE_OPTIONS, useValue: options },
1074
+ { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
1075
+ ],
1076
+ };
1077
+ };
1078
+ return AngularFirestoreModule;
1079
+ }());
1080
+ AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1081
+ AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, imports: [fire.AngularFireModule] });
1082
+ AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
1083
+ {
1084
+ provide: 'BeautyProfileRepository',
1085
+ useFactory: function (firestore, userRepository) {
1086
+ return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1087
+ },
1088
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
1089
+ },
1090
+ {
1091
+ provide: 'Buy2WinRepository',
1092
+ useFactory: function (firestore) {
1093
+ return new i2.Buy2WinFirestoreRepository(firestore.firestore);
1094
+ },
1095
+ deps: [i1$1.AngularFirestore],
1096
+ },
1097
+ {
1098
+ provide: 'CategoryRepository',
1099
+ useFactory: function (firestore) {
1100
+ return new i2.CategoryFirestoreRepository(firestore.firestore);
1101
+ },
1102
+ deps: [i1$1.AngularFirestore],
1103
+ },
1104
+ {
1105
+ provide: 'CheckoutRepository',
1106
+ useFactory: function (firestore) {
1107
+ return new i2.CheckoutFirestoreRepository(firestore.firestore);
1108
+ },
1109
+ deps: [i1$1.AngularFirestore],
1110
+ },
1111
+ {
1112
+ provide: 'CheckoutSubscriptionRepository',
1113
+ useFactory: function (firestore) {
1114
+ return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1115
+ },
1116
+ deps: [i1$1.AngularFirestore],
1117
+ },
1118
+ {
1119
+ provide: 'CouponRepository',
1120
+ useFactory: function (firestore) {
1121
+ return new i2.CouponFirestoreRepository(firestore.firestore);
1122
+ },
1123
+ deps: [i1$1.AngularFirestore],
1124
+ },
1125
+ {
1126
+ provide: 'EditionRepository',
1127
+ useFactory: function (firestore, subscriptionRepository) {
1128
+ return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1129
+ },
1130
+ deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1131
+ },
1132
+ {
1133
+ provide: 'HomeRepository',
1134
+ useFactory: function (firestore) {
1135
+ return new i2.HomeFirestoreRepository(firestore.firestore);
1136
+ },
1137
+ deps: [i1$1.AngularFirestore],
1138
+ },
1139
+ {
1140
+ provide: 'LeadRepository',
1141
+ useFactory: function (firestore) {
1142
+ return new i2.LeadFirestoreRepository(firestore.firestore);
1143
+ },
1144
+ deps: [i1$1.AngularFirestore],
1145
+ },
1146
+ {
1147
+ provide: 'LegacyOrderRepository',
1148
+ useFactory: function (firestore) {
1149
+ return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
1150
+ },
1151
+ deps: [i1$1.AngularFirestore],
1152
+ },
1153
+ {
1154
+ provide: 'ShopMenuRepository',
1155
+ useFactory: function (firestore) {
1156
+ return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1157
+ },
1158
+ deps: [i1$1.AngularFirestore],
1159
+ },
1160
+ {
1161
+ provide: 'OrderRepository',
1162
+ useFactory: function (firestore) {
1163
+ return new i2.OrderFirestoreRepository(firestore.firestore);
1164
+ },
1165
+ deps: [i1$1.AngularFirestore],
1166
+ },
1167
+ {
1168
+ provide: 'PaymentRepository',
1169
+ useFactory: function (firestore) {
1170
+ return new i2.PaymentFirestoreRepository(firestore.firestore);
1171
+ },
1172
+ deps: [i1$1.AngularFirestore],
1173
+ },
1174
+ {
1175
+ provide: 'ProductRepository',
1176
+ useFactory: function (firestore) {
1177
+ return new i2.ProductFirestoreRepository(firestore.firestore);
1178
+ },
1179
+ deps: [i1$1.AngularFirestore],
1180
+ },
1181
+ {
1182
+ provide: 'SubscriptionPaymentRepository',
1183
+ useFactory: function (firestore, subscriptionRepository) {
1184
+ return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1185
+ },
1186
+ deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1187
+ },
1188
+ {
1189
+ provide: 'SubscriptionPlanRepository',
1190
+ useFactory: function (firestore) {
1191
+ return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1192
+ },
1193
+ deps: [i1$1.AngularFirestore],
1194
+ },
1195
+ {
1196
+ provide: 'SubscriptionProductRepository',
1197
+ useFactory: function (firestore) {
1198
+ return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1199
+ },
1200
+ deps: [i1$1.AngularFirestore],
1201
+ },
1202
+ {
1203
+ provide: 'SubscriptionRepository',
1204
+ useFactory: function (firestore) {
1205
+ return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1206
+ },
1207
+ deps: [i1$1.AngularFirestore],
1208
+ },
1209
+ {
1210
+ provide: 'UserRepository',
1211
+ useFactory: function (firestore) {
1212
+ return new i2.UserFirestoreRepository(firestore.firestore);
1213
+ },
1214
+ deps: [i1$1.AngularFirestore],
1215
+ },
1216
+ {
1217
+ provide: 'UserAddressRepository',
1218
+ useFactory: function (firestore, userRepository) {
1219
+ return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1220
+ },
1221
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
1222
+ },
1223
+ {
1224
+ provide: 'UserPaymentMethodRepository',
1225
+ useFactory: function (firestore, userRepository) {
1226
+ return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1227
+ },
1228
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
1229
+ },
1230
+ {
1231
+ provide: 'VariantRepository',
1232
+ useFactory: function (firestore, productRepository) {
1233
+ return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1234
+ },
1235
+ deps: [i1$1.AngularFirestore, 'ProductRepository'],
1236
+ },
1237
+ ], imports: [[fire.AngularFireModule]] });
1238
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
1239
+ type: i0.NgModule,
1240
+ args: [{
1241
+ imports: [fire.AngularFireModule],
1242
+ providers: [
1243
+ {
1244
+ provide: 'BeautyProfileRepository',
1245
+ useFactory: function (firestore, userRepository) {
1246
+ return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1247
+ },
1248
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
1249
+ },
1250
+ {
1251
+ provide: 'Buy2WinRepository',
1252
+ useFactory: function (firestore) {
1253
+ return new i2.Buy2WinFirestoreRepository(firestore.firestore);
1254
+ },
1255
+ deps: [i1$1.AngularFirestore],
1256
+ },
1257
+ {
1258
+ provide: 'CategoryRepository',
1259
+ useFactory: function (firestore) {
1260
+ return new i2.CategoryFirestoreRepository(firestore.firestore);
1261
+ },
1262
+ deps: [i1$1.AngularFirestore],
1263
+ },
1264
+ {
1265
+ provide: 'CheckoutRepository',
1266
+ useFactory: function (firestore) {
1267
+ return new i2.CheckoutFirestoreRepository(firestore.firestore);
1268
+ },
1269
+ deps: [i1$1.AngularFirestore],
1270
+ },
1271
+ {
1272
+ provide: 'CheckoutSubscriptionRepository',
1273
+ useFactory: function (firestore) {
1274
+ return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1275
+ },
1276
+ deps: [i1$1.AngularFirestore],
1277
+ },
1278
+ {
1279
+ provide: 'CouponRepository',
1280
+ useFactory: function (firestore) {
1281
+ return new i2.CouponFirestoreRepository(firestore.firestore);
1282
+ },
1283
+ deps: [i1$1.AngularFirestore],
1284
+ },
1285
+ {
1286
+ provide: 'EditionRepository',
1287
+ useFactory: function (firestore, subscriptionRepository) {
1288
+ return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1289
+ },
1290
+ deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1291
+ },
1292
+ {
1293
+ provide: 'HomeRepository',
1294
+ useFactory: function (firestore) {
1295
+ return new i2.HomeFirestoreRepository(firestore.firestore);
1296
+ },
1297
+ deps: [i1$1.AngularFirestore],
1298
+ },
1299
+ {
1300
+ provide: 'LeadRepository',
1301
+ useFactory: function (firestore) {
1302
+ return new i2.LeadFirestoreRepository(firestore.firestore);
1303
+ },
1304
+ deps: [i1$1.AngularFirestore],
1305
+ },
1306
+ {
1307
+ provide: 'LegacyOrderRepository',
1308
+ useFactory: function (firestore) {
1309
+ return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
1310
+ },
1311
+ deps: [i1$1.AngularFirestore],
1312
+ },
1313
+ {
1314
+ provide: 'ShopMenuRepository',
1315
+ useFactory: function (firestore) {
1316
+ return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1317
+ },
1318
+ deps: [i1$1.AngularFirestore],
1319
+ },
1320
+ {
1321
+ provide: 'OrderRepository',
1322
+ useFactory: function (firestore) {
1323
+ return new i2.OrderFirestoreRepository(firestore.firestore);
1324
+ },
1325
+ deps: [i1$1.AngularFirestore],
1326
+ },
1327
+ {
1328
+ provide: 'PaymentRepository',
1329
+ useFactory: function (firestore) {
1330
+ return new i2.PaymentFirestoreRepository(firestore.firestore);
1331
+ },
1332
+ deps: [i1$1.AngularFirestore],
1333
+ },
1334
+ {
1335
+ provide: 'ProductRepository',
1336
+ useFactory: function (firestore) {
1337
+ return new i2.ProductFirestoreRepository(firestore.firestore);
1338
+ },
1339
+ deps: [i1$1.AngularFirestore],
1340
+ },
1341
+ {
1342
+ provide: 'SubscriptionPaymentRepository',
1343
+ useFactory: function (firestore, subscriptionRepository) {
1344
+ return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1345
+ },
1346
+ deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1347
+ },
1348
+ {
1349
+ provide: 'SubscriptionPlanRepository',
1350
+ useFactory: function (firestore) {
1351
+ return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1352
+ },
1353
+ deps: [i1$1.AngularFirestore],
1354
+ },
1355
+ {
1356
+ provide: 'SubscriptionProductRepository',
1357
+ useFactory: function (firestore) {
1358
+ return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1359
+ },
1360
+ deps: [i1$1.AngularFirestore],
1361
+ },
1362
+ {
1363
+ provide: 'SubscriptionRepository',
1364
+ useFactory: function (firestore) {
1365
+ return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1366
+ },
1367
+ deps: [i1$1.AngularFirestore],
1368
+ },
1369
+ {
1370
+ provide: 'UserRepository',
1371
+ useFactory: function (firestore) {
1372
+ return new i2.UserFirestoreRepository(firestore.firestore);
1373
+ },
1374
+ deps: [i1$1.AngularFirestore],
1375
+ },
1376
+ {
1377
+ provide: 'UserAddressRepository',
1378
+ useFactory: function (firestore, userRepository) {
1379
+ return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1380
+ },
1381
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
1382
+ },
1383
+ {
1384
+ provide: 'UserPaymentMethodRepository',
1385
+ useFactory: function (firestore, userRepository) {
1386
+ return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1387
+ },
1388
+ deps: [i1$1.AngularFirestore, 'UserRepository'],
1389
+ },
1390
+ {
1391
+ provide: 'VariantRepository',
1392
+ useFactory: function (firestore, productRepository) {
1393
+ return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1394
+ },
1395
+ deps: [i1$1.AngularFirestore, 'ProductRepository'],
1396
+ },
1397
+ ],
1398
+ }]
1398
1399
  }] });
1399
1400
 
1400
- var AngularConnectModule = /** @class */ (function () {
1401
- function AngularConnectModule() {
1402
- }
1403
- AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
1404
- return {
1405
- ngModule: AngularConnectModule,
1406
- 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 }]))),
1407
- };
1408
- };
1409
- return AngularConnectModule;
1410
- }());
1411
- AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1412
- AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule] });
1413
- AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [
1414
- AuthService,
1415
- CartService,
1416
- CheckoutService,
1417
- CheckoutSubscriptionService,
1418
- CouponService,
1419
- HomeShopService,
1420
- OrderService,
1421
- ], imports: [[fire.AngularFireModule, AngularFirestoreModule]] });
1422
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
1423
- type: i0.NgModule,
1424
- args: [{
1425
- imports: [fire.AngularFireModule, AngularFirestoreModule],
1426
- providers: [
1427
- AuthService,
1428
- CartService,
1429
- CheckoutService,
1430
- CheckoutSubscriptionService,
1431
- CouponService,
1432
- HomeShopService,
1433
- OrderService,
1434
- ],
1435
- }]
1401
+ var AngularConnectModule = /** @class */ (function () {
1402
+ function AngularConnectModule() {
1403
+ }
1404
+ AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
1405
+ return {
1406
+ ngModule: AngularConnectModule,
1407
+ 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 }]))),
1408
+ };
1409
+ };
1410
+ return AngularConnectModule;
1411
+ }());
1412
+ AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1413
+ AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule] });
1414
+ AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [
1415
+ AuthService,
1416
+ CartService,
1417
+ CheckoutService,
1418
+ CheckoutSubscriptionService,
1419
+ CouponService,
1420
+ HomeShopService,
1421
+ OrderService,
1422
+ ], imports: [[fire.AngularFireModule, AngularFirestoreModule]] });
1423
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
1424
+ type: i0.NgModule,
1425
+ args: [{
1426
+ imports: [fire.AngularFireModule, AngularFirestoreModule],
1427
+ providers: [
1428
+ AuthService,
1429
+ CartService,
1430
+ CheckoutService,
1431
+ CheckoutSubscriptionService,
1432
+ CouponService,
1433
+ HomeShopService,
1434
+ OrderService,
1435
+ ],
1436
+ }]
1436
1437
  }] });
1437
1438
 
1438
- /**
1439
- * Generated bundle index. Do not edit.
1439
+ /**
1440
+ * Generated bundle index. Do not edit.
1440
1441
  */
1441
1442
 
1442
1443
  exports.AngularConnectModule = AngularConnectModule;