@gem-sdk/components 2.0.0-dev.373 → 2.0.0-dev.375

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.
Files changed (38) hide show
  1. package/dist/cjs/builder.js +0 -1
  2. package/dist/cjs/form/components/contact/Contact.liquid.js +9 -3
  3. package/dist/cjs/form/components/contact/common/composeStyles.js +2 -1
  4. package/dist/cjs/form/components/form-email/FormEmail.js +16 -22
  5. package/dist/cjs/form/components/newsletter/Newsletter.liquid.js +39 -34
  6. package/dist/cjs/form/components/newsletter/common/composeStyles.js +2 -2
  7. package/dist/cjs/form/setting/contact/Contact.js +6 -15
  8. package/dist/cjs/form/setting/contact/ContactInitConfig.js +1 -1
  9. package/dist/cjs/form/setting/contact/configs/settings.js +206 -0
  10. package/dist/cjs/form/setting/contact/configs/uiV1.js +76 -0
  11. package/dist/cjs/form/setting/contact/configs/uiV2.js +241 -0
  12. package/dist/cjs/form/setting/newsletter/Newsletter.js +1 -1
  13. package/dist/cjs/form/setting/newsletter/NewsletterInitConfig.js +2 -4
  14. package/dist/cjs/form/setting/newsletter/configs/settings.js +13 -0
  15. package/dist/cjs/form/setting/newsletter/configs/uiV2.js +35 -13
  16. package/dist/cjs/form/setting/submit-button/configs/settings.js +17 -9
  17. package/dist/cjs/form/setting/submit-button/configs/uiV2.js +2 -2
  18. package/dist/cjs/sticky/components/common/styles.js +16 -5
  19. package/dist/esm/builder.js +0 -1
  20. package/dist/esm/form/components/contact/Contact.liquid.js +9 -3
  21. package/dist/esm/form/components/contact/common/composeStyles.js +3 -2
  22. package/dist/esm/form/components/form-email/FormEmail.js +17 -23
  23. package/dist/esm/form/components/newsletter/Newsletter.liquid.js +40 -35
  24. package/dist/esm/form/components/newsletter/common/composeStyles.js +2 -2
  25. package/dist/esm/form/setting/contact/Contact.js +6 -15
  26. package/dist/esm/form/setting/contact/ContactInitConfig.js +1 -1
  27. package/dist/esm/form/setting/contact/configs/settings.js +202 -0
  28. package/dist/esm/form/setting/contact/configs/uiV1.js +74 -0
  29. package/dist/esm/form/setting/contact/configs/uiV2.js +239 -0
  30. package/dist/esm/form/setting/newsletter/Newsletter.js +1 -1
  31. package/dist/esm/form/setting/newsletter/NewsletterInitConfig.js +2 -4
  32. package/dist/esm/form/setting/newsletter/configs/settings.js +13 -0
  33. package/dist/esm/form/setting/newsletter/configs/uiV2.js +35 -13
  34. package/dist/esm/form/setting/submit-button/configs/settings.js +17 -9
  35. package/dist/esm/form/setting/submit-button/configs/uiV2.js +2 -2
  36. package/dist/esm/sticky/components/common/styles.js +16 -5
  37. package/dist/types/index.d.ts +5 -2
  38. package/package.json +2 -2
