stripe-pwa-elements 2.0.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/LICENSE +21 -0
- package/dist/cjs/index-aec82bce.js +1698 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/ion-icon.cjs.entry.js +310 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/stripe-elements.cjs.js +19 -0
- package/dist/cjs/stripe-payment-request-button.cjs.entry.js +177 -0
- package/dist/cjs/stripe-payment-sheet.cjs.entry.js +112 -0
- package/dist/cjs/stripe-payment_2.cjs.entry.js +3469 -0
- package/dist/cjs/stripe.esm-648239f0.js +131 -0
- package/dist/collection/collection-manifest.json +22 -0
- package/dist/collection/components/stripe-element-modal/stripe-element-modal.css +62 -0
- package/dist/collection/components/stripe-element-modal/stripe-element-modal.js +162 -0
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.css +3 -0
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +510 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.css +86 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.js +864 -0
- package/dist/collection/components/stripe-payment-sheet-modal/stripe-payment-sheet-modal.css +3 -0
- package/dist/collection/components/stripe-payment-sheet-modal/stripe-payment-sheet-modal.js +495 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/interfaces.js +1 -0
- package/dist/collection/utils/i18n.js +28 -0
- package/dist/collection/utils/platform.js +81 -0
- package/dist/collection/utils/utils.js +27 -0
- package/dist/custom-elements/index.d.ts +63 -0
- package/dist/custom-elements/index.js +4197 -0
- package/dist/esm/index-a7e5d6fd.js +1669 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/ion-icon.entry.js +306 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/stripe-elements.js +17 -0
- package/dist/esm/stripe-payment-request-button.entry.js +173 -0
- package/dist/esm/stripe-payment-sheet.entry.js +108 -0
- package/dist/esm/stripe-payment_2.entry.js +3464 -0
- package/dist/esm/stripe.esm-ea56157a.js +129 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/node_modules/ionicons/dist/collection/components/icon/icon.css +101 -0
- package/dist/stripe-elements/index.esm.js +0 -0
- package/dist/stripe-elements/p-3922cc8d.js +2 -0
- package/dist/stripe-elements/p-50848f78.entry.js +1 -0
- package/dist/stripe-elements/p-56a89bc1.js +1 -0
- package/dist/stripe-elements/p-8e1243b3.entry.js +1 -0
- package/dist/stripe-elements/p-9232a32e.entry.js +1 -0
- package/dist/stripe-elements/p-cdf60a81.entry.js +1 -0
- package/dist/stripe-elements/stripe-elements.esm.js +1 -0
- package/dist/stripe-elements/svg/accessibility-outline.svg +1 -0
- package/dist/stripe-elements/svg/accessibility-sharp.svg +1 -0
- package/dist/stripe-elements/svg/accessibility.svg +1 -0
- package/dist/stripe-elements/svg/add-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/add-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/add-circle.svg +1 -0
- package/dist/stripe-elements/svg/add-outline.svg +1 -0
- package/dist/stripe-elements/svg/add-sharp.svg +1 -0
- package/dist/stripe-elements/svg/add.svg +1 -0
- package/dist/stripe-elements/svg/airplane-outline.svg +1 -0
- package/dist/stripe-elements/svg/airplane-sharp.svg +1 -0
- package/dist/stripe-elements/svg/airplane.svg +1 -0
- package/dist/stripe-elements/svg/alarm-outline.svg +1 -0
- package/dist/stripe-elements/svg/alarm-sharp.svg +1 -0
- package/dist/stripe-elements/svg/alarm.svg +1 -0
- package/dist/stripe-elements/svg/albums-outline.svg +1 -0
- package/dist/stripe-elements/svg/albums-sharp.svg +1 -0
- package/dist/stripe-elements/svg/albums.svg +1 -0
- package/dist/stripe-elements/svg/alert-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/alert-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/alert-circle.svg +1 -0
- package/dist/stripe-elements/svg/alert-outline.svg +1 -0
- package/dist/stripe-elements/svg/alert-sharp.svg +1 -0
- package/dist/stripe-elements/svg/alert.svg +1 -0
- package/dist/stripe-elements/svg/american-football-outline.svg +1 -0
- package/dist/stripe-elements/svg/american-football-sharp.svg +1 -0
- package/dist/stripe-elements/svg/american-football.svg +1 -0
- package/dist/stripe-elements/svg/analytics-outline.svg +1 -0
- package/dist/stripe-elements/svg/analytics-sharp.svg +1 -0
- package/dist/stripe-elements/svg/analytics.svg +1 -0
- package/dist/stripe-elements/svg/aperture-outline.svg +1 -0
- package/dist/stripe-elements/svg/aperture-sharp.svg +1 -0
- package/dist/stripe-elements/svg/aperture.svg +1 -0
- package/dist/stripe-elements/svg/apps-outline.svg +1 -0
- package/dist/stripe-elements/svg/apps-sharp.svg +1 -0
- package/dist/stripe-elements/svg/apps.svg +1 -0
- package/dist/stripe-elements/svg/archive-outline.svg +1 -0
- package/dist/stripe-elements/svg/archive-sharp.svg +1 -0
- package/dist/stripe-elements/svg/archive.svg +1 -0
- package/dist/stripe-elements/svg/arrow-back-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-back-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-back-circle.svg +1 -0
- package/dist/stripe-elements/svg/arrow-back-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-back-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-back.svg +1 -0
- package/dist/stripe-elements/svg/arrow-down-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-down-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-down-circle.svg +1 -0
- package/dist/stripe-elements/svg/arrow-down-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-down-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-down.svg +1 -0
- package/dist/stripe-elements/svg/arrow-forward-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-forward-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-forward-circle.svg +1 -0
- package/dist/stripe-elements/svg/arrow-forward-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-forward-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-forward.svg +1 -0
- package/dist/stripe-elements/svg/arrow-redo-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-redo-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-redo-circle.svg +1 -0
- package/dist/stripe-elements/svg/arrow-redo-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-redo-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-redo.svg +1 -0
- package/dist/stripe-elements/svg/arrow-undo-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-undo-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-undo-circle.svg +1 -0
- package/dist/stripe-elements/svg/arrow-undo-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-undo-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-undo.svg +1 -0
- package/dist/stripe-elements/svg/arrow-up-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-up-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-up-circle.svg +1 -0
- package/dist/stripe-elements/svg/arrow-up-outline.svg +1 -0
- package/dist/stripe-elements/svg/arrow-up-sharp.svg +1 -0
- package/dist/stripe-elements/svg/arrow-up.svg +1 -0
- package/dist/stripe-elements/svg/at-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/at-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/at-circle.svg +1 -0
- package/dist/stripe-elements/svg/at-outline.svg +1 -0
- package/dist/stripe-elements/svg/at-sharp.svg +1 -0
- package/dist/stripe-elements/svg/at.svg +1 -0
- package/dist/stripe-elements/svg/attach-outline.svg +1 -0
- package/dist/stripe-elements/svg/attach-sharp.svg +1 -0
- package/dist/stripe-elements/svg/attach.svg +1 -0
- package/dist/stripe-elements/svg/backspace-outline.svg +1 -0
- package/dist/stripe-elements/svg/backspace-sharp.svg +1 -0
- package/dist/stripe-elements/svg/backspace.svg +1 -0
- package/dist/stripe-elements/svg/bag-add-outline.svg +1 -0
- package/dist/stripe-elements/svg/bag-add-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bag-add.svg +1 -0
- package/dist/stripe-elements/svg/bag-check-outline.svg +1 -0
- package/dist/stripe-elements/svg/bag-check-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bag-check.svg +1 -0
- package/dist/stripe-elements/svg/bag-handle-outline.svg +1 -0
- package/dist/stripe-elements/svg/bag-handle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bag-handle.svg +1 -0
- package/dist/stripe-elements/svg/bag-outline.svg +1 -0
- package/dist/stripe-elements/svg/bag-remove-outline.svg +1 -0
- package/dist/stripe-elements/svg/bag-remove-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bag-remove.svg +1 -0
- package/dist/stripe-elements/svg/bag-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bag.svg +1 -0
- package/dist/stripe-elements/svg/balloon-outline.svg +1 -0
- package/dist/stripe-elements/svg/balloon-sharp.svg +1 -0
- package/dist/stripe-elements/svg/balloon.svg +1 -0
- package/dist/stripe-elements/svg/ban-outline.svg +1 -0
- package/dist/stripe-elements/svg/ban-sharp.svg +1 -0
- package/dist/stripe-elements/svg/ban.svg +1 -0
- package/dist/stripe-elements/svg/bandage-outline.svg +1 -0
- package/dist/stripe-elements/svg/bandage-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bandage.svg +1 -0
- package/dist/stripe-elements/svg/bar-chart-outline.svg +1 -0
- package/dist/stripe-elements/svg/bar-chart-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bar-chart.svg +1 -0
- package/dist/stripe-elements/svg/barbell-outline.svg +1 -0
- package/dist/stripe-elements/svg/barbell-sharp.svg +1 -0
- package/dist/stripe-elements/svg/barbell.svg +1 -0
- package/dist/stripe-elements/svg/barcode-outline.svg +1 -0
- package/dist/stripe-elements/svg/barcode-sharp.svg +1 -0
- package/dist/stripe-elements/svg/barcode.svg +1 -0
- package/dist/stripe-elements/svg/baseball-outline.svg +1 -0
- package/dist/stripe-elements/svg/baseball-sharp.svg +1 -0
- package/dist/stripe-elements/svg/baseball.svg +1 -0
- package/dist/stripe-elements/svg/basket-outline.svg +1 -0
- package/dist/stripe-elements/svg/basket-sharp.svg +1 -0
- package/dist/stripe-elements/svg/basket.svg +1 -0
- package/dist/stripe-elements/svg/basketball-outline.svg +1 -0
- package/dist/stripe-elements/svg/basketball-sharp.svg +1 -0
- package/dist/stripe-elements/svg/basketball.svg +1 -0
- package/dist/stripe-elements/svg/battery-charging-outline.svg +1 -0
- package/dist/stripe-elements/svg/battery-charging-sharp.svg +1 -0
- package/dist/stripe-elements/svg/battery-charging.svg +1 -0
- package/dist/stripe-elements/svg/battery-dead-outline.svg +1 -0
- package/dist/stripe-elements/svg/battery-dead-sharp.svg +1 -0
- package/dist/stripe-elements/svg/battery-dead.svg +1 -0
- package/dist/stripe-elements/svg/battery-full-outline.svg +1 -0
- package/dist/stripe-elements/svg/battery-full-sharp.svg +1 -0
- package/dist/stripe-elements/svg/battery-full.svg +1 -0
- package/dist/stripe-elements/svg/battery-half-outline.svg +1 -0
- package/dist/stripe-elements/svg/battery-half-sharp.svg +1 -0
- package/dist/stripe-elements/svg/battery-half.svg +1 -0
- package/dist/stripe-elements/svg/beaker-outline.svg +1 -0
- package/dist/stripe-elements/svg/beaker-sharp.svg +1 -0
- package/dist/stripe-elements/svg/beaker.svg +1 -0
- package/dist/stripe-elements/svg/bed-outline.svg +1 -0
- package/dist/stripe-elements/svg/bed-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bed.svg +1 -0
- package/dist/stripe-elements/svg/beer-outline.svg +1 -0
- package/dist/stripe-elements/svg/beer-sharp.svg +1 -0
- package/dist/stripe-elements/svg/beer.svg +1 -0
- package/dist/stripe-elements/svg/bicycle-outline.svg +1 -0
- package/dist/stripe-elements/svg/bicycle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bicycle.svg +1 -0
- package/dist/stripe-elements/svg/bluetooth-outline.svg +1 -0
- package/dist/stripe-elements/svg/bluetooth-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bluetooth.svg +1 -0
- package/dist/stripe-elements/svg/boat-outline.svg +1 -0
- package/dist/stripe-elements/svg/boat-sharp.svg +1 -0
- package/dist/stripe-elements/svg/boat.svg +1 -0
- package/dist/stripe-elements/svg/body-outline.svg +1 -0
- package/dist/stripe-elements/svg/body-sharp.svg +1 -0
- package/dist/stripe-elements/svg/body.svg +1 -0
- package/dist/stripe-elements/svg/bonfire-outline.svg +1 -0
- package/dist/stripe-elements/svg/bonfire-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bonfire.svg +1 -0
- package/dist/stripe-elements/svg/book-outline.svg +1 -0
- package/dist/stripe-elements/svg/book-sharp.svg +1 -0
- package/dist/stripe-elements/svg/book.svg +1 -0
- package/dist/stripe-elements/svg/bookmark-outline.svg +1 -0
- package/dist/stripe-elements/svg/bookmark-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bookmark.svg +1 -0
- package/dist/stripe-elements/svg/bookmarks-outline.svg +1 -0
- package/dist/stripe-elements/svg/bookmarks-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bookmarks.svg +1 -0
- package/dist/stripe-elements/svg/bowling-ball-outline.svg +1 -0
- package/dist/stripe-elements/svg/bowling-ball-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bowling-ball.svg +1 -0
- package/dist/stripe-elements/svg/briefcase-outline.svg +1 -0
- package/dist/stripe-elements/svg/briefcase-sharp.svg +1 -0
- package/dist/stripe-elements/svg/briefcase.svg +1 -0
- package/dist/stripe-elements/svg/browsers-outline.svg +1 -0
- package/dist/stripe-elements/svg/browsers-sharp.svg +1 -0
- package/dist/stripe-elements/svg/browsers.svg +1 -0
- package/dist/stripe-elements/svg/brush-outline.svg +1 -0
- package/dist/stripe-elements/svg/brush-sharp.svg +1 -0
- package/dist/stripe-elements/svg/brush.svg +1 -0
- package/dist/stripe-elements/svg/bug-outline.svg +1 -0
- package/dist/stripe-elements/svg/bug-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bug.svg +1 -0
- package/dist/stripe-elements/svg/build-outline.svg +1 -0
- package/dist/stripe-elements/svg/build-sharp.svg +1 -0
- package/dist/stripe-elements/svg/build.svg +1 -0
- package/dist/stripe-elements/svg/bulb-outline.svg +1 -0
- package/dist/stripe-elements/svg/bulb-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bulb.svg +1 -0
- package/dist/stripe-elements/svg/bus-outline.svg +1 -0
- package/dist/stripe-elements/svg/bus-sharp.svg +1 -0
- package/dist/stripe-elements/svg/bus.svg +1 -0
- package/dist/stripe-elements/svg/business-outline.svg +1 -0
- package/dist/stripe-elements/svg/business-sharp.svg +1 -0
- package/dist/stripe-elements/svg/business.svg +1 -0
- package/dist/stripe-elements/svg/cafe-outline.svg +1 -0
- package/dist/stripe-elements/svg/cafe-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cafe.svg +1 -0
- package/dist/stripe-elements/svg/calculator-outline.svg +1 -0
- package/dist/stripe-elements/svg/calculator-sharp.svg +1 -0
- package/dist/stripe-elements/svg/calculator.svg +1 -0
- package/dist/stripe-elements/svg/calendar-clear-outline.svg +1 -0
- package/dist/stripe-elements/svg/calendar-clear-sharp.svg +1 -0
- package/dist/stripe-elements/svg/calendar-clear.svg +1 -0
- package/dist/stripe-elements/svg/calendar-number-outline.svg +1 -0
- package/dist/stripe-elements/svg/calendar-number-sharp.svg +1 -0
- package/dist/stripe-elements/svg/calendar-number.svg +1 -0
- package/dist/stripe-elements/svg/calendar-outline.svg +1 -0
- package/dist/stripe-elements/svg/calendar-sharp.svg +1 -0
- package/dist/stripe-elements/svg/calendar.svg +1 -0
- package/dist/stripe-elements/svg/call-outline.svg +1 -0
- package/dist/stripe-elements/svg/call-sharp.svg +1 -0
- package/dist/stripe-elements/svg/call.svg +1 -0
- package/dist/stripe-elements/svg/camera-outline.svg +1 -0
- package/dist/stripe-elements/svg/camera-reverse-outline.svg +1 -0
- package/dist/stripe-elements/svg/camera-reverse-sharp.svg +1 -0
- package/dist/stripe-elements/svg/camera-reverse.svg +1 -0
- package/dist/stripe-elements/svg/camera-sharp.svg +1 -0
- package/dist/stripe-elements/svg/camera.svg +1 -0
- package/dist/stripe-elements/svg/car-outline.svg +1 -0
- package/dist/stripe-elements/svg/car-sharp.svg +1 -0
- package/dist/stripe-elements/svg/car-sport-outline.svg +1 -0
- package/dist/stripe-elements/svg/car-sport-sharp.svg +1 -0
- package/dist/stripe-elements/svg/car-sport.svg +1 -0
- package/dist/stripe-elements/svg/car.svg +1 -0
- package/dist/stripe-elements/svg/card-outline.svg +1 -0
- package/dist/stripe-elements/svg/card-sharp.svg +1 -0
- package/dist/stripe-elements/svg/card.svg +1 -0
- package/dist/stripe-elements/svg/caret-back-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/caret-back-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/caret-back-circle.svg +1 -0
- package/dist/stripe-elements/svg/caret-back-outline.svg +1 -0
- package/dist/stripe-elements/svg/caret-back-sharp.svg +1 -0
- package/dist/stripe-elements/svg/caret-back.svg +1 -0
- package/dist/stripe-elements/svg/caret-down-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/caret-down-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/caret-down-circle.svg +1 -0
- package/dist/stripe-elements/svg/caret-down-outline.svg +1 -0
- package/dist/stripe-elements/svg/caret-down-sharp.svg +1 -0
- package/dist/stripe-elements/svg/caret-down.svg +1 -0
- package/dist/stripe-elements/svg/caret-forward-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/caret-forward-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/caret-forward-circle.svg +1 -0
- package/dist/stripe-elements/svg/caret-forward-outline.svg +1 -0
- package/dist/stripe-elements/svg/caret-forward-sharp.svg +1 -0
- package/dist/stripe-elements/svg/caret-forward.svg +1 -0
- package/dist/stripe-elements/svg/caret-up-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/caret-up-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/caret-up-circle.svg +1 -0
- package/dist/stripe-elements/svg/caret-up-outline.svg +1 -0
- package/dist/stripe-elements/svg/caret-up-sharp.svg +1 -0
- package/dist/stripe-elements/svg/caret-up.svg +1 -0
- package/dist/stripe-elements/svg/cart-outline.svg +1 -0
- package/dist/stripe-elements/svg/cart-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cart.svg +1 -0
- package/dist/stripe-elements/svg/cash-outline.svg +1 -0
- package/dist/stripe-elements/svg/cash-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cash.svg +1 -0
- package/dist/stripe-elements/svg/cellular-outline.svg +1 -0
- package/dist/stripe-elements/svg/cellular-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cellular.svg +1 -0
- package/dist/stripe-elements/svg/chatbox-ellipses-outline.svg +1 -0
- package/dist/stripe-elements/svg/chatbox-ellipses-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chatbox-ellipses.svg +1 -0
- package/dist/stripe-elements/svg/chatbox-outline.svg +1 -0
- package/dist/stripe-elements/svg/chatbox-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chatbox.svg +1 -0
- package/dist/stripe-elements/svg/chatbubble-ellipses-outline.svg +1 -0
- package/dist/stripe-elements/svg/chatbubble-ellipses-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chatbubble-ellipses.svg +1 -0
- package/dist/stripe-elements/svg/chatbubble-outline.svg +1 -0
- package/dist/stripe-elements/svg/chatbubble-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chatbubble.svg +1 -0
- package/dist/stripe-elements/svg/chatbubbles-outline.svg +1 -0
- package/dist/stripe-elements/svg/chatbubbles-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chatbubbles.svg +1 -0
- package/dist/stripe-elements/svg/checkbox-outline.svg +1 -0
- package/dist/stripe-elements/svg/checkbox-sharp.svg +1 -0
- package/dist/stripe-elements/svg/checkbox.svg +1 -0
- package/dist/stripe-elements/svg/checkmark-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/checkmark-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/checkmark-circle.svg +1 -0
- package/dist/stripe-elements/svg/checkmark-done-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/checkmark-done-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/checkmark-done-circle.svg +1 -0
- package/dist/stripe-elements/svg/checkmark-done-outline.svg +1 -0
- package/dist/stripe-elements/svg/checkmark-done-sharp.svg +1 -0
- package/dist/stripe-elements/svg/checkmark-done.svg +1 -0
- package/dist/stripe-elements/svg/checkmark-outline.svg +1 -0
- package/dist/stripe-elements/svg/checkmark-sharp.svg +1 -0
- package/dist/stripe-elements/svg/checkmark.svg +1 -0
- package/dist/stripe-elements/svg/chevron-back-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/chevron-back-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chevron-back-circle.svg +1 -0
- package/dist/stripe-elements/svg/chevron-back-outline.svg +1 -0
- package/dist/stripe-elements/svg/chevron-back-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chevron-back.svg +1 -0
- package/dist/stripe-elements/svg/chevron-down-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/chevron-down-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chevron-down-circle.svg +1 -0
- package/dist/stripe-elements/svg/chevron-down-outline.svg +1 -0
- package/dist/stripe-elements/svg/chevron-down-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chevron-down.svg +1 -0
- package/dist/stripe-elements/svg/chevron-forward-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/chevron-forward-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chevron-forward-circle.svg +1 -0
- package/dist/stripe-elements/svg/chevron-forward-outline.svg +1 -0
- package/dist/stripe-elements/svg/chevron-forward-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chevron-forward.svg +1 -0
- package/dist/stripe-elements/svg/chevron-up-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/chevron-up-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chevron-up-circle.svg +1 -0
- package/dist/stripe-elements/svg/chevron-up-outline.svg +1 -0
- package/dist/stripe-elements/svg/chevron-up-sharp.svg +1 -0
- package/dist/stripe-elements/svg/chevron-up.svg +1 -0
- package/dist/stripe-elements/svg/clipboard-outline.svg +1 -0
- package/dist/stripe-elements/svg/clipboard-sharp.svg +1 -0
- package/dist/stripe-elements/svg/clipboard.svg +1 -0
- package/dist/stripe-elements/svg/close-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/close-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/close-circle.svg +1 -0
- package/dist/stripe-elements/svg/close-outline.svg +1 -0
- package/dist/stripe-elements/svg/close-sharp.svg +1 -0
- package/dist/stripe-elements/svg/close.svg +1 -0
- package/dist/stripe-elements/svg/cloud-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/cloud-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cloud-circle.svg +1 -0
- package/dist/stripe-elements/svg/cloud-done-outline.svg +1 -0
- package/dist/stripe-elements/svg/cloud-done-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cloud-done.svg +1 -0
- package/dist/stripe-elements/svg/cloud-download-outline.svg +1 -0
- package/dist/stripe-elements/svg/cloud-download-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cloud-download.svg +1 -0
- package/dist/stripe-elements/svg/cloud-offline-outline.svg +1 -0
- package/dist/stripe-elements/svg/cloud-offline-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cloud-offline.svg +1 -0
- package/dist/stripe-elements/svg/cloud-outline.svg +1 -0
- package/dist/stripe-elements/svg/cloud-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cloud-upload-outline.svg +1 -0
- package/dist/stripe-elements/svg/cloud-upload-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cloud-upload.svg +1 -0
- package/dist/stripe-elements/svg/cloud.svg +1 -0
- package/dist/stripe-elements/svg/cloudy-night-outline.svg +1 -0
- package/dist/stripe-elements/svg/cloudy-night-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cloudy-night.svg +1 -0
- package/dist/stripe-elements/svg/cloudy-outline.svg +1 -0
- package/dist/stripe-elements/svg/cloudy-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cloudy.svg +1 -0
- package/dist/stripe-elements/svg/code-download-outline.svg +1 -0
- package/dist/stripe-elements/svg/code-download-sharp.svg +1 -0
- package/dist/stripe-elements/svg/code-download.svg +1 -0
- package/dist/stripe-elements/svg/code-outline.svg +1 -0
- package/dist/stripe-elements/svg/code-sharp.svg +1 -0
- package/dist/stripe-elements/svg/code-slash-outline.svg +1 -0
- package/dist/stripe-elements/svg/code-slash-sharp.svg +1 -0
- package/dist/stripe-elements/svg/code-slash.svg +1 -0
- package/dist/stripe-elements/svg/code-working-outline.svg +1 -0
- package/dist/stripe-elements/svg/code-working-sharp.svg +1 -0
- package/dist/stripe-elements/svg/code-working.svg +1 -0
- package/dist/stripe-elements/svg/code.svg +1 -0
- package/dist/stripe-elements/svg/cog-outline.svg +1 -0
- package/dist/stripe-elements/svg/cog-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cog.svg +1 -0
- package/dist/stripe-elements/svg/color-fill-outline.svg +1 -0
- package/dist/stripe-elements/svg/color-fill-sharp.svg +1 -0
- package/dist/stripe-elements/svg/color-fill.svg +1 -0
- package/dist/stripe-elements/svg/color-filter-outline.svg +1 -0
- package/dist/stripe-elements/svg/color-filter-sharp.svg +1 -0
- package/dist/stripe-elements/svg/color-filter.svg +1 -0
- package/dist/stripe-elements/svg/color-palette-outline.svg +1 -0
- package/dist/stripe-elements/svg/color-palette-sharp.svg +1 -0
- package/dist/stripe-elements/svg/color-palette.svg +1 -0
- package/dist/stripe-elements/svg/color-wand-outline.svg +1 -0
- package/dist/stripe-elements/svg/color-wand-sharp.svg +1 -0
- package/dist/stripe-elements/svg/color-wand.svg +1 -0
- package/dist/stripe-elements/svg/compass-outline.svg +1 -0
- package/dist/stripe-elements/svg/compass-sharp.svg +1 -0
- package/dist/stripe-elements/svg/compass.svg +1 -0
- package/dist/stripe-elements/svg/construct-outline.svg +1 -0
- package/dist/stripe-elements/svg/construct-sharp.svg +1 -0
- package/dist/stripe-elements/svg/construct.svg +1 -0
- package/dist/stripe-elements/svg/contract-outline.svg +1 -0
- package/dist/stripe-elements/svg/contract-sharp.svg +1 -0
- package/dist/stripe-elements/svg/contract.svg +1 -0
- package/dist/stripe-elements/svg/contrast-outline.svg +1 -0
- package/dist/stripe-elements/svg/contrast-sharp.svg +1 -0
- package/dist/stripe-elements/svg/contrast.svg +1 -0
- package/dist/stripe-elements/svg/copy-outline.svg +1 -0
- package/dist/stripe-elements/svg/copy-sharp.svg +1 -0
- package/dist/stripe-elements/svg/copy.svg +1 -0
- package/dist/stripe-elements/svg/create-outline.svg +1 -0
- package/dist/stripe-elements/svg/create-sharp.svg +1 -0
- package/dist/stripe-elements/svg/create.svg +1 -0
- package/dist/stripe-elements/svg/crop-outline.svg +1 -0
- package/dist/stripe-elements/svg/crop-sharp.svg +1 -0
- package/dist/stripe-elements/svg/crop.svg +1 -0
- package/dist/stripe-elements/svg/cube-outline.svg +1 -0
- package/dist/stripe-elements/svg/cube-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cube.svg +1 -0
- package/dist/stripe-elements/svg/cut-outline.svg +1 -0
- package/dist/stripe-elements/svg/cut-sharp.svg +1 -0
- package/dist/stripe-elements/svg/cut.svg +1 -0
- package/dist/stripe-elements/svg/desktop-outline.svg +1 -0
- package/dist/stripe-elements/svg/desktop-sharp.svg +1 -0
- package/dist/stripe-elements/svg/desktop.svg +1 -0
- package/dist/stripe-elements/svg/diamond-outline.svg +1 -0
- package/dist/stripe-elements/svg/diamond-sharp.svg +1 -0
- package/dist/stripe-elements/svg/diamond.svg +1 -0
- package/dist/stripe-elements/svg/dice-outline.svg +1 -0
- package/dist/stripe-elements/svg/dice-sharp.svg +1 -0
- package/dist/stripe-elements/svg/dice.svg +1 -0
- package/dist/stripe-elements/svg/disc-outline.svg +1 -0
- package/dist/stripe-elements/svg/disc-sharp.svg +1 -0
- package/dist/stripe-elements/svg/disc.svg +1 -0
- package/dist/stripe-elements/svg/document-attach-outline.svg +1 -0
- package/dist/stripe-elements/svg/document-attach-sharp.svg +1 -0
- package/dist/stripe-elements/svg/document-attach.svg +1 -0
- package/dist/stripe-elements/svg/document-lock-outline.svg +1 -0
- package/dist/stripe-elements/svg/document-lock-sharp.svg +1 -0
- package/dist/stripe-elements/svg/document-lock.svg +1 -0
- package/dist/stripe-elements/svg/document-outline.svg +1 -0
- package/dist/stripe-elements/svg/document-sharp.svg +1 -0
- package/dist/stripe-elements/svg/document-text-outline.svg +1 -0
- package/dist/stripe-elements/svg/document-text-sharp.svg +1 -0
- package/dist/stripe-elements/svg/document-text.svg +1 -0
- package/dist/stripe-elements/svg/document.svg +1 -0
- package/dist/stripe-elements/svg/documents-outline.svg +1 -0
- package/dist/stripe-elements/svg/documents-sharp.svg +1 -0
- package/dist/stripe-elements/svg/documents.svg +1 -0
- package/dist/stripe-elements/svg/download-outline.svg +1 -0
- package/dist/stripe-elements/svg/download-sharp.svg +1 -0
- package/dist/stripe-elements/svg/download.svg +1 -0
- package/dist/stripe-elements/svg/duplicate-outline.svg +1 -0
- package/dist/stripe-elements/svg/duplicate-sharp.svg +1 -0
- package/dist/stripe-elements/svg/duplicate.svg +1 -0
- package/dist/stripe-elements/svg/ear-outline.svg +1 -0
- package/dist/stripe-elements/svg/ear-sharp.svg +1 -0
- package/dist/stripe-elements/svg/ear.svg +1 -0
- package/dist/stripe-elements/svg/earth-outline.svg +1 -0
- package/dist/stripe-elements/svg/earth-sharp.svg +1 -0
- package/dist/stripe-elements/svg/earth.svg +1 -0
- package/dist/stripe-elements/svg/easel-outline.svg +1 -0
- package/dist/stripe-elements/svg/easel-sharp.svg +1 -0
- package/dist/stripe-elements/svg/easel.svg +1 -0
- package/dist/stripe-elements/svg/egg-outline.svg +1 -0
- package/dist/stripe-elements/svg/egg-sharp.svg +1 -0
- package/dist/stripe-elements/svg/egg.svg +1 -0
- package/dist/stripe-elements/svg/ellipse-outline.svg +1 -0
- package/dist/stripe-elements/svg/ellipse-sharp.svg +1 -0
- package/dist/stripe-elements/svg/ellipse.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-horizontal-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-horizontal-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-horizontal-circle.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-horizontal-outline.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-horizontal-sharp.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-horizontal.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-vertical-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-vertical-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-vertical-circle.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-vertical-outline.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-vertical-sharp.svg +1 -0
- package/dist/stripe-elements/svg/ellipsis-vertical.svg +1 -0
- package/dist/stripe-elements/svg/enter-outline.svg +1 -0
- package/dist/stripe-elements/svg/enter-sharp.svg +1 -0
- package/dist/stripe-elements/svg/enter.svg +1 -0
- package/dist/stripe-elements/svg/exit-outline.svg +1 -0
- package/dist/stripe-elements/svg/exit-sharp.svg +1 -0
- package/dist/stripe-elements/svg/exit.svg +1 -0
- package/dist/stripe-elements/svg/expand-outline.svg +1 -0
- package/dist/stripe-elements/svg/expand-sharp.svg +1 -0
- package/dist/stripe-elements/svg/expand.svg +1 -0
- package/dist/stripe-elements/svg/extension-puzzle-outline.svg +1 -0
- package/dist/stripe-elements/svg/extension-puzzle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/extension-puzzle.svg +1 -0
- package/dist/stripe-elements/svg/eye-off-outline.svg +1 -0
- package/dist/stripe-elements/svg/eye-off-sharp.svg +1 -0
- package/dist/stripe-elements/svg/eye-off.svg +1 -0
- package/dist/stripe-elements/svg/eye-outline.svg +1 -0
- package/dist/stripe-elements/svg/eye-sharp.svg +1 -0
- package/dist/stripe-elements/svg/eye.svg +1 -0
- package/dist/stripe-elements/svg/eyedrop-outline.svg +1 -0
- package/dist/stripe-elements/svg/eyedrop-sharp.svg +1 -0
- package/dist/stripe-elements/svg/eyedrop.svg +1 -0
- package/dist/stripe-elements/svg/fast-food-outline.svg +1 -0
- package/dist/stripe-elements/svg/fast-food-sharp.svg +1 -0
- package/dist/stripe-elements/svg/fast-food.svg +1 -0
- package/dist/stripe-elements/svg/female-outline.svg +1 -0
- package/dist/stripe-elements/svg/female-sharp.svg +1 -0
- package/dist/stripe-elements/svg/female.svg +1 -0
- package/dist/stripe-elements/svg/file-tray-full-outline.svg +1 -0
- package/dist/stripe-elements/svg/file-tray-full-sharp.svg +1 -0
- package/dist/stripe-elements/svg/file-tray-full.svg +1 -0
- package/dist/stripe-elements/svg/file-tray-outline.svg +1 -0
- package/dist/stripe-elements/svg/file-tray-sharp.svg +1 -0
- package/dist/stripe-elements/svg/file-tray-stacked-outline.svg +1 -0
- package/dist/stripe-elements/svg/file-tray-stacked-sharp.svg +1 -0
- package/dist/stripe-elements/svg/file-tray-stacked.svg +1 -0
- package/dist/stripe-elements/svg/file-tray.svg +1 -0
- package/dist/stripe-elements/svg/film-outline.svg +1 -0
- package/dist/stripe-elements/svg/film-sharp.svg +1 -0
- package/dist/stripe-elements/svg/film.svg +1 -0
- package/dist/stripe-elements/svg/filter-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/filter-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/filter-circle.svg +1 -0
- package/dist/stripe-elements/svg/filter-outline.svg +1 -0
- package/dist/stripe-elements/svg/filter-sharp.svg +1 -0
- package/dist/stripe-elements/svg/filter.svg +1 -0
- package/dist/stripe-elements/svg/finger-print-outline.svg +1 -0
- package/dist/stripe-elements/svg/finger-print-sharp.svg +1 -0
- package/dist/stripe-elements/svg/finger-print.svg +1 -0
- package/dist/stripe-elements/svg/fish-outline.svg +1 -0
- package/dist/stripe-elements/svg/fish-sharp.svg +1 -0
- package/dist/stripe-elements/svg/fish.svg +1 -0
- package/dist/stripe-elements/svg/fitness-outline.svg +1 -0
- package/dist/stripe-elements/svg/fitness-sharp.svg +1 -0
- package/dist/stripe-elements/svg/fitness.svg +1 -0
- package/dist/stripe-elements/svg/flag-outline.svg +1 -0
- package/dist/stripe-elements/svg/flag-sharp.svg +1 -0
- package/dist/stripe-elements/svg/flag.svg +1 -0
- package/dist/stripe-elements/svg/flame-outline.svg +1 -0
- package/dist/stripe-elements/svg/flame-sharp.svg +1 -0
- package/dist/stripe-elements/svg/flame.svg +1 -0
- package/dist/stripe-elements/svg/flash-off-outline.svg +1 -0
- package/dist/stripe-elements/svg/flash-off-sharp.svg +1 -0
- package/dist/stripe-elements/svg/flash-off.svg +1 -0
- package/dist/stripe-elements/svg/flash-outline.svg +1 -0
- package/dist/stripe-elements/svg/flash-sharp.svg +1 -0
- package/dist/stripe-elements/svg/flash.svg +1 -0
- package/dist/stripe-elements/svg/flashlight-outline.svg +1 -0
- package/dist/stripe-elements/svg/flashlight-sharp.svg +1 -0
- package/dist/stripe-elements/svg/flashlight.svg +1 -0
- package/dist/stripe-elements/svg/flask-outline.svg +1 -0
- package/dist/stripe-elements/svg/flask-sharp.svg +1 -0
- package/dist/stripe-elements/svg/flask.svg +1 -0
- package/dist/stripe-elements/svg/flower-outline.svg +1 -0
- package/dist/stripe-elements/svg/flower-sharp.svg +1 -0
- package/dist/stripe-elements/svg/flower.svg +1 -0
- package/dist/stripe-elements/svg/folder-open-outline.svg +1 -0
- package/dist/stripe-elements/svg/folder-open-sharp.svg +1 -0
- package/dist/stripe-elements/svg/folder-open.svg +1 -0
- package/dist/stripe-elements/svg/folder-outline.svg +1 -0
- package/dist/stripe-elements/svg/folder-sharp.svg +1 -0
- package/dist/stripe-elements/svg/folder.svg +1 -0
- package/dist/stripe-elements/svg/football-outline.svg +1 -0
- package/dist/stripe-elements/svg/football-sharp.svg +1 -0
- package/dist/stripe-elements/svg/football.svg +1 -0
- package/dist/stripe-elements/svg/footsteps-outline.svg +1 -0
- package/dist/stripe-elements/svg/footsteps-sharp.svg +1 -0
- package/dist/stripe-elements/svg/footsteps.svg +1 -0
- package/dist/stripe-elements/svg/funnel-outline.svg +1 -0
- package/dist/stripe-elements/svg/funnel-sharp.svg +1 -0
- package/dist/stripe-elements/svg/funnel.svg +1 -0
- package/dist/stripe-elements/svg/game-controller-outline.svg +1 -0
- package/dist/stripe-elements/svg/game-controller-sharp.svg +1 -0
- package/dist/stripe-elements/svg/game-controller.svg +1 -0
- package/dist/stripe-elements/svg/gift-outline.svg +1 -0
- package/dist/stripe-elements/svg/gift-sharp.svg +1 -0
- package/dist/stripe-elements/svg/gift.svg +1 -0
- package/dist/stripe-elements/svg/git-branch-outline.svg +1 -0
- package/dist/stripe-elements/svg/git-branch-sharp.svg +1 -0
- package/dist/stripe-elements/svg/git-branch.svg +1 -0
- package/dist/stripe-elements/svg/git-commit-outline.svg +1 -0
- package/dist/stripe-elements/svg/git-commit-sharp.svg +1 -0
- package/dist/stripe-elements/svg/git-commit.svg +1 -0
- package/dist/stripe-elements/svg/git-compare-outline.svg +1 -0
- package/dist/stripe-elements/svg/git-compare-sharp.svg +1 -0
- package/dist/stripe-elements/svg/git-compare.svg +1 -0
- package/dist/stripe-elements/svg/git-merge-outline.svg +1 -0
- package/dist/stripe-elements/svg/git-merge-sharp.svg +1 -0
- package/dist/stripe-elements/svg/git-merge.svg +1 -0
- package/dist/stripe-elements/svg/git-network-outline.svg +1 -0
- package/dist/stripe-elements/svg/git-network-sharp.svg +1 -0
- package/dist/stripe-elements/svg/git-network.svg +1 -0
- package/dist/stripe-elements/svg/git-pull-request-outline.svg +1 -0
- package/dist/stripe-elements/svg/git-pull-request-sharp.svg +1 -0
- package/dist/stripe-elements/svg/git-pull-request.svg +1 -0
- package/dist/stripe-elements/svg/glasses-outline.svg +1 -0
- package/dist/stripe-elements/svg/glasses-sharp.svg +1 -0
- package/dist/stripe-elements/svg/glasses.svg +1 -0
- package/dist/stripe-elements/svg/globe-outline.svg +1 -0
- package/dist/stripe-elements/svg/globe-sharp.svg +1 -0
- package/dist/stripe-elements/svg/globe.svg +1 -0
- package/dist/stripe-elements/svg/golf-outline.svg +1 -0
- package/dist/stripe-elements/svg/golf-sharp.svg +1 -0
- package/dist/stripe-elements/svg/golf.svg +1 -0
- package/dist/stripe-elements/svg/grid-outline.svg +1 -0
- package/dist/stripe-elements/svg/grid-sharp.svg +1 -0
- package/dist/stripe-elements/svg/grid.svg +1 -0
- package/dist/stripe-elements/svg/hammer-outline.svg +1 -0
- package/dist/stripe-elements/svg/hammer-sharp.svg +1 -0
- package/dist/stripe-elements/svg/hammer.svg +1 -0
- package/dist/stripe-elements/svg/hand-left-outline.svg +1 -0
- package/dist/stripe-elements/svg/hand-left-sharp.svg +1 -0
- package/dist/stripe-elements/svg/hand-left.svg +1 -0
- package/dist/stripe-elements/svg/hand-right-outline.svg +1 -0
- package/dist/stripe-elements/svg/hand-right-sharp.svg +1 -0
- package/dist/stripe-elements/svg/hand-right.svg +1 -0
- package/dist/stripe-elements/svg/happy-outline.svg +1 -0
- package/dist/stripe-elements/svg/happy-sharp.svg +1 -0
- package/dist/stripe-elements/svg/happy.svg +1 -0
- package/dist/stripe-elements/svg/hardware-chip-outline.svg +1 -0
- package/dist/stripe-elements/svg/hardware-chip-sharp.svg +1 -0
- package/dist/stripe-elements/svg/hardware-chip.svg +1 -0
- package/dist/stripe-elements/svg/headset-outline.svg +1 -0
- package/dist/stripe-elements/svg/headset-sharp.svg +1 -0
- package/dist/stripe-elements/svg/headset.svg +1 -0
- package/dist/stripe-elements/svg/heart-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/heart-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/heart-circle.svg +1 -0
- package/dist/stripe-elements/svg/heart-dislike-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/heart-dislike-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/heart-dislike-circle.svg +1 -0
- package/dist/stripe-elements/svg/heart-dislike-outline.svg +1 -0
- package/dist/stripe-elements/svg/heart-dislike-sharp.svg +1 -0
- package/dist/stripe-elements/svg/heart-dislike.svg +1 -0
- package/dist/stripe-elements/svg/heart-half-outline.svg +1 -0
- package/dist/stripe-elements/svg/heart-half-sharp.svg +1 -0
- package/dist/stripe-elements/svg/heart-half.svg +1 -0
- package/dist/stripe-elements/svg/heart-outline.svg +1 -0
- package/dist/stripe-elements/svg/heart-sharp.svg +1 -0
- package/dist/stripe-elements/svg/heart.svg +1 -0
- package/dist/stripe-elements/svg/help-buoy-outline.svg +1 -0
- package/dist/stripe-elements/svg/help-buoy-sharp.svg +1 -0
- package/dist/stripe-elements/svg/help-buoy.svg +1 -0
- package/dist/stripe-elements/svg/help-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/help-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/help-circle.svg +1 -0
- package/dist/stripe-elements/svg/help-outline.svg +1 -0
- package/dist/stripe-elements/svg/help-sharp.svg +1 -0
- package/dist/stripe-elements/svg/help.svg +1 -0
- package/dist/stripe-elements/svg/home-outline.svg +1 -0
- package/dist/stripe-elements/svg/home-sharp.svg +1 -0
- package/dist/stripe-elements/svg/home.svg +1 -0
- package/dist/stripe-elements/svg/hourglass-outline.svg +1 -0
- package/dist/stripe-elements/svg/hourglass-sharp.svg +1 -0
- package/dist/stripe-elements/svg/hourglass.svg +1 -0
- package/dist/stripe-elements/svg/ice-cream-outline.svg +1 -0
- package/dist/stripe-elements/svg/ice-cream-sharp.svg +1 -0
- package/dist/stripe-elements/svg/ice-cream.svg +1 -0
- package/dist/stripe-elements/svg/id-card-outline.svg +1 -0
- package/dist/stripe-elements/svg/id-card-sharp.svg +1 -0
- package/dist/stripe-elements/svg/id-card.svg +1 -0
- package/dist/stripe-elements/svg/image-outline.svg +1 -0
- package/dist/stripe-elements/svg/image-sharp.svg +1 -0
- package/dist/stripe-elements/svg/image.svg +1 -0
- package/dist/stripe-elements/svg/images-outline.svg +1 -0
- package/dist/stripe-elements/svg/images-sharp.svg +1 -0
- package/dist/stripe-elements/svg/images.svg +1 -0
- package/dist/stripe-elements/svg/infinite-outline.svg +1 -0
- package/dist/stripe-elements/svg/infinite-sharp.svg +1 -0
- package/dist/stripe-elements/svg/infinite.svg +1 -0
- package/dist/stripe-elements/svg/information-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/information-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/information-circle.svg +1 -0
- package/dist/stripe-elements/svg/information-outline.svg +1 -0
- package/dist/stripe-elements/svg/information-sharp.svg +1 -0
- package/dist/stripe-elements/svg/information.svg +1 -0
- package/dist/stripe-elements/svg/invert-mode-outline.svg +1 -0
- package/dist/stripe-elements/svg/invert-mode-sharp.svg +1 -0
- package/dist/stripe-elements/svg/invert-mode.svg +1 -0
- package/dist/stripe-elements/svg/journal-outline.svg +1 -0
- package/dist/stripe-elements/svg/journal-sharp.svg +1 -0
- package/dist/stripe-elements/svg/journal.svg +1 -0
- package/dist/stripe-elements/svg/key-outline.svg +1 -0
- package/dist/stripe-elements/svg/key-sharp.svg +1 -0
- package/dist/stripe-elements/svg/key.svg +1 -0
- package/dist/stripe-elements/svg/keypad-outline.svg +1 -0
- package/dist/stripe-elements/svg/keypad-sharp.svg +1 -0
- package/dist/stripe-elements/svg/keypad.svg +1 -0
- package/dist/stripe-elements/svg/language-outline.svg +1 -0
- package/dist/stripe-elements/svg/language-sharp.svg +1 -0
- package/dist/stripe-elements/svg/language.svg +1 -0
- package/dist/stripe-elements/svg/laptop-outline.svg +1 -0
- package/dist/stripe-elements/svg/laptop-sharp.svg +1 -0
- package/dist/stripe-elements/svg/laptop.svg +1 -0
- package/dist/stripe-elements/svg/layers-outline.svg +1 -0
- package/dist/stripe-elements/svg/layers-sharp.svg +1 -0
- package/dist/stripe-elements/svg/layers.svg +1 -0
- package/dist/stripe-elements/svg/leaf-outline.svg +1 -0
- package/dist/stripe-elements/svg/leaf-sharp.svg +1 -0
- package/dist/stripe-elements/svg/leaf.svg +1 -0
- package/dist/stripe-elements/svg/library-outline.svg +1 -0
- package/dist/stripe-elements/svg/library-sharp.svg +1 -0
- package/dist/stripe-elements/svg/library.svg +1 -0
- package/dist/stripe-elements/svg/link-outline.svg +1 -0
- package/dist/stripe-elements/svg/link-sharp.svg +1 -0
- package/dist/stripe-elements/svg/link.svg +1 -0
- package/dist/stripe-elements/svg/list-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/list-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/list-circle.svg +1 -0
- package/dist/stripe-elements/svg/list-outline.svg +1 -0
- package/dist/stripe-elements/svg/list-sharp.svg +1 -0
- package/dist/stripe-elements/svg/list.svg +1 -0
- package/dist/stripe-elements/svg/locate-outline.svg +1 -0
- package/dist/stripe-elements/svg/locate-sharp.svg +1 -0
- package/dist/stripe-elements/svg/locate.svg +1 -0
- package/dist/stripe-elements/svg/location-outline.svg +1 -0
- package/dist/stripe-elements/svg/location-sharp.svg +1 -0
- package/dist/stripe-elements/svg/location.svg +1 -0
- package/dist/stripe-elements/svg/lock-closed-outline.svg +1 -0
- package/dist/stripe-elements/svg/lock-closed-sharp.svg +1 -0
- package/dist/stripe-elements/svg/lock-closed.svg +1 -0
- package/dist/stripe-elements/svg/lock-open-outline.svg +1 -0
- package/dist/stripe-elements/svg/lock-open-sharp.svg +1 -0
- package/dist/stripe-elements/svg/lock-open.svg +1 -0
- package/dist/stripe-elements/svg/log-in-outline.svg +1 -0
- package/dist/stripe-elements/svg/log-in-sharp.svg +1 -0
- package/dist/stripe-elements/svg/log-in.svg +1 -0
- package/dist/stripe-elements/svg/log-out-outline.svg +1 -0
- package/dist/stripe-elements/svg/log-out-sharp.svg +1 -0
- package/dist/stripe-elements/svg/log-out.svg +1 -0
- package/dist/stripe-elements/svg/logo-alipay.svg +1 -0
- package/dist/stripe-elements/svg/logo-amazon.svg +1 -0
- package/dist/stripe-elements/svg/logo-amplify.svg +1 -0
- package/dist/stripe-elements/svg/logo-android.svg +1 -0
- package/dist/stripe-elements/svg/logo-angular.svg +1 -0
- package/dist/stripe-elements/svg/logo-apple-appstore.svg +1 -0
- package/dist/stripe-elements/svg/logo-apple-ar.svg +1 -0
- package/dist/stripe-elements/svg/logo-apple.svg +1 -0
- package/dist/stripe-elements/svg/logo-behance.svg +1 -0
- package/dist/stripe-elements/svg/logo-bitbucket.svg +1 -0
- package/dist/stripe-elements/svg/logo-bitcoin.svg +1 -0
- package/dist/stripe-elements/svg/logo-buffer.svg +1 -0
- package/dist/stripe-elements/svg/logo-capacitor.svg +1 -0
- package/dist/stripe-elements/svg/logo-chrome.svg +1 -0
- package/dist/stripe-elements/svg/logo-closed-captioning.svg +1 -0
- package/dist/stripe-elements/svg/logo-codepen.svg +1 -0
- package/dist/stripe-elements/svg/logo-css3.svg +1 -0
- package/dist/stripe-elements/svg/logo-designernews.svg +1 -0
- package/dist/stripe-elements/svg/logo-deviantart.svg +1 -0
- package/dist/stripe-elements/svg/logo-discord.svg +1 -0
- package/dist/stripe-elements/svg/logo-docker.svg +1 -0
- package/dist/stripe-elements/svg/logo-dribbble.svg +1 -0
- package/dist/stripe-elements/svg/logo-dropbox.svg +1 -0
- package/dist/stripe-elements/svg/logo-edge.svg +1 -0
- package/dist/stripe-elements/svg/logo-electron.svg +1 -0
- package/dist/stripe-elements/svg/logo-euro.svg +1 -0
- package/dist/stripe-elements/svg/logo-facebook.svg +1 -0
- package/dist/stripe-elements/svg/logo-figma.svg +1 -0
- package/dist/stripe-elements/svg/logo-firebase.svg +1 -0
- package/dist/stripe-elements/svg/logo-firefox.svg +1 -0
- package/dist/stripe-elements/svg/logo-flickr.svg +1 -0
- package/dist/stripe-elements/svg/logo-foursquare.svg +1 -0
- package/dist/stripe-elements/svg/logo-github.svg +1 -0
- package/dist/stripe-elements/svg/logo-gitlab.svg +1 -0
- package/dist/stripe-elements/svg/logo-google-playstore.svg +1 -0
- package/dist/stripe-elements/svg/logo-google.svg +1 -0
- package/dist/stripe-elements/svg/logo-hackernews.svg +1 -0
- package/dist/stripe-elements/svg/logo-html5.svg +1 -0
- package/dist/stripe-elements/svg/logo-instagram.svg +1 -0
- package/dist/stripe-elements/svg/logo-ionic.svg +1 -0
- package/dist/stripe-elements/svg/logo-ionitron.svg +1 -0
- package/dist/stripe-elements/svg/logo-javascript.svg +1 -0
- package/dist/stripe-elements/svg/logo-laravel.svg +1 -0
- package/dist/stripe-elements/svg/logo-linkedin.svg +1 -0
- package/dist/stripe-elements/svg/logo-markdown.svg +1 -0
- package/dist/stripe-elements/svg/logo-mastodon.svg +1 -0
- package/dist/stripe-elements/svg/logo-medium.svg +1 -0
- package/dist/stripe-elements/svg/logo-microsoft.svg +1 -0
- package/dist/stripe-elements/svg/logo-no-smoking.svg +1 -0
- package/dist/stripe-elements/svg/logo-nodejs.svg +1 -0
- package/dist/stripe-elements/svg/logo-npm.svg +1 -0
- package/dist/stripe-elements/svg/logo-octocat.svg +1 -0
- package/dist/stripe-elements/svg/logo-paypal.svg +1 -0
- package/dist/stripe-elements/svg/logo-pinterest.svg +1 -0
- package/dist/stripe-elements/svg/logo-playstation.svg +1 -0
- package/dist/stripe-elements/svg/logo-pwa.svg +1 -0
- package/dist/stripe-elements/svg/logo-python.svg +1 -0
- package/dist/stripe-elements/svg/logo-react.svg +1 -0
- package/dist/stripe-elements/svg/logo-reddit.svg +1 -0
- package/dist/stripe-elements/svg/logo-rss.svg +1 -0
- package/dist/stripe-elements/svg/logo-sass.svg +1 -0
- package/dist/stripe-elements/svg/logo-skype.svg +1 -0
- package/dist/stripe-elements/svg/logo-slack.svg +1 -0
- package/dist/stripe-elements/svg/logo-snapchat.svg +1 -0
- package/dist/stripe-elements/svg/logo-soundcloud.svg +1 -0
- package/dist/stripe-elements/svg/logo-stackoverflow.svg +1 -0
- package/dist/stripe-elements/svg/logo-steam.svg +1 -0
- package/dist/stripe-elements/svg/logo-stencil.svg +1 -0
- package/dist/stripe-elements/svg/logo-tableau.svg +1 -0
- package/dist/stripe-elements/svg/logo-tiktok.svg +1 -0
- package/dist/stripe-elements/svg/logo-tumblr.svg +1 -0
- package/dist/stripe-elements/svg/logo-tux.svg +1 -0
- package/dist/stripe-elements/svg/logo-twitch.svg +1 -0
- package/dist/stripe-elements/svg/logo-twitter.svg +1 -0
- package/dist/stripe-elements/svg/logo-usd.svg +1 -0
- package/dist/stripe-elements/svg/logo-venmo.svg +1 -0
- package/dist/stripe-elements/svg/logo-vercel.svg +1 -0
- package/dist/stripe-elements/svg/logo-vimeo.svg +1 -0
- package/dist/stripe-elements/svg/logo-vk.svg +1 -0
- package/dist/stripe-elements/svg/logo-vue.svg +1 -0
- package/dist/stripe-elements/svg/logo-web-component.svg +1 -0
- package/dist/stripe-elements/svg/logo-wechat.svg +1 -0
- package/dist/stripe-elements/svg/logo-whatsapp.svg +1 -0
- package/dist/stripe-elements/svg/logo-windows.svg +1 -0
- package/dist/stripe-elements/svg/logo-wordpress.svg +1 -0
- package/dist/stripe-elements/svg/logo-xbox.svg +1 -0
- package/dist/stripe-elements/svg/logo-xing.svg +1 -0
- package/dist/stripe-elements/svg/logo-yahoo.svg +1 -0
- package/dist/stripe-elements/svg/logo-yen.svg +1 -0
- package/dist/stripe-elements/svg/logo-youtube.svg +1 -0
- package/dist/stripe-elements/svg/magnet-outline.svg +1 -0
- package/dist/stripe-elements/svg/magnet-sharp.svg +1 -0
- package/dist/stripe-elements/svg/magnet.svg +1 -0
- package/dist/stripe-elements/svg/mail-open-outline.svg +1 -0
- package/dist/stripe-elements/svg/mail-open-sharp.svg +1 -0
- package/dist/stripe-elements/svg/mail-open.svg +1 -0
- package/dist/stripe-elements/svg/mail-outline.svg +1 -0
- package/dist/stripe-elements/svg/mail-sharp.svg +1 -0
- package/dist/stripe-elements/svg/mail-unread-outline.svg +1 -0
- package/dist/stripe-elements/svg/mail-unread-sharp.svg +1 -0
- package/dist/stripe-elements/svg/mail-unread.svg +1 -0
- package/dist/stripe-elements/svg/mail.svg +1 -0
- package/dist/stripe-elements/svg/male-female-outline.svg +1 -0
- package/dist/stripe-elements/svg/male-female-sharp.svg +1 -0
- package/dist/stripe-elements/svg/male-female.svg +1 -0
- package/dist/stripe-elements/svg/male-outline.svg +1 -0
- package/dist/stripe-elements/svg/male-sharp.svg +1 -0
- package/dist/stripe-elements/svg/male.svg +1 -0
- package/dist/stripe-elements/svg/man-outline.svg +1 -0
- package/dist/stripe-elements/svg/man-sharp.svg +1 -0
- package/dist/stripe-elements/svg/man.svg +1 -0
- package/dist/stripe-elements/svg/map-outline.svg +1 -0
- package/dist/stripe-elements/svg/map-sharp.svg +1 -0
- package/dist/stripe-elements/svg/map.svg +1 -0
- package/dist/stripe-elements/svg/medal-outline.svg +1 -0
- package/dist/stripe-elements/svg/medal-sharp.svg +1 -0
- package/dist/stripe-elements/svg/medal.svg +1 -0
- package/dist/stripe-elements/svg/medical-outline.svg +1 -0
- package/dist/stripe-elements/svg/medical-sharp.svg +1 -0
- package/dist/stripe-elements/svg/medical.svg +1 -0
- package/dist/stripe-elements/svg/medkit-outline.svg +1 -0
- package/dist/stripe-elements/svg/medkit-sharp.svg +1 -0
- package/dist/stripe-elements/svg/medkit.svg +1 -0
- package/dist/stripe-elements/svg/megaphone-outline.svg +1 -0
- package/dist/stripe-elements/svg/megaphone-sharp.svg +1 -0
- package/dist/stripe-elements/svg/megaphone.svg +1 -0
- package/dist/stripe-elements/svg/menu-outline.svg +1 -0
- package/dist/stripe-elements/svg/menu-sharp.svg +1 -0
- package/dist/stripe-elements/svg/menu.svg +1 -0
- package/dist/stripe-elements/svg/mic-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/mic-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/mic-circle.svg +1 -0
- package/dist/stripe-elements/svg/mic-off-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/mic-off-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/mic-off-circle.svg +1 -0
- package/dist/stripe-elements/svg/mic-off-outline.svg +1 -0
- package/dist/stripe-elements/svg/mic-off-sharp.svg +1 -0
- package/dist/stripe-elements/svg/mic-off.svg +1 -0
- package/dist/stripe-elements/svg/mic-outline.svg +1 -0
- package/dist/stripe-elements/svg/mic-sharp.svg +1 -0
- package/dist/stripe-elements/svg/mic.svg +1 -0
- package/dist/stripe-elements/svg/moon-outline.svg +1 -0
- package/dist/stripe-elements/svg/moon-sharp.svg +1 -0
- package/dist/stripe-elements/svg/moon.svg +1 -0
- package/dist/stripe-elements/svg/move-outline.svg +1 -0
- package/dist/stripe-elements/svg/move-sharp.svg +1 -0
- package/dist/stripe-elements/svg/move.svg +1 -0
- package/dist/stripe-elements/svg/musical-note-outline.svg +1 -0
- package/dist/stripe-elements/svg/musical-note-sharp.svg +1 -0
- package/dist/stripe-elements/svg/musical-note.svg +1 -0
- package/dist/stripe-elements/svg/musical-notes-outline.svg +1 -0
- package/dist/stripe-elements/svg/musical-notes-sharp.svg +1 -0
- package/dist/stripe-elements/svg/musical-notes.svg +1 -0
- package/dist/stripe-elements/svg/navigate-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/navigate-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/navigate-circle.svg +1 -0
- package/dist/stripe-elements/svg/navigate-outline.svg +1 -0
- package/dist/stripe-elements/svg/navigate-sharp.svg +1 -0
- package/dist/stripe-elements/svg/navigate.svg +1 -0
- package/dist/stripe-elements/svg/newspaper-outline.svg +1 -0
- package/dist/stripe-elements/svg/newspaper-sharp.svg +1 -0
- package/dist/stripe-elements/svg/newspaper.svg +1 -0
- package/dist/stripe-elements/svg/notifications-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/notifications-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/notifications-circle.svg +1 -0
- package/dist/stripe-elements/svg/notifications-off-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/notifications-off-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/notifications-off-circle.svg +1 -0
- package/dist/stripe-elements/svg/notifications-off-outline.svg +1 -0
- package/dist/stripe-elements/svg/notifications-off-sharp.svg +1 -0
- package/dist/stripe-elements/svg/notifications-off.svg +1 -0
- package/dist/stripe-elements/svg/notifications-outline.svg +1 -0
- package/dist/stripe-elements/svg/notifications-sharp.svg +1 -0
- package/dist/stripe-elements/svg/notifications.svg +1 -0
- package/dist/stripe-elements/svg/nuclear-outline.svg +1 -0
- package/dist/stripe-elements/svg/nuclear-sharp.svg +1 -0
- package/dist/stripe-elements/svg/nuclear.svg +1 -0
- package/dist/stripe-elements/svg/nutrition-outline.svg +1 -0
- package/dist/stripe-elements/svg/nutrition-sharp.svg +1 -0
- package/dist/stripe-elements/svg/nutrition.svg +1 -0
- package/dist/stripe-elements/svg/open-outline.svg +1 -0
- package/dist/stripe-elements/svg/open-sharp.svg +1 -0
- package/dist/stripe-elements/svg/open.svg +1 -0
- package/dist/stripe-elements/svg/options-outline.svg +1 -0
- package/dist/stripe-elements/svg/options-sharp.svg +1 -0
- package/dist/stripe-elements/svg/options.svg +1 -0
- package/dist/stripe-elements/svg/paper-plane-outline.svg +1 -0
- package/dist/stripe-elements/svg/paper-plane-sharp.svg +1 -0
- package/dist/stripe-elements/svg/paper-plane.svg +1 -0
- package/dist/stripe-elements/svg/partly-sunny-outline.svg +1 -0
- package/dist/stripe-elements/svg/partly-sunny-sharp.svg +1 -0
- package/dist/stripe-elements/svg/partly-sunny.svg +1 -0
- package/dist/stripe-elements/svg/pause-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/pause-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/pause-circle.svg +1 -0
- package/dist/stripe-elements/svg/pause-outline.svg +1 -0
- package/dist/stripe-elements/svg/pause-sharp.svg +1 -0
- package/dist/stripe-elements/svg/pause.svg +1 -0
- package/dist/stripe-elements/svg/paw-outline.svg +1 -0
- package/dist/stripe-elements/svg/paw-sharp.svg +1 -0
- package/dist/stripe-elements/svg/paw.svg +1 -0
- package/dist/stripe-elements/svg/pencil-outline.svg +1 -0
- package/dist/stripe-elements/svg/pencil-sharp.svg +1 -0
- package/dist/stripe-elements/svg/pencil.svg +1 -0
- package/dist/stripe-elements/svg/people-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/people-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/people-circle.svg +1 -0
- package/dist/stripe-elements/svg/people-outline.svg +1 -0
- package/dist/stripe-elements/svg/people-sharp.svg +1 -0
- package/dist/stripe-elements/svg/people.svg +1 -0
- package/dist/stripe-elements/svg/person-add-outline.svg +1 -0
- package/dist/stripe-elements/svg/person-add-sharp.svg +1 -0
- package/dist/stripe-elements/svg/person-add.svg +1 -0
- package/dist/stripe-elements/svg/person-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/person-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/person-circle.svg +1 -0
- package/dist/stripe-elements/svg/person-outline.svg +1 -0
- package/dist/stripe-elements/svg/person-remove-outline.svg +1 -0
- package/dist/stripe-elements/svg/person-remove-sharp.svg +1 -0
- package/dist/stripe-elements/svg/person-remove.svg +1 -0
- package/dist/stripe-elements/svg/person-sharp.svg +1 -0
- package/dist/stripe-elements/svg/person.svg +1 -0
- package/dist/stripe-elements/svg/phone-landscape-outline.svg +1 -0
- package/dist/stripe-elements/svg/phone-landscape-sharp.svg +1 -0
- package/dist/stripe-elements/svg/phone-landscape.svg +1 -0
- package/dist/stripe-elements/svg/phone-portrait-outline.svg +1 -0
- package/dist/stripe-elements/svg/phone-portrait-sharp.svg +1 -0
- package/dist/stripe-elements/svg/phone-portrait.svg +1 -0
- package/dist/stripe-elements/svg/pie-chart-outline.svg +1 -0
- package/dist/stripe-elements/svg/pie-chart-sharp.svg +1 -0
- package/dist/stripe-elements/svg/pie-chart.svg +1 -0
- package/dist/stripe-elements/svg/pin-outline.svg +1 -0
- package/dist/stripe-elements/svg/pin-sharp.svg +1 -0
- package/dist/stripe-elements/svg/pin.svg +1 -0
- package/dist/stripe-elements/svg/pint-outline.svg +1 -0
- package/dist/stripe-elements/svg/pint-sharp.svg +1 -0
- package/dist/stripe-elements/svg/pint.svg +1 -0
- package/dist/stripe-elements/svg/pizza-outline.svg +1 -0
- package/dist/stripe-elements/svg/pizza-sharp.svg +1 -0
- package/dist/stripe-elements/svg/pizza.svg +1 -0
- package/dist/stripe-elements/svg/planet-outline.svg +1 -0
- package/dist/stripe-elements/svg/planet-sharp.svg +1 -0
- package/dist/stripe-elements/svg/planet.svg +1 -0
- package/dist/stripe-elements/svg/play-back-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/play-back-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/play-back-circle.svg +1 -0
- package/dist/stripe-elements/svg/play-back-outline.svg +1 -0
- package/dist/stripe-elements/svg/play-back-sharp.svg +1 -0
- package/dist/stripe-elements/svg/play-back.svg +1 -0
- package/dist/stripe-elements/svg/play-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/play-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/play-circle.svg +1 -0
- package/dist/stripe-elements/svg/play-forward-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/play-forward-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/play-forward-circle.svg +1 -0
- package/dist/stripe-elements/svg/play-forward-outline.svg +1 -0
- package/dist/stripe-elements/svg/play-forward-sharp.svg +1 -0
- package/dist/stripe-elements/svg/play-forward.svg +1 -0
- package/dist/stripe-elements/svg/play-outline.svg +1 -0
- package/dist/stripe-elements/svg/play-sharp.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-back-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-back-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-back-circle.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-back-outline.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-back-sharp.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-back.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-forward-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-forward-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-forward-circle.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-forward-outline.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-forward-sharp.svg +1 -0
- package/dist/stripe-elements/svg/play-skip-forward.svg +1 -0
- package/dist/stripe-elements/svg/play.svg +1 -0
- package/dist/stripe-elements/svg/podium-outline.svg +1 -0
- package/dist/stripe-elements/svg/podium-sharp.svg +1 -0
- package/dist/stripe-elements/svg/podium.svg +1 -0
- package/dist/stripe-elements/svg/power-outline.svg +1 -0
- package/dist/stripe-elements/svg/power-sharp.svg +1 -0
- package/dist/stripe-elements/svg/power.svg +1 -0
- package/dist/stripe-elements/svg/pricetag-outline.svg +1 -0
- package/dist/stripe-elements/svg/pricetag-sharp.svg +1 -0
- package/dist/stripe-elements/svg/pricetag.svg +1 -0
- package/dist/stripe-elements/svg/pricetags-outline.svg +1 -0
- package/dist/stripe-elements/svg/pricetags-sharp.svg +1 -0
- package/dist/stripe-elements/svg/pricetags.svg +1 -0
- package/dist/stripe-elements/svg/print-outline.svg +1 -0
- package/dist/stripe-elements/svg/print-sharp.svg +1 -0
- package/dist/stripe-elements/svg/print.svg +1 -0
- package/dist/stripe-elements/svg/prism-outline.svg +1 -0
- package/dist/stripe-elements/svg/prism-sharp.svg +1 -0
- package/dist/stripe-elements/svg/prism.svg +1 -0
- package/dist/stripe-elements/svg/pulse-outline.svg +1 -0
- package/dist/stripe-elements/svg/pulse-sharp.svg +1 -0
- package/dist/stripe-elements/svg/pulse.svg +1 -0
- package/dist/stripe-elements/svg/push-outline.svg +1 -0
- package/dist/stripe-elements/svg/push-sharp.svg +1 -0
- package/dist/stripe-elements/svg/push.svg +1 -0
- package/dist/stripe-elements/svg/qr-code-outline.svg +1 -0
- package/dist/stripe-elements/svg/qr-code-sharp.svg +1 -0
- package/dist/stripe-elements/svg/qr-code.svg +1 -0
- package/dist/stripe-elements/svg/radio-button-off-outline.svg +1 -0
- package/dist/stripe-elements/svg/radio-button-off-sharp.svg +1 -0
- package/dist/stripe-elements/svg/radio-button-off.svg +1 -0
- package/dist/stripe-elements/svg/radio-button-on-outline.svg +1 -0
- package/dist/stripe-elements/svg/radio-button-on-sharp.svg +1 -0
- package/dist/stripe-elements/svg/radio-button-on.svg +1 -0
- package/dist/stripe-elements/svg/radio-outline.svg +1 -0
- package/dist/stripe-elements/svg/radio-sharp.svg +1 -0
- package/dist/stripe-elements/svg/radio.svg +1 -0
- package/dist/stripe-elements/svg/rainy-outline.svg +1 -0
- package/dist/stripe-elements/svg/rainy-sharp.svg +1 -0
- package/dist/stripe-elements/svg/rainy.svg +1 -0
- package/dist/stripe-elements/svg/reader-outline.svg +1 -0
- package/dist/stripe-elements/svg/reader-sharp.svg +1 -0
- package/dist/stripe-elements/svg/reader.svg +1 -0
- package/dist/stripe-elements/svg/receipt-outline.svg +1 -0
- package/dist/stripe-elements/svg/receipt-sharp.svg +1 -0
- package/dist/stripe-elements/svg/receipt.svg +1 -0
- package/dist/stripe-elements/svg/recording-outline.svg +1 -0
- package/dist/stripe-elements/svg/recording-sharp.svg +1 -0
- package/dist/stripe-elements/svg/recording.svg +1 -0
- package/dist/stripe-elements/svg/refresh-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/refresh-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/refresh-circle.svg +1 -0
- package/dist/stripe-elements/svg/refresh-outline.svg +1 -0
- package/dist/stripe-elements/svg/refresh-sharp.svg +1 -0
- package/dist/stripe-elements/svg/refresh.svg +1 -0
- package/dist/stripe-elements/svg/reload-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/reload-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/reload-circle.svg +1 -0
- package/dist/stripe-elements/svg/reload-outline.svg +1 -0
- package/dist/stripe-elements/svg/reload-sharp.svg +1 -0
- package/dist/stripe-elements/svg/reload.svg +1 -0
- package/dist/stripe-elements/svg/remove-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/remove-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/remove-circle.svg +1 -0
- package/dist/stripe-elements/svg/remove-outline.svg +1 -0
- package/dist/stripe-elements/svg/remove-sharp.svg +1 -0
- package/dist/stripe-elements/svg/remove.svg +1 -0
- package/dist/stripe-elements/svg/reorder-four-outline.svg +1 -0
- package/dist/stripe-elements/svg/reorder-four-sharp.svg +1 -0
- package/dist/stripe-elements/svg/reorder-four.svg +1 -0
- package/dist/stripe-elements/svg/reorder-three-outline.svg +1 -0
- package/dist/stripe-elements/svg/reorder-three-sharp.svg +1 -0
- package/dist/stripe-elements/svg/reorder-three.svg +1 -0
- package/dist/stripe-elements/svg/reorder-two-outline.svg +1 -0
- package/dist/stripe-elements/svg/reorder-two-sharp.svg +1 -0
- package/dist/stripe-elements/svg/reorder-two.svg +1 -0
- package/dist/stripe-elements/svg/repeat-outline.svg +1 -0
- package/dist/stripe-elements/svg/repeat-sharp.svg +1 -0
- package/dist/stripe-elements/svg/repeat.svg +1 -0
- package/dist/stripe-elements/svg/resize-outline.svg +1 -0
- package/dist/stripe-elements/svg/resize-sharp.svg +1 -0
- package/dist/stripe-elements/svg/resize.svg +1 -0
- package/dist/stripe-elements/svg/restaurant-outline.svg +1 -0
- package/dist/stripe-elements/svg/restaurant-sharp.svg +1 -0
- package/dist/stripe-elements/svg/restaurant.svg +1 -0
- package/dist/stripe-elements/svg/return-down-back-outline.svg +1 -0
- package/dist/stripe-elements/svg/return-down-back-sharp.svg +1 -0
- package/dist/stripe-elements/svg/return-down-back.svg +1 -0
- package/dist/stripe-elements/svg/return-down-forward-outline.svg +1 -0
- package/dist/stripe-elements/svg/return-down-forward-sharp.svg +1 -0
- package/dist/stripe-elements/svg/return-down-forward.svg +1 -0
- package/dist/stripe-elements/svg/return-up-back-outline.svg +1 -0
- package/dist/stripe-elements/svg/return-up-back-sharp.svg +1 -0
- package/dist/stripe-elements/svg/return-up-back.svg +1 -0
- package/dist/stripe-elements/svg/return-up-forward-outline.svg +1 -0
- package/dist/stripe-elements/svg/return-up-forward-sharp.svg +1 -0
- package/dist/stripe-elements/svg/return-up-forward.svg +1 -0
- package/dist/stripe-elements/svg/ribbon-outline.svg +1 -0
- package/dist/stripe-elements/svg/ribbon-sharp.svg +1 -0
- package/dist/stripe-elements/svg/ribbon.svg +1 -0
- package/dist/stripe-elements/svg/rocket-outline.svg +1 -0
- package/dist/stripe-elements/svg/rocket-sharp.svg +1 -0
- package/dist/stripe-elements/svg/rocket.svg +1 -0
- package/dist/stripe-elements/svg/rose-outline.svg +1 -0
- package/dist/stripe-elements/svg/rose-sharp.svg +1 -0
- package/dist/stripe-elements/svg/rose.svg +1 -0
- package/dist/stripe-elements/svg/sad-outline.svg +1 -0
- package/dist/stripe-elements/svg/sad-sharp.svg +1 -0
- package/dist/stripe-elements/svg/sad.svg +1 -0
- package/dist/stripe-elements/svg/save-outline.svg +1 -0
- package/dist/stripe-elements/svg/save-sharp.svg +1 -0
- package/dist/stripe-elements/svg/save.svg +1 -0
- package/dist/stripe-elements/svg/scale-outline.svg +1 -0
- package/dist/stripe-elements/svg/scale-sharp.svg +1 -0
- package/dist/stripe-elements/svg/scale.svg +1 -0
- package/dist/stripe-elements/svg/scan-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/scan-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/scan-circle.svg +1 -0
- package/dist/stripe-elements/svg/scan-outline.svg +1 -0
- package/dist/stripe-elements/svg/scan-sharp.svg +1 -0
- package/dist/stripe-elements/svg/scan.svg +1 -0
- package/dist/stripe-elements/svg/school-outline.svg +1 -0
- package/dist/stripe-elements/svg/school-sharp.svg +1 -0
- package/dist/stripe-elements/svg/school.svg +1 -0
- package/dist/stripe-elements/svg/search-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/search-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/search-circle.svg +1 -0
- package/dist/stripe-elements/svg/search-outline.svg +1 -0
- package/dist/stripe-elements/svg/search-sharp.svg +1 -0
- package/dist/stripe-elements/svg/search.svg +1 -0
- package/dist/stripe-elements/svg/send-outline.svg +1 -0
- package/dist/stripe-elements/svg/send-sharp.svg +1 -0
- package/dist/stripe-elements/svg/send.svg +1 -0
- package/dist/stripe-elements/svg/server-outline.svg +1 -0
- package/dist/stripe-elements/svg/server-sharp.svg +1 -0
- package/dist/stripe-elements/svg/server.svg +1 -0
- package/dist/stripe-elements/svg/settings-outline.svg +1 -0
- package/dist/stripe-elements/svg/settings-sharp.svg +1 -0
- package/dist/stripe-elements/svg/settings.svg +1 -0
- package/dist/stripe-elements/svg/shapes-outline.svg +1 -0
- package/dist/stripe-elements/svg/shapes-sharp.svg +1 -0
- package/dist/stripe-elements/svg/shapes.svg +1 -0
- package/dist/stripe-elements/svg/share-outline.svg +1 -0
- package/dist/stripe-elements/svg/share-sharp.svg +1 -0
- package/dist/stripe-elements/svg/share-social-outline.svg +1 -0
- package/dist/stripe-elements/svg/share-social-sharp.svg +1 -0
- package/dist/stripe-elements/svg/share-social.svg +1 -0
- package/dist/stripe-elements/svg/share.svg +1 -0
- package/dist/stripe-elements/svg/shield-checkmark-outline.svg +1 -0
- package/dist/stripe-elements/svg/shield-checkmark-sharp.svg +1 -0
- package/dist/stripe-elements/svg/shield-checkmark.svg +1 -0
- package/dist/stripe-elements/svg/shield-half-outline.svg +1 -0
- package/dist/stripe-elements/svg/shield-half-sharp.svg +1 -0
- package/dist/stripe-elements/svg/shield-half.svg +1 -0
- package/dist/stripe-elements/svg/shield-outline.svg +1 -0
- package/dist/stripe-elements/svg/shield-sharp.svg +1 -0
- package/dist/stripe-elements/svg/shield.svg +1 -0
- package/dist/stripe-elements/svg/shirt-outline.svg +1 -0
- package/dist/stripe-elements/svg/shirt-sharp.svg +1 -0
- package/dist/stripe-elements/svg/shirt.svg +1 -0
- package/dist/stripe-elements/svg/shuffle-outline.svg +1 -0
- package/dist/stripe-elements/svg/shuffle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/shuffle.svg +1 -0
- package/dist/stripe-elements/svg/skull-outline.svg +1 -0
- package/dist/stripe-elements/svg/skull-sharp.svg +1 -0
- package/dist/stripe-elements/svg/skull.svg +1 -0
- package/dist/stripe-elements/svg/snow-outline.svg +1 -0
- package/dist/stripe-elements/svg/snow-sharp.svg +1 -0
- package/dist/stripe-elements/svg/snow.svg +1 -0
- package/dist/stripe-elements/svg/sparkles-outline.svg +1 -0
- package/dist/stripe-elements/svg/sparkles-sharp.svg +1 -0
- package/dist/stripe-elements/svg/sparkles.svg +1 -0
- package/dist/stripe-elements/svg/speedometer-outline.svg +1 -0
- package/dist/stripe-elements/svg/speedometer-sharp.svg +1 -0
- package/dist/stripe-elements/svg/speedometer.svg +1 -0
- package/dist/stripe-elements/svg/square-outline.svg +1 -0
- package/dist/stripe-elements/svg/square-sharp.svg +1 -0
- package/dist/stripe-elements/svg/square.svg +1 -0
- package/dist/stripe-elements/svg/star-half-outline.svg +1 -0
- package/dist/stripe-elements/svg/star-half-sharp.svg +1 -0
- package/dist/stripe-elements/svg/star-half.svg +1 -0
- package/dist/stripe-elements/svg/star-outline.svg +1 -0
- package/dist/stripe-elements/svg/star-sharp.svg +1 -0
- package/dist/stripe-elements/svg/star.svg +1 -0
- package/dist/stripe-elements/svg/stats-chart-outline.svg +1 -0
- package/dist/stripe-elements/svg/stats-chart-sharp.svg +1 -0
- package/dist/stripe-elements/svg/stats-chart.svg +1 -0
- package/dist/stripe-elements/svg/stop-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/stop-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/stop-circle.svg +1 -0
- package/dist/stripe-elements/svg/stop-outline.svg +1 -0
- package/dist/stripe-elements/svg/stop-sharp.svg +1 -0
- package/dist/stripe-elements/svg/stop.svg +1 -0
- package/dist/stripe-elements/svg/stopwatch-outline.svg +1 -0
- package/dist/stripe-elements/svg/stopwatch-sharp.svg +1 -0
- package/dist/stripe-elements/svg/stopwatch.svg +1 -0
- package/dist/stripe-elements/svg/storefront-outline.svg +1 -0
- package/dist/stripe-elements/svg/storefront-sharp.svg +1 -0
- package/dist/stripe-elements/svg/storefront.svg +1 -0
- package/dist/stripe-elements/svg/subway-outline.svg +1 -0
- package/dist/stripe-elements/svg/subway-sharp.svg +1 -0
- package/dist/stripe-elements/svg/subway.svg +1 -0
- package/dist/stripe-elements/svg/sunny-outline.svg +1 -0
- package/dist/stripe-elements/svg/sunny-sharp.svg +1 -0
- package/dist/stripe-elements/svg/sunny.svg +1 -0
- package/dist/stripe-elements/svg/swap-horizontal-outline.svg +1 -0
- package/dist/stripe-elements/svg/swap-horizontal-sharp.svg +1 -0
- package/dist/stripe-elements/svg/swap-horizontal.svg +1 -0
- package/dist/stripe-elements/svg/swap-vertical-outline.svg +1 -0
- package/dist/stripe-elements/svg/swap-vertical-sharp.svg +1 -0
- package/dist/stripe-elements/svg/swap-vertical.svg +1 -0
- package/dist/stripe-elements/svg/sync-circle-outline.svg +1 -0
- package/dist/stripe-elements/svg/sync-circle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/sync-circle.svg +1 -0
- package/dist/stripe-elements/svg/sync-outline.svg +1 -0
- package/dist/stripe-elements/svg/sync-sharp.svg +1 -0
- package/dist/stripe-elements/svg/sync.svg +1 -0
- package/dist/stripe-elements/svg/tablet-landscape-outline.svg +1 -0
- package/dist/stripe-elements/svg/tablet-landscape-sharp.svg +1 -0
- package/dist/stripe-elements/svg/tablet-landscape.svg +1 -0
- package/dist/stripe-elements/svg/tablet-portrait-outline.svg +1 -0
- package/dist/stripe-elements/svg/tablet-portrait-sharp.svg +1 -0
- package/dist/stripe-elements/svg/tablet-portrait.svg +1 -0
- package/dist/stripe-elements/svg/telescope-outline.svg +1 -0
- package/dist/stripe-elements/svg/telescope-sharp.svg +1 -0
- package/dist/stripe-elements/svg/telescope.svg +1 -0
- package/dist/stripe-elements/svg/tennisball-outline.svg +1 -0
- package/dist/stripe-elements/svg/tennisball-sharp.svg +1 -0
- package/dist/stripe-elements/svg/tennisball.svg +1 -0
- package/dist/stripe-elements/svg/terminal-outline.svg +1 -0
- package/dist/stripe-elements/svg/terminal-sharp.svg +1 -0
- package/dist/stripe-elements/svg/terminal.svg +1 -0
- package/dist/stripe-elements/svg/text-outline.svg +1 -0
- package/dist/stripe-elements/svg/text-sharp.svg +1 -0
- package/dist/stripe-elements/svg/text.svg +1 -0
- package/dist/stripe-elements/svg/thermometer-outline.svg +1 -0
- package/dist/stripe-elements/svg/thermometer-sharp.svg +1 -0
- package/dist/stripe-elements/svg/thermometer.svg +1 -0
- package/dist/stripe-elements/svg/thumbs-down-outline.svg +1 -0
- package/dist/stripe-elements/svg/thumbs-down-sharp.svg +1 -0
- package/dist/stripe-elements/svg/thumbs-down.svg +1 -0
- package/dist/stripe-elements/svg/thumbs-up-outline.svg +1 -0
- package/dist/stripe-elements/svg/thumbs-up-sharp.svg +1 -0
- package/dist/stripe-elements/svg/thumbs-up.svg +1 -0
- package/dist/stripe-elements/svg/thunderstorm-outline.svg +1 -0
- package/dist/stripe-elements/svg/thunderstorm-sharp.svg +1 -0
- package/dist/stripe-elements/svg/thunderstorm.svg +1 -0
- package/dist/stripe-elements/svg/ticket-outline.svg +1 -0
- package/dist/stripe-elements/svg/ticket-sharp.svg +1 -0
- package/dist/stripe-elements/svg/ticket.svg +1 -0
- package/dist/stripe-elements/svg/time-outline.svg +1 -0
- package/dist/stripe-elements/svg/time-sharp.svg +1 -0
- package/dist/stripe-elements/svg/time.svg +1 -0
- package/dist/stripe-elements/svg/timer-outline.svg +1 -0
- package/dist/stripe-elements/svg/timer-sharp.svg +1 -0
- package/dist/stripe-elements/svg/timer.svg +1 -0
- package/dist/stripe-elements/svg/today-outline.svg +1 -0
- package/dist/stripe-elements/svg/today-sharp.svg +1 -0
- package/dist/stripe-elements/svg/today.svg +1 -0
- package/dist/stripe-elements/svg/toggle-outline.svg +1 -0
- package/dist/stripe-elements/svg/toggle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/toggle.svg +1 -0
- package/dist/stripe-elements/svg/trail-sign-outline.svg +1 -0
- package/dist/stripe-elements/svg/trail-sign-sharp.svg +1 -0
- package/dist/stripe-elements/svg/trail-sign.svg +1 -0
- package/dist/stripe-elements/svg/train-outline.svg +1 -0
- package/dist/stripe-elements/svg/train-sharp.svg +1 -0
- package/dist/stripe-elements/svg/train.svg +1 -0
- package/dist/stripe-elements/svg/transgender-outline.svg +1 -0
- package/dist/stripe-elements/svg/transgender-sharp.svg +1 -0
- package/dist/stripe-elements/svg/transgender.svg +1 -0
- package/dist/stripe-elements/svg/trash-bin-outline.svg +1 -0
- package/dist/stripe-elements/svg/trash-bin-sharp.svg +1 -0
- package/dist/stripe-elements/svg/trash-bin.svg +1 -0
- package/dist/stripe-elements/svg/trash-outline.svg +1 -0
- package/dist/stripe-elements/svg/trash-sharp.svg +1 -0
- package/dist/stripe-elements/svg/trash.svg +1 -0
- package/dist/stripe-elements/svg/trending-down-outline.svg +1 -0
- package/dist/stripe-elements/svg/trending-down-sharp.svg +1 -0
- package/dist/stripe-elements/svg/trending-down.svg +1 -0
- package/dist/stripe-elements/svg/trending-up-outline.svg +1 -0
- package/dist/stripe-elements/svg/trending-up-sharp.svg +1 -0
- package/dist/stripe-elements/svg/trending-up.svg +1 -0
- package/dist/stripe-elements/svg/triangle-outline.svg +1 -0
- package/dist/stripe-elements/svg/triangle-sharp.svg +1 -0
- package/dist/stripe-elements/svg/triangle.svg +1 -0
- package/dist/stripe-elements/svg/trophy-outline.svg +1 -0
- package/dist/stripe-elements/svg/trophy-sharp.svg +1 -0
- package/dist/stripe-elements/svg/trophy.svg +1 -0
- package/dist/stripe-elements/svg/tv-outline.svg +1 -0
- package/dist/stripe-elements/svg/tv-sharp.svg +1 -0
- package/dist/stripe-elements/svg/tv.svg +1 -0
- package/dist/stripe-elements/svg/umbrella-outline.svg +1 -0
- package/dist/stripe-elements/svg/umbrella-sharp.svg +1 -0
- package/dist/stripe-elements/svg/umbrella.svg +1 -0
- package/dist/stripe-elements/svg/unlink-outline.svg +1 -0
- package/dist/stripe-elements/svg/unlink-sharp.svg +1 -0
- package/dist/stripe-elements/svg/unlink.svg +1 -0
- package/dist/stripe-elements/svg/videocam-off-outline.svg +1 -0
- package/dist/stripe-elements/svg/videocam-off-sharp.svg +1 -0
- package/dist/stripe-elements/svg/videocam-off.svg +1 -0
- package/dist/stripe-elements/svg/videocam-outline.svg +1 -0
- package/dist/stripe-elements/svg/videocam-sharp.svg +1 -0
- package/dist/stripe-elements/svg/videocam.svg +1 -0
- package/dist/stripe-elements/svg/volume-high-outline.svg +1 -0
- package/dist/stripe-elements/svg/volume-high-sharp.svg +1 -0
- package/dist/stripe-elements/svg/volume-high.svg +1 -0
- package/dist/stripe-elements/svg/volume-low-outline.svg +1 -0
- package/dist/stripe-elements/svg/volume-low-sharp.svg +1 -0
- package/dist/stripe-elements/svg/volume-low.svg +1 -0
- package/dist/stripe-elements/svg/volume-medium-outline.svg +1 -0
- package/dist/stripe-elements/svg/volume-medium-sharp.svg +1 -0
- package/dist/stripe-elements/svg/volume-medium.svg +1 -0
- package/dist/stripe-elements/svg/volume-mute-outline.svg +1 -0
- package/dist/stripe-elements/svg/volume-mute-sharp.svg +1 -0
- package/dist/stripe-elements/svg/volume-mute.svg +1 -0
- package/dist/stripe-elements/svg/volume-off-outline.svg +1 -0
- package/dist/stripe-elements/svg/volume-off-sharp.svg +1 -0
- package/dist/stripe-elements/svg/volume-off.svg +1 -0
- package/dist/stripe-elements/svg/walk-outline.svg +1 -0
- package/dist/stripe-elements/svg/walk-sharp.svg +1 -0
- package/dist/stripe-elements/svg/walk.svg +1 -0
- package/dist/stripe-elements/svg/wallet-outline.svg +1 -0
- package/dist/stripe-elements/svg/wallet-sharp.svg +1 -0
- package/dist/stripe-elements/svg/wallet.svg +1 -0
- package/dist/stripe-elements/svg/warning-outline.svg +1 -0
- package/dist/stripe-elements/svg/warning-sharp.svg +1 -0
- package/dist/stripe-elements/svg/warning.svg +1 -0
- package/dist/stripe-elements/svg/watch-outline.svg +1 -0
- package/dist/stripe-elements/svg/watch-sharp.svg +1 -0
- package/dist/stripe-elements/svg/watch.svg +1 -0
- package/dist/stripe-elements/svg/water-outline.svg +1 -0
- package/dist/stripe-elements/svg/water-sharp.svg +1 -0
- package/dist/stripe-elements/svg/water.svg +1 -0
- package/dist/stripe-elements/svg/wifi-outline.svg +1 -0
- package/dist/stripe-elements/svg/wifi-sharp.svg +1 -0
- package/dist/stripe-elements/svg/wifi.svg +1 -0
- package/dist/stripe-elements/svg/wine-outline.svg +1 -0
- package/dist/stripe-elements/svg/wine-sharp.svg +1 -0
- package/dist/stripe-elements/svg/wine.svg +1 -0
- package/dist/stripe-elements/svg/woman-outline.svg +1 -0
- package/dist/stripe-elements/svg/woman-sharp.svg +1 -0
- package/dist/stripe-elements/svg/woman.svg +1 -0
- package/dist/types/components/stripe-element-modal/stripe-element-modal.d.ts +31 -0
- package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +141 -0
- package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.d.ts +278 -0
- package/dist/types/components/stripe-payment-sheet-modal/stripe-payment-sheet-modal.d.ts +124 -0
- package/dist/types/components.d.ts +512 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interfaces.d.ts +53 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/i18n.d.ts +1 -0
- package/dist/types/utils/platform.d.ts +26 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +79 -0
- package/readme.md +179 -0
|
@@ -0,0 +1,4197 @@
|
|
|
1
|
+
import { getAssetPath, HTMLElement, Build, h, Host, createEvent, proxyCustomElement } from '@stencil/core/internal/client';
|
|
2
|
+
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
3
|
+
|
|
4
|
+
let CACHED_MAP;
|
|
5
|
+
const getIconMap = () => {
|
|
6
|
+
if (typeof window === 'undefined') {
|
|
7
|
+
return new Map();
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
if (!CACHED_MAP) {
|
|
11
|
+
const win = window;
|
|
12
|
+
win.Ionicons = win.Ionicons || {};
|
|
13
|
+
CACHED_MAP = win.Ionicons.map = win.Ionicons.map || new Map();
|
|
14
|
+
}
|
|
15
|
+
return CACHED_MAP;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const getUrl = (i) => {
|
|
19
|
+
let url = getSrc(i.src);
|
|
20
|
+
if (url) {
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
url = getName(i.name, i.icon, i.mode, i.ios, i.md);
|
|
24
|
+
if (url) {
|
|
25
|
+
return getNamedUrl(url);
|
|
26
|
+
}
|
|
27
|
+
if (i.icon) {
|
|
28
|
+
url = getSrc(i.icon);
|
|
29
|
+
if (url) {
|
|
30
|
+
return url;
|
|
31
|
+
}
|
|
32
|
+
url = getSrc(i.icon[i.mode]);
|
|
33
|
+
if (url) {
|
|
34
|
+
return url;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
const getNamedUrl = (iconName) => {
|
|
40
|
+
const url = getIconMap().get(iconName);
|
|
41
|
+
if (url) {
|
|
42
|
+
return url;
|
|
43
|
+
}
|
|
44
|
+
return getAssetPath(`svg/${iconName}.svg`);
|
|
45
|
+
};
|
|
46
|
+
const getName = (iconName, icon, mode, ios, md) => {
|
|
47
|
+
// default to "md" if somehow the mode wasn't set
|
|
48
|
+
mode = (mode && toLower(mode)) === 'ios' ? 'ios' : 'md';
|
|
49
|
+
// if an icon was passed in using the ios or md attributes
|
|
50
|
+
// set the iconName to whatever was passed in
|
|
51
|
+
if (ios && mode === 'ios') {
|
|
52
|
+
iconName = toLower(ios);
|
|
53
|
+
}
|
|
54
|
+
else if (md && mode === 'md') {
|
|
55
|
+
iconName = toLower(md);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
if (!iconName && icon && !isSrc(icon)) {
|
|
59
|
+
iconName = icon;
|
|
60
|
+
}
|
|
61
|
+
if (isStr(iconName)) {
|
|
62
|
+
iconName = toLower(iconName);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (!isStr(iconName) || iconName.trim() === '') {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
// only allow alpha characters and dash
|
|
69
|
+
const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
|
|
70
|
+
if (invalidChars !== '') {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return iconName;
|
|
74
|
+
};
|
|
75
|
+
const getSrc = (src) => {
|
|
76
|
+
if (isStr(src)) {
|
|
77
|
+
src = src.trim();
|
|
78
|
+
if (isSrc(src)) {
|
|
79
|
+
return src;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
};
|
|
84
|
+
const isSrc = (str) => str.length > 0 && /(\/|\.)/.test(str);
|
|
85
|
+
const isStr = (val) => typeof val === 'string';
|
|
86
|
+
const toLower = (val) => val.toLowerCase();
|
|
87
|
+
/**
|
|
88
|
+
* Elements inside of web components sometimes need to inherit global attributes
|
|
89
|
+
* set on the host. For example, the inner input in `ion-input` should inherit
|
|
90
|
+
* the `title` attribute that developers set directly on `ion-input`. This
|
|
91
|
+
* helper function should be called in componentWillLoad and assigned to a variable
|
|
92
|
+
* that is later used in the render function.
|
|
93
|
+
*
|
|
94
|
+
* This does not need to be reactive as changing attributes on the host element
|
|
95
|
+
* does not trigger a re-render.
|
|
96
|
+
*/
|
|
97
|
+
const inheritAttributes = (el, attributes = []) => {
|
|
98
|
+
const attributeObject = {};
|
|
99
|
+
attributes.forEach(attr => {
|
|
100
|
+
if (el.hasAttribute(attr)) {
|
|
101
|
+
const value = el.getAttribute(attr);
|
|
102
|
+
if (value !== null) {
|
|
103
|
+
attributeObject[attr] = el.getAttribute(attr);
|
|
104
|
+
}
|
|
105
|
+
el.removeAttribute(attr);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return attributeObject;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const validateContent = (svgContent) => {
|
|
112
|
+
const div = document.createElement('div');
|
|
113
|
+
div.innerHTML = svgContent;
|
|
114
|
+
// setup this way to ensure it works on our buddy IE
|
|
115
|
+
for (let i = div.childNodes.length - 1; i >= 0; i--) {
|
|
116
|
+
if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {
|
|
117
|
+
div.removeChild(div.childNodes[i]);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
// must only have 1 root element
|
|
121
|
+
const svgElm = div.firstElementChild;
|
|
122
|
+
if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {
|
|
123
|
+
const svgClass = svgElm.getAttribute('class') || '';
|
|
124
|
+
svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());
|
|
125
|
+
// root element must be an svg
|
|
126
|
+
// lets double check we've got valid elements
|
|
127
|
+
// do not allow scripts
|
|
128
|
+
if (isValid(svgElm)) {
|
|
129
|
+
return div.innerHTML;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return '';
|
|
133
|
+
};
|
|
134
|
+
const isValid = (elm) => {
|
|
135
|
+
if (elm.nodeType === 1) {
|
|
136
|
+
if (elm.nodeName.toLowerCase() === 'script') {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
for (let i = 0; i < elm.attributes.length; i++) {
|
|
140
|
+
const val = elm.attributes[i].value;
|
|
141
|
+
if (isStr(val) && val.toLowerCase().indexOf('on') === 0) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
for (let i = 0; i < elm.childNodes.length; i++) {
|
|
146
|
+
if (!isValid(elm.childNodes[i])) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return true;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const ioniconContent = new Map();
|
|
155
|
+
const requests = new Map();
|
|
156
|
+
const getSvgContent = (url, sanitize) => {
|
|
157
|
+
// see if we already have a request for this url
|
|
158
|
+
let req = requests.get(url);
|
|
159
|
+
if (!req) {
|
|
160
|
+
if (typeof fetch !== 'undefined' && typeof document !== 'undefined') {
|
|
161
|
+
// we don't already have a request
|
|
162
|
+
req = fetch(url).then((rsp) => {
|
|
163
|
+
if (rsp.ok) {
|
|
164
|
+
return rsp.text().then((svgContent) => {
|
|
165
|
+
if (svgContent && sanitize !== false) {
|
|
166
|
+
svgContent = validateContent(svgContent);
|
|
167
|
+
}
|
|
168
|
+
ioniconContent.set(url, svgContent || '');
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
ioniconContent.set(url, '');
|
|
172
|
+
});
|
|
173
|
+
// cache for the same requests
|
|
174
|
+
requests.set(url, req);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
// set to empty for ssr scenarios and resolve promise
|
|
178
|
+
ioniconContent.set(url, '');
|
|
179
|
+
return Promise.resolve();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return req;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const iconCss = ":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:32px;stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}:host(.flip-rtl) .icon-inner{transform:scaleX(-1)}:host(.icon-small){font-size:18px !important}:host(.icon-large){font-size:32px !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}";
|
|
186
|
+
|
|
187
|
+
const Icon = class extends HTMLElement {
|
|
188
|
+
constructor() {
|
|
189
|
+
super();
|
|
190
|
+
this.__registerHost();
|
|
191
|
+
this.__attachShadow();
|
|
192
|
+
this.iconName = null;
|
|
193
|
+
this.inheritedAttributes = {};
|
|
194
|
+
this.isVisible = false;
|
|
195
|
+
/**
|
|
196
|
+
* The mode determines which platform styles to use.
|
|
197
|
+
*/
|
|
198
|
+
this.mode = getIonMode();
|
|
199
|
+
/**
|
|
200
|
+
* If enabled, ion-icon will be loaded lazily when it's visible in the viewport.
|
|
201
|
+
* Default, `false`.
|
|
202
|
+
*/
|
|
203
|
+
this.lazy = false;
|
|
204
|
+
/**
|
|
205
|
+
* When set to `false`, SVG content that is HTTP fetched will not be checked
|
|
206
|
+
* if the response SVG content has any `<script>` elements, or any attributes
|
|
207
|
+
* that start with `on`, such as `onclick`.
|
|
208
|
+
* @default true
|
|
209
|
+
*/
|
|
210
|
+
this.sanitize = true;
|
|
211
|
+
this.hasAriaHidden = () => {
|
|
212
|
+
const { el } = this;
|
|
213
|
+
return el.hasAttribute('aria-hidden') && el.getAttribute('aria-hidden') === 'true';
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
componentWillLoad() {
|
|
217
|
+
this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);
|
|
218
|
+
}
|
|
219
|
+
connectedCallback() {
|
|
220
|
+
// purposely do not return the promise here because loading
|
|
221
|
+
// the svg file should not hold up loading the app
|
|
222
|
+
// only load the svg if it's visible
|
|
223
|
+
this.waitUntilVisible(this.el, '50px', () => {
|
|
224
|
+
this.isVisible = true;
|
|
225
|
+
this.loadIcon();
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
disconnectedCallback() {
|
|
229
|
+
if (this.io) {
|
|
230
|
+
this.io.disconnect();
|
|
231
|
+
this.io = undefined;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
waitUntilVisible(el, rootMargin, cb) {
|
|
235
|
+
if (Build.isBrowser && this.lazy && typeof window !== 'undefined' && window.IntersectionObserver) {
|
|
236
|
+
const io = (this.io = new window.IntersectionObserver((data) => {
|
|
237
|
+
if (data[0].isIntersecting) {
|
|
238
|
+
io.disconnect();
|
|
239
|
+
this.io = undefined;
|
|
240
|
+
cb();
|
|
241
|
+
}
|
|
242
|
+
}, { rootMargin }));
|
|
243
|
+
io.observe(el);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
// browser doesn't support IntersectionObserver
|
|
247
|
+
// so just fallback to always show it
|
|
248
|
+
cb();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
loadIcon() {
|
|
252
|
+
if (Build.isBrowser && this.isVisible) {
|
|
253
|
+
const url = getUrl(this);
|
|
254
|
+
if (url) {
|
|
255
|
+
if (ioniconContent.has(url)) {
|
|
256
|
+
// sync if it's already loaded
|
|
257
|
+
this.svgContent = ioniconContent.get(url);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
// async if it hasn't been loaded
|
|
261
|
+
getSvgContent(url, this.sanitize).then(() => (this.svgContent = ioniconContent.get(url)));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const label = this.iconName = getName(this.name, this.icon, this.mode, this.ios, this.md);
|
|
266
|
+
/**
|
|
267
|
+
* Come up with a default label
|
|
268
|
+
* in case user does not provide their own.
|
|
269
|
+
*/
|
|
270
|
+
if (label) {
|
|
271
|
+
this.ariaLabel = label.replace(/\-/g, ' ');
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
render() {
|
|
275
|
+
const { iconName, ariaLabel, inheritedAttributes } = this;
|
|
276
|
+
const mode = this.mode || 'md';
|
|
277
|
+
const flipRtl = this.flipRtl ||
|
|
278
|
+
(iconName &&
|
|
279
|
+
(iconName.indexOf('arrow') > -1 || iconName.indexOf('chevron') > -1) &&
|
|
280
|
+
this.flipRtl !== false);
|
|
281
|
+
/**
|
|
282
|
+
* Only set the aria-label if a) we have generated
|
|
283
|
+
* one for the icon and if aria-hidden is not set to "true".
|
|
284
|
+
* If developer wants to set their own aria-label, then
|
|
285
|
+
* inheritedAttributes down below will override whatever
|
|
286
|
+
* default label we have set.
|
|
287
|
+
*/
|
|
288
|
+
return (h(Host, Object.assign({ "aria-label": ariaLabel !== undefined && !this.hasAriaHidden() ? ariaLabel : null, role: "img", class: Object.assign(Object.assign({ [mode]: true }, createColorClasses(this.color)), { [`icon-${this.size}`]: !!this.size, 'flip-rtl': !!flipRtl && this.el.ownerDocument.dir === 'rtl' }) }, inheritedAttributes), Build.isBrowser && this.svgContent ? (h("div", { class: "icon-inner", innerHTML: this.svgContent })) : (h("div", { class: "icon-inner" }))));
|
|
289
|
+
}
|
|
290
|
+
static get assetsDirs() { return ["svg"]; }
|
|
291
|
+
get el() { return this; }
|
|
292
|
+
static get watchers() { return {
|
|
293
|
+
"name": ["loadIcon"],
|
|
294
|
+
"src": ["loadIcon"],
|
|
295
|
+
"icon": ["loadIcon"]
|
|
296
|
+
}; }
|
|
297
|
+
static get style() { return iconCss; }
|
|
298
|
+
};
|
|
299
|
+
const getIonMode = () => (Build.isBrowser && typeof document !== 'undefined' && document.documentElement.getAttribute('mode')) || 'md';
|
|
300
|
+
const createColorClasses = (color) => {
|
|
301
|
+
return color
|
|
302
|
+
? {
|
|
303
|
+
'ion-color': true,
|
|
304
|
+
[`ion-color-${color}`]: true,
|
|
305
|
+
}
|
|
306
|
+
: null;
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
var V3_URL = 'https://js.stripe.com/v3';
|
|
310
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
|
311
|
+
var EXISTING_SCRIPT_MESSAGE = 'loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used';
|
|
312
|
+
var findScript = function findScript() {
|
|
313
|
+
var scripts = document.querySelectorAll("script[src^=\"".concat(V3_URL, "\"]"));
|
|
314
|
+
|
|
315
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
316
|
+
var script = scripts[i];
|
|
317
|
+
|
|
318
|
+
if (!V3_URL_REGEX.test(script.src)) {
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return script;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return null;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
var injectScript = function injectScript(params) {
|
|
329
|
+
var queryString = params && !params.advancedFraudSignals ? '?advancedFraudSignals=false' : '';
|
|
330
|
+
var script = document.createElement('script');
|
|
331
|
+
script.src = "".concat(V3_URL).concat(queryString);
|
|
332
|
+
var headOrBody = document.head || document.body;
|
|
333
|
+
|
|
334
|
+
if (!headOrBody) {
|
|
335
|
+
throw new Error('Expected document.body not to be null. Stripe.js requires a <body> element.');
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
headOrBody.appendChild(script);
|
|
339
|
+
return script;
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
var registerWrapper = function registerWrapper(stripe, startTime) {
|
|
343
|
+
if (!stripe || !stripe._registerWrapper) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
stripe._registerWrapper({
|
|
348
|
+
name: 'stripe-js',
|
|
349
|
+
version: "1.31.0",
|
|
350
|
+
startTime: startTime
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
var stripePromise = null;
|
|
355
|
+
var loadScript = function loadScript(params) {
|
|
356
|
+
// Ensure that we only attempt to load Stripe.js at most once
|
|
357
|
+
if (stripePromise !== null) {
|
|
358
|
+
return stripePromise;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
stripePromise = new Promise(function (resolve, reject) {
|
|
362
|
+
if (typeof window === 'undefined') {
|
|
363
|
+
// Resolve to null when imported server side. This makes the module
|
|
364
|
+
// safe to import in an isomorphic code base.
|
|
365
|
+
resolve(null);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (window.Stripe && params) {
|
|
370
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
if (window.Stripe) {
|
|
374
|
+
resolve(window.Stripe);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
try {
|
|
379
|
+
var script = findScript();
|
|
380
|
+
|
|
381
|
+
if (script && params) {
|
|
382
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
|
383
|
+
} else if (!script) {
|
|
384
|
+
script = injectScript(params);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
script.addEventListener('load', function () {
|
|
388
|
+
if (window.Stripe) {
|
|
389
|
+
resolve(window.Stripe);
|
|
390
|
+
} else {
|
|
391
|
+
reject(new Error('Stripe.js not available'));
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
script.addEventListener('error', function () {
|
|
395
|
+
reject(new Error('Failed to load Stripe.js'));
|
|
396
|
+
});
|
|
397
|
+
} catch (error) {
|
|
398
|
+
reject(error);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
return stripePromise;
|
|
403
|
+
};
|
|
404
|
+
var initStripe = function initStripe(maybeStripe, args, startTime) {
|
|
405
|
+
if (maybeStripe === null) {
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
var stripe = maybeStripe.apply(undefined, args);
|
|
410
|
+
registerWrapper(stripe, startTime);
|
|
411
|
+
return stripe;
|
|
412
|
+
}; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
413
|
+
|
|
414
|
+
// own script injection.
|
|
415
|
+
|
|
416
|
+
var stripePromise$1 = Promise.resolve().then(function () {
|
|
417
|
+
return loadScript(null);
|
|
418
|
+
});
|
|
419
|
+
var loadCalled = false;
|
|
420
|
+
stripePromise$1["catch"](function (err) {
|
|
421
|
+
if (!loadCalled) {
|
|
422
|
+
console.warn(err);
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
var loadStripe = function loadStripe() {
|
|
426
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
427
|
+
args[_key] = arguments[_key];
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
loadCalled = true;
|
|
431
|
+
var startTime = Date.now();
|
|
432
|
+
return stripePromise$1.then(function (maybeStripe) {
|
|
433
|
+
return initStripe(maybeStripe, args, startTime);
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
const getPlatforms = (win) => setupPlatforms(win);
|
|
438
|
+
const setupPlatforms = (win = window) => {
|
|
439
|
+
if (typeof win === 'undefined') {
|
|
440
|
+
return [];
|
|
441
|
+
}
|
|
442
|
+
win.Ionic = win.Ionic || {};
|
|
443
|
+
let platforms = win.Ionic.platforms;
|
|
444
|
+
if (platforms == null) {
|
|
445
|
+
platforms = win.Ionic.platforms = detectPlatforms(win);
|
|
446
|
+
platforms.forEach(p => win.document.documentElement.classList.add(`plt-${p}`));
|
|
447
|
+
}
|
|
448
|
+
return platforms;
|
|
449
|
+
};
|
|
450
|
+
const detectPlatforms = (win) => Object.keys(PLATFORMS_MAP).filter(p => PLATFORMS_MAP[p](win));
|
|
451
|
+
const isMobileWeb = (win) => isMobile(win) && !isHybrid(win);
|
|
452
|
+
const isIpad = (win) => {
|
|
453
|
+
// iOS 12 and below
|
|
454
|
+
if (testUserAgent(win, /iPad/i)) {
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
// iOS 13+
|
|
458
|
+
if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {
|
|
459
|
+
return true;
|
|
460
|
+
}
|
|
461
|
+
return false;
|
|
462
|
+
};
|
|
463
|
+
const isIphone = (win) => testUserAgent(win, /iPhone/i);
|
|
464
|
+
const isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
|
|
465
|
+
const isAndroid = (win) => testUserAgent(win, /android|sink/i);
|
|
466
|
+
const isAndroidTablet = (win) => {
|
|
467
|
+
return isAndroid(win) && !testUserAgent(win, /mobile/i);
|
|
468
|
+
};
|
|
469
|
+
const isPhablet = (win) => {
|
|
470
|
+
const width = win.innerWidth;
|
|
471
|
+
const height = win.innerHeight;
|
|
472
|
+
const smallest = Math.min(width, height);
|
|
473
|
+
const largest = Math.max(width, height);
|
|
474
|
+
return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;
|
|
475
|
+
};
|
|
476
|
+
const isTablet = (win) => {
|
|
477
|
+
const width = win.innerWidth;
|
|
478
|
+
const height = win.innerHeight;
|
|
479
|
+
const smallest = Math.min(width, height);
|
|
480
|
+
const largest = Math.max(width, height);
|
|
481
|
+
return isIpad(win) || isAndroidTablet(win) || (smallest > 460 && smallest < 820 && largest > 780 && largest < 1400);
|
|
482
|
+
};
|
|
483
|
+
const isMobile = (win) => matchMedia(win, '(any-pointer:coarse)');
|
|
484
|
+
const isDesktop = (win) => !isMobile(win);
|
|
485
|
+
const isHybrid = (win) => isCordova(win) || isCapacitorNative(win);
|
|
486
|
+
const isCordova = (win) => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
|
|
487
|
+
const isCapacitorNative = (win) => {
|
|
488
|
+
const capacitor = win['Capacitor'];
|
|
489
|
+
return !!(capacitor && capacitor.isNative);
|
|
490
|
+
};
|
|
491
|
+
const isElectron = (win) => testUserAgent(win, /electron/i);
|
|
492
|
+
const isPWA = (win) => !!(win.matchMedia('(display-mode: standalone)').matches || win.navigator.standalone);
|
|
493
|
+
const testUserAgent = (win, expr) => expr.test(win.navigator.userAgent);
|
|
494
|
+
const matchMedia = (win, query) => win.matchMedia(query).matches;
|
|
495
|
+
const PLATFORMS_MAP = {
|
|
496
|
+
ipad: isIpad,
|
|
497
|
+
iphone: isIphone,
|
|
498
|
+
ios: isIOS,
|
|
499
|
+
android: isAndroid,
|
|
500
|
+
phablet: isPhablet,
|
|
501
|
+
tablet: isTablet,
|
|
502
|
+
cordova: isCordova,
|
|
503
|
+
capacitor: isCapacitorNative,
|
|
504
|
+
electron: isElectron,
|
|
505
|
+
pwa: isPWA,
|
|
506
|
+
mobile: isMobile,
|
|
507
|
+
mobileweb: isMobileWeb,
|
|
508
|
+
desktop: isDesktop,
|
|
509
|
+
hybrid: isHybrid,
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
const checkPlatform = () => {
|
|
513
|
+
const device = getPlatforms();
|
|
514
|
+
if (device.includes('ios')) {
|
|
515
|
+
return 'ios';
|
|
516
|
+
}
|
|
517
|
+
if (device.includes('android')) {
|
|
518
|
+
return 'android';
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
const waitForElm = (el, selector) => {
|
|
522
|
+
return new Promise(resolve => {
|
|
523
|
+
if (el.querySelector(selector)) {
|
|
524
|
+
return resolve(el.querySelector(selector));
|
|
525
|
+
}
|
|
526
|
+
const observer = new MutationObserver(() => {
|
|
527
|
+
if (el.querySelector(selector)) {
|
|
528
|
+
resolve(el.querySelector(selector));
|
|
529
|
+
observer.disconnect();
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
observer.observe(el, {
|
|
533
|
+
childList: true,
|
|
534
|
+
subtree: true
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
function _typeof(obj) {
|
|
540
|
+
"@babel/helpers - typeof";
|
|
541
|
+
|
|
542
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
543
|
+
return typeof obj;
|
|
544
|
+
} : function (obj) {
|
|
545
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
546
|
+
}, _typeof(obj);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
function _defineProperty(obj, key, value) {
|
|
550
|
+
if (key in obj) {
|
|
551
|
+
Object.defineProperty(obj, key, {
|
|
552
|
+
value: value,
|
|
553
|
+
enumerable: true,
|
|
554
|
+
configurable: true,
|
|
555
|
+
writable: true
|
|
556
|
+
});
|
|
557
|
+
} else {
|
|
558
|
+
obj[key] = value;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
return obj;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
function _objectSpread(target) {
|
|
565
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
566
|
+
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
567
|
+
var ownKeys = Object.keys(source);
|
|
568
|
+
|
|
569
|
+
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
570
|
+
ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
571
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
572
|
+
}));
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
ownKeys.forEach(function (key) {
|
|
576
|
+
_defineProperty(target, key, source[key]);
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return target;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
function _classCallCheck(instance, Constructor) {
|
|
584
|
+
if (!(instance instanceof Constructor)) {
|
|
585
|
+
throw new TypeError("Cannot call a class as a function");
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function _defineProperties(target, props) {
|
|
590
|
+
for (var i = 0; i < props.length; i++) {
|
|
591
|
+
var descriptor = props[i];
|
|
592
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
593
|
+
descriptor.configurable = true;
|
|
594
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
595
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
600
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
601
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
602
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
603
|
+
writable: false
|
|
604
|
+
});
|
|
605
|
+
return Constructor;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
function _assertThisInitialized(self) {
|
|
609
|
+
if (self === void 0) {
|
|
610
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
return self;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
function _possibleConstructorReturn(self, call) {
|
|
617
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
618
|
+
return call;
|
|
619
|
+
} else if (call !== void 0) {
|
|
620
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
return _assertThisInitialized(self);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
function _getPrototypeOf(o) {
|
|
627
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
628
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
629
|
+
};
|
|
630
|
+
return _getPrototypeOf(o);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
function _setPrototypeOf(o, p) {
|
|
634
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
635
|
+
o.__proto__ = p;
|
|
636
|
+
return o;
|
|
637
|
+
};
|
|
638
|
+
return _setPrototypeOf(o, p);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function _inherits(subClass, superClass) {
|
|
642
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
643
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
647
|
+
constructor: {
|
|
648
|
+
value: subClass,
|
|
649
|
+
writable: true,
|
|
650
|
+
configurable: true
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
Object.defineProperty(subClass, "prototype", {
|
|
654
|
+
writable: false
|
|
655
|
+
});
|
|
656
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
var consoleLogger = {
|
|
660
|
+
type: 'logger',
|
|
661
|
+
log: function log(args) {
|
|
662
|
+
this.output('log', args);
|
|
663
|
+
},
|
|
664
|
+
warn: function warn(args) {
|
|
665
|
+
this.output('warn', args);
|
|
666
|
+
},
|
|
667
|
+
error: function error(args) {
|
|
668
|
+
this.output('error', args);
|
|
669
|
+
},
|
|
670
|
+
output: function output(type, args) {
|
|
671
|
+
if (console && console[type]) console[type].apply(console, args);
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
var Logger = function () {
|
|
676
|
+
function Logger(concreteLogger) {
|
|
677
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
678
|
+
|
|
679
|
+
_classCallCheck(this, Logger);
|
|
680
|
+
|
|
681
|
+
this.init(concreteLogger, options);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
_createClass(Logger, [{
|
|
685
|
+
key: "init",
|
|
686
|
+
value: function init(concreteLogger) {
|
|
687
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
688
|
+
this.prefix = options.prefix || 'i18next:';
|
|
689
|
+
this.logger = concreteLogger || consoleLogger;
|
|
690
|
+
this.options = options;
|
|
691
|
+
this.debug = options.debug;
|
|
692
|
+
}
|
|
693
|
+
}, {
|
|
694
|
+
key: "setDebug",
|
|
695
|
+
value: function setDebug(bool) {
|
|
696
|
+
this.debug = bool;
|
|
697
|
+
}
|
|
698
|
+
}, {
|
|
699
|
+
key: "log",
|
|
700
|
+
value: function log() {
|
|
701
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
702
|
+
args[_key] = arguments[_key];
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
return this.forward(args, 'log', '', true);
|
|
706
|
+
}
|
|
707
|
+
}, {
|
|
708
|
+
key: "warn",
|
|
709
|
+
value: function warn() {
|
|
710
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
711
|
+
args[_key2] = arguments[_key2];
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
return this.forward(args, 'warn', '', true);
|
|
715
|
+
}
|
|
716
|
+
}, {
|
|
717
|
+
key: "error",
|
|
718
|
+
value: function error() {
|
|
719
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
720
|
+
args[_key3] = arguments[_key3];
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
return this.forward(args, 'error', '');
|
|
724
|
+
}
|
|
725
|
+
}, {
|
|
726
|
+
key: "deprecate",
|
|
727
|
+
value: function deprecate() {
|
|
728
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
729
|
+
args[_key4] = arguments[_key4];
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
return this.forward(args, 'warn', 'WARNING DEPRECATED: ', true);
|
|
733
|
+
}
|
|
734
|
+
}, {
|
|
735
|
+
key: "forward",
|
|
736
|
+
value: function forward(args, lvl, prefix, debugOnly) {
|
|
737
|
+
if (debugOnly && !this.debug) return null;
|
|
738
|
+
if (typeof args[0] === 'string') args[0] = "".concat(prefix).concat(this.prefix, " ").concat(args[0]);
|
|
739
|
+
return this.logger[lvl](args);
|
|
740
|
+
}
|
|
741
|
+
}, {
|
|
742
|
+
key: "create",
|
|
743
|
+
value: function create(moduleName) {
|
|
744
|
+
return new Logger(this.logger, _objectSpread({}, {
|
|
745
|
+
prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
|
|
746
|
+
}, this.options));
|
|
747
|
+
}
|
|
748
|
+
}]);
|
|
749
|
+
|
|
750
|
+
return Logger;
|
|
751
|
+
}();
|
|
752
|
+
|
|
753
|
+
var baseLogger = new Logger();
|
|
754
|
+
|
|
755
|
+
var EventEmitter = function () {
|
|
756
|
+
function EventEmitter() {
|
|
757
|
+
_classCallCheck(this, EventEmitter);
|
|
758
|
+
|
|
759
|
+
this.observers = {};
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
_createClass(EventEmitter, [{
|
|
763
|
+
key: "on",
|
|
764
|
+
value: function on(events, listener) {
|
|
765
|
+
var _this = this;
|
|
766
|
+
|
|
767
|
+
events.split(' ').forEach(function (event) {
|
|
768
|
+
_this.observers[event] = _this.observers[event] || [];
|
|
769
|
+
|
|
770
|
+
_this.observers[event].push(listener);
|
|
771
|
+
});
|
|
772
|
+
return this;
|
|
773
|
+
}
|
|
774
|
+
}, {
|
|
775
|
+
key: "off",
|
|
776
|
+
value: function off(event, listener) {
|
|
777
|
+
if (!this.observers[event]) return;
|
|
778
|
+
|
|
779
|
+
if (!listener) {
|
|
780
|
+
delete this.observers[event];
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
this.observers[event] = this.observers[event].filter(function (l) {
|
|
785
|
+
return l !== listener;
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
}, {
|
|
789
|
+
key: "emit",
|
|
790
|
+
value: function emit(event) {
|
|
791
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
792
|
+
args[_key - 1] = arguments[_key];
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
if (this.observers[event]) {
|
|
796
|
+
var cloned = [].concat(this.observers[event]);
|
|
797
|
+
cloned.forEach(function (observer) {
|
|
798
|
+
observer.apply(void 0, args);
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
if (this.observers['*']) {
|
|
803
|
+
var _cloned = [].concat(this.observers['*']);
|
|
804
|
+
|
|
805
|
+
_cloned.forEach(function (observer) {
|
|
806
|
+
observer.apply(observer, [event].concat(args));
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}]);
|
|
811
|
+
|
|
812
|
+
return EventEmitter;
|
|
813
|
+
}();
|
|
814
|
+
|
|
815
|
+
function defer() {
|
|
816
|
+
var res;
|
|
817
|
+
var rej;
|
|
818
|
+
var promise = new Promise(function (resolve, reject) {
|
|
819
|
+
res = resolve;
|
|
820
|
+
rej = reject;
|
|
821
|
+
});
|
|
822
|
+
promise.resolve = res;
|
|
823
|
+
promise.reject = rej;
|
|
824
|
+
return promise;
|
|
825
|
+
}
|
|
826
|
+
function makeString(object) {
|
|
827
|
+
if (object == null) return '';
|
|
828
|
+
return '' + object;
|
|
829
|
+
}
|
|
830
|
+
function copy(a, s, t) {
|
|
831
|
+
a.forEach(function (m) {
|
|
832
|
+
if (s[m]) t[m] = s[m];
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
function getLastOfPath(object, path, Empty) {
|
|
837
|
+
function cleanKey(key) {
|
|
838
|
+
return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
function canNotTraverseDeeper() {
|
|
842
|
+
return !object || typeof object === 'string';
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
var stack = typeof path !== 'string' ? [].concat(path) : path.split('.');
|
|
846
|
+
|
|
847
|
+
while (stack.length > 1) {
|
|
848
|
+
if (canNotTraverseDeeper()) return {};
|
|
849
|
+
var key = cleanKey(stack.shift());
|
|
850
|
+
if (!object[key] && Empty) object[key] = new Empty();
|
|
851
|
+
|
|
852
|
+
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
853
|
+
object = object[key];
|
|
854
|
+
} else {
|
|
855
|
+
object = {};
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
if (canNotTraverseDeeper()) return {};
|
|
860
|
+
return {
|
|
861
|
+
obj: object,
|
|
862
|
+
k: cleanKey(stack.shift())
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
function setPath(object, path, newValue) {
|
|
867
|
+
var _getLastOfPath = getLastOfPath(object, path, Object),
|
|
868
|
+
obj = _getLastOfPath.obj,
|
|
869
|
+
k = _getLastOfPath.k;
|
|
870
|
+
|
|
871
|
+
obj[k] = newValue;
|
|
872
|
+
}
|
|
873
|
+
function pushPath(object, path, newValue, concat) {
|
|
874
|
+
var _getLastOfPath2 = getLastOfPath(object, path, Object),
|
|
875
|
+
obj = _getLastOfPath2.obj,
|
|
876
|
+
k = _getLastOfPath2.k;
|
|
877
|
+
|
|
878
|
+
obj[k] = obj[k] || [];
|
|
879
|
+
if (concat) obj[k] = obj[k].concat(newValue);
|
|
880
|
+
if (!concat) obj[k].push(newValue);
|
|
881
|
+
}
|
|
882
|
+
function getPath(object, path) {
|
|
883
|
+
var _getLastOfPath3 = getLastOfPath(object, path),
|
|
884
|
+
obj = _getLastOfPath3.obj,
|
|
885
|
+
k = _getLastOfPath3.k;
|
|
886
|
+
|
|
887
|
+
if (!obj) return undefined;
|
|
888
|
+
return obj[k];
|
|
889
|
+
}
|
|
890
|
+
function getPathWithDefaults(data, defaultData, key) {
|
|
891
|
+
var value = getPath(data, key);
|
|
892
|
+
|
|
893
|
+
if (value !== undefined) {
|
|
894
|
+
return value;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
return getPath(defaultData, key);
|
|
898
|
+
}
|
|
899
|
+
function deepExtend(target, source, overwrite) {
|
|
900
|
+
for (var prop in source) {
|
|
901
|
+
if (prop !== '__proto__' && prop !== 'constructor') {
|
|
902
|
+
if (prop in target) {
|
|
903
|
+
if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) {
|
|
904
|
+
if (overwrite) target[prop] = source[prop];
|
|
905
|
+
} else {
|
|
906
|
+
deepExtend(target[prop], source[prop], overwrite);
|
|
907
|
+
}
|
|
908
|
+
} else {
|
|
909
|
+
target[prop] = source[prop];
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
return target;
|
|
915
|
+
}
|
|
916
|
+
function regexEscape(str) {
|
|
917
|
+
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
|
|
918
|
+
}
|
|
919
|
+
var _entityMap = {
|
|
920
|
+
'&': '&',
|
|
921
|
+
'<': '<',
|
|
922
|
+
'>': '>',
|
|
923
|
+
'"': '"',
|
|
924
|
+
"'": ''',
|
|
925
|
+
'/': '/'
|
|
926
|
+
};
|
|
927
|
+
function escape(data) {
|
|
928
|
+
if (typeof data === 'string') {
|
|
929
|
+
return data.replace(/[&<>"'\/]/g, function (s) {
|
|
930
|
+
return _entityMap[s];
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
return data;
|
|
935
|
+
}
|
|
936
|
+
var isIE10 = typeof window !== 'undefined' && window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1;
|
|
937
|
+
|
|
938
|
+
function deepFind(obj, path) {
|
|
939
|
+
var keySeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
|
|
940
|
+
if (!obj) return undefined;
|
|
941
|
+
if (obj[path]) return obj[path];
|
|
942
|
+
var paths = path.split(keySeparator);
|
|
943
|
+
var current = obj;
|
|
944
|
+
|
|
945
|
+
for (var i = 0; i < paths.length; ++i) {
|
|
946
|
+
if (!current) return undefined;
|
|
947
|
+
|
|
948
|
+
if (typeof current[paths[i]] === 'string' && i + 1 < paths.length) {
|
|
949
|
+
return undefined;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
if (current[paths[i]] === undefined) {
|
|
953
|
+
var j = 2;
|
|
954
|
+
var p = paths.slice(i, i + j).join(keySeparator);
|
|
955
|
+
var mix = current[p];
|
|
956
|
+
|
|
957
|
+
while (mix === undefined && paths.length > i + j) {
|
|
958
|
+
j++;
|
|
959
|
+
p = paths.slice(i, i + j).join(keySeparator);
|
|
960
|
+
mix = current[p];
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
if (mix === undefined) return undefined;
|
|
964
|
+
if (typeof mix === 'string') return mix;
|
|
965
|
+
if (p && typeof mix[p] === 'string') return mix[p];
|
|
966
|
+
var joinedPath = paths.slice(i + j).join(keySeparator);
|
|
967
|
+
if (joinedPath) return deepFind(mix, joinedPath, keySeparator);
|
|
968
|
+
return undefined;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
current = current[paths[i]];
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
return current;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
var ResourceStore = function (_EventEmitter) {
|
|
978
|
+
_inherits(ResourceStore, _EventEmitter);
|
|
979
|
+
|
|
980
|
+
function ResourceStore(data) {
|
|
981
|
+
var _this;
|
|
982
|
+
|
|
983
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
984
|
+
ns: ['translation'],
|
|
985
|
+
defaultNS: 'translation'
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
_classCallCheck(this, ResourceStore);
|
|
989
|
+
|
|
990
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(ResourceStore).call(this));
|
|
991
|
+
|
|
992
|
+
if (isIE10) {
|
|
993
|
+
EventEmitter.call(_assertThisInitialized(_this));
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
_this.data = data || {};
|
|
997
|
+
_this.options = options;
|
|
998
|
+
|
|
999
|
+
if (_this.options.keySeparator === undefined) {
|
|
1000
|
+
_this.options.keySeparator = '.';
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
if (_this.options.ignoreJSONStructure === undefined) {
|
|
1004
|
+
_this.options.ignoreJSONStructure = true;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
return _this;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
_createClass(ResourceStore, [{
|
|
1011
|
+
key: "addNamespaces",
|
|
1012
|
+
value: function addNamespaces(ns) {
|
|
1013
|
+
if (this.options.ns.indexOf(ns) < 0) {
|
|
1014
|
+
this.options.ns.push(ns);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}, {
|
|
1018
|
+
key: "removeNamespaces",
|
|
1019
|
+
value: function removeNamespaces(ns) {
|
|
1020
|
+
var index = this.options.ns.indexOf(ns);
|
|
1021
|
+
|
|
1022
|
+
if (index > -1) {
|
|
1023
|
+
this.options.ns.splice(index, 1);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}, {
|
|
1027
|
+
key: "getResource",
|
|
1028
|
+
value: function getResource(lng, ns, key) {
|
|
1029
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1030
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
1031
|
+
var ignoreJSONStructure = options.ignoreJSONStructure !== undefined ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
1032
|
+
var path = [lng, ns];
|
|
1033
|
+
if (key && typeof key !== 'string') path = path.concat(key);
|
|
1034
|
+
if (key && typeof key === 'string') path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
1035
|
+
|
|
1036
|
+
if (lng.indexOf('.') > -1) {
|
|
1037
|
+
path = lng.split('.');
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
var result = getPath(this.data, path);
|
|
1041
|
+
if (result || !ignoreJSONStructure || typeof key !== 'string') return result;
|
|
1042
|
+
return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
|
|
1043
|
+
}
|
|
1044
|
+
}, {
|
|
1045
|
+
key: "addResource",
|
|
1046
|
+
value: function addResource(lng, ns, key, value) {
|
|
1047
|
+
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
1048
|
+
silent: false
|
|
1049
|
+
};
|
|
1050
|
+
var keySeparator = this.options.keySeparator;
|
|
1051
|
+
if (keySeparator === undefined) keySeparator = '.';
|
|
1052
|
+
var path = [lng, ns];
|
|
1053
|
+
if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
1054
|
+
|
|
1055
|
+
if (lng.indexOf('.') > -1) {
|
|
1056
|
+
path = lng.split('.');
|
|
1057
|
+
value = ns;
|
|
1058
|
+
ns = path[1];
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
this.addNamespaces(ns);
|
|
1062
|
+
setPath(this.data, path, value);
|
|
1063
|
+
if (!options.silent) this.emit('added', lng, ns, key, value);
|
|
1064
|
+
}
|
|
1065
|
+
}, {
|
|
1066
|
+
key: "addResources",
|
|
1067
|
+
value: function addResources(lng, ns, resources) {
|
|
1068
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
1069
|
+
silent: false
|
|
1070
|
+
};
|
|
1071
|
+
|
|
1072
|
+
for (var m in resources) {
|
|
1073
|
+
if (typeof resources[m] === 'string' || Object.prototype.toString.apply(resources[m]) === '[object Array]') this.addResource(lng, ns, m, resources[m], {
|
|
1074
|
+
silent: true
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
1079
|
+
}
|
|
1080
|
+
}, {
|
|
1081
|
+
key: "addResourceBundle",
|
|
1082
|
+
value: function addResourceBundle(lng, ns, resources, deep, overwrite) {
|
|
1083
|
+
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
|
|
1084
|
+
silent: false
|
|
1085
|
+
};
|
|
1086
|
+
var path = [lng, ns];
|
|
1087
|
+
|
|
1088
|
+
if (lng.indexOf('.') > -1) {
|
|
1089
|
+
path = lng.split('.');
|
|
1090
|
+
deep = resources;
|
|
1091
|
+
resources = ns;
|
|
1092
|
+
ns = path[1];
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
this.addNamespaces(ns);
|
|
1096
|
+
var pack = getPath(this.data, path) || {};
|
|
1097
|
+
|
|
1098
|
+
if (deep) {
|
|
1099
|
+
deepExtend(pack, resources, overwrite);
|
|
1100
|
+
} else {
|
|
1101
|
+
pack = _objectSpread({}, pack, resources);
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
setPath(this.data, path, pack);
|
|
1105
|
+
if (!options.silent) this.emit('added', lng, ns, resources);
|
|
1106
|
+
}
|
|
1107
|
+
}, {
|
|
1108
|
+
key: "removeResourceBundle",
|
|
1109
|
+
value: function removeResourceBundle(lng, ns) {
|
|
1110
|
+
if (this.hasResourceBundle(lng, ns)) {
|
|
1111
|
+
delete this.data[lng][ns];
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
this.removeNamespaces(ns);
|
|
1115
|
+
this.emit('removed', lng, ns);
|
|
1116
|
+
}
|
|
1117
|
+
}, {
|
|
1118
|
+
key: "hasResourceBundle",
|
|
1119
|
+
value: function hasResourceBundle(lng, ns) {
|
|
1120
|
+
return this.getResource(lng, ns) !== undefined;
|
|
1121
|
+
}
|
|
1122
|
+
}, {
|
|
1123
|
+
key: "getResourceBundle",
|
|
1124
|
+
value: function getResourceBundle(lng, ns) {
|
|
1125
|
+
if (!ns) ns = this.options.defaultNS;
|
|
1126
|
+
if (this.options.compatibilityAPI === 'v1') return _objectSpread({}, {}, this.getResource(lng, ns));
|
|
1127
|
+
return this.getResource(lng, ns);
|
|
1128
|
+
}
|
|
1129
|
+
}, {
|
|
1130
|
+
key: "getDataByLanguage",
|
|
1131
|
+
value: function getDataByLanguage(lng) {
|
|
1132
|
+
return this.data[lng];
|
|
1133
|
+
}
|
|
1134
|
+
}, {
|
|
1135
|
+
key: "toJSON",
|
|
1136
|
+
value: function toJSON() {
|
|
1137
|
+
return this.data;
|
|
1138
|
+
}
|
|
1139
|
+
}]);
|
|
1140
|
+
|
|
1141
|
+
return ResourceStore;
|
|
1142
|
+
}(EventEmitter);
|
|
1143
|
+
|
|
1144
|
+
var postProcessor = {
|
|
1145
|
+
processors: {},
|
|
1146
|
+
addPostProcessor: function addPostProcessor(module) {
|
|
1147
|
+
this.processors[module.name] = module;
|
|
1148
|
+
},
|
|
1149
|
+
handle: function handle(processors, value, key, options, translator) {
|
|
1150
|
+
var _this = this;
|
|
1151
|
+
|
|
1152
|
+
processors.forEach(function (processor) {
|
|
1153
|
+
if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator);
|
|
1154
|
+
});
|
|
1155
|
+
return value;
|
|
1156
|
+
}
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
var checkedLoadedFor = {};
|
|
1160
|
+
|
|
1161
|
+
var Translator = function (_EventEmitter) {
|
|
1162
|
+
_inherits(Translator, _EventEmitter);
|
|
1163
|
+
|
|
1164
|
+
function Translator(services) {
|
|
1165
|
+
var _this;
|
|
1166
|
+
|
|
1167
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1168
|
+
|
|
1169
|
+
_classCallCheck(this, Translator);
|
|
1170
|
+
|
|
1171
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(Translator).call(this));
|
|
1172
|
+
|
|
1173
|
+
if (isIE10) {
|
|
1174
|
+
EventEmitter.call(_assertThisInitialized(_this));
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
copy(['resourceStore', 'languageUtils', 'pluralResolver', 'interpolator', 'backendConnector', 'i18nFormat', 'utils'], services, _assertThisInitialized(_this));
|
|
1178
|
+
_this.options = options;
|
|
1179
|
+
|
|
1180
|
+
if (_this.options.keySeparator === undefined) {
|
|
1181
|
+
_this.options.keySeparator = '.';
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
_this.logger = baseLogger.create('translator');
|
|
1185
|
+
return _this;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
_createClass(Translator, [{
|
|
1189
|
+
key: "changeLanguage",
|
|
1190
|
+
value: function changeLanguage(lng) {
|
|
1191
|
+
if (lng) this.language = lng;
|
|
1192
|
+
}
|
|
1193
|
+
}, {
|
|
1194
|
+
key: "exists",
|
|
1195
|
+
value: function exists(key) {
|
|
1196
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
1197
|
+
interpolation: {}
|
|
1198
|
+
};
|
|
1199
|
+
|
|
1200
|
+
if (key === undefined || key === null) {
|
|
1201
|
+
return false;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
var resolved = this.resolve(key, options);
|
|
1205
|
+
return resolved && resolved.res !== undefined;
|
|
1206
|
+
}
|
|
1207
|
+
}, {
|
|
1208
|
+
key: "extractFromKey",
|
|
1209
|
+
value: function extractFromKey(key, options) {
|
|
1210
|
+
var nsSeparator = options.nsSeparator !== undefined ? options.nsSeparator : this.options.nsSeparator;
|
|
1211
|
+
if (nsSeparator === undefined) nsSeparator = ':';
|
|
1212
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
1213
|
+
var namespaces = options.ns || this.options.defaultNS;
|
|
1214
|
+
|
|
1215
|
+
if (nsSeparator && key.indexOf(nsSeparator) > -1) {
|
|
1216
|
+
var m = key.match(this.interpolator.nestingRegexp);
|
|
1217
|
+
|
|
1218
|
+
if (m && m.length > 0) {
|
|
1219
|
+
return {
|
|
1220
|
+
key: key,
|
|
1221
|
+
namespaces: namespaces
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
var parts = key.split(nsSeparator);
|
|
1226
|
+
if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1) namespaces = parts.shift();
|
|
1227
|
+
key = parts.join(keySeparator);
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
1231
|
+
return {
|
|
1232
|
+
key: key,
|
|
1233
|
+
namespaces: namespaces
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
}, {
|
|
1237
|
+
key: "translate",
|
|
1238
|
+
value: function translate(keys, options, lastKey) {
|
|
1239
|
+
var _this2 = this;
|
|
1240
|
+
|
|
1241
|
+
if (_typeof(options) !== 'object' && this.options.overloadTranslationOptionHandler) {
|
|
1242
|
+
options = this.options.overloadTranslationOptionHandler(arguments);
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
if (!options) options = {};
|
|
1246
|
+
if (keys === undefined || keys === null) return '';
|
|
1247
|
+
if (!Array.isArray(keys)) keys = [String(keys)];
|
|
1248
|
+
var keySeparator = options.keySeparator !== undefined ? options.keySeparator : this.options.keySeparator;
|
|
1249
|
+
|
|
1250
|
+
var _this$extractFromKey = this.extractFromKey(keys[keys.length - 1], options),
|
|
1251
|
+
key = _this$extractFromKey.key,
|
|
1252
|
+
namespaces = _this$extractFromKey.namespaces;
|
|
1253
|
+
|
|
1254
|
+
var namespace = namespaces[namespaces.length - 1];
|
|
1255
|
+
var lng = options.lng || this.language;
|
|
1256
|
+
var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
1257
|
+
|
|
1258
|
+
if (lng && lng.toLowerCase() === 'cimode') {
|
|
1259
|
+
if (appendNamespaceToCIMode) {
|
|
1260
|
+
var nsSeparator = options.nsSeparator || this.options.nsSeparator;
|
|
1261
|
+
return namespace + nsSeparator + key;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
return key;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
var resolved = this.resolve(keys, options);
|
|
1268
|
+
var res = resolved && resolved.res;
|
|
1269
|
+
var resUsedKey = resolved && resolved.usedKey || key;
|
|
1270
|
+
var resExactUsedKey = resolved && resolved.exactUsedKey || key;
|
|
1271
|
+
var resType = Object.prototype.toString.apply(res);
|
|
1272
|
+
var noObject = ['[object Number]', '[object Function]', '[object RegExp]'];
|
|
1273
|
+
var joinArrays = options.joinArrays !== undefined ? options.joinArrays : this.options.joinArrays;
|
|
1274
|
+
var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
1275
|
+
var handleAsObject = typeof res !== 'string' && typeof res !== 'boolean' && typeof res !== 'number';
|
|
1276
|
+
|
|
1277
|
+
if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === 'string' && resType === '[object Array]')) {
|
|
1278
|
+
if (!options.returnObjects && !this.options.returnObjects) {
|
|
1279
|
+
if (!this.options.returnedObjectHandler) {
|
|
1280
|
+
this.logger.warn('accessing an object - but returnObjects options is not enabled!');
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
return this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread({}, options, {
|
|
1284
|
+
ns: namespaces
|
|
1285
|
+
})) : "key '".concat(key, " (").concat(this.language, ")' returned an object instead of string.");
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
if (keySeparator) {
|
|
1289
|
+
var resTypeIsArray = resType === '[object Array]';
|
|
1290
|
+
var copy = resTypeIsArray ? [] : {};
|
|
1291
|
+
var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
|
|
1292
|
+
|
|
1293
|
+
for (var m in res) {
|
|
1294
|
+
if (Object.prototype.hasOwnProperty.call(res, m)) {
|
|
1295
|
+
var deepKey = "".concat(newKeyToUse).concat(keySeparator).concat(m);
|
|
1296
|
+
copy[m] = this.translate(deepKey, _objectSpread({}, options, {
|
|
1297
|
+
joinArrays: false,
|
|
1298
|
+
ns: namespaces
|
|
1299
|
+
}));
|
|
1300
|
+
if (copy[m] === deepKey) copy[m] = res[m];
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
res = copy;
|
|
1305
|
+
}
|
|
1306
|
+
} else if (handleAsObjectInI18nFormat && typeof joinArrays === 'string' && resType === '[object Array]') {
|
|
1307
|
+
res = res.join(joinArrays);
|
|
1308
|
+
if (res) res = this.extendTranslation(res, keys, options, lastKey);
|
|
1309
|
+
} else {
|
|
1310
|
+
var usedDefault = false;
|
|
1311
|
+
var usedKey = false;
|
|
1312
|
+
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
1313
|
+
var hasDefaultValue = Translator.hasDefaultValue(options);
|
|
1314
|
+
var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count) : '';
|
|
1315
|
+
var defaultValue = options["defaultValue".concat(defaultValueSuffix)] || options.defaultValue;
|
|
1316
|
+
|
|
1317
|
+
if (!this.isValidLookup(res) && hasDefaultValue) {
|
|
1318
|
+
usedDefault = true;
|
|
1319
|
+
res = defaultValue;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
if (!this.isValidLookup(res)) {
|
|
1323
|
+
usedKey = true;
|
|
1324
|
+
res = key;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
|
|
1328
|
+
var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? undefined : res;
|
|
1329
|
+
var updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
|
|
1330
|
+
|
|
1331
|
+
if (usedKey || usedDefault || updateMissing) {
|
|
1332
|
+
this.logger.log(updateMissing ? 'updateKey' : 'missingKey', lng, namespace, key, updateMissing ? defaultValue : res);
|
|
1333
|
+
|
|
1334
|
+
if (keySeparator) {
|
|
1335
|
+
var fk = this.resolve(key, _objectSpread({}, options, {
|
|
1336
|
+
keySeparator: false
|
|
1337
|
+
}));
|
|
1338
|
+
if (fk && fk.res) this.logger.warn('Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.');
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
var lngs = [];
|
|
1342
|
+
var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
|
|
1343
|
+
|
|
1344
|
+
if (this.options.saveMissingTo === 'fallback' && fallbackLngs && fallbackLngs[0]) {
|
|
1345
|
+
for (var i = 0; i < fallbackLngs.length; i++) {
|
|
1346
|
+
lngs.push(fallbackLngs[i]);
|
|
1347
|
+
}
|
|
1348
|
+
} else if (this.options.saveMissingTo === 'all') {
|
|
1349
|
+
lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
|
|
1350
|
+
} else {
|
|
1351
|
+
lngs.push(options.lng || this.language);
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
var send = function send(l, k, fallbackValue) {
|
|
1355
|
+
if (_this2.options.missingKeyHandler) {
|
|
1356
|
+
_this2.options.missingKeyHandler(l, namespace, k, updateMissing ? fallbackValue : resForMissing, updateMissing, options);
|
|
1357
|
+
} else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
|
|
1358
|
+
_this2.backendConnector.saveMissing(l, namespace, k, updateMissing ? fallbackValue : resForMissing, updateMissing, options);
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
_this2.emit('missingKey', l, namespace, k, res);
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
if (this.options.saveMissing) {
|
|
1365
|
+
if (this.options.saveMissingPlurals && needsPluralHandling) {
|
|
1366
|
+
lngs.forEach(function (language) {
|
|
1367
|
+
_this2.pluralResolver.getSuffixes(language).forEach(function (suffix) {
|
|
1368
|
+
send([language], key + suffix, options["defaultValue".concat(suffix)] || defaultValue);
|
|
1369
|
+
});
|
|
1370
|
+
});
|
|
1371
|
+
} else {
|
|
1372
|
+
send(lngs, key, defaultValue);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
res = this.extendTranslation(res, keys, options, resolved, lastKey);
|
|
1378
|
+
if (usedKey && res === key && this.options.appendNamespaceToMissingKey) res = "".concat(namespace, ":").concat(key);
|
|
1379
|
+
if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) res = this.options.parseMissingKeyHandler(res);
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
return res;
|
|
1383
|
+
}
|
|
1384
|
+
}, {
|
|
1385
|
+
key: "extendTranslation",
|
|
1386
|
+
value: function extendTranslation(res, key, options, resolved, lastKey) {
|
|
1387
|
+
var _this3 = this;
|
|
1388
|
+
|
|
1389
|
+
if (this.i18nFormat && this.i18nFormat.parse) {
|
|
1390
|
+
res = this.i18nFormat.parse(res, options, resolved.usedLng, resolved.usedNS, resolved.usedKey, {
|
|
1391
|
+
resolved: resolved
|
|
1392
|
+
});
|
|
1393
|
+
} else if (!options.skipInterpolation) {
|
|
1394
|
+
if (options.interpolation) this.interpolator.init(_objectSpread({}, options, {
|
|
1395
|
+
interpolation: _objectSpread({}, this.options.interpolation, options.interpolation)
|
|
1396
|
+
}));
|
|
1397
|
+
var skipOnVariables = options.interpolation && options.interpolation.skipOnVariables || this.options.interpolation.skipOnVariables;
|
|
1398
|
+
var nestBef;
|
|
1399
|
+
|
|
1400
|
+
if (skipOnVariables) {
|
|
1401
|
+
var nb = res.match(this.interpolator.nestingRegexp);
|
|
1402
|
+
nestBef = nb && nb.length;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
var data = options.replace && typeof options.replace !== 'string' ? options.replace : options;
|
|
1406
|
+
if (this.options.interpolation.defaultVariables) data = _objectSpread({}, this.options.interpolation.defaultVariables, data);
|
|
1407
|
+
res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
|
|
1408
|
+
|
|
1409
|
+
if (skipOnVariables) {
|
|
1410
|
+
var na = res.match(this.interpolator.nestingRegexp);
|
|
1411
|
+
var nestAft = na && na.length;
|
|
1412
|
+
if (nestBef < nestAft) options.nest = false;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
if (options.nest !== false) res = this.interpolator.nest(res, function () {
|
|
1416
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1417
|
+
args[_key] = arguments[_key];
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
if (lastKey && lastKey[0] === args[0] && !options.context) {
|
|
1421
|
+
_this3.logger.warn("It seems you are nesting recursively key: ".concat(args[0], " in key: ").concat(key[0]));
|
|
1422
|
+
|
|
1423
|
+
return null;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
return _this3.translate.apply(_this3, args.concat([key]));
|
|
1427
|
+
}, options);
|
|
1428
|
+
if (options.interpolation) this.interpolator.reset();
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
var postProcess = options.postProcess || this.options.postProcess;
|
|
1432
|
+
var postProcessorNames = typeof postProcess === 'string' ? [postProcess] : postProcess;
|
|
1433
|
+
|
|
1434
|
+
if (res !== undefined && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
|
|
1435
|
+
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread({
|
|
1436
|
+
i18nResolved: resolved
|
|
1437
|
+
}, options) : options, this);
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
return res;
|
|
1441
|
+
}
|
|
1442
|
+
}, {
|
|
1443
|
+
key: "resolve",
|
|
1444
|
+
value: function resolve(keys) {
|
|
1445
|
+
var _this4 = this;
|
|
1446
|
+
|
|
1447
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1448
|
+
var found;
|
|
1449
|
+
var usedKey;
|
|
1450
|
+
var exactUsedKey;
|
|
1451
|
+
var usedLng;
|
|
1452
|
+
var usedNS;
|
|
1453
|
+
if (typeof keys === 'string') keys = [keys];
|
|
1454
|
+
keys.forEach(function (k) {
|
|
1455
|
+
if (_this4.isValidLookup(found)) return;
|
|
1456
|
+
|
|
1457
|
+
var extracted = _this4.extractFromKey(k, options);
|
|
1458
|
+
|
|
1459
|
+
var key = extracted.key;
|
|
1460
|
+
usedKey = key;
|
|
1461
|
+
var namespaces = extracted.namespaces;
|
|
1462
|
+
if (_this4.options.fallbackNS) namespaces = namespaces.concat(_this4.options.fallbackNS);
|
|
1463
|
+
var needsPluralHandling = options.count !== undefined && typeof options.count !== 'string';
|
|
1464
|
+
var needsContextHandling = options.context !== undefined && (typeof options.context === 'string' || typeof options.context === 'number') && options.context !== '';
|
|
1465
|
+
var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
|
|
1466
|
+
namespaces.forEach(function (ns) {
|
|
1467
|
+
if (_this4.isValidLookup(found)) return;
|
|
1468
|
+
usedNS = ns;
|
|
1469
|
+
|
|
1470
|
+
if (!checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
|
|
1471
|
+
checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true;
|
|
1472
|
+
|
|
1473
|
+
_this4.logger.warn("key \"".concat(usedKey, "\" for languages \"").concat(codes.join(', '), "\" won't get resolved as namespace \"").concat(usedNS, "\" was not yet loaded"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
codes.forEach(function (code) {
|
|
1477
|
+
if (_this4.isValidLookup(found)) return;
|
|
1478
|
+
usedLng = code;
|
|
1479
|
+
var finalKey = key;
|
|
1480
|
+
var finalKeys = [finalKey];
|
|
1481
|
+
|
|
1482
|
+
if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
|
|
1483
|
+
_this4.i18nFormat.addLookupKeys(finalKeys, key, code, ns, options);
|
|
1484
|
+
} else {
|
|
1485
|
+
var pluralSuffix;
|
|
1486
|
+
if (needsPluralHandling) pluralSuffix = _this4.pluralResolver.getSuffix(code, options.count);
|
|
1487
|
+
if (needsPluralHandling && needsContextHandling) finalKeys.push(finalKey + pluralSuffix);
|
|
1488
|
+
if (needsContextHandling) finalKeys.push(finalKey += "".concat(_this4.options.contextSeparator).concat(options.context));
|
|
1489
|
+
if (needsPluralHandling) finalKeys.push(finalKey += pluralSuffix);
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
var possibleKey;
|
|
1493
|
+
|
|
1494
|
+
while (possibleKey = finalKeys.pop()) {
|
|
1495
|
+
if (!_this4.isValidLookup(found)) {
|
|
1496
|
+
exactUsedKey = possibleKey;
|
|
1497
|
+
found = _this4.getResource(code, ns, possibleKey, options);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
});
|
|
1501
|
+
});
|
|
1502
|
+
});
|
|
1503
|
+
return {
|
|
1504
|
+
res: found,
|
|
1505
|
+
usedKey: usedKey,
|
|
1506
|
+
exactUsedKey: exactUsedKey,
|
|
1507
|
+
usedLng: usedLng,
|
|
1508
|
+
usedNS: usedNS
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1511
|
+
}, {
|
|
1512
|
+
key: "isValidLookup",
|
|
1513
|
+
value: function isValidLookup(res) {
|
|
1514
|
+
return res !== undefined && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === '');
|
|
1515
|
+
}
|
|
1516
|
+
}, {
|
|
1517
|
+
key: "getResource",
|
|
1518
|
+
value: function getResource(code, ns, key) {
|
|
1519
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1520
|
+
if (this.i18nFormat && this.i18nFormat.getResource) return this.i18nFormat.getResource(code, ns, key, options);
|
|
1521
|
+
return this.resourceStore.getResource(code, ns, key, options);
|
|
1522
|
+
}
|
|
1523
|
+
}], [{
|
|
1524
|
+
key: "hasDefaultValue",
|
|
1525
|
+
value: function hasDefaultValue(options) {
|
|
1526
|
+
var prefix = 'defaultValue';
|
|
1527
|
+
|
|
1528
|
+
for (var option in options) {
|
|
1529
|
+
if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && undefined !== options[option]) {
|
|
1530
|
+
return true;
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
return false;
|
|
1535
|
+
}
|
|
1536
|
+
}]);
|
|
1537
|
+
|
|
1538
|
+
return Translator;
|
|
1539
|
+
}(EventEmitter);
|
|
1540
|
+
|
|
1541
|
+
function capitalize(string) {
|
|
1542
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
var LanguageUtil = function () {
|
|
1546
|
+
function LanguageUtil(options) {
|
|
1547
|
+
_classCallCheck(this, LanguageUtil);
|
|
1548
|
+
|
|
1549
|
+
this.options = options;
|
|
1550
|
+
this.whitelist = this.options.supportedLngs || false;
|
|
1551
|
+
this.supportedLngs = this.options.supportedLngs || false;
|
|
1552
|
+
this.logger = baseLogger.create('languageUtils');
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
_createClass(LanguageUtil, [{
|
|
1556
|
+
key: "getScriptPartFromCode",
|
|
1557
|
+
value: function getScriptPartFromCode(code) {
|
|
1558
|
+
if (!code || code.indexOf('-') < 0) return null;
|
|
1559
|
+
var p = code.split('-');
|
|
1560
|
+
if (p.length === 2) return null;
|
|
1561
|
+
p.pop();
|
|
1562
|
+
if (p[p.length - 1].toLowerCase() === 'x') return null;
|
|
1563
|
+
return this.formatLanguageCode(p.join('-'));
|
|
1564
|
+
}
|
|
1565
|
+
}, {
|
|
1566
|
+
key: "getLanguagePartFromCode",
|
|
1567
|
+
value: function getLanguagePartFromCode(code) {
|
|
1568
|
+
if (!code || code.indexOf('-') < 0) return code;
|
|
1569
|
+
var p = code.split('-');
|
|
1570
|
+
return this.formatLanguageCode(p[0]);
|
|
1571
|
+
}
|
|
1572
|
+
}, {
|
|
1573
|
+
key: "formatLanguageCode",
|
|
1574
|
+
value: function formatLanguageCode(code) {
|
|
1575
|
+
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
1576
|
+
var specialCases = ['hans', 'hant', 'latn', 'cyrl', 'cans', 'mong', 'arab'];
|
|
1577
|
+
var p = code.split('-');
|
|
1578
|
+
|
|
1579
|
+
if (this.options.lowerCaseLng) {
|
|
1580
|
+
p = p.map(function (part) {
|
|
1581
|
+
return part.toLowerCase();
|
|
1582
|
+
});
|
|
1583
|
+
} else if (p.length === 2) {
|
|
1584
|
+
p[0] = p[0].toLowerCase();
|
|
1585
|
+
p[1] = p[1].toUpperCase();
|
|
1586
|
+
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
|
|
1587
|
+
} else if (p.length === 3) {
|
|
1588
|
+
p[0] = p[0].toLowerCase();
|
|
1589
|
+
if (p[1].length === 2) p[1] = p[1].toUpperCase();
|
|
1590
|
+
if (p[0] !== 'sgn' && p[2].length === 2) p[2] = p[2].toUpperCase();
|
|
1591
|
+
if (specialCases.indexOf(p[1].toLowerCase()) > -1) p[1] = capitalize(p[1].toLowerCase());
|
|
1592
|
+
if (specialCases.indexOf(p[2].toLowerCase()) > -1) p[2] = capitalize(p[2].toLowerCase());
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
return p.join('-');
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
|
|
1599
|
+
}
|
|
1600
|
+
}, {
|
|
1601
|
+
key: "isWhitelisted",
|
|
1602
|
+
value: function isWhitelisted(code) {
|
|
1603
|
+
this.logger.deprecate('languageUtils.isWhitelisted', 'function "isWhitelisted" will be renamed to "isSupportedCode" in the next major - please make sure to rename it\'s usage asap.');
|
|
1604
|
+
return this.isSupportedCode(code);
|
|
1605
|
+
}
|
|
1606
|
+
}, {
|
|
1607
|
+
key: "isSupportedCode",
|
|
1608
|
+
value: function isSupportedCode(code) {
|
|
1609
|
+
if (this.options.load === 'languageOnly' || this.options.nonExplicitSupportedLngs) {
|
|
1610
|
+
code = this.getLanguagePartFromCode(code);
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
|
|
1614
|
+
}
|
|
1615
|
+
}, {
|
|
1616
|
+
key: "getBestMatchFromCodes",
|
|
1617
|
+
value: function getBestMatchFromCodes(codes) {
|
|
1618
|
+
var _this = this;
|
|
1619
|
+
|
|
1620
|
+
if (!codes) return null;
|
|
1621
|
+
var found;
|
|
1622
|
+
codes.forEach(function (code) {
|
|
1623
|
+
if (found) return;
|
|
1624
|
+
|
|
1625
|
+
var cleanedLng = _this.formatLanguageCode(code);
|
|
1626
|
+
|
|
1627
|
+
if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng)) found = cleanedLng;
|
|
1628
|
+
});
|
|
1629
|
+
|
|
1630
|
+
if (!found && this.options.supportedLngs) {
|
|
1631
|
+
codes.forEach(function (code) {
|
|
1632
|
+
if (found) return;
|
|
1633
|
+
|
|
1634
|
+
var lngOnly = _this.getLanguagePartFromCode(code);
|
|
1635
|
+
|
|
1636
|
+
if (_this.isSupportedCode(lngOnly)) return found = lngOnly;
|
|
1637
|
+
found = _this.options.supportedLngs.find(function (supportedLng) {
|
|
1638
|
+
if (supportedLng.indexOf(lngOnly) === 0) return supportedLng;
|
|
1639
|
+
});
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0];
|
|
1644
|
+
return found;
|
|
1645
|
+
}
|
|
1646
|
+
}, {
|
|
1647
|
+
key: "getFallbackCodes",
|
|
1648
|
+
value: function getFallbackCodes(fallbacks, code) {
|
|
1649
|
+
if (!fallbacks) return [];
|
|
1650
|
+
if (typeof fallbacks === 'function') fallbacks = fallbacks(code);
|
|
1651
|
+
if (typeof fallbacks === 'string') fallbacks = [fallbacks];
|
|
1652
|
+
if (Object.prototype.toString.apply(fallbacks) === '[object Array]') return fallbacks;
|
|
1653
|
+
if (!code) return fallbacks["default"] || [];
|
|
1654
|
+
var found = fallbacks[code];
|
|
1655
|
+
if (!found) found = fallbacks[this.getScriptPartFromCode(code)];
|
|
1656
|
+
if (!found) found = fallbacks[this.formatLanguageCode(code)];
|
|
1657
|
+
if (!found) found = fallbacks[this.getLanguagePartFromCode(code)];
|
|
1658
|
+
if (!found) found = fallbacks["default"];
|
|
1659
|
+
return found || [];
|
|
1660
|
+
}
|
|
1661
|
+
}, {
|
|
1662
|
+
key: "toResolveHierarchy",
|
|
1663
|
+
value: function toResolveHierarchy(code, fallbackCode) {
|
|
1664
|
+
var _this2 = this;
|
|
1665
|
+
|
|
1666
|
+
var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
|
|
1667
|
+
var codes = [];
|
|
1668
|
+
|
|
1669
|
+
var addCode = function addCode(c) {
|
|
1670
|
+
if (!c) return;
|
|
1671
|
+
|
|
1672
|
+
if (_this2.isSupportedCode(c)) {
|
|
1673
|
+
codes.push(c);
|
|
1674
|
+
} else {
|
|
1675
|
+
_this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c));
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
|
|
1679
|
+
if (typeof code === 'string' && code.indexOf('-') > -1) {
|
|
1680
|
+
if (this.options.load !== 'languageOnly') addCode(this.formatLanguageCode(code));
|
|
1681
|
+
if (this.options.load !== 'languageOnly' && this.options.load !== 'currentOnly') addCode(this.getScriptPartFromCode(code));
|
|
1682
|
+
if (this.options.load !== 'currentOnly') addCode(this.getLanguagePartFromCode(code));
|
|
1683
|
+
} else if (typeof code === 'string') {
|
|
1684
|
+
addCode(this.formatLanguageCode(code));
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
fallbackCodes.forEach(function (fc) {
|
|
1688
|
+
if (codes.indexOf(fc) < 0) addCode(_this2.formatLanguageCode(fc));
|
|
1689
|
+
});
|
|
1690
|
+
return codes;
|
|
1691
|
+
}
|
|
1692
|
+
}]);
|
|
1693
|
+
|
|
1694
|
+
return LanguageUtil;
|
|
1695
|
+
}();
|
|
1696
|
+
|
|
1697
|
+
var sets = [{
|
|
1698
|
+
lngs: ['ach', 'ak', 'am', 'arn', 'br', 'fil', 'gun', 'ln', 'mfe', 'mg', 'mi', 'oc', 'pt', 'pt-BR', 'tg', 'tl', 'ti', 'tr', 'uz', 'wa'],
|
|
1699
|
+
nr: [1, 2],
|
|
1700
|
+
fc: 1
|
|
1701
|
+
}, {
|
|
1702
|
+
lngs: ['af', 'an', 'ast', 'az', 'bg', 'bn', 'ca', 'da', 'de', 'dev', 'el', 'en', 'eo', 'es', 'et', 'eu', 'fi', 'fo', 'fur', 'fy', 'gl', 'gu', 'ha', 'hi', 'hu', 'hy', 'ia', 'it', 'kk', 'kn', 'ku', 'lb', 'mai', 'ml', 'mn', 'mr', 'nah', 'nap', 'nb', 'ne', 'nl', 'nn', 'no', 'nso', 'pa', 'pap', 'pms', 'ps', 'pt-PT', 'rm', 'sco', 'se', 'si', 'so', 'son', 'sq', 'sv', 'sw', 'ta', 'te', 'tk', 'ur', 'yo'],
|
|
1703
|
+
nr: [1, 2],
|
|
1704
|
+
fc: 2
|
|
1705
|
+
}, {
|
|
1706
|
+
lngs: ['ay', 'bo', 'cgg', 'fa', 'ht', 'id', 'ja', 'jbo', 'ka', 'km', 'ko', 'ky', 'lo', 'ms', 'sah', 'su', 'th', 'tt', 'ug', 'vi', 'wo', 'zh'],
|
|
1707
|
+
nr: [1],
|
|
1708
|
+
fc: 3
|
|
1709
|
+
}, {
|
|
1710
|
+
lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'],
|
|
1711
|
+
nr: [1, 2, 5],
|
|
1712
|
+
fc: 4
|
|
1713
|
+
}, {
|
|
1714
|
+
lngs: ['ar'],
|
|
1715
|
+
nr: [0, 1, 2, 3, 11, 100],
|
|
1716
|
+
fc: 5
|
|
1717
|
+
}, {
|
|
1718
|
+
lngs: ['cs', 'sk'],
|
|
1719
|
+
nr: [1, 2, 5],
|
|
1720
|
+
fc: 6
|
|
1721
|
+
}, {
|
|
1722
|
+
lngs: ['csb', 'pl'],
|
|
1723
|
+
nr: [1, 2, 5],
|
|
1724
|
+
fc: 7
|
|
1725
|
+
}, {
|
|
1726
|
+
lngs: ['cy'],
|
|
1727
|
+
nr: [1, 2, 3, 8],
|
|
1728
|
+
fc: 8
|
|
1729
|
+
}, {
|
|
1730
|
+
lngs: ['fr'],
|
|
1731
|
+
nr: [1, 2],
|
|
1732
|
+
fc: 9
|
|
1733
|
+
}, {
|
|
1734
|
+
lngs: ['ga'],
|
|
1735
|
+
nr: [1, 2, 3, 7, 11],
|
|
1736
|
+
fc: 10
|
|
1737
|
+
}, {
|
|
1738
|
+
lngs: ['gd'],
|
|
1739
|
+
nr: [1, 2, 3, 20],
|
|
1740
|
+
fc: 11
|
|
1741
|
+
}, {
|
|
1742
|
+
lngs: ['is'],
|
|
1743
|
+
nr: [1, 2],
|
|
1744
|
+
fc: 12
|
|
1745
|
+
}, {
|
|
1746
|
+
lngs: ['jv'],
|
|
1747
|
+
nr: [0, 1],
|
|
1748
|
+
fc: 13
|
|
1749
|
+
}, {
|
|
1750
|
+
lngs: ['kw'],
|
|
1751
|
+
nr: [1, 2, 3, 4],
|
|
1752
|
+
fc: 14
|
|
1753
|
+
}, {
|
|
1754
|
+
lngs: ['lt'],
|
|
1755
|
+
nr: [1, 2, 10],
|
|
1756
|
+
fc: 15
|
|
1757
|
+
}, {
|
|
1758
|
+
lngs: ['lv'],
|
|
1759
|
+
nr: [1, 2, 0],
|
|
1760
|
+
fc: 16
|
|
1761
|
+
}, {
|
|
1762
|
+
lngs: ['mk'],
|
|
1763
|
+
nr: [1, 2],
|
|
1764
|
+
fc: 17
|
|
1765
|
+
}, {
|
|
1766
|
+
lngs: ['mnk'],
|
|
1767
|
+
nr: [0, 1, 2],
|
|
1768
|
+
fc: 18
|
|
1769
|
+
}, {
|
|
1770
|
+
lngs: ['mt'],
|
|
1771
|
+
nr: [1, 2, 11, 20],
|
|
1772
|
+
fc: 19
|
|
1773
|
+
}, {
|
|
1774
|
+
lngs: ['or'],
|
|
1775
|
+
nr: [2, 1],
|
|
1776
|
+
fc: 2
|
|
1777
|
+
}, {
|
|
1778
|
+
lngs: ['ro'],
|
|
1779
|
+
nr: [1, 2, 20],
|
|
1780
|
+
fc: 20
|
|
1781
|
+
}, {
|
|
1782
|
+
lngs: ['sl'],
|
|
1783
|
+
nr: [5, 1, 2, 3],
|
|
1784
|
+
fc: 21
|
|
1785
|
+
}, {
|
|
1786
|
+
lngs: ['he', 'iw'],
|
|
1787
|
+
nr: [1, 2, 20, 21],
|
|
1788
|
+
fc: 22
|
|
1789
|
+
}];
|
|
1790
|
+
var _rulesPluralsTypes = {
|
|
1791
|
+
1: function _(n) {
|
|
1792
|
+
return Number(n > 1);
|
|
1793
|
+
},
|
|
1794
|
+
2: function _(n) {
|
|
1795
|
+
return Number(n != 1);
|
|
1796
|
+
},
|
|
1797
|
+
3: function _(n) {
|
|
1798
|
+
return 0;
|
|
1799
|
+
},
|
|
1800
|
+
4: function _(n) {
|
|
1801
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
1802
|
+
},
|
|
1803
|
+
5: function _(n) {
|
|
1804
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5);
|
|
1805
|
+
},
|
|
1806
|
+
6: function _(n) {
|
|
1807
|
+
return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
|
|
1808
|
+
},
|
|
1809
|
+
7: function _(n) {
|
|
1810
|
+
return Number(n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
1811
|
+
},
|
|
1812
|
+
8: function _(n) {
|
|
1813
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
|
|
1814
|
+
},
|
|
1815
|
+
9: function _(n) {
|
|
1816
|
+
return Number(n >= 2);
|
|
1817
|
+
},
|
|
1818
|
+
10: function _(n) {
|
|
1819
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
|
|
1820
|
+
},
|
|
1821
|
+
11: function _(n) {
|
|
1822
|
+
return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
|
|
1823
|
+
},
|
|
1824
|
+
12: function _(n) {
|
|
1825
|
+
return Number(n % 10 != 1 || n % 100 == 11);
|
|
1826
|
+
},
|
|
1827
|
+
13: function _(n) {
|
|
1828
|
+
return Number(n !== 0);
|
|
1829
|
+
},
|
|
1830
|
+
14: function _(n) {
|
|
1831
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
|
|
1832
|
+
},
|
|
1833
|
+
15: function _(n) {
|
|
1834
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
|
1835
|
+
},
|
|
1836
|
+
16: function _(n) {
|
|
1837
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
|
|
1838
|
+
},
|
|
1839
|
+
17: function _(n) {
|
|
1840
|
+
return Number(n == 1 || n % 10 == 1 && n % 100 != 11 ? 0 : 1);
|
|
1841
|
+
},
|
|
1842
|
+
18: function _(n) {
|
|
1843
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
|
|
1844
|
+
},
|
|
1845
|
+
19: function _(n) {
|
|
1846
|
+
return Number(n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3);
|
|
1847
|
+
},
|
|
1848
|
+
20: function _(n) {
|
|
1849
|
+
return Number(n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2);
|
|
1850
|
+
},
|
|
1851
|
+
21: function _(n) {
|
|
1852
|
+
return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
|
|
1853
|
+
},
|
|
1854
|
+
22: function _(n) {
|
|
1855
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);
|
|
1856
|
+
}
|
|
1857
|
+
};
|
|
1858
|
+
|
|
1859
|
+
function createRules() {
|
|
1860
|
+
var rules = {};
|
|
1861
|
+
sets.forEach(function (set) {
|
|
1862
|
+
set.lngs.forEach(function (l) {
|
|
1863
|
+
rules[l] = {
|
|
1864
|
+
numbers: set.nr,
|
|
1865
|
+
plurals: _rulesPluralsTypes[set.fc]
|
|
1866
|
+
};
|
|
1867
|
+
});
|
|
1868
|
+
});
|
|
1869
|
+
return rules;
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
var PluralResolver = function () {
|
|
1873
|
+
function PluralResolver(languageUtils) {
|
|
1874
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1875
|
+
|
|
1876
|
+
_classCallCheck(this, PluralResolver);
|
|
1877
|
+
|
|
1878
|
+
this.languageUtils = languageUtils;
|
|
1879
|
+
this.options = options;
|
|
1880
|
+
this.logger = baseLogger.create('pluralResolver');
|
|
1881
|
+
this.rules = createRules();
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
_createClass(PluralResolver, [{
|
|
1885
|
+
key: "addRule",
|
|
1886
|
+
value: function addRule(lng, obj) {
|
|
1887
|
+
this.rules[lng] = obj;
|
|
1888
|
+
}
|
|
1889
|
+
}, {
|
|
1890
|
+
key: "getRule",
|
|
1891
|
+
value: function getRule(code) {
|
|
1892
|
+
return this.rules[code] || this.rules[this.languageUtils.getLanguagePartFromCode(code)];
|
|
1893
|
+
}
|
|
1894
|
+
}, {
|
|
1895
|
+
key: "needsPlural",
|
|
1896
|
+
value: function needsPlural(code) {
|
|
1897
|
+
var rule = this.getRule(code);
|
|
1898
|
+
return rule && rule.numbers.length > 1;
|
|
1899
|
+
}
|
|
1900
|
+
}, {
|
|
1901
|
+
key: "getPluralFormsOfKey",
|
|
1902
|
+
value: function getPluralFormsOfKey(code, key) {
|
|
1903
|
+
return this.getSuffixes(code).map(function (suffix) {
|
|
1904
|
+
return key + suffix;
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
}, {
|
|
1908
|
+
key: "getSuffixes",
|
|
1909
|
+
value: function getSuffixes(code) {
|
|
1910
|
+
var _this = this;
|
|
1911
|
+
|
|
1912
|
+
var rule = this.getRule(code);
|
|
1913
|
+
|
|
1914
|
+
if (!rule) {
|
|
1915
|
+
return [];
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
return rule.numbers.map(function (number) {
|
|
1919
|
+
return _this.getSuffix(code, number);
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
}, {
|
|
1923
|
+
key: "getSuffix",
|
|
1924
|
+
value: function getSuffix(code, count) {
|
|
1925
|
+
var _this2 = this;
|
|
1926
|
+
|
|
1927
|
+
var rule = this.getRule(code);
|
|
1928
|
+
|
|
1929
|
+
if (rule) {
|
|
1930
|
+
var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
|
|
1931
|
+
var suffix = rule.numbers[idx];
|
|
1932
|
+
|
|
1933
|
+
if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
1934
|
+
if (suffix === 2) {
|
|
1935
|
+
suffix = 'plural';
|
|
1936
|
+
} else if (suffix === 1) {
|
|
1937
|
+
suffix = '';
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
var returnSuffix = function returnSuffix() {
|
|
1942
|
+
return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
|
|
1943
|
+
};
|
|
1944
|
+
|
|
1945
|
+
if (this.options.compatibilityJSON === 'v1') {
|
|
1946
|
+
if (suffix === 1) return '';
|
|
1947
|
+
if (typeof suffix === 'number') return "_plural_".concat(suffix.toString());
|
|
1948
|
+
return returnSuffix();
|
|
1949
|
+
} else if (this.options.compatibilityJSON === 'v2') {
|
|
1950
|
+
return returnSuffix();
|
|
1951
|
+
} else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
1952
|
+
return returnSuffix();
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
this.logger.warn("no plural rule found for: ".concat(code));
|
|
1959
|
+
return '';
|
|
1960
|
+
}
|
|
1961
|
+
}]);
|
|
1962
|
+
|
|
1963
|
+
return PluralResolver;
|
|
1964
|
+
}();
|
|
1965
|
+
|
|
1966
|
+
var Interpolator = function () {
|
|
1967
|
+
function Interpolator() {
|
|
1968
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1969
|
+
|
|
1970
|
+
_classCallCheck(this, Interpolator);
|
|
1971
|
+
|
|
1972
|
+
this.logger = baseLogger.create('interpolator');
|
|
1973
|
+
this.options = options;
|
|
1974
|
+
|
|
1975
|
+
this.format = options.interpolation && options.interpolation.format || function (value) {
|
|
1976
|
+
return value;
|
|
1977
|
+
};
|
|
1978
|
+
|
|
1979
|
+
this.init(options);
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
_createClass(Interpolator, [{
|
|
1983
|
+
key: "init",
|
|
1984
|
+
value: function init() {
|
|
1985
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1986
|
+
if (!options.interpolation) options.interpolation = {
|
|
1987
|
+
escapeValue: true
|
|
1988
|
+
};
|
|
1989
|
+
var iOpts = options.interpolation;
|
|
1990
|
+
this.escape = iOpts.escape !== undefined ? iOpts.escape : escape;
|
|
1991
|
+
this.escapeValue = iOpts.escapeValue !== undefined ? iOpts.escapeValue : true;
|
|
1992
|
+
this.useRawValueToEscape = iOpts.useRawValueToEscape !== undefined ? iOpts.useRawValueToEscape : false;
|
|
1993
|
+
this.prefix = iOpts.prefix ? regexEscape(iOpts.prefix) : iOpts.prefixEscaped || '{{';
|
|
1994
|
+
this.suffix = iOpts.suffix ? regexEscape(iOpts.suffix) : iOpts.suffixEscaped || '}}';
|
|
1995
|
+
this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ',';
|
|
1996
|
+
this.unescapePrefix = iOpts.unescapeSuffix ? '' : iOpts.unescapePrefix || '-';
|
|
1997
|
+
this.unescapeSuffix = this.unescapePrefix ? '' : iOpts.unescapeSuffix || '';
|
|
1998
|
+
this.nestingPrefix = iOpts.nestingPrefix ? regexEscape(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape('$t(');
|
|
1999
|
+
this.nestingSuffix = iOpts.nestingSuffix ? regexEscape(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape(')');
|
|
2000
|
+
this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ',';
|
|
2001
|
+
this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1000;
|
|
2002
|
+
this.alwaysFormat = iOpts.alwaysFormat !== undefined ? iOpts.alwaysFormat : false;
|
|
2003
|
+
this.resetRegExp();
|
|
2004
|
+
}
|
|
2005
|
+
}, {
|
|
2006
|
+
key: "reset",
|
|
2007
|
+
value: function reset() {
|
|
2008
|
+
if (this.options) this.init(this.options);
|
|
2009
|
+
}
|
|
2010
|
+
}, {
|
|
2011
|
+
key: "resetRegExp",
|
|
2012
|
+
value: function resetRegExp() {
|
|
2013
|
+
var regexpStr = "".concat(this.prefix, "(.+?)").concat(this.suffix);
|
|
2014
|
+
this.regexp = new RegExp(regexpStr, 'g');
|
|
2015
|
+
var regexpUnescapeStr = "".concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
|
|
2016
|
+
this.regexpUnescape = new RegExp(regexpUnescapeStr, 'g');
|
|
2017
|
+
var nestingRegexpStr = "".concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
|
|
2018
|
+
this.nestingRegexp = new RegExp(nestingRegexpStr, 'g');
|
|
2019
|
+
}
|
|
2020
|
+
}, {
|
|
2021
|
+
key: "interpolate",
|
|
2022
|
+
value: function interpolate(str, data, lng, options) {
|
|
2023
|
+
var _this = this;
|
|
2024
|
+
|
|
2025
|
+
var match;
|
|
2026
|
+
var value;
|
|
2027
|
+
var replaces;
|
|
2028
|
+
var defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
|
|
2029
|
+
|
|
2030
|
+
function regexSafe(val) {
|
|
2031
|
+
return val.replace(/\$/g, '$$$$');
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
var handleFormat = function handleFormat(key) {
|
|
2035
|
+
if (key.indexOf(_this.formatSeparator) < 0) {
|
|
2036
|
+
var path = getPathWithDefaults(data, defaultData, key);
|
|
2037
|
+
return _this.alwaysFormat ? _this.format(path, undefined, lng, _objectSpread({}, options, data, {
|
|
2038
|
+
interpolationkey: key
|
|
2039
|
+
})) : path;
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
var p = key.split(_this.formatSeparator);
|
|
2043
|
+
var k = p.shift().trim();
|
|
2044
|
+
var f = p.join(_this.formatSeparator).trim();
|
|
2045
|
+
return _this.format(getPathWithDefaults(data, defaultData, k), f, lng, _objectSpread({}, options, data, {
|
|
2046
|
+
interpolationkey: k
|
|
2047
|
+
}));
|
|
2048
|
+
};
|
|
2049
|
+
|
|
2050
|
+
this.resetRegExp();
|
|
2051
|
+
var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
2052
|
+
var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables || this.options.interpolation.skipOnVariables;
|
|
2053
|
+
var todos = [{
|
|
2054
|
+
regex: this.regexpUnescape,
|
|
2055
|
+
safeValue: function safeValue(val) {
|
|
2056
|
+
return regexSafe(val);
|
|
2057
|
+
}
|
|
2058
|
+
}, {
|
|
2059
|
+
regex: this.regexp,
|
|
2060
|
+
safeValue: function safeValue(val) {
|
|
2061
|
+
return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val);
|
|
2062
|
+
}
|
|
2063
|
+
}];
|
|
2064
|
+
todos.forEach(function (todo) {
|
|
2065
|
+
replaces = 0;
|
|
2066
|
+
|
|
2067
|
+
while (match = todo.regex.exec(str)) {
|
|
2068
|
+
value = handleFormat(match[1].trim());
|
|
2069
|
+
|
|
2070
|
+
if (value === undefined) {
|
|
2071
|
+
if (typeof missingInterpolationHandler === 'function') {
|
|
2072
|
+
var temp = missingInterpolationHandler(str, match, options);
|
|
2073
|
+
value = typeof temp === 'string' ? temp : '';
|
|
2074
|
+
} else if (skipOnVariables) {
|
|
2075
|
+
value = match[0];
|
|
2076
|
+
continue;
|
|
2077
|
+
} else {
|
|
2078
|
+
_this.logger.warn("missed to pass in variable ".concat(match[1], " for interpolating ").concat(str));
|
|
2079
|
+
|
|
2080
|
+
value = '';
|
|
2081
|
+
}
|
|
2082
|
+
} else if (typeof value !== 'string' && !_this.useRawValueToEscape) {
|
|
2083
|
+
value = makeString(value);
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
var safeValue = todo.safeValue(value);
|
|
2087
|
+
str = str.replace(match[0], safeValue);
|
|
2088
|
+
|
|
2089
|
+
if (skipOnVariables) {
|
|
2090
|
+
todo.regex.lastIndex += safeValue.length;
|
|
2091
|
+
todo.regex.lastIndex -= match[0].length;
|
|
2092
|
+
} else {
|
|
2093
|
+
todo.regex.lastIndex = 0;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
replaces++;
|
|
2097
|
+
|
|
2098
|
+
if (replaces >= _this.maxReplaces) {
|
|
2099
|
+
break;
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
});
|
|
2103
|
+
return str;
|
|
2104
|
+
}
|
|
2105
|
+
}, {
|
|
2106
|
+
key: "nest",
|
|
2107
|
+
value: function nest(str, fc) {
|
|
2108
|
+
var _this2 = this;
|
|
2109
|
+
|
|
2110
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
2111
|
+
var match;
|
|
2112
|
+
var value;
|
|
2113
|
+
|
|
2114
|
+
var clonedOptions = _objectSpread({}, options);
|
|
2115
|
+
|
|
2116
|
+
clonedOptions.applyPostProcessor = false;
|
|
2117
|
+
delete clonedOptions.defaultValue;
|
|
2118
|
+
|
|
2119
|
+
function handleHasOptions(key, inheritedOptions) {
|
|
2120
|
+
var sep = this.nestingOptionsSeparator;
|
|
2121
|
+
if (key.indexOf(sep) < 0) return key;
|
|
2122
|
+
var c = key.split(new RegExp("".concat(sep, "[ ]*{")));
|
|
2123
|
+
var optionsString = "{".concat(c[1]);
|
|
2124
|
+
key = c[0];
|
|
2125
|
+
optionsString = this.interpolate(optionsString, clonedOptions);
|
|
2126
|
+
optionsString = optionsString.replace(/'/g, '"');
|
|
2127
|
+
|
|
2128
|
+
try {
|
|
2129
|
+
clonedOptions = JSON.parse(optionsString);
|
|
2130
|
+
if (inheritedOptions) clonedOptions = _objectSpread({}, inheritedOptions, clonedOptions);
|
|
2131
|
+
} catch (e) {
|
|
2132
|
+
this.logger.warn("failed parsing options string in nesting for key ".concat(key), e);
|
|
2133
|
+
return "".concat(key).concat(sep).concat(optionsString);
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
delete clonedOptions.defaultValue;
|
|
2137
|
+
return key;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
while (match = this.nestingRegexp.exec(str)) {
|
|
2141
|
+
var formatters = [];
|
|
2142
|
+
var doReduce = false;
|
|
2143
|
+
|
|
2144
|
+
if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) {
|
|
2145
|
+
var r = match[1].split(this.formatSeparator).map(function (elem) {
|
|
2146
|
+
return elem.trim();
|
|
2147
|
+
});
|
|
2148
|
+
match[1] = r.shift();
|
|
2149
|
+
formatters = r;
|
|
2150
|
+
doReduce = true;
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
|
|
2154
|
+
if (value && match[0] === str && typeof value !== 'string') return value;
|
|
2155
|
+
if (typeof value !== 'string') value = makeString(value);
|
|
2156
|
+
|
|
2157
|
+
if (!value) {
|
|
2158
|
+
this.logger.warn("missed to resolve ".concat(match[1], " for nesting ").concat(str));
|
|
2159
|
+
value = '';
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
if (doReduce) {
|
|
2163
|
+
value = formatters.reduce(function (v, f) {
|
|
2164
|
+
return _this2.format(v, f, options.lng, _objectSpread({}, options, {
|
|
2165
|
+
interpolationkey: match[1].trim()
|
|
2166
|
+
}));
|
|
2167
|
+
}, value.trim());
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
str = str.replace(match[0], value);
|
|
2171
|
+
this.regexp.lastIndex = 0;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
return str;
|
|
2175
|
+
}
|
|
2176
|
+
}]);
|
|
2177
|
+
|
|
2178
|
+
return Interpolator;
|
|
2179
|
+
}();
|
|
2180
|
+
|
|
2181
|
+
function remove(arr, what) {
|
|
2182
|
+
var found = arr.indexOf(what);
|
|
2183
|
+
|
|
2184
|
+
while (found !== -1) {
|
|
2185
|
+
arr.splice(found, 1);
|
|
2186
|
+
found = arr.indexOf(what);
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
var Connector = function (_EventEmitter) {
|
|
2191
|
+
_inherits(Connector, _EventEmitter);
|
|
2192
|
+
|
|
2193
|
+
function Connector(backend, store, services) {
|
|
2194
|
+
var _this;
|
|
2195
|
+
|
|
2196
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
2197
|
+
|
|
2198
|
+
_classCallCheck(this, Connector);
|
|
2199
|
+
|
|
2200
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(Connector).call(this));
|
|
2201
|
+
|
|
2202
|
+
if (isIE10) {
|
|
2203
|
+
EventEmitter.call(_assertThisInitialized(_this));
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
_this.backend = backend;
|
|
2207
|
+
_this.store = store;
|
|
2208
|
+
_this.services = services;
|
|
2209
|
+
_this.languageUtils = services.languageUtils;
|
|
2210
|
+
_this.options = options;
|
|
2211
|
+
_this.logger = baseLogger.create('backendConnector');
|
|
2212
|
+
_this.state = {};
|
|
2213
|
+
_this.queue = [];
|
|
2214
|
+
|
|
2215
|
+
if (_this.backend && _this.backend.init) {
|
|
2216
|
+
_this.backend.init(services, options.backend, options);
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
return _this;
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
_createClass(Connector, [{
|
|
2223
|
+
key: "queueLoad",
|
|
2224
|
+
value: function queueLoad(languages, namespaces, options, callback) {
|
|
2225
|
+
var _this2 = this;
|
|
2226
|
+
|
|
2227
|
+
var toLoad = [];
|
|
2228
|
+
var pending = [];
|
|
2229
|
+
var toLoadLanguages = [];
|
|
2230
|
+
var toLoadNamespaces = [];
|
|
2231
|
+
languages.forEach(function (lng) {
|
|
2232
|
+
var hasAllNamespaces = true;
|
|
2233
|
+
namespaces.forEach(function (ns) {
|
|
2234
|
+
var name = "".concat(lng, "|").concat(ns);
|
|
2235
|
+
|
|
2236
|
+
if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
|
|
2237
|
+
_this2.state[name] = 2;
|
|
2238
|
+
} else if (_this2.state[name] < 0) ; else if (_this2.state[name] === 1) {
|
|
2239
|
+
if (pending.indexOf(name) < 0) pending.push(name);
|
|
2240
|
+
} else {
|
|
2241
|
+
_this2.state[name] = 1;
|
|
2242
|
+
hasAllNamespaces = false;
|
|
2243
|
+
if (pending.indexOf(name) < 0) pending.push(name);
|
|
2244
|
+
if (toLoad.indexOf(name) < 0) toLoad.push(name);
|
|
2245
|
+
if (toLoadNamespaces.indexOf(ns) < 0) toLoadNamespaces.push(ns);
|
|
2246
|
+
}
|
|
2247
|
+
});
|
|
2248
|
+
if (!hasAllNamespaces) toLoadLanguages.push(lng);
|
|
2249
|
+
});
|
|
2250
|
+
|
|
2251
|
+
if (toLoad.length || pending.length) {
|
|
2252
|
+
this.queue.push({
|
|
2253
|
+
pending: pending,
|
|
2254
|
+
loaded: {},
|
|
2255
|
+
errors: [],
|
|
2256
|
+
callback: callback
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
return {
|
|
2261
|
+
toLoad: toLoad,
|
|
2262
|
+
pending: pending,
|
|
2263
|
+
toLoadLanguages: toLoadLanguages,
|
|
2264
|
+
toLoadNamespaces: toLoadNamespaces
|
|
2265
|
+
};
|
|
2266
|
+
}
|
|
2267
|
+
}, {
|
|
2268
|
+
key: "loaded",
|
|
2269
|
+
value: function loaded(name, err, data) {
|
|
2270
|
+
var s = name.split('|');
|
|
2271
|
+
var lng = s[0];
|
|
2272
|
+
var ns = s[1];
|
|
2273
|
+
if (err) this.emit('failedLoading', lng, ns, err);
|
|
2274
|
+
|
|
2275
|
+
if (data) {
|
|
2276
|
+
this.store.addResourceBundle(lng, ns, data);
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
this.state[name] = err ? -1 : 2;
|
|
2280
|
+
var loaded = {};
|
|
2281
|
+
this.queue.forEach(function (q) {
|
|
2282
|
+
pushPath(q.loaded, [lng], ns);
|
|
2283
|
+
remove(q.pending, name);
|
|
2284
|
+
if (err) q.errors.push(err);
|
|
2285
|
+
|
|
2286
|
+
if (q.pending.length === 0 && !q.done) {
|
|
2287
|
+
Object.keys(q.loaded).forEach(function (l) {
|
|
2288
|
+
if (!loaded[l]) loaded[l] = [];
|
|
2289
|
+
|
|
2290
|
+
if (q.loaded[l].length) {
|
|
2291
|
+
q.loaded[l].forEach(function (ns) {
|
|
2292
|
+
if (loaded[l].indexOf(ns) < 0) loaded[l].push(ns);
|
|
2293
|
+
});
|
|
2294
|
+
}
|
|
2295
|
+
});
|
|
2296
|
+
q.done = true;
|
|
2297
|
+
|
|
2298
|
+
if (q.errors.length) {
|
|
2299
|
+
q.callback(q.errors);
|
|
2300
|
+
} else {
|
|
2301
|
+
q.callback();
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
});
|
|
2305
|
+
this.emit('loaded', loaded);
|
|
2306
|
+
this.queue = this.queue.filter(function (q) {
|
|
2307
|
+
return !q.done;
|
|
2308
|
+
});
|
|
2309
|
+
}
|
|
2310
|
+
}, {
|
|
2311
|
+
key: "read",
|
|
2312
|
+
value: function read(lng, ns, fcName) {
|
|
2313
|
+
var _this3 = this;
|
|
2314
|
+
|
|
2315
|
+
var tried = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
2316
|
+
var wait = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 350;
|
|
2317
|
+
var callback = arguments.length > 5 ? arguments[5] : undefined;
|
|
2318
|
+
if (!lng.length) return callback(null, {});
|
|
2319
|
+
return this.backend[fcName](lng, ns, function (err, data) {
|
|
2320
|
+
if (err && data && tried < 5) {
|
|
2321
|
+
setTimeout(function () {
|
|
2322
|
+
_this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback);
|
|
2323
|
+
}, wait);
|
|
2324
|
+
return;
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
callback(err, data);
|
|
2328
|
+
});
|
|
2329
|
+
}
|
|
2330
|
+
}, {
|
|
2331
|
+
key: "prepareLoading",
|
|
2332
|
+
value: function prepareLoading(languages, namespaces) {
|
|
2333
|
+
var _this4 = this;
|
|
2334
|
+
|
|
2335
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
2336
|
+
var callback = arguments.length > 3 ? arguments[3] : undefined;
|
|
2337
|
+
|
|
2338
|
+
if (!this.backend) {
|
|
2339
|
+
this.logger.warn('No backend was added via i18next.use. Will not load resources.');
|
|
2340
|
+
return callback && callback();
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
if (typeof languages === 'string') languages = this.languageUtils.toResolveHierarchy(languages);
|
|
2344
|
+
if (typeof namespaces === 'string') namespaces = [namespaces];
|
|
2345
|
+
var toLoad = this.queueLoad(languages, namespaces, options, callback);
|
|
2346
|
+
|
|
2347
|
+
if (!toLoad.toLoad.length) {
|
|
2348
|
+
if (!toLoad.pending.length) callback();
|
|
2349
|
+
return null;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
toLoad.toLoad.forEach(function (name) {
|
|
2353
|
+
_this4.loadOne(name);
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2356
|
+
}, {
|
|
2357
|
+
key: "load",
|
|
2358
|
+
value: function load(languages, namespaces, callback) {
|
|
2359
|
+
this.prepareLoading(languages, namespaces, {}, callback);
|
|
2360
|
+
}
|
|
2361
|
+
}, {
|
|
2362
|
+
key: "reload",
|
|
2363
|
+
value: function reload(languages, namespaces, callback) {
|
|
2364
|
+
this.prepareLoading(languages, namespaces, {
|
|
2365
|
+
reload: true
|
|
2366
|
+
}, callback);
|
|
2367
|
+
}
|
|
2368
|
+
}, {
|
|
2369
|
+
key: "loadOne",
|
|
2370
|
+
value: function loadOne(name) {
|
|
2371
|
+
var _this5 = this;
|
|
2372
|
+
|
|
2373
|
+
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
2374
|
+
var s = name.split('|');
|
|
2375
|
+
var lng = s[0];
|
|
2376
|
+
var ns = s[1];
|
|
2377
|
+
this.read(lng, ns, 'read', undefined, undefined, function (err, data) {
|
|
2378
|
+
if (err) _this5.logger.warn("".concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
|
|
2379
|
+
if (!err && data) _this5.logger.log("".concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
|
|
2380
|
+
|
|
2381
|
+
_this5.loaded(name, err, data);
|
|
2382
|
+
});
|
|
2383
|
+
}
|
|
2384
|
+
}, {
|
|
2385
|
+
key: "saveMissing",
|
|
2386
|
+
value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
|
|
2387
|
+
var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
|
|
2388
|
+
|
|
2389
|
+
if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
|
|
2390
|
+
this.logger.warn("did not save key \"".concat(key, "\" as the namespace \"").concat(namespace, "\" was not yet loaded"), 'This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!');
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
if (key === undefined || key === null || key === '') return;
|
|
2395
|
+
|
|
2396
|
+
if (this.backend && this.backend.create) {
|
|
2397
|
+
this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread({}, options, {
|
|
2398
|
+
isUpdate: isUpdate
|
|
2399
|
+
}));
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
if (!languages || !languages[0]) return;
|
|
2403
|
+
this.store.addResource(languages[0], namespace, key, fallbackValue);
|
|
2404
|
+
}
|
|
2405
|
+
}]);
|
|
2406
|
+
|
|
2407
|
+
return Connector;
|
|
2408
|
+
}(EventEmitter);
|
|
2409
|
+
|
|
2410
|
+
function get() {
|
|
2411
|
+
return {
|
|
2412
|
+
debug: false,
|
|
2413
|
+
initImmediate: true,
|
|
2414
|
+
ns: ['translation'],
|
|
2415
|
+
defaultNS: ['translation'],
|
|
2416
|
+
fallbackLng: ['dev'],
|
|
2417
|
+
fallbackNS: false,
|
|
2418
|
+
whitelist: false,
|
|
2419
|
+
nonExplicitWhitelist: false,
|
|
2420
|
+
supportedLngs: false,
|
|
2421
|
+
nonExplicitSupportedLngs: false,
|
|
2422
|
+
load: 'all',
|
|
2423
|
+
preload: false,
|
|
2424
|
+
simplifyPluralSuffix: true,
|
|
2425
|
+
keySeparator: '.',
|
|
2426
|
+
nsSeparator: ':',
|
|
2427
|
+
pluralSeparator: '_',
|
|
2428
|
+
contextSeparator: '_',
|
|
2429
|
+
partialBundledLanguages: false,
|
|
2430
|
+
saveMissing: false,
|
|
2431
|
+
updateMissing: false,
|
|
2432
|
+
saveMissingTo: 'fallback',
|
|
2433
|
+
saveMissingPlurals: true,
|
|
2434
|
+
missingKeyHandler: false,
|
|
2435
|
+
missingInterpolationHandler: false,
|
|
2436
|
+
postProcess: false,
|
|
2437
|
+
postProcessPassResolved: false,
|
|
2438
|
+
returnNull: true,
|
|
2439
|
+
returnEmptyString: true,
|
|
2440
|
+
returnObjects: false,
|
|
2441
|
+
joinArrays: false,
|
|
2442
|
+
returnedObjectHandler: false,
|
|
2443
|
+
parseMissingKeyHandler: false,
|
|
2444
|
+
appendNamespaceToMissingKey: false,
|
|
2445
|
+
appendNamespaceToCIMode: false,
|
|
2446
|
+
overloadTranslationOptionHandler: function handle(args) {
|
|
2447
|
+
var ret = {};
|
|
2448
|
+
if (_typeof(args[1]) === 'object') ret = args[1];
|
|
2449
|
+
if (typeof args[1] === 'string') ret.defaultValue = args[1];
|
|
2450
|
+
if (typeof args[2] === 'string') ret.tDescription = args[2];
|
|
2451
|
+
|
|
2452
|
+
if (_typeof(args[2]) === 'object' || _typeof(args[3]) === 'object') {
|
|
2453
|
+
var options = args[3] || args[2];
|
|
2454
|
+
Object.keys(options).forEach(function (key) {
|
|
2455
|
+
ret[key] = options[key];
|
|
2456
|
+
});
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
return ret;
|
|
2460
|
+
},
|
|
2461
|
+
interpolation: {
|
|
2462
|
+
escapeValue: true,
|
|
2463
|
+
format: function format(value, _format, lng, options) {
|
|
2464
|
+
return value;
|
|
2465
|
+
},
|
|
2466
|
+
prefix: '{{',
|
|
2467
|
+
suffix: '}}',
|
|
2468
|
+
formatSeparator: ',',
|
|
2469
|
+
unescapePrefix: '-',
|
|
2470
|
+
nestingPrefix: '$t(',
|
|
2471
|
+
nestingSuffix: ')',
|
|
2472
|
+
nestingOptionsSeparator: ',',
|
|
2473
|
+
maxReplaces: 1000,
|
|
2474
|
+
skipOnVariables: false
|
|
2475
|
+
}
|
|
2476
|
+
};
|
|
2477
|
+
}
|
|
2478
|
+
function transformOptions(options) {
|
|
2479
|
+
if (typeof options.ns === 'string') options.ns = [options.ns];
|
|
2480
|
+
if (typeof options.fallbackLng === 'string') options.fallbackLng = [options.fallbackLng];
|
|
2481
|
+
if (typeof options.fallbackNS === 'string') options.fallbackNS = [options.fallbackNS];
|
|
2482
|
+
|
|
2483
|
+
if (options.whitelist) {
|
|
2484
|
+
if (options.whitelist && options.whitelist.indexOf('cimode') < 0) {
|
|
2485
|
+
options.whitelist = options.whitelist.concat(['cimode']);
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
options.supportedLngs = options.whitelist;
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
if (options.nonExplicitWhitelist) {
|
|
2492
|
+
options.nonExplicitSupportedLngs = options.nonExplicitWhitelist;
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
if (options.supportedLngs && options.supportedLngs.indexOf('cimode') < 0) {
|
|
2496
|
+
options.supportedLngs = options.supportedLngs.concat(['cimode']);
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
return options;
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
function noop() {}
|
|
2503
|
+
|
|
2504
|
+
var I18n = function (_EventEmitter) {
|
|
2505
|
+
_inherits(I18n, _EventEmitter);
|
|
2506
|
+
|
|
2507
|
+
function I18n() {
|
|
2508
|
+
var _this;
|
|
2509
|
+
|
|
2510
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2511
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
2512
|
+
|
|
2513
|
+
_classCallCheck(this, I18n);
|
|
2514
|
+
|
|
2515
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(I18n).call(this));
|
|
2516
|
+
|
|
2517
|
+
if (isIE10) {
|
|
2518
|
+
EventEmitter.call(_assertThisInitialized(_this));
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
_this.options = transformOptions(options);
|
|
2522
|
+
_this.services = {};
|
|
2523
|
+
_this.logger = baseLogger;
|
|
2524
|
+
_this.modules = {
|
|
2525
|
+
external: []
|
|
2526
|
+
};
|
|
2527
|
+
|
|
2528
|
+
if (callback && !_this.isInitialized && !options.isClone) {
|
|
2529
|
+
if (!_this.options.initImmediate) {
|
|
2530
|
+
_this.init(options, callback);
|
|
2531
|
+
|
|
2532
|
+
return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
setTimeout(function () {
|
|
2536
|
+
_this.init(options, callback);
|
|
2537
|
+
}, 0);
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
return _this;
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
_createClass(I18n, [{
|
|
2544
|
+
key: "init",
|
|
2545
|
+
value: function init() {
|
|
2546
|
+
var _this2 = this;
|
|
2547
|
+
|
|
2548
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2549
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
2550
|
+
|
|
2551
|
+
if (typeof options === 'function') {
|
|
2552
|
+
callback = options;
|
|
2553
|
+
options = {};
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
if (options.whitelist && !options.supportedLngs) {
|
|
2557
|
+
this.logger.deprecate('whitelist', 'option "whitelist" will be renamed to "supportedLngs" in the next major - please make sure to rename this option asap.');
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
if (options.nonExplicitWhitelist && !options.nonExplicitSupportedLngs) {
|
|
2561
|
+
this.logger.deprecate('whitelist', 'options "nonExplicitWhitelist" will be renamed to "nonExplicitSupportedLngs" in the next major - please make sure to rename this option asap.');
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
this.options = _objectSpread({}, get(), this.options, transformOptions(options));
|
|
2565
|
+
this.format = this.options.interpolation.format;
|
|
2566
|
+
if (!callback) callback = noop;
|
|
2567
|
+
|
|
2568
|
+
function createClassOnDemand(ClassOrObject) {
|
|
2569
|
+
if (!ClassOrObject) return null;
|
|
2570
|
+
if (typeof ClassOrObject === 'function') return new ClassOrObject();
|
|
2571
|
+
return ClassOrObject;
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
if (!this.options.isClone) {
|
|
2575
|
+
if (this.modules.logger) {
|
|
2576
|
+
baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
|
|
2577
|
+
} else {
|
|
2578
|
+
baseLogger.init(null, this.options);
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
var lu = new LanguageUtil(this.options);
|
|
2582
|
+
this.store = new ResourceStore(this.options.resources, this.options);
|
|
2583
|
+
var s = this.services;
|
|
2584
|
+
s.logger = baseLogger;
|
|
2585
|
+
s.resourceStore = this.store;
|
|
2586
|
+
s.languageUtils = lu;
|
|
2587
|
+
s.pluralResolver = new PluralResolver(lu, {
|
|
2588
|
+
prepend: this.options.pluralSeparator,
|
|
2589
|
+
compatibilityJSON: this.options.compatibilityJSON,
|
|
2590
|
+
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
2591
|
+
});
|
|
2592
|
+
s.interpolator = new Interpolator(this.options);
|
|
2593
|
+
s.utils = {
|
|
2594
|
+
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
2595
|
+
};
|
|
2596
|
+
s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
|
|
2597
|
+
s.backendConnector.on('*', function (event) {
|
|
2598
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
2599
|
+
args[_key - 1] = arguments[_key];
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
_this2.emit.apply(_this2, [event].concat(args));
|
|
2603
|
+
});
|
|
2604
|
+
|
|
2605
|
+
if (this.modules.languageDetector) {
|
|
2606
|
+
s.languageDetector = createClassOnDemand(this.modules.languageDetector);
|
|
2607
|
+
s.languageDetector.init(s, this.options.detection, this.options);
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
if (this.modules.i18nFormat) {
|
|
2611
|
+
s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
|
|
2612
|
+
if (s.i18nFormat.init) s.i18nFormat.init(this);
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
this.translator = new Translator(this.services, this.options);
|
|
2616
|
+
this.translator.on('*', function (event) {
|
|
2617
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
2618
|
+
args[_key2 - 1] = arguments[_key2];
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
_this2.emit.apply(_this2, [event].concat(args));
|
|
2622
|
+
});
|
|
2623
|
+
this.modules.external.forEach(function (m) {
|
|
2624
|
+
if (m.init) m.init(_this2);
|
|
2625
|
+
});
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
2629
|
+
var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
2630
|
+
if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0];
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
if (!this.services.languageDetector && !this.options.lng) {
|
|
2634
|
+
this.logger.warn('init: no languageDetector is used and no lng is defined');
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
var storeApi = ['getResource', 'hasResourceBundle', 'getResourceBundle', 'getDataByLanguage'];
|
|
2638
|
+
storeApi.forEach(function (fcName) {
|
|
2639
|
+
_this2[fcName] = function () {
|
|
2640
|
+
var _this2$store;
|
|
2641
|
+
|
|
2642
|
+
return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
|
|
2643
|
+
};
|
|
2644
|
+
});
|
|
2645
|
+
var storeApiChained = ['addResource', 'addResources', 'addResourceBundle', 'removeResourceBundle'];
|
|
2646
|
+
storeApiChained.forEach(function (fcName) {
|
|
2647
|
+
_this2[fcName] = function () {
|
|
2648
|
+
var _this2$store2;
|
|
2649
|
+
|
|
2650
|
+
(_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
|
|
2651
|
+
|
|
2652
|
+
return _this2;
|
|
2653
|
+
};
|
|
2654
|
+
});
|
|
2655
|
+
var deferred = defer();
|
|
2656
|
+
|
|
2657
|
+
var load = function load() {
|
|
2658
|
+
var finish = function finish(err, t) {
|
|
2659
|
+
if (_this2.isInitialized && !_this2.initializedStoreOnce) _this2.logger.warn('init: i18next is already initialized. You should call init just once!');
|
|
2660
|
+
_this2.isInitialized = true;
|
|
2661
|
+
if (!_this2.options.isClone) _this2.logger.log('initialized', _this2.options);
|
|
2662
|
+
|
|
2663
|
+
_this2.emit('initialized', _this2.options);
|
|
2664
|
+
|
|
2665
|
+
deferred.resolve(t);
|
|
2666
|
+
callback(err, t);
|
|
2667
|
+
};
|
|
2668
|
+
|
|
2669
|
+
if (_this2.languages && _this2.options.compatibilityAPI !== 'v1' && !_this2.isInitialized) return finish(null, _this2.t.bind(_this2));
|
|
2670
|
+
|
|
2671
|
+
_this2.changeLanguage(_this2.options.lng, finish);
|
|
2672
|
+
};
|
|
2673
|
+
|
|
2674
|
+
if (this.options.resources || !this.options.initImmediate) {
|
|
2675
|
+
load();
|
|
2676
|
+
} else {
|
|
2677
|
+
setTimeout(load, 0);
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
return deferred;
|
|
2681
|
+
}
|
|
2682
|
+
}, {
|
|
2683
|
+
key: "loadResources",
|
|
2684
|
+
value: function loadResources(language) {
|
|
2685
|
+
var _this3 = this;
|
|
2686
|
+
|
|
2687
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
2688
|
+
var usedCallback = callback;
|
|
2689
|
+
var usedLng = typeof language === 'string' ? language : this.language;
|
|
2690
|
+
if (typeof language === 'function') usedCallback = language;
|
|
2691
|
+
|
|
2692
|
+
if (!this.options.resources || this.options.partialBundledLanguages) {
|
|
2693
|
+
if (usedLng && usedLng.toLowerCase() === 'cimode') return usedCallback();
|
|
2694
|
+
var toLoad = [];
|
|
2695
|
+
|
|
2696
|
+
var append = function append(lng) {
|
|
2697
|
+
if (!lng) return;
|
|
2698
|
+
|
|
2699
|
+
var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
|
|
2700
|
+
|
|
2701
|
+
lngs.forEach(function (l) {
|
|
2702
|
+
if (toLoad.indexOf(l) < 0) toLoad.push(l);
|
|
2703
|
+
});
|
|
2704
|
+
};
|
|
2705
|
+
|
|
2706
|
+
if (!usedLng) {
|
|
2707
|
+
var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
2708
|
+
fallbacks.forEach(function (l) {
|
|
2709
|
+
return append(l);
|
|
2710
|
+
});
|
|
2711
|
+
} else {
|
|
2712
|
+
append(usedLng);
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
if (this.options.preload) {
|
|
2716
|
+
this.options.preload.forEach(function (l) {
|
|
2717
|
+
return append(l);
|
|
2718
|
+
});
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
this.services.backendConnector.load(toLoad, this.options.ns, usedCallback);
|
|
2722
|
+
} else {
|
|
2723
|
+
usedCallback(null);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
}, {
|
|
2727
|
+
key: "reloadResources",
|
|
2728
|
+
value: function reloadResources(lngs, ns, callback) {
|
|
2729
|
+
var deferred = defer();
|
|
2730
|
+
if (!lngs) lngs = this.languages;
|
|
2731
|
+
if (!ns) ns = this.options.ns;
|
|
2732
|
+
if (!callback) callback = noop;
|
|
2733
|
+
this.services.backendConnector.reload(lngs, ns, function (err) {
|
|
2734
|
+
deferred.resolve();
|
|
2735
|
+
callback(err);
|
|
2736
|
+
});
|
|
2737
|
+
return deferred;
|
|
2738
|
+
}
|
|
2739
|
+
}, {
|
|
2740
|
+
key: "use",
|
|
2741
|
+
value: function use(module) {
|
|
2742
|
+
if (!module) throw new Error('You are passing an undefined module! Please check the object you are passing to i18next.use()');
|
|
2743
|
+
if (!module.type) throw new Error('You are passing a wrong module! Please check the object you are passing to i18next.use()');
|
|
2744
|
+
|
|
2745
|
+
if (module.type === 'backend') {
|
|
2746
|
+
this.modules.backend = module;
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2749
|
+
if (module.type === 'logger' || module.log && module.warn && module.error) {
|
|
2750
|
+
this.modules.logger = module;
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
if (module.type === 'languageDetector') {
|
|
2754
|
+
this.modules.languageDetector = module;
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
if (module.type === 'i18nFormat') {
|
|
2758
|
+
this.modules.i18nFormat = module;
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
if (module.type === 'postProcessor') {
|
|
2762
|
+
postProcessor.addPostProcessor(module);
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
if (module.type === '3rdParty') {
|
|
2766
|
+
this.modules.external.push(module);
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2769
|
+
return this;
|
|
2770
|
+
}
|
|
2771
|
+
}, {
|
|
2772
|
+
key: "changeLanguage",
|
|
2773
|
+
value: function changeLanguage(lng, callback) {
|
|
2774
|
+
var _this4 = this;
|
|
2775
|
+
|
|
2776
|
+
this.isLanguageChangingTo = lng;
|
|
2777
|
+
var deferred = defer();
|
|
2778
|
+
this.emit('languageChanging', lng);
|
|
2779
|
+
|
|
2780
|
+
var done = function done(err, l) {
|
|
2781
|
+
if (l) {
|
|
2782
|
+
_this4.language = l;
|
|
2783
|
+
_this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
|
|
2784
|
+
|
|
2785
|
+
_this4.translator.changeLanguage(l);
|
|
2786
|
+
|
|
2787
|
+
_this4.isLanguageChangingTo = undefined;
|
|
2788
|
+
|
|
2789
|
+
_this4.emit('languageChanged', l);
|
|
2790
|
+
|
|
2791
|
+
_this4.logger.log('languageChanged', l);
|
|
2792
|
+
} else {
|
|
2793
|
+
_this4.isLanguageChangingTo = undefined;
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
deferred.resolve(function () {
|
|
2797
|
+
return _this4.t.apply(_this4, arguments);
|
|
2798
|
+
});
|
|
2799
|
+
if (callback) callback(err, function () {
|
|
2800
|
+
return _this4.t.apply(_this4, arguments);
|
|
2801
|
+
});
|
|
2802
|
+
};
|
|
2803
|
+
|
|
2804
|
+
var setLng = function setLng(lngs) {
|
|
2805
|
+
if (!lng && !lngs && _this4.services.languageDetector) lngs = [];
|
|
2806
|
+
var l = typeof lngs === 'string' ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
|
|
2807
|
+
|
|
2808
|
+
if (l) {
|
|
2809
|
+
if (!_this4.language) {
|
|
2810
|
+
_this4.language = l;
|
|
2811
|
+
_this4.languages = _this4.services.languageUtils.toResolveHierarchy(l);
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
if (!_this4.translator.language) _this4.translator.changeLanguage(l);
|
|
2815
|
+
if (_this4.services.languageDetector) _this4.services.languageDetector.cacheUserLanguage(l);
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
_this4.loadResources(l, function (err) {
|
|
2819
|
+
done(err, l);
|
|
2820
|
+
});
|
|
2821
|
+
};
|
|
2822
|
+
|
|
2823
|
+
if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
|
|
2824
|
+
setLng(this.services.languageDetector.detect());
|
|
2825
|
+
} else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
|
|
2826
|
+
this.services.languageDetector.detect(setLng);
|
|
2827
|
+
} else {
|
|
2828
|
+
setLng(lng);
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
return deferred;
|
|
2832
|
+
}
|
|
2833
|
+
}, {
|
|
2834
|
+
key: "getFixedT",
|
|
2835
|
+
value: function getFixedT(lng, ns, keyPrefix) {
|
|
2836
|
+
var _this5 = this;
|
|
2837
|
+
|
|
2838
|
+
var fixedT = function fixedT(key, opts) {
|
|
2839
|
+
var options;
|
|
2840
|
+
|
|
2841
|
+
if (_typeof(opts) !== 'object') {
|
|
2842
|
+
for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
|
2843
|
+
rest[_key3 - 2] = arguments[_key3];
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
|
|
2847
|
+
} else {
|
|
2848
|
+
options = _objectSpread({}, opts);
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
options.lng = options.lng || fixedT.lng;
|
|
2852
|
+
options.lngs = options.lngs || fixedT.lngs;
|
|
2853
|
+
options.ns = options.ns || fixedT.ns;
|
|
2854
|
+
var keySeparator = _this5.options.keySeparator || '.';
|
|
2855
|
+
var resultKey = keyPrefix ? "".concat(keyPrefix).concat(keySeparator).concat(key) : key;
|
|
2856
|
+
return _this5.t(resultKey, options);
|
|
2857
|
+
};
|
|
2858
|
+
|
|
2859
|
+
if (typeof lng === 'string') {
|
|
2860
|
+
fixedT.lng = lng;
|
|
2861
|
+
} else {
|
|
2862
|
+
fixedT.lngs = lng;
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2865
|
+
fixedT.ns = ns;
|
|
2866
|
+
fixedT.keyPrefix = keyPrefix;
|
|
2867
|
+
return fixedT;
|
|
2868
|
+
}
|
|
2869
|
+
}, {
|
|
2870
|
+
key: "t",
|
|
2871
|
+
value: function t() {
|
|
2872
|
+
var _this$translator;
|
|
2873
|
+
|
|
2874
|
+
return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
|
|
2875
|
+
}
|
|
2876
|
+
}, {
|
|
2877
|
+
key: "exists",
|
|
2878
|
+
value: function exists() {
|
|
2879
|
+
var _this$translator2;
|
|
2880
|
+
|
|
2881
|
+
return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
|
|
2882
|
+
}
|
|
2883
|
+
}, {
|
|
2884
|
+
key: "setDefaultNamespace",
|
|
2885
|
+
value: function setDefaultNamespace(ns) {
|
|
2886
|
+
this.options.defaultNS = ns;
|
|
2887
|
+
}
|
|
2888
|
+
}, {
|
|
2889
|
+
key: "hasLoadedNamespace",
|
|
2890
|
+
value: function hasLoadedNamespace(ns) {
|
|
2891
|
+
var _this6 = this;
|
|
2892
|
+
|
|
2893
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2894
|
+
|
|
2895
|
+
if (!this.isInitialized) {
|
|
2896
|
+
this.logger.warn('hasLoadedNamespace: i18next was not initialized', this.languages);
|
|
2897
|
+
return false;
|
|
2898
|
+
}
|
|
2899
|
+
|
|
2900
|
+
if (!this.languages || !this.languages.length) {
|
|
2901
|
+
this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
|
|
2902
|
+
return false;
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
var lng = this.languages[0];
|
|
2906
|
+
var fallbackLng = this.options ? this.options.fallbackLng : false;
|
|
2907
|
+
var lastLng = this.languages[this.languages.length - 1];
|
|
2908
|
+
if (lng.toLowerCase() === 'cimode') return true;
|
|
2909
|
+
|
|
2910
|
+
var loadNotPending = function loadNotPending(l, n) {
|
|
2911
|
+
var loadState = _this6.services.backendConnector.state["".concat(l, "|").concat(n)];
|
|
2912
|
+
|
|
2913
|
+
return loadState === -1 || loadState === 2;
|
|
2914
|
+
};
|
|
2915
|
+
|
|
2916
|
+
if (options.precheck) {
|
|
2917
|
+
var preResult = options.precheck(this, loadNotPending);
|
|
2918
|
+
if (preResult !== undefined) return preResult;
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
if (this.hasResourceBundle(lng, ns)) return true;
|
|
2922
|
+
if (!this.services.backendConnector.backend) return true;
|
|
2923
|
+
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
2924
|
+
return false;
|
|
2925
|
+
}
|
|
2926
|
+
}, {
|
|
2927
|
+
key: "loadNamespaces",
|
|
2928
|
+
value: function loadNamespaces(ns, callback) {
|
|
2929
|
+
var _this7 = this;
|
|
2930
|
+
|
|
2931
|
+
var deferred = defer();
|
|
2932
|
+
|
|
2933
|
+
if (!this.options.ns) {
|
|
2934
|
+
callback && callback();
|
|
2935
|
+
return Promise.resolve();
|
|
2936
|
+
}
|
|
2937
|
+
|
|
2938
|
+
if (typeof ns === 'string') ns = [ns];
|
|
2939
|
+
ns.forEach(function (n) {
|
|
2940
|
+
if (_this7.options.ns.indexOf(n) < 0) _this7.options.ns.push(n);
|
|
2941
|
+
});
|
|
2942
|
+
this.loadResources(function (err) {
|
|
2943
|
+
deferred.resolve();
|
|
2944
|
+
if (callback) callback(err);
|
|
2945
|
+
});
|
|
2946
|
+
return deferred;
|
|
2947
|
+
}
|
|
2948
|
+
}, {
|
|
2949
|
+
key: "loadLanguages",
|
|
2950
|
+
value: function loadLanguages(lngs, callback) {
|
|
2951
|
+
var deferred = defer();
|
|
2952
|
+
if (typeof lngs === 'string') lngs = [lngs];
|
|
2953
|
+
var preloaded = this.options.preload || [];
|
|
2954
|
+
var newLngs = lngs.filter(function (lng) {
|
|
2955
|
+
return preloaded.indexOf(lng) < 0;
|
|
2956
|
+
});
|
|
2957
|
+
|
|
2958
|
+
if (!newLngs.length) {
|
|
2959
|
+
if (callback) callback();
|
|
2960
|
+
return Promise.resolve();
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
this.options.preload = preloaded.concat(newLngs);
|
|
2964
|
+
this.loadResources(function (err) {
|
|
2965
|
+
deferred.resolve();
|
|
2966
|
+
if (callback) callback(err);
|
|
2967
|
+
});
|
|
2968
|
+
return deferred;
|
|
2969
|
+
}
|
|
2970
|
+
}, {
|
|
2971
|
+
key: "dir",
|
|
2972
|
+
value: function dir(lng) {
|
|
2973
|
+
if (!lng) lng = this.languages && this.languages.length > 0 ? this.languages[0] : this.language;
|
|
2974
|
+
if (!lng) return 'rtl';
|
|
2975
|
+
var rtlLngs = ['ar', 'shu', 'sqr', 'ssh', 'xaa', 'yhd', 'yud', 'aao', 'abh', 'abv', 'acm', 'acq', 'acw', 'acx', 'acy', 'adf', 'ads', 'aeb', 'aec', 'afb', 'ajp', 'apc', 'apd', 'arb', 'arq', 'ars', 'ary', 'arz', 'auz', 'avl', 'ayh', 'ayl', 'ayn', 'ayp', 'bbz', 'pga', 'he', 'iw', 'ps', 'pbt', 'pbu', 'pst', 'prp', 'prd', 'ug', 'ur', 'ydd', 'yds', 'yih', 'ji', 'yi', 'hbo', 'men', 'xmn', 'fa', 'jpr', 'peo', 'pes', 'prs', 'dv', 'sam'];
|
|
2976
|
+
return rtlLngs.indexOf(this.services.languageUtils.getLanguagePartFromCode(lng)) >= 0 ? 'rtl' : 'ltr';
|
|
2977
|
+
}
|
|
2978
|
+
}, {
|
|
2979
|
+
key: "createInstance",
|
|
2980
|
+
value: function createInstance() {
|
|
2981
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2982
|
+
var callback = arguments.length > 1 ? arguments[1] : undefined;
|
|
2983
|
+
return new I18n(options, callback);
|
|
2984
|
+
}
|
|
2985
|
+
}, {
|
|
2986
|
+
key: "cloneInstance",
|
|
2987
|
+
value: function cloneInstance() {
|
|
2988
|
+
var _this8 = this;
|
|
2989
|
+
|
|
2990
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2991
|
+
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
2992
|
+
|
|
2993
|
+
var mergedOptions = _objectSpread({}, this.options, options, {
|
|
2994
|
+
isClone: true
|
|
2995
|
+
});
|
|
2996
|
+
|
|
2997
|
+
var clone = new I18n(mergedOptions);
|
|
2998
|
+
var membersToCopy = ['store', 'services', 'language'];
|
|
2999
|
+
membersToCopy.forEach(function (m) {
|
|
3000
|
+
clone[m] = _this8[m];
|
|
3001
|
+
});
|
|
3002
|
+
clone.services = _objectSpread({}, this.services);
|
|
3003
|
+
clone.services.utils = {
|
|
3004
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
3005
|
+
};
|
|
3006
|
+
clone.translator = new Translator(clone.services, clone.options);
|
|
3007
|
+
clone.translator.on('*', function (event) {
|
|
3008
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
3009
|
+
args[_key4 - 1] = arguments[_key4];
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
clone.emit.apply(clone, [event].concat(args));
|
|
3013
|
+
});
|
|
3014
|
+
clone.init(mergedOptions, callback);
|
|
3015
|
+
clone.translator.options = clone.options;
|
|
3016
|
+
clone.translator.backendConnector.services.utils = {
|
|
3017
|
+
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
|
|
3018
|
+
};
|
|
3019
|
+
return clone;
|
|
3020
|
+
}
|
|
3021
|
+
}, {
|
|
3022
|
+
key: "toJSON",
|
|
3023
|
+
value: function toJSON() {
|
|
3024
|
+
return {
|
|
3025
|
+
options: this.options,
|
|
3026
|
+
store: this.store,
|
|
3027
|
+
language: this.language,
|
|
3028
|
+
languages: this.languages
|
|
3029
|
+
};
|
|
3030
|
+
}
|
|
3031
|
+
}]);
|
|
3032
|
+
|
|
3033
|
+
return I18n;
|
|
3034
|
+
}(EventEmitter);
|
|
3035
|
+
|
|
3036
|
+
var i18next = new I18n();
|
|
3037
|
+
|
|
3038
|
+
var arr = [];
|
|
3039
|
+
var each = arr.forEach;
|
|
3040
|
+
var slice = arr.slice;
|
|
3041
|
+
function defaults(obj) {
|
|
3042
|
+
each.call(slice.call(arguments, 1), function (source) {
|
|
3043
|
+
if (source) {
|
|
3044
|
+
for (var prop in source) {
|
|
3045
|
+
if (obj[prop] === undefined) obj[prop] = source[prop];
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
});
|
|
3049
|
+
return obj;
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
// eslint-disable-next-line no-control-regex
|
|
3053
|
+
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
3054
|
+
|
|
3055
|
+
var serializeCookie = function serializeCookie(name, val, options) {
|
|
3056
|
+
var opt = options || {};
|
|
3057
|
+
opt.path = opt.path || '/';
|
|
3058
|
+
var value = encodeURIComponent(val);
|
|
3059
|
+
var str = name + '=' + value;
|
|
3060
|
+
|
|
3061
|
+
if (opt.maxAge > 0) {
|
|
3062
|
+
var maxAge = opt.maxAge - 0;
|
|
3063
|
+
if (isNaN(maxAge)) throw new Error('maxAge should be a Number');
|
|
3064
|
+
str += '; Max-Age=' + Math.floor(maxAge);
|
|
3065
|
+
}
|
|
3066
|
+
|
|
3067
|
+
if (opt.domain) {
|
|
3068
|
+
if (!fieldContentRegExp.test(opt.domain)) {
|
|
3069
|
+
throw new TypeError('option domain is invalid');
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
str += '; Domain=' + opt.domain;
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3075
|
+
if (opt.path) {
|
|
3076
|
+
if (!fieldContentRegExp.test(opt.path)) {
|
|
3077
|
+
throw new TypeError('option path is invalid');
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
str += '; Path=' + opt.path;
|
|
3081
|
+
}
|
|
3082
|
+
|
|
3083
|
+
if (opt.expires) {
|
|
3084
|
+
if (typeof opt.expires.toUTCString !== 'function') {
|
|
3085
|
+
throw new TypeError('option expires is invalid');
|
|
3086
|
+
}
|
|
3087
|
+
|
|
3088
|
+
str += '; Expires=' + opt.expires.toUTCString();
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
if (opt.httpOnly) str += '; HttpOnly';
|
|
3092
|
+
if (opt.secure) str += '; Secure';
|
|
3093
|
+
|
|
3094
|
+
if (opt.sameSite) {
|
|
3095
|
+
var sameSite = typeof opt.sameSite === 'string' ? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
3096
|
+
|
|
3097
|
+
switch (sameSite) {
|
|
3098
|
+
case true:
|
|
3099
|
+
str += '; SameSite=Strict';
|
|
3100
|
+
break;
|
|
3101
|
+
|
|
3102
|
+
case 'lax':
|
|
3103
|
+
str += '; SameSite=Lax';
|
|
3104
|
+
break;
|
|
3105
|
+
|
|
3106
|
+
case 'strict':
|
|
3107
|
+
str += '; SameSite=Strict';
|
|
3108
|
+
break;
|
|
3109
|
+
|
|
3110
|
+
case 'none':
|
|
3111
|
+
str += '; SameSite=None';
|
|
3112
|
+
break;
|
|
3113
|
+
|
|
3114
|
+
default:
|
|
3115
|
+
throw new TypeError('option sameSite is invalid');
|
|
3116
|
+
}
|
|
3117
|
+
}
|
|
3118
|
+
|
|
3119
|
+
return str;
|
|
3120
|
+
};
|
|
3121
|
+
|
|
3122
|
+
var cookie = {
|
|
3123
|
+
create: function create(name, value, minutes, domain) {
|
|
3124
|
+
var cookieOptions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
3125
|
+
path: '/',
|
|
3126
|
+
sameSite: 'strict'
|
|
3127
|
+
};
|
|
3128
|
+
|
|
3129
|
+
if (minutes) {
|
|
3130
|
+
cookieOptions.expires = new Date();
|
|
3131
|
+
cookieOptions.expires.setTime(cookieOptions.expires.getTime() + minutes * 60 * 1000);
|
|
3132
|
+
}
|
|
3133
|
+
|
|
3134
|
+
if (domain) cookieOptions.domain = domain;
|
|
3135
|
+
document.cookie = serializeCookie(name, encodeURIComponent(value), cookieOptions);
|
|
3136
|
+
},
|
|
3137
|
+
read: function read(name) {
|
|
3138
|
+
var nameEQ = name + '=';
|
|
3139
|
+
var ca = document.cookie.split(';');
|
|
3140
|
+
|
|
3141
|
+
for (var i = 0; i < ca.length; i++) {
|
|
3142
|
+
var c = ca[i];
|
|
3143
|
+
|
|
3144
|
+
while (c.charAt(0) === ' ') {
|
|
3145
|
+
c = c.substring(1, c.length);
|
|
3146
|
+
}
|
|
3147
|
+
|
|
3148
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
return null;
|
|
3152
|
+
},
|
|
3153
|
+
remove: function remove(name) {
|
|
3154
|
+
this.create(name, '', -1);
|
|
3155
|
+
}
|
|
3156
|
+
};
|
|
3157
|
+
var cookie$1 = {
|
|
3158
|
+
name: 'cookie',
|
|
3159
|
+
lookup: function lookup(options) {
|
|
3160
|
+
var found;
|
|
3161
|
+
|
|
3162
|
+
if (options.lookupCookie && typeof document !== 'undefined') {
|
|
3163
|
+
var c = cookie.read(options.lookupCookie);
|
|
3164
|
+
if (c) found = c;
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
return found;
|
|
3168
|
+
},
|
|
3169
|
+
cacheUserLanguage: function cacheUserLanguage(lng, options) {
|
|
3170
|
+
if (options.lookupCookie && typeof document !== 'undefined') {
|
|
3171
|
+
cookie.create(options.lookupCookie, lng, options.cookieMinutes, options.cookieDomain, options.cookieOptions);
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
3174
|
+
};
|
|
3175
|
+
|
|
3176
|
+
var querystring = {
|
|
3177
|
+
name: 'querystring',
|
|
3178
|
+
lookup: function lookup(options) {
|
|
3179
|
+
var found;
|
|
3180
|
+
|
|
3181
|
+
if (typeof window !== 'undefined') {
|
|
3182
|
+
var search = window.location.search;
|
|
3183
|
+
|
|
3184
|
+
if (!window.location.search && window.location.hash && window.location.hash.indexOf('?') > -1) {
|
|
3185
|
+
search = window.location.hash.substring(window.location.hash.indexOf('?'));
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3188
|
+
var query = search.substring(1);
|
|
3189
|
+
var params = query.split('&');
|
|
3190
|
+
|
|
3191
|
+
for (var i = 0; i < params.length; i++) {
|
|
3192
|
+
var pos = params[i].indexOf('=');
|
|
3193
|
+
|
|
3194
|
+
if (pos > 0) {
|
|
3195
|
+
var key = params[i].substring(0, pos);
|
|
3196
|
+
|
|
3197
|
+
if (key === options.lookupQuerystring) {
|
|
3198
|
+
found = params[i].substring(pos + 1);
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
return found;
|
|
3205
|
+
}
|
|
3206
|
+
};
|
|
3207
|
+
|
|
3208
|
+
var hasLocalStorageSupport = null;
|
|
3209
|
+
|
|
3210
|
+
var localStorageAvailable = function localStorageAvailable() {
|
|
3211
|
+
if (hasLocalStorageSupport !== null) return hasLocalStorageSupport;
|
|
3212
|
+
|
|
3213
|
+
try {
|
|
3214
|
+
hasLocalStorageSupport = window !== 'undefined' && window.localStorage !== null;
|
|
3215
|
+
var testKey = 'i18next.translate.boo';
|
|
3216
|
+
window.localStorage.setItem(testKey, 'foo');
|
|
3217
|
+
window.localStorage.removeItem(testKey);
|
|
3218
|
+
} catch (e) {
|
|
3219
|
+
hasLocalStorageSupport = false;
|
|
3220
|
+
}
|
|
3221
|
+
|
|
3222
|
+
return hasLocalStorageSupport;
|
|
3223
|
+
};
|
|
3224
|
+
|
|
3225
|
+
var localStorage = {
|
|
3226
|
+
name: 'localStorage',
|
|
3227
|
+
lookup: function lookup(options) {
|
|
3228
|
+
var found;
|
|
3229
|
+
|
|
3230
|
+
if (options.lookupLocalStorage && localStorageAvailable()) {
|
|
3231
|
+
var lng = window.localStorage.getItem(options.lookupLocalStorage);
|
|
3232
|
+
if (lng) found = lng;
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
return found;
|
|
3236
|
+
},
|
|
3237
|
+
cacheUserLanguage: function cacheUserLanguage(lng, options) {
|
|
3238
|
+
if (options.lookupLocalStorage && localStorageAvailable()) {
|
|
3239
|
+
window.localStorage.setItem(options.lookupLocalStorage, lng);
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
};
|
|
3243
|
+
|
|
3244
|
+
var hasSessionStorageSupport = null;
|
|
3245
|
+
|
|
3246
|
+
var sessionStorageAvailable = function sessionStorageAvailable() {
|
|
3247
|
+
if (hasSessionStorageSupport !== null) return hasSessionStorageSupport;
|
|
3248
|
+
|
|
3249
|
+
try {
|
|
3250
|
+
hasSessionStorageSupport = window !== 'undefined' && window.sessionStorage !== null;
|
|
3251
|
+
var testKey = 'i18next.translate.boo';
|
|
3252
|
+
window.sessionStorage.setItem(testKey, 'foo');
|
|
3253
|
+
window.sessionStorage.removeItem(testKey);
|
|
3254
|
+
} catch (e) {
|
|
3255
|
+
hasSessionStorageSupport = false;
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
return hasSessionStorageSupport;
|
|
3259
|
+
};
|
|
3260
|
+
|
|
3261
|
+
var sessionStorage = {
|
|
3262
|
+
name: 'sessionStorage',
|
|
3263
|
+
lookup: function lookup(options) {
|
|
3264
|
+
var found;
|
|
3265
|
+
|
|
3266
|
+
if (options.lookupSessionStorage && sessionStorageAvailable()) {
|
|
3267
|
+
var lng = window.sessionStorage.getItem(options.lookupSessionStorage);
|
|
3268
|
+
if (lng) found = lng;
|
|
3269
|
+
}
|
|
3270
|
+
|
|
3271
|
+
return found;
|
|
3272
|
+
},
|
|
3273
|
+
cacheUserLanguage: function cacheUserLanguage(lng, options) {
|
|
3274
|
+
if (options.lookupSessionStorage && sessionStorageAvailable()) {
|
|
3275
|
+
window.sessionStorage.setItem(options.lookupSessionStorage, lng);
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
};
|
|
3279
|
+
|
|
3280
|
+
var navigator$1 = {
|
|
3281
|
+
name: 'navigator',
|
|
3282
|
+
lookup: function lookup(options) {
|
|
3283
|
+
var found = [];
|
|
3284
|
+
|
|
3285
|
+
if (typeof navigator !== 'undefined') {
|
|
3286
|
+
if (navigator.languages) {
|
|
3287
|
+
// chrome only; not an array, so can't use .push.apply instead of iterating
|
|
3288
|
+
for (var i = 0; i < navigator.languages.length; i++) {
|
|
3289
|
+
found.push(navigator.languages[i]);
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
|
|
3293
|
+
if (navigator.userLanguage) {
|
|
3294
|
+
found.push(navigator.userLanguage);
|
|
3295
|
+
}
|
|
3296
|
+
|
|
3297
|
+
if (navigator.language) {
|
|
3298
|
+
found.push(navigator.language);
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3302
|
+
return found.length > 0 ? found : undefined;
|
|
3303
|
+
}
|
|
3304
|
+
};
|
|
3305
|
+
|
|
3306
|
+
var htmlTag = {
|
|
3307
|
+
name: 'htmlTag',
|
|
3308
|
+
lookup: function lookup(options) {
|
|
3309
|
+
var found;
|
|
3310
|
+
var htmlTag = options.htmlTag || (typeof document !== 'undefined' ? document.documentElement : null);
|
|
3311
|
+
|
|
3312
|
+
if (htmlTag && typeof htmlTag.getAttribute === 'function') {
|
|
3313
|
+
found = htmlTag.getAttribute('lang');
|
|
3314
|
+
}
|
|
3315
|
+
|
|
3316
|
+
return found;
|
|
3317
|
+
}
|
|
3318
|
+
};
|
|
3319
|
+
|
|
3320
|
+
var path = {
|
|
3321
|
+
name: 'path',
|
|
3322
|
+
lookup: function lookup(options) {
|
|
3323
|
+
var found;
|
|
3324
|
+
|
|
3325
|
+
if (typeof window !== 'undefined') {
|
|
3326
|
+
var language = window.location.pathname.match(/\/([a-zA-Z-]*)/g);
|
|
3327
|
+
|
|
3328
|
+
if (language instanceof Array) {
|
|
3329
|
+
if (typeof options.lookupFromPathIndex === 'number') {
|
|
3330
|
+
if (typeof language[options.lookupFromPathIndex] !== 'string') {
|
|
3331
|
+
return undefined;
|
|
3332
|
+
}
|
|
3333
|
+
|
|
3334
|
+
found = language[options.lookupFromPathIndex].replace('/', '');
|
|
3335
|
+
} else {
|
|
3336
|
+
found = language[0].replace('/', '');
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
|
|
3341
|
+
return found;
|
|
3342
|
+
}
|
|
3343
|
+
};
|
|
3344
|
+
|
|
3345
|
+
var subdomain = {
|
|
3346
|
+
name: 'subdomain',
|
|
3347
|
+
lookup: function lookup(options) {
|
|
3348
|
+
var found;
|
|
3349
|
+
|
|
3350
|
+
if (typeof window !== 'undefined') {
|
|
3351
|
+
var language = window.location.href.match(/(?:http[s]*\:\/\/)*(.*?)\.(?=[^\/]*\..{2,5})/gi);
|
|
3352
|
+
|
|
3353
|
+
if (language instanceof Array) {
|
|
3354
|
+
if (typeof options.lookupFromSubdomainIndex === 'number') {
|
|
3355
|
+
found = language[options.lookupFromSubdomainIndex].replace('http://', '').replace('https://', '').replace('.', '');
|
|
3356
|
+
} else {
|
|
3357
|
+
found = language[0].replace('http://', '').replace('https://', '').replace('.', '');
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
|
|
3362
|
+
return found;
|
|
3363
|
+
}
|
|
3364
|
+
};
|
|
3365
|
+
|
|
3366
|
+
function getDefaults() {
|
|
3367
|
+
return {
|
|
3368
|
+
order: ['querystring', 'cookie', 'localStorage', 'sessionStorage', 'navigator', 'htmlTag'],
|
|
3369
|
+
lookupQuerystring: 'lng',
|
|
3370
|
+
lookupCookie: 'i18next',
|
|
3371
|
+
lookupLocalStorage: 'i18nextLng',
|
|
3372
|
+
lookupSessionStorage: 'i18nextLng',
|
|
3373
|
+
// cache user language
|
|
3374
|
+
caches: ['localStorage'],
|
|
3375
|
+
excludeCacheFor: ['cimode'] //cookieMinutes: 10,
|
|
3376
|
+
//cookieDomain: 'myDomain'
|
|
3377
|
+
|
|
3378
|
+
};
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3381
|
+
var Browser = /*#__PURE__*/function () {
|
|
3382
|
+
function Browser(services) {
|
|
3383
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3384
|
+
|
|
3385
|
+
_classCallCheck(this, Browser);
|
|
3386
|
+
|
|
3387
|
+
this.type = 'languageDetector';
|
|
3388
|
+
this.detectors = {};
|
|
3389
|
+
this.init(services, options);
|
|
3390
|
+
}
|
|
3391
|
+
|
|
3392
|
+
_createClass(Browser, [{
|
|
3393
|
+
key: "init",
|
|
3394
|
+
value: function init(services) {
|
|
3395
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3396
|
+
var i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
3397
|
+
this.services = services;
|
|
3398
|
+
this.options = defaults(options, this.options || {}, getDefaults()); // backwards compatibility
|
|
3399
|
+
|
|
3400
|
+
if (this.options.lookupFromUrlIndex) this.options.lookupFromPathIndex = this.options.lookupFromUrlIndex;
|
|
3401
|
+
this.i18nOptions = i18nOptions;
|
|
3402
|
+
this.addDetector(cookie$1);
|
|
3403
|
+
this.addDetector(querystring);
|
|
3404
|
+
this.addDetector(localStorage);
|
|
3405
|
+
this.addDetector(sessionStorage);
|
|
3406
|
+
this.addDetector(navigator$1);
|
|
3407
|
+
this.addDetector(htmlTag);
|
|
3408
|
+
this.addDetector(path);
|
|
3409
|
+
this.addDetector(subdomain);
|
|
3410
|
+
}
|
|
3411
|
+
}, {
|
|
3412
|
+
key: "addDetector",
|
|
3413
|
+
value: function addDetector(detector) {
|
|
3414
|
+
this.detectors[detector.name] = detector;
|
|
3415
|
+
}
|
|
3416
|
+
}, {
|
|
3417
|
+
key: "detect",
|
|
3418
|
+
value: function detect(detectionOrder) {
|
|
3419
|
+
var _this = this;
|
|
3420
|
+
|
|
3421
|
+
if (!detectionOrder) detectionOrder = this.options.order;
|
|
3422
|
+
var detected = [];
|
|
3423
|
+
detectionOrder.forEach(function (detectorName) {
|
|
3424
|
+
if (_this.detectors[detectorName]) {
|
|
3425
|
+
var lookup = _this.detectors[detectorName].lookup(_this.options);
|
|
3426
|
+
|
|
3427
|
+
if (lookup && typeof lookup === 'string') lookup = [lookup];
|
|
3428
|
+
if (lookup) detected = detected.concat(lookup);
|
|
3429
|
+
}
|
|
3430
|
+
});
|
|
3431
|
+
if (this.services.languageUtils.getBestMatchFromCodes) return detected; // new i18next v19.5.0
|
|
3432
|
+
|
|
3433
|
+
return detected.length > 0 ? detected[0] : null; // a little backward compatibility
|
|
3434
|
+
}
|
|
3435
|
+
}, {
|
|
3436
|
+
key: "cacheUserLanguage",
|
|
3437
|
+
value: function cacheUserLanguage(lng, caches) {
|
|
3438
|
+
var _this2 = this;
|
|
3439
|
+
|
|
3440
|
+
if (!caches) caches = this.options.caches;
|
|
3441
|
+
if (!caches) return;
|
|
3442
|
+
if (this.options.excludeCacheFor && this.options.excludeCacheFor.indexOf(lng) > -1) return;
|
|
3443
|
+
caches.forEach(function (cacheName) {
|
|
3444
|
+
if (_this2.detectors[cacheName]) _this2.detectors[cacheName].cacheUserLanguage(lng, _this2.options);
|
|
3445
|
+
});
|
|
3446
|
+
}
|
|
3447
|
+
}]);
|
|
3448
|
+
|
|
3449
|
+
return Browser;
|
|
3450
|
+
}();
|
|
3451
|
+
|
|
3452
|
+
Browser.type = 'languageDetector';
|
|
3453
|
+
|
|
3454
|
+
i18next.use(Browser).init({
|
|
3455
|
+
fallbackLng: 'en',
|
|
3456
|
+
debug: false,
|
|
3457
|
+
resources: {
|
|
3458
|
+
en: {
|
|
3459
|
+
translation: {},
|
|
3460
|
+
},
|
|
3461
|
+
ja: {
|
|
3462
|
+
translation: {
|
|
3463
|
+
'Pay': '支払う',
|
|
3464
|
+
'Failed to load Stripe': 'ライブラリの読み込みに失敗しました。',
|
|
3465
|
+
'Add your payment information': '支払情報を追加',
|
|
3466
|
+
'Add card': 'カードを追加',
|
|
3467
|
+
'Add a card': 'カードを追加',
|
|
3468
|
+
'Add': '追加',
|
|
3469
|
+
'Card information': 'カード情報',
|
|
3470
|
+
'Card Number': 'カード番号',
|
|
3471
|
+
'MM / YY': '月 / 年',
|
|
3472
|
+
'CVC': 'セキュリティコード(CVC)',
|
|
3473
|
+
'Country or region': '地域',
|
|
3474
|
+
'Postal Code': '郵便番号',
|
|
3475
|
+
},
|
|
3476
|
+
},
|
|
3477
|
+
},
|
|
3478
|
+
});
|
|
3479
|
+
const i18n = i18next;
|
|
3480
|
+
|
|
3481
|
+
const stripePaymentSheetCss = ":root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-payment-sheet-wrap{display:block;width:100%;background:#fff;padding:32px 16px}.stripe-payment-sheet-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:\"Roboto\", suns-serif;box-sizing:border-box}.stripe-payment-sheet-wrap button{cursor:pointer}.stripe-payment-sheet-wrap .StripeElement{padding:8px 16px;min-height:64px;border-bottom:1px solid var(--color-input-border);border-radius:4px;display:flex;justify-content:center;align-items:center}.stripe-payment-sheet-wrap .StripeElement>.__PrivateStripeElement{width:100%}.stripe-payment-sheet-wrap .stripe-input-box{background-color:#fff;border-radius:2px;filter:drop-shadow(0 0 1px var(--color-input-border))}.stripe-payment-sheet-wrap .stripe-input-column .StripeElement{border-right:1px solid var(--color-input-border)}.stripe-payment-sheet-wrap .stripe-input-column .StripeElement:last-child{border-right:none}.stripe-payment-sheet-wrap .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .stripe-section-title{font-size:14px;font-weight:bold;color:var(--color-label);margin-bottom:8px}.stripe-payment-sheet-wrap .payment-info label{color:var(--color-label)}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap button{display:block;color:var(--color-button-text);background-color:var(--color-primary);width:100%;text-align:center;padding:16px 16px;font-size:18px;border-radius:8px;min-height:42px}.stripe-payment-sheet-wrap button:disabled{color:var(--color-button-text-disabled)}";
|
|
3482
|
+
|
|
3483
|
+
const StripePayment$1 = class extends HTMLElement {
|
|
3484
|
+
constructor() {
|
|
3485
|
+
super();
|
|
3486
|
+
this.__registerHost();
|
|
3487
|
+
this.stripeLoaded = createEvent(this, "stripeLoaded", 7);
|
|
3488
|
+
this.formSubmit = createEvent(this, "formSubmit", 7);
|
|
3489
|
+
this.defaultFormSubmitResult = createEvent(this, "defaultFormSubmitResult", 7);
|
|
3490
|
+
/**
|
|
3491
|
+
* Status of the Stripe client initilizing process
|
|
3492
|
+
*/
|
|
3493
|
+
this.loadStripeStatus = '';
|
|
3494
|
+
/**
|
|
3495
|
+
* Default submit handle type.
|
|
3496
|
+
* If you want to use `setupIntent`, should update this attribute.
|
|
3497
|
+
*/
|
|
3498
|
+
this.intentType = 'payment';
|
|
3499
|
+
/**
|
|
3500
|
+
* If true, show zip code field
|
|
3501
|
+
*/
|
|
3502
|
+
this.zip = true;
|
|
3503
|
+
/**
|
|
3504
|
+
* Payment sheet title
|
|
3505
|
+
* By default we recommended to use these string
|
|
3506
|
+
* - 'Add your payment information' -> PaymentSheet / PaymentFlow(Android)
|
|
3507
|
+
* - 'Add a card' -> PaymentFlow(iOS)
|
|
3508
|
+
* These strings will translated automatically by this library.
|
|
3509
|
+
*/
|
|
3510
|
+
this.sheetTitle = 'Add your payment information';
|
|
3511
|
+
/**
|
|
3512
|
+
* Submit button label
|
|
3513
|
+
* By default we recommended to use these string
|
|
3514
|
+
* - 'Pay' -> PaymentSheet
|
|
3515
|
+
* - 'Add' -> PaymentFlow(Android)
|
|
3516
|
+
* - 'Add card' -> PaymentFlow(iOS)
|
|
3517
|
+
* - 'Add a card' -> PaymentFlow(iOS)
|
|
3518
|
+
* These strings will translated automatically by this library.
|
|
3519
|
+
*
|
|
3520
|
+
*/
|
|
3521
|
+
this.buttonLabel = 'Pay';
|
|
3522
|
+
/**
|
|
3523
|
+
* The progress status of the checkout process
|
|
3524
|
+
*/
|
|
3525
|
+
this.progress = '';
|
|
3526
|
+
/**
|
|
3527
|
+
* Error message
|
|
3528
|
+
*/
|
|
3529
|
+
this.errorMessage = '';
|
|
3530
|
+
/**
|
|
3531
|
+
* zip code
|
|
3532
|
+
*/
|
|
3533
|
+
this.zipCode = '';
|
|
3534
|
+
/**
|
|
3535
|
+
* Overwrite the application name that registered
|
|
3536
|
+
* For wrapper library (like Capacitor)
|
|
3537
|
+
*/
|
|
3538
|
+
this.applicationName = 'stripe-pwa-elements';
|
|
3539
|
+
/**
|
|
3540
|
+
* Show the form label
|
|
3541
|
+
*/
|
|
3542
|
+
this.showLabel = false;
|
|
3543
|
+
/**
|
|
3544
|
+
* The component will provide a function to call the `stripe.confirmCardPayment`API.
|
|
3545
|
+
* If you want to customize the behavior, should set false.
|
|
3546
|
+
* And listen the 'formSubmit' event on the element
|
|
3547
|
+
*/
|
|
3548
|
+
this.shouldUseDefaultFormSubmitAction = true;
|
|
3549
|
+
if (this.publishableKey) {
|
|
3550
|
+
this.initStripe(this.publishableKey, {
|
|
3551
|
+
stripeAccount: this.stripeAccount,
|
|
3552
|
+
});
|
|
3553
|
+
}
|
|
3554
|
+
else {
|
|
3555
|
+
this.loadStripeStatus = 'failure';
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3558
|
+
/**
|
|
3559
|
+
* Get Stripe.js, and initialize elements
|
|
3560
|
+
* @param publishableKey
|
|
3561
|
+
* @param options
|
|
3562
|
+
* @example
|
|
3563
|
+
* ```
|
|
3564
|
+
* const stripeElement = document.createElement('stripe-card-element');
|
|
3565
|
+
* customElements
|
|
3566
|
+
* .whenDefined('stripe-card-element')
|
|
3567
|
+
* .then(() => {
|
|
3568
|
+
* tripeElement.initStripe('pk_test_XXXXXXXXX')
|
|
3569
|
+
* })
|
|
3570
|
+
* ```
|
|
3571
|
+
*/
|
|
3572
|
+
async initStripe(publishableKey, options = undefined) {
|
|
3573
|
+
this.loadStripeStatus = 'loading';
|
|
3574
|
+
loadStripe(publishableKey, {
|
|
3575
|
+
stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
|
|
3576
|
+
})
|
|
3577
|
+
.then(stripe => {
|
|
3578
|
+
this.loadStripeStatus = 'success';
|
|
3579
|
+
stripe.registerAppInfo({
|
|
3580
|
+
name: this.applicationName,
|
|
3581
|
+
});
|
|
3582
|
+
this.stripe = stripe;
|
|
3583
|
+
return;
|
|
3584
|
+
})
|
|
3585
|
+
.catch(e => {
|
|
3586
|
+
console.log(e);
|
|
3587
|
+
this.errorMessage = e.message;
|
|
3588
|
+
this.loadStripeStatus = 'failure';
|
|
3589
|
+
return;
|
|
3590
|
+
})
|
|
3591
|
+
.then(() => {
|
|
3592
|
+
if (!this.stripe) {
|
|
3593
|
+
return;
|
|
3594
|
+
}
|
|
3595
|
+
return this.initElement();
|
|
3596
|
+
})
|
|
3597
|
+
.then(() => {
|
|
3598
|
+
if (!this.stripe) {
|
|
3599
|
+
return;
|
|
3600
|
+
}
|
|
3601
|
+
this.stripeLoadedEventHandler();
|
|
3602
|
+
});
|
|
3603
|
+
}
|
|
3604
|
+
/**
|
|
3605
|
+
* Update the form submit progress
|
|
3606
|
+
* @param progress
|
|
3607
|
+
* @returns
|
|
3608
|
+
* @example
|
|
3609
|
+
* ```
|
|
3610
|
+
* const stripeElement = document.createElement('stripe-card-element');
|
|
3611
|
+
* customElements
|
|
3612
|
+
* .whenDefined('stripe-card-element')
|
|
3613
|
+
* .then(() => {
|
|
3614
|
+
* // You must set the attributes to stop running default form submit action when you want to listen the 'formSubmit' event.
|
|
3615
|
+
* stripeElement.setAttribute('should-use-default-form-submit-action', false)
|
|
3616
|
+
* stripeElement.addEventListener('formSubmit', async props => {
|
|
3617
|
+
* const {
|
|
3618
|
+
* detail: { stripe, cardNumber, event },
|
|
3619
|
+
* } = props;
|
|
3620
|
+
* const result = await stripe.createPaymentMethod({
|
|
3621
|
+
* type: 'card',
|
|
3622
|
+
* card: cardNumber,
|
|
3623
|
+
* });
|
|
3624
|
+
* console.log(result);
|
|
3625
|
+
* stripeElement.updateProgress('success')
|
|
3626
|
+
* });
|
|
3627
|
+
* })
|
|
3628
|
+
*/
|
|
3629
|
+
async updateProgress(progress) {
|
|
3630
|
+
this.progress = progress;
|
|
3631
|
+
return this;
|
|
3632
|
+
}
|
|
3633
|
+
/**
|
|
3634
|
+
* Set error message
|
|
3635
|
+
* @param errorMessage string
|
|
3636
|
+
* @returns
|
|
3637
|
+
* @example
|
|
3638
|
+
* ```
|
|
3639
|
+
* const stripeElement = document.createElement('stripe-card-element');
|
|
3640
|
+
* customElements
|
|
3641
|
+
* .whenDefined('stripe-card-element')
|
|
3642
|
+
* .then(() => {
|
|
3643
|
+
* // You must set the attributes to stop running default form submit action when you want to listen the 'formSubmit' event.
|
|
3644
|
+
* stripeElement.setAttribute('should-use-default-form-submit-action', false)
|
|
3645
|
+
* stripeElement.addEventListener('formSubmit', async props => {
|
|
3646
|
+
* try {
|
|
3647
|
+
* throw new Error('debug')
|
|
3648
|
+
* } catch (e) {
|
|
3649
|
+
* stripeElement.setErrorMessage(`Error: ${e.message}`)
|
|
3650
|
+
* stripeElement.updateProgress('failure')
|
|
3651
|
+
* }
|
|
3652
|
+
* });
|
|
3653
|
+
* })
|
|
3654
|
+
*/
|
|
3655
|
+
async setErrorMessage(errorMessage) {
|
|
3656
|
+
this.errorMessage = errorMessage;
|
|
3657
|
+
return this;
|
|
3658
|
+
}
|
|
3659
|
+
/**
|
|
3660
|
+
* @param option
|
|
3661
|
+
* @private
|
|
3662
|
+
*/
|
|
3663
|
+
async setPaymentRequestOption(option) {
|
|
3664
|
+
this.paymentRequestOption = option;
|
|
3665
|
+
this.createPaymentRequestButton();
|
|
3666
|
+
return this;
|
|
3667
|
+
}
|
|
3668
|
+
stripeLoadedEventHandler() {
|
|
3669
|
+
const event = {
|
|
3670
|
+
stripe: this.stripe,
|
|
3671
|
+
};
|
|
3672
|
+
if (this.stripeDidLoaded) {
|
|
3673
|
+
this.stripeDidLoaded(event);
|
|
3674
|
+
}
|
|
3675
|
+
this.stripeLoaded.emit(event);
|
|
3676
|
+
}
|
|
3677
|
+
async formSubmitEventHandler() {
|
|
3678
|
+
const { cardCVC, cardExpiry, cardNumber, stripe } = this;
|
|
3679
|
+
this.formSubmit.emit({
|
|
3680
|
+
cardCVCElement: cardCVC,
|
|
3681
|
+
cardExpiryElement: cardExpiry,
|
|
3682
|
+
cardNumberElement: cardNumber,
|
|
3683
|
+
stripe,
|
|
3684
|
+
});
|
|
3685
|
+
}
|
|
3686
|
+
async defaultFormSubmitResultHandler(result) {
|
|
3687
|
+
this.defaultFormSubmitResult.emit(result);
|
|
3688
|
+
}
|
|
3689
|
+
componentWillUpdate() {
|
|
3690
|
+
if (!this.publishableKey) {
|
|
3691
|
+
return;
|
|
3692
|
+
}
|
|
3693
|
+
if (['success', 'loading'].includes(this.loadStripeStatus)) {
|
|
3694
|
+
return;
|
|
3695
|
+
}
|
|
3696
|
+
this.initStripe(this.publishableKey, {
|
|
3697
|
+
stripeAccount: this.stripeAccount,
|
|
3698
|
+
});
|
|
3699
|
+
this.createPaymentRequestButton();
|
|
3700
|
+
}
|
|
3701
|
+
/**
|
|
3702
|
+
* Default form submit action (just call a confirmCardPayment).
|
|
3703
|
+
* If you don't want use it, please set `should-use-default-form-submit-action="false"`
|
|
3704
|
+
* @param event
|
|
3705
|
+
* @param param1
|
|
3706
|
+
*/
|
|
3707
|
+
async defaultFormSubmitAction(event, { stripe, cardNumberElement, intentClientSecret }) {
|
|
3708
|
+
event.preventDefault();
|
|
3709
|
+
try {
|
|
3710
|
+
const { intentType } = this;
|
|
3711
|
+
const result = await (() => {
|
|
3712
|
+
if (intentType === 'payment') {
|
|
3713
|
+
return stripe.confirmCardPayment(intentClientSecret, {
|
|
3714
|
+
payment_method: {
|
|
3715
|
+
card: cardNumberElement,
|
|
3716
|
+
},
|
|
3717
|
+
});
|
|
3718
|
+
}
|
|
3719
|
+
return stripe.confirmCardSetup(intentClientSecret, {
|
|
3720
|
+
payment_method: {
|
|
3721
|
+
card: cardNumberElement,
|
|
3722
|
+
},
|
|
3723
|
+
});
|
|
3724
|
+
})();
|
|
3725
|
+
this.defaultFormSubmitResultHandler(result);
|
|
3726
|
+
}
|
|
3727
|
+
catch (e) {
|
|
3728
|
+
this.defaultFormSubmitResultHandler(e);
|
|
3729
|
+
throw e;
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
/**
|
|
3733
|
+
* Initialize Component using Stripe Element
|
|
3734
|
+
*/
|
|
3735
|
+
async initElement() {
|
|
3736
|
+
const elements = this.stripe.elements();
|
|
3737
|
+
const handleCardError = ({ error }) => {
|
|
3738
|
+
if (error) {
|
|
3739
|
+
this.errorMessage = error.message;
|
|
3740
|
+
}
|
|
3741
|
+
else {
|
|
3742
|
+
this.errorMessage = '';
|
|
3743
|
+
}
|
|
3744
|
+
};
|
|
3745
|
+
this.cardNumber = elements.create('cardNumber', {
|
|
3746
|
+
placeholder: i18n.t('Card Number'),
|
|
3747
|
+
});
|
|
3748
|
+
const cardNumberElement = await waitForElm(this.el, '#card-number');
|
|
3749
|
+
this.cardNumber.mount(cardNumberElement);
|
|
3750
|
+
this.cardNumber.on('change', handleCardError);
|
|
3751
|
+
this.cardExpiry = elements.create('cardExpiry');
|
|
3752
|
+
const cardExpiryElement = await waitForElm(this.el, '#card-expiry');
|
|
3753
|
+
this.cardExpiry.mount(cardExpiryElement);
|
|
3754
|
+
this.cardExpiry.on('change', handleCardError);
|
|
3755
|
+
this.cardCVC = elements.create('cardCvc');
|
|
3756
|
+
const cardCVCElement = await waitForElm(this.el, '#card-cvc');
|
|
3757
|
+
this.cardCVC.mount(cardCVCElement);
|
|
3758
|
+
this.cardCVC.on('change', handleCardError);
|
|
3759
|
+
document.getElementById('stripe-card-element').addEventListener('submit', async (e) => {
|
|
3760
|
+
const { cardCVC, cardExpiry, cardNumber, stripe, intentClientSecret } = this;
|
|
3761
|
+
const submitEventProps = {
|
|
3762
|
+
cardCVCElement: cardCVC,
|
|
3763
|
+
cardExpiryElement: cardExpiry,
|
|
3764
|
+
cardNumberElement: cardNumber,
|
|
3765
|
+
stripe,
|
|
3766
|
+
intentClientSecret,
|
|
3767
|
+
zipCode: this.zipCode,
|
|
3768
|
+
};
|
|
3769
|
+
this.progress = 'loading';
|
|
3770
|
+
try {
|
|
3771
|
+
if (this.handleSubmit) {
|
|
3772
|
+
await this.handleSubmit(e, submitEventProps);
|
|
3773
|
+
}
|
|
3774
|
+
else if (this.shouldUseDefaultFormSubmitAction === true && intentClientSecret) {
|
|
3775
|
+
await this.defaultFormSubmitAction(e, submitEventProps);
|
|
3776
|
+
}
|
|
3777
|
+
else {
|
|
3778
|
+
e.preventDefault();
|
|
3779
|
+
}
|
|
3780
|
+
await this.formSubmitEventHandler();
|
|
3781
|
+
if (this.handleSubmit || this.shouldUseDefaultFormSubmitAction === true) {
|
|
3782
|
+
this.progress = 'success';
|
|
3783
|
+
}
|
|
3784
|
+
}
|
|
3785
|
+
catch (e) {
|
|
3786
|
+
this.errorMessage = e.message;
|
|
3787
|
+
this.progress = 'failure';
|
|
3788
|
+
}
|
|
3789
|
+
});
|
|
3790
|
+
}
|
|
3791
|
+
componentDidLoad() {
|
|
3792
|
+
this.el.classList.add(checkPlatform());
|
|
3793
|
+
}
|
|
3794
|
+
disconnectedCallback() {
|
|
3795
|
+
if (this.cardNumber) {
|
|
3796
|
+
this.cardNumber.unmount();
|
|
3797
|
+
}
|
|
3798
|
+
if (this.cardExpiry) {
|
|
3799
|
+
this.cardExpiry.unmount();
|
|
3800
|
+
}
|
|
3801
|
+
if (this.cardCVC) {
|
|
3802
|
+
this.cardCVC.unmount();
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3805
|
+
/**
|
|
3806
|
+
* Create payment request button
|
|
3807
|
+
* It's just proxy of stripe-payment-request-button
|
|
3808
|
+
*/
|
|
3809
|
+
createPaymentRequestButton() {
|
|
3810
|
+
const { showPaymentRequestButton, paymentRequestOption } = this;
|
|
3811
|
+
if (!showPaymentRequestButton || !paymentRequestOption) {
|
|
3812
|
+
return null;
|
|
3813
|
+
}
|
|
3814
|
+
if (!document) {
|
|
3815
|
+
return null;
|
|
3816
|
+
}
|
|
3817
|
+
const targetElement = document.getElementById('stripe-payment-request-button');
|
|
3818
|
+
const stripePaymentRequestElement = document.createElement('stripe-payment-request-button');
|
|
3819
|
+
targetElement.appendChild(stripePaymentRequestElement);
|
|
3820
|
+
const { paymentRequestPaymentMethodHandler, paymentRequestShippingOptionChangeHandler, paymentRequestShippingAddressChangeHandler } = paymentRequestOption;
|
|
3821
|
+
customElements.whenDefined('stripe-payment-request-button').then(() => {
|
|
3822
|
+
stripePaymentRequestElement.setPaymentRequestOption(paymentRequestOption);
|
|
3823
|
+
if (paymentRequestPaymentMethodHandler) {
|
|
3824
|
+
stripePaymentRequestElement.setPaymentMethodEventHandler(paymentRequestPaymentMethodHandler);
|
|
3825
|
+
}
|
|
3826
|
+
if (paymentRequestShippingOptionChangeHandler) {
|
|
3827
|
+
stripePaymentRequestElement.setPaymentRequestShippingOptionEventHandler(paymentRequestShippingOptionChangeHandler);
|
|
3828
|
+
}
|
|
3829
|
+
if (paymentRequestShippingAddressChangeHandler) {
|
|
3830
|
+
stripePaymentRequestElement.setPaymentRequestShippingAddressEventHandler(paymentRequestShippingAddressChangeHandler);
|
|
3831
|
+
}
|
|
3832
|
+
return stripePaymentRequestElement.initStripe(this.publishableKey);
|
|
3833
|
+
});
|
|
3834
|
+
}
|
|
3835
|
+
render() {
|
|
3836
|
+
const { errorMessage } = this;
|
|
3837
|
+
if (this.loadStripeStatus === 'failure') {
|
|
3838
|
+
return h("p", null, i18n.t('Failed to load Stripe'));
|
|
3839
|
+
}
|
|
3840
|
+
const disabled = this.progress === 'loading';
|
|
3841
|
+
return (h("div", { class: "stripe-payment-sheet-wrap" }, h("form", { id: "stripe-card-element" }, h("div", { class: "stripe-heading" }, i18n.t(this.sheetTitle)), h("div", { id: "stripe-payment-request-button" }), h("div", null, h("div", { class: "stripe-section-title" }, i18n.t('Card information'))), h("div", { class: "payment-info card visible" }, h("fieldset", { class: "stripe-input-box" }, h("div", null, h("label", null, this.showLabel ? h("lenged", null, i18n.t('Card Number')) : null, h("div", { id: "card-number" }))), h("div", { class: "stripe-input-column", style: { display: 'flex' } }, h("label", { style: { width: '50%' } }, this.showLabel ? h("lenged", null, i18n.t('MM / YY')) : null, h("div", { id: "card-expiry" })), h("label", { style: { width: '50%' } }, this.showLabel ? h("lenged", null, i18n.t('CVC')) : null, h("div", { id: "card-cvc" }))), h("div", { id: "card-errors", class: "element-errors" }, errorMessage))), this.zip ? (h("div", { style: { marginTop: '1.5rem' } }, h("div", { class: "stripe-section-title" }, i18n.t('Country or region')))) : null, this.zip ? (h("div", { class: "payment-info card visible" }, h("fieldset", { class: "stripe-input-box" }, h("div", null, h("label", null, this.showLabel ? h("lenged", null, i18n.t('Postal Code')) : null, h("input", { id: "zip", name: "zip", type: "text", inputmode: "numeric", class: "stripe-input-box StripeElement", style: { width: '100%' }, placeholder: i18n.t('Postal Code'), value: this.zipCode, onInput: e => {
|
|
3842
|
+
this.zipCode = e.target.value;
|
|
3843
|
+
} })))))) : null, h("div", { style: { marginTop: '32px' } }, h("button", { type: "submit", disabled: disabled }, this.progress === 'loading' ? i18n.t('Loading') : i18n.t(this.buttonLabel))))));
|
|
3844
|
+
}
|
|
3845
|
+
get el() { return this; }
|
|
3846
|
+
static get style() { return stripePaymentSheetCss; }
|
|
3847
|
+
};
|
|
3848
|
+
|
|
3849
|
+
const stripePaymentRequestButtonCss = ":host{display:block}";
|
|
3850
|
+
|
|
3851
|
+
const StripePaymentRequestButton$1 = class extends HTMLElement {
|
|
3852
|
+
constructor() {
|
|
3853
|
+
super();
|
|
3854
|
+
this.__registerHost();
|
|
3855
|
+
this.stripeLoaded = createEvent(this, "stripeLoaded", 7);
|
|
3856
|
+
this.loadStripeStatus = '';
|
|
3857
|
+
/**
|
|
3858
|
+
* Overwrite the application name that registered
|
|
3859
|
+
* For wrapper library (like Capacitor)
|
|
3860
|
+
*/
|
|
3861
|
+
this.applicationName = 'stripe-pwa-elements';
|
|
3862
|
+
if (this.publishableKey !== undefined && this.paymentRequestOption !== undefined) {
|
|
3863
|
+
this.initStripe(this.publishableKey, {
|
|
3864
|
+
stripeAccount: this.stripeAccount,
|
|
3865
|
+
});
|
|
3866
|
+
}
|
|
3867
|
+
else {
|
|
3868
|
+
this.loadStripeStatus = 'failure';
|
|
3869
|
+
}
|
|
3870
|
+
}
|
|
3871
|
+
/**
|
|
3872
|
+
* Check isAvailable ApplePay or GooglePay.
|
|
3873
|
+
* If you run this method, you should run before initStripe.
|
|
3874
|
+
*/
|
|
3875
|
+
async isAvailable(type) {
|
|
3876
|
+
if (this.publishableKey === undefined) {
|
|
3877
|
+
throw 'You should run this method run, after set publishableKey.';
|
|
3878
|
+
}
|
|
3879
|
+
const stripe = await loadStripe(this.publishableKey, {
|
|
3880
|
+
stripeAccount: this.stripeAccount,
|
|
3881
|
+
});
|
|
3882
|
+
const paymentRequest = stripe.paymentRequest({
|
|
3883
|
+
country: 'US',
|
|
3884
|
+
currency: 'usd',
|
|
3885
|
+
total: {
|
|
3886
|
+
label: 'Demo total',
|
|
3887
|
+
amount: 1099,
|
|
3888
|
+
},
|
|
3889
|
+
disableWallets: ['applePay', 'googlePay', 'browserCard'].filter(method => method !== type),
|
|
3890
|
+
});
|
|
3891
|
+
const paymentRequestSupport = await paymentRequest.canMakePayment();
|
|
3892
|
+
if (!paymentRequestSupport || (type === 'applePay' && !paymentRequestSupport[type]) || (type === 'googlePay' && !paymentRequestSupport[type])) {
|
|
3893
|
+
throw 'This device can not use.';
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
/**
|
|
3897
|
+
* Register event handler for `paymentRequest.on('paymentmethod'` event.
|
|
3898
|
+
*/
|
|
3899
|
+
async setPaymentMethodEventHandler(handler) {
|
|
3900
|
+
this.paymentMethodEventHandler = handler;
|
|
3901
|
+
}
|
|
3902
|
+
/**
|
|
3903
|
+
* Register event handler for `paymentRequest.on('shippingoptionchange'` event.
|
|
3904
|
+
*/
|
|
3905
|
+
async setPaymentRequestShippingOptionEventHandler(handler) {
|
|
3906
|
+
this.shippingOptionEventHandler = handler;
|
|
3907
|
+
}
|
|
3908
|
+
/**
|
|
3909
|
+
* Register event handler for `paymentRequest.on('shippingaddresschange'` event.
|
|
3910
|
+
*/
|
|
3911
|
+
async setPaymentRequestShippingAddressEventHandler(handler) {
|
|
3912
|
+
this.shippingAddressEventHandler = handler;
|
|
3913
|
+
}
|
|
3914
|
+
stripeLoadedEventHandler() {
|
|
3915
|
+
const event = {
|
|
3916
|
+
stripe: this.stripe,
|
|
3917
|
+
};
|
|
3918
|
+
if (this.stripeDidLoaded) {
|
|
3919
|
+
this.stripeDidLoaded(event);
|
|
3920
|
+
}
|
|
3921
|
+
this.stripeLoaded.emit(event);
|
|
3922
|
+
}
|
|
3923
|
+
/**
|
|
3924
|
+
* @param option
|
|
3925
|
+
* @private
|
|
3926
|
+
*/
|
|
3927
|
+
async setPaymentRequestOption(option) {
|
|
3928
|
+
this.paymentRequestOption = option;
|
|
3929
|
+
return this;
|
|
3930
|
+
}
|
|
3931
|
+
/**
|
|
3932
|
+
* Get Stripe.js, and initialize elements
|
|
3933
|
+
* @param publishableKey
|
|
3934
|
+
* @param options
|
|
3935
|
+
*/
|
|
3936
|
+
async initStripe(publishableKey, options = undefined) {
|
|
3937
|
+
this.loadStripeStatus = 'loading';
|
|
3938
|
+
loadStripe(publishableKey, {
|
|
3939
|
+
stripeAccount: options === null || options === void 0 ? void 0 : options.stripeAccount,
|
|
3940
|
+
})
|
|
3941
|
+
.then(stripe => {
|
|
3942
|
+
this.loadStripeStatus = 'success';
|
|
3943
|
+
stripe.registerAppInfo({
|
|
3944
|
+
name: this.applicationName,
|
|
3945
|
+
});
|
|
3946
|
+
this.stripe = stripe;
|
|
3947
|
+
return;
|
|
3948
|
+
})
|
|
3949
|
+
.catch(e => {
|
|
3950
|
+
console.log(e);
|
|
3951
|
+
this.loadStripeStatus = 'failure';
|
|
3952
|
+
return;
|
|
3953
|
+
})
|
|
3954
|
+
.then(() => {
|
|
3955
|
+
if (!this.stripe) {
|
|
3956
|
+
return;
|
|
3957
|
+
}
|
|
3958
|
+
// 後方互換のため、明確にfalseにしていないものはtrue扱い
|
|
3959
|
+
return this.initElement(!(options === null || options === void 0 ? void 0 : options.showButton) === false);
|
|
3960
|
+
})
|
|
3961
|
+
.then(() => {
|
|
3962
|
+
if (!this.stripe) {
|
|
3963
|
+
return;
|
|
3964
|
+
}
|
|
3965
|
+
this.stripeLoadedEventHandler();
|
|
3966
|
+
});
|
|
3967
|
+
}
|
|
3968
|
+
/**
|
|
3969
|
+
* Initialize Component using Stripe Element
|
|
3970
|
+
*/
|
|
3971
|
+
async initElement(showButton = true) {
|
|
3972
|
+
const paymentRequest = this.stripe.paymentRequest(this.paymentRequestOption);
|
|
3973
|
+
// Check if the Payment Request is available (or Apple Pay on the Web).
|
|
3974
|
+
const paymentRequestSupport = await paymentRequest.canMakePayment();
|
|
3975
|
+
if (!paymentRequestSupport) {
|
|
3976
|
+
throw 'paymentRequest is not support.';
|
|
3977
|
+
}
|
|
3978
|
+
if (this.paymentMethodEventHandler) {
|
|
3979
|
+
paymentRequest.on('paymentmethod', event => {
|
|
3980
|
+
this.paymentMethodEventHandler(event, this.stripe);
|
|
3981
|
+
});
|
|
3982
|
+
}
|
|
3983
|
+
if (this.shippingOptionEventHandler) {
|
|
3984
|
+
paymentRequest.on('shippingoptionchange', event => {
|
|
3985
|
+
this.shippingOptionEventHandler(event, this.stripe);
|
|
3986
|
+
});
|
|
3987
|
+
}
|
|
3988
|
+
if (this.shippingAddressEventHandler) {
|
|
3989
|
+
paymentRequest.on('shippingaddresschange', event => {
|
|
3990
|
+
this.shippingAddressEventHandler(event, this.stripe);
|
|
3991
|
+
});
|
|
3992
|
+
}
|
|
3993
|
+
if (showButton) {
|
|
3994
|
+
// Display the Pay button by mounting the Element in the DOM.
|
|
3995
|
+
const elements = this.stripe.elements();
|
|
3996
|
+
const paymentRequestButton = elements.create('paymentRequestButton', {
|
|
3997
|
+
paymentRequest,
|
|
3998
|
+
});
|
|
3999
|
+
const paymentRequestButtonElement = this.el.querySelector('#payment-request-button');
|
|
4000
|
+
paymentRequestButton.mount(paymentRequestButtonElement);
|
|
4001
|
+
// Show the payment request section.
|
|
4002
|
+
this.el.querySelector('#payment-request').classList.add('visible');
|
|
4003
|
+
}
|
|
4004
|
+
else {
|
|
4005
|
+
/**
|
|
4006
|
+
* This method must be called as the result of a user interaction (for example, in a click handler).
|
|
4007
|
+
* https://stripe.com/docs/js/payment_request/show
|
|
4008
|
+
*/
|
|
4009
|
+
paymentRequest.show();
|
|
4010
|
+
}
|
|
4011
|
+
}
|
|
4012
|
+
render() {
|
|
4013
|
+
return (h(Host, null, h("div", { id: "payment-request" }, h("div", { id: "payment-request-button" })), h("slot", null)));
|
|
4014
|
+
}
|
|
4015
|
+
get el() { return this; }
|
|
4016
|
+
static get style() { return stripePaymentRequestButtonCss; }
|
|
4017
|
+
};
|
|
4018
|
+
|
|
4019
|
+
const stripePaymentSheetModalCss = ":host{display:block}";
|
|
4020
|
+
|
|
4021
|
+
const StripePaymentSheet$1 = class extends HTMLElement {
|
|
4022
|
+
constructor() {
|
|
4023
|
+
super();
|
|
4024
|
+
this.__registerHost();
|
|
4025
|
+
this.closed = createEvent(this, "closed", 7);
|
|
4026
|
+
/**
|
|
4027
|
+
* Show the form label
|
|
4028
|
+
*/
|
|
4029
|
+
this.showLabel = false;
|
|
4030
|
+
/**
|
|
4031
|
+
* The component will provide a function to call the `stripe.confirmCardPayment`API.
|
|
4032
|
+
* If you want to customize the behavior, should set false.
|
|
4033
|
+
* And listen the 'formSubmit' event on the element
|
|
4034
|
+
*/
|
|
4035
|
+
this.shouldUseDefaultFormSubmitAction = true;
|
|
4036
|
+
/**
|
|
4037
|
+
* Default submit handle type.
|
|
4038
|
+
* If you want to use `setupIntent`, should update this attribute.
|
|
4039
|
+
* @example
|
|
4040
|
+
* ```
|
|
4041
|
+
* <stripe-payment-sheet intent-type="setup" />
|
|
4042
|
+
* ```
|
|
4043
|
+
*/
|
|
4044
|
+
this.intentType = 'payment';
|
|
4045
|
+
/**
|
|
4046
|
+
* If true, the modal display close button
|
|
4047
|
+
*/
|
|
4048
|
+
this.showCloseButton = true;
|
|
4049
|
+
/**
|
|
4050
|
+
* If true, show zip code field
|
|
4051
|
+
*/
|
|
4052
|
+
this.zip = true;
|
|
4053
|
+
/**
|
|
4054
|
+
* Modal state.
|
|
4055
|
+
* If true, the modal will open
|
|
4056
|
+
*/
|
|
4057
|
+
this.open = false;
|
|
4058
|
+
}
|
|
4059
|
+
componentDidLoad() {
|
|
4060
|
+
const modal = this.el.querySelector('stripe-sheet');
|
|
4061
|
+
modal.addEventListener('close', () => {
|
|
4062
|
+
this.closed.emit();
|
|
4063
|
+
});
|
|
4064
|
+
}
|
|
4065
|
+
/**
|
|
4066
|
+
* Get the inner component
|
|
4067
|
+
*/
|
|
4068
|
+
async getStripePaymentSheetElement() {
|
|
4069
|
+
return this.el.querySelector('stripe-payment');
|
|
4070
|
+
}
|
|
4071
|
+
/**
|
|
4072
|
+
* open modal
|
|
4073
|
+
*/
|
|
4074
|
+
async present() {
|
|
4075
|
+
this.open = true;
|
|
4076
|
+
return new Promise((resolve, reject) => {
|
|
4077
|
+
const paymentSheet = this.el.querySelector('stripe-payment');
|
|
4078
|
+
paymentSheet.addEventListener('formSubmit', async (props) => {
|
|
4079
|
+
resolve(props);
|
|
4080
|
+
});
|
|
4081
|
+
this.el.addEventListener('closed', () => reject());
|
|
4082
|
+
});
|
|
4083
|
+
}
|
|
4084
|
+
/**
|
|
4085
|
+
* Update Stripe client loading process
|
|
4086
|
+
*/
|
|
4087
|
+
async updateProgress(progress) {
|
|
4088
|
+
const paymentSheet = this.el.querySelector('stripe-payment');
|
|
4089
|
+
return paymentSheet.updateProgress(progress);
|
|
4090
|
+
}
|
|
4091
|
+
/**
|
|
4092
|
+
* Remove the modal
|
|
4093
|
+
*/
|
|
4094
|
+
async destroy() {
|
|
4095
|
+
const paymentSheet = this.el.querySelector('stripe-payment');
|
|
4096
|
+
paymentSheet.remove();
|
|
4097
|
+
this.el.remove();
|
|
4098
|
+
}
|
|
4099
|
+
/**
|
|
4100
|
+
*
|
|
4101
|
+
* Add payment request button
|
|
4102
|
+
*/
|
|
4103
|
+
async setPaymentRequestButton(options) {
|
|
4104
|
+
const elements = this.el.getElementsByTagName('stripe-payment');
|
|
4105
|
+
if (elements.length < 1) {
|
|
4106
|
+
return;
|
|
4107
|
+
}
|
|
4108
|
+
const paymentSheetElement = elements[0];
|
|
4109
|
+
if (!paymentSheetElement) {
|
|
4110
|
+
return;
|
|
4111
|
+
}
|
|
4112
|
+
paymentSheetElement.setAttribute('show-payment-request-button', 'true');
|
|
4113
|
+
if (this.applicationName) {
|
|
4114
|
+
paymentSheetElement.setAttribute('application-name', this.applicationName);
|
|
4115
|
+
}
|
|
4116
|
+
paymentSheetElement.setPaymentRequestOption(options);
|
|
4117
|
+
}
|
|
4118
|
+
render() {
|
|
4119
|
+
return (h("stripe-sheet", { open: this.open, showCloseButton: this.showCloseButton }, h("stripe-payment", { showLabel: this.showLabel, publishableKey: this.publishableKey, intentClientSecret: this.intentClientSecret, shouldUseDefaultFormSubmitAction: this.shouldUseDefaultFormSubmitAction, handleSubmit: this.handleSubmit, stripeDidLoaded: this.stripeDidLoaded, intentType: this.intentType, zip: this.zip, buttonLabel: this.buttonLabel, sheetTitle: this.sheetTitle, applicationName: this.applicationName })));
|
|
4120
|
+
}
|
|
4121
|
+
get el() { return this; }
|
|
4122
|
+
static get style() { return stripePaymentSheetModalCss; }
|
|
4123
|
+
};
|
|
4124
|
+
|
|
4125
|
+
const stripeElementModalCss = "*:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:\"Roboto\", suns-serif;box-sizing:border-box}button{cursor:pointer}:root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}:host{display:block}.modal-row{display:none}.modal-row.open{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:1ch;background:rgba(0, 0, 0, 0.3)}.modal-child{padding:1.5rem;background-color:#fff;width:100%}.modal-close-button-wrap{padding-left:8px}.modal-close-button-wrap .modal-close-button{width:32px;display:block;fill:var(--color-label);cursor:pointer}";
|
|
4126
|
+
|
|
4127
|
+
const StripeSheet$1 = class extends HTMLElement {
|
|
4128
|
+
constructor() {
|
|
4129
|
+
super();
|
|
4130
|
+
this.__registerHost();
|
|
4131
|
+
this.__attachShadow();
|
|
4132
|
+
this.close = createEvent(this, "close", 7);
|
|
4133
|
+
/**
|
|
4134
|
+
* If true, the modal display close button
|
|
4135
|
+
*/
|
|
4136
|
+
this.showCloseButton = true;
|
|
4137
|
+
/**
|
|
4138
|
+
* Modal state.
|
|
4139
|
+
* If true, the modal will open
|
|
4140
|
+
*/
|
|
4141
|
+
this.open = false;
|
|
4142
|
+
}
|
|
4143
|
+
/**
|
|
4144
|
+
* Toggle modal state
|
|
4145
|
+
*/
|
|
4146
|
+
async toggleModal() {
|
|
4147
|
+
this.open = !this.open;
|
|
4148
|
+
if (this.open === false) {
|
|
4149
|
+
this.close.emit();
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
/**
|
|
4153
|
+
* Open the modal
|
|
4154
|
+
*/
|
|
4155
|
+
async openModal() {
|
|
4156
|
+
this.open = true;
|
|
4157
|
+
}
|
|
4158
|
+
/**
|
|
4159
|
+
* Close the modal
|
|
4160
|
+
*/
|
|
4161
|
+
async closeModal() {
|
|
4162
|
+
this.open = false;
|
|
4163
|
+
this.close.emit();
|
|
4164
|
+
}
|
|
4165
|
+
componentDidLoad() {
|
|
4166
|
+
this.el.classList.add(checkPlatform());
|
|
4167
|
+
}
|
|
4168
|
+
render() {
|
|
4169
|
+
const { open, showCloseButton } = this;
|
|
4170
|
+
return (h(Host, null, h("div", { class: `modal-row${open ? ' open' : ''}`, onClick: () => this.closeModal() }, h("div", { class: "modal-child", onClick: e => e.stopPropagation() }, showCloseButton ? (h("div", { class: "modal-close-button-wrap" }, h("ion-icon", { name: "close", size: "large", class: "modal-close-button", onClick: () => this.closeModal() }))) : null, h("slot", null)))));
|
|
4171
|
+
}
|
|
4172
|
+
get el() { return this; }
|
|
4173
|
+
static get style() { return stripeElementModalCss; }
|
|
4174
|
+
};
|
|
4175
|
+
|
|
4176
|
+
const IonIcon = /*@__PURE__*/proxyCustomElement(Icon, [1,"ion-icon",{"mode":[1025],"color":[1],"ios":[1],"md":[1],"flipRtl":[4,"flip-rtl"],"name":[513],"src":[1],"icon":[8],"size":[1],"lazy":[4],"sanitize":[4],"svgContent":[32],"isVisible":[32],"ariaLabel":[32]}]);
|
|
4177
|
+
const StripePayment = /*@__PURE__*/proxyCustomElement(StripePayment$1, [0,"stripe-payment",{"intentType":[1,"intent-type"],"zip":[4],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"showPaymentRequestButton":[4,"show-payment-request-button"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"loadStripeStatus":[32],"stripe":[32],"progress":[32],"errorMessage":[32],"zipCode":[32],"paymentRequestOption":[32]}]);
|
|
4178
|
+
const StripePaymentRequestButton = /*@__PURE__*/proxyCustomElement(StripePaymentRequestButton$1, [4,"stripe-payment-request-button",{"paymentMethodEventHandler":[16],"shippingOptionEventHandler":[16],"shippingAddressEventHandler":[16],"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"stripeDidLoaded":[1040],"loadStripeStatus":[32],"stripe":[32],"paymentRequestOption":[32]}]);
|
|
4179
|
+
const StripePaymentSheet = /*@__PURE__*/proxyCustomElement(StripePaymentSheet$1, [0,"stripe-payment-sheet",{"publishableKey":[1,"publishable-key"],"stripeAccount":[1,"stripe-account"],"applicationName":[1,"application-name"],"showLabel":[4,"show-label"],"sheetTitle":[1,"sheet-title"],"buttonLabel":[1,"button-label"],"intentClientSecret":[1,"intent-client-secret"],"shouldUseDefaultFormSubmitAction":[4,"should-use-default-form-submit-action"],"intentType":[1,"intent-type"],"handleSubmit":[1040],"stripeDidLoaded":[1040],"showCloseButton":[4,"show-close-button"],"zip":[4],"open":[4]}]);
|
|
4180
|
+
const StripeSheet = /*@__PURE__*/proxyCustomElement(StripeSheet$1, [1,"stripe-sheet",{"showCloseButton":[4,"show-close-button"],"open":[4]}]);
|
|
4181
|
+
const defineCustomElements = (opts) => {
|
|
4182
|
+
if (typeof customElements !== 'undefined') {
|
|
4183
|
+
[
|
|
4184
|
+
IonIcon,
|
|
4185
|
+
StripePayment,
|
|
4186
|
+
StripePaymentRequestButton,
|
|
4187
|
+
StripePaymentSheet,
|
|
4188
|
+
StripeSheet
|
|
4189
|
+
].forEach(cmp => {
|
|
4190
|
+
if (!customElements.get(cmp.is)) {
|
|
4191
|
+
customElements.define(cmp.is, cmp, opts);
|
|
4192
|
+
}
|
|
4193
|
+
});
|
|
4194
|
+
}
|
|
4195
|
+
};
|
|
4196
|
+
|
|
4197
|
+
export { IonIcon, StripePayment, StripePaymentRequestButton, StripePaymentSheet, StripeSheet, defineCustomElements };
|