@abtnode/blocklet-services 1.16.52-beta-20250909-073849-4e392ab1 → 1.16.52-beta-20250911-023851-d988be85
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/api/emails/_components/footer.js +7 -2
- package/api/libs/email.js +5 -1
- package/api/routes/user.js +52 -2
- package/api/services/auth/connect/verify-destroy.js +42 -9
- package/api/socket/util.js +4 -1
- package/api/util/utm.js +241 -0
- package/dist/assets/{access-control-D09br-Cx.js → access-control-DTQ50N6V.js} +1 -1
- package/dist/assets/{add-component-core-BCbsNEyt.js → add-component-core-BrVCLSN6.js} +1 -1
- package/dist/assets/{add-resource-DBuTqFch.js → add-resource-c90mXjXe.js} +1 -1
- package/dist/assets/{addon-2U31yyFl.js → addon-CxluIuPz.js} +1 -1
- package/dist/assets/{advanced-DVAtlRsh.js → advanced-DFALg-CZ.js} +1 -1
- package/dist/assets/{aigne-CmfV21Mm.js → aigne-C4_yXAUg.js} +1 -1
- package/dist/assets/{appearance-EmfiaxOZ.js → appearance-DKolOYs4.js} +1 -1
- package/dist/assets/{arrow-down.svg-Gif3Qlbk.js → arrow-down.svg-CGgLriRk.js} +1 -1
- package/dist/assets/{audit-logs-C5x9wWcD.js → audit-logs-numMr61S.js} +1 -1
- package/dist/assets/{authorize-YaX9nvjo.js → authorize-Cs-nLZVa.js} +1 -1
- package/dist/assets/{base32-DyHKL8vT.js → base32-2BTO5zmk.js} +1 -1
- package/dist/assets/{bind-account-BnNXFevx.js → bind-account-DATlcjGM.js} +1 -1
- package/dist/assets/{branding-BNYDI8rS.js → branding-ChMkwmNu.js} +1 -1
- package/dist/assets/{branding-Bv9eQfQk.js → branding-CpqfcsE-.js} +1 -1
- package/dist/assets/{branding-BlOjZ4LN.js → branding-Dv6FvDLK.js} +2 -2
- package/dist/assets/{bundle-avatar-D7OAJcb0.js → bundle-avatar-CfoJFi5J.js} +1 -1
- package/dist/assets/{complete-B0a8dWfz.js → complete-CshVhiET.js} +1 -1
- package/dist/assets/{component-6jLWJQG9.js → component-B1O9WT7z.js} +3 -3
- package/dist/assets/{config-BEgT9FgV.js → config-Bmq4DJl0.js} +1 -1
- package/dist/assets/{config-CXDgD6Am.js → config-CmIvwzmQ.js} +1 -1
- package/dist/assets/{config-navigation-DNtDnJ9O.js → config-navigation-R4T6jiU3.js} +3 -3
- package/dist/assets/{config-space-D-KJ_Zvk.js → config-space-BVAKDgsX.js} +1 -1
- package/dist/assets/{config-MLIXNVND.js → config-vTUk_Yfk.js} +1 -1
- package/dist/assets/{confirm-C969ZG_F.js → confirm-DV4YCyEc.js} +1 -1
- package/dist/assets/{connect-BYQGcjsx.js → connect-C9A-I8R8.js} +1 -1
- package/dist/assets/{connect-to-CtmxY5oP.js → connect-to-CtS-ZsP9.js} +1 -1
- package/dist/assets/{connect-DdSQXSfp.js → connect-vQygM1gc.js} +1 -1
- package/dist/assets/{dashboard-BpRwSCeh.js → dashboard-CzGF4PYs.js} +3 -3
- package/dist/assets/{delete-confirm-CGjwwcqY.js → delete-confirm-ad8t0UXs.js} +1 -1
- package/dist/assets/{domain-BV8HnqtN.js → domain-D-3zw7uG.js} +1 -1
- package/dist/assets/{domain-action-card-Bz_-Xazt.js → domain-action-card-wBZ8YZ_K.js} +1 -1
- package/dist/assets/{domains-NDWqWGFH.js → domains-BjPU8dXK.js} +1 -1
- package/dist/assets/{email-mSK2XoU_.js → email-DCapsREm.js} +1 -1
- package/dist/assets/engine-CRVby1S4.js +1 -0
- package/dist/assets/{exchange-passport-hHgDgdxw.js → exchange-passport-CuSVCQpP.js} +1 -1
- package/dist/assets/{form-BV7lGmay.js → form-2mrhORLa.js} +1 -1
- package/dist/assets/{fuel-DjNr8IWY.js → fuel-DHo_QvBk.js} +1 -1
- package/dist/assets/{gen-access-key-DLCb_M09.js → gen-access-key-D3bzBUlQ.js} +1 -1
- package/dist/assets/{gen-simple-access-key-Cg4jKiTS.js → gen-simple-access-key-BKkuz2Fk.js} +1 -1
- package/dist/assets/{get-safe-url-DJ5I-iKX.js → get-safe-url-D4-uUwWa.js} +1 -1
- package/dist/assets/{hdkey-BJATMZk2.js → hdkey-CZt5k06-.js} +1 -1
- package/dist/assets/{home-PQ364yRa.js → home-DgBfnhbE.js} +1 -1
- package/dist/assets/{iframe-CQuSp4d_.js → iframe-amFSSPgY.js} +1 -1
- package/dist/assets/{index-C1b11Gor.js → index-B0DwBoe3.js} +1 -1
- package/dist/assets/{index-lscqrS5Z.js → index-B2EmOTH7.js} +59 -59
- package/dist/assets/{index-BHQHhcdx.js → index-BFQzptXM.js} +1 -1
- package/dist/assets/{index-C61enzfv.js → index-BNWq4zK7.js} +1 -1
- package/dist/assets/{index-DFGqK9ZQ.js → index-BV5aEWS1.js} +1 -1
- package/dist/assets/{index-BI5OO07e.js → index-BWhAMS1Q.js} +1 -1
- package/dist/assets/{index-CfB_bXYI.js → index-BmPcC1s0.js} +1 -1
- package/dist/assets/{index-DtI2e8-p.js → index-C1-AZbYf.js} +1 -1
- package/dist/assets/{index-CXDyHIY4.js → index-C1pPU9qq.js} +1 -1
- package/dist/assets/{index-Cik3nAZb.js → index-CBP6lyxa.js} +1 -1
- package/dist/assets/{index-VN_RpImI.js → index-CZYE2JtK.js} +4 -4
- package/dist/assets/{index-DSFB8WaL.js → index-Ca0DgcTh.js} +1 -1
- package/dist/assets/{index-B6ucEBWQ.js → index-Cgvk2QQ_.js} +1 -1
- package/dist/assets/{index-C_MKoY4B.js → index-DBhVhw1v.js} +1 -1
- package/dist/assets/{index-jhEes964.js → index-DVMWAhrt.js} +1 -1
- package/dist/assets/{index-tt5ea0-c.js → index-DkTLhY6N.js} +1 -1
- package/dist/assets/{index-nwknV05O.js → index-FBIc-uda.js} +1 -1
- package/dist/assets/{index-B9b-a_Uj.js → index-HB59rGor.js} +3 -3
- package/dist/assets/index-LTZrTPAZ.js +113 -0
- package/dist/assets/{index-Chtj9VuG.js → index-S5gZ547W.js} +1 -1
- package/dist/assets/{index-Dm-MhWfc.js → index-Vdt8KS2l.js} +1 -1
- package/dist/assets/{index-DSddfOC9.js → index-ub2vI299.js} +1 -1
- package/dist/assets/{index-Cl62IadO.js → index-zmlRlLsp.js} +1 -1
- package/dist/assets/{invitation-DjO59W1C.js → invitation-CsaolrG3.js} +1 -1
- package/dist/assets/{invite-t79Nm2Zx.js → invite-Bz_emQWL.js} +1 -1
- package/dist/assets/{isURL-Bx60otHf.js → isURL-DviHJNBO.js} +1 -1
- package/dist/assets/{issue-passport-CXTkBSWc.js → issue-passport-ZQsWd3Dr.js} +1 -1
- package/dist/assets/{item-ZVdS__zd.js → item-vw_cuyBZ.js} +1 -1
- package/dist/assets/{landing-page-oOptuves.js → landing-page-CVL3NbvQ.js} +1 -1
- package/dist/assets/{layout-i3qPT3h9.js → layout-BKp8C5F-.js} +1 -1
- package/dist/assets/{list-oKgOsN2z.js → list-CY0v9mkZ.js} +1 -1
- package/dist/assets/{list-BxMbz6k1.js → list-zVgARuTW.js} +3 -3
- package/dist/assets/{localization-COWn2xkt.js → localization-UoEVomCp.js} +1 -1
- package/dist/assets/{log-Bi6PHqUs.js → log-CuQWYZCB.js} +1 -1
- package/dist/assets/{login-DDdmbVzv.js → login-1ZsKClLU.js} +1 -1
- package/dist/assets/{login-oauth-callback-D39cBDZP.js → login-oauth-callback-YZd7R3pO.js} +1 -1
- package/dist/assets/{logo-uploader-DRWtRqku.js → logo-uploader-DuDo-4bO.js} +2 -2
- package/dist/assets/{lost-passport-B1R7WTbU.js → lost-passport-Dx86JuPR.js} +1 -1
- package/dist/assets/{open-window-DTzdbnUT.js → open-window-DnjhXMUE.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-BkmmmYAi.js → over-due-invoice-payment-Dam76xor.js} +1 -1
- package/dist/assets/{overview-BxARj22l.js → overview-DiuRZ10x.js} +1 -1
- package/dist/assets/{passport-item-DgPDBerJ.js → passport-item-CwFxbGyQ.js} +1 -1
- package/dist/assets/{permission-D42aYR9e.js → permission-DwyNIiFn.js} +1 -1
- package/dist/assets/{preferences-BcDy0kQP.js → preferences-D93Xc9AW.js} +1 -1
- package/dist/assets/{profile-embed-DOdWPLKA.js → profile-embed-C7ST7lEr.js} +1 -1
- package/dist/assets/{publish-resource-B0NiskVq.js → publish-resource-DU3M6kAz.js} +1 -1
- package/dist/assets/{runtime-2fPExSHG.js → runtime-Cp_2Mkns.js} +1 -1
- package/dist/assets/sdk-j_z17Rma.js +1 -0
- package/dist/assets/{security-Bv7TZuHo.js → security-DNzyYn22.js} +1 -1
- package/dist/assets/{session-sOrWgMPW.js → session-DGj-_oAZ.js} +1 -1
- package/dist/assets/{setup-rvCY-r6K.js → setup-IfocPlKr.js} +1 -1
- package/dist/assets/{spaces-BCmMWVI9.js → spaces-CoMtZGNH.js} +1 -1
- package/dist/assets/{start-B0m4kfc8.js → start-CtfSNTEq.js} +1 -1
- package/dist/assets/{status-CUW3huRP.js → status-DYzeHwu5.js} +1 -1
- package/dist/assets/{step-actions-DF1OO2xv.js → step-actions-CJGBq_RL.js} +1 -1
- package/dist/assets/{studio-Xl6uVEBK.js → studio-cTiQkJ_r.js} +1 -1
- package/dist/assets/{team-DXp2kdu1.js → team-B8B1ZhIQ.js} +1 -1
- package/dist/assets/{traffic-5td870d8.js → traffic-DqTwvxdl.js} +1 -1
- package/dist/assets/{transfer-BtDVmVUd.js → transfer-Yhxjz3He.js} +1 -1
- package/dist/assets/{unsubscribe-BRrYNDWq.js → unsubscribe-D98i3Dcl.js} +1 -1
- package/dist/assets/{use-app-logo-mu7QCMiy.js → use-app-logo-wJojGoX8.js} +1 -1
- package/dist/assets/{user-center-CU9t4WoO.js → user-center-4QiBEXkz.js} +3 -3
- package/dist/assets/{user-follower-CZumNR6l.js → user-follower-daqBbJjL.js} +1 -1
- package/dist/assets/{user-sessions-BcCJ6YmQ.js → user-sessions-gPGe7NTf.js} +1 -1
- package/dist/assets/{util-Dffdnd4E.js → util-6fgrHxDz.js} +1 -1
- package/dist/assets/{util-RS7QU94f.js → util-BkJCSJXb.js} +1 -1
- package/dist/assets/{wait-connect-D_jGn7lY.js → wait-connect-D0ORg2Ga.js} +1 -1
- package/dist/assets/{wizard-BZlSlN9j.js → wizard-C7eP8Bda.js} +1 -1
- package/dist/assets/{wizard-components-CI8Erh9Q.js → wizard-components-CXkOVy_c.js} +2 -2
- package/dist/assets/{wrap-locale-YgVg0_fN.js → wrap-locale-BARiwFz6.js} +1 -1
- package/dist/assets/{zh-BRHJ9MGq.js → zh-D04z7ZNH.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +23 -23
- package/dist/assets/engine-c0Vv0qOe.js +0 -1
- package/dist/assets/index-DP3uANMf.js +0 -113
- package/dist/assets/sdk-BeAqfHTz.js +0 -1
|
@@ -11,6 +11,7 @@ const constant_1 = require("@abtnode/constant");
|
|
|
11
11
|
const copyright_1 = __importDefault(require("./copyright"));
|
|
12
12
|
const powered_by_1 = __importDefault(require("./powered-by"));
|
|
13
13
|
const style_1 = require("../_libs/style");
|
|
14
|
+
const react_1 = require("react");
|
|
14
15
|
const linkStyle = Object.assign(Object.assign({}, style_1.linkStyle), { color: '#898989', fontSize: '12px' });
|
|
15
16
|
function PointDivider() {
|
|
16
17
|
return (0, jsx_runtime_1.jsx)("span", { style: { color: '#757575', fontSize: '12px', fontWeight: 'bold' }, children: "\u00A0\u00B7\u00A0" });
|
|
@@ -30,10 +31,14 @@ function Footer({ showLogo = false, showCopyright = false, appInfo, locale = 'en
|
|
|
30
31
|
if (!userInfoContent) {
|
|
31
32
|
return null;
|
|
32
33
|
}
|
|
34
|
+
const unsubscribeTokenUrl = (0, react_1.useMemo)(() => {
|
|
35
|
+
// @note: Cannot use joinURL here because appInfo.url may contain query strings
|
|
36
|
+
return (0, ufo_1.resolveURL)(appInfo.url, constant_1.WELLKNOWN_SERVICE_PATH_PREFIX, `/user/unsubscribe?token=${unsubscribeToken}`);
|
|
37
|
+
}, [unsubscribeToken, appInfo.url]);
|
|
33
38
|
if (locale === 'zh') {
|
|
34
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u7531\u4E8E\u60A8\u662F", (0, jsx_runtime_1.jsx)(components_1.Link, { href: appInfo.url, target: "_blank", style: linkStyle, children: appInfo.title }), "\u7684\u8BA2\u9605\u8005\u6216\u7528\u6237\uFF0C\u6B64\u7535\u5B50\u90AE\u4EF6\u5DF2\u53D1\u9001\u5230", (userInfo === null || userInfo === void 0 ? void 0 : userInfo.email) ? ((0, jsx_runtime_1.jsx)(components_1.Link, { href: `mailto:${userInfo === null || userInfo === void 0 ? void 0 : userInfo.email}`, style: linkStyle, children: userInfo === null || userInfo === void 0 ? void 0 : userInfo.email })) : (userInfoContent), "\u3002", unsubscribeToken ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u5982\u679C\u60A8\u4E0D\u60F3\u518D\u6536\u5230\u6B64\u7C7B\u90AE\u4EF6\uFF0C\u60A8\u53EF\u4EE5", ' ', (0, jsx_runtime_1.jsx)(components_1.Link, { href:
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u7531\u4E8E\u60A8\u662F", (0, jsx_runtime_1.jsx)(components_1.Link, { href: appInfo.url, target: "_blank", style: linkStyle, children: appInfo.title }), "\u7684\u8BA2\u9605\u8005\u6216\u7528\u6237\uFF0C\u6B64\u7535\u5B50\u90AE\u4EF6\u5DF2\u53D1\u9001\u5230", (userInfo === null || userInfo === void 0 ? void 0 : userInfo.email) ? ((0, jsx_runtime_1.jsx)(components_1.Link, { href: `mailto:${userInfo === null || userInfo === void 0 ? void 0 : userInfo.email}`, style: linkStyle, children: userInfo === null || userInfo === void 0 ? void 0 : userInfo.email })) : (userInfoContent), "\u3002", unsubscribeToken ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u5982\u679C\u60A8\u4E0D\u60F3\u518D\u6536\u5230\u6B64\u7C7B\u90AE\u4EF6\uFF0C\u60A8\u53EF\u4EE5", ' ', (0, jsx_runtime_1.jsx)(components_1.Link, { href: unsubscribeTokenUrl, style: linkStyle, target: "_blank", children: "\u9000\u8BA2" }), "\u3002"] })) : null] }));
|
|
35
40
|
}
|
|
36
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["This email was sent to", ' ', (userInfo === null || userInfo === void 0 ? void 0 : userInfo.email) ? ((0, jsx_runtime_1.jsx)(components_1.Link, { href: `mailto:${userInfo === null || userInfo === void 0 ? void 0 : userInfo.email}`, style: linkStyle, children: userInfo === null || userInfo === void 0 ? void 0 : userInfo.email })) : (userInfoContent), ' ', "as you are a subscriber or a user of", ' ', (0, jsx_runtime_1.jsx)(components_1.Link, { href: appInfo.url, target: "_blank", style: linkStyle, children: appInfo.title }), ".", ' ', unsubscribeToken ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["If you'd rather not receive this kind of email, you can", ' ', (0, jsx_runtime_1.jsx)(components_1.Link, { href:
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["This email was sent to", ' ', (userInfo === null || userInfo === void 0 ? void 0 : userInfo.email) ? ((0, jsx_runtime_1.jsx)(components_1.Link, { href: `mailto:${userInfo === null || userInfo === void 0 ? void 0 : userInfo.email}`, style: linkStyle, children: userInfo === null || userInfo === void 0 ? void 0 : userInfo.email })) : (userInfoContent), ' ', "as you are a subscriber or a user of", ' ', (0, jsx_runtime_1.jsx)(components_1.Link, { href: appInfo.url, target: "_blank", style: linkStyle, children: appInfo.title }), ".", ' ', unsubscribeToken ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["If you'd rather not receive this kind of email, you can", ' ', (0, jsx_runtime_1.jsx)(components_1.Link, { href: unsubscribeTokenUrl, style: linkStyle, target: "_blank", children: "unsubscribe" }), "."] })) : null] }));
|
|
37
42
|
}
|
|
38
43
|
return ((0, jsx_runtime_1.jsxs)(components_1.Section, { children: [showLogo && (0, jsx_runtime_1.jsx)(components_1.Img, { src: appInfo.logo, width: "32", height: "32", alt: appInfo.title }), !showContactUs ? null : (0, jsx_runtime_1.jsx)(ContactUs, { signatureConfig: signatureConfig }), (0, jsx_runtime_1.jsx)(components_1.Text, { style: style_1.footerStyle, children: (0, jsx_runtime_1.jsx)(UnsubscribeContent, {}) }), (0, jsx_runtime_1.jsx)(components_1.Text, { style: { margin: '8px 0' } }), poweredBy && (0, jsx_runtime_1.jsx)(powered_by_1.default, Object.assign({}, poweredBy)), showCopyright && (0, jsx_runtime_1.jsx)(copyright_1.default, {})] }));
|
|
39
44
|
}
|
package/api/libs/email.js
CHANGED
|
@@ -13,6 +13,7 @@ const { ActivityNotificationEmail } = require('../emails/_templates/activity-not
|
|
|
13
13
|
const { VerifyCodeEmail } = require('../emails/_templates/verify-code');
|
|
14
14
|
const { KycCodeVerifyEmail } = require('../emails/_templates/kyc-code-verify');
|
|
15
15
|
const cache = require('../cache');
|
|
16
|
+
const { attachNotificationUTM, getUTMUrl } = require('../util/utm');
|
|
16
17
|
|
|
17
18
|
const schemaEmail = Joi.string().email().required();
|
|
18
19
|
|
|
@@ -52,6 +53,9 @@ async function sendEmail(
|
|
|
52
53
|
throw new Error('Email Service is not available.');
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
// eslint-disable-next-line no-param-reassign
|
|
57
|
+
notification = attachNotificationUTM(notification);
|
|
58
|
+
|
|
55
59
|
if (provider === 'service') {
|
|
56
60
|
const config = blocklet.settings?.notification?.email;
|
|
57
61
|
const info = getBlockletInfo(blocklet);
|
|
@@ -62,7 +66,7 @@ async function sendEmail(
|
|
|
62
66
|
description: info.description,
|
|
63
67
|
title: info.name,
|
|
64
68
|
version: info.version,
|
|
65
|
-
url: info.appUrl,
|
|
69
|
+
url: getUTMUrl(info.appUrl, notification.utm, notification?.sender?.componentDid),
|
|
66
70
|
};
|
|
67
71
|
|
|
68
72
|
const emailSignature = getEmailSignatureConfig(blocklet);
|
package/api/routes/user.js
CHANGED
|
@@ -1019,7 +1019,21 @@ module.exports = {
|
|
|
1019
1019
|
did: req.user.did,
|
|
1020
1020
|
extra: JSON.stringify(preSaveData),
|
|
1021
1021
|
});
|
|
1022
|
-
|
|
1022
|
+
|
|
1023
|
+
const result = user?.extra?.privacy || {};
|
|
1024
|
+
|
|
1025
|
+
await node.createAuditLog(
|
|
1026
|
+
{
|
|
1027
|
+
action: 'updateUserExtra',
|
|
1028
|
+
args: { teamDid, userDid: req.user.did, type: 'privacy' },
|
|
1029
|
+
context: formatContext(req),
|
|
1030
|
+
result: {
|
|
1031
|
+
privacy: value, // @FIXME: liushuang,多传一层的目的是为了保持和 SDK 相同结构
|
|
1032
|
+
},
|
|
1033
|
+
},
|
|
1034
|
+
node
|
|
1035
|
+
);
|
|
1036
|
+
res.json(result);
|
|
1023
1037
|
});
|
|
1024
1038
|
|
|
1025
1039
|
server.get(
|
|
@@ -1078,7 +1092,17 @@ module.exports = {
|
|
|
1078
1092
|
did: req.user.did,
|
|
1079
1093
|
extra: JSON.stringify(preSaveData),
|
|
1080
1094
|
});
|
|
1081
|
-
|
|
1095
|
+
const result = pick(user.extra || {}, ['notifications', 'webhooks']);
|
|
1096
|
+
await node.createAuditLog(
|
|
1097
|
+
{
|
|
1098
|
+
action: 'updateUserExtra',
|
|
1099
|
+
args: { teamDid, userDid: req.user.did, type: value.webhooks ? 'webhooks' : 'notifications' },
|
|
1100
|
+
context: formatContext(req),
|
|
1101
|
+
result,
|
|
1102
|
+
},
|
|
1103
|
+
node
|
|
1104
|
+
);
|
|
1105
|
+
res.json(result);
|
|
1082
1106
|
}
|
|
1083
1107
|
);
|
|
1084
1108
|
|
|
@@ -1355,6 +1379,16 @@ module.exports = {
|
|
|
1355
1379
|
return;
|
|
1356
1380
|
}
|
|
1357
1381
|
|
|
1382
|
+
await node.createAuditLog(
|
|
1383
|
+
{
|
|
1384
|
+
action: 'updateUserInfo',
|
|
1385
|
+
args: { teamDid, userDid: req.user.did },
|
|
1386
|
+
context: formatContext(req),
|
|
1387
|
+
result: updateData,
|
|
1388
|
+
},
|
|
1389
|
+
node
|
|
1390
|
+
);
|
|
1391
|
+
|
|
1358
1392
|
res.json(
|
|
1359
1393
|
pick(user || {}, [
|
|
1360
1394
|
'did',
|
|
@@ -1550,6 +1584,14 @@ module.exports = {
|
|
|
1550
1584
|
|
|
1551
1585
|
try {
|
|
1552
1586
|
const result = await node.followUser({ teamDid, userDid, followerDid });
|
|
1587
|
+
await node.createAuditLog(
|
|
1588
|
+
{
|
|
1589
|
+
action: 'followUser',
|
|
1590
|
+
args: { teamDid, userDid, followerDid },
|
|
1591
|
+
context: formatContext(req),
|
|
1592
|
+
},
|
|
1593
|
+
node
|
|
1594
|
+
);
|
|
1553
1595
|
res.json(result);
|
|
1554
1596
|
} catch (err) {
|
|
1555
1597
|
logger.error('Failed to follow user', { error: err, userDid: req.user.did });
|
|
@@ -1579,6 +1621,14 @@ module.exports = {
|
|
|
1579
1621
|
|
|
1580
1622
|
try {
|
|
1581
1623
|
const result = await node.unfollowUser({ teamDid, userDid, followerDid });
|
|
1624
|
+
await node.createAuditLog(
|
|
1625
|
+
{
|
|
1626
|
+
action: 'unfollowUser',
|
|
1627
|
+
args: { teamDid, userDid, followerDid },
|
|
1628
|
+
context: formatContext(req),
|
|
1629
|
+
},
|
|
1630
|
+
node
|
|
1631
|
+
);
|
|
1582
1632
|
res.json(result);
|
|
1583
1633
|
} catch (err) {
|
|
1584
1634
|
logger.error('Failed to unfollow user', { error: err, userDid: req.user.did });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { messages } = require('@abtnode/auth/lib/auth');
|
|
2
2
|
const { authenticateByVc, getVerifyAccessClaims, validateVerifyDestroyRequest } = require('@abtnode/auth/lib/server');
|
|
3
|
-
const { ROLES } = require('@abtnode/constant');
|
|
3
|
+
const { ROLES, PASSPORT_STATUS } = require('@abtnode/constant');
|
|
4
4
|
const { getSourceAppPid } = require('@blocklet/sdk/lib/util/login');
|
|
5
5
|
const { fromBase64 } = require('@ocap/util');
|
|
6
6
|
const { LOGIN_PROVIDER } = require('@blocklet/constant');
|
|
@@ -11,14 +11,27 @@ const logger = require('../../../libs/logger')();
|
|
|
11
11
|
const { createTokenFn, getDidConnectVersion } = require('../../../util');
|
|
12
12
|
const { getTrustedIssuers } = require('../../../util/blocklet-utils');
|
|
13
13
|
|
|
14
|
+
// GUEST 角色包含两种情况:
|
|
15
|
+
// 1. 用户没有任何身份凭证(passport)
|
|
16
|
+
// 2. 用户有身份凭证,但角色为 guest
|
|
14
17
|
const ALLOWED_ROLES = [ROLES.OWNER, ROLES.ADMIN, ROLES.MEMBER, ROLES.GUEST];
|
|
15
|
-
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param {*} shouldCheckRole boolean or string
|
|
21
|
+
* @returns boolean
|
|
22
|
+
*/
|
|
23
|
+
const parseShouldCheckRole = (shouldCheckRole) => {
|
|
24
|
+
if (typeof shouldCheckRole === 'boolean') {
|
|
25
|
+
return shouldCheckRole;
|
|
26
|
+
}
|
|
27
|
+
return shouldCheckRole === 'true';
|
|
28
|
+
};
|
|
16
29
|
|
|
17
30
|
// eslint-disable-next-line no-unused-vars
|
|
18
31
|
module.exports = function createRoutes(node, authenticator, createSessionToken) {
|
|
19
32
|
return {
|
|
20
33
|
action: 'verify-destroy',
|
|
21
|
-
onConnect: async ({ request, userDid, extraParams: { locale, payload, roles } }) => {
|
|
34
|
+
onConnect: async ({ request, userDid, extraParams: { locale, payload, roles, shouldCheckRole = true } }) => {
|
|
22
35
|
const blocklet = await request.getBlocklet();
|
|
23
36
|
const user = await node.getUser({
|
|
24
37
|
teamDid: blocklet.appPid,
|
|
@@ -32,11 +45,18 @@ module.exports = function createRoutes(node, authenticator, createSessionToken)
|
|
|
32
45
|
throw new Error(messages.notAuthorized[locale]);
|
|
33
46
|
}
|
|
34
47
|
|
|
35
|
-
const
|
|
36
|
-
|
|
48
|
+
const allowedRoles = user.passports
|
|
49
|
+
.filter((x) => x.status === PASSPORT_STATUS.VALID && x.scope === 'passport')
|
|
50
|
+
.map((x) => x.role);
|
|
51
|
+
let expected = [];
|
|
52
|
+
if (parseShouldCheckRole(shouldCheckRole)) {
|
|
53
|
+
expected = validateVerifyDestroyRequest({ payload, roles, locale, allowedRoles: ALLOWED_ROLES });
|
|
54
|
+
} else {
|
|
55
|
+
expected = allowedRoles;
|
|
56
|
+
}
|
|
37
57
|
|
|
38
58
|
const sourceAppPid = getSourceAppPid(request);
|
|
39
|
-
if (!
|
|
59
|
+
if (!allowedRoles.length) {
|
|
40
60
|
return {
|
|
41
61
|
verifiableCredential: {
|
|
42
62
|
type: 'verifiableCredential',
|
|
@@ -60,7 +80,7 @@ module.exports = function createRoutes(node, authenticator, createSessionToken)
|
|
|
60
80
|
},
|
|
61
81
|
|
|
62
82
|
onAuth: async ({ request, claims, challenge, userDid, updateSession, extraParams }) => {
|
|
63
|
-
const { locale, payload } = extraParams;
|
|
83
|
+
const { locale, payload, shouldCheckRole } = extraParams;
|
|
64
84
|
const sourceAppPid = getSourceAppPid(request);
|
|
65
85
|
const [blocklet, blockletInfo] = await Promise.all([request.getBlocklet(), request.getBlockletInfo()]);
|
|
66
86
|
const userInfo = await node.getUser({
|
|
@@ -68,9 +88,22 @@ module.exports = function createRoutes(node, authenticator, createSessionToken)
|
|
|
68
88
|
user: { did: userDid },
|
|
69
89
|
options: { enableConnectedAccount: true },
|
|
70
90
|
});
|
|
91
|
+
|
|
92
|
+
if (!userInfo) {
|
|
93
|
+
throw new Error(messages.notAllowed[locale]);
|
|
94
|
+
}
|
|
95
|
+
if (!userInfo.approved) {
|
|
96
|
+
throw new Error(messages.notAuthorized[locale]);
|
|
97
|
+
}
|
|
98
|
+
|
|
71
99
|
const parsed = JSON.parse(fromBase64(payload).toString());
|
|
72
100
|
|
|
73
|
-
|
|
101
|
+
const userRoles = userInfo.passports
|
|
102
|
+
.filter((x) => x.status === PASSPORT_STATUS.VALID && x.scope === 'passport')
|
|
103
|
+
.map((x) => x.role);
|
|
104
|
+
|
|
105
|
+
// 如果用户没有任何 passport,则不进行验证
|
|
106
|
+
if (!parseShouldCheckRole(shouldCheckRole) && !userRoles.length) {
|
|
74
107
|
return;
|
|
75
108
|
}
|
|
76
109
|
|
|
@@ -86,7 +119,7 @@ module.exports = function createRoutes(node, authenticator, createSessionToken)
|
|
|
86
119
|
action: 'verify-destroy',
|
|
87
120
|
});
|
|
88
121
|
|
|
89
|
-
if (!
|
|
122
|
+
if (!userRoles.includes(role)) {
|
|
90
123
|
throw new Error(messages.notAllowed[locale]);
|
|
91
124
|
}
|
|
92
125
|
|
package/api/socket/util.js
CHANGED
|
@@ -5,7 +5,7 @@ const { getApplicationInfo } = require('@abtnode/auth/lib/auth');
|
|
|
5
5
|
const logger = require('../libs/logger')('socket');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @param {
|
|
8
|
+
* @param {import('@blocklet/sdk/lib/types/notification').TNotification} notification
|
|
9
9
|
* @param {{
|
|
10
10
|
* {string} name
|
|
11
11
|
* {Wallet} wallet
|
|
@@ -28,6 +28,7 @@ const parseNotification = (notification, senderInfo) => {
|
|
|
28
28
|
// actualDid is the did of the application that is used to decrypt the message if needed
|
|
29
29
|
actualDid: senderInfo.wallet.address,
|
|
30
30
|
actualPk: senderInfo.wallet.pk,
|
|
31
|
+
componentDid: senderInfo.componentDid,
|
|
31
32
|
};
|
|
32
33
|
});
|
|
33
34
|
|
|
@@ -60,6 +61,8 @@ const ensureSenderApp = async ({ sender, node, nodeInfo }) => {
|
|
|
60
61
|
throw new Error(`Invalid authentication token for sender blocklet: ${sender.appDid}`);
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
appInfo.componentDid = sender.componentDid;
|
|
65
|
+
|
|
63
66
|
return appInfo;
|
|
64
67
|
};
|
|
65
68
|
|
package/api/util/utm.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
const { withQuery, getQuery } = require('ufo');
|
|
2
|
+
const isUrl = require('is-url');
|
|
3
|
+
const cloneDeep = require('lodash/cloneDeep');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* 为外部 URL 添加 UTM 追踪参数
|
|
8
|
+
* @param {string} url - 原始 URL 地址
|
|
9
|
+
* @param {{
|
|
10
|
+
* source?: string;
|
|
11
|
+
* medium?: string;
|
|
12
|
+
* campaign?: string;
|
|
13
|
+
* content?: string;
|
|
14
|
+
* }} utm - 导航区域,默认是 notification 的 utm
|
|
15
|
+
* @param {string} componentDid - 组件 DID
|
|
16
|
+
* @returns {string} 添加 UTM 参数后的 URL
|
|
17
|
+
* @see https://team.arcblock.io/comment/discussions/7504c5ce-7453-4223-a539-27620efcf38e#ffed52a7-916e-4586-aa78-a29a377804e6
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
function getUTMUrl(url, utm, componentDid) {
|
|
21
|
+
try {
|
|
22
|
+
if (!isUrl(url)) {
|
|
23
|
+
return url;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const existsQueryParams = getQuery(url);
|
|
27
|
+
|
|
28
|
+
// 根据 componentDid 设置默认的 emailUTMSource
|
|
29
|
+
const getDefaultUTMSource = (_componentDid) => {
|
|
30
|
+
const transactionalEmailComponents = [
|
|
31
|
+
'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk', // Payment Kit
|
|
32
|
+
'z8iZkFBbrVQxZHvcWWB3Sa2TrfGmSeFz9MSU7', // Launcher
|
|
33
|
+
'z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p', // DID Names
|
|
34
|
+
'z8iZnaYxnkMD5AKRjTKiCb8pQr1ut8UantAcf', // DID Spaces
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
return transactionalEmailComponents.includes(_componentDid) ? 'transactional_email' : 'activity_notification';
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const emailUTMSource = process.env.EMAIL_UTM_SOURCE || getDefaultUTMSource(componentDid);
|
|
41
|
+
const emailUTMMedium = process.env.EMAIL_UTM_MEDIUM || 'email';
|
|
42
|
+
const emailUTMCampaign = process.env.EMAIL_UTM_CAMPAIGN || 'notification';
|
|
43
|
+
const emailUTMContent = process.env.EMAIL_UTM_CONTENT || 'email_body';
|
|
44
|
+
const queryParams = {
|
|
45
|
+
// 自身站点的 hostname
|
|
46
|
+
utm_source: utm?.source || emailUTMSource,
|
|
47
|
+
// 默认为 email
|
|
48
|
+
utm_medium: utm?.medium || emailUTMMedium,
|
|
49
|
+
// 全局导航统一标签
|
|
50
|
+
utm_campaign: utm?.campaign || emailUTMCampaign,
|
|
51
|
+
// 目标站点标识
|
|
52
|
+
utm_content: utm?.content || emailUTMContent,
|
|
53
|
+
...existsQueryParams,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return withQuery(url, queryParams);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error('Failed to generate UTM URL:', error);
|
|
59
|
+
return url;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 将 notification 中的 url 添加 UTM 参数
|
|
65
|
+
* @param {import('@blocklet/sdk/lib/types/notification').TNotification} notification
|
|
66
|
+
* @returns {import('@blocklet/sdk/lib/types/notification').TNotification} 处理后的 notification 对象
|
|
67
|
+
*/
|
|
68
|
+
function attachNotificationUTM(notification) {
|
|
69
|
+
if (!notification || typeof notification !== 'object') {
|
|
70
|
+
return notification;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const componentDid = notification.sender?.componentDid;
|
|
74
|
+
|
|
75
|
+
// 创建一个深拷贝避免修改原对象
|
|
76
|
+
const notificationClone = cloneDeep(notification);
|
|
77
|
+
|
|
78
|
+
// 处理顶层的 url 字段
|
|
79
|
+
if (notificationClone.url) {
|
|
80
|
+
notificationClone.url = getUTMUrl(notificationClone.url, notificationClone.utm, componentDid);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 处理顶层的 checkUrl 字段
|
|
84
|
+
if (notificationClone.checkUrl) {
|
|
85
|
+
notificationClone.checkUrl = getUTMUrl(notificationClone.checkUrl, notificationClone.utm, componentDid);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 处理 actions 中的 link 字段
|
|
89
|
+
if (notificationClone.actions && Array.isArray(notificationClone.actions)) {
|
|
90
|
+
notificationClone.actions.forEach((action) => {
|
|
91
|
+
if (action && action.link) {
|
|
92
|
+
action.link = getUTMUrl(
|
|
93
|
+
action.link,
|
|
94
|
+
{
|
|
95
|
+
...notificationClone.utm,
|
|
96
|
+
...action.utm,
|
|
97
|
+
},
|
|
98
|
+
componentDid
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 处理 attachments 和 blocks 中的 URL
|
|
105
|
+
const processAttachments = (attachments) => {
|
|
106
|
+
if (!Array.isArray(attachments)) return;
|
|
107
|
+
|
|
108
|
+
attachments.forEach((attachment) => {
|
|
109
|
+
if (!attachment) return;
|
|
110
|
+
|
|
111
|
+
const { type, data } = attachment;
|
|
112
|
+
|
|
113
|
+
switch (type) {
|
|
114
|
+
case 'image':
|
|
115
|
+
if (data && data.url) {
|
|
116
|
+
data.url = getUTMUrl(
|
|
117
|
+
data.url,
|
|
118
|
+
{
|
|
119
|
+
...notificationClone.utm,
|
|
120
|
+
...data.utm,
|
|
121
|
+
},
|
|
122
|
+
componentDid
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
|
|
127
|
+
case 'dapp':
|
|
128
|
+
if (data) {
|
|
129
|
+
if (data.url) {
|
|
130
|
+
data.url = getUTMUrl(
|
|
131
|
+
data.url,
|
|
132
|
+
{
|
|
133
|
+
...notificationClone.utm,
|
|
134
|
+
...data.utm,
|
|
135
|
+
},
|
|
136
|
+
componentDid
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
if (data.logo) {
|
|
140
|
+
data.logo = getUTMUrl(
|
|
141
|
+
data.logo,
|
|
142
|
+
{
|
|
143
|
+
...notificationClone.utm,
|
|
144
|
+
...data.utm,
|
|
145
|
+
},
|
|
146
|
+
componentDid
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
break;
|
|
151
|
+
|
|
152
|
+
case 'link':
|
|
153
|
+
if (data) {
|
|
154
|
+
if (data.url) {
|
|
155
|
+
data.url = getUTMUrl(
|
|
156
|
+
data.url,
|
|
157
|
+
{
|
|
158
|
+
...notificationClone.utm,
|
|
159
|
+
...data.utm,
|
|
160
|
+
},
|
|
161
|
+
componentDid
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
if (data.image) {
|
|
165
|
+
data.image = getUTMUrl(
|
|
166
|
+
data.image,
|
|
167
|
+
{
|
|
168
|
+
...notificationClone.utm,
|
|
169
|
+
...data.utm,
|
|
170
|
+
},
|
|
171
|
+
componentDid
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
|
|
177
|
+
case 'section':
|
|
178
|
+
// 处理 section 中的 fields,可能包含嵌套的 attachments
|
|
179
|
+
if (attachment.fields && Array.isArray(attachment.fields)) {
|
|
180
|
+
processAttachments(attachment.fields);
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
|
|
184
|
+
default:
|
|
185
|
+
// 对于其他类型,检查是否有通用的 url 字段
|
|
186
|
+
if (data && data.url) {
|
|
187
|
+
data.url = getUTMUrl(
|
|
188
|
+
data.url,
|
|
189
|
+
{
|
|
190
|
+
...notificationClone.utm,
|
|
191
|
+
...data.utm,
|
|
192
|
+
},
|
|
193
|
+
componentDid
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// 处理 attachments
|
|
202
|
+
if (notificationClone.attachments) {
|
|
203
|
+
processAttachments(notificationClone.attachments);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// 处理 blocks
|
|
207
|
+
if (notificationClone.blocks) {
|
|
208
|
+
processAttachments(notificationClone.blocks);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// 处理 activity 中的 target.id(可能是 URL)
|
|
212
|
+
if (notificationClone.activity && notificationClone.activity.target && notificationClone.activity.target.id) {
|
|
213
|
+
notificationClone.activity.target.id = getUTMUrl(
|
|
214
|
+
notificationClone.activity.target.id,
|
|
215
|
+
{
|
|
216
|
+
...notificationClone.utm,
|
|
217
|
+
...notificationClone.activity.target.utm,
|
|
218
|
+
},
|
|
219
|
+
componentDid
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// 处理 activity 中的 meta.id(可能是 URL)
|
|
224
|
+
if (notificationClone.activity && notificationClone.activity.meta && notificationClone.activity.meta.id) {
|
|
225
|
+
notificationClone.activity.meta.id = getUTMUrl(
|
|
226
|
+
notificationClone.activity.meta.id,
|
|
227
|
+
{
|
|
228
|
+
...notificationClone.utm,
|
|
229
|
+
...notificationClone.activity.meta.utm,
|
|
230
|
+
},
|
|
231
|
+
componentDid
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return notificationClone;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
module.exports = {
|
|
239
|
+
getUTMUrl,
|
|
240
|
+
attachNotificationUTM,
|
|
241
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as h,j as e,ak as l,y as E,bp as A,b6 as g,bq as L,at as N,W as y}from"./vendor-mui-core-Bq_sfmbr.js";import{r as m}from"./vendor-react-Dvs43sk9.js";import{T as I,H as j}from"./vendor-ux-DnuP69h2.js";import{A as b}from"./config-
|
|
1
|
+
import{D as h,j as e,ak as l,y as E,bp as A,b6 as g,bq as L,at as N,W as y}from"./vendor-mui-core-Bq_sfmbr.js";import{r as m}from"./vendor-react-Dvs43sk9.js";import{T as I,H as j}from"./vendor-ux-DnuP69h2.js";import{A as b}from"./config-CmIvwzmQ.js";import{a as O}from"./page-header-CIjuv0WX.js";import{m as v,f as R,c as o,h as T}from"./index-B2EmOTH7.js";import{S as Y}from"./layout-BKp8C5F-.js";import{S as D}from"./step-actions-CJGBq_RL.js";import{S as P}from"./button-VDZIHEym.js";import"./vendor-utils-DQK0pEML.js";import"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-CzdgnaKl.js";import"./content-layout-CotAwqHA.js";import"./use-mobile-C8UweHoJ.js";function W({onNext:a=()=>{}}){const C=h(),{t:n,locale:p}=I(),[i,c]=m.useState(!1),[S,d]=m.useState(""),{blocklet:r}=v();m.useEffect(()=>{const t=R.findServiceFromMeta(r.meta,o.NODE_SERVICES.AUTH);d(t?.config?.whoCanAccess||o.WHO_CAN_ACCESS.ALL)},[r]);const f=async t=>{let s=o.ACCESS_POLICY_PUBLIC;t===o.WHO_CAN_ACCESS.ALL?s=o.ACCESS_POLICY_PUBLIC:t===o.WHO_CAN_ACCESS.INVITED?s=o.ACCESS_POLICY_INVITED_ONLY:t===o.WHO_CAN_ACCESS.OWNER?s=o.ACCESS_POLICY_OWNER_ONLY:t===o.WHO_CAN_ACCESS.ADMIN&&(s=o.ACCESS_POLICY_ADMIN_ONLY);try{c(!0),await T.updateBlockletSecurityRule({input:{did:r.meta.did,data:{id:o.SECURITY_RULE_DEFAULT_ID,accessPolicyId:s}}}),c(!1)}catch(_){c(!1),j.error(_.message)}},x=async t=>{i||(d(t.target.value),await f(t.target.value))},u={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:C.palette.text.secondary};return e.jsxs(k,{children:[e.jsx(l,{className:"header",children:e.jsx(O,{title:n("blocklet.config.access.title"),subTitle:n("blocklet.config.access.description")})}),e.jsx(l,{className:"form-container",children:e.jsx(E,{component:"fieldset",children:e.jsx(A,{name:"inherit",value:S,onChange:x,children:b.map(t=>e.jsxs(l,{sx:{mb:2,"&:last-child":{mb:0}},children:[e.jsx(g,{value:t.value,control:e.jsx(L,{size:"small",color:"primary"}),label:e.jsxs("span",{style:{display:"flex",alignItems:"center",position:"relative"},children:[e.jsx(t.icon,{style:u}),e.jsx("span",{style:{marginTop:2},children:t.title[p]})]})}),e.jsx(l,{className:"tip",children:t.description[p]})]},t.value))})})}),e.jsx(D,{mt:8,disabled:i,blocklet:r,onStartNow:()=>a("complete"),children:e.jsx(P,{loading:i,variant:"contained",disabled:i,onClick:()=>a(),children:n("setup.continue")})})]})}W.propTypes={onNext:y.func};const k=N(Y)`
|
|
2
2
|
height: 100%;
|
|
3
3
|
overflow-y: auto;
|
|
4
4
|
.header {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{W as F,j as l,a6 as jt,at as ot,ak as te,D as qt,T as Ie,J as Yt,b6 as Zr,a5 as ei,I as No,bU as Ao,S as Do,ch as va,dS as ya,aP as Mo,F as ba,z as Gn,bH as xa,bI as wa,bJ as Sa,bC as Ea,aX as Bo,V as ka,aO as Ta,cO as ja,cP as Oa,bA as Ca,bD as Ia,M as ti,am as Fo,aq as Ra,b1 as ut,b7 as Pa,ds as La,a8 as $o,ad as Uo,aV as _a,aj as qo,Q as Tn,Y as Na,bv as Wo,o as zo,aU as Aa,ar as Xt,c6 as Da,c5 as Ma,c1 as Ei,U as ki,ah as Ba,dM as Fa,O as $a,K as Ua,P as qa,ai as Wa,an as Vo,A as Ti,aI as za,dI as Va}from"./vendor-mui-core-Bq_sfmbr.js";import{r as q,g as ni,u as Ka,i as Ga,p as Ha,e as Xa,a as Ut,d as Ya,f as In,j as Ja}from"./vendor-react-Dvs43sk9.js";import{r as ri,S as Qa,s as Ko,A as Za}from"./item-
|
|
1
|
+
import{W as F,j as l,a6 as jt,at as ot,ak as te,D as qt,T as Ie,J as Yt,b6 as Zr,a5 as ei,I as No,bU as Ao,S as Do,ch as va,dS as ya,aP as Mo,F as ba,z as Gn,bH as xa,bI as wa,bJ as Sa,bC as Ea,aX as Bo,V as ka,aO as Ta,cO as ja,cP as Oa,bA as Ca,bD as Ia,M as ti,am as Fo,aq as Ra,b1 as ut,b7 as Pa,ds as La,a8 as $o,ad as Uo,aV as _a,aj as qo,Q as Tn,Y as Na,bv as Wo,o as zo,aU as Aa,ar as Xt,c6 as Da,c5 as Ma,c1 as Ei,U as ki,ah as Ba,dM as Fa,O as $a,K as Ua,P as qa,ai as Wa,an as Vo,A as Ti,aI as za,dI as Va}from"./vendor-mui-core-Bq_sfmbr.js";import{r as q,g as ni,u as Ka,i as Ga,p as Ha,e as Xa,a as Ut,d as Ya,f as In,j as Ja}from"./vendor-react-Dvs43sk9.js";import{r as ri,S as Qa,s as Ko,A as Za}from"./item-vw_cuyBZ.js";import{D as bt,F as ii,J as Go,T as St,ab as xt,H as Hn,aL as ji,l as Qt,C as Ho,$ as zn,V as Xo,I as el,O as tl,a7 as Br,bb as nl}from"./vendor-ux-DnuP69h2.js";import{Z as un,f as $t,c as rl,ch as il,bd as ol,av as sl,aB as Xn,b9 as al,bW as Yo,ci as ll,bS as cl,cj as ul,ck as dl,a4 as hl,X as Bt,bG as fl,v as Jo,aM as pl,cl as ml,G as gl,cm as vl,a8 as Yn,cn as Qo,bl as Zo,k as Jn,ah as Oi,co as yl,ao as bl,cp as xl,cq as wl,cr as Rn,cs as Ci,ba as Sl}from"./index-B2EmOTH7.js";import{j as Ii,o as El,T as kl,L as Tl,P as jl}from"./vendor-arcblock-CzdgnaKl.js";import{u as Ri}from"./launch-result-message-CFpqIQB2.js";import{a as Fr}from"./page-header-CIjuv0WX.js";import{e as yt,B as Ol,C as nn,J as Qn,D as Pi,R as es,Q as Cl,a8 as Il,A as Rl,o as or,U as Pl,am as Ll,an as _l,ao as Nl,a as bn,S as Al,b as Dl}from"./vendor-utils-DQK0pEML.js";import{f as $r}from"./index-DBs9Ljax.js";import{e as Ml}from"./engine-CRVby1S4.js";import{u as Bl,C as Fl}from"./config-space-BVAKDgsX.js";import{R as Pn}from"./required-CtPXGgxr.js";import{S as $l}from"./index-C1-AZbYf.js";import{a as ts,h as Ul,w as ql,f as Wl,b as zl,d as Vl,e as Kl,M as Gl}from"./index-DdXpn59U.js";import{k as jn,a as Hl,b as Xl,u as ns,g as Yl,o as Jl}from"./vendor-hooks-DLNZ8kxG.js";import{g as Ql}from"./get-safe-url-D4-uUwWa.js";import{r as rs,A as Zl}from"./config-vTUk_Yfk.js";import{r as ec}from"./index-BPy8_fa2.js";import{r as tc}from"./cloneDeep-sSKmkjV3.js";import{u as oi}from"./useLocalStorage-DyyYsV_-.js";import{v as Li}from"./index-CcuDh75j.js";import{u as nc}from"./session-DGj-_oAZ.js";import{W as rc}from"./did-address-4KKI5Z_V.js";import{a as _i}from"./api-sewNv0AE.js";import{v as ic,e as oc}from"./util-6fgrHxDz.js";import{u as is}from"./use-mobile-D2h0sedv.js";import{C as sc}from"./content-layout-CotAwqHA.js";import{C as ac,D as lc,a as cc}from"./connect-to-CtS-ZsP9.js";import{d as sr}from"./search-4YYphs0l.js";const Lf="blocklet-add-component-registry",_f="server-add-registry",Nf=e=>`resource-${e}-add-registry`;function os(e){const{info:t}=un();return q.useMemo(()=>!e||!e.docker?.image||e.docker?.image&&e.docker?.runBaseScript?!0:window.blocklet?window.blocklet.enableDocker&&window.blocklet.enableDockerNetwork:t.enableDocker&&t.enableDockerNetwork,[e,t])}function ss({disabled:e=!1,children:t,onConfirm:r}){return q.useEffect(()=>{if(e)return()=>{};const i=s=>{s.code==="Enter"&&(s.metaKey===!0||s.ctrlKey===!0)&&(s.preventDefault(),s.stopPropagation(),r())};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[e,r]),t}ss.propTypes={disabled:F.bool,children:F.any.isRequired,onConfirm:F.func.isRequired};function as({onContinue:e,nextDisabled:t=!1,launching:r=!1,texts:i={listenName:"",launchingText:"",buttonNext:""},description:s=""}){const[n,o]=q.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(uc,{children:l.jsxs(ss,{disabled:t,onConfirm:e,children:[l.jsx("div",{className:"eula-trigger",onClick:()=>o(a=>!a),children:i.listenName}),l.jsx(bt,{disabled:t,color:"primary",variant:"contained",className:"next-button",onClick:e,children:r?l.jsxs(l.Fragment,{children:[l.jsx(jt,{size:14}),i.launchingText]}):i.buttonNext})]})}),l.jsx(ii,{open:n,title:i.listenName,onClose:()=>o(!1),children:s})]})}as.propTypes={onContinue:F.func.isRequired,nextDisabled:F.bool,launching:F.bool,description:F.any,texts:F.object};const uc=ot.div`
|
|
2
2
|
margin: 0 auto;
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: space-between;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{J as v,j as l}from"./vendor-mui-core-Bq_sfmbr.js";import{j as B,r}from"./vendor-react-Dvs43sk9.js";import{C as W,D as L}from"./vendor-utils-DQK0pEML.js";import{T as O,F as T}from"./vendor-ux-DnuP69h2.js";import{h as d,b as A,m as F}from"./vendor-hooks-DLNZ8kxG.js";import{A as _,S as $}from"./add-component-core-
|
|
1
|
+
import{J as v,j as l}from"./vendor-mui-core-Bq_sfmbr.js";import{j as B,r}from"./vendor-react-Dvs43sk9.js";import{C as W,D as L}from"./vendor-utils-DQK0pEML.js";import{T as O,F as T}from"./vendor-ux-DnuP69h2.js";import{h as d,b as A,m as F}from"./vendor-hooks-DLNZ8kxG.js";import{A as _,S as $}from"./add-component-core-BrVCLSN6.js";import{m as K,I as z}from"./index-B2EmOTH7.js";import"./lottie-web-4koyQiv_.js";import"./item-vw_cuyBZ.js";import"./index-DBs9Ljax.js";import"./delete-confirm-ad8t0UXs.js";import"./click-to-copy-CH3FJWJo.js";import"./confirm-DV4YCyEc.js";import"./session-DGj-_oAZ.js";import"./get-safe-url-D4-uUwWa.js";import"./did-address-4KKI5Z_V.js";import"./wait-connect-D0ORg2Ga.js";import"./vendor-arcblock-CzdgnaKl.js";import"./launch-result-message-CFpqIQB2.js";import"./page-header-CIjuv0WX.js";import"./engine-CRVby1S4.js";import"./config-space-BVAKDgsX.js";import"./spaces-CoMtZGNH.js";import"./api-sewNv0AE.js";import"./required-CtPXGgxr.js";import"./index-C1-AZbYf.js";import"./Google-DzJt8j2p.js";import"./cloneDeep-sSKmkjV3.js";import"./form-wrapper-BEhcx7Ef.js";import"./logo-uploader-DuDo-4bO.js";import"./collapse-Cf8moIch.js";import"./index-DdXpn59U.js";import"./config-vTUk_Yfk.js";import"./isURL-DviHJNBO.js";import"./section-4lLmF6fb.js";import"./form-text-input-CyaKz-aW.js";import"./edit.svg-DycWG9v3.js";import"./index-BPy8_fa2.js";import"./index-BWhAMS1Q.js";import"./useLocalStorage-DyyYsV_-.js";import"./index-CcuDh75j.js";import"./util-6fgrHxDz.js";import"./use-mobile-D2h0sedv.js";import"./content-layout-CotAwqHA.js";import"./connect-to-CtS-ZsP9.js";import"./index-BV5aEWS1.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-C4j3gH0o.js";import"./search-4YYphs0l.js";function _t(){const{t:u}=O(),{blocklet:h}=K(),{componentDid:s}=B(),w=v(t=>t.breakpoints.down("md")),e=new URL(window.location.href),f=e.searchParams.get("mode")==="dialog",n=e.searchParams.get("resourceType")||"",m=e.searchParams.get("resourceDid")||s,g=e.searchParams.get("store")||"",C=e.searchParams.get("showFromUrl")!=="false",R=e.searchParams.get("showResourcesSwitch")!=="false",S=e.searchParams.get("enableRunBackground")!=="false",b=e.searchParams.get("showCategory")!=="false",a=h?.meta?.did,i=g.split(",").filter(Boolean).map(t=>{try{return new URL(t.startsWith("http")?t:`https://${t}`).origin}catch(o){return console.error(o),null}}).filter(Boolean),[y,E]=r.useState(i.map(t=>({url:t,name:t.replace("https://","")}))),[P,D]=r.useState(null),[U,j]=r.useState("");r.useEffect(()=>{(async()=>{try{const t=await Promise.all(i.map(async o=>{const x=W(o,"/api/store.json"),{data:M}=await L.get(x);return{url:o,name:M.name}}));E(t||[])}catch(t){console.error(t)}})()},[i.join(",")]);const k=()=>{window.parent.postMessage({event:"resourceDialog.close",componentDid:s},"*")};r.useEffect(()=>{const t=z();return a&&t.connect(),()=>{a&&t.isConnected()&&t.disconnect()}},[a]),d(()=>{window.parent.postMessage({event:"resourceDialog.loaded",componentDid:s},"*")});const c=A(t=>{t.data?.event==="resourceDialog.select"&&t.data?.componentDid===s&&(D(t.data.data),j(t.data.storeUrl))});d(()=>{window.addEventListener("message",c)}),F(()=>{window.removeEventListener("message",c)});const p=({inDialog:t=!0}={})=>l.jsx(_,{stores:y,selectedMeta:P,storeUrl:U,resourceType:n,resourceDid:m,mode:"embed",inDialog:t,storageKey:$(`${n}+${m}`),showResourcesSwitch:R,showFromUrl:C,enableRunBackground:S,showCategory:b});return f?l.jsx(T,{className:"resource-dialog",title:u("blocklet.publish.addResource"),maxWidth:!1,fullWidth:!1,PaperProps:{style:w?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:(t,o)=>{o!=="backdropClick"&&k()},showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:p()}):p({inDialog:!1})}export{_t as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as t,k as x}from"./vendor-react-Dvs43sk9.js";import{j as e,I as u,at as C,W as o}from"./vendor-mui-core-Bq_sfmbr.js";import{G as M,Y as f,K as b}from"./vendor-ux-DnuP69h2.js";import{aj as H}from"./index-
|
|
1
|
+
import{r as t,k as x}from"./vendor-react-Dvs43sk9.js";import{j as e,I as u,at as C,W as o}from"./vendor-mui-core-Bq_sfmbr.js";import{G as M,Y as f,K as b}from"./vendor-ux-DnuP69h2.js";import{aj as H}from"./index-B2EmOTH7.js";import{t as Z}from"./question-mark-circle.svg-B4stD6SS.js";const g=s=>t.createElement("svg",{width:21,height:20,viewBox:"0 0 21 20",xmlns:"http://www.w3.org/2000/svg",...s},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.60567 17.3203C7.38971 16.9661 7.19606 16.5686 7.02468 16.1402C6.86016 15.7289 6.7127 15.2804 6.58436 14.801C6.01415 15.0849 5.48171 15.439 4.99946 15.855C5.7556 16.5015 6.63848 17.004 7.60567 17.3203ZM8.26264 15.645C8.10246 15.2446 7.95842 14.7971 7.83425 14.3104C8.53612 14.104 9.26539 13.9991 9.9998 14H10.0015C10.7359 13.9991 11.4652 14.104 12.167 14.3104C12.0429 14.7971 11.8988 15.2446 11.7386 15.645C11.4556 16.3525 11.1353 16.8804 10.8137 17.2204C10.4935 17.559 10.2185 17.6667 10.0006 17.6667C9.78281 17.6667 9.50783 17.559 9.18757 17.2204C8.86599 16.8804 8.54566 16.3525 8.26264 15.645ZM10.0007 12.6667C10.8258 12.6657 11.6453 12.7785 12.4365 13.0005C12.5533 12.274 12.6295 11.49 12.6565 10.6666H7.34483C7.37175 11.49 7.448 12.274 7.56482 13.0006C8.35599 12.7785 9.17556 12.6657 10.0007 12.6667ZM7.34483 9.33331C7.37175 8.50999 7.448 7.72596 7.56482 6.99945C8.35598 7.22152 9.17556 7.33433 10.0007 7.33334C10.8258 7.33433 11.6453 7.22153 12.4365 6.99947C12.5533 7.72597 12.6295 8.51 12.6565 9.33331H7.34483ZM13.9905 10.6666C13.9603 11.6495 13.8639 12.5916 13.7104 13.4645C14.5207 13.8311 15.2715 14.3159 15.9385 14.9026C16.9065 13.7315 17.5347 12.2691 17.6722 10.6666H13.9905ZM17.6721 9.33331H13.9904C13.9603 8.35043 13.8639 7.40842 13.7104 6.5355C14.5207 6.16891 15.2715 5.68412 15.9385 5.09743C16.9065 6.26854 17.5347 7.73084 17.6721 9.33331ZM19.0006 10.0017C18.9997 14.9715 14.9706 19 10.0006 19H10.0006C5.03005 19 1.00061 14.9706 1.00061 10C1.00061 9.99999 1.00061 9.99999 1.00061 9.99998C1.00062 5.02943 5.03005 1 10.0006 1C14.9712 1 19.0006 5.02944 19.0006 10C19.0006 10.0006 19.0006 10.0011 19.0006 10.0017ZM2.32907 9.33331C2.46651 7.73082 3.09476 6.2685 4.0628 5.09738C4.72975 5.68407 5.48055 6.16888 6.29084 6.53548C6.13742 7.40841 6.041 8.35042 6.01083 9.33331H2.32907ZM2.32907 10.6666H6.01083C6.04099 11.6496 6.13742 12.5916 6.29084 13.4645C5.48055 13.8311 4.72975 14.3159 4.06281 14.9026C3.09475 13.7315 2.46649 12.2692 2.32907 10.6666ZM12.9766 16.1402C13.1411 15.7289 13.2886 15.2804 13.4169 14.8009C13.9871 15.0849 14.5196 15.4389 15.0018 15.8549C14.2457 16.5014 13.3628 17.004 12.3956 17.3202C12.6116 16.9661 12.8052 16.5686 12.9766 16.1402ZM12.3956 2.67976C13.3628 2.996 14.2457 3.49858 15.0018 4.14508C14.5196 4.56106 13.9871 4.91516 13.4169 5.19908C13.2886 4.71963 13.1411 4.2711 12.9766 3.85979C12.8052 3.43137 12.6116 3.03387 12.3956 2.67976ZM11.7386 4.355C11.8988 4.75545 12.0429 5.20292 12.167 5.68962C11.4652 5.89603 10.7359 6.00096 10.0015 6.00001H9.9998C9.26539 6.00096 8.53612 5.89602 7.83424 5.68961C7.95841 5.20291 8.10246 4.75544 8.26264 4.355C8.54566 3.64747 8.86599 3.11964 9.18757 2.7796C9.50783 2.44096 9.78281 2.33333 10.0006 2.33333C10.2185 2.33333 10.4935 2.44096 10.8137 2.7796C11.1353 3.11964 11.4556 3.64747 11.7386 4.355ZM7.02468 3.85979C6.86015 4.2711 6.71269 4.71961 6.58436 5.19906C6.01414 4.91513 5.4817 4.56103 4.99945 4.14504C5.7556 3.49854 6.63848 2.99596 7.60567 2.67973C7.38971 3.03385 7.19606 3.43136 7.02468 3.85979Z",fill:"currentColor"}));function j({SessionContext:s,extraItems:n=[],showLocale:r=!0,showHelper:l=!0,showSessionManager:c=!0,sessionManagerProps:i={}}){const{session:d}=t.useContext(s),{locale:p}=t.useContext(M),w=x(),h=()=>{if(w.pathname.indexOf("/store")>-1){window.open("https://www.arcblock.io/content/docs/createblocklet","_blank");return}window.open("https://www.arcblock.io/content/docs/blocklet-developer","_blank")};return e.jsxs(e.Fragment,{children:[n.map((a,m)=>t.cloneElement(a,{key:m})),r&&e.jsx(v,{"data-cy":"locale-addon",icon:g,size:23,showText:!1,className:"locale-addon"}),e.jsx(H,{}),l&&e.jsx(u,{onClick:h,children:e.jsx(Z,{})}),c&&e.jsx(k,{locale:p,session:d,size:24,showRole:!0,...i,showManageBlocklet:!1})]})}j.propTypes={SessionContext:o.object.isRequired,extraItems:o.array,showLocale:o.bool,showSessionManager:o.bool,showHelper:o.bool,sessionManagerProps:o.object};const k=C(b)`
|
|
2
2
|
.user-addon {
|
|
3
3
|
.user-avatar {
|
|
4
4
|
width: 28px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as P}from"./vendor-react-Dvs43sk9.js";import{j as k,a6 as ce,ak as T,Q as qe,cw as Ne,T as ee,W as F,b6 as Me,a5 as Pe,bC as Fe,aX as ze,at as je,U as Je,b1 as le,z as Be,A as Ue,cx as ke,be as ne,a3 as W,cy as We,am as ge,bd as ye}from"./vendor-mui-core-Bq_sfmbr.js";import{Z as te,a8 as Ve,v as Se,f as Ke,W as He,bc as Ge,p as Ze,bd as Ye,aB as Qe,be as K,bf as Xe,c as et,aU as be,B as Re,$ as Ae,X as Z,bg as tt}from"./index-
|
|
1
|
+
import{r as P}from"./vendor-react-Dvs43sk9.js";import{j as k,a6 as ce,ak as T,Q as qe,cw as Ne,T as ee,W as F,b6 as Me,a5 as Pe,bC as Fe,aX as ze,at as je,U as Je,b1 as le,z as Be,A as Ue,cx as ke,be as ne,a3 as W,cy as We,am as ge,bd as ye}from"./vendor-mui-core-Bq_sfmbr.js";import{Z as te,a8 as Ve,v as Se,f as Ke,W as He,bc as Ge,p as Ze,bd as Ye,aB as Qe,be as K,bf as Xe,c as et,aU as be,B as Re,$ as Ae,X as Z,bg as tt}from"./index-B2EmOTH7.js";import{w as ue,P as rt}from"./permission-DwyNIiFn.js";import{T as oe,D as G,H,F as Oe,an as st,J as ve,G as nt}from"./vendor-ux-DnuP69h2.js";import{l as Ee}from"./vendor-hooks-DLNZ8kxG.js";import{C as me}from"./confirm-DV4YCyEc.js";import{f as ie}from"./index-DBs9Ljax.js";import{u as at}from"./useSetState-DFuQZPPV.js";import{u as Ce}from"./session-DGj-_oAZ.js";import{S as U}from"./section-4lLmF6fb.js";import{C as it}from"./click-to-copy-CH3FJWJo.js";import{u as De}from"./team-B8B1ZhIQ.js";import{w as ot,Z as lt}from"./vendor-utils-DQK0pEML.js";import{v as ct}from"./index-CcuDh75j.js";import{W as ut}from"./did-address-4KKI5Z_V.js";import{V as ft}from"./status-DYzeHwu5.js";import"./vendor-arcblock-CzdgnaKl.js";import"./lottie-web-4koyQiv_.js";import"./required-CtPXGgxr.js";import"./isURL-DviHJNBO.js";import"./use-app-logo-wJojGoX8.js";import"./omit-C2ouGG7F.js";const dt=localStorage.getItem("enableDebug")==="true";function mt({teamDid:$,size:D="small",...L}){const{t:E}=oe(),{api:j}=te(),[w,p]=P.useState(!1),[i,g]=P.useState(null),m=()=>{p(!1),g(null)},f=async()=>{try{p(!0);const a=await j.clearCache({input:{teamDid:$}});H.success(E("blocklet.config.clearCache.success",{count:a.removed?.length||0}))}catch(a){H.error(ie(a))}finally{p(!1),g(null)}},e={title:E("blocklet.config.clearCache.title"),description:E("blocklet.config.clearCache.description"),confirm:E("common.confirm"),cancel:E("common.cancel"),onConfirm:f,onCancel:m};return k.jsxs("div",{...L,children:[k.jsxs(G,{onClick:()=>g(e),color:"error",variant:"outlined",size:D,children:[w?k.jsx(ce,{size:16,style:{marginRight:5}}):null,E("blocklet.config.clearCache.action")]}),i&&k.jsx(me,{title:i.title,description:i.description,confirm:i.confirm,cancel:i.cancel,onConfirm:i.onConfirm,onCancel:i.onCancel})]})}function Ie({onChange:$=()=>{},disabled:D=!1,loading:L=!1,inService:E=!1}){const{t:j}=oe(),{api:w,session:p}=Ce(),{blocklet:i}=Ve(),[g,m]=at({newAppSk:"",isConnectOpen:!1,confirmDialogOpen:!1}),f=()=>m({isConnectOpen:!1}),e=()=>{if(Ke.isInProgress(i.status)){H.error(j("blocklet.error.isInProgress"));return}m({confirmDialogOpen:!0})};return k.jsxs(k.Fragment,{children:[k.jsx(U,{title:j("blocklet.config.migrate.button"),desc:j("blocklet.config.migrate.description"),children:k.jsx(T,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:k.jsxs(qe,{style:{flexShrink:0},variant:"contained",color:"primary",size:"small","data-cy":"config-did",disabled:D||L,onClick:e,children:[k.jsx(Ne,{style:{fontSize:"1.3em",marginRight:4}}),j("blocklet.config.migrate.button")]})})}),k.jsxs(k.Fragment,{children:[g.isConnectOpen&&k.jsx(Se,{popup:!0,open:g.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:w.get,checkTimeout:5*60*1e3,onSuccess:()=>{$(),E&&p.logout(),f()},extraParams:{appDid:i.appDid},messages:{title:j("setup.keyPair.title"),scan:j("setup.keyPair.scan"),confirm:j("setup.keyPair.confirm"),success:j("setup.keyPair.success")},onClose:f}),g.confirmDialogOpen&&k.jsx(me,{title:k.jsx(ee,{sx:{fontSize:"20px",fontWeight:"500"},children:j("blocklet.config.migrate.title")}),description:k.jsx(ee,{sx:{fontSize:"14px",color:"#9397A1"},children:j("blocklet.config.migrate.confirm")}),confirm:j("common.confirm"),cancel:j("common.cancel"),onConfirm:()=>m({confirmDialogOpen:!1,isConnectOpen:!0}),onCancel:()=>m({confirmDialogOpen:!1})})]})]})}Ie.propTypes={onChange:F.func,disabled:F.bool,loading:F.bool,inService:F.bool};function Te({onCancel:$,onSuccess:D,onError:L=()=>{}}){const{api:E}=P.useContext(He),[j,w]=P.useState(!1),{t:p,locale:i}=oe(),[g,m]=P.useState(""),[f,e]=P.useState(!1),[a,n]=P.useState(0),[r,t]=P.useState(""),{endpoint:l}=De(),[s,o]=P.useState(!1),u=c=>{m(null),w(!0);try{t(c.result),n(_.length-1)}catch(h){const b=ie(h);m(b),L(h)}finally{w(!1)}},d=()=>{e(!0),n(1)},y=()=>{e(!1),n(0)},_=[{body:k.jsxs(T,{children:[k.jsx(ee,{children:p("team.transferApp.transferDialog.tips.progress")}),k.jsx(ee,{sx:{mt:3,mb:2},children:p("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),onCancel:$,onConfirm:d},{cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),body:()=>k.jsx(Se,{action:"transfer-app-owner",open:f,locale:i,checkFn:E.get,onClose:y,onSuccess:u,checkTimeout:5*60*1e3,extraParams:{},messages:{title:p("team.transferApp.connectDialog.title"),scan:p("team.transferApp.connectDialog.scan"),confirm:p("team.transferApp.connectDialog.confirm"),success:p("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const c=Ge({transferId:r.transferId,endpoint:l});return k.jsxs(k.Fragment,{children:[k.jsx(T,{component:Y,dangerouslySetInnerHTML:{__html:p("team.transferApp.transferDialog.createSuccessTip1")}}),k.jsx(T,{component:Y,sx:{mt:2},children:k.jsx(Y,{children:p("team.transferApp.transferDialog.createSuccessTip3")})}),k.jsxs(T,{children:[k.jsx(T,{component:Y,sx:{mt:2},children:k.jsx(Y,{children:p("team.transferApp.transferDialog.createSuccessTip2",{expireDate:Ze(r.expireDate,i)})})}),k.jsx(T,{sx:{my:1},children:k.jsx(it,{children:c})})]}),k.jsx("div",{children:k.jsx(Me,{value:"end",control:k.jsx(Pe,{checked:s,onChange:h=>o(h.target.checked)}),label:p("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:p("common.confirm"),onConfirm:D}],v=_[a];return k.jsxs(Oe,{title:k.jsx(Y,{className:"title",children:p("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:k.jsxs(k.Fragment,{children:[v.cancel&&k.jsx(G,{onClick:v.onCancel,color:"inherit",children:v.cancel}),k.jsxs(G,{onClick:v.onConfirm,color:"error",disabled:j||a===_.length-1&&!s,variant:"contained",autoFocus:!0,children:[j&&k.jsx(ce,{size:16}),v.confirm]})]}),children:[k.jsx(Fe,{component:"div",children:typeof v.body=="function"?v.body():v.body}),!!g&&k.jsx(ze,{severity:"error",variant:"icon",children:g})]})}Te.propTypes={onCancel:F.func.isRequired,onSuccess:F.func.isRequired,onError:F.func};const Y=je.div`
|
|
2
2
|
font-size: 16px;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
&.title {
|