@hyvor/design 1.1.25-beta-org-2 → 1.1.25-beta-org-3
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/HyvorBar/HyvorBar.svelte +3 -1
- package/dist/components/HyvorBar/Organization/BarOrganization.svelte +2 -8
- package/dist/components/HyvorBar/Organization/BarOrganization.svelte.d.ts +1 -3
- package/dist/components/HyvorBar/Organization/OrganizationButton.svelte +8 -9
- package/dist/components/HyvorBar/Organization/OrganizationButton.svelte.d.ts +0 -2
- package/dist/components/HyvorBar/Organization/OrgsList.svelte +1 -0
- package/dist/components/HyvorBar/bar.d.ts +1 -0
- package/dist/components/HyvorBar/bar.js +2 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import BarProducts, { PRODUCTS } from './BarProducts.svelte';
|
|
5
5
|
import BarSupport from './BarSupport.svelte';
|
|
6
6
|
import {
|
|
7
|
+
barOnOrganizationSwitch,
|
|
7
8
|
barUser,
|
|
8
9
|
initBar,
|
|
9
10
|
setInstanceAndProduct,
|
|
@@ -71,6 +72,7 @@
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
barOnOrganizationSwitch.set(onOrganizationSwitch);
|
|
74
76
|
if (authOverride) {
|
|
75
77
|
barUser.set(authOverride.user);
|
|
76
78
|
}
|
|
@@ -102,7 +104,7 @@
|
|
|
102
104
|
{getName()}
|
|
103
105
|
</span>
|
|
104
106
|
</a>
|
|
105
|
-
<BarOrganization
|
|
107
|
+
<BarOrganization />
|
|
106
108
|
<BarLicense name={getName()} />
|
|
107
109
|
</div>
|
|
108
110
|
<div class="right">
|
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
let disableTooltip = $state(false);
|
|
7
7
|
|
|
8
|
-
let props: {
|
|
9
|
-
onSwitch: (org: BarOrganization) => void;
|
|
10
|
-
} = $props();
|
|
8
|
+
let props: {} = $props();
|
|
11
9
|
|
|
12
10
|
barOrganizationDropdownOpen.subscribe((value) => {
|
|
13
11
|
if (value) disableTooltip = true;
|
|
@@ -17,11 +15,7 @@
|
|
|
17
15
|
{#if $barUser}
|
|
18
16
|
<Tooltip position="bottom" text="Switch Organization" disabled={disableTooltip}>
|
|
19
17
|
<div class="wrap">
|
|
20
|
-
<OrganizationButton
|
|
21
|
-
bind:show={$barOrganizationDropdownOpen}
|
|
22
|
-
onSwitch={props.onSwitch}
|
|
23
|
-
style="bordered"
|
|
24
|
-
/>
|
|
18
|
+
<OrganizationButton bind:show={$barOrganizationDropdownOpen} style="bordered" />
|
|
25
19
|
</div>
|
|
26
20
|
</Tooltip>
|
|
27
21
|
{/if}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { type BarOrganization } from '../bar.js';
|
|
2
|
-
type $$ComponentProps = {
|
|
3
|
-
onSwitch: (org: BarOrganization) => void;
|
|
4
|
-
};
|
|
2
|
+
type $$ComponentProps = {};
|
|
5
3
|
declare const BarOrganization: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
4
|
type BarOrganization = ReturnType<typeof BarOrganization>;
|
|
7
5
|
export default BarOrganization;
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
import Dropdown from '../../Dropdown/Dropdown.svelte';
|
|
3
3
|
import IconChevronExpand from '@hyvor/icons/IconChevronExpand';
|
|
4
4
|
import OrgsList from './OrgsList.svelte';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
barOnOrganizationSwitch,
|
|
7
|
+
barUser,
|
|
8
|
+
switchOrganization,
|
|
9
|
+
type BarOrganization
|
|
10
|
+
} from '../bar.js';
|
|
6
11
|
import toast from '../../Toast/toast.js';
|
|
7
12
|
import type { DropdownAlign } from '../../Dropdown/dropdown.types.js';
|
|
8
13
|
|
|
@@ -14,17 +19,11 @@
|
|
|
14
19
|
|
|
15
20
|
interface Props {
|
|
16
21
|
show?: boolean;
|
|
17
|
-
onSwitch?: (org: BarOrganization) => void;
|
|
18
22
|
style?: 'bordered' | 'plain';
|
|
19
23
|
dropdownAlign?: DropdownAlign;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
let {
|
|
23
|
-
show = $bindable(false),
|
|
24
|
-
onSwitch,
|
|
25
|
-
style = 'plain',
|
|
26
|
-
dropdownAlign = 'center'
|
|
27
|
-
}: Props = $props();
|
|
26
|
+
let { show = $bindable(false), style = 'plain', dropdownAlign = 'center' }: Props = $props();
|
|
28
27
|
let switching = $state(false);
|
|
29
28
|
|
|
30
29
|
async function handleSwitch(org: BarOrganization) {
|
|
@@ -40,7 +39,7 @@
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
switching = false;
|
|
43
|
-
|
|
42
|
+
$barOnOrganizationSwitch?.(org);
|
|
44
43
|
}
|
|
45
44
|
</script>
|
|
46
45
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type BarOrganization } from '../bar.js';
|
|
2
1
|
import type { DropdownAlign } from '../../Dropdown/dropdown.types.js';
|
|
3
2
|
/**
|
|
4
3
|
* This component depends on data from HyvorBar
|
|
@@ -7,7 +6,6 @@ import type { DropdownAlign } from '../../Dropdown/dropdown.types.js';
|
|
|
7
6
|
*/
|
|
8
7
|
interface Props {
|
|
9
8
|
show?: boolean;
|
|
10
|
-
onSwitch?: (org: BarOrganization) => void;
|
|
11
9
|
style?: 'bordered' | 'plain';
|
|
12
10
|
dropdownAlign?: DropdownAlign;
|
|
13
11
|
}
|
|
@@ -41,6 +41,7 @@ export declare const barLicense: import("svelte/store").Writable<BarResolvedLice
|
|
|
41
41
|
export declare const barHasFailedInvoices: import("svelte/store").Writable<boolean>;
|
|
42
42
|
export declare const barOrganizationDropdownOpen: import("svelte/store").Writable<boolean>;
|
|
43
43
|
export declare const barOrganizations: import("svelte/store").Writable<BarOrganization[]>;
|
|
44
|
+
export declare const barOnOrganizationSwitch: import("svelte/store").Writable<((org: BarOrganization) => void) | null>;
|
|
44
45
|
export declare function setInstanceAndProduct(instance_: string, product_: string): void;
|
|
45
46
|
/**
|
|
46
47
|
* @throws Error if initialization fails
|
|
@@ -8,6 +8,7 @@ export const barLicense = writable(null);
|
|
|
8
8
|
export const barHasFailedInvoices = writable(false);
|
|
9
9
|
export const barOrganizationDropdownOpen = writable(false);
|
|
10
10
|
export const barOrganizations = writable([]);
|
|
11
|
+
export const barOnOrganizationSwitch = writable(null);
|
|
11
12
|
export function setInstanceAndProduct(instance_, product_) {
|
|
12
13
|
instance = instance_;
|
|
13
14
|
product = product_;
|
|
@@ -39,7 +40,7 @@ export async function initBar() {
|
|
|
39
40
|
if (data.user && track.ready()) {
|
|
40
41
|
track.identify(data.user.id.toString(), {
|
|
41
42
|
name: data.user.name ?? undefined,
|
|
42
|
-
avatar: data.user.picture_url ?? undefined
|
|
43
|
+
avatar: data.user.picture_url ?? undefined
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
}
|
package/package.json
CHANGED