@appkit/dek-plugin 0.12.0 → 0.13.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.es.js
CHANGED
|
@@ -439,11 +439,14 @@ function usePluginState(api2, key, defaultValue) {
|
|
|
439
439
|
}
|
|
440
440
|
return [
|
|
441
441
|
value,
|
|
442
|
-
(
|
|
443
|
-
if (typeof
|
|
444
|
-
|
|
442
|
+
(newValueOrFn) => {
|
|
443
|
+
if (typeof newValueOrFn === "function") {
|
|
444
|
+
newValueOrFn = newValueOrFn(value);
|
|
445
445
|
}
|
|
446
|
-
|
|
446
|
+
if (typeof newValueOrFn === "object") {
|
|
447
|
+
newValueOrFn = JSON.stringify(newValueOrFn);
|
|
448
|
+
}
|
|
449
|
+
setState(integrationKey, key, newValueOrFn);
|
|
447
450
|
}
|
|
448
451
|
];
|
|
449
452
|
}
|
package/dist/index.umd.js
CHANGED
|
@@ -442,11 +442,14 @@ var __publicField = (obj, key, value) => {
|
|
|
442
442
|
}
|
|
443
443
|
return [
|
|
444
444
|
value,
|
|
445
|
-
(
|
|
446
|
-
if (typeof
|
|
447
|
-
|
|
445
|
+
(newValueOrFn) => {
|
|
446
|
+
if (typeof newValueOrFn === "function") {
|
|
447
|
+
newValueOrFn = newValueOrFn(value);
|
|
448
448
|
}
|
|
449
|
-
|
|
449
|
+
if (typeof newValueOrFn === "object") {
|
|
450
|
+
newValueOrFn = JSON.stringify(newValueOrFn);
|
|
451
|
+
}
|
|
452
|
+
setState(integrationKey, key, newValueOrFn);
|
|
450
453
|
}
|
|
451
454
|
];
|
|
452
455
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { DekApi } from '../api';
|
|
2
2
|
import { DekApiStateType } from '../state';
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
declare function usePluginState(api: DekApi, key: string
|
|
6
|
-
declare function usePluginState(api: DekApi, key: string, defaultValue:
|
|
7
|
-
declare function usePluginState(api: DekApi, key: string, defaultValue:
|
|
8
|
-
declare function usePluginState(api: DekApi, key: string, defaultValue:
|
|
9
|
-
declare function usePluginState(api: DekApi, key: string, defaultValue:
|
|
3
|
+
export type DekApiSetStateAction = (value: DekApiStateType) => void;
|
|
4
|
+
export type DekApiStateSetFunc = (value: DekApiStateType) => DekApiStateType;
|
|
5
|
+
declare function usePluginState(api: DekApi, key: string): [DekApiStateType | undefined, DekApiSetStateAction];
|
|
6
|
+
declare function usePluginState(api: DekApi, key: string, defaultValue: string): [string, DekApiSetStateAction];
|
|
7
|
+
declare function usePluginState(api: DekApi, key: string, defaultValue: number): [number, DekApiSetStateAction];
|
|
8
|
+
declare function usePluginState(api: DekApi, key: string, defaultValue: boolean): [boolean, DekApiSetStateAction];
|
|
9
|
+
declare function usePluginState(api: DekApi, key: string, defaultValue: Array<any>): [Array<any>, DekApiSetStateAction];
|
|
10
|
+
declare function usePluginState(api: DekApi, key: string, defaultValue: Record<string, any>): [Record<string, any>, DekApiSetStateAction];
|
|
10
11
|
export default usePluginState;
|