@gorgo/medusa-integration 0.0.7 → 0.1.1

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.
@@ -47,10 +47,19 @@ const IntegrationIcon = ({
47
47
  className: "rounded-lg object-cover border shadow-xs w-12 h-12",
48
48
  onError: () => setErrored(true)
49
49
  }
50
- ) : /* @__PURE__ */ jsxRuntime.jsx(icons.PuzzleSolid, { className: "text-ui-fg-subtle" }) });
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;
51
60
  };
52
61
  const PAGE_SIZE = 20;
53
- const DOCS_URL = "https://docs.gorgojs.com/ru/medusa-plugins/integration-module";
62
+ const DOCS_URL = "https://docs.gorgojs.com/medusa-modules/integration";
54
63
  const IntegrationCell = ({ item }) => {
55
64
  const { t } = reactI18next.useTranslation();
56
65
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
@@ -58,7 +67,7 @@ const IntegrationCell = ({ item }) => {
58
67
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
59
68
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
60
69
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", leading: "compact", weight: "plus", children: t(item.display_name) }),
61
- 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) })
62
71
  ] }),
63
72
  item.version && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "xsmall", leading: "compact", className: "text-ui-fg-subtle", children: [
64
73
  t("integration.meta.version", { version: item.version }),
@@ -2196,7 +2205,7 @@ const EditPage = () => {
2196
2205
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-1", children: [
2197
2206
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
2198
2207
  /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: t(descriptor.displayName) }),
2199
- 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) })
2200
2209
  ] }),
2201
2210
  version && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "xsmall", leading: "compact", className: "text-ui-fg-subtle", children: [
2202
2211
  t("integration.meta.version", { version }),
@@ -2291,7 +2300,7 @@ const IntegrationBreadcrumb = ({ params }) => {
2291
2300
  const handle$1 = {
2292
2301
  breadcrumb: ({ params }) => /* @__PURE__ */ jsxRuntime.jsx(IntegrationBreadcrumb, { params })
2293
2302
  };
2294
- const PUBLISH_URL = "https://docs.gorgojs.com/integrations";
2303
+ const PUBLISH_URL = "https://docs.gorgojs.com/medusa-modules/integration";
2295
2304
  const API_URL = "https://gorgojs.com";
2296
2305
  const InstallModal = ({ item, onOpenChange }) => {
2297
2306
  const { t } = reactI18next.useTranslation();
@@ -2303,8 +2312,12 @@ const InstallModal = ({ item, onOpenChange }) => {
2303
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: [
2304
2313
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: t("integration.browse.install_addToConfig") }),
2305
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: [
2306
- /* @__PURE__ */ jsxRuntime.jsx("code", { className: "txt-compact-small text-ui-fg-subtle", children: `npm i ${item.npm}` }),
2307
- /* @__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` })
2308
2321
  ] }),
2309
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: [
2310
2323
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
@@ -43,10 +43,19 @@ const IntegrationIcon = ({
43
43
  className: "rounded-lg object-cover border shadow-xs w-12 h-12",
44
44
  onError: () => setErrored(true)
45
45
  }
46
- ) : /* @__PURE__ */ jsx(PuzzleSolid, { className: "text-ui-fg-subtle" }) });
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;
47
56
  };
48
57
  const PAGE_SIZE = 20;
49
- const DOCS_URL = "https://docs.gorgojs.com/ru/medusa-plugins/integration-module";
58
+ const DOCS_URL = "https://docs.gorgojs.com/medusa-modules/integration";
50
59
  const IntegrationCell = ({ item }) => {
51
60
  const { t } = useTranslation();
52
61
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
@@ -54,7 +63,7 @@ const IntegrationCell = ({ item }) => {
54
63
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
55
64
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
56
65
  /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "plus", children: t(item.display_name) }),
57
- 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) })
58
67
  ] }),
59
68
  item.version && /* @__PURE__ */ jsxs(Text, { size: "xsmall", leading: "compact", className: "text-ui-fg-subtle", children: [
60
69
  t("integration.meta.version", { version: item.version }),
@@ -2192,7 +2201,7 @@ const EditPage = () => {
2192
2201
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-1", children: [
2193
2202
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
2194
2203
  /* @__PURE__ */ jsx(Heading, { children: t(descriptor.displayName) }),
2195
- 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) })
2196
2205
  ] }),
2197
2206
  version && /* @__PURE__ */ jsxs(Text, { size: "xsmall", leading: "compact", className: "text-ui-fg-subtle", children: [
2198
2207
  t("integration.meta.version", { version }),
@@ -2287,7 +2296,7 @@ const IntegrationBreadcrumb = ({ params }) => {
2287
2296
  const handle$1 = {
2288
2297
  breadcrumb: ({ params }) => /* @__PURE__ */ jsx(IntegrationBreadcrumb, { params })
2289
2298
  };
2290
- const PUBLISH_URL = "https://docs.gorgojs.com/integrations";
2299
+ const PUBLISH_URL = "https://docs.gorgojs.com/medusa-modules/integration";
2291
2300
  const API_URL = "https://gorgojs.com";
2292
2301
  const InstallModal = ({ item, onOpenChange }) => {
2293
2302
  const { t } = useTranslation();
@@ -2299,8 +2308,12 @@ const InstallModal = ({ item, onOpenChange }) => {
2299
2308
  /* @__PURE__ */ jsx(Drawer.Body, { className: "flex flex-1 flex-col gap-y-4 overflow-auto", children: item && /* @__PURE__ */ jsxs(Fragment, { children: [
2300
2309
  /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: t("integration.browse.install_addToConfig") }),
2301
2310
  /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle flex items-center justify-between gap-x-2 rounded-md px-3 py-2", children: [
2302
- /* @__PURE__ */ jsx("code", { className: "txt-compact-small text-ui-fg-subtle", children: `npm i ${item.npm}` }),
2303
- /* @__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` })
2304
2317
  ] }),
2305
2318
  item.configSnippet && /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle flex flex-col gap-y-2 rounded-md px-3 py-2", children: [
2306
2319
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
package/README.md CHANGED
@@ -5,9 +5,9 @@ Integration Module for Medusa
5
5
  <p align="center">
6
6
  <a href="https://docs.gorgojs.com/integrations/integration">Documentation</a>
7
7
  <br/>
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.
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.
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gorgo/medusa-integration",
3
- "version": "0.0.7",
3
+ "version": "0.1.1",
4
4
  "description": "Integration module for Medusa",
5
5
  "author": {
6
6
  "name": "Gorgo",
@@ -46,7 +46,7 @@
46
46
  "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit"
47
47
  },
48
48
  "dependencies": {
49
- "@gorgo/telemetry": "^1.0.0"
49
+ "@gorgo/telemetry": "^1.3.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@medusajs/admin-sdk": "^2.17.2",
package/README.ru.md DELETED
@@ -1,81 +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).