chore: Remove remaining V1 plugins (#7255)

This commit is contained in:
Oli Juhl authored and GitHub committed 2024-05-06 17:31:24 +02:00
1 parent 651b953db7
commit 309c04afe8
69 files changed
+55 -4483

No files matched your search

@@ -1,13 +0,0 @@
{
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-instanceof",
"@babel/plugin-transform-classes"
],
"presets": ["@babel/preset-env"],
"env": {
"test": {
"plugins": ["@babel/plugin-transform-runtime"]
}
}
}
@@ -1,15 +0,0 @@
/lib
node_modules
.DS_store
.env*
/*.js
!index.js
!jest.config.js
/dist
/api
/services
/models
/subscribers
@@ -1,9 +0,0 @@
.DS_store
src
dist
yarn.lock
.babelrc
jest.config.js
.turbo
.yarn
@@ -1,172 +0,0 @@
# Change Log
## 1.1.27
### Patch Changes
- [#4276](https://github.com/medusajs/medusa/pull/4276) [`afd1b67f1`](https://github.com/medusajs/medusa/commit/afd1b67f1c7de8cf07fd9fcbdde599a37914e9b5) Thanks [@olivermrbl](https://github.com/olivermrbl)! - chore: Use caret range
## 1.1.26
### Patch Changes
- [#3763](https://github.com/medusajs/medusa/pull/3763) [`4104d9ccb`](https://github.com/medusajs/medusa/commit/4104d9ccb25276c85b5363f85e14b3093e64df85) Thanks [@StephixOne](https://github.com/StephixOne)! - fix(plugin-discount-generator,plugin-economic,plugin-mailchimp,plugin-restock-notification,plugin-sendgrid,plugin-wishlist): Temporarily remove payload validation in some plugins
## 1.1.25
### Patch Changes
- Updated dependencies [[`121b42acf`](https://github.com/medusajs/medusa/commit/121b42acfe98c12dd593f9b1f2072ff0f3b61724), [`aa690beed`](https://github.com/medusajs/medusa/commit/aa690beed775646cbc86b445fb5dc90dcac087d5), [`54dcc1871`](https://github.com/medusajs/medusa/commit/54dcc1871c8f28bea962dbb9df6e79b038d56449), [`77d46220c`](https://github.com/medusajs/medusa/commit/77d46220c23bfe19e575cbc445874eb6c22f3c73)]:
- medusa-core-utils@1.2.0
- medusa-interfaces@1.3.7
## 1.1.25-rc.0
### Patch Changes
- Updated dependencies [[`121b42acf`](https://github.com/medusajs/medusa/commit/121b42acfe98c12dd593f9b1f2072ff0f3b61724), [`aa690beed`](https://github.com/medusajs/medusa/commit/aa690beed775646cbc86b445fb5dc90dcac087d5), [`54dcc1871`](https://github.com/medusajs/medusa/commit/54dcc1871c8f28bea962dbb9df6e79b038d56449), [`77d46220c`](https://github.com/medusajs/medusa/commit/77d46220c23bfe19e575cbc445874eb6c22f3c73)]:
- medusa-core-utils@1.2.0-rc.0
- medusa-interfaces@1.3.7-rc.0
## 1.1.24
### Patch Changes
- [#3217](https://github.com/medusajs/medusa/pull/3217) [`8c5219a31`](https://github.com/medusajs/medusa/commit/8c5219a31ef76ee571fbce84d7d57a63abe56eb0) Thanks [@adrien2p](https://github.com/adrien2p)! - chore: Fix npm packages files included
- Updated dependencies [[`8c5219a31`](https://github.com/medusajs/medusa/commit/8c5219a31ef76ee571fbce84d7d57a63abe56eb0)]:
- medusa-core-utils@1.1.39
- medusa-interfaces@1.3.6
## 1.1.23
### Patch Changes
- [#3185](https://github.com/medusajs/medusa/pull/3185) [`08324355a`](https://github.com/medusajs/medusa/commit/08324355a4466b017a0bc7ab1d333ee3cd27b8c4) Thanks [@olivermrbl](https://github.com/olivermrbl)! - chore: Patches all dependencies + minor bumps `winston` to include a [fix for a significant memory leak](https://github.com/winstonjs/winston/pull/2057)
- Updated dependencies [[`08324355a`](https://github.com/medusajs/medusa/commit/08324355a4466b017a0bc7ab1d333ee3cd27b8c4)]:
- medusa-core-utils@1.1.38
- medusa-interfaces@1.3.5
## 1.1.22
### Patch Changes
- [#3025](https://github.com/medusajs/medusa/pull/3025) [`93d0dc1bd`](https://github.com/medusajs/medusa/commit/93d0dc1bdcb54cf6e87428a7bb9b0dac196b4de2) Thanks [@adrien2p](https://github.com/adrien2p)! - fix(medusa): test, build and watch scripts
- Updated dependencies [[`93d0dc1bd`](https://github.com/medusajs/medusa/commit/93d0dc1bdcb54cf6e87428a7bb9b0dac196b4de2)]:
- medusa-interfaces@1.3.4
## 1.1.21
### Patch Changes
- [#2808](https://github.com/medusajs/medusa/pull/2808) [`0a9c89185`](https://github.com/medusajs/medusa/commit/0a9c891853c4d16b553d38268a3408ca1daa71f0) Thanks [@patrick-medusajs](https://github.com/patrick-medusajs)! - chore: explicitly add devDependencies for monorepo peerDependencies
- Updated dependencies [[`7cced6006`](https://github.com/medusajs/medusa/commit/7cced6006a9a6f9108009e9f3e191e9f3ba1b168)]:
- medusa-core-utils@1.1.37
## 1.1.20
### Patch Changes
- [#2623](https://github.com/medusajs/medusa/pull/2623) [`533208197`](https://github.com/medusajs/medusa/commit/5332081972cdd08b4d718799097d78043279057b) Thanks [@pKorsholm](https://github.com/pKorsholm)! - Bump dependency version for medusa packages
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.19](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.18...medusa-plugin-discount-generator@1.1.19) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.18](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.17...medusa-plugin-discount-generator@1.1.18) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.15...medusa-plugin-discount-generator@1.1.17) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.15...medusa-plugin-discount-generator@1.1.16) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.14...medusa-plugin-discount-generator@1.1.15) (2021-09-15)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.13...medusa-plugin-discount-generator@1.1.14) (2021-09-14)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.12...medusa-plugin-discount-generator@1.1.13) (2021-07-26)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.10...medusa-plugin-discount-generator@1.1.12) (2021-07-15)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.10...medusa-plugin-discount-generator@1.1.11) (2021-07-15)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.9...medusa-plugin-discount-generator@1.1.10) (2021-07-02)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.8...medusa-plugin-discount-generator@1.1.9) (2021-06-22)
### Bug Fixes
- release assist ([668e8a7](https://github.com/medusajs/medusa/commit/668e8a740200847fc2a41c91d2979097f1392532))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.7...medusa-plugin-discount-generator@1.1.8) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.6...medusa-plugin-discount-generator@1.1.7) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.5...medusa-plugin-discount-generator@1.1.6) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.4...medusa-plugin-discount-generator@1.1.5) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.3...medusa-plugin-discount-generator@1.1.4) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.0...medusa-plugin-discount-generator@1.1.3) (2021-04-28)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.2](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.1...medusa-plugin-discount-generator@1.1.2) (2021-04-20)
**Note:** Version bump only for package medusa-plugin-discount-generator
## [1.1.1](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.0...medusa-plugin-discount-generator@1.1.1) (2021-04-20)
**Note:** Version bump only for package medusa-plugin-discount-generator
# 1.1.0 (2021-01-26)
## 1.0.1 (2020-09-05)
# 1.0.0 (2020-09-03)
# 1.0.0-alpha.26 (2020-08-27)
# 1.0.0-alpha.3 (2020-08-20)
# 1.0.0-alpha.2 (2020-08-20)
# 1.0.0-alpha.1 (2020-08-20)
# 1.0.0-alpha.0 (2020-08-20)
**Note:** Version bump only for package medusa-plugin-discount-generator
@@ -1,41 +0,0 @@
# Discount Generator
Generate dynamic discount codes in your Medusa backend.
[Medusa Website](https://medusajs.com/) | [Medusa Repository](https://github.com/medusajs/medusa)
## Features
- Provides a service that can be used to generate a dynamic discount with a random code.
- Provides an endpoint that can be used to generate a dynamic discount with a random code.
---
## Prerequisites
- [Medusa backend](https://docs.medusajs.com/development/backend/install)
---
## How to Install
1\. Run the following command in the directory of the Medusa backend:
```bash
npm install medusa-plugin-discount-generator
```
2\. In `medusa-config.js` add the following at the end of the `plugins` array:
```js
const plugins = [
// ...
`medusa-plugin-discount-generator`
]
```
---
## Test the Plugin
Try using the `DiscountGeneratorService` in your code, or using the `/discount-code` endpoint to generate a random discount code.
@@ -1,3 +0,0 @@
module.exports = {
testEnvironment: "node",
}
@@ -1,47 +0,0 @@
{
"name": "medusa-plugin-discount-generator",
"version": "1.1.27",
"main": "index.js",
"license": "MIT",
"author": "Sebastian Rindom",
"repository": {
"type": "git",
"url": "https://github.com/medusajs/medusa",
"directory": "packages/medusa-plugin-discount-generator"
},
"engines": {
"node": ">=16"
},
"devDependencies": {
"@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5",
"@babel/node": "^7.7.4",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-transform-classes": "^7.9.5",
"@babel/plugin-transform-instanceof": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.5",
"@babel/register": "^7.7.4",
"@babel/runtime": "^7.9.6",
"client-sessions": "^0.8.0",
"cross-env": "^5.2.1",
"jest": "^25.5.4",
"medusa-interfaces": "^1.3.7"
},
"scripts": {
"prepublishOnly": "cross-env NODE_ENV=production yarn run build",
"test": "jest --passWithNoTests src",
"build": "babel src --out-dir . --ignore '**/__tests__','**/__mocks__'",
"watch": "babel -w src --out-dir . --ignore '**/__tests__','**/__mocks__'"
},
"peerDependencies": {
"medusa-interfaces": "^1.3.7"
},
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1",
"medusa-core-utils": "^1.2.0",
"randomatic": "^3.1.1"
},
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
}
@@ -1,29 +0,0 @@
import { Router } from "express"
import bodyParser from "body-parser"
import { Validator, MedusaError } from "medusa-core-utils"
export default (container) => {
const route = Router()
route.post("/discount-code", bodyParser.json(), async (req, res) => {
const schema = Validator.object().keys({
discount_code: Validator.string().required(),
})
const { value, error } = schema.validate(req.body)
if (error) {
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
}
const discountGenerator = req.scope.resolve("discountGeneratorService")
const code = await discountGenerator.generateDiscount(value.discount_code)
res.json({
code
})
})
return route
}
@@ -1,20 +0,0 @@
import randomize from "randomatic"
import { BaseService } from "medusa-interfaces"
class DiscountGeneratorService extends BaseService {
constructor({ discountService }) {
super()
this.discountService_ = discountService
}
async generateDiscount(dynamicDiscountCode) {
const discount = await this.discountService_.retrieveByCode(dynamicDiscountCode)
const data = {
code: randomize("A0", 10)
}
return this.discountService_.createDynamicCode(discount._id, data)
}
}
export default DiscountGeneratorService
-13
View File
@@ -1,13 +0,0 @@
{
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-classes",
"@babel/plugin-transform-instanceof"
],
"presets": ["@babel/preset-env"],
"env": {
"test": {
"plugins": ["@babel/plugin-transform-runtime"]
}
}
}
@@ -1,14 +0,0 @@
dist/
node_modules/
.DS_store
.env*
/*.js
!index.js
yarn.lock
yarn-error.log
/api
/services
/models
/subscribers
@@ -1,8 +0,0 @@
.DS_store
src
dist
yarn.lock
.babelrc
.turbo
.yarn
@@ -1,203 +0,0 @@
# Change Log
## 1.2.8
### Patch Changes
- [#4276](https://github.com/medusajs/medusa/pull/4276) [`afd1b67f1`](https://github.com/medusajs/medusa/commit/afd1b67f1c7de8cf07fd9fcbdde599a37914e9b5) Thanks [@olivermrbl](https://github.com/olivermrbl)! - chore: Use caret range
## 1.2.7
### Patch Changes
- [#3884](https://github.com/medusajs/medusa/pull/3884) [`440f900af`](https://github.com/medusajs/medusa/commit/440f900af03dd0af29c9b16f01576d3eff45cd04) Thanks [@olivermrbl](https://github.com/olivermrbl)! - fix(medusa-plugin-ip-lookup): Remove outdated Typeorm usage
## 1.2.6
### Patch Changes
- Updated dependencies [[`121b42acf`](https://github.com/medusajs/medusa/commit/121b42acfe98c12dd593f9b1f2072ff0f3b61724)]:
- medusa-interfaces@1.3.7
## 1.2.6-rc.0
### Patch Changes
- Updated dependencies [[`121b42acf`](https://github.com/medusajs/medusa/commit/121b42acfe98c12dd593f9b1f2072ff0f3b61724)]:
- medusa-interfaces@1.3.7-rc.0
## 1.2.5
### Patch Changes
- [#3217](https://github.com/medusajs/medusa/pull/3217) [`8c5219a31`](https://github.com/medusajs/medusa/commit/8c5219a31ef76ee571fbce84d7d57a63abe56eb0) Thanks [@adrien2p](https://github.com/adrien2p)! - chore: Fix npm packages files included
- Updated dependencies [[`8c5219a31`](https://github.com/medusajs/medusa/commit/8c5219a31ef76ee571fbce84d7d57a63abe56eb0)]:
- medusa-interfaces@1.3.6
## 1.2.4
### Patch Changes
- [#3185](https://github.com/medusajs/medusa/pull/3185) [`08324355a`](https://github.com/medusajs/medusa/commit/08324355a4466b017a0bc7ab1d333ee3cd27b8c4) Thanks [@olivermrbl](https://github.com/olivermrbl)! - chore: Patches all dependencies + minor bumps `winston` to include a [fix for a significant memory leak](https://github.com/winstonjs/winston/pull/2057)
- Updated dependencies [[`08324355a`](https://github.com/medusajs/medusa/commit/08324355a4466b017a0bc7ab1d333ee3cd27b8c4)]:
- medusa-interfaces@1.3.5
## 1.2.3
### Patch Changes
- [#3025](https://github.com/medusajs/medusa/pull/3025) [`93d0dc1bd`](https://github.com/medusajs/medusa/commit/93d0dc1bdcb54cf6e87428a7bb9b0dac196b4de2) Thanks [@adrien2p](https://github.com/adrien2p)! - fix(medusa): test, build and watch scripts
- Updated dependencies [[`93d0dc1bd`](https://github.com/medusajs/medusa/commit/93d0dc1bdcb54cf6e87428a7bb9b0dac196b4de2)]:
- medusa-interfaces@1.3.4
## 1.2.2
### Patch Changes
- [#2808](https://github.com/medusajs/medusa/pull/2808) [`0a9c89185`](https://github.com/medusajs/medusa/commit/0a9c891853c4d16b553d38268a3408ca1daa71f0) Thanks [@patrick-medusajs](https://github.com/patrick-medusajs)! - chore: explicitly add devDependencies for monorepo peerDependencies
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.2.1](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.2.0...medusa-plugin-ip-lookup@1.2.1) (2022-07-05)
### Bug Fixes
- **medusa:** Remove deps `mongoose` + `mongodb` ([#1218](https://github.com/medusajs/medusa/issues/1218)) ([c76e23e](https://github.com/medusajs/medusa/commit/c76e23e84dd8cb08c3c709f9f95c4c17b9685439))
# [1.2.0](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.19...medusa-plugin-ip-lookup@1.2.0) (2022-05-01)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.19](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.18...medusa-plugin-ip-lookup@1.1.19) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.18](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.17...medusa-plugin-ip-lookup@1.1.18) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.15...medusa-plugin-ip-lookup@1.1.17) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.15...medusa-plugin-ip-lookup@1.1.16) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.14...medusa-plugin-ip-lookup@1.1.15) (2021-09-15)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.13...medusa-plugin-ip-lookup@1.1.14) (2021-09-14)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.12...medusa-plugin-ip-lookup@1.1.13) (2021-07-26)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.10...medusa-plugin-ip-lookup@1.1.12) (2021-07-15)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.10...medusa-plugin-ip-lookup@1.1.11) (2021-07-15)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.9...medusa-plugin-ip-lookup@1.1.10) (2021-07-02)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.8...medusa-plugin-ip-lookup@1.1.9) (2021-06-22)
### Bug Fixes
- release assist ([668e8a7](https://github.com/medusajs/medusa/commit/668e8a740200847fc2a41c91d2979097f1392532))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.7...medusa-plugin-ip-lookup@1.1.8) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.6...medusa-plugin-ip-lookup@1.1.7) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.5...medusa-plugin-ip-lookup@1.1.6) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.4...medusa-plugin-ip-lookup@1.1.5) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.3...medusa-plugin-ip-lookup@1.1.4) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.0...medusa-plugin-ip-lookup@1.1.3) (2021-04-28)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.2](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.1...medusa-plugin-ip-lookup@1.1.2) (2021-04-20)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## [1.1.1](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.0...medusa-plugin-ip-lookup@1.1.1) (2021-04-20)
**Note:** Version bump only for package medusa-plugin-ip-lookup
# [1.1.0](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.0.11...medusa-plugin-ip-lookup@1.1.0) (2021-01-26)
**Note:** Version bump only for package medusa-plugin-ip-lookup
## 1.0.11 (2020-11-02)
### Bug Fixes
- add country code on preCartCreation ([e3faa64](https://github.com/medusajs/medusa/commit/e3faa646a7b91d2686b56718df46bea5b709731b))
## 1.0.10 (2020-09-09)
### Bug Fixes
- updates license ([db519fb](https://github.com/medusajs/medusa/commit/db519fbaa6f8ad02c19cbecba5d4f28ba1ee81aa))
## 1.0.1 (2020-09-05)
# 1.0.0 (2020-09-03)
### Bug Fixes
- remove debug ([4d575e0](https://github.com/medusajs/medusa/commit/4d575e0a263e1b131242ac97263d643217cbe140))
# 1.0.0-y.25 (2020-09-03)
### Bug Fixes
- **medusa-plugin-ip-lookup:** Adds .npmignore ([ea93943](https://github.com/medusajs/medusa/commit/ea939437f37ecd555169750ca334f1a46346248d))
# 1.0.0-y.24 (2020-09-03)
### Bug Fixes
- debug ([8920a96](https://github.com/medusajs/medusa/commit/8920a96f7caaa46b7d9fe2dbf6b06147d144c499))
# 1.0.0-y.20 (2020-09-03)
### Bug Fixes
- debug ([f0b61e7](https://github.com/medusajs/medusa/commit/f0b61e7654b010d0f9d477bc018523e972ff9ea6))
# 1.0.0-alpha.26 (2020-08-27)
# 1.0.0-alpha.21 (2020-08-25)
## [1.0.10](https://github.com/medusajs/medusa/compare/v1.0.9...v1.0.10) (2020-09-09)
### Bug Fixes
- updates license ([db519fb](https://github.com/medusajs/medusa/commit/db519fbaa6f8ad02c19cbecba5d4f28ba1ee81aa))
@@ -1,54 +0,0 @@
# ipstack (IP Lookup)
Automatically detect the region and location of your customer using ipstack.
[Medusa Website](https://medusajs.com/) | [Medusa Repository](https://github.com/medusajs/medusa)
## Features
- Look up the location of your customer using ipstack.
- Provides a middleware that can be added to any request to set the region and country of a cart.
- Provides a service that can be used across codebase to detect the location of a user using their IP.
---
## Prerequisites
- [Medusa backend](https://docs.medusajs.com/development/backend/install)
- [ipstack account](https://ipstack.com)
---
## How to Install
1\. Run the following command in the directory of the Medusa backend:
```bash
npm install medusa-plugin-ip-lookup
```
2\. Set the following environment variable in `.env`:
```bash
IPSTACK_ACCESS_KEY=<YOUR_ACCESS_KEY>
```
3\. In `medusa-config.js` add the following at the end of the `plugins` array:
```js
const plugins = [
// other plugins...
{
resolve: `medusa-plugin-ip-lookup`,
options: {
access_token: process.env.IPSTACK_ACCESS_KEY,
},
},
]
```
---
## Test the Plugin
You can use the `IpLookupService` service to look up the location of an IP, or use the middleware `preCartCreation` on any route.
@@ -1,42 +0,0 @@
{
"name": "medusa-plugin-ip-lookup",
"version": "1.2.8",
"description": "IP lookup middleware for Medusa core",
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "https://github.com/medusajs/medusa",
"directory": "packages/medusa-plugin-ip-lookup"
},
"engines": {
"node": ">=16"
},
"scripts": {
"prepare": "cross-env NODE_ENV=production yarn run build",
"test": "jest --passWithNoTests src",
"build": "babel src --out-dir . --ignore '**/__tests__','**/__mocks__'",
"watch": "babel -w src --out-dir . --ignore '**/__tests__','**/__mocks__'"
},
"author": "Oliver Juhl",
"license": "MIT",
"devDependencies": {
"@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-transform-classes": "^7.9.5",
"@babel/plugin-transform-instanceof": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.5",
"@babel/runtime": "^7.7.6",
"cross-env": "^5.2.1",
"jest": "^25.5.4",
"medusa-interfaces": "^1.3.7"
},
"peerDependencies": {
"medusa-interfaces": "^1.3.7"
},
"dependencies": {
"axios": "^0.20.0"
},
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
}
@@ -1,38 +0,0 @@
export default {
preCartCreation: async function (req, res, next) {
try {
if (req.body.region_id) {
next()
return
}
const ipLookupService = req.scope.resolve("ipLookupService")
const regionService = req.scope.resolve("regionService")
const ip = req.headers["x-forwarded-for"] || req.connection.remoteAddress
const { data } = await ipLookupService.lookupIp(ip)
if (!data.country_code) {
next()
return
}
const region = await regionService
.retrieveByCountryCode(data.country_code)
.catch(() => void 0)
if (!region) {
next()
return
}
req.body.region_id = region.id
req.body.country_code = data.country_code.toLowerCase()
next()
} catch (error) {
next()
}
},
}
@@ -1,18 +0,0 @@
import { BaseService } from "medusa-interfaces"
import axios from "axios"
class IpLookupService extends BaseService {
constructor({}, options) {
super()
this.options_ = options
}
async lookupIp(ipAddress) {
return axios.get(
`http://api.ipstack.com/${ipAddress}?access_key=${this.options_.access_token}`
)
}
}
export default IpLookupService
@@ -1,12 +0,0 @@
let ignore = [`**/dist`]
// Jest needs to compile this code, but generally we don't want this copied
// to output folders
if (process.env.NODE_ENV !== `test`) {
ignore.push(`**/__tests__`)
}
module.exports = {
presets: [["babel-preset-medusa-package"], ["@babel/preset-typescript"]],
ignore,
}
@@ -1,18 +0,0 @@
/lib
node_modules
.DS_store
.env*
/*.js
!.babelrc*
!index.js
!jest.config.js
/dist
/api
/services
/models
/subscribers
/migrations
/repositories
@@ -1,9 +0,0 @@
.DS_store
src
dist
yarn.lock
.babelrc
jest.config.js
.turbo
.yarn
@@ -1,391 +0,0 @@
# Change Log
## 7.0.3
### Patch Changes
- [`cf1821184`](https://github.com/medusajs/medusa/commit/cf18211848d6083354fc070800d94f00130f3da2) Thanks [@olivermrbl](https://github.com/olivermrbl)! - chore: Add missing changeset
## 7.0.2
### Patch Changes
- [#4718](https://github.com/medusajs/medusa/pull/4718) [`803aca068`](https://github.com/medusajs/medusa/commit/803aca0689ce6d9f0d93d883dbd3547c427ff33e) Thanks [@josipmatichr](https://github.com/josipmatichr)! - feat(medusa-plugin-restock-notifications): Multi-warehouse support
## 7.0.1
### Patch Changes
- [#4276](https://github.com/medusajs/medusa/pull/4276) [`afd1b67f1`](https://github.com/medusajs/medusa/commit/afd1b67f1c7de8cf07fd9fcbdde599a37914e9b5) Thanks [@olivermrbl](https://github.com/olivermrbl)! - chore: Use caret range
## 7.0.0
### Patch Changes
- Updated dependencies [[`0a35f21af`](https://github.com/medusajs/medusa/commit/0a35f21af7ac8b6cdc1af12a403e95f9bf6142fe), [`4fb443c0e`](https://github.com/medusajs/medusa/commit/4fb443c0ea38bde3148bce059c0ee3b91dfff3d4), [`0476f5251`](https://github.com/medusajs/medusa/commit/0476f52519237c622b37d29de0718f9774b6add7), [`0f87d3d64`](https://github.com/medusajs/medusa/commit/0f87d3d642b56bf19de8136e1f5bfedf364c5193), [`ed382f2ee`](https://github.com/medusajs/medusa/commit/ed382f2ee510cbf96164991efa7ff75e3ce659ff), [`92f01cefb`](https://github.com/medusajs/medusa/commit/92f01cefbc4a190defce425fb237d2d68728fa9a), [`e3cfbcd4a`](https://github.com/medusajs/medusa/commit/e3cfbcd4a78073c63ecd9829bc531e50d3944f07), [`6998666c6`](https://github.com/medusajs/medusa/commit/6998666c6edd6617ca61a8d39c26435bad1273e3), [`81eeaa329`](https://github.com/medusajs/medusa/commit/81eeaa32942b1a7148126a7218ceb168ce8d6cac), [`e2d29d35c`](https://github.com/medusajs/medusa/commit/e2d29d35c4c477bc9b4a3ddce1279276fd072875), [`3a38c84f8`](https://github.com/medusajs/medusa/commit/3a38c84f88b05f74ee0a172af3e3f78b2ec8c2d2), [`4f3c8f5d7`](https://github.com/medusajs/medusa/commit/4f3c8f5d70b5ae4a11e9d4a2fea4a8410b2daf47), [`a91987fab`](https://github.com/medusajs/medusa/commit/a91987fab33745f9864eab21bd1c27e8e3e24571), [`bf18bd0c8`](https://github.com/medusajs/medusa/commit/bf18bd0c8a284dd0042d4c54d84acb2e7c10edd3), [`db4199530`](https://github.com/medusajs/medusa/commit/db419953075e0907b8c4d27ab5188e9bd3e3d72b)]:
- @medusajs/medusa@1.12.0
## 6.0.0
### Patch Changes
- Updated dependencies [[`a66646233`](https://github.com/medusajs/medusa/commit/a666462333d20821a3e50e3fbc65bc8a511c726f), [`9518efcca`](https://github.com/medusajs/medusa/commit/9518efccae1961d9b3cd1e85148e293a3744eedb), [`a86f0e815`](https://github.com/medusajs/medusa/commit/a86f0e815a9e75d7d562fbe516c5bb7e0ab1f6ee), [`cdbac2c84`](https://github.com/medusajs/medusa/commit/cdbac2c8403a3c15c0e11993f6b7dab268fa5c08), [`26963acc0`](https://github.com/medusajs/medusa/commit/26963acc0a5caa1bca97cfe4cbcee113a8d75b84)]:
- @medusajs/medusa@1.11.0
## 5.0.1
### Patch Changes
- Updated dependencies [[`3d6bcaaf6`](https://github.com/medusajs/medusa/commit/3d6bcaaf65b3a43dfb251460d73e448870b5105f), [`7fd22ecb4`](https://github.com/medusajs/medusa/commit/7fd22ecb4d5190e92c6750a9fbf2d8534bb9f4ab), [`bd53adb23`](https://github.com/medusajs/medusa/commit/bd53adb238a64640533698fbccb98a39a0346590), [`1ea57c3a6`](https://github.com/medusajs/medusa/commit/1ea57c3a69a5377a8dd0821df819743ded4a222b), [`0c58ead6d`](https://github.com/medusajs/medusa/commit/0c58ead6d869f5605cbd2b8aca129984b7493bcf), [`cff54d732`](https://github.com/medusajs/medusa/commit/cff54d73253a4c2d16a174a28f0f5d31c94bcebd), [`a8e73942e`](https://github.com/medusajs/medusa/commit/a8e73942e69662ca673ccc4300e270ff6ab523d1), [`ff37cd190`](https://github.com/medusajs/medusa/commit/ff37cd190fa455f4ba4f76cfb4d641b1611cc32e)]:
- @medusajs/medusa@1.10.1
## 5.0.0
### Patch Changes
- Updated dependencies [[`0e488e71b`](https://github.com/medusajs/medusa/commit/0e488e71b186f7d08b18c4c6ba409ef3cadb8152), [`538c9874b`](https://github.com/medusajs/medusa/commit/538c9874ba18c1352284089a789d4a90652bc795), [`d539c6fee`](https://github.com/medusajs/medusa/commit/d539c6feeba8ee431f9a655b6cd4e9102cba2b25), [`b7a782639`](https://github.com/medusajs/medusa/commit/b7a7826394ecd621ca80e6d4ce445ea1c26804ac), [`983872319`](https://github.com/medusajs/medusa/commit/98387231927e9872f54c9e72597576f3273de506), [`284f1eed9`](https://github.com/medusajs/medusa/commit/284f1eed9a9fc7272df3fccdb162ea93750999de), [`4e8045a0a`](https://github.com/medusajs/medusa/commit/4e8045a0ac44b1541ee3cd846079f55d3e0dc957), [`d2443d83e`](https://github.com/medusajs/medusa/commit/d2443d83e60fee3c3f28b762d66378c3f07f1b5f), [`8b93bae8f`](https://github.com/medusajs/medusa/commit/8b93bae8f8ad1f6eb43931a7ba03bfa691475eca)]:
- @medusajs/medusa@1.10.0
## 4.0.0
### Patch Changes
- Updated dependencies [[`440f900af`](https://github.com/medusajs/medusa/commit/440f900af03dd0af29c9b16f01576d3eff45cd04), [`366b12fce`](https://github.com/medusajs/medusa/commit/366b12fcea679551c55baaeeaaf41bbddf04b972), [`7e213f210`](https://github.com/medusajs/medusa/commit/7e213f2106ed76449fbdfa6eda5594b59522443a), [`d2826872f`](https://github.com/medusajs/medusa/commit/d2826872fe487a027b677aeb43704f761a6b4e80), [`0d0e9bf20`](https://github.com/medusajs/medusa/commit/0d0e9bf2069718ac54684efbe4d449942bb2ef32), [`2be144ff0`](https://github.com/medusajs/medusa/commit/2be144ff05e852a3541a9a972942cfc15ef3bd38), [`935abeae6`](https://github.com/medusajs/medusa/commit/935abeae68012a93d820789c743941c3c1a1b802), [`3a77e8a88`](https://github.com/medusajs/medusa/commit/3a77e8a88fd327aca579bcd09d767d9315a04d7f), [`af710f1b4`](https://github.com/medusajs/medusa/commit/af710f1b48a4545a5064029a557013af34c4c100), [`491566df6`](https://github.com/medusajs/medusa/commit/491566df6b7ced35f655f810961422945e10ecd0), [`966ddd2f1`](https://github.com/medusajs/medusa/commit/966ddd2f1648d5d3c1c68094f488f307e3186d92), [`3b3236cc0`](https://github.com/medusajs/medusa/commit/3b3236cc01fc8b7448c1bdbad066a19c2c3de2c3), [`4a8562743`](https://github.com/medusajs/medusa/commit/4a8562743569f5bbb7bd0894b025a74725726529)]:
- @medusajs/medusa@1.9.0
## 3.0.2
### Patch Changes
- Updated dependencies [[`6bb1654b6`](https://github.com/medusajs/medusa/commit/6bb1654b61880f8658bf1395e4ccef860780aac4), [`95d338262`](https://github.com/medusajs/medusa/commit/95d338262b63e3daa6697bb23806980a8b5e5cdc), [`4f58ddee0`](https://github.com/medusajs/medusa/commit/4f58ddee03509a4c46af160e5824cba80d4c950a)]:
- @medusajs/medusa@1.8.2
## 3.0.1
### Patch Changes
- [#3763](https://github.com/medusajs/medusa/pull/3763) [`4104d9ccb`](https://github.com/medusajs/medusa/commit/4104d9ccb25276c85b5363f85e14b3093e64df85) Thanks [@StephixOne](https://github.com/StephixOne)! - fix(plugin-discount-generator,plugin-economic,plugin-mailchimp,plugin-restock-notification,plugin-sendgrid,plugin-wishlist): Temporarily remove payload validation in some plugins
- Updated dependencies [[`78ff64e78`](https://github.com/medusajs/medusa/commit/78ff64e7837f6506c641a3c97ffdfa6ee17419ee), [`1a60c6f58`](https://github.com/medusajs/medusa/commit/1a60c6f58dd80d2d8cb8ee10c186975b39325d13), [`713d85a92`](https://github.com/medusajs/medusa/commit/713d85a92cf5249e3b75b96f8bf2c25e4f9b0c90), [`914d57336`](https://github.com/medusajs/medusa/commit/914d57336bc8355533d743745989f793ffd4d513), [`60abb91b7`](https://github.com/medusajs/medusa/commit/60abb91b7c568c6c4cce3b2da7cfb8d54b078299), [`089f1eb19`](https://github.com/medusajs/medusa/commit/089f1eb19e2bb43659c5b300fccb8163c1d60b5c), [`08f85fa33`](https://github.com/medusajs/medusa/commit/08f85fa33b35e15f944a833e1401c7ba2081d3ec), [`282e239df`](https://github.com/medusajs/medusa/commit/282e239dfc0a74f0eb72b17426c8c8bffd86064a), [`abdb74d99`](https://github.com/medusajs/medusa/commit/abdb74d997f49f994bff49787a396179982843b0), [`eab2d22f7`](https://github.com/medusajs/medusa/commit/eab2d22f7d22ec53c68398558ffda32d2a734983), [`08f85fa33`](https://github.com/medusajs/medusa/commit/08f85fa33b35e15f944a833e1401c7ba2081d3ec), [`085fedb1f`](https://github.com/medusajs/medusa/commit/085fedb1f7e982859cff3ef3f1d870dce3bcc8b6), [`4d69d8ef6`](https://github.com/medusajs/medusa/commit/4d69d8ef6aef0a05d0bbb00eed045c2de511be56), [`7f6dc44be`](https://github.com/medusajs/medusa/commit/7f6dc44beb9789088f6d6b796f7545beb3653094), [`d533caa4c`](https://github.com/medusajs/medusa/commit/d533caa4c2986c1c9e320cce97423b0cdc213b6c)]:
- @medusajs/medusa@1.8.1
## 3.0.0
### Patch Changes
- Updated dependencies [[`d6b1ad1cc`](https://github.com/medusajs/medusa/commit/d6b1ad1ccd9a8f91b169f30ff99492cf3adcccac), [`e143a8697`](https://github.com/medusajs/medusa/commit/e143a86976a5cc6a53b7a795e8486df4db1d1c09), [`121b42acf`](https://github.com/medusajs/medusa/commit/121b42acfe98c12dd593f9b1f2072ff0f3b61724), [`84e448968`](https://github.com/medusajs/medusa/commit/84e44896836b2c44017572ac5192ab1cd937048c), [`33c6ccf05`](https://github.com/medusajs/medusa/commit/33c6ccf0591b8ef527f3b10a70b51e29751b4998), [`788ddc0f4`](https://github.com/medusajs/medusa/commit/788ddc0f43696df607f07133af15a04b29d5447d), [`5fd74b38a`](https://github.com/medusajs/medusa/commit/5fd74b38ae1b4f7dced191983b78db83f7b1f71b), [`30a320364`](https://github.com/medusajs/medusa/commit/30a3203640be9993ba2f8447abfdecc0d3e2f9b6), [`240d0ea7b`](https://github.com/medusajs/medusa/commit/240d0ea7b88ff494d0fe28c7c5348e958c14571f), [`6c0462472`](https://github.com/medusajs/medusa/commit/6c046247275c46d934f03d53471bdd555a19a9ad), [`589d1c09b`](https://github.com/medusajs/medusa/commit/589d1c09b085dcaf9667061201ac9deff3047466), [`0695ff642`](https://github.com/medusajs/medusa/commit/0695ff642b5836e7c28d40118aafe7a769023d5a), [`530740889`](https://github.com/medusajs/medusa/commit/53074088941719ac7ca435e76e3e64ba23fac200), [`13f40d721`](https://github.com/medusajs/medusa/commit/13f40d721702fbcdf6c131354ec9a81322d4a662), [`4342ac884`](https://github.com/medusajs/medusa/commit/4342ac884bc3fe473576ef10d291f3547e0ffc62), [`fe9eea4c1`](https://github.com/medusajs/medusa/commit/fe9eea4c18b7e04ba91660716c92b11a49840a3c), [`a5ad6c054`](https://github.com/medusajs/medusa/commit/a5ad6c05428e1bb090bbc5a51345a00821781c06), [`748833383`](https://github.com/medusajs/medusa/commit/748833383f4bafd05109dac7afa1286fe851cba3), [`7f87c4f2c`](https://github.com/medusajs/medusa/commit/7f87c4f2c8abb876213a595005e67d770be9cbe4), [`e5a2e9c8d`](https://github.com/medusajs/medusa/commit/e5a2e9c8d237bbe4e3563f5a7a892ca41f01ba24), [`0a02b70e5`](https://github.com/medusajs/medusa/commit/0a02b70e59cfbd8888fb58c29ee9aaf96eb8099a), [`8ddb3952c`](https://github.com/medusajs/medusa/commit/8ddb3952c045e6c05c8d0f6922f0d4ba30cf3bd4), [`fe4b8feb7`](https://github.com/medusajs/medusa/commit/fe4b8feb7e0af2ffc436ca77a769ecb37e16e652), [`aa690beed`](https://github.com/medusajs/medusa/commit/aa690beed775646cbc86b445fb5dc90dcac087d5), [`5eb61fa0e`](https://github.com/medusajs/medusa/commit/5eb61fa0ef991b8a9fabb16c2c159e51b9541867), [`f033711ad`](https://github.com/medusajs/medusa/commit/f033711ad649466d72dd9f673d75848c97c0861f), [`eed784d7d`](https://github.com/medusajs/medusa/commit/eed784d7d0b58aeddc9f6f5ea56fe80c608b22f5), [`3171b0e51`](https://github.com/medusajs/medusa/commit/3171b0e518aebcaa31bbe5c6e914d65282873cda), [`a0c919a8d`](https://github.com/medusajs/medusa/commit/a0c919a8d01ca5edf62336de48e9a112e3822f38), [`522e306e2`](https://github.com/medusajs/medusa/commit/522e306e2e9abf4afce63f30714389eba32bef7f), [`80b95a230`](https://github.com/medusajs/medusa/commit/80b95a230056d9ed15f7302f248094f879516faf), [`a1e59313c`](https://github.com/medusajs/medusa/commit/a1e59313c964a944a287b54f6654d1d19ac8a59b), [`10bf05c14`](https://github.com/medusajs/medusa/commit/10bf05c147cb65a263465129790edd44a6d8948b), [`cbbf3ca05`](https://github.com/medusajs/medusa/commit/cbbf3ca054387a900c5777c2eb0218df2c72bae6), [`9ba09ba4d`](https://github.com/medusajs/medusa/commit/9ba09ba4d753f132537f0447097fe9f54922c074), [`12d304307`](https://github.com/medusajs/medusa/commit/12d304307af87ea9287a41869eb33ef09f273d85), [`693015fde`](https://github.com/medusajs/medusa/commit/693015fde3218d67fb9c07eebeaea9950bf3f1f1), [`287c829c9`](https://github.com/medusajs/medusa/commit/287c829c9c5a9797fb8cd118b7a6066ad1935898), [`74bc4b16a`](https://github.com/medusajs/medusa/commit/74bc4b16a07f78668003ca930bf2a0d928897ceb), [`0cca13779`](https://github.com/medusajs/medusa/commit/0cca13779d0e84683193ad82ab163a10a807e903), [`aed7805c0`](https://github.com/medusajs/medusa/commit/aed7805c0e64b884007148bde90cfce7bee8aad4), [`e359d3f85`](https://github.com/medusajs/medusa/commit/e359d3f85bc12fd3868fc4b563cd994366e899dd), [`0d1b63d77`](https://github.com/medusajs/medusa/commit/0d1b63d773ad91846757a6f0b81b78b0b97b3f2b), [`4042beb10`](https://github.com/medusajs/medusa/commit/4042beb1026b9ad8b381aaa6e1a5214cd92db00f), [`809ab2e0e`](https://github.com/medusajs/medusa/commit/809ab2e0eb2d62054481fa6491d3f7cafbadab4f), [`f43e9f0f2`](https://github.com/medusajs/medusa/commit/f43e9f0f20a8b0637252951b2bdfed4d42fb9f5e), [`842423679`](https://github.com/medusajs/medusa/commit/8424236799c3789f884285cd3c8a491e91aef2ca), [`935870e01`](https://github.com/medusajs/medusa/commit/935870e010af1ec884259b1f1328421e99acc3af), [`57d7728dd`](https://github.com/medusajs/medusa/commit/57d7728dd9d00df712e1a872899b8397955dfe46), [`15f47baf5`](https://github.com/medusajs/medusa/commit/15f47baf56e6722b7821cfaa2fb468e582dfa2c1), [`999aeb116`](https://gitLine truncated
- @medusajs/medusa@1.8.0
- medusa-core-utils@1.2.0
- medusa-interfaces@1.3.7
## 3.0.0-rc.8
### Patch Changes
- Updated dependencies [[`4488ec685`](https://github.com/medusajs/medusa/commit/4488ec68524f95f367cbd352e9e5eb1957d1d0d6)]:
- @medusajs/medusa@1.8.0-rc.8
## 3.0.0-rc.7
### Patch Changes
- Updated dependencies [[`748833383`](https://github.com/medusajs/medusa/commit/748833383f4bafd05109dac7afa1286fe851cba3), [`e5a2e9c8d`](https://github.com/medusajs/medusa/commit/e5a2e9c8d237bbe4e3563f5a7a892ca41f01ba24)]:
- @medusajs/medusa@1.8.0-rc.7
## 3.0.0-rc.6
### Patch Changes
- Updated dependencies [[`788ddc0f4`](https://github.com/medusajs/medusa/commit/788ddc0f43696df607f07133af15a04b29d5447d), [`a5ad6c054`](https://github.com/medusajs/medusa/commit/a5ad6c05428e1bb090bbc5a51345a00821781c06), [`7f87c4f2c`](https://github.com/medusajs/medusa/commit/7f87c4f2c8abb876213a595005e67d770be9cbe4), [`eed784d7d`](https://github.com/medusajs/medusa/commit/eed784d7d0b58aeddc9f6f5ea56fe80c608b22f5), [`a0c919a8d`](https://github.com/medusajs/medusa/commit/a0c919a8d01ca5edf62336de48e9a112e3822f38), [`0cca13779`](https://github.com/medusajs/medusa/commit/0cca13779d0e84683193ad82ab163a10a807e903)]:
- @medusajs/medusa@1.8.0-rc.6
## 3.0.0-rc.5
### Patch Changes
- Updated dependencies [[`4342ac884`](https://github.com/medusajs/medusa/commit/4342ac884bc3fe473576ef10d291f3547e0ffc62), [`809ab2e0e`](https://github.com/medusajs/medusa/commit/809ab2e0eb2d62054481fa6491d3f7cafbadab4f)]:
- @medusajs/medusa@1.8.0-rc.5
## 3.0.0-rc.4
### Patch Changes
- Updated dependencies [[`5fd74b38a`](https://github.com/medusajs/medusa/commit/5fd74b38ae1b4f7dced191983b78db83f7b1f71b), [`999aeb116`](https://github.com/medusajs/medusa/commit/999aeb116c4742e5b5e0d80793af23f7727276f0), [`5e405be02`](https://github.com/medusajs/medusa/commit/5e405be02cc94779222dc3d930e747027496d918), [`a7e3f2d34`](https://github.com/medusajs/medusa/commit/a7e3f2d343c4059ba83022ec5c09f8101b251297)]:
- @medusajs/medusa@1.8.0-rc.4
## 3.0.0-rc.3
### Patch Changes
- Updated dependencies [[`0695ff642`](https://github.com/medusajs/medusa/commit/0695ff642b5836e7c28d40118aafe7a769023d5a), [`693015fde`](https://github.com/medusajs/medusa/commit/693015fde3218d67fb9c07eebeaea9950bf3f1f1)]:
- @medusajs/medusa@1.8.0-rc.3
## 3.0.0-rc.2
### Patch Changes
- Updated dependencies []:
- @medusajs/medusa@1.8.0-rc.2
## 3.0.0-rc.1
### Patch Changes
- Updated dependencies [[`530740889`](https://github.com/medusajs/medusa/commit/53074088941719ac7ca435e76e3e64ba23fac200), [`e359d3f85`](https://github.com/medusajs/medusa/commit/e359d3f85bc12fd3868fc4b563cd994366e899dd), [`bca1f80dd`](https://github.com/medusajs/medusa/commit/bca1f80dd501d878455e1ad4f5091cf20ef900ea), [`5f41cd9a6`](https://github.com/medusajs/medusa/commit/5f41cd9a67eb0962f999291594c0aac5e38eb916), [`1ce3cc5ae`](https://github.com/medusajs/medusa/commit/1ce3cc5ae4e4cb16eb03be49c9287503f759fc60), [`332a9b686`](https://github.com/medusajs/medusa/commit/332a9b686bd0d224855215213dd11b4704283f62), [`feaf8d2e1`](https://github.com/medusajs/medusa/commit/feaf8d2e19715585d154464d003759c3a1f4f322)]:
- @medusajs/medusa@1.8.0-rc.1
## 3.0.0-rc.0
### Patch Changes
- Updated dependencies [[`d6b1ad1cc`](https://github.com/medusajs/medusa/commit/d6b1ad1ccd9a8f91b169f30ff99492cf3adcccac), [`e143a8697`](https://github.com/medusajs/medusa/commit/e143a86976a5cc6a53b7a795e8486df4db1d1c09), [`121b42acf`](https://github.com/medusajs/medusa/commit/121b42acfe98c12dd593f9b1f2072ff0f3b61724), [`84e448968`](https://github.com/medusajs/medusa/commit/84e44896836b2c44017572ac5192ab1cd937048c), [`33c6ccf05`](https://github.com/medusajs/medusa/commit/33c6ccf0591b8ef527f3b10a70b51e29751b4998), [`30a320364`](https://github.com/medusajs/medusa/commit/30a3203640be9993ba2f8447abfdecc0d3e2f9b6), [`240d0ea7b`](https://github.com/medusajs/medusa/commit/240d0ea7b88ff494d0fe28c7c5348e958c14571f), [`6c0462472`](https://github.com/medusajs/medusa/commit/6c046247275c46d934f03d53471bdd555a19a9ad), [`589d1c09b`](https://github.com/medusajs/medusa/commit/589d1c09b085dcaf9667061201ac9deff3047466), [`13f40d721`](https://github.com/medusajs/medusa/commit/13f40d721702fbcdf6c131354ec9a81322d4a662), [`fe9eea4c1`](https://github.com/medusajs/medusa/commit/fe9eea4c18b7e04ba91660716c92b11a49840a3c), [`0a02b70e5`](https://github.com/medusajs/medusa/commit/0a02b70e59cfbd8888fb58c29ee9aaf96eb8099a), [`fe4b8feb7`](https://github.com/medusajs/medusa/commit/fe4b8feb7e0af2ffc436ca77a769ecb37e16e652), [`aa690beed`](https://github.com/medusajs/medusa/commit/aa690beed775646cbc86b445fb5dc90dcac087d5), [`5eb61fa0e`](https://github.com/medusajs/medusa/commit/5eb61fa0ef991b8a9fabb16c2c159e51b9541867), [`f033711ad`](https://github.com/medusajs/medusa/commit/f033711ad649466d72dd9f673d75848c97c0861f), [`3171b0e51`](https://github.com/medusajs/medusa/commit/3171b0e518aebcaa31bbe5c6e914d65282873cda), [`522e306e2`](https://github.com/medusajs/medusa/commit/522e306e2e9abf4afce63f30714389eba32bef7f), [`80b95a230`](https://github.com/medusajs/medusa/commit/80b95a230056d9ed15f7302f248094f879516faf), [`a1e59313c`](https://github.com/medusajs/medusa/commit/a1e59313c964a944a287b54f6654d1d19ac8a59b), [`10bf05c14`](https://github.com/medusajs/medusa/commit/10bf05c147cb65a263465129790edd44a6d8948b), [`cbbf3ca05`](https://github.com/medusajs/medusa/commit/cbbf3ca054387a900c5777c2eb0218df2c72bae6), [`9ba09ba4d`](https://github.com/medusajs/medusa/commit/9ba09ba4d753f132537f0447097fe9f54922c074), [`12d304307`](https://github.com/medusajs/medusa/commit/12d304307af87ea9287a41869eb33ef09f273d85), [`287c829c9`](https://github.com/medusajs/medusa/commit/287c829c9c5a9797fb8cd118b7a6066ad1935898), [`74bc4b16a`](https://github.com/medusajs/medusa/commit/74bc4b16a07f78668003ca930bf2a0d928897ceb), [`aed7805c0`](https://github.com/medusajs/medusa/commit/aed7805c0e64b884007148bde90cfce7bee8aad4), [`0d1b63d77`](https://github.com/medusajs/medusa/commit/0d1b63d773ad91846757a6f0b81b78b0b97b3f2b), [`4042beb10`](https://github.com/medusajs/medusa/commit/4042beb1026b9ad8b381aaa6e1a5214cd92db00f), [`f43e9f0f2`](https://github.com/medusajs/medusa/commit/f43e9f0f20a8b0637252951b2bdfed4d42fb9f5e), [`842423679`](https://github.com/medusajs/medusa/commit/8424236799c3789f884285cd3c8a491e91aef2ca), [`935870e01`](https://github.com/medusajs/medusa/commit/935870e010af1ec884259b1f1328421e99acc3af), [`57d7728dd`](https://github.com/medusajs/medusa/commit/57d7728dd9d00df712e1a872899b8397955dfe46), [`15f47baf5`](https://github.com/medusajs/medusa/commit/15f47baf56e6722b7821cfaa2fb468e582dfa2c1), [`55c5fba0d`](https://github.com/medusajs/medusa/commit/55c5fba0d3dbd015c3ffd74d645a8057892d0f52), [`38503fff5`](https://github.com/medusajs/medusa/commit/38503fff56bbceb092e396ac11432a56967b53e9), [`40de54b01`](https://github.com/medusajs/medusa/commit/40de54b0101bdfd37f577d18c10ec9f1ab1ce8fe), [`54dcc1871`](https://github.com/medusajs/medusa/commit/54dcc1871c8f28bea962dbb9df6e79b038d56449), [`478d1af8d`](https://github.com/medusajs/medusa/commit/478d1af8d0df0af16baf4f130e19b0be34f5f295), [`77d46220c`](https://github.com/medusajs/medusa/commit/77d46220c23bfe19e575cbc445874eb6c22f3c73), [`6748877c6`](https://github.com/medusajs/medusa/commit/6748877c694c1433f666c6987f20af76b201b495), [`7e17e0ddc`](https://github.com/medusajs/medusa/commit/7e17e0ddc2e6b2891e9ee1420b04a541899d2a9d), [`7f2223b65`](https://github.com/medusajs/medusa/commit/7f2223b6507b0a3c452977bfcdee92af2086fa29), [`7d585f5f8`](https://github.com/medusajs/medusa/commit/7d585f5f84a910c02d274df7a489dc3ff1ea273a), [`4e9d257d3`](https://github.com/medusajs/medusa/commit/4e9d257d3bf76703ef5be8ca054cc9f0f7339def), [`ef5ef9f5a`](https://github.com/medusajs/medusa/commit/ef5ef9f5a26febf0b64d9981606c1e59999ca76e), [`46547f29c`](https://github.com/medusajs/medusa/commit/46547f29c755719e22d2977c5e5f8ab8a4a7fcae), [`f97b3d7cc`](https://github.com/medusajs/medusa/commit/f97b3d7ccee381d3491337ab5144bb44520382a7), [`f3bf351d2`](https://github.com/medusajs/medusa/commit/f3bf351d21d1c2a67ed2d603c8b7ed4ae5cbd366), [`d61d6c7b7`](https://github.com/medusajs/medusa/commit/d61d6c7b7f8549996090f5315597d22d2af968f9), [`55a1f232a`](https://gitLine truncated
- @medusajs/medusa@1.8.0-rc.0
- medusa-core-utils@1.2.0-rc.0
- medusa-interfaces@1.3.7-rc.0
## 2.0.4
### Patch Changes
- [#3217](https://github.com/medusajs/medusa/pull/3217) [`8c5219a31`](https://github.com/medusajs/medusa/commit/8c5219a31ef76ee571fbce84d7d57a63abe56eb0) Thanks [@adrien2p](https://github.com/adrien2p)! - chore: Fix npm packages files included
- Updated dependencies [[`507ad00be`](https://github.com/medusajs/medusa/commit/507ad00bec74bb63b17eae8a4a3313eb6e0d2503), [`6e443dc70`](https://github.com/medusajs/medusa/commit/6e443dc708ffe20bf96d45ddc207ed274c28e344), [`eee928381`](https://github.com/medusajs/medusa/commit/eee9283818b1717f37f084c319201ea7144fdf8a), [`4cb44a3a2`](https://github.com/medusajs/medusa/commit/4cb44a3a2ec5bcf3d90e3b6a0e1f6bb9ff45e2b6), [`472f96d7f`](https://github.com/medusajs/medusa/commit/472f96d7fb8668a15df6e6f9ea31291891b3e688), [`61b0b2f3a`](https://github.com/medusajs/medusa/commit/61b0b2f3aa1d54d539b216a99032549485136a82), [`80452332d`](https://github.com/medusajs/medusa/commit/80452332d852ad7d33d74e1f08f12f45d7a35503), [`bbbb3d888`](https://github.com/medusajs/medusa/commit/bbbb3d888292391976355c88ecb0fcf8a7c115bc), [`10ff72c30`](https://github.com/medusajs/medusa/commit/10ff72c30ae59d2174d876b0c4141aad135d9a1c), [`968eb8fc6`](https://github.com/medusajs/medusa/commit/968eb8fc6b7ccd7221f88f42d75717f3a0547861), [`a59bd84e4`](https://github.com/medusajs/medusa/commit/a59bd84e41fb5d8fc2edc7bdc43d3cbf74d9d7dc), [`8c5219a31`](https://github.com/medusajs/medusa/commit/8c5219a31ef76ee571fbce84d7d57a63abe56eb0), [`cac13a88d`](https://github.com/medusajs/medusa/commit/cac13a88da42fa986bd7352fbc12a318b566d98f), [`a2cc084db`](https://github.com/medusajs/medusa/commit/a2cc084db817f8f7699e9b0daceda274b5f0e0c0), [`8194d19b0`](https://github.com/medusajs/medusa/commit/8194d19b0e933310fdc65af25300da5dd185e669)]:
- @medusajs/medusa@1.7.7
- medusa-core-utils@1.1.39
- medusa-interfaces@1.3.6
## 2.0.3
### Patch Changes
- [#3185](https://github.com/medusajs/medusa/pull/3185) [`08324355a`](https://github.com/medusajs/medusa/commit/08324355a4466b017a0bc7ab1d333ee3cd27b8c4) Thanks [@olivermrbl](https://github.com/olivermrbl)! - chore: Patches all dependencies + minor bumps `winston` to include a [fix for a significant memory leak](https://github.com/winstonjs/winston/pull/2057)
- Updated dependencies [[`ce866475b`](https://github.com/medusajs/medusa/commit/ce866475b4b6c8b453638000f7b1df7a27daf45d), [`53532df8d`](https://github.com/medusajs/medusa/commit/53532df8d597ed5471c07296981b6959cba4ddc3), [`d8ffbe25b`](https://github.com/medusajs/medusa/commit/d8ffbe25b047fda0f644240c9f518f95e74f03cb), [`2d525237b`](https://github.com/medusajs/medusa/commit/2d525237b682e89495b6cc8e3aa677bfad4d0726), [`5b63533c7`](https://github.com/medusajs/medusa/commit/5b63533c77528cab31755cedab9e768f7461f373), [`09dc9c667`](https://github.com/medusajs/medusa/commit/09dc9c6677c0d64cf765b27290e707ea75edd4aa), [`4105405f2`](https://github.com/medusajs/medusa/commit/4105405f28c3f3e54a6077c95a575a268fb5569f), [`ee42b60a2`](https://github.com/medusajs/medusa/commit/ee42b60a20db2afc5e9b6b958502f9e86ec37d80), [`d0adaf57e`](https://github.com/medusajs/medusa/commit/d0adaf57ed1018f29bebf01e5cffde5f7192f89f), [`f65f590a2`](https://github.com/medusajs/medusa/commit/f65f590a2771d6e526d7dfc7ca721be74c8f79a9), [`5ec6d438f`](https://github.com/medusajs/medusa/commit/5ec6d438fb1f909be925461c788f3a3a958528e4), [`5c1d2a5e8`](https://github.com/medusajs/medusa/commit/5c1d2a5e83c3654ae468d17c900892c32ef76060), [`8e41c6996`](https://github.com/medusajs/medusa/commit/8e41c6996601142661bde877b9ee1d80b8325f5f), [`d50db84a3`](https://github.com/medusajs/medusa/commit/d50db84a336da2de9c06a59aa79f2a5e9aa558f1), [`82da3605f`](https://github.com/medusajs/medusa/commit/82da3605fb50cef182699900552109ad654f0df2), [`b242e2232`](https://github.com/medusajs/medusa/commit/b242e22326ce74d5437d0da6863f22facbb5964c), [`4339d47e1`](https://github.com/medusajs/medusa/commit/4339d47e1f6c9f6c8f100b3ac72c8a394b6dd44d), [`2e7e16b91`](https://github.com/medusajs/medusa/commit/2e7e16b9173e2779946776b9b07ce7232c683f36), [`9ebb50104`](https://github.com/medusajs/medusa/commit/9ebb50104cc1f6c8ef1cea446ae595fb2eb532a2), [`08324355a`](https://github.com/medusajs/medusa/commit/08324355a4466b017a0bc7ab1d333ee3cd27b8c4), [`e22a383f4`](https://github.com/medusajs/medusa/commit/e22a383f4738e8bc80394ccaba3ac9a4ae678955), [`dc156861d`](https://github.com/medusajs/medusa/commit/dc156861d413ecfe3fd264bcd5ad736d83d8a08e), [`8f4c84121`](https://github.com/medusajs/medusa/commit/8f4c84121bd9b8c7067d72f03125e13afe4d2571), [`bfa33f444`](https://github.com/medusajs/medusa/commit/bfa33f444cd225906149777c5c6e842685f3dd7c), [`f776ed234`](https://github.com/medusajs/medusa/commit/f776ed234fcfccf23041ffebecbae6c9a8b7e922), [`4d6e63d68`](https://github.com/medusajs/medusa/commit/4d6e63d68f4e64c365ecbba133876d95e6528763), [`fcba70570`](https://github.com/medusajs/medusa/commit/fcba705701b8013183fafb39e8dda4a85718080a), [`4f0d8992a`](https://github.com/medusajs/medusa/commit/4f0d8992a091a05e93dd5be3762dfa47f074610e), [`d25a53104`](https://github.com/medusajs/medusa/commit/d25a531045143d3be68d3cd3b5764bbbc792ee3a), [`86c87c7b1`](https://github.com/medusajs/medusa/commit/86c87c7b1020ab6bb02f931e1ee113f2857cf527), [`78650ea66`](https://github.com/medusajs/medusa/commit/78650ea66517b0a77100228615d8122f84ad235b), [`b9bda3bf4`](https://github.com/medusajs/medusa/commit/b9bda3bf4e0f95675041085cea5008268c37edd5), [`e581d3bd9`](https://github.com/medusajs/medusa/commit/e581d3bd90f9bc40105e7eaf34e0c94d4f657f7a), [`4d3210bfb`](https://github.com/medusajs/medusa/commit/4d3210bfbb84877d951f7319d2e87c1acbdd6aad)]:
- @medusajs/medusa@1.7.6
- medusa-core-utils@1.1.38
- medusa-interfaces@1.3.5
## 2.0.2
### Patch Changes
- [#3025](https://github.com/medusajs/medusa/pull/3025) [`93d0dc1bd`](https://github.com/medusajs/medusa/commit/93d0dc1bdcb54cf6e87428a7bb9b0dac196b4de2) Thanks [@adrien2p](https://github.com/adrien2p)! - fix(medusa): test, build and watch scripts
- Updated dependencies [[`9dbccd9ca`](https://github.com/medusajs/medusa/commit/9dbccd9ca78b8b66f9a21947bb863622e7ff326b), [`542daeead`](https://github.com/medusajs/medusa/commit/542daeeadd78d939f5144c690e8907374da6d085), [`8c08d0031`](https://github.com/medusajs/medusa/commit/8c08d003198b94c00f8428a51c0e79d2ca9d1dc7), [`017538883`](https://github.com/medusajs/medusa/commit/017538883588792e1ff37abcab0fd2872c9af932), [`b2839e2e4`](https://github.com/medusajs/medusa/commit/b2839e2e4dc0d9344fa2ac8d4d16b796def4c56d), [`76d175231`](https://github.com/medusajs/medusa/commit/76d17523105d3860028a90a45b6038a64040e5ce), [`9e3beaf53`](https://github.com/medusajs/medusa/commit/9e3beaf5319dc785cf84b856cfcc8193df90c3a4), [`7d4b8b9cc`](https://github.com/medusajs/medusa/commit/7d4b8b9cc59672d01cdf0c6f331bc3d1eeec9bee), [`aab163bab`](https://github.com/medusajs/medusa/commit/aab163babb91759a05b852d34c299cdfac96d800), [`a0c4cfe0f`](https://github.com/medusajs/medusa/commit/a0c4cfe0f74cf30c45956c32c2fb22bf833bea68), [`27a29ef24`](https://github.com/medusajs/medusa/commit/27a29ef24e5ea1ba2bc0be8ecb7dd747d4c7c65b), [`aef842123`](https://github.com/medusajs/medusa/commit/aef8421235d8fff68d7d4f8b73f77484073311a5), [`1dc79590b`](https://github.com/medusajs/medusa/commit/1dc79590b3539af09dbc8fbf931d9b5ee225fb0d), [`9c4647383`](https://github.com/medusajs/medusa/commit/9c4647383ebf0a183ccc566636bcf7af06409060), [`a0c4cfe0f`](https://github.com/medusajs/medusa/commit/a0c4cfe0f74cf30c45956c32c2fb22bf833bea68), [`b80124d32`](https://github.com/medusajs/medusa/commit/b80124d32d950790c2a01b49e8c34d562b1d57f4), [`cb1ec0076`](https://github.com/medusajs/medusa/commit/cb1ec0076b4fd932c686d6027e8b060ceded3a64), [`142c8aa70`](https://github.com/medusajs/medusa/commit/142c8aa70f583d9b11a6add2b8f988e9ba4cf979), [`1547dd814`](https://github.com/medusajs/medusa/commit/1547dd8143889fc30045fc3d0241de8e69acb76e), [`d2c692aa9`](https://github.com/medusajs/medusa/commit/d2c692aa96ea89c053f9a694a9ae6dba77e89b14), [`150696de9`](https://github.com/medusajs/medusa/commit/150696de99fc852c5d72a746f168b6f62b2086ed), [`93d0dc1bd`](https://github.com/medusajs/medusa/commit/93d0dc1bdcb54cf6e87428a7bb9b0dac196b4de2), [`b3e4be720`](https://github.com/medusajs/medusa/commit/b3e4be72087d0b528c3cce322edf9325b855c8ae)]:
- @medusajs/medusa@1.7.4
- medusa-interfaces@1.3.4
## 2.0.1
### Patch Changes
- [#2808](https://github.com/medusajs/medusa/pull/2808) [`0a9c89185`](https://github.com/medusajs/medusa/commit/0a9c891853c4d16b553d38268a3408ca1daa71f0) Thanks [@patrick-medusajs](https://github.com/patrick-medusajs)! - chore: explicitly add devDependencies for monorepo peerDependencies
- Updated dependencies [[`7cced6006`](https://github.com/medusajs/medusa/commit/7cced6006a9a6f9108009e9f3e191e9f3ba1b168), [`463f83ffd`](https://github.com/medusajs/medusa/commit/463f83ffdd450d5325a57fe742b68bfb32ef1a42), [`17c3f34e3`](https://github.com/medusajs/medusa/commit/17c3f34e3df0a4c3656ad8909608331e207155f1), [`c16522d6c`](https://github.com/medusajs/medusa/commit/c16522d6ce806aa6289d626b868818409f41c66e), [`2e5ceb795`](https://github.com/medusajs/medusa/commit/2e5ceb795008fbf53d19bb79ac561561dd11311e), [`71b536e01`](https://github.com/medusajs/medusa/commit/71b536e01e32e3ab3fb5d295df9d67497a8bbe6d), [`9e05fef4b`](https://github.com/medusajs/medusa/commit/9e05fef4b973ceb60a2b975c839de96ca743597b), [`3113d8024`](https://github.com/medusajs/medusa/commit/3113d8024fdeb09230675c2053fcefe811e575fd), [`e27b1940c`](https://github.com/medusajs/medusa/commit/e27b1940c7249e835404ac5490cf39e93053d2bb), [`5e4decbc1`](https://github.com/medusajs/medusa/commit/5e4decbc1c4cc25cb1adb1f63b2f8ea8669d352e), [`b700c6ba5`](https://github.com/medusajs/medusa/commit/b700c6ba5b323c7c5e200f721f0335f40b3e357a), [`8a60a7338`](https://github.com/medusajs/medusa/commit/8a60a73389c1b5c8abf96fbbcc7be7c4d427041d), [`ba6bb3e54`](https://github.com/medusajs/medusa/commit/ba6bb3e54b9989cecf476c7411c406a43562efe1), [`ea460b4e0`](https://github.com/medusajs/medusa/commit/ea460b4e0b1a9aa0fe1ab66bc21a8c40f76a65b3), [`c8724da50`](https://github.com/medusajs/medusa/commit/c8724da50300b94255c5fb4ffe9904be279b5923), [`8dcc805cc`](https://github.com/medusajs/medusa/commit/8dcc805ccf8da619549e77f009d6c4d7b2b6c99a), [`a027d5ff9`](https://github.com/medusajs/medusa/commit/a027d5ff9eb821a1c8728476e4f8bf5f4dd102c8)]:
- medusa-core-utils@1.1.37
- @medusajs/medusa@1.7.1
## 2.0.0
### Patch Changes
- Updated dependencies [[`198fe78c1`](https://github.com/medusajs/medusa/commit/198fe78c138455f16d02406234fcfb05c4581372), [`72f70bc78`](https://github.com/medusajs/medusa/commit/72f70bc789e7c4a9df512745f7fc809595a3b503), [`e63777e3c`](https://github.com/medusajs/medusa/commit/e63777e3c52fe34ed502c3b0ceb82e3e1e993474), [`70a8d3450`](https://github.com/medusajs/medusa/commit/70a8d3450fb8551bb25a3e50be4ef74dc361c946), [`1b21af87a`](https://github.com/medusajs/medusa/commit/1b21af87ab80c18013f0f44434e59b873c2313aa), [`ed121922b`](https://github.com/medusajs/medusa/commit/ed121922b04e2e2af672fa6ab5ad69cd3cf17040), [`346461755`](https://github.com/medusajs/medusa/commit/3464617553770353a5d781caea8bdf880c72909f), [`e18b59de6`](https://github.com/medusajs/medusa/commit/e18b59de66ef52698d3f6b5ebec9f212a52fce02), [`42d9c7222`](https://github.com/medusajs/medusa/commit/42d9c7222b05ea231a920ea0694f6be8c13a956a), [`33aa3edb8`](https://github.com/medusajs/medusa/commit/33aa3edb805c217cf8e024af4c5be1835eb397dd), [`1dc816039`](https://github.com/medusajs/medusa/commit/1dc816039cdd332d50e3d979f78c5ee0f820db97), [`a6243618f`](https://github.com/medusajs/medusa/commit/a6243618fef5f9dd51ccba9e07e7849dd177202c), [`cb2a32a82`](https://github.com/medusajs/medusa/commit/cb2a32a82b2a4d89e57a120262a9eee002ee29a9), [`c2c38dd09`](https://github.com/medusajs/medusa/commit/c2c38dd091dd0938c8be63e515ccbc3158f72378), [`424efff91`](https://github.com/medusajs/medusa/commit/424efff91943dad3982b44a8549e828678c3e1b4), [`b2ea8b7d4`](https://github.com/medusajs/medusa/commit/b2ea8b7d45e91f671cd8c20fe9270c0e9c5f94cc), [`b5d6682db`](https://github.com/medusajs/medusa/commit/b5d6682db66a7e4f6729c24fbec075a2faef87c4), [`d68e81fb3`](https://github.com/medusajs/medusa/commit/d68e81fb3df116af70738eef93e227f41b72d80b)]:
- @medusajs/medusa@1.7.0
- medusa-core-utils@1.1.36
## 1.0.1
### Patch Changes
- [#2623](https://github.com/medusajs/medusa/pull/2623) [`533208197`](https://github.com/medusajs/medusa/commit/5332081972cdd08b4d718799097d78043279057b) Thanks [@pKorsholm](https://github.com/pKorsholm)! - Bump dependency version for medusa packages
- Updated dependencies [[`f60267a49`](https://github.com/medusajs/medusa/commit/f60267a494f95d85b6007e617a1f9b0146854bae), [`022a84691`](https://github.com/medusajs/medusa/commit/022a84691eb84f408bcc36921d23703d498c847f), [`5d977a8f5`](https://github.com/medusajs/medusa/commit/5d977a8f57552af02eae0a44016b2213609b6d92), [`e09f6e8a1`](https://github.com/medusajs/medusa/commit/e09f6e8a1e4a759fe70664bea0538c61b7cea70a), [`9e91a50df`](https://github.com/medusajs/medusa/commit/9e91a50df17b4f542db8d9678b5f489218511adb), [`a77780671`](https://github.com/medusajs/medusa/commit/a77780671aadc311c0e8a541104cbff1ea769ac7), [`d7997ef25`](https://github.com/medusajs/medusa/commit/d7997ef256b7fd98d96be720c9aec694e426f92f)]:
- @medusajs/medusa@1.6.5
## 1.0.0
### Patch Changes
- Updated dependencies [[`64949dc72`](https://github.com/medusajs/medusa/commit/64949dc721a6c697e3eb7091db9f2d261111a766), [`b6161d240`](https://github.com/medusajs/medusa/commit/b6161d24043b8b910320475b8616b7e29a96f6cd), [`af80e0fd2`](https://github.com/medusajs/medusa/commit/af80e0fd2ed75cd3c15282ddcbfb949060dfdd33)]:
- @medusajs/medusa@1.4.0
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.0.32](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.31...medusa-plugin-restock-notification@0.0.32) (2022-02-06)
### Bug Fixes
- release ([fc3fbc8](https://github.com/medusajs/medusa/commit/fc3fbc897fad5c8a5d3eea828ac7277fba9d70af))
## [0.0.31](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.30...medusa-plugin-restock-notification@0.0.31) (2022-02-06)
### Features
- medusa-react admin hooks ([#978](https://github.com/medusajs/medusa/issues/978)) ([2e38484](https://github.com/medusajs/medusa/commit/2e384842d5b2e9742a86b96f28a8f00357795b86)), closes [#1019](https://github.com/medusajs/medusa/issues/1019)
## [0.0.30](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.29...medusa-plugin-restock-notification@0.0.30) (2022-01-11)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.29](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.28...medusa-plugin-restock-notification@0.0.29) (2021-12-29)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.28](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.27...medusa-plugin-restock-notification@0.0.28) (2021-12-17)
### Features
- add medusa-react ([#913](https://github.com/medusajs/medusa/issues/913)) ([d0d8dd7](https://github.com/medusajs/medusa/commit/d0d8dd7bf62eaac71df8714c2dfb4f204d192f51))
## [0.0.27](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.26...medusa-plugin-restock-notification@0.0.27) (2021-12-08)
### Bug Fixes
- ensures that delayed restock notifications are being sent ([#881](https://github.com/medusajs/medusa/issues/881)) ([329767e](https://github.com/medusajs/medusa/commit/329767e27980253d456030dd5aad648662d39e3d))
## [0.0.26](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.25...medusa-plugin-restock-notification@0.0.26) (2021-11-23)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.25](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.24...medusa-plugin-restock-notification@0.0.25) (2021-11-22)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.24](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.22...medusa-plugin-restock-notification@0.0.24) (2021-11-19)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.23](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.22...medusa-plugin-restock-notification@0.0.23) (2021-11-19)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.22](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.21...medusa-plugin-restock-notification@0.0.22) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.21](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.20...medusa-plugin-restock-notification@0.0.21) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.20](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.18...medusa-plugin-restock-notification@0.0.20) (2021-10-18)
### Bug Fixes
- add delay before triggering email ([#458](https://github.com/medusajs/medusa/issues/458)) ([ee2f7c6](https://github.com/medusajs/medusa/commit/ee2f7c6333a0e8a4fa1454c514662bb83ce16346))
## [0.0.19](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.18...medusa-plugin-restock-notification@0.0.19) (2021-10-18)
### Bug Fixes
- add delay before triggering email ([#458](https://github.com/medusajs/medusa/issues/458)) ([ee2f7c6](https://github.com/medusajs/medusa/commit/ee2f7c6333a0e8a4fa1454c514662bb83ce16346))
## [0.0.18](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.18...medusa-plugin-restock-notification@0.0.18) (2021-09-15)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.17](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.18...medusa-plugin-restock-notification@0.0.17) (2021-09-14)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.18](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.16...medusa-plugin-restock-notification@0.0.18) (2021-09-02)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.17](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.16...medusa-plugin-restock-notification@0.0.17) (2021-08-31)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.16](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.15...medusa-plugin-restock-notification@0.0.16) (2021-08-05)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.15](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.14...medusa-plugin-restock-notification@0.0.15) (2021-07-26)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.14](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.12...medusa-plugin-restock-notification@0.0.14) (2021-07-15)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.13](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.12...medusa-plugin-restock-notification@0.0.13) (2021-07-15)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.12](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.11...medusa-plugin-restock-notification@0.0.12) (2021-07-02)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.11](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.10...medusa-plugin-restock-notification@0.0.11) (2021-06-24)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.10](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.9...medusa-plugin-restock-notification@0.0.10) (2021-06-22)
### Bug Fixes
- release assist ([668e8a7](https://github.com/medusajs/medusa/commit/668e8a740200847fc2a41c91d2979097f1392532))
## [0.0.9](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.8...medusa-plugin-restock-notification@0.0.9) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.8](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.7...medusa-plugin-restock-notification@0.0.8) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.7](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.7...medusa-plugin-restock-notification@0.0.7) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.6](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.7...medusa-plugin-restock-notification@0.0.6) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.4](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.7...medusa-plugin-restock-notification@0.0.4) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.7](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.6...medusa-plugin-restock-notification@0.0.7) (2021-04-29)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.6](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.3...medusa-plugin-restock-notification@0.0.6) (2021-04-28)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.5](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.4...medusa-plugin-restock-notification@0.0.5) (2021-04-20)
**Note:** Version bump only for package medusa-plugin-restock-notification
## [0.0.4](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.3...medusa-plugin-restock-notification@0.0.4) (2021-04-20)
### Features
- **medusa:** Swaps on swaps ([#229](https://github.com/medusajs/medusa/issues/229)) ([f8f1f57](https://github.com/medusajs/medusa/commit/f8f1f57fa1bcdc6f7ae4183e657a07e2641b1345))
## [0.0.3](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.2...medusa-plugin-restock-notification@0.0.3) (2021-04-13)
**Note:** Version bump only for package medusa-plugin-restock-notification
## 0.0.2 (2021-04-13)
### Bug Fixes
- .gitignore ([684c20a](https://github.com/medusajs/medusa/commit/684c20ab293237f91fc160a269fd072c5de7012b))
- adds tests ([69442a1](https://github.com/medusajs/medusa/commit/69442a1735193aeb010043f114d89037d4d76279))
- cors ([15bbb71](https://github.com/medusajs/medusa/commit/15bbb71a46efe00af3bd46bc16dfd48439204587))
- cors ([e4a30e8](https://github.com/medusajs/medusa/commit/e4a30e8afc84eb201b0ddcb027bbe5674d0aff8f))
- cors ([967134e](https://github.com/medusajs/medusa/commit/967134e797a867fd84064d3764815961a976015b))
- creates restock functionality ([2b25550](https://github.com/medusajs/medusa/commit/2b2555004e52e97c15bfca59e030fdfc3d86ae49))
- deps ([a9ea38c](https://github.com/medusajs/medusa/commit/a9ea38c2005beb63e14ed151e25ecd26819c748c))
- gitignore ([fa1fe9d](https://github.com/medusajs/medusa/commit/fa1fe9d619e19a277db6ee3a25ebb177222fa04b))
- merge ([7897610](https://github.com/medusajs/medusa/commit/78976106209b35730d69817b52595b6008590159))
- peerdependencies ([40725c6](https://github.com/medusajs/medusa/commit/40725c6d0a643369a710cfc7cbf5b5f65a4f1f93))
- restock ([237ed51](https://github.com/medusajs/medusa/commit/237ed5130760645c6b892fa1d5fc09a713b95f58))
- **segment:** swap tracking ([295f0f6](https://github.com/medusajs/medusa/commit/295f0f652a0880292a3788b9c65476a3c5c1b8d4))
- working api ([9d81097](https://github.com/medusajs/medusa/commit/9d810971a7e0de2a586b5c9c372f0aad2818918b))
### Features
- restock service ([8bd5fa8](https://github.com/medusajs/medusa/commit/8bd5fa821286a90f3ab21e8c96993ac543fb7cab))
@@ -1,98 +0,0 @@
# Restock Notifications
Send notifications to subscribed customers when an item has been restocked.
[Medusa Website](https://medusajs.com/) | [Medusa Repository](https://github.com/medusajs/medusa)
## Features
- Triggers an event when a product variant has been restocked.
- Provides an endpoint to subscribe customers to receive restock notifications.
- Does not implement the email or notification sending mechanisms. Instead, it is compatible with Notification plugins such as [SendGrid](https://docs.medusajs.com/plugins/notifications/sendgrid).
---
## Prerequisites
- [Medusa backend](https://docs.medusajs.com/development/backend/install)
- [Redis](https://docs.medusajs.com/development/backend/prepare-environment#redis)
- [PostgreSQL](https://docs.medusajs.com/development/backend/prepare-environment#postgresql)
---
## How to Install
1\. Run the following command in the directory of the Medusa backend:
```bash
npm install medusa-plugin-restock-notification
```
2\. In `medusa-config.js` add the following at the end of the `plugins` array:
```js
const plugins = [
// other plugins...
{
resolve: `medusa-plugin-restock-notification`,
options: {
trigger_delay, // optional, delay time in milliseconds
inventory_required, // minimum inventory quantity to consider a variant as restocked
},
},
]
```
3\. Run the following command in the directory of the Medusa backend to run the plugin's migrations:
```bash
medusa migrations run
```
---
## Test the Plugin
1\. Run the following command in the directory of the Medusa backend to run the backend:
```bash
npm run start
```
2\. Subscribe an email or identification username (depends on your notification service) to receive restock notifications using the endpoint `/restock-notifications/variants/<variant_id>`. `<variant_id>` is the ID of the variant you're subscribing to.
2\. Change the inventory quantity of a product variant based on the restock threshold you've set, and see the event `restock-notification.restocked` triggered.
---
## Additional Information
### API endpoint
The plugin exposes an endpoint `/restock-notifications/variants/:variant_id` to sign emails up for restock notifications. It accepts the following request body:
```json
{
"email": "customer@test.com"
}
```
The endpoint responds with `200 OK` on successful signups. If a signup for an already in stock item is attempted the endpoint will have a 400 response code.
### Restock events
The plugin listens for the `product-variant.updated` call and emits a `restock-notification.restocked` event when a variant with restock signups become available.
The data sent with the `restock-notification.restocked` event are:
- `variant_id`: The ID of the variant to listen for restock events for.
- `emails`: An array of emails that are to be notified of restocks.
For example:
```json
{
"variant_id": "variant_1234567890",
"emails": ["seb@test.com", "oli@test.com"]
}
```
@@ -1 +0,0 @@
// noop
@@ -1,6 +0,0 @@
module.exports = {
testEnvironment: "node",
transform: {
"^.+\\.[jt]s?$": `../../jest-transformer.js`,
},
}
@@ -1,52 +0,0 @@
{
"name": "medusa-plugin-restock-notification",
"version": "7.0.3",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/medusajs/medusa",
"directory": "packages/medusa-plugin-restock-notification"
},
"engines": {
"node": ">=16"
},
"author": "Sebastian Rindom <seb@medusa-commerce.com>",
"license": "MIT",
"devDependencies": {
"@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5",
"@babel/plugin-transform-typescript": "^7.13.0",
"@babel/preset-typescript": "^7.12.7",
"@medusajs/medusa": "^1.17.1",
"babel-preset-medusa-package": "^1.1.19",
"cross-env": "^5.2.1",
"jest": "^25.5.4",
"medusa-interfaces": "^1.3.7",
"medusa-test-utils": "^1.1.40",
"pg": "^8.5.1",
"typeorm": "^0.3.16",
"ulid": "^2.3.0"
},
"scripts": {
"prepare": "cross-env NODE_ENV=production yarn run build",
"test": "jest --silent --bail --maxWorkers=50% --forceExit",
"build": "babel src --out-dir . --ignore '**/__tests__','**/__mocks__'",
"watch": "babel -w src --out-dir . --ignore '**/__tests__','**/__mocks__'"
},
"peerDependencies": {
"@medusajs/medusa": "^1.12.0",
"medusa-interfaces": "^1.3.7",
"typeorm": "^0.3.16"
},
"dependencies": {
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"medusa-core-utils": "^1.2.0"
},
"gitHead": "cd1f5afa5aa8c0b15ea957008ee19f1d695cbd2e",
"keywords": [
"medusa-plugin",
"medusa-plugin-notification"
]
}
@@ -1,11 +0,0 @@
import { Router } from "express"
import routes from "./routes"
export default (rootDirectory) => {
const app = Router()
routes(app, rootDirectory)
return app
}
@@ -1 +0,0 @@
export default (fn) => (...args) => fn(...args).catch(args[2])
@@ -1,5 +0,0 @@
import { default as wrap } from "./await-middleware"
export default {
wrap,
}
@@ -1,19 +0,0 @@
export default async (req, res) => {
const { variant_id } = req.params
try {
const restockNotificationService = req.scope.resolve(
"restockNotificationService"
)
let sales_channel_id = req.body.sales_channel_id
if (req.publishableApiKeyScopes?.sales_channel_ids.length === 1) {
sales_channel_id = req.publishableApiKeyScopes.sales_channel_ids[0]
}
await restockNotificationService.addEmail(variant_id, req.body.email, sales_channel_id)
res.sendStatus(201)
} catch (err) {
res.status(400).json({ message: err.message })
}
}
@@ -1,29 +0,0 @@
import { Router } from "express"
import bodyParser from "body-parser"
import cors from "cors"
import { getConfigFile, parseCorsOrigins } from "medusa-core-utils"
import middlewares from "../middleware"
const route = Router()
export default (app, rootDirectory) => {
app.use("/restock-notifications", route)
const { configModule } = getConfigFile(rootDirectory, "medusa-config")
const { projectConfig } = configModule
const corsOptions = {
origin: parseCorsOrigins(projectConfig.store_cors),
credentials: true,
}
route.options("/variants/:variant_id", cors(corsOptions))
route.post(
"/variants/:variant_id",
cors(corsOptions),
bodyParser.json(),
middlewares.wrap(require("./add-email").default)
)
return app
}
@@ -1,21 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm"
export class restockNotification1617703530229 implements MigrationInterface {
name = "restockNotification1617703530229"
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "restock_notification" ("variant_id" character varying NOT NULL, "emails" jsonb NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_49181ca04caac807fcec321705a" PRIMARY KEY ("variant_id"))`
)
await queryRunner.query(
`ALTER TABLE "restock_notification" ADD CONSTRAINT "FK_49181ca04caac807fcec321705a" FOREIGN KEY ("variant_id") REFERENCES "product_variant"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`
)
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "restock_notification" DROP CONSTRAINT "FK_49181ca04caac807fcec321705a"`
)
await queryRunner.query(`DROP TABLE "restock_notification"`)
}
}
@@ -1,56 +0,0 @@
import {
Entity,
Index,
BeforeInsert,
Column,
DeleteDateColumn,
CreateDateColumn,
UpdateDateColumn,
PrimaryColumn,
ManyToOne,
JoinColumn,
} from "typeorm"
import { ProductVariant } from "@medusajs/medusa"
@Entity()
export class RestockNotification {
@PrimaryColumn()
variant_id: string
@ManyToOne(() => ProductVariant)
@JoinColumn({ name: "variant_id" })
variant: ProductVariant
@Column({ type: "jsonb" })
emails: string[]
@CreateDateColumn({ type: "timestamptz" })
created_at: Date
@UpdateDateColumn({ type: "timestamptz" })
updated_at: Date
}
/**
* @schema restock_notification
* title: "Restock Notification"
* description: "Holds a list of emails that wish to be notifed when an item is restocked."
* x-resourceId: restock_notification
* properties:
* variant_id:
* type: string
* description: "The id of the variant that customers have signed up to be notified about,"
* emails:
* description: "The emails of customers who wish to be notified about restocks."
* type: array
* items:
* type: string
* created_at:
* type: string
* format: date-time
* description: "The date time at which the first restock signup was made."
* updated_at:
* type: string
* format: date-time
* description: "The date time at which the first last signup was made."
*/
@@ -1,265 +0,0 @@
import { MockManager, MockRepository } from "medusa-test-utils"
import RestockNotificationService from "../restock-notification"
describe("RestockNotificationService", () => {
const RestockNotificationModel = MockRepository({
findOne: (q) => {
if (q.where.variant_id === "variant_1234") {
return Promise.resolve({
variant_id: "variant_1234",
emails: ["test@tesmail.com"],
})
}
if (q.where.variant_id === "variant_outofstock") {
return Promise.resolve({
variant_id: "variant_outofstock",
emails: ["test@tesmail.com"],
})
}
if (q.where.variant_id === "variant_low_inventory") {
return Promise.resolve({
variant_id: "variant_low_inventory",
email: ["test@tesmail.com"],
})
}
return Promise.resolve()
},
})
const ProductVariantService = {
retrieve: (id) => {
if (id === "variant_instock") {
return {
id,
inventory_quantity: 10,
}
}
if (id === "variant_1234") {
return {
id,
inventory_quantity: 10,
}
}
if (id === "variant_low_inventory") {
return {
id,
inventory_quantity: 2,
}
}
return {
id,
inventory_quantity: 0,
}
},
}
const EventBusService = {
emit: jest.fn(),
withTransaction: function () {
return this
},
}
describe("retrieve", () => {
const restockNotiService = new RestockNotificationService({
manager: MockManager,
productVariantService: ProductVariantService,
restockNotificationModel: RestockNotificationModel,
eventBusService: EventBusService,
})
it("successfully retrieves", async () => {
jest.clearAllMocks()
const result = await restockNotiService.retrieve("variant_1234")
expect(result).toEqual({
variant_id: "variant_1234",
emails: ["test@tesmail.com"],
})
})
it("successfully retrieves with empty response", async () => {
jest.clearAllMocks()
const result = await restockNotiService.retrieve("variant_non")
expect(result).toEqual(undefined)
})
})
describe("addEmail", () => {
const restockNotiService = new RestockNotificationService({
manager: MockManager,
productVariantService: ProductVariantService,
restockNotificationModel: RestockNotificationModel,
eventBusService: EventBusService,
})
it("successfully adds email to non-existing noti", async () => {
jest.clearAllMocks()
await restockNotiService.addEmail("variant_test", "seb@med-test.com")
expect(RestockNotificationModel.create).toHaveBeenCalledTimes(1)
expect(RestockNotificationModel.create).toHaveBeenCalledWith({
variant_id: "variant_test",
emails: ["seb@med-test.com"],
})
expect(RestockNotificationModel.save).toHaveBeenCalledTimes(1)
})
it("successfully adds email to existing noti", async () => {
jest.clearAllMocks()
await restockNotiService.addEmail("variant_1234", "seb@med-test.com")
expect(RestockNotificationModel.save).toHaveBeenCalledTimes(1)
expect(RestockNotificationModel.save).toHaveBeenCalledWith({
variant_id: "variant_1234",
emails: ["test@tesmail.com", "seb@med-test.com"],
})
})
it("fails to add if in stock", async () => {
jest.clearAllMocks()
await expect(
restockNotiService.addEmail("variant_instock", "seb@med-test.com")
).rejects.toThrow(
"You cannot sign up for restock notifications on a product that is not sold out"
)
})
})
describe("triggerRestock", () => {
afterEach(() => {
jest.useRealTimers()
})
it("trigger delay default to 0", async () => {
const restockNotiService = new RestockNotificationService({
manager: MockManager,
productVariantService: ProductVariantService,
restockNotificationModel: RestockNotificationModel,
eventBusService: EventBusService,
})
restockNotiService.restockExecute = jest.fn()
restockNotiService.triggerRestock("variant_test")
expect(restockNotiService.restockExecute).toHaveBeenCalledTimes(1)
})
it("trigger delay 10", async () => {
const restockNotiService = new RestockNotificationService(
{
manager: MockManager,
productVariantService: ProductVariantService,
restockNotificationModel: RestockNotificationModel,
eventBusService: EventBusService,
},
{ trigger_delay: 10 }
)
restockNotiService.restockExecute = jest.fn()
restockNotiService.triggerRestock("variant_test")
expect(EventBusService.emit).toHaveBeenCalledTimes(1)
expect(EventBusService.emit).toHaveBeenCalledWith(
"restock-notification.execute",
{ variant_id: "variant_test" },
{ delay: 10 }
)
})
})
describe("restockExecute", () => {
const restockNotiService = new RestockNotificationService({
manager: MockManager,
productVariantService: ProductVariantService,
restockNotificationModel: RestockNotificationModel,
eventBusService: EventBusService,
})
it("non-existing noti does nothing", async () => {
jest.clearAllMocks()
await expect(restockNotiService.restockExecute("variant_test")).resolves
})
it("existing noti but out of stock does nothing", async () => {
jest.clearAllMocks()
await expect(restockNotiService.restockExecute("variant_outofstock"))
.resolves
})
it("existing noti emits and deletes", async () => {
jest.clearAllMocks()
await restockNotiService.restockExecute("variant_1234")
expect(EventBusService.emit).toHaveBeenCalledTimes(1)
expect(EventBusService.emit).toHaveBeenCalledWith(
"restock-notification.restocked",
{
variant_id: "variant_1234",
emails: ["test@tesmail.com"],
}
)
expect(RestockNotificationModel.delete).toHaveBeenCalledTimes(1)
expect(RestockNotificationModel.delete).toHaveBeenCalledWith(
"variant_1234"
)
})
it("options inventory_required takes precedence if given", async () => {
jest.clearAllMocks()
const service = new RestockNotificationService(
{
manager: MockManager,
productVariantService: ProductVariantService,
restockNotificationModel: RestockNotificationModel,
eventBusService: EventBusService,
},
{ inventory_required: 5 }
)
await service.restockExecute("variant_1234")
expect(EventBusService.emit).toHaveBeenCalledTimes(1)
expect(EventBusService.emit).toHaveBeenCalledWith(
"restock-notification.restocked",
{
variant_id: "variant_1234",
emails: ["test@tesmail.com"],
}
)
expect(RestockNotificationModel.delete).toHaveBeenCalledTimes(1)
expect(RestockNotificationModel.delete).toHaveBeenCalledWith(
"variant_1234"
)
})
it("Inventory requires 5, wont emit when called with variant inventory 2", async () => {
jest.clearAllMocks()
const service = new RestockNotificationService(
{
manager: MockManager,
productVariantService: ProductVariantService,
restockNotificationModel: RestockNotificationModel,
eventBusService: EventBusService,
},
{ inventory_required: 5 }
)
await service.restockExecute("variant_low_inventory")
expect(EventBusService.emit).toHaveBeenCalledTimes(0)
expect(RestockNotificationModel.delete).toHaveBeenCalledTimes(0)
})
})
})
@@ -1,168 +0,0 @@
import { MedusaError } from "medusa-core-utils"
import { BaseService } from "medusa-interfaces"
/**
* Restock notifications can be used to keep track of customers who wish to be
* notified when a certain item is restocked. Restock notifications can only
* apply to sold out items and will be deleted once items are restocked.
*/
class RestockNotificationService extends BaseService {
constructor(
{
manager,
eventBusService,
productVariantService,
productVariantInventoryService,
restockNotificationModel,
},
options
) {
super()
this.manager_ = manager
this.options_ = options
this.productVariantService_ = productVariantService
this.productVariantInventoryService_ = productVariantInventoryService
this.restockNotificationModel_ = restockNotificationModel
this.eventBus_ = eventBusService
}
withTransaction(transactionManager) {
if (!transactionManager) {
return this
}
const cloned = new RestockNotificationService(
{
manager: transactionManager,
options: this.options_,
eventBusService: this.eventBus_,
productVariantService: this.productVariantService_,
restockNotificationModel: this.restockNotificationModel_,
},
this.options_
)
cloned.transactionManager_ = transactionManager
return cloned
}
/**
* Retrieves a restock notification by a given variant id.
* @param {string} variantId - the variant id to retrieve restock notification
* for
* @return {Promise<RestockNotification>} The restock notification
*/
async retrieve(variantId) {
const restockRepo = this.manager_.getRepository(
this.restockNotificationModel_
)
return await restockRepo.findOne({ where: { variant_id: variantId } })
}
/**
* Adds an email to be notified when a certain variant is restocked. Throws if
* the variant is not sold out.
* @param {string} variantId - the variant id to sign up for notifications for
* @param {string} email - the email to signup
* @param {string} salesChannelId - the sales channel id of the variant
* @return {Promise<RestockNotification>} The resulting restock notification
*/
async addEmail(variantId, email, salesChannelId) {
return this.atomicPhase_(async (manager) => {
const restockRepo = manager.getRepository(this.restockNotificationModel_)
const existing = await this.retrieve(variantId)
if (existing) {
// Converting to a set handles duplicates for us
const emailSet = new Set(existing.emails)
emailSet.add(email)
existing.emails = Array.from(emailSet)
return await restockRepo.save(existing)
} else {
let variant = await this.productVariantService_.retrieve(variantId)
if (salesChannelId) {
const variants =
await this.productVariantInventoryService_.setVariantAvailability(
[variant],
salesChannelId
)
if (variants.length) {
variant = variants[0]
}
}
if (variant.inventory_quantity > 0) {
throw new MedusaError(
MedusaError.Types.NOT_ALLOWED,
"You cannot sign up for restock notifications on a product that is not sold out"
)
}
const created = restockRepo.create({
variant_id: variant.id,
emails: [email],
})
return await restockRepo.save(created)
}
})
}
/**
* Checks if anyone has signed up for restock notifications on a given variant
* and emits a restocked event to the event bus. After successful emission the
* restock notification is deleted.
* @param {string} variantId - the variant id to trigger restock for
* @return The resulting restock notification
*/
async triggerRestock(variantId) {
const delay = this.options_?.trigger_delay ?? 0
if (delay) {
return await this.eventBus_.emit(
"restock-notification.execute",
{ variant_id: variantId },
{ delay }
)
}
return await this.restockExecute(variantId)
}
async restockExecute(variantId) {
return await this.atomicPhase_(async (manager) => {
const restockRepo = manager.getRepository(this.restockNotificationModel_)
const existing = await this.retrieve(variantId)
if (!existing) {
return
}
const variant = await this.productVariantService_.retrieve(variantId)
if (
variant.inventory_quantity > (this.options_?.inventory_required ?? 0)
) {
await this.eventBus_
.withTransaction(manager)
.emit("restock-notification.restocked", {
variant_id: variantId,
emails: existing.emails,
})
await restockRepo.delete(variantId)
}
})
}
}
export default RestockNotificationService
@@ -1,37 +0,0 @@
class VariantSubscriber {
constructor({ manager, eventBusService, restockNotificationService }) {
this.manager_ = manager
this.restockNotificationService_ = restockNotificationService
eventBusService.subscribe(
"product-variant.updated",
this.handleVariantUpdate
)
eventBusService.subscribe(
"restock-notification.execute",
this.handleDelayedExecute
)
}
handleDelayedExecute = async (data) => {
const { variant_id } = data
return await this.restockNotificationService_.restockExecute(variant_id)
}
handleVariantUpdate = async (data) => {
const { id, fields } = data
if (fields.includes("inventory_quantity")) {
return await this.manager_.transaction(
async (m) =>
await this.restockNotificationService_
.withTransaction(m)
.triggerRestock(id)
)
}
return Promise.resolve()
}
}
export default VariantSubscriber
@@ -1,15 +0,0 @@
{
"compilerOptions": {
"lib": [
"es5",
"es6"
],
"target": "es5",
"esModuleInterop": true,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true
}
}
-15
View File
@@ -1,15 +0,0 @@
/lib
node_modules
.DS_store
.env*
/*.js
!index.js
!jest.config.js
/dist
/api
/services
/models
/subscribers
@@ -1,9 +0,0 @@
.DS_store
src
dist
yarn.lock
.babelrc
jest.config.js
.turbo
.yarn
-391
View File
@@ -1,391 +0,0 @@
# Change Log
## 1.3.7
### Patch Changes
- [#4389](https://github.com/medusajs/medusa/pull/4389) [`9dcdc0041`](https://github.com/medusajs/medusa/commit/9dcdc0041a2b08cc0723343dd8d9127d9977b086) Thanks [@adrien2p](https://github.com/adrien2p)! - fix(medusa, utils): fix the way selects are consumed alongside the relations
## 1.3.6
### Patch Changes
- [#4276](https://github.com/medusajs/medusa/pull/4276) [`afd1b67f1`](https://github.com/medusajs/medusa/commit/afd1b67f1c7de8cf07fd9fcbdde599a37914e9b5) Thanks [@olivermrbl](https://github.com/olivermrbl)! - chore: Use caret range
## 1.3.5
### Patch Changes
- Updated dependencies [[`121b42acf`](https://github.com/medusajs/medusa/commit/121b42acfe98c12dd593f9b1f2072ff0f3b61724), [`aa690beed`](https://github.com/medusajs/medusa/commit/aa690beed775646cbc86b445fb5dc90dcac087d5), [`54dcc1871`](https://github.com/medusajs/medusa/commit/54dcc1871c8f28bea962dbb9df6e79b038d56449), [`77d46220c`](https://github.com/medusajs/medusa/commit/77d46220c23bfe19e575cbc445874eb6c22f3c73)]:
- medusa-core-utils@1.2.0
- medusa-interfaces@1.3.7
- medusa-test-utils@1.1.40
## 1.3.5-rc.0
### Patch Changes
- Updated dependencies [[`121b42acf`](https://github.com/medusajs/medusa/commit/121b42acfe98c12dd593f9b1f2072ff0f3b61724), [`aa690beed`](https://github.com/medusajs/medusa/commit/aa690beed775646cbc86b445fb5dc90dcac087d5), [`54dcc1871`](https://github.com/medusajs/medusa/commit/54dcc1871c8f28bea962dbb9df6e79b038d56449), [`77d46220c`](https://github.com/medusajs/medusa/commit/77d46220c23bfe19e575cbc445874eb6c22f3c73)]:
- medusa-core-utils@1.2.0-rc.0
- medusa-interfaces@1.3.7-rc.0
- medusa-test-utils@1.1.40-rc.0
## 1.3.4
### Patch Changes
- [#3217](https://github.com/medusajs/medusa/pull/3217) [`8c5219a31`](https://github.com/medusajs/medusa/commit/8c5219a31ef76ee571fbce84d7d57a63abe56eb0) Thanks [@adrien2p](https://github.com/adrien2p)! - chore: Fix npm packages files included
- Updated dependencies [[`8c5219a31`](https://github.com/medusajs/medusa/commit/8c5219a31ef76ee571fbce84d7d57a63abe56eb0)]:
- medusa-core-utils@1.1.39
- medusa-interfaces@1.3.6
## 1.3.3
### Patch Changes
- [#3185](https://github.com/medusajs/medusa/pull/3185) [`08324355a`](https://github.com/medusajs/medusa/commit/08324355a4466b017a0bc7ab1d333ee3cd27b8c4) Thanks [@olivermrbl](https://github.com/olivermrbl)! - chore: Patches all dependencies + minor bumps `winston` to include a [fix for a significant memory leak](https://github.com/winstonjs/winston/pull/2057)
- Updated dependencies [[`08324355a`](https://github.com/medusajs/medusa/commit/08324355a4466b017a0bc7ab1d333ee3cd27b8c4)]:
- medusa-core-utils@1.1.38
- medusa-interfaces@1.3.5
## 1.3.2
### Patch Changes
- [#3025](https://github.com/medusajs/medusa/pull/3025) [`93d0dc1bd`](https://github.com/medusajs/medusa/commit/93d0dc1bdcb54cf6e87428a7bb9b0dac196b4de2) Thanks [@adrien2p](https://github.com/adrien2p)! - fix(medusa): test, build and watch scripts
- Updated dependencies [[`93d0dc1bd`](https://github.com/medusajs/medusa/commit/93d0dc1bdcb54cf6e87428a7bb9b0dac196b4de2)]:
- medusa-interfaces@1.3.4
## 1.3.1
### Patch Changes
- [#2808](https://github.com/medusajs/medusa/pull/2808) [`0a9c89185`](https://github.com/medusajs/medusa/commit/0a9c891853c4d16b553d38268a3408ca1daa71f0) Thanks [@patrick-medusajs](https://github.com/patrick-medusajs)! - chore: explicitly add devDependencies for monorepo peerDependencies
- Updated dependencies [[`7cced6006`](https://github.com/medusajs/medusa/commit/7cced6006a9a6f9108009e9f3e191e9f3ba1b168)]:
- medusa-core-utils@1.1.37
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [1.3.0](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.2.1...medusa-plugin-segment@1.3.0) (2022-05-01)
### Bug Fixes
- ensure customer identify calls before order track ([#1227](https://github.com/medusajs/medusa/issues/1227)) ([fbe3b98](https://github.com/medusajs/medusa/commit/fbe3b987618d28325938e8fe6264b01d4d581c71))
### Features
- Add DiscountConditions ([#1230](https://github.com/medusajs/medusa/issues/1230)) ([a610805](https://github.com/medusajs/medusa/commit/a610805917ee930d4cebde74905e541a468aa83b)), closes [#1146](https://github.com/medusajs/medusa/issues/1146) [#1149](https://github.com/medusajs/medusa/issues/1149) [#1156](https://github.com/medusajs/medusa/issues/1156) [#1170](https://github.com/medusajs/medusa/issues/1170) [#1172](https://github.com/medusajs/medusa/issues/1172) [#1212](https://github.com/medusajs/medusa/issues/1212) [#1224](https://github.com/medusajs/medusa/issues/1224) [#1228](https://github.com/medusajs/medusa/issues/1228)
## [1.2.1](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.42...medusa-plugin-segment@1.2.1) (2022-02-28)
### Features
- new tax api ([#979](https://github.com/medusajs/medusa/issues/979)) ([47588e7](https://github.com/medusajs/medusa/commit/47588e7a8d3b2ae2fed0c1e87fdf1ee2db6bcdc2)), closes [#885](https://github.com/medusajs/medusa/issues/885) [#896](https://github.com/medusajs/medusa/issues/896) [#911](https://github.com/medusajs/medusa/issues/911) [#945](https://github.com/medusajs/medusa/issues/945) [#950](https://github.com/medusajs/medusa/issues/950) [#951](https://github.com/medusajs/medusa/issues/951) [#954](https://github.com/medusajs/medusa/issues/954) [#969](https://github.com/medusajs/medusa/issues/969) [#998](https://github.com/medusajs/medusa/issues/998) [#1017](https://github.com/medusajs/medusa/issues/1017) [#1110](https://github.com/medusajs/medusa/issues/1110)
# [1.2.0](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.42...medusa-plugin-segment@1.2.0) (2022-02-25)
### Features
- new tax api ([#979](https://github.com/medusajs/medusa/issues/979)) ([c56660f](https://github.com/medusajs/medusa/commit/c56660fca9921a3f3637bc137d9794781c5b090f)), closes [#885](https://github.com/medusajs/medusa/issues/885) [#896](https://github.com/medusajs/medusa/issues/896) [#911](https://github.com/medusajs/medusa/issues/911) [#945](https://github.com/medusajs/medusa/issues/945) [#950](https://github.com/medusajs/medusa/issues/950) [#951](https://github.com/medusajs/medusa/issues/951) [#954](https://github.com/medusajs/medusa/issues/954) [#969](https://github.com/medusajs/medusa/issues/969) [#998](https://github.com/medusajs/medusa/issues/998) [#1017](https://github.com/medusajs/medusa/issues/1017) [#1110](https://github.com/medusajs/medusa/issues/1110)
## [1.1.42](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.41...medusa-plugin-segment@1.1.42) (2022-02-06)
### Bug Fixes
- release ([fc3fbc8](https://github.com/medusajs/medusa/commit/fc3fbc897fad5c8a5d3eea828ac7277fba9d70af))
## [1.1.41](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.40...medusa-plugin-segment@1.1.41) (2022-02-06)
### Features
- medusa-react admin hooks ([#978](https://github.com/medusajs/medusa/issues/978)) ([2e38484](https://github.com/medusajs/medusa/commit/2e384842d5b2e9742a86b96f28a8f00357795b86)), closes [#1019](https://github.com/medusajs/medusa/issues/1019)
## [1.1.40](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.39...medusa-plugin-segment@1.1.40) (2022-01-11)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.39](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.38...medusa-plugin-segment@1.1.39) (2021-12-29)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.38](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.37...medusa-plugin-segment@1.1.38) (2021-12-17)
### Features
- add medusa-react ([#913](https://github.com/medusajs/medusa/issues/913)) ([d0d8dd7](https://github.com/medusajs/medusa/commit/d0d8dd7bf62eaac71df8714c2dfb4f204d192f51))
## [1.1.37](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.36...medusa-plugin-segment@1.1.37) (2021-12-08)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.36](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.35...medusa-plugin-segment@1.1.36) (2021-11-23)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.35](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.34...medusa-plugin-segment@1.1.35) (2021-11-22)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.34](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.33...medusa-plugin-segment@1.1.34) (2021-11-19)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.33](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.32...medusa-plugin-segment@1.1.33) (2021-11-19)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.32](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.31...medusa-plugin-segment@1.1.32) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.30...medusa-plugin-segment@1.1.31) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.28...medusa-plugin-segment@1.1.30) (2021-10-18)
### Features
- allow product selection on discounts allocated to a specific item ([#395](https://github.com/medusajs/medusa/issues/395)) ([84d4d79](https://github.com/medusajs/medusa/commit/84d4d791eaf9508367a20d9f930ca959a7b707dd))
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.28...medusa-plugin-segment@1.1.29) (2021-10-18)
### Features
- allow product selection on discounts allocated to a specific item ([#395](https://github.com/medusajs/medusa/issues/395)) ([84d4d79](https://github.com/medusajs/medusa/commit/84d4d791eaf9508367a20d9f930ca959a7b707dd))
## [1.1.28](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.27...medusa-plugin-segment@1.1.28) (2021-09-15)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.27](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.26...medusa-plugin-segment@1.1.27) (2021-09-14)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.26](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.25...medusa-plugin-segment@1.1.26) (2021-08-05)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.25](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.24...medusa-plugin-segment@1.1.25) (2021-07-26)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.22...medusa-plugin-segment@1.1.24) (2021-07-15)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.23](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.22...medusa-plugin-segment@1.1.23) (2021-07-15)
### Bug Fixes
- sends return reasons to segment on Order Refunded event ([55ba9ba](https://github.com/medusajs/medusa/commit/55ba9bae05527d602d654f99d678b610c5ba7229))
## [1.1.22](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.21...medusa-plugin-segment@1.1.22) (2021-07-02)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.21](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.20...medusa-plugin-segment@1.1.21) (2021-06-22)
### Bug Fixes
- release assist ([668e8a7](https://github.com/medusajs/medusa/commit/668e8a740200847fc2a41c91d2979097f1392532))
## [1.1.20](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.19...medusa-plugin-segment@1.1.20) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.19](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.18...medusa-plugin-segment@1.1.19) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.18](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.17...medusa-plugin-segment@1.1.18) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.16...medusa-plugin-segment@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.15...medusa-plugin-segment@1.1.16) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.12...medusa-plugin-segment@1.1.15) (2021-04-28)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.13...medusa-plugin-segment@1.1.14) (2021-04-20)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.12...medusa-plugin-segment@1.1.13) (2021-04-20)
### Features
- **medusa:** Swaps on swaps ([#229](https://github.com/medusajs/medusa/issues/229)) ([f8f1f57](https://github.com/medusajs/medusa/commit/f8f1f57fa1bcdc6f7ae4183e657a07e2641b1345))
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.11...medusa-plugin-segment@1.1.12) (2021-04-13)
### Bug Fixes
- merge develop ([a468c45](https://github.com/medusajs/medusa/commit/a468c451e82c68f41b5005a2e480057f6124aaa6))
- **segment:** swap tracking ([295f0f6](https://github.com/medusajs/medusa/commit/295f0f652a0880292a3788b9c65476a3c5c1b8d4))
- scaffolding ([0539a94](https://github.com/medusajs/medusa/commit/0539a949fa208ddbf140823c47abb7589f3c2401))
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.10...medusa-plugin-segment@1.1.11) (2021-04-13)
### Bug Fixes
- **segment:** swap tracking ([295f0f6](https://github.com/medusajs/medusa/commit/295f0f652a0880292a3788b9c65476a3c5c1b8d4))
- scaffolding ([0539a94](https://github.com/medusajs/medusa/commit/0539a949fa208ddbf140823c47abb7589f3c2401))
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.9...medusa-plugin-segment@1.1.10) (2021-04-02)
### Bug Fixes
- adds exchange rates api key ([8eec38a](https://github.com/medusajs/medusa/commit/8eec38af7164fe60106b8dac33ae9acfeb2b0f2e))
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.8...medusa-plugin-segment@1.1.9) (2021-03-30)
### Bug Fixes
- adds tests for segment ([1b00f96](https://github.com/medusajs/medusa/commit/1b00f967dea3dc3aa65fafbe1334492fba5c33c2))
- don't divide zero decimal currencies ([3258955](https://github.com/medusajs/medusa/commit/3258955b462f91fc6f4d807c5cc9b5ad11d6bbdf))
- don't divide zero decimal currencies ([cfab2d4](https://github.com/medusajs/medusa/commit/cfab2d408a296a938266d0989b1de67d060b2ed5))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.7...medusa-plugin-segment@1.1.8) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.5...medusa-plugin-segment@1.1.7) (2021-03-17)
### Features
- **medusa:** cart context ([#201](https://github.com/medusajs/medusa/issues/201)) ([dd7b306](https://github.com/medusajs/medusa/commit/dd7b306333fbe1042f5cf2bed614bce84ea9475f))
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.5...medusa-plugin-segment@1.1.6) (2021-03-17)
### Features
- **medusa:** cart context ([#201](https://github.com/medusajs/medusa/issues/201)) ([dd7b306](https://github.com/medusajs/medusa/commit/dd7b306333fbe1042f5cf2bed614bce84ea9475f))
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.5-next.3...medusa-plugin-segment@1.1.5) (2021-02-25)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.5-next.3](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.5-next.2...medusa-plugin-segment@1.1.5-next.3) (2021-02-25)
### Bug Fixes
- normalize currency code ([98aa404](https://github.com/medusajs/medusa/commit/98aa404306d55f0818d48e56c51146351ebfe306))
## [1.1.5-next.2](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.5-next.1...medusa-plugin-segment@1.1.5-next.2) (2021-02-25)
### Features
- **segment:** track shipments ([d156911](https://github.com/medusajs/medusa/commit/d15691188348c19fc22806d8cf7584fc5f249ce9))
## [1.1.5-next.1](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.5-next.0...medusa-plugin-segment@1.1.5-next.1) (2021-02-25)
### Bug Fixes
- add subtitle to tracks ([0c294b7](https://github.com/medusajs/medusa/commit/0c294b7b3acbc1b873aab7e90a8e596bdac48899))
- versioning ([262af34](https://github.com/medusajs/medusa/commit/262af34125543d9a80bf469b5d380019b9bc8d3f))
## [1.1.5-next.0](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.4...medusa-plugin-segment@1.1.5-next.0) (2021-02-22)
### Features
- **medusa-plugin-segment:** adds category and type to segment events ([#179](https://github.com/medusajs/medusa/issues/179)) ([e27cf72](https://github.com/medusajs/medusa/commit/e27cf72a8ca49a6586a82dde964d559c40a4415f))
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.3...medusa-plugin-segment@1.1.4) (2021-02-17)
### Bug Fixes
- item reporting revenue discounted ([6e6669d](https://github.com/medusajs/medusa/commit/6e6669dee8cb3f7e044a4001fa1e183bb61766dd))
- price after discounts ([0ed6b4a](https://github.com/medusajs/medusa/commit/0ed6b4a6a09d1d2ef5c9d6a199db1e01234bc3c2))
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.2...medusa-plugin-segment@1.1.3) (2021-02-03)
### Features
- **medusa,brightpearl,segment,webshipper:** claims ([#163](https://github.com/medusajs/medusa/issues/163)) ([690d339](https://github.com/medusajs/medusa/commit/690d33966754a7dbe159c3ac09712a3c3bfaff0b))
## [1.1.2](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.1...medusa-plugin-segment@1.1.2) (2021-02-01)
**Note:** Version bump only for package medusa-plugin-segment
## [1.1.1](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.0...medusa-plugin-segment@1.1.1) (2021-01-27)
**Note:** Version bump only for package medusa-plugin-segment
# [1.1.0](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.0.16...medusa-plugin-segment@1.1.0) (2021-01-26)
**Note:** Version bump only for package medusa-plugin-segment
## [1.0.16](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.0.15...medusa-plugin-segment@1.0.16) (2021-01-08)
**Note:** Version bump only for package medusa-plugin-segment
## [1.0.15](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.0.14...medusa-plugin-segment@1.0.15) (2020-12-17)
**Note:** Version bump only for package medusa-plugin-segment
## [1.0.14](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.0.13...medusa-plugin-segment@1.0.14) (2020-11-24)
**Note:** Version bump only for package medusa-plugin-segment
## [1.0.13](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.0.12...medusa-plugin-segment@1.0.13) (2020-10-19)
**Note:** Version bump only for package medusa-plugin-segment
## [1.0.12](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.0.11...medusa-plugin-segment@1.0.12) (2020-10-17)
**Note:** Version bump only for package medusa-plugin-segment
## 1.0.11 (2020-09-13)
### Bug Fixes
- **medusa-plugin-segment:** Track additional order details ([6a90e94](https://github.com/medusajs/medusa/commit/6a90e94c62f5e300fe970ac5d6b64c8c0e52eb40))
## 1.0.10 (2020-09-09)
### Bug Fixes
- updates license ([db519fb](https://github.com/medusajs/medusa/commit/db519fbaa6f8ad02c19cbecba5d4f28ba1ee81aa))
## 1.0.7 (2020-09-07)
## 1.0.1 (2020-09-05)
## 1.0.1-beta.0 (2020-09-04)
# 1.0.0 (2020-09-03)
# 1.0.0-alpha.30 (2020-08-28)
# 1.0.0-alpha.27 (2020-08-27)
# 1.0.0-alpha.26 (2020-08-27)
# 1.0.0-alpha.24 (2020-08-27)
# 1.0.0-alpha.3 (2020-08-20)
# 1.0.0-alpha.2 (2020-08-20)
# 1.0.0-alpha.1 (2020-08-20)
# 1.0.0-alpha.0 (2020-08-20)
## [1.0.10](https://github.com/medusajs/medusa/compare/v1.0.9...v1.0.10) (2020-09-09)
### Bug Fixes
- updates license ([db519fb](https://github.com/medusajs/medusa/commit/db519fbaa6f8ad02c19cbecba5d4f28ba1ee81aa))
-65
View File
@@ -1,65 +0,0 @@
# Segment
Track essential commerce analytics with Segment.
[Segment Plugin Documentation](https://docs.medusajs.com/plugins/analytics/segment) | [Medusa Website](https://medusajs.com) | [Medusa Repository](https://github.com/medusajs/medusa)
## Features
- Automatic analytics tracking for events related to Orders, Swaps, and Claims.
- Flexibility to track analytics for custom events or operations.
---
## Prerequisites
- [Medusa backend](https://docs.medusajs.com/development/backend/install)
- [Segment account](https://app.segment.com/signup)
---
## How to Install
1\. Run the following command in the directory of the Medusa backend:
```bash
npm install medusa-plugin-segment
```
2\. Set the following environment variable in `.env`:
```bash
SEGMENT_WRITE_KEY=<YOUR_SEGMENT_WRITE_KEY>
```
3\. In `medusa-config.js` add the following at the end of the `plugins` array:
```js
const plugins = [
// ...
{
resolve: `medusa-plugin-segment`,
options: {
write_key: process.env.SEGMENT_WRITE_KEY,
},
},
]
```
---
## Test the Plugin
1\. Run the following command in the directory of the Medusa backend to run the backend:
```bash
npm run start
```
2\. Place an order using a storefront or the [Store APIs](https://docs.medusajs.com/api/store). You should see the event tracked in Segment.
---
## Additional Resources
- [Segment Plugin Documentation](https://docs.medusajs.com/plugins/analytics/segment)
-1
View File
@@ -1 +0,0 @@
// noop
@@ -1,6 +0,0 @@
module.exports = {
testEnvironment: "node",
transform: {
"^.+\\.[jt]s?$": `../../jest-transformer.js`,
},
}
@@ -1,45 +0,0 @@
{
"name": "medusa-plugin-segment",
"version": "1.3.7",
"description": "Segment Analytics",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/medusajs/medusa",
"directory": "packages/medusa-plugin-segment"
},
"engines": {
"node": ">=16"
},
"author": "Sebastian Rindom",
"license": "MIT",
"devDependencies": {
"cross-env": "^5.2.1",
"eslint": "^6.8.0",
"jest": "^25.5.4",
"medusa-interfaces": "^1.3.7",
"medusa-test-utils": "^1.1.40",
"rimraf": "^5.0.1",
"typescript": "^4.9.5"
},
"scripts": {
"prepublishOnly": "cross-env NODE_ENV=production tsc --build",
"test": "jest --passWithNoTests src",
"build": "rimraf dist && tsc -p ./tsconfig.server.json",
"watch": "tsc --watch"
},
"peerDependencies": {
"@medusajs/medusa": ">= 1.18.0 < 2",
"medusa-interfaces": "^1.3.7"
},
"dependencies": {
"analytics-node": "^3.4.0-beta.1",
"axios": "^0.19.2",
"medusa-core-utils": "^1.2.0"
},
"gitHead": "cd1f5afa5aa8c0b15ea957008ee19f1d695cbd2e",
"keywords": [
"medusa-plugin",
"medusa-plugin-analytics"
]
}
@@ -1,253 +0,0 @@
import SegmentService from "../segment"
jest.mock("analytics-node")
const orderFactory = (config = {}) => {
return {
id: "12355",
display_id: "1234",
cart_id: "cart_13",
region_id: "reg_123",
items: [
{
title: "Test",
variant: {
product_id: "prod_123",
sku: "TEST",
},
unit_price: 1100,
quantity: 2,
},
],
shipping_methods: [
{
name: "standard",
price: 12399,
},
],
payments: [
{
id: "123",
},
],
tax_rate: 23.1,
currency_code: "DKK",
discounts: [],
shipping_address: {
first_name: "Test",
last_name: "Testson",
address_1: "Test",
address_2: "TEst",
postal_code: "1234",
country_code: "DK",
phone: "12345678",
},
email: "test@example.com",
subtotal: 2200,
total: 12399,
tax_total: 0,
shipping_total: 12399,
discount_total: 0,
gift_card_total: 0,
...config,
}
}
describe("SegmentService", () => {
const ProductService = {
retrieve: () =>
Promise.resolve({
collection: { title: "Collection" },
type: { value: "Type" },
subtitle: "Subtitle",
}),
}
const TotalsService = {
getLineItemTotals: (item) => {
return {
total: item.unit_price,
tax_total: 0,
}
},
}
describe("buildOrder", () => {
const segmentService = new SegmentService(
{
productService: ProductService,
totalsService: TotalsService,
},
{ account: "test" }
)
segmentService.getReportingValue = async (_, v) => {
const num = v
return Promise.resolve(Number(Math.round(num + "e2") + "e-2"))
}
it("successfully builds sales order", async () => {
jest.clearAllMocks()
const order = orderFactory()
const segmentOrder = await segmentService.buildOrder(order)
expect(segmentOrder).toEqual({
checkout_id: "cart_13",
coupon: undefined,
currency: "DKK",
discount: 0,
email: "test@example.com",
order_id: "12355",
payment_provider: "",
products: [
{
category: "Collection",
name: "Test",
price: 5.5,
product_id: "prod_123",
quantity: 2,
reporting_revenue: 11,
sku: "",
subtitle: "Subtitle",
type: "Type",
variant: "TEST",
},
],
region_id: "reg_123",
reporting_discount: 0,
reporting_revenue: 123.99,
reporting_shipping: 123.99,
reporting_subtotal: 22,
reporting_tax: 0,
reporting_total: 123.99,
revenue: 123.99,
shipping: 123.99,
shipping_city: undefined,
shipping_country: "DK",
shipping_methods: [
{
name: "standard",
price: 12399,
},
],
subtotal: 22,
tax: 0,
total: 123.99,
})
})
it("successfully adds return reason and note on buildOrder", async () => {
jest.clearAllMocks()
const order = orderFactory()
order.items = order.items.map((i) => {
i.note = "testing 1234"
i.reason = {
value: "test_reason",
id: "rr_test",
}
return i
})
const segmentOrder = await segmentService.buildOrder(order)
expect(segmentOrder).toEqual({
checkout_id: "cart_13",
coupon: undefined,
currency: "DKK",
discount: 0,
email: "test@example.com",
order_id: "12355",
payment_provider: "",
products: [
{
category: "Collection",
name: "Test",
price: 5.5,
product_id: "prod_123",
quantity: 2,
reporting_revenue: 11,
sku: "",
subtitle: "Subtitle",
type: "Type",
variant: "TEST",
reason_id: "rr_test",
reason_value: "test_reason",
note: "testing 1234",
},
],
region_id: "reg_123",
reporting_discount: 0,
reporting_revenue: 123.99,
reporting_shipping: 123.99,
reporting_subtotal: 22,
reporting_tax: 0,
reporting_total: 123.99,
revenue: 123.99,
shipping: 123.99,
shipping_city: undefined,
shipping_country: "DK",
shipping_methods: [
{
name: "standard",
price: 12399,
},
],
subtotal: 22,
tax: 0,
total: 123.99,
})
})
it("successfully builds order with zero decimal currency", async () => {
jest.clearAllMocks()
const order = orderFactory({ currency_code: "krw" })
const segmentOrder = await segmentService.buildOrder(order)
expect(segmentOrder).toEqual({
checkout_id: "cart_13",
coupon: undefined,
currency: "KRW",
discount: 0,
email: "test@example.com",
order_id: "12355",
payment_provider: "",
products: [
{
category: "Collection",
name: "Test",
price: 550,
product_id: "prod_123",
quantity: 2,
reporting_revenue: 1100,
sku: "",
subtitle: "Subtitle",
type: "Type",
variant: "TEST",
},
],
region_id: "reg_123",
reporting_discount: 0,
reporting_revenue: 12399,
reporting_shipping: 12399,
reporting_subtotal: 2200,
reporting_tax: 0,
reporting_total: 12399,
revenue: 12399,
shipping: 12399,
shipping_city: undefined,
shipping_country: "DK",
shipping_methods: [
{
name: "standard",
price: 12399,
},
],
subtotal: 2200,
tax: 0,
total: 12399,
})
})
})
})
@@ -1,184 +0,0 @@
import Analytics from "analytics-node"
import axios from "axios"
import { BaseService } from "medusa-interfaces"
import { humanizeAmount } from "medusa-core-utils"
class SegmentService extends BaseService {
/**
* @param {Object} options - options defined in `medusa-config.js`
* e.g.
* {
* write_key: Segment write key given in Segment dashboard
* use_ga_id: If set to true the plugin will look for a ga_id in the cart
* context if present this id will be used as the Google Analytics
* client id.
* }
*/
constructor({ totalsService, productService }, options) {
super()
this.totalsService_ = totalsService
this.options_ = options
this.productService_ = productService
this.analytics_ = new Analytics(options.write_key)
}
/**
* Wrapper around segment's identify call
*/
identify(data) {
return this.analytics_.identify(data)
}
track(data) {
return this.analytics_.track(data)
}
async getReportingValue(rawCurrency, value) {
const fromCurrency = rawCurrency.toUpperCase()
const date = "latest"
const toCurrency =
(this.options_.reporting_currency &&
this.options_.reporting_currency.toUpperCase()) ||
"EUR"
if (fromCurrency === toCurrency) {
return this.rounded_(value)
}
const exchangeRate = await axios
.get(
`https://api.exchangeratesapi.io/${date}?symbols=${fromCurrency}&base=${toCurrency}&access_key=${this.options_.exchange_rates_api_key}`
)
.then(({ data }) => {
return data.rates[fromCurrency]
})
return this.rounded_(value / exchangeRate)
}
async buildOrder(order) {
const curr = order.currency_code
const subtotal = humanizeAmount(order.subtotal, curr)
const total = humanizeAmount(order.total, curr)
const tax = humanizeAmount(order.tax_total, curr)
const discount = humanizeAmount(order.discount_total, curr)
const shipping = humanizeAmount(order.shipping_total, curr)
const revenue = total - tax
let coupon
if (order.discounts && order.discounts.length) {
coupon = order.discounts[0] && order.discounts[0].code
}
const orderData = {
checkout_id: order.cart_id,
order_id: order.id,
email: order.email,
region_id: order.region_id,
payment_provider: order.payments?.map((p) => p.provider_id).join(","),
shipping_methods: order.shipping_methods,
shipping_country: order.shipping_address?.country_code,
shipping_city: order.shipping_address?.city,
reporting_total: await this.getReportingValue(order.currency_code, total),
reporting_subtotal: await this.getReportingValue(
order.currency_code,
subtotal
),
reporting_revenue: await this.getReportingValue(
order.currency_code,
revenue
),
reporting_shipping: await this.getReportingValue(
order.currency_code,
shipping
),
reporting_tax: await this.getReportingValue(order.currency_code, tax),
reporting_discount: await this.getReportingValue(
order.currency_code,
discount
),
total,
subtotal,
revenue,
shipping,
tax,
discount,
coupon,
currency: order.currency_code.toUpperCase(),
products: await Promise.all(
order.items.map(async (item) => {
let name = item.title
const totals = await this.totalsService_.getLineItemTotals(
item,
order,
{
include_tax: true,
}
)
const lineTotal = totals.total - totals.tax_total
const revenue = await this.getReportingValue(
curr,
humanizeAmount(lineTotal, curr)
)
let sku = ""
let variant = ""
if (item.variant && item.variant.sku) {
let skuParts = item.variant.sku.split("-")
skuParts.pop()
sku = skuParts.join("-")
variant = item.variant.sku
}
const product = await this.productService_.retrieve(
item.variant.product_id,
{ relations: ["collection", "type"] }
)
const toReturn = {
name,
variant,
price: this.rounded_(
humanizeAmount(lineTotal, curr) / item.quantity
),
reporting_revenue: revenue,
product_id: item.variant.product_id,
category: product.collection?.title,
subtitle: product.subtitle,
type: product.type?.value,
sku,
quantity: item.quantity,
}
// If we are building a refund order include details about
// the reason for return
if (item.reason) {
toReturn.reason_id = item.reason.id
toReturn.reason_value = item.reason.value
}
if (item.note) {
toReturn.note = item.note
}
return toReturn
})
),
}
return orderData
}
rounded_(v) {
return Number(Math.round(v + "e2") + "e-2")
}
}
export default SegmentService
@@ -1,46 +0,0 @@
export default async function handler({ data: { id }, container }) {
const segmentService = container.resolve("segmentService")
const claimService = container.resolve("claimService")
const claim = await claimService.retrieve(id, {
relations: [
"order",
"claim_items",
"claim_items.item",
"claim_items.tags",
"claim_items.variant",
],
})
for (const ci of claim.claim_items) {
const price = ci.item.unit_price / 100
const reporting_price = await segmentService.getReportingValue(
claim.order.currency_code,
price
)
const event = {
event: "Item Claimed",
userId: claim.order.customer_id,
timestamp: claim.created_at,
properties: {
price,
reporting_price,
order_id: claim.order_id,
claim_id: claim.id,
claim_item_id: ci.id,
type: claim.type,
quantity: ci.quantity,
variant: ci.variant.sku,
product_id: ci.variant.product_id,
reason: ci.reason,
note: ci.note,
tags: ci.tags.map((t) => ({ id: t.id, value: t.value })),
},
}
await segmentService.track(event)
}
}
export const config = {
event: "claim.created",
}
@@ -1,21 +0,0 @@
export default async function handler({ data: { id }, container }) {
const orderService = container.resolve("orderService")
const segmentService = container.resolve("segmentService")
const order = await orderService.retrieveWithTotals(id)
const date = new Date()
const orderData = await segmentService.buildOrder(order)
const orderEvent = {
event: "Order Cancelled",
userId: order.customer_id,
properties: orderData,
timestamp: date,
}
segmentService.track(orderEvent)
}
export const config = {
event: "order.canceled",
}
@@ -1,82 +0,0 @@
export default async function handler({ data: { id, return_id }, container }) {
const orderService = container.resolve("orderService")
const returnService = container.resolve("returnService")
const segmentService = container.resolve("segmentService")
const order = await orderService.retrieveWithTotals(id, {
relations: [
"customer",
"billing_address",
"shipping_address",
"discounts",
"discounts.rule",
"shipping_methods",
"shipping_methods.shipping_option",
"payments",
"fulfillments",
"returns",
"items",
"gift_cards",
"gift_card_transactions",
"swaps",
"swaps.return_order",
"swaps.payment",
"swaps.shipping_methods",
"swaps.shipping_methods.shipping_option",
"swaps.shipping_address",
"swaps.additional_items",
"swaps.fulfillments",
],
})
const ret = await returnService.retrieve(return_id, {
relations: ["items", "items.reason"],
})
const shipping: object[] = []
if (ret.shipping_method && ret.shipping_method.price) {
shipping.push({
...ret.shipping_method,
price: -1 * (ret.shipping_method.price / 100),
})
}
let merged = [...order.items]
// merge items from order with items from order swaps
if (order.swaps && order.swaps.length) {
for (const s of order.swaps) {
merged = [...merged, ...s.additional_items]
}
}
const toBuildFrom = {
...order,
shipping_methods: shipping,
items: ret.items.map((i) => {
const li = merged.find((l) => l.id === i.item_id)
if (i.reason) {
li.reason = i.reason
}
if (i.note) {
li.note = i.note
}
return li
}),
}
const orderData = await segmentService.buildOrder(toBuildFrom)
const orderEvent = {
event: "Order Refunded",
userId: order.customer_id,
properties: orderData,
timestamp: new Date(),
}
segmentService.track(orderEvent)
}
export const config = {
event: "order.items-returned",
}
@@ -1,87 +0,0 @@
export default async function handler({ data: { id }, container }) {
const orderService = container.resolve("orderService")
const cartService = container.resolve("cartService")
const segmentService = container.resolve("segmentService")
const order = await orderService.retrieveWithTotals(id, {
relations: [
"customer",
"billing_address",
"shipping_address",
"discounts",
"discounts.rule",
"shipping_methods",
"shipping_methods.shipping_option",
"payments",
"fulfillments",
"items",
"returns",
"gift_cards",
"gift_card_transactions",
"swaps",
"swaps.return_order",
"swaps.payment",
"swaps.shipping_methods",
"swaps.shipping_methods.shipping_option",
"swaps.shipping_address",
"swaps.additional_items",
"swaps.fulfillments",
],
})
const eventContext: Record<string, unknown> = {}
const integrations: Record<string, unknown> = {}
if (order.cart_id) {
try {
const cart = await cartService.retrieve(order.cart_id, {
select: ["context"],
})
if (cart.context) {
if (cart.context.ip) {
eventContext.ip = cart.context.ip
}
if (cart.context.user_agent) {
eventContext.user_agent = cart.context.user_agent
}
if (segmentService.options_ && segmentService.options_.use_ga_id) {
if (cart.context.ga_id) {
integrations["Google Analytics"] = {
clientId: cart.context.ga_id,
}
}
}
}
} catch (err) {
console.log(err)
console.warn("Failed to gather context for order")
}
}
const orderData = await segmentService.buildOrder(order)
const orderEvent = {
event: "Order Completed",
userId: order.customer_id,
properties: orderData,
timestamp: order.created_at,
context: eventContext,
integrations,
}
segmentService.identify({
userId: order.customer_id,
traits: {
email: order.email,
firstName: order.shipping_address.first_name,
lastName: order.shipping_address.last_name,
},
})
segmentService.track(orderEvent)
}
export const config = {
event: "order.placed",
}
@@ -1,60 +0,0 @@
export default async function handler({
data: { id, fulfillment_id },
container,
}) {
const orderService = container.resolve("orderService")
const fulfillmentService = container.resolve("fulfillmentService")
const segmentService = container.resolve("segmentService")
const order = await orderService.retrieveWithTotals(id, {
relations: [
"customer",
"billing_address",
"shipping_address",
"discounts",
"discounts.rule",
"shipping_methods",
"shipping_methods.shipping_option",
"payments",
"fulfillments",
"returns",
"items",
"gift_cards",
"gift_card_transactions",
"swaps",
"swaps.return_order",
"swaps.payment",
"swaps.shipping_methods",
"swaps.shipping_methods.shipping_option",
"swaps.shipping_address",
"swaps.additional_items",
"swaps.fulfillments",
],
})
const fulfillment = await fulfillmentService.retrieve(fulfillment_id, {
relations: ["items"],
})
const toBuildFrom = {
...order,
provider_id: fulfillment.provider,
items: fulfillment.items.map((i) =>
order.items.find((l) => l.id === i.item_id)
),
}
const orderData = await segmentService.buildOrder(toBuildFrom)
const orderEvent = {
event: "Order Shipped",
userId: order.customer_id,
properties: orderData,
timestamp: fulfillment.shipped_at,
}
segmentService.track(orderEvent)
}
export const config = {
event: "order.shipment_created",
}
@@ -1,24 +0,0 @@
import { gatherSwapReport } from "../utils/gather-swap-report"
export default async function handler({ data: { id }, container }) {
const swapService = container.resolve("swapService")
const segmentService = container.resolve("segmentService")
const lineItemService = container.resolve("lineItemService")
const [swap, swapReport] = await gatherSwapReport(id, {
swapService,
segmentService,
lineItemService,
})
return await segmentService.track({
event: "Swap Created",
userId: swap.order.customer_id,
timestamp: swap.created_at,
properties: swapReport,
})
}
export const config = {
event: "swap.created",
}
@@ -1,36 +0,0 @@
import { humanizeAmount } from "medusa-core-utils"
import { gatherSwapReport } from "../utils/gather-swap-report"
export default async function handler({ data: { id }, container }) {
const swapService = container.resolve("swapService")
const segmentService = container.resolve("segmentService")
const lineItemService = container.resolve("lineItemService")
const [swap, swapReport] = await gatherSwapReport(id, {
swapService,
segmentService,
lineItemService,
})
const currency = swapReport.currency
const total = humanizeAmount(swap.difference_due, currency)
const reporting_total = await segmentService.getReportingValue(
currency,
total
)
return await segmentService.track({
event: "Swap Confirmed",
userId: swap.order.customer_id,
timestamp: swap.confirmed_at,
properties: {
reporting_total,
total,
...swapReport,
},
})
}
export const config = {
event: "swap.payment_completed",
}
@@ -1,41 +0,0 @@
import { humanizeAmount } from "medusa-core-utils"
import { gatherSwapReport } from "../utils/gather-swap-report"
export default async function handler({
data: { id, fulfillment_id },
container,
}) {
const segmentService = container.resolve("segmentService")
const fulfillmentService = container.resolve("fulfillmentService")
const swapService = container.resolve("swapService")
const lineItemService = container.resolve("lineItemService")
const [swap, swapReport] = await gatherSwapReport(id, {
swapService,
segmentService,
lineItemService,
})
const fulfillment = await fulfillmentService.retrieve(fulfillment_id)
const currency = swapReport.currency
const total = humanizeAmount(swap.difference_due, currency)
const reporting_total = await segmentService.getReportingValue(
currency,
total
)
return await segmentService.track({
event: "Swap Shipped",
userId: swap.order.customer_id,
timestamp: fulfillment.shipped_at,
properties: {
reporting_total,
total,
...swapReport,
},
})
}
export const config = {
event: "swap.shipment_created",
}
@@ -1,71 +0,0 @@
import { humanizeAmount } from "medusa-core-utils"
export async function gatherSwapReport(
id,
{ swapService, segmentService, lineItemService }
) {
const swap = await swapService.retrieve(id, {
relations: [
"order",
"additional_items",
"additional_items.variant",
"return_order",
"return_order.items",
"return_order.shipping_method",
],
})
const currency = swap.order.currency_code
const newItems = await Promise.all(
swap.additional_items.map(async (i) => {
const price = humanizeAmount(i.unit_price, currency)
const reporting_price = await segmentService.getReportingValue(
currency,
price
)
return {
name: i.title,
product_id: i.variant.product_id,
variant: i.variant.sku,
quantity: i.quantity,
price,
reporting_price,
}
})
)
const returnItems = await Promise.all(
swap.return_order.items.map(async (ri) => {
const i = await lineItemService.retrieve(ri.item_id, {
relations: ["variant"],
})
const price = humanizeAmount(i.unit_price, currency)
const reporting_price = await segmentService.getReportingValue(
currency,
price
)
return {
name: i.title,
product_id: i.variant.product_id,
variant: i.variant.sku,
quantity: ri.quantity,
price,
reporting_price,
}
})
)
return [
swap,
{
swap_id: swap.id,
order_id: swap.order_id,
new_items: newItems,
return_items: returnItems,
currency,
},
]
}
@@ -1,8 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "esnext"
},
"include": ["src/admin"],
"exclude": ["**/*.spec.js"]
}
@@ -1,35 +0,0 @@
{
"compilerOptions": {
"lib": [
"es5",
"es6",
"es2019"
],
"target": "es5",
"jsx": "react-jsx" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
"outDir": "./dist",
"esModuleInterop": true,
"declaration": true,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitReturns": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"allowJs": true,
"skipLibCheck": true,
"downlevelIteration": true // to use ES5 specific tooling
},
"include": ["src"],
"exclude": [
"dist",
"build",
"src/**/__tests__",
"src/**/__mocks__",
"src/**/__fixtures__",
"node_modules",
".eslintrc.js"
]
}
@@ -1,7 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"inlineSourceMap": true /* Emit a single file with source maps instead of having a separate file. */
},
"exclude": ["src/admin", "**/*.spec.js"]
}
@@ -1,5 +0,0 @@
{
"extends": "./tsconfig.json",
"include": ["src"],
"exclude": ["node_modules"]
}
-13
View File
@@ -1,13 +0,0 @@
{
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-instanceof",
"@babel/plugin-transform-classes"
],
"presets": ["@babel/preset-env"],
"env": {
"test": {
"plugins": ["@babel/plugin-transform-runtime"]
}
}
}
@@ -1,15 +0,0 @@
/lib
node_modules
.DS_store
.env*
/*.js
!index.js
!jest.config.js
/dist
/api
/services
/models
/subscribers
@@ -1,9 +0,0 @@
.DS_store
src
dist
yarn.lock
.babelrc
jest.config.js
.turbo
.yarn
@@ -1,287 +0,0 @@
# Change Log
## 1.1.43
### Patch Changes
- [#3763](https://github.com/medusajs/medusa/pull/3763) [`4104d9ccb`](https://github.com/medusajs/medusa/commit/4104d9ccb25276c85b5363f85e14b3093e64df85) Thanks [@StephixOne](https://github.com/StephixOne)! - fix(plugin-discount-generator,plugin-economic,plugin-mailchimp,plugin-restock-notification,plugin-sendgrid,plugin-wishlist): Temporarily remove payload validation in some plugins
## 1.1.42
### Patch Changes
- Updated dependencies [[`121b42acf`](https://github.com/medusajs/medusa/commit/121b42acfe98c12dd593f9b1f2072ff0f3b61724), [`aa690beed`](https://github.com/medusajs/medusa/commit/aa690beed775646cbc86b445fb5dc90dcac087d5), [`54dcc1871`](https://github.com/medusajs/medusa/commit/54dcc1871c8f28bea962dbb9df6e79b038d56449), [`77d46220c`](https://github.com/medusajs/medusa/commit/77d46220c23bfe19e575cbc445874eb6c22f3c73)]:
- medusa-core-utils@1.2.0
- medusa-interfaces@1.3.7
- medusa-test-utils@1.1.40
## 1.1.42-rc.0
### Patch Changes
- Updated dependencies [[`121b42acf`](https://github.com/medusajs/medusa/commit/121b42acfe98c12dd593f9b1f2072ff0f3b61724), [`aa690beed`](https://github.com/medusajs/medusa/commit/aa690beed775646cbc86b445fb5dc90dcac087d5), [`54dcc1871`](https://github.com/medusajs/medusa/commit/54dcc1871c8f28bea962dbb9df6e79b038d56449), [`77d46220c`](https://github.com/medusajs/medusa/commit/77d46220c23bfe19e575cbc445874eb6c22f3c73)]:
- medusa-core-utils@1.2.0-rc.0
- medusa-interfaces@1.3.7-rc.0
- medusa-test-utils@1.1.40-rc.0
## 1.1.41
### Patch Changes
- Updated dependencies [[`8c5219a31`](https://github.com/medusajs/medusa/commit/8c5219a31ef76ee571fbce84d7d57a63abe56eb0)]:
- medusa-core-utils@1.1.39
- medusa-interfaces@1.3.6
## 1.1.40
### Patch Changes
- Updated dependencies [[`08324355a`](https://github.com/medusajs/medusa/commit/08324355a4466b017a0bc7ab1d333ee3cd27b8c4)]:
- medusa-core-utils@1.1.38
- medusa-interfaces@1.3.5
## 1.1.39
### Patch Changes
- [#3025](https://github.com/medusajs/medusa/pull/3025) [`93d0dc1bd`](https://github.com/medusajs/medusa/commit/93d0dc1bdcb54cf6e87428a7bb9b0dac196b4de2) Thanks [@adrien2p](https://github.com/adrien2p)! - fix(medusa): test, build and watch scripts
- Updated dependencies [[`93d0dc1bd`](https://github.com/medusajs/medusa/commit/93d0dc1bdcb54cf6e87428a7bb9b0dac196b4de2)]:
- medusa-interfaces@1.3.4
## 1.1.38
### Patch Changes
- [#2808](https://github.com/medusajs/medusa/pull/2808) [`0a9c89185`](https://github.com/medusajs/medusa/commit/0a9c891853c4d16b553d38268a3408ca1daa71f0) Thanks [@patrick-medusajs](https://github.com/patrick-medusajs)! - chore: explicitly add devDependencies for monorepo peerDependencies
- Updated dependencies [[`7cced6006`](https://github.com/medusajs/medusa/commit/7cced6006a9a6f9108009e9f3e191e9f3ba1b168)]:
- medusa-core-utils@1.1.37
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.37](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.36...medusa-plugin-wishlist@1.1.37) (2022-01-11)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.36](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.35...medusa-plugin-wishlist@1.1.36) (2021-12-29)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.35](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.34...medusa-plugin-wishlist@1.1.35) (2021-12-17)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.34](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.33...medusa-plugin-wishlist@1.1.34) (2021-12-08)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.33](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.32...medusa-plugin-wishlist@1.1.33) (2021-11-23)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.32](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.31...medusa-plugin-wishlist@1.1.32) (2021-11-22)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.30...medusa-plugin-wishlist@1.1.31) (2021-11-19)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.29...medusa-plugin-wishlist@1.1.30) (2021-11-19)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.28...medusa-plugin-wishlist@1.1.29) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.28](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.27...medusa-plugin-wishlist@1.1.28) (2021-10-18)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.27](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.25...medusa-plugin-wishlist@1.1.27) (2021-10-18)
### Features
- update and cancel swaps, claims, and returns ([#310](https://github.com/medusajs/medusa/issues/310)) ([cf66f97](https://github.com/medusajs/medusa/commit/cf66f97758003a41737602d4b1b1051b266d4f81))
## [1.1.26](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.25...medusa-plugin-wishlist@1.1.26) (2021-10-18)
### Features
- update and cancel swaps, claims, and returns ([#310](https://github.com/medusajs/medusa/issues/310)) ([cf66f97](https://github.com/medusajs/medusa/commit/cf66f97758003a41737602d4b1b1051b266d4f81))
## [1.1.25](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.25...medusa-plugin-wishlist@1.1.25) (2021-09-15)
### Features
- update and cancel swaps, claims, and returns ([#310](https://github.com/medusajs/medusa/issues/310)) ([cf66f97](https://github.com/medusajs/medusa/commit/cf66f97758003a41737602d4b1b1051b266d4f81))
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.25...medusa-plugin-wishlist@1.1.24) (2021-09-14)
### Features
- update and cancel swaps, claims, and returns ([#310](https://github.com/medusajs/medusa/issues/310)) ([cf66f97](https://github.com/medusajs/medusa/commit/cf66f97758003a41737602d4b1b1051b266d4f81))
## [1.1.25](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.23...medusa-plugin-wishlist@1.1.25) (2021-09-02)
### Bug Fixes
- 404 ([b1132ee](https://github.com/medusajs/medusa/commit/b1132eec23514a6e7a22fe6653f4a4b4fde0e83f))
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.23...medusa-plugin-wishlist@1.1.24) (2021-08-31)
### Bug Fixes
- 404 ([b1132ee](https://github.com/medusajs/medusa/commit/b1132eec23514a6e7a22fe6653f4a4b4fde0e83f))
## [1.1.23](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.22...medusa-plugin-wishlist@1.1.23) (2021-08-05)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.22](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.21...medusa-plugin-wishlist@1.1.22) (2021-07-26)
### Bug Fixes
- support wishlist ([#325](https://github.com/medusajs/medusa/issues/325)) ([4e003be](https://github.com/medusajs/medusa/commit/4e003bebaac0d84bedf5a2ed6ca94b728b50a9d9))
## [1.1.21](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.19...medusa-plugin-wishlist@1.1.21) (2021-07-15)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.20](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.19...medusa-plugin-wishlist@1.1.20) (2021-07-15)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.19](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.18...medusa-plugin-wishlist@1.1.19) (2021-07-02)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.18](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.17...medusa-plugin-wishlist@1.1.18) (2021-06-22)
### Bug Fixes
- release assist ([668e8a7](https://github.com/medusajs/medusa/commit/668e8a740200847fc2a41c91d2979097f1392532))
## [1.1.17](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.16...medusa-plugin-wishlist@1.1.17) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.16](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.15...medusa-plugin-wishlist@1.1.16) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.14...medusa-plugin-wishlist@1.1.15) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.13...medusa-plugin-wishlist@1.1.14) (2021-06-09)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.12...medusa-plugin-wishlist@1.1.13) (2021-06-08)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.9...medusa-plugin-wishlist@1.1.12) (2021-04-28)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.10...medusa-plugin-wishlist@1.1.11) (2021-04-20)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.9...medusa-plugin-wishlist@1.1.10) (2021-04-20)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.8...medusa-plugin-wishlist@1.1.9) (2021-04-13)
### Bug Fixes
- merge develop ([2982a8e](https://github.com/medusajs/medusa/commit/2982a8e682e90beb4549d969d9d3b04d78a46a2d))
- merge develop ([a468c45](https://github.com/medusajs/medusa/commit/a468c451e82c68f41b5005a2e480057f6124aaa6))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.7...medusa-plugin-wishlist@1.1.8) (2021-04-13)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.6...medusa-plugin-wishlist@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.5...medusa-plugin-wishlist@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.3...medusa-plugin-wishlist@1.1.5) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.3...medusa-plugin-wishlist@1.1.4) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.2...medusa-plugin-wishlist@1.1.3) (2021-02-17)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.2](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.1...medusa-plugin-wishlist@1.1.2) (2021-02-03)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.1.1](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.0...medusa-plugin-wishlist@1.1.1) (2021-01-27)
**Note:** Version bump only for package medusa-plugin-wishlist
# [1.1.0](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.0.13...medusa-plugin-wishlist@1.1.0) (2021-01-26)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.0.13](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.0.12...medusa-plugin-wishlist@1.0.13) (2020-12-17)
**Note:** Version bump only for package medusa-plugin-wishlist
## [1.0.12](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.0.11...medusa-plugin-wishlist@1.0.12) (2020-11-24)
**Note:** Version bump only for package medusa-plugin-wishlist
## 1.0.11 (2020-10-19)
## 1.0.10 (2020-09-09)
### Bug Fixes
- updates license ([db519fb](https://github.com/medusajs/medusa/commit/db519fbaa6f8ad02c19cbecba5d4f28ba1ee81aa))
## 1.0.7 (2020-09-07)
## 1.0.1 (2020-09-05)
## 1.0.1-beta.0 (2020-09-04)
# 1.0.0 (2020-09-03)
# 1.0.0-alpha.30 (2020-08-28)
# 1.0.0-alpha.27 (2020-08-27)
# 1.0.0-alpha.26 (2020-08-27)
# 1.0.0-alpha.24 (2020-08-27)
# 1.0.0-alpha.3 (2020-08-20)
# 1.0.0-alpha.2 (2020-08-20)
# 1.0.0-alpha.1 (2020-08-20)
# 1.0.0-alpha.0 (2020-08-20)
## [1.0.10](https://github.com/medusajs/medusa/compare/v1.0.9...v1.0.10) (2020-09-09)
### Bug Fixes
- updates license ([db519fb](https://github.com/medusajs/medusa/commit/db519fbaa6f8ad02c19cbecba5d4f28ba1ee81aa))
-40
View File
@@ -1,40 +0,0 @@
# Wishlist
Add wishlist capabilities to your commerce application.
[Medusa Website](https://medusajs.com) | [Medusa Repository](https://github.com/medusajs/medusa)
## Features
- Allow customers to manage items in their wishlist.
---
## Prerequisites
- [Medusa backend](https://docs.medusajs.com/development/backend/install)
---
## How to Install
1\. Run the following command in the directory of the Medusa backend:
```bash
npm install medusa-plugin-wishlist
```
2\. In `medusa-config.js` add the following at the end of the `plugins` array:
```js
const plugins = [
// ...
`medusa-plugin-wishlist`
]
```
---
## Test the Plugin
Learn about testing the plugin in [the documentation](https://docs.medusajs.com/plugins/other/wishlist)
-1
View File
@@ -1 +0,0 @@
// noop
@@ -1,3 +0,0 @@
module.exports = {
testEnvironment: "node",
}
@@ -1,51 +0,0 @@
{
"name": "medusa-plugin-wishlist",
"version": "1.1.43",
"description": "Provides /customers/:id/wishlist to add items to a customr's wishlist",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/medusajs/medusa",
"directory": "packages/medusa-plugin-wishlist"
},
"engines": {
"node": ">=16"
},
"author": "Sebastian Rindom",
"license": "MIT",
"devDependencies": {
"@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5",
"@babel/node": "^7.7.4",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-transform-classes": "^7.9.5",
"@babel/plugin-transform-instanceof": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.5",
"@babel/register": "^7.7.4",
"@babel/runtime": "^7.9.6",
"cross-env": "^5.2.1",
"jest": "^25.5.4",
"medusa-interfaces": "^1.3.7",
"medusa-test-utils": "^1.1.40"
},
"scripts": {
"prepare": "cross-env NODE_ENV=production yarn run build",
"test": "jest --passWithNoTests src",
"build": "babel src --out-dir . --ignore '**/__tests__','**/__mocks__'",
"watch": "babel -w src --out-dir . --ignore '**/__tests__','**/__mocks__'"
},
"peerDependencies": {
"medusa-interfaces": "^1.3.7"
},
"dependencies": {
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"medusa-core-utils": "^1.2.0"
},
"gitHead": "3bbd1e8507e00bc471de6ae3c30207999a4a4011",
"keywords": [
"medusa-plugin"
]
}
@@ -1,50 +0,0 @@
import express, { Router } from "express"
import jwt from "jsonwebtoken"
import cors from "cors"
import { getConfigFile, MedusaError, parseCorsOrigins } from "medusa-core-utils"
const app = Router()
export default (rootDirectory) => {
const { configModule } = getConfigFile(rootDirectory, "medusa-config")
const { projectConfig } = configModule
const corsOptions = {
origin: parseCorsOrigins(projectConfig.store_cors),
credentials: true,
}
const JWT_SECRET = process.env.JWT_SECRET || ""
app.use("/wishlists/:token", cors(corsOptions))
app.get(
"/wishlists/:token",
cors(corsOptions),
express.json(),
async (req, res) => {
const customerService = req.scope.resolve("customerService")
const { token } = req.params
let decode
try {
decode = jwt.decode(token, JWT_SECRET)
if (!decode || !decode.customer_id) {
throw new MedusaError(MedusaError.Types.NOT_FOUND, "Invalid token")
}
} catch (err) {
res.status(400).json({ message: err.message })
}
try {
const customer = await customerService.retrieve(decode.customer_id)
const wishlist = {
items: customer.metadata.wishlist,
first_name: customer.first_name,
}
res.status(200).json({ wishlist })
} catch (err) {
res.status(400).json({ message: err.message })
}
}
)
return app
}
@@ -1,76 +0,0 @@
import bodyParser from "body-parser"
import { Router } from "express"
import jwt from "jsonwebtoken"
import { MedusaError } from "medusa-core-utils"
const JWT_SECRET = process.env.JWT_SECRET || ""
export default () => {
const app = Router()
app.delete("/:id/wishlist", bodyParser.json(), async (req, res) => {
const customerService = req.scope.resolve("customerService")
let customer = await customerService.retrieve(req.params.id)
const wishlist = (customer.metadata && customer.metadata.wishlist) || []
const newWishlist = [...wishlist]
newWishlist.splice(req.body.index, 1)
customer = await customerService.update(customer.id, {
metadata: { wishlist: newWishlist },
})
res.json({ customer })
})
app.post("/:id/wishlist", bodyParser.json(), async (req, res) => {
const lineItemService = req.scope.resolve("lineItemService")
const customerService = req.scope.resolve("customerService")
const regionService = req.scope.resolve("regionService")
let customer = await customerService.retrieve(req.params.id)
const regions = await regionService.list()
if (regions.length) {
const lineItem = await lineItemService.generate(
req.body.variant_id,
regions[0].id,
req.body.quantity,
{ metadata: req.body.metadata }
)
const wishlist = (customer.metadata && customer.metadata.wishlist) || []
customer = await customerService.update(customer.id, {
metadata: { wishlist: [...wishlist, lineItem] },
})
}
res.json({ customer })
})
app.post("/:id/wishlist/share-token", bodyParser.json(), async (req, res) => {
const customerService = req.scope.resolve("customerService")
const customer = await customerService.retrieve(req.params.id)
// check customer has wishlist else throw 400 bad request
if (!customer?.metadata?.wishlist) {
throw new MedusaError(
MedusaError.Types.INVALID_DATA,
"Invalid data - Customer doesn't have a wishlist"
)
}
const token = jwt.sign(
{
customer_id: customer.id,
},
JWT_SECRET
)
res.json({ share_token: token })
})
return app
}
+55 -493
View File
@@ -1876,7 +1876,7 @@ __metadata:
languageName: node
linkType: hard
"@babel/node@npm:^7.12.10, @babel/node@npm:^7.12.6, @babel/node@npm:^7.7.4":
"@babel/node@npm:^7.12.10, @babel/node@npm:^7.12.6":
version: 7.22.5
resolution: "@babel/node@npm:7.22.5"
dependencies:
@@ -3787,20 +3787,6 @@ __metadata:
languageName: node
linkType: hard
"@babel/plugin-transform-typescript@npm:^7.13.0, @babel/plugin-transform-typescript@npm:^7.22.5":
version: 7.22.5
resolution: "@babel/plugin-transform-typescript@npm:7.22.5"
dependencies:
"@babel/helper-annotate-as-pure": ^7.22.5
"@babel/helper-create-class-features-plugin": ^7.22.5
"@babel/helper-plugin-utils": ^7.22.5
"@babel/plugin-syntax-typescript": ^7.22.5
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: 1ee79ead40f8a299dd643d433a514e2bc970f954d27c3a92d62f2139a19128c31d76d094df7e1c1789a70528f349ba536f271a0b47117c77ca49cd26f8b1c66d
languageName: node
linkType: hard
"@babel/plugin-transform-typescript@npm:^7.18.6":
version: 7.24.5
resolution: "@babel/plugin-transform-typescript@npm:7.24.5"
@@ -3815,6 +3801,20 @@ __metadata:
languageName: node
linkType: hard
"@babel/plugin-transform-typescript@npm:^7.22.5":
version: 7.22.5
resolution: "@babel/plugin-transform-typescript@npm:7.22.5"
dependencies:
"@babel/helper-annotate-as-pure": ^7.22.5
"@babel/helper-create-class-features-plugin": ^7.22.5
"@babel/helper-plugin-utils": ^7.22.5
"@babel/plugin-syntax-typescript": ^7.22.5
peerDependencies:
"@babel/core": ^7.0.0-0
checksum: 1ee79ead40f8a299dd643d433a514e2bc970f954d27c3a92d62f2139a19128c31d76d094df7e1c1789a70528f349ba536f271a0b47117c77ca49cd26f8b1c66d
languageName: node
linkType: hard
"@babel/plugin-transform-unicode-escapes@npm:^7.10.4":
version: 7.24.1
resolution: "@babel/plugin-transform-unicode-escapes@npm:7.24.1"
@@ -4267,7 +4267,7 @@ __metadata:
languageName: node
linkType: hard
"@babel/register@npm:^7.11.5, @babel/register@npm:^7.12.1, @babel/register@npm:^7.22.5, @babel/register@npm:^7.7.4":
"@babel/register@npm:^7.11.5, @babel/register@npm:^7.12.1, @babel/register@npm:^7.22.5":
version: 7.22.5
resolution: "@babel/register@npm:7.22.5"
dependencies:
@@ -7983,7 +7983,7 @@ __metadata:
languageName: unknown
linkType: soft
"@medusajs/medusa@^1.17.1, @medusajs/medusa@^1.20.3, @medusajs/medusa@^1.20.4, @medusajs/medusa@^1.20.5, @medusajs/medusa@workspace:*, @medusajs/medusa@workspace:^, @medusajs/medusa@workspace:packages/medusa":
"@medusajs/medusa@^1.20.3, @medusajs/medusa@^1.20.4, @medusajs/medusa@^1.20.5, @medusajs/medusa@workspace:*, @medusajs/medusa@workspace:^, @medusajs/medusa@workspace:packages/medusa":
version: 0.0.0-use.local
resolution: "@medusajs/medusa@workspace:packages/medusa"
dependencies:
@@ -11345,16 +11345,6 @@ __metadata:
languageName: node
linkType: hard
"@segment/loosely-validate-event@npm:^2.0.0":
version: 2.0.0
resolution: "@segment/loosely-validate-event@npm:2.0.0"
dependencies:
component-type: ^1.2.1
join-component: ^1.1.0
checksum: c083c70c5f0a42a2bc5b685f82830b968d01b5b8de2a9a1c362a3952c6bb33ffbdfcf8196c8ce110a5050f78ff9dcf395832eb55687843c80dc77dfe659b0803
languageName: node
linkType: hard
"@sideway/address@npm:^4.1.4":
version: 4.1.4
resolution: "@sideway/address@npm:4.1.4"
@@ -16822,7 +16812,7 @@ __metadata:
languageName: node
linkType: hard
"acorn-jsx@npm:^5.2.0, acorn-jsx@npm:^5.3.1, acorn-jsx@npm:^5.3.2":
"acorn-jsx@npm:^5.3.1, acorn-jsx@npm:^5.3.2":
version: 5.3.2
resolution: "acorn-jsx@npm:5.3.2"
peerDependencies:
@@ -17039,22 +17029,6 @@ __metadata:
languageName: node
linkType: hard
"analytics-node@npm:^3.4.0-beta.1":
version: 3.5.0
resolution: "analytics-node@npm:3.5.0"
dependencies:
"@segment/loosely-validate-event": ^2.0.0
axios: ^0.21.1
axios-retry: ^3.0.2
lodash.isstring: ^4.0.1
md5: ^2.2.1
ms: ^2.0.0
remove-trailing-slash: ^0.1.0
uuid: ^3.2.1
checksum: 041b0ac7d20df2366ebf612f7e088f686241ec57f7f4212252fd896b095210b1464724ababfa3904679e9137ee3ccb64a1ed64c8d69dc222ac1c9d2d6c19e74f
languageName: node
linkType: hard
"ansi-align@npm:^3.0.0":
version: 3.0.1
resolution: "ansi-align@npm:3.0.1"
@@ -17138,7 +17112,7 @@ __metadata:
languageName: node
linkType: hard
"ansi-styles@npm:^3.2.0, ansi-styles@npm:^3.2.1":
"ansi-styles@npm:^3.2.1":
version: 3.2.1
resolution: "ansi-styles@npm:3.2.1"
dependencies:
@@ -17816,7 +17790,7 @@ __metadata:
languageName: node
linkType: hard
"axios-retry@npm:^3.0.2, axios-retry@npm:^3.1.9":
"axios-retry@npm:^3.1.9":
version: 3.5.1
resolution: "axios-retry@npm:3.5.1"
dependencies:
@@ -17837,25 +17811,7 @@ __metadata:
languageName: node
linkType: hard
"axios@npm:^0.19.2":
version: 0.19.2
resolution: "axios@npm:0.19.2"
dependencies:
follow-redirects: 1.5.10
checksum: b775abf2db44ea4f182f4c2bfa4bf84a723b86f5aa001f222f12193fa45ba243b7e3f27b66289c6afa51d696402b05c82715fd621a34add5b538e850adcdbce1
languageName: node
linkType: hard
"axios@npm:^0.20.0":
version: 0.20.0
resolution: "axios@npm:0.20.0"
dependencies:
follow-redirects: ^1.10.0
checksum: 36dffb87c584d75bc5b009165c78031aab113f874b81c510deab369a63a2a27bd241395751a801c79d2ed2dcee55a4d8a557f0c1b9fd7de6c38bdd1ad7f56783
languageName: node
linkType: hard
"axios@npm:^0.21.1, axios@npm:^0.21.4":
"axios@npm:^0.21.4":
version: 0.21.4
resolution: "axios@npm:0.21.4"
dependencies:
@@ -19522,13 +19478,6 @@ __metadata:
languageName: node
linkType: hard
"charenc@npm:0.0.2":
version: 0.0.2
resolution: "charenc@npm:0.0.2"
checksum: a45ec39363a16799d0f9365c8dd0c78e711415113c6f14787a22462ef451f5013efae8a28f1c058f81fc01f2a6a16955f7a5fd0cd56247ce94a45349c89877d8
languageName: node
linkType: hard
"check-error@npm:^1.0.3":
version: 1.0.3
resolution: "check-error@npm:1.0.3"
@@ -19847,15 +19796,6 @@ __metadata:
languageName: node
linkType: hard
"client-sessions@npm:^0.8.0":
version: 0.8.0
resolution: "client-sessions@npm:0.8.0"
dependencies:
cookies: ^0.7.0
checksum: b53995540b212d9c5992d48432eb97aa9a2e8a91c4d487c6a495c3c5b39711789422096b4d24e00b1b3ac41d87a16a4411673fffc2d56f7fb840d15841413b1b
languageName: node
linkType: hard
"cliui@npm:^6.0.0":
version: 6.0.0
resolution: "cliui@npm:6.0.0"
@@ -20242,13 +20182,6 @@ __metadata:
languageName: node
linkType: hard
"component-type@npm:^1.2.1":
version: 1.2.1
resolution: "component-type@npm:1.2.1"
checksum: 8f9537d529d619484b8572cd569f212ea264d8c84dc65ccaaa0136e4a2e06696e9a2b2b1979ef264251f8b4ebfa075f23c860b6e4270385fd7663b42e5727cee
languageName: node
linkType: hard
"compressible@npm:~2.0.16":
version: 2.0.18
resolution: "compressible@npm:2.0.18"
@@ -20457,16 +20390,6 @@ __metadata:
languageName: node
linkType: hard
"cookies@npm:^0.7.0":
version: 0.7.3
resolution: "cookies@npm:0.7.3"
dependencies:
depd: ~1.1.2
keygrip: ~1.0.3
checksum: ecb29d0cb442e530bf3f5642e542346d747de0f9f94c092bba4eebd44d4d55dfde6d2cf20e58387ae8dc5d2e1f1562c6623a5b1df1e4539df2ca021ae27b802c
languageName: node
linkType: hard
"copy-concurrently@npm:^1.0.0":
version: 1.0.5
resolution: "copy-concurrently@npm:1.0.5"
@@ -20837,13 +20760,6 @@ __metadata:
languageName: node
linkType: hard
"crypt@npm:0.0.2":
version: 0.0.2
resolution: "crypt@npm:0.0.2"
checksum: adbf263441dd801665d5425f044647533f39f4612544071b1471962209d235042fb703c27eea2795c7c53e1dfc242405173003f83cf4f4761a633d11f9653f18
languageName: node
linkType: hard
"crypto-browserify@npm:^3.11.0":
version: 3.12.0
resolution: "crypto-browserify@npm:3.12.0"
@@ -21325,15 +21241,6 @@ __metadata:
languageName: node
linkType: hard
"debug@npm:=3.1.0":
version: 3.1.0
resolution: "debug@npm:3.1.0"
dependencies:
ms: 2.0.0
checksum: 5bff34a352d7b2eaa31886eeaf2ee534b5461ec0548315b2f9f80bd1d2533cab7df1fa52e130ce27bc31c3945fbffb0fc72baacdceb274b95ce853db89254ea4
languageName: node
linkType: hard
"debug@npm:^3.0.0, debug@npm:^3.1.0, debug@npm:^3.2.7":
version: 3.2.7
resolution: "debug@npm:3.2.7"
@@ -22180,13 +22087,6 @@ __metadata:
languageName: node
linkType: hard
"emoji-regex@npm:^7.0.1":
version: 7.0.3
resolution: "emoji-regex@npm:7.0.3"
checksum: a8917d695c3a3384e4b7230a6a06fd2de6b3db3709116792e8b7b36ddbb3db4deb28ad3e983e70d4f2a1f9063b5dab9025e4e26e9ca08278da4fbb73e213743f
languageName: node
linkType: hard
"emoji-regex@npm:^8.0.0":
version: 8.0.0
resolution: "emoji-regex@npm:8.0.0"
@@ -22987,7 +22887,7 @@ __metadata:
languageName: node
linkType: hard
"eslint-scope@npm:5.1.1, eslint-scope@npm:^5.0.0, eslint-scope@npm:^5.1.1":
"eslint-scope@npm:5.1.1, eslint-scope@npm:^5.1.1":
version: 5.1.1
resolution: "eslint-scope@npm:5.1.1"
dependencies:
@@ -23027,15 +22927,6 @@ __metadata:
languageName: node
linkType: hard
"eslint-utils@npm:^1.4.3":
version: 1.4.3
resolution: "eslint-utils@npm:1.4.3"
dependencies:
eslint-visitor-keys: ^1.1.0
checksum: ba19a817177d5fc54ae89cd80ecc8bc24eefd640bd8b0db204f29dc79cf9621bb42d68bf31eae6c89ca1f52d748b6583214f57288f9a78d2bd368a2340abe41c
languageName: node
linkType: hard
"eslint-utils@npm:^2.1.0":
version: 2.1.0
resolution: "eslint-utils@npm:2.1.0"
@@ -23123,53 +23014,6 @@ __metadata:
languageName: node
linkType: hard
"eslint@npm:^6.8.0":
version: 6.8.0
resolution: "eslint@npm:6.8.0"
dependencies:
"@babel/code-frame": ^7.0.0
ajv: ^6.10.0
chalk: ^2.1.0
cross-spawn: ^6.0.5
debug: ^4.0.1
doctrine: ^3.0.0
eslint-scope: ^5.0.0
eslint-utils: ^1.4.3
eslint-visitor-keys: ^1.1.0
espree: ^6.1.2
esquery: ^1.0.1
esutils: ^2.0.2
file-entry-cache: ^5.0.1
functional-red-black-tree: ^1.0.1
glob-parent: ^5.0.0
globals: ^12.1.0
ignore: ^4.0.6
import-fresh: ^3.0.0
imurmurhash: ^0.1.4
inquirer: ^7.0.0
is-glob: ^4.0.0
js-yaml: ^3.13.1
json-stable-stringify-without-jsonify: ^1.0.1
levn: ^0.3.0
lodash: ^4.17.14
minimatch: ^3.0.4
mkdirp: ^0.5.1
natural-compare: ^1.4.0
optionator: ^0.8.3
progress: ^2.0.0
regexpp: ^2.0.1
semver: ^6.1.2
strip-ansi: ^5.2.0
strip-json-comments: ^3.0.1
table: ^5.2.3
text-table: ^0.2.0
v8-compile-cache: ^2.0.3
bin:
eslint: ./bin/eslint.js
checksum: 95cd68b3bee8fcabf4468d3fcdfe74baefa878556312ad9ffd25715fe0dc96d6a7d381133bd9307dc24604a14c74fd86ce4fa3851b10783bb69a456b2d7a4acb
languageName: node
linkType: hard
"eslint@npm:^8.23.0":
version: 8.44.0
resolution: "eslint@npm:8.44.0"
@@ -23274,17 +23118,6 @@ __metadata:
languageName: node
linkType: hard
"espree@npm:^6.1.2":
version: 6.2.1
resolution: "espree@npm:6.2.1"
dependencies:
acorn: ^7.1.1
acorn-jsx: ^5.2.0
eslint-visitor-keys: ^1.1.0
checksum: 499b47bc599ac3515598072ca787016bdaf0d463467ee1c7113061949359a26d74b8fb344afdad63e38b0e81c7b068013125f7a123d0776e0d75fffe2fc9cfac
languageName: node
linkType: hard
"espree@npm:^7.3.0, espree@npm:^7.3.1":
version: 7.3.1
resolution: "espree@npm:7.3.1"
@@ -23328,7 +23161,7 @@ __metadata:
languageName: node
linkType: hard
"esquery@npm:^1.0.1, esquery@npm:^1.4.0, esquery@npm:^1.4.2":
"esquery@npm:^1.4.0, esquery@npm:^1.4.2":
version: 1.5.0
resolution: "esquery@npm:1.5.0"
dependencies:
@@ -24081,15 +23914,6 @@ __metadata:
languageName: node
linkType: hard
"file-entry-cache@npm:^5.0.1":
version: 5.0.1
resolution: "file-entry-cache@npm:5.0.1"
dependencies:
flat-cache: ^2.0.1
checksum: 2480fb523a0342b8ede8b17717517f69ce6b775083d06e50e2e10ca45f16c94f1d4d95976ae627735716174033374a2d6717ba4b58569e1fea8564a1b1f2e4c1
languageName: node
linkType: hard
"file-entry-cache@npm:^6.0.1":
version: 6.0.1
resolution: "file-entry-cache@npm:6.0.1"
@@ -24285,17 +24109,6 @@ __metadata:
languageName: node
linkType: hard
"flat-cache@npm:^2.0.1":
version: 2.0.1
resolution: "flat-cache@npm:2.0.1"
dependencies:
flatted: ^2.0.0
rimraf: 2.6.3
write: 1.0.3
checksum: 09e4d2300d05734eb2ac39ea0bb9cc6d64c0c856f6b77d2bdc7734490b4a8f860d721f59ffd5508f6938c577f8394fe7b5f6acf99a5ec4af6478d7c5c8390bcb
languageName: node
linkType: hard
"flat-cache@npm:^3.0.4":
version: 3.0.4
resolution: "flat-cache@npm:3.0.4"
@@ -24306,13 +24119,6 @@ __metadata:
languageName: node
linkType: hard
"flatted@npm:^2.0.0":
version: 2.0.2
resolution: "flatted@npm:2.0.2"
checksum: 1895ac3971c3a71b0384c6d8b8ef1f217dfe7e72bc7dabc51ef532772b761e626dd7cae53a729b9e65389409d7f03fd84f1900bde4f9e719ed04e57e8510e0d4
languageName: node
linkType: hard
"flatted@npm:^3.1.0":
version: 3.2.7
resolution: "flatted@npm:3.2.7"
@@ -24356,16 +24162,7 @@ __metadata:
languageName: node
linkType: hard
"follow-redirects@npm:1.5.10":
version: 1.5.10
resolution: "follow-redirects@npm:1.5.10"
dependencies:
debug: =3.1.0
checksum: f56ca26dcf3c9996a6cf8868b61e369a35d4000ade0292bdd27b5e0934902681b037060b9fabe58e7042bb8b85166d5db8bbcf027f1825c1577e4cffd904fd3f
languageName: node
linkType: hard
"follow-redirects@npm:^1.10.0, follow-redirects@npm:^1.14.0, follow-redirects@npm:^1.14.4":
"follow-redirects@npm:^1.14.0, follow-redirects@npm:^1.14.4":
version: 1.15.2
resolution: "follow-redirects@npm:1.15.2"
peerDependenciesMeta:
@@ -25058,7 +24855,7 @@ __metadata:
languageName: node
linkType: hard
"glob-parent@npm:^5.0.0, glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2":
"glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2":
version: 5.1.2
resolution: "glob-parent@npm:5.1.2"
dependencies:
@@ -25228,15 +25025,6 @@ __metadata:
languageName: node
linkType: hard
"globals@npm:^12.1.0":
version: 12.4.0
resolution: "globals@npm:12.4.0"
dependencies:
type-fest: ^0.8.1
checksum: f6731c915f5fde6ac3737016be748682fdf52a436e4f2702d14cec4f15f3aefcc306483bdae4c9195b04848416443f57e9de6771c74fd77becfbba2d2068bc73
languageName: node
linkType: hard
"globals@npm:^13.19.0, globals@npm:^13.6.0, globals@npm:^13.9.0":
version: 13.20.0
resolution: "globals@npm:13.20.0"
@@ -26311,27 +26099,6 @@ __metadata:
languageName: node
linkType: hard
"inquirer@npm:^7.0.0":
version: 7.3.3
resolution: "inquirer@npm:7.3.3"
dependencies:
ansi-escapes: ^4.2.1
chalk: ^4.1.0
cli-cursor: ^3.1.0
cli-width: ^3.0.0
external-editor: ^3.0.3
figures: ^3.0.0
lodash: ^4.17.19
mute-stream: 0.0.8
run-async: ^2.4.0
rxjs: ^6.6.0
string-width: ^4.1.0
strip-ansi: ^6.0.0
through: ^2.3.6
checksum: 96e75974cfd863fe6653c075e41fa5f1a290896df141189816db945debabcd92d3277145f11aef8d2cfca5409ab003ccdd18a099744814057b52a2f27aeb8c94
languageName: node
linkType: hard
"inquirer@npm:^8.0.0, inquirer@npm:^8.1.1":
version: 8.2.5
resolution: "inquirer@npm:8.2.5"
@@ -26732,7 +26499,7 @@ __metadata:
languageName: node
linkType: hard
"is-buffer@npm:^1.1.5, is-buffer@npm:~1.1.6":
"is-buffer@npm:^1.1.5":
version: 1.1.6
resolution: "is-buffer@npm:1.1.6"
checksum: ae18aa0b6e113d6c490ad1db5e8df9bdb57758382b313f5a22c9c61084875c6396d50bbf49315f5b1926d142d74dfb8d31b40d993a383e0a158b15fea7a82234
@@ -26930,13 +26697,6 @@ __metadata:
languageName: node
linkType: hard
"is-fullwidth-code-point@npm:^2.0.0":
version: 2.0.0
resolution: "is-fullwidth-code-point@npm:2.0.0"
checksum: e58f3e4a601fc0500d8b2677e26e9fe0cd450980e66adb29d85b6addf7969731e38f8e43ed2ec868a09c101a55ac3d8b78902209269f38c5286bc98f5bc1b4d9
languageName: node
linkType: hard
"is-fullwidth-code-point@npm:^3.0.0":
version: 3.0.0
resolution: "is-fullwidth-code-point@npm:3.0.0"
@@ -30335,13 +30095,6 @@ __metadata:
languageName: node
linkType: hard
"join-component@npm:^1.1.0":
version: 1.1.0
resolution: "join-component@npm:1.1.0"
checksum: 7319cb1ca6ffc514d82ac1b965c4e6cd6bf852adec1e7833bd8613e17f4965e78e2653c8de75a1fe51d9a2cae36af3298008df4079cfd903ef3ecbd231fe11c1
languageName: node
linkType: hard
"joycon@npm:^3.0.1, joycon@npm:^3.1.1":
version: 3.1.1
resolution: "joycon@npm:3.1.1"
@@ -30853,13 +30606,6 @@ __metadata:
languageName: node
linkType: hard
"keygrip@npm:~1.0.3":
version: 1.0.3
resolution: "keygrip@npm:1.0.3"
checksum: 2a94700bbdd6f53c3f77932aa2d211ff7f537472a21d257203aa48972c2fdc71c60f82e661415887ea068061ce3c7532c5fdd7e8efd4390ad154d51f1a5932a9
languageName: node
linkType: hard
"keygrip@npm:~1.1.0":
version: 1.1.0
resolution: "keygrip@npm:1.1.0"
@@ -31178,16 +30924,6 @@ __metadata:
languageName: node
linkType: hard
"levn@npm:^0.3.0, levn@npm:~0.3.0":
version: 0.3.0
resolution: "levn@npm:0.3.0"
dependencies:
prelude-ls: ~1.1.2
type-check: ~0.3.2
checksum: e440df9de4233da0b389cd55bd61f0f6aaff766400bebbccd1231b81801f6dbc1d816c676ebe8d70566394b749fa624b1ed1c68070e9c94999f0bdecc64cb676
languageName: node
linkType: hard
"levn@npm:^0.4.1":
version: 0.4.1
resolution: "levn@npm:0.4.1"
@@ -31198,6 +30934,16 @@ __metadata:
languageName: node
linkType: hard
"levn@npm:~0.3.0":
version: 0.3.0
resolution: "levn@npm:0.3.0"
dependencies:
prelude-ls: ~1.1.2
type-check: ~0.3.2
checksum: e440df9de4233da0b389cd55bd61f0f6aaff766400bebbccd1231b81801f6dbc1d816c676ebe8d70566394b749fa624b1ed1c68070e9c94999f0bdecc64cb676
languageName: node
linkType: hard
"libphonenumber-js@npm:^1.10.14":
version: 1.10.37
resolution: "libphonenumber-js@npm:1.10.37"
@@ -31530,7 +31276,7 @@ __metadata:
languageName: node
linkType: hard
"lodash@npm:4.17.21, lodash@npm:4.x, lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21, lodash@npm:^4.7.0, lodash@npm:~4.17.21":
"lodash@npm:4.17.21, lodash@npm:4.x, lodash@npm:^4.17.11, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21, lodash@npm:^4.7.0, lodash@npm:~4.17.21":
version: 4.17.21
resolution: "lodash@npm:4.17.21"
checksum: d8cbea072bb08655bb4c989da418994b073a608dffa608b09ac04b43a791b12aeae7cd7ad919aa4c925f33b48490b5cfe6c1f71d827956071dae2e7bb3a6b74c
@@ -31938,17 +31684,6 @@ __metadata:
languageName: node
linkType: hard
"md5@npm:^2.2.1":
version: 2.3.0
resolution: "md5@npm:2.3.0"
dependencies:
charenc: 0.0.2
crypt: 0.0.2
is-buffer: ~1.1.6
checksum: 14a21d597d92e5b738255fbe7fe379905b8cb97e0a49d44a20b58526a646ec5518c337b817ce0094ca94d3e81a3313879c4c7b510d250c282d53afbbdede9110
languageName: node
linkType: hard
"mdast-squeeze-paragraphs@npm:^4.0.0":
version: 4.0.0
resolution: "mdast-squeeze-paragraphs@npm:4.0.0"
@@ -32071,7 +31806,7 @@ __metadata:
languageName: unknown
linkType: soft
"medusa-interfaces@^1.3.7, medusa-interfaces@^1.3.9, medusa-interfaces@workspace:*, medusa-interfaces@workspace:packages/medusa-interfaces":
"medusa-interfaces@^1.3.9, medusa-interfaces@workspace:*, medusa-interfaces@workspace:packages/medusa-interfaces":
version: 0.0.0-use.local
resolution: "medusa-interfaces@workspace:packages/medusa-interfaces"
dependencies:
@@ -32093,129 +31828,6 @@ __metadata:
languageName: unknown
linkType: soft
"medusa-plugin-discount-generator@workspace:packages/medusa-plugin-discount-generator":
version: 0.0.0-use.local
resolution: "medusa-plugin-discount-generator@workspace:packages/medusa-plugin-discount-generator"
dependencies:
"@babel/cli": ^7.7.5
"@babel/core": ^7.7.5
"@babel/node": ^7.7.4
"@babel/plugin-proposal-class-properties": ^7.7.4
"@babel/plugin-transform-classes": ^7.9.5
"@babel/plugin-transform-instanceof": ^7.8.3
"@babel/plugin-transform-runtime": ^7.7.6
"@babel/preset-env": ^7.7.5
"@babel/register": ^7.7.4
"@babel/runtime": ^7.9.6
body-parser: ^1.19.0
client-sessions: ^0.8.0
cross-env: ^5.2.1
express: ^4.17.1
jest: ^25.5.4
medusa-core-utils: ^1.2.0
medusa-interfaces: ^1.3.7
randomatic: ^3.1.1
peerDependencies:
medusa-interfaces: ^1.3.7
languageName: unknown
linkType: soft
"medusa-plugin-ip-lookup@workspace:packages/medusa-plugin-ip-lookup":
version: 0.0.0-use.local
resolution: "medusa-plugin-ip-lookup@workspace:packages/medusa-plugin-ip-lookup"
dependencies:
"@babel/cli": ^7.7.5
"@babel/core": ^7.7.5
"@babel/plugin-proposal-class-properties": ^7.7.4
"@babel/plugin-transform-classes": ^7.9.5
"@babel/plugin-transform-instanceof": ^7.8.3
"@babel/plugin-transform-runtime": ^7.7.6
"@babel/preset-env": ^7.7.5
"@babel/runtime": ^7.7.6
axios: ^0.20.0
cross-env: ^5.2.1
jest: ^25.5.4
medusa-interfaces: ^1.3.7
peerDependencies:
medusa-interfaces: ^1.3.7
languageName: unknown
linkType: soft
"medusa-plugin-restock-notification@workspace:packages/medusa-plugin-restock-notification":
version: 0.0.0-use.local
resolution: "medusa-plugin-restock-notification@workspace:packages/medusa-plugin-restock-notification"
dependencies:
"@babel/cli": ^7.7.5
"@babel/core": ^7.7.5
"@babel/plugin-transform-typescript": ^7.13.0
"@babel/preset-typescript": ^7.12.7
"@medusajs/medusa": ^1.17.1
babel-preset-medusa-package: ^1.1.19
body-parser: ^1.19.0
cors: ^2.8.5
cross-env: ^5.2.1
express: ^4.17.1
jest: ^25.5.4
medusa-core-utils: ^1.2.0
medusa-interfaces: ^1.3.7
medusa-test-utils: ^1.1.40
pg: ^8.5.1
typeorm: ^0.3.16
ulid: ^2.3.0
peerDependencies:
"@medusajs/medusa": ^1.12.0
medusa-interfaces: ^1.3.7
typeorm: ^0.3.16
languageName: unknown
linkType: soft
"medusa-plugin-segment@workspace:packages/medusa-plugin-segment":
version: 0.0.0-use.local
resolution: "medusa-plugin-segment@workspace:packages/medusa-plugin-segment"
dependencies:
analytics-node: ^3.4.0-beta.1
axios: ^0.19.2
cross-env: ^5.2.1
eslint: ^6.8.0
jest: ^25.5.4
medusa-core-utils: ^1.2.0
medusa-interfaces: ^1.3.7
medusa-test-utils: ^1.1.40
rimraf: ^5.0.1
typescript: ^4.9.5
peerDependencies:
"@medusajs/medusa": ">= 1.18.0 < 2"
medusa-interfaces: ^1.3.7
languageName: unknown
linkType: soft
"medusa-plugin-wishlist@workspace:packages/medusa-plugin-wishlist":
version: 0.0.0-use.local
resolution: "medusa-plugin-wishlist@workspace:packages/medusa-plugin-wishlist"
dependencies:
"@babel/cli": ^7.7.5
"@babel/core": ^7.7.5
"@babel/node": ^7.7.4
"@babel/plugin-proposal-class-properties": ^7.7.4
"@babel/plugin-transform-classes": ^7.9.5
"@babel/plugin-transform-instanceof": ^7.8.3
"@babel/plugin-transform-runtime": ^7.7.6
"@babel/preset-env": ^7.7.5
"@babel/register": ^7.7.4
"@babel/runtime": ^7.9.6
body-parser: ^1.19.0
cors: ^2.8.5
cross-env: ^5.2.1
express: ^4.17.1
jest: ^25.5.4
medusa-core-utils: ^1.2.0
medusa-interfaces: ^1.3.7
medusa-test-utils: ^1.1.40
peerDependencies:
medusa-interfaces: ^1.3.7
languageName: unknown
linkType: soft
"medusa-react@workspace:^, medusa-react@workspace:packages/medusa-react":
version: 0.0.0-use.local
resolution: "medusa-react@workspace:packages/medusa-react"
@@ -32280,7 +31892,7 @@ __metadata:
languageName: unknown
linkType: soft
"medusa-test-utils@^1.1.40, medusa-test-utils@^1.1.42, medusa-test-utils@^1.1.43, medusa-test-utils@^1.1.44, medusa-test-utils@workspace:*, medusa-test-utils@workspace:^, medusa-test-utils@workspace:packages/core/medusa-test-utils":
"medusa-test-utils@^1.1.42, medusa-test-utils@^1.1.43, medusa-test-utils@^1.1.44, medusa-test-utils@workspace:*, medusa-test-utils@workspace:^, medusa-test-utils@workspace:packages/core/medusa-test-utils":
version: 0.0.0-use.local
resolution: "medusa-test-utils@workspace:packages/core/medusa-test-utils"
dependencies:
@@ -34095,7 +33707,7 @@ __metadata:
languageName: node
linkType: hard
"optionator@npm:^0.8.1, optionator@npm:^0.8.3":
"optionator@npm:^0.8.1":
version: 0.8.3
resolution: "optionator@npm:0.8.3"
dependencies:
@@ -37243,13 +36855,6 @@ __metadata:
languageName: node
linkType: hard
"regexpp@npm:^2.0.1":
version: 2.0.1
resolution: "regexpp@npm:2.0.1"
checksum: 4ac2cf4c68941728bffbba5a8f597a23385c2c05afc5bf5de74744ee048765ab84ea3ce3c6a5bdce102a3a54514b75b7add48b4c1abd925ca3afd40e537f2b5f
languageName: node
linkType: hard
"regexpp@npm:^3.1.0":
version: 3.2.0
resolution: "regexpp@npm:3.2.0"
@@ -37383,7 +36988,7 @@ __metadata:
languageName: node
linkType: hard
"remove-trailing-slash@npm:^0.1.0, remove-trailing-slash@npm:^0.1.1":
"remove-trailing-slash@npm:^0.1.1":
version: 0.1.1
resolution: "remove-trailing-slash@npm:0.1.1"
checksum: 6fa91e7b89e0675fdca6ce54af5fad9bd612d51e2251913a2e113b521b157647f1f8c694b55447780b489b30a63ebe949ccda7411ef383d09136bb27121c6c09
@@ -37795,17 +37400,6 @@ __metadata:
languageName: node
linkType: hard
"rimraf@npm:2.6.3, rimraf@npm:~2.6.2":
version: 2.6.3
resolution: "rimraf@npm:2.6.3"
dependencies:
glob: ^7.1.3
bin:
rimraf: ./bin.js
checksum: f1e646f8c567795f2916aef7aadf685b543da6b9a53e482bb04b07472c7eef2b476045ba1e29f401c301c66b630b22b815ab31fdd60c5e1ae6566ff523debf45
languageName: node
linkType: hard
"rimraf@npm:5.0.1, rimraf@npm:^5.0.1":
version: 5.0.1
resolution: "rimraf@npm:5.0.1"
@@ -37850,6 +37444,17 @@ __metadata:
languageName: node
linkType: hard
"rimraf@npm:~2.6.2":
version: 2.6.3
resolution: "rimraf@npm:2.6.3"
dependencies:
glob: ^7.1.3
bin:
rimraf: ./bin.js
checksum: f1e646f8c567795f2916aef7aadf685b543da6b9a53e482bb04b07472c7eef2b476045ba1e29f401c301c66b630b22b815ab31fdd60c5e1ae6566ff523debf45
languageName: node
linkType: hard
"ripemd160@npm:^2.0.0, ripemd160@npm:^2.0.1":
version: 2.0.2
resolution: "ripemd160@npm:2.0.2"
@@ -38245,7 +37850,7 @@ __metadata:
languageName: node
linkType: hard
"rxjs@npm:^6.4.0, rxjs@npm:^6.6.0":
"rxjs@npm:^6.4.0":
version: 6.6.7
resolution: "rxjs@npm:6.6.7"
dependencies:
@@ -38992,17 +38597,6 @@ __metadata:
languageName: node
linkType: hard
"slice-ansi@npm:^2.1.0":
version: 2.1.0
resolution: "slice-ansi@npm:2.1.0"
dependencies:
ansi-styles: ^3.2.0
astral-regex: ^1.0.0
is-fullwidth-code-point: ^2.0.0
checksum: c317b21ec9e3d3968f3d5b548cbfc2eae331f58a03f1352621020799cbe695b3611ee972726f8f32d4ca530065a5ec9c74c97fde711c1f41b4a1585876b2c191
languageName: node
linkType: hard
"slice-ansi@npm:^3.0.0":
version: 3.0.0
resolution: "slice-ansi@npm:3.0.0"
@@ -39677,17 +39271,6 @@ __metadata:
languageName: node
linkType: hard
"string-width@npm:^3.0.0":
version: 3.1.0
resolution: "string-width@npm:3.1.0"
dependencies:
emoji-regex: ^7.0.1
is-fullwidth-code-point: ^2.0.0
strip-ansi: ^5.1.0
checksum: 85fa0d4f106e7999bb68c1c640c76fa69fb8c069dab75b009e29c123914e2d3b532e6cfa4b9d1bd913176fc83dedd7a2d7bf40d21a81a8a1978432cedfb65b91
languageName: node
linkType: hard
"string-width@npm:^5.0.1, string-width@npm:^5.1.2":
version: 5.1.2
resolution: "string-width@npm:5.1.2"
@@ -39817,7 +39400,7 @@ __metadata:
languageName: node
linkType: hard
"strip-ansi@npm:^5.1.0, strip-ansi@npm:^5.2.0":
"strip-ansi@npm:^5.2.0":
version: 5.2.0
resolution: "strip-ansi@npm:5.2.0"
dependencies:
@@ -40246,18 +39829,6 @@ __metadata:
languageName: node
linkType: hard
"table@npm:^5.2.3":
version: 5.4.6
resolution: "table@npm:5.4.6"
dependencies:
ajv: ^6.10.2
lodash: ^4.17.14
slice-ansi: ^2.1.0
string-width: ^3.0.0
checksum: 87ad7b7cc926aa06e0e2a91a0fb4fcb8b365da87969bc5c74b54cae5d518a089245f44bf80f945ec1aa74c405782db15eeb1dd1926315d842cdc9dbb9371672e
languageName: node
linkType: hard
"table@npm:^6.0.9":
version: 6.8.1
resolution: "table@npm:6.8.1"
@@ -42523,7 +42094,7 @@ __metadata:
languageName: node
linkType: hard
"uuid@npm:^3.2.1, uuid@npm:^3.3.2":
"uuid@npm:^3.3.2":
version: 3.4.0
resolution: "uuid@npm:3.4.0"
bin:
@@ -43624,15 +43195,6 @@ __metadata:
languageName: node
linkType: hard
"write@npm:1.0.3":
version: 1.0.3
resolution: "write@npm:1.0.3"
dependencies:
mkdirp: ^0.5.1
checksum: 2ab5472e32ce2d25279a9d22365c5dd5b95fe40497ca43fa329aa61687fca56e36837615a1b6adfc4ca540389383185680a23497d75a1698b1dcbb52741d29a4
languageName: node
linkType: hard
"ws@npm:^6.1.0":
version: 6.2.2
resolution: "ws@npm:6.2.2"