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