@wix/auto_sdk_automations_automations-v-2 1.0.3 → 1.0.5

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 (134) hide show
  1. package/build/{internal/cjs/src/automations-v2-automation-automations-v-2.universal.d.ts → automations-v2-automation-automations-v-2.universal-BVuQcd6J.d.mts} +223 -567
  2. package/build/{cjs/src/automations-v2-automation-automations-v-2.universal.d.ts → automations-v2-automation-automations-v-2.universal-BVuQcd6J.d.ts} +223 -567
  3. package/build/index.d.mts +202 -0
  4. package/build/index.d.ts +202 -0
  5. package/build/index.js +1562 -0
  6. package/build/index.js.map +1 -0
  7. package/build/index.mjs +1498 -0
  8. package/build/index.mjs.map +1 -0
  9. package/build/internal/{es/src/automations-v2-automation-automations-v-2.universal.d.ts → automations-v2-automation-automations-v-2.universal-BVuQcd6J.d.mts} +223 -567
  10. package/build/{es/src/automations-v2-automation-automations-v-2.universal.d.ts → internal/automations-v2-automation-automations-v-2.universal-BVuQcd6J.d.ts} +223 -567
  11. package/build/internal/index.d.mts +202 -0
  12. package/build/internal/index.d.ts +202 -0
  13. package/build/internal/index.js +1562 -0
  14. package/build/internal/index.js.map +1 -0
  15. package/build/internal/index.mjs +1498 -0
  16. package/build/internal/index.mjs.map +1 -0
  17. package/build/internal/meta.d.mts +1167 -0
  18. package/build/internal/meta.d.ts +1167 -0
  19. package/build/internal/meta.js +963 -0
  20. package/build/internal/meta.js.map +1 -0
  21. package/build/internal/meta.mjs +920 -0
  22. package/build/internal/meta.mjs.map +1 -0
  23. package/build/meta.d.mts +1167 -0
  24. package/build/meta.d.ts +1167 -0
  25. package/build/meta.js +963 -0
  26. package/build/meta.js.map +1 -0
  27. package/build/meta.mjs +920 -0
  28. package/build/meta.mjs.map +1 -0
  29. package/package.json +13 -12
  30. package/build/cjs/index.d.ts +0 -1
  31. package/build/cjs/index.js +0 -18
  32. package/build/cjs/index.js.map +0 -1
  33. package/build/cjs/index.typings.d.ts +0 -1
  34. package/build/cjs/index.typings.js +0 -18
  35. package/build/cjs/index.typings.js.map +0 -1
  36. package/build/cjs/meta.d.ts +0 -1
  37. package/build/cjs/meta.js +0 -18
  38. package/build/cjs/meta.js.map +0 -1
  39. package/build/cjs/src/automations-v2-automation-automations-v-2.context.d.ts +0 -37
  40. package/build/cjs/src/automations-v2-automation-automations-v-2.context.js +0 -61
  41. package/build/cjs/src/automations-v2-automation-automations-v-2.context.js.map +0 -1
  42. package/build/cjs/src/automations-v2-automation-automations-v-2.http.d.ts +0 -74
  43. package/build/cjs/src/automations-v2-automation-automations-v-2.http.js +0 -666
  44. package/build/cjs/src/automations-v2-automation-automations-v-2.http.js.map +0 -1
  45. package/build/cjs/src/automations-v2-automation-automations-v-2.meta.d.ts +0 -49
  46. package/build/cjs/src/automations-v2-automation-automations-v-2.meta.js +0 -351
  47. package/build/cjs/src/automations-v2-automation-automations-v-2.meta.js.map +0 -1
  48. package/build/cjs/src/automations-v2-automation-automations-v-2.public.d.ts +0 -172
  49. package/build/cjs/src/automations-v2-automation-automations-v-2.public.js +0 -167
  50. package/build/cjs/src/automations-v2-automation-automations-v-2.public.js.map +0 -1
  51. package/build/cjs/src/automations-v2-automation-automations-v-2.types.d.ts +0 -2222
  52. package/build/cjs/src/automations-v2-automation-automations-v-2.types.js +0 -275
  53. package/build/cjs/src/automations-v2-automation-automations-v-2.types.js.map +0 -1
  54. package/build/cjs/src/automations-v2-automation-automations-v-2.universal.js +0 -1024
  55. package/build/cjs/src/automations-v2-automation-automations-v-2.universal.js.map +0 -1
  56. package/build/es/index.d.ts +0 -1
  57. package/build/es/index.js +0 -2
  58. package/build/es/index.js.map +0 -1
  59. package/build/es/index.typings.d.ts +0 -1
  60. package/build/es/index.typings.js +0 -2
  61. package/build/es/index.typings.js.map +0 -1
  62. package/build/es/meta.d.ts +0 -1
  63. package/build/es/meta.js +0 -2
  64. package/build/es/meta.js.map +0 -1
  65. package/build/es/package.json +0 -3
  66. package/build/es/src/automations-v2-automation-automations-v-2.context.d.ts +0 -37
  67. package/build/es/src/automations-v2-automation-automations-v-2.context.js +0 -37
  68. package/build/es/src/automations-v2-automation-automations-v-2.context.js.map +0 -1
  69. package/build/es/src/automations-v2-automation-automations-v-2.http.d.ts +0 -74
  70. package/build/es/src/automations-v2-automation-automations-v-2.http.js +0 -646
  71. package/build/es/src/automations-v2-automation-automations-v-2.http.js.map +0 -1
  72. package/build/es/src/automations-v2-automation-automations-v-2.meta.d.ts +0 -49
  73. package/build/es/src/automations-v2-automation-automations-v-2.meta.js +0 -308
  74. package/build/es/src/automations-v2-automation-automations-v-2.meta.js.map +0 -1
  75. package/build/es/src/automations-v2-automation-automations-v-2.public.d.ts +0 -172
  76. package/build/es/src/automations-v2-automation-automations-v-2.public.js +0 -126
  77. package/build/es/src/automations-v2-automation-automations-v-2.public.js.map +0 -1
  78. package/build/es/src/automations-v2-automation-automations-v-2.types.d.ts +0 -2222
  79. package/build/es/src/automations-v2-automation-automations-v-2.types.js +0 -272
  80. package/build/es/src/automations-v2-automation-automations-v-2.types.js.map +0 -1
  81. package/build/es/src/automations-v2-automation-automations-v-2.universal.js +0 -981
  82. package/build/es/src/automations-v2-automation-automations-v-2.universal.js.map +0 -1
  83. package/build/internal/cjs/index.d.ts +0 -1
  84. package/build/internal/cjs/index.js +0 -18
  85. package/build/internal/cjs/index.js.map +0 -1
  86. package/build/internal/cjs/index.typings.d.ts +0 -1
  87. package/build/internal/cjs/index.typings.js +0 -18
  88. package/build/internal/cjs/index.typings.js.map +0 -1
  89. package/build/internal/cjs/meta.d.ts +0 -1
  90. package/build/internal/cjs/meta.js +0 -18
  91. package/build/internal/cjs/meta.js.map +0 -1
  92. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.context.d.ts +0 -37
  93. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.context.js +0 -61
  94. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.context.js.map +0 -1
  95. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.http.d.ts +0 -74
  96. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.http.js +0 -666
  97. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.http.js.map +0 -1
  98. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.meta.d.ts +0 -49
  99. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.meta.js +0 -351
  100. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.meta.js.map +0 -1
  101. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.public.d.ts +0 -172
  102. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.public.js +0 -167
  103. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.public.js.map +0 -1
  104. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.types.d.ts +0 -2222
  105. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.types.js +0 -275
  106. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.types.js.map +0 -1
  107. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.universal.js +0 -1024
  108. package/build/internal/cjs/src/automations-v2-automation-automations-v-2.universal.js.map +0 -1
  109. package/build/internal/es/index.d.ts +0 -1
  110. package/build/internal/es/index.js +0 -2
  111. package/build/internal/es/index.js.map +0 -1
  112. package/build/internal/es/index.typings.d.ts +0 -1
  113. package/build/internal/es/index.typings.js +0 -2
  114. package/build/internal/es/index.typings.js.map +0 -1
  115. package/build/internal/es/meta.d.ts +0 -1
  116. package/build/internal/es/meta.js +0 -2
  117. package/build/internal/es/meta.js.map +0 -1
  118. package/build/internal/es/src/automations-v2-automation-automations-v-2.context.d.ts +0 -37
  119. package/build/internal/es/src/automations-v2-automation-automations-v-2.context.js +0 -37
  120. package/build/internal/es/src/automations-v2-automation-automations-v-2.context.js.map +0 -1
  121. package/build/internal/es/src/automations-v2-automation-automations-v-2.http.d.ts +0 -74
  122. package/build/internal/es/src/automations-v2-automation-automations-v-2.http.js +0 -646
  123. package/build/internal/es/src/automations-v2-automation-automations-v-2.http.js.map +0 -1
  124. package/build/internal/es/src/automations-v2-automation-automations-v-2.meta.d.ts +0 -49
  125. package/build/internal/es/src/automations-v2-automation-automations-v-2.meta.js +0 -308
  126. package/build/internal/es/src/automations-v2-automation-automations-v-2.meta.js.map +0 -1
  127. package/build/internal/es/src/automations-v2-automation-automations-v-2.public.d.ts +0 -172
  128. package/build/internal/es/src/automations-v2-automation-automations-v-2.public.js +0 -126
  129. package/build/internal/es/src/automations-v2-automation-automations-v-2.public.js.map +0 -1
  130. package/build/internal/es/src/automations-v2-automation-automations-v-2.types.d.ts +0 -2222
  131. package/build/internal/es/src/automations-v2-automation-automations-v-2.types.js +0 -272
  132. package/build/internal/es/src/automations-v2-automation-automations-v-2.types.js.map +0 -1
  133. package/build/internal/es/src/automations-v2-automation-automations-v-2.universal.js +0 -981
  134. package/build/internal/es/src/automations-v2-automation-automations-v-2.universal.js.map +0 -1
