|
| 1 | +<!doctype html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="UTF-8" /> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 6 | + <title>Alma Widgets basic example</title> |
| 7 | + |
| 8 | + <link rel="stylesheet" href="./style.css" /> |
| 9 | + <link rel="stylesheet" href="../dist/widgets.css" /> |
| 10 | + <!-- <link |
| 11 | + rel="stylesheet" |
| 12 | + href="https://cdn.jsdelivr.net/npm/@alma/widgets@4.x/dist/widgets.min.css" |
| 13 | + /> --> |
| 14 | +</head> |
| 15 | +<body> |
| 16 | +<div class="body"> |
| 17 | + <div> |
| 18 | + <img src="../src/assets/alma.svg" class="alma-logo" alt="alma" /> |
| 19 | + </div> |
| 20 | + <div class="menu"> |
| 21 | + <a href="./multiple.html">Multiple widgets</a> |
| 22 | + <a href="./basic.html">Basic page</a> |
| 23 | + </div> |
| 24 | + <div class="main"> |
| 25 | + <div class="image"> |
| 26 | + <img src="./sac-a-main.jpeg" alt="product" /> |
| 27 | + </div> |
| 28 | + |
| 29 | + <div> |
| 30 | + <div class="product"> |
| 31 | + <h1>Sac à main</h1> |
| 32 | + <!-- Generating html tags that matches style from style.css to ensure the widget's css does not impact the site's style. |
| 33 | + In this example file, it is made to be obvious and not pretty see style sheet--> |
| 34 | + <button>Fake button</button> |
| 35 | + <p> The button above should be red with border blue, and the paragraph has a red border and a margin bottom set to 16px. </p> |
| 36 | + <p> Those are style from style.css which is the main style of the page (like the merchant website style) and should not be impacted by the widget style. </p> |
| 37 | + <select onchange="renderPaymentPlans()" id="quantity"> |
| 38 | + <option value="1">1</option> |
| 39 | + <option value="2">2</option> |
| 40 | + <option value="3">3</option> |
| 41 | + <option value="10">10</option> |
| 42 | + </select> |
| 43 | + <h3>450 €</h3> |
| 44 | + <span>This widget should be displayed to respect our design without being impacted by merchant style :</span> |
| 45 | + <div id="alma-widget-payment-plans"></div> |
| 46 | + <br /> |
| 47 | + <span>This widget should be displayed to respect the override made in the style.css file, as a merchant would do to customize our widget :</span> |
| 48 | + <div id="alma-widget-payment-plans-custom"></div> |
| 49 | + <div class="add-to-cart"> |
| 50 | + <button>Ajouter au panier</button> |
| 51 | + </div> |
| 52 | + </div> |
| 53 | + </div> |
| 54 | + </div> |
| 55 | +</div> |
| 56 | +<script src="../dist/widgets.umd.js"></script> |
| 57 | +<!-- <script src="https://cdn.jsdelivr.net/npm/@alma/widgets@4.x/dist/widgets.umd.js"></script> --> |
| 58 | + |
| 59 | +<script> |
| 60 | + var widgets = Alma.Widgets.initialize('11gKoO333vEXacMNMUMUSc4c4g68g2Les4', Alma.ApiMode.TEST) |
| 61 | + function renderPaymentPlans() { |
| 62 | + var purchaseAmount = 450 * 100 * document.getElementById('quantity').value |
| 63 | + widgets.add(Alma.Widgets.PaymentPlans, { |
| 64 | + container: '#alma-widget-payment-plans', |
| 65 | + locale: 'fr', |
| 66 | + purchaseAmount, |
| 67 | + transitionDelay: 1500, |
| 68 | + }) |
| 69 | + } |
| 70 | + function renderPaymentPlansCustom() { |
| 71 | + var purchaseAmount = 450 * 100 * document.getElementById('quantity').value |
| 72 | + widgets.add(Alma.Widgets.PaymentPlans, { |
| 73 | + container: '#alma-widget-payment-plans-custom', |
| 74 | + locale: 'fr', |
| 75 | + purchaseAmount, |
| 76 | + monochrome: false, |
| 77 | + transitionDelay: 1500, |
| 78 | + }) |
| 79 | + } |
| 80 | + renderPaymentPlans() |
| 81 | + renderPaymentPlansCustom() |
| 82 | + |
| 83 | + |
| 84 | +</script> |
| 85 | +</body> |
| 86 | +</html> |
0 commit comments