@infrab4a/connect-angular 0.13.0-beta.9 → 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 (65) hide show
  1. package/bundles/infrab4a-connect-angular.umd.js +1390 -1269
  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 -47
  5. package/esm2015/lib/angular-firebase-auth.module.js +113 -103
  6. package/esm2015/lib/angular-firestore.module.js +337 -343
  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 -7
  10. package/esm2015/lib/services/auth.service.js +42 -45
  11. package/esm2015/lib/services/cart.service.js +166 -162
  12. package/esm2015/lib/services/checkout-subscription.service.js +68 -37
  13. package/esm2015/lib/services/checkout.service.js +79 -79
  14. package/esm2015/lib/services/coupon.service.js +70 -51
  15. package/esm2015/lib/services/errors/group-invalid-coupon.error.js +7 -0
  16. package/esm2015/lib/services/errors/index.js +3 -2
  17. package/esm2015/lib/services/errors/invalid-coupon.error.js +7 -7
  18. package/esm2015/lib/services/home-shop.service.js +107 -0
  19. package/esm2015/lib/services/index.js +8 -7
  20. package/esm2015/lib/services/order.service.js +32 -30
  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 +986 -878
  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 -9
  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 -6
  34. package/lib/services/auth.service.d.ts +19 -21
  35. package/lib/services/cart.service.d.ts +41 -41
  36. package/lib/services/checkout-subscription.service.d.ts +18 -13
  37. package/lib/services/checkout.service.d.ts +22 -22
  38. package/lib/services/coupon.service.d.ts +14 -13
  39. package/lib/services/errors/group-invalid-coupon.error.d.ts +5 -0
  40. package/lib/services/errors/index.d.ts +2 -1
  41. package/lib/services/errors/invalid-coupon.error.d.ts +4 -4
  42. package/lib/services/home-shop.service.d.ts +24 -0
  43. package/lib/services/index.d.ts +7 -6
  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 +4 -3
  49. package/public-api.d.ts +1 -1
  50. package/esm2015/lib/factories/firebase-app.factory.js +0 -18
  51. package/esm2015/lib/factories/firebase-auth.factory.js +0 -2
  52. package/esm2015/lib/factories/firebase-firestore.factory.js +0 -2
  53. package/esm2015/lib/factories/index.js +0 -4
  54. package/esm2015/lib/providers/firebase-app.provider.js +0 -12
  55. package/esm2015/lib/providers/firebase-auth.provider.js +0 -15
  56. package/esm2015/lib/providers/firebase-firestore.provider.js +0 -14
  57. package/esm2015/lib/providers/index.js +0 -4
  58. package/lib/factories/firebase-app.factory.d.ts +0 -4
  59. package/lib/factories/firebase-auth.factory.d.ts +0 -2
  60. package/lib/factories/firebase-firestore.factory.d.ts +0 -2
  61. package/lib/factories/index.d.ts +0 -3
  62. package/lib/providers/firebase-app.provider.d.ts +0 -17
  63. package/lib/providers/firebase-auth.provider.d.ts +0 -11
  64. package/lib/providers/firebase-firestore.provider.d.ts +0 -10
  65. package/lib/providers/index.d.ts +0 -3
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('firebase'), require('@infrab4a/connect'), require('firebase/app'), require('js-cookie')) :
3
- typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', 'firebase', '@infrab4a/connect', 'firebase/app', 'js-cookie'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a["connect-angular"] = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.firebase, global["@infrab4a/connect"], global.firebase, global["js-cookie"]));
5
- })(this, (function (exports, i0, rxjs, operators, firebase$1, i2, firebase, cookie) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/fire/auth'), require('@infrab4a/connect'), require('js-cookie'), require('@angular/fire/firestore'), require('@angular/fire')) :
3
+ typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/fire/auth', '@infrab4a/connect', 'js-cookie', '@angular/fire/firestore', '@angular/fire'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a["connect-angular"] = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.ng.fire.auth, global["@infrab4a/connect"], global["js-cookie"], global.ng.fire.firestore, global.ng.fire));
5
+ })(this, (function (exports, i0, rxjs, operators, i1, i2, cookie, i1$1, fire) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -25,1288 +25,1419 @@
25
25
  }
26
26
 
27
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var firebase__default$1 = /*#__PURE__*/_interopDefaultLegacy(firebase$1);
28
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
29
  var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
30
- var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
31
30
  var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
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 FirebaseAuthFactory = function (app) { return app.auth(); };
352
-
353
- var FirebaseAppFactory = function (options, zone, nameOrConfig) {
354
- var name = ((i2.isString(nameOrConfig) && nameOrConfig) || '[DEFAULT]').toString();
355
- var config = ((i2.isObject(nameOrConfig) && nameOrConfig) || {});
356
- config.name = config.name || name;
357
- var existingApp = firebase__default["default"].apps.filter(function (firebaseApp) { return firebaseApp && firebaseApp.name === config.name; })[0];
358
- var app = existingApp || zone.runOutsideAngular(function () { return firebase__default["default"].initializeApp(options, config); });
359
- try {
360
- if (JSON.stringify(options) !== JSON.stringify(app.options)) {
361
- console.error('error', app.name + " Firebase App already initialized with different options : '.'\n }");
362
- }
363
- }
364
- catch (e) { }
365
- return app;
366
- };
367
-
368
- var FIREBASE_OPTIONS = new i0.InjectionToken('connect-angular.app.options');
369
- var FIREBASE_APP_NAME = new i0.InjectionToken('connect-angular.app.nameOrConfig');
370
- var ConnectAngularFirebaseApp = /** @class */ (function () {
371
- function ConnectAngularFirebaseApp() {
372
- }
373
- return ConnectAngularFirebaseApp;
374
- }());
375
- var FirebaseAppProvider = {
376
- provide: ConnectAngularFirebaseApp,
377
- useFactory: FirebaseAppFactory,
378
- deps: [FIREBASE_OPTIONS, i0.NgZone, [new i0.Optional(), FIREBASE_APP_NAME]],
379
- };
380
-
381
- var ConnectAngularFirebaseAuth = /** @class */ (function () {
382
- function ConnectAngularFirebaseAuth() {
383
- this.onAuthStateChanged = firebase__default$1["default"].auth().onAuthStateChanged;
384
- this.currentUser = firebase__default$1["default"].auth().currentUser;
385
- }
386
- return ConnectAngularFirebaseAuth;
387
- }());
388
- var FirebaseAuthProvider = {
389
- provide: ConnectAngularFirebaseAuth,
390
- useFactory: FirebaseAuthFactory,
391
- deps: [ConnectAngularFirebaseApp],
392
- };
393
-
394
- var fromCallback = function (cb, zone) { return new rxjs.Observable(function (subscriber) { return ({ unsubscribe: zone.runOutsideAngular(function () { return cb(subscriber); }) }); }); };
395
- var AuthService = /** @class */ (function () {
396
- function AuthService(firebaseAuth, userRepository, zone) {
397
- this.firebaseAuth = firebaseAuth;
398
- this.userRepository = userRepository;
399
- this.zone = zone;
400
- }
401
- AuthService.prototype.getAuthstate = function () {
402
- this.firebaseAuth.onAuthStateChanged(function (user) { return user; });
403
- var observables = [
404
- fromCallback(this.firebaseAuth.onAuthStateChanged, this.zone).pipe(operators.catchError(function () { return rxjs.of(null); })),
405
- this.getUser().pipe(operators.catchError(function () { return rxjs.of(null); })),
406
- ];
407
- return rxjs.combineLatest(observables).pipe(operators.map(function (_a) {
408
- var _b = __read(_a, 2), fireUser = _b[0], user = _b[1];
409
- return {
410
- user: user,
411
- isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
412
- };
413
- }));
414
- };
415
- AuthService.prototype.getUser = function () {
416
- var _this = this;
417
- 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)); }));
418
- };
419
- AuthService.prototype.getTokenId = function () {
420
- return rxjs.from(this.firebaseAuth.currentUser.getIdToken());
421
- };
422
- AuthService.prototype.getFireUser = function () {
423
- return rxjs.of(this.firebaseAuth.currentUser).pipe(operators.catchError(function () { return rxjs.of(null); }));
424
- };
425
- return AuthService;
426
- }());
427
- AuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, deps: [{ token: ConnectAngularFirebaseAuth }, { token: 'UserRepository' }, { token: i0__namespace.NgZone }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
428
- AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService });
429
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, decorators: [{
430
- type: i0.Injectable
431
- }], ctorParameters: function () {
432
- return [{ type: ConnectAngularFirebaseAuth }, { type: undefined, decorators: [{
433
- type: i0.Inject,
434
- args: ['UserRepository']
435
- }] }, { type: i0__namespace.NgZone }];
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
+ }] }];
436
390
  } });
