@wix/auto_sdk_ecom_checkout 1.0.36 → 1.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/build/{es/src/ecom-v1-checkout-checkout.types.d.ts → ecom-v1-checkout-checkout.universal-DEDRvPML.d.mts} +674 -365
  2. package/build/{cjs/src/ecom-v1-checkout-checkout.types.d.ts → ecom-v1-checkout-checkout.universal-DEDRvPML.d.ts} +674 -365
  3. package/build/index.d.mts +210 -0
  4. package/build/index.d.ts +210 -0
  5. package/build/index.js +2782 -0
  6. package/build/index.js.map +1 -0
  7. package/build/index.mjs +2708 -0
  8. package/build/index.mjs.map +1 -0
  9. package/build/internal/{cjs/src/ecom-v1-checkout-checkout.types.d.ts → ecom-v1-checkout-checkout.universal-CirtPjnM.d.mts} +803 -364
  10. package/build/internal/{es/src/ecom-v1-checkout-checkout.types.d.ts → ecom-v1-checkout-checkout.universal-CirtPjnM.d.ts} +803 -364
  11. package/build/internal/index.d.mts +240 -0
  12. package/build/internal/index.d.ts +240 -0
  13. package/build/internal/index.js +2782 -0
  14. package/build/internal/index.js.map +1 -0
  15. package/build/internal/index.mjs +2708 -0
  16. package/build/internal/index.mjs.map +1 -0
  17. package/build/internal/meta.d.mts +2606 -0
  18. package/build/internal/meta.d.ts +2606 -0
  19. package/build/internal/meta.js +1587 -0
  20. package/build/internal/meta.js.map +1 -0
  21. package/build/internal/meta.mjs +1544 -0
  22. package/build/internal/meta.mjs.map +1 -0
  23. package/build/meta.d.mts +2606 -0
  24. package/build/meta.d.ts +2606 -0
  25. package/build/meta.js +1587 -0
  26. package/build/meta.js.map +1 -0
  27. package/build/meta.mjs +1544 -0
  28. package/build/meta.mjs.map +1 -0
  29. package/package.json +12 -11
  30. package/build/cjs/index.d.ts +0 -1
  31. package/build/cjs/index.js +0 -18
  32. package/build/cjs/index.js.map +0 -1
  33. package/build/cjs/index.typings.d.ts +0 -1
  34. package/build/cjs/index.typings.js +0 -18
  35. package/build/cjs/index.typings.js.map +0 -1
  36. package/build/cjs/meta.d.ts +0 -1
  37. package/build/cjs/meta.js +0 -18
  38. package/build/cjs/meta.js.map +0 -1
  39. package/build/cjs/src/ecom-v1-checkout-checkout.context.d.ts +0 -35
  40. package/build/cjs/src/ecom-v1-checkout-checkout.context.js +0 -76
  41. package/build/cjs/src/ecom-v1-checkout-checkout.context.js.map +0 -1
  42. package/build/cjs/src/ecom-v1-checkout-checkout.http.d.ts +0 -101
  43. package/build/cjs/src/ecom-v1-checkout-checkout.http.js +0 -1317
  44. package/build/cjs/src/ecom-v1-checkout-checkout.http.js.map +0 -1
  45. package/build/cjs/src/ecom-v1-checkout-checkout.meta.d.ts +0 -59
  46. package/build/cjs/src/ecom-v1-checkout-checkout.meta.js +0 -351
  47. package/build/cjs/src/ecom-v1-checkout-checkout.meta.js.map +0 -1
  48. package/build/cjs/src/ecom-v1-checkout-checkout.public.d.ts +0 -182
  49. package/build/cjs/src/ecom-v1-checkout-checkout.public.js +0 -357
  50. package/build/cjs/src/ecom-v1-checkout-checkout.public.js.map +0 -1
  51. package/build/cjs/src/ecom-v1-checkout-checkout.types.js +0 -303
  52. package/build/cjs/src/ecom-v1-checkout-checkout.types.js.map +0 -1
  53. package/build/cjs/src/ecom-v1-checkout-checkout.universal.d.ts +0 -4437
  54. package/build/cjs/src/ecom-v1-checkout-checkout.universal.js +0 -1587
  55. package/build/cjs/src/ecom-v1-checkout-checkout.universal.js.map +0 -1
  56. package/build/es/index.d.ts +0 -1
  57. package/build/es/index.js +0 -2
  58. package/build/es/index.js.map +0 -1
  59. package/build/es/index.typings.d.ts +0 -1
  60. package/build/es/index.typings.js +0 -2
  61. package/build/es/index.typings.js.map +0 -1
  62. package/build/es/meta.d.ts +0 -1
  63. package/build/es/meta.js +0 -2
  64. package/build/es/meta.js.map +0 -1
  65. package/build/es/package.json +0 -3
  66. package/build/es/src/ecom-v1-checkout-checkout.context.d.ts +0 -35
  67. package/build/es/src/ecom-v1-checkout-checkout.context.js +0 -41
  68. package/build/es/src/ecom-v1-checkout-checkout.context.js.map +0 -1
  69. package/build/es/src/ecom-v1-checkout-checkout.http.d.ts +0 -101
  70. package/build/es/src/ecom-v1-checkout-checkout.http.js +0 -1297
  71. package/build/es/src/ecom-v1-checkout-checkout.http.js.map +0 -1
  72. package/build/es/src/ecom-v1-checkout-checkout.meta.d.ts +0 -59
  73. package/build/es/src/ecom-v1-checkout-checkout.meta.js +0 -308
  74. package/build/es/src/ecom-v1-checkout-checkout.meta.js.map +0 -1
  75. package/build/es/src/ecom-v1-checkout-checkout.public.d.ts +0 -182
  76. package/build/es/src/ecom-v1-checkout-checkout.public.js +0 -305
  77. package/build/es/src/ecom-v1-checkout-checkout.public.js.map +0 -1
  78. package/build/es/src/ecom-v1-checkout-checkout.types.js +0 -300
  79. package/build/es/src/ecom-v1-checkout-checkout.types.js.map +0 -1
  80. package/build/es/src/ecom-v1-checkout-checkout.universal.d.ts +0 -4437
  81. package/build/es/src/ecom-v1-checkout-checkout.universal.js +0 -1544
  82. package/build/es/src/ecom-v1-checkout-checkout.universal.js.map +0 -1
  83. package/build/internal/cjs/index.d.ts +0 -1
  84. package/build/internal/cjs/index.js +0 -18
  85. package/build/internal/cjs/index.js.map +0 -1
  86. package/build/internal/cjs/index.typings.d.ts +0 -1
  87. package/build/internal/cjs/index.typings.js +0 -18
  88. package/build/internal/cjs/index.typings.js.map +0 -1
  89. package/build/internal/cjs/meta.d.ts +0 -1
  90. package/build/internal/cjs/meta.js +0 -18
  91. package/build/internal/cjs/meta.js.map +0 -1
  92. package/build/internal/cjs/src/ecom-v1-checkout-checkout.context.d.ts +0 -41
  93. package/build/internal/cjs/src/ecom-v1-checkout-checkout.context.js +0 -76
  94. package/build/internal/cjs/src/ecom-v1-checkout-checkout.context.js.map +0 -1
  95. package/build/internal/cjs/src/ecom-v1-checkout-checkout.http.d.ts +0 -101
  96. package/build/internal/cjs/src/ecom-v1-checkout-checkout.http.js +0 -1317
  97. package/build/internal/cjs/src/ecom-v1-checkout-checkout.http.js.map +0 -1
  98. package/build/internal/cjs/src/ecom-v1-checkout-checkout.meta.d.ts +0 -59
  99. package/build/internal/cjs/src/ecom-v1-checkout-checkout.meta.js +0 -351
  100. package/build/internal/cjs/src/ecom-v1-checkout-checkout.meta.js.map +0 -1
  101. package/build/internal/cjs/src/ecom-v1-checkout-checkout.public.d.ts +0 -206
  102. package/build/internal/cjs/src/ecom-v1-checkout-checkout.public.js +0 -357
  103. package/build/internal/cjs/src/ecom-v1-checkout-checkout.public.js.map +0 -1
  104. package/build/internal/cjs/src/ecom-v1-checkout-checkout.types.js +0 -303
  105. package/build/internal/cjs/src/ecom-v1-checkout-checkout.types.js.map +0 -1
  106. package/build/internal/cjs/src/ecom-v1-checkout-checkout.universal.d.ts +0 -4623
  107. package/build/internal/cjs/src/ecom-v1-checkout-checkout.universal.js +0 -1587
  108. package/build/internal/cjs/src/ecom-v1-checkout-checkout.universal.js.map +0 -1
  109. package/build/internal/es/index.d.ts +0 -1
  110. package/build/internal/es/index.js +0 -2
  111. package/build/internal/es/index.js.map +0 -1
  112. package/build/internal/es/index.typings.d.ts +0 -1
  113. package/build/internal/es/index.typings.js +0 -2
  114. package/build/internal/es/index.typings.js.map +0 -1
  115. package/build/internal/es/meta.d.ts +0 -1
  116. package/build/internal/es/meta.js +0 -2
  117. package/build/internal/es/meta.js.map +0 -1
  118. package/build/internal/es/src/ecom-v1-checkout-checkout.context.d.ts +0 -41
  119. package/build/internal/es/src/ecom-v1-checkout-checkout.context.js +0 -41
  120. package/build/internal/es/src/ecom-v1-checkout-checkout.context.js.map +0 -1
  121. package/build/internal/es/src/ecom-v1-checkout-checkout.http.d.ts +0 -101
  122. package/build/internal/es/src/ecom-v1-checkout-checkout.http.js +0 -1297
  123. package/build/internal/es/src/ecom-v1-checkout-checkout.http.js.map +0 -1
  124. package/build/internal/es/src/ecom-v1-checkout-checkout.meta.d.ts +0 -59
  125. package/build/internal/es/src/ecom-v1-checkout-checkout.meta.js +0 -308
  126. package/build/internal/es/src/ecom-v1-checkout-checkout.meta.js.map +0 -1
  127. package/build/internal/es/src/ecom-v1-checkout-checkout.public.d.ts +0 -206
  128. package/build/internal/es/src/ecom-v1-checkout-checkout.public.js +0 -305
  129. package/build/internal/es/src/ecom-v1-checkout-checkout.public.js.map +0 -1
  130. package/build/internal/es/src/ecom-v1-checkout-checkout.types.js +0 -300
  131. package/build/internal/es/src/ecom-v1-checkout-checkout.types.js.map +0 -1
  132. package/build/internal/es/src/ecom-v1-checkout-checkout.universal.d.ts +0 -4623
  133. package/build/internal/es/src/ecom-v1-checkout-checkout.universal.js +0 -1544
  134. package/build/internal/es/src/ecom-v1-checkout-checkout.universal.js.map +0 -1
