@foxy.io/elements 1.59.1 → 1.60.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 (171) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +1 -1
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-admin-subscription-card.js +1 -1
  5. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  6. package/dist/cdn/foxy-admin-transaction-card.js +1 -1
  7. package/dist/cdn/foxy-api-browser.js +1 -1
  8. package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
  9. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  10. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  11. package/dist/cdn/foxy-attribute-card.js +1 -1
  12. package/dist/cdn/foxy-attribute-form.js +1 -1
  13. package/dist/cdn/foxy-billing-address-card.js +1 -1
  14. package/dist/cdn/foxy-cancellation-form.js +1 -1
  15. package/dist/cdn/foxy-cart-card.js +1 -1
  16. package/dist/cdn/foxy-cart-form.js +1 -1
  17. package/dist/cdn/foxy-client-card.js +1 -1
  18. package/dist/cdn/foxy-client-form.js +1 -1
  19. package/dist/cdn/foxy-collection-page.js +1 -1
  20. package/dist/cdn/foxy-collection-pages.js +1 -1
  21. package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
  22. package/dist/cdn/foxy-coupon-card.js +1 -1
  23. package/dist/cdn/foxy-coupon-code-card.js +1 -1
  24. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  25. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  26. package/dist/cdn/foxy-coupon-detail-card.js +1 -1
  27. package/dist/cdn/foxy-coupon-form.js +1 -1
  28. package/dist/cdn/foxy-custom-field-card.js +1 -1
  29. package/dist/cdn/foxy-custom-field-form.js +1 -1
  30. package/dist/cdn/foxy-customer-api.js +1 -1
  31. package/dist/cdn/foxy-customer-card.js +1 -1
  32. package/dist/cdn/foxy-customer-form.js +1 -1
  33. package/dist/cdn/foxy-customer-portal-settings-form.js +1 -1
  34. package/dist/cdn/foxy-customer-portal-settings.js +1 -1
  35. package/dist/cdn/foxy-customer-portal.js +1 -1
  36. package/dist/cdn/foxy-customer.js +1 -1
  37. package/dist/cdn/foxy-customers-table.js +1 -1
  38. package/dist/cdn/foxy-discount-builder.js +1 -1
  39. package/dist/cdn/foxy-discount-card.js +1 -1
  40. package/dist/cdn/foxy-discount-detail-card.js +1 -1
  41. package/dist/cdn/foxy-donation.js +1 -1
  42. package/dist/cdn/foxy-downloadable-card.js +1 -1
  43. package/dist/cdn/foxy-downloadable-form.js +1 -1
  44. package/dist/cdn/foxy-email-template-card.js +1 -1
  45. package/dist/cdn/foxy-email-template-form.js +1 -1
  46. package/dist/cdn/foxy-error-entry-card.js +1 -1
  47. package/dist/cdn/foxy-experimental-add-to-cart-builder.js +1 -1
  48. package/dist/cdn/foxy-filter-attribute-card.js +1 -1
  49. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  50. package/dist/cdn/foxy-form-dialog.js +1 -1
  51. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  52. package/dist/cdn/foxy-gift-card-card.js +1 -1
  53. package/dist/cdn/foxy-gift-card-code-card.js +1 -1
  54. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  55. package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
  56. package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
  57. package/dist/cdn/foxy-gift-card-form.js +1 -1
  58. package/dist/cdn/foxy-i18n-editor.js +1 -1
  59. package/dist/cdn/foxy-integration-card.js +1 -1
  60. package/dist/cdn/foxy-integration-form.js +1 -1
  61. package/dist/cdn/foxy-item-card.js +1 -1
  62. package/dist/cdn/foxy-item-category-card.js +1 -1
  63. package/dist/cdn/foxy-item-category-form.js +1 -1
  64. package/dist/cdn/foxy-item-form.js +1 -1
  65. package/dist/cdn/foxy-item-option-card.js +1 -1
  66. package/dist/cdn/foxy-item-option-form.js +1 -1
  67. package/dist/cdn/foxy-items-form.js +1 -1
  68. package/dist/cdn/foxy-native-integration-card.js +1 -1
  69. package/dist/cdn/foxy-native-integration-form.js +1 -1
  70. package/dist/cdn/foxy-nucleon-element.js +1 -1
  71. package/dist/cdn/foxy-pagination.js +1 -1
  72. package/dist/cdn/foxy-passkey-card.js +1 -1
  73. package/dist/cdn/foxy-passkey-form.js +1 -1
  74. package/dist/cdn/foxy-payment-card-embed.js +1 -1
  75. package/dist/cdn/foxy-payment-card.js +1 -1
  76. package/dist/cdn/foxy-payment-method-card.js +1 -1
  77. package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
  78. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  79. package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
  80. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  81. package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
  82. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  83. package/dist/cdn/foxy-query-builder.js +1 -1
  84. package/dist/cdn/foxy-report-form.js +1 -1
  85. package/dist/cdn/foxy-reports-table.js +6 -6
  86. package/dist/cdn/foxy-shipment-card.js +1 -1
  87. package/dist/cdn/foxy-shipping-container-card.js +1 -1
  88. package/dist/cdn/foxy-shipping-drop-type-card.js +1 -1
  89. package/dist/cdn/foxy-shipping-method-card.js +1 -1
  90. package/dist/cdn/foxy-shipping-service-card.js +1 -1
  91. package/dist/cdn/foxy-sign-in-form.js +1 -1
  92. package/dist/cdn/foxy-store-card.js +1 -1
  93. package/dist/cdn/foxy-store-form.js +1 -1
  94. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  95. package/dist/cdn/foxy-store-transaction-folder-card.js +1 -1
  96. package/dist/cdn/foxy-store-transaction-folder-form.js +1 -1
  97. package/dist/cdn/foxy-subscription-card.js +1 -1
  98. package/dist/cdn/foxy-subscription-form.js +1 -1
  99. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  100. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  101. package/dist/cdn/foxy-table.js +1 -1
  102. package/dist/cdn/foxy-tax-card.js +1 -1
  103. package/dist/cdn/foxy-tax-form.js +1 -1
  104. package/dist/cdn/foxy-template-config-form.js +1 -1
  105. package/dist/cdn/foxy-template-form.js +1 -1
  106. package/dist/cdn/foxy-template-set-card.js +1 -1
  107. package/dist/cdn/foxy-template-set-form.js +1 -1
  108. package/dist/cdn/foxy-transaction-card.js +1 -1
  109. package/dist/cdn/foxy-transaction.js +1 -1
  110. package/dist/cdn/foxy-transactions-table.js +1 -1
  111. package/dist/cdn/foxy-update-payment-method-form.js +1 -1
  112. package/dist/cdn/foxy-user-card.js +1 -1
  113. package/dist/cdn/foxy-user-form.js +1 -1
  114. package/dist/cdn/foxy-user-invitation-card.js +1 -1
  115. package/dist/cdn/foxy-user-invitation-form.js +1 -1
  116. package/dist/cdn/foxy-users-table.js +1 -1
  117. package/dist/cdn/foxy-webhook-card.js +1 -1
  118. package/dist/cdn/foxy-webhook-form.js +1 -1
  119. package/dist/cdn/foxy-webhook-log-card.js +1 -1
  120. package/dist/cdn/foxy-webhook-status-card.js +1 -1
  121. package/dist/cdn/{shared-7b6a899b.js → shared-091e97f3.js} +1 -1
  122. package/dist/cdn/shared-0996f4d0.js +1 -0
  123. package/dist/cdn/{shared-3991076b.js → shared-0b0ab3d2.js} +1 -1
  124. package/dist/cdn/{shared-14713ead.js → shared-18707481.js} +1 -1
  125. package/dist/cdn/{shared-336e73ce.js → shared-222b23bb.js} +1 -1
  126. package/dist/cdn/shared-2fbff8e7.js +1 -0
  127. package/dist/cdn/{shared-8ec1b077.js → shared-32a39c0b.js} +1 -1
  128. package/dist/cdn/shared-345b07f1.js +1 -0
  129. package/dist/cdn/{shared-bc74cd11.js → shared-3a61d8a6.js} +1 -1
  130. package/dist/cdn/{shared-1e9df11c.js → shared-3ef23488.js} +1 -1
  131. package/dist/cdn/{shared-33d770fe.js → shared-40a2705c.js} +1 -1
  132. package/dist/cdn/{shared-cb5305b9.js → shared-41f93e6c.js} +1 -1
  133. package/dist/cdn/{shared-45649d84.js → shared-4ab85bea.js} +1 -1
  134. package/dist/cdn/{shared-28fa98d7.js → shared-4ed4b075.js} +1 -1
  135. package/dist/cdn/{shared-20841d9c.js → shared-56278a3c.js} +1 -1
  136. package/dist/cdn/{shared-d743ec15.js → shared-5e7defee.js} +1 -1
  137. package/dist/cdn/{shared-59dfee2c.js → shared-7b15217c.js} +1 -1
  138. package/dist/cdn/{shared-1a814f90.js → shared-7e28c953.js} +1 -1
  139. package/dist/cdn/{shared-2652e98e.js → shared-8292d44e.js} +1 -1
  140. package/dist/cdn/shared-87e17c02.js +1 -0
  141. package/dist/cdn/{shared-a1bec4a0.js → shared-88f841ff.js} +1 -1
  142. package/dist/cdn/{shared-3eca56ee.js → shared-8be109a9.js} +1 -1
  143. package/dist/cdn/{shared-9f8b593b.js → shared-8f5c8c08.js} +1 -1
  144. package/dist/cdn/{shared-be20875c.js → shared-9b290320.js} +1 -1
  145. package/dist/cdn/{shared-b84996e5.js → shared-a95a66b8.js} +1 -1
  146. package/dist/cdn/{shared-4cc16cdf.js → shared-ac536c67.js} +1 -1
  147. package/dist/cdn/{shared-a44fcc6a.js → shared-ad5617ef.js} +1 -1
  148. package/dist/cdn/{shared-38e0a818.js → shared-af4f71bf.js} +1 -1
  149. package/dist/cdn/{shared-50ef1d5a.js → shared-c85c1864.js} +1 -1
  150. package/dist/cdn/{shared-760a2243.js → shared-cda51ccf.js} +1 -1
  151. package/dist/cdn/{shared-db17c9ee.js → shared-d2f777dc.js} +1 -1
  152. package/dist/cdn/{shared-fdf6df5c.js → shared-e9f9face.js} +1 -1
  153. package/dist/cdn/{shared-3baa9cc9.js → shared-eb349085.js} +1 -1
  154. package/dist/cdn/{shared-19b475f7.js → shared-f9c8881a.js} +1 -1
  155. package/dist/cdn/translations/user-invitation-form/en.json +4 -0
  156. package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormScopeControl/InternalUserInvitationFormScopeControl.d.ts +5 -2
  157. package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormScopeControl/InternalUserInvitationFormScopeControl.js +28 -8
  158. package/dist/elements/public/UserInvitationForm/internal/InternalUserInvitationFormScopeControl/InternalUserInvitationFormScopeControl.js.map +1 -1
  159. package/dist/utils/group-invitation-scopes.d.ts +1 -1
  160. package/dist/utils/group-invitation-scopes.js +4 -2
  161. package/dist/utils/group-invitation-scopes.js.map +1 -1
  162. package/dist/utils/invitation-scope.d.ts +1 -1
  163. package/dist/utils/invitation-scope.js +9 -10
  164. package/dist/utils/invitation-scope.js.map +1 -1
  165. package/dist/utils/user-scope.js +2 -2
  166. package/dist/utils/user-scope.js.map +1 -1
  167. package/package.json +1 -1
  168. package/dist/cdn/shared-36f1e29f.js +0 -1
  169. package/dist/cdn/shared-559b648a.js +0 -1
  170. package/dist/cdn/shared-ab1f5f1f.js +0 -1
  171. package/dist/cdn/shared-da3393a5.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"user-scope.js","sourceRoot":"","sources":["../../src/utils/user-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,qCAAkC;AAqBxD;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAgC;IAC7D,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACrF,IAAI,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC;QAAE,OAAO,IAAI,CAAC;IAEjD,MAAM,aAAa,GAAG,WAAW,CAAC,IAAI,CACpC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,O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,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1D,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IACnD,IAAI,IAAI,CAAC,MAAM;QAAE,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;;QAC/D,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE3C,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["import { COLLECTIONS } from './group-invitation-scopes';\n\n/** `users` is not an invitation collection, but `user_full_access` grants it. */\nexport type ScopeCollection = (typeof COLLECTIONS)[number] | 'users';\n\nexport type UserScope = {\n canRead(collection: ScopeCollection): boolean;\n canWrite(collection: ScopeCollection): boolean;\n canResend(collection: ScopeCollection): boolean;\n};\n\nexport type ScopeRule = {\n /** Control path (as used by `hiddencontrols` / `readonlycontrols`) this rule applies to. */\n path: string;\n collection: ScopeCollection;\n /** Permission required to show the control. Defaults to `read`. */\n need?: 'read' | 'write' | 'resend';\n /** Show the control, but make it readonly when the user cannot write the collection. */\n readonlyIfNoWrite?: boolean;\n};\n\n/**\n * Parses a space-separated API token scope. Returns `null` when the scope does not restrict\n * store collections (no scope, `store_full_access`, or no collection tokens), meaning the UI\n * must stay unchanged.\n */\nexport function parseUserScope(scope: string | null | undefined): UserScope | null {\n const tokens = new Set((scope ?? '').split(/\\s+/).filter(token => token.length > 0));\n if (tokens.has('store_full_access')) return null;\n\n const isStoreScoped = COLLECTIONS.some(\n c => tokens.has(`${c}_read`) || tokens.has(`${c}_write`) || tokens.has(`${c}_resend`)\n );\n if (!isStoreScoped) return null;\n\n const canWrite = (c: ScopeCollection) =>\n tokens.has(`${c}_write`) || (c === 'users' && tokens.has('user_full_access'));\n\n return {\n canWrite,\n // A write scope satisfies a read check in the API.\n canRead: c => canWrite(c) || tokens.has(`${c}_read`),\n canResend: c => tokens.has(`${c}_resend`),\n };\n}\n\n/**\n * Returns `true` when the scope can read the collection, or when the scope does not restrict\n * store collections at all (unset, `store_full_access`, no collection tokens).\n */\nexport function canReadCollection(\n scope: string | null | undefined,\n collection: ScopeCollection\n): boolean {\n return parseUserScope(scope)?.canRead(collection) ?? true;\n}\n\n/** Turns scope rules into control selectors to hide or make readonly. */\nexport function getScopeSelectors(\n scope: UserScope | null,\n rules: ScopeRule[],\n own: ScopeCollection | null\n): { hidden: string[]; readonly: string[]; readonlyAll: boolean } {\n const result = { hidden: [] as string[], readonly: [] as string[], readonlyAll: false };\n if (!scope) return result;\n\n const check = { read: scope.canRead, write: scope.canWrite, resend: scope.canResend };\n\n for (const { path, collection, need = 'read', readonlyIfNoWrite } of rules) {\n if (!check[need](collection)) result.hidden.push(path);\n else if (readonlyIfNoWrite && !scope.canWrite(collection)) result.readonly.push(path);\n }\n\n // Own collection with no read access is left alone: the API's \"Access denied\" covers it.\n if (own && scope.canRead(own) && !scope.canWrite(own)) {\n result.readonlyAll = true;\n result.hidden.push('delete', 'create');\n }\n\n return result;\n}\n\n/**\n * Collection that gates a zoomed rel. A rel that is not listed (items, discounts, applied\n * taxes, attributes...) belongs to its parent, which is already readable, so it is kept.\n */\nconst ZOOM_COLLECTIONS: Record<string, ScopeCollection> = {\n applied_gift_card_codes: 'gift_cards',\n billing_addresses: 'transactions',\n cart: 'carts',\n coupon: 'coupons',\n coupon_code: 'coupons',\n customer: 'customers',\n default_billing_address: 'customers',\n default_payment_method: 'customers',\n default_shipping_address: 'customers',\n downloadable: 'downloadables',\n email_template: 'templates',\n folder: 'transactions',\n gift_card: 'gift_cards',\n gift_card_code: 'gift_cards',\n gift_card_code_logs: 'gift_cards',\n item_category: 'item_categories',\n last_transaction: 'transactions',\n original_transaction: 'transactions',\n payments: 'transactions',\n shipments: 'transactions',\n store: 'stores',\n subscription: 'subscriptions',\n tax: 'taxes',\n template_set: 'templates',\n transaction: 'transactions',\n transaction_template: 'carts',\n};\n\n/**\n * Removes the zoom paths the scope can't read from a URL. The API denies the whole request\n * when one zoomed resource can't be read. Returns the URL unchanged when the scope does not\n * restrict store collections.\n */\nexport function filterZoom(url: string, scope: string | null | undefined): string {\n const userScope = parseUserScope(scope);\n if (!userScope || !url.includes('zoom=')) return url;\n\n const parsedURL = new URL(url);\n const paths = (parsedURL.searchParams.get('zoom') ?? '').split(',').filter(Boolean);\n const isReadable = (rel: string) => {\n const collection = ZOOM_COLLECTIONS[rel];\n return !collection || userScope.canRead(collection);\n };\n\n // Keep the readable start of each path: `items:item_category` becomes `items`.\n const trimmed = paths.map(path => {\n const rels = path.split(':');\n const end = rels.findIndex(rel => !isReadable(rel));\n return end === -1 ? path : rels.slice(0, end).join(':');\n });\n\n const kept = Array.from(new Set(trimmed.filter(Boolean)));\n if (kept.join(',') === paths.join(',')) return url;\n if (kept.length) parsedURL.searchParams.set('zoom', kept.join(','));\n else parsedURL.searchParams.delete('zoom');\n\n return parsedURL.toString();\n}\n"]}
1
+ {"version":3,"file":"user-scope.js","sourceRoot":"","sources":["../../src/utils/user-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,qCAAkC;AAqBxD;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAAgC;IAC7D,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACrF,IAAI,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC;QAAE,OAAO,IAAI,CAAC;IAEjD,MAAM,aAAa,GAAG,WAAW,CAAC,IAAI,CACpC,CAAC,CAAC,EAA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AAC;IAC1D,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1D,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IACnD,IAAI,IAAI,CAAC,MAAM;QAAE,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;;QAC/D,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE3C,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["import { COLLECTIONS } from './group-invitation-scopes';\n\n/** `users` is not an invitation collection, but `user_full_access` grants it. */\nexport type ScopeCollection = (typeof COLLECTIONS)[number] | 'users';\n\nexport type UserScope = {\n canRead(collection: ScopeCollection): boolean;\n canWrite(collection: ScopeCollection): boolean;\n canResend(collection: ScopeCollection): boolean;\n};\n\nexport type ScopeRule = {\n /** Control path (as used by `hiddencontrols` / `readonlycontrols`) this rule applies to. */\n path: string;\n collection: ScopeCollection;\n /** Permission required to show the control. Defaults to `read`. */\n need?: 'read' | 'write' | 'resend';\n /** Show the control, but make it readonly when the user cannot write the collection. */\n readonlyIfNoWrite?: boolean;\n};\n\n/**\n * Parses a space-separated API token scope. Returns `null` when the scope does not restrict\n * store collections (no scope, `store_full_access`, or no collection tokens), meaning the UI\n * must stay unchanged.\n */\nexport function parseUserScope(scope: string | null | undefined): UserScope | null {\n const tokens = new Set((scope ?? '').split(/\\s+/).filter(token => token.length > 0));\n if (tokens.has('store_full_access')) return null;\n\n const isStoreScoped = COLLECTIONS.some(\n c => tokens.has(`${c}_read`) || tokens.has(`${c}_write`) || tokens.has(`${c}_resend`)\n );\n if (!isStoreScoped) return null;\n\n const canWrite = (c: ScopeCollection) =>\n tokens.has(`${c}_write`) || (c === 'users' && tokens.has('user_full_access'));\n\n return {\n canWrite,\n // A write scope satisfies a read or resend check in the API.\n canRead: c => canWrite(c) || tokens.has(`${c}_read`),\n canResend: c => canWrite(c) || tokens.has(`${c}_resend`),\n };\n}\n\n/**\n * Returns `true` when the scope can read the collection, or when the scope does not restrict\n * store collections at all (unset, `store_full_access`, no collection tokens).\n */\nexport function canReadCollection(\n scope: string | null | undefined,\n collection: ScopeCollection\n): boolean {\n return parseUserScope(scope)?.canRead(collection) ?? true;\n}\n\n/** Turns scope rules into control selectors to hide or make readonly. */\nexport function getScopeSelectors(\n scope: UserScope | null,\n rules: ScopeRule[],\n own: ScopeCollection | null\n): { hidden: string[]; readonly: string[]; readonlyAll: boolean } {\n const result = { hidden: [] as string[], readonly: [] as string[], readonlyAll: false };\n if (!scope) return result;\n\n const check = { read: scope.canRead, write: scope.canWrite, resend: scope.canResend };\n\n for (const { path, collection, need = 'read', readonlyIfNoWrite } of rules) {\n if (!check[need](collection)) result.hidden.push(path);\n else if (readonlyIfNoWrite && !scope.canWrite(collection)) result.readonly.push(path);\n }\n\n // Own collection with no read access is left alone: the API's \"Access denied\" covers it.\n if (own && scope.canRead(own) && !scope.canWrite(own)) {\n result.readonlyAll = true;\n result.hidden.push('delete', 'create');\n }\n\n return result;\n}\n\n/**\n * Collection that gates a zoomed rel. A rel that is not listed (items, discounts, applied\n * taxes, attributes...) belongs to its parent, which is already readable, so it is kept.\n */\nconst ZOOM_COLLECTIONS: Record<string, ScopeCollection> = {\n applied_gift_card_codes: 'gift_cards',\n billing_addresses: 'transactions',\n cart: 'carts',\n coupon: 'coupons',\n coupon_code: 'coupons',\n customer: 'customers',\n default_billing_address: 'customers',\n default_payment_method: 'customers',\n default_shipping_address: 'customers',\n downloadable: 'downloadables',\n email_template: 'templates',\n folder: 'transactions',\n gift_card: 'gift_cards',\n gift_card_code: 'gift_cards',\n gift_card_code_logs: 'gift_cards',\n item_category: 'item_categories',\n last_transaction: 'transactions',\n original_transaction: 'transactions',\n payments: 'transactions',\n shipments: 'transactions',\n store: 'stores',\n subscription: 'subscriptions',\n tax: 'taxes',\n template_set: 'templates',\n transaction: 'transactions',\n transaction_template: 'carts',\n};\n\n/**\n * Removes the zoom paths the scope can't read from a URL. The API denies the whole request\n * when one zoomed resource can't be read. Returns the URL unchanged when the scope does not\n * restrict store collections.\n */\nexport function filterZoom(url: string, scope: string | null | undefined): string {\n const userScope = parseUserScope(scope);\n if (!userScope || !url.includes('zoom=')) return url;\n\n const parsedURL = new URL(url);\n const paths = (parsedURL.searchParams.get('zoom') ?? '').split(',').filter(Boolean);\n const isReadable = (rel: string) => {\n const collection = ZOOM_COLLECTIONS[rel];\n return !collection || userScope.canRead(collection);\n };\n\n // Keep the readable start of each path: `items:item_category` becomes `items`.\n const trimmed = paths.map(path => {\n const rels = path.split(':');\n const end = rels.findIndex(rel => !isReadable(rel));\n return end === -1 ? path : rels.slice(0, end).join(':');\n });\n\n const kept = Array.from(new Set(trimmed.filter(Boolean)));\n if (kept.join(',') === paths.join(',')) return url;\n if (kept.length) parsedURL.searchParams.set('zoom', kept.join(','));\n else parsedURL.searchParams.delete('zoom');\n\n return parsedURL.toString();\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.59.1",
4
+ "version": "1.60.1",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1 +0,0 @@
1
- import{i as a}from"./shared-50ef1d5a.js";async function t(t){try{return await t}catch(t){if(t instanceof Response&&await a(t))return;throw t}}export{t as i};
@@ -1 +0,0 @@
1
- import"./foxy-spinner.js";import{I as e}from"./shared-20841d9c.js";customElements.define("foxy-internal-card",e);
@@ -1 +0,0 @@
1
- import{p as t,c as n}from"./shared-da3393a5.js";function r(t){return(null==t?void 0:t._links["fx:cart"])?"carts":(null==t?void 0:t._links["fx:transaction"])?"transactions":null}function s(r,s,a){var i;if(!t(r))return!0;const c=t=>n(r,t),o=null!==(i=null==s?void 0:s._links)&&void 0!==i?i:{};if(o["fx:transaction"]&&c("transactions"))return!0;return!(!c("carts")||!o["fx:cart"]&&(!o["fx:subscription"]||!c("subscriptions")))&&(!(a&&!a.currency_code)||!!c("templates")&&(""!==a.template_set_uri||c("stores")))}export{s as c,r as g};
@@ -1 +0,0 @@
1
- const s=["carts","coupons","customers","customer_portal_settings","downloadables","gift_cards","integrations","item_categories","payment_settings","reporting","shipping_integrations","shipping_settings","stores","subscriptions","subscription_settings","taxes","templates","transactions","user_invitations","webhooks"],e=["transactions","webhooks","taxes"];function t(t){const n=new Set((null!=t?t:"").split(/\s+/).filter((s=>s.length>0)));if(n.has("store_full_access"))return{storeFullAccess:!0,full:[],read:[],resend:[]};const a=[],r=[],o=[];return s.forEach((s=>{n.has(`${s}_write`)?a.push(s):n.has(`${s}_read`)&&r.push(s);e.includes(s)&&n.has(`${s}_resend`)&&o.push(s)})),{storeFullAccess:!1,full:a,read:r,resend:o}}function n(e){const t=new Set((null!=e?e:"").split(/\s+/).filter((s=>s.length>0)));if(t.has("store_full_access"))return null;if(!s.some((s=>t.has(`${s}_read`)||t.has(`${s}_write`)||t.has(`${s}_resend`))))return null;const n=s=>t.has(`${s}_write`)||"users"===s&&t.has("user_full_access");return{canWrite:n,canRead:s=>n(s)||t.has(`${s}_read`),canResend:s=>t.has(`${s}_resend`)}}function a(s,e){var t,a;return null===(a=null===(t=n(s))||void 0===t?void 0:t.canRead(e))||void 0===a||a}function r(s,e,t){const n={hidden:[],readonly:[],readonlyAll:!1};if(!s)return n;const a={read:s.canRead,write:s.canWrite,resend:s.canResend};for(const{path:t,collection:r,need:o="read",readonlyIfNoWrite:i}of e)a[o](r)?i&&!s.canWrite(r)&&n.readonly.push(t):n.hidden.push(t);return t&&s.canRead(t)&&!s.canWrite(t)&&(n.readonlyAll=!0,n.hidden.push("delete","create")),n}const o={applied_gift_card_codes:"gift_cards",billing_addresses:"transactions",cart:"carts",coupon:"coupons",coupon_code:"coupons",customer:"customers",default_billing_address:"customers",default_payment_method:"customers",default_shipping_address:"customers",downloadable:"downloadables",email_template:"templates",folder:"transactions",gift_card:"gift_cards",gift_card_code:"gift_cards",gift_card_code_logs:"gift_cards",item_category:"item_categories",last_transaction:"transactions",original_transaction:"transactions",payments:"transactions",shipments:"transactions",store:"stores",subscription:"subscriptions",tax:"taxes",template_set:"templates",transaction:"transactions",transaction_template:"carts"};function i(s,e){var t;const a=n(e);if(!a||!s.includes("zoom="))return s;const r=new URL(s),i=(null!==(t=r.searchParams.get("zoom"))&&void 0!==t?t:"").split(",").filter(Boolean),c=i.map((s=>{const e=s.split(":"),t=e.findIndex((s=>!(s=>{const e=o[s];return!e||a.canRead(e)})(s)));return-1===t?s:e.slice(0,t).join(":")})),l=Array.from(new Set(c.filter(Boolean)));return l.join(",")===i.join(",")?s:(l.length?r.searchParams.set("zoom",l.join(",")):r.searchParams.delete("zoom"),r.toString())}export{s as C,e as R,t as a,a as c,i as f,r as g,n as p};