@seamly/web-ui 21.0.9 → 22.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/build/dist/lib/components.js +9228 -7777
  2. package/build/dist/lib/components.js.map +1 -0
  3. package/build/dist/lib/components.min.js +2 -1
  4. package/build/dist/lib/components.min.js.LICENSE.txt +2 -2
  5. package/build/dist/lib/components.min.js.map +1 -0
  6. package/build/dist/lib/config.js +2 -1
  7. package/build/dist/lib/config.js.map +1 -0
  8. package/build/dist/lib/config.min.js +2 -1
  9. package/build/dist/lib/config.min.js.map +1 -0
  10. package/build/dist/lib/contexts.js +2 -1
  11. package/build/dist/lib/contexts.js.map +1 -0
  12. package/build/dist/lib/contexts.min.js +2 -1
  13. package/build/dist/lib/contexts.min.js.map +1 -0
  14. package/build/dist/lib/deprecated-view.css +1 -1
  15. package/build/dist/lib/deprecated-view.js +1 -1
  16. package/build/dist/lib/hooks.js +6999 -5996
  17. package/build/dist/lib/hooks.js.map +1 -0
  18. package/build/dist/lib/hooks.min.js +2 -1
  19. package/build/dist/lib/hooks.min.js.map +1 -0
  20. package/build/dist/lib/index.debug.js +940 -370
  21. package/build/dist/lib/index.debug.js.map +1 -0
  22. package/build/dist/lib/index.debug.min.js +2 -1
  23. package/build/dist/lib/index.debug.min.js.LICENSE.txt +334 -110
  24. package/build/dist/lib/index.debug.min.js.map +1 -0
  25. package/build/dist/lib/index.js +2810 -5472
  26. package/build/dist/lib/index.js.map +1 -0
  27. package/build/dist/lib/index.min.js +2 -1
  28. package/build/dist/lib/index.min.js.LICENSE.txt +2 -2
  29. package/build/dist/lib/index.min.js.map +1 -0
  30. package/build/dist/lib/sounds/beep.mp3 +0 -0
  31. package/build/dist/lib/standalone.js +10575 -13540
  32. package/build/dist/lib/standalone.js.map +1 -0
  33. package/build/dist/lib/standalone.min.js +2 -1
  34. package/build/dist/lib/standalone.min.js.LICENSE.txt +1 -1
  35. package/build/dist/lib/standalone.min.js.map +1 -0
  36. package/build/dist/lib/storage.js +2 -1
  37. package/build/dist/lib/storage.js.map +1 -0
  38. package/build/dist/lib/storage.min.js +2 -1
  39. package/build/dist/lib/storage.min.js.map +1 -0
  40. package/build/dist/lib/style-guide.js +1701 -5859
  41. package/build/dist/lib/style-guide.js.map +1 -0
  42. package/build/dist/lib/style-guide.min.js +2 -1
  43. package/build/dist/lib/style-guide.min.js.LICENSE.txt +2 -2
  44. package/build/dist/lib/style-guide.min.js.map +1 -0
  45. package/build/dist/lib/styles-default-implementation.css +1 -1
  46. package/build/dist/lib/styles-default-implementation.js +1 -1
  47. package/build/dist/lib/styles.css +1 -1
  48. package/build/dist/lib/styles.js +1 -1
  49. package/build/dist/lib/utils.js +11536 -14530
  50. package/build/dist/lib/utils.js.map +1 -0
  51. package/build/dist/lib/utils.min.js +2 -1
  52. package/build/dist/lib/utils.min.js.LICENSE.txt +1 -6
  53. package/build/dist/lib/utils.min.js.map +1 -0
  54. package/package.json +58 -48
  55. package/src/javascripts/api/conversation-connector.ts +2 -0
  56. package/src/javascripts/api/errors/seamly-api-error.ts +15 -0
  57. package/src/javascripts/api/index.ts +168 -94
  58. package/src/javascripts/config.ts +1 -1
  59. package/src/javascripts/config.types.ts +18 -11
  60. package/src/javascripts/domains/config/selectors.ts +1 -1
  61. package/src/javascripts/domains/config/slice.ts +12 -0
  62. package/src/javascripts/domains/forms/forms.types.ts +1 -0
  63. package/src/javascripts/domains/forms/hooks.ts +10 -2
  64. package/src/javascripts/domains/store/selectors.ts +23 -10
  65. package/src/javascripts/domains/store/slice.ts +63 -11
  66. package/src/javascripts/domains/store/store.types.ts +41 -1
  67. package/src/javascripts/domains/translations/components/options-button.tsx +1 -4
  68. package/src/javascripts/domains/translations/hooks.ts +11 -4
  69. package/src/javascripts/index.ts +2 -0
  70. package/src/javascripts/lib/url-helpers.ts +24 -0
  71. package/src/javascripts/schema.ts +10 -0
  72. package/src/javascripts/style-guide/states.js +109 -0
  73. package/src/javascripts/ui/components/conversation/conversation.tsx +2 -0
  74. package/src/javascripts/ui/components/conversation/event/chat-scroll/chat-scroll-provider.tsx +2 -0
  75. package/src/javascripts/ui/components/conversation/event/choice-prompt.js +1 -1
  76. package/src/javascripts/ui/components/conversation/event/text.js +1 -1
  77. package/src/javascripts/ui/components/conversation/event/upload.js +50 -9
  78. package/src/javascripts/ui/components/conversation/use-chat-scroll.ts +3 -2
  79. package/src/javascripts/ui/components/core/seamly-event-subscriber.ts +7 -1
  80. package/src/javascripts/ui/components/core/seamly-file-upload.tsx +156 -0
  81. package/src/javascripts/ui/components/entry/abort-transaction-button/abort-transaction-button.tsx +45 -0
  82. package/src/javascripts/ui/components/entry/text-entry/hooks.ts +108 -0
  83. package/src/javascripts/ui/components/entry/text-entry/index.js +7 -4
  84. package/src/javascripts/ui/components/entry/text-entry/{text-entry-form.js → text-entry-form.tsx} +8 -22
  85. package/src/javascripts/ui/components/form-controls/{input.js → input.tsx} +13 -2
  86. package/src/javascripts/ui/components/form-controls/{wrapper.js → wrapper.tsx} +8 -4
  87. package/src/javascripts/ui/components/view/{index.js → index.tsx} +53 -4
  88. package/src/javascripts/ui/components/view/window-view/{index.js → index.tsx} +14 -2
  89. package/src/javascripts/ui/components/widgets/{in-out-transition.js → in-out-transition.tsx} +67 -28
  90. package/src/javascripts/ui/hooks/{seamly-api-hooks.js → seamly-api-hooks.ts} +1 -1
  91. package/src/javascripts/ui/hooks/sounds/beep.mp3 +0 -0
  92. package/src/javascripts/ui/hooks/use-click-outside.ts +5 -3
  93. package/src/javascripts/ui/hooks/use-notifications.ts +114 -0
  94. package/src/javascripts/ui/hooks/use-timeout.ts +20 -0
  95. package/src/stylesheets/3-chat/_chat.scss +3 -5
  96. package/src/stylesheets/4-base/_formelements.scss +0 -36
  97. package/src/stylesheets/5-components/_abort-transaction.scss +10 -0
  98. package/src/stylesheets/5-components/_buttons.scss +18 -3
  99. package/src/stylesheets/5-components/_character-limit.scss +2 -2
  100. package/src/stylesheets/5-components/_chat-status.scss +26 -37
  101. package/src/stylesheets/5-components/_choice-prompt.scss +9 -10
  102. package/src/stylesheets/5-components/_conversation.scss +9 -62
  103. package/src/stylesheets/5-components/_disclaimer.scss +11 -3
  104. package/src/stylesheets/5-components/_error.scss +3 -2
  105. package/src/stylesheets/5-components/_idle.scss +3 -8
  106. package/src/stylesheets/5-components/_input.scss +34 -13
  107. package/src/stylesheets/5-components/_interrupt.scss +3 -10
  108. package/src/stylesheets/5-components/_loader.scss +1 -2
  109. package/src/stylesheets/5-components/_message-author.scss +2 -4
  110. package/src/stylesheets/5-components/_message-body.scss +33 -10
  111. package/src/stylesheets/5-components/_message-card.scss +2 -10
  112. package/src/stylesheets/5-components/_message-carousel.scss +4 -4
  113. package/src/stylesheets/5-components/_message-cta.scss +0 -6
  114. package/src/stylesheets/5-components/_message.scss +1 -0
  115. package/src/stylesheets/5-components/_modal.scss +2 -5
  116. package/src/stylesheets/5-components/_options.scss +17 -22
  117. package/src/stylesheets/5-components/_pre-chat-messages.scss +3 -1
  118. package/src/stylesheets/5-components/_prompt.scss +3 -7
  119. package/src/stylesheets/5-components/_skip-link.scss +2 -1
  120. package/src/stylesheets/5-components/_suggestions.scss +2 -2
  121. package/src/stylesheets/5-components/_translation-options.scss +5 -2
  122. package/src/stylesheets/5-components/_unread-messages.scss +33 -0
  123. package/src/stylesheets/5-components/_upload.scss +20 -27
  124. package/src/stylesheets/6-default-implementation/_hover.scss +14 -17
  125. package/src/stylesheets/7-deprecated/1-settings/_config.scss +17 -0
  126. package/src/stylesheets/7-deprecated/3-app/_app.scss +2 -1
  127. package/src/stylesheets/7-deprecated/5-components/_card.scss +1 -0
  128. package/src/stylesheets/7-deprecated/5-components/_chat-status.scss +66 -20
  129. package/src/stylesheets/7-deprecated/5-components/_conversation.scss +1 -4
  130. package/src/stylesheets/7-deprecated/5-components/_input.scss +6 -1
  131. package/src/stylesheets/7-deprecated/5-components/_interrupt.scss +1 -4
  132. package/src/stylesheets/7-deprecated/5-components/_message.scss +49 -12
  133. package/src/stylesheets/7-deprecated/5-components/_translation-options.scss +30 -37
  134. package/src/stylesheets/7-deprecated/5-components/_unread-messages.scss +38 -0
  135. package/src/stylesheets/deprecated-view.scss +1 -0
  136. package/src/stylesheets/styles.scss +2 -0
  137. package/webpack/config.common.js +6 -1
  138. package/webpack/config.package.js +18 -0
  139. package/webpack/defaults.js +1 -1
  140. package/src/javascripts/ui/components/core/seamly-file-upload.js +0 -86
  141. package/src/javascripts/ui/components/entry/text-entry/hooks.js +0 -46
