@medusajs/loyalty-plugin 0.0.1 → 0.0.2

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 (220) hide show
  1. package/.medusa/server/src/admin/index.js +30214 -0
  2. package/.medusa/server/src/admin/index.mjs +30193 -0
  3. package/package.json +14 -9
  4. package/.medusa/server/src/admin/components/action-menu.js +0 -63
  5. package/.medusa/server/src/admin/components/chip-group.js +0 -82
  6. package/.medusa/server/src/admin/components/chip-input.js +0 -157
  7. package/.medusa/server/src/admin/components/combobox.js +0 -324
  8. package/.medusa/server/src/admin/components/conditional-tooltip.js +0 -15
  9. package/.medusa/server/src/admin/components/data-grid/components/data-grid-boolean-cell.js +0 -66
  10. package/.medusa/server/src/admin/components/data-grid/components/data-grid-cell-container.js +0 -77
  11. package/.medusa/server/src/admin/components/data-grid/components/data-grid-currency-cell.js +0 -110
  12. package/.medusa/server/src/admin/components/data-grid/components/data-grid-duplicate-cell.js +0 -16
  13. package/.medusa/server/src/admin/components/data-grid/components/data-grid-keyboard-shortcut-modal.js +0 -214
  14. package/.medusa/server/src/admin/components/data-grid/components/data-grid-number-cell.js +0 -77
  15. package/.medusa/server/src/admin/components/data-grid/components/data-grid-readonly-cell.js +0 -32
  16. package/.medusa/server/src/admin/components/data-grid/components/data-grid-root.js +0 -743
  17. package/.medusa/server/src/admin/components/data-grid/components/data-grid-row-error-indicator.js +0 -37
  18. package/.medusa/server/src/admin/components/data-grid/components/data-grid-skeleton.js +0 -54
  19. package/.medusa/server/src/admin/components/data-grid/components/data-grid-text-cell.js +0 -66
  20. package/.medusa/server/src/admin/components/data-grid/components/data-grid-toggleable-number-cell.js +0 -166
  21. package/.medusa/server/src/admin/components/data-grid/components/index.js +0 -16
  22. package/.medusa/server/src/admin/components/data-grid/context/data-grid-context.js +0 -7
  23. package/.medusa/server/src/admin/components/data-grid/context/index.js +0 -6
  24. package/.medusa/server/src/admin/components/data-grid/context/use-data-grid-context.js +0 -14
  25. package/.medusa/server/src/admin/components/data-grid/data-grid.js +0 -31
  26. package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-column-helper.js +0 -28
  27. package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-price-columns.js +0 -85
  28. package/.medusa/server/src/admin/components/data-grid/helpers/index.js +0 -6
  29. package/.medusa/server/src/admin/components/data-grid/hooks/index.js +0 -31
  30. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-error.js +0 -50
  31. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-handlers.js +0 -123
  32. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-metadata.js +0 -52
  33. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-snapshot.js +0 -43
  34. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell.js +0 -191
  35. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-clipboard-events.js +0 -70
  36. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-column-visibility.js +0 -51
  37. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-duplicate-cell.js +0 -15
  38. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-error-highlighting.js +0 -86
  39. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-form-handlers.js +0 -149
  40. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-keydown-event.js +0 -482
  41. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-mouse-up-event.js +0 -64
  42. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-navigation.js +0 -81
  43. package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-query-tool.js +0 -14
  44. package/.medusa/server/src/admin/components/data-grid/index.js +0 -8
  45. package/.medusa/server/src/admin/components/data-grid/models/data-grid-bulk-update-command.js +0 -27
  46. package/.medusa/server/src/admin/components/data-grid/models/data-grid-matrix.js +0 -296
  47. package/.medusa/server/src/admin/components/data-grid/models/data-grid-query-tool.js +0 -62
  48. package/.medusa/server/src/admin/components/data-grid/models/data-grid-update-command.js +0 -25
  49. package/.medusa/server/src/admin/components/data-grid/models/index.js +0 -10
  50. package/.medusa/server/src/admin/components/data-grid/types.js +0 -1
  51. package/.medusa/server/src/admin/components/data-grid/utils.js +0 -18
  52. package/.medusa/server/src/admin/components/data-table/components/data-table-status-cell/data-table-status-cell.js +0 -36
  53. package/.medusa/server/src/admin/components/data-table/data-table.js +0 -271
  54. package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-columns.js +0 -51
  55. package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-filters.js +0 -90
  56. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/index.js +0 -10
  57. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-columns.js +0 -48
  58. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-empty-state.js +0 -19
  59. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-filters.js +0 -30
  60. package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-query.js +0 -23
  61. package/.medusa/server/src/admin/components/data-table/index.js +0 -4
  62. package/.medusa/server/src/admin/components/data-table.js +0 -249
  63. package/.medusa/server/src/admin/components/display-id.js +0 -18
  64. package/.medusa/server/src/admin/components/file-upload.js +0 -116
  65. package/.medusa/server/src/admin/components/form.js +0 -151
  66. package/.medusa/server/src/admin/components/handle-input.js +0 -22
  67. package/.medusa/server/src/admin/components/header.js +0 -41
  68. package/.medusa/server/src/admin/components/icon-avatar.js +0 -27
  69. package/.medusa/server/src/admin/components/json-view-section.js +0 -139
  70. package/.medusa/server/src/admin/components/keybound-form.js +0 -32
  71. package/.medusa/server/src/admin/components/layouts/single-column.js +0 -7
  72. package/.medusa/server/src/admin/components/layouts/two-column.js +0 -13
  73. package/.medusa/server/src/admin/components/listicle.js +0 -20
  74. package/.medusa/server/src/admin/components/modals/index.js +0 -19
  75. package/.medusa/server/src/admin/components/modals/route-drawer/index.js +0 -4
  76. package/.medusa/server/src/admin/components/modals/route-drawer/route-drawer.js +0 -57
  77. package/.medusa/server/src/admin/components/modals/route-focus-modal/index.js +0 -4
  78. package/.medusa/server/src/admin/components/modals/route-focus-modal/route-focus-modal.js +0 -71
  79. package/.medusa/server/src/admin/components/modals/route-modal-form/index.js +0 -4
  80. package/.medusa/server/src/admin/components/modals/route-modal-form/route-modal-form.js +0 -60
  81. package/.medusa/server/src/admin/components/modals/route-modal-provider/index.js +0 -6
  82. package/.medusa/server/src/admin/components/modals/route-modal-provider/route-modal-context.js +0 -5
  83. package/.medusa/server/src/admin/components/modals/route-modal-provider/route-provider.js +0 -30
  84. package/.medusa/server/src/admin/components/modals/route-modal-provider/use-route-modal.js +0 -12
  85. package/.medusa/server/src/admin/components/modals/stacked-drawer/index.js +0 -5
  86. package/.medusa/server/src/admin/components/modals/stacked-drawer/stacked-drawer.js +0 -55
  87. package/.medusa/server/src/admin/components/modals/stacked-focus-modal/index.js +0 -5
  88. package/.medusa/server/src/admin/components/modals/stacked-focus-modal/stacked-focus-modal.js +0 -63
  89. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/index.js +0 -6
  90. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-context.js +0 -5
  91. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-provider.js +0 -47
  92. package/.medusa/server/src/admin/components/modals/stacked-modal-provider/use-stacked-modal.js +0 -14
  93. package/.medusa/server/src/admin/components/placeholder-cell.js +0 -7
  94. package/.medusa/server/src/admin/components/product/product-cell/index.js +0 -5
  95. package/.medusa/server/src/admin/components/product/product-cell/product-cell.js +0 -15
  96. package/.medusa/server/src/admin/components/product/product-status-cell/index.js +0 -5
  97. package/.medusa/server/src/admin/components/product/product-status-cell/product-status-cell.js +0 -18
  98. package/.medusa/server/src/admin/components/product/sales-channels-cell/index.js +0 -5
  99. package/.medusa/server/src/admin/components/product/sales-channels-cell/sales-channels-cell.js +0 -31
  100. package/.medusa/server/src/admin/components/product/variant-cell/index.js +0 -5
  101. package/.medusa/server/src/admin/components/product/variant-cell/variant-cell.js +0 -15
  102. package/.medusa/server/src/admin/components/section-row.js +0 -32
  103. package/.medusa/server/src/admin/components/sidebar-link.js +0 -31
  104. package/.medusa/server/src/admin/components/sortable-list.js +0 -152
  105. package/.medusa/server/src/admin/components/switch-box.js +0 -43
  106. package/.medusa/server/src/admin/components/tax-badge.js +0 -18
  107. package/.medusa/server/src/admin/components/thumbnail.js +0 -28
  108. package/.medusa/server/src/admin/components/upload-media-form-item.js +0 -83
  109. package/.medusa/server/src/admin/hooks/api/customers.js +0 -26
  110. package/.medusa/server/src/admin/hooks/api/gift-cards.js +0 -107
  111. package/.medusa/server/src/admin/hooks/api/order.js +0 -16
  112. package/.medusa/server/src/admin/hooks/api/price-preferences.js +0 -19
  113. package/.medusa/server/src/admin/hooks/api/products.js +0 -127
  114. package/.medusa/server/src/admin/hooks/api/regions.js +0 -17
  115. package/.medusa/server/src/admin/hooks/api/sales-channels.js +0 -28
  116. package/.medusa/server/src/admin/hooks/api/store-credit-accounts.js +0 -41
  117. package/.medusa/server/src/admin/hooks/api/store.js +0 -31
  118. package/.medusa/server/src/admin/hooks/api/transaction-groups.js +0 -23
  119. package/.medusa/server/src/admin/hooks/api/transactions.js +0 -23
  120. package/.medusa/server/src/admin/hooks/commands/use-command-history.js +0 -45
  121. package/.medusa/server/src/admin/hooks/common/use-combobox-data.js +0 -59
  122. package/.medusa/server/src/admin/hooks/common/use-data-table-date-filters.js +0 -89
  123. package/.medusa/server/src/admin/hooks/common/use-date.js +0 -32
  124. package/.medusa/server/src/admin/hooks/common/use-debounced-search.js +0 -22
  125. package/.medusa/server/src/admin/hooks/common/use-query-params.js +0 -14
  126. package/.medusa/server/src/admin/hooks/query/use-customers-filters.js +0 -30
  127. package/.medusa/server/src/admin/hooks/query/use-transaction-groups-filters.js +0 -30
  128. package/.medusa/server/src/admin/hooks/sales-channels/index.js +0 -10
  129. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-columns.js +0 -48
  130. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-empty-state.js +0 -19
  131. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-filters.js +0 -30
  132. package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-query.js +0 -23
  133. package/.medusa/server/src/admin/lib/currencies.js +0 -729
  134. package/.medusa/server/src/admin/lib/query-key.js +0 -17
  135. package/.medusa/server/src/admin/lib/sdk.js +0 -10
  136. package/.medusa/server/src/admin/routes/gift-card-products/@create/page.js +0 -75
  137. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/components/gift-card-product-edit-denominations-form.js +0 -172
  138. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/page.js +0 -30
  139. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/components/gift-card-product-edit-form.js +0 -180
  140. package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/page.js +0 -30
  141. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-general-section.js +0 -97
  142. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-media-section.js +0 -162
  143. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-sales-channel-section.js +0 -89
  144. package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-variant-section.js +0 -199
  145. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/edit-product-media-form.js +0 -353
  146. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/index.js +0 -5
  147. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/index.js +0 -4
  148. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/product-media-gallery.js +0 -247
  149. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/index.js +0 -4
  150. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view-context.js +0 -5
  151. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view.js +0 -48
  152. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/use-product-media-view.js +0 -14
  153. package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/page.js +0 -28
  154. package/.medusa/server/src/admin/routes/gift-card-products/_id_/page.js +0 -40
  155. package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/prices-edit.js +0 -121
  156. package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/variant-pricing-form.js +0 -72
  157. package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/page.js +0 -23
  158. package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/components/edit-sales-channel-form.js +0 -123
  159. package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/page.js +0 -23
  160. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/general-form-section.js +0 -1
  161. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-denominations-form.js +0 -98
  162. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-details-form.js +0 -28
  163. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-denominations.js +0 -96
  164. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-general.js +0 -90
  165. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-media.js +0 -288
  166. 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
  167. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-organize.js +0 -23
  168. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form.js +0 -285
  169. 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
  170. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/index.js +0 -4
  171. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/schema.js +0 -112
  172. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/types.js +0 -1
  173. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/columns.js +0 -35
  174. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/filters.js +0 -11
  175. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/gift-card-products-table.js +0 -61
  176. package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/query.js +0 -23
  177. package/.medusa/server/src/admin/routes/gift-card-products/page.js +0 -18
  178. package/.medusa/server/src/admin/routes/gift-cards/_id_/@expiration/page.js +0 -137
  179. package/.medusa/server/src/admin/routes/gift-cards/_id_/@note/page.js +0 -87
  180. package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/components/transfer-icon.js +0 -352
  181. package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/page.js +0 -116
  182. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-balance-section.js +0 -49
  183. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-general-section.js +0 -177
  184. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-note-section.js +0 -27
  185. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-order-section.js +0 -33
  186. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-owner-section.js +0 -33
  187. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-transactions-section.js +0 -18
  188. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/columns.js +0 -50
  189. package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/query.js +0 -23
  190. package/.medusa/server/src/admin/routes/gift-cards/_id_/page.js +0 -78
  191. package/.medusa/server/src/admin/routes/gift-cards/components/gift-card-products-section.js +0 -40
  192. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/columns.js +0 -57
  193. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/filters.js +0 -13
  194. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/gift-cards-table.js +0 -61
  195. package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/query.js +0 -23
  196. package/.medusa/server/src/admin/routes/gift-cards/page.js +0 -27
  197. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/credit-card-icon.js +0 -126
  198. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-balance-section.js +0 -31
  199. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-details-section.js +0 -43
  200. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/columns.js +0 -44
  201. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/filters.js +0 -18
  202. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/query.js +0 -37
  203. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/table.js +0 -58
  204. package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/page.js +0 -39
  205. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/columns.js +0 -58
  206. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/filters.js +0 -13
  207. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/query.js +0 -31
  208. package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/table.js +0 -56
  209. package/.medusa/server/src/admin/routes/store-credit-accounts/page.js +0 -19
  210. package/.medusa/server/src/admin/utils/date-utils.js +0 -27
  211. package/.medusa/server/src/admin/utils/format-amount.js +0 -9
  212. package/.medusa/server/src/admin/utils/format-date.js +0 -21
  213. package/.medusa/server/src/admin/utils/refs.js +0 -20
  214. package/.medusa/server/src/admin/utils/statuses.js +0 -23
  215. package/.medusa/server/src/admin/utils/validations.js +0 -71
  216. package/.medusa/server/src/admin/utils/variants.js +0 -92
  217. package/.medusa/server/src/admin/widgets/customer-gift-cards-widget.js +0 -67
  218. package/.medusa/server/src/admin/widgets/customer-store-credit-widget.js +0 -42
  219. package/.medusa/server/src/admin/widgets/order-gift-cards-widget.js +0 -58
  220. package/.medusa/server/types/loyalty/module.js +0 -8
