@vue-storefront/next 4.0.0 → 4.1.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/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +22 -2
- package/dist/index.mjs +20 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -98,5 +98,15 @@ declare function createSdk<TConfig extends Record<string, any>>(options: CreateS
|
|
|
98
98
|
* );
|
|
99
99
|
*/
|
|
100
100
|
declare function defineSdkConfig<TConfig extends Record<string, any>>(config: Config<TConfig>): Config<TConfig>;
|
|
101
|
+
type ResolveSdkOptionsConfig = {
|
|
102
|
+
customSuffix: string;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Helper function to resolve the SDK options based on the configuration.
|
|
106
|
+
* @param input - The options for creating the SDK.
|
|
107
|
+
* @param options - The configuration object, that allows to customize the API Url creation on enabled multistore.
|
|
108
|
+
* @returns The resolved SDK options.
|
|
109
|
+
*/
|
|
110
|
+
declare function resolveSdkOptions(input: CreateSdkOptions, options?: Partial<ResolveSdkOptionsConfig>): CreateSdkOptions;
|
|
101
111
|
|
|
102
|
-
export { type CreateSdkOptions, createSdk, defineSdkConfig };
|
|
112
|
+
export { type CreateSdkOptions, createSdk, defineSdkConfig, resolveSdkOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -98,5 +98,15 @@ declare function createSdk<TConfig extends Record<string, any>>(options: CreateS
|
|
|
98
98
|
* );
|
|
99
99
|
*/
|
|
100
100
|
declare function defineSdkConfig<TConfig extends Record<string, any>>(config: Config<TConfig>): Config<TConfig>;
|
|
101
|
+
type ResolveSdkOptionsConfig = {
|
|
102
|
+
customSuffix: string;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Helper function to resolve the SDK options based on the configuration.
|
|
106
|
+
* @param input - The options for creating the SDK.
|
|
107
|
+
* @param options - The configuration object, that allows to customize the API Url creation on enabled multistore.
|
|
108
|
+
* @returns The resolved SDK options.
|
|
109
|
+
*/
|
|
110
|
+
declare function resolveSdkOptions(input: CreateSdkOptions, options?: Partial<ResolveSdkOptionsConfig>): CreateSdkOptions;
|
|
101
111
|
|
|
102
|
-
export { type CreateSdkOptions, createSdk, defineSdkConfig };
|
|
112
|
+
export { type CreateSdkOptions, createSdk, defineSdkConfig, resolveSdkOptions };
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
37
37
|
var src_exports = {};
|
|
38
38
|
__export(src_exports, {
|
|
39
39
|
createSdk: () => createSdk,
|
|
40
|
-
defineSdkConfig: () => defineSdkConfig
|
|
40
|
+
defineSdkConfig: () => defineSdkConfig,
|
|
41
|
+
resolveSdkOptions: () => resolveSdkOptions
|
|
41
42
|
});
|
|
42
43
|
module.exports = __toCommonJS(src_exports);
|
|
43
44
|
|
|
@@ -151,8 +152,27 @@ function createSdk(options, configDefinition) {
|
|
|
151
152
|
function defineSdkConfig(config) {
|
|
152
153
|
return config;
|
|
153
154
|
}
|
|
155
|
+
function resolveSdkOptions(input, options = {}) {
|
|
156
|
+
var _a, _b, _c, _d, _e;
|
|
157
|
+
if ((_a = input == null ? void 0 : input.multistore) == null ? void 0 : _a.enabled) {
|
|
158
|
+
return {
|
|
159
|
+
middleware: {
|
|
160
|
+
// This is a dummy URL, the localhost domain will be replaced by the actual domain in the browser
|
|
161
|
+
// in composeMiddlewareUrl function. The server-side rendering will use ssrApiUrl.
|
|
162
|
+
apiUrl: `https://localhost/${(_b = options == null ? void 0 : options.customSuffix) != null ? _b : "api"}`,
|
|
163
|
+
cdnCacheBustingId: (_c = input.middleware) == null ? void 0 : _c.cdnCacheBustingId,
|
|
164
|
+
ssrApiUrl: (_e = (_d = input.middleware) == null ? void 0 : _d.ssrApiUrl) != null ? _e : input.middleware.apiUrl
|
|
165
|
+
},
|
|
166
|
+
multistore: {
|
|
167
|
+
enabled: true
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return input;
|
|
172
|
+
}
|
|
154
173
|
// Annotate the CommonJS export names for ESM import in node:
|
|
155
174
|
0 && (module.exports = {
|
|
156
175
|
createSdk,
|
|
157
|
-
defineSdkConfig
|
|
176
|
+
defineSdkConfig,
|
|
177
|
+
resolveSdkOptions
|
|
158
178
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -113,7 +113,26 @@ function createSdk(options, configDefinition) {
|
|
|
113
113
|
function defineSdkConfig(config) {
|
|
114
114
|
return config;
|
|
115
115
|
}
|
|
116
|
+
function resolveSdkOptions(input, options = {}) {
|
|
117
|
+
var _a, _b, _c, _d, _e;
|
|
118
|
+
if ((_a = input == null ? void 0 : input.multistore) == null ? void 0 : _a.enabled) {
|
|
119
|
+
return {
|
|
120
|
+
middleware: {
|
|
121
|
+
// This is a dummy URL, the localhost domain will be replaced by the actual domain in the browser
|
|
122
|
+
// in composeMiddlewareUrl function. The server-side rendering will use ssrApiUrl.
|
|
123
|
+
apiUrl: `https://localhost/${(_b = options == null ? void 0 : options.customSuffix) != null ? _b : "api"}`,
|
|
124
|
+
cdnCacheBustingId: (_c = input.middleware) == null ? void 0 : _c.cdnCacheBustingId,
|
|
125
|
+
ssrApiUrl: (_e = (_d = input.middleware) == null ? void 0 : _d.ssrApiUrl) != null ? _e : input.middleware.apiUrl
|
|
126
|
+
},
|
|
127
|
+
multistore: {
|
|
128
|
+
enabled: true
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return input;
|
|
133
|
+
}
|
|
116
134
|
export {
|
|
117
135
|
createSdk,
|
|
118
|
-
defineSdkConfig
|
|
136
|
+
defineSdkConfig,
|
|
137
|
+
resolveSdkOptions
|
|
119
138
|
};
|