@takagaki/cortex-decisions-viewer 0.12.283 → 0.12.286

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.
@@ -21,13 +21,18 @@
21
21
  * (nonce は返った id_token の `nonce` クレームから読む。サーバが検証済みトークンと台帳で突き合わせる)
22
22
  * 6. 結果を本体へ返し、成功なら閉じる(閉じられなければ[閉じる])
23
23
  *
24
+ * まとめて選ぶ(本体の指示に `pick: true`=受け口の `googleConfirm.pick`・cortex-engine #3142 便 CONN-DRIVE): Picker を複数選べる形で開き、
25
+ * 選んだ全部を `pick-drive-folders` に 1 回で送る(意図の baseRev・req つき)。足す=マイドライブのフォルダ・共有ドライブの 2 表示・
26
+ * 選び直す=確認が要る登録済みのフォルダ(`ids`・`setFileIds`)だけ・一番上の行(`top`)=共有ドライブだけ(nonce を行の ID に結び `replaces` を送る)。
27
+ * `pick` の無い指示(古い受け口)は今の流れ(1 つ選ぶ・旧 op/意図の add)のまま
28
+ *
24
29
  * 🔴 トークン・nonce は変数に持つだけ。storage・DOM・ログに書かない。本体へはトークンを渡さない。
25
30
  * postMessage は送り元・送り先のオリジンを確かめる(同じオリジンだけ)。
26
31
  *
27
32
  * 文言(画面に出る言葉)の正本は intake の `GOOGLE_CONFIRM_MESSAGES`。ここにあるのは、サーバに届く前の失敗の言葉だけ。
28
33
  */
29
34
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.GOOGLE_CONFIRM_SCOPES = exports.GOOGLE_CONFIRM_WINDOW_FEATURES = exports.GOOGLE_CONFIRM_CHANNEL_PREFIX = exports.GOOGLE_CONFIRM_CALLBACK_PATH = exports.GOOGLE_CONFIRM_POST_TYPES = exports.GOOGLE_CONFIRM_PAGE_FILE = void 0;
35
+ exports.GOOGLE_CONFIRM_PICK_MAX = exports.GOOGLE_CONFIRM_SCOPES = exports.GOOGLE_CONFIRM_WINDOW_FEATURES = exports.GOOGLE_CONFIRM_CHANNEL_PREFIX = exports.GOOGLE_CONFIRM_CALLBACK_PATH = exports.GOOGLE_CONFIRM_POST_TYPES = exports.GOOGLE_CONFIRM_PAGE_FILE = void 0;
31
36
  exports.googleConfirmAssetName = googleConfirmAssetName;
32
37
  exports.googleConfirmPageJs = googleConfirmPageJs;
33
38
  exports.renderGoogleConfirmPage = renderGoogleConfirmPage;
@@ -62,6 +67,8 @@ exports.GOOGLE_CONFIRM_SCOPES = {
62
67
  "google-chat": "https://www.googleapis.com/auth/chat.spaces.readonly",
63
68
  "drive-account": "https://www.googleapis.com/auth/drive.readonly",
64
69
  };
70
+ /** まとめて選べるフォルダの数の上限(受け口の `PICK_DRIVE_FOLDERS_MAX` の写し・一致はテストが見る)。Picker の `setMaxItems` と選び直しの一覧の長さに使う */
71
+ exports.GOOGLE_CONFIRM_PICK_MAX = 10;
65
72
  /** 外部ファイル名(内容ハッシュ。同じ中身なら同じ名前=全案件で同じファイル名になる) */
66
73
  function googleConfirmAssetName(js) {
67
74
  return `assets/google-confirm.${(0, node_crypto_1.createHash)("sha256").update(js, "utf8").digest("hex").slice(0, 8)}.js`;
@@ -87,6 +94,8 @@ function googleConfirmPageJs() {
87
94
  var ADMIN_NOTE = "相手の管理者がこのアプリを許可する必要があります";
88
95
  var ACCOUNT_ADMIN_BLOCKED = "管理者が Cortex のアプリを『信頼できる』にしていないため、許可できませんでした。管理者への頼みの文を渡してください";
89
96
  var FLOW_RE = /^[0-9a-f]{32}$/;
97
+ var PICK_ID_RE = /^[A-Za-z0-9_-]{10,200}$/;
98
+ var PICK_MAX = ${JSON.stringify(exports.GOOGLE_CONFIRM_PICK_MAX)};
90
99
 
91
100
  var $ = function (id) { return document.getElementById(id); };
92
101
  var titleEl = $("gc-title");
@@ -149,7 +158,7 @@ function googleConfirmPageJs() {
149
158
  hideBusy();
150
159
  goBtn.hidden = true;
151
160
  closeBtn.hidden = false;
152
- setStatus("✓ " + message + "。このウィンドウは閉じて構いません", "is-ok");
161
+ setStatus("✓ " + String(message).replace(/。$/, "") + "。このウィンドウは閉じて構いません", "is-ok");
153
162
  send(Object.assign({ type: MSG.result, ok: true, message: message }, extra || {}));
154
163
  setTimeout(function () { try { window.close(); } catch (e) { /* 閉じられなくても表示は残る */ } }, 1200);
155
164
  }
@@ -159,7 +168,7 @@ function googleConfirmPageJs() {
159
168
  hideBusy();
160
169
  goBtn.hidden = false;
161
170
  goBtn.disabled = false;
162
- goBtn.textContent = "もう一度 Google で確認する";
171
+ goBtn.textContent = ctx && ctx.pick ? "もう一度選ぶ" : "もう一度 Google で確認する";
163
172
  closeBtn.hidden = false;
164
173
  setStatus("✗ " + message, "is-error");
165
174
  send(Object.assign({ type: MSG.result, ok: false, message: message }, extra || {}));
@@ -193,6 +202,12 @@ function googleConfirmPageJs() {
193
202
  function intentBody(kind, target) {
194
203
  return { v: 1, kind: kind, action: "add", target: target, baseRev: ctx.intent.baseRev, req: ctx.intent.req };
195
204
  }
205
+ /** まとめて選んだフォルダを 1 回で送る本文(受け口の pick-drive-folders)。一番上の行の選び直しだけ replaces を添える */
206
+ function pickBody(docs) {
207
+ var body = { op: "pick-drive-folders", folderIds: docs.map(function (d) { return d.id; }), baseRev: ctx.intent.baseRev, req: ctx.intent.req };
208
+ if (ctx.mode === "confirm" && ctx.top && ctx.id) body.replaces = ctx.id;
209
+ return body;
210
+ }
196
211
  function loadInfo() {
197
212
  var intake = ctx.intake;
198
213
  var url = intake.url + (intake.url.indexOf("?") === -1 ? "?" : "&") + "op=google-confirm-info&t=" + encodeURIComponent(intake.token);
@@ -256,7 +271,10 @@ function googleConfirmPageJs() {
256
271
  document.head.appendChild(s);
257
272
  });
258
273
  }
259
- /** Picker でフォルダを選ぶ。選ばずに閉じたら null。確認(confirm)は、確かめる行のフォルダだけを出す(setFileIds は setEnableDrives・setParent と併用できないので 1 つの画面にする) */
274
+ /**
275
+ * Picker でフォルダを選ぶ。選ばずに閉じたら null。確認(confirm)は、確かめる行のフォルダだけを出す(setFileIds は setEnableDrives・setParent と併用できないので 1 つの画面にする)。
276
+ * まとめて選ぶ(ctx.pick)ときは複数を選べる形で、選んだ全部(配列)を返す。選び直しは確認が要る行の全部(ctx.ids)・一番上の行は共有ドライブの表示だけ
277
+ */
260
278
  function pickFolder(info, accessToken) {
261
279
  return loadScript("https://apis.google.com/js/api.js")
262
280
  .then(function () { return new Promise(function (resolve) { window.gapi.load("picker", { callback: resolve }); }); })
@@ -270,7 +288,13 @@ function googleConfirmPageJs() {
270
288
  .setDeveloperKey(info.apiKey)
271
289
  .setOAuthToken(accessToken)
272
290
  .enableFeature(g.Feature.SUPPORT_DRIVES);
273
- if (ctx.mode === "confirm" && ctx.id) {
291
+ if (ctx.pick) builder = builder.enableFeature(g.Feature.MULTISELECT_ENABLED).setMaxItems(PICK_MAX);
292
+ if (ctx.pick && ctx.mode === "confirm" && ctx.top) {
293
+ builder = builder.addView(shared);
294
+ } else if (ctx.pick && ctx.mode === "confirm") {
295
+ var listed = new g.DocsView(g.ViewId.FOLDERS).setIncludeFolders(true).setSelectFolderEnabled(true).setMimeTypes("application/vnd.google-apps.folder").setFileIds(ctx.ids.join(","));
296
+ builder = builder.addView(listed);
297
+ } else if (ctx.mode === "confirm" && ctx.id) {
274
298
  var only = new g.DocsView(g.ViewId.FOLDERS).setIncludeFolders(true).setSelectFolderEnabled(true).setMimeTypes("application/vnd.google-apps.folder").setFileIds(ctx.id);
275
299
  builder = builder.addView(only);
276
300
  } else {
@@ -278,7 +302,7 @@ function googleConfirmPageJs() {
278
302
  }
279
303
  var picker = builder
280
304
  .setCallback(function (data) {
281
- if (data.action === g.Action.PICKED && data.docs && data.docs[0]) resolve(data.docs[0]);
305
+ if (data.action === g.Action.PICKED && data.docs && data.docs[0]) resolve(ctx.pick ? data.docs.filter(function (d) { return d && typeof d.id === "string"; }) : data.docs[0]);
282
306
  else if (data.action === g.Action.CANCEL) resolve(null);
283
307
  })
284
308
  .build();
@@ -317,6 +341,8 @@ function googleConfirmPageJs() {
317
341
  info = i;
318
342
  var body = { op: "google-nonce", kind: ctx.kind };
319
343
  if (ctx.kind === "google-chat") body.url = ctx.url || ctx.id;
344
+ // まとめて選ぶ: 一番上の行の選び直しだけ nonce を行の ID に結ぶ(受け口は replaces と同じ ID の nonce を求める)。ほかは ID の空の nonce
345
+ else if (ctx.pick) { if (ctx.mode === "confirm" && ctx.top && ctx.id) body.folderId = ctx.id; }
320
346
  else if (ctx.id) body.folderId = ctx.id;
321
347
  return callIntake(body);
322
348
  })
@@ -372,7 +398,11 @@ function googleConfirmPageJs() {
372
398
  return callIntake(Object.assign({ op: "connect-drive-account" }, tokens));
373
399
  }
374
400
  if (ctx.kind === "drive") {
375
- if (!picked) throw { message: "フォルダを選ばずに閉じられました。もう一度押してください" };
401
+ if (!picked || (ctx.pick && !picked.length)) throw { message: "フォルダを選ばずに閉じられました。もう一度押してください" };
402
+ if (ctx.pick) {
403
+ showBusy("保存しています…", "終わるまでこの窓を閉じずにお待ちください");
404
+ return callIntake(Object.assign(pickBody(picked), tokens));
405
+ }
376
406
  if (ctx.mode === "confirm") showBusy("確認しています…");
377
407
  else showBusy("保存しています…", "終わるまでこの窓を閉じずにお待ちください");
378
408
  body = ctx.mode === "confirm"
@@ -390,6 +420,11 @@ function googleConfirmPageJs() {
390
420
  if (r.status === 200 && ctx.kind === "drive-account") {
391
421
  // 応答はアドレスだけ(本体は state を取り直して宛先を出す)
392
422
  succeed("許可しました", { changed: true, status: 200 });
423
+ } else if (ctx.pick) {
424
+ // まとめて選ぶ: 文は受け口の message をそのまま。途中で止まった(200 以外)も、足せた分があれば本体は一覧を取り直す
425
+ var savedN = typeof r.body.saved === "number" ? r.body.saved : 0;
426
+ if (r.status === 200) succeed(r.body.message || "確認しました", { changed: savedN > 0 || r.body.replaced === true, status: 200 });
427
+ else retryable(r.body.message || "追加できませんでした", { status: r.status, code: r.body.code || null, changed: savedN > 0 });
393
428
  } else if (r.status === 200) {
394
429
  succeed(r.body.message || "確認しました", { changed: r.body.changed !== false, status: 200 });
395
430
  } else {
@@ -417,13 +452,20 @@ function googleConfirmPageJs() {
417
452
  if (d.kind !== "drive" && d.kind !== "google-chat" && d.kind !== "drive-account") return;
418
453
  flow = d.flow;
419
454
  ctx = { intake: d.intake, ticket: typeof d.ticket === "string" ? d.ticket : null, kind: d.kind, mode: d.kind === "drive-account" ? "connect" : d.mode === "confirm" ? "confirm" : "add", url: typeof d.url === "string" ? d.url : "", id: d.kind === "drive-account" ? "" : typeof d.id === "string" ? d.id : "", intent: d.kind === "drive-account" ? null : intentOf(d.intent) };
455
+ // まとめて選ぶ(Drive・意図が揃っているときだけ。揃わなければ今の流れ)。選び直しの一覧は形の合う ID だけ・押した行を先頭に・PICK_MAX(10)まで
456
+ ctx.pick = d.pick === true && ctx.kind === "drive" && !!ctx.intent;
457
+ ctx.top = ctx.pick && ctx.mode === "confirm" && d.top === true && !!ctx.id;
458
+ ctx.ids = !ctx.pick ? [] : [ctx.id].concat(Array.isArray(d.ids) ? d.ids : []).filter(function (x, i, a) { return typeof x === "string" && PICK_ID_RE.test(x) && a.indexOf(x) === i; }).slice(0, PICK_MAX);
459
+ if (ctx.pick && ctx.mode === "confirm" && !ctx.top && !ctx.ids.length) ctx.pick = false;
420
460
  var isDrive = ctx.kind === "drive";
421
461
  var what = isDrive ? "Drive のフォルダ" : "Google Chat のスペース";
422
- titleEl.textContent = (ctx.mode === "confirm" ? what + "を確認する" : what + "を追加する");
462
+ titleEl.textContent = (ctx.mode === "confirm" ? what + (ctx.pick ? "を選び直す" : "を確認する") : what + "を追加する");
423
463
  // 入口②の文はオーナー OK(T134・10/31・便 RS-T85g §8)
424
464
  if (ctx.kind === "drive-account") titleEl.textContent = "Cortex 用アカウントで許可する";
425
465
  leadEl.textContent = ctx.kind === "drive-account"
426
466
  ? "御社の Cortex 用の Google アカウント(人のアカウントではなく、Cortex のために作ったもの)を選んで、Google ドライブの読み取りを 1 回だけ許可してください。"
467
+ : isDrive && ctx.pick
468
+ ? (ctx.top ? "共有ドライブの直下のフォルダを選びます。" : ctx.mode === "confirm" ? "読ませるフォルダを選び直します。" : "あなたの Google アカウントで、読ませるフォルダを選びます。") + "「このアプリは Google で確認されていません」と出たら、「詳細」から進めます。"
427
469
  : isDrive
428
470
  ? (ctx.mode === "confirm" && ctx.id ? "登録済みのフォルダを、あなたの Google アカウントで開けるか確かめます。出てきたフォルダを選んで[Select]を押してください。" : "あなたの Google アカウントで、追加するフォルダを選びます。") + "選んだフォルダだけを Cortex が確認に使います。「このアプリは Google で確認されていません」と出たら、「詳細」から進めます。"
429
471
  : "あなたの Google アカウントで、このスペースを開けるかを確認します。メッセージは読みません。";
@@ -22,7 +22,8 @@ exports.TENANT_INTAKE_TABLES = {
22
22
  // `project-icon-*` はプロジェクトのアイコンを置く・外す(cortex-engine #2503 便 ICON-VIEWER・受け口の表と同じ)
23
23
  ops: ["state", "config", "probe", "secret", "slack-oauth-start", "google-confirm-info", "memory-refresh", "memory-runs", "memory-history", "memory-report", "member-list", "member-preview", "member-invite", "member-remove", "project-info", "project-info-update", "project-icon-set", "project-icon-remove"],
24
24
  // Google の確認の 3 つ(便 RS-T85f 続き)と Drive の入口②の許可(便 RS-T85g・受け口の `TENANT_INTAKE_GOOGLE_PAYLOAD_OPS`)。種別は op で決まるか、google-nonce は本文の kind
25
- configPayloadOps: ["google-nonce", "confirm-drive-folder", "confirm-google-chat-space", "connect-drive-account"],
25
+ // まとめて選ぶ `pick-drive-folders`(種別 drive・cortex-engine #3142 便 CONN-DRIVE・受け口の表と同じ)
26
+ configPayloadOps: ["google-nonce", "confirm-drive-folder", "confirm-google-chat-space", "connect-drive-account", "pick-drive-folders"],
26
27
  configKinds: ["github", "backlog", "slack", "drive", "google-chat", "memory"],
27
28
  probeTypes: ["github", "backlog", "slack"],
28
29
  secretKinds: ["backlog"],
@@ -53,7 +54,7 @@ function tenantIntakeOpen(op, body, t) {
53
54
  // 受け口の `tenantIntakeConfigGate`: 中の op は Google の確認の 3 つと入口②の許可だけ。種別は op で決まる(google-nonce は本文の kind)・Google の種別だけ
54
55
  if (typeof p.op !== "string" || t.configPayloadOps.indexOf(p.op) < 0)
55
56
  return false;
56
- const kind = p.op === "confirm-drive-folder" ? "drive" : p.op === "confirm-google-chat-space" ? "google-chat" : p.op === "connect-drive-account" ? "drive-account" : p.kind;
57
+ const kind = p.op === "confirm-drive-folder" || p.op === "pick-drive-folders" ? "drive" : p.op === "confirm-google-chat-space" ? "google-chat" : p.op === "connect-drive-account" ? "drive-account" : p.kind;
57
58
  return typeof kind === "string" && Object.prototype.hasOwnProperty.call(t.googleKinds, kind);
58
59
  }
59
60
  return typeof p.kind === "string" && t.configKinds.indexOf(p.kind) >= 0;
@@ -11,6 +11,8 @@ exports.inviteResultLineOf = inviteResultLineOf;
11
11
  exports.removeResultLineOf = removeResultLineOf;
12
12
  exports.memberErrorLineOf = memberErrorLineOf;
13
13
  exports.memberRowsOf = memberRowsOf;
14
+ exports.termNameProblemOf = termNameProblemOf;
15
+ exports.addTermTo = addTermTo;
14
16
  exports.projectNameProblemOf = projectNameProblemOf;
15
17
  /**
16
18
  * メンバーのページ・プロジェクトの情報・旗の出し分け(cortex-engine #2897 便 RAIL-T4・設計 #2860 確定版 §4・§5・§7 T4)。
@@ -68,7 +70,13 @@ function abilitiesOf(ans) {
68
70
  const a = ans && typeof ans === "object" ? ans : {};
69
71
  const o = a.abilities && typeof a.abilities === "object" ? a.abilities : {};
70
72
  const b = (v) => (typeof v === "boolean" ? v : null);
71
- return { manageMembers: b(o.canManageMembers), requestInvite: b(o.canRequestInvite), classify: b(o.canClassify), setIcon: b(o.canSetIcon) };
73
+ return {
74
+ manageMembers: b(o.canManageMembers),
75
+ requestInvite: b(o.canRequestInvite),
76
+ classify: b(o.canClassify),
77
+ addClassificationTerms: b(o.canAddClassificationTerms),
78
+ setIcon: b(o.canSetIcon),
79
+ };
72
80
  }
73
81
  /** この呼び出しを つなぎ先の旗で止めるか(旗が false のときだけ・時計の config は止めない)。ops は SOURCE_EDIT_OPS(引数で受ける・純関数に保つ) */
74
82
  function sourceEditBlocked(op, body, rights, ops) {
@@ -228,6 +236,30 @@ function memberRowsOf(ans) {
228
236
  }
229
237
  return rows;
230
238
  }
239
+ /**
240
+ * 部署・業種・技術の自由入力の検め(ポータルの作る時の画面 projectSetup.ts の termNameProblem・サーバーの collectTermNameProblems と同じ規則)。
241
+ * 空は不可・前後の空白を落として 50 字以内・" と \ と制御文字(改行を含む。U+0000–U+001F・U+007F)は不可(空白を落とす前の値で見る)。
242
+ * 通れば null、だめなら 1 行(文はポータルの作る時と同じ)。cortex-engine #2958 便 CLASS-FREE
243
+ */
244
+ function termNameProblemOf(label, value) {
245
+ const raw = typeof value === "string" ? value : "";
246
+ const v = raw.trim();
247
+ if (v === "")
248
+ return label + "を入力してください";
249
+ if (v.length > 50)
250
+ return label + "は50文字以内で入力してください";
251
+ if (/["\\\u0000-\u001f\u007f]/.test(raw))
252
+ return label + 'に改行・制御文字・" と \\ は使えません';
253
+ return null;
254
+ }
255
+ /** 技術の並びに 1 つ足した並び(ポータルの addPlatform と同じ: 前後の空白を落として比べ、同じ語は 2 つにしない・空は足さない) */
256
+ function addTermTo(list, name) {
257
+ const xs = Array.isArray(list) ? list.filter((x) => typeof x === "string") : [];
258
+ const t = typeof name === "string" ? name.trim() : "";
259
+ if (t === "" || xs.some((x) => x.trim() === t))
260
+ return xs.slice();
261
+ return xs.concat([t]);
262
+ }
231
263
  /** 案件名・顧客名の検め(ポータルの ProjectClassificationForm と同じ線: 必須〈案件名〉・100 字・「{{」なし)。通れば null、だめなら 1 行 */
232
264
  function projectNameProblemOf(label, value, required) {
233
265
  const v = typeof value === "string" ? value.trim() : "";
package/dist/render.js CHANGED
@@ -5202,6 +5202,10 @@ a:hover { text-decoration: underline; }
5202
5202
  .project-info-tech { border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
5203
5203
  .project-info-tech legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
5204
5204
  .project-info-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
5205
+ .project-info-field .project-info-other { margin-top: 6px; }
5206
+ .project-info-other-row { flex: 1 1 100%; display: flex; align-items: center; gap: 6px; }
5207
+ .project-info-other-row .project-info-other { margin-top: 0; flex: 1 1 auto; min-width: 0; }
5208
+ .project-info-other-row button { flex: none; white-space: nowrap; }
5205
5209
  /* 更新の記録(cortex-engine #2894 便 RAIL-T3)。一覧は 1 回 1 行・押すとその回のページ。その回は「できた記憶・変わった記憶」→「この回に入った材料」 */
5206
5210
  .runs h2 { margin: 0 0 12px; font-size: 20px; }
5207
5211
  .runs-months { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 13px; }
@@ -7027,7 +7031,7 @@ const CLIENT_JS = `
7027
7031
  }
7028
7032
  function googleInfoSigOf(i) {
7029
7033
  if (!i) return "";
7030
- return JSON.stringify([i.enabled === true, i.ready === true, i.confirmed || null]);
7034
+ return JSON.stringify([i.enabled === true, i.ready === true, i.confirmed || null, i.gate === false, i.pick === true]);
7031
7035
  }
7032
7036
  // 組織の Google の栓(op=state の tenantGoogle)も入れる(栓の答えが届いたら Google の欄を描き直す・便 RS-T85f 続き)
7033
7037
  function googleInfoSig() { return googleInfoSigOf(googleInfo) + JSON.stringify(LIVE_TENANT_GOOGLE); }
@@ -7133,6 +7137,24 @@ const CLIENT_JS = `
7133
7137
  return el("p", { class: "sec-how", text: TENANT_GCHAT_CUSTOMER_NOTE });
7134
7138
  }
7135
7139
  function googleConfirmOn() { return !!googleInfo && googleInfo.enabled === true; }
7140
+ /** 確認の門が掛からない受け口(運営の組織・googleConfirm.gate が false)。行は読まれているので確認の一手を出さない。gate の無い古い答えは false(今のまま出す) */
7141
+ function googleGateOff() { return !!googleInfo && googleInfo.gate === false; }
7142
+ /** まとめて選ぶ op を受ける受け口か(googleConfirm.pick・cortex-engine #3142 便 CONN-DRIVE) */
7143
+ function googlePickOn() { return !!googleInfo && googleInfo.pick === true; }
7144
+ /**
7145
+ * 共有ドライブの一番上の行の手がかり(共有ドライブの ID の形)。🔴 画面の見分けはこの手がかりだけ。正は受け口(Google の driveId で決める)。
7146
+ * 外れても、選び直しの表示に出るだけで、受け口が正しく扱う
7147
+ */
7148
+ var DRIVE_TOP_ID_RE = /^0A[A-Za-z0-9_-]{8,}Uk9PVA$/;
7149
+ /** 選び直しで Picker に出す、確認が要る登録済みの Drive の行の ID(押した行を先頭・一番上の形の物は除く) */
7150
+ function googleDriveRepickIds(id) {
7151
+ var out = [id];
7152
+ configSourceRows(CONFIG, "drive").forEach(function (row) {
7153
+ var ref = row && row.ref;
7154
+ if (typeof ref === "string" && ref !== id && !DRIVE_TOP_ID_RE.test(ref) && !googleConfirmedHas("drive", ref)) out.push(ref);
7155
+ });
7156
+ return out;
7157
+ }
7136
7158
  function googleConfirmReady() { return googleConfirmOn() && googleInfo.ready === true; }
7137
7159
  function googleConfirmedHas(kind, id) {
7138
7160
  var c = googleInfo && googleInfo.confirmed;
@@ -7166,9 +7188,16 @@ const CLIENT_JS = `
7166
7188
  }
7167
7189
  var intake = SITE.intake;
7168
7190
  // 設定の表の案件の追加(便 DS-8b): 窓が意図の形(baseRev・req つき)で保存する。req は 1 回の確認のあいだ同じ値(押し直しは同じ意図)
7169
- var tableAdd = opts.mode === "add" && viewMode() === "table";
7191
+ // まとめて選ぶ(opts.pick)ときは、選び直し(mode: confirm)でも意図を渡す(受け口の pick-drive-folders は baseRev・req を求める)
7192
+ var tableAdd = (opts.mode === "add" && viewMode() === "table") || opts.pick === true;
7170
7193
  if (tableAdd && !CONFIG) { resolve({ ok: false, message: "設定を読み込めていません。少し待ってからもう一度押してください" }); return; }
7171
7194
  var intent = tableAdd ? { baseRev: CONFIG.rev, req: configNewReq(Date.now(), configRandomHex()) } : null;
7195
+ // まとめて選ぶ: 受け口は件ごとに req を派生させ、直近の保存の req と比べる。押し直し(Google から戻るたびの指示)で同じ req を使うと
7196
+ // 途中まで足した後に REQ_MISMATCH になるので、指示を払い出すたびに req と baseRev(今の CONFIG.rev)を作り直す
7197
+ function intentNow() {
7198
+ if (opts.pick === true && intent && CONFIG) intent = { baseRev: CONFIG.rev, req: configNewReq(Date.now(), configRandomHex()) };
7199
+ return intent;
7200
+ }
7172
7201
  var flow = gcRandomFlow();
7173
7202
  var win = window.open(new URL(GC_PAGE, location.href).href, "cortex-google-confirm", gcWindowFeatures());
7174
7203
  if (!win) { resolve({ ok: false, message: "ポップアップが開けませんでした。ブラウザのポップアップを許可して、もう一度押してください" }); return; }
@@ -7211,7 +7240,12 @@ const CLIENT_JS = `
7211
7240
  url: opts.url || "",
7212
7241
  id: opts.id || "",
7213
7242
  };
7214
- if (intent) start.intent = intent;
7243
+ if (intentNow()) start.intent = intent;
7244
+ if (opts.pick === true) {
7245
+ start.pick = true;
7246
+ if (Array.isArray(opts.ids)) start.ids = opts.ids;
7247
+ if (opts.top === true) start.top = true;
7248
+ }
7215
7249
  target(start);
7216
7250
  }
7217
7251
  function handle(data, replyTo) {
@@ -7226,7 +7260,11 @@ const CLIENT_JS = `
7226
7260
  // 失敗として返したあとに成功が届いたら、一覧だけ取り直す
7227
7261
  if (resolved) afterGoogleConfirm();
7228
7262
  end({ ok: true, message: data.message, changed: data.changed });
7229
- } else if (!resolved) last = { message: typeof data.message === "string" ? data.message : null };
7263
+ } else {
7264
+ // まとめて選ぶで途中まで足せた(changed)ときは、失敗でも一覧を取り直す
7265
+ if (data.changed === true) afterGoogleConfirm();
7266
+ if (!resolved) last = { message: typeof data.message === "string" ? data.message : null };
7267
+ }
7230
7268
  }
7231
7269
  }
7232
7270
  function viaChannel(msg) { try { if (channel) channel.postMessage(msg); } catch (e) { /* 閉じている */ } }
@@ -7283,7 +7321,8 @@ const CLIENT_JS = `
7283
7321
  });
7284
7322
  return slot;
7285
7323
  }
7286
- /** Drive の追加欄(栓が入っているとき)。URL の貼り付けは無く、[Google で選ぶ]だけ */
7324
+ var GOOGLE_DRIVE_PICK_NOTE = "共有ドライブは、その直下のフォルダを選んでください(まとめて選べます)。";
7325
+ /** Drive の追加欄(栓が入っているとき)。URL の貼り付けは無く、[Google で選ぶ]だけ。まとめて選べる受け口(info.pick)では 1 行の案内を添える */
7287
7326
  function googleDriveAddBox(info) {
7288
7327
  var msg = el("div", { class: "ds-toggle-msg" });
7289
7328
  var btn = el("button", { class: "ds-toggle-btn", type: "button", text: "Google で選ぶ" });
@@ -7292,7 +7331,7 @@ const CLIENT_JS = `
7292
7331
  btn.disabled = true;
7293
7332
  msg.className = "ds-toggle-msg";
7294
7333
  msg.textContent = "Google の画面で選んでください…";
7295
- var r = await openGoogleConfirm({ kind: "drive", mode: "add" });
7334
+ var r = await openGoogleConfirm(info.pick === true ? { kind: "drive", mode: "add", pick: true } : { kind: "drive", mode: "add" });
7296
7335
  btn.disabled = false;
7297
7336
  msg.className = "ds-toggle-msg" + (r.ok ? " is-ok" : " is-error");
7298
7337
  msg.textContent = (r.ok ? "✓ " : "✗ ") + r.message;
@@ -7300,6 +7339,7 @@ const CLIENT_JS = `
7300
7339
  });
7301
7340
  return el("div", { class: "ds-addform", "data-adder": "google-drive" }, [
7302
7341
  el("div", { class: "ds-addform-title", text: "+ Google Drive のフォルダを追加" }),
7342
+ info.pick === true ? el("p", { class: "sec-how", text: GOOGLE_DRIVE_PICK_NOTE }) : null,
7303
7343
  el("div", { class: "ds-toggle" }, [btn, msg]),
7304
7344
  ]);
7305
7345
  }
@@ -7325,9 +7365,12 @@ const CLIENT_JS = `
7325
7365
  */
7326
7366
  function googleVerifyAction(kind, id, btnClass) {
7327
7367
  if (!intakeKindOpen(kind)) return null;
7328
- if (!googleConfirmReady() || googleConfirmedHas(kind, id)) return null;
7368
+ if (!googleConfirmReady() || googleConfirmedHas(kind, id) || googleGateOff()) return null;
7369
+ var top = kind === "drive" && DRIVE_TOP_ID_RE.test(id);
7370
+ // Drive の語の差し替えは、まとめて選ぶ受け口(pick)の時だけ。pick の無い古い受け口は今の語のまま(一番上の行も選び直せないので出し分けない)
7371
+ var words = kind !== "drive" ? GOOGLE_VERIFY_WORDS.chat : !googlePickOn() ? GOOGLE_VERIFY_WORDS.driveLegacy : top ? GOOGLE_VERIFY_WORDS.driveTop : GOOGLE_VERIFY_WORDS.drive;
7329
7372
  var msg = el("div", { class: "ds-toggle-msg src-gverify-msg" });
7330
- var btn = el("button", { class: btnClass, type: "button", text: "Google で確認する", "data-src-act": "google-verify" });
7373
+ var btn = el("button", { class: btnClass, type: "button", text: words.btn, "data-src-act": "google-verify" });
7331
7374
  // 行が保存中・確認中で押せなくしているか。押した後に押せるへ戻すのは、行が止めていないときだけ(便 S44-5d-CI3)
7332
7375
  var locked = false;
7333
7376
  btn.addEventListener("click", async function () {
@@ -7335,7 +7378,13 @@ const CLIENT_JS = `
7335
7378
  btn.disabled = true;
7336
7379
  msg.className = "ds-toggle-msg src-gverify-msg";
7337
7380
  msg.textContent = "Google の画面で確認してください…";
7338
- var r = await openGoogleConfirm({ kind: kind, mode: "confirm", id: id, url: id });
7381
+ var opts = { kind: kind, mode: "confirm", id: id, url: id };
7382
+ if (kind === "drive" && googlePickOn()) {
7383
+ opts.pick = true;
7384
+ opts.top = top;
7385
+ opts.ids = top ? [id] : googleDriveRepickIds(id);
7386
+ }
7387
+ var r = await openGoogleConfirm(opts);
7339
7388
  btn.disabled = locked;
7340
7389
  msg.className = "ds-toggle-msg src-gverify-msg" + (r.ok ? " is-ok" : " is-error");
7341
7390
  msg.textContent = (r.ok ? "✓ " : "✗ ") + r.message;
@@ -7343,13 +7392,13 @@ const CLIENT_JS = `
7343
7392
  });
7344
7393
  /** 行の止め(保存中・確認中)を写す。ボタンの disabled を直に書かず、これを通す */
7345
7394
  function setLocked(v) { locked = !!v; btn.disabled = locked; }
7346
- return { btn: btn, msg: msg, setLocked: setLocked };
7395
+ return { btn: btn, msg: msg, why: words.why, setLocked: setLocked };
7347
7396
  }
7348
7397
  /** 今ある行の「未確認」の印と[確認する](確認済みの行には何も足さない・期限で外さない) */
7349
7398
  function appendGoogleVerifyUi(row, kind, id) {
7350
7399
  // 組織の受け口は Google の接続先を受けない(確認の結果を保存する口が閉じている)
7351
7400
  if (!intakeKindOpen(kind)) return;
7352
- if (!googleConfirmReady() || googleConfirmedHas(kind, id)) return;
7401
+ if (!googleConfirmReady() || googleConfirmedHas(kind, id) || googleGateOff()) return;
7353
7402
  var msg = el("span", { class: "ds-toggle-msg" });
7354
7403
  var btn = el("button", { class: "ds-toggle-btn", type: "button", text: "確認する" });
7355
7404
  btn.addEventListener("click", async function () {
@@ -7418,6 +7467,8 @@ ${member_page_1.removeResultLineOf.toString()}
7418
7467
  ${member_page_1.memberErrorLineOf.toString()}
7419
7468
  ${member_page_1.memberRowsOf.toString()}
7420
7469
  ${member_page_1.projectNameProblemOf.toString()}
7470
+ ${member_page_1.termNameProblemOf.toString()}
7471
+ ${member_page_1.addTermTo.toString()}
7421
7472
  var PROJECT_ICON_TYPES = ${JSON.stringify(project_icon_edit_1.PROJECT_ICON_TYPES)};
7422
7473
  var PROJECT_ICON_SHRINK = ${JSON.stringify(project_icon_edit_1.PROJECT_ICON_SHRINK)};
7423
7474
  ${project_icon_edit_1.projectIconTypeOk.toString()}
@@ -7584,6 +7635,7 @@ ${config_flow_1.configRemoveConfirmLines.toString()}
7584
7635
  ${config_flow_1.configDuplicateLines.toString()}
7585
7636
  // 組み直したプロジェクトの接続先の行(便 S44-5a)。🔴 表の 8 行を落とすと、流し込んだ関数が未定義を参照して操作タブが描けない
7586
7637
  var SOURCE_ROW_TOOLS = ${JSON.stringify(source_rows_1.SOURCE_ROW_TOOLS)};
7638
+ var SOURCE_JOIN_STEPS = ${JSON.stringify(source_rows_1.SOURCE_JOIN_STEPS)};
7587
7639
  var SOURCE_REASON_TEXT = ${JSON.stringify(source_rows_1.SOURCE_REASON_TEXT)};
7588
7640
  var SOURCE_NEXT_TAIL_CHECK = ${JSON.stringify(source_rows_1.SOURCE_NEXT_TAIL_CHECK)};
7589
7641
  var SOURCE_NEXT_TAIL_AUTO = ${JSON.stringify(source_rows_1.SOURCE_NEXT_TAIL_AUTO)};
@@ -10311,7 +10363,9 @@ ${story_1.evidenceToggleHidden.toString()}
10311
10363
  }
10312
10364
  /**
10313
10365
  * 分類(案件名・顧客名・区分・部署・業種・技術)。変えられるかはポータルの答えの abilities.canClassify(オーナーの答え Q5)。
10314
- * 選び肢に無い新しい言葉はここでは足さない(当社の管理者がポータルの管理の画面で足す)。
10366
+ * 選び肢に無い新しい言葉をその場で足せるのは、答えの abilities.canAddClassificationTerms が真の人だけ(案件の組織の社内のメンバー・
10367
+ * ポータルの作る時の画面と同じ「その他(自由入力)」の形。cortex-engine #2958 便 CLASS-FREE)。旗が無い古いポータルでは足す欄を出さない。
10368
+ * 足した語はポータルが案件の組織のマスタに入れるので、保存できたら選び肢(known)に入れ、「(マスタに無い値)」を付けない。
10315
10369
  * 分類できない案件(classifiable が真でない・欄が無い)では分類の節を出さない(設計レビューの直し)。
10316
10370
  * 答えの形(ポータルの ProjectInfoResponse のまま): { ok, info: { displayName, clientName, kind, org, industry, tech: [] }, choices?: { kind: [], org: [], industry: [], tech: [] }, classifiable, abilities }。
10317
10371
  * 真偽の欄は info に入らない。値は info から読む(null は未設定)。
@@ -10340,6 +10394,15 @@ ${story_1.evidenceToggleHidden.toString()}
10340
10394
  }
10341
10395
  var form = el("form", { class: "project-info-form", novalidate: "novalidate" });
10342
10396
  var fields = {};
10397
+ // 🔴 足す欄は旗が真のときだけ(旗の無い古いポータル・基盤の管理者がお客様の案件を直すときは出さない)
10398
+ var canAdd = ABILITIES.addClassificationTerms === true;
10399
+ // 「その他(自由入力)」の行の値(ポータルの OTHER_OPTION と同じ)
10400
+ var OTHER = "__other__";
10401
+ // 欄ごとの選び肢(保存できたら足した語を入れる)
10402
+ var knownOf = {};
10403
+ // 技術の自由入力を並びに足す(通れば null・だめなら 1 行。足す欄が無ければ何もしない)
10404
+ var addTech = function () { return null; };
10405
+ var line = el("p", { class: "member-note", "aria-live": "polite" });
10343
10406
  labels.forEach(function (lb) {
10344
10407
  var key = lb[0];
10345
10408
  var id = "project-info-" + key;
@@ -10356,7 +10419,42 @@ ${story_1.evidenceToggleHidden.toString()}
10356
10419
  fields.tech.push(cb);
10357
10420
  fs.appendChild(el("label", { class: "project-info-check" }, [cb, document.createTextNode(known.indexOf(t) < 0 ? t + UNKNOWN : t)]));
10358
10421
  });
10359
- if (!opts.length) fs.appendChild(el("p", { class: "member-note", text: "選べる技術がありません" }));
10422
+ var noTech = opts.length ? null : el("p", { class: "member-note", text: "選べる技術がありません" });
10423
+ if (noTech) fs.appendChild(noTech);
10424
+ knownOf.tech = known;
10425
+ if (canAdd) {
10426
+ // 🔴 打っただけでは並びに足さない(「追加する」で足す・ポータルの作る時と同じ)。保存の時に欄に残った語は足してから送る
10427
+ var techOther = el("input", { type: "text", class: "project-info-other", "aria-label": "技術(自由入力)" });
10428
+ var techAdd = el("button", { type: "button", class: "ds-toggle-btn", text: "追加する" });
10429
+ var techRow = el("div", { class: "project-info-other-row" }, [techOther, techAdd]);
10430
+ fields.techOther = techOther;
10431
+ addTech = function () {
10432
+ var raw = techOther.value;
10433
+ if (!raw.trim()) return null;
10434
+ var bad = termNameProblemOf("技術", raw);
10435
+ if (bad) return bad;
10436
+ var name = raw.trim();
10437
+ var now = fields.tech.map(function (cb) { return cb.value; });
10438
+ if (addTermTo(now, name).length === now.length) {
10439
+ // 同じ語(前後の空白を落として比べる)は行を増やさず、その行に印を付ける
10440
+ fields.tech.forEach(function (cb) { if (cb.value.trim() === name) cb.checked = true; });
10441
+ } else {
10442
+ var ncb = el("input", { type: "checkbox", value: name });
10443
+ ncb.checked = true;
10444
+ fields.tech.push(ncb);
10445
+ fs.insertBefore(el("label", { class: "project-info-check" }, [ncb, document.createTextNode(name)]), techRow);
10446
+ if (noTech && noTech.parentNode) noTech.parentNode.removeChild(noTech);
10447
+ }
10448
+ techOther.value = "";
10449
+ return null;
10450
+ };
10451
+ techAdd.addEventListener("click", function () {
10452
+ var bad = addTech();
10453
+ line.textContent = bad || "";
10454
+ line.className = bad ? "member-note is-error" : "member-note";
10455
+ });
10456
+ fs.appendChild(techRow);
10457
+ }
10360
10458
  wrap.appendChild(fs);
10361
10459
  } else if (key === "displayName" || key === "clientName") {
10362
10460
  wrap.appendChild(el("label", { for: id, text: lb[1] }));
@@ -10391,25 +10489,62 @@ ${story_1.evidenceToggleHidden.toString()}
10391
10489
  sel.value = key === "kind" && unknown ? "" : cur[key];
10392
10490
  fields[key] = sel;
10393
10491
  wrap.appendChild(sel);
10492
+ knownOf[key] = choices;
10493
+ // 部署・業種: 末尾に「その他(自由入力)」。選ぶと入力欄が出る(ポータルの作る時と同じ言葉)。区分は対象外
10494
+ if (canAdd && key !== "kind") {
10495
+ sel.appendChild(el("option", { value: OTHER, text: "その他(自由入力)" }));
10496
+ var other = el("input", { type: "text", class: "project-info-other", "aria-label": lb[1] + "(自由入力)" });
10497
+ other.hidden = true;
10498
+ fields[key + "Other"] = other;
10499
+ sel.addEventListener("change", function () { other.hidden = sel.value !== OTHER; });
10500
+ wrap.appendChild(other);
10501
+ }
10394
10502
  }
10395
10503
  form.appendChild(wrap);
10396
10504
  });
10397
10505
  var save = el("button", { type: "submit", class: "ds-toggle-btn member-primary", text: "保存する" });
10398
- var line = el("p", { class: "member-note", "aria-live": "polite" });
10506
+ // 部署・業種の値(「その他(自由入力)」なら入力欄の値・前後の空白を落とす)
10507
+ var pick = function (key) {
10508
+ var sel = fields[key];
10509
+ return sel.value === OTHER ? fields[key + "Other"].value.trim() : sel.value;
10510
+ };
10399
10511
  form.appendChild(el("div", { class: "project-info-actions" }, [save]));
10400
10512
  form.appendChild(line);
10513
+ /** 保存できた後、自由入力で足した部署・業種を選び肢の行に移す(技術は足した時に印の無い行で出している) */
10514
+ var settleAdded = function (send) {
10515
+ ["org", "industry"].forEach(function (key) {
10516
+ var sel = fields[key];
10517
+ var v = send[key];
10518
+ if (!sel || typeof v !== "string" || !v || sel.value !== OTHER) return;
10519
+ var known = knownOf[key] || [];
10520
+ if (known.indexOf(v) < 0) known.push(v);
10521
+ var has = [].slice.call(sel.options).some(function (o) { return o.value === v; });
10522
+ if (!has) sel.insertBefore(el("option", { value: v, text: v }), sel.querySelector('option[value="' + OTHER + '"]'));
10523
+ sel.value = v;
10524
+ fields[key + "Other"].value = "";
10525
+ fields[key + "Other"].hidden = true;
10526
+ });
10527
+ (send.tech || []).forEach(function (t) { if (knownOf.tech && knownOf.tech.indexOf(t) < 0) knownOf.tech.push(t); });
10528
+ };
10401
10529
  form.addEventListener("submit", function (e) {
10402
10530
  e.preventDefault();
10531
+ // 🔴 送る前に手元でも形を見る(ポータルの作る時と同じ規則・同じ文)。自由入力の欄の生の値で見る
10532
+ var termBad = null;
10533
+ [["org", "部署"], ["industry", "業種"]].forEach(function (p) {
10534
+ if (!termBad && fields[p[0]] && fields[p[0]].value === OTHER) termBad = termNameProblemOf(p[1], fields[p[0] + "Other"].value);
10535
+ });
10536
+ // 技術の欄に打ったまま「追加する」を押していない語も、足してから送る(ポータルの作る時と同じ)
10537
+ if (!termBad) termBad = addTech();
10403
10538
  var next = {
10404
10539
  displayName: fields.displayName.value.trim(),
10405
10540
  clientName: fields.clientName.value.trim(),
10406
10541
  kind: fields.kind.value,
10407
- org: fields.org ? fields.org.value : cur.org,
10408
- industry: fields.industry.value,
10542
+ org: fields.org ? pick("org") : cur.org,
10543
+ industry: pick("industry"),
10409
10544
  tech: fields.tech.filter(function (cb) { return cb.checked; }).map(function (cb) { return cb.value; }),
10410
10545
  };
10411
10546
  var bad = projectNameProblemOf("案件名", next.displayName, true) || projectNameProblemOf("顧客名", next.clientName, false) ||
10412
- (next.kind ? null : "区分を選んでください");
10547
+ (next.kind ? null : "区分を選んでください") || termBad;
10413
10548
  if (bad) { line.textContent = bad; line.className = "member-note is-error"; return; }
10414
10549
  // 🔴 変わった欄だけ送る(案件の Home.md の差分を増やさない・ポータルと同じ)。部署は空にしない(空なら送らない)。業種の「なし」は null
10415
10550
  var send = {};
@@ -10431,6 +10566,8 @@ ${story_1.evidenceToggleHidden.toString()}
10431
10566
  line.className = "member-note";
10432
10567
  // 次に保存するときの比べる元を、今送った値にする
10433
10568
  Object.keys(send).forEach(function (k) { cur[k] = k === "industry" && send[k] === null ? "" : send[k]; });
10569
+ // 🔴 足した語はポータルが案件の組織のマスタに入れた。選び肢に入れ、「(マスタに無い値)」を付けない
10570
+ if (canAdd) settleAdded(send);
10434
10571
  }, function () {
10435
10572
  save.disabled = false;
10436
10573
  save.textContent = "保存する";
@@ -18597,11 +18734,20 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
18597
18734
  * 理由と次にすること(問題ありのときだけ)。「詳しく」は相手のツールや窓口が返した語をそのまま。
18598
18735
  * ① 要対応・② Cortex 側で対応中の行は理由の次に「今は…記憶に入りません」(gap)。② は次にすることが空=出さない(受け口の行の fixer・cortex-engine #3018)
18599
18736
  */
18600
- function sourceWhyEl(why, next, detail, gap) {
18737
+ function sourceWhyEl(why, next, detail, gap, steps) {
18738
+ // steps(入れ方の手順・文とコピーの部品)がある時は、次にすることを手順にする(copyInline で値と[コピー])
18739
+ var nextEl = null;
18740
+ if (steps && steps.length) {
18741
+ nextEl = el("span", { class: "src-next", "data-src-steps": "1" }, [document.createTextNode("次にすること: ")]);
18742
+ steps.forEach(function (part) {
18743
+ if (typeof part === "string") nextEl.appendChild(document.createTextNode(part));
18744
+ else if (part && part.copy) nextEl.appendChild(copyInline(part.copy, true));
18745
+ });
18746
+ } else if (next) nextEl = el("span", { class: "src-next", text: "次にすること: " + next });
18601
18747
  var box = el("div", { class: "src-why" }, [
18602
18748
  document.createTextNode(why),
18603
18749
  gap ? el("span", { class: "src-gap", text: gap }) : null,
18604
- next ? el("span", { class: "src-next", text: "次にすること: " + next }) : null,
18750
+ nextEl,
18605
18751
  ]);
18606
18752
  if (detail) box.appendChild(el("details", {}, [el("summary", { text: "詳しく" }), el("code", { text: detail })]));
18607
18753
  return box;
@@ -18717,12 +18863,17 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
18717
18863
  return hit || (n === 1 && r.kind === "backlog" && !only.space ? only : null);
18718
18864
  }
18719
18865
  /**
18720
- * [Google で確認する]が出る行の名前の下の 1 句(cortex-engine #2673 便 S44-5f の直し 3)。同じ一覧で出る行と出ない行があると
18721
- * 利用者に訳が分からない(出ないのは、足すときに Google で確かめた行=確かめの記録がある行)。共有の宛先の行の扱いは
18722
- * engine #2640(権限の共通化)で変わる予定なので、今は一言を添える方に倒す。便 S44-5f-2 の直し 5: 別の行の話(かっこ)を外し、
18723
- * 何を確かめるのか(Google のアカウントでの確認)を言う。状態が「接続OK」の行に出ても食い違わない(読めることと持ち主の確認は別)
18866
+ * 確認の一手が出る行のボタンの語と、名前の下の 1 句(cortex-engine #3142 便 CONN-DRIVE D3)。出ない行(足すときに Google で選んだ行)との訳を言う。
18867
+ * Drive は選ぶ=確認なので「選び直す」・共有ドライブの一番上の行は「直下のフォルダを選ぶ」・Chat は選ぶ画面が無いので「確認する」。
18868
+ * 道具の表(adapters.mjs の ownerLogin)の語は CONN-ONE-A の語の表の範囲なので触らず、ここで Drive だけ上書きする
18724
18869
  */
18725
- var GOOGLE_VERIFY_WHY_TEXT = "この行は Google のアカウントでの確認がまだです";
18870
+ var GOOGLE_VERIFY_WORDS = {
18871
+ drive: { btn: "Google で選び直す", why: "Google で選び直すまで、このフォルダは読みません。" },
18872
+ driveTop: { btn: "直下のフォルダを選ぶ", why: "共有ドライブそのものは読めません。直下のフォルダを選んでください。選んだフォルダだけを読み、ほかのフォルダは読まなくなります。" },
18873
+ // pick の無い古い受け口の Drive の行(今の語)
18874
+ driveLegacy: { btn: "Google で確認する", why: "この行は Google のアカウントでの確認がまだです" },
18875
+ chat: { btn: "Google で確認する", why: "Google で確認するまで、このスペースは読みません。" },
18876
+ };
18726
18877
  /** 組み直したプロジェクトの説明文の止め方(画面に無いボタンの名前を案内しない・便 S44-5c の直し 4) */
18727
18878
  var SOURCE_STOP_TEXT = "止めるには、行の[この接続先を外す]を押してください。";
18728
18879
  /** 欄が見つからない行の下の 1 文(便 S44-5c の直し 8) */
@@ -18793,7 +18944,9 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
18793
18944
  var key = sourceKeyOf(r);
18794
18945
  var busy = SOURCE_BUSY[key] === true;
18795
18946
  var saving = CONFIG_SAVING[key] === true;
18796
- var v = sourceRowView(r, busy, Date.now());
18947
+ // コピーする物の値(SOURCE_ROW_TOOLS の joinCopy の鍵 → 値)。取り込み用のアカウントは画面の DRIVE_INGEST_ACCOUNT(組織の画面は組織の読み手)
18948
+ // 組織の取り込み用アカウントの許可が切れている間は手順を出さない(DS_GATE_CAP の一手と揃える・宛先が読めないため)
18949
+ var v = sourceRowView(r, busy, Date.now(), { ingestAccount: tenantDriveAccountExpired() ? "" : DRIVE_INGEST_ACCOUNT });
18797
18950
  var cfg = CONFIG ? configFindSource(CONFIG, r.kind, r.ref, r.workspace) : null;
18798
18951
  // Slack は url を持たない行も、同じワークスペースの住所・ワークスペースの ID から組んでリンクにする(便 S44-5e の直し 1)
18799
18952
  // Google Chat はスペースの ID(spaces/…)から組む(便 S44-5f の直し 5・サーバの googleChatSpaceUrl と同じ形)
@@ -18842,8 +18995,8 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
18842
18995
  // 準備中の 1 文は名前の列の 2 段目に置く(行の下に段を足すと、この行だけ高くなる・便 S44-5d の直し 4)
18843
18996
  if (notifyPending) who.appendChild(el("div", { class: "src-sub", text: NOTIFY_WS_PENDING_TEXT }));
18844
18997
  // [Google で確認する]が出る行と出ない行の訳を 1 句(便 S44-5f の直し 3)。足すときに Google で確かめた行は確かめ済みで出ない
18845
- if (gverify) who.appendChild(el("div", { class: "src-sub", "data-src-gverify-why": "1", text: GOOGLE_VERIFY_WHY_TEXT }));
18846
- if (v.why) item.appendChild(sourceWhyEl(v.why, v.next, v.detail, v.gap));
18998
+ if (gverify) who.appendChild(el("div", { class: "src-sub", "data-src-gverify-why": "1", text: gverify.why }));
18999
+ if (v.why) item.appendChild(sourceWhyEl(v.why, v.next, v.detail, v.gap, v.steps));
18847
19000
  // 鍵の欄は「API キーを変更する」を押した行の中にだけ開く(便 S44-5c・見本 3 の 3)
18848
19001
  if (keyOpen) {
18849
19002
  var kc = sourceKeyCardFor(r);
@@ -19041,7 +19194,7 @@ ${intake_scope_1.tenantIntakeOpen.toString()}
19041
19194
  for (var i = 0; i < buttons.length; i++) buttons[i].disabled = saving;
19042
19195
  if (gverifyT) gverifyT.setLocked(saving);
19043
19196
  card.appendChild(acts);
19044
- if (gverifyT) card.appendChild(el("div", { class: "ds-toggle-msg", "data-src-gverify-why": "1", text: GOOGLE_VERIFY_WHY_TEXT }));
19197
+ if (gverifyT) card.appendChild(el("div", { class: "ds-toggle-msg", "data-src-gverify-why": "1", text: gverifyT.why }));
19045
19198
  if (gverifyT) card.appendChild(gverifyT.msg);
19046
19199
  if (saving) card.appendChild(el("div", { class: "ds-toggle-msg ds-config-saving", text: "保存中…" }));
19047
19200
  var note = saving ? null : configNoteEl(key);
@@ -11,7 +11,7 @@
11
11
  * - 理由の文は `docs/setup-ui-spec.md` 3-D(13 語・原本の綴りは engine の `source-state.mjs` の `SOURCE_REASONS`)
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.SOURCE_FIXED_IP_WAIT_TEXT = exports.SOURCE_CHECK_FAILED_TEXT = exports.SOURCE_STATE_WORDS = exports.SOURCE_CORTEX_TEXT = exports.SOURCE_RATE_UNTIL_TEXT = exports.SOURCE_UNTIL_FIXED_TEXT = exports.SOURCE_CHECK_WORD = exports.SOURCE_NEXT_NO_CHECK = exports.SOURCE_NEXT_TAIL_AUTO = exports.SOURCE_NEXT_TAIL_CHECK = exports.SOURCE_REASON_TEXT = exports.SOURCE_ROW_TOOLS = void 0;
14
+ exports.SOURCE_FIXED_IP_WAIT_TEXT = exports.SOURCE_CHECK_FAILED_TEXT = exports.SOURCE_STATE_WORDS = exports.SOURCE_CORTEX_TEXT = exports.SOURCE_RATE_UNTIL_TEXT = exports.SOURCE_UNTIL_FIXED_TEXT = exports.SOURCE_CHECK_WORD = exports.SOURCE_NEXT_NO_CHECK = exports.SOURCE_NEXT_TAIL_AUTO = exports.SOURCE_NEXT_TAIL_CHECK = exports.SOURCE_REASON_TEXT = exports.SOURCE_JOIN_STEPS = exports.SOURCE_ROW_TOOLS = void 0;
15
15
  exports.sourceReasonLines = sourceReasonLines;
16
16
  exports.sourceWhen = sourceWhen;
17
17
  exports.sourceKeyTag = sourceKeyTag;
@@ -26,15 +26,23 @@ exports.sourceTileLine = sourceTileLine;
26
26
  exports.sourceMeetingTileLine = sourceMeetingTileLine;
27
27
  /** 行の種類(`sources.groups[].kind`)→ 名詞と性質。`tool` は engine の道具の表の鍵・`tile` は操作タブのタイルのアダプタ */
28
28
  const SOURCE_ROW_TOOLS = {
29
- slack: { tool: "slack", tile: "slack", toolName: "Slack", placeName: "チャンネル", countUnit: "チャンネル", joinWord: "招待", keyName: null, notify: true, check: true },
30
- "google-chat": { tool: "google-chat", tile: "google-chat", toolName: "Google Chat", placeName: "スペース", countUnit: "スペース", joinWord: "追加", keyName: null, notify: true, check: true },
31
- github: { tool: "github", tile: "github", toolName: "GitHub", placeName: "リポジトリ", countUnit: "リポジトリ", joinWord: "追加", keyName: null, notify: false, check: true },
32
- backlog: { tool: "backlog", tile: "backlog", toolName: "Backlog", placeName: "プロジェクト", countUnit: "件", joinWord: null, keyName: "API キー", notify: false, check: true },
33
- figma: { tool: "figma", tile: "figma", toolName: "Figma", placeName: "ファイル", countUnit: "ファイル", joinWord: null, keyName: "API キー", notify: false, check: true },
34
- drive: { tool: "google-drive", tile: "google-drive", toolName: "Google ドライブ", placeName: "フォルダ", countUnit: "フォルダ", joinWord: "閲覧者として共有", keyName: null, notify: false, check: true },
35
- meet: { tool: "google-meet", tile: "google-meet", toolName: "Google Meet", placeName: "カレンダー", countUnit: "件", joinWord: null, keyName: null, notify: false, check: false },
29
+ slack: { tool: "slack", tile: "slack", toolName: "Slack", placeName: "チャンネル", countUnit: "チャンネル", joinWord: "招待", keyName: null, notify: true, check: true, joinCopy: null },
30
+ "google-chat": { tool: "google-chat", tile: "google-chat", toolName: "Google Chat", placeName: "スペース", countUnit: "スペース", joinWord: "追加", keyName: null, notify: true, check: true, joinCopy: null },
31
+ github: { tool: "github", tile: "github", toolName: "GitHub", placeName: "リポジトリ", countUnit: "リポジトリ", joinWord: "追加", keyName: null, notify: false, check: true, joinCopy: null },
32
+ backlog: { tool: "backlog", tile: "backlog", toolName: "Backlog", placeName: "プロジェクト", countUnit: "件", joinWord: null, keyName: "API キー", notify: false, check: true, joinCopy: null },
33
+ figma: { tool: "figma", tile: "figma", toolName: "Figma", placeName: "ファイル", countUnit: "ファイル", joinWord: null, keyName: "API キー", notify: false, check: true, joinCopy: null },
34
+ drive: { tool: "google-drive", tile: "google-drive", toolName: "Google ドライブ", placeName: "フォルダ", countUnit: "フォルダ", joinWord: "閲覧者として共有", keyName: null, notify: false, check: true, joinCopy: "ingestAccount" },
35
+ meet: { tool: "google-meet", tile: "google-meet", toolName: "Google Meet", placeName: "カレンダー", countUnit: "件", joinWord: null, keyName: null, notify: false, check: false, joinCopy: null },
36
36
  };
37
37
  exports.SOURCE_ROW_TOOLS = SOURCE_ROW_TOOLS;
38
+ /**
39
+ * `not_member`(Cortex がその場に入っていない)の「次にすること」を、コピーつきの手順にする道具の手順(`SOURCE_ROW_TOOLS` の `joinCopy` の鍵 → 前・後の文)。
40
+ * コピーする物(〈取り込み用のアカウント〉など)の値は画面が持つ(`sourceRowView` の `copies`)。値が分からない時は今の文のまま(cortex-engine #3142 便 CONN-DRIVE D5)
41
+ */
42
+ const SOURCE_JOIN_STEPS = {
43
+ ingestAccount: { before: "① このアドレスをコピー: ", after: " ② フォルダの[共有]で、このアドレスを「閲覧者」で追加 ③ [接続を確認]を押す" },
44
+ };
45
+ exports.SOURCE_JOIN_STEPS = SOURCE_JOIN_STEPS;
38
46
  /**
39
47
  * 理由の符号 → 理由の 1 文・次にすることの 1 文・強くするボタン(`check`=接続を確認・`key`=〈鍵〉を変更する・`owner`=Google で確認する・null=無し)。
40
48
  * 〈ツール〉〈場〉〈入れ方〉〈鍵〉は `{tool}` `{place}` `{join}` `{key}`。`key_missing` は人が鍵を入れる種類(`key_missing`)と入れない種類(`key_missing:none`)で文が違う
@@ -299,9 +307,10 @@ function startCheckConnectedOf(groups, meeting, calendarName) {
299
307
  /**
300
308
  * 行の見え方(ボタンの並びと強さ・理由の文)。ボタンの順はいつも同じ: 接続を確認 → 通知先 → 〈鍵〉を変更する → この接続先を外す(右の端)。
301
309
  * 強くするのは「問題あり」(① `user`・印なし)のときの次にすることのボタン 1 つだけ。② `cortex` は強くしない・③ `wait` は理由の箱を出さない。外すボタンは強くしない(赤い枠のまま)
302
- * @returns {{ facts, buttons: {id: "check"|"notify"|"key"|"remove", text: string, strong: boolean}[], why: string, gap: string, next: string, detail: string }}
310
+ * `copies`(任意)は `joinCopy` の鍵 → コピーする値。`not_member` で次にすることがあり、値が分かる時だけ `steps`(文とコピーの部品の並び)を返す(無ければ null)
311
+ * @returns {{ facts, buttons: {id: "check"|"notify"|"key"|"remove", text: string, strong: boolean}[], why: string, gap: string, next: string, detail: string, steps: (string|{copy: string})[] | null }}
303
312
  */
304
- function sourceRowView(row, busy, nowMs) {
313
+ function sourceRowView(row, busy, nowMs, copies) {
305
314
  const r = row || {};
306
315
  const t = SOURCE_ROW_TOOLS[r.kind] || { keyName: null };
307
316
  const facts = sourceFacts(r, busy, nowMs);
@@ -327,7 +336,12 @@ function sourceRowView(row, busy, nowMs) {
327
336
  buttons.push({ id: "key", text: t.keyName + "を変更する", strong: strong === "key" });
328
337
  if (r.removable === true)
329
338
  buttons.push({ id: "remove", text: "この接続先を外す", strong: false });
330
- return { facts: facts, buttons: buttons, why: why, gap: gap, next: next, detail: shown && typeof r.detail === "string" ? r.detail : "" };
339
+ // 入れ方の手順(Slack の /invite と同じ型)。種類の名前で分けず、表の joinCopy と画面が渡す値の有無で決める
340
+ const copyKey = t.joinCopy;
341
+ const copyVal = copyKey && copies && typeof copies[copyKey] === "string" ? copies[copyKey] : "";
342
+ const st = copyKey && Object.prototype.hasOwnProperty.call(SOURCE_JOIN_STEPS, copyKey) ? SOURCE_JOIN_STEPS[copyKey] : null;
343
+ const steps = shown && next && r.reason === "not_member" && copyVal && st ? [st.before, { copy: copyVal }, st.after] : null;
344
+ return { facts: facts, buttons: buttons, why: why, gap: gap, next: next, detail: shown && typeof r.detail === "string" ? r.detail : "", steps: steps };
331
345
  }
332
346
  /**
333
347
  * 会議のまとまりの頭(画面 9)。会議は行にしない。状態のかたまりと、問題ありのときだけ理由と次にすること。ボタンは無い。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takagaki/cortex-decisions-viewer",
3
- "version": "0.12.283",
3
+ "version": "0.12.286",
4
4
  "description": "Cortexの意思決定記録(Decisions/*.md)を静的サイトにビルドして閲覧する。各レコードに「Edit on GitHub」リンクを付与する。",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,