@subiz/widget-v4 4.1.206 → 4.1.207

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.
@@ -0,0 +1,90 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta name="description" content="Subiz preview" />
5
+ <meta charset="utf-8" />
6
+ <title>Widget v4</title>
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
+ <style>
9
+ body {
10
+ background: #ffc107;
11
+ }
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <h1>Subiz widget testing</h1>
16
+ <button id="test1">Test 1</button>
17
+ <script>
18
+ let sbz_info = {}
19
+ function getUrlParameter(name) {
20
+ name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]')
21
+ var regex = new RegExp('[\\?&]' + name + '=([^&#]*)')
22
+ var results = regex.exec(location.search)
23
+ return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '))
24
+ }
25
+
26
+ window.sbz_v4 = true // signature to trick injected script believe that we are running v4 code
27
+
28
+ var accid =
29
+ getUrlParameter('id') || getUrlParameter('acc_id') || getUrlParameter('account_id') || 'acqsulrowbxiugvginhw'
30
+ // making a queue, so we can process data asynchronous
31
+ window._sbzaccid = accid
32
+ window.subiz = function () {
33
+ window.subiz.q.push(arguments)
34
+ }
35
+ window.subiz.q = []
36
+ // set account it in the very first call
37
+ window.subiz('setAccount', accid)
38
+ // window.subiz('expandWidget')
39
+
40
+ if (accid == 'acqsulrowbxiugvginhw') {
41
+ <!--window.subiz('setViewingProduct', {id: '220170', sku: 'ipx', source_id: 'IPHONE10'})-->
42
+ }
43
+
44
+ setTimeout(function () {
45
+ const button = document.createElement('button')
46
+ button.innerText = 'test2'
47
+ button.id = 'test2'
48
+ document.body.appendChild(button)
49
+ }, 2000)
50
+
51
+ setTimeout(function () {
52
+ // only run when url contain ?bot=greeting
53
+ var urlParams = new URLSearchParams(window.location.search)
54
+ const greeting = urlParams.get('bot')
55
+ if (greeting !== 'greeting') return
56
+
57
+ let botid = '<botid>' ////////////////////// replace your bot id here. eg: bbrtilgagvnoehvpzg
58
+
59
+ // dont allow other bots to run
60
+ subiz('shrinkWidget')
61
+ subiz('stopAutobot')
62
+
63
+ subiz('waitReady', function () {
64
+ let kk = subiz('startConvo', {
65
+ initial_by: botid,
66
+ state: 'active',
67
+ members: [{id: botid, type: 'bot'}],
68
+ }).then(function (out) {
69
+ if (!out || !out.convo || !out.convo.id) return
70
+ subiz('showWidget', 'chat', out.convo.id)
71
+ })
72
+ })
73
+ })
74
+ setTimeout(function () {
75
+ if (accid === 'acshaomzfkhqtwlxmtfo' && getUrlParameter('chat-only')) {
76
+ subiz('overrideChatbox', {
77
+ chatbox: {
78
+ offline_form: {
79
+ enabled: false,
80
+ },
81
+ prechat_form: {
82
+ enabled: false,
83
+ },
84
+ },
85
+ })
86
+ }
87
+ })
88
+ </script>
89
+ <script defer src="/library.js"></script></body>
90
+ </html>