@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,146 +0,0 @@
1
- import React, { type FC, useState, useEffect, useCallback } from "react";
2
- import { widget } from "@wix/editor";
3
- import {
4
- SidePanel,
5
- WixDesignSystemProvider,
6
- Input,
7
- FormField,
8
- TimeInput,
9
- Box,
10
- } from "@wix/design-system";
11
- import "@wix/design-system/styles.global.css";
12
- import { ColorPickerField } from "./components/ColorPickerField";
13
- import { FontPickerField } from "./components/FontPickerField";
14
- import { parseTimeValue } from "./utils";
15
-
16
- const DEFAULT_BG_COLOR = "#0a0e27";
17
- const DEFAULT_TEXT_COLOR = "#00ff88";
18
- const DEFAULT_TEXT_FONT = "";
19
- const DEFAULT_TEXT_DECORATION = "";
20
-
21
- const Panel: FC = () => {
22
- const [title, setTitle] = useState<string>("Countdown");
23
- const [targetDate, setTargetDate] = useState<string>("");
24
- const [targetTime, setTargetTime] = useState<string>("00:00");
25
- const [bgColor, setBgColor] = useState<string>(DEFAULT_BG_COLOR);
26
- const [textColor, setTextColor] = useState<string>(DEFAULT_TEXT_COLOR);
27
- const [font, setFont] = useState({ font: DEFAULT_TEXT_FONT, textDecoration: DEFAULT_TEXT_DECORATION });
28
-
29
- useEffect(() => {
30
- Promise.all([
31
- widget.getProp("title"),
32
- widget.getProp("target-date"),
33
- widget.getProp("target-time"),
34
- widget.getProp("bg-color"),
35
- widget.getProp("text-color"),
36
- widget.getProp("font"),
37
- ])
38
- .then(([titleVal, dateVal, timeVal, bgColorVal, textColorVal, fontString]) => {
39
- setTitle(titleVal || "Countdown");
40
- setTargetDate(dateVal || "");
41
- setTargetTime(timeVal || "00:00");
42
- setBgColor(bgColorVal || DEFAULT_BG_COLOR);
43
- setTextColor(textColorVal || DEFAULT_TEXT_COLOR);
44
- setFont(JSON.parse(fontString || "{}"));
45
- })
46
- .catch((error) => console.error("Failed to fetch widget properties:", error));
47
- }, []);
48
-
49
- const handleTitleChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
50
- const newTitle = event.target.value;
51
- setTitle(newTitle);
52
- widget.setProp("title", newTitle);
53
- }, []);
54
-
55
- const handleDateChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
56
- const newDate = event.target.value;
57
- setTargetDate(newDate);
58
- widget.setProp("target-date", newDate);
59
- }, []);
60
-
61
- const handleTimeChange = useCallback(({ date }: { date: Date }) => {
62
- if (date) {
63
- const hours = String(date.getHours()).padStart(2, '0');
64
- const minutes = String(date.getMinutes()).padStart(2, '0');
65
- const newTime = `${hours}:${minutes}`;
66
- setTargetTime(newTime);
67
- widget.setProp("target-time", newTime);
68
- }
69
- }, []);
70
-
71
- const handleBgColorChange = (value: string) => {
72
- setBgColor(value);
73
- widget.setProp("bg-color", value);
74
- };
75
-
76
- const handleTextColorChange = (value: string) => {
77
- setTextColor(value);
78
- widget.setProp("text-color", value);
79
- };
80
-
81
- const handleFontChange = (value: { font: string; textDecoration: string }) => {
82
- setFont(value);
83
- widget.setProp("font", JSON.stringify(value));
84
- };
85
-
86
- return (
87
- <WixDesignSystemProvider>
88
- <SidePanel width="300" height="100vh">
89
- <SidePanel.Header title="Countdown Settings" />
90
- <SidePanel.Content noPadding stretchVertically>
91
- <Box direction="vertical" gap="24px">
92
- <SidePanel.Field>
93
- <FormField label="Title" required>
94
- <Input
95
- type="text"
96
- value={title}
97
- onChange={handleTitleChange}
98
- placeholder="Enter countdown title"
99
- />
100
- </FormField>
101
- </SidePanel.Field>
102
-
103
- <SidePanel.Field>
104
- <FormField label="Target Date" required>
105
- <Input
106
- type="date"
107
- value={targetDate}
108
- onChange={handleDateChange}
109
- />
110
- </FormField>
111
- </SidePanel.Field>
112
-
113
- <SidePanel.Field>
114
- <FormField label="Target Time" required>
115
- <TimeInput
116
- value={parseTimeValue(targetTime)}
117
- onChange={handleTimeChange}
118
- />
119
- </FormField>
120
- </SidePanel.Field>
121
-
122
- <ColorPickerField
123
- label="Background Color"
124
- value={bgColor}
125
- onChange={handleBgColorChange}
126
- />
127
-
128
- <ColorPickerField
129
- label="Text Color"
130
- value={textColor}
131
- onChange={handleTextColorChange}
132
- />
133
-
134
- <FontPickerField
135
- label="Text Font"
136
- value={font}
137
- onChange={handleFontChange}
138
- />
139
- </Box>
140
- </SidePanel.Content>
141
- </SidePanel>
142
- </WixDesignSystemProvider>
143
- );
144
- };
145
-
146
- export default Panel;
@@ -1,73 +0,0 @@
1
- import type React from 'react';
2
-
3
- interface StyleProps {
4
- bgColor: string;
5
- textColor: string;
6
- textFont?: string;
7
- textDecoration?: string;
8
- }
9
-
10
- export interface WidgetStyles {
11
- wrapper: React.CSSProperties;
12
- title: React.CSSProperties;
13
- digits: React.CSSProperties;
14
- block: React.CSSProperties;
15
- number: React.CSSProperties;
16
- label: React.CSSProperties;
17
- separator: React.CSSProperties;
18
- message: React.CSSProperties;
19
- }
20
-
21
- export function createStyles({ bgColor, textColor, textFont, textDecoration }: StyleProps): WidgetStyles {
22
- return {
23
- wrapper: {
24
- backgroundColor: bgColor,
25
- padding: '24px 32px',
26
- textAlign: 'center',
27
- display: 'inline-block',
28
- },
29
- title: {
30
- font: textFont || '600 24px sans-serif',
31
- color: textColor,
32
- textDecoration,
33
- marginBottom: '16px',
34
- },
35
- digits: {
36
- display: 'flex',
37
- alignItems: 'center',
38
- justifyContent: 'center',
39
- gap: '16px',
40
- },
41
- block: {
42
- display: 'flex',
43
- flexDirection: 'column',
44
- alignItems: 'center',
45
- padding: '12px 16px',
46
- },
47
- number: {
48
- font: textFont || '600 40px sans-serif',
49
- color: textColor,
50
- textDecoration,
51
- lineHeight: 1,
52
- },
53
- label: {
54
- fontSize: '12px',
55
- marginTop: '8px',
56
- color: textColor,
57
- opacity: 0.7,
58
- },
59
- separator: {
60
- font: textFont || '600 32px sans-serif',
61
- color: textColor,
62
- textDecoration,
63
- lineHeight: 1,
64
- opacity: 0.5,
65
- marginBottom: '20px',
66
- },
67
- message: {
68
- fontSize: '18px',
69
- color: textColor,
70
- },
71
- };
72
- }
73
-
@@ -1,46 +0,0 @@
1
- export interface TimeRemaining {
2
- days: number;
3
- hours: number;
4
- minutes: number;
5
- seconds: number;
6
- isExpired: boolean;
7
- }
8
-
9
- export const INITIAL_TIME: TimeRemaining = {
10
- days: 0,
11
- hours: 0,
12
- minutes: 0,
13
- seconds: 0,
14
- isExpired: false,
15
- };
16
-
17
- export function calculateTimeRemaining(targetDate: string, targetTime: string): TimeRemaining {
18
- const target = new Date(`${targetDate}T${targetTime}`);
19
- const diff = target.getTime() - Date.now();
20
-
21
- if (diff <= 0) {
22
- return { ...INITIAL_TIME, isExpired: true };
23
- }
24
-
25
- const days = Math.floor(diff / (1000 * 60 * 60 * 24));
26
- const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
27
- const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
28
- const seconds = Math.floor((diff % (1000 * 60)) / 1000);
29
-
30
- return { days, hours, minutes, seconds, isExpired: false };
31
- }
32
-
33
- export function padNumber(value: number): string {
34
- return String(value).padStart(2, '0');
35
- }
36
-
37
- export function parseTimeValue(timeString: string): Date {
38
- const [hours, minutes] = timeString.split(':').map(Number);
39
- const date = new Date();
40
- date.setHours(hours || 0);
41
- date.setMinutes(minutes || 0);
42
- date.setSeconds(0);
43
- date.setMilliseconds(0);
44
- return date;
45
- }
46
-
@@ -1,97 +0,0 @@
1
- import React, { type FC, useState, useEffect } from 'react';
2
- import ReactDOM from 'react-dom';
3
- import reactToWebComponent from 'react-to-webcomponent';
4
- import { TimeBlock } from './components/TimeBlock';
5
- import { Separator } from './components/Separator';
6
- import { calculateTimeRemaining, padNumber, INITIAL_TIME, type TimeRemaining } from './utils';
7
- import { createStyles } from './styles';
8
-
9
- interface WidgetProps {
10
- title?: string;
11
- targetDate?: string;
12
- targetTime?: string;
13
- bgColor?: string;
14
- textColor?: string;
15
- font?: string;
16
- }
17
-
18
- const CustomElement: FC<WidgetProps> = ({
19
- title = 'Countdown',
20
- targetDate = '',
21
- targetTime = '00:00',
22
- bgColor = '#ffffff',
23
- textColor = '#333333',
24
- font = "{}",
25
- }) => {
26
- const { font: textFont, textDecoration } = JSON.parse(font);
27
- const [time, setTime] = useState<TimeRemaining>(INITIAL_TIME);
28
- const styles = createStyles({ bgColor, textColor, textFont, textDecoration });
29
-
30
- useEffect(() => {
31
- if (!targetDate) return;
32
-
33
- const update = () => setTime(calculateTimeRemaining(targetDate, targetTime));
34
- update();
35
-
36
- const interval = setInterval(update, 1000);
37
- return () => clearInterval(interval);
38
- }, [targetDate, targetTime]);
39
-
40
- if (!targetDate) {
41
- return (
42
- <div style={styles.wrapper}>
43
- {title && <div style={styles.title}>{title}</div>}
44
- <div style={styles.message}>Set a target date</div>
45
- </div>
46
- );
47
- }
48
-
49
- if (time.isExpired) {
50
- return (
51
- <div style={styles.wrapper}>
52
- {title && <div style={styles.title}>{title}</div>}
53
- <div style={styles.message}>Event has started!</div>
54
- </div>
55
- );
56
- }
57
-
58
- const timeUnits = [
59
- { value: time.days, label: 'Days' },
60
- { value: time.hours, label: 'Hours' },
61
- { value: time.minutes, label: 'Minutes' },
62
- { value: time.seconds, label: 'Seconds' },
63
- ];
64
-
65
- return (
66
- <div style={styles.wrapper}>
67
- {title && <div style={styles.title}>{title}</div>}
68
- <div style={styles.digits}>
69
- {timeUnits.map((unit, index) => (
70
- <React.Fragment key={unit.label}>
71
- {index > 0 && <Separator style={styles.separator} />}
72
- <TimeBlock
73
- value={padNumber(unit.value)}
74
- label={unit.label}
75
- numberStyle={styles.number}
76
- labelStyle={styles.label}
77
- blockStyle={styles.block}
78
- />
79
- </React.Fragment>
80
- ))}
81
- </div>
82
- </div>
83
- );
84
- };
85
-
86
- const customElement = reactToWebComponent(CustomElement, React, ReactDOM, {
87
- props: {
88
- title: 'string',
89
- targetDate: 'string',
90
- targetTime: 'string',
91
- bgColor: 'string',
92
- textColor: 'string',
93
- font: 'string',
94
- },
95
- });
96
-
97
- export default customElement;