@wix/ditto-codegen-public 1.0.274 → 1.0.276

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.
Files changed (80) hide show
  1. package/dist/out.js +5 -5
  2. package/package.json +2 -2
  3. package/dist/examples-apps/ai-chatbot/.nvmrc +0 -1
  4. package/dist/examples-apps/ai-chatbot/README.md +0 -21
  5. package/dist/examples-apps/ai-chatbot/package-lock.json +0 -7266
  6. package/dist/examples-apps/ai-chatbot/package.json +0 -35
  7. package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/ProductChat.module.css +0 -3
  8. package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/ProductChat.tsx +0 -108
  9. package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/page.tsx +0 -100
  10. package/dist/examples-apps/ai-chatbot/src/dashboard/withProviders.tsx +0 -15
  11. package/dist/examples-apps/ai-chatbot/src/env.d.ts +0 -4
  12. package/dist/examples-apps/ai-chatbot/src/types.ts +0 -4
  13. package/dist/examples-apps/ai-chatbot/tsconfig.json +0 -8
  14. package/dist/examples-apps/ai-chatbot/wix.config.json +0 -5
  15. package/dist/examples-apps/contact-created-logger/package-lock.json +0 -15102
  16. package/dist/examples-apps/contact-created-logger/package.json +0 -37
  17. package/dist/examples-apps/contact-created-logger/src/backend/events/contact-created-logger/event.ts +0 -56
  18. package/dist/examples-apps/contact-created-logger/tsconfig.json +0 -5
  19. package/dist/examples-apps/contact-created-logger/wix.config.json +0 -4
  20. package/dist/examples-apps/coupon-popup/README.md +0 -13
  21. package/dist/examples-apps/coupon-popup/package.json +0 -43
  22. package/dist/examples-apps/coupon-popup/src/extensions.ts +0 -12
  23. package/dist/examples-apps/coupon-popup/src/index.ts +0 -2
  24. package/dist/examples-apps/coupon-popup/src/site/embedded-scripts/cart-coupon-popup/embedded.html +0 -562
  25. package/dist/examples-apps/coupon-popup/src/site/embedded-scripts/cart-coupon-popup/extensions.ts +0 -8
  26. package/dist/examples-apps/coupon-popup/tsconfig.json +0 -10
  27. package/dist/examples-apps/coupon-popup/wix.config.json +0 -4
  28. package/dist/examples-apps/custom-element/countdown-widget/components/ColorPickerField.tsx +0 -27
  29. package/dist/examples-apps/custom-element/countdown-widget/components/FontPickerField.tsx +0 -34
  30. package/dist/examples-apps/custom-element/countdown-widget/components/Separator.tsx +0 -10
  31. package/dist/examples-apps/custom-element/countdown-widget/components/TimeBlock.tsx +0 -23
  32. package/dist/examples-apps/custom-element/countdown-widget/extensions.ts +0 -18
  33. package/dist/examples-apps/custom-element/countdown-widget/panel.tsx +0 -146
  34. package/dist/examples-apps/custom-element/countdown-widget/styles.ts +0 -73
  35. package/dist/examples-apps/custom-element/countdown-widget/utils.ts +0 -46
  36. package/dist/examples-apps/custom-element/countdown-widget/widget.tsx +0 -97
  37. package/dist/examples-apps/product-created-logger/package-lock.json +0 -15102
  38. package/dist/examples-apps/product-created-logger/package.json +0 -37
  39. package/dist/examples-apps/product-created-logger/src/backend/events/product-created-logger/event.ts +0 -66
  40. package/dist/examples-apps/product-created-logger/tsconfig.json +0 -5
  41. package/dist/examples-apps/product-created-logger/wix.config.json +0 -4
  42. package/dist/examples-apps/react-builder/component.tsx +0 -123
  43. package/dist/examples-apps/react-builder/components/Badge.tsx +0 -14
  44. package/dist/examples-apps/react-builder/components/Button.tsx +0 -31
  45. package/dist/examples-apps/react-builder/components/Counter.tsx +0 -14
  46. package/dist/examples-apps/react-builder/components/FeaturedImage.tsx +0 -31
  47. package/dist/examples-apps/react-builder/components/SocialLinks.tsx +0 -61
  48. package/dist/examples-apps/react-builder/components/Subtitle.tsx +0 -11
  49. package/dist/examples-apps/react-builder/components/Tags.tsx +0 -25
  50. package/dist/examples-apps/react-builder/components/Title.tsx +0 -11
  51. package/dist/examples-apps/react-builder/components/index.ts +0 -8
  52. package/dist/examples-apps/react-builder/manifest.json +0 -345
  53. package/dist/examples-apps/react-builder/style.css +0 -197
  54. package/dist/examples-apps/react-builder/types.ts +0 -70
  55. package/dist/examples-apps/spis-examples/.nvmrc +0 -1
  56. package/dist/examples-apps/spis-examples/README.md +0 -21
  57. package/dist/examples-apps/spis-examples/package-lock.json +0 -6903
  58. package/dist/examples-apps/spis-examples/package.json +0 -32
  59. package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-additional-fees/additional-fees/plugin.ts +0 -66
  60. package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-discount-triggers/discount-triggers/plugin.ts +0 -42
  61. package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-gift-cards/gift-cards/plugin.ts +0 -38
  62. package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-shipping-rates/shipping-rates/plugin.ts +0 -34
  63. package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-validations/validations/plugin.ts +0 -24
  64. package/dist/examples-apps/spis-examples/src/env.d.ts +0 -4
  65. package/dist/examples-apps/spis-examples/tsconfig.json +0 -8
  66. package/dist/examples-apps/spis-examples/wix.config.json +0 -5
  67. package/dist/examples-apps/survey-manager/README.md +0 -21
  68. package/dist/examples-apps/survey-manager/package-lock.json +0 -14252
  69. package/dist/examples-apps/survey-manager/package.json +0 -36
  70. package/dist/examples-apps/survey-manager/src/dashboard/pages/apis.ts +0 -116
  71. package/dist/examples-apps/survey-manager/src/dashboard/pages/components/PageLoader.tsx +0 -23
  72. package/dist/examples-apps/survey-manager/src/dashboard/pages/components/QuestionModal.tsx +0 -84
  73. package/dist/examples-apps/survey-manager/src/dashboard/pages/components/QuestionsTable.tsx +0 -139
  74. package/dist/examples-apps/survey-manager/src/dashboard/pages/components/SurveyPageLayout.tsx +0 -99
  75. package/dist/examples-apps/survey-manager/src/dashboard/pages/components/SurveyStats.tsx +0 -50
  76. package/dist/examples-apps/survey-manager/src/dashboard/pages/page.tsx +0 -171
  77. package/dist/examples-apps/survey-manager/src/dashboard/pages/types.ts +0 -28
  78. package/dist/examples-apps/survey-manager/tsconfig.json +0 -8
  79. package/dist/examples-apps/survey-manager/wix.config.json +0 -4
  80. package/dist/opencode-tools/wds-lookup.ts +0 -134
