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