@infrab4a/connect-angular 3.4.0-beta.5 → 3.4.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.
@@ -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('@infrab4a/connect/src'), 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', '@infrab4a/connect/src', '@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.src, global.ng.common.http, global.ng.fire));
5
- })(this, (function (exports, i0, rxjs, operators, i1, i1$1, cookie, tsCustomError, i1$2, src, i1$3, fire) { 'use strict';
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,49 @@
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, shop, subscriptionPlan) {
1231
+ ShippingService.prototype.getShippingMethods = function (shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
1233
1232
  var _this = this;
1234
- // combineLatest([
1235
- // this.homeService.getHomeData(),
1236
- // this.http.get(`${this.apiUrl}open/checkshippingcompany?personId=${personId}&postalCode=${zip}&weightGrams=${weightGrams}`)
1237
- // ]).pipe(
1238
- // map((datas, shippings) => console.log('combineLatest', datas, shippings))
1239
- // )
1240
- return this.http.get(this.apiUrl + "open/checkshippingcompany?personId=" + personId + "&postalCode=" + zip + "&weightGrams=" + weightGrams)
1241
- .pipe(operators.map(function (data) { return data.result; }), operators.map(function (shippingMethods) { return __awaiter(_this, void 0, void 0, function () {
1242
- var shippingMethodsResponse, datas;
1243
- return __generator(this, function (_a) {
1244
- shippingMethodsResponse = shippingMethods;
1245
- console.log('shippingMethods', shippingMethods);
1246
- if (!shippingMethods.length)
1247
- return [2 /*return*/, []];
1248
- datas = [];
1249
- if (this.isHolidays(datas)) {
1250
- shippingMethodsResponse = shippingMethods.filter(function (method) { return method.ShippingCompanyName !== 'Same Day'; });
1251
- }
1252
- if (totalPrice >= 200 || this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
1253
- return [2 /*return*/, shippingMethodsResponse.map(function (s) {
1254
- if (s.serviceName !== 'Same Day')
1255
- return Object.assign(Object.assign({}, s), { totalPrice: 0 });
1256
- else
1257
- return s;
1258
- })];
1259
- }
1260
- if (this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
1261
- return [2 /*return*/, shippingMethodsResponse.map(function (s) {
1262
- if (s.serviceName !== 'Same Day')
1263
- return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
1264
- else
1265
- return s;
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
+ if (_this.isHolidays(datasSameDayNotAvaliable)) {
1244
+ shippingMethods = shippingMethods.filter(function (method) { return method.ShippingCompanyName !== 'Same Day'; });
1245
+ }
1246
+ if (totalPrice >= 200 || _this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
1247
+ return shippingMethods.map(function (s) {
1248
+ if (s.serviceName !== 'Same Day')
1249
+ return Object.assign(Object.assign({}, s), { totalPrice: 0 });
1250
+ else
1251
+ return s;
1252
+ });
1253
+ }
1254
+ if (_this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
1255
+ return shippingMethods.map(function (s) {
1256
+ if (s.serviceName !== 'Same Day')
1257
+ return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
1258
+ else
1259
+ return s;
1260
+ });
1261
+ }
1262
+ return shippingMethods;
1263
+ }));
1271
1264
  };
1272
1265
  ShippingService.prototype.isFreeShippingBySubscription = function (shop, subscriptionPlan) {
1273
1266
  if (!subscriptionPlan)
1274
1267
  return false;
1275
- if (shop == src.Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
1268
+ if (shop == i1$1.Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
1276
1269
  return true;
1277
1270
  }
1278
1271
  return false;
@@ -1280,7 +1273,10 @@
1280
1273
  ShippingService.prototype.isHalfShippingBySubscription = function (shop, subscriptionPlan) {
1281
1274
  if (!subscriptionPlan)
1282
1275
  return false;
1283
- if (shop == src.Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
1276
+ if (shop == i1$1.Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
1277
+ return true;
1278
+ }
1279
+ if (shop == i1$1.Shops.GLAMSHOP && subscriptionPlan) {
1284
1280
  return true;
1285
1281
  }
1286
1282
  return false;
@@ -1299,7 +1295,7 @@
1299
1295
  };
1300
1296
  return ShippingService;
1301
1297
  }());
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 });
1298
+ 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
1299
  ShippingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService });
1304
1300
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, decorators: [{
1305
1301
  type: i0.Injectable
@@ -1307,7 +1303,7 @@
1307
1303
  return [{ type: i1__namespace$3.HttpClient }, { type: undefined, decorators: [{
1308
1304
  type: i0.Inject,
1309
1305
  args: [API_URL]
1310
- }] }];
1306
+ }] }, { type: HomeShopService }];
1311
1307
  } });
1312
1308
 
1313
1309
  var AngularFirebaseAuthModule = /** @class */ (function () {