@wix/auto_sdk_loyalty_coupons 1.0.13 → 1.0.14

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 (130) hide show
  1. package/build/index.d.mts +101 -0
  2. package/build/index.d.ts +101 -0
  3. package/build/index.js +756 -0
  4. package/build/index.js.map +1 -0
  5. package/build/index.mjs +720 -0
  6. package/build/index.mjs.map +1 -0
  7. package/build/internal/index.d.mts +101 -0
  8. package/build/internal/index.d.ts +101 -0
  9. package/build/internal/index.js +756 -0
  10. package/build/internal/index.js.map +1 -0
  11. package/build/internal/index.mjs +720 -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-YZSAPFpG.d.mts} +62 -222
  14. package/build/internal/{es/src/loyalty-v1-coupon-coupons.universal.d.ts → loyalty-v1-coupon-coupons.universal-YZSAPFpG.d.ts} +62 -222
  15. package/build/internal/{cjs/src/loyalty-v1-coupon-coupons.types.d.ts → meta.d.mts} +64 -198
  16. package/build/{es/src/loyalty-v1-coupon-coupons.types.d.ts → internal/meta.d.ts} +64 -198
  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-YZSAPFpG.d.mts} +62 -222
  22. package/build/{es/src/loyalty-v1-coupon-coupons.universal.d.ts → loyalty-v1-coupon-coupons.universal-YZSAPFpG.d.ts} +62 -222
  23. package/build/{cjs/src/loyalty-v1-coupon-coupons.types.d.ts → meta.d.mts} +64 -198
  24. package/build/{internal/es/src/loyalty-v1-coupon-coupons.types.d.ts → meta.d.ts} +64 -198
  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 -372
  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/package.json +0 -3
  65. package/build/es/src/loyalty-v1-coupon-coupons.context.d.ts +0 -22
  66. package/build/es/src/loyalty-v1-coupon-coupons.context.js +0 -22
  67. package/build/es/src/loyalty-v1-coupon-coupons.context.js.map +0 -1
  68. package/build/es/src/loyalty-v1-coupon-coupons.http.d.ts +0 -43
  69. package/build/es/src/loyalty-v1-coupon-coupons.http.js +0 -379
  70. package/build/es/src/loyalty-v1-coupon-coupons.http.js.map +0 -1
  71. package/build/es/src/loyalty-v1-coupon-coupons.meta.d.ts +0 -23
  72. package/build/es/src/loyalty-v1-coupon-coupons.meta.js +0 -128
  73. package/build/es/src/loyalty-v1-coupon-coupons.meta.js.map +0 -1
  74. package/build/es/src/loyalty-v1-coupon-coupons.public.d.ts +0 -85
  75. package/build/es/src/loyalty-v1-coupon-coupons.public.js +0 -84
  76. package/build/es/src/loyalty-v1-coupon-coupons.public.js.map +0 -1
  77. package/build/es/src/loyalty-v1-coupon-coupons.types.js +0 -38
  78. package/build/es/src/loyalty-v1-coupon-coupons.types.js.map +0 -1
  79. package/build/es/src/loyalty-v1-coupon-coupons.universal.js +0 -339
  80. package/build/es/src/loyalty-v1-coupon-coupons.universal.js.map +0 -1
  81. package/build/internal/cjs/index.d.ts +0 -1
  82. package/build/internal/cjs/index.js +0 -18
  83. package/build/internal/cjs/index.js.map +0 -1
  84. package/build/internal/cjs/index.typings.d.ts +0 -1
  85. package/build/internal/cjs/index.typings.js +0 -18
  86. package/build/internal/cjs/index.typings.js.map +0 -1
  87. package/build/internal/cjs/meta.d.ts +0 -1
  88. package/build/internal/cjs/meta.js +0 -18
  89. package/build/internal/cjs/meta.js.map +0 -1
  90. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.context.d.ts +0 -22
  91. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.context.js +0 -29
  92. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.context.js.map +0 -1
  93. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.http.d.ts +0 -43
  94. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.http.js +0 -389
  95. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.http.js.map +0 -1
  96. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.meta.d.ts +0 -23
  97. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.meta.js +0 -161
  98. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.meta.js.map +0 -1
  99. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.public.d.ts +0 -85
  100. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.public.js +0 -98
  101. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.public.js.map +0 -1
  102. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.types.js +0 -41
  103. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.types.js.map +0 -1
  104. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.universal.js +0 -372
  105. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.universal.js.map +0 -1
  106. package/build/internal/es/index.d.ts +0 -1
  107. package/build/internal/es/index.js +0 -2
  108. package/build/internal/es/index.js.map +0 -1
  109. package/build/internal/es/index.typings.d.ts +0 -1
  110. package/build/internal/es/index.typings.js +0 -2
  111. package/build/internal/es/index.typings.js.map +0 -1
  112. package/build/internal/es/meta.d.ts +0 -1
  113. package/build/internal/es/meta.js +0 -2
  114. package/build/internal/es/meta.js.map +0 -1
  115. package/build/internal/es/src/loyalty-v1-coupon-coupons.context.d.ts +0 -22
  116. package/build/internal/es/src/loyalty-v1-coupon-coupons.context.js +0 -22
  117. package/build/internal/es/src/loyalty-v1-coupon-coupons.context.js.map +0 -1
  118. package/build/internal/es/src/loyalty-v1-coupon-coupons.http.d.ts +0 -43
  119. package/build/internal/es/src/loyalty-v1-coupon-coupons.http.js +0 -379
  120. package/build/internal/es/src/loyalty-v1-coupon-coupons.http.js.map +0 -1
  121. package/build/internal/es/src/loyalty-v1-coupon-coupons.meta.d.ts +0 -23
  122. package/build/internal/es/src/loyalty-v1-coupon-coupons.meta.js +0 -128
  123. package/build/internal/es/src/loyalty-v1-coupon-coupons.meta.js.map +0 -1
  124. package/build/internal/es/src/loyalty-v1-coupon-coupons.public.d.ts +0 -85
  125. package/build/internal/es/src/loyalty-v1-coupon-coupons.public.js +0 -84
  126. package/build/internal/es/src/loyalty-v1-coupon-coupons.public.js.map +0 -1
  127. package/build/internal/es/src/loyalty-v1-coupon-coupons.types.js +0 -38
  128. package/build/internal/es/src/loyalty-v1-coupon-coupons.types.js.map +0 -1
  129. package/build/internal/es/src/loyalty-v1-coupon-coupons.universal.js +0 -339
  130. package/build/internal/es/src/loyalty-v1-coupon-coupons.universal.js.map +0 -1
