@openclaw/line 2026.10.2 → 2026.10.5-beta.2
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/dist/.setup/api-BxKwG8cd.mjs +3 -0
- package/dist/.setup/{api-CMU7bG-C.mjs → api-DPd9f0cI.mjs} +2 -2
- package/dist/.setup/{card-command-BrU6u6pm.mjs → card-command-BMLk4YKh.mjs} +15 -24
- package/dist/.setup/{channel-InKuXaRS.mjs → channel-DVuSrT_i.mjs} +161 -227
- package/dist/.setup/channel.runtime-IN_F95BO.mjs +4 -0
- package/dist/.setup/{monitor-Bb3HieCd.mjs → monitor-BY32s5Um.mjs} +68 -83
- package/dist/.setup/monitor.runtime-DKuc2SBe.mjs +2 -0
- package/dist/.setup/outbound.runtime-DLyndDng.mjs +3 -0
- package/dist/.setup/probe.runtime-D2MUF_B_.mjs +2 -0
- package/dist/.setup/{send-DAwROcyQ.mjs → send-g4gFsc9W.mjs} +51 -71
- package/dist/.setup/{send-retry-B9Nor0-J.mjs → send-retry-Dzbkz5wG.mjs} +186 -379
- package/dist/.setup/{setup-surface-1jkHGWg7.mjs → setup-surface-CYd8oqzt.mjs} +1 -1
- package/dist/.setup/{template-messages-DdF9zv_j.mjs → template-messages-CwPsGQjw.mjs} +67 -118
- package/dist/api.js +2 -2
- package/dist/channel-plugin-api.js +1 -1
- package/dist/index.js +1 -3
- package/dist/setup-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/node_modules/@line/bot-sdk/dist/channel-access-token/api/channelAccessTokenClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/channel-access-token/api/channelAccessTokenClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/channel-access-token/api/channelAccessTokenClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/exceptions.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/exceptions.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/http-fetch.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/http-fetch.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/index.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/insight/api/insightClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/insight/api/insightClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/liff/api/liffClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/liff/api/liffClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.factory.generated.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.generated.d.ts +38 -0
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.generated.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.generated.js +46 -0
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.generated.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/line-bot-client.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/api/manageAudienceBlobClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/api/manageAudienceBlobClient.js +15 -5
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/api/manageAudienceBlobClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/api/manageAudienceClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/manage-audience/api/manageAudienceClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiBlobClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiBlobClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiClient.d.ts +39 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiClient.js +59 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/api/messagingApiClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/models.d.ts +5 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/models.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/models.js +5 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/models.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpMessagesRequest.d.ts +5 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpMessagesRequest.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedButton.d.ts +26 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedButton.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedButton.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedButton.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedEmphasizedItem.d.ts +27 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedEmphasizedItem.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedEmphasizedItem.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedEmphasizedItem.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedItem.d.ts +26 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedItem.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedItem.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedItem.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageBody.d.ts +32 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageBody.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageBody.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageBody.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageRequest.d.ts +32 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageRequest.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageRequest.js +14 -0
- package/node_modules/@line/bot-sdk/dist/cjs/messaging-api/model/pnpTemplatedMessageRequest.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/cjs/middleware.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/module/api/lineModuleClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/module/api/lineModuleClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/module-attach/api/lineModuleAttachClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/module-attach/api/lineModuleAttachClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/shop/api/shopClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/shop/api/shopClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/utils.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/validate-signature.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/version.d.ts +1 -1
- package/node_modules/@line/bot-sdk/dist/cjs/version.js +1 -1
- package/node_modules/@line/bot-sdk/dist/exceptions.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/exceptions.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/http-fetch.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/insight/api/insightClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/liff/api/liffClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/line-bot-client.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/line-bot-client.generated.d.ts +38 -0
- package/node_modules/@line/bot-sdk/dist/line-bot-client.generated.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/line-bot-client.generated.js +46 -0
- package/node_modules/@line/bot-sdk/dist/line-bot-client.generated.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/api/manageAudienceBlobClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/api/manageAudienceBlobClient.js +15 -5
- package/node_modules/@line/bot-sdk/dist/manage-audience/api/manageAudienceBlobClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/manage-audience/api/manageAudienceClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/api/messagingApiBlobClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/api/messagingApiClient.d.ts +39 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/api/messagingApiClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/api/messagingApiClient.js +61 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/api/messagingApiClient.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/models.d.ts +5 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/models.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/models.js +5 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/models.js.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpMessagesRequest.d.ts +5 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpMessagesRequest.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedButton.d.ts +26 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedButton.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedButton.js +13 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedButton.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedEmphasizedItem.d.ts +27 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedEmphasizedItem.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedEmphasizedItem.js +13 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedEmphasizedItem.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedItem.d.ts +26 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedItem.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedItem.js +13 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedItem.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageBody.d.ts +32 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageBody.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageBody.js +13 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageBody.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageRequest.d.ts +32 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageRequest.d.ts.map +1 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageRequest.js +13 -0
- package/node_modules/@line/bot-sdk/dist/messaging-api/model/pnpTemplatedMessageRequest.js.map +1 -0
- package/node_modules/@line/bot-sdk/dist/module/api/lineModuleClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/module-attach/api/lineModuleAttachClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/shop/api/shopClient.d.ts.map +1 -1
- package/node_modules/@line/bot-sdk/dist/version.d.ts +1 -1
- package/node_modules/@line/bot-sdk/dist/version.js +1 -1
- package/node_modules/@line/bot-sdk/lib/line-bot-client.generated.ts +68 -0
- package/node_modules/@line/bot-sdk/lib/manage-audience/api/manageAudienceBlobClient.ts +15 -5
- package/node_modules/@line/bot-sdk/lib/messaging-api/.openapi-generator/FILES +5 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/api/messagingApiClient.ts +89 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/models.ts +5 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpMessagesRequest.ts +5 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpTemplatedButton.ts +26 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpTemplatedEmphasizedItem.ts +27 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpTemplatedItem.ts +26 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpTemplatedMessageBody.ts +33 -0
- package/node_modules/@line/bot-sdk/lib/messaging-api/model/pnpTemplatedMessageRequest.ts +33 -0
- package/node_modules/@line/bot-sdk/lib/version.ts +1 -1
- package/node_modules/@line/bot-sdk/node_modules/@types/node/README.md +2 -2
- package/node_modules/@line/bot-sdk/node_modules/@types/node/async_hooks.d.ts +18 -22
- package/node_modules/@line/bot-sdk/node_modules/@types/node/buffer.buffer.d.ts +10 -5
- package/node_modules/@line/bot-sdk/node_modules/@types/node/buffer.d.ts +7 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/child_process.d.ts +5 -1
- package/node_modules/@line/bot-sdk/node_modules/@types/node/crypto.d.ts +114 -47
- package/node_modules/@line/bot-sdk/node_modules/@types/node/dgram.d.ts +119 -4
- package/node_modules/@line/bot-sdk/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@line/bot-sdk/node_modules/@types/node/dns.d.ts +6 -6
- package/node_modules/@line/bot-sdk/node_modules/@types/node/events.d.ts +13 -22
- package/node_modules/@line/bot-sdk/node_modules/@types/node/fs/promises.d.ts +79 -66
- package/node_modules/@line/bot-sdk/node_modules/@types/node/fs.d.ts +153 -90
- package/node_modules/@line/bot-sdk/node_modules/@types/node/http.d.ts +94 -2
- package/node_modules/@line/bot-sdk/node_modules/@types/node/http2.d.ts +65 -18
- package/node_modules/@line/bot-sdk/node_modules/@types/node/inspector.d.ts +47 -1
- package/node_modules/@line/bot-sdk/node_modules/@types/node/inspector.generated.d.ts +167 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/module.d.ts +1 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/net.d.ts +139 -15
- package/node_modules/@line/bot-sdk/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@line/bot-sdk/node_modules/@types/node/package.json +3 -18
- package/node_modules/@line/bot-sdk/node_modules/@types/node/perf_hooks.d.ts +31 -19
- package/node_modules/@line/bot-sdk/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@line/bot-sdk/node_modules/@types/node/sqlite.d.ts +153 -11
- package/node_modules/@line/bot-sdk/node_modules/@types/node/stream/consumers.d.ts +7 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/stream/web.d.ts +19 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/stream.d.ts +2 -1
- package/node_modules/@line/bot-sdk/node_modules/@types/node/test.d.ts +320 -13
- package/node_modules/@line/bot-sdk/node_modules/@types/node/tls.d.ts +50 -15
- package/node_modules/@line/bot-sdk/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +5 -0
- package/node_modules/@line/bot-sdk/node_modules/@types/node/tty.d.ts +4 -3
- package/node_modules/@line/bot-sdk/node_modules/@types/node/url.d.ts +27 -3
- package/node_modules/@line/bot-sdk/node_modules/@types/node/util.d.ts +42 -2
- package/node_modules/@line/bot-sdk/node_modules/@types/node/v8.d.ts +51 -23
- package/node_modules/@line/bot-sdk/node_modules/@types/node/vm.d.ts +52 -87
- package/node_modules/@line/bot-sdk/node_modules/@types/node/zlib.d.ts +23 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/cache-interceptor.d.ts +6 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/client.d.ts +15 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/connector.d.ts +2 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/dispatcher.d.ts +8 -5
- package/node_modules/@line/bot-sdk/node_modules/undici-types/errors.d.ts +17 -1
- package/node_modules/@line/bot-sdk/node_modules/undici-types/index.d.ts +4 -1
- package/node_modules/@line/bot-sdk/node_modules/undici-types/interceptors.d.ts +7 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/package.json +1 -1
- package/node_modules/@line/bot-sdk/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/webidl.d.ts +6 -0
- package/node_modules/@line/bot-sdk/node_modules/undici-types/websocket.d.ts +2 -0
- package/node_modules/@line/bot-sdk/package.json +10 -9
- package/package.json +5 -5
- package/dist/.setup/api-BBSLQek1.mjs +0 -3
- package/dist/.setup/channel.runtime-BEhASjr_.mjs +0 -4
- package/dist/.setup/monitor.runtime-C6Kgs5BI.mjs +0 -2
- package/dist/.setup/outbound.runtime-BwO_m4n5.mjs +0 -3
- package/dist/.setup/probe.runtime-C6LYzOHu.mjs +0 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { n as resolveDefaultLineAccountId, r as resolveLineAccount } from "./accounts-DOiM8-y3.mjs";
|
|
2
2
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
3
3
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
-
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
5
4
|
import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
6
5
|
import { getFileExtension, mimeTypeFromFilePath } from "openclaw/plugin-sdk/media-mime";
|
|
7
6
|
import { resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
@@ -27,23 +26,14 @@ function inferLineTargetChatType(target) {
|
|
|
27
26
|
//#endregion
|
|
28
27
|
//#region extensions/line/src/media-url.ts
|
|
29
28
|
function isHttpsUrl(value) {
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
return new URL(value).protocol === "https:";
|
|
33
|
-
} catch {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
29
|
+
return typeof value === "string" && URL.parse(value)?.protocol === "https:";
|
|
36
30
|
}
|
|
37
31
|
//#endregion
|
|
38
32
|
//#region extensions/line/src/outbound-media.ts
|
|
39
33
|
const LINE_OUTBOUND_MEDIA_SSRF_POLICY = { allowPrivateNetwork: false };
|
|
40
34
|
async function validateLineMediaUrl(url) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
parsed = new URL(url);
|
|
44
|
-
} catch {
|
|
45
|
-
throw new Error("LINE outbound media URL must be a valid URL");
|
|
46
|
-
}
|
|
35
|
+
const parsed = URL.parse(url);
|
|
36
|
+
if (!parsed) throw new Error("LINE outbound media URL must be a valid URL");
|
|
47
37
|
if (parsed.protocol !== "https:") throw new Error("LINE outbound media URL must use HTTPS");
|
|
48
38
|
if (url.length > 2e3) throw new Error(`LINE outbound media URL must be 2000 chars or less (got ${url.length})`);
|
|
49
39
|
await resolvePinnedHostnameWithPolicy(parsed.hostname, { policy: LINE_OUTBOUND_MEDIA_SSRF_POLICY });
|
|
@@ -88,13 +78,7 @@ function isLineUserTarget(target) {
|
|
|
88
78
|
}
|
|
89
79
|
async function buildLineMediaMessage(mediaUrl, opts, target) {
|
|
90
80
|
const trimmedUrl = mediaUrl.trim();
|
|
91
|
-
if (!isHttpsUrl(trimmedUrl))
|
|
92
|
-
let parsed;
|
|
93
|
-
try {
|
|
94
|
-
parsed = new URL(trimmedUrl);
|
|
95
|
-
} catch {}
|
|
96
|
-
throw new Error(parsed ? "LINE outbound media URL must use HTTPS" : "LINE outbound media currently requires a public HTTPS URL");
|
|
97
|
-
}
|
|
81
|
+
if (!isHttpsUrl(trimmedUrl)) throw new Error(URL.canParse(trimmedUrl) ? "LINE outbound media URL must use HTTPS" : "LINE outbound media currently requires a public HTTPS URL");
|
|
98
82
|
await validateLineMediaUrl(trimmedUrl);
|
|
99
83
|
const previewImageUrl = opts.previewImageUrl?.trim();
|
|
100
84
|
if (previewImageUrl) await validateLineMediaUrl(previewImageUrl);
|
|
@@ -507,9 +491,6 @@ function normalizeLineAction(action, labelLimit = LINE_ACTION_LABEL_LIMIT) {
|
|
|
507
491
|
label
|
|
508
492
|
};
|
|
509
493
|
}
|
|
510
|
-
/**
|
|
511
|
-
* Create a message action (sends text when tapped)
|
|
512
|
-
*/
|
|
513
494
|
function messageAction(label, text) {
|
|
514
495
|
return normalizeLineAction({
|
|
515
496
|
type: "message",
|
|
@@ -517,9 +498,6 @@ function messageAction(label, text) {
|
|
|
517
498
|
text: text ?? label
|
|
518
499
|
});
|
|
519
500
|
}
|
|
520
|
-
/**
|
|
521
|
-
* Create a URI action (opens a URL when tapped)
|
|
522
|
-
*/
|
|
523
501
|
function uriAction(label, uri) {
|
|
524
502
|
return normalizeLineAction({
|
|
525
503
|
type: "uri",
|
|
@@ -527,9 +505,6 @@ function uriAction(label, uri) {
|
|
|
527
505
|
uri
|
|
528
506
|
});
|
|
529
507
|
}
|
|
530
|
-
/**
|
|
531
|
-
* Create a postback action (sends data to webhook when tapped)
|
|
532
|
-
*/
|
|
533
508
|
function postbackAction(label, data, displayText) {
|
|
534
509
|
return normalizeLineAction({
|
|
535
510
|
type: "postback",
|
|
@@ -540,6 +515,21 @@ function postbackAction(label, data, displayText) {
|
|
|
540
515
|
}
|
|
541
516
|
//#endregion
|
|
542
517
|
//#region extensions/line/src/flex-templates/common.ts
|
|
518
|
+
function cardText(text, style) {
|
|
519
|
+
return {
|
|
520
|
+
type: "text",
|
|
521
|
+
text,
|
|
522
|
+
...style
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
function cardBox(layout, contents, style = {}) {
|
|
526
|
+
return {
|
|
527
|
+
type: "box",
|
|
528
|
+
layout,
|
|
529
|
+
contents,
|
|
530
|
+
...style
|
|
531
|
+
};
|
|
532
|
+
}
|
|
543
533
|
function createCardTitle(text) {
|
|
544
534
|
return {
|
|
545
535
|
type: "text",
|
|
@@ -550,115 +540,76 @@ function createCardTitle(text) {
|
|
|
550
540
|
wrap: true
|
|
551
541
|
};
|
|
552
542
|
}
|
|
543
|
+
function createCardListItem(title, subtitle, subtitleSize) {
|
|
544
|
+
const contents = [cardText(title, {
|
|
545
|
+
size: "md",
|
|
546
|
+
weight: "bold",
|
|
547
|
+
color: "#1a1a1a",
|
|
548
|
+
wrap: true
|
|
549
|
+
})];
|
|
550
|
+
if (subtitle) contents.push(cardText(subtitle, {
|
|
551
|
+
size: subtitleSize,
|
|
552
|
+
color: "#888888",
|
|
553
|
+
wrap: true,
|
|
554
|
+
margin: "xs"
|
|
555
|
+
}));
|
|
556
|
+
return contents;
|
|
557
|
+
}
|
|
553
558
|
function createCardBubble(bodyContents, footer) {
|
|
554
559
|
const bubble = {
|
|
555
560
|
type: "bubble",
|
|
556
561
|
size: "mega",
|
|
557
|
-
body: {
|
|
558
|
-
type: "box",
|
|
559
|
-
layout: "vertical",
|
|
560
|
-
contents: bodyContents,
|
|
562
|
+
body: cardBox("vertical", bodyContents, {
|
|
561
563
|
paddingAll: "xl",
|
|
562
564
|
backgroundColor: "#FFFFFF"
|
|
563
|
-
}
|
|
565
|
+
})
|
|
564
566
|
};
|
|
565
|
-
if (footer) bubble.footer = {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
size: "xs",
|
|
572
|
-
color: "#AAAAAA",
|
|
573
|
-
wrap: true,
|
|
574
|
-
align: "center"
|
|
575
|
-
}],
|
|
567
|
+
if (footer) bubble.footer = cardBox("vertical", [cardText(footer, {
|
|
568
|
+
size: "xs",
|
|
569
|
+
color: "#AAAAAA",
|
|
570
|
+
wrap: true,
|
|
571
|
+
align: "center"
|
|
572
|
+
})], {
|
|
576
573
|
paddingAll: "lg",
|
|
577
574
|
backgroundColor: "#FAFAFA"
|
|
578
|
-
};
|
|
575
|
+
});
|
|
579
576
|
return bubble;
|
|
580
577
|
}
|
|
581
578
|
//#endregion
|
|
582
579
|
//#region extensions/line/src/flex-templates/basic-cards.ts
|
|
583
580
|
function createInfoCard(title, body, footer) {
|
|
584
|
-
return createCardBubble([{
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
}]
|
|
599
|
-
}, ...body ? [{
|
|
600
|
-
type: "box",
|
|
601
|
-
layout: "vertical",
|
|
602
|
-
contents: [{
|
|
603
|
-
type: "text",
|
|
604
|
-
text: body,
|
|
605
|
-
size: "md",
|
|
606
|
-
color: "#444444",
|
|
607
|
-
wrap: true,
|
|
608
|
-
lineSpacing: "6px"
|
|
609
|
-
}],
|
|
581
|
+
return createCardBubble([cardBox("horizontal", [cardBox("vertical", [], {
|
|
582
|
+
width: "4px",
|
|
583
|
+
backgroundColor: "#06C755",
|
|
584
|
+
cornerRadius: "2px"
|
|
585
|
+
}), {
|
|
586
|
+
...createCardTitle(title),
|
|
587
|
+
flex: 1,
|
|
588
|
+
margin: "lg"
|
|
589
|
+
}]), ...body ? [cardBox("vertical", [cardText(body, {
|
|
590
|
+
size: "md",
|
|
591
|
+
color: "#444444",
|
|
592
|
+
wrap: true,
|
|
593
|
+
lineSpacing: "6px"
|
|
594
|
+
})], {
|
|
610
595
|
margin: "xl",
|
|
611
596
|
paddingAll: "lg",
|
|
612
597
|
backgroundColor: "#F8F9FA",
|
|
613
598
|
cornerRadius: "lg"
|
|
614
|
-
}] : []], footer);
|
|
599
|
+
})] : []], footer);
|
|
615
600
|
}
|
|
616
601
|
function createListCard(title, items) {
|
|
617
602
|
const itemContents = items.slice(0, 8).map((item, index) => {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
text: item.subtitle,
|
|
629
|
-
size: "sm",
|
|
630
|
-
color: "#888888",
|
|
631
|
-
wrap: true,
|
|
632
|
-
margin: "xs"
|
|
633
|
-
});
|
|
634
|
-
const itemBox = {
|
|
635
|
-
type: "box",
|
|
636
|
-
layout: "horizontal",
|
|
637
|
-
contents: [{
|
|
638
|
-
type: "box",
|
|
639
|
-
layout: "vertical",
|
|
640
|
-
contents: [{
|
|
641
|
-
type: "box",
|
|
642
|
-
layout: "vertical",
|
|
643
|
-
contents: [],
|
|
644
|
-
width: "8px",
|
|
645
|
-
height: "8px",
|
|
646
|
-
backgroundColor: index === 0 ? "#06C755" : "#DDDDDD",
|
|
647
|
-
cornerRadius: "4px"
|
|
648
|
-
}],
|
|
649
|
-
width: "20px",
|
|
650
|
-
alignItems: "center",
|
|
651
|
-
paddingTop: "sm"
|
|
652
|
-
}, {
|
|
653
|
-
type: "box",
|
|
654
|
-
layout: "vertical",
|
|
655
|
-
contents: itemContentsLocal,
|
|
656
|
-
flex: 1
|
|
657
|
-
}],
|
|
658
|
-
margin: index > 0 ? "lg" : void 0
|
|
659
|
-
};
|
|
660
|
-
if (item.action) itemBox.action = normalizeLineAction(item.action, 40);
|
|
661
|
-
return itemBox;
|
|
603
|
+
return cardBox("horizontal", [cardBox("vertical", [cardBox("vertical", [], {
|
|
604
|
+
width: "8px",
|
|
605
|
+
height: "8px",
|
|
606
|
+
backgroundColor: index === 0 ? "#06C755" : "#DDDDDD",
|
|
607
|
+
cornerRadius: "4px"
|
|
608
|
+
})], {
|
|
609
|
+
width: "20px",
|
|
610
|
+
alignItems: "center",
|
|
611
|
+
paddingTop: "sm"
|
|
612
|
+
}), cardBox("vertical", createCardListItem(item.title, item.subtitle, "sm"), { flex: 1 })], { margin: index > 0 ? "lg" : void 0 });
|
|
662
613
|
});
|
|
663
614
|
return createCardBubble([
|
|
664
615
|
createCardTitle(title),
|
|
@@ -667,47 +618,33 @@ function createListCard(title, items) {
|
|
|
667
618
|
margin: "lg",
|
|
668
619
|
color: "#EEEEEE"
|
|
669
620
|
},
|
|
670
|
-
{
|
|
671
|
-
type: "box",
|
|
672
|
-
layout: "vertical",
|
|
673
|
-
contents: itemContents,
|
|
674
|
-
margin: "lg"
|
|
675
|
-
}
|
|
621
|
+
cardBox("vertical", itemContents, { margin: "lg" })
|
|
676
622
|
]);
|
|
677
623
|
}
|
|
678
624
|
function createTitleBody(title, body) {
|
|
679
|
-
const box = {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
weight: "bold",
|
|
686
|
-
size: "xl",
|
|
687
|
-
wrap: true
|
|
688
|
-
}],
|
|
689
|
-
paddingAll: "lg"
|
|
690
|
-
};
|
|
691
|
-
if (body) box.contents.push({
|
|
692
|
-
type: "text",
|
|
693
|
-
text: body,
|
|
625
|
+
const box = cardBox("vertical", [cardText(title, {
|
|
626
|
+
weight: "bold",
|
|
627
|
+
size: "xl",
|
|
628
|
+
wrap: true
|
|
629
|
+
})], { paddingAll: "lg" });
|
|
630
|
+
if (body) box.contents.push(cardText(body, {
|
|
694
631
|
size: "md",
|
|
695
632
|
wrap: true,
|
|
696
633
|
margin: "md",
|
|
697
634
|
color: "#666666"
|
|
698
|
-
});
|
|
635
|
+
}));
|
|
699
636
|
return box;
|
|
700
637
|
}
|
|
701
|
-
function createImageCard(imageUrl, title, body
|
|
638
|
+
function createImageCard(imageUrl, title, body) {
|
|
702
639
|
return {
|
|
703
640
|
type: "bubble",
|
|
704
641
|
hero: {
|
|
705
642
|
type: "image",
|
|
706
643
|
url: imageUrl,
|
|
707
644
|
size: "full",
|
|
708
|
-
aspectRatio:
|
|
709
|
-
aspectMode:
|
|
710
|
-
action:
|
|
645
|
+
aspectRatio: "20:13",
|
|
646
|
+
aspectMode: "cover",
|
|
647
|
+
action: void 0
|
|
711
648
|
},
|
|
712
649
|
body: createTitleBody(title, body)
|
|
713
650
|
};
|
|
@@ -716,23 +653,18 @@ function createActionCard(title, body, actions, options) {
|
|
|
716
653
|
const bubble = {
|
|
717
654
|
type: "bubble",
|
|
718
655
|
body: createTitleBody(title, body),
|
|
719
|
-
footer: {
|
|
720
|
-
type: "
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
style: index === 0 ? "primary" : "secondary",
|
|
726
|
-
margin: index > 0 ? "sm" : void 0
|
|
727
|
-
})),
|
|
728
|
-
paddingAll: "md"
|
|
729
|
-
}
|
|
656
|
+
footer: cardBox("vertical", actions.slice(0, 4).map((action, index) => ({
|
|
657
|
+
type: "button",
|
|
658
|
+
action: normalizeLineAction(action, 40),
|
|
659
|
+
style: index === 0 ? "primary" : "secondary",
|
|
660
|
+
margin: index > 0 ? "sm" : void 0
|
|
661
|
+
})), { paddingAll: "md" })
|
|
730
662
|
};
|
|
731
663
|
if (options?.imageUrl) bubble.hero = {
|
|
732
664
|
type: "image",
|
|
733
665
|
url: options.imageUrl,
|
|
734
666
|
size: "full",
|
|
735
|
-
aspectRatio:
|
|
667
|
+
aspectRatio: "20:13",
|
|
736
668
|
aspectMode: "cover"
|
|
737
669
|
};
|
|
738
670
|
return bubble;
|
|
@@ -742,197 +674,134 @@ function createActionCard(title, body, actions, options) {
|
|
|
742
674
|
function buildTitleSubtitleHeader(params) {
|
|
743
675
|
const { title, subtitle } = params;
|
|
744
676
|
const headerContents = [createCardTitle(title)];
|
|
745
|
-
if (subtitle) headerContents.push({
|
|
746
|
-
type: "text",
|
|
747
|
-
text: subtitle,
|
|
677
|
+
if (subtitle) headerContents.push(cardText(subtitle, {
|
|
748
678
|
size: "sm",
|
|
749
679
|
color: "#888888",
|
|
750
680
|
margin: "sm",
|
|
751
681
|
wrap: true
|
|
752
|
-
});
|
|
682
|
+
}));
|
|
753
683
|
return headerContents;
|
|
754
684
|
}
|
|
755
685
|
function buildCardHeaderSections(headerContents) {
|
|
756
|
-
return [{
|
|
757
|
-
type: "box",
|
|
758
|
-
layout: "vertical",
|
|
759
|
-
contents: headerContents,
|
|
760
|
-
paddingBottom: "lg"
|
|
761
|
-
}, {
|
|
686
|
+
return [cardBox("vertical", headerContents, { paddingBottom: "lg" }), {
|
|
762
687
|
type: "separator",
|
|
763
688
|
color: "#EEEEEE"
|
|
764
689
|
}];
|
|
765
690
|
}
|
|
766
691
|
function createReceiptCard(params) {
|
|
767
|
-
const { title,
|
|
768
|
-
const itemRows = items.slice(0, 12).map((item, index) => ({
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
size: "sm",
|
|
783
|
-
color: item.highlight ? "#06C755" : "#333333",
|
|
784
|
-
weight: item.highlight ? "bold" : "regular",
|
|
785
|
-
flex: 2,
|
|
786
|
-
align: "end",
|
|
787
|
-
wrap: true
|
|
788
|
-
}] : []],
|
|
692
|
+
const { title, items, total, footer } = params;
|
|
693
|
+
const itemRows = items.slice(0, 12).map((item, index) => cardBox("horizontal", [cardText(item.name, {
|
|
694
|
+
size: "sm",
|
|
695
|
+
color: "#666666",
|
|
696
|
+
weight: "regular",
|
|
697
|
+
flex: 3,
|
|
698
|
+
wrap: true
|
|
699
|
+
}), ...item.value ? [cardText(item.value, {
|
|
700
|
+
size: "sm",
|
|
701
|
+
color: "#333333",
|
|
702
|
+
weight: "regular",
|
|
703
|
+
flex: 2,
|
|
704
|
+
align: "end",
|
|
705
|
+
wrap: true
|
|
706
|
+
})] : []], {
|
|
789
707
|
paddingAll: "md",
|
|
790
708
|
backgroundColor: index % 2 === 0 ? "#FFFFFF" : "#FAFAFA"
|
|
791
709
|
}));
|
|
792
|
-
const bodyContents = [...buildCardHeaderSections(
|
|
793
|
-
title,
|
|
794
|
-
subtitle
|
|
795
|
-
})), {
|
|
796
|
-
type: "box",
|
|
797
|
-
layout: "vertical",
|
|
798
|
-
contents: itemRows,
|
|
710
|
+
const bodyContents = [...buildCardHeaderSections([createCardTitle(title)]), cardBox("vertical", itemRows, {
|
|
799
711
|
margin: "md",
|
|
800
712
|
cornerRadius: "md",
|
|
801
713
|
borderWidth: "light",
|
|
802
714
|
borderColor: "#EEEEEE"
|
|
803
|
-
}];
|
|
804
|
-
if (total) bodyContents.push({
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
text: total.value,
|
|
817
|
-
size: "xl",
|
|
818
|
-
weight: "bold",
|
|
819
|
-
color: "#06C755",
|
|
820
|
-
flex: 2,
|
|
821
|
-
align: "end"
|
|
822
|
-
}],
|
|
715
|
+
})];
|
|
716
|
+
if (total) bodyContents.push(cardBox("horizontal", [cardText(total.label, {
|
|
717
|
+
size: "lg",
|
|
718
|
+
weight: "bold",
|
|
719
|
+
color: "#111111",
|
|
720
|
+
flex: 2
|
|
721
|
+
}), cardText(total.value, {
|
|
722
|
+
size: "xl",
|
|
723
|
+
weight: "bold",
|
|
724
|
+
color: "#06C755",
|
|
725
|
+
flex: 2,
|
|
726
|
+
align: "end"
|
|
727
|
+
})], {
|
|
823
728
|
margin: "xl",
|
|
824
729
|
paddingAll: "lg",
|
|
825
730
|
backgroundColor: "#F0FDF4",
|
|
826
731
|
cornerRadius: "lg"
|
|
827
|
-
});
|
|
732
|
+
}));
|
|
828
733
|
return createCardBubble(bodyContents, footer);
|
|
829
734
|
}
|
|
830
735
|
function createEventCard(params) {
|
|
831
736
|
const { title, date, time, location, description, calendar, isAllDay, action } = params;
|
|
832
|
-
const dateBlock = {
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
text: isAllDay ? "ALL DAY" : time ?? "",
|
|
845
|
-
size: "xxl",
|
|
846
|
-
weight: "bold",
|
|
847
|
-
color: "#111111",
|
|
848
|
-
wrap: true,
|
|
849
|
-
margin: "xs"
|
|
850
|
-
}],
|
|
737
|
+
const dateBlock = cardBox("vertical", [cardText(date.toUpperCase(), {
|
|
738
|
+
size: "sm",
|
|
739
|
+
weight: "bold",
|
|
740
|
+
color: "#06C755",
|
|
741
|
+
wrap: true
|
|
742
|
+
}), cardText(isAllDay ? "ALL DAY" : time ?? "", {
|
|
743
|
+
size: "xxl",
|
|
744
|
+
weight: "bold",
|
|
745
|
+
color: "#111111",
|
|
746
|
+
wrap: true,
|
|
747
|
+
margin: "xs"
|
|
748
|
+
})], {
|
|
851
749
|
paddingBottom: "lg",
|
|
852
750
|
borderWidth: "none"
|
|
853
|
-
};
|
|
854
|
-
if (!time && !isAllDay) dateBlock.contents = [{
|
|
855
|
-
type: "text",
|
|
856
|
-
text: date,
|
|
751
|
+
});
|
|
752
|
+
if (!time && !isAllDay) dateBlock.contents = [cardText(date, {
|
|
857
753
|
size: "xl",
|
|
858
754
|
weight: "bold",
|
|
859
755
|
color: "#111111",
|
|
860
756
|
wrap: true
|
|
861
|
-
}];
|
|
862
|
-
const bodyContents = [dateBlock, {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
color: "#1a1a1a",
|
|
881
|
-
wrap: true
|
|
882
|
-
}, ...calendar ? [{
|
|
883
|
-
type: "text",
|
|
884
|
-
text: calendar,
|
|
885
|
-
size: "xs",
|
|
886
|
-
color: "#888888",
|
|
887
|
-
margin: "sm",
|
|
888
|
-
wrap: true
|
|
889
|
-
}] : []],
|
|
890
|
-
flex: 1,
|
|
891
|
-
paddingStart: "lg"
|
|
892
|
-
}],
|
|
757
|
+
})];
|
|
758
|
+
const bodyContents = [dateBlock, cardBox("horizontal", [cardBox("vertical", [], {
|
|
759
|
+
width: "4px",
|
|
760
|
+
backgroundColor: "#06C755",
|
|
761
|
+
cornerRadius: "2px"
|
|
762
|
+
}), cardBox("vertical", [cardText(title, {
|
|
763
|
+
size: "lg",
|
|
764
|
+
weight: "bold",
|
|
765
|
+
color: "#1a1a1a",
|
|
766
|
+
wrap: true
|
|
767
|
+
}), ...calendar ? [cardText(calendar, {
|
|
768
|
+
size: "xs",
|
|
769
|
+
color: "#888888",
|
|
770
|
+
margin: "sm",
|
|
771
|
+
wrap: true
|
|
772
|
+
})] : []], {
|
|
773
|
+
flex: 1,
|
|
774
|
+
paddingStart: "lg"
|
|
775
|
+
})], {
|
|
893
776
|
paddingTop: "lg",
|
|
894
777
|
paddingBottom: "lg",
|
|
895
778
|
borderWidth: "light",
|
|
896
779
|
borderColor: "#EEEEEE"
|
|
897
|
-
}];
|
|
780
|
+
})];
|
|
898
781
|
if (location || description) {
|
|
899
782
|
const detailItems = [];
|
|
900
|
-
if (location) detailItems.push({
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
size: "sm",
|
|
912
|
-
color: "#444444",
|
|
913
|
-
margin: "md",
|
|
914
|
-
flex: 1,
|
|
915
|
-
wrap: true
|
|
916
|
-
}],
|
|
917
|
-
alignItems: "flex-start"
|
|
918
|
-
});
|
|
919
|
-
if (description) detailItems.push({
|
|
920
|
-
type: "text",
|
|
921
|
-
text: description,
|
|
783
|
+
if (location) detailItems.push(cardBox("horizontal", [cardText("📍", {
|
|
784
|
+
size: "sm",
|
|
785
|
+
flex: 0
|
|
786
|
+
}), cardText(location, {
|
|
787
|
+
size: "sm",
|
|
788
|
+
color: "#444444",
|
|
789
|
+
margin: "md",
|
|
790
|
+
flex: 1,
|
|
791
|
+
wrap: true
|
|
792
|
+
})], { alignItems: "flex-start" }));
|
|
793
|
+
if (description) detailItems.push(cardText(description, {
|
|
922
794
|
size: "sm",
|
|
923
795
|
color: "#666666",
|
|
924
796
|
wrap: true,
|
|
925
797
|
margin: location ? "lg" : "none"
|
|
926
|
-
});
|
|
927
|
-
bodyContents.push({
|
|
928
|
-
type: "box",
|
|
929
|
-
layout: "vertical",
|
|
930
|
-
contents: detailItems,
|
|
798
|
+
}));
|
|
799
|
+
bodyContents.push(cardBox("vertical", detailItems, {
|
|
931
800
|
margin: "lg",
|
|
932
801
|
paddingAll: "lg",
|
|
933
802
|
backgroundColor: "#F8F9FA",
|
|
934
803
|
cornerRadius: "lg"
|
|
935
|
-
});
|
|
804
|
+
}));
|
|
936
805
|
}
|
|
937
806
|
const bubble = createCardBubble(bodyContents);
|
|
938
807
|
bubble.body.action = action === void 0 ? void 0 : normalizeLineAction(action, 40);
|
|
@@ -947,97 +816,35 @@ function createAgendaCard(params) {
|
|
|
947
816
|
const eventItems = events.slice(0, 6).map((event, index) => {
|
|
948
817
|
const isActive = event.isNow || index === 0;
|
|
949
818
|
const accentColor = isActive ? "#06C755" : "#E5E5E5";
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
layout: "vertical",
|
|
953
|
-
contents: [{
|
|
954
|
-
type: "text",
|
|
955
|
-
text: event.time ?? "—",
|
|
819
|
+
return cardBox("horizontal", [
|
|
820
|
+
cardBox("vertical", [cardText(event.time ?? "—", {
|
|
956
821
|
size: "sm",
|
|
957
822
|
weight: isActive ? "bold" : "regular",
|
|
958
823
|
color: isActive ? "#06C755" : "#666666",
|
|
959
824
|
align: "end",
|
|
960
825
|
wrap: true
|
|
961
|
-
}],
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
type: "box",
|
|
967
|
-
layout: "vertical",
|
|
968
|
-
contents: [{
|
|
969
|
-
type: "box",
|
|
970
|
-
layout: "vertical",
|
|
971
|
-
contents: [],
|
|
826
|
+
})], {
|
|
827
|
+
width: "65px",
|
|
828
|
+
justifyContent: "flex-start"
|
|
829
|
+
}),
|
|
830
|
+
cardBox("vertical", [cardBox("vertical", [], {
|
|
972
831
|
width: "10px",
|
|
973
832
|
height: "10px",
|
|
974
833
|
backgroundColor: accentColor,
|
|
975
834
|
cornerRadius: "5px"
|
|
976
|
-
}],
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
text: event.title,
|
|
985
|
-
size: "md",
|
|
986
|
-
weight: "bold",
|
|
987
|
-
color: "#1a1a1a",
|
|
988
|
-
wrap: true
|
|
989
|
-
}];
|
|
990
|
-
const secondaryParts = [];
|
|
991
|
-
if (event.location) secondaryParts.push(event.location);
|
|
992
|
-
if (event.calendar) secondaryParts.push(event.calendar);
|
|
993
|
-
if (secondaryParts.length > 0) detailContents.push({
|
|
994
|
-
type: "text",
|
|
995
|
-
text: secondaryParts.join(" · "),
|
|
996
|
-
size: "xs",
|
|
997
|
-
color: "#888888",
|
|
998
|
-
wrap: true,
|
|
999
|
-
margin: "xs"
|
|
1000
|
-
});
|
|
1001
|
-
return {
|
|
1002
|
-
type: "box",
|
|
1003
|
-
layout: "horizontal",
|
|
1004
|
-
contents: [
|
|
1005
|
-
timeColumn,
|
|
1006
|
-
dotColumn,
|
|
1007
|
-
{
|
|
1008
|
-
type: "box",
|
|
1009
|
-
layout: "vertical",
|
|
1010
|
-
contents: detailContents,
|
|
1011
|
-
flex: 1
|
|
1012
|
-
}
|
|
1013
|
-
],
|
|
835
|
+
})], {
|
|
836
|
+
width: "24px",
|
|
837
|
+
alignItems: "center",
|
|
838
|
+
justifyContent: "flex-start",
|
|
839
|
+
paddingTop: "xs"
|
|
840
|
+
}),
|
|
841
|
+
cardBox("vertical", createCardListItem(event.title, [event.location, event.calendar].filter(Boolean).join(" · "), "xs"), { flex: 1 })
|
|
842
|
+
], {
|
|
1014
843
|
margin: index > 0 ? "xl" : void 0,
|
|
1015
844
|
alignItems: "flex-start"
|
|
1016
|
-
};
|
|
1017
|
-
});
|
|
1018
|
-
return createCardBubble([...buildCardHeaderSections(headerContents), {
|
|
1019
|
-
type: "box",
|
|
1020
|
-
layout: "vertical",
|
|
1021
|
-
contents: eventItems,
|
|
1022
|
-
paddingTop: "xl"
|
|
1023
|
-
}], footer);
|
|
1024
|
-
}
|
|
1025
|
-
//#endregion
|
|
1026
|
-
//#region extensions/line/src/send-receipt.ts
|
|
1027
|
-
function createLineSendReceipt(params) {
|
|
1028
|
-
const messageIds = (params.messageIds ?? [params.messageId]).map((messageId) => messageId.trim()).filter(Boolean);
|
|
1029
|
-
const chatId = params.chatId.trim();
|
|
1030
|
-
return createMessageReceiptFromOutboundResults({
|
|
1031
|
-
results: messageIds.map((messageId) => ({
|
|
1032
|
-
channel: "line",
|
|
1033
|
-
messageId,
|
|
1034
|
-
chatId,
|
|
1035
|
-
conversationId: chatId,
|
|
1036
|
-
meta: { messageCount: params.messageCount ?? 1 }
|
|
1037
|
-
})),
|
|
1038
|
-
...chatId ? { threadId: chatId } : {},
|
|
1039
|
-
kind: params.kind ?? "unknown"
|
|
845
|
+
});
|
|
1040
846
|
});
|
|
847
|
+
return createCardBubble([...buildCardHeaderSections(headerContents), cardBox("vertical", eventItems, { paddingTop: "xl" })], footer);
|
|
1041
848
|
}
|
|
1042
849
|
//#endregion
|
|
1043
850
|
//#region extensions/line/src/channel-access-token.ts
|
|
@@ -1198,4 +1005,4 @@ async function explainLineRefusal(params) {
|
|
|
1198
1005
|
};
|
|
1199
1006
|
}
|
|
1200
1007
|
//#endregion
|
|
1201
|
-
export {
|
|
1008
|
+
export { resolveLineQuoteToken as A, fitsLineFlexBubble as C, readLineQuoteToken as D, canCarryLineQuoteToken as E, buildLineMediaMessage as M, inferLineTargetChatType as N, recordLineQuoteToken as O, normalizeLineMessagingTarget as P, uriAction as S, applyLineQuoteToken as T, createCardTitle as _, probeLineBot as a, postbackAction as b, createEventCard as c, createImageCard as d, createInfoCard as f, createCardBubble as g, cardText as h, runLinePushWithRetries as i, withoutLineQuoteTokens as j, reportLineQuoteCarrierMissing as k, createReceiptCard as l, cardBox as m, findLineHttpError as n, resolveLineChannelAccessToken as o, createListCard as p, resolveLineNonDispatchRetryable as r, createAgendaCard as s, explainLineRefusal as t, createActionCard as u, messageAction as v, toFlexMessage as w, truncateLineActionLabel as x, normalizeLineMessage as y };
|