@gorgo/medusa-integration 0.0.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,27 +39,27 @@ const IntegrationIcon = ({
39
39
  }
40
40
  );
41
41
  }
42
- return /* @__PURE__ */ jsxRuntime.jsx(
43
- "div",
42
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: showImage ? /* @__PURE__ */ jsxRuntime.jsx(
43
+ "img",
44
44
  {
45
- className: ui.clx(
46
- "bg-ui-bg-component shadow-borders-base flex shrink-0 items-center justify-center overflow-hidden rounded-md",
47
- dim
48
- ),
49
- children: showImage ? /* @__PURE__ */ jsxRuntime.jsx(
50
- "img",
51
- {
52
- src,
53
- alt,
54
- className: "h-full w-full object-cover",
55
- onError: () => setErrored(true)
56
- }
57
- ) : /* @__PURE__ */ jsxRuntime.jsx(icons.PuzzleSolid, { className: "text-ui-fg-subtle" })
45
+ src,
46
+ alt,
47
+ className: "rounded-lg object-cover border shadow-xs w-12 h-12",
48
+ onError: () => setErrored(true)
58
49
  }
59
- );
50
+ ) : /* @__PURE__ */ jsxRuntime.jsx(icons.PuzzleSolid, { className: "rounded-lg object-cover border shadow-xs w-12 h-12 p-3 text-ui-fg-subtle" }) });
51
+ };
52
+ const CATEGORY_MODULE_PREFIX = {
53
+ payment: "pp",
54
+ fulfillment: "fp",
55
+ tax: "tp"
56
+ };
57
+ const toModuleProviderId = (providerId, category) => {
58
+ const prefix = category ? CATEGORY_MODULE_PREFIX[category] : void 0;
59
+ return prefix ? providerId.replace(/^int_/, `${prefix}_`) : providerId;
60
60
  };
61
61
  const PAGE_SIZE = 20;
62
- const DOCS_URL = "https://docs.gorgojs.com/ru/medusa-plugins/integration-module";
62
+ const DOCS_URL = "https://docs.gorgojs.com/medusa-modules/integration";
63
63
  const IntegrationCell = ({ item }) => {
64
64
  const { t } = reactI18next.useTranslation();
65
65
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
@@ -67,7 +67,7 @@ const IntegrationCell = ({ item }) => {
67
67
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
68
68
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
69
69
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", weight: "plus", children: t(item.display_name) }),
70
- item.provider_id && /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "2xsmall", color: "grey", children: item.provider_id })
70
+ item.provider_id && /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "2xsmall", color: "grey", children: toModuleProviderId(item.provider_id, item.category) })
71
71
  ] }),
72
72
  item.version && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "xsmall", leading: "compact", className: "text-ui-fg-subtle", children: [
73
73
  t("integration.meta.version", { version: item.version }),
@@ -2205,7 +2205,7 @@ const EditPage = () => {
2205
2205
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-1", children: [
2206
2206
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
2207
2207
  /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: t(descriptor.displayName) }),
2208
- provider_id && /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "2xsmall", color: "grey", children: provider_id })
2208
+ provider_id && /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "2xsmall", color: "grey", children: toModuleProviderId(provider_id, descriptor.category) })
2209
2209
  ] }),
