@infrab4a/connect-angular 0.4.1 → 0.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
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';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/fire/auth'), require('@infrab4a/connect'), require('js-cookie'), require('@angular/fire'), require('@angular/fire/firestore')) :
3
+ typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/fire/auth', '@infrab4a/connect', 'js-cookie', '@angular/fire', '@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.rxjs, global.rxjs.operators, global.ng.fire.auth, global.connect, global.jsCookie, global.ng.fire, global.ng.fire.firestore));
5
+ })(this, (function (exports, i0, rxjs, operators, i1, connect, jsCookie, fire, firestore) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -23,361 +23,914 @@
23
23
  }
24
24
 
25
25
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
26
27
 
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
- AngularFirebaseAuthModulemod = 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
- }]
28
+ var AuthService = /** @class */ (function () {
29
+ function AuthService(angularFireAuth, userRepository) {
30
+ this.angularFireAuth = angularFireAuth;
31
+ this.userRepository = userRepository;
32
+ }
33
+ AuthService.prototype.getUser = function () {
34
+ var _this = this;
35
+ return rxjs.from(this.getTokenId()).pipe(operators.map(function (id) { return id || rxjs.throwError(function () { return new Error('Usuário não logado'); }); }), operators.mergeMap(function (id) { return _this.userRepository.get({ id: id }); }));
36
+ };
37
+ AuthService.prototype.getTokenId = function () {
38
+ return this.angularFireAuth.idToken;
39
+ };
40
+ return AuthService;
41
+ }());
42
+ AuthService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AuthService, deps: [{ token: i1__namespace.AngularFireAuth }, { token: 'UserRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
43
+ AuthServiceprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AuthService });
44
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AuthService, decorators: [{
45
+ type: i0.Injectable
46
+ }], ctorParameters: function () {
47
+ return [{ type: i1__namespace.AngularFireAuth }, { type: undefined, decorators: [{
48
+ type: i0.Inject,
49
+ args: ['UserRepository']
50
+ }] }];
51
+ } });
52
+
53
+ /*! *****************************************************************************
54
+ Copyright (c) Microsoft Corporation.
55
+
56
+ Permission to use, copy, modify, and/or distribute this software for any
57
+ purpose with or without fee is hereby granted.
58
+
59
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
60
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
61
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
62
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
63
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
64
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65
+ PERFORMANCE OF THIS SOFTWARE.
66
+ ***************************************************************************** */
67
+ /* global Reflect, Promise */
68
+ var extendStatics = function (d, b) {
69
+ extendStatics = Object.setPrototypeOf ||
70
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
71
+ function (d, b) { for (var p in b)
72
+ if (Object.prototype.hasOwnProperty.call(b, p))
73
+ d[p] = b[p]; };
74
+ return extendStatics(d, b);
75
+ };
76
+ function __extends(d, b) {
77
+ if (typeof b !== "function" && b !== null)
78
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
79
+ extendStatics(d, b);
80
+ function __() { this.constructor = d; }
81
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
82
+ }
83
+ var __assign = function () {
84
+ __assign = Object.assign || function __assign(t) {
85
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
86
+ s = arguments[i];
87
+ for (var p in s)
88
+ if (Object.prototype.hasOwnProperty.call(s, p))
89
+ t[p] = s[p];
90
+ }
91
+ return t;
92
+ };
93
+ return __assign.apply(this, arguments);
94
+ };
95
+ function __rest(s, e) {
96
+ var t = {};
97
+ for (var p in s)
98
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
99
+ t[p] = s[p];
100
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
101
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
102
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
103
+ t[p[i]] = s[p[i]];
104
+ }
105
+ return t;
106
+ }
107
+ function __decorate(decorators, target, key, desc) {
108
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
109
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
110
+ r = Reflect.decorate(decorators, target, key, desc);
111
+ else
112
+ for (var i = decorators.length - 1; i >= 0; i--)
113
+ if (d = decorators[i])
114
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
115
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
116
+ }
117
+ function __param(paramIndex, decorator) {
118
+ return function (target, key) { decorator(target, key, paramIndex); };
119
+ }
120
+ function __metadata(metadataKey, metadataValue) {
121
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
122
+ return Reflect.metadata(metadataKey, metadataValue);
123
+ }
124
+ function __awaiter(thisArg, _arguments, P, generator) {
125
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
126
+ return new (P || (P = Promise))(function (resolve, reject) {
127
+ function fulfilled(value) { try {
128
+ step(generator.next(value));
129
+ }
130
+ catch (e) {
131
+ reject(e);
132
+ } }
133
+ function rejected(value) { try {
134
+ step(generator["throw"](value));
135
+ }
136
+ catch (e) {
137
+ reject(e);
138
+ } }
139
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
140
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
141
+ });
142
+ }
143
+ function __generator(thisArg, body) {
144
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
145
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
146
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
147
+ function verb(n) { return function (v) { return step([n, v]); }; }
148
+ function step(op) {
149
+ if (f)
150
+ throw new TypeError("Generator is already executing.");
151
+ while (_)
152
+ try {
153
+ 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)
154
+ return t;
155
+ if (y = 0, t)
156
+ op = [op[0] & 2, t.value];
157
+ switch (op[0]) {
158
+ case 0:
159
+ case 1:
160
+ t = op;
161
+ break;
162
+ case 4:
163
+ _.label++;
164
+ return { value: op[1], done: false };
165
+ case 5:
166
+ _.label++;
167
+ y = op[1];
168
+ op = [0];
169
+ continue;
170
+ case 7:
171
+ op = _.ops.pop();
172
+ _.trys.pop();
173
+ continue;
174
+ default:
175
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
176
+ _ = 0;
177
+ continue;
178
+ }
179
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
180
+ _.label = op[1];
181
+ break;
182
+ }
183
+ if (op[0] === 6 && _.label < t[1]) {
184
+ _.label = t[1];
185
+ t = op;
186
+ break;
187
+ }
188
+ if (t && _.label < t[2]) {
189
+ _.label = t[2];
190
+ _.ops.push(op);
191
+ break;
192
+ }
193
+ if (t[2])
194
+ _.ops.pop();
195
+ _.trys.pop();
196
+ continue;
197
+ }
198
+ op = body.call(thisArg, _);
199
+ }
200
+ catch (e) {
201
+ op = [6, e];
202
+ y = 0;
203
+ }
204
+ finally {
205
+ f = t = 0;
206
+ }
207
+ if (op[0] & 5)
208
+ throw op[1];
209
+ return { value: op[0] ? op[1] : void 0, done: true };
210
+ }
211
+ }
212
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
213
+ if (k2 === undefined)
214
+ k2 = k;
215
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
216
+ }) : (function (o, m, k, k2) {
217
+ if (k2 === undefined)
218
+ k2 = k;
219
+ o[k2] = m[k];
220
+ });
221
+ function __exportStar(m, o) {
222
+ for (var p in m)
223
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
224
+ __createBinding(o, m, p);
225
+ }
226
+ function __values(o) {
227
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
228
+ if (m)
229
+ return m.call(o);
230
+ if (o && typeof o.length === "number")
231
+ return {
232
+ next: function () {
233
+ if (o && i >= o.length)
234
+ o = void 0;
235
+ return { value: o && o[i++], done: !o };
236
+ }
237
+ };
238
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
239
+ }
240
+ function __read(o, n) {
241
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
242
+ if (!m)
243
+ return o;
244
+ var i = m.call(o), r, ar = [], e;
245
+ try {
246
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
247
+ ar.push(r.value);
248
+ }
249
+ catch (error) {
250
+ e = { error: error };
251
+ }
252
+ finally {
253
+ try {
254
+ if (r && !r.done && (m = i["return"]))
255
+ m.call(i);
256
+ }
257
+ finally {
258
+ if (e)
259
+ throw e.error;
260
+ }
261
+ }
262
+ return ar;
263
+ }
264
+ /** @deprecated */
265
+ function __spread() {
266
+ for (var ar = [], i = 0; i < arguments.length; i++)
267
+ ar = ar.concat(__read(arguments[i]));
268
+ return ar;
269
+ }
270
+ /** @deprecated */
271
+ function __spreadArrays() {
272
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
273
+ s += arguments[i].length;
274
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
275
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
276
+ r[k] = a[j];
277
+ return r;
278
+ }
279
+ function __spreadArray(to, from, pack) {
280
+ if (pack || arguments.length === 2)
281
+ for (var i = 0, l = from.length, ar; i < l; i++) {
282
+ if (ar || !(i in from)) {
283
+ if (!ar)
284
+ ar = Array.prototype.slice.call(from, 0, i);
285
+ ar[i] = from[i];
286
+ }
287
+ }
288
+ return to.concat(ar || Array.prototype.slice.call(from));
289
+ }
290
+ function __await(v) {
291
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
292
+ }
293
+ function __asyncGenerator(thisArg, _arguments, generator) {
294
+ if (!Symbol.asyncIterator)
295
+ throw new TypeError("Symbol.asyncIterator is not defined.");
296
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
297
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
298
+ function verb(n) { if (g[n])
299
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
300
+ function resume(n, v) { try {
301
+ step(g[n](v));
302
+ }
303
+ catch (e) {
304
+ settle(q[0][3], e);
305
+ } }
306
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
307
+ function fulfill(value) { resume("next", value); }
308
+ function reject(value) { resume("throw", value); }
309
+ function settle(f, v) { if (f(v), q.shift(), q.length)
310
+ resume(q[0][0], q[0][1]); }
311
+ }
312
+ function __asyncDelegator(o) {
313
+ var i, p;
314
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
315
+ 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; }
316
+ }
317
+ function __asyncValues(o) {
318
+ if (!Symbol.asyncIterator)
319
+ throw new TypeError("Symbol.asyncIterator is not defined.");
320
+ var m = o[Symbol.asyncIterator], i;
321
+ 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);
322
+ 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); }); }; }
323
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
324
+ }
325
+ function __makeTemplateObject(cooked, raw) {
326
+ if (Object.defineProperty) {
327
+ Object.defineProperty(cooked, "raw", { value: raw });
328
+ }
329
+ else {
330
+ cooked.raw = raw;
331
+ }
332
+ return cooked;
333
+ }
334
+ ;
335
+ var __setModuleDefault = Object.create ? (function (o, v) {
336
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
337
+ }) : function (o, v) {
338
+ o["default"] = v;
339
+ };
340
+ function __importStar(mod) {
341
+ if (mod && mod.__esModule)
342
+ return mod;
343
+ var result = {};
344
+ if (mod != null)
345
+ for (var k in mod)
346
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
347
+ __createBinding(result, mod, k);
348
+ __setModuleDefault(result, mod);
349
+ return result;
350
+ }
351
+ function __importDefault(mod) {
352
+ return (mod && mod.__esModule) ? mod : { default: mod };
353
+ }
354
+ function __classPrivateFieldGet(receiver, state, kind, f) {
355
+ if (kind === "a" && !f)
356
+ throw new TypeError("Private accessor was defined without a getter");
357
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
358
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
359
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
360
+ }
361
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
362
+ if (kind === "m")
363
+ throw new TypeError("Private method is not writable");
364
+ if (kind === "a" && !f)
365
+ throw new TypeError("Private accessor was defined without a setter");
366
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
367
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
368
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
369
+ }
370
+
371
+ var CheckoutService = /** @class */ (function () {
372
+ function CheckoutService(checkoutRepository, userRepository) {
373
+ this.checkoutRepository = checkoutRepository;
374
+ this.userRepository = userRepository;
375
+ }
376
+ CheckoutService.prototype.getCheckout = function () {
377
+ var checkoutId = jsCookie.get('checkoutId');
378
+ if (!connect.isNil(checkoutId))
379
+ return rxjs.from(this.checkoutRepository.get({ id: checkoutId }));
380
+ return rxjs.from(this.createCheckout());
381
+ };
382
+ CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
383
+ var _this = this;
384
+ return rxjs.from(this.checkoutRepository.get({ id: checkoutId })).pipe(operators.map(function (checkout) { return rxjs.from(_this.userRepository.get({ id: checkout.user.id })); }), operators.concatMap(function (user) { return user || rxjs.throwError(function () { return new connect.NotFoundError('User is not found'); }); }));
385
+ };
386
+ CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
387
+ return rxjs.from(this.checkoutRepository.update({ id: checkout.id, lineItems: checkout.lineItems }));
388
+ };
389
+ CheckoutService.prototype.createCheckout = function () {
390
+ return __awaiter(this, void 0, void 0, function () {
391
+ var checkout;
392
+ return __generator(this, function (_a) {
393
+ switch (_a.label) {
394
+ case 0: return [4 /*yield*/, this.checkoutRepository.create({ createdAt: new Date() })];
395
+ case 1:
396
+ checkout = _a.sent();
397
+ jsCookie.set('checkoutId', checkout.id);
398
+ return [2 /*return*/, checkout];
399
+ }
400
+ });
401
+ });
402
+ };
403
+ return CheckoutService;
404
+ }());
405
+ CheckoutService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CheckoutService, deps: [{ token: 'CheckoutRepository' }, { token: 'UserRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
406
+ CheckoutService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CheckoutService });
407
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CheckoutService, decorators: [{
408
+ type: i0.Injectable
409
+ }], ctorParameters: function () {
410
+ return [{ type: undefined, decorators: [{
411
+ type: i0.Inject,
412
+ args: ['CheckoutRepository']
413
+ }] }, { type: undefined, decorators: [{
414
+ type: i0.Inject,
415
+ args: ['UserRepository']
416
+ }] }];
417
+ } });
418
+
419
+ var CartService = /** @class */ (function () {
420
+ function CartService(authService, checkoutService) {
421
+ var _this = this;
422
+ this.authService = authService;
423
+ this.checkoutService = checkoutService;
424
+ this.updateLineItemInCart = function (lineItem, quantity) { return _this.checkoutService.getCheckout().pipe(operators.mergeMap(function (checkoutLoaded) {
425
+ var _a;
426
+ var items = [];
427
+ var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.sku; }).indexOf(lineItem.sku);
428
+ if (index > -1) {
429
+ checkoutLoaded.lineItems[index].quantity += quantity;
430
+ items.concat(checkoutLoaded.lineItems);
431
+ }
432
+ else
433
+ items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
434
+ checkoutLoaded.lineItems = items;
435
+ return _this.checkoutService
436
+ .updateCheckoutLineItems(checkoutLoaded)
437
+ .pipe(operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }));
438
+ })); };
439
+ this.generateCartObject = function (items) {
440
+ var cart = {};
441
+ items === null || items === void 0 ? void 0 : items.forEach(function (item) {
442
+ var _a;
443
+ return (cart[item.sku] = connect.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) })));
444
+ });
445
+ return cart;
446
+ };
447
+ this.buildLineItem = function (_c) {
448
+ var checkout = _c.checkout, item = _c.item, isSubscriber = _c.isSubscriber, quantity = _c.quantity;
449
+ var _a, _b;
450
+ if (_this.checkMaxStock(item))
451
+ throw new Error('Desculpe! Temos apenas ' + ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) + ' em estoque.');
452
+ var image = item.image || ((_b = item.images) === null || _b === void 0 ? void 0 : _b.shift());
453
+ var pricePaid = _this.getProductPrice({ product: item, shop: checkout.shop, isSubscriber: isSubscriber });
454
+ var id = item.id, name = item.name, brand = item.brand, slug = item.slug, stock = item.stock, price = item.price, weight = item.weight, categories = item.categories, sku = item.sku;
455
+ var isGift = item.isGift || null;
456
+ return connect.LineItem.toInstance({
457
+ id: id,
458
+ name: name,
459
+ brand: brand,
460
+ slug: slug,
461
+ sku: sku,
462
+ stock: stock,
463
+ price: price,
464
+ image: image,
465
+ weight: weight,
466
+ quantity: quantity,
467
+ pricePaid: pricePaid,
468
+ categories: categories,
469
+ isGift: isGift,
470
+ });
471
+ };
472
+ this.getProductPrice = function (_c) {
473
+ var product = _c.product, shop = _c.shop, isSubscriber = _c.isSubscriber;
474
+ return product.getInfoByShop(shop)[isSubscriber ? 'subscriberPrice' : 'price'];
475
+ };
476
+ this.checkMaxStock = function (item) {
477
+ var _a;
478
+ var maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
479
+ var quantity = item.quantity || 1;
480
+ var currentItemAmount = item.quantity;
481
+ return quantity > maxStock || currentItemAmount + quantity > maxStock;
482
+ };
483
+ }
484
+ CartService.prototype.addItem = function (checkout, item, quantity) {
485
+ var _this = this;
486
+ var _a;
487
+ if (connect.isEmpty(checkout.id))
488
+ throw new connect.RequiredArgumentError(['checkout.id']);
489
+ quantity = quantity || 1;
490
+ return rxjs.of((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber).pipe(operators.mergeMap(function (isSubscriber) { return isSubscriber
491
+ ? rxjs.of(isSubscriber)
492
+ : _this.checkoutService.getUserByCheckout(checkout.id).pipe(operators.map(function (user) { return user.isSubscriber; })); }), operators.mergeMap(function (isSubscriber) {
493
+ return _this.getCart().pipe(operators.map(function () { return _this.buildLineItem({ checkout: checkout, item: item, quantity: quantity, isSubscriber: isSubscriber }); }), operators.mergeMap(function () { return _this.updateLineItemInCart(item, quantity); }));
494
+ }));
495
+ };
496
+ CartService.prototype.decreaseItem = function (item) {
497
+ var _this = this;
498
+ return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
499
+ var _a;
500
+ var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.sku === item.sku; });
501
+ if (!connect.isNil(checkoutItem))
502
+ checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
503
+ return checkout;
504
+ }), operators.mergeMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }));
505
+ };
506
+ CartService.prototype.getCart = function () {
507
+ var _this = this;
508
+ return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.mergeMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
509
+ };
510
+ CartService.prototype.getDiscount = function (coupon) {
511
+ switch (coupon.type) {
512
+ case connect.CouponTypes.FINANCIAL:
513
+ return this.getFinancialDiscount(coupon);
514
+ case connect.CouponTypes.PRODUCT:
515
+ return function (subTotalPrice) { return subTotalPrice; };
516
+ case connect.CouponTypes.GIFTCARD:
517
+ return this.getFinancialDiscount(coupon);
518
+ case connect.CouponTypes.VOUCHER:
519
+ return function (subTotalPrice) { return subTotalPrice; };
520
+ }
521
+ };
522
+ CartService.prototype.getVariantPriceDiscount = function (item, shop) {
523
+ return this.authService.getUser().pipe(operators.mergeMap(function (user) { return rxjs.iif(function () { return user.isSubscriber && !!item.getInfoByShop(shop).subscriberPrice; }, rxjs.of(item.getInfoByShop(shop).subscriberPrice), rxjs.of(item.getInfoByShop(shop).price)); }), operators.catchError(function () { return rxjs.of(item.getInfoByShop(shop).price); }));
524
+ };
525
+ CartService.prototype.removeItem = function (item) {
526
+ var _this = this;
527
+ return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
528
+ checkout.lineItems.splice(checkout.lineItems.findIndex(function (lineItem) { return lineItem.sku === item.sku; }), 1);
529
+ return checkout;
530
+ }), operators.mergeMap(function (checkout) { return _this.checkoutService.updateCheckoutLineItems(checkout); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }));
531
+ };
532
+ CartService.prototype.getFinancialDiscount = function (coupon) {
533
+ return function (subTotalPrice) {
534
+ if (connect.FinancialCoupon.isFinancialCoupon(coupon))
535
+ switch (coupon.subtype) {
536
+ case connect.CouponSubtypes.ABSOLUTE:
537
+ return subTotalPrice - coupon.discount * 100;
538
+ case connect.CouponSubtypes.PERCENTAGE:
539
+ return subTotalPrice * (1 - coupon.discount / 100);
540
+ }
541
+ };
542
+ };
543
+ return CartService;
544
+ }());
545
+ CartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
546
+ CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CartService });
547
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: CartService, decorators: [{
548
+ type: i0.Injectable
549
+ }], ctorParameters: function () { return [{ type: AuthService }, { type: CheckoutService }]; } });
550
+
551
+ var AngularFirebaseAuthModule = /** @class */ (function () {
552
+ function AngularFirebaseAuthModule() {
553
+ }
554
+ AngularFirebaseAuthModule.initializeApp = function (options, nameOrConfig) {
555
+ return {
556
+ ngModule: AngularFirebaseAuthModule,
557
+ providers: [
558
+ { provide: fire.FIREBASE_OPTIONS, useValue: options },
559
+ { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
560
+ ],
561
+ };
562
+ };
563
+ return AngularFirebaseAuthModule;
564
+ }());
565
+ AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
566
+ AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [fire.AngularFireModule] });
567
+ AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
568
+ {
569
+ provide: 'Authentication',
570
+ useFactory: function (authenticationService, userRepository) {
571
+ return new connect.Authentication(authenticationService, userRepository);
572
+ },
573
+ deps: ['AuthenticationService', 'UserRepository'],
574
+ },
575
+ {
576
+ provide: 'AuthenticationService',
577
+ useFactory: function (angularFireAuth) {
578
+ return new connect.AuthenticationFirebaseAuthService(angularFireAuth);
579
+ },
580
+ deps: [i1.AngularFireAuth],
581
+ },
582
+ {
583
+ provide: 'SignOut',
584
+ useFactory: function (authenticationService) {
585
+ return new connect.SignOut(authenticationService);
586
+ },
587
+ deps: ['AuthenticationService'],
588
+ },
589
+ ], imports: [[fire.AngularFireModule]] });
590
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
591
+ type: i0.NgModule,
592
+ args: [{
593
+ imports: [fire.AngularFireModule],
594
+ providers: [
595
+ {
596
+ provide: 'Authentication',
597
+ useFactory: function (authenticationService, userRepository) {
598
+ return new connect.Authentication(authenticationService, userRepository);
599
+ },
600
+ deps: ['AuthenticationService', 'UserRepository'],
601
+ },
602
+ {
603
+ provide: 'AuthenticationService',
604
+ useFactory: function (angularFireAuth) {
605
+ return new connect.AuthenticationFirebaseAuthService(angularFireAuth);
606
+ },
607
+ deps: [i1.AngularFireAuth],
608
+ },
609
+ {
610
+ provide: 'SignOut',
611
+ useFactory: function (authenticationService) {
612
+ return new connect.SignOut(authenticationService);
613
+ },
614
+ deps: ['AuthenticationService'],
615
+ },
616
+ ],
617
+ }]
618
+ }] });
619
+
620
+ var AngularFirestoreModule = /** @class */ (function () {
621
+ function AngularFirestoreModule() {
622
+ }
623
+ AngularFirestoreModule.initializeApp = function (options, nameOrConfig) {
624
+ return {
625
+ ngModule: AngularFirestoreModule,
626
+ providers: [
627
+ { provide: fire.FIREBASE_OPTIONS, useValue: options },
628
+ { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
629
+ ],
630
+ };
631
+ };
632
+ return AngularFirestoreModule;
633
+ }());
634
+ AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
635
+ AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirestoreModule, imports: [fire.AngularFireModule] });
636
+ AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
637
+ {
638
+ provide: 'BeautyProfileRepository',
639
+ useFactory: function (firestore, userRepository) {
640
+ return new connect.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
641
+ },
642
+ deps: [firestore.AngularFirestore, 'UserRepository'],
643
+ },
644
+ {
645
+ provide: 'Buy2WinRepository',
646
+ useFactory: function (firestore) {
647
+ return new connect.Buy2WinFirestoreRepository(firestore.firestore);
648
+ },
649
+ deps: [firestore.AngularFirestore],
650
+ },
651
+ {
652
+ provide: 'CategoryRepository',
653
+ useFactory: function (firestore) {
654
+ return new connect.CategoryFirestoreRepository(firestore.firestore);
655
+ },
656
+ deps: [firestore.AngularFirestore],
657
+ },
658
+ {
659
+ provide: 'CheckoutRepository',
660
+ useFactory: function (firestore) {
661
+ return new connect.CheckoutFirestoreRepository(firestore.firestore);
662
+ },
663
+ deps: [firestore.AngularFirestore],
664
+ },
665
+ {
666
+ provide: 'CheckoutSubscriptionRepository',
667
+ useFactory: function (firestore) {
668
+ return new connect.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
669
+ },
670
+ deps: [firestore.AngularFirestore],
671
+ },
672
+ {
673
+ provide: 'CouponRepository',
674
+ useFactory: function (firestore) {
675
+ return new connect.CouponFirestoreRepository(firestore.firestore);
676
+ },
677
+ deps: [firestore.AngularFirestore],
678
+ },
679
+ {
680
+ provide: 'EditionRepository',
681
+ useFactory: function (firestore, subscriptionRepository) {
682
+ return new connect.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
683
+ },
684
+ deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
685
+ },
686
+ {
687
+ provide: 'HomeRepository',
688
+ useFactory: function (firestore) {
689
+ return new connect.HomeFirestoreRepository(firestore.firestore);
690
+ },
691
+ deps: [firestore.AngularFirestore],
692
+ },
693
+ {
694
+ provide: 'ShopMenuRepository',
695
+ useFactory: function (firestore) {
696
+ return new connect.ShopMenuFirestoreRepository(firestore.firestore);
697
+ },
698
+ deps: [firestore.AngularFirestore],
699
+ },
700
+ {
701
+ provide: 'OrderRepository',
702
+ useFactory: function (firestore) {
703
+ return new connect.OrderFirestoreRepository(firestore.firestore);
704
+ },
705
+ deps: [firestore.AngularFirestore],
706
+ },
707
+ {
708
+ provide: 'PaymentRepository',
709
+ useFactory: function (firestore) {
710
+ return new connect.PaymentFirestoreRepository(firestore.firestore);
711
+ },
712
+ deps: [firestore.AngularFirestore],
713
+ },
714
+ {
715
+ provide: 'ProductRepository',
716
+ useFactory: function (firestore) {
717
+ return new connect.ProductFirestoreRepository(firestore.firestore);
718
+ },
719
+ deps: [firestore.AngularFirestore],
720
+ },
721
+ {
722
+ provide: 'SubscriptionPaymentRepository',
723
+ useFactory: function (firestore, subscriptionRepository) {
724
+ return new connect.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
725
+ },
726
+ deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
727
+ },
728
+ {
729
+ provide: 'SubscriptionPlanRepository',
730
+ useFactory: function (firestore) {
731
+ return new connect.SubscriptionPlanFirestoreRepository(firestore.firestore);
732
+ },
733
+ deps: [firestore.AngularFirestore],
734
+ },
735
+ {
736
+ provide: 'SubscriptionRepository',
737
+ useFactory: function (firestore) {
738
+ return new connect.SubscriptionFirestoreRepository(firestore.firestore);
739
+ },
740
+ deps: [firestore.AngularFirestore],
741
+ },
742
+ {
743
+ provide: 'UserRepository',
744
+ useFactory: function (firestore) {
745
+ return new connect.UserFirestoreRepository(firestore.firestore);
746
+ },
747
+ deps: [firestore.AngularFirestore],
748
+ },
749
+ {
750
+ provide: 'UserAddressRepository',
751
+ useFactory: function (firestore, userRepository) {
752
+ return new connect.UserAddressFirestoreRepository(firestore.firestore, userRepository);
753
+ },
754
+ deps: [firestore.AngularFirestore, 'UserRepository'],
755
+ },
756
+ {
757
+ provide: 'VariantRepository',
758
+ useFactory: function (firestore, productRepository) {
759
+ return new connect.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
760
+ },
761
+ deps: [firestore.AngularFirestore, 'ProductRepository'],
762
+ },
763
+ ], imports: [[fire.AngularFireModule]] });
764
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
765
+ type: i0.NgModule,
766
+ args: [{
767
+ imports: [fire.AngularFireModule],
768
+ providers: [
769
+ {
770
+ provide: 'BeautyProfileRepository',
771
+ useFactory: function (firestore, userRepository) {
772
+ return new connect.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
773
+ },
774
+ deps: [firestore.AngularFirestore, 'UserRepository'],
775
+ },
776
+ {
777
+ provide: 'Buy2WinRepository',
778
+ useFactory: function (firestore) {
779
+ return new connect.Buy2WinFirestoreRepository(firestore.firestore);
780
+ },
781
+ deps: [firestore.AngularFirestore],
782
+ },
783
+ {
784
+ provide: 'CategoryRepository',
785
+ useFactory: function (firestore) {
786
+ return new connect.CategoryFirestoreRepository(firestore.firestore);
787
+ },
788
+ deps: [firestore.AngularFirestore],
789
+ },
790
+ {
791
+ provide: 'CheckoutRepository',
792
+ useFactory: function (firestore) {
793
+ return new connect.CheckoutFirestoreRepository(firestore.firestore);
794
+ },
795
+ deps: [firestore.AngularFirestore],
796
+ },
797
+ {
798
+ provide: 'CheckoutSubscriptionRepository',
799
+ useFactory: function (firestore) {
800
+ return new connect.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
801
+ },
802
+ deps: [firestore.AngularFirestore],
803
+ },
804
+ {
805
+ provide: 'CouponRepository',
806
+ useFactory: function (firestore) {
807
+ return new connect.CouponFirestoreRepository(firestore.firestore);
808
+ },
809
+ deps: [firestore.AngularFirestore],
810
+ },
811
+ {
812
+ provide: 'EditionRepository',
813
+ useFactory: function (firestore, subscriptionRepository) {
814
+ return new connect.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
815
+ },
816
+ deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
817
+ },
818
+ {
819
+ provide: 'HomeRepository',
820
+ useFactory: function (firestore) {
821
+ return new connect.HomeFirestoreRepository(firestore.firestore);
822
+ },
823
+ deps: [firestore.AngularFirestore],
824
+ },
825
+ {
826
+ provide: 'ShopMenuRepository',
827
+ useFactory: function (firestore) {
828
+ return new connect.ShopMenuFirestoreRepository(firestore.firestore);
829
+ },
830
+ deps: [firestore.AngularFirestore],
831
+ },
832
+ {
833
+ provide: 'OrderRepository',
834
+ useFactory: function (firestore) {
835
+ return new connect.OrderFirestoreRepository(firestore.firestore);
836
+ },
837
+ deps: [firestore.AngularFirestore],
838
+ },
839
+ {
840
+ provide: 'PaymentRepository',
841
+ useFactory: function (firestore) {
842
+ return new connect.PaymentFirestoreRepository(firestore.firestore);
843
+ },
844
+ deps: [firestore.AngularFirestore],
845
+ },
846
+ {
847
+ provide: 'ProductRepository',
848
+ useFactory: function (firestore) {
849
+ return new connect.ProductFirestoreRepository(firestore.firestore);
850
+ },
851
+ deps: [firestore.AngularFirestore],
852
+ },
853
+ {
854
+ provide: 'SubscriptionPaymentRepository',
855
+ useFactory: function (firestore, subscriptionRepository) {
856
+ return new connect.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
857
+ },
858
+ deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
859
+ },
860
+ {
861
+ provide: 'SubscriptionPlanRepository',
862
+ useFactory: function (firestore) {
863
+ return new connect.SubscriptionPlanFirestoreRepository(firestore.firestore);
864
+ },
865
+ deps: [firestore.AngularFirestore],
866
+ },
867
+ {
868
+ provide: 'SubscriptionRepository',
869
+ useFactory: function (firestore) {
870
+ return new connect.SubscriptionFirestoreRepository(firestore.firestore);
871
+ },
872
+ deps: [firestore.AngularFirestore],
873
+ },
874
+ {
875
+ provide: 'UserRepository',
876
+ useFactory: function (firestore) {
877
+ return new connect.UserFirestoreRepository(firestore.firestore);
878
+ },
879
+ deps: [firestore.AngularFirestore],
880
+ },
881
+ {
882
+ provide: 'UserAddressRepository',
883
+ useFactory: function (firestore, userRepository) {
884
+ return new connect.UserAddressFirestoreRepository(firestore.firestore, userRepository);
885
+ },
886
+ deps: [firestore.AngularFirestore, 'UserRepository'],
887
+ },
888
+ {
889
+ provide: 'VariantRepository',
890
+ useFactory: function (firestore, productRepository) {
891
+ return new connect.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
892
+ },
893
+ deps: [firestore.AngularFirestore, 'ProductRepository'],
894
+ },
895
+ ],
896
+ }]
94
897
  }] });
