@medusajs/loyalty-plugin 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (335) hide show
  1. package/.medusa/server/src/admin/components/action-menu.js +63 -0
  2. package/.medusa/server/src/admin/components/chip-group.js +82 -0
  3. package/.medusa/server/src/admin/components/chip-input.js +157 -0
  4. package/.medusa/server/src/admin/components/combobox.js +324 -0
  5. package/.medusa/server/src/admin/components/conditional-tooltip.js +15 -0
  6. package/.medusa/server/src/admin/components/data-grid/components/data-grid-boolean-cell.js +66 -0
  7. package/.medusa/server/src/admin/components/data-grid/components/data-grid-cell-container.js +77 -0
  8. package/.medusa/server/src/admin/components/data-grid/components/data-grid-currency-cell.js +110 -0
  9. package/.medusa/server/src/admin/components/data-grid/components/data-grid-duplicate-cell.js +16 -0
  10. package/.medusa/server/src/admin/components/data-grid/components/data-grid-keyboard-shortcut-modal.js +214 -0
  11. package/.medusa/server/src/admin/components/data-grid/components/data-grid-number-cell.js +77 -0
  12. package/.medusa/server/src/admin/components/data-grid/components/data-grid-readonly-cell.js +32 -0
  13. package/.medusa/server/src/admin/components/data-grid/components/data-grid-root.js +743 -0
  14. package/.medusa/server/src/admin/components/data-grid/components/data-grid-row-error-indicator.js +37 -0
  15. package/.medusa/server/src/admin/components/data-grid/components/data-grid-skeleton.js +54 -0
  16. package/.medusa/server/src/admin/components/data-grid/components/data-grid-text-cell.js +66 -0
  17. package/.medusa/server/src/admin/components/data-grid/components/data-grid-toggleable-number-cell.js +166 -0
  18. package/.medusa/server/src/admin/components/data-grid/components/index.js +16 -0
  19. package/.medusa/server/src/admin/components/data-grid/context/data-grid-context.js +7 -0
  20. package/.medusa/server/src/admin/components/data-grid/context/index.js +6 -0
  21. package/.medusa/server/src/admin/components/data-grid/context/use-data-grid-context.js +14 -0
  22. package/.medusa/server/src/admin/components/data-grid/data-grid.js +31 -0
  23. package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-column-helper.js +28 -0
  24. package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-price-columns.js +85 -0
  25. package/.medusa/server/src/admin/components/data-grid/helpers/index.js +6 -0
  26. package/.medusa/server/src/admin/components/data-grid/hooks/index.js +31 -0
  27. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-error.js +50 -0
  28. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-handlers.js +123 -0
  29. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-metadata.js +52 -0
  30. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-snapshot.js +43 -0
  31. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell.js +191 -0
  32. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-clipboard-events.js +70 -0
  33. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-column-visibility.js +51 -0
  34. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-duplicate-cell.js +15 -0
  35. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-error-highlighting.js +86 -0
  36. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-form-handlers.js +149 -0
  37. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-keydown-event.js +482 -0
  38. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-mouse-up-event.js +64 -0
  39. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-navigation.js +81 -0
  40. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-query-tool.js +14 -0
  41. package/.medusa/server/src/admin/components/data-grid/index.js +8 -0
  42. package/.medusa/server/src/admin/components/data-grid/models/data-grid-bulk-update-command.js +27 -0
  43. package/.medusa/server/src/admin/components/data-grid/models/data-grid-matrix.js +296 -0
  44. package/.medusa/server/src/admin/components/data-grid/models/data-grid-query-tool.js +62 -0
  45. package/.medusa/server/src/admin/components/data-grid/models/data-grid-update-command.js +25 -0
  46. package/.medusa/server/src/admin/components/data-grid/models/index.js +10 -0
  47. package/.medusa/server/src/admin/components/data-grid/types.js +1 -0
  48. package/.medusa/server/src/admin/components/data-grid/utils.js +18 -0
  49. package/.medusa/server/src/admin/components/data-table/components/data-table-status-cell/data-table-status-cell.js +36 -0
  50. package/.medusa/server/src/admin/components/data-table/data-table.js +271 -0
  51. package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-columns.js +51 -0
  52. package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-filters.js +90 -0
  53. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/index.js +10 -0
  54. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-columns.js +48 -0
  55. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-empty-state.js +19 -0
  56. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-filters.js +30 -0
  57. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-query.js +23 -0
  58. package/.medusa/server/src/admin/components/data-table/index.js +4 -0
  59. package/.medusa/server/src/admin/components/data-table.js +249 -0
  60. package/.medusa/server/src/admin/components/display-id.js +18 -0
  61. package/.medusa/server/src/admin/components/file-upload.js +116 -0
  62. package/.medusa/server/src/admin/components/form.js +151 -0
  63. package/.medusa/server/src/admin/components/handle-input.js +22 -0
  64. package/.medusa/server/src/admin/components/header.js +41 -0
  65. package/.medusa/server/src/admin/components/icon-avatar.js +27 -0
  66. package/.medusa/server/src/admin/components/json-view-section.js +139 -0
  67. package/.medusa/server/src/admin/components/keybound-form.js +32 -0
  68. package/.medusa/server/src/admin/components/layouts/single-column.js +7 -0
  69. package/.medusa/server/src/admin/components/layouts/two-column.js +13 -0
  70. package/.medusa/server/src/admin/components/listicle.js +20 -0
  71. package/.medusa/server/src/admin/components/modals/index.js +19 -0
  72. package/.medusa/server/src/admin/components/modals/route-drawer/index.js +4 -0
  73. package/.medusa/server/src/admin/components/modals/route-drawer/route-drawer.js +57 -0
  74. package/.medusa/server/src/admin/components/modals/route-focus-modal/index.js +4 -0
  75. package/.medusa/server/src/admin/components/modals/route-focus-modal/route-focus-modal.js +71 -0
  76. package/.medusa/server/src/admin/components/modals/route-modal-form/index.js +4 -0
  77. package/.medusa/server/src/admin/components/modals/route-modal-form/route-modal-form.js +60 -0
  78. package/.medusa/server/src/admin/components/modals/route-modal-provider/index.js +6 -0
  79. package/.medusa/server/src/admin/components/modals/route-modal-provider/route-modal-context.js +5 -0
  80. package/.medusa/server/src/admin/components/modals/route-modal-provider/route-provider.js +30 -0
  81. package/.medusa/server/src/admin/components/modals/route-modal-provider/use-route-modal.js +12 -0
  82. package/.medusa/server/src/admin/components/modals/stacked-drawer/index.js +5 -0
  83. package/.medusa/server/src/admin/components/modals/stacked-drawer/stacked-drawer.js +55 -0
  84. package/.medusa/server/src/admin/components/modals/stacked-focus-modal/index.js +5 -0
  85. package/.medusa/server/src/admin/components/modals/stacked-focus-modal/stacked-focus-modal.js +63 -0
  86. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/index.js +6 -0
  87. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-context.js +5 -0
  88. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-provider.js +47 -0
  89. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/use-stacked-modal.js +14 -0
  90. package/.medusa/server/src/admin/components/placeholder-cell.js +7 -0
  91. package/.medusa/server/src/admin/components/product/product-cell/index.js +5 -0
  92. package/.medusa/server/src/admin/components/product/product-cell/product-cell.js +15 -0
  93. package/.medusa/server/src/admin/components/product/product-status-cell/index.js +5 -0
  94. package/.medusa/server/src/admin/components/product/product-status-cell/product-status-cell.js +18 -0
  95. package/.medusa/server/src/admin/components/product/sales-channels-cell/index.js +5 -0
  96. package/.medusa/server/src/admin/components/product/sales-channels-cell/sales-channels-cell.js +31 -0
  97. package/.medusa/server/src/admin/components/product/variant-cell/index.js +5 -0
  98. package/.medusa/server/src/admin/components/product/variant-cell/variant-cell.js +15 -0
  99. package/.medusa/server/src/admin/components/section-row.js +32 -0
  100. package/.medusa/server/src/admin/components/sidebar-link.js +31 -0
  101. package/.medusa/server/src/admin/components/sortable-list.js +152 -0
  102. package/.medusa/server/src/admin/components/switch-box.js +43 -0
  103. package/.medusa/server/src/admin/components/tax-badge.js +18 -0
  104. package/.medusa/server/src/admin/components/thumbnail.js +28 -0
  105. package/.medusa/server/src/admin/components/upload-media-form-item.js +83 -0
  106. package/.medusa/server/src/admin/hooks/api/customers.js +26 -0
  107. package/.medusa/server/src/admin/hooks/api/gift-cards.js +107 -0
  108. package/.medusa/server/src/admin/hooks/api/order.js +16 -0
  109. package/.medusa/server/src/admin/hooks/api/price-preferences.js +19 -0
  110. package/.medusa/server/src/admin/hooks/api/products.js +127 -0
  111. package/.medusa/server/src/admin/hooks/api/regions.js +17 -0
  112. package/.medusa/server/src/admin/hooks/api/sales-channels.js +28 -0
  113. package/.medusa/server/src/admin/hooks/api/store-credit-accounts.js +41 -0
  114. package/.medusa/server/src/admin/hooks/api/store.js +31 -0
  115. package/.medusa/server/src/admin/hooks/api/transaction-groups.js +23 -0
  116. package/.medusa/server/src/admin/hooks/api/transactions.js +23 -0
  117. package/.medusa/server/src/admin/hooks/commands/use-command-history.js +45 -0
  118. package/.medusa/server/src/admin/hooks/common/use-combobox-data.js +59 -0
  119. package/.medusa/server/src/admin/hooks/common/use-data-table-date-filters.js +89 -0
  120. package/.medusa/server/src/admin/hooks/common/use-date.js +32 -0
  121. package/.medusa/server/src/admin/hooks/common/use-debounced-search.js +22 -0
  122. package/.medusa/server/src/admin/hooks/common/use-query-params.js +14 -0
  123. package/.medusa/server/src/admin/hooks/query/use-customers-filters.js +30 -0
  124. package/.medusa/server/src/admin/hooks/query/use-transaction-groups-filters.js +30 -0
  125. package/.medusa/server/src/admin/hooks/sales-channels/index.js +10 -0
  126. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-columns.js +48 -0
  127. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-empty-state.js +19 -0
  128. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-filters.js +30 -0
  129. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-query.js +23 -0
  130. package/.medusa/server/src/admin/lib/currencies.js +729 -0
  131. package/.medusa/server/src/admin/lib/query-key.js +17 -0
  132. package/.medusa/server/src/admin/lib/sdk.js +10 -0
  133. package/.medusa/server/src/admin/routes/gift-card-products/@create/page.js +75 -0
  134. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/components/gift-card-product-edit-denominations-form.js +172 -0
  135. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/page.js +30 -0
  136. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/components/gift-card-product-edit-form.js +180 -0
  137. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/page.js +30 -0
  138. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-general-section.js +97 -0
  139. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-media-section.js +162 -0
  140. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-sales-channel-section.js +89 -0
  141. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-variant-section.js +199 -0
  142. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/edit-product-media-form.js +353 -0
  143. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/index.js +5 -0
  144. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/index.js +4 -0
  145. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/product-media-gallery.js +247 -0
  146. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/index.js +4 -0
  147. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view-context.js +5 -0
  148. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view.js +48 -0
  149. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/use-product-media-view.js +14 -0
  150. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/page.js +28 -0
  151. package/.medusa/server/src/admin/routes/gift-card-products/_id_/page.js +40 -0
  152. package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/prices-edit.js +121 -0
  153. package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/variant-pricing-form.js +72 -0
  154. package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/page.js +23 -0
  155. package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/components/edit-sales-channel-form.js +123 -0
  156. package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/page.js +23 -0
  157. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/general-form-section.js +1 -0
  158. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-denominations-form.js +98 -0
  159. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-details-form.js +28 -0
  160. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-denominations.js +96 -0
  161. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-general.js +90 -0
  162. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-media.js +288 -0
  163. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-organize-section.js +111 -0
  164. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-organize.js +23 -0
  165. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form.js +285 -0
  166. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-sales-channel-stacked-modal.js +124 -0
  167. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/index.js +4 -0
  168. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/schema.js +112 -0
  169. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/types.js +1 -0
  170. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/columns.js +35 -0
  171. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/filters.js +11 -0
  172. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/gift-card-products-table.js +61 -0
  173. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/query.js +23 -0
  174. package/.medusa/server/src/admin/routes/gift-card-products/page.js +18 -0
  175. package/.medusa/server/src/admin/routes/gift-cards/_id_/@expiration/page.js +137 -0
  176. package/.medusa/server/src/admin/routes/gift-cards/_id_/@note/page.js +87 -0
  177. package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/components/transfer-icon.js +352 -0
  178. package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/page.js +116 -0
  179. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-balance-section.js +49 -0
  180. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-general-section.js +177 -0
  181. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-note-section.js +27 -0
  182. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-order-section.js +33 -0
  183. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-owner-section.js +33 -0
  184. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-transactions-section.js +18 -0
  185. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/columns.js +50 -0
  186. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/query.js +23 -0
  187. package/.medusa/server/src/admin/routes/gift-cards/_id_/page.js +78 -0
  188. package/.medusa/server/src/admin/routes/gift-cards/components/gift-card-products-section.js +40 -0
  189. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/columns.js +57 -0
  190. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/filters.js +13 -0
  191. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/gift-cards-table.js +61 -0
  192. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/query.js +23 -0
  193. package/.medusa/server/src/admin/routes/gift-cards/page.js +27 -0
  194. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/credit-card-icon.js +126 -0
  195. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-balance-section.js +31 -0
  196. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-details-section.js +43 -0
  197. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/columns.js +44 -0
  198. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/filters.js +18 -0
  199. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/query.js +37 -0
  200. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/table.js +58 -0
  201. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/page.js +39 -0
  202. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/columns.js +58 -0
  203. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/filters.js +13 -0
  204. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/query.js +31 -0
  205. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/table.js +56 -0
  206. package/.medusa/server/src/admin/routes/store-credit-accounts/page.js +19 -0
  207. package/.medusa/server/src/admin/utils/date-utils.js +27 -0
  208. package/.medusa/server/src/admin/utils/format-amount.js +9 -0
  209. package/.medusa/server/src/admin/utils/format-date.js +21 -0
  210. package/.medusa/server/src/admin/utils/refs.js +20 -0
  211. package/.medusa/server/src/admin/utils/statuses.js +23 -0
  212. package/.medusa/server/src/admin/utils/validations.js +71 -0
  213. package/.medusa/server/src/admin/utils/variants.js +92 -0
  214. package/.medusa/server/src/admin/widgets/customer-gift-cards-widget.js +67 -0
  215. package/.medusa/server/src/admin/widgets/customer-store-credit-widget.js +42 -0
  216. package/.medusa/server/src/admin/widgets/order-gift-cards-widget.js +58 -0
  217. package/.medusa/server/src/api/admin/gift-cards/[id]/redeem/route.js +25 -0
  218. package/.medusa/server/src/api/admin/gift-cards/[id]/route.js +41 -0
  219. package/.medusa/server/src/api/admin/gift-cards/[id]/transfer/route.js +24 -0
  220. package/.medusa/server/src/api/admin/gift-cards/middlewares.js +55 -0
  221. package/.medusa/server/src/api/admin/gift-cards/query-config.js +29 -0
  222. package/.medusa/server/src/api/admin/gift-cards/route.js +42 -0
  223. package/.medusa/server/src/api/admin/gift-cards/validators.js +69 -0
  224. package/.medusa/server/src/api/admin/store-credit-accounts/[id]/route.js +24 -0
  225. package/.medusa/server/src/api/admin/store-credit-accounts/[id]/transactions/route.js +23 -0
  226. package/.medusa/server/src/api/admin/store-credit-accounts/middlewares.js +38 -0
  227. package/.medusa/server/src/api/admin/store-credit-accounts/query-config.js +43 -0
  228. package/.medusa/server/src/api/admin/store-credit-accounts/route.js +52 -0
  229. package/.medusa/server/src/api/admin/store-credit-accounts/validators.js +51 -0
  230. package/.medusa/server/src/api/admin/transaction-groups/middlewares.js +16 -0
  231. package/.medusa/server/src/api/admin/transaction-groups/query-config.js +13 -0
  232. package/.medusa/server/src/api/admin/transaction-groups/route.js +27 -0
  233. package/.medusa/server/src/api/admin/transaction-groups/validators.js +19 -0
  234. package/.medusa/server/src/api/middlewares.js +22 -0
  235. package/.medusa/server/src/api/store/carts/[id]/gift-cards/route.js +43 -0
  236. package/.medusa/server/src/api/store/carts/middlewares.js +26 -0
  237. package/.medusa/server/src/api/store/carts/query-config.js +9 -0
  238. package/.medusa/server/src/api/store/carts/validators.js +15 -0
  239. package/.medusa/server/src/api/store/gift-card-invitations/[code]/accept/route.js +24 -0
  240. package/.medusa/server/src/api/store/gift-card-invitations/[code]/reject/route.js +24 -0
  241. package/.medusa/server/src/api/store/gift-card-invitations/middlewares.js +30 -0
  242. package/.medusa/server/src/api/store/gift-card-invitations/query-config.js +17 -0
  243. package/.medusa/server/src/api/store/gift-card-invitations/validators.js +14 -0
  244. package/.medusa/server/src/api/store/gift-cards/[id]/invitation/route.js +26 -0
  245. package/.medusa/server/src/api/store/gift-cards/[id]/redeem/route.js +24 -0
  246. package/.medusa/server/src/api/store/gift-cards/[id]/route.js +16 -0
  247. package/.medusa/server/src/api/store/gift-cards/middlewares.js +46 -0
  248. package/.medusa/server/src/api/store/gift-cards/query-config.js +26 -0
  249. package/.medusa/server/src/api/store/gift-cards/route.js +28 -0
  250. package/.medusa/server/src/api/store/gift-cards/validators.js +26 -0
  251. package/.medusa/server/src/api/store/store-credit-accounts/[id]/route.js +31 -0
  252. package/.medusa/server/src/api/store/store-credit-accounts/middlewares.js +28 -0
  253. package/.medusa/server/src/api/store/store-credit-accounts/query-config.js +24 -0
  254. package/.medusa/server/src/api/store/store-credit-accounts/route.js +40 -0
  255. package/.medusa/server/src/api/store/store-credit-accounts/validators.js +17 -0
  256. package/.medusa/server/src/links/cart-gift-cards-link.js +13 -0
  257. package/.medusa/server/src/links/customer-gift-card-link.js +13 -0
  258. package/.medusa/server/src/links/customer-store-credit-account-link.js +13 -0
  259. package/.medusa/server/src/links/order-gift-cards-link.js +13 -0
  260. package/.medusa/server/src/links/order-line-item-gift-card-link.js +19 -0
  261. package/.medusa/server/src/modules/loyalty/index.js +12 -0
  262. package/.medusa/server/src/modules/loyalty/migrations/Migration20250123130553.js +17 -0
  263. package/.medusa/server/src/modules/loyalty/migrations/Migration20250127174331.js +19 -0
  264. package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141026.js +19 -0
  265. package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141429.js +14 -0
  266. package/.medusa/server/src/modules/loyalty/migrations/Migration20250206144714.js +14 -0
  267. package/.medusa/server/src/modules/loyalty/models/gift-card-invitation.js +20 -0
  268. package/.medusa/server/src/modules/loyalty/models/gift-card.js +28 -0
  269. package/.medusa/server/src/modules/loyalty/service.js +15 -0
  270. package/.medusa/server/src/modules/store-credit/index.js +12 -0
  271. package/.medusa/server/src/modules/store-credit/migrations/Migration20250129115518.js +16 -0
  272. package/.medusa/server/src/modules/store-credit/migrations/Migration20250130213237.js +18 -0
  273. package/.medusa/server/src/modules/store-credit/migrations/Migration20250130220640.js +19 -0
  274. package/.medusa/server/src/modules/store-credit/migrations/Migration20250131205753.js +14 -0
  275. package/.medusa/server/src/modules/store-credit/models/account-transaction.js +27 -0
  276. package/.medusa/server/src/modules/store-credit/models/store-credit-account.js +29 -0
  277. package/.medusa/server/src/modules/store-credit/models/transaction-group.js +28 -0
  278. package/.medusa/server/src/modules/store-credit/service.js +412 -0
  279. package/.medusa/server/src/providers/index.js +12 -0
  280. package/.medusa/server/src/providers/store-credit-payment/index.js +12 -0
  281. package/.medusa/server/src/providers/store-credit-payment/service.js +181 -0
  282. package/.medusa/server/src/subscribers/create-gift-card.js +94 -0
  283. package/.medusa/server/src/types/cart/index.js +3 -0
  284. package/.medusa/server/src/types/http/gift-card.js +3 -0
  285. package/.medusa/server/src/types/http/index.js +21 -0
  286. package/.medusa/server/src/types/http/store-credit-account.js +3 -0
  287. package/.medusa/server/src/types/http/transaction-group.js +3 -0
  288. package/.medusa/server/src/types/http/transaction.js +3 -0
  289. package/.medusa/server/src/types/index.js +21 -0
  290. package/.medusa/server/src/types/loyalty/index.js +20 -0
  291. package/.medusa/server/src/types/loyalty/module.js +17 -0
  292. package/.medusa/server/src/types/loyalty/service.js +3 -0
  293. package/.medusa/server/src/types/loyalty/workflows.js +3 -0
  294. package/.medusa/server/src/types/modules.js +14 -0
  295. package/.medusa/server/src/types/store-credit/index.js +19 -0
  296. package/.medusa/server/src/types/store-credit/module.js +10 -0
  297. package/.medusa/server/src/types/store-credit/service.js +3 -0
  298. package/.medusa/server/src/workflows/carts/workflows/add-gift-card-to-cart.js +167 -0
  299. package/.medusa/server/src/workflows/carts/workflows/confirm-cart-credit-lines.js +95 -0
  300. package/.medusa/server/src/workflows/carts/workflows/refresh-cart-gift-cards.js +136 -0
  301. package/.medusa/server/src/workflows/carts/workflows/remove-gift-cart-from-cart.js +66 -0
  302. package/.medusa/server/src/workflows/common/steps/validate-presence-of.js +11 -0
  303. package/.medusa/server/src/workflows/gift-card-invitation/steps/create-gift-card-invitation.js +17 -0
  304. package/.medusa/server/src/workflows/gift-card-invitation/steps/delete-gift-card-invitation.js +20 -0
  305. package/.medusa/server/src/workflows/gift-card-invitation/steps/update-gift-card-invitation.js +31 -0
  306. package/.medusa/server/src/workflows/gift-card-invitation/workflows/accept-gift-card-invitation.js +79 -0
  307. package/.medusa/server/src/workflows/gift-card-invitation/workflows/create-gift-card-invitation.js +66 -0
  308. package/.medusa/server/src/workflows/gift-card-invitation/workflows/delete-gift-card-invitation.js +10 -0
  309. package/.medusa/server/src/workflows/gift-card-invitation/workflows/reject-gift-card-invitation.js +70 -0
  310. package/.medusa/server/src/workflows/gift-cards/steps/create-gift-cards.js +17 -0
  311. package/.medusa/server/src/workflows/gift-cards/steps/delete-gift-cards.js +17 -0
  312. package/.medusa/server/src/workflows/gift-cards/steps/retrieve-gift-card-balance.js +20 -0
  313. package/.medusa/server/src/workflows/gift-cards/steps/update-gift-cards.js +34 -0
  314. package/.medusa/server/src/workflows/gift-cards/workflows/create-gift-cards.js +12 -0
  315. package/.medusa/server/src/workflows/gift-cards/workflows/delete-gift-card.js +19 -0
  316. package/.medusa/server/src/workflows/gift-cards/workflows/redeem-gift-card.js +90 -0
  317. package/.medusa/server/src/workflows/gift-cards/workflows/transfer-gift-card.js +48 -0
  318. package/.medusa/server/src/workflows/gift-cards/workflows/update-gift-cards.js +12 -0
  319. package/.medusa/server/src/workflows/hooks/after-order-created.js +31 -0
  320. package/.medusa/server/src/workflows/hooks/after-order-credit-lines-created.js +31 -0
  321. package/.medusa/server/src/workflows/hooks/before-payment-collection-refresh.js +26 -0
  322. package/.medusa/server/src/workflows/hooks/complete-cart-before-payment-authorization.js +27 -0
  323. package/.medusa/server/src/workflows/orders/workflows/link-gift-cards-to-order.js +58 -0
  324. package/.medusa/server/src/workflows/orders/workflows/refund-gift-card-credit-lines.js +96 -0
  325. package/.medusa/server/src/workflows/store-credit/steps/create-store-credit-accounts.js +17 -0
  326. package/.medusa/server/src/workflows/store-credit/steps/create-transaction-groups.js +17 -0
  327. package/.medusa/server/src/workflows/store-credit/steps/credit-account.js +17 -0
  328. package/.medusa/server/src/workflows/store-credit/steps/debit-account.js +17 -0
  329. package/.medusa/server/src/workflows/store-credit/workflows/create-store-credit-accounts.js +57 -0
  330. package/.medusa/server/src/workflows/store-credit/workflows/create-transaction-groups.js +12 -0
  331. package/.medusa/server/src/workflows/store-credit/workflows/credit-accounts.js +12 -0
  332. package/.medusa/server/src/workflows/store-credit/workflows/debit-accounts.js +12 -0
  333. package/.medusa/server/types/loyalty/module.js +8 -0
  334. package/README.md +62 -0
  335. package/package.json +94 -0
