@hyvor/design 1.1.25-beta-org-7 → 1.1.25-beta-org-9
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/components/Button/Button.svelte +1 -3
- package/dist/components/Checkbox/Checkbox.svelte.d.ts +1 -1
- package/dist/components/CodeBlock/CodeBlock.svelte +36 -4
- package/dist/components/CodeBlock/TabbedCodeBlock.svelte +60 -64
- package/dist/components/CodeBlock/TabbedCodeBlock.svelte.d.ts +1 -1
- package/dist/components/HyvorBar/HyvorBar.svelte +18 -26
- package/dist/components/HyvorBar/HyvorBar.svelte.d.ts +0 -2
- package/dist/components/HyvorBar/Notice/BarLicense.svelte +4 -2
- package/dist/components/HyvorBar/bar.d.ts +2 -26
- package/dist/components/HyvorBar/bar.js +25 -80
- package/dist/components/Internationalization/T.svelte.d.ts +5 -12
- package/dist/components/Radio/Radio.svelte.d.ts +1 -1
- package/dist/components/SplitControl/SplitControl.svelte +0 -12
- package/dist/components/SplitControl/SplitControl.svelte.d.ts +0 -1
- package/dist/components/Switch/Switch.svelte.d.ts +1 -1
- package/dist/components/TextInput/TextInput.svelte +28 -23
- package/dist/components/TextInput/TextInput.svelte.d.ts +2 -2
- package/dist/components/Textarea/Textarea.svelte +2 -6
- package/dist/components/index.d.ts +1 -2
- package/dist/components/index.js +1 -2
- package/dist/marketing/Header/Header.svelte +131 -140
- package/dist/marketing/Header/Header.svelte.d.ts +3 -1
- package/dist/marketing/Header/HeaderNotification.svelte +64 -0
- package/dist/marketing/Header/HeaderNotification.svelte.d.ts +7 -0
- package/dist/marketing/cloud.d.ts +1 -0
- package/dist/marketing/cloud.js +15 -0
- package/dist/marketing/track/track.d.ts +0 -1
- package/dist/marketing/track/track.js +3 -6
- package/package.json +4 -8
- package/dist/cloud/ResourceCreator/ResourceCreator.svelte +0 -192
- package/dist/cloud/ResourceCreator/ResourceCreator.svelte.d.ts +0 -10
- package/dist/cloud/ResourceCreator/ResourceCreatorLoader.svelte +0 -32
- package/dist/cloud/ResourceCreator/ResourceCreatorLoader.svelte.d.ts +0 -7
- package/dist/cloud/ResourceCreator/Step.svelte +0 -47
- package/dist/cloud/ResourceCreator/Step.svelte.d.ts +0 -9
- package/dist/cloud/ResourceCreator/steps.svelte.d.ts +0 -16
- package/dist/cloud/ResourceCreator/steps.svelte.js +0 -35
- package/dist/cloud/index.d.ts +0 -1
- package/dist/cloud/index.js +0 -1
- package/dist/components/HyvorBar/Organization/BarOrganization.svelte +0 -45
- package/dist/components/HyvorBar/Organization/BarOrganization.svelte.d.ts +0 -5
- package/dist/components/HyvorBar/Organization/CreateOrganization.svelte +0 -97
- package/dist/components/HyvorBar/Organization/CreateOrganization.svelte.d.ts +0 -6
- package/dist/components/HyvorBar/Organization/OrganizationButton.svelte +0 -109
- package/dist/components/HyvorBar/Organization/OrganizationButton.svelte.d.ts +0 -15
- package/dist/components/HyvorBar/Organization/OrganizationButtonOrCreator.svelte +0 -7
- package/dist/components/HyvorBar/Organization/OrganizationButtonOrCreator.svelte.d.ts +0 -18
- package/dist/components/HyvorBar/Organization/OrgsList.svelte +0 -138
- package/dist/components/HyvorBar/Organization/OrgsList.svelte.d.ts +0 -9
|
@@ -429,14 +429,12 @@
|
|
|
429
429
|
background-color: transparent;
|
|
430
430
|
color: var(--text);
|
|
431
431
|
transition: 0.2s background-color;
|
|
432
|
+
/*styles for disabled state*/
|
|
432
433
|
}
|
|
433
434
|
.button.invisible:hover {
|
|
434
435
|
background-color: var(--accent-light);
|
|
435
436
|
box-shadow: none !important;
|
|
436
437
|
}
|
|
437
|
-
.button.invisible {
|
|
438
|
-
/*styles for disabled state*/
|
|
439
|
-
}
|
|
440
438
|
.button.invisible[disabled] {
|
|
441
439
|
background-color: transparent;
|
|
442
440
|
color: var(--text);
|
|
@@ -7,6 +7,6 @@ interface Props {
|
|
|
7
7
|
children?: import('svelte').Snippet;
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
|
-
declare const Checkbox: import("svelte").Component<Props, {}, "
|
|
10
|
+
declare const Checkbox: import("svelte").Component<Props, {}, "checked" | "group" | "input">;
|
|
11
11
|
type Checkbox = ReturnType<typeof Checkbox>;
|
|
12
12
|
export default Checkbox;
|
|
@@ -1,29 +1,60 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
//import './prism.scss';
|
|
3
3
|
import './hljs.scss';
|
|
4
|
+
import Button from '../Button/Button.svelte';
|
|
5
|
+
import IconCopy from '@hyvor/icons/IconCopy';
|
|
4
6
|
|
|
5
7
|
type InputLanguage = 'html' | 'css' | 'js' | 'ts' | 'yaml' | 'json' | 'svelte' | 'jsx' | 'php';
|
|
6
|
-
|
|
7
8
|
const languagesMap: Partial<Record<InputLanguage, Language>> = {
|
|
8
9
|
svelte: 'html',
|
|
9
10
|
jsx: 'js'
|
|
10
11
|
};
|
|
11
|
-
|
|
12
12
|
import getCode, { type Language } from './getCode.js';
|
|
13
|
+
import toast from '../Toast/toast.js';
|
|
14
|
+
|
|
13
15
|
interface Props {
|
|
14
16
|
code: string;
|
|
15
17
|
language?: InputLanguage | null;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
let { code, language = 'html' }: Props = $props();
|
|
21
|
+
let languageCode = $derived(
|
|
22
|
+
language ? languagesMap[language] || language : null
|
|
23
|
+
) as Language | null;
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
function copyToClipboard() {
|
|
26
|
+
navigator.clipboard.writeText(code);
|
|
27
|
+
toast.success('Copied');
|
|
28
|
+
}
|
|
21
29
|
</script>
|
|
22
30
|
|
|
23
|
-
<
|
|
31
|
+
<div class="code-container">
|
|
32
|
+
<div class="copy-button">
|
|
33
|
+
<Button color="input" size="x-small" onclick={copyToClipboard}>
|
|
34
|
+
<IconCopy size={10} />
|
|
35
|
+
</Button>
|
|
36
|
+
</div>
|
|
37
|
+
<pre class="language-{languageCode} hljs"><code>{@html getCode(code, languageCode)}</code></pre>
|
|
38
|
+
</div>
|
|
24
39
|
|
|
25
40
|
<style>
|
|
26
41
|
/*styles for CodeBlock component */
|
|
42
|
+
.code-container {
|
|
43
|
+
position: relative;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.code-container .copy-button {
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 0px;
|
|
49
|
+
right: 12px;
|
|
50
|
+
transform: translateY(-40%);
|
|
51
|
+
z-index: 10;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.copy-button :global(button) {
|
|
55
|
+
border: 1px solid var(--border);
|
|
56
|
+
}
|
|
57
|
+
|
|
27
58
|
pre {
|
|
28
59
|
text-align: left;
|
|
29
60
|
white-space: pre;
|
|
@@ -35,6 +66,7 @@
|
|
|
35
66
|
padding: 20px;
|
|
36
67
|
line-height: 1.2;
|
|
37
68
|
}
|
|
69
|
+
|
|
38
70
|
pre code {
|
|
39
71
|
all: unset;
|
|
40
72
|
font-family:
|
|
@@ -1,78 +1,74 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { Snippet } from
|
|
3
|
-
import Button from
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import Button from '../Button/Button.svelte';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
interface Props {
|
|
6
|
+
children: Snippet;
|
|
7
|
+
tabs: string[];
|
|
8
|
+
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
let { children, tabs }: Props = $props();
|
|
11
|
+
let activeTab = $state(tabs[0]);
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
function activateTab(tab: string) {
|
|
14
|
+
activeTab = tab;
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const pres = blocksEl.querySelectorAll<HTMLElement>('.code-container');
|
|
17
|
+
const tabIndex = tabs.indexOf(tab);
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
pres.forEach((pre, index) => {
|
|
20
|
+
if (index === tabIndex) {
|
|
21
|
+
pre.style.display = 'block';
|
|
22
|
+
} else {
|
|
23
|
+
pre.style.display = 'none';
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
let blocksEl: HTMLDivElement;
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
31
|
<div class="tabbed">
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</div>
|
|
46
|
-
|
|
32
|
+
<div class="selectors">
|
|
33
|
+
{#each tabs as tab}
|
|
34
|
+
<Button
|
|
35
|
+
size="x-small"
|
|
36
|
+
color={activeTab === tab ? 'accent' : 'input'}
|
|
37
|
+
onclick={() => activateTab(tab)}>{tab}</Button
|
|
38
|
+
>
|
|
39
|
+
{/each}
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div class="blocks" bind:this={blocksEl}>
|
|
43
|
+
{@render children()}
|
|
44
|
+
</div>
|
|
47
45
|
</div>
|
|
48
46
|
|
|
49
47
|
<style>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
48
|
+
.tabbed {
|
|
49
|
+
margin: 1.5rem 0 1rem 0;
|
|
50
|
+
position: relative;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.selectors {
|
|
54
|
+
display: inline-flex;
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: 0;
|
|
57
|
+
left: 20px;
|
|
58
|
+
z-index: 1;
|
|
59
|
+
transform: translateY(-50%);
|
|
60
|
+
gap: 3px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.selectors > :global(button) {
|
|
64
|
+
border: 1px solid var(--border);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.blocks > :global(.code-container:not(:first-child)) {
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.blocks > :global(.code-container) {
|
|
72
|
+
margin: 0;
|
|
73
|
+
}
|
|
78
74
|
</style>
|
|
@@ -3,20 +3,11 @@
|
|
|
3
3
|
import { onMount } from 'svelte';
|
|
4
4
|
import BarProducts, { PRODUCTS } from './BarProducts.svelte';
|
|
5
5
|
import BarSupport from './BarSupport.svelte';
|
|
6
|
-
import {
|
|
7
|
-
barOnOrganizationSwitch,
|
|
8
|
-
barUser,
|
|
9
|
-
initBar,
|
|
10
|
-
setInstanceAndProduct,
|
|
11
|
-
type BarConfig,
|
|
12
|
-
type BarUser as BarUserType
|
|
13
|
-
} from './bar.js';
|
|
6
|
+
import { barUser, initBar, setInstanceAndProduct, type BarConfig, type BarUser as BarUserType } from './bar.js';
|
|
14
7
|
import BarUpdates from './BarUpdates.svelte';
|
|
15
8
|
import IconCaretDownFill from '@hyvor/icons/IconCaretDownFill';
|
|
16
9
|
import BarNotice from './Notice/BarNotice.svelte';
|
|
17
10
|
import BarLicense from './Notice/BarLicense.svelte';
|
|
18
|
-
import BarOrganization from './Organization/BarOrganization.svelte';
|
|
19
|
-
import { type BarOrganization as BarOrganizationType } from './bar.js';
|
|
20
11
|
|
|
21
12
|
interface Props {
|
|
22
13
|
instance?: string;
|
|
@@ -36,18 +27,16 @@
|
|
|
36
27
|
authOverride?: {
|
|
37
28
|
user: BarUserType | null;
|
|
38
29
|
logoutUrl: string;
|
|
39
|
-
}
|
|
40
|
-
onOrganizationSwitch?: (org: BarOrganizationType) => void;
|
|
30
|
+
}
|
|
41
31
|
}
|
|
42
32
|
|
|
43
33
|
let {
|
|
44
|
-
instance = 'https://hyvor.com',
|
|
45
|
-
product,
|
|
34
|
+
instance = 'https://hyvor.com',
|
|
35
|
+
product,
|
|
46
36
|
logo = `${instance}/api/public/logo/${product}.svg`,
|
|
47
37
|
config = {},
|
|
48
38
|
cloud = true,
|
|
49
|
-
authOverride = undefined
|
|
50
|
-
onOrganizationSwitch = () => {}
|
|
39
|
+
authOverride = undefined
|
|
51
40
|
}: Props = $props();
|
|
52
41
|
|
|
53
42
|
let mobileShow = $state(false);
|
|
@@ -72,15 +61,15 @@
|
|
|
72
61
|
}
|
|
73
62
|
}
|
|
74
63
|
|
|
75
|
-
barOnOrganizationSwitch.set(onOrganizationSwitch);
|
|
76
|
-
setInstanceAndProduct(instance, product);
|
|
77
|
-
if (authOverride) {
|
|
78
|
-
barUser.set(authOverride.user);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
64
|
onMount(() => {
|
|
65
|
+
setInstanceAndProduct(instance, product);
|
|
66
|
+
|
|
82
67
|
if (cloud) {
|
|
83
68
|
initBar();
|
|
69
|
+
} else {
|
|
70
|
+
if (authOverride) {
|
|
71
|
+
barUser.set(authOverride.user);
|
|
72
|
+
}
|
|
84
73
|
}
|
|
85
74
|
});
|
|
86
75
|
|
|
@@ -98,12 +87,16 @@
|
|
|
98
87
|
<div class="inner hds-box">
|
|
99
88
|
<div class="left">
|
|
100
89
|
<a class="logo" href="/">
|
|
101
|
-
<img
|
|
90
|
+
<img
|
|
91
|
+
src={logo}
|
|
92
|
+
alt={product}
|
|
93
|
+
width="20"
|
|
94
|
+
height="20"
|
|
95
|
+
/>
|
|
102
96
|
<span class="name">
|
|
103
97
|
{getName()}
|
|
104
98
|
</span>
|
|
105
99
|
</a>
|
|
106
|
-
<BarOrganization />
|
|
107
100
|
<BarLicense name={getName()} />
|
|
108
101
|
</div>
|
|
109
102
|
<div class="right">
|
|
@@ -139,7 +132,7 @@
|
|
|
139
132
|
z-index: 100;
|
|
140
133
|
}
|
|
141
134
|
.inner {
|
|
142
|
-
padding:
|
|
135
|
+
padding: 10px 29px;
|
|
143
136
|
display: flex;
|
|
144
137
|
align-items: center;
|
|
145
138
|
border-top-left-radius: 0;
|
|
@@ -150,7 +143,6 @@
|
|
|
150
143
|
display: flex;
|
|
151
144
|
align-items: center;
|
|
152
145
|
flex: 1;
|
|
153
|
-
height: 100%;
|
|
154
146
|
}
|
|
155
147
|
.logo {
|
|
156
148
|
display: flex;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type BarConfig, type BarUser as BarUserType } from './bar.js';
|
|
2
|
-
import { type BarOrganization as BarOrganizationType } from './bar.js';
|
|
3
2
|
interface Props {
|
|
4
3
|
instance?: string;
|
|
5
4
|
product: string;
|
|
@@ -14,7 +13,6 @@ interface Props {
|
|
|
14
13
|
user: BarUserType | null;
|
|
15
14
|
logoutUrl: string;
|
|
16
15
|
};
|
|
17
|
-
onOrganizationSwitch?: (org: BarOrganizationType) => void;
|
|
18
16
|
}
|
|
19
17
|
declare const HyvorBar: import("svelte").Component<Props, {}, "">;
|
|
20
18
|
type HyvorBar = ReturnType<typeof HyvorBar>;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
return daysDiff(endsAt);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
function remainingCancelAtDAys(cancelAt: number | undefined | null): null | number {
|
|
25
|
+
function remainingCancelAtDAys(cancelAt: number | undefined | null) : null | number {
|
|
26
26
|
if (!cancelAt) {
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
@@ -36,7 +36,9 @@
|
|
|
36
36
|
{#if $barLicense}
|
|
37
37
|
<a class="wrap" href="/console/billing">
|
|
38
38
|
{#if $barLicense.type === 'subscription'}
|
|
39
|
-
<Tooltip
|
|
39
|
+
<Tooltip
|
|
40
|
+
position="bottom"
|
|
41
|
+
>
|
|
40
42
|
{#snippet tooltip()}
|
|
41
43
|
Your current subscription plan for {name}. Click to manage it.
|
|
42
44
|
{/snippet}
|
|
@@ -10,14 +10,6 @@ export interface BarUser {
|
|
|
10
10
|
username?: string | null;
|
|
11
11
|
email: string;
|
|
12
12
|
picture_url: string | null;
|
|
13
|
-
current_organization: null | {
|
|
14
|
-
name: string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export interface BarOrganization {
|
|
18
|
-
id: number;
|
|
19
|
-
name: string;
|
|
20
|
-
role: 'admin' | 'billing' | 'manager' | 'member';
|
|
21
13
|
}
|
|
22
14
|
export interface BarUpdate {
|
|
23
15
|
id: number;
|
|
@@ -27,7 +19,7 @@ export interface BarUpdate {
|
|
|
27
19
|
content: string;
|
|
28
20
|
url?: string;
|
|
29
21
|
}
|
|
30
|
-
export type BarUpdateType = 'company' | 'core' | 'talk' | 'blogs' | 'fortguard';
|
|
22
|
+
export type BarUpdateType = 'company' | 'core' | 'talk' | 'blogs' | 'post' | 'relay' | 'fortguard';
|
|
31
23
|
export interface BarResolvedLicense {
|
|
32
24
|
type: 'subscription' | 'trial' | 'custom' | 'expired';
|
|
33
25
|
license: Record<string, number | boolean> | null;
|
|
@@ -37,24 +29,12 @@ export interface BarResolvedLicense {
|
|
|
37
29
|
};
|
|
38
30
|
trial_ends_at: null | number;
|
|
39
31
|
}
|
|
40
|
-
export declare const instance: import("svelte/store").Writable<string>;
|
|
41
32
|
export declare const barUser: import("svelte/store").Writable<BarUser | null>;
|
|
42
33
|
export declare const barUnreadUpdates: import("svelte/store").Writable<number>;
|
|
43
34
|
export declare const barLicense: import("svelte/store").Writable<BarResolvedLicense | null>;
|
|
44
35
|
export declare const barHasFailedInvoices: import("svelte/store").Writable<boolean>;
|
|
45
|
-
export declare const barOrganizationDropdownOpen: import("svelte/store").Writable<boolean>;
|
|
46
|
-
export declare const barOrganizations: import("svelte/store").Writable<BarOrganization[]>;
|
|
47
|
-
export declare const barOnOrganizationSwitch: import("svelte/store").Writable<((org: BarOrganization) => void) | null>;
|
|
48
|
-
export declare const barOrganizationCreating: import("svelte/store").Writable<boolean>;
|
|
49
36
|
export declare function setInstanceAndProduct(instance_: string, product_: string): void;
|
|
50
|
-
export declare function
|
|
51
|
-
/**
|
|
52
|
-
* @throws Error if initialization fails
|
|
53
|
-
*/
|
|
54
|
-
export declare function initBar(): Promise<void>;
|
|
55
|
-
export declare function getMyOrganizations(): Promise<BarOrganization[]>;
|
|
56
|
-
export declare function createOrganization(name: string): Promise<BarOrganization>;
|
|
57
|
-
export declare function switchOrganization(orgId: number): Promise<void>;
|
|
37
|
+
export declare function initBar(): void;
|
|
58
38
|
export declare class UnreadUpdatesTimeLocalStorage {
|
|
59
39
|
static KEY: string;
|
|
60
40
|
static get(): number | null;
|
|
@@ -68,8 +48,4 @@ export declare const bar: {
|
|
|
68
48
|
* This is useful to create after, for example, a user creates a new blog
|
|
69
49
|
*/
|
|
70
50
|
reload: () => void;
|
|
71
|
-
/**
|
|
72
|
-
* Open the org selector dropdown from the outside world
|
|
73
|
-
*/
|
|
74
|
-
openOrganizationDropdown: () => void;
|
|
75
51
|
};
|
|
@@ -1,95 +1,44 @@
|
|
|
1
1
|
import { track } from '../../marketing/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { writable } from 'svelte/store';
|
|
3
|
+
let instance = '';
|
|
3
4
|
let product = 'core';
|
|
4
|
-
export const instance = writable('');
|
|
5
5
|
export const barUser = writable(null);
|
|
6
6
|
export const barUnreadUpdates = writable(0);
|
|
7
7
|
export const barLicense = writable(null);
|
|
8
8
|
export const barHasFailedInvoices = writable(false);
|
|
9
|
-
export const barOrganizationDropdownOpen = writable(false);
|
|
10
|
-
export const barOrganizations = writable([]);
|
|
11
|
-
export const barOnOrganizationSwitch = writable(null);
|
|
12
|
-
export const barOrganizationCreating = writable(false);
|
|
13
9
|
export function setInstanceAndProduct(instance_, product_) {
|
|
14
|
-
instance
|
|
10
|
+
instance = instance_;
|
|
15
11
|
product = product_;
|
|
16
12
|
}
|
|
17
|
-
export function
|
|
18
|
-
return get(instance);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @throws Error if initialization fails
|
|
22
|
-
*/
|
|
23
|
-
export async function initBar() {
|
|
13
|
+
export function initBar() {
|
|
24
14
|
const query = new URLSearchParams();
|
|
25
15
|
query.set('product', product);
|
|
26
16
|
const lastUnreadTime = UnreadUpdatesTimeLocalStorage.get();
|
|
27
17
|
if (lastUnreadTime) {
|
|
28
18
|
query.set('last_read_updates_at', lastUnreadTime.toString());
|
|
29
19
|
}
|
|
30
|
-
|
|
20
|
+
fetch(instance + '/api/public/bar?' + query.toString(), {
|
|
31
21
|
credentials: 'include'
|
|
22
|
+
})
|
|
23
|
+
.then((response) => response.json())
|
|
24
|
+
.then((data) => {
|
|
25
|
+
barUser.set(data.user);
|
|
26
|
+
barUnreadUpdates.set(data.updates.unread);
|
|
27
|
+
barLicense.set(data.billing.license);
|
|
28
|
+
barHasFailedInvoices.set(data.billing.has_failed_invoices);
|
|
29
|
+
if (lastUnreadTime === null) {
|
|
30
|
+
UnreadUpdatesTimeLocalStorage.setNow();
|
|
31
|
+
}
|
|
32
|
+
if (data.user && track.ready()) {
|
|
33
|
+
track.identify(data.user.id.toString(), {
|
|
34
|
+
name: data.user.name ?? undefined,
|
|
35
|
+
avatar: data.user.picture_url ?? undefined
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
.catch((error) => {
|
|
40
|
+
console.error('Error:', error);
|
|
32
41
|
});
|
|
33
|
-
if (!response.ok) {
|
|
34
|
-
throw new Error('Failed to initialize bar');
|
|
35
|
-
}
|
|
36
|
-
const data = await response.json();
|
|
37
|
-
barUser.set(data.user);
|
|
38
|
-
barUnreadUpdates.set(data.updates.unread);
|
|
39
|
-
barLicense.set(data.billing.license);
|
|
40
|
-
barHasFailedInvoices.set(data.billing.has_failed_invoices);
|
|
41
|
-
if (lastUnreadTime === null) {
|
|
42
|
-
UnreadUpdatesTimeLocalStorage.setNow();
|
|
43
|
-
}
|
|
44
|
-
if (data.user && track.ready()) {
|
|
45
|
-
track.identify(data.user.id.toString(), {
|
|
46
|
-
name: data.user.name ?? undefined,
|
|
47
|
-
avatar: data.user.picture_url ?? undefined
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
export async function getMyOrganizations() {
|
|
52
|
-
return [];
|
|
53
|
-
/* return [
|
|
54
|
-
{ id: 1, name: 'Org 1', role: 'admin' },
|
|
55
|
-
{ id: 2, name: 'Org 2', role: 'member' },
|
|
56
|
-
{ id: 3, name: 'Org 3', role: 'billing' },
|
|
57
|
-
{ id: 4, name: 'Org 4', role: 'manager' }
|
|
58
|
-
]; */
|
|
59
|
-
const response = await fetch(getInstance() + '/api/public/bar/orgs/my', {
|
|
60
|
-
credentials: 'include'
|
|
61
|
-
});
|
|
62
|
-
const data = await response.json();
|
|
63
|
-
return data.organizations;
|
|
64
|
-
}
|
|
65
|
-
export async function createOrganization(name) {
|
|
66
|
-
const response = await fetch(getInstance() + '/api/public/bar/orgs', {
|
|
67
|
-
method: 'POST',
|
|
68
|
-
credentials: 'include',
|
|
69
|
-
headers: {
|
|
70
|
-
'Content-Type': 'application/json'
|
|
71
|
-
},
|
|
72
|
-
body: JSON.stringify({ name })
|
|
73
|
-
});
|
|
74
|
-
if (!response.ok) {
|
|
75
|
-
throw new Error('Failed to create organization');
|
|
76
|
-
}
|
|
77
|
-
const data = await response.json();
|
|
78
|
-
return data;
|
|
79
|
-
}
|
|
80
|
-
export async function switchOrganization(orgId) {
|
|
81
|
-
const response = await fetch(getInstance() + '/api/public/bar/orgs/switch', {
|
|
82
|
-
method: 'POST',
|
|
83
|
-
credentials: 'include',
|
|
84
|
-
headers: {
|
|
85
|
-
'Content-Type': 'application/json'
|
|
86
|
-
},
|
|
87
|
-
body: JSON.stringify({ organization_id: orgId })
|
|
88
|
-
});
|
|
89
|
-
if (!response.ok) {
|
|
90
|
-
throw new Error('Failed to switch organization');
|
|
91
|
-
}
|
|
92
|
-
await initBar();
|
|
93
42
|
}
|
|
94
43
|
export class UnreadUpdatesTimeLocalStorage {
|
|
95
44
|
static KEY = 'unread_updates';
|
|
@@ -149,9 +98,5 @@ export const bar = {
|
|
|
149
98
|
*/
|
|
150
99
|
reload: () => {
|
|
151
100
|
initBar();
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Open the org selector dropdown from the outside world
|
|
155
|
-
*/
|
|
156
|
-
openOrganizationDropdown: () => barOrganizationDropdownOpen.set(true)
|
|
101
|
+
}
|
|
157
102
|
};
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
import { type ToDotPaths, type I18nStrings, type PrimitiveType } from './types.js';
|
|
2
2
|
import { type Component } from 'svelte';
|
|
3
|
-
declare
|
|
4
|
-
props: {
|
|
3
|
+
declare class __sveltets_Render<StringsT extends I18nStrings> {
|
|
4
|
+
props(): {
|
|
5
5
|
key: ToDotPaths<StringsT>;
|
|
6
6
|
params?: Record<string, PrimitiveType | {
|
|
7
7
|
element?: string;
|
|
8
8
|
component?: Component<any>;
|
|
9
9
|
props?: Record<string, any>;
|
|
10
|
-
}
|
|
10
|
+
}> | undefined;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
slots: {};
|
|
15
|
-
events: {};
|
|
16
|
-
};
|
|
17
|
-
declare class __sveltets_Render<StringsT extends I18nStrings> {
|
|
18
|
-
props(): ReturnType<typeof $$render<StringsT>>['props'];
|
|
19
|
-
events(): ReturnType<typeof $$render<StringsT>>['events'];
|
|
20
|
-
slots(): ReturnType<typeof $$render<StringsT>>['slots'];
|
|
12
|
+
events(): {};
|
|
13
|
+
slots(): {};
|
|
21
14
|
bindings(): "";
|
|
22
15
|
exports(): {};
|
|
23
16
|
}
|
|
@@ -6,6 +6,6 @@ interface Props {
|
|
|
6
6
|
children?: import('svelte').Snippet;
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
}
|
|
9
|
-
declare const Radio: import("svelte").Component<Props, {}, "
|
|
9
|
+
declare const Radio: import("svelte").Component<Props, {}, "group" | "input">;
|
|
10
10
|
type Radio = ReturnType<typeof Radio>;
|
|
11
11
|
export default Radio;
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
flex?: number[];
|
|
11
11
|
children?: Snippet;
|
|
12
12
|
nested?: Snippet;
|
|
13
|
-
noHorizonalPadding?: boolean;
|
|
14
13
|
[key: string]: any;
|
|
15
14
|
}
|
|
16
15
|
|
|
@@ -21,7 +20,6 @@
|
|
|
21
20
|
flex = [1, 2],
|
|
22
21
|
children,
|
|
23
22
|
nested,
|
|
24
|
-
noHorizonalPadding = false,
|
|
25
23
|
...rest
|
|
26
24
|
}: Props = $props();
|
|
27
25
|
</script>
|
|
@@ -30,7 +28,6 @@
|
|
|
30
28
|
class="split-control"
|
|
31
29
|
class:has-nested={!!nested}
|
|
32
30
|
class:column
|
|
33
|
-
class:no-hpadding={noHorizonalPadding}
|
|
34
31
|
aria-label={typeof label === 'string' ? label : undefined}
|
|
35
32
|
{...rest}
|
|
36
33
|
>
|
|
@@ -79,9 +76,6 @@
|
|
|
79
76
|
.split-control.column {
|
|
80
77
|
flex-direction: column;
|
|
81
78
|
}
|
|
82
|
-
.split-control.column .left {
|
|
83
|
-
padding-bottom: 10px;
|
|
84
|
-
}
|
|
85
79
|
.split-control.column .right {
|
|
86
80
|
padding-top: 0;
|
|
87
81
|
}
|
|
@@ -103,12 +97,6 @@
|
|
|
103
97
|
min-width: 0;
|
|
104
98
|
}
|
|
105
99
|
|
|
106
|
-
.no-hpadding .left,
|
|
107
|
-
.no-hpadding .right {
|
|
108
|
-
padding-left: 0;
|
|
109
|
-
padding-right: 0;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
100
|
.caption-wrap {
|
|
113
101
|
margin-top: 4px;
|
|
114
102
|
}</style>
|
|
@@ -4,6 +4,6 @@ interface Props {
|
|
|
4
4
|
children?: import('svelte').Snippet;
|
|
5
5
|
[key: string]: any;
|
|
6
6
|
}
|
|
7
|
-
declare const Switch: import("svelte").Component<Props, {}, "
|
|
7
|
+
declare const Switch: import("svelte").Component<Props, {}, "checked" | "input">;
|
|
8
8
|
type Switch = ReturnType<typeof Switch>;
|
|
9
9
|
export default Switch;
|