@@ -1,38 +1,84 @@
1
- // ##### CHAT STATUS #####
2
- // ===================
3
-
4
- // BASE
5
- // ----
6
1
  .#{$n}-chat-status {
7
2
  display: flex;
8
- align-items: center;
9
- justify-content: space-between;
3
+ align-items: flex-start;
4
+ gap: $spacer * 0.5;
10
5
  width: 100%;
6
+ min-height: $buttonsize;
7
+ margin: $spacer;
11
8
  padding: $spacer * 0.5;
12
- border-bottom: $thin-border solid $grey-b;
9
+ border-radius: $borderradius;
13
10
  background-color: $white;
11
+ box-shadow: $boxshadow;
12
+
13
+ &--condensed {
14
+ align-items: center;
15
+ padding: $spacer * 0.25 $spacer * 0.5 $spacer * 0.25 $spacer * 0.25;
16
+ }
14
17
  }
15
18
 
16
- &.#{$n}-app--collapsed .#{$n}-chat-status {
17
- display: none;
19
+ .#{$n}-chat--layout-window .#{$n}-chat-status {
20
+ margin-right: $buttonsize + $spacer * 2;
18
21
  }
19
22
 
20
- // PARTS
21
- // -----
22
- .#{$n}-chat-status__title {
23
+ .#{$n}-chat-status__body {
23
24
  display: flex;
