@openclaw/line 2026.7.2-beta.4 → 2026.7.2-beta.5
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/README.md +1 -1
- package/dist/{accounts-BUBOoW5Q.js → accounts-CSH5sk8U.js} +9 -11
- package/dist/api.js +2 -2
- package/dist/{card-command-Ch0TwcDW.js → card-command-BEMIm8D8.js} +1 -2
- package/dist/{channel-CNcv74n2.js → channel-CTaWrzfl.js} +9 -9
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-D4Paci2y.js +4 -0
- package/dist/contract-api.js +1 -1
- package/dist/flex-templates-DVy_wog4.js +1341 -0
- package/dist/index.js +1 -1
- package/dist/{markdown-to-line-DWIdzBfy.js → markdown-to-line-Dn00k1bq.js} +27 -12
- package/dist/{monitor-BinAXvIY.js → monitor-DzFU5UPV.js} +43 -55
- package/dist/monitor.runtime-B8xjVqev.js +2 -0
- package/dist/{outbound.runtime-DRyoVa81.js → outbound.runtime-eHl7NNHu.js} +1 -1
- package/dist/{probe-BslD77tJ.js → probe-CM03wo6r.js} +7 -9
- package/dist/probe.runtime-D13ZtXsd.js +2 -0
- package/dist/{reply-payload-transform-d57WYHFm.js → reply-payload-transform-BRM2fRvK.js} +1 -1
- package/dist/runtime-api.js +7 -8
- package/dist/setup-api.js +1 -1
- package/dist/{setup-surface-Bili5gWy.js → setup-surface-BHQOSD8R.js} +45 -63
- package/package.json +4 -5
- package/dist/basic-cards-Rb-Ow7LN.js +0 -307
- package/dist/channel.runtime-BBCZvRa_.js +0 -4
- package/dist/flex-templates-KiKaVYgi.js +0 -813
- package/dist/monitor.runtime-DKj4FHkA.js +0 -2
- package/dist/probe.runtime-CRhVGqwl.js +0 -2
- package/npm-shrinkwrap.json +0 -60
|
@@ -1,813 +0,0 @@
|
|
|
1
|
-
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
2
|
-
//#region extensions/line/src/flex-templates/common.ts
|
|
3
|
-
function attachFooterText(bubble, footer) {
|
|
4
|
-
bubble.footer = {
|
|
5
|
-
type: "box",
|
|
6
|
-
layout: "vertical",
|
|
7
|
-
contents: [{
|
|
8
|
-
type: "text",
|
|
9
|
-
text: footer,
|
|
10
|
-
size: "xs",
|
|
11
|
-
color: "#AAAAAA",
|
|
12
|
-
wrap: true,
|
|
13
|
-
align: "center"
|
|
14
|
-
}],
|
|
15
|
-
paddingAll: "lg",
|
|
16
|
-
backgroundColor: "#FAFAFA"
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region extensions/line/src/flex-templates/schedule-cards.ts
|
|
21
|
-
function buildTitleSubtitleHeader(params) {
|
|
22
|
-
const { title, subtitle } = params;
|
|
23
|
-
const headerContents = [{
|
|
24
|
-
type: "text",
|
|
25
|
-
text: title,
|
|
26
|
-
weight: "bold",
|
|
27
|
-
size: "xl",
|
|
28
|
-
color: "#111111",
|
|
29
|
-
wrap: true
|
|
30
|
-
}];
|
|
31
|
-
if (subtitle) headerContents.push({
|
|
32
|
-
type: "text",
|
|
33
|
-
text: subtitle,
|
|
34
|
-
size: "sm",
|
|
35
|
-
color: "#888888",
|
|
36
|
-
margin: "sm",
|
|
37
|
-
wrap: true
|
|
38
|
-
});
|
|
39
|
-
return headerContents;
|
|
40
|
-
}
|
|
41
|
-
function buildCardHeaderSections(headerContents) {
|
|
42
|
-
return [{
|
|
43
|
-
type: "box",
|
|
44
|
-
layout: "vertical",
|
|
45
|
-
contents: headerContents,
|
|
46
|
-
paddingBottom: "lg"
|
|
47
|
-
}, {
|
|
48
|
-
type: "separator",
|
|
49
|
-
color: "#EEEEEE"
|
|
50
|
-
}];
|
|
51
|
-
}
|
|
52
|
-
function createMegaBubbleWithFooter(params) {
|
|
53
|
-
const bubble = {
|
|
54
|
-
type: "bubble",
|
|
55
|
-
size: "mega",
|
|
56
|
-
body: {
|
|
57
|
-
type: "box",
|
|
58
|
-
layout: "vertical",
|
|
59
|
-
contents: params.bodyContents,
|
|
60
|
-
paddingAll: "xl",
|
|
61
|
-
backgroundColor: "#FFFFFF"
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
if (params.footer) attachFooterText(bubble, params.footer);
|
|
65
|
-
return bubble;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Create a receipt/summary card (for orders, transactions, data tables)
|
|
69
|
-
*
|
|
70
|
-
* Editorial design: Clean table layout with alternating row backgrounds,
|
|
71
|
-
* prominent total section, and clear visual hierarchy.
|
|
72
|
-
*/
|
|
73
|
-
function createReceiptCard(params) {
|
|
74
|
-
const { title, subtitle, items, total, footer } = params;
|
|
75
|
-
const itemRows = items.slice(0, 12).map((item, index) => ({
|
|
76
|
-
type: "box",
|
|
77
|
-
layout: "horizontal",
|
|
78
|
-
contents: [{
|
|
79
|
-
type: "text",
|
|
80
|
-
text: item.name,
|
|
81
|
-
size: "sm",
|
|
82
|
-
color: item.highlight ? "#111111" : "#666666",
|
|
83
|
-
weight: item.highlight ? "bold" : "regular",
|
|
84
|
-
flex: 3,
|
|
85
|
-
wrap: true
|
|
86
|
-
}, {
|
|
87
|
-
type: "text",
|
|
88
|
-
text: item.value,
|
|
89
|
-
size: "sm",
|
|
90
|
-
color: item.highlight ? "#06C755" : "#333333",
|
|
91
|
-
weight: item.highlight ? "bold" : "regular",
|
|
92
|
-
flex: 2,
|
|
93
|
-
align: "end",
|
|
94
|
-
wrap: true
|
|
95
|
-
}],
|
|
96
|
-
paddingAll: "md",
|
|
97
|
-
backgroundColor: index % 2 === 0 ? "#FFFFFF" : "#FAFAFA"
|
|
98
|
-
}));
|
|
99
|
-
const bodyContents = [...buildCardHeaderSections(buildTitleSubtitleHeader({
|
|
100
|
-
title,
|
|
101
|
-
subtitle
|
|
102
|
-
})), {
|
|
103
|
-
type: "box",
|
|
104
|
-
layout: "vertical",
|
|
105
|
-
contents: itemRows,
|
|
106
|
-
margin: "md",
|
|
107
|
-
cornerRadius: "md",
|
|
108
|
-
borderWidth: "light",
|
|
109
|
-
borderColor: "#EEEEEE"
|
|
110
|
-
}];
|
|
111
|
-
if (total) bodyContents.push({
|
|
112
|
-
type: "box",
|
|
113
|
-
layout: "horizontal",
|
|
114
|
-
contents: [{
|
|
115
|
-
type: "text",
|
|
116
|
-
text: total.label,
|
|
117
|
-
size: "lg",
|
|
118
|
-
weight: "bold",
|
|
119
|
-
color: "#111111",
|
|
120
|
-
flex: 2
|
|
121
|
-
}, {
|
|
122
|
-
type: "text",
|
|
123
|
-
text: total.value,
|
|
124
|
-
size: "xl",
|
|
125
|
-
weight: "bold",
|
|
126
|
-
color: "#06C755",
|
|
127
|
-
flex: 2,
|
|
128
|
-
align: "end"
|
|
129
|
-
}],
|
|
130
|
-
margin: "xl",
|
|
131
|
-
paddingAll: "lg",
|
|
132
|
-
backgroundColor: "#F0FDF4",
|
|
133
|
-
cornerRadius: "lg"
|
|
134
|
-
});
|
|
135
|
-
return createMegaBubbleWithFooter({
|
|
136
|
-
bodyContents,
|
|
137
|
-
footer
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Create a calendar event card (for meetings, appointments, reminders)
|
|
142
|
-
*
|
|
143
|
-
* Editorial design: Date as hero, strong typographic hierarchy,
|
|
144
|
-
* color-blocked zones, full text wrapping for readability.
|
|
145
|
-
*/
|
|
146
|
-
function createEventCard(params) {
|
|
147
|
-
const { title, date, time, location, description, calendar, isAllDay, action } = params;
|
|
148
|
-
const dateBlock = {
|
|
149
|
-
type: "box",
|
|
150
|
-
layout: "vertical",
|
|
151
|
-
contents: [{
|
|
152
|
-
type: "text",
|
|
153
|
-
text: date.toUpperCase(),
|
|
154
|
-
size: "sm",
|
|
155
|
-
weight: "bold",
|
|
156
|
-
color: "#06C755",
|
|
157
|
-
wrap: true
|
|
158
|
-
}, {
|
|
159
|
-
type: "text",
|
|
160
|
-
text: isAllDay ? "ALL DAY" : time ?? "",
|
|
161
|
-
size: "xxl",
|
|
162
|
-
weight: "bold",
|
|
163
|
-
color: "#111111",
|
|
164
|
-
wrap: true,
|
|
165
|
-
margin: "xs"
|
|
166
|
-
}],
|
|
167
|
-
paddingBottom: "lg",
|
|
168
|
-
borderWidth: "none"
|
|
169
|
-
};
|
|
170
|
-
if (!time && !isAllDay) dateBlock.contents = [{
|
|
171
|
-
type: "text",
|
|
172
|
-
text: date,
|
|
173
|
-
size: "xl",
|
|
174
|
-
weight: "bold",
|
|
175
|
-
color: "#111111",
|
|
176
|
-
wrap: true
|
|
177
|
-
}];
|
|
178
|
-
const bodyContents = [dateBlock, {
|
|
179
|
-
type: "box",
|
|
180
|
-
layout: "horizontal",
|
|
181
|
-
contents: [{
|
|
182
|
-
type: "box",
|
|
183
|
-
layout: "vertical",
|
|
184
|
-
contents: [],
|
|
185
|
-
width: "4px",
|
|
186
|
-
backgroundColor: "#06C755",
|
|
187
|
-
cornerRadius: "2px"
|
|
188
|
-
}, {
|
|
189
|
-
type: "box",
|
|
190
|
-
layout: "vertical",
|
|
191
|
-
contents: [{
|
|
192
|
-
type: "text",
|
|
193
|
-
text: title,
|
|
194
|
-
size: "lg",
|
|
195
|
-
weight: "bold",
|
|
196
|
-
color: "#1a1a1a",
|
|
197
|
-
wrap: true
|
|
198
|
-
}, ...calendar ? [{
|
|
199
|
-
type: "text",
|
|
200
|
-
text: calendar,
|
|
201
|
-
size: "xs",
|
|
202
|
-
color: "#888888",
|
|
203
|
-
margin: "sm",
|
|
204
|
-
wrap: true
|
|
205
|
-
}] : []],
|
|
206
|
-
flex: 1,
|
|
207
|
-
paddingStart: "lg"
|
|
208
|
-
}],
|
|
209
|
-
paddingTop: "lg",
|
|
210
|
-
paddingBottom: "lg",
|
|
211
|
-
borderWidth: "light",
|
|
212
|
-
borderColor: "#EEEEEE"
|
|
213
|
-
}];
|
|
214
|
-
if (location || description) {
|
|
215
|
-
const detailItems = [];
|
|
216
|
-
if (location) detailItems.push({
|
|
217
|
-
type: "box",
|
|
218
|
-
layout: "horizontal",
|
|
219
|
-
contents: [{
|
|
220
|
-
type: "text",
|
|
221
|
-
text: "📍",
|
|
222
|
-
size: "sm",
|
|
223
|
-
flex: 0
|
|
224
|
-
}, {
|
|
225
|
-
type: "text",
|
|
226
|
-
text: location,
|
|
227
|
-
size: "sm",
|
|
228
|
-
color: "#444444",
|
|
229
|
-
margin: "md",
|
|
230
|
-
flex: 1,
|
|
231
|
-
wrap: true
|
|
232
|
-
}],
|
|
233
|
-
alignItems: "flex-start"
|
|
234
|
-
});
|
|
235
|
-
if (description) detailItems.push({
|
|
236
|
-
type: "text",
|
|
237
|
-
text: description,
|
|
238
|
-
size: "sm",
|
|
239
|
-
color: "#666666",
|
|
240
|
-
wrap: true,
|
|
241
|
-
margin: location ? "lg" : "none"
|
|
242
|
-
});
|
|
243
|
-
bodyContents.push({
|
|
244
|
-
type: "box",
|
|
245
|
-
layout: "vertical",
|
|
246
|
-
contents: detailItems,
|
|
247
|
-
margin: "lg",
|
|
248
|
-
paddingAll: "lg",
|
|
249
|
-
backgroundColor: "#F8F9FA",
|
|
250
|
-
cornerRadius: "lg"
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
return {
|
|
254
|
-
type: "bubble",
|
|
255
|
-
size: "mega",
|
|
256
|
-
body: {
|
|
257
|
-
type: "box",
|
|
258
|
-
layout: "vertical",
|
|
259
|
-
contents: bodyContents,
|
|
260
|
-
paddingAll: "xl",
|
|
261
|
-
backgroundColor: "#FFFFFF",
|
|
262
|
-
action
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Create a calendar agenda card showing multiple events
|
|
268
|
-
*
|
|
269
|
-
* Editorial timeline design: Time-focused left column with event details
|
|
270
|
-
* on the right. Visual accent bars indicate event priority/recency.
|
|
271
|
-
*/
|
|
272
|
-
function createAgendaCard(params) {
|
|
273
|
-
const { title, subtitle, events, footer } = params;
|
|
274
|
-
const headerContents = buildTitleSubtitleHeader({
|
|
275
|
-
title,
|
|
276
|
-
subtitle
|
|
277
|
-
});
|
|
278
|
-
const eventItems = events.slice(0, 6).map((event, index) => {
|
|
279
|
-
const isActive = event.isNow || index === 0;
|
|
280
|
-
const accentColor = isActive ? "#06C755" : "#E5E5E5";
|
|
281
|
-
const timeColumn = {
|
|
282
|
-
type: "box",
|
|
283
|
-
layout: "vertical",
|
|
284
|
-
contents: [{
|
|
285
|
-
type: "text",
|
|
286
|
-
text: event.time ?? "—",
|
|
287
|
-
size: "sm",
|
|
288
|
-
weight: isActive ? "bold" : "regular",
|
|
289
|
-
color: isActive ? "#06C755" : "#666666",
|
|
290
|
-
align: "end",
|
|
291
|
-
wrap: true
|
|
292
|
-
}],
|
|
293
|
-
width: "65px",
|
|
294
|
-
justifyContent: "flex-start"
|
|
295
|
-
};
|
|
296
|
-
const dotColumn = {
|
|
297
|
-
type: "box",
|
|
298
|
-
layout: "vertical",
|
|
299
|
-
contents: [{
|
|
300
|
-
type: "box",
|
|
301
|
-
layout: "vertical",
|
|
302
|
-
contents: [],
|
|
303
|
-
width: "10px",
|
|
304
|
-
height: "10px",
|
|
305
|
-
backgroundColor: accentColor,
|
|
306
|
-
cornerRadius: "5px"
|
|
307
|
-
}],
|
|
308
|
-
width: "24px",
|
|
309
|
-
alignItems: "center",
|
|
310
|
-
justifyContent: "flex-start",
|
|
311
|
-
paddingTop: "xs"
|
|
312
|
-
};
|
|
313
|
-
const detailContents = [{
|
|
314
|
-
type: "text",
|
|
315
|
-
text: event.title,
|
|
316
|
-
size: "md",
|
|
317
|
-
weight: "bold",
|
|
318
|
-
color: "#1a1a1a",
|
|
319
|
-
wrap: true
|
|
320
|
-
}];
|
|
321
|
-
const secondaryParts = [];
|
|
322
|
-
if (event.location) secondaryParts.push(event.location);
|
|
323
|
-
if (event.calendar) secondaryParts.push(event.calendar);
|
|
324
|
-
if (secondaryParts.length > 0) detailContents.push({
|
|
325
|
-
type: "text",
|
|
326
|
-
text: secondaryParts.join(" · "),
|
|
327
|
-
size: "xs",
|
|
328
|
-
color: "#888888",
|
|
329
|
-
wrap: true,
|
|
330
|
-
margin: "xs"
|
|
331
|
-
});
|
|
332
|
-
return {
|
|
333
|
-
type: "box",
|
|
334
|
-
layout: "horizontal",
|
|
335
|
-
contents: [
|
|
336
|
-
timeColumn,
|
|
337
|
-
dotColumn,
|
|
338
|
-
{
|
|
339
|
-
type: "box",
|
|
340
|
-
layout: "vertical",
|
|
341
|
-
contents: detailContents,
|
|
342
|
-
flex: 1
|
|
343
|
-
}
|
|
344
|
-
],
|
|
345
|
-
margin: index > 0 ? "xl" : void 0,
|
|
346
|
-
alignItems: "flex-start"
|
|
347
|
-
};
|
|
348
|
-
});
|
|
349
|
-
return createMegaBubbleWithFooter({
|
|
350
|
-
bodyContents: [...buildCardHeaderSections(headerContents), {
|
|
351
|
-
type: "box",
|
|
352
|
-
layout: "vertical",
|
|
353
|
-
contents: eventItems,
|
|
354
|
-
paddingTop: "xl"
|
|
355
|
-
}],
|
|
356
|
-
footer
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
//#endregion
|
|
360
|
-
//#region extensions/line/src/actions.ts
|
|
361
|
-
const LINE_ACTION_LABEL_LIMIT = 20;
|
|
362
|
-
const LINE_ACTION_DATA_LIMIT = 300;
|
|
363
|
-
function truncateLineActionLabel(label, limit = LINE_ACTION_LABEL_LIMIT) {
|
|
364
|
-
return truncateUtf16Safe(label, limit);
|
|
365
|
-
}
|
|
366
|
-
function truncateLineActionData(data) {
|
|
367
|
-
return truncateUtf16Safe(data, LINE_ACTION_DATA_LIMIT);
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Create a message action (sends text when tapped)
|
|
371
|
-
*/
|
|
372
|
-
function messageAction(label, text) {
|
|
373
|
-
return {
|
|
374
|
-
type: "message",
|
|
375
|
-
label: truncateLineActionLabel(label),
|
|
376
|
-
text: text ?? label
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Create a URI action (opens a URL when tapped)
|
|
381
|
-
*/
|
|
382
|
-
function uriAction(label, uri) {
|
|
383
|
-
return {
|
|
384
|
-
type: "uri",
|
|
385
|
-
label: truncateLineActionLabel(label),
|
|
386
|
-
uri
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Create a postback action (sends data to webhook when tapped)
|
|
391
|
-
*/
|
|
392
|
-
function postbackAction(label, data, displayText) {
|
|
393
|
-
return {
|
|
394
|
-
type: "postback",
|
|
395
|
-
label: truncateLineActionLabel(label),
|
|
396
|
-
data: truncateLineActionData(data),
|
|
397
|
-
displayText: displayText === void 0 ? void 0 : truncateLineActionData(displayText)
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Create a datetime picker action
|
|
402
|
-
*/
|
|
403
|
-
function datetimePickerAction(label, data, mode, options) {
|
|
404
|
-
return {
|
|
405
|
-
type: "datetimepicker",
|
|
406
|
-
label: truncateLineActionLabel(label),
|
|
407
|
-
data: truncateLineActionData(data),
|
|
408
|
-
mode,
|
|
409
|
-
initial: options?.initial,
|
|
410
|
-
max: options?.max,
|
|
411
|
-
min: options?.min
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
//#endregion
|
|
415
|
-
//#region extensions/line/src/flex-templates/media-control-cards.ts
|
|
416
|
-
/**
|
|
417
|
-
* Create a media player card for Sonos, Spotify, Apple Music, etc.
|
|
418
|
-
*
|
|
419
|
-
* Editorial design: Album art hero with gradient overlay for text,
|
|
420
|
-
* prominent now-playing indicator, refined playback controls.
|
|
421
|
-
*/
|
|
422
|
-
function createMediaPlayerCard(params) {
|
|
423
|
-
const { title, subtitle, source, imageUrl, isPlaying, progress, controls, extraActions } = params;
|
|
424
|
-
const trackInfo = [{
|
|
425
|
-
type: "text",
|
|
426
|
-
text: title,
|
|
427
|
-
weight: "bold",
|
|
428
|
-
size: "xl",
|
|
429
|
-
color: "#111111",
|
|
430
|
-
wrap: true
|
|
431
|
-
}];
|
|
432
|
-
if (subtitle) trackInfo.push({
|
|
433
|
-
type: "text",
|
|
434
|
-
text: subtitle,
|
|
435
|
-
size: "md",
|
|
436
|
-
color: "#666666",
|
|
437
|
-
wrap: true,
|
|
438
|
-
margin: "sm"
|
|
439
|
-
});
|
|
440
|
-
const statusItems = [];
|
|
441
|
-
if (isPlaying !== void 0) statusItems.push({
|
|
442
|
-
type: "box",
|
|
443
|
-
layout: "horizontal",
|
|
444
|
-
contents: [{
|
|
445
|
-
type: "box",
|
|
446
|
-
layout: "vertical",
|
|
447
|
-
contents: [],
|
|
448
|
-
width: "8px",
|
|
449
|
-
height: "8px",
|
|
450
|
-
backgroundColor: isPlaying ? "#06C755" : "#CCCCCC",
|
|
451
|
-
cornerRadius: "4px"
|
|
452
|
-
}, {
|
|
453
|
-
type: "text",
|
|
454
|
-
text: isPlaying ? "Now Playing" : "Paused",
|
|
455
|
-
size: "xs",
|
|
456
|
-
color: isPlaying ? "#06C755" : "#888888",
|
|
457
|
-
weight: "bold",
|
|
458
|
-
margin: "sm"
|
|
459
|
-
}],
|
|
460
|
-
alignItems: "center"
|
|
461
|
-
});
|
|
462
|
-
if (source) statusItems.push({
|
|
463
|
-
type: "text",
|
|
464
|
-
text: source,
|
|
465
|
-
size: "xs",
|
|
466
|
-
color: "#AAAAAA",
|
|
467
|
-
margin: statusItems.length > 0 ? "lg" : void 0
|
|
468
|
-
});
|
|
469
|
-
if (progress) statusItems.push({
|
|
470
|
-
type: "text",
|
|
471
|
-
text: progress,
|
|
472
|
-
size: "xs",
|
|
473
|
-
color: "#888888",
|
|
474
|
-
align: "end",
|
|
475
|
-
flex: 1
|
|
476
|
-
});
|
|
477
|
-
const bodyContents = [{
|
|
478
|
-
type: "box",
|
|
479
|
-
layout: "vertical",
|
|
480
|
-
contents: trackInfo
|
|
481
|
-
}];
|
|
482
|
-
if (statusItems.length > 0) bodyContents.push({
|
|
483
|
-
type: "box",
|
|
484
|
-
layout: "horizontal",
|
|
485
|
-
contents: statusItems,
|
|
486
|
-
margin: "lg",
|
|
487
|
-
alignItems: "center"
|
|
488
|
-
});
|
|
489
|
-
const bubble = {
|
|
490
|
-
type: "bubble",
|
|
491
|
-
size: "mega",
|
|
492
|
-
body: {
|
|
493
|
-
type: "box",
|
|
494
|
-
layout: "vertical",
|
|
495
|
-
contents: bodyContents,
|
|
496
|
-
paddingAll: "xl",
|
|
497
|
-
backgroundColor: "#FFFFFF"
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
|
-
if (imageUrl) bubble.hero = {
|
|
501
|
-
type: "image",
|
|
502
|
-
url: imageUrl,
|
|
503
|
-
size: "full",
|
|
504
|
-
aspectRatio: "1:1",
|
|
505
|
-
aspectMode: "cover"
|
|
506
|
-
};
|
|
507
|
-
if (controls || extraActions?.length) {
|
|
508
|
-
const footerContents = [];
|
|
509
|
-
if (controls) {
|
|
510
|
-
const controlButtons = [];
|
|
511
|
-
if (controls.previous) controlButtons.push({
|
|
512
|
-
type: "button",
|
|
513
|
-
action: {
|
|
514
|
-
type: "postback",
|
|
515
|
-
label: "⏮",
|
|
516
|
-
data: controls.previous.data
|
|
517
|
-
},
|
|
518
|
-
style: "secondary",
|
|
519
|
-
flex: 1,
|
|
520
|
-
height: "sm"
|
|
521
|
-
});
|
|
522
|
-
if (controls.play) controlButtons.push({
|
|
523
|
-
type: "button",
|
|
524
|
-
action: {
|
|
525
|
-
type: "postback",
|
|
526
|
-
label: "▶",
|
|
527
|
-
data: controls.play.data
|
|
528
|
-
},
|
|
529
|
-
style: isPlaying ? "secondary" : "primary",
|
|
530
|
-
flex: 1,
|
|
531
|
-
height: "sm",
|
|
532
|
-
margin: controls.previous ? "md" : void 0
|
|
533
|
-
});
|
|
534
|
-
if (controls.pause) controlButtons.push({
|
|
535
|
-
type: "button",
|
|
536
|
-
action: {
|
|
537
|
-
type: "postback",
|
|
538
|
-
label: "⏸",
|
|
539
|
-
data: controls.pause.data
|
|
540
|
-
},
|
|
541
|
-
style: isPlaying ? "primary" : "secondary",
|
|
542
|
-
flex: 1,
|
|
543
|
-
height: "sm",
|
|
544
|
-
margin: controlButtons.length > 0 ? "md" : void 0
|
|
545
|
-
});
|
|
546
|
-
if (controls.next) controlButtons.push({
|
|
547
|
-
type: "button",
|
|
548
|
-
action: {
|
|
549
|
-
type: "postback",
|
|
550
|
-
label: "⏭",
|
|
551
|
-
data: controls.next.data
|
|
552
|
-
},
|
|
553
|
-
style: "secondary",
|
|
554
|
-
flex: 1,
|
|
555
|
-
height: "sm",
|
|
556
|
-
margin: controlButtons.length > 0 ? "md" : void 0
|
|
557
|
-
});
|
|
558
|
-
if (controlButtons.length > 0) footerContents.push({
|
|
559
|
-
type: "box",
|
|
560
|
-
layout: "horizontal",
|
|
561
|
-
contents: controlButtons
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
if (extraActions?.length) footerContents.push({
|
|
565
|
-
type: "box",
|
|
566
|
-
layout: "horizontal",
|
|
567
|
-
contents: extraActions.slice(0, 2).map((action, index) => ({
|
|
568
|
-
type: "button",
|
|
569
|
-
action: {
|
|
570
|
-
type: "postback",
|
|
571
|
-
label: truncateLineActionLabel(action.label, 15),
|
|
572
|
-
data: action.data
|
|
573
|
-
},
|
|
574
|
-
style: "secondary",
|
|
575
|
-
flex: 1,
|
|
576
|
-
height: "sm",
|
|
577
|
-
margin: index > 0 ? "md" : void 0
|
|
578
|
-
})),
|
|
579
|
-
margin: "md"
|
|
580
|
-
});
|
|
581
|
-
if (footerContents.length > 0) bubble.footer = {
|
|
582
|
-
type: "box",
|
|
583
|
-
layout: "vertical",
|
|
584
|
-
contents: footerContents,
|
|
585
|
-
paddingAll: "lg",
|
|
586
|
-
backgroundColor: "#FAFAFA"
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
|
-
return bubble;
|
|
590
|
-
}
|
|
591
|
-
/**
|
|
592
|
-
* Create an Apple TV remote card with a D-pad and control rows.
|
|
593
|
-
*/
|
|
594
|
-
function createAppleTvRemoteCard(params) {
|
|
595
|
-
const { deviceName, status, actionData } = params;
|
|
596
|
-
const headerContents = [{
|
|
597
|
-
type: "text",
|
|
598
|
-
text: deviceName,
|
|
599
|
-
weight: "bold",
|
|
600
|
-
size: "xl",
|
|
601
|
-
color: "#111111",
|
|
602
|
-
wrap: true
|
|
603
|
-
}];
|
|
604
|
-
if (status) headerContents.push({
|
|
605
|
-
type: "text",
|
|
606
|
-
text: status,
|
|
607
|
-
size: "sm",
|
|
608
|
-
color: "#666666",
|
|
609
|
-
wrap: true,
|
|
610
|
-
margin: "sm"
|
|
611
|
-
});
|
|
612
|
-
const makeButton = (label, data, style = "secondary") => ({
|
|
613
|
-
type: "button",
|
|
614
|
-
action: {
|
|
615
|
-
type: "postback",
|
|
616
|
-
label,
|
|
617
|
-
data
|
|
618
|
-
},
|
|
619
|
-
style,
|
|
620
|
-
height: "sm",
|
|
621
|
-
flex: 1
|
|
622
|
-
});
|
|
623
|
-
const dpadRows = [
|
|
624
|
-
{
|
|
625
|
-
type: "box",
|
|
626
|
-
layout: "horizontal",
|
|
627
|
-
contents: [
|
|
628
|
-
{ type: "filler" },
|
|
629
|
-
makeButton("↑", actionData.up),
|
|
630
|
-
{ type: "filler" }
|
|
631
|
-
]
|
|
632
|
-
},
|
|
633
|
-
{
|
|
634
|
-
type: "box",
|
|
635
|
-
layout: "horizontal",
|
|
636
|
-
contents: [
|
|
637
|
-
makeButton("←", actionData.left),
|
|
638
|
-
makeButton("OK", actionData.select, "primary"),
|
|
639
|
-
makeButton("→", actionData.right)
|
|
640
|
-
],
|
|
641
|
-
margin: "md"
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
type: "box",
|
|
645
|
-
layout: "horizontal",
|
|
646
|
-
contents: [
|
|
647
|
-
{ type: "filler" },
|
|
648
|
-
makeButton("↓", actionData.down),
|
|
649
|
-
{ type: "filler" }
|
|
650
|
-
],
|
|
651
|
-
margin: "md"
|
|
652
|
-
}
|
|
653
|
-
];
|
|
654
|
-
const menuRow = {
|
|
655
|
-
type: "box",
|
|
656
|
-
layout: "horizontal",
|
|
657
|
-
contents: [makeButton("Menu", actionData.menu), makeButton("Home", actionData.home)],
|
|
658
|
-
margin: "lg"
|
|
659
|
-
};
|
|
660
|
-
const playbackRow = {
|
|
661
|
-
type: "box",
|
|
662
|
-
layout: "horizontal",
|
|
663
|
-
contents: [makeButton("Play", actionData.play), makeButton("Pause", actionData.pause)],
|
|
664
|
-
margin: "md"
|
|
665
|
-
};
|
|
666
|
-
const volumeRow = {
|
|
667
|
-
type: "box",
|
|
668
|
-
layout: "horizontal",
|
|
669
|
-
contents: [
|
|
670
|
-
makeButton("Vol +", actionData.volumeUp),
|
|
671
|
-
makeButton("Mute", actionData.mute),
|
|
672
|
-
makeButton("Vol -", actionData.volumeDown)
|
|
673
|
-
],
|
|
674
|
-
margin: "md"
|
|
675
|
-
};
|
|
676
|
-
return {
|
|
677
|
-
type: "bubble",
|
|
678
|
-
size: "mega",
|
|
679
|
-
body: {
|
|
680
|
-
type: "box",
|
|
681
|
-
layout: "vertical",
|
|
682
|
-
contents: [
|
|
683
|
-
{
|
|
684
|
-
type: "box",
|
|
685
|
-
layout: "vertical",
|
|
686
|
-
contents: headerContents
|
|
687
|
-
},
|
|
688
|
-
{
|
|
689
|
-
type: "separator",
|
|
690
|
-
margin: "lg",
|
|
691
|
-
color: "#EEEEEE"
|
|
692
|
-
},
|
|
693
|
-
...dpadRows,
|
|
694
|
-
menuRow,
|
|
695
|
-
playbackRow,
|
|
696
|
-
volumeRow
|
|
697
|
-
],
|
|
698
|
-
paddingAll: "xl",
|
|
699
|
-
backgroundColor: "#FFFFFF"
|
|
700
|
-
}
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
/**
|
|
704
|
-
* Create a device control card for Apple TV, smart home devices, etc.
|
|
705
|
-
*
|
|
706
|
-
* Editorial design: Device-focused header with status indicator,
|
|
707
|
-
* clean control grid with clear visual hierarchy.
|
|
708
|
-
*/
|
|
709
|
-
function createDeviceControlCard(params) {
|
|
710
|
-
const { deviceName, deviceType, status, isOnline, imageUrl, controls } = params;
|
|
711
|
-
const headerContents = [{
|
|
712
|
-
type: "box",
|
|
713
|
-
layout: "horizontal",
|
|
714
|
-
contents: [{
|
|
715
|
-
type: "box",
|
|
716
|
-
layout: "vertical",
|
|
717
|
-
contents: [],
|
|
718
|
-
width: "10px",
|
|
719
|
-
height: "10px",
|
|
720
|
-
backgroundColor: isOnline !== false ? "#06C755" : "#FF5555",
|
|
721
|
-
cornerRadius: "5px"
|
|
722
|
-
}, {
|
|
723
|
-
type: "text",
|
|
724
|
-
text: deviceName,
|
|
725
|
-
weight: "bold",
|
|
726
|
-
size: "xl",
|
|
727
|
-
color: "#111111",
|
|
728
|
-
wrap: true,
|
|
729
|
-
flex: 1,
|
|
730
|
-
margin: "md"
|
|
731
|
-
}],
|
|
732
|
-
alignItems: "center"
|
|
733
|
-
}];
|
|
734
|
-
if (deviceType) headerContents.push({
|
|
735
|
-
type: "text",
|
|
736
|
-
text: deviceType,
|
|
737
|
-
size: "sm",
|
|
738
|
-
color: "#888888",
|
|
739
|
-
margin: "sm"
|
|
740
|
-
});
|
|
741
|
-
if (status) headerContents.push({
|
|
742
|
-
type: "box",
|
|
743
|
-
layout: "vertical",
|
|
744
|
-
contents: [{
|
|
745
|
-
type: "text",
|
|
746
|
-
text: status,
|
|
747
|
-
size: "sm",
|
|
748
|
-
color: "#444444",
|
|
749
|
-
wrap: true
|
|
750
|
-
}],
|
|
751
|
-
margin: "lg",
|
|
752
|
-
paddingAll: "md",
|
|
753
|
-
backgroundColor: "#F8F9FA",
|
|
754
|
-
cornerRadius: "md"
|
|
755
|
-
});
|
|
756
|
-
const bubble = {
|
|
757
|
-
type: "bubble",
|
|
758
|
-
size: "mega",
|
|
759
|
-
body: {
|
|
760
|
-
type: "box",
|
|
761
|
-
layout: "vertical",
|
|
762
|
-
contents: headerContents,
|
|
763
|
-
paddingAll: "xl",
|
|
764
|
-
backgroundColor: "#FFFFFF"
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
if (imageUrl) bubble.hero = {
|
|
768
|
-
type: "image",
|
|
769
|
-
url: imageUrl,
|
|
770
|
-
size: "full",
|
|
771
|
-
aspectRatio: "16:9",
|
|
772
|
-
aspectMode: "cover"
|
|
773
|
-
};
|
|
774
|
-
if (controls.length > 0) {
|
|
775
|
-
const rows = [];
|
|
776
|
-
const limitedControls = controls.slice(0, 6);
|
|
777
|
-
for (let i = 0; i < limitedControls.length; i += 2) {
|
|
778
|
-
const rowButtons = [];
|
|
779
|
-
for (const [offset, ctrl] of limitedControls.slice(i, i + 2).entries()) {
|
|
780
|
-
const buttonLabel = ctrl.icon ? `${ctrl.icon} ${ctrl.label}` : ctrl.label;
|
|
781
|
-
rowButtons.push({
|
|
782
|
-
type: "button",
|
|
783
|
-
action: {
|
|
784
|
-
type: "postback",
|
|
785
|
-
label: truncateLineActionLabel(buttonLabel, 18),
|
|
786
|
-
data: ctrl.data
|
|
787
|
-
},
|
|
788
|
-
style: ctrl.style ?? "secondary",
|
|
789
|
-
flex: 1,
|
|
790
|
-
height: "sm",
|
|
791
|
-
margin: offset > 0 ? "md" : void 0
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
if (rowButtons.length === 1) rowButtons.push({ type: "filler" });
|
|
795
|
-
rows.push({
|
|
796
|
-
type: "box",
|
|
797
|
-
layout: "horizontal",
|
|
798
|
-
contents: rowButtons,
|
|
799
|
-
margin: i > 0 ? "md" : void 0
|
|
800
|
-
});
|
|
801
|
-
}
|
|
802
|
-
bubble.footer = {
|
|
803
|
-
type: "box",
|
|
804
|
-
layout: "vertical",
|
|
805
|
-
contents: rows,
|
|
806
|
-
paddingAll: "lg",
|
|
807
|
-
backgroundColor: "#FAFAFA"
|
|
808
|
-
};
|
|
809
|
-
}
|
|
810
|
-
return bubble;
|
|
811
|
-
}
|
|
812
|
-
//#endregion
|
|
813
|
-
export { messageAction as a, createAgendaCard as c, attachFooterText as d, datetimePickerAction as i, createEventCard as l, createDeviceControlCard as n, postbackAction as o, createMediaPlayerCard as r, uriAction as s, createAppleTvRemoteCard as t, createReceiptCard as u };
|