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

chore: add use session example and change tsconfig moduleResolution and module properties to nodenext to allow for @faststore/core/experimental imports. #201

Open
wants to merge 5 commits into
base: api-extensions-setup
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"generate": "faststore generate-graphql"
},
"dependencies": {
"@faststore/core": "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/core",
"@faststore/core": "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/core",
"next": "^12.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
5 changes: 4 additions & 1 deletion src/components/CustomBuyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { Button as UIButton } from "@faststore/ui";
import { usePDP } from "@faststore/core";
/** It's possible to import experimental functions, hooks & components from this namespace */
import { useSession_unstable as useSession } from "@faststore/core/experimental";

export function CustomBuyButton(_) {
const context = usePDP();
const { country } = useSession();
console.log("🚀 ~ CustomBuyButton context:", context);

return (
Expand All @@ -12,7 +15,7 @@ export function CustomBuyButton(_) {
alert("Hello User!");
}}
>
{context?.data?.product.customData}
{context?.data?.product.customData} {" - "} {country}
</UIButton>
);
}
2 changes: 1 addition & 1 deletion src/components/overrides/ProductDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SectionOverride } from "@faststore/core/src/typings/overrides";
import { SectionOverride } from "@faststore/core";
import { CustomBuyButton } from "../CustomBuyButton";

const SECTION = "ProductDetails" as const;
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"module": "nodenext",
"moduleResolution": "nodenext",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
Expand Down
38 changes: 19 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -974,9 +974,9 @@
resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz#786c5f41f043b07afb1af37683d7c33668858f6d"
integrity sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==

"@faststore/api@https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/api":
"@faststore/api@https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/api":
version "2.2.0-alpha.1"
resolved "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/api#5a0b9802d840c480a8424bc9625bd31d67dd37b9"
resolved "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/api#5a0b9802d840c480a8424bc9625bd31d67dd37b9"
dependencies:
"@envelop/on-resolve" "^2.0.6"
"@graphql-tools/schema" "^9.0.0"
Expand Down Expand Up @@ -1004,25 +1004,25 @@
path "^0.12.7"
stringify-object "^3.3.0"

"@faststore/components@https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/components":
"@faststore/components@https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/components":
version "2.2.0-alpha.1"
uid "957594b6a4dfde65525f126baddb08528e61fe2b"
resolved "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/components#957594b6a4dfde65525f126baddb08528e61fe2b"
resolved "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/components#957594b6a4dfde65525f126baddb08528e61fe2b"

"@faststore/core@https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/core":
version "2.2.0-alpha.2"
resolved "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/core#ba2ec96fadefd2ca9339518204ca6678ea8f4cdd"
"@faststore/core@https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/core":
version "2.2.0-alpha.3"
resolved "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/core#298c1a2f7a0927518bb23e5e1900949e7188570a"
dependencies:
"@builder.io/partytown" "^0.6.1"
"@envelop/core" "^1.2.0"
"@envelop/graphql-jit" "^1.1.1"
"@envelop/parser-cache" "^2.2.0"
"@envelop/validation-cache" "^2.2.0"
"@faststore/api" "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/api"
"@faststore/components" "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/components"
"@faststore/graphql-utils" "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/graphql-utils"
"@faststore/sdk" "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/sdk"
"@faststore/ui" "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/ui"
"@faststore/api" "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/api"
"@faststore/components" "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/components"
"@faststore/graphql-utils" "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/graphql-utils"
"@faststore/sdk" "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/sdk"
"@faststore/ui" "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/ui"
"@graphql-codegen/cli" "^3.3.1"
"@graphql-codegen/typescript" "^3.0.4"
"@graphql-codegen/typescript-operations" "^3.0.4"
Expand Down Expand Up @@ -1058,9 +1058,9 @@
tsx "^3.12.7"
typescript "4.7.3"

"@faststore/graphql-utils@https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/graphql-utils":
"@faststore/graphql-utils@https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/graphql-utils":
version "2.2.0-alpha.1"
resolved "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/graphql-utils#5920f0145a35008a247104dc2742efcc52632638"
resolved "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/graphql-utils#5920f0145a35008a247104dc2742efcc52632638"
dependencies:
"@babel/traverse" "^7.15.4"
"@babel/types" "^7.15.6"
Expand All @@ -1072,17 +1072,17 @@
resolved "https://registry.yarnpkg.com/@faststore/lighthouse/-/lighthouse-2.1.31.tgz#e1e9942496e1ca7314b4232ccc79805f2e4cb1d1"
integrity sha512-12QzCbv/zla+MLU9z+PscV+JOGX12fAsL+eIapIseS4F5duh5Pom4DMDH7Za6EVRLgA/FoGNIDeIyfnamwdSvA==

"@faststore/sdk@https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/sdk":
"@faststore/sdk@https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/sdk":
version "2.2.0-alpha.1"
resolved "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/sdk#eaaed95d9095c09cbd7ad41aca5af4cc5e4d35a0"
resolved "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/sdk#eaaed95d9095c09cbd7ad41aca5af4cc5e4d35a0"
dependencies:
idb-keyval "^5.1.3"

"@faststore/ui@https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/ui":
"@faststore/ui@https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/ui":
version "2.2.0-alpha.1"
resolved "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/ui#47be3e02545c434b450a59b74ba6b1abc3567100"
resolved "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/ui#66957b97041df38d9682e9337770b61a658f11c2"
dependencies:
"@faststore/components" "https://pkg.csb.dev/vtex/faststore/commit/54a8dee3/@faststore/components"
"@faststore/components" "https://pkg.csb.dev/vtex/faststore/commit/12fd29ce/@faststore/components"
include-media "^1.4.10"
modern-normalize "^1.1.0"
react-swipeable "^7.0.0"
Expand Down