@infrab4a/connect-angular 3.11.0-beta.1 → 4.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/angular-connect.module.d.ts +5 -6
  2. package/angular-firebase-auth.module.d.ts +6 -4
  3. package/angular-firestore.module.d.ts +7 -5
  4. package/consts/firebase-const.d.ts +3 -0
  5. package/consts/index.d.ts +1 -2
  6. package/esm2020/angular-connect.module.mjs +49 -0
  7. package/esm2020/angular-elastic-search.module.mjs +38 -0
  8. package/esm2020/angular-firebase-auth.module.mjs +130 -0
  9. package/esm2020/angular-firestore.module.mjs +358 -0
  10. package/esm2020/angular-hasura-graphql.module.mjs +90 -0
  11. package/esm2020/consts/firebase-const.mjs +4 -0
  12. package/esm2020/consts/index.mjs +5 -0
  13. package/esm2020/index.mjs +6 -0
  14. package/esm2020/services/auth.service.mjs +37 -0
  15. package/esm2020/services/cart.service.mjs +143 -0
  16. package/esm2020/services/checkout-subscription.service.mjs +51 -0
  17. package/esm2020/services/checkout.service.mjs +73 -0
  18. package/esm2020/services/coupon.service.mjs +226 -0
  19. package/esm2020/services/errors/group-invalid-coupon.error.mjs +8 -0
  20. package/esm2020/services/errors/index.mjs +3 -0
  21. package/esm2020/services/errors/invalid-coupon.error.mjs +7 -0
  22. package/esm2020/services/home-shop.service.mjs +114 -0
  23. package/esm2020/services/index.mjs +8 -0
  24. package/esm2020/services/order.service.mjs +30 -0
  25. package/esm2020/types/firebase-app-config.type.mjs +2 -0
  26. package/esm2020/types/index.mjs +2 -0
  27. package/fesm2015/infrab4a-connect-angular.mjs +1336 -0
  28. package/fesm2015/infrab4a-connect-angular.mjs.map +1 -0
  29. package/fesm2020/infrab4a-connect-angular.mjs +1291 -0
  30. package/fesm2020/infrab4a-connect-angular.mjs.map +1 -0
  31. package/index.d.ts +2 -2
  32. package/package.json +24 -12
  33. package/services/auth.service.d.ts +3 -4
  34. package/services/cart.service.d.ts +2 -9
  35. package/services/coupon.service.d.ts +10 -13
  36. package/services/errors/group-invalid-coupon.error.d.ts +6 -0
  37. package/services/errors/index.d.ts +2 -0
  38. package/services/errors/invalid-coupon.error.d.ts +4 -0
  39. package/services/index.d.ts +2 -4
  40. package/services/order.service.d.ts +2 -2
  41. package/types/firebase-app-config.type.d.ts +1 -0
  42. package/types/index.d.ts +1 -0
  43. package/bundles/infrab4a-connect-angular.umd.js +0 -2649
  44. package/bundles/infrab4a-connect-angular.umd.js.map +0 -1
  45. package/consts/backend-url.const.d.ts +0 -1
  46. package/consts/category-structure.d.ts +0 -1
  47. package/esm2015/angular-connect.module.js +0 -63
  48. package/esm2015/angular-elastic-search.module.js +0 -34
  49. package/esm2015/angular-firebase-auth.module.js +0 -113
  50. package/esm2015/angular-firestore.module.js +0 -394
  51. package/esm2015/angular-hasura-graphql.module.js +0 -172
  52. package/esm2015/consts/backend-url.const.js +0 -2
  53. package/esm2015/consts/category-structure.js +0 -2
  54. package/esm2015/consts/index.js +0 -6
  55. package/esm2015/index.js +0 -6
  56. package/esm2015/services/auth.service.js +0 -42
  57. package/esm2015/services/cart.service.js +0 -281
  58. package/esm2015/services/catalog/adapters/category-structure.adapter.js +0 -2
  59. package/esm2015/services/catalog/adapters/index.js +0 -4
  60. package/esm2015/services/catalog/adapters/new-category-structure.adapter.js +0 -51
  61. package/esm2015/services/catalog/adapters/old-category-structure.adapter.js +0 -27
  62. package/esm2015/services/catalog/catalog.service.js +0 -96
  63. package/esm2015/services/catalog/category.service.js +0 -56
  64. package/esm2015/services/catalog/enums/index.js +0 -2
  65. package/esm2015/services/catalog/enums/product-sorts.enum.js +0 -11
  66. package/esm2015/services/catalog/index.js +0 -6
  67. package/esm2015/services/catalog/models/category-with-tree.model.js +0 -10
  68. package/esm2015/services/catalog/models/index.js +0 -2
  69. package/esm2015/services/catalog/types/index.js +0 -2
  70. package/esm2015/services/catalog/types/product-sort.type.js +0 -2
  71. package/esm2015/services/checkout-subscription.service.js +0 -53
  72. package/esm2015/services/checkout.service.js +0 -70
  73. package/esm2015/services/coupon.service.js +0 -240
  74. package/esm2015/services/home-shop.service.js +0 -116
  75. package/esm2015/services/index.js +0 -10
  76. package/esm2015/services/order.service.js +0 -32
  77. package/esm2015/services/shipping.service.js +0 -98
  78. package/esm2015/services/types/shipping-methods.type.js +0 -2
  79. package/fesm2015/infrab4a-connect-angular.js +0 -1868
  80. package/fesm2015/infrab4a-connect-angular.js.map +0 -1
  81. package/infrab4a-connect-angular.d.ts +0 -5
  82. package/services/catalog/adapters/category-structure.adapter.d.ts +0 -4
  83. package/services/catalog/adapters/index.d.ts +0 -3
  84. package/services/catalog/adapters/new-category-structure.adapter.d.ts +0 -14
  85. package/services/catalog/adapters/old-category-structure.adapter.d.ts +0 -10
  86. package/services/catalog/catalog.service.d.ts +0 -54
  87. package/services/catalog/category.service.d.ts +0 -15
  88. package/services/catalog/enums/index.d.ts +0 -1
  89. package/services/catalog/enums/product-sorts.enum.d.ts +0 -9
  90. package/services/catalog/index.d.ts +0 -5
  91. package/services/catalog/models/category-with-tree.model.d.ts +0 -4
  92. package/services/catalog/models/index.d.ts +0 -1
  93. package/services/catalog/types/index.d.ts +0 -1
  94. package/services/catalog/types/product-sort.type.d.ts +0 -2
  95. package/services/shipping.service.d.ts +0 -19
  96. package/services/types/shipping-methods.type.d.ts +0 -12
  97. /package/{esm2015/consts/default-shop.const.js → esm2020/consts/default-shop.const.mjs} +0 -0
  98. /package/{esm2015/consts/es-config.const.js → esm2020/consts/es-config.const.mjs} +0 -0
  99. /package/{esm2015/consts/hasura-options.const.js → esm2020/consts/hasura-options.const.mjs} +0 -0
  100. /package/{esm2015/infrab4a-connect-angular.js → esm2020/infrab4a-connect-angular.mjs} +0 -0
  101. /package/{esm2015/services/types/index.js → esm2020/services/types/index.mjs} +0 -0
  102. /package/{esm2015/services/types/required-checkout-data.type.js → esm2020/services/types/required-checkout-data.type.mjs} +0 -0
  103. /package/{esm2015/services/types/required-checkout-subscription-data.type.js → esm2020/services/types/required-checkout-subscription-data.type.mjs} +0 -0
