@medusajs/loyalty-plugin 0.0.1 → 0.0.3

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 (233) hide show
  1. package/.medusa/server/src/admin/index.js +30277 -0
  2. package/.medusa/server/src/admin/index.mjs +30256 -0
  3. package/.medusa/server/src/api/store/carts/[id]/store-credits/route.js +24 -0
  4. package/.medusa/server/src/api/store/carts/middlewares.js +9 -1
  5. package/.medusa/server/src/api/store/carts/validators.js +5 -2
  6. package/.medusa/server/src/links/customer-gift-card-link.js +2 -2
  7. package/.medusa/server/src/links/customer-store-credit-account-link.js +2 -2
  8. package/.medusa/server/src/links/order-line-item-gift-card-link.js +2 -2
  9. package/.medusa/server/src/workflows/carts/workflows/add-store-credits-to-cart.js +104 -0
  10. package/.medusa/server/src/workflows/hooks/after-order-created.js +2 -2
  11. package/.medusa/server/src/workflows/hooks/after-order-credit-lines-created.js +3 -3
  12. package/.medusa/server/src/workflows/hooks/before-payment-collection-refresh.js +1 -1
  13. package/.medusa/server/src/workflows/hooks/complete-cart-before-payment-authorization.js +1 -1
  14. package/.medusa/server/src/workflows/orders/workflows/refund-credit-lines.js +115 -0
  15. package/package.json +14 -9
  16. package/.medusa/server/src/admin/components/action-menu.js +0 -63
  17. package/.medusa/server/src/admin/components/chip-group.js +0 -82
  18. package/.medusa/server/src/admin/components/chip-input.js +0 -157
  19. package/.medusa/server/src/admin/components/combobox.js +0 -324
  20. package/.medusa/server/src/admin/components/conditional-tooltip.js +0 -15
  21. package/.medusa/server/src/admin/components/data-grid/components/data-grid-boolean-cell.js +0 -66
  22. package/.medusa/server/src/admin/components/data-grid/components/data-grid-cell-container.js +0 -77
  23. package/.medusa/server/src/admin/components/data-grid/components/data-grid-currency-cell.js +0 -110
  24. package/.medusa/server/src/admin/components/data-grid/components/data-grid-duplicate-cell.js +0 -16
  25. package/.medusa/server/src/admin/components/data-grid/components/data-grid-keyboard-shortcut-modal.js +0 -214
  26. package/.medusa/server/src/admin/components/data-grid/components/data-grid-number-cell.js +0 -77
  27. package/.medusa/server/src/admin/components/data-grid/components/data-grid-readonly-cell.js +0 -32
  28. package/.medusa/server/src/admin/components/data-grid/components/data-grid-root.js +0 -743
  29. package/.medusa/server/src/admin/components/data-grid/components/data-grid-row-error-indicator.js +0 -37
  30. package/.medusa/server/src/admin/components/data-grid/components/data-grid-skeleton.js +0 -54
  31. package/.medusa/server/src/admin/components/data-grid/components/data-grid-text-cell.js +0 -66
  32. package/.medusa/server/src/admin/components/data-grid/components/data-grid-toggleable-number-cell.js +0 -166
  33. package/.medusa/server/src/admin/components/data-grid/components/index.js +0 -16
  34. package/.medusa/server/src/admin/components/data-grid/context/data-grid-context.js +0 -7
  35. package/.medusa/server/src/admin/components/data-grid/context/index.js +0 -6
  36. package/.medusa/server/src/admin/components/data-grid/context/use-data-grid-context.js +0 -14
  37. package/.medusa/server/src/admin/components/data-grid/data-grid.js +0 -31
  38. package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-column-helper.js +0 -28
  39. package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-price-columns.js +0 -85
  40. package/.medusa/server/src/admin/components/data-grid/helpers/index.js +0 -6
  41. package/.medusa/server/src/admin/components/data-grid/hooks/index.js +0 -31
  42. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-error.js +0 -50
  43. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-handlers.js +0 -123
  44. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-metadata.js +0 -52
  45. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-snapshot.js +0 -43
  46. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell.js +0 -191
  47. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-clipboard-events.js +0 -70
  48. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-column-visibility.js +0 -51
  49. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-duplicate-cell.js +0 -15
  50. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-error-highlighting.js +0 -86
  51. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-form-handlers.js +0 -149
  52. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-keydown-event.js +0 -482
  53. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-mouse-up-event.js +0 -64
  54. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-navigation.js +0 -81
  55. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-query-tool.js +0 -14
  56. package/.medusa/server/src/admin/components/data-grid/index.js +0 -8
  57. package/.medusa/server/src/admin/components/data-grid/models/data-grid-bulk-update-command.js +0 -27
  58. package/.medusa/server/src/admin/components/data-grid/models/data-grid-matrix.js +0 -296
  59. package/.medusa/server/src/admin/components/data-grid/models/data-grid-query-tool.js +0 -62
  60. package/.medusa/server/src/admin/components/data-grid/models/data-grid-update-command.js +0 -25
  61. package/.medusa/server/src/admin/components/data-grid/models/index.js +0 -10
  62. package/.medusa/server/src/admin/components/data-grid/types.js +0 -1
  63. package/.medusa/server/src/admin/components/data-grid/utils.js +0 -18
  64. package/.medusa/server/src/admin/components/data-table/components/data-table-status-cell/data-table-status-cell.js +0 -36
  65. package/.medusa/server/src/admin/components/data-table/data-table.js +0 -271
  66. package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-columns.js +0 -51
  67. package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-filters.js +0 -90
  68. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/index.js +0 -10
  69. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-columns.js +0 -48
  70. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-empty-state.js +0 -19
  71. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-filters.js +0 -30
  72. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-query.js +0 -23
  73. package/.medusa/server/src/admin/components/data-table/index.js +0 -4
  74. package/.medusa/server/src/admin/components/data-table.js +0 -249
  75. package/.medusa/server/src/admin/components/display-id.js +0 -18
  76. package/.medusa/server/src/admin/components/file-upload.js +0 -116
  77. package/.medusa/server/src/admin/components/form.js +0 -151
  78. package/.medusa/server/src/admin/components/handle-input.js +0 -22
  79. package/.medusa/server/src/admin/components/header.js +0 -41
  80. package/.medusa/server/src/admin/components/icon-avatar.js +0 -27
  81. package/.medusa/server/src/admin/components/json-view-section.js +0 -139
  82. package/.medusa/server/src/admin/components/keybound-form.js +0 -32
  83. package/.medusa/server/src/admin/components/layouts/single-column.js +0 -7
  84. package/.medusa/server/src/admin/components/layouts/two-column.js +0 -13
  85. package/.medusa/server/src/admin/components/listicle.js +0 -20
  86. package/.medusa/server/src/admin/components/modals/index.js +0 -19
  87. package/.medusa/server/src/admin/components/modals/route-drawer/index.js +0 -4
  88. package/.medusa/server/src/admin/components/modals/route-drawer/route-drawer.js +0 -57
  89. package/.medusa/server/src/admin/components/modals/route-focus-modal/index.js +0 -4
  90. package/.medusa/server/src/admin/components/modals/route-focus-modal/route-focus-modal.js +0 -71
  91. package/.medusa/server/src/admin/components/modals/route-modal-form/index.js +0 -4
  92. package/.medusa/server/src/admin/components/modals/route-modal-form/route-modal-form.js +0 -60
  93. package/.medusa/server/src/admin/components/modals/route-modal-provider/index.js +0 -6
  94. package/.medusa/server/src/admin/components/modals/route-modal-provider/route-modal-context.js +0 -5
  95. package/.medusa/server/src/admin/components/modals/route-modal-provider/route-provider.js +0 -30
  96. package/.medusa/server/src/admin/components/modals/route-modal-provider/use-route-modal.js +0 -12
  97. package/.medusa/server/src/admin/components/modals/stacked-drawer/index.js +0 -5
  98. package/.medusa/server/src/admin/components/modals/stacked-drawer/stacked-drawer.js +0 -55
  99. package/.medusa/server/src/admin/components/modals/stacked-focus-modal/index.js +0 -5
  100. package/.medusa/server/src/admin/components/modals/stacked-focus-modal/stacked-focus-modal.js +0 -63
  101. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/index.js +0 -6
  102. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-context.js +0 -5
  103. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-provider.js +0 -47
  104. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/use-stacked-modal.js +0 -14
  105. package/.medusa/server/src/admin/components/placeholder-cell.js +0 -7
  106. package/.medusa/server/src/admin/components/product/product-cell/index.js +0 -5
  107. package/.medusa/server/src/admin/components/product/product-cell/product-cell.js +0 -15
  108. package/.medusa/server/src/admin/components/product/product-status-cell/index.js +0 -5
  109. package/.medusa/server/src/admin/components/product/product-status-cell/product-status-cell.js +0 -18
  110. package/.medusa/server/src/admin/components/product/sales-channels-cell/index.js +0 -5
  111. package/.medusa/server/src/admin/components/product/sales-channels-cell/sales-channels-cell.js +0 -31
  112. package/.medusa/server/src/admin/components/product/variant-cell/index.js +0 -5
  113. package/.medusa/server/src/admin/components/product/variant-cell/variant-cell.js +0 -15
  114. package/.medusa/server/src/admin/components/section-row.js +0 -32
  115. package/.medusa/server/src/admin/components/sidebar-link.js +0 -31
  116. package/.medusa/server/src/admin/components/sortable-list.js +0 -152
  117. package/.medusa/server/src/admin/components/switch-box.js +0 -43
  118. package/.medusa/server/src/admin/components/tax-badge.js +0 -18
  119. package/.medusa/server/src/admin/components/thumbnail.js +0 -28
  120. package/.medusa/server/src/admin/components/upload-media-form-item.js +0 -83
  121. package/.medusa/server/src/admin/hooks/api/customers.js +0 -26
  122. package/.medusa/server/src/admin/hooks/api/gift-cards.js +0 -107
  123. package/.medusa/server/src/admin/hooks/api/order.js +0 -16
  124. package/.medusa/server/src/admin/hooks/api/price-preferences.js +0 -19
  125. package/.medusa/server/src/admin/hooks/api/products.js +0 -127
  126. package/.medusa/server/src/admin/hooks/api/regions.js +0 -17
  127. package/.medusa/server/src/admin/hooks/api/sales-channels.js +0 -28
  128. package/.medusa/server/src/admin/hooks/api/store-credit-accounts.js +0 -41
  129. package/.medusa/server/src/admin/hooks/api/store.js +0 -31
  130. package/.medusa/server/src/admin/hooks/api/transaction-groups.js +0 -23
  131. package/.medusa/server/src/admin/hooks/api/transactions.js +0 -23
  132. package/.medusa/server/src/admin/hooks/commands/use-command-history.js +0 -45
  133. package/.medusa/server/src/admin/hooks/common/use-combobox-data.js +0 -59
  134. package/.medusa/server/src/admin/hooks/common/use-data-table-date-filters.js +0 -89
  135. package/.medusa/server/src/admin/hooks/common/use-date.js +0 -32
  136. package/.medusa/server/src/admin/hooks/common/use-debounced-search.js +0 -22
  137. package/.medusa/server/src/admin/hooks/common/use-query-params.js +0 -14
  138. package/.medusa/server/src/admin/hooks/query/use-customers-filters.js +0 -30
  139. package/.medusa/server/src/admin/hooks/query/use-transaction-groups-filters.js +0 -30
  140. package/.medusa/server/src/admin/hooks/sales-channels/index.js +0 -10
  141. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-columns.js +0 -48
  142. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-empty-state.js +0 -19
  143. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-filters.js +0 -30
  144. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-query.js +0 -23
  145. package/.medusa/server/src/admin/lib/currencies.js +0 -729
  146. package/.medusa/server/src/admin/lib/query-key.js +0 -17
  147. package/.medusa/server/src/admin/lib/sdk.js +0 -10
  148. package/.medusa/server/src/admin/routes/gift-card-products/@create/page.js +0 -75
  149. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/components/gift-card-product-edit-denominations-form.js +0 -172
  150. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/page.js +0 -30
  151. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/components/gift-card-product-edit-form.js +0 -180
  152. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/page.js +0 -30
  153. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-general-section.js +0 -97
  154. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-media-section.js +0 -162
  155. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-sales-channel-section.js +0 -89
  156. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-variant-section.js +0 -199
  157. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/edit-product-media-form.js +0 -353
  158. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/index.js +0 -5
  159. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/index.js +0 -4
  160. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/product-media-gallery.js +0 -247
  161. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/index.js +0 -4
  162. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view-context.js +0 -5
  163. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view.js +0 -48
  164. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/use-product-media-view.js +0 -14
  165. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/page.js +0 -28
  166. package/.medusa/server/src/admin/routes/gift-card-products/_id_/page.js +0 -40
  167. package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/prices-edit.js +0 -121
  168. package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/variant-pricing-form.js +0 -72
  169. package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/page.js +0 -23
  170. package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/components/edit-sales-channel-form.js +0 -123
  171. package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/page.js +0 -23
  172. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/general-form-section.js +0 -1
  173. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-denominations-form.js +0 -98
  174. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-details-form.js +0 -28
  175. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-denominations.js +0 -96
  176. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-general.js +0 -90
  177. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-media.js +0 -288
  178. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-organize-section.js +0 -111
  179. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-organize.js +0 -23
  180. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form.js +0 -285
  181. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-sales-channel-stacked-modal.js +0 -124
  182. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/index.js +0 -4
  183. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/schema.js +0 -112
  184. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/types.js +0 -1
  185. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/columns.js +0 -35
  186. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/filters.js +0 -11
  187. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/gift-card-products-table.js +0 -61
  188. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/query.js +0 -23
  189. package/.medusa/server/src/admin/routes/gift-card-products/page.js +0 -18
  190. package/.medusa/server/src/admin/routes/gift-cards/_id_/@expiration/page.js +0 -137
  191. package/.medusa/server/src/admin/routes/gift-cards/_id_/@note/page.js +0 -87
  192. package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/components/transfer-icon.js +0 -352
  193. package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/page.js +0 -116
  194. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-balance-section.js +0 -49
  195. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-general-section.js +0 -177
  196. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-note-section.js +0 -27
  197. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-order-section.js +0 -33
  198. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-owner-section.js +0 -33
  199. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-transactions-section.js +0 -18
  200. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/columns.js +0 -50
  201. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/query.js +0 -23
  202. package/.medusa/server/src/admin/routes/gift-cards/_id_/page.js +0 -78
  203. package/.medusa/server/src/admin/routes/gift-cards/components/gift-card-products-section.js +0 -40
  204. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/columns.js +0 -57
  205. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/filters.js +0 -13
  206. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/gift-cards-table.js +0 -61
  207. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/query.js +0 -23
  208. package/.medusa/server/src/admin/routes/gift-cards/page.js +0 -27
  209. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/credit-card-icon.js +0 -126
  210. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-balance-section.js +0 -31
  211. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-details-section.js +0 -43
  212. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/columns.js +0 -44
  213. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/filters.js +0 -18
  214. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/query.js +0 -37
  215. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/table.js +0 -58
  216. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/page.js +0 -39
  217. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/columns.js +0 -58
  218. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/filters.js +0 -13
  219. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/query.js +0 -31
  220. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/table.js +0 -56
  221. package/.medusa/server/src/admin/routes/store-credit-accounts/page.js +0 -19
  222. package/.medusa/server/src/admin/utils/date-utils.js +0 -27
  223. package/.medusa/server/src/admin/utils/format-amount.js +0 -9
  224. package/.medusa/server/src/admin/utils/format-date.js +0 -21
  225. package/.medusa/server/src/admin/utils/refs.js +0 -20
  226. package/.medusa/server/src/admin/utils/statuses.js +0 -23
  227. package/.medusa/server/src/admin/utils/validations.js +0 -71
  228. package/.medusa/server/src/admin/utils/variants.js +0 -92
  229. package/.medusa/server/src/admin/widgets/customer-gift-cards-widget.js +0 -67
  230. package/.medusa/server/src/admin/widgets/customer-store-credit-widget.js +0 -42
  231. package/.medusa/server/src/admin/widgets/order-gift-cards-widget.js +0 -58
  232. package/.medusa/server/src/workflows/orders/workflows/refund-gift-card-credit-lines.js +0 -96
  233. package/.medusa/server/types/loyalty/module.js +0 -8
