@kiva/kv-shop 2.0.12 → 2.1.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.
@@ -176,25 +176,27 @@ 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
192
193
  price
193
194
  isTip
195
+ metadata
194
196
  }
195
197
  }
196
198
  }`,
197
- variables: { price: donationAmount }
199
+ variables: { price: donationAmount, metadata }
198
200
  });
199
201
  return data?.shop?.updateDonation;
200
202
  }
@@ -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-2KZ4SI6Y.js";
4
4
  import "./chunk-IOZ5ERDX.js";
5
5
  import "./chunk-FBF4WMN6.js";
6
6
  import "./chunk-4ODZGLWK.js";
@@ -5,25 +5,27 @@ 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
21
22
  price
22
23
  isTip
24
+ metadata
23
25
  }
24
26
  }
25
27
  }`,
26
- variables: { price: donationAmount }
28
+ variables: { price: donationAmount, metadata }
27
29
  });
28
30
  return data?.shop?.updateDonation;
29
31
  }
package/dist/index.cjs CHANGED
@@ -362,25 +362,27 @@ 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
378
379
  price
379
380
  isTip
381
+ metadata
380
382
  }
381
383
  }
382
384
  }`,
383
- variables: { price: donationAmount }
385
+ variables: { price: donationAmount, metadata }
384
386
  });
385
387
  return data?.shop?.updateDonation;
386
388
  }
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-2KZ4SI6Y.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.12",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -40,7 +40,7 @@
40
40
  "dependencies": {
41
41
  "@apollo/client": "^3.7.14",
42
42
  "@kiva/kv-analytics": "^1.3.0",
43
- "@kiva/kv-components": "^5.3.5",
43
+ "@kiva/kv-components": "^5.3.6",
44
44
  "@types/braintree-web-drop-in": "^1.34.2",
45
45
  "braintree-web-drop-in": "^1.37.0",
46
46
  "numeral": "^2.0.6",
@@ -55,5 +55,5 @@
55
55
  "optional": true
56
56
  }
57
57
  },
58
- "gitHead": "edf2d18c4c65660427738f7ddfa8bb1ae0e71ddb"
58
+ "gitHead": "b4e89f78f9fc6309e0cf5bf36dc8bbca16273358"
59
59
  }