@infrab4a/connect-angular 3.4.0-beta.10 → 3.4.0-beta.2

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.
@@ -11,7 +11,7 @@ export declare class AngularConnectModule {
11
11
  firebase: FirebaseOptions;
12
12
  elasticSearch: AxiosElasticSearchConfig;
13
13
  hasura: HasuraGraphQLOptions;
14
- backendUrl: string;
14
+ apiUrl: string;
15
15
  }, nameOrConfig?: string | FirebaseAppConfig): ModuleWithProviders<AngularFireModule>;
16
16
  static ɵfac: i0.ɵɵFactoryDeclaration<AngularConnectModule, never>;
17
17
  static ɵmod: i0.ɵɵNgModuleDeclaration<AngularConnectModule, never, [typeof i1.AngularFireModule, typeof i2.AngularFirestoreModule, typeof i3.AngularHasuraGraphQLModule], never>;
@@ -390,7 +390,7 @@
390
390
  }] }];
391
391
  } });
392
392
 
393
- var BACKEND_URL = 'BACKEND_URL';
393
+ var API_URL = 'API_URL';
394
394
 
395
395
  var DEFAULT_SHOP = 'DEFAULT_SHOP';
396
396
 
@@ -1223,100 +1223,54 @@
1223
1223
  } });
1224
1224
 
1225
1225
  var ShippingService = /** @class */ (function () {
1226
- function ShippingService(http, apiUrl, homeService) {
1226
+ function ShippingService(http, apiUrl) {
1227
1227
  this.http = http;
1228
1228
  this.apiUrl = apiUrl;
1229
- this.homeService = homeService;
1230
1229
  }
1231
- ShippingService.prototype.getShippingMethods = function (shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
1232
- var _this = this;
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;
1230
+ ShippingService.prototype.getMensShippingMethods = function (zip, weightGrams, totalPrice, personId, subscriptionPlan) {
1231
+ return this.http.get(this.apiUrl + "open/checkshippingcompany?personId=" + personId + "&postalCode=" + zip + "&weightGrams=" + weightGrams)
1232
+ .pipe(operators.map(function (data) { return data.result; }), operators.map(function (shippingMethods) {
1233
+ var shippingMethodsResponse = [];
1240
1234
  if (!shippingMethods.length)
1241
1235
  return [];
1242
- shippingMethods = shippingMethods.map(function (s) {
1243
- if (s.ShippingCompanyName == 'Same Day EG')
1244
- s.ShippingCompanyName = 'Same Day';
1245
- else
1246
- return s;
1247
- });
1248
- var datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
1249
- if (_this.isHolidays(datasSameDayNotAvaliable)) {
1250
- shippingMethods = shippingMethods.filter(function (method) { return method.ShippingCompanyName !== 'Same Day'; });
1251
- }
1252
1236
  if (totalPrice >= 200) {
1253
- shippingMethods = shippingMethods.map(function (s) {
1237
+ return shippingMethods.map(function (s) {
1254
1238
  if (s.serviceName !== 'Same Day')
1255
1239
  return Object.assign(Object.assign({}, s), { totalPrice: 0 });
1256
1240
  else
1257
1241
  return s;
1258
1242
  });
1259
1243
  }
1260
- if (shop == i1$1.Shops.GLAMSHOP)
1261
- return shippingMethods;
1262
- if (_this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
1263
- shippingMethods = shippingMethods.map(function (s) {
1264
- if (s.serviceName == 'Same Day')
1265
- return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
1266
- else
1244
+ if (subscriptionPlan && subscriptionPlan == 'SELECT') {
1245
+ return shippingMethods.map(function (s) {
1246
+ if (s.serviceName !== 'Same Day')
1267
1247
  return Object.assign(Object.assign({}, s), { totalPrice: 0 });
1248
+ else
1249
+ return s;
1268
1250
  });
1269
1251
  }
1270
- if (_this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
1271
- shippingMethods = shippingMethods.map(function (s) {
1272
- return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
1252
+ if (subscriptionPlan && subscriptionPlan == 'PRIME') {
1253
+ return shippingMethods.map(function (s) {
1254
+ if (s.serviceName !== 'Same Day')
1255
+ return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
1256
+ else
1257
+ return s;
1273
1258
  });
1274
1259
  }
1275
- return shippingMethods;
1260
+ return shippingMethodsResponse;
1276
1261
  }));
1277
1262
  };
1278
- ShippingService.prototype.isFreeShippingBySubscription = function (shop, subscriptionPlan) {
1279
- if (!subscriptionPlan)
1280
- return false;
1281
- if (shop == i1$1.Shops.MENSMARKET && subscriptionPlan == 'SELECT') {
1282
- return true;
1283
- }
1284
- return false;
1285
- };
1286
- ShippingService.prototype.isHalfShippingBySubscription = function (shop, subscriptionPlan) {
1287
- if (!subscriptionPlan)
1288
- return false;
1289
- if (shop == i1$1.Shops.MENSMARKET && subscriptionPlan == 'PRIME') {
1290
- return true;
1291
- }
1292
- if (shop == i1$1.Shops.GLAMSHOP && subscriptionPlan) {
1293
- return true;
1294
- }
1295
- return false;
1296
- };
1297
- ShippingService.prototype.isHolidays = function (datas) {
1298
- var today = new Date();
1299
- for (var key in datas) {
1300
- var start = new Date(today.getFullYear() + "-" + datas[key].beginDate);
1301
- var end = new Date(today.getFullYear() + "-" + datas[key].endDate);
1302
- if (start > end)
1303
- end = new Date(today.getFullYear() + 1 + "-" + datas[key].endDate);
1304
- if (today >= start && today <= end)
1305
- return true;
1306
- }
1307
- return false;
1308
- };
1309
1263
  return ShippingService;
1310
1264
  }());
1311
- 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: BACKEND_URL }, { token: HomeShopService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1265
+ 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 });
1312
1266
  ShippingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService });
1313
1267
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.12", ngImport: i0__namespace, type: ShippingService, decorators: [{
1314
1268
  type: i0.Injectable
1315
1269
  }], ctorParameters: function () {
1316
1270
  return [{ type: i1__namespace$3.HttpClient }, { type: undefined, decorators: [{
1317
1271
  type: i0.Inject,
1318
- args: [BACKEND_URL]
1319
- }] }, { type: HomeShopService }];
1272
+ args: [API_URL]
1273
+ }] }];
1320
1274
  } });
