diff --git a/.eslintrc.react.yml b/.eslintrc.react.yml index f50647a56a..05564d3999 100644 --- a/.eslintrc.react.yml +++ b/.eslintrc.react.yml @@ -41,9 +41,6 @@ rules: - error - multiline-multiprop react/jsx-handler-names: error - react/jsx-indent: - - error - - 2 react/jsx-indent-props: - error - 2 diff --git a/__tests__/__image_snapshots__/html/activity-add-decorate-js-activity-middleware-adds-a-custom-activity-with-decoration-1-snap.png b/__tests__/__image_snapshots__/html/activity-add-decorate-js-activity-middleware-adds-a-custom-activity-with-decoration-1-snap.png new file mode 100644 index 0000000000..c54f67c97d Binary files /dev/null and b/__tests__/__image_snapshots__/html/activity-add-decorate-js-activity-middleware-adds-a-custom-activity-with-decoration-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/activity-add-js-activity-middleware-adds-a-custom-activity-1-snap.png b/__tests__/__image_snapshots__/html/activity-add-js-activity-middleware-adds-a-custom-activity-1-snap.png new file mode 100644 index 0000000000..32b60c2722 Binary files /dev/null and b/__tests__/__image_snapshots__/html/activity-add-js-activity-middleware-adds-a-custom-activity-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/activity-decorate-js-activity-middleware-decorates-an-activity-by-text-1-snap.png b/__tests__/__image_snapshots__/html/activity-decorate-js-activity-middleware-decorates-an-activity-by-text-1-snap.png new file mode 100644 index 0000000000..a53af0f1e6 Binary files /dev/null and b/__tests__/__image_snapshots__/html/activity-decorate-js-activity-middleware-decorates-an-activity-by-text-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/activity-remove-js-activity-middleware-removes-an-activity-by-text-1-snap.png b/__tests__/__image_snapshots__/html/activity-remove-js-activity-middleware-removes-an-activity-by-text-1-snap.png new file mode 100644 index 0000000000..3bfe0d3d87 Binary files /dev/null and b/__tests__/__image_snapshots__/html/activity-remove-js-activity-middleware-removes-an-activity-by-text-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/activity-remove-replace-js-activity-middleware-removes-activity-and-replaces-activity-1-snap.png b/__tests__/__image_snapshots__/html/activity-remove-replace-js-activity-middleware-removes-activity-and-replaces-activity-1-snap.png new file mode 100644 index 0000000000..565f149717 Binary files /dev/null and b/__tests__/__image_snapshots__/html/activity-remove-replace-js-activity-middleware-removes-activity-and-replaces-activity-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/activity-replace-js-activity-middleware-replaces-an-activity-by-text-1-snap.png b/__tests__/__image_snapshots__/html/activity-replace-js-activity-middleware-replaces-an-activity-by-text-1-snap.png new file mode 100644 index 0000000000..517d85e6e3 Binary files /dev/null and b/__tests__/__image_snapshots__/html/activity-replace-js-activity-middleware-replaces-an-activity-by-text-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/activity-replace-remove-js-activity-middleware-replaces-activity-and-removes-activity-1-snap.png b/__tests__/__image_snapshots__/html/activity-replace-remove-js-activity-middleware-replaces-activity-and-removes-activity-1-snap.png new file mode 100644 index 0000000000..a0284de124 Binary files /dev/null and b/__tests__/__image_snapshots__/html/activity-replace-remove-js-activity-middleware-replaces-activity-and-removes-activity-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/use-create-activity-renderer-decorate-js-activity-middleware-hooks-decorates-an-activity-when-used-with-use-create-activity-renderer-1-snap.png b/__tests__/__image_snapshots__/html/use-create-activity-renderer-decorate-js-activity-middleware-hooks-decorates-an-activity-when-used-with-use-create-activity-renderer-1-snap.png new file mode 100644 index 0000000000..9997253cf4 Binary files /dev/null and b/__tests__/__image_snapshots__/html/use-create-activity-renderer-decorate-js-activity-middleware-hooks-decorates-an-activity-when-used-with-use-create-activity-renderer-1-snap.png differ diff --git a/__tests__/__image_snapshots__/html/use-render-attachment-decorate-js-activity-middleware-hooks-decorates-an-activity-when-used-with-use-render-attachment-1-snap.png b/__tests__/__image_snapshots__/html/use-render-attachment-decorate-js-activity-middleware-hooks-decorates-an-activity-when-used-with-use-render-attachment-1-snap.png new file mode 100644 index 0000000000..ae91db40d7 Binary files /dev/null and b/__tests__/__image_snapshots__/html/use-render-attachment-decorate-js-activity-middleware-hooks-decorates-an-activity-when-used-with-use-render-attachment-1-snap.png differ diff --git a/__tests__/html/middleware/shim-v1-v2/activity.add.decorate.html b/__tests__/html/middleware/shim-v1-v2/activity.add.decorate.html new file mode 100644 index 0000000000..b4f154398c --- /dev/null +++ b/__tests__/html/middleware/shim-v1-v2/activity.add.decorate.html @@ -0,0 +1,137 @@ + + + +
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/shim-v1-v2/activity.add.decorate.js b/__tests__/html/middleware/shim-v1-v2/activity.add.decorate.js new file mode 100644 index 0000000000..613003a438 --- /dev/null +++ b/__tests__/html/middleware/shim-v1-v2/activity.add.decorate.js @@ -0,0 +1,6 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('adds a custom activity with decoration', () => + runHTML('./middleware/shim-v1-v2/activity.add.decorate.html')); +}); diff --git a/__tests__/html/middleware/shim-v1-v2/activity.remove.replace.html b/__tests__/html/middleware/shim-v1-v2/activity.remove.replace.html new file mode 100644 index 0000000000..0870b1c8b1 --- /dev/null +++ b/__tests__/html/middleware/shim-v1-v2/activity.remove.replace.html @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/shim-v1-v2/activity.remove.replace.js b/__tests__/html/middleware/shim-v1-v2/activity.remove.replace.js new file mode 100644 index 0000000000..11948f47e6 --- /dev/null +++ b/__tests__/html/middleware/shim-v1-v2/activity.remove.replace.js @@ -0,0 +1,6 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('removes activity and replaces activity', () => + runHTML('./middleware/shim-v1-v2/activity.remove.replace.html')); +}); diff --git a/__tests__/html/middleware/shim-v1-v2/activity.replace.remove.html b/__tests__/html/middleware/shim-v1-v2/activity.replace.remove.html new file mode 100644 index 0000000000..5b506fa250 --- /dev/null +++ b/__tests__/html/middleware/shim-v1-v2/activity.replace.remove.html @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/shim-v1-v2/activity.replace.remove.js b/__tests__/html/middleware/shim-v1-v2/activity.replace.remove.js new file mode 100644 index 0000000000..cea7bf1d39 --- /dev/null +++ b/__tests__/html/middleware/shim-v1-v2/activity.replace.remove.js @@ -0,0 +1,6 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('replaces activity and removes activity', () => + runHTML('./middleware/shim-v1-v2/activity.replace.remove.html')); +}); diff --git a/__tests__/html/middleware/shim-v2-v1/activity.add.decorate.html b/__tests__/html/middleware/shim-v2-v1/activity.add.decorate.html new file mode 100644 index 0000000000..729c86d308 --- /dev/null +++ b/__tests__/html/middleware/shim-v2-v1/activity.add.decorate.html @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/shim-v2-v1/activity.add.decorate.js b/__tests__/html/middleware/shim-v2-v1/activity.add.decorate.js new file mode 100644 index 0000000000..d21e8532aa --- /dev/null +++ b/__tests__/html/middleware/shim-v2-v1/activity.add.decorate.js @@ -0,0 +1,6 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('adds a custom activity with decoration', () => + runHTML('./middleware/shim-v2-v1/activity.add.decorate.html')); +}); diff --git a/__tests__/html/middleware/shim-v2-v1/activity.remove.replace.html b/__tests__/html/middleware/shim-v2-v1/activity.remove.replace.html new file mode 100644 index 0000000000..74cf30a265 --- /dev/null +++ b/__tests__/html/middleware/shim-v2-v1/activity.remove.replace.html @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/shim-v2-v1/activity.remove.replace.js b/__tests__/html/middleware/shim-v2-v1/activity.remove.replace.js new file mode 100644 index 0000000000..0349320ddd --- /dev/null +++ b/__tests__/html/middleware/shim-v2-v1/activity.remove.replace.js @@ -0,0 +1,6 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('removes activity and replaces activity', () => + runHTML('./middleware/shim-v2-v1/activity.remove.replace.html')); +}); diff --git a/__tests__/html/middleware/shim-v2-v1/activity.replace.remove.html b/__tests__/html/middleware/shim-v2-v1/activity.replace.remove.html new file mode 100644 index 0000000000..1e979bc361 --- /dev/null +++ b/__tests__/html/middleware/shim-v2-v1/activity.replace.remove.html @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/shim-v2-v1/activity.replace.remove.js b/__tests__/html/middleware/shim-v2-v1/activity.replace.remove.js new file mode 100644 index 0000000000..cf60737d01 --- /dev/null +++ b/__tests__/html/middleware/shim-v2-v1/activity.replace.remove.js @@ -0,0 +1,6 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('replaces activity and removes activity', () => + runHTML('./middleware/shim-v2-v1/activity.replace.remove.html')); +}); diff --git a/__tests__/html/middleware/v1/activity.add.decorate.html b/__tests__/html/middleware/v1/activity.add.decorate.html new file mode 100644 index 0000000000..90c55afe17 --- /dev/null +++ b/__tests__/html/middleware/v1/activity.add.decorate.html @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v1/activity.add.decorate.js b/__tests__/html/middleware/v1/activity.add.decorate.js new file mode 100644 index 0000000000..74729e1c03 --- /dev/null +++ b/__tests__/html/middleware/v1/activity.add.decorate.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('adds a custom activity with decoration', () => runHTML('./middleware/v1/activity.add.decorate.html')); +}); diff --git a/__tests__/html/middleware/v1/activity.add.html b/__tests__/html/middleware/v1/activity.add.html new file mode 100644 index 0000000000..948bd070eb --- /dev/null +++ b/__tests__/html/middleware/v1/activity.add.html @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v1/activity.add.js b/__tests__/html/middleware/v1/activity.add.js new file mode 100644 index 0000000000..abb4b42361 --- /dev/null +++ b/__tests__/html/middleware/v1/activity.add.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('adds a custom activity', () => runHTML('./middleware/v1/activity.add.html')); +}); diff --git a/__tests__/html/middleware/v1/activity.decorate.html b/__tests__/html/middleware/v1/activity.decorate.html new file mode 100644 index 0000000000..1d142573fc --- /dev/null +++ b/__tests__/html/middleware/v1/activity.decorate.html @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v1/activity.decorate.js b/__tests__/html/middleware/v1/activity.decorate.js new file mode 100644 index 0000000000..e46641c143 --- /dev/null +++ b/__tests__/html/middleware/v1/activity.decorate.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('decorates an activity by text', () => runHTML('./middleware/v1/activity.decorate.html')); +}); diff --git a/__tests__/html/middleware/v1/activity.remove.html b/__tests__/html/middleware/v1/activity.remove.html new file mode 100644 index 0000000000..8ce1f94136 --- /dev/null +++ b/__tests__/html/middleware/v1/activity.remove.html @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v1/activity.remove.js b/__tests__/html/middleware/v1/activity.remove.js new file mode 100644 index 0000000000..6f365b7ef9 --- /dev/null +++ b/__tests__/html/middleware/v1/activity.remove.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('removes an activity by text', () => runHTML('./middleware/v1/activity.remove.html')); +}); diff --git a/__tests__/html/middleware/v1/activity.remove.replace.html b/__tests__/html/middleware/v1/activity.remove.replace.html new file mode 100644 index 0000000000..30d1a5f0a9 --- /dev/null +++ b/__tests__/html/middleware/v1/activity.remove.replace.html @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v1/activity.remove.replace.js b/__tests__/html/middleware/v1/activity.remove.replace.js new file mode 100644 index 0000000000..e38e292a41 --- /dev/null +++ b/__tests__/html/middleware/v1/activity.remove.replace.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('removes activity and replaces activity', () => runHTML('./middleware/v1/activity.remove.replace.html')); +}); diff --git a/__tests__/html/middleware/v1/activity.replace.html b/__tests__/html/middleware/v1/activity.replace.html new file mode 100644 index 0000000000..dd6152006d --- /dev/null +++ b/__tests__/html/middleware/v1/activity.replace.html @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v1/activity.replace.js b/__tests__/html/middleware/v1/activity.replace.js new file mode 100644 index 0000000000..1a3efce9b0 --- /dev/null +++ b/__tests__/html/middleware/v1/activity.replace.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('replaces an activity by text', () => runHTML('./middleware/v1/activity.replace.html')); +}); diff --git a/__tests__/html/middleware/v1/activity.replace.remove.html b/__tests__/html/middleware/v1/activity.replace.remove.html new file mode 100644 index 0000000000..c5c5daf7d7 --- /dev/null +++ b/__tests__/html/middleware/v1/activity.replace.remove.html @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v1/activity.replace.remove.js b/__tests__/html/middleware/v1/activity.replace.remove.js new file mode 100644 index 0000000000..e427c63f21 --- /dev/null +++ b/__tests__/html/middleware/v1/activity.replace.remove.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('replaces activity and removes activity', () => runHTML('./middleware/v1/activity.replace.remove.html')); +}); diff --git a/__tests__/html/middleware/v1/useCreateActivityRenderer.decorate.html b/__tests__/html/middleware/v1/useCreateActivityRenderer.decorate.html new file mode 100644 index 0000000000..f9118dc6be --- /dev/null +++ b/__tests__/html/middleware/v1/useCreateActivityRenderer.decorate.html @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + diff --git a/__tests__/html/middleware/v1/useCreateActivityRenderer.decorate.js b/__tests__/html/middleware/v1/useCreateActivityRenderer.decorate.js new file mode 100644 index 0000000000..eb44aadd44 --- /dev/null +++ b/__tests__/html/middleware/v1/useCreateActivityRenderer.decorate.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware hooks', () => { + test('decorates an activity when used with useCreateActivityRenderer', () => runHTML('./middleware/v1/useCreateActivityRenderer.decorate.html')); +}); diff --git a/__tests__/html/middleware/v1/useRenderAttachment.decorate.html b/__tests__/html/middleware/v1/useRenderAttachment.decorate.html new file mode 100644 index 0000000000..9cff64a74f --- /dev/null +++ b/__tests__/html/middleware/v1/useRenderAttachment.decorate.html @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + diff --git a/__tests__/html/middleware/v1/useRenderAttachment.decorate.js b/__tests__/html/middleware/v1/useRenderAttachment.decorate.js new file mode 100644 index 0000000000..b85efbbcd4 --- /dev/null +++ b/__tests__/html/middleware/v1/useRenderAttachment.decorate.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware hooks', () => { + test('decorates an activity when used with useRenderAttachment', () => runHTML('./middleware/v1/useRenderAttachment.decorate.html')); +}); \ No newline at end of file diff --git a/__tests__/html/middleware/v2/activity.add.decorate.html b/__tests__/html/middleware/v2/activity.add.decorate.html new file mode 100644 index 0000000000..516b94b620 --- /dev/null +++ b/__tests__/html/middleware/v2/activity.add.decorate.html @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v2/activity.add.decorate.js b/__tests__/html/middleware/v2/activity.add.decorate.js new file mode 100644 index 0000000000..680476bbb8 --- /dev/null +++ b/__tests__/html/middleware/v2/activity.add.decorate.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('adds a custom activity with decoration', () => runHTML('./middleware/v2/activity.add.decorate.html')); +}); diff --git a/__tests__/html/middleware/v2/activity.add.html b/__tests__/html/middleware/v2/activity.add.html new file mode 100644 index 0000000000..8e0d95abea --- /dev/null +++ b/__tests__/html/middleware/v2/activity.add.html @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v2/activity.add.js b/__tests__/html/middleware/v2/activity.add.js new file mode 100644 index 0000000000..81d0090642 --- /dev/null +++ b/__tests__/html/middleware/v2/activity.add.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('adds a custom activity', () => runHTML('./middleware/v2/activity.add.html')); +}); diff --git a/__tests__/html/middleware/v2/activity.decorate.html b/__tests__/html/middleware/v2/activity.decorate.html new file mode 100644 index 0000000000..bc1f66b0f2 --- /dev/null +++ b/__tests__/html/middleware/v2/activity.decorate.html @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v2/activity.decorate.js b/__tests__/html/middleware/v2/activity.decorate.js new file mode 100644 index 0000000000..52861f0946 --- /dev/null +++ b/__tests__/html/middleware/v2/activity.decorate.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('decorates an activity by text', () => runHTML('./middleware/v2/activity.decorate.html')); +}); diff --git a/__tests__/html/middleware/v2/activity.remove.html b/__tests__/html/middleware/v2/activity.remove.html new file mode 100644 index 0000000000..cddf687508 --- /dev/null +++ b/__tests__/html/middleware/v2/activity.remove.html @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v2/activity.remove.js b/__tests__/html/middleware/v2/activity.remove.js new file mode 100644 index 0000000000..afdbb0a95a --- /dev/null +++ b/__tests__/html/middleware/v2/activity.remove.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('removes an activity by text', () => runHTML('./middleware/v2/activity.remove.html')); +}); diff --git a/__tests__/html/middleware/v2/activity.remove.replace.html b/__tests__/html/middleware/v2/activity.remove.replace.html new file mode 100644 index 0000000000..969bbabb2b --- /dev/null +++ b/__tests__/html/middleware/v2/activity.remove.replace.html @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v2/activity.remove.replace.js b/__tests__/html/middleware/v2/activity.remove.replace.js new file mode 100644 index 0000000000..84b6af87df --- /dev/null +++ b/__tests__/html/middleware/v2/activity.remove.replace.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('removes activity and replaces activity', () => runHTML('./middleware/v2/activity.remove.replace.html')); +}); diff --git a/__tests__/html/middleware/v2/activity.replace.html b/__tests__/html/middleware/v2/activity.replace.html new file mode 100644 index 0000000000..56da585d29 --- /dev/null +++ b/__tests__/html/middleware/v2/activity.replace.html @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v2/activity.replace.js b/__tests__/html/middleware/v2/activity.replace.js new file mode 100644 index 0000000000..190b3d4d51 --- /dev/null +++ b/__tests__/html/middleware/v2/activity.replace.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('replaces an activity by text', () => runHTML('./middleware/v2/activity.replace.html')); +}); diff --git a/__tests__/html/middleware/v2/activity.replace.remove.html b/__tests__/html/middleware/v2/activity.replace.remove.html new file mode 100644 index 0000000000..70059ea186 --- /dev/null +++ b/__tests__/html/middleware/v2/activity.replace.remove.html @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__tests__/html/middleware/v2/activity.replace.remove.js b/__tests__/html/middleware/v2/activity.replace.remove.js new file mode 100644 index 0000000000..de9df1eb94 --- /dev/null +++ b/__tests__/html/middleware/v2/activity.replace.remove.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware', () => { + test('replaces activity and removes activity', () => runHTML('./middleware/v2/activity.replace.remove.html')); +}); diff --git a/__tests__/html/middleware/v2/activityGrouping.customMiddleware.html b/__tests__/html/middleware/v2/activityGrouping.customMiddleware.html new file mode 100644 index 0000000000..0e498d37f3 --- /dev/null +++ b/__tests__/html/middleware/v2/activityGrouping.customMiddleware.html @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + diff --git a/__tests__/html/middleware/v2/activityGrouping.customMiddleware.js b/__tests__/html/middleware/v2/activityGrouping.customMiddleware.js new file mode 100644 index 0000000000..c4b940fa79 --- /dev/null +++ b/__tests__/html/middleware/v2/activityGrouping.customMiddleware.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity grouping', () => { + test('should accept valid or invalid custom middleware', () => runHTML('./middleware/v2/activityGrouping.customMiddleware.html')); +}); diff --git a/__tests__/html/middleware/v2/useCreateActivityRenderer.decorate.html b/__tests__/html/middleware/v2/useCreateActivityRenderer.decorate.html new file mode 100644 index 0000000000..2fe8a90936 --- /dev/null +++ b/__tests__/html/middleware/v2/useCreateActivityRenderer.decorate.html @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + diff --git a/__tests__/html/middleware/v2/useCreateActivityRenderer.decorate.js b/__tests__/html/middleware/v2/useCreateActivityRenderer.decorate.js new file mode 100644 index 0000000000..7364e91156 --- /dev/null +++ b/__tests__/html/middleware/v2/useCreateActivityRenderer.decorate.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware hooks', () => { + test('decorates an activity when used with useCreateActivityRenderer', () => runHTML('./middleware/v2/useCreateActivityRenderer.decorate.html')); +}); diff --git a/__tests__/html/middleware/v2/useRenderAttachment.decorate.html b/__tests__/html/middleware/v2/useRenderAttachment.decorate.html new file mode 100644 index 0000000000..e986a0b24a --- /dev/null +++ b/__tests__/html/middleware/v2/useRenderAttachment.decorate.html @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + diff --git a/__tests__/html/middleware/v2/useRenderAttachment.decorate.js b/__tests__/html/middleware/v2/useRenderAttachment.decorate.js new file mode 100644 index 0000000000..9c8a4d581b --- /dev/null +++ b/__tests__/html/middleware/v2/useRenderAttachment.decorate.js @@ -0,0 +1,5 @@ +/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */ + +describe('activity middleware hooks', () => { + test('decorates an activity when used with useRenderAttachment', () => runHTML('./middleware/v2/useRenderAttachment.decorate.html')); +}); diff --git a/packages/api/src/hooks/Composer.tsx b/packages/api/src/hooks/Composer.tsx index 6ae1f9340d..61111c119d 100644 --- a/packages/api/src/hooks/Composer.tsx +++ b/packages/api/src/hooks/Composer.tsx @@ -71,6 +71,8 @@ import { SendBoxToolbarMiddlewareProvider, type SendBoxToolbarMiddleware } from import Tracker from './internal/Tracker'; import WebChatAPIContext, { type WebChatAPIContextType } from './internal/WebChatAPIContext'; import WebChatReduxContext, { useDispatch } from './internal/WebChatReduxContext'; +import { isV2Middleware } from '../utils/v2Middleware'; + import defaultSelectVoice from './internal/defaultSelectVoice'; import applyMiddleware, { forLegacyRenderer as applyMiddlewareForLegacyRenderer, @@ -86,6 +88,7 @@ import observableToPromise from './utils/observableToPromise'; // @ts-ignore import PrecompiledGlobalize from '../external/PrecompiledGlobalize'; import { parseUIState } from './validation/uiState'; +import { ActivityMiddlewareProvider } from '../providers/ActivityMiddleware/ActivityMiddleware'; // List of Redux actions factory we are hoisting as Web Chat functions const DISPATCHERS = { @@ -407,6 +410,11 @@ const ComposerCore = ({ [telemetryDimensionsRef] ); + const isUsingActivityMiddlewareV2 = useMemo( + () => singleToArray(activityMiddleware).some(md => isV2Middleware(md)), + [activityMiddleware] + ); + const patchedActivityRenderer = useMemo( () => applyMiddlewareForRenderer( @@ -573,7 +581,8 @@ const ComposerCore = ({ typingIndicatorRenderer: patchedTypingIndicatorRenderer, uiState, userID, - username + username, + isUsingActivityMiddlewareV2 }), [ cardActionContext, @@ -600,29 +609,31 @@ const ComposerCore = ({ renderMarkdown, scrollToEndButtonRenderer, sendTypingIndicator, - telemetryDimensionsRef, trackDimension, uiState, userID, - username + username, + isUsingActivityMiddlewareV2 ] ); return (