@pushwoosh/websdk-common 6.31.0 → 6.32.0

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.
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { INBOX_KNOWN_LAYOUTS, INBOX_WIDGET_CSS } from './constants';
4
- import { formatInboxMessageTime, getInboxHeroUrl, getInboxIconInitial, getInboxMobileTexts, getInboxTextDirection, getInboxValidSlides, isInboxContentEmpty, resolveInboxLayout, resolveInboxWidgetAppearance } from './helpers';
4
+ import { formatInboxMessageTime, getInboxHeroUrl, getInboxIconInitial, getInboxMobileTexts, getInboxValidSlides, isInboxContentEmpty, resolveInboxLayout, resolveInboxWidgetAppearance } from './helpers';
5
5
  import { InboxWebCell, inboxWidgetPreviewFrame } from './InboxWidgetReader';
6
+ import { detectTextDirection } from '../shared/textDirection';
6
7
  const MAIN = '#4B5057';
7
8
  const LOCKED = '#767C82';
8
9
  const PHANTOM = '#9AA0A6';
@@ -613,7 +614,7 @@ export function InboxCellPreview(props) {
613
614
  const texts = getInboxMobileTexts(picked, layout);
614
615
  const useAppIcon = layout === 'classic' && !picked.iconUrl && !!appIconUrl;
615
616
  const Cell = platform === 'android' ? AndroidCell : IOSCell;
616
- const rtl = !isEmpty && getInboxTextDirection(texts.title, texts.body) === 'rtl';
617
+ const rtl = !isEmpty && detectTextDirection(texts.title, texts.body) === 'rtl';
617
618
  return _jsx("div", {
618
619
  dir: rtl ? 'rtl' : undefined,
619
620
  style: frame,
@@ -16,8 +16,6 @@ export declare function getInboxMobileTexts(content: InboxCellContent, layout: I
16
16
  title: string;
17
17
  body: string;
18
18
  };
19
- /** 'rtl' when most letters of the copy read right to left; markup and Liquid do not vote. */
20
- export declare function getInboxTextDirection(...texts: (string | undefined)[]): 'rtl' | 'ltr';
21
19
  /** The colored initial a classic cell shows when there is no icon. */
22
20
  export declare function getInboxIconInitial(content: InboxCellContent): string;
23
21
  /** Date label of a web widget message: relative within a day of `now`, then `D Mon YYYY, H:mm` in local time. */
package/inbox/helpers.js CHANGED
@@ -76,22 +76,6 @@ export function getInboxMobileTexts(content, layout) {
76
76
  body: content.body || ''
77
77
  };
78
78
  }
79
- const RTL_LETTER = /[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Samaritan}\p{Script=Mandaic}\p{Script=Adlam}\p{Script=Hanifi_Rohingya}\p{Script=Mende_Kikakui}\p{Script=Yezidi}]/u;
80
- const LETTER = /\p{L}/u;
81
- const NOT_COPY = /<[^>]*>|\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}/g;
82
- /** 'rtl' when most letters of the copy read right to left; markup and Liquid do not vote. */
83
- export function getInboxTextDirection(...texts) {
84
- let rtl = 0;
85
- let ltr = 0;
86
- for (const char of texts.join(' ').replace(NOT_COPY, '')) {
87
- if (RTL_LETTER.test(char)) {
88
- rtl += 1;
89
- } else if (LETTER.test(char)) {
90
- ltr += 1;
91
- }
92
- }
93
- return rtl > ltr ? 'rtl' : 'ltr';
94
- }
95
79
  /** The colored initial a classic cell shows when there is no icon. */
