Commit Graph

3537 Commits

Author SHA1 Message Date
Shahed Nasser
b9995cf2a7 docs: added missing link (#1890) 2022-07-21 16:21:41 +03:00
Shahed Nasser
b2602fa9ed docs: improved digitalocean docs (#1889) 2022-07-21 15:22:29 +03:00
Shahed Nasser
ef84b104e6 docs: update heroku's documentation (#1881) 2022-07-20 12:24:59 +03:00
Shahed Nasser
45dcf420c6 docs: update Next.js documentation based on the new storefront (#1880)
* update next.js storefront docs

* made changes to Next.js sections
2022-07-20 12:08:08 +03:00
Sebastian Rindom
8c283ac3b0 fix(medusa): Calculated price on cart shipping options (#1878) 2022-07-20 11:04:31 +02:00
Adrien de Peretti
110c995a6a feat(medusa): Allow to query order/product by SC (#1867)
**What**

Allow to query the products and orders by sales channels

**How**

Updating the existing end points and repositories  (if necessary) to take a new query params that is sales_channel_id as an array of string

**Tests**

Add new integration tests

Fixes CORE-295
Fixes CORE-288
2022-07-19 16:54:20 +00:00
Shahed Nasser
f623a85c5d docs: improved qovery documentation (#1875)
* improved qovery guide

* added cli reference link
2022-07-19 18:14:55 +03:00
Sebastian Rindom
0e5f0d8cd6 fix(medusa-payment-klarna): Calculate shipping totals correctly (#1848) 2022-07-18 18:10:58 +02:00
Shahed Nasser
1029eca944 docs: added a dropdown for references (#1868) 2022-07-18 17:34:12 +03:00
Sebastian Rindom
4dd7fdf61c chore(medusa): Clean up atomicPhase usage (#1850) 2022-07-18 16:04:36 +02:00
Shahed Nasser
8c727f91f4 docs: added deploy to netlify button for admin (#1865)
* added deploy to netlify button

* chore: fix docs test error (#1866)

* added deploy to netlify button
2022-07-18 15:48:32 +03:00
Shahed Nasser
6ed97e2ae0 chore: fix docs test error (#1866) 2022-07-18 15:30:13 +03:00
Derek Wene
f5091c6370 feat(medusa): Add events for creating, updating, and deleting users to event bus (#1836) 2022-07-17 16:02:03 +02:00
Sergio Leon
33bb67bfb9 docs: fix typo in QuickStart next actions (#1861)
check our the… -> check out the…
2022-07-16 23:48:01 +02:00
Shahed Nasser
e134f6d237 chore: fixed commit branch on generate reference action (#1857)
* fixed commit branch

* fixes after yarn upgrade
2022-07-15 18:08:07 +03:00
chemicalkosek
32b066d923 Update to correct placement of webhook secret. (#1856)
Currently the docs say to copy the webhook secret from top right corner which starts with `we_`.
This is not the webhook secret. This is webhook id.
2022-07-15 13:36:17 +02:00
Oliver Windall Juhl
dafbfa7799 fix(medusa): Create tax lines when marking DraftOrder as paid (#1852) 2022-07-15 11:57:46 +02:00
Sebastian Rindom
c148064b4a fix(medusa): accept array of region ids in order filter (#1851) 2022-07-15 05:41:24 +00:00
Adrien de Peretti
f35ea5156a feat(medusa, medusa-js, medusa-react): Bulk add Products to a SalesChannel (#1833) 2022-07-14 16:39:44 +02:00
Adrien de Peretti
cdd91974f9 feat(medusa, medusa-js, medusa-react): Start implementing remove batch products on a sales channel (#1842)
What
Support sales channel remove product batch in medusa, medusa-js and medusa-react

How
By implementing a new endpoint and the associated service method as well as the repository methods.

Medusa-js new removeProductd method in the resource

Medusa-react new hook in the mutations

Tests

Endpoint test
Service test
Integration test
Hook tests

Fixes CORE-292
2022-07-13 19:40:23 +00:00
Oliver Windall Juhl
7162972318 fix(medusa): Free text search for PriceList Products (#1843)
**What**
Fixes #1831 and #1336
2022-07-13 14:06:33 +00:00
Kasper Fabricius Kristensen
cbdc5b7774 fix(gatsby-source-medusa): Unsupported exports warning and schema (#1463)
**What**

- Moves `sourceUpdatedNodes` and `sourceAllNodes` to a separate file, to prevent warning of unsupported exports. See #1455.
- Adds warnings if `GET /store/products`, `GET /store/regions`, and `GET /store/collections` return empty arrays. This should help new users more easily figure out why their storefronts does not work as expected.
- Adds schema to plugin, so that node types for products, regions and collections are always created. This will prevent errors such as `allMedusaRegions query failed` from happening in the storefront, as the query will be valid as the type exists, even if it returns nothing. This should make the gatsby plugin/starter easier to use. This error is an reoccurring issue in our discord, when new users try to run the Gatsby starter without seeding the storefront beforehand. 

Resolves #1455 

Co-authored-by: Sebastian Rindom <7554214+srindom@users.noreply.github.com>
2022-07-13 12:42:06 +00:00
Adrien de Peretti
a1a5848827 feat(medusa, medusa-js, medusa-react): Implement Sales Channel list (#1815)
**What**
Support sales channel list in medusa, medusa-js and medusa-react

**How**

By implementing a new endpoint and the associated service method as well as the repository methods.

Medusa-js new list method in the resource

Medusa-react new hook in the queries

**Tests**

Endpoint test
Service test
Integration test
Hook tests

Fixes CORE-280
2022-07-13 10:28:53 +00:00
Sebastian Rindom
c20d720040 fix(medusa-payment-klarna): Fix division by zero on free shipping (#1840) 2022-07-13 09:26:45 +02:00
Oliver Windall Juhl
4e375c2203 feat(medusa): Prevent default channel from being deleted (#1835)
**What**
Prevent the default channel from being deleted

Fixes CORE-317
2022-07-13 06:41:03 +00:00
Sebastian Rindom
e539bdc620 chore: Fix CI pipeline (#1839) 2022-07-12 20:14:34 +02:00
olivermrbl
cf167d00b1 chore(release): Publish 2022-07-12 09:38:54 +02:00
olivermrbl
e324f223d7 chore: Add .env to .gitignore 2022-07-12 09:36:04 +02:00
olivermrbl
fb0346f1fa fix: Merge conflicts 2022-07-12 09:29:41 +02:00
Adrien de Peretti
b402b9f159 feat(medusa): Create default sales channel associated to the store (#1830)
**What**
Add support for default sales channel

**How**
- Implement a new method in the salesChannelService `createDefault`
- call the new method above in the default loader

**Test**
- Unit tests of the sales channel service method createDefaulta
- Init default loader unit tests

Fixes CORE-316
2022-07-11 21:05:28 +00:00
Philip Korsholm
19f35ba6aa Feat(medusa, medusa-js, medusa-react): Include sales channels in related queries as an optional expand parameter (#1816)
**What**
- Add `transformQuery` to get endpoints for product, order and cart
  - ensure that the default relations (when getting a singular entity) includes sales channels when enabled
- Add `EmptyQueryParams` class in common types to prevent query parameters while using `transformQuery`
- update product-, order- and cartFactory to include sales channels if provided
- remove `packages/medusa/src/controllers/products/admin-list-products.ts`

**Testing** 
- expands sales channel for single order
- expands sales channels for orders with expand parameter 
- returns single product with sales channel 
- expands sales channels for products with expand parameter
- returns cart with sales channel for single cart

Fixes CORE-293

Co-authored-by: Sebastian Rindom <7554214+srindom@users.noreply.github.com>
Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2022-07-11 16:45:01 +00:00
Kasper Fabricius Kristensen
fb4cfc3c3c fix(medusa-react): Use correct type for hook useAdminCreateDraftOrder (#1832) 2022-07-11 16:14:10 +02:00
Oliver Windall Juhl
fb82d3dd22 fix(medusa): Add migration ensuring correct state of BatchJob model (#1825) 2022-07-11 15:50:01 +02:00
Sebastian Rindom
39f2c0c15e fix(medusa): calculates correct taxes and totals on order with gift cards (#1807)
**What**
Since the release of the Tax API the line item totals calculations on orders with gift cards have been wrong. To understand the bug consider the below order:

Region:
- tax_rate: 25%
- gift_cards_taxable: true

Order:
- applied gift card: 1000
- items: 
  - A: unit_price: 1000
  - B: unit_price: 500
- Subtotal: 1500

**Previous calculation method**
1. Determine how much of the gift card is used for each item using `item_total / subtotal * gift_card_amount`:
  - Item A: 1000/1500 * 1000 = 666.67
  - Item B: 500/1500 * 1000 = 333.33
2. Calculate line item totals including taxes using `(unit_price - gift_card) * (1 + tax_rate)`
  - Item A: 1000 - 666.67 = 333.33; vat amount -> 83.33
  - Item B: 500 - 333.33 = 166.67; vat amount -> 41.67
3. Add up the line item totals: order subtotal = 500; vat amount = 125; total = 625

This is all correct at the totals level; but at the line item level we should still use the "original prices" i.e. the line item total for item a should be (1000 * 1.25) = 1250 with a tax amount of 250. 

**New calculation method**
1. Use default totals calculations
  - Item A: subtotal: 1000, tax_total: 250, total: 1250
  - Item B: subtotal: 500, tax_total: 125, total: 625
2. Add up the line item totals: subtotal: 1500, tax_total: 375, total: 1875
3. Reduce total with gift card: subtotal: 1500 - 1000 = 500, tax_total: 375 - 250 = 125, total = 625

Totals can now be forwarded correctly to accounting plugins.

Fixes CORE-310.
2022-07-11 12:18:43 +00:00
Philip Korsholm
3e197e3adf feat(medusa): Add feature flags to store response (#1819)
**What**
- Add `feature_flags` string array to store response

**Why**
- to provide conditional ui in admin corresponding to enabled features

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2022-07-11 09:42:58 +00:00
Oliver Windall Juhl
02967f95b1 fix(medusa): Refresh adjustments when region on cart is changed (#1827)
* fix(medusa): Refresh adjustments when region on cart is changed

* fix test

* Fix unit test

* fix: integration tests

* fix: comment
2022-07-11 10:51:55 +02:00
Sebastian Rindom
dffb86bb58 chore: turbo cleanup (#1828)
- Adds workspace-tools
- Updates .gitignore to include yarn/cache for zero-installs: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
2022-07-11 08:47:48 +00:00
dependabot[bot]
6a2fd3b361 chore(deps): bump moment from 2.29.1 to 2.29.4 in /packages/gatsby-source-medusa (#1818)
Bumps [moment](https://github.com/moment/moment) from 2.29.1 to 2.29.4.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/moment/moment/blob/develop/CHANGELOG.md">moment's changelog</a>.</em></p>
<blockquote>
<h3>2.29.4</h3>
<ul>
<li>Release Jul 6, 2022
<ul>
<li><a href="https://github-redirect.dependabot.com/moment/moment/pull/6015">#6015</a> [bugfix] Fix ReDoS in preprocessRFC2822 regex</li>
</ul>
</li>
</ul>
<h3>2.29.3 <a href="https://gist.github.com/ichernev/edebd440f49adcaec72e5e77b791d8be">Full changelog</a></h3>
<ul>
<li>Release Apr 17, 2022
<ul>
<li><a href="https://github-redirect.dependabot.com/moment/moment/pull/5995">#5995</a> [bugfix] Remove const usage</li>
<li><a href="https://github-redirect.dependabot.com/moment/moment/pull/5990">#5990</a> misc: fix advisory link</li>
</ul>
</li>
</ul>
<h3>2.29.2 <a href="https://gist.github.com/ichernev/1904b564f6679d9aac1ae08ce13bc45c">See full changelog</a></h3>
<ul>
<li>Release Apr 3 2022</li>
</ul>
<p>Address <a href="https://github.com/moment/moment/security/advisories/GHSA-8hfj-j24r-96c4">https://github.com/moment/moment/security/advisories/GHSA-8hfj-j24r-96c4</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="000ac1800e"><code>000ac18</code></a> Build 2.24.4</li>
<li><a href="f2006b6479"><code>f2006b6</code></a> Bump version to 2.24.4</li>
<li><a href="536ad0c348"><code>536ad0c</code></a> Update changelog for 2.29.4</li>
<li><a href="9a3b5894f3"><code>9a3b589</code></a> [bugfix] Fix redos in preprocessRFC2822 regex (<a href="https://github-redirect.dependabot.com/moment/moment/issues/6015">#6015</a>)</li>
<li><a href="6374fd860a"><code>6374fd8</code></a> Merge branch 'master' into develop</li>
<li><a href="b4e615307e"><code>b4e6153</code></a> Revert &quot;[bugfix] Fix redos in preprocessRFC2822 regex (<a href="https://github-redirect.dependabot.com/moment/moment/issues/6015">#6015</a>)&quot;</li>
<li><a href="7aebb1617f"><code>7aebb16</code></a> [bugfix] Fix redos in preprocessRFC2822 regex (<a href="https://github-redirect.dependabot.com/moment/moment/issues/6015">#6015</a>)</li>
<li><a href="57c90622e4"><code>57c9062</code></a> Build 2.29.3</li>
<li><a href="aaf50b6bca"><code>aaf50b6</code></a> Fixup release complaints</li>
<li><a href="26f4aef9ca"><code>26f4aef</code></a> Bump version to 2.29.3</li>
<li>Additional commits viewable in <a href="https://github.com/moment/moment/compare/2.29.1...2.29.4">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=moment&package-manager=npm_and_yarn&previous-version=2.29.1&new-version=2.29.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/medusajs/medusa/network/alerts).

</details>
2022-07-10 13:41:34 +00:00
Philip Korsholm
812ba65d8f feat(medusa): Add streaming to Minio fileservice (#1619) 2022-07-10 12:34:28 +02:00
Zakaria El Asri
9fa4238ee4 chore: improve ci pipeline (#1764)
* fix: caching deps + add true parallelization to integration tests api

* fix: github action

* chore: upgrade to yarn berry (#1762)

* init migration

* remove: yarn.lock from all pkgs

* fix: build script in pkgs

* adjust yarn config

* fix: yarn.lock and yarnrc.yml

* fix: github actions

* fix: wrong type

* fix (medusa-react): use dts-cli instead of tsdx

* fix: yarn.lock

* fix: yarn v

* fix: prepare script

* add: comment on why we need to downgrade yarn before medusa-dev

* chore: move to Turborepo (#1763)

* increase number of parallel nodes

* fix (medusa-fulfillment-webshipper): build script

* fix: use new version of medusa-dev

* fix: rename cache-bootstrap to cache-deps
2022-07-10 12:11:11 +02:00
Adrien de Peretti
6715eb11de fix(medusa): Export data should always provide a file_key (#1785) 2022-07-10 11:38:27 +02:00
dependabot[bot]
65aea2fe36 chore(deps): bump moment in /packages/medusa-dev-cli (#1822)
Bumps [moment](https://github.com/moment/moment) from 2.29.1 to 2.29.4.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/moment/moment/compare/2.29.1...2.29.4)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: indirect
2022-07-10 11:34:47 +02:00
dependabot[bot]
780e087d10 chore(deps): bump moment from 2.29.1 to 2.29.4 in /www/reference (#1821)
Bumps [moment](https://github.com/moment/moment) from 2.29.1 to 2.29.4.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/moment/moment/blob/develop/CHANGELOG.md">moment's changelog</a>.</em></p>
<blockquote>
<h3>2.29.4</h3>
<ul>
<li>Release Jul 6, 2022
<ul>
<li><a href="https://github-redirect.dependabot.com/moment/moment/pull/6015">#6015</a> [bugfix] Fix ReDoS in preprocessRFC2822 regex</li>
</ul>
</li>
</ul>
<h3>2.29.3 <a href="https://gist.github.com/ichernev/edebd440f49adcaec72e5e77b791d8be">Full changelog</a></h3>
<ul>
<li>Release Apr 17, 2022
<ul>
<li><a href="https://github-redirect.dependabot.com/moment/moment/pull/5995">#5995</a> [bugfix] Remove const usage</li>
<li><a href="https://github-redirect.dependabot.com/moment/moment/pull/5990">#5990</a> misc: fix advisory link</li>
</ul>
</li>
</ul>
<h3>2.29.2 <a href="https://gist.github.com/ichernev/1904b564f6679d9aac1ae08ce13bc45c">See full changelog</a></h3>
<ul>
<li>Release Apr 3 2022</li>
</ul>
<p>Address <a href="https://github.com/moment/moment/security/advisories/GHSA-8hfj-j24r-96c4">https://github.com/moment/moment/security/advisories/GHSA-8hfj-j24r-96c4</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="000ac1800e"><code>000ac18</code></a> Build 2.24.4</li>
<li><a href="f2006b6479"><code>f2006b6</code></a> Bump version to 2.24.4</li>
<li><a href="536ad0c348"><code>536ad0c</code></a> Update changelog for 2.29.4</li>
<li><a href="9a3b5894f3"><code>9a3b589</code></a> [bugfix] Fix redos in preprocessRFC2822 regex (<a href="https://github-redirect.dependabot.com/moment/moment/issues/6015">#6015</a>)</li>
<li><a href="6374fd860a"><code>6374fd8</code></a> Merge branch 'master' into develop</li>
<li><a href="b4e615307e"><code>b4e6153</code></a> Revert &quot;[bugfix] Fix redos in preprocessRFC2822 regex (<a href="https://github-redirect.dependabot.com/moment/moment/issues/6015">#6015</a>)&quot;</li>
<li><a href="7aebb1617f"><code>7aebb16</code></a> [bugfix] Fix redos in preprocessRFC2822 regex (<a href="https://github-redirect.dependabot.com/moment/moment/issues/6015">#6015</a>)</li>
<li><a href="57c90622e4"><code>57c9062</code></a> Build 2.29.3</li>
<li><a href="aaf50b6bca"><code>aaf50b6</code></a> Fixup release complaints</li>
<li><a href="26f4aef9ca"><code>26f4aef</code></a> Bump version to 2.29.3</li>
<li>Additional commits viewable in <a href="https://github.com/moment/moment/compare/2.29.1...2.29.4">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=moment&package-manager=npm_and_yarn&previous-version=2.29.1&new-version=2.29.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/medusajs/medusa/network/alerts).

</details>
2022-07-10 09:33:56 +00:00
Derek Wene
41a757a5f8 fix(medusa): Add relations to cart retrieval to correctly calculate tax context (#1823) 2022-07-10 11:18:12 +02:00
Shahed Nasser
3b28f46705 docs: added reference for JS Client (#1629)
* added reference for JS Client

* added reference for JS Client

* added reference for JS Client
2022-07-08 18:21:46 +03:00
Adrien de Peretti
2d03634cfc feat(medusa, medusa-js, medusa-react): Implement Sales Channel deletion (#1804) 2022-07-07 10:47:51 +02:00
Sebastian Rindom
4d15e01c3e fix(medusa): calculate orders correctly by adding adjustments (#1812) 2022-07-07 07:35:12 +00:00
Frane Polić
0d1624cf6a feat(medusa, medusa-js, medusa-react): Implement Sales Channel creation (#1795) 2022-07-06 22:18:05 +02:00
Philip Korsholm
428a801293 feat(medusa-js, medusa-react): Update jsdoc with experimental annotation for sales channels (#1811)
**What**
- Add tag to indicate methods are part of an experimental feature under development

**Why**
- To notify developers because we cant support featureflags in the same way from the client side libraries.
2022-07-06 15:38:26 +00:00
Shahed Nasser
371682b4f7 docs: added deploy to netlify buttons to Gatsby guides (#1810) 2022-07-06 17:38:51 +03:00