@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.
- package/dist/out.js +5 -5
- 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
- package/dist/opencode-tools/wds-lookup.ts +0 -134
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "my-custom-app",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"dependencies": {
|
|
6
|
-
"@wix/app-management": "^1.0.120",
|
|
7
|
-
"@wix/dashboard": "^1.3.36",
|
|
8
|
-
"@wix/design-system": "^1.214.1",
|
|
9
|
-
"@wix/data": "^1.0.0",
|
|
10
|
-
"@wix/stores": "^1.0.507",
|
|
11
|
-
"@wix/wix-ui-icons-common": "^3.87.1",
|
|
12
|
-
"openai": "^5.15.0",
|
|
13
|
-
"react-query": "^3.39.3"
|
|
14
|
-
},
|
|
15
|
-
"devDependencies": {
|
|
16
|
-
"@types/react": "^16.0.0",
|
|
17
|
-
"@types/react-dom": "^16.0.0",
|
|
18
|
-
"@wix/cli": "^1.0.0",
|
|
19
|
-
"@wix/cli-app": "^1.0.0",
|
|
20
|
-
"@wix/sdk-types": "^1.0.0",
|
|
21
|
-
"react": "16.14.0",
|
|
22
|
-
"react-dom": "16.14.0",
|
|
23
|
-
"typescript": "~5.8.2"
|
|
24
|
-
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"wix": "wix",
|
|
27
|
-
"build": "wix app build",
|
|
28
|
-
"release": "wix app release",
|
|
29
|
-
"dev": "wix app dev",
|
|
30
|
-
"preview": "wix app preview",
|
|
31
|
-
"generate": "wix app generate",
|
|
32
|
-
"logs": "wix app logs",
|
|
33
|
-
"typecheck": "tsc --noEmit"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState, type FC } from "react";
|
|
2
|
-
import { productsV3 } from "@wix/stores";
|
|
3
|
-
import { httpClient } from "@wix/essentials";
|
|
4
|
-
import { Text, Box, Card, Input, Loader } from "@wix/design-system";
|
|
5
|
-
import * as Icons from "@wix/wix-ui-icons-common";
|
|
6
|
-
import styles from "./ProductChat.module.css";
|
|
7
|
-
|
|
8
|
-
export type ChatMessage = {
|
|
9
|
-
text: string;
|
|
10
|
-
author: "Business Buddy" | "User";
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const baseApiUrl = new URL(import.meta.url).origin;
|
|
14
|
-
|
|
15
|
-
async function submitProductChatMessage(
|
|
16
|
-
messages: ChatMessage[],
|
|
17
|
-
product: productsV3.V3Product,
|
|
18
|
-
) {
|
|
19
|
-
try {
|
|
20
|
-
const response = await httpClient.fetchWithAuth(`${baseApiUrl}/api/chat`, {
|
|
21
|
-
method: "POST",
|
|
22
|
-
headers: {
|
|
23
|
-
"Content-Type": "application/json",
|
|
24
|
-
},
|
|
25
|
-
body: JSON.stringify({
|
|
26
|
-
messages,
|
|
27
|
-
product,
|
|
28
|
-
}),
|
|
29
|
-
});
|
|
30
|
-
const message = await response.json();
|
|
31
|
-
|
|
32
|
-
return message;
|
|
33
|
-
} catch (error) {
|
|
34
|
-
console.error("Error submitting product chat message", error);
|
|
35
|
-
return { message: "Error submitting product chat message" };
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const ProductChat: FC<{ product: productsV3.V3Product }> = ({ product }) => {
|
|
40
|
-
const [isWaitingForReply, setIsWaitingForReply] = useState<boolean>(false);
|
|
41
|
-
const [messageDraft, setMessageDraft] = useState<string>();
|
|
42
|
-
const [chatMessages, setChatMessages] = useState<ChatMessage[]>([]);
|
|
43
|
-
|
|
44
|
-
const submitMessage = useCallback(async () => {
|
|
45
|
-
const newMessage: ChatMessage = {
|
|
46
|
-
text: messageDraft ?? "",
|
|
47
|
-
author: "User",
|
|
48
|
-
};
|
|
49
|
-
const messages = chatMessages.concat(newMessage);
|
|
50
|
-
|
|
51
|
-
setChatMessages((state) => state.concat(newMessage));
|
|
52
|
-
setMessageDraft("");
|
|
53
|
-
setIsWaitingForReply(true);
|
|
54
|
-
|
|
55
|
-
const { message: text } = await submitProductChatMessage(
|
|
56
|
-
messages,
|
|
57
|
-
product,
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
setChatMessages((messages) =>
|
|
61
|
-
messages.concat({
|
|
62
|
-
author: "Business Buddy",
|
|
63
|
-
text,
|
|
64
|
-
}),
|
|
65
|
-
);
|
|
66
|
-
setIsWaitingForReply(false);
|
|
67
|
-
}, [chatMessages, messageDraft, product]);
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<Card>
|
|
71
|
-
<Card.Header
|
|
72
|
-
title={`Ask Business Buddy about "${product.name}"`}
|
|
73
|
-
subtitle={`Product ID: ${product._id}`}
|
|
74
|
-
/>
|
|
75
|
-
<Card.Content>
|
|
76
|
-
{chatMessages.map((message) => (
|
|
77
|
-
<Box>
|
|
78
|
-
<Text tabName="p">
|
|
79
|
-
<strong>{message.author}</strong>: {message.text}
|
|
80
|
-
</Text>
|
|
81
|
-
</Box>
|
|
82
|
-
))}
|
|
83
|
-
<Box width="100%" marginTop="SP6">
|
|
84
|
-
<Input
|
|
85
|
-
{...(styles.userInput && { className: styles.userInput })}
|
|
86
|
-
onChange={(e) => setMessageDraft(e.target.value)}
|
|
87
|
-
onEnterPressed={submitMessage}
|
|
88
|
-
disabled={isWaitingForReply}
|
|
89
|
-
value={messageDraft ?? ""}
|
|
90
|
-
placeholder="Ask Business Buddy something..."
|
|
91
|
-
{...(isWaitingForReply && {
|
|
92
|
-
prefix: (
|
|
93
|
-
<Input.Affix>
|
|
94
|
-
<Loader size="tiny" />
|
|
95
|
-
</Input.Affix>
|
|
96
|
-
),
|
|
97
|
-
})}
|
|
98
|
-
suffix={
|
|
99
|
-
<Input.IconAffix>
|
|
100
|
-
<Icons.Send onClick={submitMessage} />
|
|
101
|
-
</Input.IconAffix>
|
|
102
|
-
}
|
|
103
|
-
/>
|
|
104
|
-
</Box>
|
|
105
|
-
</Card.Content>
|
|
106
|
-
</Card>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useMemo, useState, type FC } from "react";
|
|
2
|
-
import { useQuery } from "react-query";
|
|
3
|
-
import { productsV3 } from "@wix/stores";
|
|
4
|
-
import {
|
|
5
|
-
AutoComplete,
|
|
6
|
-
Card,
|
|
7
|
-
Layout,
|
|
8
|
-
Cell,
|
|
9
|
-
Page,
|
|
10
|
-
EmptyState,
|
|
11
|
-
} from "@wix/design-system";
|
|
12
|
-
import "@wix/design-system/styles.global.css";
|
|
13
|
-
import { withProviders } from "../../withProviders";
|
|
14
|
-
import { ProductChat } from "./ProductChat";
|
|
15
|
-
|
|
16
|
-
const ProductsPage: FC = () => {
|
|
17
|
-
const [currentProduct, setCurrentProduct] = useState<productsV3.V3Product>();
|
|
18
|
-
const [searchQuery, setSearchQuery] = useState<string>("");
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
data: storeProducts,
|
|
22
|
-
isLoading,
|
|
23
|
-
error,
|
|
24
|
-
} = useQuery(["products", searchQuery], async () => {
|
|
25
|
-
const result = await productsV3.queryProducts().find();
|
|
26
|
-
return { items: result.items || [] };
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const options = useMemo(
|
|
30
|
-
() =>
|
|
31
|
-
storeProducts?.items.map((product) => ({
|
|
32
|
-
id: product._id!,
|
|
33
|
-
value: product.name,
|
|
34
|
-
})),
|
|
35
|
-
[storeProducts],
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const handleSelect = useCallback(
|
|
39
|
-
(event: { id: string | number }) => {
|
|
40
|
-
setCurrentProduct(
|
|
41
|
-
storeProducts!.items.find(
|
|
42
|
-
(product) => product._id === String(event.id),
|
|
43
|
-
),
|
|
44
|
-
);
|
|
45
|
-
},
|
|
46
|
-
[storeProducts, setCurrentProduct],
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
const handleChange = useCallback(
|
|
50
|
-
(event: React.ChangeEvent<HTMLInputElement>) => {
|
|
51
|
-
setSearchQuery(event.target.value);
|
|
52
|
-
setCurrentProduct(undefined);
|
|
53
|
-
},
|
|
54
|
-
[setSearchQuery, setCurrentProduct],
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
if (error) {
|
|
58
|
-
return (
|
|
59
|
-
<EmptyState
|
|
60
|
-
theme="page-no-border"
|
|
61
|
-
title="We coudn't load products"
|
|
62
|
-
subtitle="Please try again later"
|
|
63
|
-
/>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<Page>
|
|
69
|
-
<Page.Header title="Chat About Products" />
|
|
70
|
-
<Page.Content>
|
|
71
|
-
<Layout>
|
|
72
|
-
<Cell>
|
|
73
|
-
<Card>
|
|
74
|
-
<Card.Header title="Select a product to chat about" />
|
|
75
|
-
<Card.Content>
|
|
76
|
-
<AutoComplete
|
|
77
|
-
size="large"
|
|
78
|
-
{...(isLoading && { status: "loading"})}
|
|
79
|
-
{...(options && { options })}
|
|
80
|
-
onSelect={handleSelect}
|
|
81
|
-
onChange={handleChange}
|
|
82
|
-
{...(currentProduct?.name && { value: currentProduct.name })}
|
|
83
|
-
placeholder="Select a product to chat about"
|
|
84
|
-
/>
|
|
85
|
-
</Card.Content>
|
|
86
|
-
</Card>
|
|
87
|
-
</Cell>
|
|
88
|
-
|
|
89
|
-
{currentProduct && (
|
|
90
|
-
<Cell>
|
|
91
|
-
<ProductChat product={currentProduct} />
|
|
92
|
-
</Cell>
|
|
93
|
-
)}
|
|
94
|
-
</Layout>
|
|
95
|
-
</Page.Content>
|
|
96
|
-
</Page>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default withProviders(ProductsPage);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { QueryClient, QueryClientProvider } from "react-query";
|
|
3
|
-
import { WixStyleReactMaskingProvider } from "@wix/design-system";
|
|
4
|
-
|
|
5
|
-
export function withProviders(Component: React.ComponentType) {
|
|
6
|
-
return function () {
|
|
7
|
-
return (
|
|
8
|
-
<WixStyleReactMaskingProvider>
|
|
9
|
-
<QueryClientProvider client={new QueryClient()}>
|
|
10
|
-
<Component />
|
|
11
|
-
</QueryClientProvider>
|
|
12
|
-
</WixStyleReactMaskingProvider>
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
}
|