@choiceform/os-client-core 3.4.5 → 3.4.9

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
@@ -237,16 +237,14 @@ interface CFEnvUi {
237
237
  initNodeTemplate?(
238
238
  template: CFNodeTemplate,
239
239
  state: CFSurveyState,
240
- loop: ICFLoop
241
240
  ): Promise<CFNodeTemplate>;
242
241
  /**
243
- * 加载当前问卷所有使用到的额UI动态插件的方法
242
+ * 预加载当前问卷所有使用到的额UI动态插件的方法
244
243
  * 只有实现了动态模板机制的答题端需要配置这个方法
245
244
  * 如果不配置则什么都不做
246
- * @param theme 主题
247
245
  * @param templates 模板列表
248
246
  */
249
- loadUiTemplates?(theme: CFTheme, templates: string[]): Promise<void>;
247
+ loadUiEntryTemplates?(templates: string[]): Promise<void>;
250
248
  }
251
249
 
252
250
  /**
@@ -382,6 +380,13 @@ interface CFEnvNetWork {
382
380
  * 默认行为:什么也不做
383
381
  */
384
382
  closeSocket?(): void;
383
+ /**
384
+ * 推动socket消息的方法
385
+ * 默认行为:什么也不做
386
+ * @param message 消息名
387
+ * @param payload 附带的数据
388
+ */
389
+ pushSocket?(message:string, payload: object): void;
385
390
  }
386
391
  /**
387
392
  * 授权相关的配置,不同的运行平台有不同的账户系统,所以授权方式也不一样。
@@ -735,6 +740,12 @@ interface CFSetupOptions {
735
740
  * @param message 错误内容
736
741
  */
737
742
  error(message: string): void;
743
+ /**
744
+ * 上传日志的方法,核心包运行时会生成一些有利于追踪已知错误的日志,希望能通过这个方法上传。
745
+ * 如果不设置则不会上传错误。而是在控制台打印出来
746
+ * @param message
747
+ */
748
+ uploadLog?(message: string, level?: 'log' | 'error'):void;
738
749
  /**
739
750
  * 如果在单页模式中有很多题目,进行作答后点击下一题,其中某道题目的答案不满足要求,
740
751
  * 这时候可能这道题目不再滚动条所在的可见范围内,
@@ -795,9 +806,9 @@ interface CFSetupOptions {
795
806
  * 自定义中断回调方法
796
807
  * 当核心包中运行发生异常,或者需要去往外部程序时,会中断答题流程,同时触发调用这个方法
797
808
  * 客户端中可以配置该方法来在此时机做一些自定义的事情。
798
- * 默认行为:什么也不做
809
+ * 默认行为:总是会在方法被调用的一秒内压制系统消息
799
810
  */
800
- customAbort?(relax?: boolean): void;
811
+ customAbort?(): void;
801
812
  /**
802
813
  * 自定义的去往开始页面方法,只有使用web核心包是需要关注这个方法
803
814
  *
@@ -1049,19 +1060,19 @@ interface CFCore extends CFSetupOptions {
1049
1060
  * 多次调用,只有第一次会发送请求
1050
1061
  * 请求的数据会放到缓存中,后面几次获得的都是返回的缓存数据
1051
1062
  */
1052
- fetchStartState(): Promise<CFStartState>;
1063
+ fetchStartState(): Promise<CFStartState | null>;
1053
1064
  /**
1054
1065
  * 获取答题也数据的方法
1055
1066
  * 多次调用,只有第一次会发送请求
1056
1067
  * 请求的数据会放到缓存中,后面几次获得的都是返回的缓存数据
1057
1068
  */
1058
- fetchSurveyState(): Promise<CFSurveyState>;
1069
+ fetchSurveyState(): Promise<CFSurveyState | null>;
1059
1070
  /**
1060
1071
  * 获取奖励页面数据的方法
1061
1072
  * 多次调用,只有第一次会发送请求
1062
1073
  * 请求的数据会放到缓存中,后面几次获得的都是返回的缓存数据
1063
1074
  */
1064
- fetchRewardState(): Promise<CFRewardState>;
1075
+ fetchRewardState(): Promise<CFRewardState | null>;
1065
1076
  /**
1066
1077
  * 获取主题
1067
1078
  */
@@ -2845,6 +2856,10 @@ interface ICFSmallPayload {
2845
2856
  * 测试用例数据
2846
2857
  */
2847
2858
  readonly testCases: ICFTestCase[];
2859
+ /**
2860
+ * 最后发布时间
2861
+ */
2862
+ readonly publishedAt: string;
2848
2863
  }
2849
2864
 
2850
2865
 
@@ -3140,12 +3155,7 @@ type ShouldSetDefault<T> = Required<Pick<T, OptionalKeys<T>>>;
3140
3155
  * 动态UI组件类型
3141
3156
  */
3142
3157
  interface CFUiComponent {
3143
- /**
3144
- * 样式对象
3145
- */
3146
- style: {
3147
- toString(): string;
3148
- };
3158
+
3149
3159
  }
3150
3160
 
3151
3161
  /**
@@ -5798,10 +5808,6 @@ interface CFQuestion extends ICFNode, ICFTypeInfo {
5798
5808
  * 前一道题
5799
5809
  */
5800
5810
  readonly prev: CFQuestion;
