Skip to content

Commit aad9bf6

Browse files
Revert "[DO NOT MERGE] fix(es-1487): resolve middleware url for custom domains docs update (#7388)"
This reverts commit 31a00c7.
1 parent 31a00c7 commit aad9bf6

File tree

10 files changed

+24
-86
lines changed

10 files changed

+24
-86
lines changed

.changeset/lucky-zebras-destroy.md

-5
This file was deleted.

docs/content/4.sdk/2.getting-started/1.index.md

+4-13
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,10 @@ export function getSdkOptions() {
5151
const ssrApiUrl = env('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL');
5252
const cdnCacheBustingId = env('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_CDN_CACHE_BUSTING_ID') ?? 'no-cache-busting-id-set';
5353
const isMultiStoreEnabled = env('NEXT_PUBLIC_ALOKAI_MULTISTORE_ENABLED') === 'true';
54-
5554
if (!apiUrl) {
5655
throw new Error('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_API_URL is required to run the app');
5756
}
5857

59-
if (!ssrApiUrl) {
60-
throw new Error('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL is required to run the app');
61-
}
62-
6358
const options = resolveSdkOptions({
6459
middleware: {
6560
apiUrl,
@@ -85,15 +80,13 @@ import type { CommerceEndpoints, UnifiedEndpoints } from "storefront-middleware/
8580
export function getSdkConfig() {
8681
return defineSdkConfig(({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
8782
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
88-
apiUrl: config.apiUrl + "/commerce",
89-
ssrApiUrl: config.ssrApiUrl + "/commerce",
83+
apiUrl: config.middlewareUrl + "/commerce",
9084
defaultRequestConfig: {
9185
headers: getRequestHeaders(),
9286
},
9387
}),
9488
cms: buildModule(contentfulModule, {
95-
apiUrl: config.apiUrl + "/cms",
96-
ssrApiUrl: config.ssrApiUrl + "/cms",
89+
apiUrl: config.middlewareUrl + "/cms",
9790
}),
9891
}));
9992
}
@@ -385,15 +378,13 @@ import { UnifiedEndpoints } from "storefront-middleware/types";
385378
export default defineSdkConfig(
386379
({ buildModule, config, middlewareModule getRequestHeaders }) => ({
387380
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
388-
apiUrl: config.apiUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
389-
ssrApiUrl: config.ssrApiUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
381+
apiUrl: config.middlewareUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
390382
defaultRequestConfig: {
391383
headers: getRequestHeaders(),
392384
},
393385
}),
394386
cms: buildModule(contentfulModule, {
395-
apiUrl: config.apiUrl + "/cms",
396-
ssrApiUrl: config.ssrApiUrl + "/cms",
387+
apiUrl: config.middlewareUrl + "/cms",
397388
}),
398389
})
399390
);

docs/content/4.sdk/2.getting-started/3.middleware-module.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export const { getSdk } = createSdk(
2525
options,
2626
({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
2727
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
28-
apiUrl: config.apiUrl + "/commerce",
29-
ssrApiUrl: config.ssrApiUrl + "/commerce",
28+
apiUrl: config.middlewareUrl + "/commerce",
3029
defaultRequestConfig: {
3130
headers: getRequestHeaders(),
3231
},
@@ -44,8 +43,7 @@ import { UnifiedEndpoints } from "storefront-middleware/types";
4443
export default defineSdkConfig(
4544
({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
4645
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
47-
apiUrl: config.apiUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
48-
ssrApiUrl: config.ssrApiUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
46+
apiUrl: config.middlewareUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
4947
defaultRequestConfig: {
5048
headers: getRequestHeaders(),
5149
},
@@ -126,7 +124,7 @@ export const sdk = initSDK({
126124
The `middlewareModule` accepts the following options:
127125

128126
- `apiUrl` - the URL of the middleware server,
129-
- `ssrApiUrl` - the URL of the middleware server during SSR,
127+
- `ssrApiUrl` - (Optional) the URL of the middleware server during SSR,
130128
- `defaultRequestConfig` - (Optional) default request config for each request,
131129
- `httpClient` - (Optional) a custom HTTP client,
132130
- `errorHandler` - (Optional) a custom error handler for HTTP requests.
@@ -378,8 +376,7 @@ import { UnifiedEndpoints } from "storefront-middleware/types";
378376
export function getSdkConfig() {
379377
return defineSdkConfig(({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
380378
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
381-
apiUrl: config.apiUrl + "/commerce",
382-
ssrApiUrl: config.ssrApiUrl + "/commerce",
379+
apiUrl: config.middlewareUrl + "/commerce",
383380
defaultRequestConfig: {
384381
headers: getRequestHeaders(),
385382
},
@@ -396,8 +393,7 @@ import { UnifiedEndpoints } from "storefront-middleware/types";
396393
export default defineSdkConfig(
397394
({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
398395
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
399-
apiUrl: config.apiUrl + "/commerce",
400-
ssrApiUrl: config.ssrApiUrl + "/commerce",
396+
apiUrl: config.middlewareUrl + "/commerce",
401397
defaultRequestConfig: {
402398
headers: getRequestHeaders(),
403399
},

docs/content/guides/2.alokai-essentials/1.alokai-next-js/4.install-sdk.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ export const { getSdk } = createSdk(
4848
options,
4949
({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
5050
sapcc: buildModule(middlewareModule<Endpoints>, {
51-
apiUrl: config.apiUrl + "/sapcc",
52-
ssrApiUrl: config.ssrApiUrl + "/sapcc",
51+
apiUrl: config.middlewareUrl + "/sapcc",
5352
defaultRequestConfig: {
5453
headers: getRequestHeaders(),
5554
},

docs/content/guides/2.alokai-essentials/1.alokai-next-js/9.udl.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,8 @@ export const { getSdk } = createSdk(
213213
({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
214214
- sapcc: buildModule(middlewareModule<Endpoints>, {
215215
+ unified: buildModule(middlewareModule<UnifiedEndpoints>, {
216-
- apiUrl: config.apiUrl + "/sapcc",
217-
+ apiUrl: config.apiUrl + "/commerce",
218-
- ssrApiUrl: config.ssrApiUrl + "/sapcc",
219-
+ ssrApiUrl: config.ssrApiUrl + "/commerce",
216+
- apiUrl: config.middlewareUrl + "/sapcc",
217+
+ apiUrl: config.middlewareUrl + "/commerce",
220218
defaultRequestConfig: {
221219
headers: getRequestHeaders(),
222220
},

docs/content/guides/2.alokai-essentials/3.alokai-nuxt/4.install-sdk.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ import type { Endpoints } from "@vsf-enterprise/sapcc-api";
4242
export default defineSdkConfig(
4343
({ buildModule, middlewareModule, getRequestHeaders, config }) => ({
4444
sapcc: buildModule(middlewareModule<Endpoints>, {
45-
apiUrl: config.apiUrl + "/sapcc",
46-
ssrApiUrl: config.ssrApiUrl + "/sapcc",
45+
apiUrl: config.middlewareUrl + "/sapcc",
4746
defaultRequestConfig: {
4847
headers: getRequestHeaders(),
4948
},

docs/content/guides/2.alokai-essentials/3.alokai-nuxt/9.udl.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,8 @@ export default defineSdkConfig(
205205
({ buildModule, middlewareModule, getRequestHeaders, config }) => ({
206206
- sapcc: buildModule(middlewareModule<Endpoints>, {
207207
+ commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
208-
- apiUrl: config.apiUrl + "/sapcc",
209-
+ apiUrl: config.apiUrl + "/commerce",
210-
- ssrApiUrl: config.ssrApiUrl + "/sapcc",
211-
+ ssrApiUrl: config.ssrApiUrl + "/commerce",
208+
- apiUrl: config.middlewareUrl + "/sapcc",
209+
+ apiUrl: config.middlewareUrl + "/commerce",
212210
defaultRequestConfig: {
213211
headers: getRequestHeaders(),
214212
},

0 commit comments

Comments
 (0)