437
391
 
438
392
  var DEFAULT_SHOP = 'DEFAULT_SHOP';
439
393
 
440
- var InvalidCouponError = /** @class */ (function (_super) {
441
- __extends(InvalidCouponError, _super);
442
- function InvalidCouponError(message) {
443
- var _this = _super.call(this, message) || this;
444
- _this.message = message;
445
- return _this;
446
- }
447
- 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;
448
402
  }(Error));
449
403
 
450
- var CouponService = /** @class */ (function () {
451
- function CouponService(couponRepository, defaultShop) {
452
- this.couponRepository = couponRepository;
453
- this.defaultShop = defaultShop;
454
- this.emailIsFromCollaborator = function (userEmail) { return !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g)); };
455
- }
456
- CouponService.prototype.checkCoupon = function (nickname, userEmail) {
457
- var _this = this;
458
- return rxjs.from(this.couponRepository.find([
459
- {
460
- nickname: { operator: i2.Where.EQUALS, value: nickname },
461
- shopAvailability: { operator: i2.Where.EQUALS, value: this.defaultShop },
462
- },
463
- ])).pipe(operators.concatMap(function (coupons) { return coupons.count < 1 ? rxjs.throwError(function () { return new i2.NotFoundError('Coupon not found'); }) : rxjs.of(coupons.data[0]); }), operators.concatMap(function (coupon) { return i2.FinancialCoupon.isFinancialCoupon(coupon) && _this.isValidCoupon(coupon, userEmail)
464
- ? rxjs.of(coupon)
465
- : rxjs.throwError(function () { return new InvalidCouponError('Coupon is not valid'); }); }));
466
- };
467
- CouponService.prototype.isValidCoupon = function (coupon, userEmail) {
468
- if (coupon.checkoutType !== i2.CheckoutTypes.ECOMMERCE)
469
- throw new InvalidCouponError('Coupon is not ecommerce valid');
470
- if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === i2.Exclusivities.COLLABORATORS)
471
- throw new InvalidCouponError('User is not a collaborator');
472
- if (coupon.exclusivityType === i2.Exclusivities.SPECIFIC_USER && coupon.recipient !== userEmail)
473
- throw new InvalidCouponError('Coupon is not valid for user');
474
- if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) < new Date())
475
- throw new InvalidCouponError('Coupon is expired');
476
- return true;
477
- };
478
- return CouponService;
479
- }());
480
- 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 });
481
- CouponService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, providedIn: 'root' });
482
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, decorators: [{
483
- type: i0.Injectable,
484
- args: [{
485
- providedIn: 'root',
486
- }]
487
- }], ctorParameters: function () {
488
- return [{ type: undefined, decorators: [{
489
- type: i0.Inject,
490
- args: ['CouponRepository']
491
- }] }, { type: i2__namespace.Shops, decorators: [{
492
- type: i0.Inject,
493
- args: [DEFAULT_SHOP]
494
- }] }];
495
- } });
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
+ }(Error));
496
413
 
