@kiva/kv-shop 1.11.0 → 1.11.2
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/basketCredits.cjs +14 -4
- package/dist/basketCredits.d.ts +3 -3
- package/dist/basketCredits.js +1 -1
- package/dist/{chunk-2KFUFQOY.js → chunk-L4MZ7J46.js} +14 -4
- package/dist/chunk-ZQBTUCXB.js +72 -0
- package/dist/index.cjs +96 -19
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/dist/managedAccount.cjs +6 -2
- package/dist/managedAccount.d.ts +12 -8
- package/dist/managedAccount.js +3 -63
- package/package.json +3 -3
package/dist/basketCredits.cjs
CHANGED
|
@@ -192,9 +192,13 @@ async function removeKivaCredit(apollo) {
|
|
|
192
192
|
});
|
|
193
193
|
return !!data?.shop?.removeCreditByType;
|
|
194
194
|
}
|
|
195
|
-
async function applyPromoCredit(apollo) {
|
|
195
|
+
async function applyPromoCredit(apollo, options) {
|
|
196
|
+
if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
|
|
197
|
+
return Promise.resolve(false);
|
|
198
|
+
}
|
|
196
199
|
const data = await callShopMutation(apollo, {
|
|
197
200
|
awaitRefetchQueries: true,
|
|
201
|
+
fetchPolicy: options?.fetchPolicy ?? "network-only",
|
|
198
202
|
mutation: import_core2.gql`mutation applyPromoCredit(
|
|
199
203
|
$basketId: String,
|
|
200
204
|
$creditType: CreditTypeEnum!,
|
|
@@ -204,13 +208,18 @@ async function applyPromoCredit(apollo) {
|
|
|
204
208
|
id
|
|
205
209
|
addCreditByType(creditType: $creditType, redemptionCode: $redemptionCode)
|
|
206
210
|
}
|
|
207
|
-
}
|
|
211
|
+
}`,
|
|
212
|
+
variables: { ...options?.variables }
|
|
208
213
|
});
|
|
209
214
|
return !!data?.shop?.addCreditByType;
|
|
210
215
|
}
|
|
211
|
-
async function removePromoCredit(apollo) {
|
|
216
|
+
async function removePromoCredit(apollo, options) {
|
|
217
|
+
if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
|
|
218
|
+
return Promise.resolve(false);
|
|
219
|
+
}
|
|
212
220
|
const data = await callShopMutation(apollo, {
|
|
213
221
|
awaitRefetchQueries: true,
|
|
222
|
+
fetchPolicy: options?.fetchPolicy ?? "network-only",
|
|
214
223
|
mutation: import_core2.gql`mutation removePromoCredit(
|
|
215
224
|
$basketId: String,
|
|
216
225
|
$creditType: CreditTypeEnum!,
|
|
@@ -220,7 +229,8 @@ async function removePromoCredit(apollo) {
|
|
|
220
229
|
id
|
|
221
230
|
removeCreditByType(creditType: $creditType, redemptionCode: $redemptionCode)
|
|
222
231
|
}
|
|
223
|
-
}
|
|
232
|
+
}`,
|
|
233
|
+
variables: { ...options?.variables }
|
|
224
234
|
});
|
|
225
235
|
return !!data?.shop?.removeCreditByType;
|
|
226
236
|
}
|
package/dist/basketCredits.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApolloClient } from '@apollo/client/core';
|
|
1
|
+
import { ApolloClient, MutationOptions } from '@apollo/client/core';
|
|
2
2
|
|
|
3
3
|
interface ApplyKivaCreditData {
|
|
4
4
|
shop: {
|
|
@@ -20,13 +20,13 @@ interface ApplyPromoCreditData {
|
|
|
20
20
|
addCreditByType: boolean;
|
|
21
21
|
} | null;
|
|
22
22
|
}
|
|
23
|
-
declare function applyPromoCredit(apollo: ApolloClient<any>): Promise<boolean>;
|
|
23
|
+
declare function applyPromoCredit(apollo: ApolloClient<any>, options: MutationOptions<any>): Promise<boolean>;
|
|
24
24
|
interface RemovePromoCreditData {
|
|
25
25
|
shop: {
|
|
26
26
|
id: string;
|
|
27
27
|
removeCreditByType: boolean;
|
|
28
28
|
} | null;
|
|
29
29
|
}
|
|
30
|
-
declare function removePromoCredit(apollo: ApolloClient<any>): Promise<boolean>;
|
|
30
|
+
declare function removePromoCredit(apollo: ApolloClient<any>, options: MutationOptions<any>): Promise<boolean>;
|
|
31
31
|
|
|
32
32
|
export { ApplyKivaCreditData, ApplyPromoCreditData, RemoveKivaCreditData, RemovePromoCreditData, applyKivaCredit, applyPromoCredit, removeKivaCredit, removePromoCredit };
|
package/dist/basketCredits.js
CHANGED
|
@@ -28,9 +28,13 @@ async function removeKivaCredit(apollo) {
|
|
|
28
28
|
});
|
|
29
29
|
return !!data?.shop?.removeCreditByType;
|
|
30
30
|
}
|
|
31
|
-
async function applyPromoCredit(apollo) {
|
|
31
|
+
async function applyPromoCredit(apollo, options) {
|
|
32
|
+
if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
|
|
33
|
+
return Promise.resolve(false);
|
|
34
|
+
}
|
|
32
35
|
const data = await callShopMutation(apollo, {
|
|
33
36
|
awaitRefetchQueries: true,
|
|
37
|
+
fetchPolicy: options?.fetchPolicy ?? "network-only",
|
|
34
38
|
mutation: gql`mutation applyPromoCredit(
|
|
35
39
|
$basketId: String,
|
|
36
40
|
$creditType: CreditTypeEnum!,
|
|
@@ -40,13 +44,18 @@ async function applyPromoCredit(apollo) {
|
|
|
40
44
|
id
|
|
41
45
|
addCreditByType(creditType: $creditType, redemptionCode: $redemptionCode)
|
|
42
46
|
}
|
|
43
|
-
}
|
|
47
|
+
}`,
|
|
48
|
+
variables: { ...options?.variables }
|
|
44
49
|
});
|
|
45
50
|
return !!data?.shop?.addCreditByType;
|
|
46
51
|
}
|
|
47
|
-
async function removePromoCredit(apollo) {
|
|
52
|
+
async function removePromoCredit(apollo, options) {
|
|
53
|
+
if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
|
|
54
|
+
return Promise.resolve(false);
|
|
55
|
+
}
|
|
48
56
|
const data = await callShopMutation(apollo, {
|
|
49
57
|
awaitRefetchQueries: true,
|
|
58
|
+
fetchPolicy: options?.fetchPolicy ?? "network-only",
|
|
50
59
|
mutation: gql`mutation removePromoCredit(
|
|
51
60
|
$basketId: String,
|
|
52
61
|
$creditType: CreditTypeEnum!,
|
|
@@ -56,7 +65,8 @@ async function removePromoCredit(apollo) {
|
|
|
56
65
|
id
|
|
57
66
|
removeCreditByType(creditType: $creditType, redemptionCode: $redemptionCode)
|
|
58
67
|
}
|
|
59
|
-
}
|
|
68
|
+
}`,
|
|
69
|
+
variables: { ...options?.variables }
|
|
60
70
|
});
|
|
61
71
|
return !!data?.shop?.removeCreditByType;
|
|
62
72
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
callShopQuery
|
|
3
|
+
} from "./chunk-CBJJUUVR.js";
|
|
4
|
+
|
|
5
|
+
// src/managedAccount.ts
|
|
6
|
+
import { gql } from "@apollo/client/core";
|
|
7
|
+
async function getPromoFromBasket(apollo, options) {
|
|
8
|
+
if (!options?.variables?.promoFundId && !options?.variables?.basketId) {
|
|
9
|
+
return Promise.resolve({ error: "promoFundId or basketId variable required" });
|
|
10
|
+
}
|
|
11
|
+
const data = await callShopQuery(apollo, {
|
|
12
|
+
variables: { ...options?.variables },
|
|
13
|
+
query: gql`
|
|
14
|
+
query promoCampaign($basketId: String, $promoFundId: String) {
|
|
15
|
+
shop (basketId: $basketId) {
|
|
16
|
+
id
|
|
17
|
+
promoCampaign (promoFundId: $promoFundId) {
|
|
18
|
+
promoFund {
|
|
19
|
+
id
|
|
20
|
+
displayName
|
|
21
|
+
displayDescription
|
|
22
|
+
promoPrice
|
|
23
|
+
}
|
|
24
|
+
promoGroup {
|
|
25
|
+
id
|
|
26
|
+
type
|
|
27
|
+
teamId
|
|
28
|
+
}
|
|
29
|
+
managedAccount {
|
|
30
|
+
managementType
|
|
31
|
+
audience
|
|
32
|
+
allowDonations
|
|
33
|
+
sendKivaNewsletter
|
|
34
|
+
id
|
|
35
|
+
isEmployee
|
|
36
|
+
formId
|
|
37
|
+
pageId
|
|
38
|
+
loanSearchCriteria {
|
|
39
|
+
filters {
|
|
40
|
+
cityState
|
|
41
|
+
country
|
|
42
|
+
currencyLossPossible
|
|
43
|
+
dafEligible
|
|
44
|
+
distributionModel
|
|
45
|
+
status
|
|
46
|
+
excludeNonRated
|
|
47
|
+
expiringSoon
|
|
48
|
+
gender
|
|
49
|
+
hasResearchScore
|
|
50
|
+
isGroup
|
|
51
|
+
lenderFavorite
|
|
52
|
+
loanLimit
|
|
53
|
+
isMatched
|
|
54
|
+
sector
|
|
55
|
+
loanTags
|
|
56
|
+
theme
|
|
57
|
+
}
|
|
58
|
+
sortBy
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`,
|
|
65
|
+
fetchPolicy: options?.fetchPolicy ?? "network-only"
|
|
66
|
+
}, 0);
|
|
67
|
+
return data;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
getPromoFromBasket
|
|
72
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -46,6 +46,7 @@ __export(src_exports, {
|
|
|
46
46
|
getCheckoutTrackingData: () => getCheckoutTrackingData,
|
|
47
47
|
getClientToken: () => getClientToken,
|
|
48
48
|
getFTDStatus: () => getFTDStatus,
|
|
49
|
+
getPromoFromBasket: () => getPromoFromBasket,
|
|
49
50
|
getReceiptItems: () => getReceiptItems,
|
|
50
51
|
getReceiptTotals: () => getReceiptTotals,
|
|
51
52
|
hasBasketExpired: () => hasBasketExpired,
|
|
@@ -308,9 +309,13 @@ async function removeKivaCredit(apollo) {
|
|
|
308
309
|
});
|
|
309
310
|
return !!data?.shop?.removeCreditByType;
|
|
310
311
|
}
|
|
311
|
-
async function applyPromoCredit(apollo) {
|
|
312
|
+
async function applyPromoCredit(apollo, options) {
|
|
313
|
+
if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
|
|
314
|
+
return Promise.resolve(false);
|
|
315
|
+
}
|
|
312
316
|
const data = await callShopMutation(apollo, {
|
|
313
317
|
awaitRefetchQueries: true,
|
|
318
|
+
fetchPolicy: options?.fetchPolicy ?? "network-only",
|
|
314
319
|
mutation: import_core2.gql`mutation applyPromoCredit(
|
|
315
320
|
$basketId: String,
|
|
316
321
|
$creditType: CreditTypeEnum!,
|
|
@@ -320,13 +325,18 @@ async function applyPromoCredit(apollo) {
|
|
|
320
325
|
id
|
|
321
326
|
addCreditByType(creditType: $creditType, redemptionCode: $redemptionCode)
|
|
322
327
|
}
|
|
323
|
-
}
|
|
328
|
+
}`,
|
|
329
|
+
variables: { ...options?.variables }
|
|
324
330
|
});
|
|
325
331
|
return !!data?.shop?.addCreditByType;
|
|
326
332
|
}
|
|
327
|
-
async function removePromoCredit(apollo) {
|
|
333
|
+
async function removePromoCredit(apollo, options) {
|
|
334
|
+
if (!options?.variables?.creditType && !options?.variables?.redemptionCode) {
|
|
335
|
+
return Promise.resolve(false);
|
|
336
|
+
}
|
|
328
337
|
const data = await callShopMutation(apollo, {
|
|
329
338
|
awaitRefetchQueries: true,
|
|
339
|
+
fetchPolicy: options?.fetchPolicy ?? "network-only",
|
|
330
340
|
mutation: import_core2.gql`mutation removePromoCredit(
|
|
331
341
|
$basketId: String,
|
|
332
342
|
$creditType: CreditTypeEnum!,
|
|
@@ -336,7 +346,8 @@ async function removePromoCredit(apollo) {
|
|
|
336
346
|
id
|
|
337
347
|
removeCreditByType(creditType: $creditType, redemptionCode: $redemptionCode)
|
|
338
348
|
}
|
|
339
|
-
}
|
|
349
|
+
}`,
|
|
350
|
+
variables: { ...options?.variables }
|
|
340
351
|
});
|
|
341
352
|
return !!data?.shop?.removeCreditByType;
|
|
342
353
|
}
|
|
@@ -493,14 +504,79 @@ async function pollForFinishedCheckout({
|
|
|
493
504
|
);
|
|
494
505
|
}
|
|
495
506
|
|
|
507
|
+
// src/managedAccount.ts
|
|
508
|
+
var import_core6 = require("@apollo/client/core");
|
|
509
|
+
async function getPromoFromBasket(apollo, options) {
|
|
510
|
+
if (!options?.variables?.promoFundId && !options?.variables?.basketId) {
|
|
511
|
+
return Promise.resolve({ error: "promoFundId or basketId variable required" });
|
|
512
|
+
}
|
|
513
|
+
const data = await callShopQuery(apollo, {
|
|
514
|
+
variables: { ...options?.variables },
|
|
515
|
+
query: import_core6.gql`
|
|
516
|
+
query promoCampaign($basketId: String, $promoFundId: String) {
|
|
517
|
+
shop (basketId: $basketId) {
|
|
518
|
+
id
|
|
519
|
+
promoCampaign (promoFundId: $promoFundId) {
|
|
520
|
+
promoFund {
|
|
521
|
+
id
|
|
522
|
+
displayName
|
|
523
|
+
displayDescription
|
|
524
|
+
promoPrice
|
|
525
|
+
}
|
|
526
|
+
promoGroup {
|
|
527
|
+
id
|
|
528
|
+
type
|
|
529
|
+
teamId
|
|
530
|
+
}
|
|
531
|
+
managedAccount {
|
|
532
|
+
managementType
|
|
533
|
+
audience
|
|
534
|
+
allowDonations
|
|
535
|
+
sendKivaNewsletter
|
|
536
|
+
id
|
|
537
|
+
isEmployee
|
|
538
|
+
formId
|
|
539
|
+
pageId
|
|
540
|
+
loanSearchCriteria {
|
|
541
|
+
filters {
|
|
542
|
+
cityState
|
|
543
|
+
country
|
|
544
|
+
currencyLossPossible
|
|
545
|
+
dafEligible
|
|
546
|
+
distributionModel
|
|
547
|
+
status
|
|
548
|
+
excludeNonRated
|
|
549
|
+
expiringSoon
|
|
550
|
+
gender
|
|
551
|
+
hasResearchScore
|
|
552
|
+
isGroup
|
|
553
|
+
lenderFavorite
|
|
554
|
+
loanLimit
|
|
555
|
+
isMatched
|
|
556
|
+
sector
|
|
557
|
+
loanTags
|
|
558
|
+
theme
|
|
559
|
+
}
|
|
560
|
+
sortBy
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
`,
|
|
567
|
+
fetchPolicy: options?.fetchPolicy ?? "network-only"
|
|
568
|
+
}, 0);
|
|
569
|
+
return data;
|
|
570
|
+
}
|
|
571
|
+
|
|
496
572
|
// src/oneTimeCheckout.ts
|
|
497
|
-
var
|
|
573
|
+
var import_core9 = require("@apollo/client/core");
|
|
498
574
|
var import_kv_analytics = require("@kiva/kv-analytics");
|
|
499
575
|
var import_numeral2 = __toESM(require("numeral"), 1);
|
|
500
576
|
|
|
501
577
|
// src/validatePreCheckout.ts
|
|
502
|
-
var
|
|
503
|
-
var validatePreCheckoutMutation =
|
|
578
|
+
var import_core7 = require("@apollo/client/core");
|
|
579
|
+
var validatePreCheckoutMutation = import_core7.gql`
|
|
504
580
|
mutation validatePreCheckout(
|
|
505
581
|
$basketId: String,
|
|
506
582
|
$email: String,
|
|
@@ -549,10 +625,10 @@ function redirectTo(href) {
|
|
|
549
625
|
}
|
|
550
626
|
|
|
551
627
|
// src/receipt.ts
|
|
552
|
-
var
|
|
628
|
+
var import_core8 = require("@apollo/client/core");
|
|
553
629
|
async function getFTDStatus(apollo) {
|
|
554
630
|
const result = await apollo.query({
|
|
555
|
-
query:
|
|
631
|
+
query: import_core8.gql`
|
|
556
632
|
query ftdStatus {
|
|
557
633
|
my {
|
|
558
634
|
id
|
|
@@ -571,7 +647,7 @@ async function getReceiptItems(apollo, checkoutId) {
|
|
|
571
647
|
const limit = 100;
|
|
572
648
|
let offset = 0;
|
|
573
649
|
const observer = apollo.watchQuery({
|
|
574
|
-
query:
|
|
650
|
+
query: import_core8.gql`
|
|
575
651
|
query receiptItems($checkoutId: Int, $visitorId: String, $limit: Int, $offset: Int) {
|
|
576
652
|
shop {
|
|
577
653
|
id
|
|
@@ -632,7 +708,7 @@ async function getReceiptItems(apollo, checkoutId) {
|
|
|
632
708
|
}
|
|
633
709
|
async function getReceiptTotals(apollo, checkoutId) {
|
|
634
710
|
const result = await apollo.query({
|
|
635
|
-
query:
|
|
711
|
+
query: import_core8.gql`
|
|
636
712
|
query receiptTotals($checkoutId: Int, $visitorId: String) {
|
|
637
713
|
shop {
|
|
638
714
|
id
|
|
@@ -696,7 +772,7 @@ async function getCheckoutTrackingData(apollo, checkoutId, paymentType) {
|
|
|
696
772
|
// src/oneTimeCheckout.ts
|
|
697
773
|
async function creditAmountNeeded(apollo) {
|
|
698
774
|
const data = await callShopQuery(apollo, {
|
|
699
|
-
query:
|
|
775
|
+
query: import_core9.gql`
|
|
700
776
|
query creditAmountNeeded($basketId: String) {
|
|
701
777
|
shop (basketId: $basketId) {
|
|
702
778
|
id
|
|
@@ -713,7 +789,7 @@ async function creditAmountNeeded(apollo) {
|
|
|
713
789
|
}, 0);
|
|
714
790
|
return data?.shop?.basket?.totals?.creditAmountNeeded;
|
|
715
791
|
}
|
|
716
|
-
var creditCheckoutMutation =
|
|
792
|
+
var creditCheckoutMutation = import_core9.gql`
|
|
717
793
|
mutation creditCheckout(
|
|
718
794
|
$basketId: String,
|
|
719
795
|
$visitorId: String
|
|
@@ -724,7 +800,7 @@ var creditCheckoutMutation = import_core8.gql`
|
|
|
724
800
|
}
|
|
725
801
|
}
|
|
726
802
|
`;
|
|
727
|
-
var depositCheckoutMutation =
|
|
803
|
+
var depositCheckoutMutation = import_core9.gql`
|
|
728
804
|
mutation depositCheckout(
|
|
729
805
|
$basketId: String,
|
|
730
806
|
$amount: Money!,
|
|
@@ -849,10 +925,10 @@ async function executeOneTimeCheckout({
|
|
|
849
925
|
}
|
|
850
926
|
|
|
851
927
|
// src/subscriptionCheckout.ts
|
|
852
|
-
var
|
|
928
|
+
var import_core10 = require("@apollo/client/core");
|
|
853
929
|
async function checkSubscriptionStatus(apollo) {
|
|
854
930
|
const { data: subsData } = await apollo.query({
|
|
855
|
-
query:
|
|
931
|
+
query: import_core10.gql`query subscriptionStatus{
|
|
856
932
|
my {
|
|
857
933
|
id
|
|
858
934
|
subscriptions {
|
|
@@ -902,7 +978,7 @@ async function executeNewSubscriptionCheckout({
|
|
|
902
978
|
donateAmount,
|
|
903
979
|
dayOfMonth
|
|
904
980
|
},
|
|
905
|
-
mutation:
|
|
981
|
+
mutation: import_core10.gql`mutation createAutoDepositSubscription(
|
|
906
982
|
$nonce: String!,
|
|
907
983
|
$deviceData: String,
|
|
908
984
|
$amount: Money!,
|
|
@@ -946,13 +1022,13 @@ async function executeNewSubscriptionCheckout({
|
|
|
946
1022
|
}
|
|
947
1023
|
|
|
948
1024
|
// src/useBraintreeDropIn.ts
|
|
949
|
-
var
|
|
1025
|
+
var import_core11 = require("@apollo/client/core");
|
|
950
1026
|
var import_numeral3 = __toESM(require("numeral"), 1);
|
|
951
1027
|
var import_vue_demi = require("vue-demi");
|
|
952
1028
|
var defaultPaymentTypes = ["paypal", "card", "applePay", "googlePay"];
|
|
953
1029
|
async function getClientToken(apollo) {
|
|
954
1030
|
const { data, error, errors } = await apollo.query({
|
|
955
|
-
query:
|
|
1031
|
+
query: import_core11.gql`query getClientToken {
|
|
956
1032
|
shop {
|
|
957
1033
|
id
|
|
958
1034
|
getClientToken(useCustomerId: true)
|
|
@@ -1120,6 +1196,7 @@ function useBraintreeDropIn(key = "default") {
|
|
|
1120
1196
|
getCheckoutTrackingData,
|
|
1121
1197
|
getClientToken,
|
|
1122
1198
|
getFTDStatus,
|
|
1199
|
+
getPromoFromBasket,
|
|
1123
1200
|
getReceiptItems,
|
|
1124
1201
|
getReceiptTotals,
|
|
1125
1202
|
hasBasketExpired,
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { SetTipDonationData, SetTipDonationOptions, setTipDonation } from './bas
|
|
|
4
4
|
export { BasketTotalsData, basketTotalsQuery, watchBasketTotals } from './basketTotals.js';
|
|
5
5
|
export { VerificationState, isBasketVerified } from './basketVerification.js';
|
|
6
6
|
export { CheckoutStatusQueryResult, GetCheckoutStatusOptions, PollForCheckoutStatusOptions, getCheckoutStatus, pollForFinishedCheckout } from './checkoutStatus.js';
|
|
7
|
+
export { ShopPromoCampaignData, ShopPromoCampaignError, getPromoFromBasket } from './managedAccount.js';
|
|
7
8
|
export { OneTimeCheckoutOptions, ValetInviter, executeOneTimeCheckout } from './oneTimeCheckout.js';
|
|
8
9
|
export { getCheckoutTrackingData, getFTDStatus, getReceiptItems, getReceiptTotals } from './receipt.js';
|
|
9
10
|
export { ShopError, ShopErrorOptions, parseShopError } from './shopError.js';
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
applyPromoCredit,
|
|
26
26
|
removeKivaCredit,
|
|
27
27
|
removePromoCredit
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-L4MZ7J46.js";
|
|
29
29
|
import {
|
|
30
30
|
setTipDonation
|
|
31
31
|
} from "./chunk-AI6E33YE.js";
|
|
@@ -42,6 +42,9 @@ import {
|
|
|
42
42
|
pollForFinishedCheckout
|
|
43
43
|
} from "./chunk-P62MSJJ3.js";
|
|
44
44
|
import "./chunk-TPJPGUO7.js";
|
|
45
|
+
import {
|
|
46
|
+
getPromoFromBasket
|
|
47
|
+
} from "./chunk-ZQBTUCXB.js";
|
|
45
48
|
import {
|
|
46
49
|
callShopMutation,
|
|
47
50
|
callShopQuery,
|
|
@@ -76,6 +79,7 @@ export {
|
|
|
76
79
|
getCheckoutTrackingData,
|
|
77
80
|
getClientToken,
|
|
78
81
|
getFTDStatus,
|
|
82
|
+
getPromoFromBasket,
|
|
79
83
|
getReceiptItems,
|
|
80
84
|
getReceiptTotals,
|
|
81
85
|
hasBasketExpired,
|
package/dist/managedAccount.cjs
CHANGED
|
@@ -163,8 +163,12 @@ async function callShopQuery(apollo, options, maxretries = 2) {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
// src/managedAccount.ts
|
|
166
|
-
async function getPromoFromBasket(apollo) {
|
|
166
|
+
async function getPromoFromBasket(apollo, options) {
|
|
167
|
+
if (!options?.variables?.promoFundId && !options?.variables?.basketId) {
|
|
168
|
+
return Promise.resolve({ error: "promoFundId or basketId variable required" });
|
|
169
|
+
}
|
|
167
170
|
const data = await callShopQuery(apollo, {
|
|
171
|
+
variables: { ...options?.variables },
|
|
168
172
|
query: import_core2.gql`
|
|
169
173
|
query promoCampaign($basketId: String, $promoFundId: String) {
|
|
170
174
|
shop (basketId: $basketId) {
|
|
@@ -217,7 +221,7 @@ async function getPromoFromBasket(apollo) {
|
|
|
217
221
|
}
|
|
218
222
|
}
|
|
219
223
|
`,
|
|
220
|
-
fetchPolicy: "network-only"
|
|
224
|
+
fetchPolicy: options?.fetchPolicy ?? "network-only"
|
|
221
225
|
}, 0);
|
|
222
226
|
return data;
|
|
223
227
|
}
|
package/dist/managedAccount.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ApolloClient } from '@apollo/client/core';
|
|
1
|
+
import { ApolloClient, QueryOptions } from '@apollo/client/core';
|
|
2
2
|
|
|
3
3
|
interface ShopPromoCampaignData {
|
|
4
|
-
shop
|
|
4
|
+
shop?: {
|
|
5
5
|
id: string;
|
|
6
|
-
promoCampaign
|
|
7
|
-
promoFund
|
|
6
|
+
promoCampaign?: {
|
|
7
|
+
promoFund?: {
|
|
8
8
|
id: number;
|
|
9
9
|
displayName: string;
|
|
10
10
|
displayDescription: string;
|
|
11
11
|
promoPrice: string;
|
|
12
12
|
};
|
|
13
|
-
promoGroup
|
|
13
|
+
promoGroup?: {
|
|
14
14
|
id: number;
|
|
15
15
|
type: string;
|
|
16
16
|
teamId: number;
|
|
17
17
|
};
|
|
18
|
-
managedAccount
|
|
18
|
+
managedAccount?: {
|
|
19
19
|
managementType: string;
|
|
20
20
|
audience: string;
|
|
21
21
|
allowDonations: string;
|
|
@@ -50,6 +50,10 @@ interface ShopPromoCampaignData {
|
|
|
50
50
|
} | any | null;
|
|
51
51
|
} | null;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
interface ShopPromoCampaignError {
|
|
54
|
+
shop?: any;
|
|
55
|
+
error?: string | null;
|
|
56
|
+
}
|
|
57
|
+
declare function getPromoFromBasket(apollo: ApolloClient<any>, options: QueryOptions<any>): Promise<ShopPromoCampaignData | ShopPromoCampaignError | null>;
|
|
54
58
|
|
|
55
|
-
export { getPromoFromBasket };
|
|
59
|
+
export { ShopPromoCampaignData, ShopPromoCampaignError, getPromoFromBasket };
|
package/dist/managedAccount.js
CHANGED
|
@@ -1,70 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
getPromoFromBasket
|
|
3
|
+
} from "./chunk-ZQBTUCXB.js";
|
|
4
|
+
import "./chunk-CBJJUUVR.js";
|
|
4
5
|
import "./chunk-2NC7LGGO.js";
|
|
5
6
|
import "./chunk-4ODZGLWK.js";
|
|
6
7
|
import "./chunk-LZ4UMRCV.js";
|
|
7
|
-
|
|
8
|
-
// src/managedAccount.ts
|
|
9
|
-
import { gql } from "@apollo/client/core";
|
|
10
|
-
async function getPromoFromBasket(apollo) {
|
|
11
|
-
const data = await callShopQuery(apollo, {
|
|
12
|
-
query: gql`
|
|
13
|
-
query promoCampaign($basketId: String, $promoFundId: String) {
|
|
14
|
-
shop (basketId: $basketId) {
|
|
15
|
-
id
|
|
16
|
-
promoCampaign (promoFundId: $promoFundId) {
|
|
17
|
-
promoFund {
|
|
18
|
-
id
|
|
19
|
-
displayName
|
|
20
|
-
displayDescription
|
|
21
|
-
promoPrice
|
|
22
|
-
}
|
|
23
|
-
promoGroup {
|
|
24
|
-
id
|
|
25
|
-
type
|
|
26
|
-
teamId
|
|
27
|
-
}
|
|
28
|
-
managedAccount {
|
|
29
|
-
managementType
|
|
30
|
-
audience
|
|
31
|
-
allowDonations
|
|
32
|
-
sendKivaNewsletter
|
|
33
|
-
id
|
|
34
|
-
isEmployee
|
|
35
|
-
formId
|
|
36
|
-
pageId
|
|
37
|
-
loanSearchCriteria {
|
|
38
|
-
filters {
|
|
39
|
-
cityState
|
|
40
|
-
country
|
|
41
|
-
currencyLossPossible
|
|
42
|
-
dafEligible
|
|
43
|
-
distributionModel
|
|
44
|
-
status
|
|
45
|
-
excludeNonRated
|
|
46
|
-
expiringSoon
|
|
47
|
-
gender
|
|
48
|
-
hasResearchScore
|
|
49
|
-
isGroup
|
|
50
|
-
lenderFavorite
|
|
51
|
-
loanLimit
|
|
52
|
-
isMatched
|
|
53
|
-
sector
|
|
54
|
-
loanTags
|
|
55
|
-
theme
|
|
56
|
-
}
|
|
57
|
-
sortBy
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
`,
|
|
64
|
-
fetchPolicy: "network-only"
|
|
65
|
-
}, 0);
|
|
66
|
-
return data;
|
|
67
|
-
}
|
|
68
8
|
export {
|
|
69
9
|
getPromoFromBasket
|
|
70
10
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-shop",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@apollo/client": "^3.7.14",
|
|
41
41
|
"@kiva/kv-analytics": "^1.3.0",
|
|
42
|
-
"@kiva/kv-components": "^3.78.
|
|
42
|
+
"@kiva/kv-components": "^3.78.2",
|
|
43
43
|
"@types/braintree-web-drop-in": "^1.34.2",
|
|
44
44
|
"braintree-web-drop-in": "^1.37.0",
|
|
45
45
|
"numeral": "^2.0.6",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"optional": true
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "c73bcf7a6e1d5b3fc2f384b2317ee335cc2e26f7"
|
|
58
58
|
}
|