@@ -1,1544 +0,0 @@
1
- import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
2
- import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
3
- import * as ambassadorWixEcomV1Checkout from './ecom-v1-checkout-checkout.http.js';
4
- import { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';
5
- import { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';
6
- import { transformSDKImageToRESTImage } from '@wix/sdk-runtime/transformations/image';
7
- import { transformRESTImageToSDKImage } from '@wix/sdk-runtime/transformations/image';
8
- import { transformSDKPageURLV2ToRESTPageURLV2 } from '@wix/sdk-runtime/transformations/page-url-v2';
9
- import { transformRESTPageURLV2ToSDKPageURLV2 } from '@wix/sdk-runtime/transformations/page-url-v2';
10
- import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
11
- /** JurisdictionType represents the type of the jurisdiction in which this tax detail applies (e.g. Country,State,County,City,Special). */
12
- export var JurisdictionType;
13
- (function (JurisdictionType) {
14
- JurisdictionType["UNDEFINED"] = "UNDEFINED";
15
- JurisdictionType["COUNTRY"] = "COUNTRY";
16
- JurisdictionType["STATE"] = "STATE";
17
- JurisdictionType["COUNTY"] = "COUNTY";
18
- JurisdictionType["CITY"] = "CITY";
19
- JurisdictionType["SPECIAL"] = "SPECIAL";
20
- })(JurisdictionType || (JurisdictionType = {}));
21
- export var DescriptionLineType;
22
- (function (DescriptionLineType) {
23
- /** Unrecognized type. */
24
- DescriptionLineType["UNRECOGNISED"] = "UNRECOGNISED";
25
- /** Plain text type. */
26
- DescriptionLineType["PLAIN_TEXT"] = "PLAIN_TEXT";
27
- /** Color type. */
28
- DescriptionLineType["COLOR"] = "COLOR";
29
- })(DescriptionLineType || (DescriptionLineType = {}));
30
- export var ItemAvailabilityStatus;
31
- (function (ItemAvailabilityStatus) {
32
- ItemAvailabilityStatus["AVAILABLE"] = "AVAILABLE";
33
- /** Item does not exist. */
34
- ItemAvailabilityStatus["NOT_FOUND"] = "NOT_FOUND";
35
- /** Item is not in stock. */
36
- ItemAvailabilityStatus["NOT_AVAILABLE"] = "NOT_AVAILABLE";
37
- /** Available quantity is less than requested. */
38
- ItemAvailabilityStatus["PARTIALLY_AVAILABLE"] = "PARTIALLY_AVAILABLE";
39
- })(ItemAvailabilityStatus || (ItemAvailabilityStatus = {}));
40
- export var ItemTypeItemType;
41
- (function (ItemTypeItemType) {
42
- ItemTypeItemType["UNRECOGNISED"] = "UNRECOGNISED";
43
- ItemTypeItemType["PHYSICAL"] = "PHYSICAL";
44
- ItemTypeItemType["DIGITAL"] = "DIGITAL";
45
- ItemTypeItemType["GIFT_CARD"] = "GIFT_CARD";
46
- ItemTypeItemType["SERVICE"] = "SERVICE";
47
- })(ItemTypeItemType || (ItemTypeItemType = {}));
48
- /** Frequency unit of recurring payment */
49
- export var SubscriptionFrequency;
50
- (function (SubscriptionFrequency) {
51
- SubscriptionFrequency["UNDEFINED"] = "UNDEFINED";
52
- SubscriptionFrequency["DAY"] = "DAY";
53
- SubscriptionFrequency["WEEK"] = "WEEK";
54
- SubscriptionFrequency["MONTH"] = "MONTH";
55
- SubscriptionFrequency["YEAR"] = "YEAR";
56
- })(SubscriptionFrequency || (SubscriptionFrequency = {}));
57
- export var FileType;
58
- (function (FileType) {
59
- FileType["UNSPECIFIED"] = "UNSPECIFIED";
60
- FileType["SECURE_PICTURE"] = "SECURE_PICTURE";
61
- FileType["SECURE_VIDEO"] = "SECURE_VIDEO";
62
- FileType["SECURE_DOCUMENT"] = "SECURE_DOCUMENT";
63
- FileType["SECURE_MUSIC"] = "SECURE_MUSIC";
64
- FileType["SECURE_ARCHIVE"] = "SECURE_ARCHIVE";
65
- })(FileType || (FileType = {}));
66
- /** Type of selected payment option for catalog item */
67
- export var PaymentOptionType;
68
- (function (PaymentOptionType) {
69
- /** The entire payment for this item happens as part of the checkout. */
70
- PaymentOptionType["FULL_PAYMENT_ONLINE"] = "FULL_PAYMENT_ONLINE";
71
- /** The entire payment for this item happens after checkout. For example, when using cash, check, or other offline payment methods. */
72
- PaymentOptionType["FULL_PAYMENT_OFFLINE"] = "FULL_PAYMENT_OFFLINE";
73
- /** Payment for this item is done by charging a membership. When selected, `price` is `0`. */
74
- PaymentOptionType["MEMBERSHIP"] = "MEMBERSHIP";
75
- /** Partial payment to be paid upfront during checkout. The initial amount to be paid for each line item is specified in `depositAmount`. */
76
- PaymentOptionType["DEPOSIT_ONLINE"] = "DEPOSIT_ONLINE";
77
- /** Payment for this item can only be done by charging a membership and must be manually redeemed in the dashboard by the site admin. When selected, `price` is `0`. */
78
- PaymentOptionType["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
79
- })(PaymentOptionType || (PaymentOptionType = {}));
80
- export var TaxableAddressType;
81
- (function (TaxableAddressType) {
82
- TaxableAddressType["UNKNOWN_TAXABLE_ADDRESS"] = "UNKNOWN_TAXABLE_ADDRESS";
83
- TaxableAddressType["BUSINESS"] = "BUSINESS";
84
- TaxableAddressType["BILLING"] = "BILLING";
85
- TaxableAddressType["SHIPPING"] = "SHIPPING";
86
- })(TaxableAddressType || (TaxableAddressType = {}));
87
- /** tax info types */
88
- export var CommonVatType;
89
- (function (CommonVatType) {
90
- CommonVatType["UNSPECIFIED"] = "UNSPECIFIED";
91
- /** CPF - for individual tax payers. */
92
- CommonVatType["CPF"] = "CPF";
93
- /** CNPJ - for corporations */
94
- CommonVatType["CNPJ"] = "CNPJ";
95
- })(CommonVatType || (CommonVatType = {}));
96
- export var PickupMethod;
97
- (function (PickupMethod) {
98
- PickupMethod["UNKNOWN_METHOD"] = "UNKNOWN_METHOD";
99
- PickupMethod["STORE_PICKUP"] = "STORE_PICKUP";
100
- PickupMethod["PICKUP_POINT"] = "PICKUP_POINT";
101
- })(PickupMethod || (PickupMethod = {}));
102
- export var ChargeType;
103
- (function (ChargeType) {
104
- ChargeType["HANDLING_FEE"] = "HANDLING_FEE";
105
- ChargeType["INSURANCE"] = "INSURANCE";
106
- })(ChargeType || (ChargeType = {}));
107
- export var RuleType;
108
- (function (RuleType) {
109
- RuleType["VALIDATION"] = "VALIDATION";
110
- RuleType["OTHER"] = "OTHER";
111
- RuleType["MAX"] = "MAX";
112
- RuleType["MIN"] = "MIN";
113
- RuleType["MAX_LENGTH"] = "MAX_LENGTH";
114
- RuleType["MIN_LENGTH"] = "MIN_LENGTH";
115
- RuleType["MAX_SIZE"] = "MAX_SIZE";
116
- RuleType["MIN_SIZE"] = "MIN_SIZE";
117
- RuleType["FORMAT"] = "FORMAT";
118
- RuleType["DECIMAL_LTE"] = "DECIMAL_LTE";
119
- RuleType["DECIMAL_GTE"] = "DECIMAL_GTE";
120
- RuleType["DECIMAL_LT"] = "DECIMAL_LT";
121
- RuleType["DECIMAL_GT"] = "DECIMAL_GT";
122
- RuleType["DECIMAL_MAX_SCALE"] = "DECIMAL_MAX_SCALE";
123
- RuleType["INVALID_ENUM_VALUE"] = "INVALID_ENUM_VALUE";
124
- RuleType["REQUIRED_FIELD"] = "REQUIRED_FIELD";
125
- RuleType["FIELD_NOT_ALLOWED"] = "FIELD_NOT_ALLOWED";
126
- RuleType["ONE_OF_ALIGNMENT"] = "ONE_OF_ALIGNMENT";
127
- RuleType["EXACT_LENGTH"] = "EXACT_LENGTH";
128
- RuleType["EXACT_SIZE"] = "EXACT_SIZE";
129
- RuleType["REQUIRED_ONE_OF_FIELD"] = "REQUIRED_ONE_OF_FIELD";
130
- })(RuleType || (RuleType = {}));
131
- export var DiscountType;
132
- (function (DiscountType) {
133
- DiscountType["GLOBAL"] = "GLOBAL";
134
- DiscountType["SPECIFIC_ITEMS"] = "SPECIFIC_ITEMS";
135
- DiscountType["SHIPPING"] = "SHIPPING";
136
- })(DiscountType || (DiscountType = {}));
137
- export var WeightUnit;
138
- (function (WeightUnit) {
139
- /** Weight unit can't be classified due to an error. */
140
- WeightUnit["UNSPECIFIED_WEIGHT_UNIT"] = "UNSPECIFIED_WEIGHT_UNIT";
141
- /** Kilograms. */
142
- WeightUnit["KG"] = "KG";
143
- /** Pounds. */
144
- WeightUnit["LB"] = "LB";
145
- })(WeightUnit || (WeightUnit = {}));
146
- export var RateType;
147
- (function (RateType) {
148
- /** no tax being collected for this request due to location of purchase */
149
- RateType["NO_TAX_COLLECTED"] = "NO_TAX_COLLECTED";
150
- /** manual rate used for calculation */
151
- RateType["MANUAL_RATE"] = "MANUAL_RATE";
152
- /** autotax rate used for calculation */
153
- RateType["AUTO_RATE"] = "AUTO_RATE";
154
- /** fallback rate used for calculation */
155
- RateType["FALLBACK_RATE"] = "FALLBACK_RATE";
156
- })(RateType || (RateType = {}));
157
- export var ManualCalculationReason;
158
- (function (ManualCalculationReason) {
159
- /** user set calculator in Business Manager to be Manual */
160
- ManualCalculationReason["GLOBAL_SETTING_TO_MANUAL"] = "GLOBAL_SETTING_TO_MANUAL";
161
- /** specific region is on manual even though Global setting is Auto-tax */
162
- ManualCalculationReason["REGION_SETTING_TO_MANUAL"] = "REGION_SETTING_TO_MANUAL";
163
- })(ManualCalculationReason || (ManualCalculationReason = {}));
164
- export var FallbackReason;
165
- (function (FallbackReason) {
166
- /** auto-tax failed to be calculated */
167
- FallbackReason["AUTO_TAX_FAILED"] = "AUTO_TAX_FAILED";
168
- /** auto-tax was temporarily deactivated on a system-level */
169
- FallbackReason["AUTO_TAX_DEACTIVATED"] = "AUTO_TAX_DEACTIVATED";
170
- })(FallbackReason || (FallbackReason = {}));
171
- export var ChannelType;
172
- (function (ChannelType) {
173
- /** Unspecified sales channel. This value is not supported. */
174
- ChannelType["UNSPECIFIED"] = "UNSPECIFIED";
175
- /** A web client. */
176
- ChannelType["WEB"] = "WEB";
177
- /** [Point of sale solutions](https://support.wix.com/en/wix-mobile-pos-2196395). */
178
- ChannelType["POS"] = "POS";
179
- /** [eBay shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-ebay-shop). */
180
- ChannelType["EBAY"] = "EBAY";
181
- /** [Amazon shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-amazon-shop). */
182
- ChannelType["AMAZON"] = "AMAZON";
183
- /** Other sales platform. */
184
- ChannelType["OTHER_PLATFORM"] = "OTHER_PLATFORM";
185
- /** [Wix Owner app](https://support.wix.com/article/wix-owner-app-an-overview). */
186
- ChannelType["WIX_APP_STORE"] = "WIX_APP_STORE";
187
- /** Wix Invoices app in [your dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Finvoices/settings/general-settings) */
188
- ChannelType["WIX_INVOICES"] = "WIX_INVOICES";
189
- /** Wix merchant backoffice. */
190
- ChannelType["BACKOFFICE_MERCHANT"] = "BACKOFFICE_MERCHANT";
191
- /** Wish sales channel. */
192
- ChannelType["WISH"] = "WISH";
193
- /** [ClassPass sales channel](https://support.wix.com/en/article/wix-bookings-letting-clients-book-your-services-with-classpass). */
194
- ChannelType["CLASS_PASS"] = "CLASS_PASS";
195
- /** Global-E sales channel. */
196
- ChannelType["GLOBAL_E"] = "GLOBAL_E";
197
- /** [Facebook shop](https://support.wix.com/en/article/wix-stores-changes-to-facebook-shops). */
198
- ChannelType["FACEBOOK"] = "FACEBOOK";
199
- /** [Etsy sales channel](https://support.wix.com/en/article/wix-stores-request-adding-etsy-as-a-sales-channel). */
200
- ChannelType["ETSY"] = "ETSY";
201
- /** [TikTok sales channel](https://support.wix.com/en/article/wix-stores-request-adding-tiktok-as-a-sales-channel). */
202
- ChannelType["TIKTOK"] = "TIKTOK";
203
- /** [Faire marketplace integration](https://support.wix.com/en/article/wix-stores-creating-a-faire-store-using-the-faire-integration-app). */
204
- ChannelType["FAIRE_COM"] = "FAIRE_COM";
205
- })(ChannelType || (ChannelType = {}));
206
- export var AdditionalFeeSource;
207
- (function (AdditionalFeeSource) {
208
- AdditionalFeeSource["UNKNOWN_ADDITIONAL_FEE_SOURCE"] = "UNKNOWN_ADDITIONAL_FEE_SOURCE";
209
- /** The additional fee was added by an additional fee service plugin */
210
- AdditionalFeeSource["SERVICE_PLUGIN"] = "SERVICE_PLUGIN";
211
- /** The additional fee was added on the item either via the catalog or on custom line item */
212
- AdditionalFeeSource["ITEM"] = "ITEM";
213
- /** The additional fee was added manually on the request */
214
- AdditionalFeeSource["MANUAL"] = "MANUAL";
215
- /** The additional fee was added by the shipping provider */
216
- AdditionalFeeSource["SHIPPING"] = "SHIPPING";
217
- })(AdditionalFeeSource || (AdditionalFeeSource = {}));
218
- export var Severity;
219
- (function (Severity) {
220
- /** The user is allowed to move forward in the flow. */
221
- Severity["WARNING"] = "WARNING";
222
- /**
223
- * The user is blocked from moving forward in the flow.
224
- * For example, if callerContext is CART - moving to checkout is blocked. if callerContext is CHECKOUT, placing an order is blocked.
225
- */
226
- Severity["ERROR"] = "ERROR";
227
- })(Severity || (Severity = {}));
228
- /** Available locations on the webpage */
229
- export var NameInOther;
230
- (function (NameInOther) {
231
- /** Default location, in case no specific location is specified. */
232
- NameInOther["OTHER_DEFAULT"] = "OTHER_DEFAULT";
233
- })(NameInOther || (NameInOther = {}));
234
- /** Available locations on the line item */
235
- export var NameInLineItem;
236
- (function (NameInLineItem) {
237
- /** Default location, in case no specific location is specified. */
238
- NameInLineItem["LINE_ITEM_DEFAULT"] = "LINE_ITEM_DEFAULT";
239
- })(NameInLineItem || (NameInLineItem = {}));
240
- export var SuggestedFix;
241
- (function (SuggestedFix) {
242
- /** No suggested fix is specified. The user should refer to the violation description to resolve the issue. */
243
- SuggestedFix["UNKNOWN_SUGGESTED_FIX"] = "UNKNOWN_SUGGESTED_FIX";
244
- /** The line item should be removed from the cart or checkout to resolve the violation. */
245
- SuggestedFix["REMOVE_LINE_ITEM"] = "REMOVE_LINE_ITEM";
246
- })(SuggestedFix || (SuggestedFix = {}));
247
- export var GetCheckoutPaymentSettingsResponsePaymentOption;
248
- (function (GetCheckoutPaymentSettingsResponsePaymentOption) {
249
- GetCheckoutPaymentSettingsResponsePaymentOption["UNKNOWN_PAYMENT_OPTION"] = "UNKNOWN_PAYMENT_OPTION";
250
- GetCheckoutPaymentSettingsResponsePaymentOption["MANUAL"] = "MANUAL";
251
- })(GetCheckoutPaymentSettingsResponsePaymentOption || (GetCheckoutPaymentSettingsResponsePaymentOption = {}));
252
- export var IdentityType;
253
- (function (IdentityType) {
254
- IdentityType["UNSPECIFIED_IDENTITY_TYPE"] = "UNSPECIFIED_IDENTITY_TYPE";
255
- /** Site member */
256
- IdentityType["MEMBER"] = "MEMBER";
257
- /** Contact */
258
- IdentityType["CONTACT"] = "CONTACT";
259
- })(IdentityType || (IdentityType = {}));
260
- export var LineItemType;
261
- (function (LineItemType) {
262
- /** Line item type can't be classified, due to an error */
263
- LineItemType["UNSPECIFIED_LINE_ITEM_TYPE"] = "UNSPECIFIED_LINE_ITEM_TYPE";
264
- /** Physical item type */
265
- LineItemType["PHYSICAL"] = "PHYSICAL";
266
- /** Digital item type */
267
- LineItemType["DIGITAL"] = "DIGITAL";
268
- /** Custom item price */
269
- LineItemType["CUSTOM_AMOUNT_ITEM"] = "CUSTOM_AMOUNT_ITEM";
270
- })(LineItemType || (LineItemType = {}));
271
- export var MediaItemType;
272
- (function (MediaItemType) {
273
- /** Media item type can't be classified, due to an error */
274
- MediaItemType["UNSPECIFIED_MEDIA_TYPE_ITEM"] = "UNSPECIFIED_MEDIA_TYPE_ITEM";
275
- /** Image item type */
276
- MediaItemType["IMAGE"] = "IMAGE";
277
- })(MediaItemType || (MediaItemType = {}));
278
- /** Brazilian tax info types */
279
- export var VatType;
280
- (function (VatType) {
281
- /** When the tax info type can't be classified, due to an error */
282
- VatType["UNSPECIFIED_TAX_TYPE"] = "UNSPECIFIED_TAX_TYPE";
283
- /** CPF - for individual tax payers */
284
- VatType["CPF"] = "CPF";
285
- /** CNPJ - for corporations */
286
- VatType["CNPJ"] = "CNPJ";
287
- })(VatType || (VatType = {}));
288
- export var DiscountDiscountType;
289
- (function (DiscountDiscountType) {
290
- DiscountDiscountType["UNDEFINED"] = "UNDEFINED";
291
- /** No discount */
292
- DiscountDiscountType["AMOUNT"] = "AMOUNT";
293
- DiscountDiscountType["PERCENT"] = "PERCENT";
294
- })(DiscountDiscountType || (DiscountDiscountType = {}));
295
- export var ChannelInfoChannelType;
296
- (function (ChannelInfoChannelType) {
297
- ChannelInfoChannelType["UNSPECIFIED"] = "UNSPECIFIED";
298
- ChannelInfoChannelType["WEB"] = "WEB";
299
- ChannelInfoChannelType["OTHER_PLATFORM"] = "OTHER_PLATFORM";
300
- ChannelInfoChannelType["WIX_APP_STORE"] = "WIX_APP_STORE";
301
- })(ChannelInfoChannelType || (ChannelInfoChannelType = {}));
302
- export var WebhookIdentityType;
303
- (function (WebhookIdentityType) {
304
- WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
305
- WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
306
- WebhookIdentityType["MEMBER"] = "MEMBER";
307
- WebhookIdentityType["WIX_USER"] = "WIX_USER";
308
- WebhookIdentityType["APP"] = "APP";
309
- })(WebhookIdentityType || (WebhookIdentityType = {}));
310
- /**
311
- * Creates a checkout.
312
- *
313
- * A checkout must include at least 1 item in `lineItems` or `customLineItems`.
314
- *
315
- * If passing `checkoutInfo.customFields`, then `checkoutInfo.customFields.value` is a required field.
316
- * @public
317
- * @requiredField options.channelType
318
- * @requiredField options.checkoutInfo.customFields.value
319
- * @requiredField options.checkoutInfo.membershipOptions.selectedMemberships.memberships._id
320
- * @requiredField options.checkoutInfo.membershipOptions.selectedMemberships.memberships.appId
321
- * @requiredField options.checkoutInfo.membershipOptions.selectedMemberships.memberships.lineItemIds
322
- * @requiredField options.customLineItems.descriptionLines.name
323
- * @requiredField options.customLineItems.descriptionLines.value
324
- * @requiredField options.customLineItems.itemType
325
- * @requiredField options.customLineItems.price
326
- * @requiredField options.customLineItems.productName
327
- * @requiredField options.customLineItems.quantity
328
- * @requiredField options.lineItems.catalogReference
329
- * @requiredField options.lineItems.catalogReference.appId
330
- * @requiredField options.lineItems.catalogReference.catalogItemId
331
- * @requiredField options.lineItems.quantity
332
- * @param options - Checkout creation options.
333
- * @permissionId ECOM.MODIFY_CHECKOUTS
334
- * @permissionId ECOM.ADMIN_MODIFY_CHECKOUTS
335
- * @permissionScope Manage Stores - all permissions
336
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
337
- * @permissionScope Manage Stores
338
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
339
- * @permissionScope Manage Restaurants - all permissions
340
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
341
- * @permissionScope Manage eCommerce - all permissions
342
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
343
- * @permissionScope Manage Orders
344
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
345
- * @permissionScope Manage Stores - all permissions
346
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
347
- * @permissionScope Manage eCommerce - Admin Permissions
348
- * @permissionScopeId SCOPE.ECOM.MANAGE-ADMIN
349
- * @permissionScope Manage Stores
350
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
351
- * @permissionScope Manage Restaurants - all permissions
352
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
353
- * @permissionScope Manage eCommerce - all permissions
354
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
355
- * @applicableIdentity APP
356
- * @applicableIdentity VISITOR
357
- * @returns Newly created checkout.
358
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.CreateCheckout
359
- */
360
- export async function createCheckout(options) {
361
- // @ts-ignore
362
- const { httpClient, sideEffects } = arguments[1];
363
- const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
364
- checkoutInfo: options?.checkoutInfo,
365
- couponCode: options?.couponCode,
366
- lineItems: options?.lineItems,
367
- customLineItems: options?.customLineItems,
368
- channelType: options?.channelType,
369
- giftCardCode: options?.giftCardCode,
370
- overrideCheckoutUrl: options?.overrideCheckoutUrl,
371
- }), [
372
- {
373
- transformFn: transformSDKPageURLV2ToRESTPageURLV2,
374
- paths: [
375
- { path: 'checkoutInfo.lineItems.url' },
376
- { path: 'lineItems.url' },
377
- { path: 'customLineItems.url' },
378
- ],
379
- },
380
- {
381
- transformFn: transformSDKImageToRESTImage,
382
- paths: [
383
- { path: 'checkoutInfo.lineItems.media' },
384
- { path: 'checkoutInfo.lineItems.catalogOverrideFields.image' },
385
- { path: 'lineItems.media' },
386
- { path: 'lineItems.catalogOverrideFields.image' },
387
- { path: 'customLineItems.media' },
388
- ],
389
- },
390
- {
391
- transformFn: transformSDKAddressToRESTAddress,
392
- paths: [
393
- { path: 'checkoutInfo.billingInfo.address' },
394
- { path: 'checkoutInfo.shippingInfo.shippingDestination.address' },
395
- {
396
- path: 'checkoutInfo.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
397
- },
398
- {
399
- path: 'checkoutInfo.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
400
- },
401
- ],
402
- },
403
- ]);
404
- const reqOpts = ambassadorWixEcomV1Checkout.createCheckout(payload);
405
- sideEffects?.onSiteCall?.();
406
- try {
407
- const result = await httpClient.request(reqOpts);
408
- sideEffects?.onSuccess?.(result);
409
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
410
- {
411
- transformFn: transformRESTPageURLV2ToSDKPageURLV2,
412
- paths: [{ path: 'checkout.lineItems.url' }],
413
- },
414
- {
415
- transformFn: transformRESTImageToSDKImage,
416
- paths: [
417
- { path: 'checkout.lineItems.media' },
418
- { path: 'checkout.lineItems.catalogOverrideFields.image' },
419
- ],
420
- },
421
- {
422
- transformFn: transformRESTAddressToSDKAddress,
423
- paths: [
424
- { path: 'checkout.billingInfo.address' },
425
- { path: 'checkout.shippingInfo.shippingDestination.address' },
426
- {
427
- path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
428
- },
429
- {
430
- path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
431
- },
432
- ],
433
- },
434
- ]))?.checkout;
435
- }
436
- catch (err) {
437
- const transformedError = sdkTransformError(err, {
438
- spreadPathsToArguments: {},
439
- explicitPathsToArguments: {
440
- checkoutInfo: '$[0].checkoutInfo',
441
- couponCode: '$[0].couponCode',
442
- lineItems: '$[0].lineItems',
443
- customLineItems: '$[0].customLineItems',
444
- channelType: '$[0].channelType',
445
- giftCardCode: '$[0].giftCardCode',
446
- overrideCheckoutUrl: '$[0].overrideCheckoutUrl',
447
- },
448
- singleArgumentUnchanged: false,
449
- }, ['options']);
450
- sideEffects?.onError?.(err);
451
- throw transformedError;
452
- }
453
- }
454
- /**
455
- * Retrieves a checkout.
456
- * @param _id - Checkout ID.
457
- * @public
458
- * @requiredField _id
459
- * @permissionId ECOM.READ_CHECKOUTS
460
- * @permissionScope Manage Stores - all permissions
461
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
462
- * @permissionScope Manage Stores
463
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
464
- * @permissionScope Read eCommerce - all read permissions
465
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
466
- * @permissionScope Read Orders
467
- * @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
468
- * @permissionScope Read Stores - all read permissions
469
- * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
470
- * @permissionScope Manage Restaurants - all permissions
471
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
472
- * @permissionScope Manage eCommerce - all permissions
473
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
474
- * @permissionScope Manage Orders
475
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
476
- * @applicableIdentity APP
477
- * @applicableIdentity VISITOR
478
- * @returns Retrieved checkout.
479
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckout
480
- */
481
- export async function getCheckout(_id) {
482
- // @ts-ignore
483
- const { httpClient, sideEffects } = arguments[1];
484
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
485
- const reqOpts = ambassadorWixEcomV1Checkout.getCheckout(payload);
486
- sideEffects?.onSiteCall?.();
487
- try {
488
- const result = await httpClient.request(reqOpts);
489
- sideEffects?.onSuccess?.(result);
490
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
491
- {
492
- transformFn: transformRESTPageURLV2ToSDKPageURLV2,
493
- paths: [{ path: 'checkout.lineItems.url' }],
494
- },
495
- {
496
- transformFn: transformRESTImageToSDKImage,
497
- paths: [
498
- { path: 'checkout.lineItems.media' },
499
- { path: 'checkout.lineItems.catalogOverrideFields.image' },
500
- ],
501
- },
502
- {
503
- transformFn: transformRESTAddressToSDKAddress,
504
- paths: [
505
- { path: 'checkout.billingInfo.address' },
506
- { path: 'checkout.shippingInfo.shippingDestination.address' },
507
- {
508
- path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
509
- },
510
- {
511
- path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
512
- },
513
- ],
514
- },
515
- ]))?.checkout;
516
- }
517
- catch (err) {
518
- const transformedError = sdkTransformError(err, {
519
- spreadPathsToArguments: {},
520
- explicitPathsToArguments: { id: '$[0]' },
521
- singleArgumentUnchanged: false,
522
- }, ['_id']);
523
- sideEffects?.onError?.(err);
524
- throw transformedError;
525
- }
526
- }
527
- /**
528
- * Retrieves the checkout associated with a specified cart.
529
- * @param _id - Cart ID.
530
- * @public
531
- * @requiredField _id
532
- * @permissionId ECOM.READ_CHECKOUTS
533
- * @permissionScope Manage Stores - all permissions
534
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
535
- * @permissionScope Manage Stores
536
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
537
- * @permissionScope Read eCommerce - all read permissions
538
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
539
- * @permissionScope Read Orders
540
- * @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
541
- * @permissionScope Read Stores - all read permissions
542
- * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
543
- * @permissionScope Manage Restaurants - all permissions
544
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
545
- * @permissionScope Manage eCommerce - all permissions
546
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
547
- * @permissionScope Manage Orders
548
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
549
- * @applicableIdentity APP
550
- * @applicableIdentity VISITOR
551
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckoutByCartId
552
- */
553
- export async function getCheckoutByCartId(_id) {
554
- // @ts-ignore
555
- const { httpClient, sideEffects } = arguments[1];
556
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
557
- const reqOpts = ambassadorWixEcomV1Checkout.getCheckoutByCartId(payload);
558
- sideEffects?.onSiteCall?.();
559
- try {
560
- const result = await httpClient.request(reqOpts);
561
- sideEffects?.onSuccess?.(result);
562
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
563
- {
564
- transformFn: transformRESTPageURLV2ToSDKPageURLV2,
565
- paths: [{ path: 'checkout.lineItems.url' }],
566
- },
567
- {
568
- transformFn: transformRESTImageToSDKImage,
569
- paths: [
570
- { path: 'checkout.lineItems.media' },
571
- { path: 'checkout.lineItems.catalogOverrideFields.image' },
572
- ],
573
- },
574
- {
575
- transformFn: transformRESTAddressToSDKAddress,
576
- paths: [
577
- { path: 'checkout.billingInfo.address' },
578
- { path: 'checkout.shippingInfo.shippingDestination.address' },
579
- {
580
- path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
581
- },
582
- {
583
- path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
584
- },
585
- ],
586
- },
587
- ]));
588
- }
589
- catch (err) {
590
- const transformedError = sdkTransformError(err, {
591
- spreadPathsToArguments: {},
592
- explicitPathsToArguments: { id: '$[0]' },
593
- singleArgumentUnchanged: false,
594
- }, ['_id']);
595
- sideEffects?.onError?.(err);
596
- throw transformedError;
597
- }
598
- }
599
- /**
600
- * Deprecated and will be removed soon, use GetCheckoutURL
601
- * @param _id - Checkout ID.
602
- * @internal
603
- * @documentationMaturity preview
604
- * @requiredField _id
605
- * @permissionId ECOM.READ_CHECKOUTS
606
- * @permissionScope Manage Stores - all permissions
607
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
608
- * @permissionScope Manage Stores
609
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
610
- * @permissionScope Read eCommerce - all read permissions
611
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
612
- * @permissionScope Read Orders
613
- * @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
614
- * @permissionScope Read Stores - all read permissions
615
- * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
616
- * @permissionScope Manage Restaurants - all permissions
617
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
618
- * @permissionScope Manage eCommerce - all permissions
619
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
620
- * @permissionScope Manage Orders
621
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
622
- * @applicableIdentity APP
623
- * @applicableIdentity VISITOR
624
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.GetWixCheckoutURL
625
- */
626
- export async function getWixCheckoutUrl(_id) {
627
- // @ts-ignore
628
- const { httpClient, sideEffects } = arguments[1];
629
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
630
- const reqOpts = ambassadorWixEcomV1Checkout.getWixCheckoutUrl(payload);
631
- sideEffects?.onSiteCall?.();
632
- try {
633
- const result = await httpClient.request(reqOpts);
634
- sideEffects?.onSuccess?.(result);
635
- return renameKeysFromRESTResponseToSDKResponse(result.data);
636
- }
637
- catch (err) {
638
- const transformedError = sdkTransformError(err, {
639
- spreadPathsToArguments: {},
640
- explicitPathsToArguments: { id: '$[0]' },
641
- singleArgumentUnchanged: false,
642
- }, ['_id']);
643
- sideEffects?.onError?.(err);
644
- throw transformedError;
645
- }
646
- }
647
- /**
648
- * Retrieves the checkout page URL of a specified checkout.
649
- *
650
- * By default, a `checkoutUrl` generates for a checkout and directs to a standard Wix checkout page.
651
- * However, if `overrideCheckoutUrl` has a value, it will replace and set the value of `checkoutUrl`.
652
- * @param _id - Checkout ID.
653
- * @public
654
- * @requiredField _id
655
- * @permissionId ECOM.READ_CHECKOUTS
656
- * @permissionScope Manage Stores - all permissions
657
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
658
- * @permissionScope Manage Stores
659
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
660
- * @permissionScope Read eCommerce - all read permissions
661
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.READ-ECOM
662
- * @permissionScope Read Orders
663
- * @permissionScopeId SCOPE.DC-STORES.READ-ORDERS
664
- * @permissionScope Read Stores - all read permissions
665
- * @permissionScopeId SCOPE.DC-STORES-MEGA.READ-STORES
666
- * @permissionScope Manage Restaurants - all permissions
667
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
668
- * @permissionScope Manage eCommerce - all permissions
669
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
670
- * @permissionScope Manage Orders
671
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
672
- * @applicableIdentity APP
673
- * @applicableIdentity VISITOR
674
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckoutURL
675
- */
676
- export async function getCheckoutUrl(_id) {
677
- // @ts-ignore
678
- const { httpClient, sideEffects } = arguments[1];
679
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
680
- const reqOpts = ambassadorWixEcomV1Checkout.getCheckoutUrl(payload);
681
- sideEffects?.onSiteCall?.();
682
- try {
683
- const result = await httpClient.request(reqOpts);
684
- sideEffects?.onSuccess?.(result);
685
- return renameKeysFromRESTResponseToSDKResponse(result.data);
686
- }
687
- catch (err) {
688
- const transformedError = sdkTransformError(err, {
689
- spreadPathsToArguments: {},
690
- explicitPathsToArguments: { id: '$[0]' },
691
- singleArgumentUnchanged: false,
692
- }, ['_id']);
693
- sideEffects?.onError?.(err);
694
- throw transformedError;
695
- }
696
- }
697
- /**
698
- * Updates a checkout.
699
- *
700
- * Use this method to update checkout fields such as billing and shipping info, or to add a coupon code or gift card.
701
- *
702
- * To update a checkout's `lineItems`, `completed` status, or to remove coupons and gift cards, see these methods:
703
- * + Add to Checkout: Add line items to the checkout.
704
- * + Update Line Items Quantity: Update the quantity of 1 or more line items in the checkout.
705
- * + Remove Line Items: Remove a line item from the checkout.
706
- * + Mark Checkout As Completed: To update `completed` to `true` if the checkout was completed through a non-Wix orders or payments system.
707
- * + Remove Coupon: To remove an applied coupon from the checkout.
708
- * + Remove Gift Card: To remove an applied gift card from the checkout.
709
- *
710
- * >**Notes:**
711
- * > + If nothing is passed in the request, the call will fail.
712
- * > + The `checkout.buyerInfo.email` may not be removed once it is set.
713
- * @param _id - Checkout ID.
714
- * @public
715
- * @requiredField _id
716
- * @requiredField checkout
717
- * @requiredField checkout.customFields.value
718
- * @requiredField checkout.membershipOptions.selectedMemberships.memberships._id
719
- * @requiredField checkout.membershipOptions.selectedMemberships.memberships.appId
720
- * @requiredField checkout.membershipOptions.selectedMemberships.memberships.lineItemIds
721
- * @requiredField options.customLineItems.descriptionLines.name
722
- * @requiredField options.customLineItems.descriptionLines.value
723
- * @requiredField options.customLineItems.itemType
724
- * @requiredField options.customLineItems.productName
725
- * @requiredField options.customLineItems.quantity
726
- * @requiredField options.lineItems.catalogReference
727
- * @requiredField options.lineItems.catalogReference.appId
728
- * @requiredField options.lineItems.catalogReference.catalogItemId
729
- * @requiredField options.lineItems.quantity
730
- * @param options - Checkout update options.
731
- * @permissionId ECOM.MODIFY_CHECKOUTS
732
- * @permissionId ECOM.ADMIN_MODIFY_CHECKOUTS
733
- * @permissionScope Manage Stores - all permissions
734
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
735
- * @permissionScope Manage Stores
736
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
737
- * @permissionScope Manage Restaurants - all permissions
738
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
739
- * @permissionScope Manage eCommerce - all permissions
740
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
741
- * @permissionScope Manage Orders
742
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
743
- * @permissionScope Manage Stores - all permissions
744
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
745
- * @permissionScope Manage eCommerce - Admin Permissions
746
- * @permissionScopeId SCOPE.ECOM.MANAGE-ADMIN
747
- * @permissionScope Manage Stores
748
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
749
- * @permissionScope Manage Restaurants - all permissions
750
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
751
- * @permissionScope Manage eCommerce - all permissions
752
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
753
- * @applicableIdentity APP
754
- * @applicableIdentity VISITOR
755
- * @returns Updated checkout.
756
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.UpdateCheckout
757
- */
758
- export async function updateCheckout(_id, checkout, options) {
759
- // @ts-ignore
760
- const { httpClient, sideEffects } = arguments[3];
761
- const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
762
- checkout: { ...checkout, id: _id },
763
- couponCode: options?.couponCode,
764
- giftCardCode: options?.giftCardCode,
765
- overrideCheckoutUrl: options?.overrideCheckoutUrl,
766
- lineItems: options?.lineItems,
767
- customLineItems: options?.customLineItems,
768
- }), [
769
- {
770
- transformFn: transformSDKPageURLV2ToRESTPageURLV2,
771
- paths: [
772
- { path: 'checkout.lineItems.url' },
773
- { path: 'lineItems.url' },
774
- { path: 'customLineItems.url' },
775
- ],
776
- },
777
- {
778
- transformFn: transformSDKImageToRESTImage,
779
- paths: [
780
- { path: 'checkout.lineItems.media' },
781
- { path: 'checkout.lineItems.catalogOverrideFields.image' },
782
- { path: 'lineItems.media' },
783
- { path: 'lineItems.catalogOverrideFields.image' },
784
- { path: 'customLineItems.media' },
785
- ],
786
- },
787
- {
788
- transformFn: transformSDKAddressToRESTAddress,
789
- paths: [
790
- { path: 'checkout.billingInfo.address' },
791
- { path: 'checkout.shippingInfo.shippingDestination.address' },
792
- {
793
- path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
794
- },
795
- {
796
- path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
797
- },
798
- ],
799
- },
800
- ]);
801
- const reqOpts = ambassadorWixEcomV1Checkout.updateCheckout(payload);
802
- sideEffects?.onSiteCall?.();
803
- try {
804
- const result = await httpClient.request(reqOpts);
805
- sideEffects?.onSuccess?.(result);
806
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
807
- {
808
- transformFn: transformRESTPageURLV2ToSDKPageURLV2,
809
- paths: [{ path: 'checkout.lineItems.url' }],
810
- },
811
- {
812
- transformFn: transformRESTImageToSDKImage,
813
- paths: [
814
- { path: 'checkout.lineItems.media' },
815
- { path: 'checkout.lineItems.catalogOverrideFields.image' },
816
- ],
817
- },
818
- {
819
- transformFn: transformRESTAddressToSDKAddress,
820
- paths: [
821
- { path: 'checkout.billingInfo.address' },
822
- { path: 'checkout.shippingInfo.shippingDestination.address' },
823
- {
824
- path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
825
- },
826
- {
827
- path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
828
- },
829
- ],
830
- },
831
- ]))?.checkout;
832
- }
833
- catch (err) {
834
- const transformedError = sdkTransformError(err, {
835
- spreadPathsToArguments: { checkout: '$[1]' },
836
- explicitPathsToArguments: {
837
- 'checkout.id': '$[0]',
838
- couponCode: '$[2].couponCode',
839
- giftCardCode: '$[2].giftCardCode',
840
- overrideCheckoutUrl: '$[2].overrideCheckoutUrl',
841
- lineItems: '$[2].lineItems',
842
- customLineItems: '$[2].customLineItems',
843
- },
844
- singleArgumentUnchanged: false,
845
- }, ['_id', 'checkout', 'options']);
846
- sideEffects?.onError?.(err);
847
- throw transformedError;
848
- }
849
- }
850
- /**
851
- * Removes the coupon from a specified checkout.
852
- * @param _id - ID of the checkout to remove the coupon from.
853
- * @public
854
- * @requiredField _id
855
- * @permissionId ECOM.MODIFY_CHECKOUTS
856
- * @permissionScope Manage Stores - all permissions
857
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
858
- * @permissionScope Manage Stores
859
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
860
- * @permissionScope Manage Restaurants - all permissions
861
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
862
- * @permissionScope Manage eCommerce - all permissions
863
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
864
- * @permissionScope Manage Orders
865
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
866
- * @applicableIdentity APP
867
- * @applicableIdentity VISITOR
868
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.RemoveCoupon
869
- */
870
- export async function removeCoupon(_id) {
871
- // @ts-ignore
872
- const { httpClient, sideEffects } = arguments[1];
873
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
874
- const reqOpts = ambassadorWixEcomV1Checkout.removeCoupon(payload);
875
- sideEffects?.onSiteCall?.();
876
- try {
877
- const result = await httpClient.request(reqOpts);
878
- sideEffects?.onSuccess?.(result);
879
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
880
- {
881
- transformFn: transformRESTPageURLV2ToSDKPageURLV2,
882
- paths: [{ path: 'checkout.lineItems.url' }],
883
- },
884
- {
885
- transformFn: transformRESTImageToSDKImage,
886
- paths: [
887
- { path: 'checkout.lineItems.media' },
888
- { path: 'checkout.lineItems.catalogOverrideFields.image' },
889
- ],
890
- },
891
- {
892
- transformFn: transformRESTAddressToSDKAddress,
893
- paths: [
894
- { path: 'checkout.billingInfo.address' },
895
- { path: 'checkout.shippingInfo.shippingDestination.address' },
896
- {
897
- path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
898
- },
899
- {
900
- path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
901
- },
902
- ],
903
- },
904
- ]));
905
- }
906
- catch (err) {
907
- const transformedError = sdkTransformError(err, {
908
- spreadPathsToArguments: {},
909
- explicitPathsToArguments: { id: '$[0]' },
910
- singleArgumentUnchanged: false,
911
- }, ['_id']);
912
- sideEffects?.onError?.(err);
913
- throw transformedError;
914
- }
915
- }
916
- /**
917
- * Removes the gift card from a specified checkout.
918
- *
919
- * A checkout can only hold 1 gift card.
920
- * @param _id - ID of the checkout to remove the gift card from.
921
- * @public
922
- * @requiredField _id
923
- * @permissionId ECOM.MODIFY_CHECKOUTS
924
- * @permissionScope Manage Stores - all permissions
925
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
926
- * @permissionScope Manage Stores
927
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
928
- * @permissionScope Manage Restaurants - all permissions
929
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
930
- * @permissionScope Manage eCommerce - all permissions
931
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
932
- * @permissionScope Manage Orders
933
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
934
- * @applicableIdentity APP
935
- * @applicableIdentity VISITOR
936
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.RemoveGiftCard
937
- */
938
- export async function removeGiftCard(_id) {
939
- // @ts-ignore
940
- const { httpClient, sideEffects } = arguments[1];
941
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
942
- const reqOpts = ambassadorWixEcomV1Checkout.removeGiftCard(payload);
943
- sideEffects?.onSiteCall?.();
944
- try {
945
- const result = await httpClient.request(reqOpts);
946
- sideEffects?.onSuccess?.(result);
947
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
948
- {
949
- transformFn: transformRESTPageURLV2ToSDKPageURLV2,
950
- paths: [{ path: 'checkout.lineItems.url' }],
951
- },
952
- {
953
- transformFn: transformRESTImageToSDKImage,
954
- paths: [
955
- { path: 'checkout.lineItems.media' },
956
- { path: 'checkout.lineItems.catalogOverrideFields.image' },
957
- ],
958
- },
959
- {
960
- transformFn: transformRESTAddressToSDKAddress,
961
- paths: [
962
- { path: 'checkout.billingInfo.address' },
963
- { path: 'checkout.shippingInfo.shippingDestination.address' },
964
- {
965
- path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
966
- },
967
- {
968
- path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
969
- },
970
- ],
971
- },
972
- ]));
973
- }
974
- catch (err) {
975
- const transformedError = sdkTransformError(err, {
976
- spreadPathsToArguments: {},
977
- explicitPathsToArguments: { id: '$[0]' },
978
- singleArgumentUnchanged: false,
979
- }, ['_id']);
980
- sideEffects?.onError?.(err);
981
- throw transformedError;
982
- }
983
- }
984
- /**
985
- * Removes the `overrideCheckoutUrl` from a specified checkout.
986
- *
987
- * When `overrideCheckoutUrl` is removed, the `checkoutUrl` will be set to the default, standard
988
- * Wix checkout page URL.
989
- * @param _id - ID of the checkout to remove the override checkout url from.
990
- * @public
991
- * @requiredField _id
992
- * @permissionId ECOM.MODIFY_CHECKOUTS
993
- * @permissionScope Manage Stores - all permissions
994
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
995
- * @permissionScope Manage Stores
996
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
997
- * @permissionScope Manage Restaurants - all permissions
998
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
999
- * @permissionScope Manage eCommerce - all permissions
1000
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1001
- * @permissionScope Manage Orders
1002
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1003
- * @applicableIdentity APP
1004
- * @applicableIdentity VISITOR
1005
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.RemoveOverrideCheckoutUrl
1006
- */
1007
- export async function removeOverrideCheckoutUrl(_id) {
1008
- // @ts-ignore
1009
- const { httpClient, sideEffects } = arguments[1];
1010
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
1011
- const reqOpts = ambassadorWixEcomV1Checkout.removeOverrideCheckoutUrl(payload);
1012
- sideEffects?.onSiteCall?.();
1013
- try {
1014
- const result = await httpClient.request(reqOpts);
1015
- sideEffects?.onSuccess?.(result);
1016
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1017
- {
1018
- transformFn: transformRESTPageURLV2ToSDKPageURLV2,
1019
- paths: [{ path: 'checkout.lineItems.url' }],
1020
- },
1021
- {
1022
- transformFn: transformRESTImageToSDKImage,
1023
- paths: [
1024
- { path: 'checkout.lineItems.media' },
1025
- { path: 'checkout.lineItems.catalogOverrideFields.image' },
1026
- ],
1027
- },
1028
- {
1029
- transformFn: transformRESTAddressToSDKAddress,
1030
- paths: [
1031
- { path: 'checkout.billingInfo.address' },
1032
- { path: 'checkout.shippingInfo.shippingDestination.address' },
1033
- {
1034
- path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
1035
- },
1036
- {
1037
- path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
1038
- },
1039
- ],
1040
- },
1041
- ]));
1042
- }
1043
- catch (err) {
1044
- const transformedError = sdkTransformError(err, {
1045
- spreadPathsToArguments: {},
1046
- explicitPathsToArguments: { id: '$[0]' },
1047
- singleArgumentUnchanged: false,
1048
- }, ['_id']);
1049
- sideEffects?.onError?.(err);
1050
- throw transformedError;
1051
- }
1052
- }
1053
- /**
1054
- * Adds catalog line items and/or custom line items to a checkout.
1055
- *
1056
- * When adding catalog ([SDK](https://dev.wix.com/docs/sdk/backend-modules/stores/catalog-v3/e-commerce-integration) | [REST](https://dev.wix.com/docs/rest/business-solutions/stores/catalog/e-commerce-integration)) items
1057
- * to a checkout, the `lineItems.catalogReference.appId` and `lineItems.catalogReference.catalogItemId` fields are required.
1058
- * @param _id - Checkout ID.
1059
- * @public
1060
- * @requiredField _id
1061
- * @requiredField options.customLineItems.descriptionLines.name
1062
- * @requiredField options.customLineItems.descriptionLines.value
1063
- * @requiredField options.customLineItems.itemType
1064
- * @requiredField options.customLineItems.productName
1065
- * @requiredField options.customLineItems.quantity
1066
- * @requiredField options.lineItems.catalogReference
1067
- * @requiredField options.lineItems.catalogReference.appId
1068
- * @requiredField options.lineItems.catalogReference.catalogItemId
1069
- * @requiredField options.lineItems.quantity
1070
- * @param options - Items to be added to checkout.
1071
- * @permissionId ECOM.MODIFY_CHECKOUTS
1072
- * @permissionId ECOM.ADMIN_MODIFY_CHECKOUTS
1073
- * @permissionScope Manage Stores - all permissions
1074
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1075
- * @permissionScope Manage Stores
1076
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1077
- * @permissionScope Manage Restaurants - all permissions
1078
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1079
- * @permissionScope Manage eCommerce - all permissions
1080
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1081
- * @permissionScope Manage Orders
1082
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1083
- * @permissionScope Manage Stores - all permissions
1084
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1085
- * @permissionScope Manage eCommerce - Admin Permissions
1086
- * @permissionScopeId SCOPE.ECOM.MANAGE-ADMIN
1087
- * @permissionScope Manage Stores
1088
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1089
- * @permissionScope Manage Restaurants - all permissions
1090
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1091
- * @permissionScope Manage eCommerce - all permissions
1092
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1093
- * @applicableIdentity APP
1094
- * @applicableIdentity VISITOR
1095
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.AddToCheckout
1096
- */
1097
- export async function addToCheckout(_id, options) {
1098
- // @ts-ignore
1099
- const { httpClient, sideEffects } = arguments[2];
1100
- const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
1101
- id: _id,
1102
- lineItems: options?.lineItems,
1103
- customLineItems: options?.customLineItems,
1104
- }), [
1105
- {
1106
- transformFn: transformSDKPageURLV2ToRESTPageURLV2,
1107
- paths: [{ path: 'lineItems.url' }, { path: 'customLineItems.url' }],
1108
- },
1109
- {
1110
- transformFn: transformSDKImageToRESTImage,
1111
- paths: [
1112
- { path: 'lineItems.media' },
1113
- { path: 'lineItems.catalogOverrideFields.image' },
1114
- { path: 'customLineItems.media' },
1115
- ],
1116
- },
1117
- ]);
1118
- const reqOpts = ambassadorWixEcomV1Checkout.addToCheckout(payload);
1119
- sideEffects?.onSiteCall?.();
1120
- try {
1121
- const result = await httpClient.request(reqOpts);
1122
- sideEffects?.onSuccess?.(result);
1123
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1124
- {
1125
- transformFn: transformRESTPageURLV2ToSDKPageURLV2,
1126
- paths: [{ path: 'checkout.lineItems.url' }],
1127
- },
1128
- {
1129
- transformFn: transformRESTImageToSDKImage,
1130
- paths: [
1131
- { path: 'checkout.lineItems.media' },
1132
- { path: 'checkout.lineItems.catalogOverrideFields.image' },
1133
- ],
1134
- },
1135
- {
1136
- transformFn: transformRESTAddressToSDKAddress,
1137
- paths: [
1138
- { path: 'checkout.billingInfo.address' },
1139
- { path: 'checkout.shippingInfo.shippingDestination.address' },
1140
- {
1141
- path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
1142
- },
1143
- {
1144
- path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
1145
- },
1146
- ],
1147
- },
1148
- ]));
1149
- }
1150
- catch (err) {
1151
- const transformedError = sdkTransformError(err, {
1152
- spreadPathsToArguments: {},
1153
- explicitPathsToArguments: {
1154
- id: '$[0]',
1155
- lineItems: '$[1].lineItems',
1156
- customLineItems: '$[1].customLineItems',
1157
- },
1158
- singleArgumentUnchanged: false,
1159
- }, ['_id', 'options']);
1160
- sideEffects?.onError?.(err);
1161
- throw transformedError;
1162
- }
1163
- }
1164
- /**
1165
- * Removes line items from the specified checkout.
1166
- * @param _id - ID of the checkout to remove line items from.
1167
- * @param lineItemIds - IDs of the line items to remove from the checkout.
1168
- *
1169
- * To find the IDs of the checkout line items you'd like to remove,
1170
- * pass the checkout ID to Get Checkout and look for the IDs under
1171
- * `lineItems`.
1172
- * @public
1173
- * @requiredField _id
1174
- * @requiredField lineItemIds
1175
- * @permissionId ECOM.MODIFY_CHECKOUTS
1176
- * @permissionScope Manage Stores - all permissions
1177
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1178
- * @permissionScope Manage Stores
1179
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1180
- * @permissionScope Manage Restaurants - all permissions
1181
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1182
- * @permissionScope Manage eCommerce - all permissions
1183
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1184
- * @permissionScope Manage Orders
1185
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1186
- * @applicableIdentity APP
1187
- * @applicableIdentity VISITOR
1188
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.RemoveLineItems
1189
- */
1190
- export async function removeLineItems(_id, lineItemIds) {
1191
- // @ts-ignore
1192
- const { httpClient, sideEffects } = arguments[2];
1193
- const payload = renameKeysFromSDKRequestToRESTRequest({
1194
- id: _id,
1195
- lineItemIds: lineItemIds,
1196
- });
1197
- const reqOpts = ambassadorWixEcomV1Checkout.removeLineItems(payload);
1198
- sideEffects?.onSiteCall?.();
1199
- try {
1200
- const result = await httpClient.request(reqOpts);
1201
- sideEffects?.onSuccess?.(result);
1202
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1203
- {
1204
- transformFn: transformRESTPageURLV2ToSDKPageURLV2,
1205
- paths: [{ path: 'checkout.lineItems.url' }],
1206
- },
1207
- {
1208
- transformFn: transformRESTImageToSDKImage,
1209
- paths: [
1210
- { path: 'checkout.lineItems.media' },
1211
- { path: 'checkout.lineItems.catalogOverrideFields.image' },
1212
- ],
1213
- },
1214
- {
1215
- transformFn: transformRESTAddressToSDKAddress,
1216
- paths: [
1217
- { path: 'checkout.billingInfo.address' },
1218
- { path: 'checkout.shippingInfo.shippingDestination.address' },
1219
- {
1220
- path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
1221
- },
1222
- {
1223
- path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
1224
- },
1225
- ],
1226
- },
1227
- ]));
1228
- }
1229
- catch (err) {
1230
- const transformedError = sdkTransformError(err, {
1231
- spreadPathsToArguments: {},
1232
- explicitPathsToArguments: { id: '$[0]', lineItemIds: '$[1]' },
1233
- singleArgumentUnchanged: false,
1234
- }, ['_id', 'lineItemIds']);
1235
- sideEffects?.onError?.(err);
1236
- throw transformedError;
1237
- }
1238
- }
1239
- /**
1240
- * Creates an order from a specified checkout.
1241
- *
1242
- * For an order to be created from a checkout, the following requirements must be met:
1243
- * + A checkout cannot have calculation errors. Pass the checkout ID to Get Checkout and review the `calculationErrors` field.
1244
- * + A checkout must have at least 1 line item or custom line item.
1245
- * + All of the line Items have an `availability.status` of `"AVAILABLE"` or `"PARTIALLY_AVAILABLE"`.
1246
- * + If there is a payment to be made, meaning that `priceSummary.total` is greater than `0`, the `billingInfo.address` field are required.
1247
- * + When a checkout has line items to be shipped, the `shippingInfo.shippingDestination.address` and `shippingInfo.selectedCarrierServiceOption` fields are required.
1248
- * + When a checkout has line items for pickup, the `shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails` field are required.
1249
- * @param _id - Checkout ID.
1250
- * @public
1251
- * @requiredField _id
1252
- * @param options - Additional order creation options.
1253
- * @permissionId ECOM.CREATE_ORDER_FROM_CHECKOUT
1254
- * @permissionScope Manage Stores - all permissions
1255
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1256
- * @permissionScope Manage Stores
1257
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1258
- * @permissionScope Manage Restaurants - all permissions
1259
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1260
- * @permissionScope Manage eCommerce - all permissions
1261
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1262
- * @permissionScope Manage Orders
1263
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1264
- * @applicableIdentity APP
1265
- * @applicableIdentity VISITOR
1266
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.CreateOrder
1267
- */
1268
- export async function createOrder(_id, options) {
1269
- // @ts-ignore
1270
- const { httpClient, sideEffects } = arguments[2];
1271
- const payload = renameKeysFromSDKRequestToRESTRequest({
1272
- id: _id,
1273
- savePaymentMethod: options?.savePaymentMethod,
1274
- delayCapture: options?.delayCapture,
1275
- });
1276
- const reqOpts = ambassadorWixEcomV1Checkout.createOrder(payload);
1277
- sideEffects?.onSiteCall?.();
1278
- try {
1279
- const result = await httpClient.request(reqOpts);
1280
- sideEffects?.onSuccess?.(result);
1281
- return renameKeysFromRESTResponseToSDKResponse(result.data);
1282
- }
1283
- catch (err) {
1284
- const transformedError = sdkTransformError(err, {
1285
- spreadPathsToArguments: {},
1286
- explicitPathsToArguments: {
1287
- id: '$[0]',
1288
- savePaymentMethod: '$[1].savePaymentMethod',
1289
- delayCapture: '$[1].delayCapture',
1290
- },
1291
- singleArgumentUnchanged: false,
1292
- }, ['_id', 'options']);
1293
- sideEffects?.onError?.(err);
1294
- throw transformedError;
1295
- }
1296
- }
1297
- /**
1298
- * Deprecated (use createOrder instead)
1299
- * @param _id - Checkout ID.
1300
- * @internal
1301
- * @documentationMaturity preview
1302
- * @requiredField _id
1303
- * @permissionId ECOM.CREATE_ORDER_FROM_CHECKOUT
1304
- * @permissionScope Manage Stores - all permissions
1305
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1306
- * @permissionScope Manage Stores
1307
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1308
- * @permissionScope Manage Restaurants - all permissions
1309
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1310
- * @permissionScope Manage eCommerce - all permissions
1311
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1312
- * @permissionScope Manage Orders
1313
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1314
- * @applicableIdentity APP
1315
- * @applicableIdentity VISITOR
1316
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.CreateOrderAndCharge
1317
- */
1318
- export async function createOrderAndCharge(_id, options) {
1319
- // @ts-ignore
1320
- const { httpClient, sideEffects } = arguments[2];
1321
- const payload = renameKeysFromSDKRequestToRESTRequest({
1322
- id: _id,
1323
- paymentToken: options?.paymentToken,
1324
- savePaymentMethod: options?.savePaymentMethod,
1325
- delayCapture: options?.delayCapture,
1326
- });
1327
- const reqOpts = ambassadorWixEcomV1Checkout.createOrderAndCharge(payload);
1328
- sideEffects?.onSiteCall?.();
1329
- try {
1330
- const result = await httpClient.request(reqOpts);
1331
- sideEffects?.onSuccess?.(result);
1332
- return renameKeysFromRESTResponseToSDKResponse(result.data);
1333
- }
1334
- catch (err) {
1335
- const transformedError = sdkTransformError(err, {
1336
- spreadPathsToArguments: {},
1337
- explicitPathsToArguments: {
1338
- id: '$[0]',
1339
- paymentToken: '$[1].paymentToken',
1340
- savePaymentMethod: '$[1].savePaymentMethod',
1341
- delayCapture: '$[1].delayCapture',
1342
- },
1343
- singleArgumentUnchanged: false,
1344
- }, ['_id', 'options']);
1345
- sideEffects?.onError?.(err);
1346
- throw transformedError;
1347
- }
1348
- }
1349
- /**
1350
- * Marks a checkout as completed and redirects to a specified URL.
1351
- * @param token - Server-signed JWT token with required information to complete checkout
1352
- * @public
1353
- * @documentationMaturity preview
1354
- * @requiredField token
1355
- * @permissionId ECOM.MODIFY_CHECKOUTS
1356
- * @permissionScope Manage Stores - all permissions
1357
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1358
- * @permissionScope Manage Stores
1359
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1360
- * @permissionScope Manage Restaurants - all permissions
1361
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1362
- * @permissionScope Manage eCommerce - all permissions
1363
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1364
- * @permissionScope Manage Orders
1365
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1366
- * @applicableIdentity APP
1367
- * @applicableIdentity VISITOR
1368
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.MarkCheckoutAsCompletedAndRedirectToUrl
1369
- */
1370
- export async function markCheckoutAsCompletedAndRedirectToUrl(token) {
1371
- // @ts-ignore
1372
- const { httpClient, sideEffects } = arguments[1];
1373
- const payload = renameKeysFromSDKRequestToRESTRequest({ token: token });
1374
- const reqOpts = ambassadorWixEcomV1Checkout.markCheckoutAsCompletedAndRedirectToUrl(payload);
1375
- sideEffects?.onSiteCall?.();
1376
- try {
1377
- const result = await httpClient.request(reqOpts);
1378
- sideEffects?.onSuccess?.(result);
1379
- return renameKeysFromRESTResponseToSDKResponse(result.data);
1380
- }
1381
- catch (err) {
1382
- const transformedError = sdkTransformError(err, {
1383
- spreadPathsToArguments: {},
1384
- explicitPathsToArguments: { token: '$[0]' },
1385
- singleArgumentUnchanged: false,
1386
- }, ['token']);
1387
- sideEffects?.onError?.(err);
1388
- throw transformedError;
1389
- }
1390
- }
1391
- /**
1392
- * Sets `completed` to `true` to mark a checkout as completed.
1393
- *
1394
- * When an order is completed through Wix, the `completed` field in the associated checkout object
1395
- * will automatically be updated to `true`. If an order is completed through a separate system,
1396
- * use this method to manually mark the checkout as completed.
1397
- * @param _id - Checkout ID.
1398
- * @public
1399
- * @requiredField _id
1400
- * @permissionId ECOM.MODIFY_CHECKOUTS
1401
- * @permissionScope Manage Stores - all permissions
1402
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1403
- * @permissionScope Manage Stores
1404
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1405
- * @permissionScope Manage Restaurants - all permissions
1406
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1407
- * @permissionScope Manage eCommerce - all permissions
1408
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1409
- * @permissionScope Manage Orders
1410
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1411
- * @applicableIdentity APP
1412
- * @applicableIdentity VISITOR
1413
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.MarkCheckoutAsCompleted
1414
- */
1415
- export async function markCheckoutAsCompleted(_id) {
1416
- // @ts-ignore
1417
- const { httpClient, sideEffects } = arguments[1];
1418
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
1419
- const reqOpts = ambassadorWixEcomV1Checkout.markCheckoutAsCompleted(payload);
1420
- sideEffects?.onSiteCall?.();
1421
- try {
1422
- const result = await httpClient.request(reqOpts);
1423
- sideEffects?.onSuccess?.(result);
1424
- }
1425
- catch (err) {
1426
- const transformedError = sdkTransformError(err, {
1427
- spreadPathsToArguments: {},
1428
- explicitPathsToArguments: { id: '$[0]' },
1429
- singleArgumentUnchanged: false,
1430
- }, ['_id']);
1431
- sideEffects?.onError?.(err);
1432
- throw transformedError;
1433
- }
1434
- }
1435
- /**
1436
- * Updates the quantity of one or more line items in a checkout.
1437
- *
1438
- * This method is only for updating the quantity of line items. To entirely remove a line item from
1439
- * the checkout, use the Remove Line Items method.
1440
- * To add a new line item to the checkout, use the Add to Checkout method.
1441
- *
1442
- * This method checks the amount of stock remaining for this line item. If the specified `quantity`
1443
- * is greater than the remaining stock, then the `quantity` returned in the response is the total amount
1444
- * of remaining stock.
1445
- * @param _id - Checkout ID.
1446
- * @param lineItems - Line item info to update.
1447
- * @public
1448
- * @requiredField _id
1449
- * @requiredField lineItems
1450
- * @requiredField lineItems._id
1451
- * @requiredField lineItems.quantity
1452
- * @permissionId ECOM.MODIFY_CHECKOUTS
1453
- * @permissionScope Manage Stores - all permissions
1454
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
1455
- * @permissionScope Manage Stores
1456
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
1457
- * @permissionScope Manage Restaurants - all permissions
1458
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
1459
- * @permissionScope Manage eCommerce - all permissions
1460
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
1461
- * @permissionScope Manage Orders
1462
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
1463
- * @applicableIdentity APP
1464
- * @applicableIdentity VISITOR
1465
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.UpdateLineItemsQuantity
1466
- */
1467
- export async function updateLineItemsQuantity(_id, lineItems) {
1468
- // @ts-ignore
1469
- const { httpClient, sideEffects } = arguments[2];
1470
- const payload = renameKeysFromSDKRequestToRESTRequest({
1471
- id: _id,
1472
- lineItems: lineItems,
1473
- });
1474
- const reqOpts = ambassadorWixEcomV1Checkout.updateLineItemsQuantity(payload);
1475
- sideEffects?.onSiteCall?.();
1476
- try {
1477
- const result = await httpClient.request(reqOpts);
1478
- sideEffects?.onSuccess?.(result);
1479
- return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
1480
- {
1481
- transformFn: transformRESTPageURLV2ToSDKPageURLV2,
1482
- paths: [{ path: 'checkout.lineItems.url' }],
1483
- },
1484
- {
1485
- transformFn: transformRESTImageToSDKImage,
1486
- paths: [
1487
- { path: 'checkout.lineItems.media' },
1488
- { path: 'checkout.lineItems.catalogOverrideFields.image' },
1489
- ],
1490
- },
1491
- {
1492
- transformFn: transformRESTAddressToSDKAddress,
1493
- paths: [
1494
- { path: 'checkout.billingInfo.address' },
1495
- { path: 'checkout.shippingInfo.shippingDestination.address' },
1496
- {
1497
- path: 'checkout.shippingInfo.selectedCarrierServiceOption.logistics.pickupDetails.address',
1498
- },
1499
- {
1500
- path: 'checkout.shippingInfo.carrierServiceOptions.shippingOptions.logistics.pickupDetails.address',
1501
- },
1502
- ],
1503
- },
1504
- ]));
1505
- }
1506
- catch (err) {
1507
- const transformedError = sdkTransformError(err, {
1508
- spreadPathsToArguments: {},
1509
- explicitPathsToArguments: { id: '$[0]', lineItems: '$[1]' },
1510
- singleArgumentUnchanged: false,
1511
- }, ['_id', 'lineItems']);
1512
- sideEffects?.onError?.(err);
1513
- throw transformedError;
1514
- }
1515
- }
1516
- /** @param _id - Checkout ID.
1517
- * @internal
1518
- * @documentationMaturity preview
1519
- * @requiredField _id
1520
- * @permissionId ECOM.READ_PAYMENT_SETTINGS
1521
- * @fqn com.wix.ecom.checkout.api.v1.CheckoutService.GetCheckoutPaymentSettings
1522
- */
1523
- export async function getCheckoutPaymentSettings(_id) {
1524
- // @ts-ignore
1525
- const { httpClient, sideEffects } = arguments[1];
1526
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
1527
- const reqOpts = ambassadorWixEcomV1Checkout.getCheckoutPaymentSettings(payload);
1528
- sideEffects?.onSiteCall?.();
1529
- try {
1530
- const result = await httpClient.request(reqOpts);
1531
- sideEffects?.onSuccess?.(result);
1532
- return renameKeysFromRESTResponseToSDKResponse(result.data);
1533
- }
1534
- catch (err) {
1535
- const transformedError = sdkTransformError(err, {
1536
- spreadPathsToArguments: {},
1537
- explicitPathsToArguments: { id: '$[0]' },
1538
- singleArgumentUnchanged: false,
1539
- }, ['_id']);
1540
- sideEffects?.onError?.(err);
1541
- throw transformedError;
1542
- }
1543
- }
1544
- //# sourceMappingURL=ecom-v1-checkout-checkout.universal.js.map