Skip to content

Commit 88ef69f

Browse files
committed
feat: update Create a QR Code action with new properties and version bump
1 parent 440b7b0 commit 88ef69f

File tree

1 file changed

+42
-58
lines changed

1 file changed

+42
-58
lines changed

components/codeqr/actions/create-qrcode/create-qrcode.mjs

Lines changed: 42 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@ import codeqr from "../../codeqr.app.mjs";
33
export default {
44
key: "codeqr-create-qrcode",
55
name: "Create a QR Code",
6-
description: "Creates a new QR Code in CodeQR using the QR Codes API. [See the documentation](https://codeqr.mintlify.app/api-reference/endpoint/create-a-qrcode)",
7-
version: "0.0.1",
6+
description:
7+
"Creates a new QR Code in CodeQR using the QR Codes API. [See the documentation](https://codeqr.mintlify.app/api-reference/endpoint/create-a-qrcode)",
8+
version: "0.0.2",
89
type: "action",
910
props: {
1011
codeqr,
1112
type: {
1213
type: "string",
1314
label: "QR Code Type",
1415
description: "Select the type of QR Code to generate.",
16+
options: [
17+
"url",
18+
"text",
19+
],
1520
optional: false,
1621
},
1722
static: {
@@ -22,40 +27,23 @@ export default {
2227
optional: false,
2328
default: true,
2429
},
25-
text: {
26-
type: "string",
27-
label: "Text",
28-
description: "Text content stored in the QR Code.",
29-
optional: true,
30-
},
3130
url: {
3231
type: "string",
3332
label: "URL",
3433
description: "The destination URL of the QR Code.",
3534
optional: true,
3635
},
37-
email: {
38-
type: "object",
39-
label: "Email",
40-
description: "Email data for email-based QR Codes (JSON format).",
41-
optional: true,
42-
},
43-
phone: {
44-
type: "string",
45-
label: "Phone",
46-
description: "Phone number stored in the QR Code.",
47-
optional: true,
48-
},
49-
expiresAt: {
36+
text: {
5037
type: "string",
51-
label: "Expiration Date",
52-
description: "Expiration date of the QR Code (ISO 8601).",
38+
label: "Text",
39+
description: "Text content stored in the QR Code.",
5340
optional: true,
5441
},
5542
trackConversion: {
5643
type: "boolean",
5744
label: "Track Conversion",
58-
description: "Enable tracking of conversions for the QR Code.",
45+
description:
46+
"Enable tracking of conversions for the QR Code. Only available for dynamic QR Codes.",
5947
optional: true,
6048
},
6149
title: {
@@ -64,18 +52,6 @@ export default {
6452
description: "Title associated with the QR Code.",
6553
optional: true,
6654
},
67-
description: {
68-
type: "string",
69-
label: "Description",
70-
description: "Description associated with the QR Code.",
71-
optional: true,
72-
},
73-
image: {
74-
type: "string",
75-
label: "Image URL",
76-
description: "URL of an image associated with the QR Code.",
77-
optional: true,
78-
},
7955
bgColor: {
8056
type: "string",
8157
label: "Background Color",
@@ -88,22 +64,37 @@ export default {
8864
description: "Foreground color of the QR Code.",
8965
optional: true,
9066
},
91-
size: {
92-
type: "integer",
93-
label: "Size",
94-
description: "Size of the QR Code in pixels.",
95-
optional: true,
96-
},
9767
showLogo: {
9868
type: "boolean",
9969
label: "Show Logo",
10070
description: "Whether to display a logo in the QR Code.",
10171
optional: true,
10272
},
103-
publicStats: {
104-
type: "boolean",
105-
label: "Public Stats",
106-
description: "Whether the QR Code statistics are publicly accessible.",
73+
src: {
74+
type: "string",
75+
label: "Logo URL",
76+
description:
77+
"URL of the logo to display in the QR Code (only if Show Logo is true).",
78+
optional: true,
79+
},
80+
comments: {
81+
type: "string",
82+
label: "Comments",
83+
description: "Comments or notes about the QR Code.",
84+
optional: true,
85+
},
86+
expiresAt: {
87+
type: "string",
88+
label: "Expiration Date",
89+
description:
90+
"The date and time when the short link will expire (ISO 8601). Only available for dynamic QR Codes.",
91+
optional: true,
92+
},
93+
expiredUrl: {
94+
type: "string",
95+
label: "Expired Redirect URL",
96+
description:
97+
"The URL to redirect to when the short link has expired. Only available for dynamic QR Codes.",
10798
optional: true,
10899
},
109100
},
@@ -112,29 +103,22 @@ export default {
112103
for (const key of [
113104
"type",
114105
"static",
115-
"text",
116106
"url",
117-
"phone",
118-
"expiresAt",
107+
"text",
119108
"trackConversion",
120109
"title",
121-
"description",
122-
"image",
123110
"bgColor",
124111
"fgColor",
125112
"size",
126113
"showLogo",
127-
"publicStats",
114+
"src",
115+
"comments",
116+
"expiresAt",
117+
"expiredUrl",
128118
]) {
129119
if (this[key] != null) payload[key] = this[key];
130120
}
131121

132-
if (this.email) {
133-
payload.email = typeof this.email === "string"
134-
? JSON.parse(this.email)
135-
: this.email;
136-
}
137-
138122
const response = await this.codeqr.createQrcode({
139123
$,
140124
data: payload,

0 commit comments

Comments
 (0)