@lilaquadrat/design-core 0.2.2 → 0.3.0

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.
Files changed (78) hide show
  1. package/README.md +71 -3
  2. package/html/index.server.html +1 -8
  3. package/package.json +53 -53
  4. package/src/client-entry.ts +8 -8
  5. package/src/components/partials/error.partial.vue +19 -19
  6. package/src/components/partials/main-components.partial.vue +75 -70
  7. package/src/components/partials/qrcode.partial.vue +8 -8
  8. package/src/functions/AuthProviderFactory.ts +30 -0
  9. package/src/functions/PaymenyProviderFactory.ts +11 -11
  10. package/src/functions/auth0.provider.ts +75 -0
  11. package/src/functions/keycloak.provider.ts +228 -0
  12. package/src/functions/lila-dom.ts +50 -50
  13. package/src/functions/shopify.provider.ts +176 -154
  14. package/src/functions/stripe.provider.ts +120 -108
  15. package/src/globals.d.ts +1 -2
  16. package/src/index.ts +9 -7
  17. package/src/interfaces/AuthCallbackResult.interface.ts +5 -0
  18. package/src/interfaces/AuthConfig.interface.ts +13 -0
  19. package/src/interfaces/AuthProvider.interface.ts +15 -0
  20. package/src/interfaces/FrontendConfig.interface.ts +11 -40
  21. package/src/interfaces/GenericEvents.interface.ts +1 -1
  22. package/src/interfaces/IdTokenExtended.interface.ts +13 -4
  23. package/src/interfaces/PaymentProvider.interface.ts +2 -2
  24. package/src/interfaces/RenderOptions.interface.ts +12 -0
  25. package/src/libs/ActionNotice.ts +125 -125
  26. package/src/libs/Models.class.ts +219 -221
  27. package/src/main.ts +41 -36
  28. package/src/mixins/createCookieString.ts +50 -36
  29. package/src/mixins/createModelDeclaration.ts +22 -19
  30. package/src/mixins/createRouter.ts +12 -12
  31. package/src/mixins/date.ts +4 -2
  32. package/src/mixins/formatSize.ts +5 -5
  33. package/src/mixins/getAnchor.ts +1 -1
  34. package/src/mixins/getRoutes.ts +13 -25
  35. package/src/mixins/hasSlotContent.ts +22 -16
  36. package/src/mixins/hooks.ts +101 -60
  37. package/src/mixins/loadComponents.ts +60 -58
  38. package/src/mixins/logger.ts +17 -13
  39. package/src/mixins/replaceVariables.ts +10 -8
  40. package/src/mixins/scroll.ts +61 -45
  41. package/src/models/Address.model.ts +7 -7
  42. package/src/models/Contact.model.ts +14 -14
  43. package/src/plugins/analytics.ts +198 -0
  44. package/src/plugins/auth.ts +74 -60
  45. package/src/plugins/currency.ts +10 -10
  46. package/src/plugins/events.ts +101 -97
  47. package/src/plugins/filters.ts +21 -18
  48. package/src/plugins/replacer.ts +7 -6
  49. package/src/plugins/signupFlow.ts +45 -43
  50. package/src/plugins/traceable.ts +28 -26
  51. package/src/plugins/translations.ts +9 -9
  52. package/src/plugins/youtube.ts +39 -34
  53. package/src/routes.ts +108 -108
  54. package/src/server-entry.ts +75 -77
  55. package/src/stores/calls.store.ts +14 -14
  56. package/src/stores/cart.store.ts +116 -107
  57. package/src/stores/content.store.ts +87 -45
  58. package/src/stores/editor.store.ts +16 -16
  59. package/src/stores/files.store.ts +72 -72
  60. package/src/stores/main.store.ts +155 -109
  61. package/src/stores/user.store.ts +72 -68
  62. package/src/translations/de.ts +127 -127
  63. package/src/views/content.view.vue +81 -143
  64. package/src/views/download.view.vue +25 -23
  65. package/src/views/editor.view.vue +150 -125
  66. package/src/views/login.view.vue +35 -36
  67. package/src/views/signup-account.view.vue +14 -14
  68. package/tooling/cypress/config.ts +68 -54
  69. package/tooling/cypress/manifest-utils.mjs +34 -22
  70. package/tooling/cypress/run-parallel.mjs +41 -35
  71. package/tooling/cypress/support/commands.ts +458 -300
  72. package/tooling/eslint.config.js +1 -223
  73. package/tooling/preview.plugin.js +68 -68
  74. package/tooling/ssr-test/index.mjs +205 -203
  75. package/tooling/vite.d.ts +0 -6
  76. package/tooling/vite.js +170 -162
  77. package/src/interfaces/EditorConfiguration.interface.ts +0 -15
  78. package/tooling/stylelint.config.mjs +0 -24
