@bagisto-native/core 1.0.0 → 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/dist/index.cjs CHANGED
@@ -171,14 +171,14 @@ function triggerHotwireNativeToast(message) {
171
171
  nativeToasts[0].click();
172
172
  }
173
173
  }
174
- function triggerHistorySyncEvent(url) {
174
+ function triggerHistorySyncEvent(url, tabTitle) {
175
175
  if (typeof document === "undefined") return;
176
176
  const hotwireElements = document.querySelectorAll(
177
177
  "[data-controller='bridge--historysync']"
178
178
  );
179
179
  if (hotwireElements.length > 0) {
180
180
  hotwireElements[0].dispatchEvent(new CustomEvent("turbo:next-history-sync", {
181
- detail: url,
181
+ detail: { url, title: tabTitle },
182
182
  bubbles: true
183
183
  }));
184
184
  }
@@ -203,9 +203,25 @@ function triggerCartCountValue(cartcount) {
203
203
  nativeButton[0].click();
204
204
  }
205
205
  }
206
+ function triggerDynamicButtonModalOpenEvent() {
207
+ if (typeof document === "undefined") return;
208
+ const nativeButton = document.querySelectorAll('[data-controller="bridge--dynamicbutton"][data-action="click->bridge--dynamicbutton#sendModalOpenEvent"]');
209
+ if (nativeButton.length > 0) {
210
+ nativeButton[0].click();
211
+ }
212
+ }
213
+ function triggerDynamicButtonModalDismissEvent() {
214
+ if (typeof document === "undefined") return;
215
+ const nativeButton = document.querySelectorAll('[data-controller="bridge--dynamicbutton"][data-action="click->bridge--dynamicbutton#sendModalDismissEvent"]');
216
+ if (nativeButton.length > 0) {
217
+ nativeButton[0].click();
218
+ }
219
+ }
206
220
 
207
221
  exports.isTurboNativeUserAgent = isTurboNativeUserAgent;
208
222
  exports.triggerCartCountValue = triggerCartCountValue;
223
+ exports.triggerDynamicButtonModalDismissEvent = triggerDynamicButtonModalDismissEvent;
224
+ exports.triggerDynamicButtonModalOpenEvent = triggerDynamicButtonModalOpenEvent;
209
225
  exports.triggerHistorySyncEvent = triggerHistorySyncEvent;
210
226
  exports.triggerHotwireNativeToast = triggerHotwireNativeToast;
211
227
  exports.triggerThemeModeEvent = triggerThemeModeEvent;
package/dist/index.d.cts CHANGED
@@ -87,16 +87,20 @@ declare function triggerHotwireNativeToast(message: string): void;
87
87
  * Dispatches a custom Turbo history sync event to the first
88
88
  * `bridge--historysync` controller found in the DOM.
89
89
  *
90
- * This is used to notify the native / Hotwire bridge that the
91
- * browser history should be synchronized with the given URL.
90
+ * This notifies the native / Hotwire bridge that the browser history
91
+ * should be synchronized with the given URL, along with the current
92
+ * document title from the active browser tab.
92
93
  *
93
- * The event name dispatched is `turbo:next-history-sync` and it
94
- * bubbles up the DOM tree.
94
+ * The event name dispatched is `turbo:next-history-sync`. It bubbles
95
+ * up the DOM tree so parent listeners (including native bridges)
96
+ * can react to the navigation change.
95
97
  *
96
- * @param url - A `URL` object representing the next location
97
- * to be synced with Turbo / native navigation.
98
+ * @param url - A `URL` object representing the next location to be
99
+ * synced with Turbo / native navigation.
100
+ * @param tabTitle - The current document title of the active browser
101
+ * tab, passed to the native layer for display or navigation context.
98
102
  */
99
- declare function triggerHistorySyncEvent(url: URL): void;
103
+ declare function triggerHistorySyncEvent(url: URL, tabTitle: string): void;
100
104
  /**
101
105
  * Triggers the Theme Mode bridge event by programmatically clicking
102
106
  * the hidden theme mode button in the DOM.
@@ -123,5 +127,35 @@ declare function triggerThemeModeEvent(theme: string): void;
123
127
  * @param {number} cartcount - The total number of items in the cart
124
128
  */
125
129
  declare function triggerCartCountValue(cartcount: number): void;
130
+ /**
131
+ * Triggers the modal open event by simulating a click on the first button
132
+ * that matches the specified `data-controller` and `data-action` attributes.
133
+ * This is typically used to send a signal to the native side to open a modal.
134
+ *
135
+ * @remarks
136
+ * - The function first checks if the `document` object is available (to avoid errors in non-browser environments).
137
+ * - It looks for a button element that has the `data-controller="bridge--dynamicbutton"` and
138
+ * `data-action="click->bridge--dynamicbutton#sendModalOpenEvent"` attributes.
139
+ * - If such a button exists, it simulates a click on the first button in the NodeList.
140
+ *
141
+ * @example
142
+ * triggerDynamicButtonModalOpenEvent(); // Opens the modal
143
+ */
144
+ declare function triggerDynamicButtonModalOpenEvent(): void;
145
+ /**
146
+ * Triggers the modal dismiss event by simulating a click on the first button
147
+ * that matches the specified `data-controller` and `data-action` attributes.
148
+ * This is typically used to send a signal to the native side to dismiss or close a modal.
149
+ *
150
+ * @remarks
151
+ * - The function first checks if the `document` object is available (to avoid errors in non-browser environments).
152
+ * - It looks for a button element that has the `data-controller="bridge--dynamicbutton"` and
153
+ * `data-action="click->bridge--dynamicbutton#sendModalDismissEvent"` attributes.
154
+ * - If such a button exists, it simulates a click on the first button in the NodeList.
155
+ *
156
+ * @example
157
+ * triggerDynamicButtonModalDismissEvent(); // Closes the modal
158
+ */
159
+ declare function triggerDynamicButtonModalDismissEvent(): void;
126
160
 
127
- export { DynamicButton, type FrameworkDelegate, HotwireHistorySync, HotwireLocation, HotwireSearch, HotwireThemeMode, HotwireToast, isTurboNativeUserAgent, triggerCartCountValue, triggerHistorySyncEvent, triggerHotwireNativeToast, triggerThemeModeEvent };
161
+ export { DynamicButton, type FrameworkDelegate, HotwireHistorySync, HotwireLocation, HotwireSearch, HotwireThemeMode, HotwireToast, isTurboNativeUserAgent, triggerCartCountValue, triggerDynamicButtonModalDismissEvent, triggerDynamicButtonModalOpenEvent, triggerHistorySyncEvent, triggerHotwireNativeToast, triggerThemeModeEvent };
package/dist/index.d.ts CHANGED
@@ -87,16 +87,20 @@ declare function triggerHotwireNativeToast(message: string): void;
87
87
  * Dispatches a custom Turbo history sync event to the first
88
88
  * `bridge--historysync` controller found in the DOM.
89
89
  *
90
- * This is used to notify the native / Hotwire bridge that the
91
- * browser history should be synchronized with the given URL.
90
+ * This notifies the native / Hotwire bridge that the browser history
91
+ * should be synchronized with the given URL, along with the current
92
+ * document title from the active browser tab.
92
93
  *
93
- * The event name dispatched is `turbo:next-history-sync` and it
94
- * bubbles up the DOM tree.
94
+ * The event name dispatched is `turbo:next-history-sync`. It bubbles
95
+ * up the DOM tree so parent listeners (including native bridges)
96
+ * can react to the navigation change.
95
97
  *
96
- * @param url - A `URL` object representing the next location
97
- * to be synced with Turbo / native navigation.
98
+ * @param url - A `URL` object representing the next location to be
99
+ * synced with Turbo / native navigation.
100
+ * @param tabTitle - The current document title of the active browser
101
+ * tab, passed to the native layer for display or navigation context.
98
102
  */
99
- declare function triggerHistorySyncEvent(url: URL): void;
103
+ declare function triggerHistorySyncEvent(url: URL, tabTitle: string): void;
100
104
  /**
101
105
  * Triggers the Theme Mode bridge event by programmatically clicking
102
106
  * the hidden theme mode button in the DOM.
@@ -123,5 +127,35 @@ declare function triggerThemeModeEvent(theme: string): void;
123
127
  * @param {number} cartcount - The total number of items in the cart
124
128
  */
125
129
  declare function triggerCartCountValue(cartcount: number): void;
130
+ /**
131
+ * Triggers the modal open event by simulating a click on the first button
132
+ * that matches the specified `data-controller` and `data-action` attributes.
133
+ * This is typically used to send a signal to the native side to open a modal.
134
+ *
135
+ * @remarks
136
+ * - The function first checks if the `document` object is available (to avoid errors in non-browser environments).
137
+ * - It looks for a button element that has the `data-controller="bridge--dynamicbutton"` and
138
+ * `data-action="click->bridge--dynamicbutton#sendModalOpenEvent"` attributes.
139
+ * - If such a button exists, it simulates a click on the first button in the NodeList.
140
+ *
141
+ * @example
142
+ * triggerDynamicButtonModalOpenEvent(); // Opens the modal
143
+ */
144
+ declare function triggerDynamicButtonModalOpenEvent(): void;
145
+ /**
146
+ * Triggers the modal dismiss event by simulating a click on the first button
147
+ * that matches the specified `data-controller` and `data-action` attributes.
148
+ * This is typically used to send a signal to the native side to dismiss or close a modal.
149
+ *
150
+ * @remarks
151
+ * - The function first checks if the `document` object is available (to avoid errors in non-browser environments).
152
+ * - It looks for a button element that has the `data-controller="bridge--dynamicbutton"` and
153
+ * `data-action="click->bridge--dynamicbutton#sendModalDismissEvent"` attributes.
154
+ * - If such a button exists, it simulates a click on the first button in the NodeList.
155
+ *
156
+ * @example
157
+ * triggerDynamicButtonModalDismissEvent(); // Closes the modal
158
+ */
159
+ declare function triggerDynamicButtonModalDismissEvent(): void;
126
160
 
127
- export { DynamicButton, type FrameworkDelegate, HotwireHistorySync, HotwireLocation, HotwireSearch, HotwireThemeMode, HotwireToast, isTurboNativeUserAgent, triggerCartCountValue, triggerHistorySyncEvent, triggerHotwireNativeToast, triggerThemeModeEvent };
161
+ export { DynamicButton, type FrameworkDelegate, HotwireHistorySync, HotwireLocation, HotwireSearch, HotwireThemeMode, HotwireToast, isTurboNativeUserAgent, triggerCartCountValue, triggerDynamicButtonModalDismissEvent, triggerDynamicButtonModalOpenEvent, triggerHistorySyncEvent, triggerHotwireNativeToast, triggerThemeModeEvent };
package/dist/index.js CHANGED
@@ -169,14 +169,14 @@ function triggerHotwireNativeToast(message) {
169
169
  nativeToasts[0].click();
170
170
  }
171
171
  }