25
+ flex: 1 1 auto;
26
+ flex-wrap: wrap;
27
+ gap: $spacer * 0.5;
24
28
  align-items: center;
25
- margin: 0 $spacer * 0.5 0 0;
29
+ justify-content: flex-start;
30
+ }
31
+
32
+ .#{$n}-chat-status__title {
33
+ display: flex;
34
+ margin: 0;
26
35
  color: $grey-e;
27
- font-size: $fontsize-small;
36
+ font-size: $fontsize-medium;
28
37
  font-weight: $fontweight-bold;
29
- line-height: 1;
38
+ line-height: 1.25;
39
+ }
30
40
 
31
- + .#{$n}-chat-status__button {
32
- margin-top: $spacer * 0.5;
41
+ .#{$n}-chat-status .#{$n}-icon {
42
+ flex: 0 0 $iconsize-small;
43
+ width: $iconsize-small;
44
+ height: $iconsize-small;
45
+ }
46
+
47
+ .#{$n}-chat-status__button {
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: flex-end;
51
+ gap: $spacer * 0.5;
52
+ padding: $spacer * 0.25 $spacer * 0.5;
53
+ color: $white;
54
+ }
55
+
56
+ .#{$n}-chat-status__button .#{$n}-icon {
57
+ svg {
58
+ width: 100%;
59
+ height: 100%;
60
+
61
+ path {
62
+ fill: $white;
63
+ }
33
64
  }
34
65
  }
35
66
 
36
- .#{$n}-chat-status .#{$n}-button--tertiary {
37
- color: $interaction;
67
+ .#{$n}-chat-status__close {
68
+ display: inline-flex;
69
+ flex: 0 0 auto;
70
+ justify-content: center;
71
+ min-width: $buttonsize-small - $spacer * 0.5;
72
+ min-height: $buttonsize-small - $spacer * 0.5;
73
+ color: $brand3;
74
+
75
+ &:has(.#{$n}-icon) {
76
+ flex: 0 0 $buttonsize-small - $spacer * 0.5;
77
+ width: $buttonsize-small - $spacer * 0.5;
78
+ padding: 0;
79
+ }
80
+
81
+ .#{$n}-icon {
82
+ align-self: center;
83
+ }
38
84
  }
@@ -1,10 +1,7 @@
1
1
  .#{$n}-conversation__container {
2
2
  display: flex;
3
3
  position: absolute;
4
- top: 0;
5
- right: 0;
6
- bottom: 0;
7
- left: 0;
4
+ inset: 0;
8
5
  flex: 1 1 100%;
9
6
  flex-direction: column;
10
7
  justify-content: space-between;
@@ -26,11 +26,14 @@
26
26
  height: 100%;
27
27
  margin-right: $spacer * 0.25;
28
28
  padding: $spacer * 0.5;
29
+ overflow: hidden;
29
30
  transition: padding $transition;
30
31
  border: $thin-border solid transparent;
31
32
  border-radius: $borderradius-small;
32
33
  color: $grey-e;
33
34
  font-size: $fontsize-small;
35
+ text-overflow: ellipsis;
36
+ white-space: nowrap;
34
37
  resize: none;
35
38
 
36
39
  // iOS will zoom in on focus if font-size below 16px, and not go back.
@@ -41,9 +44,11 @@
41
44
  }
42
45
 
43
46
  @include stylePlaceholder {
44
- overflow: visible;
47
+ overflow: hidden;
45
48
  color: $grey-c;
46
49
  line-height: $spacer;
50
+ text-overflow: ellipsis;
51
+ white-space: nowrap;
47
52
  }
48
53
  }
49
54
 
@@ -1,10 +1,7 @@
1
1
  .#{$n}-interrupt {
2
2
  display: flex;
3
3
  position: absolute;
4
- top: 0;
5
- right: 0;
6
- bottom: 0;
7
- left: 0;
4
+ inset: 0;
8
5
  background: $white;
9
6
  }
10
7
 
@@ -221,14 +221,12 @@ $avatar-size: $badge-touch-size;
221
221
  .#{$n}-message__body {
222
222
  width: 100%;
223
223
  }
224
- }
225
224
 
226
- .#{$n}-message--type-choice-prompt:not(
227
- .#{$n}-message--type-choice-prompt-selected
228
- ) {
229
- .#{$n}-message__body {
230
- padding: 0;
231
- background: none;
225
+ &:not(.#{$n}-message--type-choice-prompt-selected) {
226
+ .#{$n}-message__body {
227
+ padding: 0;
228
+ background: none;
229
+ }
232
230
  }
233
231
  }
