@krak-stack/registry 0.10.20 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -3
- package/README.md +11 -8
- package/dist/components/agent/index.d.ts +454 -0
- package/dist/components/agent/react.d.ts +55 -0
- package/dist/components/agent/react.js +2594 -0
- package/dist/components/agent/schema.d.ts +55 -0
- package/dist/components/animated-list/classes.d.ts +9 -0
- package/dist/components/animated-list/html.d.ts +11 -0
- package/dist/components/animated-list/html.js +533 -0
- package/dist/components/animated-list/index.d.ts +205 -0
- package/dist/components/animated-list/react.d.ts +11 -0
- package/dist/components/animated-list/react.js +711 -0
- package/dist/components/animated-list/schema.d.ts +44 -0
- package/dist/components/animated-number/html.d.ts +19 -0
- package/dist/components/animated-number/html.js +101 -0
- package/dist/components/animated-number/index.d.ts +80 -0
- package/dist/components/{ui/animated-number.d.ts → animated-number/react.d.ts} +2 -7
- package/dist/components/animated-number/react.js +278 -0
- package/dist/components/animated-number/schema.d.ts +9 -0
- package/dist/components/app-brand/classes.d.ts +11 -0
- package/dist/components/app-brand/html.d.ts +26 -0
- package/dist/components/app-brand/html.js +78 -0
- package/dist/components/app-brand/react.d.ts +12 -0
- package/dist/components/app-brand/react.js +86 -0
- package/dist/components/app-brand/schema.d.ts +36 -0
- package/dist/components/app-switcher/classes.d.ts +15 -0
- package/dist/components/app-switcher/html.d.ts +72 -0
- package/dist/components/app-switcher/html.js +327 -0
- package/dist/components/app-switcher/index.d.ts +47 -0
- package/dist/components/app-switcher/react.d.ts +12 -0
- package/dist/components/{ui/app-switcher.js → app-switcher/react.js} +84 -15
- package/dist/components/app-switcher/schema.d.ts +39 -0
- package/dist/components/async-action-button/classes.d.ts +11 -0
- package/dist/components/async-action-button/html.d.ts +46 -0
- package/dist/components/async-action-button/html.js +266 -0
- package/dist/components/async-action-button/index.d.ts +73 -0
- package/dist/components/async-action-button/react.d.ts +10 -0
- package/dist/components/async-action-button/react.js +378 -0
- package/dist/components/async-action-button/schema.d.ts +28 -0
- package/dist/{services/events/client/audit-log-table.d.ts → components/audit-log-table/react.d.ts} +2 -2
- package/dist/{services/events/client/audit-log-table.js → components/audit-log-table/react.js} +2180 -909
- package/dist/components/auto-height/html.d.ts +8 -0
- package/dist/components/auto-height/html.js +81 -0
- package/dist/components/auto-height/index.d.ts +2 -0
- package/dist/components/{ui/auto-height.d.ts → auto-height/react.d.ts} +2 -4
- package/dist/components/auto-height/react.js +75 -0
- package/dist/components/auto-height/schema.d.ts +7 -0
- package/dist/components/bulk-list-input/classes.d.ts +7 -0
- package/dist/components/bulk-list-input/html.d.ts +41 -0
- package/dist/components/bulk-list-input/html.js +265 -0
- package/dist/components/bulk-list-input/index.d.ts +76 -0
- package/dist/components/bulk-list-input/react.d.ts +12 -0
- package/dist/components/{ui/bulk-list-input.js → bulk-list-input/react.js} +71 -4
- package/dist/components/bulk-list-input/schema.d.ts +33 -0
- package/dist/components/choice-cards/classes.d.ts +19 -0
- package/dist/components/choice-cards/html.d.ts +76 -0
- package/dist/components/choice-cards/html.js +237 -0
- package/dist/components/choice-cards/index.d.ts +1 -0
- package/dist/components/choice-cards/react.d.ts +21 -0
- package/dist/components/{ui/choice-cards.js → choice-cards/react.js} +29 -10
- package/dist/components/choice-cards/schema.d.ts +100 -0
- package/dist/components/code-block/classes.d.ts +13 -0
- package/dist/components/code-block/html.d.ts +21 -0
- package/dist/components/code-block/html.js +381 -0
- package/dist/components/code-block/index.d.ts +4 -0
- package/dist/components/code-block/react.d.ts +4 -0
- package/dist/components/code-block/react.js +493 -0
- package/dist/components/code-block/schema.d.ts +29 -0
- package/dist/components/color-input/classes.d.ts +9 -0
- package/dist/components/color-input/html.d.ts +48 -0
- package/dist/components/color-input/html.js +187 -0
- package/dist/components/color-input/index.d.ts +88 -0
- package/dist/components/color-input/react.d.ts +7 -0
- package/dist/components/{ui/color-picker.js → color-input/react.js} +165 -233
- package/dist/components/color-input/schema.d.ts +40 -0
- package/dist/components/copy-button/html.d.ts +48 -0
- package/dist/components/copy-button/html.js +266 -0
- package/dist/components/copy-button/index.d.ts +73 -0
- package/dist/components/copy-button/react.d.ts +12 -0
- package/dist/components/copy-button/react.js +388 -0
- package/dist/components/copy-button/schema.d.ts +37 -0
- package/dist/components/copy-value/html.d.ts +37 -0
- package/dist/components/copy-value/html.js +426 -0
- package/dist/components/copy-value/index.d.ts +57 -0
- package/dist/components/copy-value/react.d.ts +9 -0
- package/dist/components/copy-value/react.js +682 -0
- package/dist/components/copy-value/schema.d.ts +45 -0
- package/dist/components/cron-input/classes.d.ts +25 -0
- package/dist/components/cron-input/html.d.ts +36 -0
- package/dist/components/cron-input/html.js +204 -0
- package/dist/components/cron-input/index.d.ts +59 -0
- package/dist/components/cron-input/react.d.ts +7 -0
- package/dist/components/{ui/cron-expression-editor.js → cron-input/react.js} +126 -54
- package/dist/components/cron-input/schema.d.ts +24 -0
- package/dist/components/danger-confirmation/classes.d.ts +7 -0
- package/dist/components/danger-confirmation/html.d.ts +39 -0
- package/dist/components/danger-confirmation/html.js +227 -0
- package/dist/components/danger-confirmation/index.d.ts +113 -0
- package/dist/components/{ui/danger-confirmation.d.ts → danger-confirmation/react.d.ts} +3 -12
- package/dist/components/danger-confirmation/react.js +550 -0
- package/dist/components/danger-confirmation/schema.d.ts +34 -0
- package/dist/components/data-table/classes.d.ts +63 -0
- package/dist/components/data-table/html.d.ts +1938 -0
- package/dist/components/data-table/html.js +2682 -0
- package/dist/components/data-table/index.d.ts +2686 -0
- package/dist/components/data-table/react.d.ts +578 -0
- package/dist/components/{ui/data-table.js → data-table/react.js} +2174 -897
- package/dist/components/data-table/schema.d.ts +3012 -0
- package/dist/components/date-input/classes.d.ts +17 -0
- package/dist/components/date-input/html.d.ts +60 -0
- package/dist/components/date-input/html.js +418 -0
- package/dist/components/date-input/index.d.ts +91 -0
- package/dist/components/date-input/react.d.ts +10 -0
- package/dist/components/{ui/date-picker.js → date-input/react.js} +233 -79
- package/dist/components/date-input/schema.d.ts +41 -0
- package/dist/components/editable-text/classes.d.ts +17 -0
- package/dist/components/editable-text/html.d.ts +51 -0
- package/dist/components/editable-text/html.js +370 -0
- package/dist/components/editable-text/index.d.ts +143 -0
- package/dist/components/editable-text/react.d.ts +6 -0
- package/dist/components/editable-text/react.js +499 -0
- package/dist/components/editable-text/schema.d.ts +31 -0
- package/dist/components/editing-locale-switcher/classes.d.ts +7 -0
- package/dist/components/editing-locale-switcher/html.d.ts +27 -0
- package/dist/components/editing-locale-switcher/html.js +250 -0
- package/dist/components/editing-locale-switcher/index.d.ts +52 -0
- package/dist/components/editing-locale-switcher/react.d.ts +7 -0
- package/dist/components/{ui/editing-locale-switcher.js → editing-locale-switcher/react.js} +63 -10
- package/dist/components/editing-locale-switcher/schema.d.ts +16 -0
- package/dist/components/{ui/effect-form.d.ts → effect-form/react.d.ts} +2 -2
- package/dist/components/{ui/effect-form.js → effect-form/react.js} +302 -76
- package/dist/components/effectcn/alert-dialog.d.ts +13 -0
- package/dist/components/effectcn/button.d.ts +31 -0
- package/dist/components/effectcn/calendar.d.ts +12 -0
- package/dist/components/effectcn/checkbox.d.ts +10 -0
- package/dist/components/effectcn/combobox.d.ts +25 -0
- package/dist/components/effectcn/dialog.d.ts +19 -0
- package/dist/components/effectcn/field.d.ts +11 -0
- package/dist/components/effectcn/file-drop.d.ts +8 -0
- package/dist/components/effectcn/input.d.ts +26 -0
- package/dist/components/effectcn/menu.d.ts +85 -0
- package/dist/components/effectcn/menubar.d.ts +8 -0
- package/dist/components/effectcn/popover.d.ts +18 -0
- package/dist/components/effectcn/scroll-area.d.ts +12 -0
- package/dist/components/effectcn/select.d.ts +68 -0
- package/dist/components/effectcn/toast.d.ts +29 -0
- package/dist/components/email-composer/index.d.ts +229 -0
- package/dist/components/email-composer/labels.d.ts +12 -0
- package/dist/components/email-composer/react.d.ts +5 -0
- package/dist/components/{ui/email-composer.js → email-composer/react.js} +618 -135
- package/dist/components/email-composer/schema.d.ts +42 -0
- package/dist/components/email-editor/classes.d.ts +21 -0
- package/dist/components/email-editor/html.d.ts +360 -0
- package/dist/components/email-editor/html.js +1706 -0
- package/dist/components/email-editor/index.d.ts +693 -0
- package/dist/components/{ui/email-editor.d.ts → email-editor/labels.d.ts} +1 -21
- package/dist/components/email-editor/legacy-editor.html.d.ts +160 -0
- package/dist/components/email-editor/react.d.ts +11 -0
- package/dist/components/{ui/email-editor.js → email-editor/react.js} +778 -256
- package/dist/components/email-editor/schema.d.ts +162 -0
- package/dist/components/error-component/classes.d.ts +7 -0
- package/dist/components/error-component/html.d.ts +120 -0
- package/dist/components/error-component/html.js +346 -0
- package/dist/components/error-component/index.d.ts +69 -0
- package/dist/components/error-component/react.d.ts +8 -0
- package/dist/components/error-component/react.js +744 -0
- package/dist/components/error-component/schema.d.ts +56 -0
- package/dist/components/file-input/classes.d.ts +7 -0
- package/dist/components/file-input/html.d.ts +95 -0
- package/dist/components/file-input/html.js +368 -0
- package/dist/components/file-input/index.d.ts +99 -0
- package/dist/components/file-input/react.d.ts +11 -0
- package/dist/components/{ui/file-picker.js → file-input/react.js} +122 -19
- package/dist/components/file-input/schema.d.ts +37 -0
- package/dist/components/{ui/form.d.ts → form/react.d.ts} +7 -7
- package/dist/components/{ui/form.js → form/react.js} +300 -74
- package/dist/components/icon-input/html.d.ts +55 -0
- package/dist/components/icon-input/html.js +538 -0
- package/dist/components/icon-input/index.d.ts +143 -0
- package/dist/components/icon-input/react.d.ts +6 -0
- package/dist/components/{ui/icon-input.js → icon-input/react.js} +459 -89
- package/dist/components/icon-input/schema.d.ts +23 -0
- package/dist/components/image-crop-editor/classes.d.ts +19 -0
- package/dist/components/image-crop-editor/html.d.ts +66 -0
- package/dist/components/image-crop-editor/html.js +561 -0
- package/dist/components/image-crop-editor/index.d.ts +183 -0
- package/dist/components/image-crop-editor/react.d.ts +8 -0
- package/dist/components/image-crop-editor/react.js +802 -0
- package/dist/components/image-crop-editor/schema.d.ts +54 -0
- package/dist/components/krakstack-provider/html.d.ts +17 -0
- package/dist/components/krakstack-provider/html.js +37 -0
- package/dist/components/krakstack-provider/index.d.ts +7 -0
- package/dist/components/krakstack-provider/react.d.ts +8 -0
- package/dist/components/{ui/krakstack-provider.js → krakstack-provider/react.js} +14 -5
- package/dist/components/krakstack-provider/schema.d.ts +6 -0
- package/dist/components/loading/classes.d.ts +5 -0
- package/dist/components/loading/html.d.ts +18 -0
- package/dist/components/loading/html.js +166 -0
- package/dist/components/loading/index.d.ts +6 -0
- package/dist/components/loading/react.d.ts +4 -0
- package/dist/components/loading/react.js +51 -0
- package/dist/components/loading/schema.d.ts +23 -0
- package/dist/components/locale-switcher/html.d.ts +22 -0
- package/dist/components/locale-switcher/html.js +264 -0
- package/dist/components/locale-switcher/index.d.ts +50 -0
- package/dist/components/locale-switcher/react.d.ts +7 -0
- package/dist/components/{ui/locale-switcher.js → locale-switcher/react.js} +55 -22
- package/dist/components/locale-switcher/schema.d.ts +12 -0
- package/dist/components/map-menu/classes.d.ts +13 -0
- package/dist/components/map-menu/google-maps.d.ts +80 -0
- package/dist/components/map-menu/google-viewport.d.ts +7 -0
- package/dist/components/map-menu/html.d.ts +274 -0
- package/dist/components/map-menu/html.js +934 -0
- package/dist/components/map-menu/index.d.ts +246 -0
- package/dist/components/map-menu/map.d.ts +47 -0
- package/dist/components/map-menu/react.d.ts +40 -0
- package/dist/components/{ui/map-menu.js → map-menu/react.js} +321 -83
- package/dist/components/map-menu/schema.d.ts +132 -0
- package/dist/components/markdown/classes.d.ts +1 -0
- package/dist/components/markdown/html.d.ts +23 -0
- package/dist/components/markdown/html.js +510 -0
- package/dist/components/markdown/index.d.ts +6 -0
- package/dist/components/markdown/react.d.ts +3 -0
- package/dist/components/markdown/react.js +546 -0
- package/dist/components/markdown/schema.d.ts +20 -0
- package/dist/components/notification-menu/classes.d.ts +11 -0
- package/dist/components/notification-menu/html.d.ts +67 -0
- package/dist/components/notification-menu/html.js +425 -0
- package/dist/components/notification-menu/index.d.ts +132 -0
- package/dist/components/notification-menu/react.d.ts +57 -0
- package/dist/components/notification-menu/react.js +829 -0
- package/dist/components/notification-menu/schema.d.ts +59 -0
- package/dist/components/pagination/classes.d.ts +19 -0
- package/dist/components/pagination/html.d.ts +49 -0
- package/dist/components/pagination/html.js +387 -0
- package/dist/components/pagination/index.d.ts +109 -0
- package/dist/components/pagination/react.d.ts +9 -0
- package/dist/components/{ui/pagination.js → pagination/react.js} +123 -23
- package/dist/components/pagination/schema.d.ts +36 -0
- package/dist/components/phone-number-input/classes.d.ts +17 -0
- package/dist/components/phone-number-input/html.d.ts +52 -0
- package/dist/components/phone-number-input/html.js +655 -0
- package/dist/components/phone-number-input/index.d.ts +59 -0
- package/dist/components/phone-number-input/react.d.ts +11 -0
- package/dist/components/{ui/phone-number-input.js → phone-number-input/react.js} +368 -138
- package/dist/components/phone-number-input/schema.d.ts +31 -0
- package/dist/components/presence-transition/html.d.ts +13 -0
- package/dist/components/presence-transition/html.js +128 -0
- package/dist/components/presence-transition/index.d.ts +57 -0
- package/dist/components/{ui/presence-transition.d.ts → presence-transition/react.d.ts} +3 -5
- package/dist/components/presence-transition/react.js +293 -0
- package/dist/components/presence-transition/schema.d.ts +7 -0
- package/dist/components/registry-previews/component-example.d.ts +31 -0
- package/dist/components/registry-previews/component-example.js +679 -0
- package/dist/components/registry-previews/html-preview.d.ts +17 -0
- package/dist/components/registry-previews/html-preview.js +83 -0
- package/dist/components/rich-text-editor/classes.d.ts +15 -0
- package/dist/components/rich-text-editor/engine.d.ts +9 -0
- package/dist/components/rich-text-editor/html.d.ts +246 -0
- package/dist/components/rich-text-editor/html.js +830 -0
- package/dist/components/rich-text-editor/index.d.ts +453 -0
- package/dist/components/rich-text-editor/labels.d.ts +42 -0
- package/dist/components/rich-text-editor/react.d.ts +19 -0
- package/dist/components/{ui/rich-text-editor.js → rich-text-editor/react.js} +521 -100
- package/dist/components/rich-text-editor/schema.d.ts +116 -0
- package/dist/components/search-menu/classes.d.ts +9 -0
- package/dist/components/search-menu/html.d.ts +127 -0
- package/dist/components/search-menu/html.js +432 -0
- package/dist/components/search-menu/index.d.ts +85 -0
- package/dist/components/search-menu/react.d.ts +18 -0
- package/dist/components/{ui/search-menu.js → search-menu/react.js} +290 -31
- package/dist/components/search-menu/schema.d.ts +78 -0
- package/dist/components/select-with-custom-input/classes.d.ts +17 -0
- package/dist/components/select-with-custom-input/html.d.ts +60 -0
- package/dist/components/select-with-custom-input/html.js +238 -0
- package/dist/components/select-with-custom-input/index.d.ts +114 -0
- package/dist/components/select-with-custom-input/react.d.ts +7 -0
- package/dist/components/{ui/select-with-custom-input.js → select-with-custom-input/react.js} +127 -22
- package/dist/components/select-with-custom-input/schema.d.ts +54 -0
- package/dist/components/sidebar-layout/classes.d.ts +21 -0
- package/dist/components/sidebar-layout/html.d.ts +97 -0
- package/dist/components/sidebar-layout/html.js +361 -0
- package/dist/components/sidebar-layout/index.d.ts +57 -0
- package/dist/components/sidebar-layout/react.d.ts +30 -0
- package/dist/components/{ui/sidebar-layout.js → sidebar-layout/react.js} +353 -39
- package/dist/components/sidebar-layout/schema.d.ts +54 -0
- package/dist/components/stats-card/classes.d.ts +11 -0
- package/dist/components/stats-card/html.d.ts +15 -0
- package/dist/components/stats-card/html.js +55 -0
- package/dist/components/stats-card/react.d.ts +7 -0
- package/dist/components/{ui/stats-card.js → stats-card/react.js} +19 -15
- package/dist/components/stats-card/schema.d.ts +14 -0
- package/dist/components/stepper/classes.d.ts +39 -0
- package/dist/components/stepper/html.d.ts +107 -0
- package/dist/components/stepper/html.js +397 -0
- package/dist/components/stepper/index.d.ts +83 -0
- package/dist/components/stepper/react.d.ts +17 -0
- package/dist/components/{ui/stepper.js → stepper/react.js} +120 -21
- package/dist/components/stepper/schema.d.ts +52 -0
- package/dist/components/support/classes.d.ts +55 -0
- package/dist/components/support/form.d.ts +19 -0
- package/dist/components/support/html.d.ts +266 -0
- package/dist/components/support/html.js +604 -0
- package/dist/components/support/index.d.ts +226 -0
- package/dist/components/support/multipart.d.ts +21 -0
- package/dist/components/support/react.d.ts +54 -0
- package/dist/components/support/react.js +1252 -0
- package/dist/components/support/schema.d.ts +69 -0
- package/dist/components/support.d.ts +1 -66
- package/dist/components/theme-switcher/html.d.ts +28 -0
- package/dist/components/theme-switcher/html.js +288 -0
- package/dist/components/theme-switcher/index.d.ts +59 -0
- package/dist/components/{ui/theme-switcher.d.ts → theme-switcher/react.d.ts} +4 -12
- package/dist/components/{ui/theme-switcher.js → theme-switcher/react.js} +69 -35
- package/dist/components/theme-switcher/schema.d.ts +33 -0
- package/dist/components/time-input/classes.d.ts +23 -0
- package/dist/components/time-input/html.d.ts +75 -0
- package/dist/components/time-input/html.js +571 -0
- package/dist/components/time-input/index.d.ts +164 -0
- package/dist/components/time-input/react.d.ts +7 -0
- package/dist/components/{ui/time-picker.js → time-input/react.js} +286 -114
- package/dist/components/time-input/schema.d.ts +96 -0
- package/dist/components/timezone-input/classes.d.ts +13 -0
- package/dist/components/timezone-input/html.d.ts +58 -0
- package/dist/components/timezone-input/html.js +804 -0
- package/dist/components/timezone-input/index.d.ts +170 -0
- package/dist/components/timezone-input/react.d.ts +9 -0
- package/dist/components/{ui/timezone-select.js → timezone-input/react.js} +493 -106
- package/dist/components/timezone-input/schema.d.ts +43 -0
- package/dist/components/toast/classes.d.ts +7 -0
- package/dist/components/toast/html.d.ts +34 -0
- package/dist/components/toast/html.js +280 -0
- package/dist/components/toast/index.d.ts +10 -0
- package/dist/components/toast/react.d.ts +9 -0
- package/dist/components/{ui/toast.js → toast/react.js} +35 -15
- package/dist/components/toast/schema.d.ts +24 -0
- package/dist/{services/events/client/tracking-notice.d.ts → components/tracking-notice/react.d.ts} +7 -1
- package/dist/{services/events/client/tracking-notice.js → components/tracking-notice/react.js} +13 -7
- package/dist/components/ui/animated-list.d.ts +1 -21
- package/dist/components/ui/app-brand.d.ts +1 -33
- package/dist/components/ui/async-action-button.d.ts +1 -17
- package/dist/components/ui/code-block.d.ts +1 -14
- package/dist/components/ui/copy-button.d.ts +1 -21
- package/dist/components/ui/data-table.d.ts +1 -584
- package/dist/components/ui/krakstack-provider.d.ts +1 -9
- package/dist/components/ui/loading.d.ts +1 -13
- package/dist/components/ui/pagination.d.ts +1 -47
- package/dist/components/ui/rich-text-editor.d.ts +1 -72
- package/dist/components/ui/search-menu.d.ts +1 -36
- package/dist/components/ui/sidebar-layout.d.ts +1 -40
- package/dist/components/ui/virtualized-combobox.d.ts +1 -59
- package/dist/components/unsaved-changes-guard/html.d.ts +34 -0
- package/dist/components/unsaved-changes-guard/html.js +172 -0
- package/dist/components/unsaved-changes-guard/index.d.ts +56 -0
- package/dist/components/unsaved-changes-guard/react.d.ts +4 -0
- package/dist/components/{ui/unsaved-changes-guard.js → unsaved-changes-guard/react.js} +74 -11
- package/dist/components/unsaved-changes-guard/schema.d.ts +37 -0
- package/dist/components/upload-attachment/classes.d.ts +11 -0
- package/dist/components/upload-attachment/html.d.ts +84 -0
- package/dist/components/upload-attachment/html.js +312 -0
- package/dist/components/upload-attachment/index.d.ts +72 -0
- package/dist/components/upload-attachment/react.d.ts +9 -0
- package/dist/components/{ui/upload-attachment.js → upload-attachment/react.js} +114 -17
- package/dist/components/upload-attachment/schema.d.ts +53 -0
- package/dist/components/virtualized-combobox/classes.d.ts +7 -0
- package/dist/components/virtualized-combobox/html.d.ts +97 -0
- package/dist/components/virtualized-combobox/html.js +310 -0
- package/dist/components/virtualized-combobox/index.d.ts +182 -0
- package/dist/components/virtualized-combobox/react.d.ts +31 -0
- package/dist/components/{ui/virtualized-combobox.js → virtualized-combobox/react.js} +160 -40
- package/dist/components/virtualized-combobox/schema.d.ts +92 -0
- package/dist/components/webhook-delivery-table/html.d.ts +216 -0
- package/dist/components/webhook-delivery-table/html.js +3008 -0
- package/dist/components/webhook-delivery-table/index.d.ts +405 -0
- package/dist/components/webhook-delivery-table/react.d.ts +13 -0
- package/dist/{services/webhooks/client/delivery-table.js → components/webhook-delivery-table/react.js} +2461 -948
- package/dist/components/webhook-delivery-table/schema.d.ts +134 -0
- package/dist/lib/docs.d.ts +17 -1
- package/dist/lib/docs.integrations.server.js +358 -73
- package/dist/lib/docs.js +863 -295
- package/dist/lib/docs.server.js +342 -57
- package/dist/lib/documentation-toolkit.d.ts +4 -4
- package/dist/lib/documentation-toolkit.js +354 -69
- package/dist/lib/effect-ui-adapter/model-runtime.d.ts +17 -0
- package/dist/lib/effect-ui-adapter/use-model.d.ts +9 -0
- package/dist/lib/effectcn-form.d.ts +3 -0
- package/dist/lib/effectcn-form.js +54 -0
- package/dist/lib/email-composer/index.d.ts +12 -0
- package/dist/lib/email-composer/schema.d.ts +14 -0
- package/dist/lib/httpapi-toolkit.d.ts +1 -1
- package/dist/lib/lucide-effect.d.ts +39 -0
- package/dist/lib/markdown/content.d.ts +1 -12
- package/dist/lib/rich-text/model.d.ts +5 -0
- package/dist/lib/webfetch-toolkit.d.ts +1 -1
- package/dist/services/agent/client/index.js +697 -181
- package/dist/services/agent/client/widget.d.ts +1 -55
- package/dist/services/notification/client/index.js +138 -27
- package/dist/services/notification/client/notification-menu.d.ts +1 -85
- package/dist/services/notification/public.js +138 -27
- package/dist/services/opentelemetry/browser.js +15 -9
- package/dist/services/webhooks/index.d.ts +4 -3
- package/package.json +181 -142
- package/dist/components/support-dialog.js +0 -881
- package/dist/components/support.js +0 -881
- package/dist/components/ui/animated-list.js +0 -414
- package/dist/components/ui/animated-number.js +0 -75
- package/dist/components/ui/app-brand.js +0 -126
- package/dist/components/ui/app-switcher.d.ts +0 -26
- package/dist/components/ui/async-action-button.js +0 -149
- package/dist/components/ui/auto-height.js +0 -86
- package/dist/components/ui/bulk-list-input.d.ts +0 -25
- package/dist/components/ui/choice-cards.d.ts +0 -33
- package/dist/components/ui/code-block.js +0 -221
- package/dist/components/ui/color-picker.d.ts +0 -31
- package/dist/components/ui/copy-button.js +0 -138
- package/dist/components/ui/copy-value.d.ts +0 -24
- package/dist/components/ui/copy-value.js +0 -352
- package/dist/components/ui/cron-expression-editor.d.ts +0 -16
- package/dist/components/ui/cron-expression-editor.schema.d.ts +0 -7
- package/dist/components/ui/danger-confirmation.js +0 -398
- package/dist/components/ui/date-picker.d.ts +0 -33
- package/dist/components/ui/date-picker.schema.d.ts +0 -9
- package/dist/components/ui/editable-text.d.ts +0 -19
- package/dist/components/ui/editable-text.js +0 -341
- package/dist/components/ui/editing-locale-switcher.d.ts +0 -11
- package/dist/components/ui/error-component.d.ts +0 -34
- package/dist/components/ui/error-component.js +0 -387
- package/dist/components/ui/file-picker.d.ts +0 -37
- package/dist/components/ui/icon-input.d.ts +0 -58
- package/dist/components/ui/image-crop-editor.d.ts +0 -41
- package/dist/components/ui/image-crop-editor.js +0 -417
- package/dist/components/ui/loading.js +0 -39
- package/dist/components/ui/locale-switcher.d.ts +0 -11
- package/dist/components/ui/map-menu-map.d.ts +0 -115
- package/dist/components/ui/map-menu.d.ts +0 -87
- package/dist/components/ui/phone-number-input.d.ts +0 -22
- package/dist/components/ui/phone-number-input.schema.d.ts +0 -7
- package/dist/components/ui/presence-transition.js +0 -94
- package/dist/components/ui/select-with-custom-input.d.ts +0 -36
- package/dist/components/ui/stats-card.d.ts +0 -12
- package/dist/components/ui/stepper.d.ts +0 -37
- package/dist/components/ui/time-picker.d.ts +0 -50
- package/dist/components/ui/time-picker.schema.d.ts +0 -28
- package/dist/components/ui/timezone-select.d.ts +0 -57
- package/dist/components/ui/timezone-select.schema.d.ts +0 -9
- package/dist/components/ui/toast.d.ts +0 -18
- package/dist/components/ui/unsaved-changes-guard.d.ts +0 -16
- package/dist/components/ui/upload-attachment.d.ts +0 -39
- package/dist/services/notification/persistence/drizzle.d.ts +0 -868
- package/dist/services/notification/persistence/drizzle.js +0 -214
- package/dist/services/notification/persistence/index.d.ts +0 -2
- package/dist/services/notification/persistence/index.js +0 -227
- package/dist/services/notification/persistence/schema.d.ts +0 -143
- package/dist/services/notification/persistence/schema.js +0 -118
- package/dist/services/webhooks/client/delivery-table.d.ts +0 -62
|
@@ -0,0 +1,1252 @@
|
|
|
1
|
+
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
2
|
+
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
useCallback,
|
|
6
|
+
useContext,
|
|
7
|
+
useEffect,
|
|
8
|
+
useLayoutEffect,
|
|
9
|
+
useRef,
|
|
10
|
+
useState,
|
|
11
|
+
useSyncExternalStore
|
|
12
|
+
} from "react";
|
|
13
|
+
|
|
14
|
+
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
15
|
+
import { MessageLog, Renderer, View } from "effect/ui";
|
|
16
|
+
import { BrowserHost, Html } from "effect/ui/html";
|
|
17
|
+
import { Cause, Effect, Fiber } from "effect";
|
|
18
|
+
var node = () => ({ children: [] });
|
|
19
|
+
var modelHost = (commit) => {
|
|
20
|
+
const remove = (child) => {
|
|
21
|
+
if (!child.parent)
|
|
22
|
+
return;
|
|
23
|
+
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
24
|
+
delete child.parent;
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
createElement: node,
|
|
28
|
+
createText: node,
|
|
29
|
+
setText: () => {},
|
|
30
|
+
setAttr: () => {},
|
|
31
|
+
setProp: () => {},
|
|
32
|
+
setEvents: () => {},
|
|
33
|
+
insertBefore: (parent, child, before) => {
|
|
34
|
+
if (child === before)
|
|
35
|
+
return;
|
|
36
|
+
remove(child);
|
|
37
|
+
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
38
|
+
parent.children.splice(index, 0, child);
|
|
39
|
+
child.parent = parent;
|
|
40
|
+
},
|
|
41
|
+
remove,
|
|
42
|
+
parentOf: (child) => child.parent,
|
|
43
|
+
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
44
|
+
elements: ["html"],
|
|
45
|
+
controlled: new Set,
|
|
46
|
+
runsMounts: false,
|
|
47
|
+
commit
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
51
|
+
let currentProps = props;
|
|
52
|
+
let root;
|
|
53
|
+
let active = true;
|
|
54
|
+
let failure;
|
|
55
|
+
const publish = () => {
|
|
56
|
+
if (!active)
|
|
57
|
+
return;
|
|
58
|
+
if (failure) {
|
|
59
|
+
publishSnapshot({ error: failure });
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const current = root?.model();
|
|
63
|
+
if (current !== undefined)
|
|
64
|
+
publishSnapshot({ model: current });
|
|
65
|
+
};
|
|
66
|
+
const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
|
|
67
|
+
const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
|
|
68
|
+
head: false,
|
|
69
|
+
onEmit,
|
|
70
|
+
fallback: ({ cause }) => {
|
|
71
|
+
failure = new Error("Effect UI root failed", {
|
|
72
|
+
cause: Cause.squash(cause)
|
|
73
|
+
});
|
|
74
|
+
return View.text("");
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
if (!active)
|
|
78
|
+
return;
|
|
79
|
+
root = mounted;
|
|
80
|
+
if (props !== currentProps)
|
|
81
|
+
mounted.setProps(currentProps);
|
|
82
|
+
publish();
|
|
83
|
+
return yield* Effect.never;
|
|
84
|
+
}).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
|
|
85
|
+
return {
|
|
86
|
+
send: (message) => {
|
|
87
|
+
root?.send(message);
|
|
88
|
+
publish();
|
|
89
|
+
},
|
|
90
|
+
setProps: (next) => {
|
|
91
|
+
currentProps = next;
|
|
92
|
+
root?.setProps(next);
|
|
93
|
+
},
|
|
94
|
+
dispose: () => {
|
|
95
|
+
active = false;
|
|
96
|
+
root = undefined;
|
|
97
|
+
Effect.runFork(Fiber.interrupt(fiber));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
103
|
+
"use client";
|
|
104
|
+
var ModelMessageLogContext = createContext(undefined);
|
|
105
|
+
var useModel = (component, props, options = {}) => {
|
|
106
|
+
const contextLog = useContext(ModelMessageLogContext);
|
|
107
|
+
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
108
|
+
const [store] = useState(() => {
|
|
109
|
+
const initial = { model: component.init(props).model };
|
|
110
|
+
let snapshot = initial;
|
|
111
|
+
const listeners = new Set;
|
|
112
|
+
return {
|
|
113
|
+
subscribe: (listener) => {
|
|
114
|
+
listeners.add(listener);
|
|
115
|
+
return () => {
|
|
116
|
+
listeners.delete(listener);
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
getSnapshot: () => snapshot,
|
|
120
|
+
getServerSnapshot: () => initial,
|
|
121
|
+
publish: (next) => {
|
|
122
|
+
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
123
|
+
return;
|
|
124
|
+
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
125
|
+
return;
|
|
126
|
+
snapshot = next;
|
|
127
|
+
listeners.forEach((listener) => listener());
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
132
|
+
const committed = useRef(props);
|
|
133
|
+
const onEmit = useRef(options.onEmit);
|
|
134
|
+
const runtime = useRef(undefined);
|
|
135
|
+
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
136
|
+
useLayoutEffect(() => {
|
|
137
|
+
onEmit.current = options.onEmit;
|
|
138
|
+
committed.current = props;
|
|
139
|
+
runtime.current?.setProps(props);
|
|
140
|
+
}, [props, options.onEmit]);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (messageLog === null)
|
|
143
|
+
return;
|
|
144
|
+
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
145
|
+
runtime.current = mounted;
|
|
146
|
+
return () => {
|
|
147
|
+
runtime.current = undefined;
|
|
148
|
+
mounted.dispose();
|
|
149
|
+
};
|
|
150
|
+
}, [component, messageLog, store]);
|
|
151
|
+
if ("error" in snapshot)
|
|
152
|
+
throw snapshot.error;
|
|
153
|
+
return { model: snapshot.model, send };
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// ../../src/components/support/react.tsx
|
|
157
|
+
import { Component as Component2 } from "effect/ui";
|
|
158
|
+
import { Option, Redacted as Redacted2, Schema as Schema5 } from "effect";
|
|
159
|
+
import { Check, Image, Paperclip, X } from "lucide-react";
|
|
160
|
+
import {
|
|
161
|
+
useId,
|
|
162
|
+
useLayoutEffect as useLayoutEffect2,
|
|
163
|
+
useRef as useRef2,
|
|
164
|
+
useState as useState2
|
|
165
|
+
} from "react";
|
|
166
|
+
|
|
167
|
+
// ../../src/components/ui/button.tsx
|
|
168
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
169
|
+
import { cva } from "class-variance-authority";
|
|
170
|
+
|
|
171
|
+
// ../../src/lib/utils.ts
|
|
172
|
+
import { cn } from "cn";
|
|
173
|
+
|
|
174
|
+
// ../../src/components/ui/button.tsx
|
|
175
|
+
import { jsx } from "react/jsx-runtime";
|
|
176
|
+
var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
177
|
+
variants: {
|
|
178
|
+
variant: {
|
|
179
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
180
|
+
outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
181
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
182
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
183
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
184
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
185
|
+
},
|
|
186
|
+
size: {
|
|
187
|
+
default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
188
|
+
xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
189
|
+
sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
|
|
190
|
+
lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
191
|
+
icon: "size-9",
|
|
192
|
+
"icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
193
|
+
"icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
|
|
194
|
+
"icon-lg": "size-10"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
defaultVariants: {
|
|
198
|
+
variant: "default",
|
|
199
|
+
size: "default"
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
function Button({
|
|
203
|
+
className,
|
|
204
|
+
variant = "default",
|
|
205
|
+
size = "default",
|
|
206
|
+
...props
|
|
207
|
+
}) {
|
|
208
|
+
return /* @__PURE__ */ jsx(ButtonPrimitive, {
|
|
209
|
+
"data-slot": "button",
|
|
210
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
211
|
+
...props
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// ../../src/components/ui/dialog.tsx
|
|
216
|
+
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
217
|
+
import { cn as cn2 } from "cn";
|
|
218
|
+
import { XIcon } from "lucide-react";
|
|
219
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
220
|
+
function Dialog({ ...props }) {
|
|
221
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Root, {
|
|
222
|
+
"data-slot": "dialog",
|
|
223
|
+
...props
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function DialogTrigger({ ...props }) {
|
|
227
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Trigger, {
|
|
228
|
+
"data-slot": "dialog-trigger",
|
|
229
|
+
...props
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function DialogPortal({ ...props }) {
|
|
233
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Portal, {
|
|
234
|
+
"data-slot": "dialog-portal",
|
|
235
|
+
...props
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function DialogClose({ ...props }) {
|
|
239
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Close, {
|
|
240
|
+
"data-slot": "dialog-close",
|
|
241
|
+
...props
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
function DialogOverlay({
|
|
245
|
+
className,
|
|
246
|
+
...props
|
|
247
|
+
}) {
|
|
248
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Backdrop, {
|
|
249
|
+
"data-slot": "dialog-overlay",
|
|
250
|
+
className: cn2("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs", className),
|
|
251
|
+
...props
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function DialogContent({
|
|
255
|
+
className,
|
|
256
|
+
children,
|
|
257
|
+
showCloseButton = true,
|
|
258
|
+
...props
|
|
259
|
+
}) {
|
|
260
|
+
return /* @__PURE__ */ jsxs(DialogPortal, {
|
|
261
|
+
children: [
|
|
262
|
+
/* @__PURE__ */ jsx2(DialogOverlay, {}),
|
|
263
|
+
/* @__PURE__ */ jsxs(DialogPrimitive.Popup, {
|
|
264
|
+
"data-slot": "dialog-content",
|
|
265
|
+
className: cn2("bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-sm ring-1 duration-100 outline-none sm:max-w-md", className),
|
|
266
|
+
...props,
|
|
267
|
+
children: [
|
|
268
|
+
children,
|
|
269
|
+
showCloseButton && /* @__PURE__ */ jsxs(DialogPrimitive.Close, {
|
|
270
|
+
"data-slot": "dialog-close",
|
|
271
|
+
render: /* @__PURE__ */ jsx2(Button, {
|
|
272
|
+
variant: "ghost",
|
|
273
|
+
className: "absolute top-4 right-4",
|
|
274
|
+
size: "icon-sm"
|
|
275
|
+
}),
|
|
276
|
+
children: [
|
|
277
|
+
/* @__PURE__ */ jsx2(XIcon, {}),
|
|
278
|
+
/* @__PURE__ */ jsx2("span", {
|
|
279
|
+
className: "sr-only",
|
|
280
|
+
children: "Close"
|
|
281
|
+
})
|
|
282
|
+
]
|
|
283
|
+
})
|
|
284
|
+
]
|
|
285
|
+
})
|
|
286
|
+
]
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function DialogHeader({ className, ...props }) {
|
|
290
|
+
return /* @__PURE__ */ jsx2("div", {
|
|
291
|
+
"data-slot": "dialog-header",
|
|
292
|
+
className: cn2("flex flex-col gap-2", className),
|
|
293
|
+
...props
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function DialogTitle({ className, ...props }) {
|
|
297
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Title, {
|
|
298
|
+
"data-slot": "dialog-title",
|
|
299
|
+
className: cn2("leading-none font-medium", className),
|
|
300
|
+
...props
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
function DialogDescription({
|
|
304
|
+
className,
|
|
305
|
+
...props
|
|
306
|
+
}) {
|
|
307
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Description, {
|
|
308
|
+
"data-slot": "dialog-description",
|
|
309
|
+
className: cn2("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3", className),
|
|
310
|
+
...props
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// ../../src/components/ui/field.tsx
|
|
315
|
+
import { useMemo } from "react";
|
|
316
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
317
|
+
|
|
318
|
+
// ../../src/components/ui/label.tsx
|
|
319
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
320
|
+
"use client";
|
|
321
|
+
function Label({ className, ...props }) {
|
|
322
|
+
return /* @__PURE__ */ jsx3("label", {
|
|
323
|
+
"data-slot": "label",
|
|
324
|
+
className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
325
|
+
...props
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// ../../src/components/ui/separator.tsx
|
|
330
|
+
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
331
|
+
|
|
332
|
+
// ../../src/components/ui/field.tsx
|
|
333
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
334
|
+
var fieldVariants = cva2("group/field flex w-full gap-3 data-[invalid=true]:text-destructive", {
|
|
335
|
+
variants: {
|
|
336
|
+
orientation: {
|
|
337
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
338
|
+
horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
339
|
+
responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
defaultVariants: {
|
|
343
|
+
orientation: "vertical"
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
function Field({
|
|
347
|
+
className,
|
|
348
|
+
orientation = "vertical",
|
|
349
|
+
...props
|
|
350
|
+
}) {
|
|
351
|
+
return /* @__PURE__ */ jsx4("div", {
|
|
352
|
+
role: "group",
|
|
353
|
+
"data-slot": "field",
|
|
354
|
+
"data-orientation": orientation,
|
|
355
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
356
|
+
...props
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function FieldLabel({
|
|
360
|
+
className,
|
|
361
|
+
...props
|
|
362
|
+
}) {
|
|
363
|
+
return /* @__PURE__ */ jsx4(Label, {
|
|
364
|
+
"data-slot": "field-label",
|
|
365
|
+
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className),
|
|
366
|
+
...props
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
function FieldError({
|
|
370
|
+
className,
|
|
371
|
+
children,
|
|
372
|
+
errors,
|
|
373
|
+
...props
|
|
374
|
+
}) {
|
|
375
|
+
const content = useMemo(() => {
|
|
376
|
+
if (children) {
|
|
377
|
+
return children;
|
|
378
|
+
}
|
|
379
|
+
if (!errors?.length) {
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
const uniqueErrors = [
|
|
383
|
+
...new Map(errors.map((error) => [error?.message, error])).values()
|
|
384
|
+
];
|
|
385
|
+
if (uniqueErrors?.length == 1) {
|
|
386
|
+
return uniqueErrors[0]?.message;
|
|
387
|
+
}
|
|
388
|
+
return /* @__PURE__ */ jsx4("ul", {
|
|
389
|
+
className: "ml-4 flex list-disc flex-col gap-1",
|
|
390
|
+
children: uniqueErrors.map((error, index) => error?.message && /* @__PURE__ */ jsx4("li", {
|
|
391
|
+
children: error.message
|
|
392
|
+
}, index))
|
|
393
|
+
});
|
|
394
|
+
}, [children, errors]);
|
|
395
|
+
if (!content) {
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
return /* @__PURE__ */ jsx4("div", {
|
|
399
|
+
role: "alert",
|
|
400
|
+
"data-slot": "field-error",
|
|
401
|
+
className: cn("text-sm font-normal text-destructive", className),
|
|
402
|
+
...props,
|
|
403
|
+
children: content
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// ../../src/components/ui/input.tsx
|
|
408
|
+
import { Input as InputPrimitive } from "@base-ui/react/input";
|
|
409
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
410
|
+
function Input({ className, type, ...props }) {
|
|
411
|
+
return /* @__PURE__ */ jsx5(InputPrimitive, {
|
|
412
|
+
type,
|
|
413
|
+
"data-slot": "input",
|
|
414
|
+
className: cn("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
415
|
+
...props
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// ../../src/components/ui/textarea.tsx
|
|
420
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
421
|
+
function Textarea({ className, ...props }) {
|
|
422
|
+
return /* @__PURE__ */ jsx6("textarea", {
|
|
423
|
+
"data-slot": "textarea",
|
|
424
|
+
className: cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
|
|
425
|
+
...props
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// ../../src/components/support/react.tsx
|
|
430
|
+
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
431
|
+
|
|
432
|
+
// ../../src/components/support/index.ts
|
|
433
|
+
import { Command, Component, UiSchema, View as View2 } from "effect/ui";
|
|
434
|
+
import { Effect as Effect2, Redacted, Schema as Schema3 } from "effect";
|
|
435
|
+
|
|
436
|
+
// ../../src/components/support/form.ts
|
|
437
|
+
import { Result, Schema as Schema2, SchemaIssue } from "effect";
|
|
438
|
+
|
|
439
|
+
// ../../src/components/support/schema.ts
|
|
440
|
+
import { Schema, Struct } from "effect";
|
|
441
|
+
|
|
442
|
+
// ../../src/components/support/classes.ts
|
|
443
|
+
var defaultSupportClasses = {
|
|
444
|
+
page: "mx-auto grid w-full max-w-xl gap-8 self-start",
|
|
445
|
+
pageHeader: "grid gap-3",
|
|
446
|
+
pageTitle: "m-0 text-[2rem] font-semibold tracking-tight",
|
|
447
|
+
pageDescription: "m-0 text-muted-foreground",
|
|
448
|
+
form: "grid min-w-0 gap-4",
|
|
449
|
+
fieldset: "m-0 grid min-w-0 gap-4 border-0 p-0",
|
|
450
|
+
optional: "font-normal text-muted-foreground",
|
|
451
|
+
message: "grid gap-2",
|
|
452
|
+
actions: "flex flex-wrap justify-end gap-2",
|
|
453
|
+
attachments: "m-0 flex min-w-0 list-none flex-wrap gap-2 p-0",
|
|
454
|
+
attachment: "inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-md border border-border bg-card py-1 ps-1.5 pe-1 text-xs leading-none text-card-foreground",
|
|
455
|
+
attachmentMedia: "grid size-7 shrink-0 place-items-center rounded-sm bg-muted text-foreground",
|
|
456
|
+
filename: "min-w-0 truncate font-medium",
|
|
457
|
+
attach: "relative me-auto w-fit",
|
|
458
|
+
file: "absolute inset-0 size-full cursor-pointer opacity-0",
|
|
459
|
+
alert: "m-0 text-sm text-destructive",
|
|
460
|
+
details: "flex items-center gap-2 text-sm font-medium",
|
|
461
|
+
link: "[overflow-wrap:anywhere] underline underline-offset-4",
|
|
462
|
+
closeAction: "self-start text-start",
|
|
463
|
+
dialogTitle: "flex items-center gap-2",
|
|
464
|
+
statusHeader: "grid gap-1.5",
|
|
465
|
+
statusTitle: "m-0 text-base font-semibold",
|
|
466
|
+
description: "m-0 text-sm leading-normal text-muted-foreground",
|
|
467
|
+
confirmation: "flex flex-col items-center gap-3 rounded-md border border-border px-6 py-8 text-center",
|
|
468
|
+
checkBadge: "mb-1 grid size-12 place-items-center rounded-full bg-primary/10 text-primary"
|
|
469
|
+
};
|
|
470
|
+
var resolveSupportClasses = (classes) => ({
|
|
471
|
+
...defaultSupportClasses,
|
|
472
|
+
...classes
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
// ../../src/components/support/schema.ts
|
|
476
|
+
var supportMessageLimit = 5000;
|
|
477
|
+
var supportReplyEmailLimit = 254;
|
|
478
|
+
var supportErrorDetailsLimit = 8000;
|
|
479
|
+
var supportScreenshotLimit = 3;
|
|
480
|
+
var supportScreenshotMaxBytes = 5 * 1024 * 1024;
|
|
481
|
+
var screenshotFormats = new Map([
|
|
482
|
+
[
|
|
483
|
+
"image/png",
|
|
484
|
+
{ extension: "png", signatures: [[0, [137, 80, 78, 71, 13, 10, 26, 10]]] }
|
|
485
|
+
],
|
|
486
|
+
["image/jpeg", { extension: "jpg", signatures: [[0, [255, 216, 255]]] }],
|
|
487
|
+
[
|
|
488
|
+
"image/webp",
|
|
489
|
+
{
|
|
490
|
+
extension: "webp",
|
|
491
|
+
signatures: [
|
|
492
|
+
[0, [82, 73, 70, 70]],
|
|
493
|
+
[8, [87, 69, 66, 80]]
|
|
494
|
+
]
|
|
495
|
+
}
|
|
496
|
+
]
|
|
497
|
+
]);
|
|
498
|
+
var screenshotAccept = Array.from(screenshotFormats.keys()).join(",");
|
|
499
|
+
var SupportMessage = Schema.Trim.check(Schema.isNonEmpty(), Schema.isMaxLength(supportMessageLimit)).annotate({ identifier: "SupportMessage" });
|
|
500
|
+
var SupportReplyEmail = Schema.Trim.check(Schema.isMaxLength(supportReplyEmailLimit), Schema.isPattern(/^[^\s@,<>]+@[^\s@,<>]+$/)).annotate({ identifier: "SupportReplyEmail" });
|
|
501
|
+
var SupportScreenshots = Schema.Array(Schema.File.check(Schema.makeFilter((file) => screenshotFormats.has(file.type) && file.size > 0 && file.size <= supportScreenshotMaxBytes))).check(Schema.isMaxLength(supportScreenshotLimit)).annotate({ identifier: "SupportScreenshots" });
|
|
502
|
+
var SupportErrorDetails = Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(supportErrorDetailsLimit)).annotate({ identifier: "SupportErrorDetails" });
|
|
503
|
+
var SupportRequestSchema = Schema.Struct({
|
|
504
|
+
message: SupportMessage,
|
|
505
|
+
replyEmail: Schema.optionalKey(SupportReplyEmail),
|
|
506
|
+
errorDetails: Schema.optionalKey(SupportErrorDetails),
|
|
507
|
+
attachments: SupportScreenshots
|
|
508
|
+
}).annotate({ identifier: "SupportRequest" });
|
|
509
|
+
var SupportFormState = Schema.Struct({
|
|
510
|
+
attachments: Schema.Array(Schema.File),
|
|
511
|
+
invalidAttachments: Schema.Boolean,
|
|
512
|
+
invalidFields: Schema.optional(Schema.Array(Schema.Literals(["message", "replyEmail"]))),
|
|
513
|
+
status: Schema.Literals(["idle", "pending", "invalid", "failed", "success"])
|
|
514
|
+
}).annotate({ identifier: "SupportFormState" });
|
|
515
|
+
var SupportFormMessages = Schema.Struct({
|
|
516
|
+
title: Schema.String,
|
|
517
|
+
description: Schema.optional(Schema.String),
|
|
518
|
+
placeholder: Schema.optional(Schema.String),
|
|
519
|
+
replyEmail: Schema.String,
|
|
520
|
+
replyEmailPlaceholder: Schema.optional(Schema.String),
|
|
521
|
+
attach: Schema.String,
|
|
522
|
+
invalidAttachments: Schema.String,
|
|
523
|
+
removeAttachment: Schema.String,
|
|
524
|
+
submit: Schema.String,
|
|
525
|
+
pending: Schema.String,
|
|
526
|
+
success: Schema.String,
|
|
527
|
+
successDescription: Schema.optional(Schema.String),
|
|
528
|
+
close: Schema.String,
|
|
529
|
+
invalid: Schema.String,
|
|
530
|
+
invalidMessage: Schema.optional(Schema.String),
|
|
531
|
+
invalidReplyEmail: Schema.optional(Schema.String),
|
|
532
|
+
failed: Schema.String,
|
|
533
|
+
includeErrorDetails: Schema.optional(Schema.String),
|
|
534
|
+
optional: Schema.optional(Schema.String),
|
|
535
|
+
directEmail: Schema.optional(Schema.String)
|
|
536
|
+
}).annotate({ identifier: "SupportFormMessages" });
|
|
537
|
+
var SupportClassOverrides = Schema.Record(Schema.Literals(Struct.keys(defaultSupportClasses)), Schema.optionalKey(Schema.String)).annotate({ identifier: "SupportClassOverrides" });
|
|
538
|
+
var SupportProps = Schema.Struct({
|
|
539
|
+
messages: Schema.optional(SupportFormMessages),
|
|
540
|
+
locale: Schema.optional(Schema.String),
|
|
541
|
+
className: Schema.optional(Schema.String),
|
|
542
|
+
classes: Schema.optional(SupportClassOverrides),
|
|
543
|
+
inline: Schema.optional(Schema.Boolean),
|
|
544
|
+
supportEmail: Schema.optional(Schema.String),
|
|
545
|
+
askForReplyEmail: Schema.optional(Schema.Boolean),
|
|
546
|
+
defaultReplyEmail: Schema.optional(Schema.Redacted(Schema.String)),
|
|
547
|
+
errorDetails: Schema.optional(Schema.Redacted(Schema.String))
|
|
548
|
+
}).annotate({ identifier: "SupportDialogProps" });
|
|
549
|
+
var SupportFormFields = Schema.Struct({
|
|
550
|
+
message: Schema.String,
|
|
551
|
+
replyEmail: Schema.optional(Schema.String),
|
|
552
|
+
includeErrorDetails: Schema.Boolean
|
|
553
|
+
}).annotate({ identifier: "SupportFormFields" });
|
|
554
|
+
|
|
555
|
+
// ../../src/components/support/form.ts
|
|
556
|
+
var decodeScreenshots = Schema2.decodeResult(SupportScreenshots);
|
|
557
|
+
var decodeRequest = Schema2.decodeUnknownResult(SupportRequestSchema, {
|
|
558
|
+
errors: "all"
|
|
559
|
+
});
|
|
560
|
+
var formatIssue = SchemaIssue.makeFormatterStandardSchemaV1();
|
|
561
|
+
var emptySupportForm = {
|
|
562
|
+
attachments: [],
|
|
563
|
+
invalidAttachments: false,
|
|
564
|
+
status: "idle"
|
|
565
|
+
};
|
|
566
|
+
var addSupportAttachments = (state, files) => {
|
|
567
|
+
if (state.status === "pending" || files.length === 0)
|
|
568
|
+
return state;
|
|
569
|
+
const result = decodeScreenshots([...state.attachments, ...files]);
|
|
570
|
+
if (Result.isFailure(result))
|
|
571
|
+
return { ...state, invalidAttachments: true };
|
|
572
|
+
return { ...state, attachments: result.success, invalidAttachments: false };
|
|
573
|
+
};
|
|
574
|
+
var removeSupportAttachment = (state, index) => {
|
|
575
|
+
if (state.status === "pending")
|
|
576
|
+
return state;
|
|
577
|
+
return {
|
|
578
|
+
...state,
|
|
579
|
+
attachments: state.attachments.filter((_, position) => position !== index),
|
|
580
|
+
invalidAttachments: false
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
var supportDiagnostics = (details) => details?.trim().slice(0, supportErrorDetailsLimit);
|
|
584
|
+
var beginSupportSubmission = (state, fields) => {
|
|
585
|
+
if (state.status === "pending" || state.status === "success")
|
|
586
|
+
return { state };
|
|
587
|
+
const includeReplyEmail = fields.askForReplyEmail === true || fields.askForReplyEmail !== false && Boolean(fields.replyEmail);
|
|
588
|
+
const details = fields.includeErrorDetails ? supportDiagnostics(fields.errorDetails) : undefined;
|
|
589
|
+
const draft = {
|
|
590
|
+
message: fields.message,
|
|
591
|
+
attachments: state.attachments
|
|
592
|
+
};
|
|
593
|
+
if (includeReplyEmail)
|
|
594
|
+
draft.replyEmail = fields.replyEmail;
|
|
595
|
+
if (details)
|
|
596
|
+
draft.errorDetails = details;
|
|
597
|
+
const result = decodeRequest(draft);
|
|
598
|
+
if (Result.isFailure(result)) {
|
|
599
|
+
const issues = formatIssue(result.failure.issue).issues;
|
|
600
|
+
const invalidFields = ["message", "replyEmail"].filter((field) => issues.some((issue) => issue.path?.[0] === field));
|
|
601
|
+
return { state: { ...state, status: "invalid", invalidFields } };
|
|
602
|
+
}
|
|
603
|
+
return {
|
|
604
|
+
state: { ...state, status: "pending", invalidFields: undefined },
|
|
605
|
+
request: result.success
|
|
606
|
+
};
|
|
607
|
+
};
|
|
608
|
+
var finishSupportSubmission = (state, accepted) => {
|
|
609
|
+
if (state.status !== "pending")
|
|
610
|
+
return state;
|
|
611
|
+
return accepted ? { ...emptySupportForm, status: "success" } : { ...state, status: "failed" };
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
// ../../src/components/support/index.ts
|
|
615
|
+
var defaultMessages = {
|
|
616
|
+
en: {
|
|
617
|
+
title: "Tell us how we can help",
|
|
618
|
+
description: "Share any details that will help us answer your question or understand what went wrong.",
|
|
619
|
+
placeholder: "I need help with…",
|
|
620
|
+
replyEmail: "Reply email",
|
|
621
|
+
replyEmailPlaceholder: "you@example.com",
|
|
622
|
+
attach: "Attach screenshots",
|
|
623
|
+
invalidAttachments: "Screenshots weren’t added. Choose up to 3 PNG, JPEG or WebP images, 5 MB each.",
|
|
624
|
+
removeAttachment: "Remove screenshot",
|
|
625
|
+
submit: "Send message",
|
|
626
|
+
pending: "Sending…",
|
|
627
|
+
success: "Message sent",
|
|
628
|
+
successDescription: "We will get back to you as soon as possible.",
|
|
629
|
+
close: "Close",
|
|
630
|
+
invalid: "Check your message and reply email if requested.",
|
|
631
|
+
invalidMessage: "Enter a message of 5,000 characters or fewer.",
|
|
632
|
+
invalidReplyEmail: "Enter a valid reply email address.",
|
|
633
|
+
failed: "Could not send your message. Try again.",
|
|
634
|
+
includeErrorDetails: "Include error details",
|
|
635
|
+
optional: "optional",
|
|
636
|
+
directEmail: "Or email us directly at"
|
|
637
|
+
},
|
|
638
|
+
fr: {
|
|
639
|
+
title: "Dites-nous comment nous pouvons vous aider",
|
|
640
|
+
description: "Donnez-nous les détails qui nous aideront à répondre à votre question ou à comprendre le problème.",
|
|
641
|
+
placeholder: "J’ai besoin d’aide pour…",
|
|
642
|
+
replyEmail: "Adresse courriel pour la réponse",
|
|
643
|
+
replyEmailPlaceholder: "vous@example.com",
|
|
644
|
+
attach: "Joindre des captures d’écran",
|
|
645
|
+
invalidAttachments: "Les captures d’écran n’ont pas été ajoutées. Choisissez jusqu’à 3 images PNG, JPEG ou WebP de 5 Mo chacune.",
|
|
646
|
+
removeAttachment: "Retirer la capture d’écran",
|
|
647
|
+
submit: "Envoyer le message",
|
|
648
|
+
pending: "Envoi en cours…",
|
|
649
|
+
success: "Message envoyé",
|
|
650
|
+
successDescription: "Nous vous répondrons dès que possible.",
|
|
651
|
+
close: "Fermer",
|
|
652
|
+
invalid: "Vérifiez le message et, si elle est demandée, l’adresse courriel.",
|
|
653
|
+
invalidMessage: "Saisissez un message d’au plus 5 000 caractères.",
|
|
654
|
+
invalidReplyEmail: "Saisissez une adresse courriel de réponse valide.",
|
|
655
|
+
failed: "Impossible d’envoyer votre message. Réessayez.",
|
|
656
|
+
includeErrorDetails: "Inclure les détails de l’erreur",
|
|
657
|
+
optional: "facultatif",
|
|
658
|
+
directEmail: "Ou écrivez-nous directement à"
|
|
659
|
+
}
|
|
660
|
+
};
|
|
661
|
+
var getSupportFormMessages = (locale = "en", messages) => {
|
|
662
|
+
const language = locale.split("-")[0] ?? locale;
|
|
663
|
+
return {
|
|
664
|
+
...language === "fr" ? defaultMessages.fr : defaultMessages.en,
|
|
665
|
+
...messages?.[language],
|
|
666
|
+
...messages?.[locale]
|
|
667
|
+
};
|
|
668
|
+
};
|
|
669
|
+
var SupportModel = Schema3.Struct({
|
|
670
|
+
open: Schema3.Boolean,
|
|
671
|
+
form: Schema3.Redacted(SupportFormState, { disallowJsonEncode: true })
|
|
672
|
+
}).annotate({ identifier: "SupportDialogModel" });
|
|
673
|
+
var readForm = (model) => Redacted.value(model.form);
|
|
674
|
+
var initialForm = Redacted.make(emptySupportForm);
|
|
675
|
+
var initialSupportModel = (open = false) => ({
|
|
676
|
+
open,
|
|
677
|
+
form: initialForm
|
|
678
|
+
});
|
|
679
|
+
var SupportMessage2 = UiSchema.TaggedEnum({
|
|
680
|
+
RequestedOpen: {},
|
|
681
|
+
RequestedClose: {},
|
|
682
|
+
AddedScreenshots: { files: Schema3.Redacted(Schema3.Array(Schema3.File)) },
|
|
683
|
+
RemovedScreenshot: { index: Schema3.Int },
|
|
684
|
+
SubmittedForm: { fields: Schema3.Redacted(SupportFormFields) },
|
|
685
|
+
SendFinished: { accepted: Schema3.Boolean }
|
|
686
|
+
}).annotate({ identifier: "SupportDialogMessage" });
|
|
687
|
+
|
|
688
|
+
class SendSupport extends Command.Service()("support/SendSupport", {
|
|
689
|
+
args: {
|
|
690
|
+
request: Schema3.Redacted(SupportRequestSchema, {
|
|
691
|
+
disallowJsonEncode: true
|
|
692
|
+
})
|
|
693
|
+
},
|
|
694
|
+
success: SupportMessage2
|
|
695
|
+
}) {
|
|
696
|
+
static layerFromSubmit = (submit) => SendSupport.toLayer(({ request }) => Effect2.tryPromise(async () => submit(Redacted.value(request))).pipe(Effect2.match({
|
|
697
|
+
onSuccess: () => SupportMessage2.SendFinished({ accepted: true }),
|
|
698
|
+
onFailure: () => SupportMessage2.SendFinished({ accepted: false })
|
|
699
|
+
})));
|
|
700
|
+
}
|
|
701
|
+
var supportOptions = {
|
|
702
|
+
name: "AdapterSupportDialog",
|
|
703
|
+
props: SupportProps,
|
|
704
|
+
model: SupportModel,
|
|
705
|
+
message: SupportMessage2,
|
|
706
|
+
restore: false
|
|
707
|
+
};
|
|
708
|
+
var SupportDefinition = Component.define(supportOptions);
|
|
709
|
+
var supportBehaviours = {
|
|
710
|
+
init: SupportDefinition.init(({ props }) => initialSupportModel(props.inline)),
|
|
711
|
+
update: SupportDefinition.update({
|
|
712
|
+
RequestedOpen: ($) => $.model.open ? $.model : $.evolve({ open: true }),
|
|
713
|
+
RequestedClose: ($) => readForm($.model).status === "pending" ? $.model : $.evolve({ open: false, form: initialForm }),
|
|
714
|
+
AddedScreenshots: ($, { files }) => !$.model.open ? $.model : $.evolve({
|
|
715
|
+
form: Redacted.make(addSupportAttachments(readForm($.model), Redacted.value(files)))
|
|
716
|
+
}),
|
|
717
|
+
RemovedScreenshot: ($, { index }) => !$.model.open ? $.model : $.evolve({
|
|
718
|
+
form: Redacted.make(removeSupportAttachment(readForm($.model), index))
|
|
719
|
+
}),
|
|
720
|
+
SubmittedForm: ($, { fields }) => {
|
|
721
|
+
if (!$.model.open)
|
|
722
|
+
return $.model;
|
|
723
|
+
const { message, replyEmail, includeErrorDetails } = Redacted.value(fields);
|
|
724
|
+
const { request, state } = beginSupportSubmission(readForm($.model), {
|
|
725
|
+
message,
|
|
726
|
+
replyEmail,
|
|
727
|
+
includeErrorDetails,
|
|
728
|
+
askForReplyEmail: $.props.askForReplyEmail,
|
|
729
|
+
errorDetails: $.props.errorDetails && Redacted.value($.props.errorDetails)
|
|
730
|
+
});
|
|
731
|
+
const next = $.evolve({ form: Redacted.make(state) });
|
|
732
|
+
return request ? next.run(SendSupport.make({ request: Redacted.make(request) })) : next;
|
|
733
|
+
},
|
|
734
|
+
SendFinished: ($, { accepted }) => $.evolve({
|
|
735
|
+
form: Redacted.make(finishSupportSubmission(readForm($.model), accepted))
|
|
736
|
+
})
|
|
737
|
+
})
|
|
738
|
+
};
|
|
739
|
+
var SupportDialogModel = SupportDefinition.make({
|
|
740
|
+
...supportBehaviours,
|
|
741
|
+
view: () => View2.text("")
|
|
742
|
+
});
|
|
743
|
+
// ../../src/components/support/multipart.ts
|
|
744
|
+
import { Effect as Effect3, FileSystem, Schema as Schema4 } from "effect";
|
|
745
|
+
import { Multipart } from "effect/http";
|
|
746
|
+
import { HttpApiSchema } from "effect/http-api";
|
|
747
|
+
var SupportMultipartPayload = Schema4.Struct({
|
|
748
|
+
message: SupportMessage,
|
|
749
|
+
replyEmail: Schema4.optionalKey(SupportReplyEmail),
|
|
750
|
+
errorDetails: Schema4.optionalKey(SupportErrorDetails),
|
|
751
|
+
attachments: Schema4.optionalKey(Multipart.FilesSchema.check(Schema4.isMaxLength(supportScreenshotLimit)))
|
|
752
|
+
}).annotate({ identifier: "SupportMultipartPayload" }).pipe(HttpApiSchema.asMultipart({
|
|
753
|
+
maxParts: supportScreenshotLimit + 3,
|
|
754
|
+
maxFieldSize: 32 * 1024,
|
|
755
|
+
maxFileSize: supportScreenshotMaxBytes,
|
|
756
|
+
maxTotalSize: supportScreenshotLimit * supportScreenshotMaxBytes + 1024 * 1024
|
|
757
|
+
}));
|
|
758
|
+
|
|
759
|
+
class InvalidSupportScreenshot extends Schema4.TaggedError()("InvalidSupportScreenshot", {}) {
|
|
760
|
+
}
|
|
761
|
+
var readSupportScreenshots = Effect3.fn("Support.readScreenshots")(function* (files) {
|
|
762
|
+
const fs = yield* FileSystem.FileSystem;
|
|
763
|
+
return yield* Effect3.forEach(files, (file, index) => Effect3.gen(function* () {
|
|
764
|
+
const format = screenshotFormats.get(file.contentType);
|
|
765
|
+
if (!format)
|
|
766
|
+
return yield* new InvalidSupportScreenshot;
|
|
767
|
+
const content = yield* fs.readFile(file.path);
|
|
768
|
+
if (!format.signatures.every(([offset, signature]) => signature.every((byte, index) => content[offset + index] === byte))) {
|
|
769
|
+
return yield* new InvalidSupportScreenshot;
|
|
770
|
+
}
|
|
771
|
+
return {
|
|
772
|
+
content,
|
|
773
|
+
contentType: file.contentType,
|
|
774
|
+
filename: `screenshot-${index + 1}.${format.extension}`
|
|
775
|
+
};
|
|
776
|
+
}));
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
// ../../src/components/support/react.tsx
|
|
780
|
+
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
781
|
+
"use client";
|
|
782
|
+
var useSupportFormMessages = (locale, messages) => getSupportFormMessages(useKrakstackLocale(locale), messages);
|
|
783
|
+
var SupportConfirmation = ({
|
|
784
|
+
title,
|
|
785
|
+
description,
|
|
786
|
+
classes
|
|
787
|
+
}) => /* @__PURE__ */ jsxs3("div", {
|
|
788
|
+
role: "status",
|
|
789
|
+
className: classes.confirmation,
|
|
790
|
+
children: [
|
|
791
|
+
/* @__PURE__ */ jsx7("span", {
|
|
792
|
+
className: classes.checkBadge,
|
|
793
|
+
children: /* @__PURE__ */ jsx7(Check, {
|
|
794
|
+
size: 24,
|
|
795
|
+
"aria-hidden": "true"
|
|
796
|
+
})
|
|
797
|
+
}),
|
|
798
|
+
/* @__PURE__ */ jsx7("h2", {
|
|
799
|
+
className: classes.statusTitle,
|
|
800
|
+
children: title
|
|
801
|
+
}),
|
|
802
|
+
description && /* @__PURE__ */ jsx7("p", {
|
|
803
|
+
className: classes.description,
|
|
804
|
+
children: description
|
|
805
|
+
})
|
|
806
|
+
]
|
|
807
|
+
});
|
|
808
|
+
var SupportForm = (props) => /* @__PURE__ */ jsx7(SupportWithSubmit, {
|
|
809
|
+
...props,
|
|
810
|
+
view: "form"
|
|
811
|
+
});
|
|
812
|
+
var SupportFormView = ({
|
|
813
|
+
className,
|
|
814
|
+
classes: classOverrides,
|
|
815
|
+
messages: copy,
|
|
816
|
+
state: { attachments, invalidAttachments, invalidFields, status },
|
|
817
|
+
askForReplyEmail,
|
|
818
|
+
defaultReplyEmail,
|
|
819
|
+
supportEmail,
|
|
820
|
+
showDetails,
|
|
821
|
+
onSubmit,
|
|
822
|
+
onAddScreenshots,
|
|
823
|
+
onRemoveScreenshot
|
|
824
|
+
}) => {
|
|
825
|
+
const classes = resolveSupportClasses(classOverrides);
|
|
826
|
+
const id = useId();
|
|
827
|
+
const fileInput = useRef2(null);
|
|
828
|
+
const directEmail = Schema5.decodeUnknownOption(SupportReplyEmail)(supportEmail);
|
|
829
|
+
const pending = status === "pending";
|
|
830
|
+
const messageError = invalidFields?.includes("message") ? copy.invalidMessage ?? copy.invalid : undefined;
|
|
831
|
+
const emailError = invalidFields?.includes("replyEmail") ? copy.invalidReplyEmail ?? copy.invalid : undefined;
|
|
832
|
+
return /* @__PURE__ */ jsxs3("div", {
|
|
833
|
+
className: cn(classes.form, className),
|
|
834
|
+
children: [
|
|
835
|
+
status === "success" ? /* @__PURE__ */ jsx7(SupportConfirmation, {
|
|
836
|
+
title: copy.success,
|
|
837
|
+
description: copy.successDescription,
|
|
838
|
+
classes
|
|
839
|
+
}) : /* @__PURE__ */ jsxs3("form", {
|
|
840
|
+
noValidate: true,
|
|
841
|
+
className: classes.form,
|
|
842
|
+
onSubmit: (event) => {
|
|
843
|
+
event.preventDefault();
|
|
844
|
+
onSubmit(new FormData(event.currentTarget));
|
|
845
|
+
},
|
|
846
|
+
"aria-busy": pending,
|
|
847
|
+
children: [
|
|
848
|
+
/* @__PURE__ */ jsxs3("fieldset", {
|
|
849
|
+
disabled: pending,
|
|
850
|
+
className: classes.fieldset,
|
|
851
|
+
children: [
|
|
852
|
+
askForReplyEmail !== false && /* @__PURE__ */ jsxs3(Field, {
|
|
853
|
+
children: [
|
|
854
|
+
/* @__PURE__ */ jsxs3(FieldLabel, {
|
|
855
|
+
className: classes.closeAction,
|
|
856
|
+
htmlFor: `${id}-email`,
|
|
857
|
+
children: [
|
|
858
|
+
copy.replyEmail,
|
|
859
|
+
askForReplyEmail !== true && copy.optional && /* @__PURE__ */ jsxs3("span", {
|
|
860
|
+
className: classes.optional,
|
|
861
|
+
children: [
|
|
862
|
+
" (",
|
|
863
|
+
copy.optional,
|
|
864
|
+
")"
|
|
865
|
+
]
|
|
866
|
+
})
|
|
867
|
+
]
|
|
868
|
+
}),
|
|
869
|
+
/* @__PURE__ */ jsx7(Input, {
|
|
870
|
+
id: `${id}-email`,
|
|
871
|
+
type: "email",
|
|
872
|
+
name: "replyEmail",
|
|
873
|
+
"aria-invalid": emailError ? true : undefined,
|
|
874
|
+
"aria-describedby": emailError ? `${id}-email-error` : undefined,
|
|
875
|
+
autoComplete: "email",
|
|
876
|
+
placeholder: copy.replyEmailPlaceholder,
|
|
877
|
+
maxLength: supportReplyEmailLimit,
|
|
878
|
+
defaultValue: defaultReplyEmail,
|
|
879
|
+
required: askForReplyEmail === true
|
|
880
|
+
}),
|
|
881
|
+
/* @__PURE__ */ jsx7(FieldError, {
|
|
882
|
+
id: `${id}-email-error`,
|
|
883
|
+
children: emailError
|
|
884
|
+
})
|
|
885
|
+
]
|
|
886
|
+
}),
|
|
887
|
+
/* @__PURE__ */ jsxs3("div", {
|
|
888
|
+
className: classes.message,
|
|
889
|
+
children: [
|
|
890
|
+
/* @__PURE__ */ jsxs3(Field, {
|
|
891
|
+
children: [
|
|
892
|
+
/* @__PURE__ */ jsx7(Textarea, {
|
|
893
|
+
"aria-label": copy.title,
|
|
894
|
+
"aria-invalid": messageError ? true : undefined,
|
|
895
|
+
"aria-describedby": messageError ? `${id}-message-error` : undefined,
|
|
896
|
+
name: "message",
|
|
897
|
+
rows: 8,
|
|
898
|
+
placeholder: copy.placeholder,
|
|
899
|
+
required: true,
|
|
900
|
+
maxLength: supportMessageLimit,
|
|
901
|
+
onPaste: (event) => {
|
|
902
|
+
const files = Array.from(event.clipboardData.files).filter(({ type }) => type.startsWith("image/"));
|
|
903
|
+
if (!files.length)
|
|
904
|
+
return;
|
|
905
|
+
event.preventDefault();
|
|
906
|
+
onAddScreenshots(files);
|
|
907
|
+
}
|
|
908
|
+
}),
|
|
909
|
+
/* @__PURE__ */ jsx7(FieldError, {
|
|
910
|
+
id: `${id}-message-error`,
|
|
911
|
+
children: messageError
|
|
912
|
+
})
|
|
913
|
+
]
|
|
914
|
+
}),
|
|
915
|
+
/* @__PURE__ */ jsx7("input", {
|
|
916
|
+
ref: fileInput,
|
|
917
|
+
type: "file",
|
|
918
|
+
"aria-label": copy.attach,
|
|
919
|
+
accept: screenshotAccept,
|
|
920
|
+
multiple: true,
|
|
921
|
+
hidden: true,
|
|
922
|
+
onChange: (event) => {
|
|
923
|
+
onAddScreenshots(Array.from(event.currentTarget.files ?? []));
|
|
924
|
+
event.currentTarget.value = "";
|
|
925
|
+
}
|
|
926
|
+
}),
|
|
927
|
+
attachments.length > 0 && /* @__PURE__ */ jsx7("ul", {
|
|
928
|
+
className: classes.attachments,
|
|
929
|
+
children: attachments.map((file, index) => /* @__PURE__ */ jsxs3("li", {
|
|
930
|
+
className: classes.attachment,
|
|
931
|
+
children: [
|
|
932
|
+
/* @__PURE__ */ jsx7("span", {
|
|
933
|
+
className: classes.attachmentMedia,
|
|
934
|
+
children: /* @__PURE__ */ jsx7(Image, {
|
|
935
|
+
size: 14,
|
|
936
|
+
"aria-hidden": "true"
|
|
937
|
+
})
|
|
938
|
+
}),
|
|
939
|
+
/* @__PURE__ */ jsx7("span", {
|
|
940
|
+
className: classes.filename,
|
|
941
|
+
title: file.name,
|
|
942
|
+
children: file.name
|
|
943
|
+
}),
|
|
944
|
+
/* @__PURE__ */ jsx7(Button, {
|
|
945
|
+
variant: "ghost",
|
|
946
|
+
size: "icon-sm",
|
|
947
|
+
className: "size-6",
|
|
948
|
+
type: "button",
|
|
949
|
+
"aria-label": `${copy.removeAttachment}: ${file.name}`,
|
|
950
|
+
onClick: () => onRemoveScreenshot(index),
|
|
951
|
+
children: /* @__PURE__ */ jsx7(X, {
|
|
952
|
+
size: 16,
|
|
953
|
+
"aria-hidden": "true"
|
|
954
|
+
})
|
|
955
|
+
})
|
|
956
|
+
]
|
|
957
|
+
}, index))
|
|
958
|
+
}),
|
|
959
|
+
invalidAttachments && /* @__PURE__ */ jsx7("p", {
|
|
960
|
+
role: "alert",
|
|
961
|
+
className: classes.alert,
|
|
962
|
+
children: copy.invalidAttachments
|
|
963
|
+
})
|
|
964
|
+
]
|
|
965
|
+
}),
|
|
966
|
+
showDetails && /* @__PURE__ */ jsxs3("div", {
|
|
967
|
+
className: classes.details,
|
|
968
|
+
children: [
|
|
969
|
+
/* @__PURE__ */ jsx7("input", {
|
|
970
|
+
type: "checkbox",
|
|
971
|
+
id: `${id}-include-error-details`,
|
|
972
|
+
name: "includeErrorDetails",
|
|
973
|
+
defaultChecked: true,
|
|
974
|
+
disabled: pending
|
|
975
|
+
}),
|
|
976
|
+
/* @__PURE__ */ jsx7("label", {
|
|
977
|
+
htmlFor: `${id}-include-error-details`,
|
|
978
|
+
children: copy.includeErrorDetails
|
|
979
|
+
})
|
|
980
|
+
]
|
|
981
|
+
})
|
|
982
|
+
]
|
|
983
|
+
}),
|
|
984
|
+
(status === "failed" || status === "invalid" && !messageError && !emailError) && /* @__PURE__ */ jsx7("p", {
|
|
985
|
+
role: "alert",
|
|
986
|
+
className: classes.alert,
|
|
987
|
+
children: status === "invalid" ? copy.invalid : copy.failed
|
|
988
|
+
}),
|
|
989
|
+
/* @__PURE__ */ jsxs3("div", {
|
|
990
|
+
className: classes.actions,
|
|
991
|
+
children: [
|
|
992
|
+
/* @__PURE__ */ jsxs3(Button, {
|
|
993
|
+
type: "button",
|
|
994
|
+
variant: "outline",
|
|
995
|
+
className: classes.attach,
|
|
996
|
+
size: "sm",
|
|
997
|
+
disabled: pending,
|
|
998
|
+
onClick: () => fileInput.current?.click(),
|
|
999
|
+
children: [
|
|
1000
|
+
/* @__PURE__ */ jsx7(Paperclip, {
|
|
1001
|
+
size: 16,
|
|
1002
|
+
"aria-hidden": "true"
|
|
1003
|
+
}),
|
|
1004
|
+
copy.attach
|
|
1005
|
+
]
|
|
1006
|
+
}),
|
|
1007
|
+
/* @__PURE__ */ jsx7(Button, {
|
|
1008
|
+
type: "submit",
|
|
1009
|
+
size: "sm",
|
|
1010
|
+
disabled: pending,
|
|
1011
|
+
children: pending ? copy.pending : copy.submit
|
|
1012
|
+
})
|
|
1013
|
+
]
|
|
1014
|
+
})
|
|
1015
|
+
]
|
|
1016
|
+
}),
|
|
1017
|
+
status !== "success" && directEmail._tag === "Some" && /* @__PURE__ */ jsxs3("p", {
|
|
1018
|
+
className: classes.description,
|
|
1019
|
+
children: [
|
|
1020
|
+
copy.directEmail,
|
|
1021
|
+
" ",
|
|
1022
|
+
/* @__PURE__ */ jsx7("a", {
|
|
1023
|
+
className: classes.link,
|
|
1024
|
+
href: `mailto:${encodeURIComponent(directEmail.value).replace(/%40/g, "@")}`,
|
|
1025
|
+
children: directEmail.value
|
|
1026
|
+
})
|
|
1027
|
+
]
|
|
1028
|
+
})
|
|
1029
|
+
]
|
|
1030
|
+
});
|
|
1031
|
+
};
|
|
1032
|
+
var SupportPage = (props) => /* @__PURE__ */ jsx7(SupportWithSubmit, {
|
|
1033
|
+
...props,
|
|
1034
|
+
view: "page"
|
|
1035
|
+
});
|
|
1036
|
+
var SupportPageView = ({
|
|
1037
|
+
className,
|
|
1038
|
+
classes: classOverrides,
|
|
1039
|
+
messages: { title, description },
|
|
1040
|
+
children
|
|
1041
|
+
}) => {
|
|
1042
|
+
const classes = resolveSupportClasses(classOverrides);
|
|
1043
|
+
const titleId = useId();
|
|
1044
|
+
return /* @__PURE__ */ jsxs3("section", {
|
|
1045
|
+
"aria-labelledby": titleId,
|
|
1046
|
+
className: cn(classes.page, className),
|
|
1047
|
+
children: [
|
|
1048
|
+
/* @__PURE__ */ jsxs3("header", {
|
|
1049
|
+
className: classes.pageHeader,
|
|
1050
|
+
children: [
|
|
1051
|
+
/* @__PURE__ */ jsx7("h1", {
|
|
1052
|
+
id: titleId,
|
|
1053
|
+
className: classes.pageTitle,
|
|
1054
|
+
children: title
|
|
1055
|
+
}),
|
|
1056
|
+
description && /* @__PURE__ */ jsx7("p", {
|
|
1057
|
+
className: classes.pageDescription,
|
|
1058
|
+
children: description
|
|
1059
|
+
})
|
|
1060
|
+
]
|
|
1061
|
+
}),
|
|
1062
|
+
children
|
|
1063
|
+
]
|
|
1064
|
+
});
|
|
1065
|
+
};
|
|
1066
|
+
var SupportDialog = (props) => /* @__PURE__ */ jsx7(SupportWithSubmit, {
|
|
1067
|
+
...props,
|
|
1068
|
+
view: "dialog"
|
|
1069
|
+
});
|
|
1070
|
+
var SupportWithSubmit = ({
|
|
1071
|
+
className,
|
|
1072
|
+
classes,
|
|
1073
|
+
view,
|
|
1074
|
+
trigger,
|
|
1075
|
+
locale,
|
|
1076
|
+
messages,
|
|
1077
|
+
askForReplyEmail,
|
|
1078
|
+
supportEmail,
|
|
1079
|
+
defaultReplyEmail,
|
|
1080
|
+
errorDetails,
|
|
1081
|
+
onSubmit
|
|
1082
|
+
}) => {
|
|
1083
|
+
const copy = useSupportFormMessages(locale, messages);
|
|
1084
|
+
const [submission] = useState2(() => {
|
|
1085
|
+
let submit = onSubmit;
|
|
1086
|
+
const component = SupportDialogModel.pipe(Component2.provide(SendSupport.layerFromSubmit((request) => submit(request))));
|
|
1087
|
+
return {
|
|
1088
|
+
component,
|
|
1089
|
+
setSubmit: (next) => {
|
|
1090
|
+
submit = next;
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
});
|
|
1094
|
+
useLayoutEffect2(() => {
|
|
1095
|
+
submission.setSubmit(onSubmit);
|
|
1096
|
+
}, [onSubmit, submission]);
|
|
1097
|
+
return /* @__PURE__ */ jsx7(SupportModelView, {
|
|
1098
|
+
config: SupportProps.make({
|
|
1099
|
+
className,
|
|
1100
|
+
classes,
|
|
1101
|
+
messages: copy,
|
|
1102
|
+
inline: view !== "dialog",
|
|
1103
|
+
askForReplyEmail,
|
|
1104
|
+
supportEmail,
|
|
1105
|
+
defaultReplyEmail: defaultReplyEmail === undefined ? undefined : Redacted2.make(defaultReplyEmail),
|
|
1106
|
+
errorDetails: errorDetails === undefined ? undefined : Redacted2.make(errorDetails)
|
|
1107
|
+
}),
|
|
1108
|
+
component: submission.component,
|
|
1109
|
+
view,
|
|
1110
|
+
trigger
|
|
1111
|
+
});
|
|
1112
|
+
};
|
|
1113
|
+
var SupportDialogView = ({
|
|
1114
|
+
className,
|
|
1115
|
+
classes,
|
|
1116
|
+
messages: copy,
|
|
1117
|
+
trigger,
|
|
1118
|
+
open,
|
|
1119
|
+
pending,
|
|
1120
|
+
sent,
|
|
1121
|
+
onOpenChange,
|
|
1122
|
+
children
|
|
1123
|
+
}) => {
|
|
1124
|
+
return /* @__PURE__ */ jsxs3(Dialog, {
|
|
1125
|
+
open,
|
|
1126
|
+
onOpenChange: (next, event) => {
|
|
1127
|
+
if (!next && pending || onOpenChange(next) === false)
|
|
1128
|
+
event.cancel();
|
|
1129
|
+
},
|
|
1130
|
+
children: [
|
|
1131
|
+
/* @__PURE__ */ jsx7(DialogTrigger, {
|
|
1132
|
+
render: trigger ?? /* @__PURE__ */ jsx7(Button, {
|
|
1133
|
+
variant: "outline",
|
|
1134
|
+
children: copy.title
|
|
1135
|
+
})
|
|
1136
|
+
}),
|
|
1137
|
+
/* @__PURE__ */ jsxs3(DialogContent, {
|
|
1138
|
+
className,
|
|
1139
|
+
showCloseButton: false,
|
|
1140
|
+
children: [
|
|
1141
|
+
/* @__PURE__ */ jsxs3(DialogHeader, {
|
|
1142
|
+
role: sent ? "status" : undefined,
|
|
1143
|
+
children: [
|
|
1144
|
+
/* @__PURE__ */ jsxs3(DialogTitle, {
|
|
1145
|
+
className: resolveSupportClasses(classes).dialogTitle,
|
|
1146
|
+
children: [
|
|
1147
|
+
sent ? copy.success : copy.title,
|
|
1148
|
+
sent && /* @__PURE__ */ jsx7(Check, {
|
|
1149
|
+
size: 16,
|
|
1150
|
+
"aria-hidden": "true"
|
|
1151
|
+
})
|
|
1152
|
+
]
|
|
1153
|
+
}),
|
|
1154
|
+
(sent ? copy.successDescription : copy.description) && /* @__PURE__ */ jsx7(DialogDescription, {
|
|
1155
|
+
children: sent ? copy.successDescription : copy.description
|
|
1156
|
+
})
|
|
1157
|
+
]
|
|
1158
|
+
}),
|
|
1159
|
+
/* @__PURE__ */ jsx7(DialogClose, {
|
|
1160
|
+
render: /* @__PURE__ */ jsx7(Button, {
|
|
1161
|
+
variant: "ghost",
|
|
1162
|
+
size: "icon-sm",
|
|
1163
|
+
className: "absolute end-4 top-4",
|
|
1164
|
+
disabled: pending,
|
|
1165
|
+
"aria-label": copy.close
|
|
1166
|
+
}),
|
|
1167
|
+
children: /* @__PURE__ */ jsx7(X, {
|
|
1168
|
+
size: 16,
|
|
1169
|
+
"aria-hidden": "true"
|
|
1170
|
+
})
|
|
1171
|
+
}),
|
|
1172
|
+
!sent && children
|
|
1173
|
+
]
|
|
1174
|
+
})
|
|
1175
|
+
]
|
|
1176
|
+
});
|
|
1177
|
+
};
|
|
1178
|
+
var SupportDialogReact = ({
|
|
1179
|
+
config,
|
|
1180
|
+
component
|
|
1181
|
+
}) => /* @__PURE__ */ jsx7(SupportModelView, {
|
|
1182
|
+
config,
|
|
1183
|
+
component,
|
|
1184
|
+
view: config.inline ? "page" : "dialog"
|
|
1185
|
+
});
|
|
1186
|
+
var SupportModelView = ({
|
|
1187
|
+
config,
|
|
1188
|
+
component,
|
|
1189
|
+
view,
|
|
1190
|
+
trigger
|
|
1191
|
+
}) => {
|
|
1192
|
+
const { model, send } = useModel(component, config);
|
|
1193
|
+
const { defaultReplyEmail, errorDetails } = config;
|
|
1194
|
+
const messages = config.messages ?? getSupportFormMessages(config.locale);
|
|
1195
|
+
const state = Redacted2.value(model.form);
|
|
1196
|
+
const form = /* @__PURE__ */ jsx7(SupportFormView, {
|
|
1197
|
+
className: view === "form" ? config.className : undefined,
|
|
1198
|
+
classes: config.classes,
|
|
1199
|
+
messages,
|
|
1200
|
+
state,
|
|
1201
|
+
askForReplyEmail: config.askForReplyEmail,
|
|
1202
|
+
defaultReplyEmail: defaultReplyEmail && Redacted2.value(defaultReplyEmail),
|
|
1203
|
+
supportEmail: config.supportEmail,
|
|
1204
|
+
showDetails: Boolean(supportDiagnostics(errorDetails && Redacted2.value(errorDetails))),
|
|
1205
|
+
onSubmit: (fields) => send(SupportMessage2.SubmittedForm({
|
|
1206
|
+
fields: Redacted2.make({
|
|
1207
|
+
message: readTextField(fields, "message") ?? "",
|
|
1208
|
+
replyEmail: readTextField(fields, "replyEmail"),
|
|
1209
|
+
includeErrorDetails: fields.has("includeErrorDetails")
|
|
1210
|
+
})
|
|
1211
|
+
})),
|
|
1212
|
+
onAddScreenshots: (files) => send(SupportMessage2.AddedScreenshots({ files: Redacted2.make(files) })),
|
|
1213
|
+
onRemoveScreenshot: (index) => send(SupportMessage2.RemovedScreenshot({ index }))
|
|
1214
|
+
});
|
|
1215
|
+
if (view === "form")
|
|
1216
|
+
return form;
|
|
1217
|
+
if (view === "page")
|
|
1218
|
+
return /* @__PURE__ */ jsx7(SupportPageView, {
|
|
1219
|
+
className: config.className,
|
|
1220
|
+
classes: config.classes,
|
|
1221
|
+
messages,
|
|
1222
|
+
children: form
|
|
1223
|
+
});
|
|
1224
|
+
return /* @__PURE__ */ jsx7(SupportDialogView, {
|
|
1225
|
+
className: config.className,
|
|
1226
|
+
classes: config.classes,
|
|
1227
|
+
messages,
|
|
1228
|
+
trigger,
|
|
1229
|
+
open: model.open,
|
|
1230
|
+
pending: state.status === "pending",
|
|
1231
|
+
sent: state.status === "success",
|
|
1232
|
+
onOpenChange: (open) => send(open ? SupportMessage2.RequestedOpen() : SupportMessage2.RequestedClose()),
|
|
1233
|
+
children: form
|
|
1234
|
+
});
|
|
1235
|
+
};
|
|
1236
|
+
var decodeTextField = Schema5.decodeUnknownOption(Schema5.String);
|
|
1237
|
+
var readTextField = (fields, name) => Option.getOrUndefined(decodeTextField(fields.get(name)));
|
|
1238
|
+
export {
|
|
1239
|
+
InvalidSupportScreenshot,
|
|
1240
|
+
SupportDialog,
|
|
1241
|
+
SupportDialogReact,
|
|
1242
|
+
SupportDialogView,
|
|
1243
|
+
SupportForm,
|
|
1244
|
+
SupportFormView,
|
|
1245
|
+
SupportMultipartPayload,
|
|
1246
|
+
SupportPage,
|
|
1247
|
+
SupportPageView,
|
|
1248
|
+
SupportReplyEmail,
|
|
1249
|
+
SupportRequestSchema,
|
|
1250
|
+
getSupportFormMessages,
|
|
1251
|
+
readSupportScreenshots
|
|
1252
|
+
};
|