feat(chat): show Crisp's launcher on every page - #46
Merged
Merged
Conversation
The chat loaded only when a reader clicked "Live chat" in the footer or on the FAQ. It now joins every page: the layout calls loadChatWhenIdle(), which adds Crisp's loader after the load event once the browser is idle, so it never delays the first paint and is never in the server render. The "Live chat" buttons open the same widget. While the consent bar covers the bottom-right corner (on a phone it spans the width) the launcher is hidden, and it returns when the bar closes; a chat the reader opened is never hidden. The bar carries data-consent-bar for this. The privacy policy, in English and Vietnamese, now says Crisp loads on every page and sets its cookies there, under legitimate interest, with conversations a reader starts still under consent. lib/crisp.ts and consent-bar.tsx are shared with TableProApp/license, which ships the same copies.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The chat launcher appeared only after a reader clicked "Live chat" in the footer or on the FAQ. The owner wants it on every page.
Change
lib/crisp.ts(shared):loadChatWhenIdle()adds Crisp's loader once the load event has fired and the browser is idle (requestIdleCallback, or 2 s on Safari). It is never in the server render and never competes with the first paint.openChat()opens the same widget, loading it first if a reader clicks early. Crisp is still given only the page's language.useLiveChat(), so every public page carries the launcher. The footer and FAQ "Live chat" buttons now open it.chat:hide), and it comes back when the bar closes (chat:show). A chat the reader opened is never hidden. The bar carriesdata-consent-barfor this. On desktop the bar sits bottom-left and the launcher is untouched.crisp-client/cookies there. It receives the IP, browser details, the pages viewed and messages. The cookies' lawful basis is legitimate interest; conversations a reader starts stay under consent. The processors list and the summary are updated to match.docs/architecture.md,docs/shared-files.md(new hashes), the Blade comment and test comments now describe the new behaviour.Merge with TableProApp/license (same shared files).
Tests
tests/js/crisp.test.ts(10 cases):ScriptsTest:openChat()is called only from click handlers andloadChatWhenIdle()only in an effect. No document carries a third-party script.npm run test:js: 181/181. Typecheck, build and Pint pass.enon/andvion/vi/pricing;chat:hide, and after answering it ischat:hide,chat:show;