@rebilly/instruments 8.18.0 → 8.19.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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [8.19.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.18.1...instruments/core-v8.19.0) (2024-01-08)
2
+
3
+
4
+ ### Features
5
+
6
+ * **instruments:** Add re-attempt button for declined transactions ([#2754](https://github.com/Rebilly/rebilly/issues/2754)) ([5f159b9](https://github.com/Rebilly/rebilly/commit/5f159b9a8c5782669484b957ba6d48343c2bdd33))
7
+
8
+ ## [8.18.1](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.18.0...instruments/core-v8.18.1) (2024-01-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **instruments:** Prevent event listeners from being attached multiple times ([#2766](https://github.com/Rebilly/rebilly/issues/2766)) ([e352f94](https://github.com/Rebilly/rebilly/commit/e352f9403bcb0dbcd4772044999a183f066f508a))
14
+
1
15
  ## [8.18.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.17.1...instruments/core-v8.18.0) (2024-01-05)
2
16
 
3
17
 
package/dist/index.js CHANGED
@@ -5987,7 +5987,7 @@ function cloneArrayDeep(val, instanceClone) {
5987
5987
  return res;
5988
5988
  }
5989
5989
  var cloneDeep_1 = cloneDeep;
5990
- const version = "55.9.2";
5990
+ const version = "55.10.0";
5991
5991
  let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
5992
5992
  let nanoid = (size2 = 21) => {
5993
5993
  let id2 = "";
@@ -14994,8 +14994,7 @@ async function mountAmountSelector() {
14994
14994
  const modelSafeState = state.toModel();
14995
14995
  const model = {
14996
14996
  options: modelSafeState.options,
14997
- data: modelSafeState.data,
14998
- mainStyleVars: modelSafeState.mainStyleVars
14997
+ data: modelSafeState.data
14999
14998
  };
15000
14999
  (_a = iframe.component) == null ? void 0 : _a.call("route", {
15001
15000
  name: "amount-selector"
@@ -15105,7 +15104,7 @@ const expressMethodsElement = ({ expressMethods }) => {
15105
15104
  return rootDiv;
15106
15105
  };
15107
15106
  async function mountMethodSelector() {
15108
- var _a, _b, _c, _d, _e, _f;
15107
+ var _a, _b, _c, _d, _e, _f, _g, _h;
15109
15108
  const contentEl = getElement("content");
15110
15109
  const formEl = getElement("form");
15111
15110
  const { expressMethods, methods } = getPaymentMethods();
@@ -15159,19 +15158,20 @@ async function mountMethodSelector() {
15159
15158
  const modelSafeState = state.toModel();
15160
15159
  const model = {
15161
15160
  options: modelSafeState.options,
15162
- data: modelSafeState.data,
15163
- mainStyleVars: modelSafeState.mainStyleVars
15161
+ data: modelSafeState.data
15164
15162
  };
15165
15163
  (_d = iframe == null ? void 0 : iframe.component) == null ? void 0 : _d.call("route", {
15166
15164
  name: "method-switch"
15167
15165
  });
15168
15166
  (_e = iframe == null ? void 0 : iframe.component) == null ? void 0 : _e.call("update", model);
15169
- (_f = iframe == null ? void 0 : iframe.component) == null ? void 0 : _f.on("choose-another-method", () => {
15170
- if (state.data.isPurchase) {
15171
- updateSummary();
15172
- }
15173
- mountMethodSelector();
15174
- });
15167
+ if (!((_g = (_f = iframe == null ? void 0 : iframe.component) == null ? void 0 : _f.events) == null ? void 0 : _g["restart-payment-flow"])) {
15168
+ (_h = iframe == null ? void 0 : iframe.component) == null ? void 0 : _h.on("restart-payment-flow", () => {
15169
+ if (state.data.isPurchase) {
15170
+ updateSummary();
15171
+ }
15172
+ mountMethodSelector();
15173
+ });
15174
+ }
15175
15175
  } else {
15176
15176
  state.loader.stopLoading({ id: "rebilly-instruments-form" });
15177
15177
  state.form.querySelector(
@@ -23295,7 +23295,7 @@ function handleComputedProperty(options) {
23295
23295
  var _a;
23296
23296
  return Object.assign({}, options, {
23297
23297
  _computed: {
23298
- version: "8.17.1",
23298
+ version: "8.18.1",
23299
23299
  paymentMethodsUrl: ((_a = options._dev) == null ? void 0 : _a.paymentMethodsUrl) ?? "https://forms.secure-payments.app"
23300
23300
  }
23301
23301
  });
@@ -26228,7 +26228,7 @@ async function setup({ payload }) {
26228
26228
  }
26229
26229
  }
26230
26230
  async function mountConfirmation({ payload: instrument }) {
26231
- var _a, _b, _c, _d;
26231
+ var _a, _b, _c, _d, _e, _f, _g, _h;
26232
26232
  if (instrument.billingAddress && state.summary && state.data.isPurchase) {
26233
26233
  updateSummary({ instrument });
26234
26234
  }
@@ -26240,25 +26240,28 @@ async function mountConfirmation({ payload: instrument }) {
26240
26240
  const model = {
26241
26241
  options: modelSafeState.options,
26242
26242
  data: modelSafeState.data,
26243
- mainStyleVars: modelSafeState.mainStyleVars,
26244
26243
  instrument
26245
26244
  };
26246
26245
  (_a = iframe == null ? void 0 : iframe.component) == null ? void 0 : _a.call("update", model);
26247
26246
  (_b = iframe == null ? void 0 : iframe.component) == null ? void 0 : _b.call("route", {
26248
26247
  name: "confirmation"
26249
26248
  });
26250
- (_c = iframe == null ? void 0 : iframe.component) == null ? void 0 : _c.on(
26251
- `${iframe.name}-confirm-purchase`,
26252
- (confirmedInstrument) => {
26253
- purchase({ payload: confirmedInstrument });
26254
- }
26255
- );
26256
- (_d = iframe == null ? void 0 : iframe.component) == null ? void 0 : _d.on(
26257
- `${iframe.name}-confirm-setup`,
26258
- (confirmedInstrument) => {
26259
- setup({ payload: confirmedInstrument });
26260
- }
26261
- );
26249
+ if (!((_d = (_c = iframe == null ? void 0 : iframe.component) == null ? void 0 : _c.events) == null ? void 0 : _d[`${iframe.name}-confirm-purchase`])) {
26250
+ (_e = iframe == null ? void 0 : iframe.component) == null ? void 0 : _e.on(
26251
+ `${iframe.name}-confirm-purchase`,
26252
+ (confirmedInstrument) => {
26253
+ purchase({ payload: confirmedInstrument });
26254
+ }
26255
+ );
26256
+ }
26257
+ if (!((_g = (_f = iframe == null ? void 0 : iframe.component) == null ? void 0 : _f.events) == null ? void 0 : _g[`${iframe.name}-confirm-setup`])) {
26258
+ (_h = iframe == null ? void 0 : iframe.component) == null ? void 0 : _h.on(
26259
+ `${iframe.name}-confirm-setup`,
26260
+ (confirmedInstrument) => {
26261
+ setup({ payload: confirmedInstrument });
26262
+ }
26263
+ );
26264
+ }
26262
26265
  }
26263
26266
  async function mountResult({ payload }) {
26264
26267
  var _a, _b;
@@ -26269,8 +26272,7 @@ async function mountResult({ payload }) {
26269
26272
  const modelSafeState = state.toModel();
26270
26273
  const model = {
26271
26274
  data: modelSafeState.data,
26272
- options: modelSafeState.options,
26273
- mainStyleVars: modelSafeState.mainStyleVars
26275
+ options: modelSafeState.options
26274
26276
  };
26275
26277
  if (state.data.payout) {
26276
26278
  model.payoutRequest = payload;
@@ -26456,7 +26458,7 @@ async function destroy() {
26456
26458
  cancellation.cancelAll();
26457
26459
  state.loader.clearAll();
26458
26460
  }
26459
- async function update({ newOptions = {} }) {
26461
+ async function update({ newOptions = {} } = {}) {
26460
26462
  if (!state.hasMounted) {
26461
26463
  throw Error(
26462
26464
  "Update method cannot be called before mounting instruments"
@@ -26494,7 +26496,7 @@ class RebillyInstrumentsInstance {
26494
26496
  await show({ componentName, payload });
26495
26497
  }
26496
26498
  get version() {
26497
- return `RebillyInstruments Ver.${"8.17.1"}`;
26499
+ return `RebillyInstruments Ver.${"8.18.1"}`;
26498
26500
  }
26499
26501
  on(eventName, callback) {
26500
26502
  on({ eventName, callback });