dsh-codex-subscription 3.2.3 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +4 -4
- package/README.md +4 -4
- package/docs/plugin/DETAIL.md +3 -0
- package/docs/plugin/DETAIL.zh.md +3 -0
- package/lib/client.js +385 -223
- package/lib/index.js +140 -36
- package/locale/en.json +2 -1
- package/locale/zh.json +2 -1
- package/package.json +3 -2
package/lib/client.js
CHANGED
|
@@ -1454,6 +1454,8 @@ window.__ModuleLoader__.load({
|
|
|
1454
1454
|
//#endregion
|
|
1455
1455
|
//#region src/client-locales.js
|
|
1456
1456
|
const zh = {
|
|
1457
|
+
openSubscriptionSettings: "订阅设置",
|
|
1458
|
+
projectHomepage: "GitHub 项目主页",
|
|
1457
1459
|
voiceNativeCaptureConfirm: "允许本次通话使用此电脑的麦克风和扬声器?挂断或离开会话后会停止收音。",
|
|
1458
1460
|
voiceMediaHint: "窗口不支持 WebRTC 时,可在浏览器中继续同一会话。音色试听不受影响,仍使用当前订阅,无需 API Key。",
|
|
1459
1461
|
voiceBrowserContinue: "在浏览器继续此会话",
|
|
@@ -1976,12 +1978,22 @@ window.__ModuleLoader__.load({
|
|
|
1976
1978
|
imageEditReferenceGuide: "本次编辑的干净源图为「{sourceName}」,编号定位参考图为「{referenceName}」。坐标以图片左上角为原点,x 向右、y 向下,百分比相对于整张图片。请查看这两张图片,将它们同时作为编辑工具的参考图,并在工具提示词中完整保留下方编号、位置和修改要求。只修改源图中对应位置的内容;定位参考图上的编号、圆点和引线仅用于定位,不得绘入最终结果。若无法读取两张图片或确定位置,请说明问题,不要猜测或忽略标注。",
|
|
1977
1979
|
nav: "Codex 订阅",
|
|
1978
1980
|
title: "Codex 订阅",
|
|
1979
|
-
|
|
1981
|
+
savedAccounts: "已登记账号",
|
|
1980
1982
|
disconnected: "未登录",
|
|
1981
1983
|
accountLoading: "正在读取账户状态…",
|
|
1984
|
+
accountVerifying: "正在验证…",
|
|
1985
|
+
accountVerified: "认证有效",
|
|
1986
|
+
accountRenewSignIn: "登录已失效",
|
|
1987
|
+
accountUnverified: "暂时无法确认认证状态",
|
|
1988
|
+
renewAccount: "重新登录",
|
|
1989
|
+
renewAccountHint: "请在浏览器中使用原来的 ChatGPT 账号和工作区完成授权。",
|
|
1990
|
+
failed_account_mismatch: "无法确认是原来的 ChatGPT 账号和工作区。请切回原账号后重试。",
|
|
1982
1991
|
browserLogin: "浏览器登录",
|
|
1983
1992
|
deviceLogin: "设备代码登录",
|
|
1984
1993
|
logout: "退出登录",
|
|
1994
|
+
accessDenied: "ChatGPT 拒绝了这次请求(HTTP 403)。请检查账号访问权限,或联系 OpenAI 支持;重新登录不一定能解决。",
|
|
1995
|
+
deviceLimit: "ChatGPT 不允许在这台设备使用此付费账号。请手动选择你拥有的其他获准账号,或联系 OpenAI 支持。退出登录或重置额度不会解除限制。",
|
|
1996
|
+
purchaseLimit: "此卡或设备关联的订阅过多,ChatGPT 已阻止本次购买。如有误,请联系 OpenAI 支持。",
|
|
1985
1997
|
addAccount: "添加账号",
|
|
1986
1998
|
switchAccount: "切换",
|
|
1987
1999
|
removeAccount: "移除",
|
|
@@ -2114,8 +2126,6 @@ window.__ModuleLoader__.load({
|
|
|
2114
2126
|
resetFailed: "无法使用额度重置。",
|
|
2115
2127
|
accountQuotaLeft: "{label}剩余 {value}%",
|
|
2116
2128
|
accountQuotaResets: "{value} 重置",
|
|
2117
|
-
accountQuotaLoading: "正在读取额度…",
|
|
2118
|
-
accountQuotaError: "暂时读不到这个账号的额度",
|
|
2119
2129
|
accountQuotaNone: "没有额度窗口信息",
|
|
2120
2130
|
resetRenewLogin: "登录状态已失效,请重新登录。",
|
|
2121
2131
|
resetBlocked: "ChatGPT 的网络防护拦截了这次请求(HTTP 403),登录状态没有问题。请稍后再试,或检查网络、代理或 VPN。",
|
|
@@ -2373,6 +2383,8 @@ window.__ModuleLoader__.load({
|
|
|
2373
2383
|
imageRemoveAnnotation: "删除标注"
|
|
2374
2384
|
};
|
|
2375
2385
|
const en = {
|
|
2386
|
+
openSubscriptionSettings: "Subscription settings",
|
|
2387
|
+
projectHomepage: "GitHub project",
|
|
2376
2388
|
voiceNativeCaptureConfirm: "Use this computer’s microphone and speakers for this call? Capture stops when you hang up or leave the conversation.",
|
|
2377
2389
|
voiceMediaHint: "If this window does not support WebRTC, continue the same conversation in a browser. Voice samples remain available. Your existing subscription is used; no API key is needed.",
|
|
2378
2390
|
voiceBrowserContinue: "Continue this conversation in a browser",
|
|
@@ -2895,12 +2907,22 @@ window.__ModuleLoader__.load({
|
|
|
2895
2907
|
imageEditReferenceGuide: "The clean source for this edit is \"{sourceName}\"; \"{referenceName}\" is the numbered location reference. Coordinates start at the top-left, x increases rightward and y downward; percentages refer to the whole image. Inspect both images and pass both as references to the image-editing tool. Preserve every number, position and requested change below in the tool prompt. Edit the corresponding content in the clean source; numbers, dots and leader lines on the location reference are guidance only and must not appear in the final result. If either image cannot be read or a location is unclear, explain the problem instead of guessing or ignoring annotations.",
|
|
2896
2908
|
nav: "Codex",
|
|
2897
2909
|
title: "Codex subscription",
|
|
2898
|
-
|
|
2910
|
+
savedAccounts: "Saved accounts",
|
|
2899
2911
|
disconnected: "Not signed in",
|
|
2900
2912
|
accountLoading: "Reading account status…",
|
|
2913
|
+
accountVerifying: "Checking sign-in…",
|
|
2914
|
+
accountVerified: "Sign-in verified",
|
|
2915
|
+
accountRenewSignIn: "Sign-in expired",
|
|
2916
|
+
accountUnverified: "Could not verify sign-in",
|
|
2917
|
+
renewAccount: "Sign in again",
|
|
2918
|
+
renewAccountHint: "Complete authorization in your browser with the original ChatGPT account and workspace.",
|
|
2919
|
+
failed_account_mismatch: "Could not verify the same ChatGPT account and workspace. Switch to the original account and try again.",
|
|
2901
2920
|
browserLogin: "Browser sign-in",
|
|
2902
2921
|
deviceLogin: "Device-code sign-in",
|
|
2903
2922
|
logout: "Sign out",
|
|
2923
|
+
accessDenied: "ChatGPT denied this request (HTTP 403). Check account access or contact OpenAI Support; signing in again may not resolve it.",
|
|
2924
|
+
deviceLimit: "ChatGPT does not allow this paid account on this device. Manually select another permitted account you own or contact OpenAI Support. Signing out or resetting usage does not clear the restriction.",
|
|
2925
|
+
purchaseLimit: "ChatGPT blocked this purchase because too many subscriptions are associated with this card or device. Contact OpenAI Support if this is unexpected.",
|
|
2904
2926
|
addAccount: "Add account",
|
|
2905
2927
|
switchAccount: "Switch",
|
|
2906
2928
|
removeAccount: "Remove",
|
|
@@ -3033,8 +3055,6 @@ window.__ModuleLoader__.load({
|
|
|
3033
3055
|
resetFailed: "Could not use the quota reset.",
|
|
3034
3056
|
accountQuotaLeft: "{label} {value}% left",
|
|
3035
3057
|
accountQuotaResets: "resets {value}",
|
|
3036
|
-
accountQuotaLoading: "Reading quota…",
|
|
3037
|
-
accountQuotaError: "The quota of this account could not be read right now",
|
|
3038
3058
|
accountQuotaNone: "No quota window reported",
|
|
3039
3059
|
resetRenewLogin: "Your sign-in expired. Sign in again.",
|
|
3040
3060
|
resetBlocked: "ChatGPT network protection blocked this request (HTTP 403). Your sign-in is fine; try again later or check your network, proxy or VPN.",
|
|
@@ -3294,6 +3314,10 @@ window.__ModuleLoader__.load({
|
|
|
3294
3314
|
//#endregion
|
|
3295
3315
|
//#region src/client-styles.js
|
|
3296
3316
|
const STYLE = `
|
|
3317
|
+
.codexSubscription[data-embedded=true]{max-width:960px}
|
|
3318
|
+
.codexQuotaSettingsLink{display:block;width:100%;margin-top:8px;padding:8px 0 0;border:0;border-top:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-link,var(--dsw-alias-label-primary));font:inherit;text-align:start;cursor:pointer}
|
|
3319
|
+
.codexQuotaSettingsLink:hover{text-decoration:underline}
|
|
3320
|
+
.codexQuotaSettingsLink:focus-visible{outline:2px solid var(--dsw-alias-border-l3);outline-offset:3px;border-radius:2px}
|
|
3297
3321
|
.codexSubscriptionAdvancedPreferences{display:flex;flex-direction:column;gap:10px}
|
|
3298
3322
|
.codexSubscriptionAdvancedPreferences[data-others-off=true]>[data-governed=true]{opacity:.55;transition:opacity .15s}
|
|
3299
3323
|
.codexSubscriptionSearchChoices.codexSubscriptionQuotaModes{display:flex;flex:0 0 auto;gap:0;grid-template-columns:none}
|
|
@@ -3375,7 +3399,6 @@ window.__ModuleLoader__.load({
|
|
|
3375
3399
|
.codexSubscriptionAccount:last-child{border-bottom:0}
|
|
3376
3400
|
.codexSubscriptionAccountMain{display:flex;flex-direction:column;gap:2px;padding:6px 0;min-width:0}
|
|
3377
3401
|
.codexSubscriptionAccountQuota{display:flex;flex-wrap:wrap;gap:2px 12px;font-size:12px;color:var(--dsw-alias-text-l2)}
|
|
3378
|
-
.codexSubscriptionAccountQuota[data-state=error]{color:var(--dsw-alias-text-danger,#c0392b)}
|
|
3379
3402
|
.codexSubscriptionAccount[data-active=true] .codexSubscriptionEmail,.codexSubscriptionAccount[data-active=true]>span{font-weight:600}
|
|
3380
3403
|
.codexSubscriptionEmail{max-width:100%;overflow:hidden;padding:2px 4px;border:0;border-radius:5px;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;text-align:left;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}
|
|
3381
3404
|
.codexSubscriptionEmail:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
@@ -3744,8 +3767,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
3744
3767
|
.codexSubscriptionLimit[data-pace=true] progress::-moz-progress-bar{background:var(--dsw-alias-state-warning-primary,#f5a300)}
|
|
3745
3768
|
.codexDiagResult{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 0;border-top:1px solid var(--dsw-alias-border-l2)}
|
|
3746
3769
|
.codexDiagBadge{font-size:13px;line-height:20px;font-weight:500;color:var(--dsw-alias-label-primary)}
|
|
3747
|
-
.codexDiagResult[data-state=
|
|
3748
|
-
.codexDiagResult[data-state=attention] .codexDiagBadge::before{background:var(--dsw-alias-state-warning-primary,#f5a300)}
|
|
3770
|
+
.codexDiagResult[data-state=attention] .codexDiagBadge::before{content:'';display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:8px;background:var(--dsw-alias-state-warning-primary,#f5a300)}
|
|
3749
3771
|
.codexDiagTime{font-size:12px;color:var(--dsw-alias-label-tertiary)}
|
|
3750
3772
|
.codexDiagFindings{list-style:none;margin:0;padding:0 0 6px;display:flex;flex-direction:column;gap:8px}
|
|
3751
3773
|
.codexDiagFindings>li{display:flex;flex-direction:column;gap:2px;font-size:13px;line-height:20px}
|
|
@@ -5171,9 +5193,32 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
5171
5193
|
});
|
|
5172
5194
|
}
|
|
5173
5195
|
//#endregion
|
|
5196
|
+
//#region src/http-failure.js
|
|
5197
|
+
const SIGN_IN_RENEW = "ChatGPT sign-in needs to be renewed";
|
|
5198
|
+
const ACCESS_DENIED = "ChatGPT denied this request (HTTP 403). Check account access or contact OpenAI Support; signing in again may not resolve it.";
|
|
5199
|
+
const DEVICE_LIMIT = "ChatGPT does not allow this paid account on this device. Use another permitted account you own or contact OpenAI Support. Signing out or resetting usage does not clear this restriction.";
|
|
5200
|
+
const PURCHASE_LIMIT = "ChatGPT blocked this purchase because too many subscriptions are associated with this card or device. Contact OpenAI Support if this is unexpected.";
|
|
5201
|
+
const PUBLIC_ACCESS_MESSAGES = /* @__PURE__ */ new Set([
|
|
5202
|
+
ACCESS_DENIED,
|
|
5203
|
+
DEVICE_LIMIT,
|
|
5204
|
+
PURCHASE_LIMIT
|
|
5205
|
+
]);
|
|
5206
|
+
const isAccessFailureMessage = (message) => PUBLIC_ACCESS_MESSAGES.has(message);
|
|
5207
|
+
//#endregion
|
|
5174
5208
|
//#region src/client-shared.js
|
|
5209
|
+
const ACCESS_FAILURE_KEYS = /* @__PURE__ */ new Map([
|
|
5210
|
+
[ACCESS_DENIED, "accessDenied"],
|
|
5211
|
+
[DEVICE_LIMIT, "deviceLimit"],
|
|
5212
|
+
[PURCHASE_LIMIT, "purchaseLimit"],
|
|
5213
|
+
[SIGN_IN_RENEW, "resetRenewLogin"]
|
|
5214
|
+
]);
|
|
5215
|
+
const accessFailureText = (message, t) => {
|
|
5216
|
+
const key = ACCESS_FAILURE_KEYS.get(message);
|
|
5217
|
+
return key === void 0 ? message : t(key);
|
|
5218
|
+
};
|
|
5175
5219
|
const NS = "settings.codexSubscription";
|
|
5176
|
-
const
|
|
5220
|
+
const PROJECT_URL = "https://github.com/WSL043/dsh-codex-subscription";
|
|
5221
|
+
const SUPPORT_ISSUE_URL = `${PROJECT_URL}/issues/new?template=install-problem.yml`;
|
|
5177
5222
|
const QUICK_QUOTA_REFRESH_EVENT = "dsh-codex-subscription:refresh-quick-quota";
|
|
5178
5223
|
const accountStatusErrorText = (error, t) => {
|
|
5179
5224
|
const key = {
|
|
@@ -5256,7 +5301,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
5256
5301
|
}
|
|
5257
5302
|
//#endregion
|
|
5258
5303
|
//#region src/version.js
|
|
5259
|
-
const PACKAGE_VERSION = "3.2.
|
|
5304
|
+
const PACKAGE_VERSION = "3.2.4";
|
|
5260
5305
|
//#endregion
|
|
5261
5306
|
//#region src/client-recovery.js
|
|
5262
5307
|
async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = 1e4) {
|
|
@@ -5474,7 +5519,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
5474
5519
|
}
|
|
5475
5520
|
//#endregion
|
|
5476
5521
|
//#region src/client-composer-quota.jsx
|
|
5477
|
-
function CodexComposerQuota({ preference, rpc, t, directory }) {
|
|
5522
|
+
function CodexComposerQuota({ preference, rpc, t, directory, openSettings }) {
|
|
5478
5523
|
const preferenceSnapshot = usePreferenceSnapshot(preference);
|
|
5479
5524
|
const current = (0, react.useSyncExternalStore)((listener) => directory.subscribe(listener), () => directory.getSnapshot()).current;
|
|
5480
5525
|
const quotaEnabled = preferenceSnapshot.status === "ready" && preferenceSnapshot.quickQuotaMode !== "off" && current?.provider === "openai-codex";
|
|
@@ -5569,7 +5614,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
5569
5614
|
preferenceSnapshot.quickQuotaMode !== "bar" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: `${percent(quota.remainingPercent)}%` }) : null
|
|
5570
5615
|
]
|
|
5571
5616
|
}, `${quota.windowSeconds}-${index}`))
|
|
5572
|
-
}), visible ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.
|
|
5617
|
+
}), visible ? (0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
5573
5618
|
ref: panel,
|
|
5574
5619
|
id,
|
|
5575
5620
|
role: "dialog",
|
|
@@ -5582,7 +5627,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
5582
5627
|
...position,
|
|
5583
5628
|
visibility: position ? "visible" : "hidden"
|
|
5584
5629
|
},
|
|
5585
|
-
children: quotas.map((quota, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5630
|
+
children: [quotas.map((quota, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
5586
5631
|
className: "codexQuotaDetail",
|
|
5587
5632
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [
|
|
5588
5633
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: windowLabel(quota.windowSeconds, t) }),
|
|
@@ -5592,7 +5637,15 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
|
|
|
5592
5637
|
children: shortReset(quota, t)
|
|
5593
5638
|
})
|
|
5594
5639
|
] }), forecastMode ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: formatQuotaForecast(quota.forecast, t, quota) }) : null]
|
|
5595
|
-
}, `${quota.windowSeconds}-${index}`))
|
|
5640
|
+
}, `${quota.windowSeconds}-${index}`)), openSettings ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
5641
|
+
type: "button",
|
|
5642
|
+
className: "codexQuotaSettingsLink",
|
|
5643
|
+
onClick: () => {
|
|
5644
|
+
dismiss();
|
|
5645
|
+
openSettings();
|
|
5646
|
+
},
|
|
5647
|
+
children: t("openSubscriptionSettings")
|
|
5648
|
+
}) : null]
|
|
5596
5649
|
}), document.body) : null] });
|
|
5597
5650
|
}
|
|
5598
5651
|
function shortWindow(seconds, t) {
|
|
@@ -7654,6 +7707,7 @@ void main(){
|
|
|
7654
7707
|
//#endregion
|
|
7655
7708
|
//#region src/capability-preferences.jsx
|
|
7656
7709
|
function CapabilityPreferences({ preference, t, section, disabled = false }) {
|
|
7710
|
+
const radioId = (0, react.useId)();
|
|
7657
7711
|
const snapshot = (0, react.useSyncExternalStore)(preference.subscribe, preference.getSnapshot);
|
|
7658
7712
|
const [domains, setDomains] = (0, react.useState)("");
|
|
7659
7713
|
const [invalid, setInvalid] = (0, react.useState)(false);
|
|
@@ -7670,7 +7724,7 @@ void main(){
|
|
|
7670
7724
|
className: "codexSubscriptionQuotaMode",
|
|
7671
7725
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
7672
7726
|
type: "radio",
|
|
7673
|
-
name:
|
|
7727
|
+
name: `${radioId}-codex-${field}`,
|
|
7674
7728
|
checked: snapshot[field] === value,
|
|
7675
7729
|
disabled: !snapshot.writable || disabled,
|
|
7676
7730
|
onChange: () => {
|
|
@@ -10750,6 +10804,7 @@ void main(){
|
|
|
10750
10804
|
error: ["error"]
|
|
10751
10805
|
};
|
|
10752
10806
|
function DiagnosticsCard({ rpc, t, diagnostics }) {
|
|
10807
|
+
const radioId = (0, react.useId)();
|
|
10753
10808
|
const [report, setReport] = (0, react.useState)();
|
|
10754
10809
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
10755
10810
|
const [copied, setCopied] = (0, react.useState)(false);
|
|
@@ -10844,7 +10899,7 @@ void main(){
|
|
|
10844
10899
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
10845
10900
|
className: "codexDiagResult",
|
|
10846
10901
|
role: "status",
|
|
10847
|
-
"data-state": attention.length ? "attention" :
|
|
10902
|
+
"data-state": attention.length ? "attention" : void 0,
|
|
10848
10903
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
10849
10904
|
className: "codexDiagBadge",
|
|
10850
10905
|
children: attention.length ? t("diagnosticsAttention").replace("{count}", String(attention.length)) : t("diagnosticsNoRecordedFailure")
|
|
@@ -10884,7 +10939,7 @@ void main(){
|
|
|
10884
10939
|
className: "codexSubscriptionQuotaMode",
|
|
10885
10940
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
10886
10941
|
type: "radio",
|
|
10887
|
-
name:
|
|
10942
|
+
name: `${radioId}-codex-log-level`,
|
|
10888
10943
|
checked: level === value,
|
|
10889
10944
|
onChange: () => {
|
|
10890
10945
|
setLevel(value);
|
|
@@ -11114,13 +11169,14 @@ void main(){
|
|
|
11114
11169
|
//#endregion
|
|
11115
11170
|
//#region src/client-preferences.jsx
|
|
11116
11171
|
function QuickQuotaPreference({ preference, t }) {
|
|
11172
|
+
const radioId = (0, react.useId)();
|
|
11117
11173
|
const snapshot = usePreferenceSnapshot(preference);
|
|
11118
11174
|
const writable = snapshot.status === "ready" && snapshot.writable === true;
|
|
11119
11175
|
const choice = (value, label) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11120
11176
|
className: "codexSubscriptionQuotaMode",
|
|
11121
11177
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11122
11178
|
type: "radio",
|
|
11123
|
-
name:
|
|
11179
|
+
name: `${radioId}-codex-subscription-quota-mode`,
|
|
11124
11180
|
checked: snapshot.quickQuotaMode === value,
|
|
11125
11181
|
disabled: !writable,
|
|
11126
11182
|
onChange: () => {
|
|
@@ -11177,13 +11233,14 @@ void main(){
|
|
|
11177
11233
|
});
|
|
11178
11234
|
}
|
|
11179
11235
|
function SearchProviderPreference({ preference, t }) {
|
|
11236
|
+
const radioId = (0, react.useId)();
|
|
11180
11237
|
const snapshot = usePreferenceSnapshot(preference);
|
|
11181
11238
|
const writable = snapshot.status === "ready" && snapshot.writable === true;
|
|
11182
11239
|
const choice = (value, label) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
11183
11240
|
className: "codexSubscriptionQuotaMode",
|
|
11184
11241
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11185
11242
|
type: "radio",
|
|
11186
|
-
name:
|
|
11243
|
+
name: `${radioId}-codex-subscription-search-provider`,
|
|
11187
11244
|
checked: snapshot.searchProvider === value,
|
|
11188
11245
|
disabled: !writable,
|
|
11189
11246
|
onChange: () => {
|
|
@@ -11233,7 +11290,7 @@ void main(){
|
|
|
11233
11290
|
className: "codexSubscriptionQuotaMode",
|
|
11234
11291
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11235
11292
|
type: "radio",
|
|
11236
|
-
name:
|
|
11293
|
+
name: `${radioId}-codex-subscription-fetch-provider`,
|
|
11237
11294
|
checked: snapshot.fetchProvider === value,
|
|
11238
11295
|
disabled: !writable || value === "codex" && !snapshot.fetchRoutingAvailable,
|
|
11239
11296
|
onChange: () => {
|
|
@@ -11252,6 +11309,7 @@ void main(){
|
|
|
11252
11309
|
});
|
|
11253
11310
|
}
|
|
11254
11311
|
function InputImageDetailPreference({ preference, t }) {
|
|
11312
|
+
const radioId = (0, react.useId)();
|
|
11255
11313
|
const snapshot = usePreferenceSnapshot(preference);
|
|
11256
11314
|
const writable = snapshot.status === "ready" && snapshot.writable === true;
|
|
11257
11315
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -11272,7 +11330,7 @@ void main(){
|
|
|
11272
11330
|
className: "codexSubscriptionQuotaMode",
|
|
11273
11331
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11274
11332
|
type: "radio",
|
|
11275
|
-
name:
|
|
11333
|
+
name: `${radioId}-codex-input-image-detail`,
|
|
11276
11334
|
checked: snapshot.inputImageDetail === value,
|
|
11277
11335
|
disabled: !writable,
|
|
11278
11336
|
onChange: () => {
|
|
@@ -11284,6 +11342,7 @@ void main(){
|
|
|
11284
11342
|
});
|
|
11285
11343
|
}
|
|
11286
11344
|
function ReasoningSummaryPreference({ preference, t }) {
|
|
11345
|
+
const radioId = (0, react.useId)();
|
|
11287
11346
|
const snapshot = usePreferenceSnapshot(preference);
|
|
11288
11347
|
const writable = snapshot.status === "ready" && snapshot.writable === true;
|
|
11289
11348
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -11304,7 +11363,7 @@ void main(){
|
|
|
11304
11363
|
className: "codexSubscriptionQuotaMode",
|
|
11305
11364
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11306
11365
|
type: "radio",
|
|
11307
|
-
name:
|
|
11366
|
+
name: `${radioId}-codex-reasoning-summary`,
|
|
11308
11367
|
checked: snapshot.reasoningSummary === value,
|
|
11309
11368
|
disabled: !writable,
|
|
11310
11369
|
onChange: () => {
|
|
@@ -11364,6 +11423,7 @@ void main(){
|
|
|
11364
11423
|
});
|
|
11365
11424
|
}
|
|
11366
11425
|
function RetryPolicyPreference({ preference, t }) {
|
|
11426
|
+
const radioId = (0, react.useId)();
|
|
11367
11427
|
const snapshot = usePreferenceSnapshot(preference);
|
|
11368
11428
|
const writable = snapshot.status === "ready" && snapshot.writable === true;
|
|
11369
11429
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -11384,7 +11444,7 @@ void main(){
|
|
|
11384
11444
|
className: "codexSubscriptionQuotaMode",
|
|
11385
11445
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11386
11446
|
type: "radio",
|
|
11387
|
-
name:
|
|
11447
|
+
name: `${radioId}-codex-retry-policy`,
|
|
11388
11448
|
checked: snapshot.retryPolicy === value,
|
|
11389
11449
|
disabled: !writable,
|
|
11390
11450
|
onChange: () => {
|
|
@@ -11396,6 +11456,7 @@ void main(){
|
|
|
11396
11456
|
});
|
|
11397
11457
|
}
|
|
11398
11458
|
function ConnectorsPreference({ preference, t }) {
|
|
11459
|
+
const radioId = (0, react.useId)();
|
|
11399
11460
|
const snapshot = usePreferenceSnapshot(preference);
|
|
11400
11461
|
const writable = snapshot.status === "ready" && snapshot.writable === true;
|
|
11401
11462
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -11418,7 +11479,7 @@ void main(){
|
|
|
11418
11479
|
className: "codexSubscriptionQuotaMode",
|
|
11419
11480
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11420
11481
|
type: "radio",
|
|
11421
|
-
name:
|
|
11482
|
+
name: `${radioId}-codex-connectors`,
|
|
11422
11483
|
checked: snapshot.connectors === value,
|
|
11423
11484
|
disabled: !writable,
|
|
11424
11485
|
onChange: () => {
|
|
@@ -11437,6 +11498,7 @@ void main(){
|
|
|
11437
11498
|
});
|
|
11438
11499
|
}
|
|
11439
11500
|
function StreamIdleTimeoutPreference({ preference, t }) {
|
|
11501
|
+
const radioId = (0, react.useId)();
|
|
11440
11502
|
const snapshot = usePreferenceSnapshot(preference);
|
|
11441
11503
|
const writable = snapshot.status === "ready" && snapshot.writable === true;
|
|
11442
11504
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -11457,7 +11519,7 @@ void main(){
|
|
|
11457
11519
|
className: "codexSubscriptionQuotaMode",
|
|
11458
11520
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11459
11521
|
type: "radio",
|
|
11460
|
-
name:
|
|
11522
|
+
name: `${radioId}-codex-stream-idle-timeout`,
|
|
11461
11523
|
checked: snapshot.streamIdleTimeoutMinutes === value,
|
|
11462
11524
|
disabled: !writable,
|
|
11463
11525
|
onChange: () => {
|
|
@@ -11873,6 +11935,7 @@ void main(){
|
|
|
11873
11935
|
});
|
|
11874
11936
|
}
|
|
11875
11937
|
function OutputVerbosityPreference({ preference, t }) {
|
|
11938
|
+
const radioId = (0, react.useId)();
|
|
11876
11939
|
const snapshot = usePreferenceSnapshot(preference);
|
|
11877
11940
|
const writable = ready(snapshot);
|
|
11878
11941
|
const values = [
|
|
@@ -11904,7 +11967,7 @@ void main(){
|
|
|
11904
11967
|
className: "codexSubscriptionQuotaMode",
|
|
11905
11968
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11906
11969
|
type: "radio",
|
|
11907
|
-
name:
|
|
11970
|
+
name: `${radioId}-codex-output-verbosity`,
|
|
11908
11971
|
checked: snapshot.outputVerbosity === value,
|
|
11909
11972
|
disabled: !writable,
|
|
11910
11973
|
onChange: () => {
|
|
@@ -11916,6 +11979,7 @@ void main(){
|
|
|
11916
11979
|
});
|
|
11917
11980
|
}
|
|
11918
11981
|
function Radios({ snapshot, preference, field, values, label, name, text, disabled, disabledValues = [] }) {
|
|
11982
|
+
const radioId = (0, react.useId)();
|
|
11919
11983
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
11920
11984
|
className: "codexSubscriptionQuotaModes",
|
|
11921
11985
|
role: "radiogroup",
|
|
@@ -11925,7 +11989,7 @@ void main(){
|
|
|
11925
11989
|
className: "codexSubscriptionQuotaMode",
|
|
11926
11990
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
11927
11991
|
type: "radio",
|
|
11928
|
-
name
|
|
11992
|
+
name: `${radioId}-${name}`,
|
|
11929
11993
|
checked: snapshot[field] === value,
|
|
11930
11994
|
disabled: disabled || !snapshot.writable || disabledValues.includes(value),
|
|
11931
11995
|
onChange: () => {
|
|
@@ -12299,6 +12363,7 @@ void main(){
|
|
|
12299
12363
|
async function readLoginProgress({ flow, readFlow, readAccount }) {
|
|
12300
12364
|
try {
|
|
12301
12365
|
const nextFlow = await readFlow();
|
|
12366
|
+
if (nextFlow.phase === "failed" && isAccessFailureMessage(nextFlow.error)) return { flow: nextFlow };
|
|
12302
12367
|
if (nextFlow.phase === "failed") try {
|
|
12303
12368
|
const account = await readAccount();
|
|
12304
12369
|
if (account?.authenticated === true) return {
|
|
@@ -12343,7 +12408,7 @@ void main(){
|
|
|
12343
12408
|
minute: "2-digit"
|
|
12344
12409
|
});
|
|
12345
12410
|
/** Quota of every signed-in account (read-only; the active account does not change). */
|
|
12346
|
-
function useAccountQuotas(rpc, ids, active = true) {
|
|
12411
|
+
function useAccountQuotas(rpc, ids, active = true, revision = 0) {
|
|
12347
12412
|
const [entries, setEntries] = (0, react.useState)({});
|
|
12348
12413
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
12349
12414
|
const request = (0, react.useRef)(0);
|
|
@@ -12352,10 +12417,7 @@ void main(){
|
|
|
12352
12417
|
activeRef.current = active;
|
|
12353
12418
|
const key = ids.join(",");
|
|
12354
12419
|
const load = (force) => {
|
|
12355
|
-
if (ids.length
|
|
12356
|
-
setEntries({});
|
|
12357
|
-
return;
|
|
12358
|
-
}
|
|
12420
|
+
if (ids.length === 0) return;
|
|
12359
12421
|
if (!activeRef.current || document.visibilityState === "hidden") return;
|
|
12360
12422
|
if (flight.current) {
|
|
12361
12423
|
const current = flight.current;
|
|
@@ -12363,6 +12425,7 @@ void main(){
|
|
|
12363
12425
|
return current.promise;
|
|
12364
12426
|
}
|
|
12365
12427
|
const id = ++request.current;
|
|
12428
|
+
if (force) setEntries({});
|
|
12366
12429
|
setBusy(true);
|
|
12367
12430
|
const current = {
|
|
12368
12431
|
id,
|
|
@@ -12383,17 +12446,19 @@ void main(){
|
|
|
12383
12446
|
return current.promise;
|
|
12384
12447
|
};
|
|
12385
12448
|
(0, react.useEffect)(() => {
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
setBusy(false);
|
|
12389
|
-
}
|
|
12449
|
+
setEntries({});
|
|
12450
|
+
setBusy(false);
|
|
12390
12451
|
return () => {
|
|
12391
12452
|
request.current += 1;
|
|
12392
12453
|
flight.current = void 0;
|
|
12393
12454
|
};
|
|
12394
|
-
}, [
|
|
12455
|
+
}, [
|
|
12456
|
+
key,
|
|
12457
|
+
revision,
|
|
12458
|
+
rpc
|
|
12459
|
+
]);
|
|
12395
12460
|
(0, react.useEffect)(() => {
|
|
12396
|
-
if (ids.length
|
|
12461
|
+
if (ids.length === 0 || !active) return void 0;
|
|
12397
12462
|
let timer;
|
|
12398
12463
|
const stop = () => {
|
|
12399
12464
|
clearInterval(timer);
|
|
@@ -12403,7 +12468,7 @@ void main(){
|
|
|
12403
12468
|
const wake = () => {
|
|
12404
12469
|
stop();
|
|
12405
12470
|
if (document.visibilityState === "hidden") return;
|
|
12406
|
-
|
|
12471
|
+
load(true);
|
|
12407
12472
|
timer = setInterval(again, 6e4);
|
|
12408
12473
|
};
|
|
12409
12474
|
wake();
|
|
@@ -12416,6 +12481,7 @@ void main(){
|
|
|
12416
12481
|
};
|
|
12417
12482
|
}, [
|
|
12418
12483
|
key,
|
|
12484
|
+
revision,
|
|
12419
12485
|
active,
|
|
12420
12486
|
rpc
|
|
12421
12487
|
]);
|
|
@@ -12425,27 +12491,43 @@ void main(){
|
|
|
12425
12491
|
refresh: () => load(true)
|
|
12426
12492
|
};
|
|
12427
12493
|
}
|
|
12428
|
-
function AccountQuota({ entry, loading, t }) {
|
|
12429
|
-
|
|
12430
|
-
|
|
12431
|
-
|
|
12432
|
-
|
|
12433
|
-
|
|
12434
|
-
|
|
12435
|
-
|
|
12436
|
-
|
|
12494
|
+
function AccountQuota({ entry, loading, showQuota, t }) {
|
|
12495
|
+
const state = entry === void 0 ? loading ? "loading" : "unknown" : entry.error === "ChatGPT sign-in needs to be renewed" ? "disconnected" : entry.error !== void 0 || entry.usage === void 0 ? "unknown" : "connected";
|
|
12496
|
+
const label = {
|
|
12497
|
+
connected: "accountVerified",
|
|
12498
|
+
disconnected: "accountRenewSignIn",
|
|
12499
|
+
loading: "accountVerifying",
|
|
12500
|
+
unknown: "accountUnverified"
|
|
12501
|
+
}[state];
|
|
12502
|
+
const status = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
12503
|
+
className: "codexSubscriptionStatus",
|
|
12504
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12505
|
+
className: "codexSubscriptionDot",
|
|
12506
|
+
"data-state": state,
|
|
12507
|
+
"aria-hidden": "true"
|
|
12508
|
+
}), t(label)]
|
|
12437
12509
|
});
|
|
12438
|
-
|
|
12439
|
-
|
|
12510
|
+
if (entry?.error !== void 0 && state !== "disconnected") {
|
|
12511
|
+
const message = accessFailureText(entry.error, t);
|
|
12512
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("small", {
|
|
12513
|
+
className: "codexSubscriptionAccountQuota",
|
|
12514
|
+
role: "status",
|
|
12515
|
+
children: [status, message !== entry.error ? message : null]
|
|
12516
|
+
});
|
|
12517
|
+
}
|
|
12518
|
+
if (state !== "connected" || !showQuota) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
|
|
12440
12519
|
className: "codexSubscriptionAccountQuota",
|
|
12441
|
-
|
|
12520
|
+
role: "status",
|
|
12521
|
+
children: status
|
|
12442
12522
|
});
|
|
12443
|
-
|
|
12523
|
+
const windows = entry.usage?.rateLimits?.find((limit) => limit.id === "codex")?.windows ?? [];
|
|
12524
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("small", {
|
|
12444
12525
|
className: "codexSubscriptionAccountQuota",
|
|
12445
|
-
|
|
12526
|
+
role: "status",
|
|
12527
|
+
children: [status, windows.length === 0 ? t("accountQuotaNone") : windows.map((window) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [fill(t("accountQuotaLeft"), {
|
|
12446
12528
|
label: windowLabel(window.windowSeconds, t),
|
|
12447
12529
|
value: percent(window.remainingPercent)
|
|
12448
|
-
}), window.resetsAt === void 0 ? "" : ` · ${fill(t("accountQuotaResets"), { value: when(window.resetsAt) })}`] }, window.windowSeconds))
|
|
12530
|
+
}), window.resetsAt === void 0 ? "" : ` · ${fill(t("accountQuotaResets"), { value: when(window.resetsAt) })}`] }, window.windowSeconds))]
|
|
12449
12531
|
});
|
|
12450
12532
|
}
|
|
12451
12533
|
//#endregion
|
|
@@ -12454,7 +12536,8 @@ void main(){
|
|
|
12454
12536
|
"account-claim",
|
|
12455
12537
|
"network",
|
|
12456
12538
|
"token-exchange",
|
|
12457
|
-
"callback"
|
|
12539
|
+
"callback",
|
|
12540
|
+
"account-mismatch"
|
|
12458
12541
|
];
|
|
12459
12542
|
function AccountEmail({ candidate, fallback, t, emailVisible, onClick }) {
|
|
12460
12543
|
if (typeof candidate?.email !== "string" || candidate.email.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -12471,11 +12554,13 @@ void main(){
|
|
|
12471
12554
|
});
|
|
12472
12555
|
}
|
|
12473
12556
|
const signedInIds = (account) => account?.authenticated === true ? (account.accounts ?? []).map((candidate) => candidate.id).filter((id) => typeof id === "string") : [];
|
|
12474
|
-
function AccountCard({ rpc, t, account, setAccount, onSignedOut, active = true }) {
|
|
12557
|
+
function AccountCard({ rpc, t, account, setAccount, onSignedOut, active = true, revision }) {
|
|
12475
12558
|
const [flow, setFlow] = (0, react.useState)();
|
|
12476
12559
|
const flowGeneration = (0, react.useRef)(0);
|
|
12477
12560
|
const [manualCode, setManualCode] = (0, react.useState)("");
|
|
12478
12561
|
const [adding, setAdding] = (0, react.useState)(false);
|
|
12562
|
+
const [renewId, setRenewId] = (0, react.useState)();
|
|
12563
|
+
const accountFlow = adding || renewId !== void 0;
|
|
12479
12564
|
const [removeId, setRemoveId] = (0, react.useState)();
|
|
12480
12565
|
const [confirmSignOut, setConfirmSignOut] = (0, react.useState)(false);
|
|
12481
12566
|
const [emailVisible, setEmailVisible] = (0, react.useState)(false);
|
|
@@ -12484,7 +12569,7 @@ void main(){
|
|
|
12484
12569
|
const [emailVisibilityKey, setEmailVisibilityKey] = (0, react.useState)(accountVisibilityKey);
|
|
12485
12570
|
const [busy, setBusy] = (0, react.useState)(false);
|
|
12486
12571
|
const [error, setError] = (0, react.useState)();
|
|
12487
|
-
const quotas = useAccountQuotas(rpc, signedInIds(account), active);
|
|
12572
|
+
const quotas = useAccountQuotas(rpc, signedInIds(account), active, revision);
|
|
12488
12573
|
const call = (endpoint, payload = {}) => recoveryCall(rpc, endpoint, payload);
|
|
12489
12574
|
(0, react.useEffect)(() => {
|
|
12490
12575
|
if (emailVisibilityKey === accountVisibilityKey) return;
|
|
@@ -12492,18 +12577,14 @@ void main(){
|
|
|
12492
12577
|
setEmailVisibilityKey(accountVisibilityKey);
|
|
12493
12578
|
}, [accountVisibilityKey, emailVisibilityKey]);
|
|
12494
12579
|
(0, react.useEffect)(() => {
|
|
12495
|
-
if (busy || flow?.id === void 0 || [
|
|
12496
|
-
"authenticated",
|
|
12497
|
-
"failed",
|
|
12498
|
-
"cancelled"
|
|
12499
|
-
].includes(flow.phase)) return void 0;
|
|
12580
|
+
if (busy || flow?.id === void 0 || ["failed", "cancelled"].includes(flow.phase)) return void 0;
|
|
12500
12581
|
let live = true;
|
|
12501
12582
|
let reading = false;
|
|
12502
12583
|
const generation = flowGeneration.current;
|
|
12503
12584
|
const timer = window.setInterval(() => {
|
|
12504
12585
|
if (reading) return;
|
|
12505
12586
|
reading = true;
|
|
12506
|
-
(
|
|
12587
|
+
(accountFlow ? call("login/status", { id: flow.id }).then(async (nextFlow) => ({
|
|
12507
12588
|
flow: nextFlow,
|
|
12508
12589
|
account: nextFlow.phase === "authenticated" ? await call("status") : void 0
|
|
12509
12590
|
})) : readLoginProgress({
|
|
@@ -12518,6 +12599,8 @@ void main(){
|
|
|
12518
12599
|
setAccount(next.account);
|
|
12519
12600
|
onSignedOut();
|
|
12520
12601
|
setAdding(false);
|
|
12602
|
+
setRenewId(void 0);
|
|
12603
|
+
setEmailVisible(false);
|
|
12521
12604
|
setFlow(void 0);
|
|
12522
12605
|
notifyQuickQuota();
|
|
12523
12606
|
}
|
|
@@ -12534,19 +12617,18 @@ void main(){
|
|
|
12534
12617
|
}, [
|
|
12535
12618
|
flow?.id,
|
|
12536
12619
|
flow?.phase,
|
|
12537
|
-
|
|
12620
|
+
accountFlow,
|
|
12538
12621
|
busy
|
|
12539
12622
|
]);
|
|
12540
|
-
const begin = (method, label) => {
|
|
12623
|
+
const begin = (method, target = adding ? { label: `Account ${accounts.length + 1}` } : {}) => {
|
|
12541
12624
|
flowGeneration.current += 1;
|
|
12542
12625
|
setFlow(void 0);
|
|
12543
12626
|
setBusy(true);
|
|
12544
12627
|
setError(void 0);
|
|
12545
|
-
const loginLabel = adding && label === void 0 ? `Account ${accounts.length + 1}` : label;
|
|
12546
12628
|
call("login/start", {
|
|
12547
12629
|
method,
|
|
12548
12630
|
openExternal: true,
|
|
12549
|
-
...
|
|
12631
|
+
...target
|
|
12550
12632
|
}).then(setFlow).catch(() => setError(t("failed"))).finally(() => setBusy(false));
|
|
12551
12633
|
};
|
|
12552
12634
|
const cancel = () => {
|
|
@@ -12555,9 +12637,12 @@ void main(){
|
|
|
12555
12637
|
setBusy(true);
|
|
12556
12638
|
setError(void 0);
|
|
12557
12639
|
call("login/cancel", { id: flow.id }).then((next) => {
|
|
12558
|
-
setFlow(
|
|
12559
|
-
if (
|
|
12560
|
-
|
|
12640
|
+
setFlow(accountFlow ? void 0 : next);
|
|
12641
|
+
if (accountFlow) {
|
|
12642
|
+
setAdding(false);
|
|
12643
|
+
setRenewId(void 0);
|
|
12644
|
+
return;
|
|
12645
|
+
}
|
|
12561
12646
|
return call("status").then((account) => {
|
|
12562
12647
|
if (account.authenticated === true) {
|
|
12563
12648
|
setAccount(account);
|
|
@@ -12630,20 +12715,106 @@ void main(){
|
|
|
12630
12715
|
setEmailVisible((value) => emailVisibilityKey === accountVisibilityKey ? !value : true);
|
|
12631
12716
|
};
|
|
12632
12717
|
const emailVisibleForAccount = emailVisible && emailVisibilityKey === accountVisibilityKey;
|
|
12718
|
+
const loginContent = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
12719
|
+
flow?.phase === "waiting_device" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12720
|
+
className: "codexSubscriptionFlow",
|
|
12721
|
+
children: [
|
|
12722
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("deviceHint") }),
|
|
12723
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
12724
|
+
className: "codexSubscriptionCode",
|
|
12725
|
+
children: flow.deviceCode?.userCode
|
|
12726
|
+
}),
|
|
12727
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
12728
|
+
href: flow.deviceCode?.verificationUri,
|
|
12729
|
+
target: "_blank",
|
|
12730
|
+
rel: "noreferrer",
|
|
12731
|
+
children: t("openLogin")
|
|
12732
|
+
}),
|
|
12733
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("waiting") }),
|
|
12734
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12735
|
+
type: "button",
|
|
12736
|
+
variant: "outline",
|
|
12737
|
+
disabled: busy,
|
|
12738
|
+
onClick: cancel,
|
|
12739
|
+
children: t("cancel")
|
|
12740
|
+
})
|
|
12741
|
+
]
|
|
12742
|
+
}) : null,
|
|
12743
|
+
flow?.phase === "waiting_input" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
12744
|
+
className: "codexSubscriptionFlow",
|
|
12745
|
+
onSubmit: submit,
|
|
12746
|
+
children: [
|
|
12747
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("manualCode") }),
|
|
12748
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Input, {
|
|
12749
|
+
className: "codexSubscriptionInput",
|
|
12750
|
+
value: manualCode,
|
|
12751
|
+
onChange: (event) => setManualCode(event.currentTarget.value),
|
|
12752
|
+
autoComplete: "off",
|
|
12753
|
+
spellCheck: false
|
|
12754
|
+
}),
|
|
12755
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12756
|
+
className: "codexSubscriptionActions",
|
|
12757
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12758
|
+
type: "submit",
|
|
12759
|
+
variant: "primary",
|
|
12760
|
+
disabled: busy || manualCode.trim() === "",
|
|
12761
|
+
children: t("submit")
|
|
12762
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12763
|
+
type: "button",
|
|
12764
|
+
variant: "outline",
|
|
12765
|
+
disabled: busy,
|
|
12766
|
+
onClick: cancel,
|
|
12767
|
+
children: t("cancel")
|
|
12768
|
+
})]
|
|
12769
|
+
})
|
|
12770
|
+
]
|
|
12771
|
+
}) : null,
|
|
12772
|
+
renewId !== void 0 && busy && flow === void 0 || ["starting", "waiting_browser"].includes(flow?.phase) ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12773
|
+
className: "codexSubscriptionFlow",
|
|
12774
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12775
|
+
role: "status",
|
|
12776
|
+
children: t(renewId === void 0 ? "waiting" : "renewAccountHint")
|
|
12777
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12778
|
+
className: "codexSubscriptionActions",
|
|
12779
|
+
children: [
|
|
12780
|
+
flow?.authUrl === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
12781
|
+
href: flow.authUrl,
|
|
12782
|
+
target: "_blank",
|
|
12783
|
+
rel: "noreferrer",
|
|
12784
|
+
children: t("openLogin")
|
|
12785
|
+
}),
|
|
12786
|
+
renewId === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12787
|
+
type: "button",
|
|
12788
|
+
variant: "outline",
|
|
12789
|
+
disabled: busy,
|
|
12790
|
+
onClick: () => begin("device_code", { renewId }),
|
|
12791
|
+
children: t("deviceLogin")
|
|
12792
|
+
}),
|
|
12793
|
+
flow === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12794
|
+
type: "button",
|
|
12795
|
+
variant: "outline",
|
|
12796
|
+
disabled: busy,
|
|
12797
|
+
onClick: cancel,
|
|
12798
|
+
children: t("cancel")
|
|
12799
|
+
})
|
|
12800
|
+
]
|
|
12801
|
+
})]
|
|
12802
|
+
}) : null,
|
|
12803
|
+
flow?.phase === "failed" || error !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12804
|
+
className: "codexSubscriptionError",
|
|
12805
|
+
role: "alert",
|
|
12806
|
+
children: error ?? (isAccessFailureMessage(flow?.error) ? accessFailureText(flow.error, t) : LOGIN_FAILURES.includes(flow?.failure) ? t(`failed_${flow.failure.replace("-", "_")}`) : t("failed"))
|
|
12807
|
+
}) : null
|
|
12808
|
+
] });
|
|
12633
12809
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12634
12810
|
className: "codexSubscriptionCard",
|
|
12635
12811
|
children: [
|
|
12636
12812
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12637
12813
|
className: "codexSubscriptionAccountRow",
|
|
12638
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
12814
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12639
12815
|
className: "codexSubscriptionStatus",
|
|
12640
12816
|
role: "status",
|
|
12641
|
-
"
|
|
12642
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
12643
|
-
className: "codexSubscriptionDot",
|
|
12644
|
-
"data-state": accountReady ? signedIn ? "connected" : "disconnected" : "loading",
|
|
12645
|
-
"aria-hidden": "true"
|
|
12646
|
-
}), accountReady ? signedIn ? t("connected") : t("disconnected") : t("accountLoading")]
|
|
12817
|
+
children: accountReady ? signedIn ? t("savedAccounts") : t("disconnected") : t("accountLoading")
|
|
12647
12818
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12648
12819
|
className: "codexSubscriptionActions",
|
|
12649
12820
|
children: signedIn ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
@@ -12652,6 +12823,8 @@ void main(){
|
|
|
12652
12823
|
disabled: busy || loginVisible,
|
|
12653
12824
|
onClick: () => {
|
|
12654
12825
|
setFlow(void 0);
|
|
12826
|
+
setError(void 0);
|
|
12827
|
+
setRenewId(void 0);
|
|
12655
12828
|
setAdding(true);
|
|
12656
12829
|
},
|
|
12657
12830
|
children: t("addAccount")
|
|
@@ -12671,7 +12844,7 @@ void main(){
|
|
|
12671
12844
|
variant: "outline",
|
|
12672
12845
|
disabled: busy || loginVisible,
|
|
12673
12846
|
onClick: () => setConfirmSignOut(true),
|
|
12674
|
-
children: t("signOutAll")
|
|
12847
|
+
children: t(accounts.length > 1 ? "signOutAll" : "logout")
|
|
12675
12848
|
})] }) : accountReady && (flow === void 0 || ["failed", "cancelled"].includes(flow.phase)) ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12676
12849
|
type: "button",
|
|
12677
12850
|
variant: "primary",
|
|
@@ -12689,51 +12862,67 @@ void main(){
|
|
|
12689
12862
|
}),
|
|
12690
12863
|
signedIn && accounts.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12691
12864
|
className: "codexSubscriptionAccounts",
|
|
12692
|
-
children: accounts.map((candidate) =>
|
|
12693
|
-
|
|
12694
|
-
|
|
12695
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12696
|
-
className: "
|
|
12697
|
-
|
|
12698
|
-
|
|
12699
|
-
|
|
12700
|
-
|
|
12701
|
-
|
|
12702
|
-
|
|
12703
|
-
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
|
|
12715
|
-
|
|
12716
|
-
|
|
12717
|
-
|
|
12718
|
-
|
|
12719
|
-
|
|
12720
|
-
|
|
12721
|
-
|
|
12722
|
-
|
|
12723
|
-
|
|
12724
|
-
|
|
12725
|
-
|
|
12726
|
-
|
|
12727
|
-
|
|
12728
|
-
|
|
12729
|
-
|
|
12730
|
-
|
|
12731
|
-
|
|
12732
|
-
|
|
12733
|
-
|
|
12734
|
-
|
|
12865
|
+
children: accounts.map((candidate) => {
|
|
12866
|
+
const entry = quotas.entries[candidate.id];
|
|
12867
|
+
const disabled = busy || loginVisible;
|
|
12868
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12869
|
+
className: "codexSubscriptionAccount",
|
|
12870
|
+
"data-active": candidate.active,
|
|
12871
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12872
|
+
className: "codexSubscriptionAccountMain",
|
|
12873
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccountEmail, {
|
|
12874
|
+
candidate,
|
|
12875
|
+
fallback: candidate.label,
|
|
12876
|
+
t,
|
|
12877
|
+
emailVisible: emailVisibleForAccount,
|
|
12878
|
+
onClick: toggleEmail
|
|
12879
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AccountQuota, {
|
|
12880
|
+
entry,
|
|
12881
|
+
loading: quotas.busy,
|
|
12882
|
+
showQuota: accounts.length > 1,
|
|
12883
|
+
t
|
|
12884
|
+
})]
|
|
12885
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12886
|
+
className: "codexSubscriptionActions",
|
|
12887
|
+
children: [
|
|
12888
|
+
entry?.error === "ChatGPT sign-in needs to be renewed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12889
|
+
type: "button",
|
|
12890
|
+
variant: "outline",
|
|
12891
|
+
disabled,
|
|
12892
|
+
onClick: () => {
|
|
12893
|
+
setAdding(false);
|
|
12894
|
+
setRenewId(candidate.id);
|
|
12895
|
+
begin("browser", { renewId: candidate.id });
|
|
12896
|
+
},
|
|
12897
|
+
children: t("renewAccount")
|
|
12898
|
+
}) : null,
|
|
12899
|
+
candidate.active ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12900
|
+
type: "button",
|
|
12901
|
+
variant: "outline",
|
|
12902
|
+
disabled,
|
|
12903
|
+
onClick: () => selectAccount(candidate.id),
|
|
12904
|
+
children: t("switchAccount")
|
|
12905
|
+
}),
|
|
12906
|
+
accounts.length > 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12907
|
+
type: "button",
|
|
12908
|
+
variant: "outline",
|
|
12909
|
+
disabled,
|
|
12910
|
+
onClick: () => removeAccount(candidate.id),
|
|
12911
|
+
children: removeId === candidate.id ? t("removeConfirm") : t("removeAccount")
|
|
12912
|
+
}) : null,
|
|
12913
|
+
removeId === candidate.id ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12914
|
+
type: "button",
|
|
12915
|
+
variant: "outline",
|
|
12916
|
+
disabled: busy,
|
|
12917
|
+
onClick: () => setRemoveId(void 0),
|
|
12918
|
+
children: t("removeCancel")
|
|
12919
|
+
}) : null
|
|
12920
|
+
]
|
|
12921
|
+
})]
|
|
12922
|
+
}), renewId === candidate.id ? loginContent : null] }, candidate.id);
|
|
12923
|
+
})
|
|
12735
12924
|
}) : null,
|
|
12736
|
-
signedIn && adding &&
|
|
12925
|
+
signedIn && adding && !loginVisible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
12737
12926
|
className: "codexSubscriptionFlow",
|
|
12738
12927
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12739
12928
|
className: "codexSubscriptionActions",
|
|
@@ -12756,89 +12945,18 @@ void main(){
|
|
|
12756
12945
|
type: "button",
|
|
12757
12946
|
variant: "outline",
|
|
12758
12947
|
disabled: busy,
|
|
12759
|
-
onClick: () =>
|
|
12948
|
+
onClick: () => {
|
|
12949
|
+
setAdding(false);
|
|
12950
|
+
setRenewId(void 0);
|
|
12951
|
+
setFlow(void 0);
|
|
12952
|
+
setError(void 0);
|
|
12953
|
+
},
|
|
12760
12954
|
children: t("cancel")
|
|
12761
12955
|
})
|
|
12762
12956
|
]
|
|
12763
12957
|
})
|
|
12764
12958
|
}) : null,
|
|
12765
|
-
|
|
12766
|
-
className: "codexSubscriptionFlow",
|
|
12767
|
-
children: [
|
|
12768
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("deviceHint") }),
|
|
12769
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
12770
|
-
className: "codexSubscriptionCode",
|
|
12771
|
-
children: flow.deviceCode?.userCode
|
|
12772
|
-
}),
|
|
12773
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
12774
|
-
href: flow.deviceCode?.verificationUri,
|
|
12775
|
-
target: "_blank",
|
|
12776
|
-
rel: "noreferrer",
|
|
12777
|
-
children: t("openLogin")
|
|
12778
|
-
}),
|
|
12779
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("waiting") }),
|
|
12780
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12781
|
-
type: "button",
|
|
12782
|
-
variant: "outline",
|
|
12783
|
-
disabled: busy,
|
|
12784
|
-
onClick: cancel,
|
|
12785
|
-
children: t("cancel")
|
|
12786
|
-
})
|
|
12787
|
-
]
|
|
12788
|
-
}) : null,
|
|
12789
|
-
flow?.phase === "waiting_input" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
12790
|
-
className: "codexSubscriptionFlow",
|
|
12791
|
-
onSubmit: submit,
|
|
12792
|
-
children: [
|
|
12793
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("manualCode") }),
|
|
12794
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Input, {
|
|
12795
|
-
className: "codexSubscriptionInput",
|
|
12796
|
-
value: manualCode,
|
|
12797
|
-
onChange: (event) => setManualCode(event.currentTarget.value),
|
|
12798
|
-
autoComplete: "off",
|
|
12799
|
-
spellCheck: false
|
|
12800
|
-
}),
|
|
12801
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12802
|
-
className: "codexSubscriptionActions",
|
|
12803
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12804
|
-
type: "submit",
|
|
12805
|
-
variant: "primary",
|
|
12806
|
-
disabled: busy || manualCode.trim() === "",
|
|
12807
|
-
children: t("submit")
|
|
12808
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12809
|
-
type: "button",
|
|
12810
|
-
variant: "outline",
|
|
12811
|
-
disabled: busy,
|
|
12812
|
-
onClick: cancel,
|
|
12813
|
-
children: t("cancel")
|
|
12814
|
-
})]
|
|
12815
|
-
})
|
|
12816
|
-
]
|
|
12817
|
-
}) : null,
|
|
12818
|
-
flow !== void 0 && ["starting", "waiting_browser"].includes(flow.phase) ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
12819
|
-
className: "codexSubscriptionFlow",
|
|
12820
|
-
children: [
|
|
12821
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("waiting") }),
|
|
12822
|
-
flow.authUrl === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
12823
|
-
href: flow.authUrl,
|
|
12824
|
-
target: "_blank",
|
|
12825
|
-
rel: "noreferrer",
|
|
12826
|
-
children: t("openLogin")
|
|
12827
|
-
}),
|
|
12828
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
12829
|
-
type: "button",
|
|
12830
|
-
variant: "outline",
|
|
12831
|
-
disabled: busy,
|
|
12832
|
-
onClick: cancel,
|
|
12833
|
-
children: t("cancel")
|
|
12834
|
-
})
|
|
12835
|
-
]
|
|
12836
|
-
}) : null,
|
|
12837
|
-
flow?.phase === "failed" || error !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
12838
|
-
className: "codexSubscriptionError",
|
|
12839
|
-
role: "alert",
|
|
12840
|
-
children: error ?? (LOGIN_FAILURES.includes(flow?.failure) ? t(`failed_${flow.failure.replace("-", "_")}`) : t("failed"))
|
|
12841
|
-
}) : null
|
|
12959
|
+
renewId === void 0 ? loginContent : null
|
|
12842
12960
|
]
|
|
12843
12961
|
});
|
|
12844
12962
|
}
|
|
@@ -13081,7 +13199,7 @@ void main(){
|
|
|
13081
13199
|
state.status === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
13082
13200
|
className: "codexSubscriptionError",
|
|
13083
13201
|
role: "alert",
|
|
13084
|
-
children: state.message
|
|
13202
|
+
children: accessFailureText(state.message, t)
|
|
13085
13203
|
}) : null,
|
|
13086
13204
|
state.status === "ready" && stats.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
13087
13205
|
className: "codexSubscriptionEmpty",
|
|
@@ -13223,7 +13341,7 @@ void main(){
|
|
|
13223
13341
|
}) : null, state.status === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
13224
13342
|
className: "codexSubscriptionError",
|
|
13225
13343
|
role: "alert",
|
|
13226
|
-
children: state.message
|
|
13344
|
+
children: accessFailureText(state.message, t)
|
|
13227
13345
|
}) : null]
|
|
13228
13346
|
}),
|
|
13229
13347
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -13498,6 +13616,7 @@ void main(){
|
|
|
13498
13616
|
});
|
|
13499
13617
|
}
|
|
13500
13618
|
function resetCreditErrorText(error, t) {
|
|
13619
|
+
if (isAccessFailureMessage(error?.message)) return accessFailureText(error.message, t);
|
|
13501
13620
|
return t((/* @__PURE__ */ new Map([
|
|
13502
13621
|
["ChatGPT subscription is not signed in", "resetRenewLogin"],
|
|
13503
13622
|
["ChatGPT sign-in needs to be renewed", "resetRenewLogin"],
|
|
@@ -13572,7 +13691,7 @@ void main(){
|
|
|
13572
13691
|
error === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
13573
13692
|
className: "codexSubscriptionError",
|
|
13574
13693
|
role: "alert",
|
|
13575
|
-
children: error
|
|
13694
|
+
children: accessFailureText(error, t)
|
|
13576
13695
|
}),
|
|
13577
13696
|
visibleUsage?.spendControlReached === true ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
13578
13697
|
className: "codexSubscriptionError",
|
|
@@ -13828,7 +13947,20 @@ void main(){
|
|
|
13828
13947
|
children: items
|
|
13829
13948
|
});
|
|
13830
13949
|
}
|
|
13831
|
-
function
|
|
13950
|
+
function ProjectLink({ t }) {
|
|
13951
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
|
|
13952
|
+
variant: "outline",
|
|
13953
|
+
size: "sm",
|
|
13954
|
+
title: t("projectHomepage"),
|
|
13955
|
+
onClick: () => window.open(PROJECT_URL, "_blank", "noopener,noreferrer"),
|
|
13956
|
+
children: "GitHub"
|
|
13957
|
+
});
|
|
13958
|
+
}
|
|
13959
|
+
/** The host owns the header and its layout; contribute only to our bundle. */
|
|
13960
|
+
function ProjectAction({ subject, t }) {
|
|
13961
|
+
return subject?.kind === "bundle" && subject.pkg.name === "dsh-codex-subscription" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectLink, { t }) : null;
|
|
13962
|
+
}
|
|
13963
|
+
function CodexSection({ preference, rpc, accountStatus, t, diagnostics, defaultModel, embedded = false }) {
|
|
13832
13964
|
const [tab, setTab] = (0, react.useState)("start");
|
|
13833
13965
|
const [visited, setVisited] = (0, react.useState)(() => /* @__PURE__ */ new Set(["start"]));
|
|
13834
13966
|
const selectTab = (value) => {
|
|
@@ -13859,10 +13991,11 @@ void main(){
|
|
|
13859
13991
|
}, [accountStatus, preference]);
|
|
13860
13992
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
13861
13993
|
className: "codexSubscription",
|
|
13994
|
+
"data-embedded": embedded || void 0,
|
|
13862
13995
|
children: [
|
|
13863
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
13996
|
+
embedded ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
13864
13997
|
className: "codexSubscriptionHead",
|
|
13865
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", { children: t("title") })
|
|
13998
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", { children: t("title") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProjectLink, { t })]
|
|
13866
13999
|
}),
|
|
13867
14000
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
13868
14001
|
className: "codexSettingsTabs",
|
|
@@ -13913,7 +14046,8 @@ void main(){
|
|
|
13913
14046
|
account,
|
|
13914
14047
|
setAccount,
|
|
13915
14048
|
onSignedOut: accountChanged,
|
|
13916
|
-
active: tab === "start"
|
|
14049
|
+
active: tab === "start",
|
|
14050
|
+
revision: resetKey
|
|
13917
14051
|
}),
|
|
13918
14052
|
account === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UsageCard, {
|
|
13919
14053
|
rpc,
|
|
@@ -13987,6 +14121,40 @@ void main(){
|
|
|
13987
14121
|
});
|
|
13988
14122
|
}
|
|
13989
14123
|
//#endregion
|
|
14124
|
+
//#region src/subscription-settings-entry.js
|
|
14125
|
+
const PACKAGE_NAME = "dsh-codex-subscription";
|
|
14126
|
+
/** Both host surfaces use the same controllers, RPC client and quota cache. */
|
|
14127
|
+
function registerSubscriptionSettings(ctx, shared, Section, ProjectAction) {
|
|
14128
|
+
ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
14129
|
+
name: "settings.section",
|
|
14130
|
+
id: "codex-subscription",
|
|
14131
|
+
order: 15,
|
|
14132
|
+
label: () => shared.t("nav"),
|
|
14133
|
+
locale: "settings.codexSubscription",
|
|
14134
|
+
inject: () => shared
|
|
14135
|
+
}, Section));
|
|
14136
|
+
ctx.slots.inject("plugins.bundle.config", () => ctx.slots.register({
|
|
14137
|
+
name: "plugins.bundle.config",
|
|
14138
|
+
key: PACKAGE_NAME,
|
|
14139
|
+
locale: "settings.codexSubscription",
|
|
14140
|
+
inject: () => ({
|
|
14141
|
+
...shared,
|
|
14142
|
+
embedded: true
|
|
14143
|
+
})
|
|
14144
|
+
}, Section));
|
|
14145
|
+
ctx.slots.inject("plugins.detail.actions", () => ctx.slots.register({
|
|
14146
|
+
name: "plugins.detail.actions",
|
|
14147
|
+
id: "codex-subscription-project",
|
|
14148
|
+
locale: "settings.codexSubscription",
|
|
14149
|
+
inject: () => ({ t: shared.t })
|
|
14150
|
+
}, ProjectAction));
|
|
14151
|
+
}
|
|
14152
|
+
/** Optional host navigation: older deployments retain their original settings entry. */
|
|
14153
|
+
function subscriptionSettingsOpener(ctx) {
|
|
14154
|
+
const navigation = ctx.get("pluginNavigation");
|
|
14155
|
+
return typeof navigation?.openBundle === "function" ? () => navigation.openBundle(PACKAGE_NAME) : void 0;
|
|
14156
|
+
}
|
|
14157
|
+
//#endregion
|
|
13990
14158
|
//#region src/diagnostic-checks.js
|
|
13991
14159
|
const states = /* @__PURE__ */ new Set([
|
|
13992
14160
|
"pass",
|
|
@@ -14574,21 +14742,14 @@ void main(){
|
|
|
14574
14742
|
t
|
|
14575
14743
|
})
|
|
14576
14744
|
}, DeferredImageViewer));
|
|
14577
|
-
ctx
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
rpc,
|
|
14586
|
-
accountStatus,
|
|
14587
|
-
t,
|
|
14588
|
-
diagnostics,
|
|
14589
|
-
defaultModel
|
|
14590
|
-
})
|
|
14591
|
-
}, CodexSection));
|
|
14745
|
+
registerSubscriptionSettings(ctx, {
|
|
14746
|
+
preference,
|
|
14747
|
+
rpc,
|
|
14748
|
+
accountStatus,
|
|
14749
|
+
t,
|
|
14750
|
+
diagnostics,
|
|
14751
|
+
defaultModel
|
|
14752
|
+
}, CodexSection, ProjectAction);
|
|
14592
14753
|
const sessions = ctx.get("sessions");
|
|
14593
14754
|
const rootDirectories = ctx.get("modelDirectories");
|
|
14594
14755
|
let scopedDirectories;
|
|
@@ -14602,6 +14763,7 @@ void main(){
|
|
|
14602
14763
|
preference,
|
|
14603
14764
|
rpc,
|
|
14604
14765
|
t,
|
|
14766
|
+
openSettings: subscriptionSettingsOpener(ctx),
|
|
14605
14767
|
directory: (scopedDirectories ?? rootDirectories).directoryFor(sessionId).store
|
|
14606
14768
|
})
|
|
14607
14769
|
}, ComposerRight));
|