@plasmicpkgs/plasmic-wordpress 0.0.151 → 0.0.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -4
- package/dist/index.esm.js +11 -72
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +8 -69
- package/dist/index.js.map +4 -4
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -23,10 +23,6 @@ export declare function registerAll(loader?: {
|
|
|
23
23
|
registerGlobalContext: typeof registerGlobalContext;
|
|
24
24
|
}): void;
|
|
25
25
|
|
|
26
|
-
export declare function registerWordpress(loader?: {
|
|
27
|
-
registerFunction: any;
|
|
28
|
-
}): void;
|
|
29
|
-
|
|
30
26
|
export declare function WordpressFetcher({ queryOperator, filterValue, noAutoRepeat, limit, queryType, children, className, noLayout, }: WordpressFetcherProps): React_2.JSX.Element;
|
|
31
27
|
|
|
32
28
|
export declare const WordpressFetcherMeta: ComponentMeta<WordpressFetcherProps>;
|
package/dist/index.esm.js
CHANGED
|
@@ -21,11 +21,18 @@ var __async = (__this, __arguments, generator) => {
|
|
|
21
21
|
|
|
22
22
|
// src/index.tsx
|
|
23
23
|
import registerComponent from "@plasmicapp/host/registerComponent";
|
|
24
|
-
import registerFunction2 from "@plasmicapp/host/registerFunction";
|
|
25
24
|
import registerGlobalContext from "@plasmicapp/host/registerGlobalContext";
|
|
26
25
|
|
|
27
|
-
// src/
|
|
28
|
-
import
|
|
26
|
+
// src/wordpress.tsx
|
|
27
|
+
import {
|
|
28
|
+
DataProvider,
|
|
29
|
+
repeatedElement,
|
|
30
|
+
useSelector
|
|
31
|
+
} from "@plasmicapp/host";
|
|
32
|
+
import { usePlasmicQueryData } from "@plasmicapp/query";
|
|
33
|
+
import { queryWordpress } from "@plasmicpkgs/wordpress";
|
|
34
|
+
import get from "dlv";
|
|
35
|
+
import React, { useContext } from "react";
|
|
29
36
|
|
|
30
37
|
// src/utils.ts
|
|
31
38
|
var queryOperators = [
|
|
@@ -51,64 +58,7 @@ function ensure(x, message) {
|
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
// src/query-wordpress.ts
|
|
55
|
-
function queryWordpress(wordpressUrl, type, queryOperator, filterValue, limit) {
|
|
56
|
-
return __async(this, null, function* () {
|
|
57
|
-
const urlParams = new URLSearchParams();
|
|
58
|
-
if (queryOperator && filterValue) {
|
|
59
|
-
urlParams.append(queryOperator, filterValue);
|
|
60
|
-
}
|
|
61
|
-
if (limit) {
|
|
62
|
-
urlParams.append("per_page", limit.toString());
|
|
63
|
-
}
|
|
64
|
-
const url = new URL(`wp-json/wp/v2/${type}`, wordpressUrl);
|
|
65
|
-
url.search = urlParams.toString();
|
|
66
|
-
const resp = yield fetch(url);
|
|
67
|
-
return yield resp.json();
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
var queryWordpressMeta = {
|
|
71
|
-
name: "queryWordpress",
|
|
72
|
-
displayName: "Query WordPress",
|
|
73
|
-
importPath: "@plasmicpkgs/plasmic-wordpress",
|
|
74
|
-
params: [
|
|
75
|
-
{
|
|
76
|
-
name: "wordpressUrl",
|
|
77
|
-
type: "string"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: "queryType",
|
|
81
|
-
type: "choice",
|
|
82
|
-
options: ["pages", "posts"]
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "queryOperator",
|
|
86
|
-
type: "choice",
|
|
87
|
-
options: Object.values(queryOperators).map((item) => ({
|
|
88
|
-
label: item.label,
|
|
89
|
-
value: item.value
|
|
90
|
-
}))
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "filterValue",
|
|
94
|
-
type: "string"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: "limit",
|
|
98
|
-
type: "number"
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
};
|
|
102
|
-
|
|
103
61
|
// src/wordpress.tsx
|
|
104
|
-
import {
|
|
105
|
-
DataProvider,
|
|
106
|
-
repeatedElement,
|
|
107
|
-
useSelector
|
|
108
|
-
} from "@plasmicapp/host";
|
|
109
|
-
import { usePlasmicQueryData } from "@plasmicapp/query";
|
|
110
|
-
import get from "dlv";
|
|
111
|
-
import React, { useContext } from "react";
|
|
112
62
|
var modulePath = "@plasmicpkgs/plasmic-wordpress";
|
|
113
63
|
var CredentialsContext = React.createContext(void 0);
|
|
114
64
|
var WordpressProviderMeta = {
|
|
@@ -303,16 +253,6 @@ function WordpressField({ className, field }) {
|
|
|
303
253
|
}
|
|
304
254
|
|
|
305
255
|
// src/index.tsx
|
|
306
|
-
function registerWordpress(loader) {
|
|
307
|
-
function _registerFunction(fn, meta) {
|
|
308
|
-
if (loader) {
|
|
309
|
-
loader.registerFunction(fn, meta);
|
|
310
|
-
} else {
|
|
311
|
-
registerFunction2(fn, meta);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
_registerFunction(queryWordpress, queryWordpressMeta);
|
|
315
|
-
}
|
|
316
256
|
function registerAll(loader) {
|
|
317
257
|
const _registerComponent = (Component, defaultMeta) => {
|
|
318
258
|
if (loader) {
|
|
@@ -336,7 +276,6 @@ export {
|
|
|
336
276
|
WordpressFieldMeta,
|
|
337
277
|
WordpressProvider,
|
|
338
278
|
WordpressProviderMeta,
|
|
339
|
-
registerAll
|
|
340
|
-
registerWordpress
|
|
279
|
+
registerAll
|
|
341
280
|
};
|
|
342
281
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/index.tsx", "../src/
|
|
4
|
-
"sourcesContent": ["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerFunction, {\n CustomFunctionMeta,\n} from \"@plasmicapp/host/registerFunction\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport { queryWordpress, queryWordpressMeta } from \"./query-wordpress\";\nimport {\n WordpressFetcher,\n WordpressFetcherMeta,\n WordpressField,\n WordpressFieldMeta,\n WordpressProvider,\n WordpressProviderMeta,\n} from \"./wordpress\";\n\nexport function registerWordpress(loader?: { registerFunction: any }) {\n function _registerFunction<T extends (...args: any[]) => any>(\n fn: T,\n meta: CustomFunctionMeta<T>\n ) {\n if (loader) {\n loader.registerFunction(fn, meta);\n } else {\n registerFunction(fn, meta);\n }\n }\n\n _registerFunction(queryWordpress, queryWordpressMeta);\n}\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n const _registerComponent = <T extends React.ComponentType<any>>(\n Component: T,\n defaultMeta: ComponentMeta<React.ComponentProps<T>>\n ) => {\n if (loader) {\n loader.registerComponent(Component, defaultMeta);\n } else {\n registerComponent(Component, defaultMeta);\n }\n };\n\n if (loader) {\n loader.registerGlobalContext(WordpressProvider, WordpressProviderMeta);\n } else {\n registerGlobalContext(WordpressProvider, WordpressProviderMeta);\n }\n\n _registerComponent(WordpressFetcher, WordpressFetcherMeta);\n _registerComponent(WordpressField, WordpressFieldMeta);\n}\n\nexport * from \"./wordpress\";\n", "import registerFunction, {\n CustomFunctionMeta,\n} from \"@plasmicapp/host/registerFunction\";\n\nimport { QueryOperator, queryOperators } from \"./utils\";\n\nexport async function queryWordpress(\n wordpressUrl: string,\n type: \"pages\" | \"posts\",\n queryOperator?: QueryOperator,\n filterValue?: string,\n limit?: number\n): Promise<any> {\n const urlParams = new URLSearchParams();\n if (queryOperator && filterValue) {\n urlParams.append(queryOperator, filterValue);\n }\n if (limit) {\n urlParams.append(\"per_page\", limit.toString());\n }\n const url = new URL(`wp-json/wp/v2/${type}`, wordpressUrl);\n url.search = urlParams.toString();\n\n const resp = await fetch(url);\n return await resp.json();\n}\n\nexport const queryWordpressMeta: CustomFunctionMeta<typeof queryWordpress> = {\n name: \"queryWordpress\",\n displayName: \"Query WordPress\",\n importPath: \"@plasmicpkgs/plasmic-wordpress\",\n params: [\n {\n name: \"wordpressUrl\",\n type: \"string\",\n },\n {\n name: \"queryType\",\n type: \"choice\",\n options: [\"pages\", \"posts\"],\n },\n {\n name: \"queryOperator\",\n type: \"choice\",\n options: Object.values(queryOperators).map((item) => ({\n label: item.label,\n value: item.value,\n })),\n },\n {\n name: \"filterValue\",\n type: \"string\",\n },\n {\n name: \"limit\",\n type: \"number\",\n },\n ],\n};\n\nexport function registerAllCustomFunctions(loader?: { registerFunction: any }) {\n function _registerFunction<T extends (...args: any[]) => any>(\n fn: T,\n meta: CustomFunctionMeta<T>\n ) {\n if (loader) {\n loader.registerFunction(fn, meta);\n } else {\n registerFunction(fn, meta);\n }\n }\n\n _registerFunction(queryWordpress, queryWordpressMeta);\n}\n", "export const queryOperators = [\n {\n value: \"search\",\n label: \"Search\",\n },\n {\n value: \"slug\",\n label: \"Filter by Slug\",\n },\n {\n value: \"author\",\n label: \"Filter by author\",\n },\n] as const;\n\nexport type QueryOperator = (typeof queryOperators)[number][\"value\"];\n\nexport function ensure<T>(x: T | null | undefined, message?: string): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(message ?? `Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n", "import {\n ComponentMeta,\n DataProvider,\n GlobalContextMeta,\n repeatedElement,\n useSelector,\n} from \"@plasmicapp/host\";\nimport { usePlasmicQueryData } from \"@plasmicapp/query\";\nimport get from \"dlv\";\nimport React, { ReactNode, useContext } from \"react\";\nimport { queryWordpress } from \"./query-wordpress\";\nimport { ensure, queryOperators, type QueryOperator } from \"./utils\";\n\nconst modulePath = \"@plasmicpkgs/plasmic-wordpress\";\n\ninterface WordpressProviderProps {\n wordpressUrl?: string;\n}\n\nconst CredentialsContext = React.createContext<\n WordpressProviderProps | undefined\n>(undefined);\n\nexport const WordpressProviderMeta: GlobalContextMeta<WordpressProviderProps> =\n {\n name: \"WordpressProvider\",\n displayName: \"Wordpress Provider\",\n description: \"The endpoint of your Wordpress\",\n importName: \"WordpressProvider\",\n importPath: modulePath,\n props: {\n wordpressUrl: {\n type: \"string\",\n displayName: \"Wordpress URL\",\n description: \"URL of your Wordpress \",\n defaultValue: \"https://techcrunch.com/\",\n },\n },\n };\n\nexport function WordpressProvider({\n wordpressUrl,\n children,\n}: React.PropsWithChildren<WordpressProviderProps>) {\n return (\n <CredentialsContext.Provider value={{ wordpressUrl }}>\n {children}\n </CredentialsContext.Provider>\n );\n}\n\ninterface WordpressFetcherProps {\n children?: ReactNode;\n className?: string;\n noLayout?: boolean;\n queryType?: \"posts\" | \"pages\";\n noAutoRepeat?: boolean;\n limit?: number;\n queryOperator?: QueryOperator;\n filterValue?: string;\n setControlContextData?: (data: {\n posts?: { value: string; label: string }[];\n pages?: { value: string; label: string }[];\n }) => void;\n}\n\nexport const WordpressFetcherMeta: ComponentMeta<WordpressFetcherProps> = {\n name: \"WordpressFetcher\",\n displayName: \"Wordpress Fetcher\",\n importName: \"WordpressFetcher\",\n importPath: modulePath,\n providesData: true,\n description:\n \"Fetches Wordpress data and repeats content of children once for every row fetched. \",\n defaultStyles: {\n display: \"grid\",\n gridTemplateColumns: \"1fr\",\n gridRowGap: \"8px\",\n padding: \"8px\",\n maxWidth: \"100%\",\n },\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"vbox\",\n styles: {\n padding: \"8px\",\n },\n children: {\n type: \"component\",\n name: \"WordpressField\",\n },\n },\n },\n queryType: {\n type: \"choice\",\n options: [\"posts\", \"pages\"],\n },\n queryOperator: {\n type: \"choice\",\n displayName: \"Query Operator\",\n description: \"Filter Parameter filter by\",\n options: () => {\n return queryOperators.map((item: any) => ({\n label: item?.label,\n value: item?.value,\n }));\n },\n hidden: (props) => !props.queryType,\n },\n\n filterValue: {\n type: \"string\",\n displayName: \"Filter value\",\n description: \"Value to filter\",\n hidden: (props) => !props.queryOperator,\n },\n limit: {\n type: \"number\",\n displayName: \"Limit\",\n description: \"Limit\",\n },\n noAutoRepeat: {\n type: \"boolean\",\n displayName: \"No auto-repeat\",\n description:\n \"Do not automatically repeat children for every posts or pages.\",\n defaultValue: false,\n },\n noLayout: {\n type: \"boolean\",\n displayName: \"No layout\",\n description:\n \"When set, Wordpress Fetcher will not layout its children; instead, the layout set on its parent element will be used. Useful if you want to set flex gap or control container tag type.\",\n defaultValue: false,\n },\n },\n};\n\nexport function WordpressFetcher({\n queryOperator,\n filterValue,\n noAutoRepeat,\n limit,\n queryType,\n children,\n className,\n noLayout,\n}: WordpressFetcherProps) {\n const { wordpressUrl } = ensure(\n useContext(CredentialsContext),\n \"WordpressFetcher must be used within a WordpressProvider\"\n );\n const cacheKey = JSON.stringify({\n queryOperator,\n filterValue,\n limit,\n queryType,\n wordpressUrl,\n });\n\n const { data } = usePlasmicQueryData<any | null>(\n queryType && wordpressUrl ? cacheKey : null,\n async () => {\n return queryWordpress(\n ensure(wordpressUrl, \"Wordpress URL must be specified\"),\n ensure(queryType, \"Query Type must be specified\"),\n queryOperator,\n filterValue,\n limit\n );\n }\n );\n\n const hasFilter = queryOperator && filterValue;\n\n if (!queryType) {\n return <div>Please specify query type</div>;\n }\n\n if (queryOperator && !filterValue) {\n return <div>Please specify Filter Value</div>;\n }\n if (!queryOperator && filterValue) {\n return <div>Please specify Query Operator</div>;\n }\n if (hasFilter && data?.length === 0) {\n return <div>No published {queryType} found</div>;\n }\n\n const currentName = `currentWordpress${\n queryType === \"posts\" ? \"Post\" : \"Page\"\n }`;\n const renderedData = noAutoRepeat\n ? children\n : data?.map((item: any, i: number) => (\n <DataProvider key={item.id} name={currentName} data={item}>\n {repeatedElement(i, children)}\n </DataProvider>\n ));\n\n const response = data;\n return (\n <DataProvider data={response} name=\"wordpressItems\">\n {noLayout ? (\n <> {renderedData} </>\n ) : (\n <div className={className}> {renderedData} </div>\n )}\n </DataProvider>\n );\n}\n\ninterface WordpressFieldProps {\n className?: string;\n field?: string;\n setControlContextData?: (data: { data: any }) => void;\n}\nexport const WordpressFieldMeta: ComponentMeta<WordpressFieldProps> = {\n name: \"WordpressField\",\n displayName: \"Wordpress Field\",\n importName: \"WordpressField\",\n importPath: modulePath,\n props: {\n field: {\n type: \"choice\",\n options: [\n \"title\",\n \"slug\",\n \"content\",\n \"excerpt\",\n \"date\",\n \"modified\",\n \"link\",\n \"status\",\n ],\n displayName: \"Field\",\n description: \"Field to be displayed.\",\n },\n },\n};\nexport function WordpressField({ className, field }: WordpressFieldProps) {\n const currentPost = useSelector(\"currentWordpressPost\");\n const currentPage = useSelector(\"currentWordpressPage\");\n\n const item = currentPost || currentPage;\n\n if (!item) {\n return <div>WordpressField must be used within a WordpressFetcher </div>;\n }\n\n if (!field) {\n return <div>Please specify a valid path or select a field.</div>;\n }\n\n const data = get(item, field as string);\n\n if (typeof data === \"object\" && \"rendered\" in data) {\n return (\n <div\n className={className}\n style={{ whiteSpace: \"normal\" }}\n dangerouslySetInnerHTML={{ __html: data.rendered }}\n />\n );\n } else if (!data || typeof data === \"object\") {\n return <div className={className}>Please specify a valid field.</div>;\n } else {\n return <div className={className}> {data} </div>;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,uBAEA;AACP,
|
|
6
|
-
"names": [
|
|
3
|
+
"sources": ["../src/index.tsx", "../src/wordpress.tsx", "../src/utils.ts"],
|
|
4
|
+
"sourcesContent": ["import registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n WordpressFetcher,\n WordpressFetcherMeta,\n WordpressField,\n WordpressFieldMeta,\n WordpressProvider,\n WordpressProviderMeta,\n} from \"./wordpress\";\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n const _registerComponent = <T extends React.ComponentType<any>>(\n Component: T,\n defaultMeta: CodeComponentMeta<React.ComponentProps<T>>\n ) => {\n if (loader) {\n loader.registerComponent(Component, defaultMeta);\n } else {\n registerComponent(Component, defaultMeta);\n }\n };\n\n if (loader) {\n loader.registerGlobalContext(WordpressProvider, WordpressProviderMeta);\n } else {\n registerGlobalContext(WordpressProvider, WordpressProviderMeta);\n }\n\n _registerComponent(WordpressFetcher, WordpressFetcherMeta);\n _registerComponent(WordpressField, WordpressFieldMeta);\n}\n\nexport * from \"./wordpress\";\n", "import {\n ComponentMeta,\n DataProvider,\n GlobalContextMeta,\n repeatedElement,\n useSelector,\n} from \"@plasmicapp/host\";\nimport { usePlasmicQueryData } from \"@plasmicapp/query\";\nimport { queryWordpress } from \"@plasmicpkgs/wordpress\";\nimport get from \"dlv\";\nimport React, { ReactNode, useContext } from \"react\";\nimport { ensure, queryOperators, type QueryOperator } from \"./utils\";\n\nconst modulePath = \"@plasmicpkgs/plasmic-wordpress\";\n\ninterface WordpressProviderProps {\n wordpressUrl?: string;\n}\n\nconst CredentialsContext = React.createContext<\n WordpressProviderProps | undefined\n>(undefined);\n\nexport const WordpressProviderMeta: GlobalContextMeta<WordpressProviderProps> =\n {\n name: \"WordpressProvider\",\n displayName: \"Wordpress Provider\",\n description: \"The endpoint of your Wordpress\",\n importName: \"WordpressProvider\",\n importPath: modulePath,\n props: {\n wordpressUrl: {\n type: \"string\",\n displayName: \"Wordpress URL\",\n description: \"URL of your Wordpress \",\n defaultValue: \"https://techcrunch.com/\",\n },\n },\n };\n\nexport function WordpressProvider({\n wordpressUrl,\n children,\n}: React.PropsWithChildren<WordpressProviderProps>) {\n return (\n <CredentialsContext.Provider value={{ wordpressUrl }}>\n {children}\n </CredentialsContext.Provider>\n );\n}\n\ninterface WordpressFetcherProps {\n children?: ReactNode;\n className?: string;\n noLayout?: boolean;\n queryType?: \"posts\" | \"pages\";\n noAutoRepeat?: boolean;\n limit?: number;\n queryOperator?: QueryOperator;\n filterValue?: string;\n setControlContextData?: (data: {\n posts?: { value: string; label: string }[];\n pages?: { value: string; label: string }[];\n }) => void;\n}\n\nexport const WordpressFetcherMeta: ComponentMeta<WordpressFetcherProps> = {\n name: \"WordpressFetcher\",\n displayName: \"Wordpress Fetcher\",\n importName: \"WordpressFetcher\",\n importPath: modulePath,\n providesData: true,\n description:\n \"Fetches Wordpress data and repeats content of children once for every row fetched. \",\n defaultStyles: {\n display: \"grid\",\n gridTemplateColumns: \"1fr\",\n gridRowGap: \"8px\",\n padding: \"8px\",\n maxWidth: \"100%\",\n },\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"vbox\",\n styles: {\n padding: \"8px\",\n },\n children: {\n type: \"component\",\n name: \"WordpressField\",\n },\n },\n },\n queryType: {\n type: \"choice\",\n options: [\"posts\", \"pages\"],\n },\n queryOperator: {\n type: \"choice\",\n displayName: \"Query Operator\",\n description: \"Filter Parameter filter by\",\n options: () => {\n return queryOperators.map((item: any) => ({\n label: item?.label,\n value: item?.value,\n }));\n },\n hidden: (props) => !props.queryType,\n },\n\n filterValue: {\n type: \"string\",\n displayName: \"Filter value\",\n description: \"Value to filter\",\n hidden: (props) => !props.queryOperator,\n },\n limit: {\n type: \"number\",\n displayName: \"Limit\",\n description: \"Limit\",\n },\n noAutoRepeat: {\n type: \"boolean\",\n displayName: \"No auto-repeat\",\n description:\n \"Do not automatically repeat children for every posts or pages.\",\n defaultValue: false,\n },\n noLayout: {\n type: \"boolean\",\n displayName: \"No layout\",\n description:\n \"When set, Wordpress Fetcher will not layout its children; instead, the layout set on its parent element will be used. Useful if you want to set flex gap or control container tag type.\",\n defaultValue: false,\n },\n },\n};\n\nexport function WordpressFetcher({\n queryOperator,\n filterValue,\n noAutoRepeat,\n limit,\n queryType,\n children,\n className,\n noLayout,\n}: WordpressFetcherProps) {\n const { wordpressUrl } = ensure(\n useContext(CredentialsContext),\n \"WordpressFetcher must be used within a WordpressProvider\"\n );\n const cacheKey = JSON.stringify({\n queryOperator,\n filterValue,\n limit,\n queryType,\n wordpressUrl,\n });\n\n const { data } = usePlasmicQueryData<any | null>(\n queryType && wordpressUrl ? cacheKey : null,\n async () => {\n return queryWordpress(\n ensure(wordpressUrl, \"Wordpress URL must be specified\"),\n ensure(queryType, \"Query Type must be specified\"),\n queryOperator,\n filterValue,\n limit\n );\n }\n );\n\n const hasFilter = queryOperator && filterValue;\n\n if (!queryType) {\n return <div>Please specify query type</div>;\n }\n\n if (queryOperator && !filterValue) {\n return <div>Please specify Filter Value</div>;\n }\n if (!queryOperator && filterValue) {\n return <div>Please specify Query Operator</div>;\n }\n if (hasFilter && data?.length === 0) {\n return <div>No published {queryType} found</div>;\n }\n\n const currentName = `currentWordpress${\n queryType === \"posts\" ? \"Post\" : \"Page\"\n }`;\n const renderedData = noAutoRepeat\n ? children\n : data?.map((item: any, i: number) => (\n <DataProvider key={item.id} name={currentName} data={item}>\n {repeatedElement(i, children)}\n </DataProvider>\n ));\n\n const response = data;\n return (\n <DataProvider data={response} name=\"wordpressItems\">\n {noLayout ? (\n <> {renderedData} </>\n ) : (\n <div className={className}> {renderedData} </div>\n )}\n </DataProvider>\n );\n}\n\ninterface WordpressFieldProps {\n className?: string;\n field?: string;\n setControlContextData?: (data: { data: any }) => void;\n}\nexport const WordpressFieldMeta: ComponentMeta<WordpressFieldProps> = {\n name: \"WordpressField\",\n displayName: \"Wordpress Field\",\n importName: \"WordpressField\",\n importPath: modulePath,\n props: {\n field: {\n type: \"choice\",\n options: [\n \"title\",\n \"slug\",\n \"content\",\n \"excerpt\",\n \"date\",\n \"modified\",\n \"link\",\n \"status\",\n ],\n displayName: \"Field\",\n description: \"Field to be displayed.\",\n },\n },\n};\nexport function WordpressField({ className, field }: WordpressFieldProps) {\n const currentPost = useSelector(\"currentWordpressPost\");\n const currentPage = useSelector(\"currentWordpressPage\");\n\n const item = currentPost || currentPage;\n\n if (!item) {\n return <div>WordpressField must be used within a WordpressFetcher </div>;\n }\n\n if (!field) {\n return <div>Please specify a valid path or select a field.</div>;\n }\n\n const data = get(item, field as string);\n\n if (typeof data === \"object\" && \"rendered\" in data) {\n return (\n <div\n className={className}\n style={{ whiteSpace: \"normal\" }}\n dangerouslySetInnerHTML={{ __html: data.rendered }}\n />\n );\n } else if (!data || typeof data === \"object\") {\n return <div className={className}>Please specify a valid field.</div>;\n } else {\n return <div className={className}> {data} </div>;\n }\n}\n", "export const queryOperators = [\n {\n value: \"search\",\n label: \"Search\",\n },\n {\n value: \"slug\",\n label: \"Filter by Slug\",\n },\n {\n value: \"author\",\n label: \"Filter by author\",\n },\n] as const;\n\nexport type QueryOperator = (typeof queryOperators)[number][\"value\"];\n\nexport function ensure<T>(x: T | null | undefined, message?: string): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(message ?? `Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,uBAEA;AACP,OAAO,2BAA2B;;;ACHlC;AAAA,EAEE;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AACP,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAC/B,OAAO,SAAS;AAChB,OAAO,SAAoB,kBAAkB;;;ACVtC,IAAM,iBAAiB;AAAA,EAC5B;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AACF;AAIO,SAAS,OAAU,GAAyB,SAAqB;AACtE,MAAI,MAAM,QAAQ,MAAM,QAAW;AACjC;AACA,UAAM,IAAI,MAAM,4BAAW,qCAAqC;AAAA,EAClE,OAAO;AACL,WAAO;AAAA,EACT;AACF;;;ADXA,IAAM,aAAa;AAMnB,IAAM,qBAAqB,MAAM,cAE/B,MAAS;AAEJ,IAAM,wBACX;AAAA,EACE,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,aA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O,kBAAkB,WAAW,WAAW;AAAA,IACjD,OAAO;AACL,wBAAkB,WAAW,WAAW;AAAA,IAC1C;AAAA,EACF;AAEA,MAAI,QAAQ;AACV,WAAO,sBAAsB,mBAAmB,qBAAqB;AAAA,EACvE,OAAO;AACL,0BAAsB,mBAAmB,qBAAqB;AAAA,EAChE;AAEA,qBAAmB,kBAAkB,oBAAoB;AACzD,qBAAmB,gBAAgB,kBAAkB;AACvD;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/index.js
CHANGED
|
@@ -56,16 +56,18 @@ __export(src_exports, {
|
|
|
56
56
|
WordpressFieldMeta: () => WordpressFieldMeta,
|
|
57
57
|
WordpressProvider: () => WordpressProvider,
|
|
58
58
|
WordpressProviderMeta: () => WordpressProviderMeta,
|
|
59
|
-
registerAll: () => registerAll
|
|
60
|
-
registerWordpress: () => registerWordpress
|
|
59
|
+
registerAll: () => registerAll
|
|
61
60
|
});
|
|
62
61
|
module.exports = __toCommonJS(src_exports);
|
|
63
62
|
var import_registerComponent = __toESM(require("@plasmicapp/host/registerComponent"));
|
|
64
|
-
var import_registerFunction2 = __toESM(require("@plasmicapp/host/registerFunction"));
|
|
65
63
|
var import_registerGlobalContext = __toESM(require("@plasmicapp/host/registerGlobalContext"));
|
|
66
64
|
|
|
67
|
-
// src/
|
|
68
|
-
var
|
|
65
|
+
// src/wordpress.tsx
|
|
66
|
+
var import_host = require("@plasmicapp/host");
|
|
67
|
+
var import_query = require("@plasmicapp/query");
|
|
68
|
+
var import_wordpress = require("@plasmicpkgs/wordpress");
|
|
69
|
+
var import_dlv = __toESM(require("dlv"));
|
|
70
|
+
var import_react = __toESM(require("react"));
|
|
69
71
|
|
|
70
72
|
// src/utils.ts
|
|
71
73
|
var queryOperators = [
|
|
@@ -91,60 +93,7 @@ function ensure(x, message) {
|
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
|
|
94
|
-
// src/query-wordpress.ts
|
|
95
|
-
function queryWordpress(wordpressUrl, type, queryOperator, filterValue, limit) {
|
|
96
|
-
return __async(this, null, function* () {
|
|
97
|
-
const urlParams = new URLSearchParams();
|
|
98
|
-
if (queryOperator && filterValue) {
|
|
99
|
-
urlParams.append(queryOperator, filterValue);
|
|
100
|
-
}
|
|
101
|
-
if (limit) {
|
|
102
|
-
urlParams.append("per_page", limit.toString());
|
|
103
|
-
}
|
|
104
|
-
const url = new URL(`wp-json/wp/v2/${type}`, wordpressUrl);
|
|
105
|
-
url.search = urlParams.toString();
|
|
106
|
-
const resp = yield fetch(url);
|
|
107
|
-
return yield resp.json();
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
var queryWordpressMeta = {
|
|
111
|
-
name: "queryWordpress",
|
|
112
|
-
displayName: "Query WordPress",
|
|
113
|
-
importPath: "@plasmicpkgs/plasmic-wordpress",
|
|
114
|
-
params: [
|
|
115
|
-
{
|
|
116
|
-
name: "wordpressUrl",
|
|
117
|
-
type: "string"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: "queryType",
|
|
121
|
-
type: "choice",
|
|
122
|
-
options: ["pages", "posts"]
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "queryOperator",
|
|
126
|
-
type: "choice",
|
|
127
|
-
options: Object.values(queryOperators).map((item) => ({
|
|
128
|
-
label: item.label,
|
|
129
|
-
value: item.value
|
|
130
|
-
}))
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: "filterValue",
|
|
134
|
-
type: "string"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
name: "limit",
|
|
138
|
-
type: "number"
|
|
139
|
-
}
|
|
140
|
-
]
|
|
141
|
-
};
|
|
142
|
-
|
|
143
96
|
// src/wordpress.tsx
|
|
144
|
-
var import_host = require("@plasmicapp/host");
|
|
145
|
-
var import_query = require("@plasmicapp/query");
|
|
146
|
-
var import_dlv = __toESM(require("dlv"));
|
|
147
|
-
var import_react = __toESM(require("react"));
|
|
148
97
|
var modulePath = "@plasmicpkgs/plasmic-wordpress";
|
|
149
98
|
var CredentialsContext = import_react.default.createContext(void 0);
|
|
150
99
|
var WordpressProviderMeta = {
|
|
@@ -261,7 +210,7 @@ function WordpressFetcher({
|
|
|
261
210
|
const { data } = (0, import_query.usePlasmicQueryData)(
|
|
262
211
|
queryType && wordpressUrl ? cacheKey : null,
|
|
263
212
|
() => __async(this, null, function* () {
|
|
264
|
-
return queryWordpress(
|
|
213
|
+
return (0, import_wordpress.queryWordpress)(
|
|
265
214
|
ensure(wordpressUrl, "Wordpress URL must be specified"),
|
|
266
215
|
ensure(queryType, "Query Type must be specified"),
|
|
267
216
|
queryOperator,
|
|
@@ -339,16 +288,6 @@ function WordpressField({ className, field }) {
|
|
|
339
288
|
}
|
|
340
289
|
|
|
341
290
|
// src/index.tsx
|
|
342
|
-
function registerWordpress(loader) {
|
|
343
|
-
function _registerFunction(fn, meta) {
|
|
344
|
-
if (loader) {
|
|
345
|
-
loader.registerFunction(fn, meta);
|
|
346
|
-
} else {
|
|
347
|
-
(0, import_registerFunction2.default)(fn, meta);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
_registerFunction(queryWordpress, queryWordpressMeta);
|
|
351
|
-
}
|
|
352
291
|
function registerAll(loader) {
|
|
353
292
|
const _registerComponent = (Component, defaultMeta) => {
|
|
354
293
|
if (loader) {
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/index.tsx", "../src/
|
|
4
|
-
"sourcesContent": ["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerFunction, {\n CustomFunctionMeta,\n} from \"@plasmicapp/host/registerFunction\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport { queryWordpress, queryWordpressMeta } from \"./query-wordpress\";\nimport {\n WordpressFetcher,\n WordpressFetcherMeta,\n WordpressField,\n WordpressFieldMeta,\n WordpressProvider,\n WordpressProviderMeta,\n} from \"./wordpress\";\n\nexport function registerWordpress(loader?: { registerFunction: any }) {\n function _registerFunction<T extends (...args: any[]) => any>(\n fn: T,\n meta: CustomFunctionMeta<T>\n ) {\n if (loader) {\n loader.registerFunction(fn, meta);\n } else {\n registerFunction(fn, meta);\n }\n }\n\n _registerFunction(queryWordpress, queryWordpressMeta);\n}\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n const _registerComponent = <T extends React.ComponentType<any>>(\n Component: T,\n defaultMeta: ComponentMeta<React.ComponentProps<T>>\n ) => {\n if (loader) {\n loader.registerComponent(Component, defaultMeta);\n } else {\n registerComponent(Component, defaultMeta);\n }\n };\n\n if (loader) {\n loader.registerGlobalContext(WordpressProvider, WordpressProviderMeta);\n } else {\n registerGlobalContext(WordpressProvider, WordpressProviderMeta);\n }\n\n _registerComponent(WordpressFetcher, WordpressFetcherMeta);\n _registerComponent(WordpressField, WordpressFieldMeta);\n}\n\nexport * from \"./wordpress\";\n", "import registerFunction, {\n CustomFunctionMeta,\n} from \"@plasmicapp/host/registerFunction\";\n\nimport { QueryOperator, queryOperators } from \"./utils\";\n\nexport async function queryWordpress(\n wordpressUrl: string,\n type: \"pages\" | \"posts\",\n queryOperator?: QueryOperator,\n filterValue?: string,\n limit?: number\n): Promise<any> {\n const urlParams = new URLSearchParams();\n if (queryOperator && filterValue) {\n urlParams.append(queryOperator, filterValue);\n }\n if (limit) {\n urlParams.append(\"per_page\", limit.toString());\n }\n const url = new URL(`wp-json/wp/v2/${type}`, wordpressUrl);\n url.search = urlParams.toString();\n\n const resp = await fetch(url);\n return await resp.json();\n}\n\nexport const queryWordpressMeta: CustomFunctionMeta<typeof queryWordpress> = {\n name: \"queryWordpress\",\n displayName: \"Query WordPress\",\n importPath: \"@plasmicpkgs/plasmic-wordpress\",\n params: [\n {\n name: \"wordpressUrl\",\n type: \"string\",\n },\n {\n name: \"queryType\",\n type: \"choice\",\n options: [\"pages\", \"posts\"],\n },\n {\n name: \"queryOperator\",\n type: \"choice\",\n options: Object.values(queryOperators).map((item) => ({\n label: item.label,\n value: item.value,\n })),\n },\n {\n name: \"filterValue\",\n type: \"string\",\n },\n {\n name: \"limit\",\n type: \"number\",\n },\n ],\n};\n\nexport function registerAllCustomFunctions(loader?: { registerFunction: any }) {\n function _registerFunction<T extends (...args: any[]) => any>(\n fn: T,\n meta: CustomFunctionMeta<T>\n ) {\n if (loader) {\n loader.registerFunction(fn, meta);\n } else {\n registerFunction(fn, meta);\n }\n }\n\n _registerFunction(queryWordpress, queryWordpressMeta);\n}\n", "export const queryOperators = [\n {\n value: \"search\",\n label: \"Search\",\n },\n {\n value: \"slug\",\n label: \"Filter by Slug\",\n },\n {\n value: \"author\",\n label: \"Filter by author\",\n },\n] as const;\n\nexport type QueryOperator = (typeof queryOperators)[number][\"value\"];\n\nexport function ensure<T>(x: T | null | undefined, message?: string): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(message ?? `Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n", "import {\n ComponentMeta,\n DataProvider,\n GlobalContextMeta,\n repeatedElement,\n useSelector,\n} from \"@plasmicapp/host\";\nimport { usePlasmicQueryData } from \"@plasmicapp/query\";\nimport get from \"dlv\";\nimport React, { ReactNode, useContext } from \"react\";\nimport { queryWordpress } from \"./query-wordpress\";\nimport { ensure, queryOperators, type QueryOperator } from \"./utils\";\n\nconst modulePath = \"@plasmicpkgs/plasmic-wordpress\";\n\ninterface WordpressProviderProps {\n wordpressUrl?: string;\n}\n\nconst CredentialsContext = React.createContext<\n WordpressProviderProps | undefined\n>(undefined);\n\nexport const WordpressProviderMeta: GlobalContextMeta<WordpressProviderProps> =\n {\n name: \"WordpressProvider\",\n displayName: \"Wordpress Provider\",\n description: \"The endpoint of your Wordpress\",\n importName: \"WordpressProvider\",\n importPath: modulePath,\n props: {\n wordpressUrl: {\n type: \"string\",\n displayName: \"Wordpress URL\",\n description: \"URL of your Wordpress \",\n defaultValue: \"https://techcrunch.com/\",\n },\n },\n };\n\nexport function WordpressProvider({\n wordpressUrl,\n children,\n}: React.PropsWithChildren<WordpressProviderProps>) {\n return (\n <CredentialsContext.Provider value={{ wordpressUrl }}>\n {children}\n </CredentialsContext.Provider>\n );\n}\n\ninterface WordpressFetcherProps {\n children?: ReactNode;\n className?: string;\n noLayout?: boolean;\n queryType?: \"posts\" | \"pages\";\n noAutoRepeat?: boolean;\n limit?: number;\n queryOperator?: QueryOperator;\n filterValue?: string;\n setControlContextData?: (data: {\n posts?: { value: string; label: string }[];\n pages?: { value: string; label: string }[];\n }) => void;\n}\n\nexport const WordpressFetcherMeta: ComponentMeta<WordpressFetcherProps> = {\n name: \"WordpressFetcher\",\n displayName: \"Wordpress Fetcher\",\n importName: \"WordpressFetcher\",\n importPath: modulePath,\n providesData: true,\n description:\n \"Fetches Wordpress data and repeats content of children once for every row fetched. \",\n defaultStyles: {\n display: \"grid\",\n gridTemplateColumns: \"1fr\",\n gridRowGap: \"8px\",\n padding: \"8px\",\n maxWidth: \"100%\",\n },\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"vbox\",\n styles: {\n padding: \"8px\",\n },\n children: {\n type: \"component\",\n name: \"WordpressField\",\n },\n },\n },\n queryType: {\n type: \"choice\",\n options: [\"posts\", \"pages\"],\n },\n queryOperator: {\n type: \"choice\",\n displayName: \"Query Operator\",\n description: \"Filter Parameter filter by\",\n options: () => {\n return queryOperators.map((item: any) => ({\n label: item?.label,\n value: item?.value,\n }));\n },\n hidden: (props) => !props.queryType,\n },\n\n filterValue: {\n type: \"string\",\n displayName: \"Filter value\",\n description: \"Value to filter\",\n hidden: (props) => !props.queryOperator,\n },\n limit: {\n type: \"number\",\n displayName: \"Limit\",\n description: \"Limit\",\n },\n noAutoRepeat: {\n type: \"boolean\",\n displayName: \"No auto-repeat\",\n description:\n \"Do not automatically repeat children for every posts or pages.\",\n defaultValue: false,\n },\n noLayout: {\n type: \"boolean\",\n displayName: \"No layout\",\n description:\n \"When set, Wordpress Fetcher will not layout its children; instead, the layout set on its parent element will be used. Useful if you want to set flex gap or control container tag type.\",\n defaultValue: false,\n },\n },\n};\n\nexport function WordpressFetcher({\n queryOperator,\n filterValue,\n noAutoRepeat,\n limit,\n queryType,\n children,\n className,\n noLayout,\n}: WordpressFetcherProps) {\n const { wordpressUrl } = ensure(\n useContext(CredentialsContext),\n \"WordpressFetcher must be used within a WordpressProvider\"\n );\n const cacheKey = JSON.stringify({\n queryOperator,\n filterValue,\n limit,\n queryType,\n wordpressUrl,\n });\n\n const { data } = usePlasmicQueryData<any | null>(\n queryType && wordpressUrl ? cacheKey : null,\n async () => {\n return queryWordpress(\n ensure(wordpressUrl, \"Wordpress URL must be specified\"),\n ensure(queryType, \"Query Type must be specified\"),\n queryOperator,\n filterValue,\n limit\n );\n }\n );\n\n const hasFilter = queryOperator && filterValue;\n\n if (!queryType) {\n return <div>Please specify query type</div>;\n }\n\n if (queryOperator && !filterValue) {\n return <div>Please specify Filter Value</div>;\n }\n if (!queryOperator && filterValue) {\n return <div>Please specify Query Operator</div>;\n }\n if (hasFilter && data?.length === 0) {\n return <div>No published {queryType} found</div>;\n }\n\n const currentName = `currentWordpress${\n queryType === \"posts\" ? \"Post\" : \"Page\"\n }`;\n const renderedData = noAutoRepeat\n ? children\n : data?.map((item: any, i: number) => (\n <DataProvider key={item.id} name={currentName} data={item}>\n {repeatedElement(i, children)}\n </DataProvider>\n ));\n\n const response = data;\n return (\n <DataProvider data={response} name=\"wordpressItems\">\n {noLayout ? (\n <> {renderedData} </>\n ) : (\n <div className={className}> {renderedData} </div>\n )}\n </DataProvider>\n );\n}\n\ninterface WordpressFieldProps {\n className?: string;\n field?: string;\n setControlContextData?: (data: { data: any }) => void;\n}\nexport const WordpressFieldMeta: ComponentMeta<WordpressFieldProps> = {\n name: \"WordpressField\",\n displayName: \"Wordpress Field\",\n importName: \"WordpressField\",\n importPath: modulePath,\n props: {\n field: {\n type: \"choice\",\n options: [\n \"title\",\n \"slug\",\n \"content\",\n \"excerpt\",\n \"date\",\n \"modified\",\n \"link\",\n \"status\",\n ],\n displayName: \"Field\",\n description: \"Field to be displayed.\",\n },\n },\n};\nexport function WordpressField({ className, field }: WordpressFieldProps) {\n const currentPost = useSelector(\"currentWordpressPost\");\n const currentPage = useSelector(\"currentWordpressPage\");\n\n const item = currentPost || currentPage;\n\n if (!item) {\n return <div>WordpressField must be used within a WordpressFetcher </div>;\n }\n\n if (!field) {\n return <div>Please specify a valid path or select a field.</div>;\n }\n\n const data = get(item, field as string);\n\n if (typeof data === \"object\" && \"rendered\" in data) {\n return (\n <div\n className={className}\n style={{ whiteSpace: \"normal\" }}\n dangerouslySetInnerHTML={{ __html: data.rendered }}\n />\n );\n } else if (!data || typeof data === \"object\") {\n return <div className={className}>Please specify a valid field.</div>;\n } else {\n return <div className={className}> {data} </div>;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../src/index.tsx", "../src/wordpress.tsx", "../src/utils.ts"],
|
|
4
|
+
"sourcesContent": ["import registerComponent, {\n CodeComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport registerGlobalContext from \"@plasmicapp/host/registerGlobalContext\";\nimport {\n WordpressFetcher,\n WordpressFetcherMeta,\n WordpressField,\n WordpressFieldMeta,\n WordpressProvider,\n WordpressProviderMeta,\n} from \"./wordpress\";\n\nexport function registerAll(loader?: {\n registerComponent: typeof registerComponent;\n registerGlobalContext: typeof registerGlobalContext;\n}) {\n const _registerComponent = <T extends React.ComponentType<any>>(\n Component: T,\n defaultMeta: CodeComponentMeta<React.ComponentProps<T>>\n ) => {\n if (loader) {\n loader.registerComponent(Component, defaultMeta);\n } else {\n registerComponent(Component, defaultMeta);\n }\n };\n\n if (loader) {\n loader.registerGlobalContext(WordpressProvider, WordpressProviderMeta);\n } else {\n registerGlobalContext(WordpressProvider, WordpressProviderMeta);\n }\n\n _registerComponent(WordpressFetcher, WordpressFetcherMeta);\n _registerComponent(WordpressField, WordpressFieldMeta);\n}\n\nexport * from \"./wordpress\";\n", "import {\n ComponentMeta,\n DataProvider,\n GlobalContextMeta,\n repeatedElement,\n useSelector,\n} from \"@plasmicapp/host\";\nimport { usePlasmicQueryData } from \"@plasmicapp/query\";\nimport { queryWordpress } from \"@plasmicpkgs/wordpress\";\nimport get from \"dlv\";\nimport React, { ReactNode, useContext } from \"react\";\nimport { ensure, queryOperators, type QueryOperator } from \"./utils\";\n\nconst modulePath = \"@plasmicpkgs/plasmic-wordpress\";\n\ninterface WordpressProviderProps {\n wordpressUrl?: string;\n}\n\nconst CredentialsContext = React.createContext<\n WordpressProviderProps | undefined\n>(undefined);\n\nexport const WordpressProviderMeta: GlobalContextMeta<WordpressProviderProps> =\n {\n name: \"WordpressProvider\",\n displayName: \"Wordpress Provider\",\n description: \"The endpoint of your Wordpress\",\n importName: \"WordpressProvider\",\n importPath: modulePath,\n props: {\n wordpressUrl: {\n type: \"string\",\n displayName: \"Wordpress URL\",\n description: \"URL of your Wordpress \",\n defaultValue: \"https://techcrunch.com/\",\n },\n },\n };\n\nexport function WordpressProvider({\n wordpressUrl,\n children,\n}: React.PropsWithChildren<WordpressProviderProps>) {\n return (\n <CredentialsContext.Provider value={{ wordpressUrl }}>\n {children}\n </CredentialsContext.Provider>\n );\n}\n\ninterface WordpressFetcherProps {\n children?: ReactNode;\n className?: string;\n noLayout?: boolean;\n queryType?: \"posts\" | \"pages\";\n noAutoRepeat?: boolean;\n limit?: number;\n queryOperator?: QueryOperator;\n filterValue?: string;\n setControlContextData?: (data: {\n posts?: { value: string; label: string }[];\n pages?: { value: string; label: string }[];\n }) => void;\n}\n\nexport const WordpressFetcherMeta: ComponentMeta<WordpressFetcherProps> = {\n name: \"WordpressFetcher\",\n displayName: \"Wordpress Fetcher\",\n importName: \"WordpressFetcher\",\n importPath: modulePath,\n providesData: true,\n description:\n \"Fetches Wordpress data and repeats content of children once for every row fetched. \",\n defaultStyles: {\n display: \"grid\",\n gridTemplateColumns: \"1fr\",\n gridRowGap: \"8px\",\n padding: \"8px\",\n maxWidth: \"100%\",\n },\n props: {\n children: {\n type: \"slot\",\n defaultValue: {\n type: \"vbox\",\n styles: {\n padding: \"8px\",\n },\n children: {\n type: \"component\",\n name: \"WordpressField\",\n },\n },\n },\n queryType: {\n type: \"choice\",\n options: [\"posts\", \"pages\"],\n },\n queryOperator: {\n type: \"choice\",\n displayName: \"Query Operator\",\n description: \"Filter Parameter filter by\",\n options: () => {\n return queryOperators.map((item: any) => ({\n label: item?.label,\n value: item?.value,\n }));\n },\n hidden: (props) => !props.queryType,\n },\n\n filterValue: {\n type: \"string\",\n displayName: \"Filter value\",\n description: \"Value to filter\",\n hidden: (props) => !props.queryOperator,\n },\n limit: {\n type: \"number\",\n displayName: \"Limit\",\n description: \"Limit\",\n },\n noAutoRepeat: {\n type: \"boolean\",\n displayName: \"No auto-repeat\",\n description:\n \"Do not automatically repeat children for every posts or pages.\",\n defaultValue: false,\n },\n noLayout: {\n type: \"boolean\",\n displayName: \"No layout\",\n description:\n \"When set, Wordpress Fetcher will not layout its children; instead, the layout set on its parent element will be used. Useful if you want to set flex gap or control container tag type.\",\n defaultValue: false,\n },\n },\n};\n\nexport function WordpressFetcher({\n queryOperator,\n filterValue,\n noAutoRepeat,\n limit,\n queryType,\n children,\n className,\n noLayout,\n}: WordpressFetcherProps) {\n const { wordpressUrl } = ensure(\n useContext(CredentialsContext),\n \"WordpressFetcher must be used within a WordpressProvider\"\n );\n const cacheKey = JSON.stringify({\n queryOperator,\n filterValue,\n limit,\n queryType,\n wordpressUrl,\n });\n\n const { data } = usePlasmicQueryData<any | null>(\n queryType && wordpressUrl ? cacheKey : null,\n async () => {\n return queryWordpress(\n ensure(wordpressUrl, \"Wordpress URL must be specified\"),\n ensure(queryType, \"Query Type must be specified\"),\n queryOperator,\n filterValue,\n limit\n );\n }\n );\n\n const hasFilter = queryOperator && filterValue;\n\n if (!queryType) {\n return <div>Please specify query type</div>;\n }\n\n if (queryOperator && !filterValue) {\n return <div>Please specify Filter Value</div>;\n }\n if (!queryOperator && filterValue) {\n return <div>Please specify Query Operator</div>;\n }\n if (hasFilter && data?.length === 0) {\n return <div>No published {queryType} found</div>;\n }\n\n const currentName = `currentWordpress${\n queryType === \"posts\" ? \"Post\" : \"Page\"\n }`;\n const renderedData = noAutoRepeat\n ? children\n : data?.map((item: any, i: number) => (\n <DataProvider key={item.id} name={currentName} data={item}>\n {repeatedElement(i, children)}\n </DataProvider>\n ));\n\n const response = data;\n return (\n <DataProvider data={response} name=\"wordpressItems\">\n {noLayout ? (\n <> {renderedData} </>\n ) : (\n <div className={className}> {renderedData} </div>\n )}\n </DataProvider>\n );\n}\n\ninterface WordpressFieldProps {\n className?: string;\n field?: string;\n setControlContextData?: (data: { data: any }) => void;\n}\nexport const WordpressFieldMeta: ComponentMeta<WordpressFieldProps> = {\n name: \"WordpressField\",\n displayName: \"Wordpress Field\",\n importName: \"WordpressField\",\n importPath: modulePath,\n props: {\n field: {\n type: \"choice\",\n options: [\n \"title\",\n \"slug\",\n \"content\",\n \"excerpt\",\n \"date\",\n \"modified\",\n \"link\",\n \"status\",\n ],\n displayName: \"Field\",\n description: \"Field to be displayed.\",\n },\n },\n};\nexport function WordpressField({ className, field }: WordpressFieldProps) {\n const currentPost = useSelector(\"currentWordpressPost\");\n const currentPage = useSelector(\"currentWordpressPage\");\n\n const item = currentPost || currentPage;\n\n if (!item) {\n return <div>WordpressField must be used within a WordpressFetcher </div>;\n }\n\n if (!field) {\n return <div>Please specify a valid path or select a field.</div>;\n }\n\n const data = get(item, field as string);\n\n if (typeof data === \"object\" && \"rendered\" in data) {\n return (\n <div\n className={className}\n style={{ whiteSpace: \"normal\" }}\n dangerouslySetInnerHTML={{ __html: data.rendered }}\n />\n );\n } else if (!data || typeof data === \"object\") {\n return <div className={className}>Please specify a valid field.</div>;\n } else {\n return <div className={className}> {data} </div>;\n }\n}\n", "export const queryOperators = [\n {\n value: \"search\",\n label: \"Search\",\n },\n {\n value: \"slug\",\n label: \"Filter by Slug\",\n },\n {\n value: \"author\",\n label: \"Filter by author\",\n },\n] as const;\n\nexport type QueryOperator = (typeof queryOperators)[number][\"value\"];\n\nexport function ensure<T>(x: T | null | undefined, message?: string): T {\n if (x === null || x === undefined) {\n debugger;\n throw new Error(message ?? `Value must not be undefined or null`);\n } else {\n return x;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAEO;AACP,mCAAkC;;;ACHlC,kBAMO;AACP,mBAAoC;AACpC,uBAA+B;AAC/B,iBAAgB;AAChB,mBAA6C;;;ACVtC,IAAM,iBAAiB;AAAA,EAC5B;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AACF;AAIO,SAAS,OAAU,GAAyB,SAAqB;AACtE,MAAI,MAAM,QAAQ,MAAM,QAAW;AACjC;AACA,UAAM,IAAI,MAAM,4BAAW,qCAAqC;AAAA,EAClE,OAAO;AACL,WAAO;AAAA,EACT;AACF;;;ADXA,IAAM,aAAa;AAMnB,IAAM,qBAAqB,aAAAA,QAAM,cAE/B,MAAS;AAEJ,IAAM,wBACX;AAAA,EACE,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,aA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AAC,SAAI,aAAsB,+BAA6B;AAAA,EACjE,OAAO;AACL,WAAO,6BAAAA,QAAA,cAAC,SAAI,aAAsB,KAAE,MAAK,GAAC;AAAA,EAC5C;AACF;;;ADlQO,SAAS,YAAY,QAGzB;AACD,QAAM,qBAAqB,CACzB,WACA,gBACG;AACH,QAAI,QAAQ;AACV,aAAO,kBAAkB,WAAW,WAAW;AAAA,IACjD,OAAO;AACL,mCAAAE,SAAkB,WAAW,WAAW;AAAA,IAC1C;AAAA,EACF;AAEA,MAAI,QAAQ;AACV,WAAO,sBAAsB,mBAAmB,qBAAqB;AAAA,EACvE,OAAO;AACL,qCAAAC,SAAsB,mBAAmB,qBAAqB;AAAA,EAChE;AAEA,qBAAmB,kBAAkB,oBAAoB;AACzD,qBAAmB,gBAAgB,kBAAkB;AACvD;",
|
|
6
|
+
"names": ["React", "get", "registerComponent", "registerGlobalContext"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/plasmic-wordpress",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.152",
|
|
4
4
|
"description": "Plasmic Wordpress components.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -44,8 +44,9 @@
|
|
|
44
44
|
}
|
|
45
45
|
],
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@plasmicapp/host": "1.0.
|
|
48
|
-
"@plasmicapp/query": "0.1.
|
|
47
|
+
"@plasmicapp/host": "1.0.227",
|
|
48
|
+
"@plasmicapp/query": "0.1.81",
|
|
49
|
+
"@plasmicpkgs/wordpress": "0.0.3",
|
|
49
50
|
"@types/react": "^18.0.27",
|
|
50
51
|
"@types/react-dom": "^18.0.10",
|
|
51
52
|
"husky": "^7.0.4",
|
|
@@ -56,5 +57,5 @@
|
|
|
56
57
|
"@types/dlv": "^1.1.2",
|
|
57
58
|
"dlv": "^1.1.3"
|
|
58
59
|
},
|
|
59
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "6b7adfd7b48f564d94e18eed3f1904c62dcd1e2d"
|
|
60
61
|
}
|