@rebilly/instruments 3.39.2 → 3.39.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/instruments",
3
- "version": "3.39.2",
3
+ "version": "3.39.4",
4
4
  "author": "Rebilly",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "lodash.isequal": "^4.5.0",
27
27
  "lodash.kebabcase": "^4.1.1",
28
28
  "lodash.merge": "^4.6.2",
29
- "popostmate": "^1.6.4",
29
+ "popostmate": "2.0.0",
30
30
  "rebilly-js-sdk": "^47.14.2",
31
31
  "values.js": "^2.0.0"
32
32
  },
@@ -23,9 +23,12 @@ export async function mount({
23
23
  state.data = {};
24
24
  state.options = {};
25
25
 
26
+ // Setup options
27
+ state.options = setupOptions({ options });
28
+
26
29
  // Setup DOM
27
- state.form = setupElement({ element: 'form', options });
28
- state.summary = setupElement({ element: 'summary', options });
30
+ state.form = setupElement({ element: 'form' });
31
+ state.summary = setupElement({ element: 'summary' });
29
32
  // hardcode max-width to not break UX
30
33
  // PayPal button cannot exceed 750px;
31
34
  state.form.style.maxWidth = '750px';
@@ -34,10 +37,9 @@ export async function mount({
34
37
  }
35
38
 
36
39
  // Setup state
37
- state.options = setupOptions({ options });
38
- state.storefront = setupStorefront({ options });
39
- state.mainStyleVars = setupStylesVars({ options });
40
- state.options.themeFramepay = setupFramepayTheme({ options });
40
+ state.storefront = setupStorefront();
41
+ state.mainStyleVars = setupStylesVars();
42
+ state.options.themeFramepay = setupFramepayTheme();
41
43
 
42
44
  // Setup loader
43
45
  state.loader.addDOMElement({ el: state.form });
@@ -1,6 +1,9 @@
1
1
  import { processPropertyAsDOMElement } from '../../utils';
2
+ import state from '../../state';
2
3
 
3
- export default ({element = '', options = {}}) => {
4
+ export default ({element = ''}) => {
5
+ const {options} = state;
6
+
4
7
  if (element !== 'form' && element !== 'summary') {
5
8
  throw new Error('element must be "form" or "summary"');
6
9
  }
@@ -45,12 +45,10 @@ const getStyleProps = (obj, particle = '') => {
45
45
  return output;
46
46
  }
47
47
 
48
- export default ({
49
- options = {}
50
- }) => {
48
+ export default () => {
51
49
  const fullCss = `
52
50
  ${state.mainStyleVars}
53
- ${options.css || ''}
51
+ ${state.options?.css || ''}
54
52
  `;
55
53
 
56
54
  const resolvedCssVarsObj = replaceCssVars(fullCss);
@@ -1,13 +1,13 @@
1
1
  import Storefront from '../../storefront';
2
+ import state from '../../state';
2
3
 
3
- export default ({
4
- options:{
4
+ export default () => {
5
+ const {
5
6
  publishableKey,
6
7
  organizationId,
7
8
  apiMode,
8
9
  _dev
9
- }
10
- }) => {
10
+ } = state.options;
11
11
 
12
12
  const storefront = {
13
13
  organizationId,
@@ -1,13 +1,14 @@
1
1
  import { mainStyleVars } from '../../style';
2
2
  import { addDOMElement } from '../../utils';
3
3
  import { minifyCss } from '../../style/utils/minifyCss';
4
+ import state from '../../state';
4
5
 
5
- export default ({
6
- options: {
6
+ export default () => {
7
+ const {
7
8
  theme = {},
8
9
  css,
9
- }
10
- } = {}) => {
10
+ } = state.options;
11
+
11
12
  // Adds base CSS vars stylesheet
12
13
  const styleVars = mainStyleVars(theme || {});
13
14
 
@@ -115,11 +115,11 @@ export function handleApprovalUrl({fields, payload}) {
115
115
  }
116
116
 
117
117
  state.data = new DataInstance({...fields});
118
-
118
+
119
+ const name = 'rebilly-instruments-approval-url'
119
120
  mountModal({
120
- state,
121
- name: 'rebilly-instruments-approval-url',
122
- url: `${paymentMethodsUrl}/approval-url`,
121
+ name,
122
+ url: `${paymentMethodsUrl}?name=${name}`,
123
123
  model,
124
124
  close: (updatedPurchase) => {
125
125
  Events.purchaseCompleted.dispatch(updatedPurchase);
@@ -25,13 +25,13 @@ export async function mountConfirmation({ payload: instrument }) {
25
25
  mainStyleVars: modelSafeState.mainStyleVars,
26
26
  instrument
27
27
  };
28
+
29
+ iframe?.component?.call('update', model);
28
30
 
29
31
  iframe?.component?.call('route', {
30
32
  name: 'confirmation'
31
33
  });
32
34
 
33
- iframe?.component?.call('update', model);
34
-
35
35
  iframe?.component?.on(`${iframe.name}-confirm-purchase`, (confirmedInstrument) => {
36
36
  purchase({ payload: confirmedInstrument });
37
37
  });
@@ -88,5 +88,9 @@ export async function mountModal({
88
88
  closeButton.addEventListener('click', closeModal);
89
89
  }
90
90
 
91
+ iframe.component?.call('route', {
92
+ name: 'approval-url'
93
+ });
94
+
91
95
  return iframe;
92
96
  }
package/CONTRIBUTING.md DELETED
@@ -1,4 +0,0 @@
1
- # Constributing to Rebilly Instruments package/core
2
-
3
- ## Setup
4
- No additional setup is required to run this package locally