web-push-notifications 3.100.0 → 3.103.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/core/Pushwoosh.d.ts +12 -1
  3. package/helpers/pagePath.d.ts +2 -0
  4. package/modules/Api/Api.d.ts +3 -1
  5. package/modules/ApiClient/ApiClient.d.ts +1 -0
  6. package/modules/ApiClient/ApiClient.types.d.ts +11 -2
  7. package/modules/SdkUsage/SdkUsage.d.ts +19 -0
  8. package/npm.js +1 -1
  9. package/npm.js.map +1 -1
  10. package/package.json +2 -2
  11. package/service-worker.js +1 -1
  12. package/service-worker.js.map +1 -1
  13. package/widget-inbox.js.map +1 -1
  14. package/widget-subscription.js +1 -1
  15. package/widget-subscription.js.map +1 -1
  16. package/widget-web-popups.js +1 -1
  17. package/widget-web-popups.js.map +1 -1
  18. package/widgets/WebPopups/EmbeddedWebPopups.d.ts +2 -0
  19. package/widgets/WebPopups/WebPopupsWidget.d.ts +9 -11
  20. package/widgets/WebPopups/embeddedRenderer.d.ts +2 -2
  21. package/widgets/WebPopups/interactions.d.ts +2 -0
  22. package/widgets/WebPopups/pushPermissionCondition.d.ts +4 -0
  23. package/widgets/WebPopups/types.d.ts +1 -0
  24. package/widgets/WebPopups/webPopupLogger.d.ts +2 -0
  25. package/pushwoosh-widget-subscription-prompt.d.ts +0 -1
  26. package/pushwoosh-widget-subscription.d.ts +0 -1
  27. package/pushwoosh-widget-web-popups.d.ts +0 -1
  28. /package/{pushwoosh-web-notifications.d.ts → core/__tests__/changePermissionEvent.test.d.ts} +0 -0
  29. /package/{pushwoosh-widget-inbox.d.ts → core/__tests__/siteOpenedEvent.test.d.ts} +0 -0
  30. /package/{pushwoosh-widget-recommendations.d.ts → modules/SdkUsage/__tests__/SdkUsage.test.d.ts} +0 -0
  31. /package/{pushwoosh-widget-subscribe-popup.d.ts → widgets/WebPopups/__tests__/interactions.test.d.ts}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3N,KAAKqN,GAAGmB,QAAQgG,eAAeJ,KAAMhJ,IACnCpL,KAAKsQ,oBAAoBlF,KAE3BpL,KAAKqN,GAAGmB,QAAQiG,sBAAsBL,KAAMhE,IAC1CpQ,KAAKiP,cAAcmB,IAEvB,CAEQ,oBAAAT,CAAqB/E,GAC3B,MAAMW,EAAUvL,KAAKoL,SAAS6I,KAAMS,GAAuCA,EAAK9J,OAASA,GAIrFW,GAAWA,EAAQoJ,cACrB3U,KAAKiO,QAAO,GAGdjO,KAAKqN,GAAGmB,QAAQoG,gCAAgChK,GAC7CwJ,KAAK,KACJpU,KAAK2N,eAEX,CAEQ,cAAAiC,CAAexE,GAGrBpL,KAAKgP,UAAYhP,KAAKgP,UAAU3K,OAAQuG,IAA6C,IAA5BQ,EAASvD,QAAQ+C,IAC1E5K,KAAKqN,GAAGmB,QAAQqG,wBAAwBzJ,GACrCgJ,KAAK,KACJpU,KAAK2N,eAEX,CAIQ,qBAAAI,CAAsBpF,GAC5BA,EAAMC,kBACDD,EAAMmM,QAIX9U,KAAKiO,QACP,CAGQ,oBAAAH,CAAqBnF,GACtBA,EAAMmM,SAIQnM,EAAMmM,OAAQC,QAAQ,mBACvC/U,KAAKiO,SAET,CAEQ,qBAAAD,GACFhO,KAAKqI,SAAWrI,KAAKqO,SACvBrO,KAAKiO,SAGPjO,KAAK8Q,gBACP","sources":["webpack://web-push-notifications/webpack/universalModuleDefinition","webpack://web-push-notifications/external umd {\"commonjs\":\"preact\",\"commonjs2\":\"preact\",\"amd\":\"preact\",\"root\":\"preact\"}","webpack://web-push-notifications/external umd {\"commonjs\":\"preact/compat\",\"commonjs2\":\"preact/compat\",\"amd\":\"preact/compat\",\"root\":\"preactCompat\"}","webpack://web-push-notifications/external umd {\"commonjs\":\"preact/jsx-runtime\",\"commonjs2\":\"preact/jsx-runtime\",\"amd\":\"preact/jsx-runtime\",\"root\":\"jsxRuntime\"}","webpack://web-push-notifications/webpack/bootstrap","webpack://web-push-notifications/webpack/runtime/define property getters","webpack://web-push-notifications/webpack/runtime/hasOwnProperty shorthand","webpack://web-push-notifications/webpack/runtime/make namespace object","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/inbox/constants.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/inbox/helpers.js","webpack://web-push-notifications/./src/widgets/Inbox/constants.ts","webpack://web-push-notifications/./src/widgets/Inbox/helpers.ts","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/inbox/InboxWidgetReader.js","webpack://web-push-notifications/./src/widgets/Inbox/renderer.tsx","webpack://web-push-notifications/./src/helpers/cssColor.ts","webpack://web-push-notifications/./src/helpers/cssVariables.ts","webpack://web-push-notifications/./src/helpers/url.ts","webpack://web-push-notifications/./src/widgets/Inbox/InboxWidget.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"preact\"), require(\"preact/compat\"), require(\"preact/jsx-runtime\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"preact\", \"preact/compat\", \"preact/jsx-runtime\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"preact\"), require(\"preact/compat\"), require(\"preact/jsx-runtime\")) : factory(root[\"preact\"], root[\"preactCompat\"], root[\"jsxRuntime\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, (__WEBPACK_EXTERNAL_MODULE__524__, __WEBPACK_EXTERNAL_MODULE__873__, __WEBPACK_EXTERNAL_MODULE__247__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__524__;","module.exports = __WEBPACK_EXTERNAL_MODULE__873__;","module.exports = __WEBPACK_EXTERNAL_MODULE__247__;","// The module cache\nconst __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tconst cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tconst module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter/value functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop));","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/** The sending pipeline and the editor keep at most this many carousel slides. */\nexport const INBOX_MAX_CAROUSEL_SLIDES = 5;\n/** Layouts a cell can draw; anything else falls back to the heuristic. */\nexport const INBOX_KNOWN_LAYOUTS = ['classic', 'captioned', 'banner', 'carousel'];\n/** Prefix of the widget's CSS custom properties: `--pw-inbox-<name>`, a public API customers override from their CSS. */\nexport const INBOX_WIDGET_STYLE_PREFIX = 'pw-inbox';\n/** Month labels of the absolute message dates. */\nexport const INBOX_MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'];\n/** Appearance values exposed as CSS custom properties, with their formatting. */\nexport const INBOX_WIDGET_STYLE_VARIABLES = [{\n name: 'widgetWidth',\n type: 'size'\n}, {\n name: 'borderRadius',\n type: 'size'\n}, {\n name: 'zIndex',\n type: 'number'\n}, {\n name: 'fontFamily',\n type: 'string'\n}, {\n name: 'bgColor',\n type: 'color'\n}, {\n name: 'textColor',\n type: 'color'\n}, {\n name: 'arrowBorderColor',\n type: 'color'\n}, {\n name: 'borderColor',\n type: 'color'\n}, {\n name: 'badgeBgColor',\n type: 'color'\n}, {\n name: 'badgeTextColor',\n type: 'color'\n}, {\n name: 'timeTextColor',\n type: 'color'\n}, {\n name: 'messageTitleColor',\n type: 'color'\n}, {\n name: 'emptyInboxTitleColor',\n type: 'color'\n}, {\n name: 'emptyInboxTextColor',\n type: 'color'\n}, {\n name: 'unreadDotColor',\n type: 'color'\n}, {\n name: 'avatarBgColor',\n type: 'color'\n}, {\n name: 'avatarTextColor',\n type: 'color'\n}, {\n name: 'avatarSize',\n type: 'size'\n}, {\n name: 'mediaRadius',\n type: 'size'\n}, {\n name: 'slideCaptionColor',\n type: 'color'\n}, {\n name: 'slideScrimColor',\n type: 'color'\n}, {\n name: 'pagerDotActiveColor',\n type: 'color'\n}, {\n name: 'pagerDotColor',\n type: 'color'\n}];\n/** Default appearance of the web inbox widget. */\nexport const INBOX_WIDGET_DEFAULT_APPEARANCE = {\n title: 'Inbox',\n bgColor: '#ffffff',\n textColor: '#333333',\n fontFamily: 'inherit',\n borderRadius: 4,\n borderColor: 'transparent',\n badgeBgColor: '#ff4c00',\n badgeTextColor: '#ffffff',\n widgetWidth: 350,\n zIndex: 100,\n messageTitleColor: '#7a7a7a',\n timeTextColor: '#c4c4c4',\n emptyInboxTitle: 'You\\'re all caught up',\n emptyInboxTitleColor: '#333333',\n emptyInboxText: 'There are no new messages. Stay tuned!',\n emptyInboxTextColor: '#7a7a7a',\n emptyInboxIconUrl: 'https://pushon.pushwoosh.com/static/icon-empty-inbox.png',\n arrowBorderColor: 'rgba(0,0,0,.1)',\n legacyClassicCell: false,\n unreadDotColor: '#00a2ff',\n avatarBgColor: '#c4c8cc',\n avatarTextColor: '#4b5057',\n avatarSize: 52,\n mediaRadius: 8,\n slideCaptionColor: '#ffffff',\n slideScrimColor: 'rgba(0,0,0,.45)',\n pagerDotActiveColor: '#00a2ff',\n pagerDotColor: '#ebf0f5'\n};\n/** Stylesheet of the web inbox widget and its trigger badge; class names and custom properties are public API. */\nexport const INBOX_WIDGET_CSS = `\n.pw-inbox-trigger {\n position: relative;\n cursor: pointer;\n}\n\n.pw-inbox-trigger:after {\n content: attr(data-pw-count);\n display: block;\n position: absolute;\n right: 0;\n top: 0;\n background: var(--pw-inbox-badgeBgColor, #ff4c00);\n border-radius: 8px;\n color: var(--pw-inbox-badgeTextColor, #ffffff);\n font-size: 10px;\n font-weight: normal;\n line-height: 16px;\n width: 16px;\n padding: 0 2px;\n box-sizing: border-box;\n text-align: center;\n}\n\n.pw-inbox-trigger.pw-empty:after {\n display: none;\n}\n\n.pw-inbox-widget * {\n position: static;\n box-sizing: border-box;\n font-size: 1em;\n outline: none;\n font-family: var(--pw-inbox-fontFamily, inherit);\n}\n.pw-inbox-widget {\n font-size: 14px;\n position: absolute;\n top: 0;\n left: -1000px;\n background: var(--pw-inbox-bgColor, #ffffff);\n border: solid 1px var(--pw-inbox-borderColor, transparent);\n border-radius: var(--pw-inbox-borderRadius, 4px);\n width: var(--pw-inbox-widgetWidth, 350px);\n box-shadow: 0 1px 4px 0 rgba(0,0,0,.25);\n z-index: var(--pw-inbox-zIndex, 100);\n opacity: 0;\n transition: opacity .6s ease;\n transition-delay: 100ms;\n}\n.pw-inbox-widget.pw-open {\n opacity: 1;\n transition-delay: 0ms;\n}\n.pw-inbox-widget.pw-inbox-widget--inset {\n top: auto;\n left: auto;\n display: none;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-open {\n display: block;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-bottom {\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-top {\n bottom: 100%;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-right {\n left: 100%;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-left {\n right: 100%;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--empty {\n max-height: none;\n}\n.pw-inbox-widget .pw-inbox__arrow {\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget .pw-inbox__arrow:before {\n content: \"\";\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget.pw-top {\n margin-top: -12px;\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow {\n border-top-color: var(--pw-inbox-arrowBorderColor, rgba(0,0,0,.1));\n bottom: -21px;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow:before {\n border-top-color: var(--pw-inbox-bgColor, #ffffff);\n top: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-bottom {\n margin-top: 12px;\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow {\n border-bottom-color: var(--pw-inbox-arrowBorderColor, rgba(0,0,0,.1));\n top: -21px;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow:before {\n border-bottom-color: var(--pw-inbox-bgColor, #ffffff);\n bottom: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-left {\n margin-left: -12px;\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow {\n border-left-color: var(--pw-inbox-arrowBorderColor, rgba(0,0,0,.1));\n right: -21px;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow:before {\n border-left-color: var(--pw-inbox-bgColor, #ffffff);\n left: -11px;\n top: -10px;\n}\n.pw-inbox-widget.pw-right {\n margin-left: 12px;\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow {\n border-right-color: var(--pw-inbox-arrowBorderColor, rgba(0,0,0,.1));\n left: -21px;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow:before {\n border-right-color: var(--pw-inbox-bgColor, #ffffff);\n right: -11px;\n top: -10px;\n}\n.pw-inbox_inner {\n overflow: hidden;\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n.pw-inbox_title {\n color: var(--pw-inbox-textColor, #333333);\n margin: 0;\n padding: 28px 32px 12px;\n font-size: 24px;\n font-weight: 500;\n line-height: 1.1;\n text-align: left;\n flex: 0 0 66px;\n}\n.pw-inbox_list {\n overflow-x: hidden;\n overflow-y: auto;\n min-width: 200px;\n max-height: 300px;\n padding: 0;\n margin: 0;\n list-style: none;\n position: relative;\n flex: 1 1 auto;\n}\n\n.pw-inbox_item {\n position: relative;\n padding: 8px 32px;\n margin: 0;\n text-align: left;\n}\n.pw-inbox_item-inner {\n display: flex;\n cursor: pointer;\n}\n.pw-inbox_icon {\n flex: 0 0 auto;\n width: var(--pw-inbox-avatarSize, 52px);\n height: var(--pw-inbox-avatarSize, 52px);\n margin-right: 14px;\n overflow: hidden;\n border-radius: var(--pw-inbox-mediaRadius, 8px);\n background: var(--pw-inbox-avatarBgColor, #c4c8cc);\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.pw-inbox_message-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n}\n.pw-inbox_icon-initial {\n color: var(--pw-inbox-avatarTextColor, #4b5057);\n font-size: 22px;\n line-height: 1;\n font-weight: 700;\n}\n.pw-inbox_content {\n flex: 1 1 auto;\n min-width: 0;\n}\n.pw-inbox_item-title {\n color: var(--pw-inbox-messageTitleColor, #7a7a7a);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n display: flex;\n align-items: center;\n gap: 6px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.pw-inbox_unread-dot {\n flex: 0 0 auto;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--pw-inbox-unreadDotColor, #00a2ff);\n}\n.pw-inbox_item-body {\n color: var(--pw-inbox-textColor, #333333);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n.pw-inbox_item-time {\n color: var(--pw-inbox-timeTextColor, #c4c4c4);\n font-size: 12px;\n line-height: 17px;\n}\n.pw-inbox_item-remove {\n position: absolute;\n z-index: 2;\n top: 8px;\n right: 8px;\n display: none;\n width: 10px;\n height: 10px;\n background: transparent url('https://cdn.pushwoosh.com/webpush/img/iconClose.svg') 50% no-repeat;\n cursor: pointer;\n}\n.pw-inbox_item:hover .pw-inbox_item-remove {\n display: block;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-title {\n color: var(--pw-inbox-textColor, #333333);\n font-weight: 700;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-body {\n font-weight: 700;\n}\n\n.pw-inbox_list--empty {\n padding: 50px 16px;\n text-align: center;\n max-height: 100%;\n overflow: auto;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-icon {\n text-align: center;\n margin-bottom: 30px;\n}\n.pw-inbox_list--empty .pw-inbox_list-icon img {\n max-width: 100%;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-title {\n font-size: 28px;\n line-height: 36px;\n color: var(--pw-inbox-emptyInboxTitleColor, #333333);\n margin-bottom: 20px;\n}\n\n.pw-inbox_list--empty .ipw-inbox_list-body {\n font-size: 14px;\n line-height: 18px;\n color: var(--pw-inbox-emptyInboxTextColor, #7a7a7a);\n}\n\n/* Cell layouts: banner, captioned and carousel stack their media above the\n texts, so the flex row of the classic cell becomes a column. */\n.pw-inbox_item--banner,\n.pw-inbox_item--captioned,\n.pw-inbox_item--carousel {\n flex-direction: column;\n gap: 12px;\n}\n\n.pw-inbox_media {\n position: relative;\n width: 100%;\n}\n.pw-inbox_hero {\n display: block;\n width: 100%;\n max-width: 100%;\n aspect-ratio: 2 / 1;\n object-fit: cover;\n border-radius: var(--pw-inbox-mediaRadius, 8px);\n}\n\n.pw-inbox_slide {\n position: relative;\n display: block;\n cursor: pointer;\n}\n.pw-inbox_slide-caption {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n padding: 14px 10px 6px;\n color: var(--pw-inbox-slideCaptionColor, #ffffff);\n font-size: 14px;\n line-height: 20px;\n border-radius: 0 0 var(--pw-inbox-mediaRadius, 8px) var(--pw-inbox-mediaRadius, 8px);\n background: linear-gradient(transparent, var(--pw-inbox-slideScrimColor, rgba(0,0,0,.45)));\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n\n.pw-inbox_pager {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n}\n.pw-inbox_dot {\n width: 6px;\n height: 6px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: var(--pw-inbox-pagerDotColor, #ebf0f5);\n cursor: pointer;\n}\n.pw-inbox_dot.pw-active {\n background: var(--pw-inbox-pagerDotActiveColor, #00a2ff);\n}\n\n/* \\`legacyClassicCell\\` restores the pre-3.75 classic cell. Scoped to classic on\n purpose: the three new layouts have no older look to go back to. */\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_icon {\n display: block;\n flex: 0 0 40px;\n width: auto;\n height: auto;\n margin-right: 0;\n border-radius: 0;\n background: none;\n}\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_message-image {\n width: 28px;\n height: auto;\n object-fit: fill;\n}\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_content {\n flex: 0 1 100%;\n}\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_item-title {\n display: block;\n overflow: visible;\n text-overflow: clip;\n white-space: normal;\n}\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_unread-dot {\n display: none;\n}\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_item-body {\n display: block;\n overflow: visible;\n}\n\n.pw-inbox-widget.pw-inbox-widget--preview {\n position: relative;\n top: auto;\n left: auto;\n max-width: 100%;\n opacity: 1;\n transition: none;\n}\n.pw-inbox-widget--preview .pw-inbox__arrow {\n display: none;\n}\n.pw-inbox-widget--cell .pw-inbox_item {\n padding: 16px;\n}\n.pw-inbox_icon--placeholder {\n border: 1px dashed #00a2ff;\n background: #80b7ff33;\n}\n.pw-inbox_hero--placeholder {\n border: 1px dashed #00a2ff;\n background: #80b7ff33;\n}\n`;","import { INBOX_KNOWN_LAYOUTS, INBOX_MAX_CAROUSEL_SLIDES, INBOX_MONTHS, INBOX_WIDGET_DEFAULT_APPEARANCE, INBOX_WIDGET_STYLE_PREFIX, INBOX_WIDGET_STYLE_VARIABLES } from './constants';\nconst MINUTE = 60 * 1000;\nconst HOUR = 60 * MINUTE;\nconst DAY = 24 * HOUR;\nconst RULE_BREAKERS = /[;{}]/;\n/** Picks the content to render: explicit `content` wins, otherwise the `language` entry of `localizedContent` with default/en/first fallbacks. */\nexport function pickInboxLocalizedContent(content, localizedContent, language) {\n if (content) {\n return content;\n }\n if (!localizedContent) {\n return null;\n }\n const keys = Object.keys(localizedContent);\n if (keys.length === 0) {\n return null;\n }\n if (language && localizedContent[language]) {\n return localizedContent[language];\n }\n return localizedContent.default || localizedContent.en || localizedContent[keys[0]];\n}\n/** Slides a cell draws: the ones with an image, at most {@link INBOX_MAX_CAROUSEL_SLIDES}. */\nexport function getInboxValidSlides(slides) {\n return (Array.isArray(slides) ? slides : []).filter(slide => !!slide && !!slide.imageUrl).slice(0, INBOX_MAX_CAROUSEL_SLIDES);\n}\n/** Hero image of the banner/captioned layouts: the banner, with the icon standing in when none was sent. */\nexport function getInboxHeroUrl(content) {\n return content.bannerUrl || content.iconUrl || '';\n}\n/** Resolves the layout a cell draws: the requested one when it can render, the heuristic for unknown ones, classic otherwise. */\nexport function resolveInboxLayout(content) {\n const hasTitle = !!content.title;\n const hasBody = !!content.body;\n const hero = getInboxHeroUrl(content);\n let requested = content.layoutType;\n if (!INBOX_KNOWN_LAYOUTS.includes(requested)) {\n if (content.bannerUrl && !hasTitle) {\n requested = 'banner';\n } else if (content.bannerUrl && hasTitle && hasBody) {\n requested = 'captioned';\n } else {\n requested = 'classic';\n }\n }\n switch (requested) {\n case 'banner':\n return hero ? 'banner' : 'classic';\n case 'captioned':\n return hero && hasTitle && hasBody ? 'captioned' : 'classic';\n case 'carousel':\n return hasTitle && hasBody && getInboxValidSlides(content.carousel).length > 0 ? 'carousel' : 'classic';\n default:\n return 'classic';\n }\n}\n/** True when the content has nothing to render yet, so a preview shows the layout placeholder. */\nexport function isInboxContentEmpty(content) {\n return !content.title && !content.body && !content.iconUrl && !content.bannerUrl && getInboxValidSlides(content.carousel).length === 0;\n}\n/** The layout whose placeholder an empty preview shows: the requested one when known, else classic. */\nexport function getInboxEmptyLayout(content) {\n const requested = content.layoutType;\n return INBOX_KNOWN_LAYOUTS.includes(requested) ? requested : 'classic';\n}\n/** Title/body pair of the mobile cells: in classic the body stands in for a missing title, as the mobile SDKs draw it. */\nexport function getInboxMobileTexts(content, layout) {\n if (layout === 'classic') {\n return {\n title: content.title || content.body || '',\n body: content.title && content.body || ''\n };\n }\n return {\n title: content.title || '',\n body: content.body || ''\n };\n}\n/** The colored initial a classic cell shows when there is no icon. */\nexport function getInboxIconInitial(content) {\n return (content.title || content.body || '?').trim().charAt(0).toUpperCase() || '?';\n}\n/** Date label of a web widget message: relative within a day of `now`, then `D Mon YYYY, H:mm` in local time. */\nexport function formatInboxMessageTime(sendDate, now = Date.now()) {\n const date = new Date(sendDate);\n const gap = now - date.getTime();\n if (gap <= MINUTE) {\n return 'Just now';\n }\n if (gap < HOUR) {\n return `${Math.floor(gap / MINUTE)} minutes ago`;\n }\n if (gap < DAY) {\n return `${Math.floor(gap / HOUR)} hours ago`;\n }\n const minutes = `0${date.getMinutes()}`.slice(-2);\n return `${date.getDate()} ${INBOX_MONTHS[date.getMonth()]} ${date.getFullYear()}, ${date.getHours()}:${minutes}`;\n}\n/** Newest first. */\nexport function compareInboxBySendDate(one, two) {\n return new Date(two).getTime() - new Date(one).getTime();\n}\n/** Full appearance from a partial one; the arrow border follows a visible widget border unless set explicitly. */\nexport function resolveInboxWidgetAppearance(appearance) {\n const {\n borderColor\n } = appearance || {};\n return {\n ...INBOX_WIDGET_DEFAULT_APPEARANCE,\n arrowBorderColor: borderColor && borderColor !== 'transparent' ? borderColor : INBOX_WIDGET_DEFAULT_APPEARANCE.arrowBorderColor,\n ...appearance\n };\n}\n/** One appearance value as its CSS custom property value; `null` leaves it unset so the stylesheet default applies. */\nexport function formatInboxStyleValue(type, value) {\n switch (type) {\n case 'size':\n {\n if (value === null || value === undefined || value === '') {\n return null;\n }\n const size = Number(value);\n return Number.isFinite(size) ? `${size}px` : null;\n }\n case 'number':\n {\n const parsed = parseFloat(String(value));\n return Number.isFinite(parsed) ? String(parsed) : null;\n }\n default:\n {\n const text = String(value ?? '').trim();\n return text && !RULE_BREAKERS.test(text) ? text : null;\n }\n }\n}\n/** The `--pw-inbox-*` custom properties of an appearance, ready for a `style` object or `setProperty`. */\nexport function inboxWidgetStyleVariables(appearance) {\n const variables = {};\n INBOX_WIDGET_STYLE_VARIABLES.forEach(({\n name,\n type\n }) => {\n const formatted = formatInboxStyleValue(type, appearance[name]);\n if (formatted !== null) {\n variables[`--${INBOX_WIDGET_STYLE_PREFIX}-${name}`] = formatted;\n }\n });\n return variables;\n}","import {\n INBOX_WIDGET_DEFAULT_APPEARANCE, INBOX_WIDGET_STYLE_PREFIX, INBOX_WIDGET_STYLE_VARIABLES,\n} from '@pushwoosh/websdk-common/inbox';\n\nimport { type IConfigStyles, type IInboxWidgetConfig, type TStylesNames } from './inbox_widget.types';\n\n/** Shortest gap between two server refreshes triggered by opening the widget. */\nexport const SYNC_INTERVAL = 30 * 1000;\n\nexport const STYLE_PREFIX = INBOX_WIDGET_STYLE_PREFIX;\n\nexport const CONFIG_STYLES: Array<IConfigStyles> = [...INBOX_WIDGET_STYLE_VARIABLES];\n\n// The trigger is the customer's own element, outside the widget root, so the\n// badge rules need their variables set on it too.\nconst TRIGGER_STYLE_NAMES: Array<TStylesNames> = ['badgeBgColor', 'badgeTextColor'];\n\nexport const TRIGGER_CONFIG_STYLES: Array<IConfigStyles> = CONFIG_STYLES\n .filter((style) => TRIGGER_STYLE_NAMES.indexOf(style.name) !== -1);\n\nexport const DEFAULT_CONFIG: IInboxWidgetConfig = {\n enable: false,\n triggerId: 'pwInbox',\n position: 'bottom',\n appendTo: 'body',\n ...INBOX_WIDGET_DEFAULT_APPEARANCE,\n};\n","export function isElementFixed(element: HTMLElement): boolean {\n let isFixed = window.getComputedStyle(element).position === 'fixed';\n if (!isFixed && element.parentElement) {\n isFixed = isElementFixed(element.parentElement);\n }\n return isFixed;\n}\n","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport { INBOX_WIDGET_CSS } from './constants';\nimport { formatInboxMessageTime, getInboxHeroUrl, getInboxIconInitial, getInboxValidSlides, inboxWidgetStyleVariables, resolveInboxLayout, resolveInboxWidgetAppearance } from './helpers';\nfunction stop(handler) {\n return event => {\n event.stopPropagation();\n handler?.();\n };\n}\nfunction Carousel({\n slides,\n alt,\n onSlideLinkClick\n}) {\n const [index, setIndex] = useState(0);\n const active = Math.min(index, slides.length - 1);\n const slide = slides[active];\n const onSlideClick = slide.link ? stop(() => onSlideLinkClick?.(slide.link)) : undefined;\n return _jsxs(\"div\", {\n className: \"pw-inbox_media\",\n children: [_jsxs(\"div\", {\n className: \"pw-inbox_slide\",\n onClick: onSlideClick,\n children: [_jsx(\"img\", {\n alt: slide.caption || alt,\n className: \"pw-inbox_hero\",\n src: slide.imageUrl\n }), !!slide.caption && _jsx(\"span\", {\n className: \"pw-inbox_slide-caption\",\n children: slide.caption\n })]\n }), slides.length > 1 && _jsx(\"div\", {\n className: \"pw-inbox_pager\",\n children: slides.map((_slide, slideIndex) => _jsx(\"button\", {\n className: slideIndex === active ? 'pw-inbox_dot pw-active' : 'pw-inbox_dot',\n onClick: stop(() => setIndex(slideIndex)),\n type: \"button\"\n }, slideIndex))\n })]\n });\n}\nfunction Hero({\n url,\n alt,\n placeholder\n}) {\n return _jsx(\"div\", {\n className: \"pw-inbox_media\",\n children: placeholder ? _jsx(\"div\", {\n className: \"pw-inbox_hero pw-inbox_hero--placeholder\"\n }) : _jsx(\"img\", {\n alt: alt,\n className: \"pw-inbox_hero\",\n src: url\n })\n });\n}\n/** One cell of the web inbox widget, the `li.pw-inbox_item` the WebSDK draws. */\nexport function InboxWebCell(props) {\n const {\n content,\n layout,\n title,\n body,\n timeLabel,\n isRead,\n isActionPerformed,\n code,\n placeholder,\n onClick,\n onRemove,\n onSlideLinkClick\n } = props;\n const alt = content.title || content.body || '';\n const texts = _jsxs(\"div\", {\n className: \"pw-inbox_content\",\n children: [_jsxs(\"div\", {\n className: \"pw-inbox_item-title\",\n children: [title, !isRead && _jsx(\"span\", {\n className: \"pw-inbox_unread-dot\"\n })]\n }), _jsx(\"div\", {\n className: \"pw-inbox_item-body\",\n children: body\n }), _jsx(\"div\", {\n className: \"pw-inbox_item-time\",\n children: timeLabel\n })]\n });\n let media;\n if (layout === 'carousel' && !placeholder) {\n media = _jsx(Carousel, {\n alt: alt,\n onSlideLinkClick: onSlideLinkClick,\n slides: getInboxValidSlides(content.carousel)\n });\n } else if (layout !== 'classic') {\n media = _jsx(Hero, {\n alt: alt,\n placeholder: placeholder,\n url: getInboxHeroUrl(content)\n });\n }\n let icon;\n if (placeholder) {\n icon = _jsx(\"div\", {\n className: \"pw-inbox_icon pw-inbox_icon--placeholder\"\n });\n } else {\n icon = _jsx(\"div\", {\n className: \"pw-inbox_icon\",\n children: content.iconUrl ? _jsx(\"img\", {\n alt: alt,\n className: \"pw-inbox_message-image\",\n src: content.iconUrl\n }) : _jsx(\"span\", {\n className: \"pw-inbox_icon-initial\",\n children: getInboxIconInitial(content)\n })\n });\n }\n const className = ['pw-inbox_item', !isRead && 'pw-new', !isActionPerformed && 'pw-unread'].filter(Boolean).join(' ');\n return _jsxs(\"li\", {\n className: className,\n \"data-pw-inbox-message-id\": code,\n onClick: onClick,\n children: [_jsxs(\"div\", {\n className: `pw-inbox_item-inner pw-inbox_item--${layout}`,\n children: [layout === 'classic' ? icon : media, layout !== 'banner' && texts]\n }), _jsx(\"span\", {\n className: \"pw-inbox_item-remove\",\n onClick: stop(onRemove)\n })]\n });\n}\nfunction WidgetBody({\n messages,\n appearance,\n now,\n onMessageClick,\n onMessageRemove,\n onSlideLinkClick\n}) {\n if (messages.length === 0) {\n return _jsxs(\"div\", {\n className: \"pw-inbox_list--empty\",\n children: [_jsx(\"div\", {\n className: \"pw-inbox_list-icon\",\n children: _jsx(\"img\", {\n alt: appearance.emptyInboxTitle,\n src: appearance.emptyInboxIconUrl\n })\n }), _jsx(\"div\", {\n className: \"pw-inbox_list-title\",\n children: appearance.emptyInboxTitle\n }), _jsx(\"div\", {\n className: \"ipw-inbox_list-body\",\n children: appearance.emptyInboxText\n })]\n });\n }\n return _jsxs(\"div\", {\n className: \"pw-inbox_inner\",\n children: [_jsx(\"div\", {\n className: \"pw-inbox_title\",\n children: appearance.title\n }), _jsx(\"ul\", {\n className: \"pw-inbox_list\",\n children: messages.map(message => _jsx(InboxWebCell, {\n body: message.body,\n code: message.code,\n content: message,\n isActionPerformed: message.isActionPerformed,\n isRead: message.isRead,\n layout: resolveInboxLayout(message),\n onClick: () => onMessageClick?.(message.code),\n onRemove: () => onMessageRemove?.(message.code),\n onSlideLinkClick: link => onSlideLinkClick?.(message.code, link),\n timeLabel: formatInboxMessageTime(message.sendDate, now),\n title: message.title\n }, message.code))\n })]\n });\n}\n/** Classes and custom properties of a preview widget box; a live host sets them on its own element. */\nexport function inboxWidgetPreviewFrame(appearance, extraClass) {\n const className = ['pw-inbox-widget pw-inbox-widget--preview', extraClass, appearance.legacyClassicCell && 'pw-inbox-widget--legacy-cell'].filter(Boolean).join(' ');\n return {\n className,\n style: inboxWidgetStyleVariables(appearance)\n };\n}\n/** The web inbox widget: message list or empty state. `live` fills the host's `.pw-inbox-widget` element, `preview` draws the box inline. */\nexport function InboxWidgetReader(props) {\n const {\n mode,\n messages,\n now,\n onMessageClick,\n onMessageRemove,\n onSlideLinkClick\n } = props;\n const appearance = resolveInboxWidgetAppearance(props.appearance);\n const content = _jsxs(_Fragment, {\n children: [_jsx(\"style\", {\n children: INBOX_WIDGET_CSS\n }), _jsx(\"div\", {\n className: \"pw-inbox__arrow\"\n }), _jsx(WidgetBody, {\n appearance: appearance,\n messages: messages,\n now: now,\n onMessageClick: onMessageClick,\n onMessageRemove: onMessageRemove,\n onSlideLinkClick: onSlideLinkClick\n })]\n });\n if (mode === 'live') {\n return content;\n }\n const frame = inboxWidgetPreviewFrame(appearance, messages.length === 0 ? 'pw-inbox-widget--empty' : undefined);\n return _jsx(\"div\", {\n className: frame.className,\n style: frame.style,\n children: content\n });\n}","import { render } from 'preact';\n\nimport {\n InboxWidgetReader, type InboxWidgetAppearance, type InboxWidgetMessage,\n} from '@pushwoosh/websdk-common/inbox';\n\nimport { type IInboxMessagePublic } from '../../models/InboxMessages.types';\n\n/** Clicks the reader reports back; the widget owns the actions, this module only renders. */\nexport type InboxWidgetHandlers = {\n onMessageClick: (code: string) => void;\n onMessageRemove: (code: string) => void;\n onSlideLinkClick: (code: string, link: string) => void;\n};\n\n// `heroUrl` already carries the icon fallback and `layout` is resolved, so the\n// reader can only degrade it, never re-run the heuristic on the default title.\nexport const toInboxWidgetMessage = (message: IInboxMessagePublic): InboxWidgetMessage => ({\n code: message.code,\n title: message.title,\n body: message.message,\n iconUrl: message.iconUrl,\n bannerUrl: message.heroUrl,\n layoutType: message.layout,\n carousel: message.carousel,\n sendDate: message.sendDate,\n isRead: message.isRead,\n isActionPerformed: message.isActionPerformed,\n});\n\nexport const renderInboxWidget = (\n container: HTMLElement,\n messages: Array<IInboxMessagePublic>,\n appearance: InboxWidgetAppearance,\n handlers: InboxWidgetHandlers,\n): void => {\n render(\n <InboxWidgetReader\n mode=\"live\"\n messages={messages.map(toInboxWidgetMessage)}\n appearance={appearance}\n onMessageClick={handlers.onMessageClick}\n onMessageRemove={handlers.onMessageRemove}\n onSlideLinkClick={handlers.onSlideLinkClick}\n />,\n container,\n );\n};\n","/** Drawn when the configured colour is one the browser would refuse. */\nexport const FALLBACK_COLOR = '#333';\n\n// A colour value never needs these, and they are exactly what would end the\n// declaration or the rule it is interpolated into.\nconst RULE_BREAKERS = /[;{}]/;\n\n// One element, reused: the widgets validate every colour of their config on\n// each render.\nlet probe: HTMLElement | null = null;\n\n/** Keeps a colour the browser accepts, and replaces anything else with {@link FALLBACK_COLOR}. */\nexport function getValidColor(color: string): string {\n if (RULE_BREAKERS.test(color)) {\n return FALLBACK_COLOR;\n }\n\n if (!probe) {\n probe = document.createElement('div');\n }\n\n probe.style.color = '';\n probe.style.color = color;\n\n return probe.style.color ? color : FALLBACK_COLOR;\n}\n","import { getValidColor } from './cssColor';\n\nexport type TStyleVariableType = 'number' | 'color' | 'string' | 'size';\n\nexport interface IStyleVariable<TName extends string = string> {\n name: TName;\n type: TStyleVariableType;\n}\n\nexport function getCssVariableName(prefix: string, name: string): string {\n return `--${prefix}-${name}`;\n}\n\n// `null` means \"leave it unset\": a custom property holding garbage makes every\n// rule that reads it invalid, while an absent one falls back to the stylesheet.\nexport function formatStyleVariable(type: TStyleVariableType, value: string | number | undefined): string | null {\n switch (type) {\n case 'size': {\n const size = Number(value ?? 0);\n return Number.isFinite(size) ? `${size}px` : null;\n }\n case 'number': {\n const parsed = parseFloat(String(value));\n return Number.isFinite(parsed) ? String(parsed) : null;\n }\n case 'color': {\n const color = String(value);\n return getValidColor(color) === color ? color : null;\n }\n default: {\n const text = String(value).trim();\n return text || null;\n }\n }\n}\n\nexport function applyStyleVariables<TName extends string>(\n element: HTMLElement,\n prefix: string,\n variables: Array<IStyleVariable<TName>>,\n values: Record<TName, string | number>,\n): void {\n variables.forEach(({ name, type }) => {\n const formatted = formatStyleVariable(type, values[name]);\n\n if (formatted !== null) {\n element.style.setProperty(getCssVariableName(prefix, name), formatted);\n }\n });\n}\n","// Schemes that run script in the page's own origin; everything else either\n// navigates away or is handed to the OS.\nconst UNSAFE_SCHEME = /^(?:javascript|vbscript|data|blob|file):/i;\nconst HAS_SCHEME = /^[a-z][a-z\\d+\\-.]*:/i;\n\n// Browsers ignore whitespace and control characters while resolving a scheme,\n// so a tab inside \"java<tab>script:\" navigates just as `javascript:` does.\nfunction normalize(url: string): string {\n return url\n .split('')\n .filter((char) => char.charCodeAt(0) > 0x20 && char.charCodeAt(0) !== 0x7F)\n .join('');\n}\n\n/** True when the url is safe to assign to `location.href`. Relative urls qualify. */\nexport function isSafeUrl(url: string): boolean {\n return !!url && !UNSAFE_SCHEME.test(normalize(url));\n}\n\n/** True when the url carries a scheme and that scheme is safe to navigate to. */\nexport function isSafeAbsoluteUrl(url: string): boolean {\n const normalized = normalize(url);\n\n return HAS_SCHEME.test(normalized) && !UNSAFE_SCHEME.test(normalized);\n}\n","import { compareInboxBySendDate } from '@pushwoosh/websdk-common/inbox';\n\nimport {\n CONFIG_STYLES,\n DEFAULT_CONFIG,\n STYLE_PREFIX,\n SYNC_INTERVAL,\n TRIGGER_CONFIG_STYLES,\n} from './constants';\nimport { isElementFixed } from './helpers';\nimport { type IInboxWidgetConfig, type TMessagesElementsType } from './inbox_widget.types';\nimport { renderInboxWidget } from './renderer';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\nimport { applyStyleVariables } from '../../helpers/cssVariables';\nimport { isSafeUrl } from '../../helpers/url';\nimport { type IInboxMessagePublic } from '../../models/InboxMessages.types';\n\nexport class PWInboxWidget {\n pw: Pushwoosh;\n widget: HTMLElement;\n trigger: HTMLElement;\n list: HTMLElement;\n widgetParent: HTMLElement;\n count: number;\n messages: Array<IInboxMessagePublic>;\n messagesElements: TMessagesElementsType;\n readItems: Array<string>;\n isOpened: boolean;\n config: IInboxWidgetConfig;\n defaultMargin: number;\n isFixed: boolean;\n private lastSyncAt: number = 0;\n\n constructor(pw: Pushwoosh) {\n // Set Pushwoosh object\n this.pw = pw;\n\n const inboxWidgetConfig = this.pw.initParams.inboxWidget!;\n\n this.config = {\n ...DEFAULT_CONFIG,\n arrowBorderColor: inboxWidgetConfig.borderColor && inboxWidgetConfig.borderColor !== 'transparent'\n ? inboxWidgetConfig.borderColor\n : 'rgba(0,0,0,.1)',\n ...this.pw.initParams.inboxWidget,\n };\n\n this.updateInbox = this.updateInbox.bind(this);\n this.markVisibleItemsAsRead = this.markVisibleItemsAsRead.bind(this);\n this.onWidgetClickHandler = this.onWidgetClickHandler.bind(this);\n this.onTriggerClickHandler = this.onTriggerClickHandler.bind(this);\n this.onWindowScrollHandler = this.onWindowScrollHandler.bind(this);\n this.toggle = this.toggle.bind(this);\n }\n\n public async run() {\n // The CDN loader already skips this bundle when off; an npm site constructs the widget itself.\n if (this.pw.initParams.inboxWidget?.enable === false) {\n return;\n }\n\n this.initTrigger();\n this.updateInbox();\n this.addListeners();\n }\n\n public toggle(isOpened?: boolean) {\n const openWidget = typeof isOpened === 'undefined'\n ? !this.isOpened\n : isOpened;\n\n if (openWidget) {\n this.openWidget();\n } else {\n this.closeWidget();\n }\n }\n\n // set inbox widget to trigger element on page\n private initTrigger() {\n if (!this.pw.pwinbox) {\n throw new Error('Web inbox is not allowed.');\n }\n\n const trigger = document.getElementById(this.config.triggerId);\n\n if (!trigger) {\n throw new Error(`Pushwoosh: inbox trigger element #${this.config.triggerId} is not on the page. Add it, or change Trigger ID in the Pushwoosh Control Panel or inboxWidget.triggerId in the snippet.`);\n }\n\n this.trigger = trigger;\n this.trigger.classList.add('pw-inbox-trigger');\n\n // Init has just pulled the inbox itself, so the first bell open must not\n // fetch the whole thing again seconds later.\n this.lastSyncAt = Date.now();\n\n this.defaultMargin = 12;\n this.messagesElements = {};\n this.messages = [];\n this.readItems = [];\n this.updateCounter(0);\n this.isOpened = false;\n\n this.renderWidget();\n\n this.isFixed = isElementFixed(this.trigger);\n }\n\n private renderWidget() {\n this.widget = document.createElement('div');\n this.widget.id = 'pwInboxWidget';\n this.widget.className = 'pw-inbox-widget';\n this.widget.classList.toggle('pw-open', this.isOpened);\n this.widget.classList.toggle('pw-inbox-widget--legacy-cell', this.config.legacyClassicCell);\n\n this.widgetParent = document.querySelector(this.config.appendTo) || document.body;\n\n this.widgetParent.appendChild(this.widget);\n this.applyStyleVariables();\n this.renderWidgetInner();\n }\n\n private applyStyleVariables() {\n applyStyleVariables(this.widget, STYLE_PREFIX, CONFIG_STYLES, this.config);\n applyStyleVariables(this.trigger, STYLE_PREFIX, TRIGGER_CONFIG_STYLES, this.config);\n }\n\n private renderWidgetInner() {\n this.widget.classList.toggle('pw-inbox-widget--empty', this.messages.length === 0);\n\n renderInboxWidget(this.widget, this.messages, this.config, {\n onMessageClick: (code) => this.performMessageAction(code),\n onMessageRemove: (code) => this.removeMessages([code]),\n onSlideLinkClick: (code, link) => {\n if (isSafeUrl(link)) {\n document.location.href = link;\n } else {\n this.performMessageAction(code);\n }\n },\n });\n\n this.list = this.widget.querySelector('.pw-inbox_list') || document.createElement('ul');\n this.messagesElements = {};\n this.widget.querySelectorAll<HTMLElement>('[data-pw-inbox-message-id]').forEach((element) => {\n this.messagesElements[element.getAttribute('data-pw-inbox-message-id') || ''] = element;\n });\n }\n\n private updateCounter(count: number) {\n this.count = count;\n this.trigger.setAttribute('data-pw-count', `${this.count}`);\n this.trigger.classList.toggle('pw-empty', this.count === 0);\n }\n\n private updateInboxMessages(messages: Array<IInboxMessagePublic>) {\n this.messages = messages.sort(({ sendDate: sendDateOne }, { sendDate: sendDateTwo }) => compareInboxBySendDate(sendDateOne, sendDateTwo));\n this.renderWidgetInner();\n }\n\n openWidget() {\n this.isOpened = true;\n this.widget.classList.add('pw-open');\n this.syncMessages();\n document.addEventListener('click', this.onWidgetClickHandler);\n window.addEventListener('scroll', this.onWindowScrollHandler);\n window.addEventListener('resize', this.onWindowScrollHandler);\n this.markVisibleItemsAsRead();\n if (this.messages.length > 0) {\n this.list.addEventListener('scroll', this.markVisibleItemsAsRead);\n }\n this.positionWidget();\n }\n\n closeWidget() {\n this.isOpened = false;\n document.removeEventListener('click', this.onWidgetClickHandler);\n window.removeEventListener('scroll', this.onWindowScrollHandler);\n window.removeEventListener('resize', this.onWindowScrollHandler);\n this.updateReadStatus();\n if (this.messages.length > 0) {\n this.list.removeEventListener('scroll', this.markVisibleItemsAsRead);\n }\n this.widget.classList.remove('pw-open', 'pw-top', 'pw-bottom', 'pw-right', 'pw-left');\n this.widget.removeAttribute('style');\n }\n\n private positionWidget() {\n if (!this.isOpened) {\n return;\n }\n if (this.widgetParent === document.body) {\n this.defaultPlaceWidget();\n } else {\n this.customPlaceWidget();\n }\n }\n\n private customPlaceWidget() {\n const { position } = this.config;\n this.widgetParent.style.position = 'relative';\n this.widget.classList.add('pw-inbox-widget--inset');\n this.widget.classList.add(`pw-${position}`);\n }\n\n private defaultPlaceWidget() {\n const position = this.pw.initParams.inboxWidget!.position ? this.config.position : this.getDefaultPosition();\n\n const widgetRect = this.widget.getBoundingClientRect();\n if (!document.documentElement) {\n return;\n }\n const windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n const windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n\n if (widgetRect.width + (this.defaultMargin * 2) > windowWidth) {\n this.widget.style.width = `${windowWidth - (this.defaultMargin * 2)}px`;\n }\n if (widgetRect.height + 24 > windowHeight) {\n this.widget.style.height = `${windowHeight - (this.defaultMargin * 2)}px`;\n }\n\n switch (position) {\n case 'top': {\n this.alignWidgetTop();\n break;\n }\n case 'right': {\n this.alignWidgetRight();\n break;\n }\n case 'left': {\n this.alignWidgetLeft();\n break;\n }\n case 'bottom': {\n this.alignWidgetBottom();\n break;\n }\n }\n }\n\n private alignWidgetTop() {\n const triggerRect = this.trigger.getBoundingClientRect();\n const widgetRect = this.widget.getBoundingClientRect();\n if (!document.documentElement) {\n return;\n }\n const windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n const arrow: HTMLElement = this.widget.querySelector('.pw-inbox__arrow') || document.createElement('div');\n\n this.widget.classList.add('pw-top');\n\n let left = pageXOffset + triggerRect.left + Math.floor(triggerRect.width / 2) - Math.floor(widgetRect.width / 2);\n\n const isUnderLeft = left < pageXOffset;\n const isUnderRight = left + widgetRect.width > pageXOffset + windowWidth;\n\n if (isUnderLeft) {\n left = pageXOffset + this.defaultMargin;\n }\n if (isUnderRight) {\n left = pageXOffset + windowWidth - widgetRect.width - this.defaultMargin;\n }\n\n const top = pageYOffset + triggerRect.top - widgetRect.height;\n\n this.alignWidgetElement(left, top);\n arrow.style.left = `${triggerRect.left + Math.floor(triggerRect.width / 2) - left}px`;\n\n const topMargin = this.widget.getBoundingClientRect().top;\n const isUnderTop = topMargin < 0;\n if (isUnderTop) {\n const newHeight = this.widget.getBoundingClientRect().height + topMargin - this.defaultMargin;\n const newTop = this.widget.getBoundingClientRect().top - topMargin + this.defaultMargin;\n this.widget.style.height = `${newHeight}px`;\n this.widget.style.top = `${newTop}px`;\n }\n }\n\n private alignWidgetRight() {\n const triggerRect = this.trigger.getBoundingClientRect();\n const widgetRect = this.widget.getBoundingClientRect();\n if (!document.documentElement) {\n return;\n }\n const windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n const windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n const arrow: HTMLElement = this.widget.querySelector('.pw-inbox__arrow') || document.createElement('div');\n\n this.widget.classList.add('pw-right');\n\n let top = pageYOffset + triggerRect.top + Math.floor(triggerRect.height / 2) - Math.floor(widgetRect.height / 2);\n\n const isUnderTop = top < pageYOffset;\n const isUnderBottom = pageYOffset + windowHeight < top + widgetRect.height;\n\n if (isUnderTop) {\n top = pageYOffset + this.defaultMargin;\n }\n\n if (isUnderBottom) {\n top = pageYOffset + windowHeight - widgetRect.height - this.defaultMargin;\n }\n\n const left = pageXOffset + triggerRect.left + triggerRect.width;\n\n this.alignWidgetElement(left, top);\n arrow.style.top = `${triggerRect.top + Math.floor(triggerRect.height / 2) - top}px`;\n\n const rightMargin = windowWidth - this.widget.getBoundingClientRect().right;\n const isUnderRight = rightMargin < this.defaultMargin;\n if (isUnderRight) {\n const newWidth = this.widget.getBoundingClientRect().width + rightMargin - this.defaultMargin;\n this.widget.style.width = `${newWidth}px`;\n }\n }\n\n private alignWidgetLeft() {\n const triggerRect = this.trigger.getBoundingClientRect();\n const widgetRect = this.widget.getBoundingClientRect();\n if (!document.documentElement) {\n return;\n }\n const windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n const arrow: HTMLElement = this.widget.querySelector('.pw-inbox__arrow') || document.createElement('div');\n\n this.widget.classList.add('pw-left');\n\n let top = pageYOffset + triggerRect.top + Math.floor(triggerRect.height / 2) - Math.floor(widgetRect.height / 2);\n\n const isUnderTop = top < pageYOffset;\n const isUnderBottom = pageYOffset + windowHeight < top + widgetRect.height;\n\n if (isUnderTop) {\n top = pageYOffset + this.defaultMargin;\n }\n\n if (isUnderBottom) {\n top = pageYOffset + windowHeight - widgetRect.height - this.defaultMargin;\n }\n\n const left = pageXOffset + triggerRect.left - widgetRect.width;\n\n this.alignWidgetElement(left, top);\n arrow.style.top = `${triggerRect.top + Math.floor(triggerRect.height / 2) - top}px`;\n\n const leftMargin = this.widget.getBoundingClientRect().left;\n const isUnderLeft = leftMargin < 0;\n if (isUnderLeft) {\n const newWidth = this.widget.getBoundingClientRect().width + leftMargin - this.defaultMargin;\n const newLeft = this.widget.getBoundingClientRect().left - leftMargin;\n this.widget.style.width = `${newWidth}px`;\n this.widget.style.left = `${newLeft}px`;\n }\n }\n\n private alignWidgetBottom() {\n const triggerRect = this.trigger.getBoundingClientRect();\n const widgetRect = this.widget.getBoundingClientRect();\n if (!document.documentElement) {\n return;\n }\n const windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n const windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n const arrow: HTMLElement = this.widget.querySelector('.pw-inbox__arrow') || document.createElement('div');\n\n this.widget.classList.add('pw-bottom');\n\n let left = pageXOffset + triggerRect.left + Math.floor(triggerRect.width / 2) - Math.floor(widgetRect.width / 2);\n\n const isUnderLeft = left < pageXOffset;\n const isUnderRight = left + widgetRect.width > pageXOffset + windowWidth;\n\n if (isUnderLeft) {\n left = pageXOffset + this.defaultMargin;\n }\n if (isUnderRight) {\n left = pageXOffset + windowWidth - widgetRect.width - 12;\n }\n\n const top = pageYOffset + triggerRect.top + triggerRect.height;\n\n this.alignWidgetElement(left, top);\n arrow.style.left = `${triggerRect.left + Math.floor(triggerRect.width / 2) - left}px`;\n\n const bottomRange = windowHeight - this.widget.getBoundingClientRect().bottom;\n const isUnderBottom = bottomRange < this.defaultMargin;\n if (isUnderBottom) {\n const newHeight = this.widget.getBoundingClientRect().height + bottomRange - this.defaultMargin;\n this.widget.style.height = `${newHeight}px`;\n }\n }\n\n private alignWidgetElement(left: number, top: number) {\n this.widget.style.left = `${left}px`;\n this.widget.style.top = `${top}px`;\n }\n\n private getDefaultPosition(): string {\n const { left, top, width, height } = this.trigger.getBoundingClientRect();\n if (!document.documentElement) {\n return '';\n }\n const windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n const windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n\n const antiMargins: { [key: string]: number } = {\n right: left,\n bottom: top,\n left: windowWidth - (left + width),\n top: windowHeight - (top + height),\n };\n\n const leastMargin = Math.min(left, top, antiMargins.left, antiMargins.top);\n\n let position = 'bottom';\n\n Object.keys(antiMargins).forEach((key) => {\n if (antiMargins[key] === leastMargin) {\n position = key;\n }\n });\n\n return position;\n }\n\n private addListeners() {\n this.trigger.addEventListener('click', this.onTriggerClickHandler);\n\n this.pw.push(['onPutNewMessageToInboxStore', () => {\n this.updateInbox();\n }]);\n this.pw.push(['onUpdateInboxMessages', () => {\n this.updateInbox();\n }]);\n }\n\n private markVisibleItemsAsRead() {\n if (this.messages.length === 0) {\n return;\n }\n const scrollTop = (this.list.clientHeight + this.list.scrollTop) - 50;\n Object.keys(this.messagesElements).forEach((code: string) => {\n // check message exists and user saw the message in viewport\n if (!this.messagesElements[code] || this.messagesElements[code].offsetTop > scrollTop) {\n return;\n }\n\n const message = this.messages.find((message: IInboxMessagePublic): boolean => message.code === code);\n\n // mark messages as read\n if (!!message && !message.isRead && !(this.readItems.indexOf(code) + 1)) {\n this.readItems.push(code);\n }\n });\n }\n\n private updateReadStatus() {\n // Taken and cleared in one step: the codes are reported once, and a long\n // session does not keep growing the array across every open/close cycle.\n const codes = this.readItems;\n this.readItems = [];\n\n this.pw.pwinbox.readMessagesWithCodes(codes).then(this.updateInbox);\n }\n\n // Opening the bell is the only refresh besides init: a standalone App Inbox\n // message rides a channel with no sender, so no push announces one.\n private syncMessages() {\n // getInboxMessages returns the whole inbox, with no paging on the server\n // side, so toggling the bell must not turn into a request per click.\n if (Date.now() - this.lastSyncAt < SYNC_INTERVAL) {\n return;\n }\n\n this.lastSyncAt = Date.now();\n\n this.pw.pwinbox.syncMessages().catch((error: unknown) => {\n // Not the SDK Logger: it drags `core/storage` in and costs this bundle\n // ~20 KiB. SubscriptionButton logs the same way for the same reason.\n console.error('Pushwoosh: cannot refresh the inbox on open', error);\n });\n }\n\n private updateInbox() {\n this.pw.pwinbox.loadMessages().then((messages: Array<IInboxMessagePublic>) => {\n this.updateInboxMessages(messages);\n });\n this.pw.pwinbox.unreadMessagesCount().then((count: number) => {\n this.updateCounter(count);\n });\n }\n\n private performMessageAction(code: string) {\n const message = this.messages.find((item: IInboxMessagePublic): boolean => item.code === code);\n\n // The popup is modal and locks body scroll, so the panel it was opened\n // from is left stranded under the overlay.\n if (message && message.webPopupCode) {\n this.toggle(false);\n }\n\n this.pw.pwinbox.performActionForMessageWithCode(code)\n .then(() => {\n this.updateInbox();\n });\n }\n\n private removeMessages(messages: Array<string>) {\n // Was `slice(indexOf(code), 1)`, which returns an empty array for any index\n // past 1 and so discarded every pending read code, not just this one.\n this.readItems = this.readItems.filter((code: string) => messages.indexOf(code) === -1);\n this.pw.pwinbox.deleteMessagesWithCodes(messages)\n .then(() => {\n this.updateInbox();\n });\n }\n\n // handlers\n\n private onTriggerClickHandler(event: MouseEvent) {\n event.stopPropagation();\n if (!event.target) {\n return;\n }\n\n this.toggle();\n }\n\n // Clicks inside a message are handled by the reader; any other click closes the widget.\n private onWidgetClickHandler(event: MouseEvent) {\n if (!event.target) {\n return;\n }\n\n if (!(<HTMLElement>event.target).closest('.pw-inbox_item')) {\n this.toggle();\n }\n }\n\n private onWindowScrollHandler() {\n if (this.isFixed && this.isOpened) {\n this.toggle();\n return;\n }\n this.positionWidget();\n }\n}\n"],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE__524__","__WEBPACK_EXTERNAL_MODULE__873__","__WEBPACK_EXTERNAL_MODULE__247__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","INBOX_KNOWN_LAYOUTS","INBOX_WIDGET_STYLE_PREFIX","INBOX_MONTHS","INBOX_WIDGET_STYLE_VARIABLES","name","type","INBOX_WIDGET_DEFAULT_APPEARANCE","title","bgColor","textColor","fontFamily","borderRadius","borderColor","badgeBgColor","badgeTextColor","widgetWidth","zIndex","messageTitleColor","timeTextColor","emptyInboxTitle","emptyInboxTitleColor","emptyInboxText","emptyInboxTextColor","emptyInboxIconUrl","arrowBorderColor","legacyClassicCell","unreadDotColor","avatarBgColor","avatarTextColor","avatarSize","mediaRadius","slideCaptionColor","slideScrimColor","pagerDotActiveColor","pagerDotColor","MINUTE","HOUR","RULE_BREAKERS","getInboxValidSlides","slides","Array","isArray","filter","slide","imageUrl","slice","getInboxHeroUrl","content","bannerUrl","iconUrl","resolveInboxLayout","hasTitle","hasBody","body","hero","requested","layoutType","includes","carousel","length","getInboxIconInitial","trim","charAt","toUpperCase","formatInboxMessageTime","sendDate","now","Date","date","gap","getTime","Math","floor","minutes","getMinutes","getDate","getMonth","getFullYear","getHours","inboxWidgetStyleVariables","appearance","variables","forEach","formatted","size","Number","isFinite","parsed","parseFloat","String","text","test","formatInboxStyleValue","STYLE_PREFIX","CONFIG_STYLES","TRIGGER_STYLE_NAMES","TRIGGER_CONFIG_STYLES","style","indexOf","DEFAULT_CONFIG","enable","triggerId","position","appendTo","isElementFixed","element","isFixed","window","getComputedStyle","parentElement","stop","handler","event","stopPropagation","Carousel","alt","onSlideLinkClick","index","setIndex","compat_root_preactCompat_","useState","active","min","onSlideClick","link","jsx_runtime_root_jsxRuntime_","jsxs","className","children","onClick","jsx","caption","src","map","_slide","slideIndex","Hero","url","placeholder","InboxWebCell","props","layout","timeLabel","isRead","isActionPerformed","code","onRemove","texts","media","icon","Boolean","join","WidgetBody","messages","onMessageClick","onMessageRemove","message","InboxWidgetReader","mode","resolveInboxWidgetAppearance","Fragment","frame","extraClass","inboxWidgetPreviewFrame","toInboxWidgetMessage","heroUrl","FALLBACK_COLOR","cssColor_RULE_BREAKERS","probe","formatStyleVariable","color","document","createElement","getValidColor","applyStyleVariables","prefix","values","setProperty","getCssVariableName","UNSAFE_SCHEME","normalize","split","char","charCodeAt","PWInboxWidget","constructor","pw","lastSyncAt","inboxWidgetConfig","initParams","inboxWidget","config","updateInbox","bind","markVisibleItemsAsRead","onWidgetClickHandler","onTriggerClickHandler","onWindowScrollHandler","toggle","run","initTrigger","addListeners","isOpened","openWidget","closeWidget","pwinbox","Error","trigger","getElementById","classList","add","defaultMargin","messagesElements","readItems","updateCounter","renderWidget","widget","id","widgetParent","querySelector","appendChild","renderWidgetInner","container","handlers","performMessageAction","removeMessages","location","href","external_commonjs_preact_commonjs2_preact_amd_preact_root_preact_","render","list","querySelectorAll","getAttribute","count","setAttribute","updateInboxMessages","sort","sendDateOne","sendDateTwo","compareInboxBySendDate","one","syncMessages","addEventListener","positionWidget","removeEventListener","updateReadStatus","remove","removeAttribute","defaultPlaceWidget","customPlaceWidget","getDefaultPosition","widgetRect","getBoundingClientRect","documentElement","windowWidth","max","clientWidth","innerWidth","windowHeight","clientHeight","innerHeight","width","height","alignWidgetTop","alignWidgetRight","alignWidgetLeft","alignWidgetBottom","triggerRect","arrow","left","pageXOffset","isUnderLeft","isUnderRight","top","pageYOffset","alignWidgetElement","topMargin","newHeight","newTop","isUnderTop","isUnderBottom","rightMargin","right","newWidth","leftMargin","newLeft","bottomRange","bottom","antiMargins","leastMargin","keys","push","scrollTop","offsetTop","find","codes","readMessagesWithCodes","then","catch","error","console","loadMessages","unreadMessagesCount","item","webPopupCode","performActionForMessageWithCode","deleteMessagesWithCodes","target","closest"],"sourceRoot":""}