1321
1275
 
1322
1276
  var AngularFirebaseAuthModule = /** @class */ (function () {
@@ -1910,7 +1864,7 @@
1910
1864
  AngularConnectModule.initializeApp = function (defaultShop, options, nameOrConfig) {
1911
1865
  return {
1912
1866
  ngModule: AngularConnectModule,
1913
- providers: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((i1$1.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_OPTIONS, useValue: options === null || options === void 0 ? void 0 : options.firebase }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.backendUrl) ? [] : [{ provide: BACKEND_URL, useValue: options.backendUrl }]))),
1867
+ providers: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((i1$1.isNil(defaultShop) ? [] : [{ provide: DEFAULT_SHOP, useValue: defaultShop }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_OPTIONS, useValue: options === null || options === void 0 ? void 0 : options.firebase }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.firebase) ? [] : [{ provide: fire.FIREBASE_APP_NAME, useValue: nameOrConfig }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [{ provide: ES_CONFIG, useValue: options.elasticSearch }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [{ provide: HASURA_OPTIONS, useValue: options.hasura }]))), __read((i1$1.isNil(options === null || options === void 0 ? void 0 : options.apiUrl) ? [] : [{ provide: API_URL, useValue: options.apiUrl }]))),
1914
1868
  };
1915
1869
  };
1916
1870
  return AngularConnectModule;