@rh-support/react-context 0.3.5 → 0.3.6
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/lib/esm/components/EmbeddedServiceChat/embeddedServiceChat.css +5 -0
- package/lib/esm/hooks/index.d.ts +1 -0
- package/lib/esm/hooks/index.d.ts.map +1 -1
- package/lib/esm/hooks/index.js +1 -0
- package/lib/esm/hooks/useChatConfig.d.ts +20 -0
- package/lib/esm/hooks/useChatConfig.d.ts.map +1 -0
- package/lib/esm/hooks/useChatConfig.js +58 -0
- package/lib/esm/hooks/useChatInit.d.ts.map +1 -1
- package/lib/esm/hooks/useChatInit.js +5 -10
- package/package.json +2 -2
package/lib/esm/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC"}
|
package/lib/esm/hooks/index.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* This hook is used for selected chat configuration based on environment
|
|
4
|
+
*/
|
|
5
|
+
export declare const useChatConfig: () => {
|
|
6
|
+
host: string;
|
|
7
|
+
sandBox: string;
|
|
8
|
+
gslbBaseURL: string;
|
|
9
|
+
key: string;
|
|
10
|
+
appName: string;
|
|
11
|
+
extra: {
|
|
12
|
+
baseLiveAgentContentURL: string;
|
|
13
|
+
deploymentId: string;
|
|
14
|
+
buttonId: string;
|
|
15
|
+
baseLiveAgentURL: string;
|
|
16
|
+
eswLiveAgentDevName: string;
|
|
17
|
+
isOfflineSupportEnabled: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useChatConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChatConfig.d.ts","sourceRoot":"","sources":["../../../src/hooks/useChatConfig.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;CAoDzB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Env } from '@cee-eng/hydrajs';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* This hook is used for selected chat configuration based on environment
|
|
5
|
+
*/
|
|
6
|
+
export const useChatConfig = () => {
|
|
7
|
+
const env = Env.getEnvName();
|
|
8
|
+
switch (env) {
|
|
9
|
+
case Env.EnvNames.QA:
|
|
10
|
+
return {
|
|
11
|
+
host: 'https://gss--qa.my.salesforce.com',
|
|
12
|
+
sandBox: 'https://qa-gssdex.cs203.force.com/botchat',
|
|
13
|
+
gslbBaseURL: 'https://service.force.com',
|
|
14
|
+
key: '00D7j0000008oSo',
|
|
15
|
+
appName: 'RedHatChatBot',
|
|
16
|
+
extra: {
|
|
17
|
+
baseLiveAgentContentURL: 'https://c.la3-c1cs-ia4.salesforceliveagent.com/content',
|
|
18
|
+
deploymentId: '5727j0000004CqR',
|
|
19
|
+
buttonId: '5737j0000004CKB',
|
|
20
|
+
baseLiveAgentURL: 'https://d.la3-c1cs-ia4.salesforceliveagent.com/chat',
|
|
21
|
+
eswLiveAgentDevName: 'EmbeddedServiceLiveAgent_Parent04I7j000000CadEEAS_180b2280b37',
|
|
22
|
+
isOfflineSupportEnabled: false,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
case Env.EnvNames.STAGE:
|
|
26
|
+
return {
|
|
27
|
+
host: 'https://gss--Stage2.my.salesforce.com',
|
|
28
|
+
sandBox: 'https://stage2-gssdex.cs16.force.com/botchat',
|
|
29
|
+
gslbBaseURL: 'https://service.force.com',
|
|
30
|
+
key: '00Df0000003f0P8',
|
|
31
|
+
appName: 'RedHatChatBot',
|
|
32
|
+
extra: {
|
|
33
|
+
baseLiveAgentContentURL: 'https://c.la1-c1cs-ord.salesforceliveagent.com/content',
|
|
34
|
+
deploymentId: '572f00000008QON',
|
|
35
|
+
buttonId: '573f00000008QWv',
|
|
36
|
+
baseLiveAgentURL: 'https://d.la1-c1cs-ord.salesforceliveagent.com/chat',
|
|
37
|
+
eswLiveAgentDevName: 'EmbeddedServiceLiveAgent_Parent04If00000004CPqEAM_180cd4fc482',
|
|
38
|
+
isOfflineSupportEnabled: false,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
default:
|
|
42
|
+
return {
|
|
43
|
+
host: 'https://gss--qa.my.salesforce.com',
|
|
44
|
+
sandBox: 'https://qa-gssdex.cs203.force.com/botchat',
|
|
45
|
+
gslbBaseURL: 'https://service.force.com',
|
|
46
|
+
key: '00D7j0000008oSo',
|
|
47
|
+
appName: 'RedHatChatBot',
|
|
48
|
+
extra: {
|
|
49
|
+
baseLiveAgentContentURL: 'https://c.la3-c1cs-ia4.salesforceliveagent.com/content',
|
|
50
|
+
deploymentId: '5727j0000004CqR',
|
|
51
|
+
buttonId: '5737j0000004CKB',
|
|
52
|
+
baseLiveAgentURL: 'https://d.la3-c1cs-ia4.salesforceliveagent.com/chat',
|
|
53
|
+
eswLiveAgentDevName: 'EmbeddedServiceLiveAgent_Parent04I7j000000CadEEAS_180b2280b37',
|
|
54
|
+
isOfflineSupportEnabled: false,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChatInit.d.ts","sourceRoot":"","sources":["../../../src/hooks/useChatInit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useChatInit.d.ts","sourceRoot":"","sources":["../../../src/hooks/useChatInit.ts"],"names":[],"mappings":"AAMA,UAAU,YAAY;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,kBAAkB,OAAO,KAAW,YAmD3D,CAAC"}
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { useState } from 'react';
|
|
11
11
|
import { extraPreChatInfo } from '../components/EmbeddedServiceChat/ExtraPreChatInfo';
|
|
12
|
+
import { useChatConfig } from './useChatConfig';
|
|
12
13
|
import { usePreChatFormDetails } from './usePreChatFormDetails';
|
|
13
14
|
/**
|
|
14
15
|
* This hook is used for setting chat up and listing custom event of chat.
|
|
@@ -21,6 +22,7 @@ export const useChatInit = (initialState = false) => {
|
|
|
21
22
|
// Need to set loading status true as it will prevent starting chat before loading necessary dependencies
|
|
22
23
|
const [loadingChat, setLoadingChat] = useState(true);
|
|
23
24
|
const getChatFormDetails = usePreChatFormDetails();
|
|
25
|
+
const { host, sandBox, gslbBaseURL, key, appName, extra } = useChatConfig();
|
|
24
26
|
const onStartChat = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
27
|
setLoadingChat(true);
|
|
26
28
|
yield window.embedded_svc.liveAgentAPI.startChat({
|
|
@@ -32,23 +34,16 @@ export const useChatInit = (initialState = false) => {
|
|
|
32
34
|
});
|
|
33
35
|
const initEmbedChat = () => {
|
|
34
36
|
const extraPreChatFormDetails = getChatFormDetails();
|
|
35
|
-
initESW(
|
|
37
|
+
initESW(extraPreChatFormDetails);
|
|
36
38
|
};
|
|
37
|
-
const initESW = (
|
|
39
|
+
const initESW = (extraPreChatFormDetails) => {
|
|
38
40
|
window.embedded_svc.settings.displayHelpButton = false; //Or false
|
|
39
41
|
window.embedded_svc.settings.language = 'en'; //For example, enter 'en' or 'en-US'
|
|
40
42
|
window.embedded_svc.settings.enabledFeatures = ['LiveAgent'];
|
|
41
43
|
window.embedded_svc.settings.entryFeature = 'LiveAgent';
|
|
42
44
|
window.embedded_svc.settings.extraPrechatFormDetails = extraPreChatFormDetails;
|
|
43
45
|
window.embedded_svc.settings.extraPrechatInfo = extraPreChatInfo;
|
|
44
|
-
window.embedded_svc.init(
|
|
45
|
-
baseLiveAgentContentURL: 'https://c.la3-c1cs-ia4.salesforceliveagent.com/content',
|
|
46
|
-
deploymentId: '5727j0000004CqR',
|
|
47
|
-
buttonId: '5737j0000004CKB',
|
|
48
|
-
baseLiveAgentURL: 'https://d.la3-c1cs-ia4.salesforceliveagent.com/chat',
|
|
49
|
-
eswLiveAgentDevName: 'EmbeddedServiceLiveAgent_Parent04I7j000000CadEEAS_180b2280b37',
|
|
50
|
-
isOfflineSupportEnabled: false,
|
|
51
|
-
});
|
|
46
|
+
window.embedded_svc.init(host, sandBox, gslbBaseURL, key, appName, extra);
|
|
52
47
|
// Fired when Embedded Service Chat has ended and the application is closed.
|
|
53
48
|
window.embedded_svc.addEventHandler('afterDestroy', function (data) {
|
|
54
49
|
setChatStart(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/react-context",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"not ie <= 11",
|
|
88
88
|
"not op_mini all"
|
|
89
89
|
],
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "dcac4c87edfdc2e855b7ea5b3058be26133b701b"
|
|
91
91
|
}
|