@pushwoosh/dumb-components 4.18.1 → 4.18.3

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": "@pushwoosh/dumb-components",
3
- "version": "4.18.1",
3
+ "version": "4.18.3",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -45,7 +45,7 @@
45
45
  "@codemirror/view": "^6.43.11",
46
46
  "@floating-ui/react-dom": "^2.1.9",
47
47
  "@lezer/highlight": "^1.2.1",
48
- "@pushwoosh/kit-constants": "^3.2.1",
48
+ "@pushwoosh/kit-constants": "^3.3.0",
49
49
  "@pushwoosh/kit-helpers": "^4.18.0",
50
50
  "@pushwoosh/kit-icons": "^3.0.2",
51
51
  "@pushwoosh/kit-typography": "^2.2.0",
@@ -22,5 +22,5 @@ export declare function parseDc(value: string): DynamicContent;
22
22
  export declare function isIgnoringNonTagged(dc: DynamicContent): boolean;
23
23
  /** Serializes a token back to `{tagName|modifier|defaultValue}`. */
24
24
  export declare function stringifyDc(dc: DynamicContent): string;
25
- /** Whether the sender substitutes this token, or ships it verbatim (dates are case-sensitive, other modifiers are not). */
25
+ /** Whether the sender substitutes this token, or ships it verbatim. */
26
26
  export declare function isResolvableDc(dc: DynamicContent): boolean;
@@ -1,3 +1,4 @@
1
+ import { isResolvableModifier } from '@pushwoosh/kit-constants';
1
2
  // Localization placeholders (`{{key|text}}`) contain a token-shaped substring,
2
3
  // so they are matched first and kept literal.
3
4
  const PART_REGEX = /(\{\{[^{}]*\}\}|\{(?=[^{}]*\|)[^{}]*\})/;
@@ -48,13 +49,7 @@ export function stringifyDc(dc) {
48
49
  } = dc;
49
50
  return `{${tagName}|${modifier}${isIgnoringNonTagged(dc) ? '' : `|${defaultValue}`}}`;
50
51
  }
51
- const CASE_INSENSITIVE_MODIFIERS = ['capitalizefirst', 'capitalizeallfirst', 'uppercase', 'lowercase', 'regular', 'base64', 'cent', 'dollar', 'comma', 'euro', 'jpy', 'lira'];
52
- const DATE_MODIFIERS = ['M-d-y', 'm-d-y', 'M d y', 'M d Y', 'l', 'M d', 'H:i', 'm-d-y H:i'];
53
- /** Whether the sender substitutes this token, or ships it verbatim (dates are case-sensitive, other modifiers are not). */
52
+ /** Whether the sender substitutes this token, or ships it verbatim. */
54
53
  export function isResolvableDc(dc) {
55
- const {
56
- tagName,
57
- modifier
58
- } = dc;
59
- return Boolean(tagName) && (CASE_INSENSITIVE_MODIFIERS.includes(modifier.toLowerCase()) || DATE_MODIFIERS.includes(modifier));
54
+ return Boolean(dc.tagName) && isResolvableModifier(dc.modifier);
60
55
  }