@wix/auto_sdk_ecom_delivery-profile 1.0.0

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 (111) hide show
  1. package/build/cjs/index.d.ts +1 -0
  2. package/build/cjs/index.js +18 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +1 -0
  8. package/build/cjs/meta.js +18 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.context.d.ts +21 -0
  11. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.context.js +32 -0
  12. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.context.js.map +1 -0
  13. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.http.d.ts +78 -0
  14. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.http.js +590 -0
  15. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.http.js.map +1 -0
  16. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.meta.d.ts +47 -0
  17. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.meta.js +363 -0
  18. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.meta.js.map +1 -0
  19. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.public.d.ts +167 -0
  20. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.public.js +117 -0
  21. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.public.js.map +1 -0
  22. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.types.d.ts +1053 -0
  23. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.types.js +135 -0
  24. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.types.js.map +1 -0
  25. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.universal.d.ts +1569 -0
  26. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.universal.js +935 -0
  27. package/build/cjs/src/ecom-v1-delivery-profile-delivery-profile.universal.js.map +1 -0
  28. package/build/es/index.d.ts +1 -0
  29. package/build/es/index.js +2 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/index.typings.d.ts +1 -0
  32. package/build/es/index.typings.js +2 -0
  33. package/build/es/index.typings.js.map +1 -0
  34. package/build/es/meta.d.ts +1 -0
  35. package/build/es/meta.js +2 -0
  36. package/build/es/meta.js.map +1 -0
  37. package/build/es/package.json +3 -0
  38. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.context.d.ts +21 -0
  39. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.context.js +21 -0
  40. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.context.js.map +1 -0
  41. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.http.d.ts +78 -0
  42. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.http.js +570 -0
  43. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.http.js.map +1 -0
  44. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.meta.d.ts +47 -0
  45. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.meta.js +320 -0
  46. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.meta.js.map +1 -0
  47. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.public.d.ts +167 -0
  48. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.public.js +89 -0
  49. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.public.js.map +1 -0
  50. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.types.d.ts +1053 -0
  51. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.types.js +132 -0
  52. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.types.js.map +1 -0
  53. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.universal.d.ts +1569 -0
  54. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.universal.js +892 -0
  55. package/build/es/src/ecom-v1-delivery-profile-delivery-profile.universal.js.map +1 -0
  56. package/build/internal/cjs/index.d.ts +1 -0
  57. package/build/internal/cjs/index.js +18 -0
  58. package/build/internal/cjs/index.js.map +1 -0
  59. package/build/internal/cjs/index.typings.d.ts +1 -0
  60. package/build/internal/cjs/index.typings.js +18 -0
  61. package/build/internal/cjs/index.typings.js.map +1 -0
  62. package/build/internal/cjs/meta.d.ts +1 -0
  63. package/build/internal/cjs/meta.js +18 -0
  64. package/build/internal/cjs/meta.js.map +1 -0
  65. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.context.d.ts +21 -0
  66. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.context.js +32 -0
  67. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.context.js.map +1 -0
  68. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.http.d.ts +78 -0
  69. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.http.js +590 -0
  70. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.http.js.map +1 -0
  71. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.meta.d.ts +47 -0
  72. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.meta.js +363 -0
  73. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.meta.js.map +1 -0
  74. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.public.d.ts +167 -0
  75. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.public.js +117 -0
  76. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.public.js.map +1 -0
  77. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.types.d.ts +1053 -0
  78. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.types.js +135 -0
  79. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.types.js.map +1 -0
  80. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.universal.d.ts +1569 -0
  81. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.universal.js +935 -0
  82. package/build/internal/cjs/src/ecom-v1-delivery-profile-delivery-profile.universal.js.map +1 -0
  83. package/build/internal/es/index.d.ts +1 -0
  84. package/build/internal/es/index.js +2 -0
  85. package/build/internal/es/index.js.map +1 -0
  86. package/build/internal/es/index.typings.d.ts +1 -0
  87. package/build/internal/es/index.typings.js +2 -0
  88. package/build/internal/es/index.typings.js.map +1 -0
  89. package/build/internal/es/meta.d.ts +1 -0
  90. package/build/internal/es/meta.js +2 -0
  91. package/build/internal/es/meta.js.map +1 -0
  92. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.context.d.ts +21 -0
  93. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.context.js +21 -0
  94. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.context.js.map +1 -0
  95. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.http.d.ts +78 -0
  96. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.http.js +570 -0
  97. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.http.js.map +1 -0
  98. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.meta.d.ts +47 -0
  99. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.meta.js +320 -0
  100. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.meta.js.map +1 -0
  101. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.public.d.ts +167 -0
  102. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.public.js +89 -0
  103. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.public.js.map +1 -0
  104. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.types.d.ts +1053 -0
  105. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.types.js +132 -0
  106. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.types.js.map +1 -0
  107. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.universal.d.ts +1569 -0
  108. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.universal.js +892 -0
  109. package/build/internal/es/src/ecom-v1-delivery-profile-delivery-profile.universal.js.map +1 -0
  110. package/meta/package.json +3 -0
  111. package/package.json +52 -0
