@devvit/public-api 0.10.19-next-2024-04-10-2178a091f.0 → 0.10.19-next-2024-04-10-49abb33fb.0
Sign up to get free protection for your applications and to get access to all the features.
- package/apis/ui/helpers/getFormValues.d.ts.map +1 -1
- package/apis/ui/helpers/getFormValues.js +3 -0
- package/apis/ui/helpers/transformForm.d.ts.map +1 -1
- package/apis/ui/helpers/transformForm.js +12 -0
- package/meta.json +10 -10
- package/meta.min.json +7 -7
- package/package.json +6 -6
- package/public-api.d.ts +10 -1
- package/public-api.iife.js +27 -1
- package/public-api.min.js +4 -4
- package/public-api.min.js.map +3 -3
- package/types/form.d.ts +9 -1
- package/types/form.d.ts.map +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getFormValues.d.ts","sourceRoot":"","sources":["../../../../src/apis/ui/helpers/getFormValues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,cAAc,GACpB,SAAS,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,
|
1
|
+
{"version":3,"file":"getFormValues.d.ts","sourceRoot":"","sources":["../../../../src/apis/ui/helpers/getFormValues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,cAAc,GACpB,SAAS,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,CAkBlD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAA;CAAE,GAAG,IAAI,CAK9E"}
|
@@ -3,6 +3,9 @@ export function flattenFormFieldValue(value) {
|
|
3
3
|
switch (value.fieldType) {
|
4
4
|
case FormFieldType.STRING:
|
5
5
|
return value.stringValue;
|
6
|
+
case FormFieldType.IMAGE:
|
7
|
+
// the string value is the URL
|
8
|
+
return value.stringValue;
|
6
9
|
case FormFieldType.PARAGRAPH:
|
7
10
|
return value.stringValue;
|
8
11
|
case FormFieldType.NUMBER:
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transformForm.d.ts","sourceRoot":"","sources":["../../../../src/apis/ui/helpers/transformForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,cAAc,EAAiB,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAEV,SAAS,
|
1
|
+
{"version":3,"file":"transformForm.d.ts","sourceRoot":"","sources":["../../../../src/apis/ui/helpers/transformForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,cAAc,EAAiB,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAEV,SAAS,EAOV,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAqBzE"}
|
@@ -4,6 +4,8 @@ export function transformFormFields(fields) {
|
|
4
4
|
switch (field.type) {
|
5
5
|
case 'string':
|
6
6
|
return transformStringField(field);
|
7
|
+
case 'image':
|
8
|
+
return transformImageField(field);
|
7
9
|
case 'paragraph':
|
8
10
|
return transformParagraphField(field);
|
9
11
|
case 'number':
|
@@ -39,6 +41,16 @@ function transformStringField(field) {
|
|
39
41
|
isSecret: field.isSecret,
|
40
42
|
});
|
41
43
|
}
|
44
|
+
function transformImageField(field) {
|
45
|
+
return FormFieldProto.fromPartial({
|
46
|
+
disabled: field.disabled,
|
47
|
+
fieldId: field.name,
|
48
|
+
fieldType: FormFieldType.IMAGE,
|
49
|
+
helpText: field.helpText,
|
50
|
+
label: field.label,
|
51
|
+
required: field.required,
|
52
|
+
});
|
53
|
+
}
|
42
54
|
function transformParagraphField(field) {
|
43
55
|
return FormFieldProto.fromPartial({
|
44
56
|
defaultValue: {
|
package/meta.json
CHANGED
@@ -7672,7 +7672,7 @@
|
|
7672
7672
|
"format": "esm"
|
7673
7673
|
},
|
7674
7674
|
"../protos/dist/types/devvit/ui/form_builder/v1alpha/type.js": {
|
7675
|
-
"bytes":
|
7675
|
+
"bytes": 2604,
|
7676
7676
|
"imports": [],
|
7677
7677
|
"format": "esm"
|
7678
7678
|
},
|
@@ -8123,7 +8123,7 @@
|
|
8123
8123
|
"format": "esm"
|
8124
8124
|
},
|
8125
8125
|
"../protos/dist/types/devvit/dev_portal/app_version/info/app_version_info.js": {
|
8126
|
-
"bytes":
|
8126
|
+
"bytes": 17755,
|
8127
8127
|
"imports": [
|
8128
8128
|
{
|
8129
8129
|
"path": "../../node_modules/protobufjs/minimal.js",
|
@@ -12506,7 +12506,7 @@
|
|
12506
12506
|
"format": "esm"
|
12507
12507
|
},
|
12508
12508
|
"src/types/form.ts": {
|
12509
|
-
"bytes":
|
12509
|
+
"bytes": 4907,
|
12510
12510
|
"imports": [],
|
12511
12511
|
"format": "esm"
|
12512
12512
|
},
|
@@ -12683,7 +12683,7 @@
|
|
12683
12683
|
"format": "esm"
|
12684
12684
|
},
|
12685
12685
|
"src/apis/ui/helpers/transformForm.ts": {
|
12686
|
-
"bytes":
|
12686
|
+
"bytes": 3970,
|
12687
12687
|
"imports": [
|
12688
12688
|
{
|
12689
12689
|
"path": "../protos/dist/index.js",
|
@@ -12840,7 +12840,7 @@
|
|
12840
12840
|
"format": "esm"
|
12841
12841
|
},
|
12842
12842
|
"src/apis/ui/helpers/getFormValues.ts": {
|
12843
|
-
"bytes":
|
12843
|
+
"bytes": 1069,
|
12844
12844
|
"imports": [
|
12845
12845
|
{
|
12846
12846
|
"path": "../protos/dist/index.js",
|
@@ -15285,7 +15285,7 @@
|
|
15285
15285
|
"bytesInOutput": 30111
|
15286
15286
|
},
|
15287
15287
|
"../protos/dist/types/devvit/ui/form_builder/v1alpha/type.js": {
|
15288
|
-
"bytesInOutput":
|
15288
|
+
"bytesInOutput": 1978
|
15289
15289
|
},
|
15290
15290
|
"../protos/dist/types/devvit/ui/form_builder/v1alpha/value.js": {
|
15291
15291
|
"bytesInOutput": 10440
|
@@ -15318,7 +15318,7 @@
|
|
15318
15318
|
"bytesInOutput": 56594
|
15319
15319
|
},
|
15320
15320
|
"../protos/dist/types/devvit/dev_portal/app_version/info/app_version_info.js": {
|
15321
|
-
"bytesInOutput":
|
15321
|
+
"bytesInOutput": 16297
|
15322
15322
|
},
|
15323
15323
|
"../protos/dist/types/devvit/dev_portal/app/categories/categories.js": {
|
15324
15324
|
"bytesInOutput": 6814
|
@@ -15711,7 +15711,7 @@
|
|
15711
15711
|
"bytesInOutput": 4465
|
15712
15712
|
},
|
15713
15713
|
"src/apis/ui/helpers/transformForm.ts": {
|
15714
|
-
"bytesInOutput":
|
15714
|
+
"bytesInOutput": 3682
|
15715
15715
|
},
|
15716
15716
|
"src/devvit/internals/helpers/extendDevvitPrototype.ts": {
|
15717
15717
|
"bytesInOutput": 86
|
@@ -15738,7 +15738,7 @@
|
|
15738
15738
|
"bytesInOutput": 3613
|
15739
15739
|
},
|
15740
15740
|
"src/apis/ui/helpers/getFormValues.ts": {
|
15741
|
-
"bytesInOutput":
|
15741
|
+
"bytesInOutput": 723
|
15742
15742
|
},
|
15743
15743
|
"src/devvit/internals/blocks/useForm.ts": {
|
15744
15744
|
"bytesInOutput": 1389
|
@@ -15942,7 +15942,7 @@
|
|
15942
15942
|
"bytesInOutput": 370
|
15943
15943
|
}
|
15944
15944
|
},
|
15945
|
-
"bytes":
|
15945
|
+
"bytes": 14496571
|
15946
15946
|
}
|
15947
15947
|
}
|
15948
15948
|
}
|
package/meta.min.json
CHANGED
@@ -2399,7 +2399,7 @@
|
|
2399
2399
|
"format": "esm"
|
2400
2400
|
},
|
2401
2401
|
"src/types/form.ts": {
|
2402
|
-
"bytes":
|
2402
|
+
"bytes": 4907,
|
2403
2403
|
"imports": [],
|
2404
2404
|
"format": "esm"
|
2405
2405
|
},
|
@@ -2576,7 +2576,7 @@
|
|
2576
2576
|
"format": "esm"
|
2577
2577
|
},
|
2578
2578
|
"src/apis/ui/helpers/transformForm.ts": {
|
2579
|
-
"bytes":
|
2579
|
+
"bytes": 3970,
|
2580
2580
|
"imports": [
|
2581
2581
|
{
|
2582
2582
|
"path": "@devvit/protos",
|
@@ -2733,7 +2733,7 @@
|
|
2733
2733
|
"format": "esm"
|
2734
2734
|
},
|
2735
2735
|
"src/apis/ui/helpers/getFormValues.ts": {
|
2736
|
-
"bytes":
|
2736
|
+
"bytes": 1069,
|
2737
2737
|
"imports": [
|
2738
2738
|
{
|
2739
2739
|
"path": "@devvit/protos",
|
@@ -4618,7 +4618,7 @@
|
|
4618
4618
|
"imports": [],
|
4619
4619
|
"exports": [],
|
4620
4620
|
"inputs": {},
|
4621
|
-
"bytes":
|
4621
|
+
"bytes": 1218109
|
4622
4622
|
},
|
4623
4623
|
"dist/public-api.min.js": {
|
4624
4624
|
"imports": [
|
@@ -5182,7 +5182,7 @@
|
|
5182
5182
|
"bytesInOutput": 362
|
5183
5183
|
},
|
5184
5184
|
"src/apis/ui/helpers/transformForm.ts": {
|
5185
|
-
"bytesInOutput":
|
5185
|
+
"bytesInOutput": 1956
|
5186
5186
|
},
|
5187
5187
|
"src/devvit/internals/helpers/extendDevvitPrototype.ts": {
|
5188
5188
|
"bytesInOutput": 33
|
@@ -5212,7 +5212,7 @@
|
|
5212
5212
|
"bytesInOutput": 345
|
5213
5213
|
},
|
5214
5214
|
"src/apis/ui/helpers/getFormValues.ts": {
|
5215
|
-
"bytesInOutput":
|
5215
|
+
"bytesInOutput": 407
|
5216
5216
|
},
|
5217
5217
|
"src/devvit/internals/blocks/useForm.ts": {
|
5218
5218
|
"bytesInOutput": 488
|
@@ -5407,7 +5407,7 @@
|
|
5407
5407
|
"bytesInOutput": 178
|
5408
5408
|
}
|
5409
5409
|
},
|
5410
|
-
"bytes":
|
5410
|
+
"bytes": 260409
|
5411
5411
|
}
|
5412
5412
|
}
|
5413
5413
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@devvit/public-api",
|
3
|
-
"version": "0.10.19-next-2024-04-10-
|
3
|
+
"version": "0.10.19-next-2024-04-10-49abb33fb.0",
|
4
4
|
"license": "BSD-3-Clause",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -29,9 +29,9 @@
|
|
29
29
|
},
|
30
30
|
"types": "./index.d.ts",
|
31
31
|
"dependencies": {
|
32
|
-
"@devvit/protos": "0.10.19-next-2024-04-10-
|
33
|
-
"@devvit/runtimes": "0.10.19-next-2024-04-10-
|
34
|
-
"@devvit/shared-types": "0.10.19-next-2024-04-10-
|
32
|
+
"@devvit/protos": "0.10.19-next-2024-04-10-49abb33fb.0",
|
33
|
+
"@devvit/runtimes": "0.10.19-next-2024-04-10-49abb33fb.0",
|
34
|
+
"@devvit/shared-types": "0.10.19-next-2024-04-10-49abb33fb.0",
|
35
35
|
"base64-js": "1.5.1",
|
36
36
|
"clone-deep": "4.0.1",
|
37
37
|
"core-js": "3.27.2",
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"@ampproject/filesize": "4.3.0",
|
42
42
|
"@devvit/eslint-config": "0.10.18",
|
43
43
|
"@devvit/repo-tools": "0.10.18",
|
44
|
-
"@devvit/tsconfig": "0.10.19-next-2024-04-10-
|
44
|
+
"@devvit/tsconfig": "0.10.19-next-2024-04-10-49abb33fb.0",
|
45
45
|
"@microsoft/api-extractor": "7.41.0",
|
46
46
|
"@reddit/faceplate-ui": "11.1.0",
|
47
47
|
"@types/clone-deep": "4.0.1",
|
@@ -63,5 +63,5 @@
|
|
63
63
|
}
|
64
64
|
},
|
65
65
|
"source": "./src/index.ts",
|
66
|
-
"gitHead": "
|
66
|
+
"gitHead": "71f5cdb58e297f0ca9c8a04dcd88431be4dd01d8"
|
67
67
|
}
|
package/public-api.d.ts
CHANGED
@@ -1328,7 +1328,7 @@ export declare type FormDefinition = {
|
|
1328
1328
|
onSubmit: FormOnSubmitEventHandler;
|
1329
1329
|
};
|
1330
1330
|
|
1331
|
-
export declare type FormField = StringField | ParagraphField | NumberField | BooleanField | SelectField | FormFieldGroup;
|
1331
|
+
export declare type FormField = StringField | ImageField | ParagraphField | NumberField | BooleanField | SelectField | FormFieldGroup;
|
1332
1332
|
|
1333
1333
|
/** A grouping of fields */
|
1334
1334
|
export declare type FormFieldGroup = {
|
@@ -1607,6 +1607,15 @@ declare type ImageContainer<Context> = {
|
|
1607
1607
|
animatedImage(opts: ImageOptions): Context;
|
1608
1608
|
};
|
1609
1609
|
|
1610
|
+
/**
|
1611
|
+
* Allows a user to upload an image as part of submitting the form. The string value that's
|
1612
|
+
* given back is the URL of the image.
|
1613
|
+
* @experimental
|
1614
|
+
*/
|
1615
|
+
export declare type ImageField = Omit<BaseField<string>, 'defaultValue'> & {
|
1616
|
+
type: 'image';
|
1617
|
+
};
|
1618
|
+
|
1610
1619
|
/**
|
1611
1620
|
* @borrows MediaOptions
|
1612
1621
|
*/
|