@rebilly/instruments 7.2.0 → 7.2.1
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 +7 -0
- package/dist/index.js +78 -48
- package/dist/index.min.js +10 -10
- package/package.json +57 -57
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [7.2.1](https://github.com/Rebilly/rebilly/compare/instruments/core-v7.2.0...instruments/core-v7.2.1) (2023-10-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **instruments:** Update Framepay config to include riskMetadata option ([#1799](https://github.com/Rebilly/rebilly/issues/1799)) ([1f3d761](https://github.com/Rebilly/rebilly/commit/1f3d7613996d1d7d81218d4581c888cfe2b080f8))
|
|
7
|
+
|
|
1
8
|
## [7.2.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v7.1.0...instruments/core-v7.2.0) (2023-10-06)
|
|
2
9
|
|
|
3
10
|
|
package/dist/index.js
CHANGED
|
@@ -698,8 +698,11 @@ class Loader {
|
|
|
698
698
|
basicLoaderHTML
|
|
699
699
|
};
|
|
700
700
|
}
|
|
701
|
-
addDOMElement({
|
|
702
|
-
|
|
701
|
+
addDOMElement({
|
|
702
|
+
section = "form",
|
|
703
|
+
el = null
|
|
704
|
+
} = {}) {
|
|
705
|
+
if (isDOMElement(el) && el) {
|
|
703
706
|
el.style.position = "relative";
|
|
704
707
|
this.DOM[section] = el;
|
|
705
708
|
}
|
|
@@ -729,17 +732,21 @@ class Loader {
|
|
|
729
732
|
"afterbegin",
|
|
730
733
|
this.DOM.methodsLoaderHTML
|
|
731
734
|
);
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
+
if (rootEl) {
|
|
736
|
+
minHeight = getComputedStyle(rootEl).getPropertyValue(
|
|
737
|
+
"--rebilly-methodLoaderMinHeight"
|
|
738
|
+
);
|
|
739
|
+
}
|
|
735
740
|
} else if (section === "summary") {
|
|
736
741
|
loaderEl.insertAdjacentHTML(
|
|
737
742
|
"afterbegin",
|
|
738
743
|
this.DOM.summaryLoaderHTML
|
|
739
744
|
);
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
745
|
+
if (rootEl) {
|
|
746
|
+
minHeight = getComputedStyle(rootEl).getPropertyValue(
|
|
747
|
+
"--rebilly-summaryLoaderMinHeight"
|
|
748
|
+
);
|
|
749
|
+
}
|
|
743
750
|
}
|
|
744
751
|
} else {
|
|
745
752
|
if (id2.includes("confirmation") || id2.includes("result") || id2.includes("modal")) {
|
|
@@ -2639,7 +2646,7 @@ var lodash_kebabcase = kebabCase;
|
|
|
2639
2646
|
const kebabCase$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodash_kebabcase);
|
|
2640
2647
|
class RegisteredListeners {
|
|
2641
2648
|
constructor() {
|
|
2642
|
-
|
|
2649
|
+
this._listeners = {};
|
|
2643
2650
|
}
|
|
2644
2651
|
add(eventName, callback) {
|
|
2645
2652
|
document.addEventListener(eventName, callback, false);
|
|
@@ -2659,9 +2666,6 @@ class RegisteredListeners {
|
|
|
2659
2666
|
}
|
|
2660
2667
|
const registeredListeners = new RegisteredListeners();
|
|
2661
2668
|
class BaseEvent {
|
|
2662
|
-
/**
|
|
2663
|
-
* @param {string} name
|
|
2664
|
-
*/
|
|
2665
2669
|
constructor(name) {
|
|
2666
2670
|
const PREFIX = "rebilly-instruments-";
|
|
2667
2671
|
this.internalName = PREFIX + name;
|
|
@@ -5323,7 +5327,7 @@ function cloneArrayDeep(val, instanceClone) {
|
|
|
5323
5327
|
return res;
|
|
5324
5328
|
}
|
|
5325
5329
|
var cloneDeep_1 = cloneDeep;
|
|
5326
|
-
const version = "54.
|
|
5330
|
+
const version = "54.2.0";
|
|
5327
5331
|
let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
5328
5332
|
let nanoid = (size2 = 21) => {
|
|
5329
5333
|
let id2 = "";
|
|
@@ -10573,35 +10577,51 @@ async function fetchProductsFromPlans() {
|
|
|
10573
10577
|
return [];
|
|
10574
10578
|
});
|
|
10575
10579
|
}
|
|
10576
|
-
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
10580
|
+
function parsePrice(price) {
|
|
10581
|
+
if (price == null) {
|
|
10582
|
+
return null;
|
|
10583
|
+
}
|
|
10584
|
+
if (typeof price === "string") {
|
|
10585
|
+
return !Number.isNaN(parseFloat(price)) ? parseFloat(price) : null;
|
|
10580
10586
|
}
|
|
10587
|
+
return price;
|
|
10581
10588
|
}
|
|
10582
|
-
|
|
10589
|
+
class PlanPricingBracketModel {
|
|
10583
10590
|
constructor({
|
|
10584
|
-
formula = _PlanPricingModel.Formulas.fixedFee,
|
|
10585
|
-
price = 0,
|
|
10586
10591
|
maxQuantity = null,
|
|
10587
|
-
|
|
10592
|
+
price = null
|
|
10588
10593
|
} = {}) {
|
|
10589
|
-
this.
|
|
10590
|
-
|
|
10594
|
+
this.maxQuantity = maxQuantity || Number.MAX_SAFE_INTEGER;
|
|
10595
|
+
this.price = parsePrice(price);
|
|
10596
|
+
}
|
|
10597
|
+
}
|
|
10598
|
+
const _PlanPricingModel = class _PlanPricingModel {
|
|
10599
|
+
// {
|
|
10600
|
+
// formula = PlanPricingModel.Formulas.fixedFee,
|
|
10601
|
+
// price = 0,
|
|
10602
|
+
// maxQuantity = null,
|
|
10603
|
+
// brackets = [],
|
|
10604
|
+
// }
|
|
10605
|
+
constructor(data2 = {}) {
|
|
10606
|
+
this.formula = data2.formula ?? _PlanPricingModel.Formulas.fixedFee;
|
|
10607
|
+
switch (data2.formula) {
|
|
10591
10608
|
case _PlanPricingModel.Formulas.stairstep:
|
|
10592
10609
|
case _PlanPricingModel.Formulas.tiered:
|
|
10593
10610
|
case _PlanPricingModel.Formulas.volume:
|
|
10594
|
-
|
|
10611
|
+
if (data2.brackets == null) {
|
|
10612
|
+
throw new Error("Invalid brackets.");
|
|
10613
|
+
}
|
|
10614
|
+
this.brackets = data2.brackets.map(
|
|
10595
10615
|
(bracket) => new PlanPricingBracketModel(bracket)
|
|
10596
10616
|
);
|
|
10597
10617
|
break;
|
|
10598
10618
|
case _PlanPricingModel.Formulas.flatRate:
|
|
10599
|
-
this.price =
|
|
10600
|
-
this.maxQuantity = maxQuantity;
|
|
10619
|
+
this.price = parsePrice(data2.price) ?? 0;
|
|
10620
|
+
this.maxQuantity = data2.maxQuantity ?? null;
|
|
10601
10621
|
break;
|
|
10602
10622
|
case _PlanPricingModel.Formulas.fixedFee:
|
|
10603
10623
|
default:
|
|
10604
|
-
this.price =
|
|
10624
|
+
this.price = parsePrice(data2.price) ?? 0;
|
|
10605
10625
|
break;
|
|
10606
10626
|
}
|
|
10607
10627
|
}
|
|
@@ -10623,19 +10643,19 @@ const _PlanPricingModel = class _PlanPricingModel {
|
|
|
10623
10643
|
};
|
|
10624
10644
|
}
|
|
10625
10645
|
};
|
|
10626
|
-
|
|
10646
|
+
_PlanPricingModel.SimpleFormulas = {
|
|
10627
10647
|
fixedFee: "fixed-fee",
|
|
10628
10648
|
flatRate: "flat-rate"
|
|
10629
|
-
}
|
|
10630
|
-
|
|
10649
|
+
};
|
|
10650
|
+
_PlanPricingModel.BracketFormulas = {
|
|
10631
10651
|
stairstep: "stairstep",
|
|
10632
10652
|
tiered: "tiered",
|
|
10633
10653
|
volume: "volume"
|
|
10634
|
-
}
|
|
10635
|
-
|
|
10654
|
+
};
|
|
10655
|
+
_PlanPricingModel.Formulas = {
|
|
10636
10656
|
..._PlanPricingModel.SimpleFormulas,
|
|
10637
10657
|
..._PlanPricingModel.BracketFormulas
|
|
10638
|
-
}
|
|
10658
|
+
};
|
|
10639
10659
|
let PlanPricingModel = _PlanPricingModel;
|
|
10640
10660
|
class PlanModel extends BaseModel {
|
|
10641
10661
|
constructor(fields = {}) {
|
|
@@ -13869,7 +13889,7 @@ class PaymentMetadataModel extends BaseModel {
|
|
|
13869
13889
|
return this.landscapeLogo || this.portraitLogo;
|
|
13870
13890
|
}
|
|
13871
13891
|
}
|
|
13872
|
-
class
|
|
13892
|
+
const _ReadyToPayFeatureModel = class _ReadyToPayFeatureModel {
|
|
13873
13893
|
constructor({
|
|
13874
13894
|
name = "",
|
|
13875
13895
|
expirationTime = "",
|
|
@@ -13897,12 +13917,13 @@ class ReadyToPayFeatureModel {
|
|
|
13897
13917
|
this.paypalClientId = paypalClientId;
|
|
13898
13918
|
this.linkToken = linkToken;
|
|
13899
13919
|
}
|
|
13900
|
-
}
|
|
13901
|
-
|
|
13920
|
+
};
|
|
13921
|
+
_ReadyToPayFeatureModel.FeatureName = {
|
|
13902
13922
|
paypalBillingAgreement: "PayPal billing agreement",
|
|
13903
13923
|
googlePay: "Google Pay",
|
|
13904
13924
|
applePay: "Apple Pay"
|
|
13905
|
-
}
|
|
13925
|
+
};
|
|
13926
|
+
let ReadyToPayFeatureModel = _ReadyToPayFeatureModel;
|
|
13906
13927
|
class ReadyToPayModel {
|
|
13907
13928
|
constructor({
|
|
13908
13929
|
index: index2 = null,
|
|
@@ -14003,7 +14024,7 @@ const _InvoiceModel = class _InvoiceModel extends BaseModel {
|
|
|
14003
14024
|
return this.status === _InvoiceModel.Status.paid;
|
|
14004
14025
|
}
|
|
14005
14026
|
};
|
|
14006
|
-
|
|
14027
|
+
_InvoiceModel.Status = {
|
|
14007
14028
|
draft: "draft",
|
|
14008
14029
|
unpaid: "unpaid",
|
|
14009
14030
|
paid: "paid",
|
|
@@ -14014,7 +14035,7 @@ __publicField(_InvoiceModel, "Status", {
|
|
|
14014
14035
|
partiallyRefunded: "partially-refunded",
|
|
14015
14036
|
refunded: "refunded",
|
|
14016
14037
|
disputed: "disputed"
|
|
14017
|
-
}
|
|
14038
|
+
};
|
|
14018
14039
|
let InvoiceModel = _InvoiceModel;
|
|
14019
14040
|
async function fetchInvoiceAndProducts({ data: data2 = null }) {
|
|
14020
14041
|
return Endpoint(async () => {
|
|
@@ -14039,7 +14060,7 @@ class TransactionModel extends BaseModel {
|
|
|
14039
14060
|
return this.invoiceIds[0] || null;
|
|
14040
14061
|
}
|
|
14041
14062
|
get hasInvoice() {
|
|
14042
|
-
return
|
|
14063
|
+
return Boolean(this.invoiceId);
|
|
14043
14064
|
}
|
|
14044
14065
|
}
|
|
14045
14066
|
async function fetchTransaction({ data: data2 = null }) {
|
|
@@ -14135,7 +14156,13 @@ class DepositRequestModel extends BaseModel {
|
|
|
14135
14156
|
constructor(fields) {
|
|
14136
14157
|
super(fields);
|
|
14137
14158
|
this.amount = Array.isArray(fields.amounts) ? fields.amounts[0] : fields.amount;
|
|
14138
|
-
|
|
14159
|
+
if (fields.buttons) {
|
|
14160
|
+
this.buttons = fields.buttons;
|
|
14161
|
+
} else if (fields.amounts) {
|
|
14162
|
+
this.buttons = [...fields.amounts];
|
|
14163
|
+
} else {
|
|
14164
|
+
this.buttons = [];
|
|
14165
|
+
}
|
|
14139
14166
|
this.editable = typeof fields.editable === "boolean" ? fields.editable : Boolean(fields.customAmount);
|
|
14140
14167
|
this.customAmount = merge$1(
|
|
14141
14168
|
{
|
|
@@ -14455,6 +14482,9 @@ function generateFramepayConfig({ methodIds } = {}) {
|
|
|
14455
14482
|
config.jwt = options.jwt;
|
|
14456
14483
|
config.sandbox = options.apiMode === "sandbox";
|
|
14457
14484
|
}
|
|
14485
|
+
if (data2.riskMetadata) {
|
|
14486
|
+
config.riskMetadata = data2.riskMetadata;
|
|
14487
|
+
}
|
|
14458
14488
|
return config;
|
|
14459
14489
|
}
|
|
14460
14490
|
const getMethodData = (method) => {
|
|
@@ -14545,14 +14575,14 @@ async function mountExpressMethods({ methods, container }) {
|
|
|
14545
14575
|
events.instrumentReady.dispatch(instrumentReadyPayload);
|
|
14546
14576
|
});
|
|
14547
14577
|
}
|
|
14548
|
-
function formatCurrency(number2, currency) {
|
|
14549
|
-
const
|
|
14550
|
-
if (Number.isNaN(
|
|
14578
|
+
function formatCurrency(number2, currency = "USD") {
|
|
14579
|
+
const numberValue = Number(number2);
|
|
14580
|
+
if (Number.isNaN(numberValue) || number2 == null)
|
|
14551
14581
|
return "-";
|
|
14552
14582
|
return new Intl.NumberFormat("en-US", {
|
|
14553
14583
|
style: "currency",
|
|
14554
|
-
currency
|
|
14555
|
-
}).format(
|
|
14584
|
+
currency
|
|
14585
|
+
}).format(numberValue);
|
|
14556
14586
|
}
|
|
14557
14587
|
function lineItem({ offer }) {
|
|
14558
14588
|
const plan = state.data.plans.find((item) => item.id === offer.planId);
|
|
@@ -22646,7 +22676,7 @@ ${displayNode}`
|
|
|
22646
22676
|
function handleComputedProperty(options) {
|
|
22647
22677
|
var _a;
|
|
22648
22678
|
options._computed = {
|
|
22649
|
-
version: "7.
|
|
22679
|
+
version: "7.2.0",
|
|
22650
22680
|
paymentMethodsUrl: ((_a = options._dev) == null ? void 0 : _a.paymentMethodsUrl) ?? "https://forms.secure-payments.app"
|
|
22651
22681
|
};
|
|
22652
22682
|
return options;
|
|
@@ -25774,7 +25804,7 @@ class RebillyInstrumentsInstance {
|
|
|
25774
25804
|
await show({ componentName, payload });
|
|
25775
25805
|
}
|
|
25776
25806
|
get version() {
|
|
25777
|
-
return `RebillyInstruments Ver.${"7.
|
|
25807
|
+
return `RebillyInstruments Ver.${"7.2.0"}`;
|
|
25778
25808
|
}
|
|
25779
25809
|
on(eventName, callback) {
|
|
25780
25810
|
on({ eventName, callback });
|