@infrab4a/connect-angular 0.8.0 → 0.8.1

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