@eintrek/erp-shell 0.1.77 → 0.1.79

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.
@@ -308,6 +308,21 @@ export type GuideAction = {
308
308
  | {
309
309
  type: "back";
310
310
  }
311
+ /**
312
+ * Another tab took over (shell ≥ 0.1.78): stop here, silently — a running
313
+ * step, an offer, a card or the panel goes, nothing is written.
314
+ */
315
+ | {
316
+ type: "yield";
317
+ }
318
+ /** The server's rows, read again (another tab saved, or this tab took over). */
319
+ | {
320
+ type: "refresh";
321
+ progress: GuideProgress;
322
+ pages: Record<string, PageRow>;
323
+ sections?: Record<string, PageRow>;
324
+ flows?: Record<string, PageRow>;
325
+ }
311
326
  /** A page row came back from the server. */
312
327
  | {
313
328
  type: "pageRow";
@@ -13,6 +13,11 @@ import { type GuideProgress, type GuidesAnswer, type PageRow } from "./progress"
13
13
  export interface GuideProgressRequest {
14
14
  /** The suite's app ("peoplx", "liff"). */
15
15
  app: string;
16
+ /**
17
+ * fetchProgress only: another tab saved, or this tab is taking over — skip
18
+ * any cache and ask the server (shell ≥ 0.1.78).
19
+ */
20
+ fresh?: boolean;
16
21
  /** The suite's key, the row on the server ("liff.first-run"). */
17
22
  guideKey: string;
18
23
  }
@@ -59,7 +64,7 @@ export declare class GuideProgressConflict extends Error {
59
64
  constructor(current: unknown, code?: string);
60
65
  }
61
66
  /** The GET, parsed for this suite; null (show nothing) on any failure or odd answer. */
62
- export declare function loadGuides(adapter: GuideProgressAdapter, suite: GuideSuite, signal?: AbortSignal): Promise<GuidesAnswer | null>;
67
+ export declare function loadGuides(adapter: GuideProgressAdapter, suite: GuideSuite, signal?: AbortSignal, fresh?: boolean): Promise<GuidesAnswer | null>;
63
68
  /**
64
69
  * PUT the whole state. On 409 the server's row comes back: merge (keeping
65
70
  * whatever is further along) and try once more with its rev. Returns the
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
- var format = require('./chunks/format-DQLPHq7h.cjs');
4
+ var format = require('./chunks/format-CFXhGhta.cjs');
5
5
  require('react/jsx-runtime');
6
6
  require('react');
7
7
  require('react-dom');
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- export { A as GUIDE_API_EVENT, G as GUIDE_EVENT_PREFIX, a as GUIDE_LAYER_ATTRIBUTE, c as GuideProgressConflict, d as GuideRuntime, S as SectionGuideButton, T as THAI_MONTHS_SHORT, e as apiCallDetail, f as emitGuideEvent, g as fillRoute, h as formatBaht, i as guideAnchor, j as guideMenuItems, k as guideMenuShown, l as loadGuides, m as matchApiPath, n as matchRoute, o as openFlow, p as openFlowsPanel, q as openGuidePanel, r as openPageGuide, s as openPagesPanel, t as openSectionGuide, u as reportApiCall, v as reportApiEvent, w as setSectionGuideValues, x as storeGuides, y as thaiMonth, z as thaiMonthYear, B as useGuideEntry, C as usePageGuideEntry, D as usePageGuides, E as useSectionGuideValues } from './chunks/format-ILrTMV4G.esm.js';
2
+ export { A as GUIDE_API_EVENT, G as GUIDE_EVENT_PREFIX, a as GUIDE_LAYER_ATTRIBUTE, c as GuideProgressConflict, d as GuideRuntime, S as SectionGuideButton, T as THAI_MONTHS_SHORT, e as apiCallDetail, f as emitGuideEvent, g as fillRoute, h as formatBaht, i as guideAnchor, j as guideMenuItems, k as guideMenuShown, l as loadGuides, m as matchApiPath, n as matchRoute, o as openFlow, p as openFlowsPanel, q as openGuidePanel, r as openPageGuide, s as openPagesPanel, t as openSectionGuide, u as reportApiCall, v as reportApiEvent, w as setSectionGuideValues, x as storeGuides, y as thaiMonth, z as thaiMonthYear, B as useGuideEntry, C as usePageGuideEntry, D as usePageGuides, E as useSectionGuideValues } from './chunks/format-BqUpxbzD.esm.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
5
  import 'react-dom';
package/dist/index.cjs CHANGED
@@ -14,7 +14,7 @@ var Link = require('next/link');
14
14
  var reactDom = require('react-dom');
15
15
  var nextThemes = require('next-themes');
16
16
  var axios = require('axios');
17
- var format = require('./chunks/format-DQLPHq7h.cjs');
17
+ var format = require('./chunks/format-CFXhGhta.cjs');
18
18
  var reactQueryDevtools = require('@tanstack/react-query-devtools');
19
19
  require('@floating-ui/dom');
20
20
 
@@ -1740,7 +1740,7 @@ function platformApiBase(app) {
1740
1740
  * This package's version, attached to help messages so the back office can
1741
1741
  * tell which shell a report came from. Keep in step with package.json.
1742
1742
  */
1743
- const SHELL_VERSION = "0.1.77";
1743
+ const SHELL_VERSION = "0.1.79";
1744
1744
 
1745
1745
  const HELP_APP_LABEL = {
1746
1746
  platform: "แพลตฟอร์ม",
@@ -3658,7 +3658,8 @@ function GuideHostInner({ config, organizationId, code }) {
3658
3658
  fetchProgress: req => client.fetchQuery({
3659
3659
  queryKey: ["erp-shell", "guides", organizationId, suite.app, suite.key, suite.version],
3660
3660
  queryFn: ({ signal }) => platform.fetchProgress({ ...req, signal }).catch(() => null),
3661
- staleTime: 5 * 60000,
3661
+ // Fresh after another tab saved (0.1.78); otherwise kept 5 minutes.
3662
+ staleTime: req.fresh ? 0 : 5 * 60000,
3662
3663
  gcTime: 30 * 60000,
3663
3664
  retry: false,
3664
3665
  }),