@o2s/modules.surveyjs 0.1.1 → 0.2.1
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/frontend/frontend/Survey.d.ts +0 -9
- package/dist/frontend/frontend/Survey.d.ts.map +1 -1
- package/dist/frontend/frontend/Survey.js +5 -13
- package/dist/frontend/frontend/Survey.types.d.ts +1 -1
- package/dist/frontend/frontend/Survey.types.d.ts.map +1 -1
- package/dist/frontend/frontend/lib.d.ts +12 -0
- package/dist/frontend/frontend/lib.d.ts.map +1 -0
- package/dist/frontend/frontend/lib.js +11 -0
- package/dist/tsconfig.api.tsbuildinfo +1 -1
- package/dist/tsconfig.frontend.tsbuildinfo +1 -1
- package/dist/tsconfig.sdk.tsbuildinfo +1 -1
- package/package.json +4 -2
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import './Elements/CustomSurveyNavigationButton';
|
|
3
|
-
import './Elements/CustomSurveyPanel';
|
|
4
|
-
import './Elements/CustomSurveyQuestion';
|
|
5
|
-
import './Questions/CustomSurveyQuestionBoolean';
|
|
6
|
-
import './Questions/CustomSurveyQuestionCheckbox';
|
|
7
|
-
import './Questions/CustomSurveyQuestionComment';
|
|
8
|
-
import './Questions/CustomSurveyQuestionDropdown';
|
|
9
|
-
import './Questions/CustomSurveyQuestionRadioGroup';
|
|
10
|
-
import './Questions/CustomSurveyQuestionText';
|
|
11
2
|
import { SurveyProps } from './Survey.types';
|
|
12
3
|
export declare const Survey: React.FC<SurveyProps>;
|
|
13
4
|
//# sourceMappingURL=Survey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Survey.d.ts","sourceRoot":"","sources":["../../../src/frontend/Survey.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Survey.d.ts","sourceRoot":"","sources":["../../../src/frontend/Survey.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAa1E,OAAO,EAAwB,WAAW,EAAe,MAAM,gBAAgB,CAAC;AA8EhF,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAkExC,CAAC"}
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import dynamic from 'next/dynamic';
|
|
2
3
|
import React, { startTransition, useActionState, useEffect } from 'react';
|
|
3
|
-
import { Model as SurveyJsModel } from 'survey-core';
|
|
4
|
-
import { Survey as SurveySDK } from 'survey-react-ui';
|
|
5
4
|
import { cn } from '@o2s/ui/lib/utils';
|
|
6
5
|
import { toast } from '@o2s/ui/hooks/use-toast';
|
|
7
6
|
import { Loading } from '@o2s/ui/components/Loading';
|
|
8
7
|
import { LoadingOverlay } from '@o2s/ui/elements/loading-overlay';
|
|
9
8
|
import { sdk } from '../sdk';
|
|
10
|
-
import
|
|
11
|
-
import './Elements/CustomSurveyPanel';
|
|
12
|
-
import './Elements/CustomSurveyQuestion';
|
|
13
|
-
import './Questions/CustomSurveyQuestionBoolean';
|
|
14
|
-
import './Questions/CustomSurveyQuestionCheckbox';
|
|
15
|
-
import './Questions/CustomSurveyQuestionComment';
|
|
16
|
-
import './Questions/CustomSurveyQuestionDropdown';
|
|
17
|
-
import './Questions/CustomSurveyQuestionRadioGroup';
|
|
18
|
-
import './Questions/CustomSurveyQuestionText';
|
|
9
|
+
const SurveySDK = dynamic(() => import('./lib').then((module) => module.SurveySDK));
|
|
19
10
|
const initialState = {
|
|
20
11
|
isLoading: true,
|
|
21
12
|
error: null,
|
|
22
13
|
model: null,
|
|
23
14
|
};
|
|
24
|
-
const createSurveyModel = (schema, locale, onComplete) => {
|
|
15
|
+
const createSurveyModel = async (schema, locale, onComplete) => {
|
|
16
|
+
const SurveyJsModel = await import('./lib').then((module) => module.SurveyJsModel);
|
|
25
17
|
const survey = new SurveyJsModel(schema);
|
|
26
18
|
survey.loadingHtml = '';
|
|
27
19
|
survey.locale = locale;
|
|
@@ -107,7 +99,7 @@ export const Survey = ({ code, labels, locale, accessToken }) => {
|
|
|
107
99
|
if (!schema) {
|
|
108
100
|
throw new Error(`No survey with code '${code}' found`);
|
|
109
101
|
}
|
|
110
|
-
const model = createSurveyModel(schema, locale, handleSubmit);
|
|
102
|
+
const model = await createSurveyModel(schema, locale, handleSubmit);
|
|
111
103
|
dispatch({ type: 'SET_MODEL', payload: model });
|
|
112
104
|
}
|
|
113
105
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Survey.types.d.ts","sourceRoot":"","sources":["../../../src/frontend/Survey.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Survey.types.d.ts","sourceRoot":"","sources":["../../../src/frontend/Survey.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,WAAW,GAAG;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAClB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC;AAE5C,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,MAAM;IACnB,MAAM,EAAE;QACJ,YAAY,EAAE,WAAW,CAAC;KAC7B,CAAC;CACL"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import './Elements/CustomSurveyNavigationButton';
|
|
2
|
+
import './Elements/CustomSurveyPanel';
|
|
3
|
+
import './Elements/CustomSurveyQuestion';
|
|
4
|
+
import './Questions/CustomSurveyQuestionBoolean';
|
|
5
|
+
import './Questions/CustomSurveyQuestionCheckbox';
|
|
6
|
+
import './Questions/CustomSurveyQuestionComment';
|
|
7
|
+
import './Questions/CustomSurveyQuestionDropdown';
|
|
8
|
+
import './Questions/CustomSurveyQuestionRadioGroup';
|
|
9
|
+
import './Questions/CustomSurveyQuestionText';
|
|
10
|
+
export { Model as SurveyJsModel } from 'survey-core';
|
|
11
|
+
export { Survey as SurveySDK } from 'survey-react-ui';
|
|
12
|
+
//# sourceMappingURL=lib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../../src/frontend/lib.ts"],"names":[],"mappings":"AAAA,OAAO,yCAAyC,CAAC;AACjD,OAAO,8BAA8B,CAAC;AACtC,OAAO,iCAAiC,CAAC;AACzC,OAAO,yCAAyC,CAAC;AACjD,OAAO,0CAA0C,CAAC;AAClD,OAAO,yCAAyC,CAAC;AACjD,OAAO,0CAA0C,CAAC;AAClD,OAAO,4CAA4C,CAAC;AACpD,OAAO,sCAAsC,CAAC;AAE9C,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './Elements/CustomSurveyNavigationButton';
|
|
2
|
+
import './Elements/CustomSurveyPanel';
|
|
3
|
+
import './Elements/CustomSurveyQuestion';
|
|
4
|
+
import './Questions/CustomSurveyQuestionBoolean';
|
|
5
|
+
import './Questions/CustomSurveyQuestionCheckbox';
|
|
6
|
+
import './Questions/CustomSurveyQuestionComment';
|
|
7
|
+
import './Questions/CustomSurveyQuestionDropdown';
|
|
8
|
+
import './Questions/CustomSurveyQuestionRadioGroup';
|
|
9
|
+
import './Questions/CustomSurveyQuestionText';
|
|
10
|
+
export { Model as SurveyJsModel } from 'survey-core';
|
|
11
|
+
export { Survey as SurveySDK } from 'survey-react-ui';
|