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