├── .editorconfig ├── .github └── ISSUE_TEMPLATE │ ├── 1.core_bug_report.yml │ ├── 2.provider_bug_report.yml │ ├── 3.feature_request.yml │ ├── 4.docs_request.yml │ └── config.yml ├── .gitignore ├── .prettierignore ├── .prettierrc ├── .vscode ├── extensions.json └── settings.json ├── README.md ├── license.md ├── package.json ├── packages ├── bigcommerce │ ├── .env.template │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── codegen.json │ ├── package.json │ ├── schema.d.ts │ ├── schema.graphql │ ├── scripts │ │ └── generate-definitions.js │ ├── src │ │ ├── api │ │ │ ├── definitions │ │ │ │ ├── catalog.ts │ │ │ │ ├── store-content.ts │ │ │ │ └── wishlist.ts │ │ │ ├── endpoints │ │ │ │ ├── cart │ │ │ │ │ ├── add-item.ts │ │ │ │ │ ├── get-cart.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── remove-item.ts │ │ │ │ │ └── update-item.ts │ │ │ │ ├── catalog │ │ │ │ │ └── products │ │ │ │ │ │ ├── get-products.ts │ │ │ │ │ │ └── index.ts │ │ │ │ ├── checkout │ │ │ │ │ ├── get-checkout.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── customer │ │ │ │ │ ├── address.ts │ │ │ │ │ ├── card.ts │ │ │ │ │ ├── get-logged-in-customer.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── login │ │ │ │ │ ├── index.ts │ │ │ │ │ └── login.ts │ │ │ │ ├── logout │ │ │ │ │ ├── index.ts │ │ │ │ │ └── logout.ts │ │ │ │ ├── signup │ │ │ │ │ ├── index.ts │ │ │ │ │ └── signup.ts │ │ │ │ └── wishlist │ │ │ │ │ ├── add-item.ts │ │ │ │ │ ├── get-wishlist.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── remove-item.ts │ │ │ ├── fragments │ │ │ │ ├── category-tree.ts │ │ │ │ └── product.ts │ │ │ ├── index.ts │ │ │ ├── operations │ │ │ │ ├── get-all-pages.ts │ │ │ │ ├── get-all-product-paths.ts │ │ │ │ ├── get-all-products.ts │ │ │ │ ├── get-customer-wishlist.ts │ │ │ │ ├── get-page.ts │ │ │ │ ├── get-product.ts │ │ │ │ ├── get-site-info.ts │ │ │ │ └── login.ts │ │ │ └── utils │ │ │ │ ├── concat-cookie.ts │ │ │ │ ├── errors.ts │ │ │ │ ├── fetch-graphql-api.ts │ │ │ │ ├── fetch-store-api.ts │ │ │ │ ├── fetch.ts │ │ │ │ ├── filter-edges.ts │ │ │ │ ├── get-cart-cookie.ts │ │ │ │ ├── get-customer-id.ts │ │ │ │ ├── parse-item.ts │ │ │ │ ├── set-product-locale-meta.ts │ │ │ │ └── types.ts │ │ ├── auth │ │ │ ├── index.ts │ │ │ ├── use-login.tsx │ │ │ ├── use-logout.tsx │ │ │ └── use-signup.tsx │ │ ├── cart │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-cart.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-update-item.tsx │ │ ├── checkout │ │ │ └── use-checkout.tsx │ │ ├── commerce.config.json │ │ ├── customer │ │ │ ├── address │ │ │ │ └── use-add-item.tsx │ │ │ ├── card │ │ │ │ └── use-add-item.tsx │ │ │ ├── index.ts │ │ │ └── use-customer.tsx │ │ ├── fetcher.ts │ │ ├── index.tsx │ │ ├── lib │ │ │ ├── get-slug.ts │ │ │ ├── immutability.ts │ │ │ └── normalize.ts │ │ ├── next.config.cjs │ │ ├── product │ │ │ ├── index.ts │ │ │ ├── use-price.tsx │ │ │ └── use-search.tsx │ │ ├── provider.ts │ │ ├── types.ts │ │ └── wishlist │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── commerce │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── fixup.mjs │ ├── new-provider.md │ ├── package.json │ ├── src │ │ ├── api │ │ │ ├── endpoints │ │ │ │ ├── cart.ts │ │ │ │ ├── catalog │ │ │ │ │ └── products.ts │ │ │ │ ├── checkout.ts │ │ │ │ ├── customer │ │ │ │ │ ├── address.ts │ │ │ │ │ ├── card.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── index.ts │ │ │ │ ├── login.ts │ │ │ │ ├── logout.ts │ │ │ │ ├── signup.ts │ │ │ │ └── wishlist.ts │ │ │ ├── index.ts │ │ │ ├── operations.ts │ │ │ └── utils │ │ │ │ ├── errors.ts │ │ │ │ ├── is-allowed-method.ts │ │ │ │ ├── is-allowed-operation.ts │ │ │ │ ├── types.ts │ │ │ │ └── with-operation-callback.ts │ │ ├── auth │ │ │ ├── use-login.tsx │ │ │ ├── use-logout.tsx │ │ │ └── use-signup.tsx │ │ ├── cart │ │ │ ├── use-add-item.tsx │ │ │ ├── use-cart.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-update-item.tsx │ │ ├── checkout │ │ │ ├── use-checkout.ts │ │ │ └── use-submit-checkout.tsx │ │ ├── config.cjs │ │ ├── customer │ │ │ ├── address │ │ │ │ ├── use-add-item.tsx │ │ │ │ ├── use-addresses.tsx │ │ │ │ ├── use-remove-item.tsx │ │ │ │ └── use-update-item.tsx │ │ │ ├── card │ │ │ │ ├── use-add-item.tsx │ │ │ │ ├── use-cards.tsx │ │ │ │ ├── use-remove-item.tsx │ │ │ │ └── use-update-item.tsx │ │ │ └── use-customer.tsx │ │ ├── index.tsx │ │ ├── product │ │ │ ├── use-price.tsx │ │ │ └── use-search.tsx │ │ ├── schemas │ │ │ ├── page.ts │ │ │ ├── product.ts │ │ │ └── site.ts │ │ ├── types │ │ │ ├── cart.ts │ │ │ ├── checkout.ts │ │ │ ├── common.ts │ │ │ ├── customer │ │ │ │ ├── address.ts │ │ │ │ ├── card.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── login.ts │ │ │ ├── logout.ts │ │ │ ├── page.ts │ │ │ ├── product.ts │ │ │ ├── signup.ts │ │ │ ├── site.ts │ │ │ └── wishlist.ts │ │ ├── utils │ │ │ ├── default-fetcher.ts │ │ │ ├── define-property.ts │ │ │ ├── errors.ts │ │ │ ├── types.ts │ │ │ ├── use-data.tsx │ │ │ └── use-hook.ts │ │ └── wishlist │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── commercejs │ ├── .env.template │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── global.d.ts │ ├── package.json │ ├── src │ │ ├── api │ │ │ ├── endpoints │ │ │ │ ├── cart │ │ │ │ │ └── index.ts │ │ │ │ ├── catalog │ │ │ │ │ ├── index.ts │ │ │ │ │ └── products │ │ │ │ │ │ └── index.ts │ │ │ │ ├── checkout │ │ │ │ │ ├── get-checkout.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── submit-checkout.ts │ │ │ │ ├── customer │ │ │ │ │ ├── address │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── card │ │ │ │ │ │ └── index.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── login │ │ │ │ │ ├── index.ts │ │ │ │ │ └── login.ts │ │ │ │ ├── logout │ │ │ │ │ └── index.ts │ │ │ │ ├── signup │ │ │ │ │ └── index.ts │ │ │ │ └── wishlist │ │ │ │ │ └── index.tsx │ │ │ ├── index.ts │ │ │ ├── operations │ │ │ │ ├── get-all-pages.ts │ │ │ │ ├── get-all-product-paths.ts │ │ │ │ ├── get-all-products.ts │ │ │ │ ├── get-page.ts │ │ │ │ ├── get-product.ts │ │ │ │ ├── get-site-info.ts │ │ │ │ └── index.ts │ │ │ └── utils │ │ │ │ ├── graphql-fetch.ts │ │ │ │ └── sdk-fetch.ts │ │ ├── auth │ │ │ ├── index.ts │ │ │ ├── use-login.tsx │ │ │ ├── use-logout.tsx │ │ │ └── use-signup.tsx │ │ ├── cart │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-cart.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-update-item.tsx │ │ ├── checkout │ │ │ ├── index.ts │ │ │ ├── use-checkout.tsx │ │ │ └── use-submit-checkout.tsx │ │ ├── commerce.config.json │ │ ├── constants.ts │ │ ├── customer │ │ │ ├── address │ │ │ │ ├── index.ts │ │ │ │ ├── use-add-item.tsx │ │ │ │ └── use-addresses.tsx │ │ │ ├── card │ │ │ │ ├── index.ts │ │ │ │ ├── use-add-item.tsx │ │ │ │ └── use-cards.tsx │ │ │ ├── index.ts │ │ │ └── use-customer.tsx │ │ ├── fetcher.ts │ │ ├── index.tsx │ │ ├── lib │ │ │ └── commercejs.ts │ │ ├── next.config.cjs │ │ ├── product │ │ │ ├── index.ts │ │ │ ├── use-price.tsx │ │ │ └── use-search.tsx │ │ ├── provider.ts │ │ ├── types.ts │ │ ├── utils │ │ │ ├── get-deployment-url.ts │ │ │ ├── normalize-cart.ts │ │ │ ├── normalize-category.ts │ │ │ ├── normalize-checkout.ts │ │ │ ├── normalize-product.ts │ │ │ └── product-search.ts │ │ └── wishlist │ │ │ ├── use-add-item.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── kibocommerce │ ├── .env.template │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── codegen.json │ ├── package.json │ ├── schema.d.ts │ ├── schema.graphql │ ├── src │ │ ├── api │ │ │ ├── endpoints │ │ │ │ ├── cart │ │ │ │ │ ├── add-item.ts │ │ │ │ │ ├── get-cart.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── remove-item.ts │ │ │ │ │ └── update-item.ts │ │ │ │ ├── catalog │ │ │ │ │ └── products │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ └── products.ts │ │ │ │ ├── checkout │ │ │ │ │ └── index.ts │ │ │ │ ├── customer │ │ │ │ │ ├── address.ts │ │ │ │ │ ├── card.ts │ │ │ │ │ ├── customer.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── login │ │ │ │ │ ├── index.ts │ │ │ │ │ └── login.ts │ │ │ │ ├── logout │ │ │ │ │ ├── index.ts │ │ │ │ │ └── logout.ts │ │ │ │ ├── signup │ │ │ │ │ ├── index.ts │ │ │ │ │ └── signup.ts │ │ │ │ └── wishlist │ │ │ │ │ ├── add-item.ts │ │ │ │ │ ├── get-wishlist.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── remove-item.ts │ │ │ ├── fragments │ │ │ │ ├── cartItemDetails.ts │ │ │ │ ├── category.ts │ │ │ │ ├── product.ts │ │ │ │ ├── productDetails.ts │ │ │ │ └── search.ts │ │ │ ├── index.ts │ │ │ ├── mutations │ │ │ │ ├── addItemToWishlist-mutation.ts │ │ │ │ ├── addToCart-mutation.ts │ │ │ │ ├── create-wishlist-mutation.ts │ │ │ │ ├── login-mutation.ts │ │ │ │ ├── removeItemFromCart-mutation.ts │ │ │ │ ├── removeItemFromWishlist-mutation.ts │ │ │ │ ├── signup-mutation.ts │ │ │ │ └── updateCartItemQuantity-mutation.ts │ │ │ ├── operations │ │ │ │ ├── get-all-pages.ts │ │ │ │ ├── get-all-product-paths.ts │ │ │ │ ├── get-all-products.ts │ │ │ │ ├── get-customer-wishlist.ts │ │ │ │ ├── get-page.ts │ │ │ │ ├── get-product.ts │ │ │ │ ├── get-site-info.ts │ │ │ │ └── index.ts │ │ │ ├── queries │ │ │ │ ├── get-all-pages-query.ts │ │ │ │ ├── get-all-products-query.ts │ │ │ │ ├── get-anonymous-shopper-token-query.ts │ │ │ │ ├── get-cart-query.ts │ │ │ │ ├── get-categories-tree-query.ts │ │ │ │ ├── get-customer-account-query.ts │ │ │ │ ├── get-customer-wishlist-query.ts │ │ │ │ ├── get-page-query.ts │ │ │ │ ├── get-product-query.ts │ │ │ │ └── product-search-query.ts │ │ │ └── utils │ │ │ │ ├── api-auth-helper.ts │ │ │ │ ├── cookie-handler.ts │ │ │ │ ├── fetch-graphql-api.ts │ │ │ │ ├── fetch-local.ts │ │ │ │ ├── fetch.ts │ │ │ │ ├── get-anonymous-shopper-token.ts │ │ │ │ └── get-customer-id.ts │ │ ├── auth │ │ │ ├── index.ts │ │ │ ├── use-login.tsx │ │ │ ├── use-logout.tsx │ │ │ └── use-signup.tsx │ │ ├── cart │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-cart.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-update-item.tsx │ │ ├── checkout │ │ │ └── use-checkout.tsx │ │ ├── commerce.config.json │ │ ├── customer │ │ │ ├── address │ │ │ │ └── use-add-item.tsx │ │ │ ├── card │ │ │ │ └── use-add-item.tsx │ │ │ ├── index.ts │ │ │ └── use-customer.tsx │ │ ├── fetcher.ts │ │ ├── index.tsx │ │ ├── lib │ │ │ ├── get-cookie-expiration-date.ts │ │ │ ├── get-slug.ts │ │ │ ├── normalize.ts │ │ │ ├── prepare-set-cookie.ts │ │ │ ├── product-search-vars.ts │ │ │ └── set-cookie.ts │ │ ├── next.config.cjs │ │ ├── product │ │ │ ├── index.ts │ │ │ ├── use-price.tsx │ │ │ └── use-search.tsx │ │ ├── provider.ts │ │ └── wishlist │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── local │ ├── .env.template │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── package.json │ ├── src │ │ ├── api │ │ │ ├── endpoints │ │ │ │ ├── cart │ │ │ │ │ └── index.ts │ │ │ │ ├── catalog │ │ │ │ │ ├── index.ts │ │ │ │ │ └── products.ts │ │ │ │ ├── checkout │ │ │ │ │ └── index.ts │ │ │ │ ├── customer │ │ │ │ │ ├── address.ts │ │ │ │ │ ├── card.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── login │ │ │ │ │ └── index.ts │ │ │ │ ├── logout │ │ │ │ │ └── index.ts │ │ │ │ ├── signup │ │ │ │ │ └── index.ts │ │ │ │ └── wishlist │ │ │ │ │ └── index.tsx │ │ │ ├── index.ts │ │ │ ├── operations │ │ │ │ ├── get-all-pages.ts │ │ │ │ ├── get-all-product-paths.ts │ │ │ │ ├── get-all-products.ts │ │ │ │ ├── get-customer-wishlist.ts │ │ │ │ ├── get-page.ts │ │ │ │ ├── get-product.ts │ │ │ │ ├── get-site-info.ts │ │ │ │ └── index.ts │ │ │ └── utils │ │ │ │ ├── fetch-local.ts │ │ │ │ └── fetch.ts │ │ ├── auth │ │ │ ├── index.ts │ │ │ ├── use-login.tsx │ │ │ ├── use-logout.tsx │ │ │ └── use-signup.tsx │ │ ├── cart │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-cart.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-update-item.tsx │ │ ├── checkout │ │ │ └── use-checkout.tsx │ │ ├── commerce.config.json │ │ ├── customer │ │ │ ├── address │ │ │ │ └── use-add-item.tsx │ │ │ ├── card │ │ │ │ └── use-add-item.tsx │ │ │ ├── index.ts │ │ │ └── use-customer.tsx │ │ ├── data.json │ │ ├── fetcher.ts │ │ ├── index.tsx │ │ ├── next.config.cjs │ │ ├── product │ │ │ ├── index.ts │ │ │ ├── use-price.tsx │ │ │ └── use-search.tsx │ │ ├── provider.ts │ │ └── wishlist │ │ │ ├── use-add-item.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── ordercloud │ ├── .env.template │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── package.json │ ├── src │ │ ├── api │ │ │ ├── endpoints │ │ │ │ ├── cart │ │ │ │ │ ├── add-item.ts │ │ │ │ │ ├── get-cart.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── remove-item.ts │ │ │ │ │ └── update-item.ts │ │ │ │ ├── catalog │ │ │ │ │ └── products │ │ │ │ │ │ ├── get-products.ts │ │ │ │ │ │ └── index.ts │ │ │ │ ├── checkout │ │ │ │ │ ├── get-checkout.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── submit-checkout.ts │ │ │ │ ├── customer │ │ │ │ │ ├── address │ │ │ │ │ │ ├── add-item.ts │ │ │ │ │ │ ├── get-addresses.ts │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── remove-item.ts │ │ │ │ │ │ └── update-item.ts │ │ │ │ │ ├── card │ │ │ │ │ │ ├── add-item.ts │ │ │ │ │ │ ├── get-cards.ts │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── remove-item.ts │ │ │ │ │ │ └── update-item.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── login │ │ │ │ │ └── index.ts │ │ │ │ ├── logout │ │ │ │ │ └── index.ts │ │ │ │ ├── signup │ │ │ │ │ └── index.ts │ │ │ │ └── wishlist │ │ │ │ │ └── index.tsx │ │ │ ├── index.ts │ │ │ ├── operations │ │ │ │ ├── get-all-pages.ts │ │ │ │ ├── get-all-product-paths.ts │ │ │ │ ├── get-all-products.ts │ │ │ │ ├── get-page.ts │ │ │ │ ├── get-product.ts │ │ │ │ ├── get-site-info.ts │ │ │ │ └── index.ts │ │ │ └── utils │ │ │ │ ├── cart.ts │ │ │ │ ├── fetch-graphql.ts │ │ │ │ └── fetch-rest.ts │ │ ├── auth │ │ │ ├── index.ts │ │ │ ├── use-login.tsx │ │ │ ├── use-logout.tsx │ │ │ └── use-signup.tsx │ │ ├── cart │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-cart.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-update-item.tsx │ │ ├── checkout │ │ │ ├── index.ts │ │ │ ├── use-checkout.tsx │ │ │ └── use-submit-checkout.tsx │ │ ├── commerce.config.json │ │ ├── constants.ts │ │ ├── customer │ │ │ ├── address │ │ │ │ ├── index.ts │ │ │ │ ├── use-add-item.tsx │ │ │ │ ├── use-addresses.tsx │ │ │ │ ├── use-remove-item.tsx │ │ │ │ └── use-update-item.tsx │ │ │ ├── card │ │ │ │ ├── index.ts │ │ │ │ ├── use-add-item.tsx │ │ │ │ ├── use-cards.tsx │ │ │ │ ├── use-remove-item.tsx │ │ │ │ └── use-update-item.tsx │ │ │ ├── index.ts │ │ │ └── use-customer.tsx │ │ ├── fetcher.ts │ │ ├── index.tsx │ │ ├── next.config.cjs │ │ ├── product │ │ │ ├── index.ts │ │ │ ├── use-price.tsx │ │ │ └── use-search.tsx │ │ ├── provider.ts │ │ ├── types │ │ │ ├── cart.ts │ │ │ ├── category.ts │ │ │ ├── customer │ │ │ │ ├── address.ts │ │ │ │ └── card.ts │ │ │ ├── node.d.ts │ │ │ └── product.ts │ │ ├── utils │ │ │ └── product.ts │ │ └── wishlist │ │ │ ├── use-add-item.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── saleor │ ├── .env.template │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── codegen.json │ ├── package.json │ ├── schema.d.ts │ ├── schema.graphql │ ├── src │ │ ├── api │ │ │ ├── cart.ts │ │ │ ├── catalog │ │ │ │ └── products.ts │ │ │ ├── checkout.ts │ │ │ ├── customers │ │ │ │ ├── index.ts │ │ │ │ ├── login.ts │ │ │ │ ├── logout.ts │ │ │ │ └── signup.ts │ │ │ ├── endpoints │ │ │ │ ├── cart.ts │ │ │ │ ├── catalog │ │ │ │ │ └── products.ts │ │ │ │ ├── checkout │ │ │ │ │ └── index.ts │ │ │ │ ├── customer │ │ │ │ │ ├── address.ts │ │ │ │ │ ├── card.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── login.ts │ │ │ │ ├── logout.ts │ │ │ │ ├── signup.ts │ │ │ │ └── wishlist.ts │ │ │ ├── index.ts │ │ │ ├── operations │ │ │ │ ├── get-all-pages.ts │ │ │ │ ├── get-all-product-paths.ts │ │ │ │ ├── get-all-products.ts │ │ │ │ ├── get-page.ts │ │ │ │ ├── get-product.ts │ │ │ │ ├── get-site-info.ts │ │ │ │ ├── index.ts │ │ │ │ └── login.ts │ │ │ ├── utils │ │ │ │ ├── fetch-graphql-api.ts │ │ │ │ ├── fetch.ts │ │ │ │ └── is-allowed-method.ts │ │ │ └── wishlist.ts │ │ ├── auth │ │ │ ├── use-login.tsx │ │ │ ├── use-logout.tsx │ │ │ └── use-signup.tsx │ │ ├── cart │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-cart.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-update-item.tsx │ │ ├── checkout │ │ │ └── use-checkout.tsx │ │ ├── commerce.config.json │ │ ├── const.ts │ │ ├── customer │ │ │ ├── address │ │ │ │ └── use-add-item.tsx │ │ │ ├── card │ │ │ │ └── use-add-item.tsx │ │ │ ├── index.ts │ │ │ └── use-customer.tsx │ │ ├── fetcher.ts │ │ ├── index.tsx │ │ ├── next.config.cjs │ │ ├── product │ │ │ ├── use-price.tsx │ │ │ └── use-search.tsx │ │ ├── provider.ts │ │ ├── types.ts │ │ ├── utils │ │ │ ├── checkout-attach.ts │ │ │ ├── checkout-create.ts │ │ │ ├── checkout-to-cart.ts │ │ │ ├── customer-token.ts │ │ │ ├── fragments │ │ │ │ ├── checkout-details.ts │ │ │ │ ├── index.ts │ │ │ │ └── product.ts │ │ │ ├── get-categories.ts │ │ │ ├── get-checkout-id.ts │ │ │ ├── get-search-variables.ts │ │ │ ├── get-sort-variables.ts │ │ │ ├── get-vendors.ts │ │ │ ├── handle-fetch-response.ts │ │ │ ├── handle-login.ts │ │ │ ├── index.ts │ │ │ ├── mutations │ │ │ │ ├── account-create.ts │ │ │ │ ├── checkout-attach.ts │ │ │ │ ├── checkout-create.ts │ │ │ │ ├── checkout-line-add.ts │ │ │ │ ├── checkout-line-remove.ts │ │ │ │ ├── checkout-line-update.ts │ │ │ │ ├── index.ts │ │ │ │ ├── session-create.ts │ │ │ │ └── session-destroy.ts │ │ │ ├── normalize.ts │ │ │ ├── queries │ │ │ │ ├── checkout-one.ts │ │ │ │ ├── collection-many.ts │ │ │ │ ├── collection-one.ts │ │ │ │ ├── customer-current.ts │ │ │ │ ├── customer-one.ts │ │ │ │ ├── get-all-product-vendors-query.ts │ │ │ │ ├── get-all-products-paths-query.ts │ │ │ │ ├── index.ts │ │ │ │ ├── page-many.ts │ │ │ │ ├── page-one.ts │ │ │ │ ├── product-many.ts │ │ │ │ └── product-one-by-slug.ts │ │ │ └── throw-user-errors.ts │ │ └── wishlist │ │ │ ├── use-add-item.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── sfcc │ ├── .env.template │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── package.json │ ├── src │ │ ├── api │ │ │ ├── endpoints │ │ │ │ ├── cart │ │ │ │ │ └── index.ts │ │ │ │ ├── catalog │ │ │ │ │ └── products │ │ │ │ │ │ ├── get-products.ts │ │ │ │ │ │ └── index.ts │ │ │ │ ├── checkout │ │ │ │ │ └── index.ts │ │ │ │ ├── customer │ │ │ │ │ ├── address.ts │ │ │ │ │ ├── card.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── login │ │ │ │ │ └── index.ts │ │ │ │ ├── logout │ │ │ │ │ └── index.ts │ │ │ │ ├── signup │ │ │ │ │ └── index.ts │ │ │ │ └── wishlist │ │ │ │ │ └── index.tsx │ │ │ ├── index.ts │ │ │ ├── operations │ │ │ │ ├── get-all-pages.ts │ │ │ │ ├── get-all-product-paths.ts │ │ │ │ ├── get-all-products.ts │ │ │ │ ├── get-customer-wishlist.ts │ │ │ │ ├── get-page.ts │ │ │ │ ├── get-product.ts │ │ │ │ ├── get-site-info.ts │ │ │ │ └── index.ts │ │ │ └── utils │ │ │ │ ├── fetch-local.ts │ │ │ │ ├── fetch.ts │ │ │ │ ├── get-auth-token.ts │ │ │ │ ├── normalise-product.ts │ │ │ │ └── sfcc-sdk.ts │ │ ├── auth │ │ │ ├── index.ts │ │ │ ├── use-login.tsx │ │ │ ├── use-logout.tsx │ │ │ └── use-signup.tsx │ │ ├── cart │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-cart.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-update-item.tsx │ │ ├── checkout │ │ │ └── use-checkout.tsx │ │ ├── commerce.config.json │ │ ├── customer │ │ │ ├── address │ │ │ │ └── use-add-item.tsx │ │ │ ├── card │ │ │ │ └── use-add-item.tsx │ │ │ ├── index.ts │ │ │ └── use-customer.tsx │ │ ├── fetcher.ts │ │ ├── index.tsx │ │ ├── next.config.cjs │ │ ├── product │ │ │ ├── index.ts │ │ │ ├── use-price.tsx │ │ │ └── use-search.tsx │ │ ├── provider.ts │ │ └── wishlist │ │ │ ├── use-add-item.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── shopify │ ├── .env.template │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── codegen.json │ ├── package.json │ ├── schema.d.ts │ ├── schema.graphql │ ├── src │ │ ├── api │ │ │ ├── endpoints │ │ │ │ ├── cart.ts │ │ │ │ ├── catalog │ │ │ │ │ └── products │ │ │ │ │ │ ├── get-products.ts │ │ │ │ │ │ └── index.ts │ │ │ │ ├── checkout │ │ │ │ │ ├── get-checkout.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── customer │ │ │ │ │ ├── address.ts │ │ │ │ │ ├── card.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── login.ts │ │ │ │ ├── logout.ts │ │ │ │ ├── signup.ts │ │ │ │ └── wishlist.ts │ │ │ ├── index.ts │ │ │ ├── operations │ │ │ │ ├── get-all-pages.ts │ │ │ │ ├── get-all-product-paths.ts │ │ │ │ ├── get-all-products.ts │ │ │ │ ├── get-page.ts │ │ │ │ ├── get-product.ts │ │ │ │ ├── get-site-info.ts │ │ │ │ └── login.ts │ │ │ └── utils │ │ │ │ ├── fetch-graphql-api.ts │ │ │ │ └── fetch.ts │ │ ├── auth │ │ │ ├── use-login.tsx │ │ │ ├── use-logout.tsx │ │ │ └── use-signup.tsx │ │ ├── cart │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-cart.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-update-item.tsx │ │ ├── checkout │ │ │ └── use-checkout.tsx │ │ ├── commerce.config.json │ │ ├── const.ts │ │ ├── customer │ │ │ ├── address │ │ │ │ └── use-add-item.tsx │ │ │ ├── card │ │ │ │ └── use-add-item.tsx │ │ │ ├── index.ts │ │ │ └── use-customer.tsx │ │ ├── fetcher.ts │ │ ├── index.tsx │ │ ├── next.config.cjs │ │ ├── product │ │ │ ├── use-price.tsx │ │ │ └── use-search.tsx │ │ ├── provider.ts │ │ ├── utils │ │ │ ├── checkout-create.ts │ │ │ ├── checkout-to-cart.ts │ │ │ ├── colors.ts │ │ │ ├── customer-token.ts │ │ │ ├── get-brands.ts │ │ │ ├── get-categories.ts │ │ │ ├── get-checkout-id.ts │ │ │ ├── get-search-variables.ts │ │ │ ├── get-sort-variables.ts │ │ │ ├── handle-account-activation.ts │ │ │ ├── handle-fetch-response.ts │ │ │ ├── handle-login.ts │ │ │ ├── index.ts │ │ │ ├── mutations │ │ │ │ ├── associate-customer-with-checkout.ts │ │ │ │ ├── checkout-create.ts │ │ │ │ ├── checkout-line-item-add.ts │ │ │ │ ├── checkout-line-item-remove.ts │ │ │ │ ├── checkout-line-item-update.ts │ │ │ │ ├── customer-access-token-create.ts │ │ │ │ ├── customer-access-token-delete.ts │ │ │ │ ├── customer-activate-by-url.ts │ │ │ │ ├── customer-activate.ts │ │ │ │ ├── customer-create.ts │ │ │ │ └── index.ts │ │ │ ├── normalize.ts │ │ │ ├── queries │ │ │ │ ├── get-all-collections-query.ts │ │ │ │ ├── get-all-pages-query.ts │ │ │ │ ├── get-all-product-vendors-query.ts │ │ │ │ ├── get-all-products-paths-query.ts │ │ │ │ ├── get-all-products-query.ts │ │ │ │ ├── get-checkout-query.ts │ │ │ │ ├── get-collection-products-query.ts │ │ │ │ ├── get-customer-id-query.ts │ │ │ │ ├── get-customer-query.ts │ │ │ │ ├── get-page-query.ts │ │ │ │ ├── get-product-query.ts │ │ │ │ ├── get-site-info-query.ts │ │ │ │ └── index.ts │ │ │ └── throw-user-errors.ts │ │ └── wishlist │ │ │ ├── use-add-item.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── spree │ ├── .env.template │ ├── .prettierignore │ ├── .prettierrc │ ├── README-assets │ │ └── screenshots.png │ ├── README.md │ ├── package.json │ ├── src │ │ ├── api │ │ │ ├── endpoints │ │ │ │ ├── cart │ │ │ │ │ └── index.ts │ │ │ │ ├── catalog │ │ │ │ │ ├── index.ts │ │ │ │ │ └── products.ts │ │ │ │ ├── checkout │ │ │ │ │ ├── get-checkout.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── customer │ │ │ │ │ ├── address.ts │ │ │ │ │ ├── card.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── login │ │ │ │ │ └── index.ts │ │ │ │ ├── logout │ │ │ │ │ └── index.ts │ │ │ │ ├── signup │ │ │ │ │ └── index.ts │ │ │ │ └── wishlist │ │ │ │ │ └── index.tsx │ │ │ ├── index.ts │ │ │ ├── operations │ │ │ │ ├── get-all-pages.ts │ │ │ │ ├── get-all-product-paths.ts │ │ │ │ ├── get-all-products.ts │ │ │ │ ├── get-customer-wishlist.ts │ │ │ │ ├── get-page.ts │ │ │ │ ├── get-product.ts │ │ │ │ ├── get-site-info.ts │ │ │ │ └── index.ts │ │ │ └── utils │ │ │ │ ├── create-api-fetch.ts │ │ │ │ └── fetch.ts │ │ ├── auth │ │ │ ├── index.ts │ │ │ ├── use-login.tsx │ │ │ ├── use-logout.tsx │ │ │ └── use-signup.tsx │ │ ├── cart │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-cart.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-update-item.tsx │ │ ├── checkout │ │ │ └── use-checkout.tsx │ │ ├── commerce.config.json │ │ ├── customer │ │ │ ├── address │ │ │ │ └── use-add-item.tsx │ │ │ ├── card │ │ │ │ └── use-add-item.tsx │ │ │ ├── index.ts │ │ │ └── use-customer.tsx │ │ ├── errors │ │ │ ├── AccessTokenError.ts │ │ │ ├── MisconfigurationError.ts │ │ │ ├── MissingConfigurationValueError.ts │ │ │ ├── MissingLineItemVariantError.ts │ │ │ ├── MissingOptionValueError.ts │ │ │ ├── MissingPrimaryVariantError.ts │ │ │ ├── MissingProductError.ts │ │ │ ├── MissingSlugVariableError.ts │ │ │ ├── MissingVariantError.ts │ │ │ ├── RefreshTokenError.ts │ │ │ ├── SpreeResponseContentError.ts │ │ │ ├── SpreeSdkMethodFromEndpointPathError.ts │ │ │ ├── TokensNotRejectedError.ts │ │ │ └── UserTokenResponseParseError.ts │ │ ├── fetcher.ts │ │ ├── index.tsx │ │ ├── isomorphic-config.ts │ │ ├── next.config.cjs │ │ ├── product │ │ │ ├── index.ts │ │ │ ├── use-price.tsx │ │ │ └── use-search.tsx │ │ ├── provider.ts │ │ ├── types │ │ │ └── index.ts │ │ ├── utils │ │ │ ├── convert-spree-error-to-graph-ql-error.ts │ │ │ ├── create-customized-fetch-fetcher.ts │ │ │ ├── create-empty-cart.ts │ │ │ ├── create-get-absolute-image-url.ts │ │ │ ├── expand-options.ts │ │ │ ├── force-isomorphic-config-values.ts │ │ │ ├── get-image-url.ts │ │ │ ├── get-media-gallery.ts │ │ │ ├── get-product-path.ts │ │ │ ├── get-spree-sdk-method-from-endpoint-path.ts │ │ │ ├── handle-token-errors.ts │ │ │ ├── is-json-content-type.ts │ │ │ ├── is-server.ts │ │ │ ├── login.ts │ │ │ ├── normalizations │ │ │ │ ├── normalize-cart.ts │ │ │ │ ├── normalize-page.ts │ │ │ │ ├── normalize-product.ts │ │ │ │ ├── normalize-user.ts │ │ │ │ └── normalize-wishlist.ts │ │ │ ├── pretty-print-spree-sdk-errors.ts │ │ │ ├── require-config.ts │ │ │ ├── sort-option-types.ts │ │ │ ├── tokens │ │ │ │ ├── cart-token.ts │ │ │ │ ├── ensure-fresh-user-access-token.ts │ │ │ │ ├── ensure-itoken.ts │ │ │ │ ├── is-logged-in.ts │ │ │ │ ├── revoke-user-tokens.ts │ │ │ │ └── user-token-response.ts │ │ │ └── validations │ │ │ │ ├── validate-all-products-taxonomy-id.ts │ │ │ │ ├── validate-cookie-expire.ts │ │ │ │ ├── validate-images-option-filter.ts │ │ │ │ ├── validate-images-quality.ts │ │ │ │ ├── validate-images-size.ts │ │ │ │ ├── validate-placeholder-image-url.ts │ │ │ │ └── validate-products-prerender-count.ts │ │ └── wishlist │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── swell │ ├── .env.template │ ├── .prettierignore │ ├── .prettierrc │ ├── package.json │ ├── schema.d.ts │ ├── schema.graphql │ ├── src │ │ ├── api │ │ │ ├── cart │ │ │ │ └── index.ts │ │ │ ├── catalog │ │ │ │ ├── index.ts │ │ │ │ └── products.ts │ │ │ ├── customer.ts │ │ │ ├── customers │ │ │ │ ├── index.ts │ │ │ │ ├── logout.ts │ │ │ │ └── signup.ts │ │ │ ├── endpoints │ │ │ │ ├── cart.ts │ │ │ │ ├── catalog │ │ │ │ │ └── products.ts │ │ │ │ ├── checkout │ │ │ │ │ └── index.ts │ │ │ │ ├── customer │ │ │ │ │ ├── address.ts │ │ │ │ │ ├── card.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── login.ts │ │ │ │ ├── logout.ts │ │ │ │ ├── signup.ts │ │ │ │ └── wishlist.ts │ │ │ ├── index.ts │ │ │ ├── operations │ │ │ │ ├── get-all-pages.ts │ │ │ │ ├── get-all-product-paths.ts │ │ │ │ ├── get-all-products.ts │ │ │ │ ├── get-page.ts │ │ │ │ ├── get-product.ts │ │ │ │ ├── get-site-info.ts │ │ │ │ └── login.ts │ │ │ ├── utils │ │ │ │ ├── fetch-swell-api.ts │ │ │ │ ├── fetch.ts │ │ │ │ └── is-allowed-method.ts │ │ │ └── wishlist │ │ │ │ └── index.tsx │ │ ├── auth │ │ │ ├── use-login.tsx │ │ │ ├── use-logout.tsx │ │ │ └── use-signup.tsx │ │ ├── cart │ │ │ ├── index.ts │ │ │ ├── use-add-item.tsx │ │ │ ├── use-cart.tsx │ │ │ ├── use-remove-item.tsx │ │ │ ├── use-update-item.tsx │ │ │ └── utils │ │ │ │ ├── checkout-create.ts │ │ │ │ ├── checkout-to-cart.ts │ │ │ │ └── index.ts │ │ ├── checkout │ │ │ └── use-checkout.tsx │ │ ├── commerce.config.json │ │ ├── const.ts │ │ ├── customer │ │ │ ├── address │ │ │ │ └── use-add-item.tsx │ │ │ ├── card │ │ │ │ └── use-add-item.tsx │ │ │ ├── index.ts │ │ │ └── use-customer.tsx │ │ ├── fetcher.ts │ │ ├── index.tsx │ │ ├── next.config.cjs │ │ ├── product │ │ │ ├── index.ts │ │ │ ├── use-price.tsx │ │ │ └── use-search.tsx │ │ ├── provider.ts │ │ ├── swell.ts │ │ ├── types.ts │ │ ├── types │ │ │ ├── cart.ts │ │ │ ├── checkout.ts │ │ │ ├── common.ts │ │ │ ├── customer.ts │ │ │ ├── index.ts │ │ │ ├── login.ts │ │ │ ├── logout.ts │ │ │ ├── page.ts │ │ │ ├── product.ts │ │ │ ├── signup.ts │ │ │ ├── site.ts │ │ │ └── wishlist.ts │ │ ├── utils │ │ │ ├── customer-token.ts │ │ │ ├── get-categories.ts │ │ │ ├── get-checkout-id.ts │ │ │ ├── get-search-variables.ts │ │ │ ├── get-sort-variables.ts │ │ │ ├── get-vendors.ts │ │ │ ├── handle-fetch-response.ts │ │ │ ├── handle-login.ts │ │ │ ├── index.ts │ │ │ ├── normalize.ts │ │ │ └── storage.ts │ │ └── wishlist │ │ │ ├── use-add-item.tsx │ │ │ ├── use-remove-item.tsx │ │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── taskr-swc │ ├── .prettierrc │ ├── package.json │ └── taskfile-swc.js └── vendure │ ├── .env.template │ ├── .prettierignore │ ├── .prettierrc │ ├── README.md │ ├── codegen.json │ ├── package.json │ ├── schema.d.ts │ ├── schema.graphql │ ├── src │ ├── api │ │ ├── endpoints │ │ │ ├── cart │ │ │ │ └── index.ts │ │ │ ├── catalog │ │ │ │ ├── index.ts │ │ │ │ └── products.ts │ │ │ ├── checkout │ │ │ │ └── index.ts │ │ │ ├── customer │ │ │ │ ├── address.ts │ │ │ │ ├── card.ts │ │ │ │ └── index.ts │ │ │ ├── login │ │ │ │ └── index.ts │ │ │ ├── logout │ │ │ │ └── index.ts │ │ │ ├── signup │ │ │ │ └── index.ts │ │ │ └── wishlist │ │ │ │ └── index.tsx │ │ ├── index.ts │ │ ├── operations │ │ │ ├── get-all-pages.ts │ │ │ ├── get-all-product-paths.ts │ │ │ ├── get-all-products.ts │ │ │ ├── get-customer-wishlist.ts │ │ │ ├── get-page.ts │ │ │ ├── get-product.ts │ │ │ ├── get-site-info.ts │ │ │ └── login.ts │ │ └── utils │ │ │ ├── fetch-graphql-api.ts │ │ │ └── fetch.ts │ ├── auth │ │ ├── index.ts │ │ ├── use-login.tsx │ │ ├── use-logout.tsx │ │ └── use-signup.tsx │ ├── cart │ │ ├── index.ts │ │ ├── use-add-item.tsx │ │ ├── use-cart.tsx │ │ ├── use-remove-item.tsx │ │ └── use-update-item.tsx │ ├── checkout │ │ └── use-checkout.tsx │ ├── commerce.config.json │ ├── customer │ │ ├── address │ │ │ └── use-add-item.tsx │ │ ├── card │ │ │ └── use-add-item.tsx │ │ ├── index.ts │ │ └── use-customer.tsx │ ├── fetcher.ts │ ├── index.tsx │ ├── next.config.cjs │ ├── product │ │ ├── index.ts │ │ ├── use-price.tsx │ │ └── use-search.tsx │ ├── provider.ts │ ├── utils │ │ ├── array-to-tree.ts │ │ ├── fragments │ │ │ ├── cart-fragment.ts │ │ │ └── search-result-fragment.ts │ │ ├── mutations │ │ │ ├── add-item-to-order-mutation.ts │ │ │ ├── adjust-order-line-mutation.ts │ │ │ ├── log-in-mutation.ts │ │ │ ├── log-out-mutation.ts │ │ │ ├── remove-order-line-mutation.ts │ │ │ └── sign-up-mutation.ts │ │ ├── normalize.ts │ │ └── queries │ │ │ ├── active-customer-query.ts │ │ │ ├── get-all-product-paths-query.ts │ │ │ ├── get-all-products-query.ts │ │ │ ├── get-cart-query.ts │ │ │ ├── get-collections-query.ts │ │ │ ├── get-product-query.ts │ │ │ └── search-query.ts │ └── wishlist │ │ ├── use-add-item.tsx │ │ ├── use-remove-item.tsx │ │ └── use-wishlist.tsx │ ├── taskfile.js │ └── tsconfig.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── site ├── .env.template ├── .eslintrc ├── .gitignore ├── .npmrc ├── .prettierignore ├── .prettierrc ├── assets │ ├── base.css │ ├── chrome-bug.css │ ├── components.css │ └── main.css ├── commerce-config.js ├── commerce.config.json ├── components │ ├── auth │ │ ├── ForgotPassword.tsx │ │ ├── LoginView.tsx │ │ ├── SignUpView.tsx │ │ └── index.ts │ ├── cart │ │ ├── CartItem │ │ │ ├── CartItem.module.css │ │ │ ├── CartItem.tsx │ │ │ └── index.ts │ │ ├── CartSidebarView │ │ │ ├── CartSidebarView.module.css │ │ │ ├── CartSidebarView.tsx │ │ │ └── index.ts │ │ └── index.ts │ ├── checkout │ │ ├── CheckoutSidebarView │ │ │ ├── CheckoutSidebarView.module.css │ │ │ ├── CheckoutSidebarView.tsx │ │ │ └── index.ts │ │ ├── PaymentMethodView │ │ │ ├── PaymentMethodView.module.css │ │ │ ├── PaymentMethodView.tsx │ │ │ └── index.ts │ │ ├── PaymentWidget │ │ │ ├── PaymentWidget.module.css │ │ │ ├── PaymentWidget.tsx │ │ │ └── index.ts │ │ ├── ShippingView │ │ │ ├── ShippingView.module.css │ │ │ ├── ShippingView.tsx │ │ │ └── index.ts │ │ ├── ShippingWidget │ │ │ ├── ShippingWidget.module.css │ │ │ ├── ShippingWidget.tsx │ │ │ └── index.ts │ │ └── context.tsx │ ├── common │ │ ├── Avatar │ │ │ ├── Avatar.tsx │ │ │ └── index.ts │ │ ├── FeatureBar │ │ │ ├── FeatureBar.module.css │ │ │ ├── FeatureBar.tsx │ │ │ └── index.ts │ │ ├── Footer │ │ │ ├── Footer.module.css │ │ │ ├── Footer.tsx │ │ │ └── index.ts │ │ ├── Head │ │ │ ├── Head.tsx │ │ │ └── index.ts │ │ ├── HomeAllProductsGrid │ │ │ ├── HomeAllProductsGrid.module.css │ │ │ ├── HomeAllProductsGrid.tsx │ │ │ └── index.ts │ │ ├── I18nWidget │ │ │ ├── I18nWidget.module.css │ │ │ ├── I18nWidget.tsx │ │ │ └── index.ts │ │ ├── Layout │ │ │ ├── Layout.module.css │ │ │ ├── Layout.tsx │ │ │ └── index.ts │ │ ├── Navbar │ │ │ ├── Navbar.module.css │ │ │ ├── Navbar.tsx │ │ │ ├── NavbarRoot.tsx │ │ │ └── index.ts │ │ ├── SEO │ │ │ ├── SEO.tsx │ │ │ └── index.ts │ │ ├── Searchbar │ │ │ ├── Searchbar.module.css │ │ │ ├── Searchbar.tsx │ │ │ └── index.ts │ │ ├── SidebarLayout │ │ │ ├── SidebarLayout.module.css │ │ │ ├── SidebarLayout.tsx │ │ │ └── index.ts │ │ ├── UserNav │ │ │ ├── CustomerMenuContent │ │ │ │ ├── CustomerMenuContent.module.css │ │ │ │ ├── CustomerMenuContent.tsx │ │ │ │ └── index.ts │ │ │ ├── MenuSidebarView │ │ │ │ ├── MenuSidebarView.module.css │ │ │ │ ├── MenuSidebarView.tsx │ │ │ │ └── index.ts │ │ │ ├── UserNav.module.css │ │ │ ├── UserNav.tsx │ │ │ └── index.ts │ │ └── index.ts │ ├── icons │ │ ├── ArrowLeft.tsx │ │ ├── ArrowRight.tsx │ │ ├── Bag.tsx │ │ ├── Check.tsx │ │ ├── ChevronDown.tsx │ │ ├── ChevronLeft.tsx │ │ ├── ChevronRight.tsx │ │ ├── ChevronUp.tsx │ │ ├── CreditCard.tsx │ │ ├── Cross.tsx │ │ ├── DoubleChevron.tsx │ │ ├── Github.tsx │ │ ├── Heart.tsx │ │ ├── Info.tsx │ │ ├── MapPin.tsx │ │ ├── Menu.tsx │ │ ├── Minus.tsx │ │ ├── Moon.tsx │ │ ├── Plus.tsx │ │ ├── Star.tsx │ │ ├── Sun.tsx │ │ ├── Trash.tsx │ │ ├── Vercel.tsx │ │ └── index.ts │ ├── product │ │ ├── ProductCard │ │ │ ├── ProductCard.module.css │ │ │ ├── ProductCard.tsx │ │ │ └── index.ts │ │ ├── ProductOptions │ │ │ ├── ProductOptions.tsx │ │ │ └── index.ts │ │ ├── ProductSidebar │ │ │ ├── ProductSidebar.module.css │ │ │ ├── ProductSidebar.tsx │ │ │ └── index.ts │ │ ├── ProductSlider │ │ │ ├── ProductSlider.module.css │ │ │ ├── ProductSlider.tsx │ │ │ └── index.ts │ │ ├── ProductSliderControl │ │ │ ├── ProductSliderControl.module.css │ │ │ ├── ProductSliderControl.tsx │ │ │ └── index.ts │ │ ├── ProductTag │ │ │ ├── ProductTag.module.css │ │ │ ├── ProductTag.tsx │ │ │ └── index.ts │ │ ├── ProductView │ │ │ ├── ProductView.module.css │ │ │ ├── ProductView.tsx │ │ │ └── index.ts │ │ ├── Swatch │ │ │ ├── Swatch.module.css │ │ │ ├── Swatch.tsx │ │ │ └── index.ts │ │ ├── helpers.ts │ │ └── index.ts │ ├── search.tsx │ ├── ui │ │ ├── Button │ │ │ ├── Button.module.css │ │ │ ├── Button.tsx │ │ │ └── index.ts │ │ ├── Collapse │ │ │ ├── Collapse.module.css │ │ │ ├── Collapse.tsx │ │ │ └── index.ts │ │ ├── Container │ │ │ ├── Container.tsx │ │ │ └── index.ts │ │ ├── Dropdown │ │ │ ├── Dropdown.module.css │ │ │ └── Dropdown.tsx │ │ ├── Grid │ │ │ ├── Grid.module.css │ │ │ ├── Grid.tsx │ │ │ └── index.ts │ │ ├── Hero │ │ │ ├── Hero.module.css │ │ │ ├── Hero.tsx │ │ │ └── index.ts │ │ ├── Input │ │ │ ├── Input.module.css │ │ │ ├── Input.tsx │ │ │ └── index.ts │ │ ├── Link │ │ │ ├── Link.tsx │ │ │ └── index.ts │ │ ├── LoadingDots │ │ │ ├── LoadingDots.module.css │ │ │ ├── LoadingDots.tsx │ │ │ └── index.ts │ │ ├── Logo │ │ │ ├── Logo.tsx │ │ │ └── index.ts │ │ ├── Marquee │ │ │ ├── Marquee.module.css │ │ │ ├── Marquee.tsx │ │ │ └── index.ts │ │ ├── Modal │ │ │ ├── Modal.module.css │ │ │ ├── Modal.tsx │ │ │ └── index.ts │ │ ├── Quantity │ │ │ ├── Quantity.module.css │ │ │ ├── Quantity.tsx │ │ │ └── index.ts │ │ ├── README.md │ │ ├── Rating │ │ │ ├── Rating.module.css │ │ │ ├── Rating.tsx │ │ │ └── index.ts │ │ ├── Sidebar │ │ │ ├── Sidebar.module.css │ │ │ ├── Sidebar.tsx │ │ │ └── index.ts │ │ ├── Skeleton │ │ │ ├── Skeleton.module.css │ │ │ ├── Skeleton.tsx │ │ │ └── index.ts │ │ ├── Text │ │ │ ├── Text.module.css │ │ │ ├── Text.tsx │ │ │ └── index.ts │ │ ├── context.tsx │ │ └── index.ts │ └── wishlist │ │ ├── WishlistButton │ │ ├── WishlistButton.module.css │ │ ├── WishlistButton.tsx │ │ └── index.ts │ │ ├── WishlistCard │ │ ├── WishlistCard.module.css │ │ ├── WishlistCard.tsx │ │ └── index.ts │ │ └── index.ts ├── config │ └── seo_meta.json ├── global.d.ts ├── lib │ ├── api │ │ └── commerce.ts │ ├── click-outside │ │ ├── click-outside.tsx │ │ ├── has-parent.js │ │ ├── index.ts │ │ └── is-in-dom.js │ ├── colors.ts │ ├── focus-trap.tsx │ ├── get-slug.ts │ ├── hooks │ │ ├── useAcceptCookies.ts │ │ └── useUserAvatar.ts │ ├── range-map.ts │ ├── search-props.tsx │ ├── search.tsx │ ├── to-pixels.ts │ └── usage-warns.ts ├── next-env.d.ts ├── next.config.js ├── package.json ├── pages │ ├── 404.tsx │ ├── [...pages].tsx │ ├── _app.tsx │ ├── _document.tsx │ ├── api │ │ ├── cart.ts │ │ ├── catalog │ │ │ └── products.ts │ │ ├── checkout.ts │ │ ├── customer │ │ │ ├── address.ts │ │ │ ├── card.ts │ │ │ └── index.ts │ │ ├── login.ts │ │ ├── logout.ts │ │ ├── signup.ts │ │ └── wishlist.ts │ ├── cart.tsx │ ├── index.tsx │ ├── orders.tsx │ ├── product │ │ └── [slug].tsx │ ├── profile.tsx │ ├── search.tsx │ ├── search │ │ ├── [category].tsx │ │ └── designers │ │ │ ├── [name].tsx │ │ │ └── [name] │ │ │ └── [category].tsx │ └── wishlist.tsx ├── postcss.config.js ├── public │ ├── assets │ │ ├── drop-shirt-0.png │ │ ├── drop-shirt-1.png │ │ ├── drop-shirt-2.png │ │ ├── drop-shirt.png │ │ ├── lightweight-jacket-0.png │ │ ├── lightweight-jacket-1.png │ │ ├── lightweight-jacket-2.png │ │ ├── t-shirt-0.png │ │ ├── t-shirt-1.png │ │ ├── t-shirt-2.png │ │ ├── t-shirt-3.png │ │ └── t-shirt-4.png │ ├── bg-products.svg │ ├── card.png │ ├── cursor-left.png │ ├── cursor-right.png │ ├── favicon.ico │ ├── flag-en-us.svg │ ├── flag-es-ar.svg │ ├── flag-es-co.svg │ ├── flag-es.svg │ ├── icon-144x144.png │ ├── icon-192x192.png │ ├── icon-512x512.png │ ├── icon.png │ ├── product-img-placeholder.svg │ ├── site.webmanifest │ ├── slider-arrows.png │ └── vercel.svg ├── tailwind.config.js └── tsconfig.json └── turbo.json /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Ask a question 4 | url: https://github.com/vercel/commerce/discussions 5 | about: Ask questions and discuss with other community members 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules 3 | .pnp 4 | .pnp.js 5 | .pnpm-debug.log 6 | 7 | # testing 8 | coverage 9 | 10 | # next.js 11 | .next 12 | out 13 | 14 | # production 15 | build 16 | dist 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | .idea 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env 30 | .env.local 31 | .env.development.local 32 | .env.test.local 33 | .env.production.local 34 | 35 | # vercel 36 | .vercel 37 | 38 | # Turborepo 39 | .turbo 40 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Every package defines its prettier config 2 | node_modules 3 | dist 4 | .next 5 | public 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "esbenp.prettier-vscode", 4 | "csstools.postcss", 5 | "bradlc.vscode-tailwindcss", 6 | "ms-vscode.vscode-typescript-next" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.defaultFormatter": "esbenp.prettier-vscode", 3 | "editor.formatOnSave": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/bigcommerce/.env.template: -------------------------------------------------------------------------------- 1 | COMMERCE_PROVIDER=@vercel/commerce-bigcommerce 2 | 3 | BIGCOMMERCE_STOREFRONT_API_URL= 4 | BIGCOMMERCE_STOREFRONT_API_TOKEN= 5 | BIGCOMMERCE_STORE_API_URL= 6 | BIGCOMMERCE_STORE_API_TOKEN= 7 | BIGCOMMERCE_STORE_API_CLIENT_ID= 8 | BIGCOMMERCE_CHANNEL_ID= 9 | -------------------------------------------------------------------------------- /packages/bigcommerce/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/bigcommerce/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/api/endpoints/customer/address.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/api/endpoints/customer/card.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/api/fragments/category-tree.ts: -------------------------------------------------------------------------------- 1 | export const categoryTreeItemFragment = /* GraphQL */ ` 2 | fragment categoryTreeItem on CategoryTreeItem { 3 | entityId 4 | name 5 | path 6 | description 7 | productCount 8 | } 9 | ` 10 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/api/utils/concat-cookie.ts: -------------------------------------------------------------------------------- 1 | type Header = string | number | string[] | undefined 2 | 3 | export default function concatHeader(prev: Header, val: Header) { 4 | if (!val) return prev 5 | if (!prev) return val 6 | 7 | if (Array.isArray(prev)) return prev.concat(String(val)) 8 | 9 | prev = String(prev) 10 | 11 | if (Array.isArray(val)) return [prev].concat(val) 12 | 13 | return [prev, String(val)] 14 | } 15 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/api/utils/fetch.ts: -------------------------------------------------------------------------------- 1 | import vercelFetch from '@vercel/fetch' 2 | 3 | export default vercelFetch() 4 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/api/utils/filter-edges.ts: -------------------------------------------------------------------------------- 1 | export default function filterEdges( 2 | edges: (T | null | undefined)[] | null | undefined 3 | ) { 4 | return edges?.filter((edge): edge is T => !!edge) ?? [] 5 | } 6 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/api/utils/types.ts: -------------------------------------------------------------------------------- 1 | export type RecursivePartial = { 2 | [P in keyof T]?: RecursivePartial 3 | } 4 | 5 | export type RecursiveRequired = { 6 | [P in keyof T]-?: RecursiveRequired 7 | } 8 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useLogin } from './use-login' 2 | export { default as useLogout } from './use-logout' 3 | export { default as useSignup } from './use-signup' 4 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCart } from './use-cart' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | export { default as useUpdateItem } from './use-update-item' 5 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/checkout/use-checkout.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useCheckout, { UseCheckout } from '@vercel/commerce/checkout/use-checkout' 3 | 4 | export default useCheckout as UseCheckout 5 | 6 | export const handler: SWRHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher({ input, options, fetch }) {}, 11 | useHook: 12 | ({ useData }) => 13 | async (input) => ({}), 14 | } 15 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider": "bigcommerce", 3 | "features": { 4 | "wishlist": true, 5 | "customerAuth": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/customer/address/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { UseAddItem } from '@vercel/commerce/customer/address/use-add-item' 2 | import { MutationHook } from '@vercel/commerce/utils/types' 3 | 4 | export default useAddItem as UseAddItem 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher({ input, options, fetch }) {}, 11 | useHook: 12 | ({ fetch }) => 13 | () => 14 | async () => ({}), 15 | } 16 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/customer/card/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { UseAddItem } from '@vercel/commerce/customer/card/use-add-item' 2 | import { MutationHook } from '@vercel/commerce/utils/types' 3 | 4 | export default useAddItem as UseAddItem 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher({ input, options, fetch }) {}, 11 | useHook: 12 | ({ fetch }) => 13 | () => 14 | async () => ({}), 15 | } 16 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/customer/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCustomer } from './use-customer' 2 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { getCommerceProvider, useCommerce as useCoreCommerce } from '@vercel/commerce' 2 | import { bigcommerceProvider, BigcommerceProvider } from './provider' 3 | 4 | export { bigcommerceProvider } 5 | export type { BigcommerceProvider } 6 | 7 | export const CommerceProvider = getCommerceProvider(bigcommerceProvider) 8 | 9 | export const useCommerce = () => useCoreCommerce() 10 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/lib/get-slug.ts: -------------------------------------------------------------------------------- 1 | // Remove trailing and leading slash, usually included in nodes 2 | // returned by the BigCommerce API 3 | const getSlug = (path: string) => path.replace(/^\/|\/$/g, '') 4 | 5 | export default getSlug 6 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/lib/immutability.ts: -------------------------------------------------------------------------------- 1 | import update, { Context } from 'immutability-helper' 2 | 3 | const c = new Context() 4 | 5 | c.extend('$auto', function (value, object) { 6 | return object ? c.update(object, value) : c.update({}, value) 7 | }) 8 | 9 | c.extend('$autoArray', function (value, object) { 10 | return object ? c.update(object, value) : c.update([], value) 11 | }) 12 | 13 | export default c.update 14 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/next.config.cjs: -------------------------------------------------------------------------------- 1 | const commerce = require('./commerce.config.json') 2 | 3 | module.exports = { 4 | commerce, 5 | images: { 6 | domains: ['cdn11.bigcommerce.com'], 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/product/index.ts: -------------------------------------------------------------------------------- 1 | export { default as usePrice } from './use-price' 2 | export { default as useSearch } from './use-search' 3 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/product/use-price.tsx: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/product/use-price' 2 | export { default } from '@vercel/commerce/product/use-price' 3 | -------------------------------------------------------------------------------- /packages/bigcommerce/src/wishlist/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useAddItem } from './use-add-item' 2 | export { default as useWishlist } from './use-wishlist' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | -------------------------------------------------------------------------------- /packages/commerce/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/commerce/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/commerce/fixup.mjs: -------------------------------------------------------------------------------- 1 | import { readFile, writeFile } from 'fs/promises' 2 | 3 | const packageJson = await readFile('package.json', 'utf8') 4 | 5 | writeFile('dist/package.json', packageJson, 'utf8') 6 | -------------------------------------------------------------------------------- /packages/commerce/src/api/endpoints/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/packages/commerce/src/api/endpoints/index.ts -------------------------------------------------------------------------------- /packages/commerce/src/schemas/page.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod' 2 | 3 | export const pageSchema = z.object({ 4 | id: z.string(), 5 | name: z.string(), 6 | url: z.string().startsWith('/').optional(), 7 | body: z.string(), 8 | is_visible: z.boolean().optional(), 9 | sort_order: z.number().optional(), 10 | }) 11 | 12 | export const pagesPathsSchema = z.array( 13 | z.object({ 14 | page: z.object({ 15 | path: z.string().startsWith('/'), 16 | }), 17 | }) 18 | ) 19 | -------------------------------------------------------------------------------- /packages/commerce/src/schemas/site.ts: -------------------------------------------------------------------------------- 1 | import { z } from 'zod' 2 | 3 | export const siteInfoSchema = z.object({ 4 | categories: z.array( 5 | z.object({ 6 | id: z.string(), 7 | name: z.string(), 8 | path: z.string().startsWith('/'), 9 | }) 10 | ), 11 | brands: z.array( 12 | z.object({ 13 | id: z.string(), 14 | name: z.string(), 15 | path: z.string().startsWith('/'), 16 | }) 17 | ), 18 | }) 19 | -------------------------------------------------------------------------------- /packages/commerce/src/types/logout.ts: -------------------------------------------------------------------------------- 1 | export type LogoutHook = { 2 | data: null 3 | body: { 4 | redirectTo?: string 5 | } 6 | } 7 | 8 | export type LogoutSchema = { 9 | endpoint: { 10 | options: {} 11 | handlers: { 12 | logout: LogoutHook 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/commerce/src/utils/default-fetcher.ts: -------------------------------------------------------------------------------- 1 | import type { HookFetcherFn } from './types' 2 | 3 | export const SWRFetcher: HookFetcherFn = ({ options, fetch }) => 4 | fetch(options) 5 | 6 | export const mutationFetcher: HookFetcherFn = ({ 7 | input, 8 | options, 9 | fetch, 10 | }) => fetch({ ...options, body: input }) 11 | 12 | export default SWRFetcher 13 | -------------------------------------------------------------------------------- /packages/commerce/src/wishlist/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useAddItem } from './use-add-item' 2 | export { default as useWishlist } from './use-wishlist' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | -------------------------------------------------------------------------------- /packages/commercejs/.env.template: -------------------------------------------------------------------------------- 1 | COMMERCE_PROVIDER=@vercel/commerce-commercejs 2 | 3 | # Public key for your Commerce.js account 4 | NEXT_PUBLIC_COMMERCEJS_PUBLIC_KEY= 5 | 6 | # The URL for the current deployment, optional but should be used for production deployments 7 | NEXT_PUBLIC_COMMERCEJS_DEPLOYMENT_URL= 8 | -------------------------------------------------------------------------------- /packages/commercejs/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/commercejs/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/commercejs/global.d.ts: -------------------------------------------------------------------------------- 1 | declare module '@components/checkout/context' 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/endpoints/cart/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/endpoints/catalog/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/endpoints/catalog/products/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/endpoints/checkout/get-checkout.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/endpoints/customer/address/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/endpoints/customer/card/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/endpoints/customer/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/endpoints/logout/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/endpoints/signup/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/endpoints/wishlist/index.tsx: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/operations/get-page.ts: -------------------------------------------------------------------------------- 1 | import { GetPageOperation } from '@vercel/commerce/types/page' 2 | 3 | export type Page = any 4 | export type GetPageResult = { page?: Page } 5 | 6 | export type PageVariables = { 7 | id: number 8 | } 9 | 10 | export default function getPageOperation() { 11 | async function getPage(): Promise { 12 | return Promise.resolve({}) 13 | } 14 | return getPage 15 | } 16 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/operations/index.ts: -------------------------------------------------------------------------------- 1 | export { default as getAllPages } from './get-all-pages' 2 | export { default as getPage } from './get-page' 3 | export { default as getSiteInfo } from './get-site-info' 4 | export { default as getProduct } from './get-product' 5 | export { default as getAllProducts } from './get-all-products' 6 | export { default as getAllProductPaths } from './get-all-product-paths' 7 | -------------------------------------------------------------------------------- /packages/commercejs/src/api/utils/graphql-fetch.ts: -------------------------------------------------------------------------------- 1 | import type { GraphQLFetcher } from '@vercel/commerce/api' 2 | import type { CommercejsConfig } from '../' 3 | 4 | import { FetcherError } from '@vercel/commerce/utils/errors' 5 | 6 | const fetchGraphqlApi: (getConfig: () => CommercejsConfig) => GraphQLFetcher = 7 | () => async () => { 8 | throw new FetcherError({ 9 | errors: [{ message: 'GraphQL fetch is not implemented' }], 10 | status: 500, 11 | }) 12 | } 13 | 14 | export default fetchGraphqlApi 15 | -------------------------------------------------------------------------------- /packages/commercejs/src/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useLogin } from './use-login' 2 | export { default as useLogout } from './use-logout' 3 | export { default as useSignup } from './use-signup' 4 | -------------------------------------------------------------------------------- /packages/commercejs/src/auth/use-signup.tsx: -------------------------------------------------------------------------------- 1 | import { MutationHook } from '@vercel/commerce/utils/types' 2 | import useSignup, { UseSignup } from '@vercel/commerce/auth/use-signup' 3 | 4 | export default useSignup as UseSignup 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher() { 11 | return null 12 | }, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | () => {}, 17 | } 18 | -------------------------------------------------------------------------------- /packages/commercejs/src/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCart } from './use-cart' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | export { default as useUpdateItem } from './use-update-item' 5 | -------------------------------------------------------------------------------- /packages/commercejs/src/checkout/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useSubmitCheckout } from './use-submit-checkout' 2 | export { default as useCheckout } from './use-checkout' 3 | -------------------------------------------------------------------------------- /packages/commercejs/src/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider": "commercejs", 3 | "features": { 4 | "cart": true, 5 | "search": true, 6 | "customCheckout": true, 7 | "customerAuth": true, 8 | "wishlist": false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/commercejs/src/constants.ts: -------------------------------------------------------------------------------- 1 | export const CART_COOKIE = 'commercejs_cart_id' 2 | export const CUSTOMER_COOKIE = 'commercejs_customer_token' 3 | export const API_URL = 'https://api.chec.io/v1' 4 | export const LOCALE = 'en-us' 5 | -------------------------------------------------------------------------------- /packages/commercejs/src/customer/address/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useAddresses } from './use-addresses' 2 | export { default as useAddItem } from './use-add-item' 3 | -------------------------------------------------------------------------------- /packages/commercejs/src/customer/address/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/address/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/commercejs/src/customer/card/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCards } from './use-cards' 2 | export { default as useAddItem } from './use-add-item' 3 | -------------------------------------------------------------------------------- /packages/commercejs/src/customer/card/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/card/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/commercejs/src/customer/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCustomer } from './use-customer' 2 | -------------------------------------------------------------------------------- /packages/commercejs/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { commercejsProvider, CommercejsProvider } from './provider' 2 | import { getCommerceProvider, useCommerce as useCoreCommerce } from '@vercel/commerce' 3 | 4 | export { commercejsProvider } 5 | export type { CommercejsProvider } 6 | 7 | export const CommerceProvider = getCommerceProvider(commercejsProvider) 8 | 9 | export const useCommerce = () => useCoreCommerce() 10 | -------------------------------------------------------------------------------- /packages/commercejs/src/lib/commercejs.ts: -------------------------------------------------------------------------------- 1 | import Commerce from '@chec/commerce.js' 2 | 3 | const commercejsPublicKey = process.env 4 | .NEXT_PUBLIC_COMMERCEJS_PUBLIC_KEY as string 5 | const devEnvironment = process.env.NODE_ENV === 'development' 6 | 7 | if (devEnvironment && !commercejsPublicKey) { 8 | throw Error('A Commerce.js public API key must be provided') 9 | } 10 | 11 | export const commerce = new Commerce(commercejsPublicKey, devEnvironment) 12 | -------------------------------------------------------------------------------- /packages/commercejs/src/next.config.cjs: -------------------------------------------------------------------------------- 1 | const commerce = require('./commerce.config.json') 2 | 3 | module.exports = { 4 | commerce, 5 | images: { 6 | domains: ['cdn.chec.io'], 7 | }, 8 | rewrites() { 9 | return [ 10 | { 11 | source: '/api/login/:token', 12 | destination: '/api/login?token=:token', 13 | }, 14 | ] 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /packages/commercejs/src/product/index.ts: -------------------------------------------------------------------------------- 1 | export { default as usePrice } from './use-price' 2 | export { default as useSearch } from './use-search' 3 | -------------------------------------------------------------------------------- /packages/commercejs/src/product/use-price.tsx: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/product/use-price' 2 | export { default } from '@vercel/commerce/product/use-price' 3 | -------------------------------------------------------------------------------- /packages/commercejs/src/utils/get-deployment-url.ts: -------------------------------------------------------------------------------- 1 | export const getDeploymentUrl = () => { 2 | // Custom environment variable. 3 | if (process.env.NEXT_PUBLIC_COMMERCEJS_DEPLOYMENT_URL) { 4 | return process.env.NEXT_PUBLIC_COMMERCEJS_DEPLOYMENT_URL 5 | } 6 | // Automatic Vercel deployment URL. 7 | if (process.env.NEXT_PUBLIC_VERCEL_URL) { 8 | return `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` 9 | } 10 | // Assume local development. 11 | return 'http://localhost:3000' 12 | } 13 | -------------------------------------------------------------------------------- /packages/commercejs/src/utils/normalize-category.ts: -------------------------------------------------------------------------------- 1 | import type { Category } from '@vercel/commerce/types/site' 2 | import type { Category as CommercejsCategory } from '@chec/commerce.js/types/category' 3 | 4 | export function normalizeCategory( 5 | commercejsCatgeory: CommercejsCategory 6 | ): Category { 7 | const { id, name, slug } = commercejsCatgeory 8 | return { 9 | id, 10 | name, 11 | slug, 12 | path: `/${slug}`, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/commercejs/src/wishlist/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | export function emptyHook() { 4 | const useEmptyHook = async (options = {}) => { 5 | return useCallback(async function () { 6 | return Promise.resolve() 7 | }, []) 8 | } 9 | 10 | return useEmptyHook 11 | } 12 | 13 | export default emptyHook 14 | -------------------------------------------------------------------------------- /packages/commercejs/src/wishlist/use-remove-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | type Options = { 4 | includeProducts?: boolean 5 | } 6 | 7 | export function emptyHook(options?: Options) { 8 | const useEmptyHook = async ({ id }: { id: string | number }) => { 9 | return useCallback(async function () { 10 | return Promise.resolve() 11 | }, []) 12 | } 13 | 14 | return useEmptyHook 15 | } 16 | 17 | export default emptyHook 18 | -------------------------------------------------------------------------------- /packages/kibocommerce/.env.template: -------------------------------------------------------------------------------- 1 | COMMERCE_PROVIDER=@vercel/commerce-kibocommerce 2 | KIBO_API_URL= 3 | KIBO_CART_COOKIE= 4 | KIBO_CUSTOMER_COOKIE= 5 | KIBO_CLIENT_ID= 6 | KIBO_SHARED_SECRET= 7 | KIBO_AUTH_URL= 8 | -------------------------------------------------------------------------------- /packages/kibocommerce/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/kibocommerce/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/endpoints/checkout/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/endpoints/customer/address.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/endpoints/customer/card.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/fragments/cartItemDetails.ts: -------------------------------------------------------------------------------- 1 | import { productDetails } from '../fragments/productDetails' 2 | export const cartItemDetails = /*GraphQL*/` 3 | fragment cartItemDetails on CartItem { 4 | id 5 | product { 6 | ...productDetails 7 | } 8 | quantity 9 | } 10 | ${productDetails} 11 | `; 12 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/fragments/category.ts: -------------------------------------------------------------------------------- 1 | export const CategoryInfo = /* GraphQL */` 2 | fragment categoryInfo on PrCategory { 3 | categoryId 4 | categoryCode 5 | isDisplayed 6 | content { 7 | name 8 | slug 9 | description 10 | } 11 | }`; -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/mutations/addToCart-mutation.ts: -------------------------------------------------------------------------------- 1 | import { cartItemDetails } from './../fragments/cartItemDetails' 2 | 3 | const addToCurrentCartMutation = /*GraphQL*/ ` 4 | ${cartItemDetails} 5 | 6 | mutation addToCart($productToAdd:CartItemInput!){ 7 | addItemToCurrentCart(cartItemInput: $productToAdd) { 8 | ...cartItemDetails 9 | } 10 | }` 11 | 12 | export default addToCurrentCartMutation 13 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/mutations/create-wishlist-mutation.ts: -------------------------------------------------------------------------------- 1 | const createWishlist = /*GraphQL*/` 2 | mutation createWishlist($wishlistInput:WishlistInput!) { 3 | createWishlist(wishlistInput:$wishlistInput){ 4 | id 5 | name 6 | customerAccountId 7 | } 8 | } 9 | `; 10 | 11 | export default createWishlist; -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/mutations/removeItemFromCart-mutation.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Delete cart based on current user session 3 | */ 4 | const removeItemFromCartMutation = /*GraphQL*/` 5 | mutation deleteCartItem($id: String!) { 6 | deleteCurrentCartItem(cartItemId:$id) 7 | }`; 8 | 9 | export default removeItemFromCartMutation; 10 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/mutations/removeItemFromWishlist-mutation.ts: -------------------------------------------------------------------------------- 1 | const removeItemFromWishlistMutation = /* GraphQL */` 2 | mutation deletewishlistitem($wishlistId: String!, $wishlistItemId: String!) { 3 | deleteWishlistItem(wishlistId: $wishlistId, wishlistItemId:$wishlistItemId) 4 | } 5 | `; 6 | 7 | export default removeItemFromWishlistMutation; 8 | 9 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/mutations/updateCartItemQuantity-mutation.ts: -------------------------------------------------------------------------------- 1 | const updateCartItemQuantityMutation = /*GraphQL*/` 2 | mutation updateCartItemQuantity($itemId:String!, $quantity: Int!){ 3 | updateCurrentCartItemQuantity(cartItemId:$itemId, quantity:$quantity){ 4 | id 5 | quantity 6 | } 7 | }`; 8 | 9 | export default updateCartItemQuantityMutation; 10 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/operations/index.ts: -------------------------------------------------------------------------------- 1 | export { default as getPage } from './get-page' 2 | export { default as getSiteInfo } from './get-site-info' 3 | export { default as getAllPages } from './get-all-pages' 4 | export { default as getProduct } from './get-product' 5 | export { default as getAllProducts } from './get-all-products' 6 | export { default as getAllProductPaths } from './get-all-product-paths' 7 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/queries/get-all-pages-query.ts: -------------------------------------------------------------------------------- 1 | export const getAllPagesQuery = /* GraphQL */` 2 | query($documentListName: String!) { 3 | documentListDocuments(documentListName:$documentListName){ 4 | items { 5 | id 6 | name 7 | listFQN 8 | properties 9 | } 10 | } 11 | }`; -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/queries/get-all-products-query.ts: -------------------------------------------------------------------------------- 1 | import { productInfo } from '../fragments/product'; 2 | 3 | export const getAllProductsQuery = /* GraphQL */` 4 | ${productInfo} 5 | 6 | query products( 7 | $filter: String 8 | $startIndex: Int 9 | $pageSize: Int 10 | ) { 11 | products( 12 | filter: $filter 13 | startIndex: $startIndex 14 | pageSize: $pageSize 15 | ) { 16 | items { 17 | ...productInfo 18 | } 19 | } 20 | } 21 | ` -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/queries/get-anonymous-shopper-token-query.ts: -------------------------------------------------------------------------------- 1 | export const getAnonymousShopperTokenQuery = /* GraphQL */ ` 2 | query { 3 | getAnonymousShopperToken { 4 | accessToken 5 | accessTokenExpiration 6 | refreshToken 7 | refreshTokenExpiration 8 | jwtAccessToken 9 | } 10 | } 11 | ` 12 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/queries/get-customer-account-query.ts: -------------------------------------------------------------------------------- 1 | export const getCustomerAccountQuery = /* GraphQL */` 2 | query getUser { 3 | customerAccount:getCurrentAccount { 4 | id 5 | firstName 6 | lastName 7 | emailAddress 8 | userName 9 | isAnonymous 10 | } 11 | } 12 | ` -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/queries/get-page-query.ts: -------------------------------------------------------------------------------- 1 | export const getPageQuery = /* GraphQL */` 2 | query($documentListName: String!, $filter: String!) { 3 | documentListDocuments(documentListName: $documentListName, filter: $filter){ 4 | startIndex 5 | totalCount 6 | items { 7 | id 8 | name 9 | listFQN 10 | properties 11 | } 12 | } 13 | } 14 | `; -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/queries/get-product-query.ts: -------------------------------------------------------------------------------- 1 | import { productInfo } from '../fragments/product'; 2 | 3 | export const getProductQuery = /* GraphQL */` 4 | ${productInfo} 5 | 6 | query product( 7 | $productCode: String! 8 | ) { 9 | product( 10 | productCode: $productCode 11 | ) { 12 | ...productInfo 13 | } 14 | } 15 | ` -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/utils/fetch.ts: -------------------------------------------------------------------------------- 1 | import zeitFetch from '@vercel/fetch' 2 | 3 | export default zeitFetch() 4 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/api/utils/get-anonymous-shopper-token.ts: -------------------------------------------------------------------------------- 1 | import type { KiboCommerceConfig } from '../' 2 | import { getAnonymousShopperTokenQuery } from '../queries/get-anonymous-shopper-token-query' 3 | 4 | async function getAnonymousShopperToken({ 5 | config, 6 | }: { 7 | config: KiboCommerceConfig 8 | }): Promise { 9 | const { data } = await config.fetch(getAnonymousShopperTokenQuery) 10 | return data?.getAnonymousShopperToken 11 | } 12 | 13 | export default getAnonymousShopperToken 14 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useLogin } from './use-login' 2 | export { default as useLogout } from './use-logout' 3 | export { default as useSignup } from './use-signup' 4 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCart } from './use-cart' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | export { default as useUpdateItem } from './use-update-item' 5 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/checkout/use-checkout.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useCheckout, { UseCheckout } from '@vercel/commerce/checkout/use-checkout' 3 | 4 | export default useCheckout as UseCheckout 5 | 6 | export const handler: SWRHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher({ input, options, fetch }) {}, 11 | useHook: 12 | ({ useData }) => 13 | async (input) => ({}), 14 | } 15 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider": "kibocommerce", 3 | "features": { 4 | "wishlist": true, 5 | "cart": true, 6 | "search": true, 7 | "customerAuth": true 8 | } 9 | } -------------------------------------------------------------------------------- /packages/kibocommerce/src/customer/address/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { UseAddItem } from '@vercel/commerce/customer/address/use-add-item' 2 | import { MutationHook } from '@vercel/commerce/utils/types' 3 | 4 | export default useAddItem as UseAddItem 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher({ input, options, fetch }) {}, 11 | useHook: 12 | ({ fetch }) => 13 | () => 14 | async () => ({}), 15 | } 16 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/customer/card/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { UseAddItem } from '@vercel/commerce/customer/card/use-add-item' 2 | import { MutationHook } from '@vercel/commerce/utils/types' 3 | 4 | export default useAddItem as UseAddItem 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher({ input, options, fetch }) {}, 11 | useHook: 12 | ({ fetch }) => 13 | () => 14 | async () => ({}), 15 | } 16 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/customer/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCustomer } from './use-customer' 2 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { getCommerceProvider, useCommerce as useCoreCommerce } from '@vercel/commerce' 2 | import { kiboCommerceProvider, KibocommerceProvider } from './provider' 3 | 4 | export { kiboCommerceProvider } 5 | export type { KibocommerceProvider } 6 | 7 | export const CommerceProvider = getCommerceProvider(kiboCommerceProvider) 8 | 9 | export const useCommerce = () => useCoreCommerce() 10 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/lib/get-cookie-expiration-date.ts: -------------------------------------------------------------------------------- 1 | export function getCookieExpirationDate(maxAgeInDays: number){ 2 | const today = new Date(); 3 | const expirationDate = new Date(); 4 | 5 | const cookieExpirationDate = new Date ( expirationDate.setDate(today.getDate() + maxAgeInDays) ) 6 | 7 | return cookieExpirationDate; 8 | } -------------------------------------------------------------------------------- /packages/kibocommerce/src/lib/get-slug.ts: -------------------------------------------------------------------------------- 1 | // Remove trailing and leading slash, usually included in nodes 2 | // returned by the BigCommerce API 3 | const getSlug = (path: string) => path.replace(/^\/|\/$/g, '') 4 | 5 | export default getSlug 6 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/lib/set-cookie.ts: -------------------------------------------------------------------------------- 1 | export function setCookies(res: any, cookies: string[]): void { 2 | res.setHeader('Set-Cookie', cookies); 3 | } -------------------------------------------------------------------------------- /packages/kibocommerce/src/next.config.cjs: -------------------------------------------------------------------------------- 1 | const commerce = require('./commerce.config.json') 2 | 3 | module.exports = { 4 | commerce, 5 | serverRuntimeConfig: { 6 | // Will only be available on the server side 7 | kiboAuthTicket: null 8 | }, 9 | images: { 10 | domains: ['d1slj7rdbjyb5l.cloudfront.net', 'cdn-tp1.mozu.com', 'cdn-sb.mozu.com'], 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/product/index.ts: -------------------------------------------------------------------------------- 1 | export { default as usePrice } from './use-price' 2 | export { default as useSearch } from './use-search' 3 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/product/use-price.tsx: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/product/use-price' 2 | export { default } from '@vercel/commerce/product/use-price' 3 | -------------------------------------------------------------------------------- /packages/kibocommerce/src/wishlist/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useAddItem } from './use-add-item' 2 | export { default as useWishlist } from './use-wishlist' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | -------------------------------------------------------------------------------- /packages/local/.env.template: -------------------------------------------------------------------------------- 1 | COMMERCE_PROVIDER=@vercel/commerce-local -------------------------------------------------------------------------------- /packages/local/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/local/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/local/README.md: -------------------------------------------------------------------------------- 1 | # Next.js Local Provider 2 | -------------------------------------------------------------------------------- /packages/local/src/api/endpoints/cart/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/local/src/api/endpoints/catalog/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/local/src/api/endpoints/catalog/products.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/local/src/api/endpoints/checkout/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/local/src/api/endpoints/customer/address.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/local/src/api/endpoints/customer/card.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/local/src/api/endpoints/customer/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/local/src/api/endpoints/login/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/local/src/api/endpoints/logout/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/local/src/api/endpoints/signup/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/local/src/api/endpoints/wishlist/index.tsx: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/local/src/api/operations/get-all-product-paths.ts: -------------------------------------------------------------------------------- 1 | import data from '../../data.json' 2 | 3 | export type GetAllProductPathsResult = { 4 | products: Array<{ path: string }> 5 | } 6 | 7 | export default function getAllProductPathsOperation() { 8 | function getAllProductPaths(): Promise { 9 | return Promise.resolve({ 10 | products: data.products.map(({ path }) => ({ path })), 11 | }) 12 | } 13 | 14 | return getAllProductPaths 15 | } 16 | -------------------------------------------------------------------------------- /packages/local/src/api/operations/get-customer-wishlist.ts: -------------------------------------------------------------------------------- 1 | export default function getCustomerWishlistOperation() { 2 | function getCustomerWishlist(): any { 3 | return { wishlist: {} } 4 | } 5 | return getCustomerWishlist 6 | } 7 | -------------------------------------------------------------------------------- /packages/local/src/api/operations/get-page.ts: -------------------------------------------------------------------------------- 1 | export type Page = any 2 | export type GetPageResult = { page?: Page } 3 | 4 | export type PageVariables = { 5 | id: number 6 | } 7 | 8 | export default function getPageOperation() { 9 | function getPage(): Promise { 10 | return Promise.resolve({}) 11 | } 12 | return getPage 13 | } 14 | -------------------------------------------------------------------------------- /packages/local/src/api/operations/index.ts: -------------------------------------------------------------------------------- 1 | export { default as getPage } from './get-page' 2 | export { default as getSiteInfo } from './get-site-info' 3 | export { default as getAllPages } from './get-all-pages' 4 | export { default as getProduct } from './get-product' 5 | export { default as getAllProducts } from './get-all-products' 6 | export { default as getAllProductPaths } from './get-all-product-paths' 7 | -------------------------------------------------------------------------------- /packages/local/src/api/utils/fetch.ts: -------------------------------------------------------------------------------- 1 | import zeitFetch from '@vercel/fetch' 2 | 3 | export default zeitFetch() 4 | -------------------------------------------------------------------------------- /packages/local/src/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useLogin } from './use-login' 2 | export { default as useLogout } from './use-logout' 3 | export { default as useSignup } from './use-signup' 4 | -------------------------------------------------------------------------------- /packages/local/src/auth/use-login.tsx: -------------------------------------------------------------------------------- 1 | import { MutationHook } from '@vercel/commerce/utils/types' 2 | import useLogin, { UseLogin } from '@vercel/commerce/auth/use-login' 3 | 4 | export default useLogin as UseLogin 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher() { 11 | return null 12 | }, 13 | useHook: () => () => { 14 | return async function () {} 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /packages/local/src/auth/use-logout.tsx: -------------------------------------------------------------------------------- 1 | import { MutationHook } from '@vercel/commerce/utils/types' 2 | import useLogout, { UseLogout } from '@vercel/commerce/auth/use-logout' 3 | 4 | export default useLogout as UseLogout 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher() { 11 | return null 12 | }, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => {}, 17 | } 18 | -------------------------------------------------------------------------------- /packages/local/src/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCart } from './use-cart' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | export { default as useUpdateItem } from './use-update-item' 5 | -------------------------------------------------------------------------------- /packages/local/src/checkout/use-checkout.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useCheckout, { 3 | UseCheckout, 4 | } from '@vercel/commerce/checkout/use-checkout' 5 | 6 | export default useCheckout as UseCheckout 7 | 8 | export const handler: SWRHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ useData }) => 15 | async (input) => ({}), 16 | } 17 | -------------------------------------------------------------------------------- /packages/local/src/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider": "local", 3 | "features": { 4 | "wishlist": false, 5 | "cart": false, 6 | "search": false, 7 | "customerAuth": false, 8 | "customCheckout": false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/local/src/customer/address/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/address/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/local/src/customer/card/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/card/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/local/src/customer/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCustomer } from './use-customer' 2 | -------------------------------------------------------------------------------- /packages/local/src/customer/use-customer.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useCustomer, { 3 | UseCustomer, 4 | } from '@vercel/commerce/customer/use-customer' 5 | 6 | export default useCustomer as UseCustomer 7 | export const handler: SWRHook = { 8 | fetchOptions: { 9 | query: '', 10 | }, 11 | async fetcher({ input, options, fetch }) {}, 12 | useHook: () => () => { 13 | return async function addItem() { 14 | return {} 15 | } 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /packages/local/src/fetcher.ts: -------------------------------------------------------------------------------- 1 | import { Fetcher } from '@vercel/commerce/utils/types' 2 | 3 | export const fetcher: Fetcher = async () => { 4 | console.log('FETCHER') 5 | const res = await fetch('./data.json') 6 | if (res.ok) { 7 | const { data } = await res.json() 8 | return data 9 | } 10 | throw res 11 | } 12 | -------------------------------------------------------------------------------- /packages/local/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | getCommerceProvider, 3 | useCommerce as useCoreCommerce, 4 | } from '@vercel/commerce' 5 | import { localProvider, LocalProvider } from './provider' 6 | 7 | export { localProvider } 8 | export type { LocalProvider } 9 | 10 | export const CommerceProvider = getCommerceProvider(localProvider) 11 | 12 | export const useCommerce = () => useCoreCommerce() 13 | -------------------------------------------------------------------------------- /packages/local/src/next.config.cjs: -------------------------------------------------------------------------------- 1 | const commerce = require('./commerce.config.json') 2 | 3 | module.exports = { 4 | commerce, 5 | images: { 6 | domains: ['localhost'], 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /packages/local/src/product/index.ts: -------------------------------------------------------------------------------- 1 | export { default as usePrice } from './use-price' 2 | export { default as useSearch } from './use-search' 3 | -------------------------------------------------------------------------------- /packages/local/src/product/use-price.tsx: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/product/use-price' 2 | export { default } from '@vercel/commerce/product/use-price' 3 | -------------------------------------------------------------------------------- /packages/local/src/product/use-search.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useSearch, { UseSearch } from '@vercel/commerce/product/use-search' 3 | export default useSearch as UseSearch 4 | 5 | export const handler: SWRHook = { 6 | fetchOptions: { 7 | query: '', 8 | }, 9 | async fetcher({ input, options, fetch }) {}, 10 | useHook: () => () => { 11 | return { 12 | data: { 13 | products: [], 14 | }, 15 | } 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /packages/local/src/wishlist/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | export function emptyHook() { 4 | const useEmptyHook = async (options = {}) => { 5 | return useCallback(async function () { 6 | return Promise.resolve() 7 | }, []) 8 | } 9 | 10 | return useEmptyHook 11 | } 12 | 13 | export default emptyHook 14 | -------------------------------------------------------------------------------- /packages/local/src/wishlist/use-remove-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | type Options = { 4 | includeProducts?: boolean 5 | } 6 | 7 | export function emptyHook(options?: Options) { 8 | const useEmptyHook = async ({ id }: { id: string | number }) => { 9 | return useCallback(async function () { 10 | return Promise.resolve() 11 | }, []) 12 | } 13 | 14 | return useEmptyHook 15 | } 16 | 17 | export default emptyHook 18 | -------------------------------------------------------------------------------- /packages/ordercloud/.env.template: -------------------------------------------------------------------------------- 1 | COMMERCE_PROVIDER=@vercel/commerce-ordercloud 2 | 3 | ORDERCLOUD_BUYER_CLIENT_ID= 4 | ORDERCLOUD_MIDDLEWARE_CLIENT_ID= 5 | ORDERCLOUD_MIDDLEWARE_CLIENT_SECRET= 6 | STRIPE_SECRET= 7 | -------------------------------------------------------------------------------- /packages/ordercloud/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/ordercloud/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/ordercloud/README.md: -------------------------------------------------------------------------------- 1 | # Next.js Ordercloud Provider 2 | 3 | Create your own store from [here](https://nextjs.org/commerce) 4 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/endpoints/customer/address/get-addresses.ts: -------------------------------------------------------------------------------- 1 | import type { CustomerAddressEndpoint } from '.' 2 | 3 | const getCards: CustomerAddressEndpoint['handlers']['getAddresses'] = async ({ 4 | res, 5 | }) => { 6 | return res.status(200).json({ data: null, errors: [] }) 7 | } 8 | 9 | export default getCards 10 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/endpoints/customer/address/remove-item.ts: -------------------------------------------------------------------------------- 1 | import type { CustomerAddressEndpoint } from '.' 2 | 3 | const removeItem: CustomerAddressEndpoint['handlers']['removeItem'] = async ({ 4 | res, 5 | }) => { 6 | return res.status(200).json({ data: null, errors: [] }) 7 | } 8 | 9 | export default removeItem 10 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/endpoints/customer/address/update-item.ts: -------------------------------------------------------------------------------- 1 | import type { CustomerAddressEndpoint } from '.' 2 | 3 | const updateItem: CustomerAddressEndpoint['handlers']['updateItem'] = async ({ 4 | res, 5 | }) => { 6 | return res.status(200).json({ data: null, errors: [] }) 7 | } 8 | 9 | export default updateItem 10 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/endpoints/customer/card/get-cards.ts: -------------------------------------------------------------------------------- 1 | import type { CustomerCardEndpoint } from '.' 2 | 3 | const getCards: CustomerCardEndpoint['handlers']['getCards'] = async ({ 4 | res, 5 | }) => { 6 | return res.status(200).json({ data: null, errors: [] }) 7 | } 8 | 9 | export default getCards 10 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/endpoints/customer/card/remove-item.ts: -------------------------------------------------------------------------------- 1 | import type { CustomerCardEndpoint } from '.' 2 | 3 | const removeItem: CustomerCardEndpoint['handlers']['removeItem'] = async ({ 4 | res, 5 | }) => { 6 | return res.status(200).json({ data: null, errors: [] }) 7 | } 8 | 9 | export default removeItem 10 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/endpoints/customer/card/update-item.ts: -------------------------------------------------------------------------------- 1 | import type { CustomerCardEndpoint } from '.' 2 | 3 | const updateItem: CustomerCardEndpoint['handlers']['updateItem'] = async ({ 4 | res, 5 | }) => { 6 | return res.status(200).json({ data: null, errors: [] }) 7 | } 8 | 9 | export default updateItem 10 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/endpoints/customer/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/endpoints/login/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/endpoints/logout/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/endpoints/signup/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/endpoints/wishlist/index.tsx: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/operations/get-page.ts: -------------------------------------------------------------------------------- 1 | import { GetPageOperation } from '@vercel/commerce/types/page' 2 | 3 | export type Page = any 4 | export type GetPageResult = { page?: Page } 5 | 6 | export type PageVariables = { 7 | id: number 8 | } 9 | 10 | export default function getPageOperation() { 11 | async function getPage(): Promise { 12 | return Promise.resolve({}) 13 | } 14 | return getPage 15 | } 16 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/operations/index.ts: -------------------------------------------------------------------------------- 1 | export { default as getAllPages } from './get-all-pages' 2 | export { default as getPage } from './get-page' 3 | export { default as getSiteInfo } from './get-site-info' 4 | export { default as getProduct } from './get-product' 5 | export { default as getAllProducts } from './get-all-products' 6 | export { default as getAllProductPaths } from './get-all-product-paths' 7 | -------------------------------------------------------------------------------- /packages/ordercloud/src/api/utils/fetch-graphql.ts: -------------------------------------------------------------------------------- 1 | import type { GraphQLFetcher } from '@vercel/commerce/api' 2 | import type { OrdercloudConfig } from '../' 3 | 4 | import { FetcherError } from '@vercel/commerce/utils/errors' 5 | 6 | const fetchGraphqlApi: (getConfig: () => OrdercloudConfig) => GraphQLFetcher = 7 | () => async () => { 8 | throw new FetcherError({ 9 | errors: [{ message: 'GraphQL fetch is not implemented' }], 10 | status: 500, 11 | }) 12 | } 13 | 14 | export default fetchGraphqlApi 15 | -------------------------------------------------------------------------------- /packages/ordercloud/src/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useLogin } from './use-login' 2 | export { default as useLogout } from './use-logout' 3 | export { default as useSignup } from './use-signup' 4 | -------------------------------------------------------------------------------- /packages/ordercloud/src/auth/use-login.tsx: -------------------------------------------------------------------------------- 1 | import { MutationHook } from '@vercel/commerce/utils/types' 2 | import useLogin, { UseLogin } from '@vercel/commerce/auth/use-login' 3 | 4 | export default useLogin as UseLogin 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher() { 11 | return null 12 | }, 13 | useHook: () => () => { 14 | return async function () {} 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /packages/ordercloud/src/auth/use-logout.tsx: -------------------------------------------------------------------------------- 1 | import { MutationHook } from '@vercel/commerce/utils/types' 2 | import useLogout, { UseLogout } from '@vercel/commerce/auth/use-logout' 3 | 4 | export default useLogout as UseLogout 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher() { 11 | return null 12 | }, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => {}, 17 | } 18 | -------------------------------------------------------------------------------- /packages/ordercloud/src/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCart } from './use-cart' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | export { default as useUpdateItem } from './use-update-item' 5 | -------------------------------------------------------------------------------- /packages/ordercloud/src/checkout/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useSubmitCheckout } from './use-submit-checkout' 2 | export { default as useCheckout } from './use-checkout' 3 | -------------------------------------------------------------------------------- /packages/ordercloud/src/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider": "ordercloud", 3 | "features": { 4 | "wishlist": false, 5 | "cart": true, 6 | "search": true, 7 | "customerAuth": false, 8 | "customCheckout": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/ordercloud/src/constants.ts: -------------------------------------------------------------------------------- 1 | export const CART_COOKIE = 'ordercloud.cart' 2 | export const TOKEN_COOKIE = 'ordercloud.token' 3 | export const CUSTOMER_COOKIE = 'ordercloud.customer' 4 | export const API_URL = 'https://sandboxapi.ordercloud.io' 5 | export const API_VERSION = 'v1' 6 | export const LOCALE = 'en-us' 7 | -------------------------------------------------------------------------------- /packages/ordercloud/src/customer/address/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useAddresses } from './use-addresses' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | export { default as useUpdateItem } from './use-update-item' 5 | -------------------------------------------------------------------------------- /packages/ordercloud/src/customer/card/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCards } from './use-cards' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | export { default as useUpdateItem } from './use-update-item' 5 | -------------------------------------------------------------------------------- /packages/ordercloud/src/customer/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCustomer } from './use-customer' 2 | -------------------------------------------------------------------------------- /packages/ordercloud/src/customer/use-customer.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useCustomer, { UseCustomer } from '@vercel/commerce/customer/use-customer' 3 | 4 | export default useCustomer as UseCustomer 5 | export const handler: SWRHook = { 6 | fetchOptions: { 7 | query: '', 8 | }, 9 | async fetcher({ input, options, fetch }) {}, 10 | useHook: () => () => { 11 | return async function addItem() { 12 | return {} 13 | } 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /packages/ordercloud/src/fetcher.ts: -------------------------------------------------------------------------------- 1 | import { Fetcher } from '@vercel/commerce/utils/types' 2 | 3 | const clientFetcher: Fetcher = async ({ method, url, body }) => { 4 | const response = await fetch(url!, { 5 | method, 6 | body: body ? JSON.stringify(body) : undefined, 7 | headers: { 8 | 'Content-Type': 'application/json', 9 | }, 10 | }) 11 | .then((response) => response.json()) 12 | .then((response) => response.data) 13 | 14 | return response 15 | } 16 | 17 | export default clientFetcher 18 | -------------------------------------------------------------------------------- /packages/ordercloud/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { ordercloudProvider, OrdercloudProvider } from './provider' 2 | import { getCommerceProvider, useCommerce as useCoreCommerce } from '@vercel/commerce' 3 | 4 | export { ordercloudProvider } 5 | export type { OrdercloudProvider } 6 | 7 | export const CommerceProvider = getCommerceProvider(ordercloudProvider) 8 | 9 | export const useCommerce = () => useCoreCommerce() 10 | -------------------------------------------------------------------------------- /packages/ordercloud/src/next.config.cjs: -------------------------------------------------------------------------------- 1 | const commerce = require('./commerce.config.json') 2 | 3 | module.exports = { 4 | commerce, 5 | images: { 6 | domains: ['localhost', 'ocdevops.blob.core.windows.net'], 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /packages/ordercloud/src/product/index.ts: -------------------------------------------------------------------------------- 1 | export { default as usePrice } from './use-price' 2 | export { default as useSearch } from './use-search' 3 | -------------------------------------------------------------------------------- /packages/ordercloud/src/product/use-price.tsx: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/product/use-price' 2 | export { default } from '@vercel/commerce/product/use-price' 3 | -------------------------------------------------------------------------------- /packages/ordercloud/src/types/category.ts: -------------------------------------------------------------------------------- 1 | export interface RawCategory { 2 | ID: string 3 | Name: string 4 | Description: null | string 5 | ListOrder: number 6 | Active: boolean 7 | ParentID: null 8 | ChildCount: number 9 | xp: null 10 | } 11 | -------------------------------------------------------------------------------- /packages/ordercloud/src/types/customer/card.ts: -------------------------------------------------------------------------------- 1 | export interface OredercloudCreditCard { 2 | ID: string 3 | Editable: boolean 4 | Token: string 5 | DateCreated: string 6 | CardType: string 7 | PartialAccountNumber: string 8 | CardholderName: string 9 | ExpirationDate: string 10 | xp: null 11 | } 12 | -------------------------------------------------------------------------------- /packages/ordercloud/src/types/node.d.ts: -------------------------------------------------------------------------------- 1 | export interface CustomNodeJsGlobal extends NodeJS.Global { 2 | token: string | null | undefined 3 | } 4 | -------------------------------------------------------------------------------- /packages/ordercloud/src/wishlist/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | export function emptyHook() { 4 | const useEmptyHook = async (options = {}) => { 5 | return useCallback(async function () { 6 | return Promise.resolve() 7 | }, []) 8 | } 9 | 10 | return useEmptyHook 11 | } 12 | 13 | export default emptyHook 14 | -------------------------------------------------------------------------------- /packages/ordercloud/src/wishlist/use-remove-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | type Options = { 4 | includeProducts?: boolean 5 | } 6 | 7 | export function emptyHook(options?: Options) { 8 | const useEmptyHook = async ({ id }: { id: string | number }) => { 9 | return useCallback(async function () { 10 | return Promise.resolve() 11 | }, []) 12 | } 13 | 14 | return useEmptyHook 15 | } 16 | 17 | export default emptyHook 18 | -------------------------------------------------------------------------------- /packages/saleor/.env.template: -------------------------------------------------------------------------------- 1 | COMMERCE_PROVIDER=@vercel/commerce-saleor 2 | 3 | NEXT_SALEOR_API_URL= 4 | NEXT_SALEOR_CHANNEL= 5 | -------------------------------------------------------------------------------- /packages/saleor/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/saleor/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/saleor/src/api/cart.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/catalog/products.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/checkout.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/customers/index.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/customers/login.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/customers/logout.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/customers/signup.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/endpoints/cart.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/endpoints/catalog/products.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/endpoints/customer/address.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/endpoints/customer/card.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/endpoints/customer/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/endpoints/login.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/endpoints/logout.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/endpoints/signup.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/endpoints/wishlist.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/api/operations/index.ts: -------------------------------------------------------------------------------- 1 | export { default as getAllPages } from './get-all-pages' 2 | export { default as getPage } from './get-page' 3 | export { default as getAllProducts } from './get-all-products' 4 | export { default as getAllProductPaths } from './get-all-product-paths' 5 | export { default as getProduct } from './get-product' 6 | export { default as getSiteInfo } from './get-site-info' 7 | export { default as login } from './login' 8 | -------------------------------------------------------------------------------- /packages/saleor/src/api/utils/fetch.ts: -------------------------------------------------------------------------------- 1 | import zeitFetch from '@vercel/fetch' 2 | export default zeitFetch() 3 | -------------------------------------------------------------------------------- /packages/saleor/src/api/wishlist.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/saleor/src/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCart } from './use-cart' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useUpdateItem } from './use-update-item' 4 | export { default as useRemoveItem } from './use-remove-item' 5 | -------------------------------------------------------------------------------- /packages/saleor/src/checkout/use-checkout.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useCheckout, { UseCheckout } from '@vercel/commerce/checkout/use-checkout' 3 | 4 | export default useCheckout as UseCheckout 5 | 6 | export const handler: SWRHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher({ input, options, fetch }) {}, 11 | useHook: 12 | ({ useData }) => 13 | async (input) => ({}), 14 | } 15 | -------------------------------------------------------------------------------- /packages/saleor/src/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider": "saleor", 3 | "features": { 4 | "wishlist": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/saleor/src/const.ts: -------------------------------------------------------------------------------- 1 | export const API_URL = process.env.NEXT_PUBLIC_SALEOR_API_URL 2 | export const API_CHANNEL = process.env.NEXT_PUBLIC_SALEOR_CHANNEL 3 | export const CHECKOUT_ID_COOKIE = 'saleor.CheckoutID' 4 | export const SALEOR_TOKEN = 'saleor.Token' 5 | export const SALEOR_CRSF_TOKEN = 'saleor.CSRFToken' 6 | -------------------------------------------------------------------------------- /packages/saleor/src/customer/address/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { UseAddItem } from '@vercel/commerce/customer/address/use-add-item' 2 | import { MutationHook } from '@vercel/commerce/utils/types' 3 | 4 | export default useAddItem as UseAddItem 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher({ input, options, fetch }) {}, 11 | useHook: 12 | ({ fetch }) => 13 | () => 14 | async () => ({}), 15 | } 16 | -------------------------------------------------------------------------------- /packages/saleor/src/customer/card/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { UseAddItem } from '@vercel/commerce/customer/card/use-add-item' 2 | import { MutationHook } from '@vercel/commerce/utils/types' 3 | 4 | export default useAddItem as UseAddItem 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher({ input, options, fetch }) {}, 11 | useHook: 12 | ({ fetch }) => 13 | () => 14 | async () => ({}), 15 | } 16 | -------------------------------------------------------------------------------- /packages/saleor/src/customer/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCustomer } from './use-customer' 2 | -------------------------------------------------------------------------------- /packages/saleor/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { getCommerceProvider, useCommerce as useCoreCommerce } from '@vercel/commerce' 2 | import { saleorProvider, SaleorProvider } from './provider' 3 | 4 | export { saleorProvider } 5 | export type { SaleorProvider } 6 | 7 | export const CommerceProvider = getCommerceProvider(saleorProvider) 8 | 9 | export const useCommerce = () => useCoreCommerce() 10 | -------------------------------------------------------------------------------- /packages/saleor/src/next.config.cjs: -------------------------------------------------------------------------------- 1 | const commerce = require('./commerce.config.json') 2 | 3 | module.exports = { 4 | commerce, 5 | images: { 6 | domains: [process.env.COMMERCE_IMAGE_HOST], 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /packages/saleor/src/product/use-price.tsx: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/product/use-price' 2 | export { default } from '@vercel/commerce/product/use-price' 3 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/checkout-attach.ts: -------------------------------------------------------------------------------- 1 | import * as mutation from './mutations' 2 | import { CheckoutCustomerAttach } from '../../schema' 3 | 4 | export const checkoutAttach = async (fetch: any, { variables, headers }: any): Promise => { 5 | const data = await fetch({ 6 | query: mutation.CheckoutAttach, 7 | variables, 8 | headers, 9 | }) 10 | 11 | return data 12 | } 13 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/fragments/index.ts: -------------------------------------------------------------------------------- 1 | export { ProductConnection } from './product' 2 | export { CheckoutDetails } from './checkout-details' 3 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/get-checkout-id.ts: -------------------------------------------------------------------------------- 1 | import Cookies from 'js-cookie' 2 | import { CHECKOUT_ID_COOKIE } from '../const' 3 | 4 | const getCheckoutId = (id?: string) => { 5 | const r = Cookies.get(CHECKOUT_ID_COOKIE)?.split(':') || [] 6 | return { checkoutId: r[0], checkoutToken: r[1] } 7 | } 8 | 9 | export default getCheckoutId 10 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/mutations/account-create.ts: -------------------------------------------------------------------------------- 1 | export const AccountCreate = /* GraphQL */ ` 2 | mutation AccountCreate($input: AccountRegisterInput!) { 3 | accountRegister(input: $input) { 4 | errors { 5 | code 6 | field 7 | message 8 | } 9 | user { 10 | email 11 | isActive 12 | } 13 | } 14 | } 15 | ` 16 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/mutations/checkout-attach.ts: -------------------------------------------------------------------------------- 1 | export const CheckoutAttach = /* GraphQl */ ` 2 | mutation CheckoutAttach($checkoutId: ID!) { 3 | checkoutCustomerAttach(checkoutId: $checkoutId) { 4 | errors { 5 | message 6 | } 7 | checkout { 8 | id 9 | } 10 | } 11 | } 12 | ` 13 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/mutations/checkout-create.ts: -------------------------------------------------------------------------------- 1 | import * as fragment from '../fragments' 2 | 3 | export const CheckoutCreate = /* GraphQL */ ` 4 | mutation CheckoutCreate { 5 | checkoutCreate(input: { email: "customer@example.com", lines: [], channel: "default-channel" }) { 6 | errors { 7 | code 8 | field 9 | message 10 | } 11 | checkout { 12 | ...CheckoutDetails 13 | } 14 | } 15 | } 16 | ${fragment.CheckoutDetails} 17 | ` 18 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/mutations/checkout-line-add.ts: -------------------------------------------------------------------------------- 1 | import * as fragment from '../fragments' 2 | 3 | export const CheckoutLineAdd = /* GraphQL */ ` 4 | mutation CheckoutLineAdd($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) { 5 | checkoutLinesAdd(checkoutId: $checkoutId, lines: $lineItems) { 6 | errors { 7 | code 8 | field 9 | message 10 | } 11 | checkout { 12 | ...CheckoutDetails 13 | } 14 | } 15 | } 16 | ${fragment.CheckoutDetails} 17 | ` 18 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/mutations/checkout-line-remove.ts: -------------------------------------------------------------------------------- 1 | import * as fragment from '../fragments' 2 | 3 | export const CheckoutLineDelete = /* GraphQL */ ` 4 | mutation CheckoutLineDelete($checkoutId: ID!, $lineId: ID!) { 5 | checkoutLineDelete(checkoutId: $checkoutId, lineId: $lineId) { 6 | errors { 7 | code 8 | field 9 | message 10 | } 11 | checkout { 12 | ...CheckoutDetails 13 | } 14 | } 15 | } 16 | ${fragment.CheckoutDetails} 17 | ` 18 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/mutations/index.ts: -------------------------------------------------------------------------------- 1 | export { AccountCreate } from './account-create' 2 | export { CheckoutCreate } from './checkout-create' 3 | export { CheckoutLineAdd } from './checkout-line-add' 4 | export { CheckoutLineUpdate } from './checkout-line-update' 5 | export { CheckoutLineDelete } from './checkout-line-remove' 6 | export { SessionCreate } from './session-create' 7 | export { SessionDestroy } from './session-destroy' 8 | export { CheckoutAttach } from './checkout-attach' 9 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/mutations/session-create.ts: -------------------------------------------------------------------------------- 1 | export const SessionCreate = /* GraphQL */ ` 2 | mutation SessionCreate($email: String!, $password: String!) { 3 | tokenCreate(email: $email, password: $password) { 4 | token 5 | refreshToken 6 | csrfToken 7 | errors { 8 | code 9 | field 10 | message 11 | } 12 | } 13 | } 14 | ` 15 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/mutations/session-destroy.ts: -------------------------------------------------------------------------------- 1 | export const SessionDestroy = /* GraphQL */ ` 2 | mutation SessionDestroy { 3 | tokensDeactivateAll { 4 | errors { 5 | field 6 | message 7 | } 8 | } 9 | } 10 | ` 11 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/queries/checkout-one.ts: -------------------------------------------------------------------------------- 1 | import * as fragment from '../fragments' 2 | 3 | export const CheckoutOne = /* GraphQL */ ` 4 | query CheckoutOne($checkoutId: UUID!) { 5 | checkout(token: $checkoutId) { 6 | ... on Checkout { 7 | ...CheckoutDetails 8 | } 9 | } 10 | } 11 | ${fragment.CheckoutDetails} 12 | ` 13 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/queries/collection-many.ts: -------------------------------------------------------------------------------- 1 | export const CollectionMany = /* GraphQL */ ` 2 | query CollectionMany($first: Int!, $channel: String = "default-channel") { 3 | collections(first: $first, channel: $channel) { 4 | edges { 5 | node { 6 | id 7 | name 8 | slug 9 | } 10 | } 11 | } 12 | } 13 | ` 14 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/queries/collection-one.ts: -------------------------------------------------------------------------------- 1 | import * as fragment from '../fragments' 2 | 3 | export const CollectionOne = /* GraphQL */ ` 4 | query getProductsFromCollection( 5 | $categoryId: ID! 6 | $first: Int = 50 7 | $channel: String = "default-channel" 8 | ) { 9 | collection(id: $categoryId, channel: $channel) { 10 | id 11 | products(first: $first) { 12 | ...ProductConnection 13 | } 14 | } 15 | } 16 | ${fragment.ProductConnection} 17 | ` 18 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/queries/customer-current.ts: -------------------------------------------------------------------------------- 1 | export const CustomerCurrent = /* GraphQL */ ` 2 | query CustomerCurrent { 3 | me { 4 | id 5 | email 6 | firstName 7 | lastName 8 | dateJoined 9 | } 10 | } 11 | ` 12 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/queries/customer-one.ts: -------------------------------------------------------------------------------- 1 | export const CustomerOne = /* GraphQL */ ` 2 | query CustomerOne($customerAccessToken: String!) { 3 | customer(customerAccessToken: $customerAccessToken) { 4 | id 5 | } 6 | } 7 | ` 8 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/queries/get-all-product-vendors-query.ts: -------------------------------------------------------------------------------- 1 | export const getAllProductVendors = /* GraphQL */ ` 2 | query getAllProductVendors($first: Int = 50, $cursor: String) { 3 | products(first: $first, after: $cursor) { 4 | pageInfo { 5 | hasNextPage 6 | hasPreviousPage 7 | } 8 | edges { 9 | node { 10 | vendor 11 | } 12 | cursor 13 | } 14 | } 15 | } 16 | ` 17 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/queries/page-many.ts: -------------------------------------------------------------------------------- 1 | export const PageMany = /* GraphQL */ ` 2 | query PageMany($first: Int = 50) { 3 | pages(first: $first) { 4 | edges { 5 | node { 6 | id 7 | title 8 | slug 9 | } 10 | } 11 | } 12 | } 13 | ` 14 | -------------------------------------------------------------------------------- /packages/saleor/src/utils/queries/page-one.ts: -------------------------------------------------------------------------------- 1 | export const PageOne = /* GraphQL */ ` 2 | query PageOne($id: ID!) { 3 | page(id: $id) { 4 | id 5 | title 6 | slug 7 | } 8 | } 9 | ` 10 | -------------------------------------------------------------------------------- /packages/saleor/src/wishlist/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | export function emptyHook() { 4 | const useEmptyHook = async (options = {}) => { 5 | return useCallback(async function () { 6 | return Promise.resolve() 7 | }, []) 8 | } 9 | 10 | return useEmptyHook 11 | } 12 | 13 | export default emptyHook 14 | -------------------------------------------------------------------------------- /packages/saleor/src/wishlist/use-remove-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | type Options = { 4 | includeProducts?: boolean 5 | } 6 | 7 | export function emptyHook(options?: Options) { 8 | const useEmptyHook = async ({ id }: { id: string | number }) => { 9 | return useCallback(async function () { 10 | return Promise.resolve() 11 | }, []) 12 | } 13 | 14 | return useEmptyHook 15 | } 16 | 17 | export default emptyHook 18 | -------------------------------------------------------------------------------- /packages/sfcc/.env.template: -------------------------------------------------------------------------------- 1 | COMMERCE_PROVIDER=@vercel/commerce-sfcc 2 | 3 | SFCC_CLIENT_ID= 4 | SFCC_CLIENT_SECRET= 5 | SFCC_ORG_ID= 6 | SFCC_SHORT_CODE= 7 | SFCC_SITE_ID= -------------------------------------------------------------------------------- /packages/sfcc/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/sfcc/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/endpoints/cart/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/endpoints/checkout/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/endpoints/customer/address.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/endpoints/customer/card.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/endpoints/customer/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/endpoints/login/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/endpoints/logout/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/endpoints/signup/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/endpoints/wishlist/index.tsx: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/operations/get-customer-wishlist.ts: -------------------------------------------------------------------------------- 1 | export default function getCustomerWishlistOperation() { 2 | function getCustomerWishlist(): any { 3 | return { wishlist: {} } 4 | } 5 | return getCustomerWishlist 6 | } 7 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/operations/get-page.ts: -------------------------------------------------------------------------------- 1 | export type Page = any 2 | export type GetPageResult = { page?: Page } 3 | 4 | export type PageVariables = { 5 | id: number 6 | } 7 | 8 | export default function getPageOperation() { 9 | function getPage(): Promise { 10 | return Promise.resolve({}) 11 | } 12 | return getPage 13 | } 14 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/operations/index.ts: -------------------------------------------------------------------------------- 1 | export { default as getPage } from './get-page' 2 | export { default as getSiteInfo } from './get-site-info' 3 | export { default as getAllPages } from './get-all-pages' 4 | export { default as getProduct } from './get-product' 5 | export { default as getAllProducts } from './get-all-products' 6 | export { default as getAllProductPaths } from './get-all-product-paths' 7 | -------------------------------------------------------------------------------- /packages/sfcc/src/api/utils/fetch.ts: -------------------------------------------------------------------------------- 1 | import zeitFetch from '@vercel/fetch' 2 | 3 | export default zeitFetch() 4 | -------------------------------------------------------------------------------- /packages/sfcc/src/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useLogin } from './use-login' 2 | export { default as useLogout } from './use-logout' 3 | export { default as useSignup } from './use-signup' 4 | -------------------------------------------------------------------------------- /packages/sfcc/src/auth/use-login.tsx: -------------------------------------------------------------------------------- 1 | import { MutationHook } from '@vercel/commerce/utils/types' 2 | import useLogin, { UseLogin } from '@vercel/commerce/auth/use-login' 3 | 4 | export default useLogin as UseLogin 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher() { 11 | return null 12 | }, 13 | useHook: () => () => { 14 | return async function () {} 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /packages/sfcc/src/auth/use-logout.tsx: -------------------------------------------------------------------------------- 1 | import { MutationHook } from '@vercel/commerce/utils/types' 2 | import useLogout, { UseLogout } from '@vercel/commerce/auth/use-logout' 3 | 4 | export default useLogout as UseLogout 5 | 6 | export const handler: MutationHook = { 7 | fetchOptions: { 8 | query: '', 9 | }, 10 | async fetcher() { 11 | return null 12 | }, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => {}, 17 | } 18 | -------------------------------------------------------------------------------- /packages/sfcc/src/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCart } from './use-cart' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | export { default as useUpdateItem } from './use-update-item' 5 | -------------------------------------------------------------------------------- /packages/sfcc/src/checkout/use-checkout.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useCheckout, { 3 | UseCheckout, 4 | } from '@vercel/commerce/checkout/use-checkout' 5 | 6 | export default useCheckout as UseCheckout 7 | 8 | export const handler: SWRHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ useData }) => 15 | async (input) => ({}), 16 | } 17 | -------------------------------------------------------------------------------- /packages/sfcc/src/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider": "sfcc", 3 | "features": { 4 | "wishlist": false, 5 | "cart": false, 6 | "search": true, 7 | "customerAuth": false, 8 | "customCheckout": false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/sfcc/src/customer/address/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/address/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/sfcc/src/customer/card/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/card/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/sfcc/src/customer/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCustomer } from './use-customer' 2 | -------------------------------------------------------------------------------- /packages/sfcc/src/customer/use-customer.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useCustomer, { 3 | UseCustomer, 4 | } from '@vercel/commerce/customer/use-customer' 5 | 6 | export default useCustomer as UseCustomer 7 | export const handler: SWRHook = { 8 | fetchOptions: { 9 | query: '', 10 | }, 11 | async fetcher({ input, options, fetch }) {}, 12 | useHook: () => () => { 13 | return async function addItem() { 14 | return {} 15 | } 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /packages/sfcc/src/fetcher.ts: -------------------------------------------------------------------------------- 1 | import { Fetcher } from '@vercel/commerce/utils/types' 2 | 3 | const clientFetcher: Fetcher = async ({ method, url, body }) => { 4 | const response = await fetch(url!, { 5 | method, 6 | body: body ? JSON.stringify(body) : undefined, 7 | headers: { 8 | 'Content-Type': 'application/json', 9 | }, 10 | }) 11 | .then((response) => response.json()) 12 | .then((response) => response.data) 13 | 14 | return response 15 | } 16 | 17 | export default clientFetcher 18 | -------------------------------------------------------------------------------- /packages/sfcc/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | getCommerceProvider, 3 | useCommerce as useCoreCommerce, 4 | } from '@vercel/commerce' 5 | import { sfccProvider, SfccProvider } from './provider' 6 | 7 | export { sfccProvider } 8 | export type { SfccProvider } 9 | 10 | export const CommerceProvider = getCommerceProvider(sfccProvider) 11 | 12 | export const useCommerce = () => useCoreCommerce() 13 | -------------------------------------------------------------------------------- /packages/sfcc/src/next.config.cjs: -------------------------------------------------------------------------------- 1 | const commerce = require('./commerce.config.json') 2 | 3 | module.exports = { 4 | commerce, 5 | images: { 6 | domains: [ 7 | 'localhost', 8 | 'edge.disstg.commercecloud.salesforce.com', 9 | 'zzte-053.sandbox.us02.dx.commercecloud.salesforce.com', 10 | ], 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /packages/sfcc/src/product/index.ts: -------------------------------------------------------------------------------- 1 | export { default as usePrice } from './use-price' 2 | export { default as useSearch } from './use-search' 3 | -------------------------------------------------------------------------------- /packages/sfcc/src/product/use-price.tsx: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/product/use-price' 2 | export { default } from '@vercel/commerce/product/use-price' 3 | -------------------------------------------------------------------------------- /packages/sfcc/src/wishlist/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | export function emptyHook() { 4 | const useEmptyHook = async (options = {}) => { 5 | return useCallback(async function () { 6 | return Promise.resolve() 7 | }, []) 8 | } 9 | 10 | return useEmptyHook 11 | } 12 | 13 | export default emptyHook 14 | -------------------------------------------------------------------------------- /packages/sfcc/src/wishlist/use-remove-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | type Options = { 4 | includeProducts?: boolean 5 | } 6 | 7 | export function emptyHook(options?: Options) { 8 | const useEmptyHook = async ({ id }: { id: string | number }) => { 9 | return useCallback(async function () { 10 | return Promise.resolve() 11 | }, []) 12 | } 13 | 14 | return useEmptyHook 15 | } 16 | 17 | export default emptyHook 18 | -------------------------------------------------------------------------------- /packages/shopify/.env.template: -------------------------------------------------------------------------------- 1 | COMMERCE_PROVIDER=@vercel/commerce-shopify 2 | 3 | NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN= 4 | NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN= 5 | -------------------------------------------------------------------------------- /packages/shopify/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/shopify/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/shopify/src/api/endpoints/cart.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/shopify/src/api/endpoints/customer/address.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/shopify/src/api/endpoints/customer/card.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/shopify/src/api/endpoints/customer/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/shopify/src/api/endpoints/login.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/shopify/src/api/endpoints/logout.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/shopify/src/api/endpoints/signup.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/shopify/src/api/endpoints/wishlist.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/shopify/src/api/utils/fetch.ts: -------------------------------------------------------------------------------- 1 | import zeitFetch from '@vercel/fetch' 2 | export default zeitFetch() 3 | -------------------------------------------------------------------------------- /packages/shopify/src/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCart } from './use-cart' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useUpdateItem } from './use-update-item' 4 | export { default as useRemoveItem } from './use-remove-item' 5 | -------------------------------------------------------------------------------- /packages/shopify/src/checkout/use-checkout.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useCheckout, { 3 | UseCheckout, 4 | } from '@vercel/commerce/checkout/use-checkout' 5 | 6 | export default useCheckout as UseCheckout 7 | 8 | export const handler: SWRHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ useData }) => 15 | async (input) => ({}), 16 | } 17 | -------------------------------------------------------------------------------- /packages/shopify/src/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider": "shopify", 3 | "features": { 4 | "wishlist": false, 5 | "customerAuth": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/shopify/src/customer/address/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/address/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/shopify/src/customer/card/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/card/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/shopify/src/customer/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCustomer } from './use-customer' 2 | -------------------------------------------------------------------------------- /packages/shopify/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | getCommerceProvider, 3 | useCommerce as useCoreCommerce, 4 | } from '@vercel/commerce' 5 | import { shopifyProvider, ShopifyProvider } from './provider' 6 | 7 | export { shopifyProvider } 8 | export type { ShopifyProvider } 9 | 10 | export const CommerceProvider = getCommerceProvider(shopifyProvider) 11 | 12 | export const useCommerce = () => useCoreCommerce() 13 | -------------------------------------------------------------------------------- /packages/shopify/src/next.config.cjs: -------------------------------------------------------------------------------- 1 | const commerce = require('./commerce.config.json') 2 | 3 | module.exports = { 4 | commerce, 5 | images: { 6 | domains: ['cdn.shopify.com'], 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /packages/shopify/src/product/use-price.tsx: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/product/use-price' 2 | export { default } from '@vercel/commerce/product/use-price' 3 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/get-checkout-id.ts: -------------------------------------------------------------------------------- 1 | import Cookies from 'js-cookie' 2 | import { SHOPIFY_CHECKOUT_ID_COOKIE } from '../const' 3 | 4 | const getCheckoutId = (id?: string) => { 5 | return id ?? Cookies.get(SHOPIFY_CHECKOUT_ID_COOKIE) 6 | } 7 | 8 | export default getCheckoutId 9 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/mutations/customer-access-token-create.ts: -------------------------------------------------------------------------------- 1 | const customerAccessTokenCreateMutation = /* GraphQL */ ` 2 | mutation customerAccessTokenCreate($input: CustomerAccessTokenCreateInput!) { 3 | customerAccessTokenCreate(input: $input) { 4 | customerAccessToken { 5 | accessToken 6 | expiresAt 7 | } 8 | customerUserErrors { 9 | code 10 | field 11 | message 12 | } 13 | } 14 | } 15 | ` 16 | export default customerAccessTokenCreateMutation 17 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/mutations/customer-access-token-delete.ts: -------------------------------------------------------------------------------- 1 | const customerAccessTokenDeleteMutation = /* GraphQL */ ` 2 | mutation customerAccessTokenDelete($customerAccessToken: String!) { 3 | customerAccessTokenDelete(customerAccessToken: $customerAccessToken) { 4 | deletedAccessToken 5 | deletedCustomerAccessTokenId 6 | userErrors { 7 | field 8 | message 9 | } 10 | } 11 | } 12 | ` 13 | 14 | export default customerAccessTokenDeleteMutation 15 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/mutations/customer-create.ts: -------------------------------------------------------------------------------- 1 | const customerCreateMutation = /* GraphQL */ ` 2 | mutation customerCreate($input: CustomerCreateInput!) { 3 | customerCreate(input: $input) { 4 | customerUserErrors { 5 | code 6 | field 7 | message 8 | } 9 | customer { 10 | id 11 | } 12 | } 13 | } 14 | ` 15 | export default customerCreateMutation 16 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/queries/get-all-collections-query.ts: -------------------------------------------------------------------------------- 1 | const getSiteCollectionsQuery = /* GraphQL */ ` 2 | query getSiteCollections($first: Int!) { 3 | collections(first: $first) { 4 | edges { 5 | node { 6 | id 7 | title 8 | handle 9 | } 10 | } 11 | } 12 | } 13 | ` 14 | export default getSiteCollectionsQuery 15 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/queries/get-all-pages-query.ts: -------------------------------------------------------------------------------- 1 | export const getAllPagesQuery = /* GraphQL */ ` 2 | query getAllPages($first: Int = 250) { 3 | pages(first: $first) { 4 | edges { 5 | node { 6 | id 7 | title 8 | handle 9 | } 10 | } 11 | } 12 | } 13 | ` 14 | export default getAllPagesQuery 15 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/queries/get-all-product-vendors-query.ts: -------------------------------------------------------------------------------- 1 | const getAllProductVendors = /* GraphQL */ ` 2 | query getAllProductVendors($first: Int = 250, $cursor: String) { 3 | products(first: $first, after: $cursor) { 4 | pageInfo { 5 | hasNextPage 6 | hasPreviousPage 7 | } 8 | edges { 9 | node { 10 | vendor 11 | } 12 | cursor 13 | } 14 | } 15 | } 16 | ` 17 | export default getAllProductVendors 18 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/queries/get-all-products-paths-query.ts: -------------------------------------------------------------------------------- 1 | const getAllProductsPathsQuery = /* GraphQL */ ` 2 | query getAllProductPaths($first: Int = 250, $cursor: String) { 3 | products(first: $first, after: $cursor) { 4 | pageInfo { 5 | hasNextPage 6 | hasPreviousPage 7 | } 8 | edges { 9 | node { 10 | handle 11 | } 12 | cursor 13 | } 14 | } 15 | } 16 | ` 17 | export default getAllProductsPathsQuery 18 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/queries/get-customer-id-query.ts: -------------------------------------------------------------------------------- 1 | export const getCustomerQuery = /* GraphQL */ ` 2 | query getCustomerId($customerAccessToken: String!) { 3 | customer(customerAccessToken: $customerAccessToken) { 4 | id 5 | } 6 | } 7 | ` 8 | export default getCustomerQuery 9 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/queries/get-customer-query.ts: -------------------------------------------------------------------------------- 1 | export const getCustomerQuery = /* GraphQL */ ` 2 | query getCustomer($customerAccessToken: String!) { 3 | customer(customerAccessToken: $customerAccessToken) { 4 | id 5 | firstName 6 | lastName 7 | displayName 8 | email 9 | phone 10 | tags 11 | acceptsMarketing 12 | createdAt 13 | } 14 | } 15 | ` 16 | export default getCustomerQuery 17 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/queries/get-page-query.ts: -------------------------------------------------------------------------------- 1 | export const getPageQuery = /* GraphQL */ ` 2 | query getPage($id: ID!) { 3 | node(id: $id) { 4 | id 5 | ... on Page { 6 | title 7 | handle 8 | body 9 | bodySummary 10 | } 11 | } 12 | } 13 | ` 14 | export default getPageQuery 15 | -------------------------------------------------------------------------------- /packages/shopify/src/utils/queries/get-site-info-query.ts: -------------------------------------------------------------------------------- 1 | const getSiteInfoQuery = /* GraphQL */ ` 2 | query getSiteInfo { 3 | shop { 4 | name 5 | } 6 | } 7 | ` 8 | export default getSiteInfoQuery 9 | -------------------------------------------------------------------------------- /packages/shopify/src/wishlist/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | export function emptyHook() { 4 | const useEmptyHook = async (options = {}) => { 5 | return useCallback(async function () { 6 | return Promise.resolve() 7 | }, []) 8 | } 9 | 10 | return useEmptyHook 11 | } 12 | 13 | export default emptyHook 14 | -------------------------------------------------------------------------------- /packages/shopify/src/wishlist/use-remove-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | type Options = { 4 | includeProducts?: boolean 5 | } 6 | 7 | export function emptyHook(options?: Options) { 8 | const useEmptyHook = async ({ id }: { id: string | number }) => { 9 | return useCallback(async function () { 10 | return Promise.resolve() 11 | }, []) 12 | } 13 | 14 | return useEmptyHook 15 | } 16 | 17 | export default emptyHook 18 | -------------------------------------------------------------------------------- /packages/spree/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/spree/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/spree/README-assets/screenshots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/packages/spree/README-assets/screenshots.png -------------------------------------------------------------------------------- /packages/spree/src/api/endpoints/cart/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/api/endpoints/catalog/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/api/endpoints/catalog/products.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/api/endpoints/customer/address.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/api/endpoints/customer/card.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/api/endpoints/customer/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/api/endpoints/login/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/api/endpoints/logout/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/api/endpoints/signup/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/api/endpoints/wishlist/index.tsx: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/api/operations/get-customer-wishlist.ts: -------------------------------------------------------------------------------- 1 | export default function getCustomerWishlistOperation() { 2 | function getCustomerWishlist(): any { 3 | return { wishlist: {} } 4 | } 5 | return getCustomerWishlist 6 | } 7 | -------------------------------------------------------------------------------- /packages/spree/src/api/operations/index.ts: -------------------------------------------------------------------------------- 1 | export { default as getPage } from './get-page' 2 | export { default as getSiteInfo } from './get-site-info' 3 | export { default as getAllPages } from './get-all-pages' 4 | export { default as getProduct } from './get-product' 5 | export { default as getAllProducts } from './get-all-products' 6 | export { default as getAllProductPaths } from './get-all-product-paths' 7 | -------------------------------------------------------------------------------- /packages/spree/src/api/utils/fetch.ts: -------------------------------------------------------------------------------- 1 | import vercelFetch from '@vercel/fetch' 2 | 3 | export default vercelFetch() 4 | -------------------------------------------------------------------------------- /packages/spree/src/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useLogin } from './use-login' 2 | export { default as useLogout } from './use-logout' 3 | export { default as useSignup } from './use-signup' 4 | -------------------------------------------------------------------------------- /packages/spree/src/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCart } from './use-cart' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | export { default as useUpdateItem } from './use-update-item' 5 | -------------------------------------------------------------------------------- /packages/spree/src/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider": "spree", 3 | "features": { 4 | "wishlist": true, 5 | "cart": true, 6 | "search": true, 7 | "customerAuth": true, 8 | "customCheckout": false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/spree/src/customer/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCustomer } from './use-customer' 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/AccessTokenError.ts: -------------------------------------------------------------------------------- 1 | export default class AccessTokenError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/MisconfigurationError.ts: -------------------------------------------------------------------------------- 1 | export default class MisconfigurationError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/MissingConfigurationValueError.ts: -------------------------------------------------------------------------------- 1 | export default class MissingConfigurationValueError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/MissingLineItemVariantError.ts: -------------------------------------------------------------------------------- 1 | export default class MissingLineItemVariantError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/MissingOptionValueError.ts: -------------------------------------------------------------------------------- 1 | export default class MissingOptionValueError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/MissingPrimaryVariantError.ts: -------------------------------------------------------------------------------- 1 | export default class MissingPrimaryVariantError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/MissingProductError.ts: -------------------------------------------------------------------------------- 1 | export default class MissingProductError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/MissingSlugVariableError.ts: -------------------------------------------------------------------------------- 1 | export default class MissingSlugVariableError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/MissingVariantError.ts: -------------------------------------------------------------------------------- 1 | export default class MissingVariantError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/RefreshTokenError.ts: -------------------------------------------------------------------------------- 1 | export default class RefreshTokenError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/SpreeResponseContentError.ts: -------------------------------------------------------------------------------- 1 | export default class SpreeResponseContentError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/SpreeSdkMethodFromEndpointPathError.ts: -------------------------------------------------------------------------------- 1 | export default class SpreeSdkMethodFromEndpointPathError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/TokensNotRejectedError.ts: -------------------------------------------------------------------------------- 1 | export default class TokensNotRejectedError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/errors/UserTokenResponseParseError.ts: -------------------------------------------------------------------------------- 1 | export default class UserTokenResponseParseError extends Error {} 2 | -------------------------------------------------------------------------------- /packages/spree/src/next.config.cjs: -------------------------------------------------------------------------------- 1 | const commerce = require('./commerce.config.json') 2 | 3 | module.exports = { 4 | commerce, 5 | images: { 6 | domains: [process.env.NEXT_PUBLIC_SPREE_ALLOWED_IMAGE_DOMAIN], 7 | }, 8 | rewrites() { 9 | return [ 10 | { 11 | source: '/checkout', 12 | destination: '/api/checkout', 13 | }, 14 | ] 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /packages/spree/src/product/index.ts: -------------------------------------------------------------------------------- 1 | export { default as usePrice } from './use-price' 2 | export { default as useSearch } from './use-search' 3 | -------------------------------------------------------------------------------- /packages/spree/src/product/use-price.tsx: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/product/use-price' 2 | export { default } from '@vercel/commerce/product/use-price' 3 | -------------------------------------------------------------------------------- /packages/spree/src/utils/get-product-path.ts: -------------------------------------------------------------------------------- 1 | import type { ProductSlugAttr } from '../types' 2 | 3 | const getProductPath = (partialSpreeProduct: ProductSlugAttr) => { 4 | return `/${partialSpreeProduct.attributes.slug}` 5 | } 6 | 7 | export default getProductPath 8 | -------------------------------------------------------------------------------- /packages/spree/src/utils/handle-token-errors.ts: -------------------------------------------------------------------------------- 1 | import AccessTokenError from '../errors/AccessTokenError' 2 | import RefreshTokenError from '../errors/RefreshTokenError' 3 | 4 | const handleTokenErrors = (error: unknown, action: () => void): boolean => { 5 | if (error instanceof AccessTokenError || error instanceof RefreshTokenError) { 6 | action() 7 | 8 | return true 9 | } 10 | 11 | return false 12 | } 13 | 14 | export default handleTokenErrors 15 | -------------------------------------------------------------------------------- /packages/spree/src/utils/is-json-content-type.ts: -------------------------------------------------------------------------------- 1 | const isJsonContentType = (contentType: string): boolean => 2 | contentType.includes('application/json') || 3 | contentType.includes('application/vnd.api+json') 4 | 5 | export default isJsonContentType 6 | -------------------------------------------------------------------------------- /packages/spree/src/utils/is-server.ts: -------------------------------------------------------------------------------- 1 | export default typeof window === 'undefined' 2 | -------------------------------------------------------------------------------- /packages/spree/src/utils/sort-option-types.ts: -------------------------------------------------------------------------------- 1 | import type { ExpandedProductOption } from '../types' 2 | 3 | const sortOptionsByPosition = ( 4 | options: ExpandedProductOption[] 5 | ): ExpandedProductOption[] => { 6 | return options.sort((firstOption, secondOption) => { 7 | return firstOption.position - secondOption.position 8 | }) 9 | } 10 | 11 | export default sortOptionsByPosition 12 | -------------------------------------------------------------------------------- /packages/spree/src/utils/tokens/is-logged-in.ts: -------------------------------------------------------------------------------- 1 | import { ensureUserTokenResponse } from './user-token-response' 2 | 3 | const isLoggedIn = (): boolean => { 4 | const userTokenResponse = ensureUserTokenResponse() 5 | 6 | return !!userTokenResponse 7 | } 8 | 9 | export default isLoggedIn 10 | -------------------------------------------------------------------------------- /packages/spree/src/utils/validations/validate-all-products-taxonomy-id.ts: -------------------------------------------------------------------------------- 1 | const validateAllProductsTaxonomyId = (taxonomyId: unknown): string | false => { 2 | if (!taxonomyId || taxonomyId === 'false') { 3 | return false 4 | } 5 | 6 | if (typeof taxonomyId === 'string') { 7 | return taxonomyId 8 | } 9 | 10 | throw new TypeError('taxonomyId must be a string or falsy.') 11 | } 12 | 13 | export default validateAllProductsTaxonomyId 14 | -------------------------------------------------------------------------------- /packages/spree/src/utils/validations/validate-images-option-filter.ts: -------------------------------------------------------------------------------- 1 | const validateImagesOptionFilter = ( 2 | optionTypeNameOrFalse: unknown 3 | ): string | false => { 4 | if (!optionTypeNameOrFalse || optionTypeNameOrFalse === 'false') { 5 | return false 6 | } 7 | 8 | if (typeof optionTypeNameOrFalse === 'string') { 9 | return optionTypeNameOrFalse 10 | } 11 | 12 | throw new TypeError('optionTypeNameOrFalse must be a string or falsy.') 13 | } 14 | 15 | export default validateImagesOptionFilter 16 | -------------------------------------------------------------------------------- /packages/spree/src/utils/validations/validate-images-size.ts: -------------------------------------------------------------------------------- 1 | const validateImagesSize = (size: unknown): string => { 2 | if (typeof size !== 'string') { 3 | throw new TypeError('size must be a string.') 4 | } 5 | 6 | if (!size.includes('x') || size.split('x').length != 2) { 7 | throw new Error("size must have two numbers separated with an 'x'") 8 | } 9 | 10 | return size 11 | } 12 | 13 | export default validateImagesSize 14 | -------------------------------------------------------------------------------- /packages/spree/src/utils/validations/validate-placeholder-image-url.ts: -------------------------------------------------------------------------------- 1 | const validatePlaceholderImageUrl = ( 2 | placeholderUrlOrFalse: unknown 3 | ): string | false => { 4 | if (!placeholderUrlOrFalse || placeholderUrlOrFalse === 'false') { 5 | return false 6 | } 7 | 8 | if (typeof placeholderUrlOrFalse === 'string') { 9 | return placeholderUrlOrFalse 10 | } 11 | 12 | throw new TypeError('placeholderUrlOrFalse must be a string or falsy.') 13 | } 14 | 15 | export default validatePlaceholderImageUrl 16 | -------------------------------------------------------------------------------- /packages/spree/src/wishlist/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useAddItem } from './use-add-item' 2 | export { default as useWishlist } from './use-wishlist' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | -------------------------------------------------------------------------------- /packages/swell/.env.template: -------------------------------------------------------------------------------- 1 | COMMERCE_PROVIDER=@vercel/commerce-swell 2 | 3 | SWELL_STORE_DOMAIN= 4 | SWELL_STOREFRONT_ACCESS_TOKEN= 5 | 6 | NEXT_PUBLIC_SWELL_STORE_ID= 7 | NEXT_PUBLIC_SWELL_PUBLIC_KEY= 8 | -------------------------------------------------------------------------------- /packages/swell/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/swell/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/swell/src/api/cart/index.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/catalog/index.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/catalog/products.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/customer.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/customers/index.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/customers/logout.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/customers/signup.ts: -------------------------------------------------------------------------------- 1 | export default function () {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/endpoints/cart.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/endpoints/catalog/products.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/endpoints/customer/address.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/endpoints/customer/card.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/endpoints/customer/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/endpoints/login.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/endpoints/logout.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/endpoints/signup.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/endpoints/wishlist.ts: -------------------------------------------------------------------------------- 1 | export default function (_commerce: any) {} 2 | -------------------------------------------------------------------------------- /packages/swell/src/api/utils/fetch-swell-api.ts: -------------------------------------------------------------------------------- 1 | import swell from '../../swell' 2 | 3 | const fetchApi = async (query: string, method: string, variables: [] = []) => { 4 | return swell[query][method](...variables) 5 | } 6 | 7 | export default fetchApi 8 | -------------------------------------------------------------------------------- /packages/swell/src/api/utils/fetch.ts: -------------------------------------------------------------------------------- 1 | import zeitFetch from '@vercel/fetch' 2 | export default zeitFetch() 3 | -------------------------------------------------------------------------------- /packages/swell/src/api/wishlist/index.tsx: -------------------------------------------------------------------------------- 1 | export type WishlistItem = { product: any; id: number } 2 | export default function () {} 3 | -------------------------------------------------------------------------------- /packages/swell/src/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCart } from './use-cart' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | -------------------------------------------------------------------------------- /packages/swell/src/cart/utils/index.ts: -------------------------------------------------------------------------------- 1 | export { default as checkoutToCart } from './checkout-to-cart' 2 | export { default as checkoutCreate } from './checkout-create' 3 | -------------------------------------------------------------------------------- /packages/swell/src/checkout/use-checkout.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useCheckout, { 3 | UseCheckout, 4 | } from '@vercel/commerce/checkout/use-checkout' 5 | 6 | export default useCheckout as UseCheckout 7 | 8 | export const handler: SWRHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ useData }) => 15 | async (input) => ({}), 16 | } 17 | -------------------------------------------------------------------------------- /packages/swell/src/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider": "swell", 3 | "features": { 4 | "wishlist": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/swell/src/const.ts: -------------------------------------------------------------------------------- 1 | export const SWELL_CHECKOUT_ID_COOKIE = 'SWELL_checkoutId' 2 | 3 | export const SWELL_CHECKOUT_URL_COOKIE = 'swell_checkoutUrl' 4 | 5 | export const SWELL_CUSTOMER_TOKEN_COOKIE = 'swell_customerToken' 6 | 7 | export const SWELL_COOKIE_EXPIRE = 30 8 | 9 | export const SWELL_STORE_ID = process.env.NEXT_PUBLIC_SWELL_STORE_ID 10 | 11 | export const SWELL_PUBLIC_KEY = process.env.NEXT_PUBLIC_SWELL_PUBLIC_KEY 12 | -------------------------------------------------------------------------------- /packages/swell/src/customer/address/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/address/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/swell/src/customer/card/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/card/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/swell/src/customer/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCustomer } from './use-customer' 2 | -------------------------------------------------------------------------------- /packages/swell/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | getCommerceProvider, 3 | useCommerce as useCoreCommerce, 4 | } from '@vercel/commerce' 5 | import { swellProvider, SwellProvider } from './provider' 6 | 7 | export { swellProvider } 8 | export type { SwellProvider } 9 | 10 | export const CommerceProvider = getCommerceProvider(swellProvider) 11 | 12 | export const useCommerce = () => useCoreCommerce() 13 | -------------------------------------------------------------------------------- /packages/swell/src/next.config.cjs: -------------------------------------------------------------------------------- 1 | const commerce = require('./commerce.config.json') 2 | 3 | module.exports = { 4 | commerce, 5 | images: { 6 | domains: ['cdn.schema.io'], 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /packages/swell/src/product/index.ts: -------------------------------------------------------------------------------- 1 | export { default as usePrice } from './use-price' 2 | export { default as useSearch } from './use-search' 3 | -------------------------------------------------------------------------------- /packages/swell/src/product/use-price.tsx: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/product/use-price' 2 | export { default } from '@vercel/commerce/product/use-price' 3 | -------------------------------------------------------------------------------- /packages/swell/src/swell.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import swell from 'swell-js' 3 | import { SWELL_STORE_ID, SWELL_PUBLIC_KEY } from './const' 4 | 5 | swell.init(SWELL_STORE_ID, SWELL_PUBLIC_KEY) 6 | 7 | export default swell 8 | -------------------------------------------------------------------------------- /packages/swell/src/types/cart.ts: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/types/cart' 2 | -------------------------------------------------------------------------------- /packages/swell/src/types/checkout.ts: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/types/checkout' 2 | -------------------------------------------------------------------------------- /packages/swell/src/types/common.ts: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/types/common' 2 | -------------------------------------------------------------------------------- /packages/swell/src/types/customer.ts: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/types/customer' 2 | -------------------------------------------------------------------------------- /packages/swell/src/types/login.ts: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/types/login' 2 | -------------------------------------------------------------------------------- /packages/swell/src/types/logout.ts: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/types/logout' 2 | -------------------------------------------------------------------------------- /packages/swell/src/types/page.ts: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/types/page' 2 | -------------------------------------------------------------------------------- /packages/swell/src/types/product.ts: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/types/product' 2 | -------------------------------------------------------------------------------- /packages/swell/src/types/signup.ts: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/types/signup' 2 | -------------------------------------------------------------------------------- /packages/swell/src/types/site.ts: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/types/site' 2 | -------------------------------------------------------------------------------- /packages/swell/src/types/wishlist.ts: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/types/wishlist' 2 | -------------------------------------------------------------------------------- /packages/swell/src/utils/get-categories.ts: -------------------------------------------------------------------------------- 1 | import { SwellConfig } from '../api' 2 | import type { Category } from '@vercel/commerce/types/site' 3 | 4 | const getCategories = async (config: SwellConfig): Promise => { 5 | const data = await config.fetch('categories', 'get') 6 | return ( 7 | data.results.map(({ id, name, slug }: any) => ({ 8 | id, 9 | name, 10 | slug, 11 | path: `/${slug}`, 12 | })) ?? [] 13 | ) 14 | } 15 | 16 | export default getCategories 17 | -------------------------------------------------------------------------------- /packages/swell/src/utils/get-checkout-id.ts: -------------------------------------------------------------------------------- 1 | import Cookies from 'js-cookie' 2 | import { SWELL_CHECKOUT_ID_COOKIE } from '../const' 3 | 4 | const getCheckoutId = (id?: string) => { 5 | return id ?? Cookies.get(SWELL_CHECKOUT_ID_COOKIE) 6 | } 7 | 8 | export default getCheckoutId 9 | -------------------------------------------------------------------------------- /packages/swell/src/utils/get-vendors.ts: -------------------------------------------------------------------------------- 1 | import { SwellConfig } from '../api' 2 | 3 | const getVendors = async (config: SwellConfig) => { 4 | const vendors: [string] = 5 | (await config.fetch('attributes', 'get', ['brand']))?.values ?? [] 6 | 7 | return [...new Set(vendors)].map((v) => ({ 8 | id: v, 9 | name: v, 10 | slug: v.replace(/\s+/g, '-').toLowerCase(), 11 | path: `/${v}`, 12 | })) 13 | } 14 | 15 | export default getVendors 16 | -------------------------------------------------------------------------------- /packages/swell/src/utils/handle-fetch-response.ts: -------------------------------------------------------------------------------- 1 | import { CommerceError } from '@vercel/commerce/utils/errors' 2 | 3 | type SwellFetchResponse = { 4 | error: { 5 | message: string 6 | code?: string 7 | } 8 | } 9 | 10 | const handleFetchResponse = async (res: SwellFetchResponse) => { 11 | if (res) { 12 | if (res.error) { 13 | throw new CommerceError(res.error) 14 | } 15 | return res 16 | } 17 | } 18 | 19 | export default handleFetchResponse 20 | -------------------------------------------------------------------------------- /packages/swell/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export { default as handleFetchResponse } from './handle-fetch-response' 2 | export { default as getSearchVariables } from './get-search-variables' 3 | export { default as getSortVariables } from './get-sort-variables' 4 | export { default as getVendors } from './get-vendors' 5 | export { default as getCategories } from './get-categories' 6 | export { default as getCheckoutId } from './get-checkout-id' 7 | 8 | export * from './normalize' 9 | export * from './customer-token' 10 | -------------------------------------------------------------------------------- /packages/swell/src/utils/storage.ts: -------------------------------------------------------------------------------- 1 | export const getCheckoutIdFromStorage = (token: string) => { 2 | if (window && window.sessionStorage) { 3 | return window.sessionStorage.getItem(token) 4 | } 5 | 6 | return null 7 | } 8 | 9 | export const setCheckoutIdInStorage = (token: string, id: string | number) => { 10 | if (window && window.sessionStorage) { 11 | return window.sessionStorage.setItem(token, id + '') 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/swell/src/wishlist/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | export function emptyHook() { 4 | const useEmptyHook = async (options = {}) => { 5 | return useCallback(async function () { 6 | return Promise.resolve() 7 | }, []) 8 | } 9 | 10 | return useEmptyHook 11 | } 12 | 13 | export default emptyHook 14 | -------------------------------------------------------------------------------- /packages/swell/src/wishlist/use-remove-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | type Options = { 4 | includeProducts?: boolean 5 | } 6 | 7 | export function emptyHook(options?: Options) { 8 | const useEmptyHook = async ({ id }: { id: string | number }) => { 9 | return useCallback(async function () { 10 | return Promise.resolve() 11 | }, []) 12 | } 13 | 14 | return useEmptyHook 15 | } 16 | 17 | export default emptyHook 18 | -------------------------------------------------------------------------------- /packages/taskr-swc/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/taskr-swc/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "taskr-swc", 3 | "version": "0.0.1", 4 | "license": "MIT", 5 | "scripts": { 6 | "prettier-fix": "prettier --write ." 7 | }, 8 | "main": "taskfile-swc.js", 9 | "files": [ 10 | "taskfile-swc.js" 11 | ], 12 | "devDependencies": { 13 | "@swc/core": "^1.2.138", 14 | "prettier": "^2.5.1" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/vendure/.env.template: -------------------------------------------------------------------------------- 1 | COMMERCE_PROVIDER=@vercel/commerce-vendure 2 | 3 | NEXT_PUBLIC_VENDURE_SHOP_API_URL=http://localhost:3001/shop-api 4 | NEXT_PUBLIC_VENDURE_LOCAL_URL=/vendure-shop-api 5 | -------------------------------------------------------------------------------- /packages/vendure/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /packages/vendure/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /packages/vendure/src/api/endpoints/cart/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/vendure/src/api/endpoints/catalog/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/vendure/src/api/endpoints/catalog/products.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/vendure/src/api/endpoints/customer/address.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/vendure/src/api/endpoints/customer/card.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/vendure/src/api/endpoints/customer/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/vendure/src/api/endpoints/login/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/vendure/src/api/endpoints/logout/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/vendure/src/api/endpoints/signup/index.ts: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/vendure/src/api/endpoints/wishlist/index.tsx: -------------------------------------------------------------------------------- 1 | export default function noopApi(...args: any[]): void {} 2 | -------------------------------------------------------------------------------- /packages/vendure/src/api/utils/fetch.ts: -------------------------------------------------------------------------------- 1 | import zeitFetch from '@vercel/fetch' 2 | 3 | export default zeitFetch() 4 | -------------------------------------------------------------------------------- /packages/vendure/src/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useLogin } from './use-login' 2 | export { default as useLogout } from './use-logout' 3 | export { default as useSignup } from './use-signup' 4 | -------------------------------------------------------------------------------- /packages/vendure/src/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCart } from './use-cart' 2 | export { default as useAddItem } from './use-add-item' 3 | export { default as useRemoveItem } from './use-remove-item' 4 | export { default as useUpdateItem } from './use-update-item' 5 | -------------------------------------------------------------------------------- /packages/vendure/src/checkout/use-checkout.tsx: -------------------------------------------------------------------------------- 1 | import { SWRHook } from '@vercel/commerce/utils/types' 2 | import useCheckout, { 3 | UseCheckout, 4 | } from '@vercel/commerce/checkout/use-checkout' 5 | 6 | export default useCheckout as UseCheckout 7 | 8 | export const handler: SWRHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ useData }) => 15 | async (input) => ({}), 16 | } 17 | -------------------------------------------------------------------------------- /packages/vendure/src/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "provider": "vendure", 3 | "features": { 4 | "wishlist": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/vendure/src/customer/address/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/address/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/vendure/src/customer/card/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import useAddItem, { 2 | UseAddItem, 3 | } from '@vercel/commerce/customer/card/use-add-item' 4 | import { MutationHook } from '@vercel/commerce/utils/types' 5 | 6 | export default useAddItem as UseAddItem 7 | 8 | export const handler: MutationHook = { 9 | fetchOptions: { 10 | query: '', 11 | }, 12 | async fetcher({ input, options, fetch }) {}, 13 | useHook: 14 | ({ fetch }) => 15 | () => 16 | async () => ({}), 17 | } 18 | -------------------------------------------------------------------------------- /packages/vendure/src/customer/index.ts: -------------------------------------------------------------------------------- 1 | export { default as useCustomer } from './use-customer' 2 | -------------------------------------------------------------------------------- /packages/vendure/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | getCommerceProvider, 3 | useCommerce as useCoreCommerce, 4 | } from '@vercel/commerce' 5 | import { vendureProvider, VendureProvider } from './provider' 6 | 7 | export { vendureProvider } 8 | export type { VendureProvider } 9 | 10 | export const CommerceProvider = getCommerceProvider(vendureProvider) 11 | 12 | export const useCommerce = () => useCoreCommerce() 13 | -------------------------------------------------------------------------------- /packages/vendure/src/next.config.cjs: -------------------------------------------------------------------------------- 1 | const commerce = require('./commerce.config.json') 2 | 3 | module.exports = { 4 | commerce, 5 | images: { 6 | domains: ['localhost', 'demo.vendure.io','readonlydemo.vendure.io'], 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /packages/vendure/src/product/index.ts: -------------------------------------------------------------------------------- 1 | export { default as usePrice } from './use-price' 2 | export { default as useSearch } from './use-search' 3 | -------------------------------------------------------------------------------- /packages/vendure/src/product/use-price.tsx: -------------------------------------------------------------------------------- 1 | export * from '@vercel/commerce/product/use-price' 2 | export { default } from '@vercel/commerce/product/use-price' 3 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/fragments/search-result-fragment.ts: -------------------------------------------------------------------------------- 1 | export const searchResultFragment = /* GraphQL */ ` 2 | fragment SearchResult on SearchResult { 3 | productId 4 | productName 5 | description 6 | slug 7 | sku 8 | currencyCode 9 | productAsset { 10 | id 11 | preview 12 | } 13 | priceWithTax { 14 | ... on SinglePrice { 15 | value 16 | } 17 | ... on PriceRange { 18 | min 19 | max 20 | } 21 | } 22 | } 23 | ` 24 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/mutations/add-item-to-order-mutation.ts: -------------------------------------------------------------------------------- 1 | import { cartFragment } from '../fragments/cart-fragment' 2 | 3 | export const addItemToOrderMutation = /* GraphQL */ ` 4 | mutation addItemToOrder($variantId: ID!, $quantity: Int!) { 5 | addItemToOrder(productVariantId: $variantId, quantity: $quantity) { 6 | __typename 7 | ...Cart 8 | ... on ErrorResult { 9 | errorCode 10 | message 11 | } 12 | } 13 | } 14 | ${cartFragment} 15 | ` 16 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/mutations/adjust-order-line-mutation.ts: -------------------------------------------------------------------------------- 1 | import { cartFragment } from '../fragments/cart-fragment' 2 | 3 | export const adjustOrderLineMutation = /* GraphQL */ ` 4 | mutation adjustOrderLine($orderLineId: ID!, $quantity: Int!) { 5 | adjustOrderLine(orderLineId: $orderLineId, quantity: $quantity) { 6 | __typename 7 | ...Cart 8 | ... on ErrorResult { 9 | errorCode 10 | message 11 | } 12 | } 13 | } 14 | ${cartFragment} 15 | ` 16 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/mutations/log-in-mutation.ts: -------------------------------------------------------------------------------- 1 | export const loginMutation = /* GraphQL */ ` 2 | mutation login($username: String!, $password: String!) { 3 | login(username: $username, password: $password) { 4 | __typename 5 | ... on CurrentUser { 6 | id 7 | } 8 | ... on ErrorResult { 9 | errorCode 10 | message 11 | } 12 | } 13 | } 14 | ` 15 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/mutations/log-out-mutation.ts: -------------------------------------------------------------------------------- 1 | export const logoutMutation = /* GraphQL */ ` 2 | mutation logout { 3 | logout { 4 | success 5 | } 6 | } 7 | ` 8 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/mutations/remove-order-line-mutation.ts: -------------------------------------------------------------------------------- 1 | import { cartFragment } from '../fragments/cart-fragment' 2 | 3 | export const removeOrderLineMutation = /* GraphQL */ ` 4 | mutation removeOrderLine($orderLineId: ID!) { 5 | removeOrderLine(orderLineId: $orderLineId) { 6 | __typename 7 | ...Cart 8 | ... on ErrorResult { 9 | errorCode 10 | message 11 | } 12 | } 13 | } 14 | ${cartFragment} 15 | ` 16 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/mutations/sign-up-mutation.ts: -------------------------------------------------------------------------------- 1 | export const signupMutation = /* GraphQL */ ` 2 | mutation signup($input: RegisterCustomerInput!) { 3 | registerCustomerAccount(input: $input) { 4 | __typename 5 | ... on Success { 6 | success 7 | } 8 | ... on ErrorResult { 9 | errorCode 10 | message 11 | } 12 | } 13 | } 14 | ` 15 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/queries/active-customer-query.ts: -------------------------------------------------------------------------------- 1 | export const activeCustomerQuery = /* GraphQL */ ` 2 | query activeCustomer { 3 | activeCustomer { 4 | id 5 | firstName 6 | lastName 7 | emailAddress 8 | } 9 | } 10 | ` 11 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/queries/get-all-product-paths-query.ts: -------------------------------------------------------------------------------- 1 | export const getAllProductPathsQuery = /* GraphQL */ ` 2 | query getAllProductPaths($first: Int = 100) { 3 | products(options: { take: $first }) { 4 | items { 5 | slug 6 | } 7 | } 8 | } 9 | ` 10 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/queries/get-all-products-query.ts: -------------------------------------------------------------------------------- 1 | import { searchResultFragment } from '../fragments/search-result-fragment' 2 | 3 | export const getAllProductsQuery = /* GraphQL */ ` 4 | query getAllProducts($input: SearchInput!) { 5 | search(input: $input) { 6 | items { 7 | ...SearchResult 8 | } 9 | } 10 | } 11 | ${searchResultFragment} 12 | ` 13 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/queries/get-cart-query.ts: -------------------------------------------------------------------------------- 1 | import { cartFragment } from '../fragments/cart-fragment' 2 | 3 | export const getCartQuery = /* GraphQL */ ` 4 | query activeOrder { 5 | activeOrder { 6 | ...Cart 7 | } 8 | } 9 | ${cartFragment} 10 | ` 11 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/queries/get-collections-query.ts: -------------------------------------------------------------------------------- 1 | export const getCollectionsQuery = /* GraphQL */ ` 2 | query getCollections { 3 | collections { 4 | items { 5 | id 6 | name 7 | description 8 | slug 9 | productVariants { 10 | totalItems 11 | } 12 | parent { 13 | id 14 | } 15 | children { 16 | id 17 | } 18 | } 19 | } 20 | } 21 | ` 22 | -------------------------------------------------------------------------------- /packages/vendure/src/utils/queries/search-query.ts: -------------------------------------------------------------------------------- 1 | import { searchResultFragment } from '../fragments/search-result-fragment' 2 | 3 | export const searchQuery = /* GraphQL */ ` 4 | query search($input: SearchInput!) { 5 | search(input: $input) { 6 | items { 7 | ...SearchResult 8 | } 9 | totalItems 10 | } 11 | } 12 | ${searchResultFragment} 13 | ` 14 | -------------------------------------------------------------------------------- /packages/vendure/src/wishlist/use-add-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | export function emptyHook() { 4 | const useEmptyHook = async (options = {}) => { 5 | return useCallback(async function () { 6 | return Promise.resolve() 7 | }, []) 8 | } 9 | 10 | return useEmptyHook 11 | } 12 | 13 | export default emptyHook 14 | -------------------------------------------------------------------------------- /packages/vendure/src/wishlist/use-remove-item.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react' 2 | 3 | type Options = { 4 | includeProducts?: boolean 5 | } 6 | 7 | export function emptyHook(options?: Options) { 8 | const useEmptyHook = async ({ id }: { id: string | number }) => { 9 | return useCallback(async function () { 10 | return Promise.resolve() 11 | }, []) 12 | } 13 | 14 | return useEmptyHook 15 | } 16 | 17 | export default emptyHook 18 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'site' 3 | - 'packages/*' 4 | -------------------------------------------------------------------------------- /site/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["next", "prettier"], 3 | "rules": { 4 | "react/no-unescaped-entities": "off" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /site/.npmrc: -------------------------------------------------------------------------------- 1 | strict-peer-dependencies=false -------------------------------------------------------------------------------- /site/.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .next 3 | public -------------------------------------------------------------------------------- /site/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /site/assets/chrome-bug.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Chrome has a bug with transitions on load since 2012! 3 | * 4 | * To prevent a "pop" of content, you have to disable all transitions until 5 | * the page is done loading. 6 | * 7 | * https://lab.laukstein.com/bug/input 8 | * https://twitter.com/timer150/status/1345217126680899584 9 | */ 10 | body.loading * { 11 | transition: none !important; 12 | } 13 | -------------------------------------------------------------------------------- /site/assets/components.css: -------------------------------------------------------------------------------- 1 | .fit { 2 | min-height: calc(100vh - 88px); 3 | } 4 | -------------------------------------------------------------------------------- /site/assets/main.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @import './base.css'; 3 | 4 | @tailwind components; 5 | @import './components.css'; 6 | 7 | @tailwind utilities; 8 | -------------------------------------------------------------------------------- /site/commerce.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "features": { 3 | "cart": true, 4 | "search": true, 5 | "wishlist": false, 6 | "customerAuth": false, 7 | "customCheckout": false 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /site/components/auth/index.ts: -------------------------------------------------------------------------------- 1 | export { default as LoginView } from './LoginView' 2 | export { default as SignUpView } from './SignUpView' 3 | export { default as ForgotPassword } from './ForgotPassword' 4 | -------------------------------------------------------------------------------- /site/components/cart/CartItem/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CartItem' 2 | -------------------------------------------------------------------------------- /site/components/cart/CartSidebarView/CartSidebarView.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | min-height: 100vh; 3 | } 4 | 5 | .root.empty { 6 | @apply bg-secondary text-secondary; 7 | } 8 | 9 | .lineItemsList { 10 | @apply py-4 space-y-6 sm:py-0 sm:space-y-0 sm:divide-y sm:divide-accent-2 border-accent-2; 11 | } 12 | -------------------------------------------------------------------------------- /site/components/cart/CartSidebarView/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CartSidebarView' 2 | -------------------------------------------------------------------------------- /site/components/cart/index.ts: -------------------------------------------------------------------------------- 1 | export { default as CartSidebarView } from './CartSidebarView' 2 | export { default as CartItem } from './CartItem' 3 | -------------------------------------------------------------------------------- /site/components/checkout/CheckoutSidebarView/CheckoutSidebarView.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | min-height: calc(100vh - 322px); 3 | } 4 | 5 | .lineItemsList { 6 | @apply py-4 space-y-6 sm:py-0 sm:space-y-0 sm:divide-y sm:divide-accent-2 border-accent-2; 7 | } 8 | -------------------------------------------------------------------------------- /site/components/checkout/CheckoutSidebarView/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CheckoutSidebarView' 2 | -------------------------------------------------------------------------------- /site/components/checkout/PaymentMethodView/PaymentMethodView.module.css: -------------------------------------------------------------------------------- 1 | .fieldset { 2 | @apply flex flex-col my-3; 3 | } 4 | 5 | .fieldset .label { 6 | @apply text-accent-7 uppercase text-xs font-medium mb-2; 7 | } 8 | 9 | .fieldset .input, 10 | .fieldset .select { 11 | @apply p-2 border border-accent-2 w-full text-sm font-normal; 12 | } 13 | 14 | .fieldset .input:focus, 15 | .fieldset .select:focus { 16 | @apply outline-none shadow-outline-normal; 17 | } 18 | -------------------------------------------------------------------------------- /site/components/checkout/PaymentMethodView/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './PaymentMethodView' 2 | -------------------------------------------------------------------------------- /site/components/checkout/PaymentWidget/PaymentWidget.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply border border-accent-2 px-6 py-5 mb-4 text-center 3 | flex items-center cursor-pointer hover:border-accent-4; 4 | } 5 | -------------------------------------------------------------------------------- /site/components/checkout/PaymentWidget/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './PaymentWidget' 2 | -------------------------------------------------------------------------------- /site/components/checkout/ShippingView/ShippingView.module.css: -------------------------------------------------------------------------------- 1 | .fieldset { 2 | @apply flex flex-col my-3; 3 | } 4 | 5 | .fieldset .label { 6 | @apply text-accent-7 uppercase text-xs font-medium mb-2; 7 | } 8 | 9 | .fieldset .input, 10 | .fieldset .select { 11 | @apply p-2 border border-accent-2 w-full text-sm font-normal; 12 | } 13 | 14 | .fieldset .input:focus, 15 | .fieldset .select:focus { 16 | @apply outline-none shadow-outline-normal; 17 | } 18 | 19 | .radio { 20 | @apply bg-black; 21 | } 22 | -------------------------------------------------------------------------------- /site/components/checkout/ShippingView/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ShippingView' 2 | -------------------------------------------------------------------------------- /site/components/checkout/ShippingWidget/ShippingWidget.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply border border-accent-2 px-6 py-5 mb-4 text-center 3 | flex items-center cursor-pointer hover:border-accent-4; 4 | } 5 | -------------------------------------------------------------------------------- /site/components/checkout/ShippingWidget/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ShippingWidget' 2 | -------------------------------------------------------------------------------- /site/components/common/Avatar/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Avatar' 2 | -------------------------------------------------------------------------------- /site/components/common/FeatureBar/FeatureBar.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply text-center p-6 bg-primary text-sm flex-row 3 | justify-center items-center font-medium fixed bottom-0 4 | w-full z-30 transition-all duration-300 ease-out 5 | md:flex md:text-left; 6 | } 7 | -------------------------------------------------------------------------------- /site/components/common/FeatureBar/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './FeatureBar' 2 | -------------------------------------------------------------------------------- /site/components/common/Footer/Footer.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply border-t border-accent-2; 3 | } 4 | 5 | .link { 6 | & > svg { 7 | @apply transform duration-75 ease-linear; 8 | } 9 | 10 | &:hover > svg { 11 | @apply scale-110; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /site/components/common/Footer/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Footer' 2 | -------------------------------------------------------------------------------- /site/components/common/Head/Head.tsx: -------------------------------------------------------------------------------- 1 | import type { VFC } from 'react' 2 | import { SEO } from '@components/common' 3 | 4 | const Head: VFC = () => { 5 | return ( 6 | 7 | 12 | 13 | 14 | ) 15 | } 16 | 17 | export default Head 18 | -------------------------------------------------------------------------------- /site/components/common/Head/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Head' 2 | -------------------------------------------------------------------------------- /site/components/common/HomeAllProductsGrid/HomeAllProductsGrid.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply py-12 flex flex-col w-full px-6; 3 | 4 | @screen md { 5 | @apply flex-row; 6 | } 7 | 8 | & .asideWrapper { 9 | @apply pr-3 w-full relative; 10 | 11 | @screen md { 12 | @apply w-48; 13 | } 14 | } 15 | 16 | & .aside { 17 | @apply flex flex-row w-full justify-around mb-12; 18 | 19 | @screen md { 20 | @apply mb-0 block sticky top-32; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /site/components/common/HomeAllProductsGrid/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './HomeAllProductsGrid' 2 | -------------------------------------------------------------------------------- /site/components/common/I18nWidget/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './I18nWidget' 2 | -------------------------------------------------------------------------------- /site/components/common/Layout/Layout.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply h-full bg-primary mx-auto transition-colors duration-150; 3 | max-width: 2460px; 4 | } 5 | -------------------------------------------------------------------------------- /site/components/common/Layout/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Layout' 2 | -------------------------------------------------------------------------------- /site/components/common/Navbar/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Navbar' 2 | -------------------------------------------------------------------------------- /site/components/common/SEO/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './SEO' 2 | -------------------------------------------------------------------------------- /site/components/common/Searchbar/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Searchbar' 2 | -------------------------------------------------------------------------------- /site/components/common/SidebarLayout/SidebarLayout.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply relative h-full flex flex-col; 3 | } 4 | 5 | .header { 6 | @apply sticky top-0 pl-4 py-4 pr-6 7 | flex items-center justify-between 8 | bg-accent-0 box-border w-full z-10; 9 | min-height: 66px; 10 | } 11 | 12 | .container { 13 | @apply flex flex-col flex-1 box-border; 14 | } 15 | 16 | @screen lg { 17 | .header { 18 | min-height: 74px; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /site/components/common/SidebarLayout/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './SidebarLayout' 2 | -------------------------------------------------------------------------------- /site/components/common/UserNav/CustomerMenuContent/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CustomerMenuContent' 2 | -------------------------------------------------------------------------------- /site/components/common/UserNav/MenuSidebarView/MenuSidebarView.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply px-4 sm:px-6 sm:w-full flex-1 z-20; 3 | } 4 | 5 | .item { 6 | @apply text-xl font-bold py-2; 7 | } 8 | -------------------------------------------------------------------------------- /site/components/common/UserNav/MenuSidebarView/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './MenuSidebarView' 2 | export interface Link { 3 | href: string 4 | label: string 5 | } 6 | -------------------------------------------------------------------------------- /site/components/common/UserNav/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './UserNav' 2 | export { default as MenuSidebarView } from './MenuSidebarView' 3 | export { default as CustomerMenuContent } from './CustomerMenuContent' 4 | -------------------------------------------------------------------------------- /site/components/common/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Avatar } from './Avatar' 2 | export { default as FeatureBar } from './FeatureBar' 3 | export { default as Footer } from './Footer' 4 | export { default as Layout } from './Layout' 5 | export { default as Navbar } from './Navbar' 6 | export { default as Searchbar } from './Searchbar' 7 | export { default as UserNav } from './UserNav' 8 | export { default as Head } from './Head' 9 | export { default as I18nWidget } from './I18nWidget' 10 | export { default as SEO } from './SEO' 11 | -------------------------------------------------------------------------------- /site/components/icons/Check.tsx: -------------------------------------------------------------------------------- 1 | const Check = ({ ...props }) => { 2 | return ( 3 | 11 | 17 | 18 | ) 19 | } 20 | 21 | export default Check 22 | -------------------------------------------------------------------------------- /site/components/icons/ChevronDown.tsx: -------------------------------------------------------------------------------- 1 | const ChevronDown = ({ ...props }) => { 2 | return ( 3 | 15 | 16 | 17 | ) 18 | } 19 | 20 | export default ChevronDown 21 | -------------------------------------------------------------------------------- /site/components/icons/ChevronLeft.tsx: -------------------------------------------------------------------------------- 1 | const ChevronLeft = ({ ...props }) => { 2 | return ( 3 | 15 | 16 | 17 | ) 18 | } 19 | 20 | export default ChevronLeft 21 | -------------------------------------------------------------------------------- /site/components/icons/ChevronRight.tsx: -------------------------------------------------------------------------------- 1 | const ChevronRight = ({ ...props }) => { 2 | return ( 3 | 15 | 16 | 17 | ) 18 | } 19 | 20 | export default ChevronRight 21 | -------------------------------------------------------------------------------- /site/components/icons/ChevronUp.tsx: -------------------------------------------------------------------------------- 1 | const ChevronUp = ({ ...props }) => { 2 | return ( 3 | 15 | 16 | 17 | ) 18 | } 19 | 20 | export default ChevronUp 21 | -------------------------------------------------------------------------------- /site/components/icons/Cross.tsx: -------------------------------------------------------------------------------- 1 | const Cross = ({ ...props }) => { 2 | return ( 3 | 15 | 16 | 17 | 18 | ) 19 | } 20 | 21 | export default Cross 22 | -------------------------------------------------------------------------------- /site/components/icons/Menu.tsx: -------------------------------------------------------------------------------- 1 | const Menu = ({ ...props }) => { 2 | return ( 3 | 11 | 17 | 18 | ) 19 | } 20 | 21 | export default Menu 22 | -------------------------------------------------------------------------------- /site/components/icons/Minus.tsx: -------------------------------------------------------------------------------- 1 | const Minus = ({ ...props }) => { 2 | return ( 3 | 4 | 11 | 12 | ) 13 | } 14 | 15 | export default Minus 16 | -------------------------------------------------------------------------------- /site/components/icons/Moon.tsx: -------------------------------------------------------------------------------- 1 | const Moon = ({ ...props }) => { 2 | return ( 3 | 15 | 16 | 17 | ) 18 | } 19 | 20 | export default Moon 21 | -------------------------------------------------------------------------------- /site/components/icons/Star.tsx: -------------------------------------------------------------------------------- 1 | const Star = ({ ...props }) => { 2 | return ( 3 | 11 | 12 | 13 | ) 14 | } 15 | 16 | export default Star 17 | -------------------------------------------------------------------------------- /site/components/product/ProductCard/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ProductCard' 2 | -------------------------------------------------------------------------------- /site/components/product/ProductOptions/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ProductOptions' 2 | -------------------------------------------------------------------------------- /site/components/product/ProductSidebar/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ProductSidebar' 2 | -------------------------------------------------------------------------------- /site/components/product/ProductSlider/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ProductSlider' 2 | -------------------------------------------------------------------------------- /site/components/product/ProductSliderControl/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ProductSliderControl' 2 | -------------------------------------------------------------------------------- /site/components/product/ProductTag/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ProductTag' 2 | -------------------------------------------------------------------------------- /site/components/product/ProductView/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ProductView' 2 | -------------------------------------------------------------------------------- /site/components/product/Swatch/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Swatch' 2 | -------------------------------------------------------------------------------- /site/components/product/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Swatch } from './Swatch' 2 | export { default as ProductView } from './ProductView' 3 | export { default as ProductCard } from './ProductCard' 4 | export { default as ProductSlider } from './ProductSlider' 5 | export { default as ProductOptions } from './ProductOptions' 6 | -------------------------------------------------------------------------------- /site/components/ui/Button/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Button' 2 | export * from './Button' 3 | -------------------------------------------------------------------------------- /site/components/ui/Collapse/Collapse.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply border-b border-accent-2 py-4 flex flex-col outline-none; 3 | } 4 | 5 | .header { 6 | @apply flex flex-row items-center; 7 | } 8 | 9 | .header .label { 10 | @apply text-base font-medium; 11 | } 12 | 13 | .content { 14 | @apply pt-3 overflow-hidden pl-8; 15 | } 16 | 17 | .icon { 18 | @apply mr-3 text-accent-6; 19 | margin-left: -6px; 20 | transition: transform 0.2s ease; 21 | } 22 | 23 | .icon.open { 24 | transform: rotate(90deg); 25 | } 26 | -------------------------------------------------------------------------------- /site/components/ui/Collapse/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Collapse' 2 | export * from './Collapse' 3 | -------------------------------------------------------------------------------- /site/components/ui/Container/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Container' 2 | -------------------------------------------------------------------------------- /site/components/ui/Grid/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Grid' 2 | -------------------------------------------------------------------------------- /site/components/ui/Hero/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Hero' 2 | -------------------------------------------------------------------------------- /site/components/ui/Input/Input.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply bg-primary py-2 px-6 w-full appearance-none transition duration-150 ease-in-out pr-10 border border-accent-3 text-accent-6; 3 | } 4 | 5 | .root:focus { 6 | @apply outline-none shadow-outline-normal; 7 | } 8 | -------------------------------------------------------------------------------- /site/components/ui/Input/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Input' 2 | -------------------------------------------------------------------------------- /site/components/ui/Link/Link.tsx: -------------------------------------------------------------------------------- 1 | import NextLink, { LinkProps as NextLinkProps } from 'next/link' 2 | 3 | const Link: React.FC< 4 | NextLinkProps & { 5 | children?: React.ReactNode 6 | } 7 | > = ({ href, children, ...props }) => { 8 | return ( 9 | 10 | {children} 11 | 12 | ) 13 | } 14 | 15 | export default Link 16 | -------------------------------------------------------------------------------- /site/components/ui/Link/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Link' 2 | -------------------------------------------------------------------------------- /site/components/ui/LoadingDots/LoadingDots.tsx: -------------------------------------------------------------------------------- 1 | import s from './LoadingDots.module.css' 2 | 3 | const LoadingDots: React.FC = () => { 4 | return ( 5 | 6 | 7 | 8 | 9 | 10 | ) 11 | } 12 | 13 | export default LoadingDots 14 | -------------------------------------------------------------------------------- /site/components/ui/LoadingDots/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './LoadingDots' 2 | -------------------------------------------------------------------------------- /site/components/ui/Logo/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Logo' 2 | -------------------------------------------------------------------------------- /site/components/ui/Marquee/Marquee.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply w-full min-w-full relative flex flex-row items-center overflow-hidden py-0; 3 | max-height: 320px; 4 | } 5 | 6 | .root > div { 7 | max-height: 320px; 8 | padding: 0; 9 | margin: 0; 10 | } 11 | 12 | .root > div > * > *:nth-child(2) * { 13 | max-height: 100%; 14 | } 15 | 16 | .primary { 17 | @apply bg-accent-0; 18 | } 19 | 20 | .secondary { 21 | @apply bg-accent-9; 22 | } 23 | -------------------------------------------------------------------------------- /site/components/ui/Marquee/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Marquee' 2 | -------------------------------------------------------------------------------- /site/components/ui/Modal/Modal.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply fixed bg-black bg-opacity-40 flex items-center inset-0 z-50 justify-center; 3 | backdrop-filter: blur(0.8px); 4 | -webkit-backdrop-filter: blur(0.8px); 5 | } 6 | 7 | .modal { 8 | @apply bg-primary p-12 border border-accent-2 relative; 9 | } 10 | 11 | .modal:focus { 12 | @apply outline-none; 13 | } 14 | 15 | .close { 16 | @apply hover:text-accent-5 transition ease-in-out duration-150 focus:outline-none absolute right-0 top-0 m-6; 17 | } 18 | -------------------------------------------------------------------------------- /site/components/ui/Modal/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Modal' 2 | -------------------------------------------------------------------------------- /site/components/ui/Quantity/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Quantity' 2 | export * from './Quantity' 3 | -------------------------------------------------------------------------------- /site/components/ui/README.md: -------------------------------------------------------------------------------- 1 | # UI 2 | 3 | Building blocks to build a rich graphical interfaces. Components should be atomic and pure. Serve one purpose. 4 | -------------------------------------------------------------------------------- /site/components/ui/Rating/Rating.module.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/components/ui/Rating/Rating.module.css -------------------------------------------------------------------------------- /site/components/ui/Rating/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Rating' 2 | export * from './Rating' 3 | -------------------------------------------------------------------------------- /site/components/ui/Sidebar/Sidebar.module.css: -------------------------------------------------------------------------------- 1 | .root { 2 | @apply fixed inset-0 h-full z-50 box-border outline-none; 3 | } 4 | 5 | .sidebar { 6 | @apply h-full flex flex-col text-base bg-accent-0 shadow-xl overflow-y-auto overflow-x-hidden; 7 | -webkit-overflow-scrolling: touch !important; 8 | } 9 | 10 | .backdrop { 11 | @apply absolute inset-0 bg-black bg-opacity-40 duration-100 ease-linear; 12 | backdrop-filter: blur(0.8px); 13 | -webkit-backdrop-filter: blur(0.8px); 14 | } 15 | -------------------------------------------------------------------------------- /site/components/ui/Sidebar/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Sidebar' 2 | -------------------------------------------------------------------------------- /site/components/ui/Skeleton/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Skeleton' 2 | -------------------------------------------------------------------------------- /site/components/ui/Text/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Text' 2 | -------------------------------------------------------------------------------- /site/components/wishlist/WishlistButton/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './WishlistButton' 2 | -------------------------------------------------------------------------------- /site/components/wishlist/WishlistCard/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './WishlistCard' 2 | -------------------------------------------------------------------------------- /site/components/wishlist/index.ts: -------------------------------------------------------------------------------- 1 | export { default as WishlistCard } from './WishlistCard' 2 | export { default as WishlistButton } from './WishlistButton' 3 | -------------------------------------------------------------------------------- /site/global.d.ts: -------------------------------------------------------------------------------- 1 | // Declarations for modules without types 2 | declare module 'next-themes' 3 | -------------------------------------------------------------------------------- /site/lib/api/commerce.ts: -------------------------------------------------------------------------------- 1 | import { getCommerceApi } from '@framework/api' 2 | 3 | export default getCommerceApi() 4 | -------------------------------------------------------------------------------- /site/lib/click-outside/has-parent.js: -------------------------------------------------------------------------------- 1 | import isInDOM from './is-in-dom' 2 | 3 | export default function hasParent(element, root) { 4 | return root && root.contains(element) && isInDOM(element) 5 | } 6 | -------------------------------------------------------------------------------- /site/lib/click-outside/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './click-outside' 2 | -------------------------------------------------------------------------------- /site/lib/click-outside/is-in-dom.js: -------------------------------------------------------------------------------- 1 | export default function isInDom(obj) { 2 | return Boolean(obj.closest('body')) 3 | } 4 | -------------------------------------------------------------------------------- /site/lib/get-slug.ts: -------------------------------------------------------------------------------- 1 | // Remove trailing and leading slash, usually included in nodes 2 | // returned by the BigCommerce API 3 | const getSlug = (path: string) => path.replace(/^\/|\/$/g, '') 4 | 5 | export default getSlug 6 | -------------------------------------------------------------------------------- /site/lib/range-map.ts: -------------------------------------------------------------------------------- 1 | export default function rangeMap(n: number, fn: (i: number) => any) { 2 | const arr = [] 3 | while (n > arr.length) { 4 | arr.push(fn(arr.length)) 5 | } 6 | return arr 7 | } 8 | -------------------------------------------------------------------------------- /site/lib/to-pixels.ts: -------------------------------------------------------------------------------- 1 | // Convert numbers or strings to pixel value 2 | // Helpful for styled-jsx when using a prop 3 | // height: ${toPixels(height)}; (supports height={20} and height="20px") 4 | 5 | const toPixels = (value: string | number) => { 6 | if (typeof value === 'number') { 7 | return `${value}px` 8 | } 9 | 10 | return value 11 | } 12 | 13 | export default toPixels 14 | -------------------------------------------------------------------------------- /site/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /site/pages/_document.tsx: -------------------------------------------------------------------------------- 1 | import Document, { Head, Html, Main, NextScript } from 'next/document' 2 | 3 | class MyDocument extends Document { 4 | render() { 5 | return ( 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | ) 14 | } 15 | } 16 | 17 | export default MyDocument 18 | -------------------------------------------------------------------------------- /site/pages/api/cart.ts: -------------------------------------------------------------------------------- 1 | import cartApi from '@framework/api/endpoints/cart' 2 | import commerce from '@lib/api/commerce' 3 | 4 | export default cartApi(commerce) 5 | -------------------------------------------------------------------------------- /site/pages/api/catalog/products.ts: -------------------------------------------------------------------------------- 1 | import productsApi from '@framework/api/endpoints/catalog/products' 2 | import commerce from '@lib/api/commerce' 3 | 4 | export default productsApi(commerce) 5 | -------------------------------------------------------------------------------- /site/pages/api/checkout.ts: -------------------------------------------------------------------------------- 1 | import checkoutApi from '@framework/api/endpoints/checkout' 2 | import commerce from '@lib/api/commerce' 3 | 4 | export default checkoutApi(commerce) 5 | -------------------------------------------------------------------------------- /site/pages/api/customer/address.ts: -------------------------------------------------------------------------------- 1 | import customerAddressApi from '@framework/api/endpoints/customer/address' 2 | import commerce from '@lib/api/commerce' 3 | 4 | export default customerAddressApi(commerce) 5 | -------------------------------------------------------------------------------- /site/pages/api/customer/card.ts: -------------------------------------------------------------------------------- 1 | import customerCardApi from '@framework/api/endpoints/customer/card' 2 | import commerce from '@lib/api/commerce' 3 | 4 | export default customerCardApi(commerce) 5 | -------------------------------------------------------------------------------- /site/pages/api/customer/index.ts: -------------------------------------------------------------------------------- 1 | import customerApi from '@framework/api/endpoints/customer' 2 | import commerce from '@lib/api/commerce' 3 | 4 | export default customerApi(commerce) 5 | -------------------------------------------------------------------------------- /site/pages/api/login.ts: -------------------------------------------------------------------------------- 1 | import loginApi from '@framework/api/endpoints/login' 2 | import commerce from '@lib/api/commerce' 3 | 4 | export default loginApi(commerce) 5 | -------------------------------------------------------------------------------- /site/pages/api/logout.ts: -------------------------------------------------------------------------------- 1 | import logoutApi from '@framework/api/endpoints/logout' 2 | import commerce from '@lib/api/commerce' 3 | 4 | export default logoutApi(commerce) 5 | -------------------------------------------------------------------------------- /site/pages/api/signup.ts: -------------------------------------------------------------------------------- 1 | import singupApi from '@framework/api/endpoints/signup' 2 | import commerce from '@lib/api/commerce' 3 | 4 | export default singupApi(commerce) 5 | -------------------------------------------------------------------------------- /site/pages/api/wishlist.ts: -------------------------------------------------------------------------------- 1 | import wishlistApi from '@framework/api/endpoints/wishlist' 2 | import commerce from '@lib/api/commerce' 3 | 4 | export default wishlistApi(commerce) 5 | -------------------------------------------------------------------------------- /site/pages/search.tsx: -------------------------------------------------------------------------------- 1 | import { getSearchStaticProps } from '@lib/search-props' 2 | import type { GetStaticPropsContext } from 'next' 3 | import Search from '@components/search' 4 | 5 | export async function getStaticProps(context: GetStaticPropsContext) { 6 | return getSearchStaticProps(context) 7 | } 8 | 9 | export default Search 10 | -------------------------------------------------------------------------------- /site/pages/search/[category].tsx: -------------------------------------------------------------------------------- 1 | import { getSearchStaticProps } from '@lib/search-props' 2 | import type { GetStaticPathsResult, GetStaticPropsContext } from 'next' 3 | import Search from '@components/search' 4 | 5 | export async function getStaticProps(context: GetStaticPropsContext) { 6 | return getSearchStaticProps(context) 7 | } 8 | 9 | export function getStaticPaths(): GetStaticPathsResult { 10 | return { 11 | paths: [], 12 | fallback: 'blocking', 13 | } 14 | } 15 | 16 | export default Search 17 | -------------------------------------------------------------------------------- /site/pages/search/designers/[name].tsx: -------------------------------------------------------------------------------- 1 | import { getSearchStaticProps } from '@lib/search-props' 2 | import type { GetStaticPathsResult, GetStaticPropsContext } from 'next' 3 | import Search from '@components/search' 4 | 5 | export async function getStaticProps(context: GetStaticPropsContext) { 6 | return getSearchStaticProps(context) 7 | } 8 | 9 | export function getStaticPaths(): GetStaticPathsResult { 10 | return { 11 | paths: [], 12 | fallback: 'blocking', 13 | } 14 | } 15 | 16 | export default Search 17 | -------------------------------------------------------------------------------- /site/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | 'tailwindcss/nesting', 4 | 'tailwindcss', 5 | 'autoprefixer', 6 | 'postcss-flexbugs-fixes', 7 | [ 8 | 'postcss-preset-env', 9 | { 10 | autoprefixer: { 11 | flexbox: 'no-2009', 12 | }, 13 | stage: 3, 14 | features: { 15 | 'custom-properties': false, 16 | }, 17 | }, 18 | ], 19 | ], 20 | } 21 | -------------------------------------------------------------------------------- /site/public/assets/drop-shirt-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/drop-shirt-0.png -------------------------------------------------------------------------------- /site/public/assets/drop-shirt-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/drop-shirt-1.png -------------------------------------------------------------------------------- /site/public/assets/drop-shirt-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/drop-shirt-2.png -------------------------------------------------------------------------------- /site/public/assets/drop-shirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/drop-shirt.png -------------------------------------------------------------------------------- /site/public/assets/lightweight-jacket-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/lightweight-jacket-0.png -------------------------------------------------------------------------------- /site/public/assets/lightweight-jacket-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/lightweight-jacket-1.png -------------------------------------------------------------------------------- /site/public/assets/lightweight-jacket-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/lightweight-jacket-2.png -------------------------------------------------------------------------------- /site/public/assets/t-shirt-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/t-shirt-0.png -------------------------------------------------------------------------------- /site/public/assets/t-shirt-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/t-shirt-1.png -------------------------------------------------------------------------------- /site/public/assets/t-shirt-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/t-shirt-2.png -------------------------------------------------------------------------------- /site/public/assets/t-shirt-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/t-shirt-3.png -------------------------------------------------------------------------------- /site/public/assets/t-shirt-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/assets/t-shirt-4.png -------------------------------------------------------------------------------- /site/public/card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/card.png -------------------------------------------------------------------------------- /site/public/cursor-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/cursor-left.png -------------------------------------------------------------------------------- /site/public/cursor-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/cursor-right.png -------------------------------------------------------------------------------- /site/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/favicon.ico -------------------------------------------------------------------------------- /site/public/flag-es.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site/public/icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/icon-144x144.png -------------------------------------------------------------------------------- /site/public/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/icon-192x192.png -------------------------------------------------------------------------------- /site/public/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/icon-512x512.png -------------------------------------------------------------------------------- /site/public/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/icon.png -------------------------------------------------------------------------------- /site/public/slider-arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swellstores/nextjs-commerce/a5b367a747ab068ebac78fc97dd42f1ed31ce237/site/public/slider-arrows.png --------------------------------------------------------------------------------