startbit-timezone-select 0.0.0 → 2.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.
- package/README.md +85 -3
- package/dist/admin/App-ApBjpMql.mjs +23 -0
- package/dist/admin/App-ApBjpMql.mjs.map +1 -0
- package/dist/admin/App-BlTU6Lmm.js +23 -0
- package/dist/admin/App-BlTU6Lmm.js.map +1 -0
- package/dist/admin/TimeZone-D3r22Lcf.js +66 -0
- package/dist/admin/TimeZone-D3r22Lcf.js.map +1 -0
- package/dist/admin/TimeZone-piXcAg6n.mjs +66 -0
- package/dist/admin/TimeZone-piXcAg6n.mjs.map +1 -0
- package/dist/admin/en-B4KWt_jN.js +4 -0
- package/dist/admin/en-B4KWt_jN.js.map +1 -0
- package/dist/admin/en-Byx4XI2L.mjs +4 -0
- package/dist/admin/en-Byx4XI2L.mjs.map +1 -0
- package/dist/admin/index-B1af4dDJ.mjs +106 -0
- package/dist/admin/index-B1af4dDJ.mjs.map +1 -0
- package/dist/admin/index-BEIAVxBW.js +105 -0
- package/dist/admin/index-BEIAVxBW.js.map +1 -0
- package/dist/admin/index.js +4 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/index.mjs +4 -0
- package/dist/admin/index.mjs.map +1 -0
- package/dist/server/index.js +76 -0
- package/dist/server/index.mjs +76 -0
- package/package.json +58 -31
- package/start-admin.png +0 -0
- package/timezone-custom-select-field.png +0 -0
- package/timezone-select.png +0 -0
- package/admin/src/components/CustomField.css +0 -110
- package/admin/src/components/Initializer/index.js +0 -26
- package/admin/src/components/PluginIcon/index.js +0 -12
- package/admin/src/components/PluginIcons.js +0 -12
- package/admin/src/components/TimeZone.js +0 -70
- package/admin/src/index.js +0 -84
- package/admin/src/pages/App/index.js +0 -25
- package/admin/src/pages/HomePage/index.js +0 -20
- package/admin/src/pluginId.js +0 -5
- package/admin/src/translations/en.json +0 -1
- package/admin/src/translations/fr.json +0 -1
- package/admin/src/utils/getTrad.js +0 -5
- package/server/bootstrap.js +0 -5
- package/server/config/index.js +0 -6
- package/server/content-types/index.js +0 -3
- package/server/controllers/index.js +0 -7
- package/server/controllers/my-controller.js +0 -10
- package/server/destroy.js +0 -5
- package/server/index.js +0 -25
- package/server/middlewares/index.js +0 -3
- package/server/policies/index.js +0 -3
- package/server/register.js +0 -10
- package/server/routes/index.js +0 -10
- package/server/services/index.js +0 -7
- package/server/services/my-service.js +0 -7
- package/strapi-admin.js +0 -3
- package/strapi-server.js +0 -3
package/README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
|
1
|
-
# Strapi plugin
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# Strapi plugin Startbit Timezone Select
|
|
2
|
+
|
|
3
|
+
The official plugin to provide custom select field into admin
|
|
4
|
+
|
|
5
|
+
Plugin Name: Startbit Timezone Select
|
|
6
|
+
|
|
7
|
+
Description: Startbit Timezone Select is a Strapi plugin that adds a custom Timezone field, allowing users to select and display time zones listing in UTC format.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
1. Display timezones list of all countries.
|
|
11
|
+
2. List the timezones in the UTC format that is useful to identify.
|
|
12
|
+
3. Used the strapi SingleSelect component.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
To install this plugin, you need to add an NPM dependency to your Strapi application.
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
# Using Yarn
|
|
19
|
+
yarn add startbit-timezone-select
|
|
20
|
+
# Or using NPM
|
|
21
|
+
npm install startbit-timezone-select
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Dependency
|
|
25
|
+
Run the below command into terminal to install the pear package of plugin on root
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm install react-timezone-select react-select
|
|
29
|
+
# or
|
|
30
|
+
yarn add react-timezone-select react-select
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Configuration
|
|
34
|
+
Go to `./config/plugins.js` and enable the plugin
|
|
35
|
+
|
|
36
|
+
**Example**
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
module.exports = () => ({
|
|
40
|
+
'startbit-timezone-select': {
|
|
41
|
+
enabled: true,
|
|
42
|
+
resolve: './src/plugins/startbit-timezone-select'
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Then, you'll need to build your admin panel:
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
# Using Yarn
|
|
51
|
+
yarn build
|
|
52
|
+
|
|
53
|
+
# Or using NPM
|
|
54
|
+
npm run build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Run command
|
|
58
|
+
Run the below command to start your strapi project on local system and go to admin by typing /admin into your home URL.
|
|
59
|
+

|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## Disabling altogether
|
|
63
|
+
Like every other plugin, you can also disable this plugin in the plugins configuration file.
|
|
64
|
+
Go to ./config/plugins.js and switch enabled to false
|
|
65
|
+
|
|
66
|
+
**Example**
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
module.exports = () => ({
|
|
70
|
+
'startbit-timezone-select': {
|
|
71
|
+
enabled: false,
|
|
72
|
+
resolve: './src/plugins/startbit-timezone-select'
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
After installation you will find the timezone-select at the custom field section of the content-type builder.
|
|
80
|
+

|
|
81
|
+
|
|
82
|
+
Now you can select any country from the list. The Alpha-2 code of the selected timezone is stored in the database.
|
|
83
|
+
|
|
84
|
+

|
|
85
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Page } from "@strapi/strapi/admin";
|
|
3
|
+
import { Routes, Route } from "react-router-dom";
|
|
4
|
+
import { Main } from "@strapi/design-system";
|
|
5
|
+
import { useIntl } from "react-intl";
|
|
6
|
+
import { P as PLUGIN_ID } from "./index-B1af4dDJ.mjs";
|
|
7
|
+
const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
|
|
8
|
+
const HomePage = () => {
|
|
9
|
+
const { formatMessage } = useIntl();
|
|
10
|
+
return /* @__PURE__ */ jsx(Main, { children: /* @__PURE__ */ jsxs("h1", { children: [
|
|
11
|
+
"Welcome to ",
|
|
12
|
+
formatMessage({ id: getTranslation("plugin.name") })
|
|
13
|
+
] }) });
|
|
14
|
+
};
|
|
15
|
+
const App = () => {
|
|
16
|
+
return /* @__PURE__ */ jsxs(Routes, { children: [
|
|
17
|
+
/* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage, {}) }),
|
|
18
|
+
/* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
|
|
19
|
+
] });
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
App
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App-ApBjpMql.mjs","sources":["../../admin/src/utils/getTranslation.js","../../admin/src/pages/HomePage.jsx","../../admin/src/pages/App.jsx"],"sourcesContent":["import { PLUGIN_ID } from \"../pluginId\";\n\nconst getTranslation = (id) => `${PLUGIN_ID}.${id}`;\n\nexport { getTranslation };","import { Main } from \"@strapi/design-system\";\nimport { useIntl } from \"react-intl\";\n\nimport { getTranslation } from \"../utils/getTranslation\";\n\nconst HomePage = () => {\n const { formatMessage } = useIntl();\n\n return (\n <Main>\n <h1>Welcome to {formatMessage({ id: getTranslation(\"plugin.name\") })}</h1>\n </Main>\n );\n};\n\nexport { HomePage };","import { Page } from \"@strapi/strapi/admin\";\nimport { Routes, Route } from \"react-router-dom\";\n\nimport { HomePage } from \"./HomePage\";\n\nconst App = () => {\n return (\n <Routes>\n <Route index element={<HomePage />} />\n <Route path=\"*\" element={<Page.Error />} />\n </Routes>\n );\n};\n\nexport { App };"],"names":[],"mappings":";;;;;;AAEA,MAAM,iBAAiB,CAAC,OAAO,GAAG,SAAS,IAAI,EAAE;ACGjD,MAAM,WAAW,MAAM;AACrB,QAAM,EAAE,cAAA,IAAkB,QAAA;AAE1B,SACE,oBAAC,MAAA,EACC,UAAA,qBAAC,MAAA,EAAG,UAAA;AAAA,IAAA;AAAA,IAAY,cAAc,EAAE,IAAI,eAAe,aAAa,GAAG;AAAA,EAAA,EAAA,CAAE,EAAA,CACvE;AAEJ;ACRA,MAAM,MAAM,MAAM;AAChB,8BACG,QAAA,EACC,UAAA;AAAA,IAAA,oBAAC,SAAM,OAAK,MAAC,SAAS,oBAAC,YAAS,GAAI;AAAA,IACpC,oBAAC,SAAM,MAAK,KAAI,SAAS,oBAAC,KAAK,OAAL,CAAA,CAAW,EAAA,CAAI;AAAA,EAAA,GAC3C;AAEJ;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const admin = require("@strapi/strapi/admin");
|
|
5
|
+
const reactRouterDom = require("react-router-dom");
|
|
6
|
+
const designSystem = require("@strapi/design-system");
|
|
7
|
+
const reactIntl = require("react-intl");
|
|
8
|
+
const index = require("./index-BEIAVxBW.js");
|
|
9
|
+
const getTranslation = (id) => `${index.PLUGIN_ID}.${id}`;
|
|
10
|
+
const HomePage = () => {
|
|
11
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.jsxs("h1", { children: [
|
|
13
|
+
"Welcome to ",
|
|
14
|
+
formatMessage({ id: getTranslation("plugin.name") })
|
|
15
|
+
] }) });
|
|
16
|
+
};
|
|
17
|
+
const App = () => {
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
19
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }),
|
|
20
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Error, {}) })
|
|
21
|
+
] });
|
|
22
|
+
};
|
|
23
|
+
exports.App = App;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App-BlTU6Lmm.js","sources":["../../admin/src/utils/getTranslation.js","../../admin/src/pages/HomePage.jsx","../../admin/src/pages/App.jsx"],"sourcesContent":["import { PLUGIN_ID } from \"../pluginId\";\n\nconst getTranslation = (id) => `${PLUGIN_ID}.${id}`;\n\nexport { getTranslation };","import { Main } from \"@strapi/design-system\";\nimport { useIntl } from \"react-intl\";\n\nimport { getTranslation } from \"../utils/getTranslation\";\n\nconst HomePage = () => {\n const { formatMessage } = useIntl();\n\n return (\n <Main>\n <h1>Welcome to {formatMessage({ id: getTranslation(\"plugin.name\") })}</h1>\n </Main>\n );\n};\n\nexport { HomePage };","import { Page } from \"@strapi/strapi/admin\";\nimport { Routes, Route } from \"react-router-dom\";\n\nimport { HomePage } from \"./HomePage\";\n\nconst App = () => {\n return (\n <Routes>\n <Route index element={<HomePage />} />\n <Route path=\"*\" element={<Page.Error />} />\n </Routes>\n );\n};\n\nexport { App };"],"names":["PLUGIN_ID","useIntl","jsx","Main","jsxs","Routes","Route","Page"],"mappings":";;;;;;;;AAEA,MAAM,iBAAiB,CAAC,OAAO,GAAGA,MAAAA,SAAS,IAAI,EAAE;ACGjD,MAAM,WAAW,MAAM;AACrB,QAAM,EAAE,cAAA,IAAkBC,kBAAA;AAE1B,SACEC,2BAAAA,IAACC,aAAAA,MAAA,EACC,UAAAC,2BAAAA,KAAC,MAAA,EAAG,UAAA;AAAA,IAAA;AAAA,IAAY,cAAc,EAAE,IAAI,eAAe,aAAa,GAAG;AAAA,EAAA,EAAA,CAAE,EAAA,CACvE;AAEJ;ACRA,MAAM,MAAM,MAAM;AAChB,yCACGC,uBAAA,EACC,UAAA;AAAA,IAAAH,+BAACI,eAAAA,SAAM,OAAK,MAAC,SAASJ,+BAAC,YAAS,GAAI;AAAA,IACpCA,+BAACI,eAAAA,SAAM,MAAK,KAAI,SAASJ,2BAAAA,IAACK,MAAAA,KAAK,OAAL,CAAA,CAAW,EAAA,CAAI;AAAA,EAAA,GAC3C;AAEJ;;"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
const designSystem = require("@strapi/design-system");
|
|
6
|
+
const reactIntl = require("react-intl");
|
|
7
|
+
const reactTimezoneSelect = require("react-timezone-select");
|
|
8
|
+
const TimeZone = react.forwardRef((props, ref) => {
|
|
9
|
+
const {
|
|
10
|
+
name,
|
|
11
|
+
value,
|
|
12
|
+
onChange,
|
|
13
|
+
attribute,
|
|
14
|
+
required,
|
|
15
|
+
disabled,
|
|
16
|
+
intlLabel,
|
|
17
|
+
description
|
|
18
|
+
} = props;
|
|
19
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
20
|
+
const [error, setError] = react.useState("");
|
|
21
|
+
const { options } = reactTimezoneSelect.useTimezoneSelect({
|
|
22
|
+
labelStyle: "original",
|
|
23
|
+
timezones: reactTimezoneSelect.allTimezones,
|
|
24
|
+
displayValue: "UTC"
|
|
25
|
+
});
|
|
26
|
+
react.useEffect(() => {
|
|
27
|
+
if (required && !value) {
|
|
28
|
+
setError("This field is required");
|
|
29
|
+
} else {
|
|
30
|
+
setError("");
|
|
31
|
+
}
|
|
32
|
+
}, [value, required]);
|
|
33
|
+
const handleChange = (timezoneValue) => {
|
|
34
|
+
if (required && !timezoneValue) {
|
|
35
|
+
setError("This field is required");
|
|
36
|
+
} else {
|
|
37
|
+
setError("");
|
|
38
|
+
}
|
|
39
|
+
onChange({
|
|
40
|
+
target: {
|
|
41
|
+
name,
|
|
42
|
+
type: attribute.type,
|
|
43
|
+
value: timezoneValue
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name, error, hint: description ? formatMessage(description) : "", children: [
|
|
48
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { required, children: intlLabel ? formatMessage(intlLabel) : name }),
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
50
|
+
designSystem.SingleSelect,
|
|
51
|
+
{
|
|
52
|
+
ref,
|
|
53
|
+
value: value || "",
|
|
54
|
+
onChange: handleChange,
|
|
55
|
+
disabled,
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "", children: "Select any timezone" }),
|
|
58
|
+
options.map((tz) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: tz.value, children: tz.label }, tz.value))
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
64
|
+
] });
|
|
65
|
+
});
|
|
66
|
+
exports.default = TimeZone;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeZone-D3r22Lcf.js","sources":["../../admin/src/components/TimeZone.jsx"],"sourcesContent":["import React, { forwardRef, useState, useEffect } from \"react\";\r\nimport { Field, SingleSelect, SingleSelectOption } from \"@strapi/design-system\";\r\nimport { useIntl } from \"react-intl\";\r\nimport { useTimezoneSelect, allTimezones } from \"react-timezone-select\";\r\n\r\nconst TimeZone = forwardRef((props, ref) => {\r\n const {\r\n name,\r\n value,\r\n onChange,\r\n attribute,\r\n required,\r\n disabled,\r\n intlLabel,\r\n description,\r\n } = props;\r\n\r\n const { formatMessage } = useIntl();\r\n const [error, setError] = useState(\"\");\r\n\r\n const { options } = useTimezoneSelect({\r\n labelStyle: \"original\",\r\n timezones: allTimezones,\r\n displayValue: \"UTC\",\r\n });\r\n\r\n useEffect(() => {\r\n if (required && !value) {\r\n setError(\"This field is required\");\r\n } else {\r\n setError(\"\");\r\n }\r\n }, [value, required]);\r\n\r\n const handleChange = (timezoneValue) => {\r\n if (required && !timezoneValue) {\r\n setError(\"This field is required\");\r\n } else {\r\n setError(\"\");\r\n }\r\n\r\n onChange({\r\n target: {\r\n name,\r\n type: attribute.type,\r\n value: timezoneValue,\r\n },\r\n });\r\n };\r\n\r\n return (\r\n <Field.Root name={name} error={error} hint={description ? formatMessage(description) : \"\"}>\r\n \r\n <Field.Label required={required}>\r\n {intlLabel ? formatMessage(intlLabel) : name}\r\n </Field.Label>\r\n\r\n <SingleSelect\r\n ref={ref}\r\n value={value || \"\"}\r\n onChange={handleChange}\r\n disabled={disabled}\r\n >\r\n <SingleSelectOption value=\"\">\r\n Select any timezone\r\n </SingleSelectOption>\r\n\r\n {options.map((tz) => (\r\n <SingleSelectOption key={tz.value} value={tz.value}>\r\n {tz.label} \r\n </SingleSelectOption>\r\n ))}\r\n </SingleSelect>\r\n\r\n <Field.Hint />\r\n\r\n <Field.Error />\r\n\r\n </Field.Root>\r\n );\r\n});\r\n\r\nexport default TimeZone;"],"names":["forwardRef","useIntl","useState","useTimezoneSelect","allTimezones","useEffect","jsxs","Field","jsx","SingleSelect","SingleSelectOption"],"mappings":";;;;;;;AAKA,MAAM,WAAWA,MAAAA,WAAW,CAAC,OAAO,QAAQ;AAC1C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAEJ,QAAM,EAAE,cAAA,IAAkBC,kBAAA;AAC1B,QAAM,CAAC,OAAO,QAAQ,IAAIC,MAAAA,SAAS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AEf;AAEJ,CAAC;;"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState, useEffect } from "react";
|
|
3
|
+
import { Field, SingleSelect, SingleSelectOption } from "@strapi/design-system";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
import { useTimezoneSelect, allTimezones } from "react-timezone-select";
|
|
6
|
+
const TimeZone = forwardRef((props, ref) => {
|
|
7
|
+
const {
|
|
8
|
+
name,
|
|
9
|
+
value,
|
|
10
|
+
onChange,
|
|
11
|
+
attribute,
|
|
12
|
+
required,
|
|
13
|
+
disabled,
|
|
14
|
+
intlLabel,
|
|
15
|
+
description
|
|
16
|
+
} = props;
|
|
17
|
+
const { formatMessage } = useIntl();
|
|
18
|
+
const [error, setError] = useState("");
|
|
19
|
+
const { options } = useTimezoneSelect({
|
|
20
|
+
labelStyle: "original",
|
|
21
|
+
timezones: allTimezones,
|
|
22
|
+
displayValue: "UTC"
|
|
23
|
+
});
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (required && !value) {
|
|
26
|
+
setError("This field is required");
|
|
27
|
+
} else {
|
|
28
|
+
setError("");
|
|
29
|
+
}
|
|
30
|
+
}, [value, required]);
|
|
31
|
+
const handleChange = (timezoneValue) => {
|
|
32
|
+
if (required && !timezoneValue) {
|
|
33
|
+
setError("This field is required");
|
|
34
|
+
} else {
|
|
35
|
+
setError("");
|
|
36
|
+
}
|
|
37
|
+
onChange({
|
|
38
|
+
target: {
|
|
39
|
+
name,
|
|
40
|
+
type: attribute.type,
|
|
41
|
+
value: timezoneValue
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ jsxs(Field.Root, { name, error, hint: description ? formatMessage(description) : "", children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Field.Label, { required, children: intlLabel ? formatMessage(intlLabel) : name }),
|
|
47
|
+
/* @__PURE__ */ jsxs(
|
|
48
|
+
SingleSelect,
|
|
49
|
+
{
|
|
50
|
+
ref,
|
|
51
|
+
value: value || "",
|
|
52
|
+
onChange: handleChange,
|
|
53
|
+
disabled,
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "", children: "Select any timezone" }),
|
|
56
|
+
options.map((tz) => /* @__PURE__ */ jsx(SingleSelectOption, { value: tz.value, children: tz.label }, tz.value))
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ jsx(Field.Hint, {}),
|
|
61
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
62
|
+
] });
|
|
63
|
+
});
|
|
64
|
+
export {
|
|
65
|
+
TimeZone as default
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeZone-piXcAg6n.mjs","sources":["../../admin/src/components/TimeZone.jsx"],"sourcesContent":["import React, { forwardRef, useState, useEffect } from \"react\";\r\nimport { Field, SingleSelect, SingleSelectOption } from \"@strapi/design-system\";\r\nimport { useIntl } from \"react-intl\";\r\nimport { useTimezoneSelect, allTimezones } from \"react-timezone-select\";\r\n\r\nconst TimeZone = forwardRef((props, ref) => {\r\n const {\r\n name,\r\n value,\r\n onChange,\r\n attribute,\r\n required,\r\n disabled,\r\n intlLabel,\r\n description,\r\n } = props;\r\n\r\n const { formatMessage } = useIntl();\r\n const [error, setError] = useState(\"\");\r\n\r\n const { options } = useTimezoneSelect({\r\n labelStyle: \"original\",\r\n timezones: allTimezones,\r\n displayValue: \"UTC\",\r\n });\r\n\r\n useEffect(() => {\r\n if (required && !value) {\r\n setError(\"This field is required\");\r\n } else {\r\n setError(\"\");\r\n }\r\n }, [value, required]);\r\n\r\n const handleChange = (timezoneValue) => {\r\n if (required && !timezoneValue) {\r\n setError(\"This field is required\");\r\n } else {\r\n setError(\"\");\r\n }\r\n\r\n onChange({\r\n target: {\r\n name,\r\n type: attribute.type,\r\n value: timezoneValue,\r\n },\r\n });\r\n };\r\n\r\n return (\r\n <Field.Root name={name} error={error} hint={description ? formatMessage(description) : \"\"}>\r\n \r\n <Field.Label required={required}>\r\n {intlLabel ? formatMessage(intlLabel) : name}\r\n </Field.Label>\r\n\r\n <SingleSelect\r\n ref={ref}\r\n value={value || \"\"}\r\n onChange={handleChange}\r\n disabled={disabled}\r\n >\r\n <SingleSelectOption value=\"\">\r\n Select any timezone\r\n </SingleSelectOption>\r\n\r\n {options.map((tz) => (\r\n <SingleSelectOption key={tz.value} value={tz.value}>\r\n {tz.label} \r\n </SingleSelectOption>\r\n ))}\r\n </SingleSelect>\r\n\r\n <Field.Hint />\r\n\r\n <Field.Error />\r\n\r\n </Field.Root>\r\n );\r\n});\r\n\r\nexport default TimeZone;"],"names":[],"mappings":";;;;;AAKA,MAAM,WAAW,WAAW,CAAC,OAAO,QAAQ;AAC1C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAEJ,QAAM,EAAE,cAAA,IAAkB,QAAA;AAC1B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AAErC,QAAM,EAAE,QAAA,IAAY,kBAAkB;AAAA,IACpC,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,EAAA,CACf;AAED,YAAU,MAAM;AACd,QAAI,YAAY,CAAC,OAAO;AACtB,eAAS,wBAAwB;AAAA,IACnC,OAAO;AACL,eAAS,EAAE;AAAA,IACb;AAAA,EACF,GAAG,CAAC,OAAO,QAAQ,CAAC;AAEpB,QAAM,eAAe,CAAC,kBAAkB;AACtC,QAAI,YAAY,CAAC,eAAe;AAC9B,eAAS,wBAAwB;AAAA,IACnC,OAAO;AACL,eAAS,EAAE;AAAA,IACb;AAEA,aAAS;AAAA,MACP,QAAQ;AAAA,QACN;AAAA,QACA,MAAM,UAAU;AAAA,QAChB,OAAO;AAAA,MAAA;AAAA,IACT,CACD;AAAA,EACH;AAEA,SACE,qBAAC,MAAM,MAAN,EAAW,MAAY,OAAc,MAAM,cAAc,cAAc,WAAW,IAAI,IAErF,UAAA;AAAA,IAAA,oBAAC,MAAM,OAAN,EAAY,UACV,sBAAY,cAAc,SAAS,IAAI,MAC1C;AAAA,IAEA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,OAAO,SAAS;AAAA,QAChB,UAAU;AAAA,QACV;AAAA,QAEA,UAAA;AAAA,UAAA,oBAAC,oBAAA,EAAmB,OAAM,IAAG,UAAA,uBAE7B;AAAA,UAEC,QAAQ,IAAI,CAAC,OACZ,oBAAC,oBAAA,EAAkC,OAAO,GAAG,OAC1C,UAAA,GAAG,MAAA,GADmB,GAAG,KAE5B,CACD;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAGH,oBAAC,MAAM,MAAN,EAAW;AAAA,IAEZ,oBAAC,MAAM,OAAN,CAAA,CAAY;AAAA,EAAA,GAEf;AAEJ,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en-B4KWt_jN.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en-Byx4XI2L.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Clock } from "@strapi/icons";
|
|
4
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
5
|
+
const v = glob[path];
|
|
6
|
+
if (v) {
|
|
7
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
8
|
+
}
|
|
9
|
+
return new Promise((_, reject) => {
|
|
10
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
11
|
+
reject.bind(
|
|
12
|
+
null,
|
|
13
|
+
new Error(
|
|
14
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
15
|
+
)
|
|
16
|
+
)
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const PLUGIN_ID = "startbit-timezone-select";
|
|
21
|
+
const Initializer = ({ setPlugin }) => {
|
|
22
|
+
const ref = useRef(setPlugin);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
ref.current(PLUGIN_ID);
|
|
25
|
+
}, []);
|
|
26
|
+
return null;
|
|
27
|
+
};
|
|
28
|
+
const PluginIcon = () => /* @__PURE__ */ jsx(Clock, {});
|
|
29
|
+
const index = {
|
|
30
|
+
register(app) {
|
|
31
|
+
app.addMenuLink({
|
|
32
|
+
to: `plugins/${PLUGIN_ID}`,
|
|
33
|
+
icon: PluginIcon,
|
|
34
|
+
intlLabel: {
|
|
35
|
+
id: `${PLUGIN_ID}.plugin.name`,
|
|
36
|
+
defaultMessage: PLUGIN_ID
|
|
37
|
+
},
|
|
38
|
+
Component: async () => {
|
|
39
|
+
const { App } = await import("./App-ApBjpMql.mjs");
|
|
40
|
+
return App;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
app.registerPlugin({
|
|
44
|
+
id: PLUGIN_ID,
|
|
45
|
+
initializer: Initializer,
|
|
46
|
+
isReady: false,
|
|
47
|
+
name: PLUGIN_ID
|
|
48
|
+
});
|
|
49
|
+
app.customFields.register({
|
|
50
|
+
name: "timeZone",
|
|
51
|
+
pluginId: PLUGIN_ID,
|
|
52
|
+
type: "string",
|
|
53
|
+
intlLabel: {
|
|
54
|
+
id: `${PLUGIN_ID}.timeZone.label`,
|
|
55
|
+
defaultMessage: "Timezone"
|
|
56
|
+
},
|
|
57
|
+
intlDescription: {
|
|
58
|
+
id: `${PLUGIN_ID}.timeZone.description`,
|
|
59
|
+
defaultMessage: "Dynamic TimeZone listing"
|
|
60
|
+
},
|
|
61
|
+
icon: PluginIcon,
|
|
62
|
+
components: {
|
|
63
|
+
Input: async () => import("./TimeZone-piXcAg6n.mjs").then((module) => ({
|
|
64
|
+
default: module.default
|
|
65
|
+
}))
|
|
66
|
+
},
|
|
67
|
+
options: {
|
|
68
|
+
advanced: [
|
|
69
|
+
{
|
|
70
|
+
sectionTitle: {
|
|
71
|
+
id: "global.advanced",
|
|
72
|
+
defaultMessage: "Settings"
|
|
73
|
+
},
|
|
74
|
+
items: [
|
|
75
|
+
{
|
|
76
|
+
intlLabel: { id: "global.required", defaultMessage: "Required" },
|
|
77
|
+
name: "required",
|
|
78
|
+
type: "checkbox",
|
|
79
|
+
description: {
|
|
80
|
+
id: "global.required.description",
|
|
81
|
+
defaultMessage: "Make this field required"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
async registerTrads({ locales }) {
|
|
91
|
+
return Promise.all(
|
|
92
|
+
locales.map(async (locale) => {
|
|
93
|
+
try {
|
|
94
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-Byx4XI2L.mjs") }), `./translations/${locale}.json`, 3);
|
|
95
|
+
return { data, locale };
|
|
96
|
+
} catch {
|
|
97
|
+
return { data: {}, locale };
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
export {
|
|
104
|
+
PLUGIN_ID as P,
|
|
105
|
+
index as i
|
|
106
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-B1af4dDJ.mjs","sources":["../../admin/src/pluginId.js","../../admin/src/components/Initializer.jsx","../../admin/src/components/PluginIcon.jsx","../../admin/src/index.js"],"sourcesContent":["export const PLUGIN_ID = \"startbit-timezone-select\";","import { useEffect, useRef } from \"react\";\n\nimport { PLUGIN_ID } from \"../pluginId\";\n\n/**\n * @type {import('react').FC<{ setPlugin: (id: string) => void }>}\n */\nconst Initializer = ({ setPlugin }) => {\n const ref = useRef(setPlugin);\n\n useEffect(() => {\n ref.current(PLUGIN_ID);\n }, []);\n\n return null;\n};\n\nexport { Initializer };","import { Clock } from \"@strapi/icons\";\n\nconst PluginIcon = () => <Clock />;\n\nexport { PluginIcon };","import { getTranslation } from \"./utils/getTranslation\";\nimport { PLUGIN_ID } from \"./pluginId\";\nimport { Initializer } from \"./components/Initializer\";\nimport { PluginIcon } from \"./components/PluginIcon\";\n\nexport default {\n register(app) {\n app.addMenuLink({\n to: `plugins/${PLUGIN_ID}`,\n icon: PluginIcon,\n intlLabel: {\n id: `${PLUGIN_ID}.plugin.name`,\n defaultMessage: PLUGIN_ID,\n },\n Component: async () => {\n const { App } = await import(\"./pages/App\");\n\n return App;\n },\n });\n\n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n\n app.customFields.register({\n name: \"timeZone\",\n pluginId: PLUGIN_ID,\n type: \"string\",\n\n intlLabel: {\n id: `${PLUGIN_ID}.timeZone.label`,\n defaultMessage: \"Timezone\",\n },\n\n intlDescription: {\n id: `${PLUGIN_ID}.timeZone.description`,\n defaultMessage: \"Dynamic TimeZone listing\",\n },\n icon: PluginIcon,\n components: {\n Input: async () =>\n import(\"./components/TimeZone\").then((module) => ({\n default: module.default,\n })),\n },\n\n options: {\n advanced: [\n {\n sectionTitle: {\n id: 'global.advanced',\n defaultMessage: 'Settings',\n },\n items: [\n {\n intlLabel: { id: 'global.required', defaultMessage: 'Required' },\n name: 'required',\n type: 'checkbox',\n description: {\n id: 'global.required.description',\n defaultMessage: 'Make this field required',\n },\n },\n ],\n },\n ],\n },\n });\n },\n\n async registerTrads({ locales }) {\n return Promise.all(\n locales.map(async (locale) => {\n try {\n const { default: data } = await import(\n `./translations/${locale}.json`\n );\n\n return { data, locale };\n } catch {\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AAW,EAAE,IAAI,mBAAmB,gBAAgB,WAAU;AAAA,gBAC9D,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN,aAAa;AAAA,kBACX,IAAI;AAAA,kBACJ,gBAAgB;AAAA,gBACpC;AAAA,cACA;AAAA,YACA;AAAA,UACA;AAAA,QACA;AAAA,MACA;AAAA,IACA,CAAK;AAAA,EACH;AAAA,EAEA,MAAM,cAAc,EAAE,WAAW;AAC/B,WAAO,QAAQ;AAAA,MACb,QAAQ,IAAI,OAAO,WAAW;AAC5B,YAAI;AACF,gBAAM,EAAE,SAAS,KAAI,IAAK,MAAM,qCAAA,uBAAA,OAAA,EAAA,0BAAA,MAAA,OAAA,mBAAA,EAAA,CAAA,GAAA,kBAAA,MAAA,SAAA,CAAA;AAIhC,iBAAO,EAAE,MAAM,OAAM;AAAA,QACvB,QAAQ;AACN,iBAAO,EAAE,MAAM,CAAA,GAAI,OAAM;AAAA,QAC3B;AAAA,MACF,CAAC;AAAA,IACP;AAAA,EACE;AACF;"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const react = require("react");
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const icons = require("@strapi/icons");
|
|
5
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
6
|
+
const v = glob[path];
|
|
7
|
+
if (v) {
|
|
8
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
9
|
+
}
|
|
10
|
+
return new Promise((_, reject) => {
|
|
11
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
12
|
+
reject.bind(
|
|
13
|
+
null,
|
|
14
|
+
new Error(
|
|
15
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
16
|
+
)
|
|
17
|
+
)
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const PLUGIN_ID = "startbit-timezone-select";
|
|
22
|
+
const Initializer = ({ setPlugin }) => {
|
|
23
|
+
const ref = react.useRef(setPlugin);
|
|
24
|
+
react.useEffect(() => {
|
|
25
|
+
ref.current(PLUGIN_ID);
|
|
26
|
+
}, []);
|
|
27
|
+
return null;
|
|
28
|
+
};
|
|
29
|
+
const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Clock, {});
|
|
30
|
+
const index = {
|
|
31
|
+
register(app) {
|
|
32
|
+
app.addMenuLink({
|
|
33
|
+
to: `plugins/${PLUGIN_ID}`,
|
|
34
|
+
icon: PluginIcon,
|
|
35
|
+
intlLabel: {
|
|
36
|
+
id: `${PLUGIN_ID}.plugin.name`,
|
|
37
|
+
defaultMessage: PLUGIN_ID
|
|
38
|
+
},
|
|
39
|
+
Component: async () => {
|
|
40
|
+
const { App } = await Promise.resolve().then(() => require("./App-BlTU6Lmm.js"));
|
|
41
|
+
return App;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
app.registerPlugin({
|
|
45
|
+
id: PLUGIN_ID,
|
|
46
|
+
initializer: Initializer,
|
|
47
|
+
isReady: false,
|
|
48
|
+
name: PLUGIN_ID
|
|
49
|
+
});
|
|
50
|
+
app.customFields.register({
|
|
51
|
+
name: "timeZone",
|
|
52
|
+
pluginId: PLUGIN_ID,
|
|
53
|
+
type: "string",
|
|
54
|
+
intlLabel: {
|
|
55
|
+
id: `${PLUGIN_ID}.timeZone.label`,
|
|
56
|
+
defaultMessage: "Timezone"
|
|
57
|
+
},
|
|
58
|
+
intlDescription: {
|
|
59
|
+
id: `${PLUGIN_ID}.timeZone.description`,
|
|
60
|
+
defaultMessage: "Dynamic TimeZone listing"
|
|
61
|
+
},
|
|
62
|
+
icon: PluginIcon,
|
|
63
|
+
components: {
|
|
64
|
+
Input: async () => Promise.resolve().then(() => require("./TimeZone-D3r22Lcf.js")).then((module2) => ({
|
|
65
|
+
default: module2.default
|
|
66
|
+
}))
|
|
67
|
+
},
|
|
68
|
+
options: {
|
|
69
|
+
advanced: [
|
|
70
|
+
{
|
|
71
|
+
sectionTitle: {
|
|
72
|
+
id: "global.advanced",
|
|
73
|
+
defaultMessage: "Settings"
|
|
74
|
+
},
|
|
75
|
+
items: [
|
|
76
|
+
{
|
|
77
|
+
intlLabel: { id: "global.required", defaultMessage: "Required" },
|
|
78
|
+
name: "required",
|
|
79
|
+
type: "checkbox",
|
|
80
|
+
description: {
|
|
81
|
+
id: "global.required.description",
|
|
82
|
+
defaultMessage: "Make this field required"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
async registerTrads({ locales }) {
|
|
92
|
+
return Promise.all(
|
|
93
|
+
locales.map(async (locale) => {
|
|
94
|
+
try {
|
|
95
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-B4KWt_jN.js")) }), `./translations/${locale}.json`, 3);
|
|
96
|
+
return { data, locale };
|
|
97
|
+
} catch {
|
|
98
|
+
return { data: {}, locale };
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
exports.PLUGIN_ID = PLUGIN_ID;
|
|
105
|
+
exports.index = index;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BEIAVxBW.js","sources":["../../admin/src/pluginId.js","../../admin/src/components/Initializer.jsx","../../admin/src/components/PluginIcon.jsx","../../admin/src/index.js"],"sourcesContent":["export const PLUGIN_ID = \"startbit-timezone-select\";","import { useEffect, useRef } from \"react\";\n\nimport { PLUGIN_ID } from \"../pluginId\";\n\n/**\n * @type {import('react').FC<{ setPlugin: (id: string) => void }>}\n */\nconst Initializer = ({ setPlugin }) => {\n const ref = useRef(setPlugin);\n\n useEffect(() => {\n ref.current(PLUGIN_ID);\n }, []);\n\n return null;\n};\n\nexport { Initializer };","import { Clock } from \"@strapi/icons\";\n\nconst PluginIcon = () => <Clock />;\n\nexport { PluginIcon };","import { getTranslation } from \"./utils/getTranslation\";\nimport { PLUGIN_ID } from \"./pluginId\";\nimport { Initializer } from \"./components/Initializer\";\nimport { PluginIcon } from \"./components/PluginIcon\";\n\nexport default {\n register(app) {\n app.addMenuLink({\n to: `plugins/${PLUGIN_ID}`,\n icon: PluginIcon,\n intlLabel: {\n id: `${PLUGIN_ID}.plugin.name`,\n defaultMessage: PLUGIN_ID,\n },\n Component: async () => {\n const { App } = await import(\"./pages/App\");\n\n return App;\n },\n });\n\n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n\n app.customFields.register({\n name: \"timeZone\",\n pluginId: PLUGIN_ID,\n type: \"string\",\n\n intlLabel: {\n id: `${PLUGIN_ID}.timeZone.label`,\n defaultMessage: \"Timezone\",\n },\n\n intlDescription: {\n id: `${PLUGIN_ID}.timeZone.description`,\n defaultMessage: \"Dynamic TimeZone listing\",\n },\n icon: PluginIcon,\n components: {\n Input: async () =>\n import(\"./components/TimeZone\").then((module) => ({\n default: module.default,\n })),\n },\n\n options: {\n advanced: [\n {\n sectionTitle: {\n id: 'global.advanced',\n defaultMessage: 'Settings',\n },\n items: [\n {\n intlLabel: { id: 'global.required', defaultMessage: 'Required' },\n name: 'required',\n type: 'checkbox',\n description: {\n id: 'global.required.description',\n defaultMessage: 'Make this field required',\n },\n },\n ],\n },\n ],\n },\n });\n },\n\n async registerTrads({ locales }) {\n return Promise.all(\n locales.map(async (locale) => {\n try {\n const { default: data } = await import(\n `./translations/${locale}.json`\n );\n\n return { data, locale };\n } catch {\n return { data: {}, locale };\n }\n })\n );\n },\n};"],"names":["useRef","useEffect","jsx","Clock","module"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAY,MAAC,YAAY;ACOzB,MAAM,cAAc,CAAC,EAAE,gBAAgB;AACrC,QAAM,M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AAU;AAAA,gBAC9D,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN,aAAa;AAAA,kBACX,IAAI;AAAA,kBACJ,gBAAgB;AAAA,gBACpC;AAAA,cACA;AAAA,YACA;AAAA,UACA;AAAA,QACA;AAAA,MACA;AAAA,IACA,CAAK;AAAA,EACH;AAAA,EAEA,MAAM,cAAc,EAAE,WAAW;AAC/B,WAAO,QAAQ;AAAA,MACb,QAAQ,IAAI,OAAO,WAAW;AAC5B,YAAI;AACF,gBAAM,EAAE,SAAS,KAAI,IAAK,MAAM,qCAAA,uBAAA,OAAA,EAAA,0BAAA,MAAA,QAAA,QAAA,EAAA,KAAA,MAAA,QAAA,kBAAA,CAAA,EAAA,CAAA,GAAA,kBAAA,MAAA,SAAA,CAAA;AAIhC,iBAAO,EAAE,MAAM,OAAM;AAAA,QACvB,QAAQ;AACN,iBAAO,EAAE,MAAM,CAAA,GAAI,OAAM;AAAA,QAC3B;AAAA,MACF,CAAC;AAAA,IACP;AAAA,EACE;AACF;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const bootstrap = ({ strapi }) => {
|
|
4
|
+
};
|
|
5
|
+
const destroy = ({ strapi }) => {
|
|
6
|
+
};
|
|
7
|
+
const register = ({ strapi }) => {
|
|
8
|
+
strapi.customFields.register({
|
|
9
|
+
name: "timeZone",
|
|
10
|
+
plugin: "startbit-timezone-select",
|
|
11
|
+
type: "string",
|
|
12
|
+
inputSize: {
|
|
13
|
+
default: 6,
|
|
14
|
+
isResizable: true
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const config = {
|
|
19
|
+
default: {},
|
|
20
|
+
validator() {
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const contentTypes = {};
|
|
24
|
+
const controller = ({ strapi }) => ({
|
|
25
|
+
index(ctx) {
|
|
26
|
+
ctx.body = strapi.plugin("startbit-timezone-select").service("service").getWelcomeMessage();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const controllers = {
|
|
30
|
+
controller
|
|
31
|
+
};
|
|
32
|
+
const middlewares = {};
|
|
33
|
+
const policies = {};
|
|
34
|
+
const contentAPIRoutes = () => ({
|
|
35
|
+
type: "content-api",
|
|
36
|
+
routes: [
|
|
37
|
+
{
|
|
38
|
+
method: "GET",
|
|
39
|
+
path: "/",
|
|
40
|
+
// name of the controller file & the method.
|
|
41
|
+
handler: "controller.index",
|
|
42
|
+
config: {
|
|
43
|
+
policies: []
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
const adminAPIRoutes = () => ({
|
|
49
|
+
type: "admin",
|
|
50
|
+
routes: []
|
|
51
|
+
});
|
|
52
|
+
const routes = {
|
|
53
|
+
"content-api": contentAPIRoutes,
|
|
54
|
+
admin: adminAPIRoutes
|
|
55
|
+
};
|
|
56
|
+
const service = ({ strapi }) => ({
|
|
57
|
+
getWelcomeMessage() {
|
|
58
|
+
return "Welcome to Strapi 🚀";
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const services = {
|
|
62
|
+
service
|
|
63
|
+
};
|
|
64
|
+
const index = {
|
|
65
|
+
bootstrap,
|
|
66
|
+
destroy,
|
|
67
|
+
register,
|
|
68
|
+
config,
|
|
69
|
+
controllers,
|
|
70
|
+
contentTypes,
|
|
71
|
+
middlewares,
|
|
72
|
+
policies,
|
|
73
|
+
routes,
|
|
74
|
+
services
|
|
75
|
+
};
|
|
76
|
+
exports.default = index;
|