@sendbird/cli 0.0.0-stage → 0.4.0
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/.claude-plugin/plugin.json +11 -0
- package/.codex-plugin/plugin.json +39 -0
- package/LICENSE +13 -0
- package/NOTICE.md +1105 -0
- package/PROVENANCE.md +15 -0
- package/README.md +44 -2
- package/dist/acl.d.ts +2 -0
- package/dist/acl.js +12 -0
- package/dist/acl.js.map +1 -0
- package/dist/billing-plan.d.ts +68 -0
- package/dist/billing-plan.js +235 -0
- package/dist/billing-plan.js.map +1 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +20 -0
- package/dist/browser.js.map +1 -0
- package/dist/calls-catalog.d.ts +79 -0
- package/dist/calls-catalog.js +322 -0
- package/dist/calls-catalog.js.map +1 -0
- package/dist/calls-credits.d.ts +31 -0
- package/dist/calls-credits.js +224 -0
- package/dist/calls-credits.js.map +1 -0
- package/dist/calls-trial.d.ts +45 -0
- package/dist/calls-trial.js +77 -0
- package/dist/calls-trial.js.map +1 -0
- package/dist/calls.d.ts +10 -0
- package/dist/calls.js +470 -0
- package/dist/calls.js.map +1 -0
- package/dist/catalog.d.ts +67 -0
- package/dist/catalog.js +784 -0
- package/dist/catalog.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +502 -0
- package/dist/cli.js.map +1 -0
- package/dist/core.d.ts +86 -0
- package/dist/core.js +531 -0
- package/dist/core.js.map +1 -0
- package/dist/diagnostics.d.ts +206 -0
- package/dist/diagnostics.js +664 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/discovery.d.ts +703 -0
- package/dist/discovery.js +846 -0
- package/dist/discovery.js.map +1 -0
- package/dist/docs.d.ts +31 -0
- package/dist/docs.js +139 -0
- package/dist/docs.js.map +1 -0
- package/dist/features.d.ts +131 -0
- package/dist/features.js +227 -0
- package/dist/features.js.map +1 -0
- package/dist/generated-api.d.ts +116 -0
- package/dist/generated-api.js +118 -0
- package/dist/generated-api.js.map +1 -0
- package/dist/human-format.d.ts +40 -0
- package/dist/human-format.js +205 -0
- package/dist/human-format.js.map +1 -0
- package/dist/human-list.d.ts +2 -0
- package/dist/human-list.js +368 -0
- package/dist/human-list.js.map +1 -0
- package/dist/human-output.d.ts +10 -0
- package/dist/human-output.js +1351 -0
- package/dist/human-output.js.map +1 -0
- package/dist/human-pro.d.ts +3 -0
- package/dist/human-pro.js +201 -0
- package/dist/human-pro.js.map +1 -0
- package/dist/human-progress.d.ts +5 -0
- package/dist/human-progress.js +49 -0
- package/dist/human-progress.js.map +1 -0
- package/dist/local.d.ts +42 -0
- package/dist/local.js +707 -0
- package/dist/local.js.map +1 -0
- package/dist/oauth-callback.d.ts +3 -0
- package/dist/oauth-callback.js +66 -0
- package/dist/oauth-callback.js.map +1 -0
- package/dist/oauth-lock.d.ts +6 -0
- package/dist/oauth-lock.js +212 -0
- package/dist/oauth-lock.js.map +1 -0
- package/dist/oauth.d.ts +32 -0
- package/dist/oauth.js +493 -0
- package/dist/oauth.js.map +1 -0
- package/dist/presentation.d.ts +208 -0
- package/dist/presentation.js +156 -0
- package/dist/presentation.js.map +1 -0
- package/dist/pro-api-catalog.d.ts +24 -0
- package/dist/pro-api-catalog.js +619 -0
- package/dist/pro-api-catalog.js.map +1 -0
- package/dist/pro-api.d.ts +10 -0
- package/dist/pro-api.js +338 -0
- package/dist/pro-api.js.map +1 -0
- package/dist/project.d.ts +34 -0
- package/dist/project.js +62 -0
- package/dist/project.js.map +1 -0
- package/dist/recovery.d.ts +41 -0
- package/dist/recovery.js +417 -0
- package/dist/recovery.js.map +1 -0
- package/dist/runner.d.ts +47 -0
- package/dist/runner.js +603 -0
- package/dist/runner.js.map +1 -0
- package/dist/sdk-catalog.d.ts +69 -0
- package/dist/sdk-catalog.js +527 -0
- package/dist/sdk-catalog.js.map +1 -0
- package/dist/sdk-config.d.ts +19 -0
- package/dist/sdk-config.js +85 -0
- package/dist/sdk-config.js.map +1 -0
- package/dist/sdk-dto.d.ts +244 -0
- package/dist/sdk-dto.js +98 -0
- package/dist/sdk-dto.js.map +1 -0
- package/dist/sdk-limits.d.ts +2 -0
- package/dist/sdk-limits.js +3 -0
- package/dist/sdk-limits.js.map +1 -0
- package/dist/sdk-node-file-reader.d.ts +6 -0
- package/dist/sdk-node-file-reader.js +38 -0
- package/dist/sdk-node-file-reader.js.map +1 -0
- package/dist/sdk-pro-catalog.d.ts +22 -0
- package/dist/sdk-pro-catalog.js +234 -0
- package/dist/sdk-pro-catalog.js.map +1 -0
- package/dist/sdk-pro-runtime.d.ts +31 -0
- package/dist/sdk-pro-runtime.js +293 -0
- package/dist/sdk-pro-runtime.js.map +1 -0
- package/dist/sdk-query.d.ts +10 -0
- package/dist/sdk-query.js +29 -0
- package/dist/sdk-query.js.map +1 -0
- package/dist/sdk-runtime.d.ts +15 -0
- package/dist/sdk-runtime.js +685 -0
- package/dist/sdk-runtime.js.map +1 -0
- package/dist/sdk-worker.d.ts +1 -0
- package/dist/sdk-worker.js +26 -0
- package/dist/sdk-worker.js.map +1 -0
- package/dist/sdk.d.ts +29 -0
- package/dist/sdk.js +346 -0
- package/dist/sdk.js.map +1 -0
- package/dist/search-engine.d.ts +17 -0
- package/dist/search-engine.js +54 -0
- package/dist/search-engine.js.map +1 -0
- package/dist/search-intents.d.ts +2 -0
- package/dist/search-intents.js +106 -0
- package/dist/search-intents.js.map +1 -0
- package/dist/search.d.ts +7 -0
- package/dist/search.js +58 -0
- package/dist/search.js.map +1 -0
- package/dist/secret-output.d.ts +2 -0
- package/dist/secret-output.js +108 -0
- package/dist/secret-output.js.map +1 -0
- package/dist/shell.d.ts +3 -0
- package/dist/shell.js +14 -0
- package/dist/shell.js.map +1 -0
- package/dist/skills.d.ts +210 -0
- package/dist/skills.js +374 -0
- package/dist/skills.js.map +1 -0
- package/dist/value-semantics.d.ts +70 -0
- package/dist/value-semantics.js +173 -0
- package/dist/value-semantics.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/dist/windows.d.ts +4 -0
- package/dist/windows.js +136 -0
- package/dist/windows.js.map +1 -0
- package/dist/workflows.d.ts +228 -0
- package/dist/workflows.js +1207 -0
- package/dist/workflows.js.map +1 -0
- package/package.json +90 -4
- package/plugin.json +25 -0
- package/references/agent-guide.json +199 -0
- package/references/commands.md +247 -0
- package/references/dashboard-inventory.json +14796 -0
- package/references/docs-index.json +5329 -0
- package/references/sdk-commands.json +15065 -0
- package/references/workflows.json +1246 -0
- package/skills/sendbird/SKILL.md +96 -0
- package/skills/sendbird/agents/openai.yaml +4 -0
- package/skills/sendbird/references/build-chat-app.md +50 -0
- package/skills/sendbird/references/client-guide.md +34 -0
- package/skills/sendbird/references/client-plugin-bridge.md +77 -0
- package/skills/sendbird/references/client-plugin-install.md +39 -0
- package/skills/sendbird/references/operational-checks.md +35 -0
- package/skills/sendbird/references/pro-capabilities.md +52 -0
- package/skills/sendbird/scripts/client-guide.mjs +283 -0
- package/skills/sendbird/scripts/client-plugin-bridge.mjs +703 -0
- package/skills/sendbird-setup/SKILL.md +18 -0
- package/skills/sendbird-setup/agents/openai.yaml +4 -0
- package/skills/sendbird-setup/references/onboarding.md +73 -0
- package/skills/sendbird-setup/scripts/install-cli.mjs +447 -0
- package/skills/sendbird-setup/scripts/npm-run.mjs +34 -0
package/PROVENANCE.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Implementation provenance
|
|
2
|
+
|
|
3
|
+
This separate CLI follows the approved Sendbird Chat alpha scope. Its registry, runner and CLI are implemented here; Dashbird was inspected as an internal design reference for authentication, HTTP requests, profiles, JSON output, inventory auditing and agent distribution.
|
|
4
|
+
|
|
5
|
+
- Dashbird reference checkout: `dashbird-cli-unified`, commit `11ddbd6` (local checkout, not a release claim).
|
|
6
|
+
- Dashboard baseline: `f29b7c5cfcb87e67aa572f8c5fe9e9dda44fad31`.
|
|
7
|
+
- Exact Dashboard file/symbol/line/hash mappings and discovered axios call sites are in `references/dashboard-inventory.json`.
|
|
8
|
+
- API source and React form source were both inspected. Notable cases: Supergroup path switching, multipart channel/user bodies, metadata upsert, org creation returning `organizations[]`, session cookie names, support case Salesforce-style field names.
|
|
9
|
+
- No Delight role bypass or generated Delight API surface is included.
|
|
10
|
+
|
|
11
|
+
The first-party CLI is proprietary; see LICENSE. Dependency terms are preserved in NOTICE.md and the upstream packages. Reference repositories do not by themselves establish ownership or redistribution permission. Public distribution remains subject to rights and license review; earlier grants are not revoked by this notice.
|
|
12
|
+
|
|
13
|
+
SDK extension (`0.2.0-alpha.1`): uses the official `@sendbird/chat` package pinned at 4.22.13, including its Node transport support. SDK method/type mappings are tracked separately in `references/sdk-commands.json`; they are not claimed as Dashboard API wrappers. The worker boundary isolates SDK background timers and keeps diagnostic logs out of CLI data output. [Official authentication](https://sendbird.com/docs/chat/sdk/v4/javascript/application/authenticating-a-user/authentication) and [message documentation](https://sendbird.com/docs/chat/sdk/v4/javascript/message/overview-message) were used alongside the installed declaration files.
|
|
14
|
+
|
|
15
|
+
The Pro extension keeps SDK mappings separate from Dashboard HTTP provenance. `references/dashboard-inventory.json` records the current Dashboard revision, exact source symbols and hashes of the owned validation/normalization modules. Offline CI checks those hashes; a Dashboard source audit is still a separate check and neither proves deployed Gate routing nor live entitlement. No Bot/GDPR proxy route is inferred from the presence of an internal handler.
|
package/README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Sendbird CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Manage Sendbird apps and Chat from your terminal or AI coding agent.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install -g @sendbird/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Requires Node.js 22.23.4+ (22.x) or 24.22.1+ (24.x). Supports macOS, Linux and Windows.
|
|
12
|
+
The 0.4 release begins the officially supported release line.
|
|
13
|
+
|
|
14
|
+
## Get started
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
sendbird setup
|
|
18
|
+
sendbird app list
|
|
19
|
+
sendbird --help
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Sign in through your browser and select an organization and app.
|
|
23
|
+
Use `--json` for scripts and `--dry-run` to preview supported changes.
|
|
24
|
+
|
|
25
|
+
## AI coding agents
|
|
26
|
+
|
|
27
|
+
Register the bundled Skill for your coding tool:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
sendbird skills install --agent claude --scope project
|
|
31
|
+
# Or, for Codex:
|
|
32
|
+
sendbird skills install --agent codex --scope project
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
See the [Claude Code](https://github.com/sendbird/sendbird-cli/blob/main/onboarding/claude-code.md) or [Codex](https://github.com/sendbird/sendbird-cli/blob/main/onboarding/codex.md) setup guide for plugin installation.
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
- [Command reference](https://github.com/sendbird/sendbird-cli/blob/main/references/commands.md)
|
|
40
|
+
- [Windows setup](https://github.com/sendbird/sendbird-cli/blob/main/docs/windows.md)
|
|
41
|
+
- [Development](https://github.com/sendbird/sendbird-cli/blob/main/docs/development.md)
|
|
42
|
+
- [Release notes](https://github.com/sendbird/sendbird-cli/blob/main/CHANGELOG.md)
|
|
43
|
+
- [Security](https://github.com/sendbird/sendbird-cli/blob/main/SECURITY.md)
|
|
44
|
+
|
|
45
|
+
Proprietary software. See [LICENSE](https://github.com/sendbird/sendbird-cli/blob/main/LICENSE) and [third-party notices](https://github.com/sendbird/sendbird-cli/blob/main/NOTICE.md).
|
package/dist/acl.d.ts
ADDED
package/dist/acl.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Dashboard levels are hierarchical only inside the same permission namespace. */
|
|
2
|
+
export function permissionMatches(granted, required) {
|
|
3
|
+
if (granted === required)
|
|
4
|
+
return true;
|
|
5
|
+
const g = granted.split("."), r = required.split("."), levels = ["view", "chat", "moderate", "all"];
|
|
6
|
+
if (g.length !== r.length ||
|
|
7
|
+
g.slice(0, -1).join(".") !== r.slice(0, -1).join("."))
|
|
8
|
+
return false;
|
|
9
|
+
const gi = levels.indexOf(g.at(-1)), ri = levels.indexOf(r.at(-1));
|
|
10
|
+
return gi >= 0 && ri >= 0 && gi >= ri;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=acl.js.map
|
package/dist/acl.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acl.js","sourceRoot":"","sources":["../src/acl.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE,QAAgB;IACjE,IAAI,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAC1B,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EACvB,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAC/C,IACE,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QACrB,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAErD,OAAO,KAAK,CAAC;IACf,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,EAClC,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;IACjC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type Transport } from "./core.js";
|
|
3
|
+
export declare const billingVerificationSchema: z.ZodObject<{
|
|
4
|
+
change_state: z.ZodEnum<{
|
|
5
|
+
scheduled: "scheduled";
|
|
6
|
+
current: "current";
|
|
7
|
+
not_reflected: "not_reflected";
|
|
8
|
+
}>;
|
|
9
|
+
product: z.ZodLiteral<"CHAT">;
|
|
10
|
+
requested_plan: z.ZodString;
|
|
11
|
+
mutation_sent: z.ZodLiteral<false>;
|
|
12
|
+
current_subscription: z.ZodNullable<z.ZodObject<{
|
|
13
|
+
subscription_name: z.ZodString;
|
|
14
|
+
apply_date: z.ZodNullable<z.ZodString>;
|
|
15
|
+
next_billing_date: z.ZodNullable<z.ZodString>;
|
|
16
|
+
end_date: z.ZodNullable<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
future_subscription: z.ZodNullable<z.ZodObject<{
|
|
19
|
+
subscription_name: z.ZodString;
|
|
20
|
+
apply_date: z.ZodNullable<z.ZodString>;
|
|
21
|
+
next_billing_date: z.ZodNullable<z.ZodString>;
|
|
22
|
+
end_date: z.ZodNullable<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
next: z.ZodString;
|
|
25
|
+
next_argv: z.ZodArray<z.ZodString>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const billingHandoffSchema: z.ZodObject<{
|
|
28
|
+
organization: z.ZodObject<{
|
|
29
|
+
uid: z.ZodString;
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
selection_state: z.ZodEnum<{
|
|
33
|
+
requires_dashboard_review: "requires_dashboard_review";
|
|
34
|
+
catalog_candidate: "catalog_candidate";
|
|
35
|
+
}>;
|
|
36
|
+
reasons: z.ZodArray<z.ZodString>;
|
|
37
|
+
payment_method: z.ZodString;
|
|
38
|
+
card_present: z.ZodNullable<z.ZodBoolean>;
|
|
39
|
+
quote: z.ZodNull;
|
|
40
|
+
effective_at: z.ZodNull;
|
|
41
|
+
change_completed: z.ZodLiteral<false>;
|
|
42
|
+
handoff: z.ZodObject<{
|
|
43
|
+
url: z.ZodString;
|
|
44
|
+
required: z.ZodLiteral<true>;
|
|
45
|
+
instruction: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
product: z.ZodLiteral<"CHAT">;
|
|
48
|
+
requested_plan: z.ZodString;
|
|
49
|
+
mutation_sent: z.ZodLiteral<false>;
|
|
50
|
+
current_subscription: z.ZodNullable<z.ZodObject<{
|
|
51
|
+
subscription_name: z.ZodString;
|
|
52
|
+
apply_date: z.ZodNullable<z.ZodString>;
|
|
53
|
+
next_billing_date: z.ZodNullable<z.ZodString>;
|
|
54
|
+
end_date: z.ZodNullable<z.ZodString>;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
future_subscription: z.ZodNullable<z.ZodObject<{
|
|
57
|
+
subscription_name: z.ZodString;
|
|
58
|
+
apply_date: z.ZodNullable<z.ZodString>;
|
|
59
|
+
next_billing_date: z.ZodNullable<z.ZodString>;
|
|
60
|
+
end_date: z.ZodNullable<z.ZodString>;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
next: z.ZodString;
|
|
63
|
+
next_argv: z.ZodArray<z.ZodString>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
/** No quote contract exists in Gate. These commands prepare a web handoff;
|
|
66
|
+
* they never submit subscribe, start a trial, or collect payment credentials.
|
|
67
|
+
* runner.ts verifies the authenticated organization and role before calling. */
|
|
68
|
+
export declare function billingPlan(command: string, input: Record<string, unknown>, orgId: string, t: Transport, profileName?: string): Promise<unknown>;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { shellCommand } from "./shell.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { CliError, encodeSegment, redact, request, } from "./core.js";
|
|
4
|
+
function response(schema, value) {
|
|
5
|
+
const parsed = schema.safeParse(value);
|
|
6
|
+
if (!parsed.success)
|
|
7
|
+
throw new CliError("E_SCHEMA", "Billing response lacks required identity or policy fields; inspect Dashboard", 8);
|
|
8
|
+
return parsed.data;
|
|
9
|
+
}
|
|
10
|
+
const subscriptionSummary = z
|
|
11
|
+
.object({
|
|
12
|
+
subscription_name: z.string(),
|
|
13
|
+
apply_date: z.string().nullable(),
|
|
14
|
+
next_billing_date: z.string().nullable(),
|
|
15
|
+
end_date: z.string().nullable(),
|
|
16
|
+
})
|
|
17
|
+
.nullable();
|
|
18
|
+
const sharedResult = {
|
|
19
|
+
product: z.literal("CHAT"),
|
|
20
|
+
requested_plan: z.string(),
|
|
21
|
+
mutation_sent: z.literal(false),
|
|
22
|
+
current_subscription: subscriptionSummary,
|
|
23
|
+
future_subscription: subscriptionSummary,
|
|
24
|
+
next: z.string(),
|
|
25
|
+
next_argv: z.array(z.string()),
|
|
26
|
+
};
|
|
27
|
+
export const billingVerificationSchema = z.object({
|
|
28
|
+
...sharedResult,
|
|
29
|
+
change_state: z.enum(["current", "scheduled", "not_reflected"]),
|
|
30
|
+
});
|
|
31
|
+
export const billingHandoffSchema = z.object({
|
|
32
|
+
...sharedResult,
|
|
33
|
+
organization: z.object({ uid: z.string(), name: z.string() }),
|
|
34
|
+
selection_state: z.enum(["requires_dashboard_review", "catalog_candidate"]),
|
|
35
|
+
reasons: z.array(z.string()),
|
|
36
|
+
payment_method: z.string(),
|
|
37
|
+
card_present: z.boolean().nullable(),
|
|
38
|
+
quote: z.null(),
|
|
39
|
+
effective_at: z.null(),
|
|
40
|
+
change_completed: z.literal(false),
|
|
41
|
+
handoff: z.object({
|
|
42
|
+
url: z.string().url(),
|
|
43
|
+
required: z.literal(true),
|
|
44
|
+
instruction: z.string(),
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
const subscription = z
|
|
48
|
+
.object({
|
|
49
|
+
subscription_name: z.string().min(1),
|
|
50
|
+
subscription_type: z.string().min(1),
|
|
51
|
+
product: z.literal("CHAT").optional(),
|
|
52
|
+
is_aws_marketplace: z.boolean().optional(),
|
|
53
|
+
apply_date: z.string().nullable().optional(),
|
|
54
|
+
next_billing_date: z.string().nullable().optional(),
|
|
55
|
+
end_date: z.string().nullable().optional(),
|
|
56
|
+
})
|
|
57
|
+
.passthrough();
|
|
58
|
+
const infoSchema = z.object({
|
|
59
|
+
current_subscription: subscription.nullable(),
|
|
60
|
+
future_subscription: subscription.nullable(),
|
|
61
|
+
});
|
|
62
|
+
const orgSchema = z.object({
|
|
63
|
+
uid: z.string().min(1),
|
|
64
|
+
name: z.string().min(1),
|
|
65
|
+
payment_method: z.enum(["CARD", "WIRE", "MANUAL", "SHOPIFY"]),
|
|
66
|
+
is_self_serve: z.boolean(),
|
|
67
|
+
status: z.enum(["ACTIVE", "INACTIVE", "ARCHIVED"]),
|
|
68
|
+
});
|
|
69
|
+
const catalogSchema = z.record(z.string(), z.object({
|
|
70
|
+
plan: z.object({}).passthrough(),
|
|
71
|
+
product: z.string().optional(),
|
|
72
|
+
subscription_name: z.string().optional(),
|
|
73
|
+
subscription_type: z.string().optional(),
|
|
74
|
+
billing_cycle_months: z.number().int().nonnegative().optional(),
|
|
75
|
+
}));
|
|
76
|
+
/** No quote contract exists in Gate. These commands prepare a web handoff;
|
|
77
|
+
* they never submit subscribe, start a trial, or collect payment credentials.
|
|
78
|
+
* runner.ts verifies the authenticated organization and role before calling. */
|
|
79
|
+
export async function billingPlan(command, input, orgId, t, profileName) {
|
|
80
|
+
const read = (path, query, allowEmpty = false) => request(t, { method: "GET", path, query, allowEmpty });
|
|
81
|
+
const info = response(infoSchema, await read("/dashboard_api/billing/subscriptions/info/", {
|
|
82
|
+
product: "CHAT",
|
|
83
|
+
}));
|
|
84
|
+
const plan = String(input.plan);
|
|
85
|
+
const prefix = [
|
|
86
|
+
"sendbird",
|
|
87
|
+
...(profileName ? ["--profile", profileName] : []),
|
|
88
|
+
"--org-id",
|
|
89
|
+
orgId,
|
|
90
|
+
];
|
|
91
|
+
const nextArgv = command === "billing plan verify"
|
|
92
|
+
? [...prefix, "billing", "plan", "current"]
|
|
93
|
+
: [...prefix, "billing", "plan", "verify", "--plan", plan];
|
|
94
|
+
const nextCommand = shellCommand(nextArgv, /^[a-zA-Z0-9_./:-]+$/);
|
|
95
|
+
if (command === "billing plan verify") {
|
|
96
|
+
const state = info.current_subscription?.subscription_name === plan
|
|
97
|
+
? "current"
|
|
98
|
+
: info.future_subscription?.subscription_name === plan
|
|
99
|
+
? "scheduled"
|
|
100
|
+
: "not_reflected";
|
|
101
|
+
return {
|
|
102
|
+
product: "CHAT",
|
|
103
|
+
requested_plan: plan,
|
|
104
|
+
change_state: state,
|
|
105
|
+
current_subscription: summary(info.current_subscription),
|
|
106
|
+
future_subscription: summary(info.future_subscription),
|
|
107
|
+
// Observing a matching plan is not proof that this CLI caused a change.
|
|
108
|
+
mutation_sent: false,
|
|
109
|
+
next: nextCommand,
|
|
110
|
+
next_argv: nextArgv,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const org = response(orgSchema, await read(`/dashboard_api/organizations/${encodeSegment(orgId)}/`));
|
|
114
|
+
if (org.uid !== orgId)
|
|
115
|
+
throw new CliError("E_CONTEXT", "Billing organization identity does not match the selected organization", 5);
|
|
116
|
+
if (command === "billing plan change" && input.confirm_org_name !== org.name)
|
|
117
|
+
throw new CliError("E_CONFIRMATION", "--confirm-org-name must exactly match the organization's current name; inspect billing plan check first", 2);
|
|
118
|
+
const catalog = response(catalogSchema, await read("/dashboard_api/billing/plans/", { organization_uid: orgId }));
|
|
119
|
+
if (!Object.hasOwn(catalog, plan))
|
|
120
|
+
throw new CliError("E_VALIDATION", "Requested plan is not in this organization's catalog; use billing plan list", 2);
|
|
121
|
+
const selected = catalog[plan];
|
|
122
|
+
if (selected.subscription_name && selected.subscription_name !== plan)
|
|
123
|
+
throw new CliError("E_SCHEMA", "Plan catalog identity does not match the requested plan", 8);
|
|
124
|
+
if (selected.product && selected.product !== "CHAT")
|
|
125
|
+
throw new CliError("E_VALIDATION", "Requested catalog entry is not a Chat product", 2);
|
|
126
|
+
const reasons = [];
|
|
127
|
+
const current = info.current_subscription;
|
|
128
|
+
if (current?.subscription_type === "SALES_CUSTOM")
|
|
129
|
+
reasons.push("sales_contract");
|
|
130
|
+
if (current &&
|
|
131
|
+
!["SALES_CUSTOM", "SELF_SERVE"].includes(current.subscription_type))
|
|
132
|
+
reasons.push("subscription_type_requires_review");
|
|
133
|
+
if (selected.subscription_type === "SALES_CUSTOM")
|
|
134
|
+
reasons.push("sales_plan");
|
|
135
|
+
if (current?.is_aws_marketplace)
|
|
136
|
+
reasons.push("aws_marketplace");
|
|
137
|
+
// Fail closed on an inconsistent Shopify tuple, rather than bypassing its
|
|
138
|
+
// external billing path when shop information happens to be absent.
|
|
139
|
+
if (org.payment_method === "SHOPIFY")
|
|
140
|
+
reasons.push("shopify_billing");
|
|
141
|
+
if (org.status !== "ACTIVE")
|
|
142
|
+
reasons.push("organization_inactive");
|
|
143
|
+
if (!org.is_self_serve)
|
|
144
|
+
reasons.push("legacy_organization");
|
|
145
|
+
if (org.payment_method === "WIRE" || org.payment_method === "MANUAL")
|
|
146
|
+
reasons.push("managed_payment");
|
|
147
|
+
if (info.future_subscription)
|
|
148
|
+
reasons.push("scheduled_subscription");
|
|
149
|
+
if (current?.end_date && current.subscription_name !== "free_trial")
|
|
150
|
+
reasons.push("cancellation_scheduled");
|
|
151
|
+
if (current?.subscription_name === plan)
|
|
152
|
+
reasons.push("already_current");
|
|
153
|
+
// Dashboard's picker exposes Starter/Pro families; catalog also contains
|
|
154
|
+
// support and sales-only entries. A catalog entry alone is not eligibility.
|
|
155
|
+
// Match Dashboard's TALK_TO_SALES_PLAN_NAMES, including 50K monthly/annual.
|
|
156
|
+
const salesPlan = [
|
|
157
|
+
"enterprise",
|
|
158
|
+
"plan_a_50k",
|
|
159
|
+
"plan_a_50k_annual",
|
|
160
|
+
"plan_a_100k",
|
|
161
|
+
"plan_b_50k",
|
|
162
|
+
"plan_b_50k_annual",
|
|
163
|
+
"plan_b_100k",
|
|
164
|
+
].includes(plan);
|
|
165
|
+
if (salesPlan && !reasons.includes("sales_plan"))
|
|
166
|
+
reasons.push("sales_plan");
|
|
167
|
+
const selfServePlan = /^(?:plan_a_1k|plan_[ab]_(?:5|10|25)k(?:_annual)?)$/.test(plan);
|
|
168
|
+
if (!selfServePlan && !salesPlan)
|
|
169
|
+
reasons.push("dashboard_selection_required");
|
|
170
|
+
let cardPresent = null;
|
|
171
|
+
if (org.payment_method === "CARD" && reasons.length === 0) {
|
|
172
|
+
const card = response(z.union([
|
|
173
|
+
z.object({}).strict(),
|
|
174
|
+
z
|
|
175
|
+
.object({
|
|
176
|
+
brand: z.string().min(1),
|
|
177
|
+
last4: z.string().regex(/^\d{4}$/),
|
|
178
|
+
})
|
|
179
|
+
.passthrough(),
|
|
180
|
+
z.null(),
|
|
181
|
+
]), await read(`/dashboard_api/organizations/${encodeSegment(orgId)}/card/`, undefined, true));
|
|
182
|
+
cardPresent = card !== null && "brand" in card;
|
|
183
|
+
if (!cardPresent)
|
|
184
|
+
reasons.push("payment_method_required");
|
|
185
|
+
}
|
|
186
|
+
// Never copy Shopify URLs or other untrusted server links into an agent
|
|
187
|
+
// handoff. Dashboard performs channel-specific navigation after login.
|
|
188
|
+
const dashboard = t.env === "staging"
|
|
189
|
+
? "https://dashboard-dev.sendbird.com"
|
|
190
|
+
: "https://dashboard.sendbird.com";
|
|
191
|
+
const destination = reasons.some((r) => ["sales_contract", "sales_plan", "aws_marketplace"].includes(r))
|
|
192
|
+
? "/settings/contact_us"
|
|
193
|
+
: reasons.includes("shopify_billing")
|
|
194
|
+
? "/settings/general"
|
|
195
|
+
: "/settings/general/plans/chat";
|
|
196
|
+
return redact({
|
|
197
|
+
product: "CHAT",
|
|
198
|
+
requested_plan: plan,
|
|
199
|
+
organization: { uid: org.uid, name: org.name },
|
|
200
|
+
current_subscription: summary(current),
|
|
201
|
+
future_subscription: summary(info.future_subscription),
|
|
202
|
+
selection_state: reasons.length
|
|
203
|
+
? "requires_dashboard_review"
|
|
204
|
+
: "catalog_candidate",
|
|
205
|
+
reasons,
|
|
206
|
+
payment_method: org.payment_method,
|
|
207
|
+
card_present: cardPresent,
|
|
208
|
+
quote: null,
|
|
209
|
+
effective_at: null,
|
|
210
|
+
handoff: {
|
|
211
|
+
url: `${dashboard}${destination}`,
|
|
212
|
+
required: true,
|
|
213
|
+
instruction: destination === "/settings/contact_us"
|
|
214
|
+
? "Sign in to the same organization and request a plan review through Dashboard. This contract or target plan requires Sales or marketplace handling."
|
|
215
|
+
: destination === "/settings/general"
|
|
216
|
+
? "Sign in to the same organization and follow Dashboard's Shopify billing link. Review and confirm in the external billing channel."
|
|
217
|
+
: "Sign in to the same organization, select the requested Chat plan, review the price and effective date, and confirm in Dashboard.",
|
|
218
|
+
},
|
|
219
|
+
mutation_sent: false,
|
|
220
|
+
change_completed: false,
|
|
221
|
+
next: nextCommand,
|
|
222
|
+
next_argv: nextArgv,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function summary(value) {
|
|
226
|
+
if (!value)
|
|
227
|
+
return null;
|
|
228
|
+
return {
|
|
229
|
+
subscription_name: value.subscription_name,
|
|
230
|
+
apply_date: value.apply_date ?? null,
|
|
231
|
+
next_billing_date: value.next_billing_date ?? null,
|
|
232
|
+
end_date: value.end_date ?? null,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=billing-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-plan.js","sourceRoot":"","sources":["../src/billing-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,aAAa,EACb,MAAM,EACN,OAAO,GAER,MAAM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,CAAC,WAAW,KAAK,mBAAmB;oBACnC,CAAC,CAAC,mIAAmI;oBACrI,CAAC,CAAC,kIAAkI;SAC3I;QACD,aAAa,EAAE,KAAK;QACpB,gBAAgB,EAAE,KAAK;QACvB,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,QAAQ;KACpB,CAAC,CAAC;AACL,CAAC;AACD,SAAS,OAAO,CAAC,KAA0C;IACzD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,OAAO;QACL,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,IAAI;QACpC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,IAAI,IAAI;QAClD,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,IAAI;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function openBrowser(url: string): void;
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Browser launch is best effort: the caller always prints the same URL. */
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { powershell } from "./windows.js";
|
|
4
|
+
export function openBrowser(url) {
|
|
5
|
+
if (new URL(url).protocol !== "https:")
|
|
6
|
+
return;
|
|
7
|
+
if (process.platform === "win32") {
|
|
8
|
+
try {
|
|
9
|
+
powershell(`$u=[Uri]$r.url; if($u.Scheme -ne 'https'){throw 'Expected HTTPS'}; $p=New-Object Diagnostics.ProcessStartInfo; $p.FileName=$u.AbsoluteUri; $p.UseShellExecute=$true; [Diagnostics.Process]::Start($p) | Out-Null`, { url });
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
/* The printed URL remains available for manual opening. */
|
|
13
|
+
}
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const child = spawn(process.platform === "darwin" ? "open" : "xdg-open", [url], { stdio: "ignore" });
|
|
17
|
+
child.on("error", () => { });
|
|
18
|
+
child.unref();
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO;IAC/C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,UAAU,CACR,kNAAkN,EAClN,EAAE,GAAG,EAAE,CACR,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,2DAA2D;QAC7D,CAAC;QACD,OAAO;IACT,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CACjB,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,EACnD,CAAC,GAAG,CAAC,EACL,EAAE,KAAK,EAAE,QAAQ,EAAE,CACpB,CAAC;IACF,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC5B,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Definition } from "./catalog.js";
|
|
3
|
+
export declare const pushTypes: readonly ["apns_voip", "calls_apns_remote", "fcm_voip", "huawei_voip"];
|
|
4
|
+
export declare const relayMethodDescription = "Direct calls: stun&turn tries direct P2P/STUN first and falls back to TURN relay; turn uses TURN server relay only. Direct-call cloud recording prevents relay changes.";
|
|
5
|
+
export declare const callsActivationStateSchema: z.ZodObject<{
|
|
6
|
+
app_id: z.ZodString;
|
|
7
|
+
is_calls_enabled: z.ZodNullable<z.ZodBoolean>;
|
|
8
|
+
calls_flag_source: z.ZodEnum<{
|
|
9
|
+
unknown: "unknown";
|
|
10
|
+
is_calls_enabled: "is_calls_enabled";
|
|
11
|
+
"attrs.sendbird_calls.enabled": "attrs.sendbird_calls.enabled";
|
|
12
|
+
conflict: "conflict";
|
|
13
|
+
}>;
|
|
14
|
+
push_enabled: z.ZodNullable<z.ZodBoolean>;
|
|
15
|
+
region: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export declare const callsDefinitions: Definition[];
|
|
18
|
+
export declare const pushRecord: z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
push_type: z.ZodOptional<z.ZodString>;
|
|
21
|
+
is_sandbox: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
apns_env_cert_type: z.ZodOptional<z.ZodString>;
|
|
23
|
+
apns_expiration: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
apns_name: z.ZodOptional<z.ZodString>;
|
|
25
|
+
apns_type: z.ZodOptional<z.ZodString>;
|
|
26
|
+
apns_key_id: z.ZodOptional<z.ZodString>;
|
|
27
|
+
apns_team_id: z.ZodOptional<z.ZodString>;
|
|
28
|
+
content_available: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
mutable_content: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
has_unread_count_badge: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
push_sound: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
33
|
+
private_key_id: z.ZodOptional<z.ZodString>;
|
|
34
|
+
use_v1_api: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
huawei_app_id: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export declare const callsPushListSchema: z.ZodObject<{
|
|
39
|
+
push_configurations: z.ZodArray<z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
push_type: z.ZodOptional<z.ZodString>;
|
|
42
|
+
is_sandbox: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
apns_env_cert_type: z.ZodOptional<z.ZodString>;
|
|
44
|
+
apns_expiration: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
apns_name: z.ZodOptional<z.ZodString>;
|
|
46
|
+
apns_type: z.ZodOptional<z.ZodString>;
|
|
47
|
+
apns_key_id: z.ZodOptional<z.ZodString>;
|
|
48
|
+
apns_team_id: z.ZodOptional<z.ZodString>;
|
|
49
|
+
content_available: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
+
mutable_content: z.ZodOptional<z.ZodBoolean>;
|
|
51
|
+
has_unread_count_badge: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
push_sound: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
54
|
+
private_key_id: z.ZodOptional<z.ZodString>;
|
|
55
|
+
use_v1_api: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
57
|
+
huawei_app_id: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
total_count: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
next: z.ZodOptional<z.ZodString>;
|
|
61
|
+
prev: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export declare const pushBody: z.ZodObject<{
|
|
64
|
+
format: z.ZodOptional<z.ZodEnum<{
|
|
65
|
+
p8: "p8";
|
|
66
|
+
p12: "p12";
|
|
67
|
+
}>>;
|
|
68
|
+
environment: z.ZodOptional<z.ZodEnum<{
|
|
69
|
+
production: "production";
|
|
70
|
+
development: "development";
|
|
71
|
+
}>>;
|
|
72
|
+
apns_bundle_id: z.ZodOptional<z.ZodString>;
|
|
73
|
+
apns_key_id: z.ZodOptional<z.ZodString>;
|
|
74
|
+
apns_team_id: z.ZodOptional<z.ZodString>;
|
|
75
|
+
apns_cert_password: z.ZodOptional<z.ZodString>;
|
|
76
|
+
huawei_app_id: z.ZodOptional<z.ZodString>;
|
|
77
|
+
huawei_app_secret: z.ZodOptional<z.ZodString>;
|
|
78
|
+
push_sound: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
|
+
}, z.core.$strict>;
|