@openlettermarketing/olc-react-sdk 2.1.5-beta.9 → 2.1.6

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 +1 @@
1
- export const SDK_VERSION: "2.1.5-beta.9";
1
+ export const SDK_VERSION: "2.1.6";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openlettermarketing/olc-react-sdk",
3
3
  "private": false,
4
- "version": "2.1.5-beta.9",
4
+ "version": "2.1.6",
5
5
  "type": "module",
6
6
  "description": "Simplify template builder integration for any product.",
7
7
  "main": "build/index.js",
@@ -172,12 +172,8 @@ 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
- // 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') || '');
175
+ const [searchApplied, setSearchApplied] = useState(false);
176
+ const [search, setSearch] = useState('');
181
177
  const [loader, setLoader] = useState(false);
182
178
  const [pagination, setPagination] = useState({
183
179
  count: 0,
@@ -320,11 +316,6 @@ const CustomTemplateSection: SideSection = {
320
316
  setOpenGalleryModal(false);
321
317
  store.openSidePanel(selectedSection || 'text');
322
318
  removeItem('currentTab');
323
- // Clear persisted search so the gallery opens fresh next time.
324
- setSearch('');
325
- setSearchApplied(false);
326
- removeItem('gallerySearch');
327
- removeItem('gallerySearchApplied');
328
319
  document.body.classList.remove('no-scroll');
329
320
  };
330
321
 
@@ -351,19 +342,12 @@ const CustomTemplateSection: SideSection = {
351
342
  const handleSearch = () => {
352
343
  if (search) {
353
344
  setSearchApplied(true);
354
- setItem('gallerySearchApplied', 'true');
355
345
  getTemplatesByTab();
356
346
  }
357
347
  };
358
348
 
359
349
  const removeSearchInput = () => {
360
350
  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');
367
351
  };
368
352
 
369
353
  const searchKeyDown = (event: any) => {
@@ -559,8 +543,7 @@ const CustomTemplateSection: SideSection = {
559
543
  useEffect(() => {
560
544
  if (!search && searchApplied) {
561
545
  setSearchApplied(false);
562
- removeItem('gallerySearch');
563
- removeItem('gallerySearchApplied');
546
+ setSearch('');
564
547
  setTimeout(() => {
565
548
  getTemplatesByTab();
566
549
  }, 100);
@@ -569,8 +552,6 @@ const CustomTemplateSection: SideSection = {
569
552
 
570
553
  useEffect(() => {
571
554
  searchRef.current = search;
572
- // Keep localStorage in sync so the value survives tab-switch remounts.
573
- setItem('gallerySearch', search);
574
555
  }, [search]);
575
556
 
576
557
  useEffect(() => {
package/version.js CHANGED
@@ -1 +1 @@
1
- export const SDK_VERSION = '2.1.5-beta.9';
1
+ export const SDK_VERSION = '2.1.6';