@@ -0,0 +1,892 @@
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 ambassadorWixEcomV1DeliveryProfile from './ecom-v1-delivery-profile-delivery-profile.http.js';
5
+ export var ChargeType;
6
+ (function (ChargeType) {
7
+ ChargeType["HANDLING_FEE"] = "HANDLING_FEE";
8
+ })(ChargeType || (ChargeType = {}));
9
+ export var SortOrder;
10
+ (function (SortOrder) {
11
+ SortOrder["ASC"] = "ASC";
12
+ SortOrder["DESC"] = "DESC";
13
+ })(SortOrder || (SortOrder = {}));
14
+ export var DestinationScope;
15
+ (function (DestinationScope) {
16
+ /** No additional destinations are requested */
17
+ DestinationScope["SPECIFIC_DESTINATIONS"] = "SPECIFIC_DESTINATIONS";
18
+ /** All Destinations */
19
+ DestinationScope["WORLDWIDE"] = "WORLDWIDE";
20
+ })(DestinationScope || (DestinationScope = {}));
21
+ export var State;
22
+ (function (State) {
23
+ State["UNKNOWN"] = "UNKNOWN";
24
+ State["ENABLED"] = "ENABLED";
25
+ State["DISABLED"] = "DISABLED";
26
+ State["PENDING"] = "PENDING";
27
+ State["DEMO"] = "DEMO";
28
+ })(State || (State = {}));
29
+ export var SiteCreatedContext;
30
+ (function (SiteCreatedContext) {
31
+ /** A valid option, we don't expose all reasons why site might be created. */
32
+ SiteCreatedContext["OTHER"] = "OTHER";
33
+ /** A meta site was created from template. */
34
+ SiteCreatedContext["FROM_TEMPLATE"] = "FROM_TEMPLATE";
35
+ /** A meta site was created by copying of the transfferred meta site. */
36
+ SiteCreatedContext["DUPLICATE_BY_SITE_TRANSFER"] = "DUPLICATE_BY_SITE_TRANSFER";
37
+ /** A copy of existing meta site. */
38
+ SiteCreatedContext["DUPLICATE"] = "DUPLICATE";
39
+ /** A meta site was created as a transfferred site (copy of the original), old flow, should die soon. */
40
+ SiteCreatedContext["OLD_SITE_TRANSFER"] = "OLD_SITE_TRANSFER";
41
+ /** deprecated A meta site was created for Flash editor. */
42
+ SiteCreatedContext["FLASH"] = "FLASH";
43
+ })(SiteCreatedContext || (SiteCreatedContext = {}));
44
+ export var Namespace;
45
+ (function (Namespace) {
46
+ Namespace["UNKNOWN_NAMESPACE"] = "UNKNOWN_NAMESPACE";
47
+ /** Default namespace for UGC sites. MetaSites with this namespace will be shown in a user's site list by default. */
48
+ Namespace["WIX"] = "WIX";
49
+ /** 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. */
50
+ Namespace["SHOUT_OUT"] = "SHOUT_OUT";
51
+ /** 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. */
52
+ Namespace["ALBUMS"] = "ALBUMS";
53
+ /** 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. */
54
+ Namespace["WIX_STORES_TEST_DRIVE"] = "WIX_STORES_TEST_DRIVE";
55
+ /** Hotels standalone (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default. */
56
+ Namespace["HOTELS"] = "HOTELS";
57
+ /** 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. */
58
+ Namespace["CLUBS"] = "CLUBS";
59
+ /** A partially created ADI website. MetaSites with this namespace will *not* be shown in a user's site list by default. */
60
+ Namespace["ONBOARDING_DRAFT"] = "ONBOARDING_DRAFT";
61
+ /** AppBuilder for AppStudio / shmite (c). MetaSites with this namespace will *not* be shown in a user's site list by default. */
62
+ Namespace["DEV_SITE"] = "DEV_SITE";
63
+ /** 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. */
64
+ Namespace["LOGOS"] = "LOGOS";
65
+ /** 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. */
66
+ Namespace["VIDEO_MAKER"] = "VIDEO_MAKER";
67
+ /** MetaSites with this namespace will *not* be shown in a user's site list by default. */
68
+ Namespace["PARTNER_DASHBOARD"] = "PARTNER_DASHBOARD";
69
+ /** MetaSites with this namespace will *not* be shown in a user's site list by default. */
70
+ Namespace["DEV_CENTER_COMPANY"] = "DEV_CENTER_COMPANY";
71
+ /**
72
+ * A draft created by HTML editor on open. Upon "first save" it will be moved to be of WIX domain.
73
+ *
74
+ * Meta site with this namespace will *not* be shown in a user's site list by default.
75
+ */
76
+ Namespace["HTML_DRAFT"] = "HTML_DRAFT";
77
+ /**
78
+ * the user-journey for Fitness users who want to start from managing their business instead of designing their website.
79
+ * Will be accessible from Site List and will not have a website app.
80
+ * Once the user attaches a site, the site will become a regular wixsite.
81
+ */
82
+ Namespace["SITELESS_BUSINESS"] = "SITELESS_BUSINESS";
83
+ /** Belongs to "strategic products" company. Supports new product in the creator's economy space. */
84
+ Namespace["CREATOR_ECONOMY"] = "CREATOR_ECONOMY";
85
+ /** It is to be used in the Business First efforts. */
86
+ Namespace["DASHBOARD_FIRST"] = "DASHBOARD_FIRST";
87
+ /** Bookings business flow with no site. */
88
+ Namespace["ANYWHERE"] = "ANYWHERE";
89
+ /** Namespace for Headless Backoffice with no editor */
90
+ Namespace["HEADLESS"] = "HEADLESS";
91
+ /**
92
+ * Namespace for master site that will exist in parent account that will be referenced by subaccounts
93
+ * The site will be used for account level CSM feature for enterprise
94
+ */
95
+ Namespace["ACCOUNT_MASTER_CMS"] = "ACCOUNT_MASTER_CMS";
96
+ /** Rise.ai Siteless account management for Gift Cards and Store Credit. */
97
+ Namespace["RISE"] = "RISE";
98
+ /**
99
+ * As part of the branded app new funnel, users now can create a meta site that will be branded app first.
100
+ * There's a blank site behind the scene but it's blank).
101
+ * The Mobile company will be the owner of this namespace.
102
+ */
103
+ Namespace["BRANDED_FIRST"] = "BRANDED_FIRST";
104
+ /** Nownia.com Siteless account management for Ai Scheduling Assistant. */
105
+ Namespace["NOWNIA"] = "NOWNIA";
106
+ /**
107
+ * UGC Templates are templates that are created by users for personal use and to sale to other users.
108
+ * The Partners company owns this namespace.
109
+ */
110
+ Namespace["UGC_TEMPLATE"] = "UGC_TEMPLATE";
111
+ /** Codux Headless Sites */
112
+ Namespace["CODUX"] = "CODUX";
113
+ /** Bobb - AI Design Creator. */
114
+ Namespace["MEDIA_DESIGN_CREATOR"] = "MEDIA_DESIGN_CREATOR";
115
+ /**
116
+ * Shared Blog Site is a unique single site across Enterprise account,
117
+ * This site will hold all Blog posts related to the Marketing product.
118
+ */
119
+ Namespace["SHARED_BLOG_ENTERPRISE"] = "SHARED_BLOG_ENTERPRISE";
120
+ })(Namespace || (Namespace = {}));
121
+ export var DeleteStatus;
122
+ (function (DeleteStatus) {
123
+ DeleteStatus["UNKNOWN"] = "UNKNOWN";
124
+ DeleteStatus["TRASH"] = "TRASH";
125
+ DeleteStatus["DELETED"] = "DELETED";
126
+ DeleteStatus["PENDING_PURGE"] = "PENDING_PURGE";
127
+ })(DeleteStatus || (DeleteStatus = {}));
128
+ export var WebhookIdentityType;
129
+ (function (WebhookIdentityType) {
130
+ WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
131
+ WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
132
+ WebhookIdentityType["MEMBER"] = "MEMBER";
133
+ WebhookIdentityType["WIX_USER"] = "WIX_USER";
134
+ WebhookIdentityType["APP"] = "APP";
135
+ })(WebhookIdentityType || (WebhookIdentityType = {}));
136
+ /**
137
+ * Creates a DeliveryProfile.
138
+ *
139
+ * The request body must include the DeliveryProfiles name. DeliveryRegions are optional.
140
+ * @param deliveryProfile - DeliveryProfile to be created.
141
+ * @public
142
+ * @documentationMaturity preview
143
+ * @requiredField deliveryProfile
144
+ * @requiredField deliveryProfile.deliveryRegions.deliveryCarriers.backupRate.rate
145
+ * @requiredField deliveryProfile.deliveryRegions.destinations
146
+ * @requiredField deliveryProfile.deliveryRegions.destinations.countryCode
147
+ * @requiredField deliveryProfile.deliveryRegions.name
148
+ * @requiredField deliveryProfile.name
149
+ * @permissionId ECOM.DELIVERY_PROFILE_CREATE
150
+ * @permissionScope Manage Stores - all permissions
151
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
152
+ * @permissionScope Manage eCommerce - all permissions
153
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
154
+ * @applicableIdentity APP
155
+ * @returns The created DeliveryProfile.
156
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.CreateDeliveryProfile
157
+ */
158
+ export async function createDeliveryProfile(deliveryProfile) {
159
+ // @ts-ignore
160
+ const { httpClient, sideEffects } = arguments[1];
161
+ const payload = renameKeysFromSDKRequestToRESTRequest({
162
+ deliveryProfile: deliveryProfile,
163
+ });
164
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.createDeliveryProfile(payload);
165
+ sideEffects?.onSiteCall?.();
166
+ try {
167
+ const result = await httpClient.request(reqOpts);
168
+ sideEffects?.onSuccess?.(result);
169
+ return renameKeysFromRESTResponseToSDKResponse(result.data)
170
+ ?.deliveryProfile;
171
+ }
172
+ catch (err) {
173
+ const transformedError = sdkTransformError(err, {
174
+ spreadPathsToArguments: {},
175
+ explicitPathsToArguments: { deliveryProfile: '$[0]' },
176
+ singleArgumentUnchanged: false,
177
+ }, ['deliveryProfile']);
178
+ sideEffects?.onError?.(err);
179
+ throw transformedError;
180
+ }
181
+ }
182
+ /**
183
+ * Retrieves a DeliveryProfile.
184
+ * @param deliveryProfileId - ID of the DeliveryProfile to retrieve.
185
+ * @public
186
+ * @documentationMaturity preview
187
+ * @requiredField deliveryProfileId
188
+ * @permissionId ECOM.DELIVERY_PROFILE_READ
189
+ * @permissionScope Manage Stores - all permissions
190
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
191
+ * @permissionScope Read eCommerce - all read permissions
192
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
193
+ * @permissionScope Manage eCommerce - all permissions
194
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
195
+ * @applicableIdentity APP
196
+ * @applicableIdentity VISITOR
197
+ * @returns The requested DeliveryProfile.
198
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.GetDeliveryProfile
199
+ */
200
+ export async function getDeliveryProfile(deliveryProfileId) {
201
+ // @ts-ignore
202
+ const { httpClient, sideEffects } = arguments[1];
203
+ const payload = renameKeysFromSDKRequestToRESTRequest({
204
+ deliveryProfileId: deliveryProfileId,
205
+ });
206
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.getDeliveryProfile(payload);
207
+ sideEffects?.onSiteCall?.();
208
+ try {
209
+ const result = await httpClient.request(reqOpts);
210
+ sideEffects?.onSuccess?.(result);
211
+ return renameKeysFromRESTResponseToSDKResponse(result.data)
212
+ ?.deliveryProfile;
213
+ }
214
+ catch (err) {
215
+ const transformedError = sdkTransformError(err, {
216
+ spreadPathsToArguments: {},
217
+ explicitPathsToArguments: { deliveryProfileId: '$[0]' },
218
+ singleArgumentUnchanged: false,
219
+ }, ['deliveryProfileId']);
220
+ sideEffects?.onError?.(err);
221
+ throw transformedError;
222
+ }
223
+ }
224
+ /**
225
+ * Updates a DeliveryProfile.
226
+ *
227
+ *
228
+ * Each time the DeliveryProfile is updated,
229
+ * `revision` increments by 1.
230
+ * The current `revision` must be passed when updating the DeliveryProfile.
231
+ * This ensures you're working with the latest DeliveryProfile
232
+ * and prevents unintended overwrites.
233
+ *
234
+ * This method does not allow updating the DeliveryRegions in this DeliveryProfile.
235
+ * Use AddDeliveryRegion, UpdateDeliveryRegion and RemoveDeliveryRegion for these functionalities.
236
+ * @param _id - DeliveryProfile ID.
237
+ * @public
238
+ * @documentationMaturity preview
239
+ * @requiredField _id
240
+ * @requiredField deliveryProfile
241
+ * @requiredField deliveryProfile.revision
242
+ * @permissionId ECOM.DELIVERY_PROFILE_UPDATE
243
+ * @permissionScope Manage Stores - all permissions
244
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
245
+ * @permissionScope Manage eCommerce - all permissions
246
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
247
+ * @applicableIdentity APP
248
+ * @returns Updated DeliveryProfile.
249
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.UpdateDeliveryProfile
250
+ */
251
+ export async function updateDeliveryProfile(_id, deliveryProfile) {
252
+ // @ts-ignore
253
+ const { httpClient, sideEffects } = arguments[2];
254
+ const payload = renameKeysFromSDKRequestToRESTRequest({
255
+ deliveryProfile: { ...deliveryProfile, id: _id },
256
+ });
257
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.updateDeliveryProfile(payload);
258
+ sideEffects?.onSiteCall?.();
259
+ try {
260
+ const result = await httpClient.request(reqOpts);
261
+ sideEffects?.onSuccess?.(result);
262
+ return renameKeysFromRESTResponseToSDKResponse(result.data)
263
+ ?.deliveryProfile;
264
+ }
265
+ catch (err) {
266
+ const transformedError = sdkTransformError(err, {
267
+ spreadPathsToArguments: { deliveryProfile: '$[1]' },
268
+ explicitPathsToArguments: { 'deliveryProfile.id': '$[0]' },
269
+ singleArgumentUnchanged: false,
270
+ }, ['_id', 'deliveryProfile']);
271
+ sideEffects?.onError?.(err);
272
+ throw transformedError;
273
+ }
274
+ }
275
+ /**
276
+ * Deletes a DeliveryProfile.
277
+ *
278
+ * Deleting a DeliveryProfile permanently removes them from the DeliveryProfile List.
279
+ * @param deliveryProfileId - Id of the DeliveryProfile to delete.
280
+ * @public
281
+ * @documentationMaturity preview
282
+ * @requiredField deliveryProfileId
283
+ * @permissionId ECOM.DELIVERY_PROFILE_DELETE
284
+ * @permissionScope Manage Stores - all permissions
285
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
286
+ * @permissionScope Manage eCommerce - all permissions
287
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
288
+ * @applicableIdentity APP
289
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.DeleteDeliveryProfile
290
+ */
291
+ export async function deleteDeliveryProfile(deliveryProfileId) {
292
+ // @ts-ignore
293
+ const { httpClient, sideEffects } = arguments[1];
294
+ const payload = renameKeysFromSDKRequestToRESTRequest({
295
+ deliveryProfileId: deliveryProfileId,
296
+ });
297
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.deleteDeliveryProfile(payload);
298
+ sideEffects?.onSiteCall?.();
299
+ try {
300
+ const result = await httpClient.request(reqOpts);
301
+ sideEffects?.onSuccess?.(result);
302
+ }
303
+ catch (err) {
304
+ const transformedError = sdkTransformError(err, {
305
+ spreadPathsToArguments: {},
306
+ explicitPathsToArguments: { deliveryProfileId: '$[0]' },
307
+ singleArgumentUnchanged: false,
308
+ }, ['deliveryProfileId']);
309
+ sideEffects?.onError?.(err);
310
+ throw transformedError;
311
+ }
312
+ }
313
+ /**
314
+ * Retrieves a list of DeliveryProfiles, given the provided [paging, filtering, and sorting][1].
315
+ *
316
+ * Up to 1,000 DeliveryProfiles can be returned per request.
317
+ *
318
+ * To learn how to query DeliveryProfiles, see [API Query Language][2].
319
+ *
320
+ * [1]: https://dev.wix.com/api/rest/getting-started/sorting-and-paging
321
+ * [2]: https://dev.wix.com/api/rest/getting-started/api-query-language
322
+ * @public
323
+ * @documentationMaturity preview
324
+ * @permissionScope Manage Stores - all permissions
325
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
326
+ * @permissionScope Read eCommerce - all read permissions
327
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
328
+ * @permissionScope Manage eCommerce - all permissions
329
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
330
+ * @permissionId ECOM.DELIVERY_PROFILE_READ
331
+ * @applicableIdentity APP
332
+ * @applicableIdentity VISITOR
333
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.QueryDeliveryProfiles
334
+ */
335
+ export function queryDeliveryProfiles() {
336
+ // @ts-ignore
337
+ const { httpClient, sideEffects } = arguments[0];
338
+ return queryBuilder({
339
+ func: async (payload) => {
340
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.queryDeliveryProfiles(payload);
341
+ sideEffects?.onSiteCall?.();
342
+ try {
343
+ const result = await httpClient.request(reqOpts);
344
+ sideEffects?.onSuccess?.(result);
345
+ return result;
346
+ }
347
+ catch (err) {
348
+ sideEffects?.onError?.(err);
349
+ throw err;
350
+ }
351
+ },
352
+ requestTransformer: (query) => {
353
+ const args = [query, {}];
354
+ return renameKeysFromSDKRequestToRESTRequest({
355
+ ...args?.[1],
356
+ query: args?.[0],
357
+ });
358
+ },
359
+ responseTransformer: ({ data, }) => {
360
+ const transformedData = renameKeysFromRESTResponseToSDKResponse(data);
361
+ return {
362
+ items: transformedData?.deliveryProfiles,
363
+ pagingMetadata: transformedData?.pagingMetadata,
364
+ };
365
+ },
366
+ errorTransformer: (err) => {
367
+ const transformedError = sdkTransformError(err, {
368
+ spreadPathsToArguments: {},
369
+ explicitPathsToArguments: { query: '$[0]' },
370
+ singleArgumentUnchanged: false,
371
+ });
372
+ throw transformedError;
373
+ },
374
+ pagingMethod: 'CURSOR',
375
+ transformationPaths: {},
376
+ });
377
+ }
378
+ /**
379
+ * Creates a new DeliveryRegion in an existing DeliveryProfile.
380
+ * @param deliveryProfileId - delivery profile id to associated with the DeliveryRegion
381
+ * @param deliveryRegion - DeliveryRegion to be created
382
+ * @public
383
+ * @documentationMaturity preview
384
+ * @requiredField deliveryProfileId
385
+ * @requiredField deliveryRegion
386
+ * @requiredField deliveryRegion.deliveryCarriers.backupRate.rate
387
+ * @requiredField deliveryRegion.destinations.countryCode
388
+ * @requiredField deliveryRegion.name
389
+ * @permissionId ECOM.DELIVERY_PROFILE_UPDATE
390
+ * @permissionScope Manage Stores - all permissions
391
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
392
+ * @permissionScope Manage eCommerce - all permissions
393
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
394
+ * @applicableIdentity APP
395
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.AddDeliveryRegion
396
+ */
397
+ export async function addDeliveryRegion(deliveryProfileId, deliveryRegion, options) {
398
+ // @ts-ignore
399
+ const { httpClient, sideEffects } = arguments[3];
400
+ const payload = renameKeysFromSDKRequestToRESTRequest({
401
+ deliveryProfileId: deliveryProfileId,
402
+ deliveryRegion: deliveryRegion,
403
+ revision: options?.revision,
404
+ });
405
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.addDeliveryRegion(payload);
406
+ sideEffects?.onSiteCall?.();
407
+ try {
408
+ const result = await httpClient.request(reqOpts);
409
+ sideEffects?.onSuccess?.(result);
410
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
411
+ }
412
+ catch (err) {
413
+ const transformedError = sdkTransformError(err, {
414
+ spreadPathsToArguments: {},
415
+ explicitPathsToArguments: {
416
+ deliveryProfileId: '$[0]',
417
+ deliveryRegion: '$[1]',
418
+ revision: '$[2].revision',
419
+ },
420
+ singleArgumentUnchanged: false,
421
+ }, ['deliveryProfileId', 'deliveryRegion', 'options']);
422
+ sideEffects?.onError?.(err);
423
+ throw transformedError;
424
+ }
425
+ }
426
+ /**
427
+ * Update a DeliveryRegion, supports partial update
428
+ * Pass the latest `revision` for a successful update
429
+ *
430
+ * This method does not allow setting or updating the delivery delivery_carriers in this delivery_region.
431
+ * Use AddDeliveryCarrier, UpdateDeliveryCarrier and RemoveDeliveryCarrier for these functionalities.
432
+ * @public
433
+ * @documentationMaturity preview
434
+ * @requiredField deliveryRegion
435
+ * @requiredField identifiers
436
+ * @requiredField identifiers.deliveryProfileId
437
+ * @requiredField identifiers.deliveryRegionId
438
+ * @permissionId ECOM.DELIVERY_REGION_UPDATE
439
+ * @permissionScope Manage Stores - all permissions
440
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
441
+ * @permissionScope Manage eCommerce - all permissions
442
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
443
+ * @applicableIdentity APP
444
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.UpdateDeliveryRegion
445
+ */
446
+ export async function updateDeliveryRegion(identifiers, deliveryRegion, options) {
447
+ // @ts-ignore
448
+ const { httpClient, sideEffects } = arguments[3];
449
+ const payload = renameKeysFromSDKRequestToRESTRequest({
450
+ deliveryProfileId: identifiers?.deliveryProfileId,
451
+ deliveryRegion: { ...deliveryRegion, id: identifiers?.deliveryRegionId },
452
+ revision: options?.revision,
453
+ });
454
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.updateDeliveryRegion(payload);
455
+ sideEffects?.onSiteCall?.();
456
+ try {
457
+ const result = await httpClient.request(reqOpts);
458
+ sideEffects?.onSuccess?.(result);
459
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
460
+ }
461
+ catch (err) {
462
+ const transformedError = sdkTransformError(err, {
463
+ spreadPathsToArguments: { deliveryRegion: '$[1]' },
464
+ explicitPathsToArguments: {
465
+ deliveryProfileId: '$[0].deliveryProfileId',
466
+ 'deliveryRegion.id': '$[0].deliveryRegionId',
467
+ revision: '$[2].revision',
468
+ },
469
+ singleArgumentUnchanged: false,
470
+ }, ['identifiers', 'deliveryRegion', 'options']);
471
+ sideEffects?.onError?.(err);
472
+ throw transformedError;
473
+ }
474
+ }
475
+ /**
476
+ * Delete a DeliveryRegion
477
+ * @public
478
+ * @documentationMaturity preview
479
+ * @requiredField identifiers
480
+ * @requiredField identifiers.deliveryProfileId
481
+ * @requiredField identifiers.deliveryRegionId
482
+ * @permissionId ECOM.DELIVERY_PROFILE_UPDATE
483
+ * @permissionScope Manage Stores - all permissions
484
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
485
+ * @permissionScope Manage eCommerce - all permissions
486
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
487
+ * @applicableIdentity APP
488
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.RemoveDeliveryRegion
489
+ */
490
+ export async function removeDeliveryRegion(identifiers, options) {
491
+ // @ts-ignore
492
+ const { httpClient, sideEffects } = arguments[2];
493
+ const payload = renameKeysFromSDKRequestToRESTRequest({
494
+ deliveryProfileId: identifiers?.deliveryProfileId,
495
+ deliveryRegionId: identifiers?.deliveryRegionId,
496
+ revision: options?.revision,
497
+ });
498
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.removeDeliveryRegion(payload);
499
+ sideEffects?.onSiteCall?.();
500
+ try {
501
+ const result = await httpClient.request(reqOpts);
502
+ sideEffects?.onSuccess?.(result);
503
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
504
+ }
505
+ catch (err) {
506
+ const transformedError = sdkTransformError(err, {
507
+ spreadPathsToArguments: {},
508
+ explicitPathsToArguments: {
509
+ deliveryProfileId: '$[0].deliveryProfileId',
510
+ deliveryRegionId: '$[0].deliveryRegionId',
511
+ revision: '$[1].revision',
512
+ },
513
+ singleArgumentUnchanged: false,
514
+ }, ['identifiers', 'options']);
515
+ sideEffects?.onError?.(err);
516
+ throw transformedError;
517
+ }
518
+ }
519
+ /**
520
+ * Add a delivery_carrier to a delivery region
521
+ * @param deliveryRegionId - delivery_region id to associated with the delivery_carrier.
522
+ * @public
523
+ * @documentationMaturity preview
524
+ * @requiredField deliveryRegionId
525
+ * @requiredField options
526
+ * @requiredField options.deliveryCarrier
527
+ * @requiredField options.deliveryCarrier.backupRate.rate
528
+ * @permissionId ECOM.DELIVERY_CARRIER_ADD
529
+ * @permissionScope Manage Stores - all permissions
530
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
531
+ * @permissionScope Manage eCommerce - all permissions
532
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
533
+ * @applicableIdentity APP
534
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.AddDeliveryCarrier
535
+ */
536
+ export async function addDeliveryCarrier(deliveryRegionId, options) {
537
+ // @ts-ignore
538
+ const { httpClient, sideEffects } = arguments[2];
539
+ const payload = renameKeysFromSDKRequestToRESTRequest({
540
+ deliveryRegionId: deliveryRegionId,
541
+ deliveryCarrier: options?.deliveryCarrier,
542
+ });
543
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.addDeliveryCarrier(payload);
544
+ sideEffects?.onSiteCall?.();
545
+ try {
546
+ const result = await httpClient.request(reqOpts);
547
+ sideEffects?.onSuccess?.(result);
548
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
549
+ }
550
+ catch (err) {
551
+ const transformedError = sdkTransformError(err, {
552
+ spreadPathsToArguments: {},
553
+ explicitPathsToArguments: {
554
+ deliveryRegionId: '$[0]',
555
+ deliveryCarrier: '$[1].deliveryCarrier',
556
+ },
557
+ singleArgumentUnchanged: false,
558
+ }, ['deliveryRegionId', 'options']);
559
+ sideEffects?.onError?.(err);
560
+ throw transformedError;
561
+ }
562
+ }
563
+ /**
564
+ * Remove a delivery_carrier from a delivery region
565
+ * @param deliveryRegionId - Id of the DeliveryRegion
566
+ * @public
567
+ * @documentationMaturity preview
568
+ * @requiredField deliveryRegionId
569
+ * @requiredField options
570
+ * @requiredField options.appId
571
+ * @permissionId ECOM.DELIVERY_CARRIER_REMOVE
572
+ * @permissionScope Manage Stores - all permissions
573
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
574
+ * @permissionScope Manage eCommerce - all permissions
575
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
576
+ * @applicableIdentity APP
577
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.RemoveDeliveryCarrier
578
+ */
579
+ export async function removeDeliveryCarrier(deliveryRegionId, options) {
580
+ // @ts-ignore
581
+ const { httpClient, sideEffects } = arguments[2];
582
+ const payload = renameKeysFromSDKRequestToRESTRequest({
583
+ deliveryRegionId: deliveryRegionId,
584
+ appId: options?.appId,
585
+ });
586
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.removeDeliveryCarrier(payload);
587
+ sideEffects?.onSiteCall?.();
588
+ try {
589
+ const result = await httpClient.request(reqOpts);
590
+ sideEffects?.onSuccess?.(result);
591
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
592
+ }
593
+ catch (err) {
594
+ const transformedError = sdkTransformError(err, {
595
+ spreadPathsToArguments: {},
596
+ explicitPathsToArguments: {
597
+ deliveryRegionId: '$[0]',
598
+ appId: '$[1].appId',
599
+ },
600
+ singleArgumentUnchanged: false,
601
+ }, ['deliveryRegionId', 'options']);
602
+ sideEffects?.onError?.(err);
603
+ throw transformedError;
604
+ }
605
+ }
606
+ /**
607
+ * Update a delivery carrier in a delivery region
608
+ * @param deliveryRegionId - DeliveryRegion id
609
+ * @public
610
+ * @documentationMaturity preview
611
+ * @requiredField deliveryRegionId
612
+ * @requiredField options.deliveryCarrier.appId
613
+ * @permissionId ECOM.DELIVERY_CARRIER_UPDATE
614
+ * @permissionScope Manage Stores - all permissions
615
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
616
+ * @permissionScope Manage eCommerce - all permissions
617
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
618
+ * @applicableIdentity APP
619
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.UpdateDeliveryCarrier
620
+ */
621
+ export async function updateDeliveryCarrier(deliveryRegionId, options) {
622
+ // @ts-ignore
623
+ const { httpClient, sideEffects } = arguments[2];
624
+ const payload = renameKeysFromSDKRequestToRESTRequest({
625
+ deliveryRegionId: deliveryRegionId,
626
+ deliveryCarrier: options?.deliveryCarrier,
627
+ });
628
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.updateDeliveryCarrier(payload);
629
+ sideEffects?.onSiteCall?.();
630
+ try {
631
+ const result = await httpClient.request(reqOpts);
632
+ sideEffects?.onSuccess?.(result);
633
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
634
+ }
635
+ catch (err) {
636
+ const transformedError = sdkTransformError(err, {
637
+ spreadPathsToArguments: {},
638
+ explicitPathsToArguments: {
639
+ deliveryRegionId: '$[0]',
640
+ deliveryCarrier: '$[1].deliveryCarrier',
641
+ },
642
+ singleArgumentUnchanged: false,
643
+ }, ['deliveryRegionId', 'options']);
644
+ sideEffects?.onError?.(err);
645
+ throw transformedError;
646
+ }
647
+ }
648
+ /**
649
+ * List all installed delivery carriers in order to set their ids in delivery rules
650
+ * @public
651
+ * @documentationMaturity preview
652
+ * @permissionId ECOM.DELIVERY_CARRIER_DETAILS_READ
653
+ * @permissionScope Manage Stores - all permissions
654
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
655
+ * @permissionScope Read eCommerce - all read permissions
656
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
657
+ * @permissionScope Manage eCommerce - all permissions
658
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
659
+ * @applicableIdentity APP
660
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.ListDeliveryCarrierDetails
661
+ * @deprecated
662
+ * @replacedBy ListInstalledDeliveryCarriers
663
+ * @targetRemovalDate 2025-04-01
664
+ */
665
+ export async function listDeliveryCarrierDetails() {
666
+ // @ts-ignore
667
+ const { httpClient, sideEffects } = arguments[0];
668
+ const payload = renameKeysFromSDKRequestToRESTRequest({});
669
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.listDeliveryCarrierDetails(payload);
670
+ sideEffects?.onSiteCall?.();
671
+ try {
672
+ const result = await httpClient.request(reqOpts);
673
+ sideEffects?.onSuccess?.(result);
674
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
675
+ }
676
+ catch (err) {
677
+ const transformedError = sdkTransformError(err, {
678
+ spreadPathsToArguments: {},
679
+ explicitPathsToArguments: {},
680
+ singleArgumentUnchanged: false,
681
+ }, []);
682
+ sideEffects?.onError?.(err);
683
+ throw transformedError;
684
+ }
685
+ }
686
+ /** @public
687
+ * @documentationMaturity preview
688
+ * @permissionId ECOM.DELIVERY_CARRIER_READ
689
+ * @permissionScope Manage Stores - all permissions
690
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
691
+ * @permissionScope Read eCommerce - all read permissions
692
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
693
+ * @permissionScope Manage eCommerce - all permissions
694
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
695
+ * @applicableIdentity APP
696
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.ListInstalledDeliveryCarriers
697
+ */
698
+ export async function listInstalledDeliveryCarriers() {
699
+ // @ts-ignore
700
+ const { httpClient, sideEffects } = arguments[0];
701
+ const payload = renameKeysFromSDKRequestToRESTRequest({});
702
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.listInstalledDeliveryCarriers(payload);
703
+ sideEffects?.onSiteCall?.();
704
+ try {
705
+ const result = await httpClient.request(reqOpts);
706
+ sideEffects?.onSuccess?.(result);
707
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
708
+ }
709
+ catch (err) {
710
+ const transformedError = sdkTransformError(err, {
711
+ spreadPathsToArguments: {},
712
+ explicitPathsToArguments: {},
713
+ singleArgumentUnchanged: false,
714
+ }, []);
715
+ sideEffects?.onError?.(err);
716
+ throw transformedError;
717
+ }
718
+ }
719
+ /**
720
+ * Retrieves a list of all delivery destinations configured on a site.
721
+ * Sorted by `countryCode` in ascending order.
722
+ * @public
723
+ * @documentationMaturity preview
724
+ * @permissionId ECOM.DELIVERY_PROFILE_READ
725
+ * @permissionScope Manage Stores - all permissions
726
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
727
+ * @permissionScope Read eCommerce - all read permissions
728
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
729
+ * @permissionScope Manage eCommerce - all permissions
730
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
731
+ * @applicableIdentity APP
732
+ * @applicableIdentity VISITOR
733
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.ListDeliveryDestinations
734
+ */
735
+ export async function listDeliveryDestinations() {
736
+ // @ts-ignore
737
+ const { httpClient, sideEffects } = arguments[0];
738
+ const payload = renameKeysFromSDKRequestToRESTRequest({});
739
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.listDeliveryDestinations(payload);
740
+ sideEffects?.onSiteCall?.();
741
+ try {
742
+ const result = await httpClient.request(reqOpts);
743
+ sideEffects?.onSuccess?.(result);
744
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
745
+ }
746
+ catch (err) {
747
+ const transformedError = sdkTransformError(err, {
748
+ spreadPathsToArguments: {},
749
+ explicitPathsToArguments: {},
750
+ singleArgumentUnchanged: false,
751
+ }, []);
752
+ sideEffects?.onError?.(err);
753
+ throw transformedError;
754
+ }
755
+ }
756
+ /**
757
+ * Get delivery carrier settings for a delivery profile and delivery region.
758
+ * These are returned in a table format for the dashboard.
759
+ * @param deliveryProfileId - Delivery profile id.
760
+ * @public
761
+ * @documentationMaturity preview
762
+ * @requiredField deliveryProfileId
763
+ * @permissionId ECOM.DELIVERY_CARRIER_READ
764
+ * @permissionScope Manage Stores - all permissions
765
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
766
+ * @permissionScope Read eCommerce - all read permissions
767
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
768
+ * @permissionScope Manage eCommerce - all permissions
769
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
770
+ * @applicableIdentity APP
771
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.ListDeliveryCarriers
772
+ */
773
+ export async function listDeliveryCarriers(deliveryProfileId, options) {
774
+ // @ts-ignore
775
+ const { httpClient, sideEffects } = arguments[2];
776
+ const payload = renameKeysFromSDKRequestToRESTRequest({
777
+ deliveryProfileId: deliveryProfileId,
778
+ appIds: options?.appIds,
779
+ });
780
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.listDeliveryCarriers(payload);
781
+ sideEffects?.onSiteCall?.();
782
+ try {
783
+ const result = await httpClient.request(reqOpts);
784
+ sideEffects?.onSuccess?.(result);
785
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
786
+ }
787
+ catch (err) {
788
+ const transformedError = sdkTransformError(err, {
789
+ spreadPathsToArguments: {},
790
+ explicitPathsToArguments: {
791
+ deliveryProfileId: '$[0]',
792
+ appIds: '$[1].appIds',
793
+ },
794
+ singleArgumentUnchanged: false,
795
+ }, ['deliveryProfileId', 'options']);
796
+ sideEffects?.onError?.(err);
797
+ throw transformedError;
798
+ }
799
+ }
800
+ /**
801
+ * Update carrier's external active settings
802
+ * @param carrierId - Carrier id.
803
+ * @public
804
+ * @documentationMaturity preview
805
+ * @requiredField carrierId
806
+ * @requiredField options
807
+ * @requiredField options.active
808
+ * @requiredField options.rowId
809
+ * @permissionId ECOM.DELIVERY_CARRIER_UPDATE
810
+ * @permissionScope Manage Stores - all permissions
811
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
812
+ * @permissionScope Manage eCommerce - all permissions
813
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
814
+ * @applicableIdentity APP
815
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.UpdateCarrierSettings
816
+ */
817
+ export async function updateCarrierSettings(carrierId, options) {
818
+ // @ts-ignore
819
+ const { httpClient, sideEffects } = arguments[2];
820
+ const payload = renameKeysFromSDKRequestToRESTRequest({
821
+ carrierId: carrierId,
822
+ rowId: options?.rowId,
823
+ active: options?.active,
824
+ });
825
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.updateCarrierSettings(payload);
826
+ sideEffects?.onSiteCall?.();
827
+ try {
828
+ const result = await httpClient.request(reqOpts);
829
+ sideEffects?.onSuccess?.(result);
830
+ }
831
+ catch (err) {
832
+ const transformedError = sdkTransformError(err, {
833
+ spreadPathsToArguments: {},
834
+ explicitPathsToArguments: {
835
+ carrierId: '$[0]',
836
+ rowId: '$[1].rowId',
837
+ active: '$[1].active',
838
+ },
839
+ singleArgumentUnchanged: false,
840
+ }, ['carrierId', 'options']);
841
+ sideEffects?.onError?.(err);
842
+ throw transformedError;
843
+ }
844
+ }
845
+ /**
846
+ * Updates extended fields of a DeliveryProfile without incrementing revision
847
+ * @param _id - ID of the entity to update.
848
+ * @param namespace - Identifier for the app whose extended fields are being updated.
849
+ * @public
850
+ * @documentationMaturity preview
851
+ * @requiredField _id
852
+ * @requiredField namespace
853
+ * @requiredField options
854
+ * @requiredField options.namespaceData
855
+ * @permissionId ECOM.DELIVERY_PROFILE_UPDATE
856
+ * @permissionScope Manage Stores - all permissions
857
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
858
+ * @permissionScope Manage eCommerce - all permissions
859
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
860
+ * @applicableIdentity APP
861
+ * @fqn wix.ecom.deliveryprofile.v1.DeliveryProfiles.UpdateExtendedFields
862
+ */
863
+ export async function updateExtendedFields(_id, namespace, options) {
864
+ // @ts-ignore
865
+ const { httpClient, sideEffects } = arguments[3];
866
+ const payload = renameKeysFromSDKRequestToRESTRequest({
867
+ id: _id,
868
+ namespace: namespace,
869
+ namespaceData: options?.namespaceData,
870
+ });
871
+ const reqOpts = ambassadorWixEcomV1DeliveryProfile.updateExtendedFields(payload);
872
+ sideEffects?.onSiteCall?.();
873
+ try {
874
+ const result = await httpClient.request(reqOpts);
875
+ sideEffects?.onSuccess?.(result);
876
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
877
+ }
878
+ catch (err) {
879
+ const transformedError = sdkTransformError(err, {
880
+ spreadPathsToArguments: {},
881
+ explicitPathsToArguments: {
882
+ id: '$[0]',
883
+ namespace: '$[1]',
884
+ namespaceData: '$[2].namespaceData',
885
+ },
886
+ singleArgumentUnchanged: false,
887
+ }, ['_id', 'namespace', 'options']);
888
+ sideEffects?.onError?.(err);
889
+ throw transformedError;
890
+ }
891
+ }
892
+ //# sourceMappingURL=ecom-v1-delivery-profile-delivery-profile.universal.js.map