@wix/ditto-codegen-public 1.0.64 → 1.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/out.js +94 -15
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -77738,6 +77738,58 @@ ${apiDocs}
77738
77738
  }
77739
77739
  });
77740
77740
 
77741
+ // dist/system-prompts/useElevate.js
77742
+ var require_useElevate = __commonJS({
77743
+ "dist/system-prompts/useElevate.js"(exports2) {
77744
+ "use strict";
77745
+ Object.defineProperty(exports2, "__esModule", { value: true });
77746
+ exports2.useElevate = void 0;
77747
+ var useElevate = () => {
77748
+ return `
77749
+ <authentication_elevation_requirement>
77750
+ When doing API calls, you have to elevate permissions.
77751
+ <example>
77752
+
77753
+ \`\`\`typescript
77754
+ import { auth } from "@wix/essentials";
77755
+ import { items } from "@wix/data";
77756
+ export const myFunction = async () => {
77757
+ const elevatedFunction = auth.elevate(items.query);
77758
+ const elevatedResponse = await elevatedFunction("myCollection");
77759
+ return elevatedResponse;
77760
+ });
77761
+ \`\`\`
77762
+
77763
+ </example>
77764
+ <example>
77765
+ \`\`\`typescript
77766
+ import { auth } from "@wix/essentials";
77767
+ import { cart } from "@wix/ecom";
77768
+ export const myFunction = async () => {
77769
+ const elevatedFunction = auth.elevate(cart.getCart);
77770
+ const elevatedResponse = await elevatedFunction("cart-id");
77771
+ return elevatedResponse;
77772
+ };
77773
+ \`\`\`
77774
+ </example>
77775
+ <example>
77776
+ \`\`\`typescript
77777
+ import { auth } from "@wix/essentials";
77778
+ import { products } from "@wix/stores";
77779
+ export const myFunction = async () => {
77780
+ const elevatedFunction = auth.elevate(products.deleteCollection);
77781
+ const elevatedResponse = await elevatedFunction("collection-id");
77782
+ return elevatedResponse;
77783
+ };
77784
+ \`\`\`
77785
+ </example>
77786
+ </authentication_elevation_requirement>
77787
+ `;
77788
+ };
77789
+ exports2.useElevate = useElevate;
77790
+ }
77791
+ });
77792
+
77741
77793
  // dist/system-prompts/servicePlugin/servicePluginPrompt.js
