payment-kit 1.20.17 → 1.20.19
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/.env +1 -0
- package/api/src/index.ts +2 -0
- package/api/src/libs/vendor-util/adapters/didnames-adapter.ts +412 -0
- package/api/src/libs/vendor-util/adapters/factory.ts +26 -1
- package/api/src/libs/vendor-util/adapters/launcher-adapter.ts +110 -22
- package/api/src/libs/vendor-util/adapters/types.ts +4 -0
- package/api/src/libs/vendor-util/adapters/util.ts +7 -0
- package/api/src/libs/vendor-util/fulfillment.ts +7 -2
- package/api/src/queues/vendors/fulfillment-coordinator.ts +193 -7
- package/api/src/routes/vendor.ts +87 -86
- package/blocklet.yml +1 -1
- package/package.json +7 -6
- package/src/components/vendor/actions.tsx +1 -1
- package/src/locales/en.tsx +1 -0
- package/src/locales/zh.tsx +2 -1
- package/src/pages/admin/products/vendors/create.tsx +1 -36
- package/src/pages/admin/products/vendors/index.tsx +1 -1
|
@@ -30,7 +30,6 @@ interface Vendor {
|
|
|
30
30
|
name: string;
|
|
31
31
|
description: string;
|
|
32
32
|
app_url: string;
|
|
33
|
-
vendor_did?: string;
|
|
34
33
|
status: 'active' | 'inactive';
|
|
35
34
|
metadata: Record<string, any>;
|
|
36
35
|
created_at: string;
|
|
@@ -50,7 +49,6 @@ interface VendorFormData {
|
|
|
50
49
|
name: string;
|
|
51
50
|
description: string;
|
|
52
51
|
app_url: string;
|
|
53
|
-
vendor_did?: string;
|
|
54
52
|
status: 'active' | 'inactive';
|
|
55
53
|
metadata: Array<{ key: string; value: string }>;
|
|
56
54
|
app_pid?: string;
|
|
@@ -84,7 +82,6 @@ export default function VendorCreate({
|
|
|
84
82
|
name: '',
|
|
85
83
|
description: '',
|
|
86
84
|
app_url: '',
|
|
87
|
-
vendor_did: '',
|
|
88
85
|
status: 'inactive' as const,
|
|
89
86
|
metadata: [{ key: 'blockletMetaUrl', value: '' }],
|
|
90
87
|
app_pid: '',
|
|
@@ -117,16 +114,6 @@ export default function VendorCreate({
|
|
|
117
114
|
}
|
|
118
115
|
};
|
|
119
116
|
|
|
120
|
-
const validateDid = (did: string | undefined) => {
|
|
121
|
-
if (!did) return true; // DID 是可选的
|
|
122
|
-
// DID 格式验证
|
|
123
|
-
const didPattern = /^(did:abt:)?[1-9A-HJ-NP-Za-km-z]{37}$/;
|
|
124
|
-
if (!didPattern.test(did.trim())) {
|
|
125
|
-
return t('admin.vendor.vendorDidInvalid');
|
|
126
|
-
}
|
|
127
|
-
return true;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
117
|
const onSubmit = async (data: VendorFormData) => {
|
|
131
118
|
try {
|
|
132
119
|
setLoading(true);
|
|
@@ -157,7 +144,6 @@ export default function VendorCreate({
|
|
|
157
144
|
|
|
158
145
|
const submitData = {
|
|
159
146
|
...restData,
|
|
160
|
-
vendor_did: restData.vendor_did?.replace('did:abt:', '').trim(),
|
|
161
147
|
metadata: metadataObj,
|
|
162
148
|
};
|
|
163
149
|
|
|
@@ -181,10 +167,6 @@ export default function VendorCreate({
|
|
|
181
167
|
// 从响应中获取appPid和appLogo
|
|
182
168
|
const blockletInfo = await response.json();
|
|
183
169
|
if (blockletInfo) {
|
|
184
|
-
const component = blockletInfo.componentMountPoints?.find((x: any) => x.did === submitData.vendor_did);
|
|
185
|
-
if (component && !['', '/'].includes(component.mountPoint) && submitData.metadata) {
|
|
186
|
-
submitData.metadata.mountPoint = component.mountPoint;
|
|
187
|
-
}
|
|
188
170
|
submitData.app_pid = blockletInfo.pid || blockletInfo.appPid;
|
|
189
171
|
submitData.app_logo = blockletInfo.logo || blockletInfo.appLogo;
|
|
190
172
|
}
|
|
@@ -256,6 +238,7 @@ export default function VendorCreate({
|
|
|
256
238
|
<InputLabel>{t('admin.vendor.vendorType')}</InputLabel>
|
|
257
239
|
<Select {...field} label={t('admin.vendor.vendorType')}>
|
|
258
240
|
<MenuItem value="launcher">{t('admin.vendor.launcher')}</MenuItem>
|
|
241
|
+
<MenuItem value="didnames">{t('admin.vendor.didnames')}</MenuItem>
|
|
259
242
|
</Select>
|
|
260
243
|
</FormControl>
|
|
261
244
|
)}
|
|
@@ -325,24 +308,6 @@ export default function VendorCreate({
|
|
|
325
308
|
)}
|
|
326
309
|
/>
|
|
327
310
|
|
|
328
|
-
<Controller
|
|
329
|
-
name="vendor_did"
|
|
330
|
-
control={control}
|
|
331
|
-
rules={{
|
|
332
|
-
required: t('admin.vendor.vendorDidRequired'),
|
|
333
|
-
validate: validateDid,
|
|
334
|
-
}}
|
|
335
|
-
render={({ field }) => (
|
|
336
|
-
<TextField
|
|
337
|
-
{...field}
|
|
338
|
-
label={t('admin.vendor.vendorDid')}
|
|
339
|
-
fullWidth
|
|
340
|
-
error={!!errors.vendor_did}
|
|
341
|
-
helperText={errors.vendor_did?.message || t('admin.vendor.vendorDidHelp')}
|
|
342
|
-
/>
|
|
343
|
-
)}
|
|
344
|
-
/>
|
|
345
|
-
|
|
346
311
|
<MetadataForm title={t('common.metadata.label')} />
|
|
347
312
|
|
|
348
313
|
<Controller
|
|
@@ -187,7 +187,7 @@ export default function VendorsList() {
|
|
|
187
187
|
|
|
188
188
|
const handleCopyPublicKey = async () => {
|
|
189
189
|
try {
|
|
190
|
-
await navigator.clipboard.writeText(
|
|
190
|
+
await navigator.clipboard.writeText(window.blocklet.appPk);
|
|
191
191
|
setCopySuccess(true);
|
|
192
192
|
setTimeout(() => setCopySuccess(false), 2000);
|
|
193
193
|
} catch (err) {
|