@rebilly/instruments 8.12.1 → 8.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.js +59 -36
- package/dist/index.min.js +6 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [8.14.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.13.0...instruments/core-v8.14.0) (2023-12-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **api-metadata:** Update resources based on latest api definitions ([#2613](https://github.com/Rebilly/rebilly/issues/2613)) ([78c878c](https://github.com/Rebilly/rebilly/commit/78c878c0e1c96b533698226360a89d9453e72ef9))
|
|
7
|
+
|
|
8
|
+
## [8.13.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.12.1...instruments/core-v8.13.0) (2023-12-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **instruments:** Allow instruments to work on a web component (shadow DOM) ([#2612](https://github.com/Rebilly/rebilly/issues/2612)) ([0f3ded2](https://github.com/Rebilly/rebilly/commit/0f3ded2d229a82c08bb6505243eff3257eced796))
|
|
14
|
+
|
|
1
15
|
## [8.12.1](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.12.0...instruments/core-v8.12.1) (2023-12-15)
|
|
2
16
|
|
|
3
17
|
## [8.12.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.11.0...instruments/core-v8.12.0) (2023-12-14)
|
package/dist/index.js
CHANGED
|
@@ -702,17 +702,17 @@ class Loader {
|
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
704
|
startLoading({ section = "form", id: id2 = "" } = {}) {
|
|
705
|
-
var _a, _b;
|
|
705
|
+
var _a, _b, _c;
|
|
706
706
|
this[section].push(id2);
|
|
707
|
-
const rootEl = document.querySelector(":root");
|
|
707
|
+
const rootEl = ((_a = state.shadowRoot) == null ? void 0 : _a.querySelector("style")) || document.querySelector(":root");
|
|
708
708
|
const contentPadding = 2;
|
|
709
709
|
let minHeight = "240px";
|
|
710
|
-
if ((
|
|
710
|
+
if ((_b = this.DOM) == null ? void 0 : _b[section]) {
|
|
711
711
|
let loaderEl = this.DOM[section].querySelector(
|
|
712
712
|
".rebilly-instruments-loader"
|
|
713
713
|
);
|
|
714
714
|
const { padding, paddingTop, paddingBottom } = getComputedStyle(
|
|
715
|
-
(
|
|
715
|
+
(_c = this.DOM) == null ? void 0 : _c[section]
|
|
716
716
|
);
|
|
717
717
|
if (!loaderEl) {
|
|
718
718
|
this.DOM[section].innerHTML = loaderContainer(
|
|
@@ -1542,16 +1542,14 @@ class Translate {
|
|
|
1542
1542
|
this.languages = { ...en$1, ...es$1 };
|
|
1543
1543
|
}
|
|
1544
1544
|
init(locale, messages) {
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
);
|
|
1545
|
+
const root2 = state.shadowRoot || document;
|
|
1546
|
+
this.items = Array.from(root2.querySelectorAll("[data-rebilly-i18n]"));
|
|
1548
1547
|
this.locale = this.getLocale(locale);
|
|
1549
1548
|
this.languages = merge$1({}, { ...en$1, ...es$1 }, messages);
|
|
1550
1549
|
}
|
|
1551
1550
|
translateItems() {
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
);
|
|
1551
|
+
const root2 = state.shadowRoot || document;
|
|
1552
|
+
this.items = Array.from(root2.querySelectorAll("[data-rebilly-i18n]"));
|
|
1555
1553
|
if (this.locale in this.languages) {
|
|
1556
1554
|
return this.items.forEach((item) => {
|
|
1557
1555
|
const translate = this.getTranslation(
|
|
@@ -1644,6 +1642,7 @@ const state = (() => {
|
|
|
1644
1642
|
loader: new Loader(),
|
|
1645
1643
|
translate: new Translate(),
|
|
1646
1644
|
hasMounted: false,
|
|
1645
|
+
shadowRoot: null,
|
|
1647
1646
|
toModel() {
|
|
1648
1647
|
var _a;
|
|
1649
1648
|
const model = {
|
|
@@ -2796,15 +2795,21 @@ const errorTemplate = (error2) => {
|
|
|
2796
2795
|
</div>`;
|
|
2797
2796
|
};
|
|
2798
2797
|
function clearError() {
|
|
2799
|
-
|
|
2798
|
+
var _a;
|
|
2799
|
+
const errorContainer = (_a = state.form) == null ? void 0 : _a.querySelector(
|
|
2800
|
+
"#rebilly-instruments-error"
|
|
2801
|
+
);
|
|
2800
2802
|
if (!errorContainer)
|
|
2801
2803
|
return;
|
|
2802
2804
|
errorContainer.innerHTML = "";
|
|
2803
2805
|
}
|
|
2804
2806
|
function showError(error2, isCloseable = true) {
|
|
2807
|
+
var _a;
|
|
2805
2808
|
if (!error2)
|
|
2806
2809
|
return;
|
|
2807
|
-
const errorContainer =
|
|
2810
|
+
const errorContainer = (_a = state.form) == null ? void 0 : _a.querySelector(
|
|
2811
|
+
"#rebilly-instruments-error"
|
|
2812
|
+
);
|
|
2808
2813
|
if (!errorContainer)
|
|
2809
2814
|
return;
|
|
2810
2815
|
errorContainer.innerHTML = errorTemplate(error2);
|
|
@@ -2822,7 +2827,7 @@ function showError(error2, isCloseable = true) {
|
|
|
2822
2827
|
}
|
|
2823
2828
|
});
|
|
2824
2829
|
}
|
|
2825
|
-
const closeButton =
|
|
2830
|
+
const closeButton = state.form.querySelector(
|
|
2826
2831
|
".rebilly-instruments-error-card-close-button"
|
|
2827
2832
|
);
|
|
2828
2833
|
if (isCloseable) {
|
|
@@ -2830,7 +2835,7 @@ function showError(error2, isCloseable = true) {
|
|
|
2830
2835
|
window.addEventListener("click", clickOutsideError);
|
|
2831
2836
|
window.addEventListener("blur", windowBlur, { once: true });
|
|
2832
2837
|
} else {
|
|
2833
|
-
const errorBox =
|
|
2838
|
+
const errorBox = state.form.querySelector(
|
|
2834
2839
|
".rebilly-instruments-error-card"
|
|
2835
2840
|
);
|
|
2836
2841
|
errorBox.classList.add("not-closeable");
|
|
@@ -5983,7 +5988,7 @@ function cloneArrayDeep(val, instanceClone) {
|
|
|
5983
5988
|
return res;
|
|
5984
5989
|
}
|
|
5985
5990
|
var cloneDeep_1 = cloneDeep;
|
|
5986
|
-
const version = "55.9.
|
|
5991
|
+
const version = "55.9.1";
|
|
5987
5992
|
let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
5988
5993
|
let nanoid = (size2 = 21) => {
|
|
5989
5994
|
let id2 = "";
|
|
@@ -14656,11 +14661,11 @@ async function fetchData({
|
|
|
14656
14661
|
}
|
|
14657
14662
|
function mountExpressMethod({ state: state2, id: id2 }) {
|
|
14658
14663
|
const { Rebilly } = window;
|
|
14659
|
-
const container =
|
|
14664
|
+
const container = state2.form.querySelector(
|
|
14660
14665
|
`.rebilly-instruments-${id2}-method`
|
|
14661
14666
|
);
|
|
14662
14667
|
function updateApplePayStyling() {
|
|
14663
|
-
const applePayButton =
|
|
14668
|
+
const applePayButton = state2.form.querySelector(
|
|
14664
14669
|
"#rebilly-apple-pay-button"
|
|
14665
14670
|
);
|
|
14666
14671
|
const {
|
|
@@ -14678,10 +14683,11 @@ function mountExpressMethod({ state: state2, id: id2 }) {
|
|
|
14678
14683
|
"pay-pal-billing-agreement": "paypal",
|
|
14679
14684
|
"apple-pay": "applePay"
|
|
14680
14685
|
};
|
|
14686
|
+
const element = state2.form.querySelector(
|
|
14687
|
+
`.rebilly-instruments-${id2}-method`
|
|
14688
|
+
);
|
|
14681
14689
|
if (rebillyMountFunction[id2]) {
|
|
14682
|
-
Rebilly[rebillyMountFunction[id2]].mount(
|
|
14683
|
-
`.rebilly-instruments-${id2}-method`
|
|
14684
|
-
);
|
|
14690
|
+
Rebilly[rebillyMountFunction[id2]].mount(element);
|
|
14685
14691
|
if (id2 === "apple-pay") {
|
|
14686
14692
|
updateApplePayStyling();
|
|
14687
14693
|
}
|
|
@@ -15124,7 +15130,7 @@ async function mountMethodSelector() {
|
|
|
15124
15130
|
state.options.digitalWallet = generateDigitalWallet({
|
|
15125
15131
|
expressMethods
|
|
15126
15132
|
});
|
|
15127
|
-
const container =
|
|
15133
|
+
const container = state.form.querySelector(
|
|
15128
15134
|
'[data-rebilly-instruments="express-methods-container"]'
|
|
15129
15135
|
);
|
|
15130
15136
|
mountExpressMethods({
|
|
@@ -15187,7 +15193,7 @@ const baseMethodSelectorHTML = () => `
|
|
|
15187
15193
|
async function mountForm() {
|
|
15188
15194
|
var _a;
|
|
15189
15195
|
state.form.innerHTML += baseMethodSelectorHTML();
|
|
15190
|
-
const container =
|
|
15196
|
+
const container = state.form.querySelector(
|
|
15191
15197
|
'[data-rebilly-instruments="form"]'
|
|
15192
15198
|
);
|
|
15193
15199
|
const { paymentMethodsUrl: url } = ((_a = state == null ? void 0 : state.options) == null ? void 0 : _a._computed) || {};
|
|
@@ -15221,7 +15227,7 @@ function determineFirstView() {
|
|
|
15221
15227
|
}
|
|
15222
15228
|
}
|
|
15223
15229
|
function removeForm() {
|
|
15224
|
-
const container =
|
|
15230
|
+
const container = state.form.querySelector(
|
|
15225
15231
|
'[data-rebilly-instruments="form"]'
|
|
15226
15232
|
);
|
|
15227
15233
|
container.remove();
|
|
@@ -15241,9 +15247,11 @@ function addDOMElement({
|
|
|
15241
15247
|
if (content2) {
|
|
15242
15248
|
ELEMENT.innerHTML = content2;
|
|
15243
15249
|
}
|
|
15244
|
-
|
|
15245
|
-
ELEMENT
|
|
15246
|
-
|
|
15250
|
+
if (target instanceof ShadowRoot) {
|
|
15251
|
+
target.prepend(ELEMENT);
|
|
15252
|
+
} else {
|
|
15253
|
+
document[target][insertMethod](ELEMENT);
|
|
15254
|
+
}
|
|
15247
15255
|
}
|
|
15248
15256
|
function hasValidCSSSelector(selector) {
|
|
15249
15257
|
const REGEX_CSS_SELECTOR = /([.#][_a-z]+[_a-z0-9-:\\]*)/gi;
|
|
@@ -15282,7 +15290,7 @@ function sleep(ms) {
|
|
|
15282
15290
|
const setupElement = ({ element = "" }) => {
|
|
15283
15291
|
const { options } = state;
|
|
15284
15292
|
if (element !== "form" && element !== "summary") {
|
|
15285
|
-
throw new Error('element must be "form" or "summary"');
|
|
15293
|
+
throw new Error('element must be "form", or "summary"');
|
|
15286
15294
|
}
|
|
15287
15295
|
const getProp = () => {
|
|
15288
15296
|
if (options != null && options[element]) {
|
|
@@ -23288,7 +23296,7 @@ function handleComputedProperty(options) {
|
|
|
23288
23296
|
var _a;
|
|
23289
23297
|
return Object.assign({}, options, {
|
|
23290
23298
|
_computed: {
|
|
23291
|
-
version: "8.
|
|
23299
|
+
version: "8.13.0",
|
|
23292
23300
|
paymentMethodsUrl: ((_a = options._dev) == null ? void 0 : _a.paymentMethodsUrl) ?? "https://forms.secure-payments.app"
|
|
23293
23301
|
}
|
|
23294
23302
|
});
|
|
@@ -25022,7 +25030,7 @@ let Theme = _Theme;
|
|
|
25022
25030
|
const vars = (theme2) => `
|
|
25023
25031
|
/* Instruments 'global' variables
|
|
25024
25032
|
------------------------------------------------------------ */
|
|
25025
|
-
:root {
|
|
25033
|
+
:root, :host {
|
|
25026
25034
|
${theme2.cssVars}
|
|
25027
25035
|
|
|
25028
25036
|
--rebilly-fontWeight400: 400;
|
|
@@ -25175,6 +25183,12 @@ const vars = (theme2) => `
|
|
|
25175
25183
|
border-radius: 100px;
|
|
25176
25184
|
}
|
|
25177
25185
|
|
|
25186
|
+
.rebilly-instruments-express-methods .rebilly-instruments-google-pay-method iframe {
|
|
25187
|
+
width: 100%;
|
|
25188
|
+
height: 100%;
|
|
25189
|
+
border: none;
|
|
25190
|
+
}
|
|
25191
|
+
|
|
25178
25192
|
@media (max-width: 600px) {
|
|
25179
25193
|
.rebilly-instruments-express-methods.is-compact .rebilly-instruments-express-methods-container {
|
|
25180
25194
|
-webkit-box-orient: vertical;
|
|
@@ -25731,14 +25745,14 @@ const setupStylesVars = () => {
|
|
|
25731
25745
|
element: "style",
|
|
25732
25746
|
attributes: { type: "text/css" },
|
|
25733
25747
|
content: minifyCss(styleVars),
|
|
25734
|
-
target: "head"
|
|
25748
|
+
target: state.shadowRoot || "head"
|
|
25735
25749
|
});
|
|
25736
25750
|
if (css) {
|
|
25737
25751
|
addDOMElement({
|
|
25738
25752
|
element: "style",
|
|
25739
25753
|
attributes: { type: "text/css" },
|
|
25740
25754
|
content: minifyCss(css),
|
|
25741
|
-
target: "head"
|
|
25755
|
+
target: state.shadowRoot || "head"
|
|
25742
25756
|
});
|
|
25743
25757
|
}
|
|
25744
25758
|
return styleVars;
|
|
@@ -25888,16 +25902,16 @@ async function mountModal({
|
|
|
25888
25902
|
"beforeend",
|
|
25889
25903
|
modalTemplate(isRedirect, method)
|
|
25890
25904
|
);
|
|
25891
|
-
const modalOverlay =
|
|
25905
|
+
const modalOverlay = state.form.querySelector(
|
|
25892
25906
|
".rebilly-instruments-modal-overlay"
|
|
25893
25907
|
);
|
|
25894
|
-
const modalContainer =
|
|
25908
|
+
const modalContainer = state.form.querySelector(
|
|
25895
25909
|
".rebilly-instruments-modal-container"
|
|
25896
25910
|
);
|
|
25897
|
-
const closeButton =
|
|
25911
|
+
const closeButton = state.form.querySelector(
|
|
25898
25912
|
".rebilly-instruments-modal-close"
|
|
25899
25913
|
);
|
|
25900
|
-
const modalContent =
|
|
25914
|
+
const modalContent = state.form.querySelector(
|
|
25901
25915
|
".rebilly-instruments-modal-content"
|
|
25902
25916
|
);
|
|
25903
25917
|
document.body.style.overflow = "hidden";
|
|
@@ -26345,6 +26359,14 @@ const setupUserFlow = ({ state: state2 = {} }) => {
|
|
|
26345
26359
|
});
|
|
26346
26360
|
}
|
|
26347
26361
|
};
|
|
26362
|
+
function getShadowParent(element) {
|
|
26363
|
+
while (element.parentNode && (element = element.parentNode)) {
|
|
26364
|
+
if (element instanceof ShadowRoot) {
|
|
26365
|
+
return element;
|
|
26366
|
+
}
|
|
26367
|
+
}
|
|
26368
|
+
return null;
|
|
26369
|
+
}
|
|
26348
26370
|
async function mount({
|
|
26349
26371
|
setupFramepay: setupFramepay$1 = setupFramepay,
|
|
26350
26372
|
...options
|
|
@@ -26356,6 +26378,7 @@ async function mount({
|
|
|
26356
26378
|
state.options = setupOptions({ options });
|
|
26357
26379
|
state.form = setupElement({ element: "form" });
|
|
26358
26380
|
state.summary = setupElement({ element: "summary" });
|
|
26381
|
+
state.shadowRoot = getShadowParent(state.form);
|
|
26359
26382
|
if (state.form) {
|
|
26360
26383
|
state.form.style.maxWidth = "750px";
|
|
26361
26384
|
}
|
|
@@ -26477,7 +26500,7 @@ class RebillyInstrumentsInstance {
|
|
|
26477
26500
|
await show({ componentName, payload });
|
|
26478
26501
|
}
|
|
26479
26502
|
get version() {
|
|
26480
|
-
return `RebillyInstruments Ver.${"8.
|
|
26503
|
+
return `RebillyInstruments Ver.${"8.13.0"}`;
|
|
26481
26504
|
}
|
|
26482
26505
|
on(eventName, callback) {
|
|
26483
26506
|
on({ eventName, callback });
|