@salesforce/pwa-kit-runtime 3.5.0 → 3.6.0-dev

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": "@salesforce/pwa-kit-runtime",
3
- "version": "3.5.0",
3
+ "version": "3.6.0-dev",
4
4
  "description": "The PWAKit Runtime",
5
5
  "homepage": "https://github.com/SalesforceCommerceCloud/pwa-kit/tree/develop/packages/pwa-kit-runtime#readme",
6
6
  "bugs": {
@@ -46,11 +46,11 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@loadable/component": "^5.15.3",
49
- "@salesforce/pwa-kit-dev": "3.5.0",
49
+ "@salesforce/pwa-kit-dev": "3.6.0-dev",
50
50
  "@serverless/event-mocks": "^1.1.1",
51
51
  "aws-lambda-mock-context": "^3.2.1",
52
52
  "fs-extra": "^11.1.1",
53
- "internal-lib-build": "3.5.0",
53
+ "internal-lib-build": "3.6.0-dev",
54
54
  "nock": "^13.3.0",
55
55
  "nodemon": "^2.0.22",
56
56
  "sinon": "^13.0.2",
@@ -58,7 +58,7 @@
58
58
  "supertest": "^4.0.2"
59
59
  },
60
60
  "peerDependencies": {
61
- "@salesforce/pwa-kit-dev": "3.5.0"
61
+ "@salesforce/pwa-kit-dev": "3.6.0-dev"
62
62
  },
63
63
  "peerDependenciesMeta": {
64
64
  "@salesforce/pwa-kit-dev": {
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "directory": "dist"
74
74
  },
75
- "gitHead": "59b8a18d31aff3dbe0116d240d6c7c3d2bb4a137"
75
+ "gitHead": "a6f199f018bff5a7c5e24774aa6673a418a22e88"
76
76
  }
@@ -583,6 +583,13 @@ const RemoteServerFactory = exports.RemoteServerFactory = {
583
583
  if ((_incomingRequest$path = incomingRequest.path) !== null && _incomingRequest$path !== void 0 && _incomingRequest$path.match(options.applySLASPrivateClientToEndpoints)) {
584
584
  proxyRequest.setHeader('Authorization', `Basic ${encodedSlasCredentials}`);
585
585
  }
586
+ },
587
+ onProxyRes: (proxyRes, req) => {
588
+ if (proxyRes.statusCode && proxyRes.statusCode >= 400) {
589
+ console.error(`Failed to proxy SLAS Private Client request - ${proxyRes.statusCode}`);
590
+ console.error(`Please make sure you have enabled the SLAS Private Client Proxy in your ssr.js and set the correct environment variable PWA_KIT_SLAS_CLIENT_SECRET.`);
591
+ console.error(`SLAS Private Client Proxy Request URL - ${req.protocol}://${req.get('host')}${req.originalUrl}`);
592
+ }
586
593
  }
587
594
  }));
588
595
  },
@@ -25,4 +25,4 @@ const CACHE_CONTROL = exports.CACHE_CONTROL = 'cache-control';
25
25
  const NO_CACHE = exports.NO_CACHE = 'max-age=0, nocache, nostore, must-revalidate';
26
26
  const CONTENT_SECURITY_POLICY = exports.CONTENT_SECURITY_POLICY = 'content-security-policy';
27
27
  const STRICT_TRANSPORT_SECURITY = exports.STRICT_TRANSPORT_SECURITY = 'strict-transport-security';
28
- const SLAS_CUSTOM_PROXY_PATH = exports.SLAS_CUSTOM_PROXY_PATH = '/mobify/scapi/shopper/auth';
28
+ const SLAS_CUSTOM_PROXY_PATH = exports.SLAS_CUSTOM_PROXY_PATH = '/mobify/slas/private';
@@ -901,13 +901,13 @@ describe('SLAS private client proxy', () => {
901
901
  });
902
902
  test('should not create proxy by default', () => {
903
903
  const app = _buildRemoteServer.RemoteServerFactory._createApp(opts());
904
- return (0, _supertest.default)(app).get('/mobify/scapi/shopper/auth').expect(404);
904
+ return (0, _supertest.default)(app).get('/mobify/slas/private').expect(404);
905
905
  });
906
906
  test('should return HTTP 501 if PWA_KIT_SLAS_CLIENT_SECRET env var not set', () => {
907
907
  const app = _buildRemoteServer.RemoteServerFactory._createApp(opts({
908
908
  useSLASPrivateClient: true
909
909
  }));
910
- return (0, _supertest.default)(app).get('/mobify/scapi/shopper/auth').expect(501);
910
+ return (0, _supertest.default)(app).get('/mobify/slas/private').expect(501);
911
911
  });
912
912
  test('does not insert client secret if request not for /oauth2/token', /*#__PURE__*/_asyncToGenerator(function* () {
913
913
  process.env.PWA_KIT_SLAS_CLIENT_SECRET = 'a secret';
@@ -925,7 +925,7 @@ describe('SLAS private client proxy', () => {
925
925
  useSLASPrivateClient: true,
926
926
  slasTarget: slasTarget
927
927
  }));
928
- return yield (0, _supertest.default)(app).get('/mobify/scapi/shopper/auth/somePath').then(response => {
928
+ return yield (0, _supertest.default)(app).get('/mobify/slas/private/somePath').then(response => {
929
929
  expect(response.body.authorization).toBeUndefined();
930
930
  expect(response.body.host).toBe('shortCode.api.commercecloud.salesforce.com');
931
931
  expect(response.body['x-mobify']).toBe('true');
@@ -948,7 +948,7 @@ describe('SLAS private client proxy', () => {
948
948
  useSLASPrivateClient: true,
949
949
  slasTarget: slasTarget
950
950
  }));
951
- return yield (0, _supertest.default)(app).get('/mobify/scapi/shopper/auth/oauth2/token').then(response => {
951
+ return yield (0, _supertest.default)(app).get('/mobify/slas/private/oauth2/token').then(response => {
952
952
  expect(response.body.authorization).toBe(`Basic ${encodedCredentials}`);
953
953
  expect(response.body.host).toBe('shortCode.api.commercecloud.salesforce.com');
954
954
  expect(response.body['x-mobify']).toBe('true');