releasebird-javascript-sdk 1.0.92 → 1.0.94

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/index.js CHANGED
@@ -211,6 +211,7 @@ class Rbird {
211
211
  /**
212
212
  * Show the booking modal
213
213
  * @param {Object} options - Optional configuration
214
+ * @param {string} options.appointmentTypeId - Pre-select a specific appointment type
214
215
  * @param {Function} options.onSuccess - Callback when booking is completed
215
216
  * @param {Function} options.onClose - Callback when modal is closed
216
217
  */
@@ -223,6 +224,49 @@ class Rbird {
223
224
  }
224
225
  }
225
226
 
227
+ /**
228
+ * Embed the booking form into a container element
229
+ * @param {Object} options - Configuration options
230
+ * @param {string} options.target - CSS selector for the container element (required)
231
+ * @param {string} options.appointmentTypeId - Pre-select a specific appointment type
232
+ * @param {string} options.height - Height of the embedded form (default: '600px')
233
+ * @param {Function} options.onSuccess - Callback when booking is completed
234
+ * @param {Function} options.onError - Callback when an error occurs
235
+ * @returns {Object} Object with destroy() method to remove the embedded form
236
+ * @example
237
+ * // Embed booking form in a div
238
+ * const booking = Rbird.embedBooking({
239
+ * target: '#booking-container',
240
+ * height: '700px',
241
+ * appointmentTypeId: 'abc123', // optional: pre-select appointment type
242
+ * onSuccess: () => console.log('Booking completed!')
243
+ * });
244
+ *
245
+ * // Later, to remove:
246
+ * booking.destroy();
247
+ */
248
+ static embedBooking(options = {}) {
249
+ if (typeof window === 'undefined') return;
250
+ try {
251
+ return RbirdBookingManager.getInstance().embedBooking(options);
252
+ } catch (e) {
253
+ console.error(e);
254
+ }
255
+ }
256
+
257
+ /**
258
+ * Remove an embedded booking form
259
+ * @param {string} target - CSS selector for the container element
260
+ */
261
+ static destroyEmbeddedBooking(target) {
262
+ if (typeof window === 'undefined') return;
263
+ try {
264
+ RbirdBookingManager.getInstance().destroyEmbeddedBooking(target);
265
+ } catch (e) {
266
+ console.error(e);
267
+ }
268
+ }
269
+
226
270
  }
227
271
 
228
272
  export const runFunctionWhenDomIsReady = (callback) => {