Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Shopify analytics #108

Merged
merged 65 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
382acc8
working shopify analytics
wizardlyhel Jan 6, 2023
2beabf7
add to cart analytics
wizardlyhel Jan 9, 2023
c566941
workign all events
wizardlyhel Jan 10, 2023
54b75ea
Merge branch '2023-01' into hl-shopify-analytics
wizardlyhel Jan 10, 2023
fc7dde4
file renames
wizardlyhel Jan 10, 2023
52486b1
file paths
wizardlyhel Jan 11, 2023
32966c4
lint
wizardlyhel Jan 11, 2023
9ae1d65
lint
wizardlyhel Jan 11, 2023
b2dd069
fix nextjs app lint
wizardlyhel Jan 11, 2023
e6e9f37
fix nextjs app lint
wizardlyhel Jan 11, 2023
e6a231c
test for schemas
wizardlyhel Jan 11, 2023
3943144
lint test
wizardlyhel Jan 12, 2023
f797480
fix nextjs app
wizardlyhel Jan 12, 2023
36e28a6
Merge branch '2023-01' into hl-shopify-analytics
wizardlyhel Jan 12, 2023
9e74df6
add analytic-utils tests and refactor (#117)
juanpprieto Jan 12, 2023
e5ce613
fix name
wizardlyhel Jan 12, 2023
97d9545
fix test
wizardlyhel Jan 12, 2023
fab4b40
add test for coverage
wizardlyhel Jan 12, 2023
ed2cf8e
fix no product payload test
wizardlyhel Jan 12, 2023
c806c5b
@juanpprieto/fix-failing-tests (#120)
juanpprieto Jan 12, 2023
e583db3
sendShopifyAnalytics tests
wizardlyhel Jan 13, 2023
a70eb11
better test naming
wizardlyhel Jan 13, 2023
9e2b442
lint
wizardlyhel Jan 13, 2023
4d59c5d
some PR feedbacks
wizardlyhel Jan 13, 2023
de592d6
more PR feedbacks
wizardlyhel Jan 13, 2023
6e3e07e
lint
wizardlyhel Jan 13, 2023
9aa9118
more test
wizardlyhel Jan 13, 2023
0bd8681
more test
wizardlyhel Jan 13, 2023
1674ecc
better name test
wizardlyhel Jan 13, 2023
3d505a0
@juanpprieto/cookie util test (#121)
juanpprieto Jan 13, 2023
570e57b
Merge branch '2023-01' into hl-shopify-analytics
wizardlyhel Jan 13, 2023
73b7f86
fix lint complains
wizardlyhel Jan 14, 2023
abb3a4b
Merge branch 'hl-shopify-analytics' of https://github.com/Shopify/hyd…
wizardlyhel Jan 14, 2023
667c971
fix weird ts complain
wizardlyhel Jan 14, 2023
46e8c1f
fix format
wizardlyhel Jan 14, 2023
7c1921c
clean up constants
wizardlyhel Jan 16, 2023
d46734f
convert ShopifyCookie to a hook
wizardlyhel Jan 16, 2023
6df87ee
ts clean up
wizardlyhel Jan 16, 2023
2863194
ts clean up
wizardlyhel Jan 16, 2023
6ae58f0
more ts clean up
wizardlyhel Jan 16, 2023
0b937f9
more feedback
wizardlyhel Jan 16, 2023
d63cc4f
update ShopPayButton
wizardlyhel Jan 16, 2023
53ba303
make sure monorail endpoint can be updated to the shop domain alterna…
wizardlyhel Jan 16, 2023
6dc00b2
mock failed response
wizardlyhel Jan 16, 2023
352e7e0
add doc
wizardlyhel Jan 16, 2023
d7c0fd1
prettier
wizardlyhel Jan 17, 2023
21f398c
ci browser different?
wizardlyhel Jan 17, 2023
5f053f5
return explicit type
wizardlyhel Jan 17, 2023
2881f28
see if this works
wizardlyhel Jan 17, 2023
65ecffd
merge with 2023-01
wizardlyhel Jan 17, 2023
b44ae42
fix type prettier
wizardlyhel Jan 17, 2023
1373943
fix package path
wizardlyhel Jan 17, 2023
36a0233
Merge branch '2023-01' into hl-shopify-analytics
wizardlyhel Jan 17, 2023
1240e4f
full cookie test
wizardlyhel Jan 17, 2023
4633b20
prettier
wizardlyhel Jan 17, 2023
4d9c859
move shopify cookie constants back into cart constant
wizardlyhel Jan 17, 2023
29760a4
missed a return type
wizardlyhel Jan 17, 2023
6ff782d
Update .changeset/plenty-moles-listen.md
wizardlyhel Jan 17, 2023
30a7d7c
remove console log
wizardlyhel Jan 17, 2023
0694583
update exposed methods, constants, and types
wizardlyhel Jan 17, 2023
1cea1e5
Merge branch '2023-01' into hl-shopify-analytics
wizardlyhel Jan 17, 2023
34a2158
prettier
wizardlyhel Jan 17, 2023
eee8018
fix file name
wizardlyhel Jan 17, 2023
60ae215
fix file name again
wizardlyhel Jan 17, 2023
a40c1c4
Small updates
frehner Jan 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/plenty-moles-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/hydrogen-react': patch
wizardlyhel marked this conversation as resolved.
Show resolved Hide resolved
---

Shopify Analytics methods and components
wizardlyhel marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 9 additions & 1 deletion apps/nextjs/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
import { TypedDocumentNode as DocumentNode, ResultOf } from '@graphql-typed-document-node/core';


export type FragmentType<TDocumentType extends DocumentNode<any, any>> = TDocumentType extends DocumentNode<
Expand Down Expand Up @@ -38,3 +38,11 @@ export function useFragment<TType>(
): TType | ReadonlyArray<TType> | null | undefined {
return fragmentType as any
}


export function makeFragmentData<
F extends DocumentNode,
FT extends ResultOf<F>
>(data: FT, _fragment: F): FragmentType<F> {
return data as FragmentType<F>;
}
41 changes: 41 additions & 0 deletions apps/nextjs/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,54 @@
import * as types from './graphql';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';

/**
* Map of all GraphQL operations in the project.
*
* This map has several performance disadvantages:
* 1. It is not tree-shakeable, so it will include all operations in the project.
* 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
* 3. It does not support dead code elimination, so it will add unused operations.
*
* Therefore it is highly recommended to use the babel-plugin for production.
*/
const documents = {
"\n query Collection($handle: String!) {\n collection(handle: $handle) {\n id\n handle\n title\n description\n }\n }\n": types.CollectionDocument,
"\n query IndexQuery {\n shop {\n name\n }\n products(first: 1) {\n nodes {\n # if you uncomment 'blah', it should have a GraphQL validation error in your IDE if you have a GraphQL plugin. It should also give an error during 'npm run dev'\n # blah\n id\n title\n publishedAt\n handle\n variants(first: 1) {\n nodes {\n id\n image {\n url\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n": types.IndexQueryDocument,
"\n query Product {\n shop {\n name\n }\n products(first: 1) {\n nodes {\n # if you uncomment 'blah', it should have a GraphQL validation error in your IDE if you have a GraphQL plugin. It should also give an error during 'npm run dev'\n # blah\n id\n title\n vendor\n publishedAt\n handle\n variants(first: 1) {\n nodes {\n id\n title\n price {\n amount\n }\n image {\n url\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n": types.ProductDocument,
"\n query Search($searchTerm: String) {\n products(first: 1, sortKey: RELEVANCE, query: $searchTerm) {\n pageInfo {\n startCursor\n endCursor\n hasNextPage\n hasPreviousPage\n }\n }\n }\n": types.SearchDocument,
};

/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query Collection($handle: String!) {\n collection(handle: $handle) {\n id\n handle\n title\n description\n }\n }\n"): (typeof documents)["\n query Collection($handle: String!) {\n collection(handle: $handle) {\n id\n handle\n title\n description\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query IndexQuery {\n shop {\n name\n }\n products(first: 1) {\n nodes {\n # if you uncomment 'blah', it should have a GraphQL validation error in your IDE if you have a GraphQL plugin. It should also give an error during 'npm run dev'\n # blah\n id\n title\n publishedAt\n handle\n variants(first: 1) {\n nodes {\n id\n image {\n url\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query IndexQuery {\n shop {\n name\n }\n products(first: 1) {\n nodes {\n # if you uncomment 'blah', it should have a GraphQL validation error in your IDE if you have a GraphQL plugin. It should also give an error during 'npm run dev'\n # blah\n id\n title\n publishedAt\n handle\n variants(first: 1) {\n nodes {\n id\n image {\n url\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query Product {\n shop {\n name\n }\n products(first: 1) {\n nodes {\n # if you uncomment 'blah', it should have a GraphQL validation error in your IDE if you have a GraphQL plugin. It should also give an error during 'npm run dev'\n # blah\n id\n title\n vendor\n publishedAt\n handle\n variants(first: 1) {\n nodes {\n id\n title\n price {\n amount\n }\n image {\n url\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query Product {\n shop {\n name\n }\n products(first: 1) {\n nodes {\n # if you uncomment 'blah', it should have a GraphQL validation error in your IDE if you have a GraphQL plugin. It should also give an error during 'npm run dev'\n # blah\n id\n title\n vendor\n publishedAt\n handle\n variants(first: 1) {\n nodes {\n id\n title\n price {\n amount\n }\n image {\n url\n altText\n width\n height\n }\n }\n }\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query Search($searchTerm: String) {\n products(first: 1, sortKey: RELEVANCE, query: $searchTerm) {\n pageInfo {\n startCursor\n endCursor\n hasNextPage\n hasPreviousPage\n }\n }\n }\n"): (typeof documents)["\n query Search($searchTerm: String) {\n products(first: 1, sortKey: RELEVANCE, query: $searchTerm) {\n pageInfo {\n startCursor\n endCursor\n hasNextPage\n hasPreviousPage\n }\n }\n }\n"];

/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*
*
* @example
* ```ts
* const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
* ```
*
* The query argument is unknown!
* Please regenerate the types.
**/
export function graphql(source: string): unknown;

export function graphql(source: string) {
return (documents as any)[source] ?? {};
}
Expand Down
Loading