@rebilly/instruments 9.66.4 → 9.67.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 +1,6 @@
1
- ## [9.66.4](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.66.3...instruments/core-v9.66.4) (2024-07-15)
1
+ ## [9.67.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.66.5...instruments/core-v9.67.0) (2024-07-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * **instruments:** Allow config to split payment card fields ([#6541](https://github.com/Rebilly/rebilly/issues/6541)) ([89083e8](https://github.com/Rebilly/rebilly/commit/89083e8c73e9459fa7986f83daa3c29db7fbfb75))
package/dist/index.d.ts CHANGED
@@ -225,8 +225,12 @@ export interface PaymentInstrumentsOptionFlags {
225
225
  allowMakeDefault?: boolean;
226
226
  allowCreate?: boolean;
227
227
  }
228
+ export interface PaymentCardConfiguration {
229
+ input?: "default" | "split";
230
+ }
228
231
  export interface PaymentInstrumentsDisplayOptions extends PaymentInstrumentsOptionFlags {
229
232
  address?: Address;
233
+ paymentCard?: PaymentCardConfiguration;
230
234
  paypal?: {
231
235
  buttonHeight?: number;
232
236
  };
package/dist/index.js CHANGED
@@ -16926,7 +16926,7 @@ function mountExpressMethod({ state: state2, id: id2 }) {
16926
16926
  applePayButton.style.height = buttonHeight;
16927
16927
  applePayButton.style.cursor = "pointer";
16928
16928
  }
16929
- function mountButton() {
16929
+ return function mountButton() {
16930
16930
  if (!container.children.length) {
16931
16931
  const mountFunction = {
16932
16932
  "google-pay": "googlePay",
@@ -16945,13 +16945,7 @@ function mountExpressMethod({ state: state2, id: id2 }) {
16945
16945
  console.warn(`method '${id2}' is not supported`);
16946
16946
  }
16947
16947
  }
16948
- }
16949
- Framepay == null ? void 0 : Framepay.on("ready", () => {
16950
- mountButton();
16951
- });
16952
- Framepay == null ? void 0 : Framepay.on("error", (error2) => {
16953
- console.error(error2);
16954
- });
16948
+ };
16955
16949
  }
16956
16950
  function generateFramepayConfig({ methodIds } = {}) {
16957
16951
  var _a, _b;
@@ -17034,18 +17028,44 @@ async function mountExpressMethods({ methods, container }) {
17034
17028
  }
17035
17029
  return height;
17036
17030
  }
17037
- methods.forEach((method) => {
17038
- const { METHOD_ID: id2 } = getMethodData(method);
17039
- if (id2 === "apple-pay" && !browserIsSafari()) return;
17040
- container.innerHTML += `
17031
+ Framepay == null ? void 0 : Framepay.on("ready", () => {
17032
+ const mountingMethods = [];
17033
+ methods.map((method) => {
17034
+ const { METHOD_ID: id2 } = getMethodData(method);
17035
+ if (id2 === "apple-pay" && !browserIsSafari()) return;
17036
+ container.innerHTML += `
17041
17037
  <div class="rebilly-instruments-${id2}-method" style="height: ${generateExpressMethodHeight(
17042
- method
17043
- )}"></div>
17038
+ method
17039
+ )}"></div>
17044
17040
  `;
17045
- mountExpressMethod({
17046
- state,
17047
- id: id2
17041
+ mountingMethods.push(
17042
+ mountExpressMethod({
17043
+ state,
17044
+ id: id2
17045
+ })
17046
+ );
17048
17047
  });
17048
+ mountingMethods.forEach((mount2) => mount2());
17049
+ });
17050
+ Framepay == null ? void 0 : Framepay.on("error", (error2) => {
17051
+ if (error2.code === "paypal-error") {
17052
+ const paypalEl = document.querySelector(
17053
+ ".rebilly-instruments-pay-pal-billing-agreement-method"
17054
+ );
17055
+ if (paypalEl) {
17056
+ paypalEl.remove();
17057
+ if (container.children.length <= 0) {
17058
+ const divider = document.querySelector(
17059
+ '[data-rebilly-instruments="divider"]'
17060
+ );
17061
+ if (divider) {
17062
+ divider.remove();
17063
+ }
17064
+ }
17065
+ }
17066
+ } else {
17067
+ console.error(error2);
17068
+ }
17049
17069
  });
17050
17070
  const redirectUrl = state.options.apiMode === "sandbox" ? "https://forms-sandbox.secure-payments.app/approval-url?close=true" : "https://forms.secure-payments.app/approval-url?close=true";
17051
17071
  Framepay == null ? void 0 : Framepay.on("token-ready", (token) => {
@@ -24935,6 +24955,16 @@ const paymentInstrumentsDisplayOptionsSchema = {
24935
24955
  }),
24936
24956
  googlePay: optional(digitalWalletConfigurationSchema),
24937
24957
  applePay: optional(digitalWalletConfigurationSchema),
24958
+ paymentCard: optional({
24959
+ type: "object",
24960
+ properties: {
24961
+ input: optional({
24962
+ type: "string",
24963
+ enum: ["default", "split"],
24964
+ default: "default"
24965
+ })
24966
+ }
24967
+ }),
24938
24968
  additionalFields: optional({
24939
24969
  type: "object",
24940
24970
  properties: {