497
- var CheckoutService = /** @class */ (function () {
498
- function CheckoutService(couponService, checkoutRepository, orderRepository, userRepository, defaultShop) {
499
- this.couponService = couponService;
500
- this.checkoutRepository = checkoutRepository;
501
- this.orderRepository = orderRepository;
502
- this.userRepository = userRepository;
503
- this.defaultShop = defaultShop;
504
- }
505
- CheckoutService.prototype.getCheckout = function (checkoutData) {
506
- var checkoutId = cookie__default["default"].get('checkoutId');
507
- if (!i2.isNil(checkoutId))
508
- return rxjs.from(this.checkoutRepository.get({ id: checkoutId }));
509
- return rxjs.from(this.createCheckout(checkoutData));
510
- };
511
- CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
512
- var _this = this;
513
- 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'); }); }));
514
- };
515
- CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
516
- return rxjs.from(this.checkoutRepository.update(i2.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
517
- };
518
- CheckoutService.prototype.updateCheckoutUser = function (checkout) {
519
- return rxjs.from(this.checkoutRepository.update(i2.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
520
- };
521
- CheckoutService.prototype.clearCheckoutFromSession = function () {
522
- cookie__default["default"].remove('checkoutId');
523
- return rxjs.of();
524
- };
525
- CheckoutService.prototype.checkCoupon = function (nickname) {
526
- var _this = this;
527
- return this.getCheckout().pipe(operators.concatMap(function (checkout) {
528
- var _a;
529
- return _this.couponService.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email).pipe(operators.concatMap(function (coupon) {
530
- var _a, _b;
531
- return !!((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email)
532
- ? 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) {
533
- if (orders.data.length >= (coupon.useLimit || Infinity))
534
- return rxjs.throwError(function () { return new Error('Coupon is already applied'); });
535
- return rxjs.of(coupon);
536
- }))
537
- : rxjs.of(coupon);
538
- }));
539
- }));
540
- };
541
- CheckoutService.prototype.createCheckout = function (checkoutData) {
542
- return __awaiter(this, void 0, void 0, function () {
543
- var checkout;
544
- return __generator(this, function (_c) {
545
- switch (_c.label) {
546
- 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 }))];
547
- case 1:
548
- checkout = _c.sent();
549
- cookie__default["default"].set('checkoutId', checkout.id);
550
- return [2 /*return*/, checkout];
551
- }
552
- });
553
- });
554
- };
555
- return CheckoutService;
556
- }());
557
- 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 });
558
- CheckoutService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService });
559
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, decorators: [{
560
- type: i0.Injectable
561
- }], ctorParameters: function () {
562
- return [{ type: CouponService }, { type: undefined, decorators: [{
563
- type: i0.Inject,
564
- args: ['CheckoutRepository']
565
- }] }, { type: undefined, decorators: [{
566
- type: i0.Inject,
567
- args: ['OrderRepository']
568
- }] }, { type: undefined, decorators: [{
569
- type: i0.Inject,
570
- args: ['UserRepository']
571
- }] }, { type: i2__namespace.Shops, decorators: [{
572
- type: i0.Inject,
573
- args: [DEFAULT_SHOP]
574
- }] }];
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
+ }] }];
575
480
  } });
576
481
 
