@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,31 @@
|
|
|
1
|
+
import { useQueryParams } from "../../../../hooks/common/use-query-params.js";
|
|
2
|
+
const useStoreCreditAccountsTableQuery = ({
|
|
3
|
+
prefix,
|
|
4
|
+
pageSize = 20
|
|
5
|
+
}) => {
|
|
6
|
+
const queryObject = useQueryParams(
|
|
7
|
+
["offset", "customer_id", "currency_code", "created_at", "updated_at"],
|
|
8
|
+
prefix
|
|
9
|
+
);
|
|
10
|
+
const {
|
|
11
|
+
offset,
|
|
12
|
+
created_at,
|
|
13
|
+
updated_at,
|
|
14
|
+
customer_id,
|
|
15
|
+
currency_code,
|
|
16
|
+
...rest
|
|
17
|
+
} = queryObject;
|
|
18
|
+
const searchParams = {
|
|
19
|
+
limit: pageSize,
|
|
20
|
+
offset: offset ? Number(offset) : 0,
|
|
21
|
+
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
22
|
+
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
23
|
+
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
24
|
+
currency_code: currency_code ? JSON.parse(currency_code) : void 0,
|
|
25
|
+
...rest
|
|
26
|
+
};
|
|
27
|
+
return searchParams;
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
useStoreCreditAccountsTableQuery
|
|
31
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { useStoreCreditAccounts } from "../../../../hooks/api/store-credit-accounts.js";
|
|
7
|
+
import { useStoreCreditAccountTableColumns } from "./columns.js";
|
|
8
|
+
import { useStoreCreditAccountFilters } from "./filters.js";
|
|
9
|
+
import { useStoreCreditAccountsTableQuery } from "./query.js";
|
|
10
|
+
const PAGE_SIZE = 10;
|
|
11
|
+
function StoreCreditAccountsTable() {
|
|
12
|
+
const queryParams = useStoreCreditAccountsTableQuery({
|
|
13
|
+
pageSize: PAGE_SIZE
|
|
14
|
+
});
|
|
15
|
+
const {
|
|
16
|
+
store_credit_accounts: storeCreditAccounts,
|
|
17
|
+
isPending,
|
|
18
|
+
count
|
|
19
|
+
} = useStoreCreditAccounts({
|
|
20
|
+
...queryParams,
|
|
21
|
+
order: queryParams.order ?? "-created_at"
|
|
22
|
+
});
|
|
23
|
+
const columns = useStoreCreditAccountTableColumns();
|
|
24
|
+
const filters = useStoreCreditAccountFilters();
|
|
25
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Container, { className: "p-0", children: /* @__PURE__ */ jsx(
|
|
27
|
+
DataTable,
|
|
28
|
+
{
|
|
29
|
+
data: storeCreditAccounts ?? [],
|
|
30
|
+
getRowId: (row) => row.id,
|
|
31
|
+
columns,
|
|
32
|
+
filters,
|
|
33
|
+
isLoading: isPending,
|
|
34
|
+
pageSize: PAGE_SIZE,
|
|
35
|
+
rowCount: count,
|
|
36
|
+
enableSearch: false,
|
|
37
|
+
heading: "Store Credit Accounts",
|
|
38
|
+
rowHref: (row) => `${row.id}`,
|
|
39
|
+
emptyState: {
|
|
40
|
+
empty: {
|
|
41
|
+
heading: "No store credit accounts found",
|
|
42
|
+
description: "Create a new store credit account to get started."
|
|
43
|
+
},
|
|
44
|
+
filtered: {
|
|
45
|
+
heading: "No results found",
|
|
46
|
+
description: "No store credit accounts match your filter criteria."
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
) }),
|
|
51
|
+
/* @__PURE__ */ jsx(Outlet, {})
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
StoreCreditAccountsTable
|
|
56
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { defineRouteConfig } from "@medusajs/admin-sdk";
|
|
3
|
+
import { CreditCard } from "@medusajs/icons";
|
|
4
|
+
import { Toaster } from "@medusajs/ui";
|
|
5
|
+
import { StoreCreditAccountsTable } from "./components/store-credit-accounts-table/table.js";
|
|
6
|
+
const StoreCreditAccountsPage = () => {
|
|
7
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8
|
+
/* @__PURE__ */ jsx(StoreCreditAccountsTable, {}),
|
|
9
|
+
/* @__PURE__ */ jsx(Toaster, {})
|
|
10
|
+
] });
|
|
11
|
+
};
|
|
12
|
+
const config = defineRouteConfig({
|
|
13
|
+
label: "Store Credits",
|
|
14
|
+
icon: CreditCard
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
config,
|
|
18
|
+
StoreCreditAccountsPage as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { formatDistance, sub, format } from "date-fns";
|
|
2
|
+
import { enUS } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/date-fns/locale.mjs";
|
|
3
|
+
const LOCALE = enUS;
|
|
4
|
+
function getRelativeDate(date) {
|
|
5
|
+
const now = /* @__PURE__ */ new Date();
|
|
6
|
+
return formatDistance(sub(new Date(date), { minutes: 0 }), now, {
|
|
7
|
+
addSuffix: true,
|
|
8
|
+
locale: LOCALE
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
const getFullDate = ({
|
|
12
|
+
date,
|
|
13
|
+
includeTime = false
|
|
14
|
+
}) => {
|
|
15
|
+
const ensuredDate = new Date(date);
|
|
16
|
+
if (isNaN(ensuredDate.getTime())) {
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
const timeFormat = includeTime ? "p" : "";
|
|
20
|
+
return format(ensuredDate, `PP ${timeFormat}`, {
|
|
21
|
+
locale: LOCALE
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
getFullDate,
|
|
26
|
+
getRelativeDate
|
|
27
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { formatDistance, sub, format } from "date-fns";
|
|
2
|
+
function getRelativeDate(date) {
|
|
3
|
+
const now = /* @__PURE__ */ new Date();
|
|
4
|
+
return formatDistance(sub(new Date(date), { minutes: 0 }), now, {
|
|
5
|
+
addSuffix: true,
|
|
6
|
+
includeSeconds: false
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function formatDate(date, withTime = true) {
|
|
10
|
+
if (!date) {
|
|
11
|
+
return "-";
|
|
12
|
+
}
|
|
13
|
+
if (withTime) {
|
|
14
|
+
return format(new Date(date), "dd MMM, yyyy, HH:mm:ss");
|
|
15
|
+
}
|
|
16
|
+
return format(new Date(date), "dd MMM, yyyy");
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
formatDate,
|
|
20
|
+
getRelativeDate
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
function genericForwardRef(render) {
|
|
3
|
+
return forwardRef(render);
|
|
4
|
+
}
|
|
5
|
+
function setRef(ref, value) {
|
|
6
|
+
if (typeof ref === "function") {
|
|
7
|
+
ref(value);
|
|
8
|
+
} else if (ref && "current" in ref) {
|
|
9
|
+
ref.current = value;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const useCombinedRefs = (...refs) => {
|
|
13
|
+
return (value) => {
|
|
14
|
+
refs.forEach((ref) => setRef(ref, value));
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
genericForwardRef,
|
|
19
|
+
useCombinedRefs
|
|
20
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GiftCardStatus } from "../../../types/loyalty/module.js";
|
|
2
|
+
function getGiftCardStatus(giftCard) {
|
|
3
|
+
if (giftCard.expires_at && new Date(giftCard.expires_at) < /* @__PURE__ */ new Date()) {
|
|
4
|
+
return "deactivated";
|
|
5
|
+
} else if (giftCard.status === GiftCardStatus.PENDING) {
|
|
6
|
+
return "pending";
|
|
7
|
+
} else {
|
|
8
|
+
return "active";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function getGiftCardStatusColor(status) {
|
|
12
|
+
if (status === "deactivated") {
|
|
13
|
+
return "red";
|
|
14
|
+
} else if (status === "pending") {
|
|
15
|
+
return "orange";
|
|
16
|
+
} else {
|
|
17
|
+
return "green";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
getGiftCardStatus,
|
|
22
|
+
getGiftCardStatusColor
|
|
23
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import i18next from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/i18next/dist/esm/i18next.js";
|
|
2
|
+
import { z } from "/Users/oliverjuhl/Desktop/medusa/loyalty-plugin/node_modules/zod/lib/index.mjs";
|
|
3
|
+
const castNumber = (number) => {
|
|
4
|
+
return typeof number === "string" ? Number(number.replace(",", ".")) : number;
|
|
5
|
+
};
|
|
6
|
+
const optionalInt = z.union([z.string(), z.number()]).optional().refine(
|
|
7
|
+
(value) => {
|
|
8
|
+
if (value === "" || value === void 0) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
return Number.isInteger(castNumber(value));
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
message: i18next.t("validation.mustBeInt")
|
|
15
|
+
}
|
|
16
|
+
).refine(
|
|
17
|
+
(value) => {
|
|
18
|
+
if (value === "" || value === void 0) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return castNumber(value) >= 0;
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
message: i18next.t("validation.mustBePositive")
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
const optionalFloat = z.union([z.string(), z.number()]).optional().refine(
|
|
28
|
+
(value) => {
|
|
29
|
+
if (value === "" || value === void 0) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
return castNumber(value) >= 0;
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
message: i18next.t("validation.mustBePositive")
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
const metadataFormSchema = z.array(
|
|
39
|
+
z.object({
|
|
40
|
+
key: z.string(),
|
|
41
|
+
value: z.unknown(),
|
|
42
|
+
isInitial: z.boolean().optional(),
|
|
43
|
+
isDeleted: z.boolean().optional(),
|
|
44
|
+
isIgnored: z.boolean().optional()
|
|
45
|
+
})
|
|
46
|
+
);
|
|
47
|
+
function partialFormValidation(form, fields, schema) {
|
|
48
|
+
form.clearErrors(fields);
|
|
49
|
+
const values = fields.reduce((acc, key) => {
|
|
50
|
+
acc[key] = form.getValues(key);
|
|
51
|
+
return acc;
|
|
52
|
+
}, {});
|
|
53
|
+
const validationResult = schema.safeParse(values);
|
|
54
|
+
if (!validationResult.success) {
|
|
55
|
+
validationResult.error.errors.forEach(({ path, message, code }) => {
|
|
56
|
+
form.setError(path.join("."), {
|
|
57
|
+
type: code,
|
|
58
|
+
message
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
castNumber,
|
|
67
|
+
metadataFormSchema,
|
|
68
|
+
optionalFloat,
|
|
69
|
+
optionalInt,
|
|
70
|
+
partialFormValidation
|
|
71
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { castNumber } from "./validations.js";
|
|
2
|
+
const normalizeProductFormValues = (values) => {
|
|
3
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4
|
+
const thumbnail = (_b = (_a = values.media) == null ? void 0 : _a.find((media) => media.isThumbnail)) == null ? void 0 : _b.url;
|
|
5
|
+
const images = (_c = values.media) == null ? void 0 : _c.filter((media) => !media.isThumbnail).map((media) => ({ url: media.url }));
|
|
6
|
+
const optionValues = values.denominations.map(
|
|
7
|
+
(denomination) => denomination.value
|
|
8
|
+
);
|
|
9
|
+
const options = [
|
|
10
|
+
{
|
|
11
|
+
title: "denomination",
|
|
12
|
+
values: optionValues
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
const variants = values.denominations.map((denomination) => ({
|
|
16
|
+
title: denomination.value,
|
|
17
|
+
options: {
|
|
18
|
+
denomination: denomination.value
|
|
19
|
+
},
|
|
20
|
+
sku: denomination.sku,
|
|
21
|
+
prices: denomination.prices
|
|
22
|
+
}));
|
|
23
|
+
return {
|
|
24
|
+
status: values.status,
|
|
25
|
+
tags: ((_d = values == null ? void 0 : values.tags) == null ? void 0 : _d.length) ? (_e = values.tags) == null ? void 0 : _e.map((tag) => ({ id: tag })) : void 0,
|
|
26
|
+
sales_channels: ((_f = values == null ? void 0 : values.sales_channels) == null ? void 0 : _f.length) ? (_g = values.sales_channels) == null ? void 0 : _g.map((sc) => ({ id: sc.id })) : void 0,
|
|
27
|
+
images,
|
|
28
|
+
is_giftcard: true,
|
|
29
|
+
collection_id: values.collection_id || void 0,
|
|
30
|
+
shipping_profile_id: values.shipping_profile_id || void 0,
|
|
31
|
+
categories: values.categories.map((id) => ({ id })),
|
|
32
|
+
type_id: values.type_id || void 0,
|
|
33
|
+
handle: values.handle || void 0,
|
|
34
|
+
origin_country: values.origin_country || void 0,
|
|
35
|
+
material: values.material || void 0,
|
|
36
|
+
mid_code: values.mid_code || void 0,
|
|
37
|
+
hs_code: values.hs_code || void 0,
|
|
38
|
+
thumbnail,
|
|
39
|
+
title: values.title,
|
|
40
|
+
subtitle: values.subtitle || void 0,
|
|
41
|
+
description: values.description || void 0,
|
|
42
|
+
discountable: values.discountable || void 0,
|
|
43
|
+
width: values.width ? parseFloat(values.width) : void 0,
|
|
44
|
+
length: values.length ? parseFloat(values.length) : void 0,
|
|
45
|
+
height: values.height ? parseFloat(values.height) : void 0,
|
|
46
|
+
weight: values.weight ? parseFloat(values.weight) : void 0,
|
|
47
|
+
options,
|
|
48
|
+
variants: normalizeVariants(variants, values.regionsCurrencyMap)
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const normalizeVariants = (variants, regionsCurrencyMap) => {
|
|
52
|
+
return variants.map((variant, i) => ({
|
|
53
|
+
title: variant.title,
|
|
54
|
+
options: variant.options,
|
|
55
|
+
sku: variant.sku || void 0,
|
|
56
|
+
manage_inventory: false,
|
|
57
|
+
allow_backorder: true,
|
|
58
|
+
variant_rank: i,
|
|
59
|
+
prices: Object.entries(variant.prices || {}).map(([key, value]) => {
|
|
60
|
+
if (value === "" || value === void 0) {
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
if (key.startsWith("reg_")) {
|
|
64
|
+
return {
|
|
65
|
+
currency_code: regionsCurrencyMap[key],
|
|
66
|
+
amount: castNumber(value),
|
|
67
|
+
rules: { region_id: key }
|
|
68
|
+
};
|
|
69
|
+
} else {
|
|
70
|
+
return {
|
|
71
|
+
currency_code: key,
|
|
72
|
+
amount: castNumber(value)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}).filter((v) => !!v)
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
const decorateVariantsWithDefaultValues = (variants) => {
|
|
79
|
+
return variants.map((variant) => ({
|
|
80
|
+
...variant,
|
|
81
|
+
title: variant.title || "",
|
|
82
|
+
sku: variant.sku || "",
|
|
83
|
+
manage_inventory: variant.manage_inventory || false,
|
|
84
|
+
allow_backorder: variant.allow_backorder || false,
|
|
85
|
+
inventory_kit: variant.inventory_kit || false
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
88
|
+
export {
|
|
89
|
+
decorateVariantsWithDefaultValues,
|
|
90
|
+
normalizeProductFormValues,
|
|
91
|
+
normalizeVariants
|
|
92
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { defineWidgetConfig } from "@medusajs/admin-sdk";
|
|
3
|
+
import { Gift } from "@medusajs/icons";
|
|
4
|
+
import { Container, StatusBadge } from "@medusajs/ui";
|
|
5
|
+
import { useParams, Link } from "react-router-dom";
|
|
6
|
+
import { Header } from "../components/header.js";
|
|
7
|
+
import { SidebarLink } from "../components/sidebar-link.js";
|
|
8
|
+
import { useGiftCards } from "../hooks/api/gift-cards.js";
|
|
9
|
+
import { formatAmount } from "../utils/format-amount.js";
|
|
10
|
+
import { getGiftCardStatus, getGiftCardStatusColor } from "../utils/statuses.js";
|
|
11
|
+
const MAX_GIFT_CARDS = 3;
|
|
12
|
+
const CustomerStoreCreditWidget = () => {
|
|
13
|
+
const params = useParams();
|
|
14
|
+
const {
|
|
15
|
+
gift_cards: giftCards,
|
|
16
|
+
isPending,
|
|
17
|
+
count
|
|
18
|
+
} = useGiftCards({
|
|
19
|
+
customer_id: params.id,
|
|
20
|
+
limit: MAX_GIFT_CARDS,
|
|
21
|
+
order: "-created_at",
|
|
22
|
+
fields: "+line_item.product.title"
|
|
23
|
+
});
|
|
24
|
+
if (isPending) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return /* @__PURE__ */ jsxs(Container, { className: "p-0", children: [
|
|
28
|
+
/* @__PURE__ */ jsx(Header, { title: "Gift Cards" }),
|
|
29
|
+
giftCards == null ? void 0 : giftCards.map((giftCard) => {
|
|
30
|
+
const giftCardStatus = getGiftCardStatus(giftCard);
|
|
31
|
+
const giftCardStatusColor = getGiftCardStatusColor(giftCardStatus);
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
SidebarLink,
|
|
34
|
+
{
|
|
35
|
+
icon: /* @__PURE__ */ jsx(Gift, {}),
|
|
36
|
+
labelKey: giftCard.code,
|
|
37
|
+
descriptionKey: formatAmount(
|
|
38
|
+
giftCard.value ?? 0,
|
|
39
|
+
giftCard.currency_code
|
|
40
|
+
),
|
|
41
|
+
to: `/gift-cards/${giftCard.id}`,
|
|
42
|
+
children: /* @__PURE__ */ jsx(StatusBadge, { color: giftCardStatusColor, className: "capitalize", children: giftCardStatus })
|
|
43
|
+
},
|
|
44
|
+
giftCard.id
|
|
45
|
+
);
|
|
46
|
+
}),
|
|
47
|
+
typeof count === "number" && count > MAX_GIFT_CARDS && /* @__PURE__ */ jsx(
|
|
48
|
+
Link,
|
|
49
|
+
{
|
|
50
|
+
to: `/gift-cards?customer_id="${params.id}"`,
|
|
51
|
+
className: "flex flex-col px-2 pb-2",
|
|
52
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-x-2 txt-compact-small rounded-md p-2 shadow-elevation-card-rest font-medium", children: [
|
|
53
|
+
"+ ",
|
|
54
|
+
count - MAX_GIFT_CARDS,
|
|
55
|
+
" more"
|
|
56
|
+
] })
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
] });
|
|
60
|
+
};
|
|
61
|
+
const config = defineWidgetConfig({
|
|
62
|
+
zone: "customer.details.side.after"
|
|
63
|
+
});
|
|
64
|
+
export {
|
|
65
|
+
config,
|
|
66
|
+
CustomerStoreCreditWidget as default
|
|
67
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { defineWidgetConfig } from "@medusajs/admin-sdk";
|
|
3
|
+
import { Container } from "@medusajs/ui";
|
|
4
|
+
import { useParams } from "react-router-dom";
|
|
5
|
+
import { Header } from "../components/header.js";
|
|
6
|
+
import { SidebarLink } from "../components/sidebar-link.js";
|
|
7
|
+
import { useStoreCreditAccounts } from "../hooks/api/store-credit-accounts.js";
|
|
8
|
+
import CreditCardIcon from "../routes/store-credit-accounts/_id_/components/credit-card-icon.js";
|
|
9
|
+
import { formatAmount } from "../utils/format-amount.js";
|
|
10
|
+
const CustomerStoreCreditWidget = () => {
|
|
11
|
+
const params = useParams();
|
|
12
|
+
const { store_credit_accounts: storeCreditAccounts, isPending } = useStoreCreditAccounts({
|
|
13
|
+
customer_id: params.id,
|
|
14
|
+
currency_code: "eur"
|
|
15
|
+
});
|
|
16
|
+
if (isPending) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsxs(Container, { className: "p-0", children: [
|
|
20
|
+
/* @__PURE__ */ jsx(Header, { title: "Store Credit Accounts" }),
|
|
21
|
+
storeCreditAccounts == null ? void 0 : storeCreditAccounts.map((storeCreditAccount) => /* @__PURE__ */ jsx(
|
|
22
|
+
SidebarLink,
|
|
23
|
+
{
|
|
24
|
+
icon: /* @__PURE__ */ jsx(CreditCardIcon, { className: "w-[32px] h-[24px]" }),
|
|
25
|
+
labelKey: `${storeCreditAccount.currency_code.toUpperCase()} Account`,
|
|
26
|
+
descriptionKey: formatAmount(
|
|
27
|
+
storeCreditAccount.balance ?? 0,
|
|
28
|
+
storeCreditAccount.currency_code
|
|
29
|
+
),
|
|
30
|
+
to: `/store-credit-accounts/${storeCreditAccount.id}`
|
|
31
|
+
},
|
|
32
|
+
storeCreditAccount.id
|
|
33
|
+
))
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
const config = defineWidgetConfig({
|
|
37
|
+
zone: "customer.details.side.after"
|
|
38
|
+
});
|
|
39
|
+
export {
|
|
40
|
+
config,
|
|
41
|
+
CustomerStoreCreditWidget as default
|
|
42
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { defineWidgetConfig } from "@medusajs/admin-sdk";
|
|
3
|
+
import { TriangleRightMini, Gift } from "@medusajs/icons";
|
|
4
|
+
import { Container, StatusBadge } from "@medusajs/ui";
|
|
5
|
+
import { useParams } from "react-router-dom";
|
|
6
|
+
import { Header } from "../components/header.js";
|
|
7
|
+
import { SidebarLink } from "../components/sidebar-link.js";
|
|
8
|
+
import { useOrder } from "../hooks/api/order.js";
|
|
9
|
+
import { formatAmount } from "../utils/format-amount.js";
|
|
10
|
+
import { getGiftCardStatus, getGiftCardStatusColor } from "../utils/statuses.js";
|
|
11
|
+
const OrderGiftCardsWidget = () => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const params = useParams();
|
|
14
|
+
const { order } = useOrder(params.id, {
|
|
15
|
+
fields: "+*gift_cards"
|
|
16
|
+
});
|
|
17
|
+
if (!((_a = order == null ? void 0 : order.gift_cards) == null ? void 0 : _a.length)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
|
|
21
|
+
/* @__PURE__ */ jsx(
|
|
22
|
+
Header,
|
|
23
|
+
{
|
|
24
|
+
title: "Gift Cards",
|
|
25
|
+
subtitle: "Gift cards that have been applied to this order",
|
|
26
|
+
tooltip: `A credit line “refund” will always attempt to apply the credit to gift card balance first. However, if the initial balance is covered, an remaining credit will be applied to the order.`
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
(_b = order == null ? void 0 : order.gift_cards) == null ? void 0 : _b.map((giftCard) => {
|
|
30
|
+
const giftCardStatus = getGiftCardStatus(giftCard);
|
|
31
|
+
const giftCardStatusColor = getGiftCardStatusColor(giftCardStatus);
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
SidebarLink,
|
|
34
|
+
{
|
|
35
|
+
icon: /* @__PURE__ */ jsx(Gift, {}),
|
|
36
|
+
labelKey: giftCard.code,
|
|
37
|
+
descriptionKey: formatAmount(
|
|
38
|
+
giftCard.value ?? 0,
|
|
39
|
+
giftCard.currency_code
|
|
40
|
+
),
|
|
41
|
+
to: `/gift-cards/${giftCard.id}`,
|
|
42
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(StatusBadge, { color: giftCardStatusColor, className: "capitalize", children: giftCardStatus }),
|
|
44
|
+
/* @__PURE__ */ jsx(TriangleRightMini, { className: "text-ui-fg-muted" })
|
|
45
|
+
] })
|
|
46
|
+
},
|
|
47
|
+
giftCard.id
|
|
48
|
+
);
|
|
49
|
+
})
|
|
50
|
+
] });
|
|
51
|
+
};
|
|
52
|
+
const config = defineWidgetConfig({
|
|
53
|
+
zone: "order.details.side.after"
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
config,
|
|
57
|
+
OrderGiftCardsWidget as default
|
|
58
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
const redeem_gift_card_1 = require("../../../../../workflows/gift-cards/workflows/redeem-gift-card");
|
|
6
|
+
const POST = async (req, res) => {
|
|
7
|
+
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
8
|
+
const { id } = req.params;
|
|
9
|
+
await redeem_gift_card_1.redeemGiftCardWorkflow.run({
|
|
10
|
+
input: {
|
|
11
|
+
gift_card_id: id,
|
|
12
|
+
customer_id: req.validatedBody.customer_id,
|
|
13
|
+
is_admin: true,
|
|
14
|
+
},
|
|
15
|
+
container: req.scope,
|
|
16
|
+
});
|
|
17
|
+
const { data: [gift_card], } = await query.graph({
|
|
18
|
+
entity: "gift_cards",
|
|
19
|
+
fields: req.queryConfig.fields,
|
|
20
|
+
filters: { id },
|
|
21
|
+
}, { throwIfKeyNotFound: true });
|
|
22
|
+
res.json({ gift_card });
|
|
23
|
+
};
|
|
24
|
+
exports.POST = POST;
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL2FkbWluL2dpZnQtY2FyZHMvW2lkXS9yZWRlZW0vcm91dGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBSUEscURBQXNFO0FBQ3RFLHFHQUF3RztBQUdqRyxNQUFNLElBQUksR0FBRyxLQUFLLEVBQ3ZCLEdBQXdELEVBQ3hELEdBQW1CLEVBQ25CLEVBQUU7SUFDRixNQUFNLEtBQUssR0FBRyxHQUFHLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxpQ0FBeUIsQ0FBQyxLQUFLLENBQUMsQ0FBQztJQUNqRSxNQUFNLEVBQUUsRUFBRSxFQUFFLEdBQUcsR0FBRyxDQUFDLE1BQU0sQ0FBQztJQUUxQixNQUFNLHlDQUFzQixDQUFDLEdBQUcsQ0FBQztRQUMvQixLQUFLLEVBQUU7WUFDTCxZQUFZLEVBQUUsRUFBRTtZQUNoQixXQUFXLEVBQUUsR0FBRyxDQUFDLGFBQWEsQ0FBQyxXQUFXO1lBQzFDLFFBQVEsRUFBRSxJQUFJO1NBQ2Y7UUFDRCxTQUFTLEVBQUUsR0FBRyxDQUFDLEtBQUs7S0FDckIsQ0FBQyxDQUFDO0lBRUgsTUFBTSxFQUNKLElBQUksRUFBRSxDQUFDLFNBQVMsQ0FBQyxHQUNsQixHQUFHLE1BQU0sS0FBSyxDQUFDLEtBQUssQ0FDbkI7UUFDRSxNQUFNLEVBQUUsWUFBWTtRQUNwQixNQUFNLEVBQUUsR0FBRyxDQUFDLFdBQVcsQ0FBQyxNQUFNO1FBQzlCLE9BQU8sRUFBRSxFQUFFLEVBQUUsRUFBRTtLQUNoQixFQUNELEVBQUUsa0JBQWtCLEVBQUUsSUFBSSxFQUFFLENBQzdCLENBQUM7SUFFRixHQUFHLENBQUMsSUFBSSxDQUFDLEVBQUUsU0FBUyxFQUFFLENBQUMsQ0FBQztBQUMxQixDQUFDLENBQUM7QUE1QlcsUUFBQSxJQUFJLFFBNEJmIn0=
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = exports.GET = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
const update_gift_cards_1 = require("../../../../workflows/gift-cards/workflows/update-gift-cards");
|
|
6
|
+
const GET = async (req, res) => {
|
|
7
|
+
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
8
|
+
const { id } = req.params;
|
|
9
|
+
const { data: [gift_card], } = await query.graph({
|
|
10
|
+
entity: "gift_cards",
|
|
11
|
+
fields: req.queryConfig.fields,
|
|
12
|
+
filters: { id },
|
|
13
|
+
}, { throwIfKeyNotFound: true });
|
|
14
|
+
res.json({ gift_card });
|
|
15
|
+
};
|
|
16
|
+
exports.GET = GET;
|
|
17
|
+
const POST = async (req, res) => {
|
|
18
|
+
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
19
|
+
const { id } = req.params;
|
|
20
|
+
await query.graph({
|
|
21
|
+
entity: "gift_cards",
|
|
22
|
+
fields: req.queryConfig.fields,
|
|
23
|
+
filters: { id },
|
|
24
|
+
}, { throwIfKeyNotFound: true });
|
|
25
|
+
await update_gift_cards_1.updateGiftCardsWorkflow.run({
|
|
26
|
+
input: [
|
|
27
|
+
{
|
|
28
|
+
id,
|
|
29
|
+
...req.body,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
const { data: [gift_card], } = await query.graph({
|
|
34
|
+
entity: "gift_cards",
|
|
35
|
+
fields: req.queryConfig.fields,
|
|
36
|
+
filters: { id },
|
|
37
|
+
}, { throwIfKeyNotFound: true });
|
|
38
|
+
res.json({ gift_card });
|
|
39
|
+
};
|
|
40
|
+
exports.POST = POST;
|
|
41
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL2FkbWluL2dpZnQtY2FyZHMvW2lkXS9yb3V0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFJQSxxREFBc0U7QUFDdEUsb0dBQXVHO0FBTWhHLE1BQU0sR0FBRyxHQUFHLEtBQUssRUFDdEIsR0FBNEQsRUFDNUQsR0FBbUIsRUFDbkIsRUFBRTtJQUNGLE1BQU0sS0FBSyxHQUFHLEdBQUcsQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLGlDQUF5QixDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ2pFLE1BQU0sRUFBRSxFQUFFLEVBQUUsR0FBRyxHQUFHLENBQUMsTUFBTSxDQUFDO0lBRTFCLE1BQU0sRUFDSixJQUFJLEVBQUUsQ0FBQyxTQUFTLENBQUMsR0FDbEIsR0FBRyxNQUFNLEtBQUssQ0FBQyxLQUFLLENBQ25CO1FBQ0UsTUFBTSxFQUFFLFlBQVk7UUFDcEIsTUFBTSxFQUFFLEdBQUcsQ0FBQyxXQUFXLENBQUMsTUFBTTtRQUM5QixPQUFPLEVBQUUsRUFBRSxFQUFFLEVBQUU7S0FDaEIsRUFDRCxFQUFFLGtCQUFrQixFQUFFLElBQUksRUFBRSxDQUM3QixDQUFDO0lBRUYsR0FBRyxDQUFDLElBQUksQ0FBQyxFQUFFLFNBQVMsRUFBRSxDQUFDLENBQUM7QUFDMUIsQ0FBQyxDQUFDO0FBbkJXLFFBQUEsR0FBRyxPQW1CZDtBQUVLLE1BQU0sSUFBSSxHQUFHLEtBQUssRUFDdkIsR0FBd0QsRUFDeEQsR0FBbUIsRUFDbkIsRUFBRTtJQUNGLE1BQU0sS0FBSyxHQUFHLEdBQUcsQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLGlDQUF5QixDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ2pFLE1BQU0sRUFBRSxFQUFFLEVBQUUsR0FBRyxHQUFHLENBQUMsTUFBTSxDQUFDO0lBRTFCLE1BQU0sS0FBSyxDQUFDLEtBQUssQ0FDZjtRQUNFLE1BQU0sRUFBRSxZQUFZO1FBQ3BCLE1BQU0sRUFBRSxHQUFHLENBQUMsV0FBVyxDQUFDLE1BQU07UUFDOUIsT0FBTyxFQUFFLEVBQUUsRUFBRSxFQUFFO0tBQ2hCLEVBQ0QsRUFBRSxrQkFBa0IsRUFBRSxJQUFJLEVBQUUsQ0FDN0IsQ0FBQztJQUVGLE1BQU0sMkNBQXVCLENBQUMsR0FBRyxDQUFDO1FBQ2hDLEtBQUssRUFBRTtZQUNMO2dCQUNFLEVBQUU7Z0JBQ0YsR0FBRyxHQUFHLENBQUMsSUFBSTthQUNaO1NBQ0Y7S0FDRixDQUFDLENBQUM7SUFFSCxNQUFNLEVBQ0osSUFBSSxFQUFFLENBQUMsU0FBUyxDQUFDLEdBQ2xCLEdBQUcsTUFBTSxLQUFLLENBQUMsS0FBSyxDQUNuQjtRQUNFLE1BQU0sRUFBRSxZQUFZO1FBQ3BCLE1BQU0sRUFBRSxHQUFHLENBQUMsV0FBVyxDQUFDLE1BQU07UUFDOUIsT0FBTyxFQUFFLEVBQUUsRUFBRSxFQUFFO0tBQ2hCLEVBQ0QsRUFBRSxrQkFBa0IsRUFBRSxJQUFJLEVBQUUsQ0FDN0IsQ0FBQztJQUVGLEdBQUcsQ0FBQyxJQUFJLENBQUMsRUFBRSxTQUFTLEVBQUUsQ0FBQyxDQUFDO0FBQzFCLENBQUMsQ0FBQztBQXJDVyxRQUFBLElBQUksUUFxQ2YifQ==
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.POST = void 0;
|
|
4
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
5
|
+
const transfer_gift_card_1 = require("../../../../../workflows/gift-cards/workflows/transfer-gift-card");
|
|
6
|
+
const POST = async (req, res) => {
|
|
7
|
+
const query = req.scope.resolve(utils_1.ContainerRegistrationKeys.QUERY);
|
|
8
|
+
const { id } = req.params;
|
|
9
|
+
await transfer_gift_card_1.transferGiftCardWorkflow.run({
|
|
10
|
+
input: {
|
|
11
|
+
id,
|
|
12
|
+
customer_id: req.validatedBody.customer_id,
|
|
13
|
+
},
|
|
14
|
+
container: req.scope,
|
|
15
|
+
});
|
|
16
|
+
const { data: [gift_card], } = await query.graph({
|
|
17
|
+
entity: "gift_cards",
|
|
18
|
+
fields: req.queryConfig.fields,
|
|
19
|
+
filters: { id },
|
|
20
|
+
}, { throwIfKeyNotFound: true });
|
|
21
|
+
res.json({ gift_card });
|
|
22
|
+
};
|
|
23
|
+
exports.POST = POST;
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvYXBpL2FkbWluL2dpZnQtY2FyZHMvW2lkXS90cmFuc2Zlci9yb3V0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFJQSxxREFBc0U7QUFDdEUseUdBQTRHO0FBR3JHLE1BQU0sSUFBSSxHQUFHLEtBQUssRUFDdkIsR0FBMEQsRUFDMUQsR0FBbUIsRUFDbkIsRUFBRTtJQUNGLE1BQU0sS0FBSyxHQUFHLEdBQUcsQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLGlDQUF5QixDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ2pFLE1BQU0sRUFBRSxFQUFFLEVBQUUsR0FBRyxHQUFHLENBQUMsTUFBTSxDQUFDO0lBRTFCLE1BQU0sNkNBQXdCLENBQUMsR0FBRyxDQUFDO1FBQ2pDLEtBQUssRUFBRTtZQUNMLEVBQUU7WUFDRixXQUFXLEVBQUUsR0FBRyxDQUFDLGFBQWEsQ0FBQyxXQUFXO1NBQzNDO1FBQ0QsU0FBUyxFQUFFLEdBQUcsQ0FBQyxLQUFLO0tBQ3JCLENBQUMsQ0FBQztJQUVILE1BQU0sRUFDSixJQUFJLEVBQUUsQ0FBQyxTQUFTLENBQUMsR0FDbEIsR0FBRyxNQUFNLEtBQUssQ0FBQyxLQUFLLENBQ25CO1FBQ0UsTUFBTSxFQUFFLFlBQVk7UUFDcEIsTUFBTSxFQUFFLEdBQUcsQ0FBQyxXQUFXLENBQUMsTUFBTTtRQUM5QixPQUFPLEVBQUUsRUFBRSxFQUFFLEVBQUU7S0FDaEIsRUFDRCxFQUFFLGtCQUFrQixFQUFFLElBQUksRUFBRSxDQUM3QixDQUFDO0lBRUYsR0FBRyxDQUFDLElBQUksQ0FBQyxFQUFFLFNBQVMsRUFBRSxDQUFDLENBQUM7QUFDMUIsQ0FBQyxDQUFDO0FBM0JXLFFBQUEsSUFBSSxRQTJCZiJ9
|