@rebilly/instruments 9.51.0 → 9.53.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,6 +1,6 @@
1
- ## [9.51.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.50.1...instruments/core-v9.51.0) (2024-05-27)
1
+ ## [9.53.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.52.0...instruments/core-v9.53.0) (2024-05-28)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * **api-metadata, rebilly-js-sdk:** Update resources based on latest api definitions ([#5531](https://github.com/Rebilly/rebilly/issues/5531)) ([4ffa25f](https://github.com/Rebilly/rebilly/commit/4ffa25fad2998274d82dbe80fe8131c3532b811e))
6
+ * **billing portal, instruments:** upgrade instruments management ([#5472](https://github.com/Rebilly/rebilly/issues/5472)) ([d8d886f](https://github.com/Rebilly/rebilly/commit/d8d886fca97bb034b1477ec72fe5c22aa908af22))
package/dist/index.d.ts CHANGED
@@ -223,6 +223,7 @@ export interface PaymentInstrumentsOptionFlags {
223
223
  allowDeactivate?: boolean;
224
224
  allowUpdate?: boolean;
225
225
  allowMakeDefault?: boolean;
226
+ allowCreate?: boolean;
226
227
  }
227
228
  export interface PaymentInstrumentsDisplayOptions extends PaymentInstrumentsOptionFlags {
228
229
  address?: Address;
@@ -242,6 +243,7 @@ export interface Features {
242
243
  hideResult?: boolean;
243
244
  fullPageRedirect?: boolean;
244
245
  showCoupons?: string[];
246
+ hideContinue?: boolean;
245
247
  }
246
248
  export interface DevProperties {
247
249
  paymentMethodsUrl?: string;
package/dist/index.js CHANGED
@@ -2709,7 +2709,8 @@ const events = {
2709
2709
  instrumentReady: new BaseEvent("instrument-ready"),
2710
2710
  payoutCompleted: new BaseEvent("payout-completed"),
2711
2711
  purchaseCompleted: new BaseEvent("purchase-completed"),
2712
- setupCompleted: new BaseEvent("setup-completed")
2712
+ setupCompleted: new BaseEvent("setup-completed"),
2713
+ instrumentManaged: new BaseEvent("instrument-managed")
2713
2714
  };
2714
2715
  const publicEventNames = Object.keys(events).map(
2715
2716
  (internalName) => kebabCase$1(internalName)
@@ -2860,6 +2861,69 @@ function stopLoaderHandler(iframe, data) {
2860
2861
  (_a = data.loader) == null ? void 0 : _a.stopLoading({ section, id: id2 });
2861
2862
  });
2862
2863
  }
2864
+ function showConfirmationModalHandler(iframe) {
2865
+ iframe.component.on(
2866
+ `${iframe.name}-show-confirmation-modal`,
2867
+ async (params) => {
2868
+ try {
2869
+ const response = await showConfirmationModal(params);
2870
+ iframe.component.call("update", {
2871
+ data: { confirmModal: response.confirmed }
2872
+ });
2873
+ } catch (err) {
2874
+ console.error(err);
2875
+ }
2876
+ }
2877
+ );
2878
+ }
2879
+ function showConfirmationModal({ title: title2, message, confirmText, cancelText }) {
2880
+ return new Promise((resolve2) => {
2881
+ const modalElement = document.createElement("div");
2882
+ modalElement.id = "confirmation-modal";
2883
+ modalElement.classList.add(
2884
+ "rebilly-instruments-modal-overlay",
2885
+ "is-visible"
2886
+ );
2887
+ modalElement.innerHTML = `
2888
+ <div class="rebilly-instruments-modal-container rebilly-instruments-confirmation-modal-container is-visible">
2889
+ <div class="rebilly-instruments-modal-header rebilly-instruments-confirmation-modal-header">
2890
+ <b class="rebilly-instruments-modal-title rebilly-instruments-confirmation-modal-title">${title2}</b>
2891
+ </div>
2892
+ <div class="rebilly-instruments-modal-content rebilly-instruments-confirmation-modal-content">
2893
+ <p class="rebilly-instruments-modal-message rebilly-instruments-confirmation-modal-message">${message}</p>
2894
+ </div>
2895
+ <div class="rebilly-instruments-modal-actions rebilly-instruments-confirmation-modal-actions">
2896
+ <button class="rebilly-instruments-button-transparent rebilly-instruments-confirmation-modal-cancel">${cancelText}</button>
2897
+ <button class="rebilly-instruments-button rebilly-instruments-confirmation-modal-confirm">${confirmText}</button>
2898
+ </div>
2899
+ </div>
2900
+ `;
2901
+ document.body.appendChild(modalElement);
2902
+ const modalOverlay = document.getElementById("confirmation-modal");
2903
+ const confirmBtn = modalOverlay.querySelector(
2904
+ ".rebilly-instruments-confirmation-modal-confirm"
2905
+ );
2906
+ const cancelBtn = modalOverlay.querySelector(
2907
+ ".rebilly-instruments-confirmation-modal-cancel"
2908
+ );
2909
+ document.body.style.overflow = "hidden";
2910
+ const closeModal = () => {
2911
+ modalOverlay.classList.remove("is-visible");
2912
+ setTimeout(() => {
2913
+ document.body.style.overflow = "auto";
2914
+ modalOverlay.remove();
2915
+ }, 300);
2916
+ };
2917
+ confirmBtn.addEventListener("click", () => {
2918
+ closeModal();
2919
+ resolve2({ confirmed: true });
2920
+ });
2921
+ cancelBtn.addEventListener("click", () => {
2922
+ closeModal();
2923
+ resolve2({ confirmed: false });
2924
+ });
2925
+ });
2926
+ }
2863
2927
  let ViewIframe$1 = class ViewIframe extends BaseIframe {
2864
2928
  constructor(args = {}) {
2865
2929
  super(args);
@@ -2871,6 +2935,7 @@ let ViewIframe$1 = class ViewIframe extends BaseIframe {
2871
2935
  showErrorHandler(this);
2872
2936
  updateCouponsHandler(this);
2873
2937
  updateAddonsHandler(this);
2938
+ showConfirmationModalHandler(this);
2874
2939
  }
2875
2940
  };
2876
2941
  function changeIframeSrcHandler(iframe) {
@@ -2893,6 +2958,7 @@ let ModalIframe$1 = class ModalIframe extends BaseIframe {
2893
2958
  id: this.name
2894
2959
  });
2895
2960
  showErrorHandler(this);
2961
+ showConfirmationModalHandler(this);
2896
2962
  this.component.on(`${this.name}-close`, (...args) => {
2897
2963
  close(...args);
2898
2964
  });
@@ -25253,6 +25319,10 @@ const paymentInstrumentsDisplayOptionsSchema = {
25253
25319
  type: "boolean",
25254
25320
  default: false
25255
25321
  }),
25322
+ allowCreate: optional({
25323
+ type: "boolean",
25324
+ default: true
25325
+ }),
25256
25326
  address: optional(addressSchema),
25257
25327
  paypal: optional({
25258
25328
  type: "object",
@@ -25317,6 +25387,10 @@ const featuresSchema = {
25317
25387
  type: "string",
25318
25388
  enum: ["summary", "confirmation"]
25319
25389
  }
25390
+ }),
25391
+ hideContinue: optional({
25392
+ type: "boolean",
25393
+ default: false
25320
25394
  })
25321
25395
  },
25322
25396
  default: {}
@@ -27819,6 +27893,40 @@ const vars = (theme2) => `
27819
27893
  color: #000;
27820
27894
  }
27821
27895
 
27896
+ .rebilly-instruments-confirmation-modal-container {
27897
+ width: 350px;
27898
+ margin: var(--rebilly-spacingL) auto;
27899
+ padding: var(--rebilly-spacingM);
27900
+ font-size: var(--rebilly-fontSizeBase);
27901
+ font-family: var(--rebilly-fontFamily);
27902
+ }
27903
+
27904
+ .rebilly-instruments-confirmation-modal-header {
27905
+ display: flex;
27906
+ justify-content: space-between;
27907
+ align-items: center;
27908
+ font-weight: var(--rebilly-fontWeight600);
27909
+ line-height: var(--rebilly-fontLineHeightBase);
27910
+ }
27911
+
27912
+ .rebilly-instruments-confirmation-modal-content {
27913
+ text-align: left !important;
27914
+ padding: 0 !important;
27915
+ line-height: var(--rebilly-fontLineHeightBase);
27916
+ }
27917
+
27918
+ .rebilly-instruments-confirmation-modal-actions {
27919
+ display: flex;
27920
+ justify-content: flex-end;
27921
+ align-items: baseline;
27922
+ line-height: var(--rebilly-fontLineHeightBase);
27923
+ }
27924
+
27925
+ .rebilly-instruments-confirmation-modal-actions .rebilly-instruments-confirmation-modal-confirm {
27926
+ width: initial;
27927
+ margin-left: var(--rebilly-spacingS);
27928
+ }
27929
+
27822
27930
  @media screen and (max-width: 480px) {
27823
27931
  .rebilly-instruments-modal-container.is-redirect {
27824
27932
  max-width: 96vw;
@@ -28038,6 +28146,156 @@ const vars = (theme2) => `
28038
28146
  line-height: var(--rebilly-fontLineHeightBase);
28039
28147
  }
28040
28148
 
28149
+ /* Components. Button
28150
+ ------------------------------------------------------------ */
28151
+ .rebilly-instruments-button {
28152
+ font-size: var(--rebilly-buttonFontSize);
28153
+ font-family: var(--rebilly-buttonFontFamily);
28154
+ line-height: var(--rebilly-buttonFontLineHeight);
28155
+ padding: var(--rebilly-spacingS);
28156
+ box-sizing: border-box;
28157
+ background: var(--rebilly-buttonColorBackground);
28158
+ color: var(--rebilly-buttonColorText);
28159
+ border-radius: var(--rebilly-buttonBorderRadius);
28160
+ font-weight: var(--rebilly-buttonFontWeight);
28161
+ border: var(--rebilly-buttonBorder);
28162
+ box-shadow: var(--rebilly-buttonBoxShadow);
28163
+ margin: calc(var(--rebilly-spacing2xs) + var(--rebilly-spacingS) / 2) 0;
28164
+ width: 100%;
28165
+ cursor: pointer;
28166
+ min-height: 44px;
28167
+ transition: all 0.2s ease;
28168
+ outline: none;
28169
+ }
28170
+
28171
+ .rebilly-instruments-button:not([disabled]):hover {
28172
+ background: var(--rebilly-buttonHoverColorBackground);
28173
+ color: var(--rebilly-buttonHoverColorText);
28174
+ font-family: var(--rebilly-buttonHoverFontFamily);
28175
+ font-size: var(--rebilly-buttonHoverFontSize);
28176
+ line-height: var(--rebilly-buttonHoverFontLineHeight);
28177
+ font-weight: var(--rebilly-buttonHoverFontWeight);
28178
+ border: var(--rebilly-buttonHoverBorder);
28179
+ border-radius: var(--rebilly-buttonHoverBorderRadius);
28180
+ box-shadow: var(--rebilly-buttonHoverBoxShadow);
28181
+ }
28182
+
28183
+ .rebilly-instruments-button:not([disabled]):active {
28184
+ background: var(--rebilly-buttonActiveColorBackground);
28185
+ color: var(--rebilly-buttonActiveColorText);
28186
+ font-family: var(--rebilly-buttonActiveFontFamily);
28187
+ font-size: var(--rebilly-buttonActiveFontSize);
28188
+ line-height: var(--rebilly-buttonActiveFontLineHeight);
28189
+ font-weight: var(--rebilly-buttonActiveFontWeight);
28190
+ border: var(--rebilly-buttonActiveBorder);
28191
+ border-radius: var(--rebilly-buttonActiveBorderRadius);
28192
+ box-shadow: var(--rebilly-buttonActiveBoxShadow);
28193
+ }
28194
+
28195
+ .rebilly-instruments-button.rebilly-instruments-button-secondary {
28196
+ font-size: var(--rebilly-buttonSecondaryFontSize);
28197
+ font-family: var(--rebilly-buttonSecondaryFontFamily);
28198
+ line-height: var(--rebilly-buttonSecondaryFontLineHeight);
28199
+ background: var(--rebilly-buttonSecondaryColorBackground);
28200
+ color: var(--rebilly-buttonSecondaryColorText);
28201
+ border: var(--rebilly-buttonSecondaryBorder);
28202
+ box-shadow: var(--rebilly-buttonSecondaryBoxShadow);
28203
+ }
28204
+
28205
+ .rebilly-instruments-button.rebilly-instruments-button-secondary:not(
28206
+ [disabled]
28207
+ ):hover {
28208
+ font-size: var(--rebilly-buttonSecondaryHoverFontSize);
28209
+ font-family: var(--rebilly-buttonSecondaryHoverFontFamily);
28210
+ line-height: var(--rebilly-buttonSecondaryHoverFontLineHeight);
28211
+ background: var(--rebilly-buttonSecondaryHoverColorBackground);
28212
+ color: var(--rebilly-buttonSecondaryHoverColorText);
28213
+ border: var(--rebilly-buttonSecondaryHoverBorder);
28214
+ box-shadow: var(--rebilly-buttonSecondaryHoverBoxShadow);
28215
+ }
28216
+
28217
+ .rebilly-instruments-button.rebilly-instruments-button-secondary:not(
28218
+ [disabled]
28219
+ ):active {
28220
+ font-size: var(--rebilly-buttonSecondaryActiveFontSize);
28221
+ font-family: var(--rebilly-buttonSecondaryActiveFontFamily);
28222
+ line-height: var(--rebilly-buttonSecondaryActiveFontLineHeight);
28223
+ background: var(--rebilly-buttonSecondaryActiveColorBackground);
28224
+ color: var(--rebilly-buttonSecondaryActiveColorText);
28225
+ border: var(--rebilly-buttonSecondaryActiveBorder);
28226
+ box-shadow: var(--rebilly-buttonSecondaryActiveBoxShadow);
28227
+ }
28228
+
28229
+ .rebilly-instruments-button:focus {
28230
+ box-shadow: none;
28231
+ }
28232
+
28233
+ .rebilly-instruments-button:disabled,
28234
+ .rebilly-instruments-button:disabled:hover {
28235
+ cursor: not-allowed;
28236
+ opacity: 0.6;
28237
+ }
28238
+
28239
+ .rebilly-instruments-button::first-letter {
28240
+ text-transform: uppercase;
28241
+ }
28242
+
28243
+ .rebilly-instruments-button:first-of-type {
28244
+ margin-top: var(--rebilly-spacingL);
28245
+ }
28246
+
28247
+ .rebilly-instruments-button:last-of-type {
28248
+ margin-bottom: 0;
28249
+ }
28250
+
28251
+ .rebilly-instruments-button-group {
28252
+ display: flex;
28253
+ align-items: stretch;
28254
+ margin-top: var(--rebilly-spacingL);
28255
+ }
28256
+
28257
+ .rebilly-instruments-button-group .rebilly-instruments-button {
28258
+ margin: 0 var(--rebilly-spacingXs);
28259
+ }
28260
+
28261
+ .rebilly-instruments-button-group .rebilly-instruments-button:first-of-type {
28262
+ margin-left: 0;
28263
+ }
28264
+
28265
+ .rebilly-instruments-button-group .rebilly-instruments-button:last-of-type {
28266
+ margin-right: 0;
28267
+ }
28268
+
28269
+ @media screen and (max-width: 480px) {
28270
+ .rebilly-instruments-button-group {
28271
+ flex-direction: column-reverse;
28272
+ }
28273
+
28274
+ .rebilly-instruments-button-group
28275
+ .rebilly-instruments-button:first-of-type {
28276
+ margin: 0;
28277
+ }
28278
+
28279
+ .rebilly-instruments-button-group .rebilly-instruments-button:last-of-type {
28280
+ margin: 0;
28281
+ }
28282
+
28283
+ .rebilly-instruments-button-group
28284
+ .rebilly-instruments-button
28285
+ + .rebilly-instruments-button {
28286
+ margin-bottom: var(--rebilly-spacingS);
28287
+ }
28288
+ }
28289
+
28290
+ .rebilly-instruments-button-transparent {
28291
+ border: none;
28292
+ background: transparent;
28293
+ cursor: pointer;
28294
+ color: inherit;
28295
+ font: inherit;
28296
+ }
28297
+
28298
+
28041
28299
 
28042
28300
  /* Bump offer
28043
28301
  ------------------------------------------------------------ */