577
- var CartService = /** @class */ (function () {
578
- function CartService(authService, checkoutService, defaultShop) {
579
- var _this = this;
580
- this.authService = authService;
581
- this.checkoutService = checkoutService;
582
- this.defaultShop = defaultShop;
583
- this.cartSubject = new rxjs.Subject();
584
- this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i2.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
585
- var _a;
586
- var items = [];
587
- var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.sku; }).indexOf(lineItem.sku);
588
- if (index > -1) {
589
- checkoutLoaded.lineItems[index].quantity += quantity;
590
- checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
591
- }
592
- else
593
- checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
594
- return _this.checkoutService
595
- .updateCheckoutLineItems(checkoutLoaded)
596
- .pipe(operators.map(function (updatedCheckout) { return _this.generateCartObject(updatedCheckout.lineItems); }));
597
- })); };
598
- this.generateCartObject = function (items) {
599
- var cart = {};
600
- items === null || items === void 0 ? void 0 : items.forEach(function (item) {
601
- var _a;
602
- 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) })));
603
- });
604
- return cart;
605
- };
606
- this.buildLineItem = function (_f) {
607
- var checkout = _f.checkout, item = _f.item, quantity = _f.quantity;
608
- var _a, _b, _c, _d, _e;
609
- 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;
610
- if (_this.checkMaxStock(item, quantity || 0))
611
- throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
612
- var image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
613
- 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;
614
- var isGift = item.isGift || null;
615
- var pricePaid = _this.getProductPrice({
616
- product: item,
617
- shop: checkout.shop || _this.defaultShop,
618
- isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
619
- });
620
- return i2.LineItem.toInstance({
621
- id: id,
622
- name: name,
623
- brand: brand,
624
- slug: slug,
625
- sku: sku,
626
- stock: stock,
627
- price: price,
628
- image: image,
629
- weight: weight,
630
- quantity: (item.quantity || 0) + (quantity || 0),
631
- pricePaid: pricePaid,
632
- categories: categories,
633
- isGift: isGift,
634
- });
635
- };
636
- this.getProductPrice = function (_f) {
637
- var product = _f.product, shop = _f.shop, isSubscriber = _f.isSubscriber;
638
- var info = product.getInfoByShop(shop);
639
- if (product.isGift)
640
- return 0;
641
- return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
642
- };
643
- this.checkMaxStock = function (item, quantity) {
644
- var _a;
645
- var maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
646
- var currentItemAmount = item.quantity || 0;
647
- return currentItemAmount + quantity > maxStock;
648
- };
649
- }
650
- CartService.prototype.addItem = function (item, quantity) {
651
- var _this = this;
652
- if (quantity === void 0) { quantity = 1; }
653
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) { return ({ checkout: checkout, lineItem: _this.buildLineItem({ checkout: checkout, item: item, quantity: quantity || 1 }) }); }), operators.concatMap(function (_f) {
654
- var checkout = _f.checkout, lineItem = _f.lineItem;
655
- return _this.updateLineItemInCart(lineItem, quantity || 1, checkout);
656
- }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
657
- };
658
- CartService.prototype.decreaseItem = function (item) {
659
- var _this = this;
660
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
661
- var _a;
662
- var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; });
663
- if (!i2.isNil(checkoutItem))
664
- checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
665
- return checkout;
666
- }), 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); }));
667
- };
668
- CartService.prototype.getCart = function (checkout) {
669
- var _this = this;
670
- this.buildCartFromCheckout(checkout).subscribe(function (cart) { return _this.cartSubject.next(cart); });
671
- return this.cartSubject;
672
- };
673
- /**
674
- * @deprecated The method should not be used
675
- */
676
- CartService.prototype.getDiscount = function (coupon) {
677
- switch (coupon.type) {
678
- case i2.CouponTypes.FINANCIAL:
679
- return this.getFinancialDiscount(coupon);
680
- case i2.CouponTypes.PRODUCT:
681
- return function (subTotalPrice) { return subTotalPrice; };
682
- case i2.CouponTypes.GIFTCARD:
683
- return this.getFinancialDiscount(coupon);
684
- case i2.CouponTypes.VOUCHER:
685
- return function (subTotalPrice) { return subTotalPrice; };
686
- }
687
- };
688
- /**
689
- * @deprecated The method should not be used
690
- */
691
- CartService.prototype.getVariantPriceDiscount = function (item, shop) {
692
- 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); }));
693
- };
694
- CartService.prototype.removeItem = function (item) {
695
- var _this = this;
696
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
697
- var index = checkout.lineItems.findIndex(function (lineItem) { return lineItem.sku === item.sku; });
698
- if (index >= 0)
699
- checkout.lineItems.splice(index, 1);
700
- return checkout;
701
- }), 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); }));
702
- };
703
- CartService.prototype.updateUserCart = function (user) {
704
- var _this = this;
705
- 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) {
706
- var _a;
707
- 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 }); })) || [] })));
708
- }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
709
- };
710
- CartService.prototype.clearCart = function () {
711
- var _this = this;
712
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
713
- _this.checkoutService.clearCheckoutFromSession();
714
- return checkout;
715
- }), operators.concatMap(function (oldCheckout) { return _this.buildCartFromCheckout(oldCheckout); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
716
- };
717
- CartService.prototype.buildCartFromCheckout = function (checkoutData) {
718
- var _this = this;
719
- return this.checkoutService.getCheckout(checkoutData).pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.concatMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
720
- };
721
- CartService.prototype.getFinancialDiscount = function (coupon) {
722
- return function (subTotalPrice) {
723
- if (i2.FinancialCoupon.isFinancialCoupon(coupon))
724
- switch (coupon.subtype) {
725
- case i2.CouponSubtypes.ABSOLUTE:
726
- return subTotalPrice - coupon.discount * 100;
727
- case i2.CouponSubtypes.PERCENTAGE:
728
- return subTotalPrice * (1 - coupon.discount / 100);
729
- }
730
- };
731
- };
732
- return CartService;
733
- }());
734
- 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 });
735
- CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService });
736
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, decorators: [{
737
- type: i0.Injectable
738
- }], ctorParameters: function () {
739
- return [{ type: AuthService }, { type: CheckoutService }, { type: i2__namespace.Shops, decorators: [{
740
- type: i0.Inject,
741
- args: [DEFAULT_SHOP]
742
- }] }];
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
+ }] }];
743
560
  } });
744
561
 
745
- var CheckoutSubscriptionService = /** @class */ (function () {
746
- function CheckoutSubscriptionService(checkoutSubscriptionRepository) {
747
- this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
748
- }
749
- CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
750
- var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
751
- if (!i2.isNil(checkoutId))
752
- return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
753
- return rxjs.from(this.createCheckoutSubscription(checkoutData));
754
- };
755
- CheckoutSubscriptionService.prototype.createCheckoutSubscription = function (checkoutData) {
756
- return __awaiter(this, void 0, void 0, function () {
757
- var checkout;
758
- return __generator(this, function (_a) {
759
- switch (_a.label) {
760
- case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i2.CheckoutSubscription.toInstance(i2.pick(checkoutData, ['user', 'shop'])).toPlain()))];
761
- case 1:
762
- checkout = _a.sent();
763
- cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
764
- return [2 /*return*/, checkout];
765
- }
766
- });
767
- });
768
- };
769
- CheckoutSubscriptionService.prototype.clearCheckoutSubscriptionFromSession = function () {
770
- cookie__default["default"].remove('checkoutSubscriptionId');
771
- return rxjs.of();
772
- };
773
- return CheckoutSubscriptionService;
774
- }());
775
- CheckoutSubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
776
- CheckoutSubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService });
777
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, decorators: [{
778
- type: i0.Injectable
779
- }], ctorParameters: function () {
780
- return [{ type: undefined, decorators: [{
781
- type: i0.Inject,
782
- args: ['CheckoutSubscriptionRepository']
783
- }] }];
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
+ }] }];
784
732
  } });
