releasebird-javascript-sdk 1.0.2

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/src/Styles.js ADDED
@@ -0,0 +1,453 @@
1
+ export const injectStyledCSS = (
2
+ backgroundColor,
3
+ textColor,
4
+ launcherColor,
5
+ launcherPosition,
6
+ spaceLeftRight,
7
+ spaceBottom,
8
+ isMobile
9
+ ) => {
10
+
11
+ const cta__modal = `
12
+ cta_button {
13
+ background-color: none;
14
+ border: none;
15
+ background-color: #294eab;
16
+ border-radius: 5px;
17
+ font-weight: bold;
18
+ color: white;
19
+ cursor: pointer;
20
+ font-family: inherit;
21
+ }
22
+
23
+ .cta__modal--standard {
24
+ width: 420px !important;
25
+ }
26
+
27
+ .cta__modal--big {
28
+ width: 680px !important;
29
+ }
30
+
31
+
32
+ .cta__modal-dimmer {
33
+ position: fixed;
34
+ display: none;
35
+ z-index: 90;
36
+ top: 0;
37
+ left: 0;
38
+ right: 0;
39
+ bottom: 0;
40
+ background-color: rgba(0, 0, 0, 0);
41
+ }
42
+
43
+
44
+ .circle {
45
+ width: 200px;
46
+ height: 200px;
47
+ border-radius: 50%;
48
+ background-color: #3498db;
49
+ margin-right: 20px;
50
+ }
51
+
52
+ .vertical-text {
53
+ writing-mode: vertical-rl;
54
+ text-orientation: mixed;
55
+ transform: rotate(180deg);
56
+ color: black;
57
+ font-size: 18px;
58
+ }
59
+
60
+ .feedbackButtonText {
61
+ margin-top: 20px;
62
+ --webkit-transform: rotate(90deg); /* Safari and Chrome */
63
+ --moz-transform: rotate(90deg); /* Firefox */
64
+ --ms-transform: rotate(90deg); /* IE 9 */
65
+ --o-transform: rotate(90deg); /* Opera */
66
+ transform: rotate(90deg);
67
+ --webkit-transform: translate(-50%, 50%);
68
+
69
+ }
70
+
71
+ .cta__modal-dimmer--visible {
72
+ display: block;
73
+ animation: show 0.2s;
74
+ animation-fill-mode: forwards;
75
+ }
76
+
77
+ .cta__modal {
78
+ position: fixed;
79
+ outline: none;
80
+ z-index: 10000000;
81
+ background-color: transparent;
82
+ display: none !important;
83
+ width: ${!isMobile ? '450px' : '100% !important'};
84
+ border-radius: ${!isMobile ? '24' : 0}px;
85
+ font-family: inherit;
86
+ overflow-y: hidden;
87
+ height: ${!isMobile ? '725px' : '100%'};
88
+ text-align: center;
89
+ bottom: ${!isMobile ? spaceBottom + 30 : 0}px;
90
+ right: ${(launcherPosition === 'right' && !isMobile) ? (spaceLeftRight + 10) + 'px' : 'unset'};
91
+ left: ${(launcherPosition === 'left' && !isMobile) ? (spaceLeftRight + 10)+ 'px' : 'unset'};
92
+ top: ${!isMobile ? 'unset' : 0}px;
93
+ }
94
+
95
+ .cta__modal_loading {
96
+ position: fixed;
97
+ outline: none;
98
+ z-index: 1000000;
99
+ background-color: white;
100
+ display: none !important;
101
+ left: 50%;
102
+ top: 50%;
103
+ transform: translate(-50%, -50%);
104
+ font-family: inherit;
105
+ overflow-y: auto;
106
+ height: 650px;
107
+ text-align: center;
108
+ }
109
+
110
+ .cta__modal--visible {
111
+ display: block !important;
112
+ animation: show 0.3s;
113
+ animation-fill-mode: forwards;
114
+ margin-bottom: 25px;
115
+ }
116
+
117
+ .cta__modal img {
118
+ width: 100%;
119
+ margin-bottom: 1rem;
120
+ }
121
+
122
+ .launcherButton {
123
+ backgroundColor:transparent;
124
+ width:50px;
125
+ height:50px;
126
+ z-index: 2147483630;
127
+ position:fixed;
128
+ bottom:${spaceBottom}px;
129
+ right:${launcherPosition === 'right' ? spaceLeftRight + 'px' : 'unset'};
130
+ left:${launcherPosition === 'left' ? spaceLeftRight + 'px' : 'unset'};
131
+ cursor:pointer;
132
+ }
133
+
134
+ .launcherButton5 {
135
+ backgroundColor:transparent;
136
+ width:70px;
137
+ height:50px;
138
+ z-index: 2147483630;
139
+ position:fixed;
140
+ bottom:${spaceBottom}px;
141
+ right:${launcherPosition === 'right' ? spaceLeftRight + 'px' : 'unset'};
142
+ left:${launcherPosition === 'left' ? spaceLeftRight + 'px' : 'unset'};
143
+ cursor:pointer;
144
+ }
145
+
146
+ .rbird_badge {
147
+ position: fixed;
148
+ bottom: ${spaceBottom + 35}px;
149
+ right: ${launcherPosition === 'right' ? (spaceLeftRight - 10) + 'px' : 'unset'};
150
+ left: ${launcherPosition === 'left' ? (spaceLeftRight + 35) + 'px' : 'unset'};
151
+ z-index: 2147483630;
152
+ padding: 5px 10px;
153
+ border-radius: 50%;
154
+ background-color: red;
155
+ color: white;
156
+ font-size: 12px;
157
+ }
158
+
159
+ /* Modal Content/Box */
160
+ .modal-content {
161
+ background-color: #fefefe;
162
+ margin: 15% auto; /* 15% from the top and centered */
163
+ padding: 20px;
164
+ border: 1px solid #888;
165
+ width: 80%; /* Could be more or less, depending on screen size */
166
+ }
167
+
168
+ .markerBoundary {
169
+ display: none;
170
+ position: fixed;
171
+ top: 0;
172
+ left: 0;
173
+ width: calc(100%);
174
+ height: calc(100% - 12px);
175
+ border: 6px solid red;
176
+ z-index: 100000;
177
+ }
178
+
179
+ .screenshotCloseButton {
180
+ position: absolute;
181
+ top: 0;
182
+ cursor: pointer;
183
+ right: 0;
184
+ text-align: center;
185
+ padding: 5px;
186
+ width: 50px;
187
+ background-color: red;
188
+ color: white;
189
+ font-weight: 500;
190
+ font-family: Arial, serif;
191
+ }
192
+
193
+ .editorButtons {
194
+ position: absolute;
195
+ top: 10px;
196
+ left: 50%;
197
+ height: 25px;
198
+ width: 200px;
199
+ background-color: white;
200
+ border: 1px solid lightgrey;
201
+ border-radius: 5px;
202
+ }
203
+
204
+
205
+ #myImg {
206
+ border-radius: 5px;
207
+ cursor: pointer;
208
+ transition: 0.3s;
209
+ }
210
+
211
+ #myImg:hover {opacity: 0.7;}
212
+
213
+ /* The Modal (background) */
214
+ .modalImageViewer {
215
+ position: fixed; /* Stay in place */
216
+ z-index: 10000000000; /* Sit on top */
217
+ padding-top: 100px; /* Location of the box */
218
+ left: 0;
219
+ top: 0;
220
+ width: 100%; /* Full width */
221
+ height: 100%; /* Full height */
222
+ overflow: auto; /* Enable scroll if needed */
223
+ background-color: rgb(0,0,0); /* Fallback color */
224
+ background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
225
+ }
226
+
227
+ /* Modal Content (image) */
228
+ .modal-content-imageViewer {
229
+ margin: auto;
230
+ display: block;
231
+ width: 80%;
232
+ max-width: 700px;
233
+ }
234
+
235
+ /* Caption of Modal Image */
236
+ #caption {
237
+ margin: auto;
238
+ display: block;
239
+ width: 80%;
240
+ max-width: 700px;
241
+ text-align: center;
242
+ color: #ccc;
243
+ padding: 10px 0;
244
+ height: 150px;
245
+ }
246
+
247
+ /* Add Animation */
248
+ .modal-content, #caption {
249
+ animation-name: zoom;
250
+ animation-duration: 0.6s;
251
+ }
252
+
253
+ @keyframes zoom {
254
+ from {transform: scale(0.1)}
255
+ to {transform: scale(1)}
256
+ }
257
+
258
+ /* The Close Button */
259
+ .rbird_close {
260
+ position: absolute;
261
+ top: 15px;
262
+ right: 35px;
263
+ color: #f1f1f1;
264
+ font-size: 40px;
265
+ font-weight: bold;
266
+ transition: 0.3s;
267
+ }
268
+
269
+ .hideWidgetButton {
270
+ width: 15px;
271
+ height: 15px;
272
+ position: fixed;
273
+ cursor: pointer;
274
+ bottom: ${spaceBottom + 45}px;
275
+ right: ${launcherPosition === 'right' ? (spaceLeftRight -15) + 'px' : 'unset'};
276
+ left: ${launcherPosition === 'left' ? (spaceLeftRight -15) + 'px' : 'unset'};
277
+ z-index: 2147483630;
278
+ }
279
+
280
+ .rbird_closeclose:hover,
281
+ .rbird_closeclose:focus {
282
+ color: #bbb;
283
+ text-decoration: none;
284
+ cursor: pointer;
285
+ }
286
+
287
+ .rbird-content-iframe {
288
+ width: 100%;
289
+ height: 100%;
290
+ background: transparent
291
+ }
292
+
293
+ /* 100% Image Width on Smaller Screens */
294
+ @media only screen and (max-width: 700px){
295
+ .modal-content {
296
+ width: 100%;
297
+ }
298
+ }
299
+ }`
300
+
301
+ const oldNode = document.querySelector(".rbird-styles");
302
+ if (oldNode) {
303
+ oldNode.remove();
304
+ }
305
+ const node = document.createElement("style");
306
+ node.innerHTML = cta__modal;
307
+ node.className = "rbird-styles";
308
+ document.body.appendChild(node);
309
+
310
+ return "";
311
+
312
+ };
313
+
314
+ export function launcher0(launcherColor) {
315
+ return `<svg id="Ebene_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 149.04 149.04">
316
+ <circle cx="74.52" cy="74.52" r="74.52"
317
+ transform="translate(-10.8 136.39) rotate(-80.95)"
318
+ fill="${launcherColor}"/>
319
+ <path fill="#ffffff"
320
+ d="m74.48,27.59c-28.91,0-52.34,20.8-52.34,46.47,0,13.06,6.07,24.85,15.84,33.29v18.58l23.44-6.87c4.18.95,8.55,1.46,13.06,1.46,28.91,0,52.34-20.8,52.34-46.47s-23.44-46.47-52.34-46.47Z"/>
321
+ </svg>`
322
+ }
323
+
324
+ export function launcher1(launcherColor) {
325
+ return `<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg"
326
+ viewBox="0 0 149 149" style="enable-background:new 0 0 149 149;">
327
+ <circle className="st0" cx="74.5" cy="74.5" r="74.5" fill="${launcherColor}"/>
328
+ <g>
329
+ <path fill="#ffffff" className="st1" d="M100.3,97.3H33l17.9-17.9V48l5.5-5.5h43.8l5.5,5.5v43.8L100.3,97.3z M43.4,93h55.1l3-3V49.7l-3-3H58.3l-3,3
330
+ v31.4L43.4,93z"/>
331
+ </g>
332
+ </svg>`
333
+ }
334
+
335
+ export function launcher2(launcherColor) {
336
+ return `<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg"
337
+ x="0px" y="0px"
338
+ viewBox="0 0 149 149" style="enable-background:new 0 0 149 149;">
339
+ <circle className="st0" cx="74.5" cy="74.5" r="74.5" fill="${launcherColor}"/>
340
+ <path fill="#ffffff" className="st1" d="M108.8,37c-9-9.1-21-14.1-33.8-14.1c-12.8,0-24.8,5-33.8,14.1c-9,9.1-14,21.2-14,34c0,7.5,1.8,15,5.1,21.7
341
+ c-1.6,6.4-6.1,11.7-12.1,14.4c-1.4,0.5-1.8,2.4-0.8,3.5c4,4.5,9.7,7.1,15.7,7.1c5.5,0,10.7-2.2,14.5-6c7.6,4.8,16.3,7.3,25.4,7.3
342
+ c12.8,0,24.8-5,33.8-14.1c9-9.1,14-21.2,14-34S117.8,46,108.8,37L108.8,37z M75,114.6c-8.8,0-17.2-2.6-24.5-7.6l0,0
343
+ c-0.9-0.6-2.2-0.5-3,0.4c-3.1,3.7-7.7,5.8-12.5,5.8c-3.7,0-7.3-1.3-10.2-3.6c6.1-3.6,10.5-9.7,12-16.8c0.1-0.6,0-1.1-0.2-1.6
344
+ c-3.3-6.2-5-13.2-5-20.3c0-24.1,19.4-43.7,43.3-43.7s43.3,19.6,43.3,43.7S98.9,114.6,75,114.6L75,114.6z"/>
345
+ </svg>`
346
+ }
347
+
348
+ export function launcher3(launcherColor) {
349
+ return `<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg"
350
+ x="0px" y="0px"
351
+ viewBox="0 0 149 149" style="enable-background:new 0 0 149 149;">
352
+ <circle className="st0" cx="74.5" cy="74.5" r="74.5" fill="${launcherColor}"/>
353
+ <g id="text_chat">
354
+ <g>
355
+ <path fill="#ffffff" className="st1" d="M74.5,31.6c-23.7,0-42.9,19.2-42.9,42.9c0,6.5,1.5,12.9,4.3,18.7l-2.4,10.6c-0.7,3.3-0.1,6.4,1.7,8.6
356
+ c2.2,2.8,5.9,3.9,10,3l10.6-2.3c5.8,2.8,12.3,4.3,18.7,4.3c23.7,0,42.9-19.2,42.9-42.9S98.2,31.6,74.5,31.6z"/>
357
+ <g>
358
+ <path fill="#ffffff" className="st1" d="M87.4,70.2H61.6c-2.4,0-4.3-1.9-4.3-4.3c0-2.4,1.9-4.3,4.3-4.3h25.7c2.4,0,4.3,1.9,4.3,4.3
359
+ C91.7,68.3,89.8,70.2,87.4,70.2z"/>
360
+ </g>
361
+ <g>
362
+ <path fill="#ffffff" className="st1"
363
+ d="M74.5,87.4H61.6c-2.4,0-4.3-1.9-4.3-4.3s1.9-4.3,4.3-4.3h12.9c2.4,0,4.3,1.9,4.3,4.3S76.9,87.4,74.5,87.4z"
364
+ />
365
+ </g>
366
+ </g>
367
+ </g>
368
+ </svg>`
369
+ }
370
+
371
+ export function launcher4(launcherColor) {
372
+ return `<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg"
373
+ x="0px" y="0px"
374
+ viewBox="0 0 149 149" style="enable-background:new 0 0 149 149;">
375
+ <circle className="st0" cx="74.5" cy="74.5" r="74.5" fill="${launcherColor}"/>
376
+ <path fill="#ffffff" className="st1" d="M112.5,47.2c2.2,4.3,2.2,9.9,2.2,21.2v4.8c0,6.8,0,10.2-0.8,13c-1.9,6.6-7.1,11.7-13.6,13.6
377
+ c-2.8,0.8-6.2,0.8-13,0.8h-2.2l-0.3,0c-4.1,0-8.1,1.3-11.5,3.7l-0.2,0.2l-10.5,7.5c-3.6,2.6-8.3-1.1-6.7-5.2c1.2-2.9-1-6.1-4.1-6.1
378
+ h-2.4c-8.4,0-15.2-6.8-15.2-15.2v-17c0-11.3,0-16.9,2.2-21.2c1.9-3.8,5-6.9,8.8-8.8c4.3-2.2,9.9-2.2,21.2-2.2h16.1
379
+ c11.3,0,16.9,0,21.2,2.2C107.5,40.4,110.6,43.5,112.5,47.2L112.5,47.2z M58.4,57.4c-1.7,0-3,1.4-3,3s1.4,3,3,3h32.2c1.7,0,3-1.4,3-3
380
+ s-1.4-3-3-3H58.4z M66.5,73.5c-1.7,0-3,1.4-3,3c0,1.7,1.4,3,3,3h16.1c1.7,0,3-1.4,3-3c0-1.7-1.4-3-3-3H66.5z"/>
381
+ </svg>`
382
+ }
383
+
384
+ export function launcher5(launcherColor) {
385
+ return `<svg version="1.1" id="Ebene_2" xmlns="http://www.w3.org/2000/svg"
386
+ viewBox="0 0 3437.83 2395.28">
387
+ <g id="Layer_1">
388
+ <polygon fill="${launcherColor}"
389
+ points="404.34 1465.87 202.48 2395.28 949.73 1971.67 404.34 1465.87"/>
390
+ <path fill="${launcherColor}"
391
+ d="m3436.45,1275.75C3204.96,2696.73-100.03,2331.34,2.33,885.09,240.59-504.37,3514.92-169.98,3436.45,1275.75Z"/>
392
+ <path fill="#ffffff"
393
+ d="m759.32,1060.6c-17.38-7.23-39.16-13.43-64.74-18.44l-.34-.06c-.67-.11-1.33-.25-1.97-.43-1.22-.33-2.51-.62-3.83-.85-1-.23-2.01-.41-3.07-.55-.25-.03-.5-.08-.76-.14l-.59-.13c-16.86-3.33-30.03-6.51-39.15-9.44-7.87-2.52-14.24-6.33-19.48-11.64-4.35-4.41-6.46-10.6-6.46-18.93v-.27c0-9.45,4.18-16.37,13.16-21.77,10.61-6.38,26.42-9.62,46.99-9.62,13.82,0,28.57,2.7,43.82,8.04,15.5,5.42,30.6,13.17,44.88,23.03l10.87,7.51,41.85-83.7-8.25-5.65c-13.2-9.05-27.35-16.89-42.06-23.3-14.73-6.42-30-11.39-45.38-14.79-15.48-3.42-30.88-5.15-45.74-5.15-32.19,0-60.21,5.12-83.27,15.2-23.74,10.39-42.16,25.79-54.76,45.77-12.51,19.86-18.86,43.92-18.86,71.5v.27c0,31.23,6.92,56,20.58,73.63,13.41,17.32,30.04,29.64,49.41,36.6,17.97,6.46,40.76,11.89,67.75,16.14l5.41.74c.83.21,1.66.35,2.48.42l1.07.19c14.41,2.26,26.3,4.79,35.35,7.52,7.65,2.31,13.85,5.87,18.41,10.57,3.84,3.96,5.71,9.51,5.71,16.97v.27c0,10.99-4.64,18.96-14.61,25.08-11.48,7.06-28.45,10.64-50.41,10.64-19.62,0-39-3.22-57.61-9.56-18.49-6.3-34.99-15.35-49.05-26.9l-10.58-8.69-45.86,81.61,7.39,6.11c13.18,10.89,28.3,20.32,44.94,28.02,16.54,7.65,34.43,13.54,53.18,17.5,18.69,3.94,38.06,5.94,57.58,5.94,33.03,0,61.85-5.04,85.67-14.99,24.56-10.25,43.59-25.48,56.58-45.26,12.95-19.73,19.52-43.57,19.52-70.86v-.54c0-29.11-6.39-52.69-19.01-70.08-12.42-17.12-28.16-29.74-46.8-37.5Z"/>
394
+ <path fill="#ffffff"
395
+ d="m1067.48,1143.49c0,19.67-4.92,34.26-15.04,44.6-10.05,10.27-24.27,15.27-43.48,15.27s-33.09-4.98-43.04-15.24c-10.05-10.35-14.93-24.95-14.93-44.63v-265.13h-97.28v263.23c0,32.62,6.08,61.07,18.07,84.57,12.25,24,30.39,42.54,53.92,55.1,23.1,12.33,51.11,18.58,83.26,18.58s60.2-6.25,83.38-18.57c23.62-12.55,41.85-31.08,54.19-55.07,12.09-23.51,18.23-51.98,18.23-84.6v-263.23h-97.28v265.13Z"/>
396
+ <path fill="#ffffff"
397
+ d="m1457.81,894.78c-20.32-10.89-44-16.42-70.4-16.42h-169.63v417.4h97.28v-153h72.35c26.38,0,50.05-5.47,70.36-16.26,20.59-10.94,36.78-26.64,48.14-46.66,11.25-19.84,16.96-43.06,16.96-69.01s-5.7-49.19-16.95-69.12c-11.35-20.11-27.53-35.89-48.11-46.93Zm-39.38,136.32c-2.82,5.52-6.61,9.64-11.56,12.62-5.01,3.01-10.76,4.47-17.56,4.47h-74.25v-75.25h74.25c6.99,0,12.82,1.46,17.83,4.47,4.9,2.94,8.61,7.06,11.35,12.6,2.9,5.88,4.38,12.89,4.38,20.83s-1.49,14.53-4.44,20.27Z"/>
398
+ <path fill="#ffffff"
399
+ d="m1798.27,894.78c-20.32-10.89-44-16.42-70.4-16.42h-169.63v417.4h97.28v-153h72.35c26.38,0,50.05-5.47,70.36-16.26,20.59-10.94,36.78-26.64,48.14-46.66,11.25-19.84,16.96-43.05,16.96-69.01s-5.7-49.2-16.95-69.12c-11.35-20.11-27.53-35.89-48.11-46.93Zm-39.37,136.32c-2.83,5.52-6.61,9.65-11.56,12.62-5.01,3.01-10.75,4.47-17.56,4.47h-74.25v-75.25h74.25c6.99,0,12.82,1.46,17.83,4.47,4.9,2.94,8.61,7.06,11.35,12.6,2.9,5.88,4.38,12.89,4.38,20.83s-1.49,14.53-4.43,20.27Z"/>
400
+ <path fill="#ffffff"
401
+ d="m2127.18,893.76c-23.42-12.92-50.7-19.47-81.1-19.47s-57.69,6.55-81.1,19.47c-23.64,13.05-42.19,31.74-55.13,55.57-12.8,23.57-19.3,51.11-19.3,81.84v111.77c0,30.74,6.49,58.27,19.3,81.84,12.95,23.83,31.5,42.53,55.13,55.57,23.4,12.92,50.69,19.47,81.1,19.47s57.69-6.55,81.1-19.47c23.64-13.05,42.19-31.74,55.13-55.57,12.8-23.57,19.3-51.11,19.3-81.84v-111.77c0-30.74-6.49-58.27-19.3-81.84-12.94-23.82-31.49-42.52-55.13-55.57Zm-25.57,251.08c0,11.8-2.34,22.23-6.95,31.01-4.51,8.57-10.7,14.99-18.94,19.62-8.34,4.69-18.32,7.07-29.64,7.07s-21.3-2.38-29.64-7.07c-8.24-4.63-14.43-11.05-18.94-19.62-4.62-8.77-6.95-19.2-6.95-31.01v-115.57c0-11.81,2.34-22.24,6.96-31.01,4.51-8.57,10.7-14.99,18.93-19.62,8.34-4.69,18.31-7.07,29.64-7.07s21.3,2.38,29.64,7.07c8.23,4.63,14.42,11.05,18.93,19.62,4.62,8.78,6.96,19.22,6.96,31.01v115.57Z"/>
402
+ <path fill="#ffffff"
403
+ d="m2499.13,1120.82c18.38-10.85,32.78-26.34,42.79-46.06,9.83-19.36,14.81-41.96,14.81-67.18s-4.98-47.82-14.81-67.19c-10.01-19.71-24.35-35.2-42.63-46.04-18.18-10.79-39.41-16.26-63.1-16.26h-184.28v417.67h97.28v-158.7h26.89l88.92,158.7h116.71l-97.24-167.69c5.07-2.07,9.96-4.49,14.65-7.26Zm-45.87-93.53c-2.27,5.06-5.3,8.79-9.25,11.38-3.91,2.57-8.42,3.82-13.78,3.82h-81.03v-69.83h81.03c5.54,0,10.14,1.25,14.05,3.81,3.96,2.6,6.98,6.32,9.25,11.38,2.47,5.51,3.73,12.11,3.74,19.61-.16,7.58-1.51,14.25-4.01,19.83Z"/>
404
+ <polygon fill="#ffffff"
405
+ points="2559.82 878.36 2559.82 972.93 2667.24 972.93 2667.24 1295.76 2764.53 1295.76 2764.53 972.93 2871.96 972.93 2871.96 878.36 2559.82 878.36"/>
406
+ </g>
407
+ </svg>`
408
+ }
409
+
410
+ export function launcher5Open(launcherColor) {
411
+ return `<svg version="1.1" id="Ebene_2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3437.83 2395.28">
412
+ <g id="Layer_1">
413
+
414
+ <path fill="${launcherColor}"
415
+ d="m3436.45,1275.75C3204.96,2696.73-100.03,2331.34,2.33,885.09,240.59-504.37,3514.92-169.98,3436.45,1275.75Z"/>
416
+ <path fill="#ffffff"
417
+ d="m759.32,1060.6c-17.38-7.23-39.16-13.43-64.74-18.44l-.34-.06c-.67-.11-1.33-.25-1.97-.43-1.22-.33-2.51-.62-3.83-.85-1-.23-2.01-.41-3.07-.55-.25-.03-.5-.08-.76-.14l-.59-.13c-16.86-3.33-30.03-6.51-39.15-9.44-7.87-2.52-14.24-6.33-19.48-11.64-4.35-4.41-6.46-10.6-6.46-18.93v-.27c0-9.45,4.18-16.37,13.16-21.77,10.61-6.38,26.42-9.62,46.99-9.62,13.82,0,28.57,2.7,43.82,8.04,15.5,5.42,30.6,13.17,44.88,23.03l10.87,7.51,41.85-83.7-8.25-5.65c-13.2-9.05-27.35-16.89-42.06-23.3-14.73-6.42-30-11.39-45.38-14.79-15.48-3.42-30.88-5.15-45.74-5.15-32.19,0-60.21,5.12-83.27,15.2-23.74,10.39-42.16,25.79-54.76,45.77-12.51,19.86-18.86,43.92-18.86,71.5v.27c0,31.23,6.92,56,20.58,73.63,13.41,17.32,30.04,29.64,49.41,36.6,17.97,6.46,40.76,11.89,67.75,16.14l5.41.74c.83.21,1.66.35,2.48.42l1.07.19c14.41,2.26,26.3,4.79,35.35,7.52,7.65,2.31,13.85,5.87,18.41,10.57,3.84,3.96,5.71,9.51,5.71,16.97v.27c0,10.99-4.64,18.96-14.61,25.08-11.48,7.06-28.45,10.64-50.41,10.64-19.62,0-39-3.22-57.61-9.56-18.49-6.3-34.99-15.35-49.05-26.9l-10.58-8.69-45.86,81.61,7.39,6.11c13.18,10.89,28.3,20.32,44.94,28.02,16.54,7.65,34.43,13.54,53.18,17.5,18.69,3.94,38.06,5.94,57.58,5.94,33.03,0,61.85-5.04,85.67-14.99,24.56-10.25,43.59-25.48,56.58-45.26,12.95-19.73,19.52-43.57,19.52-70.86v-.54c0-29.11-6.39-52.69-19.01-70.08-12.42-17.12-28.16-29.74-46.8-37.5Z"/>
418
+ <path fill="#ffffff"
419
+ d="m1067.48,1143.49c0,19.67-4.92,34.26-15.04,44.6-10.05,10.27-24.27,15.27-43.48,15.27s-33.09-4.98-43.04-15.24c-10.05-10.35-14.93-24.95-14.93-44.63v-265.13h-97.28v263.23c0,32.62,6.08,61.07,18.07,84.57,12.25,24,30.39,42.54,53.92,55.1,23.1,12.33,51.11,18.58,83.26,18.58s60.2-6.25,83.38-18.57c23.62-12.55,41.85-31.08,54.19-55.07,12.09-23.51,18.23-51.98,18.23-84.6v-263.23h-97.28v265.13Z"/>
420
+ <path fill="#ffffff"
421
+ d="m1457.81,894.78c-20.32-10.89-44-16.42-70.4-16.42h-169.63v417.4h97.28v-153h72.35c26.38,0,50.05-5.47,70.36-16.26,20.59-10.94,36.78-26.64,48.14-46.66,11.25-19.84,16.96-43.06,16.96-69.01s-5.7-49.19-16.95-69.12c-11.35-20.11-27.53-35.89-48.11-46.93Zm-39.38,136.32c-2.82,5.52-6.61,9.64-11.56,12.62-5.01,3.01-10.76,4.47-17.56,4.47h-74.25v-75.25h74.25c6.99,0,12.82,1.46,17.83,4.47,4.9,2.94,8.61,7.06,11.35,12.6,2.9,5.88,4.38,12.89,4.38,20.83s-1.49,14.53-4.44,20.27Z"/>
422
+ <path fill="#ffffff"
423
+ d="m1798.27,894.78c-20.32-10.89-44-16.42-70.4-16.42h-169.63v417.4h97.28v-153h72.35c26.38,0,50.05-5.47,70.36-16.26,20.59-10.94,36.78-26.64,48.14-46.66,11.25-19.84,16.96-43.05,16.96-69.01s-5.7-49.2-16.95-69.12c-11.35-20.11-27.53-35.89-48.11-46.93Zm-39.37,136.32c-2.83,5.52-6.61,9.65-11.56,12.62-5.01,3.01-10.75,4.47-17.56,4.47h-74.25v-75.25h74.25c6.99,0,12.82,1.46,17.83,4.47,4.9,2.94,8.61,7.06,11.35,12.6,2.9,5.88,4.38,12.89,4.38,20.83s-1.49,14.53-4.43,20.27Z"/>
424
+ <path fill="#ffffff"
425
+ d="m2127.18,893.76c-23.42-12.92-50.7-19.47-81.1-19.47s-57.69,6.55-81.1,19.47c-23.64,13.05-42.19,31.74-55.13,55.57-12.8,23.57-19.3,51.11-19.3,81.84v111.77c0,30.74,6.49,58.27,19.3,81.84,12.95,23.83,31.5,42.53,55.13,55.57,23.4,12.92,50.69,19.47,81.1,19.47s57.69-6.55,81.1-19.47c23.64-13.05,42.19-31.74,55.13-55.57,12.8-23.57,19.3-51.11,19.3-81.84v-111.77c0-30.74-6.49-58.27-19.3-81.84-12.94-23.82-31.49-42.52-55.13-55.57Zm-25.57,251.08c0,11.8-2.34,22.23-6.95,31.01-4.51,8.57-10.7,14.99-18.94,19.62-8.34,4.69-18.32,7.07-29.64,7.07s-21.3-2.38-29.64-7.07c-8.24-4.63-14.43-11.05-18.94-19.62-4.62-8.77-6.95-19.2-6.95-31.01v-115.57c0-11.81,2.34-22.24,6.96-31.01,4.51-8.57,10.7-14.99,18.93-19.62,8.34-4.69,18.31-7.07,29.64-7.07s21.3,2.38,29.64,7.07c8.23,4.63,14.42,11.05,18.93,19.62,4.62,8.78,6.96,19.22,6.96,31.01v115.57Z"/>
426
+ <path fill="#ffffff"
427
+ d="m2499.13,1120.82c18.38-10.85,32.78-26.34,42.79-46.06,9.83-19.36,14.81-41.96,14.81-67.18s-4.98-47.82-14.81-67.19c-10.01-19.71-24.35-35.2-42.63-46.04-18.18-10.79-39.41-16.26-63.1-16.26h-184.28v417.67h97.28v-158.7h26.89l88.92,158.7h116.71l-97.24-167.69c5.07-2.07,9.96-4.49,14.65-7.26Zm-45.87-93.53c-2.27,5.06-5.3,8.79-9.25,11.38-3.91,2.57-8.42,3.82-13.78,3.82h-81.03v-69.83h81.03c5.54,0,10.14,1.25,14.05,3.81,3.96,2.6,6.98,6.32,9.25,11.38,2.47,5.51,3.73,12.11,3.74,19.61-.16,7.58-1.51,14.25-4.01,19.83Z"/>
428
+ <polygon fill="#ffffff"
429
+ points="2559.82 878.36 2559.82 972.93 2667.24 972.93 2667.24 1295.76 2764.53 1295.76 2764.53 972.93 2871.96 972.93 2871.96 878.36 2559.82 878.36"/>
430
+ </g>
431
+ </svg>`
432
+ }
433
+
434
+ export function launcherOpen(launcherColor) {
435
+ return `<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg"
436
+ x="0px"
437
+ y="0px"
438
+ viewBox="0 0 494.08 494.08" style="enable-background:new 0 0 494.08 494.08;">
439
+ <g>
440
+ <path fill="${launcherColor}" d="M247.04,0C110.604,0,0,110.604,0,247.04s110.604,247.04,247.04,247.04s247.04-110.604,247.04-247.04
441
+ C493.845,110.701,383.379,0.235,247.04,0z M247.04,298.667l-79.787-80.64l14.293-13.653l65.493,64l65.493-64l14.72,14.507
442
+ L247.04,298.667z"/>
443
+ </g>
444
+ </svg>`
445
+ }
446
+
447
+ export const hideWidgetImage = `<svg id="Layer_1" enable-background="new 0 0 64 64" viewBox="0 0 64 64"
448
+ xmlns="http://www.w3.org/2000/svg">
449
+ <path
450
+ d="m34.8 32 19.8-19.8c.8-.8.8-2 0-2.8s-2-.8-2.8 0l-19.8 19.8-19.8-19.8c-.8-.8-2-.8-2.8 0s-.8 2 0 2.8l19.8 19.8-19.8 19.8c-.8.8-.8 2 0 2.8s2 .8 2.8 0l19.8-19.8 19.8 19.8c.8.8 2 .8 2.8 0s.8-2 0-2.8z"/>
451
+ </svg>`
452
+
453
+
package/src/index.js ADDED
@@ -0,0 +1,87 @@
1
+ import { injectStyledCSS } from "./Styles";
2
+ import RbirdSessionManager from "./RbirdSessionManager";
3
+
4
+ class Rbird {
5
+
6
+ static isMobileDevice = () => {
7
+ const mobileMaxWidth = 768; // Definiert die maximale Breite für mobile Geräte, z.B. Tablets und Smartphones
8
+ return window.innerWidth <= mobileMaxWidth;
9
+ }
10
+
11
+ static setStyles(
12
+ backgroundColor = "blue",
13
+ textColor = "red",
14
+ launcherColor = "orange",
15
+ launcherPosition = "bottom",
16
+ spaceLeftRight = 30,
17
+ spaceBottom = 30
18
+ ) {
19
+ runFunctionWhenDomIsReady(() => {
20
+ injectStyledCSS(
21
+ backgroundColor,
22
+ textColor,
23
+ launcherColor,
24
+ launcherPosition,
25
+ spaceLeftRight,
26
+ spaceBottom,
27
+ this.isMobileDevice()
28
+ );
29
+ });
30
+ }
31
+
32
+ static instance;
33
+
34
+ static getInstance() {
35
+ if (!this.instance) {
36
+ this.instance = new Rbird();
37
+ return this.instance;
38
+ } else {
39
+ return this.instance;
40
+ }
41
+ }
42
+
43
+ constructor() {
44
+ if (typeof window !== "undefined") {
45
+ // init
46
+ }
47
+ }
48
+
49
+ static initialize(apiKey) {
50
+ try {
51
+ const instance = this.getInstance();
52
+ if (instance.initialized) {
53
+ console.warn("Rbird already initialized.");
54
+ return;
55
+ }
56
+ RbirdSessionManager.getInstance().init(apiKey);
57
+ instance.initialized = true;
58
+ } catch (e) {
59
+ console.error(e);
60
+ }
61
+ }
62
+
63
+ static identify(identify, hash) {
64
+ try {
65
+ RbirdSessionManager.getInstance().identifyUser(identify, hash);
66
+ } catch (e) {
67
+ console.error(e);
68
+ }
69
+ }
70
+
71
+ }
72
+
73
+ export const runFunctionWhenDomIsReady = (callback) => {
74
+ if (
75
+ document.readyState === "complete" ||
76
+ document.readyState === "loaded" ||
77
+ document.readyState === "interactive"
78
+ ) {
79
+ callback();
80
+ } else {
81
+ document.addEventListener("DOMContentLoaded", () => {
82
+ callback();
83
+ });
84
+ }
85
+ }
86
+
87
+ export default Rbird;
@@ -0,0 +1,86 @@
1
+ const path = require("path");
2
+ const webpack = require("webpack");
3
+ const exec = require("child_process").exec;
4
+ const TerserPlugin = require("terser-webpack-plugin");
5
+
6
+ module.exports = {
7
+ mode: "production",
8
+ entry: {
9
+ index: "./src/index.js",
10
+ },
11
+ output: {
12
+ filename: "[name].js",
13
+ path: path.resolve(__dirname, "build"),
14
+ library: "Rbird",
15
+ libraryTarget: "umd",
16
+ libraryExport: "default",
17
+ globalObject: "this",
18
+ clean: true,
19
+ },
20
+ optimization: {
21
+ minimize: true,
22
+ minimizer: [
23
+ new TerserPlugin({
24
+ terserOptions: {
25
+ mangle: true,
26
+ sourceMap: true,
27
+ safari10: true,
28
+ output: {
29
+ comments: false,
30
+ },
31
+ },
32
+ extractComments: false,
33
+ }),
34
+ ],
35
+ },
36
+ devServer: {
37
+ open: true,
38
+ hot: true,
39
+ host: "0.0.0.0",
40
+ static: path.join(__dirname, "demo"),
41
+ port: 4444,
42
+ },
43
+ performance : {
44
+ hints : false
45
+ },
46
+ module: {
47
+ rules: [
48
+ {
49
+ test: /\.m?js$/,
50
+ exclude: /(node_modules|bower_components)/,
51
+ use: {
52
+ loader: "babel-loader",
53
+ },
54
+ },
55
+ {
56
+ test: /\.css$/i,
57
+ use: ["style-loader", "css-loader"],
58
+ },
59
+ {
60
+ test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/,
61
+ use: ["url-loader"],
62
+ },
63
+ ],
64
+ },
65
+ plugins: [
66
+ new webpack.DefinePlugin({
67
+ PRODUCTION: 'true',
68
+ API: JSON.stringify("https://api.releasebird.com/papi"),
69
+ CONTENT_URL: JSON.stringify("https://wcontent.releasebird.com"),
70
+ }),
71
+ {
72
+ apply: (compiler) => {
73
+ compiler.hooks.afterEmit.tap("AfterEmitPlugin", (compilation) => {
74
+ const nodeVersion = process.env.npm_package_version;
75
+ return exec(
76
+ `mkdir -p published/${nodeVersion} & mkdir -p published/latest & cp ./build/index.js published/${nodeVersion}/index.js & cp ./build/index.js published/latest/index.js`,
77
+ (err, stdout, stderr) => {
78
+ if (stdout) process.stdout.write(stdout);
79
+ if (stderr) process.stderr.write(stderr);
80
+ }
81
+ );
82
+ });
83
+ },
84
+ },
85
+ ],
86
+ };