@vendure-platform/create 0.5.1 → 1.0.0-major.202609091053.0.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 (172) hide show
  1. package/README.md +48 -36
  2. package/dist/add-to-existing.d.ts +19 -13
  3. package/dist/add-to-existing.js +1 -1
  4. package/dist/assets/demo-data/assets/branding/logo.svg +4 -0
  5. package/dist/assets/demo-data/assets/images/absorbent-pad.webp +0 -0
  6. package/dist/assets/demo-data/assets/images/adjustable-wrench.webp +0 -0
  7. package/dist/assets/demo-data/assets/images/anchor-bolt.webp +0 -0
  8. package/dist/assets/demo-data/assets/images/angle-grinder.webp +0 -0
  9. package/dist/assets/demo-data/assets/images/barrier-tape.webp +0 -0
  10. package/dist/assets/demo-data/assets/images/bench-grinder.webp +0 -0
  11. package/dist/assets/demo-data/assets/images/bracket.webp +0 -0
  12. package/dist/assets/demo-data/assets/images/broom.webp +0 -0
  13. package/dist/assets/demo-data/assets/images/bucket.webp +0 -0
  14. package/dist/assets/demo-data/assets/images/cable-gland.webp +0 -0
  15. package/dist/assets/demo-data/assets/images/cable-tie.webp +0 -0
  16. package/dist/assets/demo-data/assets/images/cable-tray.webp +0 -0
  17. package/dist/assets/demo-data/assets/images/cable.webp +0 -0
  18. package/dist/assets/demo-data/assets/images/chimney-base-kit.webp +0 -0
  19. package/dist/assets/demo-data/assets/images/chimney-cowl-bird-guard.webp +0 -0
  20. package/dist/assets/demo-data/assets/images/chimney-cowl-open.webp +0 -0
  21. package/dist/assets/demo-data/assets/images/chimney-storm-collar.webp +0 -0
  22. package/dist/assets/demo-data/assets/images/chimney-wall-bracket.webp +0 -0
  23. package/dist/assets/demo-data/assets/images/circular-saw.webp +0 -0
  24. package/dist/assets/demo-data/assets/images/cleaning-spray.webp +0 -0
  25. package/dist/assets/demo-data/assets/images/conduit.webp +0 -0
  26. package/dist/assets/demo-data/assets/images/cordless-drill.webp +0 -0
  27. package/dist/assets/demo-data/assets/images/drill-bits.webp +0 -0
  28. package/dist/assets/demo-data/assets/images/dust-mask.webp +0 -0
  29. package/dist/assets/demo-data/assets/images/ear-defenders.webp +0 -0
  30. package/dist/assets/demo-data/assets/images/ear-plugs.webp +0 -0
  31. package/dist/assets/demo-data/assets/images/extension-lead.webp +0 -0
  32. package/dist/assets/demo-data/assets/images/eye-wash-station.webp +0 -0
  33. package/dist/assets/demo-data/assets/images/face-shield.webp +0 -0
  34. package/dist/assets/demo-data/assets/images/file-set.webp +0 -0
  35. package/dist/assets/demo-data/assets/images/first-aid-kit.webp +0 -0
  36. package/dist/assets/demo-data/assets/images/floor-sign.webp +0 -0
  37. package/dist/assets/demo-data/assets/images/flue-bend-45.webp +0 -0
  38. package/dist/assets/demo-data/assets/images/flue-bend-90.webp +0 -0
  39. package/dist/assets/demo-data/assets/images/flue-section-1000mm.webp +0 -0
  40. package/dist/assets/demo-data/assets/images/flue-section-250mm.webp +0 -0
  41. package/dist/assets/demo-data/assets/images/flue-section-500mm.webp +0 -0
  42. package/dist/assets/demo-data/assets/images/fuse.webp +0 -0
  43. package/dist/assets/demo-data/assets/images/glove-dispenser.webp +0 -0
  44. package/dist/assets/demo-data/assets/images/grinding-disc.webp +0 -0
  45. package/dist/assets/demo-data/assets/images/hacksaw.webp +0 -0
  46. package/dist/assets/demo-data/assets/images/hammer.webp +0 -0
  47. package/dist/assets/demo-data/assets/images/hand-sanitiser.webp +0 -0
  48. package/dist/assets/demo-data/assets/images/head-torch.webp +0 -0
  49. package/dist/assets/demo-data/assets/images/heat-gun.webp +0 -0
  50. package/dist/assets/demo-data/assets/images/hex-bolt.webp +0 -0
  51. package/dist/assets/demo-data/assets/images/hex-key-set.webp +0 -0
  52. package/dist/assets/demo-data/assets/images/hex-nut.webp +0 -0
  53. package/dist/assets/demo-data/assets/images/hi-vis-jacket.webp +0 -0
  54. package/dist/assets/demo-data/assets/images/hi-vis-vest.webp +0 -0
  55. package/dist/assets/demo-data/assets/images/hose-clamp.webp +0 -0
  56. package/dist/assets/demo-data/assets/images/impact-driver.webp +0 -0
  57. package/dist/assets/demo-data/assets/images/jigsaw.webp +0 -0
  58. package/dist/assets/demo-data/assets/images/junction-box.webp +0 -0
  59. package/dist/assets/demo-data/assets/images/knee-pads.webp +0 -0
  60. package/dist/assets/demo-data/assets/images/machine-screw.webp +0 -0
  61. package/dist/assets/demo-data/assets/images/made-to-order-configurable-chimney.webp +0 -0
  62. package/dist/assets/demo-data/assets/images/mallet.webp +0 -0
  63. package/dist/assets/demo-data/assets/images/mcb.webp +0 -0
  64. package/dist/assets/demo-data/assets/images/mop.webp +0 -0
  65. package/dist/assets/demo-data/assets/images/paper-towels.webp +0 -0
  66. package/dist/assets/demo-data/assets/images/pipe-wrench.webp +0 -0
  67. package/dist/assets/demo-data/assets/images/pliers-set.webp +0 -0
  68. package/dist/assets/demo-data/assets/images/pry-bar.webp +0 -0
  69. package/dist/assets/demo-data/assets/images/rcd.webp +0 -0
  70. package/dist/assets/demo-data/assets/images/reciprocating-saw.webp +0 -0
  71. package/dist/assets/demo-data/assets/images/rivet.webp +0 -0
  72. package/dist/assets/demo-data/assets/images/roof-flashing-high-pitch.webp +0 -0
  73. package/dist/assets/demo-data/assets/images/roof-flashing-low-pitch.webp +0 -0
  74. package/dist/assets/demo-data/assets/images/safety-boots.webp +0 -0
  75. package/dist/assets/demo-data/assets/images/safety-glasses.webp +0 -0
  76. package/dist/assets/demo-data/assets/images/safety-harness.webp +0 -0
  77. package/dist/assets/demo-data/assets/images/safety-helmet.webp +0 -0
  78. package/dist/assets/demo-data/assets/images/safety-sign.webp +0 -0
  79. package/dist/assets/demo-data/assets/images/sanding-disc.webp +0 -0
  80. package/dist/assets/demo-data/assets/images/saw-blade.webp +0 -0
  81. package/dist/assets/demo-data/assets/images/screwdriver-set.webp +0 -0
  82. package/dist/assets/demo-data/assets/images/screwdriver.webp +0 -0
  83. package/dist/assets/demo-data/assets/images/self-tapping-screw.webp +0 -0
  84. package/dist/assets/demo-data/assets/images/socket-set.webp +0 -0
  85. package/dist/assets/demo-data/assets/images/socket.webp +0 -0
  86. package/dist/assets/demo-data/assets/images/spanner-set.webp +0 -0
  87. package/dist/assets/demo-data/assets/images/spanner.webp +0 -0
  88. package/dist/assets/demo-data/assets/images/spill-kit.webp +0 -0
  89. package/dist/assets/demo-data/assets/images/spirit-level.webp +0 -0
  90. package/dist/assets/demo-data/assets/images/switch.webp +0 -0
  91. package/dist/assets/demo-data/assets/images/tape-measure.webp +0 -0
  92. package/dist/assets/demo-data/assets/images/terminal-block.webp +0 -0
  93. package/dist/assets/demo-data/assets/images/threaded-rod.webp +0 -0
  94. package/dist/assets/demo-data/assets/images/torque-wrench.webp +0 -0
  95. package/dist/assets/demo-data/assets/images/utility-knife.webp +0 -0
  96. package/dist/assets/demo-data/assets/images/wall-pass-sleeve.webp +0 -0
  97. package/dist/assets/demo-data/assets/images/wall-plug.webp +0 -0
  98. package/dist/assets/demo-data/assets/images/washer.webp +0 -0
  99. package/dist/assets/demo-data/assets/images/waste-bin.webp +0 -0
  100. package/dist/assets/demo-data/assets/images/wire-connector.webp +0 -0
  101. package/dist/assets/demo-data/assets/images/wire-cutters.webp +0 -0
  102. package/dist/assets/demo-data/assets/images/wood-screw.webp +0 -0
  103. package/dist/assets/demo-data/assets/images/work-gloves.webp +0 -0
  104. package/dist/assets/demo-data/assets/images/work-light.webp +0 -0
  105. package/dist/assets/demo-data/assets/initial-data.json +667 -0
  106. package/dist/assets/demo-data/assets/products.csv +779 -0
  107. package/dist/assets/storefront/next-env.d.ts +2 -1
  108. package/dist/assets/storefront/next.config.ts +14 -13
  109. package/dist/assets/storefront/package.json +3 -2
  110. package/dist/assets/storefront/src/app/[locale]/account/addresses/page.tsx +2 -0
  111. package/dist/assets/storefront/src/app/[locale]/account/approvals/page.tsx +2 -0
  112. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/page.tsx +2 -0
  113. package/dist/assets/storefront/src/app/[locale]/account/company/page.tsx +2 -0
  114. package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/page.tsx +2 -0
  115. package/dist/assets/storefront/src/app/[locale]/account/company/roles/page.tsx +2 -0
  116. package/dist/assets/storefront/src/app/[locale]/account/company/users/page.tsx +2 -0
  117. package/dist/assets/storefront/src/app/[locale]/account/profile/page.tsx +2 -0
  118. package/dist/assets/storefront/src/app/[locale]/account/quick-order/page.tsx +2 -0
  119. package/dist/assets/storefront/src/app/[locale]/account/quotes/[id]/page.tsx +10 -6
  120. package/dist/assets/storefront/src/app/[locale]/cart/order-summary.tsx +8 -5
  121. package/dist/assets/storefront/src/app/[locale]/cart/promotion-code.tsx +9 -6
  122. package/dist/assets/storefront/src/app/[locale]/checkout/page.tsx +2 -0
  123. package/dist/assets/storefront/src/app/[locale]/layout.tsx +3 -3
  124. package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/order-confirmation.tsx +2 -60
  125. package/dist/assets/storefront/src/components/commerce/product-card-list.tsx +4 -2
  126. package/dist/assets/storefront/src/components/commerce/product-card.tsx +4 -2
  127. package/dist/assets/storefront/src/components/commerce/quote-action-buttons.tsx +31 -14
  128. package/dist/assets/storefront/src/config/capabilities.ts +41 -0
  129. package/dist/assets/storefront/src/config/scenario.ts +10 -0
  130. package/dist/assets/storefront/src/graphql-env.d.ts +47 -41
  131. package/dist/assets/storefront/src/i18n/server.ts +33 -5
  132. package/dist/assets/storefront/src/lib/backend-health.ts +11 -3
  133. package/dist/assets/storefront/src/lib/vendure/capability-documents.ts +246 -0
  134. package/dist/assets/storefront/src/lib/vendure/capability-schema.ts +358 -0
  135. package/dist/assets/storefront/src/lib/vendure/capability-ui.ts +15 -0
  136. package/dist/assets/storefront/src/lib/vendure/mutations.ts +835 -532
  137. package/dist/assets/storefront/src/lib/vendure/queries.ts +862 -519
  138. package/dist/assets/storefront/src/proxy.ts +11 -0
  139. package/dist/assets/storefront/src/schema.graphql +337 -243
  140. package/dist/assets/templates/README.md.hbs +25 -1
  141. package/dist/assets/templates/docker-compose.yml.hbs +4 -0
  142. package/dist/assets/templates/env.hbs +34 -9
  143. package/dist/assets/templates/environment.d.ts.hbs +1 -0
  144. package/dist/assets/templates/gitignore.hbs +7 -4
  145. package/dist/assets/templates/migrate.ts.hbs +55 -0
  146. package/dist/assets/templates/npmrc.hbs +7 -2
  147. package/dist/assets/templates/platform-edition.ts.hbs +21 -0
  148. package/dist/assets/templates/server-package.json.hbs +15 -8
  149. package/dist/assets/templates/vendure-config.ts.hbs +18 -0
  150. package/dist/bin/run.js +1 -1
  151. package/dist/cli.js +1 -1
  152. package/dist/console-onboarding.d.ts +44 -0
  153. package/dist/console-onboarding.js +1 -0
  154. package/dist/hub-projects.d.ts +48 -0
  155. package/dist/hub-projects.js +1 -0
  156. package/dist/index.d.ts +1 -1
  157. package/dist/index.js +1 -1
  158. package/dist/plugin-registry.d.ts +61 -2
  159. package/dist/plugin-registry.js +1 -1
  160. package/dist/registry.d.ts +16 -13
  161. package/dist/registry.js +1 -1
  162. package/dist/scaffold-shared.js +1 -1
  163. package/dist/scaffold-storefront-only.js +1 -1
  164. package/dist/scaffolder.d.ts +11 -0
  165. package/dist/scaffolder.js +1 -1
  166. package/dist/storefront-copier.d.ts +7 -2
  167. package/dist/storefront-copier.js +1 -1
  168. package/dist/template-renderer.d.ts +26 -5
  169. package/dist/template-renderer.js +1 -1
  170. package/dist/types.d.ts +54 -23
  171. package/package.json +14 -2
  172. package/dist/assets/storefront/src/middleware.ts +0 -11
