@kiva/kv-shop 3.6.19 → 3.7.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.
- package/dist/index.d.ts +16 -0
- package/dist/index.js +26 -23
- package/dist/trackTransaction.js +56 -0
- package/dist/util/cookie.js +7 -7
- package/dist/util/parseSPCookie.js +19 -0
- package/package.json +2 -2
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
|
|
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
|
|
6
|
-
import { getCheckoutStatus as
|
|
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
|
|
9
|
-
import { executeOneTimeCheckout as I, executeOneTimeCheckoutForGivingFund as
|
|
10
|
-
import { getCheckoutTrackingData as
|
|
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 {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
26
|
-
|
|
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
|
-
|
|
33
|
+
Z as defaultPaymentTypes,
|
|
33
34
|
L as executeNewSubscriptionCheckout,
|
|
34
35
|
I as executeOneTimeCheckout,
|
|
35
|
-
|
|
36
|
+
M as executeOneTimeCheckoutForGivingFund,
|
|
36
37
|
r as getBasketID,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
$ as
|
|
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
|
+
};
|
package/dist/util/cookie.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
var
|
|
3
|
-
if (typeof document
|
|
4
|
-
return decodeURIComponent(((
|
|
5
|
-
}, c = (
|
|
6
|
-
typeof document
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"numeral": "2.x",
|
|
56
56
|
"vue": "3.x"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "900e0a9734710845b30b256154daaab0cd79cefc"
|
|
59
59
|
}
|