@pushwoosh/smart-components-kit 1.3.3 → 1.3.5

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.
@@ -32,7 +32,6 @@ export const DynamicContentPicker = ({
32
32
  error,
33
33
  renderDynamicContent
34
34
  }) => {
35
- var _middlewareData$arrow, _middlewareData$arrow2;
36
35
  const arrowRef = useRef(null);
37
36
  const [activeVar, setActiveVar] = useState();
38
37
  const {
@@ -147,8 +146,8 @@ export const DynamicContentPicker = ({
147
146
  "$direction": placementToDirection(placement),
148
147
  ref: arrowRef,
149
148
  style: {
150
- left: (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x,
151
- top: (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y
149
+ left: middlewareData.arrow?.x,
150
+ top: middlewareData.arrow?.y
152
151
  },
153
152
  children: _jsx(ArrowIcon, {})
154
153
  })]
@@ -22,7 +22,7 @@ export const SimpleDynamicContentPickerFormSmart = ({
22
22
  const asyncResult = useDynamicContentTags();
23
23
  useEffect(() => {
24
24
  if (!asyncResult.loading) {
25
- update === null || update === void 0 || update();
25
+ update?.();
26
26
  }
27
27
  }, [asyncResult.loading, update]);
28
28
  if (asyncResult.loading) {
@@ -60,7 +60,7 @@ export const SimpleDynamicContentPickerFormSmart = ({
60
60
  const picked = options.find(item => item.name === option.value);
61
61
  onChange({
62
62
  tagName: option.value,
63
- modifier: (picked === null || picked === void 0 ? void 0 : picked.modifiers[0]) ?? 'regular',
63
+ modifier: picked?.modifiers[0] ?? 'regular',
64
64
  defaultValue: ''
65
65
  });
66
66
  },
@@ -24,7 +24,6 @@ export const VariedDynamicContentPickerFormSmart = ({
24
24
  onClose,
25
25
  update
26
26
  }) => {
27
- var _kindsOptions$find;
28
27
  const lang = useLang();
29
28
  const [vdc, setVdc] = useState(initialDc);
30
29
  const asyncResult = useVariedDynamicContentTags(applicationCode);
@@ -73,7 +72,7 @@ export const VariedDynamicContentPickerFormSmart = ({
73
72
  menuPlacement: "auto",
74
73
  value: {
75
74
  value: vdc.kind,
76
- label: (_kindsOptions$find = kindsOptions.find(o => o.value === vdc.kind)) === null || _kindsOptions$find === void 0 ? void 0 : _kindsOptions$find.label
75
+ label: kindsOptions.find(o => o.value === vdc.kind)?.label
77
76
  },
78
77
  onChange: option => {
79
78
  const newDc = createDefaultDynamicContent(option.value);
@@ -88,7 +88,7 @@ export const ExportCsvBanner = ({
88
88
  }, [getLastTasks, isHidden, lastTasksParams, updateExportTask, lang]);
89
89
  const handleClose = useCallback(() => {
90
90
  hide();
91
- onClose === null || onClose === void 0 || onClose();
91
+ onClose?.();
92
92
  }, [hide, onClose]);
93
93
  const hasRenderableContent = exportTask && ['STATUS_SUCCESS', 'STATUS_PENDING', 'STATUS_FAILED'].includes(exportTask.status);
94
94
  if (!exportTask || isHidden || !hasRenderableContent) return null;
@@ -33,7 +33,7 @@ export const useExportService = () => {
33
33
  } = await rpcGateway.exportStatistics.Export(params);
34
34
  return uid;
35
35
  } catch (err) {
36
- setError(err === null || err === void 0 ? void 0 : err.message);
36
+ setError(err?.message);
37
37
  setIsTaskInProgress(false);
38
38
  return 0;
39
39
  }
@@ -44,7 +44,7 @@ export const useExportService = () => {
44
44
  setTaskResult(result.result);
45
45
  return result;
46
46
  } catch (err) {
47
- setError(err === null || err === void 0 ? void 0 : err.message);
47
+ setError(err?.message);
48
48
  return err;
49
49
  } finally {
50
50
  setIsTaskInProgress(false);
@@ -97,7 +97,7 @@ export const useExportService = () => {
97
97
  } = await rpcGateway.exportStatistics.GetLastTasks(params);
98
98
  return tasks;
99
99
  } catch (err) {
100
- setError(err === null || err === void 0 ? void 0 : err.message);
100
+ setError(err?.message);
101
101
  return err;
102
102
  }
103
103
  }, [rpcGateway]);
@@ -24,18 +24,15 @@ export const LanguagesSelectFormLoader = ({
24
24
  });
25
25
  const valuesLangCodes = values.map(v => canonicalizeLangCode(v.value));
26
26
  const allLangCodes = Array.from(new Set([...valuesLangCodes, ...langCodes.map(canonicalizeLangCode)]).values());
27
- return allLangCodes.toSorted((a, b) => {
27
+ return allLangCodes.sort((a, b) => {
28
28
  return a.localeCompare(b, systemLanguage, {
29
29
  sensitivity: 'base'
30
30
  });
31
- }).map(code => {
32
- var _values$find;
33
- return {
34
- code,
35
- name: getLangName(code),
36
- subscribers: ((_values$find = values.find(val => canonicalizeLangCode(val.value) === code)) === null || _values$find === void 0 ? void 0 : _values$find.count) || 0
37
- };
38
- });
31
+ }).map(code => ({
32
+ code,
33
+ name: getLangName(code),
34
+ subscribers: values.find(val => canonicalizeLangCode(val.value) === code)?.count || 0
35
+ }));
39
36
  }, [application, getLangName, systemLanguage]);
40
37
  if (langAsync.loading) {
41
38
  return _jsx(Horizontal, {
@@ -15,8 +15,7 @@ export function canonicalizeLangCode(code) {
15
15
  }
16
16
  }
17
17
  export function fetchLastSelection() {
18
- var _localStorage$getItem;
19
- return ((_localStorage$getItem = localStorage.getItem(LAST_SELECTION_KEY)) === null || _localStorage$getItem === void 0 ? void 0 : _localStorage$getItem.split(',')) || [];
18
+ return localStorage.getItem(LAST_SELECTION_KEY)?.split(',') || [];
20
19
  }
21
20
  export function saveLastSelection(languages) {
22
21
  const langsForSave = languages.filter(l => l !== 'default').join(',');
@@ -57,7 +57,6 @@ export const CreateCropDrawer = ({
57
57
  onCreated,
58
58
  onDeleted
59
59
  }) => {
60
- var _original$meta;
61
60
  const lang = useLang();
62
61
  const {
63
62
  rpcGateway
@@ -83,13 +82,13 @@ export const CreateCropDrawer = ({
83
82
  setQuality(DEFAULT_QUALITY);
84
83
  }
85
84
  }, [original]);
86
- const isJpeg = /jpe?g/i.test((original === null || original === void 0 ? void 0 : original.mimeType) ?? '');
85
+ const isJpeg = /jpe?g/i.test(original?.mimeType ?? '');
87
86
  const sizeValue = Number(size);
88
87
  const isSizeValid = Number.isFinite(sizeValue) && sizeValue > 0;
89
88
  const qualityValue = Number(quality);
90
89
  const isQualityValid = !isJpeg || Number.isFinite(qualityValue) && qualityValue >= 1 && qualityValue <= 100;
91
90
  const isOriginalView = ratio === 'original';
92
- const originalMeta = (original === null || original === void 0 || (_original$meta = original.meta) === null || _original$meta === void 0 ? void 0 : _original$meta.type) === 'imageMeta' ? original.meta.data : null;
91
+ const originalMeta = original?.meta?.type === 'imageMeta' ? original.meta.data : null;
93
92
  const originalRatio = originalMeta && originalMeta.height > 0 ? originalMeta.width / originalMeta.height : 1;
94
93
  const selectedRatio = RATIOS.find(item => item.value === ratio) ?? RATIOS[0];
95
94
  const outputWidth = dimension === 'width' ? sizeValue : Math.round(sizeValue * selectedRatio.ar);
@@ -110,10 +109,7 @@ export const CreateCropDrawer = ({
110
109
  };
111
110
  // Same ratio with a different size is allowed; only an exact ratio + output
112
111
  // size match counts as a duplicate.
113
- const duplicateExists = !isOriginalView && isSizeValid && existingCrops.some(crop => {
114
- var _crop$meta;
115
- return ((_crop$meta = crop.meta) === null || _crop$meta === void 0 ? void 0 : _crop$meta.type) === 'imageMeta' && crop.meta.data.ratio === selectedRatio.label && crop.meta.data.width === outputWidth && crop.meta.data.height === outputHeight;
116
- });
112
+ const duplicateExists = !isOriginalView && isSizeValid && existingCrops.some(crop => crop.meta?.type === 'imageMeta' && crop.meta.data.ratio === selectedRatio.label && crop.meta.data.width === outputWidth && crop.meta.data.height === outputHeight);
117
113
  const handleCreate = async () => {
118
114
  if (!original || ratio === 'original' || !isSizeValid || !isQualityValid || duplicateExists) return;
119
115
  // Capture the parent up front so a concurrent reopen for another image
@@ -160,7 +156,7 @@ export const CreateCropDrawer = ({
160
156
  setPendingDeleteCrop(null);
161
157
  if (!crop) return;
162
158
  // `parent_uuid` is set on crops; fall back to the open original's uuid.
163
- const parentUuid = crop.parentUuid ?? (original === null || original === void 0 ? void 0 : original.uuid);
159
+ const parentUuid = crop.parentUuid ?? original?.uuid;
164
160
  if (!parentUuid) return;
165
161
  if (await deleteMediaFile(crop.uuid)) {
166
162
  onDeleted(parentUuid, crop.uuid);
@@ -28,7 +28,6 @@ export const MediaStorage = ({
28
28
  onPageChange,
29
29
  onSelect
30
30
  }) => {
31
- var _listAsync$value, _listAsync$value2;
32
31
  const lang = useLang();
33
32
  const {
34
33
  rpcGateway,
@@ -75,8 +74,8 @@ export const MediaStorage = ({
75
74
  const {
76
75
  loading
77
76
  } = listAsync;
78
- const files = ((_listAsync$value = listAsync.value) === null || _listAsync$value === void 0 ? void 0 : _listAsync$value.files) ?? [];
79
- const total = ((_listAsync$value2 = listAsync.value) === null || _listAsync$value2 === void 0 ? void 0 : _listAsync$value2.total) ?? 0;
77
+ const files = listAsync.value?.files ?? [];
78
+ const total = listAsync.value?.total ?? 0;
80
79
  // Read inside the async delete handler to avoid a stale-closure decision.
81
80
  const filesCountRef = useRef(files.length);
82
81
  filesCountRef.current = files.length;
@@ -95,8 +94,7 @@ export const MediaStorage = ({
95
94
  // "N crops" badge appear per file as soon as its request resolves. The
96
95
  // cleanup flag drops results of a page that has since been replaced.
97
96
  useEffect(() => {
98
- var _listAsync$value3;
99
- const originals = (_listAsync$value3 = listAsync.value) === null || _listAsync$value3 === void 0 ? void 0 : _listAsync$value3.files;
97
+ const originals = listAsync.value?.files;
100
98
  if (!originals) return undefined;
101
99
  setCropsByUuid({});
102
100
  let cancelled = false;
@@ -212,10 +210,7 @@ export const MediaStorage = ({
212
210
  type: "button",
213
211
  "$dragOver": isDragOver,
214
212
  disabled: isUploading,
215
- onClick: () => {
216
- var _uploadInputRef$curre;
217
- return (_uploadInputRef$curre = uploadInputRef.current) === null || _uploadInputRef$curre === void 0 ? void 0 : _uploadInputRef$curre.click();
218
- },
213
+ onClick: () => uploadInputRef.current?.click(),
219
214
  onDragOver: event => {
220
215
  event.preventDefault();
221
216
  setIsDragOver(true);
@@ -1,12 +1,8 @@
1
1
  /** Thumbnail URL from image meta, falling back to the full-size URL. */
2
- export const getThumbUrl = file => {
3
- var _file$meta;
4
- return ((_file$meta = file.meta) === null || _file$meta === void 0 ? void 0 : _file$meta.type) === 'imageMeta' ? file.meta.data.thumbnailUrl : file.url;
5
- };
2
+ export const getThumbUrl = file => file.meta?.type === 'imageMeta' ? file.meta.data.thumbnailUrl : file.url;
6
3
  /** Caption for a crop: ratio + pixel size (e.g. "16:9 · 1080×608"); filename fallback. */
7
4
  export const getCropCaption = file => {
8
- var _file$meta2;
9
- if (((_file$meta2 = file.meta) === null || _file$meta2 === void 0 ? void 0 : _file$meta2.type) !== 'imageMeta') return file.filename;
5
+ if (file.meta?.type !== 'imageMeta') return file.filename;
10
6
  const {
11
7
  ratio,
12
8
  width,
@@ -14,7 +14,6 @@ export function ModalCloningJourney({
14
14
  onCancel,
15
15
  isOpen
16
16
  }) {
17
- var _applicationsOptions$, _errors$title, _errors$destination, _errors$todo;
18
17
  const lang = useLang();
19
18
  const params = useParams();
20
19
  const {
@@ -91,23 +90,22 @@ export function ModalCloningJourney({
91
90
  message: 'SMART.MODAL_CLONING_JOURNEY.TITLE_COPY',
92
91
  title: journeyTitle
93
92
  }),
94
- destination: applicationsOptions.length > 0 ? [(_applicationsOptions$ = applicationsOptions.find(({
93
+ destination: applicationsOptions.length > 0 ? [applicationsOptions.find(({
95
94
  value
96
- }) => value === applicationCode)) === null || _applicationsOptions$ === void 0 ? void 0 : _applicationsOptions$.value].filter(Boolean) : [],
95
+ }) => value === applicationCode)?.value].filter(Boolean) : [],
97
96
  todo: 'keep'
98
97
  }
99
98
  });
100
99
  const values = watch();
101
100
  useEffect(() => {
102
- var _applicationsOptions$2;
103
101
  reset({
104
102
  title: lang({
105
103
  message: 'SMART.MODAL_CLONING_JOURNEY.TITLE_COPY',
106
104
  title: journeyTitle
107
105
  }),
108
- destination: applicationsOptions.length > 0 ? [(_applicationsOptions$2 = applicationsOptions.find(({
106
+ destination: applicationsOptions.length > 0 ? [applicationsOptions.find(({
109
107
  value
110
- }) => value === applicationCode)) === null || _applicationsOptions$2 === void 0 ? void 0 : _applicationsOptions$2.value].filter(Boolean) : [],
108
+ }) => value === applicationCode)?.value].filter(Boolean) : [],
111
109
  todo: 'keep'
112
110
  });
113
111
  }, [journeyTitle, applicationsOptions, applicationCode, reset, lang]);
@@ -149,7 +147,7 @@ export function ModalCloningJourney({
149
147
  name: 'CloneJourneyToAnotherApp'
150
148
  });
151
149
  }
152
- onAfterClone === null || onAfterClone === void 0 || onAfterClone(destination.includes(applicationCode));
150
+ onAfterClone?.(destination.includes(applicationCode));
153
151
  } finally {
154
152
  setIsCloning(false);
155
153
  }
@@ -201,7 +199,7 @@ export function ModalCloningJourney({
201
199
  message: 'SMART.MODAL_CLONING_JOURNEY.DESCRIPTION'
202
200
  })
203
201
  }), _jsx(FieldBox, {
204
- error: (_errors$title = errors.title) === null || _errors$title === void 0 ? void 0 : _errors$title.message,
202
+ error: errors.title?.message,
205
203
  title: lang({
206
204
  message: 'SMART.MODAL_CLONING_JOURNEY.FIELD.CAMPAIGN_NAME'
207
205
  }),
@@ -223,7 +221,7 @@ export function ModalCloningJourney({
223
221
  title: lang({
224
222
  message: 'SMART.MODAL_CLONING_JOURNEY.FIELD.DESTINATION'
225
223
  }),
226
- error: (_errors$destination = errors.destination) === null || _errors$destination === void 0 ? void 0 : _errors$destination.message,
224
+ error: errors.destination?.message,
227
225
  description: lang({
228
226
  message: 'SMART.MODAL_CLONING_JOURNEY.FIELD.DESTINATION_HINT'
229
227
  }),
@@ -248,12 +246,12 @@ export function ModalCloningJourney({
248
246
  title: lang({
249
247
  message: 'SMART.MODAL_CLONING_JOURNEY.FIELD.CONTENT'
250
248
  }),
251
- error: (_errors$todo = errors.todo) === null || _errors$todo === void 0 ? void 0 : _errors$todo.message,
249
+ error: errors.todo?.message,
252
250
  children: [_jsx(Select, {
253
251
  isDisabled: isCloning,
254
252
  name: "todo",
255
253
  options: contentOptions,
256
- onChange: params => setValue('todo', (params === null || params === void 0 ? void 0 : params.value) ?? 'keep'),
254
+ onChange: params => setValue('todo', params?.value ?? 'keep'),
257
255
  value: contentOptions.find(item => item.value === values.todo),
258
256
  menuPortalTarget: document.querySelector('body'),
259
257
  styles: {
@@ -13,7 +13,6 @@ import { Lang, useLang } from '../../polyglot';
13
13
  export const OpenActionsSummary = ({
14
14
  openActions
15
15
  }) => {
16
- var _applicationData$valu;
17
16
  const lang = useLang();
18
17
  const {
19
18
  platformsDeeplinkUrls = {},
@@ -36,7 +35,7 @@ export const OpenActionsSummary = ({
36
35
  code: applicationCode
37
36
  }) : Promise.resolve(undefined), [rpcGateway, applicationCode]);
38
37
  const hasCustomPlatformsDeeplink = Object.keys(platformsDeeplinkUrls).length > 0;
39
- const safariUrl = getSafariUrl((applicationData === null || applicationData === void 0 || (_applicationData$valu = applicationData.value) === null || _applicationData$valu === void 0 ? void 0 : _applicationData$valu.application) || null, safariUrlArgs ?? '');
38
+ const safariUrl = getSafariUrl(applicationData?.value?.application || null, safariUrlArgs ?? '');
40
39
  const renderInfoBlock = (device, action, url = null, urlText) => _jsxs(Vertical, {
41
40
  children: [_jsx("span", {
42
41
  children: _jsx(Lang, {
@@ -4,11 +4,10 @@ export const isWebLink = url => {
4
4
  };
5
5
  export const formatDeeplink = (template, deeplinkParams) => Object.keys(deeplinkParams).reduce((url, paramName) => url.replace(`{${paramName}}`, deeplinkParams[paramName]), template);
6
6
  export const getSafariUrl = (application, safariUrlArguments) => {
7
- var _application$platform, _application$properti;
8
7
  if (!application) {
9
8
  return '';
10
9
  }
11
- const isSafariConfigured = !!((_application$platform = application.platforms) !== null && _application$platform !== void 0 && (_application$platform = _application$platform[AllPlatforms.Safari]) !== null && _application$platform !== void 0 && _application$platform.isConfigured);
12
- const safariUrlTemplate = ((_application$properti = application.properties) === null || _application$properti === void 0 ? void 0 : _application$properti.safari_url_template) || '';
10
+ const isSafariConfigured = !!application.platforms?.[AllPlatforms.Safari]?.isConfigured;
11
+ const safariUrlTemplate = application.properties?.safari_url_template || '';
13
12
  return isSafariConfigured ? safariUrlTemplate.replace('%@', safariUrlArguments).replace(/%@/g, '') : '';
14
13
  };
@@ -26,8 +26,7 @@ export const usePresetOpenActions = pushPreset => {
26
26
  }
27
27
  }, [openToast, rpcGateway]);
28
28
  const getOpenActionsFromV2Preset = useCallback(async pushPreset => {
29
- var _pushPreset$localized, _pushPreset$openActio, _pushPreset$openActio2;
30
- const safariUrlArgs = ((_pushPreset$localized = pushPreset.localizedProperties.default) === null || _pushPreset$localized === void 0 || (_pushPreset$localized = _pushPreset$localized.safari) === null || _pushPreset$localized === void 0 || (_pushPreset$localized = _pushPreset$localized.urlArguments) === null || _pushPreset$localized === void 0 ? void 0 : _pushPreset$localized[0]) ?? null;
29
+ const safariUrlArgs = pushPreset.localizedProperties.default?.safari?.urlArguments?.[0] ?? null;
31
30
  const webPageUrl = isWebLink(pushPreset.url) ? pushPreset.url : null;
32
31
  const {
33
32
  platformsDeeplinkUrls,
@@ -35,11 +34,11 @@ export const usePresetOpenActions = pushPreset => {
35
34
  } = await getPlatformDeeplinksByOpenActions(pushPreset, getDeeplinkUrl);
36
35
  let defaultDeeplinkUrl = pushPreset.url ?? null;
37
36
  // openAction - for common all mobile deeplink; web url is located in 'url' prop, openActions - map with mobile deeplink platform as a key (0 we should ignore)
38
- if (((_pushPreset$openActio = pushPreset.openAction) === null || _pushPreset$openActio === void 0 || (_pushPreset$openActio = _pushPreset$openActio.kind) === null || _pushPreset$openActio === void 0 ? void 0 : _pushPreset$openActio.type) === 'deepLink') {
37
+ if (pushPreset.openAction?.kind?.type === 'deepLink') {
39
38
  const deeplinkCommonInfo = pushPreset.openAction.kind.data;
40
39
  defaultDeeplinkUrl = await getDeeplinkUrl(deeplinkCommonInfo);
41
40
  }
42
- if (((_pushPreset$openActio2 = pushPreset.openAction) === null || _pushPreset$openActio2 === void 0 || (_pushPreset$openActio2 = _pushPreset$openActio2.kind) === null || _pushPreset$openActio2 === void 0 ? void 0 : _pushPreset$openActio2.type) === 'link') {
41
+ if (pushPreset.openAction?.kind?.type === 'link') {
43
42
  const deeplinkManual = pushPreset.openAction.kind.data;
44
43
  defaultDeeplinkUrl = deeplinkManual.url;
45
44
  }
@@ -71,17 +70,16 @@ const getPlatformDeeplinksByOpenActions = async (pushPreset, getDeeplinkUrl) =>
71
70
  const platformsDeeplinkUrls = {};
72
71
  let showRichmedia = null;
73
72
  await Promise.all(Object.entries(pushPreset.openActions).filter(([plKey]) => +plKey !== WEB_PLATFORM_KEY).map(async ([plKey, action]) => {
74
- var _action$kind, _action$kind2, _action$kind3;
75
73
  const platformKey = +plKey;
76
- if ((action === null || action === void 0 || (_action$kind = action.kind) === null || _action$kind === void 0 ? void 0 : _action$kind.type) === 'deepLink') {
74
+ if (action?.kind?.type === 'deepLink') {
77
75
  const deeplinkCommonInfo = action.kind.data;
78
76
  platformsDeeplinkUrls[platformKey] = await getDeeplinkUrl(deeplinkCommonInfo);
79
77
  }
80
- if ((action === null || action === void 0 || (_action$kind2 = action.kind) === null || _action$kind2 === void 0 ? void 0 : _action$kind2.type) === 'link') {
78
+ if (action?.kind?.type === 'link') {
81
79
  const deeplinkCommonInfo = action.kind.data;
82
80
  platformsDeeplinkUrls[platformKey] = deeplinkCommonInfo.url;
83
81
  }
84
- if ((action === null || action === void 0 || (_action$kind3 = action.kind) === null || _action$kind3 === void 0 ? void 0 : _action$kind3.type) === 'richMedia') {
82
+ if (action?.kind?.type === 'richMedia') {
85
83
  if (action.kind.data.kind.type === 'url') {
86
84
  showRichmedia = {
87
85
  url: action.kind.data.kind.data
@@ -99,13 +97,12 @@ const getPlatformDeeplinksByOpenActions = async (pushPreset, getDeeplinkUrl) =>
99
97
  };
100
98
  };
101
99
  const getOpenActionsFromV1Preset = async pushPreset => {
102
- var _pushPreset$localized2, _pushPreset$localized3;
103
100
  const webPageUrl = !pushPreset.deeplink && isWebLink(pushPreset.url) ? pushPreset.url : null;
104
101
  const defaultDeeplinkUrl = pushPreset.url ?? null;
105
102
  const showRichmedia = pushPreset.richmedia ? {
106
103
  code: pushPreset.richmedia
107
104
  } : null;
108
- const safariUrlArgs = ((_pushPreset$localized2 = pushPreset.localizedProperties.default) === null || _pushPreset$localized2 === void 0 || (_pushPreset$localized2 = _pushPreset$localized2.safari) === null || _pushPreset$localized2 === void 0 || (_pushPreset$localized2 = _pushPreset$localized2.urlArguments) === null || _pushPreset$localized2 === void 0 ? void 0 : _pushPreset$localized2[0]) ?? ((_pushPreset$localized3 = pushPreset.localizedProperties.en) === null || _pushPreset$localized3 === void 0 || (_pushPreset$localized3 = _pushPreset$localized3.safari) === null || _pushPreset$localized3 === void 0 || (_pushPreset$localized3 = _pushPreset$localized3.urlArguments) === null || _pushPreset$localized3 === void 0 ? void 0 : _pushPreset$localized3[0]) ?? null;
105
+ const safariUrlArgs = pushPreset.localizedProperties.default?.safari?.urlArguments?.[0] ?? pushPreset.localizedProperties.en?.safari?.urlArguments?.[0] ?? null;
109
106
  return {
110
107
  webPageUrl,
111
108
  defaultDeeplinkUrl,
@@ -13,8 +13,8 @@ export function DesktopPage(props) {
13
13
  onClose
14
14
  } = props;
15
15
  const lang = useLang();
16
- const hasWindowsPlatform = Object.hasOwn((application === null || application === void 0 ? void 0 : application.platforms) || {}, AllPlatforms.Windows);
17
- const hasMacOSPlatform = Object.hasOwn((application === null || application === void 0 ? void 0 : application.platforms) || {}, AllPlatforms.OSX);
16
+ const hasWindowsPlatform = Object.hasOwn(application?.platforms || {}, AllPlatforms.Windows);
17
+ const hasMacOSPlatform = Object.hasOwn(application?.platforms || {}, AllPlatforms.OSX);
18
18
  return _jsxs(_Fragment, {
19
19
  children: [_jsx(Header, {
20
20
  children: _jsxs(ColumnsWrapper, {
@@ -98,7 +98,7 @@ export function DesktopPage(props) {
98
98
  "$gap": 6,
99
99
  children: [hasWindowsPlatform && _jsxs(Card, {
100
100
  as: "a",
101
- href: `/applications/${application === null || application === void 0 ? void 0 : application.code}/configure`,
101
+ href: `/applications/${application?.code}/configure`,
102
102
  children: [_jsx(CardIcon, {
103
103
  children: _jsx(PlatformLogoIcon, {
104
104
  type: "windows",
@@ -111,7 +111,7 @@ export function DesktopPage(props) {
111
111
  })]
112
112
  }), hasMacOSPlatform && _jsxs(Card, {
113
113
  as: "a",
114
- href: `/applications/${application === null || application === void 0 ? void 0 : application.code}/configure/osx`,
114
+ href: `/applications/${application?.code}/configure/osx`,
115
115
  children: [_jsx(CardIcon, {
116
116
  children: _jsx(PlatformLogoIcon, {
117
117
  type: "macos",
@@ -14,7 +14,7 @@ export function MainPage(props) {
14
14
  onClose
15
15
  } = props;
16
16
  const lang = useLang();
17
- const hasDesktopPlatforms = Object.hasOwn((application === null || application === void 0 ? void 0 : application.platforms) || {}, AllPlatforms.Windows) || Object.hasOwn((application === null || application === void 0 ? void 0 : application.platforms) || {}, AllPlatforms.OSX);
17
+ const hasDesktopPlatforms = Object.hasOwn(application?.platforms || {}, AllPlatforms.Windows) || Object.hasOwn(application?.platforms || {}, AllPlatforms.OSX);
18
18
  return _jsxs(_Fragment, {
19
19
  children: [_jsxs(Header, {
20
20
  children: [_jsxs(Vertical, {
@@ -113,7 +113,7 @@ export function MainPage(props) {
113
113
  })]
114
114
  }), _jsxs(Card, {
115
115
  as: "a",
116
- href: `/applications/${application === null || application === void 0 ? void 0 : application.code}/configure/web`,
116
+ href: `/applications/${application?.code}/configure/web`,
117
117
  children: [_jsx(CardIcon, {
118
118
  children: _jsx(DeviceIcon, {
119
119
  type: "web",
@@ -127,7 +127,7 @@ export function MainPage(props) {
127
127
  })]
128
128
  }), _jsxs(Card, {
129
129
  as: "a",
130
- href: `/applications/${application === null || application === void 0 ? void 0 : application.code}/configure/email`,
130
+ href: `/applications/${application?.code}/configure/email`,
131
131
  children: [_jsx(CardIcon, {
132
132
  children: _jsx(EmailIcon, {
133
133
  size: "medium",
@@ -140,7 +140,7 @@ export function MainPage(props) {
140
140
  })]
141
141
  }), _jsxs(Card, {
142
142
  as: "a",
143
- href: `/applications/${application === null || application === void 0 ? void 0 : application.code}/configure`,
143
+ href: `/applications/${application?.code}/configure`,
144
144
  children: [_jsx(CardIcon, {
145
145
  children: _jsx(WhatsappIcon, {
146
146
  size: "medium",
@@ -96,7 +96,7 @@ export function MobilePage(props) {
96
96
  "$gap": 6,
97
97
  children: [_jsxs(Card, {
98
98
  as: "a",
99
- href: `/applications/${application === null || application === void 0 ? void 0 : application.code}/configure/ios`,
99
+ href: `/applications/${application?.code}/configure/ios`,
100
100
  children: [_jsx(CardIcon, {
101
101
  children: _jsx(PlatformLogoIcon, {
102
102
  type: "apple",
@@ -109,7 +109,7 @@ export function MobilePage(props) {
109
109
  })]
110
110
  }), _jsxs(Card, {
111
111
  as: "a",
112
- href: `/applications/${application === null || application === void 0 ? void 0 : application.code}/configure/android`,
112
+ href: `/applications/${application?.code}/configure/android`,
113
113
  children: [_jsx(CardIcon, {
114
114
  children: _jsx(PlatformLogoIcon, {
115
115
  type: "android",
@@ -122,7 +122,7 @@ export function MobilePage(props) {
122
122
  })]
123
123
  }), _jsxs(Card, {
124
124
  as: "a",
125
- href: `/applications/${application === null || application === void 0 ? void 0 : application.code}/configure/huawei`,
125
+ href: `/applications/${application?.code}/configure/huawei`,
126
126
  children: [_jsx(CardIcon, {
127
127
  children: _jsx(PlatformLogoIcon, {
128
128
  type: "huawei",
@@ -135,7 +135,7 @@ export function MobilePage(props) {
135
135
  })]
136
136
  }), _jsxs(Card, {
137
137
  as: "a",
138
- href: `/applications/${application === null || application === void 0 ? void 0 : application.code}/configure`,
138
+ href: `/applications/${application?.code}/configure`,
139
139
  children: [_jsx(CardIcon, {
140
140
  children: _jsx(PlatformLogoIcon, {
141
141
  type: "amazon",
@@ -59,14 +59,13 @@ export const ResendModal = ({
59
59
  presetSubject
60
60
  } = watch();
61
61
  useEffect(() => {
62
- var _effectiveEmailTempla;
63
62
  if (!isOpen) {
64
63
  reset({
65
64
  presetSubject: ''
66
65
  });
67
66
  return;
68
67
  }
69
- if (!(effectiveEmailTemplate !== null && effectiveEmailTemplate !== void 0 && (_effectiveEmailTempla = effectiveEmailTemplate.content) !== null && _effectiveEmailTempla !== void 0 && _effectiveEmailTempla.subject)) {
68
+ if (!effectiveEmailTemplate?.content?.subject) {
70
69
  reset({
71
70
  presetSubject: ''
72
71
  });
@@ -83,8 +82,7 @@ export const ResendModal = ({
83
82
  const {
84
83
  isMultilanguage
85
84
  } = useMemo(() => {
86
- var _effectiveEmailTempla2;
87
- if (!(effectiveEmailTemplate !== null && effectiveEmailTemplate !== void 0 && (_effectiveEmailTempla2 = effectiveEmailTemplate.content) !== null && _effectiveEmailTempla2 !== void 0 && _effectiveEmailTempla2.subject)) {
85
+ if (!effectiveEmailTemplate?.content?.subject) {
88
86
  return {
89
87
  isMultilanguage: false
90
88
  };
@@ -147,34 +145,31 @@ export const ResendModal = ({
147
145
  render: ({
148
146
  field,
149
147
  fieldState
150
- }) => {
151
- var _fieldState$error;
152
- return _jsx(FieldBox, {
153
- title: lang({
154
- message: 'SMART.RESEND_MODAL.FIELD.SUBJECT'
155
- }),
156
- error: !!fieldState.error && _jsx(Text, {
157
- "$color": Color.DANGER,
158
- children: (_fieldState$error = fieldState.error) === null || _fieldState$error === void 0 ? void 0 : _fieldState$error.message
159
- }),
160
- children: _jsx(NativeInput, {
161
- value: field.value ?? '',
162
- disabled: isMultilanguage,
163
- "$isErrored": fieldState.invalid,
164
- name: field.name,
165
- onChange: ({
166
- target: {
167
- value
168
- }
169
- }) => {
170
- if (value) {
171
- clearErrors('presetSubject');
172
- }
173
- field.onChange(value);
148
+ }) => _jsx(FieldBox, {
149
+ title: lang({
150
+ message: 'SMART.RESEND_MODAL.FIELD.SUBJECT'
151
+ }),
152
+ error: !!fieldState.error && _jsx(Text, {
153
+ "$color": Color.DANGER,
154
+ children: fieldState.error?.message
155
+ }),
156
+ children: _jsx(NativeInput, {
157
+ value: field.value ?? '',
158
+ disabled: isMultilanguage,
159
+ "$isErrored": fieldState.invalid,
160
+ name: field.name,
161
+ onChange: ({
162
+ target: {
163
+ value
164
+ }
165
+ }) => {
166
+ if (value) {
167
+ clearErrors('presetSubject');
174
168
  }
175
- })
176
- });
177
- }
169
+ field.onChange(value);
170
+ }
171
+ })
172
+ })
178
173
  })]
179
174
  })
180
175
  }), _jsx(ModalFooter, {
@@ -19,9 +19,9 @@ export const useResend = () => {
19
19
  body: payload.request,
20
20
  withAuthorization: true
21
21
  });
22
- if ((res === null || res === void 0 ? void 0 : res.status_code) !== 200) {
22
+ if (res?.status_code !== 200) {
23
23
  openToast({
24
- title: (res === null || res === void 0 ? void 0 : res.status_message) || 'Failed to resend message',
24
+ title: res?.status_message || 'Failed to resend message',
25
25
  type: 'error'
26
26
  });
27
27
  return false;
@@ -33,7 +33,7 @@ export const useResend = () => {
33
33
  return true;
34
34
  } catch (error) {
35
35
  openToast({
36
- title: (error === null || error === void 0 ? void 0 : error.message) || 'Internal error',
36
+ title: error?.message || 'Internal error',
37
37
  type: 'error'
38
38
  });
39
39
  return false;
@@ -10,7 +10,6 @@ import { LockedText, Table } from '../../styles';
10
10
  import { DataTableList } from '../DataTableList';
11
11
  import { DataTablePagination } from '../DataTablePagination';
12
12
  export function DataTable(props) {
13
- var _data$value, _data$value2, _data$value3, _data$value4, _data$value5;
14
13
  const {
15
14
  columns,
16
15
  width,
@@ -30,7 +29,7 @@ export function DataTable(props) {
30
29
  data,
31
30
  params
32
31
  } = context;
33
- const isFiltered = ((_data$value = data.value) === null || _data$value === void 0 ? void 0 : _data$value.isFiltered) || params.search;
32
+ const isFiltered = data.value?.isFiltered || params.search;
34
33
  const onClearRequestDefault = () => {
35
34
  const keys = ['perPage', 'order', 'direction'];
36
35
  context.onChangeParams(keys.reduce((acc, key) => ({
@@ -48,7 +47,7 @@ export function DataTable(props) {
48
47
  width: width,
49
48
  isBordered: isBordered,
50
49
  "$bgColor": bgColor,
51
- children: [renderTableTop === null || renderTableTop === void 0 ? void 0 : renderTableTop(context), 'renderHead' in props && props.renderHead(), 'renderList' in props ? props.renderList(context) : _jsx(DataTableList, {
50
+ children: [renderTableTop?.(context), 'renderHead' in props && props.renderHead(), 'renderList' in props ? props.renderList(context) : _jsx(DataTableList, {
52
51
  renderItem: props.renderItem
53
52
  }), !hidePagination && _jsxs(DataTablePagination, {
54
53
  allLimits: allLimits ?? [10, 20, 50, 100],
@@ -78,7 +77,7 @@ export function DataTable(props) {
78
77
  message: 'SMART.TABLE.REQUEST_FAILED'
79
78
  })
80
79
  })]
81
- }), !data.loading && !data.error && (((_data$value2 = data.value) === null || _data$value2 === void 0 ? void 0 : _data$value2.total) ?? 0) > 0 && _jsxs(Horizontal, {
80
+ }), !data.loading && !data.error && (data.value?.total ?? 0) > 0 && _jsxs(Horizontal, {
82
81
  "$placeItems": "center",
83
82
  "$gap": 4,
84
83
  children: [lang({
@@ -86,10 +85,10 @@ export function DataTable(props) {
86
85
  }), _jsx(LockedText, {
87
86
  children: lang({
88
87
  message: 'SMART.TABLE.RESULT_COUNT',
89
- total: ((_data$value3 = data.value) === null || _data$value3 === void 0 ? void 0 : _data$value3.total) ?? 0
88
+ total: data.value?.total ?? 0
90
89
  })
91
90
  })]
92
- }), !data.loading && !data.error && (((_data$value4 = data.value) === null || _data$value4 === void 0 ? void 0 : _data$value4.total) ?? 0) === 0 && !isFiltered && _jsx(Horizontal, {
91
+ }), !data.loading && !data.error && (data.value?.total ?? 0) === 0 && !isFiltered && _jsx(Horizontal, {
93
92
  "$placeItems": "center",
94
93
  children: _jsx(LockedText, {
95
94
  children: lang({
@@ -98,7 +97,7 @@ export function DataTable(props) {
98
97
  })
99
98
  }), !data.loading && isFiltered && _jsxs(Horizontal, {
100
99
  "$gap": 16,
101
- children: [!data.error && (((_data$value5 = data.value) === null || _data$value5 === void 0 || (_data$value5 = _data$value5.items) === null || _data$value5 === void 0 ? void 0 : _data$value5.length) ?? 0) === 0 && _jsxs(Horizontal, {
100
+ children: [!data.error && (data.value?.items?.length ?? 0) === 0 && _jsxs(Horizontal, {
102
101
  "$placeItems": "center",
103
102
  "$gap": 4,
104
103
  children: [lang({
@@ -118,6 +117,6 @@ export function DataTable(props) {
118
117
  })]
119
118
  })]
120
119
  })]
121
- }), renderAfter === null || renderAfter === void 0 ? void 0 : renderAfter(context)]
120
+ }), renderAfter?.(context)]
122
121
  });
123
122
  }
@@ -12,7 +12,6 @@ import { Loading } from '../Loading';
12
12
  export function DataTableList({
13
13
  renderItem
14
14
  }) {
15
- var _data$value, _data$value2;
16
15
  const {
17
16
  data,
18
17
  params
@@ -21,7 +20,7 @@ export function DataTableList({
21
20
  if (data.loading) {
22
21
  return _jsx(Loading, {});
23
22
  }
24
- if ((_data$value = data.value) !== null && _data$value !== void 0 && (_data$value = _data$value.items) !== null && _data$value !== void 0 && _data$value.length) {
23
+ if (data.value?.items?.length) {
25
24
  return _jsx(_Fragment, {
26
25
  children: data.value.items.map(renderItem)
27
26
  });
@@ -57,7 +56,7 @@ export function DataTableList({
57
56
  })
58
57
  });
59
58
  }
60
- const isFiltered = ((_data$value2 = data.value) === null || _data$value2 === void 0 ? void 0 : _data$value2.isFiltered) || params.search;
59
+ const isFiltered = data.value?.isFiltered || params.search;
61
60
  return isFiltered ? _jsx(Horizontal, {
62
61
  "$placeItems": "center",
63
62
  "$padding": 64,
@@ -8,7 +8,6 @@ export function DataTablePagination({
8
8
  children,
9
9
  hidePageSizeSelector
10
10
  }) {
11
- var _data$value;
12
11
  const {
13
12
  data,
14
13
  params,
@@ -16,7 +15,7 @@ export function DataTablePagination({
16
15
  } = useContext(DataTableContext);
17
16
  return _jsx(TablePagination, {
18
17
  activePage: params.page,
19
- totalPages: ((_data$value = data.value) === null || _data$value === void 0 ? void 0 : _data$value.totalPages) || 1,
18
+ totalPages: data.value?.totalPages || 1,
20
19
  limit: params.perPage,
21
20
  allLimits: allLimits,
22
21
  onChangePage: page => {
package/package.json CHANGED
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@floating-ui/react-dom": "^2.1.2",
27
- "@pushwoosh/dumb-components": "^1.1.175",
27
+ "@pushwoosh/dumb-components": "^1.1.182",
28
28
  "@pushwoosh/kit-constants": "^1.8.0",
29
29
  "@pushwoosh/kit-helpers": "^4.12.0",
30
30
  "@pushwoosh/kit-icons": "^2.1.22",
@@ -36,7 +36,7 @@
36
36
  "react-router-dom": "^5.3.4"
37
37
  },
38
38
  "devDependencies": {
39
- "@pushwoosh/frontend-builder-engine": "^3.0.0",
39
+ "@pushwoosh/frontend-builder-engine": "^3.1.0",
40
40
  "@svgr/webpack": "^8.1.0",
41
41
  "@types/react": "^18.3.5",
42
42
  "@types/react-dom": "^18.3.0",
@@ -52,5 +52,5 @@
52
52
  "react": "^16.14.0 || ^18.0.0",
53
53
  "react-dom": "^16.14.0 || ^18.0.0"
54
54
  },
55
- "version": "1.3.3"
55
+ "version": "1.3.5"
56
56
  }