@pushwoosh/websdk-common 6.19.0 → 6.20.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.
- package/package.json +4 -1
- package/web-popups/WebPopupInline.d.ts +8 -0
- package/web-popups/WebPopupInline.js +46 -0
- package/web-popups/constants.d.ts +2 -0
- package/web-popups/constants.js +2 -0
- package/web-popups/helpers.d.ts +7 -1
- package/web-popups/helpers.js +28 -0
- package/web-popups/index.d.ts +4 -3
- package/web-popups/index.js +3 -2
- package/web-popups/styles.d.ts +7 -0
- package/web-popups/styles.js +9 -0
- package/web-popups/types.d.ts +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushwoosh/websdk-common",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.20.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",
|
|
@@ -31,7 +31,10 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/react": "^18.3.31",
|
|
34
|
+
"@types/react-dom": "^18.3.7",
|
|
35
|
+
"jsdom": "^26.1.0",
|
|
34
36
|
"react": "^18.3.1",
|
|
37
|
+
"react-dom": "^18.3.1",
|
|
35
38
|
"typescript": "^6.0.3",
|
|
36
39
|
"vitest": "^4.1.10"
|
|
37
40
|
},
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type WebPopupInlineProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* An Inline (EMBEDDED) block: one page box at its container's full width (the page width is ignored),
|
|
4
|
+
* without close-action buttons or ✕. Close requests are ignored — a block is part of the page.
|
|
5
|
+
* `<img>` is capped by a `<style>` scoped to the wrapper's attribute, so the rule never reaches
|
|
6
|
+
* the host page, in a shadow root or in the light DOM. Page navigation is internal.
|
|
7
|
+
*/
|
|
8
|
+
export declare function WebPopupInline({ params, mode, colorScheme, onSubmitForm, onSubmitChoice, onSubmitRating, onRequestSubscribe, }: WebPopupInlineProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { useColorScheme } from './colorScheme';
|
|
4
|
+
import { resolveWebPopupPages, startPageOf, webPopupParamsWithoutCloseButtons } from './helpers';
|
|
5
|
+
import { webPopupDarkEnabled } from './palette';
|
|
6
|
+
import { WEB_POPUP_INLINE_IMAGE_CAP_CSS, WEB_POPUP_INLINE_SCOPE_ATTRIBUTE, WEB_POPUP_INLINE_WRAPPER_STYLE } from './styles';
|
|
7
|
+
import { WebPopupBox } from './WebPopupReader';
|
|
8
|
+
/**
|
|
9
|
+
* An Inline (EMBEDDED) block: one page box at its container's full width (the page width is ignored),
|
|
10
|
+
* without close-action buttons or ✕. Close requests are ignored — a block is part of the page.
|
|
11
|
+
* `<img>` is capped by a `<style>` scoped to the wrapper's attribute, so the rule never reaches
|
|
12
|
+
* the host page, in a shadow root or in the light DOM. Page navigation is internal.
|
|
13
|
+
*/
|
|
14
|
+
export function WebPopupInline({
|
|
15
|
+
params,
|
|
16
|
+
mode = 'live',
|
|
17
|
+
colorScheme = 'auto',
|
|
18
|
+
onSubmitForm,
|
|
19
|
+
onSubmitChoice,
|
|
20
|
+
onSubmitRating,
|
|
21
|
+
onRequestSubscribe
|
|
22
|
+
}) {
|
|
23
|
+
const [pageKey, setPageKey] = useState(null);
|
|
24
|
+
const shown = useMemo(() => webPopupParamsWithoutCloseButtons(params), [params]);
|
|
25
|
+
const scheme = useColorScheme(colorScheme, webPopupDarkEnabled(shown));
|
|
26
|
+
const pages = resolveWebPopupPages(shown);
|
|
27
|
+
if (pages.length === 0) return null;
|
|
28
|
+
const page = pages.find(candidate => candidate.key === pageKey) ?? startPageOf(shown, pages);
|
|
29
|
+
return _jsxs("div", {
|
|
30
|
+
[WEB_POPUP_INLINE_SCOPE_ATTRIBUTE]: '',
|
|
31
|
+
style: WEB_POPUP_INLINE_WRAPPER_STYLE,
|
|
32
|
+
children: [_jsx("style", {
|
|
33
|
+
children: WEB_POPUP_INLINE_IMAGE_CAP_CSS
|
|
34
|
+
}), _jsx(WebPopupBox, {
|
|
35
|
+
page: page,
|
|
36
|
+
params: shown,
|
|
37
|
+
mode: mode,
|
|
38
|
+
colorScheme: scheme,
|
|
39
|
+
onPageChange: setPageKey,
|
|
40
|
+
onSubmitForm: onSubmitForm,
|
|
41
|
+
onSubmitChoice: onSubmitChoice,
|
|
42
|
+
onSubmitRating: onSubmitRating,
|
|
43
|
+
onRequestSubscribe: onRequestSubscribe
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -22,6 +22,8 @@ export declare const WEB_POPUP_ON_ACCENT_COLOR = "#FFFFFF";
|
|
|
22
22
|
export declare const WEB_POPUP_DEFAULT_COLORS: WebPopupColors;
|
|
23
23
|
/** Fallback width used when a fixed-width context needs a number anyway. */
|
|
24
24
|
export declare const WEB_POPUP_DEFAULT_WIDTH = 360;
|
|
25
|
+
/** Max height of an `<img>` in an Inline block: at full container width a side image would be too tall. */
|
|
26
|
+
export declare const WEB_POPUP_INLINE_IMAGE_MAX_HEIGHT = 360;
|
|
25
27
|
export declare const WEB_POPUP_TEXT_VARIANT_STYLES: Record<WebPopupTextVariant, CSSProperties>;
|
|
26
28
|
/**
|
|
27
29
|
* A text slot's color: the palette's main/secondary role by variant; in an
|
package/web-popups/constants.js
CHANGED
|
@@ -30,6 +30,8 @@ export const WEB_POPUP_DEFAULT_COLORS = {
|
|
|
30
30
|
};
|
|
31
31
|
/** Fallback width used when a fixed-width context needs a number anyway. */
|
|
32
32
|
export const WEB_POPUP_DEFAULT_WIDTH = 360;
|
|
33
|
+
/** Max height of an `<img>` in an Inline block: at full container width a side image would be too tall. */
|
|
34
|
+
export const WEB_POPUP_INLINE_IMAGE_MAX_HEIGHT = 360;
|
|
33
35
|
// Per-variant text styles — the same numbers the editor's canvas derives from
|
|
34
36
|
// its theme presets. No colors here: those come from the popup palette via
|
|
35
37
|
// webPopupTextColor below.
|
package/web-popups/helpers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type WebPopupColors, type WebPopupDark, type WebPopupJson, type WebPopupParams, type WebPopupPlacement, type WebPopupResolvedPage, type WebPopupValueParam } from './types';
|
|
1
|
+
import { type WebPopupColors, type WebPopupDark, type WebPopupJson, type WebPopupPageParams, type WebPopupParams, type WebPopupPlacement, type WebPopupResolvedPage, 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
|
|
@@ -81,4 +81,10 @@ export declare function resolveWebPopupPages(params: WebPopupParams): WebPopupRe
|
|
|
81
81
|
/** The page shown first: startPage when it exists, else the first page. */
|
|
82
82
|
export declare function startPageOf(params: WebPopupParams, pages: WebPopupResolvedPage[]): WebPopupResolvedPage;
|
|
83
83
|
export declare function placementMaxSize(placement: WebPopupPlacement): string;
|
|
84
|
+
/** Whether a slot is a button with the `close` action; anything malformed reads as false. */
|
|
85
|
+
export declare function isWebPopupCloseButton(slot: unknown): boolean;
|
|
86
|
+
/** A copy of one page without close-action buttons; tolerant of non-normalized json. */
|
|
87
|
+
export declare function webPopupPageWithoutCloseButtons(page: WebPopupPageParams): WebPopupPageParams;
|
|
88
|
+
/** A copy of the params without close-action buttons — an Inline (EMBEDDED) block has nothing to close. */
|
|
89
|
+
export declare function webPopupParamsWithoutCloseButtons(params: WebPopupParams): WebPopupParams;
|
|
84
90
|
export {};
|
package/web-popups/helpers.js
CHANGED
|
@@ -684,4 +684,32 @@ export function startPageOf(params, pages) {
|
|
|
684
684
|
}
|
|
685
685
|
export function placementMaxSize(placement) {
|
|
686
686
|
return `calc(100% - ${placement.offset * 2}px)`;
|
|
687
|
+
}
|
|
688
|
+
/** Whether a slot is a button with the `close` action; anything malformed reads as false. */
|
|
689
|
+
export function isWebPopupCloseButton(slot) {
|
|
690
|
+
const candidate = slot;
|
|
691
|
+
return candidate?.type === 'button' && candidate.action?.type === 'close';
|
|
692
|
+
}
|
|
693
|
+
function zoneWithoutCloseButtons(zone) {
|
|
694
|
+
if (!Array.isArray(zone?.slots)) return zone;
|
|
695
|
+
return {
|
|
696
|
+
...zone,
|
|
697
|
+
slots: zone.slots.filter(slot => !isWebPopupCloseButton(slot))
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
/** A copy of one page without close-action buttons; tolerant of non-normalized json. */
|
|
701
|
+
export function webPopupPageWithoutCloseButtons(page) {
|
|
702
|
+
if (!Array.isArray(page?.contents)) return page;
|
|
703
|
+
return {
|
|
704
|
+
...page,
|
|
705
|
+
contents: page.contents.map(zoneWithoutCloseButtons)
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
/** A copy of the params without close-action buttons — an Inline (EMBEDDED) block has nothing to close. */
|
|
709
|
+
export function webPopupParamsWithoutCloseButtons(params) {
|
|
710
|
+
if (!Array.isArray(params?.pages)) return params;
|
|
711
|
+
return {
|
|
712
|
+
...params,
|
|
713
|
+
pages: params.pages.map(webPopupPageWithoutCloseButtons)
|
|
714
|
+
};
|
|
687
715
|
}
|
package/web-popups/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { WebPopupReader, WebPopupBox, WebPopupSlotView } from './WebPopupReader';
|
|
2
|
+
export { WebPopupInline } from './WebPopupInline';
|
|
2
3
|
export { WEB_POPUP_TEMPLATES, findWebPopupTemplate } from './templates';
|
|
3
|
-
export { parseWebPopupJson, stringifyWebPopup, resolveWebPopupPages, resolveWebPopupPageSize, startPageOf, safeUrl, sanitizeWebPopupHtml, normalizeWebPopupColors, normalizeWebPopupValues, webPopupValuesMap, collectWebPopupFormCodes, webPopupExpired, normalizeWebPopupDark, WEB_POPUP_MAX_SIZE_PX, } from './helpers';
|
|
4
|
+
export { parseWebPopupJson, stringifyWebPopup, resolveWebPopupPages, resolveWebPopupPageSize, startPageOf, safeUrl, sanitizeWebPopupHtml, normalizeWebPopupColors, normalizeWebPopupValues, webPopupValuesMap, collectWebPopupFormCodes, webPopupExpired, normalizeWebPopupDark, WEB_POPUP_MAX_SIZE_PX, isWebPopupCloseButton, webPopupPageWithoutCloseButtons, webPopupParamsWithoutCloseButtons, } from './helpers';
|
|
4
5
|
export { webPopupTimerLabels, webPopupTimerRemaining, webPopupTimeZoneSupported, webPopupWallClockMs, type WebPopupTimerLabels, } from './timer';
|
|
5
6
|
export { normalizeWebPopupLayout, substituteWebPopupLayoutValues, WEB_POPUP_VALUE_KEY_PATTERN, webPopupBackgroundImageStyle, webPopupContainerStyle, webPopupCssLength, webPopupPaddingValue, webPopupTracksValue, } from './layout';
|
|
6
|
-
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_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_CHOICE_DEFAULTS, WEB_POPUP_MAX_CHOICE_OPTIONS, WEB_POPUP_RATING_DEFAULTS, WEB_POPUP_RETRY_ERROR, webPopupRatingScores, } from './constants';
|
|
7
|
+
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_CHOICE_DEFAULTS, WEB_POPUP_MAX_CHOICE_OPTIONS, WEB_POPUP_RATING_DEFAULTS, WEB_POPUP_RETRY_ERROR, webPopupRatingScores, } from './constants';
|
|
7
8
|
export { resolveWebPopupBoxChrome, resolveWebPopupColors, autoDarkWebPopupColors, webPopupColorAlpha, webPopupDarkColors, webPopupDarkEnabled, webPopupEffectiveScheme, webPopupImageSrc, webPopupMixColor, webPopupShiftColor, } from './palette';
|
|
8
9
|
export { WEB_POPUP_GLYPH_NAMES, WEB_POPUP_GLYPH_PATHS, WEB_POPUP_GLYPH_SIZES, WEB_POPUP_THUMB_UP_PATH, } from './glyphs';
|
|
9
|
-
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 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 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 WebPopupGlyphSlot, type WebPopupGlyphName, type WebPopupGlyphSize, type WebPopupSlotViewProps, } from './types';
|
|
10
|
+
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 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 WebPopupGlyphSlot, type WebPopupGlyphName, type WebPopupGlyphSize, type WebPopupSlotViewProps, } from './types';
|
package/web-popups/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { WebPopupReader, WebPopupBox, WebPopupSlotView } from './WebPopupReader';
|
|
2
|
+
export { WebPopupInline } from './WebPopupInline';
|
|
2
3
|
export { WEB_POPUP_TEMPLATES, findWebPopupTemplate } from './templates';
|
|
3
|
-
export { parseWebPopupJson, stringifyWebPopup, resolveWebPopupPages, resolveWebPopupPageSize, startPageOf, safeUrl, sanitizeWebPopupHtml, normalizeWebPopupColors, normalizeWebPopupValues, webPopupValuesMap, collectWebPopupFormCodes, webPopupExpired, normalizeWebPopupDark, WEB_POPUP_MAX_SIZE_PX } from './helpers';
|
|
4
|
+
export { parseWebPopupJson, stringifyWebPopup, resolveWebPopupPages, resolveWebPopupPageSize, startPageOf, safeUrl, sanitizeWebPopupHtml, normalizeWebPopupColors, normalizeWebPopupValues, webPopupValuesMap, collectWebPopupFormCodes, webPopupExpired, normalizeWebPopupDark, WEB_POPUP_MAX_SIZE_PX, isWebPopupCloseButton, webPopupPageWithoutCloseButtons, webPopupParamsWithoutCloseButtons } from './helpers';
|
|
4
5
|
export { webPopupTimerLabels, webPopupTimerRemaining, webPopupTimeZoneSupported, webPopupWallClockMs } from './timer';
|
|
5
6
|
export { normalizeWebPopupLayout, substituteWebPopupLayoutValues, WEB_POPUP_VALUE_KEY_PATTERN, webPopupBackgroundImageStyle, webPopupContainerStyle, webPopupCssLength, webPopupPaddingValue, webPopupTracksValue } from './layout';
|
|
6
|
-
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, WEB_POPUP_DEFAULT_WIDTH, 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_CHOICE_DEFAULTS, WEB_POPUP_MAX_CHOICE_OPTIONS, WEB_POPUP_RATING_DEFAULTS, WEB_POPUP_RETRY_ERROR, webPopupRatingScores } from './constants';
|
|
7
|
+
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, 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_CHOICE_DEFAULTS, WEB_POPUP_MAX_CHOICE_OPTIONS, WEB_POPUP_RATING_DEFAULTS, WEB_POPUP_RETRY_ERROR, webPopupRatingScores } from './constants';
|
|
7
8
|
export { resolveWebPopupBoxChrome, resolveWebPopupColors, autoDarkWebPopupColors, webPopupColorAlpha, webPopupDarkColors, webPopupDarkEnabled, webPopupEffectiveScheme, webPopupImageSrc, webPopupMixColor, webPopupShiftColor } from './palette';
|
|
8
9
|
export { WEB_POPUP_GLYPH_NAMES, WEB_POPUP_GLYPH_PATHS, WEB_POPUP_GLYPH_SIZES, WEB_POPUP_THUMB_UP_PATH } from './glyphs';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
/** Marks an Inline block's wrapper; the image cap is scoped to it so it never reaches the host page. */
|
|
3
|
+
export declare const WEB_POPUP_INLINE_SCOPE_ATTRIBUTE = "data-pw-web-popup-inline";
|
|
4
|
+
/** An Inline block fills its container: the page's own width only sizes a floating popup. */
|
|
5
|
+
export declare const WEB_POPUP_INLINE_WRAPPER_STYLE: CSSProperties;
|
|
6
|
+
/** Image-cap stylesheet of an Inline block, scoped by WEB_POPUP_INLINE_SCOPE_ATTRIBUTE. */
|
|
7
|
+
export declare const WEB_POPUP_INLINE_IMAGE_CAP_CSS = "[data-pw-web-popup-inline] img { max-height: 360px; object-fit: cover; }";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WEB_POPUP_INLINE_IMAGE_MAX_HEIGHT } from './constants';
|
|
2
|
+
/** Marks an Inline block's wrapper; the image cap is scoped to it so it never reaches the host page. */
|
|
3
|
+
export const WEB_POPUP_INLINE_SCOPE_ATTRIBUTE = 'data-pw-web-popup-inline';
|
|
4
|
+
/** An Inline block fills its container: the page's own width only sizes a floating popup. */
|
|
5
|
+
export const WEB_POPUP_INLINE_WRAPPER_STYLE = {
|
|
6
|
+
width: '100%'
|
|
7
|
+
};
|
|
8
|
+
/** Image-cap stylesheet of an Inline block, scoped by WEB_POPUP_INLINE_SCOPE_ATTRIBUTE. */
|
|
9
|
+
export const WEB_POPUP_INLINE_IMAGE_CAP_CSS = `[${WEB_POPUP_INLINE_SCOPE_ATTRIBUTE}] img { max-height: ${WEB_POPUP_INLINE_IMAGE_MAX_HEIGHT}px; object-fit: cover; }`;
|
package/web-popups/types.d.ts
CHANGED
|
@@ -658,3 +658,19 @@ export type WebPopupBoxProps = {
|
|
|
658
658
|
/** `subscribe`-action buttons; absent = they render inert (previews, editor). */
|
|
659
659
|
onRequestSubscribe?: () => Promise<WebPopupSubscribeResult>;
|
|
660
660
|
};
|
|
661
|
+
/** Props of WebPopupInline — an Inline (EMBEDDED) block: full container width, nothing closes it. */
|
|
662
|
+
export type WebPopupInlineProps = {
|
|
663
|
+
params: WebPopupParams;
|
|
664
|
+
/** Default 'live'; 'preview' reaches the leaves: no autoplay, no interval. */
|
|
665
|
+
mode?: WebPopupReaderMode;
|
|
666
|
+
/** Palette to draw with; default 'auto' — the visitor's OS setting, watched live. */
|
|
667
|
+
colorScheme?: WebPopupColorSchemePref;
|
|
668
|
+
/** Form-slot submits; absent = form slots render inert. */
|
|
669
|
+
onSubmitForm?: WebPopupFormSubmitHandler;
|
|
670
|
+
/** Choice-slot submits; absent = choice slots render inert. */
|
|
671
|
+
onSubmitChoice?: WebPopupChoiceSubmitHandler;
|
|
672
|
+
/** Rating-slot submits; absent = rating slots render inert. */
|
|
673
|
+
onSubmitRating?: WebPopupRatingSubmitHandler;
|
|
674
|
+
/** `subscribe`-action buttons; absent = they render inert. */
|
|
675
|
+
onRequestSubscribe?: () => Promise<WebPopupSubscribeResult>;
|
|
676
|
+
};
|