@plasmicpkgs/plasmic-contentful 0.0.49 → 0.0.51
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/dist/contentful.d.ts +8 -6
- package/dist/plasmic-contentful.cjs.development.js +286 -322
- package/dist/plasmic-contentful.cjs.development.js.map +1 -1
- package/dist/plasmic-contentful.cjs.production.min.js +1 -1
- package/dist/plasmic-contentful.cjs.production.min.js.map +1 -1
- package/dist/plasmic-contentful.esm.js +286 -322
- package/dist/plasmic-contentful.esm.js.map +1 -1
- package/dist/utils.d.ts +5 -0
- package/package.json +9 -9
|
@@ -10,7 +10,6 @@ var richTextHtmlRenderer = require('@contentful/rich-text-html-renderer');
|
|
|
10
10
|
var host = require('@plasmicapp/host');
|
|
11
11
|
var query = require('@plasmicapp/query');
|
|
12
12
|
var changeCase = require('change-case');
|
|
13
|
-
var Contentful = require('contentful');
|
|
14
13
|
var get = _interopDefault(require('dlv'));
|
|
15
14
|
var React = require('react');
|
|
16
15
|
var React__default = _interopDefault(React);
|
|
@@ -23,29 +22,24 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
23
22
|
reject(error);
|
|
24
23
|
return;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
if (info.done) {
|
|
28
26
|
resolve(value);
|
|
29
27
|
} else {
|
|
30
28
|
Promise.resolve(value).then(_next, _throw);
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
function _asyncToGenerator(fn) {
|
|
35
32
|
return function () {
|
|
36
33
|
var self = this,
|
|
37
|
-
|
|
34
|
+
args = arguments;
|
|
38
35
|
return new Promise(function (resolve, reject) {
|
|
39
36
|
var gen = fn.apply(self, args);
|
|
40
|
-
|
|
41
37
|
function _next(value) {
|
|
42
38
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
43
39
|
}
|
|
44
|
-
|
|
45
40
|
function _throw(err) {
|
|
46
41
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
47
42
|
}
|
|
48
|
-
|
|
49
43
|
_next(undefined);
|
|
50
44
|
});
|
|
51
45
|
};
|
|
@@ -62,17 +56,16 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
62
56
|
* This source code is licensed under the MIT license found in the
|
|
63
57
|
* LICENSE file in the root directory of this source tree.
|
|
64
58
|
*/
|
|
59
|
+
|
|
65
60
|
var runtime = function (exports) {
|
|
66
61
|
|
|
67
62
|
var Op = Object.prototype;
|
|
68
63
|
var hasOwn = Op.hasOwnProperty;
|
|
69
64
|
var undefined$1; // More compressible than void 0.
|
|
70
|
-
|
|
71
65
|
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
72
66
|
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
73
67
|
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
74
68
|
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
75
|
-
|
|
76
69
|
function define(obj, key, value) {
|
|
77
70
|
Object.defineProperty(obj, key, {
|
|
78
71
|
value: value,
|
|
@@ -82,7 +75,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
82
75
|
});
|
|
83
76
|
return obj[key];
|
|
84
77
|
}
|
|
85
|
-
|
|
86
78
|
try {
|
|
87
79
|
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
88
80
|
define({}, "");
|
|
@@ -91,19 +83,20 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
91
83
|
return obj[key] = value;
|
|
92
84
|
};
|
|
93
85
|
}
|
|
94
|
-
|
|
95
86
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
96
87
|
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
97
88
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
98
89
|
var generator = Object.create(protoGenerator.prototype);
|
|
99
|
-
var context = new Context(tryLocsList || []);
|
|
100
|
-
// .throw, and .return methods.
|
|
90
|
+
var context = new Context(tryLocsList || []);
|
|
101
91
|
|
|
92
|
+
// The ._invoke method unifies the implementations of the .next,
|
|
93
|
+
// .throw, and .return methods.
|
|
102
94
|
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
103
95
|
return generator;
|
|
104
96
|
}
|
|
97
|
+
exports.wrap = wrap;
|
|
105
98
|
|
|
106
|
-
|
|
99
|
+
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
107
100
|
// record like context.tryEntries[i].completion. This interface could
|
|
108
101
|
// have been (and was previously) designed to take a closure to be
|
|
109
102
|
// invoked without arguments, but in all the cases we care about we
|
|
@@ -113,7 +106,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
113
106
|
// in every case, so we don't have to touch the arguments object. The
|
|
114
107
|
// only additional allocation required is the completion record, which
|
|
115
108
|
// has a stable shape and so hopefully should be cheap to allocate.
|
|
116
|
-
|
|
117
109
|
function tryCatch(fn, obj, arg) {
|
|
118
110
|
try {
|
|
119
111
|
return {
|
|
@@ -127,46 +119,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
127
119
|
};
|
|
128
120
|
}
|
|
129
121
|
}
|
|
130
|
-
|
|
131
122
|
var GenStateSuspendedStart = "suspendedStart";
|
|
132
123
|
var GenStateSuspendedYield = "suspendedYield";
|
|
133
124
|
var GenStateExecuting = "executing";
|
|
134
|
-
var GenStateCompleted = "completed";
|
|
125
|
+
var GenStateCompleted = "completed";
|
|
126
|
+
|
|
127
|
+
// Returning this object from the innerFn has the same effect as
|
|
135
128
|
// breaking out of the dispatch switch statement.
|
|
129
|
+
var ContinueSentinel = {};
|
|
136
130
|
|
|
137
|
-
|
|
131
|
+
// Dummy constructor functions that we use as the .constructor and
|
|
138
132
|
// .constructor.prototype properties for functions that return Generator
|
|
139
133
|
// objects. For full spec compliance, you may wish to configure your
|
|
140
134
|
// minifier not to mangle the names of these two functions.
|
|
141
|
-
|
|
142
135
|
function Generator() {}
|
|
143
|
-
|
|
144
136
|
function GeneratorFunction() {}
|
|
137
|
+
function GeneratorFunctionPrototype() {}
|
|
145
138
|
|
|
146
|
-
|
|
139
|
+
// This is a polyfill for %IteratorPrototype% for environments that
|
|
147
140
|
// don't natively support it.
|
|
148
|
-
|
|
149
|
-
|
|
150
141
|
var IteratorPrototype = {};
|
|
151
142
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
152
143
|
return this;
|
|
153
144
|
});
|
|
154
145
|
var getProto = Object.getPrototypeOf;
|
|
155
146
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
156
|
-
|
|
157
147
|
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
158
148
|
// This environment has a native %IteratorPrototype%; use it instead
|
|
159
149
|
// of the polyfill.
|
|
160
150
|
IteratorPrototype = NativeIteratorPrototype;
|
|
161
151
|
}
|
|
162
|
-
|
|
163
152
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
164
153
|
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
165
154
|
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
166
155
|
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
167
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
168
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
156
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction");
|
|
169
157
|
|
|
158
|
+
// Helper for defining the .next, .throw, and .return methods of the
|
|
159
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
170
160
|
function defineIteratorMethods(prototype) {
|
|
171
161
|
["next", "throw", "return"].forEach(function (method) {
|
|
172
162
|
define(prototype, method, function (arg) {
|
|
@@ -174,14 +164,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
174
164
|
});
|
|
175
165
|
});
|
|
176
166
|
}
|
|
177
|
-
|
|
178
167
|
exports.isGeneratorFunction = function (genFun) {
|
|
179
168
|
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
180
|
-
return ctor ? ctor === GeneratorFunction ||
|
|
169
|
+
return ctor ? ctor === GeneratorFunction ||
|
|
170
|
+
// For the native GeneratorFunction constructor, the best we can
|
|
181
171
|
// do is to check its .name property.
|
|
182
172
|
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
183
173
|
};
|
|
184
|
-
|
|
185
174
|
exports.mark = function (genFun) {
|
|
186
175
|
if (Object.setPrototypeOf) {
|
|
187
176
|
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
@@ -189,31 +178,27 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
189
178
|
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
190
179
|
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
191
180
|
}
|
|
192
|
-
|
|
193
181
|
genFun.prototype = Object.create(Gp);
|
|
194
182
|
return genFun;
|
|
195
|
-
};
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// Within the body of any async function, `await x` is transformed to
|
|
196
186
|
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
197
187
|
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
198
188
|
// meant to be awaited.
|
|
199
|
-
|
|
200
|
-
|
|
201
189
|
exports.awrap = function (arg) {
|
|
202
190
|
return {
|
|
203
191
|
__await: arg
|
|
204
192
|
};
|
|
205
193
|
};
|
|
206
|
-
|
|
207
194
|
function AsyncIterator(generator, PromiseImpl) {
|
|
208
195
|
function invoke(method, arg, resolve, reject) {
|
|
209
196
|
var record = tryCatch(generator[method], generator, arg);
|
|
210
|
-
|
|
211
197
|
if (record.type === "throw") {
|
|
212
198
|
reject(record.arg);
|
|
213
199
|
} else {
|
|
214
200
|
var result = record.arg;
|
|
215
201
|
var value = result.value;
|
|
216
|
-
|
|
217
202
|
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
218
203
|
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
219
204
|
invoke("next", value, resolve, reject);
|
|
@@ -221,7 +206,6 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
221
206
|
invoke("throw", err, resolve, reject);
|
|
222
207
|
});
|
|
223
208
|
}
|
|
224
|
-
|
|
225
209
|
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
226
210
|
// When a yielded Promise is resolved, its final value becomes
|
|
227
211
|
// the .value of the Promise<{value,done}> result for the
|
|
@@ -235,17 +219,15 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
235
219
|
});
|
|
236
220
|
}
|
|
237
221
|
}
|
|
238
|
-
|
|
239
222
|
var previousPromise;
|
|
240
|
-
|
|
241
223
|
function enqueue(method, arg) {
|
|
242
224
|
function callInvokeWithMethodAndArg() {
|
|
243
225
|
return new PromiseImpl(function (resolve, reject) {
|
|
244
226
|
invoke(method, arg, resolve, reject);
|
|
245
227
|
});
|
|
246
228
|
}
|
|
247
|
-
|
|
248
|
-
|
|
229
|
+
return previousPromise =
|
|
230
|
+
// If enqueue has been called before, then we want to wait until
|
|
249
231
|
// all previous Promises have been resolved before calling invoke,
|
|
250
232
|
// so that results are always delivered in the correct order. If
|
|
251
233
|
// enqueue has not been called before, then it is important to
|
|
@@ -257,24 +239,25 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
257
239
|
// execute code before the first await. Since we implement simple
|
|
258
240
|
// async functions in terms of async generators, it is especially
|
|
259
241
|
// important to get this right, even though it requires care.
|
|
260
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
242
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
|
|
243
|
+
// Avoid propagating failures to Promises returned by later
|
|
261
244
|
// invocations of the iterator.
|
|
262
245
|
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
263
|
-
}
|
|
264
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
265
|
-
|
|
246
|
+
}
|
|
266
247
|
|
|
248
|
+
// Define the unified helper method that is used to implement .next,
|
|
249
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
267
250
|
this._invoke = enqueue;
|
|
268
251
|
}
|
|
269
|
-
|
|
270
252
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
271
253
|
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
272
254
|
return this;
|
|
273
255
|
});
|
|
274
|
-
exports.AsyncIterator = AsyncIterator;
|
|
256
|
+
exports.AsyncIterator = AsyncIterator;
|
|
257
|
+
|
|
258
|
+
// Note that simple async functions are implemented on top of
|
|
275
259
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
276
260
|
// the final result produced by the iterator.
|
|
277
|
-
|
|
278
261
|
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
279
262
|
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
280
263
|
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
@@ -283,39 +266,32 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
283
266
|
return result.done ? result.value : iter.next();
|
|
284
267
|
});
|
|
285
268
|
};
|
|
286
|
-
|
|
287
269
|
function makeInvokeMethod(innerFn, self, context) {
|
|
288
270
|
var state = GenStateSuspendedStart;
|
|
289
271
|
return function invoke(method, arg) {
|
|
290
272
|
if (state === GenStateExecuting) {
|
|
291
273
|
throw new Error("Generator is already running");
|
|
292
274
|
}
|
|
293
|
-
|
|
294
275
|
if (state === GenStateCompleted) {
|
|
295
276
|
if (method === "throw") {
|
|
296
277
|
throw arg;
|
|
297
|
-
}
|
|
298
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
299
|
-
|
|
278
|
+
}
|
|
300
279
|
|
|
280
|
+
// Be forgiving, per 25.3.3.3.3 of the spec:
|
|
281
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
301
282
|
return doneResult();
|
|
302
283
|
}
|
|
303
|
-
|
|
304
284
|
context.method = method;
|
|
305
285
|
context.arg = arg;
|
|
306
|
-
|
|
307
286
|
while (true) {
|
|
308
287
|
var delegate = context.delegate;
|
|
309
|
-
|
|
310
288
|
if (delegate) {
|
|
311
289
|
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
312
|
-
|
|
313
290
|
if (delegateResult) {
|
|
314
291
|
if (delegateResult === ContinueSentinel) continue;
|
|
315
292
|
return delegateResult;
|
|
316
293
|
}
|
|
317
294
|
}
|
|
318
|
-
|
|
319
295
|
if (context.method === "next") {
|
|
320
296
|
// Setting context._sent for legacy support of Babel's
|
|
321
297
|
// function.sent implementation.
|
|
@@ -325,51 +301,44 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
325
301
|
state = GenStateCompleted;
|
|
326
302
|
throw context.arg;
|
|
327
303
|
}
|
|
328
|
-
|
|
329
304
|
context.dispatchException(context.arg);
|
|
330
305
|
} else if (context.method === "return") {
|
|
331
306
|
context.abrupt("return", context.arg);
|
|
332
307
|
}
|
|
333
|
-
|
|
334
308
|
state = GenStateExecuting;
|
|
335
309
|
var record = tryCatch(innerFn, self, context);
|
|
336
|
-
|
|
337
310
|
if (record.type === "normal") {
|
|
338
311
|
// If an exception is thrown from innerFn, we leave state ===
|
|
339
312
|
// GenStateExecuting and loop back for another invocation.
|
|
340
313
|
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
341
|
-
|
|
342
314
|
if (record.arg === ContinueSentinel) {
|
|
343
315
|
continue;
|
|
344
316
|
}
|
|
345
|
-
|
|
346
317
|
return {
|
|
347
318
|
value: record.arg,
|
|
348
319
|
done: context.done
|
|
349
320
|
};
|
|
350
321
|
} else if (record.type === "throw") {
|
|
351
|
-
state = GenStateCompleted;
|
|
322
|
+
state = GenStateCompleted;
|
|
323
|
+
// Dispatch the exception by looping back around to the
|
|
352
324
|
// context.dispatchException(context.arg) call above.
|
|
353
|
-
|
|
354
325
|
context.method = "throw";
|
|
355
326
|
context.arg = record.arg;
|
|
356
327
|
}
|
|
357
328
|
}
|
|
358
329
|
};
|
|
359
|
-
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Call delegate.iterator[context.method](context.arg) and handle the
|
|
360
333
|
// result, either by returning a { value, done } result from the
|
|
361
334
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
362
335
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
363
|
-
|
|
364
|
-
|
|
365
336
|
function maybeInvokeDelegate(delegate, context) {
|
|
366
337
|
var method = delegate.iterator[context.method];
|
|
367
|
-
|
|
368
338
|
if (method === undefined$1) {
|
|
369
339
|
// A .throw or .return when the delegate iterator has no .throw
|
|
370
340
|
// method always terminates the yield* loop.
|
|
371
341
|
context.delegate = null;
|
|
372
|
-
|
|
373
342
|
if (context.method === "throw") {
|
|
374
343
|
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
375
344
|
if (delegate.iterator["return"]) {
|
|
@@ -378,51 +347,45 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
378
347
|
context.method = "return";
|
|
379
348
|
context.arg = undefined$1;
|
|
380
349
|
maybeInvokeDelegate(delegate, context);
|
|
381
|
-
|
|
382
350
|
if (context.method === "throw") {
|
|
383
351
|
// If maybeInvokeDelegate(context) changed context.method from
|
|
384
352
|
// "return" to "throw", let that override the TypeError below.
|
|
385
353
|
return ContinueSentinel;
|
|
386
354
|
}
|
|
387
355
|
}
|
|
388
|
-
|
|
389
356
|
context.method = "throw";
|
|
390
357
|
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
391
358
|
}
|
|
392
|
-
|
|
393
359
|
return ContinueSentinel;
|
|
394
360
|
}
|
|
395
|
-
|
|
396
361
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
397
|
-
|
|
398
362
|
if (record.type === "throw") {
|
|
399
363
|
context.method = "throw";
|
|
400
364
|
context.arg = record.arg;
|
|
401
365
|
context.delegate = null;
|
|
402
366
|
return ContinueSentinel;
|
|
403
367
|
}
|
|
404
|
-
|
|
405
368
|
var info = record.arg;
|
|
406
|
-
|
|
407
369
|
if (!info) {
|
|
408
370
|
context.method = "throw";
|
|
409
371
|
context.arg = new TypeError("iterator result is not an object");
|
|
410
372
|
context.delegate = null;
|
|
411
373
|
return ContinueSentinel;
|
|
412
374
|
}
|
|
413
|
-
|
|
414
375
|
if (info.done) {
|
|
415
376
|
// Assign the result of the finished delegate to the temporary
|
|
416
377
|
// variable specified by delegate.resultName (see delegateYield).
|
|
417
|
-
context[delegate.resultName] = info.value;
|
|
378
|
+
context[delegate.resultName] = info.value;
|
|
379
|
+
|
|
380
|
+
// Resume execution at the desired location (see delegateYield).
|
|
381
|
+
context.next = delegate.nextLoc;
|
|
418
382
|
|
|
419
|
-
|
|
383
|
+
// If context.method was "throw" but the delegate handled the
|
|
420
384
|
// exception, let the outer generator proceed normally. If
|
|
421
385
|
// context.method was "next", forget context.arg since it has been
|
|
422
386
|
// "consumed" by the delegate iterator. If context.method was
|
|
423
387
|
// "return", allow the original .return call to continue in the
|
|
424
388
|
// outer generator.
|
|
425
|
-
|
|
426
389
|
if (context.method !== "return") {
|
|
427
390
|
context.method = "next";
|
|
428
391
|
context.arg = undefined$1;
|
|
@@ -430,54 +393,49 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
430
393
|
} else {
|
|
431
394
|
// Re-yield the result returned by the delegate method.
|
|
432
395
|
return info;
|
|
433
|
-
}
|
|
434
|
-
// the outer generator.
|
|
435
|
-
|
|
396
|
+
}
|
|
436
397
|
|
|
398
|
+
// The delegate iterator is finished, so forget it and continue with
|
|
399
|
+
// the outer generator.
|
|
437
400
|
context.delegate = null;
|
|
438
401
|
return ContinueSentinel;
|
|
439
|
-
}
|
|
440
|
-
// unified ._invoke helper method.
|
|
441
|
-
|
|
402
|
+
}
|
|
442
403
|
|
|
404
|
+
// Define Generator.prototype.{next,throw,return} in terms of the
|
|
405
|
+
// unified ._invoke helper method.
|
|
443
406
|
defineIteratorMethods(Gp);
|
|
444
|
-
define(Gp, toStringTagSymbol, "Generator");
|
|
407
|
+
define(Gp, toStringTagSymbol, "Generator");
|
|
408
|
+
|
|
409
|
+
// A Generator should always return itself as the iterator object when the
|
|
445
410
|
// @@iterator function is called on it. Some browsers' implementations of the
|
|
446
411
|
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
447
412
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
448
413
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
449
|
-
|
|
450
414
|
define(Gp, iteratorSymbol, function () {
|
|
451
415
|
return this;
|
|
452
416
|
});
|
|
453
417
|
define(Gp, "toString", function () {
|
|
454
418
|
return "[object Generator]";
|
|
455
419
|
});
|
|
456
|
-
|
|
457
420
|
function pushTryEntry(locs) {
|
|
458
421
|
var entry = {
|
|
459
422
|
tryLoc: locs[0]
|
|
460
423
|
};
|
|
461
|
-
|
|
462
424
|
if (1 in locs) {
|
|
463
425
|
entry.catchLoc = locs[1];
|
|
464
426
|
}
|
|
465
|
-
|
|
466
427
|
if (2 in locs) {
|
|
467
428
|
entry.finallyLoc = locs[2];
|
|
468
429
|
entry.afterLoc = locs[3];
|
|
469
430
|
}
|
|
470
|
-
|
|
471
431
|
this.tryEntries.push(entry);
|
|
472
432
|
}
|
|
473
|
-
|
|
474
433
|
function resetTryEntry(entry) {
|
|
475
434
|
var record = entry.completion || {};
|
|
476
435
|
record.type = "normal";
|
|
477
436
|
delete record.arg;
|
|
478
437
|
entry.completion = record;
|
|
479
438
|
}
|
|
480
|
-
|
|
481
439
|
function Context(tryLocsList) {
|
|
482
440
|
// The root entry object (effectively a try statement without a catch
|
|
483
441
|
// or a finally block) gives us a place to store values thrown from
|
|
@@ -488,97 +446,84 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
488
446
|
tryLocsList.forEach(pushTryEntry, this);
|
|
489
447
|
this.reset(true);
|
|
490
448
|
}
|
|
491
|
-
|
|
492
449
|
exports.keys = function (object) {
|
|
493
450
|
var keys = [];
|
|
494
|
-
|
|
495
451
|
for (var key in object) {
|
|
496
452
|
keys.push(key);
|
|
497
453
|
}
|
|
454
|
+
keys.reverse();
|
|
498
455
|
|
|
499
|
-
|
|
456
|
+
// Rather than returning an object with a next method, we keep
|
|
500
457
|
// things simple and return the next function itself.
|
|
501
|
-
|
|
502
458
|
return function next() {
|
|
503
459
|
while (keys.length) {
|
|
504
460
|
var key = keys.pop();
|
|
505
|
-
|
|
506
461
|
if (key in object) {
|
|
507
462
|
next.value = key;
|
|
508
463
|
next.done = false;
|
|
509
464
|
return next;
|
|
510
465
|
}
|
|
511
|
-
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// To avoid creating an additional object, we just hang the .value
|
|
512
469
|
// and .done properties off the next function object itself. This
|
|
513
470
|
// also ensures that the minifier will not anonymize the function.
|
|
514
|
-
|
|
515
|
-
|
|
516
471
|
next.done = true;
|
|
517
472
|
return next;
|
|
518
473
|
};
|
|
519
474
|
};
|
|
520
|
-
|
|
521
475
|
function values(iterable) {
|
|
522
476
|
if (iterable) {
|
|
523
477
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
524
|
-
|
|
525
478
|
if (iteratorMethod) {
|
|
526
479
|
return iteratorMethod.call(iterable);
|
|
527
480
|
}
|
|
528
|
-
|
|
529
481
|
if (typeof iterable.next === "function") {
|
|
530
482
|
return iterable;
|
|
531
483
|
}
|
|
532
|
-
|
|
533
484
|
if (!isNaN(iterable.length)) {
|
|
534
485
|
var i = -1,
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
486
|
+
next = function next() {
|
|
487
|
+
while (++i < iterable.length) {
|
|
488
|
+
if (hasOwn.call(iterable, i)) {
|
|
489
|
+
next.value = iterable[i];
|
|
490
|
+
next.done = false;
|
|
491
|
+
return next;
|
|
492
|
+
}
|
|
541
493
|
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
return next;
|
|
547
|
-
};
|
|
548
|
-
|
|
494
|
+
next.value = undefined$1;
|
|
495
|
+
next.done = true;
|
|
496
|
+
return next;
|
|
497
|
+
};
|
|
549
498
|
return next.next = next;
|
|
550
499
|
}
|
|
551
|
-
}
|
|
552
|
-
|
|
500
|
+
}
|
|
553
501
|
|
|
502
|
+
// Return an iterator with no values.
|
|
554
503
|
return {
|
|
555
504
|
next: doneResult
|
|
556
505
|
};
|
|
557
506
|
}
|
|
558
|
-
|
|
559
507
|
exports.values = values;
|
|
560
|
-
|
|
561
508
|
function doneResult() {
|
|
562
509
|
return {
|
|
563
510
|
value: undefined$1,
|
|
564
511
|
done: true
|
|
565
512
|
};
|
|
566
513
|
}
|
|
567
|
-
|
|
568
514
|
Context.prototype = {
|
|
569
515
|
constructor: Context,
|
|
570
516
|
reset: function reset(skipTempReset) {
|
|
571
517
|
this.prev = 0;
|
|
572
|
-
this.next = 0;
|
|
518
|
+
this.next = 0;
|
|
519
|
+
// Resetting context._sent for legacy support of Babel's
|
|
573
520
|
// function.sent implementation.
|
|
574
|
-
|
|
575
521
|
this.sent = this._sent = undefined$1;
|
|
576
522
|
this.done = false;
|
|
577
523
|
this.delegate = null;
|
|
578
524
|
this.method = "next";
|
|
579
525
|
this.arg = undefined$1;
|
|
580
526
|
this.tryEntries.forEach(resetTryEntry);
|
|
581
|
-
|
|
582
527
|
if (!skipTempReset) {
|
|
583
528
|
for (var name in this) {
|
|
584
529
|
// Not sure about the optimal order of these conditions:
|
|
@@ -592,50 +537,40 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
592
537
|
this.done = true;
|
|
593
538
|
var rootEntry = this.tryEntries[0];
|
|
594
539
|
var rootRecord = rootEntry.completion;
|
|
595
|
-
|
|
596
540
|
if (rootRecord.type === "throw") {
|
|
597
541
|
throw rootRecord.arg;
|
|
598
542
|
}
|
|
599
|
-
|
|
600
543
|
return this.rval;
|
|
601
544
|
},
|
|
602
545
|
dispatchException: function dispatchException(exception) {
|
|
603
546
|
if (this.done) {
|
|
604
547
|
throw exception;
|
|
605
548
|
}
|
|
606
|
-
|
|
607
549
|
var context = this;
|
|
608
|
-
|
|
609
550
|
function handle(loc, caught) {
|
|
610
551
|
record.type = "throw";
|
|
611
552
|
record.arg = exception;
|
|
612
553
|
context.next = loc;
|
|
613
|
-
|
|
614
554
|
if (caught) {
|
|
615
555
|
// If the dispatched exception was caught by a catch block,
|
|
616
556
|
// then let that catch block handle the exception normally.
|
|
617
557
|
context.method = "next";
|
|
618
558
|
context.arg = undefined$1;
|
|
619
559
|
}
|
|
620
|
-
|
|
621
560
|
return !!caught;
|
|
622
561
|
}
|
|
623
|
-
|
|
624
562
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
625
563
|
var entry = this.tryEntries[i];
|
|
626
564
|
var record = entry.completion;
|
|
627
|
-
|
|
628
565
|
if (entry.tryLoc === "root") {
|
|
629
566
|
// Exception thrown outside of any try block that could handle
|
|
630
567
|
// it, so set the completion value of the entire function to
|
|
631
568
|
// throw the exception.
|
|
632
569
|
return handle("end");
|
|
633
570
|
}
|
|
634
|
-
|
|
635
571
|
if (entry.tryLoc <= this.prev) {
|
|
636
572
|
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
637
573
|
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
638
|
-
|
|
639
574
|
if (hasCatch && hasFinally) {
|
|
640
575
|
if (this.prev < entry.catchLoc) {
|
|
641
576
|
return handle(entry.catchLoc, true);
|
|
@@ -659,36 +594,30 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
659
594
|
abrupt: function abrupt(type, arg) {
|
|
660
595
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
661
596
|
var entry = this.tryEntries[i];
|
|
662
|
-
|
|
663
597
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
664
598
|
var finallyEntry = entry;
|
|
665
599
|
break;
|
|
666
600
|
}
|
|
667
601
|
}
|
|
668
|
-
|
|
669
602
|
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
670
603
|
// Ignore the finally entry if control is not jumping to a
|
|
671
604
|
// location outside the try/catch block.
|
|
672
605
|
finallyEntry = null;
|
|
673
606
|
}
|
|
674
|
-
|
|
675
607
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
676
608
|
record.type = type;
|
|
677
609
|
record.arg = arg;
|
|
678
|
-
|
|
679
610
|
if (finallyEntry) {
|
|
680
611
|
this.method = "next";
|
|
681
612
|
this.next = finallyEntry.finallyLoc;
|
|
682
613
|
return ContinueSentinel;
|
|
683
614
|
}
|
|
684
|
-
|
|
685
615
|
return this.complete(record);
|
|
686
616
|
},
|
|
687
617
|
complete: function complete(record, afterLoc) {
|
|
688
618
|
if (record.type === "throw") {
|
|
689
619
|
throw record.arg;
|
|
690
620
|
}
|
|
691
|
-
|
|
692
621
|
if (record.type === "break" || record.type === "continue") {
|
|
693
622
|
this.next = record.arg;
|
|
694
623
|
} else if (record.type === "return") {
|
|
@@ -698,13 +627,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
698
627
|
} else if (record.type === "normal" && afterLoc) {
|
|
699
628
|
this.next = afterLoc;
|
|
700
629
|
}
|
|
701
|
-
|
|
702
630
|
return ContinueSentinel;
|
|
703
631
|
},
|
|
704
632
|
finish: function finish(finallyLoc) {
|
|
705
633
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
706
634
|
var entry = this.tryEntries[i];
|
|
707
|
-
|
|
708
635
|
if (entry.finallyLoc === finallyLoc) {
|
|
709
636
|
this.complete(entry.completion, entry.afterLoc);
|
|
710
637
|
resetTryEntry(entry);
|
|
@@ -715,21 +642,18 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
715
642
|
"catch": function _catch(tryLoc) {
|
|
716
643
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
717
644
|
var entry = this.tryEntries[i];
|
|
718
|
-
|
|
719
645
|
if (entry.tryLoc === tryLoc) {
|
|
720
646
|
var record = entry.completion;
|
|
721
|
-
|
|
722
647
|
if (record.type === "throw") {
|
|
723
648
|
var thrown = record.arg;
|
|
724
649
|
resetTryEntry(entry);
|
|
725
650
|
}
|
|
726
|
-
|
|
727
651
|
return thrown;
|
|
728
652
|
}
|
|
729
|
-
}
|
|
730
|
-
// argument that corresponds to a known catch block.
|
|
731
|
-
|
|
653
|
+
}
|
|
732
654
|
|
|
655
|
+
// The context.catch method must only be called with a location
|
|
656
|
+
// argument that corresponds to a known catch block.
|
|
733
657
|
throw new Error("illegal catch attempt");
|
|
734
658
|
},
|
|
735
659
|
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
@@ -738,27 +662,26 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
738
662
|
resultName: resultName,
|
|
739
663
|
nextLoc: nextLoc
|
|
740
664
|
};
|
|
741
|
-
|
|
742
665
|
if (this.method === "next") {
|
|
743
666
|
// Deliberately forget the last sent value so that we don't
|
|
744
667
|
// accidentally pass it on to the delegate.
|
|
745
668
|
this.arg = undefined$1;
|
|
746
669
|
}
|
|
747
|
-
|
|
748
670
|
return ContinueSentinel;
|
|
749
671
|
}
|
|
750
|
-
};
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
// Regardless of whether this script is executing as a CommonJS module
|
|
751
675
|
// or not, return the runtime object so that we can declare the variable
|
|
752
676
|
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
753
677
|
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
754
|
-
|
|
755
678
|
return exports;
|
|
756
|
-
}(
|
|
679
|
+
}(
|
|
680
|
+
// If this script is executing as a CommonJS module, use module.exports
|
|
757
681
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
758
682
|
// object. Either way, the resulting object will be used to initialize
|
|
759
683
|
// the regeneratorRuntime variable at the top of this file.
|
|
760
684
|
module.exports );
|
|
761
|
-
|
|
762
685
|
try {
|
|
763
686
|
regeneratorRuntime = runtime;
|
|
764
687
|
} catch (accidentalStrictMode) {
|
|
@@ -780,6 +703,23 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
780
703
|
}
|
|
781
704
|
});
|
|
782
705
|
|
|
706
|
+
var searchParameters = [{
|
|
707
|
+
value: "[lt]",
|
|
708
|
+
label: 'Less than'
|
|
709
|
+
}, {
|
|
710
|
+
value: "[lte]",
|
|
711
|
+
label: 'Less than or equal'
|
|
712
|
+
}, {
|
|
713
|
+
value: "[gt]",
|
|
714
|
+
label: 'Greater than'
|
|
715
|
+
}, {
|
|
716
|
+
value: "[gte]",
|
|
717
|
+
label: 'Greater than or equal '
|
|
718
|
+
}];
|
|
719
|
+
var uniq = function uniq(xs) {
|
|
720
|
+
return Array.from(new Set(xs));
|
|
721
|
+
};
|
|
722
|
+
|
|
783
723
|
function ensure(x) {
|
|
784
724
|
if (x === null || x === undefined) {
|
|
785
725
|
debugger;
|
|
@@ -789,11 +729,9 @@ function ensure(x) {
|
|
|
789
729
|
}
|
|
790
730
|
}
|
|
791
731
|
var modulePath = "@plasmicpkgs/plasmic-contentful";
|
|
792
|
-
|
|
793
732
|
var makeDataProviderName = function makeDataProviderName(contentType) {
|
|
794
733
|
return "currentContentful" + changeCase.pascalCase(contentType) + "Item";
|
|
795
734
|
};
|
|
796
|
-
|
|
797
735
|
var CredentialsContext = /*#__PURE__*/React__default.createContext(undefined);
|
|
798
736
|
var ContentfulCredentialsProviderMeta = {
|
|
799
737
|
name: "Contentful CredentialsProvider",
|
|
@@ -823,9 +761,9 @@ var ContentfulCredentialsProviderMeta = {
|
|
|
823
761
|
};
|
|
824
762
|
function ContentfulCredentialsProvider(_ref) {
|
|
825
763
|
var accessToken = _ref.accessToken,
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
764
|
+
space = _ref.space,
|
|
765
|
+
environment = _ref.environment,
|
|
766
|
+
children = _ref.children;
|
|
829
767
|
return React__default.createElement(CredentialsContext.Provider, {
|
|
830
768
|
value: {
|
|
831
769
|
space: space,
|
|
@@ -867,10 +805,8 @@ var ContentfulFetcherMeta = {
|
|
|
867
805
|
type: "choice",
|
|
868
806
|
options: function options(props, ctx) {
|
|
869
807
|
var _ctx$types$map, _ctx$types;
|
|
870
|
-
|
|
871
808
|
return (_ctx$types$map = ctx == null ? void 0 : (_ctx$types = ctx.types) == null ? void 0 : _ctx$types.map(function (type) {
|
|
872
809
|
var _type$sys;
|
|
873
|
-
|
|
874
810
|
return {
|
|
875
811
|
label: type == null ? void 0 : type.name,
|
|
876
812
|
value: type == null ? void 0 : (_type$sys = type.sys) == null ? void 0 : _type$sys.id
|
|
@@ -880,34 +816,48 @@ var ContentfulFetcherMeta = {
|
|
|
880
816
|
displayName: "Content type",
|
|
881
817
|
description: "Content type to be queried."
|
|
882
818
|
},
|
|
883
|
-
|
|
819
|
+
filterField: {
|
|
884
820
|
type: "choice",
|
|
821
|
+
displayName: "Filter field",
|
|
822
|
+
description: "Field (from Collection) to filter by",
|
|
885
823
|
options: function options(props, ctx) {
|
|
886
|
-
var _ctx$
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
824
|
+
var _ctx$fields;
|
|
825
|
+
return (_ctx$fields = ctx == null ? void 0 : ctx.fields) != null ? _ctx$fields : [];
|
|
826
|
+
},
|
|
827
|
+
hidden: function hidden(props, ctx) {
|
|
828
|
+
return !props.contentType;
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
searchParameter: {
|
|
832
|
+
type: "choice",
|
|
833
|
+
displayName: "Search Parameter",
|
|
834
|
+
description: "Search Parameter to filter by.Read more (https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/)",
|
|
835
|
+
options: function options(props, ctx) {
|
|
836
|
+
var _ctx$queryOptions;
|
|
837
|
+
return (_ctx$queryOptions = ctx == null ? void 0 : ctx.queryOptions) != null ? _ctx$queryOptions : [];
|
|
896
838
|
},
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
839
|
+
hidden: function hidden(props, ctx) {
|
|
840
|
+
return !props.filterField;
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
filterValue: {
|
|
844
|
+
type: "string",
|
|
845
|
+
displayName: "Filter value",
|
|
846
|
+
description: "Value to filter by, should be of filter field type",
|
|
847
|
+
hidden: function hidden(props, ctx) {
|
|
848
|
+
return !props.searchParameter;
|
|
849
|
+
}
|
|
900
850
|
},
|
|
901
851
|
limit: {
|
|
902
852
|
type: "number",
|
|
903
853
|
displayName: "Limit",
|
|
904
|
-
description: "Limit the number of entries that are returned."
|
|
905
|
-
defaultValue: 1000
|
|
854
|
+
description: "Limit the number of entries that are returned."
|
|
906
855
|
},
|
|
907
|
-
|
|
908
|
-
type: "
|
|
909
|
-
displayName: "
|
|
910
|
-
description: "
|
|
856
|
+
noAutoRepeat: {
|
|
857
|
+
type: "boolean",
|
|
858
|
+
displayName: "No auto-repeat",
|
|
859
|
+
description: "Do not automatically repeat children for every entry.",
|
|
860
|
+
defaultValue: false
|
|
911
861
|
},
|
|
912
862
|
noLayout: {
|
|
913
863
|
type: "boolean",
|
|
@@ -918,144 +868,149 @@ var ContentfulFetcherMeta = {
|
|
|
918
868
|
}
|
|
919
869
|
};
|
|
920
870
|
function ContentfulFetcher(_ref2) {
|
|
921
|
-
var
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
871
|
+
var _contentTypes$items, _operators, _contentTypes$items2;
|
|
872
|
+
var filterField = _ref2.filterField,
|
|
873
|
+
filterValue = _ref2.filterValue,
|
|
874
|
+
searchParameter = _ref2.searchParameter,
|
|
875
|
+
noAutoRepeat = _ref2.noAutoRepeat,
|
|
876
|
+
contentType = _ref2.contentType,
|
|
877
|
+
children = _ref2.children,
|
|
878
|
+
className = _ref2.className,
|
|
879
|
+
limit = _ref2.limit,
|
|
880
|
+
noLayout = _ref2.noLayout,
|
|
881
|
+
setControlContextData = _ref2.setControlContextData;
|
|
929
882
|
var creds = ensure(React.useContext(CredentialsContext));
|
|
930
883
|
var cacheKey = JSON.stringify({
|
|
884
|
+
limit: limit,
|
|
885
|
+
filterField: filterField,
|
|
886
|
+
filterValue: filterValue,
|
|
887
|
+
searchParameter: searchParameter,
|
|
931
888
|
creds: creds
|
|
932
889
|
});
|
|
933
|
-
var
|
|
934
|
-
space: creds.space,
|
|
935
|
-
accessToken: creds.accessToken
|
|
936
|
-
});
|
|
937
|
-
|
|
890
|
+
var baseUrl = "https://cdn.contentful.com";
|
|
938
891
|
var _usePlasmicQueryData = query.usePlasmicQueryData(cacheKey + "/contentTypes", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
return _context.stop();
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
}, _callee);
|
|
957
|
-
}))),
|
|
958
|
-
contentTypes = _usePlasmicQueryData.data,
|
|
959
|
-
contentTypesError = _usePlasmicQueryData.error;
|
|
960
|
-
|
|
961
|
-
var _usePlasmicQueryData2 = query.usePlasmicQueryData(contentType ? cacheKey + "/" + contentType + "/entriesData/" + limit + "/" + order : null, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
962
|
-
var response;
|
|
963
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
964
|
-
while (1) {
|
|
965
|
-
switch (_context2.prev = _context2.next) {
|
|
966
|
-
case 0:
|
|
967
|
-
_context2.next = 2;
|
|
968
|
-
return client.getEntries({
|
|
969
|
-
content_type: "" + (contentType == null ? void 0 : contentType.toString()),
|
|
970
|
-
limit: limit,
|
|
971
|
-
order: order
|
|
972
|
-
});
|
|
973
|
-
|
|
974
|
-
case 2:
|
|
975
|
-
response = _context2.sent;
|
|
976
|
-
return _context2.abrupt("return", response);
|
|
977
|
-
|
|
978
|
-
case 4:
|
|
979
|
-
case "end":
|
|
980
|
-
return _context2.stop();
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
}, _callee2);
|
|
984
|
-
}))),
|
|
985
|
-
entriesData = _usePlasmicQueryData2.data,
|
|
986
|
-
entriesDataError = _usePlasmicQueryData2.error;
|
|
987
|
-
|
|
988
|
-
var _usePlasmicQueryData3 = query.usePlasmicQueryData(entryID ? cacheKey + "/entry/" + entryID : null, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
989
|
-
var response;
|
|
990
|
-
return runtime_1.wrap(function _callee3$(_context3) {
|
|
991
|
-
while (1) {
|
|
992
|
-
switch (_context3.prev = _context3.next) {
|
|
993
|
-
case 0:
|
|
994
|
-
_context3.next = 2;
|
|
995
|
-
return client.getEntry("" + entryID);
|
|
996
|
-
|
|
997
|
-
case 2:
|
|
998
|
-
response = _context3.sent;
|
|
999
|
-
return _context3.abrupt("return", response);
|
|
1000
|
-
|
|
1001
|
-
case 4:
|
|
1002
|
-
case "end":
|
|
1003
|
-
return _context3.stop();
|
|
892
|
+
var resp;
|
|
893
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
894
|
+
while (1) {
|
|
895
|
+
switch (_context.prev = _context.next) {
|
|
896
|
+
case 0:
|
|
897
|
+
_context.next = 2;
|
|
898
|
+
return fetch(baseUrl + "/spaces/" + creds.space + "/environments/" + creds.environment + "/content_types?access_token=" + creds.accessToken);
|
|
899
|
+
case 2:
|
|
900
|
+
resp = _context.sent;
|
|
901
|
+
return _context.abrupt("return", resp.json());
|
|
902
|
+
case 4:
|
|
903
|
+
case "end":
|
|
904
|
+
return _context.stop();
|
|
905
|
+
}
|
|
1004
906
|
}
|
|
1005
|
-
}
|
|
1006
|
-
},
|
|
1007
|
-
|
|
1008
|
-
entryData = _usePlasmicQueryData3.data,
|
|
1009
|
-
entryDataError = _usePlasmicQueryData3.error;
|
|
1010
|
-
|
|
907
|
+
}, _callee);
|
|
908
|
+
}))),
|
|
909
|
+
contentTypes = _usePlasmicQueryData.data;
|
|
1011
910
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
1012
|
-
types: contentTypes == null ? void 0 : contentTypes.items
|
|
1013
|
-
entries: entriesData == null ? void 0 : entriesData.items
|
|
911
|
+
types: (_contentTypes$items = contentTypes == null ? void 0 : contentTypes.items) != null ? _contentTypes$items : []
|
|
1014
912
|
});
|
|
1015
|
-
|
|
913
|
+
var _usePlasmicQueryData2 = query.usePlasmicQueryData(contentType ? cacheKey + "/" + contentType + "/entriesData" : null, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
914
|
+
var url, query, resp;
|
|
915
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
916
|
+
while (1) {
|
|
917
|
+
switch (_context2.prev = _context2.next) {
|
|
918
|
+
case 0:
|
|
919
|
+
url = "/spaces/" + creds.space + "/environments/" + creds.environment + "/entries?access_token=" + creds.accessToken + "&content_type=" + contentType;
|
|
920
|
+
if (limit) {
|
|
921
|
+
query = url + "&limit=" + limit;
|
|
922
|
+
} else {
|
|
923
|
+
query = url;
|
|
924
|
+
}
|
|
925
|
+
_context2.next = 4;
|
|
926
|
+
return fetch("" + baseUrl + query);
|
|
927
|
+
case 4:
|
|
928
|
+
resp = _context2.sent;
|
|
929
|
+
return _context2.abrupt("return", resp.json());
|
|
930
|
+
case 6:
|
|
931
|
+
case "end":
|
|
932
|
+
return _context2.stop();
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}, _callee2);
|
|
936
|
+
}))),
|
|
937
|
+
entriesData = _usePlasmicQueryData2.data;
|
|
938
|
+
var _usePlasmicQueryData3 = query.usePlasmicQueryData(contentType && filterField && filterValue ? cacheKey + "/" + contentType + "/filteredData" : null, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
939
|
+
var queryPath, resp;
|
|
940
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
941
|
+
while (1) {
|
|
942
|
+
switch (_context3.prev = _context3.next) {
|
|
943
|
+
case 0:
|
|
944
|
+
queryPath = "/spaces/" + creds.space + "/environments/" + creds.environment + "/entries?access_token=" + creds.accessToken + "&content_type=" + contentType + "&fields." + filterField + searchParameter + "=" + filterValue;
|
|
945
|
+
_context3.next = 3;
|
|
946
|
+
return fetch("" + baseUrl + queryPath);
|
|
947
|
+
case 3:
|
|
948
|
+
resp = _context3.sent;
|
|
949
|
+
return _context3.abrupt("return", resp.json());
|
|
950
|
+
case 5:
|
|
951
|
+
case "end":
|
|
952
|
+
return _context3.stop();
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}, _callee3);
|
|
956
|
+
}))),
|
|
957
|
+
filteredData = _usePlasmicQueryData3.data;
|
|
1016
958
|
if (!creds.space || !creds.accessToken) {
|
|
1017
959
|
return React__default.createElement("div", null, "Please specify a valid API Credentials: Space, Access Token and Environment");
|
|
1018
960
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
961
|
+
if (!contentTypes) {
|
|
962
|
+
return React__default.createElement("div", null, "Please configure the ContentStack credentials");
|
|
963
|
+
}
|
|
964
|
+
if (!entriesData) {
|
|
965
|
+
return React__default.createElement("div", null, "Please select a content type");
|
|
966
|
+
}
|
|
967
|
+
var filterFields = entriesData == null ? void 0 : entriesData.items.flatMap(function (item) {
|
|
968
|
+
var fields = Object.keys(item.fields).filter(function (field) {
|
|
969
|
+
var value = get(item, field);
|
|
970
|
+
return typeof value !== "object" && field !== "photos";
|
|
971
|
+
});
|
|
972
|
+
return fields;
|
|
973
|
+
});
|
|
974
|
+
var operators;
|
|
975
|
+
var matchedFields = Object.values(entriesData.items).map(function (item) {
|
|
976
|
+
var fields = Object.entries(item.fields).find(function (el) {
|
|
977
|
+
return el[0] === filterField;
|
|
978
|
+
});
|
|
979
|
+
return fields;
|
|
980
|
+
});
|
|
981
|
+
Object.values(matchedFields).map(function (model) {
|
|
982
|
+
return Array.isArray(model) ? model : [model];
|
|
983
|
+
}).map(function (item) {
|
|
984
|
+
if (typeof item[1] === "number" && typeof item[1] !== "object") {
|
|
985
|
+
operators = searchParameters;
|
|
986
|
+
} else if (typeof item[1] !== "number" && typeof item[1] !== "object" && typeof item[1] === "string") {
|
|
987
|
+
operators = [{
|
|
988
|
+
value: "[match]",
|
|
989
|
+
label: "Full text search"
|
|
990
|
+
}];
|
|
1033
991
|
}
|
|
992
|
+
});
|
|
993
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
994
|
+
queryOptions: (_operators = operators) != null ? _operators : [],
|
|
995
|
+
types: (_contentTypes$items2 = contentTypes == null ? void 0 : contentTypes.items) != null ? _contentTypes$items2 : [],
|
|
996
|
+
fields: uniq(filterFields != null ? filterFields : [])
|
|
997
|
+
});
|
|
998
|
+
if (filterField && !searchParameter) {
|
|
999
|
+
return React__default.createElement("div", null, "Please specify a Search Parameter");
|
|
1000
|
+
}
|
|
1001
|
+
if (searchParameter && !filterValue) {
|
|
1002
|
+
return React__default.createElement("div", null, "Please specify a Filter value");
|
|
1034
1003
|
}
|
|
1035
|
-
|
|
1036
1004
|
var renderedData;
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
name: "contentfulItem",
|
|
1041
|
-
data: entryData,
|
|
1042
|
-
hidden: true
|
|
1043
|
-
}, React__default.createElement(host.DataProvider, {
|
|
1044
|
-
name: makeDataProviderName(contentType),
|
|
1045
|
-
data: entryData
|
|
1046
|
-
}, children));
|
|
1047
|
-
} else if (contentType) {
|
|
1048
|
-
var _entriesData$items, _entriesData$items2;
|
|
1049
|
-
|
|
1050
|
-
if ((entriesData == null ? void 0 : (_entriesData$items = entriesData.items) == null ? void 0 : _entriesData$items.length) === 0) {
|
|
1005
|
+
if (filteredData) {
|
|
1006
|
+
var _filteredData$items, _filteredData$items2;
|
|
1007
|
+
if ((filteredData == null ? void 0 : (_filteredData$items = filteredData.items) == null ? void 0 : _filteredData$items.length) === 0) {
|
|
1051
1008
|
return React__default.createElement("div", {
|
|
1052
1009
|
className: className
|
|
1053
|
-
},
|
|
1010
|
+
}, "No published entry found");
|
|
1054
1011
|
}
|
|
1055
|
-
|
|
1056
|
-
renderedData = entriesData == null ? void 0 : (_entriesData$items2 = entriesData.items) == null ? void 0 : _entriesData$items2.map(function (item, index) {
|
|
1012
|
+
renderedData = noAutoRepeat ? children : filteredData == null ? void 0 : (_filteredData$items2 = filteredData.items) == null ? void 0 : _filteredData$items2.map(function (item, index) {
|
|
1057
1013
|
var _item$sys;
|
|
1058
|
-
|
|
1059
1014
|
return React__default.createElement(host.DataProvider, {
|
|
1060
1015
|
key: item == null ? void 0 : (_item$sys = item.sys) == null ? void 0 : _item$sys.id,
|
|
1061
1016
|
name: "contentfulItem",
|
|
@@ -1067,12 +1022,31 @@ function ContentfulFetcher(_ref2) {
|
|
|
1067
1022
|
}, host.repeatedElement(index, children)));
|
|
1068
1023
|
});
|
|
1069
1024
|
} else {
|
|
1070
|
-
|
|
1025
|
+
var _entriesData$items, _entriesData$items2;
|
|
1026
|
+
if ((entriesData == null ? void 0 : (_entriesData$items = entriesData.items) == null ? void 0 : _entriesData$items.length) === 0) {
|
|
1027
|
+
return React__default.createElement("div", {
|
|
1028
|
+
className: className
|
|
1029
|
+
}, contentType, " is empty");
|
|
1030
|
+
}
|
|
1031
|
+
renderedData = noAutoRepeat ? children : entriesData == null ? void 0 : (_entriesData$items2 = entriesData.items) == null ? void 0 : _entriesData$items2.map(function (item, index) {
|
|
1032
|
+
var _item$sys2;
|
|
1033
|
+
return React__default.createElement(host.DataProvider, {
|
|
1034
|
+
key: item == null ? void 0 : (_item$sys2 = item.sys) == null ? void 0 : _item$sys2.id,
|
|
1035
|
+
name: "contentfulItem",
|
|
1036
|
+
data: item,
|
|
1037
|
+
hidden: true
|
|
1038
|
+
}, React__default.createElement(host.DataProvider, {
|
|
1039
|
+
name: makeDataProviderName(contentType),
|
|
1040
|
+
data: item
|
|
1041
|
+
}, host.repeatedElement(index, children)));
|
|
1042
|
+
});
|
|
1071
1043
|
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1044
|
+
return React__default.createElement(host.DataProvider, {
|
|
1045
|
+
name: "contentfulItems",
|
|
1046
|
+
data: entriesData == null ? void 0 : entriesData.items
|
|
1047
|
+
}, noLayout ? React__default.createElement(React__default.Fragment, null, " ", renderedData, " ") : React__default.createElement("div", {
|
|
1074
1048
|
className: className
|
|
1075
|
-
}, " ", renderedData, " ");
|
|
1049
|
+
}, " ", renderedData, " "));
|
|
1076
1050
|
}
|
|
1077
1051
|
var ContentfulFieldMeta = {
|
|
1078
1052
|
name: "ContentfulField",
|
|
@@ -1084,7 +1058,6 @@ var ContentfulFieldMeta = {
|
|
|
1084
1058
|
type: "dataSelector",
|
|
1085
1059
|
data: function data(props, ctx) {
|
|
1086
1060
|
var _ctx$data;
|
|
1087
|
-
|
|
1088
1061
|
return (_ctx$data = ctx == null ? void 0 : ctx.data) != null ? _ctx$data : {};
|
|
1089
1062
|
},
|
|
1090
1063
|
displayName: "Field",
|
|
@@ -1094,26 +1067,20 @@ var ContentfulFieldMeta = {
|
|
|
1094
1067
|
};
|
|
1095
1068
|
function ContentfulField(_ref6) {
|
|
1096
1069
|
var _useSelector;
|
|
1097
|
-
|
|
1098
1070
|
var className = _ref6.className,
|
|
1099
|
-
|
|
1100
|
-
|
|
1071
|
+
objectPath = _ref6.objectPath,
|
|
1072
|
+
setControlContextData = _ref6.setControlContextData;
|
|
1101
1073
|
var item = (_useSelector = host.useSelector("contentfulItem")) == null ? void 0 : _useSelector.fields;
|
|
1102
|
-
|
|
1103
1074
|
if (!item) {
|
|
1104
1075
|
return React__default.createElement("div", null, "ContentfulField must be used within a ContentfulFetcher ");
|
|
1105
1076
|
}
|
|
1106
|
-
|
|
1107
1077
|
setControlContextData == null ? void 0 : setControlContextData({
|
|
1108
1078
|
data: item
|
|
1109
1079
|
});
|
|
1110
|
-
|
|
1111
1080
|
if (!objectPath) {
|
|
1112
1081
|
return React__default.createElement("div", null, "Please specify a valid path or select a field.");
|
|
1113
1082
|
}
|
|
1114
|
-
|
|
1115
1083
|
var data = get(item, objectPath);
|
|
1116
|
-
|
|
1117
1084
|
if (typeof data === "object" && "nodeType" in data && data.nodeType === "document") {
|
|
1118
1085
|
return React__default.createElement("div", {
|
|
1119
1086
|
className: className,
|
|
@@ -1147,15 +1114,12 @@ function registerAll(loader) {
|
|
|
1147
1114
|
registerComponent(Component, defaultMeta);
|
|
1148
1115
|
}
|
|
1149
1116
|
};
|
|
1150
|
-
|
|
1151
1117
|
if (loader) {
|
|
1152
1118
|
loader.registerGlobalContext(ContentfulCredentialsProvider, ContentfulCredentialsProviderMeta);
|
|
1153
1119
|
} else {
|
|
1154
1120
|
registerGlobalContext(ContentfulCredentialsProvider, ContentfulCredentialsProviderMeta);
|
|
1155
1121
|
}
|
|
1156
|
-
|
|
1157
1122
|
_registerComponent(ContentfulFetcher, ContentfulFetcherMeta);
|
|
1158
|
-
|
|
1159
1123
|
_registerComponent(ContentfulField, ContentfulFieldMeta);
|
|
1160
1124
|
}
|
|
1161
1125
|
|