785
733
 
786
- var FirebaseFirestoreFactory = function (app) { return app.firestore(); };
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
+ } });
787
807
 
788
- var ConnectAngularFirebaseFirestore = /** @class */ (function () {
789
- function ConnectAngularFirebaseFirestore() {
790
- this.doc = firebase__default$1["default"].firestore().doc;
791
- }
792
- return ConnectAngularFirebaseFirestore;
793
- }());
794
- var FirebaseFirestoreProvider = {
795
- provide: ConnectAngularFirebaseFirestore,
796
- useFactory: FirebaseFirestoreFactory,
797
- deps: [ConnectAngularFirebaseApp],
798
- };
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
+ } });
799
835
 
800
- var OrderService = /** @class */ (function () {
801
- function OrderService(firebaseFirestore, orderRepository) {
802
- this.firebaseFirestore = firebaseFirestore;
803
- this.orderRepository = orderRepository;
804
- this.orderSubject = new rxjs.Subject();
805
- }
806
- OrderService.prototype.getOrder = function (id) {
807
- var _this = this;
808
- this.firebaseFirestore.doc(this.orderRepository.collectionName + "/" + id).onSnapshot(function (doc) {
809
- var order = i2.Order.toInstance(Object.assign(Object.assign({}, doc.data()), { id: doc.id }));
810
- _this.orderSubject.next(order);
811
- });
812
- return this.orderSubject;
813
- };
814
- return OrderService;
815
- }());
816
- OrderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, deps: [{ token: ConnectAngularFirebaseFirestore }, { token: 'OrderRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
817
- OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
818
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
819
- type: i0.Injectable
820
- }], ctorParameters: function () {
821
- return [{ type: ConnectAngularFirebaseFirestore }, { type: i2__namespace.OrderFirestoreRepository, decorators: [{
822
- type: i0.Inject,
823
- args: ['OrderRepository']
824
- }] }];
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
+ }] }];
825
953
  } });
826
954
 