77742
77794
  var require_servicePluginPrompt = __commonJS({
77743
77795
  "dist/system-prompts/servicePlugin/servicePluginPrompt.js"(exports2) {
@@ -77747,9 +77799,11 @@ var require_servicePluginPrompt = __commonJS({
77747
77799
  exports2.getServicePluginPrompt = getServicePluginPrompt;
77748
77800
  var servicePluginDocLoader_1 = require_servicePluginDocLoader();
77749
77801
  var apiDocLoader_1 = require_apiDocLoader();
77802
+ var useElevate_1 = require_useElevate();
77750
77803
  function getServicePluginPrompt(spiNames = [], apiNames = []) {
77751
77804
  const servicePluginDocs = (0, servicePluginDocLoader_1.loadServicePluginDocumentation)(spiNames);
77752
77805
  const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames);
77806
+ const elevate = (0, useElevate_1.useElevate)();
77753
77807
  return `
77754
77808
  <WIXCLI_SERVICE_PLUGIN_SYSTEM_PROMPT>
77755
77809
 
@@ -77862,6 +77916,7 @@ When integrating with external services:
77862
77916
  <available_service_plugins>
77863
77917
  ${servicePluginDocs}
77864
77918
  </available_service_plugins>
77919
+ ${elevate}
77865
77920
  ${apiDocs}
77866
77921
  `;
77867
77922
  }
@@ -121046,15 +121101,20 @@ Use dynamic parameters when:
121046
121101
  - Different instances or configurations are needed for different sites
121047
121102
  - Content, styling, or functionality needs to be adjusted through a UI
121048
121103
 
121049
- Do NOT use dynamic parameters when:
121050
- - The script is fully static and requires no configuration
121051
- - All values are hardcoded and never need to change
121104
+ IMPORTANT: If an embedded script extension exists but doesn't need specific dynamic parameters, you should ALWAYS add at least one dynamic parameter: an enable/disable toggle. This allows site owners to control whether the embedded script is active without removing it entirely.
121105
+
121106
+ Example of minimum enable/disable parameter:
121107
+ {
121108
+ "key": "enabled",
121109
+ "displayName": "Enable",
121110
+ "type": "BOOLEAN",
121111
+ "description": "Enable or disable this feature",
121112
+ "required": true,
121113
+ "defaultValue": "true"
121114
+ }
121052
121115
  </when_to_use_dynamic_parameters>
121053
121116
 
121054
121117
  <output_structure>
121055
- Your output must include an array of embeddedScriptParameters. This array can be:
121056
- - Empty array [] if there are no EMBEDDED_SCRIPT extensions in the blueprint or no dynamic parameters are needed
121057
- - Array of embedded script parameter objects if there are EMBEDDED_SCRIPT extensions
121058
121118
 
121059
121119
  Each embedded script parameter object contains:
121060
121120
  - extensionId (string): The name of the embedded script extension these parameters belong to (use the extension.name field)
@@ -121071,8 +121131,6 @@ Each dynamic parameter must include:
121071
121131
 
121072
121132
  Example output structures:
121073
121133
 
121074
- No embedded script extensions:
121075
- []
121076
121134
 
121077
121135
  With embedded script extensions:
121078
121136
  [
@@ -121164,18 +121222,26 @@ Output:
121164
121222
  }
121165
121223
  ]
121166
121224
 
121167
- Example 2 - Static Pixel (no dynamic parameters needed):
121225
+ Example 2 - Static Pixel (minimal dynamic parameters):
121168
121226
  Blueprint: Add a Facebook Pixel with a hardcoded pixel ID
121169
121227
  Extension Name: "facebook-pixel"
121170
- Output: []
121228
+ Output:
121229
+ {
121230
+ "key": "enabled",
121231
+ "displayName": "Enable",
121232
+ "type": "BOOLEAN",
121233
+ "description": "Enable or disable this feature",
121234
+ "required": true,
121235
+ "defaultValue": "true"
121236
+ }
121171
121237
 
121172
121238
  </examples>
121173
121239
 
121174
121240
  <guidelines>
121175
- - If there are NO EMBEDDED_SCRIPT extensions in the blueprint, return an empty array: "embeddedScriptParameters": []
121176
- - If there are EMBEDDED_SCRIPT extensions, ONLY include them if they truly need configurable parameters
121241
+ - If there are EMBEDDED_SCRIPT extensions, you MUST always include at least one parameter per extension
121242
+ - At minimum, every embedded script should have an enable/disable parameter to allow site owners to control activation
121177
121243
  - The extensionId MUST match the exact name of the embedded script extension from the blueprint
121178
- - Only define parameters that truly need to be configurable by the site owner
121244
+ - Define additional parameters only if they truly need to be configurable by the site owner
121179
121245
  - Keep parameter keys descriptive and in lowerCamelCase
121180
121246
  - Provide clear displayName and description for each parameter
121181
121247
  - Set appropriate required flags based on functionality needs
@@ -124954,8 +125020,10 @@ var require_backendEventPrompt = __commonJS({
124954
125020
  Object.defineProperty(exports2, "__esModule", { value: true });
124955
125021
  exports2.backendEventPrompt = void 0;
124956
125022
  var apiDocLoader_1 = require_apiDocLoader();
125023
+ var useElevate_1 = require_useElevate();
124957
125024
  var backendEventPrompt = (apiNames) => {
124958
125025
  const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames);
125026
+ const elevate = (0, useElevate_1.useElevate)();
124959
125027
  return `<BACKEND_EVENT_PROMPT>
124960
125028
  <role>
124961
125029
  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.
@@ -124989,6 +125057,7 @@ You are a Wix backend event handler generator. Create event extensions for Wix C
124989
125057
  - Reference the corresponding SDK submodule category for event-specific information
124990
125058
  - Events run automatically when triggered - no manual invocation needed
124991
125059
  </implementation_guidelines>
125060
+ ${elevate}
124992
125061
  ${apiDocs}
124993
125062
  </BACKEND_EVENT_PROMPT>`;
124994
125063
  };
@@ -127455,6 +127524,7 @@ var require_DashboardDecisionAgent = __commonJS({
127455
127524
  var zod_1 = require_zod();
127456
127525
  var autoPatternPrompt_1 = require_autoPatternPrompt();
127457
127526
  var utils_1 = require_utils14();
127527
+ var types_1 = require_types_impl();
127458
127528
  var autoPatternsLlmConfig = zod_1.z.object({
127459
127529
  useAutoPatterns: zod_1.z.boolean(),
127460
127530
  schema: zod_1.z.object({
@@ -127512,9 +127582,18 @@ var require_DashboardDecisionAgent = __commonJS({
127512
127582
  buildSystemPrompt() {
127513
127583
  return (0, autoPatternPrompt_1.autoPatternDecisionPrompt)();
127514
127584
  }
127585
+ shouldNotUseAutoPatterns(params) {
127586
+ const { blueprint, planAndResources } = params;
127587
+ const hasEmbeddedScriptExtension = blueprint?.extensions?.some((ext) => ext.type === types_1.ExtensionType.EMBEDDED_SCRIPT) ?? false;
127588
+ const hasOneDashboardPageExtension = blueprint?.extensions?.filter((ext) => ext.type === types_1.ExtensionType.DASHBOARD_PAGE).length === 1;
127589
+ const shouldImplementEmbeddedScriptParameters = hasOneDashboardPageExtension && hasEmbeddedScriptExtension;
127590
+ if (!planAndResources?.createdCollections?.length || shouldImplementEmbeddedScriptParameters) {
127591
+ return true;
127592
+ }
127593
+ return false;
127594
+ }
127515
127595
  async generate(params) {
127516
- const { planAndResources } = params;
127517
- if (!planAndResources?.createdCollections?.length) {
127596
+ if (this.shouldNotUseAutoPatterns(params)) {
127518
127597
  return {
127519
127598
  useAutoPatterns: false
127520
127599
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -24,5 +24,5 @@
24
24
  "@wix/ditto-codegen": "1.0.0",
25
25
  "esbuild": "^0.25.9"
26
26
  },
27
- "falconPackageHash": "87d27be7506dec30b54f2aec3fe64ebc01e7066ab15633e83bbe1a44"
27
+ "falconPackageHash": "ccdf783fad507eccb98247f2632438eb41c1753aec8f47dabb8001c0"
28
28
  }