@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.
- package/.medusa/server/src/admin/index.js +30214 -0
- package/.medusa/server/src/admin/index.mjs +30193 -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/types/loyalty/module.js +0 -8
package/.medusa/server/src/admin/components/data-grid/components/data-grid-row-error-indicator.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Tooltip, Badge } from "@medusajs/ui";
|
|
3
|
-
const DataGridRowErrorIndicator = ({
|
|
4
|
-
rowErrors
|
|
5
|
-
}) => {
|
|
6
|
-
const rowErrorCount = rowErrors ? rowErrors.length : 0;
|
|
7
|
-
if (!rowErrors || rowErrorCount <= 0) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
return /* @__PURE__ */ jsx(
|
|
11
|
-
Tooltip,
|
|
12
|
-
{
|
|
13
|
-
content: /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-y-3", children: rowErrors.map((error, index) => /* @__PURE__ */ jsx(DataGridRowErrorLine, { error }, index)) }),
|
|
14
|
-
delayDuration: 0,
|
|
15
|
-
children: /* @__PURE__ */ jsx(Badge, { color: "red", size: "2xsmall", className: "cursor-default", children: rowErrorCount })
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
const DataGridRowErrorLine = ({
|
|
20
|
-
error
|
|
21
|
-
}) => {
|
|
22
|
-
return /* @__PURE__ */ jsxs("li", { className: "txt-compact-small flex flex-col items-start", children: [
|
|
23
|
-
error.message,
|
|
24
|
-
/* @__PURE__ */ jsx(
|
|
25
|
-
"button",
|
|
26
|
-
{
|
|
27
|
-
type: "button",
|
|
28
|
-
onClick: error.to,
|
|
29
|
-
className: "text-ui-fg-interactive hover:text-ui-fg-interactive-hover transition-fg",
|
|
30
|
-
children: "Fix error"
|
|
31
|
-
}
|
|
32
|
-
)
|
|
33
|
-
] });
|
|
34
|
-
};
|
|
35
|
-
export {
|
|
36
|
-
DataGridRowErrorIndicator
|
|
37
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Skeleton } from "@medusajs/ui";
|
|
3
|
-
const DataGridSkeleton = ({
|
|
4
|
-
columns,
|
|
5
|
-
rows: rowCount = 10
|
|
6
|
-
}) => {
|
|
7
|
-
const rows = Array.from({ length: rowCount }, (_, i) => i);
|
|
8
|
-
const colCount = columns.length;
|
|
9
|
-
return /* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle size-full", children: [
|
|
10
|
-
/* @__PURE__ */ jsx("div", { className: "bg-ui-bg-base border-b p-4", children: /* @__PURE__ */ jsx("div", { className: "bg-ui-button-neutral h-7 w-[116px] animate-pulse rounded-md" }) }),
|
|
11
|
-
/* @__PURE__ */ jsxs("div", { className: "bg-ui-bg-subtle size-full overflow-auto", children: [
|
|
12
|
-
/* @__PURE__ */ jsx(
|
|
13
|
-
"div",
|
|
14
|
-
{
|
|
15
|
-
className: "grid",
|
|
16
|
-
style: {
|
|
17
|
-
gridTemplateColumns: `repeat(${colCount}, 1fr)`
|
|
18
|
-
},
|
|
19
|
-
children: columns.map((_col, i) => {
|
|
20
|
-
return /* @__PURE__ */ jsx(
|
|
21
|
-
"div",
|
|
22
|
-
{
|
|
23
|
-
className: "bg-ui-bg-base flex h-10 w-[200px] items-center border-b border-r px-4 py-2.5 last:border-r-0",
|
|
24
|
-
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[14px] w-[164px]" })
|
|
25
|
-
},
|
|
26
|
-
i
|
|
27
|
-
);
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
),
|
|
31
|
-
/* @__PURE__ */ jsx("div", { children: rows.map((_, j) => /* @__PURE__ */ jsx(
|
|
32
|
-
"div",
|
|
33
|
-
{
|
|
34
|
-
className: "grid",
|
|
35
|
-
style: { gridTemplateColumns: `repeat(${colCount}, 1fr)` },
|
|
36
|
-
children: columns.map((_col, k) => {
|
|
37
|
-
return /* @__PURE__ */ jsx(
|
|
38
|
-
"div",
|
|
39
|
-
{
|
|
40
|
-
className: "bg-ui-bg-base flex h-10 w-[200px] items-center border-b border-r px-4 py-2.5 last:border-r-0",
|
|
41
|
-
children: /* @__PURE__ */ jsx(Skeleton, { className: "h-[14px] w-[164px]" })
|
|
42
|
-
},
|
|
43
|
-
k
|
|
44
|
-
);
|
|
45
|
-
})
|
|
46
|
-
},
|
|
47
|
-
j
|
|
48
|
-
)) })
|
|
49
|
-
] })
|
|
50
|
-
] });
|
|
51
|
-
};
|
|
52
|
-
export {
|
|
53
|
-
DataGridSkeleton
|
|
54
|
-
};
|
|
@@ -1,66 +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 DataGridTextCell = ({
|
|
13
|
-
context
|
|
14
|
-
}) => {
|
|
15
|
-
const { field, control, renderProps } = useDataGridCell({
|
|
16
|
-
context
|
|
17
|
-
});
|
|
18
|
-
const errorProps = useDataGridCellError({ context });
|
|
19
|
-
const { container, input } = renderProps;
|
|
20
|
-
return /* @__PURE__ */ jsx(
|
|
21
|
-
Controller,
|
|
22
|
-
{
|
|
23
|
-
control,
|
|
24
|
-
name: field,
|
|
25
|
-
render: ({ field: field2 }) => {
|
|
26
|
-
return /* @__PURE__ */ jsx(DataGridCellContainer, { ...container, ...errorProps, children: /* @__PURE__ */ jsx(Inner, { field: field2, inputProps: input }) });
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
const Inner = ({
|
|
32
|
-
field,
|
|
33
|
-
inputProps
|
|
34
|
-
}) => {
|
|
35
|
-
const { onChange: _, onBlur, ref, value, ...rest } = field;
|
|
36
|
-
const { ref: inputRef, onBlur: onInputBlur, onChange, ...input } = inputProps;
|
|
37
|
-
const [localValue, setLocalValue] = useState(value);
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
setLocalValue(value);
|
|
40
|
-
}, [value]);
|
|
41
|
-
const combinedRefs = useCombinedRefs(inputRef, ref);
|
|
42
|
-
return /* @__PURE__ */ jsx(
|
|
43
|
-
"input",
|
|
44
|
-
{
|
|
45
|
-
className: clx(
|
|
46
|
-
"txt-compact-small text-ui-fg-subtle flex size-full cursor-pointer items-center justify-center bg-transparent outline-none",
|
|
47
|
-
"focus:cursor-text"
|
|
48
|
-
),
|
|
49
|
-
autoComplete: "off",
|
|
50
|
-
tabIndex: -1,
|
|
51
|
-
value: localValue,
|
|
52
|
-
onChange: (e) => setLocalValue(e.target.value),
|
|
53
|
-
ref: combinedRefs,
|
|
54
|
-
onBlur: () => {
|
|
55
|
-
onBlur();
|
|
56
|
-
onInputBlur();
|
|
57
|
-
onChange(localValue, value);
|
|
58
|
-
},
|
|
59
|
-
...input,
|
|
60
|
-
...rest
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
};
|
|
64
|
-
export {
|
|
65
|
-
DataGridTextCell
|
|
66
|
-
};
|
package/.medusa/server/src/admin/components/data-grid/components/data-grid-toggleable-number-cell.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Switch } from "@medusajs/ui";
|
|
3
|
-
import { useState, useEffect, useRef } from "react";
|
|
4
|
-
import CurrencyInput from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-currency-input-field/dist/index.esm.js";
|
|
5
|
-
import { Controller } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
|
|
6
|
-
import { useCombinedRefs } from "../../../utils/refs.js";
|
|
7
|
-
import { ConditionalTooltip } from "../../conditional-tooltip.js";
|
|
8
|
-
import { useDataGridCell } from "../hooks/use-data-grid-cell.js";
|
|
9
|
-
import { useDataGridCellError } from "../hooks/use-data-grid-cell-error.js";
|
|
10
|
-
import "../context/data-grid-context.js";
|
|
11
|
-
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/get.js";
|
|
12
|
-
import "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/lodash/set.js";
|
|
13
|
-
import { DataGridCellContainer } from "./data-grid-cell-container.js";
|
|
14
|
-
const DataGridTogglableNumberCell = ({
|
|
15
|
-
context,
|
|
16
|
-
disabledToggleTooltip,
|
|
17
|
-
...rest
|
|
18
|
-
}) => {
|
|
19
|
-
const { field, control, renderProps } = useDataGridCell({
|
|
20
|
-
context
|
|
21
|
-
});
|
|
22
|
-
const errorProps = useDataGridCellError({ context });
|
|
23
|
-
const { container, input } = renderProps;
|
|
24
|
-
return /* @__PURE__ */ jsx(
|
|
25
|
-
Controller,
|
|
26
|
-
{
|
|
27
|
-
control,
|
|
28
|
-
name: field,
|
|
29
|
-
render: ({ field: field2 }) => {
|
|
30
|
-
return /* @__PURE__ */ jsx(
|
|
31
|
-
DataGridCellContainer,
|
|
32
|
-
{
|
|
33
|
-
...container,
|
|
34
|
-
...errorProps,
|
|
35
|
-
outerComponent: /* @__PURE__ */ jsx(
|
|
36
|
-
OuterComponent,
|
|
37
|
-
{
|
|
38
|
-
field: field2,
|
|
39
|
-
inputProps: input,
|
|
40
|
-
isAnchor: container.isAnchor,
|
|
41
|
-
tooltip: disabledToggleTooltip
|
|
42
|
-
}
|
|
43
|
-
),
|
|
44
|
-
children: /* @__PURE__ */ jsx(Inner, { field: field2, inputProps: input, ...rest })
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
const OuterComponent = ({
|
|
52
|
-
field,
|
|
53
|
-
inputProps,
|
|
54
|
-
isAnchor,
|
|
55
|
-
tooltip
|
|
56
|
-
}) => {
|
|
57
|
-
const buttonRef = useRef(null);
|
|
58
|
-
const { value } = field;
|
|
59
|
-
const { onChange } = inputProps;
|
|
60
|
-
const [localValue, setLocalValue] = useState(value);
|
|
61
|
-
useEffect(() => {
|
|
62
|
-
setLocalValue(value);
|
|
63
|
-
}, [value]);
|
|
64
|
-
const handleCheckedChange = (update) => {
|
|
65
|
-
const newValue = { ...localValue, checked: update };
|
|
66
|
-
if (!update && !newValue.disabledToggle) {
|
|
67
|
-
newValue.quantity = "";
|
|
68
|
-
}
|
|
69
|
-
if (update && newValue.quantity === "") {
|
|
70
|
-
newValue.quantity = 0;
|
|
71
|
-
}
|
|
72
|
-
setLocalValue(newValue);
|
|
73
|
-
onChange(newValue, value);
|
|
74
|
-
};
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
const handleKeyDown = (e) => {
|
|
77
|
-
var _a;
|
|
78
|
-
if (isAnchor && e.key.toLowerCase() === "x") {
|
|
79
|
-
e.preventDefault();
|
|
80
|
-
(_a = buttonRef.current) == null ? void 0 : _a.click();
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
84
|
-
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
85
|
-
}, [isAnchor]);
|
|
86
|
-
return /* @__PURE__ */ jsx(
|
|
87
|
-
ConditionalTooltip,
|
|
88
|
-
{
|
|
89
|
-
showTooltip: localValue.disabledToggle && tooltip,
|
|
90
|
-
content: tooltip,
|
|
91
|
-
children: /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 left-4 z-[3] flex w-fit items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
92
|
-
Switch,
|
|
93
|
-
{
|
|
94
|
-
ref: buttonRef,
|
|
95
|
-
size: "small",
|
|
96
|
-
className: "shrink-0",
|
|
97
|
-
checked: localValue.checked,
|
|
98
|
-
disabled: localValue.disabledToggle,
|
|
99
|
-
onCheckedChange: handleCheckedChange
|
|
100
|
-
}
|
|
101
|
-
) })
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
};
|
|
105
|
-
const Inner = ({
|
|
106
|
-
field,
|
|
107
|
-
inputProps,
|
|
108
|
-
placeholder,
|
|
109
|
-
...props
|
|
110
|
-
}) => {
|
|
111
|
-
const { ref, value, onChange: _, onBlur, ...fieldProps } = field;
|
|
112
|
-
const {
|
|
113
|
-
ref: inputRef,
|
|
114
|
-
onChange,
|
|
115
|
-
onBlur: onInputBlur,
|
|
116
|
-
onFocus,
|
|
117
|
-
...attributes
|
|
118
|
-
} = inputProps;
|
|
119
|
-
const [localValue, setLocalValue] = useState(value);
|
|
120
|
-
useEffect(() => {
|
|
121
|
-
setLocalValue(value);
|
|
122
|
-
}, [value]);
|
|
123
|
-
const combinedRefs = useCombinedRefs(inputRef, ref);
|
|
124
|
-
const handleInputChange = (updatedValue, _name, _values) => {
|
|
125
|
-
const ensuredValue = updatedValue !== void 0 ? updatedValue : "";
|
|
126
|
-
const newValue = { ...localValue, quantity: ensuredValue };
|
|
127
|
-
if (ensuredValue !== "") {
|
|
128
|
-
newValue.checked = true;
|
|
129
|
-
} else if (newValue.checked && newValue.disabledToggle === false) {
|
|
130
|
-
newValue.checked = false;
|
|
131
|
-
}
|
|
132
|
-
setLocalValue(newValue);
|
|
133
|
-
};
|
|
134
|
-
const handleOnChange = () => {
|
|
135
|
-
if (localValue.disabledToggle && localValue.quantity === "") {
|
|
136
|
-
localValue.quantity = 0;
|
|
137
|
-
}
|
|
138
|
-
onChange(localValue, value);
|
|
139
|
-
};
|
|
140
|
-
return /* @__PURE__ */ jsx("div", { className: "flex size-full items-center gap-x-2", children: /* @__PURE__ */ jsx(
|
|
141
|
-
CurrencyInput,
|
|
142
|
-
{
|
|
143
|
-
...fieldProps,
|
|
144
|
-
...attributes,
|
|
145
|
-
...props,
|
|
146
|
-
ref: combinedRefs,
|
|
147
|
-
className: "txt-compact-small w-full flex-1 cursor-default appearance-none bg-transparent pl-8 text-right outline-none",
|
|
148
|
-
value: localValue == null ? void 0 : localValue.quantity,
|
|
149
|
-
onValueChange: handleInputChange,
|
|
150
|
-
formatValueOnBlur: true,
|
|
151
|
-
onBlur: () => {
|
|
152
|
-
onBlur();
|
|
153
|
-
onInputBlur();
|
|
154
|
-
handleOnChange();
|
|
155
|
-
},
|
|
156
|
-
onFocus,
|
|
157
|
-
decimalsLimit: 0,
|
|
158
|
-
autoComplete: "off",
|
|
159
|
-
tabIndex: -1,
|
|
160
|
-
placeholder: !localValue.checked ? placeholder : void 0
|
|
161
|
-
}
|
|
162
|
-
) });
|
|
163
|
-
};
|
|
164
|
-
export {
|
|
165
|
-
DataGridTogglableNumberCell
|
|
166
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { DataGridBooleanCell } from "./data-grid-boolean-cell.js";
|
|
2
|
-
import { DataGridCurrencyCell } from "./data-grid-currency-cell.js";
|
|
3
|
-
import { DataGridNumberCell } from "./data-grid-number-cell.js";
|
|
4
|
-
import { DataGridReadonlyCell } from "./data-grid-readonly-cell.js";
|
|
5
|
-
import { DataGridRoot } from "./data-grid-root.js";
|
|
6
|
-
import { DataGridSkeleton } from "./data-grid-skeleton.js";
|
|
7
|
-
import { DataGridTextCell } from "./data-grid-text-cell.js";
|
|
8
|
-
export {
|
|
9
|
-
DataGridBooleanCell,
|
|
10
|
-
DataGridCurrencyCell,
|
|
11
|
-
DataGridNumberCell,
|
|
12
|
-
DataGridReadonlyCell as DataGridReadOnlyCell,
|
|
13
|
-
DataGridRoot,
|
|
14
|
-
DataGridSkeleton,
|
|
15
|
-
DataGridTextCell
|
|
16
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { DataGridContext } from "./data-grid-context.js";
|
|
3
|
-
const useDataGridContext = () => {
|
|
4
|
-
const context = useContext(DataGridContext);
|
|
5
|
-
if (!context) {
|
|
6
|
-
throw new Error(
|
|
7
|
-
"useDataGridContext must be used within a DataGridContextProvider"
|
|
8
|
-
);
|
|
9
|
-
}
|
|
10
|
-
return context;
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
useDataGridContext
|
|
14
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DataGridBooleanCell } from "./components/data-grid-boolean-cell.js";
|
|
3
|
-
import { DataGridCurrencyCell } from "./components/data-grid-currency-cell.js";
|
|
4
|
-
import { DataGridNumberCell } from "./components/data-grid-number-cell.js";
|
|
5
|
-
import { DataGridReadonlyCell } from "./components/data-grid-readonly-cell.js";
|
|
6
|
-
import { DataGridRoot } from "./components/data-grid-root.js";
|
|
7
|
-
import { DataGridSkeleton } from "./components/data-grid-skeleton.js";
|
|
8
|
-
import { DataGridTextCell } from "./components/data-grid-text-cell.js";
|
|
9
|
-
const _DataGrid = ({
|
|
10
|
-
isLoading,
|
|
11
|
-
...props
|
|
12
|
-
}) => {
|
|
13
|
-
var _a;
|
|
14
|
-
return isLoading ? /* @__PURE__ */ jsx(
|
|
15
|
-
DataGridSkeleton,
|
|
16
|
-
{
|
|
17
|
-
columns: props.columns,
|
|
18
|
-
rows: ((_a = props.data) == null ? void 0 : _a.length) && props.data.length > 0 ? props.data.length : 10
|
|
19
|
-
}
|
|
20
|
-
) : /* @__PURE__ */ jsx(DataGridRoot, { ...props });
|
|
21
|
-
};
|
|
22
|
-
const DataGrid = Object.assign(_DataGrid, {
|
|
23
|
-
BooleanCell: DataGridBooleanCell,
|
|
24
|
-
TextCell: DataGridTextCell,
|
|
25
|
-
NumberCell: DataGridNumberCell,
|
|
26
|
-
CurrencyCell: DataGridCurrencyCell,
|
|
27
|
-
ReadonlyCell: DataGridReadonlyCell
|
|
28
|
-
});
|
|
29
|
-
export {
|
|
30
|
-
DataGrid
|
|
31
|
-
};
|
package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-column-helper.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createColumnHelper } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/@tanstack/react-table/build/lib/index.mjs";
|
|
2
|
-
function createDataGridHelper() {
|
|
3
|
-
const columnHelper = createColumnHelper();
|
|
4
|
-
return {
|
|
5
|
-
column: ({
|
|
6
|
-
id,
|
|
7
|
-
name,
|
|
8
|
-
header,
|
|
9
|
-
cell,
|
|
10
|
-
disableHiding = false,
|
|
11
|
-
field,
|
|
12
|
-
type
|
|
13
|
-
}) => columnHelper.display({
|
|
14
|
-
id,
|
|
15
|
-
header,
|
|
16
|
-
cell,
|
|
17
|
-
enableHiding: !disableHiding,
|
|
18
|
-
meta: {
|
|
19
|
-
name,
|
|
20
|
-
field,
|
|
21
|
-
type
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
createDataGridHelper
|
|
28
|
-
};
|
package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-price-columns.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { IncludesTaxTooltip } from "../../tax-badge.js";
|
|
3
|
-
import { DataGridCurrencyCell } from "../components/data-grid-currency-cell.js";
|
|
4
|
-
import { DataGridReadonlyCell } from "../components/data-grid-readonly-cell.js";
|
|
5
|
-
import { createDataGridHelper } from "./create-data-grid-column-helper.js";
|
|
6
|
-
const createDataGridPriceColumns = ({
|
|
7
|
-
currencies,
|
|
8
|
-
regions,
|
|
9
|
-
pricePreferences,
|
|
10
|
-
isReadyOnly,
|
|
11
|
-
getFieldName
|
|
12
|
-
}) => {
|
|
13
|
-
const columnHelper = createDataGridHelper();
|
|
14
|
-
return [
|
|
15
|
-
...(currencies == null ? void 0 : currencies.map((currency) => {
|
|
16
|
-
const preference = pricePreferences == null ? void 0 : pricePreferences.find(
|
|
17
|
-
(p) => p.attribute === "currency_code" && p.value === currency
|
|
18
|
-
);
|
|
19
|
-
const translatedCurrencyName = `Price ${currency.toUpperCase()}`;
|
|
20
|
-
return columnHelper.column({
|
|
21
|
-
id: `currency_prices.${currency}`,
|
|
22
|
-
name: translatedCurrencyName,
|
|
23
|
-
field: (context) => {
|
|
24
|
-
const isReadyOnlyValue = isReadyOnly == null ? void 0 : isReadyOnly(context);
|
|
25
|
-
if (isReadyOnlyValue) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
return getFieldName(context, currency);
|
|
29
|
-
},
|
|
30
|
-
type: "number",
|
|
31
|
-
header: () => /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-3", children: [
|
|
32
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", title: translatedCurrencyName, children: translatedCurrencyName }),
|
|
33
|
-
/* @__PURE__ */ jsx(IncludesTaxTooltip, { includesTax: preference == null ? void 0 : preference.is_tax_inclusive })
|
|
34
|
-
] }),
|
|
35
|
-
cell: (context) => {
|
|
36
|
-
if (isReadyOnly == null ? void 0 : isReadyOnly(context)) {
|
|
37
|
-
return /* @__PURE__ */ jsx(DataGridReadonlyCell, { context });
|
|
38
|
-
}
|
|
39
|
-
return /* @__PURE__ */ jsx(DataGridCurrencyCell, { code: currency, context });
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
})) ?? [],
|
|
43
|
-
...(regions == null ? void 0 : regions.map((region) => {
|
|
44
|
-
const preference = pricePreferences == null ? void 0 : pricePreferences.find(
|
|
45
|
-
(p) => p.attribute === "region_id" && p.value === region.id
|
|
46
|
-
);
|
|
47
|
-
const translatedRegionName = `Price ${region.name}`;
|
|
48
|
-
return columnHelper.column({
|
|
49
|
-
id: `region_prices.${region.id}`,
|
|
50
|
-
name: translatedRegionName,
|
|
51
|
-
field: (context) => {
|
|
52
|
-
const isReadyOnlyValue = isReadyOnly == null ? void 0 : isReadyOnly(context);
|
|
53
|
-
if (isReadyOnlyValue) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
return getFieldName(context, region.id);
|
|
57
|
-
},
|
|
58
|
-
type: "number",
|
|
59
|
-
header: () => /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-3", children: [
|
|
60
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", title: translatedRegionName, children: translatedRegionName }),
|
|
61
|
-
/* @__PURE__ */ jsx(IncludesTaxTooltip, { includesTax: preference == null ? void 0 : preference.is_tax_inclusive })
|
|
62
|
-
] }),
|
|
63
|
-
cell: (context) => {
|
|
64
|
-
if (isReadyOnly == null ? void 0 : isReadyOnly(context)) {
|
|
65
|
-
return /* @__PURE__ */ jsx(DataGridReadonlyCell, { context });
|
|
66
|
-
}
|
|
67
|
-
const currency = currencies == null ? void 0 : currencies.find((c) => c === region.currency_code);
|
|
68
|
-
if (!currency) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
return /* @__PURE__ */ jsx(
|
|
72
|
-
DataGridCurrencyCell,
|
|
73
|
-
{
|
|
74
|
-
code: region.currency_code,
|
|
75
|
-
context
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
})) ?? []
|
|
81
|
-
];
|
|
82
|
-
};
|
|
83
|
-
export {
|
|
84
|
-
createDataGridPriceColumns
|
|
85
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useDataGridCell } from "./use-data-grid-cell.js";
|
|
2
|
-
import { useDataGridCellError } from "./use-data-grid-cell-error.js";
|
|
3
|
-
import { useDataGridCellHandlers } from "./use-data-grid-cell-handlers.js";
|
|
4
|
-
import { useDataGridCellMetadata } from "./use-data-grid-cell-metadata.js";
|
|
5
|
-
import { useDataGridCellSnapshot } from "./use-data-grid-cell-snapshot.js";
|
|
6
|
-
import { useDataGridClipboardEvents } from "./use-data-grid-clipboard-events.js";
|
|
7
|
-
import { useDataGridColumnVisibility } from "./use-data-grid-column-visibility.js";
|
|
8
|
-
import { useDataGridDuplicateCell } from "./use-data-grid-duplicate-cell.js";
|
|
9
|
-
import { useDataGridErrorHighlighting } from "./use-data-grid-error-highlighting.js";
|
|
10
|
-
import { convertArrayToPrimitive, useDataGridFormHandlers } from "./use-data-grid-form-handlers.js";
|
|
11
|
-
import { useDataGridKeydownEvent } from "./use-data-grid-keydown-event.js";
|
|
12
|
-
import { useDataGridMouseUpEvent } from "./use-data-grid-mouse-up-event.js";
|
|
13
|
-
import { useDataGridNavigation } from "./use-data-grid-navigation.js";
|
|
14
|
-
import { useDataGridQueryTool } from "./use-data-grid-query-tool.js";
|
|
15
|
-
export {
|
|
16
|
-
convertArrayToPrimitive,
|
|
17
|
-
useDataGridCell,
|
|
18
|
-
useDataGridCellError,
|
|
19
|
-
useDataGridCellHandlers,
|
|
20
|
-
useDataGridCellMetadata,
|
|
21
|
-
useDataGridCellSnapshot,
|
|
22
|
-
useDataGridClipboardEvents,
|
|
23
|
-
useDataGridColumnVisibility,
|
|
24
|
-
useDataGridDuplicateCell,
|
|
25
|
-
useDataGridErrorHighlighting,
|
|
26
|
-
useDataGridFormHandlers,
|
|
27
|
-
useDataGridKeydownEvent,
|
|
28
|
-
useDataGridMouseUpEvent,
|
|
29
|
-
useDataGridNavigation,
|
|
30
|
-
useDataGridQueryTool
|
|
31
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { get } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
|
|
3
|
-
import "../context/data-grid-context.js";
|
|
4
|
-
import { useDataGridContext } from "../context/use-data-grid-context.js";
|
|
5
|
-
const useDataGridCellError = ({
|
|
6
|
-
context
|
|
7
|
-
}) => {
|
|
8
|
-
const { errors, getCellErrorMetadata, navigateToField } = useDataGridContext();
|
|
9
|
-
const { rowIndex, columnIndex } = context;
|
|
10
|
-
const { accessor, field } = useMemo(() => {
|
|
11
|
-
return getCellErrorMetadata({ row: rowIndex, col: columnIndex });
|
|
12
|
-
}, [rowIndex, columnIndex, getCellErrorMetadata]);
|
|
13
|
-
const rowErrorsObject = accessor && columnIndex === 0 ? get(errors, accessor) : void 0;
|
|
14
|
-
const rowErrors = [];
|
|
15
|
-
function collectErrors(errorObject, baseAccessor) {
|
|
16
|
-
if (!errorObject) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (isFieldError(errorObject)) {
|
|
20
|
-
const message = errorObject.message;
|
|
21
|
-
const to = () => navigateToField(baseAccessor);
|
|
22
|
-
if (message) {
|
|
23
|
-
rowErrors.push({ message, to });
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
Object.keys(errorObject).forEach((key) => {
|
|
27
|
-
const nestedError = errorObject[key];
|
|
28
|
-
const fieldAccessor = `${baseAccessor}.${key}`;
|
|
29
|
-
if (nestedError && typeof nestedError === "object") {
|
|
30
|
-
collectErrors(nestedError, fieldAccessor);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (rowErrorsObject && accessor) {
|
|
36
|
-
collectErrors(rowErrorsObject, accessor);
|
|
37
|
-
}
|
|
38
|
-
const cellError = field ? get(errors, field) : void 0;
|
|
39
|
-
return {
|
|
40
|
-
errors,
|
|
41
|
-
rowErrors,
|
|
42
|
-
cellError
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
function isFieldError(errors) {
|
|
46
|
-
return typeof errors === "object" && "message" in errors && "type" in errors;
|
|
47
|
-
}
|
|
48
|
-
export {
|
|
49
|
-
useDataGridCellError
|
|
50
|
-
};
|