@@ -1,137 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { zodResolver } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/@hookform/resolvers/zod/dist/zod.mjs";
3
- import { Heading, toast, RadioGroup, clx, DatePicker, Button } from "@medusajs/ui";
4
- import { useState } from "react";
5
- import { useForm } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
6
- import { useParams } from "react-router-dom";
7
- import { z } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/zod/lib/index.mjs";
8
- import { Form } from "../../../../components/form.js";
9
- import { KeyboundForm } from "../../../../components/keybound-form.js";
10
- import { RouteDrawer } from "../../../../components/modals/route-drawer/route-drawer.js";
11
- import "../../../../components/modals/route-focus-modal/route-focus-modal.js";
12
- import "../../../../components/modals/route-modal-provider/route-modal-context.js";
13
- import { useRouteModal } from "../../../../components/modals/route-modal-provider/use-route-modal.js";
14
- import "../../../../components/modals/stacked-drawer/stacked-drawer.js";
15
- import "../../../../components/modals/stacked-focus-modal/stacked-focus-modal.js";
16
- import "../../../../components/modals/stacked-modal-provider/stacked-modal-context.js";
17
- import { useGiftCard, useUpdateGiftCard } from "../../../../hooks/api/gift-cards.js";
18
- const GiftCardExpiration = () => {
19
- const { id } = useParams();
20
- const {
21
- gift_card: giftCard,
22
- isPending,
23
- isError,
24
- error
25
- } = useGiftCard(id, {});
26
- if (isError) {
27
- throw error;
28
- }
29
- const isReady = !isPending && !!giftCard;
30
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
31
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
32
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit expiration date" }) }),
33
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the expiration date for the gift card" }) })
34
- ] }),
35
- isReady && /* @__PURE__ */ jsx(GiftCardExpirationForm, { giftCard })
36
- ] });
37
- };
38
- const GiftCardExpirationForm = ({ giftCard }) => {
39
- const form = useForm({
40
- defaultValues: {
41
- expires_at: giftCard.expires_at ? new Date(giftCard.expires_at) : null
42
- },
43
- resolver: zodResolver(schema)
44
- });
45
- const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
46
- const { handleSuccess } = useRouteModal();
47
- const [isSettingExpiration, setIsSettingExpiration] = useState(
48
- !!giftCard.expires_at
49
- );
50
- const onSubmit = form.handleSubmit(async (data) => {
51
- var _a;
52
- await mutateAsync(
53
- {
54
- expires_at: isSettingExpiration ? (_a = data.expires_at) == null ? void 0 : _a.toISOString() : null
55
- },
56
- {
57
- onSuccess: () => {
58
- handleSuccess();
59
- },
60
- onError: (error) => {
61
- toast.error(error.message);
62
- }
63
- }
64
- );
65
- });
66
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
67
- KeyboundForm,
68
- {
69
- className: "flex flex-1 flex-col overflow-hidden",
70
- onSubmit,
71
- children: [
72
- /* @__PURE__ */ jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
73
- /* @__PURE__ */ jsxs(
74
- RadioGroup,
75
- {
76
- className: "flex flex-col gap-y-3",
77
- value: isSettingExpiration.toString(),
78
- onValueChange: (value) => setIsSettingExpiration(value === "true"),
79
- children: [
80
- /* @__PURE__ */ jsx(
81
- RadioGroup.ChoiceBox,
82
- {
83
- value: "false",
84
- description: "",
85
- label: "No expiration date",
86
- className: clx("basis-1/2")
87
- }
88
- ),
89
- /* @__PURE__ */ jsx(
90
- RadioGroup.ChoiceBox,
91
- {
92
- value: "true",
93
- label: "Set expiration date",
94
- description: "",
95
- className: clx("basis-1/2")
96
- }
97
- )
98
- ]
99
- }
100
- ),
101
- isSettingExpiration && /* @__PURE__ */ jsx(
102
- Form.Field,
103
- {
104
- control: form.control,
105
- name: "expires_at",
106
- render: ({ field }) => {
107
- return /* @__PURE__ */ jsxs(Form.Item, { children: [
108
- /* @__PURE__ */ jsx(Form.Label, { children: "Expiration date" }),
109
- /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
110
- DatePicker,
111
- {
112
- granularity: "minute",
113
- hourCycle: 12,
114
- shouldCloseOnSelect: false,
115
- ...field
116
- }
117
- ) }),
118
- /* @__PURE__ */ jsx(Form.ErrorMessage, {})
119
- ] });
120
- }
121
- }
122
- )
123
- ] }),
124
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
125
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
126
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
127
- ] }) })
128
- ]
129
- }
130
- ) });
131
- };
132
- const schema = z.object({
133
- expires_at: z.date().nullish()
134
- });
135
- export {
136
- GiftCardExpiration as default
137
- };
@@ -1,87 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { zodResolver } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/@hookform/resolvers/zod/dist/zod.mjs";
3
- import { Heading, toast, Textarea, Button } from "@medusajs/ui";
4
- import { useForm } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
5
- import { useParams } from "react-router-dom";
6
- import { z } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/zod/lib/index.mjs";
7
- import { Form } from "../../../../components/form.js";
8
- import { KeyboundForm } from "../../../../components/keybound-form.js";
9
- import { RouteDrawer } from "../../../../components/modals/route-drawer/route-drawer.js";
10
- import "../../../../components/modals/route-focus-modal/route-focus-modal.js";
11
- import "react";
12
- import "../../../../components/modals/route-modal-provider/route-modal-context.js";
13
- import { useRouteModal } from "../../../../components/modals/route-modal-provider/use-route-modal.js";
14
- import "../../../../components/modals/stacked-drawer/stacked-drawer.js";
15
- import "../../../../components/modals/stacked-focus-modal/stacked-focus-modal.js";
16
- import "../../../../components/modals/stacked-modal-provider/stacked-modal-context.js";
17
- import { useGiftCard, useUpdateGiftCard } from "../../../../hooks/api/gift-cards.js";
18
- const Note = () => {
19
- const { id } = useParams();
20
- const {
21
- gift_card: giftCard,
22
- isPending,
23
- isError,
24
- error
25
- } = useGiftCard(id, {});
26
- if (isError) {
27
- throw error;
28
- }
29
- const isReady = !isPending && !!giftCard;
30
- return /* @__PURE__ */ jsxs(RouteDrawer, { children: [
31
- /* @__PURE__ */ jsxs(RouteDrawer.Header, { children: [
32
- /* @__PURE__ */ jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Edit note" }) }),
33
- /* @__PURE__ */ jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit the note for the gift card" }) })
34
- ] }),
35
- isReady && /* @__PURE__ */ jsx(GiftCardNoteForm, { giftCard })
36
- ] });
37
- };
38
- const GiftCardNoteForm = ({ giftCard }) => {
39
- const form = useForm({
40
- defaultValues: {
41
- note: giftCard.note ?? ""
42
- },
43
- resolver: zodResolver(schema)
44
- });
45
- const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
46
- const { handleSuccess } = useRouteModal();
47
- const onSubmit = form.handleSubmit(async (data) => {
48
- await mutateAsync(
49
- { note: data.note },
50
- {
51
- onSuccess: () => handleSuccess(),
52
- onError: (error) => toast.error(error.message)
53
- }
54
- );
55
- });
56
- return /* @__PURE__ */ jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxs(
57
- KeyboundForm,
58
- {
59
- className: "flex flex-1 flex-col overflow-hidden",
60
- onSubmit,
61
- children: [
62
- /* @__PURE__ */ jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsx(
63
- Form.Field,
64
- {
65
- control: form.control,
66
- name: "note",
67
- render: ({ field }) => /* @__PURE__ */ jsxs(Form.Item, { children: [
68
- /* @__PURE__ */ jsx(Form.Label, { children: "Note" }),
69
- /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Textarea, { ...field }) }),
70
- /* @__PURE__ */ jsx(Form.ErrorMessage, {})
71
- ] })
72
- }
73
- ) }),
74
- /* @__PURE__ */ jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
75
- /* @__PURE__ */ jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
76
- /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
77
- ] }) })
78
- ]
79
- }
80
- ) });
81
- };
82
- const schema = z.object({
83
- note: z.string().optional()
84
- });
85
- export {
86
- Note as default
87
- };
@@ -1,352 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- const TransferIcon = () => /* @__PURE__ */ jsxs(
3
- "svg",
4
- {
5
- width: "514",
6
- height: "182",
7
- viewBox: "0 0 514 182",
8
- fill: "none",
9
- xmlns: "http://www.w3.org/2000/svg",
10
- children: [
11
- /* @__PURE__ */ jsx("rect", { x: "0.5", y: "0.5", width: "513", height: "181", rx: "6.5", fill: "#FAFAFA" }),
12
- /* @__PURE__ */ jsx("rect", { x: "0.5", y: "0.5", width: "513", height: "181", rx: "6.5", stroke: "#E4E4E7" }),
13
- /* @__PURE__ */ jsx(
14
- "rect",
15
- {
16
- x: "0.00428286",
17
- y: "-0.742904",
18
- width: "33.5",
19
- height: "65.5",
20
- rx: "6.75",
21
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 306.755 89.438)",
22
- fill: "#D4D4D8",
23
- stroke: "#52525B",
24
- "stroke-width": "1.5"
25
- }
26
- ),
27
- /* @__PURE__ */ jsx(
28
- "rect",
29
- {
30
- x: "0.00428286",
31
- y: "-0.742904",
32
- width: "33.5",
33
- height: "65.5",
34
- rx: "6.75",
35
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 306.755 86.438)",
36
- fill: "white",
37
- stroke: "#52525B",
38
- "stroke-width": "1.5"
39
- }
40
- ),
41
- /* @__PURE__ */ jsx(
42
- "path",
43
- {
44
- d: "M297.579 108.142L296.126 108.959",
45
- stroke: "#52525B",
46
- "stroke-width": "1.5",
47
- "stroke-linecap": "round",
48
- "stroke-linejoin": "round"
49
- }
50
- ),
51
- /* @__PURE__ */ jsx(
52
- "path",
53
- {
54
- opacity: "0.88",
55
- d: "M299.305 110.546L297.257 110.534",
56
- stroke: "#52525B",
57
- "stroke-width": "1.5",
58
- "stroke-linecap": "round",
59
- "stroke-linejoin": "round"
60
- }
61
- ),
62
- /* @__PURE__ */ jsx(
63
- "path",
64
- {
65
- opacity: "0.75",
66
- d: "M297.552 112.929L296.108 112.096",
67
- stroke: "#52525B",
68
- "stroke-width": "1.5",
69
- "stroke-linecap": "round",
70
- "stroke-linejoin": "round"
71
- }
72
- ),
73
- /* @__PURE__ */ jsx(
74
- "path",
75
- {
76
- opacity: "0.63",
77
- d: "M293.347 113.897L293.354 112.73",
78
- stroke: "#52525B",
79
- "stroke-width": "1.5",
80
- "stroke-linecap": "round",
81
- "stroke-linejoin": "round"
82
- }
83
- ),
84
- /* @__PURE__ */ jsx(
85
- "path",
86
- {
87
- opacity: "0.5",
88
- d: "M289.154 112.881L290.606 112.064",
89
- stroke: "#52525B",
90
- "stroke-width": "1.5",
91
- "stroke-linecap": "round",
92
- "stroke-linejoin": "round"
93
- }
94
- ),
95
- /* @__PURE__ */ jsx(
96
- "path",
97
- {
98
- opacity: "0.38",
99
- d: "M287.428 110.477L289.476 110.489",
100
- stroke: "#52525B",
101
- "stroke-width": "1.5",
102
- "stroke-linecap": "round",
103
- "stroke-linejoin": "round"
104
- }
105
- ),
106
- /* @__PURE__ */ jsx(
107
- "path",
108
- {
109
- opacity: "0.25",
110
- d: "M289.181 108.094L290.624 108.928",
111
- stroke: "#52525B",
112
- "stroke-width": "1.5",
113
- "stroke-linecap": "round",
114
- "stroke-linejoin": "round"
115
- }
116
- ),
117
- /* @__PURE__ */ jsx(
118
- "path",
119
- {
120
- opacity: "0.13",
121
- d: "M293.386 107.126L293.379 108.293",
122
- stroke: "#52525B",
123
- "stroke-width": "1.5",
124
- "stroke-linecap": "round",
125
- "stroke-linejoin": "round"
126
- }
127
- ),
128
- /* @__PURE__ */ jsx(
129
- "rect",
130
- {
131
- width: "12",
132
- height: "3",
133
- rx: "1.5",
134
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 313.446 93.2925)",
135
- fill: "#D4D4D8"
136
- }
137
- ),
138
- /* @__PURE__ */ jsx(
139
- "rect",
140
- {
141
- x: "0.00428286",
142
- y: "-0.742904",
143
- width: "33.5",
144
- height: "65.5",
145
- rx: "6.75",
146
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 234.023 47.4146)",
147
- fill: "#D4D4D8",
148
- stroke: "#52525B",
149
- "stroke-width": "1.5"
150
- }
151
- ),
152
- /* @__PURE__ */ jsx(
153
- "rect",
154
- {
155
- x: "0.00428286",
156
- y: "-0.742904",
157
- width: "33.5",
158
- height: "65.5",
159
- rx: "6.75",
160
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 234.023 44.4146)",
161
- fill: "white",
162
- stroke: "#52525B",
163
- "stroke-width": "1.5"
164
- }
165
- ),
166
- /* @__PURE__ */ jsx(
167
- "rect",
168
- {
169
- width: "12",
170
- height: "3",
171
- rx: "1.5",
172
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 240.714 51.269)",
173
- fill: "#D4D4D8"
174
- }
175
- ),
176
- /* @__PURE__ */ jsx(
177
- "rect",
178
- {
179
- width: "17",
180
- height: "3",
181
- rx: "1.5",
182
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 214.556 67.958)",
183
- fill: "#D4D4D8"
184
- }
185
- ),
186
- /* @__PURE__ */ jsx(
187
- "rect",
188
- {
189
- width: "12",
190
- height: "3",
191
- rx: "1.5",
192
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 210.197 70.4092)",
193
- fill: "#D4D4D8"
194
- }
195
- ),
196
- /* @__PURE__ */ jsx(
197
- "path",
198
- {
199
- d: "M209.36 64.9564C207.928 64.1287 205.59 64.1152 204.148 64.9264C202.706 65.7375 202.698 67.0703 204.131 67.898C205.563 68.7257 207.901 68.7392 209.343 67.928C210.785 67.1169 210.793 65.7841 209.36 64.9564ZM205.438 67.1626C204.722 66.7488 204.726 66.0822 205.447 65.6768C206.168 65.2713 207.337 65.2781 208.053 65.6918C208.769 66.1055 208.765 66.7722 208.044 67.1776C207.324 67.583 206.154 67.5763 205.438 67.1626Z",
200
- fill: "#A1A1AA"
201
- }
202
- ),
203
- /* @__PURE__ */ jsx(
204
- "rect",
205
- {
206
- width: "17",
207
- height: "3",
208
- rx: "1.5",
209
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 226.758 61.0942)",
210
- fill: "#A1A1AA"
211
- }
212
- ),
213
- /* @__PURE__ */ jsx(
214
- "rect",
215
- {
216
- width: "12",
217
- height: "3",
218
- rx: "1.5",
219
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 222.399 63.5454)",
220
- fill: "#A1A1AA"
221
- }
222
- ),
223
- /* @__PURE__ */ jsx(
224
- "path",
225
- {
226
- d: "M221.562 58.0926C220.13 57.2649 217.792 57.2514 216.35 58.0626C214.908 58.8737 214.9 60.2065 216.333 61.0342C217.766 61.8619 220.103 61.8754 221.545 61.0642C222.987 60.2531 222.995 58.9203 221.562 58.0926ZM220.858 59.8971L217.815 60.1265C217.683 60.1366 217.55 60.1133 217.449 60.0629C217.44 60.0584 217.432 60.0544 217.425 60.0499C217.339 60.0004 217.29 59.9335 217.291 59.8637L217.294 59.12C217.294 58.9751 217.501 58.8585 217.756 58.8599C218.01 58.8614 218.217 58.98 218.216 59.1256L218.214 59.5669L220.732 59.3768C220.984 59.3577 221.217 59.4584 221.251 59.6029C221.286 59.7468 221.11 59.8787 220.858 59.8976L220.858 59.8971Z",
227
- fill: "#52525B"
228
- }
229
- ),
230
- /* @__PURE__ */ jsx("g", { clipPath: "url(#clip0_28788_23850)", children: /* @__PURE__ */ jsx(
231
- "path",
232
- {
233
- d: "M250.105 82.8025L257.489 82.845L257.514 78.6353",
234
- stroke: "#A1A1AA",
235
- "stroke-width": "1.5",
236
- "stroke-linecap": "round",
237
- "stroke-linejoin": "round"
238
- }
239
- ) }),
240
- /* @__PURE__ */ jsx("g", { clipPath: "url(#clip1_28788_23850)", children: /* @__PURE__ */ jsx(
241
- "path",
242
- {
243
- d: "M260.496 88.8059L267.88 88.8485L267.904 84.6387",
244
- stroke: "#A1A1AA",
245
- "stroke-width": "1.5",
246
- "stroke-linecap": "round",
247
- "stroke-linejoin": "round"
248
- }
249
- ) }),
250
- /* @__PURE__ */ jsx("g", { clipPath: "url(#clip2_28788_23850)", children: /* @__PURE__ */ jsx(
251
- "path",
252
- {
253
- d: "M270.886 94.8093L278.27 94.8519L278.294 90.6421",
254
- stroke: "#A1A1AA",
255
- "stroke-width": "1.5",
256
- "stroke-linecap": "round",
257
- "stroke-linejoin": "round"
258
- }
259
- ) }),
260
- /* @__PURE__ */ jsx("g", { clipPath: "url(#clip3_28788_23850)", children: /* @__PURE__ */ jsx(
261
- "path",
262
- {
263
- d: "M243.113 90.1911L235.728 90.1486L235.704 94.3583",
264
- stroke: "#A1A1AA",
265
- "stroke-width": "1.5",
266
- "stroke-linecap": "round",
267
- "stroke-linejoin": "round"
268
- }
269
- ) }),
270
- /* @__PURE__ */ jsx("g", { clipPath: "url(#clip4_28788_23850)", children: /* @__PURE__ */ jsx(
271
- "path",
272
- {
273
- d: "M253.503 96.1945L246.119 96.152L246.095 100.362",
274
- stroke: "#A1A1AA",
275
- "stroke-width": "1.5",
276
- "stroke-linecap": "round",
277
- "stroke-linejoin": "round"
278
- }
279
- ) }),
280
- /* @__PURE__ */ jsx("g", { clipPath: "url(#clip5_28788_23850)", children: /* @__PURE__ */ jsx(
281
- "path",
282
- {
283
- d: "M263.893 102.198L256.509 102.155L256.484 106.365",
284
- stroke: "#A1A1AA",
285
- "stroke-width": "1.5",
286
- "stroke-linecap": "round",
287
- "stroke-linejoin": "round"
288
- }
289
- ) }),
290
- /* @__PURE__ */ jsxs("defs", { children: [
291
- /* @__PURE__ */ jsx("clipPath", { id: "clip0_28788_23850", children: /* @__PURE__ */ jsx(
292
- "rect",
293
- {
294
- width: "12",
295
- height: "12",
296
- fill: "white",
297
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 255.359 75.6509)"
298
- }
299
- ) }),
300
- /* @__PURE__ */ jsx("clipPath", { id: "clip1_28788_23850", children: /* @__PURE__ */ jsx(
301
- "rect",
302
- {
303
- width: "12",
304
- height: "12",
305
- fill: "white",
306
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 265.75 81.6543)"
307
- }
308
- ) }),
309
- /* @__PURE__ */ jsx("clipPath", { id: "clip2_28788_23850", children: /* @__PURE__ */ jsx(
310
- "rect",
311
- {
312
- width: "12",
313
- height: "12",
314
- fill: "white",
315
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 276.14 87.6577)"
316
- }
317
- ) }),
318
- /* @__PURE__ */ jsx("clipPath", { id: "clip3_28788_23850", children: /* @__PURE__ */ jsx(
319
- "rect",
320
- {
321
- width: "12",
322
- height: "12",
323
- fill: "white",
324
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 237.928 85.4561)"
325
- }
326
- ) }),
327
- /* @__PURE__ */ jsx("clipPath", { id: "clip4_28788_23850", children: /* @__PURE__ */ jsx(
328
- "rect",
329
- {
330
- width: "12",
331
- height: "12",
332
- fill: "white",
333
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 248.318 91.4595)"
334
- }
335
- ) }),
336
- /* @__PURE__ */ jsx("clipPath", { id: "clip5_28788_23850", children: /* @__PURE__ */ jsx(
337
- "rect",
338
- {
339
- width: "12",
340
- height: "12",
341
- fill: "white",
342
- transform: "matrix(0.865865 0.500278 -0.871576 0.490261 258.708 97.4629)"
343
- }
344
- ) })
345
- ] })
346
- ]
347
- }
348
- );
349
- export {
350
- TransferIcon,
351
- TransferIcon as default
352
- };