@@ -1,5 +1,6 @@
1
1
  import { graphql, type ResultOf } from '@/graphql';
2
2
  import type { VendureResponse } from '@vendure-platform/storefront-client';
3
+ import { composeCapabilityDocument, forCapability } from './capability-documents';
3
4
  import {
4
5
  ActiveCustomerFragment,
5
6
  CompanyAddressFragment,
@@ -72,119 +73,162 @@ export const GetActiveCustomerQuery = graphql(
72
73
  [ActiveCustomerFragment],
73
74
  );
74
75
 
75
- export const SearchProductsQuery = graphql(
76
- `
77
- query SearchProducts($input: SearchInput!) {
78
- search(input: $input) {
79
- queryId
80
- totalItems
81
- items {
82
- ...ProductCard
83
- }
84
- facets {
85
- facet {
86
- id
87
- code
88
- name
76
+ export const SearchProductsQuery = composeCapabilityDocument(
77
+ graphql(
78
+ `
79
+ query SearchProducts($input: SearchInput!) {
80
+ search(input: $input) {
81
+ queryId
82
+ totalItems
83
+ items {
84
+ ...ProductCard
89
85
  }
90
- facetValueCounts {
91
- count
92
- facetValue {
86
+ facets {
87
+ facet {
93
88
  id
94
89
  code
95
90
  name
96
91
  }
92
+ facetValueCounts {
93
+ count
94
+ facetValue {
95
+ id
96
+ code
97
+ name
98
+ }
99
+ }
97
100
  }
98
- }
99
- prices {
100
- range {
101
- min
102
- max
103
- }
104
- rangeWithTax {
105
- min
106
- max
101
+ prices {
102
+ range {
103
+ min
104
+ max
105
+ }
106
+ rangeWithTax {
107
+ min
108
+ max
109
+ }
107
110
  }
108
111
  }
109
112
  }
110
- }
111
- `,
112
- [ProductCardFragment],
113
+ `,
114
+ [ProductCardFragment],
115
+ ),
116
+ [
117
+ {
118
+ capability: 'search.foundation',
119
+ paths: [['highlights']],
120
+ },
121
+ {
122
+ capability: 'search.analytics.clickhouse',
123
+ paths: [['search', 'queryId']],
124
+ },
125
+ ],
113
126
  );
114
127
 
115
- export const GetActiveUserShoppingListQuery = graphql(
116
- `
117
- query GetActiveUserShoppingList($id: ID) {
118
- activeUserShoppingList(id: $id) {
119
- ...ShoppingListFields
120
- items {
128
+ export const GetActiveUserShoppingListQuery = composeCapabilityDocument(
129
+ graphql(
130
+ `
131
+ query GetActiveUserShoppingList($id: ID) {
132
+ activeUserShoppingList(id: $id) {
133
+ ...ShoppingListFields
121
134
  items {
122
- ...ShoppingListItemFields
135
+ items {
136
+ ...ShoppingListItemFields
137
+ }
138
+ totalItems
123
139
  }
124
- totalItems
125
140
  }
126
141
  }
127
- }
128
- `,
129
- [ShoppingListFragment, ShoppingListItemFragment],
142
+ `,
143
+ [ShoppingListFragment, ShoppingListItemFragment],
144
+ ),
145
+ [
146
+ { capability: 'shopping-list.personal', paths: [['activeUserShoppingList']] },
147
+ {
148
+ capability: 'shopping-list.managed',
149
+ paths: [['isPublic'], ['publicCode'], ['customer'], ['purchased'], ['lastPurchasedAt']],
150
+ },
151
+ ],
130
152
  );
131
153
 
132
- export const GetActiveUserShoppingListsQuery = graphql(
133
- `
134
- query GetActiveUserShoppingLists {
135
- activeUserShoppingLists {
136
- ...ShoppingListFields
137
- items {
138
- totalItems
154
+ export const GetActiveUserShoppingListsQuery = composeCapabilityDocument(
155
+ graphql(
156
+ `
157
+ query GetActiveUserShoppingLists {
158
+ activeUserShoppingLists {
159
+ ...ShoppingListFields
160
+ items {
161
+ totalItems
162
+ }
139
163
  }
140
164
  }
141
- }
142
- `,
143
- [ShoppingListFragment],
165
+ `,
166
+ [ShoppingListFragment],
167
+ ),
168
+ [
169
+ { capability: 'shopping-list.personal', paths: [['activeUserShoppingLists']] },
170
+ {
171
+ capability: 'shopping-list.managed',
172
+ paths: [['isPublic'], ['publicCode'], ['customer']],
173
+ },
174
+ ],
144
175
  );
145
176
 
146
- export const GetShoppingListsWithItemVariantsQuery = graphql(`
147
- query GetShoppingListsWithItemVariants {
148
- activeCustomer {
149
- id
150
- }
151
- activeUserShoppingLists {
152
- id
153
- name
154
- isDefault
155
- customer {
177
+ export const GetShoppingListsWithItemVariantsQuery = composeCapabilityDocument(
178
+ graphql(`
179
+ query GetShoppingListsWithItemVariants {
180
+ activeCustomer {
156
181
  id
157
182
  }
158
- items(options: { take: 100 }) {
159
- items {
183
+ activeUserShoppingLists {
184
+ id
185
+ name
186
+ isDefault
187
+ customer {
160
188
  id
161
- productVariantId
189
+ }
190
+ items(options: { take: 100 }) {
191
+ items {
192
+ id
193
+ productVariantId
194
+ }
162
195
  }
163
196
  }
164
197
  }
165
- }
166
- `);
198
+ `),
199
+ [
200
+ { capability: 'shopping-list.personal', paths: [['activeUserShoppingLists']] },
201
+ {
202
+ capability: 'shopping-list.managed',
203
+ paths: [['activeUserShoppingLists', 'customer']],
204
+ },
205
+ ],
206
+ );
167
207
 
168
- export const GetPublicShoppingListQuery = graphql(
169
- `
170
- query GetPublicShoppingList($publicCode: String!) {
171
- publicShoppingList(publicCode: $publicCode) {
172
- ...ShoppingListFields
173
- items {
208
+ export const GetPublicShoppingListQuery = forCapability(
209
+ 'shopping-list.managed',
210
+ graphql(
211
+ `
212
+ query GetPublicShoppingList($publicCode: String!) {
213
+ publicShoppingList(publicCode: $publicCode) {
214
+ ...ShoppingListFields
174
215
  items {
175
- ...ShoppingListItemFields
216
+ items {
217
+ ...ShoppingListItemFields
218
+ }
219
+ totalItems
176
220
  }
177
- totalItems
178
221
  }
179
222
  }
180
- }
181
- `,
182
- [ShoppingListFragment, ShoppingListItemFragment],
223
+ `,
224
+ [ShoppingListFragment, ShoppingListItemFragment],
225
+ ),
226
+ [['publicShoppingList']],
183
227
  );
184
228
 
185
229
  export type SearchProductsResult = Promise<VendureResponse<ResultOf<typeof SearchProductsQuery>>>;
186
230
 
187
- export const GetProductDetailQuery = graphql(`
231
+ const GetProductDetailDocument = graphql(`
188
232
  query GetProductDetail($slug: String!) {
189
233
  product(slug: $slug) {
190
234
  id
@@ -273,23 +317,48 @@ export const GetProductDetailQuery = graphql(`
273
317
  }
274
318
  `);
275
319
 
320
+ /**
321
+ * `Product.customFields.configuratorSystemCode` is registered by
322
+ * `configurator.forms`, so it is absent from the schema of a deployment
323
+ * without that grant.
324
+ */
325
+ export const GetProductDetailQuery = composeCapabilityDocument(GetProductDetailDocument, [
326
+ {
327
+ capability: 'pricing.contract',
328
+ paths: [
329
+ ['product', 'variants', 'priceTiers'],
330
+ ['product', 'variants', 'packagingUnits', 'priceTiers'],
331
+ ],
332
+ },
333
+ { capability: 'packaging-units', paths: [['product', 'variants', 'packagingUnits']] },
334
+ { capability: 'store-credit.gift-cards', paths: [['product', 'customFields', 'isGiftCard']] },
335
+ {
336
+ capability: 'configurator.forms',
337
+ paths: [['product', 'customFields', 'configuratorSystemCode']],
338
+ },
339
+ ]);
340
+
276
341
  /** The full product object returned by GetProductDetailQuery. */
277
342
  export type ProductDetail = NonNullable<ResultOf<typeof GetProductDetailQuery>['product']>;
278
343
 
279
344
  /** A packaging unit option on a product variant. */
280
345
  export type PackagingUnitOption = NonNullable<ProductDetail['variants'][number]['packagingUnits']>[number];
281
346
 
282
- export const GetDraftVariantQuery = graphql(`
283
- query GetDraftVariant($id: ID!) {
284
- contentVersioningProductVariant(id: $id) {
285
- id
286
- name
287
- sku
347
+ export const GetDraftVariantQuery = forCapability(
348
+ 'content.history',
349
+ graphql(`
350
+ query GetDraftVariant($id: ID!) {
351
+ contentVersioningProductVariant(id: $id) {
352
+ id
353
+ name
354
+ sku
355
+ }
288
356
  }
289
- }
290
- `);
357
+ `),
358
+ [['contentVersioningProductVariant']],
359
+ );
291
360
 
292
- export const GetActiveOrderQuery = graphql(`
361
+ const GetActiveOrderDocument = graphql(`
293
362
  query GetActiveOrder {
294
363
  activeOrder {
295
364
  id
@@ -380,12 +449,42 @@ export const GetActiveOrderQuery = graphql(`
380
449
  }
381
450
  `);
382
451
 
452
+ /**
453
+ * Configurator order-line links are absent from the schema without the
454
+ * `configurator.forms` grant.
455
+ */
456
+ export const GetActiveOrderQuery = composeCapabilityDocument(GetActiveOrderDocument, [
457
+ {
458
+ capability: 'store-credit.balance',
459
+ paths: [
460
+ ['activeOrder', 'storeCreditsApplied'],
461
+ ['activeOrder', 'totalWithTaxAfterStoreCredit'],
462
+ ],
463
+ },
464
+ { capability: 'store-credit.gift-cards', paths: [['activeOrder', 'lines', 'giftCardInput']] },
465
+ {
466
+ capability: 'packaging-units',
467
+ paths: [
468
+ ['activeOrder', 'lines', 'customFields', 'packagingUnit'],
469
+ ['activeOrder', 'lines', 'customFields', 'packagingUnitConversionFactor'],
470
+ ],
471
+ },
472
+ {
473
+ capability: 'configurator.forms',
474
+ paths: [
475
+ ['activeOrder', 'lines', 'customFields', 'productConfiguration'],
476
+ ['activeOrder', 'lines', 'customFields', 'productConfigurationLine'],
477
+ ],
478
+ },
479
+ { capability: 'quote.requests', paths: [['activeOrder', 'customFields', 'sourceQuoteId']] },
480
+ ]);
481
+
383
482
  /** A store credit applied to the active order. */
384
483
  export type StoreCredit = NonNullable<
385
484
  ResultOf<typeof GetActiveOrderQuery>['activeOrder']
386
485
  >['storeCreditsApplied'][number];
387
486
 
388
- export const GetActiveOrderForCheckoutQuery = graphql(`
487
+ const GetActiveOrderForCheckoutDocument = graphql(`
389
488
  query GetActiveOrderForCheckout {
390
489
  activeOrder {
391
490
  id
@@ -482,6 +581,17 @@ export const GetActiveOrderForCheckoutQuery = graphql(`
482
581
  }
483
582
  `);
484
583
 
584
+ export const GetActiveOrderForCheckoutQuery = composeCapabilityDocument(GetActiveOrderForCheckoutDocument, [
585
+ {
586
+ capability: 'store-credit.balance',
587
+ paths: [
588
+ ['activeOrder', 'storeCreditsApplied'],
589
+ ['activeOrder', 'totalWithTaxAfterStoreCredit'],
590
+ ],
591
+ },
592
+ { capability: 'quote.requests', paths: [['activeOrder', 'customFields', 'sourceQuoteId']] },
593
+ ]);
594
+
485
595
  export const GetCustomerAddressesQuery = graphql(`
486
596
  query GetCustomerAddresses {
487
597
  activeCustomer {
@@ -609,7 +719,7 @@ export const GetOrderSummaryQuery = graphql(`
609
719
  }
610
720
  `);
611
721
 
612
- export const GetOrderDetailQuery = graphql(`
722
+ const GetOrderDetailDocument = graphql(`
613
723
  query GetOrderDetail($code: String!) {
614
724
  orderByCode(code: $code) {
615
725
  id
@@ -728,22 +838,134 @@ export const GetOrderDetailQuery = graphql(`
728
838
  }
729
839
  `);
730
840
 
731
- export const GetMyApprovalRequestsQuery = graphql(`
732
- query GetMyApprovalRequests($options: ApprovalRequestListOptions) {
733
- myApprovalRequests(options: $options) {
734
- totalItems
735
- items {
841
+ export const GetOrderDetailQuery = composeCapabilityDocument(GetOrderDetailDocument, [
842
+ {
843
+ capability: 'store-credit.balance',
844
+ paths: [
845
+ ['orderByCode', 'storeCreditsApplied'],
846
+ ['orderByCode', 'totalWithTaxAfterStoreCredit'],
847
+ ],
848
+ },
849
+ { capability: 'store-credit.gift-cards', paths: [['orderByCode', 'lines', 'giftCardInput']] },
850
+ ]);
851
+
852
+ const GetOrderByCodeForConfirmationDocument = graphql(`
853
+ query GetOrderByCodeForConfirmation($code: String!) {
854
+ orderByCode(code: $code) {
855
+ id
856
+ code
857
+ state
858
+ subTotal
859
+ subTotalWithTax
860
+ shipping
861
+ shippingWithTax
862
+ total
863
+ totalWithTax
864
+ currencyCode
865
+ storeCreditsApplied {
866
+ code
867
+ balance
868
+ amountDeducted
869
+ }
870
+ totalWithTaxAfterStoreCredit
871
+ payments {
872
+ id
873
+ method
874
+ amount
875
+ state
876
+ metadata
877
+ }
878
+ lines {
879
+ id
880
+ productVariant {
881
+ id
882
+ name
883
+ product {
884
+ id
885
+ name
886
+ slug
887
+ featuredAsset {
888
+ id
889
+ preview
890
+ }
891
+ }
892
+ }
893
+ quantity
894
+ linePrice
895
+ linePriceWithTax
896
+ }
897
+ shippingAddress {
898
+ fullName
899
+ streetLine1
900
+ streetLine2
901
+ city
902
+ province
903
+ postalCode
904
+ country
905
+ }
906
+ }
907
+ }
908
+ `);
909
+
910
+ export const GetOrderByCodeForConfirmationQuery = composeCapabilityDocument(
911
+ GetOrderByCodeForConfirmationDocument,
912
+ [
913
+ {
914
+ capability: 'store-credit.balance',
915
+ paths: [
916
+ ['orderByCode', 'storeCreditsApplied'],
917
+ ['orderByCode', 'totalWithTaxAfterStoreCredit'],
918
+ ],
919
+ },
920
+ ],
921
+ );
922
+
923
+ export const GetMyApprovalRequestsQuery = forCapability(
924
+ 'approval.orders',
925
+ graphql(`
926
+ query GetMyApprovalRequests($options: ApprovalRequestListOptions) {
927
+ myApprovalRequests(options: $options) {
928
+ totalItems
929
+ items {
930
+ id
931
+ createdAt
932
+ entityType
933
+ entityId
934
+ status
935
+ summary
936
+ requestedByCustomer {
937
+ id
938
+ firstName
939
+ lastName
940
+ }
941
+ decisions {
942
+ id
943
+ level
944
+ decision
945
+ comment
946
+ decidedAt
947
+ customer {
948
+ id
949
+ firstName
950
+ lastName
951
+ }
952
+ }
953
+ }
954
+ }
955
+ }
956
+ `),
957
+ [['myApprovalRequests']],
958
+ );
959
+
960
+ export const GetApprovalHistoryForEntityQuery = forCapability(
961
+ 'approval.orders',
962
+ graphql(`
963
+ query GetApprovalHistoryForEntity($entityType: String!, $entityId: ID!) {
964
+ approvalHistoryForEntity(entityType: $entityType, entityId: $entityId) {
736
965
  id
737
966
  createdAt
738
- entityType
739
- entityId
740
967
  status
741
968
  summary
742
- requestedByCustomer {
743
- id
744
- firstName
745
- lastName
746
- }
747
969
  decisions {
748
970
  id
749
971
  level
@@ -758,52 +980,34 @@ export const GetMyApprovalRequestsQuery = graphql(`
758
980
  }
759
981
  }
760
982
  }
761
- }
762
- `);
763
-
764
- export const GetApprovalHistoryForEntityQuery = graphql(`
765
- query GetApprovalHistoryForEntity($entityType: String!, $entityId: ID!) {
766
- approvalHistoryForEntity(entityType: $entityType, entityId: $entityId) {
767
- id
768
- createdAt
769
- status
770
- summary
771
- decisions {
772
- id
773
- level
774
- decision
775
- comment
776
- decidedAt
777
- customer {
778
- id
779
- firstName
780
- lastName
781
- }
782
- }
783
- }
784
- }
785
- `);
983
+ `),
984
+ [['approvalHistoryForEntity']],
985
+ );
786
986
 
787
- export const GetCompanyOrdersQuery = graphql(`
788
- query GetCompanyOrders($options: OrderListOptions) {
789
- companyOrders(options: $options) {
790
- totalItems
791
- items {
792
- id
793
- code
794
- createdAt
795
- state
796
- totalWithTax
797
- currencyCode
798
- customer {
987
+ export const GetCompanyOrdersQuery = forCapability(
988
+ 'org.accounts',
989
+ graphql(`
990
+ query GetCompanyOrders($options: OrderListOptions) {
991
+ companyOrders(options: $options) {
992
+ totalItems
993
+ items {
799
994
  id
800
- firstName
801
- lastName
995
+ code
996
+ createdAt
997
+ state
998
+ totalWithTax
999
+ currencyCode
1000
+ customer {
1001
+ id
1002
+ firstName
1003
+ lastName
1004
+ }
802
1005
  }
803
1006
  }
804
1007
  }
805
- }
806
- `);
1008
+ `),
1009
+ [['companyOrders']],
1010
+ );
807
1011
 
808
1012
  export const GetActiveChannelQuery = graphql(`
809
1013
  query GetActiveChannel {
@@ -818,168 +1022,221 @@ export const GetActiveChannelQuery = graphql(`
818
1022
  }
819
1023
  `);
820
1024
 
821
- export const GetCollectionProductsQuery = graphql(
822
- `
823
- query GetCollectionProducts($slug: String!, $input: SearchInput!) {
824
- collection(slug: $slug) {
825
- id
826
- name
827
- slug
828
- description
829
- featuredAsset {
830
- id
831
- preview
832
- }
833
- breadcrumbs {
834
- id
835
- name
836
- slug
837
- }
838
- children {
1025
+ export const GetCollectionProductsQuery = forCapability(
1026
+ 'search.foundation',
1027
+ graphql(
1028
+ `
1029
+ query GetCollectionProducts($slug: String!, $input: SearchInput!) {
1030
+ collection(slug: $slug) {
839
1031
  id
840
1032
  name
841
1033
  slug
1034
+ description
842
1035
  featuredAsset {
843
1036
  id
844
1037
  preview
845
1038
  }
1039
+ breadcrumbs {
1040
+ id
1041
+ name
1042
+ slug
1043
+ }
1044
+ children {
1045
+ id
1046
+ name
1047
+ slug
1048
+ featuredAsset {
1049
+ id
1050
+ preview
1051
+ }
1052
+ }
846
1053
  }
847
- }
848
- search(input: $input) {
849
- totalItems
850
- items {
851
- ...ProductCard
1054
+ search(input: $input) {
1055
+ totalItems
1056
+ items {
1057
+ ...ProductCard
1058
+ }
852
1059
  }
853
1060
  }
854
- }
855
- `,
856
- [ProductCardFragment],
1061
+ `,
1062
+ [ProductCardFragment],
1063
+ ),
1064
+ [['highlights']],
857
1065
  );
858
1066
 
859
- export const GetMyCompaniesQuery = graphql(`
860
- query GetMyCompanies {
861
- activeCustomer {
862
- id
863
- companyUsers {
1067
+ export const GetMyCompaniesQuery = forCapability(
1068
+ 'org.accounts',
1069
+ graphql(`
1070
+ query GetMyCompanies {
1071
+ activeCustomer {
864
1072
  id
865
- state
866
- company {
1073
+ companyUsers {
867
1074
  id
868
- name
869
1075
  state
1076
+ company {
1077
+ id
1078
+ name
1079
+ state
1080
+ }
870
1081
  }
871
1082
  }
872
1083
  }
873
- }
874
- `);
1084
+ `),
1085
+ [['activeCustomer', 'companyUsers']],
1086
+ );
875
1087
 
876
1088
  export type CompanyUserCompany = NonNullable<
877
1089
  ResultOf<typeof GetMyCompaniesQuery>['activeCustomer']
878
1090
  >['companyUsers'][number]['company'];
879
1091
 
880
- export const GetActiveCustomerCompanyQuery = graphql(
881
- `
882
- query GetActiveCustomerCompany {
883
- activeCustomer {
884
- id
885
- companyUsers {
886
- ...CompanyUser
1092
+ export const GetActiveCustomerCompanyQuery = composeCapabilityDocument(
1093
+ graphql(
1094
+ `
1095
+ query GetActiveCustomerCompany {
1096
+ activeCustomer {
1097
+ id
1098
+ companyUsers {
1099
+ ...CompanyUser
1100
+ }
887
1101
  }
888
1102
  }
889
- }
890
- `,
891
- [CompanyUserFragment],
1103
+ `,
1104
+ [CompanyUserFragment],
1105
+ ),
1106
+ [
1107
+ { capability: 'org.accounts', paths: [['activeCustomer', 'companyUsers']] },
1108
+ { capability: 'org.hierarchy', paths: [['businessUnits']] },
1109
+ ],
892
1110
  );
893
1111
 
894
- export const GetCompanyAccountQuery = graphql(
895
- `
896
- query GetCompanyAccount {
897
- companyAccount {
898
- company {
899
- ...Company
900
- }
901
- companyUser {
902
- ...CompanyUser
903
- }
904
- activeBusinessUnit {
905
- ...CompanyBusinessUnit
906
- }
907
- permissions
908
- }
909
- }
910
- `,
911
- [CompanyFragment, CompanyUserFragment, CompanyBusinessUnitFragment],
1112
+ export const GetCompanyAccountQuery = composeCapabilityDocument(
1113
+ graphql(
1114
+ `
1115
+ query GetCompanyAccount {
1116
+ companyAccount {
1117
+ company {
1118
+ ...Company
1119
+ }
1120
+ companyUser {
1121
+ ...CompanyUser
1122
+ }
1123
+ activeBusinessUnit {
1124
+ ...CompanyBusinessUnit
1125
+ }
1126
+ permissions
1127
+ }
1128
+ }
1129
+ `,
1130
+ [CompanyFragment, CompanyUserFragment, CompanyBusinessUnitFragment],
1131
+ ),
1132
+ [
1133
+ { capability: 'org.accounts', paths: [['companyAccount']] },
1134
+ {
1135
+ capability: 'org.hierarchy',
1136
+ paths: [['companyAccount', 'activeBusinessUnit'], ['businessUnits']],
1137
+ },
1138
+ ],
912
1139
  );
913
1140
 
914
- export const GetCompanyBusinessUnitsQuery = graphql(
915
- `
916
- query GetCompanyBusinessUnits {
917
- companyBusinessUnits {
918
- ...CompanyBusinessUnit
1141
+ export const GetCompanyBusinessUnitsQuery = forCapability(
1142
+ 'org.hierarchy',
1143
+ graphql(
1144
+ `
1145
+ query GetCompanyBusinessUnits {
1146
+ companyBusinessUnits {
1147
+ ...CompanyBusinessUnit
1148
+ }
919
1149
  }
920
- }
921
- `,
922
- [CompanyBusinessUnitFragment],
1150
+ `,
1151
+ [CompanyBusinessUnitFragment],
1152
+ ),
1153
+ [['companyBusinessUnits']],
923
1154
  );
924
1155
 
925
- export const GetShopCompanyUsersQuery = graphql(
926
- `
927
- query GetShopCompanyUsers {
928
- shopCompanyUsers {
929
- ...CompanyUser
1156
+ export const GetShopCompanyUsersQuery = composeCapabilityDocument(
1157
+ graphql(
1158
+ `
1159
+ query GetShopCompanyUsers {
1160
+ shopCompanyUsers {
1161
+ ...CompanyUser
1162
+ }
930
1163
  }
931
- }
932
- `,
933
- [CompanyUserFragment],
1164
+ `,
1165
+ [CompanyUserFragment],
1166
+ ),
1167
+ [
1168
+ { capability: 'org.accounts', paths: [['shopCompanyUsers']] },
1169
+ { capability: 'org.hierarchy', paths: [['businessUnits']] },
1170
+ ],
934
1171
  );
935
1172
 
936
- export const GetCompanyRolesQuery = graphql(
937
- `
938
- query GetCompanyRoles {
939
- companyRoles {
940
- ...CompanyRole
1173
+ export const GetCompanyRolesQuery = forCapability(
1174
+ 'org.accounts',
1175
+ graphql(
1176
+ `
1177
+ query GetCompanyRoles {
1178
+ companyRoles {
1179
+ ...CompanyRole
1180
+ }
941
1181
  }
942
- }
943
- `,
944
- [CompanyRoleFragment],
1182
+ `,
1183
+ [CompanyRoleFragment],
1184
+ ),
1185
+ [['companyRoles']],
945
1186
  );
946
1187
 
947
- export const GetCompanyAddressesQuery = graphql(
948
- `
949
- query GetCompanyAddresses {
950
- companyAddresses {
951
- ...CompanyAddress
952
- }
953
- }
954
- `,
955
- [CompanyAddressFragment],
1188
+ export const GetCompanyAddressesQuery = composeCapabilityDocument(
1189
+ graphql(
1190
+ `
1191
+ query GetCompanyAddresses {
1192
+ companyAddresses {
1193
+ ...CompanyAddress
1194
+ }
1195
+ }
1196
+ `,
1197
+ [CompanyAddressFragment],
1198
+ ),
1199
+ [
1200
+ { capability: 'org.accounts', paths: [['companyAddresses']] },
1201
+ { capability: 'org.hierarchy', paths: [['businessUnit']] },
1202
+ ],
956
1203
  );
957
1204
 
958
- export const GetCompanyPaymentMethodsQuery = graphql(
959
- `
960
- query GetCompanyPaymentMethods {
961
- companyPaymentMethods {
962
- ...CompanyPaymentMethod
1205
+ export const GetCompanyPaymentMethodsQuery = forCapability(
1206
+ 'org.accounts',
1207
+ graphql(
1208
+ `
1209
+ query GetCompanyPaymentMethods {
1210
+ companyPaymentMethods {
1211
+ ...CompanyPaymentMethod
1212
+ }
963
1213
  }
964
- }
965
- `,
966
- [CompanyPaymentMethodFragment],
1214
+ `,
1215
+ [CompanyPaymentMethodFragment],
1216
+ ),
1217
+ [['companyPaymentMethods']],
967
1218
  );
968
1219
 
969
- export const GetCompanyInvitationQuery = graphql(
970
- `
971
- query GetCompanyInvitation($token: String!) {
972
- companyInvitation(token: $token) {
973
- companyUser {
974
- ...CompanyUser
975
- }
976
- company {
977
- ...Company
1220
+ export const GetCompanyInvitationQuery = composeCapabilityDocument(
1221
+ graphql(
1222
+ `
1223
+ query GetCompanyInvitation($token: String!) {
1224
+ companyInvitation(token: $token) {
1225
+ companyUser {
1226
+ ...CompanyUser
1227
+ }
1228
+ company {
1229
+ ...Company
1230
+ }
978
1231
  }
979
1232
  }
980
- }
981
- `,
982
- [CompanyUserFragment, CompanyFragment],
1233
+ `,
1234
+ [CompanyUserFragment, CompanyFragment],
1235
+ ),
1236
+ [
1237
+ { capability: 'org.accounts', paths: [['companyInvitation']] },
1238
+ { capability: 'org.hierarchy', paths: [['businessUnits']] },
1239
+ ],
983
1240
  );
984
1241
 
985
1242
  export const InstantSearchQuery = graphql(`
@@ -1022,20 +1279,24 @@ export const InstantSearchQuery = graphql(`
1022
1279
  }
1023
1280
  `);
1024
1281
 
1025
- export const CollectionSearchQuery = graphql(`
1026
- query CollectionSearch($input: ExternalSearchScopedInput!) {
1027
- searchCollections(input: $input) {
1028
- items {
1029
- id
1030
- name
1031
- slug
1032
- thumbnailUrl
1033
- score
1282
+ export const CollectionSearchQuery = forCapability(
1283
+ 'search.foundation',
1284
+ graphql(`
1285
+ query CollectionSearch($input: ExternalSearchScopedInput!) {
1286
+ searchCollections(input: $input) {
1287
+ items {
1288
+ id
1289
+ name
1290
+ slug
1291
+ thumbnailUrl
1292
+ score
1293
+ }
1294
+ totalItems
1034
1295
  }
1035
- totalItems
1036
1296
  }
1037
- }
1038
- `);
1297
+ `),
1298
+ [['searchCollections']],
1299
+ );
1039
1300
 
1040
1301
  export const SearchVariantsQuery = graphql(`
1041
1302
  query SearchVariants($input: SearchInput!) {
@@ -1065,94 +1326,110 @@ export const SearchVariantsQuery = graphql(`
1065
1326
  }
1066
1327
  `);
1067
1328
 
1068
- export const QuoteStockCheckQuery = graphql(`
1069
- query QuoteStockCheck($quoteId: ID!) {
1070
- quoteStockCheck(quoteId: $quoteId) {
1071
- allInStock
1072
- outOfStockItems {
1073
- sku
1074
- productName
1075
- requestedQuantity
1076
- availableStock
1329
+ export const QuoteStockCheckQuery = forCapability(
1330
+ 'quote.requests',
1331
+ graphql(`
1332
+ query QuoteStockCheck($quoteId: ID!) {
1333
+ quoteStockCheck(quoteId: $quoteId) {
1334
+ allInStock
1335
+ outOfStockItems {
1336
+ sku
1337
+ productName
1338
+ requestedQuantity
1339
+ availableStock
1340
+ }
1077
1341
  }
1078
1342
  }
1079
- }
1080
- `);
1343
+ `),
1344
+ [['quoteStockCheck']],
1345
+ );
1081
1346
 
1082
- export const GetMyQuotesQuery = graphql(`
1083
- query GetMyQuotes($options: QuoteListOptions) {
1084
- myQuotes(options: $options) {
1085
- totalItems
1086
- items {
1087
- id
1088
- quoteNumber
1089
- status
1090
- validUntil
1091
- createdAt
1092
- customer {
1347
+ export const GetMyQuotesQuery = forCapability(
1348
+ 'quote.requests',
1349
+ graphql(`
1350
+ query GetMyQuotes($options: QuoteListOptions) {
1351
+ myQuotes(options: $options) {
1352
+ totalItems
1353
+ items {
1093
1354
  id
1094
- firstName
1095
- lastName
1096
- }
1097
- currentVersion {
1098
- total
1099
- lineItems {
1100
- sku
1101
- productName
1102
- quantity
1103
- unitPrice
1355
+ quoteNumber
1356
+ status
1357
+ validUntil
1358
+ createdAt
1359
+ customer {
1360
+ id
1361
+ firstName
1362
+ lastName
1363
+ }
1364
+ currentVersion {
1365
+ total
1366
+ lineItems {
1367
+ sku
1368
+ productName
1369
+ quantity
1370
+ unitPrice
1371
+ }
1104
1372
  }
1105
1373
  }
1106
1374
  }
1107
1375
  }
1108
- }
1109
- `);
1376
+ `),
1377
+ [['myQuotes']],
1378
+ );
1110
1379
 
1111
- export const GetMyStoreCreditsQuery = graphql(`
1112
- query GetMyStoreCredits($options: StoreCreditListOptions) {
1113
- myStoreCredits(options: $options) {
1114
- totalItems
1115
- items {
1116
- id
1117
- code
1118
- type
1119
- initialValue
1120
- balance
1121
- currencyCode
1122
- expiryDate
1123
- issuedTo {
1380
+ export const GetMyStoreCreditsQuery = forCapability(
1381
+ 'store-credit.balance',
1382
+ graphql(`
1383
+ query GetMyStoreCredits($options: StoreCreditListOptions) {
1384
+ myStoreCredits(options: $options) {
1385
+ totalItems
1386
+ items {
1124
1387
  id
1125
- firstName
1126
- lastName
1388
+ code
1389
+ type
1390
+ initialValue
1391
+ balance
1392
+ currencyCode
1393
+ expiryDate
1394
+ issuedTo {
1395
+ id
1396
+ firstName
1397
+ lastName
1398
+ }
1127
1399
  }
1128
1400
  }
1129
1401
  }
1130
- }
1131
- `);
1402
+ `),
1403
+ [['myStoreCredits']],
1404
+ );
1132
1405
 
1133
- export const GetGiftCardTemplatesQuery = graphql(`
1134
- query GetGiftCardTemplates {
1135
- giftCardTemplates {
1136
- items {
1137
- id
1138
- name
1139
- image {
1406
+ export const GetGiftCardTemplatesQuery = forCapability(
1407
+ 'store-credit.gift-cards',
1408
+ graphql(`
1409
+ query GetGiftCardTemplates {
1410
+ giftCardTemplates {
1411
+ items {
1140
1412
  id
1141
- preview
1142
- source
1413
+ name
1414
+ image {
1415
+ id
1416
+ preview
1417
+ source
1418
+ }
1143
1419
  }
1420
+ totalItems
1144
1421
  }
1145
- totalItems
1146
1422
  }
1147
- }
1148
- `);
1423
+ `),
1424
+ [['giftCardTemplates']],
1425
+ );
1149
1426
 
1150
1427
  /** A gift card template. */
1151
1428
  export type GiftCardTemplate = ResultOf<
1152
1429
  typeof GetGiftCardTemplatesQuery
1153
1430
  >['giftCardTemplates']['items'][number];
1154
1431
 
1155
- export const GetMyQuoteDetailQuery = graphql(`
1432
+ const GetMyQuoteDetailDocument = graphql(`
1156
1433
  query GetMyQuoteDetail($id: ID!) {
1157
1434
  myQuote(id: $id) {
1158
1435
  id
@@ -1217,6 +1494,17 @@ export const GetMyQuoteDetailQuery = graphql(`
1217
1494
  }
1218
1495
  `);
1219
1496
 
1497
+ export const GetMyQuoteDetailQuery = composeCapabilityDocument(GetMyQuoteDetailDocument, [
1498
+ { capability: 'quote.requests', paths: [['myQuote']] },
1499
+ {
1500
+ capability: 'quote.negotiation',
1501
+ paths: [
1502
+ ['myQuote', 'versions'],
1503
+ ['myQuote', 'comments'],
1504
+ ],
1505
+ },
1506
+ ]);
1507
+
1220
1508
  /** A quote detail object. */
1221
1509
  export type QuoteDetail = NonNullable<ResultOf<typeof GetMyQuoteDetailQuery>['myQuote']>;
1222
1510
  /** A version in a quote. */
@@ -1238,54 +1526,62 @@ export const GetQuoteOrderEligibleShippingMethodsQuery = graphql(`
1238
1526
  }
1239
1527
  `);
1240
1528
 
1241
- export const GetTaxIdsQuery = graphql(
1242
- `
1243
- query GetTaxIds {
1244
- taxIds {
1245
- ...TaxIdFields
1529
+ export const GetTaxIdsQuery = forCapability(
1530
+ 'tax-id.validation',
1531
+ graphql(
1532
+ `
1533
+ query GetTaxIds {
1534
+ taxIds {
1535
+ ...TaxIdFields
1536
+ }
1246
1537
  }
1247
- }
1248
- `,
1249
- [TaxIdFragment],
1538
+ `,
1539
+ [TaxIdFragment],
1540
+ ),
1541
+ [['taxIds']],
1250
1542
  );
1251
1543
 
1252
1544
  // ── Configurator ─────────────────────────────────────────
1253
1545
 
1254
- export const GetConfiguratorSystemQuery = graphql(`
1255
- query GetConfiguratorSystem($code: String!) {
1256
- configuratorSystem(code: $code) {
1257
- id
1258
- code
1259
- name
1260
- description
1261
- modules {
1546
+ export const GetConfiguratorSystemQuery = forCapability(
1547
+ 'configurator.forms',
1548
+ graphql(`
1549
+ query GetConfiguratorSystem($code: String!) {
1550
+ configuratorSystem(code: $code) {
1262
1551
  id
1263
1552
  code
1264
1553
  name
1265
- optional
1266
- sortOrder
1267
- fields {
1554
+ description
1555
+ modules {
1268
1556
  id
1269
1557
  code
1270
- fieldType
1271
1558
  name
1272
- unit
1273
- defaultValue
1274
- required
1559
+ optional
1275
1560
  sortOrder
1276
- min
1277
- max
1278
- options {
1561
+ fields {
1279
1562
  id
1280
1563
  code
1281
- label
1564
+ fieldType
1565
+ name
1566
+ unit
1567
+ defaultValue
1568
+ required
1569
+ sortOrder
1570
+ min
1571
+ max
1572
+ options {
1573
+ id
1574
+ code
1575
+ label
1576
+ }
1577
+ dynamicOptionsSource
1282
1578
  }
1283
- dynamicOptionsSource
1284
1579
  }
1285
1580
  }
1286
1581
  }
1287
- }
1288
- `);
1582
+ `),
1583
+ [['configuratorSystem']],
1584
+ );
1289
1585
 
1290
1586
  export type ConfiguratorSystem = NonNullable<
1291
1587
  ResultOf<typeof GetConfiguratorSystemQuery>['configuratorSystem']
@@ -1293,7 +1589,7 @@ export type ConfiguratorSystem = NonNullable<
1293
1589
  export type ConfiguratorModule = ConfiguratorSystem['modules'][number];
1294
1590
  export type ConfiguratorField = ConfiguratorModule['fields'][number];
1295
1591
 
1296
- export const EvaluateConfigurationQuery = graphql(`
1592
+ const EvaluateConfigurationDocument = graphql(`
1297
1593
  query EvaluateProductConfiguration($input: EvaluateProductConfigurationInput!) {
1298
1594
  evaluateProductConfiguration(input: $input) {
1299
1595
  fields {
@@ -1358,6 +1654,14 @@ export const EvaluateConfigurationQuery = graphql(`
1358
1654
  }
1359
1655
  `);
1360
1656
 
1657
+ /**
1658
+ * Configurator evaluation details only exist in the schema with
1659
+ * `configurator.forms`.
1660
+ */
1661
+ export const EvaluateConfigurationQuery = forCapability('configurator.forms', EvaluateConfigurationDocument, [
1662
+ ['evaluateProductConfiguration'],
1663
+ ]);
1664
+
1361
1665
  export type ConfigurationEvaluation = ResultOf<
1362
1666
  typeof EvaluateConfigurationQuery
1363
1667
  >['evaluateProductConfiguration'];
@@ -1365,27 +1669,31 @@ export type EvaluatedField = ConfigurationEvaluation['fields'][number];
1365
1669
  export type EvaluatedLine = ConfigurationEvaluation['lines'][number];
1366
1670
  export type EvaluatedExecutedRule = ConfigurationEvaluation['executedRules'][number];
1367
1671
 
1368
- export const GetActiveOrderConfigurationsQuery = graphql(`
1369
- query GetActiveOrderConfigurations {
1370
- activeOrder {
1371
- id
1372
- productConfigurations {
1672
+ export const GetActiveOrderConfigurationsQuery = forCapability(
1673
+ 'configurator.forms',
1674
+ graphql(`
1675
+ query GetActiveOrderConfigurations {
1676
+ activeOrder {
1373
1677
  id
1374
- name
1375
- system {
1376
- id
1377
- code
1378
- }
1379
- fieldValues {
1678
+ productConfigurations {
1380
1679
  id
1381
- moduleCode
1382
- fieldCode
1383
- value
1680
+ name
1681
+ system {
1682
+ id
1683
+ code
1684
+ }
1685
+ fieldValues {
1686
+ id
1687
+ moduleCode
1688
+ fieldCode
1689
+ value
1690
+ }
1384
1691
  }
1385
1692
  }
1386
1693
  }
1387
- }
1388
- `);
1694
+ `),
1695
+ [['activeOrder', 'productConfigurations']],
1696
+ );
1389
1697
 
1390
1698
  export type ActiveOrderConfiguration = NonNullable<
1391
1699
  NonNullable<ResultOf<typeof GetActiveOrderConfigurationsQuery>['activeOrder']>['productConfigurations']
@@ -1393,59 +1701,67 @@ export type ActiveOrderConfiguration = NonNullable<
1393
1701
 
1394
1702
  // ── Quick Order ──
1395
1703
 
1396
- export const QuickOrderSearchQuery = graphql(`
1397
- query QuickOrderSearch($term: String!, $take: Int) {
1398
- quickOrderSearch(term: $term, take: $take) {
1399
- variantId
1400
- sku
1401
- productName
1402
- variantName
1403
- price
1404
- priceWithTax
1405
- currencyCode
1406
- inStock
1704
+ export const QuickOrderSearchQuery = forCapability(
1705
+ 'quick-order',
1706
+ graphql(`
1707
+ query QuickOrderSearch($term: String!, $take: Int) {
1708
+ quickOrderSearch(term: $term, take: $take) {
1709
+ variantId
1710
+ sku
1711
+ productName
1712
+ variantName
1713
+ price
1714
+ priceWithTax
1715
+ currencyCode
1716
+ inStock
1717
+ }
1407
1718
  }
1408
- }
1409
- `);
1719
+ `),
1720
+ [['quickOrderSearch']],
1721
+ );
1410
1722
 
1411
- export const PreviewReorderQuery = graphql(`
1412
- query PreviewReorder($input: ReorderPreviewInput!) {
1413
- previewReorder(input: $input) {
1414
- lines {
1415
- sourceLineId
1416
- productVariant {
1417
- id
1418
- name
1419
- sku
1420
- product {
1723
+ export const PreviewReorderQuery = forCapability(
1724
+ 'reorder',
1725
+ graphql(`
1726
+ query PreviewReorder($input: ReorderPreviewInput!) {
1727
+ previewReorder(input: $input) {
1728
+ lines {
1729
+ sourceLineId
1730
+ productVariant {
1731
+ id
1421
1732
  name
1422
- slug
1423
- featuredAsset {
1424
- id
1425
- preview
1733
+ sku
1734
+ product {
1735
+ name
1736
+ slug
1737
+ featuredAsset {
1738
+ id
1739
+ preview
1740
+ }
1426
1741
  }
1427
1742
  }
1743
+ quantity
1744
+ status
1745
+ originalUnitPrice
1746
+ originalUnitPriceWithTax
1747
+ currentCatalogUnitPrice
1748
+ currentCatalogUnitPriceWithTax
1749
+ messages {
1750
+ type
1751
+ message
1752
+ }
1428
1753
  }
1429
- quantity
1430
- status
1431
- originalUnitPrice
1432
- originalUnitPriceWithTax
1433
- currentCatalogUnitPrice
1434
- currentCatalogUnitPriceWithTax
1435
- messages {
1436
- type
1437
- message
1754
+ summary {
1755
+ availableCount
1756
+ unavailableCount
1757
+ indicativeTotal
1758
+ currencyCode
1438
1759
  }
1439
1760
  }
1440
- summary {
1441
- availableCount
1442
- unavailableCount
1443
- indicativeTotal
1444
- currencyCode
1445
- }
1446
1761
  }
1447
- }
1448
- `);
1762
+ `),
1763
+ [['previewReorder']],
1764
+ );
1449
1765
 
1450
1766
  // ---------------------------------------------------------------------------
1451
1767
  // Shared Carts (EE-13)
@@ -1455,136 +1771,163 @@ export const PreviewReorderQuery = graphql(`
1455
1771
  // fragments) to match the masking-on convention of the other list queries.
1456
1772
  // ---------------------------------------------------------------------------
1457
1773
 
1458
- export const GetMySharedCartsQuery = graphql(`
1459
- query GetMySharedCarts($options: SharedCartListOptions) {
1460
- mySharedCarts(options: $options) {
1461
- totalItems
1462
- items {
1463
- id
1464
- name
1465
- status
1466
- updatedAt
1467
- owner {
1774
+ export const GetMySharedCartsQuery = forCapability(
1775
+ 'shared-carts.collaboration',
1776
+ graphql(`
1777
+ query GetMySharedCarts($options: SharedCartListOptions) {
1778
+ mySharedCarts(options: $options) {
1779
+ totalItems
1780
+ items {
1468
1781
  id
1469
- firstName
1470
- lastName
1471
- }
1472
- members {
1473
- role
1474
- customer {
1782
+ name
1783
+ status
1784
+ updatedAt
1785
+ owner {
1475
1786
  id
1787
+ firstName
1788
+ lastName
1789
+ }
1790
+ members {
1791
+ role
1792
+ customer {
1793
+ id
1794
+ }
1795
+ }
1796
+ order {
1797
+ id
1798
+ currencyCode
1799
+ totalWithTax
1800
+ totalQuantity
1476
1801
  }
1477
- }
1478
- order {
1479
- id
1480
- currencyCode
1481
- totalWithTax
1482
- totalQuantity
1483
1802
  }
1484
1803
  }
1485
1804
  }
1486
- }
1487
- `);
1805
+ `),
1806
+ [['mySharedCarts']],
1807
+ );
1488
1808
 
1489
1809
  // Company-wide list for company admins (ManageSharedCarts): every cart in the company, including
1490
1810
  // ones the admin isn't a member of. Same shape as GetMySharedCarts so the list page can render
1491
1811
  // either result interchangeably.
1492
- export const GetCompanySharedCartsQuery = graphql(`
1493
- query GetCompanySharedCarts($options: SharedCartListOptions) {
1494
- companySharedCarts(options: $options) {
1495
- totalItems
1496
- items {
1812
+ export const GetCompanySharedCartsQuery = forCapability(
1813
+ 'shared-carts.collaboration',
1814
+ graphql(`
1815
+ query GetCompanySharedCarts($options: SharedCartListOptions) {
1816
+ companySharedCarts(options: $options) {
1817
+ totalItems
1818
+ items {
1819
+ id
1820
+ name
1821
+ status
1822
+ updatedAt
1823
+ owner {
1824
+ id
1825
+ firstName
1826
+ lastName
1827
+ }
1828
+ members {
1829
+ role
1830
+ customer {
1831
+ id
1832
+ }
1833
+ }
1834
+ order {
1835
+ id
1836
+ currencyCode
1837
+ totalWithTax
1838
+ totalQuantity
1839
+ }
1840
+ }
1841
+ }
1842
+ }
1843
+ `),
1844
+ [['companySharedCarts']],
1845
+ );
1846
+
1847
+ export const GetSharedCartQuery = forCapability(
1848
+ 'shared-carts.collaboration',
1849
+ graphql(`
1850
+ query GetSharedCart($id: ID!) {
1851
+ sharedCart(id: $id) {
1497
1852
  id
1498
1853
  name
1854
+ description
1499
1855
  status
1856
+ createdAt
1500
1857
  updatedAt
1858
+ companyId
1501
1859
  owner {
1502
1860
  id
1503
1861
  firstName
1504
1862
  lastName
1863
+ emailAddress
1505
1864
  }
1506
1865
  members {
1507
1866
  role
1508
1867
  customer {
1509
1868
  id
1869
+ firstName
1870
+ lastName
1871
+ emailAddress
1510
1872
  }
1511
1873
  }
1512
1874
  order {
1513
1875
  id
1876
+ code
1514
1877
  currencyCode
1878
+ subTotalWithTax
1515
1879
  totalWithTax
1516
1880
  totalQuantity
1881
+ customer {
1882
+ id
1883
+ firstName
1884
+ lastName
1885
+ }
1886
+ lines {
1887
+ id
1888
+ quantity
1889
+ unitPriceWithTax
1890
+ linePriceWithTax
1891
+ productVariant {
1892
+ id
1893
+ name
1894
+ sku
1895
+ }
1896
+ featuredAsset {
1897
+ preview
1898
+ }
1899
+ }
1517
1900
  }
1518
- }
1519
- }
1520
- }
1521
- `);
1522
-
1523
- export const GetSharedCartQuery = graphql(`
1524
- query GetSharedCart($id: ID!) {
1525
- sharedCart(id: $id) {
1526
- id
1527
- name
1528
- description
1529
- status
1530
- createdAt
1531
- updatedAt
1532
- companyId
1533
- owner {
1534
- id
1535
- firstName
1536
- lastName
1537
- emailAddress
1538
- }
1539
- members {
1540
- role
1541
- customer {
1542
- id
1543
- firstName
1544
- lastName
1545
- emailAddress
1546
- }
1547
- }
1548
- order {
1549
- id
1550
- code
1551
- currencyCode
1552
- subTotalWithTax
1553
- totalWithTax
1554
- totalQuantity
1555
- customer {
1556
- id
1557
- firstName
1558
- lastName
1559
- }
1560
- lines {
1901
+ activity {
1561
1902
  id
1562
- quantity
1563
- unitPriceWithTax
1564
- linePriceWithTax
1565
- productVariant {
1903
+ createdAt
1904
+ action
1905
+ targetLineId
1906
+ detail
1907
+ actorLabel
1908
+ targetCustomer {
1566
1909
  id
1567
- name
1568
- sku
1569
- }
1570
- featuredAsset {
1571
- preview
1910
+ firstName
1911
+ lastName
1572
1912
  }
1573
1913
  }
1574
1914
  }
1575
- activity {
1915
+ }
1916
+ `),
1917
+ [['sharedCart']],
1918
+ );
1919
+
1920
+ export const GetActivePunchoutSessionQuery = forCapability(
1921
+ 'punchout',
1922
+ graphql(`
1923
+ query GetActivePunchoutSession {
1924
+ activePunchoutSession {
1576
1925
  id
1577
- createdAt
1578
- action
1579
- targetLineId
1580
- detail
1581
- actorLabel
1582
- targetCustomer {
1583
- id
1584
- firstName
1585
- lastName
1586
- }
1926
+ buyerCookie
1927
+ tradingPartnerName
1928
+ expiresAt
1587
1929
  }
1588
1930
  }
1589
- }
1590
- `);
1931
+ `),
1932
+ [['activePunchoutSession']],
1933
+ );