Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solve merge conflicts from merge: master into v2.0.0-alpha.1 (#25)
* 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>
- Loading branch information