diff --git a/.all-contributorsrc b/.all-contributorsrc index 944b65f28..8b7a1f4fa 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -75,7 +75,8 @@ "avatar_url": "https://avatars.githubusercontent.com/u/789614?v=4", "profile": "https://github.com/KevinGorjan", "contributions": [ - "code" + "code", + "doc" ] }, { @@ -84,7 +85,11 @@ "avatar_url": "https://avatars.githubusercontent.com/u/16045377?v=4", "profile": "https://github.com/bartoszherba", "contributions": [ - "code" + "code", + "doc", + "maintenance", + "mentoring", + "review" ] }, { @@ -94,7 +99,13 @@ "profile": "https://github.com/Frodigo", "contributions": [ "code", - "projectManagement" + "projectManagement", + "business", + "doc", + "ideas", + "maintenance", + "mentoring", + "review" ] }, { @@ -116,7 +127,8 @@ "contributions": [ "question", "mentoring", - "review" + "review", + "doc" ] }, { @@ -158,6 +170,42 @@ "contributions": [ "code" ] + }, + { + "login": "sethidden", + "name": "Artur Tagisow", + "avatar_url": "https://avatars.githubusercontent.com/u/5359825?v=4", + "profile": "https://github.com/sethidden", + "contributions": [ + "code" + ] + }, + { + "login": "jonathanribas", + "name": "Jonathan Ribas", + "avatar_url": "https://avatars.githubusercontent.com/u/3003782?v=4", + "profile": "https://github.com/jonathanribas", + "contributions": [ + "code" + ] + }, + { + "login": "Aliaaaam", + "name": "Ali Ghanei", + "avatar_url": "https://avatars.githubusercontent.com/u/88658555?v=4", + "profile": "https://github.com/Aliaaaam", + "contributions": [ + "code" + ] + }, + { + "login": "mayashavin", + "name": "Maya Shavin", + "avatar_url": "https://avatars.githubusercontent.com/u/6650139?v=4", + "profile": "https://github.com/mayashavin", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 5 diff --git a/docs/guide/about.md b/docs/guide/about.md index 44de0c09e..684a9f953 100644 --- a/docs/guide/about.md +++ b/docs/guide/about.md @@ -9,12 +9,12 @@ ## Support -If you have any questions about this integration we will be happy to answer them on `magento2-vsf2` channel on [our Discord](discord.vuestorefront.io). +If you have any questions about this integration we will be happy to answer them on `magento2` channel on [our Discord](discord.vuestorefront.io). ## Contributors ✨ ### Honorable Mentions - +- [Caravel x](https://www.caravelx.com/) - [Cyberfuze](https://cyberfuze.com/) - [Leonex](https://www.leonex.de/) @@ -33,18 +33,24 @@ Thanks go to these wonderful people πŸ™Œ:
Patrick Monteiro

πŸ’» -
Kevin Gorjan

πŸ’» -
Bartosz Herba

πŸ’» -
Marcin Kwiatkowski

πŸ’» πŸ“† +
Kevin Gorjan

πŸ’» πŸ“– +
Bartosz Herba

πŸ’» πŸ“– 🚧 πŸ§‘β€πŸ« πŸ‘€ +
Marcin Kwiatkowski

πŸ’» πŸ“† πŸ’Ό πŸ“– πŸ€” 🚧 πŸ§‘β€πŸ« πŸ‘€
Filip Rakowski

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ -
Filip Sobol

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ +
Filip Sobol

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ πŸ“–
Patryk Andrzejewski

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€
Renan Oliveira

πŸ”§ πŸ”Œ
Dominik Deimel

πŸ’» πŸ“–
Lior Lindvor

πŸ’» + +
Artur Tagisow

πŸ’» +
Jonathan Ribas

πŸ’» +
Ali Ghanei

πŸ’» +
Maya Shavin

πŸ“– + diff --git a/docs/guide/composables/use-addresses.md b/docs/guide/composables/use-addresses.md deleted file mode 100644 index 5f5662cc5..000000000 --- a/docs/guide/composables/use-addresses.md +++ /dev/null @@ -1,29 +0,0 @@ -# useAddresses - -`useAddresses`: - -## API -```typescript -export interface UseAddresses extends Composable { - error: ComputedProperty; - loading: ComputedProperty; - addresses: ComputedProperty; - load: (loadParams?: LOAD_ADDRESS_PARAMS) => Promise, - save: (saveParams: SAVE_ADDRESS_PARAMS) => Promise, - remove: (removeParams: REMOVE_ADDRESS_PARAMS) => Promise, - update: (updateParams: UPDATE_ADDRESS_PARAMS) => Promise, -} -``` - -* `` - - -## Example - -```javascript -``` diff --git a/docs/guide/composables/use-billing.md b/docs/guide/composables/use-billing.md deleted file mode 100644 index ccf376c73..000000000 --- a/docs/guide/composables/use-billing.md +++ /dev/null @@ -1,113 +0,0 @@ -# useBilling - -## Features -`useBilling` composable can be used to: -* fetch existing billing addresses, -* submit new billing addresses, -* modify and delete existing billing addresses. - -## API - -### `load` -Function that takes in `CustomQuery` as optional params and gets the `billing` accordingly - -### `billing` -Returns `billing` as a `computed` property -```typescript -// packages/composables/src/composables/useBilling/index.ts -export default useBillingFactory(factoryParams); - -// packages/api-client/src/types/GraphQL.ts -interface BillingCartAddress { - city: Scalars['String']; - company?: Maybe; - country: CartAddressCountry; - firstname: Scalars['String']; - lastname: Scalars['String']; - postcode?: Maybe; - region?: Maybe; - street: Array>; - telephone: Scalars['String']; -} -``` - -### `save` -Saves new address - -### `loading` -Returns the `loading` state of `search` - -### `error` -reactive object containing the error message, if search failed for any reason. - -## Getters -* `getAddresses` - returns list of billing addresses. -* `getDefault` - returns a default billing address. -* `getTotal` - returns total number of billing addresses user has. -* `getId` - returns id from an individual address. -* `getPostCode` - returns post code from an individual address. -* `getStreetName` - returns street name from an individual address. -* `getStreetNumber` - returns street number from an individual address. -* `getCity` - returns city name from an individual address. -* `getFirstName` - returns first name from an individual address. -* `getLastName` - returns last name from an individual address. -* `getCountry` - returns country name from an individual address. -* `getPhone` - return phone number from an individual address. -* `getEmail` - returns e-mail address from an individual address. -* `getProvince` - returns province (state) from an individual address. -* `getCompanyName` - returns company name from an individual address. -* `getTaxNumber` - returns tax number from an individual address. -* `getApartmentNumber` - returns apartment number from an individual address. -* `isDefault` - return information if address is current default. - -```typescript -interface UserBillingGetters { - getAddresses: (billing, criteria?: Record) => any[]; - getDefault: (billing) => any; - getTotal: (billing) => number; - getPostCode: (address) => string; - getStreetName: (address) => string; - getStreetNumber: (address) => string | number; - getCity: (address) => string; - getFirstName: (address) => string; - getLastName: (address) => string; - getCountry: (address) => string; - getPhone: (address) => string; - getEmail: (address) => string; - getProvince: (address) => string; - getCompanyName: (address) => string; - getTaxNumber: (address) => string; - getId: (address) => string; - getApartmentNumber: (address) => string | number; - isDefault: (address) => boolean; -} -``` - -## Example - -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useBilling, userBillingGetters } from '@vue-storefront/magento'; - -export default { - setup() { - const { - billing, - load, - addAddress, - deleteAddress, - updateAddress - } = useBilling(); - - // If you're using Nuxt or any other framework for Universal Vue apps - onSSR(async () => { - await load(); - }); - - return { - billing: computed(() => userBillingGetters.getAddresses(billing.value)), - userBillingGetters - }; - } -}; -``` diff --git a/docs/guide/composables/use-cart.md b/docs/guide/composables/use-cart.md deleted file mode 100644 index df12e35b3..000000000 --- a/docs/guide/composables/use-cart.md +++ /dev/null @@ -1,186 +0,0 @@ -# useCart - -## Features -`useCart` composable can be used to: -* load cart information, -* add, update and remove items in the cart, -* applying and removing coupons, -* checking if product is already added to the cart. - -## API -```typescript -interface UseCart { - cart: ComputedProperty; - setCart(cart: Cart): void; - addItem(params: { - product: Product; - quantity: number; - customQuery?: CustomQuery; - }): Promise; - isInCart: ({ product: Product }: { - product: any; - }) => boolean; - removeItem(params: { - product: CartItem; - customQuery?: CustomQuery; - }): Promise; - updateItemQty(params: { - product: CartItem; - quantity?: number; - customQuery?: CustomQuery; - }): Promise; - clear(): Promise; - applyCoupon(params: { - couponCode: string; - customQuery?: CustomQuery; - }): Promise; - removeCoupon(params: { - coupon: Coupon; - customQuery?: CustomQuery; - }): Promise; - load(): Promise; - load(params: { - customQuery?: CustomQuery; - }): Promise; - error: ComputedProperty; - loading: ComputedProperty; -} - -export interface Cart { - /** - * An array of coupons that have been applied to the cart - * @deprecated Use applied_coupons instead - */ - applied_coupon?: Maybe; - /** An array of `AppliedCoupon` objects. Each object contains the `code` text attribute, which specifies the coupon code */ - applied_coupons?: Maybe>>; - /** Available payment methods */ - available_payment_methods?: Maybe>>; - billing_address?: Maybe; - email?: Maybe; - /** The entered gift message for the cart */ - gift_message?: Maybe; - /** The unique ID for a `Cart` object */ - id: Scalars['ID']; - is_virtual: Scalars['Boolean']; - items?: Maybe>>; - prices?: Maybe; - selected_payment_method?: Maybe; - shipping_addresses: Array>; - total_quantity: Scalars['Float']; -} - -export interface CartItem { - prices?: Maybe; - product: ProductInterface; - quantity: Scalars['Float']; - /** The unique ID for a `CartItemInterface` object */ - uid: Scalars['ID']; -} - -export interface Coupon { - code: Scalars['String']; -} - -``` -> For more information on [Product interface](use-product) visit the dedicated documentation. - - -### `cart` -Returns the Items in the Cart as a `computed` property - -### `setCart` -set new Cart - -### `addItem` -Function that takes in a `product` and its `quantity` and adds it to the cart - -### `isInCart` -Function that takes in a `product` and returns `true` or `false` - -### `removeItem` -Function that takes in a `product` and removes it from the `cart` - -### `updateItemQty` -Function that takes in a `product` and its new `quantaty` and updates it accordingly - -### `clear` -Function that clears cart - -### `applyCoupon` -Function that takes in a `coupon` and applies it to the cart - -### `removeCoupon` -Function that removes all applied coupons - -### `load` -Function that loads the current `cart` - -### `error` -reactive object containing the error message, if some properties failed for any reason. - -### `loading` -a reactive object containing information about loading state of the cart. - - -## Getters - -````typescript -interface CartGetters { - getItems: (cart: Cart) => CartItem[]; - getItemName: (cartItem: CartItem) => string; - getItemImage: (cartItem: CartItem) => string; - getItemPrice: (cartItem: CartItem) => AgnosticPrice; - getItemQty: (cartItem: CartItem) => number; - getItemAttributes: ( - cartItem: CartItem, - _filterByAttributeName?: Array, - ) => Record; - getItemSku: (cartItem: CartItem) => string; - getTotals: (cart: Cart) => AgnosticTotals; - getShippingPrice: (cart: Cart) => number; - getTotalItems: (cart: Cart) => number; - getFormattedPrice: (price: number) => string; - getCoupons: (cart: Cart) => AgnosticCoupon[]; - getDiscounts: (cart: Cart) => AgnosticDiscount[]; -} -```` - -* `getItems` - returns all items from cart. -* `getItemName` - returns product name. -* `getItemImage` - returns product image. -* `getItemPrice` - returns product price. -* `getItemQty` - returns product quantity. -* `getItemAttributes` - returns product attribute. -* `getItemSku` - returns product SKU. -* `getTotals` - returns cart totals. -* `getShippingPrice` - returns current shipping price. -* `getTotalItems` - returns products amount. -* `getFormattedPrice` - returns product price with currency sign. -* `getCoupons` - returns applied coupons. -* `getDiscounts` - returns all discounts. - -## Example - -```javascript -import { useCart, cartGetters } from '@vue-storefront/magento'; -import { onSSR } from '@vue-storefront/core' - -export default { - setup () { - const { cart, removeItem, updateItemQty, load } = useCart(); - - onSSR(async () => { - await load(); - }) - - return { - removeItem, - updateItemQty, - products: computed(() => cartGetters.getItems(cart.value)), - totals: computed(() => cartGetters.getTotals(cart.value)), - totalItems: computed(() => cartGetters.getTotalItems(cart.value)) - } - } -} -``` diff --git a/docs/guide/composables/use-category-search.md b/docs/guide/composables/use-category-search.md deleted file mode 100644 index 6808916d3..000000000 --- a/docs/guide/composables/use-category-search.md +++ /dev/null @@ -1,63 +0,0 @@ -# useCategorySearch - -## Features -`useCategorySearch` composable is responsible for fetching a list of categories based on search term provided. A common usage scenario for this composable is navigation subtrees. - -## API -The `useCategorySearch` composable implements custom factory `useCategorySearchFactory` located in `packages/composables/src/factories/useCategorySearchFactory.ts` and returns `UseCategorySearch` interface: - -```typescript -export interface UseCategorySearch { - search: (params: { term: string }) => Promise; - result: ComputedProperty; - error: ComputedProperty; - loading: ComputedProperty; -} - -export interface UseCategorySearchErrors { - search: Error; -} -``` -> For more information on [Category interface](use-category) visit the dedicated documentation. - -### `search` -Function that takes `term` as search param and gets the `categories` accordingly - -### `result` -Returns an array of categories fetched by `search` method as a `computed` property. -See [useCategory](use-category.html) for more information on `categories` interface - -### `loading` -Returns the current state of `search` as `computed` boolean property - -### `error` -Reactive object containing the error message, if search failed for any reason. - -## Example -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useCategorySearch } from '@vue-storefront/magento'; - -export default { - setup () { - const { - loading, - error, - result: categories, - search: categoriesSearch, - } = useCategorySearch('AppHeader:Categories'); - - onSSR(async () => { - await categoriesSearch({ - term: 'value', - }); - }); - - return { - categories, - loading, - error, - } - } -} -``` diff --git a/docs/guide/composables/use-category.md b/docs/guide/composables/use-category.md deleted file mode 100644 index 51c7a603e..000000000 --- a/docs/guide/composables/use-category.md +++ /dev/null @@ -1,142 +0,0 @@ -# useCategory - -## Features -`useCategory` composable is responsible for fetching a list of categories. A common usage scenario for this composable is navigation. - -## API -```typescript -interface UseCategory { - categories: ComputedProperty; - search(params: ComposableFunctionArgs): Promise; - loading: ComputedProperty; - error: ComputedProperty; -} - -export type CategoryListQueryVariables = Exact<{ [key: string]: never; }>; - -export interface Category { - available_sort_by?: Maybe>>; - /** Breadcrumbs, parent categories info. */ - breadcrumbs?: Maybe>>; - /** Relative canonical URL. This value is returned only if the system setting 'Use Canonical Link Meta Tag For Categories' is enabled */ - canonical_url?: Maybe; - /** Child categories tree. */ - children?: Maybe>>; - children_count?: Maybe; - /** Category CMS Block. */ - cms_block?: Maybe; - /** - * Timestamp indicating when the category was created. - * @deprecated The field should not be used on the storefront. - */ - created_at?: Maybe; - custom_layout_update_file?: Maybe; - /** The attribute to use for sorting. */ - default_sort_by?: Maybe; - /** An optional description of the category. */ - description?: Maybe; - display_mode?: Maybe; - filter_price_range?: Maybe; - /** - * An ID that uniquely identifies the category. - * @deprecated Use the `uid` argument instead. - */ - id?: Maybe; - image?: Maybe; - include_in_menu?: Maybe; - is_anchor?: Maybe; - landing_page?: Maybe; - /** Indicates the depth of the category within the tree. */ - level?: Maybe; - meta_description?: Maybe; - meta_keywords?: Maybe; - meta_title?: Maybe; - /** The display name of the category. */ - name?: Maybe; - /** Category Path. */ - path?: Maybe; - /** Category path in store. */ - path_in_store?: Maybe; - /** The position of the category relative to other categories at the same level in tree. */ - position?: Maybe; - /** The number of products in the category that are marked as visible. By default, in complex products, parent products are visible, but their child products are not. */ - product_count?: Maybe; - /** The list of products assigned to the category. */ - products?: Maybe; - /** The unique ID for a `CategoryInterface` object. */ - uid: Scalars['ID']; - /** - * Timestamp indicating when the category was updated. - * @deprecated The field should not be used on the storefront. - */ - updated_at?: Maybe; - /** The url key assigned to the category. */ - url_key?: Maybe; - /** The url path assigned to the category. */ - url_path?: Maybe; - /** The part of the category URL that is appended after the url key */ - url_suffix?: Maybe; -} -``` - -### `search` -Function that takes `CategoryListQueryVariables`as optional param and gets the `categories` accordingly - -### `categories` -Returns an array of categories fetched by `search` method as a `computed` property. - -### `loading` -Returns the current state of `search` as `computed` boolean property - -### `error` -Reactive object containing the error message, if search failed for any reason. - -## Getters -````typescript -interface CategoryGetters { - getTree: (category: Category) => AgnosticCategoryTree | null; - getBreadcrumbs: (category: Category) => AgnosticBreadcrumb[]; - getCategoryTree?: ( - category: Category, - currentCategory: string, - withProducts: boolean, - ) => AgnosticCategoryTree | null; -} - -export interface AgnosticBreadcrumb { - text: string; - link: string; -} - -export interface AgnosticCategoryTree { - label: string; - slug?: string; - items: AgnosticCategoryTree[]; - isCurrent: boolean; - count?: number; - [x: string]: unknown; -} -```` -## Example - -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useCategory } from '@vue-storefront/magento'; - -export default { - setup () { - const { categories, search, loading } = useCategory('AppHeader:Categories'); - - onSSR(async () => { - await search({ - pageSize: 100, - }); - }); - - return { - categories, - loading - } - } -} -``` diff --git a/docs/guide/composables/use-config.md b/docs/guide/composables/use-config.md deleted file mode 100644 index c48f7288e..000000000 --- a/docs/guide/composables/use-config.md +++ /dev/null @@ -1,209 +0,0 @@ -# useConfig - -## Features -`useConfig` composable is responsible, as its name suggests, for interactions with the configuration in your eCommerce. - -## API -The `useConfig` composable implements custom factory `useConfigFactory` located in `packages/composables/src/factories/useConfigFactory.ts` and returns `UseConfig` interface: -```typescript -interface UseConfig { - config: ComputedRef; - loadConfig: () => Promise; - loading: ComputedRef; -} - -export interface StoreConfig { - /** Footer Miscellaneous HTML */ - absolute_footer?: Maybe; - /** Indicates whether guest users can write product reviews. Possible values: 1 (Yes) and 0 (No) */ - allow_guests_to_write_product_reviews?: Maybe; - /** The value of the Allow Gift Messages for Order Items option */ - allow_items?: Maybe; - /** The value of the Allow Gift Messages on Order Level option */ - allow_order?: Maybe; - /** Enable autocomplete on login and forgot password forms */ - autocomplete_on_storefront?: Maybe; - /** Base currency code */ - base_currency_code?: Maybe; - /** Base link URL for the store */ - base_link_url?: Maybe; - /** Base media URL for the store */ - base_media_url?: Maybe; - /** Base static URL for the store */ - base_static_url?: Maybe; - /** Base URL for the store */ - base_url?: Maybe; - /** Braintree cc vault status. */ - braintree_cc_vault_active?: Maybe; - /** Default Sort By. */ - catalog_default_sort_by?: Maybe; - /** Corresponds to the 'Display Prices In Product Lists' field. It indicates how FPT information is displayed on category pages */ - category_fixed_product_tax_display_setting?: Maybe; - /** Category URL Suffix. */ - category_url_suffix?: Maybe; - /** CMS Home Page */ - cms_home_page?: Maybe; - /** CMS No Cookies Page */ - cms_no_cookies?: Maybe; - /** CMS No Route Page */ - cms_no_route?: Maybe; - /** - * A code assigned to the store to identify it - * @deprecated Use `store_code` instead. - */ - code?: Maybe; - /** The configuration setting determines which thumbnail should be used in the cart for configurable products. */ - configurable_thumbnail_source?: Maybe; - /** Copyright */ - copyright?: Maybe; - /** Default Meta Description */ - default_description?: Maybe; - /** Default display currency code */ - default_display_currency_code?: Maybe; - /** Default Meta Keywords */ - default_keywords?: Maybe; - /** Default Page Title */ - default_title?: Maybe; - /** Display Demo Store Notice */ - demonotice?: Maybe; - /** Default Web URL */ - front?: Maybe; - /** Products per Page on Grid Default Value. */ - grid_per_page?: Maybe; - /** Products per Page on Grid Allowed Values. */ - grid_per_page_values?: Maybe; - /** Scripts and Style Sheets */ - head_includes?: Maybe; - /** Favicon Icon */ - head_shortcut_icon?: Maybe; - /** Logo Image */ - header_logo_src?: Maybe; - /** - * The ID number assigned to the store - * @deprecated Use `store_code` instead. - */ - id?: Maybe; - /** Indicates whether the store view has been designated as the default within the store group */ - is_default_store?: Maybe; - /** Indicates whether the store group has been designated as the default within the website */ - is_default_store_group?: Maybe; - /** List Mode. */ - list_mode?: Maybe; - /** Products per Page on List Default Value. */ - list_per_page?: Maybe; - /** Products per Page on List Allowed Values. */ - list_per_page_values?: Maybe; - /** Store locale */ - locale?: Maybe; - /** Logo Image Alt */ - logo_alt?: Maybe; - /** Logo Attribute Height */ - logo_height?: Maybe; - /** Logo Attribute Width */ - logo_width?: Maybe; - /** Indicates whether wishlists are enabled (1) or disabled (0) */ - magento_wishlist_general_is_enabled?: Maybe; - /** The minimum number of characters required for a valid password. */ - minimum_password_length?: Maybe; - /** Default No-route URL */ - no_route?: Maybe; - /** Payflow Pro vault status. */ - payment_payflowpro_cc_vault_active?: Maybe; - /** Corresponds to the 'Display Prices On Product View Page' field. It indicates how FPT information is displayed on product pages */ - product_fixed_product_tax_display_setting?: Maybe; - /** Indicates whether product reviews are enabled. Possible values: 1 (Yes) and 0 (No) */ - product_reviews_enabled?: Maybe; - /** Product URL Suffix. */ - product_url_suffix?: Maybe; - /** The number of different character classes required in a password (lowercase, uppercase, digits, special characters). */ - required_character_classes_number?: Maybe; - /** - * The ID of the root category - * @deprecated Use `root_category_uid` instead - */ - root_category_id?: Maybe; - /** The unique ID for a `CategoryInterface` object. */ - root_category_uid?: Maybe; - /** Corresponds to the 'Display Prices In Sales Modules' field. It indicates how FPT information is displayed on cart, checkout, and order pages */ - sales_fixed_product_tax_display_setting?: Maybe; - /** Secure base link URL for the store */ - secure_base_link_url?: Maybe; - /** Secure base media URL for the store */ - secure_base_media_url?: Maybe; - /** Secure base static URL for the store */ - secure_base_static_url?: Maybe; - /** Secure base URL for the store */ - secure_base_url?: Maybe; - /** Email to a Friend configuration. */ - send_friend?: Maybe; - /** Show Breadcrumbs for CMS Pages */ - show_cms_breadcrumbs?: Maybe; - /** The unique ID of the store view. In the Admin, this is called the Store View Code. When making a GraphQL call, assign this value to the `Store` header to provide the scope */ - store_code?: Maybe; - /** The unique ID assigned to the store group. In the Admin, this is called the Store Name */ - store_group_code?: Maybe; - /** The label assigned to the store group */ - store_group_name?: Maybe; - /** The label assigned to the store view */ - store_name?: Maybe; - /** The store view sort order */ - store_sort_order?: Maybe; - /** Timezone of the store */ - timezone?: Maybe; - /** Page Title Prefix */ - title_prefix?: Maybe; - /** Page Title Separator. */ - title_separator?: Maybe; - /** Page Title Suffix */ - title_suffix?: Maybe; - /** The configuration determines if the store code should be used in the URL */ - use_store_in_url?: Maybe; - /** The unique ID for the website */ - website_code?: Maybe; - /** - * The ID number assigned to the website store - * @deprecated The field should not be used on the storefront - */ - website_id?: Maybe; - /** The label assigned to the website */ - website_name?: Maybe; - /** The unit of weight */ - weight_unit?: Maybe; - /** Welcome Text */ - welcome?: Maybe; -} -``` - -### `config` -Returns the loaded `config` as `computed` property - -### `loadConfig` -Function to load the `config` - -### `loading` -Return state of `loadConfig` Function as `computed` property - -## Example -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useConfig } from '@vue-storefront/magento'; - -export default { - setup() { - const { - config, - loadConfig, - loading - } = useConfig(); - - onSSR(async () => { - await loadConfig(); - }) - - return { - config, - loading - }; - } -}; -``` diff --git a/docs/guide/composables/use-country-search.md b/docs/guide/composables/use-country-search.md deleted file mode 100644 index e5e78f711..000000000 --- a/docs/guide/composables/use-country-search.md +++ /dev/null @@ -1,77 +0,0 @@ -# useCountrySearch - -## Features -`useCountrySearch` composable is responsible for fetching a list of categories. A common usage scenario for this composable is navigation. - -## API -The `useCountrySearch` composable implements custom factory `useCountrySearchFactory` located in `packages/composables/src/composables/useCountrySearch/index.ts` and returns `UseCountrySearch` interface: -```typescript -export interface UseCountrySearch { - load: () => Promise; - search: (params: { id: string }) => Promise; - countries: ComputedProperty; - country: ComputedProperty; - error: ComputedProperty; - loading: ComputedProperty; -} - -export type Countries = CountriesListQuery['countries'][0]; - -export interface Country { - available_regions?: Maybe>>; - full_name_english?: Maybe; - full_name_locale?: Maybe; - /** The unique ID for a `Country` object. */ - id?: Maybe; - three_letter_abbreviation?: Maybe; - two_letter_abbreviation?: Maybe; -} -``` - -### `load` -Function that takes no params and gets the `Countries` array accordingly - -### `search` -Function that takes `id`as search param and gets the `Country` accordingly - -### `countries` -Returns an array of countries fetched by `load` method as a `computed` property. - -### `country` -Returns a single `Country` object fetched by `search` method as a `computed` property. - -### `loading` -Returns the current state of `search` as `computed` boolean property - -### `error` -Reactive object containing the error message, if search failed for any reason. - -## Example - -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useCountrySearch } from '@vue-storefront/magento'; - -export default { - setup (props) { - const { - load: loadCountries, - countries, - search: searchCountry, - country, - } = useCountrySearch('Step:Billing'); - - onSSR(async () => { - await searchCountry({ - id: props.identifier, - }); - }); - - return { - loadCountries, - countries, - country, - } - } -} -``` diff --git a/docs/guide/composables/use-custom-mutation.md b/docs/guide/composables/use-custom-mutation.md deleted file mode 100644 index 1c983d1b3..000000000 --- a/docs/guide/composables/use-custom-mutation.md +++ /dev/null @@ -1,84 +0,0 @@ -# useCustomMutation - -## Features -`useCustomMutation` composition function can be used to execute custom Mutation on the Magento GraphQL API. - -What makes it powerful is the ability to accept any GraphQL mutation, and execute it. - -## API -```typescript -export interface UseCustomMutation extends Composable { - setMutationString: (newMutationString: string) => void; - mutationString: ComputedProperty; - mutation: ({ variables, fetchPolicy }: { - variables: MUTATION_VARIABLES, - fetchPolicy?: FetchPolicy, - }) => Promise; - result: ComputedProperty; - loading: ComputedProperty; - error: ComputedProperty; - [x: string]: any; -} -``` - -### `setMutationString` -Function to define the mutation to be executed on the GraphQL Mutation - -### `mutationString` -`sharedRef` of the GraphQL mutation string - -### `query` -Actual query function to mutate the data under the Magento GraphQL API. - -### `result` -Reactive object containing the result information from mutation method. - -### `loading` -Reactive object containing the loading state of the query function. - -### `error` -Reactive object containing the error message, if mutation failed for any reason. - -## Example -`customMutationExample.ts` - -```typescript -import { useCustomMutation } from '@vue-storefront/magento'; - -export const customMutation = (id?: string) => { - const { - error, - loading, - mutation, - result, - setMutationString, - } = useCustomMutation(id); - - setMutationString(` - mutation subscribeEmailToNewsletter($email: String!){ - subscribeEmailToNewsletter(email: $email) { - status - } - }`); - - return { - error, - loading, - mutation, - result, - }; -}; -``` - -`Any File` -```typescript -import { customQuery } from '~/composables/customMutationExample.ts'; - -const { mutation } = customQuery(id); - -await mutation({ - variables: { - email: `${newEmail}`, - }, -}); -``` diff --git a/docs/guide/composables/use-custom-query.md b/docs/guide/composables/use-custom-query.md deleted file mode 100644 index dda849fd1..000000000 --- a/docs/guide/composables/use-custom-query.md +++ /dev/null @@ -1,87 +0,0 @@ -# useCustomQuery - -## Features -`useCustomQuery` composition function can be used to execute custom Queries on the Magento GraphQL API. - -What makes it powerful is the ability to accept any GraphQL query, and execute it. - -## API -```typescript -export interface UseCustomQuery extends Composable { - setQueryString: (newQueryString: string) => void; - queryString: ComputedProperty; - query: ({ variables, fetchPolicy, }: { - variables: QUERY_VARIABLES, - fetchPolicy?: FetchPolicy, - }) => Promise; - result: ComputedProperty; - loading: ComputedProperty; - error: ComputedProperty; -} -``` - -### `setQueryString` -Function to define the query to be executed on the GraphQL Query - -### `queryString` -`sharedRef` of the GraphQL query string - -### `query` -Actual query function to fetch the data under the Magento GraphQL API. - -### `result` -Reactive object containing the result information from query method. - -### `loading` -Reactive object containing the loading state of the query function. - -### `error` -Reactive object containing the error message, if query failed for any reason. - -## Example -`customQueryExample.ts` - -```typescript -import { useCustomQuery } from '@vue-storefront/magento'; - -export const customQuery = (id?: string) => { - const { - error, - loading, - query, - result, - setQueryString, - } = useCustomQuery(id); - - setQueryString(` - query urlResolver($url: String!) { - urlResolver(url:$url) { - id, - redirectCode, - relative_url, - type - entity_uid - } - }`); - - return { - error, - loading, - query, - result, - }; -}; -``` - -`Any File` -```typescript -import { customQuery } from '~/composables/customQueryExample.ts'; - -const { query } = customQuery(path); - -await query({ - variables: { - url: path.replace(/\/[cp|]\//gi, ''), - }, -}); -``` diff --git a/docs/guide/composables/use-external-checkout.md b/docs/guide/composables/use-external-checkout.md deleted file mode 100644 index b4b31bd1d..000000000 --- a/docs/guide/composables/use-external-checkout.md +++ /dev/null @@ -1,47 +0,0 @@ -# useExternalCheckout - -## Features -`useExternalCheckout` composable is responsible for redirecting checkout process and depends on [Magento 2 External Checkout for Vue Storefront](https://github.com/Vendic/magento2-external-checkout) repository. - -## API -The `useExternalCheckout` composable implements custom factory `useExternalCheckoutFactory` located in `packages/composables/src/factories/useExternalCheckoutFactory.ts` and returns `UseExternalCheckout` interface: -```typescript -export interface UseExternalCheckout { - initializeCheckout: (baseUrl: string) => Promise; - error: ComputedProperty; - loading: ComputedProperty; -} - -export interface UseExternalCheckoutErrors { - initializeCheckout: Error; -} -``` -### `initializeCheckout` -Function that takes `baseUrl`as search param. - -### `loading` -Returns the current state of `search` as `computed` boolean property - -### `error` -Reactive object containing the error message, if search failed for any reason. - -## Example - -```javascript -import { useExternalCheckout } from '@vue-storefront/magento'; - -export default { - setup (props) { - const { initializeCheckout } = useExternalCheckout(); - - const goToCheckout = async () => { - const redirectUrl = await initializeCheckout('/checkout/user-account'); - await router.push(redirectUrl); - }; - - return { - goToCheckout, - } - } -} -``` diff --git a/docs/guide/composables/use-facet.md b/docs/guide/composables/use-facet.md deleted file mode 100644 index 1ff36d2dc..000000000 --- a/docs/guide/composables/use-facet.md +++ /dev/null @@ -1,102 +0,0 @@ -# useFacet - -## Features -`useFacet` composition function can be used to fetch data related to: -* products, -* categories, -* breadcrumbs. - -What makes it powerful is the ability to accept multiple filters, allowing to narrow down the results to a specific category, search term, etc. - -## API -```typescript -interface UseFacet { - result: ComputedProperty>; - loading: ComputedProperty; - search: (params?: AgnosticFacetSearchParams) => Promise; - error: ComputedProperty; -} -``` - -### `search` -Function for searching and classifying records, allowing users to browse the catalog data. It accepts a single object as a parameter -```typescript -interface AgnosticFacetSearchParams { - categorySlug?: string; - rootCatSlug?: string; - term?: string; - page?: number; - itemsPerPage?: number; - sort?: string; - filters?: Record; - metadata?: any; - [x: string]: any; -} -``` - -### `result` -Reactive data object containing the response from the backend. - -### `loading` -Reactive object containing information about the loading state of search. - -### `error` -Reactive object containing the error message, if search failed for any reason. - - -## Getters -````typescript -interface FacetsGetters { - getAll: (searchData: FacetSearchResult, criteria?: CRITERIA) => AgnosticFacet[]; - getGrouped: (searchData: FacetSearchResult, criteria?: CRITERIA) => AgnosticGroupedFacet[]; - getCategoryTree: (searchData: FacetSearchResult) => AgnosticCategoryTree; - getSortOptions: (searchData: FacetSearchResult) => AgnosticSort; - getProducts: (searchData: FacetSearchResult) => RESULTS; - getPagination: (searchData: FacetSearchResult) => AgnosticPagination; - getBreadcrumbs: (searchData: FacetSearchResult) => AgnosticBreadcrumb[]; -} -```` - -* `getAll` - returns all available facets. -* `getGrouped` - returns grouped facets by facet name. -* `getCategoryTree` - return the tree of nested categories. -* `getSortOptions` - returns available and currently selected sorting options. -* `getProducts` - returns products matching current filters. -* `getPagination` - returns pagination information. -* `getBreadcrumbs` - returns breadcrumbs information. - -## Example -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useFacet, facetGetters } from '@vue-storefront/magento'; - -export default { - setup (props, context) { - const { result, search, loading } = useFacet(`facetId:${path}`); - - const products = computed(() => facetGetters.getProducts(result.value)); - const breadcrumbs = computed(() => facetGetters.getBreadcrumbs(result.value)); - const sortBy = computed(() => facetGetters.getSortOptions(result.value)); - const facets = computed(() => facetGetters.getGrouped(result.value)); - const pagination = computed(() => facetGetters.getPagination(result.value)); - - onSSR(async () => { - await search({ - categorySlug: 'clothing', - sort: 'latest', - itemsPerPage: 10, - term: 'some search query' - }); - }); - - return { - produproducts, - breadcrumbs, - sortBy, - facets, - pagination, - loading, - }; - } -} -``` diff --git a/docs/guide/composables/use-forgot-password.md b/docs/guide/composables/use-forgot-password.md deleted file mode 100644 index c356323f1..000000000 --- a/docs/guide/composables/use-forgot-password.md +++ /dev/null @@ -1,27 +0,0 @@ -# useForgotPassword - -`useForgotPassword` - -## API -```typescript -export interface UseForgotPassword { - result: ComputedProperty; - loading: ComputedProperty; - error: ComputedProperty; - setNew(params: ComposableFunctionArgs<{ - tokenValue: string, - newPassword: string, - email: string, - }>): Promise; - request(params: ComposableFunctionArgs<{ - email: string - }>): Promise; -} -``` - -* `` - - -## Example - -```javascript -``` diff --git a/docs/guide/composables/use-get-shipping-methods.md b/docs/guide/composables/use-get-shipping-methods.md deleted file mode 100644 index 5bcb6515a..000000000 --- a/docs/guide/composables/use-get-shipping-methods.md +++ /dev/null @@ -1,90 +0,0 @@ -# useGetShippingMethods - -## Features -`useGetShippingMethods` composable is responsible for fetching a Shipping Method - -## API -The `useGetShippingMethods` composable implements custom factory `useGetShippingMethodsFactory` located in `packages/composables/src/factories/useGetShippingMethodsFactory.ts` and returns `UseGetShippingMethods` interface: -```typescript -export interface UseGetShippingMethods { - state: ComputedProperty; - setState(state: ShippingMethod[]): void; - load: (params: { cartId: string }) => Promise; - result: ComputedProperty; - error: ComputedProperty; - loading: ComputedProperty; -} - -export type ShippingMethod = AvailableShippingMethod; - -export interface AvailableShippingMethod { - amount: Money; - available: Scalars['Boolean']; - /** @deprecated The field should not be used on the storefront */ - base_amount?: Maybe; - carrier_code: Scalars['String']; - carrier_title: Scalars['String']; - error_message?: Maybe; - /** Could be null if method is not available */ - method_code?: Maybe; - /** Could be null if method is not available */ - method_title?: Maybe; - price_excl_tax: Money; - price_incl_tax: Money; -} - -export interface Money { - /** A three-letter currency code, such as USD or EUR */ - currency?: Maybe; - /** A number expressing a monetary value */ - value?: Maybe; -} -``` -### `state` -Get all `ShippingMethods` as array. - -### `setState` -Set one or more `ShippingMethods` state. - -### `load` -Function that takes `cartId` as param and gets the `result` array accordingly - -### `result` -Returns a list of `ShippingMethods` fetched by `load` method as a `computed` property. - -### `loading` -Returns the current state of `search` as `computed` boolean property - -### `error` -Reactive object containing the error message, if search failed for any reason. - -## Example - -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useGetShippingMethods } from '@vue-storefront/magento'; - -export default { - setup (props) { - const { - load, - result: shippingMethods, - loading: loadingShippingMethods, - error: errorUseGetShippingMethods, - } = useGetShippingMethods('VsfShippingProvider'); - - - onSSR(async () => { - await load({ - cartId: props.identifier, - }); - }); - - return { - shippingMethods, - loadingShippingMethods, - errorUseGetShippingMethods, - } - } -} -``` diff --git a/docs/guide/composables/use-guest-user.md b/docs/guide/composables/use-guest-user.md deleted file mode 100644 index 26a1e4e14..000000000 --- a/docs/guide/composables/use-guest-user.md +++ /dev/null @@ -1,69 +0,0 @@ -# useGuestUser - -## Features -`useGuestUser` composable is responsible for fetching a Shipping Method - -## API -The `useGuestUser` composable implements custom factory `useGuestUserFactory` located in `packages/composables/src/factories/useGuestUserFactory.ts` and returns `UseGuestUser` interface: -```typescript -export interface UseGuestUser { - guestUser: ComputedProperty; - setGuestUser: (user: any) => void; - attachToCart: (params: { user: UseGuestUserRegisterParams }) => Promise; - loading: ComputedProperty; - error: ComputedProperty; -} - -export interface UseGuestUserRegisterParams { - email: string; - password: string; - firstName?: string; - lastName?: string; - [x: string]: any; -} - -export interface UseGuestUserErrors { - attachToCart: Error; -} -``` -### `guestUser` -Returns a User as a computed property - -### `setGuestUser` -Set the User - -### `attachToCart` -Function that takes `user` as `UseGuestUserRegisterParams` param. - -### `loading` -Returns the current state of `search` as `computed` boolean property - -### `error` -Reactive object containing the error message, if search failed for any reason. - -## Example - -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useGuestUser } from '@vue-storefront/magento'; - -export default { - setup (props) { - const { - attachToCart, - loading: loadingGuestUser, - error: errorGuestUser, - } = useGuestUser(); - - const handleFormSubmit = () => async () => { - await attachToCart({ user: props.user }); - }; - - return { - handleFormSubmit, - loadingGuestUser, - errorGuestUser, - } - } -} -``` diff --git a/docs/guide/composables/use-make-oder.md b/docs/guide/composables/use-make-oder.md deleted file mode 100644 index 67b3762d1..000000000 --- a/docs/guide/composables/use-make-oder.md +++ /dev/null @@ -1,103 +0,0 @@ -# useMakeOrder -`useMakeOrder` composable is responsible for making an order - -## API -````typescript -interface UseMakeOrder { - order: Ref; - make(params: { customQuery?: CustomQuery }): Promise; - error: ComputedProperty; - loading: ComputedProperty; -} - -export interface Order extends OrderItem { - /** @deprecated The order_id field is deprecated, use order_number instead. */ - order_id?: Maybe; - /** The unique ID for a `Order` object. */ - order_number: Scalars['String']; -} - -export interface OrderItem { - /** The final discount information for the product */ - discounts?: Maybe>>; - /** The entered option for the base product, such as a logo or image */ - entered_options?: Maybe>>; - /** The unique ID for a `OrderItemInterface` object */ - id: Scalars['ID']; - /** The name of the base product */ - product_name?: Maybe; - /** The sale price of the base product, including selected options */ - product_sale_price: Money; - /** The SKU of the base product */ - product_sku: Scalars['String']; - /** The type of product, such as simple, configurable, etc. */ - product_type?: Maybe; - /** URL key of the base product */ - product_url_key?: Maybe; - /** The number of canceled items */ - quantity_canceled?: Maybe; - /** The number of invoiced items */ - quantity_invoiced?: Maybe; - /** The number of units ordered for this item */ - quantity_ordered?: Maybe; - /** The number of refunded items */ - quantity_refunded?: Maybe; - /** The number of returned items */ - quantity_returned?: Maybe; - /** The number of shipped items */ - quantity_shipped?: Maybe; - /** The selected options for the base product, such as color or size */ - selected_options?: Maybe>>; - /** The status of the order item */ - status?: Maybe; -} -```` -### `make` -function for making an order. This method accepts a single optional params object. - -### `order` -a main data object that contains a made order. - -### `loading` -a reactive object containing information about loading state of your make method. - -### `error` -a reactive object containing the error message, if load or save failed for any reason. - - -## Getters -````typescript -interface UserOrderGetters { - getDate: (order: Order) => string; - getId: (order: Order) => string; - getStatus: (order: Order) => string; - getPrice: (order: Order) => number; - getItems: (order: Order) => OrderItem[]; - getItemSku: (item: OrderItem) => string; - getItemName: (item: OrderItem) => string; - getItemQty: (item: OrderItem) => number; - getItemPrice: (item: OrderItem) => number; - getFormattedPrice: (price: number) => string; -} -```` - -## Example -````javascript -import { useMakeOrder } from '@vue-storefront/magento'; -export default { - setup () { - const { order, make, loading } = useMakeOrder(); - - const processOrder = async () => { - await make(); - router.push(`/checkout/thank-you?order=${order.value.order_number}`); - }; - - return { - processOrder, - order, - loading, - }; - } -} -```` diff --git a/docs/guide/composables/use-menu-category.md b/docs/guide/composables/use-menu-category.md deleted file mode 100644 index 8df7a2006..000000000 --- a/docs/guide/composables/use-menu-category.md +++ /dev/null @@ -1,50 +0,0 @@ -# useMenuCategory - -## Features -`useMenuCategory` composable is responsible for fetching a list of categories with a dedicated file structure for AppHeader Menu. - -## API -```typescript -export interface UseCategory { - categories: ComputedProperty; - search(params: ComposableFunctionArgs): Promise; - loading: ComputedProperty; - error: ComputedProperty; -} - -export type CategoryMenu = CategoryTree; -``` -> For more information on [Category Tree interface](use-category) visit the dedicated documentation. - -### `search` -Function that takes `CategoryListQueryVariables` and `CustomQuery` as optional params and gets the `categories` accordingly - -### `categories` -Returns an array of categories fetched by `search` method as a `computed` property. - -### `loading` -Returns the current state of `search` as `computed` boolean property - -### `error` -Reactive object containing the error message, if search failed for any reason. - -## Example -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useMenuCategory } from '@vue-storefront/magento'; - -export default { - setup () { - const { categories, search, loading } = useMenuCategory('category-id'); - - onSSR(async () => { - await search({}); - }); - - return { - categories, - loading - } - } -} -``` diff --git a/docs/guide/composables/use-newsletter.md b/docs/guide/composables/use-newsletter.md deleted file mode 100644 index bcfe02a81..000000000 --- a/docs/guide/composables/use-newsletter.md +++ /dev/null @@ -1,21 +0,0 @@ -# useNewsletter - -`useNewsletter` - -## API -```typescript -export interface UseNewsletter extends Composable{ - error: ComputedProperty; - loading: ComputedProperty; - updateSubscription: (params: { - email: UPDATE_NEWSLETTER_PARAMS, - }) => Promise; -} -``` - -* `` - - -## Example - -```javascript -``` diff --git a/docs/guide/composables/use-payment-provider.md b/docs/guide/composables/use-payment-provider.md deleted file mode 100644 index 7ce292458..000000000 --- a/docs/guide/composables/use-payment-provider.md +++ /dev/null @@ -1,80 +0,0 @@ -# usePaymentProvider - -## Features -`usePaymentProvider` composable is responsible for fetching a Shipping Method - -## API -The `usePaymentProvider` composable implements custom factory `usePaymentProviderFactory` located in `packages/composables/src/factories/usePaymentProviderFactory.ts` and returns `UsePaymentProvider` interface: -```typescript -interface UsePaymentProvider { - error: ComputedProperty; - loading: ComputedProperty; - state: ComputedProperty; - setState(state: any): void; - load(params: { customQuery?: CustomQuery }): Promise; - save(params: { paymentMethod: any, customQuery?: CustomQuery }): Promise; -} - -export interface UsePaymentProviderErrors { - load: Error; - save: Error; -} -``` -### `state` -Get all `PaymentProviders` as array. - -### `setState` -Set one or more `PaymentProviders` state. - -### `load` -Function that takes `customQuery` as param and gets the `state` array accordingly - -### `save` -Function that takes `paymentMethod` as param and saves it - -### `loading` -Returns the current state of `search` as `computed` boolean property - -### `error` -Reactive object containing the error message, if search failed for any reason. - -## Example - -```javascript -import { onSSR } from '@vue-storefront/core'; -import { usePaymentProvider } from '@vue-storefront/magento'; - -export default { - setup (props) { - const { load, state, save } = usePaymentProvider(); - - onMounted(async () => { - await load(); - }); - - const paymentMethods = computed(() => (Array.isArray(state.value) ? state.value.map((p) => ({ - label: p.title, - value: p.code, - })) : [])); - - const definePaymentMethods = async (paymentMethod) => { - try { - await save({ - paymentMethod: { - code: paymentMethod, - }, - }); - - emit('status', paymentMethod); - } catch (e) { - console.error(e); - } - }; - - return { - definePaymentMethods, - state, - } - } -} -``` diff --git a/docs/guide/composables/use-product.md b/docs/guide/composables/use-product.md deleted file mode 100644 index 3347cd1b6..000000000 --- a/docs/guide/composables/use-product.md +++ /dev/null @@ -1,309 +0,0 @@ -# useProduct - -## Features -`useProduct` composable is responsible for fetching a list of products. - -## API -```typescript -interface UseProduct { - products: ComputedProperty; - loading: ComputedProperty; - error: ComputedProperty; - search(params: ComposableFunctionArgs): Promise; -} - -export interface ProductsSearchParams { - perPage?: number; - page?: number; - sort?: any; - term?: any; - filters?: any; - [x: string]: any; -} - -export interface Products { - /** Layered navigation aggregations. */ - aggregations?: Maybe>>; - /** - * Layered navigation filters array. - * @deprecated Use aggregations instead - */ - filters?: Maybe>>; - /** An array of products that match the specified search criteria. */ - items?: Maybe>>; - /** An object that includes the page_info and currentPage values specified in the query. */ - page_info?: Maybe; - /** An object that includes the default sort field and all available sort fields. */ - sort_fields?: Maybe; - /** The number of products that are marked as visible. By default, in complex products, parent products are visible, but their child products are not. */ - total_count?: Maybe; -} - -export interface ProductInterface { - activity?: Maybe; - /** - * The attribute set assigned to the product. - * @deprecated The field should not be used on the storefront. - */ - attribute_set_id?: Maybe; - /** Relative canonical URL. This value is returned only if the system setting 'Use Canonical Link Meta Tag For Products' is enabled */ - canonical_url?: Maybe; - /** The categories assigned to a product. */ - categories?: Maybe>>; - category_gear?: Maybe; - climate?: Maybe; - collar?: Maybe; - color?: Maybe; - /** The product's country of origin. */ - country_of_manufacture?: Maybe; - /** - * Timestamp indicating when the product was created. - * @deprecated The field should not be used on the storefront. - */ - created_at?: Maybe; - /** Crosssell Products */ - crosssell_products?: Maybe>>; - /** Detailed information about the product. The value can include simple HTML tags. */ - description?: Maybe; - eco_collection?: Maybe; - erin_recommends?: Maybe; - features_bags?: Maybe; - format?: Maybe; - gender?: Maybe; - /** Indicates whether a gift message is available. */ - gift_message_available?: Maybe; - /** - * The ID number assigned to the product. - * @deprecated Use the `uid` field instead. - */ - id?: Maybe; - /** The relative path to the main image on the product page. */ - image?: Maybe; - /** A number representing the product's manufacturer. */ - manufacturer?: Maybe; - material?: Maybe; - /** An array of Media Gallery objects. */ - media_gallery?: Maybe>>; - /** - * An array of MediaGalleryEntry objects. - * @deprecated Use product's `media_gallery` instead - */ - media_gallery_entries?: Maybe>>; - /** A brief overview of the product for search results listings, maximum 255 characters. */ - meta_description?: Maybe; - /** A comma-separated list of keywords that are visible only to search engines. */ - meta_keyword?: Maybe; - /** A string that is displayed in the title bar and tab of the browser and in search results lists. */ - meta_title?: Maybe; - /** The product name. Customers use this name to identify the product. */ - name?: Maybe; - new?: Maybe; - /** - * The beginning date for new product listings, and determines if the product is featured as a new product. - * @deprecated The field should not be used on the storefront. - */ - new_from_date?: Maybe; - /** - * The end date for new product listings. - * @deprecated The field should not be used on the storefront. - */ - new_to_date?: Maybe; - /** Product stock only x left count */ - only_x_left_in_stock?: Maybe; - /** If the product has multiple options, determines where they appear on the product page. */ - options_container?: Maybe; - pattern?: Maybe; - performance_fabric?: Maybe; - /** - * A ProductPrices object, indicating the price of an item. - * @deprecated Use price_range for product price information. - */ - price?: Maybe; - /** A PriceRange object, indicating the range of prices for the product */ - price_range: PriceRange; - /** An array of TierPrice objects. */ - price_tiers?: Maybe>>; - /** An array of ProductLinks objects. */ - product_links?: Maybe>>; - /** The average of all the ratings given to the product. */ - rating_summary: Scalars['Float']; - /** Related Products */ - related_products?: Maybe>>; - /** The total count of all the reviews given to the product. */ - review_count: Scalars['Int']; - /** The list of products reviews. */ - reviews: ProductReviews; - sale?: Maybe; - /** A short description of the product. Its use depends on the theme. */ - short_description?: Maybe; - size?: Maybe; - /** A number or code assigned to a product to identify the product, options, price, and manufacturer. */ - sku?: Maybe; - sleeve?: Maybe; - /** The relative path to the small image, which is used on catalog pages. */ - small_image?: Maybe; - /** - * The beginning date that a product has a special price. - * @deprecated The field should not be used on the storefront. - */ - special_from_date?: Maybe; - /** The discounted price of the product. */ - special_price?: Maybe; - /** The end date that a product has a special price. */ - special_to_date?: Maybe; - /** Stock status of the product */ - stock_status?: Maybe; - strap_bags?: Maybe; - style_bags?: Maybe; - style_bottom?: Maybe; - style_general?: Maybe; - /** The file name of a swatch image */ - swatch_image?: Maybe; - /** The relative path to the product's thumbnail image. */ - thumbnail?: Maybe; - /** - * The price when tier pricing is in effect and the items purchased threshold has been reached. - * @deprecated Use price_tiers for product tier price information. - */ - tier_price?: Maybe; - /** - * An array of ProductTierPrices objects. - * @deprecated Use price_tiers for product tier price information. - */ - tier_prices?: Maybe>>; - /** - * One of simple, virtual, bundle, downloadable, grouped, or configurable. - * @deprecated Use __typename instead. - */ - type_id?: Maybe; - /** The unique ID for a `ProductInterface` object. */ - uid: Scalars['ID']; - /** - * Timestamp indicating when the product was updated. - * @deprecated The field should not be used on the storefront. - */ - updated_at?: Maybe; - /** Upsell Products */ - upsell_products?: Maybe>>; - /** The part of the URL that identifies the product */ - url_key?: Maybe; - /** @deprecated Use product's `canonical_url` or url rewrites instead */ - url_path?: Maybe; - /** URL rewrites list */ - url_rewrites?: Maybe>>; - /** The part of the product URL that is appended after the url key */ - url_suffix?: Maybe; - /** - * An array of websites in which the product is available. - * @deprecated The field should not be used on the storefront. - */ - websites?: Maybe>>; -} - -export interface UseProductErrors { - search: Error; -} -``` - -### `search` -Function that takes in `ProductsSearchParams` as optional params and gets the `products` accordingly - -### `products` -Returns `products` as a `computed` property - -### `loading` -Returns the `loading` state of `search` - -### `error` -reactive object containing the error message, if search failed for any reason. - - -## Getters - -```typescript -interface ProductGetters { - getAttributes: ( - products: Product, - _filterByAttributeName?: string[], - ) => Record, - getAverageRating: () => number, - getBreadcrumbs: ( - product: Product, - category?: Category, - ) => AgnosticBreadcrumb[], - getCategory: ( - product: Product, - currentUrlPath: string, - ) => Category | null, - getCategoryIds: (product: Product) => string[], - getCoverImage: (product: Product) => string, - getDescription: (product: Product) => string, - getFiltered: ( - products: Product[], - _filters: ProductsSearchParams, - ) => Product[], - getFormattedPrice: (price: number) => string | null, - getGallery: (product: Product) => AgnosticMediaGalleryItem[], - getId: (product: Product) => string, - getName: (product: Product) => string, - getPrice: (product: Product) => AgnosticPrice, - getProductRelatedProduct: (product: Product) => Product[] | [], - getProductUpsellProduct: (product: Product) => Product[] | [], - getProductSku: (product: Product) => string, - getProductThumbnailImage: (product: Product) => string, - getShortDescription: (product: Product) => string, - getSlug: (product: Product, category?: Category) => string, - getTotalReviews: () => number, - getTypeId: (product: Product) => string, -} -``` -* `getAttributes` - returns product attributes. -* `getAverageRating` - returns average rating from all reviews. -* `getBreadcrumbs` - returns 'Breadcrumbs'. -* `getCategoryIds` - returns all product categories. -* `getCategory` - returns 'Category'. -* `getCoverImage` - returns cover image of product. -* `getDescription` - returns product description. -* `getFiltered` - returns filtered product. -* `getFormattedPrice` - returns product price with currency sign. -* `getGallery` - returns product gallery. -* `getId` - returns product ID. -* `getName` - returns product name. -* `getPrice` - returns product price. -* `getProductRelatedProduct` - returns 'ProductRelatedProduct'. -* `getProductSku` - returns 'ProductSku'. -* `getProductThumbnailImage` - returns 'ProductThumbnailImage'. -* `getProductUpsellProduct` - returns 'ProductUpsellProduct'. -* `getShortDescription` - returns 'ShortDescription'. -* `getSlug` - returns product slug. -* `getTotalReviews` - returns total number of reviews product has. -* `getTypeId` - returns 'TypeId'. - -## Example - -```javascript -import { useProduct, productGetters } from '@vue-storefront/magento'; -import { onSSR } from '@vue-storefront/core' - -export default { - setup () { - const { products, search, loading, error } = useProduct(''); - - onSSR(async () => { - await search({ - pageSize: 10, - currentPage: 1, - sort: { - position: 'ASC', - }, - }) - }) - - return { - loading, - error, - product: computed(() => productGetters.getFiltered(products.value?.items, { master: true })[0]), - } - } -} -``` diff --git a/docs/guide/composables/use-related-products.md b/docs/guide/composables/use-related-products.md deleted file mode 100644 index be90af824..000000000 --- a/docs/guide/composables/use-related-products.md +++ /dev/null @@ -1,26 +0,0 @@ -# useRelatedProducts - -`useRelatedProducts` - -## API -```typescript -export interface UseRelatedProducts< - PRODUCTS, - RELATED_PRODUCT_SEARCH_PARAMS, - API extends PlatformApi = any> - extends Composable { - products: ComputedProperty; - loading: ComputedProperty; - error: ComputedProperty; - search(params: ComposableFunctionArgs): Promise; - [x: string]: any; -} - -``` - -* `` - - -## Example - -```javascript -``` diff --git a/docs/guide/composables/use-review.md b/docs/guide/composables/use-review.md deleted file mode 100644 index 8bc23b055..000000000 --- a/docs/guide/composables/use-review.md +++ /dev/null @@ -1,14 +0,0 @@ -# useReview - -`useReview` - -## API -```typescript -``` - -* `` - - -## Example - -```javascript -``` diff --git a/docs/guide/composables/use-shipping-provider.md b/docs/guide/composables/use-shipping-provider.md deleted file mode 100644 index 99e96b860..000000000 --- a/docs/guide/composables/use-shipping-provider.md +++ /dev/null @@ -1,45 +0,0 @@ -# useShippingProvider -`useShippingProvider` composable can be used for: -* Loading shipping methods for the current cart. -* Selecting shipping method for the current cart. - -> WIP - -## API -```typescript -interface UseShippingProvider { - error: ComputedProperty; - loading: ComputedProperty; - state: ComputedProperty; - setState(state: STATE): void; - load(): Promise; - load(params: { customQuery?: CustomQuery }): Promise; - save(params: { shippingMethod: SHIPPING_METHOD, customQuery?: CustomQuery }): Promise; -} -``` -* `load` - function for fetching shipping method. When invoked, it requests data from the API and populates the response key inside the state property. This method accepts a single optional params object. -* `save` - function for selecting shipping method. This method accepts a single saveParams object. -* `state` - function for selecting shipping method. This method accepts a single saveParams object. -* `loading` - a reactive object containing information about loading state of your load or save method. -* `error` - a reactive object containing the error message, if load or save failed for any reason. - -## Example -````javascript -import { useShippingProvider } from '@vue-storefront/magento'; -import { onSSR } from '@vue-storefront/core'; -import { computed } from '@vue/composition-api'; - -export default { - setup () { - const { load, state } = useShippingProvider(); - - onSSR(async () => { - await load(); - }); - - return { - selectedShippingMethod: computed(() => state.value && state.value.response) - }; - } -} -```` diff --git a/docs/guide/composables/use-shipping.md b/docs/guide/composables/use-shipping.md deleted file mode 100644 index d30a7662d..000000000 --- a/docs/guide/composables/use-shipping.md +++ /dev/null @@ -1,43 +0,0 @@ -# useShipping -`useShipping` composable can be used for: -* Loading shipping address for the current cart. -* Saving shipping address for the current cart. - -> WIP - -## API -```typescript -interface UseShipping { - error: ComputedProperty; - loading: ComputedProperty; - shipping: ComputedProperty; - load(): Promise; - load(params: { customQuery?: CustomQuery }): Promise; - save: (params: { params: SHIPPING_PARAMS; shippingDetails: SHIPPING; customQuery?: CustomQuery }) => Promise; -} -``` -* `load` - function for fetching shipping address. When invoked, it requests data from the API and populates shipping property. This method accepts a single optional params object. -* `save` - function for saving shipping address. This method accepts a single saveParams object. -* `shipping` - a main data object that contains a shipping address. -* `loading` - a reactive object containing information about loading state of your load or save method. -* `error` - a reactive object containing the error message, if load or save failed for any reason. - -## Example -````javascript -import { useShipping } from '@vue-storefront/magento'; -import { onSSR } from '@vue-storefront/core'; - -export default { - setup () { - const { load, shipping } = useShipping(); - - onSSR(async () => { - await load(); - }); - - return { - shipping - }; - } -} -```` diff --git a/docs/guide/composables/use-store.md b/docs/guide/composables/use-store.md deleted file mode 100644 index 9775c0d8f..000000000 --- a/docs/guide/composables/use-store.md +++ /dev/null @@ -1,52 +0,0 @@ -# `useStore` - -## Features - -`useStore` composable is responsible, for interactions with the available stores in Magento. It allows to: -* fetch available stores -* switch to another store - -## API -The `useStore` composable implements custom factory `useStoreFactory` located in `packages/composables/src/factories/useStoreFactory.ts` and returns `UseStore` interface: -```typescript -interface UseStore extends Composable { - load: () => Promise; - change: (params: ComposableFunctionArgs) => void; - stores: ComputedRef; - loading: ComputedRef; -} - -export interface AvailableStores = { - availableStores? : Maybe>> -}; -``` - -## Getters - -`storeGetter` object contains following methods: - -* `getItems` - returns list of available stores. -* `getSelected` - returns if the selected store is equal to the config store. - - -## Example - -```js -import { useStore, storeGetters } from '@vue-storefront/magento'; -import { onSSR } from '@vue-storefront/core'; - -export default { - setup () { - const { load: loadStores, stores } = useStore(); - - onSSR(async () => { - await loadStores(); - }); - - return { - stores: storesGetters.getItems(stores.value), - selectedStore: storesGetters.getSelected(stores.value) - }; - } -} -``` diff --git a/docs/guide/composables/use-upsell-products.md b/docs/guide/composables/use-upsell-products.md deleted file mode 100644 index bdc914dff..000000000 --- a/docs/guide/composables/use-upsell-products.md +++ /dev/null @@ -1,24 +0,0 @@ -# useUpsellProducts - -`useUpsellProducts` - -## API -```typescript -export interface UseUpsellProducts< - PRODUCTS, UPSELL_PRODUCTS_SEARCH_PARAMS, - API extends PlatformApi = any> - extends Composable { - products: ComputedProperty; - loading: ComputedProperty; - error: ComputedProperty; - search(params: ComposableFunctionArgs): Promise; - [x: string]: any; -} -``` - -* `` - - -## Example - -```javascript -``` diff --git a/docs/guide/composables/use-url-resolver.md b/docs/guide/composables/use-url-resolver.md deleted file mode 100644 index 038f9863c..000000000 --- a/docs/guide/composables/use-url-resolver.md +++ /dev/null @@ -1,58 +0,0 @@ -# useRouter - -`useRouter` composition API function is responsible, as its name suggests, for interactions with the routes in your eCommerce. This function returns following values: - -## API -```typescript -interface UseRouter { - search: (url: string) => Promise; - route: Readonly>>; - loading: Readonly>>; -} -``` - -* `search` - Function that takes in a `url` and fills the `route` property -* `route` - Returns the current Page -* `loading` - Returns state of `search` - -## Example - -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useRouter } from '@vue-storefront/magento'; -import { computed } from '@vue/composition-api'; - -export default { - setup(props, context) { - const { - path - } = context.root.$route; - const { - loading, - search, - route - } = useRouter('router:' + path); - onSSR(async () => { - await search(path); - if (route.value.data.urlResolver === null) { - context.root.$nuxt.error({ - statusCode: 404, - message: 'Page not found' - }); - } - }); - - const routeType = computed(() => { - if (loading.value || route.value.data.urlResolver === null) { - return {}; - } - return route.value.data.urlResolver; - }); - - return { - loading, - routeType - }; - } -}; -``` diff --git a/docs/guide/composables/use-user-billing.md b/docs/guide/composables/use-user-billing.md deleted file mode 100644 index 6570b9c33..000000000 --- a/docs/guide/composables/use-user-billing.md +++ /dev/null @@ -1,106 +0,0 @@ -# useUserBilling -`useUserBilling` composable can be used to: -* fetch existing billing addresses, -* submit new billing addresses, -* modify and delete existing billing addresses. - -````typescript -interface UseUserBilling { - billing: ComputedProperty; - addAddress: (params: { - address: USER_BILLING_ITEM; - }) => Promise; - deleteAddress: (params: { - address: USER_BILLING_ITEM; - }) => Promise; - updateAddress: (params: { - address: USER_BILLING_ITEM; - }) => Promise; - load: () => Promise; - setDefaultAddress: (params: { - address: USER_BILLING_ITEM; - }) => Promise; - loading: ComputedProperty; - error: ComputedProperty; -} -```` - -* `load` - function for fetching user addresses. When invoked, it requests data from the API and populates billing property. -* `addAddress`- function for posting new billing address. This method accepts a single params object. -* `deleteAddress` - function for deleting existing billing address. This method accepts a single params object. -* `updateAddress` - function for updating existing billing address. This method accepts a single params object. -* `setDefaultAddress` - function for settings an existing billing address as default. This method accepts a single params object. -* `billing` - reactive data object containing response from the backend. -* `loading` - reactive object containing information about loading state of load, addAddress, deleteAddress, updateAddress and setDefaultAddress methods. -* `error` - reactive object containing the error message, if some properties failed for any reason. - -## Getter -````typescript -interface UserBillingGetters { - getAddresses: (billing: USER_BILLING, criteria?: Record) => USER_BILLING_ITEM[]; - getDefault: (billing: USER_BILLING) => USER_BILLING_ITEM; - getTotal: (billing: USER_BILLING) => number; - getPostCode: (address: USER_BILLING_ITEM) => string; - getStreetName: (address: USER_BILLING_ITEM) => string; - getStreetNumber: (address: USER_BILLING_ITEM) => string | number; - getCity: (address: USER_BILLING_ITEM) => string; - getFirstName: (address: USER_BILLING_ITEM) => string; - getLastName: (address: USER_BILLING_ITEM) => string; - getCountry: (address: USER_BILLING_ITEM) => string; - getPhone: (address: USER_BILLING_ITEM) => string; - getEmail: (address: USER_BILLING_ITEM) => string; - getProvince: (address: USER_BILLING_ITEM) => string; - getCompanyName: (address: USER_BILLING_ITEM) => string; - getTaxNumber: (address: USER_BILLING_ITEM) => string; - getId: (address: USER_BILLING_ITEM) => string; - getApartmentNumber: (address: USER_BILLING_ITEM) => string | number; - isDefault: (address: USER_BILLING_ITEM) => boolean; -} -```` - -* `getAddresses` - returns list of billing addresses. -* `getDefault` - returns a default billing address. -* `getTotal` - returns total number of billing addresses user has. -* `getId` - returns id from an individual address. -* `getPostCode` - returns post code from an individual address. -* `getStreetName` - returns street name from an individual address. -* `getStreetNumber` - returns street number from an individual address. -* `getCity` - returns city name from an individual address. -* `getFirstName` - returns first name from an individual address. -* `getLastName` - returns last name from an individual address. -* `getCountry` - returns country name from an individual address. -* `getPhone` - return phone number from an individual address. -* `getEmail` - returns e-mail address from an individual address. -* `getProvince` - returns province (state) from an individual address. -* `getCompanyName` - returns company name from an individual address. -* `getTaxNumber` - returns tax number from an individual address. -* `getApartmentNumber` - returns apartment number from an individual address. -* `isDefault` - return information if address is current default. - -## Example -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useUserBilling, userBillingGetters } from '@vue-storefront/magento'; - -export default { - setup() { - const { - billing, - load, - addAddress, - deleteAddress, - updateAddress - } = useUserBilling(); - - // If you're using Nuxt or any other framework for Universal Vue apps - onSSR(async () => { - await load(); - }); - - return { - billing: computed(() => userBillingGetters.getAddresses(billing.value)), - userBillingGetters - }; - } -}; -``` diff --git a/docs/guide/composables/use-user-order.md b/docs/guide/composables/use-user-order.md deleted file mode 100644 index 68f2f149f..000000000 --- a/docs/guide/composables/use-user-order.md +++ /dev/null @@ -1,44 +0,0 @@ -# useUserOrder - -`useUserOrders` composable is responsible, as it's name suggests for interactions with user's order history from your eCommerce. - -## API - -```typescript -interface UseUserOrder { - orders: ComputedProperty; - search(params: ComposableFunctionArgs): Promise; - loading: ComputedProperty; - error: ComputedProperty; -} -``` - -* `orders` - a main data object that contains an array of orders fetched by searchOrders method. -* `totalOrder` - Returns the total `number` of `orders` for the current User -* `error` - reactive object containing the error message, if some properties failed for any reason. -* `loading` - a reactive object containing information about loading state of your searchOrders method. - -## Example - -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useUserOrder } from '@vue-storefront/magento'; -import { computed } from '@vue/composition-api'; - -export default { - setup() { - const { - orders, - searchOrders - } = useUserOrders(); - - onSSR(async () => { - await searchOrder(); - }); - - return { - orders: computed(() => orders ? orders.value : []) - } - } -} -``` diff --git a/docs/guide/composables/use-user-shipping.md b/docs/guide/composables/use-user-shipping.md deleted file mode 100644 index 8820f9cbb..000000000 --- a/docs/guide/composables/use-user-shipping.md +++ /dev/null @@ -1,56 +0,0 @@ -# useUserShipping - -`useShipping` composable can be used for: -* Loading shipping address for the current cart. -* Saving shipping address for the current cart. - -## API -````typescript -interface UseUserShipping { - shipping: ComputedProperty; - addAddress: (params: { - address: USER_SHIPPING_ITEM; - }) => Promise; - deleteAddress: (params: { - address: USER_SHIPPING_ITEM; - }) => Promise; - updateAddress: (params: { - address: USER_SHIPPING_ITEM; - }) => Promise; - load: () => Promise; - setDefaultAddress: (params: { - address: USER_SHIPPING_ITEM; - }) => Promise; - loading: ComputedProperty; - error: ComputedProperty; -} -```` - -* `load` - function for fetching shipping address. When invoked, it requests data from the API and populates shipping property. This method accepts a single optional params object. -* `save` - function for saving shipping address. This method accepts a single saveParams object. -* `shipping` - a main data object that contains a shipping address. -* `addAddress` - function for adding a shipping address. This method accepts addressParams object -* `deleteAddress` - function for deleting a shipping address. This method accepts addressParams object -* `updateAddress` - function for updating a shipping address. This method accepts addressParams object -* `loading` - a reactive object containing information about loading state of your load or save method. -* `error` - a reactive object containing the error message, if load or save failed for any reason. - -## Example -```javascript -import { useShipping } from '@vue-storefront/magento'; -import { onSSR } from '@vue-storefront/core'; - -export default { - setup () { - const { load, shipping } = useShipping(); - - onSSR(async () => { - await load(); - }); - - return { - shipping - }; - } -} -``` diff --git a/docs/guide/composables/use-user.md b/docs/guide/composables/use-user.md deleted file mode 100644 index 31cfce636..000000000 --- a/docs/guide/composables/use-user.md +++ /dev/null @@ -1,82 +0,0 @@ -# useUser - -`useUser` composable can be used to: -* manage user authentication -* manage authentication data like email address, login or password. -* If you want to fetch/save other user data you should use the following composables: - -* `useUserBilling` -* `useUserShipping` -* `useUserOrders` - -## API -```typescript -interface UseUser { - user: ComputedProperty; - setUser: (user: USER) => void; - updateUser: (params: { - user: UPDATE_USER_PARAMS; - }) => Promise; - register: (params: { - user: UseUserRegisterParams; - }) => Promise; - login: (params: { - user: UseUserLoginParams; - }) => Promise; - logout: () => Promise; - changePassword: (params: { - current: string; - new: string; - }) => Promise; - load: () => Promise; - isAuthenticated: Ref; - loading: ComputedProperty; - error: ComputedProperty; -} -``` - -* `user` - reactive object containing information about current user. -* `updateUser` - function for updating user data. When invoked, it submits data to the API and populates user property with updated information. This method accepts a single params object. -* `register` - function for creating a new user. When invoked, it submits new user data to the API and saves them. This method accepts a single params object. -* `login` - function for log in a user based on a username and password. This method accepts a single params object. -* `logout` - function for logout a user. -* `changePassword` - function for changing user password. This method accepts a single params object. -* `isAuthenticated` - checks if user is authenticated or not. -* `loading` - reactive object containing information about loading state of user. -* `error` - reactive object containing the error message, if some properties failed for any reason. - -## Getters -````typescript -interface UserGetters { - getFirstName: (customer: USER) => string; - getLastName: (customer: USER) => string; - getFullName: (customer: USER) => string; - getEmailAddress: (customer: USER) => string; - [getterName: string]: (element: any, options?: any) => unknown; -} -```` -* `getFirstName` - returns user first name. -* `getLastName` - returns user last name. -* `getFullName` - returns full user name. -* `getEmailAddress` - returns user email address. - -## Example -```javascript -import { - useUser -} from '@vue-storefront/magento'; - -export default { - setup () { - const { user, register, login, loading } = useUser(); - - return { - register, - login, - loading, - firstName: userGetters.getFirstName(user.value), - email: userGetters.getEmailAddress(user.value) - } - } -} -``` diff --git a/docs/guide/composables/use-wishlist.md b/docs/guide/composables/use-wishlist.md deleted file mode 100644 index 0fd5c3d9f..000000000 --- a/docs/guide/composables/use-wishlist.md +++ /dev/null @@ -1,94 +0,0 @@ -# useWishlist - -`useWishlist` composable is responsible, for integrating with wishlist from Magento. It allows to: -* fetch products from wishlist -* add products to wishlist -* remove products from wishlist -* check if product is on wishlist - -## API -```typescript - interface UseWishlist { - wishlist: ComputedProperty; - loading: ComputedProperty; - addItem(params: { - product: PRODUCT; - customQuery?: CustomQuery; - }): Promise; - removeItem(params: { - product: WISHLIST_ITEM; - customQuery?: CustomQuery; - }): Promise; - load(): Promise; - load(params: { - customQuery?: CustomQuery; - }): Promise; - clear(): Promise; - setWishlist: (wishlist: WISHLIST) => void; - isOnWishlist({ product: PRODUCT }: { - product: any; - }): boolean; - error: ComputedProperty; -} -``` - -* `wishlist` - a main data object. -* `load` - function used to retrieve wishlist products. When invoked, it requests data from the API and populates wishlist property. This method accepts a single params object. -* `addItem` - function used to add new product to wishlist. When invoked, it submits data to the API and populates wishlist property with updated information. This method accepts a single params object. -* `removeItem` - function that removes products from the wishlist. It submits data to the API and populates updated wishlist property. This method accepts a single params object. -* `clear` - function that removes all products from the wishlist and populates clear wishlist property. -* `isOnWishlist` - function that checks if product is on the wishlist. It returns boolean value. This method accepts a single params object. -* `loading` - function that checks if product is on the wishlist. It returns boolean value. This method accepts a single params object. -* `error` - reactive object containing the error message, if some properties failed for any reason. - -## Getters -> WIP - -````typescript -interface WishlistGetters { - getItems: (wishlist: WISHLIST) => WISHLIST_ITEM[]; - getItemName: (wishlistItem: WISHLIST_ITEM) => string; - getItemImage: (wishlistItem: WISHLIST_ITEM) => string; - getItemPrice: (wishlistItem: WISHLIST_ITEM) => AgnosticPrice; - getItemAttributes: (wishlistItem: WISHLIST_ITEM, filters?: Array) => Record; - getItemSku: (wishlistItem: WISHLIST_ITEM) => string; - getTotals: (wishlist: WISHLIST) => AgnosticTotals; - getTotalItems: (wishlist: WISHLIST) => number; - getFormattedPrice: (price: number) => string; - [getterName: string]: (element: any, options?: any) => unknown; -} -```` -* `getItems` - returns list of products on wishlist -* `getItemName` - returns product's name from wishlist. -* `getItemImage` - returns product's image from wishlist. -* `getItemPrice` - returns product's price from wishlist. -* `getItemQty` - returns quantity of product which is on wishlist. -* `getItemAttributes` - returns product variant attribute chosen by its name. -* `getItemSku` - returns product's SKU code. -* `getTotals` - returns price of products. -* `getTotalItems` - returns amount of all items that are currently on wishlist. -* `getFormattedPrice` - returns price in formatted manner taking into account local specifics. - -## Example - -```javascript -import { onSSR } from '@vue-storefront/core'; -import { useWishlist, wishlistGetters } from '@vue-storefront/magento'; -export default { - setup() { - const { load: loadWishlist } = useWishlist(); - - const wishlistItems = computed(() => wishlistGetters.getItems()); - - // If you're using Nuxt or any other framework for Universal Vue apps - onSSR(async () => { - await loadWishlist(); - }); - - return { - loadWishlist, - wishlistItems - }; - } -}; -``` diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md index 9e747f457..74e016beb 100644 --- a/docs/guide/getting-started.md +++ b/docs/guide/getting-started.md @@ -11,5 +11,5 @@ vsf init && cd && yarn && yarn dev ## How to start if you want to contribute? -Want to contribute? Ping us on `magento2-vsf2` channel on [our Discord](https://discord.vuestorefront.io)! +Want to contribute? Ping us on `magento2` channel on [our Discord](https://discord.vuestorefront.io)! diff --git a/docs/migration-guides/1.0.0-rc.7/index.md b/docs/migration-guides/1.0.0-rc.7/index.md new file mode 100644 index 000000000..13ed518dd --- /dev/null +++ b/docs/migration-guides/1.0.0-rc.7/index.md @@ -0,0 +1,108 @@ +# Vue Storefront for Magento 1.0.0-rc.7 release notes + +Vue Storefront for Magento 1.0.0.rc.7 contains backward-incompatible changes. To review these backward-incompatible changes, see + +[1.0.0-rc.7 **Backward incompatible changes reference**](./rc.7-bic.md) + +## Vue Storefront for Magento 1.0.0-rc.7 highlights + +### Refactoring of composables + +In this version, the integration packages `@vue-storefront/magento` has been marked as deprecated. All things from this package, including composables, getters, and helpers have been moved to `@vue-storefront/magento-theme` + +**All composables have been refactored and moved to the theme.** + +- SharedRefs are not used anymore. + - from now we use the Pinia store for global state management + - instead of sharing context between each composables we use the useContext hook from Nuxt Composition API + - factories have been removed, and from now each composable is a function without dependencies on the `@vue-storefront/core` package + + +**Getters have been moved to the theme package and marked as deprecated.** + +In the next releases, getters will be removed. + +**Helpers have been moved to the theme package** + +### The onSSR hook is not used anymore + +From now, each operation that should be performed on the server-side must be called inside on the `useFetch` and the `useAsync` functions that are part of **Nuxt Composition API**. + +### The i18n plugin is not used anymore + +The i18n plugin from `@vue-storefront/core` is not used anymore. Configuring i18n is the responsibility of the theme package from now. + +### Modularization + +We started the process of split whole app into modules. The first module is the category module that contains components and logic responsible for catalog category pages. In next releases we will continue refactorization and add modules for other parts of app like product, checkout, account, wishlist and so on. + +### New features + +- Breadcrumbs on Category pages [#819](https://github.com/vuestorefront/magento2/pull/819) +- Loading skeletons: [#681](https://github.com/vuestorefront/magento2/pull/681) +- Styles for default Magento Static Blocks that appear on Category Landing Pages: [#685](https://github.com/vuestorefront/magento2/pull/685) +- Added possibility to navigate to nested categories in the mobile side menu [#709](https://github.com/vuestorefront/magento2/pull/709) +- Added information about selected filters in the filters sidebar [#830](https://github.com/vuestorefront/magento2/pull/830) +- Display category title below breadcrumbs [#892](https://github.com/vuestorefront/magento2/pull/892) +- Added mega menu on desktop view [#903](https://github.com/vuestorefront/magento2/pull/903) + +### Performance improvements + +- From now, user data is loaded only on pages where it’s necessary like checkout and my account pages. In other cases, user data is not loading and thanks to that the performance on mobile is better because we decreased the time of JS long tasks. https://github.com/vuestorefront/magento2/pull/859 +- We added the storeConfig plugin and changed the approach to getting config from Magento. [#862](https://github.com/vuestorefront/magento2/pull/862) + - before we loaded the whole Magento config on page load, and we did that in layout so it was not possible to change the use different layout than the default + - after this change, we load only a few necessary fields by the Nuxt plugin. + - Thanks to that it’s possible to use other layouts like default. Moreover, this has an impact on performance because the storeConfig Magento query is not cached on the Magento side, so when we decreased the amount of data, the time of response should be faster. +- Once we updated the Storefront UI to the newest version, we were able to add support for the NuxtImage for images in the Gallery on ta Product Page [#850](https://github.com/vuestorefront/magento2/pull/850) + +### **Bugfix** + +- color swatches are visible on the product page on a mobile device so from now it’s possible to add a configurable product to the cart on mobile devices. [#926](https://github.com/vuestorefront/magento2/pull/926) +- Wishlist and cart transition works correctly from now when a user opens the wishlist sidebar or cart sidebar [#918](https://github.com/vuestorefront/magento2/pull/918) +- Once the message about the not authorized user is displayed, the cookie with a message will be removed to avoid displaying the message endlessly. [#775](https://github.com/vuestorefront/magento2/pull/775) +- From now, it’s possible to add more than one product to the cart from the Category page in list mode [#680](https://github.com/vuestorefront/magento2/pull/680) +- The β€œyour bag is empty” phrase is centered correctly from now [#679](https://github.com/vuestorefront/magento2/pull/679) +- updated the useUser composable to assign error values for an email update action [#777](https://github.com/vuestorefront/magento2/pull/777) +- removed redundant form handling requests to avoid duplicated/multiplicated requests [#777](https://github.com/vuestorefront/magento2/pull/777) +- fixed 404-page issues and my-account redirects for non-logged users [#722](https://github.com/vuestorefront/magento2/pull/722) +- fixed price caching issue on category page [#793](https://github.com/vuestorefront/magento2/pull/793) +- fallow one digit house numbers [#824](https://github.com/vuestorefront/magento2/pull/824) +- The billing address is no longer cleared while returning to the billing step on checkout [#783](https://github.com/vuestorefront/magento2/pull/783) +- removed placeholder for a sorting mechanism in the category navbar [#782](https://github.com/vuestorefront/magento2/pull/782) +- fixed wrong direction of the draggable icon on the product page (mobile) [#927](https://github.com/vuestorefront/magento2/pull/927) +- Click on a product tab click to scroll to tab content from now [#931](https://github.com/vuestorefront/magento2/pull/931) +- Prevented content jump when an option or variant is selected [#933](https://github.com/vuestorefront/magento2/pull/933) + +### Refactors + +- Removed categoryGetters call from AppHeader.vue [#853](https://github.com/vuestorefront/magento2/pull/853) +- Removed storeConfigGetters and storeGetters from StoreSwitcher and StoresModal +- Removed categoryGetters from SearchBar.vue +- Removed category results from the Search results components [#867](https://github.com/vuestorefront/magento2/pull/867) +- Created the category module and refactored the category three components +- refactored Category page’s filters on desktop view [#815](https://github.com/vuestorefront/magento2/pull/815) +- refactored store switcher [#794](https://github.com/vuestorefront/magento2/pull/794) +- refactored cookie retrieval [#797](https://github.com/vuestorefront/magento2/pull/797) +- removed links from order's product [#778](https://github.com/vuestorefront/magento2/pull/778) +- Moved filters to sidebar on desktop view [#884](https://github.com/vuestorefront/magento2/pull/884) +- Created Grid/list components on Category page [#910](https://github.com/vuestorefront/magento2/pull/910) +- Refactored project config & env variables [#813](https://github.com/vuestorefront/magento2/pull/813) +- refactored useUiState [#595](https://github.com/vuestorefront/magento2/pull/595) +- changed homepage slider to the hero section [#928](https://github.com/vuestorefront/magento2/pull/928) +- changed products carousel on the home page to non-carousel section [#914](https://github.com/vuestorefront/magento2/pull/914) +- added skeleton loaders in category nabvar [#936](https://github.com/vuestorefront/magento2/pull/936) + +### Chore + +- Updated StorefrontUI to 0.13.0 [#781](https://github.com/vuestorefront/magento2/pull/781) +- Updated @vue-storefront packages to 2.5.6 [#740](https://github.com/vuestorefront/magento2/pull/740) +- fixed .lintstagedrc {.vue} warning [#779](https://github.com/vuestorefront/magento2/pull/779) +- lint-staged should run only once [#789](https://github.com/vuestorefront/magento2/pull/789) +- auto-assign team members to pull requests [#759](https://github.com/vuestorefront/magento2/pull/759) +- removed commitizen prepare-commit-msg git hook [#780](https://github.com/vuestorefront/magento2/pull/780) +- Merged the three .lintstagedrc regexes into one [#787](https://github.com/vuestorefront/magento2/pull/787) + +### Documentation + +- documentation about composables has been fully rewrote +- added documentation for API Client methods diff --git a/docs/migration-guides/1.0.0-rc.7/rc.7-bic.md b/docs/migration-guides/1.0.0-rc.7/rc.7-bic.md new file mode 100644 index 000000000..19c34a5f9 --- /dev/null +++ b/docs/migration-guides/1.0.0-rc.7/rc.7-bic.md @@ -0,0 +1,88 @@ +# 1.0.0-rc.7 Backward incompatible changes reference + +In this document you can see crucial breaking changes in the `1.0.0-rc.7` comparing to `1.0.0-rc.6` release. To see all changes, please take a look at [the release PR](https://github.com/vuestorefront/magento2/pull/949/files). + +## Composables (@vue-storefront/magento package) + +| File | what and how it changed | +|---------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| packages/composables/nuxt/plugin.js | Has been moved to packages/theme/modules/magento/plugin.ts | +| packages/composables/package.json | build scripts have been changed | +| packages/composables/src/composables/useAddresses/index.ts | - Marked as deprecated - use packages/theme/modules/customer/composables/useAddresses/index.ts instead, return values of the useAddresses composable have been changed | +| packages/composables/src/composables/useBilling/index.ts | - Marked as deprecated - use packages/theme/composables/useBilling/index.ts instead, return values of the useBilling composable have been changed | +| packages/composables/src/composables/useCart/index.ts | - Marked as deprecated - use packages/theme/composables/useCart/index.ts instead, return values of the useCart composable have been changed | +| packages/composables/src/composables/useCategory/index.ts | - Marked as deprecated - use packages/theme/modules/catalog/category/composables/useCategory/index.ts instead,return values of the useCategory composable have been changed | +| packages/composables/src/composables/useCategorySearch/index.ts | - Marked as deprecated - use packages/theme/modules/catalog/category/composables/useCatgegorySearch/index.ts instead | +| packages/composables/src/composables/useConfig/index.ts | - Marked as deprecated - use packages/theme/composables/useConfig/index.ts instead | +| packages/composables/src/composables/useContent/index.ts | - Marked as deprecated - use packages/theme/composables/useContent/index.ts instead, return values of the useContent composable have been changed | +| packages/composables/src/composables/useCountrySearch/index.ts | - Marked as deprecated - use packages/theme/composables/useCountry/index.ts instead, return values of the useCountrySearch composable have been changed | +| packages/composables/src/composables/useCurrency/index.ts | - Marked as deprecated - use packages/theme/composables/useCurrency/index.ts instead, return values of the useCurrency composable have been changed | +| packages/composables/src/composables/useCustomMutation/index.ts | - Marked as deprecated - use the useApi composable to send custom mutations | +| packages/composables/src/composables/useCustomQuery/index.ts | - Marked as deprecated - use the useApi composable to send custom mutations | +| packages/composables/src/composables/useExternalCheckout/index.ts | - Marked as deprecated - use packages/theme/composables/useExternalCheckout/index.ts instead | +| packages/composables/src/composables/useFacet/index.ts | - Marked as deprecated - use packages/theme/composables/useFacet/index.ts instead | +| packages/composables/src/composables/useForgotPassword/index.ts | - Marked as deprecated - use packages/theme/modules/customer/composables/useForgotPassword/index.ts instead | +| packages/composables/src/composables/useGetShippingMethods/index.ts | - Marked as deprecated - use packages/theme/composables/useGetShippingMethods/index.ts instead, return values of the useGetShippingMethods composable have been changed | +| packages/composables/src/composables/useGuestUser/index.ts | - Marked as deprecated - use packages/theme/modules/customer/composables/useGuestUser/index.ts instead, return values of the useGuestUser composable have been changed | +| packages/composables/src/composables/useMakeOrder/index.ts | - Marked as deprecated - use packages/theme/composables/useMakeOrder/index.ts instead, return values of the useMakeOrder composable have been changed | +| packages/composables/src/composables/useNewsletter/index.ts | - Marked as deprecated - use packages/theme/composables/useNewsletter/index.ts instead | +| packages/composables/src/composables/usePaymentProvider/index.ts | - Marked as deprecated - use packages/theme/composables/usePaymentProvider/index.ts instead, return values of the usePaymentProvider composable have been changed | +| packages/composables/src/composables/useProduct/index.ts | - Marked as deprecated - use packages/theme/modules/catalog/product/composables/useProduct/index.ts instead, return values of the useProduct composable have been changed | +| packages/composables/src/composables/useRelatedProducts/index.ts | - Marked as deprecated - use packages/theme/modules/catalog/product/composables/useRelatedProducts/index.ts instead, return values of the useRelatedProducts composable have been changed | +| packages/composables/src/composables/useReview/index.ts | - Marked as deprecated - use packages/theme/composables/useReview/index.ts instead, return values of the useReview composable have been changed | +| packages/composables/src/composables/useShipping/index.ts | - Marked as deprecated - use packages/theme/composables/useShipping/index.ts instead, return values of the useShipping composable have been changed | +| packages/composables/src/composables/useShippingProvider/index.ts | - Marked as deprecated - use packages/theme/composables/useShippingProvider/index.ts instead, return values of the useShippingProvider composable have been changed | +| packages/composables/src/composables/useStore/index.ts | - Marked as deprecated - use packages/theme/composables/useStore/index.ts instead, return values of the useStore composable have been changed | +| packages/composables/src/composables/useUpsellProducts/index.ts | - Marked as deprecated - use packages/theme/modules/catalog/product/composables/useUpsellProducts/index.ts instead, return values of the useUpsellProducts composable have been changed | +| packages/composables/src/composables/useUrlResolver/index.ts | - Marked as deprecated - use packages/theme/composables/useUrlResolver/index.ts instead, return values of the useUrlResolver composable have been changed | +| packages/composables/src/composables/useUser/index.ts | - Marked as deprecated - use packages/theme/modules/customer/composables/useUser/index.ts instead, return values of the useUser composable have been changed | +| packages/composables/src/composables/useUserBilling/index.ts | - Marked as deprecated | +| packages/composables/src/composables/useUserShipping/index.ts | - Marked as deprecated | +| packages/composables/src/composables/useUserOrder/index.ts | - Marked as deprecated - use packages/theme/modules/customer/composables/useUserOrder/index.ts instead, return values of the useUserOrder composable have been changed | +| packages/composables/src/composables/useWishlist/index.ts | - Marked as deprecated - use packages/theme/modules/wishlist/composables/useWishlist/index.ts instead, return values of the useWishlist composable have been changed | +| packages/composables/src/getters/_utils.ts | - marked as deprecated. Use packages/theme/getters/_utils.ts instead | +| packages/composables/src/getters/addressGetter.ts | - marked as deprecated. Use packages/theme/modules/customer/getters/addressGetter.ts instead | +| packages/composables/src/getters/cartGetters.ts | - marked as deprecated. Use packages/theme/getters/cartGetters.ts instead | +| packages/composables/src/getters/categoryGetters.ts | - marked as deprecated | +| packages/composables/src/getters/checkoutGetters.ts | - marked as deprecated. Use packages/theme/getters/checkoutGetters.ts instead | +| packages/composables/src/getters/facetGetters.ts | - marked as deprecated. Use packages/theme/getters/packages/theme/getters/facetGetters.ts instead | +| packages/composables/src/getters/forgotPasswordGetters.ts | - marked as deprecated. | +| packages/composables/src/getters/orderGetters.ts | - marked as deprecated. Use packages/theme/getters/packages/theme/getters/orderGetters.ts instead | +| packages/composables/src/getters/productGetters.ts | - marked as deprecated. Use packages/theme/modules/catalog/product/getters/productGetters.ts instead | +| packages/composables/src/getters/reviewGetters.ts | - marked as deprecated. Use packages/theme/getters/packages/theme/getters/reviewGetters.ts instead | +| packages/composables/src/getters/storeConfigGetters.ts | - marked as deprecated. Use packages/theme/getters/packages/theme/getters/storeConfigGetters.ts instead | +| packages/composables/src/getters/storeGetters.ts | - marked as deprecated. Use packages/theme/getters/packages/theme/getters/storeGetters.ts instead | +| packages/composables/src/getters/userAddressesGetters.ts | - marked as deprecated. Use packages/theme/modules/customer/getters/userAddressesGetters.ts instead | +| packages/composables/src/getters/userBillingGetters.ts | - marked as deprecated. Use packages/theme/modules/customer/getters/userBillingGetters.ts instead | +| packages/composables/src/getters/userGetters.ts | - marked as deprecated. Use packages/theme/modules/customer/getters/userGetters.ts instead | +| packages/composables/src/getters/userShippingGetters.ts | - marked as deprecated. Use packages/theme/modules/customer/getters/userShippingGetters.ts instead | +| packages/composables/src/getters/wishlistGetters.ts | - marked as deprecated. Use packages/theme/getters/packages/theme/getters/wishlistGetters.ts instead | +| packages/composables/src/helpers/buildCategoryTree.ts | - marked as deprecated | +| packages/composables/src/helpers/compareWishlist.ts | - marked as deprecated | +| packages/composables/src/helpers/findItemOnWishlist.ts | - marked as deprecated. Use packages/theme/modules/wishlist/helpers/findItemOnWishlist.ts instead | +| packages/composables/src/helpers/htmlDecoder.ts | - marked as deprecated. Use packages/theme/modules/wishlist/helpers/htmlDecoder.ts instead | +| packages/composables/src/helpers/userAddressManipulator.ts | - marked as deprecated. Use packages/theme/modules/customer/helpers/userAddressManipulator.ts instead | +| packages/composables/src/helpers/userDataGenerator.ts | - marked as deprecated. Use packages/theme/modules/customer/helpers/generateUserData.ts instead | + +## Theme + +In this document, we described the most crucial changes. We recommend checking each component/template to see all changes. + +| File | what and how it changed | +|--------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------| +| packages/theme/.env.example | Variables’ names have been changed | +| packages/theme/components/Category/CategorySidebarMenu.vue | The component has been removed | +| packages/theme/components/Header/SearchBar/SearchResults.vue | Search results for categories have been removed | +| packages/theme/components/MobileMenuSidebar.vue | The component has been removed | +| packages/theme/components/Products/BundleProductSelector.vue | The component has been removed. Use packages/theme/modules/catalog/product/components/BundleProductSelector.vue instead | +| packages/theme/components/UpsellProducts.vue | The component has been removed | +| packages/theme/config.js | This file has been deleted. Use ENV variables instead | + +## API Client + +| File | what and how it changed | +|------------------------------------------|---------------------------------------------------------------------------| +| packages/api-client/package.json | - agentkeepalive dependency has been added, npm scripts have been updated | +| packages/api-client/possible-types.js | Magento URL env variable name has been changed | +| packages/api-client/src/types/GraphQL.ts | types have been updated | +| packages/api-client/src/types/setup.ts | types have been updated | diff --git a/docs/migration-guides/index.md b/docs/migration-guides/index.md new file mode 100644 index 000000000..eda652111 --- /dev/null +++ b/docs/migration-guides/index.md @@ -0,0 +1,3 @@ +# Migration guides + +- [1.0.0-rc.7](./1.0.0-rc.7/) diff --git a/internals/eslint-import/package.json b/internals/eslint-import/package.json index c50ed6a06..aa57a97e8 100644 --- a/internals/eslint-import/package.json +++ b/internals/eslint-import/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/eslint-config-import", - "version": "1.0.0-rc.6", + "version": "1.0.0-rc.7", "author": "Heitor Ramon Ribeiro ", "license": "MIT", "scripts": { diff --git a/internals/eslint-jest/package.json b/internals/eslint-jest/package.json index 418868040..05e93deb1 100644 --- a/internals/eslint-jest/package.json +++ b/internals/eslint-jest/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/eslint-config-jest", - "version": "1.0.0-rc.6", + "version": "1.0.0-rc.7", "author": "Heitor Ramon Ribeiro ", "license": "MIT", "scripts": { diff --git a/internals/eslint-typescript/package.json b/internals/eslint-typescript/package.json index d69df46b7..f07801f2f 100644 --- a/internals/eslint-typescript/package.json +++ b/internals/eslint-typescript/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/eslint-config-typescript", - "version": "1.0.0-rc.6", + "version": "1.0.0-rc.7", "author": "Heitor Ramon Ribeiro ", "license": "MIT", "scripts": { diff --git a/internals/eslint-vue/package.json b/internals/eslint-vue/package.json index 5c7f68790..0f465e077 100644 --- a/internals/eslint-vue/package.json +++ b/internals/eslint-vue/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/eslint-config-vue", - "version": "1.0.0-rc.6", + "version": "1.0.0-rc.7", "author": "Heitor Ramon Ribeiro ", "license": "MIT", "scripts": { diff --git a/internals/eslint/package.json b/internals/eslint/package.json index a78c451b5..429bc2761 100644 --- a/internals/eslint/package.json +++ b/internals/eslint/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/eslint-config-base", - "version": "1.0.0-rc.6", + "version": "1.0.0-rc.7", "author": "Heitor Ramon Ribeiro ", "license": "MIT", "scripts": { diff --git a/package.json b/package.json index 3e16b983b..16d96e997 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "internals/*" ], "scripts": { - "build": "yarn build:api-client && yarn build:theme && yarn build:composables", + "build": "yarn build:api-client && yarn build:theme", "build:api-client": "cd packages/api-client && yarn build", "build:theme": "cd packages/theme && yarn build", "build:composables": "cd packages/composables && yarn build", @@ -26,6 +26,7 @@ "lint": "eslint . --ext .ts,.vue", "prepare": "[ -d '.husky' ] && (husky install && shx rm -rf .git/hooks && shx ln -s ../.husky .git/hooks) || true", "publish:api-client": "node ./scripts/publishApi.js", + "publish:composables": "node ./scripts/publishComposable.js", "start": "cd packages/theme && yarn start", "test": "yarn test:api-client && yarn test:theme", "test:api-client": "cd packages/api-client && yarn test --passWithNoTests", diff --git a/packages/api-client/README.md b/packages/api-client/README.md index ac5c3cf50..87ba9b077 100644 --- a/packages/api-client/README.md +++ b/packages/api-client/README.md @@ -30,7 +30,7 @@ vsf init && cd && yarn && yarn dev ## How to start if you want to contribute? -Want to contribute? Ping us on `magento2-vsf2` channel on [our Discord](http://discord.vuestorefront.io)! +Want to contribute? Ping us on `magento2` channel on [our Discord](http://discord.vuestorefront.io)! ### Requirements: - NodeJS v16 or later @@ -91,11 +91,12 @@ Find more information about the module [GraphQl Custom Config](https://github.co ## Support -If you have any questions about this integration we will be happy to answer them on `magento2-vsf2` channel on [our Discord](http://discord.vuestorefront.io). +If you have any questions about this integration we will be happy to answer them on `magento2` channel on [our Discord](http://discord.vuestorefront.io). ## Contributors ✨ ### Honorable Mentions +- [Caravel x](https://www.caravelx.com/) - [Cyberfuze](https://cyberfuze.com/) - [Leonex](https://www.leonex.de/) @@ -114,18 +115,24 @@ Thanks go to these wonderful people πŸ™Œ:
Patrick Monteiro

πŸ’» -
Kevin Gorjan

πŸ’» -
Bartosz Herba

πŸ’» -
Marcin Kwiatkowski

πŸ’» πŸ“† +
Kevin Gorjan

πŸ’» πŸ“– +
Bartosz Herba

πŸ’» πŸ“– 🚧 πŸ§‘β€πŸ« πŸ‘€ +
Marcin Kwiatkowski

πŸ’» πŸ“† πŸ’Ό πŸ“– πŸ€” 🚧 πŸ§‘β€πŸ« πŸ‘€
Filip Rakowski

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ -
Filip Sobol

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ +
Filip Sobol

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ πŸ“–
Patryk Andrzejewski

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€
Renan Oliveira

πŸ”§ πŸ”Œ
Dominik Deimel

πŸ’» πŸ“–
Lior Lindvor

πŸ’» + +
Artur Tagisow

πŸ’» +
Jonathan Ribas

πŸ’» +
Ali Ghanei

πŸ’» +
Maya Shavin

πŸ“– + @@ -134,4 +141,3 @@ Thanks go to these wonderful people πŸ™Œ: This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! - diff --git a/packages/api-client/package.json b/packages/api-client/package.json index 0416031a7..c8c32c79e 100644 --- a/packages/api-client/package.json +++ b/packages/api-client/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/magento-api", - "version": "1.0.0-rc.6", + "version": "1.0.0-rc.7", "sideEffects": false, "homepage": "https://github.com/vuestorefront/magento2", "bugs": { diff --git a/packages/composables/README.md b/packages/composables/README.md index ac00d9f78..8c0ad9648 100644 --- a/packages/composables/README.md +++ b/packages/composables/README.md @@ -30,7 +30,7 @@ vsf init && cd && yarn && yarn dev ## How to start if you want to contribute? -Want to contribute? Ping us on `magento2-vsf2` channel on [our Discord](http://discord.vuestorefront.io)! +Want to contribute? Ping us on `magento2` channel on [our Discord](http://discord.vuestorefront.io)! ### Requirements: - NodeJS v16 or later @@ -91,11 +91,12 @@ Find more information about the module [GraphQl Custom Config](https://github.co ## Support -If you have any questions about this integration we will be happy to answer them on `magento2-vsf2` channel on [our Discord](http://discord.vuestorefront.io). +If you have any questions about this integration we will be happy to answer them on `magento2` channel on [our Discord](http://discord.vuestorefront.io). ## Contributors ✨ ### Honorable Mentions +- [Caravel x](https://www.caravelx.com/) - [Cyberfuze](https://cyberfuze.com/) - [Leonex](https://www.leonex.de/) @@ -114,18 +115,24 @@ Thanks go to these wonderful people πŸ™Œ:
Patrick Monteiro

πŸ’» -
Kevin Gorjan

πŸ’» -
Bartosz Herba

πŸ’» -
Marcin Kwiatkowski

πŸ’» πŸ“† +
Kevin Gorjan

πŸ’» πŸ“– +
Bartosz Herba

πŸ’» πŸ“– 🚧 πŸ§‘β€πŸ« πŸ‘€ +
Marcin Kwiatkowski

πŸ’» πŸ“† πŸ’Ό πŸ“– πŸ€” 🚧 πŸ§‘β€πŸ« πŸ‘€
Filip Rakowski

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ -
Filip Sobol

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ +
Filip Sobol

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ πŸ“–
Patryk Andrzejewski

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€
Renan Oliveira

πŸ”§ πŸ”Œ
Dominik Deimel

πŸ’» πŸ“–
Lior Lindvor

πŸ’» + +
Artur Tagisow

πŸ’» +
Jonathan Ribas

πŸ’» +
Ali Ghanei

πŸ’» +
Maya Shavin

πŸ“– + @@ -134,4 +141,3 @@ Thanks go to these wonderful people πŸ™Œ: This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! - diff --git a/packages/composables/package.json b/packages/composables/package.json index e4ce1b83a..150486ea5 100644 --- a/packages/composables/package.json +++ b/packages/composables/package.json @@ -1,25 +1,19 @@ { "name": "@vue-storefront/magento", - "version": "1.0.0-rc.6", + "version": "1.0.0-rc.7", "license": "MIT", "homepage": "https://github.com/vuestorefront/magento2", "bugs": { "url": "https://github.com/vuestorefront/magento2/issues" }, "sideEffects": false, - "main": "./lib/index.js", - "exports": { - ".": "./lib/index.js", - "./nuxt": "./nuxt/index.js", - "./package.json": "./package.json" - }, + "main": "lib/index.cjs.js", + "module": "lib/index.es.js", + "tsModule": "src/index.ts", "types": "lib/index.d.ts", "scripts": { - "build": "yarn build:clear && yarn build:package && yarn build:types", - "build:clear": "rimraf lib", - "build:package": "node ../../scripts/build --file=src/index.ts", - "build:types": "tsc --emitDeclarationOnly", - "dev": "yarn build:package --watch", + "build": "rimraf lib && rollup -c", + "dev": "rimraf lib && rollup -c -w", "lint:fix": "eslint ./src --ext .ts,.vue --fix", "precommit": "lint-staged", "prepublish": "yarn build", @@ -28,8 +22,8 @@ "update:update": "ncu -u" }, "dependencies": { - "@vue-storefront/core": "~2.5.6", - "@vue-storefront/magento-api": "^1.0.0-rc.6", + "@vue-storefront/core": "~2.5.3", + "@vue-storefront/magento-api": "1.0.0-rc.5.2.2", "@vue/composition-api": "^1.4.1", "cookie-universal": "^2.1.5", "vue": "^2.6.14", diff --git a/packages/composables/src/composables/useCustomQuery/index.ts b/packages/composables/src/composables/useCustomQuery/index.ts index 766e0d46c..fd14f404f 100644 --- a/packages/composables/src/composables/useCustomQuery/index.ts +++ b/packages/composables/src/composables/useCustomQuery/index.ts @@ -8,6 +8,10 @@ import { } from '../../factories/useCustomQueryFactory'; import { FetchPolicy } from '../../types'; +/** + * @deprecated Will be removed in 1.1.0 release + * @use @vue-storefront/magento-theme/composables/useApi instead + */ export default useCustomQueryFactory({ query: async (context: Context, { query, diff --git a/packages/composables/src/factories/useCustomQueryFactory.ts b/packages/composables/src/factories/useCustomQueryFactory.ts index ddfc88631..9ea5b52f2 100644 --- a/packages/composables/src/factories/useCustomQueryFactory.ts +++ b/packages/composables/src/factories/useCustomQueryFactory.ts @@ -14,6 +14,10 @@ import { computed } from '@vue/composition-api'; import { FetchPolicy } from '../types'; import { UseCustomQuery } from '../types/composables'; +/** + * @deprecated Will be removed in 1.1.0 release + * @use @vue-storefront/magento-theme/composables/useApi instead + */ export interface UseCustomQueryFactoryFactoryParams extends FactoryParams { query: (context: Context, { variables, diff --git a/packages/theme/README.md b/packages/theme/README.md index 0d7928a01..c5247cf11 100644 --- a/packages/theme/README.md +++ b/packages/theme/README.md @@ -55,6 +55,7 @@ For detailed explanation on how things work, check out [Nuxt.js docs](https://nu ## Contributors ✨ ### Honorable Mentions +- [Caravel x](https://www.caravelx.com/) - [Cyberfuze](https://cyberfuze.com/) - [Leonex](https://www.leonex.de/) @@ -73,18 +74,24 @@ Thanks go to these wonderful people πŸ™Œ:
Patrick Monteiro

πŸ’» -
Kevin Gorjan

πŸ’» -
Bartosz Herba

πŸ’» -
Marcin Kwiatkowski

πŸ’» πŸ“† +
Kevin Gorjan

πŸ’» πŸ“– +
Bartosz Herba

πŸ’» πŸ“– 🚧 πŸ§‘β€πŸ« πŸ‘€ +
Marcin Kwiatkowski

πŸ’» πŸ“† πŸ’Ό πŸ“– πŸ€” 🚧 πŸ§‘β€πŸ« πŸ‘€
Filip Rakowski

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ -
Filip Sobol

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ +
Filip Sobol

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€ πŸ“–
Patryk Andrzejewski

πŸ’¬ πŸ§‘β€πŸ« πŸ‘€
Renan Oliveira

πŸ”§ πŸ”Œ
Dominik Deimel

πŸ’» πŸ“–
Lior Lindvor

πŸ’» + +
Artur Tagisow

πŸ’» +
Jonathan Ribas

πŸ’» +
Ali Ghanei

πŸ’» +
Maya Shavin

πŸ“– + diff --git a/packages/theme/package.json b/packages/theme/package.json index 71d08ac98..6f67cefc3 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/magento-theme", - "version": "1.0.0-rc.6", + "version": "1.0.0-rc.7", "private": true, "license": "MIT", "homepage": "https://github.com/vuestorefront/magento2", diff --git a/yarn.lock b/yarn.lock index daad72c3b..74c86d726 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16,6 +16,24 @@ dependencies: "@types/throttle-debounce" "^2.1.0" +"@apollo/client@^3.5.6": + version "3.6.5" + resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.6.5.tgz#6a7baaf05852187b0eac1c6064e721d47326d70c" + integrity sha512-xGAZzv1f5abyH45MSU5eOLyGQuP4Ps0OhP36pSCtt6pCICI3n4yDkdftFCPvqDVqVTuciX1kkyeJPfGodz5kwg== + dependencies: + "@graphql-typed-document-node/core" "^3.1.1" + "@wry/context" "^0.6.0" + "@wry/equality" "^0.5.0" + "@wry/trie" "^0.3.0" + graphql-tag "^2.12.6" + hoist-non-react-statics "^3.3.2" + optimism "^0.16.1" + prop-types "^15.7.2" + symbol-observable "^4.0.0" + ts-invariant "^0.10.3" + tslib "^2.3.0" + zen-observable-ts "^1.2.5" + "@apollo/client@^3.5.8", "@apollo/client@~3.2.5 || ~3.3.0 || ~3.4.0 || ~3.5.0": version "3.5.10" resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.5.10.tgz#43463108a6e07ae602cca0afc420805a19339a71" @@ -1718,7 +1736,7 @@ tslib "~2.3.0" value-or-promise "1.0.11" -"@graphql-typed-document-node/core@^3.0.0": +"@graphql-typed-document-node/core@^3.0.0", "@graphql-typed-document-node/core@^3.1.1": version "3.1.1" resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.1.1.tgz#076d78ce99822258cf813ecc1e7fa460fa74d052" integrity sha512-NQ17ii0rK1b34VZonlmT2QMJFI70m0TRwbknO/ihlbatXyaktDhN/98vBiUU6kNBPljqGqyIrl2T4nY2RpFANg== @@ -4364,6 +4382,16 @@ dependencies: "@vue-storefront/core" "~2.5.6" +"@vue-storefront/core@~2.5.3": + version "2.5.13" + resolved "https://registry.yarnpkg.com/@vue-storefront/core/-/core-2.5.13.tgz#ad7cf7c8f7a51b521202c5cb81b0511c7f1ffab8" + integrity sha512-o8mS+nha9FYgYaQdFKYbx0WEx2qtYErjeqGgtdCC1F435SliVctuxhBg5CxGkPPfk6tGO7BBAaOWMUr5Qp5ZFg== + dependencies: + axios "0.21.1" + express "^4.17.1" + lodash-es "^4.17.15" + vue "^2.6.11" + "@vue-storefront/core@~2.5.6": version "2.5.6" resolved "https://registry.yarnpkg.com/@vue-storefront/core/-/core-2.5.6.tgz#dfbfce48487a9a4a6b34576fb23d625ed0ebfada" @@ -4375,6 +4403,16 @@ lodash-es "^4.17.15" vue "^2.6.11" +"@vue-storefront/magento-api@1.0.0-rc.5.2.2": + version "1.0.0-rc.5.2.2" + resolved "https://registry.yarnpkg.com/@vue-storefront/magento-api/-/magento-api-1.0.0-rc.5.2.2.tgz#224e2880f2d7a5a5f90117fa7211823978893d98" + integrity sha512-acIvzcfOvyykCIqRbu+clZHPv/1WQwJTSba5X8Jtmm32V1B7nJjg1+NFAtzBmvNZFPQWIHD+2tz5KM0SSHpG0g== + dependencies: + "@apollo/client" "^3.5.6" + graphql "^16.2.0" + graphql-tag "^2.12.6" + isomorphic-fetch "^3.0.0" + "@vue-storefront/middleware@~2.5.6": version "2.5.6" resolved "https://registry.yarnpkg.com/@vue-storefront/middleware/-/middleware-2.5.6.tgz#ab9ba8e5b3ac15bc7b24a32ab3d9de5bcf0b7c7e" @@ -10412,6 +10450,11 @@ graphql@^15.5.1: resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.8.0.tgz#33410e96b012fa3bdb1091cc99a94769db212b38" integrity sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw== +graphql@^16.2.0: + version "16.5.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.5.0.tgz#41b5c1182eaac7f3d47164fb247f61e4dfb69c85" + integrity sha512-qbHgh8Ix+j/qY+a/ZcJnFQ+j8ezakqPiHwPiZhV/3PgGlgf96QMBB5/f2rkiC9sgLoy/xvT6TSiaf2nTHJh5iA== + growl@1.10.5: version "1.10.5" resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" @@ -18917,6 +18960,13 @@ trim-newlines@^3.0.0: resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== +ts-invariant@^0.10.3: + version "0.10.3" + resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.10.3.tgz#3e048ff96e91459ffca01304dbc7f61c1f642f6c" + integrity sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ== + dependencies: + tslib "^2.1.0" + ts-invariant@^0.9.4: version "0.9.4" resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.9.4.tgz#42ac6c791aade267dd9dc65276549df5c5d71cac" @@ -20479,6 +20529,13 @@ zen-observable-ts@^1.2.0: dependencies: zen-observable "0.8.15" +zen-observable-ts@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz#6c6d9ea3d3a842812c6e9519209365a122ba8b58" + integrity sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg== + dependencies: + zen-observable "0.8.15" + zen-observable@0.8.15: version "0.8.15" resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15"