@pnt-team/pnt-component-frontend 0.0.99 → 0.0.102
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/components/PntSecureBox/index.d.ts +42 -1
- package/lib/cjs/components/PntSecureBox/index.js +65 -6
- package/lib/cjs/components/PntSecureBox/index.scss +2 -1
- package/lib/cjs/config.d.ts +9 -1
- package/lib/cjs/global.d.ts +9 -0
- package/lib/cjs/hooks/useHighSecurity.d.ts +10 -0
- package/lib/cjs/hooks/useHighSecurity.js +14 -12
- package/lib/cjs/index.d.ts +1 -1
- package/lib/esm/components/PntSecureBox/index.d.ts +42 -1
- package/lib/esm/components/PntSecureBox/index.js +67 -8
- package/lib/esm/components/PntSecureBox/index.scss +2 -1
- package/lib/esm/config.d.ts +9 -1
- package/lib/esm/global.d.ts +9 -0
- package/lib/esm/hooks/useHighSecurity.d.ts +10 -0
- package/lib/esm/hooks/useHighSecurity.js +18 -9
- package/lib/esm/index.d.ts +1 -1
- package/lib/umd/pnt-component-frontend.min.css +1 -1
- package/lib/umd/pnt-component-frontend.min.js +1 -1
- package/package.json +9 -3
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { businessGameInfoHighSecurityDecrypt } from "../api";
|
|
2
2
|
import { usePntConfig } from "../config";
|
|
3
|
-
import { useCallback, useMemo
|
|
3
|
+
import { useCallback, useMemo } from 'react';
|
|
4
|
+
// 使用 use-sync-external-store shim,兼容 React 17(sdk-frontend),
|
|
5
|
+
// React 18+ 亦可直接使用此包(内部会代理到 react 的 useSyncExternalStore)
|
|
6
|
+
import { useSyncExternalStore } from 'use-sync-external-store';
|
|
4
7
|
|
|
5
8
|
/** 单个解锁项 */
|
|
6
9
|
|
|
7
10
|
/** 单次请求的接口配置覆盖(优先级 > PntProvider 全局配置) */
|
|
8
11
|
|
|
12
|
+
/**
|
|
13
|
+
* 高敏接口变体
|
|
14
|
+
* - 'business'(默认):业务级,走 /api/v3/business/game_info/high-security-decrypt
|
|
15
|
+
* - 'platform':平台级(发布记录页场景),走 /api/v3/business/game_info/plat-high-security-decrypt
|
|
16
|
+
*/
|
|
17
|
+
|
|
9
18
|
/** 高敏数据解锁请求参数(组件层友好命名,库内部转换为后端 snake_case) */
|
|
10
19
|
|
|
11
20
|
/** hook 初始化 scope:传入后 securityData/isUnlocked 自动按该业务+环境过滤 */
|
|
@@ -92,6 +101,7 @@ export const useHighSecurity = options => {
|
|
|
92
101
|
const scopeGameId = options?.gameId === undefined ? undefined : String(options.gameId);
|
|
93
102
|
const scopeEnv = options?.env === undefined ? undefined : String(options.env);
|
|
94
103
|
const hasScope = scopeGameId !== undefined && scopeEnv !== undefined;
|
|
104
|
+
const optionsScope = options?.scope;
|
|
95
105
|
const securityData = useMemo(() => {
|
|
96
106
|
if (!hasScope) return {};
|
|
97
107
|
const prefix = `${scopeGameId}:${scopeEnv}:`;
|
|
@@ -113,7 +123,8 @@ export const useHighSecurity = options => {
|
|
|
113
123
|
env,
|
|
114
124
|
pageId,
|
|
115
125
|
param,
|
|
116
|
-
apiConfig
|
|
126
|
+
apiConfig,
|
|
127
|
+
scope: paramScope
|
|
117
128
|
}) => {
|
|
118
129
|
const gid = String(gameId);
|
|
119
130
|
const eid = String(env ?? 0);
|
|
@@ -157,12 +168,10 @@ export const useHighSecurity = options => {
|
|
|
157
168
|
param: missing
|
|
158
169
|
};
|
|
159
170
|
|
|
160
|
-
// 拼接 URL
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
url = `/v3/business/game_info/high-security-decrypt?audience=${audience}`;
|
|
165
|
-
}
|
|
171
|
+
// 拼接 URL:按 scope 选择接口变体;decryptUrl/decryptPlatUrl 优先于默认
|
|
172
|
+
const scope = paramScope ?? optionsScope ?? 'business';
|
|
173
|
+
const audience = merged.audience || '/laas-pnt';
|
|
174
|
+
const url = scope === 'platform' ? merged.decryptPlatUrl || `/api/v3/business/game_info/plat-high-security-decrypt?audience=${audience}` : merged.decryptUrl || `/api/v3/business/game_info/high-security-decrypt?audience=${audience}`;
|
|
166
175
|
|
|
167
176
|
// 请求级并发去重:同一业务+环境+参数列表指纹在途时复用
|
|
168
177
|
const requestKey = `${gid}:${eid}:${missing.map(item => `${item.key}\u0001${item.value}`).join('\u0002')}`;
|
|
@@ -215,7 +224,7 @@ export const useHighSecurity = options => {
|
|
|
215
224
|
})();
|
|
216
225
|
inflightRequests.set(requestKey, promise);
|
|
217
226
|
return promise;
|
|
218
|
-
}, [http, snapshot, globalHighSecurity]);
|
|
227
|
+
}, [http, snapshot, globalHighSecurity, optionsScope]);
|
|
219
228
|
const clearSecurityData = useCallback(filter => {
|
|
220
229
|
clearEntries(filter);
|
|
221
230
|
}, []);
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export { default as PntUpload } from './components/PntUpload';
|
|
|
6
6
|
export type { PntUploadErrorPhase, PntUploadProps, PntUploadTexts, } from './components/PntUpload';
|
|
7
7
|
export { createPntCosUploader, normalizeSnakeCredential, default as usePntCosUploader, type CosScene, type FileNameStrategy, type GetCosCredentialParams, type NormalizeCredential, type NormalizedCosCredential, type PntCosRequestOverrides, type PntCosUploadOptions, type PntCosUploadResult, type PntCosUploader as PntCosUploaderInstance, } from './components/PntCosUploader';
|
|
8
8
|
export { useHighSecurity } from './hooks/useHighSecurity';
|
|
9
|
-
export type { ClearSecurityDataFilter, HighSecurityApiConfig, HighSecurityParamItem, HighSecurityRequestParams, UseHighSecurityOptions, UseHighSecurityResult, } from './hooks/useHighSecurity';
|
|
9
|
+
export type { ClearSecurityDataFilter, HighSecurityApiConfig, HighSecurityParamItem, HighSecurityRequestParams, HighSecurityScope, UseHighSecurityOptions, UseHighSecurityResult, } from './hooks/useHighSecurity';
|
|
10
10
|
export { isSecurityData } from './utils';
|
|
11
11
|
export { default as PntGeneralLayout } from './components/PntGeneralLayout';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.pnt-image-wrapper{position:relative}.pnt-image-wrapper .pnt-image-progress,.pnt-image-wrapper .pnt-image-upload-progress{align-items:center;display:flex;height:8.5rem;justify-content:center;width:8.5rem}.pnt-image-wrapper .pnt-image-progress .pnt-image-loading,.pnt-image-wrapper .pnt-image-upload-progress .pnt-image-loading{align-items:center;background-color:#f7f8fa;border-radius:.25rem;display:flex;flex-direction:column;height:100%;justify-content:center;text-align:center;width:100%}.pnt-image-wrapper .pnt-image-progress .pnt-image-loading svg,.pnt-image-wrapper .pnt-image-upload-progress .pnt-image-loading svg{color:var(--td-brand-color);font-size:1.5rem}.pnt-image-wrapper .pnt-image-progress .pnt-image-loading p,.pnt-image-wrapper .pnt-image-upload-progress .pnt-image-loading p{color:#808191;font-size:.75rem;margin-top:.25rem}.pnt-image-wrapper .pnt-image{height:8.5rem;width:8.5rem}.pnt-image-wrapper .pnt-image .pnt-image-mask{align-items:center;background:rgba(0,0,0,.6);color:#fff;display:flex;height:100%;justify-content:center}.pnt-image-wrapper .pnt-image .pnt-image-mask--basic{cursor:pointer}.pnt-image-wrapper .pnt-image .pnt-image-mask .pnt-image-divider{border-left:.0625rem solid var(--td-text-color-anti);height:var(--td-comp-size-xxxs);margin:0 var(--td-comp-margin-l)}.pnt-business-select{width:100%}.pnt-business-select-option-label{display:block;width:100%}.pnt-business-select-popup .t-popup__content .t-loading,.pnt-business-select-popup .t-popup__content .total-wrapper{align-items:center;display:flex;font-weight:400;height:2.25rem;line-height:1.25rem;padding:0 .875rem}.pnt-business-select-popup .t-popup__content .total-wrapper{color:#808191;font-size:.875rem}.pnt-secure-box{color:#333;max-width:-moz-fit-content;max-width:fit-content;position:relative}.pnt-secure-box .view-icon{color:#3f8cff!important;cursor:pointer;font-size:small;position:absolute;right:-1.875rem;top:.0625rem}.pnt-secure-box .security-value{position:relative;top:.1875rem}.pnt-upload{display:inline-block}.pnt-upload .pnt-upload__trigger{cursor:pointer;display:inline-block}.pnt-upload .pnt-upload__error{color:#d54941;color:var(--td-error-color,#d54941);font-size:.75rem;line-height:1.25rem;margin:.25rem 0 0}.pnt-upload--disabled .pnt-upload__trigger{cursor:not-allowed}.pnt-upload .pnt-upload-file{background-color:#fff;background-color:var(--td-bg-color-container,#fff);border:.0625rem dashed #dcdcdc;border:.0625rem dashed var(--td-component-border,#dcdcdc);border-radius:.375rem;border-radius:var(--td-radius-default,6px);box-sizing:border-box;min-width:20rem;padding:.75rem 1rem;transition:border-color .2s}.pnt-upload .pnt-upload-file:hover{border-color:#165dff;border-color:var(--td-brand-color,#165dff)}.pnt-upload .pnt-upload-file__row{align-items:center;color:#1f2329;color:var(--td-text-color-primary,#1f2329);display:flex;font-size:.875rem;gap:.5rem;line-height:1.375rem}.pnt-upload .pnt-upload-file__row--empty{color:#6b7280;color:var(--td-text-color-secondary,#6b7280);justify-content:flex-start}.pnt-upload .pnt-upload-file__row--progress{align-items:center}.pnt-upload .pnt-upload-file__icon{color:#6b7280;color:var(--td-text-color-secondary,#6b7280);flex:none;font-size:1.25rem}.pnt-upload .pnt-upload-file__name{flex:1 1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pnt-upload .pnt-upload-file__delete{color:#6b7280;color:var(--td-text-color-secondary,#6b7280);cursor:pointer;flex:none;font-size:1.125rem}.pnt-upload .pnt-upload-file__delete:hover{color:#d54941;color:var(--td-error-color,#d54941)}.pnt-upload .pnt-upload-file__progress{flex:1 1;min-width:0}.pnt-upload .pnt-upload-file__percent{color:#6b7280;color:var(--td-text-color-secondary,#6b7280);flex:none;font-size:.75rem}.pnt-upload--disabled .pnt-upload-file{background-color:#f3f3f3;background-color:var(--td-bg-color-component-disabled,#f3f3f3)}.pnt-upload--disabled .pnt-upload-file:hover{border-color:#dcdcdc;border-color:var(--td-component-border,#dcdcdc)}.pnt-general-layout{--pnt-layout-body-padding:1.5rem;--pnt-layout-card-radius:0.25rem;background-color:transparent;height:100%}.pnt-general-layout .t-layout__header{align-items:stretch;border-bottom:.0625rem solid #f0f3f6;display:flex;flex-shrink:0;height:auto;justify-content:space-between}.pnt-general-layout .t-layout__header .header-title{align-items:center;display:inline-flex;padding:1.5rem}.pnt-general-layout .t-layout__header .header-title .goback-icon{color:#3f8cff;cursor:pointer;margin-right:.75rem}.pnt-general-layout .t-layout__header .header-title .title{font-size:1.25rem;font-weight:600;line-height:1.5rem}.pnt-general-layout .t-layout__header .header-operation{align-items:center;display:flex;padding-right:1.5rem}.pnt-general-layout .t-layout__header .header-operation .t-button+.t-button{margin-left:.75rem}.pnt-general-layout--borderless .t-layout__header{border-bottom:none}.pnt-general-layout .general-layout-sub-header{border-bottom:.0625rem solid #f0f3f6;flex-shrink:0}.pnt-general-layout .general-layout-body{background:#fafafa;flex:1 1 auto;min-height:0;overflow-y:auto;padding:var(--pnt-layout-body-padding)}.pnt-general-layout .general-layout-body>div.t-card,.pnt-general-layout .general-layout-body>div.t-loading__parent>div.t-card,.pnt-general-layout .general-layout-body>div.tea-card,.pnt-general-layout .general-layout-body>div[class*=-block],.pnt-general-layout .general-layout-body>div[class*=-wrapper]{border-radius:var(--pnt-layout-card-radius);box-shadow:none;margin-bottom:1.5rem}.pnt-general-layout .general-layout-body>div.t-card .t-card__body,.pnt-general-layout .general-layout-body>div.t-loading__parent>div.t-card .t-card__body,.pnt-general-layout .general-layout-body>div.tea-card .t-card__body,.pnt-general-layout .general-layout-body>div[class*=-block] .t-card__body,.pnt-general-layout .general-layout-body>div[class*=-wrapper] .t-card__body{border-radius:var(--pnt-layout-card-radius)}.pnt-general-layout .general-layout-body>div.t-loading__parent>div:last-child.t-card,.pnt-general-layout .general-layout-body>div:last-child,.pnt-general-layout .general-layout-body>div:last-child.t-card,.pnt-general-layout .general-layout-body>div:last-child.tea-card,.pnt-general-layout .general-layout-body>div:last-child[class*=-block],.pnt-general-layout .general-layout-body>div:last-child[class*=-wrapper]{margin-bottom:0}.pnt-general-layout .t-layout__footer{background:#fff;border-top:.0625rem solid #f0f3f6;flex-shrink:0;padding:1.125rem 1.5rem}.pnt-general-layout .t-layout__footer .t-button{font-size:.875rem;font-weight:600;height:2.25rem;min-width:5.75rem}.pnt-general-layout .t-layout__footer .t-button+.t-button{margin-left:.75rem}.pnt-general-layout--footer-auto .t-layout__footer .t-button{font-size:inherit;font-weight:inherit;height:auto;min-width:0}
|
|
1
|
+
.pnt-image-wrapper{position:relative}.pnt-image-wrapper .pnt-image-progress,.pnt-image-wrapper .pnt-image-upload-progress{align-items:center;display:flex;height:8.5rem;justify-content:center;width:8.5rem}.pnt-image-wrapper .pnt-image-progress .pnt-image-loading,.pnt-image-wrapper .pnt-image-upload-progress .pnt-image-loading{align-items:center;background-color:#f7f8fa;border-radius:.25rem;display:flex;flex-direction:column;height:100%;justify-content:center;text-align:center;width:100%}.pnt-image-wrapper .pnt-image-progress .pnt-image-loading svg,.pnt-image-wrapper .pnt-image-upload-progress .pnt-image-loading svg{color:var(--td-brand-color);font-size:1.5rem}.pnt-image-wrapper .pnt-image-progress .pnt-image-loading p,.pnt-image-wrapper .pnt-image-upload-progress .pnt-image-loading p{color:#808191;font-size:.75rem;margin-top:.25rem}.pnt-image-wrapper .pnt-image{height:8.5rem;width:8.5rem}.pnt-image-wrapper .pnt-image .pnt-image-mask{align-items:center;background:rgba(0,0,0,.6);color:#fff;display:flex;height:100%;justify-content:center}.pnt-image-wrapper .pnt-image .pnt-image-mask--basic{cursor:pointer}.pnt-image-wrapper .pnt-image .pnt-image-mask .pnt-image-divider{border-left:.0625rem solid var(--td-text-color-anti);height:var(--td-comp-size-xxxs);margin:0 var(--td-comp-margin-l)}.pnt-business-select{width:100%}.pnt-business-select-option-label{display:block;width:100%}.pnt-business-select-popup .t-popup__content .t-loading,.pnt-business-select-popup .t-popup__content .total-wrapper{align-items:center;display:flex;font-weight:400;height:2.25rem;line-height:1.25rem;padding:0 .875rem}.pnt-business-select-popup .t-popup__content .total-wrapper{color:#808191;font-size:.875rem}.pnt-secure-box{color:#333;max-width:-moz-fit-content;max-width:fit-content;position:relative}.pnt-secure-box .copy-icon,.pnt-secure-box .view-icon{color:#3f8cff!important;cursor:pointer;font-size:small;position:absolute;right:-1.875rem;top:.0625rem}.pnt-secure-box .security-value{position:relative;top:.1875rem}.pnt-upload{display:inline-block}.pnt-upload .pnt-upload__trigger{cursor:pointer;display:inline-block}.pnt-upload .pnt-upload__error{color:#d54941;color:var(--td-error-color,#d54941);font-size:.75rem;line-height:1.25rem;margin:.25rem 0 0}.pnt-upload--disabled .pnt-upload__trigger{cursor:not-allowed}.pnt-upload .pnt-upload-file{background-color:#fff;background-color:var(--td-bg-color-container,#fff);border:.0625rem dashed #dcdcdc;border:.0625rem dashed var(--td-component-border,#dcdcdc);border-radius:.375rem;border-radius:var(--td-radius-default,6px);box-sizing:border-box;min-width:20rem;padding:.75rem 1rem;transition:border-color .2s}.pnt-upload .pnt-upload-file:hover{border-color:#165dff;border-color:var(--td-brand-color,#165dff)}.pnt-upload .pnt-upload-file__row{align-items:center;color:#1f2329;color:var(--td-text-color-primary,#1f2329);display:flex;font-size:.875rem;gap:.5rem;line-height:1.375rem}.pnt-upload .pnt-upload-file__row--empty{color:#6b7280;color:var(--td-text-color-secondary,#6b7280);justify-content:flex-start}.pnt-upload .pnt-upload-file__row--progress{align-items:center}.pnt-upload .pnt-upload-file__icon{color:#6b7280;color:var(--td-text-color-secondary,#6b7280);flex:none;font-size:1.25rem}.pnt-upload .pnt-upload-file__name{flex:1 1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pnt-upload .pnt-upload-file__delete{color:#6b7280;color:var(--td-text-color-secondary,#6b7280);cursor:pointer;flex:none;font-size:1.125rem}.pnt-upload .pnt-upload-file__delete:hover{color:#d54941;color:var(--td-error-color,#d54941)}.pnt-upload .pnt-upload-file__progress{flex:1 1;min-width:0}.pnt-upload .pnt-upload-file__percent{color:#6b7280;color:var(--td-text-color-secondary,#6b7280);flex:none;font-size:.75rem}.pnt-upload--disabled .pnt-upload-file{background-color:#f3f3f3;background-color:var(--td-bg-color-component-disabled,#f3f3f3)}.pnt-upload--disabled .pnt-upload-file:hover{border-color:#dcdcdc;border-color:var(--td-component-border,#dcdcdc)}.pnt-general-layout{--pnt-layout-body-padding:1.5rem;--pnt-layout-card-radius:0.25rem;background-color:transparent;height:100%}.pnt-general-layout .t-layout__header{align-items:stretch;border-bottom:.0625rem solid #f0f3f6;display:flex;flex-shrink:0;height:auto;justify-content:space-between}.pnt-general-layout .t-layout__header .header-title{align-items:center;display:inline-flex;padding:1.5rem}.pnt-general-layout .t-layout__header .header-title .goback-icon{color:#3f8cff;cursor:pointer;margin-right:.75rem}.pnt-general-layout .t-layout__header .header-title .title{font-size:1.25rem;font-weight:600;line-height:1.5rem}.pnt-general-layout .t-layout__header .header-operation{align-items:center;display:flex;padding-right:1.5rem}.pnt-general-layout .t-layout__header .header-operation .t-button+.t-button{margin-left:.75rem}.pnt-general-layout--borderless .t-layout__header{border-bottom:none}.pnt-general-layout .general-layout-sub-header{border-bottom:.0625rem solid #f0f3f6;flex-shrink:0}.pnt-general-layout .general-layout-body{background:#fafafa;flex:1 1 auto;min-height:0;overflow-y:auto;padding:var(--pnt-layout-body-padding)}.pnt-general-layout .general-layout-body>div.t-card,.pnt-general-layout .general-layout-body>div.t-loading__parent>div.t-card,.pnt-general-layout .general-layout-body>div.tea-card,.pnt-general-layout .general-layout-body>div[class*=-block],.pnt-general-layout .general-layout-body>div[class*=-wrapper]{border-radius:var(--pnt-layout-card-radius);box-shadow:none;margin-bottom:1.5rem}.pnt-general-layout .general-layout-body>div.t-card .t-card__body,.pnt-general-layout .general-layout-body>div.t-loading__parent>div.t-card .t-card__body,.pnt-general-layout .general-layout-body>div.tea-card .t-card__body,.pnt-general-layout .general-layout-body>div[class*=-block] .t-card__body,.pnt-general-layout .general-layout-body>div[class*=-wrapper] .t-card__body{border-radius:var(--pnt-layout-card-radius)}.pnt-general-layout .general-layout-body>div.t-loading__parent>div:last-child.t-card,.pnt-general-layout .general-layout-body>div:last-child,.pnt-general-layout .general-layout-body>div:last-child.t-card,.pnt-general-layout .general-layout-body>div:last-child.tea-card,.pnt-general-layout .general-layout-body>div:last-child[class*=-block],.pnt-general-layout .general-layout-body>div:last-child[class*=-wrapper]{margin-bottom:0}.pnt-general-layout .t-layout__footer{background:#fff;border-top:.0625rem solid #f0f3f6;flex-shrink:0;padding:1.125rem 1.5rem}.pnt-general-layout .t-layout__footer .t-button{font-size:.875rem;font-weight:600;height:2.25rem;min-width:5.75rem}.pnt-general-layout .t-layout__footer .t-button+.t-button{margin-left:.75rem}.pnt-general-layout--footer-auto .t-layout__footer .t-button{font-size:inherit;font-weight:inherit;height:auto;min-width:0}
|