@kiva/kv-shop 3.6.19 → 3.7.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.
package/dist/index.d.ts CHANGED
@@ -360,6 +360,22 @@ export declare interface SubscriptionCheckoutOptions {
360
360
  paymentMethod: PaymentMethodPayload;
361
361
  }
362
362
 
363
+ export declare interface TrackTransactionData {
364
+ shop: {
365
+ id: string;
366
+ trackTransaction: boolean;
367
+ } | null;
368
+ }
369
+
370
+ export declare function trackTransactionEvent({ apollo, transactionId, }: TrackTransactionOptions): Promise<boolean>;
371
+
372
+ export declare const trackTransactionMutation: DocumentNode;
373
+
374
+ export declare interface TrackTransactionOptions {
375
+ apollo: ApolloClient<any>;
376
+ transactionId: number;
377
+ }
378
+
363
379
  export declare function useBraintreeDropIn(key?: string): DropInWrapper;
364
380
 
365
381
  export declare type ValetInviter = {
package/dist/index.js CHANGED
@@ -1,57 +1,60 @@
1
1
  import { createBasket as o, getBasketID as r, hasBasketExpired as a, setBasketID as i } from "./basket.js";
2
- import { applyKivaCredit as u, applyPromoCredit as m, removeKivaCredit as s, removePromoCredit as c } from "./basketCredits.js";
2
+ import { applyKivaCredit as n, applyPromoCredit as u, removeKivaCredit as s, removePromoCredit as c } from "./basketCredits.js";
3
3
  import { KivaCardDeliveryTypeEnum as d, addKivaCardToBasket as f, setTipDonation as k } from "./basketItems.js";
4
4
  import { basketTotalsQuery as l, watchBasketTotals as h } from "./basketTotals.js";
5
- import { VerificationState as v, isBasketVerified as g } from "./basketVerification.js";
6
- import { getCheckoutStatus as T, pollForFinishedCheckout as y } from "./checkoutStatus.js";
5
+ import { VerificationState as v, isBasketVerified as T } from "./basketVerification.js";
6
+ import { getCheckoutStatus as S, pollForFinishedCheckout as y } from "./checkoutStatus.js";
7
7
  import { addGivingFund as F, addGivingFundMutation as D } from "./givingFunds.js";
8
- import { getPromoFromBasket as K } from "./managedAccount.js";
9
- import { executeOneTimeCheckout as I, executeOneTimeCheckoutForGivingFund as b } from "./oneTimeCheckout.js";
10
- import { getCheckoutTrackingData as G, getFTDStatus as M, getReceiptItems as Q, getReceiptTotals as O } from "./receipt.js";
8
+ import { getPromoFromBasket as E } from "./managedAccount.js";
9
+ import { executeOneTimeCheckout as I, executeOneTimeCheckoutForGivingFund as M } from "./oneTimeCheckout.js";
10
+ import { getCheckoutTrackingData as w, getFTDStatus as G, getReceiptItems as Q, getReceiptTotals as O } from "./receipt.js";
11
11
  import { ShopError as V, parseShopError as N } from "./shopError.js";
12
12
  import { callShopMutation as q, callShopQuery as z, watchShopQuery as A } from "./shopQueries.js";
13
13
  import { checkSubscriptionStatus as J, executeNewSubscriptionCheckout as L } from "./subscriptionCheckout.js";
14
- import { defaultPaymentTypes as W, getClientToken as X, default as Y } from "./useBraintreeDropIn.js";
15
- import { validatePreCheckout as _, validatePreCheckoutMutation as $ } from "./validatePreCheckout.js";
16
- import { default as te } from "./components/KvPaymentSelect.js";
14
+ import { trackTransactionEvent as W, trackTransactionMutation as X } from "./trackTransaction.js";
15
+ import { defaultPaymentTypes as Z, getClientToken as _, default as $ } from "./useBraintreeDropIn.js";
16
+ import { validatePreCheckout as te, validatePreCheckoutMutation as oe } from "./validatePreCheckout.js";
17
+ import { default as ae } from "./components/KvPaymentSelect.js";
17
18
  export {
18
19
  d as KivaCardDeliveryTypeEnum,
19
- te as KvPaymentSelect,
20
+ ae as KvPaymentSelect,
20
21
  V as ShopError,
21
22
  v as VerificationState,
22
23
  F as addGivingFund,
23
24
  D as addGivingFundMutation,
24
25
  f as addKivaCardToBasket,
25
- u as applyKivaCredit,
26
- m as applyPromoCredit,
26
+ n as applyKivaCredit,
27
+ u as applyPromoCredit,
27
28
  l as basketTotalsQuery,
28
29
  q as callShopMutation,
29
30
  z as callShopQuery,
30
31
  J as checkSubscriptionStatus,
31
32
  o as createBasket,
32
- W as defaultPaymentTypes,
33
+ Z as defaultPaymentTypes,
33
34
  L as executeNewSubscriptionCheckout,
34
35
  I as executeOneTimeCheckout,
35
- b as executeOneTimeCheckoutForGivingFund,
36
+ M as executeOneTimeCheckoutForGivingFund,
36
37
  r as getBasketID,
37
- T as getCheckoutStatus,
38
- G as getCheckoutTrackingData,
39
- X as getClientToken,
40
- M as getFTDStatus,
41
- K as getPromoFromBasket,
38
+ S as getCheckoutStatus,
39
+ w as getCheckoutTrackingData,
40
+ _ as getClientToken,
41
+ G as getFTDStatus,
42
+ E as getPromoFromBasket,
42
43
  Q as getReceiptItems,
43
44
  O as getReceiptTotals,
44
45
  a as hasBasketExpired,
45
- g as isBasketVerified,
46
+ T as isBasketVerified,
46
47
  N as parseShopError,
47
48
  y as pollForFinishedCheckout,
48
49
  s as removeKivaCredit,
49
50
  c as removePromoCredit,
50
51
  i as setBasketID,
51
52
  k as setTipDonation,
52
- Y as useBraintreeDropIn,
53
- _ as validatePreCheckout,
54
- $ as validatePreCheckoutMutation,
53
+ W as trackTransactionEvent,
54
+ X as trackTransactionMutation,
55
+ $ as useBraintreeDropIn,
56
+ te as validatePreCheckout,
57
+ oe as validatePreCheckoutMutation,
55
58
  h as watchBasketTotals,
56
59
  A as watchShopQuery
57
60
  };
@@ -0,0 +1,56 @@
1
+ import { gql as s } from "@apollo/client/core";
2
+ import { callShopMutation as c } from "./shopQueries.js";
3
+ import { getVisitorID as e } from "./util/visitorId.js";
4
+ import m from "./util/parseSPCookie.js";
5
+ const p = s`
6
+ mutation trackTransaction(
7
+ $campaign: String,
8
+ $campaignContent: String,
9
+ $medium: String,
10
+ $snowplowUserId: String,
11
+ $snowplowSessionId: String,
12
+ $source: String,
13
+ $transactionId: Int!,
14
+ $visitorId: String
15
+ ) {
16
+ shop {
17
+ id
18
+ trackTransaction(
19
+ campaign: $campaign
20
+ campaignContent: $campaignContent
21
+ medium: $medium
22
+ snowplowUserId: $snowplowUserId
23
+ snowplowSessionId: $snowplowSessionId
24
+ source: $source
25
+ transactionId: $transactionId
26
+ visitorId: $visitorId
27
+ )
28
+ }
29
+ }
30
+ `;
31
+ async function w({
32
+ apollo: i,
33
+ transactionId: o
34
+ }) {
35
+ var t;
36
+ if (!o)
37
+ return !1;
38
+ const { snowplowUserId: r, snowplowSessionId: a } = m(), n = await c(i, {
39
+ mutation: p,
40
+ variables: {
41
+ campaign: null,
42
+ campaignContent: null,
43
+ medium: null,
44
+ snowplowSessionId: a,
45
+ snowplowUserId: r,
46
+ source: null,
47
+ transactionId: o,
48
+ visitorId: e() || null
49
+ }
50
+ }, 0);
51
+ return !!((t = n == null ? void 0 : n.shop) != null && t.trackTransaction);
52
+ }
53
+ export {
54
+ w as trackTransactionEvent,
55
+ p as trackTransactionMutation
56
+ };
@@ -1,11 +1,11 @@
1
- const n = (e) => {
2
- var o;
3
- if (typeof document !== void 0)
4
- return decodeURIComponent(((o = document.cookie.match(`(^|;)\\s*${e}\\s*=\\s*([^;]+)`)) == null ? void 0 : o.pop()) || "");
5
- }, c = (e, o, t = "") => {
6
- typeof document !== void 0 && (document.cookie = `${e}=${encodeURIComponent(o)};${t}`);
1
+ const t = (o) => {
2
+ var e;
3
+ if (typeof document < "u")
4
+ return decodeURIComponent(((e = document.cookie.match(`(^|;)\\s*${o}\\s*=\\s*([^;]+)`)) == null ? void 0 : e.pop()) || "");
5
+ }, c = (o, e, n = "") => {
6
+ typeof document < "u" && (document.cookie = `${o}=${encodeURIComponent(e)};${n}`);
7
7
  };
8
8
  export {
9
- n as getCookieValue,
9
+ t as getCookieValue,
10
10
  c as setCookieValue
11
11
  };
@@ -0,0 +1,19 @@
1
+ import { getCookieValue as i } from "./cookie.js";
2
+ const t = () => typeof document > "u" ? null : document.cookie.split(";").map((o) => o.trim().split("=")[0]).find((o) => o && o.indexOf("_sp_id") === 0) || null;
3
+ function p() {
4
+ const s = t(), e = {
5
+ snowplowUserId: null,
6
+ snowplowSessionId: null
7
+ };
8
+ if (!s)
9
+ return e;
10
+ const o = i(s);
11
+ if (!o)
12
+ return e;
13
+ const n = (o == null ? void 0 : o.split(".")) ?? [];
14
+ return n.length > 0 && (e.snowplowUserId = (n == null ? void 0 : n[0]) ?? null, e.snowplowSessionId = (n == null ? void 0 : n[n.length - 1]) ?? null), e;
15
+ }
16
+ export {
17
+ p as default,
18
+ t as findSnowplowCookieName
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-shop",
3
- "version": "3.6.19",
3
+ "version": "3.7.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -26,7 +26,7 @@
26
26
  "devDependencies": {
27
27
  "@apollo/client": "^3.13.1",
28
28
  "@kiva/kv-analytics": "^1.3.0",
29
- "@kiva/kv-components": "^6.65.1",
29
+ "@kiva/kv-components": "^6.66.0",
30
30
  "@kiva/vite-plugin-vue-lib-css": "^2.0.0",
31
31
  "@types/braintree-web-drop-in": "^1.39.3",
32
32
  "@types/jest": "^29.5.14",
@@ -55,5 +55,5 @@
55
55
  "numeral": "2.x",
56
56
  "vue": "3.x"
57
57
  },
58
- "gitHead": "745926420b7f23d6d719f15a7faec84d0086dbad"
58
+ "gitHead": "151b1d58b96a8e43a0e3096651504d57890e91ab"
59
59
  }