@rebilly/instruments 9.50.1 → 9.52.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.50.1](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.50.0...instruments/core-v9.50.1) (2024-05-27)
1
+ ## [9.52.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v9.51.0...instruments/core-v9.52.0) (2024-05-28)
2
+
3
+
4
+ ### Features
5
+
6
+ * **instruments:** manage instruments - deactivation ([#5427](https://github.com/Rebilly/rebilly/issues/5427)) ([804c56f](https://github.com/Rebilly/rebilly/commit/804c56f8111c8c5a420d49889079bd64471ee7e9)), closes [#5425](https://github.com/Rebilly/rebilly/issues/5425)
package/dist/index.js CHANGED
@@ -2860,6 +2860,69 @@ function stopLoaderHandler(iframe, data) {
2860
2860
  (_a = data.loader) == null ? void 0 : _a.stopLoading({ section, id: id2 });
2861
2861
  });
2862
2862
  }
2863
+ function showConfirmationModalHandler(iframe) {
2864
+ iframe.component.on(
2865
+ `${iframe.name}-show-confirmation-modal`,
2866
+ async (params) => {
2867
+ try {
2868
+ const response = await showConfirmationModal(params);
2869
+ iframe.component.call("update", {
2870
+ data: { confirmModal: response.confirmed }
2871
+ });
2872
+ } catch (err) {
2873
+ console.error(err);
2874
+ }
2875
+ }
2876
+ );
2877
+ }
2878
+ function showConfirmationModal({ title: title2, message, confirmText, cancelText }) {
2879
+ return new Promise((resolve2) => {
2880
+ const modalElement = document.createElement("div");
2881
+ modalElement.id = "confirmation-modal";
2882
+ modalElement.classList.add(
2883
+ "rebilly-instruments-modal-overlay",
2884
+ "is-visible"
2885
+ );
2886
+ modalElement.innerHTML = `
2887
+ <div class="rebilly-instruments-modal-container rebilly-instruments-confirmation-modal-container is-visible">
2888
+ <div class="rebilly-instruments-modal-header rebilly-instruments-confirmation-modal-header">
2889
+ <b class="rebilly-instruments-modal-title rebilly-instruments-confirmation-modal-title">${title2}</b>
2890
+ </div>
2891
+ <div class="rebilly-instruments-modal-content rebilly-instruments-confirmation-modal-content">
2892
+ <p class="rebilly-instruments-modal-message rebilly-instruments-confirmation-modal-message">${message}</p>
2893
+ </div>
2894
+ <div class="rebilly-instruments-modal-actions rebilly-instruments-confirmation-modal-actions">
2895
+ <button class="rebilly-instruments-button-transparent rebilly-instruments-confirmation-modal-cancel">${cancelText}</button>
2896
+ <button class="rebilly-instruments-button rebilly-instruments-confirmation-modal-confirm">${confirmText}</button>
2897
+ </div>
2898
+ </div>
2899
+ `;
2900
+ document.body.appendChild(modalElement);
2901
+ const modalOverlay = document.getElementById("confirmation-modal");
2902
+ const confirmBtn = modalOverlay.querySelector(
2903
+ ".rebilly-instruments-confirmation-modal-confirm"
2904
+ );
2905
+ const cancelBtn = modalOverlay.querySelector(
2906
+ ".rebilly-instruments-confirmation-modal-cancel"
2907
+ );
2908
+ document.body.style.overflow = "hidden";
2909
+ const closeModal = () => {
2910
+ modalOverlay.classList.remove("is-visible");
2911
+ setTimeout(() => {
2912
+ document.body.style.overflow = "auto";
2913
+ modalOverlay.remove();
2914
+ }, 300);
2915
+ };
2916
+ confirmBtn.addEventListener("click", () => {
2917
+ closeModal();
2918
+ resolve2({ confirmed: true });
2919
+ });
2920
+ cancelBtn.addEventListener("click", () => {
2921
+ closeModal();
2922
+ resolve2({ confirmed: false });
2923
+ });
2924
+ });
2925
+ }
2863
2926
  let ViewIframe$1 = class ViewIframe extends BaseIframe {
2864
2927
  constructor(args = {}) {
2865
2928
  super(args);
@@ -2871,6 +2934,7 @@ let ViewIframe$1 = class ViewIframe extends BaseIframe {
2871
2934
  showErrorHandler(this);
2872
2935
  updateCouponsHandler(this);
2873
2936
  updateAddonsHandler(this);
2937
+ showConfirmationModalHandler(this);
2874
2938
  }
2875
2939
  };
2876
2940
  function changeIframeSrcHandler(iframe) {
@@ -2893,6 +2957,7 @@ let ModalIframe$1 = class ModalIframe extends BaseIframe {
2893
2957
  id: this.name
2894
2958
  });
2895
2959
  showErrorHandler(this);
2960
+ showConfirmationModalHandler(this);
2896
2961
  this.component.on(`${this.name}-close`, (...args) => {
2897
2962
  close(...args);
2898
2963
  });
@@ -27819,6 +27884,40 @@ const vars = (theme2) => `
27819
27884
  color: #000;
27820
27885
  }
27821
27886
 
27887
+ .rebilly-instruments-confirmation-modal-container {
27888
+ width: 350px;
27889
+ margin: var(--rebilly-spacingL) auto;
27890
+ padding: var(--rebilly-spacingM);
27891
+ font-size: var(--rebilly-fontSizeBase);
27892
+ font-family: var(--rebilly-fontFamily);
27893
+ }
27894
+
27895
+ .rebilly-instruments-confirmation-modal-header {
27896
+ display: flex;
27897
+ justify-content: space-between;
27898
+ align-items: center;
27899
+ font-weight: var(--rebilly-fontWeight600);
27900
+ line-height: var(--rebilly-fontLineHeightBase);
27901
+ }
27902
+
27903
+ .rebilly-instruments-confirmation-modal-content {
27904
+ text-align: left !important;
27905
+ padding: 0 !important;
27906
+ line-height: var(--rebilly-fontLineHeightBase);
27907
+ }
27908
+
27909
+ .rebilly-instruments-confirmation-modal-actions {
27910
+ display: flex;
27911
+ justify-content: flex-end;
27912
+ align-items: baseline;
27913
+ line-height: var(--rebilly-fontLineHeightBase);
27914
+ }
27915
+
27916
+ .rebilly-instruments-confirmation-modal-actions .rebilly-instruments-confirmation-modal-confirm {
27917
+ width: initial;
27918
+ margin-left: var(--rebilly-spacingS);
27919
+ }
27920
+
27822
27921
  @media screen and (max-width: 480px) {
27823
27922
  .rebilly-instruments-modal-container.is-redirect {
27824
27923
  max-width: 96vw;
@@ -28038,6 +28137,156 @@ const vars = (theme2) => `
28038
28137
  line-height: var(--rebilly-fontLineHeightBase);
28039
28138
  }
28040
28139
 
28140
+ /* Components. Button
28141
+ ------------------------------------------------------------ */
28142
+ .rebilly-instruments-button {
28143
+ font-size: var(--rebilly-buttonFontSize);
28144
+ font-family: var(--rebilly-buttonFontFamily);
28145
+ line-height: var(--rebilly-buttonFontLineHeight);
28146
+ padding: var(--rebilly-spacingS);
28147
+ box-sizing: border-box;
28148
+ background: var(--rebilly-buttonColorBackground);
28149
+ color: var(--rebilly-buttonColorText);
28150
+ border-radius: var(--rebilly-buttonBorderRadius);
28151
+ font-weight: var(--rebilly-buttonFontWeight);
28152
+ border: var(--rebilly-buttonBorder);
28153
+ box-shadow: var(--rebilly-buttonBoxShadow);
28154
+ margin: calc(var(--rebilly-spacing2xs) + var(--rebilly-spacingS) / 2) 0;
28155
+ width: 100%;
28156
+ cursor: pointer;
28157
+ min-height: 44px;
28158
+ transition: all 0.2s ease;
28159
+ outline: none;
28160
+ }
28161
+
28162
+ .rebilly-instruments-button:not([disabled]):hover {
28163
+ background: var(--rebilly-buttonHoverColorBackground);
28164
+ color: var(--rebilly-buttonHoverColorText);
28165
+ font-family: var(--rebilly-buttonHoverFontFamily);
28166
+ font-size: var(--rebilly-buttonHoverFontSize);
28167
+ line-height: var(--rebilly-buttonHoverFontLineHeight);
28168
+ font-weight: var(--rebilly-buttonHoverFontWeight);
28169
+ border: var(--rebilly-buttonHoverBorder);
28170
+ border-radius: var(--rebilly-buttonHoverBorderRadius);
28171
+ box-shadow: var(--rebilly-buttonHoverBoxShadow);
28172
+ }
28173
+
28174
+ .rebilly-instruments-button:not([disabled]):active {
28175
+ background: var(--rebilly-buttonActiveColorBackground);
28176
+ color: var(--rebilly-buttonActiveColorText);
28177
+ font-family: var(--rebilly-buttonActiveFontFamily);
28178
+ font-size: var(--rebilly-buttonActiveFontSize);
28179
+ line-height: var(--rebilly-buttonActiveFontLineHeight);
28180
+ font-weight: var(--rebilly-buttonActiveFontWeight);
28181
+ border: var(--rebilly-buttonActiveBorder);
28182
+ border-radius: var(--rebilly-buttonActiveBorderRadius);
28183
+ box-shadow: var(--rebilly-buttonActiveBoxShadow);
28184
+ }
28185
+
28186
+ .rebilly-instruments-button.rebilly-instruments-button-secondary {
28187
+ font-size: var(--rebilly-buttonSecondaryFontSize);
28188
+ font-family: var(--rebilly-buttonSecondaryFontFamily);
28189
+ line-height: var(--rebilly-buttonSecondaryFontLineHeight);
28190
+ background: var(--rebilly-buttonSecondaryColorBackground);
28191
+ color: var(--rebilly-buttonSecondaryColorText);
28192
+ border: var(--rebilly-buttonSecondaryBorder);
28193
+ box-shadow: var(--rebilly-buttonSecondaryBoxShadow);
28194
+ }
28195
+
28196
+ .rebilly-instruments-button.rebilly-instruments-button-secondary:not(
28197
+ [disabled]
28198
+ ):hover {
28199
+ font-size: var(--rebilly-buttonSecondaryHoverFontSize);
28200
+ font-family: var(--rebilly-buttonSecondaryHoverFontFamily);
28201
+ line-height: var(--rebilly-buttonSecondaryHoverFontLineHeight);
28202
+ background: var(--rebilly-buttonSecondaryHoverColorBackground);
28203
+ color: var(--rebilly-buttonSecondaryHoverColorText);
28204
+ border: var(--rebilly-buttonSecondaryHoverBorder);
28205
+ box-shadow: var(--rebilly-buttonSecondaryHoverBoxShadow);
28206
+ }
28207
+
28208
+ .rebilly-instruments-button.rebilly-instruments-button-secondary:not(
28209
+ [disabled]
28210
+ ):active {
28211
+ font-size: var(--rebilly-buttonSecondaryActiveFontSize);
28212
+ font-family: var(--rebilly-buttonSecondaryActiveFontFamily);
28213
+ line-height: var(--rebilly-buttonSecondaryActiveFontLineHeight);
28214
+ background: var(--rebilly-buttonSecondaryActiveColorBackground);
28215
+ color: var(--rebilly-buttonSecondaryActiveColorText);
28216
+ border: var(--rebilly-buttonSecondaryActiveBorder);
28217
+ box-shadow: var(--rebilly-buttonSecondaryActiveBoxShadow);
28218
+ }
28219
+
28220
+ .rebilly-instruments-button:focus {
28221
+ box-shadow: none;
28222
+ }
28223
+
28224
+ .rebilly-instruments-button:disabled,
28225
+ .rebilly-instruments-button:disabled:hover {
28226
+ cursor: not-allowed;
28227
+ opacity: 0.6;
28228
+ }
28229
+
28230
+ .rebilly-instruments-button::first-letter {
28231
+ text-transform: uppercase;
28232
+ }
28233
+
28234
+ .rebilly-instruments-button:first-of-type {
28235
+ margin-top: var(--rebilly-spacingL);
28236
+ }
28237
+
28238
+ .rebilly-instruments-button:last-of-type {
28239
+ margin-bottom: 0;
28240
+ }
28241
+
28242
+ .rebilly-instruments-button-group {
28243
+ display: flex;
28244
+ align-items: stretch;
28245
+ margin-top: var(--rebilly-spacingL);
28246
+ }
28247
+
28248
+ .rebilly-instruments-button-group .rebilly-instruments-button {
28249
+ margin: 0 var(--rebilly-spacingXs);
28250
+ }
28251
+
28252
+ .rebilly-instruments-button-group .rebilly-instruments-button:first-of-type {
28253
+ margin-left: 0;
28254
+ }
28255
+
28256
+ .rebilly-instruments-button-group .rebilly-instruments-button:last-of-type {
28257
+ margin-right: 0;
28258
+ }
28259
+
28260
+ @media screen and (max-width: 480px) {
28261
+ .rebilly-instruments-button-group {
28262
+ flex-direction: column-reverse;
28263
+ }
28264
+
28265
+ .rebilly-instruments-button-group
28266
+ .rebilly-instruments-button:first-of-type {
28267
+ margin: 0;
28268
+ }
28269
+
28270
+ .rebilly-instruments-button-group .rebilly-instruments-button:last-of-type {
28271
+ margin: 0;
28272
+ }
28273
+
28274
+ .rebilly-instruments-button-group
28275
+ .rebilly-instruments-button
28276
+ + .rebilly-instruments-button {
28277
+ margin-bottom: var(--rebilly-spacingS);
28278
+ }
28279
+ }
28280
+
28281
+ .rebilly-instruments-button-transparent {
28282
+ border: none;
28283
+ background: transparent;
28284
+ cursor: pointer;
28285
+ color: inherit;
28286
+ font: inherit;
28287
+ }
28288
+
28289
+
28041
28290
 
28042
28291
  /* Bump offer
28043
28292
  ------------------------------------------------------------ */