@icvdeveloper/common-module 0.0.23 → 0.0.25
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/dist/module.json +1 -4
- package/dist/module.mjs +1 -4
- package/dist/runtime/components/auth/LoginFullWidth.vue +2 -0
- package/dist/runtime/components/auth/PasswordReset.vue +60 -0
- package/dist/runtime/components/auth/Registration.vue +27 -0
- package/dist/runtime/components/forms/TextInput.vue +1 -1
- package/dist/runtime/composables/useLogin.mjs +5 -0
- package/dist/runtime/composables/useRegistration.d.ts +7 -0
- package/dist/runtime/composables/useRegistration.mjs +10 -0
- package/dist/runtime/store/auth.d.ts +1 -0
- package/dist/runtime/store/auth.mjs +13 -0
- package/dist/runtime/store/groups.d.ts +11 -0
- package/dist/runtime/store/groups.mjs +23 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -34,10 +34,7 @@ var PresentationType = /* @__PURE__ */ ((PresentationType2) => {
|
|
|
34
34
|
const module = defineNuxtModule({
|
|
35
35
|
meta: {
|
|
36
36
|
name: "v3plus-common-module",
|
|
37
|
-
configKey: "v3plusCommonModule"
|
|
38
|
-
compatibility: {
|
|
39
|
-
nuxt: "^3.0.0"
|
|
40
|
-
}
|
|
37
|
+
configKey: "v3plusCommonModule"
|
|
41
38
|
},
|
|
42
39
|
defaults: {
|
|
43
40
|
portalHash: null,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
+
import { toRefs } from "vue";
|
|
2
3
|
import { storeToRefs } from "pinia";
|
|
3
4
|
import { Conference } from "../../models/conference";
|
|
4
5
|
import { useLogin } from "../../composables/useLogin";
|
|
6
|
+
import { useTemplateConfigsStore } from "../../store";
|
|
5
7
|
|
|
6
8
|
interface Props {
|
|
7
9
|
conference?: Conference | null;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref, toRefs } from "vue";
|
|
3
|
+
import { useAuthStore } from "../../store/auth";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
isCentered?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
10
|
+
isCentered: false,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// data
|
|
14
|
+
const { isCentered } = toRefs(props);
|
|
15
|
+
const loading = ref<boolean>(false);
|
|
16
|
+
const email = ref<string>("");
|
|
17
|
+
const message = ref<null | string>(null);
|
|
18
|
+
const errors = ref<Array<any>>([]);
|
|
19
|
+
|
|
20
|
+
// methods
|
|
21
|
+
const { passwordReset } = useAuthStore();
|
|
22
|
+
const submitPasswordReset = () => {
|
|
23
|
+
loading.value = true;
|
|
24
|
+
message.value = null;
|
|
25
|
+
errors.value = [];
|
|
26
|
+
passwordReset(email.value)
|
|
27
|
+
.then((response) => {
|
|
28
|
+
message.value = response.data.message;
|
|
29
|
+
})
|
|
30
|
+
.catch((error) => {
|
|
31
|
+
if (error.response.status === 422) {
|
|
32
|
+
errors.value = error.response.data.errors;
|
|
33
|
+
} else {
|
|
34
|
+
errors.value = ["Error requesting password reset."];
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.finally(() => {
|
|
38
|
+
loading.value = false;
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<div :class="isCentered ? 'w-full max-w-xs mx-auto' : ''">
|
|
45
|
+
<div class="mb-4">Enter your email address to reset your password.</div>
|
|
46
|
+
<CommonMessage v-if="message" :success="true">
|
|
47
|
+
{{ message }}
|
|
48
|
+
</CommonMessage>
|
|
49
|
+
<CommonMessage v-if="errors.length > 0" :success="false">
|
|
50
|
+
{{ errors[0] }}
|
|
51
|
+
</CommonMessage>
|
|
52
|
+
<div @keyup.enter="submitPasswordReset()">
|
|
53
|
+
<CommonTextInput v-model="email" placeholder="Email" type="email" />
|
|
54
|
+
<button class="btn my-2" @click="submitPasswordReset()">
|
|
55
|
+
<span v-if="loading">Processing...</span>
|
|
56
|
+
<span v-else>Send Password Reset Link</span>
|
|
57
|
+
</button>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { storeToRefs } from "pinia";
|
|
3
|
+
import { useAuthStore } from "../../store/auth";
|
|
4
|
+
import { useRegistration } from "../../composables/useRegistration";
|
|
5
|
+
|
|
6
|
+
// data
|
|
7
|
+
const { isLoggedIn } = storeToRefs(useAuthStore());
|
|
8
|
+
|
|
9
|
+
// methods
|
|
10
|
+
const { isTownhallRegistration } = useRegistration();
|
|
11
|
+
const submitRegistration = () => {};
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div v-if="isLoggedIn">
|
|
16
|
+
<CommonMessage :success="false">Already logged in.</CommonMessage>
|
|
17
|
+
</div>
|
|
18
|
+
<div v-else class="px-2">
|
|
19
|
+
<div class="flex flex-1 flex-col text-center pt-8">
|
|
20
|
+
<h1 class="mb-3 heading-color-3">Log In</h1>
|
|
21
|
+
|
|
22
|
+
<div class="w-full max-w-xs mx-auto pb-12">
|
|
23
|
+
<form class="w-full" @submit.prevent="submitRegistration"></form>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { storeToRefs } from "pinia";
|
|
2
2
|
import { defineEmits } from "vue";
|
|
3
|
+
import {
|
|
4
|
+
useConferencesStore,
|
|
5
|
+
useAuthStore,
|
|
6
|
+
useTemplateConfigsStore
|
|
7
|
+
} from "../store";
|
|
3
8
|
import { useConferenceHelpers } from "./useConferenceHelpers.mjs";
|
|
4
9
|
export const useLogin = (conference) => {
|
|
5
10
|
const { login } = useAuthStore();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useTemplateConfigsStore } from "../store/index.mjs";
|
|
2
|
+
export const useRegistration = () => {
|
|
3
|
+
const { globalConfigValue } = useTemplateConfigsStore();
|
|
4
|
+
const isTownhallRegistration = () => {
|
|
5
|
+
return globalConfigValue("townhall_registration_enabled");
|
|
6
|
+
};
|
|
7
|
+
return {
|
|
8
|
+
isTownhallRegistration
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -61,6 +61,19 @@ export const useAuthStore = defineStore("auth", {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
+
},
|
|
65
|
+
passwordReset(email) {
|
|
66
|
+
return new Promise((resolve, reject) => {
|
|
67
|
+
const request = useApi();
|
|
68
|
+
request("portal-send-password-reset", {
|
|
69
|
+
method: "POST",
|
|
70
|
+
body: { email }
|
|
71
|
+
}).then((response) => {
|
|
72
|
+
resolve(response);
|
|
73
|
+
}).catch((error) => {
|
|
74
|
+
reject(error);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
64
77
|
}
|
|
65
78
|
}
|
|
66
79
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Group } from "../models/group";
|
|
2
|
+
export interface GroupsState {
|
|
3
|
+
groups: {
|
|
4
|
+
[conferenceId: number]: Group[];
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export declare const useGroupsStore: import("pinia").StoreDefinition<"groups", GroupsState, {
|
|
8
|
+
getGroupsByConference(state: GroupsState): (conferenceId: number) => Group[];
|
|
9
|
+
}, {
|
|
10
|
+
setGroups(conferenceId: number, groups: Group[]): void;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
export const useGroupsStore = defineStore("groups", {
|
|
3
|
+
state: () => ({
|
|
4
|
+
groups: []
|
|
5
|
+
}),
|
|
6
|
+
getters: {
|
|
7
|
+
getGroupsByConference(state) {
|
|
8
|
+
return (conferenceId) => {
|
|
9
|
+
if (conferenceId in state.groups) {
|
|
10
|
+
return state.groups[conferenceId];
|
|
11
|
+
} else {
|
|
12
|
+
console.warn("Could not find groups");
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
actions: {
|
|
19
|
+
setGroups(conferenceId, groups) {
|
|
20
|
+
this.groups[conferenceId] = groups;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|