@medusajs/loyalty-plugin 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +30277 -0
- package/.medusa/server/src/admin/index.mjs +30256 -0
- package/.medusa/server/src/api/store/carts/[id]/store-credits/route.js +24 -0
- package/.medusa/server/src/api/store/carts/middlewares.js +9 -1
- package/.medusa/server/src/api/store/carts/validators.js +5 -2
- package/.medusa/server/src/links/customer-gift-card-link.js +2 -2
- package/.medusa/server/src/links/customer-store-credit-account-link.js +2 -2
- package/.medusa/server/src/links/order-line-item-gift-card-link.js +2 -2
- package/.medusa/server/src/workflows/carts/workflows/add-store-credits-to-cart.js +104 -0
- package/.medusa/server/src/workflows/hooks/after-order-created.js +2 -2
- package/.medusa/server/src/workflows/hooks/after-order-credit-lines-created.js +3 -3
- package/.medusa/server/src/workflows/hooks/before-payment-collection-refresh.js +1 -1
- package/.medusa/server/src/workflows/hooks/complete-cart-before-payment-authorization.js +1 -1
- package/.medusa/server/src/workflows/orders/workflows/refund-credit-lines.js +115 -0
- package/package.json +14 -9
- package/.medusa/server/src/admin/components/action-menu.js +0 -63
- package/.medusa/server/src/admin/components/chip-group.js +0 -82
- package/.medusa/server/src/admin/components/chip-input.js +0 -157
- package/.medusa/server/src/admin/components/combobox.js +0 -324
- package/.medusa/server/src/admin/components/conditional-tooltip.js +0 -15
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-boolean-cell.js +0 -66
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-cell-container.js +0 -77
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-currency-cell.js +0 -110
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-duplicate-cell.js +0 -16
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-keyboard-shortcut-modal.js +0 -214
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-number-cell.js +0 -77
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-readonly-cell.js +0 -32
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-root.js +0 -743
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-row-error-indicator.js +0 -37
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-skeleton.js +0 -54
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-text-cell.js +0 -66
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-toggleable-number-cell.js +0 -166
- package/.medusa/server/src/admin/components/data-grid/components/index.js +0 -16
- package/.medusa/server/src/admin/components/data-grid/context/data-grid-context.js +0 -7
- package/.medusa/server/src/admin/components/data-grid/context/index.js +0 -6
- package/.medusa/server/src/admin/components/data-grid/context/use-data-grid-context.js +0 -14
- package/.medusa/server/src/admin/components/data-grid/data-grid.js +0 -31
- package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-column-helper.js +0 -28
- package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-price-columns.js +0 -85
- package/.medusa/server/src/admin/components/data-grid/helpers/index.js +0 -6
- package/.medusa/server/src/admin/components/data-grid/hooks/index.js +0 -31
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-error.js +0 -50
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-handlers.js +0 -123
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-metadata.js +0 -52
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-snapshot.js +0 -43
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell.js +0 -191
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-clipboard-events.js +0 -70
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-column-visibility.js +0 -51
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-duplicate-cell.js +0 -15
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-error-highlighting.js +0 -86
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-form-handlers.js +0 -149
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-keydown-event.js +0 -482
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-mouse-up-event.js +0 -64
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-navigation.js +0 -81
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-query-tool.js +0 -14
- package/.medusa/server/src/admin/components/data-grid/index.js +0 -8
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-bulk-update-command.js +0 -27
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-matrix.js +0 -296
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-query-tool.js +0 -62
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-update-command.js +0 -25
- package/.medusa/server/src/admin/components/data-grid/models/index.js +0 -10
- package/.medusa/server/src/admin/components/data-grid/types.js +0 -1
- package/.medusa/server/src/admin/components/data-grid/utils.js +0 -18
- package/.medusa/server/src/admin/components/data-table/components/data-table-status-cell/data-table-status-cell.js +0 -36
- package/.medusa/server/src/admin/components/data-table/data-table.js +0 -271
- package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-columns.js +0 -51
- package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-filters.js +0 -90
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/index.js +0 -10
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-columns.js +0 -48
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-empty-state.js +0 -19
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-filters.js +0 -30
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-query.js +0 -23
- package/.medusa/server/src/admin/components/data-table/index.js +0 -4
- package/.medusa/server/src/admin/components/data-table.js +0 -249
- package/.medusa/server/src/admin/components/display-id.js +0 -18
- package/.medusa/server/src/admin/components/file-upload.js +0 -116
- package/.medusa/server/src/admin/components/form.js +0 -151
- package/.medusa/server/src/admin/components/handle-input.js +0 -22
- package/.medusa/server/src/admin/components/header.js +0 -41
- package/.medusa/server/src/admin/components/icon-avatar.js +0 -27
- package/.medusa/server/src/admin/components/json-view-section.js +0 -139
- package/.medusa/server/src/admin/components/keybound-form.js +0 -32
- package/.medusa/server/src/admin/components/layouts/single-column.js +0 -7
- package/.medusa/server/src/admin/components/layouts/two-column.js +0 -13
- package/.medusa/server/src/admin/components/listicle.js +0 -20
- package/.medusa/server/src/admin/components/modals/index.js +0 -19
- package/.medusa/server/src/admin/components/modals/route-drawer/index.js +0 -4
- package/.medusa/server/src/admin/components/modals/route-drawer/route-drawer.js +0 -57
- package/.medusa/server/src/admin/components/modals/route-focus-modal/index.js +0 -4
- package/.medusa/server/src/admin/components/modals/route-focus-modal/route-focus-modal.js +0 -71
- package/.medusa/server/src/admin/components/modals/route-modal-form/index.js +0 -4
- package/.medusa/server/src/admin/components/modals/route-modal-form/route-modal-form.js +0 -60
- package/.medusa/server/src/admin/components/modals/route-modal-provider/index.js +0 -6
- package/.medusa/server/src/admin/components/modals/route-modal-provider/route-modal-context.js +0 -5
- package/.medusa/server/src/admin/components/modals/route-modal-provider/route-provider.js +0 -30
- package/.medusa/server/src/admin/components/modals/route-modal-provider/use-route-modal.js +0 -12
- package/.medusa/server/src/admin/components/modals/stacked-drawer/index.js +0 -5
- package/.medusa/server/src/admin/components/modals/stacked-drawer/stacked-drawer.js +0 -55
- package/.medusa/server/src/admin/components/modals/stacked-focus-modal/index.js +0 -5
- package/.medusa/server/src/admin/components/modals/stacked-focus-modal/stacked-focus-modal.js +0 -63
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/index.js +0 -6
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-context.js +0 -5
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-provider.js +0 -47
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/use-stacked-modal.js +0 -14
- package/.medusa/server/src/admin/components/placeholder-cell.js +0 -7
- package/.medusa/server/src/admin/components/product/product-cell/index.js +0 -5
- package/.medusa/server/src/admin/components/product/product-cell/product-cell.js +0 -15
- package/.medusa/server/src/admin/components/product/product-status-cell/index.js +0 -5
- package/.medusa/server/src/admin/components/product/product-status-cell/product-status-cell.js +0 -18
- package/.medusa/server/src/admin/components/product/sales-channels-cell/index.js +0 -5
- package/.medusa/server/src/admin/components/product/sales-channels-cell/sales-channels-cell.js +0 -31
- package/.medusa/server/src/admin/components/product/variant-cell/index.js +0 -5
- package/.medusa/server/src/admin/components/product/variant-cell/variant-cell.js +0 -15
- package/.medusa/server/src/admin/components/section-row.js +0 -32
- package/.medusa/server/src/admin/components/sidebar-link.js +0 -31
- package/.medusa/server/src/admin/components/sortable-list.js +0 -152
- package/.medusa/server/src/admin/components/switch-box.js +0 -43
- package/.medusa/server/src/admin/components/tax-badge.js +0 -18
- package/.medusa/server/src/admin/components/thumbnail.js +0 -28
- package/.medusa/server/src/admin/components/upload-media-form-item.js +0 -83
- package/.medusa/server/src/admin/hooks/api/customers.js +0 -26
- package/.medusa/server/src/admin/hooks/api/gift-cards.js +0 -107
- package/.medusa/server/src/admin/hooks/api/order.js +0 -16
- package/.medusa/server/src/admin/hooks/api/price-preferences.js +0 -19
- package/.medusa/server/src/admin/hooks/api/products.js +0 -127
- package/.medusa/server/src/admin/hooks/api/regions.js +0 -17
- package/.medusa/server/src/admin/hooks/api/sales-channels.js +0 -28
- package/.medusa/server/src/admin/hooks/api/store-credit-accounts.js +0 -41
- package/.medusa/server/src/admin/hooks/api/store.js +0 -31
- package/.medusa/server/src/admin/hooks/api/transaction-groups.js +0 -23
- package/.medusa/server/src/admin/hooks/api/transactions.js +0 -23
- package/.medusa/server/src/admin/hooks/commands/use-command-history.js +0 -45
- package/.medusa/server/src/admin/hooks/common/use-combobox-data.js +0 -59
- package/.medusa/server/src/admin/hooks/common/use-data-table-date-filters.js +0 -89
- package/.medusa/server/src/admin/hooks/common/use-date.js +0 -32
- package/.medusa/server/src/admin/hooks/common/use-debounced-search.js +0 -22
- package/.medusa/server/src/admin/hooks/common/use-query-params.js +0 -14
- package/.medusa/server/src/admin/hooks/query/use-customers-filters.js +0 -30
- package/.medusa/server/src/admin/hooks/query/use-transaction-groups-filters.js +0 -30
- package/.medusa/server/src/admin/hooks/sales-channels/index.js +0 -10
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-columns.js +0 -48
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-empty-state.js +0 -19
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-filters.js +0 -30
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-query.js +0 -23
- package/.medusa/server/src/admin/lib/currencies.js +0 -729
- package/.medusa/server/src/admin/lib/query-key.js +0 -17
- package/.medusa/server/src/admin/lib/sdk.js +0 -10
- package/.medusa/server/src/admin/routes/gift-card-products/@create/page.js +0 -75
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/components/gift-card-product-edit-denominations-form.js +0 -172
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/page.js +0 -30
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/components/gift-card-product-edit-form.js +0 -180
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/page.js +0 -30
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-general-section.js +0 -97
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-media-section.js +0 -162
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-sales-channel-section.js +0 -89
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-variant-section.js +0 -199
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/edit-product-media-form.js +0 -353
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/index.js +0 -5
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/index.js +0 -4
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/product-media-gallery.js +0 -247
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/index.js +0 -4
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view-context.js +0 -5
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view.js +0 -48
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/use-product-media-view.js +0 -14
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/page.js +0 -28
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/page.js +0 -40
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/prices-edit.js +0 -121
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/variant-pricing-form.js +0 -72
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/page.js +0 -23
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/components/edit-sales-channel-form.js +0 -123
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/page.js +0 -23
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/general-form-section.js +0 -1
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-denominations-form.js +0 -98
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-details-form.js +0 -28
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-denominations.js +0 -96
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-general.js +0 -90
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-media.js +0 -288
- 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
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-organize.js +0 -23
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form.js +0 -285
- 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
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/index.js +0 -4
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/schema.js +0 -112
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/types.js +0 -1
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/columns.js +0 -35
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/filters.js +0 -11
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/gift-card-products-table.js +0 -61
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/query.js +0 -23
- package/.medusa/server/src/admin/routes/gift-card-products/page.js +0 -18
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@expiration/page.js +0 -137
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@note/page.js +0 -87
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/components/transfer-icon.js +0 -352
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/page.js +0 -116
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-balance-section.js +0 -49
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-general-section.js +0 -177
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-note-section.js +0 -27
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-order-section.js +0 -33
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-owner-section.js +0 -33
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-transactions-section.js +0 -18
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/columns.js +0 -50
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/query.js +0 -23
- package/.medusa/server/src/admin/routes/gift-cards/_id_/page.js +0 -78
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-card-products-section.js +0 -40
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/columns.js +0 -57
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/filters.js +0 -13
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/gift-cards-table.js +0 -61
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/query.js +0 -23
- package/.medusa/server/src/admin/routes/gift-cards/page.js +0 -27
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/credit-card-icon.js +0 -126
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-balance-section.js +0 -31
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-details-section.js +0 -43
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/columns.js +0 -44
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/filters.js +0 -18
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/query.js +0 -37
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/table.js +0 -58
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/page.js +0 -39
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/columns.js +0 -58
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/filters.js +0 -13
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/query.js +0 -31
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/table.js +0 -56
- package/.medusa/server/src/admin/routes/store-credit-accounts/page.js +0 -19
- package/.medusa/server/src/admin/utils/date-utils.js +0 -27
- package/.medusa/server/src/admin/utils/format-amount.js +0 -9
- package/.medusa/server/src/admin/utils/format-date.js +0 -21
- package/.medusa/server/src/admin/utils/refs.js +0 -20
- package/.medusa/server/src/admin/utils/statuses.js +0 -23
- package/.medusa/server/src/admin/utils/validations.js +0 -71
- package/.medusa/server/src/admin/utils/variants.js +0 -92
- package/.medusa/server/src/admin/widgets/customer-gift-cards-widget.js +0 -67
- package/.medusa/server/src/admin/widgets/customer-store-credit-widget.js +0 -42
- package/.medusa/server/src/admin/widgets/order-gift-cards-widget.js +0 -58
- package/.medusa/server/src/workflows/orders/workflows/refund-gift-card-credit-lines.js +0 -96
- package/.medusa/server/types/loyalty/module.js +0 -8
|
@@ -1,110 +0,0 @@
|
|
|
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
|
-
};
|
package/.medusa/server/src/admin/components/data-grid/components/data-grid-duplicate-cell.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,214 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
};
|