@@ -1,171 +0,0 @@
1
- import React, { useState, useEffect, type FC } from 'react';
2
- import { dashboard } from '@wix/dashboard';
3
- import '@wix/design-system/styles.global.css';
4
-
5
- import type { SurveyQuestion, QuestionStats, QuestionFormData } from './types';
6
- import {
7
- createQuestion,
8
- getAllQuestions,
9
- updateQuestion,
10
- deleteQuestion,
11
- getQuestionStats,
12
- } from './apis';
13
- import { PageLoader } from './components/PageLoader';
14
- import { SurveyPageLayout } from './components/SurveyPageLayout';
15
-
16
- const DEFAULT_FORM_DATA: QuestionFormData = {
17
- questionText: '',
18
- maxRating: 5,
19
- isActive: true,
20
- };
21
-
22
- const SurveyManager: FC = () => {
23
- const [questions, setQuestions] = useState<SurveyQuestion[]>([]);
24
- const [questionStats, setQuestionStats] = useState<Record<string, QuestionStats>>({});
25
- const [loading, setLoading] = useState(true);
26
- const [isModalOpen, setIsModalOpen] = useState(false);
27
- const [editingQuestion, setEditingQuestion] = useState<SurveyQuestion | null>(null);
28
- const [formData, setFormData] = useState<QuestionFormData>(DEFAULT_FORM_DATA);
29
-
30
- const loadQuestions = async () => {
31
- try {
32
- setLoading(true);
33
- const result = await getAllQuestions();
34
- setQuestions(result.items);
35
-
36
- const stats: Record<string, QuestionStats> = {};
37
- for (const question of result.items) {
38
- if (question._id) {
39
- stats[question._id] = await getQuestionStats(question._id);
40
- }
41
- }
42
- setQuestionStats(stats);
43
- } catch (error) {
44
- dashboard.showToast({
45
- message: 'Failed to load survey questions',
46
- type: 'error',
47
- });
48
- } finally {
49
- setLoading(false);
50
- }
51
- };
52
-
53
- useEffect(() => {
54
- loadQuestions();
55
- }, []);
56
-
57
- const openModal = (question?: SurveyQuestion) => {
58
- setEditingQuestion(question || null);
59
- setFormData(
60
- question
61
- ? {
62
- questionText: question.questionText,
63
- maxRating: question.maxRating,
64
- isActive: question.isActive,
65
- }
66
- : DEFAULT_FORM_DATA
67
- );
68
- setIsModalOpen(true);
69
- };
70
-
71
- const closeModal = () => {
72
- setIsModalOpen(false);
73
- setEditingQuestion(null);
74
- setFormData(DEFAULT_FORM_DATA);
75
- };
76
-
77
- const handleSave = async () => {
78
- if (!formData.questionText.trim()) {
79
- dashboard.showToast({
80
- message: 'Question text is required',
81
- type: 'error',
82
- });
83
- return;
84
- }
85
-
86
- try {
87
- if (editingQuestion) {
88
- await updateQuestion({ ...editingQuestion, ...formData });
89
- dashboard.showToast({
90
- message: 'Question updated successfully',
91
- type: 'success',
92
- });
93
- } else {
94
- await createQuestion(formData);
95
- dashboard.showToast({
96
- message: 'Question created successfully',
97
- type: 'success',
98
- });
99
- }
100
- closeModal();
101
- loadQuestions();
102
- } catch (error) {
103
- dashboard.showToast({
104
- message: editingQuestion ? 'Failed to update question' : 'Failed to create question',
105
- type: 'error',
106
- });
107
- }
108
- };
109
-
110
- const handleDelete = async (questionId: string, questionText: string) => {
111
- try {
112
- await deleteQuestion(questionId);
113
- dashboard.showToast({
114
- message: `"${questionText}" deleted successfully`,
115
- type: 'success',
116
- });
117
- loadQuestions();
118
- } catch (error) {
119
- dashboard.showToast({
120
- message: 'Failed to delete question',
121
- type: 'error',
122
- });
123
- }
124
- };
125
-
126
- const handleToggleStatus = async (question: SurveyQuestion) => {
127
- try {
128
- await updateQuestion({ ...question, isActive: !question.isActive });
129
- dashboard.showToast({
130
- message: `Question ${!question.isActive ? 'activated' : 'deactivated'}`,
131
- type: 'success',
132
- });
133
- loadQuestions();
134
- } catch (error) {
135
- dashboard.showToast({
136
- message: 'Failed to update question status',
137
- type: 'error',
138
- });
139
- }
140
- };
141
-
142
- const totalResponses = Object.values(questionStats).reduce(
143
- (sum, stats) => sum + stats.totalResponses,
144
- 0
145
- );
146
- const activeQuestions = questions.filter((q) => q.isActive).length;
147
-
148
- if (loading) {
149
- return <PageLoader title="Survey Manager" message="Loading survey questions..." />;
150
- }
151
-
152
- return (
153
- <SurveyPageLayout
154
- questions={questions}
155
- questionStats={questionStats}
156
- activeQuestions={activeQuestions}
157
- totalResponses={totalResponses}
158
- isModalOpen={isModalOpen}
159
- editingQuestion={editingQuestion}
160
- formData={formData}
161
- onOpenModal={openModal}
162
- onCloseModal={closeModal}
163
- onFormChange={setFormData}
164
- onSave={handleSave}
165
- onDelete={handleDelete}
166
- onToggleStatus={handleToggleStatus}
167
- />
168
- );
169
- };
170
-
171
- export default SurveyManager;
@@ -1,28 +0,0 @@
1
- import type { items } from '@wix/data';
2
-
3
- export type WixDataItem = items.WixDataItem;
4
-
5
- export interface SurveyQuestion extends WixDataItem {
6
- questionText: string;
7
- maxRating: number;
8
- isActive: boolean;
9
- }
10
-
11
- export interface SurveyResponse extends WixDataItem {
12
- questionId: string;
13
- rating: number;
14
- submittedAt: Date;
15
- }
16
-
17
- export interface QuestionStats {
18
- totalResponses: number;
19
- averageRating: number;
20
- ratingDistribution: { [rating: number]: number };
21
- }
22
-
23
- export interface QuestionFormData {
24
- questionText: string;
25
- maxRating: number;
26
- isActive: boolean;
27
- }
28
-
@@ -1,8 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "jsx": "react"
4
- },
5
- "extends": "astro/tsconfigs/strict",
6
- "include": [".astro/types.d.ts", "**/*"],
7
- "exclude": ["dist"]
8
- }
@@ -1,4 +0,0 @@
1
- {
2
- "appId": "f24d09af-4473-430b-b9bc-6550bc08b268",
3
- "siteId": "2593d2c4-5fee-42a5-b81c-f487d4e8ed64"
4
- }
@@ -1,134 +0,0 @@
1
- import { tool } from "@opencode-ai/plugin";
2
- import { readFile, readdir } from "fs/promises";
3
- import { join } from "path";
4
- const MAX_EXAMPLE_LINES = 80;
5
-
6
- const stripBlankLines = (s: string): string =>
7
- s.split("\n").filter((l) => l.trim().length > 0).join("\n");
8
-
9
- function parseComponentNames(files: string[]): string[] {
10
- const names = new Set<string>();
11
- for (const f of files) {
12
- const m = f.match(/^(.+?)(Props|Examples)\.md$/);
13
- if (m) names.add(m[1]);
14
- }
15
- return [...names].sort();
16
- }
17
-
18
- function trimExamples(raw: string): string {
19
- const lines = raw.split("\n");
20
- const headers: number[] = [];
21
- lines.forEach((l, i) => {
22
- if (l.startsWith("### ")) headers.push(i);
23
- });
24
- const end =
25
- headers.length > 2
26
- ? headers[2]
27
- : Math.min(lines.length, MAX_EXAMPLE_LINES);
28
- return lines.slice(0, end).join("\n");
29
- }
30
-
31
- export default tool({
32
- description:
33
- "Look up Wix Design System (WDS) component props, examples, and icons. " +
34
- "Use this INSTEAD of the wds-docs skill. " +
35
- "Pass component names to get their props (lightweight). " +
36
- "Pass example names ONLY for complex components where you need usage patterns. " +
37
- "Set listAll/listIcons to discover available components/icons. " +
38
- "Combine all in one call. NEVER look up the same component twice.",
39
- args: {
40
- listAll: tool.schema
41
- .boolean()
42
- .optional()
43
- .describe("List all available WDS component names."),
44
- components: tool.schema
45
- .array(tool.schema.string())
46
- .optional()
47
- .describe(
48
- "Component names to get PROPS for, e.g. ['Table', 'Input'].",
49
- ),
50
- examples: tool.schema
51
- .array(tool.schema.string())
52
- .optional()
53
- .describe(
54
- "Component names to get EXAMPLES for. Only use for complex/unfamiliar components.",
55
- ),
56
- listIcons: tool.schema
57
- .boolean()
58
- .optional()
59
- .describe("List all available WDS icon names."),
60
- },
61
- async execute(args, context) {
62
- const docsPath = join(
63
- context.directory,
64
- "node_modules",
65
- "@wix",
66
- "design-system",
67
- "dist",
68
- "docs",
69
- );
70
- const compsDir = join(docsPath, "components");
71
- const sections: string[] = [];
72
-
73
- if (args.listAll) {
74
- try {
75
- const files = await readdir(compsDir);
76
- const names = parseComponentNames(files);
77
- sections.push(
78
- `## Available WDS Components (${names.length})\n${names.join(", ")}`,
79
- );
80
- } catch (e) {
81
- const msg = e instanceof Error ? e.message : String(e);
82
- sections.push(`ERROR listing components: ${msg}`);
83
- }
84
- }
85
-
86
- if (args.components?.length) {
87
- for (const comp of args.components) {
88
- try {
89
- const raw = await readFile(
90
- join(compsDir, `${comp}Props.md`),
91
- "utf-8",
92
- );
93
- sections.push(`## ${comp} Props\n${raw}`);
94
- } catch {
95
- sections.push(`## ${comp} Props\nNot found: ${comp}Props.md`);
96
- }
97
- }
98
- }
99
-
100
- if (args.examples?.length) {
101
- for (const comp of args.examples) {
102
- try {
103
- const raw = await readFile(
104
- join(compsDir, `${comp}Examples.md`),
105
- "utf-8",
106
- );
107
- sections.push(`## ${comp} Examples\n${trimExamples(raw)}`);
108
- } catch {
109
- sections.push(`## ${comp} Examples\nNot found: ${comp}Examples.md`);
110
- }
111
- }
112
- }
113
-
114
- if (args.listIcons) {
115
- try {
116
- const iconsMd = await readFile(join(docsPath, "icons.md"), "utf-8");
117
- sections.push(iconsMd);
118
- } catch (e) {
119
- const msg = e instanceof Error ? e.message : String(e);
120
- sections.push(`ERROR reading icons.md: ${msg}`);
121
- }
122
- }
123
-
124
- if (!sections.length) {
125
- return "No query provided. Pass listAll, components, examples, or listIcons.";
126
- }
127
-
128
- return stripBlankLines(
129
- "IMPORTS: Components from '@wix/design-system', icons from '@wix/wix-ui-icons-common'.\n" +
130
- "CSS: import '@wix/design-system/styles.global.css';\n\n" +
131
- sections.join("\n\n"),
132
- );
133
- },
134
- });