@tap-payments/os-micro-frontend-shared 0.1.259 → 0.1.260

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.
@@ -76,6 +76,19 @@ export type NavigateFunction = (params: {
76
76
  sandboxMode?: boolean;
77
77
  state?: any;
78
78
  }) => void;
79
+ export interface PreviewStorageData {
80
+ id: string;
81
+ img: string;
82
+ timestamp: number;
83
+ }
84
+ export interface PreviewData {
85
+ id: string;
86
+ img: string;
87
+ isGenerating: boolean;
88
+ serviceCode?: string;
89
+ appCode: string;
90
+ isMinimized: boolean;
91
+ }
79
92
  export type MFWidgetBaseProps = {
80
93
  windowId: string;
81
94
  i18n?: i18n;
@@ -1,4 +1,4 @@
1
- import { AppDetails, Segment, TableMode, Timezone } from '../types/index.js';
1
+ import { AppDetails, PreviewData, Segment, TableMode, Timezone } from '../types/index.js';
2
2
  import { SheetViewColumnsData } from './columnResizeStorage';
3
3
  export declare function setSecretKey(): void;
4
4
  export declare function getSecretKey(): string | null;
@@ -32,4 +32,7 @@ export declare const getGlobalTableModeStorage: () => TableMode;
32
32
  export declare const removeGlobalTableModeStorage: () => void;
33
33
  export declare const setSheetViewColumnsStorage: (data: SheetViewColumnsData) => void;
34
34
  export declare const getSheetViewColumnsStorage: () => SheetViewColumnsData;
35
+ export declare const setPreviewStorage: (previews: PreviewData[]) => void;
36
+ export declare const getPreviewStorage: () => Map<string, string>;
37
+ export declare const removePreviewStorage: () => void;
35
38
  export declare const clearTapOsLocalStorage: () => void;
@@ -12,6 +12,7 @@ const CALENDER_TIMEZONE = 'tap-dashboard-calender-timezone';
12
12
  const CALENDER_TIMEZONE_HISTORY = 'tap-dashboard-calender-timezone-history';
13
13
  const GLOBAL_TABLE_MODE_KEY = 'tap-dashboard-global-table-mode';
14
14
  const SHEETVIEW_COLUMNS_KEY = 'sheetview_columns';
15
+ const PREVIEW_STORAGE_KEY = 'dock-preview-windows';
15
16
  export function setSecretKey() {
16
17
  localStorage.setItem(SECRET_KEY_LOCAL_STORAGE, TEST_SECRET_KEY);
17
18
  }
@@ -169,6 +170,45 @@ export const removeGlobalTableModeStorage = () => {
169
170
  };
170
171
  export const setSheetViewColumnsStorage = (data) => localStorage.setItem(SHEETVIEW_COLUMNS_KEY, JSON.stringify(data));
171
172
  export const getSheetViewColumnsStorage = () => JSON.parse(localStorage.getItem(SHEETVIEW_COLUMNS_KEY) || '{}');
173
+ export const setPreviewStorage = (previews) => {
174
+ try {
175
+ const data = previews
176
+ .filter((p) => p.img)
177
+ .map((p) => ({
178
+ id: p.id,
179
+ img: p.img,
180
+ timestamp: Date.now(),
181
+ }));
182
+ localStorage.setItem(PREVIEW_STORAGE_KEY, JSON.stringify(data));
183
+ }
184
+ catch (error) {
185
+ console.warn('Failed to save preview cache:', error);
186
+ }
187
+ };
188
+ export const getPreviewStorage = () => {
189
+ try {
190
+ const cached = localStorage.getItem(PREVIEW_STORAGE_KEY);
191
+ if (!cached)
192
+ return new Map();
193
+ const data = JSON.parse(cached);
194
+ const previewMap = new Map();
195
+ data.forEach((item) => {
196
+ previewMap.set(item.id, item.img);
197
+ });
198
+ return previewMap;
199
+ }
200
+ catch (error) {
201
+ return new Map();
202
+ }
203
+ };
204
+ export const removePreviewStorage = () => {
205
+ try {
206
+ localStorage.removeItem(PREVIEW_STORAGE_KEY);
207
+ }
208
+ catch (error) {
209
+ console.warn('Failed to remove preview storage:', error);
210
+ }
211
+ };
172
212
  export const clearTapOsLocalStorage = () => {
173
213
  removeSecretKey();
174
214
  removeConnectMetaData();
@@ -180,4 +220,5 @@ export const clearTapOsLocalStorage = () => {
180
220
  removeCalenderTimezone();
181
221
  removeCalenderTimezoneHistory();
182
222
  removeGlobalTableModeStorage();
223
+ removePreviewStorage();
183
224
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.259",
4
+ "version": "0.1.260",
5
5
  "testVersion": 0,
6
6
  "type": "module",
7
7
  "main": "build/index.js",