@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
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createDataTableColumnHelper, StatusBadge } from "@medusajs/ui";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { formatAmount } from "../../../../utils/format-amount.js";
|
|
5
|
-
import { getRelativeDate } from "../../../../utils/format-date.js";
|
|
6
|
-
import { getGiftCardStatus, getGiftCardStatusColor } from "../../../../utils/statuses.js";
|
|
7
|
-
const columnHelper = createDataTableColumnHelper();
|
|
8
|
-
const useGiftCardTableColumns = () => {
|
|
9
|
-
return useMemo(() => {
|
|
10
|
-
return [
|
|
11
|
-
columnHelper.accessor("line_item.product.title", {
|
|
12
|
-
header: "Product",
|
|
13
|
-
cell: ({ row }) => {
|
|
14
|
-
var _a, _b;
|
|
15
|
-
return ((_b = (_a = row.original.line_item) == null ? void 0 : _a.product) == null ? void 0 : _b.title) || "Custom Gift Card";
|
|
16
|
-
}
|
|
17
|
-
}),
|
|
18
|
-
columnHelper.accessor("customer.first_name", {
|
|
19
|
-
header: "Owner",
|
|
20
|
-
cell: ({ row }) => {
|
|
21
|
-
if (!row.original.customer) {
|
|
22
|
-
return "N/A";
|
|
23
|
-
}
|
|
24
|
-
const fullName = [
|
|
25
|
-
row.original.customer.first_name,
|
|
26
|
-
row.original.customer.last_name
|
|
27
|
-
];
|
|
28
|
-
if (fullName.join("").length > 0) {
|
|
29
|
-
return fullName.join(" ");
|
|
30
|
-
}
|
|
31
|
-
return row.original.customer.email;
|
|
32
|
-
}
|
|
33
|
-
}),
|
|
34
|
-
columnHelper.accessor("created_at", {
|
|
35
|
-
header: "Date issued",
|
|
36
|
-
cell: ({ row }) => getRelativeDate(row.original.created_at)
|
|
37
|
-
}),
|
|
38
|
-
columnHelper.accessor("status", {
|
|
39
|
-
header: "Status",
|
|
40
|
-
cell: ({ row }) => {
|
|
41
|
-
const status = getGiftCardStatus(row.original);
|
|
42
|
-
const color = getGiftCardStatusColor(status);
|
|
43
|
-
return /* @__PURE__ */ jsx(StatusBadge, { color, children: status });
|
|
44
|
-
}
|
|
45
|
-
}),
|
|
46
|
-
columnHelper.accessor("value", {
|
|
47
|
-
header: "Value",
|
|
48
|
-
cell: ({ row }) => {
|
|
49
|
-
return formatAmount(row.original.value, row.original.currency_code);
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
];
|
|
53
|
-
}, []);
|
|
54
|
-
};
|
|
55
|
-
export {
|
|
56
|
-
useGiftCardTableColumns
|
|
57
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { useDataTableDateFilters } from "../../../../hooks/common/use-data-table-date-filters.js";
|
|
3
|
-
import { useCustomerFilters } from "../../../../hooks/query/use-customers-filters.js";
|
|
4
|
-
const useGiftCardFilters = () => {
|
|
5
|
-
const dateFilterOptions = useDataTableDateFilters();
|
|
6
|
-
const customerFilterOptions = useCustomerFilters();
|
|
7
|
-
return useMemo(() => {
|
|
8
|
-
return [...dateFilterOptions, ...customerFilterOptions];
|
|
9
|
-
}, [dateFilterOptions, customerFilterOptions]);
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
useGiftCardFilters
|
|
13
|
-
};
|
package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/gift-cards-table.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Container } from "@medusajs/ui";
|
|
3
|
-
import { Fragment } from "react";
|
|
4
|
-
import { Outlet } from "react-router-dom";
|
|
5
|
-
import { DataTable } from "../../../../components/data-table.js";
|
|
6
|
-
import { useGiftCards } from "../../../../hooks/api/gift-cards.js";
|
|
7
|
-
import { useGiftCardTableColumns } from "./columns.js";
|
|
8
|
-
import { useGiftCardFilters } from "./filters.js";
|
|
9
|
-
import { useGiftCardTableQuery } from "./query.js";
|
|
10
|
-
const PAGE_SIZE = 10;
|
|
11
|
-
function GiftCardsTable() {
|
|
12
|
-
const queryParams = useGiftCardTableQuery({
|
|
13
|
-
pageSize: PAGE_SIZE
|
|
14
|
-
});
|
|
15
|
-
const {
|
|
16
|
-
gift_cards: giftCards,
|
|
17
|
-
isPending,
|
|
18
|
-
count
|
|
19
|
-
} = useGiftCards({
|
|
20
|
-
...queryParams,
|
|
21
|
-
order: queryParams.order ?? "-created_at",
|
|
22
|
-
fields: "+line_item.product.title"
|
|
23
|
-
});
|
|
24
|
-
const columns = useGiftCardTableColumns();
|
|
25
|
-
const filters = useGiftCardFilters();
|
|
26
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
|
-
/* @__PURE__ */ jsx(Container, { className: "p-0", children: /* @__PURE__ */ jsx(
|
|
28
|
-
DataTable,
|
|
29
|
-
{
|
|
30
|
-
data: giftCards,
|
|
31
|
-
getRowId: (row) => row.id,
|
|
32
|
-
columns,
|
|
33
|
-
filters,
|
|
34
|
-
isLoading: isPending,
|
|
35
|
-
pageSize: PAGE_SIZE,
|
|
36
|
-
rowCount: count,
|
|
37
|
-
enableSearch: false,
|
|
38
|
-
heading: "Gift Cards",
|
|
39
|
-
action: {
|
|
40
|
-
label: "Create gift card",
|
|
41
|
-
to: "create"
|
|
42
|
-
},
|
|
43
|
-
rowHref: (row) => `${row.id}`,
|
|
44
|
-
emptyState: {
|
|
45
|
-
empty: {
|
|
46
|
-
heading: "No gift cards found",
|
|
47
|
-
description: "Create a new gift card to get started."
|
|
48
|
-
},
|
|
49
|
-
filtered: {
|
|
50
|
-
heading: "No results found",
|
|
51
|
-
description: "No gift cards match your filter criteria."
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
) }),
|
|
56
|
-
/* @__PURE__ */ jsx(Outlet, {})
|
|
57
|
-
] });
|
|
58
|
-
}
|
|
59
|
-
export {
|
|
60
|
-
GiftCardsTable
|
|
61
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useQueryParams } from "../../../../hooks/common/use-query-params.js";
|
|
2
|
-
const useGiftCardTableQuery = ({
|
|
3
|
-
prefix,
|
|
4
|
-
pageSize = 20
|
|
5
|
-
}) => {
|
|
6
|
-
const queryObject = useQueryParams(
|
|
7
|
-
["offset", "customer_id", "created_at", "updated_at"],
|
|
8
|
-
prefix
|
|
9
|
-
);
|
|
10
|
-
const { offset, created_at, updated_at, customer_id, ...rest } = queryObject;
|
|
11
|
-
const searchParams = {
|
|
12
|
-
limit: pageSize,
|
|
13
|
-
offset: offset ? Number(offset) : 0,
|
|
14
|
-
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
15
|
-
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
16
|
-
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
17
|
-
...rest
|
|
18
|
-
};
|
|
19
|
-
return searchParams;
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
useGiftCardTableQuery
|
|
23
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { defineRouteConfig } from "@medusajs/admin-sdk";
|
|
3
|
-
import { Gift } from "@medusajs/icons";
|
|
4
|
-
import { Toaster } from "@medusajs/ui";
|
|
5
|
-
import { TwoColumnLayout } from "../../components/layouts/two-column.js";
|
|
6
|
-
import GiftCardProductsSection from "./components/gift-card-products-section.js";
|
|
7
|
-
import { GiftCardsTable } from "./components/gift-cards-table/gift-cards-table.js";
|
|
8
|
-
const GiftCardsPage = () => {
|
|
9
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10
|
-
/* @__PURE__ */ jsx(
|
|
11
|
-
TwoColumnLayout,
|
|
12
|
-
{
|
|
13
|
-
firstCol: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(GiftCardsTable, {}) }),
|
|
14
|
-
secondCol: /* @__PURE__ */ jsx(GiftCardProductsSection, {})
|
|
15
|
-
}
|
|
16
|
-
),
|
|
17
|
-
/* @__PURE__ */ jsx(Toaster, {})
|
|
18
|
-
] });
|
|
19
|
-
};
|
|
20
|
-
const config = defineRouteConfig({
|
|
21
|
-
label: "Gift Cards",
|
|
22
|
-
icon: Gift
|
|
23
|
-
});
|
|
24
|
-
export {
|
|
25
|
-
config,
|
|
26
|
-
GiftCardsPage as default
|
|
27
|
-
};
|
package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/credit-card-icon.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
const CreditCardIcon = ({ className }) => {
|
|
3
|
-
return /* @__PURE__ */ jsxs(
|
|
4
|
-
"svg",
|
|
5
|
-
{
|
|
6
|
-
className,
|
|
7
|
-
width: "40",
|
|
8
|
-
height: "30",
|
|
9
|
-
viewBox: "0 0 40 30",
|
|
10
|
-
fill: "none",
|
|
11
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
-
children: [
|
|
13
|
-
/* @__PURE__ */ jsx("rect", { width: "40", height: "30", rx: "6", fill: "#A1A1AA" }),
|
|
14
|
-
/* @__PURE__ */ jsx(
|
|
15
|
-
"rect",
|
|
16
|
-
{
|
|
17
|
-
width: "40",
|
|
18
|
-
height: "30",
|
|
19
|
-
rx: "6",
|
|
20
|
-
fill: "url(#paint0_linear_28831_48895)",
|
|
21
|
-
fillOpacity: "0.2"
|
|
22
|
-
}
|
|
23
|
-
),
|
|
24
|
-
/* @__PURE__ */ jsx(
|
|
25
|
-
"rect",
|
|
26
|
-
{
|
|
27
|
-
x: "0.25",
|
|
28
|
-
y: "0.25",
|
|
29
|
-
width: "39.5",
|
|
30
|
-
height: "29.5",
|
|
31
|
-
rx: "5.75",
|
|
32
|
-
stroke: "#18181B",
|
|
33
|
-
strokeOpacity: "0.1",
|
|
34
|
-
strokeWidth: "0.5"
|
|
35
|
-
}
|
|
36
|
-
),
|
|
37
|
-
/* @__PURE__ */ jsx(
|
|
38
|
-
"rect",
|
|
39
|
-
{
|
|
40
|
-
x: "5",
|
|
41
|
-
y: "21.5",
|
|
42
|
-
width: "8",
|
|
43
|
-
height: "2",
|
|
44
|
-
rx: "1",
|
|
45
|
-
fill: "#18181B",
|
|
46
|
-
fillOpacity: "0.24"
|
|
47
|
-
}
|
|
48
|
-
),
|
|
49
|
-
/* @__PURE__ */ jsx(
|
|
50
|
-
"rect",
|
|
51
|
-
{
|
|
52
|
-
x: "15",
|
|
53
|
-
y: "21.5",
|
|
54
|
-
width: "5",
|
|
55
|
-
height: "2",
|
|
56
|
-
rx: "1",
|
|
57
|
-
fill: "#18181B",
|
|
58
|
-
fillOpacity: "0.24"
|
|
59
|
-
}
|
|
60
|
-
),
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
62
|
-
"rect",
|
|
63
|
-
{
|
|
64
|
-
x: "5",
|
|
65
|
-
y: "10",
|
|
66
|
-
width: "6",
|
|
67
|
-
height: "4",
|
|
68
|
-
rx: "1",
|
|
69
|
-
fill: "#18181B",
|
|
70
|
-
fillOpacity: "0.24"
|
|
71
|
-
}
|
|
72
|
-
),
|
|
73
|
-
/* @__PURE__ */ jsx(
|
|
74
|
-
"rect",
|
|
75
|
-
{
|
|
76
|
-
x: "5.25",
|
|
77
|
-
y: "10.25",
|
|
78
|
-
width: "5.5",
|
|
79
|
-
height: "3.5",
|
|
80
|
-
rx: "0.75",
|
|
81
|
-
stroke: "#18181B",
|
|
82
|
-
strokeOpacity: "0.1",
|
|
83
|
-
strokeWidth: "0.5"
|
|
84
|
-
}
|
|
85
|
-
),
|
|
86
|
-
/* @__PURE__ */ jsx("g", { clipPath: "url(#clip0_28831_48895)", children: /* @__PURE__ */ jsx(
|
|
87
|
-
"path",
|
|
88
|
-
{
|
|
89
|
-
d: "M34.0612 20.9805L33.0423 20.3942C32.7089 20.2019 32.3003 20.2019 31.9669 20.3942L30.9433 20.9805C30.6146 21.1727 30.408 21.5292 30.408 21.9091V23.0862C30.408 23.4708 30.6146 23.8226 30.9433 24.0149L31.9622 24.6058C32.2956 24.7981 32.7042 24.7981 33.0376 24.6058L34.0565 24.0149C34.3899 23.8226 34.5919 23.4708 34.5919 23.0862V21.9091C34.6013 21.5292 34.3946 21.1727 34.0612 20.9805ZM32.5023 23.5459C31.9247 23.5459 31.4551 23.0769 31.4551 22.5C31.4551 21.9231 31.9247 21.4541 32.5023 21.4541C33.0798 21.4541 33.5541 21.9231 33.5541 22.5C33.5541 23.0769 33.0845 23.5459 32.5023 23.5459Z",
|
|
90
|
-
fill: "#18181B",
|
|
91
|
-
fillOpacity: "0.24"
|
|
92
|
-
}
|
|
93
|
-
) }),
|
|
94
|
-
/* @__PURE__ */ jsxs("defs", { children: [
|
|
95
|
-
/* @__PURE__ */ jsxs(
|
|
96
|
-
"linearGradient",
|
|
97
|
-
{
|
|
98
|
-
id: "paint0_linear_28831_48895",
|
|
99
|
-
x1: "20",
|
|
100
|
-
y1: "0",
|
|
101
|
-
x2: "20",
|
|
102
|
-
y2: "30",
|
|
103
|
-
gradientUnits: "userSpaceOnUse",
|
|
104
|
-
children: [
|
|
105
|
-
/* @__PURE__ */ jsx("stop", { stopColor: "white" }),
|
|
106
|
-
/* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
),
|
|
110
|
-
/* @__PURE__ */ jsx("clipPath", { id: "clip0_28831_48895", children: /* @__PURE__ */ jsx(
|
|
111
|
-
"rect",
|
|
112
|
-
{
|
|
113
|
-
width: "5",
|
|
114
|
-
height: "5",
|
|
115
|
-
fill: "white",
|
|
116
|
-
transform: "translate(30 20)"
|
|
117
|
-
}
|
|
118
|
-
) })
|
|
119
|
-
] })
|
|
120
|
-
]
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
};
|
|
124
|
-
export {
|
|
125
|
-
CreditCardIcon as default
|
|
126
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Container, Text } from "@medusajs/ui";
|
|
3
|
-
import { formatAmount } from "../../../../utils/format-amount.js";
|
|
4
|
-
const StoreCreditAccountBalanceSection = ({
|
|
5
|
-
storeCreditAccount
|
|
6
|
-
}) => {
|
|
7
|
-
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
return /* @__PURE__ */ jsx(Container, { className: "grid grid-cols-2 gap-x-2 px-6 py-4", children: /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-x-3", children: [
|
|
11
|
-
/* @__PURE__ */ jsx("div", { className: "bg-ui-tag-green-icon h-8 w-1 rounded-full" }),
|
|
12
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
13
|
-
/* @__PURE__ */ jsx(Text, { weight: "plus", size: "small", className: "text-ui-fg-subtle", children: "Current Balance" }),
|
|
14
|
-
/* @__PURE__ */ jsx(
|
|
15
|
-
Text,
|
|
16
|
-
{
|
|
17
|
-
weight: "plus",
|
|
18
|
-
size: "xlarge",
|
|
19
|
-
className: "tabular-nums text-ui-fg-base",
|
|
20
|
-
children: formatAmount(
|
|
21
|
-
storeCreditAccount.balance,
|
|
22
|
-
storeCreditAccount.currency_code
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
)
|
|
26
|
-
] })
|
|
27
|
-
] }) });
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
StoreCreditAccountBalanceSection as default
|
|
31
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Container, Text } from "@medusajs/ui";
|
|
3
|
-
import DisplayId from "../../../../components/display-id.js";
|
|
4
|
-
import CreditCardIcon from "./credit-card-icon.js";
|
|
5
|
-
const StoreCreditAccountDetailsSection = ({
|
|
6
|
-
storeCreditAccount
|
|
7
|
-
}) => {
|
|
8
|
-
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
return /* @__PURE__ */ jsx(Container, { className: "grid grid-cols-2 gap-x-2 px-6 py-6", children: /* @__PURE__ */ jsxs(
|
|
12
|
-
Text,
|
|
13
|
-
{
|
|
14
|
-
weight: "plus",
|
|
15
|
-
size: "xlarge",
|
|
16
|
-
className: "text-ui-fg-base flex gap-x-4",
|
|
17
|
-
children: [
|
|
18
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
19
|
-
/* @__PURE__ */ jsx(CreditCardIcon, { className: "inline" }),
|
|
20
|
-
" "
|
|
21
|
-
] }),
|
|
22
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
23
|
-
/* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle", children: [
|
|
24
|
-
storeCreditAccount.currency_code.toUpperCase(),
|
|
25
|
-
" Account"
|
|
26
|
-
] }),
|
|
27
|
-
/* @__PURE__ */ jsx("div", { className: "text-ui-fg-base", children: /* @__PURE__ */ jsx(
|
|
28
|
-
Text,
|
|
29
|
-
{
|
|
30
|
-
weight: "regular",
|
|
31
|
-
size: "small",
|
|
32
|
-
className: "text-ui-fg-base flex gap-x-4",
|
|
33
|
-
children: /* @__PURE__ */ jsx(DisplayId, { id: storeCreditAccount.id })
|
|
34
|
-
}
|
|
35
|
-
) })
|
|
36
|
-
] })
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
) });
|
|
40
|
-
};
|
|
41
|
-
export {
|
|
42
|
-
StoreCreditAccountDetailsSection as default
|
|
43
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createDataTableColumnHelper } from "@medusajs/ui";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import DisplayId from "../../../../../components/display-id.js";
|
|
5
|
-
import { formatAmount } from "../../../../../utils/format-amount.js";
|
|
6
|
-
import { formatDate } from "../../../../../utils/format-date.js";
|
|
7
|
-
const columnHelper = createDataTableColumnHelper();
|
|
8
|
-
const useTransactionsTableColumns = () => {
|
|
9
|
-
return useMemo(() => {
|
|
10
|
-
return [
|
|
11
|
-
columnHelper.accessor("id", {
|
|
12
|
-
header: "ID",
|
|
13
|
-
cell: ({ row }) => {
|
|
14
|
-
return /* @__PURE__ */ jsx(DisplayId, { id: row.original.id });
|
|
15
|
-
}
|
|
16
|
-
}),
|
|
17
|
-
columnHelper.accessor("created_at", {
|
|
18
|
-
header: "Created At",
|
|
19
|
-
cell: ({ row }) => formatDate(row.original.created_at, false)
|
|
20
|
-
}),
|
|
21
|
-
columnHelper.accessor("reference", {
|
|
22
|
-
header: "Reference",
|
|
23
|
-
cell: ({ row }) => {
|
|
24
|
-
return row.original.reference;
|
|
25
|
-
}
|
|
26
|
-
}),
|
|
27
|
-
columnHelper.accessor("reference_id", {
|
|
28
|
-
header: "Reference ID"
|
|
29
|
-
}),
|
|
30
|
-
columnHelper.accessor("amount", {
|
|
31
|
-
header: "Amount",
|
|
32
|
-
cell: ({ row }) => {
|
|
33
|
-
return row.original.account.currency_code && formatAmount(
|
|
34
|
-
row.original.amount,
|
|
35
|
-
row.original.account.currency_code
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
})
|
|
39
|
-
];
|
|
40
|
-
}, []);
|
|
41
|
-
};
|
|
42
|
-
export {
|
|
43
|
-
useTransactionsTableColumns
|
|
44
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { useDataTableDateFilters } from "../../../../../hooks/common/use-data-table-date-filters.js";
|
|
3
|
-
import { useTransactionGroupFilters } from "../../../../../hooks/query/use-transaction-groups-filters.js";
|
|
4
|
-
const useTransactionsTableFilters = ({
|
|
5
|
-
transactionGroup
|
|
6
|
-
}) => {
|
|
7
|
-
const dateFilterOptions = useDataTableDateFilters();
|
|
8
|
-
const transactionGroupFilters = useTransactionGroupFilters();
|
|
9
|
-
return useMemo(() => {
|
|
10
|
-
if (transactionGroup) {
|
|
11
|
-
return [...dateFilterOptions];
|
|
12
|
-
}
|
|
13
|
-
return [...dateFilterOptions, ...transactionGroupFilters];
|
|
14
|
-
}, [dateFilterOptions, transactionGroupFilters, transactionGroup]);
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
useTransactionsTableFilters
|
|
18
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useQueryParams } from "../../../../../hooks/common/use-query-params.js";
|
|
2
|
-
const useTransactionsTableQuery = ({
|
|
3
|
-
prefix,
|
|
4
|
-
pageSize = 20
|
|
5
|
-
}) => {
|
|
6
|
-
const queryObject = useQueryParams(
|
|
7
|
-
[
|
|
8
|
-
"offset",
|
|
9
|
-
"limit",
|
|
10
|
-
"transaction_group_id",
|
|
11
|
-
"currency_code",
|
|
12
|
-
"created_at",
|
|
13
|
-
"updated_at"
|
|
14
|
-
],
|
|
15
|
-
prefix
|
|
16
|
-
);
|
|
17
|
-
const {
|
|
18
|
-
offset,
|
|
19
|
-
limit,
|
|
20
|
-
created_at,
|
|
21
|
-
updated_at,
|
|
22
|
-
transaction_group_id,
|
|
23
|
-
...rest
|
|
24
|
-
} = queryObject;
|
|
25
|
-
const searchParams = {
|
|
26
|
-
limit: limit ? Number(limit) : pageSize,
|
|
27
|
-
offset: offset ? Number(offset) : 0,
|
|
28
|
-
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
29
|
-
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
30
|
-
transaction_group_id: transaction_group_id ? JSON.parse(transaction_group_id) : void 0,
|
|
31
|
-
...rest
|
|
32
|
-
};
|
|
33
|
-
return searchParams;
|
|
34
|
-
};
|
|
35
|
-
export {
|
|
36
|
-
useTransactionsTableQuery
|
|
37
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Container } from "@medusajs/ui";
|
|
3
|
-
import { Fragment } from "react";
|
|
4
|
-
import { Outlet } from "react-router-dom";
|
|
5
|
-
import { DataTable } from "../../../../../components/data-table.js";
|
|
6
|
-
import { useStoreCreditAccountTransactions } from "../../../../../hooks/api/transactions.js";
|
|
7
|
-
import { useTransactionsTableColumns } from "./columns.js";
|
|
8
|
-
import { useTransactionsTableFilters } from "./filters.js";
|
|
9
|
-
import { useTransactionsTableQuery } from "./query.js";
|
|
10
|
-
const PAGE_SIZE = 10;
|
|
11
|
-
function TransactionsTable({
|
|
12
|
-
id,
|
|
13
|
-
transactionGroup
|
|
14
|
-
}) {
|
|
15
|
-
const queryParams = useTransactionsTableQuery({
|
|
16
|
-
pageSize: PAGE_SIZE
|
|
17
|
-
});
|
|
18
|
-
const { transactions, isLoading, count } = useStoreCreditAccountTransactions(
|
|
19
|
-
id,
|
|
20
|
-
{
|
|
21
|
-
...queryParams,
|
|
22
|
-
transaction_group_id: transactionGroup == null ? void 0 : transactionGroup.id,
|
|
23
|
-
order: queryParams.order ?? "-created_at",
|
|
24
|
-
fields: "*account,*transaction_group"
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
const columns = useTransactionsTableColumns();
|
|
28
|
-
const filters = useTransactionsTableFilters({ transactionGroup });
|
|
29
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
-
/* @__PURE__ */ jsx(Container, { className: "p-0", children: /* @__PURE__ */ jsx(
|
|
31
|
-
DataTable,
|
|
32
|
-
{
|
|
33
|
-
data: transactions ?? [],
|
|
34
|
-
getRowId: (row) => row.id,
|
|
35
|
-
columns,
|
|
36
|
-
filters,
|
|
37
|
-
isLoading,
|
|
38
|
-
pageSize: PAGE_SIZE,
|
|
39
|
-
rowCount: count,
|
|
40
|
-
enableSearch: false,
|
|
41
|
-
heading: "Transactions",
|
|
42
|
-
emptyState: {
|
|
43
|
-
empty: {
|
|
44
|
-
heading: "No transactions found"
|
|
45
|
-
},
|
|
46
|
-
filtered: {
|
|
47
|
-
heading: "No results found",
|
|
48
|
-
description: "No transactions match your filter criteria."
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
) }),
|
|
53
|
-
/* @__PURE__ */ jsx(Outlet, {})
|
|
54
|
-
] });
|
|
55
|
-
}
|
|
56
|
-
export {
|
|
57
|
-
TransactionsTable
|
|
58
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useParams } from "react-router-dom";
|
|
3
|
-
import { TwoColumnLayout } from "../../../components/layouts/two-column.js";
|
|
4
|
-
import { useStoreCreditAccount } from "../../../hooks/api/store-credit-accounts.js";
|
|
5
|
-
import StoreCreditAccountBalanceSection from "./components/store-credit-account-balance-section.js";
|
|
6
|
-
import StoreCreditAccountDetailsSection from "./components/store-credit-account-details-section.js";
|
|
7
|
-
import { TransactionsTable } from "./components/transactions-table/table.js";
|
|
8
|
-
const StoreCreditAccountPage = () => {
|
|
9
|
-
const { id } = useParams();
|
|
10
|
-
const { store_credit_account: storeCreditAccount } = useStoreCreditAccount(
|
|
11
|
-
id
|
|
12
|
-
);
|
|
13
|
-
if (!storeCreditAccount) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
17
|
-
TwoColumnLayout,
|
|
18
|
-
{
|
|
19
|
-
firstCol: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
|
-
/* @__PURE__ */ jsx(
|
|
21
|
-
StoreCreditAccountDetailsSection,
|
|
22
|
-
{
|
|
23
|
-
storeCreditAccount
|
|
24
|
-
}
|
|
25
|
-
),
|
|
26
|
-
/* @__PURE__ */ jsx(TransactionsTable, { id: storeCreditAccount.id })
|
|
27
|
-
] }),
|
|
28
|
-
secondCol: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
29
|
-
StoreCreditAccountBalanceSection,
|
|
30
|
-
{
|
|
31
|
-
storeCreditAccount
|
|
32
|
-
}
|
|
33
|
-
) })
|
|
34
|
-
}
|
|
35
|
-
) });
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
StoreCreditAccountPage as default
|
|
39
|
-
};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createDataTableColumnHelper, Badge } from "@medusajs/ui";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { formatAmount } from "../../../../utils/format-amount.js";
|
|
5
|
-
import { getRelativeDate } from "../../../../utils/format-date.js";
|
|
6
|
-
const columnHelper = createDataTableColumnHelper();
|
|
7
|
-
const useStoreCreditAccountTableColumns = () => {
|
|
8
|
-
return useMemo(() => {
|
|
9
|
-
return [
|
|
10
|
-
columnHelper.accessor("currency_code", {
|
|
11
|
-
header: "Currency",
|
|
12
|
-
cell: ({ row }) => {
|
|
13
|
-
return /* @__PURE__ */ jsx(Badge, { size: "2xsmall", children: row.original.currency_code.toUpperCase() });
|
|
14
|
-
}
|
|
15
|
-
}),
|
|
16
|
-
columnHelper.accessor("customer.email", {
|
|
17
|
-
header: "Customer",
|
|
18
|
-
cell: ({ row }) => {
|
|
19
|
-
return row.original.customer.email;
|
|
20
|
-
}
|
|
21
|
-
}),
|
|
22
|
-
columnHelper.accessor("balance", {
|
|
23
|
-
header: "Balance",
|
|
24
|
-
cell: ({ row }) => {
|
|
25
|
-
return formatAmount(
|
|
26
|
-
row.original.balance,
|
|
27
|
-
row.original.currency_code
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
}),
|
|
31
|
-
columnHelper.accessor("credits", {
|
|
32
|
-
header: "Credits",
|
|
33
|
-
cell: ({ row }) => {
|
|
34
|
-
return formatAmount(
|
|
35
|
-
row.original.credits,
|
|
36
|
-
row.original.currency_code
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
}),
|
|
40
|
-
columnHelper.accessor("debits", {
|
|
41
|
-
header: "Debits",
|
|
42
|
-
cell: ({ row }) => {
|
|
43
|
-
return formatAmount(
|
|
44
|
-
row.original.debits,
|
|
45
|
-
row.original.currency_code
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
}),
|
|
49
|
-
columnHelper.accessor("created_at", {
|
|
50
|
-
header: "Created at",
|
|
51
|
-
cell: ({ row }) => getRelativeDate(row.original.created_at)
|
|
52
|
-
})
|
|
53
|
-
];
|
|
54
|
-
}, []);
|
|
55
|
-
};
|
|
56
|
-
export {
|
|
57
|
-
useStoreCreditAccountTableColumns
|
|
58
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { useDataTableDateFilters } from "../../../../hooks/common/use-data-table-date-filters.js";
|
|
3
|
-
import { useCustomerFilters } from "../../../../hooks/query/use-customers-filters.js";
|
|
4
|
-
const useStoreCreditAccountFilters = () => {
|
|
5
|
-
const dateFilterOptions = useDataTableDateFilters();
|
|
6
|
-
const customerFilterOptions = useCustomerFilters();
|
|
7
|
-
return useMemo(() => {
|
|
8
|
-
return [...dateFilterOptions, ...customerFilterOptions];
|
|
9
|
-
}, [dateFilterOptions, customerFilterOptions]);
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
useStoreCreditAccountFilters
|
|
13
|
-
};
|