827
- var AngularFirestoreModule = /** @class */ (function () {
828
- function AngularFirestoreModule() {
829
- }
830
- AngularFirestoreModule.initializeApp = function (options, nameOrConfig) {
831
- return {
832
- ngModule: AngularFirestoreModule,
833
- providers: [
834
- { provide: FIREBASE_OPTIONS, useValue: options },
835
- { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
836
- ],
837
- };
838
- };
839
- return AngularFirestoreModule;
840
- }());
841
- AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
842
- AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule });
843
- AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
844
- FirebaseAppProvider,
845
- FirebaseFirestoreProvider,
846
- {
847
- provide: 'BeautyProfileRepository',
848
- useFactory: function (firestore, userRepository) {
849
- return new i2.UserBeautyProfileFirestoreRepository(firestore, userRepository);
850
- },
851
- deps: [ConnectAngularFirebaseFirestore, 'UserRepository'],
852
- },
853
- {
854
- provide: 'Buy2WinRepository',
855
- useFactory: function (firestore) {
856
- return new i2.Buy2WinFirestoreRepository(firestore);
857
- },
858
- deps: [ConnectAngularFirebaseFirestore],
859
- },
860
- {
861
- provide: 'CategoryRepository',
862
- useFactory: function (firestore) {
863
- return new i2.CategoryFirestoreRepository(firestore);
864
- },
865
- deps: [ConnectAngularFirebaseFirestore],
866
- },
867
- {
868
- provide: 'CheckoutRepository',
869
- useFactory: function (firestore) {
870
- return new i2.CheckoutFirestoreRepository(firestore);
871
- },
872
- deps: [ConnectAngularFirebaseFirestore],
873
- },
874
- {
875
- provide: 'CheckoutSubscriptionRepository',
876
- useFactory: function (firestore) {
877
- return new i2.CheckoutSubscriptionFirestoreRepository(firestore);
878
- },
879
- deps: [ConnectAngularFirebaseFirestore],
880
- },
881
- {
882
- provide: 'CouponRepository',
883
- useFactory: function (firestore) {
884
- return new i2.CouponFirestoreRepository(firestore);
885
- },
886
- deps: [ConnectAngularFirebaseFirestore],
887
- },
888
- {
889
- provide: 'EditionRepository',
890
- useFactory: function (firestore, subscriptionRepository) {
891
- return new i2.SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
892
- },
893
- deps: [ConnectAngularFirebaseFirestore, 'SubscriptionRepository'],
894
- },
895
- {
896
- provide: 'HomeRepository',
897
- useFactory: function (firestore) {
898
- return new i2.HomeFirestoreRepository(firestore);
899
- },
900
- deps: [ConnectAngularFirebaseFirestore],
901
- },
902
- {
903
- provide: 'LeadRepository',
904
- useFactory: function (firestore) {
905
- return new i2.LeadFirestoreRepository(firestore);
906
- },
907
- deps: [ConnectAngularFirebaseFirestore],
908
- },
909
- {
910
- provide: 'LegacyOrderRepository',
911
- useFactory: function (firestore) {
912
- return new i2.LegacyOrderFirestoreRepository(firestore);
913
- },
914
- deps: [ConnectAngularFirebaseFirestore],
915
- },
916
- {
917
- provide: 'ShopMenuRepository',
918
- useFactory: function (firestore) {
919
- return new i2.ShopMenuFirestoreRepository(firestore);
920
- },
921
- deps: [ConnectAngularFirebaseFirestore],
922
- },
923
- {
924
- provide: 'OrderRepository',
925
- useFactory: function (firestore) {
926
- return new i2.OrderFirestoreRepository(firestore);
927
- },
928
- deps: [ConnectAngularFirebaseFirestore],
929
- },
930
- {
931
- provide: 'PaymentRepository',
932
- useFactory: function (firestore) {
933
- return new i2.PaymentFirestoreRepository(firestore);
934
- },
935
- deps: [ConnectAngularFirebaseFirestore],
936
- },
937
- {
938
- provide: 'ProductRepository',
939
- useFactory: function (firestore) {
940
- return new i2.ProductFirestoreRepository(firestore);
941
- },
942
- deps: [ConnectAngularFirebaseFirestore],
943
- },
944
- {
945
- provide: 'SubscriptionPaymentRepository',
946
- useFactory: function (firestore, subscriptionRepository) {
947
- return new i2.SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
948
- },
949
- deps: [ConnectAngularFirebaseFirestore, 'SubscriptionRepository'],
950
- },
951
- {
952
- provide: 'SubscriptionPlanRepository',
953
- useFactory: function (firestore) {
954
- return new i2.SubscriptionPlanFirestoreRepository(firestore);
955
- },
956
- deps: [ConnectAngularFirebaseFirestore],
957
- },
958
- {
959
- provide: 'SubscriptionProductRepository',
960
- useFactory: function (firestore) {
961
- return new i2.SubscriptionProductFirestoreRepository(firestore);
962
- },
963
- deps: [ConnectAngularFirebaseFirestore],
964
- },
965
- {
966
- provide: 'SubscriptionRepository',
967
- useFactory: function (firestore) {
968
- return new i2.SubscriptionFirestoreRepository(firestore);
969
- },
970
- deps: [ConnectAngularFirebaseFirestore],
971
- },
972
- {
973
- provide: 'UserRepository',
974
- useFactory: function (firestore) {
975
- console.log('teste');
976
- console.log(firestore);
977
- return new i2.UserFirestoreRepository(firestore);
978
- },
979
- deps: [ConnectAngularFirebaseFirestore],
980
- },
981
- {
982
- provide: 'UserAddressRepository',
983
- useFactory: function (firestore, userRepository) {
984
- return new i2.UserAddressFirestoreRepository(firestore, userRepository);
985
- },
986
- deps: [ConnectAngularFirebaseFirestore, 'UserRepository'],
987
- },
988
- {
989
- provide: 'UserPaymentMethodRepository',
990
- useFactory: function (firestore, userRepository) {
991
- return new i2.UserPaymentMethodFirestoreRepository(firestore, userRepository);
992
- },
993
- deps: [ConnectAngularFirebaseFirestore, 'UserRepository'],
994
- },
995
- {
996
- provide: 'VariantRepository',
997
- useFactory: function (firestore, productRepository) {
998
- return new i2.ProductVariantFirestoreRepository(firestore, productRepository);
999
- },
1000
- deps: [ConnectAngularFirebaseFirestore, 'ProductRepository'],
1001
- },
1002
- ] });
1003
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
1004
- type: i0.NgModule,
1005
- args: [{
1006
- providers: [
1007
- FirebaseAppProvider,
1008
- FirebaseFirestoreProvider,
1009
- {
1010
- provide: 'BeautyProfileRepository',
1011
- useFactory: function (firestore, userRepository) {
1012
- return new i2.UserBeautyProfileFirestoreRepository(firestore, userRepository);
1013
- },
1014
- deps: [ConnectAngularFirebaseFirestore, 'UserRepository'],
1015
- },
1016
- {
1017
- provide: 'Buy2WinRepository',
1018
- useFactory: function (firestore) {
1019
- return new i2.Buy2WinFirestoreRepository(firestore);
1020
- },
1021
- deps: [ConnectAngularFirebaseFirestore],
1022
- },
1023
- {
1024
- provide: 'CategoryRepository',
1025
- useFactory: function (firestore) {
1026
- return new i2.CategoryFirestoreRepository(firestore);
1027
- },
1028
- deps: [ConnectAngularFirebaseFirestore],
1029
- },
1030
- {
1031
- provide: 'CheckoutRepository',
1032
- useFactory: function (firestore) {
1033
- return new i2.CheckoutFirestoreRepository(firestore);
1034
- },
1035
- deps: [ConnectAngularFirebaseFirestore],
1036
- },
1037
- {
1038
- provide: 'CheckoutSubscriptionRepository',
1039
- useFactory: function (firestore) {
1040
- return new i2.CheckoutSubscriptionFirestoreRepository(firestore);
1041
- },
1042
- deps: [ConnectAngularFirebaseFirestore],
1043
- },
1044
- {
1045
- provide: 'CouponRepository',
1046
- useFactory: function (firestore) {
1047
- return new i2.CouponFirestoreRepository(firestore);
1048
- },
1049
- deps: [ConnectAngularFirebaseFirestore],
1050
- },
1051
- {
1052
- provide: 'EditionRepository',
1053
- useFactory: function (firestore, subscriptionRepository) {
1054
- return new i2.SubscriptionEditionFirestoreRepository(firestore, subscriptionRepository);
1055
- },
1056
- deps: [ConnectAngularFirebaseFirestore, 'SubscriptionRepository'],
1057
- },
1058
- {
1059
- provide: 'HomeRepository',
1060
- useFactory: function (firestore) {
1061
- return new i2.HomeFirestoreRepository(firestore);
1062
- },
1063
- deps: [ConnectAngularFirebaseFirestore],
1064
- },
1065
- {
1066
- provide: 'LeadRepository',
1067
- useFactory: function (firestore) {
1068
- return new i2.LeadFirestoreRepository(firestore);
1069
- },
1070
- deps: [ConnectAngularFirebaseFirestore],
1071
- },
1072
- {
1073
- provide: 'LegacyOrderRepository',
1074
- useFactory: function (firestore) {
1075
- return new i2.LegacyOrderFirestoreRepository(firestore);
1076
- },
1077
- deps: [ConnectAngularFirebaseFirestore],
1078
- },
1079
- {
1080
- provide: 'ShopMenuRepository',
1081
- useFactory: function (firestore) {
1082
- return new i2.ShopMenuFirestoreRepository(firestore);
1083
- },
1084
- deps: [ConnectAngularFirebaseFirestore],
1085
- },
1086
- {
1087
- provide: 'OrderRepository',
1088
- useFactory: function (firestore) {
1089
- return new i2.OrderFirestoreRepository(firestore);
1090
- },
1091
- deps: [ConnectAngularFirebaseFirestore],
1092
- },
1093
- {
1094
- provide: 'PaymentRepository',
1095
- useFactory: function (firestore) {
1096
- return new i2.PaymentFirestoreRepository(firestore);
1097
- },
1098
- deps: [ConnectAngularFirebaseFirestore],
1099
- },
1100
- {
1101
- provide: 'ProductRepository',
1102
- useFactory: function (firestore) {
1103
- return new i2.ProductFirestoreRepository(firestore);
1104
- },
1105
- deps: [ConnectAngularFirebaseFirestore],
1106
- },
1107
- {
1108
- provide: 'SubscriptionPaymentRepository',
1109
- useFactory: function (firestore, subscriptionRepository) {
1110
- return new i2.SubscriptionPaymentFirestoreRepository(firestore, subscriptionRepository);
1111
- },
1112
- deps: [ConnectAngularFirebaseFirestore, 'SubscriptionRepository'],
1113
- },
1114
- {
1115
- provide: 'SubscriptionPlanRepository',
1116
- useFactory: function (firestore) {
1117
- return new i2.SubscriptionPlanFirestoreRepository(firestore);
1118
- },
1119
- deps: [ConnectAngularFirebaseFirestore],
1120
- },
1121
- {
1122
- provide: 'SubscriptionProductRepository',
1123
- useFactory: function (firestore) {
1124
- return new i2.SubscriptionProductFirestoreRepository(firestore);
1125
- },
1126
- deps: [ConnectAngularFirebaseFirestore],
1127
- },
1128
- {
1129
- provide: 'SubscriptionRepository',
1130
- useFactory: function (firestore) {
1131
- return new i2.SubscriptionFirestoreRepository(firestore);
1132
- },
1133
- deps: [ConnectAngularFirebaseFirestore],
1134
- },
1135
- {
1136
- provide: 'UserRepository',
1137
- useFactory: function (firestore) {
1138
- console.log('teste');
1139
- console.log(firestore);
1140
- return new i2.UserFirestoreRepository(firestore);
1141
- },
1142
- deps: [ConnectAngularFirebaseFirestore],
1143
- },
1144
- {
1145
- provide: 'UserAddressRepository',
1146
- useFactory: function (firestore, userRepository) {
1147
- return new i2.UserAddressFirestoreRepository(firestore, userRepository);
1148
- },
1149
- deps: [ConnectAngularFirebaseFirestore, 'UserRepository'],
1150
- },
1151
- {
1152
- provide: 'UserPaymentMethodRepository',
1153
- useFactory: function (firestore, userRepository) {
1154
- return new i2.UserPaymentMethodFirestoreRepository(firestore, userRepository);
1155
- },
1156
- deps: [ConnectAngularFirebaseFirestore, 'UserRepository'],
1157
- },
1158
- {
1159
- provide: 'VariantRepository',
1160
- useFactory: function (firestore, productRepository) {
1161
- return new i2.ProductVariantFirestoreRepository(firestore, productRepository);
1162
- },
1163
- deps: [ConnectAngularFirebaseFirestore, 'ProductRepository'],
1164
- },
1165
- ],
1166
- }]
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
+ }]
1167
1064
  }] });
