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.
- package/README.md +1079 -28
- package/package.json +94 -101
- package/proca-cli +8 -0
- package/src/commands/action/count.mjs +61 -0
- package/src/commands/action/list.mjs +204 -0
- package/src/commands/action/replay.mjs +54 -0
- package/src/commands/campaign/add.mjs +101 -0
- package/src/commands/campaign/delete.mjs +61 -0
- package/src/commands/campaign/get.mjs +107 -0
- package/src/commands/campaign/list.mjs +156 -0
- package/src/commands/campaign/queries.graphql +19 -0
- package/src/commands/config/add.mjs +101 -0
- package/src/commands/config/get.mjs +33 -0
- package/src/commands/config/set.mjs +103 -0
- package/src/commands/config/token.mjs +34 -0
- package/src/commands/config/user.mjs +76 -0
- package/src/commands/org/add.mjs +66 -0
- package/src/commands/org/crm.mjs +88 -0
- package/src/commands/org/delete.mjs +48 -0
- package/src/commands/org/get.mjs +97 -0
- package/src/commands/org/join.mjs +77 -0
- package/src/commands/supporter/count.mjs +96 -0
- package/src/commands/user/get.mjs +91 -0
- package/src/commands/user/leave.mjs +52 -0
- package/src/commands/user/list.mjs +71 -0
- package/src/commands/widget/add.mjs +101 -0
- package/src/commands/widget/cache.mjs +29 -0
- package/src/commands/widget/get.mjs +59 -0
- package/src/commands/widget/list.mjs +116 -0
- package/src/config.mjs +36 -0
- package/src/generated/schema.json +10677 -0
- package/src/hooks/help.mjs +14 -0
- package/src/hooks/init.mjs +20 -0
- package/src/index.mjs +1 -0
- package/src/procaCommand.mjs +242 -0
- package/src/queries/campaign.mjs +21 -0
- package/src/queries/widget.mjs +12 -0
- package/src/urql.mjs +60 -0
- package/src/util/twitter.mjs +23 -0
- package/theme.json +29 -0
- package/LICENSE +0 -661
- package/dist/App.css +0 -22
- package/dist/App.js +0 -25
- package/dist/App.test.js +0 -8
- package/dist/Wizard.js +0 -32
- package/dist/components/Alert.js +0 -49
- package/dist/components/Clickify.js +0 -26
- package/dist/components/Consent.js +0 -120
- package/dist/components/Country.js +0 -94
- package/dist/components/Dialog.js +0 -84
- package/dist/components/Disabled.js +0 -3
- package/dist/components/Emoji.js +0 -12
- package/dist/components/FAB.js +0 -70
- package/dist/components/Html.js +0 -56
- package/dist/components/Loader.js +0 -14
- package/dist/components/Openletter.js +0 -443
- package/dist/components/Organisation.js +0 -181
- package/dist/components/Petition.js +0 -16
- package/dist/components/ProcaRoot.js +0 -23
- package/dist/components/ProcaStyle.js +0 -94
- package/dist/components/ProgressCounter.js +0 -64
- package/dist/components/Register.js +0 -345
- package/dist/components/Share.js +0 -177
- package/dist/components/TextField.js +0 -58
- package/dist/components/Twitter.js +0 -127
- package/dist/components/TwitterAction.js +0 -111
- package/dist/components/TwitterList.js +0 -25
- package/dist/components/TwitterText.js +0 -42
- package/dist/components/Widget.js +0 -266
- package/dist/components/bespoke/Download.js +0 -49
- package/dist/components/bespoke/Register-CH.js +0 -505
- package/dist/data/countries.json +0 -114
- package/dist/hooks/useConfig.js +0 -217
- package/dist/hooks/useCount.js +0 -95
- package/dist/hooks/useData.js +0 -59
- package/dist/hooks/useElementWidth.js +0 -46
- package/dist/hooks/useGeoLocation.js +0 -45
- package/dist/hooks/useLayout.js +0 -63
- package/dist/images/Twitter.js +0 -16
- package/dist/images/Twitter.svg +0 -1
- package/dist/index.css +0 -13
- package/dist/index.js +0 -114
- package/dist/lib/domparser.js +0 -12
- package/dist/lib/i18n.js +0 -40
- package/dist/lib/init.js +0 -7
- package/dist/lib/server.js +0 -331
- package/dist/lib/urlparser.js +0 -65
- package/dist/lib/uuid.js +0 -30
- package/dist/locales/README.md +0 -37
- package/dist/locales/common.json +0 -189
- package/dist/locales/de/common.json +0 -46
- package/dist/locales/de/index.js +0 -0
- package/dist/locales/en/common.json +0 -45
- package/dist/locales/fr/common.json +0 -51
- package/dist/locales/index.js +0 -27
- package/dist/locales/it/common.json +0 -46
- package/dist/logo.svg +0 -1
- package/dist/module.js +0 -14
- package/dist/slingshot.xcf +0 -0
- package/dist/tmp.config/0.json +0 -21
- package/dist/tmp.config/2.json +0 -11
- package/dist/tmp.config/20.json +0 -29
- package/dist/tmp.config/28.json +0 -14
- package/dist/tmp.config/32.json +0 -34
- package/dist/tmp.config/35.json +0 -14
- package/dist/tmp.config/null.json +0 -1
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
|
-
|
|
3
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
|
-
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
|
|
7
|
-
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."); }
|
|
8
|
-
|
|
9
|
-
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); }
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
|
-
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; }
|
|
14
|
-
|
|
15
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
|
|
17
|
-
import React, { useEffect, useState } from "react";
|
|
18
|
-
import PropTypes from 'prop-types';
|
|
19
|
-
import { Container, Grid, Box } from "@material-ui/core";
|
|
20
|
-
/*import Backdrop from '@material-ui/core/Backdrop';
|
|
21
|
-
import CircularProgress from '@material-ui/core/CircularProgress';
|
|
22
|
-
|
|
23
|
-
<Backdrop className={classes.backdrop} open={open} onClick={handleClose}>
|
|
24
|
-
<CircularProgress color="inherit" />
|
|
25
|
-
</Backdrop>
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
import useElementWidth from "../hooks/useElementWidth";
|
|
29
|
-
import useConfig from "../hooks/useConfig";
|
|
30
|
-
import { makeStyles } from "@material-ui/core/styles";
|
|
31
|
-
import { TextField, Radio, RadioGroup, FormControlLabel, Button, FormHelperText, Snackbar } from "@material-ui/core";
|
|
32
|
-
import Alert from "@material-ui/lab/Alert";
|
|
33
|
-
import SendIcon from "@material-ui/icons/Send";
|
|
34
|
-
import DoneIcon from "@material-ui/icons/Done";
|
|
35
|
-
import useForm from "react-hook-form";
|
|
36
|
-
import useGeoLocation from "react-ipgeolocation";
|
|
37
|
-
import { useTranslation } from "react-i18next";
|
|
38
|
-
import countries from "../data/countries.json";
|
|
39
|
-
import { addActionContact } from "../lib/server.js";
|
|
40
|
-
import uuid from "../lib/uuid.js";
|
|
41
|
-
var useStyles = makeStyles(function (theme) {
|
|
42
|
-
return {
|
|
43
|
-
container: {
|
|
44
|
-
display: "flex",
|
|
45
|
-
flexWrap: "wrap"
|
|
46
|
-
},
|
|
47
|
-
notice: {
|
|
48
|
-
fontSize: theme.typography.pxToRem(13),
|
|
49
|
-
fontWeight: 'fontWeightLight',
|
|
50
|
-
color: theme.palette.text.disabled
|
|
51
|
-
},
|
|
52
|
-
bigHelper: {
|
|
53
|
-
marginLeft: theme.spacing(0),
|
|
54
|
-
marginRight: theme.spacing(0),
|
|
55
|
-
marginTop: theme.spacing(0),
|
|
56
|
-
marginBottom: theme.spacing(0),
|
|
57
|
-
fontSize: theme.typography.pxToRem(16),
|
|
58
|
-
width: "100%",
|
|
59
|
-
color: "black",
|
|
60
|
-
padding: "4px",
|
|
61
|
-
lineHeight: "inherit"
|
|
62
|
-
},
|
|
63
|
-
textField: {
|
|
64
|
-
marginLeft: theme.spacing(0),
|
|
65
|
-
marginRight: theme.spacing(0),
|
|
66
|
-
width: "100%"
|
|
67
|
-
},
|
|
68
|
-
"#petition-form": {
|
|
69
|
-
position: "relative"
|
|
70
|
-
},
|
|
71
|
-
"@global": {
|
|
72
|
-
"select:-moz-focusring": {
|
|
73
|
-
color: "transparent",
|
|
74
|
-
textShadow: "0 0 0 #000"
|
|
75
|
-
},
|
|
76
|
-
"input:valid + fieldset": {
|
|
77
|
-
borderColor: "green",
|
|
78
|
-
borderWidth: 2
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
export default function Register(props) {
|
|
84
|
-
var classes = useStyles();
|
|
85
|
-
|
|
86
|
-
var _useConfig = useConfig(),
|
|
87
|
-
config = _useConfig.config;
|
|
88
|
-
|
|
89
|
-
var _useTranslation = useTranslation(),
|
|
90
|
-
t = _useTranslation.t;
|
|
91
|
-
|
|
92
|
-
var width = useElementWidth('#proca-register');
|
|
93
|
-
|
|
94
|
-
var _useState = useState(true),
|
|
95
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
96
|
-
compact = _useState2[0],
|
|
97
|
-
setCompact = _useState2[1];
|
|
98
|
-
|
|
99
|
-
if (compact && width > 450 || !compact && width <= 450) setCompact(width <= 450);
|
|
100
|
-
|
|
101
|
-
var _useState3 = useState("default"),
|
|
102
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
103
|
-
status = _useState4[0],
|
|
104
|
-
setStatus = _useState4[1];
|
|
105
|
-
|
|
106
|
-
var _useForm = useForm({
|
|
107
|
-
// mode: "onBlur",
|
|
108
|
-
// nativeValidation: true,
|
|
109
|
-
defaultValues: config.data
|
|
110
|
-
}),
|
|
111
|
-
register = _useForm.register,
|
|
112
|
-
handleSubmit = _useForm.handleSubmit,
|
|
113
|
-
setValue = _useForm.setValue,
|
|
114
|
-
errors = _useForm.errors,
|
|
115
|
-
setError = _useForm.setError,
|
|
116
|
-
clearError = _useForm.clearError,
|
|
117
|
-
watch = _useForm.watch,
|
|
118
|
-
formState = _useForm.formState; // const { register, handleSubmit, setValue, errors } = useForm({ mode: 'onBlur', defaultValues: defaultValues });
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var country = watch("country") || "";
|
|
122
|
-
var location = useGeoLocation({
|
|
123
|
-
api: "https://country.proca.foundation"
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
if (location.country && !country) {
|
|
127
|
-
if (!countries.find(function (d) {
|
|
128
|
-
return d.iso === location.country;
|
|
129
|
-
})) {
|
|
130
|
-
console.log("visitor from ", location, "but not on our list");
|
|
131
|
-
location.country = countries.find(function (d) {
|
|
132
|
-
return d.iso === "ZZ";
|
|
133
|
-
}) ? "ZZ" : ""; // if "other" exists, set it
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (location.country) setValue("country", location.country);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
var options = {
|
|
140
|
-
margin: config.margin || "dense",
|
|
141
|
-
variant: config.variant || "filled"
|
|
142
|
-
};
|
|
143
|
-
var buttonText = config.locales && config.locales.register || t("register");
|
|
144
|
-
console.log(buttonText); //variant: standard, filled, outlined
|
|
145
|
-
//margin: normal, dense
|
|
146
|
-
|
|
147
|
-
var onSubmit = /*#__PURE__*/function () {
|
|
148
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(data) {
|
|
149
|
-
var result;
|
|
150
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
151
|
-
while (1) {
|
|
152
|
-
switch (_context.prev = _context.next) {
|
|
153
|
-
case 0:
|
|
154
|
-
data.tracking = config.utm;
|
|
155
|
-
_context.next = 3;
|
|
156
|
-
return addActionContact("register", config.actionPage, data);
|
|
157
|
-
|
|
158
|
-
case 3:
|
|
159
|
-
result = _context.sent;
|
|
160
|
-
|
|
161
|
-
if (!result.errors) {
|
|
162
|
-
_context.next = 8;
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
result.errors.forEach(function (error) {
|
|
167
|
-
console.log(error);
|
|
168
|
-
});
|
|
169
|
-
setStatus("error");
|
|
170
|
-
return _context.abrupt("return");
|
|
171
|
-
|
|
172
|
-
case 8:
|
|
173
|
-
setStatus("success");
|
|
174
|
-
uuid(result.addAction); // set the global uuid as signature's fingerprint
|
|
175
|
-
|
|
176
|
-
if (props.done) props.done({
|
|
177
|
-
errors: result.errors,
|
|
178
|
-
uuid: uuid(),
|
|
179
|
-
firstname: data.firstname,
|
|
180
|
-
country: data.country
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
case 11:
|
|
184
|
-
case "end":
|
|
185
|
-
return _context.stop();
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}, _callee);
|
|
189
|
-
}));
|
|
190
|
-
|
|
191
|
-
return function onSubmit(_x) {
|
|
192
|
-
return _ref.apply(this, arguments);
|
|
193
|
-
};
|
|
194
|
-
}();
|
|
195
|
-
|
|
196
|
-
useEffect(function () {
|
|
197
|
-
register({
|
|
198
|
-
name: "country"
|
|
199
|
-
});
|
|
200
|
-
}, [register]);
|
|
201
|
-
useEffect(function () {
|
|
202
|
-
var inputs = document.querySelectorAll("input, select, textarea"); // todo: workaround until the feature is native react-form ?
|
|
203
|
-
|
|
204
|
-
inputs.forEach(function (input) {
|
|
205
|
-
input.oninvalid = function (e) {
|
|
206
|
-
setError(e.target.attributes.name.nodeValue, e.type, e.target.validationMessage);
|
|
207
|
-
};
|
|
208
|
-
});
|
|
209
|
-
}, [register, setError]);
|
|
210
|
-
|
|
211
|
-
var selectChange = function selectChange(e) {
|
|
212
|
-
setValue("country", e.target.value);
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
var handleBlur = function handleBlur(e) {
|
|
216
|
-
e.target.checkValidity();
|
|
217
|
-
|
|
218
|
-
if (e.target.validity.valid) {
|
|
219
|
-
clearError(e.target.attributes.name.nodeValue);
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
function Error(props) {
|
|
225
|
-
if (props.display) return /*#__PURE__*/React.createElement(Snackbar, {
|
|
226
|
-
open: true,
|
|
227
|
-
autoHideDuration: 6000
|
|
228
|
-
}, /*#__PURE__*/React.createElement(Alert, {
|
|
229
|
-
severity: "error"
|
|
230
|
-
}, "Sorry, we couldn't save your signature!", /*#__PURE__*/React.createElement("br", null), "The techies have been informed."));
|
|
231
|
-
return null;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
function Success(props) {
|
|
235
|
-
if (props.display) return /*#__PURE__*/React.createElement(Snackbar, {
|
|
236
|
-
open: true,
|
|
237
|
-
autoHideDuration: 6000
|
|
238
|
-
}, /*#__PURE__*/React.createElement(Alert, {
|
|
239
|
-
severity: "success"
|
|
240
|
-
}, "Done, Thank you for your support!"));
|
|
241
|
-
return null;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (status === "success") {
|
|
245
|
-
return /*#__PURE__*/React.createElement(Container, {
|
|
246
|
-
component: "main",
|
|
247
|
-
maxWidth: "sm"
|
|
248
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
249
|
-
container: true,
|
|
250
|
-
spacing: 1
|
|
251
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
252
|
-
item: true,
|
|
253
|
-
xs: 12
|
|
254
|
-
}, /*#__PURE__*/React.createElement(DoneIcon, {
|
|
255
|
-
color: "action",
|
|
256
|
-
fontSize: "large",
|
|
257
|
-
my: 4
|
|
258
|
-
}))));
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return /*#__PURE__*/React.createElement("form", {
|
|
262
|
-
className: classes.container,
|
|
263
|
-
id: "proca-register",
|
|
264
|
-
onSubmit: handleSubmit(onSubmit),
|
|
265
|
-
method: "post",
|
|
266
|
-
url: "http://localhost"
|
|
267
|
-
}, /*#__PURE__*/React.createElement(Success, {
|
|
268
|
-
display: status === "success"
|
|
269
|
-
}), /*#__PURE__*/React.createElement(Error, {
|
|
270
|
-
display: status === "error"
|
|
271
|
-
}), /*#__PURE__*/React.createElement(Container, {
|
|
272
|
-
component: "main",
|
|
273
|
-
maxWidth: "sm"
|
|
274
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
275
|
-
container: true,
|
|
276
|
-
spacing: 1
|
|
277
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
278
|
-
item: true,
|
|
279
|
-
xs: 12,
|
|
280
|
-
sm: compact ? 12 : 6
|
|
281
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
282
|
-
id: "firstname",
|
|
283
|
-
name: "firstname",
|
|
284
|
-
label: t("First name"),
|
|
285
|
-
className: classes.textField,
|
|
286
|
-
placeholder: "eg. Leonardo",
|
|
287
|
-
autoComplete: "given-name",
|
|
288
|
-
required: true,
|
|
289
|
-
inputRef: register,
|
|
290
|
-
onBlur: handleBlur,
|
|
291
|
-
error: !!(errors && errors.firstname),
|
|
292
|
-
helperText: errors && errors.firstname && errors.firstname.message,
|
|
293
|
-
variant: options.variant,
|
|
294
|
-
margin: options.margin
|
|
295
|
-
})), /*#__PURE__*/React.createElement(Grid, {
|
|
296
|
-
item: true,
|
|
297
|
-
xs: 12,
|
|
298
|
-
sm: compact ? 12 : 6
|
|
299
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
300
|
-
id: "lastname",
|
|
301
|
-
name: "lastname",
|
|
302
|
-
label: t("Last name"),
|
|
303
|
-
autoComplete: "family-name",
|
|
304
|
-
className: classes.textField,
|
|
305
|
-
variant: options.variant,
|
|
306
|
-
margin: options.margin,
|
|
307
|
-
inputRef: register,
|
|
308
|
-
placeholder: "eg. Da Vinci"
|
|
309
|
-
})), /*#__PURE__*/React.createElement(Grid, {
|
|
310
|
-
item: true,
|
|
311
|
-
xs: 12
|
|
312
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
313
|
-
id: "email",
|
|
314
|
-
name: "email",
|
|
315
|
-
type: "email",
|
|
316
|
-
label: t("Email"),
|
|
317
|
-
autoComplete: "email",
|
|
318
|
-
className: classes.textField,
|
|
319
|
-
inputRef: register,
|
|
320
|
-
onBlur: handleBlur,
|
|
321
|
-
error: !!errors.email,
|
|
322
|
-
helperText: errors && errors.email && errors.email.message,
|
|
323
|
-
variant: options.variant,
|
|
324
|
-
margin: options.margin,
|
|
325
|
-
placeholder: "your.email@example.org",
|
|
326
|
-
required: true
|
|
327
|
-
})), /*#__PURE__*/React.createElement(Grid, {
|
|
328
|
-
item: true,
|
|
329
|
-
xs: 12,
|
|
330
|
-
sm: compact ? 12 : 3
|
|
331
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
332
|
-
id: "postcode",
|
|
333
|
-
name: "postcode",
|
|
334
|
-
label: t("Postal Code"),
|
|
335
|
-
autoComplete: "postal-code",
|
|
336
|
-
inputRef: register,
|
|
337
|
-
className: classes.textField,
|
|
338
|
-
variant: options.variant,
|
|
339
|
-
margin: options.margin
|
|
340
|
-
})), /*#__PURE__*/React.createElement(Grid, {
|
|
341
|
-
item: true,
|
|
342
|
-
xs: 12,
|
|
343
|
-
sm: compact ? 12 : 9
|
|
344
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
345
|
-
select: true,
|
|
346
|
-
id: "country",
|
|
347
|
-
name: "country",
|
|
348
|
-
label: t("Country"),
|
|
349
|
-
className: classes.textField,
|
|
350
|
-
variant: options.variant,
|
|
351
|
-
inputRef: register //value={defaultValues.country}
|
|
352
|
-
,
|
|
353
|
-
value: country,
|
|
354
|
-
onChange: selectChange,
|
|
355
|
-
InputLabelProps: {
|
|
356
|
-
shrink: country.length > 0
|
|
357
|
-
},
|
|
358
|
-
SelectProps: {
|
|
359
|
-
native: true,
|
|
360
|
-
MenuProps: {
|
|
361
|
-
className: classes.menu
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
|
-
margin: options.margin,
|
|
365
|
-
required: true
|
|
366
|
-
}, /*#__PURE__*/React.createElement("option", {
|
|
367
|
-
key: "",
|
|
368
|
-
value: ""
|
|
369
|
-
}), countries.map(function (option) {
|
|
370
|
-
return /*#__PURE__*/React.createElement("option", {
|
|
371
|
-
key: option.iso,
|
|
372
|
-
value: option.iso
|
|
373
|
-
}, option.name);
|
|
374
|
-
}))), /*#__PURE__*/React.createElement(Grid, {
|
|
375
|
-
item: true,
|
|
376
|
-
xs: 12
|
|
377
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
378
|
-
id: "comment",
|
|
379
|
-
name: "comment",
|
|
380
|
-
className: classes.textField,
|
|
381
|
-
multiline: true,
|
|
382
|
-
rowsMax: "20",
|
|
383
|
-
label: t("Comment"),
|
|
384
|
-
inputRef: register,
|
|
385
|
-
variant: options.variant,
|
|
386
|
-
margin: options.margin
|
|
387
|
-
})), /*#__PURE__*/React.createElement(Grid, {
|
|
388
|
-
item: true,
|
|
389
|
-
xs: 12
|
|
390
|
-
}, /*#__PURE__*/React.createElement(FormHelperText, {
|
|
391
|
-
className: classes.bigHelper,
|
|
392
|
-
error: errors.privacy,
|
|
393
|
-
variant: options.variant,
|
|
394
|
-
margin: options.margin
|
|
395
|
-
}, t("consent.intro", {
|
|
396
|
-
name: props.organisation
|
|
397
|
-
}), " *")), /*#__PURE__*/React.createElement(Grid, {
|
|
398
|
-
item: true,
|
|
399
|
-
xs: 12
|
|
400
|
-
}, /*#__PURE__*/React.createElement(RadioGroup, {
|
|
401
|
-
"aria-label": "privacy consent",
|
|
402
|
-
name: "privacy",
|
|
403
|
-
required: true
|
|
404
|
-
}, /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
405
|
-
value: "opt-in",
|
|
406
|
-
inputRef: register,
|
|
407
|
-
control: /*#__PURE__*/React.createElement(Radio, {
|
|
408
|
-
color: "primary"
|
|
409
|
-
}),
|
|
410
|
-
label: t("consent.opt-in")
|
|
411
|
-
}), /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
412
|
-
value: "opt-out",
|
|
413
|
-
control: /*#__PURE__*/React.createElement(Radio, null),
|
|
414
|
-
inputRef: register({
|
|
415
|
-
required: "Yes or No?"
|
|
416
|
-
}),
|
|
417
|
-
label: t("consent.opt-out")
|
|
418
|
-
}))), /*#__PURE__*/React.createElement(Grid, {
|
|
419
|
-
item: true,
|
|
420
|
-
xs: 12
|
|
421
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
422
|
-
className: classes.notice
|
|
423
|
-
}, t("consent.processing", {
|
|
424
|
-
privacy_url: "https://proca.foundation/privacy"
|
|
425
|
-
}))), /*#__PURE__*/React.createElement(Grid, {
|
|
426
|
-
item: true,
|
|
427
|
-
xs: 12
|
|
428
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
429
|
-
color: "primary",
|
|
430
|
-
variant: "contained",
|
|
431
|
-
fullWidth: true,
|
|
432
|
-
type: "submit",
|
|
433
|
-
size: "large",
|
|
434
|
-
disabled: formState.isSubmitting,
|
|
435
|
-
endIcon: /*#__PURE__*/React.createElement(SendIcon, null)
|
|
436
|
-
}, " ", buttonText)))));
|
|
437
|
-
}
|
|
438
|
-
Register.propTypes = {
|
|
439
|
-
actionPage: PropTypes.number.isRequired
|
|
440
|
-
};
|
|
441
|
-
Register.defaultProps = {
|
|
442
|
-
buttonText: "Register"
|
|
443
|
-
};
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
|
-
|
|
3
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
|
-
|
|
5
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
-
|
|
7
|
-
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."); }
|
|
8
|
-
|
|
9
|
-
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); }
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
|
-
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; }
|
|
14
|
-
|
|
15
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
-
|
|
17
|
-
import React, { useState } from "react";
|
|
18
|
-
import { useTranslation } from "react-i18next"; //import useConfig from "../hooks/useConfig";
|
|
19
|
-
|
|
20
|
-
import { Grid } from "@material-ui/core";
|
|
21
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
22
|
-
import InputAdornment from "@material-ui/core/InputAdornment";
|
|
23
|
-
import TwitterIcon from "../images/Twitter.js";
|
|
24
|
-
import SvgIcon from "@material-ui/core/SvgIcon";
|
|
25
|
-
import TextField from "./TextField";
|
|
26
|
-
import List from '@material-ui/core/List';
|
|
27
|
-
import ListItem from "@material-ui/core/ListItem";
|
|
28
|
-
import ListItemText from "@material-ui/core/ListItemText";
|
|
29
|
-
import ListItemAvatar from "@material-ui/core/ListItemAvatar";
|
|
30
|
-
import Avatar from "@material-ui/core/Avatar";
|
|
31
|
-
var useStyles = makeStyles(function (theme) {
|
|
32
|
-
return {
|
|
33
|
-
profile: {
|
|
34
|
-
backgroundColor: theme.palette.background.paper,
|
|
35
|
-
padding: "2px"
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
export default (function (props) {
|
|
40
|
-
var classes = useStyles();
|
|
41
|
-
|
|
42
|
-
var _useTranslation = useTranslation(),
|
|
43
|
-
t = _useTranslation.t; // const { config } = useConfig();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var _useState = useState({
|
|
47
|
-
name: t("Your organisation account")
|
|
48
|
-
}),
|
|
49
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
-
profile = _useState2[0],
|
|
51
|
-
setProfile = _useState2[1];
|
|
52
|
-
|
|
53
|
-
var compact = props.compact;
|
|
54
|
-
var _props$form = props.form,
|
|
55
|
-
setValue = _props$form.setValue,
|
|
56
|
-
setError = _props$form.setError,
|
|
57
|
-
watch = _props$form.watch;
|
|
58
|
-
var field = watch(["organisation", "picture", "comment"]); //variant={options.variant}
|
|
59
|
-
//margin={options.margin}
|
|
60
|
-
|
|
61
|
-
var handleBlur = function handleBlur(e) {
|
|
62
|
-
props.form.handleBlur(e);
|
|
63
|
-
if (!e.target.value) return;
|
|
64
|
-
var api = "https://twitter-proxy.tttp.workers.dev/?screen_name=" + e.target.value; // const api = "https://twitter.proca.app/?screen_name="+e.target.value;
|
|
65
|
-
|
|
66
|
-
var field = e.target.attributes.name.nodeValue;
|
|
67
|
-
|
|
68
|
-
function fetchAPI() {
|
|
69
|
-
return _fetchAPI.apply(this, arguments);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function _fetchAPI() {
|
|
73
|
-
_fetchAPI = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
74
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
75
|
-
while (1) {
|
|
76
|
-
switch (_context.prev = _context.next) {
|
|
77
|
-
case 0:
|
|
78
|
-
_context.next = 2;
|
|
79
|
-
return fetch(api).then(function (res) {
|
|
80
|
-
if (!res.ok) {
|
|
81
|
-
throw Error(res.statusText);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return res.json();
|
|
85
|
-
}).then(function (res) {
|
|
86
|
-
if (res && res.error) {
|
|
87
|
-
setProfile({
|
|
88
|
-
name: "?",
|
|
89
|
-
url: "",
|
|
90
|
-
description: ""
|
|
91
|
-
});
|
|
92
|
-
setError(field, "api", res.message.errors[0].message);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
setProfile(res);
|
|
97
|
-
setValue("url", res.url);
|
|
98
|
-
var domain = new URL(res.url).hostname;
|
|
99
|
-
domain && setValue("email", "@" + domain);
|
|
100
|
-
setValue("followers_count", res.followers_count);
|
|
101
|
-
setValue("organisation", res.name);
|
|
102
|
-
setValue("picture", res.profile_image_url_https);
|
|
103
|
-
setValue("comment", res.description);
|
|
104
|
-
}).catch(function (err) {
|
|
105
|
-
console.log(err);
|
|
106
|
-
setProfile({
|
|
107
|
-
name: "?",
|
|
108
|
-
url: "",
|
|
109
|
-
description: ""
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
case 2:
|
|
114
|
-
case "end":
|
|
115
|
-
return _context.stop();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}, _callee);
|
|
119
|
-
}));
|
|
120
|
-
return _fetchAPI.apply(this, arguments);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
fetchAPI();
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Grid, {
|
|
127
|
-
item: true,
|
|
128
|
-
xs: 12,
|
|
129
|
-
sm: compact ? 12 : 4
|
|
130
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
131
|
-
name: "twitter",
|
|
132
|
-
onBlur: handleBlur,
|
|
133
|
-
InputProps: {
|
|
134
|
-
endAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
|
|
135
|
-
position: "end"
|
|
136
|
-
}, /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement(TwitterIcon, null)))
|
|
137
|
-
},
|
|
138
|
-
required: true,
|
|
139
|
-
label: t("Account"),
|
|
140
|
-
form: props.form
|
|
141
|
-
})), /*#__PURE__*/React.createElement(Grid, {
|
|
142
|
-
item: true,
|
|
143
|
-
xs: 12,
|
|
144
|
-
sm: compact ? 12 : 8
|
|
145
|
-
}, /*#__PURE__*/React.createElement(List, {
|
|
146
|
-
className: classes.profile,
|
|
147
|
-
dense: true,
|
|
148
|
-
disablePadding: true
|
|
149
|
-
}, /*#__PURE__*/React.createElement(ListItem, {
|
|
150
|
-
alignItems: "flex-start"
|
|
151
|
-
}, /*#__PURE__*/React.createElement(ListItemAvatar, null, /*#__PURE__*/React.createElement(Avatar, {
|
|
152
|
-
src: field.picture
|
|
153
|
-
}, "?")), /*#__PURE__*/React.createElement(ListItemText, {
|
|
154
|
-
primary: field.organisation,
|
|
155
|
-
secondary: field.comment
|
|
156
|
-
})))), profile.id ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Grid, {
|
|
157
|
-
item: true,
|
|
158
|
-
xs: 12,
|
|
159
|
-
sm: compact ? 12 : 4
|
|
160
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
161
|
-
name: "organisation",
|
|
162
|
-
required: true,
|
|
163
|
-
form: props.form
|
|
164
|
-
})), /*#__PURE__*/React.createElement(Grid, {
|
|
165
|
-
item: true,
|
|
166
|
-
xs: 12,
|
|
167
|
-
sm: compact ? 12 : 8
|
|
168
|
-
}, /*#__PURE__*/React.createElement(TextField, {
|
|
169
|
-
name: "picture",
|
|
170
|
-
type: "url",
|
|
171
|
-
form: props.form
|
|
172
|
-
}), /*#__PURE__*/React.createElement("input", {
|
|
173
|
-
type: "hidden",
|
|
174
|
-
ref: props.form.register,
|
|
175
|
-
name: "url"
|
|
176
|
-
}), /*#__PURE__*/React.createElement("input", {
|
|
177
|
-
type: "hidden",
|
|
178
|
-
ref: props.form.register,
|
|
179
|
-
name: "followers_count"
|
|
180
|
-
}))) : null);
|
|
181
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
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); }
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
import ProgressCounter from "./ProgressCounter";
|
|
6
|
-
import Register from "./Register";
|
|
7
|
-
export default function SignatureForm(props) {
|
|
8
|
-
var _useTranslation = useTranslation(),
|
|
9
|
-
t = _useTranslation.t;
|
|
10
|
-
|
|
11
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ProgressCounter, {
|
|
12
|
-
actionPage: props.actionPage
|
|
13
|
-
}), /*#__PURE__*/React.createElement(Register, _extends({}, props, {
|
|
14
|
-
buttonText: t("Sign now!")
|
|
15
|
-
})));
|
|
16
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { RecoilRoot } from 'recoil';
|
|
3
|
-
import ProcaStyle from "./ProcaStyle.js";
|
|
4
|
-
import { ConfigProvider } from "../hooks/useConfig";
|
|
5
|
-
export default function Container(props) {
|
|
6
|
-
var go = props.go || function (action) {
|
|
7
|
-
return console.log("go,action");
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
var actions = props.actions || {};
|
|
11
|
-
var config = props.config || {
|
|
12
|
-
// data: Url.data(),
|
|
13
|
-
// utm: Url.utm(),
|
|
14
|
-
hook: {},
|
|
15
|
-
param: {}
|
|
16
|
-
};
|
|
17
|
-
return /*#__PURE__*/React.createElement(RecoilRoot, null, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
18
|
-
go: go,
|
|
19
|
-
actions: actions,
|
|
20
|
-
config: config
|
|
21
|
-
}, /*#__PURE__*/React.createElement(ProcaStyle, null, props.children)));
|
|
22
|
-
}
|
|
23
|
-
;
|