This repository has been archived by the owner on Apr 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cee0f5e
commit b1ea206
Showing
73 changed files
with
8,537 additions
and
926 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"schema": "http://localhost:10645/graphql", | ||
"documents": "./src/api/**/*.(graphql|gql|ts)", | ||
"generates": { | ||
"./src/graphql/types.ts": { | ||
"plugins": [ | ||
{ "add": { "content": "// This file was generated. Do not edit manually.\n/* eslint-disable */\n" } }, | ||
"typescript", | ||
"typescript-operations" | ||
] | ||
} | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
packages/api-client/src/api/addOrUpdateCartPayment/addOrUpdateCartPaymentMutation.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,11 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export default gql` | ||
mutation AddOrUpdateCartPayment($command: InputAddOrUpdateCartPaymentType!) { | ||
addOrUpdateCartPayment(command: $command) { | ||
name | ||
} | ||
} | ||
`; | ||
|
||
|
25 changes: 25 additions & 0 deletions
25
packages/api-client/src/api/addOrUpdateCartPayment/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,25 @@ | ||
import { | ||
AddOrUpdateCartPaymentMutation, | ||
AddOrUpdateCartPaymentMutationVariables, | ||
CartType, | ||
InputPaymentType | ||
} from '../../graphql/types'; | ||
import mutationDocument from './addOrUpdateCartPaymentMutation'; | ||
|
||
const addOrUpdateCartPayment = async ({ config, client }, cart: CartType, payment: InputPaymentType): Promise<void> => { | ||
const { store, getUserId, currency, locale } = config; | ||
const { data } = await client.mutate({ | ||
mutation: mutationDocument, | ||
variables: { | ||
command: { | ||
payment: payment, | ||
storeId: store, | ||
userId: getUserId(), | ||
currency: currency, | ||
language: locale, | ||
} | ||
} | ||
}); | ||
}; | ||
|
||
export default addOrUpdateCartPayment; |
11 changes: 11 additions & 0 deletions
11
packages/api-client/src/api/addOrUpdateCartShipment/addOrUpdateCartShipmentMutation.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,11 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export default gql` | ||
mutation AddOrUpdateCartShpment($command: InputAddOrUpdateCartShipmentType!) { | ||
addOrUpdateCartShipment(command: $command) { | ||
name | ||
} | ||
} | ||
`; | ||
|
||
|
25 changes: 25 additions & 0 deletions
25
packages/api-client/src/api/addOrUpdateCartShipment/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,25 @@ | ||
import { | ||
AddOrUpdateCartShpmentMutation, | ||
AddOrUpdateCartShpmentMutationVariables, | ||
CartType, | ||
InputShipmentType | ||
} from '../../graphql/types'; | ||
import mutationDocument from './addOrUpdateCartShipmentMutation'; | ||
|
||
const addOrUpdateCartShipment = async ({ config, client }, cart: CartType, shipment: InputShipmentType): Promise<void> => { | ||
const { store, getUserId, currency, locale } = config; | ||
const { data } = await client.mutate({ | ||
mutation: mutationDocument, | ||
variables: { | ||
command: { | ||
shipment: shipment, | ||
storeId: store, | ||
userId: getUserId(), | ||
currency: currency, | ||
language: locale, | ||
}, | ||
} | ||
}); | ||
}; | ||
|
||
export default addOrUpdateCartShipment; |
12 changes: 12 additions & 0 deletions
12
packages/api-client/src/api/addToCart/addToCartMutation.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,12 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export default gql` | ||
mutation AddItem($command: InputAddItemType!) { | ||
addItem(command: $command) { | ||
name, | ||
itemsQuantity | ||
} | ||
} | ||
`; | ||
|
||
|
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,27 @@ | ||
import { | ||
CartType, | ||
Product, | ||
AddItemMutation, | ||
AddItemMutationVariables, | ||
} from '../../graphql/types'; | ||
import mutationDocument from './addToCartMutation'; | ||
|
||
const addToCart = async ({ config, client }, cart: CartType, product: Product, qty: number): Promise<CartType> => { | ||
const { store, getUserId, currency, locale } = config; | ||
const { data } = await client.mutate({ | ||
mutation: mutationDocument, | ||
variables: { | ||
command: { | ||
productId: product.id, | ||
quantity: qty, | ||
storeId: store, | ||
userId: getUserId(), | ||
currency: currency, | ||
language: locale, | ||
}, | ||
} | ||
}); | ||
return data?.addItem; | ||
}; | ||
|
||
export default addToCart; |
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,9 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export default gql` | ||
mutation ClearCart($command: InputClearCartType!) { | ||
clearCart(command: $command) { | ||
itemsCount | ||
} | ||
} | ||
`; |
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,23 @@ | ||
import { | ||
CartType, | ||
ClearCartMutation, | ||
ClearCartMutationVariables, | ||
} from '../../graphql/types'; | ||
import mutationDocument from './clearCartMutation'; | ||
|
||
const clearCart = async ({ config, client }, cart: CartType): Promise<void> => { | ||
const { store, getUserId, currency, locale } = config; | ||
const { data } = await client.mutate({ | ||
mutation: mutationDocument, | ||
variables: { | ||
command: { | ||
storeId: store, | ||
userId: getUserId(), | ||
currency: currency, | ||
language: locale, | ||
}, | ||
} | ||
}); | ||
}; | ||
|
||
export default clearCart; |
Oops, something went wrong.