@@ -18,71 +18,73 @@ const STEP_ORDER: SignupStepKey[] = ['register', 'account', 'connect', 'verify']
18
18
  * maps a lock state to the route the user has to complete next.
19
19
  * keep this the single place that knows about the lock string values.
20
20
  */
21
- function routeForLock (locked?: string): { name: string } {
21
+ function routeForLock(locked?: string): { name: string } {
22
22
 
23
- if (locked === 'user-connect') return { name: 'signup-connect' };
24
- if (locked === 'email-verified') return { name: 'signup-verify' };
23
+ if (locked === 'user-connect') return { name: 'signup-connect' };
24
+ if (locked === 'email-verified') return { name: 'signup-verify' };
25
25
 
26
- return { name: 'members' };
26
+ return { name: 'members' };
27
27
 
28
28
  }
29
29
 
30
- function useSignupFlow () {
30
+ function useSignupFlow() {
31
31
 
32
- const userStore = useUserStore();
33
- const route = useRoute();
34
- // DEBUG: ?step=<1|2|3|4> forces the active step (dev only)
35
- const debugStep = computed<SignupStepKey | undefined>(() => {
32
+ const userStore = useUserStore();
33
+ const route = useRoute();
34
+ // DEBUG: ?step=<1|2|3|4> forces the active step (dev only)
35
+ const debugStep = computed<SignupStepKey | undefined>(() => {
36
36
 
37
- const step = route?.query?.step;
37
+ const step = route?.query?.step;
38
38
 
39
- if (import.meta.env.DEV && typeof step === 'string') {
39
+ if (import.meta.env.DEV && typeof step === 'string') {
40
40
 
41
- const index = Number(step) - 1;
41
+ const index = Number(step) - 1;
42
42
 
43
- if (index >= 0 && index < STEP_ORDER.length) return STEP_ORDER[index];
43
+ if (index >= 0 && index < STEP_ORDER.length) return STEP_ORDER[index];
44
44
 
45
- }
45
+ }
46
46
 
47
- return undefined;
47
+ return undefined;
48
48
 
49
- });
50
- // the furthest step the user has reached, derived from auth + lock state.
51
- // being authenticated implies register + account are done, even when there
52
- // is no local customer (e.g. connecting from a different browser).
53
- const currentKey = computed<SignupStepKey>(() => {
49
+ });
50
+ // the furthest step the user has reached, derived from auth + lock state.
51
+ // being authenticated implies register + account are done, even when there
52
+ // is no local customer (e.g. connecting from a different browser).
53
+ const currentKey = computed<SignupStepKey>(() => {
54
54
 
55
- if (debugStep.value) return debugStep.value;
55
+ if (debugStep.value) return debugStep.value;
56
56
 
57
- if (!auth.isAuth.value) {
58
- return (userStore.customer || userStore.userData) ? 'account' : 'register';
59
- }
57
+ if (!auth.isAuth.value) {
60
58
 
61
- if (userStore.locked === 'user-connect') return 'connect';
62
- if (userStore.locked === 'email-verified') return 'verify';
59
+ return (userStore.customer || userStore.userData) ? 'account' : 'register';
60
+
61
+ }
63
62
 
64
- return 'verify';
63
+ if (userStore.locked === 'user-connect') return 'connect';
64
+ if (userStore.locked === 'email-verified') return 'verify';
65
65
 
66
- });
67
- const isComplete = computed(() => !debugStep.value && auth.isAuth.value && !userStore.locked);
68
- // steps are monotonic: everything before the current step counts as done
69
- const steps = computed<SignupStep[]>(() => {
66
+ return 'verify';
70
67
 
71
- const currentIndex = STEP_ORDER.indexOf(currentKey.value);
68
+ });
69
+ const isComplete = computed(() => !debugStep.value && auth.isAuth.value && !userStore.locked);
70
+ // steps are monotonic: everything before the current step counts as done
71
+ const steps = computed<SignupStep[]>(() => {
72
72
 
73
- return STEP_ORDER.map((key, index) => ({
74
- key,
75
- label : `signup-step-${key}`,
76
- status: isComplete.value || index < currentIndex
77
- ? 'done'
78
- : index === currentIndex
79
- ? 'current'
80
- : 'upcoming',
81
- }));
73
+ const currentIndex = STEP_ORDER.indexOf(currentKey.value);
82
74
 
83
- });
75
+ return STEP_ORDER.map((key, index) => ({
76
+ key,
77
+ label: `signup-step-${key}`,
78
+ status: isComplete.value || index < currentIndex
79
+ ? 'done'
80
+ : index === currentIndex
81
+ ? 'current'
82
+ : 'upcoming',
83
+ }));
84
84
 
85
- return { steps, currentKey, isComplete, routeForLock };
85
+ });
86
+
87
+ return { steps, currentKey, isComplete, routeForLock };
86
88
 
87
89
  }
88
90
 
@@ -3,51 +3,53 @@ import useCallStore from '../stores/calls.store';
3
3
  import type { Ref } from 'vue';
4
4
 
5
5
  const plugin = {
6
- install: (): void => {
7
- logger.plugins('traceable installed')
8
- },
6
+ install: (): void => {
7
+
8
+ logger.plugins('traceable installed')
9
+
10
+ },
9
11
  };
10
12
  const useTraceable = () => {
11
13
 
12
- const { addCall, updateCall } = useCallStore();
14
+ const { addCall, updateCall } = useCallStore();
13
15
 
14
- async function traceable<T> (promise: Promise<T>, traceId?: Ref<string|undefined>, options: {time: number} = {time: 3000}) {
16
+ async function traceable<T>(promise: Promise<T>, traceId?: Ref<string|undefined>, options: {time: number} = {time: 3000}) {
15
17
 
16
- // add the new call to vuex and fetch the id
17
- const id = addCall();
18
+ // add the new call to vuex and fetch the id
19
+ const id = addCall();
18
20
 
19
- if(traceId) traceId.value = id;
21
+ if(traceId) traceId.value = id;
20
22
 
21
- const minimum = new Promise<void>((resolve) => {
23
+ const minimum = new Promise<void>((resolve) => {
22
24
 
23
- setTimeout(() => resolve(), options.time);
25
+ setTimeout(() => resolve(), options.time);
24
26
 
25
- });
26
- // the minimum promise will hold the execution of allsettled
27
- const results = await Promise.allSettled([minimum, promise]);
27
+ });
28
+ // the minimum promise will hold the execution of allsettled
29
+ const results = await Promise.allSettled([minimum, promise]);
28
30
 
29
- // no error will be thrown, we need to check the result of the given promise
30
- if (results[1].status === 'rejected') {
31
+ // no error will be thrown, we need to check the result of the given promise
32
+ if (results[1].status === 'rejected') {
31
33
 
32
- updateCall(id, 'rejected');
33
- throw results[1].reason;
34
+ updateCall(id, 'rejected');
35
+ throw results[1].reason;
34
36
 
35
- } else {
37
+ } else {
36
38
 
37
- updateCall(id, 'resolved');
38
- return results[1].value;
39
+ updateCall(id, 'resolved');
40
+ return results[1].value;
39
41
 
40
- }
42
+ }
41
43
 
42
- }
44
+ }
43
45
 
44
- return {
45
- traceable
46
- }
46
+ return {
47
+ traceable
48
+ }
47
49
 
48
50
  };
49
51
 
50
52
  export default plugin;
51
53
  export {
52
- useTraceable
54
+ useTraceable
53
55
  }
@@ -2,13 +2,13 @@ import { createI18n } from 'vue-i18n';
2
2
  import de from '../translations/de';
3
3
 
4
4
  const i18n = createI18n({
5
- legacy : false,
6
- locale : 'de',
7
- fallbackLocale: 'de',
8
- missingWarn : false,
9
- fallbackWarn : false,
10
- missing : (_locale, key) => key,
11
- messages : { de },
5
+ legacy: false,
6
+ locale: 'de',
7
+ fallbackLocale: 'de',
8
+ missingWarn: false,
9
+ fallbackWarn: false,
10
+ missing: (_locale, key) => key,
11
+ messages: { de },
12
12
  });
13
13
  const { t } = i18n.global;
14
14
 
@@ -19,9 +19,9 @@ const { t } = i18n.global;
19
19
  * the strings it renders itself - so a project calls this once at startup with
20
20
  * its own translation file.
21
21
  */
22
- function addMessages (locale: string, messages: Record<string, unknown>) {
22
+ function addMessages(locale: string, messages: Record<string, unknown>) {
23
23
 
24
- i18n.global.mergeLocaleMessage(locale, messages);
24
+ i18n.global.mergeLocaleMessage(locale, messages);
25
25
 
26
26
  }
27
27
 
@@ -3,78 +3,83 @@ import { ref } from 'vue';
3
3
 
4
4
  class Youtube {
5
5
 
6
- youtubeApiState = ref<boolean>(false);
6
+ youtubeApiState = ref<boolean>(false);
7
7
 
8
- loadState = ref<boolean>(false);
8
+ loadState = ref<boolean>(false);
9
9
 
10
- loadApi () {
10
+ loadApi() {
11
11
 
12
- if(this.loadState.value) return Promise.resolve();
12
+ if(this.loadState.value) return Promise.resolve();
13
13
 
14
- return new Promise<void>((resolve) => {
14
+ return new Promise<void>((resolve) => {
15
15
 
16
- const script = document.createElement('script');
16
+ const script = document.createElement('script');
17
17
 
18
- script.src = 'https://www.youtube.com/iframe_api';
18
+ script.src = 'https://www.youtube.com/iframe_api';
19
19
 
20
- script.onload = () => {
21
- resolve();
22
- };
20
+ script.onload = () => {
21
+
22
+ resolve();
23
+
24
+ };
23
25
 
24
- document.body.appendChild(script);
25
- this.loadState.value = true;
26
+ document.body.appendChild(script);
27
+ this.loadState.value = true;
26
28
 
27
- });
28
- }
29
+ });
30
+
31
+ }
29
32
 
30
- /**
33
+ /**
31
34
  * load the youtube iframe api and changes the youtubeApiState to true when all is ready
32
35
  */
33
- addYoutube () {
36
+ addYoutube() {
34
37
 
35
- if(!this.youtubeApiState.value) {
38
+ if(!this.youtubeApiState.value) {
36
39
 
37
- this.loadApi()
40
+ this.loadApi()
38
41
 
39
- }
42
+ }
40
43
 
41
- }
44
+ }
42
45
 
43
46
  }
44
47
 
45
48
  const youtubePlugin = new Youtube();
46
49
  const plugin = {
47
- install: (): void => {
48
- // this exists only for initialization purposes
49
- logger.plugins('youtube installed');
50
- },
50
+ install: (): void => {
51
+
52
+ // this exists only for initialization purposes
53
+ logger.plugins('youtube installed');
54
+
55
+ },
51
56
  };
52
57
 
53
58
  if(typeof window !== 'undefined') {
54
59
 
55
- window.onYouTubeIframeAPIReady = () => {
60
+ window.onYouTubeIframeAPIReady = () => {
56
61
 
57
- youtubePlugin.youtubeApiState.value = true;
62
+ youtubePlugin.youtubeApiState.value = true;
58
63
 
59
- };
64
+ };
60
65
 
61
66
  }
62
67
 
63
- function useYoutube () {
68
+ function useYoutube() {
64
69
 
65
- return {
66
- youtubeApiState: youtubePlugin.youtubeApiState,
67
- /**
70
+ return {
71
+ youtubeApiState: youtubePlugin.youtubeApiState,
72
+ /**
68
73
  * loads the youtube iframe api and changes the youtubeApiState to true when all is ready
69
74
  */
70
- addYoutube : () => youtubePlugin.addYoutube()
71
- };
75
+ addYoutube: () => youtubePlugin.addYoutube()
76
+ };
72
77
 
73
78
  }
74
79
 
75
80
  export default plugin;
76
81
 
77
82
  export {
78
- useYoutube
83
+ useYoutube
79
84
  };
80
85
 
package/src/routes.ts CHANGED
@@ -7,126 +7,126 @@ import SignupAccountView from './views/signup-account.view.vue';
7
7
  import DownloadView from './views/download.view.vue';
8
8
 
9
9
  const dynamicRoutes: readonly RouteRecordRaw[] = [
10
- {
11
- path : '/m/:pathMatch(.*)?',
12
- name : 'members',
13
- component: ContentView,
14
- meta : {
15
- contentType: 'members'
16
- }
17
- },
18
- {
19
- path : '/login-callback',
20
- name : 'login-callback',
21
- component: LoginView
22
- },
23
- {
24
- path : '/signup/account',
25
- name : 'signup-account',
26
- component: SignupAccountView
27
- },
28
- {
29
- path : '/signup',
30
- name : 'signup',
31
- component: ContentView,
32
- meta : {
33
- contentType: 'public'
34
- }
35
- },
36
- {
37
- path : '/signup/connect',
38
- name : 'signup-connect',
39
- component: ContentView,
40
- meta : {
41
- contentType: 'public'
42
- }
43
- },
44
- {
45
- path : '/signup/verify',
46
- name : 'signup-verify',
47
- component: ContentView,
48
- meta : {
49
- contentType: 'public'
50
- }
51
- },
52
- {
53
- path : '/signup/done',
54
- name : 'signup-done',
55
- component: ContentView,
56
- meta : {
57
- contentType: 'public'
58
- }
59
- },
60
- {
61
- path : '/download/:app/:filename',
62
- name : 'download',
63
- component: DownloadView,
64
- meta : {
65
- contentType: 'members'
66
- }
67
- },
68
- {
69
- path : '',
70
- name : 'public-home',
71
- component: ContentView,
72
- meta : {
73
- contentType: 'public'
74
- }
75
- },
76
- {
77
- path : '/:pathMatch(.*)*',
78
- name : 'public-content',
79
- component: ContentView,
80
- meta : {
81
- contentType: 'public'
82
- }
83
- },
10
+ {
11
+ path: '/m/:pathMatch(.*)?',
12
+ name: 'members',
13
+ component: ContentView,
14
+ meta: {
15
+ contentType: 'members'
16
+ }
17
+ },
18
+ {
19
+ path: '/login-callback',
20
+ name: 'login-callback',
21
+ component: LoginView
22
+ },
23
+ {
24
+ path: '/signup/account',
25
+ name: 'signup-account',
26
+ component: SignupAccountView
27
+ },
28
+ {
29
+ path: '/signup',
30
+ name: 'signup',
31
+ component: ContentView,
32
+ meta: {
33
+ contentType: 'public'
34
+ }
35
+ },
36
+ {
37
+ path: '/signup/connect',
38
+ name: 'signup-connect',
39
+ component: ContentView,
40
+ meta: {
41
+ contentType: 'public'
42
+ }
43
+ },
44
+ {
45
+ path: '/signup/verify',
46
+ name: 'signup-verify',
47
+ component: ContentView,
48
+ meta: {
49
+ contentType: 'public'
50
+ }
51
+ },
52
+ {
53
+ path: '/signup/done',
54
+ name: 'signup-done',
55
+ component: ContentView,
56
+ meta: {
57
+ contentType: 'public'
58
+ }
59
+ },
60
+ {
61
+ path: '/download/:app/:filename',
62
+ name: 'download',
63
+ component: DownloadView,
64
+ meta: {
65
+ contentType: 'members'
66
+ }
67
+ },
68
+ {
69
+ path: '',
70
+ name: 'public-home',
71
+ component: ContentView,
72
+ meta: {
73
+ contentType: 'public'
74
+ }
75
+ },
76
+ {
77
+ path: '/:pathMatch(.*)*',
78
+ name: 'public-content',
79
+ component: ContentView,
80
+ meta: {
81
+ contentType: 'public'
82
+ }
83
+ },
84
84
  ];
85
85
  const editorRoutes: readonly RouteRecordRaw[] = [
86
- {
87
- path : '/:pathMatch(.*)*',
88
- name : 'editor',
89
- component: EditorView
90
- },
86
+ {
87
+ path: '/:pathMatch(.*)*',
88
+ name: 'editor',
89
+ component: EditorView
90
+ },
91
91
  ];
92
92
 
93
93
  /**
94
94
  * the module gallery is the design itself, so the project provides the views.
95
95
  * testView is dev only and is left out of a production build.
96
96
  */
97
- function createPreviewRoutes (previewView: Component, testView?: Component): readonly RouteRecordRaw[] {
97
+ function createPreviewRoutes(previewView: Component, testView?: Component): readonly RouteRecordRaw[] {
98
98
 
99
- const testRoutes: RouteRecordRaw[] = testView && import.meta.env.DEV
100
- ? [
101
- {
102
- path : '/test/:name',
103
- name : 'test-view',
104
- component: testView,
105
- meta : {
106
- testOnly: true,
107
- },
108
- },
109
- ]
110
- : [];
99
+ const testRoutes: RouteRecordRaw[] = testView && import.meta.env.DEV
100
+ ? [
101
+ {
102
+ path: '/test/:name',
103
+ name: 'test-view',
104
+ component: testView,
105
+ meta: {
106
+ testOnly: true,
107
+ },
108
+ },
109
+ ]
110
+ : [];
111
111
 
112
- return [
113
- ...testRoutes,
114
- {
115
- path : '/:pathMatch(.*)*',
116
- name : 'preview',
117
- component: previewView
118
- },
119
- {
120
- path : '',
121
- name : 'preview-home',
122
- component: previewView
123
- },
124
- ];
112
+ return [
113
+ ...testRoutes,
114
+ {
115
+ path: '/:pathMatch(.*)*',
116
+ name: 'preview',
117
+ component: previewView
118
+ },
119
+ {
120
+ path: '',
121
+ name: 'preview-home',
122
+ component: previewView
123
+ },
124
+ ];
125
125
 
126
126
  }
127
127
 
128
128
  export {
129
- dynamicRoutes,
130
- editorRoutes,
131
- createPreviewRoutes
129
+ dynamicRoutes,
130
+ editorRoutes,
131
+ createPreviewRoutes
132
132
  };