@choiceform/os-client-core 3.4.57 → 3.5.1-ssr-beta3

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/index.d.ts CHANGED
@@ -904,12 +904,44 @@ interface CFUtil {
904
904
  * @param question 题目
905
905
  */
906
906
  getAnswer(question: CFQuestion): ICFAnswer;
907
+ /**
908
+ * 初始化变量依赖信息
909
+ * @param depends
910
+ */
911
+ initVarDepends(depends: IVarRelatedDependency): void;
912
+ /**
913
+ * 为开始状态中添加动态内容
914
+ */
915
+ addStartStateDynamics(state: CFStartState): void;
916
+ /**
917
+ * 为问卷状态中的添加态内容
918
+ */
919
+ addSurveyStateDynamics(state: CFSurveyState): void;
920
+ /**
921
+ * 为题目状态添加动态内容
922
+ */
923
+ addNodeDynamics(node: CFQuestion): void;
924
+ /**
925
+ * 为选项状态添加动态内容
926
+ */
927
+ addOptionDynamics(option: CFOption): void;
928
+ /**
929
+ * 为图片列表粘附变量解析能力
930
+ * @param imageList
931
+ */
932
+ extendImageListGetter(imageList: ICFImage[]): void;
933
+ /**
934
+ * 加载fake脚本
935
+ * @param startState
936
+ */
937
+ loadFakeServers(startState: CFStartState): Promise<void>;
907
938
  }
908
939
 
909
940
  /**
910
941
  * 核心对象
911
942
  */
