New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@plasmicpkgs/plasmic-cms

Package Overview
Dependencies
Maintainers
1
Versions
244
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plasmicpkgs/plasmic-cms - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

4

dist/plasmic-cms.cjs.development.js

@@ -1399,5 +1399,7 @@ 'use strict';

return table.schema.fields.map(function (f) {
var _f$name;
return {
value: f.identifier,
label: f.name
label: (_f$name = f.name) != null ? _f$name : f.identifier
};

@@ -1404,0 +1406,0 @@ });

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@plasmicapp/host/registerComponent")),r=require("@plasmicapp/host"),n=require("@plasmicapp/query"),o=e(require("react")),a=require("@plasmicpkgs/plasmic-basic-components");function i(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function u(e){i(a,n,o,u,c,"next",e)}function c(e){i(a,n,o,u,c,"throw",e)}u(void 0)}))}}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function p(e,t,r){return(p=f()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&s(o,r.prototype),o}).apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return(d=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return p(e,arguments,l(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)})(e)}function h(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(o[r]=e[r]);return o}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return m(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var y,b=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),a=new N(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var u=g(i,r);if(u){if(u===s)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(e,r,a),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function p(){}function d(){}var h={};u(h,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(_([])));v&&v!==t&&r.call(v,o)&&(h=v);var y=d.prototype=f.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){var n;this._invoke=function(o,a){function i(){return new t((function(n,i){!function n(o,a,i,u){var c=l(e[o],e,a);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,i,u)}),(function(e){n("throw",e,i,u)})):t.resolve(f).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,u)}))}u(c.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function g(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,g(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,s;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function _(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:C}}function C(){return{value:void 0,done:!0}}return p.prototype=d,u(y,"constructor",d),u(d,"constructor",p),p.displayName=u(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,i,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(w.prototype),u(w.prototype,a,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(c(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(y),u(y,i,"Generator"),u(y,o,(function(){return this})),u(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=_,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,s):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:_(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(y={exports:{}}),y.exports);function w(e){return{where:e.where,limit:e.limit,order:[{field:e.orderBy,dir:e.desc?"desc":"asc"}]}}var g=function(e){var t,r;function n(t,r){var n;return(n=e.call(this,r)||this).status=t,n}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,s(t,r),n}(d(Error)),x=function(){function e(e){this.config=e}var t=e.prototype;return t.get=function(){var e=u(b.mark((function e(t,r){var n,o,a,i,u;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r={}),(n=new URL(this.config.host+"/api/v1/cms/databases/"+this.config.databaseId+t)).search=new URLSearchParams(r).toString(),e.next=5,fetch(n.toString(),{method:"GET",headers:{accept:"*/*","x-plasmic-api-project-tokens":this.config.projectId+":"+this.config.projectApiToken},mode:"cors"});case 5:if(200===(o=e.sent).status){e.next=25;break}return e.prev=7,e.next=10,o.json();case 10:if(e.t0=i=e.sent,null!=e.t0){e.next=15;break}e.t1=void 0,e.next=16;break;case 15:e.t1=null==(u=i.error)?void 0:u.message;case 16:a=e.t1,e.next=24;break;case 19:return e.prev=19,e.t2=e.catch(7),e.next=23,o.text();case 23:a=e.sent;case 24:throw new g(o.status,a);case 25:return e.next=27,o.json();case 27:return e.abrupt("return",e.sent);case 28:case"end":return e.stop()}}),e,this,[[7,19]])})));return function(t,r){return e.apply(this,arguments)}}(),t.fetchTables=function(){var e=u(b.mark((function e(){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.get("");case 3:return e.abrupt("return",e.sent.tables);case 7:throw e.prev=7,e.t0=e.catch(0),console.error(e.t0),e.t0;case 11:case"end":return e.stop()}}),e,this,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),t.query=function(){var e=u(b.mark((function e(t,r){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.get("/tables/"+t+"/query",{q:JSON.stringify(w(r)),useDraft:Number(r.useDraft)});case 3:return e.abrupt("return",e.sent.rows);case 7:throw e.prev=7,e.t0=e.catch(0),console.error(e.t0),e.t0;case 11:case"end":return e.stop()}}),e,this,[[0,7]])})));return function(t,r){return e.apply(this,arguments)}}(),t.fetchRow=function(){var e=u(b.mark((function e(t,r,n){var o;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o=n?"?draft=1":"",e.next=4,this.get("/tables/"+t+"/rows/"+r+o);case 4:return e.abrupt("return",e.sent);case 8:throw e.prev=8,e.t0=e.catch(0),console.error(e.t0),e.t0;case 12:case"end":return e.stop()}}),e,this,[[0,8]])})));return function(t,r,n){return e.apply(this,arguments)}}(),e}();function E(e){if(!e)throw new Error("Component must be wrapped in 'CMS Data Provider'.");return new x(e)}var N=function(e){return"__plasmic_cms_query_"+e},_=function(e){return"__plasmic_cms_row_"+e};function C(){return a.useSelector("__plasmic_cms_database")}function S(e){return o.createElement(a.DataProvider,{name:"__plasmic_cms_database",data:e.config},e.children)}function j(){return a.useSelector("__plasmic_cms_tables")}function L(e){return o.createElement(a.DataProvider,{name:"__plasmic_cms_tables",data:e.tables},e.children)}function O(e,t){return[].concat(Object.keys(e).reverse()).filter((function(e){return e.startsWith(t)}))}function P(e){var t=e.children,r=e.rows;return o.createElement(a.DataProvider,{name:N(e.table),data:r},t)}function k(e){var t=a.useDataEnv(),r=j();if(t){if(e)return{table:e,row:t[_(e)]};if(r)for(var n,o=function(){var e=n.value,o=r.find((function(t){return _(t.identifier)===e}));if(o)return{v:{table:o.identifier,row:t[e]}}},i=v(O(t,"__plasmic_cms_row_"));!(n=i()).done;){var u=o();if("object"==typeof u)return u.v}}}function D(e){var t=e.children,r=e.row;return o.createElement(a.DataProvider,{name:_(e.table),data:r},t)}function M(e){return e?e.map((function(e){return{value:e.identifier,label:e.name}})):[]}function F(e,t){if(!e)return[];var r=e.find((function(e){return e.identifier===t}));return r?r.schema.fields.map((function(e){return{value:e.identifier,label:e.name}})):[]}var R=["children"],I=["table","children","setControlContextData"],q="@plasmicpkgs/plasmic-cms",T="hostless-plasmic-cms";function V(e,t,r){if("error"in e){var n=e.error;return n&&n instanceof g&&404===n.status?r.hideIfNotFound?null:o.createElement("div",null,"Error: Data not found"):o.createElement("div",null,"Error: ",null==n?void 0:n.message)}return"data"in e?t(e.data):o.createElement("div",null,"Loading...")}var A="https://studio.plasmic.app",G={name:T+"-data-provider",displayName:"CMS Data Provider",importName:"CmsDataProvider",importPath:q,props:{host:{type:"string",displayName:"Studio URL",description:"The default host for use in production is "+A+".",defaultValue:A,defaultValueHint:A},databaseId:{type:"string",displayName:"CMS ID",description:"The ID of the CMS (database) to use."},projectId:{type:"string",displayName:"Project ID",description:"This project's ID."},projectApiToken:{type:"string",displayName:"Project API token",description:"This project's API token."},children:{type:"slot",defaultValue:{type:"vbox",children:[]}}}};function Q(e){var t=e.children,r=h(e,R);return r.host=r.host||A,o.createElement(S,{config:r},o.createElement(U,null,t))}function U(e){var t=e.children,r=C(),a=JSON.stringify({component:"TablesFetcher",databaseConfig:r});return V(n.usePlasmicQueryData(a,u(b.mark((function e(){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",E(r).fetchTables());case 1:case"end":return e.stop()}}),e)})))),(function(e){return o.createElement(L,{tables:e},t)}),{hideIfNotFound:!1})}var J={name:T+"-query-loader",displayName:"CMS Query Loader",importName:"CmsQueryLoader",importPath:q,props:{children:{type:"slot",defaultValue:{type:"component",name:T+"-row-repeater"}},table:{type:"choice",displayName:"Model",description:"CMS model (table) to query.",options:function(e,t){return M(null==t?void 0:t.tables)}},useDraft:{type:"boolean",displayName:"Use drafts?",description:"If set, also query unpublished content.",defaultValue:!1},where:{type:"object",displayName:"Filter",description:"Filter clause, in JSON format."},orderBy:{type:"choice",displayName:"Order by",description:"Field to order by.",options:function(e,t){return F(null==t?void 0:t.tables,e.table)}},desc:{type:"boolean",displayName:"Sort descending?",description:'Sort descending by "Order by" field.',defaultValue:!1},limit:{type:"number",displayName:"Limit",description:"Maximum number of entries to fetch (0 for unlimited).",defaultValue:0}}};function Y(e){var t=e.table,r=e.children,a=e.setControlContextData,i=h(e,I),c=C(),l=j();l&&(null==a||a({tables:l}));var s=JSON.stringify({component:"CmsQueryLoader",table:t,databaseConfig:c,params:i});return V(n.usePlasmicQueryData(s,u(b.mark((function e(){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=4;break}throw new Error("You must select a table to query");case 4:if(!l||l.find((function(e){return e.identifier===t}))){e.next=6;break}throw new Error('There is no table called "'+t+'"');case 6:return e.abrupt("return",E(c).query(t,i));case 7:case"end":return e.stop()}}),e)})))),(function(e){return o.createElement(P,{table:t,rows:e},r)}),{hideIfNotFound:!1})}var B={name:T+"-row-repeater",displayName:"CMS Row Repeater",importName:"CmsRowRepeater",importPath:q,props:{children:{type:"slot",defaultValue:{type:"component",name:T+"-row-field"}},table:{type:"choice",displayName:"Model",description:"CMS model (table) to use.",options:function(e,t){return M(null==t?void 0:t.tables)}}}};function W(e){var t=e.table,n=e.children,i=e.setControlContextData,u=j();u&&(null==i||i({tables:u}));var c=function(e){var t=a.useDataEnv(),r=j();if(t){var n;if(e)return{table:e,rows:null!=(n=t[N(e)])?n:[]};if(r)for(var o,i=function(){var e,n=o.value,a=r.find((function(e){return N(e.identifier)===n}));if(a)return{v:{table:a.identifier,rows:null!=(e=t[n])?e:[]}}},u=v(O(t,"__plasmic_cms_query_"));!(o=u()).done;){var c=i();if("object"==typeof c)return c.v}}}(t);return c?o.createElement(o.Fragment,null,c.rows.map((function(e,t){return o.createElement(D,{table:c.table,row:e},r.repeatedElement(0===t,n))}))):o.createElement("div",null,"Error: No CMS query result to repeat.")}var H={name:T+"-row-field",displayName:"CMS Row Field",importName:"CmsRowField",importPath:q,props:{table:{type:"choice",displayName:"Model",description:"CMS model (table) to use.",options:function(e,t){return M(null==t?void 0:t.tables)}},field:{type:"choice",displayName:"Field",description:"Field (from model schema) to use.",options:function(e,t){var r;return F(null==t?void 0:t.tables,null!=(r=null==t?void 0:t.table)?r:e.table)}}}};function $(e){var t,r,n=e.className,a=e.table,i=e.field,u=e.setControlContextData,c=j(),l=k(a);if(!l||!l.row)return o.createElement("div",null,"Error: No CMS Row found");c&&(null==u||u({tables:c,table:l.table}));var s=null==c||null==(t=c.find((function(e){return e.identifier===l.table})))?void 0:t.schema,f=i?null==s?void 0:s.fields.find((function(e){return e.identifier===i})):null==s?void 0:s.fields[0];if(!f)return o.createElement("div",null,"Error: No field to display");var p=null==(r=l.row.data)?void 0:r[f.identifier];return p?function(e,t,r){switch(t){case"number":case"boolean":case"text":case"long-text":case"date-time":return o.createElement("div",{className:r.className},e);case"image":return e&&"object"==typeof e&&e.url&&e.imageMeta?o.createElement("img",{src:e.url,width:e.imageMeta.height,height:e.imageMeta.height,className:r.className}):null;default:!function(e){throw new Error("unexpected branch taken")}()}}(p,f.type,{className:n}):o.createElement("div",null,"(no data returned)")}var z={name:T+"-row-link",displayName:"CMS Row Link",importName:"CmsRowLink",importPath:q,props:{children:{type:"slot",defaultValue:{type:"vbox",tag:"a",value:"Link"}},table:{type:"choice",displayName:"Model",description:"CMS model (table) to use.",options:function(e,t){return M(null==t?void 0:t.tables)}},field:{type:"choice",displayName:"Field",description:"Field (from model schema) to use.",options:function(e,t){var r;return F(null==t?void 0:t.tables,null!=(r=null==t?void 0:t.table)?r:e.table)}},hrefProp:{type:"string",displayName:'"href" prop',description:"Prop to inject into children",defaultValue:"href"}}};function K(e){var t,r,n=e.table,a=e.field,i=e.hrefProp,u=e.children,c=e.setControlContextData,l=j(),s=k(n);if(!s||!s.row)return o.createElement("div",null,"Error: No CMS row found");l&&(null==c||c({tables:l,table:s.table}));var f=null==l||null==(t=l.find((function(e){return e.identifier===s.table})))?void 0:t.schema,p=a?null==f?void 0:f.fields.find((function(e){return e.identifier===a})):null==f?void 0:f.fields.find((function(e){return"text"===e.type}));if(!p)return o.createElement("div",null,"Error: No field to display");var d=(null==(r=s.row.data)?void 0:r[p.identifier])||"",h=o.Children.map(u,(function(e){var t;return o.isValidElement(e)?o.cloneElement(e,((t={})[i]=d,t)):e}));return o.createElement(o.Fragment,null,h)}var X={name:T+"-row-loader",displayName:"CMS Row Loader",importName:"CmsRowLoader",importPath:q,props:c({children:{type:"slot",defaultValue:{type:"component",name:T+"-row-field"}},row:{type:"string",displayName:"Entry ID",description:"Row identifier to query."},table:{type:"choice",displayName:"Model",description:"CMS model (table) to query.",options:function(e,t){return M(null==t?void 0:t.tables)}},useDraft:{type:"boolean",displayName:"Use drafts?",description:"If set, also query unpublished content.",defaultValue:!1}},{hideIfNotFound:{type:"boolean",defaultValue:!1,description:"Whether to show an error if no result is found"}})};function Z(e){var t=e.table,r=e.row,a=e.children,i=e.useDraft,c=e.hideIfNotFound,l=e.setControlContextData,s=C(),f=j();f&&(null==l||l({tables:f}));var p=JSON.stringify({component:"CmsRowLoader",table:t,row:r,databaseConfig:s,useDraft:i});return V(n.usePlasmicQueryData(p,u(b.mark((function e(){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}throw new Error("You must specify a model to fetch from.");case 2:if(r){e.next=4;break}throw new Error("You must specify an entry name to fetch.");case 4:return e.next=6,E(s).fetchRow(t,r,i);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))),(function(e){return o.createElement(D,{table:t,row:e},a)}),{hideIfNotFound:c})}exports.registerAll=function(e){var r=function(r,n){e?e.registerComponent(r,n):t(r,n)};r(Q,G),r(Y,J),r(W,B),r($,H),r(K,z),r(Z,X)};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@plasmicapp/host/registerComponent")),r=require("@plasmicapp/host"),n=require("@plasmicapp/query"),o=e(require("react")),a=require("@plasmicpkgs/plasmic-basic-components");function i(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function u(e){i(a,n,o,u,c,"next",e)}function c(e){i(a,n,o,u,c,"throw",e)}u(void 0)}))}}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function p(e,t,r){return(p=f()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&s(o,r.prototype),o}).apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return(d=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return p(e,arguments,l(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)})(e)}function h(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(o[r]=e[r]);return o}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return m(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var y,b=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),a=new N(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var u=g(i,r);if(u){if(u===s)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(e,r,a),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var s={};function f(){}function p(){}function d(){}var h={};u(h,o,(function(){return this}));var m=Object.getPrototypeOf,v=m&&m(m(_([])));v&&v!==t&&r.call(v,o)&&(h=v);var y=d.prototype=f.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){var n;this._invoke=function(o,a){function i(){return new t((function(n,i){!function n(o,a,i,u){var c=l(e[o],e,a);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,i,u)}),(function(e){n("throw",e,i,u)})):t.resolve(f).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,u)}))}u(c.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function g(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,g(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,s;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function _(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:C}}function C(){return{value:void 0,done:!0}}return p.prototype=d,u(y,"constructor",d),u(d,"constructor",p),p.displayName=u(d,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,u(e,i,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},b(w.prototype),u(w.prototype,a,(function(){return this})),e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(c(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},b(y),u(y,i,"Generator"),u(y,o,(function(){return this})),u(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=_,N.prototype={constructor:N,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,s):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),s},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),s}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:_(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(y={exports:{}}),y.exports);function w(e){return{where:e.where,limit:e.limit,order:[{field:e.orderBy,dir:e.desc?"desc":"asc"}]}}var g=function(e){var t,r;function n(t,r){var n;return(n=e.call(this,r)||this).status=t,n}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,s(t,r),n}(d(Error)),x=function(){function e(e){this.config=e}var t=e.prototype;return t.get=function(){var e=u(b.mark((function e(t,r){var n,o,a,i,u;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r={}),(n=new URL(this.config.host+"/api/v1/cms/databases/"+this.config.databaseId+t)).search=new URLSearchParams(r).toString(),e.next=5,fetch(n.toString(),{method:"GET",headers:{accept:"*/*","x-plasmic-api-project-tokens":this.config.projectId+":"+this.config.projectApiToken},mode:"cors"});case 5:if(200===(o=e.sent).status){e.next=25;break}return e.prev=7,e.next=10,o.json();case 10:if(e.t0=i=e.sent,null!=e.t0){e.next=15;break}e.t1=void 0,e.next=16;break;case 15:e.t1=null==(u=i.error)?void 0:u.message;case 16:a=e.t1,e.next=24;break;case 19:return e.prev=19,e.t2=e.catch(7),e.next=23,o.text();case 23:a=e.sent;case 24:throw new g(o.status,a);case 25:return e.next=27,o.json();case 27:return e.abrupt("return",e.sent);case 28:case"end":return e.stop()}}),e,this,[[7,19]])})));return function(t,r){return e.apply(this,arguments)}}(),t.fetchTables=function(){var e=u(b.mark((function e(){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.get("");case 3:return e.abrupt("return",e.sent.tables);case 7:throw e.prev=7,e.t0=e.catch(0),console.error(e.t0),e.t0;case 11:case"end":return e.stop()}}),e,this,[[0,7]])})));return function(){return e.apply(this,arguments)}}(),t.query=function(){var e=u(b.mark((function e(t,r){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.get("/tables/"+t+"/query",{q:JSON.stringify(w(r)),useDraft:Number(r.useDraft)});case 3:return e.abrupt("return",e.sent.rows);case 7:throw e.prev=7,e.t0=e.catch(0),console.error(e.t0),e.t0;case 11:case"end":return e.stop()}}),e,this,[[0,7]])})));return function(t,r){return e.apply(this,arguments)}}(),t.fetchRow=function(){var e=u(b.mark((function e(t,r,n){var o;return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,o=n?"?draft=1":"",e.next=4,this.get("/tables/"+t+"/rows/"+r+o);case 4:return e.abrupt("return",e.sent);case 8:throw e.prev=8,e.t0=e.catch(0),console.error(e.t0),e.t0;case 12:case"end":return e.stop()}}),e,this,[[0,8]])})));return function(t,r,n){return e.apply(this,arguments)}}(),e}();function E(e){if(!e)throw new Error("Component must be wrapped in 'CMS Data Provider'.");return new x(e)}var N=function(e){return"__plasmic_cms_query_"+e},_=function(e){return"__plasmic_cms_row_"+e};function C(){return a.useSelector("__plasmic_cms_database")}function S(e){return o.createElement(a.DataProvider,{name:"__plasmic_cms_database",data:e.config},e.children)}function j(){return a.useSelector("__plasmic_cms_tables")}function L(e){return o.createElement(a.DataProvider,{name:"__plasmic_cms_tables",data:e.tables},e.children)}function O(e,t){return[].concat(Object.keys(e).reverse()).filter((function(e){return e.startsWith(t)}))}function P(e){var t=e.children,r=e.rows;return o.createElement(a.DataProvider,{name:N(e.table),data:r},t)}function k(e){var t=a.useDataEnv(),r=j();if(t){if(e)return{table:e,row:t[_(e)]};if(r)for(var n,o=function(){var e=n.value,o=r.find((function(t){return _(t.identifier)===e}));if(o)return{v:{table:o.identifier,row:t[e]}}},i=v(O(t,"__plasmic_cms_row_"));!(n=i()).done;){var u=o();if("object"==typeof u)return u.v}}}function D(e){var t=e.children,r=e.row;return o.createElement(a.DataProvider,{name:_(e.table),data:r},t)}function M(e){return e?e.map((function(e){return{value:e.identifier,label:e.name}})):[]}function F(e,t){if(!e)return[];var r=e.find((function(e){return e.identifier===t}));return r?r.schema.fields.map((function(e){var t;return{value:e.identifier,label:null!=(t=e.name)?t:e.identifier}})):[]}var R=["children"],I=["table","children","setControlContextData"],q="@plasmicpkgs/plasmic-cms",T="hostless-plasmic-cms";function V(e,t,r){if("error"in e){var n=e.error;return n&&n instanceof g&&404===n.status?r.hideIfNotFound?null:o.createElement("div",null,"Error: Data not found"):o.createElement("div",null,"Error: ",null==n?void 0:n.message)}return"data"in e?t(e.data):o.createElement("div",null,"Loading...")}var A="https://studio.plasmic.app",G={name:T+"-data-provider",displayName:"CMS Data Provider",importName:"CmsDataProvider",importPath:q,props:{host:{type:"string",displayName:"Studio URL",description:"The default host for use in production is "+A+".",defaultValue:A,defaultValueHint:A},databaseId:{type:"string",displayName:"CMS ID",description:"The ID of the CMS (database) to use."},projectId:{type:"string",displayName:"Project ID",description:"This project's ID."},projectApiToken:{type:"string",displayName:"Project API token",description:"This project's API token."},children:{type:"slot",defaultValue:{type:"vbox",children:[]}}}};function Q(e){var t=e.children,r=h(e,R);return r.host=r.host||A,o.createElement(S,{config:r},o.createElement(U,null,t))}function U(e){var t=e.children,r=C(),a=JSON.stringify({component:"TablesFetcher",databaseConfig:r});return V(n.usePlasmicQueryData(a,u(b.mark((function e(){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",E(r).fetchTables());case 1:case"end":return e.stop()}}),e)})))),(function(e){return o.createElement(L,{tables:e},t)}),{hideIfNotFound:!1})}var J={name:T+"-query-loader",displayName:"CMS Query Loader",importName:"CmsQueryLoader",importPath:q,props:{children:{type:"slot",defaultValue:{type:"component",name:T+"-row-repeater"}},table:{type:"choice",displayName:"Model",description:"CMS model (table) to query.",options:function(e,t){return M(null==t?void 0:t.tables)}},useDraft:{type:"boolean",displayName:"Use drafts?",description:"If set, also query unpublished content.",defaultValue:!1},where:{type:"object",displayName:"Filter",description:"Filter clause, in JSON format."},orderBy:{type:"choice",displayName:"Order by",description:"Field to order by.",options:function(e,t){return F(null==t?void 0:t.tables,e.table)}},desc:{type:"boolean",displayName:"Sort descending?",description:'Sort descending by "Order by" field.',defaultValue:!1},limit:{type:"number",displayName:"Limit",description:"Maximum number of entries to fetch (0 for unlimited).",defaultValue:0}}};function Y(e){var t=e.table,r=e.children,a=e.setControlContextData,i=h(e,I),c=C(),l=j();l&&(null==a||a({tables:l}));var s=JSON.stringify({component:"CmsQueryLoader",table:t,databaseConfig:c,params:i});return V(n.usePlasmicQueryData(s,u(b.mark((function e(){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=4;break}throw new Error("You must select a table to query");case 4:if(!l||l.find((function(e){return e.identifier===t}))){e.next=6;break}throw new Error('There is no table called "'+t+'"');case 6:return e.abrupt("return",E(c).query(t,i));case 7:case"end":return e.stop()}}),e)})))),(function(e){return o.createElement(P,{table:t,rows:e},r)}),{hideIfNotFound:!1})}var B={name:T+"-row-repeater",displayName:"CMS Row Repeater",importName:"CmsRowRepeater",importPath:q,props:{children:{type:"slot",defaultValue:{type:"component",name:T+"-row-field"}},table:{type:"choice",displayName:"Model",description:"CMS model (table) to use.",options:function(e,t){return M(null==t?void 0:t.tables)}}}};function W(e){var t=e.table,n=e.children,i=e.setControlContextData,u=j();u&&(null==i||i({tables:u}));var c=function(e){var t=a.useDataEnv(),r=j();if(t){var n;if(e)return{table:e,rows:null!=(n=t[N(e)])?n:[]};if(r)for(var o,i=function(){var e,n=o.value,a=r.find((function(e){return N(e.identifier)===n}));if(a)return{v:{table:a.identifier,rows:null!=(e=t[n])?e:[]}}},u=v(O(t,"__plasmic_cms_query_"));!(o=u()).done;){var c=i();if("object"==typeof c)return c.v}}}(t);return c?o.createElement(o.Fragment,null,c.rows.map((function(e,t){return o.createElement(D,{table:c.table,row:e},r.repeatedElement(0===t,n))}))):o.createElement("div",null,"Error: No CMS query result to repeat.")}var H={name:T+"-row-field",displayName:"CMS Row Field",importName:"CmsRowField",importPath:q,props:{table:{type:"choice",displayName:"Model",description:"CMS model (table) to use.",options:function(e,t){return M(null==t?void 0:t.tables)}},field:{type:"choice",displayName:"Field",description:"Field (from model schema) to use.",options:function(e,t){var r;return F(null==t?void 0:t.tables,null!=(r=null==t?void 0:t.table)?r:e.table)}}}};function $(e){var t,r,n=e.className,a=e.table,i=e.field,u=e.setControlContextData,c=j(),l=k(a);if(!l||!l.row)return o.createElement("div",null,"Error: No CMS Row found");c&&(null==u||u({tables:c,table:l.table}));var s=null==c||null==(t=c.find((function(e){return e.identifier===l.table})))?void 0:t.schema,f=i?null==s?void 0:s.fields.find((function(e){return e.identifier===i})):null==s?void 0:s.fields[0];if(!f)return o.createElement("div",null,"Error: No field to display");var p=null==(r=l.row.data)?void 0:r[f.identifier];return p?function(e,t,r){switch(t){case"number":case"boolean":case"text":case"long-text":case"date-time":return o.createElement("div",{className:r.className},e);case"image":return e&&"object"==typeof e&&e.url&&e.imageMeta?o.createElement("img",{src:e.url,width:e.imageMeta.height,height:e.imageMeta.height,className:r.className}):null;default:!function(e){throw new Error("unexpected branch taken")}()}}(p,f.type,{className:n}):o.createElement("div",null,"(no data returned)")}var z={name:T+"-row-link",displayName:"CMS Row Link",importName:"CmsRowLink",importPath:q,props:{children:{type:"slot",defaultValue:{type:"vbox",tag:"a",value:"Link"}},table:{type:"choice",displayName:"Model",description:"CMS model (table) to use.",options:function(e,t){return M(null==t?void 0:t.tables)}},field:{type:"choice",displayName:"Field",description:"Field (from model schema) to use.",options:function(e,t){var r;return F(null==t?void 0:t.tables,null!=(r=null==t?void 0:t.table)?r:e.table)}},hrefProp:{type:"string",displayName:'"href" prop',description:"Prop to inject into children",defaultValue:"href"}}};function K(e){var t,r,n=e.table,a=e.field,i=e.hrefProp,u=e.children,c=e.setControlContextData,l=j(),s=k(n);if(!s||!s.row)return o.createElement("div",null,"Error: No CMS row found");l&&(null==c||c({tables:l,table:s.table}));var f=null==l||null==(t=l.find((function(e){return e.identifier===s.table})))?void 0:t.schema,p=a?null==f?void 0:f.fields.find((function(e){return e.identifier===a})):null==f?void 0:f.fields.find((function(e){return"text"===e.type}));if(!p)return o.createElement("div",null,"Error: No field to display");var d=(null==(r=s.row.data)?void 0:r[p.identifier])||"",h=o.Children.map(u,(function(e){var t;return o.isValidElement(e)?o.cloneElement(e,((t={})[i]=d,t)):e}));return o.createElement(o.Fragment,null,h)}var X={name:T+"-row-loader",displayName:"CMS Row Loader",importName:"CmsRowLoader",importPath:q,props:c({children:{type:"slot",defaultValue:{type:"component",name:T+"-row-field"}},row:{type:"string",displayName:"Entry ID",description:"Row identifier to query."},table:{type:"choice",displayName:"Model",description:"CMS model (table) to query.",options:function(e,t){return M(null==t?void 0:t.tables)}},useDraft:{type:"boolean",displayName:"Use drafts?",description:"If set, also query unpublished content.",defaultValue:!1}},{hideIfNotFound:{type:"boolean",defaultValue:!1,description:"Whether to show an error if no result is found"}})};function Z(e){var t=e.table,r=e.row,a=e.children,i=e.useDraft,c=e.hideIfNotFound,l=e.setControlContextData,s=C(),f=j();f&&(null==l||l({tables:f}));var p=JSON.stringify({component:"CmsRowLoader",table:t,row:r,databaseConfig:s,useDraft:i});return V(n.usePlasmicQueryData(p,u(b.mark((function e(){return b.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}throw new Error("You must specify a model to fetch from.");case 2:if(r){e.next=4;break}throw new Error("You must specify an entry name to fetch.");case 4:return e.next=6,E(s).fetchRow(t,r,i);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))),(function(e){return o.createElement(D,{table:t,row:e},a)}),{hideIfNotFound:c})}exports.registerAll=function(e){var r=function(r,n){e?e.registerComponent(r,n):t(r,n)};r(Q,G),r(Y,J),r(W,B),r($,H),r(K,z),r(Z,X)};
//# sourceMappingURL=plasmic-cms.cjs.production.min.js.map

@@ -1393,5 +1393,7 @@ import registerComponent from '@plasmicapp/host/registerComponent';

return table.schema.fields.map(function (f) {
var _f$name;
return {
value: f.identifier,
label: f.name
label: (_f$name = f.name) != null ? _f$name : f.identifier
};

@@ -1398,0 +1400,0 @@ });

{
"name": "@plasmicpkgs/plasmic-cms",
"version": "0.0.11",
"version": "0.0.12",
"description": "Plasmic CMS components",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc