@wix/auto_sdk_loyalty_coupons 1.0.5 → 1.0.7

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 (129) hide show
  1. package/build/index.d.mts +100 -0
  2. package/build/index.d.ts +100 -0
  3. package/build/index.js +753 -0
  4. package/build/index.js.map +1 -0
  5. package/build/index.mjs +717 -0
  6. package/build/index.mjs.map +1 -0
  7. package/build/internal/index.d.mts +100 -0
  8. package/build/internal/index.d.ts +100 -0
  9. package/build/internal/index.js +753 -0
  10. package/build/internal/index.js.map +1 -0
  11. package/build/internal/index.mjs +717 -0
  12. package/build/internal/index.mjs.map +1 -0
  13. package/build/internal/{cjs/src/loyalty-v1-coupon-coupons.universal.d.ts → loyalty-v1-coupon-coupons.universal-BpPn8h94.d.mts} +58 -260
  14. package/build/internal/{es/src/loyalty-v1-coupon-coupons.universal.d.ts → loyalty-v1-coupon-coupons.universal-BpPn8h94.d.ts} +58 -260
  15. package/build/internal/{cjs/src/loyalty-v1-coupon-coupons.types.d.ts → meta.d.mts} +60 -253
  16. package/build/{es/src/loyalty-v1-coupon-coupons.types.d.ts → internal/meta.d.ts} +60 -253
  17. package/build/internal/meta.js +515 -0
  18. package/build/internal/meta.js.map +1 -0
  19. package/build/internal/meta.mjs +482 -0
  20. package/build/internal/meta.mjs.map +1 -0
  21. package/build/{cjs/src/loyalty-v1-coupon-coupons.universal.d.ts → loyalty-v1-coupon-coupons.universal-BpPn8h94.d.mts} +58 -260
  22. package/build/{es/src/loyalty-v1-coupon-coupons.universal.d.ts → loyalty-v1-coupon-coupons.universal-BpPn8h94.d.ts} +58 -260
  23. package/build/{cjs/src/loyalty-v1-coupon-coupons.types.d.ts → meta.d.mts} +60 -253
  24. package/build/{internal/es/src/loyalty-v1-coupon-coupons.types.d.ts → meta.d.ts} +60 -253
  25. package/build/meta.js +515 -0
  26. package/build/meta.js.map +1 -0
  27. package/build/meta.mjs +482 -0
  28. package/build/meta.mjs.map +1 -0
  29. package/package.json +13 -12
  30. package/build/cjs/index.d.ts +0 -1
  31. package/build/cjs/index.js +0 -18
  32. package/build/cjs/index.js.map +0 -1
  33. package/build/cjs/index.typings.d.ts +0 -1
  34. package/build/cjs/index.typings.js +0 -18
  35. package/build/cjs/index.typings.js.map +0 -1
  36. package/build/cjs/meta.d.ts +0 -1
  37. package/build/cjs/meta.js +0 -18
  38. package/build/cjs/meta.js.map +0 -1
  39. package/build/cjs/src/loyalty-v1-coupon-coupons.context.d.ts +0 -22
  40. package/build/cjs/src/loyalty-v1-coupon-coupons.context.js +0 -29
  41. package/build/cjs/src/loyalty-v1-coupon-coupons.context.js.map +0 -1
  42. package/build/cjs/src/loyalty-v1-coupon-coupons.http.d.ts +0 -43
  43. package/build/cjs/src/loyalty-v1-coupon-coupons.http.js +0 -389
  44. package/build/cjs/src/loyalty-v1-coupon-coupons.http.js.map +0 -1
  45. package/build/cjs/src/loyalty-v1-coupon-coupons.meta.d.ts +0 -23
  46. package/build/cjs/src/loyalty-v1-coupon-coupons.meta.js +0 -161
  47. package/build/cjs/src/loyalty-v1-coupon-coupons.meta.js.map +0 -1
  48. package/build/cjs/src/loyalty-v1-coupon-coupons.public.d.ts +0 -85
  49. package/build/cjs/src/loyalty-v1-coupon-coupons.public.js +0 -98
  50. package/build/cjs/src/loyalty-v1-coupon-coupons.public.js.map +0 -1
  51. package/build/cjs/src/loyalty-v1-coupon-coupons.types.js +0 -41
  52. package/build/cjs/src/loyalty-v1-coupon-coupons.types.js.map +0 -1
  53. package/build/cjs/src/loyalty-v1-coupon-coupons.universal.js +0 -370
  54. package/build/cjs/src/loyalty-v1-coupon-coupons.universal.js.map +0 -1
  55. package/build/es/index.d.ts +0 -1
  56. package/build/es/index.js +0 -2
  57. package/build/es/index.js.map +0 -1
  58. package/build/es/index.typings.d.ts +0 -1
  59. package/build/es/index.typings.js +0 -2
  60. package/build/es/index.typings.js.map +0 -1
  61. package/build/es/meta.d.ts +0 -1
  62. package/build/es/meta.js +0 -2
  63. package/build/es/meta.js.map +0 -1
  64. package/build/es/src/loyalty-v1-coupon-coupons.context.d.ts +0 -22
  65. package/build/es/src/loyalty-v1-coupon-coupons.context.js +0 -22
  66. package/build/es/src/loyalty-v1-coupon-coupons.context.js.map +0 -1
  67. package/build/es/src/loyalty-v1-coupon-coupons.http.d.ts +0 -43
  68. package/build/es/src/loyalty-v1-coupon-coupons.http.js +0 -379
  69. package/build/es/src/loyalty-v1-coupon-coupons.http.js.map +0 -1
  70. package/build/es/src/loyalty-v1-coupon-coupons.meta.d.ts +0 -23
  71. package/build/es/src/loyalty-v1-coupon-coupons.meta.js +0 -128
  72. package/build/es/src/loyalty-v1-coupon-coupons.meta.js.map +0 -1
  73. package/build/es/src/loyalty-v1-coupon-coupons.public.d.ts +0 -85
  74. package/build/es/src/loyalty-v1-coupon-coupons.public.js +0 -84
  75. package/build/es/src/loyalty-v1-coupon-coupons.public.js.map +0 -1
  76. package/build/es/src/loyalty-v1-coupon-coupons.types.js +0 -38
  77. package/build/es/src/loyalty-v1-coupon-coupons.types.js.map +0 -1
  78. package/build/es/src/loyalty-v1-coupon-coupons.universal.js +0 -337
  79. package/build/es/src/loyalty-v1-coupon-coupons.universal.js.map +0 -1
  80. package/build/internal/cjs/index.d.ts +0 -1
  81. package/build/internal/cjs/index.js +0 -18
  82. package/build/internal/cjs/index.js.map +0 -1
  83. package/build/internal/cjs/index.typings.d.ts +0 -1
  84. package/build/internal/cjs/index.typings.js +0 -18
  85. package/build/internal/cjs/index.typings.js.map +0 -1
  86. package/build/internal/cjs/meta.d.ts +0 -1
  87. package/build/internal/cjs/meta.js +0 -18
  88. package/build/internal/cjs/meta.js.map +0 -1
  89. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.context.d.ts +0 -22
  90. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.context.js +0 -29
  91. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.context.js.map +0 -1
  92. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.http.d.ts +0 -43
  93. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.http.js +0 -389
  94. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.http.js.map +0 -1
  95. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.meta.d.ts +0 -23
  96. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.meta.js +0 -161
  97. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.meta.js.map +0 -1
  98. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.public.d.ts +0 -85
  99. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.public.js +0 -98
  100. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.public.js.map +0 -1
  101. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.types.js +0 -41
  102. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.types.js.map +0 -1
  103. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.universal.js +0 -370
  104. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.universal.js.map +0 -1
  105. package/build/internal/es/index.d.ts +0 -1
  106. package/build/internal/es/index.js +0 -2
  107. package/build/internal/es/index.js.map +0 -1
  108. package/build/internal/es/index.typings.d.ts +0 -1
  109. package/build/internal/es/index.typings.js +0 -2
  110. package/build/internal/es/index.typings.js.map +0 -1
  111. package/build/internal/es/meta.d.ts +0 -1
  112. package/build/internal/es/meta.js +0 -2
  113. package/build/internal/es/meta.js.map +0 -1
  114. package/build/internal/es/src/loyalty-v1-coupon-coupons.context.d.ts +0 -22
  115. package/build/internal/es/src/loyalty-v1-coupon-coupons.context.js +0 -22
  116. package/build/internal/es/src/loyalty-v1-coupon-coupons.context.js.map +0 -1
  117. package/build/internal/es/src/loyalty-v1-coupon-coupons.http.d.ts +0 -43
  118. package/build/internal/es/src/loyalty-v1-coupon-coupons.http.js +0 -379
  119. package/build/internal/es/src/loyalty-v1-coupon-coupons.http.js.map +0 -1
  120. package/build/internal/es/src/loyalty-v1-coupon-coupons.meta.d.ts +0 -23
  121. package/build/internal/es/src/loyalty-v1-coupon-coupons.meta.js +0 -128
  122. package/build/internal/es/src/loyalty-v1-coupon-coupons.meta.js.map +0 -1
  123. package/build/internal/es/src/loyalty-v1-coupon-coupons.public.d.ts +0 -85
  124. package/build/internal/es/src/loyalty-v1-coupon-coupons.public.js +0 -84
  125. package/build/internal/es/src/loyalty-v1-coupon-coupons.public.js.map +0 -1
  126. package/build/internal/es/src/loyalty-v1-coupon-coupons.types.js +0 -38
  127. package/build/internal/es/src/loyalty-v1-coupon-coupons.types.js.map +0 -1
  128. package/build/internal/es/src/loyalty-v1-coupon-coupons.universal.js +0 -337
  129. package/build/internal/es/src/loyalty-v1-coupon-coupons.universal.js.map +0 -1
@@ -0,0 +1,717 @@
1
+ // src/loyalty-v1-coupon-coupons.public.ts
2
+ import { renameKeysFromRESTResponseToSDKResponse as renameKeysFromRESTResponseToSDKResponse2 } from "@wix/sdk-runtime/rename-all-nested-keys";
3
+ import { transformRESTFloatToSDKFloat as transformRESTFloatToSDKFloat2 } from "@wix/sdk-runtime/transformations/float";
4
+ import { transformRESTTimestampToSDKTimestamp as transformRESTTimestampToSDKTimestamp2 } from "@wix/sdk-runtime/transformations/timestamp";
5
+ import { transformPaths as transformPaths2 } from "@wix/sdk-runtime/transformations/transform-paths";
6
+ import { EventDefinition } from "@wix/sdk-types";
7
+
8
+ // src/loyalty-v1-coupon-coupons.universal.ts
9
+ import { transformError as sdkTransformError } from "@wix/sdk-runtime/transform-error";
10
+ import { queryBuilder } from "@wix/sdk-runtime/query-builder";
11
+ import {
12
+ renameKeysFromSDKRequestToRESTRequest,
13
+ renameKeysFromRESTResponseToSDKResponse
14
+ } from "@wix/sdk-runtime/rename-all-nested-keys";
15
+
16
+ // src/loyalty-v1-coupon-coupons.http.ts
17
+ import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
18
+ import { transformRESTFloatToSDKFloat } from "@wix/sdk-runtime/transformations/float";
19
+ import { transformRESTTimestampToSDKTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
20
+ import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
21
+ import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
22
+ function resolveComWixpressLoyaltyCouponLoyaltyCouponsUrl(opts) {
23
+ const domainToMappings = {
24
+ "manage._base_domain_": [
25
+ {
26
+ srcPath: "/_api/loyalty-coupons",
27
+ destPath: ""
28
+ }
29
+ ],
30
+ _: [
31
+ {
32
+ srcPath: "/_api/loyalty-coupons",
33
+ destPath: ""
34
+ }
35
+ ],
36
+ "editor.wixapps.net": [
37
+ {
38
+ srcPath: "/_api/loyalty-coupons",
39
+ destPath: ""
40
+ }
41
+ ],
42
+ "editor._base_domain_": [
43
+ {
44
+ srcPath: "/_api/loyalty-coupons",
45
+ destPath: ""
46
+ }
47
+ ],
48
+ "blocks._base_domain_": [
49
+ {
50
+ srcPath: "/_api/loyalty-coupons",
51
+ destPath: ""
52
+ }
53
+ ],
54
+ "create.editorx": [
55
+ {
56
+ srcPath: "/_api/loyalty-coupons",
57
+ destPath: ""
58
+ }
59
+ ],
60
+ "www._base_domain_": [
61
+ {
62
+ srcPath: "/_api/loyalty-coupons",
63
+ destPath: ""
64
+ }
65
+ ],
66
+ "*.dev.wix-code.com": [
67
+ {
68
+ srcPath: "/_api/loyalty-coupons",
69
+ destPath: ""
70
+ }
71
+ ],
72
+ "*.pub.wix-code.com": [
73
+ {
74
+ srcPath: "/_api/loyalty-coupons",
75
+ destPath: ""
76
+ }
77
+ ],
78
+ "api._api_base_domain_": [
79
+ {
80
+ srcPath: "/loyalty-coupons",
81
+ destPath: ""
82
+ }
83
+ ],
84
+ "www.wixapis.com": [
85
+ {
86
+ srcPath: "/loyalty-coupons",
87
+ destPath: ""
88
+ }
89
+ ]
90
+ };
91
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
92
+ }
93
+ var PACKAGE_NAME = "@wix/auto_sdk_loyalty_coupons";
94
+ function redeemPointsForCoupon(payload) {
95
+ function __redeemPointsForCoupon({ host }) {
96
+ const metadata = {
97
+ entityFqdn: "wix.loyalty.v1.coupon",
98
+ method: "POST",
99
+ methodFqn: "com.wixpress.loyalty.coupon.LoyaltyCoupons.RedeemPointsForCoupon",
100
+ packageName: PACKAGE_NAME,
101
+ url: resolveComWixpressLoyaltyCouponLoyaltyCouponsUrl({
102
+ protoPath: "/v1/coupons",
103
+ data: payload,
104
+ host
105
+ }),
106
+ data: payload,
107
+ transformResponse: (payload2) => transformPaths(payload2, [
108
+ {
109
+ transformFn: transformRESTTimestampToSDKTimestamp,
110
+ paths: [
111
+ { path: "coupon.createdDate" },
112
+ { path: "coupon.updatedDate" }
113
+ ]
114
+ },
115
+ {
116
+ transformFn: transformRESTFloatToSDKFloat,
117
+ paths: [
118
+ { path: "coupon.couponReference.specification.moneyOffAmount" },
119
+ { path: "coupon.couponReference.specification.percentOffRate" },
120
+ { path: "coupon.couponReference.specification.fixedPriceAmount" },
121
+ { path: "coupon.couponReference.specification.minimumSubtotal" }
122
+ ]
123
+ }
124
+ ])
125
+ };
126
+ return metadata;
127
+ }
128
+ return __redeemPointsForCoupon;
129
+ }
130
+ function redeemCurrentMemberPointsForCoupon(payload) {
131
+ function __redeemCurrentMemberPointsForCoupon({ host }) {
132
+ const metadata = {
133
+ entityFqdn: "wix.loyalty.v1.coupon",
134
+ method: "POST",
135
+ methodFqn: "com.wixpress.loyalty.coupon.LoyaltyCoupons.RedeemCurrentMemberPointsForCoupon",
136
+ packageName: PACKAGE_NAME,
137
+ url: resolveComWixpressLoyaltyCouponLoyaltyCouponsUrl({
138
+ protoPath: "/v1/coupons/redeem-my-coupon",
139
+ data: payload,
140
+ host
141
+ }),
142
+ data: payload,
143
+ transformResponse: (payload2) => transformPaths(payload2, [
144
+ {
145
+ transformFn: transformRESTTimestampToSDKTimestamp,
146
+ paths: [
147
+ { path: "coupon.createdDate" },
148
+ { path: "coupon.updatedDate" }
149
+ ]
150
+ },
151
+ {
152
+ transformFn: transformRESTFloatToSDKFloat,
153
+ paths: [
154
+ { path: "coupon.couponReference.specification.moneyOffAmount" },
155
+ { path: "coupon.couponReference.specification.percentOffRate" },
156
+ { path: "coupon.couponReference.specification.fixedPriceAmount" },
157
+ { path: "coupon.couponReference.specification.minimumSubtotal" }
158
+ ]
159
+ }
160
+ ])
161
+ };
162
+ return metadata;
163
+ }
164
+ return __redeemCurrentMemberPointsForCoupon;
165
+ }
166
+ function getLoyaltyCoupon(payload) {
167
+ function __getLoyaltyCoupon({ host }) {
168
+ const metadata = {
169
+ entityFqdn: "wix.loyalty.v1.coupon",
170
+ method: "GET",
171
+ methodFqn: "com.wixpress.loyalty.coupon.LoyaltyCoupons.GetLoyaltyCoupon",
172
+ packageName: PACKAGE_NAME,
173
+ url: resolveComWixpressLoyaltyCouponLoyaltyCouponsUrl({
174
+ protoPath: "/v1/coupons/{loyaltyCouponId}",
175
+ data: payload,
176
+ host
177
+ }),
178
+ params: toURLSearchParams(payload),
179
+ transformResponse: (payload2) => transformPaths(payload2, [
180
+ {
181
+ transformFn: transformRESTTimestampToSDKTimestamp,
182
+ paths: [
183
+ { path: "loyaltyCoupon.createdDate" },
184
+ { path: "loyaltyCoupon.updatedDate" }
185
+ ]
186
+ },
187
+ {
188
+ transformFn: transformRESTFloatToSDKFloat,
189
+ paths: [
190
+ {
191
+ path: "loyaltyCoupon.couponReference.specification.moneyOffAmount"
192
+ },
193
+ {
194
+ path: "loyaltyCoupon.couponReference.specification.percentOffRate"
195
+ },
196
+ {
197
+ path: "loyaltyCoupon.couponReference.specification.fixedPriceAmount"
198
+ },
199
+ {
200
+ path: "loyaltyCoupon.couponReference.specification.minimumSubtotal"
201
+ }
202
+ ]
203
+ }
204
+ ])
205
+ };
206
+ return metadata;
207
+ }
208
+ return __getLoyaltyCoupon;
209
+ }
210
+ function bulkGetLoyaltyCoupon(payload) {
211
+ function __bulkGetLoyaltyCoupon({ host }) {
212
+ const metadata = {
213
+ entityFqdn: "wix.loyalty.v1.coupon",
214
+ method: "GET",
215
+ methodFqn: "com.wixpress.loyalty.coupon.LoyaltyCoupons.BulkGetLoyaltyCoupon",
216
+ packageName: PACKAGE_NAME,
217
+ url: resolveComWixpressLoyaltyCouponLoyaltyCouponsUrl({
218
+ protoPath: "/v1/bulk/coupons",
219
+ data: payload,
220
+ host
221
+ }),
222
+ params: toURLSearchParams(payload, true),
223
+ transformResponse: (payload2) => transformPaths(payload2, [
224
+ {
225
+ transformFn: transformRESTTimestampToSDKTimestamp,
226
+ paths: [
227
+ { path: "couponsInSite.loyaltyCoupons.createdDate" },
228
+ { path: "couponsInSite.loyaltyCoupons.updatedDate" }
229
+ ]
230
+ },
231
+ {
232
+ transformFn: transformRESTFloatToSDKFloat,
233
+ paths: [
234
+ {
235
+ path: "couponsInSite.loyaltyCoupons.couponReference.specification.moneyOffAmount"
236
+ },
237
+ {
238
+ path: "couponsInSite.loyaltyCoupons.couponReference.specification.percentOffRate"
239
+ },
240
+ {
241
+ path: "couponsInSite.loyaltyCoupons.couponReference.specification.fixedPriceAmount"
242
+ },
243
+ {
244
+ path: "couponsInSite.loyaltyCoupons.couponReference.specification.minimumSubtotal"
245
+ }
246
+ ]
247
+ }
248
+ ])
249
+ };
250
+ return metadata;
251
+ }
252
+ return __bulkGetLoyaltyCoupon;
253
+ }
254
+ function getCurrentMemberCoupons(payload) {
255
+ function __getCurrentMemberCoupons({ host }) {
256
+ const metadata = {
257
+ entityFqdn: "wix.loyalty.v1.coupon",
258
+ method: "GET",
259
+ methodFqn: "com.wixpress.loyalty.coupon.LoyaltyCoupons.GetCurrentMemberCoupons",
260
+ packageName: PACKAGE_NAME,
261
+ url: resolveComWixpressLoyaltyCouponLoyaltyCouponsUrl({
262
+ protoPath: "/v1/coupons/my-coupons",
263
+ data: payload,
264
+ host
265
+ }),
266
+ params: toURLSearchParams(payload),
267
+ transformResponse: (payload2) => transformPaths(payload2, [
268
+ {
269
+ transformFn: transformRESTTimestampToSDKTimestamp,
270
+ paths: [
271
+ { path: "loyaltyCoupons.createdDate" },
272
+ { path: "loyaltyCoupons.updatedDate" }
273
+ ]
274
+ },
275
+ {
276
+ transformFn: transformRESTFloatToSDKFloat,
277
+ paths: [
278
+ {
279
+ path: "loyaltyCoupons.couponReference.specification.moneyOffAmount"
280
+ },
281
+ {
282
+ path: "loyaltyCoupons.couponReference.specification.percentOffRate"
283
+ },
284
+ {
285
+ path: "loyaltyCoupons.couponReference.specification.fixedPriceAmount"
286
+ },
287
+ {
288
+ path: "loyaltyCoupons.couponReference.specification.minimumSubtotal"
289
+ }
290
+ ]
291
+ }
292
+ ])
293
+ };
294
+ return metadata;
295
+ }
296
+ return __getCurrentMemberCoupons;
297
+ }
298
+ function queryLoyaltyCoupon(payload) {
299
+ function __queryLoyaltyCoupon({ host }) {
300
+ const metadata = {
301
+ entityFqdn: "wix.loyalty.v1.coupon",
302
+ method: "POST",
303
+ methodFqn: "com.wixpress.loyalty.coupon.LoyaltyCoupons.QueryLoyaltyCoupon",
304
+ packageName: PACKAGE_NAME,
305
+ url: resolveComWixpressLoyaltyCouponLoyaltyCouponsUrl({
306
+ protoPath: "/v1/coupons/query",
307
+ data: payload,
308
+ host
309
+ }),
310
+ data: payload,
311
+ transformResponse: (payload2) => transformPaths(payload2, [
312
+ {
313
+ transformFn: transformRESTTimestampToSDKTimestamp,
314
+ paths: [
315
+ { path: "loyaltyCoupons.createdDate" },
316
+ { path: "loyaltyCoupons.updatedDate" }
317
+ ]
318
+ },
319
+ {
320
+ transformFn: transformRESTFloatToSDKFloat,
321
+ paths: [
322
+ {
323
+ path: "loyaltyCoupons.couponReference.specification.moneyOffAmount"
324
+ },
325
+ {
326
+ path: "loyaltyCoupons.couponReference.specification.percentOffRate"
327
+ },
328
+ {
329
+ path: "loyaltyCoupons.couponReference.specification.fixedPriceAmount"
330
+ },
331
+ {
332
+ path: "loyaltyCoupons.couponReference.specification.minimumSubtotal"
333
+ }
334
+ ]
335
+ }
336
+ ])
337
+ };
338
+ return metadata;
339
+ }
340
+ return __queryLoyaltyCoupon;
341
+ }
342
+ function deleteLoyaltyCoupon(payload) {
343
+ function __deleteLoyaltyCoupon({ host }) {
344
+ const metadata = {
345
+ entityFqdn: "wix.loyalty.v1.coupon",
346
+ method: "DELETE",
347
+ methodFqn: "com.wixpress.loyalty.coupon.LoyaltyCoupons.DeleteLoyaltyCoupon",
348
+ packageName: PACKAGE_NAME,
349
+ url: resolveComWixpressLoyaltyCouponLoyaltyCouponsUrl({
350
+ protoPath: "/v1/coupons/{id}",
351
+ data: payload,
352
+ host
353
+ }),
354
+ params: toURLSearchParams(payload)
355
+ };
356
+ return metadata;
357
+ }
358
+ return __deleteLoyaltyCoupon;
359
+ }
360
+
361
+ // src/loyalty-v1-coupon-coupons.universal.ts
362
+ var Type = /* @__PURE__ */ ((Type2) => {
363
+ Type2["UNKNOWN"] = "UNKNOWN";
364
+ Type2["MONEY_OFF_AMOUNT"] = "MONEY_OFF_AMOUNT";
365
+ Type2["PERCENT_OFF_RATE"] = "PERCENT_OFF_RATE";
366
+ Type2["FREE_SHIPPING"] = "FREE_SHIPPING";
367
+ Type2["FIXED_PRICE_AMOUNT"] = "FIXED_PRICE_AMOUNT";
368
+ Type2["BUY_X_GET_Y"] = "BUY_X_GET_Y";
369
+ return Type2;
370
+ })(Type || {});
371
+ var Status = /* @__PURE__ */ ((Status2) => {
372
+ Status2["UNKNOWN"] = "UNKNOWN";
373
+ Status2["PENDING"] = "PENDING";
374
+ Status2["ACTIVE"] = "ACTIVE";
375
+ Status2["APPLIED"] = "APPLIED";
376
+ Status2["FAILED"] = "FAILED";
377
+ Status2["ARCHIVED"] = "ARCHIVED";
378
+ return Status2;
379
+ })(Status || {});
380
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
381
+ SortOrder2["ASC"] = "ASC";
382
+ SortOrder2["DESC"] = "DESC";
383
+ return SortOrder2;
384
+ })(SortOrder || {});
385
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
386
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
387
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
388
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
389
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
390
+ WebhookIdentityType2["APP"] = "APP";
391
+ return WebhookIdentityType2;
392
+ })(WebhookIdentityType || {});
393
+ async function redeemPointsForCoupon2(rewardId, options) {
394
+ const { httpClient, sideEffects } = arguments[2];
395
+ const payload = renameKeysFromSDKRequestToRESTRequest({
396
+ rewardId,
397
+ loyaltyAccountId: options?.loyaltyAccountId
398
+ });
399
+ const reqOpts = redeemPointsForCoupon(payload);
400
+ sideEffects?.onSiteCall?.();
401
+ try {
402
+ const result = await httpClient.request(reqOpts);
403
+ sideEffects?.onSuccess?.(result);
404
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
405
+ } catch (err) {
406
+ const transformedError = sdkTransformError(
407
+ err,
408
+ {
409
+ spreadPathsToArguments: {},
410
+ explicitPathsToArguments: {
411
+ rewardId: "$[0]",
412
+ loyaltyAccountId: "$[1].loyaltyAccountId"
413
+ },
414
+ singleArgumentUnchanged: false
415
+ },
416
+ ["rewardId", "options"]
417
+ );
418
+ sideEffects?.onError?.(err);
419
+ throw transformedError;
420
+ }
421
+ }
422
+ async function redeemCurrentMemberPointsForCoupon2(rewardId) {
423
+ const { httpClient, sideEffects } = arguments[1];
424
+ const payload = renameKeysFromSDKRequestToRESTRequest({ rewardId });
425
+ const reqOpts = redeemCurrentMemberPointsForCoupon(payload);
426
+ sideEffects?.onSiteCall?.();
427
+ try {
428
+ const result = await httpClient.request(reqOpts);
429
+ sideEffects?.onSuccess?.(result);
430
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
431
+ } catch (err) {
432
+ const transformedError = sdkTransformError(
433
+ err,
434
+ {
435
+ spreadPathsToArguments: {},
436
+ explicitPathsToArguments: { rewardId: "$[0]" },
437
+ singleArgumentUnchanged: false
438
+ },
439
+ ["rewardId"]
440
+ );
441
+ sideEffects?.onError?.(err);
442
+ throw transformedError;
443
+ }
444
+ }
445
+ async function getLoyaltyCoupon2(loyaltyCouponId) {
446
+ const { httpClient, sideEffects } = arguments[1];
447
+ const payload = renameKeysFromSDKRequestToRESTRequest({
448
+ loyaltyCouponId
449
+ });
450
+ const reqOpts = getLoyaltyCoupon(payload);
451
+ sideEffects?.onSiteCall?.();
452
+ try {
453
+ const result = await httpClient.request(reqOpts);
454
+ sideEffects?.onSuccess?.(result);
455
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.loyaltyCoupon;
456
+ } catch (err) {
457
+ const transformedError = sdkTransformError(
458
+ err,
459
+ {
460
+ spreadPathsToArguments: {},
461
+ explicitPathsToArguments: { loyaltyCouponId: "$[0]" },
462
+ singleArgumentUnchanged: false
463
+ },
464
+ ["loyaltyCouponId"]
465
+ );
466
+ sideEffects?.onError?.(err);
467
+ throw transformedError;
468
+ }
469
+ }
470
+ async function bulkGetLoyaltyCoupon2(options) {
471
+ const { httpClient, sideEffects } = arguments[1];
472
+ const payload = renameKeysFromSDKRequestToRESTRequest({
473
+ query: options?.query
474
+ });
475
+ const reqOpts = bulkGetLoyaltyCoupon(payload);
476
+ sideEffects?.onSiteCall?.();
477
+ try {
478
+ const result = await httpClient.request(reqOpts);
479
+ sideEffects?.onSuccess?.(result);
480
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
481
+ } catch (err) {
482
+ const transformedError = sdkTransformError(
483
+ err,
484
+ {
485
+ spreadPathsToArguments: {},
486
+ explicitPathsToArguments: { query: "$[0].query" },
487
+ singleArgumentUnchanged: false
488
+ },
489
+ ["options"]
490
+ );
491
+ sideEffects?.onError?.(err);
492
+ throw transformedError;
493
+ }
494
+ }
495
+ async function getCurrentMemberCoupons2() {
496
+ const { httpClient, sideEffects } = arguments[0];
497
+ const payload = renameKeysFromSDKRequestToRESTRequest({});
498
+ const reqOpts = getCurrentMemberCoupons(payload);
499
+ sideEffects?.onSiteCall?.();
500
+ try {
501
+ const result = await httpClient.request(reqOpts);
502
+ sideEffects?.onSuccess?.(result);
503
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
504
+ } catch (err) {
505
+ const transformedError = sdkTransformError(
506
+ err,
507
+ {
508
+ spreadPathsToArguments: {},
509
+ explicitPathsToArguments: {},
510
+ singleArgumentUnchanged: false
511
+ },
512
+ []
513
+ );
514
+ sideEffects?.onError?.(err);
515
+ throw transformedError;
516
+ }
517
+ }
518
+ function queryLoyaltyCoupons() {
519
+ const { httpClient, sideEffects } = arguments[0];
520
+ return queryBuilder({
521
+ func: async (payload) => {
522
+ const reqOpts = queryLoyaltyCoupon(payload);
523
+ sideEffects?.onSiteCall?.();
524
+ try {
525
+ const result = await httpClient.request(reqOpts);
526
+ sideEffects?.onSuccess?.(result);
527
+ return result;
528
+ } catch (err) {
529
+ sideEffects?.onError?.(err);
530
+ throw err;
531
+ }
532
+ },
533
+ requestTransformer: (query) => {
534
+ const args = [query, {}];
535
+ return renameKeysFromSDKRequestToRESTRequest({
536
+ ...args?.[1],
537
+ query: args?.[0]
538
+ });
539
+ },
540
+ responseTransformer: ({
541
+ data
542
+ }) => {
543
+ const transformedData = renameKeysFromRESTResponseToSDKResponse(data);
544
+ return {
545
+ items: transformedData?.loyaltyCoupons,
546
+ pagingMetadata: transformedData?.metadata
547
+ };
548
+ },
549
+ errorTransformer: (err) => {
550
+ const transformedError = sdkTransformError(err, {
551
+ spreadPathsToArguments: {},
552
+ explicitPathsToArguments: { query: "$[0]" },
553
+ singleArgumentUnchanged: false
554
+ });
555
+ throw transformedError;
556
+ },
557
+ pagingMethod: "CURSOR",
558
+ transformationPaths: {}
559
+ });
560
+ }
561
+ async function deleteLoyaltyCoupon2(_id, revision) {
562
+ const { httpClient, sideEffects } = arguments[2];
563
+ const payload = renameKeysFromSDKRequestToRESTRequest({
564
+ id: _id,
565
+ revision
566
+ });
567
+ const reqOpts = deleteLoyaltyCoupon(payload);
568
+ sideEffects?.onSiteCall?.();
569
+ try {
570
+ const result = await httpClient.request(reqOpts);
571
+ sideEffects?.onSuccess?.(result);
572
+ } catch (err) {
573
+ const transformedError = sdkTransformError(
574
+ err,
575
+ {
576
+ spreadPathsToArguments: {},
577
+ explicitPathsToArguments: { id: "$[0]", revision: "$[1]" },
578
+ singleArgumentUnchanged: false
579
+ },
580
+ ["_id", "revision"]
581
+ );
582
+ sideEffects?.onError?.(err);
583
+ throw transformedError;
584
+ }
585
+ }
586
+
587
+ // src/loyalty-v1-coupon-coupons.public.ts
588
+ function redeemPointsForCoupon3(httpClient) {
589
+ return (rewardId, options) => redeemPointsForCoupon2(
590
+ rewardId,
591
+ options,
592
+ // @ts-ignore
593
+ { httpClient }
594
+ );
595
+ }
596
+ function redeemCurrentMemberPointsForCoupon3(httpClient) {
597
+ return (rewardId) => redeemCurrentMemberPointsForCoupon2(
598
+ rewardId,
599
+ // @ts-ignore
600
+ { httpClient }
601
+ );
602
+ }
603
+ function getLoyaltyCoupon3(httpClient) {
604
+ return (loyaltyCouponId) => getLoyaltyCoupon2(
605
+ loyaltyCouponId,
606
+ // @ts-ignore
607
+ { httpClient }
608
+ );
609
+ }
610
+ function bulkGetLoyaltyCoupon3(httpClient) {
611
+ return (options) => bulkGetLoyaltyCoupon2(
612
+ options,
613
+ // @ts-ignore
614
+ { httpClient }
615
+ );
616
+ }
617
+ function getCurrentMemberCoupons3(httpClient) {
618
+ return () => getCurrentMemberCoupons2(
619
+ // @ts-ignore
620
+ { httpClient }
621
+ );
622
+ }
623
+ function queryLoyaltyCoupons2(httpClient) {
624
+ return () => queryLoyaltyCoupons(
625
+ // @ts-ignore
626
+ { httpClient }
627
+ );
628
+ }
629
+ function deleteLoyaltyCoupon3(httpClient) {
630
+ return (_id, revision) => deleteLoyaltyCoupon2(
631
+ _id,
632
+ revision,
633
+ // @ts-ignore
634
+ { httpClient }
635
+ );
636
+ }
637
+ var onCouponCreated = EventDefinition(
638
+ "wix.loyalty.v1.coupon_created",
639
+ true,
640
+ (event) => renameKeysFromRESTResponseToSDKResponse2(
641
+ transformPaths2(event, [
642
+ {
643
+ transformFn: transformRESTTimestampToSDKTimestamp2,
644
+ paths: [
645
+ { path: "entity.createdDate" },
646
+ { path: "entity.updatedDate" },
647
+ { path: "metadata.eventTime" }
648
+ ]
649
+ },
650
+ {
651
+ transformFn: transformRESTFloatToSDKFloat2,
652
+ paths: [
653
+ { path: "entity.couponReference.specification.moneyOffAmount" },
654
+ { path: "entity.couponReference.specification.percentOffRate" },
655
+ { path: "entity.couponReference.specification.fixedPriceAmount" },
656
+ { path: "entity.couponReference.specification.minimumSubtotal" }
657
+ ]
658
+ }
659
+ ])
660
+ )
661
+ )();
662
+ var onCouponDeleted = EventDefinition(
663
+ "wix.loyalty.v1.coupon_deleted",
664
+ true,
665
+ (event) => renameKeysFromRESTResponseToSDKResponse2(
666
+ transformPaths2(event, [
667
+ {
668
+ transformFn: transformRESTTimestampToSDKTimestamp2,
669
+ paths: [
670
+ { path: "undefined.createdDate" },
671
+ { path: "undefined.updatedDate" },
672
+ { path: "metadata.eventTime" }
673
+ ]
674
+ },
675
+ {
676
+ transformFn: transformRESTFloatToSDKFloat2,
677
+ paths: [
678
+ { path: "undefined.couponReference.specification.moneyOffAmount" },
679
+ { path: "undefined.couponReference.specification.percentOffRate" },
680
+ {
681
+ path: "undefined.couponReference.specification.fixedPriceAmount"
682
+ },
683
+ { path: "undefined.couponReference.specification.minimumSubtotal" }
684
+ ]
685
+ }
686
+ ])
687
+ )
688
+ )();
689
+
690
+ // src/loyalty-v1-coupon-coupons.context.ts
691
+ import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
692
+ import { createEventModule } from "@wix/sdk-runtime/event-definition-modules";
693
+ var redeemPointsForCoupon4 = /* @__PURE__ */ createRESTModule(redeemPointsForCoupon3);
694
+ var redeemCurrentMemberPointsForCoupon4 = /* @__PURE__ */ createRESTModule(redeemCurrentMemberPointsForCoupon3);
695
+ var getLoyaltyCoupon4 = /* @__PURE__ */ createRESTModule(getLoyaltyCoupon3);
696
+ var bulkGetLoyaltyCoupon4 = /* @__PURE__ */ createRESTModule(bulkGetLoyaltyCoupon3);
697
+ var getCurrentMemberCoupons4 = /* @__PURE__ */ createRESTModule(getCurrentMemberCoupons3);
698
+ var queryLoyaltyCoupons3 = /* @__PURE__ */ createRESTModule(queryLoyaltyCoupons2);
699
+ var deleteLoyaltyCoupon4 = /* @__PURE__ */ createRESTModule(deleteLoyaltyCoupon3);
700
+ var onCouponCreated2 = createEventModule(onCouponCreated);
701
+ var onCouponDeleted2 = createEventModule(onCouponDeleted);
702
+ export {
703
+ SortOrder,
704
+ Status,
705
+ Type,
706
+ WebhookIdentityType,
707
+ bulkGetLoyaltyCoupon4 as bulkGetLoyaltyCoupon,
708
+ deleteLoyaltyCoupon4 as deleteLoyaltyCoupon,
709
+ getCurrentMemberCoupons4 as getCurrentMemberCoupons,
710
+ getLoyaltyCoupon4 as getLoyaltyCoupon,
711
+ onCouponCreated2 as onCouponCreated,
712
+ onCouponDeleted2 as onCouponDeleted,
713
+ queryLoyaltyCoupons3 as queryLoyaltyCoupons,
714
+ redeemCurrentMemberPointsForCoupon4 as redeemCurrentMemberPointsForCoupon,
715
+ redeemPointsForCoupon4 as redeemPointsForCoupon
716
+ };
717
+ //# sourceMappingURL=index.mjs.map