@tonder.io/ionic-full-sdk 0.0.11-beta → 0.0.13-beta

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.
@@ -1,296 +1,308 @@
1
- import { getCardType } from './utils';
2
-
3
- export type CollectorIds = {
4
- holderName: string,
5
- cardNumber: string,
6
- expirationMonth: string,
7
- expirationYear: string,
8
- cvv: string,
9
- tonderPayButton: string,
10
- msgError: string,
11
- msgNotification: string,
12
- cardsListContainer: string
13
- }
14
-
15
- export type Card = {
16
- card_scheme: string,
17
- cardholder_name: string,
18
- card_number: string,
19
- expiration_month: string,
20
- expiration_year: string,
21
- skyflow_id: string
22
- }
23
-
24
- export const cardTemplate = (external: boolean, collectorIds: CollectorIds) => `
25
- <div class="container-tonder">
26
- <div id="${collectorIds.cardsListContainer}" class="cards-list-container"></div>
27
- <div class="pay-new-card">
28
- <input checked id="new" name="card_selected" type="radio"/>
29
- <label class="card-item-label-new" for="new">
30
- <img class="card-image" src="${getCardType("XXXX")}" />
31
- <div class="card-number">Pagar con tarjeta</div>
32
- </label>
33
- </div>
34
- <div class="container-form">
35
- <div id="${collectorIds.holderName}" class="empty-div"></div>
36
- <div id="${collectorIds.cardNumber}" class="empty-div"></div>
37
- <div class="collect-row">
38
- <div id="${collectorIds.expirationMonth}" class="empty-div"></div>
39
- <div id="${collectorIds.expirationYear}" class="expiration-year"></div>
40
- <div id="${collectorIds.cvv}" class="empty-div"></div>
41
- </div>
42
- <div class="checkbox">
43
- <input id="save-checkout-card" type="checkbox">
44
- <label for="save-checkout-card">
45
- Guardar tarjeta para futuros pagos
46
- </label>
47
- </div>
48
- <div id="${collectorIds.msgError}"></div>
49
- <div id="${collectorIds.msgNotification}"></div>
50
- </div>
51
- <button id="${collectorIds.tonderPayButton}" class="pay-button">Pagar</button>
52
- </div>
53
-
54
- ${external ? `` : `<style>
55
-
56
- @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
57
-
58
- .container-tonder {
59
- background-color: #F9F9F9;
60
- margin: 0 auto !important;
61
- padding: 30px 10px 30px 10px;
62
- overflow: hidden;
63
- transition: max-height 0.5s ease-out;
64
- max-width: 600px;
65
- border: solid 1px #e3e3e3;
66
- }
67
-
68
- .collect-row {
69
- display: flex !important;
70
- justify-content: space-between !important;
71
- width: 100% !important;
72
- }
73
-
74
- .collect-row > :first-child {
75
- min-width: 120px; !important
76
- }
77
-
78
- .expiration-year {
79
- padding-top: 25px !important;
80
- }
81
-
82
- .empty-div {
83
- height: 80px !important;
84
- margin-top: 2px;
85
- margin-bottom: 4px;
86
- margin-left: 10px !important;
87
- margin-right: 10px !important;
88
- }
89
-
90
- .error-container{
91
- color: red !important;
92
- background-color: #FFDBDB !important;
93
- margin-bottom: 13px !important;
94
- font-size: 80% !important;
95
- padding: 8px 10px !important;
96
- border-radius: 10px !important;
97
- text-align: left !important;
98
- }
99
-
100
- .message-container{
101
- color: green !important;
102
- background-color: #DAFCE4 !important;
103
- margin-bottom: 13px !important;
104
- font-size: 80% !important;
105
- padding: 8px 10px !important;
106
- border-radius: 10px !important;
107
- text-align: left !important;
108
- }
109
-
110
- .pay-button {
111
- font-size: 16px;
112
- font-weight: bold;
113
- min-height: 2.3rem;
114
- border-radius: 0.5rem;
115
- cursor: pointer;
116
- width: 100%;
117
- padding: 1rem;
118
- text-align: center;
119
- border: none;
120
- background-color: #000;
121
- color: #fff;
122
- margin-bottom: 10px;
123
- display: none;
124
- font-family: "Inter", sans-serif !important;
125
- }
126
-
127
- .pay-button:disabled, pay-button[disabled] {
128
- background-color: #B9B9B9;
129
- }
130
-
131
- .lds-dual-ring {
132
- display: inline-block;
133
- width: 14px;
134
- height: 14px;
135
- }
136
-
137
- .lds-dual-ring:after {
138
- content: " ";
139
- display: block;
140
- width: 14px;
141
- height: 14px;
142
- border-radius: 50%;
143
- border: 6px solid #fff;
144
- border-color: #fff transparent #fff transparent;
145
- animation: lds-dual-ring 1.2s linear infinite;
146
- }
147
-
148
- @keyframes lds-dual-ring {
149
- 0% {
150
- transform: rotate(0deg);
151
- }
152
- 100% {
153
- transform: rotate(360deg);
154
- }
155
- }
156
-
157
- @media screen and (max-width: 600px) {
158
- .payment_method_zplit {
159
- font-size: 16px !important;
160
- width: 100% !important;
161
- }
162
-
163
- .payment_method_zplit label img {
164
- display: none !important;
165
- }
166
- }
167
-
168
- .cards-list-container {
169
- display: flex;
170
- flex-direction: column;
171
- padding: 0px 10px 0px 10px;
172
- gap: 33% 20px;
173
- }
174
-
175
- .checkbox label {
176
- margin-left: 10px;
177
- font-size: '12px';
178
- font-weight: '500';
179
- color: #1D1D1D;
180
- font-family: "Inter", sans-serif !important;
181
- }
182
-
183
- .checkbox {
184
- margin-top: 10px;
185
- margin-bottom: 10px;
186
- width: 100%;
187
- text-align: left;
188
- }
189
-
190
- .pay-new-card {
191
- display: flex;
192
- justify-content: start;
193
- align-items: center;
194
- color: #1D1D1D;
195
- gap: 33% 20px;
196
- margin-top: 10px;
197
- margin-bottom: 10px;
198
- padding-left: 10px;
199
- padding-right: 10px;
200
- width: 90%;
201
- }
202
-
203
- .pay-new-card .card-number {
204
- font-size: 16px;
205
- font-family: "Inter", sans-serif !important;
206
- }
207
-
208
- .card-image {
209
- width: 39px;
210
- height: 24px;
211
- text-align: left;
212
- }
213
-
214
- .card-item-label-new {
215
- display: flex;
216
- justify-content: start;
217
- align-items: center;
218
- color: #1D1D1D;
219
- gap: 33% 20px;
220
- margin-top: 10px;
221
- margin-bottom: 10px;
222
- padding-left: 10px;
223
- padding-right: 10px;
224
- width: 90%;
225
- }
226
-
227
- </style>
228
- `}`
229
-
230
- export const cardItemsTemplate = (external: boolean, cards: Card[]) => {
231
-
232
- const cardItemsHTML = cards.reduce((total: string, card: Card) => {
233
- return `${total}
234
- <div class="card-item">
235
- <input id="${card.skyflow_id}" name="card_selected" type="radio"/>
236
- <label class="card-item-label" for="${card.skyflow_id}">
237
- <img class="card-image" src="${getCardType(card.card_scheme)}" />
238
- <div class="card-number">${card.card_number}</div>
239
- <div class="card-expiration">Exp. ${card.expiration_month}/${card.expiration_year}</div>
240
- </label>
241
- </div>`
242
- }, ``);
243
-
244
- const cardItemStyle = external ? '' : `
245
- <style>
246
-
247
- @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
248
-
249
- .card-item-label {
250
- display: flex;
251
- justify-content: space-between;
252
- align-items: center;
253
- color: #1D1D1D;
254
- gap: 33% 20px;
255
- margin-top: 10px;
256
- margin-bottom: 10px;
257
- padding-left: 10px;
258
- padding-right: 10px;
259
- width: 90%;
260
- }
261
-
262
- .card_selected {
263
- width: 10%;
264
- }
265
-
266
- .card-item {
267
- display: flex;
268
- justify-content: start;
269
- align-items: center;
270
- gap: 33% 20px;
271
- }
272
-
273
- .card-item .card-number {
274
- font-size: 16px;
275
- font-family: "Inter", sans-serif !important;
276
- }
277
-
278
- .card-item .card-expiration {
279
- font-size: 16px;
280
- font-family: "Inter", sans-serif !important;
281
- }
282
-
283
- .card-image {
284
- width: 39px;
285
- height: 24px;
286
- text-align: left;
287
- }
288
-
289
- </style>
290
- `
291
- const cardItem = `
292
- ${cardItemsHTML}
293
- ${cardItemStyle}
294
- `
295
- return cardItem;
1
+ import { getCardType } from './utils';
2
+
3
+ export type CollectorIds = {
4
+ holderName: string,
5
+ cardNumber: string,
6
+ expirationMonth: string,
7
+ expirationYear: string,
8
+ cvv: string,
9
+ tonderPayButton: string,
10
+ msgError: string,
11
+ msgNotification: string,
12
+ cardsListContainer: string
13
+ }
14
+
15
+ export type Card = {
16
+ card_scheme: string,
17
+ cardholder_name: string,
18
+ card_number: string,
19
+ expiration_month: string,
20
+ expiration_year: string,
21
+ skyflow_id: string
22
+ }
23
+
24
+ export const cardTemplate = (external: boolean, collectorIds: CollectorIds) => `
25
+ <div class="container-tonder">
26
+ <div id="${collectorIds.cardsListContainer}" class="cards-list-container"></div>
27
+ <div class="pay-new-card">
28
+ <input checked id="new" name="card_selected" type="radio"/>
29
+ <label class="card-item-label-new" for="new">
30
+ <img class="card-image" src="${getCardType("XXXX")}" />
31
+ <div class="card-number">Pagar con tarjeta</div>
32
+ </label>
33
+ </div>
34
+ <div class="container-form">
35
+ <div id="${collectorIds.holderName}" class="empty-div"></div>
36
+ <div id="${collectorIds.cardNumber}" class="empty-div"></div>
37
+ <div class="collect-row">
38
+ <div id="${collectorIds.expirationMonth}" class="empty-div"></div>
39
+ <div id="${collectorIds.expirationYear}" class="expiration-year"></div>
40
+ <div id="${collectorIds.cvv}" class="empty-div"></div>
41
+ </div>
42
+ <div class="checkbox">
43
+ <input id="save-checkout-card" type="checkbox">
44
+ <label for="save-checkout-card">
45
+ Guardar tarjeta para futuros pagos
46
+ </label>
47
+ </div>
48
+ <div id="${collectorIds.msgError}"></div>
49
+ <div id="${collectorIds.msgNotification}"></div>
50
+ </div>
51
+ <button id="${collectorIds.tonderPayButton}" class="pay-button">Pagar</button>
52
+ </div>
53
+
54
+ ${external ? `` : `<style>
55
+
56
+ @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
57
+
58
+ .container-tonder {
59
+ background-color: #F9F9F9;
60
+ margin: 0 auto !important;
61
+ padding: 30px 10px 30px 10px;
62
+ overflow: hidden;
63
+ transition: max-height 0.5s ease-out;
64
+ max-width: 600px;
65
+ border: solid 1px #e3e3e3;
66
+ }
67
+
68
+ .collect-row {
69
+ display: flex !important;
70
+ justify-content: space-between !important;
71
+ width: 100% !important;
72
+ }
73
+
74
+ .collect-row > :first-child {
75
+ min-width: 120px; !important
76
+ }
77
+
78
+ .expiration-year {
79
+ padding-top: 25px !important;
80
+ }
81
+
82
+ .empty-div {
83
+ height: 80px !important;
84
+ margin-top: 2px;
85
+ margin-bottom: 4px;
86
+ margin-left: 10px !important;
87
+ margin-right: 10px !important;
88
+ }
89
+
90
+ .error-container{
91
+ color: red !important;
92
+ background-color: #FFDBDB !important;
93
+ margin-bottom: 13px !important;
94
+ font-size: 80% !important;
95
+ padding: 8px 10px !important;
96
+ border-radius: 10px !important;
97
+ text-align: left !important;
98
+ }
99
+
100
+ .message-container{
101
+ color: green !important;
102
+ background-color: #DAFCE4 !important;
103
+ margin-bottom: 13px !important;
104
+ font-size: 80% !important;
105
+ padding: 8px 10px !important;
106
+ border-radius: 10px !important;
107
+ text-align: left !important;
108
+ }
109
+
110
+ .pay-button {
111
+ font-size: 16px;
112
+ font-weight: bold;
113
+ min-height: 2.3rem;
114
+ border-radius: 0.5rem;
115
+ cursor: pointer;
116
+ width: 100%;
117
+ padding: 1rem;
118
+ text-align: center;
119
+ border: none;
120
+ background-color: #000;
121
+ color: #fff;
122
+ margin-bottom: 10px;
123
+ display: none;
124
+ font-family: "Inter", sans-serif !important;
125
+ }
126
+
127
+ .pay-button:disabled, pay-button[disabled] {
128
+ background-color: #B9B9B9;
129
+ }
130
+
131
+ .lds-dual-ring {
132
+ display: inline-block;
133
+ width: 14px;
134
+ height: 14px;
135
+ }
136
+
137
+ .lds-dual-ring:after {
138
+ content: " ";
139
+ display: block;
140
+ width: 14px;
141
+ height: 14px;
142
+ border-radius: 50%;
143
+ border: 6px solid #fff;
144
+ border-color: #fff transparent #fff transparent;
145
+ animation: lds-dual-ring 1.2s linear infinite;
146
+ }
147
+
148
+ @keyframes lds-dual-ring {
149
+ 0% {
150
+ transform: rotate(0deg);
151
+ }
152
+ 100% {
153
+ transform: rotate(360deg);
154
+ }
155
+ }
156
+
157
+ @media screen and (max-width: 600px) {
158
+ .payment_method_zplit {
159
+ font-size: 16px !important;
160
+ width: 100% !important;
161
+ }
162
+
163
+ .payment_method_zplit label img {
164
+ display: none !important;
165
+ }
166
+ }
167
+
168
+ .cards-list-container {
169
+ display: flex;
170
+ flex-direction: column;
171
+ padding: 0px 10px 0px 10px;
172
+ gap: 33% 20px;
173
+ }
174
+
175
+ .checkbox label {
176
+ margin-left: 10px;
177
+ font-size: '12px';
178
+ font-weight: '500';
179
+ color: #1D1D1D;
180
+ font-family: "Inter", sans-serif !important;
181
+ }
182
+
183
+ .checkbox {
184
+ margin-top: 10px;
185
+ margin-bottom: 10px;
186
+ width: 100%;
187
+ text-align: left;
188
+ }
189
+
190
+ .pay-new-card {
191
+ display: flex;
192
+ justify-content: start;
193
+ align-items: center;
194
+ color: #1D1D1D;
195
+ gap: 33% 20px;
196
+ margin-top: 10px;
197
+ margin-bottom: 10px;
198
+ padding-left: 10px;
199
+ padding-right: 10px;
200
+ width: 90%;
201
+ }
202
+
203
+ .pay-new-card .card-number {
204
+ font-size: 16px;
205
+ font-family: "Inter", sans-serif !important;
206
+ }
207
+
208
+ .card-image {
209
+ width: 39px;
210
+ height: 24px;
211
+ text-align: left;
212
+ }
213
+
214
+ .card-item-label-new {
215
+ display: flex;
216
+ justify-content: start;
217
+ align-items: center;
218
+ color: #1D1D1D;
219
+ gap: 33% 20px;
220
+ margin-top: 10px;
221
+ margin-bottom: 10px;
222
+ padding-left: 10px;
223
+ padding-right: 10px;
224
+ width: 90%;
225
+ }
226
+
227
+ </style>
228
+ `}`
229
+
230
+ export const cardItemsTemplate = (external: boolean, cards: Card[]) => {
231
+
232
+ const cardItemsHTML = cards.reduce((total: string, card: Card) => {
233
+ return `${total}
234
+ <div class="card-item">
235
+ <input id="${card.skyflow_id}" name="card_selected" type="radio"/>
236
+ <label class="card-item-label" for="${card.skyflow_id}">
237
+ <img class="card-image" src="${getCardType(card.card_scheme)}" />
238
+ <div class="card-number">${card.card_number}</div>
239
+ <div class="card-expiration">Exp. ${card.expiration_month}/${card.expiration_year}</div>
240
+ <div class="card-delete-icon">
241
+ <button id="delete_button_${card.skyflow_id}" class="card-delete-button">
242
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
243
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12.663 1.5h-1.326c-1.069 0-1.49.09-1.921.27-.432.181-.792.453-1.084.82-.292.365-.493.746-.784 1.774L7.368 5H5a1 1 0 0 0 0 2h.563l.703 11.25c.082 1.32.123 1.98.407 2.481a2.5 2.5 0 0 0 1.083 1.017C8.273 22 8.935 22 10.258 22h3.484c1.323 0 1.985 0 2.502-.252a2.5 2.5 0 0 0 1.083-1.017c.284-.5.325-1.16.407-2.482L18.437 7H19a1 1 0 1 0 0-2h-2.367l-.18-.636c-.292-1.028-.493-1.409-.785-1.775a2.694 2.694 0 0 0-1.084-.819c-.431-.18-.852-.27-1.92-.27zm1.89 3.5-.025-.09c-.203-.717-.29-.905-.424-1.074a.696.696 0 0 0-.292-.221c-.2-.084-.404-.115-1.149-.115h-1.326c-.745 0-.95.031-1.149.115a.696.696 0 0 0-.292.221c-.135.169-.221.357-.424 1.074L9.446 5h5.108zM9.61 8.506a.75.75 0 0 0-.724.776l.297 8.495a.75.75 0 0 0 1.499-.053l-.297-8.494a.75.75 0 0 0-.775-.724zm4.008.724a.75.75 0 0 1 1.499.052l-.297 8.495a.75.75 0 0 1-1.499-.053l.297-8.494z" fill="currentColor"/>
244
+ </svg>
245
+ </button>
246
+ </div>
247
+ </label>
248
+ </div>`
249
+ }, ``);
250
+
251
+ const cardItemStyle = external ? '' : `
252
+ <style>
253
+
254
+ @import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap");
255
+
256
+ .card-item-label {
257
+ display: flex;
258
+ justify-content: space-between;
259
+ align-items: center;
260
+ color: #1D1D1D;
261
+ gap: 33% 20px;
262
+ margin-top: 10px;
263
+ margin-bottom: 10px;
264
+ padding-left: 10px;
265
+ padding-right: 10px;
266
+ width: 90%;
267
+ }
268
+
269
+ .card_selected {
270
+ width: 10%;
271
+ }
272
+
273
+ .card-item {
274
+ display: flex;
275
+ justify-content: start;
276
+ align-items: center;
277
+ gap: 33% 20px;
278
+ }
279
+
280
+ .card-item .card-number {
281
+ font-size: 16px;
282
+ font-family: "Inter", sans-serif !important;
283
+ }
284
+
285
+ .card-item .card-expiration {
286
+ font-size: 16px;
287
+ font-family: "Inter", sans-serif !important;
288
+ }
289
+
290
+ .card-image {
291
+ width: 39px;
292
+ height: 24px;
293
+ text-align: left;
294
+ }
295
+
296
+ .card-delete-button {
297
+ background-color: transparent !important;
298
+ color: #D91C1C !important;
299
+ }
300
+
301
+ </style>
302
+ `
303
+ const cardItem = `
304
+ ${cardItemsHTML}
305
+ ${cardItemStyle}
306
+ `
307
+ return cardItem;
296
308
  }