releasebird-javascript-sdk 1.0.80 → 1.0.82

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.
@@ -851,9 +851,9 @@ export default class RbirdWebsiteWidget {
851
851
  // Update hide button position (top right of bubble)
852
852
  if (this.hideWidgetButton) {
853
853
  const buttonRect = this.websiteWidget.getBoundingClientRect();
854
- this.hideWidgetButton.style.left = `${buttonRect.right - 10}px`;
854
+ this.hideWidgetButton.style.left = `${buttonRect.right - 5}px`;
855
855
  this.hideWidgetButton.style.right = 'unset';
856
- this.hideWidgetButton.style.bottom = `${window.innerHeight - buttonRect.top + 5}px`;
856
+ this.hideWidgetButton.style.bottom = `${window.innerHeight - buttonRect.bottom + 55}px`;
857
857
  }
858
858
 
859
859
  // Update message bubbles container position
@@ -932,10 +932,13 @@ export default class RbirdWebsiteWidget {
932
932
  }
933
933
 
934
934
  // Update hide button position (top right of bubble)
935
+ // Match CSS: bottom = spaceBottom + 45 = buttonRect.bottom + 45 - buttonRect.height
936
+ // Since buttonRect.top = window.innerHeight - buttonRect.bottom, and bubble height is ~50px
937
+ // bottom = window.innerHeight - buttonRect.top - 5 should equal spaceBottom + 45
935
938
  if (this.hideWidgetButton) {
936
- this.hideWidgetButton.style.left = `${buttonRect.right - 10}px`;
939
+ this.hideWidgetButton.style.left = `${buttonRect.right - 5}px`;
937
940
  this.hideWidgetButton.style.right = 'unset';
938
- this.hideWidgetButton.style.bottom = `${window.innerHeight - buttonRect.top - 5}px`;
941
+ this.hideWidgetButton.style.bottom = `${window.innerHeight - buttonRect.bottom + 55}px`;
939
942
  }
940
943
 
941
944
  // Update message bubbles container position
package/src/Styles.js CHANGED
@@ -310,11 +310,11 @@ export const injectStyledCSS = (
310
310
 
311
311
  .hideWidgetButton {
312
312
  width: 15px;
313
- height: 15px;
313
+ height: 5px;
314
314
  position: fixed;
315
315
  cursor: pointer;
316
316
  bottom: ${spaceBottom + 55}px;
317
- right: ${launcherPosition === 'right' ? (spaceLeftRight - 10) + 'px' : 'unset'};
317
+ right: ${launcherPosition === 'right' ? (spaceLeftRight - 5) + 'px' : 'unset'};
318
318
  left: ${launcherPosition === 'left' ? (spaceLeftRight + 50) + 'px' : 'unset'};
319
319
  z-index: 10000001;
320
320
  }
package/src/index.js CHANGED
@@ -67,7 +67,7 @@ class Rbird {
67
67
  }
68
68
 
69
69
  static initialize(apiKey, showButton) {
70
- if (typeof window === 'undefined') return;
70
+ if (typeof window === 'undefined') return Promise.resolve();
71
71
  try {
72
72
  if (showButton === undefined) {
73
73
  showButton = true;
@@ -75,28 +75,32 @@ class Rbird {
75
75
  const instance = this.getInstance();
76
76
  if (instance.initialized) {
77
77
  console.warn("Rbird already initialized.");
78
- return;
78
+ return Promise.resolve();
79
79
  }
80
80
  RbirdWebsiteWidget.getInstance().noButton = !showButton;
81
- RbirdSessionManager.getInstance().init(apiKey).then(() => {
81
+ return RbirdSessionManager.getInstance().init(apiKey).then(() => {
82
82
  instance.initialized = true;
83
83
  if (showButton) {
84
84
  RbirdWebsiteWidget.getInstance().showButton(showButton);
85
85
  }
86
86
  // Initialize banner manager and display banners
87
- runFunctionWhenDomIsReady(() => {
88
- const bannerManager = RbirdBannerManager.getInstance();
89
- bannerManager.injectStyles();
90
- bannerManager.init(apiKey);
91
-
92
- // Initialize form manager
93
- const formManager = RbirdFormManager.getInstance();
94
- formManager.init(apiKey);
87
+ return new Promise((resolve) => {
88
+ runFunctionWhenDomIsReady(() => {
89
+ const bannerManager = RbirdBannerManager.getInstance();
90
+ bannerManager.injectStyles();
91
+ bannerManager.init(apiKey);
92
+
93
+ // Initialize form manager
94
+ const formManager = RbirdFormManager.getInstance();
95
+ formManager.init(apiKey);
96
+ resolve();
97
+ });
95
98
  });
96
- })
99
+ });
97
100
 
98
101
  } catch (e) {
99
102
  console.error(e);
103
+ return Promise.reject(e);
100
104
  }
101
105
  }
102
106