@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.d.mts
CHANGED
|
@@ -157,7 +157,8 @@ interface LinkFieldValue {
|
|
|
157
157
|
declare class TecofApiClient {
|
|
158
158
|
private apiUrl;
|
|
159
159
|
private secretKey;
|
|
160
|
-
|
|
160
|
+
private customCdnUrl?;
|
|
161
|
+
constructor(apiUrl: string, secretKey: string, customCdnUrl?: string);
|
|
161
162
|
private get headers();
|
|
162
163
|
/**
|
|
163
164
|
* Fetch a page by ID (for the editor)
|
|
@@ -197,7 +198,7 @@ declare class TecofApiClient {
|
|
|
197
198
|
code: string;
|
|
198
199
|
value: string;
|
|
199
200
|
}[]>>;
|
|
200
|
-
/** CDN base URL (
|
|
201
|
+
/** CDN base URL (defaults to apiUrl if not set) */
|
|
201
202
|
get cdnUrl(): string;
|
|
202
203
|
}
|
|
203
204
|
|
|
@@ -205,8 +206,9 @@ interface TecofContextValue {
|
|
|
205
206
|
apiClient: TecofApiClient;
|
|
206
207
|
secretKey: string;
|
|
207
208
|
apiUrl: string;
|
|
209
|
+
cdnUrl?: string;
|
|
208
210
|
}
|
|
209
|
-
declare const TecofProvider: ({ apiUrl, secretKey, children }: TecofProviderProps) => react_jsx_runtime.JSX.Element;
|
|
211
|
+
declare const TecofProvider: ({ apiUrl, secretKey, cdnUrl, children }: TecofProviderProps) => react_jsx_runtime.JSX.Element;
|
|
210
212
|
declare function useTecof(): TecofContextValue;
|
|
211
213
|
|
|
212
214
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -157,7 +157,8 @@ interface LinkFieldValue {
|
|
|
157
157
|
declare class TecofApiClient {
|
|
158
158
|
private apiUrl;
|
|
159
159
|
private secretKey;
|
|
160
|
-
|
|
160
|
+
private customCdnUrl?;
|
|
161
|
+
constructor(apiUrl: string, secretKey: string, customCdnUrl?: string);
|
|
161
162
|
private get headers();
|
|
162
163
|
/**
|
|
163
164
|
* Fetch a page by ID (for the editor)
|
|
@@ -197,7 +198,7 @@ declare class TecofApiClient {
|
|
|
197
198
|
code: string;
|
|
198
199
|
value: string;
|
|
199
200
|
}[]>>;
|
|
200
|
-
/** CDN base URL (
|
|
201
|
+
/** CDN base URL (defaults to apiUrl if not set) */
|
|
201
202
|
get cdnUrl(): string;
|
|
202
203
|
}
|
|
203
204
|
|
|
@@ -205,8 +206,9 @@ interface TecofContextValue {
|
|
|
205
206
|
apiClient: TecofApiClient;
|
|
206
207
|
secretKey: string;
|
|
207
208
|
apiUrl: string;
|
|
209
|
+
cdnUrl?: string;
|
|
208
210
|
}
|
|
209
|
-
declare const TecofProvider: ({ apiUrl, secretKey, children }: TecofProviderProps) => react_jsx_runtime.JSX.Element;
|
|
211
|
+
declare const TecofProvider: ({ apiUrl, secretKey, cdnUrl, children }: TecofProviderProps) => react_jsx_runtime.JSX.Element;
|
|
210
212
|
declare function useTecof(): TecofContextValue;
|
|
211
213
|
|
|
212
214
|
/**
|
package/dist/index.js
CHANGED
|
@@ -64,9 +64,10 @@ var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
|
64
64
|
|
|
65
65
|
// src/api.ts
|
|
66
66
|
var TecofApiClient = class {
|
|
67
|
-
constructor(apiUrl, secretKey) {
|
|
67
|
+
constructor(apiUrl, secretKey, customCdnUrl) {
|
|
68
68
|
this.apiUrl = apiUrl.replace(/\/+$/, "");
|
|
69
69
|
this.secretKey = secretKey;
|
|
70
|
+
this.customCdnUrl = customCdnUrl ? customCdnUrl.replace(/\/+$/, "") : void 0;
|
|
70
71
|
}
|
|
71
72
|
get headers() {
|
|
72
73
|
return {
|
|
@@ -227,20 +228,21 @@ var TecofApiClient = class {
|
|
|
227
228
|
};
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
|
-
/** CDN base URL (
|
|
231
|
+
/** CDN base URL (defaults to apiUrl if not set) */
|
|
231
232
|
get cdnUrl() {
|
|
232
|
-
return this.apiUrl;
|
|
233
|
+
return this.customCdnUrl || this.apiUrl;
|
|
233
234
|
}
|
|
234
235
|
};
|
|
235
236
|
var TecofContext = React__default.createContext(null);
|
|
236
|
-
var TecofProvider = ({ apiUrl, secretKey, children }) => {
|
|
237
|
+
var TecofProvider = ({ apiUrl, secretKey, cdnUrl, children }) => {
|
|
237
238
|
const value = React__default.useMemo(
|
|
238
239
|
() => ({
|
|
239
|
-
apiClient: new TecofApiClient(apiUrl, secretKey),
|
|
240
|
+
apiClient: new TecofApiClient(apiUrl, secretKey, cdnUrl),
|
|
240
241
|
secretKey,
|
|
241
|
-
apiUrl
|
|
242
|
+
apiUrl,
|
|
243
|
+
cdnUrl
|
|
242
244
|
}),
|
|
243
|
-
[apiUrl, secretKey]
|
|
245
|
+
[apiUrl, secretKey, cdnUrl]
|
|
244
246
|
);
|
|
245
247
|
return /* @__PURE__ */ jsxRuntime.jsx(TecofContext.Provider, { value, children });
|
|
246
248
|
};
|