Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/2.0.0 alpha.1 #11

Closed
wants to merge 150 commits into from
Closed

Release/2.0.0 alpha.1 #11

wants to merge 150 commits into from

Conversation

Gerben-T
Copy link
Collaborator

@Gerben-T Gerben-T commented Jul 23, 2021

Draft until parley-messaging/web-library-v1#9 en parley-messaging/web-library-v1#10 gemerged zijn

This PR contains early merges of the following:

  • parley-messaging/web-library-v1#10
  • parley-messaging/web-library-v1#9
  • parley-messaging/web-library-v1#8

and thus are dependencies.

These should be merged (into their destination branch) before this PR is approved/merged.
(it will become a lot smaller when everything is merged)

After they are merged into master it could be that this PR adds a couple new commits to master.

Gerben-T and others added 30 commits May 7, 2021 10:48
…ure/components

# Conflicts:
#	.babelrc
#	.eslintrc.json
#	.idea/inspectionProfiles/Project_Default.xml
#	package-lock.json
#	package.json
#	src/App.jsx
This abstraction layer is the base layer which contains all the Api calls done with fetch().
… feature/apiCode

� Conflicts:
�	.babelrc
�	.eslintrc.json
�	.gitignore
�	.idea/inspectionProfiles/Project_Default.xml
�	README.md
�	index.html
�	package-lock.json
�	package.json
�	src/App.jsx
�	src/index.jsx
no-invalid-this had to be replaced by @babel/no-invalid-this, otherwise it would show false positives in arrow functions
Announcement
Image.jsx
ImageViewer.jsx
ReplyActions.jsx

Removed
MarkdownText.jsx

Changed:
Arrow functions and removed binds
Disabled Image.jsx (not required in first version)
 into feature/components

� Conflicts:
�	.eslintrc.json
�	.idea/inspectionProfiles/Project_Default.xml
�	.idea/vcs.xml
�	README.md
�	index.html
�	package-lock.json
�	package.json
�	src/App.jsx
�	src/index.jsx
https://v2.parceljs.org/blog/beta3/

Had to install a plugin for eslint otherwise it showed errors because it is missing je react-preset
…library into feature/strictCSP

� Conflicts:
�	index.html
…ry into feature/strictCSP

� Conflicts:
�	package-lock.json
�	package.json
�	src/ui/App.jsx
@Gerben-T
Copy link
Collaborator Author

Stays in draft until dependencies are merged

Gerben-T and others added 11 commits July 27, 2021 10:48
…cation changes

This was due to the localstorage still containing the device info.
When we try to subscribe with the same info it will ignore the call because it is a waste of resources if we make the call with nothing new in it.
* Fixed - Minor styling issues font and color
Added - Error root styling (was in front-end web library) not in here tho
Auto - name got added after i did install packages

* Fixed - Prefix in root values

* Fixed - package-lock.json

* Fixed - Duplicate root style

* Fixed - vcs file
Also; renamed variables for aria labels to start with "ariaLabel"
This way we can re-subscribe if one of those has changed
When device/account identification changes we want te subscribe the (new) device to the (new) account.
Also; the default value for the deviceIdentification is either; the one saved in storage from previous session OR a new random uuid
@Gerben-T Gerben-T changed the title Release/2.0.0 alpha.1 Release/2.0.0 alpha.2 Aug 31, 2021
@Gerben-T Gerben-T changed the title Release/2.0.0 alpha.2 Release/2.0.0 alpha.1 Aug 31, 2021
@Gerben-T Gerben-T mentioned this pull request Aug 31, 2021
3 tasks
Comment on lines +94 to +95
window.hideParleyMessenger = this.hideChat;
window.showParleyMessenger = this.showChat;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/UI/index.jsx Outdated
Comment on lines 15 to 27
window.initParleyMessenger = () => {
// eslint-disable-next-line no-undef
if(process.env.NODE_ENV === "development") {
Logger.setLevel(Logger.DEBUG); // Make sure you enable "verbose" logging in your console to see DEBUG logs
ReactDOM.render(<App debug={true} />, mountNode);
} else {
ReactDOM.render(<App />, mountNode);
}
};