@@ -1,90 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { Text, Input, Textarea } from "@medusajs/ui";
3
- import { Form } from "../../../../components/form.js";
4
- import { HandleInput } from "../../../../components/handle-input.js";
5
- const GiftCardProductCreateFormGeneral = ({
6
- form
7
- }) => {
8
- return /* @__PURE__ */ jsxs("div", { id: "general", className: "grid grid-cols-1 gap-y-6 md:grid-cols-2", children: [
9
- /* @__PURE__ */ jsxs("div", { children: [
10
- /* @__PURE__ */ jsx(
11
- Text,
12
- {
13
- className: "txt-compact-small-plus text-ui-fg-base",
14
- weight: "regular",
15
- children: "General details"
16
- }
17
- ),
18
- /* @__PURE__ */ jsx(Text, { className: "txt-small text-ui-fg-muted", children: "Provide details about the gift card product" })
19
- ] }),
20
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-3", children: [
21
- /* @__PURE__ */ jsx(
22
- Form.Field,
23
- {
24
- control: form.control,
25
- name: "title",
26
- render: ({ field }) => {
27
- return /* @__PURE__ */ jsxs(Form.Item, { children: [
28
- /* @__PURE__ */ jsx(Form.Label, { className: "font-normal", children: "Title" }),
29
- /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(Input, { ...field, placeholder: "Medusa Gift Card" }) })
30
- ] });
31
- }
32
- }
33
- ),
34
- /* @__PURE__ */ jsx(
35
- Form.Field,
36
- {
37
- control: form.control,
38
- name: "subtitle",
39
- render: ({ field }) => {
40
- return /* @__PURE__ */ jsxs(Form.Item, { children: [
41
- /* @__PURE__ */ jsx(Form.Label, { className: "font-normal", optional: true, children: "Subtitle" }),
42
- /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
43
- Input,
44
- {
45
- ...field,
46
- placeholder: "Gift Card for your friends & family"
47
- }
48
- ) })
49
- ] });
50
- }
51
- }
52
- ),
53
- /* @__PURE__ */ jsx(
54
- Form.Field,
55
- {
56
- control: form.control,
57
- name: "handle",
58
- render: ({ field }) => {
59
- return /* @__PURE__ */ jsxs(Form.Item, { children: [
60
- /* @__PURE__ */ jsx(Form.Label, { className: "font-normal", optional: true, children: "Handle" }),
61
- /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(HandleInput, { ...field, placeholder: "medusa-gift-card" }) })
62
- ] });
63
- }
64
- }
65
- ),
66
- /* @__PURE__ */ jsx(
67
- Form.Field,
68
- {
69
- control: form.control,
70
- name: "description",
71
- render: ({ field }) => {
72
- return /* @__PURE__ */ jsxs(Form.Item, { children: [
73
- /* @__PURE__ */ jsx(Form.Label, { className: "font-normal", optional: true, children: "Description" }),
74
- /* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
75
- Textarea,
76
- {
77
- ...field,
78
- placeholder: "Bring joy to your friends and family this holiday season with the Medusa Gift Card"
79
- }
80
- ) })
81
- ] });
82
- }
83
- }
84
- )
85
- ] })
86
- ] });
87
- };
88
- export {
89
- GiftCardProductCreateFormGeneral
90
- };
@@ -1,288 +0,0 @@
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, arrayMove, useSortable } 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, ThumbnailBadge, XMark, StackPerspective, Trash } from "@medusajs/icons";
6
- import { Text, IconButton } from "@medusajs/ui";
7
- import { useState } from "react";
8
- import { useFieldArray } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
9
- import { ActionMenu } from "../../../../components/action-menu.js";
10
- import { UploadMediaFormItem } from "../../../../components/upload-media-form-item.js";
11
- const dropAnimationConfig = {
12
- sideEffects: defaultDropAnimationSideEffects({
13
- styles: {
14
- active: {
15
- opacity: "0.4"
16
- }
17
- }
18
- })
19
- };
20
- const GiftCardProductCreateFormMedia = ({
21
- form
22
- }) => {
23
- const { fields, append, remove } = useFieldArray({
24
- name: "media",
25
- control: form.control,
26
- keyName: "field_id"
27
- });
28
- const [activeId, setActiveId] = useState(null);
29
- const sensors = useSensors(
30
- useSensor(PointerSensor),
31
- useSensor(KeyboardSensor, {
32
- coordinateGetter: sortableKeyboardCoordinates
33
- })
34
- );
35
- const handleDragStart = (event) => {
36
- setActiveId(event.active.id);
37
- };
38
- const handleDragEnd = (event) => {
39
- setActiveId(null);
40
- const { active, over } = event;
41
- if (active.id !== (over == null ? void 0 : over.id)) {
42
- const oldIndex = fields.findIndex((item) => item.field_id === active.id);
43
- const newIndex = fields.findIndex((item) => item.field_id === (over == null ? void 0 : over.id));
44
- form.setValue("media", arrayMove(fields, oldIndex, newIndex), {
45
- shouldDirty: true,
46
- shouldTouch: true
47
- });
48
- }
49
- };
50
- const handleDragCancel = () => {
51
- setActiveId(null);
52
- };
53
- const getOnDelete = (index) => {
54
- return () => {
55
- remove(index);
56
- };
57
- };
58
- const getMakeThumbnail = (index) => {
59
- return () => {
60
- const newFields = fields.map((field, i) => {
61
- return {
62
- ...field,
63
- isThumbnail: i === index
64
- };
65
- });
66
- form.setValue("media", newFields, {
67
- shouldDirty: true,
68
- shouldTouch: true
69
- });
70
- };
71
- };
72
- const getItemHandlers = (index) => {
73
- return {
74
- onDelete: getOnDelete(index),
75
- onMakeThumbnail: getMakeThumbnail(index)
76
- };
77
- };
78
- return /* @__PURE__ */ jsxs("div", { id: "media", className: "grid grid-cols-1 gap-y-6 md:grid-cols-2 pt-6", children: [
79
- /* @__PURE__ */ jsxs("div", { children: [
80
- /* @__PURE__ */ jsx(
81
- Text,
82
- {
83
- className: "txt-compact-small-plus text-ui-fg-base",
84
- weight: "regular",
85
- children: "Images"
86
- }
87
- ),
88
- /* @__PURE__ */ jsx(Text, { className: "txt-small text-ui-fg-muted", children: "Upload images to be used as gift card product images" })
89
- ] }),
90
- /* @__PURE__ */ jsxs("div", { children: [
91
- /* @__PURE__ */ jsx(UploadMediaFormItem, { form, append, showHint: false }),
92
- /* @__PURE__ */ jsxs(
93
- DndContext,
94
- {
95
- sensors,
96
- onDragEnd: handleDragEnd,
97
- onDragStart: handleDragStart,
98
- onDragCancel: handleDragCancel,
99
- children: [
100
- /* @__PURE__ */ jsx(DragOverlay, { dropAnimation: dropAnimationConfig, children: activeId ? /* @__PURE__ */ jsx(
101
- MediaGridItemOverlay,
102
- {
103
- field: fields.find((m) => m.field_id === activeId)
104
- }
105
- ) : null }),
106
- /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-y-2 mt-2", children: /* @__PURE__ */ jsx(SortableContext, { items: fields.map((field) => field.field_id), children: fields.map((field, index) => {
107
- const { onDelete, onMakeThumbnail } = getItemHandlers(index);
108
- return /* @__PURE__ */ jsx(
109
- MediaItem,
110
- {
111
- field,
112
- onDelete,
113
- onMakeThumbnail
114
- },
115
- field.field_id
116
- );
117
- }) }) })
118
- ]
119
- }
120
- )
121
- ] })
122
- ] });
123
- };
124
- const MediaItem = ({ field, onDelete, onMakeThumbnail }) => {
125
- const {
126
- attributes,
127
- listeners,
128
- setNodeRef,
129
- setActivatorNodeRef,
130
- transform,
131
- transition,
132
- isDragging
133
- } = useSortable({ id: field.field_id });
134
- const style = {
135
- opacity: isDragging ? 0.4 : void 0,
136
- transform: CSS.Translate.toString(transform),
137
- transition
138
- };
139
- if (!field.file) {
140
- return null;
141
- }
142
- return /* @__PURE__ */ jsxs(
143
- "li",
144
- {
145
- className: "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2",
146
- ref: setNodeRef,
147
- style,
148
- children: [
149
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
150
- /* @__PURE__ */ jsx(
151
- IconButton,
152
- {
153
- variant: "transparent",
154
- type: "button",
155
- size: "small",
156
- ...attributes,
157
- ...listeners,
158
- ref: setActivatorNodeRef,
159
- className: "cursor-grab touch-none active:cursor-grabbing",
160
- children: /* @__PURE__ */ jsx(DotsSix, { className: "text-ui-fg-muted" })
161
- }
162
- ),
163
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
164
- /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-base h-10 w-[30px] overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(ThumbnailPreview, { url: field.url }) }),
165
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
166
- /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: field.file.name }),
167
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
168
- field.isThumbnail && /* @__PURE__ */ jsx(ThumbnailBadge, {}),
169
- /* @__PURE__ */ jsx(
170
- Text,
171
- {
172
- size: "xsmall",
173
- leading: "compact",
174
- className: "text-ui-fg-subtle",
175
- children: formatFileSize(field.file.size)
176
- }
177
- )
178
- ] })
179
- ] })
180
- ] })
181
- ] }),
182
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
183
- /* @__PURE__ */ jsx(
184
- ActionMenu,
185
- {
186
- groups: [
187
- {
188
- actions: [
189
- {
190
- label: "Make thumbnail",
191
- icon: /* @__PURE__ */ jsx(StackPerspective, {}),
192
- onClick: onMakeThumbnail
193
- }
194
- ]
195
- },
196
- {
197
- actions: [
198
- {
199
- icon: /* @__PURE__ */ jsx(Trash, {}),
200
- label: "Delete",
201
- onClick: onDelete
202
- }
203
- ]
204
- }
205
- ]
206
- }
207
- ),
208
- /* @__PURE__ */ jsx(
209
- IconButton,
210
- {
211
- type: "button",
212
- size: "small",
213
- variant: "transparent",
214
- onClick: onDelete,
215
- children: /* @__PURE__ */ jsx(XMark, {})
216
- }
217
- )
218
- ] })
219
- ]
220
- }
221
- );
222
- };
223
- const MediaGridItemOverlay = ({ field }) => {
224
- var _a, _b;
225
- return /* @__PURE__ */ jsxs("li", { className: "bg-ui-bg-component shadow-elevation-card-rest flex items-center justify-between rounded-lg px-3 py-2", children: [
226
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
227
- /* @__PURE__ */ jsx(
228
- IconButton,
229
- {
230
- variant: "transparent",
231
- size: "small",
232
- className: "cursor-grab touch-none active:cursor-grabbing",
233
- children: /* @__PURE__ */ jsx(DotsSix, { className: "text-ui-fg-muted" })
234
- }
235
- ),
236
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-3", children: [
237
- /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-base h-10 w-[30px] overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(ThumbnailPreview, { url: field.url }) }),
238
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
239
- /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: (_a = field.file) == null ? void 0 : _a.name }),
240
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
241
- field.isThumbnail && /* @__PURE__ */ jsx(ThumbnailBadge, {}),
242
- /* @__PURE__ */ jsx(
243
- Text,
244
- {
245
- size: "xsmall",
246
- leading: "compact",
247
- className: "text-ui-fg-subtle",
248
- children: formatFileSize(((_b = field.file) == null ? void 0 : _b.size) ?? 0)
249
- }
250
- )
251
- ] })
252
- ] })
253
- ] })
254
- ] }),
255
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-1", children: [
256
- /* @__PURE__ */ jsx(ActionMenu, { groups: [] }),
257
- /* @__PURE__ */ jsx(
258
- IconButton,
259
- {
260
- type: "button",
261
- size: "small",
262
- variant: "transparent",
263
- onClick: () => {
264
- },
265
- children: /* @__PURE__ */ jsx(XMark, {})
266
- }
267
- )
268
- ] })
269
- ] });
270
- };
271
- const ThumbnailPreview = ({ url }) => {
272
- if (!url) {
273
- return null;
274
- }
275
- return /* @__PURE__ */ jsx("img", { src: url, alt: "", className: "size-full object-cover object-center" });
276
- };
277
- function formatFileSize(bytes, decimalPlaces = 2) {
278
- if (bytes === 0) {
279
- return "0 Bytes";
280
- }
281
- const k = 1024;
282
- const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
283
- const i = Math.floor(Math.log(bytes) / Math.log(k));
284
- return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + " " + sizes[i];
285
- }
286
- export {
287
- GiftCardProductCreateFormMedia
288
- };
@@ -1,111 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { Text, Button } from "@medusajs/ui";
3
- import { useFieldArray } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
4
- import { Trans } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-i18next/dist/es/index.js";
5
- import { ChipGroup } from "../../../../components/chip-group.js";
6
- import { Form } from "../../../../components/form.js";
7
- import "../../../../components/modals/route-drawer/route-drawer.js";
8
- import "../../../../components/modals/route-focus-modal/route-focus-modal.js";
9
- import "react";
10
- import "react-router-dom";
11
- import "../../../../components/modals/route-modal-provider/route-modal-context.js";
12
- import "../../../../components/modals/stacked-drawer/stacked-drawer.js";
13
- import { StackedFocusModal } from "../../../../components/modals/stacked-focus-modal/stacked-focus-modal.js";
14
- import "../../../../components/modals/stacked-modal-provider/stacked-modal-context.js";
15
- import { useComboboxData } from "../../../../hooks/common/use-combobox-data.js";
16
- import { sdk } from "../../../../lib/sdk.js";
17
- const GiftCardProductCreateOrganizationSection = ({
18
- form
19
- }) => {
20
- useComboboxData({
21
- queryKey: ["product_collections"],
22
- queryFn: (params) => sdk.admin.productCollection.list(params),
23
- getOptions: (data) => data.collections.map((collection) => ({
24
- label: collection.title,
25
- value: collection.id
26
- }))
27
- });
28
- useComboboxData({
29
- queryKey: ["product_types"],
30
- queryFn: (params) => sdk.admin.productType.list(params),
31
- getOptions: (data) => data.product_types.map((type) => ({
32
- label: type.value,
33
- value: type.id
34
- }))
35
- });
36
- useComboboxData({
37
- queryKey: ["product_tags"],
38
- queryFn: (params) => sdk.admin.productTag.list(params),
39
- getOptions: (data) => data.product_tags.map((tag) => ({
40
- label: tag.value,
41
- value: tag.id
42
- }))
43
- });
44
- useComboboxData({
45
- queryKey: ["shipping_profiles"],
46
- queryFn: (params) => sdk.admin.shippingProfile.list(params),
47
- getOptions: (data) => data.shipping_profiles.map((shippingProfile) => ({
48
- label: shippingProfile.name,
49
- value: shippingProfile.id
50
- }))
51
- });
52
- const { fields, remove, replace } = useFieldArray({
53
- control: form.control,
54
- name: "sales_channels",
55
- keyName: "key"
56
- });
57
- const handleClearAllSalesChannels = () => {
58
- replace([]);
59
- };
60
- return /* @__PURE__ */ jsxs("div", { id: "organize", className: "grid grid-cols-1 gap-y-6 md:grid-cols-2 pt-6", children: [
61
- /* @__PURE__ */ jsxs("div", { children: [
62
- /* @__PURE__ */ jsx(
63
- Text,
64
- {
65
- className: "txt-compact-small-plus text-ui-fg-base",
66
- weight: "regular",
67
- children: "Organization"
68
- }
69
- ),
70
- /* @__PURE__ */ jsx(Text, { className: "txt-small text-ui-fg-muted", children: "Organize your gift card product" })
71
- ] }),
72
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-4", children: /* @__PURE__ */ jsx(
73
- Form.Field,
74
- {
75
- control: form.control,
76
- name: "sales_channels",
77
- render: () => {
78
- return /* @__PURE__ */ jsxs(Form.Item, { children: [
79
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-x-4", children: [
80
- /* @__PURE__ */ jsxs("div", { children: [
81
- /* @__PURE__ */ jsx(
82
- Form.Label,
83
- {
84
- className: "txt-compact-small-plus font-normal",
85
- optional: true,
86
- tooltip: "This product will only be available in the default sales channel if left untouched",
87
- children: "Sales Channels"
88
- }
89
- ),
90
- /* @__PURE__ */ jsx(Form.Hint, { children: /* @__PURE__ */ jsx(Trans, { i18nKey: "products.fields.sales_channels.hint" }) })
91
- ] }),
92
- /* @__PURE__ */ jsx(StackedFocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", type: "button", children: "Add" }) })
93
- ] }),
94
- /* @__PURE__ */ jsx(Form.Control, { className: "mt-0", children: fields.length > 0 && /* @__PURE__ */ jsx(
95
- ChipGroup,
96
- {
97
- onClearAll: handleClearAllSalesChannels,
98
- onRemove: remove,
99
- className: "py-1",
100
- children: fields.map((field, index) => /* @__PURE__ */ jsx(ChipGroup.Chip, { index, children: field.name }, field.key))
101
- }
102
- ) })
103
- ] });
104
- }
105
- }
106
- ) })
107
- ] });
108
- };
109
- export {
110
- GiftCardProductCreateOrganizationSection
111
- };
@@ -1,23 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import "../../../../components/modals/route-drawer/route-drawer.js";
3
- import "../../../../components/modals/route-focus-modal/route-focus-modal.js";
4
- import "react";
5
- import "react-router-dom";
6
- import "../../../../components/modals/route-modal-provider/route-modal-context.js";
7
- import "../../../../components/modals/stacked-drawer/stacked-drawer.js";
8
- import { StackedFocusModal } from "../../../../components/modals/stacked-focus-modal/stacked-focus-modal.js";
9
- import "../../../../components/modals/stacked-modal-provider/stacked-modal-context.js";
10
- import { GiftCardProductCreateOrganizationSection } from "./gift-card-product-create-form-organize-section.js";
11
- import { GiftCardProductSalesChannelStackedModal } from "./gift-card-product-sales-channel-stacked-modal.js";
12
- import { SC_STACKED_MODAL_ID } from "./schema.js";
13
- const GiftCardProductCreateOrganizeForm = ({
14
- form
15
- }) => {
16
- return /* @__PURE__ */ jsxs(StackedFocusModal, { id: SC_STACKED_MODAL_ID, children: [
17
- /* @__PURE__ */ jsx(GiftCardProductCreateOrganizationSection, { form }),
18
- /* @__PURE__ */ jsx(GiftCardProductSalesChannelStackedModal, { form })
19
- ] });
20
- };
21
- export {
22
- GiftCardProductCreateOrganizeForm
23
- };