@live-change/user-frontend 0.9.180 → 0.9.182

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,21 +34,35 @@
34
34
  type: String,
35
35
  required: true
36
36
  },
37
+ countries: {
38
+ type: Array,
39
+ default: null
40
+ },
41
+ })
42
+
43
+ const availableCountries = computed(() => {
44
+ if (!props.countries || props.countries.length === 0) {
45
+ return countries
46
+ }
47
+ const allowedCodes = props.countries.map(code => code.toUpperCase())
48
+ return countries.filter((country) =>
49
+ allowedCodes.includes(country.code.toUpperCase())
50
+ )
37
51
  })
38
52
 
39
53
  const selectedCountry = ref()
40
54
  watch(value, (newValue) => {
41
55
  if(!newValue) return
42
- const found = countries.find((country) => newValue.startsWith(country.name))
56
+ const found = availableCountries.value.find((country) => newValue.startsWith(country.name))
43
57
  if(found) selectedCountry.value = found
44
58
  })
45
59
 
46
- const filteredCountries = ref(countries)
60
+ const filteredCountries = ref(availableCountries.value)
47
61
  function searchCountry(event) {
48
62
  if(!event) return
49
63
  const numbers = event.query.replace(/[^\d]/g, '')
50
64
  console.log("Search country", event.query, numbers, selectedCountry.value)
51
- filteredCountries.value = countries.filter((country) =>
65
+ filteredCountries.value = availableCountries.value.filter((country) =>
52
66
  country.name.toLowerCase().startsWith(event.query.toLowerCase())
53
67
  || country.code.toLowerCase().startsWith(event.query.toLowerCase())
54
68
  || (numbers.length > 0 && country.dial_code.replace(/[^\d]/g, '').startsWith(numbers))
@@ -67,9 +81,13 @@
67
81
  const myCountry = await live(geoIpPath)
68
82
 
69
83
  if(selectedCountry.value == null) {
70
- selectedCountry.value = countries.find(c => c.code.toLowerCase() === myCountry.value.toLowerCase())
84
+ selectedCountry.value = availableCountries.value.find(c => c.code.toLowerCase() === myCountry.value.toLowerCase())
71
85
  }
72
86
 
87
+ watch(() => props.countries, () => {
88
+ filteredCountries.value = availableCountries.value
89
+ }, { deep: true })
90
+
73
91
  </script>
74
92
 
75
93
 
package/index.js CHANGED
@@ -22,6 +22,9 @@ import PhoneInput from "./front/src/phone/PhoneInput.vue"
22
22
  import CountryInput from './front/src/phone/CountryInput.vue'
23
23
  export { PhoneInput, CountryInput }
24
24
 
25
+ import countries from "./front/src/utils/countries.js"
26
+ export { countries }
27
+
25
28
  import MessageSent from "./front/src/message-auth/MessageSent.vue"
26
29
  export { MessageSent }
27
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/user-frontend",
3
- "version": "0.9.180",
3
+ "version": "0.9.182",
4
4
  "scripts": {
5
5
  "memDev": "tsx --inspect --expose-gc server/start.js memDev --enableSessions --initScript ./init.js --dbAccess",
6
6
  "localDevInit": "tsx server/start.js localDev --enableSessions --initScript ./init.js --dbAccess",
@@ -36,29 +36,29 @@
36
36
  },
37
37
  "type": "module",
38
38
  "dependencies": {
39
- "@live-change/cli": "^0.9.180",
40
- "@live-change/dao": "^0.9.180",
41
- "@live-change/dao-vue3": "^0.9.180",
42
- "@live-change/dao-websocket": "^0.9.180",
43
- "@live-change/email-service": "^0.9.180",
44
- "@live-change/framework": "^0.9.180",
45
- "@live-change/identicon-service": "^0.9.180",
46
- "@live-change/image-frontend": "^0.9.180",
47
- "@live-change/message-authentication-service": "^0.9.180",
48
- "@live-change/notification-service": "^0.9.180",
49
- "@live-change/password-authentication-service": "^0.9.180",
50
- "@live-change/pattern": "^0.9.180",
51
- "@live-change/secret-code-service": "^0.9.180",
52
- "@live-change/secret-link-service": "^0.9.180",
53
- "@live-change/security-frontend": "^0.9.180",
54
- "@live-change/security-service": "^0.9.180",
55
- "@live-change/session-service": "^0.9.180",
56
- "@live-change/timer-service": "^0.9.180",
57
- "@live-change/upload-service": "^0.9.180",
58
- "@live-change/user-identification-service": "^0.9.180",
59
- "@live-change/user-service": "^0.9.180",
60
- "@live-change/vue3-components": "^0.9.180",
61
- "@live-change/vue3-ssr": "^0.9.180",
39
+ "@live-change/cli": "^0.9.182",
40
+ "@live-change/dao": "^0.9.182",
41
+ "@live-change/dao-vue3": "^0.9.182",
42
+ "@live-change/dao-websocket": "^0.9.182",
43
+ "@live-change/email-service": "^0.9.182",
44
+ "@live-change/framework": "^0.9.182",
45
+ "@live-change/identicon-service": "^0.9.182",
46
+ "@live-change/image-frontend": "^0.9.182",
47
+ "@live-change/message-authentication-service": "^0.9.182",
48
+ "@live-change/notification-service": "^0.9.182",
49
+ "@live-change/password-authentication-service": "^0.9.182",
50
+ "@live-change/pattern": "^0.9.182",
51
+ "@live-change/secret-code-service": "^0.9.182",
52
+ "@live-change/secret-link-service": "^0.9.182",
53
+ "@live-change/security-frontend": "^0.9.182",
54
+ "@live-change/security-service": "^0.9.182",
55
+ "@live-change/session-service": "^0.9.182",
56
+ "@live-change/timer-service": "^0.9.182",
57
+ "@live-change/upload-service": "^0.9.182",
58
+ "@live-change/user-identification-service": "^0.9.182",
59
+ "@live-change/user-service": "^0.9.182",
60
+ "@live-change/vue3-components": "^0.9.182",
61
+ "@live-change/vue3-ssr": "^0.9.182",
62
62
  "@vueuse/core": "^12.3.0",
63
63
  "codeceptjs-assert": "^0.0.5",
64
64
  "codeceptjs-video-helper": "0.1.3",
@@ -79,7 +79,7 @@
79
79
  "wtfnode": "^0.9.1"
80
80
  },
81
81
  "devDependencies": {
82
- "@live-change/codeceptjs-helper": "^0.9.180",
82
+ "@live-change/codeceptjs-helper": "^0.9.182",
83
83
  "codeceptjs": "^3.6.10",
84
84
  "generate-password": "1.7.1",
85
85
  "playwright": "1.49.1",
@@ -90,5 +90,5 @@
90
90
  "author": "Michał Łaszczewski <michal@laszczewski.pl>",
91
91
  "license": "BSD-3-Clause",
92
92
  "description": "",
93
- "gitHead": "c6ee30c8f36f989714e8fc7ec71daadb895b2b6e"
93
+ "gitHead": "e12068c10b76a5661032a3df85d7168f228192af"
94
94
  }