@rxdrag/website-studio 0.0.16 → 0.0.17
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/generator/hooks/baseFiles.d.ts +52 -2
- package/dist/generator/hooks/bases/astro.config.mjs.d.ts +1 -0
- package/dist/generator/hooks/bases/createEnv.d.ts +2 -0
- package/dist/generator/hooks/bases/favicon.svg.d.ts +1 -0
- package/dist/generator/hooks/bases/package.json.d.ts +1 -0
- package/dist/generator/hooks/bases/src/base.css.d.ts +2 -0
- package/dist/generator/hooks/bases/src/layouts/Layout.astro.d.ts +1 -0
- package/dist/generator/hooks/bases/src/lib/lib.index.d.ts +1 -0
- package/dist/generator/hooks/bases/src/pages/api/ask-for-quote.ts.d.ts +1 -0
- package/dist/generator/hooks/bases/tailwind.config.mjs.d.ts +1 -0
- package/dist/generator/hooks/bases/tsconfig.json.d.ts +1 -0
- package/dist/generator/hooks/useGetFiles.d.ts +51 -2
- package/dist/generator/hooks/useGetPageFiles.d.ts +13 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1495 -979
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { Theme } from "@rxdrag/rxcms-models";
|
|
2
|
+
export declare const createBaseFiles: (theme: Theme) => {
|
|
2
3
|
"package.json": {
|
|
3
4
|
file: {
|
|
4
5
|
contents: string;
|
|
5
6
|
};
|
|
6
7
|
};
|
|
8
|
+
".gitignore": {
|
|
9
|
+
file: {
|
|
10
|
+
contents: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
7
13
|
"astro.config.mjs": {
|
|
8
14
|
file: {
|
|
9
15
|
contents: string;
|
|
@@ -14,6 +20,35 @@ export declare const baseFiles: {
|
|
|
14
20
|
contents: string;
|
|
15
21
|
};
|
|
16
22
|
};
|
|
23
|
+
".env": {
|
|
24
|
+
file: {
|
|
25
|
+
contents: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
"tailwind.config.mjs": {
|
|
29
|
+
file: {
|
|
30
|
+
contents: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
".vscode": {
|
|
34
|
+
directory: {
|
|
35
|
+
"settings.json": {
|
|
36
|
+
file: {
|
|
37
|
+
contents: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
"extensions.json": {
|
|
41
|
+
file: {
|
|
42
|
+
contents: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
"launch.json": {
|
|
46
|
+
file: {
|
|
47
|
+
contents: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
17
52
|
src: {
|
|
18
53
|
directory: {
|
|
19
54
|
layouts: {
|
|
@@ -26,7 +61,17 @@ export declare const baseFiles: {
|
|
|
26
61
|
};
|
|
27
62
|
};
|
|
28
63
|
pages: {
|
|
29
|
-
directory: {
|
|
64
|
+
directory: {
|
|
65
|
+
api: {
|
|
66
|
+
directory: {
|
|
67
|
+
"ask-for-quote.ts": {
|
|
68
|
+
file: {
|
|
69
|
+
contents: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
30
75
|
};
|
|
31
76
|
components: {
|
|
32
77
|
directory: {};
|
|
@@ -40,6 +85,11 @@ export declare const baseFiles: {
|
|
|
40
85
|
};
|
|
41
86
|
};
|
|
42
87
|
};
|
|
88
|
+
"base.css": {
|
|
89
|
+
file: {
|
|
90
|
+
contents: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
43
93
|
"env.d.ts": {
|
|
44
94
|
file: {
|
|
45
95
|
contents: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const astroConfig = "import { defineConfig } from \"astro/config\";\nimport tailwind from \"@astrojs/tailwind\";\nimport react from \"@astrojs/react\";\nimport node from \"@astrojs/node\";\n\nexport default defineConfig({\n integrations: [tailwind(), react()],\n output: \"server\", // \u4F7F\u7528\u670D\u52A1\u7AEF\u6E32\u67D3\u6A21\u5F0F\n adapter: node({\n mode: \"standalone\", // \u4F7F\u7528\u72EC\u7ACB\u6A21\u5F0F\n }), // \u4F7F\u7528 Node.js \u9002\u914D\u5668\n});\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const faviconCode = "<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 36 36\">\n<path fill=\"#000\" d=\"M22.25 4h-8.5a1 1 0 0 0-.96.73l-5.54 19.4a.5.5 0 0 0 .62.62l5.05-1.44a2 2 0 0 0 1.38-1.4l3.22-11.66a.5.5 0 0 1 .96 0l3.22 11.67a2 2 0 0 0 1.38 1.39l5.05 1.44a.5.5 0 0 0 .62-.62l-5.54-19.4a1 1 0 0 0-.96-.73Z\"/>\n<path fill=\"url(#gradient)\" d=\"M18 28a7.63 7.63 0 0 1-3-.61v.61a3 3 0 0 0 6 0v-.61c-.94.4-1.95.61-3 .61Z\"/>\n<defs>\n <linearGradient id=\"gradient\" x1=\"18\" x2=\"18\" y1=\"28\" y2=\"31\" gradientUnits=\"userSpaceOnUse\">\n <stop stop-color=\"#FF1639\"/>\n <stop offset=\"1\" stop-color=\"#FF1639\" stop-opacity=\"0\"/>\n </linearGradient>\n</defs>\n</svg>";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const packageCode = "{\n \"name\": \"astro-project\",\n \"type\": \"module\",\n \"version\": \"0.0.1\",\n \"scripts\": {\n \"dev\": \"astro dev\",\n \"start\": \"astro dev\",\n \"build\": \"astro build\",\n \"preview\": \"astro preview\",\n \"astro\": \"astro\"\n },\n \"dependencies\": {\n \"@astrojs/react\": \"^4.2.0\",\n \"@iconify/react\": \"^5.0.2\",\n \"@rxdrag/website-lib\": \"^0.0.10\",\n \"@rxdrag/website-lib-core\": \"^0.0.8\",\n \"@rxdrag/slate-preview\": \"^1.2.55\",\n \"@rxdrag/rxcms-models\": \"^0.3.46\",\n \"astro\": \"^5.3.0\",\n \"dayjs\": \"^1.11.7\",\n \"gsap\": \"^3.12.7\",\n \"react\": \"^18.2.0\",\n \"react-dom\": \"^18.2.0\"\n },\n \"devDependencies\": {\n \"@astrojs/node\": \"^9.1.3\",\n \"@astrojs/tailwind\": \"^6.0.0\",\n \"@astrojs/vercel\": \"^8.1.2\",\n \"@tailwindcss/forms\": \"^0.5.7\",\n \"@tailwindcss/typography\": \"^0.5.13\",\n \"@types/react\": \"^18.2.20\",\n \"@types/react-dom\": \"^18.2.7\",\n \"tailwindcss\": \"^3.4.1\"\n }\n }";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const layoutCode = "---\nimport \"../base.css\";\nimport { ClientRouter } from \"astro:transitions\";\n---\n\n<!doctype html>\n<html lang=\"zh-CN\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <link rel=\"icon\" type=\"image/svg+xml\" href=\"/favicon.svg\" />\n <meta name=\"generator\" content={Astro.generator} />\n <ClientRouter />\n <slot name=\"meta\" />\n </head>\n <body>\n <slot />\n </body>\n</html>\n\n<style>\n html,\n body {\n margin: 0;\n width: 100%;\n height: 100%;\n }\n</style>\n ";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const libCode = "import {\n Entify,\n type EnvVariables,\n type IEntify,\n } from \"@rxdrag/website-lib-core\";\n \n export function getEnvVariables(): EnvVariables {\n return {\n websiteId: import.meta.env.PUBLIC_WEBSITE_ID,\n entifyServerUrl: import.meta.env.PUBLIC_ENTIFY_SERVER_URL,\n entifyGuestToken: import.meta.env.PUBLIC_ENTIFY_GUEST_TOKEN,\n language: import.meta.env.PUBLIC_LANGUAGE,\n formSalt: import.meta.env.PUBLIC_FORM_SALT || \"yizhanfei\",\n };\n }\n \n export const rx = Entify.getInstance(getEnvVariables()) as IEntify;\n ";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const askForQuoteCode = "import type { APIRoute } from \"astro\";\n import type {\n SpamFilterRule,\n SpamFilterRuleBoolExp,\n SpamFilterRuleDistinctExp,\n SpamFilterRuleOrderBy,\n } from \"@rxdrag/rxcms-models\";\n import {\n EnquiryAssciations,\n EnquiryEntityName,\n EnquiryFields,\n SpamFilterRuleFields,\n SpamFilterRuleQueryOptions,\n } from \"@rxdrag/rxcms-models\";\n import { getEnvVariables, rx } from \"../../lib\";\n import {\n queryWebSiteSettings,\n sendEmail,\n upsertEntity,\n verifyEncryption,\n type QuoteRequest,\n } from \"@rxdrag/website-lib-core\";\n \n // \u6807\u8BB0\u6B64\u9875\u9762\u4E3A\u670D\u52A1\u5668\u6E32\u67D3\uFF0C\u800C\u4E0D\u662F\u9759\u6001\u751F\u6210\n export const prerender = false;\n \n export const POST: APIRoute = async ({ request }) => {\n try {\n const envVariables = getEnvVariables();\n \n // \u4ECE\u8BF7\u6C42\u4E2D\u83B7\u53D6JSON\u6570\u636E\n let requestData: QuoteRequest;\n try {\n requestData = await request.json();\n } catch (error) {\n console.error(\"JSON parsing error:\", error);\n return new Response(\n JSON.stringify({\n success: false,\n message: \"Invalid request format\",\n }),\n {\n status: 400,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n }\n );\n }\n \n // \u9A8C\u8BC1\u871C\u7F50\u5B57\u6BB5\n if (requestData.phone) {\n console.log(\"Honeypot triggered - spam submission detected\");\n // \u6084\u6084\u5931\u8D25\uFF0C\u8FD4\u56DE\u6210\u529F\u4F46\u4E0D\u5904\u7406\n return new Response(\n JSON.stringify({\n success: true,\n message:\n \"Your enquiry has been submitted successfully, we will contact you soon\",\n }),\n {\n status: 200,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n }\n );\n }\n \n // \u521B\u5EFA\u5B9E\u4F53\u5BF9\u8C61 - \u79FB\u9664\u4E0D\u5728\u6570\u636E\u5E93\u6A21\u578B\u4E2D\u7684\u5B57\u6BB5\n const { phone, encryptedField, ...entityData } = requestData;\n const entity: Record<string, unknown> = { ...entityData };\n \n // \u68C0\u67E5\u871C\u7F50\u5B57\u6BB5\n if (phone) {\n // \u871C\u7F50\u88AB\u89E6\u53D1\uFF0C\u62D2\u7EDD\u8BF7\u6C42\n return new Response(\n JSON.stringify({\n success: false,\n message: \"Form submission rejected\",\n }),\n {\n status: 400,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n }\n );\n }\n \n // \u9A8C\u8BC1\u52A0\u5BC6\u5B57\u6BB5\n const isValid = verifyEncryption(\n //\u52A0\u5BC6\u76D0\n envVariables.formSalt,\n encryptedField,\n phone || \"\",\n 30 // 30\u5206\u949F\u6709\u6548\u671F\n );\n \n if (!isValid) {\n // \u52A0\u5BC6\u9A8C\u8BC1\u5931\u8D25\uFF0C\u62D2\u7EDD\u8BF7\u6C42\n return new Response(\n JSON.stringify({\n success: false,\n message: \"Invalid form submission\",\n }),\n {\n status: 400,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n }\n );\n }\n \n // \u83B7\u53D6\u8BF7\u6C42\u5934\u4FE1\u606F\n const url =\n request.headers.get(\"X-Request-URL\") || request.headers.get(\"referer\");\n const ip =\n request.headers.get(\"X-Forwarded-For\") ||\n request.headers.get(\"X-Real-IP\");\n const userAgent = request.headers.get(\"user-agent\");\n \n // \u8BBE\u7F6E\u989D\u5916\u5B57\u6BB5\n entity[EnquiryFields.formIp] = ip;\n entity[EnquiryFields.fromUrl] = url;\n entity[EnquiryFields.userAgent] = userAgent;\n entity[EnquiryFields.read] = false;\n entity[EnquiryFields.spam] = false;\n entity[EnquiryAssciations.website] = {\n sync: { id: envVariables.websiteId },\n };\n \n // \u9A8C\u8BC1\u5FC5\u586B\u5B57\u6BB5\n if (\n !entity[EnquiryFields.name] ||\n !entity[EnquiryFields.email] ||\n !entity[EnquiryFields.message]\n ) {\n return new Response(\n JSON.stringify({\n success: false,\n message: \"Please fill in all required fields\",\n }),\n {\n status: 400,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n }\n );\n }\n \n // \u5783\u573E\u4FE1\u606F\u8FC7\u6EE4\n const spamRules = (\n await rx.queryEntityList<\n SpamFilterRule,\n SpamFilterRuleBoolExp,\n SpamFilterRuleOrderBy,\n SpamFilterRuleDistinctExp\n >(\n new SpamFilterRuleQueryOptions([\n SpamFilterRuleFields.emails,\n SpamFilterRuleFields.ips,\n SpamFilterRuleFields.keywords,\n ])\n )\n )?.items as SpamFilterRule[] | undefined;\n \n for (const rule of spamRules || []) {\n const email = (entity[EnquiryFields.email] as string)?.trim();\n if (\n !email ||\n rule.emails\n ?.replace(\"\uFF0C\", \",\")\n .split(\",\")\n .map((em) => em.trim())\n .includes(email) ||\n (ip &&\n rule.ips\n ?.replace(\"\uFF0C\", \",\")\n .split(\",\")\n .map((ipAddr) => ipAddr.trim())\n .includes(ip)) ||\n rule.keywords\n ?.split(\",\")\n .some(\n (keyword: string) =>\n keyword &&\n (entity[EnquiryFields.message] as string).includes(keyword)\n )\n ) {\n // \u6807\u8BB0\u4E3A\u5783\u573E\u4FE1\u606F\u5E76\u4FDD\u5B58\n await upsertEntity(\n EnquiryEntityName,\n { ...entity, spam: true, read: false },\n envVariables\n );\n \n // \u8FD4\u56DE404\u54CD\u5E94\uFF0C\u6A21\u62DF\u539F\u59CB\u884C\u4E3A\n return new Response(null, { status: 404 });\n }\n }\n \n // \u4FDD\u5B58\u8BE2\u4EF7\u4FE1\u606F\n await upsertEntity(EnquiryEntityName, entity, envVariables);\n \n // \u83B7\u53D6\u7F51\u7AD9\u8BBE\u7F6E\u5E76\u53D1\u9001\u90AE\u4EF6\u901A\u77E5\n const websettins = await queryWebSiteSettings(envVariables);\n const name = entity?.[EnquiryFields.name] as string;\n \n if (websettins?.noticeEmail) {\n const content = `\n Company: ${entity[EnquiryFields.company]}\n Name: ${name}\n Email: ${entity[EnquiryFields.email]}\n Message: ${entity[EnquiryFields.message]}\n IP: ${ip}\n URL: ${url}\n CTA: ${entity[EnquiryFields.fromCta]}\n userAgent: ${userAgent}\n `;\n \n const employeeEmail = {\n to: websettins?.noticeEmail,\n subject: \"New Enquiry Received\",\n message: content,\n };\n \n await sendEmail(employeeEmail, envVariables);\n }\n \n // \u8FD4\u56DEJSON\u54CD\u5E94\n return new Response(\n JSON.stringify({\n success: true,\n message:\n \"Your enquiry has been submitted successfully, we will contact you soon\",\n }),\n {\n status: 200,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n }\n );\n } catch (error) {\n console.error(\"Error processing enquiry request:\", error);\n \n // \u8FD4\u56DE\u9519\u8BEF\u54CD\u5E94\n return new Response(\n JSON.stringify({\n success: false,\n message: \"Submission failed, please try again later\",\n }),\n {\n status: 500,\n headers: {\n \"Content-Type\": \"application/json\",\n },\n }\n );\n }\n };\n ";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tailwindConfigCode = "import plugin from \"tailwindcss/plugin\";\n\nexport default {\n darkMode: \"class\", // \u4F7F\u7528class\u7B56\u7565\u6765\u63A7\u5236\u6697\u8272\u6A21\u5F0F\n content: [\n \"./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}\",\n \"node_modules/@rxdrag/website-lib/src/**/*.{js,ts,jsx,tsx}\",\n \"node_modules/@rxdrag/website-lib-core/src/**/*.{js,ts,jsx,tsx}\",\n ],\n theme: {\n extend: {},\n },\n plugins: [\n require(\"@tailwindcss/forms\"),\n require(\"@tailwindcss/typography\"),\n plugin(function ({ addVariant }) {\n addVariant(\"scrolling\", \".scrolling &\");\n addVariant(\"open\", [\".open&\", \".open &\"]);\n addVariant(\"actived\", [\".actived&\", \".actived &\"]);\n addVariant(\"disabled\", [\".disabled&\", \".disabled &\"]);\n addVariant(\"selected\", [\".selected&\", \".selected &\"]);\n }),\n ],\n};\n\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tsconfigCode = "{\n \"extends\": \"astro/tsconfigs/strict\",\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"jsxImportSource\": \"react\"\n },\n \"include\": [\".astro/types.d.ts\", \"**/*\"],\n \"exclude\": [\"dist\"]\n }\n ";
|
|
@@ -6,7 +6,17 @@ export declare function useGetFiles(): (theme?: Theme) => Promise<{
|
|
|
6
6
|
directory: {};
|
|
7
7
|
};
|
|
8
8
|
pages: {
|
|
9
|
-
directory: {
|
|
9
|
+
directory: {
|
|
10
|
+
api: {
|
|
11
|
+
directory: {
|
|
12
|
+
"ask-for-quote.ts": {
|
|
13
|
+
file: {
|
|
14
|
+
contents: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
10
20
|
};
|
|
11
21
|
layouts: {
|
|
12
22
|
directory: {
|
|
@@ -26,6 +36,11 @@ export declare function useGetFiles(): (theme?: Theme) => Promise<{
|
|
|
26
36
|
};
|
|
27
37
|
};
|
|
28
38
|
};
|
|
39
|
+
"base.css": {
|
|
40
|
+
file: {
|
|
41
|
+
contents: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
29
44
|
"env.d.ts": {
|
|
30
45
|
file: {
|
|
31
46
|
contents: string;
|
|
@@ -38,6 +53,11 @@ export declare function useGetFiles(): (theme?: Theme) => Promise<{
|
|
|
38
53
|
contents: string;
|
|
39
54
|
};
|
|
40
55
|
};
|
|
56
|
+
".gitignore": {
|
|
57
|
+
file: {
|
|
58
|
+
contents: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
41
61
|
"astro.config.mjs": {
|
|
42
62
|
file: {
|
|
43
63
|
contents: string;
|
|
@@ -48,6 +68,35 @@ export declare function useGetFiles(): (theme?: Theme) => Promise<{
|
|
|
48
68
|
contents: string;
|
|
49
69
|
};
|
|
50
70
|
};
|
|
71
|
+
".env": {
|
|
72
|
+
file: {
|
|
73
|
+
contents: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
"tailwind.config.mjs": {
|
|
77
|
+
file: {
|
|
78
|
+
contents: string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
".vscode": {
|
|
82
|
+
directory: {
|
|
83
|
+
"settings.json": {
|
|
84
|
+
file: {
|
|
85
|
+
contents: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
"extensions.json": {
|
|
89
|
+
file: {
|
|
90
|
+
contents: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
"launch.json": {
|
|
94
|
+
file: {
|
|
95
|
+
contents: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
51
100
|
public: {
|
|
52
101
|
directory: {
|
|
53
102
|
"favicon.svg": {
|
|
@@ -57,4 +106,4 @@ export declare function useGetFiles(): (theme?: Theme) => Promise<{
|
|
|
57
106
|
};
|
|
58
107
|
};
|
|
59
108
|
};
|
|
60
|
-
}>;
|
|
109
|
+
} | undefined>;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
type FileContent = {
|
|
2
|
+
contents: string;
|
|
3
|
+
};
|
|
4
|
+
type FileEntry = {
|
|
5
|
+
file: FileContent;
|
|
6
|
+
};
|
|
7
|
+
type DirectoryEntry = {
|
|
8
|
+
directory: DirectoryContent;
|
|
9
|
+
};
|
|
10
|
+
type DirectoryContent = Record<string, FileEntry | DirectoryEntry>;
|
|
11
|
+
type FileStructure = Record<string, FileEntry | DirectoryEntry>;
|
|
12
|
+
export declare function useGetPageFiles(): (themeId?: string) => Promise<FileStructure>;
|
|
13
|
+
export {};
|
package/dist/index.d.ts
CHANGED