talizen 0.0.9 → 0.0.11

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/core.d.ts CHANGED
@@ -22,9 +22,7 @@ export interface TalizenRequestOptions extends TalizenClientConfig {
22
22
  export declare function setTalizenConfig(config: TalizenClientConfig): void;
23
23
  export declare function getTalizenConfig(): TalizenClientConfig;
24
24
  declare global {
25
- interface Window {
26
- TalizenConfig?: TalizenClientConfig | undefined;
27
- }
25
+ var TalizenConfig: TalizenClientConfig | undefined;
28
26
  }
29
27
  export declare function resolveTalizenConfig(config?: TalizenRequestOptions): Required<Pick<TalizenClientConfig, "baseUrl" | "fetch">> & TalizenRequestOptions;
30
28
  export declare function requestJson<T>(path: string, init?: RequestInit, config?: TalizenRequestOptions): Promise<T>;
package/core.js CHANGED
@@ -1,20 +1,19 @@
1
- let globalTalizenConfig = {};
1
+ let talizenConfig = {};
2
2
  export function setTalizenConfig(config) {
3
- globalTalizenConfig = {
4
- ...globalTalizenConfig,
3
+ talizenConfig = {
4
+ ...talizenConfig,
5
5
  ...config,
6
6
  };
7
7
  }
8
8
  export function getTalizenConfig() {
9
- return {
10
- ...globalTalizenConfig,
11
- };
9
+ return talizenConfig;
12
10
  }
13
11
  export function resolveTalizenConfig(config) {
14
- const windowConfig = typeof window !== "undefined" ? window.TalizenConfig : {};
12
+ // globalThis is the global object in the browser and node.js
13
+ const globalTalizenConfig = typeof globalThis !== "undefined" ? globalThis.TalizenConfig : {};
15
14
  const merged = {
16
- ...windowConfig,
17
15
  ...globalTalizenConfig,
16
+ ...talizenConfig,
18
17
  ...config,
19
18
  };
20
19
  const baseUrl = merged.baseUrl ?? getDefaultBaseUrl();
package/form.js CHANGED
@@ -2,6 +2,8 @@ import { requestJson } from "./core.js";
2
2
  export async function submitForm(keyOrToken, payload, options) {
3
3
  return requestJson(`/form/${keyOrToken}/submit`, {
4
4
  method: "POST",
5
- body: JSON.stringify(payload),
5
+ body: JSON.stringify({
6
+ data: payload,
7
+ }),
6
8
  }, options);
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "talizen",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Talizen frontend SDK types for cms, form and core.",
5
5
  "type": "module",
6
6
  "license": "MIT",