@@ -1,981 +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 || (ActionErrorType = {}));
268
- export var AutomationValidationErrorValidationErrorType;
269
- (function (AutomationValidationErrorValidationErrorType) {
270
- AutomationValidationErrorValidationErrorType["UNKNOWN_VALIDATION_ERROR_TYPE"] = "UNKNOWN_VALIDATION_ERROR_TYPE";
271
- AutomationValidationErrorValidationErrorType["CONFIGURATION_ERROR"] = "CONFIGURATION_ERROR";
272
- AutomationValidationErrorValidationErrorType["PROVIDER_ERROR"] = "PROVIDER_ERROR";
273
- })(AutomationValidationErrorValidationErrorType || (AutomationValidationErrorValidationErrorType = {}));
274
- export var AutomationErrorType;
275
- (function (AutomationErrorType) {
276
- AutomationErrorType["UNKNOWN_AUTOMATION_ERROR_TYPE"] = "UNKNOWN_AUTOMATION_ERROR_TYPE";
277
- })(AutomationErrorType || (AutomationErrorType = {}));
278
- /**
279
- * Creates an automation.
280
- * @param automation - Automation to create.
281
- * @public
282
- * @documentationMaturity preview
283
- * @requiredField automation
284
- * @requiredField automation.configuration
285
- * @requiredField automation.configuration.actions
286
- * @requiredField automation.configuration.rootActionIds
287
- * @requiredField automation.configuration.status
288
- * @requiredField automation.configuration.trigger
289
- * @requiredField automation.configuration.trigger.appId
290
- * @requiredField automation.configuration.trigger.triggerKey
291
- * @requiredField automation.name
292
- * @requiredField automation.origin
293
- * @permissionId AUTOMATIONS.AUTOMATION_CREATE
294
- * @permissionScope Manage Stores
295
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
296
- * @permissionScope Set Up Automations
297
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
298
- * @applicableIdentity APP
299
- * @returns Details of the created automation.
300
- * @fqn wix.automations.v2.AutomationsService.CreateAutomation
301
- */
302
- export async function createAutomation(automation) {
303
- // @ts-ignore
304
- const { httpClient, sideEffects } = arguments[1];
305
- const payload = renameKeysFromSDKRequestToRESTRequest({
306
- automation: automation,
307
- });
308
- const reqOpts = ambassadorWixAutomationsV2Automation.createAutomation(payload);
309
- sideEffects?.onSiteCall?.();
310
- try {
311
- const result = await httpClient.request(reqOpts);
312
- sideEffects?.onSuccess?.(result);
313
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.automation;
314
- }
315
- catch (err) {
316
- const transformedError = sdkTransformError(err, {
317
- spreadPathsToArguments: {},
318
- explicitPathsToArguments: { automation: '$[0]' },
319
- singleArgumentUnchanged: false,
320
- }, ['automation']);
321
- sideEffects?.onError?.(err);
322
- throw transformedError;
323
- }
324
- }
325
- /**
326
- * Retrieves an automation by ID.
327
- * @param automationId - Automation ID.
328
- * @public
329
- * @documentationMaturity preview
330
- * @requiredField automationId
331
- * @permissionId AUTOMATIONS.AUTOMATION_READ
332
- * @permissionScope Manage Stores
333
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
334
- * @permissionScope Set Up Automations
335
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
336
- * @applicableIdentity APP
337
- * @returns Retrieved automation.
338
- * @fqn wix.automations.v2.AutomationsService.GetAutomation
339
- */
340
- export async function getAutomation(automationId) {
341
- // @ts-ignore
342
- const { httpClient, sideEffects } = arguments[1];
343
- const payload = renameKeysFromSDKRequestToRESTRequest({
344
- automationId: automationId,
345
- });
346
- const reqOpts = ambassadorWixAutomationsV2Automation.getAutomation(payload);
347
- sideEffects?.onSiteCall?.();
348
- try {
349
- const result = await httpClient.request(reqOpts);
350
- sideEffects?.onSuccess?.(result);
351
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.automation;
352
- }
353
- catch (err) {
354
- const transformedError = sdkTransformError(err, {
355
- spreadPathsToArguments: {},
356
- explicitPathsToArguments: { automationId: '$[0]' },
357
- singleArgumentUnchanged: false,
358
- }, ['automationId']);
359
- sideEffects?.onError?.(err);
360
- throw transformedError;
361
- }
362
- }
363
- /**
364
- * Updates the specified automation.
365
- *
366
- * When an automation is updated, its `revision` property is incremented by 1. When updating an automation, you must specify the current revision number.
367
- * @param _id - Automation ID.
368
- * @public
369
- * @documentationMaturity preview
370
- * @requiredField _id
371
- * @requiredField automation
372
- * @requiredField automation.revision
373
- * @permissionId AUTOMATIONS.AUTOMATION_UPDATE
374
- * @permissionScope Manage Stores
375
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
376
- * @permissionScope Set Up Automations
377
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
378
- * @applicableIdentity APP
379
- * @returns Updated automation.
380
- * @fqn wix.automations.v2.AutomationsService.UpdateAutomation
381
- */
382
- export async function updateAutomation(_id, automation) {
383
- // @ts-ignore
384
- const { httpClient, sideEffects } = arguments[2];
385
- const payload = renameKeysFromSDKRequestToRESTRequest({
386
- automation: { ...automation, id: _id },
387
- });
388
- const reqOpts = ambassadorWixAutomationsV2Automation.updateAutomation(payload);
389
- sideEffects?.onSiteCall?.();
390
- try {
391
- const result = await httpClient.request(reqOpts);
392
- sideEffects?.onSuccess?.(result);
393
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.automation;
394
- }
395
- catch (err) {
396
- const transformedError = sdkTransformError(err, {
397
- spreadPathsToArguments: { automation: '$[1]' },
398
- explicitPathsToArguments: { 'automation.id': '$[0]' },
399
- singleArgumentUnchanged: false,
400
- }, ['_id', 'automation']);
401
- sideEffects?.onError?.(err);
402
- throw transformedError;
403
- }
404
- }
405
- /**
406
- * Deletes the specified automation.
407
- * @param automationId - Automation ID.
408
- * @public
409
- * @documentationMaturity preview
410
- * @requiredField automationId
411
- * @permissionId AUTOMATIONS.AUTOMATION_DELETE
412
- * @permissionScope Manage Stores
413
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
414
- * @permissionScope Set Up Automations
415
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
416
- * @applicableIdentity APP
417
- * @fqn wix.automations.v2.AutomationsService.DeleteAutomation
418
- */
419
- export async function deleteAutomation(automationId) {
420
- // @ts-ignore
421
- const { httpClient, sideEffects } = arguments[1];
422
- const payload = renameKeysFromSDKRequestToRESTRequest({
423
- automationId: automationId,
424
- });
425
- const reqOpts = ambassadorWixAutomationsV2Automation.deleteAutomation(payload);
426
- sideEffects?.onSiteCall?.();
427
- try {
428
- const result = await httpClient.request(reqOpts);
429
- sideEffects?.onSuccess?.(result);
430
- }
431
- catch (err) {
432
- const transformedError = sdkTransformError(err, {
433
- spreadPathsToArguments: {},
434
- explicitPathsToArguments: { automationId: '$[0]' },
435
- singleArgumentUnchanged: false,
436
- }, ['automationId']);
437
- sideEffects?.onError?.(err);
438
- throw transformedError;
439
- }
440
- }
441
- /**
442
- * Deletes one or more automations.
443
- * @param automationIds - IDs of the automations to delete.
444
- * @public
445
- * @documentationMaturity preview
446
- * @requiredField automationIds
447
- * @permissionId AUTOMATIONS.AUTOMATION_DELETE
448
- * @permissionScope Manage Stores
449
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
450
- * @permissionScope Set Up Automations
451
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
452
- * @applicableIdentity APP
453
- * @fqn wix.automations.v2.AutomationsService.BulkDeleteAutomations
454
- */
455
- export async function bulkDeleteAutomations(automationIds) {
456
- // @ts-ignore
457
- const { httpClient, sideEffects } = arguments[1];
458
- const payload = renameKeysFromSDKRequestToRESTRequest({
459
- automationIds: automationIds,
460
- });
461
- const reqOpts = ambassadorWixAutomationsV2Automation.bulkDeleteAutomations(payload);
462
- sideEffects?.onSiteCall?.();
463
- try {
464
- const result = await httpClient.request(reqOpts);
465
- sideEffects?.onSuccess?.(result);
466
- return renameKeysFromRESTResponseToSDKResponse(result.data);
467
- }
468
- catch (err) {
469
- const transformedError = sdkTransformError(err, {
470
- spreadPathsToArguments: {},
471
- explicitPathsToArguments: { automationIds: '$[0]' },
472
- singleArgumentUnchanged: false,
473
- }, ['automationIds']);
474
- sideEffects?.onError?.(err);
475
- throw transformedError;
476
- }
477
- }
478
- /**
479
- * Generates a preinstalled automation from another automation.
480
- *
481
- * Calls the action providers for changes needed to make a preinstalled automation, such as changes made to email template.
482
- *
483
- * > **Note**: You must have an account permission to edit an app.
484
- * @param automation - Automation.
485
- * @public
486
- * @documentationMaturity preview
487
- * @requiredField automation
488
- * @fqn wix.automations.v2.AutomationsService.GeneratePreinstalledAutomation
489
- */
490
- export async function generatePreinstalledAutomation(automation, options) {
491
- // @ts-ignore
492
- const { httpClient, sideEffects } = arguments[2];
493
- const payload = renameKeysFromSDKRequestToRESTRequest({
494
- automation: automation,
495
- appId: options?.appId,
496
- });
497
- const reqOpts = ambassadorWixAutomationsV2Automation.generatePreinstalledAutomation(payload);
498
- sideEffects?.onSiteCall?.();
499
- try {
500
- const result = await httpClient.request(reqOpts);
501
- sideEffects?.onSuccess?.(result);
502
- return renameKeysFromRESTResponseToSDKResponse(result.data);
503
- }
504
- catch (err) {
505
- const transformedError = sdkTransformError(err, {
506
- spreadPathsToArguments: {},
507
- explicitPathsToArguments: { automation: '$[0]', appId: '$[1].appId' },
508
- singleArgumentUnchanged: false,
509
- }, ['automation', 'options']);
510
- sideEffects?.onError?.(err);
511
- throw transformedError;
512
- }
513
- }
514
- /**
515
- * 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.
516
- *
517
- * > **Note**: The method only returns automations by apps installed on the site.
518
- *
519
- * Learn more about [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language).
520
- * @public
521
- * @documentationMaturity preview
522
- * @permissionScope Manage Stores
523
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
524
- * @permissionScope Set Up Automations
525
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
526
- * @permissionId AUTOMATIONS.AUTOMATION_READ
527
- * @applicableIdentity APP
528
- * @fqn wix.automations.v2.AutomationsService.QueryAutomations
529
- */
530
- export function queryAutomations(options) {
531
- // @ts-ignore
532
- const { httpClient, sideEffects } = arguments[1];
533
- return queryBuilder({
534
- func: async (payload) => {
535
- const reqOpts = ambassadorWixAutomationsV2Automation.queryAutomations({
536
- ...payload,
537
- ...(options ?? {}),
538
- });
539
- sideEffects?.onSiteCall?.();
540
- try {
541
- const result = await httpClient.request(reqOpts);
542
- sideEffects?.onSuccess?.(result);
543
- return result;
544
- }
545
- catch (err) {
546
- sideEffects?.onError?.(err);
547
- throw err;
548
- }
549
- },
550
- requestTransformer: (query) => {
551
- const args = [query, options];
552
- return renameKeysFromSDKRequestToRESTRequest({
553
- ...args?.[1],
554
- query: args?.[0],
555
- });
556
- },
557
- responseTransformer: ({ data }) => {
558
- const transformedData = renameKeysFromRESTResponseToSDKResponse(transformPaths(data, []));
559
- return {
560
- items: transformedData?.automations,
561
- pagingMetadata: transformedData?.pagingMetadata,
562
- };
563
- },
564
- errorTransformer: (err) => {
565
- const transformedError = sdkTransformError(err, {
566
- spreadPathsToArguments: {},
567
- explicitPathsToArguments: { query: '$[0]' },
568
- singleArgumentUnchanged: false,
569
- });
570
- throw transformedError;
571
- },
572
- pagingMethod: 'CURSOR',
573
- transformationPaths: {},
574
- });
575
- }
576
- /**
577
- * Creates a copy of an action with a new ID, and changes the action's input mapping if necessary.
578
- *
579
- * The action copy isn't saved automatically. To save it, the user must perform an action
580
- * such as clicking the **Save** button.
581
- * @param automationId - ID of the automation to copy.
582
- * @public
583
- * @documentationMaturity preview
584
- * @requiredField automationId
585
- * @permissionId AUTOMATIONS.AUTOMATION_COPY
586
- * @permissionScope Manage Stores
587
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
588
- * @permissionScope Set Up Automations
589
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
590
- * @applicableIdentity APP
591
- * @fqn wix.automations.v2.AutomationsService.CopyAutomation
592
- */
593
- export async function copyAutomation(automationId, options) {
594
- // @ts-ignore
595
- const { httpClient, sideEffects } = arguments[2];
596
- const payload = renameKeysFromSDKRequestToRESTRequest({
597
- automationId: automationId,
598
- origin: options?.origin,
599
- automation: options?.automation,
600
- });
601
- const reqOpts = ambassadorWixAutomationsV2Automation.copyAutomation(payload);
602
- sideEffects?.onSiteCall?.();
603
- try {
604
- const result = await httpClient.request(reqOpts);
605
- sideEffects?.onSuccess?.(result);
606
- return renameKeysFromRESTResponseToSDKResponse(result.data);
607
- }
608
- catch (err) {
609
- const transformedError = sdkTransformError(err, {
610
- spreadPathsToArguments: {},
611
- explicitPathsToArguments: {
612
- automationId: '$[0]',
613
- origin: '$[1].origin',
614
- automation: '$[1].automation',
615
- },
616
- singleArgumentUnchanged: false,
617
- }, ['automationId', 'options']);
618
- sideEffects?.onError?.(err);
619
- throw transformedError;
620
- }
621
- }
622
- /**
623
- * Creates a draft automation.
624
- * @public
625
- * @documentationMaturity preview
626
- * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_CREATE
627
- * @permissionScope Manage Stores
628
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
629
- * @permissionScope Set Up Automations
630
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
631
- * @applicableIdentity APP
632
- * @fqn wix.automations.v2.AutomationsService.CreateDraftAutomation
633
- */
634
- export async function createDraftAutomation(options) {
635
- // @ts-ignore
636
- const { httpClient, sideEffects } = arguments[1];
637
- const payload = renameKeysFromSDKRequestToRESTRequest({
638
- automation: options?.automation,
639
- });
640
- const reqOpts = ambassadorWixAutomationsV2Automation.createDraftAutomation(payload);
641
- sideEffects?.onSiteCall?.();
642
- try {
643
- const result = await httpClient.request(reqOpts);
644
- sideEffects?.onSuccess?.(result);
645
- return renameKeysFromRESTResponseToSDKResponse(result.data);
646
- }
647
- catch (err) {
648
- const transformedError = sdkTransformError(err, {
649
- spreadPathsToArguments: {},
650
- explicitPathsToArguments: { automation: '$[0].automation' },
651
- singleArgumentUnchanged: false,
652
- }, ['options']);
653
- sideEffects?.onError?.(err);
654
- throw transformedError;
655
- }
656
- }
657
- /**
658
- * Retrieves the draft of the specified automation. If a draft doesn't exist, the method creates one.
659
- *
660
- * > **Note**: If the specified automation is a draft, the method returns it.
661
- * @param originalAutomationId - ID of the original automation on which the draft is based.
662
- * @public
663
- * @documentationMaturity preview
664
- * @requiredField originalAutomationId
665
- * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_CREATE
666
- * @permissionScope Manage Stores
667
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
668
- * @permissionScope Set Up Automations
669
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
670
- * @applicableIdentity APP
671
- * @fqn wix.automations.v2.AutomationsService.GetOrCreateDraftAutomation
672
- */
673
- export async function getOrCreateDraftAutomation(originalAutomationId) {
674
- // @ts-ignore
675
- const { httpClient, sideEffects } = arguments[1];
676
- const payload = renameKeysFromSDKRequestToRESTRequest({
677
- originalAutomationId: originalAutomationId,
678
- });
679
- const reqOpts = ambassadorWixAutomationsV2Automation.getOrCreateDraftAutomation(payload);
680
- sideEffects?.onSiteCall?.();
681
- try {
682
- const result = await httpClient.request(reqOpts);
683
- sideEffects?.onSuccess?.(result);
684
- return renameKeysFromRESTResponseToSDKResponse(result.data);
685
- }
686
- catch (err) {
687
- const transformedError = sdkTransformError(err, {
688
- spreadPathsToArguments: {},
689
- explicitPathsToArguments: { originalAutomationId: '$[0]' },
690
- singleArgumentUnchanged: false,
691
- }, ['originalAutomationId']);
692
- sideEffects?.onError?.(err);
693
- throw transformedError;
694
- }
695
- }
696
- /**
697
- * Updates a draft automation.
698
- * @param _id - Automation ID.
699
- * @public
700
- * @documentationMaturity preview
701
- * @requiredField _id
702
- * @requiredField automation
703
- * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_UPDATE
704
- * @permissionScope Manage Stores
705
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
706
- * @permissionScope Set Up Automations
707
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
708
- * @applicableIdentity APP
709
- * @fqn wix.automations.v2.AutomationsService.UpdateDraftAutomation
710
- */
711
- export async function updateDraftAutomation(_id, automation) {
712
- // @ts-ignore
713
- const { httpClient, sideEffects } = arguments[2];
714
- const payload = renameKeysFromSDKRequestToRESTRequest({
715
- automation: { ...automation, id: _id },
716
- });
717
- const reqOpts = ambassadorWixAutomationsV2Automation.updateDraftAutomation(payload);
718
- sideEffects?.onSiteCall?.();
719
- try {
720
- const result = await httpClient.request(reqOpts);
721
- sideEffects?.onSuccess?.(result);
722
- return renameKeysFromRESTResponseToSDKResponse(result.data);
723
- }
724
- catch (err) {
725
- const transformedError = sdkTransformError(err, {
726
- spreadPathsToArguments: { automation: '$[1]' },
727
- explicitPathsToArguments: { 'automation.id': '$[0]' },
728
- singleArgumentUnchanged: false,
729
- }, ['_id', 'automation']);
730
- sideEffects?.onError?.(err);
731
- throw transformedError;
732
- }
733
- }
734
- /**
735
- * Retrieves a list of automations, including drafts. Max query filter depth is 3.
736
- *
737
- * Relevant automations for the query are returned. This includes automations created on the site and pre-installed automations.
738
- * If there's an existing override for a pre-installed automation, the override is returned in the query result.
739
- * The query only returns automations from apps that are installed on the site.
740
- *
741
- * - new drafts that are not related to existing automations will be returned in the list
742
- * - the response will contain a map of originalAutomationId => relatedDrafts
743
- *
744
- * To learn about working with _Query_ endpoints, see
745
- * [API Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language),
746
- * [Sorting and Paging](https://dev.wix.com/api/rest/getting-started/pagination),
747
- * and [Field Projection](https://dev.wix.com/api/rest/getting-started/field-projection).
748
- * @public
749
- * @documentationMaturity preview
750
- * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_READ
751
- * @permissionScope Manage Stores
752
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
753
- * @permissionScope Manage Restaurants - all permissions
754
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
755
- * @permissionScope Set Up Automations
756
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
757
- * @applicableIdentity APP
758
- * @fqn wix.automations.v2.AutomationsService.QueryAutomationsWithDrafts
759
- */
760
- export async function queryAutomationsWithDrafts(options) {
761
- // @ts-ignore
762
- const { httpClient, sideEffects } = arguments[1];
763
- const payload = renameKeysFromSDKRequestToRESTRequest({
764
- query: options?.query,
765
- });
766
- const reqOpts = ambassadorWixAutomationsV2Automation.queryAutomationsWithDrafts(payload);
767
- sideEffects?.onSiteCall?.();
768
- try {
769
- const result = await httpClient.request(reqOpts);
770
- sideEffects?.onSuccess?.(result);
771
- return renameKeysFromRESTResponseToSDKResponse(result.data);
772
- }
773
- catch (err) {
774
- const transformedError = sdkTransformError(err, {
775
- spreadPathsToArguments: {},
776
- explicitPathsToArguments: { query: '$[0].query' },
777
- singleArgumentUnchanged: false,
778
- }, ['options']);
779
- sideEffects?.onError?.(err);
780
- throw transformedError;
781
- }
782
- }
783
- /**
784
- * Deletes a draft automation.
785
- * @param automationId - ID of the draft automation to delete.
786
- * @public
787
- * @documentationMaturity preview
788
- * @requiredField automationId
789
- * @permissionId AUTOMATIONS.AUTOMATION_DRAFT_DELETE
790
- * @permissionScope Manage Stores
791
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
792
- * @permissionScope Set Up Automations
793
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
794
- * @applicableIdentity APP
795
- * @fqn wix.automations.v2.AutomationsService.DeleteDraftAutomation
796
- */
797
- export async function deleteDraftAutomation(automationId) {
798
- // @ts-ignore
799
- const { httpClient, sideEffects } = arguments[1];
800
- const payload = renameKeysFromSDKRequestToRESTRequest({
801
- automationId: automationId,
802
- });
803
- const reqOpts = ambassadorWixAutomationsV2Automation.deleteDraftAutomation(payload);
804
- sideEffects?.onSiteCall?.();
805
- try {
806
- const result = await httpClient.request(reqOpts);
807
- sideEffects?.onSuccess?.(result);
808
- }
809
- catch (err) {
810
- const transformedError = sdkTransformError(err, {
811
- spreadPathsToArguments: {},
812
- explicitPathsToArguments: { automationId: '$[0]' },
813
- singleArgumentUnchanged: false,
814
- }, ['automationId']);
815
- sideEffects?.onError?.(err);
816
- throw transformedError;
817
- }
818
- }
819
- /**
820
- * Publishes a draft automation. This applies any changes to the live automation.
821
- * @param automationId - ID of the draft automation to publish.
822
- * @public
823
- * @documentationMaturity preview
824
- * @requiredField automationId
825
- * @permissionId AUTOMATIONS.AUTOMATION_UPDATE
826
- * @permissionScope Manage Stores
827
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
828
- * @permissionScope Set Up Automations
829
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
830
- * @applicableIdentity APP
831
- * @fqn wix.automations.v2.AutomationsService.PublishDraftAutomation
832
- */
833
- export async function publishDraftAutomation(automationId) {
834
- // @ts-ignore
835
- const { httpClient, sideEffects } = arguments[1];
836
- const payload = renameKeysFromSDKRequestToRESTRequest({
837
- automationId: automationId,
838
- });
839
- const reqOpts = ambassadorWixAutomationsV2Automation.publishDraftAutomation(payload);
840
- sideEffects?.onSiteCall?.();
841
- try {
842
- const result = await httpClient.request(reqOpts);
843
- sideEffects?.onSuccess?.(result);
844
- return renameKeysFromRESTResponseToSDKResponse(result.data);
845
- }
846
- catch (err) {
847
- const transformedError = sdkTransformError(err, {
848
- spreadPathsToArguments: {},
849
- explicitPathsToArguments: { automationId: '$[0]' },
850
- singleArgumentUnchanged: false,
851
- }, ['automationId']);
852
- sideEffects?.onError?.(err);
853
- throw transformedError;
854
- }
855
- }
856
- /**
857
- * Validates the specified automation.
858
- * @param automation - Automation to validate.
859
- * @public
860
- * @documentationMaturity preview
861
- * @requiredField automation
862
- * @permissionId AUTOMATIONS.AUTOMATION_VALIDATE
863
- * @permissionScope Manage Stores
864
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
865
- * @permissionScope Set Up Automations
866
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
867
- * @applicableIdentity APP
868
- * @fqn wix.automations.v2.AutomationsService.ValidateAutomation
869
- */
870
- export async function validateAutomation(automation, options) {
871
- // @ts-ignore
872
- const { httpClient, sideEffects } = arguments[2];
873
- const payload = renameKeysFromSDKRequestToRESTRequest({
874
- automation: automation,
875
- validationSettings: options?.validationSettings,
876
- });
877
- const reqOpts = ambassadorWixAutomationsV2Automation.validateAutomation(payload);
878
- sideEffects?.onSiteCall?.();
879
- try {
880
- const result = await httpClient.request(reqOpts);
881
- sideEffects?.onSuccess?.(result);
882
- return renameKeysFromRESTResponseToSDKResponse(result.data);
883
- }
884
- catch (err) {
885
- const transformedError = sdkTransformError(err, {
886
- spreadPathsToArguments: {},
887
- explicitPathsToArguments: {
888
- automation: '$[0]',
889
- validationSettings: '$[1].validationSettings',
890
- },
891
- singleArgumentUnchanged: false,
892
- }, ['automation', 'options']);
893
- sideEffects?.onError?.(err);
894
- throw transformedError;
895
- }
896
- }
897
- /**
898
- * Validates the automation specified by ID.
899
- * @param automationId - Automation ID.
900
- * @public
901
- * @documentationMaturity preview
902
- * @requiredField automationId
903
- * @permissionId AUTOMATIONS.AUTOMATION_VALIDATE
904
- * @permissionScope Manage Stores
905
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
906
- * @permissionScope Set Up Automations
907
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
908
- * @applicableIdentity APP
909
- * @fqn wix.automations.v2.AutomationsService.ValidateAutomationById
910
- */
911
- export async function validateAutomationById(automationId, options) {
912
- // @ts-ignore
913
- const { httpClient, sideEffects } = arguments[2];
914
- const payload = renameKeysFromSDKRequestToRESTRequest({
915
- automationId: automationId,
916
- validationSettings: options?.validationSettings,
917
- });
918
- const reqOpts = ambassadorWixAutomationsV2Automation.validateAutomationById(payload);
919
- sideEffects?.onSiteCall?.();
920
- try {
921
- const result = await httpClient.request(reqOpts);
922
- sideEffects?.onSuccess?.(result);
923
- return renameKeysFromRESTResponseToSDKResponse(result.data);
924
- }
925
- catch (err) {
926
- const transformedError = sdkTransformError(err, {
927
- spreadPathsToArguments: {},
928
- explicitPathsToArguments: {
929
- automationId: '$[0]',
930
- validationSettings: '$[1].validationSettings',
931
- },
932
- singleArgumentUnchanged: false,
933
- }, ['automationId', 'options']);
934
- sideEffects?.onError?.(err);
935
- throw transformedError;
936
- }
937
- }
938
- /**
939
- * Gets the specified automation revision.
940
- * @param automationId - Automation ID.
941
- * @public
942
- * @documentationMaturity preview
943
- * @requiredField automationId
944
- * @permissionId AUTOMATIONS.AUTOMATION_REVISION_READ
945
- * @permissionScope Manage Stores
946
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
947
- * @permissionScope Set Up Automations
948
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
949
- * @applicableIdentity APP
950
- * @fqn wix.automations.v2.AutomationRevisionsService.GetAutomationRevision
951
- */
952
- export async function getAutomationRevision(automationId, options) {
953
- // @ts-ignore
954
- const { httpClient, sideEffects } = arguments[2];
955
- const payload = renameKeysFromSDKRequestToRESTRequest({
956
- automationId: automationId,
957
- revision: options?.revision,
958
- fields: options?.fields,
959
- });
960
- const reqOpts = ambassadorWixAutomationsV2Automation.getAutomationRevision(payload);
961
- sideEffects?.onSiteCall?.();
962
- try {
963
- const result = await httpClient.request(reqOpts);
964
- sideEffects?.onSuccess?.(result);
965
- return renameKeysFromRESTResponseToSDKResponse(result.data);
966
- }
967
- catch (err) {
968
- const transformedError = sdkTransformError(err, {
969
- spreadPathsToArguments: {},
970
- explicitPathsToArguments: {
971
- automationId: '$[0]',
972
- revision: '$[1].revision',
973
- fields: '$[1].fields',
974
- },
975
- singleArgumentUnchanged: false,
976
- }, ['automationId', 'options']);
977
- sideEffects?.onError?.(err);
978
- throw transformedError;
979
- }
980
- }
981
- //# sourceMappingURL=automations-v2-automation-automations-v-2.universal.js.map