Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Insights): integrate Insights (Click Analytics) with InstantSearch
feat(Insights): add withInsightsClient connector wrapper This PR adds a withInsightsClient which is an HOC for connectors. ```js const connectHitsWithInsightsClient = withInsightsClient(connectHits) ``` This connector will be used by default in the widget Hits and InfiniteHits to wrap connectHits and connectInfiniteHits respectively. When this PR is merged and released we can start using withInsightsClient in the flavours. feat(Insights): add template helpers feat(Insights): add withInsightsListener This commit adds withInsightsListener which - wraps Hits and InfiniteHits component, - listens to inner clicks targetting elements with data-insights attributes - calls the insights client exposed by `withInsightsClient` ```js const HitsWithInsightsListener = withInsightsListener(Hits) ``` feat(Insights): allow passing insightsClient to instantsearch instance feat(Insights): add listener to Hits feat(Insights): add listener to InfiniteHits feat(Insights): add storybook example for hits feat(Insights & typescript): type all the things extract *WithInsightsListeners components to upper scope rename withInsightsClient to withInsights feat(Insights): fix positions in infiniteScroll feat(Insights): extract addAbsolutePositions to make it connector responsibility unshorten variable name ev -> event rename isFirstRendering -> isFirstRender type mouse event avoid inline return clean unsused comment avoid inline return inline cast document.querySelector<HTMLElement> prettier things remove document maniputation in tests remove inferrable types in readDataAttributes use post modern typing type return values Apply suggestions from code review Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> add space before describe change inferPayload signature to use named params remove perf comment add space before Unmounter Apply suggestions from code review Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> Update src/lib/__tests__/insights-client-test.js Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> remove param mutation absolute imports before relative convert to typescript client and listener tests factorize Without inside 'types/utils' simplify types typo feedback: expose addAbsolutePosition in utils feedback: improved error message add type on serializedPayload Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> casting div.firstElementChild with as keyword Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> feedback: move casting on another line feedback: improve error message on incorrect data-insights-payload json string prettier all the things feedback: add type for Hits React component fix typescript file linting add query id feat(insights): add __queryID to connectHits & connectInfiniteHits simplified tests feat(insights): encode payload to base64 typo Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> typo Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> feedback: fix insightsClient defaulting to jest.fn() feedback: remove unused beforeEach feedback: group expect statements for payloads typo Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> feedback: add quotes around objectID Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> feedback: rename WidgetParams -> TWidgetParams feedback: move clickAnalytics: true to configure feedback: use toHaveBeenNthCalledWith feedback: remove extra check for insightClient callability feedback: remove proptypes fix: typo inline setup function fix: error message formatting Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> fix: error message formatting Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> fix: error message formatting Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> fix: error message formatting Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> fix: error message formatting Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> fix: error message formatting Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> fix: error message formatting Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> fix: error message formatting fix: error message formatting Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> fix: error message formatting Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> fix: error message formatting Co-Authored-By: tkrugg <tkrugg@users.noreply.github.com> fix: update snapshots after error message reformatting
- Loading branch information