PluginProbe
MailerLite – WooCommerce integration / trunk
MailerLite – WooCommerce integration vtrunk
3.1.27 3.1.25 3.1.26 3.1.24 3.1.23 3.1.22 3.1.21 3.1.20 3.1.19 3.1.18 3.1.17 3.1.16 3.1.15 1.8.7 1.8.8 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 All 148 releases
woo-mailerlite / admin / assets / js / components / Views / Settings.js

Settings.js in MailerLite – WooCommerce integration trunk, at admin/assets/js/components/Views/Settings.js

579 lines 29.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import CustomSelect from '../Forms/CustomSelect.js';
2 import SyncFields from '../Forms/SyncFields.js';
3 import eventBus from '../eventBus.js';
4 import ApiMixin from '../Api/ApiMixin.js';
5 import { loadStart, loadEnd } from "../Plugins/Loader.js";
6
7 const POSTHOG_SURVEY_URL = 'https://eu.posthog.com/external_surveys/019f4c72-484a-0000-6cf7-722469ae076c';
8
9 const template = `
10 <div v-if="syncInProgress || asyncSyncInProgress" class="woo-ml-sync-loading-container" data-testid="sync-in-progress">
11 <strong>Sync in progress...</strong>
12 <p>This will continue as long as you stay on this page.
13 You can always come back, and it will start again.</p>
14 <div class="woo-ml-sync-progress-bar"></div>
15 </div>
16 <form method="post" id="updateSettingsForm">
17 <div class="settings-block">
18 <div class="woo-ml-survey-card" v-if="shouldShowSurvey">
19 <p class="woo-ml-survey-title">How are you finding this integration so far?</p>
20 <div class="woo-ml-survey-emojis">
21 <button type="button" @click="openSurvey" class="woo-ml-survey-emoji" title="Very unsatisfied">😫</button>
22 <button type="button" @click="openSurvey" class="woo-ml-survey-emoji" title="Unsatisfied">😠</button>
23 <button type="button" @click="openSurvey" class="woo-ml-survey-emoji" title="Somewhat unsatisfied">😕</button>
24 <button type="button" @click="openSurvey" class="woo-ml-survey-emoji" title="Neutral">😐</button>
25 <button type="button" @click="openSurvey" class="woo-ml-survey-emoji" title="Somewhat satisfied">🙂</button>
26 <button type="button" @click="openSurvey" class="woo-ml-survey-emoji" title="Satisfied">😊</button>
27 <button type="button" @click="openSurvey" class="woo-ml-survey-emoji" title="Very satisfied">🤩</button>
28 </div>
29 <div class="woo-ml-survey-labels">
30 <span>Very unsatisfied</span>
31 <span>Very satisfied</span>
32 </div>
33 </div>
34 <div class="woo-ml-survey-card" v-if="shouldShowSurveyThanks">
35 <p class="woo-ml-survey-title">Thanks for sharing!</p>
36 <p class="woo-ml-survey-thanks-text"><a href="${POSTHOG_SURVEY_URL}" target="_blank" rel="noopener noreferrer">Relaunch survey</a></p>
37 </div>
38 <div class="settings-block-fixed">
39
40 <h2 class="settings-block-header">Synchronization settings</h2>
41 <div class="form-group-ml vertical">
42 <label for="wooMlSubGroup" class="settings-label mb-3-ml">Subscriber group</label>
43 <label class="input-mailerlite mb-2-ml" style="display: flex;">
44 <custom-select
45 id="wooMlSubGroup"
46 name="subscriber-group"
47 :options="groups"
48 v-model="selectedGroup"
49 modelValue="selectedGroup"
50 :selectedGroup="selectedGroup"
51 placeholder="Select group"
52 ></custom-select>
53 <button @click="createGroup" id="createGroupModal" type="button" class="btn-secondary-ml" style="margin-left: 0.5rem; white-space: nowrap;">Create group</button>
54 </label>
55 <label class="settings-label-small">Subscribers from WooCommerce will join this MailerLite
56 subscriber group. </label>
57 </div>
58
59 <div class="form-group-ml vertical">
60 <label for="wooMlSubGroup" class="settings-label flex-ml align-items-center-ml mb-3-ml">Ignore products list
61 <div class="tooltip-ml">
62 <span class="tooltiptext-ml">This field lists products that are configured to be ignored in MailerLite e-commerce automation. To add or remove a product from this list, go to the WordPress product list and click "Quick Edit" on the relevant item.</span>
63 </div>
64 </label>
65 <label v-if="ignoredProducts.length !== 0" class="input-mailerlite" style="cursor: default;">
66 <div multiple name="ignore_product_list"
67 style="min-height: 26px; padding-left: 8px; display: flex; flex-direction: row; overflow: hidden; flex-wrap: wrap; padding: 4px; padding-top: 0; border: 1px solid #d1d5db; border-radius: 0.25rem;">
68 <span v-for="(item, index) in ignoredProducts" :key="index" style="background-color: #e5e7eb; padding: 2px 5px; border-radius: 2px; font-size: 13px; margin-right: 4px; margin-top: 4px;">{{ item }}</span>
69 </div>
70 </label>
71 <a v-else :href="productsUrl">
72 <button type="button" class="btn btn-secondary-ml flex-start-ml">Go to your products</button>
73 </a>
74 </div>
75 <div class="form-group-ml vertical">
76 <label for="wooMlSubGroup" class="settings-label flex-ml align-items-center-ml mb-3-ml">Add language
77 field
78 <div class="tooltip-ml">
79 <span class="tooltiptext-ml">Collect subscriber languages in a hidden field stored in MailerLite.</span>
80 </div>
81 </label>
82 <div class="checkbox-text-ml">
83 <input type="checkbox"
84 class="woo-ml-form-checkbox" v-model="settings.languageField"
85 name="additional_sub_fields"
86 value="yes"
87 id="language_field_checkbox"
88 />
89 <label for="language_field_checkbox" class="settings-label-medium">Collect subscriber language data.</label>
90 </div>
91 </div>
92 <div class="form-group-ml vertical">
93 <label for="sync_fields" class="settings-label flex-ml align-items-center-ml mb-3-ml">
94 Synced fields
95 <div class="tooltip-ml">
96 <span class="tooltiptext-ml">Select which fields you would like to sync. Please note that Email and Name fields are mandatory.</span>
97 </div>
98 </label>
99 <label class="input-mailerlite" data-testid="settings-sync-fields">
100 <sync-fields
101 id="sync_fields"
102 multiple="multiple"
103 data-placeholder="Click to select fields you want to sync"
104 style="width: 100%;"
105 :options="syncFields"
106 v-model="selectedSyncFields"
107 />
108 </label>
109 </div>
110 <div class="form-group-ml vertical">
111 <label for="wooMlSubGroup" class="settings-label flex-ml align-items-center-ml mb-3-ml">Synchronize
112 store
113 <div class="tooltip-ml">
114 <span class="tooltiptext-ml">Synchronize categories, products and customer data that hasn't been submitted to MailerLite.</span>
115 </div>
116 </label>
117 <p v-if="!accountConnected" class="description">
118 Plugin not connected to MailerLite yet.
119 </p>
120 <button @click.prevent="resetSync" v-if="!totalUntrackedResources && !syncInProgress" type="button" class="btn btn-secondary-ml flex-start-ml"
121 data-woo-ml-reset-resources-sync="true" ref="resetSyncBtn"><span class="woo-ml-button-text">Reset synchronized resources</span>
122 </button>
123 <button @click.prevent="startSync" v-if="totalUntrackedResources && !syncInProgress" type="button" class="btn btn-secondary-ml flex-start-ml"
124 data-woo-ml-reset-resources-sync="true" ref="startSync" data-testid="sync-untracked-resources-btn"><span class="woo-ml-button-text">Synchronize {{ totalUntrackedResources }} untracked resources</span>
125 </button>
126 </div>
127 </div>
128 </div>
129
130 <div class="settings-block">
131 <div class="settings-block-fixed">
132 <h2 class="settings-block-header">Checkout settings</h2>
133 <div class="form-group-ml vertical">
134 <label for="wooMlSubGroup" class="settings-label mb-3-ml">Subscribe on checkout</label>
135 <div class="checkbox-text-ml">
136 <input type="checkbox"
137 class="woo-ml-form-checkbox" v-model="settings.subscribeOnCheckout"
138 name="checkout"
139 value="yes"
140 id="subscribe_checkout_checkbox"
141 data-testid="subscribe-checkout-checkbox"
142 />
143 <label for="subscribe_checkout_checkbox" class="settings-label-medium">Enable list subscription via checkout page.</label>
144 </div>
145 </div>
146 <div class="checkout-settings-group" :style="{ display: !settings.subscribeOnCheckout ? 'none' : 'block' }">
147 <div class="form-group-ml vertical">
148 <label for="wooMlSubGroup" class="settings-label mb-3-ml"> Resubscribe</label>
149 <div class="checkbox-text-ml">
150 <input type="checkbox"
151 class="woo-ml-form-checkbox" v-model="settings.resubscribe"
152 name="resubscribe"
153 value="yes"
154 id="resubscribe_checkbox"
155 />
156 <label for="resubscribe_checkbox" class="settings-label-medium"> Allow unsubscribers to rejoin the email list if they
157 resubscribe via the checkout page.</label>
158 </div>
159 </div>
160 <div class="form-group-ml vertical">
161 <label for="wooMlSubGroup" class="settings-label mb-3-ml">Subscribe checkbox position</label>
162 <label class="input-mailerlite">
163 <select
164 class="woo-ml-native-select"
165 name="checkout_position"
166 :disabled="!settings.subscribeOnCheckout"
167 v-model="settings.selectedCheckoutPosition"
168 >
169 <option
170 v-for="(checkoutPosition, key) in checkoutPositions"
171 :key="key"
172 :value="key"
173 >
174 {{ checkoutPosition }}
175 </option>
176 </select>
177 </label>
178 </div>
179 <div class="form-group-ml vertical">
180 <label for="wooMlSubGroup" class="settings-label mb-3-ml">Pre-select subscribe checkbox</label>
181 <div class="checkbox-text-ml">
182 <input type="checkbox"
183 class="woo-ml-form-checkbox" v-model="settings.checkoutPreselect"
184 name="checkout_preselect"
185 value="yes"
186 id="preselect_subscribe_checkbox"
187 :disabled="!settings.subscribeOnCheckout"
188 />
189 <label for="preselect_subscribe_checkbox" class="settings-label-medium">Pre-select the signup checkbox by default.</label>
190 </div>
191 </div>
192 <div class="form-group-ml vertical">
193 <label for="wooMlSubGroup" class="settings-label mb-3-ml">Hide subscribe checkbox</label>
194 <div class="checkbox-text-ml">
195 <input type="checkbox"
196 class="woo-ml-form-checkbox" v-model="settings.checkoutHidden"
197 name="checkout_hide"
198 value="yes"
199 id="hide_subscriber_checkbox"
200 :disabled="!settings.subscribeOnCheckout"
201 />
202 <label for="hide_subscriber_checkbox" class="settings-label-medium">Check to hide the checkbox. All customers will be
203 subscribed automatically.</label>
204 </div>
205 </div>
206 <div class="form-group-ml vertical">
207 <label for="wooMlSubGroup" class="settings-label mb-3-ml">Subscribe checkbox label</label>
208 <label class="input-mailerlite">
209 <input type="text"
210 class="woo-ml-form-checkbox text-input flex-start-ml mb-3-ml"
211 v-model="settings.checkoutLabel"
212 name="checkout_label"
213 placeholder="I.e. I want to receive your newsletter."
214 :disabled="!settings.subscribeOnCheckout"
215 />
216 </label>
217 <label class="settings-label-small">This text will be displayed next to the signup
218 checkbox. </label>
219 </div>
220 <div class="form-group-ml vertical">
221 <label for="wooMlSubGroup" class="settings-label flex-ml align-items-center-ml mb-3-ml">Add subscribers after checkout
222 <div class="tooltip-ml">
223 <span class="tooltiptext-ml">Only customers that have completed the checkout process will be added to your MailerLite account as subscribers. Enabling this option disables abandoned cart functionality.</span>
224 </div>
225 </label>
226 <div class="checkbox-text-ml">
227 <input type="checkbox"
228 class="woo-ml-form-checkbox" v-model="settings.syncAfterCheckout"
229 name="disable_checkout_sync"
230 value="yes"
231 id="synchronize_after_checkout_checkbox"
232 :disabled="!settings.subscribeOnCheckout"
233 />
234 <label for="synchronize_after_checkout_checkbox" class="settings-label-medium">Add subscribers to your MailerLite account after the checkout process has been completed.</label>
235 </div>
236 <div class="woo-ml-alert-warning-small" :style="{ display: !settings.subscribeOnCheckout ? 'flex' : 'none' }"> align-items: center;">
237 <svg width="12" height="12" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10,0 C15.5228475,0 20,4.4771525 20,10 C20,15.5228475 15.5228475,20 10,20 C4.4771525,20 0,15.5228475 0,10 C0,4.4771525 4.4771525,0 10,0 Z M10,2 C5.581722,2 2,5.581722 2,10 C2,14.418278 5.581722,18 10,18 C14.418278,18 18,14.418278 18,10 C18,5.581722 14.418278,2 10,2 Z M10,12 C10.5522847,12 11,12.4477153 11,13 C11,13.5522847 10.5522847,14 10,14 C9.44771525,14 9,13.5522847 9,13 C9,12.4477153 9.44771525,12 10,12 Z M10,5 C10.5522847,5 11,5.44771525 11,6 L11,10 C11,10.5522847 10.5522847,11 10,11 C9.44771525,11 9,10.5522847 9,10 L9,6 C9,5.44771525 9.44771525,5 10,5 Z" fill-rule="nonzero"></path></svg>
238 Enabling this option disables abandoned cart functionality.</div>
239 </div>
240 </div>
241 </div>
242 </div>
243
244 <div class="settings-block">
245 <div class="settings-block-fixed">
246 <h2 class="settings-block-header">General settings</h2>
247 <div class="form-group-ml vertical">
248 <label for="wooMlSubGroup" class="settings-label flex-ml align-items-center-ml mb-3-ml">Double opt-in
249 <div class="tooltip-ml">
250 <span class="tooltiptext-ml">Changing this setting will automatically update your double opt-in setting for your MailerLite account.</span>
251 </div>
252 </label>
253 <div class="checkbox-text-ml">
254 <input type="checkbox"
255 class="woo-ml-form-checkbox" v-model="settings.doubleOptIn"
256 name="double_optin"
257 value="yes"
258 id="double_optin_checkbox"
259 />
260 <label for="double_optin_checkbox" class="settings-label-medium">Check to enforce email confirmation before being added
261 to your list.</label>
262 </div>
263 </div>
264 <div class="form-group-ml vertical">
265 <label for="wooMlSubGroup" class="settings-label mb-3-ml"> MailerLite pop-ups</label>
266 <div class="checkbox-text-ml">
267 <input type="checkbox"
268 class="woo-ml-form-checkbox" v-model="settings.popUps"
269 name="popups"
270 value="yes"
271 id="mailerlite_popups_checkbox"
272 />
273 <label for="mailerlite_popups_checkbox" class="settings-label-medium">Enable MailerLite pop-up forms. <a href="https://www.mailerlite.com/features/popups" target="_blank">Learn more.</a></label>
274 </div>
275 </div>
276 <div class="form-group-ml vertical">
277 <label for="wooMlSubGroup" class="settings-label mb-3-ml">Auto updates</label>
278 <div class="checkbox-text-ml">
279 <input type="checkbox"
280 class="woo-ml-form-checkbox" v-model="settings.autoUpdatePlugin"
281 name="auto_update_plugin"
282 value="yes"
283 id="autoupdate_plugin_checkbox"
284 />
285 <label for="autoupdate_plugin_checkbox" class="settings-label-medium">Receive automatic plugin updates.</label>
286 </div>
287 </div>
288 </div>
289 </div>
290
291 <div style="display: flex; justify-content: flex-end; margin-top: 2rem;">
292 <button @click.prevent="updateSettings" :class="{ 'woo-ml-button-loading': isLoading }" :disabled="isLoading" type="submit" class="btn-primary-ml" style="margin-top: 2rem;" id="updateSettingsBtn" data-testid="update-settings-btn"><span class="woo-ml-button-text">Save changes</span></button>
293 </div>
294 <div class="settings-block">
295 <div class="woo-ml-wizard card-between">
296 <div class="flex-start-ml">
297 <h2 class="settings-block-header" style="margin-top:0; margin-bottom: 8px;">Debug logs</h2>
298 <label class="settings-label-medium">This is an advanced troubleshooting method which gives a deeper insight and helps our support team to identify problems.</label>
299 <div class="mt-6-ml">
300 <button type="button" @click.prevent="openDebugLog" ref="openDebugLog" class="btn-secondary-ml mr-2-ml"><span class="woo-ml-button-text">Open debug logs</span></button>
301 <button v-if="platform == 1" type="button" id="enableDebugMode" ref="enableDebugMode" @click.prevent="enableDebugMode" :class="debugMode ? 'btn-danger-ml' : 'btn-primary-ml'"><span class="woo-ml-button-text">{{debugMode ? 'Disable debug mode' : 'Enable debug mode'}}</span></button>
302 </div>
303 </div>
304
305
306 </div>
307 <div class="woo-ml-wizard card-between">
308 <div>
309 <h2 class="settings-block-header" style="margin-top:0; margin-bottom: 8px;">Reset integration</h2>
310 <label class="settings-label-medium">Once you click on the "Reset integration" button this action will reset
311 all integration configurations and the process can not be reverted.</label>
312 </div>
313 <button type="button" ref="resetIntegration" @click.prevent="resetIntegration" class="btn-danger-ml"><span class="woo-ml-button-text">Reset integration</span></button>
314 </div>
315 </div>
316 </form>
317 `;
318
319 const Settings = {
320 components: {
321 CustomSelect,
322 SyncFields
323 },
324 template,
325 mixins: [ApiMixin],
326 props: {
327 group: {
328 type: Object,
329 required: false
330 },
331 fields: {
332 type: Array,
333 required: false
334 },
335 },
336 data() {
337 return {
338 ignoredProducts: woo_mailerlite_admin_data.ignoredProducts,
339 productsUrl: woo_mailerlite_admin_data.productsUrl,
340 groups: [
341 {
342 value: 1,
343 text: 'Group 1'
344 },
345 {
346 value: 2,
347 text: 'Group 2'
348 },
349 {
350 value: 3,
351 text: 'Group 3'
352 },
353 ],
354 selectedGroup: woo_mailerlite_admin_data.selectedGroup ?? null,
355 syncFields: [
356 {
357 value: 'name',
358 text: 'Name',
359 default: true
360 },
361 {
362 value: 'email',
363 text: 'Email',
364 default: true
365 },
366 {
367 value: 'company',
368 text: 'Company'
369 },
370 {
371 value: 'city',
372 text: 'City'
373 },
374 {
375 value: 'zip',
376 text: 'ZIP'
377 },
378 {
379 value: 'state',
380 text: 'State'
381 },
382 {
383 value: 'country',
384 text: 'Country'
385 },
386 {
387 value: 'phone',
388 text: 'Phone'
389 },
390 ],
391 accountConnected: true,
392 totalTrackedResources: 0,
393 totalUntrackedResources: woo_mailerlite_admin_data.sync.totalUntrackedResources ?? 0,
394 syncInProgress: woo_mailerlite_admin_data.sync.syncInProgress,
395 lastCustomerSync: 1,
396 newMLSync: 0,
397 settings: {
398 languageField: false,
399 subscribeOnCheckout: false,
400 resubscribe: false,
401 selectedCheckoutPosition: woo_mailerlite_admin_data.selectedCheckoutPosition ?? 'checkout_billing',
402 checkoutPreselect: false,
403 checkoutHidden: false,
404 syncAfterCheckout: false,
405 checkoutLabel: 'Yes, I want to receive your newsletter.',
406 doubleOptIn: false,
407 popUps: false,
408 autoUpdatePlugin: false,
409 },
410 debugMode: woo_mailerlite_admin_data?.debugMode ?? false,
411 platform: woo_mailerlite_admin_data?.account?.platform === 'rewrite' ? 1 : 2,
412 checkoutPositions: {
413 'checkout_billing': 'After billing details',
414 'checkout_billing_email': 'After billing email address',
415 'checkout_shipping': 'After shipping details',
416 'checkout_after_customer_details': 'After customer details',
417 'review_order_before_submit': 'Before submit button',
418 },
419 isLoading: false,
420 selectedSyncFields: [],
421 asyncSyncInProgress: woo_mailerlite_admin_data.asyncSync,
422 surveyClicked: false,
423 surveyFirstSeen: null,
424 }
425 },
426 mounted() {
427 eventBus.on('sync-completed', (sync) => {
428 this.syncInProgress = false
429 this.totalUntrackedResources = 0
430 });
431 eventBus.on('reset-completed', (untracked) => {
432 this.totalUntrackedResources = untracked
433 });
434
435 eventBus.on('reset-integration', (untracked) => {
436 this.resetPlugin()
437 });
438
439 },
440 created() {
441 if (woo_mailerlite_admin_data && woo_mailerlite_admin_data.settings) {
442 this.settings = {
443 ...this.settings,
444 ...woo_mailerlite_admin_data.settings,
445 };
446 }
447 const defaultValues = this.syncFields
448 .filter((opt) => opt.default)
449 .map((opt) => opt.value);
450 this.selectedSyncFields = [...new Set([...this.selectedSyncFields, ...defaultValues])];
451 this.selectedSyncFields = [...new Set([...this.selectedSyncFields, ...woo_mailerlite_admin_data.syncFields ?? []])];
452
453 if (this.fields) {
454 this.selectedSyncFields = [...new Set([...this.selectedSyncFields, ...this.fields])];
455 }
456 if (this.group) {
457 this.selectedGroup = this.group;
458 }
459 this.surveyClicked = localStorage.getItem('woo_ml_survey_clicked') === '1';
460
461 if (localStorage.getItem('woo_ml_survey_first_seen') === null) {
462 localStorage.setItem('woo_ml_survey_first_seen', new Date().toISOString());
463 }
464 this.surveyFirstSeen = localStorage.getItem('woo_ml_survey_first_seen');
465 },
466 computed: {
467 surveyActive() {
468 if (this.surveyFirstSeen === null) {
469 return false;
470 }
471
472 const expiry = new Date(this.surveyFirstSeen);
473 expiry.setDate(expiry.getDate() + 10);
474
475 return new Date() < expiry;
476 },
477 shouldShowSurvey() {
478 if (this.surveyClicked) {
479 return false;
480 }
481
482 return this.surveyActive;
483 },
484 shouldShowSurveyThanks() {
485 if (this.surveyClicked) {
486 return this.surveyActive;
487 }
488
489 return false;
490 },
491 syncMessage() {
492 const count = this.totalUntrackedResources;
493 return count === 1
494 ? `Synchronize ${count} untracked resource`
495 : `Synchronize ${count} untracked resources`;
496 },
497 syncFieldsComputed() {
498
499 return this.fields.length ? this.fields : (woo_mailerlite_admin_data.syncFields ?? []) ?? [];
500 },
501 },
502 methods: {
503 async updateSettings() {
504 this.isLoading = true
505
506 try {
507 this.settings.group = this.selectedGroup;
508 this.syncFields = this.selectedSyncFields;
509
510 this.settings.syncFields = this.syncFields
511 const data = await this.saveSettings(this.settings);
512
513 this.isLoading = false
514 if (data.success) {
515 eventBus.emit('alert-event', { success: data.message ?? "" });
516 } else {
517 eventBus.emit('alert-event', { error: data.message ?? "" });
518 }
519 } catch (err) {
520 this.isLoading = false
521 let error = 'An error occurred'
522 if (err.match('401 - Unauthorized')) {
523 error = 'Please reset the plugin and setup again!'
524 }
525 eventBus.emit('alert-event', { error: error });
526 }
527 },
528 async resetSync() {
529 loadStart(this.$refs.resetSyncBtn)
530 const resetData = await this.resetResources()
531 loadEnd(this.$refs.resetSyncBtn)
532 eventBus.emit('reset-completed', resetData.data?.totalUntrackedResources ?? 0);
533 },
534 syncResources() {
535 this.syncResources()
536 },
537 openDebugLog() {
538 eventBus.emit('show-debug-modal', this.$refs.openDebugLog);
539 },
540 async resetIntegration() {
541 eventBus.emit('show-reset-modal', this.$refs.resetIntegration);
542 },
543 async resetPlugin() {
544 // reset-integration
545 loadStart(this.$refs.resetIntegration)
546 const response = await this.resetIntegrationSettings();
547 if (response.success) {
548 loadEnd(this.$refs.resetIntegration)
549 window.location.reload()
550 eventBus.emit('wizard-step-event', 0)
551 }
552 },
553 createGroup() {
554 eventBus.emit('show-create-group-modal', this.selectedGroup)
555 },
556 startSync() {
557 this.syncInProgress = true
558 eventBus.emit('start-sync')
559 },
560 async downgradePlugin() {
561 await this.downgrade()
562 },
563
564 async enableDebugMode() {
565 loadStart(this.$refs.enableDebugMode)
566 const response = await this.debugModeEnable()
567 this.debugMode = response
568 loadEnd(this.$refs.enableDebugMode)
569 },
570 openSurvey() {
571 this.surveyClicked = true;
572 localStorage.setItem('woo_ml_survey_clicked', '1');
573 window.open(POSTHOG_SURVEY_URL, '_blank', 'noopener,noreferrer');
574 },
575 }
576 };
577
578 export default Settings;
579