@infrab4a/connect-angular 0.17.0-beta.6 → 0.17.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/angular-connect.module.d.ts.map +1 -0
- package/angular-elastic-search.module.d.ts.map +1 -0
- package/angular-firebase-auth.module.d.ts.map +1 -0
- package/angular-firestore.module.d.ts.map +1 -0
- package/bundles/infrab4a-connect-angular.umd.js +26 -7
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/consts/default-shop.const.d.ts.map +1 -0
- package/consts/es-config.const.d.ts.map +1 -0
- package/consts/index.d.ts.map +1 -0
- package/esm2015/services/coupon.service.js +16 -6
- package/fesm2015/infrab4a-connect-angular.js +15 -5
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/index.d.ts.map +1 -0
- package/infrab4a-connect-angular.d.ts.map +1 -0
- package/package.json +1 -1
- package/services/auth.service.d.ts.map +1 -0
- package/services/cart.service.d.ts.map +1 -0
- package/services/checkout-subscription.service.d.ts.map +1 -0
- package/services/checkout.service.d.ts.map +1 -0
- package/services/coupon.service.d.ts.map +1 -0
- package/services/errors/group-invalid-coupon.error.d.ts.map +1 -0
- package/services/errors/index.d.ts.map +1 -0
- package/services/errors/invalid-coupon.error.d.ts.map +1 -0
- package/services/home-shop.service.d.ts.map +1 -0
- package/services/index.d.ts.map +1 -0
- package/services/order.service.d.ts.map +1 -0
- package/services/types/index.d.ts.map +1 -0
- package/services/types/required-checkout-data.type.d.ts.map +1 -0
- package/services/types/required-checkout-subscription-data.type.d.ts.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-connect.module.d.ts","sourceRoot":"","sources":["../../projects/connect-angular/src/angular-connect.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAY,MAAM,eAAe,CAAA;AAC7D,OAAO,EACL,iBAAiB,EAGjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,wBAAwB,EAAS,KAAK,EAAE,MAAM,mBAAmB,CAAA;;;;AAc1E,qBAYa,oBAAoB;IAC/B,MAAM,CAAC,aAAa,CAClB,WAAW,EAAE,KAAK,EAClB,OAAO,EAAE;QAAE,QAAQ,EAAE,eAAe,CAAC;QAAC,aAAa,EAAE,wBAAwB,CAAA;KAAE,EAC/E,YAAY,CAAC,EAAE,MAAM,GAAG,iBAAiB,GACxC,mBAAmB,CAAC,iBAAiB,CAAC;yCAL9B,oBAAoB;0CAApB,oBAAoB;0CAApB,oBAAoB;CAgBhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-elastic-search.module.d.ts","sourceRoot":"","sources":["../../projects/connect-angular/src/angular-elastic-search.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAY,MAAM,eAAe,CAAA;AAC7D,OAAO,EAAE,wBAAwB,EAA+B,MAAM,mBAAmB,CAAA;;AAIzF,qBAWa,yBAAyB;IACpC,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,wBAAwB,GAAG,mBAAmB,CAAC,yBAAyB,CAAC;yCAD5F,yBAAyB;0CAAzB,yBAAyB;0CAAzB,yBAAyB;CAOrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-firebase-auth.module.d.ts","sourceRoot":"","sources":["../../projects/connect-angular/src/angular-firebase-auth.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAY,MAAM,eAAe,CAAA;AAC7D,OAAO,EACL,iBAAiB,EAGjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,eAAe,CAAA;;;AActB,qBA+Ca,yBAAyB;IACpC,MAAM,CAAC,aAAa,CAClB,OAAO,EAAE,eAAe,EACxB,YAAY,CAAC,EAAE,MAAM,GAAG,iBAAiB,GACxC,mBAAmB,CAAC,iBAAiB,CAAC;yCAJ9B,yBAAyB;0CAAzB,yBAAyB;0CAAzB,yBAAyB;CAarC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-firestore.module.d.ts","sourceRoot":"","sources":["../../projects/connect-angular/src/angular-firestore.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAY,MAAM,eAAe,CAAA;AAC7D,OAAO,EACL,iBAAiB,EAGjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,wBAAwB,EA8CzB,MAAM,mBAAmB,CAAA;;;;AAK1B,qBAwKa,sBAAsB;IACjC,MAAM,CAAC,aAAa,CAClB,OAAO,EAAE;QACP,QAAQ,EAAE,eAAe,CAAA;QACzB,aAAa,EAAE,wBAAwB,CAAA;KACxC,EACD,YAAY,CAAC,EAAE,MAAM,GAAG,iBAAiB,GACxC,mBAAmB,CAAC,iBAAiB,CAAC;yCAP9B,sBAAsB;0CAAtB,sBAAsB;0CAAtB,sBAAsB;CAiBlC"}
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
var cookie__default = /*#__PURE__*/_interopDefaultLegacy(cookie);
|
|
31
31
|
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
/******************************************************************************
|
|
34
34
|
Copyright (c) Microsoft Corporation.
|
|
35
35
|
|
|
36
36
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -192,7 +192,11 @@
|
|
|
192
192
|
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
193
193
|
if (k2 === undefined)
|
|
194
194
|
k2 = k;
|
|
195
|
-
Object.
|
|
195
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
196
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
197
|
+
desc = { enumerable: true, get: function () { return m[k]; } };
|
|
198
|
+
}
|
|
199
|
+
Object.defineProperty(o, k2, desc);
|
|
196
200
|
}) : (function (o, m, k, k2) {
|
|
197
201
|
if (k2 === undefined)
|
|
198
202
|
k2 = k;
|
|
@@ -346,6 +350,11 @@
|
|
|
346
350
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
347
351
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
348
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);
|
|
349
358
|
}
|
|
350
359
|
|
|
351
360
|
var AuthService = /** @class */ (function () {
|
|
@@ -450,25 +459,33 @@
|
|
|
450
459
|
};
|
|
451
460
|
CouponService.prototype.checkCouponRules = function (coupons, checkoutType, plan, checkout, isSubscription) {
|
|
452
461
|
// Caso não ache nenhum cupom, retorna erro
|
|
453
|
-
if (coupons.count < 1)
|
|
462
|
+
if (coupons.count < 1) {
|
|
463
|
+
console.log("Cupom inválido: not found");
|
|
454
464
|
return rxjs.throwError('Cupom inválido.');
|
|
465
|
+
}
|
|
455
466
|
// Get Primeiro Cupom (o find do repository retorna um array)
|
|
456
467
|
var coupon = coupons.data.shift();
|
|
457
468
|
// Verifica se o cupom é aplicavel na loja
|
|
458
469
|
var isInShop = coupon.shopAvailability === i2.Shops.ALL || coupon.shopAvailability === this.defaultShop;
|
|
459
470
|
// Cupon não aplicavel a loja retorna erro
|
|
460
|
-
if (!isInShop)
|
|
471
|
+
if (!isInShop) {
|
|
472
|
+
console.log("Cupom inválido: not in shop");
|
|
461
473
|
return rxjs.throwError('Cupom inválido.');
|
|
474
|
+
}
|
|
462
475
|
// Verifica se o coupon é aplicado no checkout que está sendo realizado
|
|
463
476
|
var isCheckoutType = coupon.checkoutType === i2.CheckoutTypes.ALL || coupon.checkoutType === checkoutType;
|
|
464
477
|
// Cupon não aplicavel ao checkout retorna erro
|
|
465
|
-
if (!isCheckoutType)
|
|
478
|
+
if (!isCheckoutType) {
|
|
479
|
+
console.log("Cupom inválido: not in checkout");
|
|
466
480
|
return rxjs.throwError('Cupom inválido.');
|
|
481
|
+
}
|
|
467
482
|
// Verifica se o cupom é ou pode ser aplicado para subscription
|
|
468
483
|
if (checkoutType === i2.CheckoutTypes.ALL || checkoutType === i2.CheckoutTypes.SUBSCRIPTION) {
|
|
469
484
|
// Se o cupom tiver um plano associado, verifica se é o mesmo plano do checkout da assinatura
|
|
470
|
-
if (coupon.plan && coupon.plan.toUpperCase() !== plan.toUpperCase())
|
|
485
|
+
if (coupon.plan && coupon.plan.toUpperCase() !== plan.toUpperCase()) {
|
|
486
|
+
console.log("Cupom inválido: not in plan");
|
|
471
487
|
return rxjs.throwError('Cupom inválido.');
|
|
488
|
+
}
|
|
472
489
|
}
|
|
473
490
|
if (isSubscription)
|
|
474
491
|
return rxjs.of(coupon);
|
|
@@ -486,8 +503,10 @@
|
|
|
486
503
|
};
|
|
487
504
|
CouponService.prototype.isValidCoupon = function (coupon, userEmail) {
|
|
488
505
|
// Verifica a data de inicio de validade do cupom
|
|
489
|
-
if ((coupon === null || coupon === void 0 ? void 0 : coupon.beginAt) > new Date())
|
|
506
|
+
if ((coupon === null || coupon === void 0 ? void 0 : coupon.beginAt) > new Date()) {
|
|
507
|
+
console.log("Cupom inválido: not valid yet");
|
|
490
508
|
throw new InvalidCouponError('Cupom inválido.');
|
|
509
|
+
}
|
|
491
510
|
// Verifica a data de validade do cupom
|
|
492
511
|
if ((coupon === null || coupon === void 0 ? void 0 : coupon.expiresIn) < new Date())
|
|
493
512
|
throw new InvalidCouponError('Cupom expirado.');
|