95
898
 
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: 'Buy2WinRepository',
122
- useFactory: function (firestore) {
123
- return new connect.Buy2WinFirestoreRepository(firestore.firestore);
124
- },
125
- deps: [firestore.AngularFirestore],
126
- },
127
- {
128
- provide: 'CategoryRepository',
129
- useFactory: function (firestore) {
130
- return new connect.CategoryFirestoreRepository(firestore.firestore);
131
- },
132
- deps: [firestore.AngularFirestore],
133
- },
134
- {
135
- provide: 'CheckoutRepository',
136
- useFactory: function (firestore) {
137
- return new connect.CheckoutFirestoreRepository(firestore.firestore);
138
- },
139
- deps: [firestore.AngularFirestore],
140
- },
141
- {
142
- provide: 'CheckoutSubscriptionRepository',
143
- useFactory: function (firestore) {
144
- return new connect.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
145
- },
146
- deps: [firestore.AngularFirestore],
147
- },
148
- {
149
- provide: 'CouponRepository',
150
- useFactory: function (firestore) {
151
- return new connect.CouponFirestoreRepository(firestore.firestore);
152
- },
153
- deps: [firestore.AngularFirestore],
154
- },
155
- {
156
- provide: 'EditionRepository',
157
- useFactory: function (firestore, subscriptionRepository) {
158
- return new connect.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
159
- },
160
- deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
161
- },
162
- {
163
- provide: 'HomeRepository',
164
- useFactory: function (firestore) {
165
- return new connect.HomeFirestoreRepository(firestore.firestore);
166
- },
167
- deps: [firestore.AngularFirestore],
168
- },
169
- {
170
- provide: 'ShopMenuRepository',
171
- useFactory: function (firestore) {
172
- return new connect.ShopMenuFirestoreRepository(firestore.firestore);
173
- },
174
- deps: [firestore.AngularFirestore],
175
- },
176
- {
177
- provide: 'OrderRepository',
178
- useFactory: function (firestore) {
179
- return new connect.OrderFirestoreRepository(firestore.firestore);
180
- },
181
- deps: [firestore.AngularFirestore],
182
- },
183
- {
184
- provide: 'PaymentRepository',
185
- useFactory: function (firestore) {
186
- return new connect.PaymentFirestoreRepository(firestore.firestore);
187
- },
188
- deps: [firestore.AngularFirestore],
189
- },
190
- {
191
- provide: 'ProductRepository',
192
- useFactory: function (firestore) {
193
- return new connect.ProductFirestoreRepository(firestore.firestore);
194
- },
195
- deps: [firestore.AngularFirestore],
196
- },
197
- {
198
- provide: 'SubscriptionPaymentRepository',
199
- useFactory: function (firestore, subscriptionRepository) {
200
- return new connect.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
201
- },
202
- deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
203
- },
204
- {
205
- provide: 'SubscriptionPlanRepository',
206
- useFactory: function (firestore) {
207
- return new connect.SubscriptionPlanFirestoreRepository(firestore.firestore);
208
- },
209
- deps: [firestore.AngularFirestore],
210
- },
211
- {
212
- provide: 'SubscriptionRepository',
213
- useFactory: function (firestore) {
214
- return new connect.SubscriptionFirestoreRepository(firestore.firestore);
215
- },
216
- deps: [firestore.AngularFirestore],
217
- },
218
- {
219
- provide: 'UserRepository',
220
- useFactory: function (firestore) {
221
- return new connect.UserFirestoreRepository(firestore.firestore);
222
- },
223
- deps: [firestore.AngularFirestore],
224
- },
225
- {
226
- provide: 'UserAddressRepository',
227
- useFactory: function (firestore, userRepository) {
228
- return new connect.UserAddressFirestoreRepository(firestore.firestore, userRepository);
229
- },
230
- deps: [firestore.AngularFirestore, 'UserRepository'],
231
- },
232
- {
233
- provide: 'VariantRepository',
234
- useFactory: function (firestore, productRepository) {
235
- return new connect.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
236
- },
237
- deps: [firestore.AngularFirestore, 'ProductRepository'],
238
- },
239
- ], imports: [[fire.AngularFireModule]] });
240
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
241
- type: i0.NgModule,
242
- args: [{
243
- imports: [fire.AngularFireModule],
244
- providers: [
245
- {
246
- provide: 'BeautyProfileRepository',
247
- useFactory: function (firestore, userRepository) {
248
- return new connect.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
249
- },
250
- deps: [firestore.AngularFirestore, 'UserRepository'],
251
- },
252
- {
253
- provide: 'Buy2WinRepository',
254
- useFactory: function (firestore) {
255
- return new connect.Buy2WinFirestoreRepository(firestore.firestore);
256
- },
257
- deps: [firestore.AngularFirestore],
258
- },
259
- {
260
- provide: 'CategoryRepository',
261
- useFactory: function (firestore) {
262
- return new connect.CategoryFirestoreRepository(firestore.firestore);
263
- },
264
- deps: [firestore.AngularFirestore],
265
- },
266
- {
267
- provide: 'CheckoutRepository',
268
- useFactory: function (firestore) {
269
- return new connect.CheckoutFirestoreRepository(firestore.firestore);
270
- },
271
- deps: [firestore.AngularFirestore],
272
- },
273
- {
274
- provide: 'CheckoutSubscriptionRepository',
275
- useFactory: function (firestore) {
276
- return new connect.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
277
- },
278
- deps: [firestore.AngularFirestore],
279
- },
280
- {
281
- provide: 'CouponRepository',
282
- useFactory: function (firestore) {
283
- return new connect.CouponFirestoreRepository(firestore.firestore);
284
- },
285
- deps: [firestore.AngularFirestore],
286
- },
287
- {
288
- provide: 'EditionRepository',
289
- useFactory: function (firestore, subscriptionRepository) {
290
- return new connect.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
291
- },
292
- deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
293
- },
294
- {
295
- provide: 'HomeRepository',
296
- useFactory: function (firestore) {
297
- return new connect.HomeFirestoreRepository(firestore.firestore);
298
- },
299
- deps: [firestore.AngularFirestore],
300
- },
301
- {
302
- provide: 'ShopMenuRepository',
303
- useFactory: function (firestore) {
304
- return new connect.ShopMenuFirestoreRepository(firestore.firestore);
305
- },
306
- deps: [firestore.AngularFirestore],
307
- },
308
- {
309
- provide: 'OrderRepository',
310
- useFactory: function (firestore) {
311
- return new connect.OrderFirestoreRepository(firestore.firestore);
312
- },
313
- deps: [firestore.AngularFirestore],
314
- },
315
- {
316
- provide: 'PaymentRepository',
317
- useFactory: function (firestore) {
318
- return new connect.PaymentFirestoreRepository(firestore.firestore);
319
- },
320
- deps: [firestore.AngularFirestore],
321
- },
322
- {
323
- provide: 'ProductRepository',
324
- useFactory: function (firestore) {
325
- return new connect.ProductFirestoreRepository(firestore.firestore);
326
- },
327
- deps: [firestore.AngularFirestore],
328
- },
329
- {
330
- provide: 'SubscriptionPaymentRepository',
331
- useFactory: function (firestore, subscriptionRepository) {
332
- return new connect.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
333
- },
334
- deps: [firestore.AngularFirestore, 'SubscriptionRepository'],
335
- },
336
- {
337
- provide: 'SubscriptionPlanRepository',
338
- useFactory: function (firestore) {
339
- return new connect.SubscriptionPlanFirestoreRepository(firestore.firestore);
340
- },
341
- deps: [firestore.AngularFirestore],
342
- },
343
- {
344
- provide: 'SubscriptionRepository',
345
- useFactory: function (firestore) {
346
- return new connect.SubscriptionFirestoreRepository(firestore.firestore);
347
- },
348
- deps: [firestore.AngularFirestore],
349
- },
350
- {
351
- provide: 'UserRepository',
352
- useFactory: function (firestore) {
353
- return new connect.UserFirestoreRepository(firestore.firestore);
354
- },
355
- deps: [firestore.AngularFirestore],
356
- },
357
- {
358
- provide: 'UserAddressRepository',
359
- useFactory: function (firestore, userRepository) {
360
- return new connect.UserAddressFirestoreRepository(firestore.firestore, userRepository);
361
- },
362
- deps: [firestore.AngularFirestore, 'UserRepository'],
363
- },
364
- {
365
- provide: 'VariantRepository',
366
- useFactory: function (firestore, productRepository) {
367
- return new connect.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
368
- },
369
- deps: [firestore.AngularFirestore, 'ProductRepository'],
370
- },
371
- ],
372
- }]
899
+ var AngularConnectModule = /** @class */ (function () {
900
+ function AngularConnectModule() {
901
+ }
902
+ AngularConnectModule.initializeApp = function (options, nameOrConfig) {
903
+ return {
904
+ ngModule: AngularConnectModule,
905
+ providers: [
906
+ { provide: fire.FIREBASE_OPTIONS, useValue: options },
907
+ { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
908
+ ],
909
+ };
910
+ };
911
+ return AngularConnectModule;
912
+ }());
913
+ AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
914
+ AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule] });
915
+ AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularConnectModule, providers: [AuthService, CartService, CheckoutService], imports: [[fire.AngularFireModule, AngularFirestoreModule]] });
916
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
917
+ type: i0.NgModule,
918
+ args: [{
919
+ imports: [fire.AngularFireModule, AngularFirestoreModule],
920
+ providers: [AuthService, CartService, CheckoutService],
921
+ }]
373
922
  }] });
374
923
 
375
- /**
376
- * Generated bundle index. Do not edit.
924
+ /**
925
+ * Generated bundle index. Do not edit.
377
926
  */
378
927
 
928
+ exports.AngularConnectModule = AngularConnectModule;
379
929
  exports.AngularFirebaseAuthModule = AngularFirebaseAuthModule;
380
930
  exports.AngularFirestoreModule = AngularFirestoreModule;
931
+ exports.AuthService = AuthService;
932
+ exports.CartService = CartService;
933
+ exports.CheckoutService = CheckoutService;
381
934
 
382
935
  Object.defineProperty(exports, '__esModule', { value: true });
383
936