ordering-ui-admin-external 1.8.2 → 1.8.3

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.
@@ -1,8 +1,7 @@
1
- import React, { useEffect } from 'react'
1
+ import React from 'react'
2
2
  import { useLanguage } from 'ordering-components-admin-external'
3
3
  import { useTheme } from 'styled-components'
4
4
  import { AppLayout } from '../AppLayout'
5
- import { removeIntercom } from '../../../utils'
6
5
 
7
6
  export const StoreApp = () => {
8
7
  const [, t] = useLanguage()
@@ -27,12 +26,6 @@ export const StoreApp = () => {
27
26
  ]
28
27
  }
29
28
 
30
- useEffect(() => {
31
- return () => {
32
- removeIntercom()
33
- }
34
- }, [])
35
-
36
29
  return (
37
30
  <AppLayout appInfo={appInfo} />
38
31
  )
@@ -53,7 +53,8 @@ export const ImporterFormUI = (props) => {
53
53
  isMapping,
54
54
  headerTitle,
55
55
  handleUpdateMultipleMapping,
56
- defaultImporter
56
+ defaultImporter,
57
+ mappingState
57
58
  } = props
58
59
 
59
60
  const [, t] = useLanguage()
@@ -246,10 +247,10 @@ export const ImporterFormUI = (props) => {
246
247
  }
247
248
  }}
248
249
  placeholder='0'
249
- defaultValue={editState?.mapping?.business_id ?? ''}
250
250
  onChange={handleChangeMappingInput}
251
251
  disabled={formState.loading}
252
252
  autoComplete='off'
253
+ value={mappingState?.['business_id'] || ''}
253
254
  />
254
255
  </InputWrapper>
255
256
  </Col>
@@ -266,10 +267,10 @@ export const ImporterFormUI = (props) => {
266
267
  }
267
268
  }}
268
269
  placeholder='0'
269
- defaultValue={editState?.mapping?.external_business_id ?? ''}
270
270
  onChange={handleChangeMappingInput}
271
271
  disabled={formState.loading}
272
272
  autoComplete='off'
273
+ value={mappingState?.['external_business_id'] || ''}
273
274
  />
274
275
  </InputWrapper>
275
276
  </Col>
@@ -287,10 +288,10 @@ export const ImporterFormUI = (props) => {
287
288
  }
288
289
  }}
289
290
  placeholder='0'
290
- defaultValue={editState?.mapping?.category_id ?? ''}
291
291
  onChange={handleChangeMappingInput}
292
292
  disabled={formState.loading}
293
293
  autoComplete='off'
294
+ value={mappingState?.['category_id'] || ''}
294
295
  />
295
296
  </InputWrapper>
296
297
  </Col>
@@ -307,10 +308,10 @@ export const ImporterFormUI = (props) => {
307
308
  }
308
309
  }}
309
310
  placeholder='0'
310
- defaultValue={editState?.mapping?.external_category_id ?? ''}
311
311
  onChange={handleChangeMappingInput}
312
312
  disabled={formState.loading}
313
313
  autoComplete='off'
314
+ value={mappingState?.['external_category_id'] || ''}
314
315
  />
315
316
  </InputWrapper>
316
317
  </Col>
@@ -328,10 +329,10 @@ export const ImporterFormUI = (props) => {
328
329
  }
329
330
  }}
330
331
  placeholder='0'
331
- defaultValue={editState?.mapping?.external_parent_category_id ?? ''}
332
332
  onChange={handleChangeMappingInput}
333
333
  disabled={formState.loading}
334
334
  autoComplete='off'
335
+ value={mappingState?.['external_parent_category_id'] || ''}
335
336
  />
336
337
  </InputWrapper>
337
338
  </Col>
@@ -352,10 +353,10 @@ export const ImporterFormUI = (props) => {
352
353
  }
353
354
  }}
354
355
  placeholder='0'
355
- defaultValue={editState?.mapping?.product_id ?? ''}
356
356
  onChange={handleChangeMappingInput}
357
357
  disabled={formState.loading}
358
358
  autoComplete='off'
359
+ value={mappingState?.['product_id'] || ''}
359
360
  />
360
361
  </InputWrapper>
361
362
  </Col>
@@ -372,10 +373,10 @@ export const ImporterFormUI = (props) => {
372
373
  }
373
374
  }}
374
375
  placeholder='0'
375
- defaultValue={editState?.mapping?.external_product_id ?? ''}
376
376
  onChange={handleChangeMappingInput}
377
377
  disabled={formState.loading}
378
378
  autoComplete='off'
379
+ value={mappingState?.['external_product_id'] || ''}
379
380
  />
380
381
  </InputWrapper>
381
382
  </Col>
@@ -394,10 +395,10 @@ export const ImporterFormUI = (props) => {
394
395
  }
395
396
  }}
396
397
  placeholder='0'
397
- defaultValue={editState?.mapping?.extra_id ?? ''}
398
398
  onChange={handleChangeMappingInput}
399
399
  disabled={formState.loading}
400
400
  autoComplete='off'
