@ujet/websdk-headless 3.0.6 → 3.2.3

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
@@ -40,6 +40,7 @@ interface ClientOption {
40
40
  bridge?: string;
41
41
  cobrowse?: {
42
42
  enabled: boolean;
43
+ template?: string;
43
44
  messages?: CobrowseMessages;
44
45
  api?: string;
45
46
  license?: string;
@@ -57,15 +58,6 @@ interface ClientOption {
57
58
 
58
59
  All methods available for `client` instance.
59
60
 
60
- ### `getTrigger`
61
-
62
- This method is used to detect current page proactive triggers. It will
63
- return current matched trigger or `null`.
64
-
65
- ```ts
66
- const trigger = await client.getTrigger()
67
- ```
68
-
69
61
  ### `getCompany`
70
62
 
71
63
  This method is used to get the company information.
@@ -212,7 +204,8 @@ interface CallRequest {
212
204
  scheduled_at?: string;
213
205
  ticket_id?: string;
214
206
  email?: string;
215
- recording_permission?: boolean;
207
+ recording_permission?: "recording_permission_not_asked" | "recording_permission_granted" | "recording_permission_denied";
208
+ ;
216
209
  }
217
210
 
218
211
  (menuId: number | string, data: CallRequest)
@@ -285,9 +278,10 @@ interface ChatRequest {
285
278
  email?: string;
286
279
  greeting?: string;
287
280
  cobrowsable?: boolean;
281
+ custom_data?: string | Record<string, any>;
288
282
  }
289
283
 
290
- (menuId: number | string, data: ChatRequest, customData?: string | object)
284
+ (menuId: number | string, data: ChatRequest)
291
285
  ```
292
286
 
293
287
  An example:
@@ -769,10 +763,10 @@ You can add CSS style according to the above template's class names.
769
763
 
770
764
  ### Custom template
771
765
 
772
- Developers can also provide a custom template with `class="cobrowse-template"`, e.g.
766
+ Developers can also provide a custom template with the `cobrowse.template` option, e.g.
773
767
 
774
- ```html
775
- <script class="cobrowse-template" type="text/template">
768
+ ```js
769
+ const COBROWSE_CONSENT_TEMPLATE = `
776
770
  <div class="cobrowse">
777
771
  <div class="cobrowse-title">$title</div>
778
772
  <div class="cobrowse-content">$content</div>
@@ -781,13 +775,49 @@ Developers can also provide a custom template with `class="cobrowse-template"`,
781
775
  <button class="cobrowse-allow js-cobrowse-allow">$allow</button>
782
776
  </div>
783
777
  </div>
784
- </script>
778
+ `
779
+ const client = new Client({
780
+ companyId: "YOUR-COMPANY-ID",
781
+ tenant: "YOUR-TENANT-NAME",
782
+ authenticate: authenticate,
783
+ cobrowse: {
784
+ template: COBROWSE_CONSENT_TEMPLATE,
785
+ ...
786
+ },
787
+ ...
788
+ })
785
789
  ```
786
790
 
787
791
  Variables `$title`, `$content`, `$deny`, and `$allow` will be replaced automatically.
788
792
 
789
793
  **Note**: `js-cobrowse-deny` and `js-cobrowse-allow` class names are required.
790
794
 
795
+ We also offer separated templates:
796
+
797
+ ```ts
798
+ const client = new Client({
799
+ companyId: "YOUR-COMPANY-ID",
800
+ tenant: "YOUR-TENANT-NAME",
801
+ authenticate: authenticate,
802
+ cobrowse: {
803
+ confirmSessionTemplate: '....',
804
+ confirmRemoteControlTemplate: '....',
805
+ confirmFullDeviceTemplate: '....',
806
+ sessionControlsTemplate: '....',
807
+ ...
808
+ },
809
+ ...
810
+ })
811
+ ```
812
+
813
+ You have to add `js-cobrowse-deny` and `js-cobrowse-allow` class names on buttons for:
814
+
815
+ - confirmSessionTemplate
816
+ - confirmRemoteControlTemplate
817
+ - confirmFullDeviceTemplate
818
+
819
+ And `js-cobrowse-end` for: `sessionControlsTemplate`.
820
+
791
821
  ### Custom messages
792
822
 
793
823
  We know `$title`, `$content`, `$deny`, and `$allow` are variables, the default (en) messages