@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
@@ -0,0 +1,183 @@
1
+ <crm_contacts_onContactCreated>
2
+ <purpose>Registers a callback function as an event handler. Triggered when a contact is created. This method registers a callback function as an event handler. When developing websites or building apps with Blocks, use a Velo backend event instead of this method. The way you call this method differs depending on the framework you are working in: When using the CLI, run the generate command to add an event extension, and then call this method within the extension code. When building a self-hosted app, subscribe your app to the relevant event, and then call this method on your server.</purpose>
3
+ <use_cases>
4
+ - Trigger welcome emails or onboarding automations when a contact is created
5
+ - Sync new contacts to external CRMs or marketing systems
6
+ - Enrich newly created contacts with third-party data
7
+ - Assign labels or segments to new contacts based on rules
8
+ - Log contact creation events for analytics and monitoring
9
+ </use_cases>
10
+
11
+ <method_declaration>
12
+ contacts.onContactCreated(handler)
13
+ </method_declaration>
14
+ <required_parameters>
15
+ - handler: function - handler(event: ContactCreatedEnvelope): void | Promise<void>
16
+ </required_parameters>
17
+ <optional_parameters>
18
+ None
19
+ </optional_parameters>
20
+ <import>import { contacts } from '@wix/crm'</import>
21
+ <types>
22
+
23
+ **ContactCreatedEnvelope**
24
+ Properties:
25
+ - event: ContactCreatedEnvelope - The contact creation event envelope
26
+
27
+ **ContactCreatedEnvelope**
28
+ Properties:
29
+ - entity: Contact - The created contact entity
30
+ - metadata: EventMetadata - Event metadata
31
+
32
+ **Contact**
33
+ Properties:
34
+ - _createdDate: Date - Date and time the contact was created.
35
+ - _id: string - Contact ID
36
+ - _updatedDate: Date - Date and time the contact was last updated.
37
+ - info: ContactInfo - Contact's details.
38
+ - lastActivity: ContactActivity - Details about the contact's last action in the site.
39
+ - primaryEmail: PrimaryEmail - Contact's primary email details.
40
+ - primaryInfo: PrimaryContactInfo - Contact's primary phone and email.
41
+ - primaryPhone: PrimaryPhone - Contact's primary phone details.
42
+ - revision: number - Revision number, which increments by 1 each time the contact is updated. To prevent conflicting changes, the existing revision must be specified when updating a contact.
43
+ - source: ContactSource - Details about the contact's source.
44
+
45
+ **ContactInfo**
46
+ Properties:
47
+ - addresses: ContactAddressesWrapper - Contact's street addresses.
48
+ - birthdate: string - Birth date in YYYY-MM-DD format. For example, 2020-03-15.
49
+ - company: string - Contact's company name.
50
+ - emails: ContactEmailsWrapper - Contact's email addresses.
51
+ - extendedFields: ExtendedFieldsWrapper - Additional custom fields.
52
+ - jobTitle: string - Contact's job title.
53
+ - labelKeys?: LabelsWrapper - List of contact's labels.
54
+ - locale: string - Locale in IETF BCP 47 language tag format.
55
+ - name: ContactName - Contact's first and last name.
56
+ - phones: ContactPhonesWrapper - Contact's phone numbers.
57
+ - picture: ContactPicture - Contact's profile picture.
58
+
59
+ **ContactAddressesWrapper**
60
+ Properties:
61
+ - items: ContactAddress[] - List of up to 50 addresses.
62
+
63
+ **ContactAddress**
64
+ Properties:
65
+ - _id: string - Street address ID.
66
+ - address: Address - Street adress
67
+ - tsg: AddressTag - Address type. UNTAGGED is shown as "Other" in the Contact List.
68
+
69
+ **ContactEmailsWrapper**
70
+ Properties:
71
+ - items: ContactEmail[] - List of up to 50 email addresses.
72
+
73
+ **ContactEmail**
74
+ Properties:
75
+ - _id: string - Email ID.
76
+ - email: string - Email address
77
+ - primary: boolean - Indicates whether this is the contact's primary email address. When changing primary to true for an email, the contact's other emails become false.
78
+ - tage: EmailTag - Email type
79
+
80
+ **ExtendedFieldsWrapper**
81
+ Properties:
82
+ - items: Record<string, any> - Contact's extended fields, where each key is the field key, and each value is the field's value for the contact.
83
+
84
+ **LabelsWrapper**
85
+ Properties:
86
+ - items: string[] - List of contact label keys.
87
+
88
+ **ContactName**
89
+ Properties:
90
+ - first: string - Contact's first name.
91
+ - last: string - Contact's last name.
92
+
93
+ **ContactPhonesWrapper**
94
+ Properties:
95
+ - items: ContactPhone[] - List of up to 50 phone numbers.
96
+
97
+ **ContactActivity**
98
+ Properties:
99
+ - activityDate: Date - Date and time of the last action.
100
+ - activityType: ContactActivityType - Contact's last action in the site.
101
+
102
+ **PrimaryEmail**
103
+ Properties:
104
+ - deliverabilityStatus: EmailDeliverabilityStatus - Indicates last reported status of sent emails. Default: NOT_SET
105
+ - email: string - Primary email address.
106
+ - subscriptionStatus: SubscriptionStatus - Indicates the recipient's opt-in or opt-out status for marketing emails. Default: NOT_SET
107
+
108
+ **PrimaryContactInfo**
109
+ Properties:
110
+ - email: string - Primary email address.
111
+ - phone: string - Primary phone number.
112
+
113
+ **PrimaryPhone**
114
+ Properties:
115
+ - countryCode: string - Country code of the primary phone number in ISO-3166 alpha-2 format.
116
+ - e164Phone: string - Phone number in ITU E.164 format. Automatically generated using phone and countryCode when both values are valid.
117
+ - formattedPhone: string - Formatted phone. Automatically generated using phone and countryCode.
118
+ - phone: string - Primary phone number.
119
+ - subscriptionStatus: SubscriptionStatus - Indicates the recipient's opt-in or opt-out status for SMS messages.
120
+
121
+ **ContactSource**
122
+ Properties:
123
+ - appId: string - App ID, if the contact was created by an app.
124
+ - sourceType: ContactSourceType - Source type
125
+
126
+ **EventMetadata**
127
+ Properties:
128
+ - _id: string - Unique event ID
129
+ - entityEventSequence: string - Sequence number for entity changes ordering
130
+ - entityFqdn: string - Fully-qualified entity type (for example, wix.crm.contact)
131
+ - entityId: string - ID of the entity associated with the event
132
+ - eventTime: Date - Event timestamp in ISO-8601 format (UTC)
133
+ - eventType: string - Event type
134
+ - identity: IdentificationData - The identification type and identity data
135
+ - instanceId: string - App instance ID
136
+ - originatedFrom?: string - If present, indicates the action that triggered the event
137
+ - slug: string - Event slug (for example, created)
138
+ - triggeredByAnonymizeRequest?: boolean - Whether triggered by a privacy request
139
+ </types>
140
+ <important_notes>
141
+ - This method registers a callback function as an event handler
142
+ - When developing websites or building apps with Blocks, use a Velo backend event instead of this method
143
+ - The way you call this method differs depending on the framework you are working in:
144
+ - When using the CLI, run the generate command to add an event extension, and then call this method within the extension code
145
+ - When building a self-hosted app, subscribe your app to the relevant event, and then call this method on your server
146
+ - The handler function can be either synchronous (void) or asynchronous (Promise<void>)
147
+ - Triggered when a contact is created
148
+ - Required Permission: 'SCOPE.DC-CONTACTS.READ-CONTACTS'
149
+ </important_notes>
150
+
151
+ <event_triggers>
152
+ - Contact Created: Triggered automatically when a new contact is successfully created in CRM
153
+ </event_triggers>
154
+ <example_usage>
155
+ ```typescript
156
+ import { contacts } from '@wix/crm';
157
+
158
+ // Register event handler for contact creation
159
+ contacts.onContactCreated((event) => {
160
+ const created = event.entity;
161
+ console.log('New contact created:', created._id);
162
+ console.log('Primary email:', created.primaryInfo?.email);
163
+ });
164
+
165
+ // Async handler example
166
+ contacts.onContactCreated(async (event) => {
167
+ const created = event.entity;
168
+ await syncToExternalCrm(created._id, created);
169
+ });
170
+ ```
171
+ </example_usage>
172
+ <related_methods>
173
+ - contacts.onContactUpdated() - Event handler for contact updates
174
+ - contacts.onContactDeleted() - Event handler for contact deletions
175
+ - contacts.onContactMerged() - Event handler for contact merges
176
+ - contacts.createContact() - Create a new contact
177
+ - contacts.getContact() - Retrieve a contact by ID
178
+ - contacts.updateContact() - Update an existing contact
179
+ - contacts.queryContacts() - Query contacts
180
+ - contacts.listContacts() - List contacts
181
+ </related_methods>
182
+ </crm_contacts_onContactCreated>
183
+
@@ -0,0 +1,103 @@
1
+ <data_items_onDataItemCreated>
2
+ <purpose>Registers a callback function as an event handler. Triggered when a data item is inserted. This method registers a callback function as an event handler. When developing websites or building apps with Blocks, use a Velo backend event instead of this method. The way you call this method differs depending on the framework you are working in: When using the CLI, run the generate command to add an event extension, and then call this method within the extension code. When building a self-hosted app, subscribe your app to the relevant event, and then call this method on your server.</purpose>
3
+ <use_cases>
4
+ - Log or audit new records inserted into collections
5
+ - Sync newly created items to external systems or data warehouses
6
+ - Trigger automations/workflows when specific collections receive new items
7
+ - Enrich or validate inserted items asynchronously
8
+ - Notify admins or stakeholders when critical items are added
9
+ </use_cases>
10
+
11
+ <method_declaration>
12
+ data.items.onDataItemCreated(handler)
13
+ </method_declaration>
14
+ <required_parameters>
15
+ - handler: function - handler(event: DataItemCreatedEnvelope): void | Promise<void>
16
+ </required_parameters>
17
+ <optional_parameters>
18
+ None
19
+ </optional_parameters>
20
+ <import>import { data } from '@wix/data'</import>
21
+ <types>
22
+
23
+ **DataItemCreatedEnvelope**
24
+ Properties:
25
+ - event: DataItemCreatedEnvelope - The data item creation event envelope
26
+
27
+ **DataItemCreatedEvent**
28
+ Properties:
29
+ - entity: DataItemEntity - The created item event data
30
+ - metadata: EventMetadata - Event metadata
31
+
32
+ **DataItemEntity**
33
+ Properties:
34
+ - _id: string - Data item ID
35
+ - data: WixDataItem - Data item contents
36
+ - dataCollectionId: string - ID of the collection to which this item belongs.
37
+
38
+ **WixDataItem**
39
+ Properties:
40
+ - createdDate: Date - Date and time the item was added to the collection.
41
+ - _id: string - Data item ID
42
+ - _owner: string - ID of the user who created the item. Can be modified with site owner permissions.
43
+ - _updatedDate: Date - Date and time the item was last modified. When the item is first inserted, _createdDate and _updatedDate have the same value.
44
+
45
+ **EventMetadata**
46
+ Properties:
47
+ - _id: string - Unique event ID. Allows clients to ignore duplicate webhooks.
48
+ - entityEventSequence: string - A sequence number defining the order of updates to the underlying entity.
49
+ - entityFqdn: string - Assumes actions are also always typed to an entity_type Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
50
+ - entityId: string - ID of the entity associated with the event.
51
+ - eventTime: Date - Event timestamp in ISO-8601 format and UTC time.
52
+ - eventType: string - Event type
53
+ - identity: IdentificationData - The identification type and identity data.
54
+ - instanceId: string - App instance ID.
55
+ - originatedFrom: string - If present, indicates the action that triggered the event.
56
+ - slug: string - This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) This is although the created/updated/deleted notion is duplication of the oneof types
57
+ - triggeredByAnonymizeRequest: boolean - Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
58
+
59
+ </types>
60
+ <important_notes>
61
+ - This method registers a callback function as an event handler
62
+ - When developing websites or building apps with Blocks, use a Velo backend event instead of this method
63
+ - The way you call this method differs depending on the framework you are working in:
64
+ - When using the CLI, run the generate command to add an event extension, and then call this method within the extension code
65
+ - When building a self-hosted app, subscribe your app to the relevant event, and then call this method on your server
66
+ - The handler function can be either synchronous (void) or asynchronous (Promise<void>)
67
+ - Triggered when a data item is inserted
68
+ - Required Permission: 'SCOPE.DC-DATA.READ'
69
+ </important_notes>
70
+
71
+ <event_triggers>
72
+ - Data Item Created: This event is triggered automatically when a new item is inserted into a collection
73
+ </event_triggers>
74
+ <example_usage>
75
+ ```typescript
76
+ import { items } from '@wix/data';
77
+
78
+ // Register event handler for data item creation
79
+ items.onDataItemCreated((event) => {
80
+ const created = event.entity;
81
+ console.log('Item created in collection:', created.dataCollectionId);
82
+ console.log('New item ID:', created._id);
83
+ // Access the inserted item payload
84
+ console.log('Item payload:', created.data);
85
+ });
86
+
87
+ // Async handler example
88
+ items.onDataItemCreated(async (event) => {
89
+ const created = event.entity;
90
+ const createdItem = await items.get(created.dataCollectionId, created._id);
91
+ console.log('Created item:', createdItem);
92
+ });
93
+ ```
94
+ </example_usage>
95
+ <related_methods>
96
+ - data.items.onDataItemUpdated() - Event handler for item updates
97
+ - data.items.onDataItemDeleted() - Event handler for item deletions
98
+ - data.items.insert() - Insert a new item into a collection
99
+ - data.items.get() - Retrieve an item by ID
100
+ - data.items.query() - Query items in a collection
101
+ </related_methods>
102
+ </data_items_onDataItemCreated>
103
+
@@ -0,0 +1,118 @@
1
+ <stores_product_onProductCreated>
2
+ <purpose>Registers a callback function as an event handler. Triggered when a product is created. This method registers a callback function as an event handler. When developing websites or building apps with Blocks, use a Velo backend event instead of this method. The way you call this method differs depending on the framework you are working in: When using the CLI, run the generate command to add an event extension, and then call this method within the extension code. When building a self-hosted app, subscribe your app to the relevant event, and then call this method on your server.</purpose>
3
+ <use_cases>
4
+ - Send notifications when new products are added to the catalog
5
+ - Synchronize product data with external systems or databases
6
+ - Trigger automated workflows for new product onboarding
7
+ - Log product creation events for analytics and monitoring
8
+ - Send welcome emails or notifications to relevant stakeholders
9
+ - Update inventory systems or third-party services
10
+ - Perform data validation or enrichment on new products
11
+ - Trigger marketing campaigns for new product launches
12
+ </use_cases>
13
+
14
+ <method_declaration>
15
+ products.onProductCreated(handler)
16
+ </method_declaration>
17
+ <required_parameters>
18
+ - handler: function - handler(event: ProductCreatedEnvelope): void | Promise<void>
19
+ </required_parameters>
20
+ <optional_parameters>
21
+ None
22
+ </optional_parameters>
23
+ <import>import { products } from '@wix/stores'</import>
24
+ <types>
25
+
26
+ **ProductCreatedEnvelope**
27
+ Properties:
28
+ - event: ProductCreatedEnvelope - The product creation event data
29
+
30
+ **ProductCreatedEvent**
31
+ Properties:
32
+ - data: ProductCreated - The created product data
33
+ - metadata: BaseEventMetadata - Additional event metadata
34
+
35
+ **ProductData**
36
+ Properties:
37
+ - productId: string - Unique product identifier
38
+ - name: string - Product name
39
+ - price: Price - Product pricing information
40
+ - visible: boolean - Whether the product is visible to customers.
41
+ - media: Media - Media items (images, videos, etc.) associated with this product.
42
+ - sku: string - Product stock keeping unit (SKU). If variants are being managed, this will be empty.
43
+ - productPageUrl: ProductPageUrl - Product page URL for this product (generated automatically by the server).
44
+ - brand: string - Product brand.
45
+ - costAndProfitData: CostAndProfitData - cost and profit data.
46
+ - originatedFromVersion: string - Information about the version of the catalog from where this event was triggered.
47
+ - slug: string - Event slug. A human readable identifier of the event.
48
+
49
+ **Price**
50
+ Properties:
51
+ - price: number - Product price
52
+ - currency: string - Product price currency
53
+ - formatted: Formatted - Formatted price display
54
+ - discountedPrice: number - Discounted product price (if no discounted price is set, the product price is returned)
55
+ - pricePerUnit: number - Price per unit
56
+
57
+ **Formatted**
58
+ Properties:
59
+ - price: string - Product price formatted with the currency
60
+ - discountedPrice: string - Discounted product price formatted with the currency (if no discounted price is set, the product formatted price is returned)
61
+ - pricePerUnit: string - Price per unit
62
+
63
+ **Media**
64
+ Properties:
65
+ - mainMedia: MainMedia - Primary media (image, video etc) associated with this product.
66
+ - items: MediaItem[]
67
+
68
+ **BaseEventMetadata**
69
+ Properties:
70
+ - eventType: string - The type of event that occurred
71
+ - instanceId: string - App instance ID.
72
+ - identity: IdentificationData - The identification type and identity data.
73
+ </types>
74
+ <important_notes>
75
+ - This method registers a callback function as an event handler
76
+ - When developing websites or building apps with Blocks, use a Velo backend event instead of this method
77
+ - The way you call this method differs depending on the framework you are working in:
78
+ - When using the CLI, run the generate command to add an event extension, and then call this method within the extension code
79
+ - When building a self-hosted app, subscribe your app to the relevant event, and then call this method on your server
80
+ - The handler function can be either synchronous (void) or asynchronous (Promise<void>)
81
+ - Triggered when a product is created
82
+ - **Required Permission**: In order to use this method, the app must have the permission scope named "SCOPE.DC-STORES.READ-PRODUCTS"
83
+ </important_notes>
84
+
85
+ <event_triggers>
86
+ - Product Created: This event is triggered automatically when a new product is successfully created in the Wix Stores catalog
87
+ </event_triggers>
88
+ <example_usage>
89
+ ```typescript
90
+ import { products } from '@wix/stores';
91
+
92
+ // Register event handler for product creation
93
+ products.onProductCreated((event) => {
94
+ console.log('New product created:', event.data.name);
95
+ console.log('Product ID:', event.data.productId);
96
+ });
97
+
98
+ // Async event handler example
99
+ products.onProductCreated(async (event) => {
100
+ try {
101
+ console.log('Processing product creation event');
102
+ // Perform async operations
103
+ await processNewProduct(event.data);
104
+ } catch (error) {
105
+ console.error('Error processing product creation:', error);
106
+ }
107
+ });
108
+ ```
109
+ </example_usage>
110
+ <related_methods>
111
+ - products.onProductChanged() - Event handler for product modifications
112
+ - products.onProductDeleted() - Event handler for product deletions
113
+ - products.createProduct() - Method to create new products
114
+ - products.getProduct() - Method to retrieve product details
115
+ - products.updateProduct() - Method to update existing products
116
+ - products.queryProducts() - Method to query products with filters
117
+ </related_methods>
118
+ </stores_product_onProductCreated>
@@ -0,0 +1,184 @@
1
+ <stores_productsV3_onProductCreated>
2
+ <purpose>
3
+ Registers an event handler that is triggered when a new product is created in your Wix Stores catalog.
4
+ This function allows you to perform custom logic such as synchronizing data, sending notifications, or triggering workflows when a new product is added.
5
+ </purpose>
6
+
7
+ <use_cases>
8
+ - Send notifications when new products are added to the catalog
9
+ - Synchronize product data with external systems or databases
10
+ - Trigger automated workflows for product onboarding
11
+ - Log product creation events for analytics or monitoring
12
+ - Update inventory or pricing in external systems
13
+ - Trigger marketing campaigns or product announcements
14
+ - Perform data validation or enrichment upon product creation
15
+ </use_cases>
16
+
17
+ <method_declaration>
18
+ productsV3.onProductCreated(handler)
19
+ </method_declaration>
20
+
21
+ <required_parameters>
22
+ - handler: function — A callback function to handle the event.
23
+ Signature: (event: ProductCreatedEnvelope) => void | Promise<void>
24
+ </required_parameters>
25
+
26
+ <optional_parameters>
27
+ None
28
+ </optional_parameters>
29
+
30
+ <import>
31
+ import { productsV3 } from '@wix/stores';
32
+ </import>
33
+
34
+ <types>
35
+
36
+ **ProductCreatedEnvelope**
37
+ Properties:
38
+ - entity: V3Product — The created product data
39
+ - metadata: EventMetadata — Event metadata information
40
+
41
+ **V3Product**
42
+ Properties:
43
+ - _createdDate: Date — Date and time the product was created.
44
+ - _id: string — Unique product identifier
45
+ - actualPriceRange: PriceRange - Product actualPrice range - minimum and maximum prices of all product variants.
46
+ - allCategoriesInfo: ProductCategoriesInfo - List of categories that directly contain this product, as well as their parent categories.
47
+ - breadcrumbsInfo: BreadcrumbsInfo - Breadcrumbs of the mainCategoryId. Used to navigate to parent categories.
48
+ - compareAtPriceRange: PriceRange - Product compareAtPrice range - minimum and maximum compare at prices of all product variants.
49
+ - costRange: PriceRange - Product cost range - minimum and maximum costs of all product variants.
50
+ - currency: string - Currency used for the pricing of this product, in ISO-4217 format. Defaults to the currency defined in the site settings, unless specified in x-wix-currency header.
51
+ - description: RichContent - Product description using rich content.
52
+ - directCategoriesInfo: ProductCategoriesInfo - List of categories that directly contain this product.
53
+ - extendedFields: ExtendedFields - Custom extended fields for the product object.
54
+ - handle: string - A unique human-friendly identifier for the product. Unlike the product ID, the handle can be set by the user to ensure consistency across multiple platforms. In case handle wasn't given, the handle will be automatically generated.
55
+ - infoSections: InfoSection[] — Additional information sections
56
+ - inventroy: Inventory - Product inventory info.
57
+ - mainCategoryId: string - The ID of the product's primary direct category, which defines the product’s breadcrumbs path. For example, if the product's main category is "T-Shirts" (which is a subcategory of "Clothing"), the breadcrumbs path will be "Clothing > T-Shirts".
58
+ - media: Media - Product media items.
59
+ - modifiers: ConnectedModifier[] - Product modifiers.
60
+ - name: string - Product name. Translatable.
61
+ - options: ConnectedOption[] - Product options. Allows the customer to customize the product. For example, selecting color, size, and more.
62
+ - plainDescription: string - Product description in HTML.
63
+ - productType: ProductType - Product type.
64
+ - revision: string - Revision number, which increments by 1 each time the product is updated. To prevent conflicting changes, the current revision must be passed when updating the product.
65
+ - ribbon: Ribbon - Product ribbon.
66
+ - seoData: SeoSchema - Product SEO data.
67
+ - slug: string - Product slug
68
+ - subscriptionDetails: SubscriptionDetails - Product subscriptions.
69
+ - taxGroupId: string - Tax group ID
70
+ - url: string - URL to the site's product page.
71
+ - variantSummary: VariantSummary - The total number of variants for the product.
72
+ - variantsInfo: VariantsInfo - Product variants. Each variant must reference all product options via its choices array. Each choice references an option using optionChoiceNames for all requests.
73
+ - visible: boolean - Whether the product is visible to site visitors on the site. Default: true
74
+ - visibleInPos: boolean - Whether the product is visible in POS (point of sale). Default: true
75
+ - physicalProperties: PhysicalProperties - Physical properties. Required when productType: PHYSICAL.
76
+
77
+ **PriceRange**
78
+ Properties:
79
+ - maxValue: FixedMonetaryAmount - Maximum value
80
+ - minValue: FixedMonetaryAmount - Minimum value
81
+
82
+ **FixedMonetaryAmount**
83
+ Properties:
84
+ - amount: string - Monetary amount. For example, "3.99", or "-4.99" for a negative amount.
85
+ - formattedAmount: string - Formatted monetary amount. For example, "$3.99".
86
+ - brand: Brand — Product brand information
87
+
88
+ **ProductCategoriesInfo**
89
+ Properties:
90
+ - categories: ProductCategory[] - A list of categories related to product.
91
+
92
+ **ProductCategory**
93
+ Properties:
94
+ - _id: string - Category ID
95
+ - index: number - Index location of the product within the category, which can be utilized for sorting products in a specific category.
96
+
97
+ **Brand**
98
+ Properties:
99
+ - _id: string - Brand ID
100
+ - name: string - Brand name
101
+
102
+ **Inventory**
103
+ Properties:
104
+ - availabilityStatus: InventoryAvailabilityStatus - Current availability status.
105
+ - preorderAvailability: ProductPreorderAvailability - Preorder availability status.
106
+ - preorderStatus: PreorderStatus — Current preorder status.
107
+
108
+ **Ribbon**
109
+ Properties:
110
+ - _id: string - Ribbon ID
111
+ - name: string - Ribbon name
112
+
113
+ **PhysicalProperties**
114
+ Properties:
115
+ - deliveryProfileId: string - Delivery profile ID.
116
+ - fulfillerId: string - Fulfiller ID.
117
+ - pricePerUnit: PricePerUnitSettings - Price per unit settings.
118
+ - pricePerUnitRange: PricePerUnitRange - Product price per unit range. The minimum and maximum price per unit of all the variants.
119
+ - shippingWeightRange: WeightRange - Product shipping weight range - Calculated from the lightest and heaviest variant shipping weights.
120
+ - weightMeasurementUnitInfo: WeightMeasurementUnitInfo - Weight measurement unit.
121
+
122
+ **PricePerUnit**
123
+ Properties:
124
+ - measurementUnit: MeasurementUnit - Measurement unit. For example, to define price per 100 grams, set this field to "G".
125
+ - quantity: number - Quantity. For example, to define price per per 100 grams, set this field to 100.
126
+
127
+ **PricePerUnitRange**
128
+ Properties:
129
+ - maxValue: PricePerUnitRangePricePerUnit - Maximum price per unit across all variants.
130
+ - minValue: PricePerUnitRangePricePerUnit - Minimum price per unit across all variants.
131
+
132
+ **PricePerUnitRangePricePerUnit**
133
+ Properties:
134
+ - description: string - Price per unit info in the format of variant specific data / product setting, for example €4.00 / 1 Kg.
135
+ - value: string - Calculated value of price per unit. Takes into account pricePerUnit settings of product and variants and price of variants.
136
+
137
+ **WeightRange**
138
+ Properties:
139
+ - maxValue: number - Maximum weight across all variants associated with this product.
140
+ - minValue: number - Minimum weight across all variants associated with this product.
141
+
142
+ **WeightMeasurementUnitInfo**
143
+ Properties:
144
+ - weightMeasurementUnit: WeightUnit - Weight measurement unit.
145
+ </types>
146
+
147
+ <important_notes>
148
+ - Triggered automatically when a new product is created in Wix Stores.
149
+ - The `handler` can be synchronous (void) or asynchronous (Promise<void>).
150
+ - When developing with Wix Blocks, use a Velo backend event instead of this SDK event.
151
+ - Usage differs by environment:
152
+ - **CLI Apps:** Run the `generate` command to add an event extension, then call this method within the generated code.
153
+ - **Self-Hosted Apps:** Subscribe to the "Product Created" event on your server and call this method in your app.
154
+ - **Permission Required:** `SCOPE.STORES.PRODUCT_READ` — Required scope for this event handler.
155
+ </important_notes>
156
+
157
+ <event_triggers>
158
+ - Triggered automatically when a new product is successfully created in the Wix Stores catalog.
159
+ </event_triggers>
160
+
161
+ <example_usage>
162
+ ```typescript
163
+ import { productsV3 } from '@wix/stores';
164
+
165
+ // Basic example
166
+ productsV3.onProductCreated(async (event) => {
167
+ console.log('New product created:', event.entity.name);
168
+ console.log('Product ID:', event.entity._id);
169
+ console.log('Visible:', event.entity.visible);
170
+ console.log('Inventory:', event.entity.inventory);
171
+ console.log('Brand:', event.entity.brand);
172
+ console.log('Event ID:', event.metadata._id);
173
+ console.log('Event Time:', event.metadata.eventTime);
174
+ });
175
+
176
+ // Async example
177
+ productsV3.onProductCreated(async (event) => {
178
+ try {
179
+ console.log('Processing product creation for:', event.entity.name);
180
+ await syncProductToExternalSystem(event.entity);
181
+ } catch (err) {
182
+ console.error('Error processing product creation:', err);
183
+ }
184
+ });