@tecof/theme-editor 0.0.11 → 0.0.12
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 +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -26,9 +26,10 @@ import ReactDOM__default from 'react-dom';
|
|
|
26
26
|
|
|
27
27
|
// src/api.ts
|
|
28
28
|
var TecofApiClient = class {
|
|
29
|
-
constructor(apiUrl, secretKey) {
|
|
29
|
+
constructor(apiUrl, secretKey, customCdnUrl) {
|
|
30
30
|
this.apiUrl = apiUrl.replace(/\/+$/, "");
|
|
31
31
|
this.secretKey = secretKey;
|
|
32
|
+
this.customCdnUrl = customCdnUrl ? customCdnUrl.replace(/\/+$/, "") : void 0;
|
|
32
33
|
}
|
|
33
34
|
get headers() {
|
|
34
35
|
return {
|
|
@@ -189,20 +190,21 @@ var TecofApiClient = class {
|
|
|
189
190
|
};
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
|
-
/** CDN base URL (
|
|
193
|
+
/** CDN base URL (defaults to apiUrl if not set) */
|
|
193
194
|
get cdnUrl() {
|
|
194
|
-
return this.apiUrl;
|
|
195
|
+
return this.customCdnUrl || this.apiUrl;
|
|
195
196
|
}
|
|
196
197
|
};
|
|
197
198
|
var TecofContext = createContext(null);
|
|
198
|
-
var TecofProvider = ({ apiUrl, secretKey, children }) => {
|
|
199
|
+
var TecofProvider = ({ apiUrl, secretKey, cdnUrl, children }) => {
|
|
199
200
|
const value = useMemo(
|
|
200
201
|
() => ({
|
|
201
|
-
apiClient: new TecofApiClient(apiUrl, secretKey),
|
|
202
|
+
apiClient: new TecofApiClient(apiUrl, secretKey, cdnUrl),
|
|
202
203
|
secretKey,
|
|
203
|
-
apiUrl
|
|
204
|
+
apiUrl,
|
|
205
|
+
cdnUrl
|
|
204
206
|
}),
|
|
205
|
-
[apiUrl, secretKey]
|
|
207
|
+
[apiUrl, secretKey, cdnUrl]
|
|
206
208
|
);
|
|
207
209
|
return /* @__PURE__ */ jsx(TecofContext.Provider, { value, children });
|
|
208
210
|
};
|