@hyvor/design 1.1.11 → 1.1.12-beta.1
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.
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Link from '../../components/Link/Link.svelte';
|
|
3
|
+
import Modal from '../../components/Modal/Modal.svelte';
|
|
4
|
+
import { replaceState } from '$app/navigation';
|
|
5
|
+
import { onMount } from 'svelte';
|
|
6
|
+
|
|
7
|
+
let partner: string | null = $state(null);
|
|
8
|
+
let showModal = $state(false);
|
|
9
|
+
|
|
10
|
+
onMount(() => {
|
|
11
|
+
const params = new URLSearchParams(window.location.search);
|
|
12
|
+
partner = params.get('partner');
|
|
13
|
+
|
|
14
|
+
if (partner) {
|
|
15
|
+
showModal = true;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
function handleConsent() {
|
|
20
|
+
const coreUrl = `${location.protocol}//${location.hostname.split('.').slice(-2).join('.')}`;
|
|
21
|
+
|
|
22
|
+
fetch(coreUrl + '/api/public/affiliate/placement', {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: {
|
|
25
|
+
'Content-Type': 'application/json'
|
|
26
|
+
},
|
|
27
|
+
body: JSON.stringify({
|
|
28
|
+
partner: partner,
|
|
29
|
+
url: window.location.href
|
|
30
|
+
}),
|
|
31
|
+
credentials: 'include'
|
|
32
|
+
}).then((response) => {
|
|
33
|
+
if (response.ok) {
|
|
34
|
+
console.info('Affiliate placement recorded for partner:', partner);
|
|
35
|
+
}
|
|
36
|
+
}).finally(() => {
|
|
37
|
+
const url = new URL(window.location.href);
|
|
38
|
+
url.searchParams.delete('partner');
|
|
39
|
+
replaceState(url, {});
|
|
40
|
+
showModal = false;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<Modal
|
|
46
|
+
title="Referred by {partner}"
|
|
47
|
+
bind:show={showModal}
|
|
48
|
+
closeOnOutsideClick={false}
|
|
49
|
+
footer={
|
|
50
|
+
{
|
|
51
|
+
cancel: {
|
|
52
|
+
text: "Do not track"
|
|
53
|
+
},
|
|
54
|
+
confirm: {
|
|
55
|
+
text: "Ok, Visit Site",
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
on:confirm={handleConsent}
|
|
60
|
+
>
|
|
61
|
+
<div class="notice">
|
|
62
|
+
You visited our site through our affiliate partner <strong>{partner}</strong>. To track this referral, we will place a small
|
|
63
|
+
cookie in your browser. This cookie helps us identify which affiliate partner referred you
|
|
64
|
+
if you sign up. It does not collect any personal data.
|
|
65
|
+
</div>
|
|
66
|
+
<p>
|
|
67
|
+
You can read more in our <Link href="https://hyvor.com/privacy" target="_blank">Privacy Policy</Link>.
|
|
68
|
+
</p>
|
|
69
|
+
</Modal>
|
|
70
|
+
|
|
71
|
+
<style>
|
|
72
|
+
.notice {
|
|
73
|
+
line-height: 24px;
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import LanguageToggle from '../../components/Internationalization/LanguageToggle.svelte';
|
|
14
14
|
import IconBluesky from '@hyvor/icons/IconBluesky';
|
|
15
15
|
import { SOCIAL_LINKS, type Socials } from '../social.js';
|
|
16
|
+
import Affiliate from '../Affiliate/Affiliate.svelte';
|
|
16
17
|
|
|
17
18
|
const year = new Date().getFullYear();
|
|
18
19
|
|
|
@@ -20,12 +21,14 @@
|
|
|
20
21
|
email?: string | null;
|
|
21
22
|
social?: Partial<Socials>;
|
|
22
23
|
center?: import('svelte').Snippet;
|
|
24
|
+
affiliate?: boolean;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
let {
|
|
26
28
|
email = null,
|
|
27
29
|
social = $bindable({} as Record<string, string | null>),
|
|
28
|
-
center
|
|
30
|
+
center,
|
|
31
|
+
affiliate = true
|
|
29
32
|
}: Props = $props();
|
|
30
33
|
|
|
31
34
|
social = {
|
|
@@ -109,6 +112,11 @@
|
|
|
109
112
|
<div class="footer-bottom-right">From France 🇫🇷</div>
|
|
110
113
|
</div>
|
|
111
114
|
</Container>
|
|
115
|
+
|
|
116
|
+
{#if affiliate}
|
|
117
|
+
<Affiliate />
|
|
118
|
+
{/if}
|
|
119
|
+
|
|
112
120
|
</footer>
|
|
113
121
|
|
|
114
122
|
<style>
|
package/package.json
CHANGED