From 19e80c0a118fd8551257d52909664fe9b36713dc Mon Sep 17 00:00:00 2001 From: jimmytai Date: Mon, 5 Feb 2024 19:30:48 +0800 Subject: [PATCH] clipboard action --- libs/tryAddShareBtn.js | 131 +++++++++++++++---------------------- line/msg/json-stringify.js | 2 + package.json | 8 +-- richmenu/index.js | 1 + richmenu/playground-1.js | 12 ++-- richmenu/playground-2.js | 18 ++--- richmenu/playground-3.js | 22 +++---- richmenu/playground-4.js | 28 +++++--- richmenu/playground-5.js | 22 +++++-- richmenu/playground-6.js | 26 +++++--- richmenu/playground-7.js | 4 +- richmenu/playground-8.js | 20 +++--- richmenu/playground-9.js | 60 +++++++++++++++++ yarn.lock | 40 +++++++---- 14 files changed, 235 insertions(+), 159 deletions(-) create mode 100644 richmenu/playground-9.js diff --git a/libs/tryAddShareBtn.js b/libs/tryAddShareBtn.js index 975c05f..d834479 100644 --- a/libs/tryAddShareBtn.js +++ b/libs/tryAddShareBtn.js @@ -8,89 +8,64 @@ const flexShareBtn = ({ uri, gistId }) => ({ type: 'flex', contents: { type: 'carousel', - contents: [ + contents: _.map([ { - size: 'nano', - type: 'bubble', - body: { - alignItems: 'center', - justifyContent: 'center', - layout: 'horizontal', - paddingAll: '5px', - spacing: 'md', - type: 'box', - action: { - type: 'uri', - uri, - }, - contents: [ - { - height: '16px', - layout: 'vertical', - type: 'box', - width: '16px', - contents: [ - { - aspectMode: 'cover', - aspectRatio: '1:1', - size: 'full', - type: 'image', - url: 'https://i.imgur.com/IFjR25G.png', - }, - ], - }, - { - flex: 0, - size: '16px', - text: '分享', - type: 'text', - }, - ], - }, + icon: 'https://i.imgur.com/IFjR25G.png', + text: '分享', + action: { type: 'uri', uri }, }, { - size: 'nano', - type: 'bubble', - body: { - alignItems: 'center', - justifyContent: 'center', - layout: 'horizontal', - paddingAll: '5px', - spacing: 'md', - type: 'box', - action: { - data: '/gistReplaceAltText', - displayText: '如果你是在手機上點選「改替代」按鈕,你應該可以在下方輸入框看到自動填寫的文字指令,請在指令後面輸入新的替代文字後傳送。', - fillInText: `/gistReplaceAltText ${gistId} `, - inputOption: 'openKeyboard', - type: 'postback', - }, - contents: [ - { - height: '16px', - layout: 'vertical', - type: 'box', - width: '16px', - contents: [ - { - aspectMode: 'cover', - aspectRatio: '1:1', - size: 'full', - type: 'image', - url: 'https://i.imgur.com/dLElEk7.png', - }, - ], - }, - { - flex: 0, - size: '16px', - text: '改替代', - type: 'text', - }, - ], + icon: 'https://i.imgur.com/W6RbIne.png', + text: '複製網址', + action: { type: 'clipboard', clipboardText: uri }, + }, + { + icon: 'https://i.imgur.com/dLElEk7.png', + text: '改替代', + action: { + data: '/gistReplaceAltText', + displayText: '如果你是在手機上點選「改替代」按鈕,你應該可以在下方輸入框看到自動填寫的文字指令,請在指令後面輸入新的替代文字後傳送。', + fillInText: `/gistReplaceAltText ${gistId} `, + inputOption: 'openKeyboard', + type: 'postback', }, }, - ], + ], btn => ({ + size: 'nano', + type: 'bubble', + body: { + alignItems: 'center', + justifyContent: 'center', + layout: 'horizontal', + paddingAll: '5px', + spacing: 'md', + type: 'box', + action: btn.action, + contents: [ + { + height: '16px', + layout: 'vertical', + type: 'box', + width: '16px', + contents: [ + { + aspectMode: 'cover', + aspectRatio: '1:1', + size: 'full', + type: 'image', + url: btn.icon, + }, + ], + }, + { + flex: 0, + size: '16px', + text: btn.text, + type: 'text', + }, + ], + }, + })), }, sender: { iconUrl: 'https://i.imgur.com/1KZoSue.png', diff --git a/line/msg/json-stringify.js b/line/msg/json-stringify.js index 14cf3f8..7533f9f 100644 --- a/line/msg/json-stringify.js +++ b/line/msg/json-stringify.js @@ -1,8 +1,10 @@ +const { beautifyFlex } = require('../../libs/helper') const msgText = require('./text') const TEXT_MAXLEN = 5000 const jsonStringifyMinify = json => { + json = beautifyFlex(json) let str = JSON.stringify(json, null, 2) if (str.length > TEXT_MAXLEN) str = JSON.stringify(json, null, 1) if (str.length > TEXT_MAXLEN) str = JSON.stringify(json) diff --git a/package.json b/package.json index 1b15ce4..079dc2d 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,11 @@ "dependencies": { "@google-cloud/functions-framework": "^3.3.0", "@josephg/resolvable": "^1.0.1", - "@line/bot-sdk": "^8.2.0", - "axios": "^1.6.3", + "@line/bot-sdk": "^8.4.0", + "axios": "^1.6.7", "crypto-js": "^4.2.0", "dayjs": "^1.11.10", - "dotenv": "^16.3.1", + "dotenv": "^16.4.5", "json5": "^2.2.3", "lodash": "^4.17.21", "octokit": "^3.1.2", @@ -22,7 +22,7 @@ "eslint": "^8.56.0", "eslint-config-standard": "^17.1.0", "eslint-plugin-import": "^2.29.1", - "eslint-plugin-n": "^16.6.1", + "eslint-plugin-n": "^16.6.2", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^6.1.1", "jest": "^29.7.0" diff --git a/richmenu/index.js b/richmenu/index.js index dcd12c2..1bca86f 100644 --- a/richmenu/index.js +++ b/richmenu/index.js @@ -19,6 +19,7 @@ const RICHMENU_FILES = [ 'playground-6', 'playground-7', 'playground-8', + 'playground-9', ] exports.bootstrap = (() => { diff --git a/richmenu/playground-1.js b/richmenu/playground-1.js index f1df27a..4d627e7 100644 --- a/richmenu/playground-1.js +++ b/richmenu/playground-1.js @@ -10,21 +10,21 @@ module.exports = { selected: true, size: { width: 2500, height: 1684 }, areas: [ - { + { // 關閉圖文選單遊樂場 bounds: { x: 2325, y: 0, width: 175, height: 208 }, action: { type: 'message', text: '/richmenuPlayground exit', }, }, - { + { // 動作說明 bounds: { x: 2150, y: 0, width: 175, height: 208 }, action: { type: 'uri', uri: 'https://developers.line.biz/en/docs/messaging-api/try-rich-menu/#try-message-action', }, }, - { + { // 2. postback bounds: { x: 742, y: 208, width: 737, height: 245 }, action: { type: 'richmenuswitch', @@ -32,7 +32,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-2' }), }, }, - { + { // 3. URI bounds: { x: 1479, y: 208, width: 730, height: 245 }, action: { type: 'richmenuswitch', @@ -40,7 +40,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-3' }), }, }, - { + { // 4. 選擇日時 bounds: { x: 2209, y: 208, width: 291, height: 245 }, action: { type: 'richmenuswitch', @@ -48,7 +48,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-4' }), }, }, - { + { // 傳送訊息 bounds: { x: 576, y: 1055, width: 1346, height: 494 }, action: { type: 'message', diff --git a/richmenu/playground-2.js b/richmenu/playground-2.js index 22eb5a5..41c8cc1 100644 --- a/richmenu/playground-2.js +++ b/richmenu/playground-2.js @@ -10,21 +10,21 @@ module.exports = { selected: true, size: { width: 2500, height: 1684 }, areas: [ - { + { // 關閉圖文選單遊樂場 bounds: { x: 2325, y: 0, width: 175, height: 208 }, action: { type: 'message', text: '/richmenuPlayground exit', }, }, - { + { // 動作說明 bounds: { x: 2150, y: 0, width: 175, height: 208 }, action: { type: 'uri', - uri: 'https://developers.line.biz/en/docs/messaging-api/try-rich-menu/#try-postback-action', + uri: 'https://developers.line.biz/en/docs/messaging-api/try-rich-menu/#try-postback-1-action', }, }, - { + { // 1. message bounds: { x: 0, y: 208, width: 742, height: 245 }, action: { type: 'richmenuswitch', @@ -32,7 +32,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-1' }), }, }, - { + { // 3. URI bounds: { x: 1479, y: 208, width: 730, height: 245 }, action: { type: 'richmenuswitch', @@ -40,7 +40,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-3' }), }, }, - { + { // 4. 選擇日時 bounds: { x: 2209, y: 208, width: 291, height: 245 }, action: { type: 'richmenuswitch', @@ -48,7 +48,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-4' }), }, }, - { + { // 包含 displayText bounds: { x: 0, y: 875, width: 1250, height: 420 }, action: { type: 'postback', @@ -56,14 +56,14 @@ module.exports = { displayText: '這則文字將顯示在聊天視窗內。', }, }, - { + { // 沒有 displayText bounds: { x: 1250, y: 875, width: 1250, height: 420 }, action: { type: 'postback', data: 'actionId=22', }, }, - { + { // 測試 inputOption 屬性 bounds: { x: 0, y: 1295, width: 2500, height: 320 }, action: { type: 'richmenuswitch', diff --git a/richmenu/playground-3.js b/richmenu/playground-3.js index d792c41..810b755 100644 --- a/richmenu/playground-3.js +++ b/richmenu/playground-3.js @@ -10,21 +10,21 @@ module.exports = { selected: true, size: { width: 2500, height: 1684 }, areas: [ - { + { // 關閉圖文選單遊樂場 bounds: { x: 2325, y: 0, width: 175, height: 208 }, action: { type: 'message', text: '/richmenuPlayground exit', }, }, - { + { // 動作說明 bounds: { x: 2150, y: 0, width: 175, height: 208 }, action: { type: 'uri', uri: 'https://developers.line.biz/en/docs/messaging-api/try-rich-menu/#try-uri-action', }, }, - { + { // 1. message bounds: { x: 0, y: 208, width: 742, height: 245 }, action: { type: 'richmenuswitch', @@ -32,7 +32,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-1' }), }, }, - { + { // 2. postback bounds: { x: 742, y: 208, width: 737, height: 245 }, action: { type: 'richmenuswitch', @@ -40,7 +40,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-2' }), }, }, - { + { // 4. 選擇日時 bounds: { x: 2209, y: 208, width: 291, height: 245 }, action: { type: 'richmenuswitch', @@ -48,42 +48,42 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-4' }), }, }, - { + { // 開啟 URL bounds: { x: 0, y: 485, width: 1332, height: 375 }, action: { type: 'uri', uri: 'https://developers.line.biz/en/reference/messaging-api/#uri-action', }, }, - { + { // 開啟 URL 查看網址 bounds: { x: 1332, y: 485, width: 380, height: 375 }, action: { type: 'message', text: '網址為:\nhttps://developers.line.biz/en/reference/messaging-api/#uri-action', }, }, - { + { // 在外部瀏覽器開啟 bounds: { x: 0, y: 860, width: 1332, height: 375 }, action: { type: 'uri', uri: 'https://developers.line.biz/en/reference/messaging-api/?openExternalBrowser=1#uri-action', }, }, - { + { // 在外部瀏覽器開啟 查看網址 bounds: { x: 1332, y: 860, width: 380, height: 375 }, action: { type: 'message', text: '網址為:\nhttps://developers.line.biz/en/reference/messaging-api/?openExternalBrowser=1#uri-action', }, }, - { + { // 在 APP 內的 Chrome 開啟 bounds: { x: 0, y: 1235, width: 1332, height: 375 }, action: { type: 'uri', uri: 'https://developers.line.biz/en/reference/messaging-api/?openInAppBrowser=0#uri-action', }, }, - { + { // 在 APP 內的 Chrome 開啟 查看網址 bounds: { x: 1332, y: 1235, width: 380, height: 375 }, action: { type: 'message', diff --git a/richmenu/playground-4.js b/richmenu/playground-4.js index 1772b63..7baa94b 100644 --- a/richmenu/playground-4.js +++ b/richmenu/playground-4.js @@ -4,27 +4,27 @@ const RICHMENU_ALIAS = 'playground-4' module.exports = { alias: RICHMENU_ALIAS, - image: 'https://i.imgur.com/GjSm4C0.png', + image: 'https://i.imgur.com/ewGGiZI.png', metadata: { chatBarText: '點此打開圖文選單', selected: true, size: { width: 2500, height: 1684 }, areas: [ - { + { // 關閉圖文選單遊樂場 bounds: { x: 2325, y: 0, width: 175, height: 208 }, action: { type: 'message', text: '/richmenuPlayground exit', }, }, - { + { // 動作說明 bounds: { x: 2150, y: 0, width: 175, height: 208 }, action: { type: 'uri', uri: 'https://developers.line.biz/en/docs/messaging-api/try-rich-menu/#try-datetime-picker-action', }, }, - { + { // 1. message bounds: { x: 0, y: 208, width: 300, height: 245 }, action: { type: 'richmenuswitch', @@ -32,7 +32,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-1' }), }, }, - { + { // 5. 切換選單 bounds: { x: 1030, y: 208, width: 730, height: 245 }, action: { type: 'richmenuswitch', @@ -40,7 +40,15 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-5' }), }, }, - { + { // 6. clipboard + bounds: { x: 1760, y: 208, width: 730, height: 245 }, + action: { + type: 'richmenuswitch', + richMenuAliasId: 'playground-9', + data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-9' }), + }, + }, + { // 選擇日期與時間 bounds: { x: 0, y: 1016, width: 1600, height: 300 }, action: { type: 'datetimepicker', @@ -48,7 +56,7 @@ module.exports = { mode: 'datetime', }, }, - { + { // 指定初始值 bounds: { x: 0, y: 1315, width: 830, height: 300 }, action: { type: 'datetimepicker', @@ -57,7 +65,7 @@ module.exports = { mode: 'datetime', }, }, - { + { // 指定上下限 bounds: { x: 830, y: 1315, width: 770, height: 300 }, action: { type: 'datetimepicker', @@ -67,7 +75,7 @@ module.exports = { mode: 'datetime', }, }, - { + { // 選擇日期 bounds: { x: 1600, y: 1016, width: 900, height: 300 }, action: { type: 'datetimepicker', @@ -75,7 +83,7 @@ module.exports = { mode: 'date', }, }, - { + { // 選擇時間 bounds: { x: 1600, y: 1315, width: 900, height: 300 }, action: { type: 'datetimepicker', diff --git a/richmenu/playground-5.js b/richmenu/playground-5.js index aca75b3..7b870a8 100644 --- a/richmenu/playground-5.js +++ b/richmenu/playground-5.js @@ -4,27 +4,27 @@ const RICHMENU_ALIAS = 'playground-5' module.exports = { alias: RICHMENU_ALIAS, - image: 'https://i.imgur.com/0KBhjYO.png', + image: 'https://i.imgur.com/zDNynYv.png', metadata: { chatBarText: '點此打開圖文選單', selected: true, size: { width: 2500, height: 1684 }, areas: [ - { + { // 關閉圖文選單遊樂場 bounds: { x: 2325, y: 0, width: 175, height: 208 }, action: { type: 'message', text: '/richmenuPlayground exit', }, }, - { + { // 動作說明 bounds: { x: 2150, y: 0, width: 175, height: 208 }, action: { type: 'uri', uri: 'https://developers.line.biz/en/docs/messaging-api/try-rich-menu/#try-richmenu-switch-action', }, }, - { + { // 1. message bounds: { x: 0, y: 208, width: 300, height: 245 }, action: { type: 'richmenuswitch', @@ -32,7 +32,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-1' }), }, }, - { + { // 4. 選擇日時 bounds: { x: 300, y: 208, width: 730, height: 245 }, action: { type: 'richmenuswitch', @@ -40,7 +40,15 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-4' }), }, }, - { + { // 6. clipboard + bounds: { x: 1760, y: 208, width: 730, height: 245 }, + action: { + type: 'richmenuswitch', + richMenuAliasId: 'playground-9', + data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-9' }), + }, + }, + { // 換成藍色選單 bounds: { x: 0, y: 1100, width: 1250, height: 450 }, action: { type: 'richmenuswitch', @@ -48,7 +56,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-6' }), }, }, - { + { // 換成小型選單 bounds: { x: 1250, y: 1100, width: 1250, height: 450 }, action: { type: 'richmenuswitch', diff --git a/richmenu/playground-6.js b/richmenu/playground-6.js index d998a7d..3395a03 100644 --- a/richmenu/playground-6.js +++ b/richmenu/playground-6.js @@ -4,43 +4,51 @@ const RICHMENU_ALIAS = 'playground-6' module.exports = { alias: RICHMENU_ALIAS, - image: 'https://i.imgur.com/YoOvVYl.png', + image: 'https://i.imgur.com/lLaScoh.png', metadata: { chatBarText: '點此打開圖文選單', selected: true, size: { width: 2500, height: 1684 }, areas: [ - { + { // 關閉圖文選單遊樂場 bounds: { x: 2325, y: 0, width: 175, height: 208 }, action: { type: 'message', text: '/richmenuPlayground exit', }, }, - { + { // 動作說明 bounds: { x: 2150, y: 0, width: 175, height: 208 }, action: { type: 'uri', uri: 'https://developers.line.biz/en/docs/messaging-api/try-rich-menu/#try-richmenu-switch-action', }, }, - { - bounds: { x: 0, y: 208, width: 300, height: 256 }, + { // 1. message + bounds: { x: 0, y: 208, width: 300, height: 245 }, action: { type: 'richmenuswitch', richMenuAliasId: 'playground-1', data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-1' }), }, }, - { - bounds: { x: 300, y: 208, width: 730, height: 256 }, + { // 4. 選擇日時 + bounds: { x: 300, y: 208, width: 730, height: 245 }, action: { type: 'richmenuswitch', richMenuAliasId: 'playground-4', data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-4' }), }, }, - { + { // 6. clipboard + bounds: { x: 1760, y: 208, width: 730, height: 245 }, + action: { + type: 'richmenuswitch', + richMenuAliasId: 'playground-9', + data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-9' }), + }, + }, + { // 換回綠色選單 bounds: { x: 0, y: 1100, width: 1250, height: 450 }, action: { type: 'richmenuswitch', @@ -48,7 +56,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-5' }), }, }, - { + { // 換成小型選單 bounds: { x: 1250, y: 1100, width: 1250, height: 450 }, action: { type: 'richmenuswitch', diff --git a/richmenu/playground-7.js b/richmenu/playground-7.js index a29b611..8b9b704 100644 --- a/richmenu/playground-7.js +++ b/richmenu/playground-7.js @@ -10,7 +10,7 @@ module.exports = { selected: true, size: { width: 2500, height: 421 }, areas: [ - { + { // 換回綠色選單 bounds: { x: 0, y: 0, width: 1600, height: 421 }, action: { type: 'richmenuswitch', @@ -18,7 +18,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-5' }), }, }, - { + { // size 說明文件 bounds: { x: 1600, y: 0, width: 660, height: 421 }, action: { type: 'uri', diff --git a/richmenu/playground-8.js b/richmenu/playground-8.js index 8a4c3d9..67f8b1c 100644 --- a/richmenu/playground-8.js +++ b/richmenu/playground-8.js @@ -10,21 +10,21 @@ module.exports = { selected: true, size: { width: 2500, height: 1684 }, areas: [ - { + { // 關閉圖文選單遊樂場 bounds: { x: 2325, y: 0, width: 175, height: 208 }, action: { type: 'message', text: '/richmenuPlayground exit', }, }, - { + { // 動作說明 bounds: { x: 2150, y: 0, width: 175, height: 208 }, action: { type: 'uri', - uri: 'https://developers.line.biz/en/docs/messaging-api/actions/#postback-action', + uri: 'https://developers.line.biz/en/docs/messaging-api/try-rich-menu/#try-postback-2-action', }, }, - { + { // 1. message bounds: { x: 0, y: 208, width: 742, height: 245 }, action: { type: 'richmenuswitch', @@ -32,7 +32,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-1' }), }, }, - { + { // 2. postback bounds: { x: 742, y: 208, width: 737, height: 245 }, action: { type: 'richmenuswitch', @@ -40,7 +40,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-2' }), }, }, - { + { // 3. URI bounds: { x: 1479, y: 208, width: 730, height: 245 }, action: { type: 'richmenuswitch', @@ -48,7 +48,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-3' }), }, }, - { + { // 4. 選擇日時 bounds: { x: 2209, y: 208, width: 291, height: 245 }, action: { type: 'richmenuswitch', @@ -56,7 +56,7 @@ module.exports = { data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-4' }), }, }, - { + { // 切換文字輸入 bounds: { x: 0, y: 875, width: 1250, height: 370 }, action: { data: 'actionId=61', @@ -65,7 +65,7 @@ module.exports = { type: 'postback', }, }, - { + { // 切換語音訊息 bounds: { x: 1250, y: 875, width: 1250, height: 370 }, action: { data: 'actionId=62', @@ -73,7 +73,7 @@ module.exports = { type: 'postback', }, }, - { + { // 關閉及開啟圖文選單 bounds: { x: 0, y: 1245, width: 2500, height: 370 }, action: { data: '/postbackInputOption', diff --git a/richmenu/playground-9.js b/richmenu/playground-9.js new file mode 100644 index 0000000..d631706 --- /dev/null +++ b/richmenu/playground-9.js @@ -0,0 +1,60 @@ +const { httpBuildQuery } = require('../libs/helper') + +const RICHMENU_ALIAS = 'playground-9' + +module.exports = { + alias: RICHMENU_ALIAS, + image: 'https://i.imgur.com/FQTPA2J.png', + metadata: { + chatBarText: '點此打開圖文選單', + selected: true, + size: { width: 2500, height: 1684 }, + areas: [ + { // 關閉圖文選單遊樂場 + bounds: { x: 2325, y: 0, width: 175, height: 208 }, + action: { + type: 'message', + text: '/richmenuPlayground exit', + }, + }, + { // 動作說明 + bounds: { x: 2150, y: 0, width: 175, height: 208 }, + action: { + type: 'uri', + uri: 'https://developers.line.biz/en/reference/messaging-api/#clipboard-action', + }, + }, + { // 1. message + bounds: { x: 0, y: 208, width: 300, height: 245 }, + action: { + type: 'richmenuswitch', + richMenuAliasId: 'playground-1', + data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-1' }), + }, + }, + { // 4. 選擇日時 + bounds: { x: 300, y: 208, width: 730, height: 245 }, + action: { + type: 'richmenuswitch', + richMenuAliasId: 'playground-4', + data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-4' }), + }, + }, + { // 5. 切換選單 + bounds: { x: 1030, y: 208, width: 730, height: 245 }, + action: { + type: 'richmenuswitch', + richMenuAliasId: 'playground-5', + data: httpBuildQuery({ from: RICHMENU_ALIAS, to: 'playground-5' }), + }, + }, + { // 複製文字 + bounds: { x: 576, y: 1055, width: 1346, height: 494 }, + action: { + type: 'clipboard', + clipboardText: '這是你從圖文選單遊樂場複製的文字', + }, + }, + ], + }, +} diff --git a/yarn.lock b/yarn.lock index d81c750..97213ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -612,10 +612,10 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" -"@line/bot-sdk@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@line/bot-sdk/-/bot-sdk-8.2.0.tgz#4c42db8ed368365917dd9fd8022ef65d0b0a9889" - integrity sha512-DpAXnyuZXjNQ2lcoRrkI7bYfmOYkJ+vnYXDHSBGH3ik/6sVNM15JQS/C3DHLpzlp9xVuwcJqJGRoGv8SSQDTZA== +"@line/bot-sdk@^8.4.0": + version "8.4.0" + resolved "https://registry.yarnpkg.com/@line/bot-sdk/-/bot-sdk-8.4.0.tgz#f7f4713bca152b4beb6b0ad23d022afeeaa90076" + integrity sha512-4tCtVkdI4YnxmFfIItkPpMUjc4xb2F9wpgQE6j2RtNbi1qOyapFLFUclAwfoZpzPrwmTVodWxyAAvrFnya63Gg== dependencies: "@types/body-parser" "^1.19.2" "@types/node" "^20.0.0" @@ -1285,7 +1285,7 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -axios@^1.0.0, axios@^1.6.3: +axios@^1.0.0: version "1.6.3" resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.3.tgz#7f50f23b3aa246eff43c54834272346c396613f4" integrity sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww== @@ -1294,6 +1294,15 @@ axios@^1.0.0, axios@^1.6.3: form-data "^4.0.0" proxy-from-env "^1.1.0" +axios@^1.6.7: + version "1.6.7" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.7.tgz#7b48c2e27c96f9c68a2f8f31e2ab19f59b06b0a7" + integrity sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA== + dependencies: + follow-redirects "^1.15.4" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + babel-jest@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" @@ -1776,10 +1785,10 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dotenv@^16.3.1: - version "16.3.1" - resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" - integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== +dotenv@^16.4.5: + version "16.4.5" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" + integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== ecdsa-sig-formatter@1.0.11: version "1.0.11" @@ -1981,10 +1990,10 @@ eslint-plugin-import@^2.29.1: semver "^6.3.1" tsconfig-paths "^3.15.0" -eslint-plugin-n@^16.6.1: - version "16.6.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-16.6.1.tgz#b16e0033bc9ce592b1c3512cb1cee24f84ecb5ae" - integrity sha512-M1kE5bVQRLBMDYRZwDhWzlzbp370SRRRC1MHqq4I3L2Tatey+9/2csc5mwLDPlmhJaDvkojbrNUME5/llpRyDg== +eslint-plugin-n@^16.6.2: + version "16.6.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-n/-/eslint-plugin-n-16.6.2.tgz#6a60a1a376870064c906742272074d5d0b412b0b" + integrity sha512-6TyDmZ1HXoFQXnhCTUjVFULReoBPOAjpuiKELMkeP40yffI/1ZRO+d9ug/VC6fqISo2WkuIBk3cvuRPALaWlOQ== dependencies: "@eslint-community/eslint-utils" "^4.4.0" builtins "^5.0.1" @@ -2294,6 +2303,11 @@ follow-redirects@^1.15.0: resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== +follow-redirects@^1.15.4: + version "1.15.5" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.5.tgz#54d4d6d062c0fa7d9d17feb008461550e3ba8020" + integrity sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw== + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e"