shopify-nuxt 0.0.1

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.
Files changed (239) hide show
  1. package/README.md +275 -0
  2. package/dist/module.d.mts +7 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +134 -0
  5. package/dist/runtime/components/ShopifyAppProvider.d.vue.ts +13 -0
  6. package/dist/runtime/components/ShopifyAppProvider.vue +11 -0
  7. package/dist/runtime/components/ShopifyAppProvider.vue.d.ts +13 -0
  8. package/dist/runtime/components/polaris/ShAppNav.d.vue.ts +13 -0
  9. package/dist/runtime/components/polaris/ShAppNav.vue +9 -0
  10. package/dist/runtime/components/polaris/ShAppNav.vue.d.ts +13 -0
  11. package/dist/runtime/components/polaris/ShAvatar.d.vue.ts +19 -0
  12. package/dist/runtime/components/polaris/ShAvatar.vue +15 -0
  13. package/dist/runtime/components/polaris/ShAvatar.vue.d.ts +19 -0
  14. package/dist/runtime/components/polaris/ShBadge.d.vue.ts +20 -0
  15. package/dist/runtime/components/polaris/ShBadge.vue +16 -0
  16. package/dist/runtime/components/polaris/ShBadge.vue.d.ts +20 -0
  17. package/dist/runtime/components/polaris/ShBanner.d.vue.ts +19 -0
  18. package/dist/runtime/components/polaris/ShBanner.vue +15 -0
  19. package/dist/runtime/components/polaris/ShBanner.vue.d.ts +19 -0
  20. package/dist/runtime/components/polaris/ShBox.d.vue.ts +39 -0
  21. package/dist/runtime/components/polaris/ShBox.vue +35 -0
  22. package/dist/runtime/components/polaris/ShBox.vue.d.ts +39 -0
  23. package/dist/runtime/components/polaris/ShButton.d.vue.ts +28 -0
  24. package/dist/runtime/components/polaris/ShButton.vue +24 -0
  25. package/dist/runtime/components/polaris/ShButton.vue.d.ts +28 -0
  26. package/dist/runtime/components/polaris/ShButtonGroup.d.vue.ts +17 -0
  27. package/dist/runtime/components/polaris/ShButtonGroup.vue +13 -0
  28. package/dist/runtime/components/polaris/ShButtonGroup.vue.d.ts +17 -0
  29. package/dist/runtime/components/polaris/ShCheckbox.d.vue.ts +28 -0
  30. package/dist/runtime/components/polaris/ShCheckbox.vue +24 -0
  31. package/dist/runtime/components/polaris/ShCheckbox.vue.d.ts +28 -0
  32. package/dist/runtime/components/polaris/ShChip.d.vue.ts +17 -0
  33. package/dist/runtime/components/polaris/ShChip.vue +13 -0
  34. package/dist/runtime/components/polaris/ShChip.vue.d.ts +17 -0
  35. package/dist/runtime/components/polaris/ShChoice.d.vue.ts +20 -0
  36. package/dist/runtime/components/polaris/ShChoice.vue +16 -0
  37. package/dist/runtime/components/polaris/ShChoice.vue.d.ts +20 -0
  38. package/dist/runtime/components/polaris/ShChoiceList.d.vue.ts +23 -0
  39. package/dist/runtime/components/polaris/ShChoiceList.vue +19 -0
  40. package/dist/runtime/components/polaris/ShChoiceList.vue.d.ts +23 -0
  41. package/dist/runtime/components/polaris/ShClickable.d.vue.ts +48 -0
  42. package/dist/runtime/components/polaris/ShClickable.vue +44 -0
  43. package/dist/runtime/components/polaris/ShClickable.vue.d.ts +48 -0
  44. package/dist/runtime/components/polaris/ShClickableChip.d.vue.ts +24 -0
  45. package/dist/runtime/components/polaris/ShClickableChip.vue +20 -0
  46. package/dist/runtime/components/polaris/ShClickableChip.vue.d.ts +24 -0
  47. package/dist/runtime/components/polaris/ShColorField.d.vue.ts +29 -0
  48. package/dist/runtime/components/polaris/ShColorField.vue +25 -0
  49. package/dist/runtime/components/polaris/ShColorField.vue.d.ts +29 -0
  50. package/dist/runtime/components/polaris/ShColorPicker.d.vue.ts +19 -0
  51. package/dist/runtime/components/polaris/ShColorPicker.vue +15 -0
  52. package/dist/runtime/components/polaris/ShColorPicker.vue.d.ts +19 -0
  53. package/dist/runtime/components/polaris/ShDateField.d.vue.ts +34 -0
  54. package/dist/runtime/components/polaris/ShDateField.vue +30 -0
  55. package/dist/runtime/components/polaris/ShDateField.vue.d.ts +34 -0
  56. package/dist/runtime/components/polaris/ShDatePicker.d.vue.ts +25 -0
  57. package/dist/runtime/components/polaris/ShDatePicker.vue +21 -0
  58. package/dist/runtime/components/polaris/ShDatePicker.vue.d.ts +25 -0
  59. package/dist/runtime/components/polaris/ShDivider.d.vue.ts +17 -0
  60. package/dist/runtime/components/polaris/ShDivider.vue +13 -0
  61. package/dist/runtime/components/polaris/ShDivider.vue.d.ts +17 -0
  62. package/dist/runtime/components/polaris/ShDropZone.d.vue.ts +25 -0
  63. package/dist/runtime/components/polaris/ShDropZone.vue +21 -0
  64. package/dist/runtime/components/polaris/ShDropZone.vue.d.ts +25 -0
  65. package/dist/runtime/components/polaris/ShEmailField.d.vue.ts +30 -0
  66. package/dist/runtime/components/polaris/ShEmailField.vue +26 -0
  67. package/dist/runtime/components/polaris/ShEmailField.vue.d.ts +30 -0
  68. package/dist/runtime/components/polaris/ShGrid.d.vue.ts +50 -0
  69. package/dist/runtime/components/polaris/ShGrid.vue +46 -0
  70. package/dist/runtime/components/polaris/ShGrid.vue.d.ts +50 -0
  71. package/dist/runtime/components/polaris/ShGridItem.d.vue.ts +41 -0
  72. package/dist/runtime/components/polaris/ShGridItem.vue +37 -0
  73. package/dist/runtime/components/polaris/ShGridItem.vue.d.ts +41 -0
  74. package/dist/runtime/components/polaris/ShHeading.d.vue.ts +18 -0
  75. package/dist/runtime/components/polaris/ShHeading.vue +14 -0
  76. package/dist/runtime/components/polaris/ShHeading.vue.d.ts +18 -0
  77. package/dist/runtime/components/polaris/ShIcon.d.vue.ts +20 -0
  78. package/dist/runtime/components/polaris/ShIcon.vue +16 -0
  79. package/dist/runtime/components/polaris/ShIcon.vue.d.ts +20 -0
  80. package/dist/runtime/components/polaris/ShImage.d.vue.ts +18 -0
  81. package/dist/runtime/components/polaris/ShImage.vue +14 -0
  82. package/dist/runtime/components/polaris/ShImage.vue.d.ts +18 -0
  83. package/dist/runtime/components/polaris/ShLink.d.vue.ts +24 -0
  84. package/dist/runtime/components/polaris/ShLink.vue +20 -0
  85. package/dist/runtime/components/polaris/ShLink.vue.d.ts +24 -0
  86. package/dist/runtime/components/polaris/ShListItem.d.vue.ts +13 -0
  87. package/dist/runtime/components/polaris/ShListItem.vue +9 -0
  88. package/dist/runtime/components/polaris/ShListItem.vue.d.ts +13 -0
  89. package/dist/runtime/components/polaris/ShMenu.d.vue.ts +16 -0
  90. package/dist/runtime/components/polaris/ShMenu.vue +12 -0
  91. package/dist/runtime/components/polaris/ShMenu.vue.d.ts +16 -0
  92. package/dist/runtime/components/polaris/ShModal.d.vue.ts +19 -0
  93. package/dist/runtime/components/polaris/ShModal.vue +15 -0
  94. package/dist/runtime/components/polaris/ShModal.vue.d.ts +19 -0
  95. package/dist/runtime/components/polaris/ShMoneyField.d.vue.ts +30 -0
  96. package/dist/runtime/components/polaris/ShMoneyField.vue +26 -0
  97. package/dist/runtime/components/polaris/ShMoneyField.vue.d.ts +30 -0
  98. package/dist/runtime/components/polaris/ShNumberField.d.vue.ts +34 -0
  99. package/dist/runtime/components/polaris/ShNumberField.vue +30 -0
  100. package/dist/runtime/components/polaris/ShNumberField.vue.d.ts +34 -0
  101. package/dist/runtime/components/polaris/ShOption.d.vue.ts +19 -0
  102. package/dist/runtime/components/polaris/ShOption.vue +15 -0
  103. package/dist/runtime/components/polaris/ShOption.vue.d.ts +19 -0
  104. package/dist/runtime/components/polaris/ShOptionGroup.d.vue.ts +17 -0
  105. package/dist/runtime/components/polaris/ShOptionGroup.vue +13 -0
  106. package/dist/runtime/components/polaris/ShOptionGroup.vue.d.ts +17 -0
  107. package/dist/runtime/components/polaris/ShOrderedList.d.vue.ts +13 -0
  108. package/dist/runtime/components/polaris/ShOrderedList.vue +9 -0
  109. package/dist/runtime/components/polaris/ShOrderedList.vue.d.ts +13 -0
  110. package/dist/runtime/components/polaris/ShPage.d.vue.ts +17 -0
  111. package/dist/runtime/components/polaris/ShPage.vue +13 -0
  112. package/dist/runtime/components/polaris/ShPage.vue.d.ts +17 -0
  113. package/dist/runtime/components/polaris/ShParagraph.d.vue.ts +21 -0
  114. package/dist/runtime/components/polaris/ShParagraph.vue +17 -0
  115. package/dist/runtime/components/polaris/ShParagraph.vue.d.ts +21 -0
  116. package/dist/runtime/components/polaris/ShPasswordField.d.vue.ts +30 -0
  117. package/dist/runtime/components/polaris/ShPasswordField.vue +26 -0
  118. package/dist/runtime/components/polaris/ShPasswordField.vue.d.ts +30 -0
  119. package/dist/runtime/components/polaris/ShPopover.d.vue.ts +21 -0
  120. package/dist/runtime/components/polaris/ShPopover.vue +17 -0
  121. package/dist/runtime/components/polaris/ShPopover.vue.d.ts +21 -0
  122. package/dist/runtime/components/polaris/ShQueryContainer.d.vue.ts +16 -0
  123. package/dist/runtime/components/polaris/ShQueryContainer.vue +12 -0
  124. package/dist/runtime/components/polaris/ShQueryContainer.vue.d.ts +16 -0
  125. package/dist/runtime/components/polaris/ShSearchField.d.vue.ts +30 -0
  126. package/dist/runtime/components/polaris/ShSearchField.vue +26 -0
  127. package/dist/runtime/components/polaris/ShSearchField.vue.d.ts +30 -0
  128. package/dist/runtime/components/polaris/ShSection.d.vue.ts +18 -0
  129. package/dist/runtime/components/polaris/ShSection.vue +14 -0
  130. package/dist/runtime/components/polaris/ShSection.vue.d.ts +18 -0
  131. package/dist/runtime/components/polaris/ShSelect.d.vue.ts +26 -0
  132. package/dist/runtime/components/polaris/ShSelect.vue +22 -0
  133. package/dist/runtime/components/polaris/ShSelect.vue.d.ts +26 -0
  134. package/dist/runtime/components/polaris/ShSpinner.d.vue.ts +17 -0
  135. package/dist/runtime/components/polaris/ShSpinner.vue +13 -0
  136. package/dist/runtime/components/polaris/ShSpinner.vue.d.ts +17 -0
  137. package/dist/runtime/components/polaris/ShStack.d.vue.ts +46 -0
  138. package/dist/runtime/components/polaris/ShStack.vue +42 -0
  139. package/dist/runtime/components/polaris/ShStack.vue.d.ts +46 -0
  140. package/dist/runtime/components/polaris/ShSwitch.d.vue.ts +27 -0
  141. package/dist/runtime/components/polaris/ShSwitch.vue +23 -0
  142. package/dist/runtime/components/polaris/ShSwitch.vue.d.ts +27 -0
  143. package/dist/runtime/components/polaris/ShTable.d.vue.ts +20 -0
  144. package/dist/runtime/components/polaris/ShTable.vue +16 -0
  145. package/dist/runtime/components/polaris/ShTable.vue.d.ts +20 -0
  146. package/dist/runtime/components/polaris/ShTableBody.d.vue.ts +13 -0
  147. package/dist/runtime/components/polaris/ShTableBody.vue +9 -0
  148. package/dist/runtime/components/polaris/ShTableBody.vue.d.ts +13 -0
  149. package/dist/runtime/components/polaris/ShTableCell.d.vue.ts +13 -0
  150. package/dist/runtime/components/polaris/ShTableCell.vue +9 -0
  151. package/dist/runtime/components/polaris/ShTableCell.vue.d.ts +13 -0
  152. package/dist/runtime/components/polaris/ShTableHeader.d.vue.ts +17 -0
  153. package/dist/runtime/components/polaris/ShTableHeader.vue +13 -0
  154. package/dist/runtime/components/polaris/ShTableHeader.vue.d.ts +17 -0
  155. package/dist/runtime/components/polaris/ShTableHeaderRow.d.vue.ts +13 -0
  156. package/dist/runtime/components/polaris/ShTableHeaderRow.vue +9 -0
  157. package/dist/runtime/components/polaris/ShTableHeaderRow.vue.d.ts +13 -0
  158. package/dist/runtime/components/polaris/ShTableRow.d.vue.ts +16 -0
  159. package/dist/runtime/components/polaris/ShTableRow.vue +12 -0
  160. package/dist/runtime/components/polaris/ShTableRow.vue.d.ts +16 -0
  161. package/dist/runtime/components/polaris/ShText.d.vue.ts +22 -0
  162. package/dist/runtime/components/polaris/ShText.vue +18 -0
  163. package/dist/runtime/components/polaris/ShText.vue.d.ts +22 -0
  164. package/dist/runtime/components/polaris/ShTextArea.d.vue.ts +31 -0
  165. package/dist/runtime/components/polaris/ShTextArea.vue +27 -0
  166. package/dist/runtime/components/polaris/ShTextArea.vue.d.ts +31 -0
  167. package/dist/runtime/components/polaris/ShTextField.d.vue.ts +33 -0
  168. package/dist/runtime/components/polaris/ShTextField.vue +29 -0
  169. package/dist/runtime/components/polaris/ShTextField.vue.d.ts +33 -0
  170. package/dist/runtime/components/polaris/ShThumbnail.d.vue.ts +18 -0
  171. package/dist/runtime/components/polaris/ShThumbnail.vue +14 -0
  172. package/dist/runtime/components/polaris/ShThumbnail.vue.d.ts +18 -0
  173. package/dist/runtime/components/polaris/ShTooltip.d.vue.ts +13 -0
  174. package/dist/runtime/components/polaris/ShTooltip.vue +9 -0
  175. package/dist/runtime/components/polaris/ShTooltip.vue.d.ts +13 -0
  176. package/dist/runtime/components/polaris/ShUnorderedList.d.vue.ts +13 -0
  177. package/dist/runtime/components/polaris/ShUnorderedList.vue +9 -0
  178. package/dist/runtime/components/polaris/ShUnorderedList.vue.d.ts +13 -0
  179. package/dist/runtime/components/polaris/ShUrlField.d.vue.ts +30 -0
  180. package/dist/runtime/components/polaris/ShUrlField.vue +26 -0
  181. package/dist/runtime/components/polaris/ShUrlField.vue.d.ts +30 -0
  182. package/dist/runtime/components/polaris/types.d.ts +1 -0
  183. package/dist/runtime/components/polaris/types.js +0 -0
  184. package/dist/runtime/composables/useAppBridge.d.ts +8 -0
  185. package/dist/runtime/composables/useAppBridge.js +21 -0
  186. package/dist/runtime/composables/useShopifyFetch.d.ts +4 -0
  187. package/dist/runtime/composables/useShopifyFetch.js +32 -0
  188. package/dist/runtime/middleware/shopify-auth.d.ts +2 -0
  189. package/dist/runtime/middleware/shopify-auth.js +11 -0
  190. package/dist/runtime/plugin.d.ts +1 -0
  191. package/dist/runtime/plugin.js +1 -0
  192. package/dist/runtime/plugins/app-bridge.d.ts +12 -0
  193. package/dist/runtime/plugins/app-bridge.js +28 -0
  194. package/dist/runtime/plugins/polaris.d.ts +1 -0
  195. package/dist/runtime/plugins/polaris.js +0 -0
  196. package/dist/runtime/server/index.d.ts +2 -0
  197. package/dist/runtime/server/index.js +7 -0
  198. package/dist/runtime/server/routes/auth-callback.d.ts +6 -0
  199. package/dist/runtime/server/routes/auth-callback.js +45 -0
  200. package/dist/runtime/server/routes/auth-exit-iframe.d.ts +6 -0
  201. package/dist/runtime/server/routes/auth-exit-iframe.js +11 -0
  202. package/dist/runtime/server/routes/auth-session-token.d.ts +7 -0
  203. package/dist/runtime/server/routes/auth-session-token.js +27 -0
  204. package/dist/runtime/server/routes/auth.d.ts +6 -0
  205. package/dist/runtime/server/routes/auth.js +23 -0
  206. package/dist/runtime/server/services/shopify.d.ts +38 -0
  207. package/dist/runtime/server/services/shopify.js +89 -0
  208. package/dist/runtime/server/test-helpers/index.d.ts +25 -0
  209. package/dist/runtime/server/test-helpers/index.js +25 -0
  210. package/dist/runtime/server/test-helpers/package.json +4 -0
  211. package/dist/runtime/server/tsconfig.json +3 -0
  212. package/dist/runtime/server/utils/authenticate-admin.d.ts +17 -0
  213. package/dist/runtime/server/utils/authenticate-admin.js +197 -0
  214. package/dist/runtime/server/utils/authenticate-flow.d.ts +17 -0
  215. package/dist/runtime/server/utils/authenticate-flow.js +70 -0
  216. package/dist/runtime/server/utils/authenticate-fulfillment-service.d.ts +16 -0
  217. package/dist/runtime/server/utils/authenticate-fulfillment-service.js +54 -0
  218. package/dist/runtime/server/utils/authenticate-pos.d.ts +18 -0
  219. package/dist/runtime/server/utils/authenticate-pos.js +31 -0
  220. package/dist/runtime/server/utils/authenticate-public.d.ts +17 -0
  221. package/dist/runtime/server/utils/authenticate-public.js +31 -0
  222. package/dist/runtime/server/utils/authenticate-webhook.d.ts +26 -0
  223. package/dist/runtime/server/utils/authenticate-webhook.js +76 -0
  224. package/dist/runtime/server/utils/clients.d.ts +25 -0
  225. package/dist/runtime/server/utils/clients.js +36 -0
  226. package/dist/runtime/server/utils/helpers.d.ts +10 -0
  227. package/dist/runtime/server/utils/helpers.js +96 -0
  228. package/dist/runtime/server/utils/login.d.ts +17 -0
  229. package/dist/runtime/server/utils/login.js +44 -0
  230. package/dist/runtime/server/utils/register-webhooks.d.ts +19 -0
  231. package/dist/runtime/server/utils/register-webhooks.js +5 -0
  232. package/dist/runtime/server/utils/unauthenticated-admin.d.ts +21 -0
  233. package/dist/runtime/server/utils/unauthenticated-admin.js +15 -0
  234. package/dist/runtime/server/utils/unauthenticated-storefront.d.ts +24 -0
  235. package/dist/runtime/server/utils/unauthenticated-storefront.js +21 -0
  236. package/dist/runtime/types.d.ts +141 -0
  237. package/dist/runtime/types.js +11 -0
  238. package/dist/types.d.mts +3 -0
  239. package/package.json +66 -0
