@kodelyth/line 2026.5.39 → 2026.5.42
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.ts +11 -0
- package/channel-plugin-api.ts +1 -0
- package/contract-api.ts +5 -0
- package/dist/accounts-CD4A1FE7.js +105 -0
- package/dist/api.js +11 -0
- package/dist/basic-cards-BISytiSa.js +307 -0
- package/dist/card-command-dQBX3fVN.js +240 -0
- package/dist/channel-DV5h44-j.js +649 -0
- package/dist/channel-plugin-api.js +2 -0
- package/dist/channel.runtime-Cc-v3szZ.js +4 -0
- package/dist/contract-api.js +2 -0
- package/dist/index.js +45 -0
- package/dist/markdown-to-line-CC3BU6CC.js +810 -0
- package/dist/monitor-Ci8Hg8ay.js +1485 -0
- package/dist/monitor.runtime-t6-QvlDB.js +2 -0
- package/dist/outbound.runtime-D1CxEvcL.js +2 -0
- package/dist/probe-BPSs_A_8.js +30 -0
- package/dist/probe.runtime-7u2o9QN5.js +2 -0
- package/dist/reply-payload-transform-CDuBzoT4.js +855 -0
- package/dist/runtime-api.js +291 -0
- package/dist/schedule-cards-D-yZMHDE.js +359 -0
- package/dist/secret-contract-api.js +5 -0
- package/dist/setup-api.js +2 -0
- package/dist/setup-entry.js +11 -0
- package/dist/setup-surface-CHfQ6Z4i.js +282 -0
- package/index.ts +53 -0
- package/klaw.plugin.json +2 -329
- package/package.json +4 -4
- package/runtime-api.ts +179 -0
- package/secret-contract-api.ts +4 -0
- package/setup-api.ts +2 -0
- package/setup-entry.ts +9 -0
- package/src/account-helpers.ts +16 -0
- package/src/accounts.test.ts +288 -0
- package/src/accounts.ts +187 -0
- package/src/actions.ts +61 -0
- package/src/auto-reply-delivery.test.ts +253 -0
- package/src/auto-reply-delivery.ts +200 -0
- package/src/bindings.ts +65 -0
- package/src/bot-access.ts +30 -0
- package/src/bot-handlers.test.ts +1094 -0
- package/src/bot-handlers.ts +620 -0
- package/src/bot-message-context.test.ts +420 -0
- package/src/bot-message-context.ts +586 -0
- package/src/bot.ts +66 -0
- package/src/card-command.ts +347 -0
- package/src/channel-access-token.ts +14 -0
- package/src/channel-api.ts +17 -0
- package/src/channel-setup-status.contract.test.ts +70 -0
- package/src/channel-shared.ts +48 -0
- package/src/channel.logout.test.ts +145 -0
- package/src/channel.runtime.ts +3 -0
- package/src/channel.sendPayload.test.ts +659 -0
- package/src/channel.setup.ts +11 -0
- package/src/channel.status.test.ts +63 -0
- package/src/channel.ts +155 -0
- package/src/config-adapter.ts +29 -0
- package/src/config-schema.test.ts +53 -0
- package/src/config-schema.ts +81 -0
- package/src/download.test.ts +164 -0
- package/src/download.ts +34 -0
- package/src/flex-templates/basic-cards.ts +395 -0
- package/src/flex-templates/common.ts +20 -0
- package/src/flex-templates/media-control-cards.ts +555 -0
- package/src/flex-templates/message.ts +13 -0
- package/src/flex-templates/schedule-cards.ts +467 -0
- package/src/flex-templates/types.ts +22 -0
- package/src/flex-templates.ts +32 -0
- package/src/gateway.ts +129 -0
- package/src/group-keys.test.ts +123 -0
- package/src/group-keys.ts +65 -0
- package/src/group-policy.ts +22 -0
- package/src/markdown-to-line.test.ts +348 -0
- package/src/markdown-to-line.ts +416 -0
- package/src/message-cards.test.ts +204 -0
- package/src/monitor-durable.test.ts +57 -0
- package/src/monitor-durable.ts +37 -0
- package/src/monitor.lifecycle.test.ts +499 -0
- package/src/monitor.runtime.ts +1 -0
- package/src/monitor.ts +507 -0
- package/src/outbound-media.test.ts +194 -0
- package/src/outbound-media.ts +120 -0
- package/src/outbound.runtime.ts +12 -0
- package/src/outbound.ts +427 -0
- package/src/probe.contract.test.ts +9 -0
- package/src/probe.runtime.ts +1 -0
- package/src/probe.ts +34 -0
- package/src/quick-reply-fallback.ts +10 -0
- package/src/reply-chunks.test.ts +180 -0
- package/src/reply-chunks.ts +110 -0
- package/src/reply-payload-transform.test.ts +392 -0
- package/src/reply-payload-transform.ts +317 -0
- package/src/rich-menu.test.ts +315 -0
- package/src/rich-menu.ts +326 -0
- package/src/runtime.ts +32 -0
- package/src/send-receipt.ts +32 -0
- package/src/send.test.ts +453 -0
- package/src/send.ts +531 -0
- package/src/setup-core.ts +149 -0
- package/src/setup-runtime-api.ts +9 -0
- package/src/setup-surface.test.ts +481 -0
- package/src/setup-surface.ts +229 -0
- package/src/signature.test.ts +34 -0
- package/src/signature.ts +24 -0
- package/src/status.ts +37 -0
- package/src/template-messages.ts +333 -0
- package/src/types.ts +130 -0
- package/src/webhook-node.test.ts +598 -0
- package/src/webhook-node.ts +155 -0
- package/src/webhook-utils.ts +10 -0
- package/src/webhook.ts +135 -0
- package/tsconfig.json +16 -0
- package/api.js +0 -7
- package/channel-plugin-api.js +0 -7
- package/contract-api.js +0 -7
- package/index.js +0 -7
- package/runtime-api.js +0 -7
- package/secret-contract-api.js +0 -7
- package/setup-api.js +0 -7
- package/setup-entry.js +0 -7
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { attachFooterText } from "./common.js";
|
|
2
|
+
import type {
|
|
3
|
+
Action,
|
|
4
|
+
CardAction,
|
|
5
|
+
FlexBox,
|
|
6
|
+
FlexBubble,
|
|
7
|
+
FlexButton,
|
|
8
|
+
FlexCarousel,
|
|
9
|
+
FlexComponent,
|
|
10
|
+
FlexImage,
|
|
11
|
+
FlexText,
|
|
12
|
+
ListItem,
|
|
13
|
+
} from "./types.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Create an info card with title, body, and optional footer
|
|
17
|
+
*
|
|
18
|
+
* Editorial design: Clean hierarchy with accent bar, generous spacing,
|
|
19
|
+
* and subtle background zones for visual separation.
|
|
20
|
+
*/
|
|
21
|
+
export function createInfoCard(title: string, body: string, footer?: string): FlexBubble {
|
|
22
|
+
const bubble: FlexBubble = {
|
|
23
|
+
type: "bubble",
|
|
24
|
+
size: "mega",
|
|
25
|
+
body: {
|
|
26
|
+
type: "box",
|
|
27
|
+
layout: "vertical",
|
|
28
|
+
contents: [
|
|
29
|
+
// Title with accent bar
|
|
30
|
+
{
|
|
31
|
+
type: "box",
|
|
32
|
+
layout: "horizontal",
|
|
33
|
+
contents: [
|
|
34
|
+
{
|
|
35
|
+
type: "box",
|
|
36
|
+
layout: "vertical",
|
|
37
|
+
contents: [],
|
|
38
|
+
width: "4px",
|
|
39
|
+
backgroundColor: "#06C755",
|
|
40
|
+
cornerRadius: "2px",
|
|
41
|
+
} as FlexBox,
|
|
42
|
+
{
|
|
43
|
+
type: "text",
|
|
44
|
+
text: title,
|
|
45
|
+
weight: "bold",
|
|
46
|
+
size: "xl",
|
|
47
|
+
color: "#111111",
|
|
48
|
+
wrap: true,
|
|
49
|
+
flex: 1,
|
|
50
|
+
margin: "lg",
|
|
51
|
+
} as FlexText,
|
|
52
|
+
],
|
|
53
|
+
} as FlexBox,
|
|
54
|
+
// Body text in subtle container
|
|
55
|
+
{
|
|
56
|
+
type: "box",
|
|
57
|
+
layout: "vertical",
|
|
58
|
+
contents: [
|
|
59
|
+
{
|
|
60
|
+
type: "text",
|
|
61
|
+
text: body,
|
|
62
|
+
size: "md",
|
|
63
|
+
color: "#444444",
|
|
64
|
+
wrap: true,
|
|
65
|
+
lineSpacing: "6px",
|
|
66
|
+
} as FlexText,
|
|
67
|
+
],
|
|
68
|
+
margin: "xl",
|
|
69
|
+
paddingAll: "lg",
|
|
70
|
+
backgroundColor: "#F8F9FA",
|
|
71
|
+
cornerRadius: "lg",
|
|
72
|
+
} as FlexBox,
|
|
73
|
+
],
|
|
74
|
+
paddingAll: "xl",
|
|
75
|
+
backgroundColor: "#FFFFFF",
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
if (footer) {
|
|
80
|
+
attachFooterText(bubble, footer);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return bubble;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Create a list card with title and multiple items
|
|
88
|
+
*
|
|
89
|
+
* Editorial design: Numbered/bulleted list with clear visual hierarchy,
|
|
90
|
+
* accent dots for each item, and generous spacing.
|
|
91
|
+
*/
|
|
92
|
+
export function createListCard(title: string, items: ListItem[]): FlexBubble {
|
|
93
|
+
const itemContents: FlexComponent[] = items.slice(0, 8).map((item, index) => {
|
|
94
|
+
const itemContents: FlexComponent[] = [
|
|
95
|
+
{
|
|
96
|
+
type: "text",
|
|
97
|
+
text: item.title,
|
|
98
|
+
size: "md",
|
|
99
|
+
weight: "bold",
|
|
100
|
+
color: "#1a1a1a",
|
|
101
|
+
wrap: true,
|
|
102
|
+
} as FlexText,
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
if (item.subtitle) {
|
|
106
|
+
itemContents.push({
|
|
107
|
+
type: "text",
|
|
108
|
+
text: item.subtitle,
|
|
109
|
+
size: "sm",
|
|
110
|
+
color: "#888888",
|
|
111
|
+
wrap: true,
|
|
112
|
+
margin: "xs",
|
|
113
|
+
} as FlexText);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const itemBox: FlexBox = {
|
|
117
|
+
type: "box",
|
|
118
|
+
layout: "horizontal",
|
|
119
|
+
contents: [
|
|
120
|
+
// Accent dot
|
|
121
|
+
{
|
|
122
|
+
type: "box",
|
|
123
|
+
layout: "vertical",
|
|
124
|
+
contents: [
|
|
125
|
+
{
|
|
126
|
+
type: "box",
|
|
127
|
+
layout: "vertical",
|
|
128
|
+
contents: [],
|
|
129
|
+
width: "8px",
|
|
130
|
+
height: "8px",
|
|
131
|
+
backgroundColor: index === 0 ? "#06C755" : "#DDDDDD",
|
|
132
|
+
cornerRadius: "4px",
|
|
133
|
+
} as FlexBox,
|
|
134
|
+
],
|
|
135
|
+
width: "20px",
|
|
136
|
+
alignItems: "center",
|
|
137
|
+
paddingTop: "sm",
|
|
138
|
+
} as FlexBox,
|
|
139
|
+
// Item content
|
|
140
|
+
{
|
|
141
|
+
type: "box",
|
|
142
|
+
layout: "vertical",
|
|
143
|
+
contents: itemContents,
|
|
144
|
+
flex: 1,
|
|
145
|
+
} as FlexBox,
|
|
146
|
+
],
|
|
147
|
+
margin: index > 0 ? "lg" : undefined,
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
if (item.action) {
|
|
151
|
+
itemBox.action = item.action;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return itemBox;
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
type: "bubble",
|
|
159
|
+
size: "mega",
|
|
160
|
+
body: {
|
|
161
|
+
type: "box",
|
|
162
|
+
layout: "vertical",
|
|
163
|
+
contents: [
|
|
164
|
+
{
|
|
165
|
+
type: "text",
|
|
166
|
+
text: title,
|
|
167
|
+
weight: "bold",
|
|
168
|
+
size: "xl",
|
|
169
|
+
color: "#111111",
|
|
170
|
+
wrap: true,
|
|
171
|
+
} as FlexText,
|
|
172
|
+
{
|
|
173
|
+
type: "separator",
|
|
174
|
+
margin: "lg",
|
|
175
|
+
color: "#EEEEEE",
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
type: "box",
|
|
179
|
+
layout: "vertical",
|
|
180
|
+
contents: itemContents,
|
|
181
|
+
margin: "lg",
|
|
182
|
+
} as FlexBox,
|
|
183
|
+
],
|
|
184
|
+
paddingAll: "xl",
|
|
185
|
+
backgroundColor: "#FFFFFF",
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Create an image card with image, title, and optional body text
|
|
192
|
+
*/
|
|
193
|
+
export function createImageCard(
|
|
194
|
+
imageUrl: string,
|
|
195
|
+
title: string,
|
|
196
|
+
body?: string,
|
|
197
|
+
options?: {
|
|
198
|
+
aspectRatio?: "1:1" | "1.51:1" | "1.91:1" | "4:3" | "16:9" | "20:13" | "2:1" | "3:1";
|
|
199
|
+
aspectMode?: "cover" | "fit";
|
|
200
|
+
action?: Action;
|
|
201
|
+
},
|
|
202
|
+
): FlexBubble {
|
|
203
|
+
const bubble: FlexBubble = {
|
|
204
|
+
type: "bubble",
|
|
205
|
+
hero: {
|
|
206
|
+
type: "image",
|
|
207
|
+
url: imageUrl,
|
|
208
|
+
size: "full",
|
|
209
|
+
aspectRatio: options?.aspectRatio ?? "20:13",
|
|
210
|
+
aspectMode: options?.aspectMode ?? "cover",
|
|
211
|
+
action: options?.action,
|
|
212
|
+
} as FlexImage,
|
|
213
|
+
body: {
|
|
214
|
+
type: "box",
|
|
215
|
+
layout: "vertical",
|
|
216
|
+
contents: [
|
|
217
|
+
{
|
|
218
|
+
type: "text",
|
|
219
|
+
text: title,
|
|
220
|
+
weight: "bold",
|
|
221
|
+
size: "xl",
|
|
222
|
+
wrap: true,
|
|
223
|
+
} as FlexText,
|
|
224
|
+
],
|
|
225
|
+
paddingAll: "lg",
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
if (body && bubble.body) {
|
|
230
|
+
bubble.body.contents.push({
|
|
231
|
+
type: "text",
|
|
232
|
+
text: body,
|
|
233
|
+
size: "md",
|
|
234
|
+
wrap: true,
|
|
235
|
+
margin: "md",
|
|
236
|
+
color: "#666666",
|
|
237
|
+
} as FlexText);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return bubble;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Create an action card with title, body, and action buttons
|
|
245
|
+
*/
|
|
246
|
+
export function createActionCard(
|
|
247
|
+
title: string,
|
|
248
|
+
body: string,
|
|
249
|
+
actions: CardAction[],
|
|
250
|
+
options?: {
|
|
251
|
+
imageUrl?: string;
|
|
252
|
+
aspectRatio?: "1:1" | "1.51:1" | "1.91:1" | "4:3" | "16:9" | "20:13" | "2:1" | "3:1";
|
|
253
|
+
},
|
|
254
|
+
): FlexBubble {
|
|
255
|
+
const bubble: FlexBubble = {
|
|
256
|
+
type: "bubble",
|
|
257
|
+
body: {
|
|
258
|
+
type: "box",
|
|
259
|
+
layout: "vertical",
|
|
260
|
+
contents: [
|
|
261
|
+
{
|
|
262
|
+
type: "text",
|
|
263
|
+
text: title,
|
|
264
|
+
weight: "bold",
|
|
265
|
+
size: "xl",
|
|
266
|
+
wrap: true,
|
|
267
|
+
} as FlexText,
|
|
268
|
+
{
|
|
269
|
+
type: "text",
|
|
270
|
+
text: body,
|
|
271
|
+
size: "md",
|
|
272
|
+
wrap: true,
|
|
273
|
+
margin: "md",
|
|
274
|
+
color: "#666666",
|
|
275
|
+
} as FlexText,
|
|
276
|
+
],
|
|
277
|
+
paddingAll: "lg",
|
|
278
|
+
},
|
|
279
|
+
footer: {
|
|
280
|
+
type: "box",
|
|
281
|
+
layout: "vertical",
|
|
282
|
+
contents: actions.slice(0, 4).map(
|
|
283
|
+
(action, index) =>
|
|
284
|
+
({
|
|
285
|
+
type: "button",
|
|
286
|
+
action: action.action,
|
|
287
|
+
style: index === 0 ? "primary" : "secondary",
|
|
288
|
+
margin: index > 0 ? "sm" : undefined,
|
|
289
|
+
}) as FlexButton,
|
|
290
|
+
),
|
|
291
|
+
paddingAll: "md",
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
if (options?.imageUrl) {
|
|
296
|
+
bubble.hero = {
|
|
297
|
+
type: "image",
|
|
298
|
+
url: options.imageUrl,
|
|
299
|
+
size: "full",
|
|
300
|
+
aspectRatio: options.aspectRatio ?? "20:13",
|
|
301
|
+
aspectMode: "cover",
|
|
302
|
+
} as FlexImage;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return bubble;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Create a carousel container from multiple bubbles
|
|
310
|
+
* LINE allows max 12 bubbles in a carousel
|
|
311
|
+
*/
|
|
312
|
+
export function createCarousel(bubbles: FlexBubble[]): FlexCarousel {
|
|
313
|
+
return {
|
|
314
|
+
type: "carousel",
|
|
315
|
+
contents: bubbles.slice(0, 12),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Create a notification bubble (for alerts, status updates)
|
|
321
|
+
*
|
|
322
|
+
* Editorial design: Bold status indicator with accent color,
|
|
323
|
+
* clear typography, optional icon for context.
|
|
324
|
+
*/
|
|
325
|
+
export function createNotificationBubble(
|
|
326
|
+
text: string,
|
|
327
|
+
options?: {
|
|
328
|
+
icon?: string;
|
|
329
|
+
type?: "info" | "success" | "warning" | "error";
|
|
330
|
+
title?: string;
|
|
331
|
+
},
|
|
332
|
+
): FlexBubble {
|
|
333
|
+
// Color based on notification type
|
|
334
|
+
const colors = {
|
|
335
|
+
info: { accent: "#3B82F6", bg: "#EFF6FF" },
|
|
336
|
+
success: { accent: "#06C755", bg: "#F0FDF4" },
|
|
337
|
+
warning: { accent: "#F59E0B", bg: "#FFFBEB" },
|
|
338
|
+
error: { accent: "#EF4444", bg: "#FEF2F2" },
|
|
339
|
+
};
|
|
340
|
+
const typeColors = colors[options?.type ?? "info"];
|
|
341
|
+
|
|
342
|
+
const contents: FlexComponent[] = [];
|
|
343
|
+
|
|
344
|
+
// Accent bar
|
|
345
|
+
contents.push({
|
|
346
|
+
type: "box",
|
|
347
|
+
layout: "vertical",
|
|
348
|
+
contents: [],
|
|
349
|
+
width: "4px",
|
|
350
|
+
backgroundColor: typeColors.accent,
|
|
351
|
+
cornerRadius: "2px",
|
|
352
|
+
} as FlexBox);
|
|
353
|
+
|
|
354
|
+
// Content section
|
|
355
|
+
const textContents: FlexComponent[] = [];
|
|
356
|
+
|
|
357
|
+
if (options?.title) {
|
|
358
|
+
textContents.push({
|
|
359
|
+
type: "text",
|
|
360
|
+
text: options.title,
|
|
361
|
+
size: "md",
|
|
362
|
+
weight: "bold",
|
|
363
|
+
color: "#111111",
|
|
364
|
+
wrap: true,
|
|
365
|
+
} as FlexText);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
textContents.push({
|
|
369
|
+
type: "text",
|
|
370
|
+
text,
|
|
371
|
+
size: options?.title ? "sm" : "md",
|
|
372
|
+
color: options?.title ? "#666666" : "#333333",
|
|
373
|
+
wrap: true,
|
|
374
|
+
margin: options?.title ? "sm" : undefined,
|
|
375
|
+
} as FlexText);
|
|
376
|
+
|
|
377
|
+
contents.push({
|
|
378
|
+
type: "box",
|
|
379
|
+
layout: "vertical",
|
|
380
|
+
contents: textContents,
|
|
381
|
+
flex: 1,
|
|
382
|
+
paddingStart: "lg",
|
|
383
|
+
} as FlexBox);
|
|
384
|
+
|
|
385
|
+
return {
|
|
386
|
+
type: "bubble",
|
|
387
|
+
body: {
|
|
388
|
+
type: "box",
|
|
389
|
+
layout: "horizontal",
|
|
390
|
+
contents,
|
|
391
|
+
paddingAll: "xl",
|
|
392
|
+
backgroundColor: typeColors.bg,
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FlexBox, FlexBubble, FlexText } from "./types.js";
|
|
2
|
+
|
|
3
|
+
export function attachFooterText(bubble: FlexBubble, footer: string) {
|
|
4
|
+
bubble.footer = {
|
|
5
|
+
type: "box",
|
|
6
|
+
layout: "vertical",
|
|
7
|
+
contents: [
|
|
8
|
+
{
|
|
9
|
+
type: "text",
|
|
10
|
+
text: footer,
|
|
11
|
+
size: "xs",
|
|
12
|
+
color: "#AAAAAA",
|
|
13
|
+
wrap: true,
|
|
14
|
+
align: "center",
|
|
15
|
+
} as FlexText,
|
|
16
|
+
],
|
|
17
|
+
paddingAll: "lg",
|
|
18
|
+
backgroundColor: "#FAFAFA",
|
|
19
|
+
} as FlexBox;
|
|
20
|
+
}
|