2210
2210
  version && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "xsmall", leading: "compact", className: "text-ui-fg-subtle", children: [
2211
2211
  t("integration.meta.version", { version }),
@@ -2300,7 +2300,7 @@ const IntegrationBreadcrumb = ({ params }) => {
2300
2300
  const handle$1 = {
2301
2301
  breadcrumb: ({ params }) => /* @__PURE__ */ jsxRuntime.jsx(IntegrationBreadcrumb, { params })
2302
2302
  };
2303
- const PUBLISH_URL = "https://docs.gorgojs.com/integrations";
2303
+ const PUBLISH_URL = "https://docs.gorgojs.com/medusa-modules/integration";
2304
2304
  const API_URL = "https://gorgojs.com";
2305
2305
  const InstallModal = ({ item, onOpenChange }) => {
2306
2306
  const { t } = reactI18next.useTranslation();
@@ -2312,8 +2312,12 @@ const InstallModal = ({ item, onOpenChange }) => {
2312
2312
  /* @__PURE__ */ jsxRuntime.jsx(ui.Drawer.Body, { className: "flex flex-1 flex-col gap-y-4 overflow-auto", children: item && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2313
2313
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: t("integration.browse.install_addToConfig") }),
2314
2314
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle flex items-center justify-between gap-x-2 rounded-md px-3 py-2", children: [
2315
- /* @__PURE__ */ jsxRuntime.jsx("code", { className: "txt-compact-small text-ui-fg-subtle", children: `npm i ${item.npm}` }),
2316
- /* @__PURE__ */ jsxRuntime.jsx(ui.Copy, { content: `npm i ${item.npm}` })
2315
+ /* @__PURE__ */ jsxRuntime.jsx("code", { className: "txt-compact-small text-ui-fg-subtle", children: `yarn add @gorgo/medusa-integration ${item.npm}@beta` }),
2316
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Copy, { content: `yarn add @gorgo/medusa-integration ${item.npm}@beta` })
2317
+ ] }),
2318
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle flex items-center justify-between gap-x-2 rounded-md px-3 py-2", children: [
2319
+ /* @__PURE__ */ jsxRuntime.jsx("code", { className: "txt-compact-small text-ui-fg-subtle", children: `npm install @gorgo/medusa-integration ${item.npm}@beta` }),
2320
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Copy, { content: `npm install @gorgo/medusa-integration ${item.npm}@beta` })
2317
2321
  ] }),
2318
2322
  item.configSnippet && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-ui-bg-subtle flex flex-col gap-y-2 rounded-md px-3 py-2", children: [
2319
2323
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
@@ -1,4 +1,4 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
1
+ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
2
  import { defineRouteConfig } from "@medusajs/admin-sdk";
3
3
  import { PuzzleSolid, CogSixTooth, Trash, Spinner, EllipsisHorizontal, PencilSquare, Plus } from "@medusajs/icons";
4
4
  import { clx, createDataTableColumnHelper, usePrompt, toast, Text, Badge, useDataTable, Container, Heading, Button, DataTable, Tabs, StatusBadge, Label, Input, Select, Switch, Textarea, Drawer, DropdownMenu, IconButton, Copy } from "@medusajs/ui";
@@ -35,27 +35,27 @@ const IntegrationIcon = ({
35
35
  }
36
36
  );
37
37
  }
38
- return /* @__PURE__ */ jsx(
39
- "div",
38
+ return /* @__PURE__ */ jsx(Fragment, { children: showImage ? /* @__PURE__ */ jsx(
39
+ "img",
40
40
  {
41
- className: clx(
42
- "bg-ui-bg-component shadow-borders-base flex shrink-0 items-center justify-center overflow-hidden rounded-md",
43
- dim
44
- ),
45
- children: showImage ? /* @__PURE__ */ jsx(
46
- "img",
47
- {
48
- src,
49
- alt,
50
- className: "h-full w-full object-cover",
51
- onError: () => setErrored(true)
52
- }
53
- ) : /* @__PURE__ */ jsx(PuzzleSolid, { className: "text-ui-fg-subtle" })
41
+ src,
42
+ alt,
43
+ className: "rounded-lg object-cover border shadow-xs w-12 h-12",
44
+ onError: () => setErrored(true)
54
45
  }
55
- );
46
+ ) : /* @__PURE__ */ jsx(PuzzleSolid, { className: "rounded-lg object-cover border shadow-xs w-12 h-12 p-3 text-ui-fg-subtle" }) });
47
+ };
48
+ const CATEGORY_MODULE_PREFIX = {
49
+ payment: "pp",
50
+ fulfillment: "fp",
51
+ tax: "tp"
52
+ };
53
+ const toModuleProviderId = (providerId, category) => {
54
+ const prefix = category ? CATEGORY_MODULE_PREFIX[category] : void 0;
55
+ return prefix ? providerId.replace(/^int_/, `${prefix}_`) : providerId;
56
56
  };
57
57
  const PAGE_SIZE = 20;