401
+ value={mappingState?.['extra_id'] || ''}
401
402
  />
402
403
  </InputWrapper>
403
404
  </Col>
@@ -414,10 +415,10 @@ export const ImporterFormUI = (props) => {
414
415
  }
415
416
  }}
416
417
  placeholder='0'
417
- defaultValue={editState?.mapping?.external_extra_id ?? ''}
418
418
  onChange={handleChangeMappingInput}
419
419
  disabled={formState.loading}
420
420
  autoComplete='off'
421
+ value={mappingState?.['external_extra_id'] || ''}
421
422
  />
422
423
  </InputWrapper>
423
424
  </Col>
@@ -436,10 +437,10 @@ export const ImporterFormUI = (props) => {
436
437
  }
437
438
  }}
438
439
  placeholder='0'
439
- defaultValue={editState?.mapping?.extra_option_id ?? ''}
440
440
  onChange={handleChangeMappingInput}
441
441
  disabled={formState.loading}
442
442
  autoComplete='off'
443
+ value={mappingState?.['extra_option_id'] || ''}
443
444
  />
444
445
  </InputWrapper>
445
446
  </Col>
@@ -456,10 +457,10 @@ export const ImporterFormUI = (props) => {
456
457
  }
457
458
  }}
458
459
  placeholder='0'
459
- defaultValue={editState?.mapping?.external_extra_option_id ?? ''}
460
460
  onChange={handleChangeMappingInput}
461
461
  disabled={formState.loading}
462
462
  autoComplete='off'
463
+ value={mappingState?.['external_extra_option_id'] || ''}
463
464
  />
464
465
  </InputWrapper>
465
466
  </Col>
@@ -478,10 +479,10 @@ export const ImporterFormUI = (props) => {
478
479
  }
479
480
  }}
480
481
  placeholder='0'
481
- defaultValue={editState?.mapping?.extra_option_suboption_id ?? ''}
482
482
  onChange={handleChangeMappingInput}
483
483
  disabled={formState.loading}
484
484
  autoComplete='off'
485
+ value={mappingState?.['extra_option_suboption_id'] || ''}
485
486
  />
486
487
  </InputWrapper>
487
488
  </Col>
@@ -498,10 +499,10 @@ export const ImporterFormUI = (props) => {
498
499
  }
499
500
  }}
500
501
  placeholder='0'
501
- defaultValue={editState?.mapping?.external_extra_option_suboption_id ?? ''}
502
502
  onChange={handleChangeMappingInput}
503
503
  disabled={formState.loading}
504
504
  autoComplete='off'
505
+ value={mappingState?.['external_extra_option_suboption_id'] || ''}
505
506
  />
506
507
  </InputWrapper>
507
508
  </Col>
@@ -292,36 +292,6 @@ export const checkSiteUrl = (url, fallback) => {
292
292
  return url[url?.length - 1] === '/' ? url : `${url}/`
293
293
  }
294
294
 
295
- /**
296
- * Function to insert intercom script dynamically
297
- */
298
- export const insertIntercom = () => {
299
- if (document.getElementById('intercom-sdk')) return
300
-
301
- const script = document.createElement('script')
302
- script.async = true
303
- script.id = 'intercom-sdk'
304
- script.defer = true
305
- script.innerHTML = 'window.intercomSettings = { api_base: \'https://api-iam.intercom.io\', app_id: \'o912y2nt\' };(function () { var w = window; var ic = w.Intercom; if (typeof ic === \'function\') { ic(\'reattach_activator\'); ic(\'update\', w.intercomSettings) } else { var d = document; var i = function () { i.c(arguments) }; i.q = []; i.c = function (args) { i.q.push(args) }; w.Intercom = i; var l = function () { var s = d.createElement(\'script\'); s.type = \'text/javascript\'; s.async = true; s.src = \'https://widget.intercom.io/widget/o912y2nt\'; var x = d.getElementsByTagName(\'script\')[0]; x.parentNode.insertBefore(s, x) }; if (document.readyState === \'complete\') { l() } else if (w.attachEvent) { w.attachEvent(\'onload\', l) } else { w.addEventListener(\'load\', l, false) } } })();'
306
- document.body.appendChild(script)
307
- }
308
-
309
- /**
310
- * Function to remove intercom script dynamically
311
- */
312
- export const removeIntercom = () => {
313
- const intercomSDK = document.getElementById('intercom-sdk')
314
- const intercomContainer = document.getElementById('intercom-container')
315
- const intercomFrame = document.getElementById('intercom-frame')
316
- const intercomLightWeight = document.querySelector('.intercom-lightweight-app')
317
- intercomSDK && document.body.removeChild(intercomSDK)
318
- intercomContainer && document.body.removeChild(intercomContainer)
319
- intercomFrame && document.body.removeChild(intercomFrame)
320
- intercomLightWeight && document.body.removeChild(intercomLightWeight)
321
- window.Intercom = null
322
- window.intercomSettings = null
323
- }
324
-
325
295
  /**
326
296
  * function to manage review comment list
327
297
  * @param {number} param0 type of reviews to return