@live-change/user-frontend 0.8.62 → 0.8.64

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.
@@ -70,11 +70,6 @@
70
70
  import { useApi, live, usePath, useActions } from '@live-change/vue3-ssr'
71
71
  const api = useApi()
72
72
  const path = usePath()
73
- const messageAuthenticationClientConfig = api.getServiceDefinition('messageAuthentication')?.clientConfig
74
- const contactTypesAvailable = messageAuthenticationClientConfig?.contactTypes || []
75
-
76
- const userClientConfig = api.getServiceDefinition('user')?.clientConfig
77
- const accountTypesAvailable = userClientConfig?.remoteAccountTypes || []
78
73
 
79
74
  const messageAuthenticationApi = useActions().messageAuthentication
80
75
 
@@ -118,43 +113,10 @@
118
113
  })
119
114
  }
120
115
 
121
- const contactsTypes = contactTypesAvailable.map(contactType => {
122
- const contactTypeUpper = contactType[0].toUpperCase() + contactType.slice(1)
123
-
124
- let serviceName = contactType
125
- let viewName = 'myUser'+contactTypeUpper+'s'
126
- if(!path[serviceName]) { // find service by viewName
127
- for(const s in path) {
128
- if(path[s][viewName]) {
129
- serviceName = s
130
- break
131
- }
132
- }
133
- }
134
- //console.log('contactType', contactType, 'serviceName', serviceName, 'viewName', viewName)
135
- console.log(`path[${serviceName}][${viewName}] =`, path[serviceName][viewName])
136
- return {
137
- contactType,
138
- serviceName,
139
- viewName,
140
- path: path[serviceName][viewName]({}),
141
- contacts: null
142
- }
143
- })
116
+ import { getContactTypes, getAccountTypes} from './connected.js'
144
117
 
145
- const accountTypes = accountTypesAvailable.map(accountType => {
146
- let serviceName = accountType+'Authentication'
147
- let viewName = 'myUserAccounts'
148
- console.log('remoteAccountType', accountType, 'serviceName', serviceName, 'viewName', viewName)
149
- console.log(`path[${serviceName}][${viewName}] =`, path[serviceName][viewName])
150
- return {
151
- accountType,
152
- serviceName,
153
- viewName,
154
- path: path[serviceName][viewName]({}),
155
- accounts: null
156
- }
157
- })
118
+ const contactsTypes = getContactTypes()
119
+ const accountTypes = getAccountTypes()
158
120
 
