@deenruv/product-options-fields-plugin 1.0.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.
- package/LICENSE +23 -0
- package/README.md +36 -0
- package/dist/plugin-server/index.d.ts +2 -0
- package/dist/plugin-server/index.js +67 -0
- package/package.json +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# License 1
|
|
2
|
+
|
|
3
|
+
The MIT License
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2025-present Aexol
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
|
|
9
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
12
|
+
|
|
13
|
+
# License 2
|
|
14
|
+
|
|
15
|
+
The MIT License
|
|
16
|
+
|
|
17
|
+
Copyright (c) 2018-2025 Michael Bromley
|
|
18
|
+
|
|
19
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @deenruv/product-options-fields-plugin
|
|
2
|
+
|
|
3
|
+
Plugin that extends ProductOption entities with additional custom fields for enhanced product option presentation. It adds color support, visibility controls, "new" flags, and image associations to product options.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @deenruv/product-options-fields-plugin
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { ProductOptionServerPlugin } from '@deenruv/product-options-fields-plugin';
|
|
15
|
+
|
|
16
|
+
// In your Deenruv server config:
|
|
17
|
+
plugins: [
|
|
18
|
+
ProductOptionServerPlugin,
|
|
19
|
+
]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- `hexColor` (string, public) — Hex color value with a color picker UI component for visual option representation
|
|
25
|
+
- `isNew` (boolean, public) — Flag to mark product options as new
|
|
26
|
+
- `isHidden` (boolean, public) — Flag to hide product options from the storefront
|
|
27
|
+
- `image` (Asset relation, public) — Associated image for visual option representation
|
|
28
|
+
- Multi-language labels (English and Polish)
|
|
29
|
+
|
|
30
|
+
## Admin UI
|
|
31
|
+
|
|
32
|
+
This plugin is server-only and does not add any admin UI extensions. The custom fields are editable through the standard ProductOption detail pages in the admin panel.
|
|
33
|
+
|
|
34
|
+
## API Extensions
|
|
35
|
+
|
|
36
|
+
This plugin does not add any GraphQL API extensions. It registers custom fields on the ProductOption entity, which are automatically exposed through the standard Deenruv GraphQL API.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ProductOptionServerPlugin = void 0;
|
|
10
|
+
const core_1 = require("@deenruv/core");
|
|
11
|
+
const ProductOptionCustomFields = [
|
|
12
|
+
{
|
|
13
|
+
name: "hexColor",
|
|
14
|
+
type: "string",
|
|
15
|
+
label: [
|
|
16
|
+
{ languageCode: core_1.LanguageCode.en, value: "Color" },
|
|
17
|
+
{ languageCode: core_1.LanguageCode.pl, value: "Kolor" },
|
|
18
|
+
],
|
|
19
|
+
public: true,
|
|
20
|
+
defaultValue: "---",
|
|
21
|
+
nullable: true,
|
|
22
|
+
ui: { component: "color-picker-input" },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "isNew",
|
|
26
|
+
type: "boolean",
|
|
27
|
+
label: [
|
|
28
|
+
{ languageCode: core_1.LanguageCode.en, value: "New" },
|
|
29
|
+
{ languageCode: core_1.LanguageCode.pl, value: "Nowy" },
|
|
30
|
+
],
|
|
31
|
+
defaultValue: false,
|
|
32
|
+
public: true,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "isHidden",
|
|
36
|
+
type: "boolean",
|
|
37
|
+
label: [
|
|
38
|
+
{ languageCode: core_1.LanguageCode.en, value: "Hidden" },
|
|
39
|
+
{ languageCode: core_1.LanguageCode.pl, value: "Ukryty" },
|
|
40
|
+
],
|
|
41
|
+
defaultValue: false,
|
|
42
|
+
public: true,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "image",
|
|
46
|
+
type: "relation",
|
|
47
|
+
label: [
|
|
48
|
+
{ languageCode: core_1.LanguageCode.en, value: "Image" },
|
|
49
|
+
{ languageCode: core_1.LanguageCode.pl, value: "Obraz" },
|
|
50
|
+
],
|
|
51
|
+
entity: core_1.Asset,
|
|
52
|
+
public: true,
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
let ProductOptionServerPlugin = class ProductOptionServerPlugin {
|
|
56
|
+
};
|
|
57
|
+
exports.ProductOptionServerPlugin = ProductOptionServerPlugin;
|
|
58
|
+
exports.ProductOptionServerPlugin = ProductOptionServerPlugin = __decorate([
|
|
59
|
+
(0, core_1.DeenruvPlugin)({
|
|
60
|
+
compatibility: "^0.0.20",
|
|
61
|
+
imports: [core_1.PluginCommonModule],
|
|
62
|
+
configuration: (config) => {
|
|
63
|
+
config.customFields.ProductOption.push(...ProductOptionCustomFields);
|
|
64
|
+
return config;
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
], ProductOptionServerPlugin);
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deenruv/product-options-fields-plugin",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"homepage": "https://deenruv.com/",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/**/*"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/plugin-server/index.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/plugin-server/index.js",
|
|
12
|
+
"./plugin-server": "./dist/plugin-server/index.js"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@deenruv/react-ui-devkit": "^1.0.0",
|
|
16
|
+
"@deenruv/common": "^1.0.0"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@deenruv/core": "^0.1.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"rimraf": "^5.0.10",
|
|
23
|
+
"typescript": "5.3.3",
|
|
24
|
+
"@deenruv/core": "^1.0.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "rimraf dist && tsc --build",
|
|
28
|
+
"watch": "tsc --build --watch",
|
|
29
|
+
"lint": "eslint .",
|
|
30
|
+
"lint:fix": "eslint --fix .",
|
|
31
|
+
"zeus": "zeus http://localhost:3000/admin-api ./src/plugin-server && zeus http://localhost:3000/admin-api ./src/plugin-ui"
|
|
32
|
+
}
|
|
33
|
+
}
|