@shopify/ui-extensions-server-kit 0.0.0-experimental-20260902222805
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 +157 -0
- package/README.md +75 -0
- package/dist/ExtensionServerClient/ExtensionServerClient.d.ts +27 -0
- package/dist/ExtensionServerClient/ExtensionServerClient.test.d.ts +9 -0
- package/dist/ExtensionServerClient/index.d.ts +2 -0
- package/dist/ExtensionServerClient/server-types.d.ts +66 -0
- package/dist/ExtensionServerClient/types.d.ts +124 -0
- package/dist/_virtual/jsx-runtime.cjs.js +1 -0
- package/dist/_virtual/jsx-runtime.cjs2.js +1 -0
- package/dist/_virtual/jsx-runtime.es.js +5 -0
- package/dist/_virtual/jsx-runtime.es2.js +4 -0
- package/dist/_virtual/react-jsx-runtime.development.cjs.js +1 -0
- package/dist/_virtual/react-jsx-runtime.development.es.js +4 -0
- package/dist/_virtual/react-jsx-runtime.production.min.cjs.js +1 -0
- package/dist/_virtual/react-jsx-runtime.production.min.es.js +4 -0
- package/dist/context/ExtensionServerProvider.d.ts +3 -0
- package/dist/context/ExtensionServerProvider.test.d.ts +1 -0
- package/dist/context/constants.d.ts +2 -0
- package/dist/context/index.d.ts +3 -0
- package/dist/context/types.d.ts +12 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/useExtensionServerContext.d.ts +1 -0
- package/dist/hooks/useExtensionServerState.d.ts +1 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
- package/dist/i18n.d.ts +68 -0
- package/dist/i18n.test.d.ts +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.cjs2.js +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.es.js +46 -0
- package/dist/index.es2.js +8 -0
- package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.cjs.js +22 -0
- package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.es.js +604 -0
- package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.cjs.js +9 -0
- package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.es.js +28 -0
- package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.cjs.js +1 -0
- package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.es.js +10 -0
- package/dist/packages/ui-extensions-server-kit/src/ExtensionServerClient/ExtensionServerClient.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/ExtensionServerClient/ExtensionServerClient.es.js +136 -0
- package/dist/packages/ui-extensions-server-kit/src/ExtensionServerClient/types.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/ExtensionServerClient/types.es.js +4 -0
- package/dist/packages/ui-extensions-server-kit/src/context/ExtensionServerProvider.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/context/ExtensionServerProvider.es.js +30 -0
- package/dist/packages/ui-extensions-server-kit/src/context/constants.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/context/constants.es.js +13 -0
- package/dist/packages/ui-extensions-server-kit/src/hooks/useExtensionServerContext.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/hooks/useExtensionServerContext.es.js +7 -0
- package/dist/packages/ui-extensions-server-kit/src/hooks/useExtensionServerState.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/hooks/useExtensionServerState.es.js +9 -0
- package/dist/packages/ui-extensions-server-kit/src/hooks/useIsomorphicLayoutEffect.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/hooks/useIsomorphicLayoutEffect.es.js +5 -0
- package/dist/packages/ui-extensions-server-kit/src/i18n.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/i18n.es.js +60 -0
- package/dist/packages/ui-extensions-server-kit/src/state/actions/actions.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/state/actions/actions.es.js +37 -0
- package/dist/packages/ui-extensions-server-kit/src/state/reducers/constants.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/state/reducers/constants.es.js +7 -0
- package/dist/packages/ui-extensions-server-kit/src/state/reducers/extensionServerReducer.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/state/reducers/extensionServerReducer.es.js +57 -0
- package/dist/packages/ui-extensions-server-kit/src/testing/MockExtensionServerProvider.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/testing/MockExtensionServerProvider.es.js +25 -0
- package/dist/packages/ui-extensions-server-kit/src/testing/app.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/testing/app.es.js +16 -0
- package/dist/packages/ui-extensions-server-kit/src/testing/extensions.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/testing/extensions.es.js +66 -0
- package/dist/packages/ui-extensions-server-kit/src/types.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/types.es.js +4 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/assetToString.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/assetToString.es.js +7 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/isUIExtension.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/isUIExtension.es.js +7 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/isValidSurface.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/isValidSurface.es.js +7 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/noop.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/noop.es.js +5 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/replaceUpdated.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/replaceUpdated.es.js +14 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/set.cjs.js +1 -0
- package/dist/packages/ui-extensions-server-kit/src/utilities/set.es.js +18 -0
- package/dist/state/actions/actions.d.ts +6 -0
- package/dist/state/actions/index.d.ts +2 -0
- package/dist/state/actions/types.d.ts +21 -0
- package/dist/state/index.d.ts +2 -0
- package/dist/state/reducers/constants.d.ts +2 -0
- package/dist/state/reducers/extensionServerReducer.d.ts +3 -0
- package/dist/state/reducers/extensionServerReducer.test.d.ts +1 -0
- package/dist/state/reducers/index.d.ts +3 -0
- package/dist/state/reducers/types.d.ts +6 -0
- package/dist/testing/MockExtensionServerProvider.d.ts +8 -0
- package/dist/testing/app.d.ts +2 -0
- package/dist/testing/extensions.d.ts +6 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/types.d.ts +196 -0
- package/dist/utilities/assetToString.d.ts +2 -0
- package/dist/utilities/assetToString.test.d.ts +1 -0
- package/dist/utilities/index.d.ts +6 -0
- package/dist/utilities/isUIExtension.d.ts +1 -0
- package/dist/utilities/isValidSurface.d.ts +2 -0
- package/dist/utilities/noop.d.ts +1 -0
- package/dist/utilities/replaceUpdated.d.ts +1 -0
- package/dist/utilities/replaceUpdated.test.d.ts +1 -0
- package/dist/utilities/set.d.ts +4 -0
- package/dist/utilities/set.test.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.mjs +1 -0
- package/node_modules/@testing-library/react/LICENSE +20 -0
- package/node_modules/@testing-library/react/README.md +692 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.cjs.js +537 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.esm.js +497 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.pure.cjs.js +501 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.pure.esm.js +461 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js +502 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.js.map +1 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js +2 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.pure.umd.min.js.map +1 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.umd.js +538 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.umd.js.map +1 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js +2 -0
- package/node_modules/@testing-library/react/dist/@testing-library/react.umd.min.js.map +1 -0
- package/node_modules/@testing-library/react/dist/act-compat.js +80 -0
- package/node_modules/@testing-library/react/dist/config.js +33 -0
- package/node_modules/@testing-library/react/dist/fire-event.js +70 -0
- package/node_modules/@testing-library/react/dist/index.js +52 -0
- package/node_modules/@testing-library/react/dist/pure.js +356 -0
- package/node_modules/@testing-library/react/dont-cleanup-after-each.js +1 -0
- package/node_modules/@testing-library/react/package.json +116 -0
- package/node_modules/@testing-library/react/pure.d.ts +1 -0
- package/node_modules/@testing-library/react/pure.js +2 -0
- package/node_modules/@testing-library/react/types/index.d.ts +287 -0
- package/node_modules/@testing-library/react/types/pure.d.ts +1 -0
- package/node_modules/@types/react/LICENSE +21 -0
- package/node_modules/@types/react/README.md +15 -0
- package/node_modules/@types/react/canary.d.ts +166 -0
- package/node_modules/@types/react/experimental.d.ts +127 -0
- package/node_modules/@types/react/global.d.ts +160 -0
- package/node_modules/@types/react/index.d.ts +4543 -0
- package/node_modules/@types/react/jsx-dev-runtime.d.ts +45 -0
- package/node_modules/@types/react/jsx-runtime.d.ts +36 -0
- package/node_modules/@types/react/package.json +206 -0
- package/node_modules/@types/react/ts5.0/canary.d.ts +166 -0
- package/node_modules/@types/react/ts5.0/experimental.d.ts +127 -0
- package/node_modules/@types/react/ts5.0/global.d.ts +160 -0
- package/node_modules/@types/react/ts5.0/index.d.ts +4530 -0
- package/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts +44 -0
- package/node_modules/@types/react/ts5.0/jsx-runtime.d.ts +35 -0
- package/node_modules/@vitejs/plugin-react/LICENSE +21 -0
- package/node_modules/@vitejs/plugin-react/README.md +159 -0
- package/node_modules/@vitejs/plugin-react/dist/index.d.ts +75 -0
- package/node_modules/@vitejs/plugin-react/dist/index.js +401 -0
- package/node_modules/@vitejs/plugin-react/dist/refresh-runtime.js +663 -0
- package/node_modules/@vitejs/plugin-react/package.json +77 -0
- package/node_modules/@vitejs/plugin-react/types/preamble.d.ts +1 -0
- package/package.json +64 -0
- package/project.json +40 -0
- package/scripts/create-entry-files.ts +44 -0
- package/src/ExtensionServerClient/ExtensionServerClient.test.ts +1238 -0
- package/src/ExtensionServerClient/ExtensionServerClient.ts +320 -0
- package/src/ExtensionServerClient/index.ts +2 -0
- package/src/ExtensionServerClient/server-types.ts +65 -0
- package/src/ExtensionServerClient/types.ts +159 -0
- package/src/context/ExtensionServerProvider.test.tsx +318 -0
- package/src/context/ExtensionServerProvider.tsx +48 -0
- package/src/context/constants.ts +16 -0
- package/src/context/index.ts +3 -0
- package/src/context/types.ts +14 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useExtensionServerContext.ts +4 -0
- package/src/hooks/useExtensionServerState.ts +6 -0
- package/src/hooks/useIsomorphicLayoutEffect.ts +6 -0
- package/src/i18n.test.ts +417 -0
- package/src/i18n.ts +205 -0
- package/src/index.ts +7 -0
- package/src/state/actions/actions.ts +36 -0
- package/src/state/actions/index.ts +2 -0
- package/src/state/actions/types.ts +26 -0
- package/src/state/index.ts +2 -0
- package/src/state/reducers/constants.ts +6 -0
- package/src/state/reducers/extensionServerReducer.test.ts +165 -0
- package/src/state/reducers/extensionServerReducer.ts +87 -0
- package/src/state/reducers/index.ts +3 -0
- package/src/state/reducers/types.ts +7 -0
- package/src/testing/MockExtensionServerProvider.tsx +36 -0
- package/src/testing/app.ts +15 -0
- package/src/testing/extensions.ts +71 -0
- package/src/testing/index.ts +3 -0
- package/src/types.ts +204 -0
- package/src/utilities/assetToString.test.ts +16 -0
- package/src/utilities/assetToString.ts +7 -0
- package/src/utilities/index.ts +6 -0
- package/src/utilities/isUIExtension.ts +8 -0
- package/src/utilities/isValidSurface.ts +6 -0
- package/src/utilities/noop.ts +1 -0
- package/src/utilities/replaceUpdated.test.ts +26 -0
- package/src/utilities/replaceUpdated.ts +15 -0
- package/src/utilities/set.test.ts +19 -0
- package/src/utilities/set.ts +35 -0
- package/testing.d.ts +1 -0
- package/testing.js +1 -0
- package/testing.mjs +1 -0
- package/tests/setup.ts +3 -0
- package/vite.config.mts +57 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# @shopify/ui-extensions-server-kit
|
|
2
|
+
|
|
3
|
+
## 0.0.0-experimental-20260902222805
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 86d164b: Add support for the `intercepts` UI extension target capability.
|
|
8
|
+
|
|
9
|
+
## 5.4.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- dbc91b4: Update types to include appassets and allowedDomains
|
|
14
|
+
|
|
15
|
+
## 5.4.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 7680a16: Added supportedFeatures to ExtensionPayload
|
|
20
|
+
|
|
21
|
+
## 5.3.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 7f2f69a: Added optional `error` property to ExtensionPayload which include the `message` and `file`
|
|
26
|
+
|
|
27
|
+
## 5.3.0
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- 386bf0e: Add support for displaying UI Extension dev logs
|
|
32
|
+
|
|
33
|
+
## 5.2.1
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- 40a7b1229a: CLI now better handles 429 rate limiting for large projects
|
|
38
|
+
|
|
39
|
+
## 5.2.0
|
|
40
|
+
|
|
41
|
+
### Minor Changes
|
|
42
|
+
|
|
43
|
+
- 1d6fe3475: Increase minimum Node version to 18
|
|
44
|
+
- 0896e62b1: Versioned app config support
|
|
45
|
+
|
|
46
|
+
## 5.1.0
|
|
47
|
+
|
|
48
|
+
### Minor Changes
|
|
49
|
+
|
|
50
|
+
- 84fddcf69: Added support for optional localizable description to UI extensions dev and deploy
|
|
51
|
+
|
|
52
|
+
## 5.0.0
|
|
53
|
+
|
|
54
|
+
### Major Changes
|
|
55
|
+
|
|
56
|
+
- ec90885f4: Drop support for setting a translatable label at the extension point level.
|
|
57
|
+
The translatable merchant-facing string should be set at using the extension's name instead.
|
|
58
|
+
|
|
59
|
+
### Minor Changes
|
|
60
|
+
|
|
61
|
+
- b8e11a77d: @shopify/ui-extensions-server-kit enable subscribing to connection open/close events
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- 8519a9701: Update helper for return the surface for each extension target to account for new target names
|
|
66
|
+
|
|
67
|
+
## 4.2.1
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- ae1e35d42: Add missing apiVersion prop to the UIExtension interface
|
|
72
|
+
|
|
73
|
+
## 4.2.0
|
|
74
|
+
|
|
75
|
+
### Minor Changes
|
|
76
|
+
|
|
77
|
+
- 2c6e98652: Enable ui-extensions-server-kit to send translated strings for the requested locales
|
|
78
|
+
|
|
79
|
+
## 4.1.0
|
|
80
|
+
|
|
81
|
+
### Minor Changes
|
|
82
|
+
|
|
83
|
+
- 335a96a24: Improved dev console with new UX & functionality. New functionality: Preview app link and QRCode, better post purchase extension instructions, copy button for all preview links, support for upcoming UI extension changes
|
|
84
|
+
|
|
85
|
+
## 4.0.1
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- 10b86c459: Expose missing API types
|
|
90
|
+
|
|
91
|
+
## 4.0.0
|
|
92
|
+
|
|
93
|
+
### Major Changes
|
|
94
|
+
|
|
95
|
+
- feee9215: Remove APIClient from ui-extensions-server-kit. APIClient is not used by the package and although it's exposed externally, all its functionality is also handled by ExtensionServerClient
|
|
96
|
+
|
|
97
|
+
## 3.25.0
|
|
98
|
+
|
|
99
|
+
## 3.24.1
|
|
100
|
+
|
|
101
|
+
## 3.24.0
|
|
102
|
+
|
|
103
|
+
## 3.23.0
|
|
104
|
+
|
|
105
|
+
## 3.22.1
|
|
106
|
+
|
|
107
|
+
## 3.22.0
|
|
108
|
+
|
|
109
|
+
## 3.21.0
|
|
110
|
+
|
|
111
|
+
## 3.20.1
|
|
112
|
+
|
|
113
|
+
## 3.20.0
|
|
114
|
+
|
|
115
|
+
## 3.19.0
|
|
116
|
+
|
|
117
|
+
## 3.18.0
|
|
118
|
+
|
|
119
|
+
## 3.17.0
|
|
120
|
+
|
|
121
|
+
## 3.16.3
|
|
122
|
+
|
|
123
|
+
## 3.16.2
|
|
124
|
+
|
|
125
|
+
## 3.16.1
|
|
126
|
+
|
|
127
|
+
## 3.16.0
|
|
128
|
+
|
|
129
|
+
## 3.15.0
|
|
130
|
+
|
|
131
|
+
## 3.14.0
|
|
132
|
+
|
|
133
|
+
## 3.13.1
|
|
134
|
+
|
|
135
|
+
## 3.13.0
|
|
136
|
+
|
|
137
|
+
## 3.12.0
|
|
138
|
+
|
|
139
|
+
## 3.11.0
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- 4fca2930: Fix prepack and private configurations
|
|
144
|
+
|
|
145
|
+
## 3.10.1
|
|
146
|
+
|
|
147
|
+
## 3.10.0
|
|
148
|
+
|
|
149
|
+
## 3.9.2
|
|
150
|
+
|
|
151
|
+
## 3.9.1
|
|
152
|
+
|
|
153
|
+
## 3.9.0
|
|
154
|
+
|
|
155
|
+
## 3.8.0
|
|
156
|
+
|
|
157
|
+
## 3.7.1
|
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<img src="https://github.com/Shopify/cli/blob/main/assets/logo.png?raw=true" width="150"/>
|
|
2
|
+
|
|
3
|
+
# Shopify CLI
|
|
4
|
+
<a href="http://twitter.com/ShopifyDevs"><img src="https://img.shields.io/twitter/follow/ShopifyDevs?style=flat-square" alt="Twitter Followers"></a>
|
|
5
|
+
<img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License">
|
|
6
|
+
<a href="https://github.com/Shopify/cli/actions/workflows/shopify-cli.yml"></a>
|
|
7
|
+
|
|
8
|
+
With the Shopify command line interface (Shopify CLI), you can:
|
|
9
|
+
- initialize, build, dev, and deploy Shopify apps, extensions, functions and themes
|
|
10
|
+
- build custom storefronts and manage their hosting
|
|
11
|
+
|
|
12
|
+
Learn more in the [commands docs](./packages/cli/README.md#commands).
|
|
13
|
+
|
|
14
|
+
<p> </p>
|
|
15
|
+
|
|
16
|
+
## Before you begin
|
|
17
|
+
|
|
18
|
+
Install the latest version of [Node.js](https://nodejs.org/en/download/) and [npm](https://docs.npmjs.com/getting-started) (or another package manager of your choice).
|
|
19
|
+
|
|
20
|
+
<p> </p>
|
|
21
|
+
|
|
22
|
+
## Developing apps with Shopify CLI
|
|
23
|
+
|
|
24
|
+
When you’re building a Shopify app, you can initialize your project using your preferred package manager. A single command will install all the dependencies you need — including Shopify CLI itself.
|
|
25
|
+
|
|
26
|
+
Initialize your project using one of the following commands:
|
|
27
|
+
- `npm init @shopify/app@latest` (installed by default with Node)
|
|
28
|
+
- `pnpm create @shopify/create-app@latest`
|
|
29
|
+
- `yarn create @shopify/app`
|
|
30
|
+
- `bun create @shopify/app@latest` (experimental)
|
|
31
|
+
|
|
32
|
+
Learn more in the docs: [Create an app](https://shopify.dev/apps/getting-started/create)
|
|
33
|
+
|
|
34
|
+
<p> </p>
|
|
35
|
+
|
|
36
|
+
## Developing themes with Shopify CLI
|
|
37
|
+
|
|
38
|
+
To work with themes, the CLI needs to be installed globally with:
|
|
39
|
+
|
|
40
|
+
- `npm install -g @shopify/cli`
|
|
41
|
+
|
|
42
|
+
You can also install it through Homebrew on macOS: `brew tap shopify/shopify && brew install shopify-cli`
|
|
43
|
+
|
|
44
|
+
Learn more in the docs: [Shopify CLI for themes](https://shopify.dev/docs/storefronts/themes/tools/cli)
|
|
45
|
+
|
|
46
|
+
<p> </p>
|
|
47
|
+
|
|
48
|
+
## Developing Hydrogen custom storefronts with Shopify CLI ##
|
|
49
|
+
|
|
50
|
+
The Hydrogen code lives here: https://github.com/Shopify/hydrogen/tree/main/packages/cli
|
|
51
|
+
|
|
52
|
+
Learn more in the docs: [Shopify CLI for Hydrogen storefronts](https://shopify.dev/docs/custom-storefronts/hydrogen/cli)
|
|
53
|
+
|
|
54
|
+
<p> </p>
|
|
55
|
+
|
|
56
|
+
## Help 🖐
|
|
57
|
+
|
|
58
|
+
If you encounter issues using the CLI or have feedback you'd like to share with us, below are some options:
|
|
59
|
+
|
|
60
|
+
- [File a bug report](https://community.shopify.dev/c/shopify-cli-libraries/14) - To report bugs create a post in Shopify CLI and Libraries on the dev community
|
|
61
|
+
- [Ask a question or request a new feature](https://community.shopify.dev/c/dev-platform/32) - To ask a question or request a new feature create a post in Dev Platform on the dev community
|
|
62
|
+
- [Shopify Community Forums](https://community.shopify.com/) - Visit our forums to connect with the community and learn more about Shopify CLI development
|
|
63
|
+
- [CLI Documentation - Apps](https://shopify.dev/apps/tools/cli) - To view CLI documentation for app development
|
|
64
|
+
- [CLI Documentation - Themes](https://shopify.dev/themes/tools/cli) - To view CLI documentation for theme development
|
|
65
|
+
- [CLI Documentation - Hydrogen](https://shopify.dev/custom-storefronts/tools/cli) - To view CLI documentation for Hydrogen (custom storefront) development
|
|
66
|
+
|
|
67
|
+
## Contribute 👩🏽💻
|
|
68
|
+
|
|
69
|
+
If you'd like to contribute to the project, check out the [contributors docs](/docs) and the [steps to get started](/docs/cli/get-started.md).
|
|
70
|
+
|
|
71
|
+
<p> </p>
|
|
72
|
+
|
|
73
|
+
## References
|
|
74
|
+
|
|
75
|
+
- [oclif](https://oclif.io/)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ExtensionServer } from './server-types.js';
|
|
2
|
+
import { DeepPartial } from '../types';
|
|
3
|
+
export declare class ExtensionServerClient implements ExtensionServer.Client {
|
|
4
|
+
id: string;
|
|
5
|
+
connection: WebSocket;
|
|
6
|
+
options: ExtensionServer.Options;
|
|
7
|
+
protected EVENT_THAT_WILL_MUTATE_THE_SERVER: string[];
|
|
8
|
+
protected listeners: Record<string, Set<(payload: any) => void>>;
|
|
9
|
+
protected connectionListeners: {
|
|
10
|
+
close: Set<(event: Event) => void>;
|
|
11
|
+
open: Set<(event: Event) => void>;
|
|
12
|
+
};
|
|
13
|
+
protected connected: boolean;
|
|
14
|
+
private uiExtensionsByUuid;
|
|
15
|
+
constructor(options?: DeepPartial<ExtensionServer.Options>);
|
|
16
|
+
connect(options?: ExtensionServer.Options): () => void;
|
|
17
|
+
on<TEvent extends keyof ExtensionServer.InboundEvents>(event: TEvent, listener: (payload: ExtensionServer.InboundEvents[TEvent]) => void): () => void;
|
|
18
|
+
persist<TEvent extends keyof ExtensionServer.OutboundPersistEvents>(event: TEvent, data: ExtensionServer.OutboundPersistEvents[TEvent]): void;
|
|
19
|
+
emit<TEvent extends keyof ExtensionServer.DispatchEvents>(...args: ExtensionServer.EmitArgs<TEvent>): void;
|
|
20
|
+
onConnection<TEvent extends keyof typeof this.connectionListeners>(event: TEvent, listener: (event: Event) => void): () => void;
|
|
21
|
+
protected initializeConnection(): void;
|
|
22
|
+
protected setupConnection(connectWebsocket?: boolean): void;
|
|
23
|
+
protected closeConnection(): void;
|
|
24
|
+
private _getLocalizedExtensions;
|
|
25
|
+
private _getLocalizedExtensionPoints;
|
|
26
|
+
private _getLocalizedValue;
|
|
27
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Surface } from './types.js';
|
|
2
|
+
import { ExtensionPayload, ExtensionPoint, App } from '../types';
|
|
3
|
+
import { FlattenedLocalization, LocalesOptions, Localization } from '../i18n';
|
|
4
|
+
export declare namespace ExtensionServer {
|
|
5
|
+
interface UIExtension extends ExtensionPayload {
|
|
6
|
+
extensionPoints: ExtensionPoint[];
|
|
7
|
+
localization?: FlattenedLocalization | Localization | null;
|
|
8
|
+
}
|
|
9
|
+
interface Client {
|
|
10
|
+
id: string;
|
|
11
|
+
connection: WebSocket;
|
|
12
|
+
options: Options;
|
|
13
|
+
connect(options?: Options): () => void;
|
|
14
|
+
on<TEvent extends keyof InboundEvents>(event: TEvent, listener: (payload: InboundEvents[TEvent]) => void): () => void;
|
|
15
|
+
persist<TEvent extends keyof OutboundPersistEvents>(event: TEvent, data: OutboundPersistEvents[TEvent]): void;
|
|
16
|
+
emit<TEvent extends keyof DispatchEvents>(...args: EmitArgs<TEvent>): void;
|
|
17
|
+
onConnection<TEvent extends 'close' | 'open'>(event: TEvent, listener: (event: Event) => void): () => void;
|
|
18
|
+
}
|
|
19
|
+
interface Options {
|
|
20
|
+
connection: {
|
|
21
|
+
url?: string;
|
|
22
|
+
automaticConnect?: boolean;
|
|
23
|
+
protocols?: string | string[];
|
|
24
|
+
};
|
|
25
|
+
surface?: Surface;
|
|
26
|
+
locales?: LocalesOptions;
|
|
27
|
+
}
|
|
28
|
+
interface ServerEvents {
|
|
29
|
+
event: string;
|
|
30
|
+
data: any;
|
|
31
|
+
}
|
|
32
|
+
interface InboundEvents extends DispatchEvents {
|
|
33
|
+
dispatch: {
|
|
34
|
+
type: keyof DispatchEvents;
|
|
35
|
+
payload: DispatchEvents[keyof DispatchEvents];
|
|
36
|
+
};
|
|
37
|
+
connected: {
|
|
38
|
+
extensions: ExtensionPayload[];
|
|
39
|
+
app?: App;
|
|
40
|
+
store: string;
|
|
41
|
+
};
|
|
42
|
+
update: {
|
|
43
|
+
extensions?: ExtensionPayload[];
|
|
44
|
+
app?: App;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
interface OutboundPersistEvents {
|
|
48
|
+
update: {
|
|
49
|
+
extensions?: ExtensionPayload[];
|
|
50
|
+
app?: App;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
interface DispatchEvents {
|
|
54
|
+
refresh: {
|
|
55
|
+
uuid: string;
|
|
56
|
+
}[];
|
|
57
|
+
focus: {
|
|
58
|
+
uuid: string;
|
|
59
|
+
}[];
|
|
60
|
+
unfocus: void;
|
|
61
|
+
navigate: {
|
|
62
|
+
url: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
type EmitArgs<TEvent extends keyof DispatchEvents> = undefined extends DispatchEvents[TEvent] ? [event: TEvent] : [event: TEvent, payload: DispatchEvents[TEvent]];
|
|
66
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { LocalesOptions } from '../i18n';
|
|
2
|
+
declare global {
|
|
3
|
+
namespace ExtensionServer {
|
|
4
|
+
/**
|
|
5
|
+
* Events being received by the extension server where the keys are the event names
|
|
6
|
+
* and the values are the payload of the given action. In case no payload is
|
|
7
|
+
* required, a value of void should be used.
|
|
8
|
+
*/
|
|
9
|
+
interface InboundEvents {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Events being sent to the extension server where the keys are the event names
|
|
13
|
+
* and the values are the payload of the given action. In case no payload is
|
|
14
|
+
* required, a value of void should be used.
|
|
15
|
+
*
|
|
16
|
+
* Persist events are those that will generate changes on the server, like
|
|
17
|
+
* update and connected events. Dispatch events are those that will
|
|
18
|
+
* simply be proxied to the clients connected to the server.
|
|
19
|
+
*/
|
|
20
|
+
interface OutboundPersistEvents {
|
|
21
|
+
}
|
|
22
|
+
interface DispatchEvents {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Extension server client class options. These are used to configure
|
|
26
|
+
* the client class.
|
|
27
|
+
*/
|
|
28
|
+
interface Options {
|
|
29
|
+
connection: {
|
|
30
|
+
/**
|
|
31
|
+
* The absolute URL of the WebSocket.
|
|
32
|
+
*/
|
|
33
|
+
url?: string;
|
|
34
|
+
/**
|
|
35
|
+
* This defines if we should automatically attempt to connect when the
|
|
36
|
+
* class is instantiated.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue true
|
|
39
|
+
*/
|
|
40
|
+
automaticConnect?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The sub-protocol selected by the server.
|
|
43
|
+
*
|
|
44
|
+
* @defaultValue []
|
|
45
|
+
*/
|
|
46
|
+
protocols?: string | string[];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* If provided the extension server will only return extensions that matches the specified surface
|
|
50
|
+
*/
|
|
51
|
+
surface?: Surface;
|
|
52
|
+
/**
|
|
53
|
+
* If provided the extension server will return a requested translations object with flattened
|
|
54
|
+
* translations for each extension matching the requested locales
|
|
55
|
+
*/
|
|
56
|
+
locales?: LocalesOptions;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Extension server client class. This class will be used to connect and
|
|
60
|
+
* communicate with the extension server.
|
|
61
|
+
*/
|
|
62
|
+
interface Client {
|
|
63
|
+
/**
|
|
64
|
+
* Connection options
|
|
65
|
+
*/
|
|
66
|
+
options: Options;
|
|
67
|
+
/**
|
|
68
|
+
* Reconnecting WebSocket Client
|
|
69
|
+
*/
|
|
70
|
+
connection: WebSocket;
|
|
71
|
+
/**
|
|
72
|
+
* Function to add an event listener to messages coming from
|
|
73
|
+
* the extension server connection.
|
|
74
|
+
*/
|
|
75
|
+
on<TEvent extends keyof ExtensionServer.InboundEvents>(event: TEvent, cb: EventListener<TEvent>): EventUnsubscriber;
|
|
76
|
+
/**
|
|
77
|
+
* Function to emit an event that will persist changes to the extension server.
|
|
78
|
+
*/
|
|
79
|
+
persist<TEvent extends keyof OutboundPersistEvents>(event: TEvent, payload: OutboundPersistEvents[TEvent]): void;
|
|
80
|
+
/**
|
|
81
|
+
* Function to emit an event to the extension server.
|
|
82
|
+
*/
|
|
83
|
+
emit<TEvent extends keyof DispatchEvents>(...args: EmitArgs<TEvent>): void;
|
|
84
|
+
/**
|
|
85
|
+
* Function that opens a connection with the extensions server.
|
|
86
|
+
*/
|
|
87
|
+
connect(options?: Options): () => void;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* This defines how the ExtensionServer client's static class is defined and the constructor
|
|
91
|
+
* arguments it requires.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```
|
|
95
|
+
* const client = new ExtensionServer({ url: 'wss://localhost:1234' });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
type StaticClient = Static<ExtensionServer.Client, [option?: ExtensionServer.Options]>;
|
|
99
|
+
/**
|
|
100
|
+
* This helper type allows us to account for nullish payloads on the emit function.
|
|
101
|
+
* In practice, this will allow TypeScript to type-check the event being emitted
|
|
102
|
+
* and, if the payload isn't required, the second argument won't be necessary.
|
|
103
|
+
*/
|
|
104
|
+
type EmitArgs<TEvent extends keyof ExtensionServer.DispatchEvents> = ExtensionServer.DispatchEvents[TEvent] extends void ? [event: TEvent] : [event: TEvent, payload: ExtensionServer.DispatchEvents[TEvent]];
|
|
105
|
+
/**
|
|
106
|
+
* This is a helper interface that allows us to define the static methods of a given
|
|
107
|
+
* class. This is useful to define static methods, static properties
|
|
108
|
+
* and constructor variables.
|
|
109
|
+
*/
|
|
110
|
+
interface Static<T = unknown, TArgs extends unknown[] = unknown[]> {
|
|
111
|
+
prototype: T;
|
|
112
|
+
new (...args: TArgs): T;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* This helper creates a partial interface with exception to the defined key values.
|
|
116
|
+
*/
|
|
117
|
+
type PartialExcept<TOject, TKey extends keyof TOject> = Partial<Omit<TOject, TKey>> & Pick<TOject, TKey>;
|
|
118
|
+
type EventListener<TEvent extends keyof ExtensionServer.InboundEvents> = (payload: ExtensionServer.InboundEvents[TEvent]) => void;
|
|
119
|
+
type EventUnsubscriber = () => void;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
export declare const AVAILABLE_SURFACES: readonly ["admin", "checkout", "post_purchase", "point_of_sale", "customer-accounts"];
|
|
123
|
+
export type Surface = (typeof AVAILABLE_SURFACES)[number];
|
|
124
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.cjs.js");var t=e.__require();exports.jsxRuntimeExports=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ExtensionServer } from '../ExtensionServerClient/server-types.js';
|
|
2
|
+
import type { ExtensionServerState, ExtensionServerActions } from '../state';
|
|
3
|
+
export interface ExtensionServerContext {
|
|
4
|
+
client: ExtensionServer.Client;
|
|
5
|
+
state: ExtensionServerState;
|
|
6
|
+
connect(options?: ExtensionServer.Options): void;
|
|
7
|
+
dispatch(action: ExtensionServerActions): void;
|
|
8
|
+
}
|
|
9
|
+
export interface ExtensionServerProviderProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
options: ExtensionServer.Options;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useExtensionServerContext: () => import("../context").ExtensionServerContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useExtensionServerState(): [import("../state").ExtensionServerState, import("react").Dispatch<import("../state").ExtensionServerActions>];
|
package/dist/i18n.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* These translation utilities were adapted from https://github.com/Shopify/checkout-web/blob/master/app/utilities/development-mode/i18n-utilities.tsx
|
|
3
|
+
* */
|
|
4
|
+
type Translation = string | {
|
|
5
|
+
[key: string]: Translation;
|
|
6
|
+
};
|
|
7
|
+
export interface Localization {
|
|
8
|
+
defaultLocale: string;
|
|
9
|
+
translations: Record<string, Record<string, Translation>>;
|
|
10
|
+
lastUpdated: number;
|
|
11
|
+
}
|
|
12
|
+
export interface FlattenedLocalization {
|
|
13
|
+
extensionLocale: string;
|
|
14
|
+
translations: string;
|
|
15
|
+
lastUpdated: number;
|
|
16
|
+
}
|
|
17
|
+
export interface LocalesOptions {
|
|
18
|
+
user: string;
|
|
19
|
+
shop?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* This is a flattened dictionary of extension translations for the active locale.
|
|
23
|
+
*
|
|
24
|
+
* Here are some examples for the 'en' locale.
|
|
25
|
+
*
|
|
26
|
+
* Nested keys are dot separated. Consider this translation definition:
|
|
27
|
+
*
|
|
28
|
+
* ```
|
|
29
|
+
* {
|
|
30
|
+
* "greetings": {
|
|
31
|
+
* "hello": "Hello {{user}}"
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* It would be represented in this flattened dictionary as:
|
|
37
|
+
* ```
|
|
38
|
+
* {
|
|
39
|
+
* "greetings.hello": "Hello {{user}}"
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
* Pluralized translations will also be flattened. Consider this definition:
|
|
43
|
+
* ```
|
|
44
|
+
* {
|
|
45
|
+
* "loyaltyPointsRemaining": {
|
|
46
|
+
* "one": "You have {{count}} loyalty point",
|
|
47
|
+
* "other": "You have {{count}} loyalty points",
|
|
48
|
+
* }
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
* It would be represented in this flattened dictionary as:
|
|
52
|
+
* ```
|
|
53
|
+
* {
|
|
54
|
+
* "loyaltyPointsRemaining.one": "You have {{count}} loyalty point",
|
|
55
|
+
* "loyaltyPointsRemaining.other": "You have {{count}} loyalty points",
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
type ExtensionTranslationMap = Record<string, string>;
|
|
60
|
+
export declare const TRANSLATED_KEYS: string[];
|
|
61
|
+
export declare function flattenDevExtensionTranslations(localization: Localization, locale: string): ExtensionTranslationMap;
|
|
62
|
+
export declare function resolveDevExtensionLocale(localization: Localization, locales: {
|
|
63
|
+
user: string;
|
|
64
|
+
shop?: string;
|
|
65
|
+
}): string;
|
|
66
|
+
export declare function getFlattenedLocalization(localization?: FlattenedLocalization | Localization | null, locales?: LocalesOptions): FlattenedLocalization | undefined;
|
|
67
|
+
export declare function isFlattenedTranslations(localization: Localization | FlattenedLocalization): localization is FlattenedLocalization;
|
|
68
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./packages/ui-extensions-server-kit/src/context/ExtensionServerProvider.cjs.js"),r=require("./packages/ui-extensions-server-kit/src/context/constants.cjs.js"),o=require("./packages/ui-extensions-server-kit/src/ExtensionServerClient/ExtensionServerClient.cjs.js"),s=require("./packages/ui-extensions-server-kit/src/ExtensionServerClient/types.cjs.js"),i=require("./packages/ui-extensions-server-kit/src/hooks/useExtensionServerContext.cjs.js"),c=require("./packages/ui-extensions-server-kit/src/hooks/useExtensionServerState.cjs.js"),a=require("./packages/ui-extensions-server-kit/src/hooks/useIsomorphicLayoutEffect.cjs.js"),e=require("./packages/ui-extensions-server-kit/src/state/actions/actions.cjs.js"),u=require("./packages/ui-extensions-server-kit/src/state/reducers/constants.cjs.js"),S=require("./packages/ui-extensions-server-kit/src/state/reducers/extensionServerReducer.cjs.js"),E=require("./packages/ui-extensions-server-kit/src/types.cjs.js"),x=require("./packages/ui-extensions-server-kit/src/utilities/noop.cjs.js"),l=require("./packages/ui-extensions-server-kit/src/utilities/replaceUpdated.cjs.js"),v=require("./packages/ui-extensions-server-kit/src/utilities/set.cjs.js"),A=require("./packages/ui-extensions-server-kit/src/utilities/assetToString.cjs.js"),d=require("./packages/ui-extensions-server-kit/src/utilities/isValidSurface.cjs.js"),q=require("./packages/ui-extensions-server-kit/src/utilities/isUIExtension.cjs.js"),t=require("./packages/ui-extensions-server-kit/src/i18n.cjs.js");exports.ExtensionServerProvider=n.ExtensionServerProvider;exports.extensionServerContext=r.extensionServerContext;exports.ExtensionServerClient=o.ExtensionServerClient;exports.AVAILABLE_SURFACES=s.AVAILABLE_SURFACES;exports.useExtensionServerContext=i.useExtensionServerContext;exports.useExtensionServerState=c.useExtensionServerState;exports.useIsomorphicLayoutEffect=a.useIsomorphicLayoutEffect;exports.createConnectedAction=e.createConnectedAction;exports.createFocusAction=e.createFocusAction;exports.createRefreshAction=e.createRefreshAction;exports.createUnfocusAction=e.createUnfocusAction;exports.createUpdateAction=e.createUpdateAction;exports.INITIAL_STATE=u.INITIAL_STATE;exports.extensionServerReducer=S.extensionServerReducer;exports.Status=E.Status;exports.noop=x.noop;exports.replaceUpdated=l.replaceUpdated;exports.set=v.set;exports.assetToString=A.assetToString;exports.isValidSurface=d.isValidSurface;exports.isUIExtension=q.isUIExtension;exports.TRANSLATED_KEYS=t.TRANSLATED_KEYS;exports.flattenDevExtensionTranslations=t.flattenDevExtensionTranslations;exports.getFlattenedLocalization=t.getFlattenedLocalization;exports.isFlattenedTranslations=t.isFlattenedTranslations;exports.resolveDevExtensionLocale=t.resolveDevExtensionLocale;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./packages/ui-extensions-server-kit/src/testing/MockExtensionServerProvider.cjs.js"),o=require("./packages/ui-extensions-server-kit/src/testing/app.cjs.js"),r=require("./packages/ui-extensions-server-kit/src/testing/extensions.cjs.js");exports.MockExtensionServerProvider=e.MockExtensionServerProvider;exports.mockApp=o.mockApp;exports.mockExtension=r.mockExtension;
|