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

Implements the configuration #10

Merged
merged 51 commits into from Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
9b777de
Fix problem where error notification returned a object and not just text
Gerben-T Jul 13, 2021
5eb9778
Add context providers
Gerben-T Jul 13, 2021
59bb371
Add tests for ui errors
Gerben-T Jul 13, 2021
393aa6d
Working changing language
Gerben-T Jul 14, 2021
5eea332
No need for contextType
Gerben-T Jul 14, 2021
dfc02eb
Create test for testing parley settings reactivity
Gerben-T Jul 16, 2021
13560b5
Make window.parleySettings reactive using Proxies
Gerben-T Jul 16, 2021
fea4039
When language changes, make sure the interfaceTexts overrides stay th…
Gerben-T Jul 16, 2021
fc28de2
Create new Api instance (and device) when switching roomNumber
Gerben-T Jul 20, 2021
50e1139
Re-register device when authHeader changes
Gerben-T Jul 20, 2021
3542aa0
Re-register device when userAdditionalInformation changes
Gerben-T Jul 20, 2021
4854e68
When infoText setting changes, the UI needs to change as well
Gerben-T Jul 20, 2021
f274f05
When placeholderMessenger setting changes, the UI needs to change as …
Gerben-T Jul 20, 2021
2fd3d07
Add some comments
Gerben-T Jul 20, 2021
f239f7c
Change how Proxy works to make it more robust and easier to understand
Gerben-T Jul 21, 2021
dcc72dd
Add workingHours (weekdays) and hideChatOutsideWorkingHours (hideChat…
Gerben-T Jul 21, 2021
328bc5b
Add mobile recognition
Gerben-T Jul 22, 2021
35b2e1d
Add device version to state
Gerben-T Jul 22, 2021
4e2024c
Move country to runOptions layer
Gerben-T Jul 23, 2021
cce605d
Authorization can't be empty when calling subscribeDevice()
Gerben-T Jul 23, 2021
13b9f5a
Fix issue where device version is empty if it didn't have pre-release…
Gerben-T Jul 23, 2021
40fb743
Add hide button for error messages
Gerben-T Jul 23, 2021
0e72bcc
Default value for error message colors
Gerben-T Jul 23, 2021
5eaea6f
Load all interface texts default on construct
Gerben-T Jul 23, 2021
d476092
Remove todo comments
Gerben-T Jul 23, 2021
1657bb0
Merge branch 'master' of github.com:parley-messaging/web-library into…
Gerben-T Sep 7, 2021
be4d769
Set stylelint config path to auto-detect
Gerben-T Sep 7, 2021
58cc022
Remove unused css
Gerben-T Sep 7, 2021
e8fd421
Rename referer to referrer if we are talking about anything other tha…
Gerben-T Apr 7, 2022
f658935
Remove unused var and remove optional params
Gerben-T Apr 7, 2022
cca9791
Make sure code coverage and index.html are CSP compliant
Gerben-T Apr 8, 2022
f1da31a
Not sure why Phpstorm deleted this but i don't think it is important
Gerben-T Apr 8, 2022
44a5922
Data can be null if no messages are found, so it's better if we check…
Gerben-T Apr 8, 2022
78f37f9
Remove eslint rule `prefer-promise-reject-errors`
Gerben-T Apr 8, 2022
5e43a14
Return `null` when get messages api call throws an error
Gerben-T Apr 8, 2022
b91f9df
fix typo
Gerben-T Apr 8, 2022
0305f85
Remove event listener on unmount
Gerben-T Apr 8, 2022
5bc92b0
Make the api generic error configurable in the UI
Gerben-T Apr 8, 2022
846e863
Make unit tests for working hours script
Gerben-T Apr 8, 2022
9f434e6
Add code coverage for unit test
Gerben-T Apr 8, 2022
9277f6f
Add missing tests so we reach ~99% code coverage
Gerben-T Apr 8, 2022
97f835e
Install light-server to serve code coverage page with live reload
Gerben-T Apr 8, 2022
ce694ec
Use array destructuring for readability
Gerben-T Apr 13, 2022
15e18dd
Use `toLocaleString()` so we don't need an extra array
Gerben-T Apr 13, 2022
035174c
Make sure office hours are 24/7 otherwise tests will fail
Gerben-T Apr 13, 2022
3655d2a
Add an extra test which tests the `false` part of the `format [day, s…
Gerben-T Apr 13, 2022
997ff5c
Merge branch 'master' of github.com:parley-messaging/web-library into…
Gerben-T Apr 13, 2022
18a4c43
Add storagePrefix to state
Gerben-T Apr 13, 2022
031b55d
Use `componentDidUpdate()` instead of `shouldComponentUpdate()` becau…
Gerben-T Apr 15, 2022
3324062
Ignore stuff we don't need in the repo
Gerben-T Apr 15, 2022
afbb281
Forgot to change copied test
Gerben-T Apr 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .eslintrc.json
Expand Up @@ -22,7 +22,8 @@
"react",
"jsx-a11y",
"@babel",
"cypress"
"cypress",
"unused-imports"
],
"rules": {
//Possible errors
Expand Down Expand Up @@ -99,6 +100,7 @@
"enforceForJSX": true
}
],
"unused-imports/no-unused-imports": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-return": "error",
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -19,3 +19,5 @@ ssl
# Testing & Code Coverage
/.nyc_output/
/coverage/
/cypress/videos
/cypress.local.json
19 changes: 0 additions & 19 deletions .idea/runConfigurations/Start.xml

This file was deleted.

3 changes: 3 additions & 0 deletions .postcssrc.json
@@ -1,6 +1,9 @@
{
"modules": true,
"plugins": {
"postcss-modules": {
"generateScopedName": "[local]__[contenthash]"
},
"autoprefixer": {},
"postcss-reporter": {
"plugins": [
Expand Down
4 changes: 3 additions & 1 deletion cypress.json
@@ -1 +1,3 @@
{}
{
"baseUrl": "https://chat-dev.parley.nu:8181"
}
6 changes: 5 additions & 1 deletion cypress/.eslintrc.json
@@ -1,10 +1,14 @@
{
"extends": "../.eslintrc.json",
"plugins": [
"no-only-tests"
],
"rules": {
"no-console": "off",
"no-magic-numbers": "off",
"arrow-body-style": "off",
"max-nested-callbacks": "off"
"max-nested-callbacks": "off",
"no-only-tests/no-only-tests": "error"
},
"ignorePatterns": ["plugins/index.js", "support/index.js"]
}
39 changes: 39 additions & 0 deletions cypress/fixtures/getMessagesResponse.json
@@ -0,0 +1,39 @@
{
"data": [
{
"id": 10737,
"time": 1536739259,
"message": "hi!",
"image": null,
"typeId": 2,
"agent": {
"id": 2,
"name": "Gerben",
"avatar": "https://beta.tracebuzz.com/images/avatars/1912991618/6033.jpg"
}
},
{
"id": 10736,
"time": 1536739157,
"message": "Hello, i have a question",
"image": null,
"typeId": 1,
"agent": null
}
],
"paging": {
"before": "",
"after": "/messages/after:10737"
},
"notifications": [],
"status": "SUCCESS",
"metadata": {
"values": {
"url": "messages"
},
"method": "get",
"duration": 0.01
},
"stickyMessage": "Sorry we are closed right know. We will be open next day from 09:00 - 17:55",
"welcomeMessage": "Welcome to our support chat, you can expect a response in ~1 minute."
}
20 changes: 20 additions & 0 deletions cypress/integration/api-class_spec.js
Expand Up @@ -16,6 +16,7 @@ const config = {
type: Web,
version: "010000",
message: "test message",
referer: "weblib-v2_cypress-test",
daanleenders marked this conversation as resolved.
Show resolved Hide resolved
};
const primitiveTypes = [
{
Expand Down Expand Up @@ -306,6 +307,25 @@ describe("Api class", () => {
});
});

it("should throw an error when using something other than a String as authorization", () => {
filterPrimitives([
"string",
"undefined", // Dont test for undefined, because authorization is optional and if we give undefined it will test for other params next
]).forEach((set) => {
expect(() => config.api.subscribeDevice(
config.pushToken,
config.pushType,
true,
config.userAdditionalInformation,
config.type,
config.version,
config.referer,
set.value,
Gerben-T marked this conversation as resolved.
Show resolved Hide resolved
))
.to.throw(`Expected \`authorization\` to be of type \`string\` but received type \`${set.type}\``);
});
});

it("should default referer to window.location.href", () => {
config.api.subscribeDevice(
config.pushToken,
Expand Down