Skip to content

Commit

Permalink
Revert "[DO NOT MERGE] fix(es-1487): resolve middleware url for custo…
Browse files Browse the repository at this point in the history
…m domains docs update (#7388)"

This reverts commit 31a00c7.
  • Loading branch information
lsliwaradioluz committed Feb 17, 2025
1 parent 31a00c7 commit aad9bf6
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 86 deletions.
5 changes: 0 additions & 5 deletions .changeset/lucky-zebras-destroy.md

This file was deleted.

17 changes: 4 additions & 13 deletions docs/content/4.sdk/2.getting-started/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,10 @@ export function getSdkOptions() {
const ssrApiUrl = env('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL');
const cdnCacheBustingId = env('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_CDN_CACHE_BUSTING_ID') ?? 'no-cache-busting-id-set';
const isMultiStoreEnabled = env('NEXT_PUBLIC_ALOKAI_MULTISTORE_ENABLED') === 'true';

if (!apiUrl) {
throw new Error('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_API_URL is required to run the app');
}

if (!ssrApiUrl) {
throw new Error('NEXT_PUBLIC_ALOKAI_MIDDLEWARE_SSR_API_URL is required to run the app');
}

const options = resolveSdkOptions({
middleware: {
apiUrl,
Expand All @@ -85,15 +80,13 @@ import type { CommerceEndpoints, UnifiedEndpoints } from "storefront-middleware/
export function getSdkConfig() {
return defineSdkConfig(({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
apiUrl: config.apiUrl + "/commerce",
ssrApiUrl: config.ssrApiUrl + "/commerce",
apiUrl: config.middlewareUrl + "/commerce",
defaultRequestConfig: {
headers: getRequestHeaders(),
},
}),
cms: buildModule(contentfulModule, {
apiUrl: config.apiUrl + "/cms",
ssrApiUrl: config.ssrApiUrl + "/cms",
apiUrl: config.middlewareUrl + "/cms",
}),
}));
}
Expand Down Expand Up @@ -385,15 +378,13 @@ import { UnifiedEndpoints } from "storefront-middleware/types";
export default defineSdkConfig(
({ buildModule, config, middlewareModule getRequestHeaders }) => ({
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
apiUrl: config.apiUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
ssrApiUrl: config.ssrApiUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
apiUrl: config.middlewareUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
defaultRequestConfig: {
headers: getRequestHeaders(),
},
}),
cms: buildModule(contentfulModule, {
apiUrl: config.apiUrl + "/cms",
ssrApiUrl: config.ssrApiUrl + "/cms",
apiUrl: config.middlewareUrl + "/cms",
}),
})
);
Expand Down
14 changes: 5 additions & 9 deletions docs/content/4.sdk/2.getting-started/3.middleware-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export const { getSdk } = createSdk(
options,
({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
apiUrl: config.apiUrl + "/commerce",
ssrApiUrl: config.ssrApiUrl + "/commerce",
apiUrl: config.middlewareUrl + "/commerce",
defaultRequestConfig: {
headers: getRequestHeaders(),
},
Expand All @@ -44,8 +43,7 @@ import { UnifiedEndpoints } from "storefront-middleware/types";
export default defineSdkConfig(
({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
apiUrl: config.apiUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
ssrApiUrl: config.ssrApiUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
apiUrl: config.middlewareUrl + "/commerce", // SAP Commerce Cloud integration is available at /commerce endpoint
defaultRequestConfig: {
headers: getRequestHeaders(),
},
Expand Down Expand Up @@ -126,7 +124,7 @@ export const sdk = initSDK({
The `middlewareModule` accepts the following options:

- `apiUrl` - the URL of the middleware server,
- `ssrApiUrl` - the URL of the middleware server during SSR,
- `ssrApiUrl` - (Optional) the URL of the middleware server during SSR,
- `defaultRequestConfig` - (Optional) default request config for each request,
- `httpClient` - (Optional) a custom HTTP client,
- `errorHandler` - (Optional) a custom error handler for HTTP requests.
Expand Down Expand Up @@ -378,8 +376,7 @@ import { UnifiedEndpoints } from "storefront-middleware/types";
export function getSdkConfig() {
return defineSdkConfig(({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
apiUrl: config.apiUrl + "/commerce",
ssrApiUrl: config.ssrApiUrl + "/commerce",
apiUrl: config.middlewareUrl + "/commerce",
defaultRequestConfig: {
headers: getRequestHeaders(),
},
Expand All @@ -396,8 +393,7 @@ import { UnifiedEndpoints } from "storefront-middleware/types";
export default defineSdkConfig(
({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
apiUrl: config.apiUrl + "/commerce",
ssrApiUrl: config.ssrApiUrl + "/commerce",
apiUrl: config.middlewareUrl + "/commerce",
defaultRequestConfig: {
headers: getRequestHeaders(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export const { getSdk } = createSdk(
options,
({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
sapcc: buildModule(middlewareModule<Endpoints>, {
apiUrl: config.apiUrl + "/sapcc",
ssrApiUrl: config.ssrApiUrl + "/sapcc",
apiUrl: config.middlewareUrl + "/sapcc",
defaultRequestConfig: {
headers: getRequestHeaders(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,8 @@ export const { getSdk } = createSdk(
({ buildModule, config, middlewareModule, getRequestHeaders }) => ({
- sapcc: buildModule(middlewareModule<Endpoints>, {
+ unified: buildModule(middlewareModule<UnifiedEndpoints>, {
- apiUrl: config.apiUrl + "/sapcc",
+ apiUrl: config.apiUrl + "/commerce",
- ssrApiUrl: config.ssrApiUrl + "/sapcc",
+ ssrApiUrl: config.ssrApiUrl + "/commerce",
- apiUrl: config.middlewareUrl + "/sapcc",
+ apiUrl: config.middlewareUrl + "/commerce",
defaultRequestConfig: {
headers: getRequestHeaders(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ import type { Endpoints } from "@vsf-enterprise/sapcc-api";
export default defineSdkConfig(
({ buildModule, middlewareModule, getRequestHeaders, config }) => ({
sapcc: buildModule(middlewareModule<Endpoints>, {
apiUrl: config.apiUrl + "/sapcc",
ssrApiUrl: config.ssrApiUrl + "/sapcc",
apiUrl: config.middlewareUrl + "/sapcc",
defaultRequestConfig: {
headers: getRequestHeaders(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,8 @@ export default defineSdkConfig(
({ buildModule, middlewareModule, getRequestHeaders, config }) => ({
- sapcc: buildModule(middlewareModule<Endpoints>, {
+ commerce: buildModule(middlewareModule<UnifiedEndpoints>, {
- apiUrl: config.apiUrl + "/sapcc",
+ apiUrl: config.apiUrl + "/commerce",
- ssrApiUrl: config.ssrApiUrl + "/sapcc",
+ ssrApiUrl: config.ssrApiUrl + "/commerce",
- apiUrl: config.middlewareUrl + "/sapcc",
+ apiUrl: config.middlewareUrl + "/commerce",
defaultRequestConfig: {
headers: getRequestHeaders(),
},
Expand Down
Loading

0 comments on commit aad9bf6

Please sign in to comment.