Skip to content

Commit d5ae9b8

Browse files
committed
remove data start-guide support
1 parent e852632 commit d5ae9b8

File tree

3 files changed

+2
-27
lines changed

3 files changed

+2
-27
lines changed

apps/nextjs/src/app/(dashboard)/widget/test/WidgetButtons.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ export function WidgetButtons() {
4646
<div className="space-y-2 mt-2">
4747
<h3 className="text-sm font-medium text-white">Change refund policy to 3 months:</h3>
4848
<button
49-
data-helper-start-guide="Change my refund policy to 3 months - Go to the Settings page, scroll down to the Refund Policy section, and select a 3 months refund policy from the dropdown menu. If needed, you can also add fine print to describe your policy in more detail."
49+
data-helper-prompt="Change my refund policy to 3 months - Go to the Settings page, scroll down to the Refund Policy section, and select a 3 months refund policy from the dropdown menu. If needed, you can also add fine print to describe your policy in more detail."
5050
className="focus:shadow-outline rounded bg-blue-500 px-4 py-2 font-bold text-primary-foreground transition duration-300 hover:bg-blue-600 focus:outline-none text-xs"
5151
>
5252
Prompt to change refund policy to 3 months
5353
</button>
5454
<button
55-
data-helper-start-guide="Go to the Discounts tab on the Checkout page, click 'New discount', enter '50off' as the discount code, select 'All products', and set the discount to 50% off."
55+
data-helper-prompt="Create a 50% off discount for all products - Go to the Discounts tab on the Checkout page, click 'New discount', enter '50off' as the discount code, select 'All products', and set the discount to 50% off."
5656
className="focus:shadow-outline rounded bg-blue-500 px-4 py-2 font-bold text-primary-foreground transition duration-300 hover:bg-blue-600 focus:outline-none text-xs"
5757
>
5858
Prompt to create 50% off discount

apps/nextjs/src/sdk/guideManager.ts

-4
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,8 @@ export class GuideManager {
183183
const hand = this.createHelperHand();
184184
const rect = element.getBoundingClientRect();
185185

186-
// Target position (center of the element)
187186
const targetX = rect.left + rect.width / 2;
188187
const targetY = rect.top + rect.height / 2;
189-
190-
// Check if the target element is behind the widget wrapper
191188
const isElementBehindWidget = this.isElementBehindWidget(element);
192189

193190
if (isElementBehindWidget) {
@@ -200,7 +197,6 @@ export class GuideManager {
200197
hand.style.left = `${targetX}px`;
201198
hand.style.top = `${targetY}px`;
202199

203-
// Simulate clicking after the hand reaches the element
204200
setTimeout(() => {
205201
hand.classList.add("clicking");
206202

apps/nextjs/src/sdk/index.ts

-21
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ class HelperWidget {
257257
private setupEventListeners(): void {
258258
this.connectExistingPromptElements();
259259
this.connectExistingToggleElements();
260-
this.setupStartGuideEventListeners();
261260
this.setupMutationObserver();
262261

263262
window.addEventListener("message", async (event: MessageEvent) => {
@@ -358,20 +357,6 @@ class HelperWidget {
358357
});
359358
}
360359

361-
private setupStartGuideEventListeners(): void {
362-
this.guideManager.connectExistingStartGuideElements(this.handleStartGuideClick.bind(this));
363-
}
364-
365-
private handleStartGuideClick(event: MouseEvent): void {
366-
const startGuideElement = event.currentTarget as HTMLElement;
367-
const prompt = startGuideElement.getAttribute("data-helper-start-guide");
368-
369-
if (prompt) {
370-
this.startGuideInternal(prompt);
371-
startGuideElement.setAttribute("data-helper-start-guide-sent", "true");
372-
}
373-
}
374-
375360
private onIframeReady(): void {
376361
if (this.isIframeReady) return;
377362

@@ -452,14 +437,8 @@ class HelperWidget {
452437
if (node.hasAttribute("data-helper-toggle")) {
453438
this.connectToggleElement(node);
454439
}
455-
if (node.hasAttribute("data-helper-start-guide")) {
456-
this.guideManager.connectStartGuideElement(node, this.handleStartGuideClick.bind(this));
457-
}
458440
node.querySelectorAll("[data-helper-prompt]").forEach(this.connectPromptElement.bind(this));
459441
node.querySelectorAll("[data-helper-toggle]").forEach(this.connectToggleElement.bind(this));
460-
node.querySelectorAll("[data-helper-start-guide]").forEach((el) => {
461-
this.guideManager.connectStartGuideElement(el, this.handleStartGuideClick.bind(this));
462-
});
463442
}
464443
});
465444
}

0 commit comments

Comments
 (0)