172
- function triggerHistorySyncEvent(url) {
172
+ function triggerHistorySyncEvent(url, tabTitle) {
173
173
  if (typeof document === "undefined") return;
174
174
  const hotwireElements = document.querySelectorAll(
175
175
  "[data-controller='bridge--historysync']"
176
176
  );
177
177
  if (hotwireElements.length > 0) {
178
178
  hotwireElements[0].dispatchEvent(new CustomEvent("turbo:next-history-sync", {
179
- detail: url,
179
+ detail: { url, title: tabTitle },
180
180
  bubbles: true
181
181
  }));
182
182
  }
@@ -201,5 +201,19 @@ function triggerCartCountValue(cartcount) {
201
201
  nativeButton[0].click();
202
202
  }
203
203
  }
204
+ function triggerDynamicButtonModalOpenEvent() {
205
+ if (typeof document === "undefined") return;
206
+ const nativeButton = document.querySelectorAll('[data-controller="bridge--dynamicbutton"][data-action="click->bridge--dynamicbutton#sendModalOpenEvent"]');
207
+ if (nativeButton.length > 0) {
208
+ nativeButton[0].click();
209
+ }
210
+ }
211
+ function triggerDynamicButtonModalDismissEvent() {
212
+ if (typeof document === "undefined") return;
213
+ const nativeButton = document.querySelectorAll('[data-controller="bridge--dynamicbutton"][data-action="click->bridge--dynamicbutton#sendModalDismissEvent"]');
214
+ if (nativeButton.length > 0) {
215
+ nativeButton[0].click();
216
+ }
217
+ }
204
218
 
205
- export { DynamicButton, HotwireHistorySync, HotwireLocation, HotwireSearch, HotwireThemeMode, HotwireToast, isTurboNativeUserAgent, triggerCartCountValue, triggerHistorySyncEvent, triggerHotwireNativeToast, triggerThemeModeEvent };
219
+ export { DynamicButton, HotwireHistorySync, HotwireLocation, HotwireSearch, HotwireThemeMode, HotwireToast, isTurboNativeUserAgent, triggerCartCountValue, triggerDynamicButtonModalDismissEvent, triggerDynamicButtonModalOpenEvent, triggerHistorySyncEvent, triggerHotwireNativeToast, triggerThemeModeEvent };
@@ -0,0 +1,2 @@
1
+ declare let DynamicButton: typeof HTMLElement | undefined;
2
+ export { DynamicButton };
@@ -0,0 +1,39 @@
1
+ let DynamicButton;
2
+ if (typeof window !== 'undefined') {
3
+ class DynamicButtonClass extends HTMLElement {
4
+ static get observedAttributes() {
5
+ return ['data-page-type'];
6
+ }
7
+ constructor() {
8
+ super();
9
+ }
10
+ connectedCallback() {
11
+ // Apply default attributes
12
+ this.type = 'button';
13
+ // Bridge action (Hotwire compatible)
14
+ this.setAttribute('data-controller', 'bridge--dynamicbutton');
15
+ }
16
+ attributeChangedCallback(name, oldVal, newVal) { }
17
+ disconnectedCallback() {
18
+ }
19
+ }
20
+ if (typeof window !== 'undefined' && !customElements.get('dynamic-button')) {
21
+ customElements.define('dynamic-button', DynamicButtonClass);
22
+ }
23
+ DynamicButton = DynamicButtonClass;
24
+ }
25
+ export { DynamicButton };
26
+ // <button
27
+ // type="button"
28
+ // data-controller="bridge--dynamicbutton"
29
+ // data-page-type="home"
30
+ // className="hidden"
31
+ // >
32
+ // </button>
33
+ // example use
34
+ // import "@hotwire/app/components";
35
+ // <dynamic-button
36
+ // data-page-type="home"
37
+ // style={{ backgroundColor: 'lightblue', padding: '10px', borderRadius: '5px' }}
38
+ // classList="dynamic-btn react"
39
+ // >Bridge Dynamic Button</dynamic-button>
@@ -0,0 +1,2 @@
1
+ declare let HotwireHistorySync: typeof HTMLElement | undefined;
2
+ export { HotwireHistorySync };
@@ -0,0 +1,21 @@
1
+ let HotwireHistorySync;
2
+ if (typeof window !== 'undefined') {
3
+ class HistorySyncClass extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ this.handleClick = this.handleClick.bind(this);
7
+ }
8
+ connectedCallback() {
9
+ this.setAttribute('role', 'button');
10
+ this.setAttribute('data-controller', 'bridge--historysync');
11
+ }
12
+ handleClick(e) { }
13
+ disconnectedCallback() {
14
+ }
15
+ }
16
+ if (!customElements.get('hotwire-history-sync')) {
17
+ customElements.define('hotwire-history-sync', HistorySyncClass);
18
+ }
19
+ HotwireHistorySync = HistorySyncClass;
20
+ }
21
+ export { HotwireHistorySync };
@@ -0,0 +1,2 @@
1
+ declare let HotwireLocation: typeof HTMLElement | undefined;
2
+ export { HotwireLocation };
@@ -0,0 +1,23 @@
1
+ let HotwireLocation;
2
+ if (typeof window !== 'undefined') {
3
+ class LocationClass extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ this.handleClick = this.handleClick.bind(this);
7
+ }
8
+ connectedCallback() {
9
+ this.setAttribute('role', 'button');
10
+ this.setAttribute('data-controller', 'bridge--location');
11
+ this.addEventListener('click', this.handleClick);
12
+ }
13
+ handleClick(e) { }
14
+ disconnectedCallback() {
15
+ this.removeEventListener('click', this.handleClick);
16
+ }
17
+ }
18
+ if (!customElements.get('hotwire-location')) {
19
+ customElements.define('hotwire-location', LocationClass);
20
+ }
21
+ HotwireLocation = LocationClass;
22
+ }
23
+ export { HotwireLocation };
@@ -0,0 +1,2 @@
1
+ declare let HotwireSearch: typeof HTMLElement | undefined;
2
+ export { HotwireSearch };
@@ -0,0 +1,26 @@
1
+ let HotwireSearch;
2
+ if (typeof window !== 'undefined') {
3
+ class HotwireSearchClass extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ }
7
+ connectedCallback() {
8
+ this.innerHTML = '';
9
+ const p = document.createElement('p');
10
+ p.setAttribute('data-controller', 'bridge--search');
11
+ p.setAttribute('data-action', 'input->bridge--search#handleInput');
12
+ p.style.display = 'none';
13
+ p.appendChild(document.createTextNode('Search Form'));
14
+ const resultsDiv = document.createElement('div');
15
+ resultsDiv.setAttribute('data-bridge--search-target', 'results');
16
+ p.appendChild(resultsDiv);
17
+ this.appendChild(p);
18
+ }
19
+ disconnectedCallback() { }
20
+ }
21
+ if (!customElements.get('hotwire-search')) {
22
+ customElements.define('hotwire-search', HotwireSearchClass);
23
+ }
24
+ HotwireSearch = HotwireSearchClass;
25
+ }
26
+ export { HotwireSearch };
@@ -0,0 +1,2 @@
1
+ declare let HotwireThemeMode: typeof HTMLElement | undefined;
2
+ export { HotwireThemeMode };
@@ -0,0 +1,24 @@
1
+ let HotwireThemeMode;
2
+ if (typeof window !== 'undefined') {
3
+ class ThemeModeClass extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ this.handleClick = this.handleClick.bind(this);
7
+ }
8
+ connectedCallback() {
9
+ this.setAttribute('role', 'button');
10
+ this.setAttribute('data-controller', 'bridge--thememode');
11
+ this.setAttribute('data-action', 'click->bridge--thememode#handleClick');
12
+ this.addEventListener('click', this.handleClick);
13
+ }
14
+ handleClick(e) { }
15
+ disconnectedCallback() {
16
+ this.removeEventListener('click', this.handleClick);
17
+ }
18
+ }
19
+ if (!customElements.get('hotwire-theme-mode')) {
20
+ customElements.define('hotwire-theme-mode', ThemeModeClass);
21
+ }
22
+ HotwireThemeMode = ThemeModeClass;
23
+ }
24
+ export { HotwireThemeMode };
@@ -0,0 +1,2 @@
1
+ declare let HotwireToast: typeof HTMLElement | undefined;
2
+ export { HotwireToast };
@@ -0,0 +1,24 @@
1
+ let HotwireToast;
2
+ if (typeof window !== 'undefined') {
3
+ class ToastClass extends HTMLElement {
4
+ constructor() {
5
+ super();
6
+ this.handleClick = this.handleClick.bind(this);
7
+ }
8
+ connectedCallback() {
9
+ this.setAttribute('role', 'button');
10
+ this.setAttribute('data-controller', 'bridge--toast');
11
+ this.setAttribute('data-action', 'click->bridge--toast#show');
12
+ this.addEventListener('click', this.handleClick);
13
+ }
14
+ handleClick(e) { }
15
+ disconnectedCallback() {
16
+ this.removeEventListener('click', this.handleClick);
17
+ }
18
+ }
19
+ if (!customElements.get('hotwire-toast')) {
20
+ customElements.define('hotwire-toast', ToastClass);
21
+ }
22
+ HotwireToast = ToastClass;
23
+ }
24
+ export { HotwireToast };
@@ -0,0 +1,8 @@
1
+ export * from './components/hotwire-toast.js';
2
+ export * from './components/dynamic-button.js';
3
+ export * from './components/hotwire-location.js';
4
+ export * from './components/hotwire-search.js';
5
+ export * from './components/hotwire-history-sync.js';
6
+ export * from './components/hotwire-theme-mode.js';
7
+ export type { FrameworkDelegate } from './types/interface.js';
8
+ export * from './utils/utils.js';
@@ -0,0 +1,7 @@
1
+ export * from './components/hotwire-toast.js';
2
+ export * from './components/dynamic-button.js';
3
+ export * from './components/hotwire-location.js';
4
+ export * from './components/hotwire-search.js';
5
+ export * from './components/hotwire-history-sync.js';
6
+ export * from './components/hotwire-theme-mode.js';
7
+ export * from './utils/utils.js';
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Check the turbo native user agent is present or not. (Hotwire)
3
+ * Function call from server components : isTurboNativeUserAgent(req.headers['user-agent']) or isTurboNativeUserAgent(useragent) where you have to find and send the useragent manually (ex. Next js Server Component);
4
+ * Function call from client components : isTurboNativeUserAgent();
5
+ * @param userAgent
6
+ * @returns
7
+ */
8
+ export declare function isTurboNativeUserAgent(userAgent?: string): boolean;
9
+ /**
10
+ * Triggers a native Hotwire toast message in the DOM.
11
+ *
12
+ * This function searches for the first element in the document
13
+ * that uses the Stimulus controller `bridge--toast`. If found,
14
+ * it updates its `data-bridge-message` attribute with the provided
15
+ * message and simulates a click event to display the toast.
16
+ *
17
+ * This utility is useful for programmatically invoking toasts from
18
+ * anywhere in your application (e.g., after form submissions or API actions).
19
+ *
20
+ * @function triggerHotwireNativeToast
21
+ * @param {string} message - The message text to display in the toast.
22
+ * @example
23
+ * // Trigger a simple toast notification
24
+ * TriggerHotwireNativeToast("Profile updated successfully!");
25
+ *
26
+ * @remarks
27
+ * The function safely checks for the presence of the `document` object,
28
+ * so it can be called in both browser and server environments.
29
+ */
30
+ export declare function triggerHotwireNativeToast(message: string): void;
31
+ /**
32
+ * Dispatches a custom Turbo history sync event to the first
33
+ * `bridge--historysync` controller found in the DOM.
34
+ *
35
+ * This notifies the native / Hotwire bridge that the browser history
36
+ * should be synchronized with the given URL, along with the current
37
+ * document title from the active browser tab.
38
+ *
39
+ * The event name dispatched is `turbo:next-history-sync`. It bubbles
40
+ * up the DOM tree so parent listeners (including native bridges)
41
+ * can react to the navigation change.
42
+ *
43
+ * @param url - A `URL` object representing the next location to be
44
+ * synced with Turbo / native navigation.
45
+ * @param tabTitle - The current document title of the active browser
46
+ * tab, passed to the native layer for display or navigation context.
47
+ */
48
+ export declare function triggerHistorySyncEvent(url: URL, tabTitle: string): void;
49
+ /**
50
+ * Triggers the Theme Mode bridge event by programmatically clicking
51
+ * the hidden theme mode button in the DOM.
52
+ *
53
+ * This function updates the `data-bridge-mode` attribute on the button
54
+ * and dispatches a click event so the native bridge can react.
55
+ *
56
+ * @param theme - The theme mode to apply.
57
+ * Must be either `"dark"` or `"light"`.
58
+ */
59
+ export declare function triggerThemeModeEvent(theme: string): void;
60
+ /**
61
+ * Triggers a native cart count update via the Hotwire bridge.
62
+ *
63
+ * This function:
64
+ * - Finds the first DOM element wired with the Hotwire Dynamic Button controller
65
+ * responsible for sending cart count data to the native app.
66
+ * - Sets the `data-bridge-cartcount` attribute with the provided cart count.
67
+ * - Programmatically triggers a click event to notify the native layer.
68
+ *
69
+ * The function safely exits when executed in a non-browser environment
70
+ * (e.g., during server-side rendering).
71
+ *
72
+ * @param {number} cartcount - The total number of items in the cart
73
+ */
74
+ export declare function triggerCartCountValue(cartcount: number): void;
75
+ /**
76
+ * Triggers the modal open event by simulating a click on the first button
77
+ * that matches the specified `data-controller` and `data-action` attributes.
78
+ * This is typically used to send a signal to the native side to open a modal.
79
+ *
80
+ * @remarks
81
+ * - The function first checks if the `document` object is available (to avoid errors in non-browser environments).
82
+ * - It looks for a button element that has the `data-controller="bridge--dynamicbutton"` and
83
+ * `data-action="click->bridge--dynamicbutton#sendModalOpenEvent"` attributes.
84
+ * - If such a button exists, it simulates a click on the first button in the NodeList.
85
+ *
86
+ * @example
87
+ * triggerDynamicButtonModalOpenEvent(); // Opens the modal
88
+ */
89
+ export declare function triggerDynamicButtonModalOpenEvent(): void;
90
+ /**
91
+ * Triggers the modal dismiss event by simulating a click on the first button
92
+ * that matches the specified `data-controller` and `data-action` attributes.
93
+ * This is typically used to send a signal to the native side to dismiss or close a modal.
94
+ *
95
+ * @remarks
96
+ * - The function first checks if the `document` object is available (to avoid errors in non-browser environments).
97
+ * - It looks for a button element that has the `data-controller="bridge--dynamicbutton"` and
98
+ * `data-action="click->bridge--dynamicbutton#sendModalDismissEvent"` attributes.
99
+ * - If such a button exists, it simulates a click on the first button in the NodeList.
100
+ *
101
+ * @example
102
+ * triggerDynamicButtonModalDismissEvent(); // Closes the modal
103
+ */
104
+ export declare function triggerDynamicButtonModalDismissEvent(): void;