@kiva/kv-shop 1.11.6 → 1.12.0

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.
@@ -193,8 +193,15 @@ async function removeKivaCredit(apollo) {
193
193
  return !!data?.shop?.removeCreditByType;
194
194
  }
195
195
  async function applyPromoCredit(apollo, options) {
196
- if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
197
- return Promise.resolve(false);
196
+ if (!options?.variables?.creditType || !options?.variables?.redemptionCode) {
197
+ return Promise.resolve({
198
+ errors: [
199
+ {
200
+ message: "Missing required parameter.",
201
+ extensions: { code: "upc.missing_parameter" }
202
+ }
203
+ ]
204
+ });
198
205
  }
199
206
  const data = await callShopMutation(apollo, {
200
207
  awaitRefetchQueries: true,
@@ -211,7 +218,7 @@ async function applyPromoCredit(apollo, options) {
211
218
  }`,
212
219
  variables: { ...options?.variables }
213
220
  });
214
- return !!data?.shop?.addCreditByType;
221
+ return data;
215
222
  }
216
223
  async function removePromoCredit(apollo, options) {
217
224
  if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
@@ -20,7 +20,7 @@ interface ApplyPromoCreditData {
20
20
  addCreditByType: boolean;
21
21
  } | null;
22
22
  }
23
- declare function applyPromoCredit(apollo: ApolloClient<any>, options: MutationOptions<any>): Promise<boolean>;
23
+ declare function applyPromoCredit(apollo: ApolloClient<any>, options: MutationOptions<any>): Promise<any>;
24
24
  interface RemovePromoCreditData {
25
25
  shop: {
26
26
  id: string;
@@ -3,7 +3,7 @@ import {
3
3
  applyPromoCredit,
4
4
  removeKivaCredit,
5
5
  removePromoCredit
6
- } from "./chunk-L4MZ7J46.js";
6
+ } from "./chunk-7DXT5Y64.js";
7
7
  import "./chunk-CBJJUUVR.js";
8
8
  import "./chunk-2NC7LGGO.js";
9
9
  import "./chunk-4ODZGLWK.js";
@@ -29,8 +29,15 @@ async function removeKivaCredit(apollo) {
29
29
  return !!data?.shop?.removeCreditByType;
30
30
  }
31
31
  async function applyPromoCredit(apollo, options) {
32
- if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
33
- return Promise.resolve(false);
32
+ if (!options?.variables?.creditType || !options?.variables?.redemptionCode) {
33
+ return Promise.resolve({
34
+ errors: [
35
+ {
36
+ message: "Missing required parameter.",
37
+ extensions: { code: "upc.missing_parameter" }
38
+ }
39
+ ]
40
+ });
34
41
  }
35
42
  const data = await callShopMutation(apollo, {
36
43
  awaitRefetchQueries: true,
@@ -47,7 +54,7 @@ async function applyPromoCredit(apollo, options) {
47
54
  }`,
48
55
  variables: { ...options?.variables }
49
56
  });
50
- return !!data?.shop?.addCreditByType;
57
+ return data;
51
58
  }
52
59
  async function removePromoCredit(apollo, options) {
53
60
  if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
package/dist/index.cjs CHANGED
@@ -310,8 +310,15 @@ async function removeKivaCredit(apollo) {
310
310
  return !!data?.shop?.removeCreditByType;
311
311
  }
312
312
  async function applyPromoCredit(apollo, options) {
313
- if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
314
- return Promise.resolve(false);
313
+ if (!options?.variables?.creditType || !options?.variables?.redemptionCode) {
314
+ return Promise.resolve({
315
+ errors: [
316
+ {
317
+ message: "Missing required parameter.",
318
+ extensions: { code: "upc.missing_parameter" }
319
+ }
320
+ ]
321
+ });
315
322
  }
316
323
  const data = await callShopMutation(apollo, {
317
324
  awaitRefetchQueries: true,
@@ -328,7 +335,7 @@ async function applyPromoCredit(apollo, options) {
328
335
  }`,
329
336
  variables: { ...options?.variables }
330
337
  });
331
- return !!data?.shop?.addCreditByType;
338
+ return data;
332
339
  }
333
340
  async function removePromoCredit(apollo, options) {
334
341
  if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  applyPromoCredit,
26
26
  removeKivaCredit,
27
27
  removePromoCredit
28
- } from "./chunk-L4MZ7J46.js";
28
+ } from "./chunk-7DXT5Y64.js";
29
29
  import {
30
30
  setTipDonation
31
31
  } from "./chunk-AI6E33YE.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-shop",
3
- "version": "1.11.6",
3
+ "version": "1.12.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -54,5 +54,5 @@
54
54
  "optional": true
55
55
  }
56
56
  },
57
- "gitHead": "c12a030cc21acf02392d153306085556615a47ae"
57
+ "gitHead": "886f6809b116f6d2510bb2562bc84c6e1e0220d0"
58
58
  }