@infrab4a/connect-angular 3.4.0-beta.5 → 3.4.0-beta.6
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 +48 -49
- package/bundles/infrab4a-connect-angular.umd.js.map +1 -1
- package/esm2015/services/shipping.service.js +30 -28
- package/fesm2015/infrab4a-connect-angular.js +28 -29
- package/fesm2015/infrab4a-connect-angular.js.map +1 -1
- package/package.json +2 -2
- package/services/shipping.service.d.ts +6 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/fire/auth'), require('@infrab4a/connect'), require('js-cookie'), require('ts-custom-error'), require('@angular/fire/firestore'), require('@
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/fire/auth', '@infrab4a/connect', 'js-cookie', 'ts-custom-error', '@angular/fire/firestore', '@
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a["connect-angular"] = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.ng.fire.auth, global["@infrab4a/connect"], global["js-cookie"], global["ts-custom-error"], global.ng.fire.firestore, global.
|
|
5
|
-
})(this, (function (exports, i0, rxjs, operators, i1, i1$1, cookie, tsCustomError, i1$2,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/fire/auth'), require('@infrab4a/connect'), require('js-cookie'), require('ts-custom-error'), require('@angular/fire/firestore'), require('@angular/common/http'), require('@angular/fire')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@infrab4a/connect-angular', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/fire/auth', '@infrab4a/connect', 'js-cookie', 'ts-custom-error', '@angular/fire/firestore', '@angular/common/http', '@angular/fire'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.infrab4a = global.infrab4a || {}, global.infrab4a["connect-angular"] = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.ng.fire.auth, global["@infrab4a/connect"], global["js-cookie"], global["ts-custom-error"], global.ng.fire.firestore, global.ng.common.http, global.ng.fire));
|
|
5
|
+
})(this, (function (exports, i0, rxjs, operators, i1, i1$1, cookie, tsCustomError, i1$2, i1$3, fire) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -1223,56 +1223,52 @@
|
|
|
1223
1223
|
} });
|
|
1224
1224
|
|
|
1225
1225
|
var ShippingService = /** @class */ (function () {
|
|
1226
|
-
function ShippingService(http,
|
|
1227
|
-
// private homeService: HomeShopService,
|
|
1228
|
-
apiUrl) {
|
|
1226
|
+
function ShippingService(http, apiUrl, homeService) {
|
|
1229
1227
|
this.http = http;
|
|
1230
1228
|
this.apiUrl = apiUrl;
|
|
1229
|
+
this.homeService = homeService;
|
|
1231
1230
|
}
|
|
1232
|
-
ShippingService.prototype.getMensShippingMethods = function (zip, weightGrams, totalPrice, personId,
|
|
1231
|
+
ShippingService.prototype.getMensShippingMethods = function (shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
|
|
1233
1232
|
var _this = this;
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
return [2 /*return*/, shippingMethodsResponse];
|
|
1269
|
-
});
|
|
1270
|
-
}); }));
|
|
1233
|
+
return rxjs.combineLatest([
|
|
1234
|
+
this.homeService.getHomeData(),
|
|
1235
|
+
this.http.get(this.apiUrl + "open/checkshippingcompany?personId=" + personId + "&postalCode=" + zip + "&weightGrams=" + weightGrams)
|
|
1236
|
+
])
|
|
1237
|
+
.pipe(operators.map(function (_a) {
|
|
1238
|
+
var _b = __read(_a, 2), datas = _b[0], shippingMethodsResponse = _b[1];
|
|
1239
|
+
var shippingMethods = shippingMethodsResponse.result;
|
|
1240
|
+
if (!shippingMethods.length)
|
|
1241
|
+
return [];
|
|
1242
|
+
var datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
|
|
1243
|
+
console.log('params que checgou', shop, zip, weightGrams, totalPrice, personId, subscriptionPlan);
|
|
1244
|
+
console.log('shippingMethods', shippingMethods);
|
|
1245
|
+
console.log('datas isHolidays', _this.isHolidays(datasSameDayNotAvaliable));
|
|
1246
|
+
if (_this.isHolidays(datasSameDayNotAvaliable)) {
|
|
1247
|
+
shippingMethods = shippingMethods.filter(function (method) { return method.ShippingCompanyName !== 'Same Day'; });
|
|
1248
|
+
}
|
|
1249
|
+
if (totalPrice >= 200 || _this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
|
|
1250
|
+
return shippingMethods.map(function (s) {
|
|
1251
|
+
if (s.serviceName !== 'Same Day')
|
|
1252
|
+
return Object.assign(Object.assign({}, s), { totalPrice: 0 });
|
|
1253
|
+
else
|
|
1254
|
+
return s;
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
if (_this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
|
|
1258
|
+
return shippingMethods.map(function (s) {
|
|
1259
|
+
if (s.serviceName !== 'Same Day')
|
|
1260
|
+
return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
|
|
1261
|
+
else
|
|
1262
|
+
return s;
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
return shippingMethods;
|
|
1266
|
+
}));
|
|
1271
1267
|
};
|
|
1272
1268
|
ShippingService.prototype.isFreeShippingBySubscription = function (shop, subscriptionPlan) {
|
|
1273
1269
|
if (!subscriptionPlan)
|
|
1274
1270
|
return false;
|
|
1275
|
-
if (shop ==
|
|
1271
|
+
if (shop == i1$1.Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
|
|
1276
1272
|
return true;
|
|
1277
1273
|
}
|
|
1278
1274
|
return false;
|
|
@@ -1280,7 +1276,10 @@
|
|
|
1280
1276
|
ShippingService.prototype.isHalfShippingBySubscription = function (shop, subscriptionPlan) {
|
|
1281
1277
|
if (!subscriptionPlan)
|
|
1282
1278
|
return false;
|
|
1283
|
-
if (shop ==
|
|
1279
|
+
if (shop == i1$1.Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
|
|
1280
|
+
return true;
|
|
1281
|
+
}
|
|
1282
|
+
if (shop == i1$1.Shops.GLAMSHOP && subscriptionPlan) {
|
|
1284
1283
|
return true;
|
|
1285
1284
|
}
|
|
1286
1285
|
return false;
|
|
@@ -1299,7 +1298,7 @@
|
|
|
1299
1298
|
};
|
|
1300
1299
|
return ShippingService;
|
|
1301
1300
|
}());
|
|
1302
|
-
ShippingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, deps: [{ token: i1__namespace$3.HttpClient }, { token: API_URL }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1301
|
+
ShippingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, deps: [{ token: i1__namespace$3.HttpClient }, { token: API_URL }, { token: HomeShopService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1303
1302
|
ShippingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService });
|
|
1304
1303
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, decorators: [{
|
|
1305
1304
|
type: i0.Injectable
|
|
@@ -1307,7 +1306,7 @@
|
|
|
1307
1306
|
return [{ type: i1__namespace$3.HttpClient }, { type: undefined, decorators: [{
|
|
1308
1307
|
type: i0.Inject,
|
|
1309
1308
|
args: [API_URL]
|
|
1310
|
-
}] }];
|
|
1309
|
+
}] }, { type: HomeShopService }];
|
|
1311
1310
|
} });
|
|
1312
1311
|
|
|
1313
1312
|
var AngularFirebaseAuthModule = /** @class */ (function () {
|