@wix/ditto-codegen-public 1.0.49 → 1.0.51

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 (60) hide show
  1. package/dist/docs-output/api-docs/crm-contacts-onContactCreated-doc.txt +183 -0
  2. package/dist/docs-output/api-docs/data-items-onDataItemCreated.txt +103 -0
  3. package/dist/docs-output/api-docs/stores-product-onProductCreated-doc.txt +118 -0
  4. package/dist/docs-output/api-docs/stores-productV3-onProductCreated-doc.txt +184 -0
  5. package/dist/docs-output/api-docs/stores-productsV3-updateProduct-doc.txt +130 -0
  6. package/dist/examples-apps/contact-created-logger/package-lock.json +15102 -0
  7. package/dist/examples-apps/contact-created-logger/package.json +37 -0
  8. package/dist/examples-apps/contact-created-logger/src/backend/events/contact-created-logger/event.ts +51 -0
  9. package/dist/examples-apps/contact-created-logger/tsconfig.json +5 -0
  10. package/dist/examples-apps/contact-created-logger/wix.config.json +4 -0
  11. package/dist/examples-apps/event-countdown/README.md +13 -0
  12. package/dist/examples-apps/event-countdown/astro.config.mjs +31 -0
  13. package/dist/examples-apps/event-countdown/package.json +51 -0
  14. package/dist/examples-apps/event-countdown/src/components/countdown-preview.tsx +164 -0
  15. package/dist/examples-apps/event-countdown/src/components/countdown-timer-settings.tsx +199 -0
  16. package/dist/examples-apps/event-countdown/src/dashboard/pages/countdown-timer-settings/extensions.ts +7 -0
  17. package/dist/examples-apps/event-countdown/src/dashboard/pages/countdown-timer-settings/page.tsx +142 -0
  18. package/dist/examples-apps/event-countdown/src/dashboard/withProviders.tsx +22 -0
  19. package/dist/examples-apps/event-countdown/src/extensions.ts +12 -0
  20. package/dist/examples-apps/event-countdown/src/index.ts +2 -0
  21. package/dist/examples-apps/event-countdown/src/site/embedded-scripts/countdown-timer/embedded.html +328 -0
  22. package/dist/examples-apps/event-countdown/src/site/embedded-scripts/countdown-timer/extensions.ts +8 -0
  23. package/dist/examples-apps/event-countdown/src/types.ts +11 -0
  24. package/dist/examples-apps/event-countdown/tsconfig.json +9 -0
  25. package/dist/examples-apps/event-countdown/wix.config.json +4 -0
  26. package/dist/examples-apps/product-created-logger/package-lock.json +15102 -0
  27. package/dist/examples-apps/product-created-logger/package.json +37 -0
  28. package/dist/examples-apps/product-created-logger/src/backend/events/product-created-logger/event.ts +67 -0
  29. package/dist/examples-apps/product-created-logger/tsconfig.json +5 -0
  30. package/dist/examples-apps/product-created-logger/wix.config.json +4 -0
  31. package/dist/examples-apps/site-popup/package.json +43 -26
  32. package/dist/examples-apps/site-popup/src/components/activation-configuration.tsx +1 -1
  33. package/dist/examples-apps/site-popup/src/components/close-button.css +33 -0
  34. package/dist/examples-apps/site-popup/src/components/close-button.tsx +4 -3
  35. package/dist/examples-apps/site-popup/src/components/popup/index.css +133 -3
  36. package/dist/examples-apps/site-popup/src/components/popup/index.tsx +10 -10
  37. package/dist/examples-apps/site-popup/src/components/site-popup-settings.tsx +4 -4
  38. package/dist/examples-apps/site-popup/src/dashboard/pages/page.tsx +2 -2
  39. package/dist/examples-apps/site-popup/src/dashboard/withProviders.tsx +4 -1
  40. package/dist/examples-apps/site-popup/src/extensions.ts +21 -0
  41. package/dist/examples-apps/site-popup/src/site/embedded-scripts/site-popup/embedded.html +1 -0
  42. package/dist/examples-apps/site-popup/src/site/embedded-scripts/site-popup/popup-overlay/index.css +21 -3
  43. package/dist/examples-apps/site-popup/src/site/embedded-scripts/site-popup/popup-overlay/index.tsx +8 -9
  44. package/dist/examples-apps/site-popup/src/types.ts +1 -1
  45. package/dist/out.js +1294 -98
  46. package/dist/wix-cli-templates/src/dashboard/pages/page.tsx +0 -4
  47. package/dist/wix-cli-templates/src/site/embedded-scripts/my-script/embedded.html +1 -2
  48. package/package.json +2 -2
  49. package/dist/examples-apps/mixpanel-analytics/src/dashboard/pages/page.json +0 -5
  50. package/dist/examples-apps/mixpanel-analytics/src/site/embedded-scripts/mixpanel-analytics/embedded.json +0 -7
  51. package/dist/examples-apps/site-popup/package-lock.json +0 -8033
  52. package/dist/examples-apps/site-popup/postcss.config.js +0 -7
  53. package/dist/examples-apps/site-popup/src/env.d.ts +0 -4
  54. package/dist/examples-apps/site-popup/src/site/embedded-scripts/site-popup/embedded.json +0 -7
  55. package/dist/examples-apps/site-popup/src/site/embedded-scripts/site-popup/params.dev.json +0 -7
  56. package/dist/examples-apps/site-popup/tailwind.config.js +0 -8
  57. package/dist/wix-cli-templates/src/dashboard/pages/wix_logo.svg +0 -18
  58. package/dist/wix-cli-templates/src/site/embedded-scripts/my-script/embedded.json +0 -7
  59. package/dist/wix-cli-templates/src/site/embedded-scripts/my-script/logger.ts +0 -1
  60. package/dist/wix-cli-templates/src/site/embedded-scripts/my-script/params.dev.json +0 -3
package/dist/out.js CHANGED
@@ -77576,9 +77576,9 @@ var require_types_impl = __commonJS({
77576
77576
  }
77577
77577
  });
77578
77578
 
