@shopify/ui-extensions-server-kit 5.4.1 → 5.5.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @shopify/ui-extensions-server-kit
2
2
 
3
+ ## 5.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 86d164b: Add support for the `intercepts` UI extension target capability.
8
+
3
9
  ## 5.4.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License">
6
6
  <a href="https://github.com/Shopify/cli/actions/workflows/shopify-cli.yml">![badge](https://github.com/Shopify/cli/actions/workflows/shopify-cli.yml/badge.svg)</a>
7
7
 
8
- With the Shopify command line interface (Shopify CLI 3.0), you can:
8
+ With the Shopify command line interface (Shopify CLI), you can:
9
9
  - initialize, build, dev, and deploy Shopify apps, extensions, functions and themes
10
10
  - build custom storefronts and manage their hosting
11
11
 
@@ -39,7 +39,7 @@ To work with themes, the CLI needs to be installed globally with:
39
39
 
40
40
  - `npm install -g @shopify/cli`
41
41
 
42
- You can also use do it through Homebrew on macOS: `brew tap shopify/shopify && brew install shopify-cli`
42
+ You can also install it through Homebrew on macOS: `brew tap shopify/shopify && brew install shopify-cli`
43
43
 
44
44
  Learn more in the docs: [Shopify CLI for themes](https://shopify.dev/docs/storefronts/themes/tools/cli)
45
45
 
package/dist/types.d.ts CHANGED
@@ -84,6 +84,15 @@ interface Metafield {
84
84
  namespace: string;
85
85
  key: string;
86
86
  }
87
+ export interface ExtensionPointIntercept {
88
+ event: string;
89
+ blocking: boolean;
90
+ applies_to?: string[];
91
+ }
92
+ export interface ExtensionPointCapabilities {
93
+ allow_direct_linking?: boolean;
94
+ intercepts?: ExtensionPointIntercept[];
95
+ }
87
96
  export interface ExtensionPoint {
88
97
  target: string;
89
98
  surface: Surface;
@@ -94,6 +103,7 @@ export interface ExtensionPoint {
94
103
  name: string;
95
104
  description?: string;
96
105
  assets?: Record<string, Asset>;
106
+ capabilities?: ExtensionPointCapabilities;
97
107
  }
98
108
  type ExtensionPoints = string[] | ExtensionPoint[] | null;
99
109
  interface CollectBuyerConsentCapabilities {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-react",
3
- "version": "5.1.4",
3
+ "version": "5.2.0",
4
4
  "description": "The default Vite plugin for React projects",
5
5
  "keywords": [
6
6
  "babel",
@@ -57,7 +57,7 @@
57
57
  "tsdown": "^0.20.3"
58
58
  },
59
59
  "peerDependencies": {
60
- "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
60
+ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
61
61
  },
62
62
  "engines": {
63
63
  "node": "^20.19.0 || >=22.12.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopify/ui-extensions-server-kit",
3
- "version": "5.4.1",
3
+ "version": "5.5.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -45,11 +45,11 @@
45
45
  "devDependencies": {
46
46
  "@testing-library/react": "^16.3.2",
47
47
  "@types/react": "^18.2.0",
48
- "@vitejs/plugin-react": "^5.1.4",
48
+ "@vitejs/plugin-react": "^5.2.0",
49
49
  "jsdom": "^25.0.0",
50
50
  "react": "^18.2.0",
51
51
  "react-dom": "^18.2.0",
52
- "vite": "6.4.1"
52
+ "vite": "6.4.3"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "react": ">=17.0.2"
package/project.json CHANGED
@@ -13,30 +13,12 @@
13
13
  "cwd": "packages/ui-extensions-server-kit"
14
14
  }
15
15
  },
16
- "build:code": {
17
- "executor": "nx:run-commands",
18
- "outputs": ["{workspaceRoot}/dist"],
19
- "options": {
20
- "command": "pnpm vite build --config vite.config.mts",
21
- "cwd": "packages/ui-extensions-server-kit"
22
- }
23
- },
24
- "build:types": {
25
- "executor": "nx:run-commands",
26
- "dependsOn": ["^build"],
27
- "outputs": ["{workspaceRoot}/dist"],
28
- "options": {
29
- "command": "pnpm tsc --emitDeclarationOnly",
30
- "cwd": "packages/ui-extensions-server-kit"
31
- }
32
- },
33
16
  "build": {
34
17
  "executor": "nx:run-commands",
35
- "dependsOn": ["build:code", "build:types"],
36
- "outputs": ["{workspaceRoot}/dist"],
37
- "inputs": ["{projectRoot}/src/**/*", "{projectRoot}/testing.*", "{projectRoot}/index.*"],
18
+ "dependsOn": ["^build"],
38
19
  "options": {
39
- "command": "cd .",
20
+ "commands": ["pnpm vite build --config vite.config.mts", "pnpm tsc --emitDeclarationOnly"],
21
+ "parallel": true,
40
22
  "cwd": "packages/ui-extensions-server-kit"
41
23
  }
42
24
  },
@@ -8,6 +8,7 @@ import {
8
8
  createFocusAction,
9
9
  createUnfocusAction,
10
10
  } from '../actions'
11
+ import {vi} from 'vitest'
11
12
 
12
13
  import type {ExtensionServerState} from './types'
13
14
 
@@ -92,8 +93,11 @@ describe('extensionServerReducer()', () => {
92
93
  })
93
94
  })
94
95
 
95
- // eslint-disable-next-line vitest/no-disabled-tests
96
- test.skip('refreshes extension url', async () => {
96
+ test('refreshes extension url', () => {
97
+ vi.useFakeTimers()
98
+ const time1 = 1000
99
+ vi.setSystemTime(time1)
100
+
97
101
  const extension = mockExtension()
98
102
  const previousState: ExtensionServerState = {
99
103
  store: 'test-store.com',
@@ -105,20 +109,21 @@ describe('extensionServerReducer()', () => {
105
109
  const state1 = extensionServerReducer(previousState, action)
106
110
 
107
111
  const url1 = new URL(state1.extensions[0].assets.main.url)
108
- const timestamp1 = url1.searchParams.get('lastUpdated') ?? ''
112
+ const timestamp1 = url1.searchParams.get('lastUpdated')
109
113
 
110
- expect(timestamp1.length).toBeGreaterThan(0)
114
+ expect(timestamp1).toBe(time1.toString())
111
115
 
112
- // sleep 1ms to guarantee new timestamp
113
- await new Promise((resolve) => setTimeout(resolve, 1))
116
+ const time2 = 2000
117
+ vi.setSystemTime(time2)
114
118
 
115
119
  const state2 = extensionServerReducer(state1, action)
116
120
 
117
121
  const url2 = new URL(state2.extensions[0].assets.main.url)
118
- const timestamp2 = url2.searchParams.get('lastUpdated') ?? ''
122
+ const timestamp2 = url2.searchParams.get('lastUpdated')
123
+
124
+ expect(timestamp2).toBe(time2.toString())
119
125
 
120
- expect(timestamp2.length).toBeGreaterThan(0)
121
- expect(timestamp1).not.toStrictEqual(timestamp2)
126
+ vi.useRealTimers()
122
127
  })
123
128
 
124
129
  describe('focus', () => {
package/src/types.ts CHANGED
@@ -83,6 +83,17 @@ interface Metafield {
83
83
  key: string
84
84
  }
85
85
 
86
+ export interface ExtensionPointIntercept {
87
+ event: string
88
+ blocking: boolean
89
+ applies_to?: string[]
90
+ }
91
+
92
+ export interface ExtensionPointCapabilities {
93
+ allow_direct_linking?: boolean
94
+ intercepts?: ExtensionPointIntercept[]
95
+ }
96
+
86
97
  export interface ExtensionPoint {
87
98
  target: string
88
99
  surface: Surface
@@ -93,6 +104,7 @@ export interface ExtensionPoint {
93
104
  name: string
94
105
  description?: string
95
106
  assets?: Record<string, Asset>
107
+ capabilities?: ExtensionPointCapabilities
96
108
  }
97
109
 
98
110
  type ExtensionPoints = string[] | ExtensionPoint[] | null