@ouroboros/mouth-mui 1.0.2 → 1.2.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/package.json +7 -6
- package/src/components/pages/Locales.d.ts +2 -2
- package/src/components/pages/Locales.js +3 -3
- package/src/components/pages/Locales.tsx +3 -3
- package/src/components/pages/Templates/Create.d.ts +2 -2
- package/src/components/pages/Templates/Create.js +3 -3
- package/src/components/pages/Templates/Create.tsx +3 -3
- package/src/components/pages/Templates/Template/Content/Create/Email.d.ts +2 -2
- package/src/components/pages/Templates/Template/Content/Create/SMS.d.ts +2 -2
- package/src/components/pages/Templates/Template/Content/Create/index.d.ts +2 -2
- package/src/components/pages/Templates/Template/Content/Preview/Email.d.ts +2 -2
- package/src/components/pages/Templates/Template/Content/Preview/SMS.d.ts +2 -2
- package/src/components/pages/Templates/Template/Content/Preview/index.d.ts +2 -2
- package/src/components/pages/Templates/Template/Content/Update/Email.d.ts +2 -2
- package/src/components/pages/Templates/Template/Content/Update/SMS.d.ts +2 -2
- package/src/components/pages/Templates/Template/Content/Update/index.d.ts +2 -2
- package/src/components/pages/Templates/Template/Content/Update/index.js +1 -1
- package/src/components/pages/Templates/Template/Content/Update/index.tsx +1 -1
- package/src/components/pages/Templates/Template/Content/View/Email.d.ts +2 -2
- package/src/components/pages/Templates/Template/Content/View/SMS.d.ts +2 -2
- package/src/components/pages/Templates/Template/Content/View/index.d.ts +2 -2
- package/src/components/pages/Templates/Template/Variables.d.ts +2 -2
- package/src/components/pages/Templates/Template/Variables.js +1 -1
- package/src/components/pages/Templates/Template/Variables.tsx +1 -1
- package/src/components/pages/Templates/Template/index.d.ts +3 -3
- package/src/components/pages/Templates/Template/index.tsx +1 -1
- package/src/components/pages/Templates/index.d.ts +2 -2
- package/src/components/pages/Templates/index.js +4 -4
- package/src/components/pages/Templates/index.tsx +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ouroboros/mouth-mui",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Components for use with the Mouth service",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"url": "https://github.com/ouroboroscoding/mouth-mui/issues"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
+
"@ouroboros/body": "^1.0.2",
|
|
29
30
|
"@types/node": "^18.14.0",
|
|
30
31
|
"@types/react": "^18.0.28",
|
|
31
32
|
"@types/uuid": "^9.0.0",
|
|
@@ -39,17 +40,17 @@
|
|
|
39
40
|
"@ouroboros/define-mui": "^1.0.3",
|
|
40
41
|
"@ouroboros/react-radiobuttons-mui": "^1.0.0",
|
|
41
42
|
"@ouroboros/subscribe": "^1.2.0",
|
|
42
|
-
"@ouroboros/tools": "^0.
|
|
43
|
+
"@ouroboros/tools": "^0.5.1",
|
|
43
44
|
"prop-types": "^15.8.1"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"@emotion/react": "^11.8.2",
|
|
47
48
|
"@emotion/styled": "^11.8.1",
|
|
48
49
|
"@mui/material": "^5.5.1",
|
|
49
|
-
"@ouroboros/body": "^1.0.
|
|
50
|
-
"@ouroboros/brain-
|
|
51
|
-
"@ouroboros/mouth": "^1.
|
|
50
|
+
"@ouroboros/body": "^1.0.2",
|
|
51
|
+
"@ouroboros/brain-react": "^1.0.0",
|
|
52
|
+
"@ouroboros/mouth": "^1.1.0",
|
|
52
53
|
"react": "^17.0.2",
|
|
53
54
|
"react-dom": "^17.0.2"
|
|
54
55
|
}
|
|
55
|
-
}
|
|
56
|
+
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-19
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { responseErrorStruct } from '@ouroboros/body';
|
|
12
12
|
export type LocalesProps = {
|
|
13
13
|
mobile: boolean;
|
|
@@ -24,7 +24,7 @@ export type LocalesProps = {
|
|
|
24
24
|
* @param Object props Properties passed to the component
|
|
25
25
|
* @returns React.Component
|
|
26
26
|
*/
|
|
27
|
-
declare function Locales(props: LocalesProps): JSX.Element;
|
|
27
|
+
declare function Locales(props: LocalesProps): React.JSX.Element;
|
|
28
28
|
declare namespace Locales {
|
|
29
29
|
var propTypes: {
|
|
30
30
|
mobile: PropTypes.Validator<boolean>;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @created 2023-01-19
|
|
8
8
|
*/
|
|
9
9
|
// Ouroboros modules
|
|
10
|
-
import {
|
|
10
|
+
import { useRights } from '@ouroboros/brain-react';
|
|
11
11
|
import clone from '@ouroboros/clone';
|
|
12
12
|
import { Tree } from '@ouroboros/define';
|
|
13
13
|
import { Form, Results } from '@ouroboros/define-mui';
|
|
@@ -41,7 +41,7 @@ export default function Locales(props) {
|
|
|
41
41
|
const [create, createSet] = useState(false);
|
|
42
42
|
const [records, recordsSet] = useState([]);
|
|
43
43
|
// Hooks
|
|
44
|
-
const rights =
|
|
44
|
+
const rights = useRights('mouth_locale');
|
|
45
45
|
// User / archived change effect
|
|
46
46
|
useEffect(() => {
|
|
47
47
|
// If we have read rights
|
|
@@ -61,7 +61,7 @@ export default function Locales(props) {
|
|
|
61
61
|
// Create a new Promise and return it
|
|
62
62
|
return new Promise((resolve, reject) => {
|
|
63
63
|
// Create the new locale
|
|
64
|
-
mouth.create('locale').then((data) => {
|
|
64
|
+
mouth.create('locale', locale).then((data) => {
|
|
65
65
|
// If we were successful
|
|
66
66
|
if (data) {
|
|
67
67
|
// Notify the parent
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
// Ouroboros modules
|
|
11
|
-
import {
|
|
11
|
+
import { useRights } from '@ouroboros/brain-react';
|
|
12
12
|
import clone from '@ouroboros/clone';
|
|
13
13
|
import { Tree } from '@ouroboros/define'
|
|
14
14
|
import { Form, Results } from '@ouroboros/define-mui';
|
|
@@ -57,7 +57,7 @@ export default function Locales(props: LocalesProps) {
|
|
|
57
57
|
const [records, recordsSet] = useState<any[]>([]);
|
|
58
58
|
|
|
59
59
|
// Hooks
|
|
60
|
-
const rights =
|
|
60
|
+
const rights = useRights('mouth_locale');
|
|
61
61
|
|
|
62
62
|
// User / archived change effect
|
|
63
63
|
useEffect(() => {
|
|
@@ -83,7 +83,7 @@ export default function Locales(props: LocalesProps) {
|
|
|
83
83
|
return new Promise((resolve, reject) => {
|
|
84
84
|
|
|
85
85
|
// Create the new locale
|
|
86
|
-
mouth.create('locale').then((data: string) => {
|
|
86
|
+
mouth.create('locale', locale).then((data: string) => {
|
|
87
87
|
|
|
88
88
|
// If we were successful
|
|
89
89
|
if(data) {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-20
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { responseErrorStruct } from '@ouroboros/body';
|
|
12
12
|
import { templateStruct } from './Template';
|
|
13
13
|
export interface CreateProps {
|
|
@@ -25,7 +25,7 @@ export interface CreateProps {
|
|
|
25
25
|
* @param Object props Properties passed to the component
|
|
26
26
|
* @returns React.Component
|
|
27
27
|
*/
|
|
28
|
-
declare function Create(props: CreateProps): JSX.Element;
|
|
28
|
+
declare function Create(props: CreateProps): React.JSX.Element;
|
|
29
29
|
declare namespace Create {
|
|
30
30
|
var propTypes: {
|
|
31
31
|
onCancel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -45,7 +45,7 @@ export default function Create(props) {
|
|
|
45
45
|
// Called when record changes
|
|
46
46
|
function change(field, value) {
|
|
47
47
|
// Set the new record
|
|
48
|
-
recordSet(o => {
|
|
48
|
+
recordSet((o) => {
|
|
49
49
|
const oRecord = clone(o);
|
|
50
50
|
oRecord[field] = value;
|
|
51
51
|
return oRecord;
|
|
@@ -54,12 +54,12 @@ export default function Create(props) {
|
|
|
54
54
|
// Called to create the template
|
|
55
55
|
function create() {
|
|
56
56
|
// Create the data in the system
|
|
57
|
-
mouth.create('template', record).then(data => {
|
|
57
|
+
mouth.create('template', record).then((data) => {
|
|
58
58
|
// Add the ID to the record
|
|
59
59
|
record._id = data;
|
|
60
60
|
// Let the parent know
|
|
61
61
|
props.onCreated(clone(record));
|
|
62
|
-
}, error => {
|
|
62
|
+
}, (error) => {
|
|
63
63
|
if (error.code === errors.body.DB_DUPLICATE) {
|
|
64
64
|
refName.current?.error('Duplicate');
|
|
65
65
|
}
|
|
@@ -64,7 +64,7 @@ export default function Create(props: CreateProps) {
|
|
|
64
64
|
function change(field: string, value: any) {
|
|
65
65
|
|
|
66
66
|
// Set the new record
|
|
67
|
-
recordSet(o => {
|
|
67
|
+
recordSet((o: templateStruct) => {
|
|
68
68
|
const oRecord = clone(o);
|
|
69
69
|
oRecord[field] = value;
|
|
70
70
|
return oRecord;
|
|
@@ -75,14 +75,14 @@ export default function Create(props: CreateProps) {
|
|
|
75
75
|
function create() {
|
|
76
76
|
|
|
77
77
|
// Create the data in the system
|
|
78
|
-
mouth.create('template', record).then(data => {
|
|
78
|
+
mouth.create('template', record).then((data: string) => {
|
|
79
79
|
|
|
80
80
|
// Add the ID to the record
|
|
81
81
|
record._id = data;
|
|
82
82
|
|
|
83
83
|
// Let the parent know
|
|
84
84
|
props.onCreated(clone(record));
|
|
85
|
-
}, error => {
|
|
85
|
+
}, (error: responseErrorStruct) => {
|
|
86
86
|
if(error.code === errors.body.DB_DUPLICATE) {
|
|
87
87
|
refName.current?.error('Duplicate');
|
|
88
88
|
} else {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-22
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { contentStruct } from '../../';
|
|
12
12
|
export type EmailProps = {
|
|
13
13
|
errors: Record<string, any>;
|
|
@@ -24,7 +24,7 @@ export type EmailProps = {
|
|
|
24
24
|
* @param Object props Properties passed to the component
|
|
25
25
|
* @returns React.Component
|
|
26
26
|
*/
|
|
27
|
-
declare function Email(props: EmailProps): JSX.Element;
|
|
27
|
+
declare function Email(props: EmailProps): React.JSX.Element;
|
|
28
28
|
declare namespace Email {
|
|
29
29
|
var propTypes: {
|
|
30
30
|
errors: PropTypes.Validator<object>;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-22
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { contentStruct } from '../../';
|
|
12
12
|
export type SMSProps = {
|
|
13
13
|
errors: Record<string, any>;
|
|
@@ -24,7 +24,7 @@ export type SMSProps = {
|
|
|
24
24
|
* @param Object props Properties passed to the component
|
|
25
25
|
* @returns React.Component
|
|
26
26
|
*/
|
|
27
|
-
declare function SMS(props: SMSProps): JSX.Element;
|
|
27
|
+
declare function SMS(props: SMSProps): React.JSX.Element;
|
|
28
28
|
declare namespace SMS {
|
|
29
29
|
var propTypes: {
|
|
30
30
|
errors: PropTypes.Validator<object>;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-22
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { contentStruct } from '../../';
|
|
12
12
|
import { responseErrorStruct } from '@ouroboros/body';
|
|
13
13
|
export type TemplateContentCreateProps = {
|
|
@@ -27,7 +27,7 @@ export type TemplateContentCreateProps = {
|
|
|
27
27
|
* @param Object props Properties passed to the component
|
|
28
28
|
* @returns React.Component
|
|
29
29
|
*/
|
|
30
|
-
declare function Create(props: TemplateContentCreateProps): JSX.Element;
|
|
30
|
+
declare function Create(props: TemplateContentCreateProps): React.JSX.Element;
|
|
31
31
|
declare namespace Create {
|
|
32
32
|
var propTypes: {
|
|
33
33
|
locales: PropTypes.Validator<{
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-22
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { contentStruct } from '../..';
|
|
12
12
|
export type EmailProps = {
|
|
13
13
|
mobile: boolean;
|
|
@@ -23,7 +23,7 @@ export type EmailProps = {
|
|
|
23
23
|
* @param Object props Properties passed to the component
|
|
24
24
|
* @returns React.Component
|
|
25
25
|
*/
|
|
26
|
-
declare function Email(props: EmailProps): JSX.Element;
|
|
26
|
+
declare function Email(props: EmailProps): React.JSX.Element;
|
|
27
27
|
declare namespace Email {
|
|
28
28
|
var propTypes: {
|
|
29
29
|
mobile: PropTypes.Validator<boolean>;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-23
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
export type SMSProps = {
|
|
12
12
|
mobile: boolean;
|
|
13
13
|
value: string;
|
|
@@ -22,7 +22,7 @@ export type SMSProps = {
|
|
|
22
22
|
* @param Object props Properties passed to the component
|
|
23
23
|
* @returns React.Component
|
|
24
24
|
*/
|
|
25
|
-
declare function SMS(props: SMSProps): JSX.Element;
|
|
25
|
+
declare function SMS(props: SMSProps): React.JSX.Element;
|
|
26
26
|
declare namespace SMS {
|
|
27
27
|
var propTypes: {
|
|
28
28
|
mobile: PropTypes.Validator<boolean>;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-23
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { contentStruct } from '../..';
|
|
12
12
|
import { responseErrorStruct } from '@ouroboros/body';
|
|
13
13
|
export type PreviewProps = {
|
|
@@ -26,7 +26,7 @@ export type PreviewProps = {
|
|
|
26
26
|
* @param Object props Properties passed to the component
|
|
27
27
|
* @returns React.Component
|
|
28
28
|
*/
|
|
29
|
-
declare function Preview(props: PreviewProps): JSX.Element;
|
|
29
|
+
declare function Preview(props: PreviewProps): React.JSX.Element;
|
|
30
30
|
declare namespace Preview {
|
|
31
31
|
var propTypes: {
|
|
32
32
|
mobile: PropTypes.Validator<boolean>;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-23
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { contentStruct } from '../../';
|
|
12
12
|
export type EmailProps = {
|
|
13
13
|
errors: Record<string, any>;
|
|
@@ -24,7 +24,7 @@ export type EmailProps = {
|
|
|
24
24
|
* @param Object props Properties passed to the component
|
|
25
25
|
* @returns React.Component
|
|
26
26
|
*/
|
|
27
|
-
declare function Email(props: EmailProps): JSX.Element;
|
|
27
|
+
declare function Email(props: EmailProps): React.JSX.Element;
|
|
28
28
|
declare namespace Email {
|
|
29
29
|
var propTypes: {
|
|
30
30
|
errors: PropTypes.Validator<object>;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-23
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { contentStruct } from '../../';
|
|
12
12
|
export type SMSProps = {
|
|
13
13
|
errors: Record<string, any>;
|
|
@@ -24,7 +24,7 @@ export type SMSProps = {
|
|
|
24
24
|
* @param Object props Properties passed to the component
|
|
25
25
|
* @returns React.Component
|
|
26
26
|
*/
|
|
27
|
-
declare function SMS(props: SMSProps): JSX.Element;
|
|
27
|
+
declare function SMS(props: SMSProps): React.JSX.Element;
|
|
28
28
|
declare namespace SMS {
|
|
29
29
|
var propTypes: {
|
|
30
30
|
errors: PropTypes.Validator<object>;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-22
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { responseErrorStruct } from '@ouroboros/body';
|
|
12
12
|
import { contentStruct } from '../..';
|
|
13
13
|
export type updateStruct = Omit<contentStruct, 'type'>;
|
|
@@ -27,7 +27,7 @@ export type UpdateProps = {
|
|
|
27
27
|
* @param Object props Properties passed to the component
|
|
28
28
|
* @returns React.Component
|
|
29
29
|
*/
|
|
30
|
-
declare function Update(props: UpdateProps): JSX.Element;
|
|
30
|
+
declare function Update(props: UpdateProps): React.JSX.Element;
|
|
31
31
|
declare namespace Update {
|
|
32
32
|
var propTypes: {
|
|
33
33
|
mobile: PropTypes.Validator<boolean>;
|
|
@@ -39,7 +39,7 @@ export default function Update(props) {
|
|
|
39
39
|
// Called to create the new content record
|
|
40
40
|
function update() {
|
|
41
41
|
// Send the record data to the server
|
|
42
|
-
mouth.update(`template/${props.value.type}`, record).then(
|
|
42
|
+
mouth.update(`template/${props.value.type}`, record).then(() => {
|
|
43
43
|
props.onUpdated({ type: props.value.type, ...record });
|
|
44
44
|
}, (error) => {
|
|
45
45
|
if (error.code === errors.body.DATA_FIELDS) {
|
|
@@ -58,7 +58,7 @@ export default function Update(props: UpdateProps) {
|
|
|
58
58
|
function update() {
|
|
59
59
|
|
|
60
60
|
// Send the record data to the server
|
|
61
|
-
mouth.update(`template/${props.value.type}`, record).then(
|
|
61
|
+
mouth.update(`template/${props.value.type}`, record).then(() => {
|
|
62
62
|
props.onUpdated({type: props.value.type, ...record});
|
|
63
63
|
}, (error: responseErrorStruct) => {
|
|
64
64
|
if(error.code === errors.body.DATA_FIELDS) {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-22
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { contentStruct } from '../../';
|
|
12
12
|
export type EmailProps = {
|
|
13
13
|
mobile: boolean;
|
|
@@ -23,7 +23,7 @@ export type EmailProps = {
|
|
|
23
23
|
* @param Object props Properties passed to the component
|
|
24
24
|
* @returns React.Component
|
|
25
25
|
*/
|
|
26
|
-
declare function Email(props: EmailProps): JSX.Element;
|
|
26
|
+
declare function Email(props: EmailProps): React.JSX.Element;
|
|
27
27
|
declare namespace Email {
|
|
28
28
|
var propTypes: {
|
|
29
29
|
mobile: PropTypes.Validator<boolean>;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-22
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { contentStruct } from '../../';
|
|
12
12
|
export type SMSProps = {
|
|
13
13
|
mobile: boolean;
|
|
@@ -23,7 +23,7 @@ export type SMSProps = {
|
|
|
23
23
|
* @param Object props Properties passed to the component
|
|
24
24
|
* @returns React.Component
|
|
25
25
|
*/
|
|
26
|
-
declare function SMS(props: SMSProps): JSX.Element;
|
|
26
|
+
declare function SMS(props: SMSProps): React.JSX.Element;
|
|
27
27
|
declare namespace SMS {
|
|
28
28
|
var propTypes: {
|
|
29
29
|
mobile: PropTypes.Validator<boolean>;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-22
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { responseErrorStruct } from '@ouroboros/body';
|
|
12
12
|
import { contentStruct } from '../..';
|
|
13
13
|
export type ViewProps = {
|
|
@@ -25,7 +25,7 @@ export type ViewProps = {
|
|
|
25
25
|
* @param Object props Properties passed to the component
|
|
26
26
|
* @returns React.Component
|
|
27
27
|
*/
|
|
28
|
-
declare function View(props: ViewProps): JSX.Element;
|
|
28
|
+
declare function View(props: ViewProps): React.JSX.Element;
|
|
29
29
|
declare namespace View {
|
|
30
30
|
var propTypes: {
|
|
31
31
|
mobile: PropTypes.Validator<boolean>;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-20
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
export type VariablesProps = {
|
|
12
12
|
onChange: (variables: Record<string, string>) => void;
|
|
13
13
|
value: Record<string, string>;
|
|
@@ -22,7 +22,7 @@ export type VariablesProps = {
|
|
|
22
22
|
* @param Object props Properties passed to the component
|
|
23
23
|
* @returns React.Component
|
|
24
24
|
*/
|
|
25
|
-
declare function Variables(props: VariablesProps): JSX.Element;
|
|
25
|
+
declare function Variables(props: VariablesProps): React.JSX.Element;
|
|
26
26
|
declare namespace Variables {
|
|
27
27
|
var propTypes: {
|
|
28
28
|
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
@@ -68,7 +68,7 @@ export default function Variables(props) {
|
|
|
68
68
|
// Render
|
|
69
69
|
return (React.createElement(Box, null,
|
|
70
70
|
React.createElement(Grid, { container: true, spacing: 1 },
|
|
71
|
-
omap(props.value, (v, k) => React.createElement(React.Fragment,
|
|
71
|
+
omap(props.value, (v, k) => React.createElement(React.Fragment, { key: k },
|
|
72
72
|
React.createElement(Grid, { item: true, xs: 5 }, k),
|
|
73
73
|
React.createElement(Grid, { item: true, xs: 5 }, v),
|
|
74
74
|
React.createElement(Grid, { item: true, xs: 2 },
|
|
@@ -93,7 +93,7 @@ export default function Variables(props: VariablesProps) {
|
|
|
93
93
|
<Box>
|
|
94
94
|
<Grid container spacing={1}>
|
|
95
95
|
{omap(props.value, (v,k) =>
|
|
96
|
-
<React.Fragment>
|
|
96
|
+
<React.Fragment key={k}>
|
|
97
97
|
<Grid item xs={5}>{k}</Grid>
|
|
98
98
|
<Grid item xs={5}>{v}</Grid>
|
|
99
99
|
<Grid item xs={2}>
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-20
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { responseErrorStruct } from '@ouroboros/body';
|
|
12
|
-
import { rightsStruct } from '@ouroboros/brain-
|
|
12
|
+
import { rightsStruct } from '@ouroboros/brain-react';
|
|
13
13
|
export type contentStruct = {
|
|
14
14
|
_id?: string;
|
|
15
15
|
_created?: number;
|
|
@@ -52,7 +52,7 @@ export type TemplateProps = {
|
|
|
52
52
|
* @param Object props Properties passed to the component
|
|
53
53
|
* @returns React.Component
|
|
54
54
|
*/
|
|
55
|
-
declare function Template(props: TemplateProps): JSX.Element;
|
|
55
|
+
declare function Template(props: TemplateProps): React.JSX.Element;
|
|
56
56
|
declare namespace Template {
|
|
57
57
|
var propTypes: {
|
|
58
58
|
locales: PropTypes.Validator<{
|
|
@@ -38,7 +38,7 @@ import Variables from './Variables';
|
|
|
38
38
|
|
|
39
39
|
// Types
|
|
40
40
|
import { responseErrorStruct } from '@ouroboros/body';
|
|
41
|
-
import { rightsStruct } from '@ouroboros/brain-
|
|
41
|
+
import { rightsStruct } from '@ouroboros/brain-react';
|
|
42
42
|
export type contentStruct = {
|
|
43
43
|
_id?: string,
|
|
44
44
|
_created?: number,
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @author Chris Nasr <chris@ouroboroscoding.com>
|
|
7
7
|
* @created 2023-01-19
|
|
8
8
|
*/
|
|
9
|
-
/// <reference types="react" />
|
|
10
9
|
import PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { responseErrorStruct } from '@ouroboros/body';
|
|
12
12
|
export type TemplatesProps = {
|
|
13
13
|
mobile: boolean;
|
|
@@ -24,7 +24,7 @@ export type TemplatesProps = {
|
|
|
24
24
|
* @param Object props Properties passed to the component
|
|
25
25
|
* @returns React.Component
|
|
26
26
|
*/
|
|
27
|
-
declare function Templates(props: TemplatesProps): JSX.Element;
|
|
27
|
+
declare function Templates(props: TemplatesProps): React.JSX.Element;
|
|
28
28
|
declare namespace Templates {
|
|
29
29
|
var propTypes: {
|
|
30
30
|
mobile: PropTypes.Validator<boolean>;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @created 2023-01-19
|
|
8
8
|
*/
|
|
9
9
|
// Ouroboros modules
|
|
10
|
-
import {
|
|
10
|
+
import { useRights } from '@ouroboros/brain-react';
|
|
11
11
|
import clone from '@ouroboros/clone';
|
|
12
12
|
import mouth from '@ouroboros/mouth';
|
|
13
13
|
import { afindi } from '@ouroboros/tools';
|
|
@@ -37,13 +37,13 @@ export default function Templates(props) {
|
|
|
37
37
|
const [locales, localesSet] = useState({});
|
|
38
38
|
const [templates, templatesSet] = useState([]);
|
|
39
39
|
// Hooks
|
|
40
|
-
const rightsContent =
|
|
41
|
-
const rightsTemplate =
|
|
40
|
+
const rightsContent = useRights('mouth_content');
|
|
41
|
+
const rightsTemplate = useRights('mouth_template');
|
|
42
42
|
// User / archived change effect
|
|
43
43
|
useEffect(() => {
|
|
44
44
|
// If we have template read permissions
|
|
45
45
|
if (rightsTemplate.read) {
|
|
46
|
-
mouth.read('
|
|
46
|
+
mouth.read('locales').then((data) => {
|
|
47
47
|
const oLocales = {};
|
|
48
48
|
for (const o of data) {
|
|
49
49
|
oLocales[o._id] = o.name;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
// Ouroboros modules
|
|
11
|
-
import {
|
|
11
|
+
import { useRights } from '@ouroboros/brain-react';
|
|
12
12
|
import clone from '@ouroboros/clone';
|
|
13
13
|
import mouth from '@ouroboros/mouth';
|
|
14
14
|
import { afindi } from '@ouroboros/tools';
|
|
@@ -52,15 +52,15 @@ export default function Templates(props: TemplatesProps) {
|
|
|
52
52
|
const [templates, templatesSet] = useState<templateStruct[]>([]);
|
|
53
53
|
|
|
54
54
|
// Hooks
|
|
55
|
-
const rightsContent =
|
|
56
|
-
const rightsTemplate =
|
|
55
|
+
const rightsContent = useRights('mouth_content');
|
|
56
|
+
const rightsTemplate = useRights('mouth_template');
|
|
57
57
|
|
|
58
58
|
// User / archived change effect
|
|
59
59
|
useEffect(() => {
|
|
60
60
|
|
|
61
61
|
// If we have template read permissions
|
|
62
62
|
if(rightsTemplate.read) {
|
|
63
|
-
mouth.read('
|
|
63
|
+
mouth.read('locales').then((data: Record<string, any>[]) => {
|
|
64
64
|
const oLocales: Record<string, string> = {};
|
|
65
65
|
for(const o of data) {
|
|
66
66
|
oLocales[o._id] = o.name;
|