@pnt-team/pnt-component-frontend 0.0.113 → 0.0.120
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/lib/cjs/api/cos.js +24 -15
- package/lib/cjs/api/index.d.ts +3 -8
- package/lib/cjs/api/index.js +1 -4
- package/lib/cjs/api/types/index.d.ts +20 -30
- package/lib/cjs/components/PntBusinessSelect/index.d.ts +0 -5
- package/lib/cjs/components/PntBusinessSelect/index.js +1 -11
- package/lib/cjs/components/PntRegionSelect/index.d.ts +0 -9
- package/lib/cjs/components/PntRegionSelect/index.js +50 -38
- package/lib/cjs/components/PntRegionSelect/types.d.ts +10 -6
- package/lib/cjs/config.d.ts +26 -2
- package/lib/cjs/config.js +5 -2
- package/lib/cjs/index.d.ts +3 -1
- package/lib/cjs/index.js +7 -0
- package/lib/esm/api/index.d.ts +3 -8
- package/lib/esm/api/index.js +2 -8
- package/lib/esm/api/types/index.d.ts +20 -30
- package/lib/esm/components/PntBusinessSelect/index.d.ts +0 -5
- package/lib/esm/components/PntBusinessSelect/index.js +1 -3
- package/lib/esm/components/PntRegionSelect/index.d.ts +0 -9
- package/lib/esm/components/PntRegionSelect/index.js +48 -43
- package/lib/esm/components/PntRegionSelect/types.d.ts +10 -6
- package/lib/esm/components/PntRegionSelect/types.js +0 -2
- package/lib/esm/config.d.ts +26 -2
- package/lib/esm/config.js +13 -1
- package/lib/esm/index.d.ts +3 -1
- package/lib/esm/index.js +2 -0
- package/lib/umd/pnt-component-frontend.min.js +1 -1
- package/package.json +1 -1
|
@@ -4,23 +4,31 @@
|
|
|
4
4
|
* 数据来源: https://api-pnt.intlgame.com
|
|
5
5
|
*/
|
|
6
6
|
export interface BusinessSelectListBody {
|
|
7
|
-
/**
|
|
8
|
-
business_access_method?: number;
|
|
9
|
-
/** 业务类型列表:1-正式业务,2-测试业务;SmartLink业务始终不返回 */
|
|
7
|
+
/** 业务类型列表,仅 game_list、game_list_option 场景支持:1-正式业务,2-测试业务 */
|
|
10
8
|
business_types?: number[];
|
|
9
|
+
/** 云控类型列表,仅 game_list、game_list_option 场景支持:1-INTL Project,2-LI PASS Project */
|
|
10
|
+
cloudCtrlType?: number[];
|
|
11
|
+
/** 集群类型列表,仅 game_list、game_list_option 场景支持:1-公有,2-私有,3-未配置 */
|
|
12
|
+
clusterTypes?: number[];
|
|
11
13
|
/** 需要返回的字段;未传时使用场景默认字段,仅支持服务端白名单字段 */
|
|
12
14
|
fields?: string[];
|
|
13
|
-
/**
|
|
15
|
+
/** 业务ID列表,仅 game_list、game_list_option 场景支持 */
|
|
14
16
|
game_ids?: string[];
|
|
15
17
|
/** 业务ID、中文名称或英文名称的模糊匹配关键字 */
|
|
16
18
|
keyword?: string;
|
|
19
|
+
/** 登录器类型列表,仅 game_list、game_list_option 场景支持 */
|
|
20
|
+
lander_type?: number[];
|
|
21
|
+
/** LI PASS 开关列表,仅 game_list、game_list_option 场景支持:1-开启,2-未开启 */
|
|
22
|
+
lipSwitches?: number[];
|
|
17
23
|
/** 当前页 */
|
|
18
24
|
pageNum?: number;
|
|
19
25
|
/** 每页条数 */
|
|
20
26
|
pageSize?: number;
|
|
21
|
-
/**
|
|
27
|
+
/** 平台列表,仅 game_list、game_list_option 场景支持 */
|
|
28
|
+
platform?: string[];
|
|
29
|
+
/** 下拉场景:game_list-业务列表,game_list_option-业务选择,compliance_age-合规年龄,custom_region-自定义合规地域,sdk-SDK定制 */
|
|
22
30
|
scene?: string;
|
|
23
|
-
/**
|
|
31
|
+
/** 业务状态列表,仅 game_list、game_list_option 场景支持:3-线上运营,4-接入中,5-中途结项,6-已下线 */
|
|
24
32
|
statuses?: number[];
|
|
25
33
|
/** 总条数 */
|
|
26
34
|
total?: number;
|
|
@@ -34,6 +42,8 @@ export interface BusinessSelectListResponseListItem {
|
|
|
34
42
|
business_type?: number;
|
|
35
43
|
/** 当前场景是否可创建;仅 compliance_age、custom_region 场景有意义 */
|
|
36
44
|
creatable?: boolean;
|
|
45
|
+
/** 当前业务是否禁用合规年龄认证;仅 compliance_age 场景有意义 */
|
|
46
|
+
disabled?: boolean;
|
|
37
47
|
/** 业务ID */
|
|
38
48
|
game_id?: string;
|
|
39
49
|
/** 业务接口开发负责人;SDK场景可返回 */
|
|
@@ -79,16 +89,14 @@ export interface BusinessGameInfoHighSecurityDecryptBody {
|
|
|
79
89
|
}
|
|
80
90
|
export type BusinessGameInfoHighSecurityDecryptResponse = Record<string, unknown>[];
|
|
81
91
|
export interface BusinessRegionQueryBody {
|
|
82
|
-
/** GameID 目标业务 ID
|
|
83
|
-
|
|
92
|
+
/** GameID 目标业务 ID;取值 > 0 时返回该业务实际生效的国家区域;
|
|
93
|
+
取值 <= 0 或未传时返回国家区域全量字典;与当前登录业务是否一致不做强校验(跨业务查询合法)。 */
|
|
84
94
|
game_id?: number;
|
|
85
|
-
/** Search 模糊搜索关键字,按 name_en / name_ch / num_code 匹配;可选,默认空字符串。 */
|
|
86
|
-
search?: string;
|
|
87
95
|
}
|
|
88
96
|
export interface BusinessRegionQueryResponseRegionListItem {
|
|
89
97
|
/** ID 区域主键 ID。 */
|
|
90
98
|
id?: number;
|
|
91
|
-
/** IsEEARegion 是否 EEA
|
|
99
|
+
/** IsEEARegion 是否 EEA 区域,取值:0=否,1=是。 */
|
|
92
100
|
is_eea_region?: number;
|
|
93
101
|
/** IsSecretRegion 是否特殊合规区域,取值:1=默认区域,2=特殊区域。 */
|
|
94
102
|
is_secret_region?: number;
|
|
@@ -104,24 +112,6 @@ export interface BusinessRegionQueryResponseRegionListItem {
|
|
|
104
112
|
region_en?: string;
|
|
105
113
|
}
|
|
106
114
|
export interface BusinessRegionQueryResponse {
|
|
107
|
-
/**
|
|
108
|
-
black_codes?: string[];
|
|
109
|
-
/** RegionList 国家区域列表;base_region_list 返回完整字典(或搜索子集),
|
|
110
|
-
business_effective_region_list 返回业务最终生效结果,business_region_rule_detail 返回完整字典(或搜索子集)。 */
|
|
111
|
-
region_list?: BusinessRegionQueryResponseRegionListItem[];
|
|
112
|
-
/** RuleState 业务规则状态,取值见 RuleState* 常量:0=未配置,1=启用,2=停用;
|
|
113
|
-
仅 business_effective_region_list / business_region_rule_detail 场景返回;base_region_list 场景省略(omitempty)。 */
|
|
114
|
-
rule_state?: number;
|
|
115
|
-
/** WhiteCodes 白名单数字码列表;base_region_list / business_effective_region_list 返回空数组,business_region_rule_detail 返回真实值。 */
|
|
116
|
-
white_codes?: string[];
|
|
117
|
-
}
|
|
118
|
-
export interface BusinessGameInfoGetCustomRegionBody {
|
|
119
|
-
/** GameID 目标业务 ID */
|
|
120
|
-
game_id: number;
|
|
121
|
-
/** Env 环境 */
|
|
122
|
-
env: number;
|
|
123
|
-
}
|
|
124
|
-
export interface BusinessGameInfoGetCustomRegionResponse {
|
|
125
|
-
/** RegionList 自定义合规区域列表 */
|
|
115
|
+
/** RegionList 国家区域列表:未携带 game_id 时为全量字典,携带 game_id 时为该业务实际生效区域;均按 id 升序。 */
|
|
126
116
|
region_list?: BusinessRegionQueryResponseRegionListItem[];
|
|
127
117
|
}
|
|
@@ -37,11 +37,6 @@ interface PntBusinessSelectProps {
|
|
|
37
37
|
* @description 1-正式业务,2-测试业务
|
|
38
38
|
*/
|
|
39
39
|
businessTypes?: number[];
|
|
40
|
-
/**
|
|
41
|
-
* 业务接入类型筛选
|
|
42
|
-
* @description 1-纯SDK,2-LI PASS,3-工作室品牌账号
|
|
43
|
-
*/
|
|
44
|
-
businessAccessMethod?: number;
|
|
45
40
|
/**
|
|
46
41
|
* 标签格式
|
|
47
42
|
* @description name-中文名,name_en-英文名,name_id-中文名(ID),name_en_id-英文名(ID)
|
|
@@ -64,7 +64,6 @@ const PntBusinessSelect = props => {
|
|
|
64
64
|
scene = 'default',
|
|
65
65
|
statuses,
|
|
66
66
|
businessTypes,
|
|
67
|
-
businessAccessMethod,
|
|
68
67
|
labelFormat = 'name',
|
|
69
68
|
labelField,
|
|
70
69
|
optionLabel,
|
|
@@ -143,11 +142,10 @@ const PntBusinessSelect = props => {
|
|
|
143
142
|
scene,
|
|
144
143
|
statuses,
|
|
145
144
|
business_types: businessTypes,
|
|
146
|
-
business_access_method: businessAccessMethod,
|
|
147
145
|
fields
|
|
148
146
|
}),
|
|
149
147
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
150
|
-
[scene, statusesKey, businessTypesKey,
|
|
148
|
+
[scene, statusesKey, businessTypesKey, pageSize, fieldsKey, pagination]);
|
|
151
149
|
|
|
152
150
|
// ---- 获取数据 ----
|
|
153
151
|
// append=true 为滚动翻页(追加),append=false 为初始化/搜索/重置(替换)
|
|
@@ -13,15 +13,6 @@ import type { PntRegionSelectProps } from './types';
|
|
|
13
13
|
* onChange={(v) => setRegions(v)}
|
|
14
14
|
* />
|
|
15
15
|
*
|
|
16
|
-
* // 自定义合规区域
|
|
17
|
-
* <PntRegionSelect
|
|
18
|
-
* dataSource="custom"
|
|
19
|
-
* gameId={gameId}
|
|
20
|
-
* env={0}
|
|
21
|
-
* value={regions}
|
|
22
|
-
* onChange={(v) => setRegions(v)}
|
|
23
|
-
* />
|
|
24
|
-
*
|
|
25
16
|
* // 业务最终生效区域
|
|
26
17
|
* <PntRegionSelect
|
|
27
18
|
* dataSource="business"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { businessRegionQuery } from "../../api";
|
|
2
|
+
import { usePntConfigOptional } from "../../config";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { Button, Checkbox, Select } from 'tdesign-react';
|
|
5
5
|
import ImportDialog from "./ImportDialog";
|
|
@@ -7,15 +7,25 @@ import "./index.scss";
|
|
|
7
7
|
import { DEFAULT_TEXTS } from "./types";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @description
|
|
10
|
+
* 归一化 region_code:纯数字字符串去掉前导零('012' -> '12'),非数字保持原样
|
|
11
|
+
* @description 后端详情接口可能返回 '12',字典接口可能返回 '012',需统一格式才能匹配
|
|
12
12
|
*/
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
|
+
const normalizeRegionCode = code => {
|
|
17
|
+
if (code == null || code === '') return '';
|
|
18
|
+
const str = String(code);
|
|
19
|
+
return /^\d+$/.test(str) ? String(Number(str)) : str;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 将后端区域项归一化为组件内部的 RegionOption
|
|
24
|
+
* @description 后端契约字段均为可选,此处补默认值
|
|
25
|
+
*/
|
|
16
26
|
const toRegionOptions = list => (list || []).map(item => ({
|
|
17
27
|
...item,
|
|
18
|
-
region_code: item.region_code
|
|
28
|
+
region_code: normalizeRegionCode(item.region_code),
|
|
19
29
|
region_ch: item.region_ch ?? '',
|
|
20
30
|
region_en: item.region_en ?? ''
|
|
21
31
|
}));
|
|
@@ -53,15 +63,6 @@ const getLabelText = (item, format) => {
|
|
|
53
63
|
* onChange={(v) => setRegions(v)}
|
|
54
64
|
* />
|
|
55
65
|
*
|
|
56
|
-
* // 自定义合规区域
|
|
57
|
-
* <PntRegionSelect
|
|
58
|
-
* dataSource="custom"
|
|
59
|
-
* gameId={gameId}
|
|
60
|
-
* env={0}
|
|
61
|
-
* value={regions}
|
|
62
|
-
* onChange={(v) => setRegions(v)}
|
|
63
|
-
* />
|
|
64
|
-
*
|
|
65
66
|
* // 业务最终生效区域
|
|
66
67
|
* <PntRegionSelect
|
|
67
68
|
* dataSource="business"
|
|
@@ -85,8 +86,8 @@ const PntRegionSelect = props => {
|
|
|
85
86
|
onChange,
|
|
86
87
|
multiple = true,
|
|
87
88
|
dataSource = 'default',
|
|
89
|
+
scope = 'business',
|
|
88
90
|
gameId,
|
|
89
|
-
env = 0,
|
|
90
91
|
options: externalOptions,
|
|
91
92
|
disabled = false,
|
|
92
93
|
placeholder,
|
|
@@ -96,6 +97,7 @@ const PntRegionSelect = props => {
|
|
|
96
97
|
texts: customTexts,
|
|
97
98
|
onLoaded,
|
|
98
99
|
optionDisabled,
|
|
100
|
+
optionFilter,
|
|
99
101
|
optionTooltip,
|
|
100
102
|
importable = false,
|
|
101
103
|
invertible = false,
|
|
@@ -107,9 +109,11 @@ const PntRegionSelect = props => {
|
|
|
107
109
|
style,
|
|
108
110
|
popupProps
|
|
109
111
|
} = props;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
|
|
113
|
+
// 外部受控模式下无需 http,因此使用可选版配置读取
|
|
114
|
+
const config = usePntConfigOptional();
|
|
115
|
+
const http = config?.http;
|
|
116
|
+
const regionQuery = config?.regionQuery;
|
|
113
117
|
const texts = useMemo(() => ({
|
|
114
118
|
...DEFAULT_TEXTS,
|
|
115
119
|
...customTexts
|
|
@@ -132,37 +136,29 @@ const PntRegionSelect = props => {
|
|
|
132
136
|
// ---- 获取数据 ----
|
|
133
137
|
const fetchData = useCallback(async () => {
|
|
134
138
|
if (isExternal) return;
|
|
139
|
+
if (!http) {
|
|
140
|
+
console.warn('[PntRegionSelect] 未注入 PntProvider.http,无法内部拉取区域数据;请用 <PntProvider> 包裹,或改用外部 options 模式');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
135
143
|
const seq = ++fetchSeqRef.current;
|
|
136
144
|
setLoading(true);
|
|
137
145
|
try {
|
|
138
146
|
let list = [];
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
console.warn('[PntRegionSelect] dataSource="custom" 时必须传入 gameId');
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
const res = await businessGameInfoGetCustomRegion(http, {
|
|
145
|
-
game_id: Number(gameId),
|
|
146
|
-
env
|
|
147
|
-
});
|
|
148
|
-
if (seq !== fetchSeqRef.current) return;
|
|
149
|
-
if (res.code === 0 && res.data?.region_list) {
|
|
150
|
-
list = toRegionOptions(res.data.region_list);
|
|
151
|
-
}
|
|
152
|
-
} else if (dataSource === 'business') {
|
|
147
|
+
const url = scope === 'platform' ? regionQuery?.queryPlatUrl || '/v5/business/region/plat-query?audience=/laas-pnt' : regionQuery?.queryUrl || '/v5/business/region/query?audience=/laas-pnt';
|
|
148
|
+
if (dataSource === 'business') {
|
|
153
149
|
if (!gameId) {
|
|
154
150
|
console.warn('[PntRegionSelect] dataSource="business" 时必须传入 gameId');
|
|
155
151
|
return;
|
|
156
152
|
}
|
|
157
153
|
const res = await businessRegionQuery(http, {
|
|
158
154
|
game_id: Number(gameId)
|
|
159
|
-
});
|
|
155
|
+
}, url);
|
|
160
156
|
if (seq !== fetchSeqRef.current) return;
|
|
161
157
|
if (res.code === 0 && res.data?.region_list) {
|
|
162
158
|
list = toRegionOptions(res.data.region_list);
|
|
163
159
|
}
|
|
164
160
|
} else {
|
|
165
|
-
const res = await businessRegionQuery(http, {});
|
|
161
|
+
const res = await businessRegionQuery(http, {}, url);
|
|
166
162
|
if (seq !== fetchSeqRef.current) return;
|
|
167
163
|
if (res.code === 0 && res.data?.region_list) {
|
|
168
164
|
list = toRegionOptions(res.data.region_list);
|
|
@@ -177,7 +173,7 @@ const PntRegionSelect = props => {
|
|
|
177
173
|
setLoading(false);
|
|
178
174
|
}
|
|
179
175
|
}
|
|
180
|
-
}, [http, dataSource, gameId,
|
|
176
|
+
}, [http, dataSource, gameId, isExternal, scope, regionQuery]);
|
|
181
177
|
|
|
182
178
|
// ---- 初始加载 ----
|
|
183
179
|
useEffect(() => {
|
|
@@ -185,20 +181,29 @@ const PntRegionSelect = props => {
|
|
|
185
181
|
}, [fetchData]);
|
|
186
182
|
|
|
187
183
|
// ---- 生效的选项列表 ----
|
|
188
|
-
|
|
184
|
+
// 外部传入的 options 也需归一化 region_code(去前导零),否则无法与 valueArr 匹配
|
|
185
|
+
const options = useMemo(() => (isExternal ? externalOptions : innerOptions).map(item => ({
|
|
186
|
+
...item,
|
|
187
|
+
region_code: normalizeRegionCode(item.region_code)
|
|
188
|
+
})), [isExternal, externalOptions, innerOptions]);
|
|
189
189
|
|
|
190
|
-
// ----
|
|
190
|
+
// ---- 归一化选中值为数组(兼容单选字符串),并去掉前导零与 options 对齐 ----
|
|
191
191
|
const valueArr = useMemo(() => {
|
|
192
192
|
if (value === undefined || value === null || value === '') return [];
|
|
193
|
-
|
|
193
|
+
const arr = Array.isArray(value) ? value : [value];
|
|
194
|
+
return arr.map(v => normalizeRegionCode(v));
|
|
194
195
|
}, [value]);
|
|
195
196
|
|
|
196
|
-
// ---- 本地搜索过滤 ----
|
|
197
|
+
// ---- 本地搜索过滤 + optionFilter 自定义过滤 ----
|
|
197
198
|
const filteredOptions = useMemo(() => {
|
|
198
|
-
|
|
199
|
+
let result = options;
|
|
200
|
+
if (optionFilter) {
|
|
201
|
+
result = result.filter(optionFilter);
|
|
202
|
+
}
|
|
203
|
+
if (!searchKeyword) return result;
|
|
199
204
|
const kw = searchKeyword.toLowerCase();
|
|
200
|
-
return
|
|
201
|
-
}, [options, searchKeyword]);
|
|
205
|
+
return result.filter(item => item.region_ch?.toLowerCase().includes(kw) || item.region_en?.toLowerCase().includes(kw) || item.region_code?.toLowerCase().includes(kw));
|
|
206
|
+
}, [options, searchKeyword, optionFilter]);
|
|
202
207
|
|
|
203
208
|
// ---- 判断选项是否禁用 ----
|
|
204
209
|
const isOptionDisabled = useCallback(item => {
|
|
@@ -259,7 +264,7 @@ const PntRegionSelect = props => {
|
|
|
259
264
|
// ---- Select onChange ----
|
|
260
265
|
const handleChange = useCallback(val => {
|
|
261
266
|
const values = Array.isArray(val) ? val : val ? [val] : [];
|
|
262
|
-
const strValues = values.map(
|
|
267
|
+
const strValues = values.map(normalizeRegionCode);
|
|
263
268
|
const selectedOptions = options.filter(o => strValues.includes(o.region_code));
|
|
264
269
|
if (multiple) {
|
|
265
270
|
onChange?.(strValues, selectedOptions);
|
|
@@ -22,10 +22,8 @@ export interface RegionOption {
|
|
|
22
22
|
* 数据源类型
|
|
23
23
|
* - default: 全部国家区域(不带任何参数,返回全部 251 个)/api/v5/business/region/query
|
|
24
24
|
* - business: 业务最终生效的区域(必须传 gameId)/api/v5/business/region/query
|
|
25
|
-
* - custom: 自定义合规区域 /v4/business/game_info/get-custom-region
|
|
26
|
-
* - compliance: 合规区域(从业务配置接口获取 compliance_zone)
|
|
27
25
|
*/
|
|
28
|
-
export type RegionDataSource = 'default' | 'business'
|
|
26
|
+
export type RegionDataSource = 'default' | 'business';
|
|
29
27
|
/**
|
|
30
28
|
* 标签格式
|
|
31
29
|
* - name: 中文名
|
|
@@ -100,10 +98,14 @@ export interface PntRegionSelectProps {
|
|
|
100
98
|
multiple?: boolean;
|
|
101
99
|
/** 数据源类型 @default 'default' */
|
|
102
100
|
dataSource?: RegionDataSource;
|
|
103
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* 接口作用域 @default 'business'
|
|
103
|
+
* - business: 业务级区域查询 /api/v5/business/region/query
|
|
104
|
+
* - platform: 平台级区域查询 /api/v5/business/region/plat-query
|
|
105
|
+
*/
|
|
106
|
+
scope?: 'business' | 'platform';
|
|
107
|
+
/** 业务ID(dataSource='business' 时必传) */
|
|
104
108
|
gameId?: string | number;
|
|
105
|
-
/** 环境(dataSource='custom' 时必传) @default 0 */
|
|
106
|
-
env?: number;
|
|
107
109
|
/**
|
|
108
110
|
* 外部受控选项列表(传入后跳过内部请求,直接使用该数据;
|
|
109
111
|
* 适用于选项由父组件获取/过滤的场景)
|
|
@@ -125,6 +127,8 @@ export interface PntRegionSelectProps {
|
|
|
125
127
|
onLoaded?: (options: RegionOption[]) => void;
|
|
126
128
|
/** 自定义选项禁用逻辑 */
|
|
127
129
|
optionDisabled?: (item: RegionOption) => boolean;
|
|
130
|
+
/** 自定义选项过滤逻辑(内部拉取数据时生效,用于只展示部分区域) */
|
|
131
|
+
optionFilter?: (item: RegionOption) => boolean;
|
|
128
132
|
/** 自定义选项 tooltip */
|
|
129
133
|
optionTooltip?: (item: RegionOption) => string;
|
|
130
134
|
/**
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
* 数据源类型
|
|
7
7
|
* - default: 全部国家区域(不带任何参数,返回全部 251 个)/api/v5/business/region/query
|
|
8
8
|
* - business: 业务最终生效的区域(必须传 gameId)/api/v5/business/region/query
|
|
9
|
-
* - custom: 自定义合规区域 /v4/business/game_info/get-custom-region
|
|
10
|
-
* - compliance: 合规区域(从业务配置接口获取 compliance_zone)
|
|
11
9
|
*/
|
|
12
10
|
|
|
13
11
|
/**
|
package/lib/esm/config.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export interface commonEesType<T> {
|
|
|
15
15
|
* 任何具备 axios 兼容 post 签名的实例均可注入。
|
|
16
16
|
*/
|
|
17
17
|
export interface PntHttpLike {
|
|
18
|
-
get<
|
|
19
|
-
post<
|
|
18
|
+
get<R = unknown>(url: string, config?: any): Promise<R>;
|
|
19
|
+
post<R = unknown, D = unknown>(url: string, data?: D, config?: any): Promise<R>;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* 高敏信息解锁接口配置(可选,全局覆盖)
|
|
@@ -37,6 +37,21 @@ export interface PntHighSecurityConfig {
|
|
|
37
37
|
/** audience 覆盖(默认 /laas-pnt) */
|
|
38
38
|
audience?: string;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* 地区查询接口配置(可选,全局覆盖)
|
|
42
|
+
*/
|
|
43
|
+
export interface PntRegionQueryConfig {
|
|
44
|
+
/**
|
|
45
|
+
* 业务级地区查询接口 URL,覆盖默认 /api/v5/business/region/query?audience=/laas-pnt
|
|
46
|
+
* @description scope='business'(默认)时使用
|
|
47
|
+
*/
|
|
48
|
+
queryUrl?: string;
|
|
49
|
+
/**
|
|
50
|
+
* 平台级地区查询接口 URL,覆盖默认 /api/v5/business/region/plat-query?audience=/laas-pnt
|
|
51
|
+
* @description scope='platform' 时使用
|
|
52
|
+
*/
|
|
53
|
+
queryPlatUrl?: string;
|
|
54
|
+
}
|
|
40
55
|
/**
|
|
41
56
|
* 组件库运行时配置:由消费方通过 PntProvider 注入
|
|
42
57
|
*/
|
|
@@ -45,6 +60,8 @@ export interface PntConfig {
|
|
|
45
60
|
http: PntHttpLike;
|
|
46
61
|
/** 高敏信息解锁接口全局配置(可选) */
|
|
47
62
|
highSecurity?: PntHighSecurityConfig;
|
|
63
|
+
/** 地区查询接口全局配置(可选) */
|
|
64
|
+
regionQuery?: PntRegionQueryConfig;
|
|
48
65
|
}
|
|
49
66
|
/**
|
|
50
67
|
* 配置 Provider:消费方在应用根入口包裹一次即可
|
|
@@ -64,3 +81,10 @@ export declare const PntProvider: import("react").Provider<PntConfig | null>;
|
|
|
64
81
|
* @internal
|
|
65
82
|
*/
|
|
66
83
|
export declare const usePntConfig: () => PntConfig;
|
|
84
|
+
/**
|
|
85
|
+
* 获取组件库运行时配置(可选版本,内部使用)
|
|
86
|
+
* @description 供「外部受控数据」模式的组件使用:未注入 Provider 时返回 null,
|
|
87
|
+
* 组件自行降级(不发起内部请求),不抛错
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
export declare const usePntConfigOptional: () => PntConfig | null;
|
package/lib/esm/config.js
CHANGED
|
@@ -15,6 +15,10 @@ import { createContext, useContext } from 'react';
|
|
|
15
15
|
* 高敏信息解锁接口配置(可选,全局覆盖)
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* 地区查询接口配置(可选,全局覆盖)
|
|
20
|
+
*/
|
|
21
|
+
|
|
18
22
|
/**
|
|
19
23
|
* 组件库运行时配置:由消费方通过 PntProvider 注入
|
|
20
24
|
*/
|
|
@@ -45,4 +49,12 @@ export const usePntConfig = () => {
|
|
|
45
49
|
throw new Error('[pnt-component-frontend] 未注入配置:请在应用根入口用 <PntProvider value={{ http }}> 包裹');
|
|
46
50
|
}
|
|
47
51
|
return cfg;
|
|
48
|
-
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 获取组件库运行时配置(可选版本,内部使用)
|
|
56
|
+
* @description 供「外部受控数据」模式的组件使用:未注入 Provider 时返回 null,
|
|
57
|
+
* 组件自行降级(不发起内部请求),不抛错
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export const usePntConfigOptional = () => useContext(PntContext);
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { PntProvider, usePntConfig, type PntConfig, type PntHighSecurityConfig, type PntHttpLike, type commonEesType, } from './config';
|
|
1
|
+
export { PntProvider, usePntConfig, type PntConfig, type PntHighSecurityConfig, type PntHttpLike, type PntRegionQueryConfig, type commonEesType, } from './config';
|
|
2
2
|
export { default as PntImage } from './components/PntImage';
|
|
3
3
|
export { default as PntBusinessSelect } from './components/PntBusinessSelect';
|
|
4
4
|
export { default as PntRegionSelect } from './components/PntRegionSelect';
|
|
@@ -7,4 +7,6 @@ export { default as PntSecureBox } from './components/PntSecureBox';
|
|
|
7
7
|
export { useHighSecurity } from './hooks/useHighSecurity';
|
|
8
8
|
export type { ClearSecurityDataFilter, HighSecurityApiConfig, HighSecurityParamItem, HighSecurityRequestParams, HighSecurityScope, UseHighSecurityOptions, UseHighSecurityResult, } from './hooks/useHighSecurity';
|
|
9
9
|
export { isSecurityData } from './utils';
|
|
10
|
+
export { businessGameInfoHighSecurityDecrypt, businessRegionQuery, businessSelectList, } from './api';
|
|
11
|
+
export type { BusinessRegionQueryBody, BusinessRegionQueryResponse, BusinessRegionQueryResponseRegionListItem, } from './api/types';
|
|
10
12
|
export { default as PntGeneralLayout } from './components/PntGeneralLayout';
|
package/lib/esm/index.js
CHANGED
|
@@ -25,5 +25,7 @@ export { default as PntSecureBox } from "./components/PntSecureBox";
|
|
|
25
25
|
export { useHighSecurity } from "./hooks/useHighSecurity";
|
|
26
26
|
export { isSecurityData } from "./utils";
|
|
27
27
|
|
|
28
|
+
// ---------- 业务 API(与组件内部共用,供外部受控模式调用) ----------
|
|
29
|
+
export { businessGameInfoHighSecurityDecrypt, businessRegionQuery, businessSelectList } from "./api";
|
|
28
30
|
// ---------- L3 布局组件 ----------
|
|
29
31
|
export { default as PntGeneralLayout } from "./components/PntGeneralLayout";
|