@rebilly/instruments 3.39.3 → 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.3",
3
+ "version": "3.39.4",
4
4
  "author": "Rebilly",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -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