@@ -0,0 +1,47 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { StackedModalContext } from "./stacked-modal-context.js";
4
+ const StackedModalProvider = ({
5
+ children,
6
+ onOpenChange
7
+ }) => {
8
+ const [state, setState] = useState({});
9
+ const getIsOpen = (id) => {
10
+ return state[id] || false;
11
+ };
12
+ const setIsOpen = (id, open) => {
13
+ setState((prevState) => ({
14
+ ...prevState,
15
+ [id]: open
16
+ }));
17
+ onOpenChange(open);
18
+ };
19
+ const register = (id) => {
20
+ setState((prevState) => ({
21
+ ...prevState,
22
+ [id]: false
23
+ }));
24
+ };
25
+ const unregister = (id) => {
26
+ setState((prevState) => {
27
+ const newState = { ...prevState };
28
+ delete newState[id];
29
+ return newState;
30
+ });
31
+ };
32
+ return /* @__PURE__ */ jsx(
33
+ StackedModalContext.Provider,
34
+ {
35
+ value: {
36
+ getIsOpen,
37
+ setIsOpen,
38
+ register,
39
+ unregister
40
+ },
41
+ children
42
+ }
43
+ );
44
+ };
45
+ export {
46
+ StackedModalProvider
47
+ };
@@ -0,0 +1,14 @@
1
+ import { useContext } from "react";
2
+ import { StackedModalContext } from "./stacked-modal-context.js";
3
+ const useStackedModal = () => {
4
+ const context = useContext(StackedModalContext);
5
+ if (!context) {
6
+ throw new Error(
7
+ "useStackedModal must be used within a StackedModalProvider"
8
+ );
9
+ }
10
+ return context;
11
+ };
12
+ export {
13
+ useStackedModal
14
+ };
@@ -0,0 +1,7 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ const PlaceholderCell = () => {
3
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx("span", { className: "text-ui-fg-muted", children: "-" }) });
4
+ };
5
+ export {
6
+ PlaceholderCell
7
+ };
@@ -0,0 +1,5 @@
1
+ import { ProductCell, ProductHeader } from "./product-cell.js";
2
+ export {
3
+ ProductCell,
4
+ ProductHeader
5
+ };
@@ -0,0 +1,15 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Thumbnail } from "../../thumbnail.js";
3
+ const ProductCell = ({ product }) => {
4
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full max-w-[250px] items-center gap-x-3 overflow-hidden", children: [
5
+ /* @__PURE__ */ jsx("div", { className: "w-fit flex-shrink-0", children: /* @__PURE__ */ jsx(Thumbnail, { src: product.thumbnail }) }),
6
+ /* @__PURE__ */ jsx("span", { title: product.title, className: "truncate", children: product.title })
7
+ ] });
8
+ };
9
+ const ProductHeader = () => {
10
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx("span", { children: "Product" }) });
11
+ };
12
+ export {
13
+ ProductCell,
14
+ ProductHeader
15
+ };
@@ -0,0 +1,5 @@
1
+ import { ProductStatusCell, ProductStatusHeader } from "./product-status-cell.js";
2
+ export {
3
+ ProductStatusCell,
4
+ ProductStatusHeader
5
+ };
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { StatusBadge } from "@medusajs/ui";
3
+ const ProductStatusCell = ({ status }) => {
4
+ const [color, text] = {
5
+ draft: ["grey", "Draft"],
6
+ proposed: ["orange", "Proposed"],
7
+ published: ["green", "Published"],
8
+ rejected: ["red", "Rejected"]
9
+ }[status];
10
+ return /* @__PURE__ */ jsx(StatusBadge, { color, children: text });
11
+ };
12
+ const ProductStatusHeader = () => {
13
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx("span", { children: "Status" }) });
14
+ };
15
+ export {
16
+ ProductStatusCell,
17
+ ProductStatusHeader
18
+ };
@@ -0,0 +1,5 @@
1
+ import { SalesChannelHeader, SalesChannelsCell } from "./sales-channels-cell.js";
2
+ export {
3
+ SalesChannelHeader,
4
+ SalesChannelsCell
5
+ };
@@ -0,0 +1,31 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Tooltip } from "@medusajs/ui";
3
+ import { PlaceholderCell } from "../../placeholder-cell.js";
4
+ const SalesChannelsCell = ({
5
+ salesChannels
6
+ }) => {
7
+ if (!salesChannels || !salesChannels.length) {
8
+ return /* @__PURE__ */ jsx(PlaceholderCell, {});
9
+ }
10
+ if (salesChannels.length > 2) {
11
+ return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full items-center gap-x-1 overflow-hidden", children: [
12
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: salesChannels.slice(0, 2).map((sc) => sc.name).join(", ") }),
13
+ /* @__PURE__ */ jsx(
14
+ Tooltip,
15
+ {
16
+ content: /* @__PURE__ */ jsx("ul", { children: salesChannels.slice(2).map((sc) => /* @__PURE__ */ jsx("li", { children: sc.name }, sc.id)) }),
17
+ children: /* @__PURE__ */ jsx("span", { className: "text-xs", children: `+ ${salesChannels.length - 2} more` })
18
+ }
19
+ )
20
+ ] });
21
+ }
22
+ const channels = salesChannels.map((sc) => sc.name).join(", ");
23
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center overflow-hidden max-w-[250px]", children: /* @__PURE__ */ jsx("span", { title: channels, className: "truncate", children: channels }) });
24
+ };
25
+ const SalesChannelHeader = () => {
26
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx("span", { children: "Sales Channels" }) });
27
+ };
28
+ export {
29
+ SalesChannelHeader,
30
+ SalesChannelsCell
31
+ };
@@ -0,0 +1,5 @@
1
+ import { VariantCell, VariantHeader } from "./variant-cell.js";
2
+ export {
3
+ VariantCell,
4
+ VariantHeader
5
+ };
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { PlaceholderCell } from "../../placeholder-cell.js";
3
+ const VariantCell = ({ variants }) => {
4
+ if (!variants || !variants.length) {
5
+ return /* @__PURE__ */ jsx(PlaceholderCell, {});
6
+ }
7
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: `${variants.length} denomination${variants.length > 1 ? "s" : ""}` }) });
8
+ };
9
+ const VariantHeader = () => {
10
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center", children: /* @__PURE__ */ jsx("span", { children: "Denominations" }) });
11
+ };
12
+ export {
13
+ VariantCell,
14
+ VariantHeader
15
+ };
@@ -0,0 +1,32 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { clx, Text } from "@medusajs/ui";
3
+ const SectionRow = ({ title, value, actions }) => {
4
+ const isValueString = typeof value === "string" || !value;
5
+ return /* @__PURE__ */ jsxs(
6
+ "div",
7
+ {
8
+ className: clx(
9
+ `text-ui-fg-subtle grid grid-cols-2 items-center px-6 py-4`,
10
+ {
11
+ "grid-cols-[1fr_1fr_28px]": !!actions
12
+ }
13
+ ),
14
+ children: [
15
+ /* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", leading: "compact", children: title }),
16
+ isValueString ? /* @__PURE__ */ jsx(
17
+ Text,
18
+ {
19
+ size: "small",
20
+ leading: "compact",
21
+ className: "whitespace-pre-line text-pretty",
22
+ children: value ?? "-"
23
+ }
24
+ ) : /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: value }),
25
+ actions && /* @__PURE__ */ jsx("div", { children: actions })
26
+ ]
27
+ }
28
+ );
29
+ };
30
+ export {
31
+ SectionRow
32
+ };
@@ -0,0 +1,31 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Link } from "react-router-dom";
3
+ import { TriangleRightMini } from "@medusajs/icons";
4
+ import { Text } from "@medusajs/ui";
5
+ const SidebarLink = ({
6
+ to,
7
+ labelKey,
8
+ descriptionKey,
9
+ icon,
10
+ children
11
+ }) => {
12
+ return /* @__PURE__ */ jsx(Link, { to, className: "group outline-none", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2 px-2 pb-2", children: /* @__PURE__ */ jsx("div", { className: "shadow-elevation-card-rest bg-ui-bg-component transition-fg hover:bg-ui-bg-component-hover active:bg-ui-bg-component-pressed group-focus-visible:shadow-borders-interactive-with-active rounded-md px-4 py-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
13
+ icon && /* @__PURE__ */ jsx("div", { children: icon }),
14
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col", children: [
15
+ /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "plus", children: labelKey }),
16
+ /* @__PURE__ */ jsx(
17
+ Text,
18
+ {
19
+ size: "small",
20
+ leading: "compact",
21
+ className: "text-ui-fg-subtle",
22
+ children: descriptionKey
23
+ }
24
+ )
25
+ ] }),
26
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: children ? children : /* @__PURE__ */ jsx(TriangleRightMini, { className: "text-ui-fg-muted" }) })
27
+ ] }) }) }) });
28
+ };
29
+ export {
30
+ SidebarLink
31
+ };
@@ -0,0 +1,152 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { defaultDropAnimationSideEffects, useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, DragOverlay } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/@dnd-kit/core/dist/core.esm.js";
3
+ import { sortableKeyboardCoordinates, SortableContext, useSortable, arrayMove } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/@dnd-kit/sortable/dist/sortable.esm.js";
4
+ import { CSS } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/@dnd-kit/utilities/dist/utilities.esm.js";
5
+ import { DotsSix } from "@medusajs/icons";
6
+ import { IconButton, clx } from "@medusajs/ui";
7
+ import { createContext, useState, useMemo, Fragment, useContext } from "react";
8
+ const List = ({
9
+ items,
10
+ onChange,
11
+ renderItem
12
+ }) => {
13
+ const [active, setActive] = useState(null);
14
+ const [activeItem, activeIndex] = useMemo(() => {
15
+ if (active === null) {
16
+ return [null, null];
17
+ }
18
+ const index = items.findIndex(({ id }) => id === active.id);
19
+ return [items[index], index];
20
+ }, [active, items]);
21
+ const sensors = useSensors(
22
+ useSensor(PointerSensor),
23
+ useSensor(KeyboardSensor, {
24
+ coordinateGetter: sortableKeyboardCoordinates
25
+ })
26
+ );
27
+ const handleDragStart = ({ active: active2 }) => {
28
+ setActive(active2);
29
+ };
30
+ const handleDragEnd = ({ active: active2, over }) => {
31
+ if (over && active2.id !== over.id) {
32
+ const activeIndex2 = items.findIndex(({ id }) => id === active2.id);
33
+ const overIndex = items.findIndex(({ id }) => id === over.id);
34
+ onChange(arrayMove(items, activeIndex2, overIndex));
35
+ }
36
+ setActive(null);
37
+ };
38
+ const handleDragCancel = () => {
39
+ setActive(null);
40
+ };
41
+ return /* @__PURE__ */ jsxs(
42
+ DndContext,
43
+ {
44
+ sensors,
45
+ onDragStart: handleDragStart,
46
+ onDragEnd: handleDragEnd,
47
+ onDragCancel: handleDragCancel,
48
+ children: [
49
+ /* @__PURE__ */ jsx(Overlay, { children: activeItem && activeIndex !== null ? renderItem(activeItem, activeIndex) : null }),
50
+ /* @__PURE__ */ jsx(SortableContext, { items, children: /* @__PURE__ */ jsx(
51
+ "ul",
52
+ {
53
+ role: "application",
54
+ className: "flex list-inside list-none list-image-none flex-col p-0",
55
+ children: items.map((item, index) => /* @__PURE__ */ jsx(Fragment, { children: renderItem(item, index) }, item.id))
56
+ }
57
+ ) })
58
+ ]
59
+ }
60
+ );
61
+ };
62
+ const dropAnimationConfig = {
63
+ sideEffects: defaultDropAnimationSideEffects({
64
+ styles: {
65
+ active: {
66
+ opacity: "0.4"
67
+ }
68
+ }
69
+ })
70
+ };
71
+ const Overlay = ({ children }) => {
72
+ return /* @__PURE__ */ jsx(
73
+ DragOverlay,
74
+ {
75
+ className: "shadow-elevation-card-hover overflow-hidden rounded-md [&>li]:border-b-0",
76
+ dropAnimation: dropAnimationConfig,
77
+ children
78
+ }
79
+ );
80
+ };
81
+ const SortableItemContext = createContext(
82
+ null
83
+ );
84
+ const useSortableItemContext = () => {
85
+ const context = useContext(SortableItemContext);
86
+ if (!context) {
87
+ throw new Error(
88
+ "useSortableItemContext must be used within a SortableItemContext"
89
+ );
90
+ }
91
+ return context;
92
+ };
93
+ const Item = ({
94
+ id,
95
+ className,
96
+ children
97
+ }) => {
98
+ const {
99
+ attributes,
100
+ isDragging,
101
+ listeners,
102
+ setNodeRef,
103
+ setActivatorNodeRef,
104
+ transform,
105
+ transition
106
+ } = useSortable({ id });
107
+ const context = useMemo(
108
+ () => ({
109
+ attributes,
110
+ listeners,
111
+ ref: setActivatorNodeRef,
112
+ isDragging
113
+ }),
114
+ [attributes, listeners, setActivatorNodeRef, isDragging]
115
+ );
116
+ const style = {
117
+ opacity: isDragging ? 0.4 : void 0,
118
+ transform: CSS.Translate.toString(transform),
119
+ transition
120
+ };
121
+ return /* @__PURE__ */ jsx(SortableItemContext.Provider, { value: context, children: /* @__PURE__ */ jsx(
122
+ "li",
123
+ {
124
+ className: clx("transition-fg flex flex-1 list-none", className),
125
+ ref: setNodeRef,
126
+ style,
127
+ children
128
+ }
129
+ ) });
130
+ };
131
+ const DragHandle = () => {
132
+ const { attributes, listeners, ref } = useSortableItemContext();
133
+ return /* @__PURE__ */ jsx(
134
+ IconButton,
135
+ {
136
+ variant: "transparent",
137
+ size: "small",
138
+ ...attributes,
139
+ ...listeners,
140
+ ref,
141
+ className: "cursor-grab touch-none active:cursor-grabbing",
142
+ children: /* @__PURE__ */ jsx(DotsSix, { className: "text-ui-fg-muted" })
143
+ }
144
+ );
145
+ };
146
+ const SortableList = Object.assign(List, {
147
+ Item,
148
+ DragHandle
149
+ });
150
+ export {
151
+ SortableList
152
+ };
@@ -0,0 +1,43 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Switch } from "@medusajs/ui";
3
+ import { Form } from "./form.js";
4
+ const SwitchBox = ({
5
+ label,
6
+ description,
7
+ optional = false,
8
+ tooltip,
9
+ onCheckedChange,
10
+ ...props
11
+ }) => {
12
+ return /* @__PURE__ */ jsx(
13
+ Form.Field,
14
+ {
15
+ ...props,
16
+ render: ({ field: { value, onChange, ...field } }) => {
17
+ return /* @__PURE__ */ jsxs(Form.Item, { children: [
18
+ /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-component shadow-elevation-card-rest flex items-start gap-x-3 rounded-lg p-3", children: [
19
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
20
+ Switch,
21
+ {
22
+ ...field,
23
+ checked: value,
24
+ onCheckedChange: (e) => {
25
+ onCheckedChange == null ? void 0 : onCheckedChange(e);
26
+ onChange(e);
27
+ }
28
+ }
29
+ ) }),
30
+ /* @__PURE__ */ jsxs("div", { children: [
31
+ /* @__PURE__ */ jsx(Form.Label, { optional, tooltip, children: label }),
32
+ /* @__PURE__ */ jsx(Form.Hint, { children: description })
33
+ ] })
34
+ ] }),
35
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
36
+ ] });
37
+ }
38
+ }
39
+ );
40
+ };
41
+ export {
42
+ SwitchBox
43
+ };
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { TaxInclusive, TaxExclusive } from "@medusajs/icons";
3
+ import { Tooltip } from "@medusajs/ui";
4
+ const IncludesTaxTooltip = ({
5
+ includesTax
6
+ }) => {
7
+ return /* @__PURE__ */ jsx(
8
+ Tooltip,
9
+ {
10
+ maxWidth: 999,
11
+ content: includesTax ? "Includes Tax" : "Excludes Tax",
12
+ children: includesTax ? /* @__PURE__ */ jsx(TaxInclusive, { className: "text-ui-fg-muted shrink-0" }) : /* @__PURE__ */ jsx(TaxExclusive, { className: "text-ui-fg-muted shrink-0" })
13
+ }
14
+ );
15
+ };
16
+ export {
17
+ IncludesTaxTooltip
18
+ };
@@ -0,0 +1,28 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Photo } from "@medusajs/icons";
3
+ import { clx } from "@medusajs/ui";
4
+ const Thumbnail = ({ src, alt, size = "base" }) => {
5
+ return /* @__PURE__ */ jsx(
6
+ "div",
7
+ {
8
+ className: clx(
9
+ "bg-ui-bg-component border-ui-border-base flex items-center justify-center overflow-hidden rounded border",
10
+ {
11
+ "h-8 w-6": size === "base",
12
+ "h-5 w-4": size === "small"
13
+ }
14
+ ),
15
+ children: src ? /* @__PURE__ */ jsx(
16
+ "img",
17
+ {
18
+ src,
19
+ alt,
20
+ className: "h-full w-full object-cover object-center"
21
+ }
22
+ ) : /* @__PURE__ */ jsx(Photo, { className: "text-ui-fg-subtle" })
23
+ }
24
+ );
25
+ };
26
+ export {
27
+ Thumbnail
28
+ };
@@ -0,0 +1,83 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { FileUpload } from "./file-upload.js";
4
+ import { Form } from "./form.js";
5
+ const SUPPORTED_FORMATS = [
6
+ "image/jpeg",
7
+ "image/png",
8
+ "image/gif",
9
+ "image/webp",
10
+ "image/heic",
11
+ "image/svg+xml"
12
+ ];
13
+ const SUPPORTED_FORMATS_FILE_EXTENSIONS = [
14
+ ".jpeg",
15
+ ".png",
16
+ ".gif",
17
+ ".webp",
18
+ ".heic",
19
+ ".svg"
20
+ ];
21
+ const UploadMediaFormItem = ({
22
+ form,
23
+ append,
24
+ showHint = true
25
+ }) => {
26
+ const hasInvalidFiles = useCallback(
27
+ (fileList) => {
28
+ const invalidFile = fileList.find(
29
+ (f) => !SUPPORTED_FORMATS.includes(f.file.type)
30
+ );
31
+ if (invalidFile) {
32
+ form.setError("media", {
33
+ type: "invalid_file",
34
+ message: `"'${invalidFile.file.name}' is not a supported file type. Supported file types are: ${SUPPORTED_FORMATS_FILE_EXTENSIONS.join(
35
+ ", "
36
+ )}.",`
37
+ });
38
+ return true;
39
+ }
40
+ return false;
41
+ },
42
+ [form]
43
+ );
44
+ const onUploaded = useCallback(
45
+ (files) => {
46
+ form.clearErrors("media");
47
+ if (hasInvalidFiles(files)) {
48
+ return;
49
+ }
50
+ files.forEach((f) => append({ ...f, isThumbnail: false }));
51
+ },
52
+ [form, append, hasInvalidFiles]
53
+ );
54
+ return /* @__PURE__ */ jsx(
55
+ Form.Field,
56
+ {
57
+ control: form.control,
58
+ name: "media",
59
+ render: () => {
60
+ return /* @__PURE__ */ jsx(Form.Item, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-2", children: [
61
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-1", children: [
62
+ /* @__PURE__ */ jsx(Form.Label, { optional: true, children: "Upload images" }),
63
+ showHint && /* @__PURE__ */ jsx(Form.Hint, { children: "Upload images for the gift card product" })
64
+ ] }),
65
+ /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
66
+ FileUpload,
67
+ {
68
+ label: "Upload images",
69
+ hint: "Upload images for the gift card product",
70
+ hasError: !!form.formState.errors.media,
71
+ formats: SUPPORTED_FORMATS,
72
+ onUploaded
73
+ }
74
+ ) }),
75
+ /* @__PURE__ */ jsx(Form.ErrorMessage, {})
76
+ ] }) });
77
+ }
78
+ }
79
+ );
80
+ };
81
+ export {
82
+ UploadMediaFormItem
83
+ };
@@ -0,0 +1,26 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { queryKeysFactory } from "../../lib/query-key.js";
3
+ import { sdk } from "../../lib/sdk.js";
4
+ const CUSTOMERS_QUERY_KEY = "customers";
5
+ const customersQueryKeys = queryKeysFactory(CUSTOMERS_QUERY_KEY);
6
+ const useCustomer = (id, query, options) => {
7
+ const { data, ...rest } = useQuery({
8
+ queryKey: customersQueryKeys.detail(id),
9
+ queryFn: async () => sdk.admin.customer.retrieve(id, query),
10
+ ...options
11
+ });
12
+ return { ...data, ...rest };
13
+ };
14
+ const useCustomers = (query, options) => {
15
+ const { data, ...rest } = useQuery({
16
+ queryFn: () => sdk.admin.customer.list(query),
17
+ queryKey: customersQueryKeys.list(query),
18
+ ...options
19
+ });
20
+ return { ...data, ...rest };
21
+ };
22
+ export {
23
+ customersQueryKeys,
24
+ useCustomer,
25
+ useCustomers
26
+ };