@infrab4a/connect-angular 3.9.0-beta.7 → 3.9.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.
- package/angular-connect.module.d.ts +19 -19
- package/angular-elastic-search.module.d.ts +9 -9
- package/angular-firebase-auth.module.d.ts +10 -10
- package/angular-firestore.module.d.ts +15 -15
- package/angular-hasura-graphql.module.d.ts +16 -16
- package/bundles/infrab4a-connect-angular.umd.js +2142 -2140
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/consts/backend-url.const.d.ts +1 -1
- package/consts/default-shop.const.d.ts +1 -1
- package/consts/es-config.const.d.ts +1 -1
- package/consts/hasura-options.const.d.ts +1 -1
- package/consts/index.d.ts +4 -4
- package/esm2015/angular-connect.module.js +52 -52
- package/esm2015/angular-elastic-search.module.js +34 -34
- package/esm2015/angular-firebase-auth.module.js +113 -113
- package/esm2015/angular-firestore.module.js +394 -394
- package/esm2015/angular-hasura-graphql.module.js +156 -156
- package/esm2015/consts/backend-url.const.js +1 -1
- package/esm2015/consts/default-shop.const.js +2 -2
- package/esm2015/consts/es-config.const.js +2 -2
- package/esm2015/consts/hasura-options.const.js +2 -2
- package/esm2015/consts/index.js +5 -5
- package/esm2015/index.js +6 -6
- package/esm2015/infrab4a-connect-angular.js +4 -4
- package/esm2015/services/auth.service.js +42 -42
- package/esm2015/services/cart.service.js +261 -259
- package/esm2015/services/checkout-subscription.service.js +53 -53
- package/esm2015/services/checkout.service.js +75 -75
- package/esm2015/services/coupon.service.js +249 -249
- package/esm2015/services/errors/group-invalid-coupon.error.js +8 -8
- package/esm2015/services/errors/index.js +3 -3
- package/esm2015/services/errors/invalid-coupon.error.js +8 -8
- package/esm2015/services/home-shop.service.js +116 -116
- package/esm2015/services/index.js +9 -9
- package/esm2015/services/order.service.js +32 -32
- package/esm2015/services/shipping.service.js +98 -98
- package/esm2015/services/types/index.js +3 -3
- package/esm2015/services/types/required-checkout-data.type.js +2 -2
- package/esm2015/services/types/required-checkout-subscription-data.type.js +2 -2
- package/esm2015/services/types/shipping-methods.type.js +2 -2
- package/fesm2015/infrab4a-connect-angular.js +1561 -1559
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/index.d.ts +5 -5
- package/infrab4a-connect-angular.d.ts +5 -5
- package/package.json +2 -2
- package/services/auth.service.d.ts +19 -19
- package/services/cart.service.d.ts +40 -40
- package/services/checkout-subscription.service.d.ts +18 -18
- package/services/checkout.service.d.ts +23 -23
- package/services/coupon.service.d.ts +25 -25
- package/services/errors/group-invalid-coupon.error.d.ts +6 -6
- package/services/errors/index.d.ts +2 -2
- package/services/errors/invalid-coupon.error.d.ts +5 -5
- package/services/home-shop.service.d.ts +25 -25
- package/services/index.d.ts +8 -8
- package/services/order.service.d.ts +13 -13
- package/services/shipping.service.d.ts +19 -19
- package/services/types/index.d.ts +2 -2
- package/services/types/required-checkout-data.type.d.ts +2 -2
- package/services/types/required-checkout-subscription-data.type.d.ts +2 -2
- package/services/types/shipping-methods.type.d.ts +12 -12
|
@@ -31,363 +31,363 @@
|
|
|
31
31
|
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
32
32
|
var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
|
|
33
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;
|
|
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
350
|
}
|
|
351
351
|
|
|
352
|
-
var AuthService = /** @class */ (function () {
|
|
353
|
-
function AuthService(angularFireAuth, userRepository) {
|
|
354
|
-
this.angularFireAuth = angularFireAuth;
|
|
355
|
-
this.userRepository = userRepository;
|
|
356
|
-
}
|
|
357
|
-
AuthService.prototype.getAuthstate = function () {
|
|
358
|
-
var observables = [
|
|
359
|
-
this.angularFireAuth.authState.pipe(operators.catchError(function () { return rxjs.of(null); })),
|
|
360
|
-
this.getUser().pipe(operators.catchError(function () { return rxjs.of(null); })),
|
|
361
|
-
];
|
|
362
|
-
return rxjs.combineLatest(observables).pipe(operators.map(function (_a) {
|
|
363
|
-
var _b = __read(_a, 2), fireUser = _b[0], user = _b[1];
|
|
364
|
-
return {
|
|
365
|
-
user: user,
|
|
366
|
-
isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
|
|
367
|
-
};
|
|
368
|
-
}));
|
|
369
|
-
};
|
|
370
|
-
AuthService.prototype.getUser = function () {
|
|
371
|
-
var _this = this;
|
|
372
|
-
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)); }));
|
|
373
|
-
};
|
|
374
|
-
AuthService.prototype.getTokenId = function () {
|
|
375
|
-
return this.angularFireAuth.idToken;
|
|
376
|
-
};
|
|
377
|
-
AuthService.prototype.getFireUser = function () {
|
|
378
|
-
return this.angularFireAuth.user.pipe(operators.catchError(function () { return rxjs.of(null); }));
|
|
379
|
-
};
|
|
380
|
-
return AuthService;
|
|
381
|
-
}());
|
|
382
|
-
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 });
|
|
383
|
-
AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService });
|
|
384
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, decorators: [{
|
|
385
|
-
type: i0.Injectable
|
|
386
|
-
}], ctorParameters: function () {
|
|
387
|
-
return [{ type: i1__namespace.AngularFireAuth }, { type: undefined, decorators: [{
|
|
388
|
-
type: i0.Inject,
|
|
389
|
-
args: ['UserRepository']
|
|
390
|
-
}] }];
|
|
352
|
+
var AuthService = /** @class */ (function () {
|
|
353
|
+
function AuthService(angularFireAuth, userRepository) {
|
|
354
|
+
this.angularFireAuth = angularFireAuth;
|
|
355
|
+
this.userRepository = userRepository;
|
|
356
|
+
}
|
|
357
|
+
AuthService.prototype.getAuthstate = function () {
|
|
358
|
+
var observables = [
|
|
359
|
+
this.angularFireAuth.authState.pipe(operators.catchError(function () { return rxjs.of(null); })),
|
|
360
|
+
this.getUser().pipe(operators.catchError(function () { return rxjs.of(null); })),
|
|
361
|
+
];
|
|
362
|
+
return rxjs.combineLatest(observables).pipe(operators.map(function (_a) {
|
|
363
|
+
var _b = __read(_a, 2), fireUser = _b[0], user = _b[1];
|
|
364
|
+
return {
|
|
365
|
+
user: user,
|
|
366
|
+
isAnonymous: fireUser === null || fireUser === void 0 ? void 0 : fireUser.isAnonymous,
|
|
367
|
+
};
|
|
368
|
+
}));
|
|
369
|
+
};
|
|
370
|
+
AuthService.prototype.getUser = function () {
|
|
371
|
+
var _this = this;
|
|
372
|
+
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)); }));
|
|
373
|
+
};
|
|
374
|
+
AuthService.prototype.getTokenId = function () {
|
|
375
|
+
return this.angularFireAuth.idToken;
|
|
376
|
+
};
|
|
377
|
+
AuthService.prototype.getFireUser = function () {
|
|
378
|
+
return this.angularFireAuth.user.pipe(operators.catchError(function () { return rxjs.of(null); }));
|
|
379
|
+
};
|
|
380
|
+
return AuthService;
|
|
381
|
+
}());
|
|
382
|
+
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 });
|
|
383
|
+
AuthService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService });
|
|
384
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AuthService, decorators: [{
|
|
385
|
+
type: i0.Injectable
|
|
386
|
+
}], ctorParameters: function () {
|
|
387
|
+
return [{ type: i1__namespace.AngularFireAuth }, { type: undefined, decorators: [{
|
|
388
|
+
type: i0.Inject,
|
|
389
|
+
args: ['UserRepository']
|
|
390
|
+
}] }];
|
|
391
391
|
} });
|
|
392
392
|
|
|
393
393
|
var BACKEND_URL = 'BACKEND_URL';
|
|
@@ -398,1819 +398,1821 @@
|
|
|
398
398
|
|
|
399
399
|
var HASURA_OPTIONS = 'HASURA_OPTIONS';
|
|
400
400
|
|
|
401
|
-
var InvalidCouponError = /** @class */ (function (_super) {
|
|
402
|
-
__extends(InvalidCouponError, _super);
|
|
403
|
-
function InvalidCouponError(message) {
|
|
404
|
-
var _this = _super.call(this, message) || this;
|
|
405
|
-
_this.message = message;
|
|
406
|
-
return _this;
|
|
407
|
-
}
|
|
408
|
-
return InvalidCouponError;
|
|
401
|
+
var InvalidCouponError = /** @class */ (function (_super) {
|
|
402
|
+
__extends(InvalidCouponError, _super);
|
|
403
|
+
function InvalidCouponError(message) {
|
|
404
|
+
var _this = _super.call(this, message) || this;
|
|
405
|
+
_this.message = message;
|
|
406
|
+
return _this;
|
|
407
|
+
}
|
|
408
|
+
return InvalidCouponError;
|
|
409
409
|
}(tsCustomError.CustomError));
|
|
410
410
|
|
|
411
|
-
var GroupInvalidCouponError = /** @class */ (function (_super) {
|
|
412
|
-
__extends(GroupInvalidCouponError, _super);
|
|
413
|
-
function GroupInvalidCouponError(errors) {
|
|
414
|
-
var _this = _super.call(this, 'Many coupon errors throw') || this;
|
|
415
|
-
_this.errors = errors;
|
|
416
|
-
return _this;
|
|
417
|
-
}
|
|
418
|
-
return GroupInvalidCouponError;
|
|
411
|
+
var GroupInvalidCouponError = /** @class */ (function (_super) {
|
|
412
|
+
__extends(GroupInvalidCouponError, _super);
|
|
413
|
+
function GroupInvalidCouponError(errors) {
|
|
414
|
+
var _this = _super.call(this, 'Many coupon errors throw') || this;
|
|
415
|
+
_this.errors = errors;
|
|
416
|
+
return _this;
|
|
417
|
+
}
|
|
418
|
+
return GroupInvalidCouponError;
|
|
419
419
|
}(tsCustomError.CustomError));
|
|
420
420
|
|
|
421
|
-
var CouponService = /** @class */ (function () {
|
|
422
|
-
function CouponService(couponRepository, defaultShop, orderRepository, categoryRepository) {
|
|
423
|
-
var _this = this;
|
|
424
|
-
this.couponRepository = couponRepository;
|
|
425
|
-
this.defaultShop = defaultShop;
|
|
426
|
-
this.orderRepository = orderRepository;
|
|
427
|
-
this.categoryRepository = categoryRepository;
|
|
428
|
-
this.emailIsFromCollaborator = function (userEmail) { return !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g)); };
|
|
429
|
-
this.separateValidCoupons = function (coupons, userEmail) { return coupons
|
|
430
|
-
.map(function (coupon) {
|
|
431
|
-
try {
|
|
432
|
-
if (!(coupon instanceof i3.Coupon))
|
|
433
|
-
throw new InvalidCouponError('Cupom inválido.');
|
|
434
|
-
if (_this.isValidCoupon(coupon, userEmail))
|
|
435
|
-
return coupon;
|
|
436
|
-
}
|
|
437
|
-
catch (error) {
|
|
438
|
-
return error;
|
|
439
|
-
}
|
|
440
|
-
})
|
|
441
|
-
.reduce(function (current, coupon) { return (Object.assign(Object.assign({}, current), (coupon instanceof i3.Coupon
|
|
442
|
-
? { valids: __spreadArray(__spreadArray([], __read(current.valids)), [coupon]) }
|
|
443
|
-
: { invalids: __spreadArray(__spreadArray([], __read(current.invalids)), [coupon]) }))); }, {
|
|
444
|
-
valids: [],
|
|
445
|
-
invalids: [],
|
|
446
|
-
}); };
|
|
447
|
-
}
|
|
448
|
-
CouponService.prototype.checkCoupon = function (nickname, userEmail, checkoutType, plan, checkout, isSubscription) {
|
|
449
|
-
var _this = this;
|
|
450
|
-
return rxjs.from(this.couponRepository.find({
|
|
451
|
-
filters: {
|
|
452
|
-
nickname: { operator: i3.Where.EQUALS, value: nickname },
|
|
453
|
-
active: { operator: i3.Where.EQUALS, value: true },
|
|
454
|
-
},
|
|
455
|
-
})).pipe(operators.concatMap(function (coupons) { return _this.checkCouponRules(coupons, checkoutType, plan, checkout, isSubscription); }), operators.concatMap(function (coupon) { return _this.checkCouponUseAndLimit(coupon, userEmail, checkout); }), operators.map(function (coupon) { return _this.isValidCoupon(coupon, userEmail); }), operators.map(function (coupon) { return coupon; }));
|
|
456
|
-
};
|
|
457
|
-
CouponService.prototype.checkCouponRules = function (coupons, checkoutType, plan, checkout, isSubscription) {
|
|
458
|
-
// Caso não ache nenhum cupom, retorna erro
|
|
459
|
-
if (coupons.count < 1) {
|
|
460
|
-
return rxjs.throwError('Cupom inválido.');
|
|
461
|
-
}
|
|
462
|
-
// Get Primeiro Cupom (o find do repository retorna um array)
|
|
463
|
-
var coupon = coupons.data.shift();
|
|
464
|
-
// Verifica se o cupom é aplicavel na loja
|
|
465
|
-
var isInShop = coupon.shopAvailability === i3.Shops.ALL || coupon.shopAvailability === this.defaultShop;
|
|
466
|
-
// Cupon não aplicavel a loja retorna erro
|
|
467
|
-
if (!isInShop)
|
|
468
|
-
return rxjs.throwError('Cupom inválido para loja.');
|
|
469
|
-
// Verifica se o coupon é aplicado no checkout que está sendo realizado
|
|
470
|
-
var isCheckoutType = coupon.checkoutType === i3.CheckoutTypes.ALL || coupon.checkoutType === checkoutType;
|
|
471
|
-
// Cupon não aplicavel ao checkout retorna erro
|
|
472
|
-
if (!isCheckoutType)
|
|
473
|
-
return rxjs.throwError('Cupom inválido. Erro de checkout.');
|
|
474
|
-
// Verifica se o cupom é ou pode ser aplicado para subscription
|
|
475
|
-
if (checkoutType === i3.CheckoutTypes.ALL || checkoutType === i3.CheckoutTypes.SUBSCRIPTION) {
|
|
476
|
-
// Se o cupom tiver um plano associado, verifica se é o mesmo plano do checkout da assinatura
|
|
477
|
-
if (coupon.plan && coupon.plan.toUpperCase() !== plan.toUpperCase())
|
|
478
|
-
return rxjs.throwError('Cupom inválido para sua assinatura.');
|
|
479
|
-
}
|
|
480
|
-
if (isSubscription)
|
|
481
|
-
return rxjs.of(coupon);
|
|
482
|
-
// Verifica se possui o valor minimo de compra para utilização do cupom
|
|
483
|
-
var hasMinSubTotal = this.hasMinSubTotal(coupon, checkout);
|
|
484
|
-
// Se não tem valor mínimo atingido, retorna erro
|
|
485
|
-
if (!hasMinSubTotal)
|
|
486
|
-
return rxjs.throwError("Valor m\u00EDnimo de " + Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue) + " n\u00E3o atingido");
|
|
487
|
-
return rxjs.of(coupon);
|
|
488
|
-
};
|
|
489
|
-
CouponService.prototype.isValidCoupon = function (coupon, userEmail) {
|
|
490
|
-
// Verifica a data de inicio de validade do cupom
|
|
491
|
-
if ((coupon === null || coupon === void 0 ? void 0 : coupon.beginAt) > new Date())
|
|
492
|
-
throw new InvalidCouponError('Cupom ainda não liberado.');
|
|
493
|
-
// Verifica a data de validade do cupom
|
|
494
|
-
if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) < new Date())
|
|
495
|
-
throw new InvalidCouponError('Cupom expirado.');
|
|
496
|
-
return coupon;
|
|
497
|
-
};
|
|
498
|
-
CouponService.prototype.checkCouponUseAndLimit = function (coupon, userEmail, checkout) {
|
|
499
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
500
|
-
var orders, ordersUserCoupon, validUser, hasProductCategories;
|
|
501
|
-
return __generator(this, function (_d) {
|
|
502
|
-
switch (_d.label) {
|
|
503
|
-
case 0: return [4 /*yield*/, this.orderRepository.find({
|
|
504
|
-
filters: {
|
|
505
|
-
coupon: { id: coupon.id },
|
|
506
|
-
payment: { status: 'paid' },
|
|
507
|
-
},
|
|
508
|
-
})];
|
|
509
|
-
case 1:
|
|
510
|
-
orders = _d.sent();
|
|
511
|
-
ordersUserCoupon = orders.data.filter(function (o) { return o.user.email == userEmail; });
|
|
512
|
-
// Verifica o limite de uso de cupom por usuario
|
|
513
|
-
if (coupon.useLimitPerUser && ordersUserCoupon.length)
|
|
514
|
-
throw new InvalidCouponError('Limite de uso por usuário atingido.');
|
|
515
|
-
// Verifica o limite de uso geral por usuario
|
|
516
|
-
if (coupon.useLimit && orders.data.length >= coupon.useLimit)
|
|
517
|
-
throw new InvalidCouponError('Limite de uso atingido.');
|
|
518
|
-
validUser = this.userValidationAndSubscriptionStatus(coupon, checkout === null || checkout === void 0 ? void 0 : checkout.user);
|
|
519
|
-
if (!validUser)
|
|
520
|
-
throw new InvalidCouponError('Usuário não elegível.');
|
|
521
|
-
return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
|
|
522
|
-
case 2:
|
|
523
|
-
hasProductCategories = _d.sent();
|
|
524
|
-
if (!hasProductCategories)
|
|
525
|
-
throw 'Seu carrinho não possui produtos elegíveis para desconto.';
|
|
526
|
-
return [2 /*return*/, coupon];
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
});
|
|
530
|
-
};
|
|
531
|
-
CouponService.prototype.calcDiscountSubscription = function (coupon, checkout) {
|
|
532
|
-
//
|
|
533
|
-
var discount = 0;
|
|
534
|
-
if (coupon.type === i3.CouponTypes.ABSOLUTE)
|
|
535
|
-
discount = coupon.discount;
|
|
536
|
-
else if (coupon.type === i3.CouponTypes.PERCENTAGE)
|
|
537
|
-
discount = checkout.subscriptionPlan.recurrencePrice * (coupon.discount / 100);
|
|
538
|
-
return rxjs.of(discount);
|
|
539
|
-
};
|
|
540
|
-
CouponService.prototype.calcDiscountShopping = function (coupon, checkout) {
|
|
541
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
542
|
-
var discount, _d;
|
|
543
|
-
return __generator(this, function (_e) {
|
|
544
|
-
switch (_e.label) {
|
|
545
|
-
case 0:
|
|
546
|
-
discount = 0;
|
|
547
|
-
_d = coupon.type;
|
|
548
|
-
switch (_d) {
|
|
549
|
-
case i3.CouponTypes.ABSOLUTE: return [3 /*break*/, 1];
|
|
550
|
-
case i3.CouponTypes.PERCENTAGE: return [3 /*break*/, 2];
|
|
551
|
-
}
|
|
552
|
-
return [3 /*break*/, 4];
|
|
553
|
-
case 1:
|
|
554
|
-
{
|
|
555
|
-
discount = coupon.discount;
|
|
556
|
-
return [3 /*break*/, 4];
|
|
557
|
-
}
|
|
558
|
-
_e.label = 2;
|
|
559
|
-
case 2: return [4 /*yield*/, this.calcShoppingPercentageDiscount(coupon, checkout)];
|
|
560
|
-
case 3:
|
|
561
|
-
discount = _e.sent();
|
|
562
|
-
return [3 /*break*/, 4];
|
|
563
|
-
case 4: return [2 /*return*/, discount];
|
|
564
|
-
}
|
|
565
|
-
});
|
|
566
|
-
});
|
|
567
|
-
};
|
|
568
|
-
CouponService.prototype.calcShoppingPercentageDiscount = function (coupon, checkout) {
|
|
569
|
-
var _a;
|
|
570
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
571
|
-
var discount, shop, lineItensDiscount, couponCategories, subTotal;
|
|
572
|
-
return __generator(this, function (_d) {
|
|
573
|
-
switch (_d.label) {
|
|
574
|
-
case 0:
|
|
575
|
-
discount = 0;
|
|
576
|
-
shop = checkout.shop;
|
|
577
|
-
lineItensDiscount = [];
|
|
578
|
-
return [4 /*yield*/, this.getCouponCategoriesId(coupon)];
|
|
579
|
-
case 1:
|
|
580
|
-
couponCategories = _d.sent();
|
|
581
|
-
if (coupon.productsCategories && coupon.productsCategories.length) {
|
|
582
|
-
lineItensDiscount = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
|
|
583
|
-
var _a;
|
|
584
|
-
if ((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length) {
|
|
585
|
-
return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat.id == c || cat.firestoreId == c; }); });
|
|
586
|
-
}
|
|
587
|
-
return true;
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
lineItensDiscount = checkout.lineItems;
|
|
592
|
-
}
|
|
593
|
-
subTotal = lineItensDiscount.reduce(function (acc, curr) {
|
|
594
|
-
var _a, _b, _c;
|
|
595
|
-
return ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber) && ((_b = curr.price[shop]) === null || _b === void 0 ? void 0 : _b.subscriberPrice)
|
|
596
|
-
? acc + ((_c = curr.price[shop]) === null || _c === void 0 ? void 0 : _c.subscriberPrice) * curr.quantity
|
|
597
|
-
: acc + curr.pricePaid * curr.quantity;
|
|
598
|
-
}, 0) || 0;
|
|
599
|
-
discount = subTotal * (coupon.discount / 100);
|
|
600
|
-
return [2 /*return*/, discount];
|
|
601
|
-
}
|
|
602
|
-
});
|
|
603
|
-
});
|
|
604
|
-
};
|
|
605
|
-
CouponService.prototype.hasMinSubTotal = function (coupon, checkout) {
|
|
606
|
-
var _a;
|
|
607
|
-
if (!coupon.minSubTotalValue)
|
|
608
|
-
return true;
|
|
609
|
-
var shop = checkout.shop;
|
|
610
|
-
var subTotal = ((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, curr) {
|
|
611
|
-
var _a, _b, _c;
|
|
612
|
-
return ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber) && ((_b = curr.price[shop]) === null || _b === void 0 ? void 0 : _b.subscriberPrice)
|
|
613
|
-
? acc + ((_c = curr.price[shop]) === null || _c === void 0 ? void 0 : _c.subscriberPrice) * curr.quantity
|
|
614
|
-
: acc + curr.pricePaid * curr.quantity;
|
|
615
|
-
}, 0)) || 0;
|
|
616
|
-
if (coupon.minSubTotalValue <= subTotal)
|
|
617
|
-
return true;
|
|
618
|
-
return false;
|
|
619
|
-
};
|
|
620
|
-
CouponService.prototype.hasProductCategories = function (coupon, checkout) {
|
|
621
|
-
var _a;
|
|
622
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
623
|
-
var couponCategories, hasCategories;
|
|
624
|
-
return __generator(this, function (_d) {
|
|
625
|
-
switch (_d.label) {
|
|
626
|
-
case 0:
|
|
627
|
-
if (!coupon.productsCategories || !coupon.productsCategories.length) {
|
|
628
|
-
return [2 /*return*/, true];
|
|
629
|
-
}
|
|
630
|
-
return [4 /*yield*/, this.getCouponCategoriesId(coupon)];
|
|
631
|
-
case 1:
|
|
632
|
-
couponCategories = _d.sent();
|
|
633
|
-
hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
|
|
634
|
-
var _a;
|
|
635
|
-
if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length))
|
|
636
|
-
return true;
|
|
637
|
-
return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat.id == c || cat.firestoreId == c; }); });
|
|
638
|
-
});
|
|
639
|
-
return [2 /*return*/, hasCategories.length ? true : false];
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
});
|
|
643
|
-
};
|
|
644
|
-
CouponService.prototype.userValidationAndSubscriptionStatus = function (coupon, user) {
|
|
645
|
-
if (coupon.exclusivityType === i3.Exclusivities.ALL_USERS)
|
|
646
|
-
return true;
|
|
647
|
-
if (!user)
|
|
648
|
-
return true;
|
|
649
|
-
// Verifica se o email do usuário é coorporativo
|
|
650
|
-
if (!this.emailIsFromCollaborator(user.email) && coupon.exclusivityType === i3.Exclusivities.COLLABORATORS)
|
|
651
|
-
throw new InvalidCouponError('Você não é colaborador.');
|
|
652
|
-
// Verifica se o email do usuário é associado ao cupom de uso por usuario
|
|
653
|
-
if (coupon.exclusivityType === i3.Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== user.email)
|
|
654
|
-
throw new InvalidCouponError('Cupom não é válido para este usuário.');
|
|
655
|
-
switch (coupon.exclusivityType) {
|
|
656
|
-
case i3.Exclusivities.ACTIVE_SUBSCRIBER:
|
|
657
|
-
return user.isSubscriber ? true : false;
|
|
658
|
-
case i3.Exclusivities.INACTIVE_SUBSCRIBER:
|
|
659
|
-
return user.isSubscriber ? false : true;
|
|
660
|
-
case i3.Exclusivities.NON_SUBSCRIBER:
|
|
661
|
-
return user.isSubscriber ? false : true;
|
|
662
|
-
}
|
|
663
|
-
return true;
|
|
664
|
-
};
|
|
665
|
-
CouponService.prototype.getCouponCategoriesId = function (coupon) {
|
|
666
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
667
|
-
var couponCategories, index, c;
|
|
668
|
-
return __generator(this, function (_d) {
|
|
669
|
-
switch (_d.label) {
|
|
670
|
-
case 0:
|
|
671
|
-
couponCategories = [];
|
|
672
|
-
index = 0;
|
|
673
|
-
_d.label = 1;
|
|
674
|
-
case 1:
|
|
675
|
-
if (!(index < coupon.productsCategories.length)) return [3 /*break*/, 4];
|
|
676
|
-
return [4 /*yield*/, this.categoryRepository.get({
|
|
677
|
-
id: coupon.productsCategories[index],
|
|
678
|
-
})];
|
|
679
|
-
case 2:
|
|
680
|
-
c = _d.sent();
|
|
681
|
-
couponCategories.push({ id: c.id, firestoreId: c.firestoreId });
|
|
682
|
-
_d.label = 3;
|
|
683
|
-
case 3:
|
|
684
|
-
index++;
|
|
685
|
-
return [3 /*break*/, 1];
|
|
686
|
-
case 4: return [2 /*return*/, couponCategories];
|
|
687
|
-
}
|
|
688
|
-
});
|
|
689
|
-
});
|
|
690
|
-
};
|
|
691
|
-
return CouponService;
|
|
692
|
-
}());
|
|
693
|
-
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 });
|
|
694
|
-
CouponService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, providedIn: 'root' });
|
|
695
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, decorators: [{
|
|
696
|
-
type: i0.Injectable,
|
|
697
|
-
args: [{
|
|
698
|
-
providedIn: 'root',
|
|
699
|
-
}]
|
|
700
|
-
}], ctorParameters: function () {
|
|
701
|
-
return [{ type: undefined, decorators: [{
|
|
702
|
-
type: i0.Inject,
|
|
703
|
-
args: ['CouponRepository']
|
|
704
|
-
}] }, { type: i3__namespace.Shops, decorators: [{
|
|
705
|
-
type: i0.Inject,
|
|
706
|
-
args: [DEFAULT_SHOP]
|
|
707
|
-
}] }, { type: undefined, decorators: [{
|
|
708
|
-
type: i0.Inject,
|
|
709
|
-
args: ['OrderRepository']
|
|
710
|
-
}] }, { type: undefined, decorators: [{
|
|
711
|
-
type: i0.Inject,
|
|
712
|
-
args: ['CategoryRepository']
|
|
713
|
-
}] }];
|
|
421
|
+
var CouponService = /** @class */ (function () {
|
|
422
|
+
function CouponService(couponRepository, defaultShop, orderRepository, categoryRepository) {
|
|
423
|
+
var _this = this;
|
|
424
|
+
this.couponRepository = couponRepository;
|
|
425
|
+
this.defaultShop = defaultShop;
|
|
426
|
+
this.orderRepository = orderRepository;
|
|
427
|
+
this.categoryRepository = categoryRepository;
|
|
428
|
+
this.emailIsFromCollaborator = function (userEmail) { return !!(userEmail === null || userEmail === void 0 ? void 0 : userEmail.match(/@b4a.com.br/g)); };
|
|
429
|
+
this.separateValidCoupons = function (coupons, userEmail) { return coupons
|
|
430
|
+
.map(function (coupon) {
|
|
431
|
+
try {
|
|
432
|
+
if (!(coupon instanceof i3.Coupon))
|
|
433
|
+
throw new InvalidCouponError('Cupom inválido.');
|
|
434
|
+
if (_this.isValidCoupon(coupon, userEmail))
|
|
435
|
+
return coupon;
|
|
436
|
+
}
|
|
437
|
+
catch (error) {
|
|
438
|
+
return error;
|
|
439
|
+
}
|
|
440
|
+
})
|
|
441
|
+
.reduce(function (current, coupon) { return (Object.assign(Object.assign({}, current), (coupon instanceof i3.Coupon
|
|
442
|
+
? { valids: __spreadArray(__spreadArray([], __read(current.valids)), [coupon]) }
|
|
443
|
+
: { invalids: __spreadArray(__spreadArray([], __read(current.invalids)), [coupon]) }))); }, {
|
|
444
|
+
valids: [],
|
|
445
|
+
invalids: [],
|
|
446
|
+
}); };
|
|
447
|
+
}
|
|
448
|
+
CouponService.prototype.checkCoupon = function (nickname, userEmail, checkoutType, plan, checkout, isSubscription) {
|
|
449
|
+
var _this = this;
|
|
450
|
+
return rxjs.from(this.couponRepository.find({
|
|
451
|
+
filters: {
|
|
452
|
+
nickname: { operator: i3.Where.EQUALS, value: nickname },
|
|
453
|
+
active: { operator: i3.Where.EQUALS, value: true },
|
|
454
|
+
},
|
|
455
|
+
})).pipe(operators.concatMap(function (coupons) { return _this.checkCouponRules(coupons, checkoutType, plan, checkout, isSubscription); }), operators.concatMap(function (coupon) { return _this.checkCouponUseAndLimit(coupon, userEmail, checkout); }), operators.map(function (coupon) { return _this.isValidCoupon(coupon, userEmail); }), operators.map(function (coupon) { return coupon; }));
|
|
456
|
+
};
|
|
457
|
+
CouponService.prototype.checkCouponRules = function (coupons, checkoutType, plan, checkout, isSubscription) {
|
|
458
|
+
// Caso não ache nenhum cupom, retorna erro
|
|
459
|
+
if (coupons.count < 1) {
|
|
460
|
+
return rxjs.throwError('Cupom inválido.');
|
|
461
|
+
}
|
|
462
|
+
// Get Primeiro Cupom (o find do repository retorna um array)
|
|
463
|
+
var coupon = coupons.data.shift();
|
|
464
|
+
// Verifica se o cupom é aplicavel na loja
|
|
465
|
+
var isInShop = coupon.shopAvailability === i3.Shops.ALL || coupon.shopAvailability === this.defaultShop;
|
|
466
|
+
// Cupon não aplicavel a loja retorna erro
|
|
467
|
+
if (!isInShop)
|
|
468
|
+
return rxjs.throwError('Cupom inválido para loja.');
|
|
469
|
+
// Verifica se o coupon é aplicado no checkout que está sendo realizado
|
|
470
|
+
var isCheckoutType = coupon.checkoutType === i3.CheckoutTypes.ALL || coupon.checkoutType === checkoutType;
|
|
471
|
+
// Cupon não aplicavel ao checkout retorna erro
|
|
472
|
+
if (!isCheckoutType)
|
|
473
|
+
return rxjs.throwError('Cupom inválido. Erro de checkout.');
|
|
474
|
+
// Verifica se o cupom é ou pode ser aplicado para subscription
|
|
475
|
+
if (checkoutType === i3.CheckoutTypes.ALL || checkoutType === i3.CheckoutTypes.SUBSCRIPTION) {
|
|
476
|
+
// Se o cupom tiver um plano associado, verifica se é o mesmo plano do checkout da assinatura
|
|
477
|
+
if (coupon.plan && coupon.plan.toUpperCase() !== plan.toUpperCase())
|
|
478
|
+
return rxjs.throwError('Cupom inválido para sua assinatura.');
|
|
479
|
+
}
|
|
480
|
+
if (isSubscription)
|
|
481
|
+
return rxjs.of(coupon);
|
|
482
|
+
// Verifica se possui o valor minimo de compra para utilização do cupom
|
|
483
|
+
var hasMinSubTotal = this.hasMinSubTotal(coupon, checkout);
|
|
484
|
+
// Se não tem valor mínimo atingido, retorna erro
|
|
485
|
+
if (!hasMinSubTotal)
|
|
486
|
+
return rxjs.throwError("Valor m\u00EDnimo de " + Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue) + " n\u00E3o atingido");
|
|
487
|
+
return rxjs.of(coupon);
|
|
488
|
+
};
|
|
489
|
+
CouponService.prototype.isValidCoupon = function (coupon, userEmail) {
|
|
490
|
+
// Verifica a data de inicio de validade do cupom
|
|
491
|
+
if ((coupon === null || coupon === void 0 ? void 0 : coupon.beginAt) > new Date())
|
|
492
|
+
throw new InvalidCouponError('Cupom ainda não liberado.');
|
|
493
|
+
// Verifica a data de validade do cupom
|
|
494
|
+
if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) < new Date())
|
|
495
|
+
throw new InvalidCouponError('Cupom expirado.');
|
|
496
|
+
return coupon;
|
|
497
|
+
};
|
|
498
|
+
CouponService.prototype.checkCouponUseAndLimit = function (coupon, userEmail, checkout) {
|
|
499
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
500
|
+
var orders, ordersUserCoupon, validUser, hasProductCategories;
|
|
501
|
+
return __generator(this, function (_d) {
|
|
502
|
+
switch (_d.label) {
|
|
503
|
+
case 0: return [4 /*yield*/, this.orderRepository.find({
|
|
504
|
+
filters: {
|
|
505
|
+
coupon: { id: coupon.id },
|
|
506
|
+
payment: { status: 'paid' },
|
|
507
|
+
},
|
|
508
|
+
})];
|
|
509
|
+
case 1:
|
|
510
|
+
orders = _d.sent();
|
|
511
|
+
ordersUserCoupon = orders.data.filter(function (o) { return o.user.email == userEmail; });
|
|
512
|
+
// Verifica o limite de uso de cupom por usuario
|
|
513
|
+
if (coupon.useLimitPerUser && ordersUserCoupon.length)
|
|
514
|
+
throw new InvalidCouponError('Limite de uso por usuário atingido.');
|
|
515
|
+
// Verifica o limite de uso geral por usuario
|
|
516
|
+
if (coupon.useLimit && orders.data.length >= coupon.useLimit)
|
|
517
|
+
throw new InvalidCouponError('Limite de uso atingido.');
|
|
518
|
+
validUser = this.userValidationAndSubscriptionStatus(coupon, checkout === null || checkout === void 0 ? void 0 : checkout.user);
|
|
519
|
+
if (!validUser)
|
|
520
|
+
throw new InvalidCouponError('Usuário não elegível.');
|
|
521
|
+
return [4 /*yield*/, this.hasProductCategories(coupon, checkout)];
|
|
522
|
+
case 2:
|
|
523
|
+
hasProductCategories = _d.sent();
|
|
524
|
+
if (!hasProductCategories)
|
|
525
|
+
throw 'Seu carrinho não possui produtos elegíveis para desconto.';
|
|
526
|
+
return [2 /*return*/, coupon];
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
});
|
|
530
|
+
};
|
|
531
|
+
CouponService.prototype.calcDiscountSubscription = function (coupon, checkout) {
|
|
532
|
+
//
|
|
533
|
+
var discount = 0;
|
|
534
|
+
if (coupon.type === i3.CouponTypes.ABSOLUTE)
|
|
535
|
+
discount = coupon.discount;
|
|
536
|
+
else if (coupon.type === i3.CouponTypes.PERCENTAGE)
|
|
537
|
+
discount = checkout.subscriptionPlan.recurrencePrice * (coupon.discount / 100);
|
|
538
|
+
return rxjs.of(discount);
|
|
539
|
+
};
|
|
540
|
+
CouponService.prototype.calcDiscountShopping = function (coupon, checkout) {
|
|
541
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
542
|
+
var discount, _d;
|
|
543
|
+
return __generator(this, function (_e) {
|
|
544
|
+
switch (_e.label) {
|
|
545
|
+
case 0:
|
|
546
|
+
discount = 0;
|
|
547
|
+
_d = coupon.type;
|
|
548
|
+
switch (_d) {
|
|
549
|
+
case i3.CouponTypes.ABSOLUTE: return [3 /*break*/, 1];
|
|
550
|
+
case i3.CouponTypes.PERCENTAGE: return [3 /*break*/, 2];
|
|
551
|
+
}
|
|
552
|
+
return [3 /*break*/, 4];
|
|
553
|
+
case 1:
|
|
554
|
+
{
|
|
555
|
+
discount = coupon.discount;
|
|
556
|
+
return [3 /*break*/, 4];
|
|
557
|
+
}
|
|
558
|
+
_e.label = 2;
|
|
559
|
+
case 2: return [4 /*yield*/, this.calcShoppingPercentageDiscount(coupon, checkout)];
|
|
560
|
+
case 3:
|
|
561
|
+
discount = _e.sent();
|
|
562
|
+
return [3 /*break*/, 4];
|
|
563
|
+
case 4: return [2 /*return*/, discount];
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
});
|
|
567
|
+
};
|
|
568
|
+
CouponService.prototype.calcShoppingPercentageDiscount = function (coupon, checkout) {
|
|
569
|
+
var _a;
|
|
570
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
571
|
+
var discount, shop, lineItensDiscount, couponCategories, subTotal;
|
|
572
|
+
return __generator(this, function (_d) {
|
|
573
|
+
switch (_d.label) {
|
|
574
|
+
case 0:
|
|
575
|
+
discount = 0;
|
|
576
|
+
shop = checkout.shop;
|
|
577
|
+
lineItensDiscount = [];
|
|
578
|
+
return [4 /*yield*/, this.getCouponCategoriesId(coupon)];
|
|
579
|
+
case 1:
|
|
580
|
+
couponCategories = _d.sent();
|
|
581
|
+
if (coupon.productsCategories && coupon.productsCategories.length) {
|
|
582
|
+
lineItensDiscount = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
|
|
583
|
+
var _a;
|
|
584
|
+
if ((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length) {
|
|
585
|
+
return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat.id == c || cat.firestoreId == c; }); });
|
|
586
|
+
}
|
|
587
|
+
return true;
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
lineItensDiscount = checkout.lineItems;
|
|
592
|
+
}
|
|
593
|
+
subTotal = lineItensDiscount.reduce(function (acc, curr) {
|
|
594
|
+
var _a, _b, _c;
|
|
595
|
+
return ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber) && ((_b = curr.price[shop]) === null || _b === void 0 ? void 0 : _b.subscriberPrice)
|
|
596
|
+
? acc + ((_c = curr.price[shop]) === null || _c === void 0 ? void 0 : _c.subscriberPrice) * curr.quantity
|
|
597
|
+
: acc + curr.pricePaid * curr.quantity;
|
|
598
|
+
}, 0) || 0;
|
|
599
|
+
discount = subTotal * (coupon.discount / 100);
|
|
600
|
+
return [2 /*return*/, discount];
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
});
|
|
604
|
+
};
|
|
605
|
+
CouponService.prototype.hasMinSubTotal = function (coupon, checkout) {
|
|
606
|
+
var _a;
|
|
607
|
+
if (!coupon.minSubTotalValue)
|
|
608
|
+
return true;
|
|
609
|
+
var shop = checkout.shop;
|
|
610
|
+
var subTotal = ((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, curr) {
|
|
611
|
+
var _a, _b, _c;
|
|
612
|
+
return ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber) && ((_b = curr.price[shop]) === null || _b === void 0 ? void 0 : _b.subscriberPrice)
|
|
613
|
+
? acc + ((_c = curr.price[shop]) === null || _c === void 0 ? void 0 : _c.subscriberPrice) * curr.quantity
|
|
614
|
+
: acc + curr.pricePaid * curr.quantity;
|
|
615
|
+
}, 0)) || 0;
|
|
616
|
+
if (coupon.minSubTotalValue <= subTotal)
|
|
617
|
+
return true;
|
|
618
|
+
return false;
|
|
619
|
+
};
|
|
620
|
+
CouponService.prototype.hasProductCategories = function (coupon, checkout) {
|
|
621
|
+
var _a;
|
|
622
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
623
|
+
var couponCategories, hasCategories;
|
|
624
|
+
return __generator(this, function (_d) {
|
|
625
|
+
switch (_d.label) {
|
|
626
|
+
case 0:
|
|
627
|
+
if (!coupon.productsCategories || !coupon.productsCategories.length) {
|
|
628
|
+
return [2 /*return*/, true];
|
|
629
|
+
}
|
|
630
|
+
return [4 /*yield*/, this.getCouponCategoriesId(coupon)];
|
|
631
|
+
case 1:
|
|
632
|
+
couponCategories = _d.sent();
|
|
633
|
+
hasCategories = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.filter(function (i) {
|
|
634
|
+
var _a;
|
|
635
|
+
if (!i.categories || !((_a = i.categories) === null || _a === void 0 ? void 0 : _a.length))
|
|
636
|
+
return true;
|
|
637
|
+
return i.categories.some(function (c) { return couponCategories.some(function (cat) { return cat.id == c || cat.firestoreId == c; }); });
|
|
638
|
+
});
|
|
639
|
+
return [2 /*return*/, hasCategories.length ? true : false];
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
});
|
|
643
|
+
};
|
|
644
|
+
CouponService.prototype.userValidationAndSubscriptionStatus = function (coupon, user) {
|
|
645
|
+
if (coupon.exclusivityType === i3.Exclusivities.ALL_USERS)
|
|
646
|
+
return true;
|
|
647
|
+
if (!user)
|
|
648
|
+
return true;
|
|
649
|
+
// Verifica se o email do usuário é coorporativo
|
|
650
|
+
if (!this.emailIsFromCollaborator(user.email) && coupon.exclusivityType === i3.Exclusivities.COLLABORATORS)
|
|
651
|
+
throw new InvalidCouponError('Você não é colaborador.');
|
|
652
|
+
// Verifica se o email do usuário é associado ao cupom de uso por usuario
|
|
653
|
+
if (coupon.exclusivityType === i3.Exclusivities.SPECIFIC_USER && coupon.userExclusiveEmail !== user.email)
|
|
654
|
+
throw new InvalidCouponError('Cupom não é válido para este usuário.');
|
|
655
|
+
switch (coupon.exclusivityType) {
|
|
656
|
+
case i3.Exclusivities.ACTIVE_SUBSCRIBER:
|
|
657
|
+
return user.isSubscriber ? true : false;
|
|
658
|
+
case i3.Exclusivities.INACTIVE_SUBSCRIBER:
|
|
659
|
+
return user.isSubscriber ? false : true;
|
|
660
|
+
case i3.Exclusivities.NON_SUBSCRIBER:
|
|
661
|
+
return user.isSubscriber ? false : true;
|
|
662
|
+
}
|
|
663
|
+
return true;
|
|
664
|
+
};
|
|
665
|
+
CouponService.prototype.getCouponCategoriesId = function (coupon) {
|
|
666
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
667
|
+
var couponCategories, index, c;
|
|
668
|
+
return __generator(this, function (_d) {
|
|
669
|
+
switch (_d.label) {
|
|
670
|
+
case 0:
|
|
671
|
+
couponCategories = [];
|
|
672
|
+
index = 0;
|
|
673
|
+
_d.label = 1;
|
|
674
|
+
case 1:
|
|
675
|
+
if (!(index < coupon.productsCategories.length)) return [3 /*break*/, 4];
|
|
676
|
+
return [4 /*yield*/, this.categoryRepository.get({
|
|
677
|
+
id: coupon.productsCategories[index],
|
|
678
|
+
})];
|
|
679
|
+
case 2:
|
|
680
|
+
c = _d.sent();
|
|
681
|
+
couponCategories.push({ id: c.id, firestoreId: c.firestoreId });
|
|
682
|
+
_d.label = 3;
|
|
683
|
+
case 3:
|
|
684
|
+
index++;
|
|
685
|
+
return [3 /*break*/, 1];
|
|
686
|
+
case 4: return [2 /*return*/, couponCategories];
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
};
|
|
691
|
+
return CouponService;
|
|
692
|
+
}());
|
|
693
|
+
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 });
|
|
694
|
+
CouponService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, providedIn: 'root' });
|
|
695
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CouponService, decorators: [{
|
|
696
|
+
type: i0.Injectable,
|
|
697
|
+
args: [{
|
|
698
|
+
providedIn: 'root',
|
|
699
|
+
}]
|
|
700
|
+
}], ctorParameters: function () {
|
|
701
|
+
return [{ type: undefined, decorators: [{
|
|
702
|
+
type: i0.Inject,
|
|
703
|
+
args: ['CouponRepository']
|
|
704
|
+
}] }, { type: i3__namespace.Shops, decorators: [{
|
|
705
|
+
type: i0.Inject,
|
|
706
|
+
args: [DEFAULT_SHOP]
|
|
707
|
+
}] }, { type: undefined, decorators: [{
|
|
708
|
+
type: i0.Inject,
|
|
709
|
+
args: ['OrderRepository']
|
|
710
|
+
}] }, { type: undefined, decorators: [{
|
|
711
|
+
type: i0.Inject,
|
|
712
|
+
args: ['CategoryRepository']
|
|
713
|
+
}] }];
|
|
714
714
|
} });
|
|
715
715
|
|
|
716
|
-
var CheckoutService = /** @class */ (function () {
|
|
717
|
-
function CheckoutService(couponService, checkoutRepository, orderRepository, userRepository, defaultShop) {
|
|
718
|
-
this.couponService = couponService;
|
|
719
|
-
this.checkoutRepository = checkoutRepository;
|
|
720
|
-
this.orderRepository = orderRepository;
|
|
721
|
-
this.userRepository = userRepository;
|
|
722
|
-
this.defaultShop = defaultShop;
|
|
723
|
-
}
|
|
724
|
-
CheckoutService.prototype.getCheckout = function (checkoutData) {
|
|
725
|
-
var checkoutId = cookie__default["default"].get('checkoutId');
|
|
726
|
-
if (!i3.isNil(checkoutId))
|
|
727
|
-
return rxjs.from(this.checkoutRepository.get({ id: checkoutId }));
|
|
728
|
-
return rxjs.from(this.createCheckout(checkoutData));
|
|
729
|
-
};
|
|
730
|
-
CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
|
|
731
|
-
var _this = this;
|
|
732
|
-
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 i3.NotFoundError('User is not found'); }); }));
|
|
733
|
-
};
|
|
734
|
-
CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
|
|
735
|
-
return rxjs.from(this.checkoutRepository.update(i3.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
|
|
736
|
-
};
|
|
737
|
-
CheckoutService.prototype.updateCheckoutUser = function (checkout) {
|
|
738
|
-
return rxjs.from(this.checkoutRepository.update(i3.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
|
|
739
|
-
};
|
|
740
|
-
CheckoutService.prototype.clearCheckoutFromSession = function () {
|
|
741
|
-
cookie__default["default"].remove('checkoutId');
|
|
742
|
-
return rxjs.of();
|
|
743
|
-
};
|
|
744
|
-
CheckoutService.prototype.calcDiscount = function (coupon) {
|
|
745
|
-
var _this = this;
|
|
746
|
-
return this.getCheckout().pipe(operators.concatMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
|
|
747
|
-
switch (_b.label) {
|
|
748
|
-
case 0: return [4 /*yield*/, this.couponService.calcDiscountShopping(coupon, checkout)];
|
|
749
|
-
case 1: return [2 /*return*/, _b.sent()];
|
|
750
|
-
}
|
|
751
|
-
}); }); }));
|
|
752
|
-
};
|
|
753
|
-
CheckoutService.prototype.checkCoupon = function (nickname, checkoutType) {
|
|
754
|
-
var _this = this;
|
|
755
|
-
return this.getCheckout().pipe(operators.concatMap(function (checkout) {
|
|
756
|
-
var _a;
|
|
757
|
-
return _this.couponService
|
|
758
|
-
.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email, i3.CheckoutTypes.ECOMMERCE, checkout.user.subscriptionPlan, checkout, false)
|
|
759
|
-
.pipe();
|
|
760
|
-
}));
|
|
761
|
-
};
|
|
762
|
-
CheckoutService.prototype.createCheckout = function (checkoutData) {
|
|
763
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
764
|
-
var checkout;
|
|
765
|
-
return __generator(this, function (_b) {
|
|
766
|
-
switch (_b.label) {
|
|
767
|
-
case 0: return [4 /*yield*/, this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, i3.Checkout.toInstance(i3.pick(checkoutData, ['user', 'shop'])).toPlain()), { shop: (checkoutData === null || checkoutData === void 0 ? void 0 : checkoutData.shop) || this.defaultShop }))];
|
|
768
|
-
case 1:
|
|
769
|
-
checkout = _b.sent();
|
|
770
|
-
cookie__default["default"].set('checkoutId', checkout.id);
|
|
771
|
-
return [2 /*return*/, checkout];
|
|
772
|
-
}
|
|
773
|
-
});
|
|
774
|
-
});
|
|
775
|
-
};
|
|
776
|
-
return CheckoutService;
|
|
777
|
-
}());
|
|
778
|
-
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 });
|
|
779
|
-
CheckoutService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService });
|
|
780
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, decorators: [{
|
|
781
|
-
type: i0.Injectable
|
|
782
|
-
}], ctorParameters: function () {
|
|
783
|
-
return [{ type: CouponService }, { type: undefined, decorators: [{
|
|
784
|
-
type: i0.Inject,
|
|
785
|
-
args: ['CheckoutRepository']
|
|
786
|
-
}] }, { type: undefined, decorators: [{
|
|
787
|
-
type: i0.Inject,
|
|
788
|
-
args: ['OrderRepository']
|
|
789
|
-
}] }, { type: undefined, decorators: [{
|
|
790
|
-
type: i0.Inject,
|
|
791
|
-
args: ['UserRepository']
|
|
792
|
-
}] }, { type: i3__namespace.Shops, decorators: [{
|
|
793
|
-
type: i0.Inject,
|
|
794
|
-
args: [DEFAULT_SHOP]
|
|
795
|
-
}] }];
|
|
716
|
+
var CheckoutService = /** @class */ (function () {
|
|
717
|
+
function CheckoutService(couponService, checkoutRepository, orderRepository, userRepository, defaultShop) {
|
|
718
|
+
this.couponService = couponService;
|
|
719
|
+
this.checkoutRepository = checkoutRepository;
|
|
720
|
+
this.orderRepository = orderRepository;
|
|
721
|
+
this.userRepository = userRepository;
|
|
722
|
+
this.defaultShop = defaultShop;
|
|
723
|
+
}
|
|
724
|
+
CheckoutService.prototype.getCheckout = function (checkoutData) {
|
|
725
|
+
var checkoutId = cookie__default["default"].get('checkoutId');
|
|
726
|
+
if (!i3.isNil(checkoutId))
|
|
727
|
+
return rxjs.from(this.checkoutRepository.get({ id: checkoutId }));
|
|
728
|
+
return rxjs.from(this.createCheckout(checkoutData));
|
|
729
|
+
};
|
|
730
|
+
CheckoutService.prototype.getUserByCheckout = function (checkoutId) {
|
|
731
|
+
var _this = this;
|
|
732
|
+
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 i3.NotFoundError('User is not found'); }); }));
|
|
733
|
+
};
|
|
734
|
+
CheckoutService.prototype.updateCheckoutLineItems = function (checkout) {
|
|
735
|
+
return rxjs.from(this.checkoutRepository.update(i3.Checkout.toInstance({ id: checkout.id, lineItems: checkout.lineItems })));
|
|
736
|
+
};
|
|
737
|
+
CheckoutService.prototype.updateCheckoutUser = function (checkout) {
|
|
738
|
+
return rxjs.from(this.checkoutRepository.update(i3.Checkout.toInstance({ id: checkout.id, user: checkout.user })));
|
|
739
|
+
};
|
|
740
|
+
CheckoutService.prototype.clearCheckoutFromSession = function () {
|
|
741
|
+
cookie__default["default"].remove('checkoutId');
|
|
742
|
+
return rxjs.of();
|
|
743
|
+
};
|
|
744
|
+
CheckoutService.prototype.calcDiscount = function (coupon) {
|
|
745
|
+
var _this = this;
|
|
746
|
+
return this.getCheckout().pipe(operators.concatMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
|
|
747
|
+
switch (_b.label) {
|
|
748
|
+
case 0: return [4 /*yield*/, this.couponService.calcDiscountShopping(coupon, checkout)];
|
|
749
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
750
|
+
}
|
|
751
|
+
}); }); }));
|
|
752
|
+
};
|
|
753
|
+
CheckoutService.prototype.checkCoupon = function (nickname, checkoutType) {
|
|
754
|
+
var _this = this;
|
|
755
|
+
return this.getCheckout().pipe(operators.concatMap(function (checkout) {
|
|
756
|
+
var _a;
|
|
757
|
+
return _this.couponService
|
|
758
|
+
.checkCoupon(nickname, (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.email, i3.CheckoutTypes.ECOMMERCE, checkout.user.subscriptionPlan, checkout, false)
|
|
759
|
+
.pipe();
|
|
760
|
+
}));
|
|
761
|
+
};
|
|
762
|
+
CheckoutService.prototype.createCheckout = function (checkoutData) {
|
|
763
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
764
|
+
var checkout;
|
|
765
|
+
return __generator(this, function (_b) {
|
|
766
|
+
switch (_b.label) {
|
|
767
|
+
case 0: return [4 /*yield*/, this.checkoutRepository.create(Object.assign(Object.assign({ createdAt: new Date() }, i3.Checkout.toInstance(i3.pick(checkoutData, ['user', 'shop'])).toPlain()), { shop: (checkoutData === null || checkoutData === void 0 ? void 0 : checkoutData.shop) || this.defaultShop }))];
|
|
768
|
+
case 1:
|
|
769
|
+
checkout = _b.sent();
|
|
770
|
+
cookie__default["default"].set('checkoutId', checkout.id);
|
|
771
|
+
return [2 /*return*/, checkout];
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
});
|
|
775
|
+
};
|
|
776
|
+
return CheckoutService;
|
|
777
|
+
}());
|
|
778
|
+
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 });
|
|
779
|
+
CheckoutService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService });
|
|
780
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutService, decorators: [{
|
|
781
|
+
type: i0.Injectable
|
|
782
|
+
}], ctorParameters: function () {
|
|
783
|
+
return [{ type: CouponService }, { type: undefined, decorators: [{
|
|
784
|
+
type: i0.Inject,
|
|
785
|
+
args: ['CheckoutRepository']
|
|
786
|
+
}] }, { type: undefined, decorators: [{
|
|
787
|
+
type: i0.Inject,
|
|
788
|
+
args: ['OrderRepository']
|
|
789
|
+
}] }, { type: undefined, decorators: [{
|
|
790
|
+
type: i0.Inject,
|
|
791
|
+
args: ['UserRepository']
|
|
792
|
+
}] }, { type: i3__namespace.Shops, decorators: [{
|
|
793
|
+
type: i0.Inject,
|
|
794
|
+
args: [DEFAULT_SHOP]
|
|
795
|
+
}] }];
|
|
796
796
|
} });
|
|
797
797
|
|
|
798
|
-
var CartService = /** @class */ (function () {
|
|
799
|
-
function CartService(authService, checkoutService, defaultShop, productRepository, variantRepository, buy2WinRepository) {
|
|
800
|
-
var _this = this;
|
|
801
|
-
this.authService = authService;
|
|
802
|
-
this.checkoutService = checkoutService;
|
|
803
|
-
this.defaultShop = defaultShop;
|
|
804
|
-
this.productRepository = productRepository;
|
|
805
|
-
this.variantRepository = variantRepository;
|
|
806
|
-
this.buy2WinRepository = buy2WinRepository;
|
|
807
|
-
this.cartSubject = new rxjs.Subject();
|
|
808
|
-
this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i3.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
|
|
809
|
-
var _a;
|
|
810
|
-
var items = [];
|
|
811
|
-
var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.id; }).indexOf(lineItem.id);
|
|
812
|
-
if (index > -1) {
|
|
813
|
-
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
814
|
-
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
815
|
-
}
|
|
816
|
-
else
|
|
817
|
-
checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
|
|
818
|
-
return _this.checkoutService
|
|
819
|
-
.updateCheckoutLineItems(checkoutLoaded)
|
|
820
|
-
.pipe(operators.map(function (updatedCheckout) { return _this.generateCartObject(updatedCheckout.lineItems); }));
|
|
821
|
-
})); };
|
|
822
|
-
this.generateCartObject = function (items) { return items
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
var
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
if (campaign.
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
_o.
|
|
1069
|
-
|
|
1070
|
-
_o.
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
_o.
|
|
1078
|
-
|
|
1079
|
-
_o.
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
return [
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
var
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
i0__namespace.ɵɵ
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
798
|
+
var CartService = /** @class */ (function () {
|
|
799
|
+
function CartService(authService, checkoutService, defaultShop, productRepository, variantRepository, buy2WinRepository) {
|
|
800
|
+
var _this = this;
|
|
801
|
+
this.authService = authService;
|
|
802
|
+
this.checkoutService = checkoutService;
|
|
803
|
+
this.defaultShop = defaultShop;
|
|
804
|
+
this.productRepository = productRepository;
|
|
805
|
+
this.variantRepository = variantRepository;
|
|
806
|
+
this.buy2WinRepository = buy2WinRepository;
|
|
807
|
+
this.cartSubject = new rxjs.Subject();
|
|
808
|
+
this.updateLineItemInCart = function (lineItem, quantity, checkout) { return (i3.isNil(checkout) ? _this.checkoutService.getCheckout() : rxjs.of(checkout)).pipe(operators.concatMap(function (checkoutLoaded) {
|
|
809
|
+
var _a;
|
|
810
|
+
var items = [];
|
|
811
|
+
var index = (_a = checkoutLoaded.lineItems) === null || _a === void 0 ? void 0 : _a.map(function (checkoutItem) { return checkoutItem.id; }).indexOf(lineItem.id);
|
|
812
|
+
if (index > -1) {
|
|
813
|
+
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
814
|
+
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
815
|
+
}
|
|
816
|
+
else
|
|
817
|
+
checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
|
|
818
|
+
return _this.checkoutService
|
|
819
|
+
.updateCheckoutLineItems(checkoutLoaded)
|
|
820
|
+
.pipe(operators.map(function (updatedCheckout) { return _this.generateCartObject(updatedCheckout.lineItems); }));
|
|
821
|
+
})); };
|
|
822
|
+
this.generateCartObject = function (items) { return items
|
|
823
|
+
? items.reduce(function (cart, item) {
|
|
824
|
+
var _h;
|
|
825
|
+
var _a;
|
|
826
|
+
return (Object.assign(Object.assign({}, cart), (_h = {}, _h[item.id] = i3.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)));
|
|
827
|
+
}, {})
|
|
828
|
+
: []; };
|
|
829
|
+
this.buildLineItem = function (_h) {
|
|
830
|
+
var checkout = _h.checkout, item = _h.item, quantity = _h.quantity;
|
|
831
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
832
|
+
var _a, _b, _c, _d, _e, _f, _g, product, image, id, name, EAN, slug, stock, price, weight, sku, type, isGift, pricePaid;
|
|
833
|
+
return __generator(this, function (_h) {
|
|
834
|
+
switch (_h.label) {
|
|
835
|
+
case 0: return [4 /*yield*/, this.getProductData(item.id)];
|
|
836
|
+
case 1:
|
|
837
|
+
product = _h.sent();
|
|
838
|
+
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;
|
|
839
|
+
if (this.checkMaxStock(item, quantity || 0))
|
|
840
|
+
throw new Error('Desculpe! Temos apenas ' + ((_c = item.stock) === null || _c === void 0 ? void 0 : _c.quantity) + ' em estoque.');
|
|
841
|
+
image = item.image || ((_d = item.images) === null || _d === void 0 ? void 0 : _d.shift());
|
|
842
|
+
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;
|
|
843
|
+
isGift = item.isGift || null;
|
|
844
|
+
pricePaid = this.getProductPrice({
|
|
845
|
+
product: item,
|
|
846
|
+
shop: checkout.shop || this.defaultShop,
|
|
847
|
+
isSubscriber: (_e = checkout.user) === null || _e === void 0 ? void 0 : _e.isSubscriber,
|
|
848
|
+
});
|
|
849
|
+
return [2 /*return*/, {
|
|
850
|
+
checkout: checkout,
|
|
851
|
+
lineItem: i3.LineItem.toInstance({
|
|
852
|
+
id: id,
|
|
853
|
+
name: name !== null && name !== void 0 ? name : product.name,
|
|
854
|
+
EAN: EAN !== null && EAN !== void 0 ? EAN : product.EAN,
|
|
855
|
+
brand: product.brand,
|
|
856
|
+
slug: slug !== null && slug !== void 0 ? slug : product.slug,
|
|
857
|
+
sku: sku !== null && sku !== void 0 ? sku : product.sku,
|
|
858
|
+
stock: stock,
|
|
859
|
+
price: price,
|
|
860
|
+
image: image,
|
|
861
|
+
weight: weight !== null && weight !== void 0 ? weight : product.weight,
|
|
862
|
+
quantity: (item.quantity || 0) + (quantity || 0),
|
|
863
|
+
pricePaid: pricePaid,
|
|
864
|
+
categories: (_f = product.categories) !== null && _f !== void 0 ? _f : [],
|
|
865
|
+
isGift: isGift !== null && isGift !== void 0 ? isGift : null,
|
|
866
|
+
costPrice: (_g = product.costPrice) !== null && _g !== void 0 ? _g : 0,
|
|
867
|
+
type: type,
|
|
868
|
+
}),
|
|
869
|
+
}];
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
});
|
|
873
|
+
};
|
|
874
|
+
this.getProductPrice = function (_h) {
|
|
875
|
+
var product = _h.product, isSubscriber = _h.isSubscriber;
|
|
876
|
+
var info = product.price;
|
|
877
|
+
if (product.isGift)
|
|
878
|
+
return 0;
|
|
879
|
+
return isSubscriber && info.subscriberPrice > 0 ? info.subscriberPrice : info.price;
|
|
880
|
+
};
|
|
881
|
+
this.checkMaxStock = function (item, quantity) {
|
|
882
|
+
var _a;
|
|
883
|
+
var maxStock = ((_a = item.stock) === null || _a === void 0 ? void 0 : _a.quantity) || 0;
|
|
884
|
+
var currentItemAmount = item.quantity || 0;
|
|
885
|
+
return currentItemAmount + quantity > maxStock;
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
CartService.prototype.addItem = function (item, quantity) {
|
|
889
|
+
var _this = this;
|
|
890
|
+
if (quantity === void 0) { quantity = 1; }
|
|
891
|
+
return rxjs.from(this.checkoutService.getCheckout()).pipe(operators.concatMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_h) {
|
|
892
|
+
switch (_h.label) {
|
|
893
|
+
case 0: return [4 /*yield*/, this.buildLineItem({ checkout: checkout, item: item, quantity: quantity || 1 })];
|
|
894
|
+
case 1: return [2 /*return*/, _h.sent()];
|
|
895
|
+
}
|
|
896
|
+
}); }); }), operators.mergeMap(function (_h) {
|
|
897
|
+
var checkout = _h.checkout, lineItem = _h.lineItem;
|
|
898
|
+
return _this.updateLineItemInCart(lineItem, quantity || 1, checkout);
|
|
899
|
+
}), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
|
|
900
|
+
};
|
|
901
|
+
CartService.prototype.decreaseItem = function (item) {
|
|
902
|
+
var _this = this;
|
|
903
|
+
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
904
|
+
var _a;
|
|
905
|
+
var checkoutItem = (_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.find(function (lineItem) { return lineItem.id === item.id; });
|
|
906
|
+
if (!i3.isNil(checkoutItem))
|
|
907
|
+
checkoutItem.quantity -= checkoutItem.quantity > 1 ? 1 : 0;
|
|
908
|
+
return checkout;
|
|
909
|
+
}), 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); }));
|
|
910
|
+
};
|
|
911
|
+
CartService.prototype.getCart = function (checkout) {
|
|
912
|
+
var _this = this;
|
|
913
|
+
this.buildCartFromCheckout(checkout).subscribe(function (cart) { return _this.cartSubject.next(cart); });
|
|
914
|
+
return this.cartSubject;
|
|
915
|
+
};
|
|
916
|
+
/**
|
|
917
|
+
* @deprecated The method should not be used
|
|
918
|
+
*/
|
|
919
|
+
CartService.prototype.getVariantPriceDiscount = function (item) {
|
|
920
|
+
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); }));
|
|
921
|
+
};
|
|
922
|
+
CartService.prototype.removeItem = function (item) {
|
|
923
|
+
var _this = this;
|
|
924
|
+
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
925
|
+
var index = checkout.lineItems.findIndex(function (lineItem) { return lineItem.id === item.id; });
|
|
926
|
+
if (index >= 0)
|
|
927
|
+
checkout.lineItems.splice(index, 1);
|
|
928
|
+
return checkout;
|
|
929
|
+
}), 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); }));
|
|
930
|
+
};
|
|
931
|
+
CartService.prototype.updateUserCart = function (user) {
|
|
932
|
+
var _this = this;
|
|
933
|
+
return this.checkoutService.getCheckout().pipe(operators.concatMap(function (checkout) { return _this.checkoutService.updateCheckoutUser(i3.Checkout.toInstance(Object.assign(Object.assign({}, checkout.toPlain()), { user: user }))); }), operators.concatMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () {
|
|
934
|
+
var _a, _b, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
935
|
+
var _this = this;
|
|
936
|
+
return __generator(this, function (_s) {
|
|
937
|
+
switch (_s.label) {
|
|
938
|
+
case 0:
|
|
939
|
+
_j = (_h = this.checkoutService)
|
|
940
|
+
.updateCheckoutLineItems;
|
|
941
|
+
_l = (_k = i3.Checkout).toInstance;
|
|
942
|
+
_o = (_m = Object).assign;
|
|
943
|
+
_p = [Object.assign({}, checkout.toPlain())];
|
|
944
|
+
_q = {};
|
|
945
|
+
if (!((_a = checkout.lineItems) === null || _a === void 0 ? void 0 : _a.length)) return [3 /*break*/, 2];
|
|
946
|
+
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) {
|
|
947
|
+
switch (_h.label) {
|
|
948
|
+
case 0: return [4 /*yield*/, this.buildLineItem({ checkout: checkout, item: item })];
|
|
949
|
+
case 1: return [2 /*return*/, (_h.sent()).lineItem];
|
|
950
|
+
}
|
|
951
|
+
}); }); }))];
|
|
952
|
+
case 1:
|
|
953
|
+
_r = _s.sent();
|
|
954
|
+
return [3 /*break*/, 3];
|
|
955
|
+
case 2:
|
|
956
|
+
_r = [];
|
|
957
|
+
_s.label = 3;
|
|
958
|
+
case 3: return [2 /*return*/, _j.apply(_h, [_l.apply(_k, [_o.apply(_m, _p.concat([(_q.lineItems = _r, _q)]))])])
|
|
959
|
+
.toPromise()];
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
}); }), operators.map(function (checkout) { return _this.generateCartObject(checkout.lineItems); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
|
|
963
|
+
};
|
|
964
|
+
CartService.prototype.clearCart = function () {
|
|
965
|
+
var _this = this;
|
|
966
|
+
return this.checkoutService.getCheckout().pipe(operators.map(function (checkout) {
|
|
967
|
+
_this.checkoutService.clearCheckoutFromSession();
|
|
968
|
+
return checkout;
|
|
969
|
+
}), operators.concatMap(function (oldCheckout) { return _this.buildCartFromCheckout(oldCheckout); }), operators.tap(function (cart) { return _this.cartSubject.next(cart); }));
|
|
970
|
+
};
|
|
971
|
+
CartService.prototype.buildCartFromCheckout = function (checkoutData) {
|
|
972
|
+
var _this = this;
|
|
973
|
+
return this.checkoutService.getCheckout(checkoutData).pipe(operators.map(function (checkout) { return checkout.lineItems; }), operators.concatMap(function (lineItems) { return rxjs.of(_this.generateCartObject(lineItems)); }));
|
|
974
|
+
};
|
|
975
|
+
CartService.prototype.getProductData = function (productId) {
|
|
976
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
977
|
+
var product, variant, error_1;
|
|
978
|
+
return __generator(this, function (_h) {
|
|
979
|
+
switch (_h.label) {
|
|
980
|
+
case 0:
|
|
981
|
+
_h.trys.push([0, 2, , 5]);
|
|
982
|
+
return [4 /*yield*/, this.productRepository.get({ id: productId })];
|
|
983
|
+
case 1:
|
|
984
|
+
product = _h.sent();
|
|
985
|
+
return [3 /*break*/, 5];
|
|
986
|
+
case 2:
|
|
987
|
+
error_1 = _h.sent();
|
|
988
|
+
if (!(error_1 instanceof i3.NotFoundError))
|
|
989
|
+
throw error_1;
|
|
990
|
+
return [4 /*yield*/, this.variantRepository.get({ id: productId })];
|
|
991
|
+
case 3:
|
|
992
|
+
variant = _h.sent();
|
|
993
|
+
return [4 /*yield*/, this.productRepository.get({ id: variant.productId })];
|
|
994
|
+
case 4:
|
|
995
|
+
product = _h.sent();
|
|
996
|
+
return [3 /*break*/, 5];
|
|
997
|
+
case 5: return [2 /*return*/, Object.assign(Object.assign({}, product.toPlain()), (variant && Object.assign({}, variant.toPlain())))];
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
});
|
|
1001
|
+
};
|
|
1002
|
+
CartService.prototype.getGifts = function () {
|
|
1003
|
+
var _this = this;
|
|
1004
|
+
return this.checkoutService.getCheckout().pipe(operators.mergeMap(function (checkout) { return __awaiter(_this, void 0, void 0, function () {
|
|
1005
|
+
var notGiftItems, cartTotal, campaigns, elegibleCampaigns, _loop_1, campaigns_1, campaigns_1_1, campaign, campaingnProducts, elegibleCampaigns_1, elegibleCampaigns_1_1, campaign, elegibleProducts, _h, _j, product, productData, gift, e_1_1, e_2_1, gifts;
|
|
1006
|
+
var e_3, _k, e_2, _l, e_1, _m;
|
|
1007
|
+
return __generator(this, function (_o) {
|
|
1008
|
+
switch (_o.label) {
|
|
1009
|
+
case 0:
|
|
1010
|
+
notGiftItems = checkout.lineItems ? checkout.lineItems.filter(function (item) { return !item.isGift; }) : [];
|
|
1011
|
+
if (!notGiftItems.length)
|
|
1012
|
+
return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: [] })];
|
|
1013
|
+
cartTotal = notGiftItems.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
|
|
1014
|
+
return [4 /*yield*/, this.buy2WinRepository
|
|
1015
|
+
.find({
|
|
1016
|
+
filters: {
|
|
1017
|
+
active: { operator: i3.Where.EQUALS, value: true },
|
|
1018
|
+
shop: { operator: i3.Where.EQUALS, value: this.defaultShop },
|
|
1019
|
+
},
|
|
1020
|
+
})
|
|
1021
|
+
.then(function (data) { return data.data; })];
|
|
1022
|
+
case 1:
|
|
1023
|
+
campaigns = _o.sent();
|
|
1024
|
+
if (!campaigns.length)
|
|
1025
|
+
return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
|
|
1026
|
+
elegibleCampaigns = [];
|
|
1027
|
+
_loop_1 = function (campaign) {
|
|
1028
|
+
var today = new Date();
|
|
1029
|
+
if (!(campaign.startDate <= today) && !(campaign.endDate >= today))
|
|
1030
|
+
return "continue";
|
|
1031
|
+
if (campaign.activeCategory) {
|
|
1032
|
+
var categoriesCampaing_1 = campaign.categories.map(function (c) { return c.id; });
|
|
1033
|
+
var filterProductsCategories = checkout.lineItems.filter(function (l) {
|
|
1034
|
+
var _a;
|
|
1035
|
+
if (!l.categories || !((_a = l.categories) === null || _a === void 0 ? void 0 : _a.length))
|
|
1036
|
+
return true;
|
|
1037
|
+
return l.categories.some(function (c) { return categoriesCampaing_1.some(function (cat) { return cat == c; }); });
|
|
1038
|
+
});
|
|
1039
|
+
if (filterProductsCategories.length) {
|
|
1040
|
+
var cartTotalCategories = filterProductsCategories.reduce(function (a, b) { return a + b.pricePaid * b.quantity; }, 0);
|
|
1041
|
+
if (cartTotalCategories >= campaign.cartValueMin)
|
|
1042
|
+
elegibleCampaigns.push(campaign);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
else {
|
|
1046
|
+
if (campaign.cartValue && campaign.cartValue > 0) {
|
|
1047
|
+
if (campaign.cartValue <= cartTotal)
|
|
1048
|
+
elegibleCampaigns.push(campaign);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
try {
|
|
1053
|
+
for (campaigns_1 = __values(campaigns), campaigns_1_1 = campaigns_1.next(); !campaigns_1_1.done; campaigns_1_1 = campaigns_1.next()) {
|
|
1054
|
+
campaign = campaigns_1_1.value;
|
|
1055
|
+
_loop_1(campaign);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1059
|
+
finally {
|
|
1060
|
+
try {
|
|
1061
|
+
if (campaigns_1_1 && !campaigns_1_1.done && (_k = campaigns_1.return)) _k.call(campaigns_1);
|
|
1062
|
+
}
|
|
1063
|
+
finally { if (e_3) throw e_3.error; }
|
|
1064
|
+
}
|
|
1065
|
+
if (!elegibleCampaigns.length)
|
|
1066
|
+
return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
|
|
1067
|
+
campaingnProducts = [];
|
|
1068
|
+
_o.label = 2;
|
|
1069
|
+
case 2:
|
|
1070
|
+
_o.trys.push([2, 14, 15, 16]);
|
|
1071
|
+
elegibleCampaigns_1 = __values(elegibleCampaigns), elegibleCampaigns_1_1 = elegibleCampaigns_1.next();
|
|
1072
|
+
_o.label = 3;
|
|
1073
|
+
case 3:
|
|
1074
|
+
if (!!elegibleCampaigns_1_1.done) return [3 /*break*/, 13];
|
|
1075
|
+
campaign = elegibleCampaigns_1_1.value;
|
|
1076
|
+
elegibleProducts = [];
|
|
1077
|
+
_o.label = 4;
|
|
1078
|
+
case 4:
|
|
1079
|
+
_o.trys.push([4, 9, 10, 11]);
|
|
1080
|
+
_h = (e_1 = void 0, __values(campaign.products)), _j = _h.next();
|
|
1081
|
+
_o.label = 5;
|
|
1082
|
+
case 5:
|
|
1083
|
+
if (!!_j.done) return [3 /*break*/, 8];
|
|
1084
|
+
product = _j.value;
|
|
1085
|
+
return [4 /*yield*/, this.productRepository.find({ filters: { sku: product } })];
|
|
1086
|
+
case 6:
|
|
1087
|
+
productData = (_o.sent()).data;
|
|
1088
|
+
if (!productData.length)
|
|
1089
|
+
return [3 /*break*/, 7];
|
|
1090
|
+
gift = productData.shift();
|
|
1091
|
+
if (gift.stock.quantity < 1)
|
|
1092
|
+
return [3 /*break*/, 7];
|
|
1093
|
+
elegibleProducts.push(gift);
|
|
1094
|
+
_o.label = 7;
|
|
1095
|
+
case 7:
|
|
1096
|
+
_j = _h.next();
|
|
1097
|
+
return [3 /*break*/, 5];
|
|
1098
|
+
case 8: return [3 /*break*/, 11];
|
|
1099
|
+
case 9:
|
|
1100
|
+
e_1_1 = _o.sent();
|
|
1101
|
+
e_1 = { error: e_1_1 };
|
|
1102
|
+
return [3 /*break*/, 11];
|
|
1103
|
+
case 10:
|
|
1104
|
+
try {
|
|
1105
|
+
if (_j && !_j.done && (_m = _h.return)) _m.call(_h);
|
|
1106
|
+
}
|
|
1107
|
+
finally { if (e_1) throw e_1.error; }
|
|
1108
|
+
return [7 /*endfinally*/];
|
|
1109
|
+
case 11:
|
|
1110
|
+
campaingnProducts.push(elegibleProducts);
|
|
1111
|
+
_o.label = 12;
|
|
1112
|
+
case 12:
|
|
1113
|
+
elegibleCampaigns_1_1 = elegibleCampaigns_1.next();
|
|
1114
|
+
return [3 /*break*/, 3];
|
|
1115
|
+
case 13: return [3 /*break*/, 16];
|
|
1116
|
+
case 14:
|
|
1117
|
+
e_2_1 = _o.sent();
|
|
1118
|
+
e_2 = { error: e_2_1 };
|
|
1119
|
+
return [3 /*break*/, 16];
|
|
1120
|
+
case 15:
|
|
1121
|
+
try {
|
|
1122
|
+
if (elegibleCampaigns_1_1 && !elegibleCampaigns_1_1.done && (_l = elegibleCampaigns_1.return)) _l.call(elegibleCampaigns_1);
|
|
1123
|
+
}
|
|
1124
|
+
finally { if (e_2) throw e_2.error; }
|
|
1125
|
+
return [7 /*endfinally*/];
|
|
1126
|
+
case 16:
|
|
1127
|
+
if (!campaingnProducts.length)
|
|
1128
|
+
return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems })];
|
|
1129
|
+
gifts = this.giftToLineItems([].concat.apply([], __spreadArray([], __read(campaingnProducts))));
|
|
1130
|
+
return [2 /*return*/, Object.assign(Object.assign({}, checkout), { lineItems: notGiftItems.concat(gifts) })];
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
}); }), 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); }));
|
|
1134
|
+
};
|
|
1135
|
+
CartService.prototype.giftToLineItems = function (items) {
|
|
1136
|
+
return items.map(function (item) {
|
|
1137
|
+
var _a;
|
|
1138
|
+
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;
|
|
1139
|
+
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];
|
|
1140
|
+
return i3.LineItem.toInstance({
|
|
1141
|
+
brand: brand,
|
|
1142
|
+
categories: categories,
|
|
1143
|
+
id: id.toString(),
|
|
1144
|
+
name: name,
|
|
1145
|
+
price: price,
|
|
1146
|
+
sku: sku,
|
|
1147
|
+
slug: slug,
|
|
1148
|
+
stock: stock,
|
|
1149
|
+
weight: weight,
|
|
1150
|
+
EAN: EAN,
|
|
1151
|
+
image: image,
|
|
1152
|
+
pricePaid: 0,
|
|
1153
|
+
quantity: 1,
|
|
1154
|
+
isGift: true,
|
|
1155
|
+
});
|
|
1156
|
+
});
|
|
1157
|
+
};
|
|
1158
|
+
return CartService;
|
|
1159
|
+
}());
|
|
1160
|
+
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: 'VariantRepository' }, { token: 'Buy2WinRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1161
|
+
CartService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService });
|
|
1162
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CartService, decorators: [{
|
|
1163
|
+
type: i0.Injectable
|
|
1164
|
+
}], ctorParameters: function () {
|
|
1165
|
+
return [{ type: AuthService }, { type: CheckoutService }, { type: i3__namespace.Shops, decorators: [{
|
|
1166
|
+
type: i0.Inject,
|
|
1167
|
+
args: [DEFAULT_SHOP]
|
|
1168
|
+
}] }, { type: undefined, decorators: [{
|
|
1169
|
+
type: i0.Inject,
|
|
1170
|
+
args: ['ProductRepository']
|
|
1171
|
+
}] }, { type: undefined, decorators: [{
|
|
1172
|
+
type: i0.Inject,
|
|
1173
|
+
args: ['VariantRepository']
|
|
1174
|
+
}] }, { type: i3__namespace.Buy2WinFirestoreRepository, decorators: [{
|
|
1175
|
+
type: i0.Inject,
|
|
1176
|
+
args: ['Buy2WinRepository']
|
|
1177
|
+
}] }];
|
|
1176
1178
|
} });
|
|
1177
1179
|
|
|
1178
|
-
var CheckoutSubscriptionService = /** @class */ (function () {
|
|
1179
|
-
function CheckoutSubscriptionService(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
1180
|
-
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
1181
|
-
this.subscriptionRepository = subscriptionRepository;
|
|
1182
|
-
this.couponService = couponService;
|
|
1183
|
-
}
|
|
1184
|
-
CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
|
|
1185
|
-
var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
|
|
1186
|
-
if (!i3.isNil(checkoutId))
|
|
1187
|
-
return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
|
|
1188
|
-
return rxjs.from(this.createCheckoutSubscription(checkoutData));
|
|
1189
|
-
};
|
|
1190
|
-
CheckoutSubscriptionService.prototype.createCheckoutSubscription = function (checkoutData) {
|
|
1191
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1192
|
-
var checkout;
|
|
1193
|
-
return __generator(this, function (_a) {
|
|
1194
|
-
switch (_a.label) {
|
|
1195
|
-
case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i3.CheckoutSubscription.toInstance(i3.pick(checkoutData, ['user', 'shop'])).toPlain()))];
|
|
1196
|
-
case 1:
|
|
1197
|
-
checkout = _a.sent();
|
|
1198
|
-
cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
|
|
1199
|
-
return [2 /*return*/, checkout];
|
|
1200
|
-
}
|
|
1201
|
-
});
|
|
1202
|
-
});
|
|
1203
|
-
};
|
|
1204
|
-
CheckoutSubscriptionService.prototype.clearCheckoutSubscriptionFromSession = function () {
|
|
1205
|
-
cookie__default["default"].remove('checkoutSubscriptionId');
|
|
1206
|
-
return rxjs.of();
|
|
1207
|
-
};
|
|
1208
|
-
CheckoutSubscriptionService.prototype.checkCoupon = function (nickname, userEmail) {
|
|
1209
|
-
var _this = this;
|
|
1210
|
-
return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService
|
|
1211
|
-
.checkCoupon(nickname, userEmail, i3.CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, checkout, true)
|
|
1212
|
-
.pipe(); }));
|
|
1213
|
-
};
|
|
1214
|
-
CheckoutSubscriptionService.prototype.calcDiscountSubscription = function (coupon) {
|
|
1215
|
-
var _this = this;
|
|
1216
|
-
return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService.calcDiscountSubscription(coupon, checkout).pipe(); }));
|
|
1217
|
-
};
|
|
1218
|
-
return CheckoutSubscriptionService;
|
|
1219
|
-
}());
|
|
1220
|
-
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 });
|
|
1221
|
-
CheckoutSubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService });
|
|
1222
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, decorators: [{
|
|
1223
|
-
type: i0.Injectable
|
|
1224
|
-
}], ctorParameters: function () {
|
|
1225
|
-
return [{ type: undefined, decorators: [{
|
|
1226
|
-
type: i0.Inject,
|
|
1227
|
-
args: ['CheckoutSubscriptionRepository']
|
|
1228
|
-
}] }, { type: undefined, decorators: [{
|
|
1229
|
-
type: i0.Inject,
|
|
1230
|
-
args: ['SubscriptionRepository']
|
|
1231
|
-
}] }, { type: CouponService }];
|
|
1180
|
+
var CheckoutSubscriptionService = /** @class */ (function () {
|
|
1181
|
+
function CheckoutSubscriptionService(checkoutSubscriptionRepository, subscriptionRepository, couponService) {
|
|
1182
|
+
this.checkoutSubscriptionRepository = checkoutSubscriptionRepository;
|
|
1183
|
+
this.subscriptionRepository = subscriptionRepository;
|
|
1184
|
+
this.couponService = couponService;
|
|
1185
|
+
}
|
|
1186
|
+
CheckoutSubscriptionService.prototype.getCheckoutSubscription = function (checkoutData) {
|
|
1187
|
+
var checkoutId = cookie__default["default"].get('checkoutSubscriptionId');
|
|
1188
|
+
if (!i3.isNil(checkoutId))
|
|
1189
|
+
return rxjs.from(this.checkoutSubscriptionRepository.get({ id: checkoutId }));
|
|
1190
|
+
return rxjs.from(this.createCheckoutSubscription(checkoutData));
|
|
1191
|
+
};
|
|
1192
|
+
CheckoutSubscriptionService.prototype.createCheckoutSubscription = function (checkoutData) {
|
|
1193
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1194
|
+
var checkout;
|
|
1195
|
+
return __generator(this, function (_a) {
|
|
1196
|
+
switch (_a.label) {
|
|
1197
|
+
case 0: return [4 /*yield*/, this.checkoutSubscriptionRepository.create(Object.assign({ createdAt: new Date() }, i3.CheckoutSubscription.toInstance(i3.pick(checkoutData, ['user', 'shop'])).toPlain()))];
|
|
1198
|
+
case 1:
|
|
1199
|
+
checkout = _a.sent();
|
|
1200
|
+
cookie__default["default"].set('checkoutSubscriptionId', checkout.id);
|
|
1201
|
+
return [2 /*return*/, checkout];
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
1204
|
+
});
|
|
1205
|
+
};
|
|
1206
|
+
CheckoutSubscriptionService.prototype.clearCheckoutSubscriptionFromSession = function () {
|
|
1207
|
+
cookie__default["default"].remove('checkoutSubscriptionId');
|
|
1208
|
+
return rxjs.of();
|
|
1209
|
+
};
|
|
1210
|
+
CheckoutSubscriptionService.prototype.checkCoupon = function (nickname, userEmail) {
|
|
1211
|
+
var _this = this;
|
|
1212
|
+
return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService
|
|
1213
|
+
.checkCoupon(nickname, userEmail, i3.CheckoutTypes.SUBSCRIPTION, checkout.subscriptionPlan.name, checkout, true)
|
|
1214
|
+
.pipe(); }));
|
|
1215
|
+
};
|
|
1216
|
+
CheckoutSubscriptionService.prototype.calcDiscountSubscription = function (coupon) {
|
|
1217
|
+
var _this = this;
|
|
1218
|
+
return this.getCheckoutSubscription().pipe(operators.concatMap(function (checkout) { return _this.couponService.calcDiscountSubscription(coupon, checkout).pipe(); }));
|
|
1219
|
+
};
|
|
1220
|
+
return CheckoutSubscriptionService;
|
|
1221
|
+
}());
|
|
1222
|
+
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 });
|
|
1223
|
+
CheckoutSubscriptionService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService });
|
|
1224
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: CheckoutSubscriptionService, decorators: [{
|
|
1225
|
+
type: i0.Injectable
|
|
1226
|
+
}], ctorParameters: function () {
|
|
1227
|
+
return [{ type: undefined, decorators: [{
|
|
1228
|
+
type: i0.Inject,
|
|
1229
|
+
args: ['CheckoutSubscriptionRepository']
|
|
1230
|
+
}] }, { type: undefined, decorators: [{
|
|
1231
|
+
type: i0.Inject,
|
|
1232
|
+
args: ['SubscriptionRepository']
|
|
1233
|
+
}] }, { type: CouponService }];
|
|
1232
1234
|
} });
|
|
1233
1235
|
|
|
1234
|
-
var HomeShopService = /** @class */ (function () {
|
|
1235
|
-
function HomeShopService(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
1236
|
-
this.categoryRepository = categoryRepository;
|
|
1237
|
-
this.homeRepository = homeRepository;
|
|
1238
|
-
this.productRepository = productRepository;
|
|
1239
|
-
this.defaultShop = defaultShop;
|
|
1240
|
-
this.buildCategoryGroupWithRequiredData = function (group) {
|
|
1241
|
-
var _a, _b;
|
|
1242
|
-
return ({
|
|
1243
|
-
category: i3.Category.toInstance(i3.pick(((_a = group === null || group === void 0 ? void 0 : group.category) === null || _a === void 0 ? void 0 : _a.toPlain()) || {}, ['id', 'name', 'slug', 'conditions'])),
|
|
1244
|
-
products: ((_b = group === null || group === void 0 ? void 0 : group.products) === null || _b === void 0 ? void 0 : _b.map(function (product) { return i3.Product.toInstance(i3.pick((product === null || product === void 0 ? void 0 : product.toPlain()) || {}, [
|
|
1245
|
-
'id',
|
|
1246
|
-
'price',
|
|
1247
|
-
'reviews',
|
|
1248
|
-
'hasVariants',
|
|
1249
|
-
'slug',
|
|
1250
|
-
'sku',
|
|
1251
|
-
'stock',
|
|
1252
|
-
'costPrice',
|
|
1253
|
-
'images',
|
|
1254
|
-
'miniatures',
|
|
1255
|
-
'name',
|
|
1256
|
-
'weight',
|
|
1257
|
-
'rate',
|
|
1258
|
-
'type',
|
|
1259
|
-
])); })) || [],
|
|
1260
|
-
});
|
|
1261
|
-
};
|
|
1262
|
-
}
|
|
1263
|
-
Object.defineProperty(HomeShopService.prototype, "homeId", {
|
|
1264
|
-
get: function () {
|
|
1265
|
-
if (this.defaultShop === i3.Shops.GLAMSHOP)
|
|
1266
|
-
return 'glamshop';
|
|
1267
|
-
if (this.defaultShop === i3.Shops.MENSMARKET)
|
|
1268
|
-
return 'mens_market';
|
|
1269
|
-
return null;
|
|
1270
|
-
},
|
|
1271
|
-
enumerable: false,
|
|
1272
|
-
configurable: true
|
|
1273
|
-
});
|
|
1274
|
-
HomeShopService.prototype.getHomeData = function () {
|
|
1275
|
-
var _this = this;
|
|
1276
|
-
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
|
|
1277
|
-
? rxjs.of(home)
|
|
1278
|
-
: rxjs.forkJoin([_this.getDiscoverProducts(), _this.getFeaturedProducts(), _this.getVerticalProducts()]).pipe(operators.map(function (_c) {
|
|
1279
|
-
var _d = __read(_c, 3), discoverProducts = _d[0], featuredProducts = _d[1], verticalProducts = _d[2];
|
|
1280
|
-
return ({
|
|
1281
|
-
discoverProducts: discoverProducts,
|
|
1282
|
-
featuredProducts: featuredProducts,
|
|
1283
|
-
verticalProducts: verticalProducts,
|
|
1284
|
-
});
|
|
1285
|
-
}), operators.concatMap(function (data) { return _this.saveHomeData(data); })); }));
|
|
1286
|
-
};
|
|
1287
|
-
HomeShopService.prototype.getBanners = function (type) {
|
|
1288
|
-
return this.getHomeConfiguration().pipe(operators.map(function (home) {
|
|
1289
|
-
if (type === 'brand')
|
|
1290
|
-
return home.brandsCarousel;
|
|
1291
|
-
if (type === 'buyToWin')
|
|
1292
|
-
return [home.buyToWinBanner];
|
|
1293
|
-
if (type === 'block')
|
|
1294
|
-
return home.blockBanners;
|
|
1295
|
-
if (type === 'blog')
|
|
1296
|
-
return [home.blogBanner];
|
|
1297
|
-
}));
|
|
1298
|
-
};
|
|
1299
|
-
HomeShopService.prototype.getMinValueForFreeShipping = function () {
|
|
1300
|
-
return this.getHomeConfiguration().pipe(operators.map(function (home) { return home.minValueForFreeShipping; }));
|
|
1301
|
-
};
|
|
1302
|
-
HomeShopService.prototype.getDiscoverProducts = function () {
|
|
1303
|
-
var _this = this;
|
|
1304
|
-
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); })); }));
|
|
1305
|
-
};
|
|
1306
|
-
HomeShopService.prototype.getFeaturedProducts = function () {
|
|
1307
|
-
var _this = this;
|
|
1308
|
-
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); })); }));
|
|
1309
|
-
};
|
|
1310
|
-
HomeShopService.prototype.getVerticalProducts = function () {
|
|
1311
|
-
var _this = this;
|
|
1312
|
-
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({
|
|
1313
|
-
filters: { categories: { operator: i3.Where.IN, value: [category.id] } },
|
|
1314
|
-
limits: { limit: 12 },
|
|
1315
|
-
})).pipe(operators.map(function (products) { return ({ category: category, products: products }); })); }), operators.map(function (_c) {
|
|
1316
|
-
var category = _c.category, products = _c.products;
|
|
1317
|
-
return ({ category: category, products: products.data });
|
|
1318
|
-
}), operators.map(_this.buildCategoryGroupWithRequiredData)); })); }));
|
|
1319
|
-
};
|
|
1320
|
-
HomeShopService.prototype.getHomeConfiguration = function () {
|
|
1321
|
-
var _this = this;
|
|
1322
|
-
return rxjs.of(this.homeConfiguration).pipe(operators.concatMap(function (home) { return home
|
|
1323
|
-
? rxjs.of(home)
|
|
1324
|
-
: !_this.homeId
|
|
1325
|
-
? rxjs.throwError(new i3.RequiredArgumentError(['homeId']))
|
|
1326
|
-
: rxjs.from(_this.homeRepository.get({ id: _this.homeId })).pipe(operators.tap(function (homeLoaded) { return (_this.homeConfiguration = homeLoaded); })); }));
|
|
1327
|
-
};
|
|
1328
|
-
HomeShopService.prototype.saveHomeData = function (homeData) {
|
|
1329
|
-
var _this = this;
|
|
1330
|
-
var data = {
|
|
1331
|
-
createdAt: new Date(),
|
|
1332
|
-
expiresAt: i3.add(new Date(), { hours: 1 }),
|
|
1333
|
-
data: homeData,
|
|
1334
|
-
};
|
|
1335
|
-
return rxjs.from(this.homeRepository.update({
|
|
1336
|
-
id: this.homeId,
|
|
1337
|
-
data: data,
|
|
1338
|
-
})).pipe(operators.tap(function () { return (_this.homeConfiguration.data = data); }), operators.map(function () { return _this.homeConfiguration; }));
|
|
1339
|
-
};
|
|
1340
|
-
return HomeShopService;
|
|
1341
|
-
}());
|
|
1342
|
-
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 });
|
|
1343
|
-
HomeShopService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService });
|
|
1344
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService, decorators: [{
|
|
1345
|
-
type: i0.Injectable
|
|
1346
|
-
}], ctorParameters: function () {
|
|
1347
|
-
return [{ type: undefined, decorators: [{
|
|
1348
|
-
type: i0.Inject,
|
|
1349
|
-
args: ['CategoryRepository']
|
|
1350
|
-
}] }, { type: undefined, decorators: [{
|
|
1351
|
-
type: i0.Inject,
|
|
1352
|
-
args: ['HomeRepository']
|
|
1353
|
-
}] }, { type: undefined, decorators: [{
|
|
1354
|
-
type: i0.Inject,
|
|
1355
|
-
args: ['ProductRepository']
|
|
1356
|
-
}] }, { type: i3__namespace.Shops, decorators: [{
|
|
1357
|
-
type: i0.Inject,
|
|
1358
|
-
args: [DEFAULT_SHOP]
|
|
1359
|
-
}] }];
|
|
1236
|
+
var HomeShopService = /** @class */ (function () {
|
|
1237
|
+
function HomeShopService(categoryRepository, homeRepository, productRepository, defaultShop) {
|
|
1238
|
+
this.categoryRepository = categoryRepository;
|
|
1239
|
+
this.homeRepository = homeRepository;
|
|
1240
|
+
this.productRepository = productRepository;
|
|
1241
|
+
this.defaultShop = defaultShop;
|
|
1242
|
+
this.buildCategoryGroupWithRequiredData = function (group) {
|
|
1243
|
+
var _a, _b;
|
|
1244
|
+
return ({
|
|
1245
|
+
category: i3.Category.toInstance(i3.pick(((_a = group === null || group === void 0 ? void 0 : group.category) === null || _a === void 0 ? void 0 : _a.toPlain()) || {}, ['id', 'name', 'slug', 'conditions'])),
|
|
1246
|
+
products: ((_b = group === null || group === void 0 ? void 0 : group.products) === null || _b === void 0 ? void 0 : _b.map(function (product) { return i3.Product.toInstance(i3.pick((product === null || product === void 0 ? void 0 : product.toPlain()) || {}, [
|
|
1247
|
+
'id',
|
|
1248
|
+
'price',
|
|
1249
|
+
'reviews',
|
|
1250
|
+
'hasVariants',
|
|
1251
|
+
'slug',
|
|
1252
|
+
'sku',
|
|
1253
|
+
'stock',
|
|
1254
|
+
'costPrice',
|
|
1255
|
+
'images',
|
|
1256
|
+
'miniatures',
|
|
1257
|
+
'name',
|
|
1258
|
+
'weight',
|
|
1259
|
+
'rate',
|
|
1260
|
+
'type',
|
|
1261
|
+
])); })) || [],
|
|
1262
|
+
});
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1265
|
+
Object.defineProperty(HomeShopService.prototype, "homeId", {
|
|
1266
|
+
get: function () {
|
|
1267
|
+
if (this.defaultShop === i3.Shops.GLAMSHOP)
|
|
1268
|
+
return 'glamshop';
|
|
1269
|
+
if (this.defaultShop === i3.Shops.MENSMARKET)
|
|
1270
|
+
return 'mens_market';
|
|
1271
|
+
return null;
|
|
1272
|
+
},
|
|
1273
|
+
enumerable: false,
|
|
1274
|
+
configurable: true
|
|
1275
|
+
});
|
|
1276
|
+
HomeShopService.prototype.getHomeData = function () {
|
|
1277
|
+
var _this = this;
|
|
1278
|
+
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
|
|
1279
|
+
? rxjs.of(home)
|
|
1280
|
+
: rxjs.forkJoin([_this.getDiscoverProducts(), _this.getFeaturedProducts(), _this.getVerticalProducts()]).pipe(operators.map(function (_c) {
|
|
1281
|
+
var _d = __read(_c, 3), discoverProducts = _d[0], featuredProducts = _d[1], verticalProducts = _d[2];
|
|
1282
|
+
return ({
|
|
1283
|
+
discoverProducts: discoverProducts,
|
|
1284
|
+
featuredProducts: featuredProducts,
|
|
1285
|
+
verticalProducts: verticalProducts,
|
|
1286
|
+
});
|
|
1287
|
+
}), operators.concatMap(function (data) { return _this.saveHomeData(data); })); }));
|
|
1288
|
+
};
|
|
1289
|
+
HomeShopService.prototype.getBanners = function (type) {
|
|
1290
|
+
return this.getHomeConfiguration().pipe(operators.map(function (home) {
|
|
1291
|
+
if (type === 'brand')
|
|
1292
|
+
return home.brandsCarousel;
|
|
1293
|
+
if (type === 'buyToWin')
|
|
1294
|
+
return [home.buyToWinBanner];
|
|
1295
|
+
if (type === 'block')
|
|
1296
|
+
return home.blockBanners;
|
|
1297
|
+
if (type === 'blog')
|
|
1298
|
+
return [home.blogBanner];
|
|
1299
|
+
}));
|
|
1300
|
+
};
|
|
1301
|
+
HomeShopService.prototype.getMinValueForFreeShipping = function () {
|
|
1302
|
+
return this.getHomeConfiguration().pipe(operators.map(function (home) { return home.minValueForFreeShipping; }));
|
|
1303
|
+
};
|
|
1304
|
+
HomeShopService.prototype.getDiscoverProducts = function () {
|
|
1305
|
+
var _this = this;
|
|
1306
|
+
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); })); }));
|
|
1307
|
+
};
|
|
1308
|
+
HomeShopService.prototype.getFeaturedProducts = function () {
|
|
1309
|
+
var _this = this;
|
|
1310
|
+
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); })); }));
|
|
1311
|
+
};
|
|
1312
|
+
HomeShopService.prototype.getVerticalProducts = function () {
|
|
1313
|
+
var _this = this;
|
|
1314
|
+
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({
|
|
1315
|
+
filters: { categories: { operator: i3.Where.IN, value: [category.id] } },
|
|
1316
|
+
limits: { limit: 12 },
|
|
1317
|
+
})).pipe(operators.map(function (products) { return ({ category: category, products: products }); })); }), operators.map(function (_c) {
|
|
1318
|
+
var category = _c.category, products = _c.products;
|
|
1319
|
+
return ({ category: category, products: products.data });
|
|
1320
|
+
}), operators.map(_this.buildCategoryGroupWithRequiredData)); })); }));
|
|
1321
|
+
};
|
|
1322
|
+
HomeShopService.prototype.getHomeConfiguration = function () {
|
|
1323
|
+
var _this = this;
|
|
1324
|
+
return rxjs.of(this.homeConfiguration).pipe(operators.concatMap(function (home) { return home
|
|
1325
|
+
? rxjs.of(home)
|
|
1326
|
+
: !_this.homeId
|
|
1327
|
+
? rxjs.throwError(new i3.RequiredArgumentError(['homeId']))
|
|
1328
|
+
: rxjs.from(_this.homeRepository.get({ id: _this.homeId })).pipe(operators.tap(function (homeLoaded) { return (_this.homeConfiguration = homeLoaded); })); }));
|
|
1329
|
+
};
|
|
1330
|
+
HomeShopService.prototype.saveHomeData = function (homeData) {
|
|
1331
|
+
var _this = this;
|
|
1332
|
+
var data = {
|
|
1333
|
+
createdAt: new Date(),
|
|
1334
|
+
expiresAt: i3.add(new Date(), { hours: 1 }),
|
|
1335
|
+
data: homeData,
|
|
1336
|
+
};
|
|
1337
|
+
return rxjs.from(this.homeRepository.update({
|
|
1338
|
+
id: this.homeId,
|
|
1339
|
+
data: data,
|
|
1340
|
+
})).pipe(operators.tap(function () { return (_this.homeConfiguration.data = data); }), operators.map(function () { return _this.homeConfiguration; }));
|
|
1341
|
+
};
|
|
1342
|
+
return HomeShopService;
|
|
1343
|
+
}());
|
|
1344
|
+
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 });
|
|
1345
|
+
HomeShopService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService });
|
|
1346
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: HomeShopService, decorators: [{
|
|
1347
|
+
type: i0.Injectable
|
|
1348
|
+
}], ctorParameters: function () {
|
|
1349
|
+
return [{ type: undefined, decorators: [{
|
|
1350
|
+
type: i0.Inject,
|
|
1351
|
+
args: ['CategoryRepository']
|
|
1352
|
+
}] }, { type: undefined, decorators: [{
|
|
1353
|
+
type: i0.Inject,
|
|
1354
|
+
args: ['HomeRepository']
|
|
1355
|
+
}] }, { type: undefined, decorators: [{
|
|
1356
|
+
type: i0.Inject,
|
|
1357
|
+
args: ['ProductRepository']
|
|
1358
|
+
}] }, { type: i3__namespace.Shops, decorators: [{
|
|
1359
|
+
type: i0.Inject,
|
|
1360
|
+
args: [DEFAULT_SHOP]
|
|
1361
|
+
}] }];
|
|
1360
1362
|
} });
|
|
1361
1363
|
|
|
1362
|
-
var OrderService = /** @class */ (function () {
|
|
1363
|
-
function OrderService(angularFirestore, orderRepository) {
|
|
1364
|
-
this.angularFirestore = angularFirestore;
|
|
1365
|
-
this.orderRepository = orderRepository;
|
|
1366
|
-
this.orderSubject = new rxjs.Subject();
|
|
1367
|
-
}
|
|
1368
|
-
OrderService.prototype.getOrder = function (id) {
|
|
1369
|
-
var _this = this;
|
|
1370
|
-
this.angularFirestore
|
|
1371
|
-
.doc(this.orderRepository.collectionName + "/" + id)
|
|
1372
|
-
.valueChanges()
|
|
1373
|
-
.pipe(operators.map(function (doc) { return i3.Order.toInstance(doc); }))
|
|
1374
|
-
.subscribe(function (doc) { return _this.orderSubject.next(doc); });
|
|
1375
|
-
return this.orderSubject;
|
|
1376
|
-
};
|
|
1377
|
-
return OrderService;
|
|
1378
|
-
}());
|
|
1379
|
-
OrderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, deps: [{ token: i1__namespace$1.AngularFirestore }, { token: 'OrderRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1380
|
-
OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
|
|
1381
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
|
|
1382
|
-
type: i0.Injectable
|
|
1383
|
-
}], ctorParameters: function () {
|
|
1384
|
-
return [{ type: i1__namespace$1.AngularFirestore }, { type: i3__namespace.OrderFirestoreRepository, decorators: [{
|
|
1385
|
-
type: i0.Inject,
|
|
1386
|
-
args: ['OrderRepository']
|
|
1387
|
-
}] }];
|
|
1364
|
+
var OrderService = /** @class */ (function () {
|
|
1365
|
+
function OrderService(angularFirestore, orderRepository) {
|
|
1366
|
+
this.angularFirestore = angularFirestore;
|
|
1367
|
+
this.orderRepository = orderRepository;
|
|
1368
|
+
this.orderSubject = new rxjs.Subject();
|
|
1369
|
+
}
|
|
1370
|
+
OrderService.prototype.getOrder = function (id) {
|
|
1371
|
+
var _this = this;
|
|
1372
|
+
this.angularFirestore
|
|
1373
|
+
.doc(this.orderRepository.collectionName + "/" + id)
|
|
1374
|
+
.valueChanges()
|
|
1375
|
+
.pipe(operators.map(function (doc) { return i3.Order.toInstance(doc); }))
|
|
1376
|
+
.subscribe(function (doc) { return _this.orderSubject.next(doc); });
|
|
1377
|
+
return this.orderSubject;
|
|
1378
|
+
};
|
|
1379
|
+
return OrderService;
|
|
1380
|
+
}());
|
|
1381
|
+
OrderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, deps: [{ token: i1__namespace$1.AngularFirestore }, { token: 'OrderRepository' }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1382
|
+
OrderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService });
|
|
1383
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: OrderService, decorators: [{
|
|
1384
|
+
type: i0.Injectable
|
|
1385
|
+
}], ctorParameters: function () {
|
|
1386
|
+
return [{ type: i1__namespace$1.AngularFirestore }, { type: i3__namespace.OrderFirestoreRepository, decorators: [{
|
|
1387
|
+
type: i0.Inject,
|
|
1388
|
+
args: ['OrderRepository']
|
|
1389
|
+
}] }];
|
|
1388
1390
|
} });
|
|
1389
1391
|
|
|
1390
|
-
var ShippingService = /** @class */ (function () {
|
|
1391
|
-
function ShippingService(http, apiUrl, homeService) {
|
|
1392
|
-
this.http = http;
|
|
1393
|
-
this.apiUrl = apiUrl;
|
|
1394
|
-
this.homeService = homeService;
|
|
1395
|
-
}
|
|
1396
|
-
ShippingService.prototype.getShippingMethods = function (shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
|
|
1397
|
-
var _this = this;
|
|
1398
|
-
return rxjs.combineLatest([
|
|
1399
|
-
this.homeService.getHomeData(),
|
|
1400
|
-
this.http.get(this.apiUrl + "open/checkshippingcompany?personId=" + personId + "&postalCode=" + zip + "&weightGrams=" + weightGrams),
|
|
1401
|
-
]).pipe(operators.map(function (_a) {
|
|
1402
|
-
var _b = __read(_a, 2), datas = _b[0], shippingMethodsResponse = _b[1];
|
|
1403
|
-
var shippingMethods = shippingMethodsResponse.result;
|
|
1404
|
-
if (!shippingMethods.length)
|
|
1405
|
-
return [];
|
|
1406
|
-
shippingMethods = shippingMethods.map(function (s) {
|
|
1407
|
-
if (s.ShippingCompanyName == 'Same Day EG')
|
|
1408
|
-
s.ShippingCompanyName = 'Same Day';
|
|
1409
|
-
else
|
|
1410
|
-
return s;
|
|
1411
|
-
});
|
|
1412
|
-
var datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
|
|
1413
|
-
if (_this.isHolidays(datasSameDayNotAvaliable)) {
|
|
1414
|
-
shippingMethods = shippingMethods.filter(function (method) { return method.serviceName !== 'Same Day'; });
|
|
1415
|
-
}
|
|
1416
|
-
if (totalPrice >= 200) {
|
|
1417
|
-
shippingMethods = shippingMethods.map(function (s) {
|
|
1418
|
-
if (s.serviceName !== 'Same Day')
|
|
1419
|
-
return Object.assign(Object.assign({}, s), { totalPrice: 0 });
|
|
1420
|
-
else
|
|
1421
|
-
return s;
|
|
1422
|
-
});
|
|
1423
|
-
}
|
|
1424
|
-
if (shop == i3.Shops.GLAMSHOP)
|
|
1425
|
-
return shippingMethods;
|
|
1426
|
-
if (_this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
|
|
1427
|
-
shippingMethods = shippingMethods.map(function (s) {
|
|
1428
|
-
if (s.serviceName == 'Same Day')
|
|
1429
|
-
return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
|
|
1430
|
-
else
|
|
1431
|
-
return Object.assign(Object.assign({}, s), { totalPrice: 0 });
|
|
1432
|
-
});
|
|
1433
|
-
}
|
|
1434
|
-
if (_this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
|
|
1435
|
-
shippingMethods = shippingMethods.map(function (s) {
|
|
1436
|
-
return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
|
|
1437
|
-
});
|
|
1438
|
-
}
|
|
1439
|
-
return shippingMethods;
|
|
1440
|
-
}));
|
|
1441
|
-
};
|
|
1442
|
-
ShippingService.prototype.isFreeShippingBySubscription = function (shop, subscriptionPlan) {
|
|
1443
|
-
if (!subscriptionPlan)
|
|
1444
|
-
return false;
|
|
1445
|
-
if (shop == i3.Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
|
|
1446
|
-
return true;
|
|
1447
|
-
}
|
|
1448
|
-
return false;
|
|
1449
|
-
};
|
|
1450
|
-
ShippingService.prototype.isHalfShippingBySubscription = function (shop, subscriptionPlan) {
|
|
1451
|
-
if (!subscriptionPlan)
|
|
1452
|
-
return false;
|
|
1453
|
-
if (shop == i3.Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
|
|
1454
|
-
return true;
|
|
1455
|
-
}
|
|
1456
|
-
return false;
|
|
1457
|
-
};
|
|
1458
|
-
ShippingService.prototype.isHolidays = function (datas) {
|
|
1459
|
-
var today = new Date();
|
|
1460
|
-
for (var key in datas) {
|
|
1461
|
-
var start = new Date(today.getFullYear() + "-" + datas[key].beginDate);
|
|
1462
|
-
var end = new Date(today.getFullYear() + "-" + datas[key].endDate);
|
|
1463
|
-
if (start > end)
|
|
1464
|
-
end = new Date(today.getFullYear() + 1 + "-" + datas[key].endDate);
|
|
1465
|
-
if (today >= start && today <= end)
|
|
1466
|
-
return true;
|
|
1467
|
-
}
|
|
1468
|
-
return false;
|
|
1469
|
-
};
|
|
1470
|
-
return ShippingService;
|
|
1471
|
-
}());
|
|
1472
|
-
ShippingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, deps: [{ token: i1__namespace$2.HttpClient }, { token: BACKEND_URL }, { token: HomeShopService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1473
|
-
ShippingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService });
|
|
1474
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, decorators: [{
|
|
1475
|
-
type: i0.Injectable
|
|
1476
|
-
}], ctorParameters: function () {
|
|
1477
|
-
return [{ type: i1__namespace$2.HttpClient }, { type: undefined, decorators: [{
|
|
1478
|
-
type: i0.Inject,
|
|
1479
|
-
args: [BACKEND_URL]
|
|
1480
|
-
}] }, { type: HomeShopService }];
|
|
1392
|
+
var ShippingService = /** @class */ (function () {
|
|
1393
|
+
function ShippingService(http, apiUrl, homeService) {
|
|
1394
|
+
this.http = http;
|
|
1395
|
+
this.apiUrl = apiUrl;
|
|
1396
|
+
this.homeService = homeService;
|
|
1397
|
+
}
|
|
1398
|
+
ShippingService.prototype.getShippingMethods = function (shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
|
|
1399
|
+
var _this = this;
|
|
1400
|
+
return rxjs.combineLatest([
|
|
1401
|
+
this.homeService.getHomeData(),
|
|
1402
|
+
this.http.get(this.apiUrl + "open/checkshippingcompany?personId=" + personId + "&postalCode=" + zip + "&weightGrams=" + weightGrams),
|
|
1403
|
+
]).pipe(operators.map(function (_a) {
|
|
1404
|
+
var _b = __read(_a, 2), datas = _b[0], shippingMethodsResponse = _b[1];
|
|
1405
|
+
var shippingMethods = shippingMethodsResponse.result;
|
|
1406
|
+
if (!shippingMethods.length)
|
|
1407
|
+
return [];
|
|
1408
|
+
shippingMethods = shippingMethods.map(function (s) {
|
|
1409
|
+
if (s.ShippingCompanyName == 'Same Day EG')
|
|
1410
|
+
s.ShippingCompanyName = 'Same Day';
|
|
1411
|
+
else
|
|
1412
|
+
return s;
|
|
1413
|
+
});
|
|
1414
|
+
var datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
|
|
1415
|
+
if (_this.isHolidays(datasSameDayNotAvaliable)) {
|
|
1416
|
+
shippingMethods = shippingMethods.filter(function (method) { return method.serviceName !== 'Same Day'; });
|
|
1417
|
+
}
|
|
1418
|
+
if (totalPrice >= 200) {
|
|
1419
|
+
shippingMethods = shippingMethods.map(function (s) {
|
|
1420
|
+
if (s.serviceName !== 'Same Day')
|
|
1421
|
+
return Object.assign(Object.assign({}, s), { totalPrice: 0 });
|
|
1422
|
+
else
|
|
1423
|
+
return s;
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
if (shop == i3.Shops.GLAMSHOP)
|
|
1427
|
+
return shippingMethods;
|
|
1428
|
+
if (_this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
|
|
1429
|
+
shippingMethods = shippingMethods.map(function (s) {
|
|
1430
|
+
if (s.serviceName == 'Same Day')
|
|
1431
|
+
return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
|
|
1432
|
+
else
|
|
1433
|
+
return Object.assign(Object.assign({}, s), { totalPrice: 0 });
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
if (_this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
|
|
1437
|
+
shippingMethods = shippingMethods.map(function (s) {
|
|
1438
|
+
return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
return shippingMethods;
|
|
1442
|
+
}));
|
|
1443
|
+
};
|
|
1444
|
+
ShippingService.prototype.isFreeShippingBySubscription = function (shop, subscriptionPlan) {
|
|
1445
|
+
if (!subscriptionPlan)
|
|
1446
|
+
return false;
|
|
1447
|
+
if (shop == i3.Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
|
|
1448
|
+
return true;
|
|
1449
|
+
}
|
|
1450
|
+
return false;
|
|
1451
|
+
};
|
|
1452
|
+
ShippingService.prototype.isHalfShippingBySubscription = function (shop, subscriptionPlan) {
|
|
1453
|
+
if (!subscriptionPlan)
|
|
1454
|
+
return false;
|
|
1455
|
+
if (shop == i3.Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
|
|
1456
|
+
return true;
|
|
1457
|
+
}
|
|
1458
|
+
return false;
|
|
1459
|
+
};
|
|
1460
|
+
ShippingService.prototype.isHolidays = function (datas) {
|
|
1461
|
+
var today = new Date();
|
|
1462
|
+
for (var key in datas) {
|
|
1463
|
+
var start = new Date(today.getFullYear() + "-" + datas[key].beginDate);
|
|
1464
|
+
var end = new Date(today.getFullYear() + "-" + datas[key].endDate);
|
|
1465
|
+
if (start > end)
|
|
1466
|
+
end = new Date(today.getFullYear() + 1 + "-" + datas[key].endDate);
|
|
1467
|
+
if (today >= start && today <= end)
|
|
1468
|
+
return true;
|
|
1469
|
+
}
|
|
1470
|
+
return false;
|
|
1471
|
+
};
|
|
1472
|
+
return ShippingService;
|
|
1473
|
+
}());
|
|
1474
|
+
ShippingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, deps: [{ token: i1__namespace$2.HttpClient }, { token: BACKEND_URL }, { token: HomeShopService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1475
|
+
ShippingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService });
|
|
1476
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, decorators: [{
|
|
1477
|
+
type: i0.Injectable
|
|
1478
|
+
}], ctorParameters: function () {
|
|
1479
|
+
return [{ type: i1__namespace$2.HttpClient }, { type: undefined, decorators: [{
|
|
1480
|
+
type: i0.Inject,
|
|
1481
|
+
args: [BACKEND_URL]
|
|
1482
|
+
}] }, { type: HomeShopService }];
|
|
1481
1483
|
} });
|
|
1482
1484
|
|
|
1483
|
-
var AngularFirebaseAuthModule = /** @class */ (function () {
|
|
1484
|
-
function AngularFirebaseAuthModule() {
|
|
1485
|
-
}
|
|
1486
|
-
AngularFirebaseAuthModule.initializeApp = function (options, nameOrConfig) {
|
|
1487
|
-
return {
|
|
1488
|
-
ngModule: AngularFirebaseAuthModule,
|
|
1489
|
-
providers: [
|
|
1490
|
-
{ provide: fire.FIREBASE_OPTIONS, useValue: options },
|
|
1491
|
-
{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
1492
|
-
],
|
|
1493
|
-
};
|
|
1494
|
-
};
|
|
1495
|
-
return AngularFirebaseAuthModule;
|
|
1496
|
-
}());
|
|
1497
|
-
AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1498
|
-
AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [fire.AngularFireModule] });
|
|
1499
|
-
AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
|
|
1500
|
-
{
|
|
1501
|
-
provide: 'Authentication',
|
|
1502
|
-
useFactory: function (authenticationService, userRepository) {
|
|
1503
|
-
return new i3.Authentication(authenticationService, userRepository);
|
|
1504
|
-
},
|
|
1505
|
-
deps: ['AuthenticationService', 'UserRepository'],
|
|
1506
|
-
},
|
|
1507
|
-
{
|
|
1508
|
-
provide: 'AuthenticationService',
|
|
1509
|
-
useFactory: function (angularFireAuth) {
|
|
1510
|
-
return new i3.AuthenticationFirebaseAuthService(angularFireAuth);
|
|
1511
|
-
},
|
|
1512
|
-
deps: [i1.AngularFireAuth],
|
|
1513
|
-
},
|
|
1514
|
-
{
|
|
1515
|
-
provide: 'Register',
|
|
1516
|
-
useFactory: function (registerService, userRepository) {
|
|
1517
|
-
return new i3.Register(registerService, userRepository);
|
|
1518
|
-
},
|
|
1519
|
-
deps: ['RegisterService', 'UserRepository'],
|
|
1520
|
-
},
|
|
1521
|
-
{
|
|
1522
|
-
provide: 'RegisterService',
|
|
1523
|
-
useFactory: function (angularFireAuth) {
|
|
1524
|
-
return new i3.RegisterFirebaseAuthService(angularFireAuth);
|
|
1525
|
-
},
|
|
1526
|
-
deps: [i1.AngularFireAuth],
|
|
1527
|
-
},
|
|
1528
|
-
{
|
|
1529
|
-
provide: 'SignOut',
|
|
1530
|
-
useFactory: function (authenticationService) {
|
|
1531
|
-
return new i3.SignOut(authenticationService);
|
|
1532
|
-
},
|
|
1533
|
-
deps: ['AuthenticationService'],
|
|
1534
|
-
},
|
|
1535
|
-
{
|
|
1536
|
-
provide: 'RecoveryPassword',
|
|
1537
|
-
useFactory: function (authenticationService) {
|
|
1538
|
-
return new i3.RecoveryPassword(authenticationService);
|
|
1539
|
-
},
|
|
1540
|
-
deps: ['AuthenticationService'],
|
|
1541
|
-
},
|
|
1542
|
-
], imports: [[fire.AngularFireModule]] });
|
|
1543
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
|
|
1544
|
-
type: i0.NgModule,
|
|
1545
|
-
args: [{
|
|
1546
|
-
imports: [fire.AngularFireModule],
|
|
1547
|
-
providers: [
|
|
1548
|
-
{
|
|
1549
|
-
provide: 'Authentication',
|
|
1550
|
-
useFactory: function (authenticationService, userRepository) {
|
|
1551
|
-
return new i3.Authentication(authenticationService, userRepository);
|
|
1552
|
-
},
|
|
1553
|
-
deps: ['AuthenticationService', 'UserRepository'],
|
|
1554
|
-
},
|
|
1555
|
-
{
|
|
1556
|
-
provide: 'AuthenticationService',
|
|
1557
|
-
useFactory: function (angularFireAuth) {
|
|
1558
|
-
return new i3.AuthenticationFirebaseAuthService(angularFireAuth);
|
|
1559
|
-
},
|
|
1560
|
-
deps: [i1.AngularFireAuth],
|
|
1561
|
-
},
|
|
1562
|
-
{
|
|
1563
|
-
provide: 'Register',
|
|
1564
|
-
useFactory: function (registerService, userRepository) {
|
|
1565
|
-
return new i3.Register(registerService, userRepository);
|
|
1566
|
-
},
|
|
1567
|
-
deps: ['RegisterService', 'UserRepository'],
|
|
1568
|
-
},
|
|
1569
|
-
{
|
|
1570
|
-
provide: 'RegisterService',
|
|
1571
|
-
useFactory: function (angularFireAuth) {
|
|
1572
|
-
return new i3.RegisterFirebaseAuthService(angularFireAuth);
|
|
1573
|
-
},
|
|
1574
|
-
deps: [i1.AngularFireAuth],
|
|
1575
|
-
},
|
|
1576
|
-
{
|
|
1577
|
-
provide: 'SignOut',
|
|
1578
|
-
useFactory: function (authenticationService) {
|
|
1579
|
-
return new i3.SignOut(authenticationService);
|
|
1580
|
-
},
|
|
1581
|
-
deps: ['AuthenticationService'],
|
|
1582
|
-
},
|
|
1583
|
-
{
|
|
1584
|
-
provide: 'RecoveryPassword',
|
|
1585
|
-
useFactory: function (authenticationService) {
|
|
1586
|
-
return new i3.RecoveryPassword(authenticationService);
|
|
1587
|
-
},
|
|
1588
|
-
deps: ['AuthenticationService'],
|
|
1589
|
-
},
|
|
1590
|
-
],
|
|
1591
|
-
}]
|
|
1485
|
+
var AngularFirebaseAuthModule = /** @class */ (function () {
|
|
1486
|
+
function AngularFirebaseAuthModule() {
|
|
1487
|
+
}
|
|
1488
|
+
AngularFirebaseAuthModule.initializeApp = function (options, nameOrConfig) {
|
|
1489
|
+
return {
|
|
1490
|
+
ngModule: AngularFirebaseAuthModule,
|
|
1491
|
+
providers: [
|
|
1492
|
+
{ provide: fire.FIREBASE_OPTIONS, useValue: options },
|
|
1493
|
+
{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
1494
|
+
],
|
|
1495
|
+
};
|
|
1496
|
+
};
|
|
1497
|
+
return AngularFirebaseAuthModule;
|
|
1498
|
+
}());
|
|
1499
|
+
AngularFirebaseAuthModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1500
|
+
AngularFirebaseAuthModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, imports: [fire.AngularFireModule] });
|
|
1501
|
+
AngularFirebaseAuthModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, providers: [
|
|
1502
|
+
{
|
|
1503
|
+
provide: 'Authentication',
|
|
1504
|
+
useFactory: function (authenticationService, userRepository) {
|
|
1505
|
+
return new i3.Authentication(authenticationService, userRepository);
|
|
1506
|
+
},
|
|
1507
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
provide: 'AuthenticationService',
|
|
1511
|
+
useFactory: function (angularFireAuth) {
|
|
1512
|
+
return new i3.AuthenticationFirebaseAuthService(angularFireAuth);
|
|
1513
|
+
},
|
|
1514
|
+
deps: [i1.AngularFireAuth],
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
provide: 'Register',
|
|
1518
|
+
useFactory: function (registerService, userRepository) {
|
|
1519
|
+
return new i3.Register(registerService, userRepository);
|
|
1520
|
+
},
|
|
1521
|
+
deps: ['RegisterService', 'UserRepository'],
|
|
1522
|
+
},
|
|
1523
|
+
{
|
|
1524
|
+
provide: 'RegisterService',
|
|
1525
|
+
useFactory: function (angularFireAuth) {
|
|
1526
|
+
return new i3.RegisterFirebaseAuthService(angularFireAuth);
|
|
1527
|
+
},
|
|
1528
|
+
deps: [i1.AngularFireAuth],
|
|
1529
|
+
},
|
|
1530
|
+
{
|
|
1531
|
+
provide: 'SignOut',
|
|
1532
|
+
useFactory: function (authenticationService) {
|
|
1533
|
+
return new i3.SignOut(authenticationService);
|
|
1534
|
+
},
|
|
1535
|
+
deps: ['AuthenticationService'],
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
provide: 'RecoveryPassword',
|
|
1539
|
+
useFactory: function (authenticationService) {
|
|
1540
|
+
return new i3.RecoveryPassword(authenticationService);
|
|
1541
|
+
},
|
|
1542
|
+
deps: ['AuthenticationService'],
|
|
1543
|
+
},
|
|
1544
|
+
], imports: [[fire.AngularFireModule]] });
|
|
1545
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirebaseAuthModule, decorators: [{
|
|
1546
|
+
type: i0.NgModule,
|
|
1547
|
+
args: [{
|
|
1548
|
+
imports: [fire.AngularFireModule],
|
|
1549
|
+
providers: [
|
|
1550
|
+
{
|
|
1551
|
+
provide: 'Authentication',
|
|
1552
|
+
useFactory: function (authenticationService, userRepository) {
|
|
1553
|
+
return new i3.Authentication(authenticationService, userRepository);
|
|
1554
|
+
},
|
|
1555
|
+
deps: ['AuthenticationService', 'UserRepository'],
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
provide: 'AuthenticationService',
|
|
1559
|
+
useFactory: function (angularFireAuth) {
|
|
1560
|
+
return new i3.AuthenticationFirebaseAuthService(angularFireAuth);
|
|
1561
|
+
},
|
|
1562
|
+
deps: [i1.AngularFireAuth],
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
provide: 'Register',
|
|
1566
|
+
useFactory: function (registerService, userRepository) {
|
|
1567
|
+
return new i3.Register(registerService, userRepository);
|
|
1568
|
+
},
|
|
1569
|
+
deps: ['RegisterService', 'UserRepository'],
|
|
1570
|
+
},
|
|
1571
|
+
{
|
|
1572
|
+
provide: 'RegisterService',
|
|
1573
|
+
useFactory: function (angularFireAuth) {
|
|
1574
|
+
return new i3.RegisterFirebaseAuthService(angularFireAuth);
|
|
1575
|
+
},
|
|
1576
|
+
deps: [i1.AngularFireAuth],
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
provide: 'SignOut',
|
|
1580
|
+
useFactory: function (authenticationService) {
|
|
1581
|
+
return new i3.SignOut(authenticationService);
|
|
1582
|
+
},
|
|
1583
|
+
deps: ['AuthenticationService'],
|
|
1584
|
+
},
|
|
1585
|
+
{
|
|
1586
|
+
provide: 'RecoveryPassword',
|
|
1587
|
+
useFactory: function (authenticationService) {
|
|
1588
|
+
return new i3.RecoveryPassword(authenticationService);
|
|
1589
|
+
},
|
|
1590
|
+
deps: ['AuthenticationService'],
|
|
1591
|
+
},
|
|
1592
|
+
],
|
|
1593
|
+
}]
|
|
1592
1594
|
}] });
|
|
1593
1595
|
|
|
1594
|
-
var AngularElasticSeachModule = /** @class */ (function () {
|
|
1595
|
-
function AngularElasticSeachModule() {
|
|
1596
|
-
}
|
|
1597
|
-
AngularElasticSeachModule.initializeApp = function (options) {
|
|
1598
|
-
return {
|
|
1599
|
-
ngModule: AngularElasticSeachModule,
|
|
1600
|
-
providers: [{ provide: ES_CONFIG, useValue: options }],
|
|
1601
|
-
};
|
|
1602
|
-
};
|
|
1603
|
-
return AngularElasticSeachModule;
|
|
1604
|
-
}());
|
|
1605
|
-
AngularElasticSeachModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1606
|
-
AngularElasticSeachModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule });
|
|
1607
|
-
AngularElasticSeachModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, providers: [
|
|
1608
|
-
{
|
|
1609
|
-
provide: i3.ProductsIndex,
|
|
1610
|
-
useFactory: function (configuration) { return new i3.ProductsIndex(new i3.AxiosAdapter(configuration)); },
|
|
1611
|
-
deps: [ES_CONFIG],
|
|
1612
|
-
},
|
|
1613
|
-
] });
|
|
1614
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, decorators: [{
|
|
1615
|
-
type: i0.NgModule,
|
|
1616
|
-
args: [{
|
|
1617
|
-
providers: [
|
|
1618
|
-
{
|
|
1619
|
-
provide: i3.ProductsIndex,
|
|
1620
|
-
useFactory: function (configuration) { return new i3.ProductsIndex(new i3.AxiosAdapter(configuration)); },
|
|
1621
|
-
deps: [ES_CONFIG],
|
|
1622
|
-
},
|
|
1623
|
-
],
|
|
1624
|
-
}]
|
|
1596
|
+
var AngularElasticSeachModule = /** @class */ (function () {
|
|
1597
|
+
function AngularElasticSeachModule() {
|
|
1598
|
+
}
|
|
1599
|
+
AngularElasticSeachModule.initializeApp = function (options) {
|
|
1600
|
+
return {
|
|
1601
|
+
ngModule: AngularElasticSeachModule,
|
|
1602
|
+
providers: [{ provide: ES_CONFIG, useValue: options }],
|
|
1603
|
+
};
|
|
1604
|
+
};
|
|
1605
|
+
return AngularElasticSeachModule;
|
|
1606
|
+
}());
|
|
1607
|
+
AngularElasticSeachModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1608
|
+
AngularElasticSeachModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule });
|
|
1609
|
+
AngularElasticSeachModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, providers: [
|
|
1610
|
+
{
|
|
1611
|
+
provide: i3.ProductsIndex,
|
|
1612
|
+
useFactory: function (configuration) { return new i3.ProductsIndex(new i3.AxiosAdapter(configuration)); },
|
|
1613
|
+
deps: [ES_CONFIG],
|
|
1614
|
+
},
|
|
1615
|
+
] });
|
|
1616
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularElasticSeachModule, decorators: [{
|
|
1617
|
+
type: i0.NgModule,
|
|
1618
|
+
args: [{
|
|
1619
|
+
providers: [
|
|
1620
|
+
{
|
|
1621
|
+
provide: i3.ProductsIndex,
|
|
1622
|
+
useFactory: function (configuration) { return new i3.ProductsIndex(new i3.AxiosAdapter(configuration)); },
|
|
1623
|
+
deps: [ES_CONFIG],
|
|
1624
|
+
},
|
|
1625
|
+
],
|
|
1626
|
+
}]
|
|
1625
1627
|
}] });
|
|
1626
1628
|
|
|
1627
|
-
var AngularFirestoreModule = /** @class */ (function () {
|
|
1628
|
-
function AngularFirestoreModule() {
|
|
1629
|
-
}
|
|
1630
|
-
AngularFirestoreModule.initializeApp = function (options, nameOrConfig) {
|
|
1631
|
-
return {
|
|
1632
|
-
ngModule: AngularFirestoreModule,
|
|
1633
|
-
providers: [
|
|
1634
|
-
{ provide: fire.FIREBASE_OPTIONS, useValue: options.firebase },
|
|
1635
|
-
{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
1636
|
-
{ provide: ES_CONFIG, useValue: options.elasticSearch },
|
|
1637
|
-
],
|
|
1638
|
-
};
|
|
1639
|
-
};
|
|
1640
|
-
return AngularFirestoreModule;
|
|
1641
|
-
}());
|
|
1642
|
-
AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1643
|
-
AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, imports: [fire.AngularFireModule, AngularElasticSeachModule] });
|
|
1644
|
-
AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
|
|
1645
|
-
{
|
|
1646
|
-
provide: 'BeautyProfileRepository',
|
|
1647
|
-
useFactory: function (firestore, userRepository) {
|
|
1648
|
-
return new i3.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
1649
|
-
},
|
|
1650
|
-
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1651
|
-
},
|
|
1652
|
-
{
|
|
1653
|
-
provide: 'Buy2WinRepository',
|
|
1654
|
-
useFactory: function (firestore) {
|
|
1655
|
-
return new i3.Buy2WinFirestoreRepository(firestore.firestore);
|
|
1656
|
-
},
|
|
1657
|
-
deps: [i1$1.AngularFirestore],
|
|
1658
|
-
},
|
|
1659
|
-
{
|
|
1660
|
-
provide: i3.CategoryFirestoreRepository,
|
|
1661
|
-
useFactory: function (firestore) {
|
|
1662
|
-
return new i3.CategoryFirestoreRepository(firestore.firestore);
|
|
1663
|
-
},
|
|
1664
|
-
deps: [i1$1.AngularFirestore],
|
|
1665
|
-
},
|
|
1666
|
-
{
|
|
1667
|
-
provide: 'CheckoutRepository',
|
|
1668
|
-
useFactory: function (firestore) {
|
|
1669
|
-
return new i3.CheckoutFirestoreRepository(firestore.firestore);
|
|
1670
|
-
},
|
|
1671
|
-
deps: [i1$1.AngularFirestore],
|
|
1672
|
-
},
|
|
1673
|
-
{
|
|
1674
|
-
provide: 'CheckoutSubscriptionRepository',
|
|
1675
|
-
useFactory: function (firestore) {
|
|
1676
|
-
return new i3.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
1677
|
-
},
|
|
1678
|
-
deps: [i1$1.AngularFirestore],
|
|
1679
|
-
},
|
|
1680
|
-
{
|
|
1681
|
-
provide: 'CouponRepository',
|
|
1682
|
-
useFactory: function (firestore) {
|
|
1683
|
-
return new i3.CouponFirestoreRepository(firestore.firestore);
|
|
1684
|
-
},
|
|
1685
|
-
deps: [i1$1.AngularFirestore],
|
|
1686
|
-
},
|
|
1687
|
-
{
|
|
1688
|
-
provide: 'CampaignHashtagRepository',
|
|
1689
|
-
useFactory: function (firestore) {
|
|
1690
|
-
return new i3.CampaignHashtagFirestoreRepository(firestore.firestore);
|
|
1691
|
-
},
|
|
1692
|
-
deps: [i1$1.AngularFirestore],
|
|
1693
|
-
},
|
|
1694
|
-
{
|
|
1695
|
-
provide: 'CampaignDashboardRepository',
|
|
1696
|
-
useFactory: function (firestore) {
|
|
1697
|
-
return new i3.CampaignDashboardFirestoreRepository(firestore.firestore);
|
|
1698
|
-
},
|
|
1699
|
-
deps: [i1$1.AngularFirestore],
|
|
1700
|
-
},
|
|
1701
|
-
{
|
|
1702
|
-
provide: 'EditionRepository',
|
|
1703
|
-
useFactory: function (firestore, subscriptionRepository) {
|
|
1704
|
-
return new i3.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
1705
|
-
},
|
|
1706
|
-
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
1707
|
-
},
|
|
1708
|
-
{
|
|
1709
|
-
provide: 'HomeRepository',
|
|
1710
|
-
useFactory: function (firestore) {
|
|
1711
|
-
return new i3.HomeFirestoreRepository(firestore.firestore);
|
|
1712
|
-
},
|
|
1713
|
-
deps: [i1$1.AngularFirestore],
|
|
1714
|
-
},
|
|
1715
|
-
{
|
|
1716
|
-
provide: 'LeadRepository',
|
|
1717
|
-
useFactory: function (firestore) {
|
|
1718
|
-
return new i3.LeadFirestoreRepository(firestore.firestore);
|
|
1719
|
-
},
|
|
1720
|
-
deps: [i1$1.AngularFirestore],
|
|
1721
|
-
},
|
|
1722
|
-
{
|
|
1723
|
-
provide: 'LegacyOrderRepository',
|
|
1724
|
-
useFactory: function (firestore) {
|
|
1725
|
-
return new i3.LegacyOrderFirestoreRepository(firestore.firestore);
|
|
1726
|
-
},
|
|
1727
|
-
deps: [i1$1.AngularFirestore],
|
|
1728
|
-
},
|
|
1729
|
-
{
|
|
1730
|
-
provide: 'ShopMenuRepository',
|
|
1731
|
-
useFactory: function (firestore) {
|
|
1732
|
-
return new i3.ShopMenuFirestoreRepository(firestore.firestore);
|
|
1733
|
-
},
|
|
1734
|
-
deps: [i1$1.AngularFirestore],
|
|
1735
|
-
},
|
|
1736
|
-
{
|
|
1737
|
-
provide: 'OrderRepository',
|
|
1738
|
-
useFactory: function (firestore) {
|
|
1739
|
-
return new i3.OrderFirestoreRepository(firestore.firestore);
|
|
1740
|
-
},
|
|
1741
|
-
deps: [i1$1.AngularFirestore],
|
|
1742
|
-
},
|
|
1743
|
-
{
|
|
1744
|
-
provide: 'PaymentRepository',
|
|
1745
|
-
useFactory: function (firestore) {
|
|
1746
|
-
return new i3.PaymentFirestoreRepository(firestore.firestore);
|
|
1747
|
-
},
|
|
1748
|
-
deps: [i1$1.AngularFirestore],
|
|
1749
|
-
},
|
|
1750
|
-
{
|
|
1751
|
-
provide: i3.ProductFirestoreRepository,
|
|
1752
|
-
useFactory: function (firestore) {
|
|
1753
|
-
return new i3.ProductFirestoreRepository(firestore.firestore);
|
|
1754
|
-
},
|
|
1755
|
-
deps: [i1$1.AngularFirestore],
|
|
1756
|
-
},
|
|
1757
|
-
{
|
|
1758
|
-
provide: 'ShopSettingsRepository',
|
|
1759
|
-
useFactory: function (firestore) {
|
|
1760
|
-
return new i3.ShopSettingsFirestoreRepository(firestore.firestore);
|
|
1761
|
-
},
|
|
1762
|
-
deps: [i1$1.AngularFirestore],
|
|
1763
|
-
},
|
|
1764
|
-
{
|
|
1765
|
-
provide: 'SubscriptionPaymentRepository',
|
|
1766
|
-
useFactory: function (firestore, subscriptionRepository) {
|
|
1767
|
-
return new i3.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
1768
|
-
},
|
|
1769
|
-
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
1770
|
-
},
|
|
1771
|
-
{
|
|
1772
|
-
provide: 'SubscriptionPlanRepository',
|
|
1773
|
-
useFactory: function (firestore) {
|
|
1774
|
-
return new i3.SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
1775
|
-
},
|
|
1776
|
-
deps: [i1$1.AngularFirestore],
|
|
1777
|
-
},
|
|
1778
|
-
{
|
|
1779
|
-
provide: 'SubscriptionProductRepository',
|
|
1780
|
-
useFactory: function (firestore) {
|
|
1781
|
-
return new i3.SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
1782
|
-
},
|
|
1783
|
-
deps: [i1$1.AngularFirestore],
|
|
1784
|
-
},
|
|
1785
|
-
{
|
|
1786
|
-
provide: 'SubscriptionRepository',
|
|
1787
|
-
useFactory: function (firestore) {
|
|
1788
|
-
return new i3.SubscriptionFirestoreRepository(firestore.firestore);
|
|
1789
|
-
},
|
|
1790
|
-
deps: [i1$1.AngularFirestore],
|
|
1791
|
-
},
|
|
1792
|
-
{
|
|
1793
|
-
provide: 'UserRepository',
|
|
1794
|
-
useFactory: function (firestore) {
|
|
1795
|
-
return new i3.UserFirestoreRepository(firestore.firestore);
|
|
1796
|
-
},
|
|
1797
|
-
deps: [i1$1.AngularFirestore],
|
|
1798
|
-
},
|
|
1799
|
-
{
|
|
1800
|
-
provide: 'UserAddressRepository',
|
|
1801
|
-
useFactory: function (firestore, userRepository) {
|
|
1802
|
-
return new i3.UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
1803
|
-
},
|
|
1804
|
-
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1805
|
-
},
|
|
1806
|
-
{
|
|
1807
|
-
provide: 'UserPaymentMethodRepository',
|
|
1808
|
-
useFactory: function (firestore, userRepository) {
|
|
1809
|
-
return new i3.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
1810
|
-
},
|
|
1811
|
-
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1812
|
-
},
|
|
1813
|
-
{
|
|
1814
|
-
provide: i3.ProductVariantFirestoreRepository,
|
|
1815
|
-
useFactory: function (firestore, productRepository) {
|
|
1816
|
-
return new i3.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
1817
|
-
},
|
|
1818
|
-
deps: [i1$1.AngularFirestore, i3.ProductFirestoreRepository],
|
|
1819
|
-
},
|
|
1820
|
-
{
|
|
1821
|
-
provide: i0.APP_INITIALIZER,
|
|
1822
|
-
useFactory: function (firestore) { return function () { return firestore.firestore.settings({ ignoreUndefinedProperties: true }); }; },
|
|
1823
|
-
deps: [i1$1.AngularFirestore],
|
|
1824
|
-
multi: true,
|
|
1825
|
-
},
|
|
1826
|
-
], imports: [[fire.AngularFireModule, AngularElasticSeachModule]] });
|
|
1827
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
|
|
1828
|
-
type: i0.NgModule,
|
|
1829
|
-
args: [{
|
|
1830
|
-
imports: [fire.AngularFireModule, AngularElasticSeachModule],
|
|
1831
|
-
providers: [
|
|
1832
|
-
{
|
|
1833
|
-
provide: 'BeautyProfileRepository',
|
|
1834
|
-
useFactory: function (firestore, userRepository) {
|
|
1835
|
-
return new i3.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
1836
|
-
},
|
|
1837
|
-
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1838
|
-
},
|
|
1839
|
-
{
|
|
1840
|
-
provide: 'Buy2WinRepository',
|
|
1841
|
-
useFactory: function (firestore) {
|
|
1842
|
-
return new i3.Buy2WinFirestoreRepository(firestore.firestore);
|
|
1843
|
-
},
|
|
1844
|
-
deps: [i1$1.AngularFirestore],
|
|
1845
|
-
},
|
|
1846
|
-
{
|
|
1847
|
-
provide: i3.CategoryFirestoreRepository,
|
|
1848
|
-
useFactory: function (firestore) {
|
|
1849
|
-
return new i3.CategoryFirestoreRepository(firestore.firestore);
|
|
1850
|
-
},
|
|
1851
|
-
deps: [i1$1.AngularFirestore],
|
|
1852
|
-
},
|
|
1853
|
-
{
|
|
1854
|
-
provide: 'CheckoutRepository',
|
|
1855
|
-
useFactory: function (firestore) {
|
|
1856
|
-
return new i3.CheckoutFirestoreRepository(firestore.firestore);
|
|
1857
|
-
},
|
|
1858
|
-
deps: [i1$1.AngularFirestore],
|
|
1859
|
-
},
|
|
1860
|
-
{
|
|
1861
|
-
provide: 'CheckoutSubscriptionRepository',
|
|
1862
|
-
useFactory: function (firestore) {
|
|
1863
|
-
return new i3.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
1864
|
-
},
|
|
1865
|
-
deps: [i1$1.AngularFirestore],
|
|
1866
|
-
},
|
|
1867
|
-
{
|
|
1868
|
-
provide: 'CouponRepository',
|
|
1869
|
-
useFactory: function (firestore) {
|
|
1870
|
-
return new i3.CouponFirestoreRepository(firestore.firestore);
|
|
1871
|
-
},
|
|
1872
|
-
deps: [i1$1.AngularFirestore],
|
|
1873
|
-
},
|
|
1874
|
-
{
|
|
1875
|
-
provide: 'CampaignHashtagRepository',
|
|
1876
|
-
useFactory: function (firestore) {
|
|
1877
|
-
return new i3.CampaignHashtagFirestoreRepository(firestore.firestore);
|
|
1878
|
-
},
|
|
1879
|
-
deps: [i1$1.AngularFirestore],
|
|
1880
|
-
},
|
|
1881
|
-
{
|
|
1882
|
-
provide: 'CampaignDashboardRepository',
|
|
1883
|
-
useFactory: function (firestore) {
|
|
1884
|
-
return new i3.CampaignDashboardFirestoreRepository(firestore.firestore);
|
|
1885
|
-
},
|
|
1886
|
-
deps: [i1$1.AngularFirestore],
|
|
1887
|
-
},
|
|
1888
|
-
{
|
|
1889
|
-
provide: 'EditionRepository',
|
|
1890
|
-
useFactory: function (firestore, subscriptionRepository) {
|
|
1891
|
-
return new i3.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
1892
|
-
},
|
|
1893
|
-
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
1894
|
-
},
|
|
1895
|
-
{
|
|
1896
|
-
provide: 'HomeRepository',
|
|
1897
|
-
useFactory: function (firestore) {
|
|
1898
|
-
return new i3.HomeFirestoreRepository(firestore.firestore);
|
|
1899
|
-
},
|
|
1900
|
-
deps: [i1$1.AngularFirestore],
|
|
1901
|
-
},
|
|
1902
|
-
{
|
|
1903
|
-
provide: 'LeadRepository',
|
|
1904
|
-
useFactory: function (firestore) {
|
|
1905
|
-
return new i3.LeadFirestoreRepository(firestore.firestore);
|
|
1906
|
-
},
|
|
1907
|
-
deps: [i1$1.AngularFirestore],
|
|
1908
|
-
},
|
|
1909
|
-
{
|
|
1910
|
-
provide: 'LegacyOrderRepository',
|
|
1911
|
-
useFactory: function (firestore) {
|
|
1912
|
-
return new i3.LegacyOrderFirestoreRepository(firestore.firestore);
|
|
1913
|
-
},
|
|
1914
|
-
deps: [i1$1.AngularFirestore],
|
|
1915
|
-
},
|
|
1916
|
-
{
|
|
1917
|
-
provide: 'ShopMenuRepository',
|
|
1918
|
-
useFactory: function (firestore) {
|
|
1919
|
-
return new i3.ShopMenuFirestoreRepository(firestore.firestore);
|
|
1920
|
-
},
|
|
1921
|
-
deps: [i1$1.AngularFirestore],
|
|
1922
|
-
},
|
|
1923
|
-
{
|
|
1924
|
-
provide: 'OrderRepository',
|
|
1925
|
-
useFactory: function (firestore) {
|
|
1926
|
-
return new i3.OrderFirestoreRepository(firestore.firestore);
|
|
1927
|
-
},
|
|
1928
|
-
deps: [i1$1.AngularFirestore],
|
|
1929
|
-
},
|
|
1930
|
-
{
|
|
1931
|
-
provide: 'PaymentRepository',
|
|
1932
|
-
useFactory: function (firestore) {
|
|
1933
|
-
return new i3.PaymentFirestoreRepository(firestore.firestore);
|
|
1934
|
-
},
|
|
1935
|
-
deps: [i1$1.AngularFirestore],
|
|
1936
|
-
},
|
|
1937
|
-
{
|
|
1938
|
-
provide: i3.ProductFirestoreRepository,
|
|
1939
|
-
useFactory: function (firestore) {
|
|
1940
|
-
return new i3.ProductFirestoreRepository(firestore.firestore);
|
|
1941
|
-
},
|
|
1942
|
-
deps: [i1$1.AngularFirestore],
|
|
1943
|
-
},
|
|
1944
|
-
{
|
|
1945
|
-
provide: 'ShopSettingsRepository',
|
|
1946
|
-
useFactory: function (firestore) {
|
|
1947
|
-
return new i3.ShopSettingsFirestoreRepository(firestore.firestore);
|
|
1948
|
-
},
|
|
1949
|
-
deps: [i1$1.AngularFirestore],
|
|
1950
|
-
},
|
|
1951
|
-
{
|
|
1952
|
-
provide: 'SubscriptionPaymentRepository',
|
|
1953
|
-
useFactory: function (firestore, subscriptionRepository) {
|
|
1954
|
-
return new i3.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
1955
|
-
},
|
|
1956
|
-
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
1957
|
-
},
|
|
1958
|
-
{
|
|
1959
|
-
provide: 'SubscriptionPlanRepository',
|
|
1960
|
-
useFactory: function (firestore) {
|
|
1961
|
-
return new i3.SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
1962
|
-
},
|
|
1963
|
-
deps: [i1$1.AngularFirestore],
|
|
1964
|
-
},
|
|
1965
|
-
{
|
|
1966
|
-
provide: 'SubscriptionProductRepository',
|
|
1967
|
-
useFactory: function (firestore) {
|
|
1968
|
-
return new i3.SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
1969
|
-
},
|
|
1970
|
-
deps: [i1$1.AngularFirestore],
|
|
1971
|
-
},
|
|
1972
|
-
{
|
|
1973
|
-
provide: 'SubscriptionRepository',
|
|
1974
|
-
useFactory: function (firestore) {
|
|
1975
|
-
return new i3.SubscriptionFirestoreRepository(firestore.firestore);
|
|
1976
|
-
},
|
|
1977
|
-
deps: [i1$1.AngularFirestore],
|
|
1978
|
-
},
|
|
1979
|
-
{
|
|
1980
|
-
provide: 'UserRepository',
|
|
1981
|
-
useFactory: function (firestore) {
|
|
1982
|
-
return new i3.UserFirestoreRepository(firestore.firestore);
|
|
1983
|
-
},
|
|
1984
|
-
deps: [i1$1.AngularFirestore],
|
|
1985
|
-
},
|
|
1986
|
-
{
|
|
1987
|
-
provide: 'UserAddressRepository',
|
|
1988
|
-
useFactory: function (firestore, userRepository) {
|
|
1989
|
-
return new i3.UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
1990
|
-
},
|
|
1991
|
-
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1992
|
-
},
|
|
1993
|
-
{
|
|
1994
|
-
provide: 'UserPaymentMethodRepository',
|
|
1995
|
-
useFactory: function (firestore, userRepository) {
|
|
1996
|
-
return new i3.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
1997
|
-
},
|
|
1998
|
-
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1999
|
-
},
|
|
2000
|
-
{
|
|
2001
|
-
provide: i3.ProductVariantFirestoreRepository,
|
|
2002
|
-
useFactory: function (firestore, productRepository) {
|
|
2003
|
-
return new i3.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
2004
|
-
},
|
|
2005
|
-
deps: [i1$1.AngularFirestore, i3.ProductFirestoreRepository],
|
|
2006
|
-
},
|
|
2007
|
-
{
|
|
2008
|
-
provide: i0.APP_INITIALIZER,
|
|
2009
|
-
useFactory: function (firestore) { return function () { return firestore.firestore.settings({ ignoreUndefinedProperties: true }); }; },
|
|
2010
|
-
deps: [i1$1.AngularFirestore],
|
|
2011
|
-
multi: true,
|
|
2012
|
-
},
|
|
2013
|
-
],
|
|
2014
|
-
}]
|
|
1629
|
+
var AngularFirestoreModule = /** @class */ (function () {
|
|
1630
|
+
function AngularFirestoreModule() {
|
|
1631
|
+
}
|
|
1632
|
+
AngularFirestoreModule.initializeApp = function (options, nameOrConfig) {
|
|
1633
|
+
return {
|
|
1634
|
+
ngModule: AngularFirestoreModule,
|
|
1635
|
+
providers: [
|
|
1636
|
+
{ provide: fire.FIREBASE_OPTIONS, useValue: options.firebase },
|
|
1637
|
+
{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig },
|
|
1638
|
+
{ provide: ES_CONFIG, useValue: options.elasticSearch },
|
|
1639
|
+
],
|
|
1640
|
+
};
|
|
1641
|
+
};
|
|
1642
|
+
return AngularFirestoreModule;
|
|
1643
|
+
}());
|
|
1644
|
+
AngularFirestoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1645
|
+
AngularFirestoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, imports: [fire.AngularFireModule, AngularElasticSeachModule] });
|
|
1646
|
+
AngularFirestoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, providers: [
|
|
1647
|
+
{
|
|
1648
|
+
provide: 'BeautyProfileRepository',
|
|
1649
|
+
useFactory: function (firestore, userRepository) {
|
|
1650
|
+
return new i3.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
1651
|
+
},
|
|
1652
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
provide: 'Buy2WinRepository',
|
|
1656
|
+
useFactory: function (firestore) {
|
|
1657
|
+
return new i3.Buy2WinFirestoreRepository(firestore.firestore);
|
|
1658
|
+
},
|
|
1659
|
+
deps: [i1$1.AngularFirestore],
|
|
1660
|
+
},
|
|
1661
|
+
{
|
|
1662
|
+
provide: i3.CategoryFirestoreRepository,
|
|
1663
|
+
useFactory: function (firestore) {
|
|
1664
|
+
return new i3.CategoryFirestoreRepository(firestore.firestore);
|
|
1665
|
+
},
|
|
1666
|
+
deps: [i1$1.AngularFirestore],
|
|
1667
|
+
},
|
|
1668
|
+
{
|
|
1669
|
+
provide: 'CheckoutRepository',
|
|
1670
|
+
useFactory: function (firestore) {
|
|
1671
|
+
return new i3.CheckoutFirestoreRepository(firestore.firestore);
|
|
1672
|
+
},
|
|
1673
|
+
deps: [i1$1.AngularFirestore],
|
|
1674
|
+
},
|
|
1675
|
+
{
|
|
1676
|
+
provide: 'CheckoutSubscriptionRepository',
|
|
1677
|
+
useFactory: function (firestore) {
|
|
1678
|
+
return new i3.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
1679
|
+
},
|
|
1680
|
+
deps: [i1$1.AngularFirestore],
|
|
1681
|
+
},
|
|
1682
|
+
{
|
|
1683
|
+
provide: 'CouponRepository',
|
|
1684
|
+
useFactory: function (firestore) {
|
|
1685
|
+
return new i3.CouponFirestoreRepository(firestore.firestore);
|
|
1686
|
+
},
|
|
1687
|
+
deps: [i1$1.AngularFirestore],
|
|
1688
|
+
},
|
|
1689
|
+
{
|
|
1690
|
+
provide: 'CampaignHashtagRepository',
|
|
1691
|
+
useFactory: function (firestore) {
|
|
1692
|
+
return new i3.CampaignHashtagFirestoreRepository(firestore.firestore);
|
|
1693
|
+
},
|
|
1694
|
+
deps: [i1$1.AngularFirestore],
|
|
1695
|
+
},
|
|
1696
|
+
{
|
|
1697
|
+
provide: 'CampaignDashboardRepository',
|
|
1698
|
+
useFactory: function (firestore) {
|
|
1699
|
+
return new i3.CampaignDashboardFirestoreRepository(firestore.firestore);
|
|
1700
|
+
},
|
|
1701
|
+
deps: [i1$1.AngularFirestore],
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
provide: 'EditionRepository',
|
|
1705
|
+
useFactory: function (firestore, subscriptionRepository) {
|
|
1706
|
+
return new i3.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
1707
|
+
},
|
|
1708
|
+
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
1709
|
+
},
|
|
1710
|
+
{
|
|
1711
|
+
provide: 'HomeRepository',
|
|
1712
|
+
useFactory: function (firestore) {
|
|
1713
|
+
return new i3.HomeFirestoreRepository(firestore.firestore);
|
|
1714
|
+
},
|
|
1715
|
+
deps: [i1$1.AngularFirestore],
|
|
1716
|
+
},
|
|
1717
|
+
{
|
|
1718
|
+
provide: 'LeadRepository',
|
|
1719
|
+
useFactory: function (firestore) {
|
|
1720
|
+
return new i3.LeadFirestoreRepository(firestore.firestore);
|
|
1721
|
+
},
|
|
1722
|
+
deps: [i1$1.AngularFirestore],
|
|
1723
|
+
},
|
|
1724
|
+
{
|
|
1725
|
+
provide: 'LegacyOrderRepository',
|
|
1726
|
+
useFactory: function (firestore) {
|
|
1727
|
+
return new i3.LegacyOrderFirestoreRepository(firestore.firestore);
|
|
1728
|
+
},
|
|
1729
|
+
deps: [i1$1.AngularFirestore],
|
|
1730
|
+
},
|
|
1731
|
+
{
|
|
1732
|
+
provide: 'ShopMenuRepository',
|
|
1733
|
+
useFactory: function (firestore) {
|
|
1734
|
+
return new i3.ShopMenuFirestoreRepository(firestore.firestore);
|
|
1735
|
+
},
|
|
1736
|
+
deps: [i1$1.AngularFirestore],
|
|
1737
|
+
},
|
|
1738
|
+
{
|
|
1739
|
+
provide: 'OrderRepository',
|
|
1740
|
+
useFactory: function (firestore) {
|
|
1741
|
+
return new i3.OrderFirestoreRepository(firestore.firestore);
|
|
1742
|
+
},
|
|
1743
|
+
deps: [i1$1.AngularFirestore],
|
|
1744
|
+
},
|
|
1745
|
+
{
|
|
1746
|
+
provide: 'PaymentRepository',
|
|
1747
|
+
useFactory: function (firestore) {
|
|
1748
|
+
return new i3.PaymentFirestoreRepository(firestore.firestore);
|
|
1749
|
+
},
|
|
1750
|
+
deps: [i1$1.AngularFirestore],
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
provide: i3.ProductFirestoreRepository,
|
|
1754
|
+
useFactory: function (firestore) {
|
|
1755
|
+
return new i3.ProductFirestoreRepository(firestore.firestore);
|
|
1756
|
+
},
|
|
1757
|
+
deps: [i1$1.AngularFirestore],
|
|
1758
|
+
},
|
|
1759
|
+
{
|
|
1760
|
+
provide: 'ShopSettingsRepository',
|
|
1761
|
+
useFactory: function (firestore) {
|
|
1762
|
+
return new i3.ShopSettingsFirestoreRepository(firestore.firestore);
|
|
1763
|
+
},
|
|
1764
|
+
deps: [i1$1.AngularFirestore],
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
provide: 'SubscriptionPaymentRepository',
|
|
1768
|
+
useFactory: function (firestore, subscriptionRepository) {
|
|
1769
|
+
return new i3.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
1770
|
+
},
|
|
1771
|
+
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
provide: 'SubscriptionPlanRepository',
|
|
1775
|
+
useFactory: function (firestore) {
|
|
1776
|
+
return new i3.SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
1777
|
+
},
|
|
1778
|
+
deps: [i1$1.AngularFirestore],
|
|
1779
|
+
},
|
|
1780
|
+
{
|
|
1781
|
+
provide: 'SubscriptionProductRepository',
|
|
1782
|
+
useFactory: function (firestore) {
|
|
1783
|
+
return new i3.SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
1784
|
+
},
|
|
1785
|
+
deps: [i1$1.AngularFirestore],
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
provide: 'SubscriptionRepository',
|
|
1789
|
+
useFactory: function (firestore) {
|
|
1790
|
+
return new i3.SubscriptionFirestoreRepository(firestore.firestore);
|
|
1791
|
+
},
|
|
1792
|
+
deps: [i1$1.AngularFirestore],
|
|
1793
|
+
},
|
|
1794
|
+
{
|
|
1795
|
+
provide: 'UserRepository',
|
|
1796
|
+
useFactory: function (firestore) {
|
|
1797
|
+
return new i3.UserFirestoreRepository(firestore.firestore);
|
|
1798
|
+
},
|
|
1799
|
+
deps: [i1$1.AngularFirestore],
|
|
1800
|
+
},
|
|
1801
|
+
{
|
|
1802
|
+
provide: 'UserAddressRepository',
|
|
1803
|
+
useFactory: function (firestore, userRepository) {
|
|
1804
|
+
return new i3.UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
1805
|
+
},
|
|
1806
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1807
|
+
},
|
|
1808
|
+
{
|
|
1809
|
+
provide: 'UserPaymentMethodRepository',
|
|
1810
|
+
useFactory: function (firestore, userRepository) {
|
|
1811
|
+
return new i3.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
1812
|
+
},
|
|
1813
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1814
|
+
},
|
|
1815
|
+
{
|
|
1816
|
+
provide: i3.ProductVariantFirestoreRepository,
|
|
1817
|
+
useFactory: function (firestore, productRepository) {
|
|
1818
|
+
return new i3.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
1819
|
+
},
|
|
1820
|
+
deps: [i1$1.AngularFirestore, i3.ProductFirestoreRepository],
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
provide: i0.APP_INITIALIZER,
|
|
1824
|
+
useFactory: function (firestore) { return function () { return firestore.firestore.settings({ ignoreUndefinedProperties: true }); }; },
|
|
1825
|
+
deps: [i1$1.AngularFirestore],
|
|
1826
|
+
multi: true,
|
|
1827
|
+
},
|
|
1828
|
+
], imports: [[fire.AngularFireModule, AngularElasticSeachModule]] });
|
|
1829
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularFirestoreModule, decorators: [{
|
|
1830
|
+
type: i0.NgModule,
|
|
1831
|
+
args: [{
|
|
1832
|
+
imports: [fire.AngularFireModule, AngularElasticSeachModule],
|
|
1833
|
+
providers: [
|
|
1834
|
+
{
|
|
1835
|
+
provide: 'BeautyProfileRepository',
|
|
1836
|
+
useFactory: function (firestore, userRepository) {
|
|
1837
|
+
return new i3.UserBeautyProfileFirestoreRepository(firestore.firestore, userRepository);
|
|
1838
|
+
},
|
|
1839
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1840
|
+
},
|
|
1841
|
+
{
|
|
1842
|
+
provide: 'Buy2WinRepository',
|
|
1843
|
+
useFactory: function (firestore) {
|
|
1844
|
+
return new i3.Buy2WinFirestoreRepository(firestore.firestore);
|
|
1845
|
+
},
|
|
1846
|
+
deps: [i1$1.AngularFirestore],
|
|
1847
|
+
},
|
|
1848
|
+
{
|
|
1849
|
+
provide: i3.CategoryFirestoreRepository,
|
|
1850
|
+
useFactory: function (firestore) {
|
|
1851
|
+
return new i3.CategoryFirestoreRepository(firestore.firestore);
|
|
1852
|
+
},
|
|
1853
|
+
deps: [i1$1.AngularFirestore],
|
|
1854
|
+
},
|
|
1855
|
+
{
|
|
1856
|
+
provide: 'CheckoutRepository',
|
|
1857
|
+
useFactory: function (firestore) {
|
|
1858
|
+
return new i3.CheckoutFirestoreRepository(firestore.firestore);
|
|
1859
|
+
},
|
|
1860
|
+
deps: [i1$1.AngularFirestore],
|
|
1861
|
+
},
|
|
1862
|
+
{
|
|
1863
|
+
provide: 'CheckoutSubscriptionRepository',
|
|
1864
|
+
useFactory: function (firestore) {
|
|
1865
|
+
return new i3.CheckoutSubscriptionFirestoreRepository(firestore.firestore);
|
|
1866
|
+
},
|
|
1867
|
+
deps: [i1$1.AngularFirestore],
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
provide: 'CouponRepository',
|
|
1871
|
+
useFactory: function (firestore) {
|
|
1872
|
+
return new i3.CouponFirestoreRepository(firestore.firestore);
|
|
1873
|
+
},
|
|
1874
|
+
deps: [i1$1.AngularFirestore],
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
provide: 'CampaignHashtagRepository',
|
|
1878
|
+
useFactory: function (firestore) {
|
|
1879
|
+
return new i3.CampaignHashtagFirestoreRepository(firestore.firestore);
|
|
1880
|
+
},
|
|
1881
|
+
deps: [i1$1.AngularFirestore],
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
provide: 'CampaignDashboardRepository',
|
|
1885
|
+
useFactory: function (firestore) {
|
|
1886
|
+
return new i3.CampaignDashboardFirestoreRepository(firestore.firestore);
|
|
1887
|
+
},
|
|
1888
|
+
deps: [i1$1.AngularFirestore],
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
provide: 'EditionRepository',
|
|
1892
|
+
useFactory: function (firestore, subscriptionRepository) {
|
|
1893
|
+
return new i3.SubscriptionEditionFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
1894
|
+
},
|
|
1895
|
+
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
provide: 'HomeRepository',
|
|
1899
|
+
useFactory: function (firestore) {
|
|
1900
|
+
return new i3.HomeFirestoreRepository(firestore.firestore);
|
|
1901
|
+
},
|
|
1902
|
+
deps: [i1$1.AngularFirestore],
|
|
1903
|
+
},
|
|
1904
|
+
{
|
|
1905
|
+
provide: 'LeadRepository',
|
|
1906
|
+
useFactory: function (firestore) {
|
|
1907
|
+
return new i3.LeadFirestoreRepository(firestore.firestore);
|
|
1908
|
+
},
|
|
1909
|
+
deps: [i1$1.AngularFirestore],
|
|
1910
|
+
},
|
|
1911
|
+
{
|
|
1912
|
+
provide: 'LegacyOrderRepository',
|
|
1913
|
+
useFactory: function (firestore) {
|
|
1914
|
+
return new i3.LegacyOrderFirestoreRepository(firestore.firestore);
|
|
1915
|
+
},
|
|
1916
|
+
deps: [i1$1.AngularFirestore],
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
provide: 'ShopMenuRepository',
|
|
1920
|
+
useFactory: function (firestore) {
|
|
1921
|
+
return new i3.ShopMenuFirestoreRepository(firestore.firestore);
|
|
1922
|
+
},
|
|
1923
|
+
deps: [i1$1.AngularFirestore],
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
provide: 'OrderRepository',
|
|
1927
|
+
useFactory: function (firestore) {
|
|
1928
|
+
return new i3.OrderFirestoreRepository(firestore.firestore);
|
|
1929
|
+
},
|
|
1930
|
+
deps: [i1$1.AngularFirestore],
|
|
1931
|
+
},
|
|
1932
|
+
{
|
|
1933
|
+
provide: 'PaymentRepository',
|
|
1934
|
+
useFactory: function (firestore) {
|
|
1935
|
+
return new i3.PaymentFirestoreRepository(firestore.firestore);
|
|
1936
|
+
},
|
|
1937
|
+
deps: [i1$1.AngularFirestore],
|
|
1938
|
+
},
|
|
1939
|
+
{
|
|
1940
|
+
provide: i3.ProductFirestoreRepository,
|
|
1941
|
+
useFactory: function (firestore) {
|
|
1942
|
+
return new i3.ProductFirestoreRepository(firestore.firestore);
|
|
1943
|
+
},
|
|
1944
|
+
deps: [i1$1.AngularFirestore],
|
|
1945
|
+
},
|
|
1946
|
+
{
|
|
1947
|
+
provide: 'ShopSettingsRepository',
|
|
1948
|
+
useFactory: function (firestore) {
|
|
1949
|
+
return new i3.ShopSettingsFirestoreRepository(firestore.firestore);
|
|
1950
|
+
},
|
|
1951
|
+
deps: [i1$1.AngularFirestore],
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
provide: 'SubscriptionPaymentRepository',
|
|
1955
|
+
useFactory: function (firestore, subscriptionRepository) {
|
|
1956
|
+
return new i3.SubscriptionPaymentFirestoreRepository(firestore.firestore, subscriptionRepository);
|
|
1957
|
+
},
|
|
1958
|
+
deps: [i1$1.AngularFirestore, 'SubscriptionRepository'],
|
|
1959
|
+
},
|
|
1960
|
+
{
|
|
1961
|
+
provide: 'SubscriptionPlanRepository',
|
|
1962
|
+
useFactory: function (firestore) {
|
|
1963
|
+
return new i3.SubscriptionPlanFirestoreRepository(firestore.firestore);
|
|
1964
|
+
},
|
|
1965
|
+
deps: [i1$1.AngularFirestore],
|
|
1966
|
+
},
|
|
1967
|
+
{
|
|
1968
|
+
provide: 'SubscriptionProductRepository',
|
|
1969
|
+
useFactory: function (firestore) {
|
|
1970
|
+
return new i3.SubscriptionProductFirestoreRepository(firestore.firestore);
|
|
1971
|
+
},
|
|
1972
|
+
deps: [i1$1.AngularFirestore],
|
|
1973
|
+
},
|
|
1974
|
+
{
|
|
1975
|
+
provide: 'SubscriptionRepository',
|
|
1976
|
+
useFactory: function (firestore) {
|
|
1977
|
+
return new i3.SubscriptionFirestoreRepository(firestore.firestore);
|
|
1978
|
+
},
|
|
1979
|
+
deps: [i1$1.AngularFirestore],
|
|
1980
|
+
},
|
|
1981
|
+
{
|
|
1982
|
+
provide: 'UserRepository',
|
|
1983
|
+
useFactory: function (firestore) {
|
|
1984
|
+
return new i3.UserFirestoreRepository(firestore.firestore);
|
|
1985
|
+
},
|
|
1986
|
+
deps: [i1$1.AngularFirestore],
|
|
1987
|
+
},
|
|
1988
|
+
{
|
|
1989
|
+
provide: 'UserAddressRepository',
|
|
1990
|
+
useFactory: function (firestore, userRepository) {
|
|
1991
|
+
return new i3.UserAddressFirestoreRepository(firestore.firestore, userRepository);
|
|
1992
|
+
},
|
|
1993
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
1994
|
+
},
|
|
1995
|
+
{
|
|
1996
|
+
provide: 'UserPaymentMethodRepository',
|
|
1997
|
+
useFactory: function (firestore, userRepository) {
|
|
1998
|
+
return new i3.UserPaymentMethodFirestoreRepository(firestore.firestore, userRepository);
|
|
1999
|
+
},
|
|
2000
|
+
deps: [i1$1.AngularFirestore, 'UserRepository'],
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
provide: i3.ProductVariantFirestoreRepository,
|
|
2004
|
+
useFactory: function (firestore, productRepository) {
|
|
2005
|
+
return new i3.ProductVariantFirestoreRepository(firestore.firestore, productRepository);
|
|
2006
|
+
},
|
|
2007
|
+
deps: [i1$1.AngularFirestore, i3.ProductFirestoreRepository],
|
|
2008
|
+
},
|
|
2009
|
+
{
|
|
2010
|
+
provide: i0.APP_INITIALIZER,
|
|
2011
|
+
useFactory: function (firestore) { return function () { return firestore.firestore.settings({ ignoreUndefinedProperties: true }); }; },
|
|
2012
|
+
deps: [i1$1.AngularFirestore],
|
|
2013
|
+
multi: true,
|
|
2014
|
+
},
|
|
2015
|
+
],
|
|
2016
|
+
}]
|
|
2015
2017
|
}] });
|
|
2016
2018
|
|
|
2017
|
-
var AngularHasuraGraphQLModule = /** @class */ (function () {
|
|
2018
|
-
function AngularHasuraGraphQLModule() {
|
|
2019
|
-
}
|
|
2020
|
-
AngularHasuraGraphQLModule.initializeApp = function (options) {
|
|
2021
|
-
return {
|
|
2022
|
-
ngModule: AngularHasuraGraphQLModule,
|
|
2023
|
-
providers: [{ provide: HASURA_OPTIONS, useValue: options }],
|
|
2024
|
-
};
|
|
2025
|
-
};
|
|
2026
|
-
return AngularHasuraGraphQLModule;
|
|
2027
|
-
}());
|
|
2028
|
-
AngularHasuraGraphQLModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2029
|
-
AngularHasuraGraphQLModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule });
|
|
2030
|
-
AngularHasuraGraphQLModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, providers: [
|
|
2031
|
-
{
|
|
2032
|
-
provide: 'CategoryRepository',
|
|
2033
|
-
useExisting: i3.CategoryHasuraGraphQLRepository,
|
|
2034
|
-
},
|
|
2035
|
-
{
|
|
2036
|
-
provide: i3.CategoryHasuraGraphQLRepository,
|
|
2037
|
-
useFactory: function (options, productRepository, categoryFilterRepository) {
|
|
2038
|
-
return new i3.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository, categoryFilterRepository);
|
|
2039
|
-
},
|
|
2040
|
-
deps: [HASURA_OPTIONS, i3.ProductHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
|
|
2041
|
-
},
|
|
2042
|
-
{
|
|
2043
|
-
provide: 'ProductRepository',
|
|
2044
|
-
useExisting: i3.ProductHasuraGraphQLRepository,
|
|
2045
|
-
},
|
|
2046
|
-
{
|
|
2047
|
-
provide: i3.ProductHasuraGraphQLRepository,
|
|
2048
|
-
useFactory: function (options) {
|
|
2049
|
-
return new i3.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2050
|
-
},
|
|
2051
|
-
deps: [HASURA_OPTIONS],
|
|
2052
|
-
},
|
|
2053
|
-
{
|
|
2054
|
-
provide: 'VariantRepository',
|
|
2055
|
-
useExisting: i3.VariantHasuraGraphQLRepository,
|
|
2056
|
-
},
|
|
2057
|
-
{
|
|
2058
|
-
provide: i3.VariantHasuraGraphQLRepository,
|
|
2059
|
-
useFactory: function (options) {
|
|
2060
|
-
return new i3.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2061
|
-
},
|
|
2062
|
-
deps: [HASURA_OPTIONS],
|
|
2063
|
-
},
|
|
2064
|
-
{
|
|
2065
|
-
provide: 'CategoryFilterRepository',
|
|
2066
|
-
useExisting: i3.CategoryFilterHasuraGraphQLRepository,
|
|
2067
|
-
},
|
|
2068
|
-
{
|
|
2069
|
-
provide: i3.CategoryFilterHasuraGraphQLRepository,
|
|
2070
|
-
useFactory: function (options) {
|
|
2071
|
-
return new i3.CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2072
|
-
},
|
|
2073
|
-
deps: [HASURA_OPTIONS],
|
|
2074
|
-
},
|
|
2075
|
-
{
|
|
2076
|
-
provide: 'FilterOptionRepository',
|
|
2077
|
-
useExisting: i3.FilterOptionHasuraGraphQLRepository,
|
|
2078
|
-
},
|
|
2079
|
-
{
|
|
2080
|
-
provide: i3.FilterOptionHasuraGraphQLRepository,
|
|
2081
|
-
useFactory: function (options) {
|
|
2082
|
-
return new i3.FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2083
|
-
},
|
|
2084
|
-
deps: [HASURA_OPTIONS],
|
|
2085
|
-
},
|
|
2086
|
-
{
|
|
2087
|
-
provide: 'FilterRepository',
|
|
2088
|
-
useExisting: i3.FilterHasuraGraphQLRepository,
|
|
2089
|
-
},
|
|
2090
|
-
{
|
|
2091
|
-
provide: i3.FilterHasuraGraphQLRepository,
|
|
2092
|
-
useFactory: function (options, filterOptionRepository, categoryFilterRepository) {
|
|
2093
|
-
return new i3.FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
|
|
2094
|
-
},
|
|
2095
|
-
deps: [HASURA_OPTIONS, i3.FilterOptionHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
|
|
2096
|
-
},
|
|
2097
|
-
] });
|
|
2098
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, decorators: [{
|
|
2099
|
-
type: i0.NgModule,
|
|
2100
|
-
args: [{
|
|
2101
|
-
providers: [
|
|
2102
|
-
{
|
|
2103
|
-
provide: 'CategoryRepository',
|
|
2104
|
-
useExisting: i3.CategoryHasuraGraphQLRepository,
|
|
2105
|
-
},
|
|
2106
|
-
{
|
|
2107
|
-
provide: i3.CategoryHasuraGraphQLRepository,
|
|
2108
|
-
useFactory: function (options, productRepository, categoryFilterRepository) {
|
|
2109
|
-
return new i3.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository, categoryFilterRepository);
|
|
2110
|
-
},
|
|
2111
|
-
deps: [HASURA_OPTIONS, i3.ProductHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
|
|
2112
|
-
},
|
|
2113
|
-
{
|
|
2114
|
-
provide: 'ProductRepository',
|
|
2115
|
-
useExisting: i3.ProductHasuraGraphQLRepository,
|
|
2116
|
-
},
|
|
2117
|
-
{
|
|
2118
|
-
provide: i3.ProductHasuraGraphQLRepository,
|
|
2119
|
-
useFactory: function (options) {
|
|
2120
|
-
return new i3.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2121
|
-
},
|
|
2122
|
-
deps: [HASURA_OPTIONS],
|
|
2123
|
-
},
|
|
2124
|
-
{
|
|
2125
|
-
provide: 'VariantRepository',
|
|
2126
|
-
useExisting: i3.VariantHasuraGraphQLRepository,
|
|
2127
|
-
},
|
|
2128
|
-
{
|
|
2129
|
-
provide: i3.VariantHasuraGraphQLRepository,
|
|
2130
|
-
useFactory: function (options) {
|
|
2131
|
-
return new i3.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2132
|
-
},
|
|
2133
|
-
deps: [HASURA_OPTIONS],
|
|
2134
|
-
},
|
|
2135
|
-
{
|
|
2136
|
-
provide: 'CategoryFilterRepository',
|
|
2137
|
-
useExisting: i3.CategoryFilterHasuraGraphQLRepository,
|
|
2138
|
-
},
|
|
2139
|
-
{
|
|
2140
|
-
provide: i3.CategoryFilterHasuraGraphQLRepository,
|
|
2141
|
-
useFactory: function (options) {
|
|
2142
|
-
return new i3.CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2143
|
-
},
|
|
2144
|
-
deps: [HASURA_OPTIONS],
|
|
2145
|
-
},
|
|
2146
|
-
{
|
|
2147
|
-
provide: 'FilterOptionRepository',
|
|
2148
|
-
useExisting: i3.FilterOptionHasuraGraphQLRepository,
|
|
2149
|
-
},
|
|
2150
|
-
{
|
|
2151
|
-
provide: i3.FilterOptionHasuraGraphQLRepository,
|
|
2152
|
-
useFactory: function (options) {
|
|
2153
|
-
return new i3.FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2154
|
-
},
|
|
2155
|
-
deps: [HASURA_OPTIONS],
|
|
2156
|
-
},
|
|
2157
|
-
{
|
|
2158
|
-
provide: 'FilterRepository',
|
|
2159
|
-
useExisting: i3.FilterHasuraGraphQLRepository,
|
|
2160
|
-
},
|
|
2161
|
-
{
|
|
2162
|
-
provide: i3.FilterHasuraGraphQLRepository,
|
|
2163
|
-
useFactory: function (options, filterOptionRepository, categoryFilterRepository) {
|
|
2164
|
-
return new i3.FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
|
|
2165
|
-
},
|
|
2166
|
-
deps: [HASURA_OPTIONS, i3.FilterOptionHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
|
|
2167
|
-
},
|
|
2168
|
-
],
|
|
2169
|
-
}]
|
|
2019
|
+
var AngularHasuraGraphQLModule = /** @class */ (function () {
|
|
2020
|
+
function AngularHasuraGraphQLModule() {
|
|
2021
|
+
}
|
|
2022
|
+
AngularHasuraGraphQLModule.initializeApp = function (options) {
|
|
2023
|
+
return {
|
|
2024
|
+
ngModule: AngularHasuraGraphQLModule,
|
|
2025
|
+
providers: [{ provide: HASURA_OPTIONS, useValue: options }],
|
|
2026
|
+
};
|
|
2027
|
+
};
|
|
2028
|
+
return AngularHasuraGraphQLModule;
|
|
2029
|
+
}());
|
|
2030
|
+
AngularHasuraGraphQLModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2031
|
+
AngularHasuraGraphQLModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule });
|
|
2032
|
+
AngularHasuraGraphQLModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, providers: [
|
|
2033
|
+
{
|
|
2034
|
+
provide: 'CategoryRepository',
|
|
2035
|
+
useExisting: i3.CategoryHasuraGraphQLRepository,
|
|
2036
|
+
},
|
|
2037
|
+
{
|
|
2038
|
+
provide: i3.CategoryHasuraGraphQLRepository,
|
|
2039
|
+
useFactory: function (options, productRepository, categoryFilterRepository) {
|
|
2040
|
+
return new i3.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository, categoryFilterRepository);
|
|
2041
|
+
},
|
|
2042
|
+
deps: [HASURA_OPTIONS, i3.ProductHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
|
|
2043
|
+
},
|
|
2044
|
+
{
|
|
2045
|
+
provide: 'ProductRepository',
|
|
2046
|
+
useExisting: i3.ProductHasuraGraphQLRepository,
|
|
2047
|
+
},
|
|
2048
|
+
{
|
|
2049
|
+
provide: i3.ProductHasuraGraphQLRepository,
|
|
2050
|
+
useFactory: function (options) {
|
|
2051
|
+
return new i3.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2052
|
+
},
|
|
2053
|
+
deps: [HASURA_OPTIONS],
|
|
2054
|
+
},
|
|
2055
|
+
{
|
|
2056
|
+
provide: 'VariantRepository',
|
|
2057
|
+
useExisting: i3.VariantHasuraGraphQLRepository,
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
provide: i3.VariantHasuraGraphQLRepository,
|
|
2061
|
+
useFactory: function (options) {
|
|
2062
|
+
return new i3.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2063
|
+
},
|
|
2064
|
+
deps: [HASURA_OPTIONS],
|
|
2065
|
+
},
|
|
2066
|
+
{
|
|
2067
|
+
provide: 'CategoryFilterRepository',
|
|
2068
|
+
useExisting: i3.CategoryFilterHasuraGraphQLRepository,
|
|
2069
|
+
},
|
|
2070
|
+
{
|
|
2071
|
+
provide: i3.CategoryFilterHasuraGraphQLRepository,
|
|
2072
|
+
useFactory: function (options) {
|
|
2073
|
+
return new i3.CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2074
|
+
},
|
|
2075
|
+
deps: [HASURA_OPTIONS],
|
|
2076
|
+
},
|
|
2077
|
+
{
|
|
2078
|
+
provide: 'FilterOptionRepository',
|
|
2079
|
+
useExisting: i3.FilterOptionHasuraGraphQLRepository,
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
provide: i3.FilterOptionHasuraGraphQLRepository,
|
|
2083
|
+
useFactory: function (options) {
|
|
2084
|
+
return new i3.FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2085
|
+
},
|
|
2086
|
+
deps: [HASURA_OPTIONS],
|
|
2087
|
+
},
|
|
2088
|
+
{
|
|
2089
|
+
provide: 'FilterRepository',
|
|
2090
|
+
useExisting: i3.FilterHasuraGraphQLRepository,
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
provide: i3.FilterHasuraGraphQLRepository,
|
|
2094
|
+
useFactory: function (options, filterOptionRepository, categoryFilterRepository) {
|
|
2095
|
+
return new i3.FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
|
|
2096
|
+
},
|
|
2097
|
+
deps: [HASURA_OPTIONS, i3.FilterOptionHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
|
|
2098
|
+
},
|
|
2099
|
+
] });
|
|
2100
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularHasuraGraphQLModule, decorators: [{
|
|
2101
|
+
type: i0.NgModule,
|
|
2102
|
+
args: [{
|
|
2103
|
+
providers: [
|
|
2104
|
+
{
|
|
2105
|
+
provide: 'CategoryRepository',
|
|
2106
|
+
useExisting: i3.CategoryHasuraGraphQLRepository,
|
|
2107
|
+
},
|
|
2108
|
+
{
|
|
2109
|
+
provide: i3.CategoryHasuraGraphQLRepository,
|
|
2110
|
+
useFactory: function (options, productRepository, categoryFilterRepository) {
|
|
2111
|
+
return new i3.CategoryHasuraGraphQLRepository(options.endpoint, options.credentials, productRepository, categoryFilterRepository);
|
|
2112
|
+
},
|
|
2113
|
+
deps: [HASURA_OPTIONS, i3.ProductHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
|
|
2114
|
+
},
|
|
2115
|
+
{
|
|
2116
|
+
provide: 'ProductRepository',
|
|
2117
|
+
useExisting: i3.ProductHasuraGraphQLRepository,
|
|
2118
|
+
},
|
|
2119
|
+
{
|
|
2120
|
+
provide: i3.ProductHasuraGraphQLRepository,
|
|
2121
|
+
useFactory: function (options) {
|
|
2122
|
+
return new i3.ProductHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2123
|
+
},
|
|
2124
|
+
deps: [HASURA_OPTIONS],
|
|
2125
|
+
},
|
|
2126
|
+
{
|
|
2127
|
+
provide: 'VariantRepository',
|
|
2128
|
+
useExisting: i3.VariantHasuraGraphQLRepository,
|
|
2129
|
+
},
|
|
2130
|
+
{
|
|
2131
|
+
provide: i3.VariantHasuraGraphQLRepository,
|
|
2132
|
+
useFactory: function (options) {
|
|
2133
|
+
return new i3.VariantHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2134
|
+
},
|
|
2135
|
+
deps: [HASURA_OPTIONS],
|
|
2136
|
+
},
|
|
2137
|
+
{
|
|
2138
|
+
provide: 'CategoryFilterRepository',
|
|
2139
|
+
useExisting: i3.CategoryFilterHasuraGraphQLRepository,
|
|
2140
|
+
},
|
|
2141
|
+
{
|
|
2142
|
+
provide: i3.CategoryFilterHasuraGraphQLRepository,
|
|
2143
|
+
useFactory: function (options) {
|
|
2144
|
+
return new i3.CategoryFilterHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2145
|
+
},
|
|
2146
|
+
deps: [HASURA_OPTIONS],
|
|
2147
|
+
},
|
|
2148
|
+
{
|
|
2149
|
+
provide: 'FilterOptionRepository',
|
|
2150
|
+
useExisting: i3.FilterOptionHasuraGraphQLRepository,
|
|
2151
|
+
},
|
|
2152
|
+
{
|
|
2153
|
+
provide: i3.FilterOptionHasuraGraphQLRepository,
|
|
2154
|
+
useFactory: function (options) {
|
|
2155
|
+
return new i3.FilterOptionHasuraGraphQLRepository(options.endpoint, options.credentials);
|
|
2156
|
+
},
|
|
2157
|
+
deps: [HASURA_OPTIONS],
|
|
2158
|
+
},
|
|
2159
|
+
{
|
|
2160
|
+
provide: 'FilterRepository',
|
|
2161
|
+
useExisting: i3.FilterHasuraGraphQLRepository,
|
|
2162
|
+
},
|
|
2163
|
+
{
|
|
2164
|
+
provide: i3.FilterHasuraGraphQLRepository,
|
|
2165
|
+
useFactory: function (options, filterOptionRepository, categoryFilterRepository) {
|
|
2166
|
+
return new i3.FilterHasuraGraphQLRepository(options.endpoint, options.credentials, filterOptionRepository, categoryFilterRepository);
|
|
2167
|
+
},
|
|
2168
|
+
deps: [HASURA_OPTIONS, i3.FilterOptionHasuraGraphQLRepository, i3.CategoryFilterHasuraGraphQLRepository],
|
|
2169
|
+
},
|
|
2170
|
+
],
|
|
2171
|
+
}]
|
|
2170
2172
|
}] });
|
|
2171
2173
|
|
|
2172
|
-
var AngularConnectModule = /** @class */ (function () {
|
|
2173
|
-
function AngularConnectModule() {
|
|
2174
|
-
}
|
|
2175
|
-
AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
|
|
2176
|
-
return {
|
|
2177
|
-
ngModule: AngularConnectModule,
|
|
2178
|
-
providers: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((i3.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i3.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((i3.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))), __read((i3.isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]))), __read((i3.isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]))), __read((i3.isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]))),
|
|
2179
|
-
};
|
|
2180
|
-
};
|
|
2181
|
-
return AngularConnectModule;
|
|
2182
|
-
}());
|
|
2183
|
-
AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2184
|
-
AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
|
|
2185
|
-
AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [
|
|
2186
|
-
AuthService,
|
|
2187
|
-
CartService,
|
|
2188
|
-
CheckoutService,
|
|
2189
|
-
CheckoutSubscriptionService,
|
|
2190
|
-
CouponService,
|
|
2191
|
-
HomeShopService,
|
|
2192
|
-
OrderService,
|
|
2193
|
-
ShippingService,
|
|
2194
|
-
], imports: [[fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule]] });
|
|
2195
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
|
|
2196
|
-
type: i0.NgModule,
|
|
2197
|
-
args: [{
|
|
2198
|
-
imports: [fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule],
|
|
2199
|
-
providers: [
|
|
2200
|
-
AuthService,
|
|
2201
|
-
CartService,
|
|
2202
|
-
CheckoutService,
|
|
2203
|
-
CheckoutSubscriptionService,
|
|
2204
|
-
CouponService,
|
|
2205
|
-
HomeShopService,
|
|
2206
|
-
OrderService,
|
|
2207
|
-
ShippingService,
|
|
2208
|
-
],
|
|
2209
|
-
}]
|
|
2174
|
+
var AngularConnectModule = /** @class */ (function () {
|
|
2175
|
+
function AngularConnectModule() {
|
|
2176
|
+
}
|
|
2177
|
+
AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
|
|
2178
|
+
return {
|
|
2179
|
+
ngModule: AngularConnectModule,
|
|
2180
|
+
providers: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((i3.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i3.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((i3.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))), __read((i3.isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]))), __read((i3.isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]))), __read((i3.isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]))),
|
|
2181
|
+
};
|
|
2182
|
+
};
|
|
2183
|
+
return AngularConnectModule;
|
|
2184
|
+
}());
|
|
2185
|
+
AngularConnectModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
2186
|
+
AngularConnectModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, imports: [fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule] });
|
|
2187
|
+
AngularConnectModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, providers: [
|
|
2188
|
+
AuthService,
|
|
2189
|
+
CartService,
|
|
2190
|
+
CheckoutService,
|
|
2191
|
+
CheckoutSubscriptionService,
|
|
2192
|
+
CouponService,
|
|
2193
|
+
HomeShopService,
|
|
2194
|
+
OrderService,
|
|
2195
|
+
ShippingService,
|
|
2196
|
+
], imports: [[fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule]] });
|
|
2197
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: AngularConnectModule, decorators: [{
|
|
2198
|
+
type: i0.NgModule,
|
|
2199
|
+
args: [{
|
|
2200
|
+
imports: [fire.AngularFireModule, AngularFirestoreModule, AngularHasuraGraphQLModule],
|
|
2201
|
+
providers: [
|
|
2202
|
+
AuthService,
|
|
2203
|
+
CartService,
|
|
2204
|
+
CheckoutService,
|
|
2205
|
+
CheckoutSubscriptionService,
|
|
2206
|
+
CouponService,
|
|
2207
|
+
HomeShopService,
|
|
2208
|
+
OrderService,
|
|
2209
|
+
ShippingService,
|
|
2210
|
+
],
|
|
2211
|
+
}]
|
|
2210
2212
|
}] });
|
|
2211
2213
|
|
|
2212
|
-
/**
|
|
2213
|
-
* Generated bundle index. Do not edit.
|
|
2214
|
+
/**
|
|
2215
|
+
* Generated bundle index. Do not edit.
|
|
2214
2216
|
*/
|
|
2215
2217
|
|
|
2216
2218
|
exports.AngularConnectModule = AngularConnectModule;
|