code7-leia 0.1.80 → 0.1.83

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.
@@ -17,9 +17,312 @@ var md = require('react-icons/md');
17
17
  var reactDropzone = require('react-dropzone');
18
18
  var pi = require('react-icons/pi');
19
19
  var redux = require('redux');
20
- require('redux-persist');
20
+ var createSagaMiddleware = _interopDefault(require('redux-saga'));
21
21
  var immer = require('immer');
22
+ var effects = require('redux-saga/effects');
23
+ var axios = _interopDefault(require('axios'));
22
24
 
25
+ function _regeneratorRuntime() {
26
+ _regeneratorRuntime = function () {
27
+ return e;
28
+ };
29
+ var t,
30
+ e = {},
31
+ r = Object.prototype,
32
+ n = r.hasOwnProperty,
33
+ o = Object.defineProperty || function (t, e, r) {
34
+ t[e] = r.value;
35
+ },
36
+ i = "function" == typeof Symbol ? Symbol : {},
37
+ a = i.iterator || "@@iterator",
38
+ c = i.asyncIterator || "@@asyncIterator",
39
+ u = i.toStringTag || "@@toStringTag";
40
+ function define(t, e, r) {
41
+ return Object.defineProperty(t, e, {
42
+ value: r,
43
+ enumerable: !0,
44
+ configurable: !0,
45
+ writable: !0
46
+ }), t[e];
47
+ }
48
+ try {
49
+ define({}, "");
50
+ } catch (t) {
51
+ define = function (t, e, r) {
52
+ return t[e] = r;
53
+ };
54
+ }
55
+ function wrap(t, e, r, n) {
56
+ var i = e && e.prototype instanceof Generator ? e : Generator,
57
+ a = Object.create(i.prototype),
58
+ c = new Context(n || []);
59
+ return o(a, "_invoke", {
60
+ value: makeInvokeMethod(t, r, c)
61
+ }), a;
62
+ }
63
+ function tryCatch(t, e, r) {
64
+ try {
65
+ return {
66
+ type: "normal",
67
+ arg: t.call(e, r)
68
+ };
69
+ } catch (t) {
70
+ return {
71
+ type: "throw",
72
+ arg: t
73
+ };
74
+ }
75
+ }
76
+ e.wrap = wrap;
77
+ var h = "suspendedStart",
78
+ l = "suspendedYield",
79
+ f = "executing",
80
+ s = "completed",
81
+ y = {};
82
+ function Generator() {}
83
+ function GeneratorFunction() {}
84
+ function GeneratorFunctionPrototype() {}
85
+ var p = {};
86
+ define(p, a, function () {
87
+ return this;
88
+ });
89
+ var d = Object.getPrototypeOf,
90
+ v = d && d(d(values([])));
91
+ v && v !== r && n.call(v, a) && (p = v);
92
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
93
+ function defineIteratorMethods(t) {
94
+ ["next", "throw", "return"].forEach(function (e) {
95
+ define(t, e, function (t) {
96
+ return this._invoke(e, t);
97
+ });
98
+ });
99
+ }
100
+ function AsyncIterator(t, e) {
101
+ function invoke(r, o, i, a) {
102
+ var c = tryCatch(t[r], t, o);
103
+ if ("throw" !== c.type) {
104
+ var u = c.arg,
105
+ h = u.value;
106
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
107
+ invoke("next", t, i, a);
108
+ }, function (t) {
109
+ invoke("throw", t, i, a);
110
+ }) : e.resolve(h).then(function (t) {
111
+ u.value = t, i(u);
112
+ }, function (t) {
113
+ return invoke("throw", t, i, a);
114
+ });
115
+ }
116
+ a(c.arg);
117
+ }
118
+ var r;
119
+ o(this, "_invoke", {
120
+ value: function (t, n) {
121
+ function callInvokeWithMethodAndArg() {
122
+ return new e(function (e, r) {
123
+ invoke(t, n, e, r);
124
+ });
125
+ }
126
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
127
+ }
128
+ });
129
+ }
130
+ function makeInvokeMethod(e, r, n) {
131
+ var o = h;
132
+ return function (i, a) {
133
+ if (o === f) throw new Error("Generator is already running");
134
+ if (o === s) {
135
+ if ("throw" === i) throw a;
136
+ return {
137
+ value: t,
138
+ done: !0
139
+ };
140
+ }
141
+ for (n.method = i, n.arg = a;;) {
142
+ var c = n.delegate;
143
+ if (c) {
144
+ var u = maybeInvokeDelegate(c, n);
145
+ if (u) {
146
+ if (u === y) continue;
147
+ return u;
148
+ }
149
+ }
150
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
151
+ if (o === h) throw o = s, n.arg;
152
+ n.dispatchException(n.arg);
153
+ } else "return" === n.method && n.abrupt("return", n.arg);
154
+ o = f;
155
+ var p = tryCatch(e, r, n);
156
+ if ("normal" === p.type) {
157
+ if (o = n.done ? s : l, p.arg === y) continue;
158
+ return {
159
+ value: p.arg,
160
+ done: n.done
161
+ };
162
+ }
163
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
164
+ }
165
+ };
166
+ }
167
+ function maybeInvokeDelegate(e, r) {
168
+ var n = r.method,
169
+ o = e.iterator[n];
170
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
171
+ var i = tryCatch(o, e.iterator, r.arg);
172
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
173
+ var a = i.arg;
174
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
175
+ }
176
+ function pushTryEntry(t) {
177
+ var e = {
178
+ tryLoc: t[0]
179
+ };
180
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
181
+ }
182
+ function resetTryEntry(t) {
183
+ var e = t.completion || {};
184
+ e.type = "normal", delete e.arg, t.completion = e;
185
+ }
186
+ function Context(t) {
187
+ this.tryEntries = [{
188
+ tryLoc: "root"
189
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
190
+ }
191
+ function values(e) {
192
+ if (e || "" === e) {
193
+ var r = e[a];
194
+ if (r) return r.call(e);
195
+ if ("function" == typeof e.next) return e;
196
+ if (!isNaN(e.length)) {
197
+ var o = -1,
198
+ i = function next() {
199
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
200
+ return next.value = t, next.done = !0, next;
201
+ };
202
+ return i.next = i;
203
+ }
204
+ }
205
+ throw new TypeError(typeof e + " is not iterable");
206
+ }
207
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
208
+ value: GeneratorFunctionPrototype,
209
+ configurable: !0
210
+ }), o(GeneratorFunctionPrototype, "constructor", {
211
+ value: GeneratorFunction,
212
+ configurable: !0
213
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
214
+ var e = "function" == typeof t && t.constructor;
215
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
216
+ }, e.mark = function (t) {
217
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
218
+ }, e.awrap = function (t) {
219
+ return {
220
+ __await: t
221
+ };
222
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
223
+ return this;
224
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
225
+ void 0 === i && (i = Promise);
226
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
227
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
228
+ return t.done ? t.value : a.next();
229
+ });
230
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
231
+ return this;
232
+ }), define(g, "toString", function () {
233
+ return "[object Generator]";
234
+ }), e.keys = function (t) {
235
+ var e = Object(t),
236
+ r = [];
237
+ for (var n in e) r.push(n);
238
+ return r.reverse(), function next() {
239
+ for (; r.length;) {
240
+ var t = r.pop();
241
+ if (t in e) return next.value = t, next.done = !1, next;
242
+ }
243
+ return next.done = !0, next;
244
+ };
245
+ }, e.values = values, Context.prototype = {
246
+ constructor: Context,
247
+ reset: function (e) {
248
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
249
+ },
250
+ stop: function () {
251
+ this.done = !0;
252
+ var t = this.tryEntries[0].completion;
253
+ if ("throw" === t.type) throw t.arg;
254
+ return this.rval;
255
+ },
256
+ dispatchException: function (e) {
257
+ if (this.done) throw e;
258
+ var r = this;
259
+ function handle(n, o) {
260
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
261
+ }
262
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
263
+ var i = this.tryEntries[o],
264
+ a = i.completion;
265
+ if ("root" === i.tryLoc) return handle("end");
266
+ if (i.tryLoc <= this.prev) {
267
+ var c = n.call(i, "catchLoc"),
268
+ u = n.call(i, "finallyLoc");
269
+ if (c && u) {
270
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
271
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
272
+ } else if (c) {
273
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
274
+ } else {
275
+ if (!u) throw new Error("try statement without catch or finally");
276
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
277
+ }
278
+ }
279
+ }
280
+ },
281
+ abrupt: function (t, e) {
282
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
283
+ var o = this.tryEntries[r];
284
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
285
+ var i = o;
286
+ break;
287
+ }
288
+ }
289
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
290
+ var a = i ? i.completion : {};
291
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
292
+ },
293
+ complete: function (t, e) {
294
+ if ("throw" === t.type) throw t.arg;
295
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
296
+ },
297
+ finish: function (t) {
298
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
299
+ var r = this.tryEntries[e];
300
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
301
+ }
302
+ },
303
+ catch: function (t) {
304
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
305
+ var r = this.tryEntries[e];
306
+ if (r.tryLoc === t) {
307
+ var n = r.completion;
308
+ if ("throw" === n.type) {
309
+ var o = n.arg;
310
+ resetTryEntry(r);
311
+ }
312
+ return o;
313
+ }
314
+ }
315
+ throw new Error("illegal catch attempt");
316
+ },
317
+ delegateYield: function (e, r, n) {
318
+ return this.delegate = {
319
+ iterator: values(e),
320
+ resultName: r,
321
+ nextLoc: n
322
+ }, "next" === this.method && (this.arg = t), y;
323
+ }
324
+ }, e;
325
+ }
23
326
  function _extends() {
24
327
  _extends = Object.assign ? Object.assign.bind() : function (target) {
25
328
  for (var i = 1; i < arguments.length; i++) {
@@ -695,6 +998,13 @@ var getFilesAction = function getFilesAction(payload) {
695
998
  payload: payload
696
999
  };
697
1000
  };
1001
+ var getFilesActionSuccess = function getFilesActionSuccess(data) {
1002
+ console.log('------------getFilesActionSuccess------------->', data);
1003
+ return {
1004
+ type: Types.GET_FILES_SUCCESS,
1005
+ payload: data
1006
+ };
1007
+ };
698
1008
 
699
1009
  var FileArea = function FileArea() {
700
1010
  var _useState = React.useState([]),
@@ -714,17 +1024,17 @@ var FileArea = function FileArea() {
714
1024
  language = _useSharedProps.language;
715
1025
  var t = getLanguage(language);
716
1026
  var dispatch = reactRedux.useDispatch();
717
- // const initFiles = useSelector((state: any) => state.files);
1027
+ var initFiles = reactRedux.useSelector(function (state) {
1028
+ return state.files;
1029
+ });
718
1030
  var tags = ["pae", "boteria", "vr", "code7", "vidalink"];
719
1031
  React.useEffect(function () {
720
1032
  console.log('useEffect, []');
721
1033
  dispatch(getFilesAction(id));
722
1034
  }, []);
723
- // useEffect(() => {
724
- // console.log(initFiles)
725
- // setFiles(initFiles)
726
- // setInitialFiles(initFiles)
727
- // }, [initFiles])
1035
+ React.useEffect(function () {
1036
+ console.log(initFiles);
1037
+ }, [initFiles]);
728
1038
  React.useEffect(function () {
729
1039
  setInitialFiles([]);
730
1040
  }, [files]);
@@ -980,7 +1290,56 @@ function filesReducer(state, action) {
980
1290
  });
981
1291
  }
982
1292
 
983
- var store = /*#__PURE__*/redux.createStore(filesReducer);
1293
+ var url = 'http://localhost:5000';
1294
+ axios.defaults.baseURL = "" + url;
1295
+ var api = /*#__PURE__*/axios.create();
1296
+
1297
+ var _marked = /*#__PURE__*/_regeneratorRuntime().mark(getFilesSaga),
1298
+ _marked2 = /*#__PURE__*/_regeneratorRuntime().mark(filesSagas);
1299
+ function getFilesSaga(action) {
1300
+ var _yield$call, data;
1301
+ return _regeneratorRuntime().wrap(function getFilesSaga$(_context) {
1302
+ while (1) switch (_context.prev = _context.next) {
1303
+ case 0:
1304
+ _context.prev = 0;
1305
+ console.log('action.payload', action.payload);
1306
+ _context.next = 4;
1307
+ return effects.call(api.get, "/files/" + action.payload);
1308
+ case 4:
1309
+ _yield$call = _context.sent;
1310
+ data = _yield$call.data;
1311
+ console.log('-----------getFiles------------------->', data.files);
1312
+ _context.next = 9;
1313
+ return effects.put(getFilesActionSuccess(data.files));
1314
+ case 9:
1315
+ _context.next = 14;
1316
+ break;
1317
+ case 11:
1318
+ _context.prev = 11;
1319
+ _context.t0 = _context["catch"](0);
1320
+ console.log('-----------getFiles.error------------------->', _context.t0);
1321
+ case 14:
1322
+ case "end":
1323
+ return _context.stop();
1324
+ }
1325
+ }, _marked, null, [[0, 11]]);
1326
+ }
1327
+ function filesSagas() {
1328
+ return _regeneratorRuntime().wrap(function filesSagas$(_context2) {
1329
+ while (1) switch (_context2.prev = _context2.next) {
1330
+ case 0:
1331
+ _context2.next = 2;
1332
+ return effects.all([effects.takeLatest(Types.GET_FILES_REQUEST, getFilesSaga)]);
1333
+ case 2:
1334
+ case "end":
1335
+ return _context2.stop();
1336
+ }
1337
+ }, _marked2);
1338
+ }
1339
+
1340
+ var sagaMiddleware = /*#__PURE__*/createSagaMiddleware();
1341
+ var store = /*#__PURE__*/redux.createStore(filesReducer, /*#__PURE__*/redux.applyMiddleware(sagaMiddleware));
1342
+ sagaMiddleware.run(filesSagas);
984
1343
 
985
1344
  function Code7(props) {
986
1345
  return React__default.createElement(reactRedux.Provider, {