@lilaquadrat/design-core 0.2.1 → 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 (80) hide show
  1. package/README.md +76 -3
  2. package/html/index.server.html +1 -8
  3. package/package.json +54 -54
  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 +132 -0
  74. package/tooling/ssr-test/index.mjs +205 -203
  75. package/tooling/vite.d.ts +36 -0
  76. package/tooling/vite.js +234 -0
  77. package/src/interfaces/EditorConfiguration.interface.ts +0 -15
  78. package/tooling/preview.plugin.ts +0 -134
  79. package/tooling/stylelint.config.mjs +0 -24
  80. package/tooling/vite.ts +0 -260
@@ -1,82 +1,124 @@
1
1
  import { ref } from 'vue'
2
2
  import { defineStore } from 'pinia'
3
- import type { BasicData, Content, Customers, List } from '@lilaquadrat/interfaces';
3
+ import type { BasicData, Cart, Content, Customers, List, WorkingContext } from '@lilaquadrat/interfaces';
4
4
 
5
5
  export const useContentStore = defineStore('content', () => {
6
6
 
7
- const content = ref<BasicData<Content>[]>([]);
8
- const recipient = ref<Customers>();
9
- const list = ref<List>();
10
- const context = ref<Record<string, string | undefined | Record<string, string>>>();
7
+ /**
8
+ * the content currently rendered.
9
+ */
10
+ const content = ref<BasicData<Content>>();
11
11
 
12
- function add (contentToAdd: Content) {
12
+ /**
13
+ * the layout the rendered page is merged with.
14
+ */
15
+ const layout = ref<BasicData<Content>>();
13
16
 
14
- content.value.push(contentToAdd)
17
+ /**
18
+ * additional content selected in the publish method, e.g. for variables in the
19
+ * rendered content.
20
+ */
21
+ const contextContent = ref<BasicData<Content>[]>([]);
15
22
 
16
- }
23
+ /**
24
+ * the recipient of a mail or pdf publish, the list it was started for and the cart
25
+ * a payment driven publish was started for.
26
+ */
27
+ const recipient = ref<Customers>();
28
+ const list = ref<List>();
29
+ const cart = ref<Cart>();
17
30
 
18
- function addMulti (contentToAdd: Content[]) {
31
+ /**
32
+ * the document head title and description.
33
+ */
34
+ const context = ref<Record<string, string | undefined | Record<string, string>>>();
19
35
 
20
- content.value.push(...contentToAdd);
36
+ function add(contentToAdd: Content) {
21
37
 
22
- }
38
+ contextContent.value.push(contentToAdd)
23
39
 
24
- function findById (id: string) {
40
+ }
41
+
42
+ function addMulti(contentToAdd: Content[]) {
25
43
 
26
- return content.value.find((single) => single.id === id);
44
+ contextContent.value.push(...contentToAdd);
45
+
46
+ }
27
47
 
28
- }
48
+ function findById(id: string) {
29
49
 
30
- function findByinternalId (internalId: string) {
50
+ return contextContent.value.find((single) => single.id === id);
31
51
 
32
- return content.value.find((single) => single._id?.toString() === internalId);
52
+ }
33
53
 
34
- }
54
+ function findByinternalId(internalId: string) {
35
55
 
36
- function findByFilename (filename: string) {
56
+ return contextContent.value.find((single) => single._id?.toString() === internalId);
37
57
 
38
- return content.value.find((single) => single.settings.filename?.includes(filename));
58
+ }
39
59
 
40
- }
60
+ function findByFilename(filename: string) {
41
61
 
42
- function setContext (data: {sitetile?: string, description?: string, [key: string]: string | undefined}) {
62
+ return contextContent.value.find((single) => single.settings.filename?.includes(filename));
43
63
 
44
- context.value = data;
64
+ }
45
65
 
46
- if(typeof document === 'undefined') return;
66
+ /**
67
+ * seeds a render with every per render value of the working context.
68
+ */
69
+ function setRender(render: Partial<WorkingContext>) {
47
70
 
48
- if(data.sitetitle) {
49
-
50
- document.title = data.sitetitle;
71
+ content.value = render.content;
72
+ layout.value = render.layout;
73
+ contextContent.value = render.contextContent ?? [];
74
+ recipient.value = render.recipient;
75
+ list.value = render.list;
76
+ cart.value = render.cart;
51
77
 
52
78
  }
79
+
80
+ function setContext(data: {sitetile?: string, description?: string, [key: string]: string | undefined}) {
81
+
82
+ context.value = data;
83
+
84
+ if(typeof document === 'undefined') return;
85
+
86
+ if(data.sitetitle) {
87
+
88
+ document.title = data.sitetitle;
89
+
90
+ }
53
91
 
54
- if(data.description) {
92
+ if(data.description) {
55
93
 
56
- const metaDescription = document.querySelector('meta[name="description"]');
94
+ const metaDescription = document.querySelector('meta[name="description"]');
57
95
 
58
- if (metaDescription) {
96
+ if (metaDescription) {
59
97
 
60
- metaDescription.setAttribute('content', data.description);
98
+ metaDescription.setAttribute('content', data.description);
61
99
 
62
- }
100
+ }
101
+
102
+ }
63
103
 
64
104
  }
65
105
 
66
- }
67
-
68
- return {
69
- add,
70
- addMulti,
71
- findById,
72
- findByinternalId,
73
- findByFilename,
74
- content,
75
- recipient,
76
- list,
77
- context,
78
- setContext
79
- }
106
+ return {
107
+ add,
108
+ addMulti,
109
+ findById,
110
+ findByinternalId,
111
+ findByFilename,
112
+ setRender,
113
+ content,
114
+ layout,
115
+ contextContent,
116
+ recipient,
117
+ list,
118
+ cart,
119
+ context,
120
+ setContext
121
+ }
80
122
 
81
123
  })
82
124
 
@@ -4,23 +4,23 @@ import type { EditorActiveModule } from '@lilaquadrat/interfaces';
4
4
 
5
5
  export const useEditorStore = defineStore('editor', () => {
6
6
 
7
- const active = ref<EditorActiveModule>({});
8
- const availableModulesWithRevision = ref<{ revision: number, modules: any[]}>();
9
- const availableModulesWithRevisionMail = ref<{ revision: number, modules: any[]}>();
10
- const modulesBrowser = shallowRef<any>();
11
- const modulesMail = shallowRef<any>();
12
- const partialsBrowser = shallowRef<any>();
13
- const partialsMail = shallowRef<any>();
7
+ const active = ref<EditorActiveModule>({});
8
+ const availableModulesWithRevision = ref<{ revision: number, modules: any[]}>();
9
+ const availableModulesWithRevisionMail = ref<{ revision: number, modules: any[]}>();
10
+ const modulesBrowser = shallowRef<any>();
11
+ const modulesMail = shallowRef<any>();
12
+ const partialsBrowser = shallowRef<any>();
13
+ const partialsMail = shallowRef<any>();
14
14
 
15
- return {
16
- active,
17
- availableModulesWithRevision,
18
- availableModulesWithRevisionMail,
19
- modulesBrowser,
20
- modulesMail,
21
- partialsBrowser,
22
- partialsMail,
23
- }
15
+ return {
16
+ active,
17
+ availableModulesWithRevision,
18
+ availableModulesWithRevisionMail,
19
+ modulesBrowser,
20
+ modulesMail,
21
+ partialsBrowser,
22
+ partialsMail,
23
+ }
24
24
 
25
25
  })
26
26
 
@@ -57,109 +57,109 @@ export interface UploadContext {
57
57
 
58
58
  export const useFilesStore = defineStore('files', () => {
59
59
 
60
- const token = ref<TokenData>();
60
+ const token = ref<TokenData>();
61
61
 
62
- function getSdk () {
62
+ function getSdk() {
63
63
 
64
- const mainStore = useMainStore();
64
+ const mainStore = useMainStore();
65
65
 
66
- return new StudioSDK(mainStore.apiConfig);
66
+ return new StudioSDK(mainStore.apiConfig);
67
67
 
68
- }
68
+ }
69
69
 
70
- async function fetchToken (app: string, scope: 'company' | 'project'): Promise<string> {
70
+ async function fetchToken(app: string, scope: 'company' | 'project'): Promise<string> {
71
71
 
72
- StudioSDK.flushCache();
72
+ StudioSDK.flushCache();
73
73
 
74
- const sdk = getSdk();
75
- const response = await sdk.members.storage.token(app, scope);
76
- const data = response?.data;
74
+ const sdk = getSdk();
75
+ const response = await sdk.members.storage.token(app, scope);
76
+ const data = response?.data;
77
77
 
78
- if (data?.token) {
78
+ if (data?.token) {
79
79
 
80
- token.value = {
81
- token : data.token,
82
- expiresAt: data.expiresAt,
83
- createdAt: data.createdAt,
84
- expiresIn: data.expiresIn,
85
- app,
86
- scope,
87
- };
80
+ token.value = {
81
+ token: data.token,
82
+ expiresAt: data.expiresAt,
83
+ createdAt: data.createdAt,
84
+ expiresIn: data.expiresIn,
85
+ app,
86
+ scope,
87
+ };
88
88
 
89
- }
89
+ }
90
90
 
91
- return data?.token ?? '';
91
+ return data?.token ?? '';
92
92
 
93
- }
93
+ }
94
94
 
95
- function isTokenValid (app: string, scope: 'company' | 'project', bufferSeconds = 30): boolean {
95
+ function isTokenValid(app: string, scope: 'company' | 'project', bufferSeconds = 30): boolean {
96
96
 
97
- if (!token.value) return false;
98
- if (token.value.app !== app) return false;
99
- if (token.value.scope !== scope) return false;
97
+ if (!token.value) return false;
98
+ if (token.value.app !== app) return false;
99
+ if (token.value.scope !== scope) return false;
100
100
 
101
- const now = Date.now() / 1000;
101
+ const now = Date.now() / 1000;
102
102
 
103
- console.log(now + bufferSeconds, token.value.expiresAt, (now + bufferSeconds) < token.value.expiresAt);
103
+ console.log(now + bufferSeconds, token.value.expiresAt, (now + bufferSeconds) < token.value.expiresAt);
104
104
 
105
- return (now + bufferSeconds) < token.value.expiresAt;
105
+ return (now + bufferSeconds) < token.value.expiresAt;
106
106
 
107
- }
107
+ }
108
108
 
109
- async function listFiles (app: string, assetId?: string, model?: string): Promise<BackendMedia[]> {
109
+ async function listFiles(app: string, assetId?: string, model?: string): Promise<BackendMedia[]> {
110
110
 
111
- const options = assetId
112
- ? {assetId: [assetId]}
113
- : undefined;
114
- const sdk = getSdk();
115
- const response = model === 'customers'
116
- ? await sdk.members.storage.listCompany(app, 1, options)
117
- : await sdk.members.storage.listProject(app, 1, options);
118
- const payload = response?.data?.data as BackendMedia[] | undefined;
111
+ const options = assetId
112
+ ? {assetId: [assetId]}
113
+ : undefined;
114
+ const sdk = getSdk();
115
+ const response = model === 'customers'
116
+ ? await sdk.members.storage.listCompany(app, 1, options)
117
+ : await sdk.members.storage.listProject(app, 1, options);
118
+ const payload = response?.data?.data as BackendMedia[] | undefined;
119
119
 
120
- return Array.isArray(payload) ? payload : [];
120
+ return Array.isArray(payload) ? payload : [];
121
121
 
122
- }
122
+ }
123
123
 
124
- async function uploadOne (
125
- file: File,
126
- bucket: string,
127
- options: { list?: string, contentId?: string, moduleUuid?: string, structureInternalId?: string },
128
- onProgress?: UploadProgressCallback,
129
- ): Promise<UploadResult> {
130
-
131
- const sdk = getSdk();
132
- const uploadFile: UploadFile = {
133
- filename: file.name,
134
- size : file.size,
135
- mimetype: file.type || 'application/octet-stream',
136
- data : file,
137
- };
124
+ async function uploadOne(
125
+ file: File,
126
+ bucket: string,
127
+ options: { list?: string, contentId?: string, moduleUuid?: string, structureInternalId?: string },
128
+ onProgress?: UploadProgressCallback,
129
+ ): Promise<UploadResult> {
138
130
 
139
- return sdk.members.storage.upload(uploadFile, bucket, options, onProgress);
131
+ const sdk = getSdk();
132
+ const uploadFile: UploadFile = {
133
+ filename: file.name,
134
+ size: file.size,
135
+ mimetype: file.type || 'application/octet-stream',
136
+ data: file,
137
+ };
140
138
 
141
- }
139
+ return sdk.members.storage.upload(uploadFile, bucket, options, onProgress);
140
+
141
+ }
142
142
 
143
- async function deleteFile (app: string, id: string) {
143
+ async function deleteFile(app: string, id: string) {
144
144
 
145
- if (!id) return;
145
+ if (!id) return;
146
146
 
147
- const sdk = getSdk();
147
+ const sdk = getSdk();
148
148
 
149
- await sdk.members.storage.remove(app, id);
150
- StudioSDK.flushCache('storage', 'listProject');
151
- StudioSDK.flushCache('storage', 'listCompany');
149
+ await sdk.members.storage.remove(app, id);
150
+ StudioSDK.flushCache('storage', 'listProject');
151
+ StudioSDK.flushCache('storage', 'listCompany');
152
152
 
153
- }
153
+ }
154
154
 
155
- return {
156
- token,
157
- fetchToken,
158
- isTokenValid,
159
- listFiles,
160
- uploadOne,
161
- deleteFile,
162
- };
155
+ return {
156
+ token,
157
+ fetchToken,
158
+ isTokenValid,
159
+ listFiles,
160
+ uploadOne,
161
+ deleteFile,
162
+ };
163
163
 
164
164
  });
165
165