@lilaquadrat/design-core 0.1.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 (86) hide show
  1. package/README.md +236 -0
  2. package/html/index.html +25 -0
  3. package/html/index.mail.html +15 -0
  4. package/html/index.server.html +29 -0
  5. package/package.json +148 -0
  6. package/src/client-entry.ts +28 -0
  7. package/src/components/partials/action.partial.vue +30 -0
  8. package/src/components/partials/client-only.partial.vue +11 -0
  9. package/src/components/partials/error.partial.vue +73 -0
  10. package/src/components/partials/main-components.partial.vue +167 -0
  11. package/src/components/partials/mediadetection.partial.vue +71 -0
  12. package/src/components/partials/qrcode.partial.vue +35 -0
  13. package/src/customs.ts +12 -0
  14. package/src/env.d.ts +1 -0
  15. package/src/functions/PaymenyProviderFactory.ts +27 -0
  16. package/src/functions/lila-dom.ts +100 -0
  17. package/src/functions/shopify.provider.ts +378 -0
  18. package/src/functions/stripe.provider.ts +181 -0
  19. package/src/globals.d.ts +19 -0
  20. package/src/index.ts +47 -0
  21. package/src/interfaces/AppState.interface.ts +4 -0
  22. package/src/interfaces/EditorConfiguration.interface.ts +15 -0
  23. package/src/interfaces/EventDeclaration.interface.ts +19 -0
  24. package/src/interfaces/FrontendConfig.interface.ts +42 -0
  25. package/src/interfaces/GenericEvents.interface.ts +6 -0
  26. package/src/interfaces/GenericState.interface.ts +5 -0
  27. package/src/interfaces/IconsPartial.ts +9 -0
  28. package/src/interfaces/IdTokenExtended.interface.ts +7 -0
  29. package/src/interfaces/ModuleBaseProps.interface.ts +8 -0
  30. package/src/interfaces/PaymentProvider.interface.ts +13 -0
  31. package/src/libs/ActionNotice.ts +235 -0
  32. package/src/libs/Models.class.ts +482 -0
  33. package/src/main.ts +84 -0
  34. package/src/mixins/createCookieString.ts +78 -0
  35. package/src/mixins/createModelDeclaration.ts +29 -0
  36. package/src/mixins/createRouter.ts +30 -0
  37. package/src/mixins/date.ts +23 -0
  38. package/src/mixins/formatSize.ts +12 -0
  39. package/src/mixins/getAnchor.ts +14 -0
  40. package/src/mixins/getRoutes.ts +50 -0
  41. package/src/mixins/hasSlotContent.ts +32 -0
  42. package/src/mixins/hooks.ts +104 -0
  43. package/src/mixins/loadComponents.ts +107 -0
  44. package/src/mixins/logger.ts +32 -0
  45. package/src/mixins/replaceVariables.ts +19 -0
  46. package/src/mixins/scroll.ts +83 -0
  47. package/src/models/Address.model.ts +24 -0
  48. package/src/models/Contact.model.ts +22 -0
  49. package/src/models.ts +2 -0
  50. package/src/plugins/auth.ts +121 -0
  51. package/src/plugins/currency.ts +26 -0
  52. package/src/plugins/events.ts +156 -0
  53. package/src/plugins/filters.ts +43 -0
  54. package/src/plugins/inview.ts +351 -0
  55. package/src/plugins/replacer.ts +18 -0
  56. package/src/plugins/resize.ts +128 -0
  57. package/src/plugins/signupFlow.ts +89 -0
  58. package/src/plugins/traceable.ts +53 -0
  59. package/src/plugins/translations.ts +29 -0
  60. package/src/plugins/youtube.ts +80 -0
  61. package/src/routes.ts +132 -0
  62. package/src/server-entry.ts +113 -0
  63. package/src/stores/calls.store.ts +33 -0
  64. package/src/stores/cart.store.ts +186 -0
  65. package/src/stores/content.store.ts +83 -0
  66. package/src/stores/editor.store.ts +27 -0
  67. package/src/stores/files.store.ts +166 -0
  68. package/src/stores/main.store.ts +184 -0
  69. package/src/stores/user.store.ts +124 -0
  70. package/src/translations/de.ts +138 -0
  71. package/src/views/content.view.vue +219 -0
  72. package/src/views/download.view.vue +143 -0
  73. package/src/views/editor.view.vue +243 -0
  74. package/src/views/login.view.vue +82 -0
  75. package/src/views/signup-account.view.vue +64 -0
  76. package/tooling/cypress/config.ts +80 -0
  77. package/tooling/cypress/generate-manifest.js +5 -0
  78. package/tooling/cypress/manifest-utils.mjs +40 -0
  79. package/tooling/cypress/run-parallel.mjs +77 -0
  80. package/tooling/cypress/support/commands.ts +436 -0
  81. package/tooling/cypress/support/e2e.ts +17 -0
  82. package/tooling/eslint.config.js +223 -0
  83. package/tooling/preview.plugin.ts +134 -0
  84. package/tooling/ssr-test/index.mjs +391 -0
  85. package/tooling/stylelint.config.mjs +24 -0
  86. package/tooling/vite.ts +246 -0
