@yan-ad/nuxt-shopify 0.0.0-stage → 1.3.4
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/LICENSE +21 -0
- package/README.md +170 -2
- package/dist/chunks/codegen.mjs +125 -0
- package/dist/module.d.mts +7 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +272 -0
- package/dist/runtime/admin-api-client.d.ts +1 -0
- package/dist/runtime/admin-api-client.js +1 -0
- package/dist/runtime/app-bridge-types.d.ts +1 -0
- package/dist/runtime/app-bridge-types.js +0 -0
- package/dist/runtime/components/polaris/App.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/App.vue +23 -0
- package/dist/runtime/components/polaris/App.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/AppNav.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/AppNav.vue +13 -0
- package/dist/runtime/components/polaris/AppNav.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Avatar.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Avatar.vue +25 -0
- package/dist/runtime/components/polaris/Avatar.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Badge.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Badge.vue +19 -0
- package/dist/runtime/components/polaris/Badge.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Banner.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Banner.vue +25 -0
- package/dist/runtime/components/polaris/Banner.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Box.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Box.vue +39 -0
- package/dist/runtime/components/polaris/Box.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Button.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Button.vue +35 -0
- package/dist/runtime/components/polaris/Button.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/ButtonGroup.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/ButtonGroup.vue +17 -0
- package/dist/runtime/components/polaris/ButtonGroup.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Checkbox.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Checkbox.vue +44 -0
- package/dist/runtime/components/polaris/Checkbox.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Chip.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Chip.vue +17 -0
- package/dist/runtime/components/polaris/Chip.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Choice.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Choice.vue +20 -0
- package/dist/runtime/components/polaris/Choice.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/ChoiceList.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/ChoiceList.vue +40 -0
- package/dist/runtime/components/polaris/ChoiceList.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Clickable.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Clickable.vue +48 -0
- package/dist/runtime/components/polaris/Clickable.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/ClickableChip.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/ClickableChip.vue +31 -0
- package/dist/runtime/components/polaris/ClickableChip.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/ColorField.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/ColorField.vue +48 -0
- package/dist/runtime/components/polaris/ColorField.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/ColorPicker.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/ColorPicker.vue +36 -0
- package/dist/runtime/components/polaris/ColorPicker.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/DateField.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/DateField.vue +55 -0
- package/dist/runtime/components/polaris/DateField.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/DatePicker.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/DatePicker.vue +45 -0
- package/dist/runtime/components/polaris/DatePicker.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Divider.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Divider.vue +17 -0
- package/dist/runtime/components/polaris/Divider.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/DropZone.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/DropZone.vue +43 -0
- package/dist/runtime/components/polaris/DropZone.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/EmailField.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/EmailField.vue +49 -0
- package/dist/runtime/components/polaris/EmailField.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/EmptyState.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/EmptyState.vue +16 -0
- package/dist/runtime/components/polaris/EmptyState.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Grid.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Grid.vue +50 -0
- package/dist/runtime/components/polaris/Grid.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/GridItem.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/GridItem.vue +41 -0
- package/dist/runtime/components/polaris/GridItem.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Heading.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Heading.vue +18 -0
- package/dist/runtime/components/polaris/Heading.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Icon.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Icon.vue +20 -0
- package/dist/runtime/components/polaris/Icon.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Image.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Image.vue +18 -0
- package/dist/runtime/components/polaris/Image.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Link.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Link.vue +24 -0
- package/dist/runtime/components/polaris/Link.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/ListItem.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/ListItem.vue +11 -0
- package/dist/runtime/components/polaris/ListItem.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/LoadingIndicator.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/LoadingIndicator.vue +22 -0
- package/dist/runtime/components/polaris/LoadingIndicator.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Menu.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Menu.vue +16 -0
- package/dist/runtime/components/polaris/Menu.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Modal.d.vue.ts +17 -0
- package/dist/runtime/components/polaris/Modal.vue +22 -0
- package/dist/runtime/components/polaris/Modal.vue.d.ts +17 -0
- package/dist/runtime/components/polaris/MoneyField.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/MoneyField.vue +49 -0
- package/dist/runtime/components/polaris/MoneyField.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Number.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Number.vue +21 -0
- package/dist/runtime/components/polaris/Number.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/NumberField.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/NumberField.vue +53 -0
- package/dist/runtime/components/polaris/NumberField.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Option.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Option.vue +19 -0
- package/dist/runtime/components/polaris/Option.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/OptionGroup.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/OptionGroup.vue +17 -0
- package/dist/runtime/components/polaris/OptionGroup.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/OrderedList.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/OrderedList.vue +11 -0
- package/dist/runtime/components/polaris/OrderedList.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Page.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Page.vue +17 -0
- package/dist/runtime/components/polaris/Page.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Paragraph.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Paragraph.vue +21 -0
- package/dist/runtime/components/polaris/Paragraph.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/PasswordField.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/PasswordField.vue +49 -0
- package/dist/runtime/components/polaris/PasswordField.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Popover.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Popover.vue +22 -0
- package/dist/runtime/components/polaris/Popover.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Progress.d.vue.ts +3 -0
- package/dist/runtime/components/polaris/Progress.vue +17 -0
- package/dist/runtime/components/polaris/Progress.vue.d.ts +3 -0
- package/dist/runtime/components/polaris/QueryContainer.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/QueryContainer.vue +16 -0
- package/dist/runtime/components/polaris/QueryContainer.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/SearchField.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/SearchField.vue +49 -0
- package/dist/runtime/components/polaris/SearchField.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Section.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Section.vue +18 -0
- package/dist/runtime/components/polaris/Section.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Select.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Select.vue +43 -0
- package/dist/runtime/components/polaris/Select.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Spinner.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Spinner.vue +17 -0
- package/dist/runtime/components/polaris/Spinner.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Stack.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Stack.vue +46 -0
- package/dist/runtime/components/polaris/Stack.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Switch.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Switch.vue +43 -0
- package/dist/runtime/components/polaris/Switch.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Table.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Table.vue +20 -0
- package/dist/runtime/components/polaris/Table.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/TableBody.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/TableBody.vue +11 -0
- package/dist/runtime/components/polaris/TableBody.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/TableCell.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/TableCell.vue +11 -0
- package/dist/runtime/components/polaris/TableCell.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/TableHeader.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/TableHeader.vue +17 -0
- package/dist/runtime/components/polaris/TableHeader.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/TableHeaderRow.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/TableHeaderRow.vue +11 -0
- package/dist/runtime/components/polaris/TableHeaderRow.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/TableRow.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/TableRow.vue +16 -0
- package/dist/runtime/components/polaris/TableRow.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Text.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Text.vue +22 -0
- package/dist/runtime/components/polaris/Text.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/TextArea.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/TextArea.vue +50 -0
- package/dist/runtime/components/polaris/TextArea.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/TextField.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/TextField.vue +52 -0
- package/dist/runtime/components/polaris/TextField.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Thumbnail.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Thumbnail.vue +19 -0
- package/dist/runtime/components/polaris/Thumbnail.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/Tooltip.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/Tooltip.vue +16 -0
- package/dist/runtime/components/polaris/Tooltip.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/UiModal.d.vue.ts +17 -0
- package/dist/runtime/components/polaris/UiModal.vue +26 -0
- package/dist/runtime/components/polaris/UiModal.vue.d.ts +17 -0
- package/dist/runtime/components/polaris/UiNavMenu.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/UiNavMenu.vue +13 -0
- package/dist/runtime/components/polaris/UiNavMenu.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/UiSaveBar.d.vue.ts +3 -0
- package/dist/runtime/components/polaris/UiSaveBar.vue +37 -0
- package/dist/runtime/components/polaris/UiSaveBar.vue.d.ts +3 -0
- package/dist/runtime/components/polaris/UiTitleBar.d.vue.ts +8 -0
- package/dist/runtime/components/polaris/UiTitleBar.vue +41 -0
- package/dist/runtime/components/polaris/UiTitleBar.vue.d.ts +8 -0
- package/dist/runtime/components/polaris/UnorderedList.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/UnorderedList.vue +11 -0
- package/dist/runtime/components/polaris/UnorderedList.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/UrlField.d.vue.ts +13 -0
- package/dist/runtime/components/polaris/UrlField.vue +49 -0
- package/dist/runtime/components/polaris/UrlField.vue.d.ts +13 -0
- package/dist/runtime/components/polaris/utils.d.ts +7 -0
- package/dist/runtime/components/polaris/utils.js +13 -0
- package/dist/runtime/composables/useAppBridge.d.ts +11 -0
- package/dist/runtime/composables/useAppBridge.js +32 -0
- package/dist/runtime/composables/useShopifyFetch.d.ts +11 -0
- package/dist/runtime/composables/useShopifyFetch.js +71 -0
- package/dist/runtime/middleware/shopify-auth.d.ts +2 -0
- package/dist/runtime/middleware/shopify-auth.js +26 -0
- package/dist/runtime/middleware/shopify-guest.d.ts +2 -0
- package/dist/runtime/middleware/shopify-guest.js +19 -0
- package/dist/runtime/pages/auth-login.d.vue.ts +3 -0
- package/dist/runtime/pages/auth-login.vue +129 -0
- package/dist/runtime/pages/auth-login.vue.d.ts +3 -0
- package/dist/runtime/pages/shopify-devtools.d.vue.ts +3 -0
- package/dist/runtime/pages/shopify-devtools.vue +224 -0
- package/dist/runtime/pages/shopify-devtools.vue.d.ts +3 -0
- package/dist/runtime/plugin.d.ts +1 -0
- package/dist/runtime/plugin.js +1 -0
- package/dist/runtime/plugins/app-bridge.d.ts +8 -0
- package/dist/runtime/plugins/app-bridge.js +24 -0
- package/dist/runtime/plugins/devtools.client.d.ts +2 -0
- package/dist/runtime/plugins/devtools.client.js +27 -0
- package/dist/runtime/plugins/standalone.d.ts +2 -0
- package/dist/runtime/plugins/standalone.js +77 -0
- package/dist/runtime/server/index.d.ts +4 -0
- package/dist/runtime/server/index.js +8 -0
- package/dist/runtime/server/plugins/add-response-headers.d.ts +11 -0
- package/dist/runtime/server/plugins/add-response-headers.js +18 -0
- package/dist/runtime/server/plugins/shopify-defaults.d.ts +8 -0
- package/dist/runtime/server/plugins/shopify-defaults.js +13 -0
- package/dist/runtime/server/routes/auth-callback.d.ts +6 -0
- package/dist/runtime/server/routes/auth-callback.js +56 -0
- package/dist/runtime/server/routes/auth-exit-iframe.d.ts +6 -0
- package/dist/runtime/server/routes/auth-exit-iframe.js +12 -0
- package/dist/runtime/server/routes/auth-session-token.d.ts +7 -0
- package/dist/runtime/server/routes/auth-session-token.js +27 -0
- package/dist/runtime/server/routes/auth.d.ts +6 -0
- package/dist/runtime/server/routes/auth.js +24 -0
- package/dist/runtime/server/routes/devtools-connect.d.ts +4 -0
- package/dist/runtime/server/routes/devtools-connect.js +12 -0
- package/dist/runtime/server/routes/devtools-session.d.ts +2 -0
- package/dist/runtime/server/routes/devtools-session.js +29 -0
- package/dist/runtime/server/routes/devtools-standalone.d.ts +4 -0
- package/dist/runtime/server/routes/devtools-standalone.js +48 -0
- package/dist/runtime/server/routes/devtools-store.d.ts +27 -0
- package/dist/runtime/server/routes/devtools-store.js +58 -0
- package/dist/runtime/server/services/shopify.d.ts +39 -0
- package/dist/runtime/server/services/shopify.js +89 -0
- package/dist/runtime/server/test-helpers/index.d.ts +25 -0
- package/dist/runtime/server/test-helpers/index.js +25 -0
- package/dist/runtime/server/test-helpers/package.json +4 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/server/utils/authenticate-admin.d.ts +18 -0
- package/dist/runtime/server/utils/authenticate-admin.js +253 -0
- package/dist/runtime/server/utils/authenticate-flow.d.ts +17 -0
- package/dist/runtime/server/utils/authenticate-flow.js +70 -0
- package/dist/runtime/server/utils/authenticate-fulfillment-service.d.ts +16 -0
- package/dist/runtime/server/utils/authenticate-fulfillment-service.js +54 -0
- package/dist/runtime/server/utils/authenticate-pos.d.ts +18 -0
- package/dist/runtime/server/utils/authenticate-pos.js +31 -0
- package/dist/runtime/server/utils/authenticate-public.d.ts +17 -0
- package/dist/runtime/server/utils/authenticate-public.js +31 -0
- package/dist/runtime/server/utils/authenticate-webhook.d.ts +26 -0
- package/dist/runtime/server/utils/authenticate-webhook.js +76 -0
- package/dist/runtime/server/utils/clients.d.ts +22 -0
- package/dist/runtime/server/utils/clients.js +53 -0
- package/dist/runtime/server/utils/devtools-info.d.ts +18 -0
- package/dist/runtime/server/utils/devtools-info.js +18 -0
- package/dist/runtime/server/utils/devtools-standalone.d.ts +5 -0
- package/dist/runtime/server/utils/devtools-standalone.js +36 -0
- package/dist/runtime/server/utils/frame-policy.d.ts +1 -0
- package/dist/runtime/server/utils/frame-policy.js +8 -0
- package/dist/runtime/server/utils/helpers.d.ts +14 -0
- package/dist/runtime/server/utils/helpers.js +106 -0
- package/dist/runtime/server/utils/login.d.ts +17 -0
- package/dist/runtime/server/utils/login.js +44 -0
- package/dist/runtime/server/utils/offline-session.d.ts +7 -0
- package/dist/runtime/server/utils/offline-session.js +85 -0
- package/dist/runtime/server/utils/register-webhooks.d.ts +19 -0
- package/dist/runtime/server/utils/register-webhooks.js +5 -0
- package/dist/runtime/server/utils/standalone-origin.d.ts +3 -0
- package/dist/runtime/server/utils/standalone-origin.js +31 -0
- package/dist/runtime/server/utils/unauthenticated-admin.d.ts +21 -0
- package/dist/runtime/server/utils/unauthenticated-admin.js +17 -0
- package/dist/runtime/shared/admin-app-url.d.ts +1 -0
- package/dist/runtime/shared/admin-app-url.js +15 -0
- package/dist/runtime/shared/devtools-bridge.d.ts +4 -0
- package/dist/runtime/shared/devtools-bridge.js +28 -0
- package/dist/runtime/shared/devtools-client.d.ts +4 -0
- package/dist/runtime/shared/devtools-client.js +51 -0
- package/dist/runtime/shared/polaris-client.d.ts +2 -0
- package/dist/runtime/shared/polaris-client.js +8 -0
- package/dist/runtime/shared/polaris.d.ts +4 -0
- package/dist/runtime/shared/polaris.js +4 -0
- package/dist/runtime/shared/standalone-context.d.ts +9 -0
- package/dist/runtime/shared/standalone-context.js +0 -0
- package/dist/runtime/shopify-api.d.ts +1 -0
- package/dist/runtime/shopify-api.js +1 -0
- package/dist/runtime/shopify-app-session-storage-memory.d.ts +1 -0
- package/dist/runtime/shopify-app-session-storage-memory.js +1 -0
- package/dist/runtime/shopify-app-session-storage.d.ts +1 -0
- package/dist/runtime/shopify-app-session-storage.js +1 -0
- package/dist/runtime/types/icon.d.ts +555 -0
- package/dist/runtime/types/index.d.ts +225 -0
- package/dist/runtime/types/index.js +11 -0
- package/dist/runtime/types.d.ts +282 -0
- package/dist/runtime/types.js +11 -0
- package/dist/types.d.mts +3 -0
- package/package.json +142 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yanuar Aditia @yanuaraditia
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,171 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# `@yan-ad/nuxt-shopify`
|
|
4
|
+
|
|
5
|
+
### Build Shopify apps with Nuxt.
|
|
6
|
+
|
|
7
|
+
Authentication, webhooks, billing, Polaris components, and App Bridge integration — together in one Nuxt module.
|
|
8
|
+
|
|
9
|
+
[Documentation](https://shopify.yan.ad) · [Getting started](https://shopify.yan.ad/getting-started/installation) · [Components](https://shopify.yan.ad/components) · [Report an issue](https://github.com/yan-ad/nuxt-shopify/issues)
|
|
10
|
+
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
[](https://badge.fury.io/js/%40yan-ad%2Fnuxt-shopify)
|
|
13
|
+
[](https://npmtrends.com/%40yan-ad%2Fnuxt-shopify)
|
|
14
|
+
[](https://nuxt.com)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
A [Nuxt](https://nuxt.com/) module for building Shopify apps — authentication, webhooks, billing, Polaris components, and App Bridge integration. The Nuxt equivalent of `@shopify/shopify-app-react-router`.
|
|
21
|
+
|
|
22
|
+
## Built for the Shopify app workflow
|
|
23
|
+
|
|
24
|
+
| Capability | What you get |
|
|
25
|
+
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| **Authentication** | Embedded token exchange, OAuth routes, expiring offline tokens, and automatic refresh and legacy-token migration. |
|
|
27
|
+
| **Admin API** | Authenticated server utilities and a session-token-aware `useShopifyFetch` for app endpoints. |
|
|
28
|
+
| **Polaris v2** | Auto-imported `Sh*` Vue wrappers with typed props, form bindings, and client-only rendering. |
|
|
29
|
+
| **App Bridge** | Shopify admin integration, navigation, and UI wrappers. |
|
|
30
|
+
| **Webhooks & billing** | Authentication helpers, webhook registration utilities, and configurable billing support. |
|
|
31
|
+
| **Developer experience** | Optional GraphQL codegen, a Shopify DevTools tab, and an authenticated standalone development handoff. |
|
|
32
|
+
| **Interactive reference** | Live component previews with editable properties and copyable Vue snippets at [shopify.yan.ad/components](https://shopify.yan.ad/components). |
|
|
33
|
+
|
|
34
|
+
> [!IMPORTANT]
|
|
35
|
+
> This project uses **Nitro v3**, which is currently a release candidate. Review compatibility and test your deployment before using it in production.
|
|
36
|
+
|
|
37
|
+
## Quick start
|
|
38
|
+
|
|
39
|
+
### 1. Install
|
|
40
|
+
|
|
41
|
+
Requires **Nuxt 4.7+**, **Nitro v3**, and a **Node-compatible server runtime** for Shopify OAuth. Use **Node.js 22.22+**; Node 24 LTS is recommended.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
bun add nitro@3.0.261103-rc
|
|
45
|
+
bunx nuxi@latest module add @yan-ad/nuxt-shopify
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Declare `nitro` directly in your app's dependencies so Nuxt selects its Nitro v3 server integration. Nitro v2 / H3 v1 are no longer supported by this module.
|
|
49
|
+
|
|
50
|
+
### 2. Configure your app
|
|
51
|
+
|
|
52
|
+
Keep credentials in environment variables, not source control:
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
// nuxt.config.ts
|
|
56
|
+
export default defineNuxtConfig({
|
|
57
|
+
modules: ['@yan-ad/nuxt-shopify'],
|
|
58
|
+
shopify: {
|
|
59
|
+
apiKey: process.env.SHOPIFY_API_KEY || '',
|
|
60
|
+
apiSecretKey: process.env.SHOPIFY_API_SECRET || '',
|
|
61
|
+
appUrl: process.env.SHOPIFY_APP_URL || '',
|
|
62
|
+
scopes: ['read_products']
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The module discovers the app handle from matching `shopify.app.toml` configuration in your Nuxt app root. Set `shopify.appHandle` explicitly when that file is unavailable at build time.
|
|
68
|
+
|
|
69
|
+
Configure and approve the corresponding Shopify app access scopes, and allow your app's `/_shopify/auth/callback` URL. Nuxt configuration alone does not grant store permissions.
|
|
70
|
+
|
|
71
|
+
### 3. Build with Vue
|
|
72
|
+
|
|
73
|
+
Components use the `Sh` prefix by default and are auto-imported:
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<template>
|
|
77
|
+
<ShApp>
|
|
78
|
+
<ShPage heading="My Shopify app">
|
|
79
|
+
<ShSection heading="Ready to build">
|
|
80
|
+
<ShParagraph>Your Nuxt app, inside Shopify admin.</ShParagraph>
|
|
81
|
+
<ShButton href="/products" variant="primary">View products</ShButton>
|
|
82
|
+
</ShSection>
|
|
83
|
+
</ShPage>
|
|
84
|
+
</ShApp>
|
|
85
|
+
</template>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Polaris wrappers mount client-side to avoid custom-element hydration conflicts. Shopify-hosted App Bridge features require an embedded admin context.
|
|
89
|
+
|
|
90
|
+
## Documentation
|
|
91
|
+
|
|
92
|
+
**[shopify.yan.ad](https://shopify.yan.ad)** — full documentation, guides, and API reference.
|
|
93
|
+
|
|
94
|
+
- [Installation](https://shopify.yan.ad/getting-started/installation) — set up your Nuxt app.
|
|
95
|
+
- [Configuration](https://shopify.yan.ad/getting-started/configuration) — credentials, module options, and app-handle discovery.
|
|
96
|
+
- [Components](https://shopify.yan.ad/components) — Polaris v2 and App Bridge wrappers with interactive previews.
|
|
97
|
+
- [Playground](./playground/README.md) — real store data, product search, pagination, and persisted app preferences.
|
|
98
|
+
|
|
99
|
+
## Local development
|
|
100
|
+
|
|
101
|
+
The playground uses Shopify CLI to manage the tunnel and app preview. Supply your own Shopify app configuration and development-store credentials, then run from the repository root:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
bun install
|
|
105
|
+
bun run dev
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`bun run dev` prepares the module and starts `shopify app dev` in the playground. There is no need to start a separate Nuxt server.
|
|
109
|
+
|
|
110
|
+
| Command | Purpose |
|
|
111
|
+
| ----------------------------------------------------------- | ------------------------------------- |
|
|
112
|
+
| `bun run dev:prepare` | Generate module stubs and Nuxt types. |
|
|
113
|
+
| `bun run dev` | Develop through Shopify CLI. |
|
|
114
|
+
| `bun run dev:build` | Build the playground for production. |
|
|
115
|
+
| `cd docs && bun install --frozen-lockfile && bun run build` | Install and build the documentation. |
|
|
116
|
+
| `bun run lint` | Run Oxlint. |
|
|
117
|
+
| `bun run lint:fix` | Apply safe lint fixes. |
|
|
118
|
+
| `bun run test` | Run Vitest. |
|
|
119
|
+
| `bun run test:watch` | Run tests in watch mode. |
|
|
120
|
+
| `bun run test:types` | Check module and playground types. |
|
|
121
|
+
| `bun run prepack` | Build the distributable module. |
|
|
122
|
+
|
|
123
|
+
### Shopify DevTools and standalone mode
|
|
124
|
+
|
|
125
|
+
The playground pins Nuxt DevTools to **v3.4.4** for Shopify CLI compatibility. In development, the **Shopify** tab shows authenticated store information, installed scopes, and token-expiry metadata without exposing credentials.
|
|
126
|
+
|
|
127
|
+
**Open Standalone** hands off an existing authenticated session to a new app tab. It uses a short-lived, single-use ticket and a protected development cookie—not fabricated Shopify ID tokens. A limited App Bridge shim provides local development behavior; it does not reproduce the Shopify admin host.
|
|
128
|
+
|
|
129
|
+
> [!WARNING]
|
|
130
|
+
> Standalone connections authorize real API requests with the connected session's permissions. Do not share handoff links or cookies. Use durable session storage in production, preserve refresh-token fields, and coordinate token rotation across multiple workers. The default memory adapter is for development.
|
|
131
|
+
|
|
132
|
+
## Contributing
|
|
133
|
+
|
|
134
|
+
Issues and pull requests are welcome. Keep changes focused and run lint, source formatting, tests, and type checks before submitting.
|
|
135
|
+
|
|
136
|
+
### Formatting in Zed
|
|
137
|
+
|
|
138
|
+
Run `bun install` and open the **repository root** in Zed. Install the [Oxc extension](https://zed.dev/extensions/oxc) for Oxlint diagnostics and safe fixes, plus the Vue extension for Vue language support. Restart language servers after changing `.zed/settings.json`.
|
|
139
|
+
|
|
140
|
+
Saving Vue, TypeScript, TSX, JavaScript, or JSX runs safe Oxlint fixes first, then the project-local Oxfmt formatter. Prettier fallback is disabled. Formatting uses `bun run --silent format:stdin --stdin-filepath <file>` with the editor buffer on stdin; it does not download a formatter on save. Bun must be available to Zed.
|
|
141
|
+
|
|
142
|
+
The shared `.oxfmtrc.json` uses two spaces, single quotes, no semicolons, and an 80-column print width. Vue templates, scripts, and styles are formatted together. Generated output and dependencies are excluded.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
bun run format:code # Format all Vue/TS/JS source files
|
|
146
|
+
bun run format:code:check # Check source formatting without writing
|
|
147
|
+
bun run lint:fix # Apply safe lint fixes
|
|
148
|
+
bun run format # Format all supported files, including docs
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
If formatting does not run, check `zed: open log`, confirm Bun is on Zed's PATH, and run `editor: format` to test the configured formatter manually.
|
|
152
|
+
|
|
153
|
+
### Releasing
|
|
154
|
+
|
|
155
|
+
Maintainers can run the existing release workflow when ready to publish:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
bun run release
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This command runs checks, builds the package, updates the changelog, publishes to npm, and pushes release changes. Run it only when you intend to release.
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
[MIT](LICENSE)
|
|
166
|
+
|
|
167
|
+
## Disclaimer
|
|
168
|
+
|
|
169
|
+
This is an independent, community-maintained project. It is not affiliated with,
|
|
170
|
+
endorsed by, or sponsored by Shopify Inc. Shopify and Polaris names, logos, and
|
|
171
|
+
trademarks belong to their respective owners.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
|
|
5
|
+
const INTROSPECTION_QUERY = `query IntrospectionQuery { __schema { queryType { name } mutationType { name } subscriptionType { name } types { ...FullType } directives { name description locations args { ...InputValue } } } } fragment FullType on __Type { kind name description fields(includeDeprecated: true) { name description args { ...InputValue } type { ...TypeRef } isDeprecated deprecationReason } inputFields { ...InputValue } interfaces { ...TypeRef } enumValues(includeDeprecated: true) { name description isDeprecated deprecationReason } possibleTypes { ...TypeRef } } fragment InputValue on __InputValue { name description type { ...TypeRef } defaultValue } fragment TypeRef on __Type { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } } } } }`;
|
|
6
|
+
async function fetchSchema(version, domain, token, cacheDir, logger) {
|
|
7
|
+
const cachedPath = resolve(cacheDir, `${version}.json`);
|
|
8
|
+
if (existsSync(cachedPath)) {
|
|
9
|
+
logger.debug(`Using cached schema for API ${version}`);
|
|
10
|
+
return cachedPath;
|
|
11
|
+
}
|
|
12
|
+
const url = `https://${domain}/admin/api/${version}/graphql.json`;
|
|
13
|
+
logger.start(`Fetching schema for API ${version}...`);
|
|
14
|
+
const response = await fetch(url, {
|
|
15
|
+
method: "POST",
|
|
16
|
+
headers: {
|
|
17
|
+
"X-Shopify-Access-Token": token,
|
|
18
|
+
"Content-Type": "application/json"
|
|
19
|
+
},
|
|
20
|
+
body: JSON.stringify({ query: INTROSPECTION_QUERY })
|
|
21
|
+
});
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`Failed to fetch schema for ${version}: ${response.status} ${response.statusText}`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
const data = await response.json();
|
|
28
|
+
await writeFile(cachedPath, JSON.stringify(data, null, 2));
|
|
29
|
+
logger.success(`Fetched schema for API ${version}`);
|
|
30
|
+
return cachedPath;
|
|
31
|
+
}
|
|
32
|
+
async function generate(schemaPaths, rootDir, outputDir, logger) {
|
|
33
|
+
let codegen;
|
|
34
|
+
let shopifyCodegen;
|
|
35
|
+
try {
|
|
36
|
+
codegen = await import('@graphql-codegen/cli');
|
|
37
|
+
shopifyCodegen = await import('@shopify/graphql-codegen');
|
|
38
|
+
} catch {
|
|
39
|
+
logger.warn(
|
|
40
|
+
"Codegen peer dependencies not installed. Install them with:\n bun add -d @graphql-codegen/cli @shopify/graphql-codegen graphql\nSkipping codegen."
|
|
41
|
+
);
|
|
42
|
+
return /* @__PURE__ */ new Map();
|
|
43
|
+
}
|
|
44
|
+
if (!existsSync(outputDir)) await mkdir(outputDir, { recursive: true });
|
|
45
|
+
const { preset, pluckConfig } = shopifyCodegen;
|
|
46
|
+
const generates = {};
|
|
47
|
+
const outputPaths = /* @__PURE__ */ new Map();
|
|
48
|
+
for (const [version, schemaPath] of schemaPaths) {
|
|
49
|
+
const outputPath = resolve(outputDir, `admin-${version}.d.ts`);
|
|
50
|
+
outputPaths.set(version, outputPath);
|
|
51
|
+
generates[outputPath] = {
|
|
52
|
+
preset,
|
|
53
|
+
schema: schemaPath,
|
|
54
|
+
documents: [
|
|
55
|
+
resolve(rootDir, "server/**/*.{ts,tsx,js,jsx}"),
|
|
56
|
+
resolve(rootDir, "app/**/*.{ts,tsx,js,jsx}")
|
|
57
|
+
],
|
|
58
|
+
presetConfig: {
|
|
59
|
+
skipTypenameInOperations: true
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
logger.start(`Generating types for ${schemaPaths.size} API version(s)...`);
|
|
64
|
+
try {
|
|
65
|
+
await codegen.generate(
|
|
66
|
+
{
|
|
67
|
+
overwrite: true,
|
|
68
|
+
pluckConfig,
|
|
69
|
+
ignoreNoDocuments: true,
|
|
70
|
+
generates
|
|
71
|
+
},
|
|
72
|
+
true
|
|
73
|
+
);
|
|
74
|
+
logger.success(`Types generated in ${outputDir}`);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
logger.error("Code generation failed:", error);
|
|
77
|
+
return /* @__PURE__ */ new Map();
|
|
78
|
+
}
|
|
79
|
+
for (const [version] of outputPaths) {
|
|
80
|
+
const indexDir = resolve(outputDir, version);
|
|
81
|
+
if (!existsSync(indexDir)) await mkdir(indexDir, { recursive: true });
|
|
82
|
+
await writeFile(
|
|
83
|
+
resolve(indexDir, "admin.d.ts"),
|
|
84
|
+
`export * from '../admin-${version}'
|
|
85
|
+
`
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
return outputPaths;
|
|
89
|
+
}
|
|
90
|
+
async function runCodegen(options) {
|
|
91
|
+
const { versions, rootDir, logger } = options;
|
|
92
|
+
const domain = process.env.SHOPIFY_CODEGEN_STORE_DOMAIN || process.env.SHOPIFY_STORE_DOMAIN;
|
|
93
|
+
const token = process.env.SHOPIFY_CODEGEN_ADMIN_ACCESS_TOKEN || process.env.SHOPIFY_ADMIN_ACCESS_TOKEN;
|
|
94
|
+
if (!domain || !token) {
|
|
95
|
+
logger.warn(
|
|
96
|
+
"Codegen requires store credentials. Set one of these env var pairs:\n SHOPIFY_CODEGEN_STORE_DOMAIN + SHOPIFY_CODEGEN_ADMIN_ACCESS_TOKEN\n SHOPIFY_STORE_DOMAIN + SHOPIFY_ADMIN_ACCESS_TOKEN\nSkipping."
|
|
97
|
+
);
|
|
98
|
+
return /* @__PURE__ */ new Map();
|
|
99
|
+
}
|
|
100
|
+
const cacheDir = resolve(rootDir, ".nuxt/shopify-schema");
|
|
101
|
+
const outputDir = resolve(rootDir, ".nuxt/types/shopify");
|
|
102
|
+
if (!existsSync(cacheDir)) await mkdir(cacheDir, { recursive: true });
|
|
103
|
+
const schemaPaths = /* @__PURE__ */ new Map();
|
|
104
|
+
for (const version of versions) {
|
|
105
|
+
try {
|
|
106
|
+
const schemaPath = await fetchSchema(
|
|
107
|
+
version,
|
|
108
|
+
domain,
|
|
109
|
+
token,
|
|
110
|
+
cacheDir,
|
|
111
|
+
logger
|
|
112
|
+
);
|
|
113
|
+
schemaPaths.set(version, schemaPath);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
logger.error(`Failed to fetch schema for ${version}:`, error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (schemaPaths.size === 0) {
|
|
119
|
+
logger.warn("No schemas fetched. Skipping codegen.");
|
|
120
|
+
return /* @__PURE__ */ new Map();
|
|
121
|
+
}
|
|
122
|
+
return generate(schemaPaths, rootDir, outputDir, logger);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export { runCodegen };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { ModuleOptions } from '../dist/runtime/types.js';
|
|
3
|
+
export { ModuleOptions, PolarisIcon } from '../dist/runtime/types.js';
|
|
4
|
+
|
|
5
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
6
|
+
|
|
7
|
+
export { _default as default };
|
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { defineNuxtModule, createResolver, useLogger, addPlugin, addServerHandler, extendPages, addServerImportsDir, addImportsDir, addRouteMiddleware, addNitroPlugin, useNitro } from '@nuxt/kit';
|
|
2
|
+
import { addCustomTab } from '@nuxt/devtools-kit';
|
|
3
|
+
import { AppDistribution } from '../dist/runtime/types.js';
|
|
4
|
+
import { ApiVersion } from '@shopify/shopify-api';
|
|
5
|
+
import { APP_BRIDGE_URL, POLARIS_URL } from '../dist/runtime/shared/polaris.js';
|
|
6
|
+
import { readdir, readFile } from 'node:fs/promises';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
import { parse } from 'smol-toml';
|
|
9
|
+
|
|
10
|
+
async function resolveAppHandle(rootDir, apiKey, explicit, warn = () => {
|
|
11
|
+
}) {
|
|
12
|
+
if (explicit?.trim()) return explicit.trim();
|
|
13
|
+
const files = (await readdir(rootDir)).filter((name) => /^shopify\.app(?:\.[\w-]+)?\.toml$/.test(name)).sort();
|
|
14
|
+
const configs = [];
|
|
15
|
+
for (const file of files) {
|
|
16
|
+
try {
|
|
17
|
+
const config = parse(await readFile(join(rootDir, file), "utf8"));
|
|
18
|
+
if (typeof config.handle === "string" && /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(config.handle)) {
|
|
19
|
+
configs.push({
|
|
20
|
+
file,
|
|
21
|
+
clientId: typeof config.client_id === "string" ? config.client_id : "",
|
|
22
|
+
handle: config.handle
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
} catch {
|
|
26
|
+
warn(
|
|
27
|
+
`Could not read ${file}. Set shopify.appHandle explicitly or fix the TOML configuration.`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const candidates = apiKey ? configs.filter((config) => config.clientId === apiKey) : configs;
|
|
32
|
+
const handles = [...new Set(candidates.map((config) => config.handle))];
|
|
33
|
+
if (handles.length === 1) return handles[0];
|
|
34
|
+
if (configs.length)
|
|
35
|
+
warn(
|
|
36
|
+
apiKey && !candidates.length ? "No Shopify app config handle matches shopify.apiKey. Set shopify.appHandle explicitly or use matching app credentials." : "Multiple Shopify app handles were found. Set shopify.appHandle explicitly to select the app."
|
|
37
|
+
);
|
|
38
|
+
return "";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const module$1 = defineNuxtModule({
|
|
42
|
+
meta: {
|
|
43
|
+
name: "@yan-ad/nuxt-shopify",
|
|
44
|
+
configKey: "shopify",
|
|
45
|
+
compatibility: {
|
|
46
|
+
nuxt: "^4.7.0"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
defaults: {
|
|
50
|
+
apiKey: "",
|
|
51
|
+
apiSecretKey: "",
|
|
52
|
+
appUrl: "",
|
|
53
|
+
allowedHosts: [".trycloudflare.com"],
|
|
54
|
+
apiVersion: ApiVersion.January26,
|
|
55
|
+
authPathPrefix: "/_shopify/auth",
|
|
56
|
+
distribution: AppDistribution.AppStore,
|
|
57
|
+
useOnlineTokens: false,
|
|
58
|
+
componentPrefix: "Sh",
|
|
59
|
+
redirectCookie: "sh-redirect-to"
|
|
60
|
+
},
|
|
61
|
+
onInstall() {
|
|
62
|
+
console.log("\u{1F6CD}\uFE0F Shopify App Module installed!");
|
|
63
|
+
},
|
|
64
|
+
onUpgrade() {
|
|
65
|
+
console.log(
|
|
66
|
+
`\u{1F6CD}\uFE0F Shopify App Module upgraded! Please always read the docs https://github.com/yan-ad/nuxt-shopify`
|
|
67
|
+
);
|
|
68
|
+
},
|
|
69
|
+
async setup(options, nuxt) {
|
|
70
|
+
const { resolve } = createResolver(import.meta.url);
|
|
71
|
+
const logger = useLogger("@yan-ad/nuxt-shopify:module");
|
|
72
|
+
const appHandle = await resolveAppHandle(
|
|
73
|
+
nuxt.options.rootDir,
|
|
74
|
+
options.apiKey,
|
|
75
|
+
options.appHandle,
|
|
76
|
+
(message) => logger.warn(message)
|
|
77
|
+
);
|
|
78
|
+
const isCustomElement = nuxt.options.vue.compilerOptions.isCustomElement;
|
|
79
|
+
nuxt.options.vue.compilerOptions.isCustomElement = (tag) => tag.startsWith("s-") || tag.startsWith("ui-") || Boolean(isCustomElement?.(tag));
|
|
80
|
+
if (nuxt.options.dev) {
|
|
81
|
+
addPlugin({
|
|
82
|
+
src: resolve("./runtime/plugins/devtools.client"),
|
|
83
|
+
mode: "client"
|
|
84
|
+
});
|
|
85
|
+
addServerHandler({
|
|
86
|
+
route: "/_shopify/devtools/connect",
|
|
87
|
+
method: "post",
|
|
88
|
+
handler: resolve("./runtime/server/routes/devtools-connect")
|
|
89
|
+
});
|
|
90
|
+
addServerHandler({
|
|
91
|
+
route: "/_shopify/devtools/standalone",
|
|
92
|
+
handler: resolve("./runtime/server/routes/devtools-standalone")
|
|
93
|
+
});
|
|
94
|
+
addPlugin({ src: resolve("./runtime/plugins/standalone"), order: -20 });
|
|
95
|
+
addServerHandler({
|
|
96
|
+
middleware: true,
|
|
97
|
+
handler: resolve("./runtime/server/routes/devtools-session")
|
|
98
|
+
});
|
|
99
|
+
extendPages((pages) => {
|
|
100
|
+
pages.push({
|
|
101
|
+
name: "shopify-devtools",
|
|
102
|
+
path: "/_shopify/devtools",
|
|
103
|
+
file: resolve("./runtime/pages/shopify-devtools.vue")
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
addServerHandler({
|
|
107
|
+
route: "/_shopify/devtools/store",
|
|
108
|
+
method: "get",
|
|
109
|
+
handler: resolve("./runtime/server/routes/devtools-store")
|
|
110
|
+
});
|
|
111
|
+
addCustomTab(
|
|
112
|
+
{
|
|
113
|
+
name: "nuxt-shopify",
|
|
114
|
+
title: "Shopify",
|
|
115
|
+
icon: "simple-icons:shopify",
|
|
116
|
+
view: { type: "iframe", src: "/_shopify/devtools" }
|
|
117
|
+
},
|
|
118
|
+
nuxt
|
|
119
|
+
);
|
|
120
|
+
if (nuxt.options.devtools !== false) {
|
|
121
|
+
nuxt.options.devtools = {
|
|
122
|
+
...typeof nuxt.options.devtools === "object" ? nuxt.options.devtools : {},
|
|
123
|
+
enabled: typeof nuxt.options.devtools === "object" ? nuxt.options.devtools.enabled ?? true : true,
|
|
124
|
+
disableAuthorization: true
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
nuxt.hook("listen", async (_server, listener) => {
|
|
128
|
+
const urls = await listener?.getURLs?.();
|
|
129
|
+
const url = urls?.[0]?.url || listener?.url;
|
|
130
|
+
if (url) logger.info(`Nuxt local URL: ${url}`);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
nuxt.options.runtimeConfig.shopify = {
|
|
134
|
+
apiKey: options.apiKey,
|
|
135
|
+
apiSecretKey: options.apiSecretKey,
|
|
136
|
+
scopes: options.scopes || [],
|
|
137
|
+
appUrl: options.appUrl,
|
|
138
|
+
apiVersion: options.apiVersion || ApiVersion.January26,
|
|
139
|
+
authPathPrefix: options.authPathPrefix || "/_shopify/auth",
|
|
140
|
+
distribution: options.distribution || AppDistribution.AppStore,
|
|
141
|
+
useOnlineTokens: options.useOnlineTokens || false
|
|
142
|
+
};
|
|
143
|
+
nuxt.options.runtimeConfig.public.shopify = {
|
|
144
|
+
appHandle,
|
|
145
|
+
apiKey: options.apiKey,
|
|
146
|
+
authPagePath: options.authPage !== false ? "/auth" : "",
|
|
147
|
+
authPathPrefix: options.authPathPrefix || "/_shopify/auth",
|
|
148
|
+
redirectCookie: options.redirectCookie || "sh-redirect-to",
|
|
149
|
+
navLinks: options.navLinks || []
|
|
150
|
+
};
|
|
151
|
+
nuxt.options.alias["#shopify/server"] = resolve("./runtime/server");
|
|
152
|
+
addServerImportsDir(resolve("./runtime/server/utils"));
|
|
153
|
+
addImportsDir(resolve("./runtime/composables"));
|
|
154
|
+
const componentsDir = resolve("./runtime/components");
|
|
155
|
+
nuxt.hook("components:dirs", (dirs) => {
|
|
156
|
+
dirs.push({
|
|
157
|
+
path: componentsDir,
|
|
158
|
+
prefix: options.componentPrefix,
|
|
159
|
+
pathPrefix: false,
|
|
160
|
+
extensions: ["vue"]
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
nuxt.hook("app:resolve", () => {
|
|
164
|
+
nuxt.options.app.head = nuxt.options.app.head || {};
|
|
165
|
+
nuxt.options.app.head.meta = [...nuxt.options.app.head.meta || []];
|
|
166
|
+
nuxt.options.app.head.script = [
|
|
167
|
+
// 1. Inline script to create the meta tag imperatively — guarantees it exists in the DOM before the CDN script executes.
|
|
168
|
+
{
|
|
169
|
+
key: "shopify-api-key-meta",
|
|
170
|
+
innerHTML: `var m=document.createElement('meta');m.name='shopify-api-key';m.content='${options.apiKey}';document.head.appendChild(m);`,
|
|
171
|
+
tagPosition: "head"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
src: APP_BRIDGE_URL,
|
|
175
|
+
tagPosition: "head"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
src: POLARIS_URL,
|
|
179
|
+
tagPosition: "head"
|
|
180
|
+
},
|
|
181
|
+
...nuxt.options.app.head.script || []
|
|
182
|
+
];
|
|
183
|
+
});
|
|
184
|
+
addPlugin({
|
|
185
|
+
src: resolve("./runtime/plugins/app-bridge"),
|
|
186
|
+
mode: "client"
|
|
187
|
+
});
|
|
188
|
+
const authPrefix = options.authPathPrefix || "/_shopify/auth";
|
|
189
|
+
addServerHandler({
|
|
190
|
+
route: authPrefix,
|
|
191
|
+
method: "get",
|
|
192
|
+
handler: resolve("./runtime/server/routes/auth")
|
|
193
|
+
});
|
|
194
|
+
addServerHandler({
|
|
195
|
+
route: `${authPrefix}/callback`,
|
|
196
|
+
method: "get",
|
|
197
|
+
handler: resolve("./runtime/server/routes/auth-callback")
|
|
198
|
+
});
|
|
199
|
+
addServerHandler({
|
|
200
|
+
route: `${authPrefix}/exit-iframe`,
|
|
201
|
+
method: "get",
|
|
202
|
+
handler: resolve("./runtime/server/routes/auth-exit-iframe")
|
|
203
|
+
});
|
|
204
|
+
addServerHandler({
|
|
205
|
+
route: `${authPrefix}/session-token`,
|
|
206
|
+
method: "get",
|
|
207
|
+
handler: resolve("./runtime/server/routes/auth-session-token")
|
|
208
|
+
});
|
|
209
|
+
addRouteMiddleware({
|
|
210
|
+
name: "shopify-auth",
|
|
211
|
+
path: resolve("./runtime/middleware/shopify-auth"),
|
|
212
|
+
global: false
|
|
213
|
+
});
|
|
214
|
+
addRouteMiddleware({
|
|
215
|
+
name: "shopify-guest",
|
|
216
|
+
path: resolve("./runtime/middleware/shopify-guest"),
|
|
217
|
+
global: false
|
|
218
|
+
});
|
|
219
|
+
if (options.authPage !== false) {
|
|
220
|
+
logger.info(
|
|
221
|
+
"Adding default /auth login page for non-embedded apps (can be customized or disabled with the authPage option)..."
|
|
222
|
+
);
|
|
223
|
+
extendPages((pages) => {
|
|
224
|
+
pages.push({
|
|
225
|
+
name: "shopify-auth-login",
|
|
226
|
+
path: "/auth",
|
|
227
|
+
file: options.authPage || resolve("./runtime/pages/auth-login.vue")
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
addNitroPlugin(resolve("./runtime/server/plugins/shopify-defaults"));
|
|
232
|
+
addNitroPlugin(resolve("./runtime/server/plugins/add-response-headers"));
|
|
233
|
+
nuxt.options.build.transpile.push(resolve("./runtime"));
|
|
234
|
+
nuxt.hook("ready", () => {
|
|
235
|
+
const nitro = useNitro();
|
|
236
|
+
const noExternals = nitro.options.noExternals;
|
|
237
|
+
if (noExternals === true) return;
|
|
238
|
+
nitro.options.noExternals = [
|
|
239
|
+
...noExternals || [],
|
|
240
|
+
"@shopify/shopify-api",
|
|
241
|
+
"@shopify/shopify-api/adapters/node",
|
|
242
|
+
"@shopify/shopify-app-session-storage-memory",
|
|
243
|
+
"isbot"
|
|
244
|
+
];
|
|
245
|
+
});
|
|
246
|
+
nuxt.hook("prepare:types", ({ references }) => {
|
|
247
|
+
references.push({
|
|
248
|
+
path: resolve("./runtime/types/index.ts")
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
if (options.codegen) {
|
|
252
|
+
const codegenVersions = Array.isArray(options.codegen) ? options.codegen : [options.apiVersion || ApiVersion.January26];
|
|
253
|
+
logger.info(
|
|
254
|
+
`Codegen enabled for API version(s): ${codegenVersions.join(", ")}`
|
|
255
|
+
);
|
|
256
|
+
for (const version of codegenVersions) {
|
|
257
|
+
const outputPath = `${nuxt.options.buildDir}/types/shopify/${version}`;
|
|
258
|
+
nuxt.options.alias[`#shopify/types/${version}/admin`] = outputPath + "/admin";
|
|
259
|
+
}
|
|
260
|
+
nuxt.hook("prepare:types", async () => {
|
|
261
|
+
const { runCodegen } = await import('./chunks/codegen.mjs');
|
|
262
|
+
await runCodegen({
|
|
263
|
+
versions: codegenVersions,
|
|
264
|
+
rootDir: nuxt.options.rootDir,
|
|
265
|
+
logger
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
export { module$1 as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@shopify/admin-api-client';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@shopify/admin-api-client";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from '@shopify/app-bridge-types';
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare var __VLS_1: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
default?: (props: typeof __VLS_1) => any;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_base: any;
|
|
6
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
+
new (): {
|
|
11
|
+
$slots: S;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<slot />
|
|
3
|
+
<ShAppNav v-if="navLinks.length && !standalone">
|
|
4
|
+
<ShLink
|
|
5
|
+
v-for="link in navLinks"
|
|
6
|
+
:key="link.href"
|
|
7
|
+
:href="link.href"
|
|
8
|
+
:rel="link.rel"
|
|
9
|
+
>
|
|
10
|
+
{{ link.label }}
|
|
11
|
+
</ShLink>
|
|
12
|
+
</ShAppNav>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup>
|
|
16
|
+
import { useRuntimeConfig, useNuxtApp } from "#app";
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
links: { type: Array, required: false }
|
|
19
|
+
});
|
|
20
|
+
const standalone = import.meta.dev && Boolean(useNuxtApp().payload.shopifyStandalone);
|
|
21
|
+
const config = useRuntimeConfig().public.shopify;
|
|
22
|
+
const navLinks = props.links || config.navLinks || [];
|
|
23
|
+
</script>
|