234
232
 
@@ -295,20 +293,50 @@ $avatar-size: $badge-touch-size;
295
293
 
296
294
  // Download
297
295
  .#{$n}-message--type-upload {
296
+ .#{$n}-message__body {
297
+ padding: 0;
298
+ }
299
+
298
300
  .#{$n}-download {
299
301
  display: flex;
300
302
  align-items: center;
301
- width: 100%;
302
- text-decoration: line-through;
303
+ gap: $spacer * 0.5;
304
+ padding: $spacer * 0.5 $spacer * 0.75;
305
+ border-radius: $borderradius;
306
+ color: inherit;
307
+ text-align: left;
303
308
  word-break: break-all;
304
309
  }
305
310
 
306
311
  .#{$n}-download-link {
307
- color: inherit;
308
312
  text-decoration: underline;
313
+ cursor: pointer;
309
314
 
310
315
  &:hover {
311
- text-decoration: none;
316
+ text-decoration: initial;
317
+ }
318
+ }
319
+
320
+ .#{$n}-download--preview {
321
+ flex-flow: column wrap;
322
+ align-items: flex-end;
323
+ gap: 0;
324
+ padding: 0;
325
+
326
+ > img {
327
+ width: 100%;
328
+ height: auto;
329
+ border-top-left-radius: $borderradius;
330
+ border-top-right-radius: $borderradius;
331
+ object-fit: cover;
332
+ }
333
+
334
+ .#{$n}-file-download {
335
+ display: flex;
336
+ flex: 0 0 auto;
337
+ justify-content: flex-end;
338
+ width: 100%;
339
+ padding: $spacer * 0.5 $spacer * 0.75;
312
340
  }
313
341
  }
314
342
 
@@ -316,7 +344,6 @@ $avatar-size: $badge-touch-size;
316
344
  flex: 0 0 16px;
317
345
  width: 16px;
318
346
  height: 16px;
319
- margin-right: $spacer * 0.5;
320
347
  }
321
348
 
322
349
  .#{$n}-icon svg {
@@ -325,6 +352,16 @@ $avatar-size: $badge-touch-size;
325
352
  }
326
353
  }
327
354
 
355
+ .#{$n}-conversation__item--source-agent .#{$n}-message--type-upload {
356
+ .#{$n}-download--preview .#{$n}-file-download {
357
+ justify-content: flex-start;
358
+ }
359
+
360
+ .#{$n}-icon path {
361
+ fill: $interaction;
362
+ }
363
+ }
364
+
328
365
  // Deleted
329
366
  .#{$n}-message--deleted .#{$n}-file-download {
330
367
  text-decoration: line-through;
@@ -1,49 +1,42 @@
1
1
  .#{$n}-translation-options {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: $spacer * 0.25;
2
5
  width: 100%;
3
6
  margin: 0;
4
7
 
5
- // 1px needed for the outline focus ring
6
- padding: 1px 0 0;
8
+ // Top padding needed for the outline focus ring
9
+ padding: $spacer * 0.05 0 0;
7
10
  list-style: none;
11
+ }
8
12
 
9
- &--item {
10
- color: $brand3;
11
- font-size: $fontsize-small;
12
-
13
- > input[type='radio'] {
14
- + label svg {
15
- opacity: 0;
16
- }
17
-
18
- &:checked + label svg {
19
- opacity: 1;
20
- }
21
- }
22
-
23
- > label {
24
- display: flex;
25
- align-items: center;
26
- width: 100%;
27
- padding: calc($spacer * 0.25) 0;
28
- font-weight: $fontweight-bold;
29
-
30
- &:hover {
31
- cursor: pointer;
32
- }
33
-
34
- // Only show a ring when we have focused via keyboard
35
- &:focus-within:has(input:focus-visible) {
36
- outline: -webkit-focus-ring-color auto 1px;
37
- }
13
+ .#{$n}-translation-options__item {
14
+ display: flex;
15
+ align-items: center;
16
+ gap: $spacer * 0.5;
17
+ width: 100%;
18
+ padding: calc($spacer * 0.25) 0;
19
+ color: $brand3;
20
+ font-size: $fontsize-small;
21
+ font-weight: $fontweight-bold;
22
+ cursor: pointer;
23
+
24
+ &:focus-visible {
25
+ outline: -webkit-focus-ring-color auto 1px;
26
+ }
38
27
 
39
- > span {
40
- margin-left: 0.5em;
41
- }
42
- }
28
+ > span {
29
+ margin-left: -0.5em;
43
30
  }
44
31
 
45
- &--icon {
32
+ .#{$n}-icon {
46
33
  display: flex;
47
- margin-right: calc($spacer / 2);
34
+ width: $iconsize-small;
35
+ height: $iconsize-small;
36
+ opacity: 0;
37
+ }
38
+
39
+ &[aria-selected='true'] .#{$n}-icon {
40
+ opacity: 1;
48
41
  }
