@wix/auto_sdk_loyalty_coupons 1.0.13 → 1.0.15

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 (119) hide show
  1. package/build/cjs/index.d.ts +101 -1
  2. package/build/cjs/index.js +753 -15
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/{internal/cjs/src/loyalty-v1-coupon-coupons.universal.d.ts → cjs/loyalty-v1-coupon-coupons.universal-YZSAPFpG.d.ts} +62 -222
  5. package/build/cjs/meta.d.ts +478 -1
  6. package/build/cjs/meta.js +512 -15
  7. package/build/cjs/meta.js.map +1 -1
  8. package/build/es/index.d.mts +101 -0
  9. package/build/es/index.mjs +720 -0
  10. package/build/es/index.mjs.map +1 -0
  11. package/build/{internal/es/src/loyalty-v1-coupon-coupons.universal.d.ts → es/loyalty-v1-coupon-coupons.universal-YZSAPFpG.d.mts} +62 -222
  12. package/build/{internal/cjs/src/loyalty-v1-coupon-coupons.types.d.ts → es/meta.d.mts} +64 -198
  13. package/build/es/meta.mjs +482 -0
  14. package/build/es/meta.mjs.map +1 -0
  15. package/build/internal/cjs/index.d.ts +101 -1
  16. package/build/internal/cjs/index.js +753 -15
  17. package/build/internal/cjs/index.js.map +1 -1
  18. package/build/{cjs/src/loyalty-v1-coupon-coupons.universal.d.ts → internal/cjs/loyalty-v1-coupon-coupons.universal-YZSAPFpG.d.ts} +62 -222
  19. package/build/internal/cjs/meta.d.ts +478 -1
  20. package/build/internal/cjs/meta.js +512 -15
  21. package/build/internal/cjs/meta.js.map +1 -1
  22. package/build/internal/es/index.d.mts +101 -0
  23. package/build/internal/es/index.mjs +720 -0
  24. package/build/internal/es/index.mjs.map +1 -0
  25. package/build/{es/src/loyalty-v1-coupon-coupons.universal.d.ts → internal/es/loyalty-v1-coupon-coupons.universal-YZSAPFpG.d.mts} +62 -222
  26. package/build/{cjs/src/loyalty-v1-coupon-coupons.types.d.ts → internal/es/meta.d.mts} +64 -198
  27. package/build/internal/es/meta.mjs +482 -0
  28. package/build/internal/es/meta.mjs.map +1 -0
  29. package/package.json +10 -9
  30. package/build/cjs/index.typings.d.ts +0 -1
  31. package/build/cjs/index.typings.js +0 -18
  32. package/build/cjs/index.typings.js.map +0 -1
  33. package/build/cjs/src/loyalty-v1-coupon-coupons.context.d.ts +0 -22
  34. package/build/cjs/src/loyalty-v1-coupon-coupons.context.js +0 -29
  35. package/build/cjs/src/loyalty-v1-coupon-coupons.context.js.map +0 -1
  36. package/build/cjs/src/loyalty-v1-coupon-coupons.http.d.ts +0 -43
  37. package/build/cjs/src/loyalty-v1-coupon-coupons.http.js +0 -389
  38. package/build/cjs/src/loyalty-v1-coupon-coupons.http.js.map +0 -1
  39. package/build/cjs/src/loyalty-v1-coupon-coupons.meta.d.ts +0 -23
  40. package/build/cjs/src/loyalty-v1-coupon-coupons.meta.js +0 -161
  41. package/build/cjs/src/loyalty-v1-coupon-coupons.meta.js.map +0 -1
  42. package/build/cjs/src/loyalty-v1-coupon-coupons.public.d.ts +0 -85
  43. package/build/cjs/src/loyalty-v1-coupon-coupons.public.js +0 -98
  44. package/build/cjs/src/loyalty-v1-coupon-coupons.public.js.map +0 -1
  45. package/build/cjs/src/loyalty-v1-coupon-coupons.types.js +0 -41
  46. package/build/cjs/src/loyalty-v1-coupon-coupons.types.js.map +0 -1
  47. package/build/cjs/src/loyalty-v1-coupon-coupons.universal.js +0 -372
  48. package/build/cjs/src/loyalty-v1-coupon-coupons.universal.js.map +0 -1
  49. package/build/es/index.d.ts +0 -1
  50. package/build/es/index.js +0 -2
  51. package/build/es/index.js.map +0 -1
  52. package/build/es/index.typings.d.ts +0 -1
  53. package/build/es/index.typings.js +0 -2
  54. package/build/es/index.typings.js.map +0 -1
  55. package/build/es/meta.d.ts +0 -1
  56. package/build/es/meta.js +0 -2
  57. package/build/es/meta.js.map +0 -1
  58. package/build/es/src/loyalty-v1-coupon-coupons.context.d.ts +0 -22
  59. package/build/es/src/loyalty-v1-coupon-coupons.context.js +0 -22
  60. package/build/es/src/loyalty-v1-coupon-coupons.context.js.map +0 -1
  61. package/build/es/src/loyalty-v1-coupon-coupons.http.d.ts +0 -43
  62. package/build/es/src/loyalty-v1-coupon-coupons.http.js +0 -379
  63. package/build/es/src/loyalty-v1-coupon-coupons.http.js.map +0 -1
  64. package/build/es/src/loyalty-v1-coupon-coupons.meta.d.ts +0 -23
  65. package/build/es/src/loyalty-v1-coupon-coupons.meta.js +0 -128
  66. package/build/es/src/loyalty-v1-coupon-coupons.meta.js.map +0 -1
  67. package/build/es/src/loyalty-v1-coupon-coupons.public.d.ts +0 -85
  68. package/build/es/src/loyalty-v1-coupon-coupons.public.js +0 -84
  69. package/build/es/src/loyalty-v1-coupon-coupons.public.js.map +0 -1
  70. package/build/es/src/loyalty-v1-coupon-coupons.types.d.ts +0 -612
  71. package/build/es/src/loyalty-v1-coupon-coupons.types.js +0 -38
  72. package/build/es/src/loyalty-v1-coupon-coupons.types.js.map +0 -1
  73. package/build/es/src/loyalty-v1-coupon-coupons.universal.js +0 -339
  74. package/build/es/src/loyalty-v1-coupon-coupons.universal.js.map +0 -1
  75. package/build/internal/cjs/index.typings.d.ts +0 -1
  76. package/build/internal/cjs/index.typings.js +0 -18
  77. package/build/internal/cjs/index.typings.js.map +0 -1
  78. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.context.d.ts +0 -22
  79. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.context.js +0 -29
  80. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.context.js.map +0 -1
  81. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.http.d.ts +0 -43
  82. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.http.js +0 -389
  83. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.http.js.map +0 -1
  84. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.meta.d.ts +0 -23
  85. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.meta.js +0 -161
  86. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.meta.js.map +0 -1
  87. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.public.d.ts +0 -85
  88. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.public.js +0 -98
  89. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.public.js.map +0 -1
  90. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.types.js +0 -41
  91. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.types.js.map +0 -1
  92. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.universal.js +0 -372
  93. package/build/internal/cjs/src/loyalty-v1-coupon-coupons.universal.js.map +0 -1
  94. package/build/internal/es/index.d.ts +0 -1
  95. package/build/internal/es/index.js +0 -2
  96. package/build/internal/es/index.js.map +0 -1
  97. package/build/internal/es/index.typings.d.ts +0 -1
  98. package/build/internal/es/index.typings.js +0 -2
  99. package/build/internal/es/index.typings.js.map +0 -1
  100. package/build/internal/es/meta.d.ts +0 -1
  101. package/build/internal/es/meta.js +0 -2
  102. package/build/internal/es/meta.js.map +0 -1
  103. package/build/internal/es/src/loyalty-v1-coupon-coupons.context.d.ts +0 -22
  104. package/build/internal/es/src/loyalty-v1-coupon-coupons.context.js +0 -22
  105. package/build/internal/es/src/loyalty-v1-coupon-coupons.context.js.map +0 -1
  106. package/build/internal/es/src/loyalty-v1-coupon-coupons.http.d.ts +0 -43
  107. package/build/internal/es/src/loyalty-v1-coupon-coupons.http.js +0 -379
  108. package/build/internal/es/src/loyalty-v1-coupon-coupons.http.js.map +0 -1
  109. package/build/internal/es/src/loyalty-v1-coupon-coupons.meta.d.ts +0 -23
  110. package/build/internal/es/src/loyalty-v1-coupon-coupons.meta.js +0 -128
  111. package/build/internal/es/src/loyalty-v1-coupon-coupons.meta.js.map +0 -1
  112. package/build/internal/es/src/loyalty-v1-coupon-coupons.public.d.ts +0 -85
  113. package/build/internal/es/src/loyalty-v1-coupon-coupons.public.js +0 -84
  114. package/build/internal/es/src/loyalty-v1-coupon-coupons.public.js.map +0 -1
  115. package/build/internal/es/src/loyalty-v1-coupon-coupons.types.d.ts +0 -612
  116. package/build/internal/es/src/loyalty-v1-coupon-coupons.types.js +0 -38
  117. package/build/internal/es/src/loyalty-v1-coupon-coupons.types.js.map +0 -1
  118. package/build/internal/es/src/loyalty-v1-coupon-coupons.universal.js +0 -339
  119. package/build/internal/es/src/loyalty-v1-coupon-coupons.universal.js.map +0 -1
