@plasmicpkgs/plasmic-content-stack 0.0.67 → 0.0.69

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