@@ -1,2649 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/fire'), require('@infrab4a/connect'), require('@angular/fire/firestore'), require('rxjs'), require('rxjs/operators'), require('@angular/fire/auth'), require('js-cookie'), require('class-transformer'), require('@angular/common/http')) :
3
- typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', '@angular/fire', '@infrab4a/connect', '@angular/fire/firestore', 'rxjs', 'rxjs/operators', '@angular/fire/auth', 'js-cookie', 'class-transformer', '@angular/common/http'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a["connect-angular"] = {}), global.ng.core, global.ng.fire, global["@infrab4a/connect"], global.ng.fire.firestore, global.rxjs, global.rxjs.operators, global.ng.fire.auth, global["js-cookie"], global["class-transformer"], global.ng.common.http));
5
- })(this, (function (exports, i0, fire, i1, i1$1, rxjs, operators, i1$2, cookie, classTransformer, i1$3) { 'use strict';
6
-
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- function _interopNamespace(e) {
10
- if (e && e.__esModule) return e;
11
- var n = Object.create(null);
12
- if (e) {
13
- Object.keys(e).forEach(function (k) {
14
- if (k !== 'default') {
15
- var d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: function () { return e[k]; }
19
- });
20
- }
21
- });
22
- }
23
- n["default"] = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1);
29
- var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$1);
30
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1$2);
31
- var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
32
- var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$3);
33
-
34
- /*! *****************************************************************************
35
- Copyright (c) Microsoft Corporation.
36
-
37
- Permission to use, copy, modify, and/or distribute this software for any
38
- purpose with or without fee is hereby granted.
39
-
40
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
41
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
42
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
43
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
44
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
45
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
46
- PERFORMANCE OF THIS SOFTWARE.
47
- ***************************************************************************** */
48
- /* global Reflect, Promise */
49
- var extendStatics = function (d, b) {
50
- extendStatics = Object.setPrototypeOf ||
51
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
52
- function (d, b) { for (var p in b)
53
- if (Object.prototype.hasOwnProperty.call(b, p))
54
- d[p] = b[p]; };
55
- return extendStatics(d, b);
56
- };
57
- function __extends(d, b) {
58
- if (typeof b !== "function" && b !== null)
59
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
60
- extendStatics(d, b);
61
- function __() { this.constructor = d; }
62
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
63
- }
64
- var __assign = function () {
65
- __assign = Object.assign || function __assign(t) {
66
- for (var s, i = 1, n = arguments.length; i < n; i++) {
67
- s = arguments[i];
68
- for (var p in s)
69
- if (Object.prototype.hasOwnProperty.call(s, p))
70
- t[p] = s[p];
71
- }
72
- return t;
73
- };
74
- return __assign.apply(this, arguments);
75
- };
76
- function __rest(s, e) {
77
- var t = {};
78
- for (var p in s)
79
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
80
- t[p] = s[p];
81
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
82
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
83
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
84
- t[p[i]] = s[p[i]];
85
- }
86
- return t;
87
- }
88
- function __decorate(decorators, target, key, desc) {
89
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
90
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
91
- r = Reflect.decorate(decorators, target, key, desc);
92
- else
93
- for (var i = decorators.length - 1; i >= 0; i--)
94
- if (d = decorators[i])
95
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
96
- return c > 3 && r && Object.defineProperty(target, key, r), r;
97
- }
98
- function __param(paramIndex, decorator) {
99
- return function (target, key) { decorator(target, key, paramIndex); };
100
- }
101
- function __metadata(metadataKey, metadataValue) {
102
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
103
- return Reflect.metadata(metadataKey, metadataValue);
104
- }
105
- function __awaiter(thisArg, _arguments, P, generator) {
106
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
107
- return new (P || (P = Promise))(function (resolve, reject) {
108
- function fulfilled(value) { try {
109
- step(generator.next(value));
110
- }
111
- catch (e) {
112
- reject(e);
113
- } }
114
- function rejected(value) { try {
115
- step(generator["throw"](value));
116
- }
117
- catch (e) {
118
- reject(e);
119
- } }
120
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
121
- step((generator = generator.apply(thisArg, _arguments || [])).next());
122
- });
123
- }
124
- function __generator(thisArg, body) {
125
- var _ = { label: 0, sent: function () { if (t[0] & 1)
126
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
127
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
128
- function verb(n) { return function (v) { return step([n, v]); }; }
129
- function step(op) {
130
- if (f)
131
- throw new TypeError("Generator is already executing.");
132
- while (_)
133
- try {
134
- 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)
135
- return t;
136
- if (y = 0, t)
137
- op = [op[0] & 2, t.value];
138
- switch (op[0]) {
139
- case 0:
140
- case 1:
141
- t = op;
142
- break;
143
- case 4:
144
- _.label++;
145
- return { value: op[1], done: false };
146
- case 5:
147
- _.label++;
148
- y = op[1];
149
- op = [0];
150
- continue;
151
- case 7:
152
- op = _.ops.pop();
153
- _.trys.pop();
154
- continue;
155
- default:
156
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
157
- _ = 0;
158
- continue;
159
- }
160
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
161
- _.label = op[1];
162
- break;
163
- }
164
- if (op[0] === 6 && _.label < t[1]) {
165
- _.label = t[1];
166
- t = op;
167
- break;
168
- }
169
- if (t && _.label < t[2]) {
170
- _.label = t[2];
171
- _.ops.push(op);
172
- break;
173
- }
174
- if (t[2])
175
- _.ops.pop();
176
- _.trys.pop();
177
- continue;
178
- }
179
- op = body.call(thisArg, _);
180
- }
181
- catch (e) {
182
- op = [6, e];
183
- y = 0;
184
- }
185
- finally {
186
- f = t = 0;
187
- }
188
- if (op[0] & 5)
189
- throw op[1];
190
- return { value: op[0] ? op[1] : void 0, done: true };
191
- }
192
- }
193
- var __createBinding = Object.create ? (function (o, m, k, k2) {
194
- if (k2 === undefined)
195
- k2 = k;
196
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
197
- }) : (function (o, m, k, k2) {
198
- if (k2 === undefined)
199
- k2 = k;
200
- o[k2] = m[k];
201
- });
202
- function __exportStar(m, o) {
203
- for (var p in m)
204
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
205
- __createBinding(o, m, p);
206
- }
207
- function __values(o) {
208
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
209
- if (m)
210
- return m.call(o);
211
- if (o && typeof o.length === "number")
212
- return {
213
- next: function () {
214
- if (o && i >= o.length)
215
- o = void 0;
216
- return { value: o && o[i++], done: !o };
217
- }
218
- };
219
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
220
- }
221
- function __read(o, n) {
222
- var m = typeof Symbol === "function" && o[Symbol.iterator];
223
- if (!m)
224
- return o;
225
- var i = m.call(o), r, ar = [], e;
226
- try {
227
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
228
- ar.push(r.value);
229
- }
230
- catch (error) {
231
- e = { error: error };
232
- }
233
- finally {
234
- try {
235
- if (r && !r.done && (m = i["return"]))
236
- m.call(i);
237
- }
238
- finally {
239
- if (e)
240
- throw e.error;
241
- }
242
- }
243
- return ar;
244
- }
245
- /** @deprecated */
246
- function __spread() {
247
- for (var ar = [], i = 0; i < arguments.length; i++)
248
- ar = ar.concat(__read(arguments[i]));
249
- return ar;
250
- }
251
- /** @deprecated */
252
- function __spreadArrays() {
253
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
254
- s += arguments[i].length;
255
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
256
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
257
- r[k] = a[j];
258
- return r;
259
- }
260
- function __spreadArray(to, from, pack) {
261
- if (pack || arguments.length === 2)
262
- for (var i = 0, l = from.length, ar; i < l; i++) {
263
- if (ar || !(i in from)) {
264
- if (!ar)
265
- ar = Array.prototype.slice.call(from, 0, i);
266
- ar[i] = from[i];
267
- }
268
- }
269
- return to.concat(ar || Array.prototype.slice.call(from));
270
- }
271
- function __await(v) {
272
- return this instanceof __await ? (this.v = v, this) : new __await(v);
273
- }
274
- function __asyncGenerator(thisArg, _arguments, generator) {
275
- if (!Symbol.asyncIterator)
276
- throw new TypeError("Symbol.asyncIterator is not defined.");
277
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
278
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
279
- function verb(n) { if (g[n])
280
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
281
- function resume(n, v) { try {
282
- step(g[n](v));
283
- }
284
- catch (e) {
285
- settle(q[0][3], e);
286
- } }
287
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
288
- function fulfill(value) { resume("next", value); }
289
- function reject(value) { resume("throw", value); }
290
- function settle(f, v) { if (f(v), q.shift(), q.length)
291
- resume(q[0][0], q[0][1]); }
292
- }
293
- function __asyncDelegator(o) {
294
- var i, p;
295
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
296
- 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; }
297
- }
298
- function __asyncValues(o) {
299
- if (!Symbol.asyncIterator)
300
- throw new TypeError("Symbol.asyncIterator is not defined.");
301
- var m = o[Symbol.asyncIterator], i;
302
- 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);
303
- 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); }); }; }
304
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
305
- }
306
- function __makeTemplateObject(cooked, raw) {
307
- if (Object.defineProperty) {
308
- Object.defineProperty(cooked, "raw", { value: raw });
309
- }
310
- else {
311
- cooked.raw = raw;
312
- }
313
- return cooked;
314
- }
315
- ;
316
- var __setModuleDefault = Object.create ? (function (o, v) {
317
- Object.defineProperty(o, "default", { enumerable: true, value: v });
318
- }) : function (o, v) {
319
- o["default"] = v;
320
- };
321
- function __importStar(mod) {
322
- if (mod && mod.__esModule)
323
- return mod;
324
- var result = {};
325
- if (mod != null)
326
- for (var k in mod)
327
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
328
- __createBinding(result, mod, k);
329
- __setModuleDefault(result, mod);
330
- return result;
331
- }
332
- function __importDefault(mod) {
333
- return (mod && mod.__esModule) ? mod : { default: mod };
334
- }
335
- function __classPrivateFieldGet(receiver, state, kind, f) {
336
- if (kind === "a" && !f)
337
- throw new TypeError("Private accessor was defined without a getter");
338
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
339
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
340
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
341
- }
342
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
343
- if (kind === "m")
344
- throw new TypeError("Private method is not writable");
345
- if (kind === "a" && !f)
346
- throw new TypeError("Private accessor was defined without a setter");
347
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
348
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
349
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
350
- }
351
-
352
- var ES_CONFIG = 'ES_CONFIG';
353
-
354
- var AngularElasticSeachModule = /** @class */ (function () {
355
- function AngularElasticSeachModule() {
356
- }
357
- AngularElasticSeachModule.initializeApp = function (options) {
358
- return {
359
- ngModule: AngularElasticSeachModule,
360
- providers: [{ provide: ES_CONFIG, useValue: options }],
361
- };
362
- };
363
- return AngularElasticSeachModule;
364
- }());
365
- AngularElasticSeachModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
366
- AngularElasticSeachModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule });
367
- AngularElasticSeachModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, providers: [
368
- {
369
- provide: i1.ProductsIndex,
370
- useFactory: function (configuration) { return new i1.ProductsIndex(new i1.AxiosAdapter(configuration)); },
371
- deps: [ES_CONFIG],
372
- },
373
- ] });
374
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, decorators: [{
375
- type: i0.NgModule,
376
- args: [{
377
- providers: [
378
- {
379
- provide: i1.ProductsIndex,
380
- useFactory: function (configuration) { return new i1.ProductsIndex(new i1.AxiosAdapter(configuration)); },
381
- deps: [ES_CONFIG],
382
- },
383
- ],
384
- }]
385
- }] });
386
-
387
- var AngularFirestoreModule = /** @class */ (function () {
388
- function AngularFirestoreModule() {
389
- }
390
- AngularFirestoreModule.initializeApp = function (options, nameOrConfig) {
391
- return {
392
- ngModule: AngularFirestoreModule,
393
- providers: [
394
- { provide: fire.FIREBASE_OPTIONS, useValue: options.firebase },
395
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
396
- { provide: ES_CONFIG, useValue: options.elasticSearch },
397
- ],
398
- };
399
- };
400
- return AngularFirestoreModule;
401
- }());
402
- AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
403
- AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, imports: [fire.AngularFireModule, AngularElasticSeachModule] });
404
- AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
405
- {
406
- provide: 'BeautyProfileRepository',
407
- useFactory: function (firestore, userRepository) {
408
- return new i1.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
409
- },
410
- deps: [i1$1.AngularFirestore, 'UserRepository'],
411
- },
412
- {
413
- provide: 'Buy2WinRepository',
414
- useFactory: function (firestore) {
415
- return new i1.Buy2WinFirestoreRepository(firestore.firestore);
416
- },
417
- deps: [i1$1.AngularFirestore],
418
- },
419
- {
420
- provide: i1.CategoryFirestoreRepository,
421
- useFactory: function (firestore) {
422
- return new i1.CategoryFirestoreRepository(firestore.firestore);
423
- },
424
- deps: [i1$1.AngularFirestore],
425
- },
426
- {
427
- provide: 'CheckoutRepository',
428
- useFactory: function (firestore) {
429
- return new i1.CheckoutFirestoreRepository(firestore.firestore);
430
- },
431
- deps: [i1$1.AngularFirestore],
432
- },
433
- {
434
- provide: 'CheckoutSubscriptionRepository',
435
- useFactory: function (firestore) {
436
- return new i1.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
437
- },
438
- deps: [i1$1.AngularFirestore],
439
- },
440
- {
441
- provide: 'CouponRepository',
442
- useFactory: function (firestore) {
443
- return new i1.CouponFirestoreRepository(firestore.firestore);
444
- },
445
- deps: [i1$1.AngularFirestore],
446
- },
447
- {
448
- provide: 'CampaignHashtagRepository',
449
- useFactory: function (firestore) {
450
- return new i1.CampaignHashtagFirestoreRepository(firestore.firestore);
451
- },
452
- deps: [i1$1.AngularFirestore],
453
- },
454
- {
455
- provide: 'CampaignDashboardRepository',
456
- useFactory: function (firestore) {
457
- return new i1.CampaignDashboardFirestoreRepository(firestore.firestore);
458
- },
459
- deps: [i1$1.AngularFirestore],
460
- },
461
- {
462
- provide: 'EditionRepository',
463
- useFactory: function (firestore, subscriptionRepository) {
464
- return new i1.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
465
- },
466
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
467
- },
468
- {
469
- provide: 'HomeRepository',
470
- useFactory: function (firestore) {
471
- return new i1.HomeFirestoreRepository(firestore.firestore);
472
- },
473
- deps: [i1$1.AngularFirestore],
474
- },
475
- {
476
- provide: 'LeadRepository',
477
- useFactory: function (firestore) {
478
- return new i1.LeadFirestoreRepository(firestore.firestore);
479
- },
480
- deps: [i1$1.AngularFirestore],
481
- },
482
- {
483
- provide: 'LegacyOrderRepository',
484
- useFactory: function (firestore) {
485
- return new i1.LegacyOrderFirestoreRepository(firestore.firestore);
486
- },
487
- deps: [i1$1.AngularFirestore],
488
- },
489
- {
490
- provide: 'ShopMenuRepository',
491
- useFactory: function (firestore) {
492
- return new i1.ShopMenuFirestoreRepository(firestore.firestore);
493
- },
494
- deps: [i1$1.AngularFirestore],
495
- },
496
- {
497
- provide: 'OrderRepository',
498
- useFactory: function (firestore) {
499
- return new i1.OrderFirestoreRepository(firestore.firestore);
500
- },
501
- deps: [i1$1.AngularFirestore],
502
- },
503
- {
504
- provide: 'PaymentRepository',
505
- useFactory: function (firestore) {
506
- return new i1.PaymentFirestoreRepository(firestore.firestore);
507
- },
508
- deps: [i1$1.AngularFirestore],
509
- },
510
- {
511
- provide: i1.ProductFirestoreRepository,
512
- useFactory: function (firestore) {
513
- return new i1.ProductFirestoreRepository(firestore.firestore);
514
- },
515
- deps: [i1$1.AngularFirestore],
516
- },
517
- {
518
- provide: 'ShopSettingsRepository',
519
- useFactory: function (firestore) {
520
- return new i1.ShopSettingsFirestoreRepository(firestore.firestore);
521
- },
522
- deps: [i1$1.AngularFirestore],
523
- },
524
- {
525
- provide: 'SubscriptionPaymentRepository',
526
- useFactory: function (firestore, subscriptionRepository) {
527
- return new i1.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
528
- },
529
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
530
- },
531
- {
532
- provide: 'SubscriptionPlanRepository',
533
- useFactory: function (firestore) {
534
- return new i1.SubscriptionPlanFirestoreRepository(firestore.firestore);
535
- },
536
- deps: [i1$1.AngularFirestore],
537
- },
538
- {
539
- provide: 'SubscriptionProductRepository',
540
- useFactory: function (firestore) {
541
- return new i1.SubscriptionProductFirestoreRepository(firestore.firestore);
542
- },
543
- deps: [i1$1.AngularFirestore],
544
- },
545
- {
546
- provide: 'SubscriptionRepository',
547
- useFactory: function (firestore) {
548
- return new i1.SubscriptionFirestoreRepository(firestore.firestore);
549
- },
550
- deps: [i1$1.AngularFirestore],
551
- },
552
- {
553
- provide: 'UserRepository',
554
- useFactory: function (firestore) {
555
- return new i1.UserFirestoreRepository(firestore.firestore);
556
- },
557
- deps: [i1$1.AngularFirestore],
558
- },
559
- {
560
- provide: 'UserAddressRepository',
561
- useFactory: function (firestore, userRepository) {
562
- return new i1.UserAddressFirestoreRepository(firestore.firestore, userRepository);
563
- },
564
- deps: [i1$1.AngularFirestore, 'UserRepository'],
565
- },
566
- {
567
- provide: 'UserPaymentMethodRepository',
568
- useFactory: function (firestore, userRepository) {
569
- return new i1.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
570
- },
571
- deps: [i1$1.AngularFirestore, 'UserRepository'],
572
- },
573
- {
574
- provide: i1.ProductVariantFirestoreRepository,
575
- useFactory: function (firestore, productRepository) {
576
- return new i1.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
577
- },
578
- deps: [i1$1.AngularFirestore, i1.ProductFirestoreRepository],
579
- },
580
- {
581
- provide: i0.APP_INITIALIZER,
582
- useFactory: function (firestore) { return function () { return firestore.firestore.settings({ ignoreUndefinedProperties: true }); }; },
583
- deps: [i1$1.AngularFirestore],
584
- multi: true,
585
- },
586
- ], imports: [[fire.AngularFireModule, AngularElasticSeachModule]] });
587
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
588
- type: i0.NgModule,
589
- args: [{
590
- imports: [fire.AngularFireModule, AngularElasticSeachModule],
591
- providers: [
592
- {
593
- provide: 'BeautyProfileRepository',
594
- useFactory: function (firestore, userRepository) {
595
- return new i1.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
596
- },
597
- deps: [i1$1.AngularFirestore, 'UserRepository'],
598
- },
599
- {
600
- provide: 'Buy2WinRepository',
601
- useFactory: function (firestore) {
602
- return new i1.Buy2WinFirestoreRepository(firestore.firestore);
603
- },
604
- deps: [i1$1.AngularFirestore],
605
- },
606
- {
607
- provide: i1.CategoryFirestoreRepository,
608
- useFactory: function (firestore) {
609
- return new i1.CategoryFirestoreRepository(firestore.firestore);
610
- },
611
- deps: [i1$1.AngularFirestore],
612
- },
613
- {
614
- provide: 'CheckoutRepository',
615
- useFactory: function (firestore) {
616
- return new i1.CheckoutFirestoreRepository(firestore.firestore);
617
- },
618
- deps: [i1$1.AngularFirestore],
619
- },
620
- {
621
- provide: 'CheckoutSubscriptionRepository',
622
- useFactory: function (firestore) {
623
- return new i1.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
624
- },
625
- deps: [i1$1.AngularFirestore],
626
- },
627
- {
628
- provide: 'CouponRepository',
629
- useFactory: function (firestore) {
630
- return new i1.CouponFirestoreRepository(firestore.firestore);
631
- },
632
- deps: [i1$1.AngularFirestore],
633
- },
634
- {
635
- provide: 'CampaignHashtagRepository',
636
- useFactory: function (firestore) {
637
- return new i1.CampaignHashtagFirestoreRepository(firestore.firestore);
638
- },
639
- deps: [i1$1.AngularFirestore],
640
- },
641
- {
642
- provide: 'CampaignDashboardRepository',
643
- useFactory: function (firestore) {
644
- return new i1.CampaignDashboardFirestoreRepository(firestore.firestore);
645
- },
646
- deps: [i1$1.AngularFirestore],
647
- },
648
- {
649
- provide: 'EditionRepository',
650
- useFactory: function (firestore, subscriptionRepository) {
651
- return new i1.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
652
- },
653
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
654
- },
655
- {
656
- provide: 'HomeRepository',
657
- useFactory: function (firestore) {
658
- return new i1.HomeFirestoreRepository(firestore.firestore);
659
- },
660
- deps: [i1$1.AngularFirestore],
661
- },
662
- {
663
- provide: 'LeadRepository',
664
- useFactory: function (firestore) {
665
- return new i1.LeadFirestoreRepository(firestore.firestore);
666
- },
667
- deps: [i1$1.AngularFirestore],
668
- },
669
- {
670
- provide: 'LegacyOrderRepository',
671
- useFactory: function (firestore) {
672
- return new i1.LegacyOrderFirestoreRepository(firestore.firestore);
673
- },
674
- deps: [i1$1.AngularFirestore],
675
- },
676
- {
677
- provide: 'ShopMenuRepository',
678
- useFactory: function (firestore) {
679
- return new i1.ShopMenuFirestoreRepository(firestore.firestore);
680
- },
681
- deps: [i1$1.AngularFirestore],
682
- },
683
- {
684
- provide: 'OrderRepository',
685
- useFactory: function (firestore) {
686
- return new i1.OrderFirestoreRepository(firestore.firestore);
687
- },
688
- deps: [i1$1.AngularFirestore],
689
- },
690
- {
691
- provide: 'PaymentRepository',
692
- useFactory: function (firestore) {
693
- return new i1.PaymentFirestoreRepository(firestore.firestore);
694
- },
695
- deps: [i1$1.AngularFirestore],
696
- },
697
- {
698
- provide: i1.ProductFirestoreRepository,
699
- useFactory: function (firestore) {
700
- return new i1.ProductFirestoreRepository(firestore.firestore);
701
- },
702
- deps: [i1$1.AngularFirestore],
703
- },
704
- {
705
- provide: 'ShopSettingsRepository',
706
- useFactory: function (firestore) {
707
- return new i1.ShopSettingsFirestoreRepository(firestore.firestore);
708
- },
709
- deps: [i1$1.AngularFirestore],
710
- },
711
- {
712
- provide: 'SubscriptionPaymentRepository',
713
- useFactory: function (firestore, subscriptionRepository) {
714
- return new i1.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
715
- },
716
- deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
717
- },
718
- {
719
- provide: 'SubscriptionPlanRepository',
720
- useFactory: function (firestore) {
721
- return new i1.SubscriptionPlanFirestoreRepository(firestore.firestore);
722
- },
723
- deps: [i1$1.AngularFirestore],
724
- },
725
- {
726
- provide: 'SubscriptionProductRepository',
727
- useFactory: function (firestore) {
728
- return new i1.SubscriptionProductFirestoreRepository(firestore.firestore);
729
- },
730
- deps: [i1$1.AngularFirestore],
731
- },
732
- {
733
- provide: 'SubscriptionRepository',
734
- useFactory: function (firestore) {
735
- return new i1.SubscriptionFirestoreRepository(firestore.firestore);
736
- },
737
- deps: [i1$1.AngularFirestore],
738
- },
739
- {
740
- provide: 'UserRepository',
741
- useFactory: function (firestore) {
742
- return new i1.UserFirestoreRepository(firestore.firestore);
743
- },
744
- deps: [i1$1.AngularFirestore],
745
- },
746
- {
747
- provide: 'UserAddressRepository',
748
- useFactory: function (firestore, userRepository) {
749
- return new i1.UserAddressFirestoreRepository(firestore.firestore, userRepository);
750
- },
751
- deps: [i1$1.AngularFirestore, 'UserRepository'],
752
- },
753
- {
754
- provide: 'UserPaymentMethodRepository',
755
- useFactory: function (firestore, userRepository) {
756
- return new i1.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
757
- },
758
- deps: [i1$1.AngularFirestore, 'UserRepository'],
759
- },
760
- {
761
- provide: i1.ProductVariantFirestoreRepository,
762
- useFactory: function (firestore, productRepository) {
763
- return new i1.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
764
- },
765
- deps: [i1$1.AngularFirestore, i1.ProductFirestoreRepository],
766
- },
767
- {
768
- provide: i0.APP_INITIALIZER,
769
- useFactory: function (firestore) { return function () { return firestore.firestore.settings({ ignoreUndefinedProperties: true }); }; },
770
- deps: [i1$1.AngularFirestore],
771
- multi: true,
772
- },
773
- ],
774
- }]
775
- }] });
776
-
777
- var BACKEND_URL = 'BACKEND_URL';
778
-
779
- var CATEGORY_STRUCTURE = 'CATEGORY_STRUCTURE';
780
-
781
- var DEFAULT_SHOP = 'DEFAULT_SHOP';
782
-
783
- var HASURA_OPTIONS = 'HASURA_OPTIONS';
784
-
785
- var AngularHasuraGraphQLModule = /** @class */ (function () {
786
- function AngularHasuraGraphQLModule() {
787
- }
788
- AngularHasuraGraphQLModule.initializeApp = function (options) {
789
- return {
790
- ngModule: AngularHasuraGraphQLModule,
791
- providers: [{ provide: HASURA_OPTIONS, useValue: options }],
792
- };
793
- };
794
- return AngularHasuraGraphQLModule;
795
- }());
796
- AngularHasuraGraphQLModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
797
- AngularHasuraGraphQLModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule });
798
- AngularHasuraGraphQLModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, providers: [
799
- {
800
- provide: 'CategoryRepository',
801
- useExisting: i1.CategoryHasuraGraphQLRepository,
802
- },
803
- {
804
- provide: i1.CategoryHasuraGraphQLRepository,
805
- useFactory: function (options, productRepository, categoryFilterRepository) {
806
- return new i1.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository, categoryFilterRepository);
807
- },
808
- deps: [HASURA_OPTIONS, i1.ProductHasuraGraphQLRepository, i1.CategoryFilterHasuraGraphQLRepository],
809
- },
810
- {
811
- provide: 'ProductRepository',
812
- useExisting: i1.ProductHasuraGraphQLRepository,
813
- },
814
- {
815
- provide: i1.ProductHasuraGraphQLRepository,
816
- useFactory: function (options) {
817
- return new i1.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
818
- },
819
- deps: [HASURA_OPTIONS],
820
- },
821
- {
822
- provide: 'VariantRepository',
823
- useExisting: i1.VariantHasuraGraphQLRepository,
824
- },
825
- {
826
- provide: i1.VariantHasuraGraphQLRepository,
827
- useFactory: function (options) {
828
- return new i1.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
829
- },
830
- deps: [HASURA_OPTIONS],
831
- },
832
- {
833
- provide: 'CategoryFilterRepository',
834
- useExisting: i1.CategoryFilterHasuraGraphQLRepository,
835
- },
836
- {
837
- provide: i1.CategoryFilterHasuraGraphQLRepository,
838
- useFactory: function (options) {
839
- return new i1.CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
840
- },
841
- deps: [HASURA_OPTIONS],
842
- },
843
- {
844
- provide: 'FilterOptionRepository',
845
- useExisting: i1.FilterOptionHasuraGraphQLRepository,
846
- },
847
- {
848
- provide: i1.FilterOptionHasuraGraphQLRepository,
849
- useFactory: function (options) {
850
- return new i1.FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
851
- },
852
- deps: [HASURA_OPTIONS],
853
- },
854
- {
855
- provide: 'FilterRepository',
856
- useExisting: i1.FilterHasuraGraphQLRepository,
857
- },
858
- {
859
- provide: i1.FilterHasuraGraphQLRepository,
860
- useFactory: function (options, filterOptionRepository, categoryFilterRepository) {
861
- return new i1.FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
862
- },
863
- deps: [HASURA_OPTIONS, i1.FilterOptionHasuraGraphQLRepository, i1.CategoryFilterHasuraGraphQLRepository],
864
- },
865
- {
866
- provide: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
867
- useFactory: function (options) { return new i1.CategoryCollectionChildrenHasuraGraphQLRepository(options.endpoint, options.credentials); },
868
- },
869
- {
870
- provide: 'CategoryCollectionChildrenRepository',
871
- useExisting: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
872
- },
873
- ] });
874
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, decorators: [{
875
- type: i0.NgModule,
876
- args: [{
877
- providers: [
878
- {
879
- provide: 'CategoryRepository',
880
- useExisting: i1.CategoryHasuraGraphQLRepository,
881
- },
882
- {
883
- provide: i1.CategoryHasuraGraphQLRepository,
884
- useFactory: function (options, productRepository, categoryFilterRepository) {
885
- return new i1.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository, categoryFilterRepository);
886
- },
887
- deps: [HASURA_OPTIONS, i1.ProductHasuraGraphQLRepository, i1.CategoryFilterHasuraGraphQLRepository],
888
- },
889
- {
890
- provide: 'ProductRepository',
891
- useExisting: i1.ProductHasuraGraphQLRepository,
892
- },
893
- {
894
- provide: i1.ProductHasuraGraphQLRepository,
895
- useFactory: function (options) {
896
- return new i1.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
897
- },
898
- deps: [HASURA_OPTIONS],
899
- },
900
- {
901
- provide: 'VariantRepository',
902
- useExisting: i1.VariantHasuraGraphQLRepository,
903
- },
904
- {
905
- provide: i1.VariantHasuraGraphQLRepository,
906
- useFactory: function (options) {
907
- return new i1.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
908
- },
909
- deps: [HASURA_OPTIONS],
910
- },
911
- {
912
- provide: 'CategoryFilterRepository',
913
- useExisting: i1.CategoryFilterHasuraGraphQLRepository,
914
- },
915
- {
916
- provide: i1.CategoryFilterHasuraGraphQLRepository,
917
- useFactory: function (options) {
918
- return new i1.CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
919
- },
920
- deps: [HASURA_OPTIONS],
921
- },
922
- {
923
- provide: 'FilterOptionRepository',
924
- useExisting: i1.FilterOptionHasuraGraphQLRepository,
925
- },
926
- {
927
- provide: i1.FilterOptionHasuraGraphQLRepository,
928
- useFactory: function (options) {
929
- return new i1.FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
930
- },
931
- deps: [HASURA_OPTIONS],
932
- },
933
- {
934
- provide: 'FilterRepository',
935
- useExisting: i1.FilterHasuraGraphQLRepository,
936
- },
937
- {
938
- provide: i1.FilterHasuraGraphQLRepository,
939
- useFactory: function (options, filterOptionRepository, categoryFilterRepository) {
940
- return new i1.FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
941
- },
942
- deps: [HASURA_OPTIONS, i1.FilterOptionHasuraGraphQLRepository, i1.CategoryFilterHasuraGraphQLRepository],
943
- },
944
- {
945
- provide: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
946
- useFactory: function (options) { return new i1.CategoryCollectionChildrenHasuraGraphQLRepository(options.endpoint, options.credentials); },
947
- },
948
- {
949
- provide: 'CategoryCollectionChildrenRepository',
950
- useExisting: i1.CategoryCollectionChildrenHasuraGraphQLRepository,
951
- },
952
- ],
953
- }]
954
- }] });
955
-
956
- var AuthService = /** @class */ (function () {
957
- function AuthService(angularFireAuth, userRepository) {
958
- this.angularFireAuth = angularFireAuth;
959
- this.userRepository = userRepository;
960
- }
961
- AuthService.prototype.getAuthstate = function () {
962
- var observables = [
963
- this.angularFireAuth.authState.pipe(operators.catchError(function () { return rxjs.of(null); })),
964
- this.getUser().pipe(operators.catchError(function () { return rxjs.of(null); })),
965
- ];
966
- return rxjs.combineLatest(observables).pipe(operators.map(function (_a) {
967
- var _b = __read(_a, 2), fireUser = _b[0], user = _b[1];
968
- return {
969
- user: user,
970
- isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
971
- };
972
- }));
973
- };
974
- AuthService.prototype.getUser = function () {
975
- var _this = this;
976
- return this.getFireUser().pipe(operators.map(function (user) { return user === null || user === void 0 ? void 0 : user.uid; }), operators.mergeMap(function (id) { return (id ? rxjs.from(_this.userRepository.get({ id: id })).pipe(operators.catchError(function () { return rxjs.of(null); })) : rxjs.of(null)); }));
977
- };
978
- AuthService.prototype.getTokenId = function () {
979
- return this.angularFireAuth.idToken;
980
- };
981
- AuthService.prototype.getFireUser = function () {
982
- return this.angularFireAuth.user.pipe(operators.catchError(function () { return rxjs.of(null); }));
983
- };
984
- return AuthService;
985
- }());
986
- 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 });
987
- AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService });
988
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, decorators: [{
989
- type: i0.Injectable
990
- }], ctorParameters: function () {
991
- return [{ type: i1__namespace.AngularFireAuth }, { type: undefined, decorators: [{
992
- type: i0.Inject,
993
- args: ['UserRepository']
994
- }] }];
995
- } });
996
-
997
- var CouponService = /** @class */ (function () {
998
- function CouponService(couponRepository, defaultShop, orderRepository, categoryRepository) {
999
- this.couponRepository = couponRepository;
1000
- this.defaultShop = defaultShop;
1001
- this.orderRepository = orderRepository;
1002
- this.categoryRepository = categoryRepository;
1003
- this.emailIsFromCollaborator = function (userEmail) { return !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g)); };
1004
- }
1005
- CouponService.prototype.checkCoupon = function (nickname, checkoutType, checkout, plan) {
1006
- var _this = this;
1007
- return rxjs.from(this.couponRepository
1008
- .find({
1009
- filters: {
1010
- nickname: { operator: i1.Where.EQUALS, value: nickname },
1011
- active: { operator: i1.Where.EQUALS, value: true },
1012
- },
1013
- })
1014
- .then(function (result) { return result.data[0]; })).pipe(operators.concatMap(function (coupon) { return _this.couponValidation(coupon, checkoutType); }), operators.concatMap(function (couponValid) { return _this.couponRulesValidation(couponValid, checkoutType, checkout, plan); }), operators.map(function (couponValidated) { return couponValidated; }));
1015
- };
1016
- CouponService.prototype.couponValidation = function (coupon, checkoutType) {
1017
- return __awaiter(this, void 0, void 0, function () {
1018
- var isInShop, isCheckoutType;
1019
- return __generator(this, function (_c) {
1020
- if (!coupon)
1021
- throw 'Cupom inválido.';
1022
- if ((coupon === null || coupon === void 0 ? void 0 : coupon.beginAt) && (coupon === null || coupon === void 0 ? void 0 : coupon.beginAt.getTime()) > new Date().getTime())
1023
- throw 'Cupom inválido.';
1024
- if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) && (coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn.getTime()) < new Date().getTime())
1025
- throw 'Cupom expirado.';
1026
- isInShop = coupon.shopAvailability === i1.Shops.ALL || coupon.shopAvailability === this.defaultShop;
1027
- if (!isInShop)
1028
- throw 'Cupom inválido para loja.';
1029
- isCheckoutType = coupon.checkoutType === i1.CheckoutTypes.ALL || coupon.checkoutType === checkoutType;
1030
- if (!isCheckoutType)
1031
- throw 'Cupom inválido. Erro de checkout.';
1032
- return [2 /*return*/, coupon];
1033
- });
1034
- });
1035
- };
1036
- CouponService.prototype.couponRulesValidation = function (coupon, checkoutType, checkout, plan) {
1037
- return __awaiter(this, void 0, void 0, function () {
1038
- var validUser, orders, ordersWithUser, couponUseLimits, hasProductCategories, hasMinSubTotal;
1039
- return __generator(this, function (_c) {
1040
- switch (_c.label) {
1041
- case 0:
1042
- if (checkoutType == i1.CheckoutTypes.SUBSCRIPTION) {
1043
- if (coupon.plan && coupon.plan.toUpperCase() !== plan.toUpperCase())
1044
- throw 'Cupom inválido para sua assinatura.';
1045
- return [2 /*return*/, coupon];
1046
- }
1047
- validUser = this.coupomUserValidation(coupon, checkout === null || checkout === void 0 ? void 0 : checkout.user);
1048
- if (!validUser)
1049
- throw 'Usuário não elegível.';
1050
- return [4 /*yield*/, this.getOrdersWithCoupon(coupon)];
1051
- case 1:
1052
- orders = _c.sent();
1053
- ordersWithUser = this.countOrdersWithUser(orders, checkout.user.email);
1054
- couponUseLimits = this.getCouponUseLimits(coupon, checkoutType, checkout.user);
1055
- if (couponUseLimits.limitedPerUser && ordersWithUser > 0)
1056
- throw 'Limite de uso por usuário atingido.';
1057
- if (!couponUseLimits.unlimited && couponUseLimits.total && orders.length >= couponUseLimits.total)
1058
- throw 'Limite de uso atingido.';
1059
- return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
1060
- case 2:
1061
- hasProductCategories = _c.sent();
1062
- if (!hasProductCategories)
1063
- throw 'Seu carrinho não possui produtos elegíveis para desconto.';
1064
- return [4 /*yield*/, this.hasMinSubTotal(coupon, checkout)];
1065
- case 3:
1066
- hasMinSubTotal = _c.sent();
1067
- if (!hasMinSubTotal)
1068
- throw "Valor m\u00EDnimo de " + Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue) + " n\u00E3o atingido";
1069
- return [2 /*return*/, coupon];
1070
- }
1071
- });
1072
- });
1073
- };
1074
- CouponService.prototype.calcDiscountSubscription = function (coupon, checkout) {
1075
- var discount = 0;
1076
- if (coupon.discount.subscription.type == i1.CouponTypes.ABSOLUTE)
1077
- discount = coupon.discount.subscription.value;
1078
- else
1079
- discount = checkout.subscriptionPlan.recurrencePrice * (coupon.discount.subscription.value / 100);
1080
- return rxjs.of(discount);
1081
- };
1082
- CouponService.prototype.calcDiscountShopping = function (coupon, checkout) {
1083
- return __awaiter(this, void 0, void 0, function () {
1084
- var discount;
1085
- return __generator(this, function (_c) {
1086
- switch (_c.label) {
1087
- case 0:
1088
- discount = 0;
1089
- if (!(checkout.user.isSubscriber && coupon.discount.subscriber.value)) return [3 /*break*/, 2];
1090
- return [4 /*yield*/, this.calcDiscountByType(coupon.discount.subscriber.type, coupon.discount.subscriber.value, coupon.productsCategories, checkout)];
1091
- case 1:
1092
- discount = _c.sent();
1093
- return [3 /*break*/, 4];
1094
- case 2: return [4 /*yield*/, this.calcDiscountByType(coupon.discount.non_subscriber.type, coupon.discount.non_subscriber.value, coupon.productsCategories, checkout)];
1095
- case 3:
1096
- discount = _c.sent();
1097
- _c.label = 4;
1098
- case 4: return [2 /*return*/, discount];
1099
- }
1100
- });
1101
- });
1102
- };
1103
- CouponService.prototype.calcDiscountByType = function (type, value, categories, checkout) {
1104
- return __awaiter(this, void 0, void 0, function () {
1105
- var discount, lineItensDiscount, subTotal;
1106
- return __generator(this, function (_c) {
1107
- switch (_c.label) {
1108
- case 0:
1109
- discount = 0;
1110
- return [4 /*yield*/, this.getLineItensEligebleForDiscount(categories, checkout)];
1111
- case 1:
1112
- lineItensDiscount = _c.sent();
1113
- subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user, checkout.shop);
1114
- if (type == i1.CouponTypes.ABSOLUTE) {
1115
- discount = value > subTotal ? subTotal : value;
1116
- }
1117
- else {
1118
- discount = subTotal * (value / 100);
1119
- }
1120
- return [2 /*return*/, discount];
1121
- }
1122
- });
1123
- });
1124
- };
1125
- CouponService.prototype.hasMinSubTotal = function (coupon, checkout) {
1126
- return __awaiter(this, void 0, void 0, function () {
1127
- var lineItensDiscount, subTotal;
1128
- return __generator(this, function (_c) {
1129
- switch (_c.label) {
1130
- case 0:
1131
- if (!coupon.minSubTotalValue)
1132
- return [2 /*return*/, true];
1133
- return [4 /*yield*/, this.getLineItensEligebleForDiscount(coupon.productsCategories, checkout)];
1134
- case 1:
1135
- lineItensDiscount = _c.sent();
1136
- subTotal = this.calcCheckoutSubtotal(lineItensDiscount, checkout.user, checkout.shop);
1137
- if (coupon.minSubTotalValue <= subTotal)
1138
- return [2 /*return*/, true];
1139
- return [2 /*return*/, false];
1140
- }
1141
- });
1142
- });
1143
- };
1144
- CouponService.prototype.hasProductCategories = function (coupon, checkout) {
1145
- var _a;
1146
- return __awaiter(this, void 0, void 0, function () {
1147
- var couponCategories, hasCategories;
1148
- return __generator(this, function (_c) {
1149
- switch (_c.label) {
1150
- case 0:
1151
- if (!coupon.productsCategories || !coupon.productsCategories.length) {
1152
- return [2 /*return*/, true];
1153
- }
1154
- return [4 /*yield*/, this.getCouponCategoriesId(coupon.productsCategories)];
1155
- case 1:
1156
- couponCategories = _c.sent();
1157
- hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
1158
- var _a;
1159
- if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length))
1160
- return true;
1161
- return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat == c; }); });
1162
- });
1163
- return [2 /*return*/, hasCategories.length ? true : false];
1164
- }
1165
- });
1166
- });
1167
- };
1168
- CouponService.prototype.coupomUserValidation = function (coupon, user) {
1169
- if (!user || coupon.exclusivityType.includes(i1.Exclusivities.ALL_USERS))
1170
- return true;
1171
- var userTypes = [];
1172
- if (coupon.exclusivityType.includes(i1.Exclusivities.COLLABORATORS) && this.emailIsFromCollaborator(user.email))
1173
- userTypes.push(i1.Exclusivities.COLLABORATORS);
1174
- if (coupon.exclusivityType.includes(i1.Exclusivities.SPECIFIC_USER) && coupon.userExclusiveEmail.includes(user.email))
1175
- userTypes.push(i1.Exclusivities.SPECIFIC_USER);
1176
- if (coupon.exclusivityType.includes(i1.Exclusivities.ACTIVE_SUBSCRIBER) &&
1177
- user.isSubscriber &&
1178
- user.subscriptionPlan != '')
1179
- userTypes.push(i1.Exclusivities.ACTIVE_SUBSCRIBER);
1180
- if (user.isSubscriber &&
1181
- user.subscriptionPlan == '' &&
1182
- coupon.exclusivityType.includes(i1.Exclusivities.INACTIVE_SUBSCRIBER))
1183
- userTypes.push(i1.Exclusivities.INACTIVE_SUBSCRIBER);
1184
- if (coupon.exclusivityType.includes(i1.Exclusivities.NON_SUBSCRIBER) && !user.isSubscriber)
1185
- userTypes.push(i1.Exclusivities.NON_SUBSCRIBER);
1186
- return coupon.exclusivityType.some(function (r) { return userTypes.includes(r); });
1187
- };
1188
- CouponService.prototype.getCouponCategoriesId = function (productsCategories) {
1189
- return __awaiter(this, void 0, void 0, function () {
1190
- var couponCategories, index, category, children;
1191
- return __generator(this, function (_c) {
1192
- switch (_c.label) {
1193
- case 0:
1194
- couponCategories = [];
1195
- index = 0;
1196
- _c.label = 1;
1197
- case 1:
1198
- if (!(index < productsCategories.length)) return [3 /*break*/, 5];
1199
- return [4 /*yield*/, this.categoryRepository.get({
1200
- id: productsCategories[index],
1201
- })];
1202
- case 2:
1203
- category = _c.sent();
1204
- if (!category) return [3 /*break*/, 4];
1205
- return [4 /*yield*/, this.categoryRepository.getChildren(parseInt(productsCategories[index]))];
1206
- case 3:
1207
- children = _c.sent();
1208
- couponCategories.push.apply(couponCategories, __spreadArray([category.id], __read(children.map(function (c) { return c.id.toString(); }))));
1209
- _c.label = 4;
1210
- case 4:
1211
- index++;
1212
- return [3 /*break*/, 1];
1213
- case 5: return [2 /*return*/, __spreadArray([], __read(new Set(couponCategories)))];
1214
- }
1215
- });
1216
- });
1217
- };
1218
- CouponService.prototype.getLineItensEligebleForDiscount = function (productsCategories, checkout) {
1219
- var _a;
1220
- return __awaiter(this, void 0, void 0, function () {
1221
- var lineItensDiscount, couponCategories;
1222
- return __generator(this, function (_c) {
1223
- switch (_c.label) {
1224
- case 0:
1225
- lineItensDiscount = [];
1226
- return [4 /*yield*/, this.getCouponCategoriesId(productsCategories)];
1227
- case 1:
1228
- couponCategories = _c.sent();
1229
- if (productsCategories && productsCategories.length) {
1230
- lineItensDiscount = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
1231
- var _a;
1232
- if ((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length) {
1233
- return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat == c; }); });
1234
- }
1235
- return true;
1236
- });
1237
- }
1238
- else {
1239
- lineItensDiscount = checkout.lineItems;
1240
- }
1241
- return [2 /*return*/, lineItensDiscount];
1242
- }
1243
- });
1244
- });
1245
- };
1246
- CouponService.prototype.calcCheckoutSubtotal = function (lineItens, user, shop) {
1247
- return ((lineItens === null || lineItens === void 0 ? void 0 : lineItens.reduce(function (acc, curr) {
1248
- var _a, _b;
1249
- return (user === null || user === void 0 ? void 0 : user.isSubscriber) && ((_a = curr.price[shop]) === null || _a === void 0 ? void 0 : _a.subscriberPrice)
1250
- ? acc + ((_b = curr.price[shop]) === null || _b === void 0 ? void 0 : _b.subscriberPrice) * curr.quantity
1251
- : acc + curr.pricePaid * curr.quantity;
1252
- }, 0)) || 0);
1253
- };
1254
- CouponService.prototype.getOrdersWithCoupon = function (coupon) {
1255
- return __awaiter(this, void 0, void 0, function () {
1256
- return __generator(this, function (_c) {
1257
- switch (_c.label) {
1258
- case 0: return [4 /*yield*/, this.orderRepository
1259
- .find({
1260
- filters: {
1261
- coupon: { id: coupon.id },
1262
- payment: { status: 'paid' },
1263
- },
1264
- })
1265
- .then(function (result) { return result.data; })];
1266
- case 1: return [2 /*return*/, _c.sent()];
1267
- }
1268
- });
1269
- });
1270
- };
1271
- CouponService.prototype.countOrdersWithUser = function (orders, email) {
1272
- return orders.filter(function (o) { return o.user.email == email; }).length;
1273
- };
1274
- CouponService.prototype.getCouponUseLimits = function (coupon, checkoutType, user) {
1275
- var couponUseLimits;
1276
- if (checkoutType == i1.CheckoutTypes.ECOMMERCE || checkoutType == i1.CheckoutTypes.ALL) {
1277
- couponUseLimits = user && user.isSubscriber ? coupon.useLimits.subscriber : coupon.useLimits.non_subscriber;
1278
- }
1279
- else {
1280
- couponUseLimits = coupon.useLimits.subscription;
1281
- }
1282
- return couponUseLimits;
1283
- };
1284
- return CouponService;
1285
- }());
1286
- CouponService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, deps: [{ token: 'CouponRepository' }, { token: DEFAULT_SHOP }, { token: 'OrderRepository' }, { token: 'CategoryRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1287
- CouponService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, providedIn: 'root' });
1288
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, decorators: [{
1289
- type: i0.Injectable,
1290
- args: [{
1291
- providedIn: 'root',
1292
- }]
1293
- }], ctorParameters: function () {
1294
- return [{ type: undefined, decorators: [{
1295
- type: i0.Inject,
1296
- args: ['CouponRepository']
1297
- }] }, { type: i1__namespace$1.Shops, decorators: [{
1298
- type: i0.Inject,
1299
- args: [DEFAULT_SHOP]
1300
- }] }, { type: undefined, decorators: [{
1301
- type: i0.Inject,
1302
- args: ['OrderRepository']
1303
- }] }, { type: undefined, decorators: [{
1304
- type: i0.Inject,
1305
- args: ['CategoryRepository']
1306
- }] }];
1307
- } });
1308
-
1309
- var CheckoutService = /** @class */ (function () {
1310
- function CheckoutService(couponService, checkoutRepository, orderRepository, userRepository, defaultShop) {
1311
- this.couponService = couponService;
1312
- this.checkoutRepository = checkoutRepository;
1313
- this.orderRepository = orderRepository;
1314
- this.userRepository = userRepository;
1315
- this.defaultShop = defaultShop;
1316
- }
1317
- CheckoutService.prototype.getCheckout = function (checkoutData) {
1318
- var checkoutId = cookie__default["default"].get('checkoutId');
1319
- if (!i1.isNil(checkoutId))
1320
- return rxjs.from(this.checkoutRepository.get({ id: checkoutId }));
1321
- return rxjs.from(this.createCheckout(checkoutData));
1322
- };
1323
- CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
1324
- var _this = this;
1325
- 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.NotFoundError('User is not found'); }); }));
1326
- };
1327
- CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
1328
- return rxjs.from(this.checkoutRepository.update(i1.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
1329
- };
1330
- CheckoutService.prototype.updateCheckoutUser = function (checkout) {
1331
- return rxjs.from(this.checkoutRepository.update(i1.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
1332
- };
1333
- CheckoutService.prototype.clearCheckoutFromSession = function () {
1334
- cookie__default["default"].remove('checkoutId');
1335
- return rxjs.of();
1336
- };
1337
- CheckoutService.prototype.calcDiscount = function (coupon) {
1338
- var _this = this;
1339
- return this.getCheckout().pipe(operators.concatMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
1340
- switch (_b.label) {
1341
- case 0: return [4 /*yield*/, this.couponService.calcDiscountShopping(coupon, checkout)];
1342
- case 1: return [2 /*return*/, _b.sent()];
1343
- }
1344
- }); }); }));
1345
- };
1346
- CheckoutService.prototype.checkCoupon = function (nickname, checkoutType) {
1347
- var _this = this;
1348
- return this.getCheckout().pipe(operators.concatMap(function (checkout) { return _this.couponService.checkCoupon(nickname, i1.CheckoutTypes.ECOMMERCE, checkout, null).pipe(); }));
1349
- };
1350
- CheckoutService.prototype.createCheckout = function (checkoutData) {
1351
- return __awaiter(this, void 0, void 0, function () {
1352
- var checkout;
1353
- return __generator(this, function (_b) {
1354
- switch (_b.label) {
1355
- case 0: return [4 /*yield*/, this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, i1.Checkout.toInstance(i1.pick(checkoutData, ['user', 'shop'])).toPlain()), { shop: (checkoutData === null || checkoutData === void 0 ? void 0 : checkoutData.shop) || this.defaultShop }))];
1356
- case 1:
1357
- checkout = _b.sent();
1358
- cookie__default["default"].set('checkoutId', checkout.id);
1359
- return [2 /*return*/, checkout];
1360
- }
1361
- });
1362
- });
1363
- };
1364
- return CheckoutService;
1365
- }());
1366
- CheckoutService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, deps: [{ token: CouponService }, { token: 'CheckoutRepository' }, { token: 'OrderRepository' }, { token: 'UserRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1367
- CheckoutService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService });
1368
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, decorators: [{
1369
- type: i0.Injectable
1370
- }], ctorParameters: function () {
1371
- return [{ type: CouponService }, { type: undefined, decorators: [{
1372
- type: i0.Inject,
1373
- args: ['CheckoutRepository']
1374
- }] }, { type: undefined, decorators: [{
1375
- type: i0.Inject,
1376
- args: ['OrderRepository']
1377
- }] }, { type: undefined, decorators: [{
1378
- type: i0.Inject,
1379
- args: ['UserRepository']
1380
- }] }, { type: i1__namespace$1.Shops, decorators: [{
1381
- type: i0.Inject,
1382
- args: [DEFAULT_SHOP]
1383
- }] }];
1384
- } });
1385
-
1386
- var CartService = /** @class */ (function () {
1387
- function CartService(authService, checkoutService, defaultShop, productRepository, categoryRepository, variantRepository, buy2WinRepository) {
1388
- var _this = this;
1389
- this.authService = authService;
1390
- this.checkoutService = checkoutService;
1391
- this.defaultShop = defaultShop;
1392
- this.productRepository = productRepository;
1393
- this.categoryRepository = categoryRepository;
1394
- this.variantRepository = variantRepository;
1395
- this.buy2WinRepository = buy2WinRepository;
1396
- this.cartSubject = new rxjs.Subject();
1397
- this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i1.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
1398
- var _a;
1399
- var items = [];
1400
- var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.id; }).indexOf(lineItem.id);
1401
- if (index > -1) {
1402
- checkoutLoaded.lineItems[index].quantity += quantity;
1403
- checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
1404
- }
1405
- else
1406
- checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
1407
- return _this.checkoutService
1408
- .updateCheckoutLineItems(checkoutLoaded)
1409
- .pipe(operators.map(function (updatedCheckout) { return _this.generateCartObject(updatedCheckout.lineItems); }));
1410
- })); };
1411
- this.generateCartObject = function (items) { return items
1412
- ? items.reduce(function (cart, item) {
1413
- var _h;
1414
- var _a;
1415
- return (Object.assign(Object.assign({}, cart), (_h = {}, _h[item.id] = i1.LineItem.toInstance(Object.assign(Object.assign({}, (cart[item.id] || item)), { quantity: (((_a = cart[item.id]) === null || _a === void 0 ? void 0 : _a.quantity) || 0) + (item.quantity ? item.quantity : 1) })), _h)));
1416
- }, {})
1417
- : []; };
1418
- this.buildLineItem = function (_h) {
1419
- var checkout = _h.checkout, item = _h.item, quantity = _h.quantity;
1420
- return __awaiter(_this, void 0, void 0, function () {
1421
- var _a, _b, _c, _d, _e, _f, _g, product, image, id, name, EAN, slug, stock, price, weight, sku, type, isGift, pricePaid;
1422
- return __generator(this, function (_h) {
1423
- switch (_h.label) {
1424
- case 0: return [4 /*yield*/, this.getProductData(item.id)];
1425
- case 1:
1426
- product = _h.sent();
1427
- 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.id === item.id; })) === null || _b === void 0 ? void 0 : _b.quantity) || 0;
1428
- if (this.checkMaxStock(item, quantity || 0))
1429
- throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
1430
- image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
1431
- id = item.id, name = item.name, EAN = item.EAN, slug = item.slug, stock = item.stock, price = item.price, weight = item.weight, sku = item.sku, type = item.type;
1432
- isGift = item.isGift || null;
1433
- pricePaid = this.getProductPrice({
1434
- product: item,
1435
- shop: checkout.shop || this.defaultShop,
1436
- isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
1437
- });
1438
- i1.RoundProductPricesHelper.roundProductPrices(item);
1439
- return [2 /*return*/, {
1440
- checkout: checkout,
1441
- lineItem: i1.LineItem.toInstance({
1442
- id: id,
1443
- name: name !== null && name !== void 0 ? name : product.name,
1444
- EAN: EAN !== null && EAN !== void 0 ? EAN : product.EAN,
1445
- brand: product.brand,
1446
- slug: slug !== null && slug !== void 0 ? slug : product.slug,
1447
- sku: sku !== null && sku !== void 0 ? sku : product.sku,
1448
- stock: stock,
1449
- price: this.roundPrice(price),
1450
- image: image,
1451
- weight: weight !== null && weight !== void 0 ? weight : product.weight,
1452
- quantity: (item.quantity || 0) + (quantity || 0),
1453
- pricePaid: pricePaid,
1454
- categories: (_f = product.categories) !== null && _f !== void 0 ? _f : [],
1455
- isGift: isGift !== null && isGift !== void 0 ? isGift : null,
1456
- costPrice: (_g = product.costPrice) !== null && _g !== void 0 ? _g : 0,
1457
- type: type,
1458
- }),
1459
- }];
1460
- }
1461
- });
1462
- });
1463
- };
1464
- this.getProductPrice = function (_h) {
1465
- var product = _h.product, isSubscriber = _h.isSubscriber;
1466
- var info = product.price;
1467
- if (product.isGift)
1468
- return 0;
1469
- return isSubscriber && info.subscriberPrice > 0
1470
- ? Number(info.subscriberPrice.toFixed(2))
1471
- : Number(info.price.toFixed(2));
1472
- };
1473
- this.checkMaxStock = function (item, quantity) {
1474
- var _a;
1475
- var maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
1476
- var currentItemAmount = item.quantity || 0;
1477
- return currentItemAmount + quantity > maxStock;
1478
- };
1479
- }
1480
- CartService.prototype.addItem = function (item, quantity) {
1481
- var _this = this;
1482
- if (quantity === void 0) { quantity = 1; }
1483
- return rxjs.from(this.checkoutService.getCheckout()).pipe(operators.concatMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_h) {
1484
- switch (_h.label) {
1485
- case 0: return [4 /*yield*/, this.buildLineItem({ checkout: checkout, item: item, quantity: quantity || 1 })];
1486
- case 1: return [2 /*return*/, _h.sent()];
1487
- }
1488
- }); }); }), operators.mergeMap(function (_h) {
1489
- var checkout = _h.checkout, lineItem = _h.lineItem;
1490
- return _this.updateLineItemInCart(lineItem, quantity || 1, checkout);
1491
- }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
1492
- };
1493
- CartService.prototype.decreaseItem = function (item) {
1494
- var _this = this;
1495
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
1496
- var _a;
1497
- var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.id === item.id; });
1498
- if (!i1.isNil(checkoutItem))
1499
- checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
1500
- return checkout;
1501
- }), 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); }));
1502
- };
1503
- CartService.prototype.getCart = function (checkout) {
1504
- var _this = this;
1505
- this.buildCartFromCheckout(checkout).subscribe(function (cart) { return _this.cartSubject.next(cart); });
1506
- return this.cartSubject;
1507
- };
1508
- /**
1509
- * @deprecated The method should not be used
1510
- */
1511
- CartService.prototype.getVariantPriceDiscount = function (item) {
1512
- return this.authService.getUser().pipe(operators.concatMap(function (user) { return rxjs.iif(function () { return user.isSubscriber && !!item.price.subscriberPrice; }, rxjs.of(item.price.subscriberPrice), rxjs.of(item.price.price)); }), operators.catchError(function () { return rxjs.of(item.price.price); }));
1513
- };
1514
- CartService.prototype.removeItem = function (item) {
1515
- var _this = this;
1516
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
1517
- var index = checkout.lineItems.findIndex(function (lineItem) { return lineItem.id === item.id; });
1518
- if (index >= 0)
1519
- checkout.lineItems.splice(index, 1);
1520
- return checkout;
1521
- }), 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); }));
1522
- };
1523
- CartService.prototype.updateUserCart = function (user) {
1524
- var _this = this;
1525
- return this.checkoutService.getCheckout().pipe(operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutUser(i1.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user: user }))); }), operators.concatMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () {
1526
- var _a, _b, _h, _j, _k, _l, _m, _o, _p, _q, _r;
1527
- var _this = this;
1528
- return __generator(this, function (_s) {
1529
- switch (_s.label) {
1530
- case 0:
1531
- _j = (_h = this.checkoutService)
1532
- .updateCheckoutLineItems;
1533
- _l = (_k = i1.Checkout).toInstance;
1534
- _o = (_m = Object).assign;
1535
- _p = [Object.assign({}, checkout.toPlain())];
1536
- _q = {};
1537
- if (!((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/, 2];
1538
- return [4 /*yield*/, Promise.all((_b = checkout.lineItems) === null || _b === void 0 ? void 0 : _b.map(function (item) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_h) {
1539
- switch (_h.label) {
1540
- case 0: return [4 /*yield*/, this.buildLineItem({ checkout: checkout, item: item })];
1541
- case 1: return [2 /*return*/, (_h.sent()).lineItem];
1542
- }
1543
- }); }); }))];
1544
- case 1:
1545
- _r = _s.sent();
1546
- return [3 /*break*/, 3];
1547
- case 2:
1548
- _r = [];
1549
- _s.label = 3;
1550
- case 3: return [2 /*return*/, _j.apply(_h, [_l.apply(_k, [_o.apply(_m, _p.concat([(_q.lineItems = _r, _q)]))])])
1551
- .toPromise()];
1552
- }
1553
- });
1554
- }); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
1555
- };
1556
- CartService.prototype.clearCart = function () {
1557
- var _this = this;
1558
- return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
1559
- _this.checkoutService.clearCheckoutFromSession();
1560
- return checkout;
1561
- }), operators.concatMap(function (oldCheckout) { return _this.buildCartFromCheckout(oldCheckout); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
1562
- };
1563
- CartService.prototype.buildCartFromCheckout = function (checkoutData) {
1564
- var _this = this;
1565
- return this.checkoutService.getCheckout(checkoutData).pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.concatMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
1566
- };
1567
- CartService.prototype.roundPrice = function (productPrice) {
1568
- var price = productPrice.price, fullPrice = productPrice.fullPrice, subscriberPrice = productPrice.subscriberPrice;
1569
- return Object.assign(Object.assign(Object.assign({}, productPrice), { price: Number(price.toFixed(2)), fullPrice: Number(fullPrice.toFixed(2)) }), (subscriberPrice && { subscriberPrice: Number(subscriberPrice.toFixed(2)) }));
1570
- };
1571
- CartService.prototype.getProductData = function (productId) {
1572
- return __awaiter(this, void 0, void 0, function () {
1573
- var product, variant, error_1, variants;
1574
- return __generator(this, function (_h) {
1575
- switch (_h.label) {
1576
- case 0:
1577
- _h.trys.push([0, 2, , 5]);
1578
- return [4 /*yield*/, this.productRepository.get({ id: productId })];
1579
- case 1:
1580
- product = _h.sent();
1581
- return [3 /*break*/, 5];
1582
- case 2:
1583
- error_1 = _h.sent();
1584
- if (!(error_1 instanceof i1.NotFoundError))
1585
- throw error_1;
1586
- return [4 /*yield*/, this.variantRepository.find({ filters: { id: productId } })];
1587
- case 3:
1588
- variants = (_h.sent()).data;
1589
- variant = variants.shift();
1590
- if (!variant)
1591
- throw error_1;
1592
- return [4 /*yield*/, this.productRepository.get({ id: variant.productId })];
1593
- case 4:
1594
- product = _h.sent();
1595
- return [3 /*break*/, 5];
1596
- case 5: return [2 /*return*/, Object.assign(Object.assign({}, product.toPlain()), (variant && Object.assign({}, variant.toPlain())))];
1597
- }
1598
- });
1599
- });
1600
- };
1601
- CartService.prototype.getGifts = function () {
1602
- var _this = this;
1603
- return this.checkoutService.getCheckout().pipe(operators.mergeMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () {
1604
- var notGiftItems, cartTotal, campaigns, elegibleCampaigns, _loop_1, this_1, campaigns_1, campaigns_1_1, campaign, e_1_1, campaingnProducts, elegibleCampaigns_1, elegibleCampaigns_1_1, campaign, elegibleProducts, _h, _j, product, productData, gift, e_2_1, e_3_1, gifts;
1605
- var e_1, _k, e_3, _l, e_2, _m;
1606
- return __generator(this, function (_o) {
1607
- switch (_o.label) {
1608
- case 0:
1609
- notGiftItems = checkout.lineItems ? checkout.lineItems.filter(function (item) { return !item.isGift; }) : [];
1610
- if (!notGiftItems.length)
1611
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: [] })];
1612
- cartTotal = notGiftItems.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
1613
- return [4 /*yield*/, this.buy2WinRepository
1614
- .find({
1615
- filters: {
1616
- active: { operator: i1.Where.EQUALS, value: true },
1617
- shop: { operator: i1.Where.EQUALS, value: this.defaultShop },
1618
- },
1619
- })
1620
- .then(function (data) { return data.data; })];
1621
- case 1:
1622
- campaigns = _o.sent();
1623
- if (!campaigns.length)
1624
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
1625
- elegibleCampaigns = [];
1626
- _loop_1 = function (campaign) {
1627
- var today, categoriesCampaing, categoriesCampaingFullTree, categoriesCampaing_1, categoriesCampaing_1_1, id, children, e_4_1, categoriesCampaingTree_1, filterProductsCategories, cartTotalCategories;
1628
- var e_4, _p;
1629
- return __generator(this, function (_q) {
1630
- switch (_q.label) {
1631
- case 0:
1632
- today = new Date().getDate();
1633
- if (!(campaign.startDate.getDate() <= today) && !(campaign.endDate.getDate() >= today))
1634
- return [2 /*return*/, "continue"];
1635
- if (!campaign.activeCategory) return [3 /*break*/, 9];
1636
- categoriesCampaing = campaign.categories.map(function (c) { return c.id.toString(); });
1637
- categoriesCampaingFullTree = [];
1638
- _q.label = 1;
1639
- case 1:
1640
- _q.trys.push([1, 6, 7, 8]);
1641
- categoriesCampaing_1 = (e_4 = void 0, __values(categoriesCampaing)), categoriesCampaing_1_1 = categoriesCampaing_1.next();
1642
- _q.label = 2;
1643
- case 2:
1644
- if (!!categoriesCampaing_1_1.done) return [3 /*break*/, 5];
1645
- id = categoriesCampaing_1_1.value;
1646
- return [4 /*yield*/, this_1.categoryRepository.getChildren(parseInt(id))];
1647
- case 3:
1648
- children = _q.sent();
1649
- categoriesCampaingFullTree.push.apply(categoriesCampaingFullTree, __spreadArray([id], __read(children.map(function (c) { return c.id.toString(); }))));
1650
- _q.label = 4;
1651
- case 4:
1652
- categoriesCampaing_1_1 = categoriesCampaing_1.next();
1653
- return [3 /*break*/, 2];
1654
- case 5: return [3 /*break*/, 8];
1655
- case 6:
1656
- e_4_1 = _q.sent();
1657
- e_4 = { error: e_4_1 };
1658
- return [3 /*break*/, 8];
1659
- case 7:
1660
- try {
1661
- if (categoriesCampaing_1_1 && !categoriesCampaing_1_1.done && (_p = categoriesCampaing_1.return)) _p.call(categoriesCampaing_1);
1662
- }
1663
- finally { if (e_4) throw e_4.error; }
1664
- return [7 /*endfinally*/];
1665
- case 8:
1666
- categoriesCampaingTree_1 = __spreadArray([], __read(new Set(categoriesCampaingFullTree)));
1667
- filterProductsCategories = checkout.lineItems.filter(function (l) {
1668
- var _a;
1669
- if (!l.categories || !((_a = l.categories) === null || _a === void 0 ? void 0 : _a.length))
1670
- return true;
1671
- return l.categories.some(function (c) { return categoriesCampaingTree_1.some(function (cat) { return cat == c; }); });
1672
- });
1673
- if (filterProductsCategories.length) {
1674
- cartTotalCategories = filterProductsCategories.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
1675
- if (cartTotalCategories >= campaign.cartValueMin)
1676
- elegibleCampaigns.push(campaign);
1677
- }
1678
- return [3 /*break*/, 10];
1679
- case 9:
1680
- if (campaign.cartValue && campaign.cartValue > 0) {
1681
- if (campaign.cartValue <= cartTotal)
1682
- elegibleCampaigns.push(campaign);
1683
- }
1684
- _q.label = 10;
1685
- case 10: return [2 /*return*/];
1686
- }
1687
- });
1688
- };
1689
- this_1 = this;
1690
- _o.label = 2;
1691
- case 2:
1692
- _o.trys.push([2, 7, 8, 9]);
1693
- campaigns_1 = __values(campaigns), campaigns_1_1 = campaigns_1.next();
1694
- _o.label = 3;
1695
- case 3:
1696
- if (!!campaigns_1_1.done) return [3 /*break*/, 6];
1697
- campaign = campaigns_1_1.value;
1698
- return [5 /*yield**/, _loop_1(campaign)];
1699
- case 4:
1700
- _o.sent();
1701
- _o.label = 5;
1702
- case 5:
1703
- campaigns_1_1 = campaigns_1.next();
1704
- return [3 /*break*/, 3];
1705
- case 6: return [3 /*break*/, 9];
1706
- case 7:
1707
- e_1_1 = _o.sent();
1708
- e_1 = { error: e_1_1 };
1709
- return [3 /*break*/, 9];
1710
- case 8:
1711
- try {
1712
- if (campaigns_1_1 && !campaigns_1_1.done && (_k = campaigns_1.return)) _k.call(campaigns_1);
1713
- }
1714
- finally { if (e_1) throw e_1.error; }
1715
- return [7 /*endfinally*/];
1716
- case 9:
1717
- if (!elegibleCampaigns.length)
1718
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
1719
- campaingnProducts = [];
1720
- _o.label = 10;
1721
- case 10:
1722
- _o.trys.push([10, 22, 23, 24]);
1723
- elegibleCampaigns_1 = __values(elegibleCampaigns), elegibleCampaigns_1_1 = elegibleCampaigns_1.next();
1724
- _o.label = 11;
1725
- case 11:
1726
- if (!!elegibleCampaigns_1_1.done) return [3 /*break*/, 21];
1727
- campaign = elegibleCampaigns_1_1.value;
1728
- elegibleProducts = [];
1729
- _o.label = 12;
1730
- case 12:
1731
- _o.trys.push([12, 17, 18, 19]);
1732
- _h = (e_2 = void 0, __values(campaign.products)), _j = _h.next();
1733
- _o.label = 13;
1734
- case 13:
1735
- if (!!_j.done) return [3 /*break*/, 16];
1736
- product = _j.value;
1737
- return [4 /*yield*/, this.productRepository.find({ filters: { sku: product } })];
1738
- case 14:
1739
- productData = (_o.sent()).data;
1740
- if (!productData.length)
1741
- return [3 /*break*/, 15];
1742
- gift = productData.shift();
1743
- if (gift.stock.quantity < 1)
1744
- return [3 /*break*/, 15];
1745
- elegibleProducts.push(gift);
1746
- _o.label = 15;
1747
- case 15:
1748
- _j = _h.next();
1749
- return [3 /*break*/, 13];
1750
- case 16: return [3 /*break*/, 19];
1751
- case 17:
1752
- e_2_1 = _o.sent();
1753
- e_2 = { error: e_2_1 };
1754
- return [3 /*break*/, 19];
1755
- case 18:
1756
- try {
1757
- if (_j && !_j.done && (_m = _h.return)) _m.call(_h);
1758
- }
1759
- finally { if (e_2) throw e_2.error; }
1760
- return [7 /*endfinally*/];
1761
- case 19:
1762
- campaingnProducts.push(elegibleProducts);
1763
- _o.label = 20;
1764
- case 20:
1765
- elegibleCampaigns_1_1 = elegibleCampaigns_1.next();
1766
- return [3 /*break*/, 11];
1767
- case 21: return [3 /*break*/, 24];
1768
- case 22:
1769
- e_3_1 = _o.sent();
1770
- e_3 = { error: e_3_1 };
1771
- return [3 /*break*/, 24];
1772
- case 23:
1773
- try {
1774
- if (elegibleCampaigns_1_1 && !elegibleCampaigns_1_1.done && (_l = elegibleCampaigns_1.return)) _l.call(elegibleCampaigns_1);
1775
- }
1776
- finally { if (e_3) throw e_3.error; }
1777
- return [7 /*endfinally*/];
1778
- case 24:
1779
- if (!campaingnProducts.length)
1780
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
1781
- gifts = this.giftToLineItems([].concat.apply([], __spreadArray([], __read(campaingnProducts))));
1782
- return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems.concat(gifts) })];
1783
- }
1784
- });
1785
- }); }), 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); }));
1786
- };
1787
- CartService.prototype.giftToLineItems = function (items) {
1788
- return items.map(function (item) {
1789
- var _a;
1790
- var brand = item.brand, categories = item.categories, id = item.id, name = item.name, price = item.price, sku = item.sku, slug = item.slug, stock = item.stock, weight = item.weight, EAN = item.EAN;
1791
- var image = ((_a = item === null || item === void 0 ? void 0 : item.miniatures) === null || _a === void 0 ? void 0 : _a.length) ? item.miniatures[0] : item.images[0];
1792
- return i1.LineItem.toInstance({
1793
- brand: brand,
1794
- categories: categories,
1795
- id: id.toString(),
1796
- name: name,
1797
- price: price,
1798
- sku: sku,
1799
- slug: slug,
1800
- stock: stock,
1801
- weight: weight,
1802
- EAN: EAN,
1803
- image: image,
1804
- pricePaid: 0,
1805
- quantity: 1,
1806
- isGift: true,
1807
- });
1808
- });
1809
- };
1810
- return CartService;
1811
- }());
1812
- CartService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, deps: [{ token: AuthService }, { token: CheckoutService }, { token: DEFAULT_SHOP }, { token: 'ProductRepository' }, { token: 'CategoryRepository' }, { token: 'VariantRepository' }, { token: 'Buy2WinRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1813
- CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService });
1814
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, decorators: [{
1815
- type: i0.Injectable
1816
- }], ctorParameters: function () {
1817
- return [{ type: AuthService }, { type: CheckoutService }, { type: i1__namespace$1.Shops, decorators: [{
1818
- type: i0.Inject,
1819
- args: [DEFAULT_SHOP]
1820
- }] }, { type: undefined, decorators: [{
1821
- type: i0.Inject,
1822
- args: ['ProductRepository']
1823
- }] }, { type: undefined, decorators: [{
1824
- type: i0.Inject,
1825
- args: ['CategoryRepository']
1826
- }] }, { type: undefined, decorators: [{
1827
- type: i0.Inject,
1828
- args: ['VariantRepository']
1829
- }] }, { type: i1__namespace$1.Buy2WinFirestoreRepository, decorators: [{
1830
- type: i0.Inject,
1831
- args: ['Buy2WinRepository']
1832
- }] }];
1833
- } });
1834
-
1835
- var CatalogService = /** @class */ (function () {
1836
- function CatalogService(productRepository, categoryStructureAdapter, shop) {
1837
- this.productRepository = productRepository;
1838
- this.categoryStructureAdapter = categoryStructureAdapter;
1839
- this.shop = shop;
1840
- this.buildFilterQuery = function (_j) {
1841
- var clubDiscount = _j.clubDiscount, brands = _j.brands, prices = _j.prices, gender = _j.gender, tags = _j.tags, rate = _j.rate, customOptions = _j.customOptions;
1842
- var filters = {};
1843
- if (clubDiscount === null || clubDiscount === void 0 ? void 0 : clubDiscount.length)
1844
- i1.set(filters, 'price.subscriberDiscountPercentage', { operator: i1.Where.IN, value: clubDiscount });
1845
- if (brands === null || brands === void 0 ? void 0 : brands.length)
1846
- filters.brand = { operator: i1.Where.IN, value: brands };
1847
- if (gender === null || gender === void 0 ? void 0 : gender.length)
1848
- filters.tags = {
1849
- operator: i1.Where.IN,
1850
- value: gender
1851
- .map(function (genderOptions) { return genderOptions === 'female' ? 'feminino' : genderOptions === 'male' ? 'masculino' : null; })
1852
- .filter(Boolean),
1853
- };
1854
- if ((prices === null || prices === void 0 ? void 0 : prices.min) || (prices === null || prices === void 0 ? void 0 : prices.max))
1855
- i1.set(filters, prices.subscriberPrice ? 'price.subscriberPrice' : 'price.price', __spreadArray(__spreadArray([], __read((prices.min ? [{ operator: i1.Where.GTE, value: Math.round(prices.min) }] : []))), __read((prices.max ? [{ operator: i1.Where.LTE, value: Math.ceil(prices.max) }] : []))));
1856
- if (rate)
1857
- filters.rate = { operator: i1.Where.GTE, value: rate };
1858
- if (tags === null || tags === void 0 ? void 0 : tags.length)
1859
- filters.tags = { operator: i1.Where.LIKE, value: tags };
1860
- if (customOptions === null || customOptions === void 0 ? void 0 : customOptions.length)
1861
- filters.filters = { operator: i1.Where.LIKE, value: customOptions };
1862
- return filters;
1863
- };
1864
- this.buildSortQuery = function (sort) {
1865
- if (!sort || sort === 'most-relevant')
1866
- return {};
1867
- if (sort === 'best-sellers')
1868
- return { shoppingCount: 'desc' };
1869
- if (sort === 'biggest-price')
1870
- return { price: 'desc' };
1871
- if (sort === 'lowest-price')
1872
- return { price: 'asc' };
1873
- if (sort === 'best-rating')
1874
- return { rate: 'desc' };
1875
- if (sort === 'news')
1876
- return { createdAt: 'desc' };
1877
- };
1878
- this.buildLimitQuery = function (options) {
1879
- var limit = (options === null || options === void 0 ? void 0 : options.perPage) || 20;
1880
- return {
1881
- limit: limit,
1882
- offset: (((options === null || options === void 0 ? void 0 : options.page) || 1) - 1) * limit,
1883
- };
1884
- };
1885
- }
1886
- CatalogService.prototype.fetchProducts = function (category, options) {
1887
- return __awaiter(this, void 0, void 0, function () {
1888
- var limits, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
1889
- return __generator(this, function (_w) {
1890
- switch (_w.label) {
1891
- case 0:
1892
- limits = this.buildLimitQuery(options);
1893
- _k = (_j = this.productRepository)
1894
- .findCatalog;
1895
- _m = (_l = Object).assign;
1896
- _p = (_o = Object).assign;
1897
- _q = {};
1898
- _s = (_r = Object).assign;
1899
- _u = (_t = Object).assign;
1900
- _v = [{}];
1901
- return [4 /*yield*/, this.categoryStructureAdapter.buildProductFilterByCategory(category)];
1902
- case 1: return [4 /*yield*/, _k.apply(_j, [_m.apply(_l, [_p.apply(_o, [(_q.filters = _s.apply(_r, [_u.apply(_t, _v.concat([(_w.sent())])), this.buildFilterQuery((options === null || options === void 0 ? void 0 : options.filters) || {})]), _q), ((options === null || options === void 0 ? void 0 : options.sort) ? { orderBy: this.buildSortQuery(options === null || options === void 0 ? void 0 : options.sort) } : {})]), { limits: limits, options: { minimal: ['price'], maximum: ['price'] } }]), (options === null || options === void 0 ? void 0 : options.mainGender) || this.shop === i1.Shops.MENSMARKET ? 'male' : 'female'])
1903
- .then(function (_j) {
1904
- var data = _j.data, total = _j.count, maximum = _j.maximum, minimal = _j.minimal;
1905
- var _a, _b, _c, _d, _e, _f, _g, _h;
1906
- return ({
1907
- products: { data: data.map(function (product) { return i1.RoundProductPricesHelper.roundProductPrices(product); }), total: total },
1908
- pages: Math.ceil(total / limits.limit),
1909
- prices: {
1910
- price: { min: +((_b = (_a = minimal === null || minimal === void 0 ? void 0 : minimal.price) === null || _a === void 0 ? void 0 : _a.price) === null || _b === void 0 ? void 0 : _b.toFixed(2)), max: +((_d = (_c = maximum === null || maximum === void 0 ? void 0 : maximum.price) === null || _c === void 0 ? void 0 : _c.price) === null || _d === void 0 ? void 0 : _d.toFixed(2)) },
1911
- subscriberPrice: {
1912
- min: +((_f = (_e = minimal === null || minimal === void 0 ? void 0 : minimal.price) === null || _e === void 0 ? void 0 : _e.subscriberPrice) === null || _f === void 0 ? void 0 : _f.toFixed(2)),
1913
- max: +((_h = (_g = maximum === null || maximum === void 0 ? void 0 : maximum.price) === null || _g === void 0 ? void 0 : _g.subscriberPrice) === null || _h === void 0 ? void 0 : _h.toFixed(2)),
1914
- },
1915
- },
1916
- });
1917
- })];
1918
- case 2: return [2 /*return*/, _w.sent()];
1919
- }
1920
- });
1921
- });
1922
- };
1923
- return CatalogService;
1924
- }());
1925
- CatalogService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1926
- CatalogService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CatalogService });
1927
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CatalogService, decorators: [{
1928
- type: i0.Injectable
1929
- }], ctorParameters: function () {
1930
- return [{ type: undefined, decorators: [{
1931
- type: i0.Inject,
1932
- args: ['ProductRepository']
1933
- }] }, { type: undefined, decorators: [{
1934
- type: i0.Inject,
1935
- args: [CATEGORY_STRUCTURE]
1936
- }] }, { type: i1__namespace$1.Shops, decorators: [{
1937
- type: i0.Inject,
1938
- args: [DEFAULT_SHOP]
1939
- }] }];
1940
- } });
1941
-
1942
- var CategoryService = /** @class */ (function () {
1943
- function CategoryService(productRepository, categoryRepository, categoryFilterRepository, categoryStructureAdapter, shop) {
1944
- this.productRepository = productRepository;
1945
- this.categoryRepository = categoryRepository;
1946
- this.categoryFilterRepository = categoryFilterRepository;
1947
- this.categoryStructureAdapter = categoryStructureAdapter;
1948
- this.shop = shop;
1949
- }
1950
- CategoryService.prototype.fetchBrands = function (category, mainGender) {
1951
- return __awaiter(this, void 0, void 0, function () {
1952
- var brands, _a, _b, _c;
1953
- return __generator(this, function (_d) {
1954
- switch (_d.label) {
1955
- case 0:
1956
- _b = (_a = this.productRepository)
1957
- .findCatalog;
1958
- _c = {};
1959
- return [4 /*yield*/, this.categoryStructureAdapter.buildProductFilterByCategory(category)];
1960
- case 1: return [4 /*yield*/, _b.apply(_a, [(_c.filters = _d.sent(),
1961
- _c.fields = ['brand'],
1962
- _c), mainGender || this.shop === i1.Shops.MENSMARKET ? 'male' : 'female'])
1963
- .then(function (_a) {
1964
- var data = _a.data;
1965
- return Object.keys(data.map(function (product) { return product.brand; }).reduce(function (brands, brand) {
1966
- var _a;
1967
- return (Object.assign(Object.assign({}, brands), (_a = {}, _a[brand] = true, _a)));
1968
- }, {}));
1969
- })];
1970
- case 2:
1971
- brands = _d.sent();
1972
- return [2 /*return*/, this.categoryRepository
1973
- .find({ filters: { brandCategory: true }, orderBy: { name: 'asc' } })
1974
- .then(function (_a) {
1975
- var data = _a.data;
1976
- return data.filter(function (category) { return brands.includes(category.conditions.brand); });
1977
- })];
1978
- }
1979
- });
1980
- });
1981
- };
1982
- CategoryService.prototype.fetchFilterOptions = function (category, filters) {
1983
- return __awaiter(this, void 0, void 0, function () {
1984
- return __generator(this, function (_a) {
1985
- switch (_a.label) {
1986
- case 0: return [4 /*yield*/, this.categoryFilterRepository
1987
- .find({ filters: { categoryId: +category.id } })
1988
- .then(function (_a) {
1989
- var data = _a.data;
1990
- return data.map(function (categoryFilter) { return categoryFilter.filter; });
1991
- })];
1992
- case 1: return [2 /*return*/, _a.sent()];
1993
- }
1994
- });
1995
- });
1996
- };
1997
- return CategoryService;
1998
- }());
1999
- CategoryService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CategoryService, deps: [{ token: 'ProductRepository' }, { token: 'CategoryRepository' }, { token: 'CategoryFilterRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2000
- CategoryService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CategoryService });
2001
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CategoryService, decorators: [{
2002
- type: i0.Injectable
2003
- }], ctorParameters: function () {
2004
- return [{ type: undefined, decorators: [{
2005
- type: i0.Inject,
2006
- args: ['ProductRepository']
2007
- }] }, { type: undefined, decorators: [{
2008
- type: i0.Inject,
2009
- args: ['CategoryRepository']
2010
- }] }, { type: undefined, decorators: [{
2011
- type: i0.Inject,
2012
- args: ['CategoryFilterRepository']
2013
- }] }, { type: undefined, decorators: [{
2014
- type: i0.Inject,
2015
- args: [CATEGORY_STRUCTURE]
2016
- }] }, { type: i1__namespace$1.Shops, decorators: [{
2017
- type: i0.Inject,
2018
- args: [DEFAULT_SHOP]
2019
- }] }];
2020
- } });
2021
-
2022
- exports.ProductSorts = void 0;
2023
- (function (ProductSorts) {
2024
- ProductSorts["MOST_RELEVANT"] = "most-relevant";
2025
- ProductSorts["BEST_SELLER"] = "best-sellers";
2026
- ProductSorts["BIGGEST_PRICE"] = "biggest-price";
2027
- ProductSorts["LOWEST_PRICE"] = "lowest-price";
2028
- ProductSorts["BIGGEST_DISCOUNT"] = "biggest-discount";
2029
- ProductSorts["BEST_RATING"] = "best-rating";
2030
- ProductSorts["NEWS"] = "news";
2031
- })(exports.ProductSorts || (exports.ProductSorts = {}));
2032
-
2033
- var CategoryWithTree = /** @class */ (function (_super) {
2034
- __extends(CategoryWithTree, _super);
2035
- function CategoryWithTree() {
2036
- return _super !== null && _super.apply(this, arguments) || this;
2037
- }
2038
- return CategoryWithTree;
2039
- }(i1.Category));
2040
- __decorate([
2041
- classTransformer.Type(function () { return CategoryWithTree; }),
2042
- __metadata("design:type", Array)
2043
- ], CategoryWithTree.prototype, "children", void 0);
2044
-
2045
- var CheckoutSubscriptionService = /** @class */ (function () {
2046
- function CheckoutSubscriptionService(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
2047
- this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
2048
- this.subscriptionRepository = subscriptionRepository;
2049
- this.couponService = couponService;
2050
- }
2051
- CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
2052
- var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
2053
- if (!i1.isNil(checkoutId))
2054
- return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
2055
- return rxjs.from(this.createCheckoutSubscription(checkoutData));
2056
- };
2057
- CheckoutSubscriptionService.prototype.createCheckoutSubscription = function (checkoutData) {
2058
- return __awaiter(this, void 0, void 0, function () {
2059
- var checkout;
2060
- return __generator(this, function (_a) {
2061
- switch (_a.label) {
2062
- case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i1.CheckoutSubscription.toInstance(i1.pick(checkoutData, ['user', 'shop'])).toPlain()))];
2063
- case 1:
2064
- checkout = _a.sent();
2065
- cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
2066
- return [2 /*return*/, checkout];
2067
- }
2068
- });
2069
- });
2070
- };
2071
- CheckoutSubscriptionService.prototype.clearCheckoutSubscriptionFromSession = function () {
2072
- cookie__default["default"].remove('checkoutSubscriptionId');
2073
- return rxjs.of();
2074
- };
2075
- CheckoutSubscriptionService.prototype.checkCoupon = function (nickname, userEmail) {
2076
- var _this = this;
2077
- return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService
2078
- .checkCoupon(nickname, i1.CheckoutTypes.SUBSCRIPTION, checkout, checkout.subscriptionPlan.name)
2079
- .pipe(); }));
2080
- };
2081
- CheckoutSubscriptionService.prototype.calcDiscountSubscription = function (coupon) {
2082
- var _this = this;
2083
- return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService.calcDiscountSubscription(coupon, checkout).pipe(); }));
2084
- };
2085
- return CheckoutSubscriptionService;
2086
- }());
2087
- CheckoutSubscriptionService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, deps: [{ token: 'CheckoutSubscriptionRepository' }, { token: 'SubscriptionRepository' }, { token: CouponService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2088
- CheckoutSubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService });
2089
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, decorators: [{
2090
- type: i0.Injectable
2091
- }], ctorParameters: function () {
2092
- return [{ type: undefined, decorators: [{
2093
- type: i0.Inject,
2094
- args: ['CheckoutSubscriptionRepository']
2095
- }] }, { type: undefined, decorators: [{
2096
- type: i0.Inject,
2097
- args: ['SubscriptionRepository']
2098
- }] }, { type: CouponService }];
2099
- } });
2100
-
2101
- var HomeShopService = /** @class */ (function () {
2102
- function HomeShopService(categoryRepository, homeRepository, productRepository, defaultShop) {
2103
- this.categoryRepository = categoryRepository;
2104
- this.homeRepository = homeRepository;
2105
- this.productRepository = productRepository;
2106
- this.defaultShop = defaultShop;
2107
- this.buildCategoryGroupWithRequiredData = function (group) {
2108
- var _a, _b;
2109
- return ({
2110
- category: i1.Category.toInstance(i1.pick(((_a = group === null || group === void 0 ? void 0 : group.category) === null || _a === void 0 ? void 0 : _a.toPlain()) || {}, ['id', 'name', 'slug', 'conditions'])),
2111
- products: ((_b = group === null || group === void 0 ? void 0 : group.products) === null || _b === void 0 ? void 0 : _b.map(function (product) { return i1.Product.toInstance(i1.pick((product === null || product === void 0 ? void 0 : product.toPlain()) || {}, [
2112
- 'id',
2113
- 'price',
2114
- 'reviews',
2115
- 'hasVariants',
2116
- 'slug',
2117
- 'sku',
2118
- 'stock',
2119
- 'costPrice',
2120
- 'images',
2121
- 'miniatures',
2122
- 'name',
2123
- 'weight',
2124
- 'rate',
2125
- 'type',
2126
- ])); })) || [],
2127
- });
2128
- };
2129
- }
2130
- Object.defineProperty(HomeShopService.prototype, "homeId", {
2131
- get: function () {
2132
- if (this.defaultShop === i1.Shops.GLAMSHOP)
2133
- return 'glamshop';
2134
- if (this.defaultShop === i1.Shops.MENSMARKET)
2135
- return 'mens_market';
2136
- return null;
2137
- },
2138
- enumerable: false,
2139
- configurable: true
2140
- });
2141
- HomeShopService.prototype.getHomeData = function () {
2142
- var _this = this;
2143
- return this.getHomeConfiguration().pipe(operators.map(function (home) { var _a; return (((_a = home === null || home === void 0 ? void 0 : home.data) === null || _a === void 0 ? void 0 : _a.expiresAt) > new Date() ? home : null); }), operators.concatMap(function (home) { return home
2144
- ? rxjs.of(home)
2145
- : rxjs.forkJoin([_this.getDiscoverProducts(), _this.getFeaturedProducts(), _this.getVerticalProducts()]).pipe(operators.map(function (_c) {
2146
- var _d = __read(_c, 3), discoverProducts = _d[0], featuredProducts = _d[1], verticalProducts = _d[2];
2147
- return ({
2148
- discoverProducts: discoverProducts,
2149
- featuredProducts: featuredProducts,
2150
- verticalProducts: verticalProducts,
2151
- });
2152
- }), operators.concatMap(function (data) { return _this.saveHomeData(data); })); }));
2153
- };
2154
- HomeShopService.prototype.getBanners = function (type) {
2155
- return this.getHomeConfiguration().pipe(operators.map(function (home) {
2156
- if (type === 'brand')
2157
- return home.brandsCarousel;
2158
- if (type === 'buyToWin')
2159
- return [home.buyToWinBanner];
2160
- if (type === 'block')
2161
- return home.blockBanners;
2162
- if (type === 'blog')
2163
- return [home.blogBanner];
2164
- }));
2165
- };
2166
- HomeShopService.prototype.getMinValueForFreeShipping = function () {
2167
- return this.getHomeConfiguration().pipe(operators.map(function (home) { return home.minValueForFreeShipping; }));
2168
- };
2169
- HomeShopService.prototype.getDiscoverProducts = function () {
2170
- var _this = this;
2171
- return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.from(_this.categoryRepository.getCategoriesForHome(home.discoverCategories)).pipe(operators.map(function (groups) { return groups.map(_this.buildCategoryGroupWithRequiredData); })); }));
2172
- };
2173
- HomeShopService.prototype.getFeaturedProducts = function () {
2174
- var _this = this;
2175
- return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.from(_this.categoryRepository.getCategoriesForHome(home.featuredCategories)).pipe(operators.map(function (groups) { return groups.map(_this.buildCategoryGroupWithRequiredData); })); }));
2176
- };
2177
- HomeShopService.prototype.getVerticalProducts = function () {
2178
- var _this = this;
2179
- return this.getHomeConfiguration().pipe(operators.concatMap(function (home) { return rxjs.forkJoin(home.verticalCarousels.filter(Boolean).map(function (id) { return rxjs.from(_this.categoryRepository.get({ id: id })).pipe(operators.concatMap(function (category) { return rxjs.from(_this.productRepository.find({
2180
- filters: { categories: { operator: i1.Where.IN, value: [category.id] } },
2181
- limits: { limit: 12 },
2182
- })).pipe(operators.map(function (products) { return ({ category: category, products: products }); })); }), operators.map(function (_c) {
2183
- var category = _c.category, products = _c.products;
2184
- return ({ category: category, products: products.data });
2185
- }), operators.map(_this.buildCategoryGroupWithRequiredData)); })); }));
2186
- };
2187
- HomeShopService.prototype.getHomeConfiguration = function () {
2188
- var _this = this;
2189
- return rxjs.of(this.homeConfiguration).pipe(operators.concatMap(function (home) { return home
2190
- ? rxjs.of(home)
2191
- : !_this.homeId
2192
- ? rxjs.throwError(new i1.RequiredArgumentError(['homeId']))
2193
- : rxjs.from(_this.homeRepository.get({ id: _this.homeId })).pipe(operators.tap(function (homeLoaded) { return (_this.homeConfiguration = homeLoaded); })); }));
2194
- };
2195
- HomeShopService.prototype.saveHomeData = function (homeData) {
2196
- var _this = this;
2197
- var data = {
2198
- createdAt: new Date(),
2199
- expiresAt: i1.add(new Date(), { hours: 1 }),
2200
- data: homeData,
2201
- };
2202
- return rxjs.from(this.homeRepository.update({
2203
- id: this.homeId,
2204
- data: data,
2205
- })).pipe(operators.tap(function () { return (_this.homeConfiguration.data = data); }), operators.map(function () { return _this.homeConfiguration; }));
2206
- };
2207
- return HomeShopService;
2208
- }());
2209
- HomeShopService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService, deps: [{ token: 'CategoryRepository' }, { token: 'HomeRepository' }, { token: 'ProductRepository' }, { token: DEFAULT_SHOP }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2210
- HomeShopService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService });
2211
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService, decorators: [{
2212
- type: i0.Injectable
2213
- }], ctorParameters: function () {
2214
- return [{ type: undefined, decorators: [{
2215
- type: i0.Inject,
2216
- args: ['CategoryRepository']
2217
- }] }, { type: undefined, decorators: [{
2218
- type: i0.Inject,
2219
- args: ['HomeRepository']
2220
- }] }, { type: undefined, decorators: [{
2221
- type: i0.Inject,
2222
- args: ['ProductRepository']
2223
- }] }, { type: i1__namespace$1.Shops, decorators: [{
2224
- type: i0.Inject,
2225
- args: [DEFAULT_SHOP]
2226
- }] }];
2227
- } });
2228
-
2229
- var OrderService = /** @class */ (function () {
2230
- function OrderService(angularFirestore, orderRepository) {
2231
- this.angularFirestore = angularFirestore;
2232
- this.orderRepository = orderRepository;
2233
- this.orderSubject = new rxjs.Subject();
2234
- }
2235
- OrderService.prototype.getOrder = function (id) {
2236
- var _this = this;
2237
- this.angularFirestore
2238
- .doc(this.orderRepository.collectionName + "/" + id)
2239
- .valueChanges()
2240
- .pipe(operators.map(function (doc) { return i1.Order.toInstance(doc); }))
2241
- .subscribe(function (doc) { return _this.orderSubject.next(doc); });
2242
- return this.orderSubject;
2243
- };
2244
- return OrderService;
2245
- }());
2246
- 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 });
2247
- OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
2248
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
2249
- type: i0.Injectable
2250
- }], ctorParameters: function () {
2251
- return [{ type: i1__namespace$2.AngularFirestore }, { type: i1__namespace$1.OrderFirestoreRepository, decorators: [{
2252
- type: i0.Inject,
2253
- args: ['OrderRepository']
2254
- }] }];
2255
- } });
2256
-
2257
- var ShippingService = /** @class */ (function () {
2258
- function ShippingService(http, apiUrl, homeService) {
2259
- this.http = http;
2260
- this.apiUrl = apiUrl;
2261
- this.homeService = homeService;
2262
- }
2263
- ShippingService.prototype.getShippingMethods = function (shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
2264
- var _this = this;
2265
- return rxjs.combineLatest([
2266
- this.homeService.getHomeData(),
2267
- this.http.get(this.apiUrl + "open/checkshippingcompany?personId=" + personId + "&postalCode=" + zip + "&weightGrams=" + weightGrams),
2268
- ]).pipe(operators.map(function (_a) {
2269
- var _b = __read(_a, 2), datas = _b[0], shippingMethodsResponse = _b[1];
2270
- var shippingMethods = shippingMethodsResponse.result;
2271
- if (!shippingMethods.length)
2272
- return [];
2273
- shippingMethods = shippingMethods.map(function (s) {
2274
- if (s.ShippingCompanyName == 'Same Day EG')
2275
- s.ShippingCompanyName = 'Same Day';
2276
- else
2277
- return s;
2278
- });
2279
- var datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
2280
- if (_this.isHolidays(datasSameDayNotAvaliable)) {
2281
- shippingMethods = shippingMethods.filter(function (method) { return method.serviceName !== 'Same Day'; });
2282
- }
2283
- if (totalPrice >= 200) {
2284
- shippingMethods = shippingMethods.map(function (s) {
2285
- if (s.serviceName !== 'Same Day')
2286
- return Object.assign(Object.assign({}, s), { totalPrice: 0 });
2287
- else
2288
- return s;
2289
- });
2290
- }
2291
- if (shop == i1.Shops.GLAMSHOP)
2292
- return shippingMethods;
2293
- if (_this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
2294
- shippingMethods = shippingMethods.map(function (s) {
2295
- if (s.serviceName == 'Same Day')
2296
- return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
2297
- else
2298
- return Object.assign(Object.assign({}, s), { totalPrice: 0 });
2299
- });
2300
- }
2301
- if (_this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
2302
- shippingMethods = shippingMethods.map(function (s) {
2303
- return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
2304
- });
2305
- }
2306
- return shippingMethods;
2307
- }));
2308
- };
2309
- ShippingService.prototype.isFreeShippingBySubscription = function (shop, subscriptionPlan) {
2310
- if (!subscriptionPlan)
2311
- return false;
2312
- if (shop == i1.Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
2313
- return true;
2314
- }
2315
- return false;
2316
- };
2317
- ShippingService.prototype.isHalfShippingBySubscription = function (shop, subscriptionPlan) {
2318
- if (!subscriptionPlan)
2319
- return false;
2320
- if (shop == i1.Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
2321
- return true;
2322
- }
2323
- return false;
2324
- };
2325
- ShippingService.prototype.isHolidays = function (datas) {
2326
- var today = new Date();
2327
- for (var key in datas) {
2328
- var start = new Date(today.getFullYear() + "-" + datas[key].beginDate);
2329
- var end = new Date(today.getFullYear() + "-" + datas[key].endDate);
2330
- if (start > end)
2331
- end = new Date(today.getFullYear() + 1 + "-" + datas[key].endDate);
2332
- if (today >= start && today <= end)
2333
- return true;
2334
- }
2335
- return false;
2336
- };
2337
- return ShippingService;
2338
- }());
2339
- ShippingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, deps: [{ token: i1__namespace$3.HttpClient }, { token: BACKEND_URL }, { token: HomeShopService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2340
- ShippingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService });
2341
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, decorators: [{
2342
- type: i0.Injectable
2343
- }], ctorParameters: function () {
2344
- return [{ type: i1__namespace$3.HttpClient }, { type: undefined, decorators: [{
2345
- type: i0.Inject,
2346
- args: [BACKEND_URL]
2347
- }] }, { type: HomeShopService }];
2348
- } });
2349
-
2350
- var NewCategoryStructureAdapter = /** @class */ (function () {
2351
- function NewCategoryStructureAdapter(categoryRepository, categoryCollectionChildrenRepository) {
2352
- this.categoryRepository = categoryRepository;
2353
- this.categoryCollectionChildrenRepository = categoryCollectionChildrenRepository;
2354
- }
2355
- NewCategoryStructureAdapter.prototype.buildProductFilterByCategory = function (category) {
2356
- return __awaiter(this, void 0, void 0, function () {
2357
- var categoriesIds, _a, _b;
2358
- return __generator(this, function (_c) {
2359
- switch (_c.label) {
2360
- case 0: return [4 /*yield*/, this.isCollection(category)];
2361
- case 1:
2362
- if (!(_c.sent())) return [3 /*break*/, 3];
2363
- return [4 /*yield*/, this.getAllCategoriesIdFromCollection(category)];
2364
- case 2:
2365
- _a = _c.sent();
2366
- return [3 /*break*/, 5];
2367
- case 3:
2368
- _b = [[]];
2369
- return [4 /*yield*/, this.getAllCategoriesIdFromCategory(category)];
2370
- case 4:
2371
- _a = __spreadArray.apply(void 0, [__spreadArray.apply(void 0, _b.concat([__read.apply(void 0, [(_c.sent())])])), [category.id.toString()]]);
2372
- _c.label = 5;
2373
- case 5:
2374
- categoriesIds = _a;
2375
- return [2 /*return*/, { category: { id: { operator: i1.Where.IN, value: categoriesIds } } }];
2376
- }
2377
- });
2378
- });
2379
- };
2380
- NewCategoryStructureAdapter.prototype.getAllCategoriesIdFromCategory = function (category) {
2381
- return __awaiter(this, void 0, void 0, function () {
2382
- return __generator(this, function (_a) {
2383
- return [2 /*return*/, this.categoryRepository
2384
- .getChildren(+category.id)
2385
- .then(function (categories) { return categories.map(function (category) { return category.id.toString(); }); })];
2386
- });
2387
- });
2388
- };
2389
- NewCategoryStructureAdapter.prototype.getAllCategoriesIdFromCollection = function (category) {
2390
- return __awaiter(this, void 0, void 0, function () {
2391
- return __generator(this, function (_a) {
2392
- return [2 /*return*/, this.categoryCollectionChildrenRepository
2393
- .find({ filters: { collectionId: +category.id } })
2394
- .then(function (_a) {
2395
- var data = _a.data;
2396
- return data.map(function (categoryCollection) { return categoryCollection.categoryId.toString(); });
2397
- })];
2398
- });
2399
- });
2400
- };
2401
- NewCategoryStructureAdapter.prototype.isCollection = function (category) {
2402
- return __awaiter(this, void 0, void 0, function () {
2403
- return __generator(this, function (_a) {
2404
- return [2 /*return*/, !i1.isNil(category.isCollection)
2405
- ? category.isCollection
2406
- : this.categoryRepository.get({ id: category.id }).then(function (category) { return category.isCollection; })];
2407
- });
2408
- });
2409
- };
2410
- return NewCategoryStructureAdapter;
2411
- }());
2412
- NewCategoryStructureAdapter.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }, { token: 'CategoryCollectionChildrenRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2413
- NewCategoryStructureAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter });
2414
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: NewCategoryStructureAdapter, decorators: [{
2415
- type: i0.Injectable
2416
- }], ctorParameters: function () {
2417
- return [{ type: undefined, decorators: [{
2418
- type: i0.Inject,
2419
- args: ['CategoryRepository']
2420
- }] }, { type: undefined, decorators: [{
2421
- type: i0.Inject,
2422
- args: ['CategoryCollectionChildrenRepository']
2423
- }] }];
2424
- } });
2425
-
2426
- var OldCategoryStructureAdapter = /** @class */ (function () {
2427
- function OldCategoryStructureAdapter(categoryRepository) {
2428
- this.categoryRepository = categoryRepository;
2429
- }
2430
- OldCategoryStructureAdapter.prototype.buildProductFilterByCategory = function (category) {
2431
- var _a;
2432
- return __awaiter(this, void 0, void 0, function () {
2433
- var productsIds, _b;
2434
- return __generator(this, function (_c) {
2435
- switch (_c.label) {
2436
- case 0:
2437
- if (!((_a = category.products) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/, 1];
2438
- _b = category.products;
2439
- return [3 /*break*/, 3];
2440
- case 1: return [4 /*yield*/, this.categoryRepository.get({ id: category.id }).then(function (categoryFound) { return categoryFound.products; })];
2441
- case 2:
2442
- _b = _c.sent();
2443
- _c.label = 3;
2444
- case 3:
2445
- productsIds = _b;
2446
- return [2 /*return*/, { id: { operator: i1.Where.IN, value: productsIds } }];
2447
- }
2448
- });
2449
- });
2450
- };
2451
- return OldCategoryStructureAdapter;
2452
- }());
2453
- OldCategoryStructureAdapter.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter, deps: [{ token: 'CategoryRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2454
- OldCategoryStructureAdapter.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter });
2455
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OldCategoryStructureAdapter, decorators: [{
2456
- type: i0.Injectable
2457
- }], ctorParameters: function () {
2458
- return [{ type: undefined, decorators: [{
2459
- type: i0.Inject,
2460
- args: ['CategoryRepository']
2461
- }] }];
2462
- } });
2463
-
2464
- var AngularConnectModule = /** @class */ (function () {
2465
- function AngularConnectModule() {
2466
- }
2467
- AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
2468
- return {
2469
- ngModule: AngularConnectModule,
2470
- providers: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([
2471
- {
2472
- provide: CATEGORY_STRUCTURE,
2473
- useClass: i1.isNil(options === null || options === void 0 ? void 0 : options.oldCategoryStructure) || (options === null || options === void 0 ? void 0 : options.oldCategoryStructure)
2474
- ? OldCategoryStructureAdapter
2475
- : NewCategoryStructureAdapter,
2476
- }
2477
- ], __read((i1.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i1.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_OPTIONS, useValue: options === null || options === void 0 ? void 0 : options.firebase }]))), __read((i1.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))), __read((i1.isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]))), __read((i1.isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]))), __read((i1.isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]))),
2478
- };
2479
- };
2480
- return AngularConnectModule;
2481
- }());
2482
- AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2483
- AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
2484
- AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [
2485
- AuthService,
2486
- CartService,
2487
- CatalogService,
2488
- CategoryService,
2489
- CheckoutService,
2490
- CheckoutSubscriptionService,
2491
- CouponService,
2492
- HomeShopService,
2493
- OrderService,
2494
- ShippingService,
2495
- ], imports: [[fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule]] });
2496
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
2497
- type: i0.NgModule,
2498
- args: [{
2499
- imports: [fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule],
2500
- providers: [
2501
- AuthService,
2502
- CartService,
2503
- CatalogService,
2504
- CategoryService,
2505
- CheckoutService,
2506
- CheckoutSubscriptionService,
2507
- CouponService,
2508
- HomeShopService,
2509
- OrderService,
2510
- ShippingService,
2511
- ],
2512
- }]
2513
- }] });
2514
-
2515
- var AngularFirebaseAuthModule = /** @class */ (function () {
2516
- function AngularFirebaseAuthModule() {
2517
- }
2518
- AngularFirebaseAuthModule.initializeApp = function (options, nameOrConfig) {
2519
- return {
2520
- ngModule: AngularFirebaseAuthModule,
2521
- providers: [
2522
- { provide: fire.FIREBASE_OPTIONS, useValue: options },
2523
- { provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
2524
- ],
2525
- };
2526
- };
2527
- return AngularFirebaseAuthModule;
2528
- }());
2529
- AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2530
- AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [fire.AngularFireModule] });
2531
- AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
2532
- {
2533
- provide: 'Authentication',
2534
- useFactory: function (authenticationService, userRepository) {
2535
- return new i1.Authentication(authenticationService, userRepository);
2536
- },
2537
- deps: ['AuthenticationService', 'UserRepository'],
2538
- },
2539
- {
2540
- provide: 'AuthenticationService',
2541
- useFactory: function (angularFireAuth) {
2542
- return new i1.AuthenticationFirebaseAuthService(angularFireAuth);
2543
- },
2544
- deps: [i1$2.AngularFireAuth],
2545
- },
2546
- {
2547
- provide: 'Register',
2548
- useFactory: function (registerService, userRepository) {
2549
- return new i1.Register(registerService, userRepository);
2550
- },
2551
- deps: ['RegisterService', 'UserRepository'],
2552
- },
2553
- {
2554
- provide: 'RegisterService',
2555
- useFactory: function (angularFireAuth) {
2556
- return new i1.RegisterFirebaseAuthService(angularFireAuth);
2557
- },
2558
- deps: [i1$2.AngularFireAuth],
2559
- },
2560
- {
2561
- provide: 'SignOut',
2562
- useFactory: function (authenticationService) {
2563
- return new i1.SignOut(authenticationService);
2564
- },
2565
- deps: ['AuthenticationService'],
2566
- },
2567
- {
2568
- provide: 'RecoveryPassword',
2569
- useFactory: function (authenticationService) {
2570
- return new i1.RecoveryPassword(authenticationService);
2571
- },
2572
- deps: ['AuthenticationService'],
2573
- },
2574
- ], imports: [[fire.AngularFireModule]] });
2575
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
2576
- type: i0.NgModule,
2577
- args: [{
2578
- imports: [fire.AngularFireModule],
2579
- providers: [
2580
- {
2581
- provide: 'Authentication',
2582
- useFactory: function (authenticationService, userRepository) {
2583
- return new i1.Authentication(authenticationService, userRepository);
2584
- },
2585
- deps: ['AuthenticationService', 'UserRepository'],
2586
- },
2587
- {
2588
- provide: 'AuthenticationService',
2589
- useFactory: function (angularFireAuth) {
2590
- return new i1.AuthenticationFirebaseAuthService(angularFireAuth);
2591
- },
2592
- deps: [i1$2.AngularFireAuth],
2593
- },
2594
- {
2595
- provide: 'Register',
2596
- useFactory: function (registerService, userRepository) {
2597
- return new i1.Register(registerService, userRepository);
2598
- },
2599
- deps: ['RegisterService', 'UserRepository'],
2600
- },
2601
- {
2602
- provide: 'RegisterService',
2603
- useFactory: function (angularFireAuth) {
2604
- return new i1.RegisterFirebaseAuthService(angularFireAuth);
2605
- },
2606
- deps: [i1$2.AngularFireAuth],
2607
- },
2608
- {
2609
- provide: 'SignOut',
2610
- useFactory: function (authenticationService) {
2611
- return new i1.SignOut(authenticationService);
2612
- },
2613
- deps: ['AuthenticationService'],
2614
- },
2615
- {
2616
- provide: 'RecoveryPassword',
2617
- useFactory: function (authenticationService) {
2618
- return new i1.RecoveryPassword(authenticationService);
2619
- },
2620
- deps: ['AuthenticationService'],
2621
- },
2622
- ],
2623
- }]
2624
- }] });
2625
-
2626
- /**
2627
- * Generated bundle index. Do not edit.
2628
- */
2629
-
2630
- exports.AngularConnectModule = AngularConnectModule;
2631
- exports.AngularFirebaseAuthModule = AngularFirebaseAuthModule;
2632
- exports.AngularFirestoreModule = AngularFirestoreModule;
2633
- exports.AngularHasuraGraphQLModule = AngularHasuraGraphQLModule;
2634
- exports.AuthService = AuthService;
2635
- exports.CartService = CartService;
2636
- exports.CatalogService = CatalogService;
2637
- exports.CategoryService = CategoryService;
2638
- exports.CategoryWithTree = CategoryWithTree;
2639
- exports.CheckoutService = CheckoutService;
2640
- exports.CheckoutSubscriptionService = CheckoutSubscriptionService;
2641
- exports.CouponService = CouponService;
2642
- exports.HomeShopService = HomeShopService;
2643
- exports.OrderService = OrderService;
2644
- exports.ShippingService = ShippingService;
2645
-
2646
- Object.defineProperty(exports, '__esModule', { value: true });
2647
-
2648
- }));
2649
- //# sourceMappingURL=infrab4a-connect-angular.umd.js.map