@kiva/kv-shop 2.0.13 → 2.1.1

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.
@@ -176,16 +176,17 @@ async function callShopMutation(apollo, options, maxretries = 2) {
176
176
  }
177
177
 
178
178
  // src/basketItems.ts
179
- async function setTipDonation({ amount, apollo }) {
179
+ async function setTipDonation({ amount, apollo, metadata }) {
180
180
  const donationAmount = (0, import_numeral.default)(amount).format("0.00");
181
181
  const data = await callShopMutation(apollo, {
182
182
  awaitRefetchQueries: true,
183
- mutation: import_core2.gql`mutation setTipDonation($price: Money!, $basketId: String) {
183
+ mutation: import_core2.gql`mutation setTipDonation($price: Money!, $basketId: String, $metadata: String) {
184
184
  shop (basketId: $basketId) {
185
185
  id
186
186
  updateDonation (donation: {
187
187
  price: $price,
188
- isTip: true
188
+ isTip: true,
189
+ metadata: $metadata,
189
190
  })
190
191
  {
191
192
  id
@@ -194,7 +195,7 @@ async function setTipDonation({ amount, apollo }) {
194
195
  }
195
196
  }
196
197
  }`,
197
- variables: { price: donationAmount }
198
+ variables: { price: donationAmount, metadata }
198
199
  });
199
200
  return data?.shop?.updateDonation;
200
201
  }
@@ -2,6 +2,7 @@ import { ApolloClient } from '@apollo/client/core/core.cjs';
2
2
 
3
3
  interface SetTipDonationOptions {
4
4
  amount: string | number;
5
+ metadata?: string | null;
5
6
  apollo: ApolloClient<any>;
6
7
  }
7
8
  interface SetTipDonationData {
@@ -11,13 +12,15 @@ interface SetTipDonationData {
11
12
  id: string;
12
13
  price: string;
13
14
  isTip: boolean;
15
+ metadata: string | null;
14
16
  } | null;
15
17
  } | null;
16
18
  }
17
- declare function setTipDonation({ amount, apollo }: SetTipDonationOptions): Promise<{
19
+ declare function setTipDonation({ amount, apollo, metadata }: SetTipDonationOptions): Promise<{
18
20
  id: string;
19
21
  price: string;
20
22
  isTip: boolean;
23
+ metadata: string | null;
21
24
  }>;
22
25
 
23
26
  export { SetTipDonationData, SetTipDonationOptions, setTipDonation };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  setTipDonation
3
- } from "./chunk-X33I6HOI.js";
3
+ } from "./chunk-Z7JRY3QE.js";
4
4
  import "./chunk-IOZ5ERDX.js";
5
5
  import "./chunk-FBF4WMN6.js";
6
6
  import "./chunk-4ODZGLWK.js";
@@ -5,16 +5,17 @@ import {
5
5
  // src/basketItems.ts
6
6
  import { gql } from "@apollo/client/core/core.cjs";
7
7
  import numeral from "numeral";
8
- async function setTipDonation({ amount, apollo }) {
8
+ async function setTipDonation({ amount, apollo, metadata }) {
9
9
  const donationAmount = numeral(amount).format("0.00");
10
10
  const data = await callShopMutation(apollo, {
11
11
  awaitRefetchQueries: true,
12
- mutation: gql`mutation setTipDonation($price: Money!, $basketId: String) {
12
+ mutation: gql`mutation setTipDonation($price: Money!, $basketId: String, $metadata: String) {
13
13
  shop (basketId: $basketId) {
14
14
  id
15
15
  updateDonation (donation: {
16
16
  price: $price,
17
- isTip: true
17
+ isTip: true,
18
+ metadata: $metadata,
18
19
  })
19
20
  {
20
21
  id
@@ -23,7 +24,7 @@ async function setTipDonation({ amount, apollo }) {
23
24
  }
24
25
  }
25
26
  }`,
26
- variables: { price: donationAmount }
27
+ variables: { price: donationAmount, metadata }
27
28
  });
28
29
  return data?.shop?.updateDonation;
29
30
  }
package/dist/index.cjs CHANGED
@@ -362,16 +362,17 @@ async function removePromoCredit(apollo, options) {
362
362
  // src/basketItems.ts
363
363
  var import_core3 = require("@apollo/client/core/core.cjs");
364
364
  var import_numeral = __toESM(require("numeral"), 1);
365
- async function setTipDonation({ amount, apollo }) {
365
+ async function setTipDonation({ amount, apollo, metadata }) {
366
366
  const donationAmount = (0, import_numeral.default)(amount).format("0.00");
367
367
  const data = await callShopMutation(apollo, {
368
368
  awaitRefetchQueries: true,
369
- mutation: import_core3.gql`mutation setTipDonation($price: Money!, $basketId: String) {
369
+ mutation: import_core3.gql`mutation setTipDonation($price: Money!, $basketId: String, $metadata: String) {
370
370
  shop (basketId: $basketId) {
371
371
  id
372
372
  updateDonation (donation: {
373
373
  price: $price,
374
- isTip: true
374
+ isTip: true,
375
+ metadata: $metadata,
375
376
  })
376
377
  {
377
378
  id
@@ -380,7 +381,7 @@ async function setTipDonation({ amount, apollo }) {
380
381
  }
381
382
  }
382
383
  }`,
383
- variables: { price: donationAmount }
384
+ variables: { price: donationAmount, metadata }
384
385
  });
385
386
  return data?.shop?.updateDonation;
386
387
  }
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-UJXHTR43.js";
29
29
  import {
30
30
  setTipDonation
31
- } from "./chunk-X33I6HOI.js";
31
+ } from "./chunk-Z7JRY3QE.js";
32
32
  import {
33
33
  basketTotalsQuery,
34
34
  watchBasketTotals
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-shop",
3
- "version": "2.0.13",
3
+ "version": "2.1.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -55,5 +55,5 @@
55
55
  "optional": true
56
56
  }
57
57
  },
58
- "gitHead": "652c8676b14247fe6c5fc084ef705781e3f73b6f"
58
+ "gitHead": "9f08afe48309c4551736e59fc9d0a80d1c046b06"
59
59
  }