Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(quantic): added logic to include quantic version in analytic payloads #4685

Merged
merged 12 commits into from
Nov 26, 2024

Conversation

mmitiche
Copy link
Contributor

@mmitiche mmitiche commented Nov 19, 2024

SFINT-5760

Description

Created the logic that will include the Quantic version in the analytic payloads pf every event logged by a Quantic component.

Screenshot 2024-11-19 at 9 26 39 AM

This logic relies on a new static resource that I created called. quanticMetadata which is a JSON file that contains the Quantic version, that's how it will work:

  • When building the Quantic library, the Quantic version is read from the package.json file and is written in the new static resource quanticMetadata.json.
  • The Quantic interfaces components for search, insight, case assist and recommendation use cases all fetch this static resource on their connected callback and pass an analytics middleware to the Headless engine they creating, this middleware handles adding the Quantic version to the analytics payload.

Copy link

github-actions bot commented Nov 19, 2024

Pull Request Report

PR Title

✅ Title follows the conventional commit spec.

Live demo links

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 241.4 241.4 0
commerce 346 346 0
search 412.5 412.5 0
insight 403.7 403.7 0
recommendation 253.6 253.6 0
ssr 406 406 0
ssr-commerce 358.3 358.3 0

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
case-assist 0 6 0
insight 0 27 0
commerce 0 15 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
case-assist : missing SSR support
insight : missing SSR support
commerce : missing SSR support

Copy link
Collaborator

@erocheleau erocheleau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with adding a new static resource is that this requires at minimum a network call to load it.

I would much rather we simply create a version.js file under quanticUtils for example, and simply write this in it:

export const version = '3.3.0';

and under quanticUtils.js we can have export * from './version.js';

and then we can import {version} from 'c/quanticUtils'; wherever we need it, this way instead of a new network call to load a static resource, it'll already be compiled in the components themselves who need it.

@mmitiche
Copy link
Contributor Author

The issue with adding a new static resource is that this requires at minimum a network call to load it.

I would much rather we simply create a version.js file under quanticUtils for example, and simply write this in it:

export const version = '3.3.0';

and under quanticUtils.js we can have export * from './version.js';

and then we can import {version} from 'c/quanticUtils'; wherever we need it, this way instead of a new network call to load a static resource, it'll already be compiled in the components themselves who need it.

The reason I did not go for the QuanticUtils solution is because I didn't want to source control a file that we are not supposed to change and that should not be change manually.
Mainly to avoid changing this by mistake or having to maintain this in our code base, and just because it made sense to not source control a file that we are never supposed to change.

Additionally, preserving this information in the Quantic Utils would probably require a logic that will automatically commit a change in this version.js file whenever we create a new version of Quantic, which means this is an additional logic to create and to maintain.

Another reason , less important the the two others, is to avoid writing the same information twice in our codebase, in the version.js and in package.json.

In the other hand, using static resources, true that it is an additional network call but I think we can all agree that it's insignificant in a Salesforce Env, especially that the file to be fetch is extremely light so practically I don't think there is a concrete or noticeable impact.
Additionally, it's the simplest way and it avoids source controlling the file that holds the version, saving us from maintaining this file and creating the logic to automatically commit to this file and maintain the logic that does this and it avoids us from having the same information duplicated in two files.

That being said, and because static resource is a natural way of handling this in SF, when I balanced the pros and cons I found that using static resources seems better than using the Quantic Utils.

Copy link
Collaborator

@erocheleau erocheleau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can, try to make this appear as rename, but otherwise all seems good!

packages/quantic/build-static-resources.js Show resolved Hide resolved
@mmitiche mmitiche added this pull request to the merge queue Nov 26, 2024
Merged via the queue into master with commit db71478 Nov 26, 2024
122 checks passed
@mmitiche mmitiche deleted the SFINT-5760 branch November 26, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants