@tanstack/create 0.65.0 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/frameworks/react/add-ons/shopify/README.md +86 -0
  3. package/dist/frameworks/react/add-ons/shopify/assets/_dot_env.local.append +19 -0
  4. package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/account-nav.tsx.ejs +41 -0
  5. package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/add-to-cart-button.tsx +48 -0
  6. package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/cart-line-item.tsx +94 -0
  7. package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/cart-summary.tsx +111 -0
  8. package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/empty-state.tsx +29 -0
  9. package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/money.tsx +11 -0
  10. package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/product-card.tsx +74 -0
  11. package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/product-grid.tsx +24 -0
  12. package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/shop-image.tsx +57 -0
  13. package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/shop.css +58 -0
  14. package/dist/frameworks/react/add-ons/shopify/assets/src/components/shop/variant-selector.tsx +79 -0
  15. package/dist/frameworks/react/add-ons/shopify/assets/src/hooks/use-cart.ts +276 -0
  16. package/dist/frameworks/react/add-ons/shopify/assets/src/hooks/use-customer.ts.ejs +22 -0
  17. package/dist/frameworks/react/add-ons/shopify/assets/src/integrations/shopify/header-cart.tsx +37 -0
  18. package/dist/frameworks/react/add-ons/shopify/assets/src/lib/shopify/customer-queries.ts.ejs +228 -0
  19. package/dist/frameworks/react/add-ons/shopify/assets/src/lib/shopify/format.ts +33 -0
  20. package/dist/frameworks/react/add-ons/shopify/assets/src/lib/shopify/queries.ts +684 -0
  21. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.addresses.tsx.ejs +67 -0
  22. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.callback.tsx.ejs +45 -0
  23. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.index.tsx.ejs +70 -0
  24. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.login.tsx.ejs +59 -0
  25. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.logout.tsx.ejs +16 -0
  26. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.orders.$id.tsx.ejs +126 -0
  27. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.orders.tsx.ejs +50 -0
  28. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.tsx.ejs +34 -0
  29. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.cart.tsx +45 -0
  30. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.collections.$handle.tsx +66 -0
  31. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.index.tsx +36 -0
  32. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.pages.$handle.tsx +39 -0
  33. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.policies.$handle.tsx +30 -0
  34. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.products.$handle.tsx +106 -0
  35. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.search.tsx +75 -0
  36. package/dist/frameworks/react/add-ons/shopify/assets/src/routes/shop.tsx +78 -0
  37. package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/cart.functions.ts +207 -0
  38. package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/catalog.functions.ts +244 -0
  39. package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/cookies.ts +29 -0
  40. package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer-client.ts.ejs +99 -0
  41. package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer-cookies.ts.ejs +49 -0
  42. package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer.functions.ts.ejs +168 -0
  43. package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/env.ts +89 -0
  44. package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/oauth.ts.ejs +301 -0
  45. package/dist/frameworks/react/add-ons/shopify/assets/src/server/shopify/storefront-client.ts +101 -0
  46. package/dist/frameworks/react/add-ons/shopify/info.json +104 -0
  47. package/dist/frameworks/react/add-ons/shopify/package.json +6 -0
  48. package/dist/frameworks/react/add-ons/shopify/small-logo.svg +1 -0
  49. package/dist/frameworks/react/examples/shopify-storefront/README.md +39 -0
  50. package/dist/frameworks/react/examples/shopify-storefront/assets/src/components/FeaturedCollections.tsx +43 -0
  51. package/dist/frameworks/react/examples/shopify-storefront/assets/src/components/ShopHero.tsx +39 -0
  52. package/dist/frameworks/react/examples/shopify-storefront/assets/src/routes/index.tsx +65 -0
  53. package/dist/frameworks/react/examples/shopify-storefront/info.json +18 -0
  54. package/dist/frameworks/react/examples/shopify-storefront/package.json +3 -0
  55. package/dist/frameworks/react/project/base/src/components/Header.tsx.ejs +34 -34
  56. package/package.json +1 -1
  57. package/src/frameworks/react/add-ons/shopify/README.md +86 -0
  58. package/src/frameworks/react/add-ons/shopify/assets/_dot_env.local.append +19 -0
  59. package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/account-nav.tsx.ejs +41 -0
  60. package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/add-to-cart-button.tsx +48 -0
  61. package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/cart-line-item.tsx +94 -0
  62. package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/cart-summary.tsx +111 -0
  63. package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/empty-state.tsx +29 -0
  64. package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/money.tsx +11 -0
  65. package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/product-card.tsx +74 -0
  66. package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/product-grid.tsx +24 -0
  67. package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/shop-image.tsx +57 -0
  68. package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/shop.css +58 -0
  69. package/src/frameworks/react/add-ons/shopify/assets/src/components/shop/variant-selector.tsx +79 -0
  70. package/src/frameworks/react/add-ons/shopify/assets/src/hooks/use-cart.ts +276 -0
  71. package/src/frameworks/react/add-ons/shopify/assets/src/hooks/use-customer.ts.ejs +22 -0
  72. package/src/frameworks/react/add-ons/shopify/assets/src/integrations/shopify/header-cart.tsx +37 -0
  73. package/src/frameworks/react/add-ons/shopify/assets/src/lib/shopify/customer-queries.ts.ejs +228 -0
  74. package/src/frameworks/react/add-ons/shopify/assets/src/lib/shopify/format.ts +33 -0
  75. package/src/frameworks/react/add-ons/shopify/assets/src/lib/shopify/queries.ts +684 -0
  76. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.addresses.tsx.ejs +67 -0
  77. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.callback.tsx.ejs +45 -0
  78. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.index.tsx.ejs +70 -0
  79. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.login.tsx.ejs +59 -0
  80. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.logout.tsx.ejs +16 -0
  81. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.orders.$id.tsx.ejs +126 -0
  82. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.orders.tsx.ejs +50 -0
  83. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.account.tsx.ejs +34 -0
  84. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.cart.tsx +45 -0
  85. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.collections.$handle.tsx +66 -0
  86. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.index.tsx +36 -0
  87. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.pages.$handle.tsx +39 -0
  88. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.policies.$handle.tsx +30 -0
  89. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.products.$handle.tsx +106 -0
  90. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.search.tsx +75 -0
  91. package/src/frameworks/react/add-ons/shopify/assets/src/routes/shop.tsx +78 -0
  92. package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/cart.functions.ts +207 -0
  93. package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/catalog.functions.ts +244 -0
  94. package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/cookies.ts +29 -0
  95. package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer-client.ts.ejs +99 -0
  96. package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer-cookies.ts.ejs +49 -0
  97. package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/customer.functions.ts.ejs +168 -0
  98. package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/env.ts +89 -0
  99. package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/oauth.ts.ejs +301 -0
  100. package/src/frameworks/react/add-ons/shopify/assets/src/server/shopify/storefront-client.ts +101 -0
  101. package/src/frameworks/react/add-ons/shopify/info.json +104 -0
  102. package/src/frameworks/react/add-ons/shopify/package.json +6 -0
  103. package/src/frameworks/react/add-ons/shopify/small-logo.svg +1 -0
  104. package/src/frameworks/react/examples/shopify-storefront/README.md +39 -0
  105. package/src/frameworks/react/examples/shopify-storefront/assets/src/components/FeaturedCollections.tsx +43 -0
  106. package/src/frameworks/react/examples/shopify-storefront/assets/src/components/ShopHero.tsx +39 -0
  107. package/src/frameworks/react/examples/shopify-storefront/assets/src/routes/index.tsx +65 -0
  108. package/src/frameworks/react/examples/shopify-storefront/info.json +18 -0
  109. package/src/frameworks/react/examples/shopify-storefront/package.json +3 -0
  110. package/src/frameworks/react/project/base/src/components/Header.tsx.ejs +34 -34
@@ -0,0 +1,228 @@
1
+ <% if (addOnOption.shopify.customerAccount !== 'enabled') { ignoreFile(); return; } %>
2
+ /**
3
+ * GraphQL queries for the Shopify Customer Account API.
4
+ *
5
+ * The Customer Account API has its own schema, distinct from the Storefront
6
+ * API. We hand-type the slices we use; if the surface area grows we can wire
7
+ * up @shopify/customer-account-api-codegen later.
8
+ */
9
+
10
+ export const CUSTOMER_QUERY = /* GraphQL */ `
11
+ query Customer {
12
+ customer {
13
+ id
14
+ firstName
15
+ lastName
16
+ emailAddress {
17
+ emailAddress
18
+ }
19
+ phoneNumber {
20
+ phoneNumber
21
+ }
22
+ defaultAddress {
23
+ id
24
+ firstName
25
+ lastName
26
+ address1
27
+ address2
28
+ city
29
+ zoneCode
30
+ zip
31
+ territoryCode
32
+ phoneNumber
33
+ }
34
+ }
35
+ }
36
+ `
37
+
38
+ export type CustomerProfile = {
39
+ id: string
40
+ firstName: string | null
41
+ lastName: string | null
42
+ emailAddress: { emailAddress: string } | null
43
+ phoneNumber: { phoneNumber: string } | null
44
+ defaultAddress: CustomerAddress | null
45
+ }
46
+
47
+ export type CustomerQueryResult = { customer: CustomerProfile }
48
+
49
+ export type CustomerAddress = {
50
+ id: string
51
+ firstName: string | null
52
+ lastName: string | null
53
+ address1: string | null
54
+ address2: string | null
55
+ city: string | null
56
+ zoneCode: string | null
57
+ zip: string | null
58
+ territoryCode: string | null
59
+ phoneNumber: string | null
60
+ }
61
+
62
+ export const CUSTOMER_ADDRESSES_QUERY = /* GraphQL */ `
63
+ query CustomerAddresses($first: Int!) {
64
+ customer {
65
+ addresses(first: $first) {
66
+ nodes {
67
+ id
68
+ firstName
69
+ lastName
70
+ address1
71
+ address2
72
+ city
73
+ zoneCode
74
+ zip
75
+ territoryCode
76
+ phoneNumber
77
+ }
78
+ }
79
+ defaultAddress {
80
+ id
81
+ }
82
+ }
83
+ }
84
+ `
85
+
86
+ export type CustomerAddressesQueryResult = {
87
+ customer: {
88
+ addresses: { nodes: Array<CustomerAddress> }
89
+ defaultAddress: { id: string } | null
90
+ }
91
+ }
92
+
93
+ export const ORDERS_QUERY = /* GraphQL */ `
94
+ query CustomerOrders($first: Int!, $after: String) {
95
+ customer {
96
+ orders(first: $first, after: $after, sortKey: PROCESSED_AT, reverse: true) {
97
+ nodes {
98
+ id
99
+ name
100
+ processedAt
101
+ financialStatus
102
+ fulfillmentStatus
103
+ totalPrice {
104
+ amount
105
+ currencyCode
106
+ }
107
+ }
108
+ pageInfo {
109
+ hasNextPage
110
+ endCursor
111
+ }
112
+ }
113
+ }
114
+ }
115
+ `
116
+
117
+ export type OrderListItem = {
118
+ id: string
119
+ name: string
120
+ processedAt: string
121
+ financialStatus: string | null
122
+ fulfillmentStatus: string | null
123
+ totalPrice: { amount: string; currencyCode: string }
124
+ }
125
+
126
+ export type OrdersQueryResult = {
127
+ customer: {
128
+ orders: {
129
+ nodes: Array<OrderListItem>
130
+ pageInfo: { hasNextPage: boolean; endCursor: string | null }
131
+ }
132
+ }
133
+ }
134
+
135
+ export const ORDER_QUERY = /* GraphQL */ `
136
+ query Order($id: ID!) {
137
+ order(id: $id) {
138
+ id
139
+ name
140
+ processedAt
141
+ financialStatus
142
+ fulfillmentStatus
143
+ totalPrice {
144
+ amount
145
+ currencyCode
146
+ }
147
+ subtotal {
148
+ amount
149
+ currencyCode
150
+ }
151
+ totalShipping {
152
+ amount
153
+ currencyCode
154
+ }
155
+ totalTax {
156
+ amount
157
+ currencyCode
158
+ }
159
+ shippingAddress {
160
+ firstName
161
+ lastName
162
+ address1
163
+ address2
164
+ city
165
+ zoneCode
166
+ zip
167
+ territoryCode
168
+ }
169
+ lineItems(first: 50) {
170
+ nodes {
171
+ id
172
+ title
173
+ quantity
174
+ variantTitle
175
+ price {
176
+ amount
177
+ currencyCode
178
+ }
179
+ image {
180
+ url
181
+ altText
182
+ width
183
+ height
184
+ }
185
+ }
186
+ }
187
+ }
188
+ }
189
+ `
190
+
191
+ export type OrderDetailLine = {
192
+ id: string
193
+ title: string
194
+ quantity: number
195
+ variantTitle: string | null
196
+ price: { amount: string; currencyCode: string }
197
+ image: {
198
+ url: string
199
+ altText: string | null
200
+ width: number | null
201
+ height: number | null
202
+ } | null
203
+ }
204
+
205
+ export type OrderDetail = {
206
+ id: string
207
+ name: string
208
+ processedAt: string
209
+ financialStatus: string | null
210
+ fulfillmentStatus: string | null
211
+ totalPrice: { amount: string; currencyCode: string }
212
+ subtotal: { amount: string; currencyCode: string } | null
213
+ totalShipping: { amount: string; currencyCode: string } | null
214
+ totalTax: { amount: string; currencyCode: string } | null
215
+ shippingAddress: {
216
+ firstName: string | null
217
+ lastName: string | null
218
+ address1: string | null
219
+ address2: string | null
220
+ city: string | null
221
+ zoneCode: string | null
222
+ zip: string | null
223
+ territoryCode: string | null
224
+ } | null
225
+ lineItems: { nodes: Array<OrderDetailLine> }
226
+ }
227
+
228
+ export type OrderQueryResult = { order: OrderDetail | null }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Browser-safe formatting helpers for Shopify Storefront API responses.
3
+ * Framework-free — no React, no provider context required.
4
+ */
5
+
6
+ export function formatMoney(amount: string | number, currencyCode: string) {
7
+ return new Intl.NumberFormat(undefined, {
8
+ style: 'currency',
9
+ currency: currencyCode,
10
+ minimumFractionDigits: 0,
11
+ maximumFractionDigits: 0,
12
+ }).format(typeof amount === 'string' ? Number(amount) : amount)
13
+ }
14
+
15
+ type ShopifyImageOptions = {
16
+ width?: number
17
+ height?: number
18
+ format?: 'webp' | 'jpg' | 'png'
19
+ crop?: 'center' | 'top' | 'bottom' | 'left' | 'right'
20
+ }
21
+
22
+ /**
23
+ * Append Shopify CDN transform parameters to a product image URL.
24
+ * Shopify's CDN serves resized/reformatted versions automatically.
25
+ */
26
+ export function shopifyImageUrl(url: string, opts: ShopifyImageOptions = {}) {
27
+ const u = new URL(url)
28
+ if (opts.width) u.searchParams.set('width', String(opts.width))
29
+ if (opts.height) u.searchParams.set('height', String(opts.height))
30
+ if (opts.format) u.searchParams.set('format', opts.format)
31
+ if (opts.crop) u.searchParams.set('crop', opts.crop)
32
+ return u.toString()
33
+ }