77579
- // dist/system-prompts/servicePlugin/servicePluginDocLoader.js
77580
- var require_servicePluginDocLoader = __commonJS({
77581
- "dist/system-prompts/servicePlugin/servicePluginDocLoader.js"(exports2) {
77579
+ // dist/system-prompts/docLoader.js
77580
+ var require_docLoader = __commonJS({
77581
+ "dist/system-prompts/docLoader.js"(exports2) {
77582
77582
  "use strict";
77583
77583
  var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
77584
77584
  if (k2 === void 0) k2 = k;
@@ -77617,11 +77617,57 @@ var require_servicePluginDocLoader = __commonJS({
77617
77617
  return result;
77618
77618
  };
77619
77619
  })();
77620
+ var __importDefault2 = exports2 && exports2.__importDefault || function(mod2) {
77621
+ return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
77622
+ };
77623
+ Object.defineProperty(exports2, "__esModule", { value: true });
77624
+ exports2.DocType = void 0;
77625
+ exports2.loadDocumentation = loadDocumentation;
77626
+ var path_1 = __importDefault2(require("path"));
77627
+ var fs4 = __importStar2(require("fs"));
77628
+ var DocType;
77629
+ (function(DocType2) {
77630
+ DocType2["API"] = "api";
77631
+ DocType2["SERVICE_PLUGIN"] = "service-plugin";
77632
+ })(DocType || (exports2.DocType = DocType = {}));
77633
+ function loadDocumentation(items, mapping, docType) {
77634
+ if (!items || items.length === 0) {
77635
+ return "";
77636
+ }
77637
+ const loadedDocs = /* @__PURE__ */ new Set();
77638
+ let combinedContent = "";
77639
+ for (const item of items) {
77640
+ const docFileName = mapping[item];
77641
+ if (docFileName && !loadedDocs.has(docFileName)) {
77642
+ try {
77643
+ const docsSubDir = docType === DocType.API ? "api-docs" : "service-plugins";
77644
+ const docPath = path_1.default.join(__dirname, "docs-output", docsSubDir, docFileName);
77645
+ if (fs4.existsSync(docPath)) {
77646
+ const docContent = fs4.readFileSync(docPath, "utf8");
77647
+ combinedContent += docContent + "\n";
77648
+ loadedDocs.add(docFileName);
77649
+ console.log(`\u2713 Loaded ${docType} documentation: ${docFileName}`);
77650
+ } else {
77651
+ console.warn(`\u26A0 ${docType} documentation not found: ${docPath}`);
77652
+ }
77653
+ } catch (error) {
77654
+ console.error(`\u2717 Failed to load ${docType} documentation for ${item}:`, error);
77655
+ }
77656
+ }
77657
+ }
77658
+ return combinedContent.trim();
77659
+ }
77660
+ }
77661
+ });
77662
+
77663
+ // dist/system-prompts/servicePlugin/servicePluginDocLoader.js
77664
+ var require_servicePluginDocLoader = __commonJS({
77665
+ "dist/system-prompts/servicePlugin/servicePluginDocLoader.js"(exports2) {
77666
+ "use strict";
77620
77667
  Object.defineProperty(exports2, "__esModule", { value: true });
77621
77668
  exports2.isSPIName = isSPIName;
77622
77669
  exports2.loadServicePluginDocumentation = loadServicePluginDocumentation;
77623
- var fs4 = __importStar2(require("fs"));
77624
- var path2 = __importStar2(require("path"));
77670
+ var docLoader_1 = require_docLoader();
77625
77671
  function isSPIName(value) {
77626
77672
  const validSPINames = [
77627
77673
  "ecom.shippingRates.getShippingRates",
@@ -77654,31 +77700,7 @@ var require_servicePluginDocLoader = __commonJS({
77654
77700
  "ecom.catalog.getCatalogItems": "ecom-catalog-doc.txt"
77655
77701
  };
77656
77702
  function loadServicePluginDocumentation(spiNames) {
77657
- if (!spiNames || spiNames.length === 0) {
77658
- return "";
77659
- }
77660
- const docsDir = path2.join(__dirname, "docs-output", "service-plugins");
77661
- const loadedDocs = /* @__PURE__ */ new Set();
77662
- let combinedContent = "";
77663
- for (const spiName of spiNames) {
77664
- const docFileName = SPI_TO_DOC_MAPPING[spiName];
77665
- if (docFileName && !loadedDocs.has(docFileName)) {
77666
- try {
77667
- const docPath = path2.join(docsDir, docFileName);
77668
- if (fs4.existsSync(docPath)) {
77669
- const docContent = fs4.readFileSync(docPath, "utf8");
77670
- combinedContent += docContent + "\n";
77671
- loadedDocs.add(docFileName);
77672
- console.log(`\u2713 Loaded service plugin documentation: ${docFileName}`);
77673
- } else {
77674
- console.warn(`\u26A0 Service plugin documentation not found: ${docPath}`);
77675
- }
77676
- } catch (error) {
77677
- console.error(`\u2717 Failed to load service plugin documentation for ${spiName}:`, error);
77678
- }
77679
- }
77680
- }
77681
- return combinedContent.trim();
77703
+ return (0, docLoader_1.loadDocumentation)(spiNames, SPI_TO_DOC_MAPPING, docLoader_1.DocType.SERVICE_PLUGIN);
77682
77704
  }
77683
77705
  }
77684
77706
  });
@@ -120276,19 +120298,19 @@ var require_utils14 = __commonJS({
120276
120298
  return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
120277
120299
  };
120278
120300
  Object.defineProperty(exports2, "__esModule", { value: true });
120279
- exports2.getErrorMessage = exports2.buildUserPromptForCodeGenerationAgent = exports2.getHttpClient = exports2.withCaching = exports2.FileSchema = void 0;
120301
+ exports2.getErrorMessage = exports2.buildUserPromptForCodeGenerationAgent = exports2.getHttpClient = exports2.withCaching = exports2.FileSchema = exports2.FileItemSchema = void 0;
120280
120302
  exports2.loadRelevantFilesAsString = loadRelevantFilesAsString;
120281
120303
  var zod_1 = require_zod();
120282
120304
  var http_client_1 = require_index_node();
120283
120305
  var fs_1 = __importDefault2(require("fs"));
120284
120306
  var path_1 = __importDefault2(require("path"));
120285
- var FileItemSchema = zod_1.z.object({
120307
+ exports2.FileItemSchema = zod_1.z.object({
120286
120308
  operation: zod_1.z.enum(["insert", "update", "delete"]).describe("File operation: insert (new file), update (modify existing), delete (remove file)").default("insert"),
120287
120309
  path: zod_1.z.string().describe("Relative file path from project root").optional(),
120288
120310
  content: zod_1.z.string().describe("Complete file content as a string (for JSON files, stringify the object). Required for insert and update operations.").optional()
120289
120311
  });
120290
120312
  exports2.FileSchema = zod_1.z.object({
120291
- files: zod_1.z.array(FileItemSchema).default([])
120313
+ files: zod_1.z.array(exports2.FileItemSchema).default([])
120292
120314
  });
120293
120315
  var withCaching = (ttl = "5m") => {
120294
120316
  return {
@@ -120384,6 +120406,11 @@ ${JSON.stringify(planAndResources.createdCollections, null, 2)}`);
120384
120406
  contextSections.push(`
120385
120407
  ## API SPEC
120386
120408
  ${JSON.stringify(planAndResources.apiSpec, null, 2)}`);
120409
+ }
120410
+ if (planAndResources?.embeddedScriptParameters) {
120411
+ contextSections.push(`
120412
+ ## EMBEDDED SCRIPT PARAMETERS
120413
+ ${JSON.stringify(planAndResources.embeddedScriptParameters, null, 2)}`);
120387
120414
  }
120388
120415
  const userMessage = `${primaryAction}:
120389
120416
  ${contextSections.join("\n")}`;
@@ -120422,6 +120449,7 @@ var require_load_examples = __commonJS({
120422
120449
  types2[types2["ServicePluginExtension"] = 3] = "ServicePluginExtension";
120423
120450
  types2[types2["CustomElementPlugin"] = 4] = "CustomElementPlugin";
120424
120451
  types2[types2["CustomElementWidget"] = 5] = "CustomElementWidget";
120452
+ types2[types2["BackendEvent"] = 6] = "BackendEvent";
120425
120453
  })(types || (exports2.types = types = {}));
120426
120454
  var appsExamples = {
120427
120455
  AIChatbot: {
@@ -120502,6 +120530,7 @@ var require_load_examples = __commonJS({
120502
120530
  "site-popup/src/components/site-popup-settings.tsx",
120503
120531
  "site-popup/src/components/activation-configuration.tsx",
120504
120532
  "site-popup/src/components/close-button.tsx",
120533
+ "site-popup/src/components/close-button.css",
120505
120534
  "site-popup/src/components/date-range-picker.tsx",
120506
120535
  "site-popup/src/components/image-picker.tsx",
120507
120536
  "site-popup/src/components/popup/index.tsx",
@@ -120512,7 +120541,11 @@ var require_load_examples = __commonJS({
120512
120541
  "site-popup/src/site/embedded-scripts/site-popup/embedded.html",
120513
120542
  "site-popup/src/site/embedded-scripts/site-popup/popup-overlay/index.tsx",
120514
120543
  "site-popup/src/site/embedded-scripts/site-popup/popup-overlay/index.css",
120515
- "site-popup/src/types.ts"
120544
+ "site-popup/src/types.ts",
120545
+ "site-popup/src/components/popup/index.tsx",
120546
+ "site-popup/src/components/popup/index.css",
120547
+ "site-popup/src/components/close-button.tsx",
120548
+ "site-popup/src/components/close-button.css"
120516
120549
  ]
120517
120550
  }
120518
120551
  },
@@ -120555,12 +120588,48 @@ var require_load_examples = __commonJS({
120555
120588
  files: {
120556
120589
  [types.DashboardPage]: ["survey-manager/src/dashboard/pages/page.tsx"]
120557
120590
  }
120591
+ },
120592
+ EventCountdown: {
120593
+ path: "event-countdown",
120594
+ description: "A dashboard app that allows administrators to create and manage countdown timers for events",
120595
+ files: {
120596
+ [types.DashboardPage]: [
120597
+ "event-countdown/src/dashboard/pages/countdown-timer-settings/page.tsx",
120598
+ "event-countdown/src/components/countdown-timer-settings.tsx",
120599
+ "event-countdown/src/components/countdown-preview.tsx",
120600
+ "event-countdown/src/types.ts",
120601
+ "event-countdown/src/dashboard/withProviders.tsx"
120602
+ ],
120603
+ [types.EmbeddedScript]: [
120604
+ "event-countdown/src/site/embedded-scripts/countdown-timer/embedded.html"
120605
+ ]
120606
+ }
120607
+ },
120608
+ ProductCreatedLogger: {
120609
+ path: "product-created-logger",
120610
+ description: "A webhook that logs product changes",
120611
+ files: {
120612
+ [types.BackendEvent]: [
120613
+ "product-created-logger/src/backend/events/product-created-logger/event.ts"
120614
+ ]
120615
+ }
120616
+ },
120617
+ ContactCreatedLogger: {
120618
+ path: "contact-created-logger",
120619
+ description: "A webhook that logs contact created",
120620
+ files: {
120621
+ [types.BackendEvent]: [
120622
+ "contact-created-logger/src/backend/events/contact-created-logger/event.ts"
120623
+ ]
120624
+ }
120558
120625
  }
120559
120626
  };
120560
120627
  exports2.examples = {
120561
120628
  [types.APIExtension]: [appsExamples.AIChatbot],
120562
120629
  [types.DashboardPage]: [
120563
120630
  appsExamples.SurveyManager,
120631
+ appsExamples.EventCountdown,
120632
+ appsExamples.SitePopup,
120564
120633
  appsExamples.AIChatbot,
120565
120634
  appsExamples.CustomProductsCatalog,
120566
120635
  appsExamples.MixPanelAnalystic,
@@ -120571,11 +120640,16 @@ var require_load_examples = __commonJS({
120571
120640
  ],
120572
120641
  [types.EmbeddedScript]: [
120573
120642
  appsExamples.MixPanelAnalystic,
120574
- appsExamples.SitePopup
120643
+ appsExamples.SitePopup,
120644
+ appsExamples.EventCountdown
120575
120645
  ],
120576
120646
  [types.ServicePluginExtension]: [appsExamples.SPISExample],
120577
120647
  [types.CustomElementPlugin]: [appsExamples.InventoryCountdown],
120578
- [types.CustomElementWidget]: [appsExamples.CustomElementWidget]
120648
+ [types.CustomElementWidget]: [appsExamples.CustomElementWidget],
120649
+ [types.BackendEvent]: [
120650
+ appsExamples.ProductCreatedLogger,
120651
+ appsExamples.ContactCreatedLogger
120652
+ ]
120579
120653
  };
120580
120654
  var loadExamples = (pluginTypes) => {
120581
120655
  const examplesAppsBasePath = path_1.default.join(__dirname, "examples-apps");
@@ -120866,9 +120940,7 @@ Your output must be strictly JSON that conforms to the provided schema (no markd
120866
120940
  Expected plan (abbreviated):
120867
120941
 
120868
120942
  \`\`\`
120869
- ${JSON.stringify({
120870
- apiSpec: todoExample
120871
- }, null, 2)}
120943
+ ${JSON.stringify(todoExample, null, 2)}
120872
120944
  \`\`\`
120873
120945
  </example_output>
120874
120946
 
@@ -120914,6 +120986,7 @@ Your output must be strictly JSON that conforms to the provided schema (no markd
120914
120986
  - Do NOT create audit, transaction, log, history, or analytics collections unless the blueprint explicitly requests them.
120915
120987
  - If the blueprint does not request persistent data, do not create any collections.
120916
120988
  - For static or hardcoded behaviors, at most create one minimal read-only configuration collection only when strictly necessary.
120989
+ - NEVER create CMS collections to store embedded script configuration parameters. Embedded script parameters (colors, messages, positions, display settings, etc.) are ALREADY persisted via the embeddedScripts API and are managed through embeddedScriptParameters. Creating duplicate CMS collections for this data is redundant and incorrect.
120917
120990
  </constraints>
120918
120991
 
120919
120992
  <typing_rules>
@@ -120963,6 +121036,11 @@ For the collections field, return:
120963
121036
  2) Propose collections only when the blueprint clearly requires persistent data. Define only the fields that are strictly required to fulfill the blueprint's functionality.
120964
121037
  3) For any field that references products, categories, or orders: ALWAYS use REFERENCE type with proper typeMetadata.
120965
121038
  4) Pick clear collection ids derived from the domain, lower-kebab or lower_underscore; avoid spaces.
121039
+ 5) Avoid Duplicate Data Storage:
121040
+ - Embedded script parameters (defined in embeddedScriptParameters) are ALREADY saved and persisted via the embeddedScripts API
121041
+ - NEVER create CMS collections that duplicate these parameters (colors, messages, positions, display settings, etc.)
121042
+ - CMS collections should ONLY be created for additional business data that is NOT covered by embeddedScriptParameters
121043
+ - Only create CMS collections if there's genuinely new data needed beyond what's in embeddedScriptParameters (e.g., user-generated content, analytics, logs if explicitly requested)
120966
121044
  </approach>
120967
121045
 
120968
121046
  </CMS_PLANNER_SYSTEM_PROMPT>
@@ -120971,6 +121049,183 @@ For the collections field, return:
120971
121049
  }
120972
121050
  });
120973
121051
 
121052
+ // dist/system-prompts/planner/dynamicParameters.js
121053
+ var require_dynamicParameters = __commonJS({
121054
+ "dist/system-prompts/planner/dynamicParameters.js"(exports2) {
121055
+ "use strict";
121056
+ Object.defineProperty(exports2, "__esModule", { value: true });
121057
+ exports2.dynamicParametersPrompt = void 0;
121058
+ var dynamicParametersPrompt = () => `
121059
+ <DYNAMIC_PARAMETERS_PLANNER_SYSTEM_PROMPT>
121060
+
121061
+ <role>
121062
+ You are a Wix CLI planner expert specialized in determining dynamic parameters for embedded scripts. Given a blueprint with EMBEDDED_SCRIPT extensions, you must decide if the embedded script needs dynamic parameters that can be configured via the dashboard, and if so, define them.
121063
+ </role>
121064
+
121065
+ <description>
121066
+ Dynamic parameters allow embedded scripts to be configurable through a dashboard interface. They are template variables ({{variableName}}) that get replaced with actual values set by the site owner in the dashboard.
121067
+
121068
+ Common use cases:
121069
+ - Configuration values (API keys, script settings, display options)
121070
+ - Content that changes (headlines, messages, display text)
121071
+ - Visual customization (colors, sizes, images)
121072
+ - Timing and scheduling (dates, durations, intervals)
121073
+ - Feature toggles (enable/disable functionality)
121074
+ </description>
121075
+
121076
+ <when_to_use_dynamic_parameters>
121077
+ Use dynamic parameters when:
121078
+ - The embedded script needs configurable values that site owners should be able to change
121079
+ - The script's behavior or appearance should be customizable without code changes
121080
+ - Different instances or configurations are needed for different sites
121081
+ - Content, styling, or functionality needs to be adjusted through a UI
121082
+
121083
+ Do NOT use dynamic parameters when:
121084
+ - The script is fully static and requires no configuration
121085
+ - All values are hardcoded and never need to change
121086
+ </when_to_use_dynamic_parameters>
121087
+
121088
+ <output_structure>
121089
+ Your output must include an array of embeddedScriptParameters. This array can be:
121090
+ - Empty array [] if there are no EMBEDDED_SCRIPT extensions in the blueprint or no dynamic parameters are needed
121091
+ - Array of embedded script parameter objects if there are EMBEDDED_SCRIPT extensions
121092
+
121093
+ Each embedded script parameter object contains:
121094
+ - extensionId (string): The name of the embedded script extension these parameters belong to (use the extension.name field)
121095
+ - parameters (array): Array of dynamic parameter definitions
121096
+
121097
+ Each dynamic parameter must include:
121098
+ - key (string, lowerCamelCase): The template variable name used as {{key}} in the embedded script
121099
+ - displayName (string): Human-readable label for the dashboard UI
121100
+ - type (ParameterType): The data type of the parameter
121101
+ - description (string, optional): Help text explaining the parameter's purpose
121102
+ - required (boolean): Whether the parameter must have a value
121103
+ - defaultValue (string, optional): Default value if not set by the user
121104
+ - options (array of strings, optional): For SELECT type parameters, the available options
121105
+
121106
+ Example output structures:
121107
+
121108
+ No embedded script extensions:
121109
+ []
121110
+
121111
+ With embedded script extensions:
121112
+ [
121113
+ {
121114
+ "extensionId": "site-popup",
121115
+ "parameters": [
121116
+ { "key": "headline", "displayName": "Headline", "type": "TEXT", "required": true },
121117
+ { "key": "text", "displayName": "Text", "type": "TEXTAREA", "required": true }
121118
+ ]
121119
+ }
121120
+ ]
121121
+
121122
+ Supported parameter types:
121123
+ - TEXT: Single-line text input
121124
+ - TEXTAREA: Multi-line text input
121125
+ - NUMBER: Numeric input
121126
+ - BOOLEAN: Checkbox or toggle
121127
+ - IMAGE: Image picker
121128
+ - DATE: Date picker
121129
+ - DATETIME: Date and time picker
121130
+ - URL: URL input with validation
121131
+ - SELECT: Dropdown with predefined options (must include options array)
121132
+ - COLOR: Color picker
121133
+ </output_structure>
121134
+
121135
+ <examples>
121136
+
121137
+ Example 1 - Site Popup (dynamic parameters needed):
121138
+ Blueprint: A popup that appears on the site with configurable message and timing
121139
+ Extension Name: "site-popup"
121140
+ Output:
121141
+ [
121142
+ {
121143
+ "extensionId": "site-popup",
121144
+ "parameters": [
121145
+ {
121146
+ "key": "headline",
121147
+ "displayName": "Headline",
121148
+ "type": "TEXT",
121149
+ "description": "The main headline shown in the popup",
121150
+ "required": true,
121151
+ "defaultValue": "Sale 20% Off"
121152
+ },
121153
+ {
121154
+ "key": "text",
121155
+ "displayName": "Text",
121156
+ "type": "TEXTAREA",
121157
+ "description": "The message content of the popup",
121158
+ "required": true,
121159
+ "defaultValue": "Sign up and get 20% off on our Winter Sale"
121160
+ },
121161
+ {
121162
+ "key": "imageUrl",
121163
+ "displayName": "Image",
121164
+ "type": "IMAGE",
121165
+ "description": "The image displayed in the popup",
121166
+ "required": false
121167
+ },
121168
+ {
121169
+ "key": "imageTitle",
121170
+ "displayName": "Image Title",
121171
+ "type": "TEXT",
121172
+ "description": "Alt text for the popup image",
121173
+ "required": false
121174
+ },
121175
+ {
121176
+ "key": "activationMode",
121177
+ "displayName": "Activation Mode",
121178
+ "type": "SELECT",
121179
+ "description": "When the popup should be active",
121180
+ "required": true,
121181
+ "defaultValue": "active",
121182
+ "options": ["active", "timed", "disabled"]
121183
+ },
121184
+ {
121185
+ "key": "startDate",
121186
+ "displayName": "Start Date",
121187
+ "type": "DATE",
121188
+ "description": "Start date for timed activation",
121189
+ "required": false
121190
+ },
121191
+ {
121192
+ "key": "endDate",
121193
+ "displayName": "End Date",
121194
+ "type": "DATE",
121195
+ "description": "End date for timed activation",
121196
+ "required": false
121197
+ }
121198
+ ]
121199
+ }
121200
+ ]
121201
+
121202
+ Example 2 - Static Pixel (no dynamic parameters needed):
121203
+ Blueprint: Add a Facebook Pixel with a hardcoded pixel ID
121204
+ Extension Name: "facebook-pixel"
121205
+ Output: []
121206
+
121207
+ </examples>
121208
+
121209
+ <guidelines>
121210
+ - If there are NO EMBEDDED_SCRIPT extensions in the blueprint, return an empty array: "embeddedScriptParameters": []
121211
+ - If there are EMBEDDED_SCRIPT extensions, ONLY include them if they truly need configurable parameters
121212
+ - The extensionId MUST match the exact name of the embedded script extension from the blueprint
121213
+ - Only define parameters that truly need to be configurable by the site owner
121214
+ - Keep parameter keys descriptive and in lowerCamelCase
121215
+ - Provide clear displayName and description for each parameter
121216
+ - Set appropriate required flags based on functionality needs
121217
+ - Choose the most appropriate type for the data
121218
+ - For SELECT types, MUST include the options array with all possible values
121219
+ - Consider grouping related parameters (e.g., activation settings, appearance settings)
121220
+ - Default values should be sensible and demonstrate the expected format
121221
+ </guidelines>
121222
+
121223
+ </DYNAMIC_PARAMETERS_PLANNER_SYSTEM_PROMPT>
121224
+ `;
121225
+ exports2.dynamicParametersPrompt = dynamicParametersPrompt;
121226
+ }
121227
+ });
121228
+
120974
121229
  // dist/system-prompts/planner/planner.js
120975
121230
  var require_planner = __commonJS({
120976
121231
  "dist/system-prompts/planner/planner.js"(exports2) {
@@ -120979,13 +121234,18 @@ var require_planner = __commonJS({
120979
121234
  exports2.plannerPrompt = void 0;
120980
121235
  var apiSpec_1 = require_apiSpec();
120981
121236
  var data_1 = require_data2();
120982
- var plannerPrompt = () => `
121237
+ var dynamicParameters_1 = require_dynamicParameters();
121238
+ var plannerPrompt = (hasEmbeddedScriptExtensions, hasBackendApiExtensions) => {
121239
+ return `
120983
121240
  <WIXCLI_PLANNER_SYSTEM_PROMPT>
120984
121241
  ${(0, data_1.cmsPlannerPrompt)()}
120985
121242
 
120986
- ${(0, apiSpec_1.apiSpecPrompt)()}
121243
+ ${hasBackendApiExtensions ? (0, apiSpec_1.apiSpecPrompt)() : "No backend API extensions in the blueprint, return an empty object: {}"}
121244
+
121245
+ ${hasEmbeddedScriptExtensions ? (0, dynamicParameters_1.dynamicParametersPrompt)() : 'No embeddedScriptParameters needed, no embedded scripts in the blueprint, return an empty array: "embeddedScriptParameters": []'}
120987
121246
  </WIXCLI_PLANNER_SYSTEM_PROMPT>
120988
121247
  `;
121248
+ };
120989
121249
  exports2.plannerPrompt = plannerPrompt;
120990
121250
  }
120991
121251
  });
@@ -122933,12 +123193,48 @@ var require_ApiSpecSchema = __commonJS({
122933
123193
  }
122934
123194
  });
122935
123195
 
123196
+ // dist/EmbeddedScriptSchema.js
123197
+ var require_EmbeddedScriptSchema = __commonJS({
123198
+ "dist/EmbeddedScriptSchema.js"(exports2) {
123199
+ "use strict";
123200
+ Object.defineProperty(exports2, "__esModule", { value: true });
123201
+ exports2.EmbeddedScriptParametersSchema = exports2.DynamicParameterSchema = void 0;
123202
+ var zod_1 = require_zod();
123203
+ var ParameterTypeEnum = zod_1.z.enum([
123204
+ "TEXT",
123205
+ "TEXTAREA",
123206
+ "NUMBER",
123207
+ "BOOLEAN",
123208
+ "IMAGE",
123209
+ "DATE",
123210
+ "DATETIME",
123211
+ "URL",
123212
+ "SELECT",
123213
+ "COLOR"
123214
+ ]).describe("The data type of a dynamic parameter for embedded scripts");
123215
+ exports2.DynamicParameterSchema = zod_1.z.object({
123216
+ key: zod_1.z.string().describe("The template variable name used as {{key}} in the embedded script (lowerCamelCase)"),
123217
+ displayName: zod_1.z.string().describe("Human-readable label for the dashboard UI"),
123218
+ type: ParameterTypeEnum.describe("The data type of the parameter"),
123219
+ description: zod_1.z.string().optional().describe("Help text explaining the parameter's purpose"),
123220
+ required: zod_1.z.boolean().describe("Whether the parameter must have a value"),
123221
+ defaultValue: zod_1.z.string().optional().describe("Default value if not set by the user"),
123222
+ options: zod_1.z.array(zod_1.z.string()).optional().describe("For SELECT type parameters, the available options")
123223
+ }).describe("A dynamic parameter definition for embedded script configuration");
123224
+ exports2.EmbeddedScriptParametersSchema = zod_1.z.object({
123225
+ extensionId: zod_1.z.string().describe("The name of the embedded script extension these parameters belong to"),
123226
+ parameters: zod_1.z.array(exports2.DynamicParameterSchema).default([]).describe("Array of dynamic parameter definitions for this embedded script")
123227
+ }).describe("Dynamic parameters configuration for a specific embedded script extension");
123228
+ }
123229
+ });
123230
+
122936
123231
  // dist/agents/PlannerAgent.js
122937
123232
  var require_PlannerAgent = __commonJS({
122938
123233
  "dist/agents/PlannerAgent.js"(exports2) {
122939
123234
  "use strict";
122940
123235
  Object.defineProperty(exports2, "__esModule", { value: true });
122941
123236
  exports2.PlannerAgent = exports2.PlannerOutputSchema = void 0;
123237
+ var types_1 = require_types_impl();
122942
123238
  var anthropic_1 = require_dist5();
122943
123239
  var ai_1 = require_dist9();
122944
123240
  var zod_1 = require_zod();
@@ -122946,27 +123242,31 @@ var require_PlannerAgent = __commonJS({
122946
123242
  var CMSAgent_1 = require_CMSAgent();
122947
123243
  var utils_1 = require_utils14();
122948
123244
  var ApiSpecSchema_1 = require_ApiSpecSchema();
123245
+ var EmbeddedScriptSchema_1 = require_EmbeddedScriptSchema();
122949
123246
  exports2.PlannerOutputSchema = zod_1.z.object({
122950
- collections: zod_1.z.array(CMSAgent_1.CmsCollectionSchema).default([]),
122951
- apiSpec: ApiSpecSchema_1.ApiSpecSchema.optional()
123247
+ collections: zod_1.z.array(CMSAgent_1.CmsCollectionSchema).default([]).describe("CMS collections to be created for the app"),
123248
+ embeddedScriptParameters: zod_1.z.array(EmbeddedScriptSchema_1.EmbeddedScriptParametersSchema).default([]).describe("Dynamic parameters for embedded script extensions (empty array if no embedded scripts)"),
123249
+ apiSpec: ApiSpecSchema_1.ApiSpecSchema.optional().describe("API specification for the app")
122952
123250
  });
122953
123251
  var PlannerAgent = class {
122954
123252
  constructor(apiKey) {
122955
123253
  this.apiKey = apiKey;
122956
123254
  this.name = "PlannerAgent";
122957
123255
  }
122958
- buildSystemPrompt() {
122959
- return (0, planner_1.plannerPrompt)();
123256
+ buildSystemPrompt(hasEmbeddedScriptExtensions, hasBackendApiExtensions) {
123257
+ return (0, planner_1.plannerPrompt)(hasEmbeddedScriptExtensions, hasBackendApiExtensions);
122960
123258
  }
122961
123259
  async generate(blueprint) {
122962
123260
  const model = (0, anthropic_1.createAnthropic)({ apiKey: this.apiKey })("claude-3-5-haiku-latest");
123261
+ const hasEmbeddedScriptExtensions = blueprint?.extensions?.some((ext) => ext.type === types_1.ExtensionType.EMBEDDED_SCRIPT) ?? false;
123262
+ const hasBackendApiExtensions = blueprint?.extensions?.some((ext) => ext.type === types_1.ExtensionType.BACKEND_API) ?? false;
122963
123263
  const result = await (0, ai_1.generateObject)({
122964
123264
  model,
122965
123265
  schema: exports2.PlannerOutputSchema,
122966
123266
  messages: [
122967
123267
  {
122968
123268
  role: "system",
122969
- content: this.buildSystemPrompt(),
123269
+ content: this.buildSystemPrompt(hasEmbeddedScriptExtensions, hasBackendApiExtensions),
122970
123270
  providerOptions: (0, utils_1.withCaching)("1h")
122971
123271
  },
122972
123272
  {
@@ -124305,7 +124605,8 @@ var require_shared = __commonJS({
124305
124605
  exports2.FIELD_TYPES_REFERENCE = `- TEXT: String values
124306
124606
  - NUMBER: Numeric values
124307
124607
  - BOOLEAN: true/false
124308
- - DATE: ISO date strings (e.g., "2024-01-15T10:30:00.000Z")
124608
+ - DATE: Date-only strings in YYYY-MM-DD format (e.g., "2024-01-15")
124609
+ - DATETIME: ISO 8601 datetime strings (e.g., "2024-01-15T10:30:00.000Z")
124309
124610
  - RICH_TEXT: HTML formatted strings
124310
124611
  - IMAGE: Image URLs or empty strings
124311
124612
  - REFERENCE: Object references - NEVER use null, undefined, or generate sample data. Return empty dataItems array [] for collections with REFERENCE fields
@@ -124660,6 +124961,174 @@ var require_SiteComponentAgent = __commonJS({
124660
124961
  }
124661
124962
  });
124662
124963
 
124964
+ // dist/system-prompts/apiDocLoader.js
124965
+ var require_apiDocLoader = __commonJS({
124966
+ "dist/system-prompts/apiDocLoader.js"(exports2) {
124967
+ "use strict";
124968
+ Object.defineProperty(exports2, "__esModule", { value: true });
124969
+ exports2.loadApiDocumentation = loadApiDocumentation;
124970
+ var docLoader_1 = require_docLoader();
124971
+ var API_TO_DOC_MAPPING = {
124972
+ "stores.productsV3.updateProduct": "stores-productsV3-updateProduct-doc.txt",
124973
+ "stores.products.onProductCreated": "stores-productV3-onProductCreated-doc.txt",
124974
+ "data.items.onDataItemCreated": "data-items-onDataItemCreated.txt",
124975
+ "crm.contacts.onContactCreated": "crm-contacts-onContactCreated-doc.txt"
124976
+ };
124977
+ function loadApiDocumentation(apiNames) {
124978
+ return (0, docLoader_1.loadDocumentation)(apiNames, API_TO_DOC_MAPPING, docLoader_1.DocType.API);
124979
+ }
124980
+ }
124981
+ });
124982
+
124983
+ // dist/system-prompts/backendEvent/backendEventPrompt.js
124984
+ var require_backendEventPrompt = __commonJS({
124985
+ "dist/system-prompts/backendEvent/backendEventPrompt.js"(exports2) {
124986
+ "use strict";
124987
+ Object.defineProperty(exports2, "__esModule", { value: true });
124988
+ exports2.backendEventPrompt = void 0;
124989
+ var apiDocLoader_1 = require_apiDocLoader();
124990
+ var backendEventPrompt = (apiNames) => {
124991
+ const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames);
124992
+ return `<BACKEND_EVENT_PROMPT>
124993
+ <role>
124994
+ You are a Wix backend event handler generator. Create event extensions for Wix CLI apps using the JavaScript SDK. Events are triggered when specific conditions on the app or user's site are met.
124995
+ </role>
124996
+
124997
+ <event_handler_patterns>
124998
+ - Use the correct SDK import for the service (e.g., import { products } from '@wix/stores')
124999
+ - Implement event listeners using the .on[EventName]() pattern
125000
+ - Always use async functions for event handlers
125001
+ - Include proper error handling and logging
125002
+ - Follow Wix backend event naming conventions
125003
+ - Events are triggered automatically when conditions are met
125004
+ </event_handler_patterns>
125005
+
125006
+ <implementation_guidelines>
125007
+ - Import the appropriate SDK module at the top of the file
125008
+ - Use descriptive function names that indicate the event being handled
125009
+ - Include console.log statements for debugging and monitoring
125010
+ - Handle both success and error cases appropriately
125011
+ - Use TypeScript types when available for better type safety
125012
+ - Follow the async/await pattern for any asynchronous operations
125013
+ - CRITICAL: Always check the exact TypeScript type structure before accessing any properties
125014
+ - DO NOT assume event structure - the event parameter type (e.g., ProductCreatedEnvelope) determines available fields
125015
+ - Use TypeScript IntelliSense or check the SDK documentation for the exact property names
125016
+ - ALWAYS check the TypeScript type definition for the exact property names and structure
125017
+ - Common event envelope patterns: event.data, event.metadata (NOT event.entity)
125018
+ - Property names vary by event type - never assume standard names like 'id' or 'name'
125019
+ - When in doubt, log the entire event object first to inspect its structure
125020
+ - DO NOT access any properties without verifying they exist in the type definition
125021
+ - Use optional chaining (?.) for all property access to prevent runtime errors
125022
+ - Reference the corresponding SDK submodule category for event-specific information
125023
+ - Events run automatically when triggered - no manual invocation needed
125024
+ </implementation_guidelines>
125025
+
125026
+ <api_docs>
125027
+ ${apiDocs}
125028
+ </api_docs>
125029
+ </BACKEND_EVENT_PROMPT>`;
125030
+ };
125031
+ exports2.backendEventPrompt = backendEventPrompt;
125032
+ }
125033
+ });
125034
+
125035
+ // dist/agents/BackendEventAgent.js
125036
+ var require_BackendEventAgent = __commonJS({
125037
+ "dist/agents/BackendEventAgent.js"(exports2) {
125038
+ "use strict";
125039
+ var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
125040
+ if (k2 === void 0) k2 = k;
125041
+ var desc = Object.getOwnPropertyDescriptor(m, k);
125042
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
125043
+ desc = { enumerable: true, get: function() {
125044
+ return m[k];
125045
+ } };
125046
+ }
125047
+ Object.defineProperty(o, k2, desc);
125048
+ }) : (function(o, m, k, k2) {
125049
+ if (k2 === void 0) k2 = k;
125050
+ o[k2] = m[k];
125051
+ }));
125052
+ var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) {
125053
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
125054
+ }) : function(o, v) {
125055
+ o["default"] = v;
125056
+ });
125057
+ var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ (function() {
125058
+ var ownKeys2 = function(o) {
125059
+ ownKeys2 = Object.getOwnPropertyNames || function(o2) {
125060
+ var ar = [];
125061
+ for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
125062
+ return ar;
125063
+ };
125064
+ return ownKeys2(o);
125065
+ };
125066
+ return function(mod2) {
125067
+ if (mod2 && mod2.__esModule) return mod2;
125068
+ var result = {};
125069
+ if (mod2 != null) {
125070
+ for (var k = ownKeys2(mod2), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod2, k[i]);
125071
+ }
125072
+ __setModuleDefault2(result, mod2);
125073
+ return result;
125074
+ };
125075
+ })();
125076
+ Object.defineProperty(exports2, "__esModule", { value: true });
125077
+ exports2.BackendEventAgent = void 0;
125078
+ var anthropic_1 = require_dist5();
125079
+ var ai_1 = require_dist9();
125080
+ var utils_1 = require_utils14();
125081
+ var backendEventPrompt_1 = require_backendEventPrompt();
125082
+ var load_examples_1 = __importStar2(require_load_examples());
125083
+ var BackendEventAgent = class {
125084
+ constructor(apiKey) {
125085
+ this.apiKey = apiKey;
125086
+ this.name = "BackendEventAgent";
125087
+ }
125088
+ buildSystemPrompt(apiNames = []) {
125089
+ return (0, backendEventPrompt_1.backendEventPrompt)(apiNames);
125090
+ }
125091
+ async generate(params) {
125092
+ const { blueprint } = params;
125093
+ const examples = (0, load_examples_1.default)([load_examples_1.types.BackendEvent]);
125094
+ const allApiNames = params.extension.relatedApis?.map((api) => api.name).filter((name) => !!name) || [];
125095
+ const systemPrompt = `${this.buildSystemPrompt(allApiNames)}
125096
+ ${examples}
125097
+ `;
125098
+ const appName = blueprint?.appName ? `'${blueprint.appName}'` : "";
125099
+ const primaryAction = `Customize backend event scaffolding for the app ${appName}`;
125100
+ const userMessage = (0, utils_1.buildUserPromptForCodeGenerationAgent)(params, primaryAction);
125101
+ const model = (0, anthropic_1.createAnthropic)({ apiKey: this.apiKey })("claude-sonnet-4-20250514");
125102
+ const result = await (0, ai_1.generateObject)({
125103
+ model,
125104
+ schema: utils_1.FileSchema,
125105
+ messages: [
125106
+ {
125107
+ role: "system",
125108
+ content: systemPrompt,
125109
+ providerOptions: (0, utils_1.withCaching)("1h")
125110
+ },
125111
+ {
125112
+ role: "user",
125113
+ content: userMessage
125114
+ }
125115
+ ],
125116
+ experimental_telemetry: {
125117
+ isEnabled: true,
125118
+ functionId: this.name
125119
+ },
125120
+ maxOutputTokens: 1e4,
125121
+ maxRetries: 3,
125122
+ temperature: 0
125123
+ });
125124
+ return result.object.files;
125125
+ }
125126
+ };
125127
+ exports2.BackendEventAgent = BackendEventAgent;
125128
+ exports2.default = BackendEventAgent;
125129
+ }
125130
+ });
125131
+
124663
125132
  // dist/system-prompts/backend/backendApi.js
124664
125133
  var require_backendApi = __commonJS({
124665
125134
  "dist/system-prompts/backend/backendApi.js"(exports2) {
@@ -126346,6 +126815,273 @@ async function updateTodo(id: string, todo: Partial<Todo>): Promise<Todo> {
126346
126815
  }
126347
126816
  });
126348
126817
 
126818
+ // dist/system-prompts/dashboardPage/dynamicParameters.js
126819
+ var require_dynamicParameters2 = __commonJS({
126820
+ "dist/system-prompts/dashboardPage/dynamicParameters.js"(exports2) {
126821
+ "use strict";
126822
+ Object.defineProperty(exports2, "__esModule", { value: true });
126823
+ exports2.dynamicParametersManagementPrompt = void 0;
126824
+ var dynamicParametersManagementPrompt = () => {
126825
+ return `
126826
+ <DYNAMIC_PARAMETERS_MANAGEMENT>
126827
+
126828
+ <description>
126829
+ This dashboard page manages dynamic parameters for an embedded script. The parameters are configurable values that site owners can set through this dashboard interface, and they will be passed to the embedded script as template variables.
126830
+
126831
+ IMPORTANT: Only implement UI for parameters that are relevant to your current use case. Ignore parameters that don't apply to the functionality you're building. It's perfectly fine to not use all parameters if they're not applicable.
126832
+ </description>
126833
+
126834
+ <implementation_requirements>
126835
+
126836
+ 1. Import embeddedScripts:
126837
+ - Import embeddedScripts directly from '@wix/app-management'
126838
+ - Use embeddedScripts.getEmbeddedScript() to load parameters
126839
+ - Use embeddedScripts.embedScript({ parameters }) to save parameters
126840
+ - Example:
126841
+ import { embeddedScripts } from '@wix/app-management';
126842
+
126843
+ 2. Type Definition:
126844
+ - Create a TypeScript type/interface that includes all the dynamic parameters
126845
+ - Example:
126846
+ export type MyScriptOptions = {
126847
+ headline: string;
126848
+ text: string;
126849
+ imageUrl: string;
126850
+ activationMode: 'active' | 'timed' | 'disabled';
126851
+ startDate?: string;
126852
+ endDate?: string;
126853
+ };
126854
+
126855
+ 3. State Management:
126856
+ - Use React useState to manage the parameter values locally
126857
+ - Initialize with default values for all parameters
126858
+ - Add separate state for isLoading and isSaving
126859
+ - Use useEffect to load parameters on mount
126860
+ - IMPORTANT: Parameters are returned as strings from the API, so you must handle type conversions:
126861
+ * BOOLEAN parameters: Convert from string 'true'/'false' to boolean
126862
+ * NUMBER parameters: Convert from string to number using Number()
126863
+ * Other types: Use as-is
126864
+ - Example:
126865
+ const [options, setOptions] = useState<MyScriptOptions>(defaultOptions);
126866
+ const [isLoading, setIsLoading] = useState(true);
126867
+ const [isSaving, setIsSaving] = useState(false);
126868
+
126869
+ useEffect(() => {
126870
+ const loadSettings = async () => {
126871
+ try {
126872
+ const embeddedScript = await embeddedScripts.getEmbeddedScript();
126873
+ const data = embeddedScript.parameters as Partial<Record<keyof MyScriptOptions, string>> || {};
126874
+
126875
+ setOptions((prev) => ({
126876
+ ...prev,
126877
+ textField: data?.textField || prev.textField,
126878
+ booleanField: data?.booleanField === 'true' ? true : data?.booleanField === 'false' ? false : prev.booleanField,
126879
+ numberField: Number(data?.numberField) || prev.numberField,
126880
+ }));
126881
+ } catch (error) {
126882
+ console.error('Failed to load settings:', error);
126883
+ } finally {
126884
+ setIsLoading(false);
126885
+ }
126886
+ };
126887
+
126888
+ loadSettings();
126889
+ }, []);
126890
+
126891
+ 4. Loading State:
126892
+ - Show a Loader component while isLoading is true
126893
+ - Example:
126894
+ {isLoading ? (
126895
+ <Box align="center" verticalAlign="middle" height="50vh">
126896
+ <Loader text="Loading..." />
126897
+ </Box>
126898
+ ) : (
126899
+ // ... form content
126900
+ )}
126901
+
126902
+ 5. Form Components:
126903
+ - IMPORTANT: Only create form fields for parameters relevant to your use case
126904
+ - Skip parameters that don't apply to the functionality being built
126905
+ - Create appropriate WDS form fields based on parameter types:
126906
+ * TEXT \u2192 Input component with FormField
126907
+ * TEXTAREA \u2192 InputArea component with FormField
126908
+ * NUMBER \u2192 Input component with type="number"
126909
+ * BOOLEAN \u2192 Checkbox or ToggleSwitch
126910
+ * IMAGE \u2192 Custom ImagePicker component (see components/image-picker.tsx)
126911
+ * DATE \u2192 DatePicker component
126912
+ * SELECT \u2192 Dropdown component with options
126913
+ * URL \u2192 Input with URL validation
126914
+ - Use FormField wrapper for labels and validation messages
126915
+ - Set required validation based on parameter.required flag
126916
+ - Show validation errors using FormField status and statusMessage props
126917
+
126918
+ 6. Save Functionality:
126919
+ - Add a Save button in the Page.Header actionsBar
126920
+ - Make handleSave an async function
126921
+ - CRITICAL: All parameters must be passed as STRING values because they are used as template variables in the embedded script
126922
+ - Convert all values to strings before saving:
126923
+ * BOOLEAN: Use String(value) or value.toString()
126924
+ * NUMBER: Use String(value) or value.toString()
126925
+ * Other types: Already strings, use as-is
126926
+ - Disable the Save button if required fields are missing or while saving
126927
+ - Add proper error handling
126928
+
126929
+ 7. Form Validation:
126930
+ - Implement validation for required fields
126931
+ - Show error states on FormField components
126932
+ - Display clear error messages
126933
+
126934
+ 8. Layout and Organization:
126935
+ - Use Card components to group related fields
126936
+ - Use Box with direction="vertical" for form layout
126937
+ - Add appropriate spacing with gap props
126938
+ - Include helpful descriptions using Card subtitle or FormField infoContent
126939
+ - Consider creating a separate settings component for complex forms
126940
+
126941
+ 9. Preview Component (Optional but Recommended):
126942
+ - If applicable, create a preview component that shows how the configuration will look
126943
+ - Display the preview alongside the settings form using Layout and Cell components
126944
+ - The preview should react to parameter changes in real-time
126945
+
126946
+ </implementation_requirements>
126947
+
126948
+ <parameter_type_mapping>
126949
+
126950
+ <example_implementation>
126951
+ See the generated site-popup example for a complete reference implementation:
126952
+ - src/dashboard/withProviders.tsx - Provider wrapper with WDS
126953
+ - src/dashboard/pages/page.tsx - Dashboard page with parameter management (wrapped with withProviders)
126954
+ - src/components/site-popup-settings.tsx - Settings form component
126955
+ - src/types.ts - Type definitions
126956
+
126957
+ Key implementation patterns from the example:
126958
+ 1. withProviders.tsx wraps the component with WixDesignSystemProvider
126959
+ 2. page.tsx exports the component wrapped: export default withProviders(MyComponent)
126960
+ 3. Parameters are saved as individual string fields, not as JSON
126961
+ 4. Parameters are loaded with proper type conversion (string to boolean, string to number, etc.)
126962
+ 5. Use embeddedScripts directly from '@wix/app-management'
126963
+ </example_implementation>
126964
+
126965
+ <file_generation_requirements>
126966
+ When dynamic parameters are present, you MUST generate these files:
126967
+ 1. src/dashboard/withProviders.tsx - Provider wrapper (REQUIRED for WDS)
126968
+ 2. src/dashboard/pages/page.tsx - The main dashboard page component
126969
+ 3. src/types.ts - Type definitions for the parameters (if needed)
126970
+ 4. Any additional component files (settings forms, previews, etc.)
126971
+
126972
+ The withProviders.tsx is NOT optional - it must always be generated when there are dynamic parameters.
126973
+ </file_generation_requirements>
126974
+
126975
+ <provider_wrapper_implementation>
126976
+ You MUST generate the following file: src/dashboard/withProviders.tsx
126977
+
126978
+ This file is REQUIRED to wrap dashboard components with the Wix Design System provider.
126979
+
126980
+ import React from 'react';
126981
+ import { WixDesignSystemProvider } from '@wix/design-system';
126982
+ import { i18n } from '@wix/essentials';
126983
+
126984
+ export default function withProviders<P extends {} = {}>(Component: React.FC<P>) {
126985
+ return function DashboardProviders(props: P) {
126986
+ const locale = i18n.getLocale();
126987
+ return (
126988
+ <WixDesignSystemProvider locale={locale} features={{ newColorsBranding: true }}>
126989
+ <Component {...props} />
126990
+ </WixDesignSystemProvider>
126991
+ );
126992
+ };
126993
+ }
126994
+
126995
+ // Also export as named export for backwards compatibility
126996
+ export { withProviders };
126997
+
126998
+ This file must be included in your generated files output.
126999
+ </provider_wrapper_implementation>
127000
+
127001
+ <using_provider_wrapper>
127002
+ In your dashboard page component (page.tsx):
127003
+ 1. Import the withProviders wrapper: import withProviders from '../../withProviders';
127004
+ 2. Import embeddedScripts from '@wix/app-management'
127005
+ 3. DO NOT wrap your component with WixDesignSystemProvider - the provider wrapper does this
127006
+ 4. Export the component wrapped with withProviders: export default withProviders(MyComponent);
127007
+ 5. Your component should only contain the Page component and its content, not providers
127008
+
127009
+ Example structure:
127010
+ import { useEffect, useState, type FC } from 'react';
127011
+ import { dashboard } from '@wix/dashboard';
127012
+ import { embeddedScripts } from '@wix/app-management';
127013
+ import { Page, Card, Button, ... } from '@wix/design-system';
127014
+ import '@wix/design-system/styles.global.css';
127015
+ import withProviders from '../../withProviders';
127016
+
127017
+ const MyDashboardPage: FC = () => {
127018
+ const [options, setOptions] = useState<MyScriptOptions>(defaultOptions);
127019
+ const [isLoading, setIsLoading] = useState(true);
127020
+ const [isSaving, setIsSaving] = useState(false);
127021
+
127022
+ useEffect(() => {
127023
+ const loadSettings = async () => {
127024
+ try {
127025
+ const embeddedScript = await embeddedScripts.getEmbeddedScript();
127026
+ const data = embeddedScript.parameters || {};
127027
+ // ... update options with data
127028
+ } catch (error) {
127029
+ console.error('Failed to load settings:', error);
127030
+ } finally {
127031
+ setIsLoading(false);
127032
+ }
127033
+ };
127034
+ loadSettings();
127035
+ }, []);
127036
+
127037
+ const handleSave = async () => {
127038
+ setIsSaving(true);
127039
+ try {
127040
+ await embeddedScripts.embedScript({ parameters: { /* ... */ } });
127041
+ dashboard.showToast({ message: 'Saved!', type: 'success' });
127042
+ } catch (error) {
127043
+ console.error('Failed to save:', error);
127044
+ dashboard.showToast({ message: 'Failed to save', type: 'error' });
127045
+ } finally {
127046
+ setIsSaving(false);
127047
+ }
127048
+ };
127049
+
127050
+ return (
127051
+ <Page height="100vh">
127052
+ {/* Page content - NO WixDesignSystemProvider here */}
127053
+ </Page>
127054
+ );
127055
+ };
127056
+
127057
+ export default withProviders(MyDashboardPage);
127058
+ </using_provider_wrapper>
127059
+
127060
+ <critical_notes>
127061
+ - Only implement UI for parameters that are relevant to your specific use case - ignore parameters that don't apply
127062
+ - ALWAYS generate withProviders.tsx when there are dynamic parameters
127063
+ - ALWAYS wrap the dashboard page export with withProviders()
127064
+ - DO NOT use WixDesignSystemProvider directly in the dashboard page component - use withProviders instead
127065
+ - ALWAYS use embeddedScripts directly from '@wix/app-management'
127066
+ - ALWAYS convert parameter values to strings when saving (embeddedScripts.embedScript must receive all string values in the parameters object)
127067
+ - ALWAYS convert string parameters back to proper types when loading (e.g., 'true' -> true for booleans, string to number for numbers)
127068
+ - ALWAYS handle the loading state with isLoading state variable
127069
+ - ALWAYS handle the saving state with isSaving state variable
127070
+ - ALWAYS add try/catch blocks for async operations (loading and saving)
127071
+ - ALWAYS use async/await for embeddedScripts operations
127072
+ - ALWAYS merge parameter values correctly in useEffect with proper type conversions
127073
+ - ALWAYS validate required fields and show appropriate error states
127074
+ - The parameter keys MUST match exactly what is expected in the embedded script template variables
127075
+ - Each parameter is saved as a separate field, NOT as a JSON string
127076
+ </critical_notes>
127077
+
127078
+ </DYNAMIC_PARAMETERS_MANAGEMENT>
127079
+ `;
127080
+ };
127081
+ exports2.dynamicParametersManagementPrompt = dynamicParametersManagementPrompt;
127082
+ }
127083
+ });
127084
+
126349
127085
  // dist/system-prompts/dashboardPage/dashboardPagePrompt.js
126350
127086
  var require_dashboardPagePrompt = __commonJS({
126351
127087
  "dist/system-prompts/dashboardPage/dashboardPagePrompt.js"(exports2) {
@@ -126357,6 +127093,7 @@ var require_dashboardPagePrompt = __commonJS({
126357
127093
  var wdsPackage_1 = require_wdsPackage();
126358
127094
  var data_1 = require_data3();
126359
127095
  var apiSpecPrompt_1 = require_apiSpecPrompt();
127096
+ var dynamicParameters_1 = require_dynamicParameters2();
126360
127097
  var wdsPackage_2 = require_wdsPackage();
126361
127098
  Object.defineProperty(exports2, "buildWdsSystemPrompt", { enumerable: true, get: function() {
126362
127099
  return wdsPackage_2.buildWdsSystemPrompt;
@@ -126386,7 +127123,7 @@ var require_dashboardPagePrompt = __commonJS({
126386
127123
  "ToggleSwitch",
126387
127124
  "InfoIcon"
126388
127125
  ];
126389
- var dashboardPagePrompt = async ({ useData, useApiSpec }) => {
127126
+ var dashboardPagePrompt = async ({ useData, useApiSpec, useDynamicParameters }) => {
126390
127127
  const wdsPrompt = await (0, wdsPackage_1.buildWdsSystemPrompt)(listOfWdsComponents);
126391
127128
  return `
126392
127129
  <WIXCLI_DASHBOARD_PAGE_SYSTEM_PROMPT>
@@ -126469,6 +127206,8 @@ ${wdsPrompt}
126469
127206
  ${useData ? data_1.dataPrompt : ""}
126470
127207
 
126471
127208
  ${useApiSpec ? apiSpecPrompt_1.apiSpecPrompt : ""}
127209
+
127210
+ ${useDynamicParameters ? (0, dynamicParameters_1.dynamicParametersManagementPrompt)() : ""}
126472
127211
  </WIXCLI_DASHBOARD_PAGE_SYSTEM_PROMPT>
126473
127212
  `;
126474
127213
  };
@@ -126500,7 +127239,8 @@ var require_DashboardPageAgent = __commonJS({
126500
127239
  const examples = (0, load_examples_1.loadExamples)([load_examples_1.types.DashboardPage]);
126501
127240
  const useData = Boolean(planAndResources?.createdCollections?.length);
126502
127241
  const useApiSpec = Boolean(planAndResources?.apiSpec);
126503
- const systemPrompt = `${await this.buildSystemPrompt({ useData, useApiSpec })}
127242
+ const useDynamicParameters = Boolean(planAndResources?.embeddedScriptParameters?.length);
127243
+ const systemPrompt = `${await this.buildSystemPrompt({ useData, useApiSpec, useDynamicParameters })}
126504
127244
  ${examples}
126505
127245
  `;
126506
127246
  console.log(`Dashboard Agent System Prompt length: ${systemPrompt.length} (is that what you expect?)`);
@@ -126659,6 +127399,7 @@ Auto-patterns is suitable for:
126659
127399
 
126660
127400
  <custom-code-needed-for>
126661
127401
  Custom code is required for:
127402
+ - Embedded script parameter management
126662
127403
  - Custom business logic or calculations
126663
127404
  - Complex workflows or state management
126664
127405
  - External API integrations or webhooks
@@ -126672,12 +127413,36 @@ Custom code is required for:
126672
127413
  </custom-code-needed-for>
126673
127414
 
126674
127415
  <task>
126675
- 1. Analyze the dashboard page description and the available collections
126676
- 2. Decide whether auto-patterns is sufficient or if custom code is needed
126677
- 3. If auto-patterns is suitable, generate the complete schema for the SINGLE most relevant collection
127416
+ 1. Analyze the dashboard page description and determine what functionality is actually needed
127417
+ 2. Consider only the collections and embedded script parameters that are RELEVANT to this specific dashboard page
127418
+ 3. Decide whether auto-patterns is sufficient or if custom code is needed
127419
+ 4. If auto-patterns is suitable, generate the complete schema for the SINGLE most relevant collection
127420
+
127421
+ IMPORTANT: Focus only on what's relevant to the current use case. Not all collections or parameters need to be used.
126678
127422
 
126679
- IMPORTANT:
127423
+ CRITICAL: EMBEDDED SCRIPT SETTINGS/CONFIGURATION PAGES
127424
+ You will receive information about embedded script parameters in the <embedded-script-parameters> section.
127425
+
127426
+ IMPORTANT: Only consider embedded script parameters that are RELEVANT to the current dashboard page use case.
127427
+ - Some embedded script parameters may exist but not be relevant to this specific dashboard page
127428
+ - Only return useAutoPatterns: false if the dashboard page is actually meant to configure those parameters
127429
+ - Ignore embedded script parameters that don't apply to the current functionality
127430
+
127431
+ Return useAutoPatterns: false if:
127432
+ 1. The dashboard page description specifically mentions configuring/managing embedded script settings
127433
+ 2. The dashboard page is clearly meant to configure widgets, scripts, or embedded functionality
127434
+ 3. The embedded script parameters are directly relevant to what this dashboard page should do
127435
+
127436
+ Do NOT return useAutoPatterns: false just because parameters exist - only if they're relevant to this page.
127437
+
127438
+ IMPORTANT: MULTIPLE COLLECTIONS
126680
127439
  Auto-patterns ONLY supports displaying/managing data from a SINGLE collection.
127440
+
127441
+ RELEVANCE MATTERS: You may receive information about multiple collections, but only consider collections that are RELEVANT to the current dashboard page use case.
127442
+ - Not every collection needs to be displayed or managed in this dashboard page
127443
+ - Only focus on collections that are directly related to what the user wants to accomplish
127444
+ - Ignore collections that don't apply to the current functionality
127445
+
126681
127446
  Return useAutoPatterns: false if the dashboard page requires:
126682
127447
  - Joining or combining data from multiple collections
126683
127448
  - Displaying fields from different collections together
@@ -126692,10 +127457,12 @@ Examples requiring MULTIPLE collections (return useAutoPatterns: false):
126692
127457
  - "Show inventory items with supplier details" (inventory + suppliers)
126693
127458
 
126694
127459
  ONLY return useAutoPatterns: true if the page description can be fully satisfied by:
126695
- - Reading/displaying items from ONE collection only
126696
- - Creating/editing items in ONE collection only
126697
- - Deleting items from ONE collection only
126698
- - Filtering/sorting items in ONE collection only
127460
+ - Reading/displaying items from ONE relevant collection only
127461
+ - Creating/editing items in ONE relevant collection only
127462
+ - Deleting items from ONE relevant collection only
127463
+ - Filtering/sorting items in ONE relevant collection only
127464
+ - NO embedded script configuration or settings management
127465
+ - The collection is actually relevant to what the user wants to accomplish
126699
127466
 
126700
127467
  Return your response in the following format:
126701
127468
  - If useAutoPatterns is false: return only useAutoPatterns
@@ -126779,40 +127546,17 @@ var require_DashboardDecisionAgent = __commonJS({
126779
127546
  buildSystemPrompt() {
126780
127547
  return (0, autoPatternPrompt_1.autoPatternDecisionPrompt)();
126781
127548
  }
126782
- buildUserPrompt(blueprint, extension, collectionsInfo) {
126783
- return `<user-request>
126784
- App Summary: ${blueprint?.summary || "Not provided"}
126785
- </user-request>
126786
-
126787
- <dashboard-page-description>
126788
- Dashboard Page Name: ${extension.name}
126789
- Dashboard Page Description: ${extension.description}
126790
- </dashboard-page-description>
126791
-
126792
- <available-collections>
126793
- ${collectionsInfo}
126794
- </available-collections>`;
126795
- }
126796
- async generate({ blueprint, extension, planAndResources }) {
126797
- if (!planAndResources.createdCollections?.length) {
127549
+ async generate(params) {
127550
+ const { planAndResources } = params;
127551
+ if (!planAndResources?.createdCollections?.length) {
126798
127552
  return {
126799
127553
  useAutoPatterns: false
126800
127554
  };
126801
127555
  }
126802
- const { createdCollections } = planAndResources;
126803
127556
  const model = (0, anthropic_1.createAnthropic)({ apiKey: this.apiKey })("claude-3-5-haiku-latest");
126804
- const collectionsInfo = createdCollections.map((collection, index) => {
126805
- const userFields = collection.fields?.filter((field) => !field.key?.startsWith("_")) || [];
126806
- const fieldsDetail = userFields.map((f) => ` - ${f.key} (${f.type}): ${f.displayName}`).join("\n");
126807
- return `
126808
- Collection ${index + 1}:
126809
- ID: ${collection.id}
126810
- Display Name: ${collection.displayName}
126811
- Fields (${userFields.length}):
126812
- ${fieldsDetail}`;
126813
- }).join("\n");
126814
127557
  const systemPrompt = this.buildSystemPrompt();
126815
- const userPrompt = this.buildUserPrompt(blueprint, extension, collectionsInfo);
127558
+ const primaryAction = "Decide whether to use auto patterns for the dashboard page";
127559
+ const userPrompt = (0, utils_1.buildUserPromptForCodeGenerationAgent)(params, primaryAction);
126816
127560
  const result = await (0, ai_1.generateObject)({
126817
127561
  model,
126818
127562
  schema: autoPatternsLlmConfig,
@@ -127403,6 +128147,305 @@ export default withDashboard(CollectionPage);
127403
128147
  }
127404
128148
  });
127405
128149
 
128150
+ // dist/system-prompts/embeddedScript/embededScript.js
128151
+ var require_embededScript = __commonJS({
128152
+ "dist/system-prompts/embeddedScript/embededScript.js"(exports2) {
128153
+ "use strict";
128154
+ Object.defineProperty(exports2, "__esModule", { value: true });
128155
+ exports2.embeddedScriptPrompt = void 0;
128156
+ var embeddedScriptPrompt = (hasDynamicParameters) => {
128157
+ return `
128158
+ <WIXCLI_EMBEDDED_SCRIPT_SYSTEM_PROMPT>
128159
+
128160
+ <role>
128161
+ You are a senior Wix CLI App Developer Expert specialized in creating embedded scripts for Wix applications. You have deep knowledge of embedded script best practices, HTML/JavaScript injection patterns, and third-party integrations.
128162
+
128163
+ You are tasked with generating a complete Wix CLI embedded script implementation based on the user's requirements.
128164
+ </role>
128165
+
128166
+ <embedded_script_extension_files_and_code>
128167
+ <description>
128168
+ Embedded scripts are HTML code fragments that get injected into the DOM of Wix sites. They enable integration with third-party services, analytics tracking, advertising, and custom JavaScript functionality.
128169
+
128170
+ Each embedded script lives in its own folder under src/site/embedded-scripts/ and you generate the embedded.html file containing the HTML/JavaScript code to be injected.
128171
+ </description>
128172
+
128173
+ <metadata_fields>
128174
+ You will also specify metadata that determines how the script is injected:
128175
+ - scriptType: ESSENTIAL | FUNCTIONAL | ANALYTICS | ADVERTISING
128176
+ - placement: HEAD | BODY_START | BODY_END
128177
+
128178
+ These are returned separately from the HTML file.
128179
+ </metadata_fields>
128180
+
128181
+ <script_types>
128182
+ An enum used by consent management apps to determine whether site visitors consent to having your script run during their visit. Possible values are:
128183
+ - ESSENTIAL: Enables site visitors to move around the site and use essential features like secure and private areas crucial to the functioning of the site.
128184
+ - FUNCTIONAL: Remembers choices site visitors make to improve their experience, such as language.
128185
+ - ANALYTICS: Provides statistics to the site owner on how visitors use the site, such as which pages they visit. This helps improve the site by identifying errors and performance issues.
128186
+ - ADVERTISING: Provides visitor information to the site owner to help market their products, such as data on the impact of marketing campaigns, re-targeted advertising, and so on.
128187
+ An embedded script must have a type. If your script falls into more than one type, choose the option closest to the bottom of the list above. For example, if your script has Advertising and Analytics aspects, choose Advertising as its type. It's unlikely that you'll need to mark it as Essential.
128188
+ </script_types>
128189
+
128190
+ <placement_options>
128191
+ An enum indicating where in the page's DOM the HTML code will be injected. Possible values are:
128192
+ - HEAD: Injects the code between the page's <head> and </head> tags.
128193
+ - BODY_START: Injects the code immediately after the page's opening <body> tag.
128194
+ - BODY_END: Injects the code immediately before the page's closing </body> tag.
128195
+ </placement_options>
128196
+
128197
+ <template_variables>
128198
+ Embedded scripts support parameterization using template variable syntax {{variableName}}.
128199
+ - Correct: <div data-value="{{myVariable}}"></div>
128200
+ - Common use cases: API keys, configuration values, user-specific data
128201
+ </template_variables>
128202
+
128203
+ </embedded_script_extension_files_and_code>
128204
+
128205
+ <core_principles>
128206
+ - Do NOT invent or assume new types, modules, functions, or imports not available in standard browser APIs or explicitly imported libraries
128207
+ - NEVER use mocks, placeholders, or TODOs in any code
128208
+ - ALWAYS implement complete, production-ready functionality
128209
+ - Handle errors gracefully and fail silently when appropriate for embedded scripts
128210
+ - Minimize performance impact - embedded scripts should be lightweight and non-blocking
128211
+ - Follow web security best practices (avoid inline event handlers, validate data, escape user input)
128212
+ </core_principles>
128213
+
128214
+ <generation_requirements>
128215
+ 1. Generate the embedded.html file with complete HTML/JavaScript implementation
128216
+ 2. Specify appropriate scriptType based on the use case:
128217
+ - Analytics tools \u2192 ANALYTICS
128218
+ - Ad networks, marketing pixels \u2192 ADVERTISING
128219
+ - Core functionality \u2192 ESSENTIAL
128220
+ - Enhanced features \u2192 FUNCTIONAL
128221
+ 3. Choose optimal placement:
128222
+ - Analytics/tracking \u2192 HEAD (initialize early)
128223
+ - Advertising \u2192 BODY_END (non-blocking)
128224
+ - Critical functionality \u2192 HEAD or BODY_START
128225
+ - Non-critical features \u2192 BODY_END (performance)
128226
+ 4. Implement complete business logic with proper error handling
128227
+ 5. Use template variables {{variableName}} for configurable values (API keys, settings, etc.)
128228
+ 6. Include proper TypeScript imports when using external modules
128229
+ </generation_requirements>
128230
+
128231
+ <implementation_guidelines>
128232
+
128233
+ ${hasDynamicParameters ? `
128234
+ <dynamic_parameters_usage>
128235
+
128236
+ <description>
128237
+ This embedded script uses dynamic parameters that are configured through the dashboard. These parameters are passed as template variables and should be used in your HTML/JavaScript code.
128238
+ </description>
128239
+
128240
+ <usage_instructions>
128241
+
128242
+ 1. Template Variable Syntax:
128243
+ - Use {{parameterKey}} syntax to insert parameter values into your HTML
128244
+ - Template variables work in HTML attributes
128245
+ - They will be replaced with actual values when the script is injected
128246
+
128247
+ 2. HTML Attributes (REQUIRED):
128248
+ - Store ALL parameter values in data attributes on a configuration element
128249
+ - Template variables can ONLY be used here, not directly in JavaScript
128250
+ - Example: <div id="config" data-headline="{{headline}}" data-text="{{text}}"></div>
128251
+
128252
+ 3. JavaScript Access:
128253
+ - JavaScript must read parameter values from the data attributes
128254
+ - Use getAttribute() or the dataset property
128255
+ - Examples:
128256
+ const config = document.getElementById('config');
128257
+ const headline = config?.getAttribute('data-headline');
128258
+ // OR using dataset:
128259
+ const { headline, text } = config.dataset;
128260
+
128261
+ 4. Type Safety:
128262
+ - Be aware of parameter types when using them in JavaScript
128263
+ - NUMBER types: convert with Number() or parseInt()
128264
+ - BOOLEAN types: compare with 'true' or 'false' strings
128265
+ - DATE/DATETIME: parse with new Date()
128266
+
128267
+ 5. Required vs Optional:
128268
+ - Required parameters will always have values
128269
+ - Optional parameters may be empty - handle gracefully
128270
+ - Provide fallback values for optional parameters
128271
+
128272
+ 6. Relevant Parameter Usage:
128273
+ - Only use dynamic parameters that are relevant to your current use case
128274
+ - Ignore parameters that don't apply to the functionality you're implementing
128275
+ - Each parameter you use should serve a clear purpose in the script's functionality
128276
+ - It's perfectly fine to not use all parameters if they're not applicable
128277
+
128278
+ </usage_instructions>
128279
+
128280
+ <example_patterns>
128281
+
128282
+ Pattern 1 - Configuration in Data Attributes:
128283
+ <div
128284
+ id="script-config"
128285
+ data-api-key="{{apiKey}}"
128286
+ data-enabled="{{enabled}}"
128287
+ data-color="{{primaryColor}}"
128288
+ ></div>
128289
+ <script>
128290
+ const config = document.getElementById('script-config');
128291
+ const apiKey = config.getAttribute('data-api-key');
128292
+ const enabled = config.getAttribute('data-enabled') === 'true';
128293
+ const color = config.getAttribute('data-color');
128294
+
128295
+ if (enabled && apiKey) {
128296
+ // Initialize with configuration
128297
+ }
128298
+ </script>
128299
+
128300
+ Pattern 2 - Using dataset Property:
128301
+ <div
128302
+ id="script-config"
128303
+ data-headline="{{headline}}"
128304
+ data-message="{{message}}"
128305
+ data-image-url="{{imageUrl}}"
128306
+ ></div>
128307
+ <script>
128308
+ const config = document.getElementById('script-config');
128309
+ const { headline, message, imageUrl } = config.dataset;
128310
+
128311
+ // Use the variables in your script logic
128312
+ if (headline) {
128313
+ document.querySelector('#headline').textContent = headline;
128314
+ }
128315
+ </script>
128316
+
128317
+ Pattern 3 - Conditional Logic:
128318
+ <div
128319
+ id="config"
128320
+ data-mode="{{activationMode}}"
128321
+ data-start="{{startDate}}"
128322
+ data-end="{{endDate}}"
128323
+ ></div>
128324
+ <script>
128325
+ const config = document.getElementById('config');
128326
+ const mode = config.getAttribute('data-mode');
128327
+
128328
+ if (mode === 'timed') {
128329
+ const startDate = new Date(config.getAttribute('data-start'));
128330
+ const endDate = new Date(config.getAttribute('data-end'));
128331
+ const now = new Date();
128332
+
128333
+ if (now >= startDate && now <= endDate) {
128334
+ // Show content
128335
+ }
128336
+ } else if (mode === 'active') {
128337
+ // Show content immediately
128338
+ }
128339
+ </script>
128340
+
128341
+ </example_patterns>
128342
+
128343
+ <validation_requirements>
128344
+ - Only use dynamic parameters that are relevant to your specific use case
128345
+ - Ignore parameters that don't apply to the functionality being implemented
128346
+ - Template variables {{parameterKey}} must match the exact key names from the parameter definitions
128347
+ - Handle both required and optional parameters appropriately
128348
+ - Provide sensible default behavior when optional parameters are not set
128349
+ - Ensure type-appropriate usage (don't use NUMBER parameters as strings without conversion)
128350
+ </validation_requirements>
128351
+
128352
+ </dynamic_parameters_usage>
128353
+ ` : ""}
128354
+
128355
+ </WIXCLI_EMBEDDED_SCRIPT_SYSTEM_PROMPT>
128356
+ `;
128357
+ };
128358
+ exports2.embeddedScriptPrompt = embeddedScriptPrompt;
128359
+ }
128360
+ });
128361
+
128362
+ // dist/agents/EmbeddedScriptAgent.js
128363
+ var require_EmbeddedScriptAgent = __commonJS({
128364
+ "dist/agents/EmbeddedScriptAgent.js"(exports2) {
128365
+ "use strict";
128366
+ var __importDefault2 = exports2 && exports2.__importDefault || function(mod2) {
128367
+ return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
128368
+ };
128369
+ Object.defineProperty(exports2, "__esModule", { value: true });
128370
+ exports2.EmbeddedScriptAgent = exports2.EmbeddedScriptSchema = exports2.EmbeddedScriptType = exports2.EmbeddedScriptPlacement = void 0;
128371
+ var anthropic_1 = require_dist5();
128372
+ var ai_1 = require_dist9();
128373
+ var utils_1 = require_utils14();
128374
+ var load_examples_1 = require_load_examples();
128375
+ var zod_1 = __importDefault2(require_zod());
128376
+ var embededScript_1 = require_embededScript();
128377
+ var EmbeddedScriptPlacement;
128378
+ (function(EmbeddedScriptPlacement2) {
128379
+ EmbeddedScriptPlacement2["HEAD"] = "HEAD";
128380
+ EmbeddedScriptPlacement2["BODY_START"] = "BODY_START";
128381
+ EmbeddedScriptPlacement2["BODY_END"] = "BODY_END";
128382
+ })(EmbeddedScriptPlacement || (exports2.EmbeddedScriptPlacement = EmbeddedScriptPlacement = {}));
128383
+ var EmbeddedScriptType;
128384
+ (function(EmbeddedScriptType2) {
128385
+ EmbeddedScriptType2["ESSENTIAL"] = "ESSENTIAL";
128386
+ EmbeddedScriptType2["FUNCTIONAL"] = "FUNCTIONAL";
128387
+ EmbeddedScriptType2["ANALYTICS"] = "ANALYTICS";
128388
+ EmbeddedScriptType2["ADVERTISING"] = "ADVERTISING";
128389
+ })(EmbeddedScriptType || (exports2.EmbeddedScriptType = EmbeddedScriptType = {}));
128390
+ exports2.EmbeddedScriptSchema = zod_1.default.object({
128391
+ files: zod_1.default.array(utils_1.FileItemSchema).default([]),
128392
+ scriptType: zod_1.default.enum(Object.values(EmbeddedScriptType)),
128393
+ placement: zod_1.default.enum(Object.values(EmbeddedScriptPlacement))
128394
+ });
128395
+ var EmbeddedScriptAgent = class {
128396
+ constructor(apiKey) {
128397
+ this.apiKey = apiKey;
128398
+ this.name = "EmbeddedScriptAgent";
128399
+ }
128400
+ async buildSystemPrompt(hasDynamicParameters) {
128401
+ return (0, embededScript_1.embeddedScriptPrompt)(hasDynamicParameters);
128402
+ }
128403
+ async generate(params) {
128404
+ const { blueprint, planAndResources } = params;
128405
+ const examples = (0, load_examples_1.loadExamples)([load_examples_1.types.EmbeddedScript]);
128406
+ const hasDynamicParameters = Boolean(planAndResources?.embeddedScriptParameters && planAndResources.embeddedScriptParameters.length > 0);
128407
+ const systemPrompt = `${await this.buildSystemPrompt(hasDynamicParameters)}
128408
+ ${examples}
128409
+ `;
128410
+ console.log(`Embedded Script Agent System Prompt length: ${systemPrompt.length} (is that what you expect?)`);
128411
+ const appName = blueprint?.appName ? `'${blueprint.appName}'` : "";
128412
+ const primaryAction = `Customize the Wix CLI embedded script scaffolding for the app ${appName}`;
128413
+ const userMessage = (0, utils_1.buildUserPromptForCodeGenerationAgent)(params, primaryAction);
128414
+ const model = (0, anthropic_1.createAnthropic)({ apiKey: this.apiKey })("claude-sonnet-4-20250514");
128415
+ const result = await (0, ai_1.generateObject)({
128416
+ model,
128417
+ schema: exports2.EmbeddedScriptSchema,
128418
+ messages: [
128419
+ {
128420
+ role: "system",
128421
+ content: systemPrompt,
128422
+ providerOptions: (0, utils_1.withCaching)("1h")
128423
+ },
128424
+ {
128425
+ role: "user",
128426
+ content: userMessage
128427
+ }
128428
+ ],
128429
+ experimental_telemetry: {
128430
+ isEnabled: true,
128431
+ functionId: this.name
128432
+ },
128433
+ maxOutputTokens: 1e4,
128434
+ maxRetries: 3,
128435
+ temperature: 0
128436
+ });
128437
+ return {
128438
+ files: result.object.files,
128439
+ scriptType: result.object.scriptType,
128440
+ placement: result.object.placement
128441
+ };
128442
+ }
128443
+ };
128444
+ exports2.EmbeddedScriptAgent = EmbeddedScriptAgent;
128445
+ exports2.default = EmbeddedScriptAgent;
128446
+ }
128447
+ });
128448
+
127406
128449
  // dist/agents/AgentsFactory.js
127407
128450
  var require_AgentsFactory = __commonJS({
127408
128451
  "dist/agents/AgentsFactory.js"(exports2) {
@@ -127418,12 +128461,14 @@ var require_AgentsFactory = __commonJS({
127418
128461
  var CMSAgent_1 = require_CMSAgent();
127419
128462
  var CMSDataAgent_1 = require_CMSDataAgent();
127420
128463
  var SiteComponentAgent_1 = __importDefault2(require_SiteComponentAgent());
128464
+ var BackendEventAgent_1 = __importDefault2(require_BackendEventAgent());
127421
128465
  var BackendApiAgent_1 = require_BackendApiAgent();
127422
128466
  var IterationAgent_1 = __importDefault2(require_IterationAgent());
127423
128467
  var CustomElementAgent_1 = __importDefault2(require_CustomElementAgent());
127424
128468
  var DashboardPageAgent_1 = __importDefault2(require_DashboardPageAgent());
127425
128469
  var DashboardDecisionAgent_1 = require_DashboardDecisionAgent();
127426
128470
  var AutoPatternsGenerator_1 = require_AutoPatternsGenerator();
128471
+ var EmbeddedScriptAgent_1 = __importDefault2(require_EmbeddedScriptAgent());
127427
128472
  var AgentsFactory = class {
127428
128473
  constructor(apiKey) {
127429
128474
  this.apiKey = apiKey;
@@ -127448,10 +128493,14 @@ var require_AgentsFactory = __commonJS({
127448
128493
  return new AutoPatternsGenerator_1.AutoPatternsGenerator();
127449
128494
  case types_1.ExtensionType.SITE_COMPONENT:
127450
128495
  return new SiteComponentAgent_1.default(this.apiKey);
128496
+ case types_1.ExtensionType.BACKEND_EVENT:
128497
+ return new BackendEventAgent_1.default(this.apiKey);
127451
128498
  case types_1.ExtensionType.SITE_WIDGET:
127452
128499
  return new CustomElementAgent_1.default(this.apiKey);
127453
128500
  case types_1.ExtensionType.BACKEND_API:
127454
128501
  return new BackendApiAgent_1.BackendApiAgent(this.apiKey);
128502
+ case "EMBEDDED_SCRIPT":
128503
+ return new EmbeddedScriptAgent_1.default(this.apiKey);
127455
128504
  default:
127456
128505
  throw new Error(`Unsupported extension type for AI customization: ${extension.type}`);
127457
128506
  }
@@ -130025,8 +131074,9 @@ var require_extensionGenerators = __commonJS({
130025
131074
  var ditto_scaffolding_1 = require_dist13();
130026
131075
  var types_1 = require_types_impl();
130027
131076
  var ditto_scaffolding_2 = require_dist13();
131077
+ var EmbeddedScriptAgent_1 = require_EmbeddedScriptAgent();
130028
131078
  var ExtensionFactory = class {
130029
- static generateExtension(extension, outputPath, scaffoldPath) {
131079
+ static generateExtension({ extension, outputPath, scaffoldPath, generatedConfig }) {
130030
131080
  const scaffoldDir = path_1.default.dirname(scaffoldPath);
130031
131081
  const id = (0, crypto_1.randomUUID)();
130032
131082
  switch (extension.type) {
@@ -130084,11 +131134,60 @@ var require_extensionGenerators = __commonJS({
130084
131134
  });
130085
131135
  break;
130086
131136
  }
131137
+ case types_1.ExtensionType.EMBEDDED_SCRIPT: {
131138
+ const name = extension.name || "My Embedded Script";
131139
+ const { placement, scriptType } = generatedConfig?.type === types_1.ExtensionType.EMBEDDED_SCRIPT ? generatedConfig : {
131140
+ placement: EmbeddedScriptAgent_1.EmbeddedScriptPlacement.HEAD,
131141
+ scriptType: EmbeddedScriptAgent_1.EmbeddedScriptType.ESSENTIAL
131142
+ };
131143
+ const extensionConfig = this.createEmbeddedScriptData(id, name, scaffoldDir, placement, scriptType);
131144
+ writeExtensionFile({
131145
+ outputPath,
131146
+ name,
131147
+ builderMethodName: "embeddedScript",
131148
+ extensionConfig,
131149
+ extensionType: extension.type,
131150
+ scaffoldDir
131151
+ });
131152
+ break;
131153
+ }
131154
+ case types_1.ExtensionType.BACKEND_EVENT: {
131155
+ const name = extension.name || "My Backend Event";
131156
+ const extensionConfig = this.createBackendEventData(id, extension.relatedApis || [], scaffoldDir);
131157
+ writeExtensionFile({
131158
+ outputPath,
131159
+ name,
131160
+ builderMethodName: "webhook",
131161
+ extensionConfig,
131162
+ extensionType: extension.type,
131163
+ scaffoldDir
131164
+ });
131165
+ break;
131166
+ }
130087
131167
  default:
130088
131168
  console.log(`Skipping extension type: ${extension.type}. It doesn't need presence in the extensions.ts file (e.g. Backend API is astro only)`);
130089
131169
  return;
130090
131170
  }
130091
131171
  }
131172
+ static createBackendEventData(id, relatedApis, scaffoldDir) {
131173
+ const slug = this.getSlugFromBlueprint(relatedApis || []);
131174
+ const source = getScaffoldPath(scaffoldDir, "event.ts");
131175
+ return { id, slug, source };
131176
+ }
131177
+ static getSlugFromBlueprint(relatedApis) {
131178
+ if (!Array.isArray(relatedApis) || relatedApis.length === 0) {
131179
+ throw new Error("Backend event extension must have at least one related API");
131180
+ }
131181
+ for (const api of relatedApis) {
131182
+ const apiName = api?.name;
131183
+ if (!apiName)
131184
+ continue;
131185
+ const slug = this.apiToSlug[apiName];
131186
+ if (slug)
131187
+ return slug;
131188
+ }
131189
+ throw new Error("No valid slug found for backend event");
131190
+ }
130092
131191
  static getServicePluginType(ext) {
130093
131192
  if (!ext.relatedSpis || ext.relatedSpis.length !== 1) {
130094
131193
  throw new Error("Service plugin extension must have only one related SPI");
@@ -130100,7 +131199,7 @@ var require_extensionGenerators = __commonJS({
130100
131199
  throw new Error("No valid service plugin type found for service plugin");
130101
131200
  }
130102
131201
  static createServicePluginData(name, scaffoldDir, id, servicePluginType) {
130103
- const source = "./" + path_1.default.join(scaffoldDir, "plugin.ts").replace(/^src\//, "");
131202
+ const source = getScaffoldPath(scaffoldDir, "plugin.ts");
130104
131203
  switch (servicePluginType) {
130105
131204
  case "ecom-shipping-rates":
130106
131205
  return {
@@ -130124,7 +131223,7 @@ var require_extensionGenerators = __commonJS({
130124
131223
  }
130125
131224
  static createDashboardPageData(id, name, scaffoldDir) {
130126
131225
  const routePath = name.toLowerCase().replace(/\s+/g, "-");
130127
- const component = "./" + path_1.default.join(scaffoldDir, "page.tsx").replace(/^src\//, "");
131226
+ const component = getScaffoldPath(scaffoldDir, "page.tsx");
130128
131227
  return {
130129
131228
  id,
130130
131229
  title: name,
@@ -130134,7 +131233,7 @@ var require_extensionGenerators = __commonJS({
130134
131233
  }
130135
131234
  static createCustomElementData(id, name, scaffoldDir) {
130136
131235
  const kebabCaseComponentName = (0, ditto_scaffolding_2.toKebabCase)(name);
130137
- const componentPath = "./" + path_1.default.join(scaffoldDir, "widget.tsx").replace(/^src\//, "");
131236
+ const componentPath = getScaffoldPath(scaffoldDir, "widget.tsx");
130138
131237
  return {
130139
131238
  id,
130140
131239
  name,
@@ -130149,7 +131248,7 @@ var require_extensionGenerators = __commonJS({
130149
131248
  }
130150
131249
  static createSiteComponentData(name, scaffoldDir, id) {
130151
131250
  const kebabCaseComponentName = (0, ditto_scaffolding_2.toKebabCase)(name);
130152
- const componentPath = "./" + path_1.default.join(scaffoldDir, "component.tsx").replace(/^src\//, "");
131251
+ const componentPath = getScaffoldPath(scaffoldDir, "component.tsx");
130153
131252
  return {
130154
131253
  id,
130155
131254
  description: name,
@@ -130165,6 +131264,16 @@ var require_extensionGenerators = __commonJS({
130165
131264
  }
130166
131265
  };
130167
131266
  }
131267
+ static createEmbeddedScriptData(id, name, scaffoldDir, placement, scriptType) {
131268
+ const source = getScaffoldPath(scaffoldDir, "embedded.html");
131269
+ return {
131270
+ id,
131271
+ name,
131272
+ source,
131273
+ placement,
131274
+ scriptType
131275
+ };
131276
+ }
130168
131277
  };
130169
131278
  exports2.ExtensionFactory = ExtensionFactory;
130170
131279
  ExtensionFactory.servicePluginBuilderMap = {
@@ -130175,6 +131284,14 @@ var require_extensionGenerators = __commonJS({
130175
131284
  "gift-cards-provider": "ecomGiftCardsProvider",
130176
131285
  "ecom-payment-settings": "ecomPaymentSettings"
130177
131286
  };
131287
+ ExtensionFactory.apiToSlug = {
131288
+ "stores.productsV3.onProductCreated": "wix.stores.catalog.v3.product_created",
131289
+ "crm.contacts.onContactCreated": "wix.contacts.v4.contact_created",
131290
+ "data.items.onDataItemCreated": "wix.data.v2.data_item_created"
131291
+ };
131292
+ function getScaffoldPath(scaffoldDir, file) {
131293
+ return "./" + path_1.default.join(scaffoldDir, file).replace(/^src\//, "");
131294
+ }
130178
131295
  function writeExtensionFile({ outputPath, name, builderMethodName, extensionConfig, extensionType, scaffoldDir }) {
130179
131296
  const sanitizedName = name.replace(/[^a-zA-Z0-9\s-_]/g, "").trim();
130180
131297
  if (!sanitizedName) {
@@ -136893,6 +138010,7 @@ var require_orchestrator = __commonJS({
136893
138010
  this.emitEvent("planner:start", {});
136894
138011
  const planner = this.agentsFactory.getAgent({ type: "PLANNER" });
136895
138012
  const plan = await planner.generate(blueprint);
138013
+ console.log("Plan", JSON.stringify(plan));
136896
138014
  this.emitEvent("planner:done", {});
136897
138015
  const createdCollections = [];
136898
138016
  if (plan?.collections?.length > 0) {
@@ -136918,6 +138036,9 @@ var require_orchestrator = __commonJS({
136918
138036
  if (plan?.apiSpec) {
136919
138037
  result.apiSpec = plan.apiSpec;
136920
138038
  }
138039
+ if (plan?.embeddedScriptParameters) {
138040
+ result.embeddedScriptParameters = plan.embeddedScriptParameters;
138041
+ }
136921
138042
  return result;
136922
138043
  }
136923
138044
  async runIterationPlanningAndAugmentExtensions(outputPath, chatHistory) {
@@ -136945,6 +138066,13 @@ var require_orchestrator = __commonJS({
136945
138066
  outputPath,
136946
138067
  planAndResources
136947
138068
  });
138069
+ case types_1.ExtensionType.EMBEDDED_SCRIPT:
138070
+ return this.processEmbeddedScript({
138071
+ extension,
138072
+ blueprint,
138073
+ outputPath,
138074
+ planAndResources
138075
+ });
136948
138076
  default:
136949
138077
  return this.processStandardExtension({
136950
138078
  extension,
@@ -136954,11 +138082,60 @@ var require_orchestrator = __commonJS({
136954
138082
  });
136955
138083
  }
136956
138084
  }
138085
+ async processEmbeddedScript(opts) {
138086
+ const { extension, blueprint, outputPath, planAndResources } = opts;
138087
+ this.emitEvent("scaffold:start", { extension });
138088
+ const scaffolds = await (0, ditto_scaffolding_1.copyScaffoldingTemplate)(extension, outputPath);
138089
+ if (!scaffolds || scaffolds.length === 0) {
138090
+ throw new Error(`\u274C Failed to scaffold ${extension.type}`);
138091
+ }
138092
+ const scaffold = scaffolds[0];
138093
+ this.emitEvent("scaffold:done", {
138094
+ extension,
138095
+ scaffoldPath: scaffolds.map((s) => s.path).join(", ")
138096
+ });
138097
+ const embeddedScriptAgent = this.agentsFactory.getAgent({
138098
+ type: "EMBEDDED_SCRIPT"
138099
+ });
138100
+ this.emitEvent("agent:start", {
138101
+ extension,
138102
+ name: embeddedScriptAgent.name
138103
+ });
138104
+ const { files, scriptType, placement } = await embeddedScriptAgent.generate({
138105
+ extension,
138106
+ blueprint,
138107
+ scaffold,
138108
+ basePath: outputPath,
138109
+ planAndResources
138110
+ });
138111
+ this.writeFile(files, outputPath);
138112
+ extensionGenerators_1.ExtensionFactory.generateExtension({
138113
+ extension,
138114
+ outputPath,
138115
+ scaffoldPath: scaffold.path,
138116
+ generatedConfig: {
138117
+ type: types_1.ExtensionType.EMBEDDED_SCRIPT,
138118
+ scriptType,
138119
+ placement
138120
+ }
138121
+ });
138122
+ this.emitEvent("agent:done", {
138123
+ extension,
138124
+ name: embeddedScriptAgent.name,
138125
+ files
138126
+ });
138127
+ }
136957
138128
  async processDashboardPage(opts) {
138129
+ const { extension, blueprint, outputPath, planAndResources } = opts;
136958
138130
  const decisionAgent = this.agentsFactory.getAgent({
136959
138131
  type: "DASHBOARD_DECISION"
136960
138132
  });
136961
- const decision = await decisionAgent.generate(opts);
138133
+ const decision = await decisionAgent.generate({
138134
+ extension,
138135
+ blueprint,
138136
+ planAndResources,
138137
+ basePath: outputPath
138138
+ });
136962
138139
  const useAutoPatterns = decision.useAutoPatterns && decision.schema && decision.relevantCollectionId;
136963
138140
  if (!useAutoPatterns) {
136964
138141
  console.log("\u{1F3A8} Using custom code generation for dashboard");
@@ -136966,8 +138143,7 @@ var require_orchestrator = __commonJS({
136966
138143
  return;
136967
138144
  }
136968
138145
  console.log("\u{1F3AF} Using auto-patterns for dashboard generation");
136969
- const { extension, outputPath, planAndResources: { createdCollections = [] } = {} } = opts;
136970
- const relevantCollection = createdCollections.find((c) => c.id === decision.relevantCollectionId);
138146
+ const relevantCollection = planAndResources.createdCollections?.find((c) => c.id === decision.relevantCollectionId);
136971
138147
  if (!relevantCollection) {
136972
138148
  throw new Error(`\u274C Collection with ID ${decision.relevantCollectionId} not found in created collections`);
136973
138149
  }
@@ -136985,7 +138161,11 @@ var require_orchestrator = __commonJS({
136985
138161
  });
136986
138162
  this.writeFile(files, outputPath);
136987
138163
  const pagePath = files[0].path || "";
136988
- extensionGenerators_1.ExtensionFactory.generateExtension(extension, outputPath, pagePath);
138164
+ extensionGenerators_1.ExtensionFactory.generateExtension({
138165
+ extension,
138166
+ outputPath,
138167
+ scaffoldPath: pagePath
138168
+ });
136989
138169
  this.emitEvent("agent:done", {
136990
138170
  extension,
136991
138171
  name: "AutoPatternsGenerator",
@@ -137022,7 +138202,11 @@ var require_orchestrator = __commonJS({
137022
138202
  basePath: outputPath
137023
138203
  });
137024
138204
  this.writeFile(files, outputPath);
137025
- extensionGenerators_1.ExtensionFactory.generateExtension(extension, outputPath, scaffold.path);
138205
+ extensionGenerators_1.ExtensionFactory.generateExtension({
138206
+ extension,
138207
+ outputPath,
138208
+ scaffoldPath: scaffold.path
138209
+ });
137026
138210
  this.emitEvent("agent:done", { extension, name: agent.name, files });
137027
138211
  }
137028
138212
  async processStandardExtension({ extension, blueprint, outputPath, planAndResources }) {
@@ -137046,7 +138230,11 @@ var require_orchestrator = __commonJS({
137046
138230
  basePath: outputPath
137047
138231
  });
137048
138232
  this.writeFile(files, outputPath);
137049
- extensionGenerators_1.ExtensionFactory.generateExtension(extension, outputPath, scaffold.path);
138233
+ extensionGenerators_1.ExtensionFactory.generateExtension({
138234
+ extension,
138235
+ outputPath,
138236
+ scaffoldPath: scaffold.path
138237
+ });
137050
138238
  this.emitEvent("agent:done", { extension, name: agent.name, files });
137051
138239
  }
137052
138240
  async processMultipleServicePluginScaffolds({ extension, blueprint, outputPath, planAndResources, scaffolds }) {
@@ -137075,7 +138263,11 @@ var require_orchestrator = __commonJS({
137075
138263
  basePath: outputPath
137076
138264
  });
137077
138265
  this.writeFile(files, outputPath);
137078
- extensionGenerators_1.ExtensionFactory.generateExtension(spiExtension, outputPath, scaffold.path);
138266
+ extensionGenerators_1.ExtensionFactory.generateExtension({
138267
+ extension: spiExtension,
138268
+ outputPath,
138269
+ scaffoldPath: scaffold.path
138270
+ });
137079
138271
  this.emitEvent("agent:done", {
137080
138272
  extension: spiExtension,
137081
138273
  name: agent.name,
@@ -137117,7 +138309,11 @@ var require_orchestrator = __commonJS({
137117
138309
  basePath: outputPath
137118
138310
  });
137119
138311
  this.writeFile(files, outputPath);
137120
- extensionGenerators_1.ExtensionFactory.generateExtension(extension, outputPath, scaffold.path);
138312
+ extensionGenerators_1.ExtensionFactory.generateExtension({
138313
+ extension,
138314
+ outputPath,
138315
+ scaffoldPath: scaffold.path
138316
+ });
137121
138317
  this.emitEvent("agent:done", {
137122
138318
  extension,
137123
138319
  name: agent.name,