@wix/ditto-codegen-public 1.0.50 → 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.
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "my-custom-app",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "astro": "astro",
7
+ "dev": "wix dev",
8
+ "build": "wix build",
9
+ "wix": "wix",
10
+ "preview": "wix preview",
11
+ "release": "wix release",
12
+ "generate": "wix generate",
13
+ "env": "wix env"
14
+ },
15
+ "dependencies": {
16
+ "@wix/astro": "0.0.4-experimental-react-component",
17
+ "@wix/crm": "^1.0.1071",
18
+ "@wix/dashboard": "^1.3.36",
19
+ "@wix/data": "^1.0.290",
20
+ "@wix/design-system": "^1.111.0",
21
+ "@wix/ecom": "^1.0.1354",
22
+ "@wix/essentials": "^0.1.23",
23
+ "@wix/sdk": "^1.15.23",
24
+ "@wix/stores": "^1.0.533",
25
+ "astro": "^5.8.0",
26
+ "typescript": "^5.8.3"
27
+ },
28
+ "devDependencies": {
29
+ "@astrojs/cloudflare": "^12.5.3",
30
+ "@astrojs/react": "^4.3.0",
31
+ "@types/react": "^18.3.1",
32
+ "@types/react-dom": "^18.3.1",
33
+ "@wix/cli": "^1.1.92",
34
+ "react": "18.3.1",
35
+ "react-dom": "18.3.1"
36
+ }
37
+ }
@@ -0,0 +1,67 @@
1
+ import { productsV3 } from '@wix/stores';
2
+ import { items } from '@wix/data';
3
+
4
+ productsV3.onProductCreated(async (event) => {
5
+ const productIdFromEvent = event.entity?._id;
6
+ try {
7
+ console.log('Product created event triggered:', event);
8
+
9
+ // Extract product information from the event
10
+ const productId = productIdFromEvent;
11
+
12
+ if (!productId) {
13
+ console.error('No product ID found in event');
14
+ return;
15
+ }
16
+
17
+ const product = event.entity;
18
+
19
+ // Create detailed creation information
20
+ const creationDetails = {
21
+ productName: product.name || 'Unknown Product',
22
+ productSlug: product.slug,
23
+ visible: product.visible,
24
+ inventory: product.inventory,
25
+ brand: product.brand
26
+ };
27
+
28
+ // Create log entry in the product-creation-logs collection
29
+ const logEntry = {
30
+ productId: productId,
31
+ changeType: 'PRODUCT_CREATED',
32
+ changedFields: ['CREATED'],
33
+ timestamp: new Date(),
34
+ changeDetails: JSON.stringify(creationDetails, null, 2)
35
+ };
36
+
37
+ // Insert the log entry into the collection
38
+ await items.insert('product-creation-logs', logEntry);
39
+
40
+ console.log('Product creation logged successfully:', {
41
+ productId,
42
+ productName: product.name,
43
+ changedFields: logEntry.changedFields,
44
+ timestamp: logEntry.timestamp
45
+ });
46
+
47
+ } catch (error) {
48
+ console.error('Error processing product creation event:', {
49
+ productId: productIdFromEvent || 'unknown',
50
+ error: error instanceof Error ? error.message : String(error),
51
+ timestamp: new Date()
52
+ });
53
+
54
+ // Try to log the error to the collection as well
55
+ try {
56
+ await items.insert('product-creation-logs', {
57
+ productId: productIdFromEvent || 'unknown',
58
+ changeType: 'ERROR',
59
+ changedFields: [],
60
+ timestamp: new Date(),
61
+ changeDetails: `Error processing product creation: ${error instanceof Error ? error.message : String(error)}`
62
+ });
63
+ } catch (logError) {
64
+ console.error('Failed to log error to collection:', logError);
65
+ }
66
+ }
67
+ });
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "astro/tsconfigs/strict",
3
+ "include": [".astro/types.d.ts", "**/*"],
4
+ "exclude": ["dist"]
5
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "appId": "54ed7c99-07c1-4992-b961-f5b4a9bd6d7f",
3
+ "siteId": "6e13b6b4-0b79-4c81-b430-d9b6a0c8e4f9"
4
+ }
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
  });
