@microsoft/ocsdk 0.5.14-main.38e168f → 0.5.15-main.75e2923

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/README.md CHANGED
@@ -6,47 +6,54 @@
6
6
  This repo contains the source code for getting up and running with the Omnichannel SDK on the web using standard web technologies and on mobile using React Native.
7
7
 
8
8
  # Getting Started
9
+
9
10
  ## Prerequisites
11
+
10
12
  - [Node v12.13.0](https://nodejs.org/en/) (or equivalent)
11
13
  - [npm](https://www.npmjs.com/)
12
14
 
13
15
  ## Installation
14
16
 
15
- ```
17
+ ```console
16
18
  npm install
17
19
  ```
18
20
 
19
21
  ## Build
20
22
 
21
23
  ### Load SDK in memory and watches the changes for development
22
- ```
24
+
25
+ ```console
23
26
  npm run watch
24
27
  ```
25
28
 
26
29
  ### Build SDK for development
27
- ```
30
+
31
+ ```console
28
32
  npm run build:dev
29
33
  ```
30
34
 
31
35
  ### Build SDK for production
32
- ```
36
+
37
+ ```console
33
38
  npm run build:prod
34
39
  ```
35
40
 
36
41
  ### Check lint rules
37
- ```
42
+
43
+ ```console
38
44
  npm run lint
39
- ```
45
+ ```console
40
46
  Lint checks is enabled by default in watch mode.
41
47
 
42
48
  # Examples
43
49
 
44
50
  ### Initialize SDK
51
+
45
52
  ```js
46
53
  const params = {
47
- orgUrl: '',
48
- orgId: '',
49
- widgetId: '',
54
+ orgUrl: '',
55
+ orgId: '',
56
+ widgetId: '',
50
57
  }
51
58
 
52
59
  const ocsdk = Microsoft.CRM.Omnichannel.SDK.SDKProvider.getSDK(params);
@@ -54,11 +61,12 @@ window.ocsdk = ocsdk;
54
61
  ```
55
62
 
56
63
  ### Initialize SDK with custom configuration
64
+
57
65
  ```js
58
66
  const params = {
59
- orgUrl: '',
60
- orgId: '',
61
- widgetId: '',
67
+ orgUrl: '',
68
+ orgId: '',
69
+ widgetId: '',
62
70
  }
63
71
 
64
72
  const configuration = {
@@ -72,34 +80,36 @@ window.ocsdk = ocsdk;
72
80
  ```
73
81
 
74
82
  ### Get Chat Config
83
+
75
84
  ```js
76
85
  // Manually generate request id
77
86
  const requestId = Microsoft.CRM.Omnichannel.SDK.Util.uuidv4();
78
87
  try {
79
- const config = await window.ocsdk.getChatConfig(requestId);
80
- // success
88
+ const config = await window.ocsdk.getChatConfig(requestId);
89
+ // success
81
90
  } catch {
82
- // failure
91
+ // failure
83
92
  }
84
93
 
85
94
  // Auto generate request id
86
95
  try {
87
- const config = await window.ocsdk.getChatConfig();
88
- // success
96
+ const config = await window.ocsdk.getChatConfig();
97
+ // success
89
98
  } catch {
90
- // failure
99
+ // failure
91
100
  }
92
101
  ```
93
102
 
94
103
  ### Get Chat Token
104
+
95
105
  ```js
96
106
  // Manually generate request id
97
107
  const requestId = Microsoft.CRM.Omnichannel.SDK.Util.uuidv4();
98
108
  try {
99
- const chatToken = await window.ocsdk.getChatToken(requestId);
100
- // success
109
+ const chatToken = await window.ocsdk.getChatToken(requestId);
110
+ // success
101
111
  } catch {
102
- // failure
112
+ // failure
103
113
  }
104
114
 
105
115
  // Auto generate request id
@@ -114,6 +124,7 @@ try {
114
124
  ```
115
125
 
116
126
  ### Session Init
127
+
117
128
  ```js
118
129
  const requestId = Microsoft.CRM.Omnichannel.SDK.Util.uuidv4();
119
130
  const optionalParams = {
@@ -132,14 +143,15 @@ const optionalParams = {
132
143
  };
133
144
 
134
145
  try {
135
- await window.ocsdk.sessionInit(requestId, optionalParams);
136
- // success
146
+ await window.ocsdk.sessionInit(requestId, optionalParams);
147
+ // success
137
148
  } catch {
138
- // failure
149
+ // failure
139
150
  }
140
151
  ```
141
152
 
142
153
  ### Session Close
154
+
143
155
  ```js
144
156
  const requestId = Microsoft.CRM.Omnichannel.SDK.Util.uuidv4();
145
157
  const optionalParams = {
@@ -147,14 +159,15 @@ const optionalParams = {
147
159
  };
148
160
 
149
161
  try {
150
- await window.ocsdk.sessionClose(requestId, optionalParams);
151
- // success
162
+ await window.ocsdk.sessionClose(requestId, optionalParams);
163
+ // success
152
164
  } catch {
153
- // failure
165
+ // failure
154
166
  }
155
167
  ```
156
168
 
157
169
  ### Submit PostChat Response
170
+
158
171
  ```js
159
172
  const requestId = Microsoft.CRM.Omnichannel.SDK.Util.uuidv4();
160
173
  const postChatResponse = {};
@@ -163,14 +176,15 @@ const optionalParams = {
163
176
  };
164
177
 
165
178
  try {
166
- await window.ocsdk.submitPostChatResponse(requestId, postChatResponse, optionalParams);
167
- // success
179
+ await window.ocsdk.submitPostChatResponse(requestId, postChatResponse, optionalParams);
180
+ // success
168
181
  } catch {
169
- // failure
182
+ // failure
170
183
  }
171
184
  ```
172
185
 
173
186
  ### Get Chat Transcripts
187
+
174
188
  ```js
175
189
  const requestId = Microsoft.CRM.Omnichannel.SDK.Util.uuidv4();
176
190
  const chatId = ''; // Chat thread ID
@@ -180,14 +194,15 @@ const optionalParams = {
180
194
  };
181
195
 
182
196
  try {
183
- const response = await window.ocsdk.getChatTranscripts(requestId, chatId, token, optionalParams);
184
- // success
197
+ const response = await window.ocsdk.getChatTranscripts(requestId, chatId, token, optionalParams);
198
+ // success
185
199
  } catch {
186
- // failure
200
+ // failure
187
201
  }
188
202
  ```
189
203
 
190
204
  ### Email Transcript
205
+
191
206
  ```js
192
207
  const requestId = Microsoft.CRM.Omnichannel.SDK.Util.uuidv4();
193
208
  const token = ''; // Skype token
@@ -202,14 +217,15 @@ const optionalParams = {
202
217
  };
203
218
 
204
219
  try {
205
- await window.ocsdk.emailTranscript(requestId, token, emailRequestBody, optionalParams);
206
- // success
220
+ await window.ocsdk.emailTranscript(requestId, token, emailRequestBody, optionalParams);
221
+ // success
207
222
  } catch {
208
- // failure
223
+ // failure
209
224
  }
210
225
  ```
211
226
 
212
227
  ### Fetch Data Masking Info
228
+
213
229
  ```js
214
230
  // Manually generate request id
215
231
  const requestId = Microsoft.CRM.Omnichannel.SDK.Util.uuidv4();
@@ -228,8 +244,11 @@ try {
228
244
  // failure
229
245
  }
230
246
  ```
247
+
231
248
  ## SDK Configuration
249
+
232
250
  These are the available config options with its default values for the SDK.
251
+
233
252
  ```js
234
253
  {
235
254
  /**
@@ -251,7 +270,7 @@ These are the available config options with its default values for the SDK.
251
270
 
252
271
  This project welcomes contributions and suggestions. Most contributions require you to agree to a
253
272
  Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
254
- the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
273
+ the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.
255
274
 
256
275
  When you submit a pull request, a CLA bot will automatically determine whether you need to provide
257
276
  a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions