@wix/auto_sdk_automations_automations-v-2 1.0.4 → 1.0.6

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 (121) hide show
  1. package/build/{internal/cjs/src/automations-v2-automation-automations-v-2.universal.d.ts → cjs/automations-v2-automation-automations-v-2.universal-CUoGClWF.d.ts} +220 -567
  2. package/build/cjs/index.d.ts +202 -1
  3. package/build/cjs/index.js +1555 -15
  4. package/build/cjs/index.js.map +1 -1
  5. package/build/cjs/meta.d.ts +1167 -1
  6. package/build/cjs/meta.js +960 -15
  7. package/build/cjs/meta.js.map +1 -1
  8. package/build/{cjs/src/automations-v2-automation-automations-v-2.universal.d.ts → es/automations-v2-automation-automations-v-2.universal-CUoGClWF.d.mts} +220 -567
  9. package/build/es/index.d.mts +202 -0
  10. package/build/es/index.mjs +1494 -0
  11. package/build/es/index.mjs.map +1 -0
  12. package/build/es/meta.d.mts +1167 -0
  13. package/build/es/meta.mjs +920 -0
  14. package/build/es/meta.mjs.map +1 -0
  15. package/build/internal/{es/src/automations-v2-automation-automations-v-2.universal.d.ts → cjs/automations-v2-automation-automations-v-2.universal-CUoGClWF.d.ts} +220 -567
  16. package/build/internal/cjs/index.d.ts +202 -1
  17. package/build/internal/cjs/index.js +1555 -15
  18. package/build/internal/cjs/index.js.map +1 -1
  19. package/build/internal/cjs/meta.d.ts +1167 -1
  20. package/build/internal/cjs/meta.js +960 -15
  21. package/build/internal/cjs/meta.js.map +1 -1
  22. package/build/{es/src/automations-v2-automation-automations-v-2.universal.d.ts → internal/es/automations-v2-automation-automations-v-2.universal-CUoGClWF.d.mts} +220 -567
  23. package/build/internal/es/index.d.mts +202 -0
  24. package/build/internal/es/index.mjs +1494 -0
  25. package/build/internal/es/index.mjs.map +1 -0
  26. package/build/internal/es/meta.d.mts +1167 -0
  27. package/build/internal/es/meta.mjs +920 -0
  28. package/build/internal/es/meta.mjs.map +1 -0
  29. package/package.json +9 -8
  30. package/build/cjs/index.typings.d.ts +0 -1
  31. package/build/cjs/index.typings.js +0 -18
  32. package/build/cjs/index.typings.js.map +0 -1
  33. package/build/cjs/src/automations-v2-automation-automations-v-2.context.d.ts +0 -37
  34. package/build/cjs/src/automations-v2-automation-automations-v-2.context.js +0 -61
  35. package/build/cjs/src/automations-v2-automation-automations-v-2.context.js.map +0 -1
  36. package/build/cjs/src/automations-v2-automation-automations-v-2.http.d.ts +0 -74
  37. package/build/cjs/src/automations-v2-automation-automations-v-2.http.js +0 -666
  38. package/build/cjs/src/automations-v2-automation-automations-v-2.http.js.map +0 -1
  39. package/build/cjs/src/automations-v2-automation-automations-v-2.meta.d.ts +0 -49
  40. package/build/cjs/src/automations-v2-automation-automations-v-2.meta.js +0 -351
  41. package/build/cjs/src/automations-v2-automation-automations-v-2.meta.js.map +0 -1
  42. package/build/cjs/src/automations-v2-automation-automations-v-2.public.d.ts +0 -172
  43. package/build/cjs/src/automations-v2-automation-automations-v-2.public.js +0 -167
  44. package/build/cjs/src/automations-v2-automation-automations-v-2.public.js.map +0 -1
  45. package/build/cjs/src/automations-v2-automation-automations-v-2.types.d.ts +0 -2223
  46. package/build/cjs/src/automations-v2-automation-automations-v-2.types.js +0 -276
  47. package/build/cjs/src/automations-v2-automation-automations-v-2.types.js.map +0 -1
  48. package/build/cjs/src/automations-v2-automation-automations-v-2.universal.js +0 -1025
  49. package/build/cjs/src/automations-v2-automation-automations-v-2.universal.js.map +0 -1
  50. package/build/es/index.d.ts +0 -1
  51. package/build/es/index.js +0 -2
  52. package/build/es/index.js.map +0 -1
  53. package/build/es/index.typings.d.ts +0 -1
  54. package/build/es/index.typings.js +0 -2
  55. package/build/es/index.typings.js.map +0 -1
  56. package/build/es/meta.d.ts +0 -1
  57. package/build/es/meta.js +0 -2
  58. package/build/es/meta.js.map +0 -1
  59. package/build/es/src/automations-v2-automation-automations-v-2.context.d.ts +0 -37
  60. package/build/es/src/automations-v2-automation-automations-v-2.context.js +0 -37
  61. package/build/es/src/automations-v2-automation-automations-v-2.context.js.map +0 -1
  62. package/build/es/src/automations-v2-automation-automations-v-2.http.d.ts +0 -74
  63. package/build/es/src/automations-v2-automation-automations-v-2.http.js +0 -646
  64. package/build/es/src/automations-v2-automation-automations-v-2.http.js.map +0 -1
  65. package/build/es/src/automations-v2-automation-automations-v-2.meta.d.ts +0 -49
  66. package/build/es/src/automations-v2-automation-automations-v-2.meta.js +0 -308
  67. package/build/es/src/automations-v2-automation-automations-v-2.meta.js.map +0 -1
  68. package/build/es/src/automations-v2-automation-automations-v-2.public.d.ts +0 -172
  69. package/build/es/src/automations-v2-automation-automations-v-2.public.js +0 -126
  70. package/build/es/src/automations-v2-automation-automations-v-2.public.js.map +0 -1
  71. package/build/es/src/automations-v2-automation-automations-v-2.types.d.ts +0 -2223
  72. package/build/es/src/automations-v2-automation-automations-v-2.types.js +0 -273
  73. package/build/es/src/automations-v2-automation-automations-v-2.types.js.map +0 -1
  74. package/build/es/src/automations-v2-automation-automations-v-2.universal.js +0 -982
  75. package/build/es/src/automations-v2-automation-automations-v-2.universal.js.map +0 -1
  76. package/build/internal/cjs/index.typings.d.ts +0 -1
  77. package/build/internal/cjs/index.typings.js +0 -18
  78. package/build/internal/cjs/index.typings.js.map +0 -1
  79. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.context.d.ts +0 -37
  80. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.context.js +0 -61
  81. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.context.js.map +0 -1
  82. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.http.d.ts +0 -74
  83. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.http.js +0 -666
  84. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.http.js.map +0 -1
  85. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.meta.d.ts +0 -49
  86. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.meta.js +0 -351
  87. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.meta.js.map +0 -1
  88. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.public.d.ts +0 -172
  89. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.public.js +0 -167
  90. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.public.js.map +0 -1
  91. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.types.d.ts +0 -2223
  92. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.types.js +0 -276
  93. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.types.js.map +0 -1
  94. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.universal.js +0 -1025
  95. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.universal.js.map +0 -1
  96. package/build/internal/es/index.d.ts +0 -1
  97. package/build/internal/es/index.js +0 -2
  98. package/build/internal/es/index.js.map +0 -1
  99. package/build/internal/es/index.typings.d.ts +0 -1
  100. package/build/internal/es/index.typings.js +0 -2
  101. package/build/internal/es/index.typings.js.map +0 -1
  102. package/build/internal/es/meta.d.ts +0 -1
  103. package/build/internal/es/meta.js +0 -2
  104. package/build/internal/es/meta.js.map +0 -1
  105. package/build/internal/es/src/automations-v2-automation-automations-v-2.context.d.ts +0 -37
  106. package/build/internal/es/src/automations-v2-automation-automations-v-2.context.js +0 -37
  107. package/build/internal/es/src/automations-v2-automation-automations-v-2.context.js.map +0 -1
  108. package/build/internal/es/src/automations-v2-automation-automations-v-2.http.d.ts +0 -74
  109. package/build/internal/es/src/automations-v2-automation-automations-v-2.http.js +0 -646
  110. package/build/internal/es/src/automations-v2-automation-automations-v-2.http.js.map +0 -1
  111. package/build/internal/es/src/automations-v2-automation-automations-v-2.meta.d.ts +0 -49
  112. package/build/internal/es/src/automations-v2-automation-automations-v-2.meta.js +0 -308
  113. package/build/internal/es/src/automations-v2-automation-automations-v-2.meta.js.map +0 -1
  114. package/build/internal/es/src/automations-v2-automation-automations-v-2.public.d.ts +0 -172
  115. package/build/internal/es/src/automations-v2-automation-automations-v-2.public.js +0 -126
  116. package/build/internal/es/src/automations-v2-automation-automations-v-2.public.js.map +0 -1
  117. package/build/internal/es/src/automations-v2-automation-automations-v-2.types.d.ts +0 -2223
  118. package/build/internal/es/src/automations-v2-automation-automations-v-2.types.js +0 -273
  119. package/build/internal/es/src/automations-v2-automation-automations-v-2.types.js.map +0 -1
  120. package/build/internal/es/src/automations-v2-automation-automations-v-2.universal.js +0 -982
  121. package/build/internal/es/src/automations-v2-automation-automations-v-2.universal.js.map +0 -1
