proca 0.8.1 → 1.1.5

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.
Files changed (106) hide show
  1. package/README.md +1079 -28
  2. package/package.json +94 -101
  3. package/proca-cli +8 -0
  4. package/src/commands/action/count.mjs +61 -0
  5. package/src/commands/action/list.mjs +204 -0
  6. package/src/commands/action/replay.mjs +54 -0
  7. package/src/commands/campaign/add.mjs +101 -0
  8. package/src/commands/campaign/delete.mjs +61 -0
  9. package/src/commands/campaign/get.mjs +107 -0
  10. package/src/commands/campaign/list.mjs +156 -0
  11. package/src/commands/campaign/queries.graphql +19 -0
  12. package/src/commands/config/add.mjs +101 -0
  13. package/src/commands/config/get.mjs +33 -0
  14. package/src/commands/config/set.mjs +103 -0
  15. package/src/commands/config/token.mjs +34 -0
  16. package/src/commands/config/user.mjs +76 -0
  17. package/src/commands/org/add.mjs +66 -0
  18. package/src/commands/org/crm.mjs +88 -0
  19. package/src/commands/org/delete.mjs +48 -0
  20. package/src/commands/org/get.mjs +97 -0
  21. package/src/commands/org/join.mjs +77 -0
  22. package/src/commands/supporter/count.mjs +96 -0
  23. package/src/commands/user/get.mjs +91 -0
  24. package/src/commands/user/leave.mjs +52 -0
  25. package/src/commands/user/list.mjs +71 -0
  26. package/src/commands/widget/add.mjs +101 -0
  27. package/src/commands/widget/cache.mjs +29 -0
  28. package/src/commands/widget/get.mjs +59 -0
  29. package/src/commands/widget/list.mjs +116 -0
  30. package/src/config.mjs +36 -0
  31. package/src/generated/schema.json +10677 -0
  32. package/src/hooks/help.mjs +14 -0
  33. package/src/hooks/init.mjs +20 -0
  34. package/src/index.mjs +1 -0
  35. package/src/procaCommand.mjs +242 -0
  36. package/src/queries/campaign.mjs +21 -0
  37. package/src/queries/widget.mjs +12 -0
  38. package/src/urql.mjs +60 -0
  39. package/src/util/twitter.mjs +23 -0
  40. package/theme.json +29 -0
  41. package/LICENSE +0 -661
  42. package/dist/App.css +0 -22
  43. package/dist/App.js +0 -25
  44. package/dist/App.test.js +0 -8
  45. package/dist/Wizard.js +0 -32
  46. package/dist/components/Alert.js +0 -49
  47. package/dist/components/Clickify.js +0 -26
  48. package/dist/components/Consent.js +0 -120
  49. package/dist/components/Country.js +0 -94
  50. package/dist/components/Dialog.js +0 -84
  51. package/dist/components/Disabled.js +0 -3
  52. package/dist/components/Emoji.js +0 -12
  53. package/dist/components/FAB.js +0 -70
  54. package/dist/components/Html.js +0 -56
  55. package/dist/components/Loader.js +0 -14
  56. package/dist/components/Openletter.js +0 -443
  57. package/dist/components/Organisation.js +0 -181
  58. package/dist/components/Petition.js +0 -16
  59. package/dist/components/ProcaRoot.js +0 -23
  60. package/dist/components/ProcaStyle.js +0 -94
  61. package/dist/components/ProgressCounter.js +0 -64
  62. package/dist/components/Register.js +0 -345
  63. package/dist/components/Share.js +0 -177
  64. package/dist/components/TextField.js +0 -58
  65. package/dist/components/Twitter.js +0 -127
  66. package/dist/components/TwitterAction.js +0 -111
  67. package/dist/components/TwitterList.js +0 -25
  68. package/dist/components/TwitterText.js +0 -42
  69. package/dist/components/Widget.js +0 -266
  70. package/dist/components/bespoke/Download.js +0 -49
  71. package/dist/components/bespoke/Register-CH.js +0 -505
  72. package/dist/data/countries.json +0 -114
  73. package/dist/hooks/useConfig.js +0 -217
  74. package/dist/hooks/useCount.js +0 -95
  75. package/dist/hooks/useData.js +0 -59
  76. package/dist/hooks/useElementWidth.js +0 -46
  77. package/dist/hooks/useGeoLocation.js +0 -45
  78. package/dist/hooks/useLayout.js +0 -63
  79. package/dist/images/Twitter.js +0 -16
  80. package/dist/images/Twitter.svg +0 -1
  81. package/dist/index.css +0 -13
  82. package/dist/index.js +0 -114
  83. package/dist/lib/domparser.js +0 -12
  84. package/dist/lib/i18n.js +0 -40
  85. package/dist/lib/init.js +0 -7
  86. package/dist/lib/server.js +0 -331
  87. package/dist/lib/urlparser.js +0 -65
  88. package/dist/lib/uuid.js +0 -30
  89. package/dist/locales/README.md +0 -37
  90. package/dist/locales/common.json +0 -189
  91. package/dist/locales/de/common.json +0 -46
  92. package/dist/locales/de/index.js +0 -0
  93. package/dist/locales/en/common.json +0 -45
  94. package/dist/locales/fr/common.json +0 -51
  95. package/dist/locales/index.js +0 -27
  96. package/dist/locales/it/common.json +0 -46
  97. package/dist/logo.svg +0 -1
  98. package/dist/module.js +0 -14
  99. package/dist/slingshot.xcf +0 -0
  100. package/dist/tmp.config/0.json +0 -21
  101. package/dist/tmp.config/2.json +0 -11
  102. package/dist/tmp.config/20.json +0 -29
  103. package/dist/tmp.config/28.json +0 -14
  104. package/dist/tmp.config/32.json +0 -34
  105. package/dist/tmp.config/35.json +0 -14
  106. package/dist/tmp.config/null.json +0 -1
