@antglobal/voyager-campaign-sdk 0.0.1788950302-dev.6 → 0.0.1788950302-dev.8
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/adapter/agreementSign.d.ts +4 -19
- package/dist/adapter/types.d.ts +23 -8
- package/dist/core/locale.d.ts +19 -0
- package/dist/core/rawRequest.d.ts +2 -2
- package/dist/mp_web.js +11 -11
- package/dist/types.d.ts +0 -8
- package/package.json +3 -8
- package/dist/adapter/mp.d.ts +0 -2
- package/dist/adapter/openRpc.d.ts +0 -11
- package/dist/adapter/requestRouting.d.ts +0 -9
- package/dist/core/mock.d.ts +0 -5
- package/dist/mp/index.d.ts +0 -2
- package/dist/mp.js +0 -9
- package/mp.d.ts +0 -1
- package/mp.js +0 -4
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CN
|
|
3
|
-
*
|
|
2
|
+
* CN 协议中心签约公共流程(基于 @alipay/agreement-utils);
|
|
3
|
+
* 环境判断与工具库加载由本端注入。
|
|
4
4
|
*/
|
|
5
|
+
import type { AgreementUtilsPort } from './types';
|
|
5
6
|
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
|
-
}
|
|
21
7
|
export interface AgreementSignFlowOptions {
|
|
22
8
|
/** prod/pre 用正式签约产品,其余环境用联调签约产品 */
|
|
23
9
|
isProdOrPreEnv: () => boolean;
|
|
24
|
-
|
|
10
|
+
loadAgreementUtils: () => AgreementUtilsPort;
|
|
25
11
|
}
|
|
26
12
|
export interface AgreementSignFlow {
|
|
27
13
|
querySignStatus(): Promise<SignResult>;
|
|
28
14
|
sign(): Promise<SignResult>;
|
|
29
15
|
}
|
|
30
16
|
export declare function createAgreementSignFlow(options: AgreementSignFlowOptions): AgreementSignFlow;
|
|
31
|
-
export {};
|
package/dist/adapter/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SignResult, SystemInfo, VoyagerPlatform, VoyagerRequestOptions
|
|
1
|
+
import type { SignResult, SystemInfo, VoyagerPlatform, VoyagerRequestOptions } from '../types';
|
|
2
2
|
export type { VoyagerPlatform };
|
|
3
3
|
export interface RpcPayload {
|
|
4
4
|
operationType: string;
|
|
@@ -12,9 +12,6 @@ export interface RpcPayload {
|
|
|
12
12
|
gateway?: string;
|
|
13
13
|
/** PRE 联调环境标识 */
|
|
14
14
|
workspaceId?: string;
|
|
15
|
-
/** 有效业务请求环境;内部签约请求可省略。 */
|
|
16
|
-
env?: string;
|
|
17
|
-
routingInfo?: VoyagerRequestEnvInfo;
|
|
18
15
|
}
|
|
19
16
|
export type RequestInput<TParams extends Record<string, unknown> = Record<string, unknown>> = VoyagerRequestOptions<TParams>;
|
|
20
17
|
export interface StoragePort {
|
|
@@ -23,7 +20,7 @@ export interface StoragePort {
|
|
|
23
20
|
remove(key: string): Promise<void>;
|
|
24
21
|
}
|
|
25
22
|
/**
|
|
26
|
-
* 平台适配器:
|
|
23
|
+
* 平台适配器:mp_web 实现端能力对接,共享核心不直接触碰端能力
|
|
27
24
|
*/
|
|
28
25
|
export interface PlatformAdapter {
|
|
29
26
|
platform: VoyagerPlatform;
|
|
@@ -31,15 +28,33 @@ export interface PlatformAdapter {
|
|
|
31
28
|
/** 发送前对 payload 做平台级加工(如 mp_web 联调环境的网关切换与请求头注入) */
|
|
32
29
|
decoratePayload?(payload: RpcPayload): Promise<RpcPayload> | RpcPayload;
|
|
33
30
|
getSystemInfo(): Promise<SystemInfo>;
|
|
34
|
-
/** 钱包标识(对齐 biz-base 取 hylid client
|
|
31
|
+
/** 钱包标识(对齐 biz-base 取 hylid client),未识别兜底 unknown */
|
|
35
32
|
getClientName(): string;
|
|
36
|
-
/**
|
|
33
|
+
/** 当前语言原始值(hylid getCurrentLanguage) */
|
|
37
34
|
getLocale(systemInfo: SystemInfo): string;
|
|
38
35
|
/** 可选:获取风控 tokenId(envInfo.tokenId),未提供时不注入 */
|
|
39
36
|
getAppToken?(): Promise<string | undefined>;
|
|
40
37
|
storage: StoragePort;
|
|
41
38
|
fetchWhitelistConfig(): Promise<unknown>;
|
|
42
|
-
fetchMockConfig?(): Promise<unknown>;
|
|
43
39
|
querySignStatus(): Promise<SignResult>;
|
|
44
40
|
sign(): Promise<SignResult>;
|
|
45
41
|
}
|
|
42
|
+
export interface AgreementUtilsPort {
|
|
43
|
+
querySignRecord(productCd: string): Promise<{
|
|
44
|
+
success?: boolean;
|
|
45
|
+
data?: {
|
|
46
|
+
userId?: string;
|
|
47
|
+
signRecordVOS?: Array<{
|
|
48
|
+
agreementId?: string;
|
|
49
|
+
status?: string;
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
signAgreement(options: {
|
|
54
|
+
productCd: string;
|
|
55
|
+
agreementIds: string[];
|
|
56
|
+
}): Promise<{
|
|
57
|
+
success?: boolean;
|
|
58
|
+
userId?: string;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** iQuic 平台语言模型,对齐 aplus-biz-base i18n/interface.ts */
|
|
2
|
+
export declare const Language: {
|
|
3
|
+
readonly zh_CN: "zh_CN";
|
|
4
|
+
readonly zh_HK: "zh_HK";
|
|
5
|
+
readonly en_US: "en_US";
|
|
6
|
+
readonly th_TH: "th_TH";
|
|
7
|
+
readonly ko_KR: "ko_KR";
|
|
8
|
+
readonly it_IT: "it_IT";
|
|
9
|
+
readonly in_ID: "in_ID";
|
|
10
|
+
};
|
|
11
|
+
export type Language = (typeof Language)[keyof typeof Language];
|
|
12
|
+
/**
|
|
13
|
+
* 按钱包匹配支持的语言,对齐 aplus-biz-base matchSiteSupportedLanguage:
|
|
14
|
+
* 1. 归一化原始语言(连字符转下划线、id→in、region 大写)
|
|
15
|
+
* 2. 全匹配(忽略大小写)→ 返回
|
|
16
|
+
* 3. 前缀匹配 → 返回
|
|
17
|
+
* 4. 兜底 → 返回列表第一个或 en_US
|
|
18
|
+
*/
|
|
19
|
+
export declare function matchWalletSupportedLanguage(clientName: string, rawLocale: string): Language;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlatformAdapter } from '../adapter/types';
|
|
2
|
-
import type { VoyagerEnvInfo
|
|
2
|
+
import type { VoyagerEnvInfo } from '../types';
|
|
3
3
|
import { createEnvInfoLoader } from './envInfo';
|
|
4
|
-
export type RawRequestFn = <TResponse>(serviceCode: string, params: Record<string, unknown
|
|
4
|
+
export type RawRequestFn = <TResponse>(serviceCode: string, params: Record<string, unknown>) => Promise<TResponse>;
|
|
5
5
|
export declare function createRawRequest(adapter: PlatformAdapter, getEnvInfo: () => Promise<VoyagerEnvInfo>): RawRequestFn;
|
|
6
6
|
export { createEnvInfoLoader };
|