-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lib): 🎨 Ask for URL instead of publishId
- Loading branch information
1 parent
d6b9413
commit 5a2df9f
Showing
10 changed files
with
378 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
import * as Typebot from "../../src"; | ||
import * as Typebot from '../../src' | ||
|
||
beforeEach(() => { | ||
document.body.innerHTML = ""; | ||
}); | ||
document.body.innerHTML = '' | ||
}) | ||
|
||
it("should have the corresponding custom color", () => { | ||
expect.assertions(1); | ||
it('should have the corresponding custom color', () => { | ||
expect.assertions(1) | ||
Typebot.initBubble({ | ||
button: { color: "#222222" }, | ||
publishId: "typebot-id", | ||
}); | ||
button: { color: '#222222' }, | ||
url: 'https://typebot.io/typebot-id', | ||
}) | ||
const buttonElement = document.querySelector( | ||
"#typebot-bubble > button" | ||
) as HTMLElement; | ||
expect(buttonElement.style.backgroundColor).toBe("rgb(34, 34, 34)"); | ||
}); | ||
'#typebot-bubble > button' | ||
) as HTMLElement | ||
expect(buttonElement.style.backgroundColor).toBe('rgb(34, 34, 34)') | ||
}) | ||
|
||
it("should have the default svg icon", () => { | ||
expect.assertions(1); | ||
it('should have the default svg icon', () => { | ||
expect.assertions(1) | ||
Typebot.initBubble({ | ||
publishId: "typebot-id", | ||
}); | ||
url: 'https://typebot.io/typebot-id', | ||
}) | ||
const buttonIconElement = document.querySelector( | ||
"#typebot-bubble > button > .icon" | ||
) as HTMLElement; | ||
expect(buttonIconElement.tagName).toBe("svg"); | ||
}); | ||
'#typebot-bubble > button > .icon' | ||
) as HTMLElement | ||
expect(buttonIconElement.tagName).toBe('svg') | ||
}) | ||
|
||
it("should have the corresponding custom icon", () => { | ||
expect.assertions(1); | ||
it('should have the corresponding custom icon', () => { | ||
expect.assertions(1) | ||
Typebot.initBubble({ | ||
button: { iconUrl: "https://web.com/icon.png" }, | ||
publishId: "typebot-id", | ||
}); | ||
button: { iconUrl: 'https://web.com/icon.png' }, | ||
url: 'https://typebot.io/typebot-id', | ||
}) | ||
const buttonIconElement = document.querySelector( | ||
"#typebot-bubble > button > .icon" | ||
) as HTMLImageElement; | ||
expect(buttonIconElement.src).toBe("https://web.com/icon.png"); | ||
}); | ||
'#typebot-bubble > button > .icon' | ||
) as HTMLImageElement | ||
expect(buttonIconElement.src).toBe('https://web.com/icon.png') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,91 @@ | ||
import * as Typebot from "../../src"; | ||
import * as Typebot from '../../src' | ||
|
||
beforeEach(() => { | ||
document.body.innerHTML = ""; | ||
}); | ||
document.body.innerHTML = '' | ||
}) | ||
|
||
describe("openBubble", () => { | ||
it("should add the opened bubble", () => { | ||
expect.assertions(3); | ||
describe('openBubble', () => { | ||
it('should add the opened bubble', () => { | ||
expect.assertions(3) | ||
const { open } = Typebot.initBubble({ | ||
publishId: "typebot-id", | ||
}); | ||
const bubble = document.getElementById("typebot-bubble") as HTMLDivElement; | ||
expect(bubble.classList.contains("iframe-opened")).toBe(false); | ||
open(); | ||
expect(bubble.classList.contains("iframe-opened")).toBe(true); | ||
expect(open).not.toThrow(); | ||
}); | ||
url: 'https://typebot.io/typebot-id', | ||
}) | ||
const bubble = document.getElementById('typebot-bubble') as HTMLDivElement | ||
expect(bubble.classList.contains('iframe-opened')).toBe(false) | ||
open() | ||
expect(bubble.classList.contains('iframe-opened')).toBe(true) | ||
expect(open).not.toThrow() | ||
}) | ||
|
||
it("should hide the proactive message", () => { | ||
expect.assertions(2); | ||
it('should hide the proactive message', () => { | ||
expect.assertions(2) | ||
const { open, openProactiveMessage } = Typebot.initBubble({ | ||
publishId: "typebot-id", | ||
url: 'https://typebot.io/typebot-id', | ||
proactiveMessage: { | ||
textContent: "Hi click here!", | ||
avatarUrl: "https://website.com/my-avatar.png", | ||
textContent: 'Hi click here!', | ||
avatarUrl: 'https://website.com/my-avatar.png', | ||
}, | ||
}); | ||
const bubble = document.getElementById("typebot-bubble") as HTMLDivElement; | ||
if (openProactiveMessage) openProactiveMessage(); | ||
expect(bubble.classList.contains("message-opened")).toBe(true); | ||
open(); | ||
expect(bubble.classList.contains("message-opened")).toBe(false); | ||
}); | ||
}); | ||
}) | ||
const bubble = document.getElementById('typebot-bubble') as HTMLDivElement | ||
if (openProactiveMessage) openProactiveMessage() | ||
expect(bubble.classList.contains('message-opened')).toBe(true) | ||
open() | ||
expect(bubble.classList.contains('message-opened')).toBe(false) | ||
}) | ||
}) | ||
|
||
describe("closeBubble", () => { | ||
it("should remove the corresponding class", () => { | ||
expect.assertions(2); | ||
describe('closeBubble', () => { | ||
it('should remove the corresponding class', () => { | ||
expect.assertions(2) | ||
const { close, open } = Typebot.initBubble({ | ||
publishId: "typebot-id", | ||
}); | ||
open(); | ||
const bubble = document.getElementById("typebot-bubble") as HTMLDivElement; | ||
expect(bubble.classList.contains("iframe-opened")).toBe(true); | ||
close(); | ||
expect(bubble.classList.contains("iframe-opened")).toBe(false); | ||
}); | ||
}); | ||
url: 'https://typebot.io/typebot-id', | ||
}) | ||
open() | ||
const bubble = document.getElementById('typebot-bubble') as HTMLDivElement | ||
expect(bubble.classList.contains('iframe-opened')).toBe(true) | ||
close() | ||
expect(bubble.classList.contains('iframe-opened')).toBe(false) | ||
}) | ||
}) | ||
|
||
describe("openProactiveMessage", () => { | ||
it("should add the opened className", () => { | ||
expect.assertions(1); | ||
describe('openProactiveMessage', () => { | ||
it('should add the opened className', () => { | ||
expect.assertions(1) | ||
const { openProactiveMessage } = Typebot.initBubble({ | ||
proactiveMessage: { | ||
textContent: "Hi click here!", | ||
textContent: 'Hi click here!', | ||
}, | ||
publishId: "typebot-id", | ||
}); | ||
const bubble = document.getElementById("typebot-bubble") as HTMLDivElement; | ||
if (openProactiveMessage) openProactiveMessage(); | ||
expect(bubble.classList.contains("message-opened")).toBe(true); | ||
}); | ||
url: 'https://typebot.io/typebot-id', | ||
}) | ||
const bubble = document.getElementById('typebot-bubble') as HTMLDivElement | ||
if (openProactiveMessage) openProactiveMessage() | ||
expect(bubble.classList.contains('message-opened')).toBe(true) | ||
}) | ||
|
||
it("shouldn't be returned if no message", () => { | ||
expect.assertions(1); | ||
expect.assertions(1) | ||
const { openProactiveMessage } = Typebot.initBubble({ | ||
publishId: "typebot-id", | ||
}); | ||
expect(openProactiveMessage).toBeUndefined(); | ||
}); | ||
}); | ||
url: 'typebot-id', | ||
}) | ||
expect(openProactiveMessage).toBeUndefined() | ||
}) | ||
}) | ||
|
||
describe("Request commands afterwards", () => { | ||
it("should return defined commands", () => { | ||
describe('Request commands afterwards', () => { | ||
it('should return defined commands', () => { | ||
Typebot.initBubble({ | ||
proactiveMessage: { | ||
textContent: "Hi click here!", | ||
textContent: 'Hi click here!', | ||
}, | ||
publishId: "typebot-id", | ||
}); | ||
url: 'https://typebot.io/typebot-id', | ||
}) | ||
|
||
const { close, open, openProactiveMessage } = Typebot.getBubbleActions(); | ||
expect(close).toBeDefined(); | ||
expect(open).toBeDefined(); | ||
expect(openProactiveMessage).toBeDefined(); | ||
open(); | ||
const bubble = document.getElementById("typebot-bubble") as HTMLDivElement; | ||
expect(bubble.classList.contains("iframe-opened")).toBe(true); | ||
}); | ||
}); | ||
const { close, open, openProactiveMessage } = Typebot.getBubbleActions() | ||
expect(close).toBeDefined() | ||
expect(open).toBeDefined() | ||
expect(openProactiveMessage).toBeDefined() | ||
open() | ||
const bubble = document.getElementById('typebot-bubble') as HTMLDivElement | ||
expect(bubble.classList.contains('iframe-opened')).toBe(true) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
5a2df9f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
viewer-v2 – ./apps/viewer
app.yvon.earth
chat.hayuri.id
granitemj.com
gollum.riku.ai
bot.matthesv.de
gmqtops.com
gevenice.com
gelville.com
chat.matthesv.de
bot.contakit.com
graniteerwin.com
viewer.typebot.io
zap.fundviser.in
bot.dsignagency.com
92109660.therpm.club
thegraniteempire.com
demo.wemakebots.xyz
88584434.therpm.club
bot.digitalpointer.id
graniteempirecin.com
bot.outstandbrand.com
criar.somaperuzzo.com
bot.pratikmandalia.com
michaeljackson.riku.ai
link.venturasuceder.com
chat.thehomebuyersusa.com
invite.bridesquadapp.com
granitedepotasheville.com
granitedepotknoxville.com
countertopscolumbia.com
typebot-viewer.vercel.app
bot.adventureconsulting.hu
granitedepotcrossroads.com
chat.atlasoutfittersk9.com
liveconvert.kandalearn.com
lavergne.thegraniteempire.com
granitequartzgreeneville.com
tarian.theiofoundation.org
granitedepotcountertops.com
bot.pinpointinteractive.com
viewer-v2-typebot-io.vercel.app
viewer-v2-git-main-typebot-io.vercel.app