@infrab4a/connect-angular 0.0.0-watch → 0.0.2

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 (61) hide show
  1. package/bundles/infrab4a-connect-angular.umd.js +154 -1823
  2. package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
  3. package/esm2015/infrab4a-connect-angular.js +5 -5
  4. package/esm2015/lib/angular-firebase-auth.module.js +71 -0
  5. package/esm2015/lib/angular-firestore.module.js +85 -0
  6. package/esm2015/lib/index.js +3 -0
  7. package/esm2015/public-api.js +2 -0
  8. package/fesm2015/infrab4a-connect-angular.js +147 -1301
  9. package/fesm2015/infrab4a-connect-angular.js.map +1 -1
  10. package/infrab4a-connect-angular.d.ts +5 -5
  11. package/{angular-firebase-auth.module.d.ts → lib/angular-firebase-auth.module.d.ts} +10 -10
  12. package/{angular-firestore.module.d.ts → lib/angular-firestore.module.d.ts} +10 -15
  13. package/lib/index.d.ts +2 -0
  14. package/package.json +11 -14
  15. package/public-api.d.ts +1 -0
  16. package/angular-connect.module.d.ts +0 -18
  17. package/angular-elastic-search.module.d.ts +0 -9
  18. package/angular-hasura-graphql.module.d.ts +0 -16
  19. package/consts/default-shop.const.d.ts +0 -1
  20. package/consts/es-config.const.d.ts +0 -1
  21. package/consts/hasura-options.const.d.ts +0 -1
  22. package/consts/index.d.ts +0 -3
  23. package/esm2015/angular-connect.module.js +0 -49
  24. package/esm2015/angular-elastic-search.module.js +0 -38
  25. package/esm2015/angular-firebase-auth.module.js +0 -113
  26. package/esm2015/angular-firestore.module.js +0 -340
  27. package/esm2015/angular-hasura-graphql.module.js +0 -90
  28. package/esm2015/consts/default-shop.const.js +0 -2
  29. package/esm2015/consts/es-config.const.js +0 -2
  30. package/esm2015/consts/hasura-options.const.js +0 -2
  31. package/esm2015/consts/index.js +0 -4
  32. package/esm2015/index.js +0 -6
  33. package/esm2015/services/auth.service.js +0 -42
  34. package/esm2015/services/cart.service.js +0 -153
  35. package/esm2015/services/checkout-subscription.service.js +0 -51
  36. package/esm2015/services/checkout.service.js +0 -75
  37. package/esm2015/services/coupon.service.js +0 -266
  38. package/esm2015/services/errors/group-invalid-coupon.error.js +0 -8
  39. package/esm2015/services/errors/index.js +0 -3
  40. package/esm2015/services/errors/invalid-coupon.error.js +0 -8
  41. package/esm2015/services/home-shop.service.js +0 -113
  42. package/esm2015/services/index.js +0 -8
  43. package/esm2015/services/order.service.js +0 -32
  44. package/esm2015/services/types/index.js +0 -3
  45. package/esm2015/services/types/required-checkout-data.type.js +0 -2
  46. package/esm2015/services/types/required-checkout-subscription-data.type.js +0 -2
  47. package/index.d.ts +0 -5
  48. package/services/auth.service.d.ts +0 -19
  49. package/services/cart.service.d.ts +0 -35
  50. package/services/checkout-subscription.service.d.ts +0 -18
  51. package/services/checkout.service.d.ts +0 -23
  52. package/services/coupon.service.d.ts +0 -26
  53. package/services/errors/group-invalid-coupon.error.d.ts +0 -6
  54. package/services/errors/index.d.ts +0 -2
  55. package/services/errors/invalid-coupon.error.d.ts +0 -5
  56. package/services/home-shop.service.d.ts +0 -25
  57. package/services/index.d.ts +0 -7
  58. package/services/order.service.d.ts +0 -13
  59. package/services/types/index.d.ts +0 -2
  60. package/services/types/required-checkout-data.type.d.ts +0 -2
  61. package/services/types/required-checkout-subscription-data.type.d.ts +0 -2
