@antglobal/voyager-campaign-sdk 0.0.1788950302-dev.3 → 0.0.1788950302-dev.5

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.
@@ -1,16 +1,31 @@
1
1
  /**
2
- * CN 协议中心签约公共流程(mp 与 mp_web 共用,基于 @alipay/agreement-utils);
3
- * 环境判断与工具库加载由各平台注入。
2
+ * CN 协议中心签约公共流程(mp 与 mp_web 共用,直接使用 openRpc);
3
+ * 环境判断与开放通道由各平台注入。
4
4
  */
5
- import type { AgreementUtilsPort } from './types';
6
5
  import type { SignResult } from '../types';
6
+ import type { OpenRpcPayload } from './openRpc';
7
+ interface AgreementResponse {
8
+ success?: boolean;
9
+ userId?: string;
10
+ errorContext?: {
11
+ errorMsg?: string;
12
+ };
13
+ data?: {
14
+ userId?: string;
15
+ signRecordVOS?: Array<{
16
+ agreementId?: string;
17
+ status?: string;
18
+ }>;
19
+ };
20
+ }
7
21
  export interface AgreementSignFlowOptions {
8
22
  /** prod/pre 用正式签约产品,其余环境用联调签约产品 */
9
23
  isProdOrPreEnv: () => boolean;
10
- loadAgreementUtils: () => AgreementUtilsPort;
24
+ openRpc: (payload: OpenRpcPayload) => Promise<AgreementResponse>;
11
25
  }
12
26
  export interface AgreementSignFlow {
13
27
  querySignStatus(): Promise<SignResult>;
14
28
  sign(): Promise<SignResult>;
15
29
  }
16
30
  export declare function createAgreementSignFlow(options: AgreementSignFlowOptions): AgreementSignFlow;
31
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { VoyagerPlatform } from '../types';
2
+ export interface OpenRpcPayload {
3
+ operationType: string;
4
+ requestData: Array<Record<string, unknown>>;
5
+ gateway?: string;
6
+ headers?: Record<string, string>;
7
+ region?: string;
8
+ }
9
+ export declare function rpcError(error: unknown, fallback: string): Error;
10
+ /** CN 开放通道;不回退到普通 rpc。响应保持原样,业务 data 不解包。 */
11
+ export declare function callOpenRpc<TResponse>(platform: VoyagerPlatform, payload: OpenRpcPayload): Promise<TResponse>;
@@ -43,22 +43,3 @@ export interface PlatformAdapter {
43
43
  querySignStatus(): Promise<SignResult>;
44
44
  sign(): Promise<SignResult>;
45
45
  }
46
- export interface AgreementUtilsPort {
47
- querySignRecord(productCd: string): Promise<{
48
- success?: boolean;
49
- data?: {
50
- userId?: string;
51
- signRecordVOS?: Array<{
52
- agreementId?: string;
53
- status?: string;
54
- }>;
55
- };
56
- }>;
57
- signAgreement(options: {
58
- productCd: string;
59
- agreementIds: string[];
60
- }): Promise<{
61
- success?: boolean;
62
- userId?: string;
63
- }>;
64
- }