Commit Graph

4739 Commits

Author SHA1 Message Date
Stevche Radevski
63be07031b feat: Add skeleton for Store module (#6506) 2024-02-26 12:00:48 +00:00
Riqwan Thamir
8ea37d03c9 fix(utils): bignumber util considers nullable options when setting value (#6499)
what:

- when setting null for nullable columns, big number utils should not throw error
- remove circular soft delete depenedencies for cart module
- trims zeros on big number values
2024-02-26 11:29:36 +00:00
Adrien de Peretti
56cbf88115 chore(utils): Soft delete should allow self referencing circular deps (#6504)
**What**
Self referencing circular dep should not be an error and should be accepted
2024-02-26 09:37:46 +00:00
Sebastian Rindom
d983329481 feat(tax): soft deletes (#6486)
**What**
- Adds soft deletes
2024-02-26 08:34:46 +00:00
Shahed Nasser
3b18f399c1 docs(ui): show icon tooltip on small devices (#6407) 2024-02-26 08:31:36 +01:00
Sebastian Rindom
3c5b020c5e feat(tax): singular creates and deletes of regions, rates, rules (#6464)
**What**
- Adds support for creating single rates, regions, rules.
- Adds delete methods.
2024-02-25 21:38:41 +00:00
Adrien de Peretti
168f02f138 chore(util): Detect circular dependencies on soft delete (#6489) 2024-02-24 14:21:43 +01:00
Stevche Radevski
5b85c3103e feat: Update signature of region module to match latest spec (#6487) 2024-02-23 15:56:16 +00:00
Shahed Nasser
c86e27bd0d chore: generated tsdocs (#6352)
Generated TSDocs for the past release.

Note: I haven't updated examples as the examples are for modules without a public reference yet, so the examples can wait.
2024-02-23 15:21:16 +00:00
Adrien de Peretti
788c4a1e36 feat(fulfillment): Shipping options, rules CRUD + rules based context filtering (#6455)
**What**
- Update shipping options with its rules and type
- create/update rules independently
- context based validation fundation
- 🔴 list shipping options with context rules fitlering will come in a separate pr to keep this one smaller

FIXES CORE-1743
FIXES CORE-1764
2024-02-23 11:14:33 +00:00
Stevche Radevski
78b6d46584 Merge pull request #6471 from medusajs/feat/add-api-endpoints-api-key
feat(api-key): Add the endpoints and workflows for api key module
2024-02-23 11:35:31 +01:00
Stevche Radevski
0582545065 feat(api-key): Add the endpoints and workflows for api key module 2024-02-23 11:01:08 +01:00
Oli Juhl
d9636f4631 chore(cart): Make all cart entities soft-deletable (#6475) 2024-02-23 08:59:02 +01:00
Philip Korsholm
3fc2aea752 feat(modules-sdk, types, user, utils):init user module events (#6431)
* init user module events

* refactor utils

* undo test script update

* fix feedback

* add eventbus service to module test-runner

* add injected dependencies

* move events to utils

* use const eventname in tests

* rm withTransaction
2024-02-23 09:31:02 +08:00
Adrien de Peretti
36a61658f9 feat(utils): Fix big number decorator and cleanup (#6473)
**What**
- Fix big number decorator and cleanup
2024-02-22 16:58:41 +00:00
Sebastian Rindom
598ee6f49c feat(tax): adds getItemTaxLines (#6440)
**What**
- Selects the correct tax line for an item given a calculation context.

**For later PR**
- Consider optimizations. Some thoughts:
  - Even with global sales the number of rates in the DB is not likely to grow beyond ~1000.
  - Can large orders with hundreds of items optimize somehow?
  - Does it make sense to write a custom SQL query to do this?
- Support combined rate.

**Test cases covered**
The selection of tax rates take the following priority:

1. specific product rules - province
2. specific product type rules - province
3. default province rules
4. specific product rules - country
5. specific product type rules - country
6. default country rules

There are test cases for each of them under the following data seed structure:

### **US** 
- **Default Rate**: 2%
- **Sub-Regions**
  - CA 
    - Default Rate: 5%
    - Overrides
      - Reduced rate (for 3 product ids): 3%
      - Reduced rate (for product type): 1%
  - NY 
    - Default rate: 6%
  - FL 
    - Default rate: 4%
- **Overrides**
  - None

### **Denmark** 
- **Default rate:** 25% 
- **Sub-Regions**
  - None
- **Overrides**
  -  None

### **Germany** 
- **Default Rate:** 19%
- **Sub-Regions**
  - None
- **Overrides:**
  - Reduced Rate (for product type) - 7%

### **Canada** 
- **Default rate**: 5%
- **Sub-Regions**
  - QC 
    - Default rate: 2%
    - Overrides:
      - Reduced rate (for same product type as country reduced rate): 1%
  - BC 
    - Default rate: 2%
- **Overrides**
  - Reduced rate (for product id) - 3%
  - Reduced rate (for product type) - 3.5%
2024-02-22 16:28:55 +00:00
invalid w
58943e83fd fix(medusa): unable to delete downloaded files (#6169)
resolve #6168
2024-02-22 12:13:42 +00:00
Shahed Nasser
52afc619b3 docs: typo fix in create event module reference (#6470) 2024-02-22 12:16:18 +01:00
Adrien de Peretti
f611865553 fix(workflows-sdk): Fix StepFunction typings and custom step name (#6468)
* fix(workflows=sdk): Fix StepFunction typings and custom step name

* Create smart-nails-switch.md

* fixes

* fixes

* fixes

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-02-22 11:59:53 +01:00
Kasper Fabricius Kristensen
72a17d6cd7 feat(dashboard): Rework route modals (#6459)
**What**
- Reworks how RouteModals are setup.

**Why**
- With the current implementation it was possible to create a race-condition in the logic that handled displaying a prompt if the user tried to close a modal, while a child form was dirty. The race condition would cause a new prompt to spawn each time the user clicked the screen, making it impossible to dismiss the prompt. This only occurred in a few specific cases.

**How**
- Creates two new components: RouteFocusModal and RouteDrawer. The component shares logic for handling their own open/closed state, and now accept a form prop, that allows the modals to keep track of whether their child form is dirty. This change ensures that race conditions cannot occur, and that the prompt always only renders once when needed.
2024-02-22 09:03:40 +00:00
Stevche Radevski
add861d205 chore(utils): Move generic utils from region module to utils (#6466)
Moves some generic utilities from the region module to the top-level utils package
2024-02-22 08:06:46 +00:00
Stevche Radevski
5a15e039ec Merge pull request #6463 from medusajs/feat/implement-crud-api-key-module
feat(api-key): Add CRUD functionalities to the api key module
2024-02-21 16:36:31 +01:00
Stevche Radevski
ec6351b363 chore: Updates based on PR feedback 2024-02-21 16:05:51 +01:00
Stevche Radevski
c99ca5cc22 feat(api-key): Add CRUD functionalities to the api key module 2024-02-21 15:45:40 +01:00
Adrien de Peretti
e0750bae40 chore(medusa-test-utils): Add debug option to the module test runner (#6462)
**What**
Add a debug options to the test runner, for now it will only switch the db to log the query but it could evolve to do more debug.
2024-02-21 13:01:03 +00:00
Frane Polić
8ff838970e fix(medusa): register logger when running migrations (#6415) 2024-02-21 13:28:58 +01:00
Kasper Fabricius Kristensen
44d43e8155 feat(dashboard, medusa, medusa-js, medusa-react, icons): DataGrid, partial Product domain, and ProductVariant hook (#6428)
The PR for the Products section is growing quite large, so I would like to merge this PR that contains a lot of the ground work before moving onto finalizing the rest of the domain.

**Note**
Since the PR contains changes to the core, that the dashboard depends on, the staging env will not work. To preview this PR, you will need to run it locally. 

## `@medusajs/medusa`

**What**
- Adds missing query params to `GET /admin/products/:id/variants`
- `options.values` has been added to the default relations of admin product endpoints.

## `medusa-react`

**What**
- Adds missing hook for `GET /admin/products/:id/variants`

## `@medusajs/dashboard`
- Adds base implementation for `DataGrid` component (formerly `BulkEditor`) (WIP)
- Adds `/products` overview page
- Adds partial `/products/create` page for creating new products (WIP - need to go over design w/ Ludvig before continuing)
- Adds `/products/:id` details page
- Adds `/products/:id/gallery` page for inspecting a products images in fullscreen.
- Adds `/products/:id/edit` page for editing the general information of a product
- Adds `/products/:id/attributes` page for editing the attributes information of a product
- Adds `/products/:id/sales-channels` page for editing which sales channels a product is available in
- Fixes a bug in `DataTable` where a table with two fixed columns would not display correctly

For the review its not important to test the DataGrid, as it is still WIP, and I need to go through some minor changes to the behaviour with Ludvig, as virtualizing it adds some constraints.

## `@medusajs/icons`

**What**
- Pulls latest icons from Figma

## TODO in next PR
- [ ] Fix the typing of POST /admin/products/:id as it is currently not possible to delete any of the nullable fields once they have been added. Be aware of this when reviewing this PR.
- [ ] Wrap up `/products/create` page
- [ ] Add `/products/:id/media` page for managing media associated with the product.
- [ ] Add `/products/id/options` for managing product options (need Ludvig to rethink this as the current API is very limited and we can implement the current design as is.)
- [ ] Add `/products/:id/variants/:id` page for editing a variant. (Possibly concat all of these into one BulkEditor page?)
2024-02-21 11:29:35 +00:00
Shahed Nasser
c3e30224c7 docs: add missing widget props for collections injection zones (#6452)
* docs: add missing widget props for collections injection zones

Adds missing widget props for the `product_collection.details.before` and `product_collection.details.after` injection zones.

* fix lint error
2024-02-21 07:49:30 +01:00
Stevche Radevski
30dbb86ef4 chore: Update CONTRIBUTING.md to include information on changesets (#6454) 2024-02-21 07:48:04 +01:00
Carlos R. L. Rodrigues
56b0b45304 Feat(order): order changes (#6435)
What:
 - Order DB schema migration
 - BigNumberField Decorator
  
![order_schema](https://github.com/medusajs/medusa/assets/37986729/64ec82ca-5c28-46ef-9a57-614c5a4d25f6)
2024-02-20 23:07:57 +00:00
Sebastian Rindom
137cc0ebf8 feat(tax): introduce tax override data models (#6422)
**What**
- Adds Tax rules to allow overrides of tax rates for certain products, product types or shipping options.

**Punted to future PR**
- Currently, the creation methods only support bulk operations. A later PR will include support for singular operations, too.
- It should be possible to add products, types, and shipping options to a tax rate after creating it. Add, remove, update will come in a later PR.
2024-02-20 16:50:19 +00:00
Riqwan Thamir
43ed6a990d fix: fix fulfillment spec (#6456) 2024-02-20 15:53:18 +01:00
Mohammed Faiyyaz Khatri
76ff9e87b6 fix(utils): Symbol for Indian Currency (#6453) 2024-02-20 15:45:01 +01:00
Stevche Radevski
269be1b64a feat: Add skeleton for api key module (#6451)
Adds a module skeleton for the API Key module.
Implementation of functionalities will follow in separate PRs
2024-02-20 12:28:57 +00:00
Stevche Radevski
cfefd59249 feat(regions): Add support for updating countries in a region (#6432)
**What**
Add missing support for updating countries on the POST /admin/regions/:id route.
Furthermore, the PR refactors how the normalization and validation was handled in both create and update scenarios.
Finally, the PR adds a unique index on the country entity, which ensures at the DB level that we cannot have a duplicate country in the DB for a single region.
2024-02-20 11:46:42 +00:00
Adrien de Peretti
c319edb8e0 chore(utils): Add default ordering to the internal service factory list/listAndCount (#6436)
**What**
Default ordering. By default, only the top level entity ordering is applied using the primary keys, the relations are default ordered by the foreign keys.

It include tests fixing for deterministic data ordering
2024-02-20 11:07:39 +00:00
Oli Juhl
691f68c3b8 feat(region): Region create, delete, update admin endpoints (#6332)
**What**
Add `POST /admin/regions`
Add `POST /admin/regions/:id`
Add `DELETE /admin/regions/:id`

All are added for v2 using API Routes and workflows.

In follow-up PRs, I will add support for passing countries in update and create.

Update: First follow-up PR is #6372
2024-02-20 10:19:07 +00:00
Adrien de Peretti
1d91b7429b feat(fulfillment): implementation part 2 (#6408)
**What**

> [!NOTE]  
> I can see this pr becoming huge, so I d like to get this partial one merged 👍 


- Fixes shared connection usage (mikro orm compare the instance to its own package and therefore was resulting in not trully reusing the provided connection leading to exhausting the connection pool as multiple connections was created and end up not being all destroyed properly under the hood, discovered in my integration tests)
- Create shipping options method implementation
- DTO's definition and service interface update
- integration tests 
- Re work of the indexes with new util update
- Test runner utils to remove a big chunk of the boilerplate of the packages integrations

FIXES CORE-1742
2024-02-19 12:33:46 +00:00
Oli Juhl
680dfcdad3 feat(core-flow, medusa): Create cart with Sales Channel (#6427) 2024-02-19 09:42:11 +01:00
Oli Juhl
5db3ec09e2 feat: Cart Customer link + create cart with customer (#6426) 2024-02-19 08:28:44 +01:00
Philip Korsholm
f6d38163bb Feat(medusa, user, core-flows): User creation with invites (#6413)
**What**
- add accept invite endpoint 

**Invite accept flow**
- authenticate using the auth endpoint to create and auth-user
- invoke accept endpoint with token and info to create user
2024-02-19 05:29:15 +00:00
Sebastian Rindom
5977a38ef4 feat(tax): Add TaxRegion (#6421)
**What**
- Adds a TaxRegion entity.

**For context: High-level design of the Tax module**
- A TaxRegion scopes tax rates to a geographical place.
- You can define tax regions on two levels: country-level, province-level (this corresponds to state in US contexts)
- Each Tax Region can have a default Tax Rate.
-  [not yet done] - Each Tax Region can also have granularly defined tax rates for different products and shipping rates. For example, California can have a base rate for default products, but a reduced rate for groceries.
- Tax Rates specify if they can be combined with other rates - it's always the lowest level rate that wins.

The above allows a merchant to define their tax settings along the lines of this:

- Denmark (Region)
  - Default rate: 25% (TaxRate)
- Germany (Region)
  - Default rate: 19% (TaxRate)
  - Reduced rate (books): 9% (TaxRate w. rule)
- United States (Region)
  - Default rate: 0% (TaxRate)
  - California: (Region)
    - Default rate: 7.25% (TaxRate)
  - Arkansas: (Region)
    - Default rate: 6.5%
    - Reduced rate (groceries): 0.125% (TaxRate w. rule)

The TaxModule can then receive a list of products and the shipping address to determine what tax rates apply to the line items.
2024-02-18 13:31:50 +00:00
Oli Juhl
1ba35b02dd feat: Cart SalesChannel link + clean-up (#6418) 2024-02-16 20:48:56 +01:00
Darius
1df14de183 chore: Update teams.yml (#6419)
adding myself to medusa team
2024-02-16 16:57:54 +01:00
Shahed Nasser
68123c6ffd docs: add missing steps to enable medusa_v2 flag (#6406) 2024-02-16 14:20:52 +00:00
Oli Juhl
24fb102a56 feat: CartRegion link, definition + workflow (#6392) 2024-02-16 14:06:26 +00:00
Sebastian Rindom
7df4947ecf feat(tax): tax module scaffolding (#6417)
**What**
- Scaffolds the tax module
2024-02-16 13:24:23 +00:00
Shahed Nasser
0d68eadf84 docs: add ignore tag to isPaymentProcessor (#6410)
- Add ignore tags to `isPaymentProcessor` method and property
- Generate payment reference to move the associated section.
2024-02-16 12:51:14 +00:00
Stevche Radevski
35a4db29b7 Merge pull request #6416 from medusajs/chore/add-sradevski-teams
Add sradevski to teams.yml
2024-02-16 13:14:35 +01:00
Stevche Radevski
a4d43f05f0 Add sradevski to teams.yml 2024-02-16 13:00:15 +01:00