@seamly/web-ui 20.8.1 → 21.0.1-beta.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/build/dist/lib/components.js +14855 -20
- package/build/dist/lib/components.min.js +2 -1
- package/build/dist/lib/components.min.js.LICENSE.txt +48 -0
- package/build/dist/lib/config.js +9 -3
- package/build/dist/lib/config.min.js +1 -1
- package/build/dist/lib/contexts.js +14 -5
- package/build/dist/lib/contexts.min.js +1 -1
- package/build/dist/lib/deprecated-view.js +1 -1
- package/build/dist/lib/hooks.js +8446 -20
- package/build/dist/lib/hooks.min.js +2 -1
- package/build/dist/lib/hooks.min.js.LICENSE.txt +38 -0
- package/build/dist/lib/index.debug.js +585 -584
- package/build/dist/lib/index.debug.min.js +1 -1
- package/build/dist/lib/index.debug.min.js.LICENSE.txt +110 -110
- package/build/dist/lib/index.js +20279 -26454
- package/build/dist/lib/index.min.js +1 -1
- package/build/dist/lib/index.min.js.LICENSE.txt +6 -1
- package/build/dist/lib/standalone.js +27823 -34681
- package/build/dist/lib/standalone.min.js +1 -1
- package/build/dist/lib/standalone.min.js.LICENSE.txt +1 -1
- package/build/dist/lib/storage.js +6 -15
- package/build/dist/lib/style-guide.js +23181 -7921
- package/build/dist/lib/style-guide.min.js +1 -1
- package/build/dist/lib/style-guide.min.js.LICENSE.txt +10 -0
- package/build/dist/lib/styles-default-implementation.js +1 -1
- package/build/dist/lib/styles.js +1 -1
- package/build/dist/lib/utils.js +22149 -17
- package/build/dist/lib/utils.min.js +2 -1
- package/build/dist/lib/utils.min.js.LICENSE.txt +48 -0
- package/package.json +54 -52
- package/src/icons/icon_check-16.svg +14 -0
- package/src/icons/icon_check-32.svg +14 -0
- package/src/javascripts/api/conversation-connector.ts +149 -0
- package/src/javascripts/api/errors/seamly-base-error.js +19 -0
- package/src/javascripts/api/errors/seamly-unavailable-error.js +5 -7
- package/src/javascripts/api/{index.js → index.ts} +163 -116
- package/src/javascripts/config.types.ts +5 -4
- package/src/javascripts/domains/app/actions.ts +47 -46
- package/src/javascripts/domains/app/hooks.js +1 -1
- package/src/javascripts/domains/config/actions.ts +2 -8
- package/src/javascripts/domains/config/hooks.ts +1 -1
- package/src/javascripts/domains/config/selectors.ts +6 -6
- package/src/javascripts/domains/config/slice.ts +3 -3
- package/src/javascripts/domains/errors/index.ts +66 -0
- package/src/javascripts/domains/forms/context.ts +1 -1
- package/src/javascripts/domains/forms/forms.types.ts +3 -3
- package/src/javascripts/domains/forms/hooks.ts +10 -10
- package/src/javascripts/domains/forms/provider.tsx +9 -9
- package/src/javascripts/domains/i18n/actions.ts +11 -5
- package/src/javascripts/domains/i18n/hooks.ts +11 -8
- package/src/javascripts/domains/i18n/selectors.ts +10 -4
- package/src/javascripts/domains/i18n/slice.ts +0 -1
- package/src/javascripts/domains/interrupt/hooks.ts +1 -1
- package/src/javascripts/domains/interrupt/middleware.ts +1 -1
- package/src/javascripts/domains/store/index.ts +1 -1
- package/src/javascripts/domains/store/selectors.ts +16 -0
- package/src/javascripts/domains/store/slice.ts +47 -41
- package/src/javascripts/domains/store/store.types.ts +38 -10
- package/src/javascripts/domains/translations/components/{options-button.js → options-button.tsx} +30 -20
- package/src/javascripts/domains/translations/components/options-dialog/index.tsx +33 -0
- package/src/javascripts/domains/translations/components/options-dialog/translation-option.tsx +42 -0
- package/src/javascripts/domains/translations/components/options-dialog/translation-options.tsx +81 -0
- package/src/javascripts/domains/translations/components/translation-status.tsx +15 -0
- package/src/javascripts/domains/translations/hooks.ts +77 -11
- package/src/javascripts/domains/translations/slice.ts +20 -9
- package/src/javascripts/domains/translations/translations.types.ts +4 -2
- package/src/javascripts/domains/visibility/actions.ts +6 -10
- package/src/javascripts/domains/visibility/hooks.ts +33 -14
- package/src/javascripts/domains/visibility/selectors.ts +3 -2
- package/src/javascripts/domains/visibility/slice.ts +2 -6
- package/src/javascripts/index.ts +18 -22
- package/src/javascripts/lib/engine/{index.js → index.tsx} +25 -7
- package/src/javascripts/lib/url-helpers.ts +112 -0
- package/src/javascripts/package/components.js +15 -1
- package/src/javascripts/package/config.js +1 -1
- package/src/javascripts/package/contexts.js +5 -3
- package/src/javascripts/package/hooks.js +19 -1
- package/src/javascripts/package/utils.js +13 -3
- package/src/javascripts/schema.ts +28 -0
- package/src/javascripts/style-guide/components/app.js +16 -12
- package/src/javascripts/style-guide/components/links.js +6 -6
- package/src/javascripts/style-guide/components/static-core.js +14 -9
- package/src/javascripts/style-guide/components/view.js +2 -2
- package/src/javascripts/style-guide/states.js +132 -36
- package/src/javascripts/style-guide/style-guide-engine.js +2 -1
- package/src/javascripts/style-guide/style-guide-external-api.js +1 -1
- package/src/javascripts/ui/components/app-options/index.js +25 -6
- package/src/javascripts/ui/components/chat-app.js +1 -1
- package/src/javascripts/ui/components/chat-status/chat-status-action.tsx +30 -0
- package/src/javascripts/ui/components/chat-status/index.tsx +61 -0
- package/src/javascripts/ui/components/conversation/component-filter.js +9 -9
- package/src/javascripts/ui/components/conversation/{conversation.js → conversation.tsx} +32 -41
- package/src/javascripts/ui/components/conversation/event/card-component.js +2 -2
- package/src/javascripts/ui/components/conversation/event/card-message.js +1 -1
- package/src/javascripts/ui/components/conversation/event/carousel-component/components/controls.js +2 -2
- package/src/javascripts/ui/components/conversation/event/carousel-component/index.js +4 -4
- package/src/javascripts/ui/components/conversation/event/carousel-message/components/slide.js +2 -2
- package/src/javascripts/ui/components/conversation/event/carousel-message/index.js +1 -1
- package/src/javascripts/ui/components/conversation/event/chat-scroll/chat-scroll-context.ts +12 -0
- package/src/javascripts/ui/components/conversation/event/chat-scroll/chat-scroll-provider.tsx +46 -0
- package/src/javascripts/ui/components/conversation/event/chat-scroll/unread-messages-button.tsx +30 -0
- package/src/javascripts/ui/components/conversation/event/choice-prompt.js +12 -8
- package/src/javascripts/ui/components/conversation/event/conversation-suggestions.js +6 -6
- package/src/javascripts/ui/components/conversation/event/cta.js +2 -2
- package/src/javascripts/ui/components/conversation/event/divider/index.js +0 -1
- package/src/javascripts/ui/components/conversation/event/divider/variants/default.js +1 -1
- package/src/javascripts/ui/components/conversation/event/divider/variants/new-translation.js +17 -22
- package/src/javascripts/ui/components/conversation/event/divider/variants/time-indicator.js +2 -2
- package/src/javascripts/ui/components/conversation/event/event-participant.js +1 -1
- package/src/javascripts/ui/components/conversation/event/event.tsx +66 -0
- package/src/javascripts/ui/components/conversation/event/hooks/use-event-link-click-handler.js +1 -1
- package/src/javascripts/ui/components/conversation/event/hooks/use-formatted-date.js +1 -1
- package/src/javascripts/ui/components/conversation/event/image-lightbox.js +1 -1
- package/src/javascripts/ui/components/conversation/event/image.js +2 -2
- package/src/javascripts/ui/components/conversation/event/splash.js +1 -1
- package/src/javascripts/ui/components/conversation/event/translation.js +1 -1
- package/src/javascripts/ui/components/conversation/event/upload.js +2 -2
- package/src/javascripts/ui/components/conversation/event/video.js +2 -2
- package/src/javascripts/ui/components/conversation/event-divider.js +1 -1
- package/src/javascripts/ui/components/conversation/message-container.js +1 -1
- package/src/javascripts/ui/components/conversation/use-chat-scroll.ts +108 -0
- package/src/javascripts/ui/components/core/{seamly-activity-monitor.js → seamly-activity-monitor.tsx} +12 -5
- package/src/javascripts/ui/components/core/seamly-api-context.ts +7 -0
- package/src/javascripts/ui/components/core/seamly-chat.tsx +8 -0
- package/src/javascripts/ui/components/core/{seamly-core.js → seamly-core.tsx} +27 -14
- package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +340 -0
- package/src/javascripts/ui/components/core/seamly-file-upload.js +2 -2
- package/src/javascripts/ui/components/core/seamly-idle-detach-counter.js +1 -1
- package/src/javascripts/ui/components/core/seamly-instance-functions-loader.js +24 -11
- package/src/javascripts/ui/components/core/seamly-live-region.js +4 -4
- package/src/javascripts/ui/components/core/seamly-new-notifications.js +3 -3
- package/src/javascripts/ui/components/core/seamly-read-state.js +2 -33
- package/src/javascripts/ui/components/entry/deprecated-toggle-button.js +4 -4
- package/src/javascripts/ui/components/entry/entry-container.js +8 -8
- package/src/javascripts/ui/components/entry/text-entry/hooks.js +3 -3
- package/src/javascripts/ui/components/entry/text-entry/index.js +3 -3
- package/src/javascripts/ui/components/entry/text-entry/text-entry-form.js +4 -4
- package/src/javascripts/ui/components/entry/upload/file-upload-form.js +3 -3
- package/src/javascripts/ui/components/entry/upload/index.js +5 -5
- package/src/javascripts/ui/components/entry/upload-toggle.js +6 -6
- package/src/javascripts/ui/components/faq/faq.js +14 -14
- package/src/javascripts/ui/components/form-controls/error.js +2 -2
- package/src/javascripts/ui/components/form-controls/file-input.js +3 -3
- package/src/javascripts/ui/components/layout/agent-info.js +3 -3
- package/src/javascripts/ui/components/layout/chat-frame.js +20 -12
- package/src/javascripts/ui/components/layout/chat.js +5 -5
- package/src/javascripts/ui/components/layout/deprecated-app-frame.js +6 -6
- package/src/javascripts/ui/components/layout/deprecated-chat-frame.js +34 -0
- package/src/javascripts/ui/components/layout/header.js +2 -2
- package/src/javascripts/ui/components/layout/icon.js +11 -9
- package/src/javascripts/ui/components/layout/interrupt.js +7 -5
- package/src/javascripts/ui/components/layout/pre-chat-messages.js +1 -1
- package/src/javascripts/ui/components/layout/privacy-disclaimer.js +2 -2
- package/src/javascripts/ui/components/options/options-button.js +5 -5
- package/src/javascripts/ui/components/options/{options-frame.js → options-frame.tsx} +52 -18
- package/src/javascripts/ui/components/options/transcript/index.js +9 -10
- package/src/javascripts/ui/components/options/transcript/transcript-form.js +2 -2
- package/src/javascripts/ui/components/suggestions/index.js +8 -8
- package/src/javascripts/ui/components/suggestions/suggestions-item.js +1 -1
- package/src/javascripts/{domains/translations/components/chat-status.js → ui/components/translation-chat-status/index.tsx} +13 -14
- package/src/javascripts/ui/components/translation-proposal/index.tsx +36 -0
- package/src/javascripts/ui/components/view/app-view.js +2 -7
- package/src/javascripts/ui/components/view/deprecated-view.js +8 -10
- package/src/javascripts/ui/components/view/index.js +6 -6
- package/src/javascripts/ui/components/view/inline-view.js +4 -8
- package/src/javascripts/ui/components/view/window-view/collapse-button.js +2 -2
- package/src/javascripts/ui/components/view/window-view/index.js +11 -17
- package/src/javascripts/ui/components/view/window-view/window-open-button.js +6 -6
- package/src/javascripts/ui/components/warnings/idle-detach-warning.js +3 -3
- package/src/javascripts/ui/components/warnings/prompt.js +1 -1
- package/src/javascripts/ui/components/warnings/resume-conversation-prompt.js +4 -4
- package/src/javascripts/ui/components/widgets/in-out-transition.js +20 -18
- package/src/javascripts/ui/components/widgets/lightbox.js +3 -3
- package/src/javascripts/ui/components/widgets/modal.js +2 -2
- package/src/javascripts/ui/components/widgets/upload-progress.js +2 -2
- package/src/javascripts/ui/hooks/file-upload-hooks.js +1 -1
- package/src/javascripts/ui/hooks/focus-helper-hooks.js +1 -1
- package/src/javascripts/ui/hooks/seamly-entry-hooks.js +6 -6
- package/src/javascripts/ui/hooks/seamly-hooks.js +11 -10
- package/src/javascripts/ui/hooks/seamly-option-hooks.js +6 -6
- package/src/javascripts/ui/hooks/{seamly-state-hooks.js → seamly-state-hooks.ts} +9 -6
- package/src/javascripts/ui/hooks/use-click-outside.ts +29 -0
- package/src/javascripts/ui/hooks/use-event-component-mapping.js +11 -10
- package/src/javascripts/ui/hooks/use-interval.js +1 -1
- package/src/javascripts/ui/hooks/use-seamly-actions.ts +29 -29
- package/src/javascripts/ui/hooks/use-seamly-chat.js +14 -24
- package/src/javascripts/ui/hooks/use-seamly-commands.js +20 -15
- package/src/javascripts/ui/hooks/use-seamly-idle-detach-countdown.js +8 -8
- package/src/javascripts/ui/hooks/use-seamly-resume-conversation-prompt.js +2 -2
- package/src/javascripts/ui/hooks/use-single-file-upload.js +1 -1
- package/src/javascripts/ui/hooks/utility-hooks.js +1 -1
- package/src/javascripts/ui/utils/general-utils.js +0 -23
- package/src/javascripts/ui/utils/seamly-utils.ts +10 -1
- package/src/javascripts/ui/utils/seamly-utils.types.ts +9 -0
- package/src/stylesheets/1-settings/_config.scss +1 -1
- package/src/stylesheets/3-chat/_chat.scss +24 -9
- package/src/stylesheets/5-components/_chat-status.scss +72 -16
- package/src/stylesheets/5-components/_conversation.scss +35 -1
- package/src/stylesheets/5-components/_disclaimer.scss +0 -5
- package/src/stylesheets/5-components/_options.scss +16 -6
- package/src/stylesheets/5-components/_translation-options.scss +51 -0
- package/src/stylesheets/6-default-implementation/_scrollbar.scss +1 -1
- package/src/stylesheets/7-deprecated/3-app/_app.scss +19 -4
- package/src/stylesheets/7-deprecated/5-components/_chat-status.scss +5 -0
- package/src/stylesheets/7-deprecated/5-components/_options.scss +1 -4
- package/src/stylesheets/7-deprecated/5-components/_translation-options.scss +49 -0
- package/src/stylesheets/deprecated-view.scss +1 -0
- package/src/stylesheets/styles.scss +1 -0
- package/webpack/config.common.js +4 -4
- package/webpack/config.package.js +10 -16
- package/webpack/config.site.js +4 -1
- package/webpack/config.test.js +2 -1
- package/build/dist/lib/deprecated-view.css +0 -1
- package/build/dist/lib/styles-default-implementation.css +0 -1
- package/build/dist/lib/styles.css +0 -1
- package/src/.DS_Store +0 -0
- package/src/javascripts/api/event-producer.js +0 -20
- package/src/javascripts/api/producer.js +0 -136
- package/src/javascripts/domains/errors/index.js +0 -37
- package/src/javascripts/domains/translations/components/options-dialog/form.js +0 -70
- package/src/javascripts/domains/translations/components/options-dialog/index.js +0 -87
- package/src/javascripts/ui/components/chat-status/index.js +0 -38
- package/src/javascripts/ui/components/conversation/event/event.js +0 -36
- package/src/javascripts/ui/components/core/seamly-api-context.js +0 -5
- package/src/javascripts/ui/components/core/seamly-event-subscriber.js +0 -279
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* focus-trap 7.1.0
|
|
3
|
+
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*!
|
|
7
|
+
* tabbable 6.0.1
|
|
8
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @license React
|
|
13
|
+
* react-is.production.min.js
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the MIT license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @license React
|
|
23
|
+
* use-sync-external-store-shim.production.min.js
|
|
24
|
+
*
|
|
25
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
26
|
+
*
|
|
27
|
+
* This source code is licensed under the MIT license found in the
|
|
28
|
+
* LICENSE file in the root directory of this source tree.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @license React
|
|
33
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
34
|
+
*
|
|
35
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the MIT license found in the
|
|
38
|
+
* LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/** @license React v16.13.1
|
|
42
|
+
* react-is.production.min.js
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamly/web-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "21.0.1-beta.1",
|
|
4
4
|
"main": "build/dist/lib/index.js",
|
|
5
5
|
"types": "build/src/javascripts/index.d.ts",
|
|
6
6
|
"module": "",
|
|
@@ -22,76 +22,78 @@
|
|
|
22
22
|
"webpack/*"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@reduxjs/toolkit": "^1.8.
|
|
25
|
+
"@reduxjs/toolkit": "^1.8.6",
|
|
26
26
|
"@ultraq/icu-message-formatter": "^0.12.0",
|
|
27
27
|
"deep-keys": "^0.5.0",
|
|
28
|
-
"focus-trap": "^
|
|
28
|
+
"focus-trap": "^7.0.0",
|
|
29
29
|
"include-media": "^1.4.10",
|
|
30
30
|
"js-cookie": "^3.0.1",
|
|
31
|
-
"minivents": "^2.2.
|
|
32
|
-
"phoenix": "1.6.
|
|
33
|
-
"react-redux": "^8.0.
|
|
34
|
-
"superagent": "^
|
|
35
|
-
"xstream": "^11.14.0"
|
|
31
|
+
"minivents": "^2.2.1",
|
|
32
|
+
"phoenix": "1.6.15",
|
|
33
|
+
"react-redux": "^8.0.4",
|
|
34
|
+
"superagent": "^8.0.3"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
|
-
"@babel/core": "^7.
|
|
39
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.
|
|
37
|
+
"@babel/core": "^7.19.6",
|
|
38
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.19.4",
|
|
40
39
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
41
|
-
"@babel/plugin-transform-classes": "^7.
|
|
42
|
-
"@babel/plugin-transform-react-jsx": "^7.
|
|
43
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
44
|
-
"@babel/preset-env": "^7.
|
|
40
|
+
"@babel/plugin-transform-classes": "^7.19.0",
|
|
41
|
+
"@babel/plugin-transform-react-jsx": "^7.19.0",
|
|
42
|
+
"@babel/plugin-transform-runtime": "^7.19.6",
|
|
43
|
+
"@babel/preset-env": "^7.19.4",
|
|
45
44
|
"@babel/preset-react": "^7.18.6",
|
|
46
45
|
"@babel/preset-typescript": "^7.18.6",
|
|
47
|
-
"@babel/runtime-corejs3": "^7.18.
|
|
48
|
-
"@seamly/doc-site": "^
|
|
49
|
-
"@seamly/eslint-config": "^2.
|
|
50
|
-
"@seamly/prettier-config": "^2.
|
|
46
|
+
"@babel/runtime-corejs3": "^7.18.9",
|
|
47
|
+
"@seamly/doc-site": "^2.0.0",
|
|
48
|
+
"@seamly/eslint-config": "^2.3.0",
|
|
49
|
+
"@seamly/prettier-config": "^2.2.0",
|
|
51
50
|
"@seamly/stylelint-config": "^2.0.0",
|
|
52
51
|
"@testing-library/jest-dom": "^5.16.5",
|
|
53
|
-
"@testing-library/preact": "^2.
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
52
|
+
"@testing-library/preact": "^3.2.2",
|
|
53
|
+
"@trivago/prettier-plugin-sort-imports": "^3.4.0",
|
|
54
|
+
"@types/jest": "^27.5.2",
|
|
55
|
+
"@types/phoenix": "^1.5.4",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^5.42.0",
|
|
57
|
+
"@typescript-eslint/parser": "^5.42.0",
|
|
58
|
+
"babel-loader": "^9.0.1",
|
|
59
|
+
"babel-plugin-react-remove-properties": "^0.3.0",
|
|
60
|
+
"copy-webpack-plugin": "^11.0.0",
|
|
60
61
|
"cypress-file-upload": "^5.0.8",
|
|
61
62
|
"cypress-wait-until": "^1.7.2",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
63
|
+
"cypress": "^10.11.0",
|
|
64
|
+
"debug": "^4.3.4",
|
|
64
65
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
65
|
-
"eslint-import-resolver-typescript": "^3.5.
|
|
66
|
+
"eslint-import-resolver-typescript": "^3.5.2",
|
|
66
67
|
"eslint-plugin-cypress": "^2.12.1",
|
|
67
68
|
"eslint-plugin-import": "^2.26.0",
|
|
68
|
-
"eslint-plugin-jest": "^
|
|
69
|
+
"eslint-plugin-jest": "^27.1.3",
|
|
70
|
+
"eslint": "^8.27.0",
|
|
69
71
|
"file-loader": "^6.2.0",
|
|
70
72
|
"glob": "^8.0.3",
|
|
71
|
-
"husky": "^
|
|
73
|
+
"husky": "^8.0.1",
|
|
72
74
|
"ignore-loader": "^0.1.2",
|
|
75
|
+
"jest-environment-jsdom": "^27.5.1",
|
|
73
76
|
"jest": "^27.5.1",
|
|
74
|
-
"mini-css-extract-plugin": "^2.
|
|
77
|
+
"mini-css-extract-plugin": "^2.6.1",
|
|
75
78
|
"postcss": "8",
|
|
76
|
-
"preact": "^10.
|
|
77
|
-
"prettier": "^2.
|
|
79
|
+
"preact": "^10.11.2",
|
|
80
|
+
"prettier": "^2.7.1",
|
|
78
81
|
"raw-loader": "^4.0.2",
|
|
79
82
|
"rimraf": "^3.0.2",
|
|
80
|
-
"sneakpeek-cli": "^0.2.1",
|
|
81
83
|
"start-server-and-test": "^1.14.0",
|
|
82
|
-
"style-loader": "^3.3.
|
|
83
|
-
"stylelint": "14.
|
|
84
|
-
"ts-loader": "^9.
|
|
85
|
-
"typescript": "^4.
|
|
84
|
+
"style-loader": "^3.3.1",
|
|
85
|
+
"stylelint": "^14.14.0",
|
|
86
|
+
"ts-loader": "^9.4.1",
|
|
87
|
+
"typescript": "^4.8.4",
|
|
86
88
|
"url-loader": "^4.1.1",
|
|
87
|
-
"webpack": "^
|
|
88
|
-
"webpack-
|
|
89
|
-
"webpack-
|
|
90
|
-
"webpack-
|
|
91
|
-
"webpack
|
|
89
|
+
"webpack-bundle-analyzer": "^4.7.0",
|
|
90
|
+
"webpack-cli": "^4.10.0",
|
|
91
|
+
"webpack-dev-server": "^4.11.1",
|
|
92
|
+
"webpack-merge": "^5.8.0",
|
|
93
|
+
"webpack": "^5.74.0"
|
|
92
94
|
},
|
|
93
95
|
"peerDependencies": {
|
|
94
|
-
"preact": "10.
|
|
96
|
+
"preact": "^10.11.2"
|
|
95
97
|
},
|
|
96
98
|
"scripts": {
|
|
97
99
|
"build:clean": "rimraf build; mkdir -p build",
|
|
@@ -101,17 +103,18 @@
|
|
|
101
103
|
"server": "webpack serve --node-env=development",
|
|
102
104
|
"server:test": "webpack serve --node-env=development --env build=test",
|
|
103
105
|
"lint:scss": "stylelint \"src/stylesheets/**/*.scss\" --formatter=verbose",
|
|
104
|
-
"lint:js": "eslint
|
|
106
|
+
"lint:js": "yarn run check:eslint && yarn run check:code",
|
|
105
107
|
"lint": "yarn run lint:js && yarn run lint:scss && yarn check:prettier",
|
|
106
|
-
"format:code": "prettier --write \"src/**/*.{js,scss}\"",
|
|
107
|
-
"format:tests": "prettier --write \"tests/**/*.{js,scss}\"",
|
|
108
|
-
"format:public": "prettier --write \"public/**/*.{js,scss,html}\"",
|
|
109
|
-
"format:webpack": "prettier --write \"webpack/**/*.{js,scss}\"",
|
|
108
|
+
"format:code": "yarn run check:eslint --fix && prettier --write \"src/**/*.{js,ts,tsx,scss}\"",
|
|
109
|
+
"format:tests": "prettier --write \"tests/**/*.{js,ts,tsx,scss}\"",
|
|
110
|
+
"format:public": "prettier --write \"public/**/*.{js,ts,tsx,scss,html}\"",
|
|
111
|
+
"format:webpack": "prettier --write \"webpack/**/*.{js,ts,tsx,scss}\"",
|
|
110
112
|
"format": "yarn run format:code && yarn run format:tests && yarn run format:public && yarn run format:webpack",
|
|
111
|
-
"check:code": "prettier --check \"src/**/*.{js,scss}\"",
|
|
113
|
+
"check:code": "prettier --check \"src/**/*.{js,ts,tsx,scss}\"",
|
|
112
114
|
"check:tests": "prettier --check \"tests/**/*.{js,scss}\"",
|
|
113
115
|
"check:public": "prettier --check \"public/**/*.{js,scss,html}\"",
|
|
114
116
|
"check:webpack": "prettier --check \"webpack/**/*.{js,scss,html}\"",
|
|
117
|
+
"check:eslint": "eslint --ext .js,.ts,.tsx src/ webpack/",
|
|
115
118
|
"check:prettier": "yarn run check:code && yarn run check:tests && yarn run check:public && yarn run check:webpack",
|
|
116
119
|
"test": "jest",
|
|
117
120
|
"types:generate": "npx openapi-typescript schema.yaml --output src/javascripts/schema.ts",
|
|
@@ -121,6 +124,5 @@
|
|
|
121
124
|
"test:e2e": "start-server-and-test server:test http-get://localhost:8080/tests/index.js cypress:open",
|
|
122
125
|
"test:e2e:ci": "start-server-and-test server:test http-get://localhost:8080/tests/index.js cypress:run",
|
|
123
126
|
"prepare": "husky install"
|
|
124
|
-
}
|
|
125
|
-
"prettier": "@seamly/prettier-config"
|
|
127
|
+
}
|
|
126
128
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="16px"
|
|
4
|
+
height="16px"
|
|
5
|
+
x="0px"
|
|
6
|
+
y="0px"
|
|
7
|
+
viewBox="0 0 16 16"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
fill="currentColor"
|
|
11
|
+
d="M11.6,4.3l-5,5L4.9,7.5C4.4,7,3.7,7,3.2,7.5l0,0C2.8,8,2.8,8.7,3.2,9.2l1.7,1.7l0,0l0.8,0.8
|
|
12
|
+
c0.5,0.5,1.2,0.5,1.7,0l0.8-0.8l5-5c0.5-0.5,0.5-1.2,0-1.7l0,0C12.8,3.8,12.1,3.8,11.6,4.3z"
|
|
13
|
+
/>
|
|
14
|
+
</svg>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="32px"
|
|
4
|
+
height="32px"
|
|
5
|
+
x="0px"
|
|
6
|
+
y="0px"
|
|
7
|
+
viewBox="0 0 32 32"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
fill="currentColor"
|
|
11
|
+
d="M22.9,9.3l-9.3,9.3l-3.2-3.2c-0.9-0.9-2.3-0.9-3.2,0l0,0c-0.9,0.9-0.9,2.3,0,3.2l3.2,3.2l0,0l1.6,1.6
|
|
12
|
+
c0.9,0.9,2.3,0.9,3.2,0l1.6-1.6l9.3-9.3c0.9-0.9,0.9-2.3,0-3.2l0,0C25.2,8.4,23.7,8.4,22.9,9.3z"
|
|
13
|
+
/>
|
|
14
|
+
</svg>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Channel, Socket } from 'phoenix'
|
|
2
|
+
import { apiVersion } from 'config'
|
|
3
|
+
import debug from 'lib/debug'
|
|
4
|
+
import splitUrlParams from 'lib/split-url-params'
|
|
5
|
+
|
|
6
|
+
const log = debug('seamly')
|
|
7
|
+
|
|
8
|
+
type ConnectionState =
|
|
9
|
+
| 'socket_closed' // Socket is closed.
|
|
10
|
+
| 'channel_closed' // Channel is closed.
|
|
11
|
+
| 'channel_erred' // Errors received from joined channel.
|
|
12
|
+
| 'join_channel_succeeded' // Joined channel succesfully.
|
|
13
|
+
| 'join_channel_erred' // Error on joining channel. This is usefull when you want to restart a chat sessions.
|
|
14
|
+
| 'attach_channel_succeeded' // Attached channel to system.
|
|
15
|
+
export default class ConversationConnector {
|
|
16
|
+
#connectionListeners = []
|
|
17
|
+
|
|
18
|
+
accessToken: string
|
|
19
|
+
|
|
20
|
+
channelName: string
|
|
21
|
+
|
|
22
|
+
channelTopic: string
|
|
23
|
+
|
|
24
|
+
url: string
|
|
25
|
+
|
|
26
|
+
socket: Socket
|
|
27
|
+
|
|
28
|
+
channel: Channel
|
|
29
|
+
|
|
30
|
+
async connect(
|
|
31
|
+
url: string,
|
|
32
|
+
channelName: string,
|
|
33
|
+
channelTopic: string,
|
|
34
|
+
accessToken: string,
|
|
35
|
+
) {
|
|
36
|
+
this.url = url
|
|
37
|
+
|
|
38
|
+
this.accessToken = accessToken
|
|
39
|
+
this.channelName = channelName
|
|
40
|
+
this.channelTopic = channelTopic
|
|
41
|
+
const { url: splittedUrl, params } = splitUrlParams(this.url)
|
|
42
|
+
|
|
43
|
+
this.socket = new Socket(splittedUrl, {
|
|
44
|
+
params: { ...params, v: apiVersion },
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
this.socket.connect()
|
|
48
|
+
|
|
49
|
+
this.channel = this.socket.channel(this.channelTopic, {
|
|
50
|
+
authorization: `Bearer ${this.accessToken}`,
|
|
51
|
+
channelName: this.channelName,
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
this.start()
|
|
55
|
+
|
|
56
|
+
this.socket.onError((err) => {
|
|
57
|
+
log('[SOCKET][ERROR]', err)
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
this.socket.onOpen(() => {
|
|
61
|
+
log('[SOCKET]OPEN')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
this.channel.on('system', (msg) => {
|
|
65
|
+
switch (msg.type) {
|
|
66
|
+
case 'attach_channel_succeeded':
|
|
67
|
+
this.#emitConnectionState('attach_channel_succeeded')
|
|
68
|
+
break
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
this.socket.onClose(() => {
|
|
73
|
+
log('[SOCKET]CLOSE')
|
|
74
|
+
this.#emitConnectionState('socket_closed')
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
this.channel.onClose(() => {
|
|
78
|
+
log('[CHANNEL]CLOSE')
|
|
79
|
+
this.#emitConnectionState('channel_closed')
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
this.channel.onError((msg) => {
|
|
83
|
+
log('[CHANNEL][ERROR]', msg)
|
|
84
|
+
this.#emitConnectionState('channel_erred')
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
this.#listenTo(
|
|
88
|
+
'ack',
|
|
89
|
+
'ui',
|
|
90
|
+
'error',
|
|
91
|
+
'participant',
|
|
92
|
+
'message',
|
|
93
|
+
'service_data',
|
|
94
|
+
'system',
|
|
95
|
+
'info',
|
|
96
|
+
'sync',
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
start() {
|
|
101
|
+
this.channel
|
|
102
|
+
.join()
|
|
103
|
+
.receive('ok', () => {
|
|
104
|
+
log('[CHANNEL][JOIN] OK')
|
|
105
|
+
this.#emitConnectionState('join_channel_succeeded')
|
|
106
|
+
})
|
|
107
|
+
.receive('error', (err) => {
|
|
108
|
+
log('[CHANNEL][JOIN] ERROR', err)
|
|
109
|
+
this.#emitConnectionState('join_channel_erred')
|
|
110
|
+
// @ts-ignore
|
|
111
|
+
this.channel.socket.disconnect()
|
|
112
|
+
})
|
|
113
|
+
.receive('timeout', () => {
|
|
114
|
+
log('[CHANEL][JOIN] Networking issue. Still waiting...')
|
|
115
|
+
})
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
disconnect() {
|
|
119
|
+
this.#connectionListeners = []
|
|
120
|
+
this.channel?.leave()
|
|
121
|
+
this.socket?.remove(this.channel)
|
|
122
|
+
this.socket?.disconnect()
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
#listenTo(...types: string[]) {
|
|
126
|
+
types.forEach((type) => {
|
|
127
|
+
this.channel.on(type, (msg) => {
|
|
128
|
+
log('[RECEIVE]', type, msg)
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// eslint-disable-next-line no-unused-vars
|
|
134
|
+
onConnection(cb: (_payload: ConnectionState) => void) {
|
|
135
|
+
this.#connectionListeners.push(cb)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
#emitConnectionState(payload: ConnectionState) {
|
|
139
|
+
this.#connectionListeners.forEach((cb) => cb(payload))
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
pushToChannel(
|
|
143
|
+
command: string,
|
|
144
|
+
payload: { type: string; error: unknown },
|
|
145
|
+
timeout = 10000,
|
|
146
|
+
) {
|
|
147
|
+
this.channel.push(command, payload, timeout)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
+
function parseOriginalErrMsg(str) {
|
|
2
|
+
try {
|
|
3
|
+
const json = JSON.parse(str)
|
|
4
|
+
return json.error
|
|
5
|
+
} catch (e) {
|
|
6
|
+
return str
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
export default class SeamlyBaseError extends Error {
|
|
11
|
+
action = ''
|
|
12
|
+
|
|
13
|
+
langKey = ''
|
|
14
|
+
|
|
2
15
|
constructor(originalError, ...params) {
|
|
3
16
|
super(...params)
|
|
4
17
|
|
|
@@ -6,11 +19,17 @@ export default class SeamlyBaseError extends Error {
|
|
|
6
19
|
Error.captureStackTrace(this, Object.getPrototypeOf(this))
|
|
7
20
|
}
|
|
8
21
|
this.originalError = originalError
|
|
22
|
+
|
|
9
23
|
if (originalError?.payload) {
|
|
10
24
|
this.originalEvent = originalError
|
|
11
25
|
this.originalError = originalError.payload.error
|
|
12
26
|
this.message = `Event of type ${originalError.payload.type} encountered`
|
|
13
27
|
}
|
|
28
|
+
if (!this.message && originalError?.message) {
|
|
29
|
+
const parsedOriginalMessage = parseOriginalErrMsg(originalError.message)
|
|
30
|
+
this.message = parsedOriginalMessage
|
|
31
|
+
}
|
|
32
|
+
|
|
14
33
|
if (originalError?.error) {
|
|
15
34
|
this.originalError = originalError.error
|
|
16
35
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
+
import SeamlyBaseError from './seamly-base-error'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* This error is used to alert the user that there's a problem with the connection
|
|
3
5
|
* when initialising the application because of a connection issue on either the server
|
|
4
6
|
* or the client side.
|
|
5
7
|
*/
|
|
6
|
-
export default class SeamlyUnavailableError extends
|
|
7
|
-
constructor(params) {
|
|
8
|
-
super(params)
|
|
9
|
-
|
|
10
|
-
if (Error.captureStackTrace) {
|
|
11
|
-
Error.captureStackTrace(this, SeamlyUnavailableError)
|
|
12
|
-
}
|
|
8
|
+
export default class SeamlyUnavailableError extends SeamlyBaseError {
|
|
9
|
+
constructor(originalError, ...params) {
|
|
10
|
+
super(originalError, ...params)
|
|
13
11
|
|
|
14
12
|
this.name = 'SeamlyUnavailableError'
|
|
15
13
|
this.langKey = 'errors.seamlyUnavailable'
|