@@ -1,10 +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('@angular/fire/auth'), require('@infrab4a/connect'), require('js-cookie'), require('ts-custom-error'), 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', 'ts-custom-error', '@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["ts-custom-error"], global.ng.fire.firestore, global.ng.fire));
5
- })(this, (function (exports, i0, rxjs, operators, i1, i2, cookie, tsCustomError, i1$1, fire) { 'use strict';
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/fire'), require('@angular/fire/auth'), require('@infrab4a/connect'), require('@angular/fire/firestore')) :
3
+ typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', '@angular/fire', '@angular/fire/auth', '@infrab4a/connect', '@angular/fire/firestore'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a["connect-angular"] = {}), global.ng.core, global.ng.fire, global.ng.fire.auth, global.connect, global.ng.fire.firestore));
5
+ })(this, (function (exports, i0, fire, auth, connect, firestore) { 'use strict';
8
6
 
9
7
  function _interopNamespace(e) {
10
8
  if (e && e.__esModule) return e;
@@ -25,1832 +23,165 @@
25
23
  }
26
24
 
27
25
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
29
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
30
- var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
31
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
32
-
33
- /******************************************************************************
34
- Copyright (c) Microsoft Corporation.
35
-
36
- Permission to use, copy, modify, and/or distribute this software for any
37
- purpose with or without fee is hereby granted.
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 (g && (g = 0, op[0] && (_ = 0)), _)
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
- var desc = Object.getOwnPropertyDescriptor(m, k);
196
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
197
- desc = { enumerable: true, get: function () { return m[k]; } };
198
- }
199
- Object.defineProperty(o, k2, desc);
200
- }) : (function (o, m, k, k2) {
201
- if (k2 === undefined)
202
- k2 = k;
203
- o[k2] = m[k];
204
- });
205
- function __exportStar(m, o) {
206
- for (var p in m)
207
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
208
- __createBinding(o, m, p);
209
- }
210
- function __values(o) {
211
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
212
- if (m)
213
- return m.call(o);
214
- if (o && typeof o.length === "number")
215
- return {
216
- next: function () {
217
- if (o && i >= o.length)
218
- o = void 0;
219
- return { value: o && o[i++], done: !o };
220
- }
221
- };
222
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
223
- }
224
- function __read(o, n) {
225
- var m = typeof Symbol === "function" && o[Symbol.iterator];
226
- if (!m)
227
- return o;
228
- var i = m.call(o), r, ar = [], e;
229
- try {
230
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
231
- ar.push(r.value);
232
- }
233
- catch (error) {
234
- e = { error: error };
235
- }
236
- finally {
237
- try {
238
- if (r && !r.done && (m = i["return"]))
239
- m.call(i);
240
- }
241
- finally {
242
- if (e)
243
- throw e.error;
244
- }
245
- }
246
- return ar;
247
- }
248
- /** @deprecated */
249
- function __spread() {
250
- for (var ar = [], i = 0; i < arguments.length; i++)
251
- ar = ar.concat(__read(arguments[i]));
252
- return ar;
253
- }
254
- /** @deprecated */
255
- function __spreadArrays() {
256
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
257
- s += arguments[i].length;
258
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
259
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
260
- r[k] = a[j];
261
- return r;
262
- }
263
- function __spreadArray(to, from, pack) {
264
- if (pack || arguments.length === 2)
265
- for (var i = 0, l = from.length, ar; i < l; i++) {
266
- if (ar || !(i in from)) {
267
- if (!ar)
268
- ar = Array.prototype.slice.call(from, 0, i);
269
- ar[i] = from[i];
270
- }
271
- }
272
- return to.concat(ar || Array.prototype.slice.call(from));
273
- }
274
- function __await(v) {
275
- return this instanceof __await ? (this.v = v, this) : new __await(v);
276
- }
277
- function __asyncGenerator(thisArg, _arguments, generator) {
278
- if (!Symbol.asyncIterator)
279
- throw new TypeError("Symbol.asyncIterator is not defined.");
280
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
281
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
282
- function verb(n) { if (g[n])
283
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
284
- function resume(n, v) { try {
285
- step(g[n](v));
286
- }
287
- catch (e) {
288
- settle(q[0][3], e);
289
- } }
290
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
291
- function fulfill(value) { resume("next", value); }
292
- function reject(value) { resume("throw", value); }
293
- function settle(f, v) { if (f(v), q.shift(), q.length)
294
- resume(q[0][0], q[0][1]); }
295
- }
296
- function __asyncDelegator(o) {
297
- var i, p;
298
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
299
- 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; }
300
- }
301
- function __asyncValues(o) {
302
- if (!Symbol.asyncIterator)
303
- throw new TypeError("Symbol.asyncIterator is not defined.");
304
- var m = o[Symbol.asyncIterator], i;
305
- 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);
306
- 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); }); }; }
307
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
308
- }
309
- function __makeTemplateObject(cooked, raw) {
310
- if (Object.defineProperty) {
311
- Object.defineProperty(cooked, "raw", { value: raw });
312
- }
313
- else {
314
- cooked.raw = raw;
315
- }
316
- return cooked;
317
- }
318
- ;
319
- var __setModuleDefault = Object.create ? (function (o, v) {
320
- Object.defineProperty(o, "default", { enumerable: true, value: v });
321
- }) : function (o, v) {
322
- o["default"] = v;
323
- };
324
- function __importStar(mod) {
325
- if (mod && mod.__esModule)
326
- return mod;
327
- var result = {};
328
- if (mod != null)
329
- for (var k in mod)
330
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
331
- __createBinding(result, mod, k);
332
- __setModuleDefault(result, mod);
333
- return result;
334
- }
335
- function __importDefault(mod) {
336
- return (mod && mod.__esModule) ? mod : { default: mod };
337
- }
338
- function __classPrivateFieldGet(receiver, state, kind, f) {
339
- if (kind === "a" && !f)
340
- throw new TypeError("Private accessor was defined without a getter");
341
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
342
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
343
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
344
- }
345
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
346
- if (kind === "m")
347
- throw new TypeError("Private method is not writable");
348
- if (kind === "a" && !f)
349
- throw new TypeError("Private accessor was defined without a setter");
350
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
351
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
352
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
353
- }
354
- function __classPrivateFieldIn(state, receiver) {
355
- if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
356
- throw new TypeError("Cannot use 'in' operator on non-object");
357
- return typeof state === "function" ? receiver === state : state.has(receiver);
358
- }
359
-
360
- var AuthService = /** @class */ (function () {
361
- function AuthService(angularFireAuth, userRepository) {
362
- this.angularFireAuth = angularFireAuth;
363
- this.userRepository = userRepository;
364
- }
365
- AuthService.prototype.getAuthstate = function () {
366
- var observables = [
367
- this.angularFireAuth.authState.pipe(operators.catchError(function () { return rxjs.of(null); })),
368
- this.getUser().pipe(operators.catchError(function () { return rxjs.of(null); })),
369
- ];
370
- return rxjs.combineLatest(observables).pipe(operators.map(function (_a) {
371
- var _b = __read(_a, 2), fireUser = _b[0], user = _b[1];
372
- return {
373
- user: user,
374
- isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
375
- };
376
- }));
377
- };
378
- AuthService.prototype.getUser = function () {
379
- var _this = this;
380
- 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)); }));
381
- };
382
- AuthService.prototype.getTokenId = function () {
383
- return this.angularFireAuth.idToken;
384
- };
385
- AuthService.prototype.getFireUser = function () {
386
- return this.angularFireAuth.user.pipe(operators.catchError(function () { return rxjs.of(null); }));
387
- };
388
- return AuthService;
389
- }());
390
- 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 });
391
- AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService });
392
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, decorators: [{
393
- type: i0.Injectable
394
- }], ctorParameters: function () {
395
- return [{ type: i1__namespace.AngularFireAuth }, { type: undefined, decorators: [{
396
- type: i0.Inject,
397
- args: ['UserRepository']
398
- }] }];
399
- } });
400
-
401
- var DEFAULT_SHOP = 'DEFAULT_SHOP';
402
-
403
- var ES_CONFIG = 'ES_CONFIG';
404
-
405
- var HASURA_OPTIONS = 'HASURA_OPTIONS';
406
-
407
- var InvalidCouponError = /** @class */ (function (_super) {
408
- __extends(InvalidCouponError, _super);
409
- function InvalidCouponError(message) {
410
- var _this = _super.call(this, message) || this;
411
- _this.message = message;
412
- return _this;
413
- }
414
- return InvalidCouponError;
415
- }(tsCustomError.CustomError));
416
-
417
- var GroupInvalidCouponError = /** @class */ (function (_super) {
418
- __extends(GroupInvalidCouponError, _super);
419
- function GroupInvalidCouponError(errors) {
420
- var _this = _super.call(this, 'Many coupon errors throw') || this;
421
- _this.errors = errors;
422
- return _this;
423
- }
424
- return GroupInvalidCouponError;
425
- }(tsCustomError.CustomError));
426
-
427
- var CouponService = /** @class */ (function () {
428
- function CouponService(couponRepository, defaultShop, orderRepository, subscriptionRepository, categoryRepository) {
429
- var _this = this;
430
- this.couponRepository = couponRepository;
431
- this.defaultShop = defaultShop;
432
- this.orderRepository = orderRepository;
433
- this.subscriptionRepository = subscriptionRepository;
434
- this.categoryRepository = categoryRepository;
435
- this.emailIsFromCollaborator = function (userEmail) { return !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g)); };
436
- this.separateValidCoupons = function (coupons, userEmail) { return coupons
437
- .map(function (coupon) {
438
- try {
439
- if (!(coupon instanceof i2.Coupon))
440
- throw new InvalidCouponError('Cupom inválido.');
441
- if (_this.isValidCoupon(coupon, userEmail))
442
- return coupon;
443
- }
444
- catch (error) {
445
- return error;
446
- }
447
- })
448
- .reduce(function (current, coupon) { return (Object.assign(Object.assign({}, current), (coupon instanceof i2.Coupon
449
- ? { valids: __spreadArray(__spreadArray([], __read(current.valids)), [coupon]) }
450
- : { invalids: __spreadArray(__spreadArray([], __read(current.invalids)), [coupon]) }))); }, {
451
- valids: [],
452
- invalids: [],
453
- }); };
454
- }
455
- CouponService.prototype.checkCoupon = function (nickname, userEmail, checkoutType, plan, checkout, isSubscription) {
456
- var _this = this;
457
- return rxjs.from(this.couponRepository.find({
458
- filters: {
459
- nickname: { operator: i2.Where.EQUALS, value: nickname },
460
- active: { operator: i2.Where.EQUALS, value: true },
461
- },
462
- })).pipe(operators.concatMap(function (coupons) { return _this.checkCouponRules(coupons, checkoutType, plan, checkout, isSubscription); }), operators.concatMap(function (coupon) { return _this.checkCouponUseAndLimit(coupon, userEmail, checkout); }), operators.map(function (coupon) { return _this.isValidCoupon(coupon, userEmail); }), operators.map(function (coupon) { return coupon; }));
463
- };
464
- CouponService.prototype.checkCouponRules = function (coupons, checkoutType, plan, checkout, isSubscription) {
465
- // Caso não ache nenhum cupom, retorna erro
466
- if (coupons.count < 1) {
467
- return rxjs.throwError('Cupom inválido.');
468
- }
469
- // Get Primeiro Cupom (o find do repository retorna um array)
470
- var coupon = coupons.data.shift();
471
- // Verifica se o cupom é aplicavel na loja
472
- var isInShop = coupon.shopAvailability === i2.Shops.ALL || coupon.shopAvailability === this.defaultShop;
473
- // Cupon não aplicavel a loja retorna erro
474
- if (!isInShop)
475
- return rxjs.throwError('Cupom inválido para loja.');
476
- // Verifica se o coupon é aplicado no checkout que está sendo realizado
477
- var isCheckoutType = coupon.checkoutType === i2.CheckoutTypes.ALL || coupon.checkoutType === checkoutType;
478
- // Cupon não aplicavel ao checkout retorna erro
479
- if (!isCheckoutType)
480
- return rxjs.throwError('Cupom inválido. Erro de checkout.');
481
- // Verifica se o cupom é ou pode ser aplicado para subscription
482
- if (checkoutType === i2.CheckoutTypes.ALL || checkoutType === i2.CheckoutTypes.SUBSCRIPTION) {
483
- // Se o cupom tiver um plano associado, verifica se é o mesmo plano do checkout da assinatura
484
- if (coupon.plan && coupon.plan.toUpperCase() !== plan.toUpperCase())
485
- return rxjs.throwError('Cupom inválido para sua assinatura.');
486
- }
487
- if (isSubscription)
488
- return rxjs.of(coupon);
489
- // Verifica se possui o valor minimo de compra para utilização do cupom
490
- var hasMinSubTotal = this.hasMinSubTotal(coupon, checkout);
491
- // Se não tem valor mínimo atingido, retorna erro
492
- if (!hasMinSubTotal)
493
- return rxjs.throwError('Valor mínimo não atingido');
494
- return rxjs.of(coupon);
495
- };
496
- CouponService.prototype.isValidCoupon = function (coupon, userEmail) {
497
- // Verifica a data de inicio de validade do cupom
498
- if ((coupon === null || coupon === void 0 ? void 0 : coupon.beginAt) > new Date())
499
- throw new InvalidCouponError('Cupom ainda não liberado.');
500
- // Verifica a data de validade do cupom
501
- if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) < new Date())
502
- throw new InvalidCouponError('Cupom expirado.');
503
- return coupon;
504
- };
505
- CouponService.prototype.checkCouponUseAndLimit = function (coupon, userEmail, checkout) {
506
- return __awaiter(this, void 0, void 0, function () {
507
- var orders, ordersUserCoupon, validUser, hasProductCategories;
508
- return __generator(this, function (_d) {
509
- switch (_d.label) {
510
- case 0: return [4 /*yield*/, this.orderRepository.find({
511
- filters: {
512
- coupon: { id: coupon.id },
513
- payment: { status: 'paid' },
514
- },
515
- })];
516
- case 1:
517
- orders = _d.sent();
518
- ordersUserCoupon = orders.data.filter(function (o) { return o.user.email == userEmail; });
519
- // Verifica o limite de uso de cupom por usuario
520
- if (coupon.useLimitPerUser && ordersUserCoupon.length)
521
- throw new InvalidCouponError('Limite de uso por usuário atingido.');
522
- // Verifica o limite de uso geral por usuario
523
- if (coupon.useLimit && orders.data.length >= coupon.useLimit)
524
- throw new InvalidCouponError('Limite de uso atingido.');
525
- return [4 /*yield*/, this.userValidationAndSubscriptionStatus(coupon, userEmail)];
526
- case 2:
527
- validUser = _d.sent();
528
- if (!validUser)
529
- throw new InvalidCouponError('Usuário não elegível.');
530
- return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
531
- case 3:
532
- hasProductCategories = _d.sent();
533
- if (!hasProductCategories)
534
- throw 'Seu carrinho não possui produtos elegíveis para desconto.';
535
- return [2 /*return*/, coupon];
536
- }
537
- });
538
- });
539
- };
540
- CouponService.prototype.calcDiscountSubscription = function (coupon, checkout) {
541
- //
542
- var discount = 0;
543
- if (coupon.type === i2.CouponTypes.ABSOLUTE)
544
- discount = coupon.discount;
545
- else if (coupon.type === i2.CouponTypes.PERCENTAGE)
546
- discount = checkout.subscriptionPlan.recurrencePrice * (coupon.discount / 100);
547
- return rxjs.of(discount);
548
- };
549
- CouponService.prototype.calcDiscountShopping = function (coupon, checkout) {
550
- return __awaiter(this, void 0, void 0, function () {
551
- var discount, _d;
552
- return __generator(this, function (_e) {
553
- switch (_e.label) {
554
- case 0:
555
- discount = 0;
556
- _d = coupon.type;
557
- switch (_d) {
558
- case i2.CouponTypes.ABSOLUTE: return [3 /*break*/, 1];
559
- case i2.CouponTypes.PERCENTAGE: return [3 /*break*/, 2];
560
- }
561
- return [3 /*break*/, 4];
562
- case 1:
563
- {
564
- discount = coupon.discount;
565
- return [3 /*break*/, 4];
566
- }
567
- _e.label = 2;
568
- case 2: return [4 /*yield*/, this.calcShoppingPercentageDiscount(coupon, checkout)];
569
- case 3:
570
- discount = _e.sent();
571
- return [3 /*break*/, 4];
572
- case 4: return [2 /*return*/, discount];
573
- }
574
- });
575
- });
576
- };
577
- CouponService.prototype.calcShoppingPercentageDiscount = function (coupon, checkout) {
578
- var _a;
579
- return __awaiter(this, void 0, void 0, function () {
580
- var discount, shop, lineItensDiscount, couponCategories, subTotal;
581
- return __generator(this, function (_d) {
582
- switch (_d.label) {
583
- case 0:
584
- discount = 0;
585
- shop = checkout.shop;
586
- lineItensDiscount = [];
587
- return [4 /*yield*/, this.getCouponCategoriesId(coupon)];
588
- case 1:
589
- couponCategories = _d.sent();
590
- if (coupon.productsCategories && coupon.productsCategories.length) {
591
- lineItensDiscount = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
592
- var _a;
593
- if ((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length) {
594
- return i.categories.some(function (c) { return couponCategories.some(function (cat) { return (cat.id == c || cat.firestoreId == c); }); });
595
- }
596
- return true;
597
- });
598
- }
599
- else {
600
- lineItensDiscount = checkout.lineItems;
601
- }
602
- subTotal = lineItensDiscount.reduce(function (acc, curr) {
603
- var _a, _b, _c;
604
- return ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber) && ((_b = curr.price[shop]) === null || _b === void 0 ? void 0 : _b.subscriberPrice)
605
- ? acc + ((_c = curr.price[shop]) === null || _c === void 0 ? void 0 : _c.subscriberPrice) * curr.quantity
606
- : acc + curr.pricePaid * curr.quantity;
607
- }, 0) || 0;
608
- discount = subTotal * (coupon.discount / 100);
609
- return [2 /*return*/, discount];
610
- }
611
- });
612
- });
613
- };
614
- CouponService.prototype.hasMinSubTotal = function (coupon, checkout) {
615
- var _a;
616
- if (!coupon.minSubTotalValue)
617
- return true;
618
- var shop = checkout.shop;
619
- var subTotal = ((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, curr) {
620
- var _a, _b, _c;
621
- return ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber) && ((_b = curr.price[shop]) === null || _b === void 0 ? void 0 : _b.subscriberPrice)
622
- ? acc + ((_c = curr.price[shop]) === null || _c === void 0 ? void 0 : _c.subscriberPrice) * curr.quantity
623
- : acc + curr.pricePaid * curr.quantity;
624
- }, 0)) || 0;
625
- if (coupon.minSubTotalValue <= subTotal)
626
- return true;
627
- return false;
628
- };
629
- CouponService.prototype.hasProductCategories = function (coupon, checkout) {
630
- var _a;
631
- return __awaiter(this, void 0, void 0, function () {
632
- var couponCategories, hasCategories;
633
- return __generator(this, function (_d) {
634
- switch (_d.label) {
635
- case 0:
636
- if (!coupon.productsCategories || !coupon.productsCategories.length) {
637
- return [2 /*return*/, true];
638
- }
639
- return [4 /*yield*/, this.getCouponCategoriesId(coupon)];
640
- case 1:
641
- couponCategories = _d.sent();
642
- hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
643
- var _a;
644
- if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length))
645
- return true;
646
- return i.categories.some(function (c) { return couponCategories.some(function (cat) { return (cat.id == c || cat.firestoreId == c); }); });
647
- });
648
- return [2 /*return*/, hasCategories.length ? true : false];
649
- }
650
- });
651
- });
652
- };
653
- CouponService.prototype.userValidationAndSubscriptionStatus = function (coupon, userEmail) {
654
- return __awaiter(this, void 0, void 0, function () {
655
- var couponRuleSubscription, sub, activeSubs;
656
- return __generator(this, function (_d) {
657
- switch (_d.label) {
658
- case 0:
659
- // Verifica se o email do usuário é coorporativo
660
- if (!this.emailIsFromCollaborator(userEmail) && coupon.exclusivityType === i2.Exclusivities.COLLABORATORS)
661
- throw new InvalidCouponError('Você não é colaborador.');
662
- // Verifica se o email do usuário é associado ao cupom de uso por usuario
663
- if (coupon.exclusivityType === i2.Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== userEmail)
664
- throw new InvalidCouponError('Cupom não é válido para este usuário.');
665
- couponRuleSubscription = coupon.exclusivityType === i2.Exclusivities.ACTIVE_SUBSCRIBER ||
666
- coupon.exclusivityType === i2.Exclusivities.INACTIVE_SUBSCRIBER ||
667
- coupon.exclusivityType === i2.Exclusivities.NON_SUBSCRIBER;
668
- if (!(couponRuleSubscription && userEmail)) return [3 /*break*/, 2];
669
- return [4 /*yield*/, this.subscriptionRepository
670
- .find({
671
- filters: {
672
- user: {
673
- email: { operator: i2.Where.EQUALS, value: userEmail },
674
- },
675
- },
676
- })
677
- .then(function (sub) { return sub.data; })];
678
- case 1:
679
- sub = _d.sent();
680
- activeSubs = sub === null || sub === void 0 ? void 0 : sub.filter(function (s) { return s.status === i2.Status.ACTIVE; });
681
- switch (coupon.exclusivityType) {
682
- case i2.Exclusivities.ACTIVE_SUBSCRIBER:
683
- return [2 /*return*/, activeSubs.length > 0];
684
- case i2.Exclusivities.INACTIVE_SUBSCRIBER:
685
- return [2 /*return*/, activeSubs.length === 0];
686
- case i2.Exclusivities.NON_SUBSCRIBER:
687
- return [2 /*return*/, sub.length === 0];
688
- default:
689
- return [2 /*return*/, false];
690
- }
691
- _d.label = 2;
692
- case 2: return [2 /*return*/, true];
693
- }
694
- });
695
- });
696
- };
697
- CouponService.prototype.getCouponCategoriesId = function (coupon) {
698
- return __awaiter(this, void 0, void 0, function () {
699
- var couponCategories, index, c;
700
- return __generator(this, function (_d) {
701
- switch (_d.label) {
702
- case 0:
703
- couponCategories = [];
704
- index = 0;
705
- _d.label = 1;
706
- case 1:
707
- if (!(index < coupon.productsCategories.length)) return [3 /*break*/, 4];
708
- return [4 /*yield*/, this.categoryRepository.get({ id: coupon.productsCategories[index] })];
709
- case 2:
710
- c = _d.sent();
711
- couponCategories.push({ id: c.id, firestoreId: c.firestoreId });
712
- _d.label = 3;
713
- case 3:
714
- index++;
715
- return [3 /*break*/, 1];
716
- case 4: return [2 /*return*/, couponCategories];
717
- }
718
- });
719
- });
720
- };
721
- return CouponService;
722
- }());
723
- CouponService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }, { token: 'OrderRepository' }, { token: 'SubscriptionRepository' }, { token: 'CategoryRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
724
- CouponService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, providedIn: 'root' });
725
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, decorators: [{
726
- type: i0.Injectable,
727
- args: [{
728
- providedIn: 'root',
729
- }]
730
- }], ctorParameters: function () {
731
- return [{ type: undefined, decorators: [{
732
- type: i0.Inject,
733
- args: ['CouponRepository']
734
- }] }, { type: i2__namespace.Shops, decorators: [{
735
- type: i0.Inject,
736
- args: [DEFAULT_SHOP]
737
- }] }, { type: undefined, decorators: [{
738
- type: i0.Inject,
739
- args: ['OrderRepository']
740
- }] }, { type: undefined, decorators: [{
741
- type: i0.Inject,
742
- args: ['SubscriptionRepository']
743
- }] }, { type: undefined, decorators: [{
744
- type: i0.Inject,
745
- args: ['CategoryRepository']
746
- }] }];
747
- } });
748
-
749
- var CheckoutService = /** @class */ (function () {
750
- function CheckoutService(couponService, checkoutRepository, orderRepository, userRepository, defaultShop) {
751
- this.couponService = couponService;
752
- this.checkoutRepository = checkoutRepository;
753
- this.orderRepository = orderRepository;
754
- this.userRepository = userRepository;
755
- this.defaultShop = defaultShop;
756
- }
757
- CheckoutService.prototype.getCheckout = function (checkoutData) {
758
- var checkoutId = cookie__default["default"].get('checkoutId');
759
- if (!i2.isNil(checkoutId))
760
- return rxjs.from(this.checkoutRepository.get({ id: checkoutId }));
761
- return rxjs.from(this.createCheckout(checkoutData));
762
- };
763
- CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
764
- var _this = this;
765
- 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'); }); }));
766
- };
767
- CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
768
- return rxjs.from(this.checkoutRepository.update(i2.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
769
- };
770
- CheckoutService.prototype.updateCheckoutUser = function (checkout) {
771
- return rxjs.from(this.checkoutRepository.update(i2.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
772
- };
773
- CheckoutService.prototype.clearCheckoutFromSession = function () {
774
- cookie__default["default"].remove('checkoutId');
775
- return rxjs.of();
776
- };
777
- CheckoutService.prototype.calcDiscount = function (coupon) {
778
- var _this = this;
779
- return this.getCheckout().pipe(operators.concatMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
780
- switch (_b.label) {
781
- case 0: return [4 /*yield*/, this.couponService.calcDiscountShopping(coupon, checkout)];
782
- case 1: return [2 /*return*/, _b.sent()];
783
- }
784
- }); }); }));
785
- };
786
- CheckoutService.prototype.checkCoupon = function (nickname, checkoutType) {
787
- var _this = this;
788
- return this.getCheckout().pipe(operators.concatMap(function (checkout) {
789
- var _a;
790
- return _this.couponService
791
- .checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email, i2.CheckoutTypes.ECOMMERCE, checkout.user.subscriptionPlan, checkout, false)
792
- .pipe();
793
- }));
794
- };
795
- CheckoutService.prototype.createCheckout = function (checkoutData) {
796
- return __awaiter(this, void 0, void 0, function () {
797
- var checkout;
798
- return __generator(this, function (_b) {
799
- switch (_b.label) {
800
- 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 }))];
801
- case 1:
802
- checkout = _b.sent();
803
- cookie__default["default"].set('checkoutId', checkout.id);
804
- return [2 /*return*/, checkout];
805
- }
806
- });
807
- });
808
- };
809
- return CheckoutService;
810
- }());
811
- 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 });
812
- CheckoutService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService });
813
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, decorators: [{
814
- type: i0.Injectable
815
- }], ctorParameters: function () {
816
- return [{ type: CouponService }, { type: undefined, decorators: [{
817
- type: i0.Inject,
818
- args: ['CheckoutRepository']
819
- }] }, { type: undefined, decorators: [{
820
- type: i0.Inject,
821
- args: ['OrderRepository']
822
- }] }, { type: undefined, decorators: [{
823
- type: i0.Inject,
824
- args: ['UserRepository']
825
- }] }, { type: i2__namespace.Shops, decorators: [{
826
- type: i0.Inject,
827
- args: [DEFAULT_SHOP]
828
- }] }];
829
- } });
830
-
831
- var CartService = /** @class */ (function () {
832
- function CartService(authService, checkoutService, defaultShop, productRepository) {
833
- var _this = this;
834
- this.authService = authService;
835
- this.checkoutService = checkoutService;
836
- this.defaultShop = defaultShop;
837
- this.productRepository = productRepository;
838
- this.cartSubject = new rxjs.Subject();
839
- this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i2.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
840
- var _a;
841
- var items = [];
842
- var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.sku; }).indexOf(lineItem.sku);
843
- if (index > -1) {
844
- checkoutLoaded.lineItems[index].quantity += quantity;
845
- checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
846
- }
847
- else
848
- checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
849
- return _this.checkoutService
850
- .updateCheckoutLineItems(checkoutLoaded)
851
- .pipe(operators.map(function (updatedCheckout) { return _this.generateCartObject(updatedCheckout.lineItems); }));
852
- })); };
853
- this.generateCartObject = function (items) {
854
- var cart = {};
855
- items === null || items === void 0 ? void 0 : items.forEach(function (item) {
856
- var _a;
857
- 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) })));
858
- });
859
- return cart;
860
- };
861
- this.buildLineItem = function (_h) {
862
- var checkout = _h.checkout, item = _h.item, quantity = _h.quantity;
863
- return __awaiter(_this, void 0, void 0, function () {
864
- var _a, _b, _c, _d, _e, _f, _g, product, image, id, name, EAN, brand, slug, stock, price, weight, categories, sku, type, isGift, pricePaid;
865
- return __generator(this, function (_h) {
866
- switch (_h.label) {
867
- case 0: return [4 /*yield*/, this.productRepository.get({ id: item.id })];
868
- case 1:
869
- product = _h.sent();
870
- 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;
871
- if (this.checkMaxStock(item, quantity || 0))
872
- throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
873
- image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
874
- id = item.id, name = item.name, EAN = item.EAN, brand = item.brand, slug = item.slug, stock = item.stock, price = item.price, weight = item.weight, categories = item.categories, sku = item.sku, type = item.type;
875
- isGift = item.isGift || null;
876
- pricePaid = this.getProductPrice({
877
- product: item,
878
- shop: checkout.shop || this.defaultShop,
879
- isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
880
- });
881
- return [2 /*return*/, {
882
- checkout: checkout,
883
- lineItem: i2.LineItem.toInstance({
884
- id: id,
885
- name: name !== null && name !== void 0 ? name : product.name,
886
- EAN: EAN !== null && EAN !== void 0 ? EAN : product.EAN,
887
- brand: product.brand,
888
- slug: slug !== null && slug !== void 0 ? slug : product.slug,
889
- sku: sku !== null && sku !== void 0 ? sku : product.sku,
890
- stock: stock,
891
- price: price,
892
- image: image,
893
- weight: weight !== null && weight !== void 0 ? weight : product.weight,
894
- quantity: (item.quantity || 0) + (quantity || 0),
895
- pricePaid: pricePaid,
896
- categories: (_f = product.categories) !== null && _f !== void 0 ? _f : [],
897
- isGift: isGift !== null && isGift !== void 0 ? isGift : null,
898
- costPrice: (_g = product.costPrice) !== null && _g !== void 0 ? _g : 0,
899
- type: type,
900
- }),
901
- }];
902
- }
903
- });
904
- });
905
- };
906
- this.getProductPrice = function (_h) {
907
- var product = _h.product, isSubscriber = _h.isSubscriber;
908
- var info = product.price;
909
- if (product.isGift)
910
- return 0;
911
- return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
912
- };
913
- this.checkMaxStock = function (item, quantity) {
914
- var _a;
915
- var maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
916
- var currentItemAmount = item.quantity || 0;
917
- return currentItemAmount + quantity > maxStock;
918
- };
919
- }
920
- CartService.prototype.addItem = function (item, quantity) {
921
- var _this = this;
922
- if (quantity === void 0) { quantity = 1; }
923
- return rxjs.from(this.checkoutService.getCheckout()).pipe(operators.concatMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_h) {
924
- switch (_h.label) {
925
- case 0: return [4 /*yield*/, this.buildLineItem({ checkout: checkout, item: item, quantity: quantity || 1 })];
926
- case 1: return [2 /*return*/, _h.sent()];
927
- }
928
- }); }); }), operators.mergeMap(function (_h) {
929
- var checkout = _h.checkout, lineItem = _h.lineItem;
930
- return _this.updateLineItemInCart(lineItem, quantity || 1, checkout);
931
- }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
932
- };
933
- CartService.prototype.decreaseItem = function (item) {
934
- var _this = this;
935
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
936
- var _a;
937
- var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; });
938
- if (!i2.isNil(checkoutItem))
939
- checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
940
- return checkout;
941
- }), 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); }));
942
- };
943
- CartService.prototype.getCart = function (checkout) {
944
- var _this = this;
945
- this.buildCartFromCheckout(checkout).subscribe(function (cart) { return _this.cartSubject.next(cart); });
946
- return this.cartSubject;
947
- };
948
- /**
949
- * @deprecated The method should not be used
950
- */
951
- CartService.prototype.getVariantPriceDiscount = function (item) {
952
- return this.authService.getUser().pipe(operators.concatMap(function (user) { return rxjs.iif(function () { return user.isSubscriber && !!item.price.subscriberPrice; }, rxjs.of(item.price.subscriberPrice), rxjs.of(item.price.price)); }), operators.catchError(function () { return rxjs.of(item.price.price); }));
953
- };
954
- CartService.prototype.removeItem = function (item) {
955
- var _this = this;
956
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
957
- var index = checkout.lineItems.findIndex(function (lineItem) { return lineItem.sku === item.sku; });
958
- if (index >= 0)
959
- checkout.lineItems.splice(index, 1);
960
- return checkout;
961
- }), 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); }));
962
- };
963
- CartService.prototype.updateUserCart = function (user) {
964
- var _this = this;
965
- 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) { return __awaiter(_this, void 0, void 0, function () {
966
- var _a, _b, _h, _j, _k, _l, _m, _o, _p, _q, _r;
967
- var _this = this;
968
- return __generator(this, function (_s) {
969
- switch (_s.label) {
970
- case 0:
971
- _j = (_h = this.checkoutService).updateCheckoutLineItems;
972
- _l = (_k = i2.Checkout).toInstance;
973
- _o = (_m = Object).assign;
974
- _p = [Object.assign({}, checkout.toPlain())];
975
- _q = {};
976
- if (!((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/, 2];
977
- return [4 /*yield*/, Promise.all((_b = checkout.lineItems) === null || _b === void 0 ? void 0 : _b.map(function (item) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_h) {
978
- switch (_h.label) {
979
- case 0: return [4 /*yield*/, this.buildLineItem({ checkout: checkout, item: item })];
980
- case 1: return [2 /*return*/, (_h.sent()).lineItem];
981
- }
982
- }); }); }))];
983
- case 1:
984
- _r = _s.sent();
985
- return [3 /*break*/, 3];
986
- case 2:
987
- _r = [];
988
- _s.label = 3;
989
- case 3: return [2 /*return*/, _j.apply(_h, [_l.apply(_k, [_o.apply(_m, _p.concat([(_q.lineItems = _r, _q)]))])]).toPromise()];
990
- }
991
- });
992
- }); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
993
- };
994
- CartService.prototype.clearCart = function () {
995
- var _this = this;
996
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
997
- _this.checkoutService.clearCheckoutFromSession();
998
- return checkout;
999
- }), operators.concatMap(function (oldCheckout) { return _this.buildCartFromCheckout(oldCheckout); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
1000
- };
1001
- CartService.prototype.buildCartFromCheckout = function (checkoutData) {
1002
- var _this = this;
1003
- return this.checkoutService.getCheckout(checkoutData).pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.concatMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
1004
- };
1005
- return CartService;
1006
- }());
1007
- 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 }, { token: 'ProductRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1008
- CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService });
1009
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, decorators: [{
1010
- type: i0.Injectable
1011
- }], ctorParameters: function () {
1012
- return [{ type: AuthService }, { type: CheckoutService }, { type: i2__namespace.Shops, decorators: [{
1013
- type: i0.Inject,
1014
- args: [DEFAULT_SHOP]
1015
- }] }, { type: undefined, decorators: [{
1016
- type: i0.Inject,
1017
- args: ['ProductRepository']
1018
- }] }];
1019
- } });
1020
26
 