@@ -1,18 +1,756 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
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 });
15
9
  };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./src/loyalty-v1-coupon-coupons.context.js"), exports);
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_paths3 = 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 import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
398
+ var Type = /* @__PURE__ */ ((Type2) => {
399
+ Type2["UNKNOWN"] = "UNKNOWN";
400
+ Type2["MONEY_OFF_AMOUNT"] = "MONEY_OFF_AMOUNT";
401
+ Type2["PERCENT_OFF_RATE"] = "PERCENT_OFF_RATE";
402
+ Type2["FREE_SHIPPING"] = "FREE_SHIPPING";
403
+ Type2["FIXED_PRICE_AMOUNT"] = "FIXED_PRICE_AMOUNT";
404
+ Type2["BUY_X_GET_Y"] = "BUY_X_GET_Y";
405
+ return Type2;
406
+ })(Type || {});
407
+ var Status = /* @__PURE__ */ ((Status2) => {
408
+ Status2["UNKNOWN"] = "UNKNOWN";
409
+ Status2["PENDING"] = "PENDING";
410
+ Status2["ACTIVE"] = "ACTIVE";
411
+ Status2["APPLIED"] = "APPLIED";
412
+ Status2["FAILED"] = "FAILED";
413
+ Status2["ARCHIVED"] = "ARCHIVED";
414
+ return Status2;
415
+ })(Status || {});
416
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
417
+ SortOrder2["ASC"] = "ASC";
418
+ SortOrder2["DESC"] = "DESC";
419
+ return SortOrder2;
420
+ })(SortOrder || {});
421
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
422
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
423
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
424
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
425
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
426
+ WebhookIdentityType2["APP"] = "APP";
427
+ return WebhookIdentityType2;
428
+ })(WebhookIdentityType || {});
429
+ async function redeemPointsForCoupon2(rewardId, options) {
430
+ const { httpClient, sideEffects } = arguments[2];
431
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
432
+ rewardId,
433
+ loyaltyAccountId: options?.loyaltyAccountId
434
+ });
435
+ const reqOpts = redeemPointsForCoupon(payload);
436
+ sideEffects?.onSiteCall?.();
437
+ try {
438
+ const result = await httpClient.request(reqOpts);
439
+ sideEffects?.onSuccess?.(result);
440
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
441
+ } catch (err) {
442
+ const transformedError = (0, import_transform_error.transformError)(
443
+ err,
444
+ {
445
+ spreadPathsToArguments: {},
446
+ explicitPathsToArguments: {
447
+ rewardId: "$[0]",
448
+ loyaltyAccountId: "$[1].loyaltyAccountId"
449
+ },
450
+ singleArgumentUnchanged: false
451
+ },
452
+ ["rewardId", "options"]
453
+ );
454
+ sideEffects?.onError?.(err);
455
+ throw transformedError;
456
+ }
457
+ }
458
+ async function redeemCurrentMemberPointsForCoupon2(rewardId) {
459
+ const { httpClient, sideEffects } = arguments[1];
460
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({ rewardId });
461
+ const reqOpts = redeemCurrentMemberPointsForCoupon(payload);
462
+ sideEffects?.onSiteCall?.();
463
+ try {
464
+ const result = await httpClient.request(reqOpts);
465
+ sideEffects?.onSuccess?.(result);
466
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
467
+ } catch (err) {
468
+ const transformedError = (0, import_transform_error.transformError)(
469
+ err,
470
+ {
471
+ spreadPathsToArguments: {},
472
+ explicitPathsToArguments: { rewardId: "$[0]" },
473
+ singleArgumentUnchanged: false
474
+ },
475
+ ["rewardId"]
476
+ );
477
+ sideEffects?.onError?.(err);
478
+ throw transformedError;
479
+ }
480
+ }
481
+ async function getLoyaltyCoupon2(loyaltyCouponId) {
482
+ const { httpClient, sideEffects } = arguments[1];
483
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
484
+ loyaltyCouponId
485
+ });
486
+ const reqOpts = getLoyaltyCoupon(payload);
487
+ sideEffects?.onSiteCall?.();
488
+ try {
489
+ const result = await httpClient.request(reqOpts);
490
+ sideEffects?.onSuccess?.(result);
491
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.loyaltyCoupon;
492
+ } catch (err) {
493
+ const transformedError = (0, import_transform_error.transformError)(
494
+ err,
495
+ {
496
+ spreadPathsToArguments: {},
497
+ explicitPathsToArguments: { loyaltyCouponId: "$[0]" },
498
+ singleArgumentUnchanged: false
499
+ },
500
+ ["loyaltyCouponId"]
501
+ );
502
+ sideEffects?.onError?.(err);
503
+ throw transformedError;
504
+ }
505
+ }
506
+ async function bulkGetLoyaltyCoupon2(options) {
507
+ const { httpClient, sideEffects } = arguments[1];
508
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
509
+ query: options?.query
510
+ });
511
+ const reqOpts = bulkGetLoyaltyCoupon(payload);
512
+ sideEffects?.onSiteCall?.();
513
+ try {
514
+ const result = await httpClient.request(reqOpts);
515
+ sideEffects?.onSuccess?.(result);
516
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
517
+ } catch (err) {
518
+ const transformedError = (0, import_transform_error.transformError)(
519
+ err,
520
+ {
521
+ spreadPathsToArguments: {},
522
+ explicitPathsToArguments: { query: "$[0].query" },
523
+ singleArgumentUnchanged: false
524
+ },
525
+ ["options"]
526
+ );
527
+ sideEffects?.onError?.(err);
528
+ throw transformedError;
529
+ }
530
+ }
531
+ async function getCurrentMemberCoupons2() {
532
+ const { httpClient, sideEffects } = arguments[0];
533
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({});
534
+ const reqOpts = getCurrentMemberCoupons(payload);
535
+ sideEffects?.onSiteCall?.();
536
+ try {
537
+ const result = await httpClient.request(reqOpts);
538
+ sideEffects?.onSuccess?.(result);
539
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
540
+ } catch (err) {
541
+ const transformedError = (0, import_transform_error.transformError)(
542
+ err,
543
+ {
544
+ spreadPathsToArguments: {},
545
+ explicitPathsToArguments: {},
546
+ singleArgumentUnchanged: false
547
+ },
548
+ []
549
+ );
550
+ sideEffects?.onError?.(err);
551
+ throw transformedError;
552
+ }
553
+ }
554
+ function queryLoyaltyCoupons() {
555
+ const { httpClient, sideEffects } = arguments[0];
556
+ return (0, import_query_builder.queryBuilder)({
557
+ func: async (payload) => {
558
+ const reqOpts = queryLoyaltyCoupon(payload);
559
+ sideEffects?.onSiteCall?.();
560
+ try {
561
+ const result = await httpClient.request(reqOpts);
562
+ sideEffects?.onSuccess?.(result);
563
+ return result;
564
+ } catch (err) {
565
+ sideEffects?.onError?.(err);
566
+ throw err;
567
+ }
568
+ },
569
+ requestTransformer: (query) => {
570
+ const args = [query, {}];
571
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
572
+ ...args?.[1],
573
+ query: args?.[0]
574
+ });
575
+ },
576
+ responseTransformer: ({
577
+ data
578
+ }) => {
579
+ const transformedData = (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
580
+ (0, import_transform_paths2.transformPaths)(data, [])
581
+ );
582
+ return {
583
+ items: transformedData?.loyaltyCoupons,
584
+ pagingMetadata: transformedData?.metadata
585
+ };
586
+ },
587
+ errorTransformer: (err) => {
588
+ const transformedError = (0, import_transform_error.transformError)(err, {
589
+ spreadPathsToArguments: {},
590
+ explicitPathsToArguments: { query: "$[0]" },
591
+ singleArgumentUnchanged: false
592
+ });
593
+ throw transformedError;
594
+ },
595
+ pagingMethod: "CURSOR",
596
+ transformationPaths: {}
597
+ });
598
+ }
599
+ async function deleteLoyaltyCoupon2(_id, revision) {
600
+ const { httpClient, sideEffects } = arguments[2];
601
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
602
+ id: _id,
603
+ revision
604
+ });
605
+ const reqOpts = deleteLoyaltyCoupon(payload);
606
+ sideEffects?.onSiteCall?.();
607
+ try {
608
+ const result = await httpClient.request(reqOpts);
609
+ sideEffects?.onSuccess?.(result);
610
+ } catch (err) {
611
+ const transformedError = (0, import_transform_error.transformError)(
612
+ err,
613
+ {
614
+ spreadPathsToArguments: {},
615
+ explicitPathsToArguments: { id: "$[0]", revision: "$[1]" },
616
+ singleArgumentUnchanged: false
617
+ },
618
+ ["_id", "revision"]
619
+ );
620
+ sideEffects?.onError?.(err);
621
+ throw transformedError;
622
+ }
623
+ }
624
+
625
+ // src/loyalty-v1-coupon-coupons.public.ts
626
+ function redeemPointsForCoupon3(httpClient) {
627
+ return (rewardId, options) => redeemPointsForCoupon2(
628
+ rewardId,
629
+ options,
630
+ // @ts-ignore
631
+ { httpClient }
632
+ );
633
+ }
634
+ function redeemCurrentMemberPointsForCoupon3(httpClient) {
635
+ return (rewardId) => redeemCurrentMemberPointsForCoupon2(
636
+ rewardId,
637
+ // @ts-ignore
638
+ { httpClient }
639
+ );
640
+ }
641
+ function getLoyaltyCoupon3(httpClient) {
642
+ return (loyaltyCouponId) => getLoyaltyCoupon2(
643
+ loyaltyCouponId,
644
+ // @ts-ignore
645
+ { httpClient }
646
+ );
647
+ }
648
+ function bulkGetLoyaltyCoupon3(httpClient) {
649
+ return (options) => bulkGetLoyaltyCoupon2(
650
+ options,
651
+ // @ts-ignore
652
+ { httpClient }
653
+ );
654
+ }
655
+ function getCurrentMemberCoupons3(httpClient) {
656
+ return () => getCurrentMemberCoupons2(
657
+ // @ts-ignore
658
+ { httpClient }
659
+ );
660
+ }
661
+ function queryLoyaltyCoupons2(httpClient) {
662
+ return () => queryLoyaltyCoupons(
663
+ // @ts-ignore
664
+ { httpClient }
665
+ );
666
+ }
667
+ function deleteLoyaltyCoupon3(httpClient) {
668
+ return (_id, revision) => deleteLoyaltyCoupon2(
669
+ _id,
670
+ revision,
671
+ // @ts-ignore
672
+ { httpClient }
673
+ );
674
+ }
675
+ var onCouponCreated = (0, import_sdk_types.EventDefinition)(
676
+ "wix.loyalty.v1.coupon_created",
677
+ true,
678
+ (event) => (0, import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)(
679
+ (0, import_transform_paths3.transformPaths)(event, [
680
+ {
681
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
682
+ paths: [
683
+ { path: "entity.createdDate" },
684
+ { path: "entity.updatedDate" },
685
+ { path: "metadata.eventTime" }
686
+ ]
687
+ },
688
+ {
689
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
690
+ paths: [
691
+ { path: "entity.couponReference.specification.moneyOffAmount" },
692
+ { path: "entity.couponReference.specification.percentOffRate" },
693
+ { path: "entity.couponReference.specification.fixedPriceAmount" },
694
+ { path: "entity.couponReference.specification.minimumSubtotal" }
695
+ ]
696
+ }
697
+ ])
698
+ )
699
+ )();
700
+ var onCouponDeleted = (0, import_sdk_types.EventDefinition)(
701
+ "wix.loyalty.v1.coupon_deleted",
702
+ true,
703
+ (event) => (0, import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)(
704
+ (0, import_transform_paths3.transformPaths)(event, [
705
+ {
706
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
707
+ paths: [
708
+ { path: "undefined.createdDate" },
709
+ { path: "undefined.updatedDate" },
710
+ { path: "metadata.eventTime" }
711
+ ]
712
+ },
713
+ {
714
+ transformFn: import_float2.transformRESTFloatToSDKFloat,
715
+ paths: [
716
+ { path: "undefined.couponReference.specification.moneyOffAmount" },
717
+ { path: "undefined.couponReference.specification.percentOffRate" },
718
+ {
719
+ path: "undefined.couponReference.specification.fixedPriceAmount"
720
+ },
721
+ { path: "undefined.couponReference.specification.minimumSubtotal" }
722
+ ]
723
+ }
724
+ ])
725
+ )
726
+ )();
727
+
728
+ // src/loyalty-v1-coupon-coupons.context.ts
729
+ var import_rest_modules3 = require("@wix/sdk-runtime/rest-modules");
730
+ var import_event_definition_modules = require("@wix/sdk-runtime/event-definition-modules");
731
+ var redeemPointsForCoupon4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(redeemPointsForCoupon3);
732
+ var redeemCurrentMemberPointsForCoupon4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(redeemCurrentMemberPointsForCoupon3);
733
+ var getLoyaltyCoupon4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getLoyaltyCoupon3);
734
+ var bulkGetLoyaltyCoupon4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(bulkGetLoyaltyCoupon3);
735
+ var getCurrentMemberCoupons4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getCurrentMemberCoupons3);
736
+ var queryLoyaltyCoupons3 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(queryLoyaltyCoupons2);
737
+ var deleteLoyaltyCoupon4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(deleteLoyaltyCoupon3);
738
+ var onCouponCreated2 = (0, import_event_definition_modules.createEventModule)(onCouponCreated);
739
+ var onCouponDeleted2 = (0, import_event_definition_modules.createEventModule)(onCouponDeleted);
740
+ // Annotate the CommonJS export names for ESM import in node:
741
+ 0 && (module.exports = {
742
+ SortOrder,
743
+ Status,
744
+ Type,
745
+ WebhookIdentityType,
746
+ bulkGetLoyaltyCoupon,
747
+ deleteLoyaltyCoupon,
748
+ getCurrentMemberCoupons,
749
+ getLoyaltyCoupon,
750
+ onCouponCreated,
751
+ onCouponDeleted,
752
+ queryLoyaltyCoupons,
753
+ redeemCurrentMemberPointsForCoupon,
754
+ redeemPointsForCoupon
755
+ });
18
756
  //# sourceMappingURL=index.js.map