Repository navigation
Simplify setup, fix tracking bugs and close storefront gaps - #52
Merged
Merged
Conversation
Webchat, popups and other widgets are configured in Hellotext, so the settings page keeps only the Business ID and Access Token, and the store loads the latest unversioned Hellotext.js from jsDelivr on the storefront. - Register hellotext_create_profile from an always-loaded file; it only existed after the CreateProfile class autoloaded, so most requests never created or linked profiles. - Send profile and session requests to /v1; the client's static suffix dropped it for the rest of the request. - Use the session stored on the order for status changes and refunds, and never link a shop manager's session to a customer or new user. - Capture the session at classic and block checkout and track order.placed once, when the order is paid or on hold, from the thank-you page or the status change. - Compare carts once at shutdown in WC()->session: totals after recalculation, changed quantities, no removals after checkout, referer URL for background add to cart. Stop starting a PHP session. - Track only valid coupons, validated against the cart. - Register the activation hook, reissue the API key on every connection, revoke it on deactivation, and move the integration when the Business ID changes. - Handle deleted products and variation terms, trim saved credentials, prefix global functions, and replace APP_ENV with HELLOTEXT_API_URL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After Hellotext.initialize(), set Hellotext.page.section from the WooCommerce page (front page: homepage; shop and product taxonomies: product_collection; product: product_details), so every event and Webchat message reports it, and call Hellotext.alert.show() for that section, as the Shopify and VTEX integrations do. The Smart Alert subscribes visitors to Push, which needs a service worker on the store's origin. Ship the worker from the Hellotext.js Push guide in assets/ and pass its path as push.serviceWorkerUrl. It registers under the plugin's folder, so it never replaces a worker the store runs at the site root. CI checks the release package includes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…out views Move the storefront startup into assets/storefront.js, with its settings in window.hellotextWoo, and close the gaps with the other integrations: - Add the product of a Webchat card to the WooCommerce cart when Hellotext.js dispatches cart.added, through ?wc-ajax=add_to_cart like WooCommerce's own buttons, refreshing the mini cart. The card's message is posted along and sent as the source of the resulting cart.added. - Track page.viewed after setting the page section, except on product pages and the checkout, which report their own events. - Track cart.viewed on the cart page and checkout.started on the checkout, once per cart and not on the thank-you or payment pages. - Send the product's whole quantity in cart.added again: Hellotext sets the cart line to it. - Skip the storefront while WooCommerce is inactive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b1f424218
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…merce version Review findings: - The Webchat add to cart opens only http(s) pages on the store's origin (Aikido: unvalidated window.location navigation). - A connection keeps the store's working API key until Hellotext accepts the new one. A failed connection removes only the new key, shows on the settings page, and is retried when the settings are saved again, even unchanged. A key a cut-short connection left pending is cleared first. - A customer's session is remembered as linked only after Hellotext linked it, so a failed attempt is retried on the next visit. Checkout links: ?hellotext_checkout=1&products=id:quantity,..., the link Hellotext sends stores older than WooCommerce 10.0, replaces the cart with the products and opens the checkout with the link's other parameters, as WooCommerce's /checkout-link/ does. A product that needs options opens its page; when nothing can be added, the cart opens. The WooCommerce version is sent when connecting, so Hellotext can choose between WooCommerce's checkout link and the plugin's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Part of hellotext/hellotext#6270.
Simplifies the plugin's setup, fixes the tracking bugs found while reviewing it, and closes the storefront gaps with the VTEX, Shopify, Magento and Tienda Nube integrations. Three commits, each with passing tests.
Simpler setup
@hellotext/hellotext/dist/hellotext.min.js), as the other integrations do, and no longer loads it in wp-admin.define('HELLOTEXT_API_URL', …)inwp-config.phpinstead ofAPP_ENV.Bugs fixed
hellotext_create_profilewas registered at the bottom of theCreateProfileclass file, which only loads when the class is first used. Product views, carts and checkouts never created or linked profiles./v1after any earlier request in the same page load, through the client's static suffix.hello_sessionand created a profile for them. They now use the session stored on the order, and users created in wp-admin don't get the admin's session.order.placednever fired on block themes or when the customer didn't return from the payment page. The session is now captured at classic and block checkout, andorder.placedis sent once, when the order is paid or on hold. Orders tracked by earlier versions aren't sent again.WC()->session.uninstall().Storefront
assets/storefront.jsstarts Hellotext.js with the settings inwindow.hellotextWoo, then:Hellotext.page.section(front page →homepage; shop, categories, tags and attributes →product_collection; product →product_details), so every event and Webchat message reports it, and callsHellotext.alert.show(section).push.serviceWorkerUrl. It registers under the plugin's folder, so it never replaces a worker the store runs at the root.?wc-ajax=add_to_cart, refreshes the mini cart, and credits the resultingcart.addedto the card's message.page.viewedin the browser;cart.viewed, andcheckout.startedonce per cart, from PHP.cart.addedcarries the product's whole quantity in the cart, since Rails'CartService#add_items_to_cartsets the line to it.Checkout links and connecting
?hellotext_checkout=1&products=id:quantity,…is the checkout link Hellotext sends stores older than WooCommerce 10.0 (hellotext/hellotext#6959)./checkout-link/does.Testing
storefront.jswas run in Node against stubbedHellotext,fetchand jQuery: startup order, page view rules, add to cart, variable products, block Mini-Cart, redirect to cart, failures.DEVELOPMENT.mdlists what to smoke test.Needs a Rails change
Woo::Integration::Createdoesn't create a Push channel, as the VTEX and Shopify setup jobs do withfind_or_associate_push_channel. Until it does,Api::V1::Public::Push::IdentitiesControllerrejects subscriptions from Woo stores, so the Smart Alert's "Allow" can't subscribe visitors.🤖 Generated with Claude Code