1
+ {"version":3,"file":"widget-inbox.js","mappings":"CAAA,SAAAA,EAAAC,GACA,oBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,EAAAG,QAAA,UAAAA,QAAA,iBAAAA,QAAA,4BACA,sBAAAC,QAAAA,OAAAC,IACAD,OAAA,gDAAAJ,OACA,CACA,IAAAM,EAAA,iBAAAL,QAAAD,EAAAG,QAAA,UAAAA,QAAA,iBAAAA,QAAA,uBAAAH,EAAAD,EAAA,OAAAA,EAAA,aAAAA,EAAA,YACA,QAAAQ,KAAAD,GAAA,iBAAAL,QAAAA,QAAAF,GAAAQ,GAAAD,EAAAC,EACA,CACC,CATD,CASCC,KAAA,CAAAC,EAAAC,EAAAC,qCCTDT,EAAAD,QAAAQ,UCAAP,EAAAD,QAAAS,UCAAR,EAAAD,QAAAU,ICCA,MAAAC,EAAA,GAGA,SAAAC,EAAAC,GAEA,MAAAC,EAAAH,EAAAE,GACA,QAAAE,IAAAD,EACA,OAAAA,EAAAd,QAGA,MAAAC,EAAAU,EAAAE,GAAA,CAGAb,QAAA,IAOA,OAHAgB,EAAAH,GAAAZ,EAAAA,EAAAD,QAAAY,GAGAX,EAAAD,OACA,CCrBAY,EAAAK,EAAA,CAAAjB,EAAAkB,KACA,QAAAC,KAAAD,EACAN,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ications/external umd {\"commonjs\":\"preact\",\"commonjs2\":\"preact\",\"amd\":\"preact\",\"root\":\"preact\"}","webpack://web-push-notifications/external umd {\"commonjs\":\"preact/compat\",\"commonjs2\":\"preact/compat\",\"amd\":\"preact/compat\",\"root\":\"preactCompat\"}","webpack://web-push-notifications/external umd {\"commonjs\":\"preact/jsx-runtime\",\"commonjs2\":\"preact/jsx-runtime\",\"amd\":\"preact/jsx-runtime\",\"root\":\"jsxRuntime\"}","webpack://web-push-notifications/webpack/bootstrap","webpack://web-push-notifications/webpack/runtime/define property getters","webpack://web-push-notifications/webpack/runtime/hasOwnProperty shorthand","webpack://web-push-notifications/webpack/runtime/make namespace object","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/inbox/constants.js","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/inbox/helpers.js","webpack://web-push-notifications/./src/widgets/Inbox/constants.ts","webpack://web-push-notifications/./src/widgets/Inbox/helpers.ts","webpack://web-push-notifications/./node_modules/@pushwoosh/websdk-common/inbox/InboxWidgetReader.js","webpack://web-push-notifications/./src/widgets/Inbox/renderer.tsx","webpack://web-push-notifications/./src/helpers/cssColor.ts","webpack://web-push-notifications/./src/helpers/cssVariables.ts","webpack://web-push-notifications/./src/helpers/url.ts","webpack://web-push-notifications/./src/widgets/Inbox/InboxWidget.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"preact\"), require(\"preact/compat\"), require(\"preact/jsx-runtime\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"preact\", \"preact/compat\", \"preact/jsx-runtime\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"preact\"), require(\"preact/compat\"), require(\"preact/jsx-runtime\")) : factory(root[\"preact\"], root[\"preactCompat\"], root[\"jsxRuntime\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, (__WEBPACK_EXTERNAL_MODULE__524__, __WEBPACK_EXTERNAL_MODULE__873__, __WEBPACK_EXTERNAL_MODULE__247__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__524__;","module.exports = __WEBPACK_EXTERNAL_MODULE__873__;","module.exports = __WEBPACK_EXTERNAL_MODULE__247__;","// The module cache\nconst __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tconst cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tconst module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter/value functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop));","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/** The sending pipeline and the editor keep at most this many carousel slides. */\nexport const INBOX_MAX_CAROUSEL_SLIDES = 5;\n/** Layouts a cell can draw; anything else falls back to the heuristic. */\nexport const INBOX_KNOWN_LAYOUTS = ['classic', 'captioned', 'banner', 'carousel'];\n/** Prefix of the widget's CSS custom properties: `--pw-inbox-<name>`, a public API customers override from their CSS. */\nexport const INBOX_WIDGET_STYLE_PREFIX = 'pw-inbox';\n/** Month labels of the absolute message dates. */\nexport const INBOX_MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'];\n/** Appearance values exposed as CSS custom properties, with their formatting. */\nexport const INBOX_WIDGET_STYLE_VARIABLES = [{\n name: 'widgetWidth',\n type: 'size'\n}, {\n name: 'borderRadius',\n type: 'size'\n}, {\n name: 'zIndex',\n type: 'number'\n}, {\n name: 'fontFamily',\n type: 'string'\n}, {\n name: 'bgColor',\n type: 'color'\n}, {\n name: 'textColor',\n type: 'color'\n}, {\n name: 'arrowBorderColor',\n type: 'color'\n}, {\n name: 'borderColor',\n type: 'color'\n}, {\n name: 'badgeBgColor',\n type: 'color'\n}, {\n name: 'badgeTextColor',\n type: 'color'\n}, {\n name: 'timeTextColor',\n type: 'color'\n}, {\n name: 'messageTitleColor',\n type: 'color'\n}, {\n name: 'emptyInboxTitleColor',\n type: 'color'\n}, {\n name: 'emptyInboxTextColor',\n type: 'color'\n}, {\n name: 'unreadDotColor',\n type: 'color'\n}, {\n name: 'avatarBgColor',\n type: 'color'\n}, {\n name: 'avatarTextColor',\n type: 'color'\n}, {\n name: 'avatarSize',\n type: 'size'\n}, {\n name: 'mediaRadius',\n type: 'size'\n}, {\n name: 'slideCaptionColor',\n type: 'color'\n}, {\n name: 'slideScrimColor',\n type: 'color'\n}, {\n name: 'pagerDotActiveColor',\n type: 'color'\n}, {\n name: 'pagerDotColor',\n type: 'color'\n}];\n/** Default appearance of the web inbox widget. */\nexport const INBOX_WIDGET_DEFAULT_APPEARANCE = {\n title: 'Inbox',\n bgColor: '#ffffff',\n textColor: '#333333',\n fontFamily: 'inherit',\n borderRadius: 4,\n borderColor: 'transparent',\n badgeBgColor: '#ff4c00',\n badgeTextColor: '#ffffff',\n widgetWidth: 350,\n zIndex: 100,\n messageTitleColor: '#7a7a7a',\n timeTextColor: '#c4c4c4',\n emptyInboxTitle: 'You\\'re all caught up',\n emptyInboxTitleColor: '#333333',\n emptyInboxText: 'There are no new messages. Stay tuned!',\n emptyInboxTextColor: '#7a7a7a',\n emptyInboxIconUrl: 'https://pushon.pushwoosh.com/static/icon-empty-inbox.png',\n arrowBorderColor: 'rgba(0,0,0,.1)',\n legacyClassicCell: false,\n unreadDotColor: '#00a2ff',\n avatarBgColor: '#c4c8cc',\n avatarTextColor: '#4b5057',\n avatarSize: 52,\n mediaRadius: 8,\n slideCaptionColor: '#ffffff',\n slideScrimColor: 'rgba(0,0,0,.45)',\n pagerDotActiveColor: '#00a2ff',\n pagerDotColor: '#ebf0f5'\n};\n/** Stylesheet of the web inbox widget and its trigger badge; class names and custom properties are public API. */\nexport const INBOX_WIDGET_CSS = `\n.pw-inbox-trigger {\n position: relative;\n cursor: pointer;\n}\n\n.pw-inbox-trigger:after {\n content: attr(data-pw-count);\n display: block;\n position: absolute;\n right: 0;\n top: 0;\n background: var(--pw-inbox-badgeBgColor, #ff4c00);\n border-radius: 8px;\n color: var(--pw-inbox-badgeTextColor, #ffffff);\n font-size: 10px;\n font-weight: normal;\n line-height: 16px;\n width: 16px;\n padding: 0 2px;\n box-sizing: border-box;\n text-align: center;\n}\n\n.pw-inbox-trigger.pw-empty:after {\n display: none;\n}\n\n.pw-inbox-widget * {\n position: static;\n box-sizing: border-box;\n font-size: 1em;\n outline: none;\n font-family: var(--pw-inbox-fontFamily, inherit);\n}\n.pw-inbox-widget {\n font-size: 14px;\n position: absolute;\n top: 0;\n left: -1000px;\n background: var(--pw-inbox-bgColor, #ffffff);\n border: solid 1px var(--pw-inbox-borderColor, transparent);\n border-radius: var(--pw-inbox-borderRadius, 4px);\n width: var(--pw-inbox-widgetWidth, 350px);\n box-shadow: 0 1px 4px 0 rgba(0,0,0,.25);\n z-index: var(--pw-inbox-zIndex, 100);\n opacity: 0;\n transition: opacity .6s ease;\n transition-delay: 100ms;\n}\n.pw-inbox-widget.pw-open {\n opacity: 1;\n transition-delay: 0ms;\n}\n.pw-inbox-widget.pw-inbox-widget--inset {\n top: auto;\n left: auto;\n display: none;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-open {\n display: block;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-bottom {\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-top {\n bottom: 100%;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-right {\n left: 100%;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-left {\n right: 100%;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--empty {\n max-height: none;\n}\n.pw-inbox-widget .pw-inbox__arrow {\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget .pw-inbox__arrow:before {\n content: \"\";\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget.pw-top {\n margin-top: -12px;\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow {\n border-top-color: var(--pw-inbox-arrowBorderColor, rgba(0,0,0,.1));\n bottom: -21px;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow:before {\n border-top-color: var(--pw-inbox-bgColor, #ffffff);\n top: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-bottom {\n margin-top: 12px;\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow {\n border-bottom-color: var(--pw-inbox-arrowBorderColor, rgba(0,0,0,.1));\n top: -21px;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow:before {\n border-bottom-color: var(--pw-inbox-bgColor, #ffffff);\n bottom: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-left {\n margin-left: -12px;\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow {\n border-left-color: var(--pw-inbox-arrowBorderColor, rgba(0,0,0,.1));\n right: -21px;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow:before {\n border-left-color: var(--pw-inbox-bgColor, #ffffff);\n left: -11px;\n top: -10px;\n}\n.pw-inbox-widget.pw-right {\n margin-left: 12px;\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow {\n border-right-color: var(--pw-inbox-arrowBorderColor, rgba(0,0,0,.1));\n left: -21px;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow:before {\n border-right-color: var(--pw-inbox-bgColor, #ffffff);\n right: -11px;\n top: -10px;\n}\n.pw-inbox_inner {\n overflow: hidden;\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n.pw-inbox_title {\n color: var(--pw-inbox-textColor, #333333);\n margin: 0;\n padding: 28px 32px 12px;\n font-size: 24px;\n font-weight: 500;\n line-height: 1.1;\n text-align: left;\n flex: 0 0 66px;\n}\n.pw-inbox_list {\n overflow-x: hidden;\n overflow-y: auto;\n min-width: 200px;\n max-height: 300px;\n padding: 0;\n margin: 0;\n list-style: none;\n position: relative;\n flex: 1 1 auto;\n}\n\n.pw-inbox_item {\n position: relative;\n padding: 8px 32px;\n margin: 0;\n text-align: left;\n}\n.pw-inbox_item-inner {\n display: flex;\n cursor: pointer;\n}\n.pw-inbox_icon {\n flex: 0 0 auto;\n width: var(--pw-inbox-avatarSize, 52px);\n height: var(--pw-inbox-avatarSize, 52px);\n margin-right: 14px;\n overflow: hidden;\n border-radius: var(--pw-inbox-mediaRadius, 8px);\n background: var(--pw-inbox-avatarBgColor, #c4c8cc);\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.pw-inbox_message-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n}\n.pw-inbox_icon-initial {\n color: var(--pw-inbox-avatarTextColor, #4b5057);\n font-size: 22px;\n line-height: 1;\n font-weight: 700;\n}\n.pw-inbox_content {\n flex: 1 1 auto;\n min-width: 0;\n}\n.pw-inbox_item-title {\n color: var(--pw-inbox-messageTitleColor, #7a7a7a);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n display: flex;\n align-items: center;\n gap: 6px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.pw-inbox_unread-dot {\n flex: 0 0 auto;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: var(--pw-inbox-unreadDotColor, #00a2ff);\n}\n.pw-inbox_item-body {\n color: var(--pw-inbox-textColor, #333333);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n.pw-inbox_item-time {\n color: var(--pw-inbox-timeTextColor, #c4c4c4);\n font-size: 12px;\n line-height: 17px;\n}\n.pw-inbox_item-remove {\n position: absolute;\n z-index: 2;\n top: 8px;\n right: 8px;\n display: none;\n width: 10px;\n height: 10px;\n background: transparent url('https://cdn.pushwoosh.com/webpush/img/iconClose.svg') 50% no-repeat;\n cursor: pointer;\n}\n.pw-inbox_item:hover .pw-inbox_item-remove {\n display: block;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-title {\n color: var(--pw-inbox-textColor, #333333);\n font-weight: 700;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-body {\n font-weight: 700;\n}\n\n.pw-inbox_list--empty {\n padding: 50px 16px;\n text-align: center;\n max-height: 100%;\n overflow: auto;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-icon {\n text-align: center;\n margin-bottom: 30px;\n}\n.pw-inbox_list--empty .pw-inbox_list-icon img {\n max-width: 100%;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-title {\n font-size: 28px;\n line-height: 36px;\n color: var(--pw-inbox-emptyInboxTitleColor, #333333);\n margin-bottom: 20px;\n}\n\n.pw-inbox_list--empty .ipw-inbox_list-body {\n font-size: 14px;\n line-height: 18px;\n color: var(--pw-inbox-emptyInboxTextColor, #7a7a7a);\n}\n\n/* Cell layouts: banner, captioned and carousel stack their media above the\n texts, so the flex row of the classic cell becomes a column. */\n.pw-inbox_item--banner,\n.pw-inbox_item--captioned,\n.pw-inbox_item--carousel {\n flex-direction: column;\n gap: 12px;\n}\n\n.pw-inbox_media {\n position: relative;\n width: 100%;\n}\n.pw-inbox_hero {\n display: block;\n width: 100%;\n max-width: 100%;\n aspect-ratio: 2 / 1;\n object-fit: cover;\n border-radius: var(--pw-inbox-mediaRadius, 8px);\n}\n\n.pw-inbox_slide {\n position: relative;\n display: block;\n cursor: pointer;\n}\n.pw-inbox_slide-caption {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n padding: 14px 10px 6px;\n color: var(--pw-inbox-slideCaptionColor, #ffffff);\n font-size: 14px;\n line-height: 20px;\n border-radius: 0 0 var(--pw-inbox-mediaRadius, 8px) var(--pw-inbox-mediaRadius, 8px);\n background: linear-gradient(transparent, var(--pw-inbox-slideScrimColor, rgba(0,0,0,.45)));\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n}\n\n.pw-inbox_pager {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n}\n.pw-inbox_dot {\n width: 6px;\n height: 6px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: var(--pw-inbox-pagerDotColor, #ebf0f5);\n cursor: pointer;\n}\n.pw-inbox_dot.pw-active {\n background: var(--pw-inbox-pagerDotActiveColor, #00a2ff);\n}\n\n/* \\`legacyClassicCell\\` restores the pre-3.75 classic cell. Scoped to classic on\n purpose: the three new layouts have no older look to go back to. */\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_icon {\n display: block;\n flex: 0 0 40px;\n width: auto;\n height: auto;\n margin-right: 0;\n border-radius: 0;\n background: none;\n}\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_message-image {\n width: 28px;\n height: auto;\n object-fit: fill;\n}\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_content {\n flex: 0 1 100%;\n}\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_item-title {\n display: block;\n overflow: visible;\n text-overflow: clip;\n white-space: normal;\n}\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_unread-dot {\n display: none;\n}\n.pw-inbox-widget--legacy-cell .pw-inbox_item--classic .pw-inbox_item-body {\n display: block;\n overflow: visible;\n}\n\n.pw-inbox-widget.pw-inbox-widget--preview {\n position: relative;\n top: auto;\n left: auto;\n max-width: 100%;\n opacity: 1;\n transition: none;\n}\n.pw-inbox-widget--preview .pw-inbox__arrow {\n display: none;\n}\n.pw-inbox-widget--cell .pw-inbox_item {\n padding: 16px;\n}\n.pw-inbox_icon--placeholder {\n border: 1px dashed #00a2ff;\n background: #80b7ff33;\n}\n.pw-inbox_hero--placeholder {\n border: 1px dashed #00a2ff;\n background: #80b7ff33;\n}\n`;","import { INBOX_KNOWN_LAYOUTS, INBOX_MAX_CAROUSEL_SLIDES, INBOX_MONTHS, INBOX_WIDGET_DEFAULT_APPEARANCE, INBOX_WIDGET_STYLE_PREFIX, INBOX_WIDGET_STYLE_VARIABLES } from './constants';\nconst MINUTE = 60 * 1000;\nconst HOUR = 60 * MINUTE;\nconst DAY = 24 * HOUR;\nconst RULE_BREAKERS = /[;{}]/;\n/** Picks the content to render: explicit `content` wins, otherwise the `language` entry of `localizedContent` with default/en/first fallbacks. */\nexport function pickInboxLocalizedContent(content, localizedContent, language) {\n if (content) {\n return content;\n }\n if (!localizedContent) {\n return null;\n }\n const keys = Object.keys(localizedContent);\n if (keys.length === 0) {\n return null;\n }\n if (language && localizedContent[language]) {\n return localizedContent[language];\n }\n return localizedContent.default || localizedContent.en || localizedContent[keys[0]];\n}\n/** Slides a cell draws: the ones with an image, at most {@link INBOX_MAX_CAROUSEL_SLIDES}. */\nexport function getInboxValidSlides(slides) {\n return (Array.isArray(slides) ? slides : []).filter(slide => !!slide && !!slide.imageUrl).slice(0, INBOX_MAX_CAROUSEL_SLIDES);\n}\n/** Hero image of the banner/captioned layouts: the banner, with the icon standing in when none was sent. */\nexport function getInboxHeroUrl(content) {\n return content.bannerUrl || content.iconUrl || '';\n}\n/** Resolves the layout a cell draws: the requested one when it can render, the heuristic for unknown ones, classic otherwise. */\nexport function resolveInboxLayout(content) {\n const hasTitle = !!content.title;\n const hasBody = !!content.body;\n const hero = getInboxHeroUrl(content);\n let requested = content.layoutType;\n if (!INBOX_KNOWN_LAYOUTS.includes(requested)) {\n if (content.bannerUrl && !hasTitle) {\n requested = 'banner';\n } else if (content.bannerUrl && hasTitle && hasBody) {\n requested = 'captioned';\n } else {\n requested = 'classic';\n }\n }\n switch (requested) {\n case 'banner':\n return hero ? 'banner' : 'classic';\n case 'captioned':\n return hero && hasTitle && hasBody ? 'captioned' : 'classic';\n case 'carousel':\n return hasTitle && hasBody && getInboxValidSlides(content.carousel).length > 0 ? 'carousel' : 'classic';\n default:\n return 'classic';\n }\n}\n/** True when the content has nothing to render yet, so a preview shows the layout placeholder. */\nexport function isInboxContentEmpty(content) {\n return !content.title && !content.body && !content.iconUrl && !content.bannerUrl && getInboxValidSlides(content.carousel).length === 0;\n}\n/** The layout whose placeholder an empty preview shows: the requested one when known, else classic. */\nexport function getInboxEmptyLayout(content) {\n const requested = content.layoutType;\n return INBOX_KNOWN_LAYOUTS.includes(requested) ? requested : 'classic';\n}\n/** Title/body pair of the mobile cells: in classic the body stands in for a missing title, as the mobile SDKs draw it. */\nexport function getInboxMobileTexts(content, layout) {\n if (layout === 'classic') {\n return {\n title: content.title || content.body || '',\n body: content.title && content.body || ''\n };\n }\n return {\n title: content.title || '',\n body: content.body || ''\n };\n}\nconst 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;\nconst LETTER = /\\p{L}/u;\nconst NOT_COPY = /<[^>]*>|\\{\\{[\\s\\S]*?\\}\\}|\\{%[\\s\\S]*?%\\}/g;\n/** 'rtl' when most letters of the copy read right to left; markup and Liquid do not vote. */\nexport function getInboxTextDirection(...texts) {\n let rtl = 0;\n let ltr = 0;\n for (const char of texts.join(' ').replace(NOT_COPY, '')) {\n if (RTL_LETTER.test(char)) {\n rtl += 1;\n } else if (LETTER.test(char)) {\n ltr += 1;\n }\n }\n return rtl > ltr ? 'rtl' : 'ltr';\n}\n/** The colored initial a classic cell shows when there is no icon. */\nexport function getInboxIconInitial(content) {\n return (content.title || content.body || '?').trim().charAt(0).toUpperCase() || '?';\n}\n/** Date label of a web widget message: relative within a day of `now`, then `D Mon YYYY, H:mm` in local time. */\nexport function formatInboxMessageTime(sendDate, now = Date.now()) {\n const date = new Date(sendDate);\n const gap = now - date.getTime();\n if (gap <= MINUTE) {\n return 'Just now';\n }\n if (gap < HOUR) {\n return `${Math.floor(gap / MINUTE)} minutes ago`;\n }\n if (gap < DAY) {\n return `${Math.floor(gap / HOUR)} hours ago`;\n }\n const minutes = `0${date.getMinutes()}`.slice(-2);\n return `${date.getDate()} ${INBOX_MONTHS[date.getMonth()]} ${date.getFullYear()}, ${date.getHours()}:${minutes}`;\n}\n/** Newest first. */\nexport function compareInboxBySendDate(one, two) {\n return new Date(two).getTime() - new Date(one).getTime();\n}\n/** Full appearance from a partial one; the arrow border follows a visible widget border unless set explicitly. */\nexport function resolveInboxWidgetAppearance(appearance) {\n const {\n borderColor\n } = appearance || {};\n return {\n ...INBOX_WIDGET_DEFAULT_APPEARANCE,\n arrowBorderColor: borderColor && borderColor !== 'transparent' ? borderColor : INBOX_WIDGET_DEFAULT_APPEARANCE.arrowBorderColor,\n ...appearance\n };\n}\n/** One appearance value as its CSS custom property value; `null` leaves it unset so the stylesheet default applies. */\nexport function formatInboxStyleValue(type, value) {\n switch (type) {\n case 'size':\n {\n if (value === null || value === undefined || value === '') {\n return null;\n }\n const size = Number(value);\n return Number.isFinite(size) ? `${size}px` : null;\n }\n case 'number':\n {\n const parsed = parseFloat(String(value));\n return Number.isFinite(parsed) ? String(parsed) : null;\n }\n default:\n {\n const text = String(value ?? '').trim();\n return text && !RULE_BREAKERS.test(text) ? text : null;\n }\n }\n}\n/** The `--pw-inbox-*` custom properties of an appearance, ready for a `style` object or `setProperty`. */\nexport function inboxWidgetStyleVariables(appearance) {\n const variables = {};\n INBOX_WIDGET_STYLE_VARIABLES.forEach(({\n name,\n type\n }) => {\n const formatted = formatInboxStyleValue(type, appearance[name]);\n if (formatted !== null) {\n variables[`--${INBOX_WIDGET_STYLE_PREFIX}-${name}`] = formatted;\n }\n });\n return variables;\n}","import {\n INBOX_WIDGET_DEFAULT_APPEARANCE, INBOX_WIDGET_STYLE_PREFIX, INBOX_WIDGET_STYLE_VARIABLES,\n} from '@pushwoosh/websdk-common/inbox';\n\nimport { type IConfigStyles, type IInboxWidgetConfig, type TStylesNames } from './inbox_widget.types';\n\n/** Shortest gap between two server refreshes triggered by opening the widget. */\nexport const SYNC_INTERVAL = 30 * 1000;\n\nexport const STYLE_PREFIX = INBOX_WIDGET_STYLE_PREFIX;\n\nexport const CONFIG_STYLES: Array<IConfigStyles> = [...INBOX_WIDGET_STYLE_VARIABLES];\n\n// The trigger is the customer's own element, outside the widget root, so the\n// badge rules need their variables set on it too.\nconst TRIGGER_STYLE_NAMES: Array<TStylesNames> = ['badgeBgColor', 'badgeTextColor'];\n\nexport const TRIGGER_CONFIG_STYLES: Array<IConfigStyles> = CONFIG_STYLES\n .filter((style) => TRIGGER_STYLE_NAMES.indexOf(style.name) !== -1);\n\nexport const DEFAULT_CONFIG: IInboxWidgetConfig = {\n enable: false,\n triggerId: 'pwInbox',\n position: 'bottom',\n appendTo: 'body',\n ...INBOX_WIDGET_DEFAULT_APPEARANCE,\n};\n","export function isElementFixed(element: HTMLElement): boolean {\n let isFixed = window.getComputedStyle(element).position === 'fixed';\n if (!isFixed && element.parentElement) {\n isFixed = isElementFixed(element.parentElement);\n }\n return isFixed;\n}\n","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport { INBOX_WIDGET_CSS } from './constants';\nimport { formatInboxMessageTime, getInboxHeroUrl, getInboxIconInitial, getInboxValidSlides, inboxWidgetStyleVariables, resolveInboxLayout, resolveInboxWidgetAppearance } from './helpers';\nfunction stop(handler) {\n return event => {\n event.stopPropagation();\n handler?.();\n };\n}\nfunction Carousel({\n slides,\n alt,\n onSlideLinkClick\n}) {\n const [index, setIndex] = useState(0);\n const active = Math.min(index, slides.length - 1);\n const slide = slides[active];\n const onSlideClick = slide.link ? stop(() => onSlideLinkClick?.(slide.link)) : undefined;\n return _jsxs(\"div\", {\n className: \"pw-inbox_media\",\n children: [_jsxs(\"div\", {\n className: \"pw-inbox_slide\",\n onClick: onSlideClick,\n children: [_jsx(\"img\", {\n alt: slide.caption || alt,\n className: \"pw-inbox_hero\",\n src: slide.imageUrl\n }), !!slide.caption && _jsx(\"span\", {\n className: \"pw-inbox_slide-caption\",\n children: slide.caption\n })]\n }), slides.length > 1 && _jsx(\"div\", {\n className: \"pw-inbox_pager\",\n children: slides.map((_slide, slideIndex) => _jsx(\"button\", {\n className: slideIndex === active ? 'pw-inbox_dot pw-active' : 'pw-inbox_dot',\n onClick: stop(() => setIndex(slideIndex)),\n type: \"button\"\n }, slideIndex))\n })]\n });\n}\nfunction Hero({\n url,\n alt,\n placeholder\n}) {\n return _jsx(\"div\", {\n className: \"pw-inbox_media\",\n children: placeholder ? _jsx(\"div\", {\n className: \"pw-inbox_hero pw-inbox_hero--placeholder\"\n }) : _jsx(\"img\", {\n alt: alt,\n className: \"pw-inbox_hero\",\n src: url\n })\n });\n}\n/** One cell of the web inbox widget, the `li.pw-inbox_item` the WebSDK draws. */\nexport function InboxWebCell(props) {\n const {\n content,\n layout,\n title,\n body,\n timeLabel,\n isRead,\n isActionPerformed,\n code,\n placeholder,\n onClick,\n onRemove,\n onSlideLinkClick\n } = props;\n const alt = content.title || content.body || '';\n const texts = _jsxs(\"div\", {\n className: \"pw-inbox_content\",\n children: [_jsxs(\"div\", {\n className: \"pw-inbox_item-title\",\n children: [title, !isRead && _jsx(\"span\", {\n className: \"pw-inbox_unread-dot\"\n })]\n }), _jsx(\"div\", {\n className: \"pw-inbox_item-body\",\n children: body\n }), _jsx(\"div\", {\n className: \"pw-inbox_item-time\",\n children: timeLabel\n })]\n });\n let media;\n if (layout === 'carousel' && !placeholder) {\n media = _jsx(Carousel, {\n alt: alt,\n onSlideLinkClick: onSlideLinkClick,\n slides: getInboxValidSlides(content.carousel)\n });\n } else if (layout !== 'classic') {\n media = _jsx(Hero, {\n alt: alt,\n placeholder: placeholder,\n url: getInboxHeroUrl(content)\n });\n }\n let icon;\n if (placeholder) {\n icon = _jsx(\"div\", {\n className: \"pw-inbox_icon pw-inbox_icon--placeholder\"\n });\n } else {\n icon = _jsx(\"div\", {\n className: \"pw-inbox_icon\",\n children: content.iconUrl ? _jsx(\"img\", {\n alt: alt,\n className: \"pw-inbox_message-image\",\n src: content.iconUrl\n }) : _jsx(\"span\", {\n className: \"pw-inbox_icon-initial\",\n children: getInboxIconInitial(content)\n })\n });\n }\n const className = ['pw-inbox_item', !isRead && 'pw-new', !isActionPerformed && 'pw-unread'].filter(Boolean).join(' ');\n return _jsxs(\"li\", {\n className: className,\n \"data-pw-inbox-message-id\": code,\n onClick: onClick,\n children: [_jsxs(\"div\", {\n className: `pw-inbox_item-inner pw-inbox_item--${layout}`,\n children: [layout === 'classic' ? icon : media, layout !== 'banner' && texts]\n }), _jsx(\"span\", {\n className: \"pw-inbox_item-remove\",\n onClick: stop(onRemove)\n })]\n });\n}\nfunction WidgetBody({\n messages,\n appearance,\n now,\n onMessageClick,\n onMessageRemove,\n onSlideLinkClick\n}) {\n if (messages.length === 0) {\n return _jsxs(\"div\", {\n className: \"pw-inbox_list--empty\",\n children: [_jsx(\"div\", {\n className: \"pw-inbox_list-icon\",\n children: _jsx(\"img\", {\n alt: appearance.emptyInboxTitle,\n src: appearance.emptyInboxIconUrl\n })\n }), _jsx(\"div\", {\n className: \"pw-inbox_list-title\",\n children: appearance.emptyInboxTitle\n }), _jsx(\"div\", {\n className: \"ipw-inbox_list-body\",\n children: appearance.emptyInboxText\n })]\n });\n }\n return _jsxs(\"div\", {\n className: \"pw-inbox_inner\",\n children: [_jsx(\"div\", {\n className: \"pw-inbox_title\",\n children: appearance.title\n }), _jsx(\"ul\", {\n className: \"pw-inbox_list\",\n children: messages.map(message => _jsx(InboxWebCell, {\n body: message.body,\n code: message.code,\n content: message,\n isActionPerformed: message.isActionPerformed,\n isRead: message.isRead,\n layout: resolveInboxLayout(message),\n onClick: () => onMessageClick?.(message.code),\n onRemove: () => onMessageRemove?.(message.code),\n onSlideLinkClick: link => onSlideLinkClick?.(message.code, link),\n timeLabel: formatInboxMessageTime(message.sendDate, now),\n title: message.title\n }, message.code))\n })]\n });\n}\n/** Classes and custom properties of a preview widget box; a live host sets them on its own element. */\nexport function inboxWidgetPreviewFrame(appearance, extraClass) {\n const className = ['pw-inbox-widget pw-inbox-widget--preview', extraClass, appearance.legacyClassicCell && 'pw-inbox-widget--legacy-cell'].filter(Boolean).join(' ');\n return {\n className,\n style: inboxWidgetStyleVariables(appearance)\n };\n}\n/** The web inbox widget: message list or empty state. `live` fills the host's `.pw-inbox-widget` element, `preview` draws the box inline. */\nexport function InboxWidgetReader(props) {\n const {\n mode,\n messages,\n now,\n onMessageClick,\n onMessageRemove,\n onSlideLinkClick\n } = props;\n const appearance = resolveInboxWidgetAppearance(props.appearance);\n const content = _jsxs(_Fragment, {\n children: [_jsx(\"style\", {\n children: INBOX_WIDGET_CSS\n }), _jsx(\"div\", {\n className: \"pw-inbox__arrow\"\n }), _jsx(WidgetBody, {\n appearance: appearance,\n messages: messages,\n now: now,\n onMessageClick: onMessageClick,\n onMessageRemove: onMessageRemove,\n onSlideLinkClick: onSlideLinkClick\n })]\n });\n if (mode === 'live') {\n return content;\n }\n const frame = inboxWidgetPreviewFrame(appearance, messages.length === 0 ? 'pw-inbox-widget--empty' : undefined);\n return _jsx(\"div\", {\n className: frame.className,\n style: frame.style,\n children: content\n });\n}","import { render } from 'preact';\n\nimport {\n InboxWidgetReader, type InboxWidgetAppearance, type InboxWidgetMessage,\n} from '@pushwoosh/websdk-common/inbox';\n\nimport { type IInboxMessagePublic } from '../../models/InboxMessages.types';\n\n/** Clicks the reader reports back; the widget owns the actions, this module only renders. */\nexport type InboxWidgetHandlers = {\n onMessageClick: (code: string) => void;\n onMessageRemove: (code: string) => void;\n onSlideLinkClick: (code: string, link: string) => void;\n};\n\n// `heroUrl` already carries the icon fallback and `layout` is resolved, so the\n// reader can only degrade it, never re-run the heuristic on the default title.\nexport const toInboxWidgetMessage = (message: IInboxMessagePublic): InboxWidgetMessage => ({\n code: message.code,\n title: message.title,\n body: message.message,\n iconUrl: message.iconUrl,\n bannerUrl: message.heroUrl,\n layoutType: message.layout,\n carousel: message.carousel,\n sendDate: message.sendDate,\n isRead: message.isRead,\n isActionPerformed: message.isActionPerformed,\n});\n\nexport const renderInboxWidget = (\n container: HTMLElement,\n messages: Array<IInboxMessagePublic>,\n appearance: InboxWidgetAppearance,\n handlers: InboxWidgetHandlers,\n): void => {\n render(\n <InboxWidgetReader\n mode=\"live\"\n messages={messages.map(toInboxWidgetMessage)}\n appearance={appearance}\n onMessageClick={handlers.onMessageClick}\n onMessageRemove={handlers.onMessageRemove}\n onSlideLinkClick={handlers.onSlideLinkClick}\n />,\n container,\n );\n};\n","/** Drawn when the configured colour is one the browser would refuse. */\nexport const FALLBACK_COLOR = '#333';\n\n// A colour value never needs these, and they are exactly what would end the\n// declaration or the rule it is interpolated into.\nconst RULE_BREAKERS = /[;{}]/;\n\n// One element, reused: the widgets validate every colour of their config on\n// each render.\nlet probe: HTMLElement | null = null;\n\n/** Keeps a colour the browser accepts, and replaces anything else with {@link FALLBACK_COLOR}. */\nexport function getValidColor(color: string): string {\n if (RULE_BREAKERS.test(color)) {\n return FALLBACK_COLOR;\n }\n\n if (!probe) {\n probe = document.createElement('div');\n }\n\n probe.style.color = '';\n probe.style.color = color;\n\n return probe.style.color ? color : FALLBACK_COLOR;\n}\n","import { getValidColor } from './cssColor';\n\nexport type TStyleVariableType = 'number' | 'color' | 'string' | 'size';\n\nexport interface IStyleVariable<TName extends string = string> {\n name: TName;\n type: TStyleVariableType;\n}\n\nexport function getCssVariableName(prefix: string, name: string): string {\n return `--${prefix}-${name}`;\n}\n\n// `null` means \"leave it unset\": a custom property holding garbage makes every\n// rule that reads it invalid, while an absent one falls back to the stylesheet.\nexport function formatStyleVariable(type: TStyleVariableType, value: string | number | undefined): string | null {\n switch (type) {\n case 'size': {\n const size = Number(value ?? 0);\n return Number.isFinite(size) ? `${size}px` : null;\n }\n case 'number': {\n const parsed = parseFloat(String(value));\n return Number.isFinite(parsed) ? String(parsed) : null;\n }\n case 'color': {\n const color = String(value);\n return getValidColor(color) === color ? color : null;\n }\n default: {\n const text = String(value).trim();\n return text || null;\n }\n }\n}\n\nexport function applyStyleVariables<TName extends string>(\n element: HTMLElement,\n prefix: string,\n variables: Array<IStyleVariable<TName>>,\n values: Record<TName, string | number>,\n): void {\n variables.forEach(({ name, type }) => {\n const formatted = formatStyleVariable(type, values[name]);\n\n if (formatted !== null) {\n element.style.setProperty(getCssVariableName(prefix, name), formatted);\n }\n });\n}\n","// Schemes that run script in the page's own origin; everything else either\n// navigates away or is handed to the OS.\nconst UNSAFE_SCHEME = /^(?:javascript|vbscript|data|blob|file):/i;\nconst HAS_SCHEME = /^[a-z][a-z\\d+\\-.]*:/i;\n\n// Browsers ignore whitespace and control characters while resolving a scheme,\n// so a tab inside \"java<tab>script:\" navigates just as `javascript:` does.\nfunction normalize(url: string): string {\n return url\n .split('')\n .filter((char) => char.charCodeAt(0) > 0x20 && char.charCodeAt(0) !== 0x7F)\n .join('');\n}\n\n/** True when the url is safe to assign to `location.href`. Relative urls qualify. */\nexport function isSafeUrl(url: string): boolean {\n return !!url && !UNSAFE_SCHEME.test(normalize(url));\n}\n\n/** True when the url carries a scheme and that scheme is safe to navigate to. */\nexport function isSafeAbsoluteUrl(url: string): boolean {\n const normalized = normalize(url);\n\n return HAS_SCHEME.test(normalized) && !UNSAFE_SCHEME.test(normalized);\n}\n","import { compareInboxBySendDate } from '@pushwoosh/websdk-common/inbox';\n\nimport {\n CONFIG_STYLES,\n DEFAULT_CONFIG,\n STYLE_PREFIX,\n SYNC_INTERVAL,\n TRIGGER_CONFIG_STYLES,\n} from './constants';\nimport { isElementFixed } from './helpers';\nimport { type IInboxWidgetConfig, type TMessagesElementsType } from './inbox_widget.types';\nimport { renderInboxWidget } from './renderer';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\nimport { applyStyleVariables } from '../../helpers/cssVariables';\nimport { isSafeUrl } from '../../helpers/url';\nimport { type IInboxMessagePublic } from '../../models/InboxMessages.types';\n\nexport class PWInboxWidget {\n pw: Pushwoosh;\n widget: HTMLElement;\n trigger: HTMLElement;\n list: HTMLElement;\n widgetParent: HTMLElement;\n count: number;\n messages: Array<IInboxMessagePublic>;\n messagesElements: TMessagesElementsType;\n readItems: Array<string>;\n isOpened: boolean;\n config: IInboxWidgetConfig;\n defaultMargin: number;\n isFixed: boolean;\n private lastSyncAt: number = 0;\n\n constructor(pw: Pushwoosh) {\n // Set Pushwoosh object\n this.pw = pw;\n\n const inboxWidgetConfig = this.pw.initParams.inboxWidget!;\n\n this.config = {\n ...DEFAULT_CONFIG,\n arrowBorderColor: inboxWidgetConfig.borderColor && inboxWidgetConfig.borderColor !== 'transparent'\n ? inboxWidgetConfig.borderColor\n : 'rgba(0,0,0,.1)',\n ...this.pw.initParams.inboxWidget,\n };\n\n this.updateInbox = this.updateInbox.bind(this);\n this.markVisibleItemsAsRead = this.markVisibleItemsAsRead.bind(this);\n this.onWidgetClickHandler = this.onWidgetClickHandler.bind(this);\n this.onTriggerClickHandler = this.onTriggerClickHandler.bind(this);\n this.onWindowScrollHandler = this.onWindowScrollHandler.bind(this);\n this.toggle = this.toggle.bind(this);\n }\n\n public async run() {\n // The CDN loader already skips this bundle when off; an npm site constructs the widget itself.\n if (this.pw.initParams.inboxWidget?.enable === false) {\n return;\n }\n\n this.initTrigger();\n this.updateInbox();\n this.addListeners();\n }\n\n public toggle(isOpened?: boolean) {\n const openWidget = typeof isOpened === 'undefined'\n ? !this.isOpened\n : isOpened;\n\n if (openWidget) {\n this.openWidget();\n } else {\n this.closeWidget();\n }\n }\n\n // set inbox widget to trigger element on page\n private initTrigger() {\n if (!this.pw.pwinbox) {\n throw new Error('Web inbox is not allowed.');\n }\n\n const trigger = document.getElementById(this.config.triggerId);\n\n if (!trigger) {\n throw new Error(`Pushwoosh: inbox trigger element #${this.config.triggerId} is not on the page. Add it, or change Trigger ID in the Pushwoosh Control Panel or inboxWidget.triggerId in the snippet.`);\n }\n\n this.trigger = trigger;\n this.trigger.classList.add('pw-inbox-trigger');\n\n // Init has just pulled the inbox itself, so the first bell open must not\n // fetch the whole thing again seconds later.\n this.lastSyncAt = Date.now();\n\n this.defaultMargin = 12;\n this.messagesElements = {};\n this.messages = [];\n this.readItems = [];\n this.updateCounter(0);\n this.isOpened = false;\n\n this.renderWidget();\n\n this.isFixed = isElementFixed(this.trigger);\n }\n\n private renderWidget() {\n this.widget = document.createElement('div');\n this.widget.id = 'pwInboxWidget';\n this.widget.className = 'pw-inbox-widget';\n this.widget.classList.toggle('pw-open', this.isOpened);\n this.widget.classList.toggle('pw-inbox-widget--legacy-cell', this.config.legacyClassicCell);\n\n this.widgetParent = document.querySelector(this.config.appendTo) || document.body;\n\n this.widgetParent.appendChild(this.widget);\n this.applyStyleVariables();\n this.renderWidgetInner();\n }\n\n private applyStyleVariables() {\n applyStyleVariables(this.widget, STYLE_PREFIX, CONFIG_STYLES, this.config);\n applyStyleVariables(this.trigger, STYLE_PREFIX, TRIGGER_CONFIG_STYLES, this.config);\n }\n\n private renderWidgetInner() {\n this.widget.classList.toggle('pw-inbox-widget--empty', this.messages.length === 0);\n\n renderInboxWidget(this.widget, this.messages, this.config, {\n onMessageClick: (code) => this.performMessageAction(code),\n onMessageRemove: (code) => this.removeMessages([code]),\n onSlideLinkClick: (code, link) => {\n if (isSafeUrl(link)) {\n document.location.href = link;\n } else {\n this.performMessageAction(code);\n }\n },\n });\n\n this.list = this.widget.querySelector('.pw-inbox_list') || document.createElement('ul');\n this.messagesElements = {};\n this.widget.querySelectorAll<HTMLElement>('[data-pw-inbox-message-id]').forEach((element) => {\n this.messagesElements[element.getAttribute('data-pw-inbox-message-id') || ''] = element;\n });\n }\n\n private updateCounter(count: number) {\n this.count = count;\n this.trigger.setAttribute('data-pw-count', `${this.count}`);\n this.trigger.classList.toggle('pw-empty', this.count === 0);\n }\n\n private updateInboxMessages(messages: Array<IInboxMessagePublic>) {\n this.messages = messages.sort(({ sendDate: sendDateOne }, { sendDate: sendDateTwo }) => compareInboxBySendDate(sendDateOne, sendDateTwo));\n this.renderWidgetInner();\n }\n\n openWidget() {\n this.isOpened = true;\n this.widget.classList.add('pw-open');\n this.syncMessages();\n document.addEventListener('click', this.onWidgetClickHandler);\n window.addEventListener('scroll', this.onWindowScrollHandler);\n window.addEventListener('resize', this.onWindowScrollHandler);\n this.markVisibleItemsAsRead();\n if (this.messages.length > 0) {\n this.list.addEventListener('scroll', this.markVisibleItemsAsRead);\n }\n this.positionWidget();\n }\n\n closeWidget() {\n this.isOpened = false;\n document.removeEventListener('click', this.onWidgetClickHandler);\n window.removeEventListener('scroll', this.onWindowScrollHandler);\n window.removeEventListener('resize', this.onWindowScrollHandler);\n this.updateReadStatus();\n if (this.messages.length > 0) {\n this.list.removeEventListener('scroll', this.markVisibleItemsAsRead);\n }\n this.widget.classList.remove('pw-open', 'pw-top', 'pw-bottom', 'pw-right', 'pw-left');\n this.widget.removeAttribute('style');\n }\n\n private positionWidget() {\n if (!this.isOpened) {\n return;\n }\n if (this.widgetParent === document.body) {\n this.defaultPlaceWidget();\n } else {\n this.customPlaceWidget();\n }\n }\n\n private customPlaceWidget() {\n const { position } = this.config;\n this.widgetParent.style.position = 'relative';\n this.widget.classList.add('pw-inbox-widget--inset');\n this.widget.classList.add(`pw-${position}`);\n }\n\n private defaultPlaceWidget() {\n const position = this.pw.initParams.inboxWidget!.position ? this.config.position : this.getDefaultPosition();\n\n const widgetRect = this.widget.getBoundingClientRect();\n if (!document.documentElement) {\n return;\n }\n const windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n const windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n\n if (widgetRect.width + (this.defaultMargin * 2) > windowWidth) {\n this.widget.style.width = `${windowWidth - (this.defaultMargin * 2)}px`;\n }\n if (widgetRect.height + 24 > windowHeight) {\n this.widget.style.height = `${windowHeight - (this.defaultMargin * 2)}px`;\n }\n\n switch (position) {\n case 'top': {\n this.alignWidgetTop();\n break;\n }\n case 'right': {\n this.alignWidgetRight();\n break;\n }\n case 'left': {\n this.alignWidgetLeft();\n break;\n }\n case 'bottom': {\n this.alignWidgetBottom();\n break;\n }\n }\n }\n\n private alignWidgetTop() {\n const triggerRect = this.trigger.getBoundingClientRect();\n const widgetRect = this.widget.getBoundingClientRect();\n if (!document.documentElement) {\n return;\n }\n const windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n const arrow: HTMLElement = this.widget.querySelector('.pw-inbox__arrow') || document.createElement('div');\n\n this.widget.classList.add('pw-top');\n\n let left = pageXOffset + triggerRect.left + Math.floor(triggerRect.width / 2) - Math.floor(widgetRect.width / 2);\n\n const isUnderLeft = left < pageXOffset;\n const isUnderRight = left + widgetRect.width > pageXOffset + windowWidth;\n\n if (isUnderLeft) {\n left = pageXOffset + this.defaultMargin;\n }\n if (isUnderRight) {\n left = pageXOffset + windowWidth - widgetRect.width - this.defaultMargin;\n }\n\n const top = pageYOffset + triggerRect.top - widgetRect.height;\n\n this.alignWidgetElement(left, top);\n arrow.style.left = `${triggerRect.left + Math.floor(triggerRect.width / 2) - left}px`;\n\n const topMargin = this.widget.getBoundingClientRect().top;\n const isUnderTop = topMargin < 0;\n if (isUnderTop) {\n const newHeight = this.widget.getBoundingClientRect().height + topMargin - this.defaultMargin;\n const newTop = this.widget.getBoundingClientRect().top - topMargin + this.defaultMargin;\n this.widget.style.height = `${newHeight}px`;\n this.widget.style.top = `${newTop}px`;\n }\n }\n\n private alignWidgetRight() {\n const triggerRect = this.trigger.getBoundingClientRect();\n const widgetRect = this.widget.getBoundingClientRect();\n if (!document.documentElement) {\n return;\n }\n const windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n const windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n const arrow: HTMLElement = this.widget.querySelector('.pw-inbox__arrow') || document.createElement('div');\n\n this.widget.classList.add('pw-right');\n\n let top = pageYOffset + triggerRect.top + Math.floor(triggerRect.height / 2) - Math.floor(widgetRect.height / 2);\n\n const isUnderTop = top < pageYOffset;\n const isUnderBottom = pageYOffset + windowHeight < top + widgetRect.height;\n\n if (isUnderTop) {\n top = pageYOffset + this.defaultMargin;\n }\n\n if (isUnderBottom) {\n top = pageYOffset + windowHeight - widgetRect.height - this.defaultMargin;\n }\n\n const left = pageXOffset + triggerRect.left + triggerRect.width;\n\n this.alignWidgetElement(left, top);\n arrow.style.top = `${triggerRect.top + Math.floor(triggerRect.height / 2) - top}px`;\n\n const rightMargin = windowWidth - this.widget.getBoundingClientRect().right;\n const isUnderRight = rightMargin < this.defaultMargin;\n if (isUnderRight) {\n const newWidth = this.widget.getBoundingClientRect().width + rightMargin - this.defaultMargin;\n this.widget.style.width = `${newWidth}px`;\n }\n }\n\n private alignWidgetLeft() {\n const triggerRect = this.trigger.getBoundingClientRect();\n const widgetRect = this.widget.getBoundingClientRect();\n if (!document.documentElement) {\n return;\n }\n const windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n const arrow: HTMLElement = this.widget.querySelector('.pw-inbox__arrow') || document.createElement('div');\n\n this.widget.classList.add('pw-left');\n\n let top = pageYOffset + triggerRect.top + Math.floor(triggerRect.height / 2) - Math.floor(widgetRect.height / 2);\n\n const isUnderTop = top < pageYOffset;\n const isUnderBottom = pageYOffset + windowHeight < top + widgetRect.height;\n\n if (isUnderTop) {\n top = pageYOffset + this.defaultMargin;\n }\n\n if (isUnderBottom) {\n top = pageYOffset + windowHeight - widgetRect.height - this.defaultMargin;\n }\n\n const left = pageXOffset + triggerRect.left - widgetRect.width;\n\n this.alignWidgetElement(left, top);\n arrow.style.top = `${triggerRect.top + Math.floor(triggerRect.height / 2) - top}px`;\n\n const leftMargin = this.widget.getBoundingClientRect().left;\n const isUnderLeft = leftMargin < 0;\n if (isUnderLeft) {\n const newWidth = this.widget.getBoundingClientRect().width + leftMargin - this.defaultMargin;\n const newLeft = this.widget.getBoundingClientRect().left - leftMargin;\n this.widget.style.width = `${newWidth}px`;\n this.widget.style.left = `${newLeft}px`;\n }\n }\n\n private alignWidgetBottom() {\n const triggerRect = this.trigger.getBoundingClientRect();\n const widgetRect = this.widget.getBoundingClientRect();\n if (!document.documentElement) {\n return;\n }\n const windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n const windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n const arrow: HTMLElement = this.widget.querySelector('.pw-inbox__arrow') || document.createElement('div');\n\n this.widget.classList.add('pw-bottom');\n\n let left = pageXOffset + triggerRect.left + Math.floor(triggerRect.width / 2) - Math.floor(widgetRect.width / 2);\n\n const isUnderLeft = left < pageXOffset;\n const isUnderRight = left + widgetRect.width > pageXOffset + windowWidth;\n\n if (isUnderLeft) {\n left = pageXOffset + this.defaultMargin;\n }\n if (isUnderRight) {\n left = pageXOffset + windowWidth - widgetRect.width - 12;\n }\n\n const top = pageYOffset + triggerRect.top + triggerRect.height;\n\n this.alignWidgetElement(left, top);\n arrow.style.left = `${triggerRect.left + Math.floor(triggerRect.width / 2) - left}px`;\n\n const bottomRange = windowHeight - this.widget.getBoundingClientRect().bottom;\n const isUnderBottom = bottomRange < this.defaultMargin;\n if (isUnderBottom) {\n const newHeight = this.widget.getBoundingClientRect().height + bottomRange - this.defaultMargin;\n this.widget.style.height = `${newHeight}px`;\n }\n }\n\n private alignWidgetElement(left: number, top: number) {\n this.widget.style.left = `${left}px`;\n this.widget.style.top = `${top}px`;\n }\n\n private getDefaultPosition(): string {\n const { left, top, width, height } = this.trigger.getBoundingClientRect();\n if (!document.documentElement) {\n return '';\n }\n const windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n const windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n\n const antiMargins: { [key: string]: number } = {\n right: left,\n bottom: top,\n left: windowWidth - (left + width),\n top: windowHeight - (top + height),\n };\n\n const leastMargin = Math.min(left, top, antiMargins.left, antiMargins.top);\n\n let position = 'bottom';\n\n Object.keys(antiMargins).forEach((key) => {\n if (antiMargins[key] === leastMargin) {\n position = key;\n }\n });\n\n return position;\n }\n\n private addListeners() {\n this.trigger.addEventListener('click', this.onTriggerClickHandler);\n\n this.pw.push(['onPutNewMessageToInboxStore', () => {\n this.updateInbox();\n }]);\n this.pw.push(['onUpdateInboxMessages', () => {\n this.updateInbox();\n }]);\n }\n\n private markVisibleItemsAsRead() {\n if (this.messages.length === 0) {\n return;\n }\n const scrollTop = (this.list.clientHeight + this.list.scrollTop) - 50;\n Object.keys(this.messagesElements).forEach((code: string) => {\n // check message exists and user saw the message in viewport\n if (!this.messagesElements[code] || this.messagesElements[code].offsetTop > scrollTop) {\n return;\n }\n\n const message = this.messages.find((message: IInboxMessagePublic): boolean => message.code === code);\n\n // mark messages as read\n if (!!message && !message.isRead && !(this.readItems.indexOf(code) + 1)) {\n this.readItems.push(code);\n }\n });\n }\n\n private updateReadStatus() {\n // Taken and cleared in one step: the codes are reported once, and a long\n // session does not keep growing the array across every open/close cycle.\n const codes = this.readItems;\n this.readItems = [];\n\n this.pw.pwinbox.readMessagesWithCodes(codes).then(this.updateInbox);\n }\n\n // Opening the bell is the only refresh besides init: a standalone App Inbox\n // message rides a channel with no sender, so no push announces one.\n private syncMessages() {\n // getInboxMessages returns the whole inbox, with no paging on the server\n // side, so toggling the bell must not turn into a request per click.\n if (Date.now() - this.lastSyncAt < SYNC_INTERVAL) {\n return;\n }\n\n this.lastSyncAt = Date.now();\n\n this.pw.pwinbox.syncMessages().catch((error: unknown) => {\n // Not the SDK Logger: it drags `core/storage` in and costs this bundle\n // ~20 KiB. SubscriptionButton logs the same way for the same reason.\n console.error('Pushwoosh: cannot refresh the inbox on open', error);\n });\n }\n\n private updateInbox() {\n this.pw.pwinbox.loadMessages().then((messages: Array<IInboxMessagePublic>) => {\n this.updateInboxMessages(messages);\n });\n this.pw.pwinbox.unreadMessagesCount().then((count: number) => {\n this.updateCounter(count);\n });\n }\n\n private performMessageAction(code: string) {\n const message = this.messages.find((item: IInboxMessagePublic): boolean => item.code === code);\n\n // The popup is modal and locks body scroll, so the panel it was opened\n // from is left stranded under the overlay.\n if (message && message.webPopupCode) {\n this.toggle(false);\n }\n\n this.pw.pwinbox.performActionForMessageWithCode(code)\n .then(() => {\n this.updateInbox();\n });\n }\n\n private removeMessages(messages: Array<string>) {\n // Was `slice(indexOf(code), 1)`, which returns an empty array for any index\n // past 1 and so discarded every pending read code, not just this one.\n this.readItems = this.readItems.filter((code: string) => messages.indexOf(code) === -1);\n this.pw.pwinbox.deleteMessagesWithCodes(messages)\n .then(() => {\n this.updateInbox();\n });\n }\n\n // handlers\n\n private onTriggerClickHandler(event: MouseEvent) {\n event.stopPropagation();\n if (!event.target) {\n return;\n }\n\n this.toggle();\n }\n\n // Clicks inside a message are handled by the reader; any other click closes the widget.\n private onWidgetClickHandler(event: MouseEvent) {\n if (!event.target) {\n return;\n }\n\n if (!(<HTMLElement>event.target).closest('.pw-inbox_item')) {\n this.toggle();\n }\n }\n\n private onWindowScrollHandler() {\n if (this.isFixed && this.isOpened) {\n this.toggle();\n return;\n }\n this.positionWidget();\n }\n}\n"],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE__524__","__WEBPACK_EXTERNAL_MODULE__873__","__WEBPACK_EXTERNAL_MODULE__247__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","INBOX_KNOWN_LAYOUTS","INBOX_WIDGET_STYLE_PREFIX","INBOX_MONTHS","INBOX_WIDGET_STYLE_VARIABLES","name","type","INBOX_WIDGET_DEFAULT_APPEARANCE","title","bgColor","textColor","fontFamily","borderRadius","borderColor","badgeBgColor","badgeTextColor","widgetWidth","zIndex","messageTitleColor","timeTextColor","emptyInboxTitle","emptyInboxTitleColor","emptyInboxText","emptyInboxTextColor","emptyInboxIconUrl","arrowBorderColor","legacyClassicCell","unreadDotColor","avatarBgColor","avatarTextColor","avatarSize","mediaRadius","slideCaptionColor","slideScrimColor","pagerDotActiveColor","pagerDotColor","MINUTE","HOUR","RULE_BREAKERS","getInboxValidSlides","slides","Array","isArray","filter","slide","imageUrl","slice","getInboxHeroUrl","content","bannerUrl","iconUrl","resolveInboxLayout","hasTitle","hasBody","body","hero","requested","layoutType","includes","carousel","length","getInboxIconInitial","trim","charAt","toUpperCase","formatInboxMessageTime","sendDate","now","Date","date","gap","getTime","Math","floor","minutes","getMinutes","getDate","getMonth","getFullYear","getHours","inboxWidgetStyleVariables","appearance","variables","forEach","formatted","size","Number","isFinite","parsed","parseFloat","String","text","test","formatInboxStyleValue","STYLE_PREFIX","CONFIG_STYLES","TRIGGER_STYLE_NAMES","TRIGGER_CONFIG_STYLES","style","indexOf","DEFAULT_CONFIG","enable","triggerId","position","appendTo","isElementFixed","element","isFixed","window","getComputedStyle","parentElement","stop","handler","event","stopPropagation","Carousel","alt","onSlideLinkClick","index","setIndex","compat_root_preactCompat_","useState","active","min","onSlideClick","link","jsx_runtime_root_jsxRuntime_","jsxs","className","children","onClick","jsx","caption","src","map","_slide","slideIndex","Hero","url","placeholder","InboxWebCell","props","layout","timeLabel","isRead","isActionPerformed","code","onRemove","texts","media","icon","Boolean","join","WidgetBody","messages","onMessageClick","onMessageRemove","message","InboxWidgetReader","mode","resolveInboxWidgetAppearance","Fragment","frame","extraClass","inboxWidgetPreviewFrame","toInboxWidgetMessage","heroUrl","FALLBACK_COLOR","cssColor_RULE_BREAKERS","probe","formatStyleVariable","color","document","createElement","getValidColor","applyStyleVariables","prefix","values","setProperty","getCssVariableName","UNSAFE_SCHEME","normalize","split","char","charCodeAt","PWInboxWidget","constructor","pw","lastSyncAt","inboxWidgetConfig","initParams","inboxWidget","config","updateInbox","bind","markVisibleItemsAsRead","onWidgetClickHandler","onTriggerClickHandler","onWindowScrollHandler","toggle","run","initTrigger","addListeners","isOpened","openWidget","closeWidget","pwinbox","Error","trigger","getElementById","classList","add","defaultMargin","messagesElements","readItems","updateCounter","renderWidget","widget","id","widgetParent","querySelector","appendChild","renderWidgetInner","container","handlers","performMessageAction","removeMessages","location","href","external_commonjs_preact_commonjs2_preact_amd_preact_root_preact_","render","list","querySelectorAll","getAttribute","count","setAttribute","updateInboxMessages","sort","sendDateOne","sendDateTwo","compareInboxBySendDate","one","syncMessages","addEventListener","positionWidget","removeEventListener","updateReadStatus","remove","removeAttribute","defaultPlaceWidget","customPlaceWidget","getDefaultPosition","widgetRect","getBoundingClientRect","documentElement","windowWidth","max","clientWidth","innerWidth","windowHeight","clientHeight","innerHeight","width","height","alignWidgetTop","alignWidgetRight","alignWidgetLeft","alignWidgetBottom","triggerRect","arrow","left","pageXOffset","isUnderLeft","isUnderRight","top","pageYOffset","alignWidgetElement","topMargin","newHeight","newTop","isUnderTop","isUnderBottom","rightMargin","right","newWidth","leftMargin","newLeft","bottomRange","bottom","antiMargins","leastMargin","keys","push","scrollTop","offsetTop","find","codes","readMessagesWithCodes","then","catch","error","console","loadMessages","unreadMessagesCount","item","webPopupCode","performActionForMessageWithCode","deleteMessagesWithCodes","target","closest"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("preact"),require("preact/compat"),require("preact/jsx-runtime"));else if("function"==typeof define&&define.amd)define(["preact","preact/compat","preact/jsx-runtime"],e);else{var n="object"==typeof exports?e(require("preact"),require("preact/compat"),require("preact/jsx-runtime")):e(t.preact,t.preactCompat,t.jsxRuntime);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(t,e,n)=>(()=>{"use strict";var o={524(e){e.exports=t},873(t){t.exports=e},247(t){t.exports=n}};const i={};function r(t){const e=i[t];if(void 0!==e)return e.exports;const n=i[t]={exports:{}};return o[t](n,n.exports,r),n.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};let s={};r.r(s),r.d(s,{PWSubscriptionWidget:()=>St});const a=/^(https?:|mailto:|tel:)/i,c="#101828",l="#667085",d="#FFFFFF",u={background:"#FFFFFF",accent:"#2970FF",text:c,textSecondary:l,textInverse:"#FFFFFF"};function h(t,e){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:6,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===t?{backgroundColor:e.surface,color:e.accent,border:`1px solid ${e.accent}`}:{backgroundColor:e.accent,color:e.onAccent,border:"none"}}}const p={card:["top","bottom","top-left","top-right","bottom-left","bottom-right"],bar:["top","bottom"],modal:["center"]},f=Object.keys(p),b=["bottom-right","bottom-left","top-right","top-left"],m=["auto","launcher","manual"],g={delay:[0,3600],cappingCount:[0,100],cappingInterval:[0,8760],borderRadius:[0,32],offset:[0,100],launcherSize:[16,200],zIndex:[0,2147483647]},y={enable:!1,prompt:{enabled:!1,layout:"card",position:"top",borderRadius:12,overlay:!1},launcher:{enabled:!1,position:"bottom-right",offset:20,width:48,height:48},display:{trigger:"auto",delay:5,cappingCount:3,cappingInterval:4},texts:{title:"Stay in the loop",message:"Allow notifications to get our news and special offers first.",acceptText:"Allow",declineText:"Not now",closeText:"Got it",blockedTitle:"Notifications are blocked",blockedMessage:"To get our notifications, allow them for this site in your browser settings.",launcherLabel:"Subscribe to notifications",launcherBlockedLabel:"Notifications are blocked"},colors:u,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',zIndex:2147483e3},x=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function w(t){const e=x.exec(t.trim())?.[1];if(!e)return null;const n=3===e.length?e.split("").map(t=>t+t).join(""):e;return[0,2,4].map(t=>parseInt(n.slice(t,t+2),16))}function v([t,e,n]){return`#${[t,e,n].map(t=>Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0")).join("")}`}function k(t,e,n){let o=n;return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+6*(e-t)*o:o<.5?e:o<2/3?t+(e-t)*(2/3-o)*6:t}function M(t){return t>.5?.07+.86*(1-t):t}function S(t){return t<.5?.93-t*((.93-.5)/.5):t}function j(t,e){const n=w(t);if(!n)return t;const[o,i,r]=function([t,e,n]){const[o,i,r]=[t/255,e/255,n/255],s=Math.max(o,i,r),a=Math.min(o,i,r),c=(s+a)/2;if(s===a)return[0,0,c];const l=s-a;let d;return d=s===o?(i-r)/l+(i<r?6:0):s===i?(r-o)/l+2:(o-i)/l+4,[d/6,c>.5?l/(2-s-a):l/(s+a),c]}(n);return v(function([t,e,n]){if(0===e){const t=255*n;return[t,t,t]}const o=n<.5?n*(1+e):n+e-n*e,i=2*n-o;return[255*k(i,o,t+1/3),255*k(i,o,t),255*k(i,o,t-1/3)]}([o,i,"fold"===e?M(r):S(r)]))}function I(t,e,n){const o=w(t),i=w(e);return o&&i?v(o.map((t,e)=>t+(i[e]-t)*n)):t}function C(t){const e=w(t);if(!e)return!1;const[n,o,i]=e;return(.299*n+.587*o+.114*i)/255>.6}function F(t){return{background:j(t.background,"fold"),accent:t.accent,text:j(t.text,"lift"),textSecondary:j(t.textSecondary,"lift"),textInverse:t.textInverse}}function z(t,e){return"light"===e?{surface:u.background,surfaceText:c,border:"#D0D5DD",onAccent:d,error:"#D92D20",chromeIcon:l}:{surface:I(t.background,t.text,.08),surfaceText:t.text,border:I(t.background,t.text,.24),onAccent:C(t.accent)?c:d,error:"#FDA29B",chromeIcon:t.textSecondary}}function A(t){return!0===t.dark?.enabled}function P(t,e="light"){return"dark"===e&&A(t)?"dark":"light"}function E(t,e="light"){const n=P(t,e),o="dark"===n?(i=t.colors,r=t.dark,{...F(i),...r?.colors??{}}):t.colors;var i,r;return{...o,scheme:n,...z(o,n)}}function T(t){const e=(t||"").trim();if(e)return e.startsWith("#")||e.startsWith("/")||e.startsWith("?")||a.test(e)?e:void 0}new Set(["STRONG","B","EM","I","U","BR","A"]);function D(t){return"string"==typeof t&&t?t:void 0}function H(t){const e="object"==typeof t.colors&&null!==t.colors?t.colors:{};return{background:D(e.background)??D(t.background)??u.background,accent:D(e.accent)??D(t.accent)??u.accent,text:D(e.text)??u.text,textSecondary:D(e.textSecondary)??u.textSecondary,textInverse:D(e.textInverse)??u.textInverse}}function L(t,e){const n=t.dark;if("object"!=typeof n||null===n)return;const o=n,i="object"==typeof o.colors&&null!==o.colors?o.colors:{},r=F(e),s=function(t){if("object"!=typeof t||null===t)return;const e=t,n=D(e.color);if(!n)return;return{color:n,opacity:"number"==typeof e.opacity&&Number.isFinite(e.opacity)?Math.max(0,Math.min(1,e.opacity)):1}}(o.overlay);return{enabled:!0===o.enabled,colors:{background:D(i.background)??r.background,accent:D(i.accent)??r.accent,text:D(i.text)??r.text,textSecondary:D(i.textSecondary)??r.textSecondary,textInverse:D(i.textInverse)??r.textInverse},...s?{overlay:s}:{},...D(o.boxShadow)?{boxShadow:o.boxShadow}:{}}}function O(t){return"object"!=typeof t||null===t||Array.isArray(t)?{}:t}function R(t,e,n){return e.includes(t)?t:n}function W(t,[e,n],o){return"number"==typeof t&&Number.isFinite(t)?Math.max(e,Math.min(n,Math.round(t))):o}function q(t,e){if("string"!=typeof t)return e;const n=t.trim();return n?n.slice(0,300):e}function B(t){const e=T("string"==typeof t?t:void 0);return e&&/^(https?:\/\/|\/)/i.test(e)?e:void 0}function U(t,e){const n="string"==typeof e?e.trim().slice(0,64):"";return n?{[t]:n}:{}}function V(t){const e=y.texts,n=Object.keys(e);return Object.fromEntries(n.map(n=>[n,q(t[n],e[n])]))}function _(t){return"default"===t||"denied"===t}function N(t){return"denied"===t?"blocked":"ask"}function $(t,e){return t.launcher.enabled&&_(e)}var G=r(247),K=r(524),X=r(873);const J="(prefers-color-scheme: dark)";function Q(t,e){const[n,o]=(0,X.useState)(()=>"auto"===t&&e&&"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(J).matches);return(0,X.useEffect)(()=>{if("auto"!==t||!e||"undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia(J),i=t=>o(t.matches);return o(n.matches),n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[t,e]),"auto"!==t?t:n?"dark":"light"}const Y={bell:"M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0",gift:"M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z",cart:"M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",chart:"M3 21h18M7 21V11M12 21V6M17 21v-8",lock:"M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3",calendar:"M4 6h16v15H4zM4 10h16M9 3v4M15 3v4",check:"M4 13l5 5L20 6",star:"M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z",clock:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2",tag:"M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0",mail:"M3 6h18v12H3zM3 7l9 6 9-6",phone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4",download:"M12 3v12M7 11l5 5 5-5M4 20h16",play:"M8 5l12 7-12 7z",shield:"M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z",sparkle:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z",percent:"M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0",truck:"M2 7h12v10H2zM14 10h4l3 3v4h-7M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",ticket:"M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12",user:"M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0"},Z=(Object.keys(Y),"0 12px 32px rgba(16, 24, 40, 0.18)");function tt(t,e){const[n,o]=t.split("-");return{[n]:e,[o]:e}}function et(t,e){return e?(t?"pw-subw-drop":"pw-subw-rise")+" 0.3s ease-out backwards":void 0}function nt(t,e,n){const{layout:o,position:i}=t.prompt,r={position:e,zIndex:t.zIndex,boxSizing:"border-box",pointerEvents:"auto"};if("bar"===o)return{...r,left:0,right:0,[i]:0,animation:et("top"===i,n)};if("modal"===o)return{...r,top:"50%",left:"50%",width:"min(420px, calc(100% - 32px))",transform:"translate(-50%, -50%)",animation:n?"pw-subw-fade 0.25s ease-out backwards":void 0};const s="min(360px, calc(100% - 32px))",a=et(i.startsWith("top"),n);return"top"===i||"bottom"===i?{...r,[i]:16,left:"50%",width:s,transform:"translateX(-50%)",animation:a}:{...r,...tt(i,16),width:s,animation:a}}function ot({label:t,primary:e,colors:n,disabled:o,onClick:i}){return(0,G.jsx)("button",{type:"button",disabled:o,onClick:i,style:{...h(e?"primary":"secondary",n),display:"inline-block",width:"auto",padding:"8px 18px",whiteSpace:"nowrap",opacity:o?.6:1,cursor:o?"default":"pointer"},children:t})}function it({config:t,variant:e,colors:n,busy:o,onAccept:i,onDecline:r}){const{prompt:s,texts:a}=t,c="bar"===s.layout,l="blocked"===e;return(0,G.jsxs)("div",{role:"dialog","aria-label":l?a.blockedTitle:a.title,style:{display:"flex",flexDirection:c?"row":"column",alignItems:c?"center":"stretch",flexWrap:c?"wrap":"nowrap",gap:16,padding:c?"12px 20px":20,boxSizing:"border-box",width:"100%",borderRadius:c?0:s.borderRadius,boxShadow:Z,backgroundColor:n.background,color:n.text,fontFamily:t.fontFamily,colorScheme:n.scheme},children:[(0,G.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:12,flex:c?"1 1 240px":void 0},children:[s.iconUrl&&(0,G.jsx)("img",{src:s.iconUrl,alt:"",width:48,height:48,style:{flex:"none",borderRadius:8,objectFit:"cover"}}),(0,G.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:0},children:[(0,G.jsx)("div",{style:{fontSize:16,fontWeight:600,lineHeight:1.4},children:l?a.blockedTitle:a.title}),(0,G.jsx)("div",{style:{fontSize:14,lineHeight:1.5,color:n.textSecondary},children:l?a.blockedMessage:a.message})]})]}),(0,G.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,flex:"none"},children:l?(0,G.jsx)(ot,{label:a.closeText,primary:!0,colors:n,onClick:r}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ot,{label:a.declineText,primary:!1,colors:n,onClick:r}),(0,G.jsx)(ot,{label:a.acceptText,primary:!0,colors:n,disabled:o,onClick:i})]})})]})}function rt({config:t,blocked:e,colors:n,onClick:o}){const{width:i,height:r,imageUrl:s}=t.launcher,a=e?t.texts.launcherBlockedLabel:t.texts.launcherLabel,c=Math.round(Math.min(i,r)/2),l={display:"flex",alignItems:"center",justifyContent:"center",width:i,height:r,padding:0,border:"none",cursor:"pointer",opacity:e?.7:1};return s?(0,G.jsx)("button",{type:"button","aria-label":a,title:a,onClick:o,style:{...l,background:"none"},children:(0,G.jsx)("img",{src:s,alt:"",width:i,height:r,style:{display:"block",objectFit:"contain"}})}):(0,G.jsx)("button",{type:"button","aria-label":a,title:a,onClick:o,style:{...l,borderRadius:"50%",backgroundColor:t.launcher.background??n.accent,color:t.launcher.iconColor??n.onAccent,boxShadow:Z},children:(0,G.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,G.jsx)("path",{d:Y.bell}),e&&(0,G.jsx)("path",{d:"M4 4l16 16"})]})})}function st({config:t,permission:e,open:n,mode:o="live",colorScheme:i="auto",busy:r,onAccept:s,onDecline:a,onLauncherClick:c}){const l=E(t,Q(i,A(t))),d="live"===o,u=d?"fixed":"absolute",h=n&&t.prompt.enabled,p=$(t,e);return h||p?(0,G.jsxs)(G.Fragment,{children:[d&&(0,G.jsx)("style",{children:"\n@keyframes pw-subw-fade { from { opacity: 0; } }\n@keyframes pw-subw-drop { from { opacity: 0; translate: 0 -16px; } }\n@keyframes pw-subw-rise { from { opacity: 0; translate: 0 16px; } }\n"}),h&&t.prompt.overlay&&(0,G.jsx)("div",{style:{position:u,inset:0,zIndex:t.zIndex,backgroundColor:"rgba(16, 24, 40, 0.5)",animation:d?"pw-subw-fade 0.2s ease-out backwards":void 0,pointerEvents:"auto"},onClick:a}),h&&(0,G.jsx)("div",{style:nt(t,u,d),children:(0,G.jsx)(it,{config:t,variant:N(e),colors:l,busy:r,onAccept:s,onDecline:a})}),p&&(0,G.jsx)("div",{style:{position:u,zIndex:t.zIndex,pointerEvents:"auto",...tt(t.launcher.position,t.launcher.offset)},children:(0,G.jsx)(rt,{config:t,blocked:"denied"===e,colors:l,onClick:c})})]}):null}const at="keyValue",ct="messages",lt="inboxMessages";function dt(t,e){return function(n){n.objectStoreNames.contains(t)||e(n)}}const ut=[dt(at,function(t){t.createObjectStore(at,{keyPath:"key"})}),dt("log",function(t){const e=t.createObjectStore("log",{keyPath:"id",autoIncrement:!0});e.createIndex("environment","environment",{unique:!1}),e.createIndex("date","date",{unique:!1}),e.createIndex("type","type",{unique:!1})}),dt(ct,function(t){t.createObjectStore(ct,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),dt(lt,function(t){const e="status",n=t.createObjectStore(lt,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(e,e,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class ht{get all(){return ut}}class pt{constructor(t,e=new ht){this.db=t,this.migrationsBuilder=e}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(t){t.forEach(t=>{t(this.db)})}}function ft(t,e){console.info("onversionchange",e),t.close()}let bt;function mt(t){return(bt||(bt=new Promise((t,e)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=ft.bind(null,o,e),t(o)},n.onerror=()=>e(n.error),n.onupgradeneeded=t=>{const n=t.target.result;n.onversionchange=ft.bind(null,n,e),new pt(n).applyMigrations()}})),bt).then(e=>new Promise((n,o)=>t(e,n,o)))}class gt{_add(t){return mt((e,n,o)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).add(t);i.onsuccess=()=>{n(t)},i.onerror=()=>{o(i.error)}}).then(t=>this.getAll().then(e=>{if(Array.isArray(e)){const n=e.map(t=>t.id).sort((t,e)=>t==e?0:t<e?1:-1);if(n.length>this.maxItems)return Promise.all(n.slice(this.maxItems).map(t=>this.delete(t))).then(()=>t)}return t}))}delete(t){return mt((e,n,o)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).delete(t);i.onsuccess=()=>{n(i.result)},i.onerror=()=>{o(i.error)}})}getAll(){return mt((t,e,n)=>{const o=[],i=t.transaction(this.name).objectStore(this.name).openCursor();i.onsuccess=t=>{const n=t.target.result;n?(n.value&&o.push(n.value),n.continue()):e(o)},i.onerror=()=>{n(i.error)}})}}yt=at;var yt;const xt=new class extends gt{constructor(){super(...arguments),this.name="log",this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(t,e,n){const o={type:t,environment:this.environment,message:`${e}`,date:new Date};return e instanceof Error&&(o.stack=e.stack),n&&(o.additional=n),this._add(o)}},wt=(new class extends gt{constructor(){super(...arguments),this.name=ct,this.maxItems=25}add(t){return this._add({...t,date:new Date})}},{error:1,info:2,debug:3});let vt=3;const kt={setLevel(t){wt[t]||(t="error"),vt=wt[t]},write(t,e,n){return"error"===t?this.error(e):this.info(e),xt.add(t,e,n)}};Object.keys(wt).forEach(t=>{const e=wt[t];kt[t]=(...n)=>{e<=vt&&(console.groupCollapsed(t),console.info("",...n),console.trace("trace"),console.groupEnd())}});const Mt="Pushwoosh subscription widget:";class St{constructor(t){this.permission="unsupported",this.open=!1,this.busy=!1,this.container=null,this.autoShowTimer=null,this.pw=t,this.config=function(t){const e=y,n=O(t),o=O(n.prompt),i=O(n.launcher),r=O(n.display),s=g,a=R(o.layout,f,e.prompt.layout),c=p[a],l=R(r.trigger,m,e.display.trigger),d=B(o.iconUrl),u=B(i.imageUrl),h=H({colors:n.colors}),x=L({dark:n.dark},h),w=!0===o.enabled,v=!0===i.enabled;return{enable:w||v,prompt:{enabled:w,layout:a,position:R(o.position,c,c[0]),...d?{iconUrl:d}:{},borderRadius:W(o.borderRadius,s.borderRadius,e.prompt.borderRadius),overlay:"modal"===a||!0===o.overlay},launcher:{enabled:v,position:R(i.position,b,e.launcher.position),offset:W(i.offset,s.offset,e.launcher.offset),width:W(i.width,s.launcherSize,e.launcher.width),height:W(i.height,s.launcherSize,e.launcher.height),...u?{imageUrl:u}:{},...U("background",i.background),...U("iconColor",i.iconColor)},display:{trigger:l,delay:W(r.delay,s.delay,e.display.delay),cappingCount:W(r.cappingCount,s.cappingCount,e.display.cappingCount),cappingInterval:W(r.cappingInterval,s.cappingInterval,e.display.cappingInterval)},texts:V(O(n.texts)),colors:h,...x?{dark:x}:{},fontFamily:q(n.fontFamily,e.fontFamily),zIndex:W(n.zIndex,s.zIndex,e.zIndex)}}(t.initParams.subscriptionWidget),this.accept=this.accept.bind(this),this.decline=this.decline.bind(this),this.toggle=this.toggle.bind(this),this.launcherClick=this.launcherClick.bind(this),t.moduleRegistry.subscriptionWidget=this}async run(){const{pw:t,config:e}=this;e.enable&&t.isPushAvailable()&&(this.permission=await this.readPermission(),this.mount(),this.listenSubscriptionChanges(),await this.scheduleAutoShow())}show(){this.container&&this.config.prompt.enabled&&_(this.permission)&&!this.open&&(this.open=!0,this.render(),this.pw.dispatchEvent("show-subscription-widget",{}))}hide(){this.open&&(this.open=!1,this.busy=!1,this.render(),this.pw.dispatchEvent("hide-subscription-widget",{}))}toggle(t){t??!this.open?this.show():this.hide()}isVisible(){return this.open}async readPermission(){const t=this.pw.driver?.getPermission();return"denied"===t?"denied":await this.pw.isSubscribed()?"granted":"default"}mount(){const t=document.createElement("div");t.id="pushwoosh-subscription-widget",t.style.position="fixed",t.style.inset="0",t.style.zIndex=String(this.config.zIndex),t.style.pointerEvents="none",document.body.appendChild(t),this.container=document.createElement("div"),t.attachShadow({mode:"open"}).appendChild(this.container),this.render()}render(){var t;if(this.container)return this.open||$(this.config,this.permission)?void((t,e)=>{(0,K.render)((0,G.jsx)(st,{...e,mode:"live"}),t)})(this.container,{config:this.config,permission:this.permission,open:this.open,busy:this.busy,onAccept:this.accept,onDecline:this.decline,onLauncherClick:this.launcherClick}):(t=this.container,void(0,K.render)(null,t))}async scheduleAutoShow(){const t=await this.pw.data.getSubscriptionWidgetHistory();(function(t,e,n,o){const{trigger:i,cappingCount:r,cappingInterval:s}=t.display;return!(!t.prompt.enabled||"auto"!==i||"default"!==e||r>0&&n.shownCount>=r||!(null===n.lastShownAt||o-n.lastShownAt>=36e5*s))})(this.config,this.permission,t,Date.now())&&(this.autoShowTimer=setTimeout(async()=>{this.autoShowTimer=null,this.open||"default"!==this.permission||(this.show(),await this.pw.data.setSubscriptionWidgetHistory(function(t,e){return{shownCount:t.shownCount+1,lastShownAt:e}}(t,Date.now())))},1e3*this.config.display.delay))}launcherClick(){const t=(e=this.config,n=this.permission,e.prompt.enabled?"prompt":"default"===n?"subscribe":"none");var e,n;"prompt"===t?this.toggle():"subscribe"===t&&this.subscribeFromLauncher()}async subscribeFromLauncher(){try{await this.pw.subscribe()}catch(t){kt.error(t,`${Mt} failed to subscribe`)}this.permission=await this.readPermission(),this.render()}async accept(){this.busy=!0,this.render();try{await this.pw.subscribe()}catch(t){kt.error(t,`${Mt} failed to subscribe`)}if(this.permission=await this.readPermission(),"denied"===this.permission)return this.busy=!1,void this.render();this.hide()}decline(){this.hide()}listenSubscriptionChanges(){const t=async()=>{this.permission=await this.readPermission(),"granted"===this.permission&&(this.cancelAutoShow(),this.hide()),this.render()};this.pw.addEventHandler("subscribe",t),this.pw.addEventHandler("unsubscribe",t),this.pw.addEventHandler("permission-denied",t)}cancelAutoShow(){null!==this.autoShowTimer&&(clearTimeout(this.autoShowTimer),this.autoShowTimer=null)}}return s})());
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("preact"),require("preact/compat"),require("preact/jsx-runtime"));else if("function"==typeof define&&define.amd)define(["preact","preact/compat","preact/jsx-runtime"],e);else{var n="object"==typeof exports?e(require("preact"),require("preact/compat"),require("preact/jsx-runtime")):e(t.preact,t.preactCompat,t.jsxRuntime);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(t,e,n)=>(()=>{"use strict";var o={524(e){e.exports=t},873(t){t.exports=e},247(t){t.exports=n}};const i={};function r(t){const e=i[t];if(void 0!==e)return e.exports;const n=i[t]={exports:{}};return o[t](n,n.exports,r),n.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};let s={};r.r(s),r.d(s,{PWSubscriptionWidget:()=>St});const a=/^(https?:|mailto:|tel:)/i,c="#101828",l="#667085",d="#FFFFFF",u={background:"#FFFFFF",accent:"#2970FF",text:c,textSecondary:l,textInverse:"#FFFFFF"};function h(t,e){return{display:"block",boxSizing:"border-box",width:"100%",padding:"10px 25px",borderRadius:6,fontSize:14,fontWeight:600,fontFamily:"inherit",lineHeight:1.5,textAlign:"center",textDecoration:"none",cursor:"pointer",..."secondary"===t?{backgroundColor:e.surface,color:e.accent,border:`1px solid ${e.accent}`}:{backgroundColor:e.accent,color:e.onAccent,border:"none"}}}const p={card:["top","bottom","top-left","top-right","bottom-left","bottom-right"],bar:["top","bottom"],modal:["center"]},f=Object.keys(p),b=["bottom-right","bottom-left","top-right","top-left"],m=["auto","launcher","manual"],g={delay:[0,3600],cappingCount:[0,100],cappingInterval:[0,8760],borderRadius:[0,32],offset:[0,100],launcherSize:[16,200],zIndex:[0,2147483647]},y={enable:!1,prompt:{enabled:!1,layout:"card",position:"top",borderRadius:12,overlay:!1},launcher:{enabled:!1,position:"bottom-right",offset:20,width:48,height:48},display:{trigger:"auto",delay:5,cappingCount:3,cappingInterval:4},texts:{title:"Stay in the loop",message:"Allow notifications to get our news and special offers first.",acceptText:"Allow",declineText:"Not now",closeText:"Got it",blockedTitle:"Notifications are blocked",blockedMessage:"To get our notifications, allow them for this site in your browser settings.",launcherLabel:"Subscribe to notifications",launcherBlockedLabel:"Notifications are blocked"},colors:u,fontFamily:'Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',zIndex:2147483e3},x=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function w(t){const e=x.exec(t.trim())?.[1];if(!e)return null;const n=3===e.length?e.split("").map(t=>t+t).join(""):e;return[0,2,4].map(t=>parseInt(n.slice(t,t+2),16))}function v([t,e,n]){return`#${[t,e,n].map(t=>Math.max(0,Math.min(255,Math.round(t))).toString(16).padStart(2,"0")).join("")}`}function k(t,e,n){let o=n;return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+6*(e-t)*o:o<.5?e:o<2/3?t+(e-t)*(2/3-o)*6:t}function M(t){return t>.5?.07+.86*(1-t):t}function S(t){return t<.5?.93-t*((.93-.5)/.5):t}function j(t,e){const n=w(t);if(!n)return t;const[o,i,r]=function([t,e,n]){const[o,i,r]=[t/255,e/255,n/255],s=Math.max(o,i,r),a=Math.min(o,i,r),c=(s+a)/2;if(s===a)return[0,0,c];const l=s-a;let d;return d=s===o?(i-r)/l+(i<r?6:0):s===i?(r-o)/l+2:(o-i)/l+4,[d/6,c>.5?l/(2-s-a):l/(s+a),c]}(n);return v(function([t,e,n]){if(0===e){const t=255*n;return[t,t,t]}const o=n<.5?n*(1+e):n+e-n*e,i=2*n-o;return[255*k(i,o,t+1/3),255*k(i,o,t),255*k(i,o,t-1/3)]}([o,i,"fold"===e?M(r):S(r)]))}function I(t,e,n){const o=w(t),i=w(e);return o&&i?v(o.map((t,e)=>t+(i[e]-t)*n)):t}function C(t){const e=w(t);if(!e)return!1;const[n,o,i]=e;return(.299*n+.587*o+.114*i)/255>.6}function F(t){return{background:j(t.background,"fold"),accent:t.accent,text:j(t.text,"lift"),textSecondary:j(t.textSecondary,"lift"),textInverse:t.textInverse}}function z(t,e){return"light"===e?{surface:u.background,surfaceText:c,border:"#D0D5DD",onAccent:d,error:"#D92D20",chromeIcon:l}:{surface:I(t.background,t.text,.08),surfaceText:t.text,border:I(t.background,t.text,.24),onAccent:C(t.accent)?c:d,error:"#FDA29B",chromeIcon:t.textSecondary}}function A(t){return!0===t.dark?.enabled}function P(t,e="light"){return"dark"===e&&A(t)?"dark":"light"}function E(t,e="light"){const n=P(t,e),o="dark"===n?(i=t.colors,r=t.dark,{...F(i),...r?.colors??{}}):t.colors;var i,r;return{...o,scheme:n,...z(o,n)}}function T(t){const e=(t||"").trim();if(e)return e.startsWith("#")||e.startsWith("/")||e.startsWith("?")||a.test(e)?e:void 0}new Set(["STRONG","B","EM","I","U","BR","A"]);function D(t){return"string"==typeof t&&t?t:void 0}function H(t){const e="object"==typeof t.colors&&null!==t.colors?t.colors:{};return{background:D(e.background)??D(t.background)??u.background,accent:D(e.accent)??D(t.accent)??u.accent,text:D(e.text)??u.text,textSecondary:D(e.textSecondary)??u.textSecondary,textInverse:D(e.textInverse)??u.textInverse}}function L(t,e){const n=t.dark;if("object"!=typeof n||null===n)return;const o=n,i="object"==typeof o.colors&&null!==o.colors?o.colors:{},r=F(e),s=function(t){if("object"!=typeof t||null===t)return;const e=t,n=D(e.color);if(!n)return;return{color:n,opacity:"number"==typeof e.opacity&&Number.isFinite(e.opacity)?Math.max(0,Math.min(1,e.opacity)):1}}(o.overlay);return{enabled:!0===o.enabled,colors:{background:D(i.background)??r.background,accent:D(i.accent)??r.accent,text:D(i.text)??r.text,textSecondary:D(i.textSecondary)??r.textSecondary,textInverse:D(i.textInverse)??r.textInverse},...s?{overlay:s}:{},...D(o.boxShadow)?{boxShadow:o.boxShadow}:{}}}function O(t){return"object"!=typeof t||null===t||Array.isArray(t)?{}:t}function R(t,e,n){return e.includes(t)?t:n}function W(t,[e,n],o){return"number"==typeof t&&Number.isFinite(t)?Math.max(e,Math.min(n,Math.round(t))):o}function q(t,e){if("string"!=typeof t)return e;const n=t.trim();return n?n.slice(0,300):e}function B(t){const e=T("string"==typeof t?t:void 0);return e&&/^(https?:\/\/|\/)/i.test(e)?e:void 0}function U(t,e){const n="string"==typeof e?e.trim().slice(0,64):"";return n?{[t]:n}:{}}function V(t){const e=y.texts,n=Object.keys(e);return Object.fromEntries(n.map(n=>[n,q(t[n],e[n])]))}function _(t){return"default"===t||"denied"===t}function N(t){return"denied"===t?"blocked":"ask"}function $(t,e){return t.launcher.enabled&&_(e)}var G=r(247),K=r(524),X=r(873);const J="(prefers-color-scheme: dark)";function Q(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia(J).matches}const Y={bell:"M6 10a6 6 0 0 1 12 0c0 4 1.5 5.5 2 6H4c.5-.5 2-2 2-6M10 20a2 2 0 0 0 4 0",gift:"M3 11h18v9a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zM2.5 7h19v4h-19zM12 7v14M12 7c-1 0-3-.2-3.5-1a2 2 0 0 1 3.5-1 2 2 0 0 1 3.5 1c-.5.8-2.5 1-3.5 1z",cart:"M2 4h2.2l2.4 11.2A2 2 0 0 0 8.6 17H19M6 7h15l-2.2 7.5H8M10.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M19.5 20a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",chart:"M3 21h18M7 21V11M12 21V6M17 21v-8",lock:"M5 11h14v10H5zM8 11V8a4 4 0 0 1 8 0v3",calendar:"M4 6h16v15H4zM4 10h16M9 3v4M15 3v4",check:"M4 13l5 5L20 6",star:"M12 3l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5-5.8-3.1-5.8 3.1 1.1-6.5L2.6 9.8l6.5-.9z",clock:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0M12 7v5l4 2",tag:"M20.6 13.4l-7.2 7.2a2 2 0 0 1-2.8 0l-7-7A2 2 0 0 1 3 12.2V5a2 2 0 0 1 2-2h7.2a2 2 0 0 1 1.4.6l7 7a2 2 0 0 1 0 2.8zM9 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0",mail:"M3 6h18v12H3zM3 7l9 6 9-6",phone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1M10 19h4",download:"M12 3v12M7 11l5 5 5-5M4 20h16",play:"M8 5l12 7-12 7z",shield:"M12 3l8 3v6c0 5-3.4 8.6-8 10-4.6-1.4-8-5-8-10V6z",sparkle:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM18 15l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1L15 18l2.1-.9z",percent:"M19 5L5 19M8.5 8.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0M20.5 15.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0",truck:"M2 7h12v10H2zM14 10h4l3 3v4h-7M8.5 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M20 19a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0",ticket:"M4 7h16v4a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4zM14 7v12",user:"M20 21a8 8 0 0 0-16 0M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0"},Z=(Object.keys(Y),"0 12px 32px rgba(16, 24, 40, 0.18)");function tt(t,e){const[n,o]=t.split("-");return{[n]:e,[o]:e}}function et(t,e){return e?(t?"pw-subw-drop":"pw-subw-rise")+" 0.3s ease-out backwards":void 0}function nt(t,e,n){const{layout:o,position:i}=t.prompt,r={position:e,zIndex:t.zIndex,boxSizing:"border-box",pointerEvents:"auto"};if("bar"===o)return{...r,left:0,right:0,[i]:0,animation:et("top"===i,n)};if("modal"===o)return{...r,top:"50%",left:"50%",width:"min(420px, calc(100% - 32px))",transform:"translate(-50%, -50%)",animation:n?"pw-subw-fade 0.25s ease-out backwards":void 0};const s="min(360px, calc(100% - 32px))",a=et(i.startsWith("top"),n);return"top"===i||"bottom"===i?{...r,[i]:16,left:"50%",width:s,transform:"translateX(-50%)",animation:a}:{...r,...tt(i,16),width:s,animation:a}}function ot({label:t,primary:e,colors:n,disabled:o,onClick:i}){return(0,G.jsx)("button",{type:"button",disabled:o,onClick:i,style:{...h(e?"primary":"secondary",n),display:"inline-block",width:"auto",padding:"8px 18px",whiteSpace:"nowrap",opacity:o?.6:1,cursor:o?"default":"pointer"},children:t})}function it({config:t,variant:e,colors:n,busy:o,onAccept:i,onDecline:r}){const{prompt:s,texts:a}=t,c="bar"===s.layout,l="blocked"===e;return(0,G.jsxs)("div",{role:"dialog","aria-label":l?a.blockedTitle:a.title,style:{display:"flex",flexDirection:c?"row":"column",alignItems:c?"center":"stretch",flexWrap:c?"wrap":"nowrap",gap:16,padding:c?"12px 20px":20,boxSizing:"border-box",width:"100%",borderRadius:c?0:s.borderRadius,boxShadow:Z,backgroundColor:n.background,color:n.text,fontFamily:t.fontFamily,colorScheme:n.scheme},children:[(0,G.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:12,flex:c?"1 1 240px":void 0},children:[s.iconUrl&&(0,G.jsx)("img",{src:s.iconUrl,alt:"",width:48,height:48,style:{flex:"none",borderRadius:8,objectFit:"cover"}}),(0,G.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:0},children:[(0,G.jsx)("div",{style:{fontSize:16,fontWeight:600,lineHeight:1.4},children:l?a.blockedTitle:a.title}),(0,G.jsx)("div",{style:{fontSize:14,lineHeight:1.5,color:n.textSecondary},children:l?a.blockedMessage:a.message})]})]}),(0,G.jsx)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,flex:"none"},children:l?(0,G.jsx)(ot,{label:a.closeText,primary:!0,colors:n,onClick:r}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ot,{label:a.declineText,primary:!1,colors:n,onClick:r}),(0,G.jsx)(ot,{label:a.acceptText,primary:!0,colors:n,disabled:o,onClick:i})]})})]})}function rt({config:t,blocked:e,colors:n,onClick:o}){const{width:i,height:r,imageUrl:s}=t.launcher,a=e?t.texts.launcherBlockedLabel:t.texts.launcherLabel,c=Math.round(Math.min(i,r)/2),l={display:"flex",alignItems:"center",justifyContent:"center",width:i,height:r,padding:0,border:"none",cursor:"pointer",opacity:e?.7:1};return s?(0,G.jsx)("button",{type:"button","aria-label":a,title:a,onClick:o,style:{...l,background:"none"},children:(0,G.jsx)("img",{src:s,alt:"",width:i,height:r,style:{display:"block",objectFit:"contain"}})}):(0,G.jsx)("button",{type:"button","aria-label":a,title:a,onClick:o,style:{...l,borderRadius:"50%",backgroundColor:t.launcher.background??n.accent,color:t.launcher.iconColor??n.onAccent,boxShadow:Z},children:(0,G.jsxs)("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,G.jsx)("path",{d:Y.bell}),e&&(0,G.jsx)("path",{d:"M4 4l16 16"})]})})}function st({config:t,permission:e,open:n,mode:o="live",colorScheme:i="auto",busy:r,onAccept:s,onDecline:a,onLauncherClick:c}){const l=E(t,function(t,e){const[n,o]=(0,X.useState)(()=>"auto"===t&&e&&Q()),i=[t,e],[r,s]=(0,X.useState)(null);return(null===r||i.some((t,e)=>t!==r[e]))&&(s(i),"auto"===t&&e&&o(Q())),(0,X.useEffect)(()=>{if("auto"!==t||!e||"undefined"==typeof window||"function"!=typeof window.matchMedia)return;const n=window.matchMedia(J),i=t=>o(t.matches);return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[t,e]),"auto"!==t?t:n?"dark":"light"}(i,A(t))),d="live"===o,u=d?"fixed":"absolute",h=n&&t.prompt.enabled,p=$(t,e);return h||p?(0,G.jsxs)(G.Fragment,{children:[d&&(0,G.jsx)("style",{children:"\n@keyframes pw-subw-fade { from { opacity: 0; } }\n@keyframes pw-subw-drop { from { opacity: 0; translate: 0 -16px; } }\n@keyframes pw-subw-rise { from { opacity: 0; translate: 0 16px; } }\n"}),h&&t.prompt.overlay&&(0,G.jsx)("div",{style:{position:u,inset:0,zIndex:t.zIndex,backgroundColor:"rgba(16, 24, 40, 0.5)",animation:d?"pw-subw-fade 0.2s ease-out backwards":void 0,pointerEvents:"auto"},onClick:a}),h&&(0,G.jsx)("div",{style:nt(t,u,d),children:(0,G.jsx)(it,{config:t,variant:N(e),colors:l,busy:r,onAccept:s,onDecline:a})}),p&&(0,G.jsx)("div",{style:{position:u,zIndex:t.zIndex,pointerEvents:"auto",...tt(t.launcher.position,t.launcher.offset)},children:(0,G.jsx)(rt,{config:t,blocked:"denied"===e,colors:l,onClick:c})})]}):null}const at="keyValue",ct="messages",lt="inboxMessages";function dt(t,e){return function(n){n.objectStoreNames.contains(t)||e(n)}}const ut=[dt(at,function(t){t.createObjectStore(at,{keyPath:"key"})}),dt("log",function(t){const e=t.createObjectStore("log",{keyPath:"id",autoIncrement:!0});e.createIndex("environment","environment",{unique:!1}),e.createIndex("date","date",{unique:!1}),e.createIndex("type","type",{unique:!1})}),dt(ct,function(t){t.createObjectStore(ct,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),dt(lt,function(t){const e="status",n=t.createObjectStore(lt,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(e,e,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class ht{get all(){return ut}}class pt{constructor(t,e=new ht){this.db=t,this.migrationsBuilder=e}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(t){t.forEach(t=>{t(this.db)})}}function ft(t,e){console.info("onversionchange",e),t.close()}let bt;function mt(t){return(bt||(bt=new Promise((t,e)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=ft.bind(null,o,e),t(o)},n.onerror=()=>e(n.error),n.onupgradeneeded=t=>{const n=t.target.result;n.onversionchange=ft.bind(null,n,e),new pt(n).applyMigrations()}})),bt).then(e=>new Promise((n,o)=>t(e,n,o)))}class gt{_add(t){return mt((e,n,o)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).add(t);i.onsuccess=()=>{n(t)},i.onerror=()=>{o(i.error)}}).then(t=>this.getAll().then(e=>{if(Array.isArray(e)){const n=e.map(t=>t.id).sort((t,e)=>t==e?0:t<e?1:-1);if(n.length>this.maxItems)return Promise.all(n.slice(this.maxItems).map(t=>this.delete(t))).then(()=>t)}return t}))}delete(t){return mt((e,n,o)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).delete(t);i.onsuccess=()=>{n(i.result)},i.onerror=()=>{o(i.error)}})}getAll(){return mt((t,e,n)=>{const o=[],i=t.transaction(this.name).objectStore(this.name).openCursor();i.onsuccess=t=>{const n=t.target.result;n?(n.value&&o.push(n.value),n.continue()):e(o)},i.onerror=()=>{n(i.error)}})}}yt=at;var yt;const xt=new class extends gt{constructor(){super(...arguments),this.name="log",this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(t,e,n){const o={type:t,environment:this.environment,message:`${e}`,date:new Date};return e instanceof Error&&(o.stack=e.stack),n&&(o.additional=n),this._add(o)}},wt=(new class extends gt{constructor(){super(...arguments),this.name=ct,this.maxItems=25}add(t){return this._add({...t,date:new Date})}},{error:1,info:2,debug:3});let vt=3;const kt={setLevel(t){wt[t]||(t="error"),vt=wt[t]},write(t,e,n){return"error"===t?this.error(e):this.info(e),xt.add(t,e,n)}};Object.keys(wt).forEach(t=>{const e=wt[t];kt[t]=(...n)=>{e<=vt&&(console.groupCollapsed(t),console.info("",...n),console.trace("trace"),console.groupEnd())}});const Mt="Pushwoosh subscription widget:";class St{constructor(t){this.permission="unsupported",this.open=!1,this.busy=!1,this.container=null,this.autoShowTimer=null,this.pw=t,this.config=function(t){const e=y,n=O(t),o=O(n.prompt),i=O(n.launcher),r=O(n.display),s=g,a=R(o.layout,f,e.prompt.layout),c=p[a],l=R(r.trigger,m,e.display.trigger),d=B(o.iconUrl),u=B(i.imageUrl),h=H({colors:n.colors}),x=L({dark:n.dark},h),w=!0===o.enabled,v=!0===i.enabled;return{enable:w||v,prompt:{enabled:w,layout:a,position:R(o.position,c,c[0]),...d?{iconUrl:d}:{},borderRadius:W(o.borderRadius,s.borderRadius,e.prompt.borderRadius),overlay:"modal"===a||!0===o.overlay},launcher:{enabled:v,position:R(i.position,b,e.launcher.position),offset:W(i.offset,s.offset,e.launcher.offset),width:W(i.width,s.launcherSize,e.launcher.width),height:W(i.height,s.launcherSize,e.launcher.height),...u?{imageUrl:u}:{},...U("background",i.background),...U("iconColor",i.iconColor)},display:{trigger:l,delay:W(r.delay,s.delay,e.display.delay),cappingCount:W(r.cappingCount,s.cappingCount,e.display.cappingCount),cappingInterval:W(r.cappingInterval,s.cappingInterval,e.display.cappingInterval)},texts:V(O(n.texts)),colors:h,...x?{dark:x}:{},fontFamily:q(n.fontFamily,e.fontFamily),zIndex:W(n.zIndex,s.zIndex,e.zIndex)}}(t.initParams.subscriptionWidget),this.accept=this.accept.bind(this),this.decline=this.decline.bind(this),this.toggle=this.toggle.bind(this),this.launcherClick=this.launcherClick.bind(this),t.moduleRegistry.subscriptionWidget=this}async run(){const{pw:t,config:e}=this;e.enable&&t.isPushAvailable()&&(this.permission=await this.readPermission(),this.mount(),this.listenSubscriptionChanges(),await this.scheduleAutoShow())}show(){this.container&&this.config.prompt.enabled&&_(this.permission)&&!this.open&&(this.open=!0,this.render(),this.pw.dispatchEvent("show-subscription-widget",{}))}hide(){this.open&&(this.open=!1,this.busy=!1,this.render(),this.pw.dispatchEvent("hide-subscription-widget",{}))}toggle(t){t??!this.open?this.show():this.hide()}isVisible(){return this.open}async readPermission(){const t=this.pw.driver?.getPermission();return"denied"===t?"denied":await this.pw.isSubscribed()?"granted":"default"}mount(){const t=document.createElement("div");t.id="pushwoosh-subscription-widget",t.style.position="fixed",t.style.inset="0",t.style.zIndex=String(this.config.zIndex),t.style.pointerEvents="none",document.body.appendChild(t),this.container=document.createElement("div"),t.attachShadow({mode:"open"}).appendChild(this.container),this.render()}render(){var t;if(this.container)return this.open||$(this.config,this.permission)?void((t,e)=>{(0,K.render)((0,G.jsx)(st,{...e,mode:"live"}),t)})(this.container,{config:this.config,permission:this.permission,open:this.open,busy:this.busy,onAccept:this.accept,onDecline:this.decline,onLauncherClick:this.launcherClick}):(t=this.container,void(0,K.render)(null,t))}async scheduleAutoShow(){const t=await this.pw.data.getSubscriptionWidgetHistory();(function(t,e,n,o){const{trigger:i,cappingCount:r,cappingInterval:s}=t.display;return!(!t.prompt.enabled||"auto"!==i||"default"!==e||r>0&&n.shownCount>=r||!(null===n.lastShownAt||o-n.lastShownAt>=36e5*s))})(this.config,this.permission,t,Date.now())&&(this.autoShowTimer=setTimeout(async()=>{this.autoShowTimer=null,this.open||"default"!==this.permission||(this.show(),await this.pw.data.setSubscriptionWidgetHistory(function(t,e){return{shownCount:t.shownCount+1,lastShownAt:e}}(t,Date.now())))},1e3*this.config.display.delay))}launcherClick(){const t=(e=this.config,n=this.permission,e.prompt.enabled?"prompt":"default"===n?"subscribe":"none");var e,n;"prompt"===t?this.toggle():"subscribe"===t&&this.subscribeFromLauncher()}async subscribeFromLauncher(){try{await this.pw.subscribe()}catch(t){kt.error(t,`${Mt} failed to subscribe`)}this.permission=await this.readPermission(),this.render()}async accept(){this.busy=!0,this.render();try{await this.pw.subscribe()}catch(t){kt.error(t,`${Mt} failed to subscribe`)}if(this.permission=await this.readPermission(),"denied"===this.permission)return this.busy=!1,void this.render();this.hide()}decline(){this.hide()}listenSubscriptionChanges(){const t=async()=>{this.permission=await this.readPermission(),"granted"===this.permission&&(this.cancelAutoShow(),this.hide()),this.render()};this.pw.addSdkEventHandler("subscribe",t),this.pw.addSdkEventHandler("unsubscribe",t),this.pw.addSdkEventHandler("permission-denied",t)}cancelAutoShow(){null!==this.autoShowTimer&&(clearTimeout(this.autoShowTimer),this.autoShowTimer=null)}}return s})());
2
2
  //# sourceMappingURL=widget-subscription.js.map