1021
- var CheckoutSubscriptionService = /** @class */ (function () {
1022
- function CheckoutSubscriptionService(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
1023
- this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
1024
- this.subscriptionRepository = subscriptionRepository;
1025
- this.couponService = couponService;
1026
- }
1027
- CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
1028
- var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
1029
- if (!i2.isNil(checkoutId))
1030
- return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
1031
- return rxjs.from(this.createCheckoutSubscription(checkoutData));
1032
- };
1033
- CheckoutSubscriptionService.prototype.createCheckoutSubscription = function (checkoutData) {
1034
- return __awaiter(this, void 0, void 0, function () {
1035
- var checkout;
1036
- return __generator(this, function (_a) {
1037
- switch (_a.label) {
1038
- case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i2.CheckoutSubscription.toInstance(i2.pick(checkoutData, ['user', 'shop'])).toPlain()))];
1039
- case 1:
1040
- checkout = _a.sent();
1041
- cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
1042
- return [2 /*return*/, checkout];
1043
- }
1044
- });
1045
- });
1046
- };
1047
- CheckoutSubscriptionService.prototype.clearCheckoutSubscriptionFromSession = function () {
1048
- cookie__default["default"].remove('checkoutSubscriptionId');
1049
- return rxjs.of();
1050
- };
1051
- CheckoutSubscriptionService.prototype.checkCoupon = function (nickname, userEmail) {
1052
- var _this = this;
1053
- return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService.checkCoupon(nickname, userEmail, i2.CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, null, true).pipe(); }));
1054
- };
1055
- CheckoutSubscriptionService.prototype.calcDiscountSubscription = function (coupon) {
1056
- var _this = this;
1057
- return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService.calcDiscountSubscription(coupon, checkout).pipe(); }));
1058
- };
1059
- return CheckoutSubscriptionService;
1060
- }());
1061
- 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 });
1062
- CheckoutSubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService });
1063
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, decorators: [{
1064
- type: i0.Injectable
1065
- }], ctorParameters: function () {
1066
- return [{ type: undefined, decorators: [{
1067
- type: i0.Inject,
1068
- args: ['CheckoutSubscriptionRepository']
1069
- }] }, { type: undefined, decorators: [{
1070
- type: i0.Inject,
1071
- args: ['SubscriptionRepository']
1072
- }] }, { type: CouponService }];
1073
- } });
1074
-
1075
- var OrderService = /** @class */ (function () {
1076
- function OrderService(angularFirestore, orderRepository) {
1077
- this.angularFirestore = angularFirestore;
1078
- this.orderRepository = orderRepository;
1079
- this.orderSubject = new rxjs.Subject();
1080
- }
1081
- OrderService.prototype.getOrder = function (id) {
1082
- var _this = this;
1083
- this.angularFirestore
1084
- .doc(this.orderRepository.collectionName + "/" + id)
1085
- .valueChanges()
1086
- .pipe(operators.map(function (doc) { return i2.Order.toInstance(doc); }))
1087
- .subscribe(function (doc) { return _this.orderSubject.next(doc); });
1088
- return this.orderSubject;
1089
- };
1090
- return OrderService;
1091
- }());
1092
- 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 });
1093
- OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
1094
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
1095
- type: i0.Injectable
1096
- }], ctorParameters: function () {
1097
- return [{ type: i1__namespace$1.AngularFirestore }, { type: i2__namespace.OrderFirestoreRepository, decorators: [{
1098
- type: i0.Inject,
1099
- args: ['OrderRepository']
1100
- }] }];
1101
- } });
1102
-
1103
- var HomeShopService = /** @class */ (function () {
1104
- function HomeShopService(categoryRepository, homeRepository, productRepository, defaultShop) {
1105
- this.categoryRepository = categoryRepository;
1106
- this.homeRepository = homeRepository;
1107
- this.productRepository = productRepository;
1108
- this.defaultShop = defaultShop;
1109
- this.buildCategoryGroupWithRequiredData = function (group) { return ({
1110
- category: i2.Category.toInstance(i2.pick(group.category.toPlain(), ['id', 'name', 'slug', 'conditions'])),
1111
- products: group.products.map(function (product) { return i2.Product.toInstance(i2.pick(product.toPlain(), [
1112
- 'id',
1113
- 'price',
1114
- 'reviews',
1115
- 'hasVariants',
1116
- 'slug',
1117
- 'sku',
1118
- 'stock',
1119
- 'costPrice',
1120
- 'images',
1121
- 'miniatures',
1122
- 'name',
1123
- 'weight',
1124
- 'rate',
1125
- 'type'
1126
- ])); }),
1127
- }); };
1128
- }
1129
- Object.defineProperty(HomeShopService.prototype, "homeId", {
1130
- get: function () {
1131
- if (this.defaultShop === i2.Shops.GLAMSHOP)
1132
- return 'glamshop';
1133
- if (this.defaultShop === i2.Shops.MENSMARKET)
1134
- return 'mens_market';
1135
- return null;
1136
- },
1137
- enumerable: false,
1138
- configurable: true
1139
- });
1140
- HomeShopService.prototype.getHomeData = function () {
1141
- var _this = this;
1142
- return this.getHomeConfiguration().pipe(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
1143
- ? rxjs.of(home)
1144
- : rxjs.forkJoin([_this.getDiscoverProducts(), _this.getFeaturedProducts(), _this.getVerticalProducts()]).pipe(operators.map(function (_b) {
1145
- var _c = __read(_b, 3), discoverProducts = _c[0], featuredProducts = _c[1], verticalProducts = _c[2];
1146
- return ({
1147
- discoverProducts: discoverProducts,
1148
- featuredProducts: featuredProducts,
1149
- verticalProducts: verticalProducts,
1150
- });
1151
- }), operators.concatMap(function (data) { return _this.saveHomeData(data); })); }));
1152
- };
1153
- HomeShopService.prototype.getBanners = function (type) {
1154
- return this.getHomeConfiguration().pipe(operators.map(function (home) {
1155
- if (type === 'brand')
1156
- return home.brandsCarousel;
1157
- if (type === 'buyToWin')
1158
- return [home.buyToWinBanner];
1159
- if (type === 'block')
1160
- return home.blockBanners;
1161
- if (type === 'blog')
1162
- return [home.blogBanner];
1163
- }));
1164
- };
1165
- HomeShopService.prototype.getMinValueForFreeShipping = function () {
1166
- return this.getHomeConfiguration().pipe(operators.map(function (home) { return home.minValueForFreeShipping; }));
1167
- };
1168
- HomeShopService.prototype.getDiscoverProducts = function () {
1169
- var _this = this;
1170
- 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); })); }));
1171
- };
1172
- HomeShopService.prototype.getFeaturedProducts = function () {
1173
- var _this = this;
1174
- 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); })); }));
1175
- };
1176
- HomeShopService.prototype.getVerticalProducts = function () {
1177
- var _this = this;
1178
- return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.forkJoin(home.verticalCarousels.filter(Boolean).map(function (id) { return rxjs.from(_this.categoryRepository.get({ id: id })).pipe(operators.concatMap(function (category) { return rxjs.from(_this.productRepository.find({
1179
- filters: { categories: { operator: i2.Where.IN, value: [category.id] } },
1180
- limits: { limit: 12 },
1181
- })).pipe(operators.map(function (products) { return ({ category: category, products: products }); })); }), operators.map(function (_b) {
1182
- var category = _b.category, products = _b.products;
1183
- return ({ category: category, products: products.data });
1184
- }), operators.map(_this.buildCategoryGroupWithRequiredData)); })); }));
1185
- };
1186
- HomeShopService.prototype.getHomeConfiguration = function () {
1187
- var _this = this;
1188
- return rxjs.of(this.homeConfiguration).pipe(operators.concatMap(function (home) { return home
1189
- ? rxjs.of(home)
1190
- : !_this.homeId
1191
- ? rxjs.throwError(new i2.RequiredArgumentError(['homeId']))
1192
- : rxjs.from(_this.homeRepository.get({ id: _this.homeId })).pipe(operators.tap(function (homeLoaded) { return (_this.homeConfiguration = homeLoaded); })); }));
1193
- };
1194
- HomeShopService.prototype.saveHomeData = function (homeData) {
1195
- var _this = this;
1196
- var data = {
1197
- createdAt: new Date(),
1198
- expiresAt: i2.add(new Date(), { hours: 1 }),
1199
- data: homeData,
1200
- };
1201
- return rxjs.from(this.homeRepository.update({
1202
- id: this.homeId,
1203
- data: data,
1204
- })).pipe(operators.tap(function () { return (_this.homeConfiguration.data = data); }), operators.map(function () { return _this.homeConfiguration; }));
1205
- };
1206
- return HomeShopService;
1207
- }());
1208
- 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 });
1209
- HomeShopService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService });
1210
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService, decorators: [{
1211
- type: i0.Injectable
1212
- }], ctorParameters: function () {
1213
- return [{ type: undefined, decorators: [{
1214
- type: i0.Inject,
1215
- args: ['CategoryRepository']
1216
- }] }, { type: undefined, decorators: [{
1217
- type: i0.Inject,
1218
- args: ['HomeRepository']
1219
- }] }, { type: undefined, decorators: [{
1220
- type: i0.Inject,
1221
- args: ['ProductRepository']
1222
- }] }, { type: i2__namespace.Shops, decorators: [{
1223
- type: i0.Inject,
1224
- args: [DEFAULT_SHOP]
1225
- }] }];
1226
- } });
1227
-
1228
- var AngularFirebaseAuthModule = /** @class */ (function () {
1229
- function AngularFirebaseAuthModule() {
1230
- }
1231
- AngularFirebaseAuthModule.initializeApp = function (options, nameOrConfig) {
1232
- return {
1233
- ngModule: AngularFirebaseAuthModule,
1234
- providers: [
1235
- { provide: fire.FIREBASE_OPTIONS, useValue: options },
1236
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
1237
- ],
1238
- };
1239
- };
1240
- return AngularFirebaseAuthModule;
1241
- }());
1242
- AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1243
- AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [fire.AngularFireModule] });
1244
- AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
1245
- {
1246
- provide: 'Authentication',
1247
- useFactory: function (authenticationService, userRepository) {
1248
- return new i2.Authentication(authenticationService, userRepository);
1249
- },
1250
- deps: ['AuthenticationService', 'UserRepository'],
1251
- },
1252
- {
1253
- provide: 'AuthenticationService',
1254
- useFactory: function (angularFireAuth) {
1255
- return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
1256
- },
1257
- deps: [i1.AngularFireAuth],
1258
- },
1259
- {
1260
- provide: 'Register',
1261
- useFactory: function (registerService, userRepository) {
1262
- return new i2.Register(registerService, userRepository);
1263
- },
1264
- deps: ['RegisterService', 'UserRepository'],
1265
- },
1266
- {
1267
- provide: 'RegisterService',
1268
- useFactory: function (angularFireAuth) {
1269
- return new i2.RegisterFirebaseAuthService(angularFireAuth);
1270
- },
1271
- deps: [i1.AngularFireAuth],
1272
- },
1273
- {
1274
- provide: 'SignOut',
1275
- useFactory: function (authenticationService) {
1276
- return new i2.SignOut(authenticationService);
1277
- },
1278
- deps: ['AuthenticationService'],
1279
- },
1280
- {
1281
- provide: 'RecoveryPassword',
1282
- useFactory: function (authenticationService) {
1283
- return new i2.RecoveryPassword(authenticationService);
1284
- },
1285
- deps: ['AuthenticationService'],
1286
- },
1287
- ], imports: [[fire.AngularFireModule]] });
1288
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
1289
- type: i0.NgModule,
1290
- args: [{
1291
- imports: [fire.AngularFireModule],
1292
- providers: [
1293
- {
1294
- provide: 'Authentication',
1295
- useFactory: function (authenticationService, userRepository) {
1296
- return new i2.Authentication(authenticationService, userRepository);
1297
- },
1298
- deps: ['AuthenticationService', 'UserRepository'],
1299
- },
1300
- {
1301
- provide: 'AuthenticationService',
1302
- useFactory: function (angularFireAuth) {
1303
- return new i2.AuthenticationFirebaseAuthService(angularFireAuth);
1304
- },
1305
- deps: [i1.AngularFireAuth],
1306
- },
1307
- {
1308
- provide: 'Register',
1309
- useFactory: function (registerService, userRepository) {
1310
- return new i2.Register(registerService, userRepository);
1311
- },
1312
- deps: ['RegisterService', 'UserRepository'],
1313
- },
1314
- {
1315
- provide: 'RegisterService',
1316
- useFactory: function (angularFireAuth) {
1317
- return new i2.RegisterFirebaseAuthService(angularFireAuth);
1318
- },
1319
- deps: [i1.AngularFireAuth],
1320
- },
1321
- {
1322
- provide: 'SignOut',
1323
- useFactory: function (authenticationService) {
1324
- return new i2.SignOut(authenticationService);
1325
- },
1326
- deps: ['AuthenticationService'],
1327
- },
1328
- {
1329
- provide: 'RecoveryPassword',
1330
- useFactory: function (authenticationService) {
1331
- return new i2.RecoveryPassword(authenticationService);
1332
- },
1333
- deps: ['AuthenticationService'],
1334
- },
1335
- ],
1336
- }]
1337
- }] });
1338
-
1339
- var AngularElasticSeachModule = /** @class */ (function () {
1340
- function AngularElasticSeachModule() {
1341
- }
1342
- AngularElasticSeachModule.initializeApp = function (options) {
1343
- return {
1344
- ngModule: AngularElasticSeachModule,
1345
- providers: [{ provide: ES_CONFIG, useValue: options }],
1346
- };
1347
- };
1348
- return AngularElasticSeachModule;
1349
- }());
1350
- AngularElasticSeachModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1351
- AngularElasticSeachModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule });
1352
- AngularElasticSeachModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, providers: [
1353
- {
1354
- provide: i2.ProductsIndex,
1355
- useFactory: function (configuration) {
1356
- return new i2.ProductsIndex(new i2.AxiosAdapter(configuration));
1357
- },
1358
- deps: [ES_CONFIG],
1359
- },
1360
- ] });
1361
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, decorators: [{
1362
- type: i0.NgModule,
1363
- args: [{
1364
- providers: [
1365
- {
1366
- provide: i2.ProductsIndex,
1367
- useFactory: function (configuration) {
1368
- return new i2.ProductsIndex(new i2.AxiosAdapter(configuration));
1369
- },
1370
- deps: [ES_CONFIG],
1371
- },
1372
- ],
1373
- }]
1374
- }] });
1375
-
1376
- var AngularFirestoreModule = /** @class */ (function () {
1377
- function AngularFirestoreModule() {
1378
- }
1379
- AngularFirestoreModule.initializeApp = function (options, nameOrConfig) {
1380
- return {
1381
- ngModule: AngularFirestoreModule,
1382
- providers: [
1383
- { provide: fire.FIREBASE_OPTIONS, useValue: options.firebase },
1384
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
1385
- { provide: ES_CONFIG, useValue: options.elasticSearch },
1386
- ],
1387
- };
1388
- };
1389
- return AngularFirestoreModule;
1390
- }());
1391
- AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1392
- AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, imports: [fire.AngularFireModule, AngularElasticSeachModule] });
1393
- AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
1394
- {
1395
- provide: 'BeautyProfileRepository',
1396
- useFactory: function (firestore, userRepository) {
1397
- return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1398
- },
1399
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1400
- },
1401
- {
1402
- provide: 'Buy2WinRepository',
1403
- useFactory: function (firestore) {
1404
- return new i2.Buy2WinFirestoreRepository(firestore.firestore);
1405
- },
1406
- deps: [i1$1.AngularFirestore],
1407
- },
1408
- {
1409
- provide: i2.CategoryFirestoreRepository,
1410
- useFactory: function (firestore) {
1411
- return new i2.CategoryFirestoreRepository(firestore.firestore);
1412
- },
1413
- deps: [i1$1.AngularFirestore],
1414
- },
1415
- {
1416
- provide: 'CheckoutRepository',
1417
- useFactory: function (firestore) {
1418
- return new i2.CheckoutFirestoreRepository(firestore.firestore);
1419
- },
1420
- deps: [i1$1.AngularFirestore],
1421
- },
1422
- {
1423
- provide: 'CheckoutSubscriptionRepository',
1424
- useFactory: function (firestore) {
1425
- return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1426
- },
1427
- deps: [i1$1.AngularFirestore],
1428
- },
1429
- {
1430
- provide: 'CouponRepository',
1431
- useFactory: function (firestore) {
1432
- return new i2.CouponFirestoreRepository(firestore.firestore);
1433
- },
1434
- deps: [i1$1.AngularFirestore],
1435
- },
1436
- {
1437
- provide: 'EditionRepository',
1438
- useFactory: function (firestore, subscriptionRepository) {
1439
- return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1440
- },
1441
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1442
- },
1443
- {
1444
- provide: 'HomeRepository',
1445
- useFactory: function (firestore) {
1446
- return new i2.HomeFirestoreRepository(firestore.firestore);
1447
- },
1448
- deps: [i1$1.AngularFirestore],
1449
- },
1450
- {
1451
- provide: 'LeadRepository',
1452
- useFactory: function (firestore) {
1453
- return new i2.LeadFirestoreRepository(firestore.firestore);
1454
- },
1455
- deps: [i1$1.AngularFirestore],
1456
- },
1457
- {
1458
- provide: 'LegacyOrderRepository',
1459
- useFactory: function (firestore) {
1460
- return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
1461
- },
1462
- deps: [i1$1.AngularFirestore],
1463
- },
1464
- {
1465
- provide: 'ShopMenuRepository',
1466
- useFactory: function (firestore) {
1467
- return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1468
- },
1469
- deps: [i1$1.AngularFirestore],
1470
- },
1471
- {
1472
- provide: 'OrderRepository',
1473
- useFactory: function (firestore) {
1474
- return new i2.OrderFirestoreRepository(firestore.firestore);
1475
- },
1476
- deps: [i1$1.AngularFirestore],
1477
- },
1478
- {
1479
- provide: 'PaymentRepository',
1480
- useFactory: function (firestore) {
1481
- return new i2.PaymentFirestoreRepository(firestore.firestore);
1482
- },
1483
- deps: [i1$1.AngularFirestore],
1484
- },
1485
- {
1486
- provide: i2.ProductFirestoreRepository,
1487
- useFactory: function (firestore) {
1488
- return new i2.ProductFirestoreRepository(firestore.firestore);
1489
- },
1490
- deps: [i1$1.AngularFirestore],
1491
- },
1492
- {
1493
- provide: 'SubscriptionPaymentRepository',
1494
- useFactory: function (firestore, subscriptionRepository) {
1495
- return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1496
- },
1497
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1498
- },
1499
- {
1500
- provide: 'SubscriptionPlanRepository',
1501
- useFactory: function (firestore) {
1502
- return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1503
- },
1504
- deps: [i1$1.AngularFirestore],
1505
- },
1506
- {
1507
- provide: 'SubscriptionProductRepository',
1508
- useFactory: function (firestore) {
1509
- return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1510
- },
1511
- deps: [i1$1.AngularFirestore],
1512
- },
1513
- {
1514
- provide: 'SubscriptionRepository',
1515
- useFactory: function (firestore) {
1516
- return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1517
- },
1518
- deps: [i1$1.AngularFirestore],
1519
- },
1520
- {
1521
- provide: 'UserRepository',
1522
- useFactory: function (firestore) {
1523
- return new i2.UserFirestoreRepository(firestore.firestore);
1524
- },
1525
- deps: [i1$1.AngularFirestore],
1526
- },
1527
- {
1528
- provide: 'UserAddressRepository',
1529
- useFactory: function (firestore, userRepository) {
1530
- return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1531
- },
1532
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1533
- },
1534
- {
1535
- provide: 'UserPaymentMethodRepository',
1536
- useFactory: function (firestore, userRepository) {
1537
- return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1538
- },
1539
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1540
- },
1541
- {
1542
- provide: i2.ProductVariantFirestoreRepository,
1543
- useFactory: function (firestore, productRepository) {
1544
- return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1545
- },
1546
- deps: [i1$1.AngularFirestore, i2.ProductFirestoreRepository],
1547
- },
1548
- ], imports: [[fire.AngularFireModule, AngularElasticSeachModule]] });
1549
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
1550
- type: i0.NgModule,
1551
- args: [{
1552
- imports: [fire.AngularFireModule, AngularElasticSeachModule],
1553
- providers: [
1554
- {
1555
- provide: 'BeautyProfileRepository',
1556
- useFactory: function (firestore, userRepository) {
1557
- return new i2.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
1558
- },
1559
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1560
- },
1561
- {
1562
- provide: 'Buy2WinRepository',
1563
- useFactory: function (firestore) {
1564
- return new i2.Buy2WinFirestoreRepository(firestore.firestore);
1565
- },
1566
- deps: [i1$1.AngularFirestore],
1567
- },
1568
- {
1569
- provide: i2.CategoryFirestoreRepository,
1570
- useFactory: function (firestore) {
1571
- return new i2.CategoryFirestoreRepository(firestore.firestore);
1572
- },
1573
- deps: [i1$1.AngularFirestore],
1574
- },
1575
- {
1576
- provide: 'CheckoutRepository',
1577
- useFactory: function (firestore) {
1578
- return new i2.CheckoutFirestoreRepository(firestore.firestore);
1579
- },
1580
- deps: [i1$1.AngularFirestore],
1581
- },
1582
- {
1583
- provide: 'CheckoutSubscriptionRepository',
1584
- useFactory: function (firestore) {
1585
- return new i2.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
1586
- },
1587
- deps: [i1$1.AngularFirestore],
1588
- },
1589
- {
1590
- provide: 'CouponRepository',
1591
- useFactory: function (firestore) {
1592
- return new i2.CouponFirestoreRepository(firestore.firestore);
1593
- },
1594
- deps: [i1$1.AngularFirestore],
1595
- },
1596
- {
1597
- provide: 'EditionRepository',
1598
- useFactory: function (firestore, subscriptionRepository) {
1599
- return new i2.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
1600
- },
1601
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1602
- },
1603
- {
1604
- provide: 'HomeRepository',
1605
- useFactory: function (firestore) {
1606
- return new i2.HomeFirestoreRepository(firestore.firestore);
1607
- },
1608
- deps: [i1$1.AngularFirestore],
1609
- },
1610
- {
1611
- provide: 'LeadRepository',
1612
- useFactory: function (firestore) {
1613
- return new i2.LeadFirestoreRepository(firestore.firestore);
1614
- },
1615
- deps: [i1$1.AngularFirestore],
1616
- },
1617
- {
1618
- provide: 'LegacyOrderRepository',
1619
- useFactory: function (firestore) {
1620
- return new i2.LegacyOrderFirestoreRepository(firestore.firestore);
1621
- },
1622
- deps: [i1$1.AngularFirestore],
1623
- },
1624
- {
1625
- provide: 'ShopMenuRepository',
1626
- useFactory: function (firestore) {
1627
- return new i2.ShopMenuFirestoreRepository(firestore.firestore);
1628
- },
1629
- deps: [i1$1.AngularFirestore],
1630
- },
1631
- {
1632
- provide: 'OrderRepository',
1633
- useFactory: function (firestore) {
1634
- return new i2.OrderFirestoreRepository(firestore.firestore);
1635
- },
1636
- deps: [i1$1.AngularFirestore],
1637
- },
1638
- {
1639
- provide: 'PaymentRepository',
1640
- useFactory: function (firestore) {
1641
- return new i2.PaymentFirestoreRepository(firestore.firestore);
1642
- },
1643
- deps: [i1$1.AngularFirestore],
1644
- },
1645
- {
1646
- provide: i2.ProductFirestoreRepository,
1647
- useFactory: function (firestore) {
1648
- return new i2.ProductFirestoreRepository(firestore.firestore);
1649
- },
1650
- deps: [i1$1.AngularFirestore],
1651
- },
1652
- {
1653
- provide: 'SubscriptionPaymentRepository',
1654
- useFactory: function (firestore, subscriptionRepository) {
1655
- return new i2.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
1656
- },
1657
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
1658
- },
1659
- {
1660
- provide: 'SubscriptionPlanRepository',
1661
- useFactory: function (firestore) {
1662
- return new i2.SubscriptionPlanFirestoreRepository(firestore.firestore);
1663
- },
1664
- deps: [i1$1.AngularFirestore],
1665
- },
1666
- {
1667
- provide: 'SubscriptionProductRepository',
1668
- useFactory: function (firestore) {
1669
- return new i2.SubscriptionProductFirestoreRepository(firestore.firestore);
1670
- },
1671
- deps: [i1$1.AngularFirestore],
1672
- },
1673
- {
1674
- provide: 'SubscriptionRepository',
1675
- useFactory: function (firestore) {
1676
- return new i2.SubscriptionFirestoreRepository(firestore.firestore);
1677
- },
1678
- deps: [i1$1.AngularFirestore],
1679
- },
1680
- {
1681
- provide: 'UserRepository',
1682
- useFactory: function (firestore) {
1683
- return new i2.UserFirestoreRepository(firestore.firestore);
1684
- },
1685
- deps: [i1$1.AngularFirestore],
1686
- },
1687
- {
1688
- provide: 'UserAddressRepository',
1689
- useFactory: function (firestore, userRepository) {
1690
- return new i2.UserAddressFirestoreRepository(firestore.firestore, userRepository);
1691
- },
1692
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1693
- },
1694
- {
1695
- provide: 'UserPaymentMethodRepository',
1696
- useFactory: function (firestore, userRepository) {
1697
- return new i2.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
1698
- },
1699
- deps: [i1$1.AngularFirestore, 'UserRepository'],
1700
- },
1701
- {
1702
- provide: i2.ProductVariantFirestoreRepository,
1703
- useFactory: function (firestore, productRepository) {
1704
- return new i2.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
1705
- },
1706
- deps: [i1$1.AngularFirestore, i2.ProductFirestoreRepository],
1707
- },
1708
- ],
1709
- }]
1710
- }] });
1711
-
1712
- var AngularHasuraGraphQLModule = /** @class */ (function () {
1713
- function AngularHasuraGraphQLModule() {
1714
- }
1715
- AngularHasuraGraphQLModule.initializeApp = function (options) {
1716
- return {
1717
- ngModule: AngularHasuraGraphQLModule,
1718
- providers: [{ provide: HASURA_OPTIONS, useValue: options }],
1719
- };
1720
- };
1721
- return AngularHasuraGraphQLModule;
1722
- }());
1723
- AngularHasuraGraphQLModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1724
- AngularHasuraGraphQLModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule });
1725
- AngularHasuraGraphQLModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, providers: [
1726
- {
1727
- provide: 'CategoryRepository',
1728
- useExisting: i2.CategoryHasuraGraphQLRepository,
1729
- },
1730
- {
1731
- provide: i2.CategoryHasuraGraphQLRepository,
1732
- useFactory: function (options, productRepository) {
1733
- return new i2.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository);
1734
- },
1735
- deps: [HASURA_OPTIONS, i2.ProductHasuraGraphQLRepository],
1736
- },
1737
- {
1738
- provide: 'ProductRepository',
1739
- useExisting: i2.ProductHasuraGraphQLRepository,
1740
- },
1741
- {
1742
- provide: i2.ProductHasuraGraphQLRepository,
1743
- useFactory: function (options) {
1744
- return new i2.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
1745
- },
1746
- deps: [HASURA_OPTIONS],
1747
- },
1748
- {
1749
- provide: 'VariantRepository',
1750
- useExisting: i2.VariantHasuraGraphQLRepository,
1751
- },
1752
- {
1753
- provide: i2.VariantHasuraGraphQLRepository,
1754
- useFactory: function (options) {
1755
- return new i2.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
1756
- },
1757
- deps: [HASURA_OPTIONS],
1758
- },
1759
- ] });
1760
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, decorators: [{
1761
- type: i0.NgModule,
1762
- args: [{
1763
- providers: [
1764
- {
1765
- provide: 'CategoryRepository',
1766
- useExisting: i2.CategoryHasuraGraphQLRepository,
1767
- },
1768
- {
1769
- provide: i2.CategoryHasuraGraphQLRepository,
1770
- useFactory: function (options, productRepository) {
1771
- return new i2.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository);
1772
- },
1773
- deps: [HASURA_OPTIONS, i2.ProductHasuraGraphQLRepository],
1774
- },
1775
- {
1776
- provide: 'ProductRepository',
1777
- useExisting: i2.ProductHasuraGraphQLRepository,
1778
- },
1779
- {
1780
- provide: i2.ProductHasuraGraphQLRepository,
1781
- useFactory: function (options) {
1782
- return new i2.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
1783
- },
1784
- deps: [HASURA_OPTIONS],
1785
- },
1786
- {
1787
- provide: 'VariantRepository',
1788
- useExisting: i2.VariantHasuraGraphQLRepository,
1789
- },
1790
- {
1791
- provide: i2.VariantHasuraGraphQLRepository,
1792
- useFactory: function (options) {
1793
- return new i2.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
1794
- },
1795
- deps: [HASURA_OPTIONS],
1796
- },
1797
- ],
1798
- }]
27
+ var AngularFirebaseAuthModule = /** @class */ (function () {
28
+ function AngularFirebaseAuthModule() {
29
+ }
30
+ AngularFirebaseAuthModule.initializeApp = function (options, nameOrConfig) {
31
+ return {
32
+ ngModule: AngularFirebaseAuthModule,
33
+ providers: [
34
+ { provide: fire.FIREBASE_OPTIONS, useValue: options },
35
+ { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
36
+ ],
37
+ };
38
+ };
39
+ return AngularFirebaseAuthModule;
40
+ }());
41
+ AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
42
+ AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [fire.AngularFireModule] });
43
+ AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
44
+ {
45
+ provide: 'Authentication',
46
+ useFactory: function (authenticationService, userRepository) {
47
+ return new connect.Authentication(authenticationService, userRepository);
48
+ },
49
+ deps: ['AuthenticationService', 'UserRepository'],
50
+ },
51
+ {
52
+ provide: 'AuthenticationService',
53
+ useFactory: function (angularFireAuth) {
54
+ return new connect.AuthenticationFirebaseAuthService(angularFireAuth);
55
+ },
56
+ deps: [auth.AngularFireAuth],
57
+ },
58
+ {
59
+ provide: 'SignOut',
60
+ useFactory: function (authenticationService) {
61
+ return new connect.SignOut(authenticationService);
62
+ },
63
+ deps: ['AuthenticationService'],
64
+ },
65
+ ], imports: [[fire.AngularFireModule]] });
66
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
67
+ type: i0.NgModule,
68
+ args: [{
69
+ imports: [fire.AngularFireModule],
70
+ providers: [
71
+ {
72
+ provide: 'Authentication',
73
+ useFactory: function (authenticationService, userRepository) {
74
+ return new connect.Authentication(authenticationService, userRepository);
75
+ },
76
+ deps: ['AuthenticationService', 'UserRepository'],
77
+ },
78
+ {
79
+ provide: 'AuthenticationService',
80
+ useFactory: function (angularFireAuth) {
81
+ return new connect.AuthenticationFirebaseAuthService(angularFireAuth);
82
+ },
83
+ deps: [auth.AngularFireAuth],
84
+ },
85
+ {
86
+ provide: 'SignOut',
87
+ useFactory: function (authenticationService) {
88
+ return new connect.SignOut(authenticationService);
89
+ },
90
+ deps: ['AuthenticationService'],
91
+ },
92
+ ],
93
+ }]
1799
94
  }] });
