@wix/ditto-codegen-public 1.0.244 → 1.0.245
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/out.js +0 -6
- package/package.json +2 -2
- package/dist/examples-apps/coupon-popup/src/components/cart-popup-settings.tsx +0 -135
- package/dist/examples-apps/coupon-popup/src/dashboard/pages/cart-popup-manager/extensions.ts +0 -7
- package/dist/examples-apps/coupon-popup/src/dashboard/pages/cart-popup-manager/page.tsx +0 -133
- package/dist/examples-apps/coupon-popup/src/dashboard/withProviders.tsx +0 -16
package/dist/out.js
CHANGED
|
@@ -89010,11 +89010,6 @@ var require_load_examples = __commonJS({
|
|
|
89010
89010
|
path: "coupon-popup",
|
|
89011
89011
|
description: "A marketing app that displays a configurable coupon popup in the shopping cart, with a dashboard interface for managing popup settings and an embedded script to show the popup on the site",
|
|
89012
89012
|
files: {
|
|
89013
|
-
[types_1.ExtensionType.DASHBOARD_PAGE]: [
|
|
89014
|
-
"coupon-popup/src/dashboard/pages/cart-popup-manager/page.tsx",
|
|
89015
|
-
"coupon-popup/src/dashboard/withProviders.tsx",
|
|
89016
|
-
"coupon-popup/src/components/cart-popup-settings.tsx"
|
|
89017
|
-
],
|
|
89018
89013
|
[types_1.ExtensionType.EMBEDDED_SCRIPT]: [
|
|
89019
89014
|
"coupon-popup/src/site/embedded-scripts/cart-coupon-popup/embedded.html"
|
|
89020
89015
|
]
|
|
@@ -89024,7 +89019,6 @@ var require_load_examples = __commonJS({
|
|
|
89024
89019
|
var examples = {
|
|
89025
89020
|
[types_1.ExtensionType.DASHBOARD_PAGE]: [
|
|
89026
89021
|
appsExamples.SurveyManager,
|
|
89027
|
-
appsExamples.CouponPopup,
|
|
89028
89022
|
appsExamples.AIChatbot
|
|
89029
89023
|
],
|
|
89030
89024
|
[types_1.ExtensionType.EMBEDDED_SCRIPT]: [appsExamples.CouponPopup],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ditto-codegen-public",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.245",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"@wix/ditto-codegen": "1.0.0",
|
|
29
29
|
"esbuild": "^0.27.2"
|
|
30
30
|
},
|
|
31
|
-
"falconPackageHash": "
|
|
31
|
+
"falconPackageHash": "4aa908e1e82a22b42b4ad74b623391c687437c15ac95d8e99e79c889"
|
|
32
32
|
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { type FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Input,
|
|
4
|
-
InputArea,
|
|
5
|
-
Card,
|
|
6
|
-
FormField,
|
|
7
|
-
ToggleSwitch,
|
|
8
|
-
NumberInput,
|
|
9
|
-
Box,
|
|
10
|
-
type FormFieldProps,
|
|
11
|
-
} from '@wix/design-system';
|
|
12
|
-
import type { CartPopupOptions } from '../dashboard/pages/cart-popup-manager/page';
|
|
13
|
-
|
|
14
|
-
interface Props {
|
|
15
|
-
options: CartPopupOptions;
|
|
16
|
-
onChange: (options: CartPopupOptions) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const CartPopupSettings: FC<Props> = ({ options, onChange }) => {
|
|
20
|
-
const getFieldStatus = (
|
|
21
|
-
field: keyof CartPopupOptions,
|
|
22
|
-
required: boolean = false
|
|
23
|
-
): Partial<FormFieldProps> => {
|
|
24
|
-
return required && !options[field]
|
|
25
|
-
? {
|
|
26
|
-
status: 'error',
|
|
27
|
-
statusMessage: 'Required.',
|
|
28
|
-
}
|
|
29
|
-
: {};
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Box direction="vertical" gap="24px">
|
|
34
|
-
<Card>
|
|
35
|
-
<Card.Header
|
|
36
|
-
title="Popup Content"
|
|
37
|
-
subtitle="Configure the text and coupon code displayed in the popup"
|
|
38
|
-
/>
|
|
39
|
-
<Card.Divider />
|
|
40
|
-
<Card.Content>
|
|
41
|
-
<Box gap="18px" direction="vertical">
|
|
42
|
-
<FormField
|
|
43
|
-
label="Coupon Code"
|
|
44
|
-
required
|
|
45
|
-
{...getFieldStatus('couponCode', true)}
|
|
46
|
-
>
|
|
47
|
-
<Input
|
|
48
|
-
placeholder="SAVE20"
|
|
49
|
-
value={options.couponCode}
|
|
50
|
-
onChange={(e) =>
|
|
51
|
-
onChange({
|
|
52
|
-
...options,
|
|
53
|
-
couponCode: e.currentTarget.value,
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
/>
|
|
57
|
-
</FormField>
|
|
58
|
-
|
|
59
|
-
<FormField
|
|
60
|
-
label="Popup Headline"
|
|
61
|
-
required
|
|
62
|
-
{...getFieldStatus('popupHeadline', true)}
|
|
63
|
-
>
|
|
64
|
-
<Input
|
|
65
|
-
placeholder="Special Offer!"
|
|
66
|
-
value={options.popupHeadline}
|
|
67
|
-
onChange={(e) =>
|
|
68
|
-
onChange({
|
|
69
|
-
...options,
|
|
70
|
-
popupHeadline: e.currentTarget.value,
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
/>
|
|
74
|
-
</FormField>
|
|
75
|
-
|
|
76
|
-
<FormField
|
|
77
|
-
label="Popup Description"
|
|
78
|
-
required
|
|
79
|
-
{...getFieldStatus('popupDescription', true)}
|
|
80
|
-
>
|
|
81
|
-
<InputArea
|
|
82
|
-
placeholder="Apply this coupon to get a discount on your cart!"
|
|
83
|
-
value={options.popupDescription}
|
|
84
|
-
onChange={(e) =>
|
|
85
|
-
onChange({
|
|
86
|
-
...options,
|
|
87
|
-
popupDescription: e.currentTarget.value,
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
rows={3}
|
|
91
|
-
/>
|
|
92
|
-
</FormField>
|
|
93
|
-
</Box>
|
|
94
|
-
</Card.Content>
|
|
95
|
-
</Card>
|
|
96
|
-
|
|
97
|
-
<Card>
|
|
98
|
-
<Card.Header
|
|
99
|
-
title="Display Settings"
|
|
100
|
-
subtitle="Configure when and how the popup appears"
|
|
101
|
-
/>
|
|
102
|
-
<Card.Divider />
|
|
103
|
-
<Card.Content>
|
|
104
|
-
<Box gap="18px" direction="vertical">
|
|
105
|
-
<FormField label="Enable Popup">
|
|
106
|
-
<ToggleSwitch
|
|
107
|
-
checked={options.enablePopup}
|
|
108
|
-
onChange={() =>
|
|
109
|
-
onChange({
|
|
110
|
-
...options,
|
|
111
|
-
enablePopup: !options.enablePopup,
|
|
112
|
-
})
|
|
113
|
-
}
|
|
114
|
-
/>
|
|
115
|
-
</FormField>
|
|
116
|
-
|
|
117
|
-
<FormField label="Minimum Cart Value">
|
|
118
|
-
<NumberInput
|
|
119
|
-
value={options.minimumCartValue}
|
|
120
|
-
onChange={(value) =>
|
|
121
|
-
onChange({
|
|
122
|
-
...options,
|
|
123
|
-
minimumCartValue: value || 0,
|
|
124
|
-
})
|
|
125
|
-
}
|
|
126
|
-
min={0}
|
|
127
|
-
prefix="$"
|
|
128
|
-
/>
|
|
129
|
-
</FormField>
|
|
130
|
-
</Box>
|
|
131
|
-
</Card.Content>
|
|
132
|
-
</Card>
|
|
133
|
-
</Box>
|
|
134
|
-
);
|
|
135
|
-
};
|
package/dist/examples-apps/coupon-popup/src/dashboard/pages/cart-popup-manager/extensions.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { extensions } from '@wix/astro/builders';
|
|
2
|
-
export const dashboardpagecartPopupManager = extensions.dashboardPage({
|
|
3
|
-
"id": "3304e8b7-4d5c-4719-86bb-68f6235a4bc5",
|
|
4
|
-
"title": "Cart Popup Manager",
|
|
5
|
-
"routePath": "cart-popup-manager",
|
|
6
|
-
"component": "./dashboard/pages/cart-popup-manager/page.tsx"
|
|
7
|
-
})
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState, type FC } from 'react';
|
|
2
|
-
import { dashboard } from '@wix/dashboard';
|
|
3
|
-
import { embeddedScripts } from '@wix/app-management';
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
Page,
|
|
7
|
-
Layout,
|
|
8
|
-
Cell,
|
|
9
|
-
Loader,
|
|
10
|
-
Box,
|
|
11
|
-
} from '@wix/design-system';
|
|
12
|
-
import '@wix/design-system/styles.global.css';
|
|
13
|
-
import withProviders from '../../withProviders';
|
|
14
|
-
import { CartPopupSettings } from '../../../components/cart-popup-settings';
|
|
15
|
-
|
|
16
|
-
export type CartPopupOptions = {
|
|
17
|
-
couponCode: string;
|
|
18
|
-
popupHeadline: string;
|
|
19
|
-
popupDescription: string;
|
|
20
|
-
minimumCartValue: number;
|
|
21
|
-
enablePopup: boolean;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const cartPopupDefaultOptions: CartPopupOptions = {
|
|
25
|
-
couponCode: '',
|
|
26
|
-
popupHeadline: 'Special Offer!',
|
|
27
|
-
popupDescription: 'Apply this coupon to get a discount on your cart!',
|
|
28
|
-
minimumCartValue: 0,
|
|
29
|
-
enablePopup: true,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const CartPopupManagerPage: FC = () => {
|
|
33
|
-
const [options, setOptions] = useState<CartPopupOptions>(cartPopupDefaultOptions);
|
|
34
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
35
|
-
const [isSaving, setIsSaving] = useState(false);
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
const loadSettings = async () => {
|
|
39
|
-
try {
|
|
40
|
-
const embeddedScript = await embeddedScripts.getEmbeddedScript();
|
|
41
|
-
const data = embeddedScript.parameters as Partial<Record<keyof CartPopupOptions, string>> || {};
|
|
42
|
-
|
|
43
|
-
setOptions((prev) => ({
|
|
44
|
-
...prev,
|
|
45
|
-
couponCode: data?.couponCode || prev.couponCode,
|
|
46
|
-
popupHeadline: data?.popupHeadline || prev.popupHeadline,
|
|
47
|
-
popupDescription: data?.popupDescription || prev.popupDescription,
|
|
48
|
-
minimumCartValue: Number(data?.minimumCartValue) || prev.minimumCartValue,
|
|
49
|
-
enablePopup: data?.enablePopup === 'true' ? true : data?.enablePopup === 'false' ? false : prev.enablePopup,
|
|
50
|
-
}));
|
|
51
|
-
} catch (error) {
|
|
52
|
-
console.error('Failed to load settings:', error);
|
|
53
|
-
} finally {
|
|
54
|
-
setIsLoading(false);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
loadSettings();
|
|
59
|
-
}, []);
|
|
60
|
-
|
|
61
|
-
const handleSave = async () => {
|
|
62
|
-
if (!options.couponCode || !options.popupHeadline || !options.popupDescription) {
|
|
63
|
-
dashboard.showToast({
|
|
64
|
-
message: 'Please fill in all required fields',
|
|
65
|
-
type: 'error',
|
|
66
|
-
});
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
setIsSaving(true);
|
|
71
|
-
try {
|
|
72
|
-
// Convert all values to strings for embedded script parameters
|
|
73
|
-
await embeddedScripts.embedScript({
|
|
74
|
-
parameters: {
|
|
75
|
-
couponCode: options.couponCode,
|
|
76
|
-
popupHeadline: options.popupHeadline,
|
|
77
|
-
popupDescription: options.popupDescription,
|
|
78
|
-
minimumCartValue: String(options.minimumCartValue),
|
|
79
|
-
enablePopup: String(options.enablePopup),
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
dashboard.showToast({
|
|
84
|
-
message: 'Cart popup settings saved successfully!',
|
|
85
|
-
type: 'success',
|
|
86
|
-
});
|
|
87
|
-
} catch (error) {
|
|
88
|
-
console.error('Failed to save settings:', error);
|
|
89
|
-
dashboard.showToast({
|
|
90
|
-
message: 'Failed to save settings. Please try again.',
|
|
91
|
-
type: 'error',
|
|
92
|
-
});
|
|
93
|
-
} finally {
|
|
94
|
-
setIsSaving(false);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<Page height="100vh">
|
|
100
|
-
<Page.Header
|
|
101
|
-
title="Cart Popup Manager"
|
|
102
|
-
subtitle="Configure your cart popup's content, coupon code, and display rules"
|
|
103
|
-
actionsBar={
|
|
104
|
-
<Button
|
|
105
|
-
skin="inverted"
|
|
106
|
-
disabled={!options.couponCode || !options.popupHeadline || !options.popupDescription || isSaving}
|
|
107
|
-
onClick={handleSave}
|
|
108
|
-
>
|
|
109
|
-
{isSaving ? 'Saving...' : 'Save'}
|
|
110
|
-
</Button>
|
|
111
|
-
}
|
|
112
|
-
/>
|
|
113
|
-
<Page.Content>
|
|
114
|
-
{isLoading ? (
|
|
115
|
-
<Box align="center" verticalAlign="middle" height="50vh">
|
|
116
|
-
<Loader text="Loading cart popup settings..." />
|
|
117
|
-
</Box>
|
|
118
|
-
) : (
|
|
119
|
-
<Layout gap="24px">
|
|
120
|
-
<Cell span={12}>
|
|
121
|
-
<CartPopupSettings
|
|
122
|
-
options={options}
|
|
123
|
-
onChange={setOptions}
|
|
124
|
-
/>
|
|
125
|
-
</Cell>
|
|
126
|
-
</Layout>
|
|
127
|
-
)}
|
|
128
|
-
</Page.Content>
|
|
129
|
-
</Page>
|
|
130
|
-
);
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export default withProviders(CartPopupManagerPage);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { WixDesignSystemProvider } from '@wix/design-system';
|
|
3
|
-
import { i18n } from '@wix/essentials';
|
|
4
|
-
|
|
5
|
-
export default function withProviders<P extends {} = {}>(Component: React.FC<P>) {
|
|
6
|
-
return function DashboardProviders(props: P) {
|
|
7
|
-
const locale = i18n.getLocale();
|
|
8
|
-
return (
|
|
9
|
-
<WixDesignSystemProvider locale={locale} features={{ newColorsBranding: true }}>
|
|
10
|
-
<Component {...props} />
|
|
11
|
-
</WixDesignSystemProvider>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { withProviders };
|