912
943
  interface CFCore extends CFSetupOptions {
944
+ customStore: Record<string, any>;
913
945
  /**
914
946
  * 发布的版本号
915
947
  */
@@ -1058,7 +1090,7 @@ interface CFCore extends CFSetupOptions {
1058
1090
  /**
1059
1091
  * 获取主题
1060
1092
  */
1061
- getTheme(): CFTheme;
1093
+ theme: CFTheme;
1062
1094
  /**
1063
1095
  * 初始化实时预览
1064
1096
  */
@@ -6315,8 +6347,7 @@ interface ICFSurveyMeta {
6315
6347
  * @ignore
6316
6348
  * todo 这里面只要包含一个cfpd对象就可以,不要把cfpd的每个属性都解开重新放到这里
6317
6349
  */
6318
- interface ICFParsedStartMeta {
6319
- imageList: ICFImage[];
6350
+ interface ICFParsedStartMeta extends IVarRelatedDependency {
6320
6351
  videoList: CFVideo[];
6321
6352
  nodeList: ICFNode[];
6322
6353
  /**
@@ -6324,11 +6355,9 @@ interface ICFParsedStartMeta {
6324
6355
  */
6325
6356
  surveyId: string;
6326
6357
  theme: ICFThemeConfig;
6327
- variables: ICFVarRaw[];
6328
6358
  surveyMeta: ICFSurveyMeta;
6329
6359
  nodeGroups: CFPDNodeGroup[];
6330
6360
  embedApis: ICFEmbedApi[];
6331
- varStyles: CFVarStyleGroup;
6332
6361
  langs: ICFLang[];
6333
6362
  language: string;
6334
6363
  langTable: CFLangTableItem[];
@@ -6722,6 +6751,7 @@ interface ICFRealtimeGlobalSetting extends CFPDCustomLogo {
6722
6751
  varStyles: CFVarStyleGroup;
6723
6752
  embedApis: ICFEmbedApi[];
6724
6753
  presetRichStyles: CFPDPresetRichStyle[];
6754
+ nodeGroups: ICFNodeGroup[];
6725
6755
  }
6726
6756
 
6727
6757
  /**
@@ -6753,7 +6783,7 @@ interface CFRealtime {
6753
6783
  * + 当[[CFRealtimeState.isGift]]为true,就可以当成[[CFRewardState]]来渲染奖励页面
6754
6784
  * + 否则,就当成[[CFSurveyState]]来渲染答题页面
6755
6785
  */
6756
- interface CFRealtimeState extends CFSurveyState, CFStartState {
6786
+ interface CFRealtimeState extends CFSurveyState, CFStartState, IVarRelatedDependency {
6757
6787
  /**
6758
6788
  * 奖励类型,预览奖励页面时才存在
6759
6789
  */
@@ -7100,7 +7130,9 @@ interface ICFStartMiniState extends ICFCustomLogo {
7100
7130
  * 以及一个开始答题的开始按钮.
7101
7131
  * 开始按钮点击后应该调用[[CFUIEventHandler.handleNextClick]]方法
7102
7132
  */
7103
- interface CFStartState extends ICFTranMiniState, ICFMiniState, CFStateBase, ICFCustomLogo {
7133
+ interface CFStartState extends ICFTranMiniState, ICFMiniState, CFStateBase, ICFCustomLogo, IVarRelatedDependency {
7134
+ embedApis: ICFEmbedApi[];
7135
+ nodeGroups: ICFNodeGroup[];
7104
7136
  core?: CFCore;
7105
7137
  /**
7106
7138
  * 开始节点的类型
@@ -7237,12 +7269,29 @@ interface ICFContext {
7237
7269
  question?: CFQuestion;
7238
7270
  }
7239
7271
 
7272
+ interface IVarRelatedDependency {
7273
+ /**
7274
+ * 样式组__
7275
+ */
7276
+ varStyles: CFVarStyleGroup;
7277
+ /**
7278
+ * 图片列表__
7279
+ */
7280
+ imageList: ICFImage[];
7281
+ /**
7282
+ * 选项列表__
7283
+ */
7284
+ variables: ICFVarRaw[];
7285
+ }
7286
+
7240
7287
  /**
7241
7288
  * 答题总状态
7242
7289
  * 答题页面数据
7243
7290
  * 使用[[CFSurveyState.nodes]]来渲染当前需要渲染的题目
7244
7291
  */
7245
- interface CFSurveyState extends ICFTranMiniState, ICFStartMiniState, ICFMiniState, CFStateBase {
7292
+ interface CFSurveyState extends ICFTranMiniState, ICFStartMiniState, ICFMiniState, CFStateBase, IVarRelatedDependency {
7293
+ embedApis: ICFEmbedApi[];
7294
+ nodeGroups: ICFNodeGroup[];
7246
7295
  /**
7247
7296
  * 进入问卷的模式
7248
7297
  */
@@ -8969,16 +9018,6 @@ interface CFImageInNode extends CFPDNodeImage {
8969
9018
  */
8970
9019
  // type?: IMG_REF_TYPE;
8971
9020
  }
8972
-
8973
- /**
8974
- * @todo 确认一下这个类型真的正确??? 怎么感觉好像已经不对了
8975
- */
8976
- declare const enum IMG_REF_TYPE {
8977
- /**
8978
- * 新增媒体这个类型
8979
- */
8980
- MEDIA = 'media',
8981
- }
8982
9021
  /**
8983
9022
  * 图片信息
8984
9023
  * @ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choiceform/os-client-core",
3
- "version": "3.4.57",
3
+ "version": "3.5.1-ssr-beta3",
4
4
  "description": "choiceform survey client core",
5
5
  "main": "./dist/core.js",
6
6
  "repository": "https://github.com/choice-form/os-client-core",
@@ -9,6 +9,7 @@
9
9
  "scripts": {
10
10
  "test": "node_modules/.bin/cf-auto --watch",
11
11
  "start": "webpack-dev-server --env NODE_ENV=local --mode=development",
12
+ "start-node": "webpack-dev-server --config ./ssr.webpack.config.js --env NODE_ENV=local --mode=development",
12
13
  "prod": "webpack --env NODE_ENV=prod --mode=production",
13
14
  "staging": "webpack --env NODE_ENV=staging --mode=production",
14
15
  "local": "webpack --env NODE_ENV=local --mode=development",