@medusajs/loyalty-plugin 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/components/action-menu.js +63 -0
- package/.medusa/server/src/admin/components/chip-group.js +82 -0
- package/.medusa/server/src/admin/components/chip-input.js +157 -0
- package/.medusa/server/src/admin/components/combobox.js +324 -0
- package/.medusa/server/src/admin/components/conditional-tooltip.js +15 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-boolean-cell.js +66 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-cell-container.js +77 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-currency-cell.js +110 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-duplicate-cell.js +16 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-keyboard-shortcut-modal.js +214 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-number-cell.js +77 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-readonly-cell.js +32 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-root.js +743 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-row-error-indicator.js +37 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-skeleton.js +54 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-text-cell.js +66 -0
- package/.medusa/server/src/admin/components/data-grid/components/data-grid-toggleable-number-cell.js +166 -0
- package/.medusa/server/src/admin/components/data-grid/components/index.js +16 -0
- package/.medusa/server/src/admin/components/data-grid/context/data-grid-context.js +7 -0
- package/.medusa/server/src/admin/components/data-grid/context/index.js +6 -0
- package/.medusa/server/src/admin/components/data-grid/context/use-data-grid-context.js +14 -0
- package/.medusa/server/src/admin/components/data-grid/data-grid.js +31 -0
- package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-column-helper.js +28 -0
- package/.medusa/server/src/admin/components/data-grid/helpers/create-data-grid-price-columns.js +85 -0
- package/.medusa/server/src/admin/components/data-grid/helpers/index.js +6 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/index.js +31 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-error.js +50 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-handlers.js +123 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-metadata.js +52 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell-snapshot.js +43 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-cell.js +191 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-clipboard-events.js +70 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-column-visibility.js +51 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-duplicate-cell.js +15 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-error-highlighting.js +86 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-form-handlers.js +149 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-keydown-event.js +482 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-mouse-up-event.js +64 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-navigation.js +81 -0
- package/.medusa/server/src/admin/components/data-grid/hooks/use-data-grid-query-tool.js +14 -0
- package/.medusa/server/src/admin/components/data-grid/index.js +8 -0
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-bulk-update-command.js +27 -0
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-matrix.js +296 -0
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-query-tool.js +62 -0
- package/.medusa/server/src/admin/components/data-grid/models/data-grid-update-command.js +25 -0
- package/.medusa/server/src/admin/components/data-grid/models/index.js +10 -0
- package/.medusa/server/src/admin/components/data-grid/types.js +1 -0
- package/.medusa/server/src/admin/components/data-grid/utils.js +18 -0
- package/.medusa/server/src/admin/components/data-table/components/data-table-status-cell/data-table-status-cell.js +36 -0
- package/.medusa/server/src/admin/components/data-table/data-table.js +271 -0
- package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-columns.js +51 -0
- package/.medusa/server/src/admin/components/data-table/helpers/general/use-data-table-date-filters.js +90 -0
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/index.js +10 -0
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-columns.js +48 -0
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-empty-state.js +19 -0
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-filters.js +30 -0
- package/.medusa/server/src/admin/components/data-table/helpers/sales-channels/use-sales-channel-table-query.js +23 -0
- package/.medusa/server/src/admin/components/data-table/index.js +4 -0
- package/.medusa/server/src/admin/components/data-table.js +249 -0
- package/.medusa/server/src/admin/components/display-id.js +18 -0
- package/.medusa/server/src/admin/components/file-upload.js +116 -0
- package/.medusa/server/src/admin/components/form.js +151 -0
- package/.medusa/server/src/admin/components/handle-input.js +22 -0
- package/.medusa/server/src/admin/components/header.js +41 -0
- package/.medusa/server/src/admin/components/icon-avatar.js +27 -0
- package/.medusa/server/src/admin/components/json-view-section.js +139 -0
- package/.medusa/server/src/admin/components/keybound-form.js +32 -0
- package/.medusa/server/src/admin/components/layouts/single-column.js +7 -0
- package/.medusa/server/src/admin/components/layouts/two-column.js +13 -0
- package/.medusa/server/src/admin/components/listicle.js +20 -0
- package/.medusa/server/src/admin/components/modals/index.js +19 -0
- package/.medusa/server/src/admin/components/modals/route-drawer/index.js +4 -0
- package/.medusa/server/src/admin/components/modals/route-drawer/route-drawer.js +57 -0
- package/.medusa/server/src/admin/components/modals/route-focus-modal/index.js +4 -0
- package/.medusa/server/src/admin/components/modals/route-focus-modal/route-focus-modal.js +71 -0
- package/.medusa/server/src/admin/components/modals/route-modal-form/index.js +4 -0
- package/.medusa/server/src/admin/components/modals/route-modal-form/route-modal-form.js +60 -0
- package/.medusa/server/src/admin/components/modals/route-modal-provider/index.js +6 -0
- package/.medusa/server/src/admin/components/modals/route-modal-provider/route-modal-context.js +5 -0
- package/.medusa/server/src/admin/components/modals/route-modal-provider/route-provider.js +30 -0
- package/.medusa/server/src/admin/components/modals/route-modal-provider/use-route-modal.js +12 -0
- package/.medusa/server/src/admin/components/modals/stacked-drawer/index.js +5 -0
- package/.medusa/server/src/admin/components/modals/stacked-drawer/stacked-drawer.js +55 -0
- package/.medusa/server/src/admin/components/modals/stacked-focus-modal/index.js +5 -0
- package/.medusa/server/src/admin/components/modals/stacked-focus-modal/stacked-focus-modal.js +63 -0
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/index.js +6 -0
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-context.js +5 -0
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/stacked-modal-provider.js +47 -0
- package/.medusa/server/src/admin/components/modals/stacked-modal-provider/use-stacked-modal.js +14 -0
- package/.medusa/server/src/admin/components/placeholder-cell.js +7 -0
- package/.medusa/server/src/admin/components/product/product-cell/index.js +5 -0
- package/.medusa/server/src/admin/components/product/product-cell/product-cell.js +15 -0
- package/.medusa/server/src/admin/components/product/product-status-cell/index.js +5 -0
- package/.medusa/server/src/admin/components/product/product-status-cell/product-status-cell.js +18 -0
- package/.medusa/server/src/admin/components/product/sales-channels-cell/index.js +5 -0
- package/.medusa/server/src/admin/components/product/sales-channels-cell/sales-channels-cell.js +31 -0
- package/.medusa/server/src/admin/components/product/variant-cell/index.js +5 -0
- package/.medusa/server/src/admin/components/product/variant-cell/variant-cell.js +15 -0
- package/.medusa/server/src/admin/components/section-row.js +32 -0
- package/.medusa/server/src/admin/components/sidebar-link.js +31 -0
- package/.medusa/server/src/admin/components/sortable-list.js +152 -0
- package/.medusa/server/src/admin/components/switch-box.js +43 -0
- package/.medusa/server/src/admin/components/tax-badge.js +18 -0
- package/.medusa/server/src/admin/components/thumbnail.js +28 -0
- package/.medusa/server/src/admin/components/upload-media-form-item.js +83 -0
- package/.medusa/server/src/admin/hooks/api/customers.js +26 -0
- package/.medusa/server/src/admin/hooks/api/gift-cards.js +107 -0
- package/.medusa/server/src/admin/hooks/api/order.js +16 -0
- package/.medusa/server/src/admin/hooks/api/price-preferences.js +19 -0
- package/.medusa/server/src/admin/hooks/api/products.js +127 -0
- package/.medusa/server/src/admin/hooks/api/regions.js +17 -0
- package/.medusa/server/src/admin/hooks/api/sales-channels.js +28 -0
- package/.medusa/server/src/admin/hooks/api/store-credit-accounts.js +41 -0
- package/.medusa/server/src/admin/hooks/api/store.js +31 -0
- package/.medusa/server/src/admin/hooks/api/transaction-groups.js +23 -0
- package/.medusa/server/src/admin/hooks/api/transactions.js +23 -0
- package/.medusa/server/src/admin/hooks/commands/use-command-history.js +45 -0
- package/.medusa/server/src/admin/hooks/common/use-combobox-data.js +59 -0
- package/.medusa/server/src/admin/hooks/common/use-data-table-date-filters.js +89 -0
- package/.medusa/server/src/admin/hooks/common/use-date.js +32 -0
- package/.medusa/server/src/admin/hooks/common/use-debounced-search.js +22 -0
- package/.medusa/server/src/admin/hooks/common/use-query-params.js +14 -0
- package/.medusa/server/src/admin/hooks/query/use-customers-filters.js +30 -0
- package/.medusa/server/src/admin/hooks/query/use-transaction-groups-filters.js +30 -0
- package/.medusa/server/src/admin/hooks/sales-channels/index.js +10 -0
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-columns.js +48 -0
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-empty-state.js +19 -0
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-filters.js +30 -0
- package/.medusa/server/src/admin/hooks/sales-channels/use-sales-channel-table-query.js +23 -0
- package/.medusa/server/src/admin/lib/currencies.js +729 -0
- package/.medusa/server/src/admin/lib/query-key.js +17 -0
- package/.medusa/server/src/admin/lib/sdk.js +10 -0
- package/.medusa/server/src/admin/routes/gift-card-products/@create/page.js +75 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/components/gift-card-product-edit-denominations-form.js +172 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@denominations/page.js +30 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/components/gift-card-product-edit-form.js +180 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/@edit/page.js +30 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-general-section.js +97 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-media-section.js +162 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-sales-channel-section.js +89 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/components/product-variant-section.js +199 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/edit-product-media-form.js +353 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/edit-product-media-form/index.js +5 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/index.js +4 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-gallery/product-media-gallery.js +247 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/index.js +4 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view-context.js +5 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/product-media-view.js +48 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/components/product-media-view/use-product-media-view.js +14 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/media/page.js +28 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/page.js +40 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/prices-edit.js +121 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/variant-pricing-form.js +72 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/page.js +23 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/components/edit-sales-channel-form.js +123 -0
- package/.medusa/server/src/admin/routes/gift-card-products/_id_/sales-channels/page.js +23 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/general-form-section.js +1 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-denominations-form.js +98 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-details-form.js +28 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-denominations.js +96 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-general.js +90 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-media.js +288 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-organize-section.js +111 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form-organize.js +23 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-create-form.js +285 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/gift-card-product-sales-channel-stacked-modal.js +124 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/index.js +4 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/schema.js +112 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-product-create-form/types.js +1 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/columns.js +35 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/filters.js +11 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/gift-card-products-table.js +61 -0
- package/.medusa/server/src/admin/routes/gift-card-products/components/gift-card-products-table/query.js +23 -0
- package/.medusa/server/src/admin/routes/gift-card-products/page.js +18 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@expiration/page.js +137 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@note/page.js +87 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/components/transfer-icon.js +352 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/@owner/page.js +116 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-balance-section.js +49 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-general-section.js +177 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-note-section.js +27 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-order-section.js +33 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-owner-section.js +33 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/gift-card-transactions-section.js +18 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/columns.js +50 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/components/transactions-table/query.js +23 -0
- package/.medusa/server/src/admin/routes/gift-cards/_id_/page.js +78 -0
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-card-products-section.js +40 -0
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/columns.js +57 -0
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/filters.js +13 -0
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/gift-cards-table.js +61 -0
- package/.medusa/server/src/admin/routes/gift-cards/components/gift-cards-table/query.js +23 -0
- package/.medusa/server/src/admin/routes/gift-cards/page.js +27 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/credit-card-icon.js +126 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-balance-section.js +31 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/store-credit-account-details-section.js +43 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/columns.js +44 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/filters.js +18 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/query.js +37 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/components/transactions-table/table.js +58 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/_id_/page.js +39 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/columns.js +58 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/filters.js +13 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/query.js +31 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/components/store-credit-accounts-table/table.js +56 -0
- package/.medusa/server/src/admin/routes/store-credit-accounts/page.js +19 -0
- package/.medusa/server/src/admin/utils/date-utils.js +27 -0
- package/.medusa/server/src/admin/utils/format-amount.js +9 -0
- package/.medusa/server/src/admin/utils/format-date.js +21 -0
- package/.medusa/server/src/admin/utils/refs.js +20 -0
- package/.medusa/server/src/admin/utils/statuses.js +23 -0
- package/.medusa/server/src/admin/utils/validations.js +71 -0
- package/.medusa/server/src/admin/utils/variants.js +92 -0
- package/.medusa/server/src/admin/widgets/customer-gift-cards-widget.js +67 -0
- package/.medusa/server/src/admin/widgets/customer-store-credit-widget.js +42 -0
- package/.medusa/server/src/admin/widgets/order-gift-cards-widget.js +58 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/redeem/route.js +25 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/route.js +41 -0
- package/.medusa/server/src/api/admin/gift-cards/[id]/transfer/route.js +24 -0
- package/.medusa/server/src/api/admin/gift-cards/middlewares.js +55 -0
- package/.medusa/server/src/api/admin/gift-cards/query-config.js +29 -0
- package/.medusa/server/src/api/admin/gift-cards/route.js +42 -0
- package/.medusa/server/src/api/admin/gift-cards/validators.js +69 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/route.js +24 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/[id]/transactions/route.js +23 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/middlewares.js +38 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/query-config.js +43 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/route.js +52 -0
- package/.medusa/server/src/api/admin/store-credit-accounts/validators.js +51 -0
- package/.medusa/server/src/api/admin/transaction-groups/middlewares.js +16 -0
- package/.medusa/server/src/api/admin/transaction-groups/query-config.js +13 -0
- package/.medusa/server/src/api/admin/transaction-groups/route.js +27 -0
- package/.medusa/server/src/api/admin/transaction-groups/validators.js +19 -0
- package/.medusa/server/src/api/middlewares.js +22 -0
- package/.medusa/server/src/api/store/carts/[id]/gift-cards/route.js +43 -0
- package/.medusa/server/src/api/store/carts/middlewares.js +26 -0
- package/.medusa/server/src/api/store/carts/query-config.js +9 -0
- package/.medusa/server/src/api/store/carts/validators.js +15 -0
- package/.medusa/server/src/api/store/gift-card-invitations/[code]/accept/route.js +24 -0
- package/.medusa/server/src/api/store/gift-card-invitations/[code]/reject/route.js +24 -0
- package/.medusa/server/src/api/store/gift-card-invitations/middlewares.js +30 -0
- package/.medusa/server/src/api/store/gift-card-invitations/query-config.js +17 -0
- package/.medusa/server/src/api/store/gift-card-invitations/validators.js +14 -0
- package/.medusa/server/src/api/store/gift-cards/[id]/invitation/route.js +26 -0
- package/.medusa/server/src/api/store/gift-cards/[id]/redeem/route.js +24 -0
- package/.medusa/server/src/api/store/gift-cards/[id]/route.js +16 -0
- package/.medusa/server/src/api/store/gift-cards/middlewares.js +46 -0
- package/.medusa/server/src/api/store/gift-cards/query-config.js +26 -0
- package/.medusa/server/src/api/store/gift-cards/route.js +28 -0
- package/.medusa/server/src/api/store/gift-cards/validators.js +26 -0
- package/.medusa/server/src/api/store/store-credit-accounts/[id]/route.js +31 -0
- package/.medusa/server/src/api/store/store-credit-accounts/middlewares.js +28 -0
- package/.medusa/server/src/api/store/store-credit-accounts/query-config.js +24 -0
- package/.medusa/server/src/api/store/store-credit-accounts/route.js +40 -0
- package/.medusa/server/src/api/store/store-credit-accounts/validators.js +17 -0
- package/.medusa/server/src/links/cart-gift-cards-link.js +13 -0
- package/.medusa/server/src/links/customer-gift-card-link.js +13 -0
- package/.medusa/server/src/links/customer-store-credit-account-link.js +13 -0
- package/.medusa/server/src/links/order-gift-cards-link.js +13 -0
- package/.medusa/server/src/links/order-line-item-gift-card-link.js +19 -0
- package/.medusa/server/src/modules/loyalty/index.js +12 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250123130553.js +17 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250127174331.js +19 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141026.js +19 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206141429.js +14 -0
- package/.medusa/server/src/modules/loyalty/migrations/Migration20250206144714.js +14 -0
- package/.medusa/server/src/modules/loyalty/models/gift-card-invitation.js +20 -0
- package/.medusa/server/src/modules/loyalty/models/gift-card.js +28 -0
- package/.medusa/server/src/modules/loyalty/service.js +15 -0
- package/.medusa/server/src/modules/store-credit/index.js +12 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250129115518.js +16 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130213237.js +18 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250130220640.js +19 -0
- package/.medusa/server/src/modules/store-credit/migrations/Migration20250131205753.js +14 -0
- package/.medusa/server/src/modules/store-credit/models/account-transaction.js +27 -0
- package/.medusa/server/src/modules/store-credit/models/store-credit-account.js +29 -0
- package/.medusa/server/src/modules/store-credit/models/transaction-group.js +28 -0
- package/.medusa/server/src/modules/store-credit/service.js +412 -0
- package/.medusa/server/src/providers/index.js +12 -0
- package/.medusa/server/src/providers/store-credit-payment/index.js +12 -0
- package/.medusa/server/src/providers/store-credit-payment/service.js +181 -0
- package/.medusa/server/src/subscribers/create-gift-card.js +94 -0
- package/.medusa/server/src/types/cart/index.js +3 -0
- package/.medusa/server/src/types/http/gift-card.js +3 -0
- package/.medusa/server/src/types/http/index.js +21 -0
- package/.medusa/server/src/types/http/store-credit-account.js +3 -0
- package/.medusa/server/src/types/http/transaction-group.js +3 -0
- package/.medusa/server/src/types/http/transaction.js +3 -0
- package/.medusa/server/src/types/index.js +21 -0
- package/.medusa/server/src/types/loyalty/index.js +20 -0
- package/.medusa/server/src/types/loyalty/module.js +17 -0
- package/.medusa/server/src/types/loyalty/service.js +3 -0
- package/.medusa/server/src/types/loyalty/workflows.js +3 -0
- package/.medusa/server/src/types/modules.js +14 -0
- package/.medusa/server/src/types/store-credit/index.js +19 -0
- package/.medusa/server/src/types/store-credit/module.js +10 -0
- package/.medusa/server/src/types/store-credit/service.js +3 -0
- package/.medusa/server/src/workflows/carts/workflows/add-gift-card-to-cart.js +167 -0
- package/.medusa/server/src/workflows/carts/workflows/confirm-cart-credit-lines.js +95 -0
- package/.medusa/server/src/workflows/carts/workflows/refresh-cart-gift-cards.js +136 -0
- package/.medusa/server/src/workflows/carts/workflows/remove-gift-cart-from-cart.js +66 -0
- package/.medusa/server/src/workflows/common/steps/validate-presence-of.js +11 -0
- package/.medusa/server/src/workflows/gift-card-invitation/steps/create-gift-card-invitation.js +17 -0
- package/.medusa/server/src/workflows/gift-card-invitation/steps/delete-gift-card-invitation.js +20 -0
- package/.medusa/server/src/workflows/gift-card-invitation/steps/update-gift-card-invitation.js +31 -0
- package/.medusa/server/src/workflows/gift-card-invitation/workflows/accept-gift-card-invitation.js +79 -0
- package/.medusa/server/src/workflows/gift-card-invitation/workflows/create-gift-card-invitation.js +66 -0
- package/.medusa/server/src/workflows/gift-card-invitation/workflows/delete-gift-card-invitation.js +10 -0
- package/.medusa/server/src/workflows/gift-card-invitation/workflows/reject-gift-card-invitation.js +70 -0
- package/.medusa/server/src/workflows/gift-cards/steps/create-gift-cards.js +17 -0
- package/.medusa/server/src/workflows/gift-cards/steps/delete-gift-cards.js +17 -0
- package/.medusa/server/src/workflows/gift-cards/steps/retrieve-gift-card-balance.js +20 -0
- package/.medusa/server/src/workflows/gift-cards/steps/update-gift-cards.js +34 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/create-gift-cards.js +12 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/delete-gift-card.js +19 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/redeem-gift-card.js +90 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/transfer-gift-card.js +48 -0
- package/.medusa/server/src/workflows/gift-cards/workflows/update-gift-cards.js +12 -0
- package/.medusa/server/src/workflows/hooks/after-order-created.js +31 -0
- package/.medusa/server/src/workflows/hooks/after-order-credit-lines-created.js +31 -0
- package/.medusa/server/src/workflows/hooks/before-payment-collection-refresh.js +26 -0
- package/.medusa/server/src/workflows/hooks/complete-cart-before-payment-authorization.js +27 -0
- package/.medusa/server/src/workflows/orders/workflows/link-gift-cards-to-order.js +58 -0
- package/.medusa/server/src/workflows/orders/workflows/refund-gift-card-credit-lines.js +96 -0
- package/.medusa/server/src/workflows/store-credit/steps/create-store-credit-accounts.js +17 -0
- package/.medusa/server/src/workflows/store-credit/steps/create-transaction-groups.js +17 -0
- package/.medusa/server/src/workflows/store-credit/steps/credit-account.js +17 -0
- package/.medusa/server/src/workflows/store-credit/steps/debit-account.js +17 -0
- package/.medusa/server/src/workflows/store-credit/workflows/create-store-credit-accounts.js +57 -0
- package/.medusa/server/src/workflows/store-credit/workflows/create-transaction-groups.js +12 -0
- package/.medusa/server/src/workflows/store-credit/workflows/credit-accounts.js +12 -0
- package/.medusa/server/src/workflows/store-credit/workflows/debit-accounts.js +12 -0
- package/.medusa/server/types/loyalty/module.js +8 -0
- package/README.md +62 -0
- package/package.json +94 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useParams } from "react-router-dom";
|
|
3
|
+
import "../../../../components/modals/route-drawer/route-drawer.js";
|
|
4
|
+
import { RouteFocusModal } from "../../../../components/modals/route-focus-modal/route-focus-modal.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import "../../../../components/modals/route-modal-provider/route-modal-context.js";
|
|
7
|
+
import "../../../../components/modals/stacked-drawer/stacked-drawer.js";
|
|
8
|
+
import "../../../../components/modals/stacked-focus-modal/stacked-focus-modal.js";
|
|
9
|
+
import "../../../../components/modals/stacked-modal-provider/stacked-modal-context.js";
|
|
10
|
+
import { useProduct } from "../../../../hooks/api/products.js";
|
|
11
|
+
import { ProductMediaView } from "./components/product-media-view/product-media-view.js";
|
|
12
|
+
const ProductMedia = () => {
|
|
13
|
+
const { id } = useParams();
|
|
14
|
+
const { product, isLoading, isError, error } = useProduct(id);
|
|
15
|
+
const ready = !isLoading && product;
|
|
16
|
+
if (isError) {
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsxs(RouteFocusModal, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Product media" }) }),
|
|
21
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Edit product media" }) }),
|
|
22
|
+
ready && /* @__PURE__ */ jsx(ProductMediaView, { product })
|
|
23
|
+
] });
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
ProductMedia,
|
|
27
|
+
ProductMedia as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useParams, Outlet } from "react-router-dom";
|
|
3
|
+
import { JsonViewSection } from "../../../components/json-view-section.js";
|
|
4
|
+
import { TwoColumnLayout } from "../../../components/layouts/two-column.js";
|
|
5
|
+
import { useProduct } from "../../../hooks/api/products.js";
|
|
6
|
+
import { ProductGeneralSection } from "./components/product-general-section.js";
|
|
7
|
+
import { ProductMediaSection } from "./components/product-media-section.js";
|
|
8
|
+
import { ProductSalesChannelSection } from "./components/product-sales-channel-section.js";
|
|
9
|
+
import { ProductVariantSection } from "./components/product-variant-section.js";
|
|
10
|
+
const ProductDetail = () => {
|
|
11
|
+
const { id } = useParams();
|
|
12
|
+
const { product, isLoading, isError, error } = useProduct(id);
|
|
13
|
+
if (isLoading || !product) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (isError) {
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx(
|
|
21
|
+
TwoColumnLayout,
|
|
22
|
+
{
|
|
23
|
+
firstCol: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
|
+
/* @__PURE__ */ jsx(ProductGeneralSection, { product }),
|
|
25
|
+
/* @__PURE__ */ jsx(ProductVariantSection, { product }),
|
|
26
|
+
/* @__PURE__ */ jsx(JsonViewSection, { data: product })
|
|
27
|
+
] }),
|
|
28
|
+
secondCol: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29
|
+
/* @__PURE__ */ jsx(ProductSalesChannelSection, { product }),
|
|
30
|
+
/* @__PURE__ */ jsx(ProductMediaSection, { product })
|
|
31
|
+
] })
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ jsx(Outlet, {})
|
|
35
|
+
] });
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
ProductDetail,
|
|
39
|
+
ProductDetail as default
|
|
40
|
+
};
|
package/.medusa/server/src/admin/routes/gift-card-products/_id_/prices/components/prices-edit.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { zodResolver } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/@hookform/resolvers/zod/dist/zod.mjs";
|
|
3
|
+
import { Button } from "@medusajs/ui";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { useForm } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
|
|
6
|
+
import * as zod from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/zod/lib/index.mjs";
|
|
7
|
+
import { KeyboundForm } from "../../../../../components/keybound-form.js";
|
|
8
|
+
import "../../../../../components/modals/route-drawer/route-drawer.js";
|
|
9
|
+
import { RouteFocusModal } from "../../../../../components/modals/route-focus-modal/route-focus-modal.js";
|
|
10
|
+
import "react-router-dom";
|
|
11
|
+
import "../../../../../components/modals/route-modal-provider/route-modal-context.js";
|
|
12
|
+
import { useRouteModal } from "../../../../../components/modals/route-modal-provider/use-route-modal.js";
|
|
13
|
+
import "../../../../../components/modals/stacked-drawer/stacked-drawer.js";
|
|
14
|
+
import "../../../../../components/modals/stacked-focus-modal/stacked-focus-modal.js";
|
|
15
|
+
import "../../../../../components/modals/stacked-modal-provider/stacked-modal-context.js";
|
|
16
|
+
import { useUpdateProductVariantsBatch } from "../../../../../hooks/api/products.js";
|
|
17
|
+
import { useRegions } from "../../../../../hooks/api/regions.js";
|
|
18
|
+
import { castNumber } from "../../../../../utils/validations.js";
|
|
19
|
+
import { VariantPricingForm } from "./variant-pricing-form.js";
|
|
20
|
+
const UpdateDenominationPricesSchema = zod.object({
|
|
21
|
+
variants: zod.array(
|
|
22
|
+
zod.object({
|
|
23
|
+
prices: zod.record(zod.string(), zod.string().or(zod.number()).optional()).optional()
|
|
24
|
+
})
|
|
25
|
+
)
|
|
26
|
+
});
|
|
27
|
+
const PricingEdit = ({
|
|
28
|
+
product,
|
|
29
|
+
variantId
|
|
30
|
+
}) => {
|
|
31
|
+
var _a;
|
|
32
|
+
const { handleSuccess } = useRouteModal();
|
|
33
|
+
const { mutateAsync, isPending } = useUpdateProductVariantsBatch(product.id);
|
|
34
|
+
const { regions } = useRegions({ limit: 9999 });
|
|
35
|
+
const regionsCurrencyMap = useMemo(() => {
|
|
36
|
+
if (!(regions == null ? void 0 : regions.length)) {
|
|
37
|
+
return {};
|
|
38
|
+
}
|
|
39
|
+
return regions.reduce((acc, reg) => {
|
|
40
|
+
acc[reg.id] = reg.currency_code;
|
|
41
|
+
return acc;
|
|
42
|
+
}, {});
|
|
43
|
+
}, [regions]);
|
|
44
|
+
const variants = variantId ? (_a = product.variants) == null ? void 0 : _a.filter((v) => v.id === variantId) : product.variants;
|
|
45
|
+
const form = useForm({
|
|
46
|
+
defaultValues: {
|
|
47
|
+
variants: variants == null ? void 0 : variants.map((variant) => ({
|
|
48
|
+
title: variant.title,
|
|
49
|
+
prices: variant.prices.reduce((acc, price) => {
|
|
50
|
+
var _a2;
|
|
51
|
+
if ((_a2 = price.rules) == null ? void 0 : _a2.region_id) {
|
|
52
|
+
acc[price.rules.region_id] = price.amount;
|
|
53
|
+
} else {
|
|
54
|
+
acc[price.currency_code] = price.amount;
|
|
55
|
+
}
|
|
56
|
+
return acc;
|
|
57
|
+
}, {})
|
|
58
|
+
}))
|
|
59
|
+
},
|
|
60
|
+
resolver: zodResolver(UpdateDenominationPricesSchema, {})
|
|
61
|
+
});
|
|
62
|
+
const handleSubmit = form.handleSubmit(async (values) => {
|
|
63
|
+
const reqData = values.variants.map((variant, ind) => {
|
|
64
|
+
var _a2;
|
|
65
|
+
return {
|
|
66
|
+
id: (_a2 = variants == null ? void 0 : variants[ind]) == null ? void 0 : _a2.id,
|
|
67
|
+
prices: Object.entries(variant.prices || {}).filter(
|
|
68
|
+
([_, value]) => value !== "" && typeof value !== "undefined"
|
|
69
|
+
// deleted cells
|
|
70
|
+
).map(([currencyCodeOrRegionId, value]) => {
|
|
71
|
+
var _a3, _b, _c, _d, _e, _f;
|
|
72
|
+
const regionId = currencyCodeOrRegionId.startsWith("reg_") ? currencyCodeOrRegionId : void 0;
|
|
73
|
+
const currencyCode = currencyCodeOrRegionId.startsWith("reg_") ? regionsCurrencyMap[regionId] : currencyCodeOrRegionId;
|
|
74
|
+
let existingId = void 0;
|
|
75
|
+
if (regionId) {
|
|
76
|
+
existingId = (_c = (_b = (_a3 = variants == null ? void 0 : variants[ind]) == null ? void 0 : _a3.prices) == null ? void 0 : _b.find(
|
|
77
|
+
(p) => p.rules["region_id"] === regionId
|
|
78
|
+
)) == null ? void 0 : _c.id;
|
|
79
|
+
} else {
|
|
80
|
+
existingId = (_f = (_e = (_d = variants == null ? void 0 : variants[ind]) == null ? void 0 : _d.prices) == null ? void 0 : _e.find(
|
|
81
|
+
(p) => p.currency_code === currencyCode && Object.keys(p.rules ?? {}).length === 0
|
|
82
|
+
)) == null ? void 0 : _f.id;
|
|
83
|
+
}
|
|
84
|
+
const amount = castNumber(value);
|
|
85
|
+
return {
|
|
86
|
+
id: existingId,
|
|
87
|
+
currency_code: currencyCode,
|
|
88
|
+
amount,
|
|
89
|
+
...regionId ? { rules: { region_id: regionId } } : {}
|
|
90
|
+
};
|
|
91
|
+
})
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
await mutateAsync(reqData, {
|
|
95
|
+
onSuccess: () => {
|
|
96
|
+
handleSuccess("..");
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
return /* @__PURE__ */ jsx(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxs(KeyboundForm, { onSubmit: handleSubmit, className: "flex size-full flex-col", children: [
|
|
101
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
102
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex flex-col overflow-hidden", children: /* @__PURE__ */ jsx(VariantPricingForm, { form }) }),
|
|
103
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-end gap-x-2", children: [
|
|
104
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "small", children: "Cancel" }) }),
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
Button,
|
|
107
|
+
{
|
|
108
|
+
type: "submit",
|
|
109
|
+
variant: "primary",
|
|
110
|
+
size: "small",
|
|
111
|
+
isLoading: isPending,
|
|
112
|
+
children: "Save"
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] }) })
|
|
116
|
+
] }) });
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
PricingEdit,
|
|
120
|
+
UpdateDenominationPricesSchema
|
|
121
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useWatch } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
|
|
4
|
+
import { DataGrid } from "../../../../../components/data-grid/data-grid.js";
|
|
5
|
+
import { createDataGridHelper } from "../../../../../components/data-grid/helpers/create-data-grid-column-helper.js";
|
|
6
|
+
import { createDataGridPriceColumns } from "../../../../../components/data-grid/helpers/create-data-grid-price-columns.js";
|
|
7
|
+
import "../../../../../components/modals/route-drawer/route-drawer.js";
|
|
8
|
+
import "../../../../../components/modals/route-focus-modal/route-focus-modal.js";
|
|
9
|
+
import "react-router-dom";
|
|
10
|
+
import "../../../../../components/modals/route-modal-provider/route-modal-context.js";
|
|
11
|
+
import { useRouteModal } from "../../../../../components/modals/route-modal-provider/use-route-modal.js";
|
|
12
|
+
import "../../../../../components/modals/stacked-drawer/stacked-drawer.js";
|
|
13
|
+
import "../../../../../components/modals/stacked-focus-modal/stacked-focus-modal.js";
|
|
14
|
+
import "../../../../../components/modals/stacked-modal-provider/stacked-modal-context.js";
|
|
15
|
+
import { usePricePreferences } from "../../../../../hooks/api/price-preferences.js";
|
|
16
|
+
import { useRegions } from "../../../../../hooks/api/regions.js";
|
|
17
|
+
import { useStore } from "../../../../../hooks/api/store.js";
|
|
18
|
+
const VariantPricingForm = ({ form }) => {
|
|
19
|
+
const { store } = useStore();
|
|
20
|
+
const { regions } = useRegions({ limit: 9999 });
|
|
21
|
+
const { price_preferences: pricePreferences } = usePricePreferences({});
|
|
22
|
+
const { setCloseOnEscape } = useRouteModal();
|
|
23
|
+
const columns = useVariantPriceGridColumns({
|
|
24
|
+
currencies: store == null ? void 0 : store.supported_currencies,
|
|
25
|
+
regions,
|
|
26
|
+
pricePreferences
|
|
27
|
+
});
|
|
28
|
+
const variants = useWatch({
|
|
29
|
+
control: form.control,
|
|
30
|
+
name: "variants"
|
|
31
|
+
});
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
DataGrid,
|
|
34
|
+
{
|
|
35
|
+
columns,
|
|
36
|
+
data: variants,
|
|
37
|
+
state: form,
|
|
38
|
+
onEditingChange: (editing) => setCloseOnEscape(!editing)
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
const columnHelper = createDataGridHelper();
|
|
43
|
+
const useVariantPriceGridColumns = ({
|
|
44
|
+
currencies = [],
|
|
45
|
+
regions = [],
|
|
46
|
+
pricePreferences = []
|
|
47
|
+
}) => {
|
|
48
|
+
return useMemo(() => {
|
|
49
|
+
return [
|
|
50
|
+
columnHelper.column({
|
|
51
|
+
id: "Title",
|
|
52
|
+
header: "Title",
|
|
53
|
+
cell: (context) => {
|
|
54
|
+
const entity = context.row.original;
|
|
55
|
+
return /* @__PURE__ */ jsx(DataGrid.ReadonlyCell, { context, children: /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center gap-x-2 overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: entity.title }) }) });
|
|
56
|
+
},
|
|
57
|
+
disableHiding: true
|
|
58
|
+
}),
|
|
59
|
+
...createDataGridPriceColumns({
|
|
60
|
+
currencies: currencies.map((c) => c.currency_code),
|
|
61
|
+
regions,
|
|
62
|
+
pricePreferences,
|
|
63
|
+
getFieldName: (context, value) => {
|
|
64
|
+
return `variants.${context.row.index}.prices.${value}`;
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
];
|
|
68
|
+
}, [currencies, regions, pricePreferences]);
|
|
69
|
+
};
|
|
70
|
+
export {
|
|
71
|
+
VariantPricingForm
|
|
72
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useParams } from "react-router-dom";
|
|
3
|
+
import "../../../../components/modals/route-drawer/route-drawer.js";
|
|
4
|
+
import { RouteFocusModal } from "../../../../components/modals/route-focus-modal/route-focus-modal.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import "../../../../components/modals/route-modal-provider/route-modal-context.js";
|
|
7
|
+
import "../../../../components/modals/stacked-drawer/stacked-drawer.js";
|
|
8
|
+
import "../../../../components/modals/stacked-focus-modal/stacked-focus-modal.js";
|
|
9
|
+
import "../../../../components/modals/stacked-modal-provider/stacked-modal-context.js";
|
|
10
|
+
import { useProduct } from "../../../../hooks/api/products.js";
|
|
11
|
+
import { PricingEdit } from "./components/prices-edit.js";
|
|
12
|
+
const ProductPrices = () => {
|
|
13
|
+
const { id, variant_id } = useParams();
|
|
14
|
+
const { product, isLoading, isError, error } = useProduct(id);
|
|
15
|
+
if (isError) {
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsx(RouteFocusModal, { children: !isLoading && product && /* @__PURE__ */ jsx(PricingEdit, { product, variantId: variant_id }) });
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
ProductPrices,
|
|
22
|
+
ProductPrices as default
|
|
23
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createDataTableColumnHelper, Button } from "@medusajs/ui";
|
|
3
|
+
import { useState, useEffect, useMemo } from "react";
|
|
4
|
+
import * as zod from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/zod/lib/index.mjs";
|
|
5
|
+
import { zodResolver } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/@hookform/resolvers/zod/dist/zod.mjs";
|
|
6
|
+
import { keepPreviousData } from "@tanstack/react-query";
|
|
7
|
+
import { useForm } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
|
|
8
|
+
import { DataTable } from "../../../../../components/data-table.js";
|
|
9
|
+
import { useSalesChannelTableColumns } from "../../../../../components/data-table/helpers/sales-channels/use-sales-channel-table-columns.js";
|
|
10
|
+
import { useSalesChannelTableEmptyState } from "../../../../../components/data-table/helpers/sales-channels/use-sales-channel-table-empty-state.js";
|
|
11
|
+
import { useSalesChannelTableFilters } from "../../../../../components/data-table/helpers/sales-channels/use-sales-channel-table-filters.js";
|
|
12
|
+
import { useSalesChannelTableQuery } from "../../../../../components/data-table/helpers/sales-channels/use-sales-channel-table-query.js";
|
|
13
|
+
import "../../../../../components/modals/route-drawer/route-drawer.js";
|
|
14
|
+
import { RouteFocusModal } from "../../../../../components/modals/route-focus-modal/route-focus-modal.js";
|
|
15
|
+
import "react-router-dom";
|
|
16
|
+
import "../../../../../components/modals/route-modal-provider/route-modal-context.js";
|
|
17
|
+
import { useRouteModal } from "../../../../../components/modals/route-modal-provider/use-route-modal.js";
|
|
18
|
+
import "../../../../../components/modals/stacked-drawer/stacked-drawer.js";
|
|
19
|
+
import "../../../../../components/modals/stacked-focus-modal/stacked-focus-modal.js";
|
|
20
|
+
import "../../../../../components/modals/stacked-modal-provider/stacked-modal-context.js";
|
|
21
|
+
import { useUpdateProduct } from "../../../../../hooks/api/products.js";
|
|
22
|
+
import { useSalesChannels } from "../../../../../hooks/api/sales-channels.js";
|
|
23
|
+
const EditSalesChannelsSchema = zod.object({
|
|
24
|
+
sales_channels: zod.array(zod.string()).optional()
|
|
25
|
+
});
|
|
26
|
+
const PAGE_SIZE = 50;
|
|
27
|
+
const PREFIX = "sc";
|
|
28
|
+
const EditSalesChannelsForm = ({
|
|
29
|
+
product
|
|
30
|
+
}) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
const { handleSuccess } = useRouteModal();
|
|
33
|
+
const form = useForm({
|
|
34
|
+
defaultValues: {
|
|
35
|
+
sales_channels: ((_a = product.sales_channels) == null ? void 0 : _a.map((sc) => sc.id)) ?? []
|
|
36
|
+
},
|
|
37
|
+
resolver: zodResolver(EditSalesChannelsSchema)
|
|
38
|
+
});
|
|
39
|
+
const { setValue } = form;
|
|
40
|
+
const initialState = ((_b = product.sales_channels) == null ? void 0 : _b.reduce((acc, curr) => {
|
|
41
|
+
acc[curr.id] = true;
|
|
42
|
+
return acc;
|
|
43
|
+
}, {})) ?? {};
|
|
44
|
+
const [rowSelection, setRowSelection] = useState(initialState);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const ids = Object.keys(rowSelection);
|
|
47
|
+
setValue("sales_channels", ids, {
|
|
48
|
+
shouldDirty: true,
|
|
49
|
+
shouldTouch: true
|
|
50
|
+
});
|
|
51
|
+
}, [rowSelection, setValue]);
|
|
52
|
+
const searchParams = useSalesChannelTableQuery({
|
|
53
|
+
pageSize: PAGE_SIZE,
|
|
54
|
+
prefix: PREFIX
|
|
55
|
+
});
|
|
56
|
+
const { sales_channels, count, isLoading, isError, error } = useSalesChannels(
|
|
57
|
+
{
|
|
58
|
+
...searchParams
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
placeholderData: keepPreviousData
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
const filters = useSalesChannelTableFilters();
|
|
65
|
+
const emptyState = useSalesChannelTableEmptyState();
|
|
66
|
+
const columns = useColumns();
|
|
67
|
+
const { mutateAsync, isPending: isMutating } = useUpdateProduct(product.id);
|
|
68
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
69
|
+
const arr = data.sales_channels ?? [];
|
|
70
|
+
const sales_channels2 = arr.map((id) => {
|
|
71
|
+
return {
|
|
72
|
+
id
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
await mutateAsync(
|
|
76
|
+
{
|
|
77
|
+
sales_channels: sales_channels2
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
onSuccess: () => {
|
|
81
|
+
handleSuccess();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
if (isError) {
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
return /* @__PURE__ */ jsx(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col overflow-hidden", children: [
|
|
90
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Header, {}),
|
|
91
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Body, { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
92
|
+
DataTable,
|
|
93
|
+
{
|
|
94
|
+
data: sales_channels,
|
|
95
|
+
columns,
|
|
96
|
+
getRowId: (row) => row.id,
|
|
97
|
+
rowCount: count,
|
|
98
|
+
isLoading,
|
|
99
|
+
filters,
|
|
100
|
+
rowSelection: {
|
|
101
|
+
state: rowSelection,
|
|
102
|
+
onRowSelectionChange: setRowSelection
|
|
103
|
+
},
|
|
104
|
+
autoFocusSearch: true,
|
|
105
|
+
layout: "fill",
|
|
106
|
+
emptyState,
|
|
107
|
+
prefix: PREFIX
|
|
108
|
+
}
|
|
109
|
+
) }),
|
|
110
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
111
|
+
/* @__PURE__ */ jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsx(Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
112
|
+
/* @__PURE__ */ jsx(Button, { size: "small", isLoading: isMutating, onClick: handleSubmit, children: "Save" })
|
|
113
|
+
] }) })
|
|
114
|
+
] }) });
|
|
115
|
+
};
|
|
116
|
+
const columnHelper = createDataTableColumnHelper();
|
|
117
|
+
const useColumns = () => {
|
|
118
|
+
const columns = useSalesChannelTableColumns();
|
|
119
|
+
return useMemo(() => [columnHelper.select(), ...columns], [columns]);
|
|
120
|
+
};
|
|
121
|
+
export {
|
|
122
|
+
EditSalesChannelsForm
|
|
123
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useParams } from "react-router-dom";
|
|
3
|
+
import "../../../../components/modals/route-drawer/route-drawer.js";
|
|
4
|
+
import { RouteFocusModal } from "../../../../components/modals/route-focus-modal/route-focus-modal.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import "../../../../components/modals/route-modal-provider/route-modal-context.js";
|
|
7
|
+
import "../../../../components/modals/stacked-drawer/stacked-drawer.js";
|
|
8
|
+
import "../../../../components/modals/stacked-focus-modal/stacked-focus-modal.js";
|
|
9
|
+
import "../../../../components/modals/stacked-modal-provider/stacked-modal-context.js";
|
|
10
|
+
import { useProduct } from "../../../../hooks/api/products.js";
|
|
11
|
+
import { EditSalesChannelsForm } from "./components/edit-sales-channel-form.js";
|
|
12
|
+
const ProductSalesChannels = () => {
|
|
13
|
+
const { id } = useParams();
|
|
14
|
+
const { product, isLoading, isError, error } = useProduct(id);
|
|
15
|
+
if (isError) {
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsx(RouteFocusModal, { children: !isLoading && product && /* @__PURE__ */ jsx(EditSalesChannelsForm, { product }) });
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
ProductSalesChannels,
|
|
22
|
+
ProductSalesChannels as default
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useWatch } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
|
|
4
|
+
import { DataGrid } from "../../../../components/data-grid/data-grid.js";
|
|
5
|
+
import { createDataGridHelper } from "../../../../components/data-grid/helpers/create-data-grid-column-helper.js";
|
|
6
|
+
import { createDataGridPriceColumns } from "../../../../components/data-grid/helpers/create-data-grid-price-columns.js";
|
|
7
|
+
import "../../../../components/modals/route-drawer/route-drawer.js";
|
|
8
|
+
import "../../../../components/modals/route-focus-modal/route-focus-modal.js";
|
|
9
|
+
import "react-router-dom";
|
|
10
|
+
import "../../../../components/modals/route-modal-provider/route-modal-context.js";
|
|
11
|
+
import { useRouteModal } from "../../../../components/modals/route-modal-provider/use-route-modal.js";
|
|
12
|
+
import "../../../../components/modals/stacked-drawer/stacked-drawer.js";
|
|
13
|
+
import "../../../../components/modals/stacked-focus-modal/stacked-focus-modal.js";
|
|
14
|
+
import "../../../../components/modals/stacked-modal-provider/stacked-modal-context.js";
|
|
15
|
+
const GiftCardProductCreateDenominationsForm = ({
|
|
16
|
+
form,
|
|
17
|
+
regions,
|
|
18
|
+
store,
|
|
19
|
+
pricePreferences
|
|
20
|
+
}) => {
|
|
21
|
+
const { setCloseOnEscape } = useRouteModal();
|
|
22
|
+
const currencyCodes = useMemo(
|
|
23
|
+
() => {
|
|
24
|
+
var _a;
|
|
25
|
+
return ((_a = store == null ? void 0 : store.supported_currencies) == null ? void 0 : _a.map((c) => c.currency_code)) || [];
|
|
26
|
+
},
|
|
27
|
+
[store]
|
|
28
|
+
);
|
|
29
|
+
const denominations = useWatch({
|
|
30
|
+
control: form.control,
|
|
31
|
+
name: "denominations",
|
|
32
|
+
defaultValue: []
|
|
33
|
+
});
|
|
34
|
+
const columns = useColumns({
|
|
35
|
+
denominations,
|
|
36
|
+
currencies: currencyCodes,
|
|
37
|
+
regions,
|
|
38
|
+
pricePreferences
|
|
39
|
+
});
|
|
40
|
+
const variantData = useMemo(() => {
|
|
41
|
+
const ret = [];
|
|
42
|
+
denominations.forEach((v, i) => {
|
|
43
|
+
ret.push({ ...v, originalIndex: i });
|
|
44
|
+
});
|
|
45
|
+
return ret;
|
|
46
|
+
}, [denominations]);
|
|
47
|
+
return /* @__PURE__ */ jsx("div", { className: "flex size-full flex-col divide-y overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
48
|
+
DataGrid,
|
|
49
|
+
{
|
|
50
|
+
columns,
|
|
51
|
+
data: variantData,
|
|
52
|
+
state: form,
|
|
53
|
+
onEditingChange: (editing) => setCloseOnEscape(!editing)
|
|
54
|
+
}
|
|
55
|
+
) });
|
|
56
|
+
};
|
|
57
|
+
const columnHelper = createDataGridHelper();
|
|
58
|
+
const useColumns = ({
|
|
59
|
+
denominations = [],
|
|
60
|
+
currencies = [],
|
|
61
|
+
regions = [],
|
|
62
|
+
pricePreferences = []
|
|
63
|
+
}) => {
|
|
64
|
+
return useMemo(
|
|
65
|
+
() => [
|
|
66
|
+
columnHelper.column({
|
|
67
|
+
id: "denominations",
|
|
68
|
+
header: () => /* @__PURE__ */ jsx("div", { className: "flex size-full items-center overflow-hidden", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: "Denomination" }) }),
|
|
69
|
+
cell: (context) => {
|
|
70
|
+
return /* @__PURE__ */ jsx(DataGrid.ReadonlyCell, { context, children: context.row.original.value });
|
|
71
|
+
},
|
|
72
|
+
disableHiding: true
|
|
73
|
+
}),
|
|
74
|
+
columnHelper.column({
|
|
75
|
+
id: "sku",
|
|
76
|
+
name: "SKU",
|
|
77
|
+
header: "SKU",
|
|
78
|
+
field: (context) => `denominations.${context.row.original.originalIndex}.sku`,
|
|
79
|
+
type: "text",
|
|
80
|
+
cell: (context) => {
|
|
81
|
+
return /* @__PURE__ */ jsx(DataGrid.TextCell, { context });
|
|
82
|
+
}
|
|
83
|
+
}),
|
|
84
|
+
...createDataGridPriceColumns({
|
|
85
|
+
currencies,
|
|
86
|
+
regions,
|
|
87
|
+
pricePreferences,
|
|
88
|
+
getFieldName: (context, value) => {
|
|
89
|
+
return `denominations.${context.row.original.originalIndex}.prices.${value}`;
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
],
|
|
93
|
+
[currencies, regions, denominations, pricePreferences]
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
export {
|
|
97
|
+
GiftCardProductCreateDenominationsForm
|
|
98
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Divider, Heading } from "@medusajs/ui";
|
|
3
|
+
import { GiftCardProductCreateFormDenominations } from "./gift-card-product-create-form-denominations.js";
|
|
4
|
+
import { GiftCardProductCreateFormGeneral } from "./gift-card-product-create-form-general.js";
|
|
5
|
+
import { GiftCardProductCreateFormMedia } from "./gift-card-product-create-form-media.js";
|
|
6
|
+
import { GiftCardProductCreateOrganizeForm } from "./gift-card-product-create-form-organize.js";
|
|
7
|
+
const GiftCardProductCreateDetailsForm = ({
|
|
8
|
+
form
|
|
9
|
+
}) => {
|
|
10
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children: [
|
|
11
|
+
/* @__PURE__ */ jsx(Header, {}),
|
|
12
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-6", children: [
|
|
13
|
+
/* @__PURE__ */ jsx(GiftCardProductCreateFormGeneral, { form }),
|
|
14
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
15
|
+
/* @__PURE__ */ jsx(GiftCardProductCreateFormMedia, { form }),
|
|
16
|
+
/* @__PURE__ */ jsx(Divider, { variant: "dashed" }),
|
|
17
|
+
/* @__PURE__ */ jsx(GiftCardProductCreateOrganizeForm, { form }),
|
|
18
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
19
|
+
/* @__PURE__ */ jsx(GiftCardProductCreateFormDenominations, { form })
|
|
20
|
+
] })
|
|
21
|
+
] }) });
|
|
22
|
+
};
|
|
23
|
+
const Header = () => {
|
|
24
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx(Heading, { children: "Create Gift Card Product" }) });
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
GiftCardProductCreateDetailsForm
|
|
28
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MinusMini } from "@medusajs/icons";
|
|
3
|
+
import { Text, Input, Button, Alert } from "@medusajs/ui";
|
|
4
|
+
import { useFieldArray } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/react-hook-form/dist/index.esm.mjs";
|
|
5
|
+
import { Form } from "../../../../components/form.js";
|
|
6
|
+
const GiftCardProductCreateFormDenominations = ({
|
|
7
|
+
form
|
|
8
|
+
}) => {
|
|
9
|
+
const {
|
|
10
|
+
fields: denominationsFields,
|
|
11
|
+
append: addDenomination,
|
|
12
|
+
remove: removeDenomination
|
|
13
|
+
} = useFieldArray({
|
|
14
|
+
name: "denominations",
|
|
15
|
+
control: form.control
|
|
16
|
+
});
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", { id: "variants", className: "grid grid-cols-1 gap-y-6 md:grid-cols-2", children: [
|
|
18
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
19
|
+
/* @__PURE__ */ jsx(
|
|
20
|
+
Text,
|
|
21
|
+
{
|
|
22
|
+
className: "txt-compact-small-plus text-ui-fg-base",
|
|
23
|
+
weight: "regular",
|
|
24
|
+
children: "Denominations"
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ jsx(Text, { className: "txt-small text-ui-fg-muted", children: "Denominations are the different values that can be selected for the gift card product." })
|
|
28
|
+
] }),
|
|
29
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
30
|
+
denominationsFields.map((denominationField, index) => {
|
|
31
|
+
return /* @__PURE__ */ jsxs(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: "flex items-center justify-between shadow-elevation-card-rest bg-ui-bg-component transition-fg rounded-md px-4 py-2",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
Form.Field,
|
|
38
|
+
{
|
|
39
|
+
control: form.control,
|
|
40
|
+
name: `denominations.${index}.value`,
|
|
41
|
+
render: ({ field }) => {
|
|
42
|
+
return /* @__PURE__ */ jsxs(Form.Item, { className: "w-full", children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Form.Control, { children: /* @__PURE__ */ jsx(
|
|
44
|
+
Input,
|
|
45
|
+
{
|
|
46
|
+
...field,
|
|
47
|
+
placeholder: "100",
|
|
48
|
+
required: true,
|
|
49
|
+
type: "number",
|
|
50
|
+
min: 0
|
|
51
|
+
}
|
|
52
|
+
) }),
|
|
53
|
+
/* @__PURE__ */ jsx(Form.ErrorMessage, {})
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
denominationField.id
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center rounded-xl", children: /* @__PURE__ */ jsx(
|
|
60
|
+
Button,
|
|
61
|
+
{
|
|
62
|
+
size: "small",
|
|
63
|
+
variant: "secondary",
|
|
64
|
+
type: "button",
|
|
65
|
+
className: "rounded-full bg-red-500 text-white p-0 ml-4 hover:bg-red-600",
|
|
66
|
+
onClick: () => {
|
|
67
|
+
removeDenomination(index);
|
|
68
|
+
},
|
|
69
|
+
children: /* @__PURE__ */ jsx(MinusMini, { className: "rounded-full" })
|
|
70
|
+
}
|
|
71
|
+
) })
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
denominationField.id
|
|
75
|
+
);
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
Button,
|
|
79
|
+
{
|
|
80
|
+
size: "small",
|
|
81
|
+
variant: "secondary",
|
|
82
|
+
type: "button",
|
|
83
|
+
className: "w-full",
|
|
84
|
+
onClick: () => {
|
|
85
|
+
addDenomination({ value: "", sku: "", prices: {} });
|
|
86
|
+
},
|
|
87
|
+
children: "Add denomination"
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
form.formState.errors.denominations && /* @__PURE__ */ jsx(Alert, { variant: "error", children: "Please add at least one denomination." })
|
|
91
|
+
] }) }) })
|
|
92
|
+
] });
|
|
93
|
+
};
|
|
94
|
+
export {
|
|
95
|
+
GiftCardProductCreateFormDenominations
|
|
96
|
+
};
|