@@ -58,6 +58,7 @@ const Prices = {
58
58
CNY : '¥68.00' ,
59
59
AUD : '$14.99' ,
60
60
} ,
61
+ /*
61
62
PLUS: {
62
63
USD: '$4.99',
63
64
GBP: '£3.99',
@@ -67,6 +68,16 @@ const Prices = {
67
68
CNY: '¥38.00',
68
69
AUD: '$7.99',
69
70
},
71
+ */
72
+ PLUS : {
73
+ USD : '$9.99' ,
74
+ GBP : '£7.99' ,
75
+ EUR : '€9.99' ,
76
+ JPY : '¥1,500' ,
77
+ CAD : '$12.99' ,
78
+ CNY : '¥68.00' ,
79
+ AUD : '$14.99' ,
80
+ } ,
70
81
CORPORATE : {
71
82
USD : '$9.99/yr' ,
72
83
GBP : '£7.99/yr' ,
@@ -146,6 +157,7 @@ const htmlText = `
146
157
</label>
147
158
</div>
148
159
<div class="button-wrapper">
160
+ <!--
149
161
<a class="button-link button-link--paypal js-link-paypal" href="${ DEFAULT_LINK_PAYPAL } " target="_blank" rel="noopener" data-s="d-plus-paypal">
150
162
<span class="button-link__text">Pay with <span class="button-link__text--paypal">PayPal</span></span>
151
163
</a>
@@ -156,6 +168,20 @@ const htmlText = `
156
168
<a class="button-link button-link--other button-link--inactive js-link-other" href="${ Links . Redirect . CORPORATE } " target="_blank" rel="noopener" data-s="d-plus-other">
157
169
<span class="button-link__text" data-text="more">More options</span>
158
170
</a>
171
+ -->
172
+ <a class="button-link button-link--paddle js-link-paddle" href="#pay" data-s="d-side-paddle">
173
+ <span class="button-link__text">
174
+ <span data-text="pay">Pay</span>
175
+ <span class="js-price-regular">${ DEFAULT_PRICE_PLUS } </span>
176
+ </span>
177
+ </a>
178
+ </div>
179
+ <div class="payment-methods">
180
+ <i class="payment-methods__paypal"></i>
181
+ <i class="payment-methods__gpay"></i>
182
+ <i class="payment-methods__visa"></i>
183
+ <i class="payment-methods__mastercard"></i>
184
+ <i class="payment-methods__amex"></i>
159
185
</div>
160
186
</div>
161
187
</section>
@@ -411,6 +437,9 @@ const cssText = `
411
437
text-transform: none;
412
438
transform: none;
413
439
}
440
+ .button-link--paddle {
441
+ font-weight: bold;
442
+ }
414
443
.currencies {
415
444
align-items: center;
416
445
display: flex;
@@ -447,6 +476,7 @@ const cssText = `
447
476
flex: none;
448
477
font-weight: 300;
449
478
}
479
+
450
480
.flag {
451
481
background-image: url('/images/flags.svg');
452
482
background-position-y: center;
@@ -479,6 +509,47 @@ const cssText = `
479
509
.flag-au {
480
510
background-position-x: -9em;
481
511
}
512
+
513
+ .payment-methods {
514
+ align-items: center;
515
+ display: flex;
516
+ flex-direction: row;
517
+ gap: 0.75rem;
518
+ justify-content: center;
519
+ margin-top: 0.25rem;
520
+ }
521
+ .payment-methods i {
522
+ background-position: center;
523
+ background-repeat: no-repeat;
524
+ background-size: contain;
525
+ display: inline-block;
526
+ }
527
+ .payment-methods__paypal {
528
+ aspect-ratio: 101 / 32;
529
+ background-image: url(/images/paypal-logo-white.svg);
530
+ height: 1rem;
531
+ }
532
+ .payment-methods__gpay {
533
+ aspect-ratio: 41 / 17;
534
+ background-image: url(/images/icon-gpay.svg);
535
+ height: 1rem;
536
+ }
537
+ .payment-methods__visa {
538
+ aspect-ratio: 1 / 1;
539
+ background-image: url('https://buy.paddle.com/images/icons/visa.svg');
540
+ height: 1.5rem;
541
+ }
542
+ .payment-methods__mastercard {
543
+ aspect-ratio: 1 / 1;
544
+ background-image: url('https://buy.paddle.com/images/icons/mastercard.svg');
545
+ height: 1.5rem;
546
+ }
547
+ .payment-methods__amex {
548
+ aspect-ratio: 1 / 1;
549
+ background-image: url('https://buy.paddle.com/images/icons/amex.svg');
550
+ height: 1.5rem;
551
+ }
552
+
482
553
:host {
483
554
container-type: inline-size;
484
555
font-size: 1.25rem;
@@ -547,4 +618,39 @@ class PlusTiersElement extends HTMLElement {
547
618
}
548
619
}
549
620
621
+ /** @typedef {any } Paddle */
622
+
623
+ let didInitializePaddle = false ;
624
+
625
+ /**
626
+ * @param {PlusTiersElement } element
627
+ */
628
+ async function initPaddle ( element ) {
629
+ /** @type {any } */
630
+ let Paddle ;
631
+ if ( ! didInitializePaddle ) {
632
+ // @ts -ignore
633
+ await import ( 'https://cdn.paddle.com/paddle/v2/paddle.js' ) ;
634
+ Paddle = /** @type {any } */ ( window ) . Paddle ;
635
+ // Paddle.initialize({
636
+ // token: 'live_b32a4d21e35479ee3ea2b849be9',
637
+ // });
638
+ }
639
+ element . shadowRoot ?. querySelector ( '.js-link-paddle' ) ?. addEventListener ( 'click' , ( ) => {
640
+ Paddle . Checkout . open ( {
641
+ token : 'live_b32a4d21e35479ee3ea2b849be9' ,
642
+ settings : {
643
+ displayMode : 'overlay' ,
644
+ variant : 'one-page' ,
645
+ } ,
646
+ items : [
647
+ {
648
+ priceId : 'pri_01je4ebmn474jsee5eh2gmfan9' ,
649
+ quantity : 1 ,
650
+ } ,
651
+ ] ,
652
+ } ) ;
653
+ } ) ;
654
+ }
655
+
550
656
customElements . define ( 'darkreader-plus-tiers' , PlusTiersElement ) ;
0 commit comments