diff --git a/.github/probots.yml b/.github/probots.yml new file mode 100644 index 000000000..1491d2756 --- /dev/null +++ b/.github/probots.yml @@ -0,0 +1,2 @@ +enabled: + - cla diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e97df425..a332447c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,36 @@ # Changelog +### v2.0.0 (January 3, 2019) +- Fetch `collections`, `products`, `collectionByHandle` and `productByHandle` from the QueryRoot instead of from the Shop object. +- Return `checkoutUserErrors` instead of `userErrors` when present. This will add an extra field called code. +- Expose `checkoutLineItemsReplace` mutation (to replace deprecated `checkoutLineItemsAdd`, `checkoutLineItemsRemove`, and `checkoutLineItemsUpdate` mutations). +- Remove unused fixtures + +### v1.11.0 (November 27, 2018) +- Added availableForSale field to Product query fragment +- Removed tags field from Product query fragment +- Add field aliasing to deprecated fields in affected query fragments: + - availableForSale on VariantFragment + - countryCode on CheckoutFragment + - src on CollectionFragment and VariantFragment + +### v1.10.0 (November 7, 2018) +- Updates deprecated Storefront API methods used for some checkout mutations. + +### v1.9.1 (October 24, 2018) +- Specifies pageInfo for discountApplications connection + +### [UNSAFE] v1.9.0 (October 23, 2018) +- Updates schema.json +- Support checkoutDiscountCodeRemove mutation +- Exposes discounts on the checkout Object +- Allows a null checkout response from CheckoutResource.fetch (#563) + +### v1.8.0 (August 30, 2018) +- Support checkoutEmailUpdate mutation + ### v0.1.3 (March 30, 2016) -- Adds IE9 support for `atob` and `btoa` using polyfills via #52 -- Cleans up some deployment noise (#54). Thanks @tessalt +- Adds IE9 support for `atob` and `btoa` using polyfills via #52 +- Cleans up some deployment noise (#54). Thanks @tessalt ### v0.1.0 (March 22, 2016) - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1c95e11f4..f10c88d6b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,10 +64,11 @@ The following documents the folder structure for this project and what the purpo See [here](https://github.com/Shopify/js-buy-sdk/blob/master/examples) for our examples. ## Documentation -If your change affects how people use the project (i.e. adding or -changing arguments to a function, adding a new function, changing the -return value, etc), please ensure the documentation is also updated to -reflect this. The docs live inside the `docs/` folder and are hosted +Please do not update documentation, as this may cause +merge conflicts. After a pull request has been merged, the +maintainers will update documentation and release a new version. + +The docs live inside the `docs/` folder and are hosted at `http://shopify.github.io/js-buy-sdk`. To generate docs run the following: diff --git a/DEPLOYING.md b/DEPLOYING.md index 649dba7b6..028def08e 100644 --- a/DEPLOYING.md +++ b/DEPLOYING.md @@ -5,6 +5,20 @@ * write new version to package.json * create a commit with a commit message matching the version number * create a new tag matching the version number -3. Push the new commit and tags to master with `git push origin master --tags` -4. Create a release on Github. Include changelog in description -5. Deploy built scripts to s3 via [shipit](https://shipit.shopify.io/shopify/js-buy-sdk/production) +3. Push the new commit and tags to master with `git push && git push --tags` +4. Deploy built scripts to s3 via [shipit](https://shipit.shopify.io/shopify/js-buy-sdk/production) + +# Updating Documentation + +If your change affects how people use the project (i.e. adding or +changing arguments to a function, adding a new function, changing the +return value, etc), please ensure the documentation is also updated to +reflect this. The docs live inside the `docs/` folder and are hosted +at `http://shopify.github.io/js-buy-sdk`. + +Please update the docs in a separate PR from the code change. When the two are +updated together, the diff will be huge and it will be difficult to review. + +1. Generate documentation using `npm run doc:build` or `yarn doc:build` +2. Update the [Changelog](https://github.com/Shopify/js-buy-sdk/CHANGELOG.md) with details about the release. +3. Merge your branch into master diff --git a/README.md b/README.md index a1d4f9aaf..c4cd4e807 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ and provides the ability to retrieve products and collections from your shop, ad [Full API docs are available here](https://shopify.github.io/js-buy-sdk). +## Changelog + +View our [Changelog](https://github.com/Shopify/js-buy-sdk/blob/master/CHANGELOG.md) for details about our releases. + ## Table Of Contents - [Installation](#installation) @@ -43,10 +47,16 @@ $ npm install shopify-buy **CDN:** -There is a minified UMD build available via CDN: +There is a minified UMD build available via CDN (see the [Changelog](https://github.com/Shopify/js-buy-sdk/blob/master/CHANGELOG.md) for details about the latest release): + +```html + +``` + +You can also use a specific release version: ```html - + ``` ## Builds @@ -197,10 +207,19 @@ client.checkout.addDiscount(checkoutId, discountCode).then(checkout => { ### Removing a Discount ```javascript +<<<<<<< HEAD const checkoutId = 'Z2lkOi8vc2hvcGlmeS9DaGVja291dC9kMTZmM2EzMDM4Yjc4N='; client.checkout.removeDiscount(checkoutId).then((checkout) => { // Do something with the updated checkout +======= +const checkoutId = 'Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0SW1hZ2UvMTgyMTc3ODc1OTI='; // ID of an existing checkout + +// Removes the applied discount from an existing checkout. +client.checkout.removeDiscount(checkoutId).then(checkout => { + // Do something with the updated checkout + console.log(checkout); +>>>>>>> upstream/master }); ``` diff --git a/docs/CheckoutResource.html b/docs/CheckoutResource.html index 774d7496b..08e553cb2 100644 --- a/docs/CheckoutResource.html +++ b/docs/CheckoutResource.html @@ -93,7 +93,7 @@