49
42
  }
@@ -0,0 +1,38 @@
1
+ .#{$n}-unread-messages {
2
+ display: none;
3
+ position: absolute;
4
+ bottom: $spacer;
5
+ align-items: center;
6
+ justify-content: center;
7
+ margin: 0;
8
+ opacity: 0;
9
+
10
+ &.#{$n}-transition--visible {
11
+ display: flex;
12
+ }
13
+
14
+ &.#{$n}-transition--in {
15
+ transition: opacity $transition 1s;
16
+ opacity: 1;
17
+ }
18
+
19
+ .#{$n}-button {
20
+ display: flex;
21
+ align-items: center;
22
+ gap: $spacer * 0.5;
23
+ }
24
+
25
+ .#{$n}-icon {
26
+ width: $spacer;
27
+ height: $spacer;
28
+
29
+ svg {
30
+ width: $spacer;
31
+ height: $spacer;
32
+ }
33
+
34
+ svg path {
35
+ fill: $white;
36
+ }
37
+ }
38
+ }
@@ -56,6 +56,7 @@
56
56
  @import '7-deprecated/5-components/carousel';
57
57
  @import '7-deprecated/5-components/collapse-button';
58
58
  @import '7-deprecated/5-components/suggestions';
59
+ @import '7-deprecated/5-components/unread-messages';
59
60
  }
60
61
 
61
62
  .#{$n}-app--deprecated,
@@ -10,6 +10,7 @@
10
10
  @import '3-chat/chat';
11
11
  @import '4-base/elements';
12
12
  @import '4-base/formelements';
13
+ @import '5-components/abort-transaction';
13
14
  @import '5-components/avatar';
14
15
  @import '5-components/buttons';
15
16
  @import '5-components/choice-prompt';
@@ -45,6 +46,7 @@
45
46
  @import '5-components/window-open-button';
46
47
  @import '5-components/pre-chat-messages';
47
48
  @import '5-components/unstarted';
49
+ @import '5-components/unread-messages';
48
50
  }
49
51
 
50
52
  .#{$n}-app,
@@ -5,6 +5,7 @@ const webpackMerge = require('webpack-merge').merge
5
5
  const { styleScssLoaders } = require('@seamly/doc-site/lib/config/site')
6
6
  const BundleAnalyzerPlugin =
7
7
  require('webpack-bundle-analyzer').BundleAnalyzerPlugin
8
+ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
8
9
 
9
10
  const generateBabelLoaderBrowserPluginsPart = require('./parts/babel-loader-browser-plugins')
10
11
  const generateDevServerPart = require('./parts/dev-server')
@@ -37,6 +38,7 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
37
38
  PACKAGE_NAME: JSON.stringify(pkg.name),
38
39
  PACKAGE_VERSION: JSON.stringify(pkg.version),
39
40
  }),
41
+ new ForkTsCheckerWebpackPlugin(),
40
42
  ]
41
43
 
42
44
  if (env.analyze) {
@@ -93,6 +95,8 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
93
95
  '@babel/env',
94
96
  {
95
97
  targets: BROWSERS,
98
+ useBuiltIns: 'entry',
99
+ corejs: '3.30.0',
96
100
  },
97
101
  ],
98
102
  ],
@@ -104,7 +108,7 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
104
108
  },
105
109
  },
106
110
  {
107
- test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
111
+ test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2|mp3)$/,
108
112
  exclude: [PUBLIC_ROOT],
