@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.
- package/.medusa/server/src/admin/components/action-menu.js +63 -0
- package/.medusa/server/src/admin/components/chip-group.js +82 -0
- package/.medusa/server/src/admin/components/chip-input.js +157 -0
- package/.medusa/server/src/admin/components/combobox.js +324 -0
- package/.medusa/server/src/admin/components/conditional-tooltip.js +15 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-boolean-cell.js +66 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-cell-container.js +77 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-currency-cell.js +110 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-duplicate-cell.js +16 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-keyboard-shortcut-modal.js +214 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-number-cell.js +77 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-readonly-cell.js +32 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-root.js +743 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-row-error-indicator.js +37 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-skeleton.js +54 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-text-cell.js +66 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-toggleable-number-cell.js +166 -0
- package/.medusa/server/src/admin/components/data-grid/components/index.js +16 -0
- package/.medusa/server/src/admin/components/data-grid/context/data-grid-context.js +7 -0
- package/.medusa/server/src/admin/components/data-grid/context/index.js +6 -0
- package/.medusa/server/src/admin/components/data-grid/context/use-data-grid-context.js +14 -0
- package/.medusa/server/src/admin/components/data-grid/data-grid.js +31 -0
- package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-column-helper.js +28 -0
- package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-price-columns.js +85 -0
- package/.medusa/server/src/admin/components/data-grid/helpers/index.js +6 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/index.js +31 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-error.js +50 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-handlers.js +123 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-metadata.js +52 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-snapshot.js +43 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell.js +191 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-clipboard-events.js +70 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-column-visibility.js +51 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-duplicate-cell.js +15 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-error-highlighting.js +86 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-form-handlers.js +149 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-keydown-event.js +482 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-mouse-up-event.js +64 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-navigation.js +81 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-query-tool.js +14 -0
- package/.medusa/server/src/admin/components/data-grid/index.js +8 -0
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-bulk-update-command.js +27 -0
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-matrix.js +296 -0
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-query-tool.js +62 -0
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-update-command.js +25 -0
- package/.medusa/server/src/admin/components/data-grid/models/index.js +10 -0
- package/.medusa/server/src/admin/components/data-grid/types.js +1 -0
- package/.medusa/server/src/admin/components/data-grid/utils.js +18 -0
- package/.medusa/server/src/admin/components/data-table/components/data-table-status-cell/data-table-status-cell.js +36 -0
- package/.medusa/server/src/admin/components/data-table/data-table.js +271 -0
- package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-columns.js +51 -0
- package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-filters.js +90 -0
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/index.js +10 -0
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-columns.js +48 -0
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-empty-state.js +19 -0
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-filters.js +30 -0
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-query.js +23 -0
- package/.medusa/server/src/admin/components/data-table/index.js +4 -0
- package/.medusa/server/src/admin/components/data-table.js +249 -0
- package/.medusa/server/src/admin/components/display-id.js +18 -0
- package/.medusa/server/src/admin/components/file-upload.js +116 -0
- package/.medusa/server/src/admin/components/form.js +151 -0
- package/.medusa/server/src/admin/components/handle-input.js +22 -0
- package/.medusa/server/src/admin/components/header.js +41 -0
- package/.medusa/server/src/admin/components/icon-avatar.js +27 -0
- package/.medusa/server/src/admin/components/json-view-section.js +139 -0
- package/.medusa/server/src/admin/components/keybound-form.js +32 -0
- package/.medusa/server/src/admin/components/layouts/single-column.js +7 -0
- package/.medusa/server/src/admin/components/layouts/two-column.js +13 -0
- package/.medusa/server/src/admin/components/listicle.js +20 -0
- package/.medusa/server/src/admin/components/modals/index.js +19 -0
- package/.medusa/server/src/admin/components/modals/route-drawer/index.js +4 -0
- package/.medusa/server/src/admin/components/modals/route-drawer/route-drawer.js +57 -0
- package/.medusa/server/src/admin/components/modals/route-focus-modal/index.js +4 -0
- package/.medusa/server/src/admin/components/modals/route-focus-modal/route-focus-modal.js +71 -0
- package/.medusa/server/src/admin/components/modals/route-modal-form/index.js +4 -0
- package/.medusa/server/src/admin/components/modals/route-modal-form/route-modal-form.js +60 -0
- package/.medusa/server/src/admin/components/modals/route-modal-provider/index.js +6 -0
- package/.medusa/server/src/admin/components/modals/route-modal-provider/route-modal-context.js +5 -0
- package/.medusa/server/src/admin/components/modals/route-modal-provider/route-provider.js +30 -0
- package/.medusa/server/src/admin/components/modals/route-modal-provider/use-route-modal.js +12 -0
- package/.medusa/server/src/admin/components/modals/stacked-drawer/index.js +5 -0
- package/.medusa/server/src/admin/components/modals/stacked-drawer/stacked-drawer.js +55 -0
- package/.medusa/server/src/admin/components/modals/stacked-focus-modal/index.js +5 -0
- package/.medusa/server/src/admin/components/modals/stacked-focus-modal/stacked-focus-modal.js +63 -0
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/index.js +6 -0
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-context.js +5 -0
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-provider.js +47 -0
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/use-stacked-modal.js +14 -0
- package/.medusa/server/src/admin/components/placeholder-cell.js +7 -0
- package/.medusa/server/src/admin/components/product/product-cell/index.js +5 -0
- package/.medusa/server/src/admin/components/product/product-cell/product-cell.js +15 -0
- package/.medusa/server/src/admin/components/product/product-status-cell/index.js +5 -0
- package/.medusa/server/src/admin/components/product/product-status-cell/product-status-cell.js +18 -0
- package/.medusa/server/src/admin/components/product/sales-channels-cell/index.js +5 -0
- package/.medusa/server/src/admin/components/product/sales-channels-cell/sales-channels-cell.js +31 -0
- package/.medusa/server/src/admin/components/product/variant-cell/index.js +5 -0
- package/.medusa/server/src/admin/components/product/variant-cell/variant-cell.js +15 -0
- package/.medusa/server/src/admin/components/section-row.js +32 -0
- package/.medusa/server/src/admin/components/sidebar-link.js +31 -0
- package/.medusa/server/src/admin/components/sortable-list.js +152 -0
- package/.medusa/server/src/admin/components/switch-box.js +43 -0
- package/.medusa/server/src/admin/components/tax-badge.js +18 -0
- package/.medusa/server/src/admin/components/thumbnail.js +28 -0
- package/.medusa/server/src/admin/components/upload-media-form-item.js +83 -0
- package/.medusa/server/src/admin/hooks/api/customers.js +26 -0
- package/.medusa/server/src/admin/hooks/api/gift-cards.js +107 -0
- package/.medusa/server/src/admin/hooks/api/order.js +16 -0
- package/.medusa/server/src/admin/hooks/api/price-preferences.js +19 -0
- package/.medusa/server/src/admin/hooks/api/products.js +127 -0
- package/.medusa/server/src/admin/hooks/api/regions.js +17 -0
- package/.medusa/server/src/admin/hooks/api/sales-channels.js +28 -0
- package/.medusa/server/src/admin/hooks/api/store-credit-accounts.js +41 -0
- package/.medusa/server/src/admin/hooks/api/store.js +31 -0
- package/.medusa/server/src/admin/hooks/api/transaction-groups.js +23 -0
- package/.medusa/server/src/admin/hooks/api/transactions.js +23 -0
- package/.medusa/server/src/admin/hooks/commands/use-command-history.js +45 -0
- package/.medusa/server/src/admin/hooks/common/use-combobox-data.js +59 -0
- package/.medusa/server/src/admin/hooks/common/use-data-table-date-filters.js +89 -0
- package/.medusa/server/src/admin/hooks/common/use-date.js +32 -0
- package/.medusa/server/src/admin/hooks/common/use-debounced-search.js +22 -0
- package/.medusa/server/src/admin/hooks/common/use-query-params.js +14 -0
- package/.medusa/server/src/admin/hooks/query/use-customers-filters.js +30 -0
- package/.medusa/server/src/admin/hooks/query/use-transaction-groups-filters.js +30 -0
- package/.medusa/server/src/admin/hooks/sales-channels/index.js +10 -0
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-columns.js +48 -0
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-empty-state.js +19 -0
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-filters.js +30 -0
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-query.js +23 -0
- package/.medusa/server/src/admin/lib/currencies.js +729 -0
- package/.medusa/server/src/admin/lib/query-key.js +17 -0
- package/.medusa/server/src/admin/lib/sdk.js +10 -0
- package/.medusa/server/src/admin/routes/gift-card-products/@create/page.js +75 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/components/gift-card-product-edit-denominations-form.js +172 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/page.js +30 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/components/gift-card-product-edit-form.js +180 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/page.js +30 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-general-section.js +97 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-media-section.js +162 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-sales-channel-section.js +89 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-variant-section.js +199 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/edit-product-media-form.js +353 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/index.js +5 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/index.js +4 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/product-media-gallery.js +247 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/index.js +4 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view-context.js +5 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view.js +48 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/use-product-media-view.js +14 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/page.js +28 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/page.js +40 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/prices-edit.js +121 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/variant-pricing-form.js +72 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/page.js +23 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/components/edit-sales-channel-form.js +123 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/page.js +23 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/general-form-section.js +1 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-denominations-form.js +98 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-details-form.js +28 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-denominations.js +96 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-general.js +90 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-media.js +288 -0
- 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
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-organize.js +23 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form.js +285 -0
- 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
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/index.js +4 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/schema.js +112 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/types.js +1 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/columns.js +35 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/filters.js +11 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/gift-card-products-table.js +61 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/query.js +23 -0
- package/.medusa/server/src/admin/routes/gift-card-products/page.js +18 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@expiration/page.js +137 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@note/page.js +87 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/components/transfer-icon.js +352 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/page.js +116 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-balance-section.js +49 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-general-section.js +177 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-note-section.js +27 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-order-section.js +33 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-owner-section.js +33 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-transactions-section.js +18 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/columns.js +50 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/query.js +23 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/page.js +78 -0
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-card-products-section.js +40 -0
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/columns.js +57 -0
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/filters.js +13 -0
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/gift-cards-table.js +61 -0
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/query.js +23 -0
- package/.medusa/server/src/admin/routes/gift-cards/page.js +27 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/credit-card-icon.js +126 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-balance-section.js +31 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-details-section.js +43 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/columns.js +44 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/filters.js +18 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/query.js +37 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/table.js +58 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/page.js +39 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/columns.js +58 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/filters.js +13 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/query.js +31 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/table.js +56 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/page.js +19 -0
- package/.medusa/server/src/admin/utils/date-utils.js +27 -0
- package/.medusa/server/src/admin/utils/format-amount.js +9 -0
- package/.medusa/server/src/admin/utils/format-date.js +21 -0
- package/.medusa/server/src/admin/utils/refs.js +20 -0
- package/.medusa/server/src/admin/utils/statuses.js +23 -0
- package/.medusa/server/src/admin/utils/validations.js +71 -0
- package/.medusa/server/src/admin/utils/variants.js +92 -0
- package/.medusa/server/src/admin/widgets/customer-gift-cards-widget.js +67 -0
- package/.medusa/server/src/admin/widgets/customer-store-credit-widget.js +42 -0
- package/.medusa/server/src/admin/widgets/order-gift-cards-widget.js +58 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/redeem/route.js +25 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/route.js +41 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/transfer/route.js +24 -0
- package/.medusa/server/src/api/admin/gift-cards/middlewares.js +55 -0
- package/.medusa/server/src/api/admin/gift-cards/query-config.js +29 -0
- package/.medusa/server/src/api/admin/gift-cards/route.js +42 -0
- package/.medusa/server/src/api/admin/gift-cards/validators.js +69 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/route.js +24 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/transactions/route.js +23 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/middlewares.js +38 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/query-config.js +43 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/route.js +52 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/validators.js +51 -0
- package/.medusa/server/src/api/admin/transaction-groups/middlewares.js +16 -0
- package/.medusa/server/src/api/admin/transaction-groups/query-config.js +13 -0
- package/.medusa/server/src/api/admin/transaction-groups/route.js +27 -0
- package/.medusa/server/src/api/admin/transaction-groups/validators.js +19 -0
- package/.medusa/server/src/api/middlewares.js +22 -0
- package/.medusa/server/src/api/store/carts/[id]/gift-cards/route.js +43 -0
- package/.medusa/server/src/api/store/carts/middlewares.js +26 -0
- package/.medusa/server/src/api/store/carts/query-config.js +9 -0
- package/.medusa/server/src/api/store/carts/validators.js +15 -0
- package/.medusa/server/src/api/store/gift-card-invitations/[code]/accept/route.js +24 -0
- package/.medusa/server/src/api/store/gift-card-invitations/[code]/reject/route.js +24 -0
- package/.medusa/server/src/api/store/gift-card-invitations/middlewares.js +30 -0
- package/.medusa/server/src/api/store/gift-card-invitations/query-config.js +17 -0
- package/.medusa/server/src/api/store/gift-card-invitations/validators.js +14 -0
- package/.medusa/server/src/api/store/gift-cards/[id]/invitation/route.js +26 -0
- package/.medusa/server/src/api/store/gift-cards/[id]/redeem/route.js +24 -0
- package/.medusa/server/src/api/store/gift-cards/[id]/route.js +16 -0
- package/.medusa/server/src/api/store/gift-cards/middlewares.js +46 -0
- package/.medusa/server/src/api/store/gift-cards/query-config.js +26 -0
- package/.medusa/server/src/api/store/gift-cards/route.js +28 -0
- package/.medusa/server/src/api/store/gift-cards/validators.js +26 -0
- package/.medusa/server/src/api/store/store-credit-accounts/[id]/route.js +31 -0
- package/.medusa/server/src/api/store/store-credit-accounts/middlewares.js +28 -0
- package/.medusa/server/src/api/store/store-credit-accounts/query-config.js +24 -0
- package/.medusa/server/src/api/store/store-credit-accounts/route.js +40 -0
- package/.medusa/server/src/api/store/store-credit-accounts/validators.js +17 -0
- package/.medusa/server/src/links/cart-gift-cards-link.js +13 -0
- package/.medusa/server/src/links/customer-gift-card-link.js +13 -0
- package/.medusa/server/src/links/customer-store-credit-account-link.js +13 -0
- package/.medusa/server/src/links/order-gift-cards-link.js +13 -0
- package/.medusa/server/src/links/order-line-item-gift-card-link.js +19 -0
- package/.medusa/server/src/modules/loyalty/index.js +12 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250123130553.js +17 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250127174331.js +19 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141026.js +19 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141429.js +14 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206144714.js +14 -0
- package/.medusa/server/src/modules/loyalty/models/gift-card-invitation.js +20 -0
- package/.medusa/server/src/modules/loyalty/models/gift-card.js +28 -0
- package/.medusa/server/src/modules/loyalty/service.js +15 -0
- package/.medusa/server/src/modules/store-credit/index.js +12 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250129115518.js +16 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130213237.js +18 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130220640.js +19 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250131205753.js +14 -0
- package/.medusa/server/src/modules/store-credit/models/account-transaction.js +27 -0
- package/.medusa/server/src/modules/store-credit/models/store-credit-account.js +29 -0
- package/.medusa/server/src/modules/store-credit/models/transaction-group.js +28 -0
- package/.medusa/server/src/modules/store-credit/service.js +412 -0
- package/.medusa/server/src/providers/index.js +12 -0
- package/.medusa/server/src/providers/store-credit-payment/index.js +12 -0
- package/.medusa/server/src/providers/store-credit-payment/service.js +181 -0
- package/.medusa/server/src/subscribers/create-gift-card.js +94 -0
- package/.medusa/server/src/types/cart/index.js +3 -0
- package/.medusa/server/src/types/http/gift-card.js +3 -0
- package/.medusa/server/src/types/http/index.js +21 -0
- package/.medusa/server/src/types/http/store-credit-account.js +3 -0
- package/.medusa/server/src/types/http/transaction-group.js +3 -0
- package/.medusa/server/src/types/http/transaction.js +3 -0
- package/.medusa/server/src/types/index.js +21 -0
- package/.medusa/server/src/types/loyalty/index.js +20 -0
- package/.medusa/server/src/types/loyalty/module.js +17 -0
- package/.medusa/server/src/types/loyalty/service.js +3 -0
- package/.medusa/server/src/types/loyalty/workflows.js +3 -0
- package/.medusa/server/src/types/modules.js +14 -0
- package/.medusa/server/src/types/store-credit/index.js +19 -0
- package/.medusa/server/src/types/store-credit/module.js +10 -0
- package/.medusa/server/src/types/store-credit/service.js +3 -0
- package/.medusa/server/src/workflows/carts/workflows/add-gift-card-to-cart.js +167 -0
- package/.medusa/server/src/workflows/carts/workflows/confirm-cart-credit-lines.js +95 -0
- package/.medusa/server/src/workflows/carts/workflows/refresh-cart-gift-cards.js +136 -0
- package/.medusa/server/src/workflows/carts/workflows/remove-gift-cart-from-cart.js +66 -0
- package/.medusa/server/src/workflows/common/steps/validate-presence-of.js +11 -0
- package/.medusa/server/src/workflows/gift-card-invitation/steps/create-gift-card-invitation.js +17 -0
- package/.medusa/server/src/workflows/gift-card-invitation/steps/delete-gift-card-invitation.js +20 -0
- package/.medusa/server/src/workflows/gift-card-invitation/steps/update-gift-card-invitation.js +31 -0
- package/.medusa/server/src/workflows/gift-card-invitation/workflows/accept-gift-card-invitation.js +79 -0
- package/.medusa/server/src/workflows/gift-card-invitation/workflows/create-gift-card-invitation.js +66 -0
- package/.medusa/server/src/workflows/gift-card-invitation/workflows/delete-gift-card-invitation.js +10 -0
- package/.medusa/server/src/workflows/gift-card-invitation/workflows/reject-gift-card-invitation.js +70 -0
- package/.medusa/server/src/workflows/gift-cards/steps/create-gift-cards.js +17 -0
- package/.medusa/server/src/workflows/gift-cards/steps/delete-gift-cards.js +17 -0
- package/.medusa/server/src/workflows/gift-cards/steps/retrieve-gift-card-balance.js +20 -0
- package/.medusa/server/src/workflows/gift-cards/steps/update-gift-cards.js +34 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/create-gift-cards.js +12 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/delete-gift-card.js +19 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/redeem-gift-card.js +90 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/transfer-gift-card.js +48 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/update-gift-cards.js +12 -0
- package/.medusa/server/src/workflows/hooks/after-order-created.js +31 -0
- package/.medusa/server/src/workflows/hooks/after-order-credit-lines-created.js +31 -0
- package/.medusa/server/src/workflows/hooks/before-payment-collection-refresh.js +26 -0
- package/.medusa/server/src/workflows/hooks/complete-cart-before-payment-authorization.js +27 -0
- package/.medusa/server/src/workflows/orders/workflows/link-gift-cards-to-order.js +58 -0
- package/.medusa/server/src/workflows/orders/workflows/refund-gift-card-credit-lines.js +96 -0
- package/.medusa/server/src/workflows/store-credit/steps/create-store-credit-accounts.js +17 -0
- package/.medusa/server/src/workflows/store-credit/steps/create-transaction-groups.js +17 -0
- package/.medusa/server/src/workflows/store-credit/steps/credit-account.js +17 -0
- package/.medusa/server/src/workflows/store-credit/steps/debit-account.js +17 -0
- package/.medusa/server/src/workflows/store-credit/workflows/create-store-credit-accounts.js +57 -0
- package/.medusa/server/src/workflows/store-credit/workflows/create-transaction-groups.js +12 -0
- package/.medusa/server/src/workflows/store-credit/workflows/credit-accounts.js +12 -0
- package/.medusa/server/src/workflows/store-credit/workflows/debit-accounts.js +12 -0
- package/.medusa/server/types/loyalty/module.js +8 -0
- package/README.md +62 -0
- package/package.json +94 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox } from "@medusajs/ui";
|
|
3
|
+
import { Controller } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
|
|
4
|
+
import { useCombinedRefs } from "../../../utils/refs.js";
|
|
5
|
+
import { useDataGridCell } from "../hooks/use-data-grid-cell.js";
|
|
6
|
+
import { useDataGridCellError } from "../hooks/use-data-grid-cell-error.js";
|
|
7
|
+
import "react";
|
|
8
|
+
import "../context/data-grid-context.js";
|
|
9
|
+
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/get.js";
|
|
10
|
+
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/set.js";
|
|
11
|
+
import { DataGridCellContainer } from "./data-grid-cell-container.js";
|
|
12
|
+
const DataGridBooleanCell = ({
|
|
13
|
+
context,
|
|
14
|
+
disabled
|
|
15
|
+
}) => {
|
|
16
|
+
const { field, control, renderProps } = useDataGridCell({
|
|
17
|
+
context
|
|
18
|
+
});
|
|
19
|
+
const errorProps = useDataGridCellError({ context });
|
|
20
|
+
const { container, input } = renderProps;
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
Controller,
|
|
23
|
+
{
|
|
24
|
+
control,
|
|
25
|
+
name: field,
|
|
26
|
+
render: ({ field: field2 }) => {
|
|
27
|
+
return /* @__PURE__ */ jsx(DataGridCellContainer, { ...container, ...errorProps, children: /* @__PURE__ */ jsx(Inner, { field: field2, inputProps: input, disabled }) });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
const Inner = ({
|
|
33
|
+
field,
|
|
34
|
+
inputProps,
|
|
35
|
+
disabled
|
|
36
|
+
}) => {
|
|
37
|
+
const { ref, value, onBlur, name, disabled: fieldDisabled } = field;
|
|
38
|
+
const {
|
|
39
|
+
ref: inputRef,
|
|
40
|
+
onBlur: onInputBlur,
|
|
41
|
+
onChange,
|
|
42
|
+
onFocus,
|
|
43
|
+
...attributes
|
|
44
|
+
} = inputProps;
|
|
45
|
+
const combinedRefs = useCombinedRefs(ref, inputRef);
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
Checkbox,
|
|
48
|
+
{
|
|
49
|
+
disabled: disabled || fieldDisabled,
|
|
50
|
+
name,
|
|
51
|
+
checked: value,
|
|
52
|
+
onCheckedChange: (newValue) => onChange(newValue === true, value),
|
|
53
|
+
onFocus,
|
|
54
|
+
onBlur: () => {
|
|
55
|
+
onBlur();
|
|
56
|
+
onInputBlur();
|
|
57
|
+
},
|
|
58
|
+
ref: combinedRefs,
|
|
59
|
+
tabIndex: -1,
|
|
60
|
+
...attributes
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
DataGridBooleanCell
|
|
66
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ErrorMessage } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/@hookform/error-message/dist/index.esm.js";
|
|
3
|
+
import { ExclamationCircle } from "@medusajs/icons";
|
|
4
|
+
import { clx, Tooltip } from "@medusajs/ui";
|
|
5
|
+
import { get } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
|
|
6
|
+
import { DataGridRowErrorIndicator } from "./data-grid-row-error-indicator.js";
|
|
7
|
+
const DataGridCellContainer = ({
|
|
8
|
+
isAnchor,
|
|
9
|
+
isSelected,
|
|
10
|
+
isDragSelected,
|
|
11
|
+
field,
|
|
12
|
+
showOverlay,
|
|
13
|
+
placeholder,
|
|
14
|
+
innerProps,
|
|
15
|
+
overlayProps,
|
|
16
|
+
children,
|
|
17
|
+
errors,
|
|
18
|
+
rowErrors,
|
|
19
|
+
outerComponent
|
|
20
|
+
}) => {
|
|
21
|
+
const error = get(errors, field);
|
|
22
|
+
const hasError = !!error;
|
|
23
|
+
return /* @__PURE__ */ jsxs("div", { className: "group/container relative size-full", children: [
|
|
24
|
+
/* @__PURE__ */ jsxs(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: clx(
|
|
28
|
+
"bg-ui-bg-base group/cell relative flex size-full items-center gap-x-2 px-4 py-2.5 outline-none",
|
|
29
|
+
{
|
|
30
|
+
"bg-ui-tag-red-bg text-ui-tag-red-text": hasError && !isAnchor && !isSelected && !isDragSelected,
|
|
31
|
+
"ring-ui-bg-interactive ring-2 ring-inset": isAnchor,
|
|
32
|
+
"bg-ui-bg-highlight [&:has([data-field]:focus)]:bg-ui-bg-base": isSelected || isAnchor,
|
|
33
|
+
"bg-ui-bg-subtle": isDragSelected && !isAnchor
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
tabIndex: -1,
|
|
37
|
+
...innerProps,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
ErrorMessage,
|
|
41
|
+
{
|
|
42
|
+
name: field,
|
|
43
|
+
errors,
|
|
44
|
+
render: ({ message }) => {
|
|
45
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(Tooltip, { content: message, delayDuration: 0, children: /* @__PURE__ */ jsx(ExclamationCircle, { className: "text-ui-tag-red-icon z-[3]" }) }) });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ jsx("div", { className: "relative z-[1] flex size-full items-center justify-center", children: /* @__PURE__ */ jsx(RenderChildren, { isAnchor, placeholder, children }) }),
|
|
50
|
+
/* @__PURE__ */ jsx(DataGridRowErrorIndicator, { rowErrors }),
|
|
51
|
+
showOverlay && /* @__PURE__ */ jsx(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
...overlayProps,
|
|
55
|
+
"data-cell-overlay": "true",
|
|
56
|
+
className: "absolute inset-0 z-[2]"
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
outerComponent
|
|
63
|
+
] });
|
|
64
|
+
};
|
|
65
|
+
const RenderChildren = ({
|
|
66
|
+
isAnchor,
|
|
67
|
+
placeholder,
|
|
68
|
+
children
|
|
69
|
+
}) => {
|
|
70
|
+
if (!isAnchor && placeholder) {
|
|
71
|
+
return placeholder;
|
|
72
|
+
}
|
|
73
|
+
return children;
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
DataGridCellContainer
|
|
77
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState, useEffect } from "react";
|
|
3
|
+
import CurrencyInput, { formatValue } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-currency-input-field/dist/index.esm.js";
|
|
4
|
+
import { Controller } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
|
|
5
|
+
import { currencies } from "../../../lib/currencies.js";
|
|
6
|
+
import { useCombinedRefs } from "../../../utils/refs.js";
|
|
7
|
+
import { useDataGridCell } from "../hooks/use-data-grid-cell.js";
|
|
8
|
+
import { useDataGridCellError } from "../hooks/use-data-grid-cell-error.js";
|
|
9
|
+
import "../context/data-grid-context.js";
|
|
10
|
+
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/get.js";
|
|
11
|
+
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/set.js";
|
|
12
|
+
import { DataGridCellContainer } from "./data-grid-cell-container.js";
|
|
13
|
+
const DataGridCurrencyCell = ({
|
|
14
|
+
context,
|
|
15
|
+
code
|
|
16
|
+
}) => {
|
|
17
|
+
const { field, control, renderProps } = useDataGridCell({
|
|
18
|
+
context
|
|
19
|
+
});
|
|
20
|
+
const errorProps = useDataGridCellError({ context });
|
|
21
|
+
const { container, input } = renderProps;
|
|
22
|
+
const currency = currencies[code.toUpperCase()];
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
Controller,
|
|
25
|
+
{
|
|
26
|
+
control,
|
|
27
|
+
name: field,
|
|
28
|
+
render: ({ field: field2 }) => {
|
|
29
|
+
return /* @__PURE__ */ jsx(DataGridCellContainer, { ...container, ...errorProps, children: /* @__PURE__ */ jsx(Inner, { field: field2, inputProps: input, currencyInfo: currency }) });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
const Inner = ({
|
|
35
|
+
field,
|
|
36
|
+
inputProps,
|
|
37
|
+
currencyInfo
|
|
38
|
+
}) => {
|
|
39
|
+
const { value, onChange: _, onBlur, ref, ...rest } = field;
|
|
40
|
+
const {
|
|
41
|
+
ref: inputRef,
|
|
42
|
+
onBlur: onInputBlur,
|
|
43
|
+
onFocus,
|
|
44
|
+
onChange,
|
|
45
|
+
...attributes
|
|
46
|
+
} = inputProps;
|
|
47
|
+
const formatter = useCallback(
|
|
48
|
+
(value2) => {
|
|
49
|
+
const ensuredValue = typeof value2 === "number" ? value2.toString() : value2 || "";
|
|
50
|
+
return formatValue({
|
|
51
|
+
value: ensuredValue,
|
|
52
|
+
decimalScale: currencyInfo.decimal_digits,
|
|
53
|
+
disableGroupSeparators: true,
|
|
54
|
+
decimalSeparator: "."
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
[currencyInfo]
|
|
58
|
+
);
|
|
59
|
+
const [localValue, setLocalValue] = useState(value || "");
|
|
60
|
+
const handleValueChange = (value2, _name, _values) => {
|
|
61
|
+
if (!value2) {
|
|
62
|
+
setLocalValue("");
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
setLocalValue(value2);
|
|
66
|
+
};
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
let update = value;
|
|
69
|
+
if (!isNaN(Number(value))) {
|
|
70
|
+
update = formatter(update);
|
|
71
|
+
}
|
|
72
|
+
setLocalValue(update);
|
|
73
|
+
}, [value, formatter]);
|
|
74
|
+
const combinedRed = useCombinedRefs(inputRef, ref);
|
|
75
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative flex size-full items-center", children: [
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
"span",
|
|
78
|
+
{
|
|
79
|
+
className: "txt-compact-small text-ui-fg-muted pointer-events-none absolute left-0 w-fit min-w-4",
|
|
80
|
+
"aria-hidden": true,
|
|
81
|
+
children: currencyInfo.symbol_native
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
CurrencyInput,
|
|
86
|
+
{
|
|
87
|
+
...rest,
|
|
88
|
+
...attributes,
|
|
89
|
+
ref: combinedRed,
|
|
90
|
+
className: "txt-compact-small w-full flex-1 cursor-default appearance-none bg-transparent pl-8 text-right outline-none",
|
|
91
|
+
value: localValue || void 0,
|
|
92
|
+
onValueChange: handleValueChange,
|
|
93
|
+
formatValueOnBlur: true,
|
|
94
|
+
onBlur: () => {
|
|
95
|
+
onBlur();
|
|
96
|
+
onInputBlur();
|
|
97
|
+
onChange(localValue, value);
|
|
98
|
+
},
|
|
99
|
+
onFocus,
|
|
100
|
+
decimalScale: currencyInfo.decimal_digits,
|
|
101
|
+
decimalsLimit: currencyInfo.decimal_digits,
|
|
102
|
+
autoComplete: "off",
|
|
103
|
+
tabIndex: -1
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] });
|
|
107
|
+
};
|
|
108
|
+
export {
|
|
109
|
+
DataGridCurrencyCell
|
|
110
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "../context/data-grid-context.js";
|
|
4
|
+
import { useDataGridDuplicateCell } from "../hooks/use-data-grid-duplicate-cell.js";
|
|
5
|
+
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/get.js";
|
|
6
|
+
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/set.js";
|
|
7
|
+
const DataGridDuplicateCell = ({
|
|
8
|
+
duplicateOf,
|
|
9
|
+
children
|
|
10
|
+
}) => {
|
|
11
|
+
const { watchedValue } = useDataGridDuplicateCell({ duplicateOf });
|
|
12
|
+
return /* @__PURE__ */ jsx("div", { className: "bg-ui-bg-base txt-compact-small text-ui-fg-subtle flex size-full cursor-not-allowed items-center justify-between overflow-hidden px-4 py-2.5 outline-none", children: typeof children === "function" ? children({ value: watchedValue }) : children });
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
DataGridDuplicateCell
|
|
16
|
+
};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { XMark } from "@medusajs/icons";
|
|
3
|
+
import { Button, clx, Heading, Kbd, IconButton, Input, Text } from "@medusajs/ui";
|
|
4
|
+
import { Dialog } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/radix-ui/dist/index.mjs";
|
|
5
|
+
import { useState, useMemo } from "react";
|
|
6
|
+
const useDataGridShortcuts = () => {
|
|
7
|
+
const shortcuts = useMemo(
|
|
8
|
+
() => [
|
|
9
|
+
{
|
|
10
|
+
label: "Undo",
|
|
11
|
+
keys: {
|
|
12
|
+
Mac: ["⌘", "Z"],
|
|
13
|
+
Windows: ["Ctrl", "Z"]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: "Redo",
|
|
18
|
+
keys: {
|
|
19
|
+
Mac: ["⇧", "⌘", "Z"],
|
|
20
|
+
Windows: ["Shift", "Ctrl", "Z"]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: "Copy",
|
|
25
|
+
keys: {
|
|
26
|
+
Mac: ["⌘", "C"],
|
|
27
|
+
Windows: ["Ctrl", "C"]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "Paste",
|
|
32
|
+
keys: {
|
|
33
|
+
Mac: ["⌘", "V"],
|
|
34
|
+
Windows: ["Ctrl", "V"]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "Edit",
|
|
39
|
+
keys: {
|
|
40
|
+
Mac: ["↵"],
|
|
41
|
+
Windows: ["Enter"]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "Delete",
|
|
46
|
+
keys: {
|
|
47
|
+
Mac: ["⌫"],
|
|
48
|
+
Windows: ["Backspace"]
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: "Clear",
|
|
53
|
+
keys: {
|
|
54
|
+
Mac: ["Space"],
|
|
55
|
+
Windows: ["Space"]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: "Move Up",
|
|
60
|
+
keys: {
|
|
61
|
+
Mac: ["↑"],
|
|
62
|
+
Windows: ["↑"]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: "Move Down",
|
|
67
|
+
keys: {
|
|
68
|
+
Mac: ["↓"],
|
|
69
|
+
Windows: ["↓"]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: "Move Left",
|
|
74
|
+
keys: {
|
|
75
|
+
Mac: ["←"],
|
|
76
|
+
Windows: ["←"]
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: "Move Right",
|
|
81
|
+
keys: {
|
|
82
|
+
Mac: ["→"],
|
|
83
|
+
Windows: ["→"]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: "Move Top",
|
|
88
|
+
keys: {
|
|
89
|
+
Mac: ["⌘", "↑"],
|
|
90
|
+
Windows: ["Ctrl", "↑"]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: "Move Bottom",
|
|
95
|
+
keys: {
|
|
96
|
+
Mac: ["⌘", "↓"],
|
|
97
|
+
Windows: ["Ctrl", "↓"]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: "Select Down",
|
|
102
|
+
keys: {
|
|
103
|
+
Mac: ["⇧", "↓"],
|
|
104
|
+
Windows: ["Shift", "↓"]
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
label: "Select Up",
|
|
109
|
+
keys: {
|
|
110
|
+
Mac: ["⇧", "↑"],
|
|
111
|
+
Windows: ["Shift", "↑"]
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
label: "Select Column Down",
|
|
116
|
+
keys: {
|
|
117
|
+
Mac: ["⇧", "⌘", "↓"],
|
|
118
|
+
Windows: ["Shift", "Ctrl", "↓"]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
label: "Select Column Up",
|
|
123
|
+
keys: {
|
|
124
|
+
Mac: ["⇧", "⌘", "↑"],
|
|
125
|
+
Windows: ["Shift", "Ctrl", "↑"]
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: "Focus Toolbar",
|
|
130
|
+
keys: {
|
|
131
|
+
Mac: ["⌃", "⌥", ","],
|
|
132
|
+
Windows: ["Ctrl", "Alt", ","]
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: "Focus Cancel",
|
|
137
|
+
keys: {
|
|
138
|
+
Mac: ["⌃", "⌥", "."],
|
|
139
|
+
Windows: ["Ctrl", "Alt", "."]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
[]
|
|
144
|
+
);
|
|
145
|
+
return shortcuts;
|
|
146
|
+
};
|
|
147
|
+
const DataGridKeyboardShortcutModal = ({
|
|
148
|
+
open,
|
|
149
|
+
onOpenChange
|
|
150
|
+
}) => {
|
|
151
|
+
const [searchValue, onSearchValueChange] = useState("");
|
|
152
|
+
const shortcuts = useDataGridShortcuts();
|
|
153
|
+
const searchResults = useMemo(() => {
|
|
154
|
+
return shortcuts.filter(
|
|
155
|
+
(shortcut) => shortcut.label.toLowerCase().includes(searchValue.toLowerCase())
|
|
156
|
+
);
|
|
157
|
+
}, [searchValue, shortcuts]);
|
|
158
|
+
return /* @__PURE__ */ jsxs(Dialog.Root, { open, onOpenChange, children: [
|
|
159
|
+
/* @__PURE__ */ jsx(Dialog.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Shortcuts" }) }),
|
|
160
|
+
/* @__PURE__ */ jsxs(Dialog.Portal, { children: [
|
|
161
|
+
/* @__PURE__ */ jsx(
|
|
162
|
+
Dialog.Overlay,
|
|
163
|
+
{
|
|
164
|
+
className: clx(
|
|
165
|
+
"bg-ui-bg-overlay fixed inset-0",
|
|
166
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ jsxs(Dialog.Content, { className: "bg-ui-bg-subtle shadow-elevation-modal fixed left-[50%] top-[50%] flex h-full max-h-[612px] w-full max-w-[560px] translate-x-[-50%] translate-y-[-50%] flex-col divide-y overflow-hidden rounded-lg outline-none", children: [
|
|
171
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-3 px-6 py-4", children: [
|
|
172
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
173
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
174
|
+
/* @__PURE__ */ jsx(Dialog.Title, { asChild: true, children: /* @__PURE__ */ jsx(Heading, { children: "Shortcuts" }) }),
|
|
175
|
+
/* @__PURE__ */ jsx(Dialog.Description, { className: "sr-only" })
|
|
176
|
+
] }),
|
|
177
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
178
|
+
/* @__PURE__ */ jsx(Kbd, { children: "esc" }),
|
|
179
|
+
/* @__PURE__ */ jsx(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { variant: "transparent", size: "small", children: /* @__PURE__ */ jsx(XMark, {}) }) })
|
|
180
|
+
] })
|
|
181
|
+
] }),
|
|
182
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
183
|
+
Input,
|
|
184
|
+
{
|
|
185
|
+
type: "search",
|
|
186
|
+
value: searchValue,
|
|
187
|
+
autoFocus: true,
|
|
188
|
+
onChange: (e) => onSearchValueChange(e.target.value)
|
|
189
|
+
}
|
|
190
|
+
) })
|
|
191
|
+
] }),
|
|
192
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col divide-y overflow-y-auto", children: searchResults.map((shortcut, index) => {
|
|
193
|
+
var _a;
|
|
194
|
+
return /* @__PURE__ */ jsxs(
|
|
195
|
+
"div",
|
|
196
|
+
{
|
|
197
|
+
className: "text-ui-fg-subtle flex items-center justify-between px-6 py-3",
|
|
198
|
+
children: [
|
|
199
|
+
/* @__PURE__ */ jsx(Text, { size: "small", children: shortcut.label }),
|
|
200
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-1", children: (_a = shortcut.keys.Mac) == null ? void 0 : _a.map((key, index2) => {
|
|
201
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-1", children: /* @__PURE__ */ jsx(Kbd, { children: key }) }, index2);
|
|
202
|
+
}) })
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
index
|
|
206
|
+
);
|
|
207
|
+
}) })
|
|
208
|
+
] })
|
|
209
|
+
] })
|
|
210
|
+
] });
|
|
211
|
+
};
|
|
212
|
+
export {
|
|
213
|
+
DataGridKeyboardShortcutModal
|
|
214
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clx } from "@medusajs/ui";
|
|
3
|
+
import { useState, useEffect } from "react";
|
|
4
|
+
import { Controller } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
|
|
5
|
+
import { useCombinedRefs } from "../../../utils/refs.js";
|
|
6
|
+
import { useDataGridCell } from "../hooks/use-data-grid-cell.js";
|
|
7
|
+
import { useDataGridCellError } from "../hooks/use-data-grid-cell-error.js";
|
|
8
|
+
import "../context/data-grid-context.js";
|
|
9
|
+
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/get.js";
|
|
10
|
+
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/set.js";
|
|
11
|
+
import { DataGridCellContainer } from "./data-grid-cell-container.js";
|
|
12
|
+
const DataGridNumberCell = ({
|
|
13
|
+
context,
|
|
14
|
+
...rest
|
|
15
|
+
}) => {
|
|
16
|
+
const { field, control, renderProps } = useDataGridCell({
|
|
17
|
+
context
|
|
18
|
+
});
|
|
19
|
+
const errorProps = useDataGridCellError({ context });
|
|
20
|
+
const { container, input } = renderProps;
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
Controller,
|
|
23
|
+
{
|
|
24
|
+
control,
|
|
25
|
+
name: field,
|
|
26
|
+
render: ({ field: field2 }) => {
|
|
27
|
+
return /* @__PURE__ */ jsx(DataGridCellContainer, { ...container, ...errorProps, children: /* @__PURE__ */ jsx(Inner, { field: field2, inputProps: input, ...rest }) });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
const Inner = ({
|
|
33
|
+
field,
|
|
34
|
+
inputProps,
|
|
35
|
+
...props
|
|
36
|
+
}) => {
|
|
37
|
+
const { ref, value, onChange: _, onBlur, ...fieldProps } = field;
|
|
38
|
+
const {
|
|
39
|
+
ref: inputRef,
|
|
40
|
+
onChange,
|
|
41
|
+
onBlur: onInputBlur,
|
|
42
|
+
onFocus,
|
|
43
|
+
...attributes
|
|
44
|
+
} = inputProps;
|
|
45
|
+
const [localValue, setLocalValue] = useState(value);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
setLocalValue(value);
|
|
48
|
+
}, [value]);
|
|
49
|
+
const combinedRefs = useCombinedRefs(inputRef, ref);
|
|
50
|
+
return /* @__PURE__ */ jsx("div", { className: "size-full", children: /* @__PURE__ */ jsx(
|
|
51
|
+
"input",
|
|
52
|
+
{
|
|
53
|
+
ref: combinedRefs,
|
|
54
|
+
value: localValue,
|
|
55
|
+
onChange: (e) => setLocalValue(e.target.value),
|
|
56
|
+
onBlur: () => {
|
|
57
|
+
onBlur();
|
|
58
|
+
onInputBlur();
|
|
59
|
+
onChange(localValue, value);
|
|
60
|
+
},
|
|
61
|
+
onFocus,
|
|
62
|
+
type: "number",
|
|
63
|
+
inputMode: "decimal",
|
|
64
|
+
className: clx(
|
|
65
|
+
"txt-compact-small size-full bg-transparent outline-none",
|
|
66
|
+
"placeholder:text-ui-fg-muted"
|
|
67
|
+
),
|
|
68
|
+
tabIndex: -1,
|
|
69
|
+
...props,
|
|
70
|
+
...fieldProps,
|
|
71
|
+
...attributes
|
|
72
|
+
}
|
|
73
|
+
) });
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
DataGridNumberCell
|
|
77
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clx } from "@medusajs/ui";
|
|
3
|
+
import "react";
|
|
4
|
+
import "../context/data-grid-context.js";
|
|
5
|
+
import { useDataGridCellError } from "../hooks/use-data-grid-cell-error.js";
|
|
6
|
+
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/get.js";
|
|
7
|
+
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/set.js";
|
|
8
|
+
import { DataGridRowErrorIndicator } from "./data-grid-row-error-indicator.js";
|
|
9
|
+
const DataGridReadonlyCell = ({
|
|
10
|
+
context,
|
|
11
|
+
color = "muted",
|
|
12
|
+
children
|
|
13
|
+
}) => {
|
|
14
|
+
const { rowErrors } = useDataGridCellError({ context });
|
|
15
|
+
return /* @__PURE__ */ jsxs(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
className: clx(
|
|
19
|
+
"txt-compact-small text-ui-fg-subtle flex size-full cursor-not-allowed items-center justify-between overflow-hidden px-4 py-2.5 outline-none",
|
|
20
|
+
color === "muted" && "bg-ui-bg-subtle",
|
|
21
|
+
color === "normal" && "bg-ui-bg-base"
|
|
22
|
+
),
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 truncate", children }),
|
|
25
|
+
/* @__PURE__ */ jsx(DataGridRowErrorIndicator, { rowErrors })
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
DataGridReadonlyCell
|
|
32
|
+
};
|