@goodandready/dsh-subscriptions 0.5.1 → 0.5.2

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/lib/client.js CHANGED
@@ -83,6 +83,8 @@ window.__ModuleLoader__.load({
83
83
  '.dsub-brandOllama{background:rgba(107,114,128,.15);color:#9ca3af;border:1px solid rgba(107,114,128,.3)}' +
84
84
  '.dsub-brandKimi{background:rgba(236,72,153,.15);color:#f472b6;border:1px solid rgba(236,72,153,.3)}' +
85
85
  '.dsub-brandGlm{background:rgba(20,184,166,.15);color:#2dd4bf;border:1px solid rgba(20,184,166,.3)}' +
86
+ '.dsub-planBadge{display:inline-flex;align-items:center;padding:1px 6px;border-radius:4px;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px;background:rgba(99,102,241,.15);color:#818cf8;border:1px solid rgba(99,102,241,.3);margin-left:6px}' +
87
+
86
88
  '.dsub-accInfo{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}' +
87
89
  '.dsub-accNameRow{display:flex;align-items:center;justify-content:space-between;gap:8px}' +
88
90
  '.dsub-accName{font-size:13px;font-weight:600}' +
@@ -322,7 +324,32 @@ const cssId = 'dsh-subscriptions/settings.module.css'
322
324
  }
323
325
 
324
326
  // #51: live countdown to the quota window reset (account.quota.resetAt).
325
- function formatRelativeReset(resetAt, lang, now) {
327
+ function normalizePlanBadge(provider, plan) {
328
+ if (!plan && provider !== 'kimi' && provider !== 'glm') return null
329
+ var p = String(plan || '').toLowerCase().replace(/[^a-z0-9]/g, '')
330
+ var label = plan
331
+ if (provider === 'codex') {
332
+ if (p.indexOf('pro20') >= 0 || p === 'pro') label = 'Pro 20x'
333
+ else if (p.indexOf('pro5') >= 0 || p.indexOf('prolite') >= 0) label = 'Pro 5x'
334
+ else if (p.indexOf('team') >= 0) label = 'Team'
335
+ else if (p.indexOf('plus') >= 0) label = 'Plus'
336
+ else if (p.indexOf('enterp') >= 0) label = 'Enterprise'
337
+ } else if (provider === 'grok') {
338
+ if (p.indexOf('super') >= 0) label = 'SuperGrok'
339
+ else if (p.indexOf('plus') >= 0) label = 'X Premium+'
340
+ else if (p.indexOf('premium') >= 0) label = 'X Premium'
341
+ } else if (provider === 'antigravity') {
342
+ if (p.indexOf('ultra') >= 0) label = 'Ultra'
343
+ else if (p.indexOf('pro') >= 0) label = 'Pro'
344
+ } else if (provider === 'kimi') {
345
+ label = 'Coding Plan'
346
+ } else if (provider === 'glm') {
347
+ label = '150% Boost'
348
+ }
349
+ return label ? React.createElement('span', { className: 'dsub-planBadge' }, label) : null
350
+ }
351
+
352
+ function formatRelativeReset(resetAt, lang, now) {
326
353
  if (!resetAt || !Number.isFinite(resetAt) || resetAt <= 0) return ''
327
354
  var delta = resetAt - (now || Date.now())
328
355
  var isRu = lang !== 'en'
@@ -737,6 +764,7 @@ const cssId = 'dsh-subscriptions/settings.module.css'
737
764
  },
738
765
  }),
739
766
  React.createElement('span', { className: 'dsub-badge' + (account.validationUrl ? ' dsub-badge-warn' : (on ? ' dsub-badge-on' : '')) }, badgeFor(account, t)),
767
+ normalizePlanBadge(row.slot.provider, account.plan || (account.quota && account.quota.plan)),
740
768
  React.createElement('button', {
741
769
  type: 'button', className: 'dsub-mini',
742
770
  onClick: () => connect(row.slot.provider, row.slot.index).catch((e) => setErr(String(e.message || e))),
package/lib/plan.js ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Normalize and pretty-print subscription plans.
3
+ */
4
+
5
+ export function normalizePlanName(provider, rawPlan) {
6
+ if (!rawPlan || typeof rawPlan !== 'string') {
7
+ if (provider === 'kimi') return 'Coding Plan'
8
+ if (provider === 'glm') return 'Coding Plan 150%'
9
+ return ''
10
+ }
11
+ const key = rawPlan.trim().toLowerCase().replace(/[^a-z0-9]/g, '')
12
+ if (provider === 'codex') {
13
+ if (key.includes('pro20') || key === 'pro') return 'Pro 20x'
14
+ if (key.includes('pro5') || key.includes('prolite')) return 'Pro 5x'
15
+ if (key.includes('team')) return 'Team'
16
+ if (key.includes('plus')) return 'Plus'
17
+ if (key.includes('enterp')) return 'Enterprise'
18
+ if (key.includes('edu')) return 'Edu'
19
+ if (key.includes('free')) return 'Free'
20
+ }
21
+ if (provider === 'grok') {
22
+ if (key.includes('super')) return 'SuperGrok'
23
+ if (key.includes('plus') || key.includes('premiumplus')) return 'X Premium+'
24
+ if (key.includes('premium')) return 'X Premium'
25
+ if (key.includes('basic')) return 'X Basic'
26
+ if (key.includes('free')) return 'Free'
27
+ }
28
+ if (provider === 'claude') {
29
+ if (key.includes('team')) return 'Team'
30
+ if (key.includes('enterp')) return 'Enterprise'
31
+ if (key.includes('pro')) return 'Pro'
32
+ if (key.includes('free')) return 'Free'
33
+ }
34
+ if (provider === 'antigravity') {
35
+ if (key.includes('ultra')) return 'Ultra'
36
+ if (key.includes('pro')) return 'Pro'
37
+ if (key.includes('free')) return 'Free'
38
+ }
39
+ if (provider === 'kimi') return 'Coding Plan'
40
+ if (provider === 'glm') return 'Coding Plan 150%'
41
+ return rawPlan
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-subscriptions",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Use ChatGPT Codex, Claude, Grok, and Antigravity subscriptions as DeepSeek Harness LLM providers via OAuth.",
5
5
  "license": "MIT",
6
6
  "type": "module",