@kiva/kv-components 3.48.0 → 3.48.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/CHANGELOG.md +8 -0
- package/package.json +2 -2
- package/tests/unit/specs/components/KvClassicLoanCard.spec.js +136 -0
- package/tests/unit/specs/components/KvWideLoanCard.spec.js +136 -0
- package/utils/loanCard.js +189 -0
- package/vue/KvBorrowerImage.vue +11 -2
- package/vue/KvClassicLoanCard.vue +66 -165
- package/vue/KvWideLoanCard.vue +429 -0
- package/vue/stories/KvBorrowerImage.stories.js +6 -0
- package/vue/stories/KvClassicLoanCard.stories.js +33 -0
- package/vue/stories/KvWideLoanCard.stories.js +279 -0
|
@@ -28,6 +28,7 @@ const story = (args) => {
|
|
|
28
28
|
:kv-track-function="kvTrackFunction"
|
|
29
29
|
:photo-path="photoPath"
|
|
30
30
|
:show-view-loan="showViewLoan"
|
|
31
|
+
:custom-callouts="customCallouts"
|
|
31
32
|
/>
|
|
32
33
|
</div>
|
|
33
34
|
`,
|
|
@@ -118,6 +119,38 @@ export const ShowTags = story({
|
|
|
118
119
|
showTags: true,
|
|
119
120
|
});
|
|
120
121
|
|
|
122
|
+
export const CustomCallouts = story({
|
|
123
|
+
loanId: loan.id,
|
|
124
|
+
loan: {
|
|
125
|
+
...loan,
|
|
126
|
+
loanFundraisingInfo: {
|
|
127
|
+
fundedAmount: '950.00',
|
|
128
|
+
isExpiringSoon: false,
|
|
129
|
+
reservedAmount: '0.00',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
kvTrackFunction,
|
|
133
|
+
photoPath,
|
|
134
|
+
showTags: true,
|
|
135
|
+
customCallouts: ['Loan Length: 15mo'],
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
export const CustomCalloutsWrap = story({
|
|
139
|
+
loanId: loan.id,
|
|
140
|
+
loan: {
|
|
141
|
+
...loan,
|
|
142
|
+
loanFundraisingInfo: {
|
|
143
|
+
fundedAmount: '950.00',
|
|
144
|
+
isExpiringSoon: false,
|
|
145
|
+
reservedAmount: '0.00',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
kvTrackFunction,
|
|
149
|
+
photoPath,
|
|
150
|
+
showTags: true,
|
|
151
|
+
customCallouts: ['Loan Length: 15mo', 'Long Dairy Processing'],
|
|
152
|
+
});
|
|
153
|
+
|
|
121
154
|
export const Matched = story({
|
|
122
155
|
loanId: loan.id,
|
|
123
156
|
loan: {
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import KvWideLoanCard from '../KvWideLoanCard.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'KvWideLoanCard',
|
|
5
|
+
component: KvWideLoanCard,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const story = (args) => {
|
|
9
|
+
const template = (_args, { argTypes }) => ({
|
|
10
|
+
props: Object.keys(argTypes),
|
|
11
|
+
components: { KvWideLoanCard },
|
|
12
|
+
template: `
|
|
13
|
+
<div style="max-width: 800px;">
|
|
14
|
+
<kv-wide-loan-card
|
|
15
|
+
:loanId="loanId"
|
|
16
|
+
:loan="loan"
|
|
17
|
+
:custom-loan-details="customLoanDetails"
|
|
18
|
+
:show-tags="showTags"
|
|
19
|
+
:category-page-name="categoryPageName"
|
|
20
|
+
:enable-five-dollars-notes="enableFiveDollarsNotes"
|
|
21
|
+
:five-dollars-selected="fiveDollarsSelected"
|
|
22
|
+
:is-adding="isAdding"
|
|
23
|
+
:is-visitor="isVisitor"
|
|
24
|
+
:basket-items="basketItems"
|
|
25
|
+
:is-bookmarked="isBookmarked"
|
|
26
|
+
:kv-track-function="kvTrackFunction"
|
|
27
|
+
:photo-path="photoPath"
|
|
28
|
+
:show-view-loan="showViewLoan"
|
|
29
|
+
:custom-callouts="customCallouts"
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
`,
|
|
33
|
+
});
|
|
34
|
+
template.args = args;
|
|
35
|
+
return template;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const nextWeek = new Date();
|
|
39
|
+
nextWeek.setDate(new Date().getDate() + 7);
|
|
40
|
+
|
|
41
|
+
const loan = {
|
|
42
|
+
id: 1,
|
|
43
|
+
name: 'Alan',
|
|
44
|
+
geocode: {
|
|
45
|
+
city: 'Lyantonde',
|
|
46
|
+
state: 'Central Region',
|
|
47
|
+
country: {
|
|
48
|
+
isoCode: 'UG',
|
|
49
|
+
name: 'Uganda',
|
|
50
|
+
region: 'Africa',
|
|
51
|
+
__typename: 'Country',
|
|
52
|
+
},
|
|
53
|
+
__typename: 'Geocode',
|
|
54
|
+
},
|
|
55
|
+
image: { hash: '9673d0722a7675b9b8d11f90849d9b44' },
|
|
56
|
+
fundraisingPercent: 0.5,
|
|
57
|
+
unreservedAmount: '500.00',
|
|
58
|
+
use: 'to purchase heifers to increase headcount of cattle and sales of organic milk.',
|
|
59
|
+
status: 'fundraising',
|
|
60
|
+
loanAmount: '1000.00',
|
|
61
|
+
borrowerCount: 1,
|
|
62
|
+
activity: {
|
|
63
|
+
id: 61,
|
|
64
|
+
name: 'Dairy',
|
|
65
|
+
__typename: 'Activity',
|
|
66
|
+
},
|
|
67
|
+
sector: {
|
|
68
|
+
id: 1,
|
|
69
|
+
name: 'Agriculture',
|
|
70
|
+
__typename: 'Sector',
|
|
71
|
+
},
|
|
72
|
+
plannedExpirationDate: nextWeek.toISOString(),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const kvTrackFunction = () => { };
|
|
76
|
+
|
|
77
|
+
const photoPath = 'https://www-kiva-org.freetls.fastly.net/img/';
|
|
78
|
+
|
|
79
|
+
export const Loading = story({
|
|
80
|
+
loanId: loan.id,
|
|
81
|
+
loan: undefined,
|
|
82
|
+
kvTrackFunction,
|
|
83
|
+
photoPath,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const PartialLoading = story({
|
|
87
|
+
loanId: loan.id,
|
|
88
|
+
loan: {
|
|
89
|
+
...loan,
|
|
90
|
+
unreservedAmount: undefined,
|
|
91
|
+
fundraisingPercent: undefined,
|
|
92
|
+
},
|
|
93
|
+
kvTrackFunction,
|
|
94
|
+
photoPath,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export const ShowTags = story({
|
|
98
|
+
loanId: loan.id,
|
|
99
|
+
loan: {
|
|
100
|
+
...loan,
|
|
101
|
+
loanFundraisingInfo: {
|
|
102
|
+
fundedAmount: '950.00',
|
|
103
|
+
isExpiringSoon: false,
|
|
104
|
+
reservedAmount: '0.00',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
kvTrackFunction,
|
|
108
|
+
photoPath,
|
|
109
|
+
showTags: true,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
export const CustomCallouts = story({
|
|
113
|
+
loanId: loan.id,
|
|
114
|
+
loan: {
|
|
115
|
+
...loan,
|
|
116
|
+
loanFundraisingInfo: {
|
|
117
|
+
fundedAmount: '950.00',
|
|
118
|
+
isExpiringSoon: false,
|
|
119
|
+
reservedAmount: '0.00',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
kvTrackFunction,
|
|
123
|
+
photoPath,
|
|
124
|
+
showTags: true,
|
|
125
|
+
customCallouts: ['Loan Length: 15mo'],
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export const CustomCalloutsWrap = story({
|
|
129
|
+
loanId: loan.id,
|
|
130
|
+
loan: {
|
|
131
|
+
...loan,
|
|
132
|
+
loanFundraisingInfo: {
|
|
133
|
+
fundedAmount: '950.00',
|
|
134
|
+
isExpiringSoon: false,
|
|
135
|
+
reservedAmount: '0.00',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
kvTrackFunction,
|
|
139
|
+
photoPath,
|
|
140
|
+
showTags: true,
|
|
141
|
+
customCallouts: ['Loan Length: 15mo', 'Long Dairy Processing'],
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
export const Matched = story({
|
|
145
|
+
loanId: loan.id,
|
|
146
|
+
loan: {
|
|
147
|
+
...loan,
|
|
148
|
+
matchingText: 'Matched by Ebay',
|
|
149
|
+
matchRatio: 1,
|
|
150
|
+
loanFundraisingInfo: {
|
|
151
|
+
fundedAmount: '200.00',
|
|
152
|
+
isExpiringSoon: false,
|
|
153
|
+
reservedAmount: '0.00',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
kvTrackFunction,
|
|
157
|
+
photoPath,
|
|
158
|
+
showTags: true,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
export const AllSharesReserved = story({
|
|
162
|
+
loanId: loan.id,
|
|
163
|
+
loan: {
|
|
164
|
+
...loan,
|
|
165
|
+
unreservedAmount: '0.00',
|
|
166
|
+
fundraisingPercent: 1,
|
|
167
|
+
},
|
|
168
|
+
kvTrackFunction,
|
|
169
|
+
photoPath,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
export const InBasket = story({
|
|
173
|
+
loanId: loan.id,
|
|
174
|
+
loan,
|
|
175
|
+
kvTrackFunction,
|
|
176
|
+
photoPath,
|
|
177
|
+
basketItems: [{ id: loan.id, __typename: 'LoanReservation' }],
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
export const LongCallouts = story({
|
|
181
|
+
loanId: loan.id,
|
|
182
|
+
loan: {
|
|
183
|
+
...loan,
|
|
184
|
+
activity: { id: 1, name: 'Longer activity name test that will be longer than 50% of the card' },
|
|
185
|
+
},
|
|
186
|
+
showTags: true,
|
|
187
|
+
kvTrackFunction,
|
|
188
|
+
photoPath,
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
export const LseLoan = story({
|
|
192
|
+
loanId: loan.id,
|
|
193
|
+
loan: {
|
|
194
|
+
...loan,
|
|
195
|
+
loanFundraisingInfo: {
|
|
196
|
+
fundedAmount: '950.00',
|
|
197
|
+
isExpiringSoon: false,
|
|
198
|
+
reservedAmount: '0.00',
|
|
199
|
+
},
|
|
200
|
+
partnerName: 'N/A, direct to Novulis',
|
|
201
|
+
tags: [
|
|
202
|
+
'user_favorite',
|
|
203
|
+
'#Woman-Owned Business',
|
|
204
|
+
'#Animals',
|
|
205
|
+
'#Repeat Borrower',
|
|
206
|
+
'#Supporting Family',
|
|
207
|
+
'#Eco-friendly',
|
|
208
|
+
'#Single parent',
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
kvTrackFunction,
|
|
212
|
+
photoPath,
|
|
213
|
+
showTags: true,
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
export const Bookmarked = story({
|
|
217
|
+
loanId: loan.id,
|
|
218
|
+
loan,
|
|
219
|
+
isBookmarked: true,
|
|
220
|
+
isVisitor: false,
|
|
221
|
+
kvTrackFunction,
|
|
222
|
+
photoPath,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
export const Adding = story({
|
|
226
|
+
loanId: loan.id,
|
|
227
|
+
loan,
|
|
228
|
+
isAdding: true,
|
|
229
|
+
kvTrackFunction,
|
|
230
|
+
photoPath,
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
export const FiveDollarNotes = story({
|
|
234
|
+
loanId: loan.id,
|
|
235
|
+
loan,
|
|
236
|
+
enableFiveDollarsNotes: true,
|
|
237
|
+
kvTrackFunction,
|
|
238
|
+
photoPath,
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
export const FiveDollarsSelected = story({
|
|
242
|
+
loanId: loan.id,
|
|
243
|
+
loan,
|
|
244
|
+
enableFiveDollarsNotes: true,
|
|
245
|
+
fiveDollarsSelected: true,
|
|
246
|
+
kvTrackFunction,
|
|
247
|
+
photoPath,
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
export const ViewLoan = story({
|
|
251
|
+
loanId: loan.id,
|
|
252
|
+
loan,
|
|
253
|
+
kvTrackFunction,
|
|
254
|
+
photoPath,
|
|
255
|
+
showViewLoan: true,
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
export const ViewLoanFunded = story({
|
|
259
|
+
loanId: loan.id,
|
|
260
|
+
loan: {
|
|
261
|
+
...loan,
|
|
262
|
+
unreservedAmount: '0.00',
|
|
263
|
+
fundraisingPercent: 1,
|
|
264
|
+
},
|
|
265
|
+
kvTrackFunction,
|
|
266
|
+
photoPath,
|
|
267
|
+
showViewLoan: true,
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
export const LendAgain = story({
|
|
271
|
+
loanId: loan.id,
|
|
272
|
+
loan: {
|
|
273
|
+
...loan,
|
|
274
|
+
userProperties: { lentTo: true },
|
|
275
|
+
},
|
|
276
|
+
customLoanDetails: true,
|
|
277
|
+
kvTrackFunction,
|
|
278
|
+
photoPath,
|
|
279
|
+
});
|