@gorgo/medusa-integration 0.0.3 → 0.0.4
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.
- package/.medusa/server/src/admin/index.js +35 -21
- package/.medusa/server/src/admin/index.mjs +35 -21
- package/.medusa/server/src/api/admin/integrations/__tests__/helpers.unit.spec.d.ts +1 -0
- package/.medusa/server/src/api/admin/integrations/__tests__/helpers.unit.spec.js +30 -0
- package/.medusa/server/src/api/admin/integrations/_helpers.d.ts +3 -3
- package/.medusa/server/src/api/admin/integrations/_helpers.js +8 -8
- package/.medusa/server/src/index.d.ts +1 -1
- package/.medusa/server/src/jobs/__tests__/test-integration-connections.unit.spec.d.ts +1 -0
- package/.medusa/server/src/jobs/__tests__/test-integration-connections.unit.spec.js +27 -0
- package/.medusa/server/src/jobs/test-integration-connections.d.ts +7 -0
- package/.medusa/server/src/jobs/test-integration-connections.js +19 -6
- package/.medusa/server/src/modules/integration/descriptor/__tests__/build-zod.unit.spec.js +43 -1
- package/.medusa/server/src/modules/integration/descriptor/__tests__/define.unit.spec.js +3 -3
- package/.medusa/server/src/modules/integration/descriptor/__tests__/introspect.unit.spec.js +3 -3
- package/.medusa/server/src/modules/integration/descriptor/__tests__/section-write.unit.spec.d.ts +1 -0
- package/.medusa/server/src/modules/integration/descriptor/__tests__/section-write.unit.spec.js +64 -0
- package/.medusa/server/src/modules/integration/descriptor/__tests__/validate.unit.spec.js +28 -2
- package/.medusa/server/src/modules/integration/descriptor/build-zod.js +7 -1
- package/.medusa/server/src/modules/integration/descriptor/define.d.ts +5 -5
- package/.medusa/server/src/modules/integration/descriptor/define.js +1 -1
- package/.medusa/server/src/modules/integration/descriptor/introspect.js +2 -2
- package/.medusa/server/src/modules/integration/descriptor/meta.d.ts +1 -1
- package/.medusa/server/src/modules/integration/descriptor/section-write.d.ts +10 -0
- package/.medusa/server/src/modules/integration/descriptor/section-write.js +24 -0
- package/.medusa/server/src/modules/integration/loaders/load-providers.js +2 -2
- package/.medusa/server/src/modules/integration/migrations/Migration20260720130920.d.ts +5 -0
- package/.medusa/server/src/modules/integration/migrations/Migration20260720130920.js +18 -0
- package/.medusa/server/src/modules/integration/models/integration.d.ts +1 -1
- package/.medusa/server/src/modules/integration/models/integration.js +3 -3
- package/.medusa/server/src/modules/integration/services/__tests__/integration-module.unit.spec.d.ts +1 -0
- package/.medusa/server/src/modules/integration/services/__tests__/integration-module.unit.spec.js +240 -0
- package/.medusa/server/src/modules/integration/services/__tests__/integration-provider.unit.spec.js +2 -2
- package/.medusa/server/src/modules/integration/services/integration-module.d.ts +3 -3
- package/.medusa/server/src/modules/integration/services/integration-module.js +3 -3
- package/.medusa/server/src/modules/integration/utils/integration.d.ts +3 -3
- package/.medusa/server/src/modules/integration/utils/integration.js +4 -4
- package/.medusa/server/src/subscribers/__tests__/invalidate-options-cache.unit.spec.d.ts +1 -0
- package/.medusa/server/src/subscribers/__tests__/invalidate-options-cache.unit.spec.js +53 -0
- package/.medusa/server/src/types/http/integration/admin/entities.d.ts +5 -4
- package/.medusa/server/src/types/integration/common.d.ts +3 -3
- package/.medusa/server/src/workflows/integration/steps/apply-integration-section.d.ts +1 -1
- package/.medusa/server/src/workflows/integration/steps/apply-integration-section.js +13 -20
- package/.medusa/server/src/workflows/integration/steps/set-integration-enabled.d.ts +1 -1
- package/.medusa/server/src/workflows/integration/steps/upsert-integration-record.d.ts +2 -2
- package/.medusa/server/src/workflows/integration/workflows/set-integration-enabled.d.ts +1 -1
- package/.medusa/server/src/workflows/integration/workflows/upsert-integration.js +2 -2
- package/README.md +41 -2
- package/README.ru.md +85 -0
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ const utils_1 = require("@medusajs/framework/utils");
|
|
|
6
6
|
const integration_1 = require("../../../modules/integration");
|
|
7
7
|
const introspect_1 = require("../../../modules/integration/descriptor/introspect");
|
|
8
8
|
const validate_1 = require("../../../modules/integration/descriptor/validate");
|
|
9
|
+
const section_write_1 = require("../../../modules/integration/descriptor/section-write");
|
|
9
10
|
/**
|
|
10
11
|
* Resolve which option ids this request may write, merge them over the stored config, run
|
|
11
12
|
* per-option validation, and encrypt secret options inline.
|
|
@@ -23,35 +24,27 @@ exports.applyIntegrationSectionStep = (0, workflows_sdk_1.createStep)("apply-int
|
|
|
23
24
|
if (!descriptor) {
|
|
24
25
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.NOT_FOUND, `No integration provider registered for "${input.provider_id}"`);
|
|
25
26
|
}
|
|
26
|
-
// Resolve
|
|
27
|
-
|
|
27
|
+
// Resolve which option ids this request is *scoped* to write: a built-in section may write
|
|
28
|
+
// exactly its own options; a widget (no section_id) may write the declared keys it submits.
|
|
29
|
+
let scopeIds;
|
|
28
30
|
if (input.section_id != null) {
|
|
29
31
|
const section = descriptor.sections.find((s) => s.id === input.section_id);
|
|
30
32
|
if (!section) {
|
|
31
33
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `Unknown section "${input.section_id}"`);
|
|
32
34
|
}
|
|
33
|
-
|
|
35
|
+
scopeIds = [...section.options];
|
|
34
36
|
}
|
|
35
37
|
else {
|
|
36
|
-
|
|
38
|
+
scopeIds = Object.keys(input.values).filter((k) => Object.prototype.hasOwnProperty.call(descriptor.options, k));
|
|
37
39
|
}
|
|
38
|
-
//
|
|
40
|
+
// Persist only the ids actually submitted (a partial section save is a draft — unsubmitted
|
|
41
|
+
// fields are left as stored, never wiped; blank secrets keep their existing value).
|
|
39
42
|
const current = await service.getStoredValues(input.provider_id);
|
|
40
43
|
const secretKeys = new Set((0, introspect_1.secretFieldNames)(descriptor));
|
|
41
|
-
const submitted =
|
|
42
|
-
|
|
43
|
-
let v = input.values[id];
|
|
44
|
-
if (secretKeys.has(id) && (v == null || v === "")) {
|
|
45
|
-
if (id in current)
|
|
46
|
-
v = current[id];
|
|
47
|
-
else
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
submitted[id] = v;
|
|
51
|
-
}
|
|
52
|
-
// Validate submitted ids against the merged config (per-option cross-field rules see siblings).
|
|
44
|
+
const { writeIds, submitted } = (0, section_write_1.selectWritableValues)(scopeIds, input.values, secretKeys);
|
|
45
|
+
// Validate exactly the submitted ids against the merged config (cross-field rules see siblings).
|
|
53
46
|
const merged = { ...current, ...submitted };
|
|
54
|
-
const validated = (0, validate_1.validateOptions)(descriptor,
|
|
47
|
+
const validated = (0, validate_1.validateOptions)(descriptor, writeIds, merged);
|
|
55
48
|
if (!validated.success) {
|
|
56
49
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, validated.issues.map((i) => `${i.path}: ${i.message}`).join("; "));
|
|
57
50
|
}
|
|
@@ -59,8 +52,8 @@ exports.applyIntegrationSectionStep = (0, workflows_sdk_1.createStep)("apply-int
|
|
|
59
52
|
const full = { ...current, ...validated.data };
|
|
60
53
|
const options = service.encryptForStorage(descriptor, full);
|
|
61
54
|
return new workflows_sdk_1.StepResponse({
|
|
62
|
-
|
|
55
|
+
category: descriptor.category,
|
|
63
56
|
options,
|
|
64
57
|
});
|
|
65
58
|
});
|
|
66
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
59
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwbHktaW50ZWdyYXRpb24tc2VjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy93b3JrZmxvd3MvaW50ZWdyYXRpb24vc3RlcHMvYXBwbHktaW50ZWdyYXRpb24tc2VjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxxRUFBNEU7QUFDNUUscURBQXVEO0FBQ3ZELDhEQUFpRTtBQUVqRSxtRkFBcUY7QUFDckYsK0VBQWtGO0FBQ2xGLHlGQUE0RjtBQVM1Rjs7Ozs7Ozs7OztHQVVHO0FBQ1UsUUFBQSwyQkFBMkIsR0FBRyxJQUFBLDBC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FFLENBQUMsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQ2xFLENBQUE7SUFDSCxDQUFDO0lBRUQsbUdBQW1HO0lBQ25HLE1BQU0sSUFBSSxHQUFHLEVBQUUsR0FBRyxPQUFPLEVBQUUsR0FBRyxTQUFTLENBQUMsSUFBSSxFQUFFLENBQUE7SUFDOUMsTUFBTSxPQUFPLEdBQUcsT0FBTyxDQUFDLGlCQUFpQixDQUFDLFVBQVUsRUFBRSxJQUFJLENBQUMsQ0FBQTtJQUMzRCxPQUFPLElBQUksNEJBQVksQ0FBQztRQUN0QixRQUFRLEVBQUUsVUFBVSxDQUFDLFFBQVE7UUFDN0IsT0FBTztLQUNSLENBQUMsQ0FBQTtBQUNKLENBQUMsQ0FDRixDQUFBIn0=
|
|
@@ -4,7 +4,7 @@ export type SetIntegrationEnabledStepInput = {
|
|
|
4
4
|
};
|
|
5
5
|
export declare const setIntegrationEnabledStep: import("@medusajs/framework/workflows-sdk").StepFunction<SetIntegrationEnabledStepInput, {
|
|
6
6
|
id: string;
|
|
7
|
-
|
|
7
|
+
category: "payment" | "fulfillment" | "marketplace" | "crm" | "erp" | "pim" | "notification" | "feed" | "tax" | "other";
|
|
8
8
|
provider_id: string;
|
|
9
9
|
title: string | null;
|
|
10
10
|
options: Record<string, unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CategoryKind } from "../../../modules/integration/descriptor/define";
|
|
2
2
|
export type UpsertIntegrationRecordStepInput = {
|
|
3
3
|
provider_id: string;
|
|
4
|
-
|
|
4
|
+
category: CategoryKind;
|
|
5
5
|
options: Record<string, unknown>;
|
|
6
6
|
title?: string | null;
|
|
7
7
|
};
|
|
@@ -5,7 +5,7 @@ export type SetIntegrationEnabledWorkflowInput = {
|
|
|
5
5
|
export declare const setIntegrationEnabledWorkflowId = "set-integration-enabled";
|
|
6
6
|
export declare const setIntegrationEnabledWorkflow: import("@medusajs/framework/workflows-sdk").ReturnWorkflow<SetIntegrationEnabledWorkflowInput, {
|
|
7
7
|
id: string;
|
|
8
|
-
|
|
8
|
+
category: "payment" | "fulfillment" | "marketplace" | "crm" | "erp" | "pim" | "notification" | "feed" | "tax" | "other";
|
|
9
9
|
provider_id: string;
|
|
10
10
|
title: string | null;
|
|
11
11
|
options: Record<string, unknown>;
|
|
@@ -13,7 +13,7 @@ exports.upsertIntegrationWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.
|
|
|
13
13
|
const recordInput = (0, workflows_sdk_1.transform)({ input, prepared }, (data) => ({
|
|
14
14
|
provider_id: data.input.provider_id,
|
|
15
15
|
title: data.input.title ?? null,
|
|
16
|
-
|
|
16
|
+
category: data.prepared.category,
|
|
17
17
|
options: data.prepared.options,
|
|
18
18
|
}));
|
|
19
19
|
const record = (0, steps_1.upsertIntegrationRecordStep)(recordInput);
|
|
@@ -26,4 +26,4 @@ exports.upsertIntegrationWorkflow = (0, workflows_sdk_1.createWorkflow)(exports.
|
|
|
26
26
|
})));
|
|
27
27
|
return new workflows_sdk_1.WorkflowResponse(record);
|
|
28
28
|
});
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBzZXJ0LWludGVncmF0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL3dvcmtmbG93cy9pbnRlZ3JhdGlvbi93b3JrZmxvd3MvdXBzZXJ0LWludGVncmF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLHFFQUErRjtBQUMvRixvQ0FJaUI7QUFTSixRQUFBLDJCQUEyQixHQUFHLG9CQUFvQixDQUFBO0FBRWxELFFBQUEseUJBQXlCLEdBQUcsSUFBQSw4QkFBYyxFQUNyRCxtQ0FBMkIsRUFDM0IsVUFBVSxLQUFxQztJQUM3QyxNQUFNLF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|
@@ -2,17 +2,28 @@
|
|
|
2
2
|
Integration Module for Medusa
|
|
3
3
|
</h1>
|
|
4
4
|
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://docs.gorgojs.com/medusa-plugins/integration">Documentation</a>
|
|
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.
|
|
9
|
+
<br/>
|
|
10
|
+
<a href="https://github.com/gorgojs/medusa-plugins/blob/HEAD/packages/medusa-integration/README.ru.md">Читать README на русском ↗</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
5
13
|
<br/>
|
|
6
14
|
|
|
7
15
|
<p align="center">
|
|
8
16
|
<a href="https://medusajs.com">
|
|
9
17
|
<img src="https://img.shields.io/badge/Medusa-^2.17.2-blue?logo=medusa" alt="Medusa" />
|
|
10
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" />
|
|
21
|
+
</a>
|
|
11
22
|
</p>
|
|
12
23
|
|
|
13
24
|
<p align="center">
|
|
14
25
|
<a href="https://t.me/gorgojs_chat">
|
|
15
|
-
<img src="https://img.shields.io/badge/Telegram-Support_Chat-0088cc?logo=telegram&style=social" alt="
|
|
26
|
+
<img src="https://img.shields.io/badge/Telegram-Support_Chat-0088cc?logo=telegram&style=social" alt="Support Chat on Telegram" />
|
|
16
27
|
</a>
|
|
17
28
|
</p>
|
|
18
29
|
|
|
@@ -22,9 +33,33 @@ Integration Module for Medusa
|
|
|
22
33
|
</a>
|
|
23
34
|
</p>
|
|
24
35
|
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- **No-code configuration in the Admin.** Plugin credentials and settings are managed under Settings → Integrations — no `medusa-config`/env edits and no redeploys.
|
|
39
|
+
- **Encrypted secrets at rest.** Fields marked `secret` are encrypted (AES-256-GCM) and never reach the browser.
|
|
40
|
+
- **Declarative descriptor** (`defineIntegration`) for plugin authors: options, sections, validation, and a connection test in one place.
|
|
41
|
+
- **Rich option types & validation:** `string` / `url` / `email` / `uuid` / `number` / `boolean` / `enum` / `json`, per-option and cross-section rules, conditional visibility, read-only fields, i18n labels, and an icon.
|
|
42
|
+
- **Multiple instances** of the same provider (e.g. several accounts).
|
|
43
|
+
- **Connection test** from the Admin.
|
|
44
|
+
- **Typed runtime resolve:** consumers read a validated, decrypted config; incomplete or disabled configs never resolve, so drafts don't leak into runtime.
|
|
45
|
+
- **Custom admin widgets** per provider.
|
|
46
|
+
- **Anonymous telemetry.**
|
|
47
|
+
|
|
48
|
+
## What is the integration module?
|
|
49
|
+
|
|
50
|
+
Plugins need settings — API keys, modes, webhooks. Usually these live in `medusa-config`/env, which requires code access and a redeploy for every change, with secrets kept in plain text. This module moves settings into the **Admin and the database**: a store admin fills in a form, secrets are encrypted, and the consuming plugin reads the ready config at runtime. Plugin authors only **describe** the settings form — the module handles the UI, storage, encryption, and validation.
|
|
51
|
+
|
|
52
|
+
## Integrated plugins & providers
|
|
53
|
+
|
|
54
|
+
| Provider | Category | `resolve` |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| [T-Kassa](https://docs.gorgojs.com/medusa-plugins/t-kassa) | `payment` | `@gorgo/medusa-payment-tkassa-v2/providers/integration-tkassa` |
|
|
57
|
+
|
|
58
|
+
Any plugin can ship an integration provider — see the [documentation](https://docs.gorgojs.com/medusa-plugins/integration).
|
|
59
|
+
|
|
25
60
|
## 💬 Support & Community
|
|
26
61
|
|
|
27
|
-
Got questions or ideas about the
|
|
62
|
+
Got questions or ideas about the module? Join the Telegram support chat — [@gorgojs_chat](https://t.me/gorgojs_chat)
|
|
28
63
|
|
|
29
64
|
Connect with other Medusa developers on Telegram — [@medusajs_chat](https://t.me/medusajs_chat)
|
|
30
65
|
|
|
@@ -41,6 +76,10 @@ yarn add @gorgo/medusa-integration
|
|
|
41
76
|
npm install @gorgo/medusa-integration
|
|
42
77
|
```
|
|
43
78
|
|
|
79
|
+
## Documentation
|
|
80
|
+
|
|
81
|
+
The complete installation, configuration, and usage guide is available on the [Gorgo documentation website](https://docs.gorgojs.com/medusa-plugins/integration).
|
|
82
|
+
|
|
44
83
|
## License
|
|
45
84
|
|
|
46
85
|
Licensed under the [MIT License](LICENSE).
|
package/README.ru.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
Модуль интеграций для Medusa
|
|
3
|
+
</h1>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://docs.gorgojs.ru/medusa-plugins/integration">Документация</a>
|
|
7
|
+
<br/>
|
|
8
|
+
Модуль Medusa, который позволяет плагинам описывать свои настройки, а администраторам магазина — конфигурировать их прямо в админке: без правок <code>medusa-config</code> и передеплоя, с шифрованием секретов.
|
|
9
|
+
<br/>
|
|
10
|
+
<a href="https://github.com/gorgojs/medusa-plugins/blob/HEAD/packages/medusa-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/medusa-plugins/t-kassa) | `payment` | `@gorgo/medusa-payment-tkassa-v2/providers/integration-tkassa` |
|
|
57
|
+
|
|
58
|
+
Любой плагин может поставлять integration-провайдер — см. [документацию](https://docs.gorgojs.ru/medusa-plugins/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/medusa-plugins/integration).
|
|
82
|
+
|
|
83
|
+
## Лицензия
|
|
84
|
+
|
|
85
|
+
Распространяется на условиях [лицензии MIT](LICENSE).
|