@descope/flow-components 3.1.3 → 3.1.5

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.
@@ -5,7 +5,7 @@
5
5
  "name": "flowComponents",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "3.1.3",
8
+ "buildVersion": "3.1.5",
9
9
  "buildName": "@descope/flow-components"
10
10
  },
11
11
  "remoteEntry": {
@@ -5,7 +5,7 @@
5
5
  "name": "flowComponents",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "3.1.3",
8
+ "buildVersion": "3.1.5",
9
9
  "buildName": "@descope/flow-components"
10
10
  },
11
11
  "remoteEntry": {
package/dist/index.cjs.js CHANGED
@@ -88530,10 +88530,14 @@ function requireIndex_cjs () {
88530
88530
  return `<div data-id="${escapedStateCode}" data-name="${escapedSearchTerms}" data-label="${escapedLabel}">${escapedLabel}</div>`;
88531
88531
  };
88532
88532
 
88533
- const cityItem = ({ name }) => {
88533
+ const cityItem = ({ name, translations, lang }) => {
88534
+ const displayName = resolveTranslation({ name, translations }, lang);
88535
+ const searchTerms = [displayName];
88536
+ if (displayName !== name) searchTerms.push(name);
88534
88537
  const escapedId = escapeHtml(name);
88535
- const escapedName = escapeHtml(name);
88536
- return `<div data-id="${escapedId}" data-name="${escapedName}">${escapedName}</div>`;
88538
+ const escapedSearchTerms = escapeHtml(searchTerms.join(' '));
88539
+ const escapedLabel = escapeHtml(displayName);
88540
+ return `<div data-id="${escapedId}" data-name="${escapedSearchTerms}" data-label="${escapedLabel}">${escapedLabel}</div>`;
88537
88541
  };
88538
88542
 
88539
88543
  const comboBoxHTML = (id) =>
@@ -88593,6 +88597,7 @@ function requireIndex_cjs () {
88593
88597
  #countriesMap = new Map();
88594
88598
  #cachedCountries = null;
88595
88599
  #cachedSubdivisions = null;
88600
+ #cachedCities = null;
88596
88601
  #labels = null;
88597
88602
 
88598
88603
  // Value requested programmatically before data has loaded.
@@ -88639,8 +88644,8 @@ function requireIndex_cjs () {
88639
88644
  const lang = this.getAttribute('lang') || undefined;
88640
88645
  if (!lang) return undefined;
88641
88646
  try {
88642
- Intl.getCanonicalLocales(lang);
88643
- return lang;
88647
+ const [canonical] = Intl.getCanonicalLocales(lang);
88648
+ return canonical;
88644
88649
  } catch {
88645
88650
  return undefined; // invalid BCP47 tag — fall back to English
88646
88651
  }
@@ -88823,8 +88828,11 @@ function requireIndex_cjs () {
88823
88828
 
88824
88829
  #setupValueTransform() {
88825
88830
  // Display only the item name in the input, while data-name includes ISO codes for search
88826
- [this.#countryComboBox, this.#subdivisionComboBox].forEach((combo) => {
88827
-
88831
+ [
88832
+ this.#countryComboBox,
88833
+ this.#subdivisionComboBox,
88834
+ this.#cityComboBox,
88835
+ ].forEach((combo) => {
88828
88836
  combo.customValueTransformFn = (val) => {
88829
88837
  const item = combo.baseElement?.items?.find(
88830
88838
  (i) => i['data-name'] === val,
@@ -88969,7 +88977,11 @@ function requireIndex_cjs () {
88969
88977
  if (cities) {
88970
88978
  this.#cityVisible = cities.length > 0;
88971
88979
  if (cities.length > 0) {
88972
- this.#cityComboBox.data = cities;
88980
+ this.#cachedCities = cities;
88981
+ this.#cityComboBox.data = cities.map((c) => ({
88982
+ ...c,
88983
+ lang: this.#lang,
88984
+ }));
88973
88985
  if (pendingCity) toSelect.push([this.#cityComboBox, pendingCity]);
88974
88986
  }
88975
88987
  }
@@ -89080,7 +89092,6 @@ function requireIndex_cjs () {
89080
89092
  if (!this.#pendingValue && this.#defaultCountry)
89081
89093
  this.#onCountrySelected(this.#defaultCountry);
89082
89094
  } catch (e) {
89083
-
89084
89095
  console.error(`[${componentName$V}] Failed to load countries`, e);
89085
89096
  } finally {
89086
89097
  this.#countryComboBox.removeAttribute('loading');
@@ -89105,7 +89116,6 @@ function requireIndex_cjs () {
89105
89116
  this.#loadCities(countryIso2);
89106
89117
  }
89107
89118
  } catch (e) {
89108
-
89109
89119
  console.error(
89110
89120
  `[${componentName$V}] Failed to load subdivisions for ${countryIso2}`,
89111
89121
  e,
@@ -89127,10 +89137,13 @@ function requireIndex_cjs () {
89127
89137
  this.#cityVisible = cities.length > 0;
89128
89138
  this.#refreshState();
89129
89139
  if (cities.length > 0) {
89130
- this.#cityComboBox.data = cities;
89140
+ this.#cachedCities = cities;
89141
+ this.#cityComboBox.data = cities.map((c) => ({
89142
+ ...c,
89143
+ lang: this.#lang,
89144
+ }));
89131
89145
  }
89132
89146
  } catch (e) {
89133
-
89134
89147
  console.error(
89135
89148
  `[${componentName$V}] Failed to load cities for ${countryIso2}${stateCode ? `/${stateCode}` : ''}`,
89136
89149
  e,
@@ -89155,6 +89168,14 @@ function requireIndex_cjs () {
89155
89168
  if (prevSubdivision)
89156
89169
  this.#selectItemById(this.#subdivisionComboBox, prevSubdivision);
89157
89170
  }
89171
+ if (this.#cachedCities && this.#cityVisible) {
89172
+ const prevCity = this.#cityComboBox.value;
89173
+ this.#cityComboBox.data = this.#cachedCities.map((c) => ({
89174
+ ...c,
89175
+ lang: this.#lang,
89176
+ }));
89177
+ if (prevCity) this.#selectItemById(this.#cityComboBox, prevCity);
89178
+ }
89158
89179
  // Re-apply translated subdivision type label for the new lang
89159
89180
  const currentIso2 = this.#countryComboBox.value;
89160
89181
  if (currentIso2) {
@@ -89268,6 +89289,7 @@ function requireIndex_cjs () {
89268
89289
  #resetCity() {
89269
89290
  this.#cityComboBox.value = '';
89270
89291
  this.#cityComboBox.data = [];
89292
+ this.#cachedCities = null;
89271
89293
  this.#cityVisible = false;
89272
89294
  this.#refreshState();
89273
89295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/flow-components",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@babel/core": "7.29.0",
28
- "@babel/preset-env": "7.29.0",
28
+ "@babel/preset-env": "7.29.2",
29
29
  "@babel/preset-react": "7.28.5",
30
30
  "@babel/preset-typescript": "7.28.5",
31
31
  "@module-federation/enhanced": "0.13.1",
@@ -97,7 +97,7 @@
97
97
  "webpack-subresource-integrity": "5.2.0-rc.1"
98
98
  },
99
99
  "dependencies": {
100
- "@descope/web-components-ui": "3.1.3"
100
+ "@descope/web-components-ui": "3.1.5"
101
101
  },
102
102
  "peerDependencies": {
103
103
  "react": ">= 18"