159
121
  const contactPromises = contactsTypes.map(async contactType => {
160
122
  contactType.contacts = await live(contactType.path)
@@ -0,0 +1,89 @@
1
+ import { useApi, live } from '@live-change/vue3-ssr'
2
+ import { computed } from 'vue'
3
+
4
+ export function getContactTypes(api = useApi()) {
5
+ const path = api.fetch
6
+ const messageAuthenticationClientConfig = api.getServiceDefinition('messageAuthentication')?.clientConfig
7
+ const contactTypesAvailable = messageAuthenticationClientConfig?.contactTypes || []
8
+ const contactsTypes = contactTypesAvailable.map(contactType => {
9
+ const contactTypeUpper = contactType[0].toUpperCase() + contactType.slice(1)
10
+
11
+ let serviceName = contactType
12
+ let viewName = 'myUser'+contactTypeUpper+'s'
13
+ if(!path[serviceName]) { // find service by viewName
14
+ for(const s in path) {
15
+ if(path[s][viewName]) {
16
+ serviceName = s
17
+ break
18
+ }
19
+ }
20
+ }
21
+ //console.log('contactType', contactType, 'serviceName', serviceName, 'viewName', viewName)
22
+ console.log(`path[${serviceName}][${viewName}] =`, path[serviceName][viewName])
23
+ return {
24
+ contactType,
25
+ serviceName,
26
+ viewName,
27
+ path: path[serviceName][viewName]({}),
28
+ contacts: null,
29
+ async fetchContacts(context, onUnmountedCb){
30
+ const contacts = await live(path[serviceName][viewName]({}), context, onUnmountedCb)
31
+ this.contacts = contacts
32
+ return contacts
33
+ }
34
+ }
35
+ })
36
+ return contactsTypes
37
+
38
+ }
39
+
40
+ export function getAccountTypes(api = useApi()) {
41
+ const userClientConfig = api.getServiceDefinition('user')?.clientConfig
42
+ const accountTypesAvailable = userClientConfig?.remoteAccountTypes || []
43
+ const path = api.fetch
44
+ const accountTypes = accountTypesAvailable.map(accountType => {
45
+ let serviceName = accountType+'Authentication'
46
+ let viewName = 'myUserAccounts'
47
+ console.log('remoteAccountType', accountType, 'serviceName', serviceName, 'viewName', viewName)
48
+ console.log(`path[${serviceName}][${viewName}] =`, path[serviceName][viewName])
49
+ return {
50
+ accountType,
51
+ serviceName,
52
+ viewName,
53
+ path: path[serviceName][viewName]({}),
54
+ accounts: null,
55
+ async fetchAccounts(context, onUnmountedCb){
56
+ const accounts = await live(path[serviceName][viewName]({}), context, onUnmountedCb)
57
+ this.accounts = accounts
58
+ return accounts
59
+ }
60
+ }
61
+ })
62
+ return accountTypes
63
+ }
64
+
65
+ export async function getContacts(api = useApi()) {
66
+ const contactsTypes = getContactTypes(api)
67
+ for(const contactType of contactsTypes) {
68
+ await contactType.fetchContacts()
69
+ }
70
+ const contacts = computed(() => contactsTypes.map((c,i) => c.contacts.value.map(v => ({
71
+ contactType: c.contactType,
72
+ serviceName: c.serviceName,
73
+ ...(v)
74
+ }))).flat())
75
+ return contacts
76
+ }
77
+
78
+ export async function getAccounts(api = useApi()) {
79
+ const accountTypes = getAccountTypes(api)
80
+ for(const accountType of accountTypes) {
81
+ await accountType.fetchAccounts()
82
+ }
83
+ const accounts = computed(() => accountTypes.map((c,i) => c.accounts.value.map(v => ({
84
+ accountType: c.contactType,
85
+ serviceName: c.serviceName,
86
+ ...(v)
87
+ }))).flat())
88
+ return accounts
89
+ }
@@ -100,6 +100,9 @@
100
100
  }
101
101
 
102
102
  const name = computed(() => userData.value?.name
103
+ || (userData.value.firstName && userData.value.lastName
104
+ ? userData.value.firstName + ' ' + userData.value.lastName
105
+ : userData.value.firstName)
103
106
  || props.anonymous
104
107
  || uniqueNamesGenerator(nameGeneratorConfig))
105
108
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  </a>
16
16
  <div class="align-items-center flex-grow-1 justify-content-between hidden absolute w-full md:w-auto surface-overlay
17
- right-0 top-100 z-1 shadow-2">
17
+ right-0 top-100 z-5 shadow-2">
18
18
  <loading-zone suspense>
19
19
  <template v-slot:loading>
20
20
  <div class="flex align-items-center justify-content-center top-0 left-0 notifications-loading">
package/index.js CHANGED
@@ -17,4 +17,6 @@ export { Password }
17
17
  import GoogleAccess from './front/src/google-access/GoogleAccess.vue'
18
18
  export { GoogleAccess }
19
19
 
20
+ export * from './front/src/connected/connected.js'
21
+
20
22
  export * from "./front/src/router.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/user-frontend",
3
- "version": "0.8.62",
3
+ "version": "0.8.64",
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.8.62",
26
- "@live-change/dao": "^0.8.62",
27
- "@live-change/dao-vue3": "^0.8.62",
28
- "@live-change/dao-websocket": "^0.8.62",
29
- "@live-change/email-service": "^0.8.62",
30
- "@live-change/framework": "^0.8.62",
31
- "@live-change/identicon-service": "^0.8.62",
32
- "@live-change/image-frontend": "^0.8.62",
33
- "@live-change/message-authentication-service": "^0.8.62",
34
- "@live-change/notification-service": "^0.8.62",
35
- "@live-change/password-authentication-service": "^0.8.62",
36
- "@live-change/pattern": "^0.8.62",
37
- "@live-change/secret-code-service": "^0.8.62",
38
- "@live-change/secret-link-service": "^0.8.62",
39
- "@live-change/security-frontend": "^0.8.62",
40
- "@live-change/security-service": "^0.8.62",
41
- "@live-change/session-service": "^0.8.62",
42
- "@live-change/timer-service": "^0.8.62",
43
- "@live-change/upload-service": "^0.8.62",
44
- "@live-change/user-identification-service": "^0.8.62",
45
- "@live-change/user-service": "^0.8.62",
46
- "@live-change/vue3-components": "^0.8.62",
47
- "@live-change/vue3-ssr": "^0.8.62",
25
+ "@live-change/cli": "^0.8.64",
26
+ "@live-change/dao": "^0.8.64",
27
+ "@live-change/dao-vue3": "^0.8.64",
28
+ "@live-change/dao-websocket": "^0.8.64",
29
+ "@live-change/email-service": "^0.8.64",
30
+ "@live-change/framework": "^0.8.64",
31
+ "@live-change/identicon-service": "^0.8.64",
32
+ "@live-change/image-frontend": "^0.8.64",
33
+ "@live-change/message-authentication-service": "^0.8.64",
34
+ "@live-change/notification-service": "^0.8.64",
35
+ "@live-change/password-authentication-service": "^0.8.64",
36
+ "@live-change/pattern": "^0.8.64",
37
+ "@live-change/secret-code-service": "^0.8.64",
38
+ "@live-change/secret-link-service": "^0.8.64",
39
+ "@live-change/security-frontend": "^0.8.64",
40
+ "@live-change/security-service": "^0.8.64",
41
+ "@live-change/session-service": "^0.8.64",
42
+ "@live-change/timer-service": "^0.8.64",
43
+ "@live-change/upload-service": "^0.8.64",
44
+ "@live-change/user-identification-service": "^0.8.64",
45
+ "@live-change/user-service": "^0.8.64",
46
+ "@live-change/vue3-components": "^0.8.64",
47
+ "@live-change/vue3-ssr": "^0.8.64",
48
48
  "@vueuse/core": "^10.11.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.8.62",
68
+ "@live-change/codeceptjs-helper": "^0.8.64",
69
69
  "codeceptjs": "^3.6.5",
70
70
  "generate-password": "1.7.1",
71
71
  "playwright": "^1.41.2",
@@ -76,5 +76,5 @@
76
76
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
77
77
  "license": "BSD-3-Clause",
78
78
  "description": "",
79
- "gitHead": "063d94e3e0a751ada8568b5b1913744c8879ea0e"
79
+ "gitHead": "cf14b283170cd39b80a57865e9b5eb9cf2073f39"
80
80
  }