@smartex.com/modules-utils 0.1.1 → 0.1.3
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/base/index.d.ts +4 -4
- package/dist/survey/index.d.ts +10 -10
- package/package.json +13 -2
package/dist/base/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type ModuleProps<T extends object = object> = {
|
|
5
5
|
token: string;
|
|
6
6
|
lang?: 'ru' | 'kz' | 'en';
|
|
7
7
|
theme?: string;
|
|
@@ -12,11 +12,11 @@ interface ModuleProps<T extends object = object> {
|
|
|
12
12
|
};
|
|
13
13
|
onSuccess?: () => void;
|
|
14
14
|
onError?: (errors: string[]) => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
15
|
+
};
|
|
16
|
+
type ModuleController<T extends object = object> = {
|
|
17
17
|
mount: (targetNodeId: string, props: ModuleProps<T>) => void;
|
|
18
18
|
unmount: () => void;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
|
|
21
21
|
declare const createModuleController: <E extends object = object>(Module: ComponentType<ModuleProps<E>>) => ModuleController<E>;
|
|
22
22
|
|
package/dist/survey/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ComponentType, ReactNode } from 'react';
|
|
|
2
2
|
import { SurveyResultEntry, CtxStoreWithSurvey } from '@smartex.com/ctx';
|
|
3
3
|
|
|
4
4
|
type Lang = 'ru' | 'kz' | 'en';
|
|
5
|
-
|
|
5
|
+
type SurveyAnswer = {
|
|
6
6
|
code: number;
|
|
7
7
|
text: {
|
|
8
8
|
ru: string | null;
|
|
@@ -24,8 +24,8 @@ interface SurveyAnswer {
|
|
|
24
24
|
isMandatory: number;
|
|
25
25
|
isCustomRouting: boolean;
|
|
26
26
|
isCustomInput: boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
27
|
+
};
|
|
28
|
+
type SurveyQuestion = {
|
|
29
29
|
code: number;
|
|
30
30
|
text: {
|
|
31
31
|
ru: string | null;
|
|
@@ -48,8 +48,8 @@ interface SurveyQuestion {
|
|
|
48
48
|
isFirst: boolean;
|
|
49
49
|
isPrevStepDisabled: boolean;
|
|
50
50
|
isModule: boolean;
|
|
51
|
-
}
|
|
52
|
-
|
|
51
|
+
};
|
|
52
|
+
type SurveyMountProps<T extends object = object> = {
|
|
53
53
|
token: string;
|
|
54
54
|
lang?: Lang;
|
|
55
55
|
theme?: string;
|
|
@@ -66,7 +66,7 @@ interface SurveyMountProps<T extends object = object> {
|
|
|
66
66
|
routeToQuestion: (questionCode: number) => void;
|
|
67
67
|
onSurveyFinish: () => void;
|
|
68
68
|
onError: (errors: string[]) => void;
|
|
69
|
-
}
|
|
69
|
+
};
|
|
70
70
|
type SurveyComponentProps = {
|
|
71
71
|
question: SurveyMountProps['question'];
|
|
72
72
|
getSettings: <T = unknown>(key?: string) => [T | null, string | null];
|
|
@@ -77,15 +77,15 @@ type SurveyComponentProps = {
|
|
|
77
77
|
onError: (errors: string[]) => void;
|
|
78
78
|
onSurveyFinish: SurveyMountProps['onSurveyFinish'];
|
|
79
79
|
};
|
|
80
|
-
|
|
80
|
+
type SurveyModuleController<E extends object = object> = {
|
|
81
81
|
mount: (targetNodeId: string, props: SurveyMountProps<E>) => void;
|
|
82
82
|
unmount: () => void;
|
|
83
|
-
}
|
|
84
|
-
|
|
83
|
+
};
|
|
84
|
+
type SurveyModuleWrapperConfig = {
|
|
85
85
|
schema: Record<string, unknown>;
|
|
86
86
|
defaultLang: Lang;
|
|
87
87
|
logicScreenAliases: string[];
|
|
88
|
-
}
|
|
88
|
+
};
|
|
89
89
|
type SurveyCtxStore<S extends Record<string, unknown>> = CtxStoreWithSurvey<S>;
|
|
90
90
|
|
|
91
91
|
type SurveyLayout = ComponentType<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartex.com/modules-utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -15,8 +15,19 @@
|
|
|
15
15
|
"import": "./dist/survey/index.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
+
"typesVersions": {
|
|
19
|
+
"*": {
|
|
20
|
+
"base": [
|
|
21
|
+
"dist/base/index.d.ts"
|
|
22
|
+
],
|
|
23
|
+
"survey": [
|
|
24
|
+
"dist/survey/index.d.ts"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
18
28
|
"scripts": {
|
|
19
|
-
"
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"build": "npm run typecheck && tsup",
|
|
20
31
|
"prepublishOnly": "npm run build"
|
|
21
32
|
},
|
|
22
33
|
"peerDependencies": {
|