@@ -0,0 +1,6 @@
1
+ import type { Ref } from 'vue';
2
+
3
+ export default interface GenericEvents {
4
+ // eslint-disable-next-line no-unused-vars
5
+ [key: string]: (additionalData: string | undefined, mouseEvent: MouseEvent, traceId: Ref) => void;
6
+ }
@@ -0,0 +1,5 @@
1
+ import type { ModuleGeneric } from '@lilaquadrat/interfaces';
2
+
3
+ export default interface GenericState {
4
+ [key: string]: {[key: string]: string | string[]} | number | boolean | string | string[] | ModuleGeneric[] | Date | any;
5
+ }
@@ -0,0 +1,9 @@
1
+ export default interface IconsPartial {
2
+ type: 'arrow-right' | 'arrow-left' | 'arrow-right-long' | 'chevron-down' | 'chevron-up' | 'chevron-left' | 'chevron-right'
3
+ | 'mouse' | 'checked' | 'close' | 'zoom-in' | 'zoom-out' | 'warning' | 'location' | 'play' | 'pause' | 'muted' | 'unmuted' | 'calendar' | 'cart'
4
+ | 'image' | 'document' | 'trash' | 'download' | 'replay'
5
+ colorScheme?: 'colorScheme1' | 'colorScheme2' | 'colorScheme4' |'white' | 'grey' | 'red' | 'bright' | 'dark' | 'textColor'
6
+ size?: 'small' | 'smaller' | 'medium' | 'large' | 'larger' | 'big' | 'xl'
7
+ rotate?: number
8
+ animate?: boolean
9
+ }
@@ -0,0 +1,7 @@
1
+ import type { IdToken } from '@auth0/auth0-spa-js';
2
+
3
+ export default interface IdTokenExtended extends IdToken {
4
+ lilaquadrat_configuration?: boolean
5
+ lilaquadrat_firstLogin?: boolean
6
+ }
7
+
@@ -0,0 +1,8 @@
1
+ export default interface ModuleBaseProps {
2
+ sub?: boolean
3
+ id?: string
4
+ parentId: string
5
+ uuid: string
6
+ variant?: string[]
7
+ index?: {title?: string, anchor?: string}
8
+ }
@@ -0,0 +1,13 @@
1
+ export default interface PaymentProvider {
2
+
3
+ getCart(attributes?: Record<string, string>): Promise<{id: string, checkourUrl?: string}>;
4
+ updateCartAttributes(cartId: string, attributes?: Record<string, string>): Promise<{id: string, checkourUrl?: string}>;
5
+ getCartWithProducts(cartId: string): Promise<any[]>;
6
+ getProduct(productId: string): Promise<any>;
7
+ addToCart(cartId: string, product: any, amount: number): Promise<any>;
8
+ removeFromCart(cartId: string, product: any): Promise<any>;
9
+ updateQuantity(cartId: string, cartProduct: any, amount: number): Promise<any>;
10
+ finalize(cartId: string): Promise<any>;
11
+ getFinishedCart(cartId: string): Promise<any>;
12
+
13
+ }
@@ -0,0 +1,235 @@
1
+ import { t } from '../plugins/translations';
2
+ import type { ErrorObject } from 'ajv';
3
+
4
+ export interface TranslatedPath {
5
+ path?: string,
6
+ values?: string[]|number[]
7
+ }
8
+
9
+ export interface ParsedError {
10
+ path: string
11
+ translatedPath: TranslatedPath
12
+ parentPath?: TranslatedPath
13
+ error: string
14
+ keyword: string
15
+ }
16
+
17
+ export interface ErrorsObject {
18
+ [key: string]: ParsedError
19
+ }
20
+
21
+ export default class ActionNotice {
22
+ error: any;
23
+
24
+ static parse (errors: ErrorObject[], translationPre: string | undefined, structureMappings: Record<string, string> | undefined): ErrorsObject {
25
+
26
+ const parsedErrors: ErrorsObject = {};
27
+
28
+ errors?.forEach((single) => {
29
+
30
+ ActionNotice.parseSingle(single, translationPre, parsedErrors, structureMappings);
31
+
32
+ });
33
+
34
+ return parsedErrors;
35
+
36
+ }
37
+
38
+ static parseSingle (error: ErrorObject, translationPre: string | undefined, errors: ErrorsObject, structureMappings: Record<string, string> | undefined) {
39
+
40
+ const pathArray = error.instancePath.split('/').filter((single) => single);
41
+ // check if the second element is a number, to determine if we are inside of a array
42
+ const arrayElementIndex = !Number.isNaN(pathArray[1]) ? +pathArray[1] + 1 : null;
43
+ const messageResponse = ActionNotice.getParsedError(error, pathArray[0], undefined, translationPre, structureMappings);
44
+ const path = messageResponse.path || pathArray[0];
45
+
46
+ /**
47
+ pathArray has a number as second element and a element after this number
48
+ only a numbers would mean that the array needs to have a valid element
49
+ ```JSON
50
+ {
51
+ instancePath: "/categories/0",
52
+ schemaPath: "#/properties/categories/items/required",
53
+ keyword: "required"
54
+ }
55
+ ```
56
+ */
57
+
58
+ if (arrayElementIndex) {
59
+
60
+ const arrayMessageResponse = ActionNotice.getParsedError(error, pathArray[0], pathArray[0], translationPre, structureMappings);
61
+ const useKey = `${pathArray[0]}-elements`;
62
+ const useIndex = (arrayElementIndex - 1).toString();
63
+ let useError = errors[useKey] as unknown as Record<string, Record<string, ParsedError>>;
64
+
65
+ if (!useError) useError = {} as Record<string, Record<string, ParsedError>>;
66
+
67
+ if (!useError[useIndex]) useError[useIndex] = {};
68
+
69
+ useError[useIndex][path] = arrayMessageResponse;
70
+
71
+ } else {
72
+
73
+ errors[path] = messageResponse;
74
+
75
+ }
76
+
77
+ }
78
+
79
+ static getParsedError (error: ErrorObject, usePath: string, basePath: string | undefined, translationPre: string | undefined, structureMappings: Record<string, string> | undefined): ParsedError {
80
+
81
+ let message: string = '';
82
+ let path = usePath;
83
+ let translatedPath: string = '';
84
+ const mappedErrorParams = ActionNotice.mapErrorParams(Object.values(error.params), structureMappings);
85
+
86
+ console.log('error', mappedErrorParams);
87
+
88
+ console.log('error', Object.values(error.params));
89
+
90
+ if (error.keyword === 'type') {
91
+
92
+ message = t(
93
+ `validation-error-type-${error.params.type}`,
94
+ );
95
+
96
+ }
97
+
98
+ if (error.keyword === 'minLength' || error.keyword === 'maxLength') {
99
+
100
+ message = t(
101
+ `validation-error-${error.keyword}`,
102
+ mappedErrorParams
103
+ );
104
+
105
+ }
106
+
107
+ if (error.keyword === 'maxItems' || error.keyword === 'minItems') {
108
+
109
+ message = t(
110
+ `validation-error-${error.keyword}`,
111
+ mappedErrorParams
112
+ );
113
+
114
+ }
115
+
116
+ if (error.keyword === 'contains') {
117
+
118
+ message = t(
119
+ `validation-error-${error.keyword}`,
120
+ mappedErrorParams
121
+ );
122
+
123
+ }
124
+
125
+ if (error.keyword === 'additionalProperties') {
126
+
127
+ message = t(
128
+ `validation-error-${error.keyword}`,
129
+ mappedErrorParams,
130
+ );
131
+
132
+ translatedPath = 'main';
133
+
134
+ }
135
+
136
+ if (error.keyword === 'required') {
137
+
138
+ message = t(
139
+ `validation-error-${error.keyword}`,
140
+ mappedErrorParams
141
+ );
142
+
143
+ translatedPath = '';
144
+ path = error.params.missingProperty;
145
+
146
+ }
147
+
148
+ if (error.keyword === 'enum') {
149
+
150
+ message = t(
151
+ `validation-error-${error.keyword}`,
152
+ [mappedErrorParams.join(',')],
153
+ );
154
+
155
+ }
156
+
157
+ if (error.keyword === 'invalidId') {
158
+
159
+ message = t(
160
+ `validation-error-${error.keyword}`,
161
+ [error.params.invalid],
162
+ );
163
+
164
+ translatedPath = '';
165
+ path = error.params.invalid;
166
+
167
+ }
168
+
169
+ if (error.keyword === 'DOCUMENT_ALREADY_EXISTS') {
170
+
171
+ message = t(
172
+ `validation-error-${error.keyword}`,
173
+ mappedErrorParams
174
+ );
175
+
176
+ translatedPath = 'main';
177
+ path = 'id';
178
+
179
+ }
180
+
181
+ if (!message) {
182
+
183
+ message = t(
184
+ `validation-error-${error.keyword}`,
185
+ );
186
+ translatedPath = 'main';
187
+
188
+ }
189
+
190
+ if (!translatedPath) {
191
+
192
+ const combinedPath = basePath ? `${basePath}-${path}` : path;
193
+
194
+ translatedPath = translationPre ? `${translationPre}-${combinedPath}` : combinedPath as string;
195
+
196
+ }
197
+
198
+ return {
199
+ error : message,
200
+ path,
201
+ translatedPath: { path: translatedPath, values: Object.values(error.params) },
202
+ keyword : error.keyword,
203
+ };
204
+
205
+ }
206
+
207
+ static reset () {
208
+
209
+ return {};
210
+
211
+ }
212
+
213
+ static mapErrorParams (keys: string[], mappings: Record<string, string> | undefined): string[] {
214
+
215
+ console.log('keys', keys, mappings);
216
+
217
+ if (!mappings) return keys;
218
+
219
+ const mappedKeys = keys.map((key) => {
220
+
221
+ if (mappings[key]) {
222
+
223
+ return mappings[key];
224
+
225
+ }
226
+
227
+ return key;
228
+
229
+ });
230
+
231
+ return mappedKeys;
232
+
233
+ }
234
+
235
+ }