window.destroyParleyMessenger = () => {
ReactDOM.unmountComponentAtNode(mountNode);
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package.json Outdated
Comment on lines 6 to 42
"targets": {
"ui-for-watcher": {
"distDir": "dist/",
"optimize": false,
"sourceMap": false
},
"ui-minimized": {
"distDir": "dist/ui/minified",
"optimize": true,
"sourceMap": false
},
"ui-sourcemapped": {
"distDir": "dist/ui/sourcemapped",
"optimize": false,
"sourceMap": true
},
"cdn-demo-live": {
"distDir": "dist/ui/cdn-demo-live",
"publicUrl": "/demo/v2/",
"optimize": true,
"sourceMap": false
},
"cdn-demo-local": {
"distDir": "dist/ui/cdn-demo-local",
"optimize": false,
"sourceMap": true
}
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "npx parcel serve --host chat-dev.parley.nu --https --cert ssl/ssl.cert --key ssl/ssl.key --no-autoinstall index.html",
"build": "npx parcel build index.html",
"start": "npx parcel serve --host chat-dev.parley.nu --https --cert ssl/ssl.cert --key ssl/ssl.key --no-autoinstall --port 8181 --target ui-for-watcher index.html",
"build": "npx parcel build --target ui-minimized --target ui-sourcemapped index.html",
"build-cdn-demo": "npx parcel build --target cdn-demo-live --target cdn-demo-local parleycdn-demo/index.html",
"test:open": "./bin/start_cypress.sh",
"test:coverage": "npx nyc report --reporter=lcov --reporter=text-summary && echo '\nOpen coverage/lcov-report/index.html for html view'"
"test:coverage": "npx nyc report --reporter=lcov --reporter=text-summary && echo '\nOpen coverage/lcov-report/index.html for html view'",
"zip": "cd ./dist/ui && for i in */; do zip -r \"${i%/}.zip\" \"$i\"; done",
"release": "rm -rf ./dist/ui && npm run build && npm run build-cdn-demo && npm run zip"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daanleenders daanleenders marked this pull request as ready for review April 19, 2022 12:31
… release/2.0.0-alpha.1

� Conflicts:
�	.babelrc
�	cypress/integration/api-class_spec.js
�	cypress/integration/ui_spec.js
�	index.html
�	package-lock.json
�	package.json
�	src/Api/Api.js
�	src/UI/App.jsx
�	src/UI/Buttons/HeaderButton.jsx
�	src/UI/Chat.jsx
�	src/UI/Chat.module.css
�	src/UI/Launcher.jsx
�	src/UI/Launcher.module.css
�	src/UI/ReplyText.jsx
�	src/UI/Scripts/Context.js
�	src/UI/Scripts/WorkingHours.js
@Gerben-T
Copy link
Collaborator Author

Merge conflicts worden opgelost met parley-messaging/web-library-v1#25

Gerben-T and others added 2 commits April 26, 2022 08:44
* Add support for strict CSP's (#8)

* Initial commit

* Initial commit

* Use babel-eslint parser to support arrow functions (and other)

* Use babel-eslint parser to support arrow functions (part 2)

* Intitial commit for components

* Add Api abstraction layer

This abstraction layer is the base layer which contains all the Api calls done with fetch().

* Add step comments to EventLog.jsx

* Add some comments to api scripts

* We dont have a release branch anymore (due to creating a new repo)

* Fix ESLint issues, especially no-invalid-this

no-invalid-this had to be replaced by @babel/no-invalid-this, otherwise it would show false positives in arrow functions

* Removed console logs and fixed `curly` rule to be used always

* Innitial commit for:
Announcement
Image.jsx
ImageViewer.jsx
ReplyActions.jsx

Removed
MarkdownText.jsx

Changed:
Arrow functions and removed binds
Disabled Image.jsx (not required in first version)

* Add build targets to package.json

* Remove babel presets that are handled automatically in Parcel beta 3

https://v2.parceljs.org/blog/beta3/

Had to install a plugin for eslint otherwise it showed errors because it is missing je react-preset

* Working on build targets

* Added .postcssrc for more control over CSS transformations

* Update readme with info about building

* Add CSP

* Pulled from /components

* Pulled from /build

* Create index.html with CSP

* Forgot to load the css stylesheet

* Add Cypress and Polling and first basic test

* Add unit tests for polling mechanism

* Implement PollingService in ApiEventTarget

And demo this in the example application

* Implement Polling Service in UI (because we don't use the logic in ApiEventTarget anymore)

* Add polling test for restartPolling()

* Fix regex

* Remove duplicated files

* Remove duplicated files

* Only stop(& restart) the polling interval when we go on to the next interval

If we keep the current interval there is no need to stop and restart..

* Reset variables when calling restartPolling()

* Remove unneeded dependency with account/deviceIdentification

* Rename stuff & fix issue with `currentIntervalAmount` being greater than the max

Also fixed last test for polling; it didn't stop after `resolve()` so it needed a `return`

* Remove config const for polling tests and let each test define their own

also lowered the intervals for the first test

* Use timeouts in Polling

* Rename message send event to "sent" (past tense)

* Rename interfaceTexts.js to tempConfig.js, becuase we will be storing config values aswell

Also disabled quickreplies

* Start polling when device is subscribed and reset polling when message is sent

Also added; Message sending on submit, Device registration when chat opens, Stop polling on unmount

* Disable input field while sending message to parley

* Remove comments about implementing stuff later

We have tickets and that should be enough

* Use ow package to validate params

* Rename var to timeout

* Remove commented console logs

* Wait for getMessages before continuing the next interval

* Forgot a variable

* Test polling reaction to api events

* Show messages in conversation

* Restart polling when there is focus on the input field

Also open the chat when there is a new message

* Fixed issue in code that finds a new message id

* Let Conversation.jsx restart polling when it mounts

This way you should always see your new messages when the conversation window opens

* Scroll down when there is a new message

* Suppress eslint error

When i remove this variable the IDEA complains about the override not being the same as the original..

* Only render Agent's name once if there are more agent messages

* Refocus input field after sending a message

* Updating axe-core

Was hoping this would fix it..

* Remove auto start of polling in constructor

Also clear event listeners on stopPolling()
And fixed tests

* Restart polling when page/window receives visibility/focus

* Fix scroll to bottom when new messages come in

Had to compare last id's instead of array lengths because the API gives out max 50 messages..

* Fix typo in test

* Merge

* Only load code-coverage code when in development mode

* (re)create index CSP file

* Turn default imports (css) into namespace imports

https://v2.parceljs.org/languages/postcss/#css-modules-tree-shaking

* Fix issue where CSS was not correctly build in index_CSP.html

* Dont check unused vars in args because they can conflict with phpstorm's "signature mismatch" inspection

* No need for a variable here

* Remove unused npmrc

* Use Parcel nightly for css scope hoisting fix

fix: parcel-bundler/parcel#6489
Also used parcel's babel presets as defined here: https://v2.parceljs.org/languages/babel/#extending-the-default-babel-config

* Remove idea gitignore (we have our own one)

* Revert change to parley-web-library.iml

* Remove pageVisibilityApi.js, we dont need it anymore

* Make sure fontawesome css is bundled in our css

so that we don't need to include it separately in the index.html

* Remove axe-core and fix csp

* Dont need postcss (installed automatically by Parcel)

* Fix building css finally

Co-authored-by: Gydo Titulaer <gydo.titulaer@tracebuzz.com>
Co-authored-by: Daan Leenders <daan@tracebuzz.com>

* Save device registration in storage (#9)

* Save device registration in local storage and check it upon `subscribeDevice()`

* Add ability to load settings from window.parleySettings (for now)

* Add start wrapper function for loading the chat in the advanced demo page (for now)

* Add css to index.html

* Use namespace imports for styles

* Use parcel's own babel presets

* Use css scoped names

* Fix issue with Parcel

* Add js for demo page (taken from v1 so not optimized, might also be temporary)

* Only load code coverage on development builds

* Compare localStorage device information with new one when calling subscribeDevice

when they both match, it means we don't have any new data for the api
so calling it would be a waste of resources.

* Add authorization and language options to demo

# Conflicts:
#	index.js
#	parleycdn-demo/index.html

* Add authorization and language options to demo

* Compare authorization before registering device

* Make storage prefix customizable

Somehow is also missed some npm packages so i needed to install those

* Add storage prefix from settings

* Update index.html

Co-authored-by: Daan Leenders <daanleenders@gmail.com>

Co-authored-by: Daan Leenders <daanleenders@gmail.com>

* Implements the configuration (#10)

* Fix problem where error notification returned a object and not just text

also added the use of `ApiGenericError` for errors when the API didn't provide one

* Add context providers

also handle/show errors in chat
also remove axe-core (doesn't work and keeps throwing errors)

* Add tests for ui errors

* Working changing language

* No need for contextType

* Create test for testing parley settings reactivity

* Make window.parleySettings reactive using Proxies

also; moved/renamed context.js => Scripts/Context.js
also; add a Logger for logging stuff with log levels

* When language changes, make sure the interfaceTexts overrides stay the same

when overriding interfaceTexts using `window.parleySettings.runOptions.interfaceTexts` and switching language, we don't want your custom overrides to get replaced by the InterfaceText.{language} defaults

* Create new Api instance (and device) when switching roomNumber

* Re-register device when authHeader changes

* Re-register device when userAdditionalInformation changes

* When infoText setting changes, the UI needs to change as well

Also; fixed issue where proxy would keep triggering `setState()` after being unmounted
Also; added eslint plugin to remove unused imports

* When placeholderMessenger setting changes, the UI needs to change as well

Also; added plugin to disallow `.only` tests

* Add some comments

* Change how Proxy works to make it more robust and easier to understand

Also; renamed v1 props to v2 in InterfaceTexts
Also; moved some functions around
Also; added jsdocs
Also; fixed issue where errorNotfication render gave an error that it didn't exist

* Add workingHours (weekdays) and hideChatOutsideWorkingHours (hideChatAfterBusinessHours) settings

Also; made them hide the Launcher if we are outside working hours and hideChatxxx is true
Also; Copied the script from v1 that checks if we are inside/outside working hours

* Add mobile recognition

* Add device version to state

* Move country to runOptions layer

* Authorization can't be empty when calling subscribeDevice()

* Fix issue where device version is empty if it didn't have pre-release tags

* Add hide button for error messages

* Default value for error message colors

* Load all interface texts default on construct

* Remove todo comments

* Set stylelint config path to auto-detect

somehow Phpstorm was messing up the path (probably because of a new update..)

* Remove unused css

* Rename referer to referrer if we are talking about anything other than the HTTP header / Api payload

* Remove unused var and remove optional params

* Make sure code coverage and index.html are CSP compliant

* Not sure why Phpstorm deleted this but i don't think it is important

* Data can be null if no messages are found, so it's better if we check if data is set

* Remove eslint rule `prefer-promise-reject-errors`

We don't need to throw an Error here with a stack trace because the API made the error so there is no stack trace that points to the API..

* Return `null` when get messages api call throws an error

* fix typo

* Remove event listener on unmount

* Make the api generic error configurable in the UI

* Make unit tests for working hours script

* Add code coverage for unit test

* Add missing tests so we reach ~99% code coverage

I can't test line 92 on workingHours.js because it checks the current date and to change that i need to change the system time..

* Install light-server to serve code coverage page with live reload

Couldn't use `parcel serve` for this because the index.html page contained multiple assets

* Use array destructuring for readability

* Use `toLocaleString()` so we don't need an extra array

* Make sure office hours are 24/7 otherwise tests will fail

* Add an extra test which tests the `false` part of the `format [day, start, end, false]` office hours format

* Add storagePrefix to state

* Use `componentDidUpdate()` instead of `shouldComponentUpdate()` because it is a better place for these checks

* Ignore stuff we don't need in the repo

* Forgot to change copied test

Also ignore gitlink

* Don't allow falsy values in the `state.messages`, it should always be an array

* Fix some bad merges

* Add functionality that clears your local messages if you don't have access (anymore) to the API

Co-authored-by: Gydo Titulaer <gydo.titulaer@tracebuzz.com>
Co-authored-by: Daan Leenders <daan@tracebuzz.com>
Co-authored-by: Daan Leenders <daanleenders@gmail.com>
…ase/2.0.0-alpha.1

# Conflicts:
#	cypress/integration/ui_spec.js
#	src/UI/Conversation.jsx
@Gerben-T
Copy link
Collaborator Author

Merged in #13
Daar gaat de PR verder

@Gerben-T Gerben-T closed this Jun 22, 2022
@daanleenders daanleenders deleted the release/2.0.0-alpha.1 branch June 28, 2022 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants