-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: added support for Virtual and Downloadable products (#199) * feat(downloadable products): created add query + async call * feat(downloadable products): updated schema.graphql * feat(downloadable products): added method and modified productDetail query * feat(downloadable products): added missing exports, methods and GraphQL types * feat(downloadable products): updated useCart so downloadable products can be added to the cart * feat(virtual product): updated graphql * feat(virtual products): created api method * feat(virtal product): updated useCart * feat(virtual products): added missing imports + TS interfaces * chore: updated README with new VSF brand * refactor(documentation): refine project setup description (#201) * fix(composables): remove redundant debugger statement (#202) * docs: add @bartoszherba as a contributor * chore: release 1.0.0-rc.4.1 Co-authored-by: Kevin Gorjan <[email protected]> Co-authored-by: Bartosz Herba <[email protected]>
- Loading branch information
1 parent
3a279b6
commit 4177abf
Showing
22 changed files
with
567 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
182 changes: 182 additions & 0 deletions
182
packages/api-client/src/api/addDownloadableProductsToCart/addDownloadableProductsToCart.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export default gql` | ||
mutation addDownloadableProductsToCart($input: AddDownloadableProductsToCartInput) { | ||
addDownloadableProductsToCart(input: $input) { | ||
cart { | ||
id | ||
is_virtual | ||
applied_coupons { | ||
code | ||
} | ||
prices { | ||
subtotal_excluding_tax { | ||
value | ||
}, | ||
subtotal_including_tax { | ||
value | ||
}, | ||
applied_taxes { | ||
amount { | ||
value | ||
}, | ||
label | ||
} | ||
discounts { | ||
amount { | ||
value | ||
}, | ||
label | ||
} | ||
grand_total { | ||
value | ||
} | ||
} | ||
items { | ||
uid | ||
product { | ||
uid | ||
__typename | ||
sku | ||
name | ||
stock_status | ||
only_x_left_in_stock | ||
rating_summary | ||
thumbnail { | ||
url | ||
position | ||
disabled | ||
label | ||
} | ||
url_key | ||
url_rewrites { | ||
url | ||
} | ||
price_range { | ||
maximum_price { | ||
final_price { | ||
currency | ||
value | ||
} | ||
regular_price { | ||
currency | ||
value | ||
} | ||
} | ||
minimum_price { | ||
final_price { | ||
currency | ||
value | ||
} | ||
regular_price { | ||
currency | ||
value | ||
} | ||
} | ||
} | ||
categories { | ||
uid | ||
name | ||
url_suffix | ||
url_path | ||
breadcrumbs { | ||
category_name, | ||
category_url_path | ||
} | ||
} | ||
review_count | ||
reviews { | ||
items { | ||
average_rating | ||
ratings_breakdown { | ||
name | ||
value | ||
} | ||
} | ||
} | ||
} | ||
prices { | ||
row_total { | ||
value | ||
} | ||
row_total_including_tax { | ||
value | ||
} | ||
total_item_discount { | ||
value | ||
} | ||
} | ||
quantity | ||
... on ConfigurableCartItem { | ||
configurable_options { | ||
configurable_product_option_uid | ||
option_label | ||
configurable_product_option_value_uid | ||
value_label | ||
} | ||
} | ||
... on BundleCartItem { | ||
bundle_options { | ||
uid | ||
label | ||
type | ||
values { | ||
id | ||
label | ||
price | ||
quantity | ||
} | ||
} | ||
} | ||
} | ||
total_quantity | ||
shipping_addresses { | ||
firstname | ||
lastname | ||
street | ||
city | ||
company | ||
region { | ||
code | ||
region_id | ||
label | ||
} | ||
postcode | ||
telephone | ||
country { | ||
code | ||
label | ||
} | ||
selected_shipping_method { | ||
carrier_code | ||
carrier_title | ||
method_code | ||
method_title | ||
amount { | ||
value | ||
currency | ||
} | ||
} | ||
} | ||
billing_address { | ||
firstname | ||
lastname | ||
street | ||
city | ||
company | ||
region { | ||
code | ||
region_id | ||
label | ||
} | ||
postcode | ||
telephone | ||
country { | ||
code | ||
label | ||
} | ||
} | ||
} | ||
} | ||
}`; |
17 changes: 17 additions & 0 deletions
17
packages/api-client/src/api/addDownloadableProductsToCart/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { FetchResult } from '@apollo/client'; | ||
import addDownloadableProductsToCart from './addDownloadableProductsToCart'; | ||
import { | ||
AddDownloadableProductsToCartInput, | ||
AddDownloadableProductsToCartMutation, | ||
AddDownloadableProductsToCartMutationVariables, | ||
} from '../../types/GraphQL'; | ||
import { Context } from '../../types/context'; | ||
|
||
export default async ( | ||
{ client }: Context, | ||
input: AddDownloadableProductsToCartInput, | ||
): Promise<FetchResult<AddDownloadableProductsToCartMutation>> => client | ||
.mutate<AddDownloadableProductsToCartMutation, AddDownloadableProductsToCartMutationVariables>({ | ||
mutation: addDownloadableProductsToCart, | ||
variables: { input }, | ||
}); |
Oops, something went wrong.