@vue-storefront/nuxt 5.0.0 → 6.0.0
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/dist/module.json
CHANGED
|
@@ -66,8 +66,10 @@ export function defineSdkConfig<TConfig>(config: Config<TConfig>) {
|
|
|
66
66
|
const runtimeConfig = useRuntimeConfig();
|
|
67
67
|
|
|
68
68
|
const requestHeaders = useRequestHeaders(["x-forwarded-host", "host"]);
|
|
69
|
+
const resolvedOptions = resolveOptions(runtimeConfig.public.alokai);
|
|
70
|
+
|
|
69
71
|
const middlewareUrl = composeMiddlewareUrl({
|
|
70
|
-
options:
|
|
72
|
+
options: resolvedOptions,
|
|
71
73
|
headers: requestHeaders,
|
|
72
74
|
});
|
|
73
75
|
|
|
@@ -89,3 +91,29 @@ export function defineSdkConfig<TConfig>(config: Config<TConfig>) {
|
|
|
89
91
|
});
|
|
90
92
|
}
|
|
91
93
|
}
|
|
94
|
+
|
|
95
|
+
function resolveSdkOptions(
|
|
96
|
+
input: SdkModuleOptions,
|
|
97
|
+
options: Partial<ResolveSdkOptionsConfig> = {}
|
|
98
|
+
): SdkModuleOptions {
|
|
99
|
+
if (input?.multistore?.enabled) {
|
|
100
|
+
return {
|
|
101
|
+
middleware: {
|
|
102
|
+
// This is a dummy URL, the localhost domain will be replaced by the actual domain in the browser
|
|
103
|
+
// in composeMiddlewareUrl function. The server-side rendering will use ssrApiUrl.
|
|
104
|
+
apiUrl: `https://localhost/${options?.customSuffix ?? "api"}`,
|
|
105
|
+
cdnCacheBustingId: input.middleware?.cdnCacheBustingId,
|
|
106
|
+
ssrApiUrl: input.middleware?.ssrApiUrl ?? input.middleware.apiUrl,
|
|
107
|
+
},
|
|
108
|
+
multistore: {
|
|
109
|
+
enabled: true,
|
|
110
|
+
},`
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return input;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
type ResolveSdkOptionsConfig = {
|
|
118
|
+
customSuffix: string;
|
|
119
|
+
}
|