new C
Source:
@@ -271,7 +271,7 @@

Parameters:
Source:
@@ -464,7 +464,7 @@
Parameters:
Source:
@@ -839,7 +839,7 @@
Properties
Source:
@@ -1012,7 +1012,7 @@
Parameters:
Source:
@@ -1179,7 +1179,7 @@
Parameters:
Source:
@@ -1346,7 +1346,7 @@
Parameters:
Source:
@@ -1538,7 +1538,7 @@
Parameters:
Source:
@@ -1607,6 +1607,199 @@
Example
+

replaceLineItems(checkoutId, lineItems) → {Promise|GraphModel}

+ + + + + + +
+

Replace line items on an existing checkout.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
checkoutId + + +String + + + +

The ID of the checkout to add line items to.

lineItems + + +Array.<Object> + + + +

A list of line items to set on the checkout. See the Storefront API reference for valid input fields for each line item.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise resolving with the updated checkout.

+
+ + + +
+
+ Type +
+
+ +Promise +| + +GraphModel + + +
+
+ + + + + + +
Example
+ +
const checkoutId = 'Z2lkOi8vc2hvcGlmeS9DaGVja291dC9kMTZmM2EzMDM4Yjc4N=';
+const lineItems = [{variantId: 'Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8yOTEwNjAyMjc5Mg==', quantity: 5}];
+
+client.checkout.replaceLineItems(checkoutId, lineItems).then((checkout) => {
+  // Do something with the updated checkout
+});
+ + + + + + + + +

updateAttributes(checkoutId, inputopt) → {Promise|GraphModel}

@@ -1878,7 +2071,7 @@
Properties
Source:
@@ -1947,6 +2140,199 @@
Example
+

updateEmail(checkoutId, email) → {Promise|GraphModel}

+ + + + + + +
+

Replaces the value of checkout's email address

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
checkoutId + + +String + + + +

The ID of the checkout to update.

email + + +String + + + +

The email address to apply to the checkout.

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise resolving with the updated checkout.

+
+ + + +
+
+ Type +
+
+ +Promise +| + +GraphModel + + +
+
+ + + + + + +
Example
+ +
const checkoutId = 'Z2lkOi8vc2hvcGlmeS9DaGVja291dC9kMTZmM2EzMDM4Yjc4N=';
+const email = 'user@example.com';
+
+client.checkout.updateEmail(checkoutId, email).then((checkout) => {
+  // Do something with the updated checkout
+});
+ + + + + + + + +

updateLineItems(checkoutId, lineItems) → {Promise|GraphModel}

@@ -2071,7 +2457,7 @@
Parameters:
Source:
@@ -2270,7 +2656,7 @@
Parameters:
Source:
@@ -2367,7 +2753,7 @@

Home

Classes