@01.software/sdk 0.2.7 → 0.2.9-dev.260305.35fd2d4
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/README.md +37 -8
- package/dist/{auth-ZBsN9vPn.d.cts → auth-CDyJoENT.d.cts} +1 -1
- package/dist/{auth-D-_Ju7m5.d.ts → auth-Gb34eOkR.d.ts} +1 -1
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -2
- package/dist/auth.d.ts +2 -2
- package/dist/auth.js.map +1 -1
- package/dist/components.cjs +225 -42
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +98 -16
- package/dist/components.d.ts +98 -16
- package/dist/components.js +218 -34
- package/dist/components.js.map +1 -1
- package/dist/flow.cjs +148 -0
- package/dist/flow.cjs.map +1 -0
- package/dist/flow.d.cts +116 -0
- package/dist/flow.d.ts +116 -0
- package/dist/flow.js +123 -0
- package/dist/flow.js.map +1 -0
- package/dist/index.cjs +70 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -21
- package/dist/index.d.ts +48 -21
- package/dist/index.js +70 -15
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-CRSz8jfP.d.cts → payload-types-BFAXKjly.d.cts} +242 -79
- package/dist/{payload-types-CRSz8jfP.d.ts → payload-types-BFAXKjly.d.ts} +242 -79
- package/dist/{webhook-Dn5o0LXq.d.cts → webhook-CmbS5Uu3.d.cts} +2 -2
- package/dist/{webhook-C_DHB0Sw.d.ts → webhook-Ct6PD0Ys.d.ts} +2 -2
- package/dist/webhook.d.cts +2 -2
- package/dist/webhook.d.ts +2 -2
- package/package.json +29 -3
package/dist/components.js
CHANGED
|
@@ -17,6 +17,18 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
20
32
|
var __async = (__this, __arguments, generator) => {
|
|
21
33
|
return new Promise((resolve, reject) => {
|
|
22
34
|
var fulfilled = (value) => {
|
|
@@ -39,34 +51,205 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
51
|
};
|
|
40
52
|
|
|
41
53
|
// src/components/RichTextContent/index.tsx
|
|
42
|
-
import
|
|
54
|
+
import React2 from "react";
|
|
43
55
|
import {
|
|
44
56
|
defaultJSXConverters,
|
|
45
57
|
LinkJSXConverter,
|
|
46
|
-
RichText
|
|
58
|
+
RichText,
|
|
59
|
+
TextJSXConverter
|
|
47
60
|
} from "@payloadcms/richtext-lexical/react";
|
|
61
|
+
|
|
62
|
+
// src/components/RichTextContent/styled.tsx
|
|
63
|
+
import React from "react";
|
|
64
|
+
function createComponentConverters(components, internalDocToHref) {
|
|
65
|
+
const converters = {};
|
|
66
|
+
if (components.Heading) {
|
|
67
|
+
const Heading = components.Heading;
|
|
68
|
+
converters.heading = ({ node, nodesToJSX }) => /* @__PURE__ */ React.createElement(Heading, { tag: node.tag, node }, nodesToJSX({ nodes: node.children }));
|
|
69
|
+
}
|
|
70
|
+
if (components.Paragraph) {
|
|
71
|
+
const Paragraph = components.Paragraph;
|
|
72
|
+
converters.paragraph = ({ node, nodesToJSX }) => {
|
|
73
|
+
const children = nodesToJSX({ nodes: node.children });
|
|
74
|
+
return /* @__PURE__ */ React.createElement(Paragraph, { isEmpty: !(children == null ? void 0 : children.length), node }, (children == null ? void 0 : children.length) ? children : /* @__PURE__ */ React.createElement("br", null));
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (components.Blockquote) {
|
|
78
|
+
const Blockquote = components.Blockquote;
|
|
79
|
+
converters.quote = ({ node, nodesToJSX }) => /* @__PURE__ */ React.createElement(Blockquote, { node }, nodesToJSX({ nodes: node.children }));
|
|
80
|
+
}
|
|
81
|
+
if (components.List) {
|
|
82
|
+
const List = components.List;
|
|
83
|
+
converters.list = ({ node, nodesToJSX }) => /* @__PURE__ */ React.createElement(List, { tag: node.tag, listType: node.listType, node }, nodesToJSX({ nodes: node.children }));
|
|
84
|
+
}
|
|
85
|
+
if (components.ListItem) {
|
|
86
|
+
const ListItem = components.ListItem;
|
|
87
|
+
converters.listitem = ({ node, nodesToJSX }) => {
|
|
88
|
+
const hasSubLists = node.children.some(
|
|
89
|
+
(child) => child.type === "list"
|
|
90
|
+
);
|
|
91
|
+
return /* @__PURE__ */ React.createElement(
|
|
92
|
+
ListItem,
|
|
93
|
+
{
|
|
94
|
+
hasSubLists,
|
|
95
|
+
checked: node.checked,
|
|
96
|
+
value: node.value,
|
|
97
|
+
node
|
|
98
|
+
},
|
|
99
|
+
nodesToJSX({ nodes: node.children })
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (components.Link) {
|
|
104
|
+
const Link = components.Link;
|
|
105
|
+
const resolveHref = (node) => {
|
|
106
|
+
var _a;
|
|
107
|
+
if (node.fields.linkType === "internal") {
|
|
108
|
+
return internalDocToHref ? internalDocToHref({ linkNode: node }) : "#";
|
|
109
|
+
}
|
|
110
|
+
return (_a = node.fields.url) != null ? _a : "";
|
|
111
|
+
};
|
|
112
|
+
converters.link = ({ node, nodesToJSX }) => /* @__PURE__ */ React.createElement(
|
|
113
|
+
Link,
|
|
114
|
+
{
|
|
115
|
+
href: resolveHref(node),
|
|
116
|
+
rel: node.fields.newTab ? "noopener noreferrer" : void 0,
|
|
117
|
+
target: node.fields.newTab ? "_blank" : void 0,
|
|
118
|
+
node
|
|
119
|
+
},
|
|
120
|
+
nodesToJSX({ nodes: node.children })
|
|
121
|
+
);
|
|
122
|
+
converters.autolink = ({ node, nodesToJSX }) => {
|
|
123
|
+
var _a;
|
|
124
|
+
return /* @__PURE__ */ React.createElement(
|
|
125
|
+
Link,
|
|
126
|
+
{
|
|
127
|
+
href: (_a = node.fields.url) != null ? _a : "",
|
|
128
|
+
rel: node.fields.newTab ? "noopener noreferrer" : void 0,
|
|
129
|
+
target: node.fields.newTab ? "_blank" : void 0,
|
|
130
|
+
node
|
|
131
|
+
},
|
|
132
|
+
nodesToJSX({ nodes: node.children })
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (components.HorizontalRule) {
|
|
137
|
+
const HorizontalRule = components.HorizontalRule;
|
|
138
|
+
converters.horizontalrule = /* @__PURE__ */ React.createElement(HorizontalRule, null);
|
|
139
|
+
}
|
|
140
|
+
if (components.Upload) {
|
|
141
|
+
const Upload = components.Upload;
|
|
142
|
+
converters.upload = ({ node }) => {
|
|
143
|
+
var _a;
|
|
144
|
+
const uploadNode = node;
|
|
145
|
+
if (typeof uploadNode.value !== "object") return null;
|
|
146
|
+
const doc = uploadNode.value;
|
|
147
|
+
return /* @__PURE__ */ React.createElement(
|
|
148
|
+
Upload,
|
|
149
|
+
{
|
|
150
|
+
src: doc.url,
|
|
151
|
+
alt: ((_a = uploadNode.fields) == null ? void 0 : _a.alt) || (doc == null ? void 0 : doc.alt) || "",
|
|
152
|
+
width: doc.width,
|
|
153
|
+
height: doc.height,
|
|
154
|
+
mimeType: doc.mimeType,
|
|
155
|
+
filename: doc.filename,
|
|
156
|
+
sizes: doc.sizes,
|
|
157
|
+
node
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (components.Table) {
|
|
163
|
+
const Table = components.Table;
|
|
164
|
+
converters.table = ({ node, nodesToJSX }) => /* @__PURE__ */ React.createElement(Table, { node }, nodesToJSX({ nodes: node.children }));
|
|
165
|
+
}
|
|
166
|
+
if (components.TableRow) {
|
|
167
|
+
const TableRow = components.TableRow;
|
|
168
|
+
converters.tablerow = ({ node, nodesToJSX }) => /* @__PURE__ */ React.createElement(TableRow, { node }, nodesToJSX({ nodes: node.children }));
|
|
169
|
+
}
|
|
170
|
+
if (components.TableCell) {
|
|
171
|
+
const TableCell = components.TableCell;
|
|
172
|
+
converters.tablecell = ({ node, nodesToJSX }) => /* @__PURE__ */ React.createElement(
|
|
173
|
+
TableCell,
|
|
174
|
+
{
|
|
175
|
+
tag: node.headerState > 0 ? "th" : "td",
|
|
176
|
+
colSpan: node.colSpan > 1 ? node.colSpan : void 0,
|
|
177
|
+
rowSpan: node.rowSpan > 1 ? node.rowSpan : void 0,
|
|
178
|
+
backgroundColor: node.backgroundColor || void 0,
|
|
179
|
+
node
|
|
180
|
+
},
|
|
181
|
+
nodesToJSX({ nodes: node.children })
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
return converters;
|
|
185
|
+
}
|
|
186
|
+
function StyledRichTextContent(_a) {
|
|
187
|
+
var _b = _a, {
|
|
188
|
+
components = {},
|
|
189
|
+
internalDocToHref,
|
|
190
|
+
blocks,
|
|
191
|
+
textState
|
|
192
|
+
} = _b, props = __objRest(_b, [
|
|
193
|
+
"components",
|
|
194
|
+
"internalDocToHref",
|
|
195
|
+
"blocks",
|
|
196
|
+
"textState"
|
|
197
|
+
]);
|
|
198
|
+
const converters = createComponentConverters(components, internalDocToHref);
|
|
199
|
+
return /* @__PURE__ */ React.createElement(
|
|
200
|
+
RichTextContent,
|
|
201
|
+
__spreadProps(__spreadValues({}, props), {
|
|
202
|
+
internalDocToHref,
|
|
203
|
+
converters,
|
|
204
|
+
blocks,
|
|
205
|
+
textState
|
|
206
|
+
})
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// src/components/RichTextContent/index.tsx
|
|
211
|
+
function hyphenToCamel(str) {
|
|
212
|
+
return str.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
213
|
+
}
|
|
214
|
+
function createTextStateConverter(state) {
|
|
215
|
+
const defaultTextConverter = TextJSXConverter.text;
|
|
216
|
+
return (_a) => {
|
|
217
|
+
var _b = _a, { node } = _b, rest = __objRest(_b, ["node"]);
|
|
218
|
+
var _a2, _b2;
|
|
219
|
+
const base = defaultTextConverter(__spreadValues({ node }, rest));
|
|
220
|
+
const nodeState = node.$;
|
|
221
|
+
if (!nodeState || typeof nodeState !== "object") return base;
|
|
222
|
+
const style = {};
|
|
223
|
+
for (const stateKey in nodeState) {
|
|
224
|
+
const stateValue = nodeState[stateKey];
|
|
225
|
+
if (!stateValue) continue;
|
|
226
|
+
const css = (_b2 = (_a2 = state[stateKey]) == null ? void 0 : _a2[stateValue]) == null ? void 0 : _b2.css;
|
|
227
|
+
if (css) {
|
|
228
|
+
for (const prop in css) {
|
|
229
|
+
const val = css[prop];
|
|
230
|
+
if (val) style[hyphenToCamel(prop)] = val;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (Object.keys(style).length === 0) return base;
|
|
235
|
+
return /* @__PURE__ */ React2.createElement("span", { style }, base);
|
|
236
|
+
};
|
|
237
|
+
}
|
|
48
238
|
function RichTextContent({
|
|
49
239
|
data,
|
|
50
240
|
className,
|
|
51
241
|
internalDocToHref,
|
|
52
|
-
|
|
242
|
+
converters,
|
|
243
|
+
blocks,
|
|
244
|
+
disableDefaultConverters,
|
|
245
|
+
textState
|
|
53
246
|
}) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
data,
|
|
58
|
-
className,
|
|
59
|
-
converters: __spreadProps(__spreadValues(__spreadValues({}, defaultJSXConverters), LinkJSXConverter({
|
|
60
|
-
internalDocToHref
|
|
61
|
-
})), {
|
|
62
|
-
blocks: blocks ? blocks : void 0
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
);
|
|
247
|
+
const baseConverters = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, disableDefaultConverters ? {} : defaultJSXConverters), LinkJSXConverter({ internalDocToHref })), textState ? { text: createTextStateConverter(textState) } : {}), converters), blocks ? { blocks } : {});
|
|
248
|
+
return /* @__PURE__ */ React2.createElement(RichText, { data, className, converters: baseConverters });
|
|
66
249
|
}
|
|
67
250
|
|
|
68
251
|
// src/components/FormRenderer/index.tsx
|
|
69
|
-
import
|
|
252
|
+
import React3, { useState, useCallback, useEffect, useRef } from "react";
|
|
70
253
|
|
|
71
254
|
// src/components/FormRenderer/countries.ts
|
|
72
255
|
var COUNTRIES = [
|
|
@@ -437,14 +620,14 @@ function FormRenderer({
|
|
|
437
620
|
value: (_a2 = values[field.name]) != null ? _a2 : "",
|
|
438
621
|
onChange: (v) => handleChange(field.name, v)
|
|
439
622
|
};
|
|
440
|
-
const el = /* @__PURE__ */
|
|
623
|
+
const el = /* @__PURE__ */ React3.createElement(
|
|
441
624
|
"div",
|
|
442
625
|
{
|
|
443
626
|
key: (_b = field.id) != null ? _b : field.name,
|
|
444
627
|
className: fieldClassName,
|
|
445
628
|
style
|
|
446
629
|
},
|
|
447
|
-
field.label && /* @__PURE__ */
|
|
630
|
+
field.label && /* @__PURE__ */ React3.createElement("label", { htmlFor: field.name }, field.label),
|
|
448
631
|
input
|
|
449
632
|
);
|
|
450
633
|
return renderField ? renderField(field, context, el) : el;
|
|
@@ -454,7 +637,7 @@ function FormRenderer({
|
|
|
454
637
|
return wrapField(
|
|
455
638
|
field,
|
|
456
639
|
style,
|
|
457
|
-
/* @__PURE__ */
|
|
640
|
+
/* @__PURE__ */ React3.createElement(
|
|
458
641
|
"select",
|
|
459
642
|
{
|
|
460
643
|
id: field.name,
|
|
@@ -463,8 +646,8 @@ function FormRenderer({
|
|
|
463
646
|
required: (_b = field.required) != null ? _b : false,
|
|
464
647
|
onChange: (e) => handleChange(field.name, e.target.value)
|
|
465
648
|
},
|
|
466
|
-
/* @__PURE__ */
|
|
467
|
-
options.map((opt) => /* @__PURE__ */
|
|
649
|
+
/* @__PURE__ */ React3.createElement("option", { value: "" }, placeholder || "Select\u2026"),
|
|
650
|
+
options.map((opt) => /* @__PURE__ */ React3.createElement("option", { key: opt.value, value: opt.value }, opt.label))
|
|
468
651
|
)
|
|
469
652
|
);
|
|
470
653
|
};
|
|
@@ -476,7 +659,7 @@ function FormRenderer({
|
|
|
476
659
|
return wrapField(
|
|
477
660
|
field,
|
|
478
661
|
style,
|
|
479
|
-
/* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ React3.createElement(
|
|
480
663
|
"input",
|
|
481
664
|
{
|
|
482
665
|
type: "text",
|
|
@@ -493,7 +676,7 @@ function FormRenderer({
|
|
|
493
676
|
return wrapField(
|
|
494
677
|
field,
|
|
495
678
|
style,
|
|
496
|
-
/* @__PURE__ */
|
|
679
|
+
/* @__PURE__ */ React3.createElement(
|
|
497
680
|
"input",
|
|
498
681
|
{
|
|
499
682
|
type: "email",
|
|
@@ -509,7 +692,7 @@ function FormRenderer({
|
|
|
509
692
|
return wrapField(
|
|
510
693
|
field,
|
|
511
694
|
style,
|
|
512
|
-
/* @__PURE__ */
|
|
695
|
+
/* @__PURE__ */ React3.createElement(
|
|
513
696
|
"input",
|
|
514
697
|
{
|
|
515
698
|
type: "number",
|
|
@@ -530,7 +713,7 @@ function FormRenderer({
|
|
|
530
713
|
return wrapField(
|
|
531
714
|
field,
|
|
532
715
|
style,
|
|
533
|
-
/* @__PURE__ */
|
|
716
|
+
/* @__PURE__ */ React3.createElement(
|
|
534
717
|
"textarea",
|
|
535
718
|
{
|
|
536
719
|
id: field.name,
|
|
@@ -546,14 +729,14 @@ function FormRenderer({
|
|
|
546
729
|
value: (_j = values[field.name]) != null ? _j : false,
|
|
547
730
|
onChange: (v) => handleChange(field.name, v)
|
|
548
731
|
};
|
|
549
|
-
const el = /* @__PURE__ */
|
|
732
|
+
const el = /* @__PURE__ */ React3.createElement(
|
|
550
733
|
"div",
|
|
551
734
|
{
|
|
552
735
|
key: (_k = field.id) != null ? _k : field.name,
|
|
553
736
|
className: fieldClassName,
|
|
554
737
|
style
|
|
555
738
|
},
|
|
556
|
-
/* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ React3.createElement("label", { htmlFor: field.name }, /* @__PURE__ */ React3.createElement(
|
|
557
740
|
"input",
|
|
558
741
|
{
|
|
559
742
|
type: "checkbox",
|
|
@@ -563,7 +746,7 @@ function FormRenderer({
|
|
|
563
746
|
required: (_l = field.required) != null ? _l : false,
|
|
564
747
|
onChange: (e) => handleChange(field.name, e.target.checked)
|
|
565
748
|
}
|
|
566
|
-
), field.label && /* @__PURE__ */
|
|
749
|
+
), field.label && /* @__PURE__ */ React3.createElement("span", null, field.label))
|
|
567
750
|
);
|
|
568
751
|
return renderField ? renderField(field, context, el) : el;
|
|
569
752
|
}
|
|
@@ -580,7 +763,7 @@ function FormRenderer({
|
|
|
580
763
|
return renderSelectField(field, style, US_STATES);
|
|
581
764
|
case "message":
|
|
582
765
|
if (renderMessage && field.message) {
|
|
583
|
-
return /* @__PURE__ */
|
|
766
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, { key: (_p = (_o = field.id) != null ? _o : field.blockName) != null ? _p : "message" }, renderMessage(field.message));
|
|
584
767
|
}
|
|
585
768
|
return null;
|
|
586
769
|
default:
|
|
@@ -588,7 +771,7 @@ function FormRenderer({
|
|
|
588
771
|
}
|
|
589
772
|
};
|
|
590
773
|
const buttonLabel = form.submitButtonLabel || "Submit";
|
|
591
|
-
return /* @__PURE__ */
|
|
774
|
+
return /* @__PURE__ */ React3.createElement("form", { onSubmit: handleSubmit, className }, (_a = form.fields) == null ? void 0 : _a.map((field) => renderFieldElement(field)), renderButton ? renderButton({ isSubmitting, label: buttonLabel }) : /* @__PURE__ */ React3.createElement(
|
|
592
775
|
"button",
|
|
593
776
|
{
|
|
594
777
|
type: "submit",
|
|
@@ -600,7 +783,7 @@ function FormRenderer({
|
|
|
600
783
|
}
|
|
601
784
|
|
|
602
785
|
// src/components/Image/index.tsx
|
|
603
|
-
import
|
|
786
|
+
import React4, { useCallback as useCallback2, useRef as useRef2, useState as useState2 } from "react";
|
|
604
787
|
|
|
605
788
|
// src/utils/image.ts
|
|
606
789
|
var IMAGE_SIZES = [384, 768, 1536];
|
|
@@ -715,7 +898,7 @@ function Image({
|
|
|
715
898
|
opacity: loaded ? 1 : 0,
|
|
716
899
|
transition: "opacity 0.3s ease"
|
|
717
900
|
}), imgStyle);
|
|
718
|
-
return /* @__PURE__ */
|
|
901
|
+
return /* @__PURE__ */ React4.createElement("div", { className, style: containerStyle }, hasLqip && /* @__PURE__ */ React4.createElement(
|
|
719
902
|
"img",
|
|
720
903
|
{
|
|
721
904
|
"aria-hidden": true,
|
|
@@ -728,7 +911,7 @@ function Image({
|
|
|
728
911
|
transform: "scale(1.1)"
|
|
729
912
|
})
|
|
730
913
|
}
|
|
731
|
-
), placeholderColor && /* @__PURE__ */
|
|
914
|
+
), placeholderColor && /* @__PURE__ */ React4.createElement(
|
|
732
915
|
"div",
|
|
733
916
|
{
|
|
734
917
|
"aria-hidden": true,
|
|
@@ -736,7 +919,7 @@ function Image({
|
|
|
736
919
|
backgroundColor: placeholderColor
|
|
737
920
|
})
|
|
738
921
|
}
|
|
739
|
-
), /* @__PURE__ */
|
|
922
|
+
), /* @__PURE__ */ React4.createElement(
|
|
740
923
|
"img",
|
|
741
924
|
{
|
|
742
925
|
ref: imgRef,
|
|
@@ -758,6 +941,7 @@ export {
|
|
|
758
941
|
FormRenderer,
|
|
759
942
|
Image,
|
|
760
943
|
RichTextContent,
|
|
944
|
+
StyledRichTextContent,
|
|
761
945
|
toSubmissionData
|
|
762
946
|
};
|
|
763
947
|
//# sourceMappingURL=components.js.map
|