package/README.md ADDED
@@ -0,0 +1,275 @@
1
+ # `shopify-nuxt`
2
+
3
+ > **NOTE** This package is in early alpha and is not yet recommended for production use. The API may change without a major version bump. Please try it out and share your feedback!
4
+
5
+ <!-- ![Build Status]() -->
6
+
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.md)
8
+ [![npm version](https://badge.fury.io/js/shopify-nuxt.svg)](https://badge.fury.io/js/shopify-nuxt)
9
+ [![Nuxt](https://img.shields.io/badge/Nuxt-020420?logo=nuxt)](https://nuxt.com)
10
+
11
+ This package makes it easy to use [Nuxt](https://nuxt.com/) to build Shopify apps.
12
+
13
+ It builds on the `@shopify/shopify-api` package and creates a Nuxt module layer that allows your app to communicate with and authenticate requests from Shopify.
14
+
15
+ > **Note**: this package will enable your app's backend to work with Shopify APIs, and by default it will behave as an [embedded app](https://shopify.dev/docs/apps/auth/oauth/session-tokens). It uses the CDN-based [Shopify App Bridge](https://shopify.dev/docs/apps/tools/app-bridge) for frontend authentication.
16
+
17
+ ## Requirements
18
+
19
+ To follow these usage guides, you will need to:
20
+
21
+ - Have a [Shopify Partner account](https://partners.shopify.com/signup) and development store
22
+ - Have an app already set up on your partner account
23
+ - Have a JavaScript package manager such as [bun](https://bun.sh), [yarn](https://yarnpkg.com), or [npm](https://www.npmjs.com/) installed
24
+ - Have [Nuxt](https://nuxt.com/) v4 or later installed
25
+
26
+ ## Getting started
27
+
28
+ Install the module to your Nuxt application:
29
+
30
+ ```bash
31
+ # Using bun
32
+ bun add shopify-nuxt
33
+
34
+ # Using npm
35
+ npm install shopify-nuxt
36
+
37
+ # Using yarn
38
+ yarn add shopify-nuxt
39
+ ```
40
+
41
+ Then add `shopify-nuxt` to the `modules` section and configure it in your `nuxt.config.ts`:
42
+
43
+ ```ts
44
+ export default defineNuxtConfig({
45
+ modules: ['shopify-nuxt'],
46
+
47
+ shopify: {
48
+ apiKey: 'ApiKeyFromPartnersDashboard',
49
+ apiSecretKey: 'ApiSecretKeyFromPartnersDashboard',
50
+ scopes: ['read_products', 'write_products'],
51
+ appUrl: 'https://your-app-url.com'
52
+ }
53
+ })
54
+ ```
55
+
56
+ For session storage and post-auth hooks, create a Nitro server plugin:
57
+
58
+ ```ts
59
+ // server/plugins/shopify.ts
60
+ import { configureShopify } from '#shopify/server'
61
+ import { MemorySessionStorage } from '@shopify/shopify-app-session-storage-memory'
62
+
63
+ export default defineNitroPlugin(() => {
64
+ configureShopify({
65
+ sessionStorage: new MemorySessionStorage(),
66
+ hooks: {
67
+ afterAuth: async ({ session, admin }) => {
68
+ // Register webhooks, seed data, etc.
69
+ }
70
+ }
71
+ })
72
+ })
73
+ ```
74
+
75
+ ### Authenticating admin requests
76
+
77
+ Use `useShopifyAdmin()` in your server API routes to authenticate requests from the Shopify admin:
78
+
79
+ ```ts
80
+ // server/api/products.ts
81
+ export default defineEventHandler(async (event) => {
82
+ const { admin } = await useShopifyAdmin(event)
83
+
84
+ const response = await admin.graphql(`{
85
+ products(first: 5) {
86
+ edges {
87
+ node {
88
+ id
89
+ title
90
+ }
91
+ }
92
+ }
93
+ }`)
94
+
95
+ return response
96
+ })
97
+ ```
98
+
99
+ ### Handling webhooks
100
+
101
+ Use `useShopifyWebhook()` to validate and process incoming webhooks:
102
+
103
+ ```ts
104
+ // server/api/webhooks.ts
105
+ export default defineEventHandler(async (event) => {
106
+ const { topic, shop, payload } = await useShopifyWebhook(event)
107
+
108
+ switch (topic) {
109
+ case 'APP_UNINSTALLED':
110
+ // Clean up shop data
111
+ break
112
+ case 'PRODUCTS_CREATE':
113
+ // Handle new product
114
+ break
115
+ }
116
+
117
+ return { success: true }
118
+ })
119
+ ```
120
+
121
+ ### Using App Bridge on the client
122
+
123
+ The module automatically injects the Shopify App Bridge CDN script and provides typed access via composables:
124
+
125
+ ```vue
126
+ <script setup>
127
+ // Access the App Bridge instance (typed as ShopifyGlobal)
128
+ const shopify = useAppBridge()
129
+
130
+ // Or use the authenticated fetch wrapper
131
+ const shopifyFetch = useShopifyFetch()
132
+ const { data } = await shopifyFetch('/api/products')
133
+ </script>
134
+
135
+ <template>
136
+ <ShopifyAppProvider>
137
+ <!-- Your app content -->
138
+ </ShopifyAppProvider>
139
+ </template>
140
+ ```
141
+
142
+ ### Using Polaris components
143
+
144
+ This module provides Vue wrapper components for [Shopify Polaris web components](https://shopify.dev/docs/api/app-home/web-components). Use the `Sh`-prefixed wrappers instead of the raw `s-*` web components — they provide typed props with autocomplete and work seamlessly with Vue's reactivity system.
145
+
146
+ ```vue
147
+ <template>
148
+ <ShPage heading="Products">
149
+ <ShStack gap="base">
150
+ <ShButton variant="primary" @click="save">Save</ShButton>
151
+ <ShButton @click="cancel">Cancel</ShButton>
152
+ </ShStack>
153
+
154
+ <ShBanner heading="Welcome" tone="info" dismissible>
155
+ Start by adding your first product.
156
+ </ShBanner>
157
+
158
+ <ShTextField
159
+ label="Product title"
160
+ :value="title"
161
+ placeholder="Enter product title"
162
+ />
163
+ </ShPage>
164
+ </template>
165
+ ```
166
+
167
+ All `Sh*` components are auto-imported — no manual imports needed. Each component maps directly to its Polaris web component counterpart (e.g., `<ShButton>` → `<s-button>`, `<ShTextField>` → `<s-text-field>`).
168
+
169
+ ### Loading your app in Shopify Admin
170
+
171
+ To load your app within the Shopify Admin, you need to:
172
+
173
+ 1. Update your app's URL in your Partners Dashboard app setup page to your app URL (e.g., `https://your-app-url.com`)
174
+ 1. Update your app's callback URL to `https://your-app-url.com/_shopify/auth/callback` in that same page
175
+ 1. Go to **Test your app** in Partners Dashboard and select your development store
176
+
177
+ ## Features
178
+
179
+ | Feature | Description |
180
+ | ------------------- | ------------------------------------------------------------------------------- |
181
+ | **Authentication** | OAuth flow, session tokens, token exchange — all handled automatically |
182
+ | **App Bridge** | CDN-based App Bridge with full TypeScript types via `@shopify/app-bridge-types` |
183
+ | **Polaris** | Vue wrapper components (`Sh*`) for all Polaris web components with typed props |
184
+ | **Webhooks** | HMAC validation, payload parsing, and webhook registration |
185
+ | **Admin API** | GraphQL and REST clients with automatic session management |
186
+ | **Billing** | Billing context for subscription and usage-based charges |
187
+ | **Session storage** | Pluggable session storage via `@shopify/shopify-app-session-storage` |
188
+ | **Auto-imports** | Server utilities and client composables are auto-imported |
189
+
190
+ ## Server utilities
191
+
192
+ These are auto-imported in your `server/` directory:
193
+
194
+ | Utility | Purpose |
195
+ | ------------------------------------------- | ----------------------------------------------------- |
196
+ | `useShopifyAdmin(event)` | Authenticate admin requests (token exchange, session) |
197
+ | `useShopifyWebhook(event)` | Validate webhook HMAC + parse payload |
198
+ | `useShopifyFlow(event)` | Authenticate Shopify Flow extension requests |
199
+ | `useShopifyPublic(event)` | Authenticate public/checkout extension requests |
200
+ | `useShopifyPos(event)` | Authenticate POS extension requests |
201
+ | `useShopifyFulfillmentService(event)` | Authenticate fulfillment service callbacks |
202
+ | `useShopifyLogin(event)` | Handle merchant login (non-embedded apps) |
203
+ | `useShopifyUnauthenticatedAdmin(shop)` | Offline session admin API access |
204
+ | `useShopifyUnauthenticatedStorefront(shop)` | Offline session storefront API access |
205
+ | `registerShopifyWebhooks(session)` | Register webhooks for a shop |
206
+
207
+ ## Client composables
208
+
209
+ These are auto-imported in your Vue components:
210
+
211
+ | Composable | Purpose |
212
+ | ------------------- | ------------------------------------------------- |
213
+ | `useAppBridge()` | Returns typed `ShopifyGlobal` from App Bridge CDN |
214
+ | `useShopifyFetch()` | Fetch wrapper with automatic session token auth |
215
+
216
+ ## Testing your app
217
+
218
+ This package exports test helpers through `shopify-nuxt/test-helpers` to simplify testing:
219
+
220
+ ```ts
221
+ import { testConfig, testSession } from 'shopify-nuxt/test-helpers'
222
+
223
+ // testConfig() returns a dummy configuration for testing
224
+ const config = testConfig()
225
+
226
+ // testSession() returns a mock Shopify session
227
+ const session = testSession()
228
+ ```
229
+
230
+ ## Resources
231
+
232
+ Getting started:
233
+
234
+ - [Nuxt docs](https://nuxt.com/docs)
235
+ - [Build a Shopify app](https://shopify.dev/docs/apps/build/build)
236
+
237
+ Shopify:
238
+
239
+ - [Intro to Shopify apps](https://shopify.dev/docs/apps/getting-started)
240
+ - [Shopify CLI](https://shopify.dev/docs/apps/tools/cli)
241
+ - [Shopify App Bridge](https://shopify.dev/docs/api/app-bridge-library)
242
+ - [Polaris Web Components](https://shopify.dev/docs/api/app-home/using-polaris-components)
243
+ - [App extensions](https://shopify.dev/docs/apps/app-extensions/list)
244
+ - [Shopify Functions](https://shopify.dev/docs/api/functions)
245
+
246
+ ## Contributing
247
+
248
+ <details>
249
+ <summary>Local development</summary>
250
+
251
+ ```bash
252
+ # Install dependencies
253
+ bun install
254
+
255
+ # Generate type stubs
256
+ bun run dev:prepare
257
+
258
+ # Develop with the playground
259
+ bun run dev
260
+
261
+ # Build the playground
262
+ bun run dev:build
263
+
264
+ # Run ESLint
265
+ bun run lint
266
+
267
+ # Run Vitest
268
+ bun run test
269
+ bun run test:watch
270
+
271
+ # Release new version
272
+ bun run release
273
+ ```
274
+
275
+ </details>
@@ -0,0 +1,7 @@
1
+ import * as _nuxt_schema from '@nuxt/schema';
2
+ import { ModuleOptions } from '../dist/runtime/types.js';
3
+ export { ModuleOptions } from '../dist/runtime/types.js';
4
+
5
+ declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
6
+
7
+ export { _default as default };
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "shopify-nuxt",
3
+ "configKey": "shopify",
4
+ "version": "0.0.1",
5
+ "builder": {
6
+ "@nuxt/module-builder": "1.0.2",
7
+ "unbuild": "unknown"
8
+ }
9
+ }
@@ -0,0 +1,134 @@
1
+ import { defineNuxtModule, createResolver, addServerImportsDir, addImportsDir, addComponentsDir, addTypeTemplate, addPlugin, addServerHandler, addRouteMiddleware } from '@nuxt/kit';
2
+ import { ApiVersion } from '@shopify/shopify-api';
3
+
4
+ const module$1 = defineNuxtModule({
5
+ meta: {
6
+ name: "shopify-nuxt",
7
+ configKey: "shopify"
8
+ },
9
+ defaults: {
10
+ apiKey: "",
11
+ apiSecretKey: "",
12
+ scopes: [],
13
+ appUrl: "",
14
+ apiVersion: ApiVersion.January26,
15
+ authPathPrefix: "/_shopify/auth",
16
+ distribution: "app_store",
17
+ useOnlineTokens: false
18
+ },
19
+ setup(options, nuxt) {
20
+ const resolver = createResolver(import.meta.url);
21
+ nuxt.options.runtimeConfig.shopify = {
22
+ apiKey: options.apiKey,
23
+ apiSecretKey: options.apiSecretKey,
24
+ scopes: options.scopes,
25
+ appUrl: options.appUrl,
26
+ apiVersion: options.apiVersion || ApiVersion.January26,
27
+ authPathPrefix: options.authPathPrefix || "/_shopify/auth",
28
+ distribution: options.distribution || "app_store",
29
+ useOnlineTokens: options.useOnlineTokens || false
30
+ };
31
+ nuxt.options.runtimeConfig.public.shopify = {
32
+ apiKey: options.apiKey
33
+ };
34
+ nuxt.options.alias["#shopify/server"] = resolver.resolve("./runtime/server");
35
+ addServerImportsDir(resolver.resolve("./runtime/server/utils"));
36
+ addImportsDir(resolver.resolve("./runtime/composables"));
37
+ addComponentsDir({
38
+ path: resolver.resolve("./runtime/components")
39
+ });
40
+ nuxt.hook("app:resolve", () => {
41
+ nuxt.options.app.head = nuxt.options.app.head || {};
42
+ nuxt.options.app.head.meta = [
43
+ {
44
+ name: "content-security-policy",
45
+ content: "frame-ancestors 'self' *.myshopify.com *.shopify.com"
46
+ },
47
+ ...nuxt.options.app.head.meta || []
48
+ ];
49
+ nuxt.options.app.head.script = [
50
+ // 1. Inline script to create the meta tag imperatively — guarantees it
51
+ // exists in the DOM before the CDN script executes.
52
+ {
53
+ key: "shopify-api-key-meta",
54
+ innerHTML: `var m=document.createElement('meta');m.name='shopify-api-key';m.content='${options.apiKey}';document.head.appendChild(m);`,
55
+ tagPosition: "head"
56
+ },
57
+ // 2. App Bridge CDN — reads the meta tag on load
58
+ {
59
+ src: "https://cdn.shopify.com/shopifycloud/app-bridge.js",
60
+ tagPosition: "head"
61
+ },
62
+ // 3. Polaris CDN
63
+ {
64
+ src: "https://cdn.shopify.com/shopifycloud/polaris.js",
65
+ tagPosition: "head"
66
+ },
67
+ ...nuxt.options.app.head.script || []
68
+ ];
69
+ nuxt.options.vue.compilerOptions.isCustomElement = (tag) => {
70
+ return tag.startsWith("s-");
71
+ };
72
+ });
73
+ addTypeTemplate({
74
+ filename: "types/polaris.d.ts",
75
+ getContents: () => `
76
+ /// <reference types="@shopify/polaris-types" />
77
+
78
+ declare module 'vue' {
79
+ interface HTMLAttributes {
80
+ slot?: string
81
+ }
82
+ }
83
+
84
+ export {}
85
+ `
86
+ });
87
+ addPlugin({
88
+ src: resolver.resolve("./runtime/plugins/app-bridge"),
89
+ mode: "client"
90
+ });
91
+ const authPrefix = options.authPathPrefix || "/_shopify/auth";
92
+ addServerHandler({
93
+ route: authPrefix,
94
+ method: "get",
95
+ handler: resolver.resolve("./runtime/server/routes/auth")
96
+ });
97
+ addServerHandler({
98
+ route: `${authPrefix}/callback`,
99
+ method: "get",
100
+ handler: resolver.resolve("./runtime/server/routes/auth-callback")
101
+ });
102
+ addServerHandler({
103
+ route: `${authPrefix}/exit-iframe`,
104
+ method: "get",
105
+ handler: resolver.resolve("./runtime/server/routes/auth-exit-iframe")
106
+ });
107
+ addServerHandler({
108
+ route: `${authPrefix}/session-token`,
109
+ method: "get",
110
+ handler: resolver.resolve("./runtime/server/routes/auth-session-token")
111
+ });
112
+ addRouteMiddleware({
113
+ name: "shopify-auth",
114
+ path: resolver.resolve("./runtime/middleware/shopify-auth"),
115
+ global: false
116
+ });
117
+ nuxt.options.build.transpile.push(resolver.resolve("./runtime"));
118
+ nuxt.hook("nitro:config", (nitroConfig) => {
119
+ nitroConfig.externals = nitroConfig.externals || {};
120
+ nitroConfig.externals.inline = nitroConfig.externals.inline || [];
121
+ nitroConfig.externals.inline.push(
122
+ "@shopify/shopify-api",
123
+ "@shopify/shopify-api/adapters/node"
124
+ );
125
+ });
126
+ nuxt.hook("prepare:types", ({ references }) => {
127
+ references.push({
128
+ path: resolver.resolve("./runtime/types.ts")
129
+ });
130
+ });
131
+ }
132
+ });
133
+
134
+ export { module$1 as default };
@@ -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: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, 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,11 @@
1
+ <template>
2
+ <div>
3
+ <slot />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup>
8
+ defineOptions({
9
+ name: "ShopifyAppProvider"
10
+ });
11
+ </script>
@@ -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: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, 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,13 @@
1
+ declare var __VLS_8: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_8) => any;
4
+ };
5
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, 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,9 @@
1
+ <template>
2
+ <s-app-nav v-bind="$attrs">
3
+ <slot />
4
+ </s-app-nav>
5
+ </template>
6
+
7
+ <script setup>
8
+ defineOptions({ name: "ShAppNav", inheritAttrs: false });
9
+ </script>
@@ -0,0 +1,13 @@
1
+ declare var __VLS_8: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_8) => any;
4
+ };
5
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, 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,19 @@
1
+ type __VLS_Props = {
2
+ initials?: string;
3
+ src?: string;
4
+ size?: 'small' | 'small-200' | 'base' | 'large' | 'large-200';
5
+ alt?: string;
6
+ };
7
+ declare var __VLS_8: {};
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_8) => any;
10
+ };
11
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <s-avatar v-bind="$attrs">
3
+ <slot />
4
+ </s-avatar>
5
+ </template>
6
+
7
+ <script setup>
8
+ defineOptions({ name: "ShAvatar", inheritAttrs: false });
9
+ defineProps({
10
+ initials: { type: String, required: false },
11
+ src: { type: String, required: false },
12
+ size: { type: String, required: false },
13
+ alt: { type: String, required: false }
14
+ });
15
+ </script>
@@ -0,0 +1,19 @@
1
+ type __VLS_Props = {
2
+ initials?: string;
3
+ src?: string;
4
+ size?: 'small' | 'small-200' | 'base' | 'large' | 'large-200';
5
+ alt?: string;
6
+ };
7
+ declare var __VLS_8: {};
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_8) => any;
10
+ };
11
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ content?: string;
3
+ progress?: string;
4
+ tone?: string;
5
+ icon?: string;
6
+ size?: 'base' | 'large';
7
+ };
8
+ declare var __VLS_8: {};
9
+ type __VLS_Slots = {} & {
10
+ default?: (props: typeof __VLS_8) => any;
11
+ };
12
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <s-badge v-bind="$attrs">
3
+ <slot />
4
+ </s-badge>
5
+ </template>
6
+
7
+ <script setup>
8
+ defineOptions({ name: "ShBadge", inheritAttrs: false });
9
+ defineProps({
10
+ content: { type: String, required: false },
11
+ progress: { type: String, required: false },
12
+ tone: { type: String, required: false },
13
+ icon: { type: String, required: false },
14
+ size: { type: String, required: false }
15
+ });
16
+ </script>
@@ -0,0 +1,20 @@
1
+ type __VLS_Props = {
2
+ content?: string;
3
+ progress?: string;
4
+ tone?: string;
5
+ icon?: string;
6
+ size?: 'base' | 'large';
7
+ };
8
+ declare var __VLS_8: {};
9
+ type __VLS_Slots = {} & {
10
+ default?: (props: typeof __VLS_8) => any;
11
+ };
12
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,19 @@
1
+ type __VLS_Props = {
2
+ heading?: string;
3
+ tone?: 'info' | 'success' | 'warning' | 'critical' | 'auto';
4
+ hidden?: boolean;
5
+ dismissible?: boolean;
6
+ };
7
+ declare var __VLS_8: {};
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_8) => any;
10
+ };
11
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <s-banner v-bind="$attrs">
3
+ <slot />
4
+ </s-banner>
5
+ </template>
6
+
7
+ <script setup>
8
+ defineOptions({ name: "ShBanner", inheritAttrs: false });
9
+ defineProps({
10
+ heading: { type: String, required: false },
11
+ tone: { type: String, required: false },
12
+ hidden: { type: Boolean, required: false },
13
+ dismissible: { type: Boolean, required: false }
14
+ });
15
+ </script>