releasebird-javascript-sdk 1.0.28 → 1.0.30

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/SVGEditor.js CHANGED
@@ -28,6 +28,9 @@ class Menu {
28
28
  pathButton.style.boxShadow = "none";
29
29
  pathButton.style.border = "none";
30
30
  pathButton.style.cursor = "pointer";
31
+ pathButton.style.touchAction = "manipulation";
32
+ pathButton.style.webkitTapHighlightColor = "transparent";
33
+ pathButton.style.padding = "5px";
31
34
  pathButton.innerHTML = "<svg fill=\"none\" height=\"20pt\" viewBox=\"0 0 120 120\" width=\"20px\" xmlns=\"http://www.w3.org/2000/svg\">\n" +
32
35
  " <path clip-rule=\"evenodd\"\n" +
33
36
  " d=\"m76.25 82.5c-.6904 0-1.25.5596-1.25 1.25s.5596 1.25 1.25 1.25h21.25c6.904 0 12.5 5.5964 12.5 12.5 0 6.904-5.596 12.5-12.5 12.5h-71.5c-2.2091 0-4-1.791-4-4s1.7909-4 4-4h71.5c2.4853 0 4.5-2.0147 4.5-4.5s-2.0147-4.5-4.5-4.5h-21.25c-5.1086 0-9.25-4.1414-9.25-9.25s4.1414-9.25 9.25-9.25h24.75c2.209 0 4 1.7909 4 4s-1.791 4-4 4z\"\n" +
@@ -46,6 +49,9 @@ class Menu {
46
49
  rectButton.style.cursor = "pointer";
47
50
  rectButton.style.boxShadow = "none";
48
51
  rectButton.style.border = "none";
52
+ rectButton.style.touchAction = "manipulation";
53
+ rectButton.style.webkitTapHighlightColor = "transparent";
54
+ rectButton.style.padding = "5px";
49
55
  rectButton.innerHTML = "<svg id=\"Layer_1\" enable-background=\"new 0 0 48 48\" height=\"20pt\" viewBox=\"0 0 48 48\" width=\"20pt\"\n" +
50
56
  " xmlns=\"http://www.w3.org/2000/svg\">\n" +
51
57
  " <path d=\"m44 12.5h-40c-.83 0-1.5.67-1.5 1.5v20c0 .83.67 1.5 1.5 1.5h40c.83 0 1.5-.67 1.5-1.5v-20c0-.83-.67-1.5-1.5-1.5zm-1.5 20h-37v-17h37z\"/>\n" +
@@ -59,6 +65,9 @@ class Menu {
59
65
  circleButton.style.cursor = "pointer";
60
66
  circleButton.style.boxShadow = "none";
61
67
  circleButton.style.border = "none";
68
+ circleButton.style.touchAction = "manipulation";
69
+ circleButton.style.webkitTapHighlightColor = "transparent";
70
+ circleButton.style.padding = "5px";
62
71
  circleButton.innerHTML = "<svg height=\"20pt\" viewBox=\"0 0 512 512\" width=\"20pt\" xmlns=\"http://www.w3.org/2000/svg\">\n" +
63
72
  " <path d=\"m256 512c-68.378906 0-132.667969-26.628906-181.019531-74.980469-48.351563-48.351562-74.980469-112.640625-74.980469-181.019531s26.628906-132.667969 74.980469-181.019531c48.351562-48.351563 112.640625-74.980469 181.019531-74.980469s132.667969 26.628906 181.019531 74.980469c48.351563 48.351562 74.980469 112.640625 74.980469 181.019531s-26.628906 132.667969-74.980469 181.019531c-48.351562 48.351563-112.640625 74.980469-181.019531 74.980469zm0-482c-124.617188 0-226 101.382812-226 226s101.382812 226 226 226 226-101.382812 226-226-101.382812-226-226-226zm0 0\"/>\n" +
64
73
  " <path d=\"m256 512c-68.378906 0-132.667969-26.628906-181.019531-74.980469-48.351563-48.351562-74.980469-112.640625-74.980469-181.019531s26.628906-132.667969 74.980469-181.019531c48.351562-48.351563 112.640625-74.980469 181.019531-74.980469s132.667969 26.628906 181.019531 74.980469c48.351563 48.351562 74.980469 112.640625 74.980469 181.019531s-26.628906 132.667969-74.980469 181.019531c-48.351562 48.351563-112.640625 74.980469-181.019531 74.980469zm0-482c-124.617188 0-226 101.382812-226 226s101.382812 226 226 226 226-101.382812 226-226-101.382812-226-226-226zm0 0\"/>\n" +
@@ -71,6 +80,9 @@ class Menu {
71
80
  ellipseButton.style.boxShadow = "none";
72
81
  ellipseButton.style.cursor = "pointer";
73
82
  ellipseButton.style.border = "none";
83
+ ellipseButton.style.touchAction = "manipulation";
84
+ ellipseButton.style.webkitTapHighlightColor = "transparent";
85
+ ellipseButton.style.padding = "5px";
74
86
  ellipseButton.addEventListener("click", (event) => this.onClick("shape", "ellipse"));
75
87
  ellipseButton.innerHTML = "<svg clip-rule=\"evenodd\" fill-rule=\"evenodd\" height=\"20pt\" stroke-linejoin=\"round\" stroke-miterlimit=\"2\"\n" +
76
88
  " viewBox=\"0 0 24 24\" width=\"20pt\" xmlns=\"http://www.w3.org/2000/svg\">\n" +
@@ -304,11 +316,29 @@ class Menu {
304
316
  nextButton.style.borderRadius = "8px";
305
317
  nextButton.style.marginLeft = "10px";
306
318
  nextButton.style.cursor = "pointer";
319
+ nextButton.style.touchAction = "manipulation";
320
+ nextButton.style.userSelect = "none";
321
+ nextButton.style.webkitUserSelect = "none";
322
+ nextButton.style.webkitTapHighlightColor = "transparent";
323
+
324
+ // Mobile responsive adjustments
325
+ if (window.innerWidth <= 768) {
326
+ nextButton.style.fontSize = "14px";
327
+ nextButton.style.padding = "10px";
328
+ nextButton.style.paddingTop = "6px";
329
+ nextButton.style.paddingBottom = "6px";
330
+ nextButton.style.marginLeft = "5px";
331
+ }
307
332
 
308
333
  nextButton.addEventListener("click", (event) => {
309
334
  RbirdScreenshotManager.getInstance().screenshot();
310
335
  });
311
336
 
337
+ // Add touch event for better mobile support
338
+ nextButton.addEventListener("touchstart", (event) => {
339
+ event.stopPropagation();
340
+ });
341
+
312
342
  menu.appendChild(nextButton);
313
343
 
314
344
  return menu;
@@ -380,9 +410,16 @@ export default class SVGEditor {
380
410
  }
381
411
 
382
412
  attachEvents(svg) {
413
+ // Mouse events
383
414
  svg.addEventListener("mousedown", this.onMouseDown.bind(this));
384
415
  svg.addEventListener("mousemove", this.onMouseMove.bind(this));
385
416
  svg.addEventListener("mouseup", this.onMouseUp.bind(this));
417
+
418
+ // Touch events for mobile/tablet
419
+ svg.addEventListener("touchstart", this.onTouchStart.bind(this), {passive: false});
420
+ svg.addEventListener("touchmove", this.onTouchMove.bind(this), {passive: false});
421
+ svg.addEventListener("touchend", this.onTouchEnd.bind(this));
422
+ svg.addEventListener("touchcancel", this.onTouchEnd.bind(this));
386
423
  }
387
424
 
388
425
  createMenu() {
@@ -409,6 +446,19 @@ export default class SVGEditor {
409
446
  element.style.padding = '10px';
410
447
  element.style.borderRadius = '8px';
411
448
  element.style.transform = 'translateX(-50%)';
449
+ element.style.touchAction = 'manipulation';
450
+ element.style.userSelect = 'none';
451
+ element.style.webkitUserSelect = 'none';
452
+ element.style.zIndex = '900000001';
453
+
454
+ // Mobile responsive adjustments
455
+ if (window.innerWidth <= 768) {
456
+ element.style.padding = '8px';
457
+ element.style.top = '5px';
458
+ element.style.maxWidth = '95vw';
459
+ element.style.overflowX = 'auto';
460
+ }
461
+
412
462
  return element;
413
463
  }
414
464
 
@@ -416,6 +466,37 @@ export default class SVGEditor {
416
466
  this.codeSection.innerText = this.svg.innerHTML.replace(new RegExp("><", "g"), ">\n<");
417
467
  }
418
468
 
469
+ getEventPosition(event) {
470
+ // Handle touch events
471
+ if (event.touches && event.touches.length > 0) {
472
+ const touch = event.touches[0];
473
+ const rect = this.svg.getBoundingClientRect();
474
+ return {
475
+ x: touch.clientX - rect.left,
476
+ y: touch.clientY - rect.top
477
+ };
478
+ }
479
+ // Handle mouse events
480
+ return {
481
+ x: event.offsetX,
482
+ y: event.offsetY
483
+ };
484
+ }
485
+
486
+ onTouchStart(event) {
487
+ event.preventDefault();
488
+ this.onMouseDown(event);
489
+ }
490
+
491
+ onTouchMove(event) {
492
+ event.preventDefault();
493
+ this.onMouseMove(event);
494
+ }
495
+
496
+ onTouchEnd(event) {
497
+ this.onMouseUp();
498
+ }
499
+
419
500
  onMouseDown(event) {
420
501
  this.createdObject = document.createElementNS(svgns, this.menuSettings.shape);
421
502
  this.createdObject.setAttributeNS(null, "fill", this.menuSettings.fill);
@@ -423,10 +504,8 @@ export default class SVGEditor {
423
504
  this.createdObject.setAttributeNS(null, "stroke-width", String(this.menuSettings.size));
424
505
  this.svg.appendChild(this.createdObject);
425
506
 
426
- this.originalMousePosition = this.lastMousePosition = this.currentMousePosition = {
427
- x: event.offsetX,
428
- y: event.offsetY
429
- };
507
+ const position = this.getEventPosition(event);
508
+ this.originalMousePosition = this.lastMousePosition = this.currentMousePosition = position;
430
509
 
431
510
  switch (this.menuSettings.shape) {
432
511
  case "path":
@@ -441,7 +520,7 @@ export default class SVGEditor {
441
520
  return;
442
521
 
443
522
  this.lastMousePosition = this.currentMousePosition;
444
- this.currentMousePosition = {x: event.offsetX, y: event.offsetY};
523
+ this.currentMousePosition = this.getEventPosition(event);
445
524
 
446
525
  this.updateCurrentObject();
447
526
  }
package/src/Styles.js CHANGED
@@ -85,6 +85,7 @@ export const injectStyledCSS = (
85
85
  font-family: inherit;
86
86
  overflow-y: hidden;
87
87
  height: ${!isMobile ? '725px' : '100%'};
88
+ max-height: ${!isMobile ? '725px' : '100%'};
88
89
  text-align: center;
89
90
  bottom: ${!isMobile ? spaceBottom + 30 : 0}px;
90
91
  right: ${(launcherPosition === 'right' && !isMobile) ? (spaceLeftRight + 10) + 'px' : 'unset'};
@@ -92,6 +93,19 @@ export const injectStyledCSS = (
92
93
  top: ${!isMobile ? 'unset' : 0}px;
93
94
  }
94
95
 
96
+ @media (min-width: 769px) and (max-width: 1024px) {
97
+ .cta__modal {
98
+ width: 100% !important;
99
+ height: 100% !important;
100
+ max-height: 100vh !important;
101
+ bottom: 0 !important;
102
+ top: 0 !important;
103
+ left: 0 !important;
104
+ right: 0 !important;
105
+ border-radius: 0 !important;
106
+ }
107
+ }
108
+
95
109
  .cta__modal_loading {
96
110
  position: fixed;
97
111
  outline: none;
package/webpack.config.js CHANGED
@@ -66,7 +66,7 @@ module.exports = {
66
66
  new webpack.DefinePlugin({
67
67
  PRODUCTION: 'true',
68
68
  API: JSON.stringify("https://api.releasebird.com/papi"),
69
- CONTENT_URL: JSON.stringify("https://wcontent.releasebird.com"),
69
+ CONTENT_URL: JSON.stringify("https://wcontent.releasebird.net"),
70
70
  }),
71
71
  {
72
72
  apply: (compiler) => {