@worldfirst/worldfirst-js 0.0.1775118337-dev.8 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldfirst/worldfirst-js",
3
- "version": "0.0.1775118337-dev.8",
3
+ "version": "1.0.1",
4
4
  "description": "worldfirst sdk",
5
5
  "exports": {
6
6
  ".": {
package/types.d.ts CHANGED
@@ -86,7 +86,7 @@ declare abstract class BaseElement<Config extends BaseElementConfig = BaseElemen
86
86
  /**
87
87
  * 卸载元素
88
88
  */
89
- umount(): void;
89
+ unmount(): void;
90
90
  /* Excluded from this release type: isSingleMode */
91
91
  /**
92
92
  * 监听消息
@@ -236,6 +236,10 @@ declare interface DefaultAppearanceProps {
236
236
  rules: string;
237
237
  }
238
238
 
239
+ declare const ELEMENT_TYPE: {
240
+ ONBOARD: string;
241
+ };
242
+
239
243
  /**
240
244
  * @description 元素列表项类型
241
245
  */
@@ -246,6 +250,8 @@ declare type ElementListItemType = iBaseElementClass | {
246
250
 
247
251
  declare type ElementMode = 'SINGLE' | 'GROUP';
248
252
 
253
+ export declare type ElementTypes = keyof typeof ELEMENT_TYPE;
254
+
249
255
  declare interface ErrorPayload<Code extends string = string> {
250
256
  source: ErrorSource;
251
257
  code: Code;
@@ -332,13 +338,51 @@ declare type OnboardElementConfig = BaseElementConfig<OnboardAppConfig>;
332
338
  /**
333
339
  * @description Onboard element events
334
340
  */
335
- export declare type OnboardElementEvents = WorldFirstBridgeEventMap<OnboardAppConfig, OnboardSubmitParams>;
341
+ export declare interface OnboardElementEvents extends WorldFirstBridgeEventMap<OnboardAppConfig, OnboardSubmitParams> {
342
+ stepChange: {
343
+ hasNext: boolean;
344
+ hasPre: boolean;
345
+ hasTemporaryStorage: boolean;
346
+ hasSubmit: boolean;
347
+ nodeId: string;
348
+ /**
349
+ * 是否是上一步
350
+ */
351
+ stepBack: boolean;
352
+ };
353
+ updateTheme: Record<string, string>;
354
+ }
336
355
 
337
356
  /**
338
- * @description The submit params
357
+ * @description submit params
339
358
  */
340
359
  export declare interface OnboardSubmitParams {
341
- [key: string]: any;
360
+ /**
361
+ * @description 提交是否成功
362
+ */
363
+ success: boolean;
364
+ /**
365
+ * @description 返回的数据
366
+ */
367
+ data?: Record<string, any>;
368
+ /**
369
+ * @description 错误信息
370
+ */
371
+ error?: {
372
+ source: string;
373
+ code: string;
374
+ message: string;
375
+ reason: string;
376
+ traceId?: string;
377
+ };
378
+ /**
379
+ * @description 兼容旧版本的 result 字段
380
+ */
381
+ result?: 'success' | 'fail';
382
+ /**
383
+ * @description 兼容旧版本的 errorMessage 字段
384
+ */
385
+ errorMessage?: string;
342
386
  }
343
387
 
344
388
  /**
@@ -401,6 +445,12 @@ declare interface PreLoadConfig {
401
445
  * 每个值与 createElement 的 type 参数一致,如 'Onboard'、'Vaulting'。
402
446
  */
403
447
  elements?: string[];
448
+ /**
449
+ * @description 语言标识,用于替换 manifest 中多语言资源 URL 的 {lang} 占位符。
450
+ * 支持的值与 embeddedSDK 的 VALID_LANGUAGES 一致,如 'zh-CN'、'en-US' 等。
451
+ * 若未传入或不在支持列表中,默认使用 'zh-CN'。
452
+ */
453
+ locale?: string;
404
454
  }
405
455
 
406
456
  /**
@@ -192,7 +192,7 @@ declare abstract class BaseElement<Config extends BaseElementConfig = BaseElemen
192
192
  /**
193
193
  * 卸载元素
194
194
  */
195
- umount(): void;
195
+ unmount(): void;
196
196
  /**
197
197
  * 独立模式,需要实现submit
198
198
  * @internal 内部属性不暴露给商户
@@ -462,6 +462,10 @@ declare interface DefaultAppearanceProps {
462
462
  rules: string;
463
463
  }
464
464
 
465
+ declare const ELEMENT_TYPE: {
466
+ ONBOARD: string;
467
+ };
468
+
465
469
  /**
466
470
  * @description 元素列表项类型
467
471
  */
@@ -472,6 +476,8 @@ declare type ElementListItemType = iBaseElementClass | {
472
476
 
473
477
  declare type ElementMode = 'SINGLE' | 'GROUP';
474
478
 
479
+ export declare type ElementTypes = keyof typeof ELEMENT_TYPE;
480
+
475
481
  declare interface ErrorPayload<Code extends string = string> {
476
482
  source: ErrorSource;
477
483
  code: Code;
@@ -558,13 +564,51 @@ declare type OnboardElementConfig = BaseElementConfig<OnboardAppConfig>;
558
564
  /**
559
565
  * @description Onboard element events
560
566
  */
561
- export declare type OnboardElementEvents = WorldFirstBridgeEventMap<OnboardAppConfig, OnboardSubmitParams>;
567
+ export declare interface OnboardElementEvents extends WorldFirstBridgeEventMap<OnboardAppConfig, OnboardSubmitParams> {
568
+ stepChange: {
569
+ hasNext: boolean;
570
+ hasPre: boolean;
571
+ hasTemporaryStorage: boolean;
572
+ hasSubmit: boolean;
573
+ nodeId: string;
574
+ /**
575
+ * 是否是上一步
576
+ */
577
+ stepBack: boolean;
578
+ };
579
+ updateTheme: Record<string, string>;
580
+ }
562
581
 
563
582
  /**
564
- * @description The submit params
583
+ * @description submit params
565
584
  */
566
585
  export declare interface OnboardSubmitParams {
567
- [key: string]: any;
586
+ /**
587
+ * @description 提交是否成功
588
+ */
589
+ success: boolean;
590
+ /**
591
+ * @description 返回的数据
592
+ */
593
+ data?: Record<string, any>;
594
+ /**
595
+ * @description 错误信息
596
+ */
597
+ error?: {
598
+ source: string;
599
+ code: string;
600
+ message: string;
601
+ reason: string;
602
+ traceId?: string;
603
+ };
604
+ /**
605
+ * @description 兼容旧版本的 result 字段
606
+ */
607
+ result?: 'success' | 'fail';
608
+ /**
609
+ * @description 兼容旧版本的 errorMessage 字段
610
+ */
611
+ errorMessage?: string;
568
612
  }
569
613
 
570
614
  /**
@@ -630,6 +674,12 @@ declare interface PreLoadConfig {
630
674
  * 每个值与 createElement 的 type 参数一致,如 'Onboard'、'Vaulting'。
631
675
  */
632
676
  elements?: string[];
677
+ /**
678
+ * @description 语言标识,用于替换 manifest 中多语言资源 URL 的 {lang} 占位符。
679
+ * 支持的值与 embeddedSDK 的 VALID_LANGUAGES 一致,如 'zh-CN'、'en-US' 等。
680
+ * 若未传入或不在支持列表中,默认使用 'zh-CN'。
681
+ */
682
+ locale?: string;
633
683
  }
634
684
 
635
685
  /**