@live-change/user-frontend 0.9.20 → 0.9.22

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.
@@ -34,17 +34,42 @@
34
34
 
35
35
  import pluralize from 'pluralize'
36
36
 
37
+ import { useApi } from "@live-change/vue3-ssr"
38
+ const api = useApi()
39
+
40
+ import { useToast } from 'primevue/usetoast'
41
+ const toast = useToast()
42
+ import { useConfirm } from 'primevue/useconfirm'
43
+ const confirm = useConfirm()
44
+
45
+ const userClientConfig = api.getServiceDefinition('user')?.clientConfig
46
+
37
47
  const afterSignIn = computed( () => isMounted.value && localStorage.redirectAfterSignIn )
38
48
  const redirectTime = ref()
39
49
  let timeout
40
50
  onMounted(() => {
41
- redirectTime.value = new Date(Date.now() + 10 * 1000)
42
- timeout = setTimeout(() => {
43
- if (afterSignIn.value) {
44
- localStorage.removeItem('redirectAfterSignIn')
45
- router.push(JSON.parse(afterSignIn.value))
51
+ if(localStorage.redirectAfterSignIn) {
52
+ const route = JSON.parse(localStorage.redirectAfterSignIn)
53
+ console.error("ROUTE!", route)
54
+ localStorage.removeItem('redirectAfterSignIn')
55
+ const delay = route?.meta?.afterSignInRedirectDelay ?? userClientConfig?.afterSignInRedirectDelay ?? 10
56
+ delete route.meta
57
+ if(delay) {
58
+ redirectTime.value = new Date(Date.now() + delay * 1000)
59
+ timeout = setTimeout(() => {
60
+ if(afterSignIn.value) {
61
+ router.push(route)
62
+ }
63
+ }, redirectTime.value - currentTime.value)
64
+ } else {
65
+ toast.add({
66
+ severity: 'info', life: 6000,
67
+ summary: 'Signed in',
68
+ detail: 'Congratulations! You have successfully logged in to your account.'
69
+ })
70
+ router.push(route)
46
71
  }
47
- }, redirectTime.value - currentTime.value)
72
+ }
48
73
  })
49
74
  onUnmounted(() => {
50
75
  clearTimeout(timeout)
@@ -105,6 +105,13 @@
105
105
 
106
106
  const masked = ref(true)
107
107
 
108
+ import { useToast } from 'primevue/usetoast'
109
+ const toast = useToast()
110
+ import { useConfirm } from 'primevue/useconfirm'
111
+ const confirm = useConfirm()
112
+
113
+ const userClientConfig = api.getServiceDefinition('user')?.clientConfig
114
+
108
115
  const [passwordExists, emails, phones] = await Promise.all([
109
116
  live(path().passwordAuthentication.myUserPasswordAuthenticationExists()),
110
117
  live(path().email?.myUserEmails()),
@@ -115,13 +122,27 @@
115
122
  const redirectTime = ref()
116
123
  let timeout
117
124
  onMounted(() => {
118
- redirectTime.value = new Date(Date.now() + 10 * 1000)
119
- timeout = setTimeout(() => {
120
- if (afterSignIn.value) {
121
- localStorage.removeItem('redirectAfterSignIn')
122
- router.push(JSON.parse(afterSignIn.value))
125
+ if(localStorage.redirectAfterSignIn) {
126
+ localStorage.removeItem('redirectAfterSignIn')
127
+ const route = JSON.parse(afterSignIn.value)
128
+ const delay = route?.meta?.afterSignInRedirectDelay ?? userClientConfig?.afterSignInRedirectDelay ?? 10
129
+ delete route.meta
130
+ if(delay) {
131
+ redirectTime.value = new Date(Date.now() + delay * 1000)
132
+ timeout = setTimeout(() => {
133
+ if(afterSignIn.value) {
134
+ router.push(route)
135
+ }
136
+ }, redirectTime.value - currentTime.value)
137
+ } else {
138
+ toast.add({
139
+ severity: 'info', life: 6000,
140
+ summary: 'Signed up',
141
+ detail: 'Congratulations! You have successfully created your account.'
142
+ })
143
+ router.push(route)
123
144
  }
124
- }, redirectTime.value - currentTime.value)
145
+ }
125
146
  })
126
147
  onUnmounted(() => {
127
148
  clearTimeout(timeout)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/user-frontend",
3
- "version": "0.9.20",
3
+ "version": "0.9.22",
4
4
  "scripts": {
5
5
  "memDev": "node --inspect --expose-gc server/start.js memDev --enableSessions --initScript ./init.js --dbAccess",
6
6
  "localDevInit": "rm tmp.db; node server/start.js localDev --enableSessions --initScript ./init.js",
@@ -22,29 +22,29 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/cli": "^0.9.20",
26
- "@live-change/dao": "^0.9.20",
27
- "@live-change/dao-vue3": "^0.9.20",
28
- "@live-change/dao-websocket": "^0.9.20",
29
- "@live-change/email-service": "^0.9.20",
30
- "@live-change/framework": "^0.9.20",
31
- "@live-change/identicon-service": "^0.9.20",
32
- "@live-change/image-frontend": "^0.9.20",
33
- "@live-change/message-authentication-service": "^0.9.20",
34
- "@live-change/notification-service": "^0.9.20",
35
- "@live-change/password-authentication-service": "^0.9.20",
36
- "@live-change/pattern": "^0.9.20",
37
- "@live-change/secret-code-service": "^0.9.20",
38
- "@live-change/secret-link-service": "^0.9.20",
39
- "@live-change/security-frontend": "^0.9.20",
40
- "@live-change/security-service": "^0.9.20",
41
- "@live-change/session-service": "^0.9.20",
42
- "@live-change/timer-service": "^0.9.20",
43
- "@live-change/upload-service": "^0.9.20",
44
- "@live-change/user-identification-service": "^0.9.20",
45
- "@live-change/user-service": "^0.9.20",
46
- "@live-change/vue3-components": "^0.9.20",
47
- "@live-change/vue3-ssr": "^0.9.20",
25
+ "@live-change/cli": "^0.9.22",
26
+ "@live-change/dao": "^0.9.22",
27
+ "@live-change/dao-vue3": "^0.9.22",
28
+ "@live-change/dao-websocket": "^0.9.22",
29
+ "@live-change/email-service": "^0.9.22",
30
+ "@live-change/framework": "^0.9.22",
31
+ "@live-change/identicon-service": "^0.9.22",
32
+ "@live-change/image-frontend": "^0.9.22",
33
+ "@live-change/message-authentication-service": "^0.9.22",
34
+ "@live-change/notification-service": "^0.9.22",
35
+ "@live-change/password-authentication-service": "^0.9.22",
36
+ "@live-change/pattern": "^0.9.22",
37
+ "@live-change/secret-code-service": "^0.9.22",
38
+ "@live-change/secret-link-service": "^0.9.22",
39
+ "@live-change/security-frontend": "^0.9.22",
40
+ "@live-change/security-service": "^0.9.22",
41
+ "@live-change/session-service": "^0.9.22",
42
+ "@live-change/timer-service": "^0.9.22",
43
+ "@live-change/upload-service": "^0.9.22",
44
+ "@live-change/user-identification-service": "^0.9.22",
45
+ "@live-change/user-service": "^0.9.22",
46
+ "@live-change/vue3-components": "^0.9.22",
47
+ "@live-change/vue3-ssr": "^0.9.22",
48
48
  "@vueuse/core": "^12.3.0",
49
49
  "codeceptjs-assert": "^0.0.5",
50
50
  "codeceptjs-video-helper": "0.1.3",
@@ -65,7 +65,7 @@
65
65
  "wtfnode": "^0.9.1"
66
66
  },
67
67
  "devDependencies": {
68
- "@live-change/codeceptjs-helper": "^0.9.20",
68
+ "@live-change/codeceptjs-helper": "^0.9.22",
69
69
  "codeceptjs": "^3.6.10",
70
70
  "generate-password": "1.7.1",
71
71
  "playwright": "1.49.1",
@@ -76,5 +76,5 @@
76
76
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
77
77
  "license": "BSD-3-Clause",
78
78
  "description": "",
79
- "gitHead": "6524c2dedbb137e95e9aa07eaf9503d68d7b9093"
79
+ "gitHead": "fd2681b5cefacd62d4a64b8276f0513b01f8a020"
80
80
  }