@wix/ditto-codegen-public 1.0.273 → 1.0.275
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/opencode-tools/batch-read.ts +28 -0
- package/dist/opencode-tools/batch-write.ts +38 -0
- package/dist/opencode-tools/uuid.ts +19 -0
- package/dist/opencode-tools/validate.ts +51 -0
- package/dist/opencode-tools/wds-lookup.ts +134 -0
- package/dist/out.js +392 -102
- package/package.json +2 -2
- package/dist/examples-apps/ai-chatbot/.nvmrc +0 -1
- package/dist/examples-apps/ai-chatbot/README.md +0 -21
- package/dist/examples-apps/ai-chatbot/package-lock.json +0 -7266
- package/dist/examples-apps/ai-chatbot/package.json +0 -35
- package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/ProductChat.module.css +0 -3
- package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/ProductChat.tsx +0 -108
- package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/page.tsx +0 -100
- package/dist/examples-apps/ai-chatbot/src/dashboard/withProviders.tsx +0 -15
- package/dist/examples-apps/ai-chatbot/src/env.d.ts +0 -4
- package/dist/examples-apps/ai-chatbot/src/types.ts +0 -4
- package/dist/examples-apps/ai-chatbot/tsconfig.json +0 -8
- package/dist/examples-apps/ai-chatbot/wix.config.json +0 -5
- package/dist/examples-apps/contact-created-logger/package-lock.json +0 -15102
- package/dist/examples-apps/contact-created-logger/package.json +0 -37
- package/dist/examples-apps/contact-created-logger/src/backend/events/contact-created-logger/event.ts +0 -56
- package/dist/examples-apps/contact-created-logger/tsconfig.json +0 -5
- package/dist/examples-apps/contact-created-logger/wix.config.json +0 -4
- package/dist/examples-apps/coupon-popup/README.md +0 -13
- package/dist/examples-apps/coupon-popup/package.json +0 -43
- package/dist/examples-apps/coupon-popup/src/extensions.ts +0 -12
- package/dist/examples-apps/coupon-popup/src/index.ts +0 -2
- package/dist/examples-apps/coupon-popup/src/site/embedded-scripts/cart-coupon-popup/embedded.html +0 -562
- package/dist/examples-apps/coupon-popup/src/site/embedded-scripts/cart-coupon-popup/extensions.ts +0 -8
- package/dist/examples-apps/coupon-popup/tsconfig.json +0 -10
- package/dist/examples-apps/coupon-popup/wix.config.json +0 -4
- package/dist/examples-apps/custom-element/countdown-widget/components/ColorPickerField.tsx +0 -27
- package/dist/examples-apps/custom-element/countdown-widget/components/FontPickerField.tsx +0 -34
- package/dist/examples-apps/custom-element/countdown-widget/components/Separator.tsx +0 -10
- package/dist/examples-apps/custom-element/countdown-widget/components/TimeBlock.tsx +0 -23
- package/dist/examples-apps/custom-element/countdown-widget/extensions.ts +0 -18
- package/dist/examples-apps/custom-element/countdown-widget/panel.tsx +0 -146
- package/dist/examples-apps/custom-element/countdown-widget/styles.ts +0 -73
- package/dist/examples-apps/custom-element/countdown-widget/utils.ts +0 -46
- package/dist/examples-apps/custom-element/countdown-widget/widget.tsx +0 -97
- package/dist/examples-apps/product-created-logger/package-lock.json +0 -15102
- package/dist/examples-apps/product-created-logger/package.json +0 -37
- package/dist/examples-apps/product-created-logger/src/backend/events/product-created-logger/event.ts +0 -66
- package/dist/examples-apps/product-created-logger/tsconfig.json +0 -5
- package/dist/examples-apps/product-created-logger/wix.config.json +0 -4
- package/dist/examples-apps/react-builder/component.tsx +0 -123
- package/dist/examples-apps/react-builder/components/Badge.tsx +0 -14
- package/dist/examples-apps/react-builder/components/Button.tsx +0 -31
- package/dist/examples-apps/react-builder/components/Counter.tsx +0 -14
- package/dist/examples-apps/react-builder/components/FeaturedImage.tsx +0 -31
- package/dist/examples-apps/react-builder/components/SocialLinks.tsx +0 -61
- package/dist/examples-apps/react-builder/components/Subtitle.tsx +0 -11
- package/dist/examples-apps/react-builder/components/Tags.tsx +0 -25
- package/dist/examples-apps/react-builder/components/Title.tsx +0 -11
- package/dist/examples-apps/react-builder/components/index.ts +0 -8
- package/dist/examples-apps/react-builder/manifest.json +0 -345
- package/dist/examples-apps/react-builder/style.css +0 -197
- package/dist/examples-apps/react-builder/types.ts +0 -70
- package/dist/examples-apps/spis-examples/.nvmrc +0 -1
- package/dist/examples-apps/spis-examples/README.md +0 -21
- package/dist/examples-apps/spis-examples/package-lock.json +0 -6903
- package/dist/examples-apps/spis-examples/package.json +0 -32
- package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-additional-fees/additional-fees/plugin.ts +0 -66
- package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-discount-triggers/discount-triggers/plugin.ts +0 -42
- package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-gift-cards/gift-cards/plugin.ts +0 -38
- package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-shipping-rates/shipping-rates/plugin.ts +0 -34
- package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-validations/validations/plugin.ts +0 -24
- package/dist/examples-apps/spis-examples/src/env.d.ts +0 -4
- package/dist/examples-apps/spis-examples/tsconfig.json +0 -8
- package/dist/examples-apps/spis-examples/wix.config.json +0 -5
- package/dist/examples-apps/survey-manager/README.md +0 -21
- package/dist/examples-apps/survey-manager/package-lock.json +0 -14252
- package/dist/examples-apps/survey-manager/package.json +0 -36
- package/dist/examples-apps/survey-manager/src/dashboard/pages/apis.ts +0 -116
- package/dist/examples-apps/survey-manager/src/dashboard/pages/components/PageLoader.tsx +0 -23
- package/dist/examples-apps/survey-manager/src/dashboard/pages/components/QuestionModal.tsx +0 -84
- package/dist/examples-apps/survey-manager/src/dashboard/pages/components/QuestionsTable.tsx +0 -139
- package/dist/examples-apps/survey-manager/src/dashboard/pages/components/SurveyPageLayout.tsx +0 -99
- package/dist/examples-apps/survey-manager/src/dashboard/pages/components/SurveyStats.tsx +0 -50
- package/dist/examples-apps/survey-manager/src/dashboard/pages/page.tsx +0 -171
- package/dist/examples-apps/survey-manager/src/dashboard/pages/types.ts +0 -28
- package/dist/examples-apps/survey-manager/tsconfig.json +0 -8
- package/dist/examples-apps/survey-manager/wix.config.json +0 -4
|
@@ -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
|
-
|