1168
1065
 
1169
- var AngularFirebaseAuthModule = /** @class */ (function () {
1170
- function AngularFirebaseAuthModule() {
1171
- }
1172
- AngularFirebaseAuthModule.initializeApp = function (options, nameOrConfig) {
1173
- return {
1174
- ngModule: AngularFirebaseAuthModule,
1175
- providers: [
1176
- { provide: FIREBASE_OPTIONS, useValue: options },
1177
- { provide: FIREBASE_APP_NAME, useValue: nameOrConfig },
1178
- ],
1179
- };
1180
- };
1181
- return AngularFirebaseAuthModule;
1182
- }());
1183
- AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1184
- AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [AngularFirestoreModule] });
1185
- AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
1186
- FirebaseAppProvider,
1187
- FirebaseAuthProvider,
1188
- {
1189
- provide: 'Authentication',
1190
- useFactory: function (authenticationService, userRepository) {
1191
- return new i2.Authentication(authenticationService, userRepository);
1192
- },
1193
- deps: ['AuthenticationService', 'UserRepository'],
1194
- },
1195
- {
1196
- provide: 'AuthenticationService',
1197
- useFactory: function (auth) {
1198
- return new i2.AuthenticationFirebaseAuthService(auth);
1199
- },
1200
- deps: [ConnectAngularFirebaseAuth],
1201
- },
1202
- {
1203
- provide: 'Register',
1204
- useFactory: function (registerService, userRepository) {
1205
- return new i2.Register(registerService, userRepository);
1206
- },
1207
- deps: ['RegisterService', 'UserRepository'],
1208
- },
1209
- {
1210
- provide: 'RegisterService',
1211
- useFactory: function (auth) {
1212
- return new i2.RegisterFirebaseAuthService(auth);
1213
- },
1214
- deps: [ConnectAngularFirebaseAuth],
1215
- },
1216
- {
1217
- provide: 'SignOut',
1218
- useFactory: function (authenticationService) {
1219
- return new i2.SignOut(authenticationService);
1220
- },
1221
- deps: ['AuthenticationService'],
1222
- },
1223
- ], imports: [[AngularFirestoreModule]] });
1224
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
1225
- type: i0.NgModule,
1226
- args: [{
1227
- imports: [AngularFirestoreModule],
1228
- providers: [
1229
- FirebaseAppProvider,
1230
- FirebaseAuthProvider,
1231
- {
1232
- provide: 'Authentication',
1233
- useFactory: function (authenticationService, userRepository) {
1234
- return new i2.Authentication(authenticationService, userRepository);
1235
- },
1236
- deps: ['AuthenticationService', 'UserRepository'],
1237
- },
1238
- {
1239
- provide: 'AuthenticationService',
1240
- useFactory: function (auth) {
1241
- return new i2.AuthenticationFirebaseAuthService(auth);
1242
- },
1243
- deps: [ConnectAngularFirebaseAuth],
1244
- },
1245
- {
1246
- provide: 'Register',
1247
- useFactory: function (registerService, userRepository) {
1248
- return new i2.Register(registerService, userRepository);
1249
- },
1250
- deps: ['RegisterService', 'UserRepository'],
1251
- },
1252
- {
1253
- provide: 'RegisterService',
1254
- useFactory: function (auth) {
1255
- return new i2.RegisterFirebaseAuthService(auth);
1256
- },
1257
- deps: [ConnectAngularFirebaseAuth],
1258
- },
1259
- {
1260
- provide: 'SignOut',
1261
- useFactory: function (authenticationService) {
1262
- return new i2.SignOut(authenticationService);
1263
- },
1264
- deps: ['AuthenticationService'],
1265
- },
1266
- ],
1267
- }]
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
+ }]
1268
1399
  }] });
