Thomas G. Lopes commited on
Commit
8816e9f
·
1 Parent(s): 79e869e

filter non team/enterprise orgs

Browse files
src/lib/components/inference-playground/billing-modal.svelte CHANGED
@@ -16,12 +16,13 @@
16
  const { onClose }: Props = $props();
17
 
18
  const options = $derived([
19
- { value: "", label: "Personal Account", avatarUrl: user.avatarUrl, isEnterprise: false },
20
- ...user.orgs.map(org => ({
21
  value: org.name,
22
  label: org.fullname,
23
  avatarUrl: org.avatarUrl,
24
  isEnterprise: org.isEnterprise,
 
25
  })),
26
  ]);
27
 
@@ -101,12 +102,18 @@
101
  <span class="text-gray-900 dark:text-white">
102
  {option.label}
103
  </span>
104
- {#if option.isEnterprise}
105
  <span
106
  class="rounded bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900/30 dark:text-blue-300"
107
  >
108
  Enterprise
109
  </span>
 
 
 
 
 
 
110
  {/if}
111
  </div>
112
  {/if}
@@ -147,12 +154,18 @@
147
  {/if}
148
 
149
  <span class="text-sm text-gray-900 dark:text-white">{option.label}</span>
150
- {#if option.isEnterprise}
151
  <span
152
  class="rounded bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900/30 dark:text-blue-300"
153
  >
154
  Enterprise
155
  </span>
 
 
 
 
 
 
156
  {/if}
157
  </div>
158
  </div>
@@ -255,7 +268,10 @@
255
  </form>
256
 
257
  <!-- Help Link -->
258
- <div class="border-t border-gray-200 pt-4 dark:border-gray-700">
 
 
 
259
  <a
260
  href="https://huggingface.co/docs/inference-providers/pricing#billing-for-team-and-enterprise-organizations"
261
  target="_blank"
 
16
  const { onClose }: Props = $props();
17
 
18
  const options = $derived([
19
+ { value: "", label: "Personal Account", avatarUrl: user.avatarUrl, isEnterprise: false, plan: null },
20
+ ...user.paidOrgs.map(org => ({
21
  value: org.name,
22
  label: org.fullname,
23
  avatarUrl: org.avatarUrl,
24
  isEnterprise: org.isEnterprise,
25
+ plan: org.plan,
26
  })),
27
  ]);
28
 
 
102
  <span class="text-gray-900 dark:text-white">
103
  {option.label}
104
  </span>
105
+ {#if option.plan === "enterprise"}
106
  <span
107
  class="rounded bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900/30 dark:text-blue-300"
108
  >
109
  Enterprise
110
  </span>
111
+ {:else if option.plan === "team"}
112
+ <span
113
+ class="rounded bg-purple-100 px-2 py-0.5 text-xs font-medium text-purple-800 dark:bg-purple-900/30 dark:text-purple-300"
114
+ >
115
+ Team
116
+ </span>
117
  {/if}
118
  </div>
119
  {/if}
 
154
  {/if}
155
 
156
  <span class="text-sm text-gray-900 dark:text-white">{option.label}</span>
157
+ {#if option.plan === "enterprise"}
158
  <span
159
  class="rounded bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900/30 dark:text-blue-300"
160
  >
161
  Enterprise
162
  </span>
163
+ {:else if option.plan === "team"}
164
+ <span
165
+ class="rounded bg-purple-100 px-2 py-0.5 text-xs font-medium text-purple-800 dark:bg-purple-900/30 dark:text-purple-300"
166
+ >
167
+ Team
168
+ </span>
169
  {/if}
170
  </div>
171
  </div>
 
268
  </form>
269
 
270
  <!-- Help Link -->
271
+ <div class="space-y-2 border-t border-gray-200 pt-4 dark:border-gray-700">
272
+ <p class="text-xs text-gray-600 dark:text-gray-400">
273
+ Note: Only organizations with Team or Enterprise plans can use organization billing for Inference Providers.
274
+ </p>
275
  <a
276
  href="https://huggingface.co/docs/inference-providers/pricing#billing-for-team-and-enterprise-organizations"
277
  target="_blank"
src/lib/state/user.svelte.ts CHANGED
@@ -8,6 +8,7 @@ interface Org {
8
  avatarUrl: string;
9
  roleInOrg: string;
10
  isEnterprise: boolean;
 
11
  }
12
 
13
  interface WhoamiResponse {
@@ -53,6 +54,10 @@ class User {
53
  return this.#info?.orgs ?? [];
54
  }
55
 
 
 
 
 
56
  get name() {
57
  return this.#info?.name ?? "";
58
  }
 
8
  avatarUrl: string;
9
  roleInOrg: string;
10
  isEnterprise: boolean;
11
+ plan?: string;
12
  }
13
 
14
  interface WhoamiResponse {
 
54
  return this.#info?.orgs ?? [];
55
  }
56
 
57
+ get paidOrgs() {
58
+ return this.orgs.filter(org => org.plan === "team" || org.plan === "enterprise");
59
+ }
60
+
61
  get name() {
62
  return this.#info?.name ?? "";
63
  }