@openlettermarketing/olc-react-sdk 2.1.5-beta.7 → 2.1.5-beta.9
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/build/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION: "2.1.5-beta.
|
|
1
|
+
export const SDK_VERSION: "2.1.5-beta.9";
|
package/package.json
CHANGED
|
@@ -623,13 +623,11 @@ const CustomQRCode = {
|
|
|
623
623
|
};
|
|
624
624
|
|
|
625
625
|
const handleEditQRCode = async (qrCode: any) => {
|
|
626
|
-
console.log("qrCode.utm_source:::",qrCode.utm_source);
|
|
627
|
-
console.log("qrCode.utm_medium",qrCode.utm_medium)
|
|
628
626
|
setIsEditing(true);
|
|
629
627
|
setSelectedQR(qrCode);
|
|
630
628
|
dispatch(setQrUrl(qrCode.url));
|
|
631
|
-
dispatch(setUtmSource(qrCode.
|
|
632
|
-
dispatch(setUtmMedium(qrCode.
|
|
629
|
+
dispatch(setUtmSource(qrCode.utmSource || 'direct mail'));
|
|
630
|
+
dispatch(setUtmMedium(qrCode.utmMedium || 'QR Code'));
|
|
633
631
|
dispatch(setUtmCampaignName(qrCode.utm_campaign_name || ''));
|
|
634
632
|
dispatch(setCustomUtms(qrCode.custom_utms || {}));
|
|
635
633
|
|
|
@@ -172,8 +172,12 @@ const CustomTemplateSection: SideSection = {
|
|
|
172
172
|
const [myTemplates, setMyTemplates] = useState<TemplateRecord[]>([]);
|
|
173
173
|
const [teamTemplates, setTeamTemplates] = useState<TemplateRecord[]>([]);
|
|
174
174
|
const [olcTemplates, setOlcTemplates] = useState<TemplateRecord[]>([]);
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
// Initialise from localStorage so state survives the MobX-driven unmount/remount
|
|
176
|
+
// that occurs when the user switches browser tabs and returns.
|
|
177
|
+
const [searchApplied, setSearchApplied] = useState(
|
|
178
|
+
getItem('gallerySearchApplied') === 'true'
|
|
179
|
+
);
|
|
180
|
+
const [search, setSearch] = useState(getItem('gallerySearch') || '');
|
|
177
181
|
const [loader, setLoader] = useState(false);
|
|
178
182
|
const [pagination, setPagination] = useState({
|
|
179
183
|
count: 0,
|
|
@@ -316,6 +320,11 @@ const CustomTemplateSection: SideSection = {
|
|
|
316
320
|
setOpenGalleryModal(false);
|
|
317
321
|
store.openSidePanel(selectedSection || 'text');
|
|
318
322
|
removeItem('currentTab');
|
|
323
|
+
// Clear persisted search so the gallery opens fresh next time.
|
|
324
|
+
setSearch('');
|
|
325
|
+
setSearchApplied(false);
|
|
326
|
+
removeItem('gallerySearch');
|
|
327
|
+
removeItem('gallerySearchApplied');
|
|
319
328
|
document.body.classList.remove('no-scroll');
|
|
320
329
|
};
|
|
321
330
|
|
|
@@ -342,12 +351,19 @@ const CustomTemplateSection: SideSection = {
|
|
|
342
351
|
const handleSearch = () => {
|
|
343
352
|
if (search) {
|
|
344
353
|
setSearchApplied(true);
|
|
354
|
+
setItem('gallerySearchApplied', 'true');
|
|
345
355
|
getTemplatesByTab();
|
|
346
356
|
}
|
|
347
357
|
};
|
|
348
358
|
|
|
349
359
|
const removeSearchInput = () => {
|
|
350
360
|
setSearch('');
|
|
361
|
+
// Do NOT call setSearchApplied(false) here — React 18 batches both state updates
|
|
362
|
+
// into one render, making searchApplied already false when useEffect([search]) runs,
|
|
363
|
+
// which prevents the condition (!search && searchApplied) from firing and skips
|
|
364
|
+
// the re-fetch. The useEffect below owns that transition.
|
|
365
|
+
removeItem('gallerySearch');
|
|
366
|
+
removeItem('gallerySearchApplied');
|
|
351
367
|
};
|
|
352
368
|
|
|
353
369
|
const searchKeyDown = (event: any) => {
|
|
@@ -543,7 +559,8 @@ const CustomTemplateSection: SideSection = {
|
|
|
543
559
|
useEffect(() => {
|
|
544
560
|
if (!search && searchApplied) {
|
|
545
561
|
setSearchApplied(false);
|
|
546
|
-
|
|
562
|
+
removeItem('gallerySearch');
|
|
563
|
+
removeItem('gallerySearchApplied');
|
|
547
564
|
setTimeout(() => {
|
|
548
565
|
getTemplatesByTab();
|
|
549
566
|
}, 100);
|
|
@@ -552,6 +569,8 @@ const CustomTemplateSection: SideSection = {
|
|
|
552
569
|
|
|
553
570
|
useEffect(() => {
|
|
554
571
|
searchRef.current = search;
|
|
572
|
+
// Keep localStorage in sync so the value survives tab-switch remounts.
|
|
573
|
+
setItem('gallerySearch', search);
|
|
555
574
|
}, [search]);
|
|
556
575
|
|
|
557
576
|
useEffect(() => {
|
package/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = '2.1.5-beta.
|
|
1
|
+
export const SDK_VERSION = '2.1.5-beta.9';
|