@nuskin/product-components 3.1.5 → 3.1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## [3.1.6](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.5...v3.1.6) (2022-08-11)
2
+
3
+
4
+ ### Fix
5
+
6
+ * [NsProductOffer] Allow loading an offer with no storefront data in firebase. Delete storefront storage if none exists (#CX12-5289) ([488f5cb](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/488f5cb47602806fecb50a49fd61f1b588ed6424)), closes [#CX12-5289](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX12-5289)
7
+
8
+ ## [3.1.6-cx12-5289.2](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.6-cx12-5289.1...v3.1.6-cx12-5289.2) (2022-07-26)
9
+
10
+
11
+ ### Fix
12
+
13
+ * Add fixes from CX9-8164 ([6102a1d](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/6102a1d50d2b996684638aaeee6414e3dc7a418d))
14
+ * Check for responseObject ([8f8aace](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/8f8aacea14db2daffc103854f3fbe56fd760ec20))
15
+
16
+ ## [3.1.6-cx12-5289.1](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.5...v3.1.6-cx12-5289.1) (2022-07-25)
17
+
18
+
19
+ ### Fix
20
+
21
+ * [NsProductOffer] Allow loading an offer with no storefront data in firebase. Delete storefront storage if none exists (#CX12-5289) ([7ddb948](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/7ddb9487011140d9a32d1d561537353de20f7634)), closes [#CX12-5289](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX12-5289)
22
+ * Update gitlab-ci.yml (#CX12-5289) ([dba63d3](https://code.tls.nuskin.io/ns-am/ux/product-components/commit/dba63d3d6fc17ad17b3d3816d0774e86fa18558d)), closes [#CX12-5289](https://code.tls.nuskin.io/ns-am/ux/product-components/issues/CX12-5289)
23
+
1
24
  ## [3.1.5](https://code.tls.nuskin.io/ns-am/ux/product-components/compare/v3.1.4...v3.1.5) (2022-06-14)
2
25
 
3
26
 
@@ -255,7 +255,7 @@ export default {
255
255
  return this.$NsProductUserService.isPreferredCustomer;
256
256
  },
257
257
  localStoreId() {
258
- return (this.storeOwner || {}).sapId || this.storeId || this.queryStoreId;
258
+ return this.storeId || this.queryStoreId || (this.storeOwner || {}).sapId;
259
259
  },
260
260
  isStorefront() {
261
261
  return !!this.localStoreId;
@@ -385,17 +385,20 @@ export default {
385
385
  if (!isNullOrEmpty(sponsor)) {
386
386
  StoreFrontSponsorStorageService.setStoreFrontSponsor(sponsor);
387
387
  this.storeOwner = sponsor;
388
+ } else {
389
+ StoreFrontSponsorStorageService.clearStoreFrontSponsor();
390
+ this.storeOwner = {};
388
391
  }
389
392
  }
390
393
 
391
- if (!!this.localOfferId && !isNullOrEmpty(this.storeOwner)) {
394
+ if (this.localOfferId) {
392
395
  // get store preferred name from account service if possible
393
396
  const storeOwnerAccountInfo = await AccountService.getAccountInfo(
394
397
  this.localStoreId
395
398
  );
396
399
  this.storePreferredName =
397
- (storeOwnerAccountInfo || {}).preferredName ||
398
- this.storeOwner.displayName;
400
+ (this.storeOwner || {}).displayName ||
401
+ (storeOwnerAccountInfo || {}).preferredName;
399
402
 
400
403
  this.setT(
401
404
  "offerNotFound",
@@ -499,13 +502,32 @@ export default {
499
502
  ? response.data
500
503
  : null;
501
504
 
505
+ //Check if offer has expiration date that is older than midnight the next day
506
+ if (responseObject && responseObject.expirationDate) {
507
+ let currentDate = new Date();
508
+ currentDate.setHours(0);
509
+ currentDate.setMinutes(0);
510
+ currentDate.setSeconds(0);
511
+ currentDate.setMilliseconds(0);
512
+ // The expiration = 00:00 the next day (CX9-8164)
513
+ let expirationDate = new Date(responseObject.expirationDate);
514
+ expirationDate.setTime(
515
+ expirationDate.getTime() + expirationDate.getTimezoneOffset() * 60000
516
+ );
517
+ expirationDate.setHours(0);
518
+ expirationDate.setMinutes(0);
519
+ expirationDate.setSeconds(0);
520
+ expirationDate.setMilliseconds(0);
521
+ if (expirationDate.getTime() < currentDate.getTime()) {
522
+ this.offerExpired = true;
523
+ return;
524
+ }
525
+ }
526
+
502
527
  if (
503
528
  !responseObject ||
504
529
  responseObject.active === false ||
505
- responseObject.isDeleted ||
506
- (responseObject.expirationDate &&
507
- new Date(responseObject.expirationDate).getTime() <=
508
- new Date().getTime())
530
+ responseObject.isDeleted
509
531
  ) {
510
532
  this.offerExpired = true;
511
533
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/product-components",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "Nu Skin Product Components",
5
5
  "main": "index.js",
6
6
  "scripts": {