@lark-apaas/client-toolkit 1.2.81 → 1.2.82-alpha.20261104064739

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.
@@ -6,6 +6,9 @@ import { normalizeBasePath } from "../../utils/utils.js";
6
6
  function PageHoc({ children }) {
7
7
  useEffect(()=>{
8
8
  if ('development' !== process.env.NODE_ENV) return;
9
+ try {
10
+ if ('workmate' === process.env.MIAODA_APP_CREATED_VIA) return;
11
+ } catch {}
9
12
  let cancelled = false;
10
13
  const basePath = normalizeBasePath(process.env.CLIENT_BASE_PATH);
11
14
  const id = networkIdleCallback(()=>{
@@ -46,6 +46,7 @@ beforeEach(()=>{
46
46
  vi.useFakeTimers();
47
47
  vi.clearAllMocks();
48
48
  vi.stubEnv('NODE_ENV', 'development');
49
+ vi.stubEnv('MIAODA_APP_CREATED_VIA', void 0);
49
50
  vi.stubEnv('CLIENT_BASE_PATH', '/app/test/');
50
51
  globalThis.IS_REACT_ACT_ENVIRONMENT = true;
51
52
  container = document.createElement('div');
@@ -102,6 +103,53 @@ describe('development page screenshot', ()=>{
102
103
  expect(snapdom).not.toHaveBeenCalled();
103
104
  expect(submitPostMessage).not.toHaveBeenCalled();
104
105
  });
106
+ it('does not schedule or capture for workmate applications', async ()=>{
107
+ vi.stubEnv('MIAODA_APP_CREATED_VIA', 'workmate');
108
+ await mount();
109
+ await idle();
110
+ expect(container.textContent).toBe('Application');
111
+ expect(networkIdleCallback).not.toHaveBeenCalled();
112
+ expect(snapdom).not.toHaveBeenCalled();
113
+ expect(submitPostMessage).not.toHaveBeenCalled();
114
+ });
115
+ it.each([
116
+ void 0,
117
+ '',
118
+ 'miaoda'
119
+ ])('still captures for other creation sources: %s', async (source)=>{
120
+ vi.stubEnv('MIAODA_APP_CREATED_VIA', source);
121
+ await mount();
122
+ await idle();
123
+ expect(snapdom).toHaveBeenCalledTimes(1);
124
+ expect(submitPostMessage).toHaveBeenCalledWith({
125
+ type: 'PageScreenshot',
126
+ data: png
127
+ });
128
+ });
129
+ it('still captures when an older preset leaves the creation source unavailable', async ()=>{
130
+ const originalProcess = process;
131
+ const env = new Proxy(process.env, {
132
+ get (target, key) {
133
+ if ('MIAODA_APP_CREATED_VIA' === key) throw new ReferenceError('process is not defined');
134
+ return Reflect.get(target, key);
135
+ }
136
+ });
137
+ vi.stubGlobal('process', new Proxy(originalProcess, {
138
+ get (target, key) {
139
+ return 'env' === key ? env : Reflect.get(target, key);
140
+ }
141
+ }));
142
+ try {
143
+ await mount();
144
+ await idle();
145
+ } finally{
146
+ vi.unstubAllGlobals();
147
+ }
148
+ expect(submitPostMessage).toHaveBeenCalledWith({
149
+ type: 'PageScreenshot',
150
+ data: png
151
+ });
152
+ });
105
153
  it('only schedules one active capture under StrictMode', async ()=>{
106
154
  await mount(true);
107
155
  await idle();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/client-toolkit",
3
- "version": "1.2.81",
3
+ "version": "1.2.82-alpha.20261104064739",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
@@ -105,7 +105,7 @@
105
105
  "@lark-apaas/dataloom": "^0.1.6",
106
106
  "@lark-apaas/internal-slardar": "^0.0.3",
107
107
  "@lark-apaas/miaoda-inspector": "^1.0.25",
108
- "@lark-apaas/observable-web": "^1.0.11",
108
+ "@lark-apaas/observable-web": "^1.0.6",
109
109
  "@radix-ui/react-avatar": "^1.1.10",
110
110
  "@radix-ui/react-popover": "^1.1.15",
111
111
  "@radix-ui/react-slot": "^1.2.3",