@oneclick.dev/cms-kit 0.0.52 → 0.0.55

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.ts CHANGED
@@ -2,6 +2,23 @@ import { Ref } from 'vue';
2
2
  import { useLayout } from '../components/ui/flow-builder/composables/useLayout';
3
3
  import { useRunProcess } from '../components/ui/flow-builder/composables/useRunProcess';
4
4
 
5
+ declare type ArrayizeIfMultiple<S, TSetting> = TSetting extends {
6
+ multiple: true;
7
+ } ? S[] : S;
8
+
9
+ export declare interface BaseSetting<T> {
10
+ label: string;
11
+ description?: string;
12
+ type: SettingType;
13
+ default?: T;
14
+ valuesFrom?: string;
15
+ visibility?: {
16
+ dependsOn: string[];
17
+ visibleWhen: Record<string, (val: any) => boolean>;
18
+ enabledWhen?: Record<string, (val: any) => boolean>;
19
+ };
20
+ }
21
+
5
22
  declare interface BuilderState {
6
23
  show: boolean;
7
24
  variableContext: Variable[];
@@ -9,6 +26,10 @@ declare interface BuilderState {
9
26
  action?: any;
10
27
  }
11
28
 
29
+ export declare interface CheckboxSetting extends BaseSetting<boolean> {
30
+ type: 'checkbox';
31
+ }
32
+
12
33
  export declare const components: {};
13
34
 
14
35
  declare interface CustomDialogState {
@@ -19,6 +40,14 @@ declare interface CustomDialogState {
19
40
  resolve: ((result: any) => void) | null;
20
41
  }
21
42
 
43
+ export declare interface DataQuerySetting extends BaseSetting<string> {
44
+ type: 'dataQuery';
45
+ accept?: string[];
46
+ integrationKey?: string;
47
+ }
48
+
49
+ export declare function defineModuleConfig<const S extends ModuleSettingsSchema>(schema: S & ValidateDefaults<S>): S & ValidateDefaults<S>;
50
+
22
51
  declare interface FlowBuilderState {
23
52
  id: number;
24
53
  show: boolean;
@@ -27,6 +56,18 @@ declare interface FlowBuilderState {
27
56
  resolve: ((val: any) => void) | null;
28
57
  }
29
58
 
59
+ export declare interface FlowSetting extends BaseSetting<any> {
60
+ type: 'flow';
61
+ }
62
+
63
+ export declare interface FormSetting extends BaseSetting<any> {
64
+ type: 'form';
65
+ }
66
+
67
+ export declare interface InputSetting extends BaseSetting<string> {
68
+ type: 'input' | 'textarea' | 'color';
69
+ }
70
+
30
71
  declare interface MediaSourceCreateParams {
31
72
  name: string;
32
73
  integrationId: string;
@@ -34,6 +75,11 @@ declare interface MediaSourceCreateParams {
34
75
  allowUserFolders: boolean;
35
76
  }
36
77
 
78
+ export declare interface MediaSourceSetting extends BaseSetting<string> {
79
+ type: 'mediaSource';
80
+ multiple?: boolean;
81
+ }
82
+
37
83
  declare interface MediaSourceUpdateParams {
38
84
  name?: string;
39
85
  integrationId?: string;
@@ -41,6 +87,23 @@ declare interface MediaSourceUpdateParams {
41
87
  allowUserFolders?: boolean;
42
88
  }
43
89
 
90
+ export declare interface ModuleMetadata {
91
+ name: string;
92
+ description: string;
93
+ icon?: string;
94
+ version?: string;
95
+ author?: string;
96
+ tags?: string[];
97
+ }
98
+
99
+ export declare type ModuleSetting = SelectSetting | CheckboxSetting | InputSetting | NumberSetting | ResourceSetting | MediaSourceSetting | DataQuerySetting | FlowSetting | FormSetting;
100
+
101
+ export declare type ModuleSettingsSchema = Record<string, ModuleSetting>;
102
+
103
+ export declare interface NumberSetting extends BaseSetting<number> {
104
+ type: 'number';
105
+ }
106
+
44
107
  declare interface OverlayState {
45
108
  show: boolean;
46
109
  projectId: string;
@@ -48,6 +111,30 @@ declare interface OverlayState {
48
111
  params: Record<string, string>;
49
112
  }
50
113
 
114
+ export declare type ResolveConfig<TSchema extends ModuleSettingsSchema> = {
115
+ [K in keyof TSchema]: ValueTypeFromSetting<TSchema[K]>;
116
+ };
117
+
118
+ export declare interface ResourceSetting extends BaseSetting<string> {
119
+ type: 'resource';
120
+ accept?: string[];
121
+ }
122
+
123
+ /** ----------------- value typing ----------------- **/
124
+ declare type ScalarForType<T extends SettingType> = T extends 'checkbox' ? boolean : T extends 'number' ? number : T extends 'input' | 'textarea' | 'color' | 'resource' | 'dataQuery' ? string : T extends 'mediaSource' ? string : T extends 'select' | 'radio' ? string : T extends 'flow' ? any : T extends 'form' ? any : never;
125
+
126
+ export declare interface SelectSetting extends BaseSetting<string> {
127
+ type: 'select' | 'radio';
128
+ options?: {
129
+ label: string;
130
+ value: string;
131
+ }[];
132
+ predefinedOptions?: 'languages' | 'countries' | 'timezones' | 'currencies';
133
+ multiple?: boolean;
134
+ }
135
+
136
+ export declare type SettingType = 'checkbox' | 'input' | 'textarea' | 'select' | 'radio' | 'number' | 'color' | 'resource' | 'mediaSource' | 'dataQuery' | 'flow' | 'form';
137
+
51
138
  export declare const useBreadcrumbs: () => {};
52
139
 
53
140
  export declare function useCms(): {
@@ -77,7 +164,7 @@ export declare const useFirebaseIntegration: (projectId: string) => {
77
164
 
78
165
  declare type UseFlowBuilder = () => {
79
166
  flowBuilderStack: FlowBuilderState[];
80
- openFlowBuilder: (workflow: any, config?: any) => Promise<any>;
167
+ openFlowBuilder: (workflow: any, config?: any, externalVariables?: any[]) => Promise<any>;
81
168
  closeFlowBuilder: (id: number, result: any) => void;
82
169
  runFlow: (workflow: any, context: any) => Promise<any>;
83
170
  };
@@ -128,6 +215,12 @@ export declare const useMediaLibrary: () => {
128
215
  getStorageContent: (sourceId: string, path?: string) => Promise<any>;
129
216
  };
130
217
 
218
+ declare type UseModule = () => {
219
+ config: Record<string, any>;
220
+ };
221
+
222
+ export declare const useModule: () => ReturnType<UseModule>;
223
+
131
224
  export declare const useModuleOverlay: () => {
132
225
  openInOverlay: (moduleId: string, params?: Record<string, string>) => void;
133
226
  overlayState: OverlayState;
@@ -137,8 +230,8 @@ declare type UseModulePermissions = () => {
137
230
  isAdmin: () => boolean;
138
231
  isSuperAdmin: () => boolean;
139
232
  hasPermission: (permission: string) => boolean;
140
- hasPermissionOR: (...permissions: string[]) => boolean;
141
- hasPermissionAND: (...permissions: string[]) => boolean;
233
+ hasAnyPermission: (...permissions: string[]) => boolean;
234
+ hasEveryPermission: (...permissions: string[]) => boolean;
142
235
  };
143
236
 
144
237
  export declare const useModulePermissions: () => ReturnType<UseModulePermissions>;
@@ -197,6 +290,14 @@ declare type UseUtilsService = () => {
197
290
 
198
291
  export declare const useUtilsService: () => ReturnType<UseUtilsService>;
199
292
 
293
+ declare type ValidateDefaults<TSchema extends ModuleSettingsSchema> = {
294
+ [K in keyof TSchema]: TSchema[K] extends {
295
+ default: infer D;
296
+ } ? (D extends ValueTypeFromSetting<TSchema[K]> ? TSchema[K] : never) : TSchema[K];
297
+ };
298
+
299
+ declare type ValueTypeFromSetting<TSetting extends ModuleSetting> = ArrayizeIfMultiple<ScalarForType<TSetting['type']>, TSetting>;
300
+
200
301
  declare interface Variable {
201
302
  name: string;
202
303
  type: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneclick.dev/cms-kit",
3
- "version": "0.0.52",
3
+ "version": "0.0.55",
4
4
  "type": "module",
5
5
  "main": "./dist/cms-kit.cjs",
6
6
  "module": "./dist/cms-kit.js",
@@ -62,8 +62,9 @@
62
62
  "emoji-mart-vue-fast": "^15.0.4",
63
63
  "graphlib": "^2.1.8",
64
64
  "gsap": "^3.13.0",
65
- "lucide-vue-next": "^0.525.0",
65
+ "lucide-vue-next": "^0.548.0",
66
66
  "motion-v": "^1.5.0",
67
+ "qrcode": "^1.5.4",
67
68
  "reka-ui": "^2.3.2",
68
69
  "tailwind-merge": "^3.2.0",
69
70
  "tailwindcss": "^4.1.11",