@tostudy-ai/cli 0.18.10 → 0.18.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +9 -3
- package/dist/main.js.map +2 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1043,6 +1043,7 @@ var init_errors_pt_br = __esm({
|
|
|
1043
1043
|
suggestReasonMatch: "combina com o seu perfil em",
|
|
1044
1044
|
suggestReasonAnd: "e",
|
|
1045
1045
|
suggestPaidHeader: "Pagos. A matr\xEDcula fica no navegador e nada \xE9 debitado por aqui:",
|
|
1046
|
+
loginAccountOwnerManaged: "Esta conta agora \xE9 gerenciada por voc\xEA no ToStudy (senha ou login social), ent\xE3o c\xF3digos e magic-links da imers\xE3o n\xE3o funcionam mais. Rode `tostudy login` (sem --magic-link) para entrar pelo navegador.",
|
|
1046
1047
|
enrollmentNotEntitled: "\u{1F6AB} Sua matr\xEDcula neste curso n\xE3o est\xE1 mais ativa (reembolso, cancelamento ou preview expirado).\nPara voltar a estudar, adquira o curso novamente em https://tostudy.ai.\n",
|
|
1047
1048
|
creator: {
|
|
1048
1049
|
loginBrowserOnly: "`--creator` s\xF3 funciona no login pelo browser. Rode `tostudy login --creator` sem --code, --magic-link ou --manual.",
|
|
@@ -1154,6 +1155,7 @@ var init_errors_en_us = __esm({
|
|
|
1154
1155
|
suggestReasonMatch: "matches your profile on",
|
|
1155
1156
|
suggestReasonAnd: "and",
|
|
1156
1157
|
suggestPaidHeader: "Paid. Enrollment stays in the browser and nothing is charged here:",
|
|
1158
|
+
loginAccountOwnerManaged: "You now manage this account on ToStudy (password or social login), so immersion codes and magic links no longer work. Run `tostudy login` (without --magic-link) to sign in through the browser.",
|
|
1157
1159
|
enrollmentNotEntitled: "\u{1F6AB} Your enrollment in this course is no longer active (refund, cancellation, or expired preview).\nTo study again, purchase the course at https://tostudy.ai.\n",
|
|
1158
1160
|
creator: {
|
|
1159
1161
|
loginBrowserOnly: "`--creator` only works with the browser login. Run `tostudy login --creator` without --code, --magic-link or --manual.",
|
|
@@ -3486,6 +3488,10 @@ async function persistSession(data, apiUrl) {
|
|
|
3486
3488
|
apiUrl
|
|
3487
3489
|
});
|
|
3488
3490
|
}
|
|
3491
|
+
function exchangeErrorMessage(code) {
|
|
3492
|
+
if (code === "account_owner_managed") return getErrors().loginAccountOwnerManaged;
|
|
3493
|
+
return code ?? "Falha na autentica\xE7\xE3o";
|
|
3494
|
+
}
|
|
3489
3495
|
async function loginWithCode(code, apiUrl) {
|
|
3490
3496
|
assertTrustedApiUrl(apiUrl);
|
|
3491
3497
|
const res = await fetch(`${apiUrl}/api/cli/auth/exchange`, {
|
|
@@ -3495,7 +3501,7 @@ async function loginWithCode(code, apiUrl) {
|
|
|
3495
3501
|
});
|
|
3496
3502
|
if (!res.ok) {
|
|
3497
3503
|
const body = await res.json().catch(() => ({}));
|
|
3498
|
-
throw new Error(body.error
|
|
3504
|
+
throw new Error(exchangeErrorMessage(body.error));
|
|
3499
3505
|
}
|
|
3500
3506
|
const data = await res.json();
|
|
3501
3507
|
await persistSession(data, apiUrl);
|
|
@@ -3519,7 +3525,7 @@ async function loginWithMagicLink(magicLinkUrl, apiUrl) {
|
|
|
3519
3525
|
});
|
|
3520
3526
|
if (!res.ok) {
|
|
3521
3527
|
const body = await res.json().catch(() => ({}));
|
|
3522
|
-
throw new Error(body.error
|
|
3528
|
+
throw new Error(exchangeErrorMessage(body.error));
|
|
3523
3529
|
}
|
|
3524
3530
|
const data = await res.json();
|
|
3525
3531
|
await persistSession(data, apiUrl);
|
|
@@ -3840,7 +3846,7 @@ init_workspace_state();
|
|
|
3840
3846
|
init_formatter();
|
|
3841
3847
|
|
|
3842
3848
|
// src/version.ts
|
|
3843
|
-
var CLI_VERSION = true ? "0.18.
|
|
3849
|
+
var CLI_VERSION = true ? "0.18.11" : "0.7.1";
|
|
3844
3850
|
|
|
3845
3851
|
// src/update-checker.ts
|
|
3846
3852
|
init_config_dir();
|