@wix/ditto-codegen-public 1.0.17 → 1.0.19

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 (2) hide show
  1. package/dist/out.js +311 -16
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -115231,12 +115231,196 @@ dashboard.onBeforeUnload(() => {
115231
115231
  }
115232
115232
  });
115233
115233
 
115234
+ // dist/system-prompts/dashboardPage/buttonAndModalExamples.js
115235
+ var require_buttonAndModalExamples = __commonJS({
115236
+ "dist/system-prompts/dashboardPage/buttonAndModalExamples.js"(exports2) {
115237
+ "use strict";
115238
+ Object.defineProperty(exports2, "__esModule", { value: true });
115239
+ exports2.buttonAndModalExamples = void 0;
115240
+ exports2.buttonAndModalExamples = `
115241
+ ## Dashboard UI Components - Buttons and Modals Examples
115242
+
115243
+ ### Essential Imports for Dashboard Components
115244
+
115245
+ \`\`\`typescript
115246
+ import React, { type FC, useState, useEffect } from 'react';
115247
+ import { dashboard } from '@wix/dashboard';
115248
+ import {
115249
+ Button,
115250
+ Page,
115251
+ WixDesignSystemProvider,
115252
+ Tabs,
115253
+ Card,
115254
+ Table,
115255
+ TableActionCell,
115256
+ TableToolbar,
115257
+ Modal,
115258
+ CustomModalLayout,
115259
+ FormField,
115260
+ Input,
115261
+ ToggleSwitch,
115262
+ Layout,
115263
+ Cell,
115264
+ Badge,
115265
+ Box,
115266
+ Text,
115267
+ } from '@wix/design-system';
115268
+ import '@wix/design-system/styles.global.css';
115269
+ import * as Icons from '@wix/wix-ui-icons-common';
115270
+ import { items } from "@wix/data";
115271
+ \`\`\`
115272
+
115273
+ ### Button Examples
115274
+
115275
+ #### Primary Action Buttons
115276
+ \`\`\`typescript
115277
+ // Add/Create button with icon
115278
+ <Button
115279
+ size="small"
115280
+ prefixIcon={<Icons.Add />}
115281
+ onClick={() => openModal('item')}
115282
+ >
115283
+ Add Item
115284
+ </Button>
115285
+
115286
+ // Save button (primary)
115287
+ <Button
115288
+ priority="primary"
115289
+ onClick={handleSave}
115290
+ disabled={loading}
115291
+ >
115292
+ {loading ? 'Saving...' : 'Save'}
115293
+ </Button>
115294
+ \`\`\`
115295
+
115296
+ #### Table Action Buttons
115297
+ \`\`\`typescript
115298
+ const columns = [
115299
+ { title: 'Name', render: (row: YourType) => row.name },
115300
+ {
115301
+ render: (row: YourType) => (
115302
+ <TableActionCell
115303
+ primaryAction={{
115304
+ text: 'Edit',
115305
+ onClick: () => openModal('item', row)
115306
+ }}
115307
+ secondaryActions={[
115308
+ {
115309
+ text: 'Delete',
115310
+ icon: <Icons.DeleteSmall />,
115311
+ onClick: () => handleDelete(row._id!)
115312
+ }
115313
+ ]}
115314
+ />
115315
+ )
115316
+ }
115317
+ ];
115318
+ \`\`\`
115319
+
115320
+ ### Modal Examples
115321
+
115322
+ #### State Management for Modals
115323
+ \`\`\`typescript
115324
+ const [isModalOpen, setIsModalOpen] = useState(false);
115325
+ const [modalType, setModalType] = useState<'item'>('item');
115326
+ const [editingItem, setEditingItem] = useState<YourType | null>(null);
115327
+ const [formData, setFormData] = useState<any>({});
115328
+
115329
+ const openModal = (type: 'item', item?: YourType) => {
115330
+ setModalType(type);
115331
+ setEditingItem(item || null);
115332
+
115333
+ // Initialize form data based on editing or creating
115334
+ if (item) {
115335
+ setFormData({
115336
+ name: item.name,
115337
+ description: item.description,
115338
+ isActive: item.isActive,
115339
+ // ... other fields
115340
+ });
115341
+ } else {
115342
+ setFormData({
115343
+ name: '',
115344
+ description: '',
115345
+ isActive: true,
115346
+ // ... default values
115347
+ });
115348
+ }
115349
+
115350
+ setIsModalOpen(true);
115351
+ };
115352
+
115353
+ const closeModal = () => {
115354
+ setIsModalOpen(false);
115355
+ setEditingItem(null);
115356
+ setFormData({});
115357
+ };
115358
+ \`\`\`
115359
+
115360
+ #### Basic Modal with Form
115361
+ \`\`\`typescript
115362
+ <Modal isOpen={isModalOpen} onRequestClose={closeModal}>
115363
+ <CustomModalLayout
115364
+ primaryButtonText="Save"
115365
+ secondaryButtonText="Cancel"
115366
+ onCloseButtonClick={closeModal}
115367
+ primaryButtonOnClick={handleSave}
115368
+ secondaryButtonOnClick={closeModal}
115369
+ title={\`\${editingItem ? 'Edit' : 'Add'} Item\`}
115370
+ content={
115371
+ <Layout gap="24px">
115372
+ <Cell span={12}>
115373
+ <FormField label="Name">
115374
+ <Input
115375
+ value={formData.name || ''}
115376
+ onChange={(e) => setFormData({ ...formData, name: e.target.value })}
115377
+ placeholder="Enter item name"
115378
+ />
115379
+ </FormField>
115380
+ </Cell>
115381
+ <Cell span={12}>
115382
+ <FormField label="Description">
115383
+ <Input
115384
+ value={formData.description || ''}
115385
+ onChange={(e) => setFormData({ ...formData, description: e.target.value })}
115386
+ placeholder="Enter description"
115387
+ />
115388
+ </FormField>
115389
+ </Cell>
115390
+ <Cell span={6}>
115391
+ <FormField label="Price">
115392
+ <Input
115393
+ type="number"
115394
+ value={formData.price || ''}
115395
+ onChange={(e) => setFormData({ ...formData, price: Number(e.target.value) })}
115396
+ placeholder="0.00"
115397
+ />
115398
+ </FormField>
115399
+ </Cell>
115400
+ <Cell span={6}>
115401
+ <FormField label="Active" labelPlacement="right" stretchContent={false}>
115402
+ <ToggleSwitch
115403
+ checked={formData.isActive || false}
115404
+ onChange={() => setFormData({ ...formData, isActive: !formData.isActive })}
115405
+ />
115406
+ </FormField>
115407
+ </Cell>
115408
+ </Layout>
115409
+ }
115410
+ />
115411
+ </Modal>
115412
+ \`\`\`
115413
+ `;
115414
+ }
115415
+ });
115416
+
115234
115417
  // dist/system-prompts/dashboardPage/wdsPackage.js