5801
- /**
5802
- * 后一道题
5803
- */
5804
- readonly next: CFQuestion;
5805
5811
  /**
5806
5812
  * 编号,该题的唯一代号
5807
5813
  * 如果有该属性,UI要渲染
@@ -6897,6 +6903,7 @@ interface ICFIntroMeta {
6897
6903
  readonly payload_digest: string;
6898
6904
  readonly diagram_url: string;
6899
6905
  readonly langs: ICFRemoteLang[];
6906
+ readonly published_at:string;
6900
6907
  }
6901
6908
 
6902
6909
  /**
@@ -6918,11 +6925,11 @@ interface ICFParsedSmallPayload {
6918
6925
  readonly varStyles: CFVarStyleGroup;
6919
6926
  readonly langs: ICFLang[];
6920
6927
  readonly language: string;
6921
- readonly langStore: any;
6922
6928
  readonly langTable: CFLangTableItem[];
6923
6929
  readonly langResume: boolean;
6924
6930
  readonly testCases: ICFTestCase[];
6925
6931
  readonly disabledLangs: string[];
6932
+ readonly publishedAt: string;
6926
6933
  }
6927
6934
 
6928
6935
  /**
@@ -7676,6 +7683,10 @@ interface ICFStartMiniState extends ICFCustomLogo {
7676
7683
  * 挂载的自动提示数据
7677
7684
  */
7678
7685
  readonly autoCpltGroups: ICFAutoCpltGroup[];
7686
+ /**
7687
+ * 自带的多语言翻译包,可以不需要请求大翻译包就实现开始页面的语言切换。
7688
+ */
7689
+ readonly i18n?: any;
7679
7690
  /**
7680
7691
  * @ignore
7681
7692
  * 自定义logo的图片内容
@@ -7724,6 +7735,14 @@ interface ICFStartMiniState extends ICFCustomLogo {
7724
7735
  */
7725
7736
  interface CFStartState extends ICFTranMiniState, ICFStartMiniIntro, CFStateBase, ICFCustomLogo {
7726
7737
  readonly core?: CFCore;
7738
+ /**
7739
+ * 开始节点的类型
7740
+ */
7741
+ readonly type: NODE_TYPE;
7742
+ /**
7743
+ * 开始节点的名称
7744
+ */
7745
+ readonly nodeName:string;
7727
7746
  /**
7728
7747
  * 开始节点的布局设置
7729
7748
  */
@@ -7814,6 +7833,10 @@ interface CFStartState extends ICFTranMiniState, ICFStartMiniIntro, CFStateBase,
7814
7833
  * 是否正在加载,当该属性为true时,UI需要选人加载中的状态
7815
7834
  */
7816
7835
  readonly nextLoading: boolean;
7836
+ /**
7837
+ * 最后发布地址
7838
+ */
7839
+ readonly publishedAt: string;
7817
7840
  }
7818
7841
 
7819
7842
 
@@ -7997,10 +8020,6 @@ interface CFSurveyState
7997
8020
  * @ignore
7998
8021
  */
7999
8022
  readonly refreshing: boolean;
8000
- /**
8001
- * @ignore
8002
- */
8003
- readonly needRegions: boolean;
8004
8023
  /**
8005
8024
  * @ignore
8006
8025
  */
@@ -9819,6 +9838,10 @@ interface ICFVarRaw {
9819
9838
  readonly name?: string;
9820
9839
  readonly uuid: string;
9821
9840
  readonly request?: ICFRequest;
9841
+ /**
9842
+ * 自带的语言包,为开始页面使用的时候可以自行翻译,而无需去加载翻译大包
9843
+ */
9844
+ readonly i18n?:any;
9822
9845
  }
9823
9846
 
9824
9847
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@choiceform/os-client-core",
3
- "version": "3.4.5",
4
- "description": "choice form survey client core",
3
+ "version": "3.4.9",
4
+ "description": "choiceform survey client core",
5
5
  "main": "./dist/core.js",
6
6
  "repository": "https://github.com/choice-form/os-client-core",
7
7
  "author": "fenyiwudian <laiq@cform.io>",
@@ -42,10 +42,11 @@
42
42
  "@babel/preset-env": "^7.10.4",
43
43
  "@babel/runtime": "^7.12.1",
44
44
  "@types/node-fetch": "^2.5.8",
45
+ "@types/phoenix": "^1.5.3",
45
46
  "@typescript-eslint/eslint-plugin": "^4.31.0",
46
47
  "@typescript-eslint/parser": "^4.31.0",
47
48
  "babel-loader": "^8.1.0",
48
- "cf-auto": "^1.94.0",
49
+ "cf-auto": "^1.96.0",
49
50
  "chokidar": "^3.0.2",
50
51
  "clean-webpack-plugin": "^3.0.0",
51
52
  "copy-webpack-plugin": "^6.0.3",
@@ -60,7 +61,7 @@
60
61
  "messageformat": "^2.3.0",
61
62
  "node-fetch": "^2.6.1",
62
63
  "pako": "^1.0.10",
63
- "phoenix": "^1.5.3",
64
+ "phoenix": "^1.6.2",
64
65
  "prettier": "^2.3.2",
65
66
  "typedoc": "^0.15.0",
66
67
  "ua-parser-js": "^0.7.20"