@budibase/frontend-core 3.23.24 → 3.23.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "3.23.24",
3
+ "version": "3.23.26",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
@@ -17,5 +17,5 @@
17
17
  "shortid": "2.2.15",
18
18
  "socket.io-client": "^4.7.5"
19
19
  },
20
- "gitHead": "083c01f79a93ea8819c45370178ded6909dd2ef4"
20
+ "gitHead": "c17fe00ac51b8f257b3e66dfcee10b82a6ea5264"
21
21
  }
package/src/api/index.ts CHANGED
@@ -91,6 +91,20 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
91
91
  } catch (error) {
92
92
  // Do nothing
93
93
  }
94
+
95
+ // account lockout
96
+ const accountLocked = response.headers.get("X-Account-Locked") === "1"
97
+ const retryAfter = response.headers.get("Retry-After")
98
+ if (accountLocked) {
99
+ const seconds = Number(retryAfter)
100
+ if (Number.isFinite(seconds)) {
101
+ const remainingTime = seconds < 60 ? seconds : Math.ceil(seconds / 60)
102
+ const timeUnit = seconds < 60 ? "second" : "minute"
103
+ message = `Account temporarily locked. Try again in ${remainingTime} ${timeUnit}${remainingTime === 1 ? "" : "s"}.`
104
+ } else {
105
+ message = "Account temporarily locked. Try again later."
106
+ }
107
+ }
94
108
  return {
95
109
  message,
96
110
  json,
@@ -117,15 +117,16 @@
117
117
 
118
118
  /**
119
119
  * Converts arrays into strings. The CodeEditor expects a string or encoded JS
120
- * FilterValueType.VALUE values are emptied when first loaded in the binding drawer.
120
+ * value, so normalise everything to a readable string but preserve whatever the
121
+ * user last entered when reopening the drawer.
121
122
  *
122
123
  * @param{string} fieldValue
123
124
  */
124
125
  const toDrawerValue = fieldValue => {
125
- if (filter.valueType == FilterValueType.VALUE) {
126
- return ""
127
- }
128
- return Array.isArray(fieldValue) ? fieldValue.join(",") : readableValue
126
+ const normalised = Array.isArray(fieldValue)
127
+ ? fieldValue.join(",")
128
+ : readableValue
129
+ return normalised ?? ""
129
130
  }
130
131
  </script>
131
132