@@ -1,982 +0,0 @@
1
- import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
2
- import { queryBuilder } from '@wix/sdk-runtime/query-builder';
3
- import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
4
- import * as ambassadorWixAutomationsV2Automation from './automations-v2-automation-automations-v-2.http.js';
5
- // @ts-ignore
6
- import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
7
- export var Domain;
8
- (function (Domain) {
9
- /** User domain (default). */
10
- Domain["USER"] = "USER";
11
- /** Wix domain. */
12
- Domain["WIX"] = "WIX";
13
- /** Wix account-level domain. */
14
- Domain["WIX_ACCOUNT"] = "WIX_ACCOUNT";
15
- })(Domain || (Domain = {}));
16
- export var TimeUnit;
17
- (function (TimeUnit) {
18
- TimeUnit["UNKNOWN_TIME_UNIT"] = "UNKNOWN_TIME_UNIT";
19
- /** Minutes. */
20
- TimeUnit["MINUTES"] = "MINUTES";
21
- /** Hours. */
22
- TimeUnit["HOURS"] = "HOURS";
23
- /** Days. */
24
- TimeUnit["DAYS"] = "DAYS";
25
- /** Weeks. */
26
- TimeUnit["WEEKS"] = "WEEKS";
27
- /** Months. */
28
- TimeUnit["MONTHS"] = "MONTHS";
29
- })(TimeUnit || (TimeUnit = {}));
30
- export var Operator;
31
- (function (Operator) {
32
- /** Unknown. */
33
- Operator["UNKNOWN_OPERATOR"] = "UNKNOWN_OPERATOR";
34
- /** `OR` operator. */
35
- Operator["OR"] = "OR";
36
- /** `AND` operator. */
37
- Operator["AND"] = "AND";
38
- })(Operator || (Operator = {}));
39
- export var Type;
40
- (function (Type) {
41
- /** Based on the trigger. */
42
- Type["UNKNOWN_ACTION_TYPE"] = "UNKNOWN_ACTION_TYPE";
43
- /** Defined by a [Wix app](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/about-automation-configuration#app-defined-actions). This action type is available in the site dashboard. */
44
- Type["APP_DEFINED"] = "APP_DEFINED";
45
- /** Condition. This determines which action runs next. */
46
- Type["CONDITION"] = "CONDITION";
47
- /** Delay. The automation must wait before executing the next step. */
48
- Type["DELAY"] = "DELAY";
49
- /** Rate-limiter. This stops the automation flow if the subsequent action has reached its maximum allowed executions. */
50
- Type["RATE_LIMIT"] = "RATE_LIMIT";
51
- })(Type || (Type = {}));
52
- export var Status;
53
- (function (Status) {
54
- /** Unknown. */
55
- Status["UNKNOWN_STATUS"] = "UNKNOWN_STATUS";
56
- /** Active. Active automations can be triggered. */
57
- Status["ACTIVE"] = "ACTIVE";
58
- /** Inactive. Inactive automations cannot be triggered. */
59
- Status["INACTIVE"] = "INACTIVE";
60
- })(Status || (Status = {}));
61
- export var Origin;
62
- (function (Origin) {
63
- /** Default value. */
64
- Origin["UNKNOWN_ORIGIN"] = "UNKNOWN_ORIGIN";
65
- /** Created by a [Wix user](https://dev.wix.com/docs/build-apps/get-started/overview/glossary#wix-user). */
66
- Origin["USER"] = "USER";
67
- /** Created by a [Wix app](https://dev.wix.com/docs/build-apps/get-started/overview/glossary#wix-app) for a particular site. */
68
- Origin["APPLICATION"] = "APPLICATION";
69
- /** [Preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations). */
70
- Origin["PREINSTALLED"] = "PREINSTALLED";
71
- })(Origin || (Origin = {}));
72
- export var WebhookIdentityType;
73
- (function (WebhookIdentityType) {
74
- WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
75
- WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
76
- WebhookIdentityType["MEMBER"] = "MEMBER";
77
- WebhookIdentityType["WIX_USER"] = "WIX_USER";
78
- WebhookIdentityType["APP"] = "APP";
79
- })(WebhookIdentityType || (WebhookIdentityType = {}));
80
- export var Language;
81
- (function (Language) {
82
- /** Unknown. */
83
- Language["UNKNOWN_LANGUAGE"] = "UNKNOWN_LANGUAGE";
84
- /** `JAVASCRIPT` language. */
85
- Language["JAVASCRIPT"] = "JAVASCRIPT";
86
- })(Language || (Language = {}));
87
- export var RequestedFields;
88
- (function (RequestedFields) {
89
- RequestedFields["UNKNOWN_REQUESTED_FIELD"] = "UNKNOWN_REQUESTED_FIELD";
90
- /** whether to return in response `configuration.trigger.override_output_schema` field and in `configuration.actions` the `override_output_schema` field */
91
- RequestedFields["OVERRIDE_SCHEMA"] = "OVERRIDE_SCHEMA";
92
- })(RequestedFields || (RequestedFields = {}));
93
- export var SortOrder;
94
- (function (SortOrder) {
95
- SortOrder["ASC"] = "ASC";
96
- SortOrder["DESC"] = "DESC";
97
- })(SortOrder || (SortOrder = {}));
98
- export var State;
99
- (function (State) {
100
- State["UNKNOWN"] = "UNKNOWN";
101
- State["ENABLED"] = "ENABLED";
102
- State["DISABLED"] = "DISABLED";
103
- State["PENDING"] = "PENDING";
104
- State["DEMO"] = "DEMO";
105
- })(State || (State = {}));
106
- export var SiteCreatedContext;
107
- (function (SiteCreatedContext) {
108
- /** A valid option, we don't expose all reasons why site might be created. */
109
- SiteCreatedContext["OTHER"] = "OTHER";
110
- /** A meta site was created from template. */
111
- SiteCreatedContext["FROM_TEMPLATE"] = "FROM_TEMPLATE";
112
- /** A meta site was created by copying of the transfferred meta site. */
113
- SiteCreatedContext["DUPLICATE_BY_SITE_TRANSFER"] = "DUPLICATE_BY_SITE_TRANSFER";
114
- /** A copy of existing meta site. */
115
- SiteCreatedContext["DUPLICATE"] = "DUPLICATE";
116
- /** A meta site was created as a transfferred site (copy of the original), old flow, should die soon. */
117
- SiteCreatedContext["OLD_SITE_TRANSFER"] = "OLD_SITE_TRANSFER";
118
- /** deprecated A meta site was created for Flash editor. */
119
- SiteCreatedContext["FLASH"] = "FLASH";
120
- })(SiteCreatedContext || (SiteCreatedContext = {}));
121
- export var Namespace;
122
- (function (Namespace) {
123
- Namespace["UNKNOWN_NAMESPACE"] = "UNKNOWN_NAMESPACE";
124
- /** Default namespace for UGC sites. MetaSites with this namespace will be shown in a user's site list by default. */
125
- Namespace["WIX"] = "WIX";
126
- /** ShoutOut stand alone product. These are siteless (no actual Wix site, no HtmlWeb). MetaSites with this namespace will *not* be shown in a user's site list by default. */
127
- Namespace["SHOUT_OUT"] = "SHOUT_OUT";
128
- /** MetaSites created by the Albums product, they appear as part of the Albums app. MetaSites with this namespace will *not* be shown in a user's site list by default. */
129
- Namespace["ALBUMS"] = "ALBUMS";
130
- /** Part of the WixStores migration flow, a user tries to migrate and gets this site to view and if the user likes it then stores removes this namespace and deletes the old site with the old stores. MetaSites with this namespace will *not* be shown in a user's site list by default. */
131
- Namespace["WIX_STORES_TEST_DRIVE"] = "WIX_STORES_TEST_DRIVE";
132
- /** Hotels standalone (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default. */
133
- Namespace["HOTELS"] = "HOTELS";
134
- /** Clubs siteless MetaSites, a club without a wix website. MetaSites with this namespace will *not* be shown in a user's site list by default. */
135
- Namespace["CLUBS"] = "CLUBS";
136
- /** A partially created ADI website. MetaSites with this namespace will *not* be shown in a user's site list by default. */
137
- Namespace["ONBOARDING_DRAFT"] = "ONBOARDING_DRAFT";
138
- /** AppBuilder for AppStudio / shmite (c). MetaSites with this namespace will *not* be shown in a user's site list by default. */
139
- Namespace["DEV_SITE"] = "DEV_SITE";
140
- /** LogoMaker websites offered to the user after logo purchase. MetaSites with this namespace will *not* be shown in a user's site list by default. */
141
- Namespace["LOGOS"] = "LOGOS";
142
- /** VideoMaker websites offered to the user after video purchase. MetaSites with this namespace will *not* be shown in a user's site list by default. */
143
- Namespace["VIDEO_MAKER"] = "VIDEO_MAKER";
144
- /** MetaSites with this namespace will *not* be shown in a user's site list by default. */
145
- Namespace["PARTNER_DASHBOARD"] = "PARTNER_DASHBOARD";
146
- /** MetaSites with this namespace will *not* be shown in a user's site list by default. */
147
- Namespace["DEV_CENTER_COMPANY"] = "DEV_CENTER_COMPANY";
148
- /**
149
- * A draft created by HTML editor on open. Upon "first save" it will be moved to be of WIX domain.
150
- *
151
- * Meta site with this namespace will *not* be shown in a user's site list by default.
152
- */
153
- Namespace["HTML_DRAFT"] = "HTML_DRAFT";
154
- /**
155
- * the user-journey for Fitness users who want to start from managing their business instead of designing their website.
156
- * Will be accessible from Site List and will not have a website app.
157
- * Once the user attaches a site, the site will become a regular wixsite.
158
- */
159
- Namespace["SITELESS_BUSINESS"] = "SITELESS_BUSINESS";
160
- /** Belongs to "strategic products" company. Supports new product in the creator's economy space. */
161
- Namespace["CREATOR_ECONOMY"] = "CREATOR_ECONOMY";
162
- /** It is to be used in the Business First efforts. */
163
- Namespace["DASHBOARD_FIRST"] = "DASHBOARD_FIRST";
164
- /** Bookings business flow with no site. */
165
- Namespace["ANYWHERE"] = "ANYWHERE";
166
- /** Namespace for Headless Backoffice with no editor */
167
- Namespace["HEADLESS"] = "HEADLESS";
168
- /**
169
- * Namespace for master site that will exist in parent account that will be referenced by subaccounts
170
- * The site will be used for account level CSM feature for enterprise
171
- */
172
- Namespace["ACCOUNT_MASTER_CMS"] = "ACCOUNT_MASTER_CMS";
173
- /** Rise.ai Siteless account management for Gift Cards and Store Credit. */
174
- Namespace["RISE"] = "RISE";
175
- /**
176
- * As part of the branded app new funnel, users now can create a meta site that will be branded app first.
177
- * There's a blank site behind the scene but it's blank).
178
- * The Mobile company will be the owner of this namespace.
179
- */
180
- Namespace["BRANDED_FIRST"] = "BRANDED_FIRST";
181
- /** Nownia.com Siteless account management for Ai Scheduling Assistant. */
182
- Namespace["NOWNIA"] = "NOWNIA";
183
- /**
184
- * UGC Templates are templates that are created by users for personal use and to sale to other users.
185
- * The Partners company owns this namespace.
186
- */
187
- Namespace["UGC_TEMPLATE"] = "UGC_TEMPLATE";
188
- /** Codux Headless Sites */
189
- Namespace["CODUX"] = "CODUX";
190
- /** Bobb - AI Design Creator. */
191
- Namespace["MEDIA_DESIGN_CREATOR"] = "MEDIA_DESIGN_CREATOR";
192
- /**
193
- * Shared Blog Site is a unique single site across Enterprise account,
194
- * This site will hold all Blog posts related to the Marketing product.
195
- */
196
- Namespace["SHARED_BLOG_ENTERPRISE"] = "SHARED_BLOG_ENTERPRISE";
197
- /** Standalone forms (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default. */
198
- Namespace["STANDALONE_FORMS"] = "STANDALONE_FORMS";
199
- /** Standalone events (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default. */
200
- Namespace["STANDALONE_EVENTS"] = "STANDALONE_EVENTS";
201
- /** MIMIR - Siteless account for MIMIR Ai Job runner. */
202
- Namespace["MIMIR"] = "MIMIR";
203
- })(Namespace || (Namespace = {}));
204
- export var DeleteStatus;
205
- (function (DeleteStatus) {
206
- DeleteStatus["UNKNOWN"] = "UNKNOWN";
207
- DeleteStatus["TRASH"] = "TRASH";
208
- DeleteStatus["DELETED"] = "DELETED";
209
- DeleteStatus["PENDING_PURGE"] = "PENDING_PURGE";
210
- DeleteStatus["PURGED_EXTERNALLY"] = "PURGED_EXTERNALLY";
211
- })(DeleteStatus || (DeleteStatus = {}));
212
- export var TriggerValidationErrorValidationErrorType;
213
- (function (TriggerValidationErrorValidationErrorType) {
214
- TriggerValidationErrorValidationErrorType["UNKNOWN_VALIDATION_ERROR_TYPE"] = "UNKNOWN_VALIDATION_ERROR_TYPE";
215
- /** Configuration error. */
216
- TriggerValidationErrorValidationErrorType["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
217
- /** Provider error. */
218
- TriggerValidationErrorValidationErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
219
- })(TriggerValidationErrorValidationErrorType || (TriggerValidationErrorValidationErrorType = {}));
220
- export var TriggerErrorType;
221
- (function (TriggerErrorType) {
222
- TriggerErrorType["UNKNOWN_TRIGGER_ERROR_TYPE"] = "UNKNOWN_TRIGGER_ERROR_TYPE";
223
- /** Trigger not found. */
224
- TriggerErrorType["NOT_FOUND"] = "NOT_FOUND";
225
- /** App not installed. */
226
- TriggerErrorType["APP_NOT_INSTALLED"] = "APP_NOT_INSTALLED";
227
- /** Moderation mismatch. */
228
- TriggerErrorType["MODERATION_MISMATCH"] = "MODERATION_MISMATCH";
229
- /** Deprecated. */
230
- TriggerErrorType["DEPRECATED"] = "DEPRECATED";
231
- /** Invalid trigger key. */
232
- TriggerErrorType["INVALID_TRIGGER_KEY"] = "INVALID_TRIGGER_KEY";
233
- /** Invalid filter field key. */
234
- TriggerErrorType["INVALID_FILTER_FIELD_KEY"] = "INVALID_FILTER_FIELD_KEY";
235
- /** Invalid filter expression. */
236
- TriggerErrorType["INVALID_FILTER_EXPRESSION"] = "INVALID_FILTER_EXPRESSION";
237
- })(TriggerErrorType || (TriggerErrorType = {}));
238
- export var ValidationErrorSeverity;
239
- (function (ValidationErrorSeverity) {
240
- ValidationErrorSeverity["UNKNOWN_VALIDATION_ERROR_SEVERITY"] = "UNKNOWN_VALIDATION_ERROR_SEVERITY";
241
- /** Warning. */
242
- ValidationErrorSeverity["WARNING"] = "WARNING";
243
- /** Error. */
244
- ValidationErrorSeverity["ERROR"] = "ERROR";
245
- })(ValidationErrorSeverity || (ValidationErrorSeverity = {}));
246
- export var ValidationErrorType;
247
- (function (ValidationErrorType) {
248
- ValidationErrorType["UNKNOWN_VALIDATION_ERROR_TYPE"] = "UNKNOWN_VALIDATION_ERROR_TYPE";
249
- /** Configuration error. */
250
- ValidationErrorType["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
251
- /** Provider error. */
252
- ValidationErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
253
- })(ValidationErrorType || (ValidationErrorType = {}));
254
- export var ActionErrorType;
255
- (function (ActionErrorType) {
256
- ActionErrorType["UNKNOWN_ACTION_ERROR_TYPE"] = "UNKNOWN_ACTION_ERROR_TYPE";
257
- ActionErrorType["NOT_FOUND"] = "NOT_FOUND";
258
- ActionErrorType["APP_NOT_INSTALLED"] = "APP_NOT_INSTALLED";
259
- ActionErrorType["MODERATION_MISMATCH"] = "MODERATION_MISMATCH";
260
- ActionErrorType["DEPRECATED"] = "DEPRECATED";
261
- ActionErrorType["INVALID_ACTION_KEY"] = "INVALID_ACTION_KEY";
262
- ActionErrorType["INVALID_MAPPING"] = "INVALID_MAPPING";
263
- ActionErrorType["MAPPING_TYPE_MISMATCH"] = "MAPPING_TYPE_MISMATCH";
264
- ActionErrorType["MAPPING_MISSING_REQUIRED_FIELD"] = "MAPPING_MISSING_REQUIRED_FIELD";
265
- ActionErrorType["MAPPING_SCHEMA_MISMATCH"] = "MAPPING_SCHEMA_MISMATCH";
266
- ActionErrorType["MAPPING_VARIABLE_MISSING_FROM_SCHEMA"] = "MAPPING_VARIABLE_MISSING_FROM_SCHEMA";
267
- ActionErrorType["SAMPLE_CODE_RUN_FAILED"] = "SAMPLE_CODE_RUN_FAILED";
268
- })(ActionErrorType || (ActionErrorType = {}));
269
- export var AutomationValidationErrorValidationErrorType;
270
- (function (AutomationValidationErrorValidationErrorType) {
271
- AutomationValidationErrorValidationErrorType["UNKNOWN_VALIDATION_ERROR_TYPE"] = "UNKNOWN_VALIDATION_ERROR_TYPE";
272
- AutomationValidationErrorValidationErrorType["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
273
- AutomationValidationErrorValidationErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
274
- })(AutomationValidationErrorValidationErrorType || (AutomationValidationErrorValidationErrorType = {}));
275
- export var AutomationErrorType;
276
- (function (AutomationErrorType) {
277
- AutomationErrorType["UNKNOWN_AUTOMATION_ERROR_TYPE"] = "UNKNOWN_AUTOMATION_ERROR_TYPE";
278
- })(AutomationErrorType || (AutomationErrorType = {}));
279
- /**
280
- * Creates an automation.
281
- * @param automation - Automation to create.
282
- * @public
283
- * @documentationMaturity preview
284
- * @requiredField automation
285
- * @requiredField automation.configuration
286
- * @requiredField automation.configuration.actions
287
- * @requiredField automation.configuration.rootActionIds
288
- * @requiredField automation.configuration.status
289
- * @requiredField automation.configuration.trigger
290
- * @requiredField automation.configuration.trigger.appId
291
- * @requiredField automation.configuration.trigger.triggerKey
292
- * @requiredField automation.name
293
- * @requiredField automation.origin
294
- * @permissionId AUTOMATIONS.AUTOMATION_CREATE
295
- * @permissionScope Manage Stores
296
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
297
- * @permissionScope Set Up Automations
298
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
299
- * @applicableIdentity APP
300
- * @returns Details of the created automation.
301
- * @fqn wix.automations.v2.AutomationsService.CreateAutomation
302
- */
303
- export async function createAutomation(automation) {
304
- // @ts-ignore
305
- const { httpClient, sideEffects } = arguments[1];
306
- const payload = renameKeysFromSDKRequestToRESTRequest({
307
- automation: automation,
308
- });
309
- const reqOpts = ambassadorWixAutomationsV2Automation.createAutomation(payload);
310
- sideEffects?.onSiteCall?.();
311
- try {
312
- const result = await httpClient.request(reqOpts);
313
- sideEffects?.onSuccess?.(result);
314
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.automation;
315
- }
316
- catch (err) {
317
- const transformedError = sdkTransformError(err, {
318
- spreadPathsToArguments: {},
319
- explicitPathsToArguments: { automation: '$[0]' },
320
- singleArgumentUnchanged: false,
321
- }, ['automation']);
322
- sideEffects?.onError?.(err);
323
- throw transformedError;
324
- }
325
- }
326
- /**
327
- * Retrieves an automation by ID.
328
- * @param automationId - Automation ID.
329
- * @public
330
- * @documentationMaturity preview
331
- * @requiredField automationId
332
- * @permissionId AUTOMATIONS.AUTOMATION_READ
333
- * @permissionScope Manage Stores
334
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
335
- * @permissionScope Set Up Automations
336
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
337
- * @applicableIdentity APP
338
- * @returns Retrieved automation.
339
- * @fqn wix.automations.v2.AutomationsService.GetAutomation
340
- */
341
- export async function getAutomation(automationId) {
342
- // @ts-ignore
343
- const { httpClient, sideEffects } = arguments[1];
344
- const payload = renameKeysFromSDKRequestToRESTRequest({
345
- automationId: automationId,
346
- });
347
- const reqOpts = ambassadorWixAutomationsV2Automation.getAutomation(payload);
348
- sideEffects?.onSiteCall?.();
349
- try {
350
- const result = await httpClient.request(reqOpts);
351
- sideEffects?.onSuccess?.(result);
352
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.automation;
353
- }
354
- catch (err) {
355
- const transformedError = sdkTransformError(err, {
356
- spreadPathsToArguments: {},
357
- explicitPathsToArguments: { automationId: '$[0]' },
358
- singleArgumentUnchanged: false,
359
- }, ['automationId']);
360
- sideEffects?.onError?.(err);
361
- throw transformedError;
362
- }
363
- }
364
- /**
365
- * Updates the specified automation.
366
- *
367
- * When an automation is updated, its `revision` property is incremented by 1. When updating an automation, you must specify the current revision number.
368
- * @param _id - Automation ID.
369
- * @public
370
- * @documentationMaturity preview
371
- * @requiredField _id
372
- * @requiredField automation
373
- * @requiredField automation.revision
374
- * @permissionId AUTOMATIONS.AUTOMATION_UPDATE
375
- * @permissionScope Manage Stores
376
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
377
- * @permissionScope Set Up Automations
378
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
379
- * @applicableIdentity APP
380
- * @returns Updated automation.
381
- * @fqn wix.automations.v2.AutomationsService.UpdateAutomation
382
- */
383
- export async function updateAutomation(_id, automation) {
384
- // @ts-ignore
385
- const { httpClient, sideEffects } = arguments[2];
386
- const payload = renameKeysFromSDKRequestToRESTRequest({
387
- automation: { ...automation, id: _id },
388
- });
389
- const reqOpts = ambassadorWixAutomationsV2Automation.updateAutomation(payload);
390
- sideEffects?.onSiteCall?.();
391
- try {
392
- const result = await httpClient.request(reqOpts);
393
- sideEffects?.onSuccess?.(result);
394
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.automation;
395
- }
396
- catch (err) {
397
- const transformedError = sdkTransformError(err, {
398
- spreadPathsToArguments: { automation: '$[1]' },
399
- explicitPathsToArguments: { 'automation.id': '$[0]' },
400
- singleArgumentUnchanged: false,
401
- }, ['_id', 'automation']);
402
- sideEffects?.onError?.(err);
403
- throw transformedError;
404
- }
405
- }
406
- /**
407
- * Deletes the specified automation.
408
- * @param automationId - Automation ID.
409
- * @public
410
- * @documentationMaturity preview
411
- * @requiredField automationId
412
- * @permissionId AUTOMATIONS.AUTOMATION_DELETE
413
- * @permissionScope Manage Stores
414
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
415
- * @permissionScope Set Up Automations
416
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
417
- * @applicableIdentity APP
418
- * @fqn wix.automations.v2.AutomationsService.DeleteAutomation
419
- */
420
- export async function deleteAutomation(automationId) {
421
- // @ts-ignore
422
- const { httpClient, sideEffects } = arguments[1];
423
- const payload = renameKeysFromSDKRequestToRESTRequest({
424
- automationId: automationId,
425
- });
426
- const reqOpts = ambassadorWixAutomationsV2Automation.deleteAutomation(payload);
427
- sideEffects?.onSiteCall?.();
428
- try {
429
- const result = await httpClient.request(reqOpts);
430
- sideEffects?.onSuccess?.(result);
431
- }
432
- catch (err) {
433
- const transformedError = sdkTransformError(err, {
434
- spreadPathsToArguments: {},
435
- explicitPathsToArguments: { automationId: '$[0]' },
436
- singleArgumentUnchanged: false,
437
- }, ['automationId']);
438
- sideEffects?.onError?.(err);
439
- throw transformedError;
440
- }
441
- }
442
- /**
443
- * Deletes one or more automations.
444
- * @param automationIds - IDs of the automations to delete.
445
- * @public
446
- * @documentationMaturity preview
447
- * @requiredField automationIds
448
- * @permissionId AUTOMATIONS.AUTOMATION_DELETE
449
- * @permissionScope Manage Stores
450
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
451
- * @permissionScope Set Up Automations
452
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
453
- * @applicableIdentity APP
454
- * @fqn wix.automations.v2.AutomationsService.BulkDeleteAutomations
455
- */
456
- export async function bulkDeleteAutomations(automationIds) {
457
- // @ts-ignore
458
- const { httpClient, sideEffects } = arguments[1];
459
- const payload = renameKeysFromSDKRequestToRESTRequest({
460
- automationIds: automationIds,
461
- });
462
- const reqOpts = ambassadorWixAutomationsV2Automation.bulkDeleteAutomations(payload);
463
- sideEffects?.onSiteCall?.();
464
- try {
465
- const result = await httpClient.request(reqOpts);
466
- sideEffects?.onSuccess?.(result);
467
- return renameKeysFromRESTResponseToSDKResponse(result.data);
468
- }
469
- catch (err) {
470
- const transformedError = sdkTransformError(err, {
471
- spreadPathsToArguments: {},
472
- explicitPathsToArguments: { automationIds: '$[0]' },
473
- singleArgumentUnchanged: false,
474
- }, ['automationIds']);
475
- sideEffects?.onError?.(err);
476
- throw transformedError;
477
- }
478
- }
479
- /**
480
- * Generates a preinstalled automation from another automation.
481
- *
482
- * Calls the action providers for changes needed to make a preinstalled automation, such as changes made to email template.
483
- *
484
- * > **Note**: You must have an account permission to edit an app.
485
- * @param automation - Automation.
486
- * @public
487
- * @documentationMaturity preview
488
- * @requiredField automation
489
- * @fqn wix.automations.v2.AutomationsService.GeneratePreinstalledAutomation
490
- */
491
- export async function generatePreinstalledAutomation(automation, options) {
492
- // @ts-ignore
493
- const { httpClient, sideEffects } = arguments[2];
494
- const payload = renameKeysFromSDKRequestToRESTRequest({
495
- automation: automation,
496
- appId: options?.appId,
497
- });
498
- const reqOpts = ambassadorWixAutomationsV2Automation.generatePreinstalledAutomation(payload);
499
- sideEffects?.onSiteCall?.();
500
- try {
501
- const result = await httpClient.request(reqOpts);
502
- sideEffects?.onSuccess?.(result);
503
- return renameKeysFromRESTResponseToSDKResponse(result.data);
504
- }
505
- catch (err) {
506
- const transformedError = sdkTransformError(err, {
507
- spreadPathsToArguments: {},
508
- explicitPathsToArguments: { automation: '$[0]', appId: '$[1].appId' },
509
- singleArgumentUnchanged: false,
510
- }, ['automation', 'options']);
511
- sideEffects?.onError?.(err);
512
- throw transformedError;
513
- }
514
- }
515
- /**
516
- * Retrieves a list of automations. This includes both automations overridden on a site and preinstalled automations. If a preinstalled automation has been overridden on the site, the method returns the override automation.
517
- *
518
- * > **Note**: The method only returns automations by apps installed on the site.
519
- *
520
- * Learn more about [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
521
- * @public
522
- * @documentationMaturity preview
523
- * @permissionScope Manage Stores
524
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
525
- * @permissionScope Set Up Automations
526
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
527
- * @permissionId AUTOMATIONS.AUTOMATION_READ
528
- * @applicableIdentity APP
529
- * @fqn wix.automations.v2.AutomationsService.QueryAutomations
530
- */
531
- export function queryAutomations(options) {
532
- // @ts-ignore
533
- const { httpClient, sideEffects } = arguments[1];
534
- return queryBuilder({
535
- func: async (payload) => {
536
- const reqOpts = ambassadorWixAutomationsV2Automation.queryAutomations({
537
- ...payload,
538
- ...(options ?? {}),
539
- });
540
- sideEffects?.onSiteCall?.();
541
- try {
542
- const result = await httpClient.request(reqOpts);
543
- sideEffects?.onSuccess?.(result);
544
- return result;
545
- }
546
- catch (err) {
547
- sideEffects?.onError?.(err);
548
- throw err;
549
- }
550
- },
551
- requestTransformer: (query) => {
552
- const args = [query, options];
553
- return renameKeysFromSDKRequestToRESTRequest({
554
- ...args?.[1],
555
- query: args?.[0],
556
- });
557
- },
558
- responseTransformer: ({ data }) => {
559
- const transformedData = renameKeysFromRESTResponseToSDKResponse(transformPaths(data, []));
560
- return {
561
- items: transformedData?.automations,
562
- pagingMetadata: transformedData?.pagingMetadata,
563
- };
564
- },
565
- errorTransformer: (err) => {
566
- const transformedError = sdkTransformError(err, {
567
- spreadPathsToArguments: {},
568
- explicitPathsToArguments: { query: '$[0]' },
569
- singleArgumentUnchanged: false,
570
- });
571
- throw transformedError;
572
- },
573
- pagingMethod: 'CURSOR',
574
- transformationPaths: {},
575
- });
576
- }
577
- /**
578
- * Creates a copy of an action with a new ID, and changes the action's input mapping if necessary.
579
- *
580
- * The action copy isn't saved automatically. To save it, the user must perform an action
581
- * such as clicking the **Save** button.
582
- * @param automationId - ID of the automation to copy.
583
- * @public
584
- * @documentationMaturity preview
585
- * @requiredField automationId
586
- * @permissionId AUTOMATIONS.AUTOMATION_COPY
587
- * @permissionScope Manage Stores
588
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
589
- * @permissionScope Set Up Automations
590
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
591
- * @applicableIdentity APP
592
- * @fqn wix.automations.v2.AutomationsService.CopyAutomation
593
- */
594
- export async function copyAutomation(automationId, options) {
595
- // @ts-ignore
596
- const { httpClient, sideEffects } = arguments[2];
597
- const payload = renameKeysFromSDKRequestToRESTRequest({
598
- automationId: automationId,
599
- origin: options?.origin,
600
- automation: options?.automation,
601
- });
602
- const reqOpts = ambassadorWixAutomationsV2Automation.copyAutomation(payload);
603
- sideEffects?.onSiteCall?.();
604
- try {
605
- const result = await httpClient.request(reqOpts);
606
- sideEffects?.onSuccess?.(result);
607
- return renameKeysFromRESTResponseToSDKResponse(result.data);
608
- }
609
- catch (err) {
610
- const transformedError = sdkTransformError(err, {
611
- spreadPathsToArguments: {},
612
- explicitPathsToArguments: {
613
- automationId: '$[0]',
614
- origin: '$[1].origin',
615
- automation: '$[1].automation',
616
- },
617
- singleArgumentUnchanged: false,
618
- }, ['automationId', 'options']);
619
- sideEffects?.onError?.(err);
620
- throw transformedError;
621
- }
622
- }
623
- /**
624
- * Creates a draft automation.
625
- * @public
626
- * @documentationMaturity preview
627
- * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_CREATE
628
- * @permissionScope Manage Stores
629
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
630
- * @permissionScope Set Up Automations
631
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
632
- * @applicableIdentity APP
633
- * @fqn wix.automations.v2.AutomationsService.CreateDraftAutomation
634
- */
635
- export async function createDraftAutomation(options) {
636
- // @ts-ignore
637
- const { httpClient, sideEffects } = arguments[1];
638
- const payload = renameKeysFromSDKRequestToRESTRequest({
639
- automation: options?.automation,
640
- });
641
- const reqOpts = ambassadorWixAutomationsV2Automation.createDraftAutomation(payload);
642
- sideEffects?.onSiteCall?.();
643
- try {
644
- const result = await httpClient.request(reqOpts);
645
- sideEffects?.onSuccess?.(result);
646
- return renameKeysFromRESTResponseToSDKResponse(result.data);
647
- }
648
- catch (err) {
649
- const transformedError = sdkTransformError(err, {
650
- spreadPathsToArguments: {},
651
- explicitPathsToArguments: { automation: '$[0].automation' },
652
- singleArgumentUnchanged: false,
653
- }, ['options']);
654
- sideEffects?.onError?.(err);
655
- throw transformedError;
656
- }
657
- }
658
- /**
659
- * Retrieves the draft of the specified automation. If a draft doesn't exist, the method creates one.
660
- *
661
- * > **Note**: If the specified automation is a draft, the method returns it.
662
- * @param originalAutomationId - ID of the original automation on which the draft is based.
663
- * @public
664
- * @documentationMaturity preview
665
- * @requiredField originalAutomationId
666
- * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_CREATE
667
- * @permissionScope Manage Stores
668
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
669
- * @permissionScope Set Up Automations
670
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
671
- * @applicableIdentity APP
672
- * @fqn wix.automations.v2.AutomationsService.GetOrCreateDraftAutomation
673
- */
674
- export async function getOrCreateDraftAutomation(originalAutomationId) {
675
- // @ts-ignore
676
- const { httpClient, sideEffects } = arguments[1];
677
- const payload = renameKeysFromSDKRequestToRESTRequest({
678
- originalAutomationId: originalAutomationId,
679
- });
680
- const reqOpts = ambassadorWixAutomationsV2Automation.getOrCreateDraftAutomation(payload);
681
- sideEffects?.onSiteCall?.();
682
- try {
683
- const result = await httpClient.request(reqOpts);
684
- sideEffects?.onSuccess?.(result);
685
- return renameKeysFromRESTResponseToSDKResponse(result.data);
686
- }
687
- catch (err) {
688
- const transformedError = sdkTransformError(err, {
689
- spreadPathsToArguments: {},
690
- explicitPathsToArguments: { originalAutomationId: '$[0]' },
691
- singleArgumentUnchanged: false,
692
- }, ['originalAutomationId']);
693
- sideEffects?.onError?.(err);
694
- throw transformedError;
695
- }
696
- }
697
- /**
698
- * Updates a draft automation.
699
- * @param _id - Automation ID.
700
- * @public
701
- * @documentationMaturity preview
702
- * @requiredField _id
703
- * @requiredField automation
704
- * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_UPDATE
705
- * @permissionScope Manage Stores
706
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
707
- * @permissionScope Set Up Automations
708
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
709
- * @applicableIdentity APP
710
- * @fqn wix.automations.v2.AutomationsService.UpdateDraftAutomation
711
- */
712
- export async function updateDraftAutomation(_id, automation) {
713
- // @ts-ignore
714
- const { httpClient, sideEffects } = arguments[2];
715
- const payload = renameKeysFromSDKRequestToRESTRequest({
716
- automation: { ...automation, id: _id },
717
- });
718
- const reqOpts = ambassadorWixAutomationsV2Automation.updateDraftAutomation(payload);
719
- sideEffects?.onSiteCall?.();
720
- try {
721
- const result = await httpClient.request(reqOpts);
722
- sideEffects?.onSuccess?.(result);
723
- return renameKeysFromRESTResponseToSDKResponse(result.data);
724
- }
725
- catch (err) {
726
- const transformedError = sdkTransformError(err, {
727
- spreadPathsToArguments: { automation: '$[1]' },
728
- explicitPathsToArguments: { 'automation.id': '$[0]' },
729
- singleArgumentUnchanged: false,
730
- }, ['_id', 'automation']);
731
- sideEffects?.onError?.(err);
732
- throw transformedError;
733
- }
734
- }
735
- /**
736
- * Retrieves a list of automations, including drafts. Max query filter depth is 3.
737
- *
738
- * Relevant automations for the query are returned. This includes automations created on the site and pre-installed automations.
739
- * If there's an existing override for a pre-installed automation, the override is returned in the query result.
740
- * The query only returns automations from apps that are installed on the site.
741
- *
742
- * - new drafts that are not related to existing automations will be returned in the list
743
- * - the response will contain a map of originalAutomationId => relatedDrafts
744
- *
745
- * To learn about working with _Query_ endpoints, see
746
- * [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),
747
- * [Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),
748
- * and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).
749
- * @public
750
- * @documentationMaturity preview
751
- * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_READ
752
- * @permissionScope Manage Stores
753
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
754
- * @permissionScope Manage Restaurants - all permissions
755
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
756
- * @permissionScope Set Up Automations
757
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
758
- * @applicableIdentity APP
759
- * @fqn wix.automations.v2.AutomationsService.QueryAutomationsWithDrafts
760
- */
761
- export async function queryAutomationsWithDrafts(options) {
762
- // @ts-ignore
763
- const { httpClient, sideEffects } = arguments[1];
764
- const payload = renameKeysFromSDKRequestToRESTRequest({
765
- query: options?.query,
766
- });
767
- const reqOpts = ambassadorWixAutomationsV2Automation.queryAutomationsWithDrafts(payload);
768
- sideEffects?.onSiteCall?.();
769
- try {
770
- const result = await httpClient.request(reqOpts);
771
- sideEffects?.onSuccess?.(result);
772
- return renameKeysFromRESTResponseToSDKResponse(result.data);
773
- }
774
- catch (err) {
775
- const transformedError = sdkTransformError(err, {
776
- spreadPathsToArguments: {},
777
- explicitPathsToArguments: { query: '$[0].query' },
778
- singleArgumentUnchanged: false,
779
- }, ['options']);
780
- sideEffects?.onError?.(err);
781
- throw transformedError;
782
- }
783
- }
784
- /**
785
- * Deletes a draft automation.
786
- * @param automationId - ID of the draft automation to delete.
787
- * @public
788
- * @documentationMaturity preview
789
- * @requiredField automationId
790
- * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_DELETE
791
- * @permissionScope Manage Stores
792
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
793
- * @permissionScope Set Up Automations
794
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
795
- * @applicableIdentity APP
796
- * @fqn wix.automations.v2.AutomationsService.DeleteDraftAutomation
797
- */
798
- export async function deleteDraftAutomation(automationId) {
799
- // @ts-ignore
800
- const { httpClient, sideEffects } = arguments[1];
801
- const payload = renameKeysFromSDKRequestToRESTRequest({
802
- automationId: automationId,
803
- });
804
- const reqOpts = ambassadorWixAutomationsV2Automation.deleteDraftAutomation(payload);
805
- sideEffects?.onSiteCall?.();
806
- try {
807
- const result = await httpClient.request(reqOpts);
808
- sideEffects?.onSuccess?.(result);
809
- }
810
- catch (err) {
811
- const transformedError = sdkTransformError(err, {
812
- spreadPathsToArguments: {},
813
- explicitPathsToArguments: { automationId: '$[0]' },
814
- singleArgumentUnchanged: false,
815
- }, ['automationId']);
816
- sideEffects?.onError?.(err);
817
- throw transformedError;
818
- }
819
- }
820
- /**
821
- * Publishes a draft automation. This applies any changes to the live automation.
822
- * @param automationId - ID of the draft automation to publish.
823
- * @public
824
- * @documentationMaturity preview
825
- * @requiredField automationId
826
- * @permissionId AUTOMATIONS.AUTOMATION_UPDATE
827
- * @permissionScope Manage Stores
828
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
829
- * @permissionScope Set Up Automations
830
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
831
- * @applicableIdentity APP
832
- * @fqn wix.automations.v2.AutomationsService.PublishDraftAutomation
833
- */
834
- export async function publishDraftAutomation(automationId) {
835
- // @ts-ignore
836
- const { httpClient, sideEffects } = arguments[1];
837
- const payload = renameKeysFromSDKRequestToRESTRequest({
838
- automationId: automationId,
839
- });
840
- const reqOpts = ambassadorWixAutomationsV2Automation.publishDraftAutomation(payload);
841
- sideEffects?.onSiteCall?.();
842
- try {
843
- const result = await httpClient.request(reqOpts);
844
- sideEffects?.onSuccess?.(result);
845
- return renameKeysFromRESTResponseToSDKResponse(result.data);
846
- }
847
- catch (err) {
848
- const transformedError = sdkTransformError(err, {
849
- spreadPathsToArguments: {},
850
- explicitPathsToArguments: { automationId: '$[0]' },
851
- singleArgumentUnchanged: false,
852
- }, ['automationId']);
853
- sideEffects?.onError?.(err);
854
- throw transformedError;
855
- }
856
- }
857
- /**
858
- * Validates the specified automation.
859
- * @param automation - Automation to validate.
860
- * @public
861
- * @documentationMaturity preview
862
- * @requiredField automation
863
- * @permissionId AUTOMATIONS.AUTOMATION_VALIDATE
864
- * @permissionScope Manage Stores
865
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
866
- * @permissionScope Set Up Automations
867
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
868
- * @applicableIdentity APP
869
- * @fqn wix.automations.v2.AutomationsService.ValidateAutomation
870
- */
871
- export async function validateAutomation(automation, options) {
872
- // @ts-ignore
873
- const { httpClient, sideEffects } = arguments[2];
874
- const payload = renameKeysFromSDKRequestToRESTRequest({
875
- automation: automation,
876
- validationSettings: options?.validationSettings,
877
- });
878
- const reqOpts = ambassadorWixAutomationsV2Automation.validateAutomation(payload);
879
- sideEffects?.onSiteCall?.();
880
- try {
881
- const result = await httpClient.request(reqOpts);
882
- sideEffects?.onSuccess?.(result);
883
- return renameKeysFromRESTResponseToSDKResponse(result.data);
884
- }
885
- catch (err) {
886
- const transformedError = sdkTransformError(err, {
887
- spreadPathsToArguments: {},
888
- explicitPathsToArguments: {
889
- automation: '$[0]',
890
- validationSettings: '$[1].validationSettings',
891
- },
892
- singleArgumentUnchanged: false,
893
- }, ['automation', 'options']);
894
- sideEffects?.onError?.(err);
895
- throw transformedError;
896
- }
897
- }
898
- /**
899
- * Validates the automation specified by ID.
900
- * @param automationId - Automation ID.
901
- * @public
902
- * @documentationMaturity preview
903
- * @requiredField automationId
904
- * @permissionId AUTOMATIONS.AUTOMATION_VALIDATE
905
- * @permissionScope Manage Stores
906
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
907
- * @permissionScope Set Up Automations
908
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
909
- * @applicableIdentity APP
910
- * @fqn wix.automations.v2.AutomationsService.ValidateAutomationById
911
- */
912
- export async function validateAutomationById(automationId, options) {
913
- // @ts-ignore
914
- const { httpClient, sideEffects } = arguments[2];
915
- const payload = renameKeysFromSDKRequestToRESTRequest({
916
- automationId: automationId,
917
- validationSettings: options?.validationSettings,
918
- });
919
- const reqOpts = ambassadorWixAutomationsV2Automation.validateAutomationById(payload);
920
- sideEffects?.onSiteCall?.();
921
- try {
922
- const result = await httpClient.request(reqOpts);
923
- sideEffects?.onSuccess?.(result);
924
- return renameKeysFromRESTResponseToSDKResponse(result.data);
925
- }
926
- catch (err) {
927
- const transformedError = sdkTransformError(err, {
928
- spreadPathsToArguments: {},
929
- explicitPathsToArguments: {
930
- automationId: '$[0]',
931
- validationSettings: '$[1].validationSettings',
932
- },
933
- singleArgumentUnchanged: false,
934
- }, ['automationId', 'options']);
935
- sideEffects?.onError?.(err);
936
- throw transformedError;
937
- }
938
- }
939
- /**
940
- * Gets the specified automation revision.
941
- * @param automationId - Automation ID.
942
- * @public
943
- * @documentationMaturity preview
944
- * @requiredField automationId
945
- * @permissionId AUTOMATIONS.AUTOMATION_REVISION_READ
946
- * @permissionScope Manage Stores
947
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
948
- * @permissionScope Set Up Automations
949
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
950
- * @applicableIdentity APP
951
- * @fqn wix.automations.v2.AutomationRevisionsService.GetAutomationRevision
952
- */
953
- export async function getAutomationRevision(automationId, options) {
954
- // @ts-ignore
955
- const { httpClient, sideEffects } = arguments[2];
956
- const payload = renameKeysFromSDKRequestToRESTRequest({
957
- automationId: automationId,
958
- revision: options?.revision,
959
- fields: options?.fields,
960
- });
961
- const reqOpts = ambassadorWixAutomationsV2Automation.getAutomationRevision(payload);
962
- sideEffects?.onSiteCall?.();
963
- try {
964
- const result = await httpClient.request(reqOpts);
965
- sideEffects?.onSuccess?.(result);
966
- return renameKeysFromRESTResponseToSDKResponse(result.data);
967
- }
968
- catch (err) {
969
- const transformedError = sdkTransformError(err, {
970
- spreadPathsToArguments: {},
971
- explicitPathsToArguments: {
972
- automationId: '$[0]',
973
- revision: '$[1].revision',
974
- fields: '$[1].fields',
975
- },
976
- singleArgumentUnchanged: false,
977
- }, ['automationId', 'options']);
978
- sideEffects?.onError?.(err);
979
- throw transformedError;
980
- }
981
- }
982
- //# sourceMappingURL=automations-v2-automation-automations-v-2.universal.js.map