expensify-common 2.0.48 → 2.0.49

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.
@@ -724,7 +724,7 @@ class ExpensiMark {
724
724
  */
725
725
  replace(text, { filterRules = [], shouldEscapeText = true, shouldKeepRawInput = false, disabledRules = [], extras = EXTRAS_DEFAULT } = {}) {
726
726
  // This ensures that any html the user puts into the comment field shows as raw html
727
- let replacedText = shouldEscapeText ? Utils.escape(text) : text;
727
+ let replacedText = shouldEscapeText ? Utils.escapeText(text) : text;
728
728
  const rules = this.getHtmlRuleset(filterRules, disabledRules, shouldKeepRawInput);
729
729
  const processRule = (rule) => {
730
730
  // Pre-process text before applying regex
@@ -749,7 +749,7 @@ class ExpensiMark {
749
749
  catch (e) {
750
750
  ExpensiMark.Log.alert('Error replacing text with html in ExpensiMark.replace', { error: e });
751
751
  // We want to return text without applying rules if exception occurs during replacing
752
- return shouldEscapeText ? Utils.escape(text) : text;
752
+ return shouldEscapeText ? Utils.escapeText(text) : text;
753
753
  }
754
754
  return replacedText;
755
755
  }
@@ -1099,7 +1099,7 @@ class ExpensiMark {
1099
1099
  // When the attribute contains HTML and is converted back to MD we need to re-escape it to avoid
1100
1100
  // illegal attribute value characters like `," or ' which might break the HTML
1101
1101
  originalContent = str_1.default.replaceAll(originalContent, '\n', '');
1102
- return Utils.escape(originalContent);
1102
+ return Utils.escapeText(originalContent);
1103
1103
  }
1104
1104
  /**
1105
1105
  * Determines the end position to truncate the HTML content while considering word boundaries.
@@ -795,7 +795,7 @@ class Combobox extends react_1.default.Component {
795
795
  };
796
796
  const toggleBtnClasses = this.props.bs4 ? 'dropdown-toggle dropdown-toggle-split btn btn-outline-primary' : 'dropdown-toggle btn btn-default';
797
797
  return (react_1.default.createElement("div", { className: (0, classnames_1.default)(inputGroupClasses, this.props.extraClasses), onKeyDown: this.handleKeyDown, role: "presentation" },
798
- react_1.default.createElement("input", { ref: (ref) => (this.value = ref), type: "text", className: (0, classnames_1.default)(['form-control', { error: this.state.hasError }]), disabled: this.state.isDisabled, "aria-label": "...", onChange: this.performSearch, onKeyDown: this.closeDropdownOnTabOut, value: this.props.propertyToDisplay === 'value' ? Utils.unescape(this.state.currentValue) : Utils.unescape(this.state.currentText.replace(/ /g, '')), onFocus: this.openDropdown, autoComplete: "off", placeholder: this.props.placeholder, tabIndex: "0" }),
798
+ react_1.default.createElement("input", { ref: (ref) => (this.value = ref), type: "text", className: (0, classnames_1.default)(['form-control', { error: this.state.hasError }]), disabled: this.state.isDisabled, "aria-label": "...", onChange: this.performSearch, onKeyDown: this.closeDropdownOnTabOut, value: this.props.propertyToDisplay === 'value' ? Utils.unescapeText(this.state.currentValue) : Utils.unescapeText(this.state.currentText.replace(/ /g, '')), onFocus: this.openDropdown, autoComplete: "off", placeholder: this.props.placeholder, tabIndex: "0" }),
799
799
  react_1.default.createElement("div", { className: (0, classnames_1.default)(inputGroupBtnClasses) },
800
800
  react_1.default.createElement("button", { type: "button", className: (0, classnames_1.default)(toggleBtnClasses, { error: this.state.hasError }), disabled: this.state.isDisabled, onClick: this.toggleDropdown, onKeyDown: this.closeDropdownOnTabOut, tabIndex: "-1" },
801
801
  !this.props.bs4 && react_1.default.createElement("span", { className: "caret" }),
package/dist/str.js CHANGED
@@ -112,7 +112,7 @@ const Str = {
112
112
  * @returns The escaped string
113
113
  */
114
114
  safeEscape(s) {
115
- return Utils.escape(Utils.unescape(s));
115
+ return Utils.escapeText(Utils.unescapeText(s));
116
116
  },
117
117
  /**
118
118
  * HTML encoding insensitive equals.
package/dist/utils.d.ts CHANGED
@@ -7,14 +7,14 @@ declare function isNavigatorAvailable(): boolean;
7
7
  * corresponding HTML entities.
8
8
  * Source: https://github.com/lodash/lodash/blob/main/src/escape.ts
9
9
  */
10
- declare function escape(string: string): string;
10
+ declare function escapeText(string: string): string;
11
11
  /**
12
12
  * The inverse of `escape`this method converts the HTML entities
13
13
  * `&`, `<`, `>`, `"` and `'` in `string` to
14
14
  * their corresponding characters.
15
15
  * Source: https://github.com/lodash/lodash/blob/main/src/unescape.ts
16
16
  * */
17
- declare function unescape(string: string): string;
17
+ declare function unescapeText(string: string): string;
18
18
  /**
19
19
  * Checks if the given variable is a function
20
20
  * @param {*} variableToCheck
@@ -27,4 +27,4 @@ declare function isFunction(variableToCheck: unknown): boolean;
27
27
  * @returns {boolean}
28
28
  */
29
29
  declare function isObject(obj: unknown): boolean;
30
- export { isWindowAvailable, isNavigatorAvailable, escape, unescape, isFunction, isObject };
30
+ export { isWindowAvailable, isNavigatorAvailable, escapeText, unescapeText, isFunction, isObject };
package/dist/utils.js CHANGED
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isWindowAvailable = isWindowAvailable;
4
4
  exports.isNavigatorAvailable = isNavigatorAvailable;
5
- exports.escape = escape;
6
- exports.unescape = unescape;
5
+ exports.escapeText = escapeText;
6
+ exports.unescapeText = unescapeText;
7
7
  exports.isFunction = isFunction;
8
8
  exports.isObject = isObject;
9
9
  /** Checks if the `window` global object is available. */
@@ -29,7 +29,7 @@ const reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
29
29
  * corresponding HTML entities.
30
30
  * Source: https://github.com/lodash/lodash/blob/main/src/escape.ts
31
31
  */
32
- function escape(string) {
32
+ function escapeText(string) {
33
33
  return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, (chr) => htmlEscapes[chr]) : string || '';
34
34
  }
35
35
  const htmlUnescapes = {
@@ -49,7 +49,7 @@ const reHasEscapedHtml = RegExp(reEscapedHtml.source);
49
49
  * their corresponding characters.
50
50
  * Source: https://github.com/lodash/lodash/blob/main/src/unescape.ts
51
51
  * */
52
- function unescape(string) {
52
+ function unescapeText(string) {
53
53
  return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, (entity) => htmlUnescapes[entity] || "'") : string || '';
54
54
  }
55
55
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expensify-common",
3
- "version": "2.0.48",
3
+ "version": "2.0.49",
4
4
  "author": "Expensify, Inc.",
5
5
  "description": "Expensify libraries and components shared across different repos",
6
6
  "homepage": "https://expensify.com",