@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.
- package/README.md +71 -3
- package/html/index.server.html +1 -8
- package/package.json +53 -53
- package/src/client-entry.ts +8 -8
- package/src/components/partials/error.partial.vue +19 -19
- package/src/components/partials/main-components.partial.vue +75 -70
- package/src/components/partials/qrcode.partial.vue +8 -8
- package/src/functions/AuthProviderFactory.ts +30 -0
- package/src/functions/PaymenyProviderFactory.ts +11 -11
- package/src/functions/auth0.provider.ts +75 -0
- package/src/functions/keycloak.provider.ts +228 -0
- package/src/functions/lila-dom.ts +50 -50
- package/src/functions/shopify.provider.ts +176 -154
- package/src/functions/stripe.provider.ts +120 -108
- package/src/globals.d.ts +1 -2
- package/src/index.ts +9 -7
- package/src/interfaces/AuthCallbackResult.interface.ts +5 -0
- package/src/interfaces/AuthConfig.interface.ts +13 -0
- package/src/interfaces/AuthProvider.interface.ts +15 -0
- package/src/interfaces/FrontendConfig.interface.ts +11 -40
- package/src/interfaces/GenericEvents.interface.ts +1 -1
- package/src/interfaces/IdTokenExtended.interface.ts +13 -4
- package/src/interfaces/PaymentProvider.interface.ts +2 -2
- package/src/interfaces/RenderOptions.interface.ts +12 -0
- package/src/libs/ActionNotice.ts +125 -125
- package/src/libs/Models.class.ts +219 -221
- package/src/main.ts +41 -36
- package/src/mixins/createCookieString.ts +50 -36
- package/src/mixins/createModelDeclaration.ts +22 -19
- package/src/mixins/createRouter.ts +12 -12
- package/src/mixins/date.ts +4 -2
- package/src/mixins/formatSize.ts +5 -5
- package/src/mixins/getAnchor.ts +1 -1
- package/src/mixins/getRoutes.ts +13 -25
- package/src/mixins/hasSlotContent.ts +22 -16
- package/src/mixins/hooks.ts +101 -60
- package/src/mixins/loadComponents.ts +60 -58
- package/src/mixins/logger.ts +17 -13
- package/src/mixins/replaceVariables.ts +10 -8
- package/src/mixins/scroll.ts +61 -45
- package/src/models/Address.model.ts +7 -7
- package/src/models/Contact.model.ts +14 -14
- package/src/plugins/analytics.ts +198 -0
- package/src/plugins/auth.ts +74 -60
- package/src/plugins/currency.ts +10 -10
- package/src/plugins/events.ts +101 -97
- package/src/plugins/filters.ts +21 -18
- package/src/plugins/replacer.ts +7 -6
- package/src/plugins/signupFlow.ts +45 -43
- package/src/plugins/traceable.ts +28 -26
- package/src/plugins/translations.ts +9 -9
- package/src/plugins/youtube.ts +39 -34
- package/src/routes.ts +108 -108
- package/src/server-entry.ts +75 -77
- package/src/stores/calls.store.ts +14 -14
- package/src/stores/cart.store.ts +116 -107
- package/src/stores/content.store.ts +87 -45
- package/src/stores/editor.store.ts +16 -16
- package/src/stores/files.store.ts +72 -72
- package/src/stores/main.store.ts +155 -109
- package/src/stores/user.store.ts +72 -68
- package/src/translations/de.ts +127 -127
- package/src/views/content.view.vue +81 -143
- package/src/views/download.view.vue +25 -23
- package/src/views/editor.view.vue +150 -125
- package/src/views/login.view.vue +35 -36
- package/src/views/signup-account.view.vue +14 -14
- package/tooling/cypress/config.ts +68 -54
- package/tooling/cypress/manifest-utils.mjs +34 -22
- package/tooling/cypress/run-parallel.mjs +41 -35
- package/tooling/cypress/support/commands.ts +458 -300
- package/tooling/eslint.config.js +1 -223
- package/tooling/preview.plugin.js +68 -68
- package/tooling/ssr-test/index.mjs +205 -203
- package/tooling/vite.d.ts +0 -6
- package/tooling/vite.js +170 -162
- package/src/interfaces/EditorConfiguration.interface.ts +0 -15
- package/tooling/stylelint.config.mjs +0 -24
package/src/plugins/auth.ts
CHANGED
|
@@ -1,121 +1,135 @@
|
|
|
1
|
-
import
|
|
1
|
+
import AuthProviderFactory from '../functions/AuthProviderFactory';
|
|
2
|
+
import type AuthConfig from '../interfaces/AuthConfig.interface';
|
|
3
|
+
import type AuthProvider from '../interfaces/AuthProvider.interface';
|
|
2
4
|
import type IdTokenExtended from '../interfaces/IdTokenExtended.interface';
|
|
3
5
|
import logger from '../mixins/logger';
|
|
4
|
-
import {
|
|
6
|
+
import type { Auth0ClientOptions } from '@auth0/auth0-spa-js';
|
|
5
7
|
import { ref } from 'vue';
|
|
6
8
|
|
|
7
9
|
class Auth {
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
private provider?: AuthProvider;
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
options: { dev: boolean } = { dev: false };
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
isAuth = ref<boolean>(false);
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
token = ref<string>();
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
async init(config: AuthConfig | Auth0ClientOptions, options?: { dev: boolean }) {
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
logger.auth('init')
|
|
22
|
+
this.provider = undefined;
|
|
23
|
+
this.isAuth.value = false;
|
|
24
|
+
this.token.value = undefined;
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
const configuration: AuthConfig = 'type' in config ? config : { type: 'auth0', options: config };
|
|
27
|
+
this.provider = await AuthProviderFactory(configuration);
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
if (options) this.options = options;
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
try {
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
await this.provider.init();
|
|
34
|
+
await this.updateAuthStatus();
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
} catch (error) {
|
|
31
37
|
|
|
32
|
-
|
|
38
|
+
console.error(error);
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
}
|
|
35
41
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
try {
|
|
42
|
+
try {
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
if (this.isAuth.value && !this.token.value) await this.getToken();
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
} catch (error) {
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
console.error(error);
|
|
47
49
|
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
logger.auth('init done')
|
|
53
|
+
|
|
48
54
|
}
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
}
|
|
56
|
+
async updateAuthStatus() {
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
this.isAuth.value = await this.getProvider().isAuthenticated();
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
}
|
|
56
61
|
|
|
57
|
-
|
|
62
|
+
async getToken() {
|
|
58
63
|
|
|
59
|
-
|
|
64
|
+
this.token.value = await this.getProvider().getToken();
|
|
60
65
|
|
|
61
|
-
|
|
66
|
+
}
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
async refreshToken() {
|
|
64
69
|
|
|
65
|
-
|
|
70
|
+
this.token.value = await this.getProvider().refreshToken();
|
|
66
71
|
|
|
67
|
-
|
|
72
|
+
}
|
|
68
73
|
|
|
69
|
-
|
|
74
|
+
getTokenContent(): Promise<IdTokenExtended | undefined> {
|
|
70
75
|
|
|
71
|
-
|
|
76
|
+
return this.getProvider().getTokenContent();
|
|
72
77
|
|
|
73
|
-
|
|
78
|
+
}
|
|
74
79
|
|
|
75
|
-
|
|
80
|
+
triggerLogin(customerId?: string, emailConfirmationCode?: string) {
|
|
76
81
|
|
|
77
|
-
|
|
82
|
+
return this.getProvider().triggerLogin({ customerId, emailConfirmationCode });
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
}
|
|
80
85
|
|
|
81
|
-
|
|
86
|
+
triggerSignup(customerId?: string, emailConfirmationCode?: string) {
|
|
82
87
|
|
|
83
|
-
|
|
88
|
+
return this.getProvider().triggerSignup({ customerId, emailConfirmationCode });
|
|
84
89
|
|
|
85
|
-
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
triggerLogout() {
|
|
86
93
|
|
|
87
|
-
|
|
94
|
+
localStorage.removeItem('lila-customer');
|
|
95
|
+
this.isAuth.value = false;
|
|
96
|
+
this.token.value = undefined;
|
|
97
|
+
return this.getProvider().triggerLogout();
|
|
98
|
+
|
|
99
|
+
}
|
|
88
100
|
|
|
89
|
-
|
|
101
|
+
async handleCallback() {
|
|
90
102
|
|
|
91
|
-
|
|
92
|
-
localStorage.removeItem('lila-customer');
|
|
103
|
+
const result = await this.getProvider().handleCallback();
|
|
93
104
|
|
|
94
|
-
|
|
105
|
+
await this.updateAuthStatus();
|
|
106
|
+
await this.getToken();
|
|
95
107
|
|
|
96
|
-
|
|
108
|
+
return result;
|
|
97
109
|
|
|
98
|
-
|
|
110
|
+
}
|
|
99
111
|
|
|
100
|
-
|
|
101
|
-
await this.getToken();
|
|
112
|
+
private getProvider(): AuthProvider {
|
|
102
113
|
|
|
103
|
-
|
|
114
|
+
if (!this.provider) throw new Error('AUTH_NOT_INITIALIZED');
|
|
115
|
+
return this.provider;
|
|
104
116
|
|
|
105
|
-
|
|
117
|
+
}
|
|
106
118
|
|
|
107
119
|
}
|
|
108
120
|
|
|
109
121
|
const auth = new Auth;
|
|
110
122
|
const plugin = {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
123
|
+
install: (): void => {
|
|
124
|
+
|
|
125
|
+
logger.plugins('auth installed')
|
|
126
|
+
|
|
127
|
+
},
|
|
114
128
|
};
|
|
115
129
|
const useAuth = () => ({ authToken: auth.token.value })
|
|
116
130
|
|
|
117
131
|
export default plugin;
|
|
118
132
|
export {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
133
|
+
auth,
|
|
134
|
+
useAuth
|
|
135
|
+
}
|
package/src/plugins/currency.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import logger from '../mixins/logger';
|
|
2
2
|
import type { App } from 'vue';
|
|
3
3
|
|
|
4
|
-
function formatCurrency
|
|
4
|
+
function formatCurrency(amount: number) {
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
return new Intl.NumberFormat(navigator?.language || 'en-US', {
|
|
7
|
+
style: 'currency',
|
|
8
|
+
currency: 'EUR',
|
|
9
|
+
}).format(amount);
|
|
10
10
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const plugin = {
|
|
14
|
-
|
|
14
|
+
install: (vue: App): void => {
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
vue.config.globalProperties.$currency = (amount: number) => formatCurrency(amount);
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
logger.plugins('currency installed');
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
},
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export default plugin;
|
|
24
24
|
export {
|
|
25
|
-
|
|
25
|
+
formatCurrency
|
|
26
26
|
}
|
package/src/plugins/events.ts
CHANGED
|
@@ -10,147 +10,151 @@ import logger from '../mixins/logger';
|
|
|
10
10
|
import type { Ref } from 'vue';
|
|
11
11
|
|
|
12
12
|
const eventDeclarations: EventDeclaration[] = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
{
|
|
14
|
+
id: 'login',
|
|
15
|
+
name: 'Anmelden',
|
|
16
|
+
description: 'löst den Login für Benutzer aus',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
id: 'logout',
|
|
20
|
+
name: 'Abmelden',
|
|
21
|
+
description: 'löst den Logout für Benutzer aus',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'register',
|
|
25
|
+
name: 'Registrieren',
|
|
26
|
+
description: 'erstellt ein neues Benutzerkonto',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 'resendConfirmationMail',
|
|
30
|
+
name: 'Bestätigungscode erneut senden',
|
|
31
|
+
description: 'Eingeloggte Nutzer',
|
|
32
|
+
confirmRequired: true,
|
|
33
|
+
operation: true,
|
|
34
|
+
feedback: {
|
|
35
|
+
resolved: 'Bestätigungscode wurde versendet',
|
|
36
|
+
rejected: 'Bestätigungscode konnte nicht gesendet werden',
|
|
37
|
+
pending: 'Bestätigungscode wird versendet'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'refresh_token',
|
|
42
|
+
name: 'Anmeldung aktualisieren',
|
|
43
|
+
description: 'aktualisiert das Authentifizierungstoken für den Benutzer',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'addToCart',
|
|
47
|
+
name: 'In den Warenkorb legen',
|
|
48
|
+
description: 'fügt das angegebene Produkt dem Warenkorb hinzu',
|
|
49
|
+
additionalData: {
|
|
50
|
+
name: 'shopifyid',
|
|
51
|
+
description: 'die Produkt-ID'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'scrollToNextModule',
|
|
56
|
+
name: 'Scroll zum nächstes Module',
|
|
57
|
+
description: 'Scrollt zum nächsten Module',
|
|
38
58
|
}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id : 'refresh_token',
|
|
42
|
-
name : 'Anmeldung aktualisieren',
|
|
43
|
-
description: 'aktualisiert das Authentifizierungstoken für den Benutzer',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
id : 'addToCart',
|
|
47
|
-
name : 'In den Warenkorb legen',
|
|
48
|
-
description : 'fügt das angegebene Produkt dem Warenkorb hinzu',
|
|
49
|
-
additionalData: {
|
|
50
|
-
name : 'shopifyid',
|
|
51
|
-
description: 'die Produkt-ID'
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id : 'scrollToNextModule',
|
|
56
|
-
name : 'Scroll zum nächstes Module',
|
|
57
|
-
description: 'Scrollt zum nächsten Module',
|
|
58
|
-
}
|
|
59
59
|
];
|
|
60
60
|
const events: GenericEvents = {
|
|
61
|
-
|
|
61
|
+
login: () => {
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
const userStore = useUserStore();
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
auth.triggerLogin(userStore.customer?._id, userStore.emailConfirmationCode);
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
},
|
|
68
|
+
logout: () => {
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
auth.triggerLogout();
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
},
|
|
73
|
+
register: () => {
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
const userStore = useUserStore();
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
auth.triggerSignup(userStore.customer?._id, userStore.emailConfirmationCode);
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
},
|
|
80
|
+
addToCart: (product?: string) => {
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
console.log('add to cart', product);
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
console.warn('ADD_TO_CART_FAILED_PRODUCT_ID_MISSING');
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
84
|
+
if (!product) {
|
|
88
85
|
|
|
89
|
-
|
|
86
|
+
console.warn('ADD_TO_CART_FAILED_PRODUCT_ID_MISSING');
|
|
87
|
+
return;
|
|
88
|
+
|
|
89
|
+
}
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
const cartStore = useCartStore();
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
refresh_token: () => {
|
|
93
|
+
cartStore.addProduct(product as string);
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
},
|
|
96
|
+
refresh_token: () => {
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
scrollToNextModule: (additionalData: string | undefined, mouseEvent: MouseEvent) => {
|
|
98
|
+
auth.triggerLogin()
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const nextSibling = parentModule?.nextElementSibling;
|
|
100
|
+
},
|
|
101
|
+
scrollToNextModule: (additionalData: string | undefined, mouseEvent: MouseEvent) => {
|
|
104
102
|
|
|
105
|
-
|
|
103
|
+
const target = mouseEvent.target as HTMLElement;
|
|
104
|
+
const parentModule = target?.closest('.lila-module');
|
|
105
|
+
const nextSibling = parentModule?.nextElementSibling;
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
console.log('scroll to next module');
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
behavior: 'smooth',
|
|
111
|
-
block : 'center'
|
|
112
|
-
});
|
|
109
|
+
if (nextSibling) {
|
|
113
110
|
|
|
114
|
-
|
|
111
|
+
nextSibling.scrollIntoView({
|
|
112
|
+
behavior: 'smooth',
|
|
113
|
+
block: 'center'
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
}
|
|
115
117
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
},
|
|
119
|
+
resendConfirmationMail: async (additionalData: string | undefined, mouseEvent: MouseEvent, traceId: Ref<string | undefined>) => {
|
|
118
120
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
const { apiConfig } = useMainStore();
|
|
122
|
+
const { traceable } = useTraceable();
|
|
123
|
+
const sdk = new StudioSDK(apiConfig)
|
|
122
124
|
|
|
123
|
-
|
|
125
|
+
return traceable(sdk.members.me.resendConfirmationMail(), traceId);
|
|
124
126
|
|
|
125
|
-
|
|
127
|
+
}
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
/**
|
|
129
131
|
* triggers a predefined event
|
|
130
132
|
*/
|
|
131
|
-
function triggerEvent
|
|
133
|
+
function triggerEvent(type: keyof typeof events | string, additionalData: string | undefined, mouseEvent: MouseEvent, traceId: Ref<string | undefined>) {
|
|
132
134
|
|
|
133
|
-
|
|
135
|
+
const event = events[type as keyof typeof events];
|
|
134
136
|
|
|
135
|
-
|
|
137
|
+
if (!event) {
|
|
136
138
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
console.error('EVENT_MISSING', type, event);
|
|
140
|
+
throw new Error('EVENT_MISSING');
|
|
139
141
|
|
|
140
|
-
|
|
142
|
+
}
|
|
141
143
|
|
|
142
|
-
|
|
144
|
+
return event(additionalData, mouseEvent, traceId);
|
|
143
145
|
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
const useEvents = () => ({ triggerEvent, eventDeclarations, events })
|
|
147
149
|
const plugin = {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
install: () => {
|
|
151
|
+
|
|
152
|
+
logger.plugins('events installed');
|
|
153
|
+
|
|
154
|
+
},
|
|
151
155
|
};
|
|
152
156
|
|
|
153
157
|
export default plugin;
|
|
154
158
|
export {
|
|
155
|
-
|
|
159
|
+
useEvents
|
|
156
160
|
}
|
package/src/plugins/filters.ts
CHANGED
|
@@ -4,40 +4,43 @@ import type { App } from 'vue';
|
|
|
4
4
|
|
|
5
5
|
const HelpersPlugin = {
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
return value.toString().padStart(minLength, '0');
|
|
9
|
-
},
|
|
7
|
+
leadingZero(value: string | number, minLength: number) {
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
return value.toString().padStart(minLength, '0');
|
|
10
|
+
|
|
11
|
+
},
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
getFilename(contentType: 'public' | 'members', path?: string) {
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const contentIdArray = [];
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
if(!path || path === '/') return 'home';
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
if(contentType === 'members' && path !== '/m' && !path.startsWith('/m/')) contentIdArray.push('m');
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
contentIdArray.push(...path.split('/'));
|
|
22
|
+
|
|
23
|
+
return contentIdArray.filter((single) => single.length).join('/');
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
},
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
date(date: string | Date, format?: string) {
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
return useDate(date).locale('de').format(format || 'DD.MM.YYYY HH:mm');
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
}
|
|
30
32
|
|
|
31
33
|
}
|
|
32
34
|
const plugin = {
|
|
33
|
-
|
|
35
|
+
install: (vue: App): void => {
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
vue.config.globalProperties.$helpers = HelpersPlugin;
|
|
38
|
+
logger.plugins('helpers installed')
|
|
39
|
+
|
|
40
|
+
},
|
|
38
41
|
};
|
|
39
42
|
|
|
40
43
|
export default plugin;
|
|
41
44
|
export {
|
|
42
|
-
|
|
45
|
+
HelpersPlugin
|
|
43
46
|
};
|
package/src/plugins/replacer.ts
CHANGED
|
@@ -5,14 +5,15 @@ import useUserStore from '../stores/user.store';
|
|
|
5
5
|
import type { App } from 'vue';
|
|
6
6
|
|
|
7
7
|
const plugin = {
|
|
8
|
-
|
|
8
|
+
install: (vue: App): void => {
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const contentStore = useContentStore();
|
|
11
|
+
const userStore = useUserStore();
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
vue.config.globalProperties.$replacer = (content: string) => replaceVariables(content, {...contentStore.context, recipient: contentStore.recipient, list: contentStore.list, cart: contentStore.cart, user: userStore.userData });
|
|
14
|
+
logger.plugins('replacer installed')
|
|
15
|
+
|
|
16
|
+
},
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export default plugin;
|