@@ -0,0 +1,720 @@
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 transformPaths3 } 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
+ import { transformPaths as transformPaths2 } from "@wix/sdk-runtime/transformations/transform-paths";
363
+ var Type = /* @__PURE__ */ ((Type2) => {
364
+ Type2["UNKNOWN"] = "UNKNOWN";
365
+ Type2["MONEY_OFF_AMOUNT"] = "MONEY_OFF_AMOUNT";
366
+ Type2["PERCENT_OFF_RATE"] = "PERCENT_OFF_RATE";
367
+ Type2["FREE_SHIPPING"] = "FREE_SHIPPING";
368
+ Type2["FIXED_PRICE_AMOUNT"] = "FIXED_PRICE_AMOUNT";
369
+ Type2["BUY_X_GET_Y"] = "BUY_X_GET_Y";
370
+ return Type2;
371
+ })(Type || {});
372
+ var Status = /* @__PURE__ */ ((Status2) => {
373
+ Status2["UNKNOWN"] = "UNKNOWN";
374
+ Status2["PENDING"] = "PENDING";
375
+ Status2["ACTIVE"] = "ACTIVE";
376
+ Status2["APPLIED"] = "APPLIED";
377
+ Status2["FAILED"] = "FAILED";
378
+ Status2["ARCHIVED"] = "ARCHIVED";
379
+ return Status2;
380
+ })(Status || {});
381
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
382
+ SortOrder2["ASC"] = "ASC";
383
+ SortOrder2["DESC"] = "DESC";
384
+ return SortOrder2;
385
+ })(SortOrder || {});
386
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
387
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
388
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
389
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
390
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
391
+ WebhookIdentityType2["APP"] = "APP";
392
+ return WebhookIdentityType2;
393
+ })(WebhookIdentityType || {});
394
+ async function redeemPointsForCoupon2(rewardId, options) {
395
+ const { httpClient, sideEffects } = arguments[2];
396
+ const payload = renameKeysFromSDKRequestToRESTRequest({
397
+ rewardId,
398
+ loyaltyAccountId: options?.loyaltyAccountId
399
+ });
400
+ const reqOpts = redeemPointsForCoupon(payload);
401
+ sideEffects?.onSiteCall?.();
402
+ try {
403
+ const result = await httpClient.request(reqOpts);
404
+ sideEffects?.onSuccess?.(result);
405
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
406
+ } catch (err) {
407
+ const transformedError = sdkTransformError(
408
+ err,
409
+ {
410
+ spreadPathsToArguments: {},
411
+ explicitPathsToArguments: {
412
+ rewardId: "$[0]",
413
+ loyaltyAccountId: "$[1].loyaltyAccountId"
414
+ },
415
+ singleArgumentUnchanged: false
416
+ },
417
+ ["rewardId", "options"]
418
+ );
419
+ sideEffects?.onError?.(err);
420
+ throw transformedError;
421
+ }
422
+ }
423
+ async function redeemCurrentMemberPointsForCoupon2(rewardId) {
424
+ const { httpClient, sideEffects } = arguments[1];
425
+ const payload = renameKeysFromSDKRequestToRESTRequest({ rewardId });
426
+ const reqOpts = redeemCurrentMemberPointsForCoupon(payload);
427
+ sideEffects?.onSiteCall?.();
428
+ try {
429
+ const result = await httpClient.request(reqOpts);
430
+ sideEffects?.onSuccess?.(result);
431
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
432
+ } catch (err) {
433
+ const transformedError = sdkTransformError(
434
+ err,
435
+ {
436
+ spreadPathsToArguments: {},
437
+ explicitPathsToArguments: { rewardId: "$[0]" },
438
+ singleArgumentUnchanged: false
439
+ },
440
+ ["rewardId"]
441
+ );
442
+ sideEffects?.onError?.(err);
443
+ throw transformedError;
444
+ }
445
+ }
446
+ async function getLoyaltyCoupon2(loyaltyCouponId) {
447
+ const { httpClient, sideEffects } = arguments[1];
448
+ const payload = renameKeysFromSDKRequestToRESTRequest({
449
+ loyaltyCouponId
450
+ });
451
+ const reqOpts = getLoyaltyCoupon(payload);
452
+ sideEffects?.onSiteCall?.();
453
+ try {
454
+ const result = await httpClient.request(reqOpts);
455
+ sideEffects?.onSuccess?.(result);
456
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.loyaltyCoupon;
457
+ } catch (err) {
458
+ const transformedError = sdkTransformError(
459
+ err,
460
+ {
461
+ spreadPathsToArguments: {},
462
+ explicitPathsToArguments: { loyaltyCouponId: "$[0]" },
463
+ singleArgumentUnchanged: false
464
+ },
465
+ ["loyaltyCouponId"]
466
+ );
467
+ sideEffects?.onError?.(err);
468
+ throw transformedError;
469
+ }
470
+ }
471
+ async function bulkGetLoyaltyCoupon2(options) {
472
+ const { httpClient, sideEffects } = arguments[1];
473
+ const payload = renameKeysFromSDKRequestToRESTRequest({
474
+ query: options?.query
475
+ });
476
+ const reqOpts = bulkGetLoyaltyCoupon(payload);
477
+ sideEffects?.onSiteCall?.();
478
+ try {
479
+ const result = await httpClient.request(reqOpts);
480
+ sideEffects?.onSuccess?.(result);
481
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
482
+ } catch (err) {
483
+ const transformedError = sdkTransformError(
484
+ err,
485
+ {
486
+ spreadPathsToArguments: {},
487
+ explicitPathsToArguments: { query: "$[0].query" },
488
+ singleArgumentUnchanged: false
489
+ },
490
+ ["options"]
491
+ );
492
+ sideEffects?.onError?.(err);
493
+ throw transformedError;
494
+ }
495
+ }
496
+ async function getCurrentMemberCoupons2() {
497
+ const { httpClient, sideEffects } = arguments[0];
498
+ const payload = renameKeysFromSDKRequestToRESTRequest({});
499
+ const reqOpts = getCurrentMemberCoupons(payload);
500
+ sideEffects?.onSiteCall?.();
501
+ try {
502
+ const result = await httpClient.request(reqOpts);
503
+ sideEffects?.onSuccess?.(result);
504
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
505
+ } catch (err) {
506
+ const transformedError = sdkTransformError(
507
+ err,
508
+ {
509
+ spreadPathsToArguments: {},
510
+ explicitPathsToArguments: {},
511
+ singleArgumentUnchanged: false
512
+ },
513
+ []
514
+ );
515
+ sideEffects?.onError?.(err);
516
+ throw transformedError;
517
+ }
518
+ }
519
+ function queryLoyaltyCoupons() {
520
+ const { httpClient, sideEffects } = arguments[0];
521
+ return queryBuilder({
522
+ func: async (payload) => {
523
+ const reqOpts = queryLoyaltyCoupon(payload);
524
+ sideEffects?.onSiteCall?.();
525
+ try {
526
+ const result = await httpClient.request(reqOpts);
527
+ sideEffects?.onSuccess?.(result);
528
+ return result;
529
+ } catch (err) {
530
+ sideEffects?.onError?.(err);
531
+ throw err;
532
+ }
533
+ },
534
+ requestTransformer: (query) => {
535
+ const args = [query, {}];
536
+ return renameKeysFromSDKRequestToRESTRequest({
537
+ ...args?.[1],
538
+ query: args?.[0]
539
+ });
540
+ },
541
+ responseTransformer: ({
542
+ data
543
+ }) => {
544
+ const transformedData = renameKeysFromRESTResponseToSDKResponse(
545
+ transformPaths2(data, [])
546
+ );
547
+ return {
548
+ items: transformedData?.loyaltyCoupons,
549
+ pagingMetadata: transformedData?.metadata
550
+ };
551
+ },
552
+ errorTransformer: (err) => {
553
+ const transformedError = sdkTransformError(err, {
554
+ spreadPathsToArguments: {},
555
+ explicitPathsToArguments: { query: "$[0]" },
556
+ singleArgumentUnchanged: false
557
+ });
558
+ throw transformedError;
559
+ },
560
+ pagingMethod: "CURSOR",
561
+ transformationPaths: {}
562
+ });
563
+ }
564
+ async function deleteLoyaltyCoupon2(_id, revision) {
565
+ const { httpClient, sideEffects } = arguments[2];
566
+ const payload = renameKeysFromSDKRequestToRESTRequest({
567
+ id: _id,
568
+ revision
569
+ });
570
+ const reqOpts = deleteLoyaltyCoupon(payload);
571
+ sideEffects?.onSiteCall?.();
572
+ try {
573
+ const result = await httpClient.request(reqOpts);
574
+ sideEffects?.onSuccess?.(result);
575
+ } catch (err) {
576
+ const transformedError = sdkTransformError(
577
+ err,
578
+ {
579
+ spreadPathsToArguments: {},
580
+ explicitPathsToArguments: { id: "$[0]", revision: "$[1]" },
581
+ singleArgumentUnchanged: false
582
+ },
583
+ ["_id", "revision"]
584
+ );
585
+ sideEffects?.onError?.(err);
586
+ throw transformedError;
587
+ }
588
+ }
589
+
590
+ // src/loyalty-v1-coupon-coupons.public.ts
591
+ function redeemPointsForCoupon3(httpClient) {
592
+ return (rewardId, options) => redeemPointsForCoupon2(
593
+ rewardId,
594
+ options,
595
+ // @ts-ignore
596
+ { httpClient }
597
+ );
598
+ }
599
+ function redeemCurrentMemberPointsForCoupon3(httpClient) {
600
+ return (rewardId) => redeemCurrentMemberPointsForCoupon2(
601
+ rewardId,
602
+ // @ts-ignore
603
+ { httpClient }
604
+ );
605
+ }
606
+ function getLoyaltyCoupon3(httpClient) {
607
+ return (loyaltyCouponId) => getLoyaltyCoupon2(
608
+ loyaltyCouponId,
609
+ // @ts-ignore
610
+ { httpClient }
611
+ );
612
+ }
613
+ function bulkGetLoyaltyCoupon3(httpClient) {
614
+ return (options) => bulkGetLoyaltyCoupon2(
615
+ options,
616
+ // @ts-ignore
617
+ { httpClient }
618
+ );
619
+ }
620
+ function getCurrentMemberCoupons3(httpClient) {
621
+ return () => getCurrentMemberCoupons2(
622
+ // @ts-ignore
623
+ { httpClient }
624
+ );
625
+ }
626
+ function queryLoyaltyCoupons2(httpClient) {
627
+ return () => queryLoyaltyCoupons(
628
+ // @ts-ignore
629
+ { httpClient }
630
+ );
631
+ }
632
+ function deleteLoyaltyCoupon3(httpClient) {
633
+ return (_id, revision) => deleteLoyaltyCoupon2(
634
+ _id,
635
+ revision,
636
+ // @ts-ignore
637
+ { httpClient }
638
+ );
639
+ }
640
+ var onCouponCreated = EventDefinition(
641
+ "wix.loyalty.v1.coupon_created",
642
+ true,
643
+ (event) => renameKeysFromRESTResponseToSDKResponse2(
644
+ transformPaths3(event, [
645
+ {
646
+ transformFn: transformRESTTimestampToSDKTimestamp2,
647
+ paths: [
648
+ { path: "entity.createdDate" },
649
+ { path: "entity.updatedDate" },
650
+ { path: "metadata.eventTime" }
651
+ ]
652
+ },
653
+ {
654
+ transformFn: transformRESTFloatToSDKFloat2,
655
+ paths: [
656
+ { path: "entity.couponReference.specification.moneyOffAmount" },
657
+ { path: "entity.couponReference.specification.percentOffRate" },
658
+ { path: "entity.couponReference.specification.fixedPriceAmount" },
659
+ { path: "entity.couponReference.specification.minimumSubtotal" }
660
+ ]
661
+ }
662
+ ])
663
+ )
664
+ )();
665
+ var onCouponDeleted = EventDefinition(
666
+ "wix.loyalty.v1.coupon_deleted",
667
+ true,
668
+ (event) => renameKeysFromRESTResponseToSDKResponse2(
669
+ transformPaths3(event, [
670
+ {
671
+ transformFn: transformRESTTimestampToSDKTimestamp2,
672
+ paths: [
673
+ { path: "undefined.createdDate" },
674
+ { path: "undefined.updatedDate" },
675
+ { path: "metadata.eventTime" }
676
+ ]
677
+ },
678
+ {
679
+ transformFn: transformRESTFloatToSDKFloat2,
680
+ paths: [
681
+ { path: "undefined.couponReference.specification.moneyOffAmount" },
682
+ { path: "undefined.couponReference.specification.percentOffRate" },
683
+ {
684
+ path: "undefined.couponReference.specification.fixedPriceAmount"
685
+ },
686
+ { path: "undefined.couponReference.specification.minimumSubtotal" }
687
+ ]
688
+ }
689
+ ])
690
+ )
691
+ )();
692
+
693
+ // src/loyalty-v1-coupon-coupons.context.ts
694
+ import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
695
+ import { createEventModule } from "@wix/sdk-runtime/event-definition-modules";
696
+ var redeemPointsForCoupon4 = /* @__PURE__ */ createRESTModule(redeemPointsForCoupon3);
697
+ var redeemCurrentMemberPointsForCoupon4 = /* @__PURE__ */ createRESTModule(redeemCurrentMemberPointsForCoupon3);
698
+ var getLoyaltyCoupon4 = /* @__PURE__ */ createRESTModule(getLoyaltyCoupon3);
699
+ var bulkGetLoyaltyCoupon4 = /* @__PURE__ */ createRESTModule(bulkGetLoyaltyCoupon3);
700
+ var getCurrentMemberCoupons4 = /* @__PURE__ */ createRESTModule(getCurrentMemberCoupons3);
701
+ var queryLoyaltyCoupons3 = /* @__PURE__ */ createRESTModule(queryLoyaltyCoupons2);
702
+ var deleteLoyaltyCoupon4 = /* @__PURE__ */ createRESTModule(deleteLoyaltyCoupon3);
703
+ var onCouponCreated2 = createEventModule(onCouponCreated);
704
+ var onCouponDeleted2 = createEventModule(onCouponDeleted);
705
+ export {
706
+ SortOrder,
707
+ Status,
708
+ Type,
709
+ WebhookIdentityType,
710
+ bulkGetLoyaltyCoupon4 as bulkGetLoyaltyCoupon,
711
+ deleteLoyaltyCoupon4 as deleteLoyaltyCoupon,
712
+ getCurrentMemberCoupons4 as getCurrentMemberCoupons,
713
+ getLoyaltyCoupon4 as getLoyaltyCoupon,
714
+ onCouponCreated2 as onCouponCreated,
715
+ onCouponDeleted2 as onCouponDeleted,
716
+ queryLoyaltyCoupons3 as queryLoyaltyCoupons,
717
+ redeemCurrentMemberPointsForCoupon4 as redeemCurrentMemberPointsForCoupon,
718
+ redeemPointsForCoupon4 as redeemPointsForCoupon
719
+ };
720
+ //# sourceMappingURL=index.mjs.map