109
113
  loader: 'url-loader',
110
114
  options: {
@@ -122,6 +126,7 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
122
126
  loader: 'ts-loader',
123
127
  exclude: /node_modules|\.d\.ts$/,
124
128
  options: {
129
+ transpileOnly: true,
125
130
  compilerOptions: {
126
131
  outDir: 'build',
127
132
  noEmit: false,
@@ -1,12 +1,14 @@
1
1
  /* eslint-disable */
2
2
  const webpackDefinePlugin = require('webpack').DefinePlugin
3
3
  const webpackMerge = require('webpack-merge').merge
4
+ const SourceMapDevToolPlugin = require('webpack').SourceMapDevToolPlugin
4
5
  const glob = require('glob')
5
6
  const path = require('path')
6
7
  const { assetScssLoaders } = require('@seamly/doc-site/lib/config/site')
7
8
  const defaultConfig = require('./defaults')
8
9
  const generateBabelLoaderPluginsPart = require('./parts/babel-loader-plugins')
9
10
  const generateBabelLoaderBrowserPluginsPart = require('./parts/babel-loader-browser-plugins')
11
+ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
10
12
 
11
13
  module.exports = (env = {}, argv = {}, configOverrides = {}) => {
12
14
  const implConfig = {
@@ -48,6 +50,11 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
48
50
  PACKAGE_NAME: JSON.stringify(pkg.name),
49
51
  PACKAGE_VERSION: JSON.stringify(pkg.version),
50
52
  }),
53
+ new SourceMapDevToolPlugin({
54
+ filename: '[file].map[query]',
55
+ append: '\n//# sourceMappingURL=~/[url]',
56
+ }),
57
+ new ForkTsCheckerWebpackPlugin(),
51
58
  ],
52
59
  resolve: {
53
60
  modules: [path.resolve(__dirname, '../src/javascripts'), 'node_modules'],
@@ -61,6 +68,14 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
61
68
  },
62
69
  module: {
63
70
  rules: [
71
+ {
72
+ test: /\.(mp3|wav)$/,
73
+ loader: 'file-loader',
74
+ options: {
75
+ name: '[name].[ext]',
76
+ outputPath: 'sounds',
77
+ },
78
+ },
64
79
  {
65
80
  test: /\.(j|t)s$/,
66
81
  include: BABEL_TRANSPILE_MODULES.map((moduleName) =>
@@ -84,6 +99,7 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
84
99
  loader: 'ts-loader',
85
100
  exclude: /node_modules|\.d\.ts$/,
86
101
  options: {
102
+ transpileOnly: true,
87
103
  compilerOptions: {
88
104
  outDir: 'build',
89
105
  noEmit: false,
@@ -164,6 +180,8 @@ module.exports = (env = {}, argv = {}, configOverrides = {}) => {
164
180
  '@babel/env',
165
181
  {
166
182
  targets: BROWSERS,
183
+ useBuiltIns: 'entry',
184
+ corejs: '3.30.0',
167
185
  },
168
186
  ],
169
187
  ],
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-var-requires */
2
2
  const path = require('path')
3
3
 
4
- const BABEL_TRANSPILE_MODULES = ['debug', 'superagent', 'phoenix']
4
+ const BABEL_TRANSPILE_MODULES = ['debug', 'phoenix']
5
5
  const BROWSERS = 'last 1 version, > 1%, not dead, not ie 11, not ie_mob 11'
6
6
 
7
7
  const ROOT = path.resolve(__dirname, '..')
@@ -1,86 +0,0 @@
1
- import { useDispatch } from 'react-redux'
2
- import { useSeamlyApiContext, useSeamlyCommands } from 'ui/hooks/seamly-hooks'
3
- import { useI18n } from 'domains/i18n/hooks'
4
- import {
5
- registerUpload,
6
- setUploadComplete,
7
- setUploadError,
8
- setUploadProgress,
9
- } from 'domains/store/slice'
10
- import { randomId } from 'lib/id'
11
- import SeamlyFileUploadContext from './seamly-file-upload-context'
12
-
13
- const SeamlyFileUpload = ({ children }) => {
14
- const { t } = useI18n()
15
- const dispatch = useDispatch()
16
- const api = useSeamlyApiContext()
17
- const { addUploadBubble } = useSeamlyCommands()
18
-
19
- const onUploadFileHandler = (file) => {
20
- const fileId = randomId()
21
-
22
- const uploadHandle = api.uploadFile(
23
- file,
24
- (p) => {
25
- dispatch(setUploadProgress({ fileId, progress: Math.ceil(p) }))
26
- },
27
- (result) => {
28
- const {
29
- id,
30
- transactionId,
31
- occurredAt,
32
- body: { contentType, filename, filesize, url },
33
- } = result.body
34
- dispatch(setUploadComplete(fileId))
35
- addUploadBubble(
36
- id,
37
- transactionId,
38
- occurredAt,
39
- contentType,
40
- filename,
41
- filesize,
42
- url,
43
- )
44
- },
45
- (err) => {
46
- const errorKey = err && err.body ? err.body.error : ''
47
- let errorText
48
-
49
- switch (errorKey) {
50
- case 'file_uploads_are_disabled':
51
- errorText = t('fileUpload.errors.unavailable')
52
- break
53
- case 'request_entity_too_large':
54
- errorText = t('fileUpload.errors.tooLarge')
55
- break
56
- case 'file_has_invalid_mime_type':
57
- errorText = t('fileUpload.errors.wrongType')
58
- break
59
- case 'virus_found':
60
- errorText = t('fileUpload.errors.virusFound')
61
- break
62
- default:
63
- errorText = t('fileUpload.errors.general')
64
- }
65
-
66
- dispatch(setUploadError({ fileId, errorText }))
67
- },
68
- )
69
-
70
- dispatch(
71
- registerUpload({
72
- fileId,
73
- fileName: file.name,
74
- uploadHandle,
75
- }),
76
- )
77
- }
78
-
79
- return (
80
- <SeamlyFileUploadContext.Provider value={onUploadFileHandler}>
81
- {children}
82
- </SeamlyFileUploadContext.Provider>
83
- )
84
- }
85
-
86
- export default SeamlyFileUpload
@@ -1,46 +0,0 @@
1
- import { useEffect, useMemo } from 'preact/hooks'
2
- import { maxCharacterSrDebounceDelay, maxCharacterWarningLimit } from 'config'
3
- import { useLiveRegion } from 'ui/hooks/live-region-hooks'
4
- import { useEntryTextLimit } from 'ui/hooks/seamly-state-hooks'
5
- import { debounce } from 'ui/utils/general-utils'
6
- import { useFormControl } from 'domains/forms/hooks'
7
- import { useI18n } from 'domains/i18n/hooks'
8
-
9
- export function useCharacterLimit(controlName) {
10
- const { t } = useI18n()
11
- const { sendAssertive } = useLiveRegion()
12
- const { hasLimit, limit } = useEntryTextLimit()
13
-
14
- const debouncedSendAssertive = useMemo(
15
- () => debounce(sendAssertive, maxCharacterSrDebounceDelay),
16
- [sendAssertive],
17
- )
18
- const validateLimit = useMemo(() => {
19
- return debounce((_reachedCharacterWarning, _remainingChars) => {
20
- if (_reachedCharacterWarning) {
21
- debouncedSendAssertive(
22
- t('input.srCharacterLimitText', { limit: _remainingChars }),
23
- )
24
- }
25
- }, maxCharacterSrDebounceDelay)
26
- }, [debouncedSendAssertive, t])
27
-
28
- const [{ value }] = useFormControl(controlName)
29
- const remainingChars = hasLimit && value ? limit - value.length : limit
30
- const reachedCharacterWarning = hasLimit
31
- ? remainingChars <= maxCharacterWarningLimit
32
- : false
33
- const reachedCharacterLimit = hasLimit ? remainingChars < 0 : false
34
-
35
- useEffect(() => {
36
- validateLimit(reachedCharacterWarning, remainingChars)
37
- }, [reachedCharacterWarning, remainingChars, validateLimit])
38
-
39
- return {
40
- hasCharacterLimit: hasLimit,
41
- characterLimit: limit,
42
- reachedCharacterWarning,
43
- reachedCharacterLimit,
44
- remainingChars,
45
- }
46
- }