@nuskin/ns-shop 7.0.6 → 7.0.7-cx16-11056.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-shop",
3
- "version": "7.0.6",
3
+ "version": "7.0.7-cx16-11056.1",
4
4
  "description": "The description that will amaze and astound your audience when they read it",
5
5
  "main": "src/shop.js",
6
6
  "scripts": {
@@ -142,15 +142,21 @@ const getAdrOverrideId = () => {
142
142
  const _doNewExternalPaymentProcess = (order) => {
143
143
  // We only redirect if there is a redirect Url.
144
144
  if (order.redirectUrl) {
145
+ const redirectUrl = new URL(order.redirectUrl);
145
146
  // The landing page should be the checkout page.
146
147
  const protocol = window.location.href.split('://')[0];
147
148
  const domain = UrlService.extractDomain();
148
149
  const path = encodeURIComponent(CartService.getCheckoutPage({route: 'orderSummary'}));
149
150
 
151
+ // If we are on mynuskin.com we want to keep external payment on mynuskin.com. For developing localhost we don't want to stay on localhost
152
+ if (!domain.includes('localhost')) {
153
+ redirectUrl.hostname = window.location.hostname;
154
+ }
155
+
150
156
  // Append the landing page URL
151
157
  // Example of order.redirectUrl: "redirectUrl":
152
158
  // "https://test.nuskin.com/external-payment/api/v1/redirect?orderId=NS002761827&verify=null&ofsOrderId=0149707745"
153
- window.location = `${order.redirectUrl}&landingUrl=${protocol}://${domain}${path}`;
159
+ window.location = `${redirectUrl.toString()}&landingUrl=${protocol}://${domain}${path}`;
154
160
  }
155
161
  };
156
162