1800
95
 
1801
- var AngularConnectModule = /** @class */ (function () {
1802
- function AngularConnectModule() {
1803
- }
1804
- AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
1805
- return {
1806
- ngModule: AngularConnectModule,
1807
- providers: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((i2.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i2.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_OPTIONS, useValue: options === null || options === void 0 ? void 0 : options.firebase }]))), __read((i2.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))), __read((i2.isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]))), __read((i2.isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]))),
1808
- };
1809
- };
1810
- return AngularConnectModule;
1811
- }());
1812
- AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1813
- AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
1814
- AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [
1815
- AuthService,
1816
- CartService,
1817
- CheckoutService,
1818
- CheckoutSubscriptionService,
1819
- CouponService,
1820
- HomeShopService,
1821
- OrderService,
1822
- ], imports: [[fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule]] });
1823
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
1824
- type: i0.NgModule,
1825
- args: [{
1826
- imports: [fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule],
1827
- providers: [
1828
- AuthService,
1829
- CartService,
1830
- CheckoutService,
1831
- CheckoutSubscriptionService,
1832
- CouponService,
1833
- HomeShopService,
1834
- OrderService,
1835
- ],
1836
- }]
96
+ var AngularFirestoreModule = /** @class */ (function () {
97
+ function AngularFirestoreModule() {
98
+ }
99
+ AngularFirestoreModule.initializeApp = function (options, nameOrConfig) {
100
+ return {
101
+ ngModule: AngularFirestoreModule,
102
+ providers: [
103
+ { provide: fire.FIREBASE_OPTIONS, useValue: options },
104
+ { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
105
+ ],
106
+ };
107
+ };
108
+ return AngularFirestoreModule;
109
+ }());
110
+ AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
111
+ AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirestoreModule, imports: [fire.AngularFireModule] });
112
+ AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
113
+ {
114
+ provide: 'BeautyProfileRepository',
115
+ useFactory: function (firestore, userRepository) {
116
+ return new connect.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
117
+ },
118
+ deps: [firestore.AngularFirestore, 'UserRepository'],
119
+ },
120
+ {
121
+ provide: 'EditionRepository',
122
+ useFactory: function (firestore, subscriptionRepository) {
123
+ return new connect.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
124
+ },
125
+ deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
126
+ },
127
+ {
128
+ provide: 'SubscriptionRepository',
129
+ useFactory: function (firestore) {
130
+ return new connect.SubscriptionFirestoreRepository(firestore.firestore);
131
+ },
132
+ deps: [firestore.AngularFirestore],
133
+ },
134
+ {
135
+ provide: 'UserRepository',
136
+ useFactory: function (firestore) {
137
+ return new connect.UserFirestoreRepository(firestore.firestore);
138
+ },
139
+ deps: [firestore.AngularFirestore],
140
+ },
141
+ ], imports: [[fire.AngularFireModule]] });
142
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
143
+ type: i0.NgModule,
144
+ args: [{
145
+ imports: [fire.AngularFireModule],
146
+ providers: [
147
+ {
148
+ provide: 'BeautyProfileRepository',
149
+ useFactory: function (firestore, userRepository) {
150
+ return new connect.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
151
+ },
152
+ deps: [firestore.AngularFirestore, 'UserRepository'],
153
+ },
154
+ {
155
+ provide: 'EditionRepository',
156
+ useFactory: function (firestore, subscriptionRepository) {
157
+ return new connect.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
158
+ },
159
+ deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
160
+ },
161
+ {
162
+ provide: 'SubscriptionRepository',
163
+ useFactory: function (firestore) {
164
+ return new connect.SubscriptionFirestoreRepository(firestore.firestore);
165
+ },
166
+ deps: [firestore.AngularFirestore],
167
+ },
168
+ {
169
+ provide: 'UserRepository',
170
+ useFactory: function (firestore) {
171
+ return new connect.UserFirestoreRepository(firestore.firestore);
172
+ },
173
+ deps: [firestore.AngularFirestore],
174
+ },
175
+ ],
176
+ }]
1837
177
  }] });
1838
178
 
1839
- /**
1840
- * Generated bundle index. Do not edit.
179
+ /**
180
+ * Generated bundle index. Do not edit.
1841
181
  */
1842
182
 
1843
- exports.AngularConnectModule = AngularConnectModule;
1844
183
  exports.AngularFirebaseAuthModule = AngularFirebaseAuthModule;
1845
184
  exports.AngularFirestoreModule = AngularFirestoreModule;
1846
- exports.AngularHasuraGraphQLModule = AngularHasuraGraphQLModule;
1847
- exports.AuthService = AuthService;
1848
- exports.CartService = CartService;
1849
- exports.CheckoutService = CheckoutService;
1850
- exports.CheckoutSubscriptionService = CheckoutSubscriptionService;
1851
- exports.CouponService = CouponService;
1852
- exports.HomeShopService = HomeShopService;
1853
- exports.OrderService = OrderService;
1854
185
 
1855
186
  Object.defineProperty(exports, '__esModule', { value: true });
1856
187