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

Client-side analytics integration in demo-store #376

Merged
merged 32 commits into from
Feb 1, 2023

Conversation

wizardlyhel
Copy link
Contributor

@wizardlyhel wizardlyhel commented Jan 19, 2023

Example integration of Shopify analytics using storefront-kit-react

Docs:

@wizardlyhel wizardlyhel changed the title Analytics integration in demo-store Client-side analytics integration in demo-store Jan 24, 2023
@wizardlyhel wizardlyhel marked this pull request as ready for review January 25, 2023 22:46
@github-actions

This comment has been minimized.

jplhomer
jplhomer previously approved these changes Jan 27, 2023
Copy link
Contributor

@jplhomer jplhomer left a comment

Choose a reason for hiding this comment

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

Just a couple comments/suggestions! Looks good.

.changeset/orange-students-lie.md Show resolved Hide resolved
templates/demo-store/app/root.tsx Outdated Show resolved Hide resolved
templates/demo-store/app/root.tsx Outdated Show resolved Hide resolved
templates/demo-store/app/root.tsx Outdated Show resolved Hide resolved
templates/demo-store/app/root.tsx Outdated Show resolved Hide resolved
@blittle blittle changed the base branch from v0.x-2022-10 to 2023-01 January 31, 2023 14:51
@blittle blittle dismissed jplhomer’s stale review January 31, 2023 14:51

The base branch was changed.

@github-actions github-actions bot had a problem deploying to preview January 31, 2023 18:12 Failure
@github-actions github-actions bot had a problem deploying to preview February 1, 2023 20:17 Failure
@github-actions github-actions bot had a problem deploying to preview February 1, 2023 20:20 Failure
.changeset/orange-students-lie.md Outdated Show resolved Hide resolved
@github-actions github-actions bot had a problem deploying to preview February 1, 2023 20:49 Failure
@wizardlyhel wizardlyhel merged commit 46fc0bd into 2023-01 Feb 1, 2023
@wizardlyhel wizardlyhel deleted the hl-rsk-analytics branch February 1, 2023 23:26
Comment on lines +32 to +44
export type I18nBase = {
language: LanguageCode;
country: CountryCode;
};

export type CreateStorefrontClientOptions<TI18n extends I18nBase> = Parameters<
typeof createStorefrontUtilities
>[0] & {
cache?: Cache;
buyerIp?: string;
requestGroupId?: string;
waitUntil?: ExecutionContext['waitUntil'];
i18n?: {
language: LanguageCode;
country: CountryCode;
pathPrefix?: string;
};
i18n?: TI18n;
Copy link
Contributor

@frandiox frandiox Feb 2, 2023

Choose a reason for hiding this comment

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

@wizardlyhel I'm a bit late to the party but what's the reason to remove pathPrefix from here? We are still passing it in server.ts as a parameter to createStorefrontClient({ i18n: {pathPrefix...}}).

I guess it's because we don't use that internally in Hydrogen, so now it's only part of the types in the user land? -- like, they need to cast the type when reading pathPrefix in loaders. Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, they shouldn't need to typecast ... It should be the type that they return from their i18n function.

createStorefrontClient shouldn't dictate the type of i18n. Developers should dictate what that type is.

Let say we leave it what it was before and developer would like to have more i18n related properties (ie. currency) to be pass along in the i18n object, they would end up typecasting anyways.

So the key is that we need to make sure the type is being pass thru the createStorefrontClient.. but I just found out the type isn't being passed over (I was testing the type generic and it works there. Need to figure out what happen)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can see it working inside server.ts
Screenshot 2023-02-02 at 9 25 11 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix PR #432

@github-actions github-actions bot mentioned this pull request Feb 8, 2023
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.

3 participants