@ujet/websdk-headless 3.0.5 → 3.1.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;
@@ -212,7 +213,8 @@ interface CallRequest {
212
213
  scheduled_at?: string;
213
214
  ticket_id?: string;
214
215
  email?: string;
215
- recording_permission?: boolean;
216
+ recording_permission?: "recording_permission_not_asked" | "recording_permission_granted" | "recording_permission_denied";
217
+ ;
216
218
  }
217
219
 
218
220
  (menuId: number | string, data: CallRequest)
@@ -285,9 +287,10 @@ interface ChatRequest {
285
287
  email?: string;
286
288
  greeting?: string;
287
289
  cobrowsable?: boolean;
290
+ custom_data?: string | Record<string, any>;
288
291
  }
289
292
 
290
- (menuId: number | string, data: ChatRequest, customData?: string | object)
293
+ (menuId: number | string, data: ChatRequest)
291
294
  ```
292
295
 
293
296
  An example:
@@ -769,10 +772,10 @@ You can add CSS style according to the above template's class names.
769
772
 
770
773
  ### Custom template
771
774
 
772
- Developers can also provide a custom template with `class="cobrowse-template"`, e.g.
775
+ Developers can also provide a custom template with the `cobrowse.template` option, e.g.
773
776
 
774
- ```html
775
- <script class="cobrowse-template" type="text/template">
777
+ ```js
778
+ const COBROWSE_CONSENT_TEMPLATE = `
776
779
  <div class="cobrowse">
777
780
  <div class="cobrowse-title">$title</div>
778
781
  <div class="cobrowse-content">$content</div>
@@ -781,13 +784,49 @@ Developers can also provide a custom template with `class="cobrowse-template"`,
781
784
  <button class="cobrowse-allow js-cobrowse-allow">$allow</button>
782
785
  </div>
783
786
  </div>
784
- </script>
787
+ `
788
+ const client = new Client({
789
+ companyId: "YOUR-COMPANY-ID",
790
+ tenant: "YOUR-TENANT-NAME",
791
+ authenticate: authenticate,
792
+ cobrowse: {
793
+ template: COBROWSE_CONSENT_TEMPLATE,
794
+ ...
795
+ },
796
+ ...
797
+ })
785
798
  ```
786
799
 
787
800
  Variables `$title`, `$content`, `$deny`, and `$allow` will be replaced automatically.
788
801
 
789
802
  **Note**: `js-cobrowse-deny` and `js-cobrowse-allow` class names are required.
790
803
 
804
+ We also offer separated templates:
805
+
806
+ ```ts
807
+ const client = new Client({
808
+ companyId: "YOUR-COMPANY-ID",
809
+ tenant: "YOUR-TENANT-NAME",
810
+ authenticate: authenticate,
811
+ cobrowse: {
812
+ confirmSessionTemplate: '....',
813
+ confirmRemoteControlTemplate: '....',
814
+ confirmFullDeviceTemplate: '....',
815
+ sessionControlsTemplate: '....',
816
+ ...
817
+ },
818
+ ...
819
+ })
820
+ ```
821
+
822
+ You have to add `js-cobrowse-deny` and `js-cobrowse-allow` class names on buttons for:
823
+
824
+ - confirmSessionTemplate
825
+ - confirmRemoteControlTemplate
826
+ - confirmFullDeviceTemplate
827
+
828
+ And `js-cobrowse-end` for: `sessionControlsTemplate`.
829
+
791
830
  ### Custom messages
792
831
 
793
832
  We know `$title`, `$content`, `$deny`, and `$allow` are variables, the default (en) messages