@@ -2,10 +2,11 @@ import { template, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
2
  import { getDynamicSourceLocales, getStaticLocale, getSettingPreloadData } from '../../../helpers.js';
3
3
  import { composeContainerAttrs, composeAnchorAttrs, composeFormAttrs, composePopoverAttrs } from './common/composeAttrs.js';
4
4
  import { createStyle, createClass } from '@gem-sdk/system';
5
- import { composeContainerStyles, composeFormStyles, popoverStyles } from './common/composeStyles.js';
5
+ import { composeContainerStylesForm, composeFormStyles, popoverStyles } from './common/composeStyles.js';
6
6
  import { composeFormClasses } from './common/composeClasses.js';
7
+ import { composeContainerStyles } from '../contact/common/composeStyles.js';
7
8
 
8
- const Newsletter = ({ builderProps, setting, children, style, formType, advanced, pageContext })=>{
9
+ const Newsletter = ({ builderProps, setting, children, style, formType, advanced, pageContext, styles })=>{
9
10
  const errorMessage = getDynamicSourceLocales({
10
11
  val: setting?.errorMessage,
11
12
  uid: builderProps?.uid,
@@ -23,56 +24,60 @@ const Newsletter = ({ builderProps, setting, children, style, formType, advanced
23
24
  translate: setting?.translate
24
25
  });
25
26
  const containerAttrs = composeContainerAttrs(builderProps, setting);
26
- const composedContainerStyles = createStyle(composeContainerStyles(style));
27
+ const composedContainerStyles = createStyle(composeContainerStylesForm(style));
27
28
  const anchorAttrs = composeAnchorAttrs(builderProps, setting);
28
29
  const composedFormClasses = createClass(composeFormClasses());
29
30
  const composedFormStyles = createStyle(composeFormStyles(setting));
30
31
  const formAttrs = composeFormAttrs(builderProps);
31
32
  const popoverAttrs = composePopoverAttrs(builderProps);
32
33
  const generatedPopoverStyles = popoverStyles(builderProps);
34
+ const containerStyle = createStyle(composeContainerStyles(setting, styles));
33
35
  return template`
34
- <gp-form
35
- ${{
36
+ <div style="${containerStyle}">
37
+ <gp-form
38
+ ${{
36
39
  ...containerAttrs
37
40
  }}
38
- style="${composedContainerStyles}"
39
- >
40
- <a
41
- ${{
41
+ style="${composedContainerStyles}"
42
+ >
43
+ <a
44
+ ${{
42
45
  ...anchorAttrs
43
46
  }}
44
- >
45
- </a>
46
- {% form '${formType ? formType : 'customer'}', class: 'gp-form-${builderProps?.uid} ${advanced?.cssClass}', id: 'contact_form_${builderProps?.uid}' %}
47
- {% if form.errors %}
48
- <div
49
- ${{
47
+ >
48
+ </a>
49
+ {% form '${formType ? formType : 'customer'}', class: 'gp-form-${builderProps?.uid} ${advanced?.cssClass}', id: 'contact_form_${builderProps?.uid}' %}
50
+ {% if form.errors %}
51
+ <div
52
+ ${{
50
53
  ...formAttrs
51
54
  }}
52
- class="${composedFormClasses}"
53
- style="${composedFormStyles}"
54
- >
55
- ${errorMessage}
56
- </div>
57
- {% endif %}
58
- <div popover ${{
55
+ class="${composedFormClasses}"
56
+ style="${composedFormStyles}"
57
+ >
58
+ ${errorMessage}
59
+ </div>
60
+ {% endif %}
61
+ <div popover ${{
59
62
  ...popoverAttrs
60
63
  }}>
61
- <style>
62
- ${generatedPopoverStyles}
63
- </style>
64
- <div
65
- ${{
64
+ <style>
65
+ ${generatedPopoverStyles}
66
+ </style>
67
+ <div
68
+ ${{
66
69
  ...formAttrs
67
70
  }}
68
- class="${composedFormClasses}"
69
- style="${composedFormStyles}"
70
- >
71
- ${successMessage}
72
- </div></div>
73
- ${children}
74
- {% endform %}
75
- </gp-form>
71
+ class="${composedFormClasses}"
72
+ style="${composedFormStyles}"
73
+ >
74
+ ${successMessage}
75
+ </div>
76
+ </div>
77
+ ${children}
78
+ {% endform %}
79
+ </gp-form>
80
+ </div>
76
81
  ${RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-form.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-form.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
77
82
  `;
78
83
  };
@@ -2,7 +2,7 @@ import { filterTruthy } from '../../../helpers/common.js';
2
2
  import { getStyleBackgroundByDevice } from '@gem-sdk/core';
3
3
 
4
4
  const composeStyles = (styles)=>filterTruthy(styles);
5
- const composeContainerStyles = (style)=>{
5
+ const composeContainerStylesForm = (style)=>{
6
6
  return composeStyles({
7
7
  ...style
8
8
  });
@@ -23,4 +23,4 @@ const popoverStyles = (builderProps)=>`
23
23
  }
24
24
  `;
25
25
 
26
- export { composeContainerStyles, composeFormStyles, popoverStyles };
26
+ export { composeContainerStylesForm, composeFormStyles, popoverStyles };
@@ -1,8 +1,9 @@
1
1
  import { contactInitConfig } from './ContactInitConfig.js';
2
- import config$1 from '../newsletter/Newsletter.js';
2
+ import { SettingUIV2 } from './configs/uiV2.js';
3
+ import { SettingUIV1 } from './configs/uiV1.js';
4
+ import ContactSettings from './configs/settings.js';
3
5
 
4
6
  // TODO VICTOR
5
- // @ts-nocheck
6
7
  const config = {
7
8
  tag: 'ContactForm',
8
9
  label: 'Contact Form',
@@ -16,19 +17,9 @@ const config = {
16
17
  <path d="M2.28223 19.5C1.86801 19.5 1.53223 19.8358 1.53223 20.25C1.53223 20.6642 1.86801 21 2.28223 21H21.7498C22.164 21 22.4998 20.6642 22.4998 20.25C22.4998 19.8358 22.164 19.5 21.7498 19.5H2.28223Z" fill="white"/>
17
18
  </svg>
18
19
  `,
19
- settings: [
20
- {
21
- id: 'setting',
22
- note: `This element sends submissions to <a class="no-underline text-primary-250" target="_blank" href="https://help.shopify.com/en/manual/customers/manage-customers#email-customers">the sender email address</a>`,
23
- controls: config$1.settings?.find((item)=>item.id === 'setting')?.controls || []
24
- },
25
- {
26
- id: 'style',
27
- controls: config$1.settings?.find((item)=>item.id === 'style')?.controls || []
28
- }
29
- ],
30
- ui: config$1.ui,
31
- uiV2: config$1.uiV2,
20
+ settings: ContactSettings,
21
+ ui: SettingUIV1,
22
+ uiV2: SettingUIV2,
32
23
  presets: [
33
24
  {
34
25
  id: 'contact',
@@ -238,7 +238,7 @@ const contactInitConfig = [
238
238
  {
239
239
  tag: 'SubmitButton',
240
240
  settings: {
241
- label: 'Send'
241
+ label: 'Submit'
242
242
  },
243
243
  styles: {
244
244
  roundedBtn: {
@@ -0,0 +1,202 @@
1
+ const ContactSettings = [
2
+ {
3
+ id: 'setting',
4
+ note: `This element sends submissions to <a class="no-underline text-primary-250" target="_blank" href="https://help.shopify.com/en/manual/customers/manage-customers#email-customers">the sender email address</a>`,
5
+ controls: [
6
+ {
7
+ id: 'callbackURL',
8
+ type: 'pick-link',
9
+ label: 'Pick Link',
10
+ customLabel: {
11
+ en: 'Action'
12
+ },
13
+ default: {
14
+ type: 'stay-on-page',
15
+ link: '',
16
+ target: '_self'
17
+ },
18
+ hiddenOptions: {
19
+ 'scroll-to': true,
20
+ 'open-popup': true,
21
+ 'send-email': true,
22
+ 'call-phone': true
23
+ }
24
+ },
25
+ {
26
+ id: 'successMessage',
27
+ type: 'textarea',
28
+ label: 'Success Message',
29
+ default: "Thanks for contacting us. We'll get back to you as soon as possible.",
30
+ autoHeight: true,
31
+ minHeight: 58
32
+ },
33
+ {
34
+ id: 'successColor',
35
+ type: 'color-picker-v2',
36
+ label: 'Color',
37
+ default: '#00A042'
38
+ },
39
+ {
40
+ id: 'errorMessage',
41
+ type: 'textarea',
42
+ label: 'Error Message',
43
+ default: 'Can’t send email. Please try again later.',
44
+ autoHeight: true,
45
+ minHeight: 58
46
+ },
47
+ {
48
+ id: 'errorColor',
49
+ type: 'color-picker-v2',
50
+ label: 'Color',
51
+ default: '#F44336'
52
+ },
53
+ {
54
+ id: 'translate',
55
+ type: 'input',
56
+ default: 'successMessage,errorMessage'
57
+ },
58
+ {
59
+ id: 'background',
60
+ type: 'background-media',
61
+ ignoreReRender: true,
62
+ hideImage: true,
63
+ devices: {
64
+ desktop: {
65
+ default: {
66
+ type: 'color',
67
+ color: 'transparent'
68
+ }
69
+ }
70
+ },
71
+ compoDefaultValue: {
72
+ desktop: {
73
+ default: {
74
+ type: 'color',
75
+ color: '#E2E2E2'
76
+ }
77
+ }
78
+ }
79
+ },
80
+ {
81
+ id: 'width',
82
+ type: 'input:unit',
83
+ label: 'Width',
84
+ placeholder: 'Auto Width',
85
+ min: 0,
86
+ units: [
87
+ 'px',
88
+ '%'
89
+ ],
90
+ hide: true,
91
+ devices: {
92
+ desktop: {
93
+ default: '480px'
94
+ }
95
+ }
96
+ },
97
+ {
98
+ id: 'size',
99
+ label: 'Field size',
100
+ type: 'size',
101
+ default: {
102
+ type: 'medium'
103
+ },
104
+ ignoreReRender: true
105
+ },
106
+ {
107
+ id: 'afterSubmitActionToggle',
108
+ type: 'toggle',
109
+ label: 'Action after submit',
110
+ devices: {
111
+ desktop: {
112
+ default: false
113
+ }
114
+ }
115
+ },
116
+ // {
117
+ // id: 'fullWidth',
118
+ // label: 'Full Width',
119
+ // type: 'toggle',
120
+ // devices: {
121
+ // desktop: {
122
+ // default: true,
123
+ // },
124
+ // },
125
+ // },
126
+ {
127
+ id: 'afterSubmitAction',
128
+ type: 'select',
129
+ options: [
130
+ {
131
+ label: 'Stay on page',
132
+ value: 'stay-on-page'
133
+ },
134
+ {
135
+ label: 'Open URL',
136
+ value: 'open-url'
137
+ }
138
+ ],
139
+ default: 'stay-on-page'
140
+ }
141
+ ]
142
+ },
143
+ {
144
+ id: 'style',
145
+ controls: [
146
+ {
147
+ id: 'globalSize',
148
+ type: 'size-setting',
149
+ devices: {
150
+ desktop: {
151
+ default: {
152
+ width: 'Auto',
153
+ height: 'Auto',
154
+ padding: {
155
+ type: 'medium',
156
+ top: '12px',
157
+ bottom: '12px',
158
+ left: '24px',
159
+ right: '24px'
160
+ }
161
+ }
162
+ }
163
+ },
164
+ settingConfig: {
165
+ width: {
166
+ displayOptions: [
167
+ 'full',
168
+ 'auto',
169
+ 'small',
170
+ 'large',
171
+ 'medium'
172
+ ],
173
+ sizeConfig: {
174
+ small: '100px',
175
+ medium: '116px',
176
+ large: '132px'
177
+ }
178
+ },
179
+ height: {
180
+ displayOptions: [
181
+ 'auto',
182
+ 'small',
183
+ 'large',
184
+ 'medium'
185
+ ],
186
+ sizeConfig: {
187
+ small: '28px',
188
+ medium: '36px',
189
+ large: '44px'
190
+ }
191
+ }
192
+ },
193
+ hiddenSettings: [
194
+ 'shape',
195
+ 'gap'
196
+ ]
197
+ }
198
+ ]
199
+ }
200
+ ];
201
+
202
+ export { ContactSettings as default };
@@ -0,0 +1,74 @@
1
+ const SettingUIV1 = [
2
+ {
3
+ type: 'group',
4
+ label: {
5
+ en: 'After submit'
6
+ },
7
+ controls: [
8
+ {
9
+ type: 'control',
10
+ label: {
11
+ en: 'Action'
12
+ },
13
+ setting: {
14
+ id: 'afterSubmitAction'
15
+ }
16
+ },
17
+ {
18
+ type: 'control',
19
+ label: {
20
+ en: ''
21
+ },
22
+ layout: 'vertical',
23
+ setting: {
24
+ id: 'callbackURL'
25
+ },
26
+ condition: `afterSubmitAction == 'open-url'`
27
+ }
28
+ ]
29
+ },
30
+ {
31
+ type: 'group',
32
+ label: {
33
+ en: 'Success message'
34
+ },
35
+ controls: [
36
+ {
37
+ type: 'control',
38
+ label: {
39
+ en: 'Message'
40
+ },
41
+ options: {
42
+ labelPosition: 'start'
43
+ },
44
+ layout: 'vertical',
45
+ setting: {
46
+ id: 'successMessage'
47
+ }
48
+ }
49
+ ]
50
+ },
51
+ {
52
+ type: 'group',
53
+ label: {
54
+ en: 'Error message'
55
+ },
56
+ controls: [
57
+ {
58
+ type: 'control',
59
+ label: {
60
+ en: 'Message'
61
+ },
62
+ options: {
63
+ labelPosition: 'start'
64
+ },
65
+ layout: 'vertical',
66
+ setting: {
67
+ id: 'errorMessage'
68
+ }
69
+ }
70
+ ]
71
+ }
72
+ ];
73
+
74
+ export { SettingUIV1 };
@@ -0,0 +1,239 @@
1
+ const SettingUIV2 = [
2
+ {
3
+ label: {
4
+ en: 'Message'
5
+ },
6
+ controls: [
7
+ {
8
+ type: 'combo',
9
+ label: {
10
+ en: 'Success'
11
+ },
12
+ iconName: 'polaris-text-block',
13
+ getValueFromSettingID: 'successMessage',
14
+ isHideClear: true,
15
+ disableScrollbar: true,
16
+ popoverLabel: {
17
+ en: 'Success message'
18
+ },
19
+ controls: [
20
+ {
21
+ layout: 'vertical',
22
+ label: {
23
+ en: 'Content'
24
+ },
25
+ setting: {
26
+ id: 'successMessage'
27
+ }
28
+ },
29
+ {
30
+ setting: {
31
+ id: 'successColor'
32
+ },
33
+ label: {
34
+ en: 'Color'
35
+ }
36
+ }
37
+ ]
38
+ },
39
+ {
40
+ type: 'combo',
41
+ label: {
42
+ en: 'Error'
43
+ },
44
+ iconName: 'polaris-text-block',
45
+ getValueFromSettingID: 'errorMessage',
46
+ isHideClear: true,
47
+ disableScrollbar: true,
48
+ popoverLabel: {
49
+ en: 'Error message'
50
+ },
51
+ controls: [
52
+ {
53
+ layout: 'vertical',
54
+ label: {
55
+ en: 'Content'
56
+ },
57
+ setting: {
58
+ id: 'errorMessage'
59
+ }
60
+ },
61
+ {
62
+ setting: {
63
+ id: 'errorColor'
64
+ },
65
+ label: {
66
+ en: 'Color'
67
+ }
68
+ }
69
+ ]
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ label: {
75
+ en: 'Size'
76
+ },
77
+ controls: [
78
+ {
79
+ id: 'Width',
80
+ label: {
81
+ en: 'Width'
82
+ },
83
+ controlConfig: {
84
+ id: 'width',
85
+ type: 'dropdown:input',
86
+ label: 'Width',
87
+ inputType: 'number',
88
+ units: [
89
+ 'px',
90
+ '%'
91
+ ],
92
+ hideUnit: false,
93
+ linkWithSetting: {
94
+ name: 'globalSize',
95
+ field: 'width'
96
+ },
97
+ displayOptions: [
98
+ {
99
+ label: 'Fit content',
100
+ value: 'Auto',
101
+ showValue: true
102
+ }
103
+ ]
104
+ },
105
+ layout: 'horizontal'
106
+ },
107
+ {
108
+ label: {
109
+ en: 'Padding'
110
+ },
111
+ controlConfig: {
112
+ id: 'padding',
113
+ type: 'padding-v2',
114
+ linkWithSetting: {
115
+ name: 'globalSize',
116
+ field: 'padding'
117
+ },
118
+ compoDefaultValue: {
119
+ desktop: {
120
+ default: {
121
+ type: 'medium',
122
+ top: '12px',
123
+ bottom: '12px',
124
+ left: '24px',
125
+ right: '24px'
126
+ }
127
+ }
128
+ }
129
+ }
130
+ }
131
+ ]
132
+ },
133
+ {
134
+ label: {
135
+ en: 'Background'
136
+ },
137
+ controls: [
138
+ {
139
+ setting: {
140
+ id: 'background'
141
+ },
142
+ layout: 'vertical'
143
+ }
144
+ ]
145
+ },
146
+ {
147
+ label: {
148
+ en: 'Shape'
149
+ },
150
+ controls: [
151
+ {
152
+ label: {
153
+ en: 'Border'
154
+ },
155
+ setting: {
156
+ id: 'border',
157
+ state: 'normal'
158
+ }
159
+ },
160
+ {
161
+ label: {
162
+ en: 'Corner'
163
+ },
164
+ setting: {
165
+ id: 'rounded',
166
+ state: 'normal'
167
+ }
168
+ },
169
+ {
170
+ label: {
171
+ en: 'Shadow'
172
+ },
173
+ setting: {
174
+ id: 'boxShadow',
175
+ state: 'normal'
176
+ },
177
+ options: {
178
+ updateFields: [
179
+ {
180
+ field: 'enable',
181
+ settingId: 'hasBoxShadow',
182
+ state: 'normal'
183
+ }
184
+ ]
185
+ },
186
+ controlChangeTrigger: {
187
+ settings: [
188
+ {
189
+ condition: `boxShadow.normal.enable === true`,
190
+ source: [
191
+ 'boxShadow',
192
+ 'hasBoxShadow'
193
+ ],
194
+ action: {
195
+ controlId: 'hasBoxShadow',
196
+ groupType: 'advanced',
197
+ controlType: 'advanced',
198
+ state: 'normal',
199
+ newValue: true
200
+ }
201
+ },
202
+ {
203
+ condition: `boxShadow.normal.enable === false`,
204
+ source: [
205
+ 'boxShadow',
206
+ 'hasBoxShadow'
207
+ ],
208
+ action: {
209
+ controlId: 'hasBoxShadow',
210
+ groupType: 'advanced',
211
+ controlType: 'advanced',
212
+ state: 'normal',
213
+ newValue: false
214
+ }
215
+ }
216
+ ],
217
+ options: {
218
+ noRecordHistory: true
219
+ }
220
+ }
221
+ }
222
+ ]
223
+ },
224
+ {
225
+ label: {
226
+ en: 'After submit'
227
+ },
228
+ controls: [
229
+ {
230
+ layout: 'vertical',
231
+ setting: {
232
+ id: 'callbackURL'
233
+ }
234
+ }
235
+ ]
236
+ }
237
+ ];
238
+
239
+ export { SettingUIV2 };
@@ -47,7 +47,7 @@ const config = {
47
47
  editor: {
48
48
  en: {
49
49
  err_msg_default: 'Can’t send email. Please try again later.',
50
- success_msg_default: `Thanks for contacting us. We'll get back to you as soon as possible.`
50
+ success_msg_default: `Thanks for subscribing`
51
51
  }
52
52
  }
53
53
  }