@hyvor/design 1.0.10 → 1.0.11
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.
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
})
|
|
93
|
+
$effect(() => {
|
|
94
|
+
position;
|
|
95
|
+
align;
|
|
96
|
+
positionWrap();
|
|
97
|
+
})
|
|
98
98
|
|
|
99
99
|
function debouncedPosition() {
|
|
100
100
|
debounce(positionWrap, 10)();
|
|
@@ -110,6 +110,10 @@
|
|
|
110
110
|
subtree: true,
|
|
111
111
|
childList: true
|
|
112
112
|
});
|
|
113
|
+
|
|
114
|
+
return () => {
|
|
115
|
+
mutationObserver.disconnect();
|
|
116
|
+
};
|
|
113
117
|
});
|
|
114
118
|
|
|
115
119
|
function slideIn(node: any) {
|
|
@@ -5,32 +5,48 @@
|
|
|
5
5
|
|
|
6
6
|
let { name } = $props();
|
|
7
7
|
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
return 1;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const endsAtDate = new Date(endsAt * 1000);
|
|
8
|
+
function daysDiff(unix: number) {
|
|
9
|
+
const date = new Date(unix * 1000);
|
|
14
10
|
const now = new Date();
|
|
15
11
|
|
|
16
|
-
const diffTime =
|
|
12
|
+
const diffTime = date.valueOf() - now.valueOf();
|
|
17
13
|
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
18
14
|
|
|
19
15
|
return Math.max(diffDays, 1);
|
|
20
16
|
}
|
|
21
17
|
|
|
18
|
+
function remainingTrialDays(endsAt: number | undefined | null) {
|
|
19
|
+
if (!endsAt) {
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
return daysDiff(endsAt);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function remainingCancelAtDAys(cancelAt: number | undefined | null) : null | number {
|
|
26
|
+
if (!cancelAt) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return daysDiff(cancelAt);
|
|
30
|
+
}
|
|
31
|
+
|
|
22
32
|
let trialDays = $derived(remainingTrialDays($barLicense?.trial_ends_at));
|
|
33
|
+
let cancelAtDays = $derived(remainingCancelAtDAys($barLicense?.subscription?.cancel_at));
|
|
23
34
|
</script>
|
|
24
35
|
|
|
25
36
|
{#if $barLicense}
|
|
26
37
|
<a class="wrap" href="/console/billing">
|
|
27
38
|
{#if $barLicense.type === 'subscription'}
|
|
28
39
|
<Tooltip
|
|
29
|
-
text="Your current subscription plan for {name}. Click to manage it."
|
|
30
40
|
position="bottom"
|
|
31
41
|
>
|
|
42
|
+
{#snippet tooltip()}
|
|
43
|
+
Your current subscription plan for {name}. Click to manage it.
|
|
44
|
+
{/snippet}
|
|
32
45
|
<Tag color="blue" size="small">
|
|
33
|
-
{$barLicense.
|
|
46
|
+
{$barLicense.subscription!.plan_readable}
|
|
47
|
+
{#if cancelAtDays}
|
|
48
|
+
(until {cancelAtDays}d)
|
|
49
|
+
{/if}
|
|
34
50
|
</Tag>
|
|
35
51
|
</Tooltip>
|
|
36
52
|
{:else if $barLicense.type === 'custom'}
|
|
@@ -21,14 +21,18 @@ export interface BarUpdate {
|
|
|
21
21
|
url?: string;
|
|
22
22
|
}
|
|
23
23
|
export type BarUpdateType = 'company' | 'core' | 'talk' | 'blogs' | 'fortguard';
|
|
24
|
-
export interface
|
|
24
|
+
export interface BarResolvedLicense {
|
|
25
25
|
type: 'subscription' | 'trial' | 'custom' | 'expired';
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
license: Record<string, number | boolean> | null;
|
|
27
|
+
subscription: null | {
|
|
28
|
+
plan_readable: string;
|
|
29
|
+
cancel_at: null | number;
|
|
30
|
+
};
|
|
31
|
+
trial_ends_at: null | number;
|
|
28
32
|
}
|
|
29
33
|
export declare const barUser: import("svelte/store").Writable<BarUser | null>;
|
|
30
34
|
export declare const barUnreadUpdates: import("svelte/store").Writable<number>;
|
|
31
|
-
export declare const barLicense: import("svelte/store").Writable<
|
|
35
|
+
export declare const barLicense: import("svelte/store").Writable<BarResolvedLicense | null>;
|
|
32
36
|
export declare const barHasFailedInvoices: import("svelte/store").Writable<boolean>;
|
|
33
37
|
export declare function loadBarUser(instance: string, product: BarProduct): void;
|
|
34
38
|
export declare class UnreadUpdatesTimeLocalStorage {
|
package/package.json
CHANGED