96
80
  export function getInboxIconInitial(content) {
97
81
  return (content.title || content.body || '?').trim().charAt(0).toUpperCase() || '?';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/websdk-common",
3
- "version": "6.31.0",
3
+ "version": "6.32.0",
4
4
  "description": "Code shared by the Pushwoosh WebSDK and the Control Panel, one entry point per module (web-popups: web popup model and renderer; subscription-widget: push subscription widget model and renderer; inbox: web inbox widget and inbox cell previews)",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -37,7 +37,7 @@
37
37
  "react": "19.3.0",
38
38
  "react-dom": "19.3.0",
39
39
  "typescript": "^6.0.3",
40
- "vitest": "^4.1.12"
40
+ "vitest": "^5.1.1"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": "^19.0.0"
@@ -0,0 +1,3 @@
1
+ export type TextDirection = 'ltr' | 'rtl';
2
+ /** 'rtl' when most letters of the copy read right to left; markup and Liquid do not vote. */
3
+ export declare function detectTextDirection(...texts: (string | undefined)[]): TextDirection;
@@ -0,0 +1,16 @@
1
+ const RTL_LETTER = /[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Samaritan}\p{Script=Mandaic}\p{Script=Adlam}\p{Script=Hanifi_Rohingya}\p{Script=Mende_Kikakui}\p{Script=Yezidi}]/u;
2
+ const LETTER = /\p{L}/u;
3
+ const NOT_COPY = /<[^>]*>|\{\{[\s\S]*?\}\}|\{%[\s\S]*?%\}/g;
4
+ /** 'rtl' when most letters of the copy read right to left; markup and Liquid do not vote. */
5
+ export function detectTextDirection(...texts) {
6
+ let rtl = 0;
7
+ let ltr = 0;
8
+ for (const char of texts.join(' ').replace(NOT_COPY, '')) {
9
+ if (RTL_LETTER.test(char)) {
10
+ rtl += 1;
11
+ } else if (LETTER.test(char)) {
12
+ ltr += 1;
13
+ }
14
+ }
15
+ return rtl > ltr ? 'rtl' : 'ltr';
16
+ }
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useContext, useEffect, useState } from 'react';
2
+ import { useContext, useEffect, useMemo, useState } from 'react';
3
3
  import { useColorScheme } from './colorScheme';
4
4
  import { webPopupButtonPillStyle, webPopupFormInputStyle, webPopupRatingScores, webPopupTextColor, webPopupSlotGap, webPopupSlotRole, WEB_POPUP_BG_SECTION_FALLBACK, WEB_POPUP_BUTTON_SLOT_PADDING, WEB_POPUP_FONT_STACK, WEB_POPUP_EMAIL_PATTERN, WEB_POPUP_KEYFRAMES, WEB_POPUP_PAGE_TRANSITION_MS, WEB_POPUP_RETRY_ERROR, WEB_POPUP_TEXT_SLOT_PADDING, WEB_POPUP_TEXT_VARIANT_STYLES } from './constants';
5
5
  import { ConsentSlotView, EmailInputSlotView, SubmitSlotView, TagInputSlotView } from './form-slots';
6
6
  import { useWebPopupFormSession, WebPopupFormSessionContext } from './formSession';
7
7
  import { WEB_POPUP_GLYPH_PATHS, WEB_POPUP_THUMB_UP_PATH } from './glyphs';
8
- import { applyWebPopupSubscribeOutcome, placementMaxSize, resolveWebPopupPages, safeUrl, sanitizeWebPopupHtml, startPageOf, webPopupLinkTargetAttrs } from './helpers';
8
+ import { applyWebPopupSubscribeOutcome, placementMaxSize, resolveWebPopupPages, safeUrl, sanitizeWebPopupHtml, startPageOf, webPopupCssTextAlign, webPopupDirection, webPopupLinkTargetAttrs } from './helpers';
9
9
  import { webPopupBackgroundImageStyle, webPopupContainerStyle, webPopupScrimGradient } from './layout';
10
10
  import { resolveWebPopupBoxChrome, resolveWebPopupColors, webPopupColorAlpha, webPopupDarkEnabled, webPopupImageSrc } from './palette';
11
11
  import { ProductsSlotView, WebPopupProductsContext } from './productsSlot';
