@availity/feedback 6.2.14-alpha.3 → 6.2.14
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.
- package/CHANGELOG.md +1663 -1655
- package/LICENSE +20 -20
- package/README.md +25 -25
- package/index.d.ts +3 -3
- package/package.json +3 -3
- package/src/Feedback.d.ts +25 -25
- package/src/Feedback.js +102 -102
- package/src/FeedbackButton.d.ts +9 -9
- package/src/FeedbackDropdown.d.ts +14 -14
- package/src/FeedbackForm.d.ts +31 -31
- package/src/FeedbackModal.d.ts +9 -9
- package/src/SmileField.js +79 -79
- package/src/SupportForm.js +149 -149
package/src/SupportForm.js
CHANGED
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Button, ModalBody, ModalHeader, ModalFooter } from 'reactstrap';
|
|
4
|
-
import { Form } from '@availity/form';
|
|
5
|
-
import { AvOrganizationSelect } from '@availity/select/resources';
|
|
6
|
-
import * as yup from 'yup';
|
|
7
|
-
import nativeForm from '@availity/native-form';
|
|
8
|
-
import { avOrganizationsApi, avWebQLApi } from '@availity/api-axios';
|
|
9
|
-
import '@availity/yup';
|
|
10
|
-
|
|
11
|
-
const SUPPORT_PERMISSION_ID = '7205';
|
|
12
|
-
|
|
13
|
-
const ORG_VALIDATION_MESSAGE = 'Please select an organization from the dropdown.';
|
|
14
|
-
|
|
15
|
-
const getToken = () => document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, '$1');
|
|
16
|
-
|
|
17
|
-
const openSupport = async (values, setBlocking, setSupportIsActive, feedbackToggle) => {
|
|
18
|
-
setBlocking(true);
|
|
19
|
-
const orgsResp = await avOrganizationsApi.getOrganizations(SUPPORT_PERMISSION_ID);
|
|
20
|
-
let salesforceResponse;
|
|
21
|
-
if (orgsResp.data.organizations.some((org) => org.id === values.organization.id)) {
|
|
22
|
-
salesforceResponse = await avWebQLApi.create({
|
|
23
|
-
query: `
|
|
24
|
-
query salesforceUser($organizationId: ID!) {
|
|
25
|
-
salesforceUser(organizationId: $organizationId) {
|
|
26
|
-
id
|
|
27
|
-
accountId
|
|
28
|
-
newCommunity
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
`,
|
|
32
|
-
variables: {
|
|
33
|
-
organizationId: values.organization.id,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
let href = 'mailto:support@availity.com';
|
|
39
|
-
const target = '_top';
|
|
40
|
-
|
|
41
|
-
if (!salesforceResponse || !salesforceResponse.data) {
|
|
42
|
-
window.open(href, target);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const salesforceData = salesforceResponse.data.data.salesforceUser;
|
|
46
|
-
const ssoId = 'BJx3fqX3BH';
|
|
47
|
-
const newCommutySsoId = 'E-t_s_JQ0P';
|
|
48
|
-
|
|
49
|
-
if (salesforceData) {
|
|
50
|
-
const attributes = {
|
|
51
|
-
orgGenKey: values.organization.customerId,
|
|
52
|
-
organizationName: values.organization.name,
|
|
53
|
-
partyId: values.organization.id,
|
|
54
|
-
payerId: 'AVAILITY',
|
|
55
|
-
X_Client_ID: '5430d59f-c5cc-4be7-be5a-34472ec30fe9',
|
|
56
|
-
X_XSRF_TOKEN: getToken(),
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
if (salesforceData.id && salesforceData.accountId) {
|
|
60
|
-
attributes.avSalesForceContactId = salesforceData.id;
|
|
61
|
-
attributes.avSalesForceContactAccId = salesforceData.accountId;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
href = `/ms/api/availity/internal/spc/magneto/sso/v1/saml/${salesforceData.newCommunity ? newCommutySsoId : ssoId}`;
|
|
65
|
-
|
|
66
|
-
await nativeForm(ssoId, attributes, { action: href, target: '_blank' }, 'saml');
|
|
67
|
-
setBlocking(false);
|
|
68
|
-
} else {
|
|
69
|
-
window.open(href, target);
|
|
70
|
-
}
|
|
71
|
-
setSupportIsActive(false);
|
|
72
|
-
feedbackToggle(false);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
function orgSelectTest(msg) {
|
|
76
|
-
const orgSelectSchema = yup.object().shape({
|
|
77
|
-
id: yup.string().isRequired(true, ORG_VALIDATION_MESSAGE),
|
|
78
|
-
name: yup.string().isRequired(true, ORG_VALIDATION_MESSAGE),
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
return this.test({
|
|
82
|
-
name: 'orgSelectTest',
|
|
83
|
-
exclusive: true,
|
|
84
|
-
message: msg || 'This field is invalid.',
|
|
85
|
-
async test(componentValue) {
|
|
86
|
-
if (!componentValue) return true;
|
|
87
|
-
|
|
88
|
-
const valid = await orgSelectSchema.isValid(componentValue);
|
|
89
|
-
return valid;
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
yup.addMethod(yup.object, 'orgSelectTest', orgSelectTest);
|
|
95
|
-
|
|
96
|
-
const SupportForm = ({ setSupportIsActive, setBlocking, feedbackToggle }) => (
|
|
97
|
-
<>
|
|
98
|
-
<ModalHeader id="support-form-header" role="heading" aria-level="2" className="h5" tag="div">
|
|
99
|
-
Open Support Ticket
|
|
100
|
-
</ModalHeader>
|
|
101
|
-
<Form
|
|
102
|
-
aria-label="Support Form"
|
|
103
|
-
aria-describedby="support-form-header"
|
|
104
|
-
role="form"
|
|
105
|
-
data-testid="support-form"
|
|
106
|
-
initialValues={{
|
|
107
|
-
organization: undefined,
|
|
108
|
-
}}
|
|
109
|
-
validationSchema={yup.object({
|
|
110
|
-
organization: yup
|
|
111
|
-
.object()
|
|
112
|
-
.orgSelectTest(ORG_VALIDATION_MESSAGE)
|
|
113
|
-
.isRequired(ORG_VALIDATION_MESSAGE)
|
|
114
|
-
.typeError(ORG_VALIDATION_MESSAGE),
|
|
115
|
-
})}
|
|
116
|
-
onSubmit={(values) => openSupport(values, setBlocking, setSupportIsActive, feedbackToggle)}
|
|
117
|
-
>
|
|
118
|
-
<ModalBody>
|
|
119
|
-
<AvOrganizationSelect
|
|
120
|
-
name="organization"
|
|
121
|
-
label="Select an Organization"
|
|
122
|
-
data-testid="org-dropdown"
|
|
123
|
-
getResult={(data) => data.organizations}
|
|
124
|
-
/>
|
|
125
|
-
</ModalBody>
|
|
126
|
-
<ModalFooter>
|
|
127
|
-
<Button
|
|
128
|
-
onClick={() => setSupportIsActive(false)}
|
|
129
|
-
color="secondary"
|
|
130
|
-
type="button"
|
|
131
|
-
onKeyDown={({ keyCode }) => keyCode === 13 && setSupportIsActive(false)}
|
|
132
|
-
>
|
|
133
|
-
Close
|
|
134
|
-
</Button>
|
|
135
|
-
<Button data-testid="submit-btn" type="submit" color="primary">
|
|
136
|
-
Continue
|
|
137
|
-
</Button>
|
|
138
|
-
</ModalFooter>
|
|
139
|
-
</Form>
|
|
140
|
-
</>
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
SupportForm.propTypes = {
|
|
144
|
-
setSupportIsActive: PropTypes.func,
|
|
145
|
-
setBlocking: PropTypes.func,
|
|
146
|
-
feedbackToggle: PropTypes.func,
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export default SupportForm;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Button, ModalBody, ModalHeader, ModalFooter } from 'reactstrap';
|
|
4
|
+
import { Form } from '@availity/form';
|
|
5
|
+
import { AvOrganizationSelect } from '@availity/select/resources';
|
|
6
|
+
import * as yup from 'yup';
|
|
7
|
+
import nativeForm from '@availity/native-form';
|
|
8
|
+
import { avOrganizationsApi, avWebQLApi } from '@availity/api-axios';
|
|
9
|
+
import '@availity/yup';
|
|
10
|
+
|
|
11
|
+
const SUPPORT_PERMISSION_ID = '7205';
|
|
12
|
+
|
|
13
|
+
const ORG_VALIDATION_MESSAGE = 'Please select an organization from the dropdown.';
|
|
14
|
+
|
|
15
|
+
const getToken = () => document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, '$1');
|
|
16
|
+
|
|
17
|
+
const openSupport = async (values, setBlocking, setSupportIsActive, feedbackToggle) => {
|
|
18
|
+
setBlocking(true);
|
|
19
|
+
const orgsResp = await avOrganizationsApi.getOrganizations(SUPPORT_PERMISSION_ID);
|
|
20
|
+
let salesforceResponse;
|
|
21
|
+
if (orgsResp.data.organizations.some((org) => org.id === values.organization.id)) {
|
|
22
|
+
salesforceResponse = await avWebQLApi.create({
|
|
23
|
+
query: `
|
|
24
|
+
query salesforceUser($organizationId: ID!) {
|
|
25
|
+
salesforceUser(organizationId: $organizationId) {
|
|
26
|
+
id
|
|
27
|
+
accountId
|
|
28
|
+
newCommunity
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`,
|
|
32
|
+
variables: {
|
|
33
|
+
organizationId: values.organization.id,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let href = 'mailto:support@availity.com';
|
|
39
|
+
const target = '_top';
|
|
40
|
+
|
|
41
|
+
if (!salesforceResponse || !salesforceResponse.data) {
|
|
42
|
+
window.open(href, target);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const salesforceData = salesforceResponse.data.data.salesforceUser;
|
|
46
|
+
const ssoId = 'BJx3fqX3BH';
|
|
47
|
+
const newCommutySsoId = 'E-t_s_JQ0P';
|
|
48
|
+
|
|
49
|
+
if (salesforceData) {
|
|
50
|
+
const attributes = {
|
|
51
|
+
orgGenKey: values.organization.customerId,
|
|
52
|
+
organizationName: values.organization.name,
|
|
53
|
+
partyId: values.organization.id,
|
|
54
|
+
payerId: 'AVAILITY',
|
|
55
|
+
X_Client_ID: '5430d59f-c5cc-4be7-be5a-34472ec30fe9',
|
|
56
|
+
X_XSRF_TOKEN: getToken(),
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
if (salesforceData.id && salesforceData.accountId) {
|
|
60
|
+
attributes.avSalesForceContactId = salesforceData.id;
|
|
61
|
+
attributes.avSalesForceContactAccId = salesforceData.accountId;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
href = `/ms/api/availity/internal/spc/magneto/sso/v1/saml/${salesforceData.newCommunity ? newCommutySsoId : ssoId}`;
|
|
65
|
+
|
|
66
|
+
await nativeForm(ssoId, attributes, { action: href, target: '_blank' }, 'saml');
|
|
67
|
+
setBlocking(false);
|
|
68
|
+
} else {
|
|
69
|
+
window.open(href, target);
|
|
70
|
+
}
|
|
71
|
+
setSupportIsActive(false);
|
|
72
|
+
feedbackToggle(false);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
function orgSelectTest(msg) {
|
|
76
|
+
const orgSelectSchema = yup.object().shape({
|
|
77
|
+
id: yup.string().isRequired(true, ORG_VALIDATION_MESSAGE),
|
|
78
|
+
name: yup.string().isRequired(true, ORG_VALIDATION_MESSAGE),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
return this.test({
|
|
82
|
+
name: 'orgSelectTest',
|
|
83
|
+
exclusive: true,
|
|
84
|
+
message: msg || 'This field is invalid.',
|
|
85
|
+
async test(componentValue) {
|
|
86
|
+
if (!componentValue) return true;
|
|
87
|
+
|
|
88
|
+
const valid = await orgSelectSchema.isValid(componentValue);
|
|
89
|
+
return valid;
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
yup.addMethod(yup.object, 'orgSelectTest', orgSelectTest);
|
|
95
|
+
|
|
96
|
+
const SupportForm = ({ setSupportIsActive, setBlocking, feedbackToggle }) => (
|
|
97
|
+
<>
|
|
98
|
+
<ModalHeader id="support-form-header" role="heading" aria-level="2" className="h5" tag="div">
|
|
99
|
+
Open Support Ticket
|
|
100
|
+
</ModalHeader>
|
|
101
|
+
<Form
|
|
102
|
+
aria-label="Support Form"
|
|
103
|
+
aria-describedby="support-form-header"
|
|
104
|
+
role="form"
|
|
105
|
+
data-testid="support-form"
|
|
106
|
+
initialValues={{
|
|
107
|
+
organization: undefined,
|
|
108
|
+
}}
|
|
109
|
+
validationSchema={yup.object({
|
|
110
|
+
organization: yup
|
|
111
|
+
.object()
|
|
112
|
+
.orgSelectTest(ORG_VALIDATION_MESSAGE)
|
|
113
|
+
.isRequired(ORG_VALIDATION_MESSAGE)
|
|
114
|
+
.typeError(ORG_VALIDATION_MESSAGE),
|
|
115
|
+
})}
|
|
116
|
+
onSubmit={(values) => openSupport(values, setBlocking, setSupportIsActive, feedbackToggle)}
|
|
117
|
+
>
|
|
118
|
+
<ModalBody>
|
|
119
|
+
<AvOrganizationSelect
|
|
120
|
+
name="organization"
|
|
121
|
+
label="Select an Organization"
|
|
122
|
+
data-testid="org-dropdown"
|
|
123
|
+
getResult={(data) => data.organizations}
|
|
124
|
+
/>
|
|
125
|
+
</ModalBody>
|
|
126
|
+
<ModalFooter>
|
|
127
|
+
<Button
|
|
128
|
+
onClick={() => setSupportIsActive(false)}
|
|
129
|
+
color="secondary"
|
|
130
|
+
type="button"
|
|
131
|
+
onKeyDown={({ keyCode }) => keyCode === 13 && setSupportIsActive(false)}
|
|
132
|
+
>
|
|
133
|
+
Close
|
|
134
|
+
</Button>
|
|
135
|
+
<Button data-testid="submit-btn" type="submit" color="primary">
|
|
136
|
+
Continue
|
|
137
|
+
</Button>
|
|
138
|
+
</ModalFooter>
|
|
139
|
+
</Form>
|
|
140
|
+
</>
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
SupportForm.propTypes = {
|
|
144
|
+
setSupportIsActive: PropTypes.func,
|
|
145
|
+
setBlocking: PropTypes.func,
|
|
146
|
+
feedbackToggle: PropTypes.func,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export default SupportForm;
|