@abtnode/blocklet-services 1.17.3-beta-20251120-052956-035abea6 → 1.17.3-beta-20251123-232619-53258789
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 +3 -2
- package/api/libs/push-kit/index.js +3 -4
- package/api/services/notification/queue.js +47 -40
- package/api/socket/channel/did.js +14 -9
- package/dist/assets/{access-control-DTCMjhKk.js → access-control-nEfPjX9L.js} +1 -1
- package/dist/assets/{add-component-core-CUr388CN.js → add-component-core-CvN1A_dW.js} +1 -1
- package/dist/assets/{add-resource-Dc856hpt.js → add-resource-B9_aO4fk.js} +1 -1
- package/dist/assets/{addon-B40hGwgm.js → addon-VQ1uddFd.js} +1 -1
- package/dist/assets/{advanced-Br_YsN3-.js → advanced-DrQgmCdX.js} +1 -1
- package/dist/assets/{aigne-H9M2qziH.js → aigne-Bnseq7nJ.js} +1 -1
- package/dist/assets/{appearance-CZaZuJSH.js → appearance-B-5PmK14.js} +1 -1
- package/dist/assets/ar-Dz5bxvSE.js +7 -0
- package/dist/assets/{arrow-down.svg-B4fW36cY.js → arrow-down.svg-CpfG-t7r.js} +1 -1
- package/dist/assets/{audit-logs-CdBxa8MQ.js → audit-logs-DZUc-RBS.js} +1 -1
- package/dist/assets/{authorize-BF4yXQyf.js → authorize-CHAjiVSh.js} +1 -1
- package/dist/assets/{bind-account-D6p5CBbp.js → bind-account-NDZClqum.js} +1 -1
- package/dist/assets/{branding-CoyX7jAw.js → branding-C9cXITVH.js} +1 -1
- package/dist/assets/{branding-DNryM-GG.js → branding-CO4Sr13R.js} +1 -1
- package/dist/assets/{branding-B7dM6NSY.js → branding-CmgULIp-.js} +1 -1
- package/dist/assets/{bundle-avatar--3Ig7ZeD.js → bundle-avatar-Dtrtu9tJ.js} +1 -1
- package/dist/assets/{complete-DPTGJDLo.js → complete-Bb4ybro9.js} +1 -1
- package/dist/assets/{component-C9douaIx.js → component-DaJPU9PG.js} +35 -35
- package/dist/assets/{config-DLpmAnUO.js → config-BU9M-TDw.js} +1 -1
- package/dist/assets/{config-DbJRjGKg.js → config-DCVvdigc.js} +1 -1
- package/dist/assets/{config-BuIjAxID.js → config-DV7G62tB.js} +1 -1
- package/dist/assets/{config-navigation-ebep7Vaw.js → config-navigation-CesehlHG.js} +2 -2
- package/dist/assets/{config-space-BIBMi9yR.js → config-space-CNnFak18.js} +1 -1
- package/dist/assets/{confirm-CklyzxUV.js → confirm-CvbX7Jj-.js} +1 -1
- package/dist/assets/{connect-D1S9h2vl.js → connect-B1N-w3eV.js} +1 -1
- package/dist/assets/{connect-sHh18260.js → connect-Nix-snxX.js} +1 -1
- package/dist/assets/{connect-to-CN0n_rfw.js → connect-to-DBGTL_TU.js} +1 -1
- package/dist/assets/{dashboard-BOEp1A3P.js → dashboard-BahbXvzp.js} +6 -6
- package/dist/assets/de-Ztxy5vEB.js +7 -0
- package/dist/assets/{delete-confirm-DOWoUCR5.js → delete-confirm-ByS6hl26.js} +1 -1
- package/dist/assets/{domain-_Mg8zUon.js → domain-BpamjKaC.js} +1 -1
- package/dist/assets/{domain-action-card-COcfS69j.js → domain-action-card-Cp48mNnX.js} +1 -1
- package/dist/assets/{domains-HnFn4BU9.js → domains-Dh12Syq6.js} +1 -1
- package/dist/assets/{email-CY8kCkSP.js → email-BMJdUyBy.js} +1 -1
- package/dist/assets/engine-B0uUUVPG.js +1 -0
- package/dist/assets/es-Cd-spoK_.js +9 -0
- package/dist/assets/{exchange-passport-DPA710jd.js → exchange-passport-DHKedqAo.js} +1 -1
- package/dist/assets/{form-CaWm2WdL.js → form-D4lC8hNg.js} +1 -1
- package/dist/assets/fr-k8jXteN1.js +7 -0
- package/dist/assets/{fuel-DAxqtWTp.js → fuel-D2QywWA1.js} +1 -1
- package/dist/assets/{gen-access-key-DnFZ5j_f.js → gen-access-key-CsAuE1ey.js} +1 -1
- package/dist/assets/{gen-simple-access-key-D0cY_mzH.js → gen-simple-access-key-BOAC0Yfv.js} +1 -1
- package/dist/assets/{get-safe-url-b0FoyA1U.js → get-safe-url-D0cItynk.js} +1 -1
- package/dist/assets/hi-CvpI1-tn.js +5 -0
- package/dist/assets/{home-BLXMP7Fn.js → home-sZAuweUB.js} +1 -1
- package/dist/assets/id-D8coHs1U.js +7 -0
- package/dist/assets/{iframe-Cf5bT_6x.js → iframe-NYFbYzoQ.js} +1 -1
- package/dist/assets/{index-CWtomC5e.js → index--7-DPN_c.js} +1 -1
- package/dist/assets/{index-B11Boj2H.js → index-9P0uzLew.js} +1 -1
- package/dist/assets/{index-DX8eFzfu.js → index-BEkcjGoQ.js} +1 -1
- package/dist/assets/{index-WkJweVHY.js → index-BH-HC7Ph.js} +1 -1
- package/dist/assets/{index-zNB-v-t2.js → index-BOoBQ7dY.js} +1 -1
- package/dist/assets/{index-CQOXFqub.js → index-BWJVW6O0.js} +1 -1
- package/dist/assets/{index-CLUTu1X-.js → index-Ba6mPf9I.js} +1 -1
- package/dist/assets/{index-gIzQEnMj.js → index-BiLP0QV2.js} +3 -3
- package/dist/assets/{index-DKSVm7e-.js → index-C3V_Ak74.js} +1 -1
- package/dist/assets/{index-DiqdSyj7.js → index-CK2ZwMoB.js} +5 -5
- package/dist/assets/{index-DnuNgd04.js → index-CWtUSVIH.js} +1 -1
- package/dist/assets/{index--t-eBalO.js → index-Cc_JDDUW.js} +1 -1
- package/dist/assets/{index-DIpoCt72.js → index-CdVfZKvV.js} +1 -1
- package/dist/assets/{index-aRHQsmOg.js → index-Cfrh8736.js} +1 -1
- package/dist/assets/{index-BBGDYmGN.js → index-Ch20_Gn6.js} +1 -1
- package/dist/assets/{index-XwZTnGB3.js → index-Ch3guul5.js} +1 -1
- package/dist/assets/{index-BYMI0ny4.js → index-Cl9r3uEV.js} +1 -1
- package/dist/assets/{index-Crb5v_oP.js → index-CyU0h18X.js} +1 -1
- package/dist/assets/{index-CS-lh8B6.js → index-DHkYqLAY.js} +1 -1
- package/dist/assets/{index-BQ7b2rES.js → index-DYUtJWG8.js} +1 -1
- package/dist/assets/{index-CALyM1b7.js → index-DZXHhkOt.js} +1 -1
- package/dist/assets/index-Dh70orck.js +1 -0
- package/dist/assets/{index-C-fUoCuC.js → index-DtgymkwS.js} +1 -1
- package/dist/assets/{index-DW1-kshH.js → index-kx2x1q2N.js} +1 -1
- package/dist/assets/{index-B9JcYhlg.js → index-sEUo7wfw.js} +1 -1
- package/dist/assets/{index-DByR2J-y.js → index-vI-j8RJ2.js} +2 -2
- package/dist/assets/{invitation-DDf3OBDz.js → invitation-DTvxpx-M.js} +1 -1
- package/dist/assets/{invitations-D12iZAQL.js → invitations-DaZ82lJz.js} +1 -1
- package/dist/assets/{invite-Df9QWw7t.js → invite-B9UmiQDw.js} +1 -1
- package/dist/assets/{isURL-bkdgf1x2.js → isURL-DI8OpvEf.js} +1 -1
- package/dist/assets/{issue-passport-gNt3LqEb.js → issue-passport-D5GApp70.js} +1 -1
- package/dist/assets/{item-1yEVSl8f.js → item-D1yR_MDv.js} +1 -1
- package/dist/assets/ja-Dkn5OA2r.js +9 -0
- package/dist/assets/ko-DXfRo0NY.js +9 -0
- package/dist/assets/{landing-page-DIy3L18O.js → landing-page-BIWKEZD_.js} +1 -1
- package/dist/assets/{layout-CgGSszKF.js → layout-BLkdV05j.js} +1 -1
- package/dist/assets/{list-CSWSdurz.js → list-Cyphcnxa.js} +1 -1
- package/dist/assets/{list-Bj4EH_EL.js → list-rzFnsBFB.js} +1 -1
- package/dist/assets/{localization-CgrsqMtL.js → localization-DorjASD7.js} +1 -1
- package/dist/assets/{log-B_J8mg8B.js → log-CJ_iyIlL.js} +1 -1
- package/dist/assets/{login-Bio30C4m.js → login-DGJOwn5p.js} +1 -1
- package/dist/assets/{login-oauth-callback-D0EhzZTU.js → login-oauth-callback-BYfBr2PG.js} +1 -1
- package/dist/assets/{logo-uploader-DnA7whvY.js → logo-uploader-JGejQIFw.js} +1 -1
- package/dist/assets/{lost-passport-CM51lU3r.js → lost-passport-BNK7HPbD.js} +1 -1
- package/dist/assets/{open-window-z11fkxAm.js → open-window-C3jjCeaT.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-B7tDPPws.js → over-due-invoice-payment-Db3XRUjV.js} +1 -1
- package/dist/assets/{overview-1UV4-LGy.js → overview-BXpe9azn.js} +1 -1
- package/dist/assets/{passport-BxAsPdEH.js → passport-D9DnlXMQ.js} +1 -1
- package/dist/assets/{passport-item-DmCvf5Er.js → passport-item-DouM676j.js} +1 -1
- package/dist/assets/{permission-t78Xon7o.js → permission-CFZyPM8U.js} +1 -1
- package/dist/assets/{preferences-K24ynDKn.js → preferences-DfiBTjAd.js} +1 -1
- package/dist/assets/{profile-embed-DXvSNJu_.js → profile-embed-Dt_zuZJQ.js} +1 -1
- package/dist/assets/pt-CNQsUMCu.js +5 -0
- package/dist/assets/{publish-resource-BM96DWgo.js → publish-resource-CO34lIX9.js} +1 -1
- package/dist/assets/ru-CjyCft4V.js +5 -0
- package/dist/assets/{runtime-RJv_jEZF.js → runtime-C2bubBwk.js} +1 -1
- package/dist/assets/sdk-lNpIX04q.js +1 -0
- package/dist/assets/{security-C-ANgtMR.js → security-D5ayNbch.js} +1 -1
- package/dist/assets/{session-Dt50YAVT.js → session-DkvXxWtg.js} +1 -1
- package/dist/assets/{setup-BryxUu7A.js → setup-DvZls4Lo.js} +1 -1
- package/dist/assets/{simple-select-DZvdqo7G.js → simple-select-BP2aEPA1.js} +1 -1
- package/dist/assets/{spaces-BRmoEATc.js → spaces-Crb6xNg_.js} +1 -1
- package/dist/assets/{start-CChSAOWC.js → start-DEanO3ch.js} +1 -1
- package/dist/assets/{starting-progress-Dn3jpzSc.js → starting-progress-CZvfzqkC.js} +1 -1
- package/dist/assets/status-De4_OTsm.js +1 -0
- package/dist/assets/{step-actions-BursUhDh.js → step-actions-B3C_rdx7.js} +1 -1
- package/dist/assets/{studio-Cfhka82V.js → studio-BqxKVD_H.js} +1 -1
- package/dist/assets/{team-W2Fdvkfl.js → team-zaYl7mkh.js} +1 -1
- package/dist/assets/th-WQWRMKAv.js +5 -0
- package/dist/assets/{traffic-DKKjsKRb.js → traffic-ZVRPMYlF.js} +1 -1
- package/dist/assets/{transfer-Dji3lOoL.js → transfer-vhH8WqET.js} +1 -1
- package/dist/assets/{unsubscribe-Dszf0vso.js → unsubscribe-D400O_ym.js} +1 -1
- package/dist/assets/{use-app-logo-Bu9kUO2d.js → use-app-logo-RgeQYsuM.js} +1 -1
- package/dist/assets/{user-center-BuHH3C1u.js → user-center-Dyu4ORgh.js} +2 -2
- package/dist/assets/{user-follower-Bn21LRum.js → user-follower-DoonDjSz.js} +1 -1
- package/dist/assets/{util-qnRu_NH_.js → util-BIClPSUX.js} +1 -1
- package/dist/assets/{util-Byg5myf8.js → util-Dcv5G2iK.js} +1 -1
- package/dist/assets/vi-Br98wbNi.js +5 -0
- package/dist/assets/{wait-connect-z8A2YqYx.js → wait-connect-DUwp6hVe.js} +1 -1
- package/dist/assets/{wizard-gl51MV0G.js → wizard-CXL7I23B.js} +1 -1
- package/dist/assets/{wizard-components-Bu-3Twf8.js → wizard-components-CZc8F6Ff.js} +1 -1
- package/dist/assets/{wrap-locale-DwrX4tfZ.js → wrap-locale-D5BJMkAL.js} +1 -1
- package/dist/assets/{zh-5FnkOdV9.js → zh-BvhUUizT.js} +1 -1
- package/dist/assets/{zh-Daif36Hm.js → zh-DB1zAstv.js} +1 -1
- package/dist/assets/zh-tw-DVMVT9am.js +9 -0
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +23 -23
- package/dist/assets/ar-CCM7LUa7.js +0 -7
- package/dist/assets/de-STCToRpb.js +0 -7
- package/dist/assets/engine-D5_fEmdT.js +0 -1
- package/dist/assets/es-CrUw-8oc.js +0 -9
- package/dist/assets/fr-B6GuZu9m.js +0 -7
- package/dist/assets/hi-Cw_VH7M3.js +0 -5
- package/dist/assets/id-ErxRX4DU.js +0 -7
- package/dist/assets/index-DCa5wWAd.js +0 -1
- package/dist/assets/ja-CvssCilG.js +0 -9
- package/dist/assets/ko-CwfYSSYs.js +0 -9
- package/dist/assets/pt-DiKRyIZy.js +0 -5
- package/dist/assets/ru-5wNmeEUO.js +0 -5
- package/dist/assets/sdk-2Xqu2SZD.js +0 -1
- package/dist/assets/status-Ukzm4O8y.js +0 -1
- package/dist/assets/th-B6ebKspD.js +0 -5
- package/dist/assets/vi-PpVWvm1I.js +0 -5
- package/dist/assets/zh-tw-C3Px30Ps.js +0 -9
package/api/libs/email.js
CHANGED
|
@@ -43,14 +43,15 @@ async function sendEmail(
|
|
|
43
43
|
|
|
44
44
|
const blocklet = await node.getBlocklet({ did: teamDid, useCache: true });
|
|
45
45
|
if (!blocklet) {
|
|
46
|
-
logger.warn(`Failed to get blocklet: ${teamDid}`);
|
|
47
46
|
throw new Error(`Failed to get blocklet: ${teamDid}`);
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
const provider = getEmailServiceProvider(blocklet);
|
|
51
50
|
logger.debug('service.sendEmail', { teamDid, provider, raw, launcher });
|
|
52
51
|
if (!provider || (provider === 'launcher' && !launcher)) {
|
|
53
|
-
|
|
52
|
+
const error = new Error('Email Service is not available.');
|
|
53
|
+
error.logLevel = 'debug';
|
|
54
|
+
throw error;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -10,16 +10,15 @@ const logger = require('../logger')('blocklet-services:notification');
|
|
|
10
10
|
async function sendPush(receiver, notification, { node, teamDid }) {
|
|
11
11
|
const blocklet = await node.getBlocklet({ did: teamDid, useCache: true });
|
|
12
12
|
if (!blocklet) {
|
|
13
|
-
logger.warn(`Failed to get blocklet: ${teamDid}`);
|
|
14
13
|
throw new Error(`Failed to get blocklet: ${teamDid}`);
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
const config = blocklet.settings?.notification?.pushKit || {};
|
|
18
17
|
|
|
19
18
|
if (!config.enabled || !config.endpoint) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
throw
|
|
19
|
+
const error = new Error(`Push Kit Service is not Enabled, teamDid: ${teamDid}`);
|
|
20
|
+
error.logLevel = 'debug';
|
|
21
|
+
throw error;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
const pushKitConfig = {
|
|
@@ -22,7 +22,7 @@ const { updateNotificationSendStatus } = require('../../socket/channel/did');
|
|
|
22
22
|
const eventHub =
|
|
23
23
|
process.env.NODE_ENV === 'test' ? require('@arcblock/event-hub/single') : require('@arcblock/event-hub');
|
|
24
24
|
|
|
25
|
-
const logger = require('../../libs/logger')('notification');
|
|
25
|
+
const logger = require('../../libs/logger')('blocklet-services:notification-queue');
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
*
|
|
@@ -83,10 +83,9 @@ const init = ({ node, notificationService }) => {
|
|
|
83
83
|
},
|
|
84
84
|
async (job) => {
|
|
85
85
|
try {
|
|
86
|
-
const { receiver, notification, sender, options } = job;
|
|
86
|
+
const { receiver, notification, sender, options, source } = job;
|
|
87
87
|
|
|
88
88
|
if (!receiver) {
|
|
89
|
-
logger.error('Invalid receiver', { did: receiver });
|
|
90
89
|
throw new Error('Invalid receiver');
|
|
91
90
|
}
|
|
92
91
|
|
|
@@ -96,9 +95,10 @@ const init = ({ node, notificationService }) => {
|
|
|
96
95
|
notification,
|
|
97
96
|
options,
|
|
98
97
|
pushOnly: job.pushOnly,
|
|
98
|
+
source,
|
|
99
99
|
});
|
|
100
100
|
} catch (error) {
|
|
101
|
-
logger.
|
|
101
|
+
logger.error('Failed to send to app', { notificationId: job.notification.id, receiver: job.receiver, error });
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
);
|
|
@@ -111,7 +111,6 @@ const init = ({ node, notificationService }) => {
|
|
|
111
111
|
const { notification, receiver, sender } = job;
|
|
112
112
|
|
|
113
113
|
if (!receiver) {
|
|
114
|
-
logger.error('Invalid receiver', { did: receiver });
|
|
115
114
|
throw new Error('Invalid receiver');
|
|
116
115
|
}
|
|
117
116
|
|
|
@@ -122,7 +121,11 @@ const init = ({ node, notificationService }) => {
|
|
|
122
121
|
pushOnly: job.pushOnly,
|
|
123
122
|
});
|
|
124
123
|
} catch (error) {
|
|
125
|
-
|
|
124
|
+
if (error.logLevel === 'debug') {
|
|
125
|
+
logger.debug('Failed to send to push', { notificationId: job.notification.id, receiver: job.receiver, error });
|
|
126
|
+
} else {
|
|
127
|
+
logger.error('Failed to send to push', { notificationId: job.notification.id, receiver: job.receiver, error });
|
|
128
|
+
}
|
|
126
129
|
}
|
|
127
130
|
});
|
|
128
131
|
|
|
@@ -142,14 +145,10 @@ const init = ({ node, notificationService }) => {
|
|
|
142
145
|
try {
|
|
143
146
|
const { input, email } = job;
|
|
144
147
|
if (!input) {
|
|
145
|
-
logger.error('Job input is missing or invalid', { notificationId: job.notificationId });
|
|
146
148
|
throw new Error('Job input is missing or invalid');
|
|
147
149
|
}
|
|
148
150
|
|
|
149
151
|
if (!email) {
|
|
150
|
-
logger.error('Email address is missing. Unable to send email notification', {
|
|
151
|
-
notificationId: job.notificationId,
|
|
152
|
-
});
|
|
153
152
|
throw new Error('Email address is missing. Unable to send email notification');
|
|
154
153
|
}
|
|
155
154
|
|
|
@@ -206,7 +205,21 @@ const init = ({ node, notificationService }) => {
|
|
|
206
205
|
notificationId: job.notificationId,
|
|
207
206
|
});
|
|
208
207
|
} catch (error) {
|
|
209
|
-
|
|
208
|
+
if (error.logLevel === 'debug') {
|
|
209
|
+
logger.debug('Failed to send to email', {
|
|
210
|
+
notificationId: job.notificationId,
|
|
211
|
+
receivers: job.input.receivers.join(','),
|
|
212
|
+
email: job.email,
|
|
213
|
+
error,
|
|
214
|
+
});
|
|
215
|
+
} else {
|
|
216
|
+
logger.error('Failed to send to email', {
|
|
217
|
+
notificationId: job.notificationId,
|
|
218
|
+
receivers: job.input.receivers.join(','),
|
|
219
|
+
email: job.email,
|
|
220
|
+
error,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
210
223
|
}
|
|
211
224
|
}
|
|
212
225
|
);
|
|
@@ -227,19 +240,16 @@ const init = ({ node, notificationService }) => {
|
|
|
227
240
|
try {
|
|
228
241
|
const { input } = job;
|
|
229
242
|
if (!input) {
|
|
230
|
-
logger.error('Invalid job', { url: job.url });
|
|
231
243
|
throw new Error('Invalid job');
|
|
232
244
|
}
|
|
233
245
|
|
|
234
246
|
const { notification, webhook, sender, receivers = [] } = input;
|
|
235
247
|
|
|
236
248
|
if (!receivers.length) {
|
|
237
|
-
logger.error('Invalid receiver', { dids: receivers });
|
|
238
249
|
throw new Error('Invalid receiver');
|
|
239
250
|
}
|
|
240
251
|
|
|
241
252
|
if (!webhook || !webhook.url) {
|
|
242
|
-
logger.error('Invalid webhook', { webhook });
|
|
243
253
|
throw new Error('Invalid webhook');
|
|
244
254
|
}
|
|
245
255
|
|
|
@@ -264,7 +274,12 @@ const init = ({ node, notificationService }) => {
|
|
|
264
274
|
notificationId: job.notificationId,
|
|
265
275
|
});
|
|
266
276
|
} catch (error) {
|
|
267
|
-
logger.
|
|
277
|
+
logger.error('Failed to send to webhook', {
|
|
278
|
+
url: job?.webhook?.url,
|
|
279
|
+
notificationId: job.notificationId,
|
|
280
|
+
receivers: job.input.receivers.join(','),
|
|
281
|
+
error,
|
|
282
|
+
});
|
|
268
283
|
}
|
|
269
284
|
}
|
|
270
285
|
);
|
|
@@ -498,7 +513,7 @@ const init = ({ node, notificationService }) => {
|
|
|
498
513
|
};
|
|
499
514
|
|
|
500
515
|
const insertToWalletPushQueue = (props, nodeInfo, isResend) => {
|
|
501
|
-
const { channels, notification, sender, userInfo, teamDid, options = {} } = props;
|
|
516
|
+
const { channels, notification, sender, userInfo, teamDid, options = {}, source } = props;
|
|
502
517
|
|
|
503
518
|
const receiverDid = userInfo.did;
|
|
504
519
|
|
|
@@ -521,6 +536,7 @@ const init = ({ node, notificationService }) => {
|
|
|
521
536
|
receiver: receiverDid,
|
|
522
537
|
isResend,
|
|
523
538
|
pushOnly: props.pushOnly && !isResend,
|
|
539
|
+
source,
|
|
524
540
|
});
|
|
525
541
|
} else {
|
|
526
542
|
// 如果是重发的消息,只需要更新推送状态,不需要更新 channel状态
|
|
@@ -587,10 +603,14 @@ const init = ({ node, notificationService }) => {
|
|
|
587
603
|
const queue = createNotificationQueue('notification-receivers', {}, async (job) => {
|
|
588
604
|
const { teamDid, channels, receiver, sender, notification, nodeInfo, userInfo, ...rest } = job;
|
|
589
605
|
|
|
606
|
+
logger.info('notification start insert to queue', {
|
|
607
|
+
teamDid,
|
|
608
|
+
notificationId: notification.id,
|
|
609
|
+
receiver,
|
|
610
|
+
});
|
|
590
611
|
try {
|
|
591
612
|
if (!userInfo) {
|
|
592
|
-
|
|
593
|
-
throw new Error('Invalid receiver user');
|
|
613
|
+
throw new Error(`Invalid receiver user: ${receiver}`);
|
|
594
614
|
}
|
|
595
615
|
|
|
596
616
|
// FIXME: @liushuang: notification.id.startsWith('NOTIF-') HACK 的处理方式,是一个兜底行为。
|
|
@@ -669,7 +689,7 @@ const init = ({ node, notificationService }) => {
|
|
|
669
689
|
logger.error('Failed to insert to webhook push queue', { error });
|
|
670
690
|
}
|
|
671
691
|
} catch (error) {
|
|
672
|
-
logger.error('Failed to create notification receiver', { error });
|
|
692
|
+
logger.error('Failed to create notification receiver', { error, notificationId: notification.id });
|
|
673
693
|
}
|
|
674
694
|
});
|
|
675
695
|
|
|
@@ -677,33 +697,21 @@ const init = ({ node, notificationService }) => {
|
|
|
677
697
|
eventHub.on(EVENTS.NOTIFICATION_CREATE_QUEUED, async (data) => {
|
|
678
698
|
// Only first worker process handle blocklet event
|
|
679
699
|
try {
|
|
680
|
-
logger.info('notification start insert to queue
|
|
700
|
+
logger.info('notification start insert to queue:', {
|
|
681
701
|
teamDid: data?.teamDid,
|
|
682
702
|
notificationId: data?.notification?.id,
|
|
683
703
|
receivers: data?.receivers?.join(','),
|
|
684
704
|
});
|
|
685
705
|
if (isInstanceWorker()) {
|
|
686
|
-
logger.warn('notification is instance worker, skip insert to queue', {
|
|
687
|
-
teamDid: data?.teamDid,
|
|
688
|
-
notificationId: data?.notification?.id,
|
|
689
|
-
receivers: data?.receivers?.join(','),
|
|
690
|
-
});
|
|
691
706
|
return;
|
|
692
707
|
}
|
|
693
708
|
if (!data.notification) {
|
|
694
|
-
|
|
695
|
-
return;
|
|
709
|
+
throw new Error('Invalid notification: notification is required');
|
|
696
710
|
}
|
|
697
711
|
const nodeInfo = await node.getNodeInfo({ useCache: true });
|
|
698
712
|
|
|
699
713
|
if (nodeInfo.mode !== NODE_MODES.DEBUG) {
|
|
700
|
-
|
|
701
|
-
await validateNotification(data.notification);
|
|
702
|
-
} catch (error) {
|
|
703
|
-
logger.error('Failed to validate notification', { error });
|
|
704
|
-
// 抛出错误,阻止后续执行
|
|
705
|
-
throw error;
|
|
706
|
-
}
|
|
714
|
+
await validateNotification(data.notification);
|
|
707
715
|
}
|
|
708
716
|
|
|
709
717
|
// 按照 receiver 添加到推送队列
|
|
@@ -725,11 +733,6 @@ const init = ({ node, notificationService }) => {
|
|
|
725
733
|
});
|
|
726
734
|
|
|
727
735
|
if (users.length === 0) {
|
|
728
|
-
logger.warn('no users found, skip insert to queue', {
|
|
729
|
-
notificationId: notification?.id,
|
|
730
|
-
receivers: receivers?.join(','),
|
|
731
|
-
teamDid,
|
|
732
|
-
});
|
|
733
736
|
throw new Error('No users found');
|
|
734
737
|
}
|
|
735
738
|
// 如果 notification 没有 id,则生成一个, wallet 要基于这唯一个ID进行处理
|
|
@@ -755,7 +758,11 @@ const init = ({ node, notificationService }) => {
|
|
|
755
758
|
});
|
|
756
759
|
});
|
|
757
760
|
} catch (error) {
|
|
758
|
-
logger.error('Failed to create notification receiver', {
|
|
761
|
+
logger.error('Failed to create notification receiver', {
|
|
762
|
+
error,
|
|
763
|
+
notificationId: data?.notification?.id,
|
|
764
|
+
teamDid: data?.teamDid,
|
|
765
|
+
});
|
|
759
766
|
}
|
|
760
767
|
});
|
|
761
768
|
};
|
|
@@ -13,7 +13,7 @@ const {
|
|
|
13
13
|
const JWT = require('@arcblock/jwt');
|
|
14
14
|
const uniq = require('lodash/uniq');
|
|
15
15
|
|
|
16
|
-
const logger = require('../../libs/logger')('
|
|
16
|
+
const logger = require('../../libs/logger')('blocklet-services:socket-channel:did');
|
|
17
17
|
const { ensureSenderApp, getSenderServer, parseNotification, EVENTS } = require('../util');
|
|
18
18
|
const states = require('../../state');
|
|
19
19
|
const { sendEmail } = require('../../libs/email');
|
|
@@ -162,6 +162,8 @@ const sendToUserDid = async ({ sender, receiver: rawDid, notification, options,
|
|
|
162
162
|
|
|
163
163
|
const notifications = Array.isArray(notification) ? notification : [notification];
|
|
164
164
|
|
|
165
|
+
const isServer = !teamDid || teamDid === nodeInfo.did;
|
|
166
|
+
|
|
165
167
|
try {
|
|
166
168
|
const result = await Promise.all(
|
|
167
169
|
notifications.map((_notification) => {
|
|
@@ -183,7 +185,7 @@ const sendToUserDid = async ({ sender, receiver: rawDid, notification, options,
|
|
|
183
185
|
// 这两个字段用于 socket 通知
|
|
184
186
|
entityType: _notification.entityType || 'blocklet',
|
|
185
187
|
entityId: _notification.entityId || sender.appDid,
|
|
186
|
-
source: _notification.source || 'component',
|
|
188
|
+
source: isServer ? 'system' : _notification.source || 'component',
|
|
187
189
|
channels: CHANNEL_MAP[_notification.type] || channels,
|
|
188
190
|
sender,
|
|
189
191
|
options: { ...rest },
|
|
@@ -210,11 +212,12 @@ const sendToAppDid = async ({
|
|
|
210
212
|
options,
|
|
211
213
|
pushOnly,
|
|
212
214
|
wsServer,
|
|
215
|
+
source,
|
|
213
216
|
}) => {
|
|
214
217
|
if (notification && sender) {
|
|
215
218
|
const { keepForOfflineUser = true, ttl } = options || {};
|
|
216
219
|
const teamDid = sender.appDid;
|
|
217
|
-
const { id
|
|
220
|
+
const { id } = notification;
|
|
218
221
|
if (Array.isArray(receiver)) {
|
|
219
222
|
throw new Error('Invalid receiver: 1 receiver each time');
|
|
220
223
|
}
|
|
@@ -242,7 +245,7 @@ const sendToAppDid = async ({
|
|
|
242
245
|
|
|
243
246
|
if (count <= 0 && keepForOfflineUser && source !== 'system') {
|
|
244
247
|
// 系统发出的消息不进行缓存
|
|
245
|
-
logger.
|
|
248
|
+
logger.debug('Online client was not found', { userDid: receiver });
|
|
246
249
|
await states.message.insert({
|
|
247
250
|
did: receiver,
|
|
248
251
|
event: EVENTS.MESSAGE,
|
|
@@ -393,7 +396,7 @@ const sendToWebhook = async ({ sender, receiver, notification, node, pushOnly })
|
|
|
393
396
|
status: res ? NOTIFICATION_SEND_STATUS.SENT : NOTIFICATION_SEND_STATUS.FAILED,
|
|
394
397
|
failedReason: res ? '' : NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE,
|
|
395
398
|
};
|
|
396
|
-
|
|
399
|
+
updateNotificationSendStatus({
|
|
397
400
|
node,
|
|
398
401
|
teamDid,
|
|
399
402
|
notificationId: id,
|
|
@@ -404,14 +407,15 @@ const sendToWebhook = async ({ sender, receiver, notification, node, pushOnly })
|
|
|
404
407
|
}
|
|
405
408
|
return res;
|
|
406
409
|
} catch (error) {
|
|
407
|
-
|
|
410
|
+
// 使用 debug 级别记录详细执行信息,避免与上层业务日志重复
|
|
411
|
+
logger.debug('Webhook send failed', { error, webhook: webhook.url, notificationId: id });
|
|
408
412
|
if (!pushOnly) {
|
|
409
413
|
webhookParams[webhook.url] = {
|
|
410
414
|
...webhookParams[webhook.url],
|
|
411
415
|
status: NOTIFICATION_SEND_STATUS.FAILED,
|
|
412
416
|
failedReason: error.message,
|
|
413
417
|
};
|
|
414
|
-
|
|
418
|
+
updateNotificationSendStatus({
|
|
415
419
|
node,
|
|
416
420
|
teamDid,
|
|
417
421
|
notificationId: id,
|
|
@@ -445,7 +449,7 @@ const sendToMail = async ({ sender, receiver, notification, options, node, pushO
|
|
|
445
449
|
throw new Error('Invalid receiver: empty');
|
|
446
450
|
}
|
|
447
451
|
if (receivers.some((x) => emailSchema.validate(x).error)) {
|
|
448
|
-
throw new Error(
|
|
452
|
+
throw new Error(`Invalid receiver: invalid email: ${receivers.join(', ')}`);
|
|
449
453
|
}
|
|
450
454
|
if (receivers.length > 10) {
|
|
451
455
|
throw new Error('Invalid receiver: too many, should be less than 10');
|
|
@@ -566,7 +570,8 @@ const sendToPush = async ({ sender, receiver, notification, options, node, pushO
|
|
|
566
570
|
return res;
|
|
567
571
|
})
|
|
568
572
|
.catch((err) => {
|
|
569
|
-
|
|
573
|
+
// 使用 debug 级别记录详细执行信息,避免与上层业务日志重复
|
|
574
|
+
logger.debug('PushKit send failed', { error: err, receivers, notificationId: id });
|
|
570
575
|
if (!pushOnly) {
|
|
571
576
|
updateNotificationSendStatus({
|
|
572
577
|
node,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as E,j as e,ak as l,y as h,bq as A,b6 as g,br as L,at as N,W as y}from"./vendor-mui-core-___CiWHn.js";import{r as m}from"./vendor-react-CUXIiAnY.js";import{V as I,H as j}from"./vendor-ux-pxYpYMxD.js";import{A as b}from"./config-
|
|
1
|
+
import{D as E,j as e,ak as l,y as h,bq as A,b6 as g,br as L,at as N,W as y}from"./vendor-mui-core-___CiWHn.js";import{r as m}from"./vendor-react-CUXIiAnY.js";import{V as I,H as j}from"./vendor-ux-pxYpYMxD.js";import{A as b}from"./config-BU9M-TDw.js";import{a as O}from"./page-header-bY0dwe6y.js";import{l as v,e as R,c as o,f as T}from"./index-CK2ZwMoB.js";import{S as Y}from"./layout-BLkdV05j.js";import{S as D}from"./step-actions-B3C_rdx7.js";import{S as P}from"./button-CjoOMC5b.js";import"./vendor-utils-Doa0RxLS.js";import"./vendor-hooks-L8kZVRUL.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DBEMYjVA.js";import"./content-layout-DpoiOm37.js";import"./use-mobile-yOnqxyr6.js";function W({onNext:a=()=>{}}){const C=E(),{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(h,{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 B,j as l,a6 as Tt,at as tt,ak as te,D as Ut,T as je,J as Yt,b6 as ei,a5 as ti,I as No,bV as Ao,S as Do,bb as va,dR as ya,aP as Mo,F as ba,z as Hn,bP as xa,bQ as wa,bR as Sa,bD as Ea,aX as Bo,V as ka,aO as Ta,cY as ja,cZ as Oa,bB as Ca,bE as Ia,M as ni,am as Fo,aq as Ra,b1 as lt,b7 as Pa,dM as La,a8 as $o,ad as Uo,aV as _a,aj as qo,Q as jn,Y as Na,bw as Wo,o as zo,aU as Aa,ar as Xt,c7 as Da,c6 as Ma,c2 as ki,U as Ti,ah as Ba,dO as Fa,O as $a,K as Ua,P as qa,ai as Wa,an as Vo,A as ji,aI as za,dJ as Va}from"./vendor-mui-core-___CiWHn.js";import{r as q,g as ri,u as Ka,i as Ga,p as Ha,e as Xa,a as $t,d as Ya,f as Rn,j as Ja}from"./vendor-react-CUXIiAnY.js";import{r as ii,S as Qa,s as Ko,A as Za}from"./item-
|
|
1
|
+
import{W as B,j as l,a6 as Tt,at as tt,ak as te,D as Ut,T as je,J as Yt,b6 as ei,a5 as ti,I as No,bV as Ao,S as Do,bb as va,dR as ya,aP as Mo,F as ba,z as Hn,bP as xa,bQ as wa,bR as Sa,bD as Ea,aX as Bo,V as ka,aO as Ta,cY as ja,cZ as Oa,bB as Ca,bE as Ia,M as ni,am as Fo,aq as Ra,b1 as lt,b7 as Pa,dM as La,a8 as $o,ad as Uo,aV as _a,aj as qo,Q as jn,Y as Na,bw as Wo,o as zo,aU as Aa,ar as Xt,c7 as Da,c6 as Ma,c2 as ki,U as Ti,ah as Ba,dO as Fa,O as $a,K as Ua,P as qa,ai as Wa,an as Vo,A as ji,aI as za,dJ as Va}from"./vendor-mui-core-___CiWHn.js";import{r as q,g as ri,u as Ka,i as Ga,p as Ha,e as Xa,a as $t,d as Ya,f as Rn,j as Ja}from"./vendor-react-CUXIiAnY.js";import{r as ii,S as Qa,s as Ko,A as Za}from"./item-D1yR_MDv.js";import{n as vt,b as oi,e as Go,V as xt,U as yt,a6 as el,r as tl,O as Xn,H as Yn,aE as Oi,l as Qt,o as Ho,$ as Vn,w as Xo,d as nl,i as rl,A as Fr,aX as il}from"./vendor-ux-pxYpYMxD.js";import{_ as dn,e as Ft,c as ol,c5 as sl,b6 as al,bS as Yo,c6 as ll,c7 as cl,c8 as ul,c9 as dl,a8 as hl,Y as Mt,bB as fl,v as Jo,aP as pl,ca as ml,G as gl,cb as vl,ac as Jn,cc as Qo,bi as Zo,k as Qn,V as Ci,cd as yl,aq as bl,ce as xl,cf as wl,cg as Pn,ch as Ii,b7 as Sl}from"./index-CK2ZwMoB.js";import{j as Ri,o as El,T as kl,L as Tl,P as jl}from"./vendor-arcblock-DBEMYjVA.js";import{u as Pi}from"./launch-result-message-5HOBRYMn.js";import{a as $r}from"./page-header-bY0dwe6y.js";import{e as gt,B as Ol,C as rn,J as Zn,D as Li,R as es,Q as Cl,a8 as Il,A as Rl,o as sr,V as Pl,al as Ll,am as _l,an as Nl,a as xn,S as Al,b as Dl}from"./vendor-utils-Doa0RxLS.js";import{f as Ur}from"./index-DBs9Ljax.js";import{e as Ml}from"./engine-B0uUUVPG.js";import{u as Bl,C as Fl}from"./config-space-CNnFak18.js";import{R as Ln}from"./required-BuZo1JHj.js";import{S as $l}from"./index-sEUo7wfw.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-DO0bEcmC.js";import{k as On,a as Hl,b as Xl,u as ns,g as Yl,q as Jl}from"./vendor-hooks-L8kZVRUL.js";import{g as Ql}from"./get-safe-url-D0cItynk.js";import{r as rs,A as Zl}from"./config-DCVvdigc.js";import{r as ec}from"./index-BsA1v5Kx.js";import{r as tc}from"./cloneDeep-C11iVb3m.js";import{u as si}from"./useLocalStorage-CbmitI3m.js";import{v as _i}from"./index-0wVxGFHL.js";import{u as nc}from"./session-DkvXxWtg.js";import{W as rc}from"./did-address-BKqL0vbP.js";import{a as Ni}from"./api-DcGGeMWE.js";import{v as ic,e as oc}from"./util-BIClPSUX.js";import{u as is}from"./use-mobile-BGG7EyYb.js";import{C as sc}from"./content-layout-DpoiOm37.js";import{C as ac,D as lc,a as cc}from"./connect-to-DBGTL_TU.js";import{d as ar}from"./search-4YYphs0l.js";const _f="blocklet-add-component-registry",Nf="server-add-registry",Af=e=>`resource-${e}-add-registry`;function os(e){const{info:t}=dn();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:B.bool,children:B.any.isRequired,onConfirm:B.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(vt,{disabled:t,color:"primary",variant:"contained",className:"next-button",onClick:e,children:r?l.jsxs(l.Fragment,{children:[l.jsx(Tt,{size:14}),i.launchingText]}):i.buttonNext})]})}),l.jsx(oi,{open:n,title:i.listenName,onClose:()=>o(!1),children:s})]})}as.propTypes={onContinue:B.func.isRequired,nextDisabled:B.bool,launching:B.bool,description:B.any,texts:B.object};const uc=tt.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-___CiWHn.js";import{j as B,r}from"./vendor-react-CUXIiAnY.js";import{C as W,D as L}from"./vendor-utils-Doa0RxLS.js";import{V as O,b as A}from"./vendor-ux-pxYpYMxD.js";import{h as d,b as T,m as _}from"./vendor-hooks-L8kZVRUL.js";import{A as $,S as F}from"./add-component-core-
|
|
1
|
+
import{J as v,j as l}from"./vendor-mui-core-___CiWHn.js";import{j as B,r}from"./vendor-react-CUXIiAnY.js";import{C as W,D as L}from"./vendor-utils-Doa0RxLS.js";import{V as O,b as A}from"./vendor-ux-pxYpYMxD.js";import{h as d,b as T,m as _}from"./vendor-hooks-L8kZVRUL.js";import{A as $,S as F}from"./add-component-core-CvN1A_dW.js";import{l as K,I as z}from"./index-CK2ZwMoB.js";import"./lottie-web-4koyQiv_.js";import"./item-D1yR_MDv.js";import"./index-DBs9Ljax.js";import"./delete-confirm-ByS6hl26.js";import"./click-to-copy-BiDS_MtA.js";import"./confirm-CvbX7Jj-.js";import"./session-DkvXxWtg.js";import"./get-safe-url-D0cItynk.js";import"./did-address-BKqL0vbP.js";import"./wait-connect-DUwp6hVe.js";import"./vendor-arcblock-DBEMYjVA.js";import"./launch-result-message-5HOBRYMn.js";import"./page-header-bY0dwe6y.js";import"./engine-B0uUUVPG.js";import"./config-space-CNnFak18.js";import"./spaces-Crb6xNg_.js";import"./api-DcGGeMWE.js";import"./required-BuZo1JHj.js";import"./index-sEUo7wfw.js";import"./Google-BOjQI1aW.js";import"./cloneDeep-C11iVb3m.js";import"./create-passport-svg-k1mCsufD.js";import"./form-wrapper-BxqO_YSO.js";import"./logo-uploader-JGejQIFw.js";import"./collapse-Cqxx6nMG.js";import"./index-DO0bEcmC.js";import"./config-DCVvdigc.js";import"./isURL-DI8OpvEf.js";import"./section-DDyoFT-o.js";import"./form-text-input-gTokKFc6.js";import"./edit.svg-Dz9cVo7r.js";import"./index-BsA1v5Kx.js";import"./useLocalStorage-CbmitI3m.js";import"./index-0wVxGFHL.js";import"./util-BIClPSUX.js";import"./use-mobile-BGG7EyYb.js";import"./content-layout-DpoiOm37.js";import"./connect-to-DBGTL_TU.js";import"./index-BWJVW6O0.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-DDc9u4Rr.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",b=e.searchParams.get("enableRunBackground")!=="false",S=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=T(t=>{t.data?.event==="resourceDialog.select"&&t.data?.componentDid===s&&(D(t.data.data),j(t.data.storeUrl))});d(()=>{window.addEventListener("message",c)}),_(()=>{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:F(`${n}+${m}`),showResourcesSwitch:R,showFromUrl:C,enableRunBackground:b,showCategory:S});return f?l.jsx(A,{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-CUXIiAnY.js";import{j as e,I as u,at as C,W as o}from"./vendor-mui-core-___CiWHn.js";import{p as M,Y as f,f as b}from"./vendor-ux-pxYpYMxD.js";import{al as H}from"./index-
|
|
1
|
+
import{r as t,k as x}from"./vendor-react-CUXIiAnY.js";import{j as e,I as u,at as C,W as o}from"./vendor-mui-core-___CiWHn.js";import{p as M,Y as f,f as b}from"./vendor-ux-pxYpYMxD.js";import{al as H}from"./index-CK2ZwMoB.js";import{t as Z}from"./question-mark-circle.svg-DK9nTUDZ.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 k({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(j,{locale:p,session:d,size:24,showRole:!0,...i,showManageBlocklet:!1})]})}k.propTypes={SessionContext:o.object.isRequired,extraItems:o.array,showLocale:o.bool,showSessionManager:o.bool,showHelper:o.bool,sessionManagerProps:o.object};const j=C(b)`
|
|
2
2
|
.user-addon {
|
|
3
3
|
.user-avatar {
|
|
4
4
|
width: 28px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as z}from"./vendor-react-CUXIiAnY.js";import{j as k,a6 as ce,ak as T,Q as Me,cB as Pe,T as te,W as J,b6 as Ne,a5 as Fe,bD as ze,aX as Je,at as ke,U as Be,b1 as ie,z as Ue,A as Ve,cC as Se,bg as Y,a3 as V,cD as We,am as ge,bf as ye}from"./vendor-mui-core-___CiWHn.js";import{_ as re,ac as Ke,v as Re,e as He,X as Ge,b9 as Ze,o as Ye,b4 as Qe,c as Xe,aS as be,B as Oe,a0 as Ae,Y as Z,ba as et}from"./index-
|
|
1
|
+
import{r as z}from"./vendor-react-CUXIiAnY.js";import{j as k,a6 as ce,ak as T,Q as Me,cB as Pe,T as te,W as J,b6 as Ne,a5 as Fe,bD as ze,aX as Je,at as ke,U as Be,b1 as ie,z as Ue,A as Ve,cC as Se,bg as Y,a3 as V,cD as We,am as ge,bf as ye}from"./vendor-mui-core-___CiWHn.js";import{_ as re,ac as Ke,v as Re,e as He,X as Ge,b9 as Ze,o as Ye,b4 as Qe,c as Xe,aS as be,B as Oe,a0 as Ae,Y as Z,ba as et}from"./index-CK2ZwMoB.js";import{w as ue,P as tt}from"./permission-CFZyPM8U.js";import{V as le,n as G,H as W,b as Ee,a5 as rt,a6 as st,O as nt,x as H,e as ve,p as at}from"./vendor-ux-pxYpYMxD.js";import{l as Ce}from"./vendor-hooks-L8kZVRUL.js";import{C as me}from"./confirm-CvbX7Jj-.js";import{f as oe}from"./index-DBs9Ljax.js";import{u as it}from"./useSetState-cWrp7qoX.js";import{u as De}from"./session-DkvXxWtg.js";import{S as U}from"./section-DDyoFT-o.js";import{C as ot}from"./click-to-copy-BiDS_MtA.js";import{u as Ie}from"./team-zaYl7mkh.js";import{v as lt,U as ct}from"./vendor-utils-Doa0RxLS.js";import{v as ut}from"./index-0wVxGFHL.js";import{W as ft}from"./did-address-BKqL0vbP.js";import{V as dt}from"./status-De4_OTsm.js";import{F as _e}from"./form-text-input-gTokKFc6.js";import"./vendor-arcblock-DBEMYjVA.js";import"./lottie-web-4koyQiv_.js";import"./required-BuZo1JHj.js";import"./isURL-DI8OpvEf.js";import"./use-app-logo-RgeQYsuM.js";import"./omit-CPVfFmp-.js";import"./form-wrapper-BxqO_YSO.js";import"./edit.svg-Dz9cVo7r.js";const mt=localStorage.getItem("enableDebug")==="true";function ht({teamDid:$,size:q="small",...P}){const{t:C}=le(),{api:j}=re(),[w,p]=z.useState(!1),[o,g]=z.useState(null),m=()=>{p(!1),g(null)},f=async()=>{try{p(!0);const a=await j.clearCache({input:{teamDid:$}});W.success(C("blocklet.config.clearCache.success",{count:a.removed?.length||0}))}catch(a){W.error(oe(a))}finally{p(!1),g(null)}},e={title:C("blocklet.config.clearCache.title"),description:C("blocklet.config.clearCache.description"),confirm:C("common.confirm"),cancel:C("common.cancel"),onConfirm:f,onCancel:m};return k.jsxs("div",{...P,children:[k.jsxs(G,{onClick:()=>g(e),color:"error",variant:"outlined",size:q,children:[w?k.jsx(ce,{size:16,style:{marginRight:5}}):null,C("blocklet.config.clearCache.action")]}),o&&k.jsx(me,{title:o.title,description:o.description,confirm:o.confirm,cancel:o.cancel,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}function Te({onChange:$=()=>{},disabled:q=!1,loading:P=!1,inService:C=!1}){const{t:j}=le(),{api:w,session:p}=De(),{blocklet:o}=Ke(),[g,m]=it({newAppSk:"",isConnectOpen:!1,confirmDialogOpen:!1}),f=()=>m({isConnectOpen:!1}),e=()=>{if(He.isInProgress(o.status)){W.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(Me,{style:{flexShrink:0},variant:"contained",color:"primary",size:"small","data-cy":"config-did",disabled:q||P,onClick:e,children:[k.jsx(Pe,{style:{fontSize:"1.3em",marginRight:4}}),j("blocklet.config.migrate.button")]})})}),k.jsxs(k.Fragment,{children:[g.isConnectOpen&&k.jsx(Re,{popup:!0,open:g.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:w.get,checkTimeout:5*60*1e3,onSuccess:()=>{$(),C&&p.logout(),f()},extraParams:{appDid:o.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(te,{sx:{fontSize:"20px",fontWeight:"500"},children:j("blocklet.config.migrate.title")}),description:k.jsx(te,{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})})]})]})}Te.propTypes={onChange:J.func,disabled:J.bool,loading:J.bool,inService:J.bool};function Le({onCancel:$,onSuccess:q,onError:P=()=>{}}){const{api:C}=z.useContext(Ge),[j,w]=z.useState(!1),{t:p,locale:o}=le(),[g,m]=z.useState(""),[f,e]=z.useState(!1),[a,n]=z.useState(0),[r,t]=z.useState(""),{endpoint:l}=Ie(),[s,i]=z.useState(!1),u=c=>{m(null),w(!0);try{t(c.result),n(_.length-1)}catch(h){const b=oe(h);m(b),P(h)}finally{w(!1)}},d=()=>{e(!0),n(1)},y=()=>{e(!1),n(0)},_=[{body:k.jsxs(T,{children:[k.jsx(te,{children:p("team.transferApp.transferDialog.tips.progress")}),k.jsx(te,{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(Re,{action:"transfer-app-owner",open:f,locale:o,checkFn:C.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=Ze({transferId:r.transferId,endpoint:l});return k.jsxs(k.Fragment,{children:[k.jsx(T,{component:Q,dangerouslySetInnerHTML:{__html:p("team.transferApp.transferDialog.createSuccessTip1")}}),k.jsx(T,{component:Q,sx:{mt:2},children:k.jsx(Q,{children:p("team.transferApp.transferDialog.createSuccessTip3")})}),k.jsxs(T,{children:[k.jsx(T,{component:Q,sx:{mt:2},children:k.jsx(Q,{children:p("team.transferApp.transferDialog.createSuccessTip2",{expireDate:Ye(r.expireDate,o)})})}),k.jsx(T,{sx:{my:1},children:k.jsx(ot,{children:c})})]}),k.jsx("div",{children:k.jsx(Ne,{value:"end",control:k.jsx(Fe,{checked:s,onChange:h=>i(h.target.checked)}),label:p("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:p("common.confirm"),onConfirm:q}],v=_[a];return k.jsxs(Ee,{title:k.jsx(Q,{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(ze,{component:"div",children:typeof v.body=="function"?v.body():v.body}),!!g&&k.jsx(Je,{severity:"error",variant:"icon",children:g})]})}Le.propTypes={onCancel:J.func.isRequired,onSuccess:J.func.isRequired,onError:J.func};const Q=ke.div`
|
|
2
2
|
font-size: 16px;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
&.title {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,ak as d,Q as p,at as x,W as u}from"./vendor-mui-core-___CiWHn.js";import{r as o}from"./vendor-react-CUXIiAnY.js";import{p as g}from"./vendor-ux-pxYpYMxD.js";import{a as h}from"./page-header-bY0dwe6y.js";import{ac as j}from"./index-
|
|
1
|
+
import{j as t,ak as d,Q as p,at as x,W as u}from"./vendor-mui-core-___CiWHn.js";import{r as o}from"./vendor-react-CUXIiAnY.js";import{p as g}from"./vendor-ux-pxYpYMxD.js";import{a as h}from"./page-header-bY0dwe6y.js";import{ac as j}from"./index-CK2ZwMoB.js";import{A as b}from"./config-DCVvdigc.js";import{S as k}from"./step-actions-B3C_rdx7.js";import{S}from"./layout-BLkdV05j.js";import"./vendor-utils-Doa0RxLS.js";import"./vendor-hooks-L8kZVRUL.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DBEMYjVA.js";import"./isURL-DI8OpvEf.js";import"./section-DDyoFT-o.js";import"./required-BuZo1JHj.js";import"./form-wrapper-BxqO_YSO.js";import"./form-text-input-gTokKFc6.js";import"./edit.svg-Dz9cVo7r.js";import"./wait-connect-DUwp6hVe.js";import"./get-safe-url-D0cItynk.js";import"./index-BsA1v5Kx.js";import"./index-DBs9Ljax.js";import"./use-mobile-yOnqxyr6.js";import"./content-layout-DpoiOm37.js";function y({onNext:s=()=>{},onPrevious:l=()=>{}}){const{t:r}=o.useContext(g),{blocklet:e}=j(),i=o.useMemo(()=>e?.meta?.requirements,[e]),n=o.useRef(null),[a,m]=o.useState(!1),f=async()=>{try{m(!0),(await n.current.onSubmit()||!i?.aigne)&&s()}catch(c){console.error("error",c)}finally{m(!1)}};return t.jsxs(C,{children:[t.jsx("div",{className:"header",children:t.jsx(h,{title:r("setting.aigne.config"),onClickBack:l})}),t.jsx(d,{className:"form-container",children:t.jsx(b,{orientation:"vertical",hideSubmitButton:!0,hideDivider:!0,ref:n,source:"setup",forceValidate:i?.aigne})}),t.jsxs(k,{blocklet:e,children:[!i?.aigne&&t.jsx(p,{className:"bottom-button-skip",sx:{mr:1},onClick:()=>s(),children:r("setup.skip")}),t.jsx(p,{className:"start-now bottom-button",loading:a,variant:"contained",disabled:a,onClick:f,children:r("setup.continue")})]})]})}y.propTypes={onNext:u.func,onPrevious:u.func};const C=x(S)`
|
|
2
2
|
height: 100%;
|
|
3
3
|
overflow-y: auto;
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as E,A as k}from"./vendor-utils-Doa0RxLS.js";import{_ as T,ac as j,c as M}from"./index-
|
|
1
|
+
import{C as E,A as k}from"./vendor-utils-Doa0RxLS.js";import{_ as T,ac as j,c as M}from"./index-CK2ZwMoB.js";import{r as e}from"./vendor-react-CUXIiAnY.js";import{V as B}from"./vendor-ux-pxYpYMxD.js";import{u as D}from"./use-mobile-BGG7EyYb.js";import{D as H,j as o,ak as w,a6 as I}from"./vendor-mui-core-___CiWHn.js";import"./vendor-arcblock-DBEMYjVA.js";import"./vendor-hooks-L8kZVRUL.js";import"./lottie-web-4koyQiv_.js";function K(){const{info:x,inService:g}=T(),{blocklet:y}=j(),{locale:u}=B(),f=e.useRef(null),r=H(),[L,R]=e.useState(0),m=D(),[t,S]=e.useState(!0),s=e.useRef(null);let a="";g?a=M.WELLKNOWN_SERVICE_PATH_PREFIX:a=x.routing.adminPath;const c=new URLSearchParams;g?c.set("appUrl",window.location.origin):c.set("authKey","__sst"),c.set("schemaKey",E(window.location.origin,a,`/api/theme?id=${encodeURIComponent(y.meta.did)}`));const l=e.useCallback(()=>{if(s.current){const n=k(JSON.parse(JSON.stringify(r)),["palette","typography","shape","direction","breakpoints","mixins","shadows","transitions","zIndex"]);s.current.contentWindow.postMessage({type:"SEND_THEME",payload:n},window.location.origin)}},[r]),d=e.useCallback(()=>{s.current&&s.current.contentWindow.postMessage({type:"SEND_LOCALE",payload:u},window.location.origin)},[u]);return e.useEffect(()=>{const n=i=>{i.origin===window.location.origin&&(i.data.type==="REQUEST_THEME"&&l(),i.data.type==="THEME_BUILDER_LOADED"&&(d(),S(!1)))};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[l,d]),e.useEffect(()=>{t===!1&&l()},[r,t,l]),e.useEffect(()=>{t===!1&&d()},[u,t,d]),e.useEffect(()=>{const n=document.querySelector("#arc__dashboard-main"),i=document.querySelector(".dashboard-content"),p=()=>{if(f.current){const{height:C}=n.getBoundingClientRect(),{top:_}=i.getBoundingClientRect(),{top:b}=f.current.getBoundingClientRect();let h=C-b+_-(m?108:164);m&&(h=Math.min(h,600)),R(h)}};return p(),window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}},[m,r]),o.jsxs(o.Fragment,{children:[o.jsx(w,{ref:f}),t&&o.jsx(w,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px"},children:o.jsx(I,{})}),o.jsx("iframe",{title:"Theme Builder",ref:s,src:`${E(window.location.origin,a,"/hosted/theme-builder/")}?${c.toString()}`,style:{border:0,width:"100%",height:`${L}px`,display:t?"none":"block"}})]})}export{K as default};
|