@@ -33,7 +33,7 @@ function TextSlotView({
33
33
  }) {
34
34
  const style = {
35
35
  ...WEB_POPUP_TEXT_VARIANT_STYLES[slot.variant],
36
- textAlign: slot.align ?? align
36
+ textAlign: webPopupCssTextAlign(slot.align ?? align)
37
37
  };
38
38
  const color = webPopupTextColor(slot.variant, colors, inverse);
39
39
  if (color) style.color = color;
@@ -158,7 +158,7 @@ function SlotMessageView({
158
158
  style: {
159
159
  ...WEB_POPUP_TEXT_VARIANT_STYLES.body,
160
160
  padding: WEB_POPUP_TEXT_SLOT_PADDING,
161
- textAlign: align,
161
+ textAlign: webPopupCssTextAlign(align),
162
162
  ...(color ? {
163
163
  color
164
164
  } : {})
@@ -270,7 +270,7 @@ function FormSlotView({
270
270
  noValidate: true,
271
271
  style: {
272
272
  margin: 0,
273
- textAlign: 'left'
273
+ textAlign: 'start'
274
274
  },
275
275
  onSubmit: event => {
276
276
  event.preventDefault();
@@ -358,7 +358,7 @@ function FormSlotView({
358
358
  }), phase === 'error' && _jsx("div", {
359
359
  style: {
360
360
  ...errorStyle,
361
- textAlign: align
361
+ textAlign: webPopupCssTextAlign(align)
362
362
  },
363
363
  children: WEB_POPUP_RETRY_ERROR
364
364
  })]
@@ -446,7 +446,7 @@ function TimerSlotView({
446
446
  return _jsx("div", {
447
447
  style: {
448
448
  padding: WEB_POPUP_TEXT_SLOT_PADDING,
449
- textAlign: align
449
+ textAlign: webPopupCssTextAlign(align)
450
450
  },
451
451
  children: _jsx("div", {
452
452
  style: {
@@ -791,7 +791,7 @@ function GlyphSlotView({
791
791
  return _jsx("div", {
792
792
  style: {
793
793
  padding: WEB_POPUP_TEXT_SLOT_PADDING,
794
- textAlign: align,
794
+ textAlign: webPopupCssTextAlign(align),
795
795
  lineHeight: 0
796
796
  },
797
797
  children: _jsx("svg", {
@@ -1241,6 +1241,7 @@ export function WebPopupBox({
1241
1241
  const subscribeSession = useWebPopupSubscribeSession();
1242
1242
  const colors = resolveWebPopupColors(params, colorScheme);
1243
1243
  const box = resolveWebPopupBoxChrome(params, colorScheme);
1244
+ const dir = useMemo(() => webPopupDirection(params), [params]);
1244
1245
  const style = {
1245
1246
  position: 'relative',
1246
1247
  boxSizing: 'border-box',
@@ -1273,6 +1274,7 @@ export function WebPopupBox({
1273
1274
  } : {})
1274
1275
  };
1275
1276
  return _jsx("div", {
1277
+ dir: dir,
1276
1278
  style: style,
1277
1279
  children: _jsx(WebPopupFormSessionContext.Provider, {
1278
1280
  value: formSession,
@@ -1316,7 +1318,7 @@ function CloseButton({
1316
1318
  style: {
1317
1319
  position: 'absolute',
1318
1320
  top: 10,
1319
- right: 10,
1321
+ insetInlineEnd: 10,
1320
1322
  width: 24,
1321
1323
  height: 24,
1322
1324
  padding: 0,
@@ -1405,6 +1407,7 @@ export function WebPopupReader({
1405
1407
  }));
1406
1408
  }, [params]);
1407
1409
  const scheme = useColorScheme(colorScheme, webPopupDarkEnabled(params));
1410
+ const dir = useMemo(() => webPopupDirection(params), [params]);
1408
1411
  const pages = resolveWebPopupPages(params);
1409
1412
  if (pages.length === 0) return null;
1410
1413
  const page = pages.find(p => p.key === pageKey) ?? startPageOf(params, pages);
@@ -1457,6 +1460,7 @@ export function WebPopupReader({
1457
1460
  },
1458
1461
  onClick: onRequestClose
1459
1462
  }), _jsxs("div", {
1463
+ dir: dir,
1460
1464
  style: fixedContainerStyle(params, page.width, page.height),
1461
1465
  children: [_jsx(WebPopupBox, {
1462
1466
  page: page,
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useContext } from 'react';
3
3
  import { WebPopupFormSessionContext } from '../../formSession';
4
+ import { webPopupCssTextAlign } from '../../helpers';
4
5
  import { WEB_POPUP_SUBMIT_ATTRIBUTE } from '../../styles';
5
6
  import { errorStyle } from '../styles';
6
7
  import { pillStyle, slotStyle } from './styles';
@@ -24,7 +25,7 @@ export function SubmitSlotView({
24
25
  }), session.phase === 'error' && _jsx("div", {
25
26
  style: {
26
27
  ...errorStyle(colors),
27
- textAlign: align
28
+ textAlign: webPopupCssTextAlign(align)
28
29
  },
29
30
  children: slot.errorMessage
30
31
  })]
@@ -1,7 +1,7 @@
1
1
  import { webPopupTextColor, WEB_POPUP_TEXT_SLOT_PADDING, WEB_POPUP_TEXT_VARIANT_STYLES } from '../constants';
2
2
  export const fieldSlotStyle = {
3
3
  padding: WEB_POPUP_TEXT_SLOT_PADDING,
4
- textAlign: 'left'
4
+ textAlign: 'start'
5
5
  };
6
6
  export function captionStyle({
7
7
  inverse,
@@ -1,4 +1,4 @@
1
- import { type WebPopupButtonAction, type WebPopupColors, type WebPopupDark, type WebPopupJson, type WebPopupLogger, type WebPopupPageParams, type WebPopupParams, type WebPopupPlacement, type WebPopupProductsSlot, type WebPopupResolvedPage, type WebPopupValueParam } from './types';
1
+ import { type WebPopupButtonAction, type WebPopupColors, type WebPopupDark, type WebPopupDirection, type WebPopupJson, type WebPopupLogger, type WebPopupPageParams, type WebPopupParams, type WebPopupPlacement, type WebPopupProductsSlot, type WebPopupResolvedPage, type WebPopupSlot, type WebPopupTextAlign, type WebPopupValueParam } from './types';
2
2
  export declare function safeUrl(url: string | undefined): string | undefined;
3
3
  /**
4
4
  * The target/rel pair a popup link renders with: only an exact '_self' opts
@@ -91,6 +91,12 @@ export declare function resolveWebPopupPageSize(own: number | 'stretch' | null |
91
91
  * — the renderer never falls back itself.
92
92
  */
93
93
  export declare function resolveWebPopupPages(params: WebPopupParams): WebPopupResolvedPage[];
94
+ /** The popup's text direction: the authored `dir`, else what its copy reads as. */
95
+ export declare function webPopupDirection(params: WebPopupParams): WebPopupDirection;
96
+ /** The visitor-facing copy of a slot; placeholders, urls and tag names stay out of the direction vote. */
97
+ export declare function webPopupSlotCopy(slot: WebPopupSlot): string[];
98
+ /** CSS alignment of an authored one: 'left' is the editor's default, so it follows the direction. */
99
+ export declare function webPopupCssTextAlign(align: WebPopupTextAlign): 'start' | 'center' | 'right';
94
100
  /** The page shown first: startPage when it exists, else the first page. */
95
101
  export declare function startPageOf(params: WebPopupParams, pages: WebPopupResolvedPage[]): WebPopupResolvedPage;
96
102
  export declare function placementMaxSize(placement: WebPopupPlacement): string;
@@ -2,7 +2,8 @@ import { SAFE_URL_PROTOCOL, WEB_POPUP_CHOICE_DEFAULTS, WEB_POPUP_CONSENT_DEFAULT
2
2
  import { WEB_POPUP_GLYPH_NAMES, WEB_POPUP_GLYPH_SIZES } from './glyphs';
3
3
  import { normalizeWebPopupLayout, substituteWebPopupLayoutValues, WEB_POPUP_VALUE_KEY_PATTERN } from './layout';
4
4
  import { autoDarkWebPopupColors } from './palette';
5
- import { webPopupTimeZoneSupported, webPopupWallClockMs } from './timer';
5
+ import { webPopupTimerLabels, webPopupTimeZoneSupported, webPopupWallClockMs } from './timer';
6
+ import { detectTextDirection } from '../shared/textDirection';
6
7
  // Sanitize a user-entered button URL before it lands in an href: https/http/
7
8
  // mailto/tel and page-relative links only.
8
9
  export function safeUrl(url) {
@@ -797,6 +798,45 @@ export function resolveWebPopupPages(params) {
797
798
  }
798
799
  return out;
799
800
  }
801
+ /** The popup's text direction: the authored `dir`, else what its copy reads as. */
802
+ export function webPopupDirection(params) {
803
+ if (params.dir === 'ltr' || params.dir === 'rtl') return params.dir;
804
+ const copy = resolveWebPopupPages(params).flatMap(page => page.contents.flatMap(zone => zone.slots.flatMap(webPopupSlotCopy)));
805
+ return detectTextDirection(...copy);
806
+ }
807
+ /** The visitor-facing copy of a slot; placeholders, urls and tag names stay out of the direction vote. */
808
+ export function webPopupSlotCopy(slot) {
809
+ switch (slot.type) {
810
+ case 'text':
811
+ return [slot.html];
812
+ case 'button':
813
+ return [slot.label];
814
+ case 'email-subscription-form':
815
+ return [...slot.fields.map(field => field.label), slot.submitLabel, slot.successMessage, slot.confirmEmailMessage, ...(slot.privacy ? [slot.privacy.checkboxLabel, slot.privacy.linkLabel] : [])];
816
+ case 'choice':
817
+ return [...slot.options.map(option => option.label), slot.submitLabel, slot.successMessage];
818
+ case 'rating':
819
+ return [slot.labels.low, slot.labels.high, slot.submitLabel, slot.successMessage];
820
+ case 'products':
821
+ return [slot.ctaText];
822
+ case 'email-input':
823
+ return [slot.label, slot.invalidMessage, slot.requiredMessage];
824
+ case 'tag-input':
825
+ return [slot.label, slot.requiredMessage];
826
+ case 'consent':
827
+ return [slot.checkboxLabel, slot.linkLabel, slot.requiredMessage];
828
+ case 'submit':
829
+ return [slot.label, slot.errorMessage];
830
+ case 'timer':
831
+ return slot.showLabels ? Object.values(webPopupTimerLabels(slot.language)) : [];
832
+ case 'glyph':
833
+ return [];
834
+ }
835
+ }
836
+ /** CSS alignment of an authored one: 'left' is the editor's default, so it follows the direction. */
837
+ export function webPopupCssTextAlign(align) {
838
+ return align === 'left' ? 'start' : align;
839
+ }
800
840
  /** The page shown first: startPage when it exists, else the first page. */
801
841
  export function startPageOf(params, pages) {
802
842
  return pages.find(p => p.key === params.startPage) ?? pages[0];
@@ -3,11 +3,11 @@ export { WebPopupInline } from './WebPopupInline';
3
3
  export { loadWebPopupProducts } from './productsSlot';
4
4
  export { WEB_POPUP_CLOSE_ATTRIBUTE, WEB_POPUP_SUBMIT_ATTRIBUTE } from './styles';
5
5
  export { WEB_POPUP_TEMPLATES, findWebPopupTemplate } from './templates';
6
- export { parseWebPopupJson, stringifyWebPopup, resolveWebPopupPages, resolveWebPopupPageSize, startPageOf, safeUrl, sanitizeWebPopupHtml, normalizeWebPopupColors, normalizeWebPopupValues, webPopupValuesMap, collectWebPopupFormCodes, collectWebPopupProductSlots, webPopupExpired, normalizeWebPopupDark, WEB_POPUP_MAX_SIZE_PX, isWebPopupCloseButton, webPopupPageWithoutCloseButtons, webPopupParamsWithoutCloseButtons, } from './helpers';
6
+ export { parseWebPopupJson, stringifyWebPopup, resolveWebPopupPages, resolveWebPopupPageSize, startPageOf, safeUrl, sanitizeWebPopupHtml, normalizeWebPopupColors, normalizeWebPopupValues, webPopupValuesMap, collectWebPopupFormCodes, collectWebPopupProductSlots, webPopupExpired, normalizeWebPopupDark, WEB_POPUP_MAX_SIZE_PX, isWebPopupCloseButton, webPopupPageWithoutCloseButtons, webPopupParamsWithoutCloseButtons, webPopupDirection, webPopupCssTextAlign, } from './helpers';
7
7
  export { webPopupHasForm } from './form';
8
8
  export { webPopupTimerLabels, webPopupTimerRemaining, webPopupTimeZoneSupported, webPopupWallClockMs, type WebPopupTimerLabels, } from './timer';
9
9
  export { normalizeWebPopupLayout, substituteWebPopupLayoutValues, WEB_POPUP_VALUE_KEY_PATTERN, webPopupBackgroundImageStyle, webPopupContainerStyle, webPopupCssLength, webPopupPaddingValue, webPopupTracksValue, } from './layout';
10
10
  export { WEB_POPUP_VERSION, WEB_POPUP_FONT_STACK, WEB_POPUP_TEXT_COLOR, WEB_POPUP_TEXT_SECONDARY_COLOR, WEB_POPUP_ACCENT_COLOR, WEB_POPUP_BACKGROUND_COLOR, WEB_POPUP_DEFAULT_COLORS, webPopupTextColor, WEB_POPUP_TEXT_VARIANT_STYLES, WEB_POPUP_BG_SECTION_FALLBACK, WEB_POPUP_TEXT_SLOT_PADDING, WEB_POPUP_BUTTON_SLOT_PADDING, webPopupSlotGap, webPopupSlotRole, type WebPopupSlotRole, WEB_POPUP_DEFAULT_WIDTH, WEB_POPUP_INLINE_IMAGE_MAX_HEIGHT, WEB_POPUP_LAYOUT_MAX_DEPTH, WEB_POPUP_LAYOUT_MAX_NODES, webPopupButtonPillStyle, webPopupFormInputStyle, WEB_POPUP_FORM_INPUT_BORDER, WEB_POPUP_FORM_ERROR_COLOR, WEB_POPUP_FORM_ERROR_COLOR_DARK, WEB_POPUP_ON_ACCENT_COLOR, WEB_POPUP_FORM_DEFAULTS, WEB_POPUP_PRODUCTS_DEFAULTS, WEB_POPUP_PRODUCTS_MAX_LIMIT, WEB_POPUP_PRODUCTS_CACHE_MS, WEB_POPUP_CHOICE_DEFAULTS, WEB_POPUP_MAX_CHOICE_OPTIONS, WEB_POPUP_RATING_DEFAULTS, WEB_POPUP_RETRY_ERROR, WEB_POPUP_EMAIL_INPUT_DEFAULTS, WEB_POPUP_TAG_INPUT_DEFAULTS, WEB_POPUP_CONSENT_DEFAULTS, WEB_POPUP_SUBMIT_DEFAULTS, webPopupRatingScores, } from './constants';
11
11
  export { resolveWebPopupBoxChrome, resolveWebPopupColors, autoDarkWebPopupColors, webPopupColorAlpha, webPopupDarkColors, webPopupDarkEnabled, webPopupEffectiveScheme, webPopupImageSrc, webPopupMixColor, webPopupShiftColor, } from './palette';
12
12
  export { WEB_POPUP_GLYPH_NAMES, WEB_POPUP_GLYPH_PATHS, WEB_POPUP_GLYPH_SIZES, WEB_POPUP_THUMB_UP_PATH, } from './glyphs';
13
- export { type WebPopupJson, type WebPopupKind, type WebPopupParams, type WebPopupColors, type WebPopupChrome, type WebPopupPageParams, type WebPopupResolvedPage, type WebPopupDark, type WebPopupResolvedColors, type WebPopupColorScheme, type WebPopupColorSchemePref, type WebPopupSlot, type WebPopupImage, type WebPopupVideo, type WebPopupPlacement, type WebPopupOverlay, type WebPopupAnimation, type WebPopupButtonAction, type WebPopupButtonVariant, type WebPopupTextVariant, type WebPopupTextAlign, type WebPopupVAnchor, type WebPopupHAnchor, type WebPopupReaderMode, type WebPopupReaderProps, type WebPopupLeafRenderers, type WebPopupBoxProps, type WebPopupInlineProps, type WebPopupLayoutNode, type WebPopupContainerNode, type WebPopupContentNode, type WebPopupImageNode, type WebPopupContainerType, type WebPopupContainerProps, type WebPopupContentZone, type WebPopupContentTone, type WebPopupCssLength, type WebPopupBoxSides, type WebPopupAlignItems, type WebPopupJustifyContent, type WebPopupValueParam, type WebPopupValueControl, type WebPopupLengthUnit, type WebPopupLengthRange, type WebPopupValueRef, type WebPopupTemplate, type WebPopupFormField, type WebPopupFormFieldKind, type WebPopupFormPrivacy, type WebPopupFormSubmitPayload, type WebPopupFormSubmitResult, type WebPopupFormSubmitHandler, type WebPopupEmailInputSlot, type WebPopupTagInputSlot, type WebPopupConsentSlot, type WebPopupSubmitSlot, type WebPopupFormValues, type WebPopupFormValuesSubmitResult, type WebPopupFormValuesSubmitHandler, type WebPopupTimerSlot, type WebPopupTimerExpireAction, type WebPopupTimerRemaining, type WebPopupChoiceSlot, type WebPopupChoiceOption, type WebPopupChoiceControl, type WebPopupChoiceSubmitPayload, type WebPopupChoiceSubmitHandler, type WebPopupRatingSlot, type WebPopupRatingScale, type WebPopupRatingSubmitMode, type WebPopupRatingSubmitPayload, type WebPopupRatingSubmitHandler, type WebPopupSubscribeResult, type WebPopupSubscribeOutcome, type WebPopupLogger, type WebPopupGlyphSlot, type WebPopupGlyphName, type WebPopupGlyphSize, type WebPopupProductsSlot, type WebPopupProductsStrategy, type WebPopupProductsLayout, type WebPopupProductsFields, type WebPopupProduct, type WebPopupProductsHost, type WebPopupSlotViewProps, } from './types';
13
+ export { type WebPopupJson, type WebPopupKind, type WebPopupParams, type WebPopupColors, type WebPopupChrome, type WebPopupPageParams, type WebPopupResolvedPage, type WebPopupDark, type WebPopupResolvedColors, type WebPopupColorScheme, type WebPopupColorSchemePref, type WebPopupSlot, type WebPopupImage, type WebPopupVideo, type WebPopupPlacement, type WebPopupOverlay, type WebPopupAnimation, type WebPopupButtonAction, type WebPopupButtonVariant, type WebPopupTextVariant, type WebPopupTextAlign, type WebPopupDirection, type WebPopupVAnchor, type WebPopupHAnchor, type WebPopupReaderMode, type WebPopupReaderProps, type WebPopupLeafRenderers, type WebPopupBoxProps, type WebPopupInlineProps, type WebPopupLayoutNode, type WebPopupContainerNode, type WebPopupContentNode, type WebPopupImageNode, type WebPopupContainerType, type WebPopupContainerProps, type WebPopupContentZone, type WebPopupContentTone, type WebPopupCssLength, type WebPopupBoxSides, type WebPopupAlignItems, type WebPopupJustifyContent, type WebPopupValueParam, type WebPopupValueControl, type WebPopupLengthUnit, type WebPopupLengthRange, type WebPopupValueRef, type WebPopupTemplate, type WebPopupFormField, type WebPopupFormFieldKind, type WebPopupFormPrivacy, type WebPopupFormSubmitPayload, type WebPopupFormSubmitResult, type WebPopupFormSubmitHandler, type WebPopupEmailInputSlot, type WebPopupTagInputSlot, type WebPopupConsentSlot, type WebPopupSubmitSlot, type WebPopupFormValues, type WebPopupFormValuesSubmitResult, type WebPopupFormValuesSubmitHandler, type WebPopupTimerSlot, type WebPopupTimerExpireAction, type WebPopupTimerRemaining, type WebPopupChoiceSlot, type WebPopupChoiceOption, type WebPopupChoiceControl, type WebPopupChoiceSubmitPayload, type WebPopupChoiceSubmitHandler, type WebPopupRatingSlot, type WebPopupRatingScale, type WebPopupRatingSubmitMode, type WebPopupRatingSubmitPayload, type WebPopupRatingSubmitHandler, type WebPopupSubscribeResult, type WebPopupSubscribeOutcome, type WebPopupLogger, type WebPopupGlyphSlot, type WebPopupGlyphName, type WebPopupGlyphSize, type WebPopupProductsSlot, type WebPopupProductsStrategy, type WebPopupProductsLayout, type WebPopupProductsFields, type WebPopupProduct, type WebPopupProductsHost, type WebPopupSlotViewProps, } from './types';
@@ -3,7 +3,7 @@ export { WebPopupInline } from './WebPopupInline';
3
3
  export { loadWebPopupProducts } from './productsSlot';
4
4
  export { WEB_POPUP_CLOSE_ATTRIBUTE, WEB_POPUP_SUBMIT_ATTRIBUTE } from './styles';
5
5
  export { WEB_POPUP_TEMPLATES, findWebPopupTemplate } from './templates';
6
- export { parseWebPopupJson, stringifyWebPopup, resolveWebPopupPages, resolveWebPopupPageSize, startPageOf, safeUrl, sanitizeWebPopupHtml, normalizeWebPopupColors, normalizeWebPopupValues, webPopupValuesMap, collectWebPopupFormCodes, collectWebPopupProductSlots, webPopupExpired, normalizeWebPopupDark, WEB_POPUP_MAX_SIZE_PX, isWebPopupCloseButton, webPopupPageWithoutCloseButtons, webPopupParamsWithoutCloseButtons } from './helpers';
6
+ export { parseWebPopupJson, stringifyWebPopup, resolveWebPopupPages, resolveWebPopupPageSize, startPageOf, safeUrl, sanitizeWebPopupHtml, normalizeWebPopupColors, normalizeWebPopupValues, webPopupValuesMap, collectWebPopupFormCodes, collectWebPopupProductSlots, webPopupExpired, normalizeWebPopupDark, WEB_POPUP_MAX_SIZE_PX, isWebPopupCloseButton, webPopupPageWithoutCloseButtons, webPopupParamsWithoutCloseButtons, webPopupDirection, webPopupCssTextAlign } from './helpers';
7
7
  export { webPopupHasForm } from './form';
8
8
  export { webPopupTimerLabels, webPopupTimerRemaining, webPopupTimeZoneSupported, webPopupWallClockMs } from './timer';
9
9
  export { normalizeWebPopupLayout, substituteWebPopupLayoutValues, WEB_POPUP_VALUE_KEY_PATTERN, webPopupBackgroundImageStyle, webPopupContainerStyle, webPopupCssLength, webPopupPaddingValue, webPopupTracksValue } from './layout';
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
2
2
  /** Text styles a slot can use ('icon' = emoji line, 'eyebrow' = small caps kicker). */
3
3
  export type WebPopupTextVariant = 'icon' | 'eyebrow' | 'h1' | 'h2' | 'h3' | 'body' | 'caption';
4
4
  export type WebPopupTextAlign = 'left' | 'center' | 'right';
5
+ export type WebPopupDirection = 'ltr' | 'rtl';
5
6
  export type WebPopupButtonVariant = 'primary' | 'secondary';
6
7
  /**
7
8
  * What a button does: open a URL, dismiss the popup, switch to another page
@@ -574,6 +575,8 @@ export type WebPopupParams = WebPopupChrome & {
574
575
  pages: WebPopupPageParams[];
575
576
  /** Key of the page shown first; absent/unknown = the first page. */
576
577
  startPage?: string;
578
+ /** Text direction; absent = detected from the copy (mostly RTL letters = 'rtl'). */
579
+ dir?: WebPopupDirection;
577
580
  };
578
581
  export type WebPopupKind = {
579
582
  id: string;