@wix/ditto-codegen-public 1.0.40 → 1.0.41
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/examples-apps/custom-element/src/widgets/custom-elements/countdown-timer/widget.tsx +332 -0
- package/dist/out.js +213 -77
- package/package.json +2 -2
- package/dist/examples-apps/chart-widget/.nvmrc +0 -1
- package/dist/examples-apps/chart-widget/README.md +0 -21
- package/dist/examples-apps/chart-widget/assets/chart-widget/thumbnail.png +0 -0
- package/dist/examples-apps/chart-widget/package-lock.json +0 -6329
- package/dist/examples-apps/chart-widget/package.json +0 -30
- package/dist/examples-apps/chart-widget/src/env.d.ts +0 -4
- package/dist/examples-apps/chart-widget/src/site/widgets/custom-elements/chart-widget/common.ts +0 -20
- package/dist/examples-apps/chart-widget/src/site/widgets/custom-elements/chart-widget/element/bar-chart.tsx +0 -53
- package/dist/examples-apps/chart-widget/src/site/widgets/custom-elements/chart-widget/element/pie-chart.tsx +0 -40
- package/dist/examples-apps/chart-widget/src/site/widgets/custom-elements/chart-widget/element.json +0 -20
- package/dist/examples-apps/chart-widget/src/site/widgets/custom-elements/chart-widget/element.tsx +0 -53
- package/dist/examples-apps/chart-widget/src/site/widgets/custom-elements/chart-widget/panel/chart-type.tsx +0 -47
- package/dist/examples-apps/chart-widget/src/site/widgets/custom-elements/chart-widget/panel/slice.tsx +0 -72
- package/dist/examples-apps/chart-widget/src/site/widgets/custom-elements/chart-widget/panel.tsx +0 -90
- package/dist/examples-apps/chart-widget/tsconfig.json +0 -8
- package/dist/examples-apps/chart-widget/wix.config.json +0 -5
package/dist/out.js
CHANGED
|
@@ -117494,30 +117494,6 @@ var require_load_examples = __commonJS({
|
|
|
117494
117494
|
"ai-chatbot/src/dashboard/utils.ts",
|
|
117495
117495
|
"ai-chatbot/src/dashboard/withProviders.tsx",
|
|
117496
117496
|
"ai-chatbot/src/types.ts"
|
|
117497
|
-
],
|
|
117498
|
-
[types.EmbeddedScript]: [],
|
|
117499
|
-
[types.ServicePluginExtension]: [],
|
|
117500
|
-
[types.CustomElementPlugin]: [],
|
|
117501
|
-
[types.CustomElementWidget]: []
|
|
117502
|
-
}
|
|
117503
|
-
},
|
|
117504
|
-
ChartWidget: {
|
|
117505
|
-
path: "chart-widget",
|
|
117506
|
-
description: "A custom widget that displays interactive charts (pie charts and bar charts) with configurable data and styling options for site content",
|
|
117507
|
-
files: {
|
|
117508
|
-
[types.APIExtension]: [],
|
|
117509
|
-
[types.DashboardPage]: [],
|
|
117510
|
-
[types.EmbeddedScript]: [],
|
|
117511
|
-
[types.ServicePluginExtension]: [],
|
|
117512
|
-
[types.CustomElementPlugin]: [],
|
|
117513
|
-
[types.CustomElementWidget]: [
|
|
117514
|
-
"chart-widget/src/site/widgets/custom-elements/chart-widget/common.ts",
|
|
117515
|
-
"chart-widget/src/site/widgets/custom-elements/chart-widget/element.tsx",
|
|
117516
|
-
"chart-widget/src/site/widgets/custom-elements/chart-widget/element/bar-chart.tsx",
|
|
117517
|
-
"chart-widget/src/site/widgets/custom-elements/chart-widget/element/pie-chart.tsx",
|
|
117518
|
-
"chart-widget/src/site/widgets/custom-elements/chart-widget/panel.tsx",
|
|
117519
|
-
"chart-widget/src/site/widgets/custom-elements/chart-widget/panel/chart-type.tsx",
|
|
117520
|
-
"chart-widget/src/site/widgets/custom-elements/chart-widget/panel/slice.tsx"
|
|
117521
117497
|
]
|
|
117522
117498
|
}
|
|
117523
117499
|
},
|
|
@@ -117525,41 +117501,30 @@ var require_load_examples = __commonJS({
|
|
|
117525
117501
|
path: "custom-products-catalog",
|
|
117526
117502
|
description: "A dashboard app that provides a custom interface for managing products with advanced filtering, bulk operations, and CRUD functionality for store products",
|
|
117527
117503
|
files: {
|
|
117528
|
-
[types.APIExtension]: [],
|
|
117529
117504
|
[types.DashboardPage]: [
|
|
117530
117505
|
"custom-products-catalog/src/dashboard/pages/page.tsx",
|
|
117531
117506
|
"custom-products-catalog/src/dashboard/components/create-product.tsx",
|
|
117532
117507
|
"custom-products-catalog/src/dashboard/hooks/stores.ts",
|
|
117533
117508
|
"custom-products-catalog/src/dashboard/withProviders.tsx"
|
|
117534
|
-
]
|
|
117535
|
-
[types.EmbeddedScript]: [],
|
|
117536
|
-
[types.ServicePluginExtension]: [],
|
|
117537
|
-
[types.CustomElementPlugin]: [],
|
|
117538
|
-
[types.CustomElementWidget]: []
|
|
117509
|
+
]
|
|
117539
117510
|
}
|
|
117540
117511
|
},
|
|
117541
117512
|
InventoryCountdown: {
|
|
117542
117513
|
path: "inventory-countdown",
|
|
117543
117514
|
description: "A site plugin that displays real-time inventory countdown for products, showing stock levels and urgency messaging to encourage purchases",
|
|
117544
117515
|
files: {
|
|
117545
|
-
[types.APIExtension]: [],
|
|
117546
|
-
[types.DashboardPage]: [],
|
|
117547
|
-
[types.EmbeddedScript]: [],
|
|
117548
|
-
[types.ServicePluginExtension]: [],
|
|
117549
117516
|
[types.CustomElementPlugin]: [
|
|
117550
117517
|
"inventory-countdown/src/site/plugins/custom-elements/stock-counter/plugin.tsx",
|
|
117551
117518
|
"inventory-countdown/src/site/plugins/custom-elements/stock-counter/plugin.module.css",
|
|
117552
117519
|
"inventory-countdown/src/site/plugins/custom-elements/stock-counter/panel.tsx",
|
|
117553
117520
|
"inventory-countdown/src/site/plugins/custom-elements/stock-counter/consts.ts"
|
|
117554
|
-
]
|
|
117555
|
-
[types.CustomElementWidget]: []
|
|
117521
|
+
]
|
|
117556
117522
|
}
|
|
117557
117523
|
},
|
|
117558
117524
|
MixPanelAnalystic: {
|
|
117559
117525
|
path: "mixpanel-analytics",
|
|
117560
117526
|
description: "An analytics integration app that embeds Mixpanel tracking scripts into websites and provides a dashboard interface for configuring analytics tokens",
|
|
117561
117527
|
files: {
|
|
117562
|
-
[types.APIExtension]: [],
|
|
117563
117528
|
[types.DashboardPage]: [
|
|
117564
117529
|
"mixpanel-analytics/src/dashboard/pages/page.tsx",
|
|
117565
117530
|
"mixpanel-analytics/src/dashboard/components/ProjectToken.tsx",
|
|
@@ -117568,29 +117533,20 @@ var require_load_examples = __commonJS({
|
|
|
117568
117533
|
],
|
|
117569
117534
|
[types.EmbeddedScript]: [
|
|
117570
117535
|
"mixpanel-analytics/src/site/embedded-scripts/mixpanel-analytics/embedded.html"
|
|
117571
|
-
]
|
|
117572
|
-
[types.ServicePluginExtension]: [],
|
|
117573
|
-
[types.CustomElementPlugin]: [],
|
|
117574
|
-
[types.CustomElementWidget]: []
|
|
117536
|
+
]
|
|
117575
117537
|
}
|
|
117576
117538
|
},
|
|
117577
117539
|
MyLocationApp: {
|
|
117578
117540
|
path: "my-locations-app",
|
|
117579
117541
|
description: "The Locations app allows site owners to easily manage their business locations and hours of operation. The app will contain a dashboard page with a list of the site owner's business locations, and a button to edit the hours for each location",
|
|
117580
117542
|
files: {
|
|
117581
|
-
[types.
|
|
117582
|
-
[types.DashboardPage]: ["my-locations-app/src/dashboard/pages/page.tsx"],
|
|
117583
|
-
[types.EmbeddedScript]: [],
|
|
117584
|
-
[types.ServicePluginExtension]: [],
|
|
117585
|
-
[types.CustomElementPlugin]: [],
|
|
117586
|
-
[types.CustomElementWidget]: []
|
|
117543
|
+
[types.DashboardPage]: ["my-locations-app/src/dashboard/pages/page.tsx"]
|
|
117587
117544
|
}
|
|
117588
117545
|
},
|
|
117589
117546
|
SitePopup: {
|
|
117590
117547
|
path: "site-popup",
|
|
117591
117548
|
description: "A marketing app that creates configurable popup overlays for websites with customizable content, images, and activation settings to engage visitors",
|
|
117592
117549
|
files: {
|
|
117593
|
-
[types.APIExtension]: [],
|
|
117594
117550
|
[types.DashboardPage]: [
|
|
117595
117551
|
"site-popup/src/dashboard/pages/page.tsx",
|
|
117596
117552
|
"site-popup/src/dashboard/hooks/wix-embeds.ts",
|
|
@@ -117609,55 +117565,47 @@ var require_load_examples = __commonJS({
|
|
|
117609
117565
|
"site-popup/src/site/embedded-scripts/site-popup/popup-overlay/index.tsx",
|
|
117610
117566
|
"site-popup/src/site/embedded-scripts/site-popup/popup-overlay/index.css",
|
|
117611
117567
|
"site-popup/src/types.ts"
|
|
117612
|
-
]
|
|
117613
|
-
|
|
117614
|
-
|
|
117615
|
-
|
|
117568
|
+
]
|
|
117569
|
+
}
|
|
117570
|
+
},
|
|
117571
|
+
CustomElementWidget: {
|
|
117572
|
+
path: "custom-element",
|
|
117573
|
+
description: "A Custom Element that displays a countdown timer",
|
|
117574
|
+
files: {
|
|
117575
|
+
[types.CustomElementWidget]: [
|
|
117576
|
+
"custom-element/src/widgets/custom-elements/countdown-timer/widget.tsx"
|
|
117577
|
+
]
|
|
117616
117578
|
}
|
|
117617
117579
|
},
|
|
117618
117580
|
SPISExample: {
|
|
117619
117581
|
path: "spis-examples",
|
|
117620
117582
|
description: "A comprehensive collection of Service Plugin Interface (SPI) examples demonstrating ecommerce integrations including additional fees, discount triggers, shipping rates, validations, and gift card providers",
|
|
117621
117583
|
files: {
|
|
117622
|
-
[types.APIExtension]: [],
|
|
117623
117584
|
[types.DashboardPage]: ["spis-examples/src/dashboard/pages/page.tsx"],
|
|
117624
|
-
[types.EmbeddedScript]: [],
|
|
117625
117585
|
[types.ServicePluginExtension]: [
|
|
117626
117586
|
"spis-examples/src/backend/service-plugins/ecom-additional-fees/additional-fees/plugin.ts",
|
|
117627
117587
|
"spis-examples/src/backend/service-plugins/ecom-discounts-trigger/discount-triggers/plugin.ts",
|
|
117628
117588
|
"spis-examples/src/backend/service-plugins/ecom-shipping-rates/shipping-rates/plugin.ts",
|
|
117629
117589
|
"spis-examples/src/backend/service-plugins/ecom-validations/validations/plugin.ts",
|
|
117630
117590
|
"spis-examples/src/backend/service-plugins/gift-cards-provider/gift-cards/plugin.ts"
|
|
117631
|
-
]
|
|
117632
|
-
[types.CustomElementPlugin]: [],
|
|
117633
|
-
[types.CustomElementWidget]: []
|
|
117591
|
+
]
|
|
117634
117592
|
}
|
|
117635
117593
|
},
|
|
117636
117594
|
TopBlogPosts: {
|
|
117637
117595
|
path: "top-blog-posts",
|
|
117638
117596
|
description: "A dashboard analytics app that displays statistics about the most viewed and most liked blog posts on a website with navigation to blog management",
|
|
117639
117597
|
files: {
|
|
117640
|
-
[types.APIExtension]: [],
|
|
117641
117598
|
[types.DashboardPage]: [
|
|
117642
117599
|
"top-blog-posts/src/dashboard/pages/page.tsx",
|
|
117643
117600
|
"top-blog-posts/src/dashboard/pages/blog-utils.ts"
|
|
117644
|
-
]
|
|
117645
|
-
[types.EmbeddedScript]: [],
|
|
117646
|
-
[types.ServicePluginExtension]: [],
|
|
117647
|
-
[types.CustomElementPlugin]: [],
|
|
117648
|
-
[types.CustomElementWidget]: []
|
|
117601
|
+
]
|
|
117649
117602
|
}
|
|
117650
117603
|
},
|
|
117651
117604
|
SurveyManager: {
|
|
117652
117605
|
path: "survey-manager",
|
|
117653
117606
|
description: "A dashboard app that allows administrators to create and manage rating (1-5) survey questions and view aggregated results",
|
|
117654
117607
|
files: {
|
|
117655
|
-
[types.
|
|
117656
|
-
[types.DashboardPage]: ["survey-manager/src/dashboard/pages/page.tsx"],
|
|
117657
|
-
[types.EmbeddedScript]: [],
|
|
117658
|
-
[types.ServicePluginExtension]: [],
|
|
117659
|
-
[types.CustomElementPlugin]: [],
|
|
117660
|
-
[types.CustomElementWidget]: []
|
|
117608
|
+
[types.DashboardPage]: ["survey-manager/src/dashboard/pages/page.tsx"]
|
|
117661
117609
|
}
|
|
117662
117610
|
}
|
|
117663
117611
|
};
|
|
@@ -117679,7 +117627,7 @@ var require_load_examples = __commonJS({
|
|
|
117679
117627
|
],
|
|
117680
117628
|
[types.ServicePluginExtension]: [appsExamples.SPISExample],
|
|
117681
117629
|
[types.CustomElementPlugin]: [appsExamples.InventoryCountdown],
|
|
117682
|
-
[types.CustomElementWidget]: [appsExamples.
|
|
117630
|
+
[types.CustomElementWidget]: [appsExamples.CustomElementWidget]
|
|
117683
117631
|
};
|
|
117684
117632
|
var loadExamples = (pluginTypes) => {
|
|
117685
117633
|
const examplesAppsBasePath = path_1.default.join(__dirname, "examples-apps");
|
|
@@ -122710,6 +122658,7 @@ Given the full chat history, current user request, blueprint, and all project fi
|
|
|
122710
122658
|
|
|
122711
122659
|
<site_component>
|
|
122712
122660
|
**Use when:**
|
|
122661
|
+
- Only when the user explicitly requests to use React
|
|
122713
122662
|
- User wants to create a custom UI component for the site frontend
|
|
122714
122663
|
- Need to build interactive widgets, forms, or display components for visitors
|
|
122715
122664
|
- Creating custom elements that appear on the site (not admin interfaces)
|
|
@@ -122717,6 +122666,17 @@ Given the full chat history, current user request, blueprint, and all project fi
|
|
|
122717
122666
|
- Example: 'Create a product showcase widget', 'Add a contact form component', 'Build a testimonial slider'
|
|
122718
122667
|
</site_component>
|
|
122719
122668
|
|
|
122669
|
+
<site_widget>
|
|
122670
|
+
**Use when:**
|
|
122671
|
+
- also called custom element
|
|
122672
|
+
- Only when the user does not explicitly requests to use React
|
|
122673
|
+
- User wants to create a custom UI component for the site frontend
|
|
122674
|
+
- Need to build interactive widgets, forms, or display components for visitors
|
|
122675
|
+
- Creating custom elements that appear on the site (not admin interfaces)
|
|
122676
|
+
- Building components that integrate with site data or user interactions
|
|
122677
|
+
- Example: 'Create a product showcase widget', 'Add a contact form component', 'Build a testimonial slider'
|
|
122678
|
+
</site_widget>
|
|
122679
|
+
|
|
122720
122680
|
<service_plugin>
|
|
122721
122681
|
**Use when:**
|
|
122722
122682
|
- User needs custom business logic for eCommerce (fees, shipping, discounts, validations)
|
|
@@ -122757,7 +122717,7 @@ Given the full chat history, current user request, blueprint, and all project fi
|
|
|
122757
122717
|
|
|
122758
122718
|
<selection_rules>
|
|
122759
122719
|
1. **For UI/Admin interfaces**: Use DASHBOARD_PAGE
|
|
122760
|
-
2. **For site frontend components**: Use SITE_COMPONENT
|
|
122720
|
+
2. **For site frontend components**: Use SITE_COMPONENT or SITE_WIDGET
|
|
122761
122721
|
3. **For eCommerce business logic**: Use SERVICE_PLUGIN
|
|
122762
122722
|
4. **For management interfaces**: Use DASHBOARD_PAGE
|
|
122763
122723
|
5. **For eCommerce features**: Combine SERVICE_PLUGIN (logic) + DASHBOARD_PAGE (configuration UI)
|
|
@@ -122767,7 +122727,7 @@ Given the full chat history, current user request, blueprint, and all project fi
|
|
|
122767
122727
|
<common_patterns>
|
|
122768
122728
|
- **eCommerce Extensions**: SERVICE_PLUGIN + DASHBOARD_PAGE
|
|
122769
122729
|
- **Configuration/Settings Apps**: DASHBOARD_PAGE only
|
|
122770
|
-
- **Site Frontend Features**: SITE_COMPONENT only
|
|
122730
|
+
- **Site Frontend Features**: SITE_COMPONENT or SITE_WIDGET only
|
|
122771
122731
|
- **Full-Featured Apps**: SITE_COMPONENT + SERVICE_PLUGIN + DASHBOARD_PAGE
|
|
122772
122732
|
</common_patterns>
|
|
122773
122733
|
|
|
@@ -122779,7 +122739,7 @@ Given the full chat history, current user request, blueprint, and all project fi
|
|
|
122779
122739
|
- Be specific about which file paths are relevant for each current extension (all extension types)
|
|
122780
122740
|
- Consider the full chat history context when making decisions
|
|
122781
122741
|
- Prioritize reusing existing extensions over creating new ones
|
|
122782
|
-
- **SUPPORTED EXTENSION TYPES ONLY**: DASHBOARD_PAGE, SERVICE_PLUGIN, and
|
|
122742
|
+
- **SUPPORTED EXTENSION TYPES ONLY**: DASHBOARD_PAGE, SERVICE_PLUGIN, SITE_COMPONENT, and SITE_WIDGET
|
|
122783
122743
|
- **IMPORTANT**: The "type" field is ONLY for SERVICE_PLUGIN extensions - specify the SPI type
|
|
122784
122744
|
- The "paths" field is for ALL extension types - specify relevant file paths to modify
|
|
122785
122745
|
- Choose SPI types based on the specific eCommerce functionality requested (shipping, fees, validation, etc.)
|
|
@@ -122817,6 +122777,12 @@ The response must be a valid JSON object matching the IterationPlanSchema:
|
|
|
122817
122777
|
"name": "Product Showcase Widget",
|
|
122818
122778
|
"paths": ["src/site/components/ProductShowcase/component.tsx"],
|
|
122819
122779
|
"relevantUserRequest": "Create a product showcase widget for the site frontend"
|
|
122780
|
+
},
|
|
122781
|
+
{
|
|
122782
|
+
"extensionType": "SITE_WIDGET",
|
|
122783
|
+
"name": "Product Showcase Widget",
|
|
122784
|
+
"paths": ["src/site/widgets/custom-elements/product-showcase/widget.tsx"],
|
|
122785
|
+
"relevantUserRequest": "Create a product showcase widget for the site frontend"
|
|
122820
122786
|
}
|
|
122821
122787
|
],
|
|
122822
122788
|
"additionalExtensions": [
|
|
@@ -122831,8 +122797,8 @@ The response must be a valid JSON object matching the IterationPlanSchema:
|
|
|
122831
122797
|
}
|
|
122832
122798
|
|
|
122833
122799
|
**Key Points:**
|
|
122834
|
-
- currentExtensions: Existing extensions that need to be MODIFIED (use extensionType of "SERVICE_PLUGIN", "DASHBOARD_PAGE", or "
|
|
122835
|
-
- additionalExtensions: New extensions that need to be CREATED (use extensionType of "SERVICE_PLUGIN", "DASHBOARD_PAGE", or "
|
|
122800
|
+
- currentExtensions: Existing extensions that need to be MODIFIED (use extensionType of "SERVICE_PLUGIN", "DASHBOARD_PAGE", "SITE_COMPONENT", or "SITE_WIDGET")
|
|
122801
|
+
- additionalExtensions: New extensions that need to be CREATED (use extensionType of "SERVICE_PLUGIN", "DASHBOARD_PAGE", "SITE_COMPONENT", or "SITE_WIDGET")
|
|
122836
122802
|
- summary: Brief summary combining the chat history and current user request
|
|
122837
122803
|
- "name" field: REQUIRED for ALL extensions - provide a descriptive name for the extension
|
|
122838
122804
|
- "relatedSpis" field: ONLY for SERVICE_PLUGIN extensions - specify the SPI name
|
|
@@ -122892,6 +122858,8 @@ var require_IterationAgent = __commonJS({
|
|
|
122892
122858
|
return types_1.ExtensionType.DASHBOARD_PAGE;
|
|
122893
122859
|
case "SITE_COMPONENT":
|
|
122894
122860
|
return types_1.ExtensionType.SITE_COMPONENT;
|
|
122861
|
+
case "SITE_WIDGET":
|
|
122862
|
+
return types_1.ExtensionType.SITE_WIDGET;
|
|
122895
122863
|
default:
|
|
122896
122864
|
throw new Error(`Unsupported extension type: ${extensionType}`);
|
|
122897
122865
|
}
|
|
@@ -122958,6 +122926,152 @@ ${allFilesContent}`
|
|
|
122958
122926
|
}
|
|
122959
122927
|
});
|
|
122960
122928
|
|
|
122929
|
+
// dist/system-prompts/site/customElementPrompt.js
|
|
122930
|
+
var require_customElementPrompt = __commonJS({
|
|
122931
|
+
"dist/system-prompts/site/customElementPrompt.js"(exports2) {
|
|
122932
|
+
"use strict";
|
|
122933
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
122934
|
+
exports2.customElementPrompt = void 0;
|
|
122935
|
+
var customElementPrompt = async () => {
|
|
122936
|
+
return `
|
|
122937
|
+
<WIXCLI_CUSTOM_ELEMENT_SYSTEM_PROMPT>
|
|
122938
|
+
<role>
|
|
122939
|
+
You are a senior Wix CLI App Developer and React expert. Your job is to produce a beautiful, production\u2011quality site component quickly and correctly.
|
|
122940
|
+
</role>
|
|
122941
|
+
|
|
122942
|
+
<rules>
|
|
122943
|
+
- Return ONLY a JSON object matching the schema { path, content, type } (no prose, no markdown)
|
|
122944
|
+
- type must be "typescript"; content must be the COMPLETE file source
|
|
122945
|
+
- Do NOT add dependencies; do NOT use @wix/design-system or @wix/wix-ui-icons-common
|
|
122946
|
+
- Do NOT invent types/modules/props; use only what exists in the scaffold and standard libs
|
|
122947
|
+
</rules>
|
|
122948
|
+
|
|
122949
|
+
<style_guidelines>
|
|
122950
|
+
- Prefer simple, elegant UI using inline styles (no CSS imports)
|
|
122951
|
+
- Use semantic HTML and accessible patterns (aria-*, roles, focus styles)
|
|
122952
|
+
- Favor flex layouts, spacing, readable typography; avoid visual clutter
|
|
122953
|
+
- Keep responsiveness lightweight (flex/wrap/percentages); avoid heavy logic
|
|
122954
|
+
</style_guidelines>
|
|
122955
|
+
|
|
122956
|
+
<engineering_guidelines>
|
|
122957
|
+
- Implement a functional React + TypeScript component with a typed Props interface
|
|
122958
|
+
- Keep the component small, pure, and readable; remove dead code/unused imports
|
|
122959
|
+
- Use React hooks where needed; avoid unnecessary re-renders
|
|
122960
|
+
- Name things clearly; avoid magic numbers; extract tiny helpers if it improves clarity
|
|
122961
|
+
</engineering_guidelines>
|
|
122962
|
+
|
|
122963
|
+
<typescript_quality_guidelines>
|
|
122964
|
+
- Generated code MUST compile with zero TypeScript errors under strict settings:
|
|
122965
|
+
strict, noImplicitAny, strictNullChecks, exactOptionalPropertyTypes, noUncheckedIndexedAccess
|
|
122966
|
+
- Prefer type-narrowing and exhaustive logic over assertions; avoid non-null assertions (!) and unsafe casts (as any)
|
|
122967
|
+
- Treat optional values, refs, and array indexing results as possibly undefined and handle them explicitly
|
|
122968
|
+
- Use exhaustive checks for unions (e.g., switch with a never check) and return total values (no implicit undefined)
|
|
122969
|
+
- Do NOT use // @ts-ignore or // @ts-expect-error; fix the types or add guards instead
|
|
122970
|
+
</typescript_quality_guidelines>
|
|
122971
|
+
|
|
122972
|
+
</WIXCLI_CUSTOM_ELEMENT_SYSTEM_PROMPT>
|
|
122973
|
+
`;
|
|
122974
|
+
};
|
|
122975
|
+
exports2.customElementPrompt = customElementPrompt;
|
|
122976
|
+
}
|
|
122977
|
+
});
|
|
122978
|
+
|
|
122979
|
+
// dist/agents/CustomElementAgent.js
|
|
122980
|
+
var require_CustomElementAgent = __commonJS({
|
|
122981
|
+
"dist/agents/CustomElementAgent.js"(exports2) {
|
|
122982
|
+
"use strict";
|
|
122983
|
+
var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
122984
|
+
if (k2 === void 0) k2 = k;
|
|
122985
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
122986
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
122987
|
+
desc = { enumerable: true, get: function() {
|
|
122988
|
+
return m[k];
|
|
122989
|
+
} };
|
|
122990
|
+
}
|
|
122991
|
+
Object.defineProperty(o, k2, desc);
|
|
122992
|
+
}) : (function(o, m, k, k2) {
|
|
122993
|
+
if (k2 === void 0) k2 = k;
|
|
122994
|
+
o[k2] = m[k];
|
|
122995
|
+
}));
|
|
122996
|
+
var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
122997
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
122998
|
+
}) : function(o, v) {
|
|
122999
|
+
o["default"] = v;
|
|
123000
|
+
});
|
|
123001
|
+
var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
|
|
123002
|
+
var ownKeys2 = function(o) {
|
|
123003
|
+
ownKeys2 = Object.getOwnPropertyNames || function(o2) {
|
|
123004
|
+
var ar = [];
|
|
123005
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
123006
|
+
return ar;
|
|
123007
|
+
};
|
|
123008
|
+
return ownKeys2(o);
|
|
123009
|
+
};
|
|
123010
|
+
return function(mod2) {
|
|
123011
|
+
if (mod2 && mod2.__esModule) return mod2;
|
|
123012
|
+
var result = {};
|
|
123013
|
+
if (mod2 != null) {
|
|
123014
|
+
for (var k = ownKeys2(mod2), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod2, k[i]);
|
|
123015
|
+
}
|
|
123016
|
+
__setModuleDefault2(result, mod2);
|
|
123017
|
+
return result;
|
|
123018
|
+
};
|
|
123019
|
+
})();
|
|
123020
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
123021
|
+
exports2.CustomElementAgent = void 0;
|
|
123022
|
+
var anthropic_1 = require_dist5();
|
|
123023
|
+
var ai_1 = require_dist7();
|
|
123024
|
+
var utils_1 = require_utils14();
|
|
123025
|
+
var customElementPrompt_1 = require_customElementPrompt();
|
|
123026
|
+
var load_examples_1 = __importStar2(require_load_examples());
|
|
123027
|
+
var CustomElementAgent = class {
|
|
123028
|
+
constructor(apiKey) {
|
|
123029
|
+
this.apiKey = apiKey;
|
|
123030
|
+
this.name = "CustomElementAgent";
|
|
123031
|
+
}
|
|
123032
|
+
async buildSystemPrompt() {
|
|
123033
|
+
return (0, customElementPrompt_1.customElementPrompt)();
|
|
123034
|
+
}
|
|
123035
|
+
async generate(params) {
|
|
123036
|
+
const { blueprint } = params;
|
|
123037
|
+
const examples = (0, load_examples_1.default)([load_examples_1.types.CustomElementWidget]);
|
|
123038
|
+
const systemPrompt = `${await this.buildSystemPrompt()}
|
|
123039
|
+
${examples}
|
|
123040
|
+
`;
|
|
123041
|
+
const appName = blueprint?.appName ? `'${blueprint.appName}'` : "";
|
|
123042
|
+
const primaryAction = `Customize the Wix CLI custom element / site widget scaffolding for the app ${appName}`;
|
|
123043
|
+
const userMessage = (0, utils_1.buildUserPromptForCodeGenerationAgent)(params, primaryAction);
|
|
123044
|
+
const model = (0, anthropic_1.createAnthropic)({ apiKey: this.apiKey })("claude-sonnet-4-20250514");
|
|
123045
|
+
const result = await (0, ai_1.generateObject)({
|
|
123046
|
+
model,
|
|
123047
|
+
schema: utils_1.FileSchema,
|
|
123048
|
+
messages: [
|
|
123049
|
+
{
|
|
123050
|
+
role: "system",
|
|
123051
|
+
content: systemPrompt,
|
|
123052
|
+
providerOptions: (0, utils_1.withCaching)("1h")
|
|
123053
|
+
},
|
|
123054
|
+
{
|
|
123055
|
+
role: "user",
|
|
123056
|
+
content: userMessage
|
|
123057
|
+
}
|
|
123058
|
+
],
|
|
123059
|
+
experimental_telemetry: {
|
|
123060
|
+
isEnabled: true,
|
|
123061
|
+
functionId: this.name
|
|
123062
|
+
},
|
|
123063
|
+
maxOutputTokens: 1e4,
|
|
123064
|
+
maxRetries: 3,
|
|
123065
|
+
temperature: 0
|
|
123066
|
+
});
|
|
123067
|
+
return result.object.files;
|
|
123068
|
+
}
|
|
123069
|
+
};
|
|
123070
|
+
exports2.CustomElementAgent = CustomElementAgent;
|
|
123071
|
+
exports2.default = CustomElementAgent;
|
|
123072
|
+
}
|
|
123073
|
+
});
|
|
123074
|
+
|
|
122961
123075
|
// dist/agents/AgentsFactory.js
|
|
122962
123076
|
var require_AgentsFactory = __commonJS({
|
|
122963
123077
|
"dist/agents/AgentsFactory.js"(exports2) {
|
|
@@ -122975,6 +123089,7 @@ var require_AgentsFactory = __commonJS({
|
|
|
122975
123089
|
var CMSDataAgent_1 = require_CMSDataAgent();
|
|
122976
123090
|
var SiteComponentAgent_1 = __importDefault2(require_SiteComponentAgent());
|
|
122977
123091
|
var IterationAgent_1 = __importDefault2(require_IterationAgent());
|
|
123092
|
+
var CustomElementAgent_1 = __importDefault2(require_CustomElementAgent());
|
|
122978
123093
|
var AgentsFactory = class {
|
|
122979
123094
|
constructor(apiKey) {
|
|
122980
123095
|
this.apiKey = apiKey;
|
|
@@ -122995,6 +123110,8 @@ var require_AgentsFactory = __commonJS({
|
|
|
122995
123110
|
return new IterationAgent_1.default(this.apiKey);
|
|
122996
123111
|
case types_1.ExtensionType.SITE_COMPONENT:
|
|
122997
123112
|
return new SiteComponentAgent_1.default(this.apiKey);
|
|
123113
|
+
case types_1.ExtensionType.SITE_WIDGET:
|
|
123114
|
+
return new CustomElementAgent_1.default(this.apiKey);
|
|
122998
123115
|
default:
|
|
122999
123116
|
throw new Error(`Unsupported extension type for AI customization: ${extension.type}`);
|
|
123000
123117
|
}
|
|
@@ -123193,7 +123310,7 @@ var require_scaffolding = __commonJS({
|
|
|
123193
123310
|
case types_1.ExtensionType.DASHBOARD_MODAL:
|
|
123194
123311
|
return copyDashboardModalScaffolding(extension, outputPath);
|
|
123195
123312
|
case types_1.ExtensionType.SITE_WIDGET:
|
|
123196
|
-
return
|
|
123313
|
+
return copyCustomElementScaffolding(extension, outputPath);
|
|
123197
123314
|
case types_1.ExtensionType.EMBEDDED_SCRIPT:
|
|
123198
123315
|
return copyEmbeddedScriptScaffolding(extension, outputPath);
|
|
123199
123316
|
case types_1.ExtensionType.BACKEND_API:
|
|
@@ -123248,7 +123365,7 @@ var require_scaffolding = __commonJS({
|
|
|
123248
123365
|
console.log(` \u{1F532} Copying dashboard modal scaffolding from: ${scaffoldingSubPath} to ${outputFolder}`);
|
|
123249
123366
|
return (0, tools_1.copyScaffolding)(scaffoldingSubPath, outputPath, outputFolder);
|
|
123250
123367
|
}
|
|
123251
|
-
async function
|
|
123368
|
+
async function copyCustomElementScaffolding(extension, outputPath) {
|
|
123252
123369
|
const scaffoldingSubPath = "src/site/widgets/custom-elements/my-widget";
|
|
123253
123370
|
const uniqueFolderName = toKebabCase(extension.name || "my-widget");
|
|
123254
123371
|
const outputFolder = `src/site/widgets/custom-elements/${uniqueFolderName}`;
|
|
@@ -125846,6 +125963,20 @@ var require_extensionGenerators = __commonJS({
|
|
|
125846
125963
|
component
|
|
125847
125964
|
};
|
|
125848
125965
|
}
|
|
125966
|
+
static createCustomElementData(ext, scaffoldDir) {
|
|
125967
|
+
const componentName = ext.name ?? "custom-element";
|
|
125968
|
+
const kebabCaseComponentName = (0, ditto_scaffolding_2.toKebabCase)(componentName);
|
|
125969
|
+
const componentPath = "./" + path_1.default.join(scaffoldDir, "widget.tsx").replace(/^src\//, "");
|
|
125970
|
+
return {
|
|
125971
|
+
tagName: "custom-element",
|
|
125972
|
+
element: componentPath,
|
|
125973
|
+
installation: { base: { autoAdd: true } },
|
|
125974
|
+
base: { name: kebabCaseComponentName },
|
|
125975
|
+
behaviors: {},
|
|
125976
|
+
dependencies: [],
|
|
125977
|
+
size: { height: { defaultHeight: 500 }, width: { defaultWidth: 500 } }
|
|
125978
|
+
};
|
|
125979
|
+
}
|
|
125849
125980
|
static createSiteComponentData(ext, scaffoldDir, id) {
|
|
125850
125981
|
const componentName = ext.name ?? "my-component";
|
|
125851
125982
|
const kebabCaseComponentName = (0, ditto_scaffolding_2.toKebabCase)(componentName);
|
|
@@ -125882,6 +126013,11 @@ var require_extensionGenerators = __commonJS({
|
|
|
125882
126013
|
builderMethod: "siteComponent",
|
|
125883
126014
|
defaultName: "my-component",
|
|
125884
126015
|
createExtensionData: _a2.createSiteComponentData.bind(_a2)
|
|
126016
|
+
},
|
|
126017
|
+
[types_1.ExtensionType.SITE_WIDGET]: {
|
|
126018
|
+
builderMethod: "customElement",
|
|
126019
|
+
defaultName: "my-custom-element",
|
|
126020
|
+
createExtensionData: _a2.createCustomElementData.bind(_a2)
|
|
125885
126021
|
}
|
|
125886
126022
|
};
|
|
125887
126023
|
ExtensionFactory.servicePluginBuilderMap = {
|
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.41",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@wix/ditto-codegen": "1.0.0",
|
|
25
25
|
"esbuild": "^0.25.9"
|
|
26
26
|
},
|
|
27
|
-
"falconPackageHash": "
|
|
27
|
+
"falconPackageHash": "0069e609e9e75fcd22fbc0c90a8243c34e49285ca4a4a8c58939a77d"
|
|
28
28
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
22.10.0
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# chart-widget
|
|
2
|
-
|
|
3
|
-
This project was bootstrapped with [Create Wix App](https://www.npmjs.com/package/@wix/create-app).
|
|
4
|
-
Read more about it in the [Wix CLI for Apps
|
|
5
|
-
documentation](https://dev.wix.com/docs/build-apps/developer-tools/cli/get-started/about-the-wix-cli-for-apps).
|
|
6
|
-
|
|
7
|
-
## Setup 🔧
|
|
8
|
-
|
|
9
|
-
##### Install dependencies:
|
|
10
|
-
|
|
11
|
-
```console
|
|
12
|
-
npm install
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Available Scripts
|
|
16
|
-
|
|
17
|
-
In the project directory, you can run:
|
|
18
|
-
|
|
19
|
-
```console
|
|
20
|
-
npm run dev
|
|
21
|
-
```
|
|
Binary file
|