package/dist/App.js DELETED
@@ -1,25 +0,0 @@
1
- import React from "react";
2
- import { Grid } from '@material-ui/core'; //import logo from './logo.svg';
3
- //import './App.css';
4
-
5
- import Petition from "./Petition";
6
- import FABAction from "./FAB";
7
- import { Wizard } from "./Wizard";
8
-
9
- var querystring = require("querystring");
10
-
11
- function App() {
12
- return /*#__PURE__*/React.createElement(Grid, {
13
- container: true,
14
- className: "App"
15
- }, /*#__PURE__*/React.createElement(Grid, {
16
- item: true
17
- }, /*#__PURE__*/React.createElement(Wizard, null)), /*#__PURE__*/React.createElement(Grid, {
18
- item: true
19
- }, /*#__PURE__*/React.createElement(FABAction, null), /*#__PURE__*/React.createElement(Petition, {
20
- margin: "dense",
21
- variant: "filled"
22
- })));
23
- }
24
-
25
- export default App;
package/dist/App.test.js DELETED
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
- import App from "./App";
4
- it('renders without crashing', function () {
5
- var div = document.createElement('div');
6
- ReactDOM.render( /*#__PURE__*/React.createElement(App, null), div);
7
- ReactDOM.unmountComponentAtNode(div);
8
- });
package/dist/Wizard.js DELETED
@@ -1,32 +0,0 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2
-
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
-
5
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
- import React from "react";
8
- import { ButtonGroup, Button } from '@material-ui/core';
9
- var config = {
10
- data: {},
11
- margin: "dense",
12
- variant: "filled",
13
- selector: "#signature-form"
14
- };
15
-
16
- var Wizard = function Wizard(args) {
17
- if (args) config = _objectSpread({}, config, {}, args);
18
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ButtonGroup, {
19
- color: "primary",
20
- "aria-label": "outlined primary button group"
21
- }, /*#__PURE__*/React.createElement(Button, null, "One"), /*#__PURE__*/React.createElement(Button, null, "Two"), /*#__PURE__*/React.createElement(Button, null, "Three")), /*#__PURE__*/React.createElement(ButtonGroup, {
22
- variant: "contained",
23
- color: "primary",
24
- "aria-label": "contained primary button group"
25
- }, /*#__PURE__*/React.createElement(Button, null, "One"), /*#__PURE__*/React.createElement(Button, null, "Two"), /*#__PURE__*/React.createElement(Button, null, "Three")), /*#__PURE__*/React.createElement(ButtonGroup, {
26
- variant: "text",
27
- color: "primary",
28
- "aria-label": "text primary button group"
29
- }, /*#__PURE__*/React.createElement(Button, null, "One"), /*#__PURE__*/React.createElement(Button, null, "Two"), /*#__PURE__*/React.createElement(Button, null, "Three")));
30
- };
31
-
32
- export { config, Wizard };
@@ -1,49 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
- import React from 'react';
14
- import PropTypes from "prop-types";
15
- import Snackbar from "@material-ui/core/Snackbar";
16
- import Alert from "@material-ui/lab/Alert";
17
-
18
- var Component = function Component(props) {
19
- var _React$useState = React.useState(true),
20
- _React$useState2 = _slicedToArray(_React$useState, 2),
21
- open = _React$useState2[0],
22
- setOpen = _React$useState2[1];
23
-
24
- var handleClose = function handleClose() {
25
- setOpen(false);
26
- };
27
-
28
- return /*#__PURE__*/React.createElement(Snackbar, {
29
- open: open,
30
- key: props.text,
31
- onClose: handleClose,
32
- autoHideDuration: props.autoHideDuration
33
- }, /*#__PURE__*/React.createElement(Alert, {
34
- severity: props.severity,
35
- onClose: handleClose
36
- }, props.text));
37
- };
38
-
39
- Component.defaultProps = {
40
- severity: "info",
41
- autoHideDuration: 3000,
42
- text: "Hello"
43
- };
44
- Component.propTypes = {
45
- severity: PropTypes.string,
46
- text: PropTypes.string,
47
- autoHideDuration: PropTypes.number
48
- };
49
- export default Component;
@@ -1,26 +0,0 @@
1
- import { useEffect } from 'react';
2
-
3
- var Component = function Component(props) {
4
- var click = props.done || props.click;
5
- var selector = props.watchSelector;
6
- useEffect(function () {
7
- var d = document.querySelectorAll(selector);
8
- d.forEach(function (e) {
9
- console.log(e);
10
-
11
- e.onclick = function (event) {
12
- event.preventDefault();
13
- click(e);
14
- };
15
- });
16
- }, [click, selector]);
17
- return null;
18
- };
19
-
20
- Component.defaultProps = {
21
- watchSelector: ".proca-button",
22
- click: function click(e) {
23
- return alert("default action, needs to overwrite");
24
- }
25
- };
26
- export default Component;
@@ -1,120 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
- import React, { Fragment } from "react";
14
- import { Box, Grid, Radio, RadioGroup, FormHelperText, FormControlLabel, Collapse } from "@material-ui/core";
15
- import { Alert, AlertTitle } from "@material-ui/lab";
16
- import { useTranslation, Trans } from "react-i18next";
17
- import { useCampaignConfig } from "../hooks/useConfig";
18
- import { useLayout } from "../hooks/useLayout";
19
- import { makeStyles } from "@material-ui/core/styles";
20
- var useStyles = makeStyles(function (theme) {
21
- return {
22
- bigHelper: {
23
- marginLeft: theme.spacing(0),
24
- marginRight: theme.spacing(0),
25
- marginTop: theme.spacing(0),
26
- marginBottom: theme.spacing(0),
27
- fontSize: theme.typography.pxToRem(16),
28
- width: "100%",
29
- color: theme.palette.text.primary,
30
- padding: "4px",
31
- lineHeight: "inherit"
32
- },
33
- label: {
34
- fontSize: theme.typography.pxToRem(13),
35
- color: theme.palette.text.primary,
36
- marginBottom: theme.spacing(0)
37
- },
38
- notice: {
39
- fontSize: theme.typography.pxToRem(13),
40
- fontWeight: 'fontWeightLight',
41
- color: theme.palette.text.secondary,
42
- '& a': {
43
- color: theme.palette.text.secondary
44
- }
45
- }
46
- };
47
- });
48
- export default (function (props) {
49
- var _props$form = props.form,
50
- errors = _props$form.errors,
51
- register = _props$form.register;
52
-
53
- var _useTranslation = useTranslation(),
54
- t = _useTranslation.t;
55
-
56
- var _React$useState = React.useState(false),
57
- _React$useState2 = _slicedToArray(_React$useState, 2),
58
- value = _React$useState2[0],
59
- setValue = _React$useState2[1];
60
-
61
- var config = useCampaignConfig();
62
- var layout = useLayout();
63
- var classes = useStyles();
64
-
65
- var handleChange = function handleChange(event) {
66
- setValue(event.target.value);
67
- };
68
-
69
- var link = config.privacy_url || "https://proca.foundation/privacy_policy";
70
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Grid, {
71
- item: true,
72
- xs: 12
73
- }, /*#__PURE__*/React.createElement(FormHelperText, {
74
- className: classes.bigHelper,
75
- error: errors.privacy,
76
- variant: layout.variant,
77
- margin: layout.margin
78
- }, t("consent.intro", {
79
- name: config.organisation
80
- }), " *")), /*#__PURE__*/React.createElement(Grid, {
81
- item: true,
82
- xs: 12
83
- }, /*#__PURE__*/React.createElement(RadioGroup, {
84
- "aria-label": "privacy consent",
85
- name: "privacy",
86
- onChange: handleChange,
87
- required: true
88
- }, /*#__PURE__*/React.createElement(FormControlLabel, {
89
- value: "opt-in",
90
- inputRef: register,
91
- className: classes.label,
92
- control: /*#__PURE__*/React.createElement(Radio, {
93
- color: "primary"
94
- }),
95
- label: t("consent.opt-in")
96
- }), /*#__PURE__*/React.createElement(FormControlLabel, {
97
- value: "opt-out",
98
- control: /*#__PURE__*/React.createElement(Radio, null),
99
- className: classes.label,
100
- inputRef: register({
101
- required: "Yes or No?"
102
- }),
103
- label: t("consent.opt-out")
104
- }), /*#__PURE__*/React.createElement(Collapse, {
105
- in: value === "opt-out"
106
- }, /*#__PURE__*/React.createElement(Alert, {
107
- severity: "warning"
108
- }, /*#__PURE__*/React.createElement(Trans, {
109
- i18nKey: "consent.confirm"
110
- }, /*#__PURE__*/React.createElement(AlertTitle, null, "Sure?"), /*#__PURE__*/React.createElement("span", null, "explanation"), /*#__PURE__*/React.createElement("b", null, "unsubscribe at any time")))))), /*#__PURE__*/React.createElement(Grid, {
111
- item: true,
112
- xs: 12
113
- }, /*#__PURE__*/React.createElement(Box, {
114
- className: classes.notice
115
- }, /*#__PURE__*/React.createElement(Trans, {
116
- i18nKey: "consent.processing"
117
- }, "Text ", /*#__PURE__*/React.createElement("a", {
118
- href: link
119
- }, "link")))));
120
- });
@@ -1,94 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import useConfig from "../hooks/useConfig";
3
- import { TextField } from "@material-ui/core";
4
- import { useTranslation } from "react-i18next";
5
- import useForm from "react-hook-form";
6
- import useGeoLocation from "react-ipgeolocation";
7
- import { Container, Grid } from "@material-ui/core";
8
- import countries from "../data/countries.json";
9
- export default (function (props) {
10
- var _useConfig = useConfig(),
11
- config = _useConfig.config,
12
- setConfig = _useConfig.setConfig;
13
-
14
- var _useTranslation = useTranslation(),
15
- t = _useTranslation.t;
16
-
17
- var _useForm = useForm({
18
- // mode: "onBlur",
19
- // nativeValidation: true,
20
- defaultValues: config.data
21
- }),
22
- register = _useForm.register,
23
- setValue = _useForm.setValue,
24
- watch = _useForm.watch;
25
-
26
- var country = watch("country") || "";
27
- var location = useGeoLocation({
28
- api: "https://country.proca.foundation"
29
- });
30
-
31
- if (location.country && !country) {
32
- if (!countries.find(function (d) {
33
- return d.iso === location.country;
34
- })) {
35
- console.log("visitor from ", location, "but not on our list");
36
- location.country = countries.find(function (d) {
37
- return d.iso === "ZZ";
38
- }) ? "ZZ" : ""; // if "other" exists, set it
39
- }
40
-
41
- if (location.country) setValue("country", location.country);
42
- }
43
-
44
- useEffect(function () {
45
- if (country === "" || config.country === country) return; //nothing to update
46
- // console.log("set country before:after",config.country,country);
47
-
48
- setConfig("country", country);
49
- }, [country, config, setConfig]);
50
- useEffect(function () {
51
- register({
52
- name: "country"
53
- });
54
- }, [register]);
55
-
56
- var selectChange = function selectChange(e) {
57
- setValue("country", e.target.value);
58
- };
59
-
60
- return /*#__PURE__*/React.createElement(Container, {
61
- component: "main",
62
- maxWidth: "sm"
63
- }, /*#__PURE__*/React.createElement(Grid, {
64
- container: true,
65
- spacing: 1
66
- }, /*#__PURE__*/React.createElement(Grid, {
67
- item: true,
68
- xs: 12
69
- }, /*#__PURE__*/React.createElement(TextField, {
70
- select: true,
71
- id: "country",
72
- name: "country",
73
- label: t("Country"),
74
- variant: config.variant,
75
- inputRef: register //value={defaultValues.country}
76
- ,
77
- value: country,
78
- onChange: selectChange,
79
- InputLabelProps: {
80
- shrink: country.length > 0
81
- },
82
- SelectProps: {
83
- native: true
84
- }
85
- }, /*#__PURE__*/React.createElement("option", {
86
- key: "",
87
- value: ""
88
- }), countries.map(function (option) {
89
- return /*#__PURE__*/React.createElement("option", {
90
- key: option.iso,
91
- value: option.iso
92
- }, option.name);
93
- })))));
94
- });
@@ -1,84 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
14
-
15
- import React, { useState, useEffect } from "react"; //import { Container, Grid } from "@material-ui/core";
16
-
17
- import { makeStyles, useTheme } from "@material-ui/core/styles";
18
- import { Dialog, DialogContent, DialogTitle, useMediaQuery, IconButton } from "@material-ui/core"; //import { useTranslation } from "react-i18next";
19
-
20
- import CloseIcon from "@material-ui/icons/Close";
21
- import Slide from "@material-ui/core/Slide";
22
- var Transition = React.forwardRef(function Transition(props, ref) {
23
- return /*#__PURE__*/React.createElement(Slide, _extends({
24
- direction: "up",
25
- ref: ref
26
- }, props));
27
- });
28
- var useStyles = makeStyles(function (theme) {
29
- return {
30
- dialogTitle: {
31
- display: "flex",
32
- justifyContent: "space-between",
33
- alignItems: "center"
34
- }
35
- };
36
- });
37
-
38
- function OpenDialog(props) {
39
- var _useState = useState(props.dialog || false),
40
- _useState2 = _slicedToArray(_useState, 2),
41
- open = _useState2[0],
42
- setOpen = _useState2[1];
43
-
44
- var _useState3 = useState(props.name || ""),
45
- _useState4 = _slicedToArray(_useState3, 2),
46
- title = _useState4[0],
47
- setTitle = _useState4[1];
48
-
49
- var theme = useTheme();
50
- var fullScreen = useMediaQuery(theme.breakpoints.down("sm"));
51
- useEffect(function () {
52
- return setOpen(props.dialog);
53
- }, [props.dialog]);
54
-
55
- var handleClose = function handleClose() {
56
- setOpen(false);
57
-
58
- if (props.close instanceof Function) {
59
- props.close();
60
- } else {
61
- if (props.done instanceof Function) props.done();
62
- }
63
- };
64
-
65
- var classes = useStyles(); //{React.cloneElement(props.children, { setTitle: setTitle, title: title })}
66
-
67
- return /*#__PURE__*/React.createElement(Dialog, {
68
- open: open,
69
- onClose: handleClose,
70
- TransitionComponent: Transition,
71
- "aria-labelledby": "sign-dialog-title",
72
- fullScreen: fullScreen
73
- }, title ? /*#__PURE__*/React.createElement(DialogTitle, {
74
- className: classes.dialogTitle,
75
- disableTypography: true
76
- }, /*#__PURE__*/React.createElement("h2", null, title), /*#__PURE__*/React.createElement(IconButton, {
77
- onClick: handleClose
78
- }, /*#__PURE__*/React.createElement(CloseIcon, null))) : null, /*#__PURE__*/React.createElement(DialogContent, null, props.children));
79
- }
80
-
81
- OpenDialog.defaultProps = {
82
- dialog: true
83
- };
84
- export default OpenDialog; //export default {Open,Close};
@@ -1,3 +0,0 @@
1
- export default function Disabled(props) {
2
- return "disabled action";
3
- }
@@ -1,12 +0,0 @@
1
- import React from "react";
2
-
3
- var Emoji = function Emoji(props) {
4
- return /*#__PURE__*/React.createElement("span", {
5
- className: "emoji",
6
- role: "img",
7
- "aria-label": props.label ? props.label : "",
8
- "aria-hidden": props.label ? "false" : "true"
9
- }, props.symbol);
10
- };
11
-
12
- export default Emoji;
@@ -1,70 +0,0 @@
1
- import React from "react"; //import { Container, Grid } from "@material-ui/core";
2
-
3
- import { makeStyles } from "@material-ui/core/styles";
4
- import { Fab, Button, Slide, Badge } from "@material-ui/core"; //import DialogActions from '@material-ui/core/DialogActions';
5
- //import DialogContentText from '@material-ui/core/DialogContentText';
6
-
7
- import { useTranslation } from "react-i18next";
8
- import useCount from "../hooks/useCount.js"; //import CloseIcon from "@material-ui/icons/Close";
9
-
10
- import CreateIcon from "@material-ui/icons/Create";
11
- var useStyles = makeStyles(function (theme) {
12
- return {
13
- fab: {
14
- margin: 0,
15
- top: "auto",
16
- right: 20,
17
- bottom: 20,
18
- left: "auto",
19
- position: "fixed"
20
- },
21
- dialogTitle: {
22
- display: "flex",
23
- justifyContent: "space-between",
24
- alignItems: "center"
25
- }
26
- };
27
- });
28
- /*const Transition = React.forwardRef(function Transition(props, ref) {
29
- return <Slide direction="up" ref={ref} {...props} />;
30
- });
31
- */
32
-
33
- export default function FABAction(props) {
34
- // const theme = useTheme();
35
- var _useTranslation = useTranslation(),
36
- t = _useTranslation.t;
37
-
38
- var counter = useCount(props.actionPage);
39
-
40
- var handleClickOpen = function handleClickOpen() {
41
- props.done();
42
- };
43
-
44
- var classes = useStyles();
45
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
46
- variant: "contained",
47
- fullWidth: true,
48
- type: "submit",
49
- size: "large",
50
- onClick: handleClickOpen,
51
- endIcon: /*#__PURE__*/React.createElement(CreateIcon, null)
52
- }, " ", t("Sign now!")), /*#__PURE__*/React.createElement("div", {
53
- className: classes.fab
54
- }, /*#__PURE__*/React.createElement(Slide, {
55
- direction: "right",
56
- mountOnEnter: true,
57
- unmountOnExit: true,
58
- in: true
59
- }, /*#__PURE__*/React.createElement(Badge, {
60
- badgeContent: counter,
61
- max: 9999999,
62
- color: "secondary",
63
- overlap: "circle"
64
- }, /*#__PURE__*/React.createElement(Fab, {
65
- color: "primary",
66
- variant: "extended",
67
- "aria-label": t("Sign now!"),
68
- onClick: handleClickOpen
69
- }, /*#__PURE__*/React.createElement(CreateIcon, null), t("Sign now!"), "\xA0")))));
70
- }
@@ -1,56 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
-
7
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
8
-
9
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
11
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
- import React, { useLayoutEffect, useState } from 'react';
14
- import Alert from "./Alert";
15
- import useConfig from "../hooks/useConfig";
16
-
17
- function Component(props) {
18
- var config = useConfig().config;
19
- console.log(config);
20
-
21
- var _useState = useState(null),
22
- _useState2 = _slicedToArray(_useState, 2),
23
- error = _useState2[0],
24
- setError = _useState2[1];
25
-
26
- useLayoutEffect(function () {
27
- var dom = props.dom || '.proca-html';
28
-
29
- var replacer = function replacer(v) {
30
- // replace tokens {fieldname} by config.data[fieldname] (if it exists)
31
- var k = v.slice(1, -1);
32
- return config.data[k] || v;
33
- };
34
-
35
- try {
36
- var template = document.querySelector(dom);
37
- template.style.display = "none";
38
- document.getElementById('proca-html-root').innerHTML = template.innerHTML.replace(/(\{[^}]+\})/g, replacer); // document.getElementById('proca-html-root').innerHTML= template.innerHTML;
39
- } catch (e) {
40
- setError("missing template dom with class " + dom);
41
- console.log(e);
42
- } // return () => {};
43
-
44
- }, [props.dom, config.data]);
45
- return error ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Alert, {
46
- severity: "error",
47
- text: error
48
- }), /*#__PURE__*/React.createElement("span", {
49
- role: "img",
50
- "aria-label": "error"
51
- }, "\uD83D\uDC1B")) : /*#__PURE__*/React.createElement("div", {
52
- id: "proca-html-root"
53
- }, "...");
54
- }
55
-
56
- export default Component;
@@ -1,14 +0,0 @@
1
- import { useEffect } from 'react';
2
-
3
- var Component = function Component(props) {
4
- useEffect(function () {
5
- if (typeof window[props.loader] === "function") {
6
- setTimeout(window[props.loader], 1);
7
- } else {
8
- console.log("missing function ", props.loader);
9
- }
10
- }, [props.loader]);
11
- return null;
12
- };
13
-
14
- export default Component;