@@ -120427,6 +120449,7 @@ var require_load_examples = __commonJS({
120427
120449
  types2[types2["ServicePluginExtension"] = 3] = "ServicePluginExtension";
120428
120450
  types2[types2["CustomElementPlugin"] = 4] = "CustomElementPlugin";
120429
120451
  types2[types2["CustomElementWidget"] = 5] = "CustomElementWidget";
120452
+ types2[types2["BackendEvent"] = 6] = "BackendEvent";
120430
120453
  })(types || (exports2.types = types = {}));
120431
120454
  var appsExamples = {
120432
120455
  AIChatbot: {
@@ -120581,6 +120604,24 @@ var require_load_examples = __commonJS({
120581
120604
  "event-countdown/src/site/embedded-scripts/countdown-timer/embedded.html"
120582
120605
  ]
120583
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
+ }
120584
120625
  }
120585
120626
  };
120586
120627
  exports2.examples = {
@@ -120604,7 +120645,11 @@ var require_load_examples = __commonJS({
120604
120645
  ],
120605
120646
  [types.ServicePluginExtension]: [appsExamples.SPISExample],
120606
120647
  [types.CustomElementPlugin]: [appsExamples.InventoryCountdown],
120607
- [types.CustomElementWidget]: [appsExamples.CustomElementWidget]
120648
+ [types.CustomElementWidget]: [appsExamples.CustomElementWidget],
120649
+ [types.BackendEvent]: [
120650
+ appsExamples.ProductCreatedLogger,
120651
+ appsExamples.ContactCreatedLogger
120652
+ ]
120608
120653
  };
120609
120654
  var loadExamples = (pluginTypes) => {
120610
120655
  const examplesAppsBasePath = path_1.default.join(__dirname, "examples-apps");
@@ -124916,6 +124961,174 @@ var require_SiteComponentAgent = __commonJS({
124916
124961
  }
124917
124962
  });
124918
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
+
124919
125132
  // dist/system-prompts/backend/backendApi.js
124920
125133
  var require_backendApi = __commonJS({
124921
125134
  "dist/system-prompts/backend/backendApi.js"(exports2) {
@@ -128248,6 +128461,7 @@ var require_AgentsFactory = __commonJS({
128248
128461
  var CMSAgent_1 = require_CMSAgent();
128249
128462
  var CMSDataAgent_1 = require_CMSDataAgent();
128250
128463
  var SiteComponentAgent_1 = __importDefault2(require_SiteComponentAgent());
128464
+ var BackendEventAgent_1 = __importDefault2(require_BackendEventAgent());
128251
128465
  var BackendApiAgent_1 = require_BackendApiAgent();
128252
128466
  var IterationAgent_1 = __importDefault2(require_IterationAgent());
128253
128467
  var CustomElementAgent_1 = __importDefault2(require_CustomElementAgent());
@@ -128279,6 +128493,8 @@ var require_AgentsFactory = __commonJS({
128279
128493
  return new AutoPatternsGenerator_1.AutoPatternsGenerator();
128280
128494
  case types_1.ExtensionType.SITE_COMPONENT:
128281
128495
  return new SiteComponentAgent_1.default(this.apiKey);
128496
+ case types_1.ExtensionType.BACKEND_EVENT:
128497
+ return new BackendEventAgent_1.default(this.apiKey);
128282
128498
  case types_1.ExtensionType.SITE_WIDGET:
128283
128499
  return new CustomElementAgent_1.default(this.apiKey);
128284
128500
  case types_1.ExtensionType.BACKEND_API:
@@ -130935,11 +131151,43 @@ var require_extensionGenerators = __commonJS({
130935
131151
  });
130936
131152
  break;
130937
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
+ }
130938
131167
  default:
130939
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)`);
130940
131169
  return;
130941
131170
  }
130942
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
+ }
130943
131191
  static getServicePluginType(ext) {
130944
131192
  if (!ext.relatedSpis || ext.relatedSpis.length !== 1) {
130945
131193
  throw new Error("Service plugin extension must have only one related SPI");
@@ -130951,7 +131199,7 @@ var require_extensionGenerators = __commonJS({
130951
131199
  throw new Error("No valid service plugin type found for service plugin");
130952
131200
  }
130953
131201
  static createServicePluginData(name, scaffoldDir, id, servicePluginType) {
130954
- const source = "./" + path_1.default.join(scaffoldDir, "plugin.ts").replace(/^src\//, "");
131202
+ const source = getScaffoldPath(scaffoldDir, "plugin.ts");
130955
131203
  switch (servicePluginType) {
130956
131204
  case "ecom-shipping-rates":
130957
131205
  return {
@@ -130975,7 +131223,7 @@ var require_extensionGenerators = __commonJS({
130975
131223
  }
130976
131224
  static createDashboardPageData(id, name, scaffoldDir) {
130977
131225
  const routePath = name.toLowerCase().replace(/\s+/g, "-");
130978
- const component = "./" + path_1.default.join(scaffoldDir, "page.tsx").replace(/^src\//, "");
131226
+ const component = getScaffoldPath(scaffoldDir, "page.tsx");
130979
131227
  return {
130980
131228
  id,
130981
131229
  title: name,
@@ -130985,7 +131233,7 @@ var require_extensionGenerators = __commonJS({
130985
131233
  }
130986
131234
  static createCustomElementData(id, name, scaffoldDir) {
130987
131235
  const kebabCaseComponentName = (0, ditto_scaffolding_2.toKebabCase)(name);
130988
- const componentPath = "./" + path_1.default.join(scaffoldDir, "widget.tsx").replace(/^src\//, "");
131236
+ const componentPath = getScaffoldPath(scaffoldDir, "widget.tsx");
130989
131237
  return {
130990
131238
  id,
130991
131239
  name,
@@ -131000,7 +131248,7 @@ var require_extensionGenerators = __commonJS({
131000
131248
  }
131001
131249
  static createSiteComponentData(name, scaffoldDir, id) {
131002
131250
  const kebabCaseComponentName = (0, ditto_scaffolding_2.toKebabCase)(name);
131003
- const componentPath = "./" + path_1.default.join(scaffoldDir, "component.tsx").replace(/^src\//, "");
131251
+ const componentPath = getScaffoldPath(scaffoldDir, "component.tsx");
131004
131252
  return {
131005
131253
  id,
131006
131254
  description: name,
@@ -131017,7 +131265,7 @@ var require_extensionGenerators = __commonJS({
131017
131265
  };
131018
131266
  }
131019
131267
  static createEmbeddedScriptData(id, name, scaffoldDir, placement, scriptType) {
131020
- const source = "./" + path_1.default.join(scaffoldDir, "embedded.html").replace(/^src\//, "");
131268
+ const source = getScaffoldPath(scaffoldDir, "embedded.html");
131021
131269
  return {
131022
131270
  id,
131023
131271
  name,
@@ -131036,6 +131284,14 @@ var require_extensionGenerators = __commonJS({
131036
131284
  "gift-cards-provider": "ecomGiftCardsProvider",
131037
131285
  "ecom-payment-settings": "ecomPaymentSettings"
131038
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
+ }
131039
131295
  function writeExtensionFile({ outputPath, name, builderMethodName, extensionConfig, extensionType, scaffoldDir }) {
131040
131296
  const sanitizedName = name.replace(/[^a-zA-Z0-9\s-_]/g, "").trim();
131041
131297
  if (!sanitizedName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.50",
3
+ "version": "1.0.51",
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": "27597af53280a5e7594b7c5eca0423a2a6ef6e723e2d2abc57bcb02d"
27
+ "falconPackageHash": "efcbb303a4740c425b38bdb2dc6536ed5d7a6d2f7a04c1dd8c296fd9"
28
28
  }