115235
115418
  var require_wdsPackage = __commonJS({
115236
115419
  "dist/system-prompts/dashboardPage/wdsPackage.js"(exports2) {
115237
115420
  "use strict";
115238
115421
  Object.defineProperty(exports2, "__esModule", { value: true });
115239
115422
  exports2.buildWdsSystemPrompt = buildWdsSystemPrompt;
115423
+ var buttonAndModalExamples_1 = require_buttonAndModalExamples();
115240
115424
  var STORIES_URL = "https://mykolass.wixsite.com/storybook-builder/_functions/getStoriesList?production=true&library=wix-style-react";
115241
115425
  function normalize(text) {
115242
115426
  return (text || "").toLowerCase();
@@ -115289,6 +115473,9 @@ ${exampleLines}
115289
115473
  <wds_reference>
115290
115474
  <source>Wix Design System \u2014 filtered components</source>
115291
115475
  ${blocks}
115476
+
115477
+ ${buttonAndModalExamples_1.buttonAndModalExamples}
115478
+
115292
115479
  </wds_reference>`;
115293
115480
  }
115294
115481
  }
@@ -115305,23 +115492,123 @@ var require_data = __commonJS({
115305
115492
  - Read: items.query('Collection').filter/sort.limit.find() \u2192 { items, totalCount, hasNext }
115306
115493
  - Write: items.insert | update | remove. Ensure collection permissions allow the action
115307
115494
 
115495
+ WixDataItem Interface:
115496
+ The WixDataItem is the base interface for all data items in Wix Data collections. It includes:
115497
+ - [key: string]: any - Additional custom fields defined in your collection schema
115498
+
115308
115499
  Access data using the collection schema:
115309
115500
  - Always use the exact field keys you defined in the collection schema.
115310
115501
  - YOU MUST use the collection id exactly as you defined it in the collection schema.
115502
+ - YOU MUST use the collection schema's exact field types for all operations (query, insert, update, remove)
115503
+ - All custom fields are stored in the [key: string]: any part of the WixDataItem interface
115311
115504
 
115312
115505
  Example - Insert / Update / Delete (if permissions allow):
115313
- import { items } from '@wix/data';
115314
115506
 
115315
- async function addItem(collectionId: string, itemData: WixDataItem) {
115316
- return items.insert(collectionId, itemData);
115507
+ import { items } from "@wix/data";
115508
+
115509
+ export type WixDataItem = items.WixDataItem;
115510
+
115511
+ /**
115512
+ * Creates a new item in the collection
115513
+ * @param collectionId - ID of the collection
115514
+ * @param itemData - Data for the new item
115515
+ * @returns Promise<T> - The created item
115516
+ */
115517
+ async function createItem<T extends WixDataItem>(collectionId: string, itemData: T): Promise<T> {
115518
+ try {
115519
+ const result = await items.insert(collectionId, itemData);
115520
+ return result as T;
115521
+ } catch (error) {
115522
+ console.error(\`Error creating \${collectionId}:\`, error);
115523
+ throw new Error(
115524
+ error instanceof Error ? error.message : \`Failed to create \${collectionId}\`
115525
+ );
115526
+ }
115317
115527
  }
115318
115528
 
115319
- async function renameItem(collectionId: string, itemData: WixDataItem) {
115320
- await items.update(collectionId, itemData);
115529
+ /**
115530
+ * Retrieves all items from the collection
115531
+ * @param collectionId - ID of the collection
115532
+ * @returns Promise<items.WixDataResult<T>> - Query result with all items
115533
+ */
115534
+ async function getAllItems<T extends WixDataItem>(collectionId: string): Promise<items.WixDataResult<T>> {
115535
+ try {
115536
+ const result = await items.query(collectionId).find();
115537
+ return result as items.WixDataResult<T>;
115538
+ } catch (error) {
115539
+ console.error(\`Error fetching \${collectionId}s:\`, error);
115540
+ throw new Error(
115541
+ error instanceof Error ? error.message : \`Failed to fetch \${collectionId}s\`
115542
+ );
115543
+ }
115544
+ }
115545
+
115546
+ /**
115547
+ * Retrieves a single item by ID
115548
+ * @param collectionId - ID of the collection
115549
+ * @param itemId - ID of the item to retrieve
115550
+ * @returns Promise<T | null> - The item or null if not found
115551
+ */
115552
+ async function getItemById<T extends WixDataItem>(collectionId: string, itemId: string): Promise<T | null> {
115553
+ try {
115554
+ const result = await items.query(collectionId)
115555
+ .eq("_id", itemId)
115556
+ .find();
115557
+
115558
+ if (result.items.length > 0) {
115559
+ return result.items[0] as T;
115560
+ }
115561
+ return null;
115562
+ } catch (error) {
115563
+ console.error(\`Error fetching \${collectionId} by ID:\`, error);
115564
+ throw new Error(
115565
+ error instanceof Error ? error.message : \`Failed to fetch \${collectionId}\`
115566
+ );
115567
+ }
115568
+ }
115569
+
115570
+ /**
115571
+ * Updates an existing item
115572
+ * @param collectionId - ID of the collection
115573
+ * @param itemData - Updated item data (must include _id)
115574
+ * @returns Promise<T> - The updated item
115575
+ */
115576
+ async function updateItem<T extends WixDataItem>(collectionId: string, itemData: T): Promise<T> {
115577
+ try {
115578
+ if (!itemData._id) {
115579
+ throw new Error(\`\${collectionId} ID is required for update\`);
115580
+ }
115581
+
115582
+ const result = await items.update(collectionId, itemData);
115583
+ return result as T;
115584
+ } catch (error) {
115585
+ console.error(\`Error updating \${collectionId}:\`, error);
115586
+ throw new Error(
115587
+ error instanceof Error ? error.message : \`Failed to update \${collectionId}\`
115588
+ );
115589
+ }
115321
115590
  }
115322
115591
 
115323
- async function deleteItem(collectionId: string, itemId: WixDataItem) {
115324
- await items.remove(collectionId, itemId);
115592
+ /**
115593
+ * Deletes an item by ID
115594
+ * @param collectionId - ID of the collection
115595
+ * @param itemId - ID of the item to delete
115596
+ * @returns Promise<T> - The deleted item
115597
+ */
115598
+ async function deleteItem<T extends WixDataItem>(collectionId: string, itemId: string): Promise<T> {
115599
+ try {
115600
+ if (!itemId) {
115601
+ throw new Error(\`\${collectionId} ID is required for deletion\`);
115602
+ }
115603
+
115604
+ const result = await items.remove(collectionId, itemId);
115605
+ return result as T;
115606
+ } catch (error) {
115607
+ console.error(\`Error deleting \${collectionId}:\`, error);
115608
+ throw new Error(
115609
+ error instanceof Error ? error.message : \`Failed to delete \${collectionId}\`
115610
+ );
115611
+ }
115325
115612
  }
115326
115613
  </wix_data_docs>`;
115327
115614
  }
@@ -115360,6 +115647,7 @@ var require_dashboardPagePrompt = __commonJS({
115360
115647
  "SectionHeader",
115361
115648
  "Heading",
115362
115649
  "Modal",
115650
+ "Checkbox",
115363
115651
  "Table",
115364
115652
  "Badge",
115365
115653
  "ToggleSwitch",
@@ -115529,6 +115817,7 @@ Your output must be strictly JSON that conforms to the provided schema (no markd
115529
115817
  <constraints>
115530
115818
  - Collection must include: id, displayName, displayField (when appropriate), fields[], permissions, and plugins[].
115531
115819
  - Field definitions must use supported FieldType enums exactly as strings: TEXT, NUMBER, DATE, DATETIME, IMAGE, BOOLEAN, DOCUMENT, URL, RICH_TEXT, VIDEO, ANY, ARRAY_STRING, ARRAY_DOCUMENT, AUDIO, TIME, LANGUAGE, RICH_CONTENT, MEDIA_GALLERY, ADDRESS, PAGE_LINK, REFERENCE, MULTI_REFERENCE, OBJECT, ARRAY.
115820
+ - ALWAYS use REFERENCE fields when creating relationships between different CMS collections. ALL related fields must use REFERENCE type.
115532
115821
  - ALWAYS use REFERENCE fields when the blueprint indicates relationships to Stores entities (products, categories, orders). Use TEXT fields for all other relationships.
115533
115822
  - MANDATORY REFERENCE scenarios (you MUST use REFERENCE type):
115534
115823
  - productId, product \u2192 REFERENCE to "Stores/Products"
@@ -115541,8 +115830,9 @@ Your output must be strictly JSON that conforms to the provided schema (no markd
115541
115830
  - SITE_MEMBER_AUTHOR: Each member manages their own items.
115542
115831
  - SITE_MEMBER: Any logged-in member.
115543
115832
  - ANYONE: All site visitors, including anonymous.
115544
- - Choose minimal but meaningful fields that fit the blueprint\u2019s domain. Do not add system fields like _id, _createdDate, etc.; they are created automatically.
115833
+ - Choose minimal but meaningful fields that fit the blueprint's domain. Do not add system fields like _id, _createdDate, etc.; they are created automatically.
115545
115834
  - Ensure field keys are lowerCamelCase and ASCII. displayName values are human-readable.
115835
+ - Do NOT create fields that can be inferred or aggregated from other existing fields (e.g., don't create an "averageRating" field if you already have individual "rating" fields - calculate it dynamically).
115546
115836
  - Do NOT create audit, transaction, log, history, or analytics collections unless the blueprint explicitly requests them.
115547
115837
  - If the blueprint does not request persistent data, do not create any collections.
115548
115838
  - For static or hardcoded behaviors, at most create one minimal read-only configuration collection only when strictly necessary.
@@ -120230,6 +120520,7 @@ var require_orchestrator = __commonJS({
120230
120520
  super();
120231
120521
  this.agentsFactory = agentsFactory;
120232
120522
  this.apiKey = apiKey;
120523
+ this.shouldUseFixAgent = process.env.USE_AUTOFIX === "true";
120233
120524
  }
120234
120525
  // Typed helpers
120235
120526
  onEvent(event, listener) {
@@ -120421,10 +120712,12 @@ var require_orchestrator = __commonJS({
120421
120712
  outputPath,
120422
120713
  durationMs: durationMsCodeGeneration
120423
120714
  });
120424
- await this.startFixFlow({
120425
- projectDir: outputPath,
120426
- apiKey: this.apiKey
120427
- });
120715
+ if (this.shouldUseFixAgent) {
120716
+ await this.startFixFlow({
120717
+ projectDir: outputPath,
120718
+ apiKey: this.apiKey
120719
+ });
120720
+ }
120428
120721
  const durationMs = Date.now() - start;
120429
120722
  this.emitEvent("finish", { outputPath, durationMs });
120430
120723
  }
@@ -120495,10 +120788,12 @@ var require_orchestrator = __commonJS({
120495
120788
  outputPath,
120496
120789
  durationMs: durationMsCodeGeneration
120497
120790
  });
120498
- await this.startFixFlow({
120499
- projectDir: outputPath,
120500
- apiKey: this.apiKey
120501
- });
120791
+ if (this.shouldUseFixAgent) {
120792
+ await this.startFixFlow({
120793
+ projectDir: outputPath,
120794
+ apiKey: this.apiKey
120795
+ });
120796
+ }
120502
120797
  const durationMs = Date.now() - start;
120503
120798
  this.emitEvent("finish:iteration", { outputPath, durationMs });
120504
120799
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
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": "70fbc8a04729200a2076d5870d3ced40e10ef55b8ce324003c82c4bf"
27
+ "falconPackageHash": "6e23c9a5f3946572cfa8396e568764b65d1f4254fc1256a99d9ac401"
28
28
  }