1269
1400
 
1270
- var AngularConnectModule = /** @class */ (function () {
1271
- function AngularConnectModule() {
1272
- }
1273
- AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
1274
- return {
1275
- ngModule: AngularConnectModule,
1276
- providers: __spreadArray(__spreadArray(__spreadArray([], __read((i2.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i2.isNil(options) ? [] : [{ provide: FIREBASE_OPTIONS, useValue: options }]))), __read((i2.isNil(options) ? [] : [{ provide: FIREBASE_APP_NAME, useValue: nameOrConfig }]))),
1277
- };
1278
- };
1279
- return AngularConnectModule;
1280
- }());
1281
- AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1282
- AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [AngularFirebaseAuthModule, AngularFirestoreModule] });
1283
- AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [
1284
- AuthService,
1285
- CartService,
1286
- CheckoutService,
1287
- CheckoutSubscriptionService,
1288
- CouponService,
1289
- OrderService,
1290
- FirebaseAppProvider,
1291
- ], imports: [[AngularFirebaseAuthModule, AngularFirestoreModule]] });
1292
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
1293
- type: i0.NgModule,
1294
- args: [{
1295
- imports: [AngularFirebaseAuthModule, AngularFirestoreModule],
1296
- providers: [
1297
- AuthService,
1298
- CartService,
1299
- CheckoutService,
1300
- CheckoutSubscriptionService,
1301
- CouponService,
1302
- OrderService,
1303
- FirebaseAppProvider,
1304
- ],
1305
- }]
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
+ }]
1306
1437
  }] });
1307
1438
 
1308
- /**
1309
- * Generated bundle index. Do not edit.
1439
+ /**
1440
+ * Generated bundle index. Do not edit.
1310
1441
  */
1311
1442
 
1312
1443
  exports.AngularConnectModule = AngularConnectModule;
@@ -1316,18 +1447,8 @@
1316
1447
  exports.CartService = CartService;
1317
1448
  exports.CheckoutService = CheckoutService;
1318
1449
  exports.CheckoutSubscriptionService = CheckoutSubscriptionService;
1319
- exports.ConnectAngularFirebaseApp = ConnectAngularFirebaseApp;
1320
- exports.ConnectAngularFirebaseAuth = ConnectAngularFirebaseAuth;
1321
- exports.ConnectAngularFirebaseFirestore = ConnectAngularFirebaseFirestore;
1322
1450
  exports.CouponService = CouponService;
1323
- exports.FIREBASE_APP_NAME = FIREBASE_APP_NAME;
1324
- exports.FIREBASE_OPTIONS = FIREBASE_OPTIONS;
1325
- exports.FirebaseAppFactory = FirebaseAppFactory;
1326
- exports.FirebaseAppProvider = FirebaseAppProvider;
1327
- exports.FirebaseAuthFactory = FirebaseAuthFactory;
1328
- exports.FirebaseAuthProvider = FirebaseAuthProvider;
1329
- exports.FirebaseFirestoreFactory = FirebaseFirestoreFactory;
1330
- exports.FirebaseFirestoreProvider = FirebaseFirestoreProvider;
1451
+ exports.HomeShopService = HomeShopService;
1331
1452
  exports.OrderService = OrderService;
1332
1453
 
1333
1454
  Object.defineProperty(exports, '__esModule', { value: true });