@abtnode/blocklet-services 1.16.41-beta-20250319-034744-5c62f533 → 1.16.41-beta-20250319-131732-1224cca5
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/libs/email.js +78 -58
- package/api/libs/open-graph/template.js +2 -3
- package/api/services/kyc/index.js +1 -0
- package/api/socket/channel/did.js +2 -1
- package/dist/assets/{access-control-DyHt8ppX.js → access-control-DM5bKXj8.js} +1 -1
- package/dist/assets/{add-component-core-DOdhiJes.js → add-component-core-BGLFE6FF.js} +1 -1
- package/dist/assets/{add-resource-CGPM0kPR.js → add-resource-CTONcgV6.js} +1 -1
- package/dist/assets/{analytics-BRjS4mY-.js → analytics-jwKnm2P5.js} +1 -1
- package/dist/assets/{audit-logs-D1W37Cj4.js → audit-logs-BSAndjyr.js} +1 -1
- package/dist/assets/{branding-DR3Jnq-d.js → branding-Ds6v3n-A.js} +2 -2
- package/dist/assets/{bundle-avatar-Eqwd2qUG.js → bundle-avatar-C4EBeG0M.js} +1 -1
- package/dist/assets/{complete-BzSPyjUA.js → complete-B5CCv5xy.js} +1 -1
- package/dist/assets/{component--_f-xKi7.js → component-B2RHEZO0.js} +1 -1
- package/dist/assets/{config-BDpdqYom.js → config-CkTkraLZ.js} +1 -1
- package/dist/assets/{config-navigation-BrXS6Zm4.js → config-navigation-Cy2R-qEJ.js} +3 -3
- package/dist/assets/{config-space-BZu4nd7t.js → config-space-BjgJ--W4.js} +1 -1
- package/dist/assets/{confirm-CCmbVvGp.js → confirm-BaiaCWsM.js} +1 -1
- package/dist/assets/{connect-Bgm2clKz.js → connect-RNS66o1f.js} +1 -1
- package/dist/assets/{connect-C1EdscR7.js → connect-mVRf-ABx.js} +1 -1
- package/dist/assets/{connect-to-CAjdR1Vi.js → connect-to-CChFecmc.js} +1 -1
- package/dist/assets/{dashboard-C2dbiNOp.js → dashboard-BUwFD31P.js} +3 -3
- package/dist/assets/{delete-confirm-CVo1ye7X.js → delete-confirm-Bh6Ch3bf.js} +1 -1
- package/dist/assets/{domain-BQkRhwGe.js → domain-D2juCz3R.js} +1 -1
- package/dist/assets/{domain-action-card-Dlgq4rsm.js → domain-action-card-C_--u5r9.js} +1 -1
- package/dist/assets/{domains-DaOwHgX-.js → domains-vqaJZbX-.js} +1 -1
- package/dist/assets/{email-BHF0jLjs.js → email-DKMhmT65.js} +1 -1
- package/dist/assets/{exchange-passport-C6TpmUyM.js → exchange-passport-BMfAdTZi.js} +1 -1
- package/dist/assets/{form-text-input-C8x5debf.js → form-text-input-BKnTJYUO.js} +1 -1
- package/dist/assets/{fuel-DQMzXBHQ.js → fuel-DGFl2kVF.js} +1 -1
- package/dist/assets/{index-D8WxMgot.js → index-B4PgdoaR.js} +3 -3
- package/dist/assets/{index-BVjGveR4.js → index-BlGUkC5j.js} +1 -1
- package/dist/assets/{index-CYdNDqQ1.js → index-C8sg0Ts_.js} +3 -3
- package/dist/assets/{index-Bv_udrJr.js → index-CHzM6Ehl.js} +1 -1
- package/dist/assets/{index-DojJOk-8.js → index-Co79YnZI.js} +1 -1
- package/dist/assets/{index-D2qwAqco.js → index-D-RS3D7s.js} +1 -1
- package/dist/assets/{index-CmyG8bip.js → index-DF1FIm9G.js} +1 -1
- package/dist/assets/{index-BsMTGy4m.js → index-DMqGxTc4.js} +1 -1
- package/dist/assets/{index-KP4WZslk.js → index-DRzvuBvI.js} +1 -1
- package/dist/assets/{index-Dv43WFu_.js → index-DneJ5oOQ.js} +4 -4
- package/dist/assets/{index-Db8S8FOW.js → index-DsfwDSo4.js} +1 -1
- package/dist/assets/{index-BL64rJ3g.js → index-DxtGslY8.js} +1 -1
- package/dist/assets/{index-Dal_0cM6.js → index-okPJPuPc.js} +1 -1
- package/dist/assets/{index-DJJGXGi6.js → index-wWAZioAD.js} +1 -1
- package/dist/assets/{invitation-CDtK_Uyv.js → invitation-3fNTl35Q.js} +1 -1
- package/dist/assets/{invite-DSQnWK9o.js → invite-vSXLKXaC.js} +1 -1
- package/dist/assets/{issue-passport-Bb_7kKPQ.js → issue-passport-iTVcPmbK.js} +1 -1
- package/dist/assets/{item-C1U0HVPR.js → item-BKw13HQ1.js} +1 -1
- package/dist/assets/{layout-Bkn9nC3f.js → layout-MdeSR5MO.js} +1 -1
- package/dist/assets/{list-BIXoIHH2.js → list-BYBgvMRq.js} +1 -1
- package/dist/assets/{log-CuiY798z.js → log-Djo2s0oZ.js} +1 -1
- package/dist/assets/{login-Ds2aHi-M.js → login-BqLbwYZb.js} +1 -1
- package/dist/assets/{logo-uploader-DQCS5qZW.js → logo-uploader-DtUHte5C.js} +2 -2
- package/dist/assets/{lost-passport-DdbK0_Yc.js → lost-passport-C_dlQRA5.js} +1 -1
- package/dist/assets/open-window-yeboX1Ru.js +1 -1
- package/dist/assets/{overview-DFNGZZos.js → overview-Ct6FaHVl.js} +1 -1
- package/dist/assets/{publish-resource-CPSJ7Gd2.js → publish-resource-wn5vCulN.js} +1 -1
- package/dist/assets/{relative-time-xM8Zc84I.js → relative-time-CYqHHkvJ.js} +1 -1
- package/dist/assets/{setup-CkUck5w6.js → setup-BDulmyU9.js} +3 -3
- package/dist/assets/{start-CRCAeTDI.js → start-CUVz5ZKQ.js} +1 -1
- package/dist/assets/{status-D8ugfvVU.js → status-i0njxvUg.js} +1 -1
- package/dist/assets/{step-actions-C83ykph7.js → step-actions-Zukntbkg.js} +1 -1
- package/dist/assets/{traffic-DjeUj5sV.js → traffic-DBvn8sNu.js} +1 -1
- package/dist/assets/{transfer-B_MO7Mf7.js → transfer-DLvipuQf.js} +1 -1
- package/dist/assets/{unsubscribe-ajBobtwD.js → unsubscribe-Nax9Uwlj.js} +1 -1
- package/dist/assets/{user-center-D62gRjAl.js → user-center-dlERaSQ2.js} +1 -1
- package/dist/assets/{util-CohOBosL.js → util-DHw5muRJ.js} +1 -1
- package/dist/assets/{wrap-locale-lZatlhee.js → wrap-locale-gZlt-kQa.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +21 -21
package/api/libs/email.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const { Joi } = require('@arcblock/validator');
|
|
2
2
|
const { render } = require('@react-email/components');
|
|
3
|
-
const { emailConfigSchema } = require('@blocklet/sdk/lib/validators/email');
|
|
4
3
|
const getBlockletInfo = require('@blocklet/meta/lib/info');
|
|
5
|
-
const
|
|
4
|
+
const { getEmailServiceProvider } = require('@abtnode/auth/lib/email');
|
|
5
|
+
const { sendEmailWithLauncher } = require('@abtnode/auth/lib/launcher');
|
|
6
6
|
|
|
7
7
|
const logger = require('./logger')('blocklet-services:notification');
|
|
8
8
|
const { NotificationEmail } = require('../emails/pages/notification');
|
|
@@ -15,7 +15,7 @@ const validateEmail = schemaEmail.validateAsync.bind(schemaEmail);
|
|
|
15
15
|
async function sendEmail(
|
|
16
16
|
receiver,
|
|
17
17
|
notification,
|
|
18
|
-
{ teamDid, node, locale, unsubscribeToken = '', userInfo = {}, raw = false }
|
|
18
|
+
{ teamDid, node, locale, unsubscribeToken = '', userInfo = {}, raw = false, launcher = false }
|
|
19
19
|
) {
|
|
20
20
|
if (!receiver) {
|
|
21
21
|
throw new Error('receiver is required');
|
|
@@ -30,68 +30,88 @@ async function sendEmail(
|
|
|
30
30
|
logger.warn(`Failed to get blocklet: ${teamDid}`);
|
|
31
31
|
throw new Error(`Failed to get blocklet: ${teamDid}`);
|
|
32
32
|
}
|
|
33
|
-
const config = blocklet.settings?.notification?.email || {};
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const provider = getEmailServiceProvider(blocklet);
|
|
35
|
+
logger.debug('service.sendEmail', { teamDid, provider, raw, launcher });
|
|
36
|
+
if (!provider || (provider === 'launcher' && !launcher)) {
|
|
37
|
+
throw new Error('Email Service is not available.');
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
if (provider === 'service') {
|
|
41
|
+
const config = blocklet.settings?.notification?.email;
|
|
42
|
+
const info = getBlockletInfo(blocklet);
|
|
43
|
+
const logo = `${info.appUrl}/.well-known/service/blocklet/logo-rect?imageFilter=convert&f=png`;
|
|
44
|
+
|
|
45
|
+
const appInfo = notification.appInfo || {
|
|
46
|
+
logo,
|
|
47
|
+
description: info.description,
|
|
48
|
+
title: info.name,
|
|
49
|
+
version: info.version,
|
|
50
|
+
url: info.appUrl,
|
|
51
|
+
};
|
|
44
52
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
const subject = `${
|
|
54
|
+
notification.title ||
|
|
55
|
+
{ zh: '您收到了一个通知', en: 'You have received a notification' }[locale] ||
|
|
56
|
+
'You have received a notification'
|
|
57
|
+
}`;
|
|
58
|
+
|
|
59
|
+
const html = render(
|
|
60
|
+
NotificationEmail({
|
|
61
|
+
subject,
|
|
62
|
+
appInfo,
|
|
63
|
+
...notification,
|
|
64
|
+
locale,
|
|
65
|
+
raw,
|
|
66
|
+
unsubscribeToken,
|
|
67
|
+
userInfo: {
|
|
68
|
+
...userInfo,
|
|
69
|
+
email: receiver,
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const emailData = {
|
|
75
|
+
from: `"${appInfo.title}" <${config.from}>`,
|
|
76
|
+
to: receiver,
|
|
77
|
+
title: notification.title,
|
|
64
78
|
subject,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
locale,
|
|
68
|
-
raw,
|
|
69
|
-
unsubscribeToken,
|
|
70
|
-
userInfo: {
|
|
71
|
-
...userInfo,
|
|
72
|
-
email: receiver,
|
|
73
|
-
},
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
const emailData = {
|
|
77
|
-
from: `"${appInfo.title}" <${value.from}>`,
|
|
78
|
-
to: receiver,
|
|
79
|
-
title: notification.title,
|
|
80
|
-
subject,
|
|
81
|
-
html,
|
|
82
|
-
replyTo: value.from,
|
|
83
|
-
};
|
|
84
|
-
if (process.env.NODE_ENV === 'test') {
|
|
85
|
-
return {
|
|
86
|
-
messageId: 'test-message-id',
|
|
87
|
-
accepted: [emailData.to],
|
|
88
|
-
rejected: [],
|
|
89
|
-
response: 'Test environment - Email skipped',
|
|
79
|
+
html,
|
|
80
|
+
replyTo: config.from,
|
|
90
81
|
};
|
|
82
|
+
|
|
83
|
+
if (process.env.NODE_ENV === 'test') {
|
|
84
|
+
return {
|
|
85
|
+
messageId: 'test-message-id',
|
|
86
|
+
accepted: [emailData.to],
|
|
87
|
+
rejected: [],
|
|
88
|
+
response: 'Test environment - Email skipped',
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const transporter = cache.getTransport({ did: teamDid, config });
|
|
92
|
+
const result = await transporter.sendMail(emailData);
|
|
93
|
+
return result;
|
|
91
94
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
|
|
96
|
+
if (provider === 'launcher') {
|
|
97
|
+
if (!blocklet.controller) {
|
|
98
|
+
throw new Error('Launcher info not available.');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const info = await node.getNodeInfo({ useCache: true });
|
|
102
|
+
const result = await sendEmailWithLauncher(info.sk, blocklet.controller, {
|
|
103
|
+
receiver,
|
|
104
|
+
notification,
|
|
105
|
+
options: { locale, raw },
|
|
106
|
+
});
|
|
107
|
+
if (result.error) {
|
|
108
|
+
throw new Error(result.error);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
throw new Error('Unknown email provider.');
|
|
95
115
|
}
|
|
96
116
|
|
|
97
117
|
module.exports = {
|
|
@@ -200,8 +200,7 @@ const getCoverTemplate = ({ width, height, logo, logoRounded, color, title, desc
|
|
|
200
200
|
</div>`;
|
|
201
201
|
};
|
|
202
202
|
|
|
203
|
-
const getBannerTemplate = ({ width, height,
|
|
204
|
-
const textColor = getTextColor(color.start);
|
|
203
|
+
const getBannerTemplate = ({ width, height, logo, logoRounded, background, title }, fn) => {
|
|
205
204
|
return fn`<div
|
|
206
205
|
style="
|
|
207
206
|
width: ${width}px;
|
|
@@ -225,7 +224,7 @@ const getBannerTemplate = ({ width, height, color, logo, logoRounded, background
|
|
|
225
224
|
<h2
|
|
226
225
|
style="
|
|
227
226
|
font-size: 72px;
|
|
228
|
-
color:
|
|
227
|
+
color: #eee;
|
|
229
228
|
font-weight: 500;
|
|
230
229
|
font-family: Arial, sans-serif;
|
|
231
230
|
text-align: left;
|
|
@@ -458,13 +458,14 @@ const sendToMail = async ({ sender, receiver, notification, options, node, pushO
|
|
|
458
458
|
|
|
459
459
|
const notifications = parseNotification({ id, ...rest }, senderInfo);
|
|
460
460
|
|
|
461
|
-
const { locale = 'en' } = options || {};
|
|
461
|
+
const { locale = 'en', raw = false } = options || {};
|
|
462
462
|
const results = await Promise.allSettled(
|
|
463
463
|
receivers.map((email) => {
|
|
464
464
|
return sendEmail(email, notifications[0], {
|
|
465
465
|
teamDid: sender.appDid,
|
|
466
466
|
node,
|
|
467
467
|
locale,
|
|
468
|
+
raw,
|
|
468
469
|
...(unsubscribeToken ? { unsubscribeToken } : {}),
|
|
469
470
|
...(userInfo ? { userInfo } : {}),
|
|
470
471
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as E,j as e,a3 as c,bj as h,bz as L,bn as N,bA as g,E as I,a9 as b}from"./vendor-mui-core-O22FPGM4.js";import{r as m}from"./vendor-react-DoD83n6N.js";import{u as j,p as o,V as O}from"./vendor-ux-did-connect-D75Zatzm.js";import{A as y}from"./config-C3tQWDAE.js";import{P}from"./page-header-DyeTxe1U.js";import{o as R,f as T,e as Y}from"./index-
|
|
1
|
+
import{e as E,j as e,a3 as c,bj as h,bz as L,bn as N,bA as g,E as I,a9 as b}from"./vendor-mui-core-O22FPGM4.js";import{r as m}from"./vendor-react-DoD83n6N.js";import{u as j,p as o,V as O}from"./vendor-ux-did-connect-D75Zatzm.js";import{A as y}from"./config-C3tQWDAE.js";import{P}from"./page-header-DyeTxe1U.js";import{o as R,f as T,e as Y}from"./index-C8sg0Ts_.js";import{S as v}from"./layout-MdeSR5MO.js";import{S as D}from"./step-actions-Zukntbkg.js";import{S as H}from"./button-BqyvGZC-.js";import"./vendor-utils-CbeKtci8.js";import"./vendor-hooks-CYyfK9g3.js";import"./lottie-web-B6s7dDoL.js";import"./vendor-arcblock-E5QJEgSK.js";import"./content-layout--DV54O6i.js";function C({onNext:a}){const S=E(),{t:n,locale:p}=j(),[i,l]=m.useState(!1),[f,d]=m.useState(""),{blocklet:r}=R();m.useEffect(()=>{var s;const t=T.findServiceFromMeta(r.meta,o.NODE_SERVICES.AUTH);d(((s=t==null?void 0:t.config)==null?void 0:s.whoCanAccess)||o.WHO_CAN_ACCESS.ALL)},[r]);const u=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{l(!0),await Y.updateBlockletSecurityRule({input:{did:r.meta.did,data:{id:o.SECURITY_RULE_DEFAULT_ID,accessPolicyId:s}}}),l(!1)}catch(A){l(!1),O.error(A.message)}},x=async t=>{i||(d(t.target.value),await u(t.target.value))},_={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:S.palette.text.secondary};return e.jsxs(W,{children:[e.jsx(c,{className:"header",children:e.jsx(P,{title:n("blocklet.config.access.title"),subTitle:n("blocklet.config.access.description")})}),e.jsx(h,{component:"fieldset",children:e.jsx(L,{name:"inherit",value:f,onChange:x,children:y.map(t=>e.jsxs(c,{sx:{mb:2},children:[e.jsx(N,{value:t.value,control:e.jsx(g,{size:"small",color:"primary"}),label:e.jsxs("span",{children:[e.jsx(t.icon,{style:_}),t.title[p]]})}),e.jsx(c,{className:"tip",children:t.description[p]})]},t.value))})}),e.jsx(D,{mt:8,disabled:i,blocklet:r,onStartNow:()=>a("complete"),children:e.jsx(H,{loading:i,variant:"contained",disabled:i,onClick:()=>a(),children:n("setup.continue")})})]})}C.propTypes={onNext:I.func};C.defaultProps={onNext:()=>{}};const W=b(v)`
|
|
2
2
|
height: 100%;
|
|
3
3
|
overflow-y: auto;
|
|
4
4
|
.header {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a1 as ks,j as o,E as A,a2 as mt,a9 as Ge,a3 as J,T as ge,t as Vt,bn as wi,bO as Ei,I as Os,bC as Is,bP as Rs,z as Cs,be as Ll,b2 as Ps,bl as Nl,M as Tr,bv as Al,bw as Dl,bx as Ml,br as Fl,ac as _s,L as Bl,b1 as $l,b0 as Ul,ai as Si,a4 as Ls,a6 as Wl,ad as tt,e as ir,bE as zl,x as or,R as Ns,V as As,am as Ds,bK as Ms,af as ql,aa as qt,bd as jo,A as ko,Z as Vl,P as Kl,G as Gl,v as Hl,$ as Xl,D as Yl,K as Oo,bp as Ql}from"./vendor-mui-core-O22FPGM4.js";import{r as M,g as Ti,f as Jl,k as Zl,a as ji,e as Ee,b as Ft,l as ec}from"./vendor-react-DoD83n6N.js";import{j as Fs,d as tc,S as nc,s as Bs,A as rc}from"./item-
|
|
1
|
+
import{a1 as ks,j as o,E as A,a2 as mt,a9 as Ge,a3 as J,T as ge,t as Vt,bn as wi,bO as Ei,I as Os,bC as Is,bP as Rs,z as Cs,be as Ll,b2 as Ps,bl as Nl,M as Tr,bv as Al,bw as Dl,bx as Ml,br as Fl,ac as _s,L as Bl,b1 as $l,b0 as Ul,ai as Si,a4 as Ls,a6 as Wl,ad as tt,e as ir,bE as zl,x as or,R as Ns,V as As,am as Ds,bK as Ms,af as ql,aa as qt,bd as jo,A as ko,Z as Vl,P as Kl,G as Gl,v as Hl,$ as Xl,D as Yl,K as Oo,bp as Ql}from"./vendor-mui-core-O22FPGM4.js";import{r as M,g as Ti,f as Jl,k as Zl,a as ji,e as Ee,b as Ft,l as ec}from"./vendor-react-DoD83n6N.js";import{j as Fs,d as tc,S as nc,s as Bs,A as rc}from"./item-BKw13HQ1.js";import{r as $s,B as ut,ak as ki,P as Us,p as Ws,u as gt,i as Dt,a as ic,l as oc,aj as jr,aZ as sc,am as zs,bd as Io,ap as ac,V as Oi,C as lc,s as Gt,U as xr,aw as Ro,af as qs,be as gr,f as Ii,b2 as Vs,g as Ks,X as cc,bf as uc,ai as oi,bg as dc}from"./vendor-ux-did-connect-D75Zatzm.js";import{z as Pn,f as Mt,Z as hc,_ as fc,h as jt,$ as pc,D as mc,a0 as gc,a1 as vc,a2 as yc,C as kr,a3 as Gs,X as bc,a4 as xc,a5 as wc,a6 as Ec,a7 as cr,a8 as Co,a9 as Sc}from"./index-C8sg0Ts_.js";import{j as Po,c as Tc,E as Or,e as jc,f as kc,g as Oc,L as Ic,S as Rc}from"./vendor-arcblock-E5QJEgSK.js";import{L as _o}from"./launch-result-message-WNYdod-D.js";import{P as Hs}from"./page-header-DyeTxe1U.js";import{b as ct,p as Cc,B as Pc,C as Lo,x as Jn,Y as Xs,a0 as _c,ab as Lc,G as Nc,J as Mr,w as Ri,W as Ac,ac as Dc,ad as Mc,ae as Fc,y as Gn,af as Bc,c as $c}from"./vendor-utils-CbeKtci8.js";import{u as Uc,C as Wc}from"./config-space-BjgJ--W4.js";import{R as Fr}from"./logo-uploader-DtUHte5C.js";import{S as zc}from"./index-DxtGslY8.js";import{s as Ys,h as qc,w as Vc,f as Kc,a as Gc,b as Hc,c as Xc,M as Yc}from"./index-oXEi5lCg.js";import{l as sr,f as Qc,a as Jc,e as Qs,w as Zc}from"./vendor-hooks-CYyfK9g3.js";import{g as eu}from"./get-safe-url-CXJBjnNj.js";import{p as tu}from"./index-DQKEK30u.js";import{r as nu}from"./Google-CBPWeaVC.js";import{I as No}from"./index-D5rqbUOM.js";import{u as ru}from"./session-CD9NaM-v.js";import{W as iu}from"./did-address-DIKoCoBp.js";import{_ as Js}from"./useLocalStorage-CtbpqE0c.js";import{f as Zs}from"./format-error-LAoTjvJe.js";import{a as Ao}from"./api-CvDkueg1.js";import{d as ou,a as su,v as au,e as lu}from"./util-DHw5muRJ.js";import{u as ea}from"./use-mobile-Cb_97PZu.js";import{C as cu}from"./content-layout--DV54O6i.js";import{C as uu,D as du,a as hu}from"./connect-to-CChFecmc.js";import{d as fu}from"./ArrowDropDown-ydRfHJ2x.js";import{d as pu}from"./ChevronLeft-CqDoHwdJ.js";import{d as mu}from"./ChevronRight-Bpkf9aqI.js";const dg="blocklet-add-component-registry",hg="server-add-registry",fg=e=>`resource-${e}-add-registry`;var Ci={},gu=ks;Object.defineProperty(Ci,"__esModule",{value:!0});var ta=Ci.default=void 0,vu=gu($s()),yu=o;ta=Ci.default=(0,vu.default)((0,yu.jsx)("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M8 13h8v-2H8zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5"}),"Link");function na(e){const{info:t}=Pn();return M.useMemo(()=>{var n,r,i;return!e||!((n=e.docker)!=null&&n.image)||(r=e.docker)!=null&&r.image&&((i=e.docker)!=null&&i.runBaseScript)?!0:window.blocklet?window.blocklet.enableDocker&&window.blocklet.enableDockerNetwork:t.enableDocker&&t.enableDockerNetwork},[e,t])}function Pi({disabled:e,children:t,onConfirm:n}){return M.useEffect(()=>{if(e)return()=>{};const r=i=>{i.code==="Enter"&&(i.metaKey===!0||i.ctrlKey===!0)&&(i.preventDefault(),i.stopPropagation(),n())};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[e,n]),t}Pi.propTypes={disabled:A.bool,children:A.any.isRequired,onConfirm:A.func.isRequired};Pi.defaultProps={disabled:!1};function _i({onContinue:e,nextDisabled:t,launching:n,texts:r,description:i}){const[s,a]=M.useState(!1),c=()=>a(f=>!f);return o.jsxs(o.Fragment,{children:[o.jsx(bu,{children:o.jsxs(Pi,{disabled:t,onConfirm:e,children:[o.jsx("div",{className:"eula-trigger",onClick:c,children:r.listenName}),o.jsx(ut,{disabled:t,color:"primary",variant:"contained",className:"next-button",onClick:e,children:n?o.jsxs(o.Fragment,{children:[o.jsx(mt,{size:14}),r.launchingText]}):r.buttonNext})]})}),o.jsx(ki,{open:s,title:r.listenName,onClose:()=>a(!1),children:i})]})}_i.propTypes={onContinue:A.func.isRequired,nextDisabled:A.bool,launching:A.bool,description:A.any,texts:A.object};_i.defaultProps={nextDisabled:!1,launching:!1,description:"",texts:{listenName:"",launchingText:"",buttonNext:""}};const bu=Ge.div`
|
|
2
2
|
margin: 0 auto;
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: space-between;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as B,j as h}from"./vendor-mui-core-O22FPGM4.js";import{l as L,r}from"./vendor-react-DoD83n6N.js";import{x as W,C as O}from"./vendor-utils-CbeKtci8.js";import{u as A,ak as T}from"./vendor-ux-did-connect-D75Zatzm.js";import{k as w,u as _,r as F}from"./vendor-hooks-CYyfK9g3.js";import{A as K,S as $}from"./add-component-core-
|
|
1
|
+
import{t as B,j as h}from"./vendor-mui-core-O22FPGM4.js";import{l as L,r}from"./vendor-react-DoD83n6N.js";import{x as W,C as O}from"./vendor-utils-CbeKtci8.js";import{u as A,ak as T}from"./vendor-ux-did-connect-D75Zatzm.js";import{k as w,u as _,r as F}from"./vendor-hooks-CYyfK9g3.js";import{A as K,S as $}from"./add-component-core-BGLFE6FF.js";import{o as z,M as G}from"./index-C8sg0Ts_.js";import"./lottie-web-B6s7dDoL.js";import"./item-BKw13HQ1.js";import"./vendor-arcblock-E5QJEgSK.js";import"./format-error-LAoTjvJe.js";import"./Launch-XvyEoGhF.js";import"./Done-B8c93MpP.js";import"./DeleteOutline-D4DYIaUj.js";import"./delete-confirm-Bh6Ch3bf.js";import"./click-to-copy-Dc16fHKA.js";import"./shorten-label-DXrhdUJE.js";import"./confirm-BaiaCWsM.js";import"./session-CD9NaM-v.js";import"./get-safe-url-CXJBjnNj.js";import"./did-address-DIKoCoBp.js";import"./launch-result-message-WNYdod-D.js";import"./page-header-DyeTxe1U.js";import"./config-space-BjgJ--W4.js";import"./api-CvDkueg1.js";import"./logo-uploader-DtUHte5C.js";import"./index-tUQxVYYQ.js";import"./index-DxtGslY8.js";import"./Google-CBPWeaVC.js";import"./index-oXEi5lCg.js";import"./index-DQKEK30u.js";import"./index-D5rqbUOM.js";import"./useLocalStorage-CtbpqE0c.js";import"./util-DHw5muRJ.js";import"./use-mobile-Cb_97PZu.js";import"./content-layout--DV54O6i.js";import"./connect-to-CChFecmc.js";import"./ArrowDropDown-ydRfHJ2x.js";import"./ChevronLeft-CqDoHwdJ.js";import"./ChevronRight-Bpkf9aqI.js";function ke(){var d;const{t:f}=A(),{blocklet:i}=z(),{componentDid:s}=L(),g=B(e=>e.breakpoints.down("md")),o=new URL(window.location.href),C=o.searchParams.get("mode")==="dialog",c=o.searchParams.get("resourceType")||"",p=o.searchParams.get("resourceDid")||s,R=o.searchParams.get("store")||"",S=o.searchParams.get("showFromUrl")!=="false",y=o.searchParams.get("showResourcesSwitch")!=="false",E=o.searchParams.get("enableRunBackground")!=="false",P=o.searchParams.get("showCategory")!=="false",n=(d=i==null?void 0:i.meta)==null?void 0:d.did,m=R.split(",").filter(Boolean).map(e=>{try{return new URL(e.startsWith("http")?e:`https://${e}`).origin}catch(t){return console.error(t),null}}).filter(Boolean),[D,x]=r.useState(m.map(e=>({url:e,name:e.replace("https://","")}))),[U,b]=r.useState(null),[M,j]=r.useState("");r.useEffect(()=>{(async()=>{try{const e=await Promise.all(m.map(async t=>{const a=W(t,"/api/store.json"),{data:v}=await O.get(a);return{url:t,name:v.name}}));x(e||[])}catch(e){console.error(e)}})()},[m.join(",")]);const k=()=>{window.parent.postMessage({event:"resourceDialog.close",componentDid:s},"*")};r.useEffect(()=>{const e=G();return n&&e.connect(),()=>{n&&e.isConnected()&&e.disconnect()}},[n]),w(()=>{window.parent.postMessage({event:"resourceDialog.loaded",componentDid:s},"*")});const l=_(e=>{var t,a;((t=e.data)==null?void 0:t.event)==="resourceDialog.select"&&((a=e.data)==null?void 0:a.componentDid)===s&&(b(e.data.data),j(e.data.storeUrl))});w(()=>{window.addEventListener("message",l)}),F(()=>{window.removeEventListener("message",l)});const u=({inDialog:e=!0}={})=>h.jsx(K,{stores:D,selectedMeta:U,storeUrl:M,resourceType:c,resourceDid:p,mode:"embed",inDialog:e,storageKey:$(`${c}+${p}`),showResourcesSwitch:y,showFromUrl:S,enableRunBackground:E,showCategory:P});return C?h.jsx(T,{className:"resource-dialog",title:f("blocklet.publish.addResource"),maxWidth:!1,fullWidth:!1,PaperProps:{style:g?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:(e,t)=>{t!=="backdropClick"&&k()},showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:u()}):u({inDialog:!1})}export{ke as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{E as $t,e as gT,j as _t,bE as yT,a3 as Ur,a9 as Bg,T as rl,bd as ru,a4 as jo,bZ as P2,b_ as R2}from"./vendor-mui-core-O22FPGM4.js";import{g as E2,b as k2,r as he,f as O2}from"./vendor-react-DoD83n6N.js";import{u as Ch,X as N2,i as B2,a2 as z2,aX as V2,aq as G2}from"./vendor-ux-did-connect-D75Zatzm.js";import{T as F2}from"./traffic-
|
|
1
|
+
import{E as $t,e as gT,j as _t,bE as yT,a3 as Ur,a9 as Bg,T as rl,bd as ru,a4 as jo,bZ as P2,b_ as R2}from"./vendor-mui-core-O22FPGM4.js";import{g as E2,b as k2,r as he,f as O2}from"./vendor-react-DoD83n6N.js";import{u as Ch,X as N2,i as B2,a2 as z2,aX as V2,aq as G2}from"./vendor-ux-did-connect-D75Zatzm.js";import{T as F2}from"./traffic-DBvn8sNu.js";import{p as H2}from"./index-DMqGxTc4.js";import{ax as mT,aw as _T,z as W2,C as ST,f as bv,aF as U2,o as $2}from"./index-C8sg0Ts_.js";import{B as h0,y as Af,aG as Y2}from"./vendor-utils-CbeKtci8.js";import{O as eo}from"./vendor-arcblock-E5QJEgSK.js";import{B as xT,D as v0,E as c0,F as p0}from"./vendor-hooks-CYyfK9g3.js";import{B as X2}from"./bundle-avatar-C4EBeG0M.js";import{B as Z2}from"./dashboard-BUwFD31P.js";import{L as q2}from"./list-header-Bzt7zKtS.js";import"./lottie-web-B6s7dDoL.js";import"./useAsyncRetry-CEJwVPZ6.js";import"./useAsync-D2OhgEkV.js";import"./iframe-C0FAfo1V.js";import"./LaunchOutlined-BfbVRiJT.js";import"./ChevronLeft-CqDoHwdJ.js";import"./ChevronRight-Bpkf9aqI.js";import"./index-DWJc5Rxl.js";import"./format-error-LAoTjvJe.js";import"./vendor-mui-x-K-9WHqhO.js";import"./useLocalStorage-CtbpqE0c.js";import"./confirm-BaiaCWsM.js";import"./PlayArrow-DI84Lay5.js";import"./get-safe-url-CXJBjnNj.js";import"./session-CD9NaM-v.js";import"./InfoOutlined-HP5LuELQ.js";import"./useSetState-BL3ktMon.js";/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{V as U,r as W,b8 as N,u as V,bk as H,X as F,p as Z}from"./vendor-ux-did-connect-D75Zatzm.js";import{j as e,a1 as G,a3 as p,bg as q,T as w,a4 as K,I as $,a2 as J,bj as X,bm as Q,bi as Y,ai as ee,bJ as te,a9 as re}from"./vendor-mui-core-O22FPGM4.js";import{p as oe}from"./util-CzgwETtC.js";import{r as l,L as ae}from"./vendor-react-DoD83n6N.js";import{_ as se}from"./useLocalStorage-CtbpqE0c.js";import{z as O}from"./index-
|
|
1
|
+
import{V as U,r as W,b8 as N,u as V,bk as H,X as F,p as Z}from"./vendor-ux-did-connect-D75Zatzm.js";import{j as e,a1 as G,a3 as p,bg as q,T as w,a4 as K,I as $,a2 as J,bj as X,bm as Q,bi as Y,ai as ee,bJ as te,a9 as re}from"./vendor-mui-core-O22FPGM4.js";import{p as oe}from"./util-CzgwETtC.js";import{r as l,L as ae}from"./vendor-react-DoD83n6N.js";import{_ as se}from"./useLocalStorage-CtbpqE0c.js";import{z as O}from"./index-C8sg0Ts_.js";import{M}from"./index-oXEi5lCg.js";import{F as ie}from"./vendor-arcblock-E5QJEgSK.js";import{d as ne}from"./InfoOutlined-HP5LuELQ.js";import{d as le}from"./vendor-utils-CbeKtci8.js";import{R as ce}from"./relative-time-CYqHHkvJ.js";import{S as E}from"./shorten-label-DXrhdUJE.js";import{r as I}from"./index-Aq7Gmh7c.js";import{u as de}from"./dashboard-BUwFD31P.js";import"./vendor-hooks-CYyfK9g3.js";import"./lottie-web-B6s7dDoL.js";import"./base32-gJJTbpiB.js";import"./index-DMqGxTc4.js";import"./confirm-BaiaCWsM.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-DI84Lay5.js";import"./get-safe-url-CXJBjnNj.js";import"./session-CD9NaM-v.js";import"./useAsyncRetry-CEJwVPZ6.js";import"./useAsync-D2OhgEkV.js";import"./useSetState-BL3ktMon.js";const T=l.createContext({}),{Provider:pe,Consumer:Ke}=T;function ue(){return localStorage.getItem("audit-log-page-size")&&Number(localStorage.getItem("audit-log-page-size"))||10}function fe({children:t,scope:o="",categories:i=[],showScope:c,scopeFormatter:m}){const{api:f,info:C}=O(),[x,L]=l.useState([]),[a,h]=l.useState({total:0,pageSize:ue(),pageCount:0,page:1}),[v,g]=l.useState(!1),[r,n]=l.useState(""),[d,z]=se(`audit-log-category-${o}`,"all"),s=[{value:"all",label:"All",description:""},{value:"blocklet",label:"Blocklet Management",description:""},{value:"server",label:"Server Management",description:""},{value:"team",label:"Team Management",description:""},{value:"security",label:"Security",description:""},{value:"certificates",label:"Certificate Management",description:""},{value:"integrations",label:"Integration Management",description:""},{value:"gateway",label:"Gateway",description:""}].filter(S=>i.length?S.value==="all"||i.includes(S.value):!0),u=async({page:S=1,pageSize:P=20,silent:k=!0}={})=>{if(!v){k||g(!0);try{const b=await f.getAuditLogs({input:{paging:{page:S,pageSize:P},category:d==="all"?"":d,scope:o,actionOrContent:r}});c&&(b.list||[]).forEach(_=>{_.scope!==C.did&&(_.link=`/blocklets/${_.scope}/components`)}),L(b.list),h(b.paging),g(!1)}catch(b){U.error(b.message),g(!1)}}};l.useEffect(()=>{localStorage.setItem("audit-log-page-size",a.pageSize)},[a.pageSize]),l.useEffect(()=>{u({page:1,pageSize:a.pageSize,silent:!1})},[]),l.useEffect(()=>{u({page:1,pageSize:a.pageSize,silent:!1})},[d,r]);const j={loading:v,fetch:u,filter:{category:d,scope:o},categories:s,setCategory:z,data:x,paging:a,setPaging:h,showScope:c,scopeFormatter:m,actionOrContent:r,setActionOrContent:n};return e.jsx(pe,{value:{auditLogs:j},children:t})}function B(){const{auditLogs:t}=l.useContext(T);return t}var A={},ge=G;Object.defineProperty(A,"__esModule",{value:!0});var R=A.default=void 0,me=ge(W()),xe=e;R=A.default=(0,me.default)((0,xe.jsx)("path",{d:"M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15z"}),"UnfoldMore");const Le=`
|
|
2
2
|
<svg style="width:38px;height:38px;" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M50.152 10.6417L31.72 0L13.288 10.6417V24.7942L1 31.8887V53.1722L19.432 63.8139L31.6902 56.7366L31.72 56.7538L31.7498 56.7366L44.008 63.8139L62.44 53.1722V31.8887L50.152 24.7942V10.6417ZM60.52 32.9972L48.232 25.9027V11.7502L31.72 2.21703L15.208 11.7502V25.9028L2.92 32.9972V52.0636L19.432 61.5968L31.6902 54.5196L31.72 54.5368L31.7498 54.5196L44.008 61.5968L60.52 52.0636V32.9972Z" fill="url(#paint0_linear_606_96)"/>
|
|
4
4
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M50.1521 24.8307L31.7201 14.189L13.2881 24.8307V46.1141L31.7201 56.7558L50.1521 46.1141V24.8307ZM15.2081 25.9392L31.7201 16.406L48.2321 25.9392V45.0056L31.7201 54.5388L15.2081 45.0056V25.9392ZM28.5464 23.0464C28.6641 22.6342 29.0408 22.3501 29.4695 22.3501H33.9707C34.3993 22.3501 34.776 22.6342 34.8938 23.0464L35.7504 26.0447L37.8696 27.2681L40.8945 26.5109C41.3103 26.4068 41.7447 26.591 41.959 26.9622L44.2096 30.8604C44.424 31.2316 44.3662 31.6998 44.0682 32.0079L41.8999 34.2489V36.6959L44.0682 38.9369C44.3662 39.245 44.424 39.7133 44.2096 40.0845L41.959 43.9827C41.7447 44.3539 41.3103 44.538 40.8945 44.4339L37.8696 43.6767L35.7504 44.9002L34.8938 47.8984C34.776 48.3106 34.3993 48.5947 33.9707 48.5947H29.4695C29.0408 48.5947 28.6641 48.3106 28.5464 47.8984L27.6897 44.9002L25.5706 43.6767L22.5457 44.4339C22.1299 44.538 21.6955 44.3539 21.4812 43.9827L19.2305 40.0845C19.0162 39.7133 19.0739 39.245 19.372 38.9369L21.5402 36.6959V34.2489L19.372 32.0079C19.0739 31.6998 19.0162 31.2316 19.2305 30.8604L21.4812 26.9622C21.6955 26.591 22.1299 26.4068 22.5457 26.5109L25.5706 27.2681L27.6897 26.0447L28.5464 23.0464ZM28.9861 27.5132C29.2018 27.3887 29.3607 27.1851 29.4292 26.9456L30.1936 24.2701H33.2466L34.011 26.9456C34.0794 27.1851 34.2383 27.3887 34.4541 27.5132L37.2459 29.1251C37.4617 29.2497 37.7174 29.2855 37.9591 29.225L40.6583 28.5493L42.1848 31.1932L40.25 33.193C40.0768 33.372 39.9799 33.6114 39.9799 33.8605V37.0843C39.9799 37.3334 40.0768 37.5728 40.25 37.7518L42.1848 39.7516L40.6583 42.3955L37.9591 41.7198C37.7174 41.6593 37.4617 41.6951 37.2459 41.8197L34.4541 43.4316C34.2383 43.5561 34.0794 43.7597 34.011 43.9992L33.2466 46.6747H30.1936L29.4292 43.9992C29.3607 43.7597 29.2018 43.5561 28.9861 43.4316L26.1942 41.8197C25.9785 41.6951 25.7228 41.6593 25.4811 41.7198L22.7819 42.3955L21.2554 39.7516L23.1902 37.7518C23.3634 37.5728 23.4602 37.3334 23.4602 37.0843V33.8605C23.4602 33.6114 23.3634 33.372 23.1902 33.193L21.2554 31.1932L22.7819 28.5493L25.4811 29.225C25.7228 29.2855 25.9785 29.2497 26.1942 29.1251L28.9861 27.5132ZM31.7201 41.6407C28.3134 41.6407 25.5517 38.8791 25.5517 35.4724C25.5517 32.0657 28.3134 29.3041 31.7201 29.3041C35.1268 29.3041 37.8884 32.0657 37.8884 35.4724C37.8884 38.8791 35.1268 41.6407 31.7201 41.6407ZM35.9684 35.4724C35.9684 37.8187 34.0664 39.7207 31.7201 39.7207C29.3738 39.7207 27.4717 37.8187 27.4717 35.4724C27.4717 33.1261 29.3738 31.2241 31.7201 31.2241C34.0664 31.2241 35.9684 33.1261 35.9684 35.4724Z" fill="url(#paint1_linear_606_96)"/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{_ as Se}from"./vendor-arcblock-E5QJEgSK.js";import{a1 as Ie,j as e,ad as z,T as P,a3 as m,bg as Pe,a4 as re,I as F,D as ue,E as w,ab as Re,r as ke,bK as Ee,K as oe,y as _e,x as $,a9 as Oe}from"./vendor-mui-core-O22FPGM4.js";import{r as De,u as Le,b4 as Ve,p as L}from"./vendor-ux-did-connect-D75Zatzm.js";import{E as M,D as ie,C as se,P as ne}from"./react-beautiful-dnd.esm-DcDZ_Ghe.js";import{d as ae}from"./DeleteOutline-D4DYIaUj.js";import{l as Te,e as $e}from"./vendor-hooks-CYyfK9g3.js";import{r as h}from"./vendor-react-DoD83n6N.js";import{S as K}from"./studio-Cb_GlvSi.js";import"./vendor-utils-CbeKtci8.js";import"./lottie-web-B6s7dDoL.js";import"./raf-schd.esm-GV-XhwE0.js";var C={};Object.defineProperty(C,"__esModule",{value:!0});C.getVideoId=V;var Ue=C.getEmbedUrl=ze,We=C.getVideoCoverUrl=Fe,Ae=C.getVideoCheckUrl=Ne;C.getYoutubeId=pe;C.getVimeoId=he;C.isVideoUrl=qe;function pe(r){var s,l,i;const t=r.trim();return t.includes("youtu.be/")?(s=t.split("youtu.be/")[1])==null?void 0:s.split("?")[0]:t.includes("/embed/")?(l=t.split("/embed/")[1])==null?void 0:l.split("?")[0]:t.includes("youtube.com/watch")?new URL(t).searchParams.get("v"):t.includes("youtube.com/shorts/")?(i=t.split("/shorts/")[1])==null?void 0:i.split("?")[0]:""}function he(r){var s,l,i,a,u,y,x;const t=r.trim();return t.includes("/embed/")?(s=t.split("/embed/")[1])==null?void 0:s.split("?")[0]:t.includes("vimeo.com/video/")?(l=t.split("/video/")[1])==null?void 0:l.split("?")[0]:t.includes("vimeo.com/channels/")?(a=(i=t.split("/channels/")[1])==null?void 0:i.split("/")[1])==null?void 0:a.split("?")[0]:t.includes("vimeo.com/groups/")?(y=(u=t.split("/groups/")[1])==null?void 0:u.split("/")[1])==null?void 0:y.split("?")[0]:t.includes("vimeo.com/")?(x=t.split("vimeo.com/")[1])==null?void 0:x.split("?")[0]:""}const U={};function V(r){const t=r.trim();return!t||!/^https?:\/\/.+\..+/.test(t)?[]:(U[t]||(U[t]=(()=>{const s=new URL(t);return s.host.includes("youtube.com")||s.host.includes("youtu.be")?[pe(t),"youtube"]:s.host.includes("vimeo.com")?[he(t),"vimeo"]:[]})()),U[t])}const k={};function ze(r,{modestbranding:t=1,controls:s=0,autoplay:l=0}={}){const i=r.trim();if(!i)return"";if(k[i]!==void 0)return k[i];const[a,u]=V(i);return u==="youtube"?k[i]=`https://www.youtube.com/embed/${a}?modestbranding=${t}&controls=${s}&autoplay=${l}`:u==="vimeo"?k[i]=`https://player.vimeo.com/video/${a}?autoplay=${l}`:k[i]="",k[i]}const E={};function Fe(r){const t=r.trim();if(!t)return"";if(E[t]!==void 0)return E[t];const[s,l]=V(t);return l==="youtube"?E[t]=`https://img.youtube.com/vi/${s}/mqdefault.jpg`:l==="vimeo"?E[t]=`https://i.vimeocdn.com/${s}/1000x563`:E[t]="",E[t]}function Ne(r){const t=r.trim();if(!t)return"";const[s,l]=V(t);return l==="youtube"?`https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${s}&format=json`:l==="vimeo"?`https://vimeo.com/api/oembed.json?url=https://vimeo.com/${s}`:""}function qe(r){const t=r.trim();return V(t).length>0}var X={},He=Ie;Object.defineProperty(X,"__esModule",{value:!0});var me=X.default=void 0,Be=He(De()),Ke=e;me=X.default=(0,Be.default)((0,Ke.jsx)("path",{d:"M19 2h-4.18C14.4.84 13.3 0 12 0c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1m7 18H5V4h2v3h10V4h2z"}),"ContentPaste");const le=h.lazy(()=>Se(()=>import("./index-D8WxMgot.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(r=>({default:r.Uploader}))),Me=`${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/logo/upload`,Xe=`${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/screenshots/upload`,Ye=`${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/logo`,W=`${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/screenshots`,Je=`${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/videos`,ce=5,de=3;function ct(){var ee;const{t:r,locale:t}=Le(),[s,l]=h.useState(!1),[i,a]=h.useState(!1),[u,y]=h.useState([]),[x,j]=h.useState([]),[f,S]=h.useState(""),[T,_]=h.useState(""),[N,q]=h.useState(Date.now()),p=Te(async()=>{var c;const n=await(await fetch(W)).json();return y(n.screenshots||[]),j(((c=n.videos)==null?void 0:c.filter(d=>!!d))||[]),n}),R=h.useRef(null),g=h.useRef(null);if(p.loading&&!p.data)return e.jsx(K,{children:e.jsx(M,{size:40})});if(p.error)return e.jsx(K,{children:e.jsx(z,{direction:"column",spacing:1,sx:{mb:3},children:e.jsx(P,{color:"error.main",sx:{fontWeight:"bold"},children:p.error.message})})});const v=async o=>{const n=o.filter(c=>!!c);j(n),await fetch(Je,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({videos:n})})},H=async o=>{const n=Array.from(x),[c]=n.splice(o.source.index,1);n.splice(o.destination.index,0,c),await v(n)},xe=async o=>{const n=Array.from(u),[c]=n.splice(o.source.index,1);n.splice(o.destination.index,0,c),y(n),await fetch(`${W}/reorder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({screenshots:n})})},J=async o=>{o.destination&&(o.source.droppableId==="screenshots"?await xe(o):o.source.droppableId==="videos"&&await H(o),p.runAsync())},Z=o=>{_(o.trim()),a(!0)},G=async(o,n="")=>{let c=[];n?c=o?x.map(d=>d===n?o.trim():d):x.filter(d=>d!==n):o&&(c=[...x,o.trim()]),_(""),a(!1),(o||n)&&await v(c),p.runAsync()},fe=o=>{l(!0),S(o)},Q=()=>{l(!1),S("")};function be(){const o=[{label:r("studio.type"),value:"png, jpg, webp, svg"},{label:r("studio.ratio"),value:"256x256"},{label:r("studio.size"),value:"<500KB"}],n=[{label:r("studio.tip"),value:r("studio.change")}];return e.jsx(A,{title:r("common.logo"),rules:o,tips:n,children:e.jsx(m,{sx:{flex:1,cursor:"pointer"},children:e.jsx(Pe,{variant:"square",sx:{width:128,height:128},alt:"Blocklet Logo",src:`${Ye}?t=${N}`,onClick:()=>{var c;return(c=R.current)==null?void 0:c.open()}})})})}function ve(){const o=[{label:r("studio.ratio"),value:"16 / 9"},{label:r("studio.count"),value:`1~${ce}`},{label:r("studio.size"),value:"<5MB"}],n=[{label:r("studio.tip"),value:r("studio.orderTipLong")}];return e.jsx(A,{title:r("common.screenshot"),tips:n,rules:o,children:e.jsx(ie,{onDragEnd:J,children:e.jsx(se,{droppableId:"screenshots",direction:"horizontal",children:(d,O)=>e.jsxs(m,{display:"flex",alignItems:"center",sx:{flex:1,mt:1,flexWrap:"wrap",minHeight:225,background:O.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:O.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:d.innerRef,...d.droppableProps,children:[u.map((b,B)=>e.jsx(ne,{draggableId:b,index:B,children:(I,D)=>{const te=`${W}/${b}`;return e.jsxs(m,{ref:I.innerRef,...I.draggableProps,...I.dragHandleProps,className:"image-wrapper",sx:{transform:D.isDragging?"scale(1.05)":"none",boxShadow:D.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:te,onClick:()=>fe(b),style:{cursor:"pointer"}}),e.jsx(re,{title:r("studio.deleteTooltip"),children:e.jsx(F,{className:"action",style:{top:10,color:"white",background:"red"},onClick:async()=>{await fetch(te,{method:"DELETE"}),p.runAsync()},children:e.jsx(ae,{})})})]})}},b)),d.placeholder,u.length<ce&&c()]})})})});function c(){return e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",mb:2,width:400,height:225,fontSize:40,sx:{background:"#eee",cursor:"pointer",color:"#999"},onClick:()=>{var d;return(d=g.current)==null?void 0:d.open()},children:"+"})}}function je(){const o=[{label:r("studio.count"),value:`1~${de}`},{label:r("studio.videoType"),value:e.jsxs(e.Fragment,{children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})}],n=[{label:`${r("studio.tip")}`,value:r("studio.videoTipLong")}];return e.jsxs(A,{title:r("studio.video"),tips:n,rules:o,children:[e.jsx(ie,{onDragEnd:J,children:e.jsx(se,{droppableId:"videos",direction:"horizontal",children:(d,O)=>e.jsxs(m,{display:"flex",alignItems:"center",sx:{flex:1,mt:1,flexWrap:"wrap",minHeight:225,background:O.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:O.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:d.innerRef,...d.droppableProps,children:[x.map((b,B)=>e.jsx(ne,{draggableId:b,index:B,children:(I,D)=>e.jsxs(m,{ref:I.innerRef,...I.draggableProps,...I.dragHandleProps,className:"image-wrapper",sx:{transform:D.isDragging?"scale(1.05)":"none",boxShadow:D.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"videos",src:We(b),onClick:()=>Z(b),style:{cursor:"pointer"}}),e.jsx(m,{sx:{position:"absolute",cursor:"pointer",fontSize:"3rem"},onClick:()=>Z(b),children:e.jsx(ge,{})}),e.jsx(re,{title:r("studio.deleteTooltip"),children:e.jsx(F,{className:"action",style:{top:10,color:"white",background:"red"},onClick:()=>G(null,b),children:e.jsx(ae,{})})})]})},b)),d.placeholder,x.length<de&&c()]})})}),i&&e.jsx(Y,{t:r,handleOperateVideo:G,defaultUrl:T,videos:x})]});function c(){return e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",mb:2,width:400,height:225,fontSize:40,sx:{background:"#eee",cursor:"pointer",color:"#999"},onClick:()=>a(!0),children:"+"})}}function ye(){return e.jsx(ue,{open:s,onClose:Q,maxWidth:"xl",PaperProps:{style:{backgroundColor:"transparent",boxShadow:"none"}},children:e.jsx("img",{src:`${W}/${f}`,alt:"Screenshot Full",style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain"},onClick:Q})})}function we(){return e.jsxs(h.Suspense,{fallback:e.jsx(M,{size:40}),children:[e.jsx(le,{ref:R,locale:t,popup:!0,onUploadFinish:()=>{var o;(o=R.current)==null||o.close(),q(Date.now()),p.runAsync()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:Me,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),e.jsx(le,{ref:g,popup:!0,onUploadFinish:()=>{var o;(o=g.current)==null||o.close(),p.runAsync()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:Xe,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-u.length}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})}const Ce=`https://www.arcblock.io/docs/blocklet-store/${t}/supplying-images`;return e.jsx(K,{children:e.jsxs(Ze,{children:[e.jsxs(z,{direction:"column",spacing:1,sx:{mb:3},children:[e.jsx(P,{variant:"h5",sx:{fontWeight:"bold"},children:r("studio.title",{title:(ee=p.data)==null?void 0:ee.title})}),e.jsxs(P,{variant:"body2",color:"text.secondary",children:[r("studio.description")," ",e.jsx("a",{href:Ce,target:"_blank",rel:"noreferrer",children:r("studio.documentation")})]})]}),be(),ve(),je(),ye(),we()]})})}function A({title:r,rules:t,tips:s,children:l}){return e.jsxs(m,{display:"flex",flexDirection:"column",sx:{mb:4},children:[e.jsxs(z,{direction:"column",spacing:1,sx:{mb:2},children:[e.jsx(P,{variant:"h6",sx:{fontWeight:"bold"},children:r}),e.jsx(z,{direction:"row",spacing:2,sx:{fontSize:"13px",opacity:.8},children:t.map(a=>i(a.label,a.value))}),s.map(a=>e.jsx(m,{sx:{fontSize:"13px",opacity:.8},children:i(a.label,a.value)}))]}),l]});function i(a,u){return e.jsxs(m,{component:"span",children:[e.jsxs(m,{component:"span",sx:{color:"#555",mr:.5},children:[a,":"]}),e.jsx(m,{component:"span",sx:{color:"#007ec6"},children:u})]})}}A.propTypes={title:w.string.isRequired,rules:w.array.isRequired,tips:w.array.isRequired,children:w.node.isRequired};function Y({handleOperateVideo:r,t,defaultUrl:s="",videos:l}){var R;const[i,a]=h.useState(s),[u,y]=h.useState(!1),[x,j]=h.useState(!1),f=h.useRef(i),S=i!==s&&l.includes(i),T=!i&&s,_=!S&&(i&&i!==f.current||u),N=!!((R=navigator.clipboard)!=null&&R.readText),{run:q}=$e(p,{wait:500,leading:!0});return e.jsxs(ue,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Re,{children:t(s?"studio.videoDialogEditTitle":"studio.videoDialogTitle")}),e.jsxs(ke,{children:[e.jsx(Ee,{fullWidth:!0,value:i,onChange:g=>{const v=g.target.value.trim();a(v),v?q(v):j(!1)},placeholder:t("studio.videoInputLabel"),endAdornment:i?e.jsx(oe,{position:"end",children:e.jsx(F,{onClick:()=>{a(""),p("")},children:e.jsx(Ve,{})})}):N&&e.jsx(oe,{position:"end",children:e.jsx(F,{onClick:async()=>{try{const g=(await navigator.clipboard.readText()||"").trim();a(g),p(g)}catch(g){console.error(g)}},children:e.jsx(me,{})})})}),e.jsxs(m,{mb:2,mt:.5,children:[S&&e.jsx(P,{variant:"body2",color:"error",children:t("studio.duplicateVideo")}),!S&&x&&e.jsx(P,{variant:"body2",color:"error",children:t("studio.videoDialogNoSrc")})]}),f.current?e.jsx("iframe",{width:"100%",height:"315",title:`video-${f.current}`,src:Ue(f.current),allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,border:"1px solid #eee"}):e.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:315,width:"100%",border:"1px solid #eee"},children:u?e.jsx(M,{size:40}):e.jsx(P,{variant:"h5",color:"text.secondary",children:e.jsx(ge,{})})})]}),e.jsxs(_e,{children:[e.jsx($,{onClick:()=>r(),children:t("studio.cancel")}),T&&e.jsx($,{variant:"contained",color:"error",onClick:()=>r(null,s),children:t("studio.delete")}),_&&e.jsx($,{variant:"contained",onClick:()=>p(i),disabled:!i||u,children:t("studio.preview")}),!T&&!_&&e.jsx($,{variant:"contained",onClick:()=>r(f.current),disabled:!f.current||s===f.current||S,children:t("studio.confirm")})]})]});function p(g){f.current="";const v=Ae(g);j(g?!v:!1),v&&(y(!0),fetch(v).then(H=>{H.ok?(f.current=g,j(!1)):j(!0)}).catch(()=>{j(!0)}).finally(()=>y(!1)))}}Y.propTypes={handleOperateVideo:w.func.isRequired,t:w.func.isRequired,defaultUrl:w.string,videos:w.array.isRequired};Y.defaultProps={defaultUrl:""};function ge(){return e.jsxs("svg",{viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",height:48,width:48,children:[e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28C0 43.464 12.536 56 28 56Z",fill:"black","fill-opacity":"0.54"}),e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M39.6667 28L21 17.5V38.5L39.6667 28Z",fill:"white"})]})}const Ze=Oe.div`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B4PgdoaR.js","assets/vendor-ux-did-connect-D75Zatzm.js","assets/vendor-react-DoD83n6N.js","assets/vendor-utils-CbeKtci8.js","assets/vendor-mui-core-O22FPGM4.js","assets/vendor-hooks-CYyfK9g3.js","assets/lottie-web-B6s7dDoL.js","assets/vendor-ux-did-connect-DhgPdlEj.css","assets/vendor-arcblock-E5QJEgSK.js","assets/index-DQKEK30u.js","assets/index-C8sg0Ts_.js","assets/index-tUQxVYYQ.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as Se}from"./vendor-arcblock-E5QJEgSK.js";import{a1 as Ie,j as e,ad as z,T as P,a3 as m,bg as Pe,a4 as re,I as F,D as ue,E as w,ab as Re,r as ke,bK as Ee,K as oe,y as _e,x as $,a9 as Oe}from"./vendor-mui-core-O22FPGM4.js";import{r as De,u as Le,b4 as Ve,p as L}from"./vendor-ux-did-connect-D75Zatzm.js";import{E as M,D as ie,C as se,P as ne}from"./react-beautiful-dnd.esm-DcDZ_Ghe.js";import{d as ae}from"./DeleteOutline-D4DYIaUj.js";import{l as Te,e as $e}from"./vendor-hooks-CYyfK9g3.js";import{r as h}from"./vendor-react-DoD83n6N.js";import{S as K}from"./studio-Cb_GlvSi.js";import"./vendor-utils-CbeKtci8.js";import"./lottie-web-B6s7dDoL.js";import"./raf-schd.esm-GV-XhwE0.js";var C={};Object.defineProperty(C,"__esModule",{value:!0});C.getVideoId=V;var Ue=C.getEmbedUrl=ze,We=C.getVideoCoverUrl=Fe,Ae=C.getVideoCheckUrl=Ne;C.getYoutubeId=pe;C.getVimeoId=he;C.isVideoUrl=qe;function pe(r){var s,l,i;const t=r.trim();return t.includes("youtu.be/")?(s=t.split("youtu.be/")[1])==null?void 0:s.split("?")[0]:t.includes("/embed/")?(l=t.split("/embed/")[1])==null?void 0:l.split("?")[0]:t.includes("youtube.com/watch")?new URL(t).searchParams.get("v"):t.includes("youtube.com/shorts/")?(i=t.split("/shorts/")[1])==null?void 0:i.split("?")[0]:""}function he(r){var s,l,i,a,u,y,x;const t=r.trim();return t.includes("/embed/")?(s=t.split("/embed/")[1])==null?void 0:s.split("?")[0]:t.includes("vimeo.com/video/")?(l=t.split("/video/")[1])==null?void 0:l.split("?")[0]:t.includes("vimeo.com/channels/")?(a=(i=t.split("/channels/")[1])==null?void 0:i.split("/")[1])==null?void 0:a.split("?")[0]:t.includes("vimeo.com/groups/")?(y=(u=t.split("/groups/")[1])==null?void 0:u.split("/")[1])==null?void 0:y.split("?")[0]:t.includes("vimeo.com/")?(x=t.split("vimeo.com/")[1])==null?void 0:x.split("?")[0]:""}const U={};function V(r){const t=r.trim();return!t||!/^https?:\/\/.+\..+/.test(t)?[]:(U[t]||(U[t]=(()=>{const s=new URL(t);return s.host.includes("youtube.com")||s.host.includes("youtu.be")?[pe(t),"youtube"]:s.host.includes("vimeo.com")?[he(t),"vimeo"]:[]})()),U[t])}const k={};function ze(r,{modestbranding:t=1,controls:s=0,autoplay:l=0}={}){const i=r.trim();if(!i)return"";if(k[i]!==void 0)return k[i];const[a,u]=V(i);return u==="youtube"?k[i]=`https://www.youtube.com/embed/${a}?modestbranding=${t}&controls=${s}&autoplay=${l}`:u==="vimeo"?k[i]=`https://player.vimeo.com/video/${a}?autoplay=${l}`:k[i]="",k[i]}const E={};function Fe(r){const t=r.trim();if(!t)return"";if(E[t]!==void 0)return E[t];const[s,l]=V(t);return l==="youtube"?E[t]=`https://img.youtube.com/vi/${s}/mqdefault.jpg`:l==="vimeo"?E[t]=`https://i.vimeocdn.com/${s}/1000x563`:E[t]="",E[t]}function Ne(r){const t=r.trim();if(!t)return"";const[s,l]=V(t);return l==="youtube"?`https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=${s}&format=json`:l==="vimeo"?`https://vimeo.com/api/oembed.json?url=https://vimeo.com/${s}`:""}function qe(r){const t=r.trim();return V(t).length>0}var X={},He=Ie;Object.defineProperty(X,"__esModule",{value:!0});var me=X.default=void 0,Be=He(De()),Ke=e;me=X.default=(0,Be.default)((0,Ke.jsx)("path",{d:"M19 2h-4.18C14.4.84 13.3 0 12 0c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1m7 18H5V4h2v3h10V4h2z"}),"ContentPaste");const le=h.lazy(()=>Se(()=>import("./index-B4PgdoaR.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(r=>({default:r.Uploader}))),Me=`${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/logo/upload`,Xe=`${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/screenshots/upload`,Ye=`${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/logo`,W=`${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/screenshots`,Je=`${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/studio/videos`,ce=5,de=3;function ct(){var ee;const{t:r,locale:t}=Le(),[s,l]=h.useState(!1),[i,a]=h.useState(!1),[u,y]=h.useState([]),[x,j]=h.useState([]),[f,S]=h.useState(""),[T,_]=h.useState(""),[N,q]=h.useState(Date.now()),p=Te(async()=>{var c;const n=await(await fetch(W)).json();return y(n.screenshots||[]),j(((c=n.videos)==null?void 0:c.filter(d=>!!d))||[]),n}),R=h.useRef(null),g=h.useRef(null);if(p.loading&&!p.data)return e.jsx(K,{children:e.jsx(M,{size:40})});if(p.error)return e.jsx(K,{children:e.jsx(z,{direction:"column",spacing:1,sx:{mb:3},children:e.jsx(P,{color:"error.main",sx:{fontWeight:"bold"},children:p.error.message})})});const v=async o=>{const n=o.filter(c=>!!c);j(n),await fetch(Je,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({videos:n})})},H=async o=>{const n=Array.from(x),[c]=n.splice(o.source.index,1);n.splice(o.destination.index,0,c),await v(n)},xe=async o=>{const n=Array.from(u),[c]=n.splice(o.source.index,1);n.splice(o.destination.index,0,c),y(n),await fetch(`${W}/reorder`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({screenshots:n})})},J=async o=>{o.destination&&(o.source.droppableId==="screenshots"?await xe(o):o.source.droppableId==="videos"&&await H(o),p.runAsync())},Z=o=>{_(o.trim()),a(!0)},G=async(o,n="")=>{let c=[];n?c=o?x.map(d=>d===n?o.trim():d):x.filter(d=>d!==n):o&&(c=[...x,o.trim()]),_(""),a(!1),(o||n)&&await v(c),p.runAsync()},fe=o=>{l(!0),S(o)},Q=()=>{l(!1),S("")};function be(){const o=[{label:r("studio.type"),value:"png, jpg, webp, svg"},{label:r("studio.ratio"),value:"256x256"},{label:r("studio.size"),value:"<500KB"}],n=[{label:r("studio.tip"),value:r("studio.change")}];return e.jsx(A,{title:r("common.logo"),rules:o,tips:n,children:e.jsx(m,{sx:{flex:1,cursor:"pointer"},children:e.jsx(Pe,{variant:"square",sx:{width:128,height:128},alt:"Blocklet Logo",src:`${Ye}?t=${N}`,onClick:()=>{var c;return(c=R.current)==null?void 0:c.open()}})})})}function ve(){const o=[{label:r("studio.ratio"),value:"16 / 9"},{label:r("studio.count"),value:`1~${ce}`},{label:r("studio.size"),value:"<5MB"}],n=[{label:r("studio.tip"),value:r("studio.orderTipLong")}];return e.jsx(A,{title:r("common.screenshot"),tips:n,rules:o,children:e.jsx(ie,{onDragEnd:J,children:e.jsx(se,{droppableId:"screenshots",direction:"horizontal",children:(d,O)=>e.jsxs(m,{display:"flex",alignItems:"center",sx:{flex:1,mt:1,flexWrap:"wrap",minHeight:225,background:O.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:O.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:d.innerRef,...d.droppableProps,children:[u.map((b,B)=>e.jsx(ne,{draggableId:b,index:B,children:(I,D)=>{const te=`${W}/${b}`;return e.jsxs(m,{ref:I.innerRef,...I.draggableProps,...I.dragHandleProps,className:"image-wrapper",sx:{transform:D.isDragging?"scale(1.05)":"none",boxShadow:D.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"screenshot",src:te,onClick:()=>fe(b),style:{cursor:"pointer"}}),e.jsx(re,{title:r("studio.deleteTooltip"),children:e.jsx(F,{className:"action",style:{top:10,color:"white",background:"red"},onClick:async()=>{await fetch(te,{method:"DELETE"}),p.runAsync()},children:e.jsx(ae,{})})})]})}},b)),d.placeholder,u.length<ce&&c()]})})})});function c(){return e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",mb:2,width:400,height:225,fontSize:40,sx:{background:"#eee",cursor:"pointer",color:"#999"},onClick:()=>{var d;return(d=g.current)==null?void 0:d.open()},children:"+"})}}function je(){const o=[{label:r("studio.count"),value:`1~${de}`},{label:r("studio.videoType"),value:e.jsxs(e.Fragment,{children:[e.jsx("a",{href:"https://www.youtube.com/",target:"_blank",rel:"noreferrer",children:"Youtube"}),","," ",e.jsx("a",{href:"https://vimeo.com/",target:"_blank",rel:"noreferrer",children:"Vimeo"})]})}],n=[{label:`${r("studio.tip")}`,value:r("studio.videoTipLong")}];return e.jsxs(A,{title:r("studio.video"),tips:n,rules:o,children:[e.jsx(ie,{onDragEnd:J,children:e.jsx(se,{droppableId:"videos",direction:"horizontal",children:(d,O)=>e.jsxs(m,{display:"flex",alignItems:"center",sx:{flex:1,mt:1,flexWrap:"wrap",minHeight:225,background:O.isDraggingOver?"#f5f5f5":"transparent",transition:"background-color 0.2s ease",border:O.isDraggingOver?"2px dashed #999":"none",borderRadius:"4px"},ref:d.innerRef,...d.droppableProps,children:[x.map((b,B)=>e.jsx(ne,{draggableId:b,index:B,children:(I,D)=>e.jsxs(m,{ref:I.innerRef,...I.draggableProps,...I.dragHandleProps,className:"image-wrapper",sx:{transform:D.isDragging?"scale(1.05)":"none",boxShadow:D.isDragging?"0 5px 10px rgba(0,0,0,0.15)":"none",transition:"transform 0.2s ease, box-shadow 0.2s ease"},children:[e.jsx("img",{alt:"videos",src:We(b),onClick:()=>Z(b),style:{cursor:"pointer"}}),e.jsx(m,{sx:{position:"absolute",cursor:"pointer",fontSize:"3rem"},onClick:()=>Z(b),children:e.jsx(ge,{})}),e.jsx(re,{title:r("studio.deleteTooltip"),children:e.jsx(F,{className:"action",style:{top:10,color:"white",background:"red"},onClick:()=>G(null,b),children:e.jsx(ae,{})})})]})},b)),d.placeholder,x.length<de&&c()]})})}),i&&e.jsx(Y,{t:r,handleOperateVideo:G,defaultUrl:T,videos:x})]});function c(){return e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",mb:2,width:400,height:225,fontSize:40,sx:{background:"#eee",cursor:"pointer",color:"#999"},onClick:()=>a(!0),children:"+"})}}function ye(){return e.jsx(ue,{open:s,onClose:Q,maxWidth:"xl",PaperProps:{style:{backgroundColor:"transparent",boxShadow:"none"}},children:e.jsx("img",{src:`${W}/${f}`,alt:"Screenshot Full",style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain"},onClick:Q})})}function we(){return e.jsxs(h.Suspense,{fallback:e.jsx(M,{size:40}),children:[e.jsx(le,{ref:R,locale:t,popup:!0,onUploadFinish:()=>{var o;(o=R.current)==null||o.close(),q(Date.now()),p.runAsync()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:Me,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo"),e.jsx(le,{ref:g,popup:!0,onUploadFinish:()=>{var o;(o=g.current)==null||o.close(),p.runAsync()},installerProps:{disabled:!0},plugins:["ImageEditor"],apiPathProps:{uploader:Xe,disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/*","application/svg+xml"],maxFileSize:1024*1024*5,maxNumberOfFiles:5-u.length}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:16/9,initialAspectRatio:16/9,croppedCanvasOptions:{minWidth:1280,minHeight:720,maxWidth:1280*2,maxHeight:720*2}}}},"uploader-screenshot")]})}const Ce=`https://www.arcblock.io/docs/blocklet-store/${t}/supplying-images`;return e.jsx(K,{children:e.jsxs(Ze,{children:[e.jsxs(z,{direction:"column",spacing:1,sx:{mb:3},children:[e.jsx(P,{variant:"h5",sx:{fontWeight:"bold"},children:r("studio.title",{title:(ee=p.data)==null?void 0:ee.title})}),e.jsxs(P,{variant:"body2",color:"text.secondary",children:[r("studio.description")," ",e.jsx("a",{href:Ce,target:"_blank",rel:"noreferrer",children:r("studio.documentation")})]})]}),be(),ve(),je(),ye(),we()]})})}function A({title:r,rules:t,tips:s,children:l}){return e.jsxs(m,{display:"flex",flexDirection:"column",sx:{mb:4},children:[e.jsxs(z,{direction:"column",spacing:1,sx:{mb:2},children:[e.jsx(P,{variant:"h6",sx:{fontWeight:"bold"},children:r}),e.jsx(z,{direction:"row",spacing:2,sx:{fontSize:"13px",opacity:.8},children:t.map(a=>i(a.label,a.value))}),s.map(a=>e.jsx(m,{sx:{fontSize:"13px",opacity:.8},children:i(a.label,a.value)}))]}),l]});function i(a,u){return e.jsxs(m,{component:"span",children:[e.jsxs(m,{component:"span",sx:{color:"#555",mr:.5},children:[a,":"]}),e.jsx(m,{component:"span",sx:{color:"#007ec6"},children:u})]})}}A.propTypes={title:w.string.isRequired,rules:w.array.isRequired,tips:w.array.isRequired,children:w.node.isRequired};function Y({handleOperateVideo:r,t,defaultUrl:s="",videos:l}){var R;const[i,a]=h.useState(s),[u,y]=h.useState(!1),[x,j]=h.useState(!1),f=h.useRef(i),S=i!==s&&l.includes(i),T=!i&&s,_=!S&&(i&&i!==f.current||u),N=!!((R=navigator.clipboard)!=null&&R.readText),{run:q}=$e(p,{wait:500,leading:!0});return e.jsxs(ue,{open:!0,fullWidth:!0,maxWidth:"sm",children:[e.jsx(Re,{children:t(s?"studio.videoDialogEditTitle":"studio.videoDialogTitle")}),e.jsxs(ke,{children:[e.jsx(Ee,{fullWidth:!0,value:i,onChange:g=>{const v=g.target.value.trim();a(v),v?q(v):j(!1)},placeholder:t("studio.videoInputLabel"),endAdornment:i?e.jsx(oe,{position:"end",children:e.jsx(F,{onClick:()=>{a(""),p("")},children:e.jsx(Ve,{})})}):N&&e.jsx(oe,{position:"end",children:e.jsx(F,{onClick:async()=>{try{const g=(await navigator.clipboard.readText()||"").trim();a(g),p(g)}catch(g){console.error(g)}},children:e.jsx(me,{})})})}),e.jsxs(m,{mb:2,mt:.5,children:[S&&e.jsx(P,{variant:"body2",color:"error",children:t("studio.duplicateVideo")}),!S&&x&&e.jsx(P,{variant:"body2",color:"error",children:t("studio.videoDialogNoSrc")})]}),f.current?e.jsx("iframe",{width:"100%",height:"315",title:`video-${f.current}`,src:Ue(f.current),allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,border:"1px solid #eee"}):e.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:315,width:"100%",border:"1px solid #eee"},children:u?e.jsx(M,{size:40}):e.jsx(P,{variant:"h5",color:"text.secondary",children:e.jsx(ge,{})})})]}),e.jsxs(_e,{children:[e.jsx($,{onClick:()=>r(),children:t("studio.cancel")}),T&&e.jsx($,{variant:"contained",color:"error",onClick:()=>r(null,s),children:t("studio.delete")}),_&&e.jsx($,{variant:"contained",onClick:()=>p(i),disabled:!i||u,children:t("studio.preview")}),!T&&!_&&e.jsx($,{variant:"contained",onClick:()=>r(f.current),disabled:!f.current||s===f.current||S,children:t("studio.confirm")})]})]});function p(g){f.current="";const v=Ae(g);j(g?!v:!1),v&&(y(!0),fetch(v).then(H=>{H.ok?(f.current=g,j(!1)):j(!0)}).catch(()=>{j(!0)}).finally(()=>y(!1)))}}Y.propTypes={handleOperateVideo:w.func.isRequired,t:w.func.isRequired,defaultUrl:w.string,videos:w.array.isRequired};Y.defaultProps={defaultUrl:""};function ge(){return e.jsxs("svg",{viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",height:48,width:48,children:[e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28C0 43.464 12.536 56 28 56Z",fill:"black","fill-opacity":"0.54"}),e.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M39.6667 28L21 17.5V38.5L39.6667 28Z",fill:"white"})]})}const Ze=Oe.div`
|
|
3
3
|
margin-top: 24px;
|
|
4
4
|
.image-wrapper {
|
|
5
5
|
margin-bottom: 16px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as f,bg as E,E as a}from"./vendor-mui-core-O22FPGM4.js";import{p as P,U as $}from"./vendor-ux-did-connect-D75Zatzm.js";import{x as g}from"./vendor-utils-CbeKtci8.js";import{z as x,A as j,W as h,X as R,Y as A}from"./index-
|
|
1
|
+
import{j as f,bg as E,E as a}from"./vendor-mui-core-O22FPGM4.js";import{p as P,U as $}from"./vendor-ux-did-connect-D75Zatzm.js";import{x as g}from"./vendor-utils-CbeKtci8.js";import{z as x,A as j,W as h,X as R,Y as A}from"./index-C8sg0Ts_.js";function w({blocklet:r,ancestors:p=[]}){var d,m;const s=x(),{inService:n}=s,i=j(r==null?void 0:r.status)||h(r==null?void 0:r.status),o=`?v=${(d=r==null?void 0:r.meta)==null?void 0:d.version}${i?"~":""}`;let t=n?`${g(A,P.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle")}${o}`:g(s.imgPrefix,"blocklet.png");if(r.source==="registry"&&r.deployedFrom&&r.meta.logo)t=`${g(r.deployedFrom,R(r.meta.bundleDid,r.meta.logo))}${o}`;else{const u=((m=window.env)==null?void 0:m.apiPrefix)||"/",e=p.concat(r),c=n?e.slice(1):e;t=`${g(u,`/blocklet/logo-bundle${c.map(v=>`/${v.meta.did}`).join("")}`)}${o}`}return{logoUrl:t,inService:n}}function y({blocklet:r,style:p,size:s,ancestors:n,...i}){const o=x(),{logoUrl:t,inService:d}=w({blocklet:r,ancestors:n}),{variant:m}=i,u=d?()=>{}:c=>{c.target.src=`${o.imgPrefix}/blocklet.png`};let e=f.jsx("img",{src:t,onError:u,alt:r.meta.name,style:{width:s}});return r.meta.logo||(e=f.jsx($,{did:r.meta.did||"",responsive:!0})),f.jsx(E,{variant:m||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},p),...i,children:e})}y.propTypes={blocklet:a.object.isRequired,style:a.object,size:a.oneOfType([a.number,a.string]),ancestors:a.array};y.defaultProps={style:{},size:40,ancestors:[]};export{y as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a9 as d,j as e,a2 as T,a3 as h,E as C}from"./vendor-mui-core-O22FPGM4.js";import{u as _,_ as B,V as v,p as $}from"./vendor-ux-did-connect-D75Zatzm.js";import{o as A,q as F,ao as I,d as M,e as N,ag as V,ap as W,P as z}from"./index-
|
|
1
|
+
import{a9 as d,j as e,a2 as T,a3 as h,E as C}from"./vendor-mui-core-O22FPGM4.js";import{u as _,_ as B,V as v,p as $}from"./vendor-ux-did-connect-D75Zatzm.js";import{o as A,q as F,ao as I,d as M,e as N,ag as V,ap as W,P as z}from"./index-C8sg0Ts_.js";import{r as a}from"./vendor-react-DoD83n6N.js";import{x as O}from"./vendor-utils-CbeKtci8.js";import{L as X}from"./launch-result-message-WNYdod-D.js";import{g as q}from"./get-safe-url-BvS0hy8W.js";import{S as E}from"./button-BqyvGZC-.js";import{S as H}from"./layout-MdeSR5MO.js";import"./vendor-hooks-CYyfK9g3.js";import"./lottie-web-B6s7dDoL.js";import"./vendor-arcblock-E5QJEgSK.js";import"./content-layout--DV54O6i.js";const K=d(X)`
|
|
2
2
|
&& .result-footer {
|
|
3
3
|
height: 120px;
|
|
4
4
|
> div {
|