58
- const DOCS_URL = "https://docs.gorgojs.com/ru/medusa-plugins/integration-module";
58
+ const DOCS_URL = "https://docs.gorgojs.com/medusa-modules/integration";
59
59
  const IntegrationCell = ({ item }) => {
60
60
  const { t } = useTranslation();
61
61
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
@@ -63,7 +63,7 @@ const IntegrationCell = ({ item }) => {
63
63
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
64
64
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
65
65
  /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "plus", children: t(item.display_name) }),
66
- item.provider_id && /* @__PURE__ */ jsx(Badge, { size: "2xsmall", color: "grey", children: item.provider_id })
66
+ item.provider_id && /* @__PURE__ */ jsx(Badge, { size: "2xsmall", color: "grey", children: toModuleProviderId(item.provider_id, item.category) })
67
67
  ] }),
68
68
  item.version && /* @__PURE__ */ jsxs(Text, { size: "xsmall", leading: "compact", className: "text-ui-fg-subtle", children: [
69
69
  t("integration.meta.version", { version: item.version }),
@@ -2201,7 +2201,7 @@ const EditPage = () => {
2201
2201
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-1", children: [
2202
2202
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
2203
2203
  /* @__PURE__ */ jsx(Heading, { children: t(descriptor.displayName) }),
2204
- provider_id && /* @__PURE__ */ jsx(Badge, { size: "2xsmall", color: "grey", children: provider_id })
2204
+ provider_id && /* @__PURE__ */ jsx(Badge, { size: "2xsmall", color: "grey", children: toModuleProviderId(provider_id, descriptor.category) })
2205
2205
  ] }),
2206
2206
  version && /* @__PURE__ */ jsxs(Text, { size: "xsmall", leading: "compact", className: "text-ui-fg-subtle", children: [
2207
2207
  t("integration.meta.version", { version }),
@@ -2296,7 +2296,7 @@ const IntegrationBreadcrumb = ({ params }) => {
2296
2296
  const handle$1 = {
2297
2297
  breadcrumb: ({ params }) => /* @__PURE__ */ jsx(IntegrationBreadcrumb, { params })
2298
2298
  };
2299
- const PUBLISH_URL = "https://docs.gorgojs.com/integrations";
2299
+ const PUBLISH_URL = "https://docs.gorgojs.com/medusa-modules/integration";
2300
2300
  const API_URL = "https://gorgojs.com";
2301
2301
  const InstallModal = ({ item, onOpenChange }) => {
2302
2302
  const { t } = useTranslation();
@@ -2308,8 +2308,12 @@ const InstallModal = ({ item, onOpenChange }) => {
2308
2308
  /* @__PURE__ */ jsx(Drawer.Body, { className: "flex flex-1 flex-col gap-y-4 overflow-auto", children: item && /* @__PURE__ */ jsxs(Fragment, { children: [
2309
2309
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: t("integration.browse.install_addToConfig") }),
2310
2310
  /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle flex items-center justify-between gap-x-2 rounded-md px-3 py-2", children: [
2311
- /* @__PURE__ */ jsx("code", { className: "txt-compact-small text-ui-fg-subtle", children: `npm i ${item.npm}` }),
2312
- /* @__PURE__ */ jsx(Copy, { content: `npm i ${item.npm}` })
2311
+ /* @__PURE__ */ jsx("code", { className: "txt-compact-small text-ui-fg-subtle", children: `yarn add @gorgo/medusa-integration ${item.npm}@beta` }),
2312
+ /* @__PURE__ */ jsx(Copy, { content: `yarn add @gorgo/medusa-integration ${item.npm}@beta` })
2313
+ ] }),
2314
+ /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle flex items-center justify-between gap-x-2 rounded-md px-3 py-2", children: [
2315
+ /* @__PURE__ */ jsx("code", { className: "txt-compact-small text-ui-fg-subtle", children: `npm install @gorgo/medusa-integration ${item.npm}@beta` }),
2316
+ /* @__PURE__ */ jsx(Copy, { content: `npm install @gorgo/medusa-integration ${item.npm}@beta` })
2313
2317
  ] }),
2314
2318
  item.configSnippet && /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle flex flex-col gap-y-2 rounded-md px-3 py-2", children: [
2315
2319
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
package/README.md CHANGED
@@ -7,7 +7,7 @@ Integration Module for Medusa
7
7
  <br/>
8
8
  A Medusa module that lets plugins declare their settings and store admins configure them right in the Admin — no <code>medusa-config</code> edits, no redeploys, secrets encrypted at rest.
9
9
  <br/>
10
- <a href="https://github.com/gorgojs/medusa-integrations/blob/HEAD/packages/modules/integration/README.ru.md">Читать README на русском ↗</a>
10
+ <a href="https://github.com/gorgojs/medusa-integrations/blob/HEAD/packages/modules/integration/README-ru.md">Читать README на русском ↗</a>
11
11
  </p>
12
12
 
13
13
  <br/>
@@ -16,8 +16,8 @@ Integration Module for Medusa
16
16
  <a href="https://medusajs.com">
17
17
  <img src="https://img.shields.io/badge/Medusa-^2.17.2-blue?logo=medusa" alt="Medusa" />
18
18
  </a>
19
- <a href="https://medusajs.com">
20
- <img src="https://img.shields.io/badge/Tested_with_Medusa-v2.17.2-green?logo=checkmarx" alt="Medusa" />
19
+ <a href="https://github.com/gorgojs/medusa-integrations/actions/workflows/update-medusa-version.yml">
20
+ <img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/gorgojs/medusa-integrations/main/.badges/medusa-integration.json&logo=checkmarx" alt="Medusa" />
21
21
  </a>
22
22
  </p>
23
23
 
@@ -79,7 +79,3 @@ npm install @gorgo/medusa-integration
79
79
  ## Documentation
80
80
 
81
81
  The complete installation, configuration, and usage guide is available on the [Gorgo documentation website](https://docs.gorgojs.com/integrations/integration).
82
-
83
- ## License
84
-
85
- Licensed under the [MIT License](LICENSE).
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@gorgo/medusa-integration",
3
- "version": "0.0.6",
3
+ "version": "0.1.0",
4
4
  "description": "Integration module for Medusa",
5
5
  "author": {
6
6
  "name": "Gorgo",
7
7
  "url": "https://gorgojs.com"
8
8
  },
9
- "license": "MIT",
10
9
  "files": [
11
10
  ".medusa/server"
12
11
  ],
@@ -47,7 +46,7 @@
47
46
  "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit"
48
47
  },
49
48
  "dependencies": {
50
- "@gorgo/telemetry": "^1.0.0"
49
+ "@gorgo/telemetry": "^1.3.0"
51
50
  },
52
51
  "devDependencies": {
53
52
  "@medusajs/admin-sdk": "^2.17.2",
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License Copyright (c) 2025 Gorgo
2
-
3
- Permission is hereby granted, free
4
- of charge, to any person obtaining a copy of this software and associated
5
- documentation files (the "Software"), to deal in the Software without
6
- restriction, including without limitation the rights to use, copy, modify, merge,
7
- publish, distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to the
9
- following conditions:
10
-
11
- The above copyright notice and this permission notice
12
- (including the next paragraph) shall be included in all copies or substantial
13
- portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16
- ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
18
- EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
package/README.ru.md DELETED
@@ -1,85 +0,0 @@
1
- <h1 align="center">
2
- Модуль интеграций для Medusa
3
- </h1>
4
-
5
- <p align="center">
6
- <a href="https://docs.gorgojs.ru/integrations/integration">Документация</a>
7
- <br/>
8
- Модуль Medusa, который позволяет плагинам описывать свои настройки, а администраторам магазина — конфигурировать их прямо в админке: без правок <code>medusa-config</code> и передеплоя, с шифрованием секретов.
9
- <br/>
10
- <a href="https://github.com/gorgojs/medusa-integrations/blob/HEAD/packages/modules/integration/README.md">Read README in English ↗</a>
11
- </p>
12
-
13
- <br>
14
-
15
- <p align="center">
16
- <a href="https://medusajs.com">
17
- <img src="https://img.shields.io/badge/Medusa-^2.17.2-blue?logo=medusa" alt="Medusa" />
18
- </a>
19
- <a href="https://medusajs.com">
20
- <img src="https://img.shields.io/badge/Протестировано_с_Medusa-v2.17.2-green?logo=checkmarx" alt="Medusa" />
21
- </a>
22
- </p>
23
-
24
- <p align="center">
25
- <a href="https://t.me/gorgojs_chat">
26
- <img src="https://img.shields.io/badge/Telegram-Чат_поддержки-0088cc?logo=telegram&style=social" alt="Чат поддержки в Telegram" />
27
- </a>
28
- </p>
29
-
30
- <p align="center">
31
- <a href="https://t.me/medusajs_chat">
32
- <img src="https://img.shields.io/badge/Telegram-Чат_dev--сообщества_Medusa.js-0088cc?logo=telegram&style=social" alt="Чат сообщества разработчиков Medusa.js в Telegram" />
33
- </a>
34
- </p>
35
-
36
- ## Возможности
37
-
38
- - **No-code конфигурация в админке.** Учётные данные и параметры плагинов задаются в разделе Настройки → Интеграции — без правок `medusa-config`/env и передеплоя.
39
- - **Шифрование секретов на месте (at-rest).** Поля с пометкой `secret` шифруются (AES-256-GCM) и никогда не уходят в браузер.
40
- - **Декларативный дескриптор** (`defineIntegration`) для авторов плагинов: опции, секции, валидация и проверка соединения — в одном месте.
41
- - **Богатые типы опций и валидация:** `string` / `url` / `email` / `uuid` / `number` / `boolean` / `enum` / `json`, правила на уровне опции и меж-секционные, условная видимость, read-only-поля, i18n-подписи и иконка.
42
- - **Несколько экземпляров** одного провайдера (например, несколько аккаунтов).
43
- - **Проверка соединения** прямо из админки.
44
- - **Типизированный резолв в рантайме:** потребитель получает провалидированный расшифрованный конфиг; неполные или выключенные конфигурации не резолвятся — черновик не «протекает» в рантайм.
45
- - **Кастомные виджеты** провайдера в админке.
46
- - **Анонимная телеметрия.**
47
-
48
- ## Что такое модуль интеграций?
49
-
50
- Плагинам нужны настройки — ключи API, режимы, вебхуки. Обычно их держат в `medusa-config`/env: это требует доступа к коду и передеплоя при каждом изменении, а секреты лежат в открытом виде. Модуль переносит настройки в **админку и БД**: администратор магазина заполняет форму, секреты шифруются, а плагин-потребитель читает готовый конфиг в рантайме. Автор плагина при этом лишь **описывает** форму настроек — UI, хранение, шифрование и валидацию берёт на себя модуль.
51
-
52
- ## Подключённые плагины и провайдеры
53
-
54
- | Провайдер | Категория | `resolve` |
55
- |---|---|---|
56
- | [T-Kassa](https://docs.gorgojs.ru/integrations/t-kassa) | `payment` | `@gorgo/medusa-payment-tkassa-v2/providers/integration-tkassa` |
57
-
58
- Любой плагин может поставлять integration-провайдер — см. [документацию](https://docs.gorgojs.ru/integrations/integration).
59
-
60
- ## 💬 Поддержка и сообщество
61
-
62
- Есть вопросы по модулю или идеи? Пишите в чат поддержки в Telegram — [@gorgojs_chat](https://t.me/gorgojs_chat)
63
-
64
- Общайтесь с другими разработчиками Medusa в Telegram — [@medusajs_chat](https://t.me/medusajs_chat)
65
-
66
- ## Требования
67
-
68
- - Medusa v2.17.2 или выше
69
- - Node.js v20 или выше
70
-
71
- ## Установка
72
-
73
- ```bash
74
- yarn add @gorgo/medusa-integration
75
- # или
76
- npm install @gorgo/medusa-integration
77
- ```
78
-
79
- ## Документация
80
-
81
- Полное руководство по установке, настройке и использованию доступно на [сайте документации Gorgo](https://docs.gorgojs.ru/integrations/integration).
82
-
83
- ## Лицензия
84
-
85
- Распространяется на условиях [лицензии MIT](LICENSE).