@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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20250127174331 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20250127174331 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql('create table if not exists "loyalty_gift_card_invitation" ("id" text not null, "email" text not null, "code" text not null, "status" text check ("status" in (\'pending\', \'accepted\', \'rejected\')) not null default \'pending\', "expires_at" timestamptz null, "gift_card_id" text not null, "metadata" jsonb null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "loyalty_gift_card_invitation_pkey" primary key ("id"));');
|
|
8
|
+
this.addSql('alter table if exists "loyalty_gift_card_invitation" add constraint "loyalty_gift_card_invitation_gift_card_id_unique" unique ("gift_card_id");');
|
|
9
|
+
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_loyalty_gift_card_invitation_code_unique" ON "loyalty_gift_card_invitation" (code) WHERE deleted_at IS NULL;');
|
|
10
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_loyalty_gift_card_invitation_gift_card_id" ON "loyalty_gift_card_invitation" (gift_card_id) WHERE deleted_at IS NULL;');
|
|
11
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_loyalty_gift_card_invitation_deleted_at" ON "loyalty_gift_card_invitation" (deleted_at) WHERE deleted_at IS NULL;');
|
|
12
|
+
this.addSql('alter table if exists "loyalty_gift_card_invitation" add constraint "loyalty_gift_card_invitation_gift_card_id_foreign" foreign key ("gift_card_id") references "loyalty_gift_card" ("id") on update cascade;');
|
|
13
|
+
}
|
|
14
|
+
async down() {
|
|
15
|
+
this.addSql('drop table if exists "loyalty_gift_card_invitation" cascade;');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.Migration20250127174331 = Migration20250127174331;
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTAxMjcxNzQzMzEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9sb3lhbHR5L21pZ3JhdGlvbnMvTWlncmF0aW9uMjAyNTAxMjcxNzQzMzEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsc0RBQWtEO0FBRWxELE1BQWEsdUJBQXdCLFNBQVEsc0JBQVM7SUFDcEQsS0FBSyxDQUFDLEVBQUU7UUFDTixJQUFJLENBQUMsTUFBTSxDQUNULGdnQkFBZ2dCLENBQ2pnQixDQUFDO1FBRUYsSUFBSSxDQUFDLE1BQU0sQ0FDVCxpSkFBaUosQ0FDbEosQ0FBQztRQUVGLElBQUksQ0FBQyxNQUFNLENBQ1QscUpBQXFKLENBQ3RKLENBQUM7UUFFRixJQUFJLENBQUMsTUFBTSxDQUNULHVKQUF1SixDQUN4SixDQUFDO1FBRUYsSUFBSSxDQUFDLE1BQU0sQ0FDVCxtSkFBbUosQ0FDcEosQ0FBQztRQUVGLElBQUksQ0FBQyxNQUFNLENBQ1QsK01BQStNLENBQ2hOLENBQUM7SUFDSixDQUFDO0lBRUQsS0FBSyxDQUFDLElBQUk7UUFDUixJQUFJLENBQUMsTUFBTSxDQUFDLDhEQUE4RCxDQUFDLENBQUM7SUFDOUUsQ0FBQztDQUNGO0FBOUJELDBEQThCQyJ9
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20250206141026 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20250206141026 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql(`alter table if exists "loyalty_gift_card_invitation" drop constraint if exists "loyalty_gift_card_invitation_gift_card_id_unique";`);
|
|
8
|
+
this.addSql(`drop index if exists "loyalty_gift_card_invitation_gift_card_id_unique";`);
|
|
9
|
+
this.addSql(`drop index if exists "IDX_loyalty_gift_card_invitation_gift_card_id";`);
|
|
10
|
+
this.addSql(`CREATE UNIQUE INDEX IF NOT EXISTS "IDX_loyalty_gift_card_invitation_gift_card_id_unique" ON "loyalty_gift_card_invitation" (gift_card_id) WHERE deleted_at IS NULL;`);
|
|
11
|
+
}
|
|
12
|
+
async down() {
|
|
13
|
+
this.addSql(`drop index if exists "IDX_loyalty_gift_card_invitation_gift_card_id_unique";`);
|
|
14
|
+
this.addSql(`alter table if exists "loyalty_gift_card_invitation" add constraint "loyalty_gift_card_invitation_gift_card_id_unique" unique ("gift_card_id");`);
|
|
15
|
+
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_loyalty_gift_card_invitation_gift_card_id" ON "loyalty_gift_card_invitation" (gift_card_id) WHERE deleted_at IS NULL;`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.Migration20250206141026 = Migration20250206141026;
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTAyMDYxNDEwMjYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9sb3lhbHR5L21pZ3JhdGlvbnMvTWlncmF0aW9uMjAyNTAyMDYxNDEwMjYudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsc0RBQWtEO0FBRWxELE1BQWEsdUJBQXdCLFNBQVEsc0JBQVM7SUFDM0MsS0FBSyxDQUFDLEVBQUU7UUFDZixJQUFJLENBQUMsTUFBTSxDQUNULG9JQUFvSSxDQUNySSxDQUFDO1FBQ0YsSUFBSSxDQUFDLE1BQU0sQ0FDVCwwRUFBMEUsQ0FDM0UsQ0FBQztRQUNGLElBQUksQ0FBQyxNQUFNLENBQ1QsdUVBQXVFLENBQ3hFLENBQUM7UUFFRixJQUFJLENBQUMsTUFBTSxDQUNULHFLQUFxSyxDQUN0SyxDQUFDO0lBQ0osQ0FBQztJQUVRLEtBQUssQ0FBQyxJQUFJO1FBQ2pCLElBQUksQ0FBQyxNQUFNLENBQ1QsOEVBQThFLENBQy9FLENBQUM7UUFFRixJQUFJLENBQUMsTUFBTSxDQUNULGlKQUFpSixDQUNsSixDQUFDO1FBQ0YsSUFBSSxDQUFDLE1BQU0sQ0FDVCx1SkFBdUosQ0FDeEosQ0FBQztJQUNKLENBQUM7Q0FDRjtBQTdCRCwwREE2QkMifQ==
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20250206141429 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20250206141429 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql(`drop index if exists "IDX_line_item_id_customer_id";`);
|
|
8
|
+
}
|
|
9
|
+
async down() {
|
|
10
|
+
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_line_item_id_customer_id" ON "loyalty_gift_card" (line_item_id, customer_id) WHERE deleted_at IS NULL;`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Migration20250206141429 = Migration20250206141429;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTAyMDYxNDE0MjkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9sb3lhbHR5L21pZ3JhdGlvbnMvTWlncmF0aW9uMjAyNTAyMDYxNDE0MjkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsc0RBQWtEO0FBRWxELE1BQWEsdUJBQXdCLFNBQVEsc0JBQVM7SUFDM0MsS0FBSyxDQUFDLEVBQUU7UUFDZixJQUFJLENBQUMsTUFBTSxDQUFDLHNEQUFzRCxDQUFDLENBQUM7SUFDdEUsQ0FBQztJQUVRLEtBQUssQ0FBQyxJQUFJO1FBQ2pCLElBQUksQ0FBQyxNQUFNLENBQ1Qsd0lBQXdJLENBQ3pJLENBQUM7SUFDSixDQUFDO0NBQ0Y7QUFWRCwwREFVQyJ9
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20250206144714 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20250206144714 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql(`alter table if exists "loyalty_gift_card" add column if not exists "reference_id" text null, add column if not exists "reference" text null;`);
|
|
8
|
+
}
|
|
9
|
+
async down() {
|
|
10
|
+
this.addSql(`alter table if exists "loyalty_gift_card" drop column if exists "reference_id", drop column if exists "reference";`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Migration20250206144714 = Migration20250206144714;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTAyMDYxNDQ3MTQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9sb3lhbHR5L21pZ3JhdGlvbnMvTWlncmF0aW9uMjAyNTAyMDYxNDQ3MTQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsc0RBQWtEO0FBRWxELE1BQWEsdUJBQXdCLFNBQVEsc0JBQVM7SUFDM0MsS0FBSyxDQUFDLEVBQUU7UUFDZixJQUFJLENBQUMsTUFBTSxDQUNULDhJQUE4SSxDQUMvSSxDQUFDO0lBQ0osQ0FBQztJQUVRLEtBQUssQ0FBQyxJQUFJO1FBQ2pCLElBQUksQ0FBQyxNQUFNLENBQ1Qsb0hBQW9ILENBQ3JILENBQUM7SUFDSixDQUFDO0NBQ0Y7QUFaRCwwREFZQyJ9
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
7
|
+
const types_1 = require("../../../types");
|
|
8
|
+
const gift_card_1 = __importDefault(require("./gift-card"));
|
|
9
|
+
exports.default = utils_1.model.define({ tableName: "loyalty_gift_card_invitation", name: "GiftCardInvitation" }, {
|
|
10
|
+
id: utils_1.model.id({ prefix: "gcardinv" }).primaryKey(),
|
|
11
|
+
email: utils_1.model.text().searchable(),
|
|
12
|
+
code: utils_1.model.text().unique(),
|
|
13
|
+
status: utils_1.model
|
|
14
|
+
.enum(types_1.GiftCardInvitationStatus)
|
|
15
|
+
.default(types_1.GiftCardInvitationStatus.PENDING),
|
|
16
|
+
expires_at: utils_1.model.dateTime().nullable(),
|
|
17
|
+
gift_card: utils_1.model.belongsTo(() => gift_card_1.default, { mappedBy: "invitation" }),
|
|
18
|
+
metadata: utils_1.model.json().nullable(),
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2lmdC1jYXJkLWludml0YXRpb24uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9sb3lhbHR5L21vZGVscy9naWZ0LWNhcmQtaW52aXRhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHFEQUFrRDtBQUNsRCwwQ0FBMEQ7QUFDMUQsNERBQW1DO0FBRW5DLGtCQUFlLGFBQUssQ0FBQyxNQUFNLENBQ3pCLEVBQUUsU0FBUyxFQUFFLDhCQUE4QixFQUFFLElBQUksRUFBRSxvQkFBb0IsRUFBRSxFQUN6RTtJQUNFLEVBQUUsRUFBRSxhQUFLLENBQUMsRUFBRSxDQUFDLEVBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxDQUFDLENBQUMsVUFBVSxFQUFFO0lBQ2pELEtBQUssRUFBRSxhQUFLLENBQUMsSUFBSSxFQUFFLENBQUMsVUFBVSxFQUFFO0lBQ2hDLElBQUksRUFBRSxhQUFLLENBQUMsSUFBSSxFQUFFLENBQUMsTUFBTSxFQUFFO0lBQzNCLE1BQU0sRUFBRSxhQUFLO1NBQ1YsSUFBSSxDQUFDLGdDQUF3QixDQUFDO1NBQzlCLE9BQU8sQ0FBQyxnQ0FBd0IsQ0FBQyxPQUFPLENBQUM7SUFDNUMsVUFBVSxFQUFFLGFBQUssQ0FBQyxRQUFRLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDdkMsU0FBUyxFQUFFLGFBQUssQ0FBQyxTQUFTLENBQUMsR0FBRyxFQUFFLENBQUMsbUJBQVEsRUFBRSxFQUFFLFFBQVEsRUFBRSxZQUFZLEVBQUUsQ0FBQztJQUN0RSxRQUFRLEVBQUUsYUFBSyxDQUFDLElBQUksRUFBRSxDQUFDLFFBQVEsRUFBRTtDQUNsQyxDQUNGLENBQUMifQ==
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
7
|
+
const types_1 = require("../../../types");
|
|
8
|
+
const gift_card_invitation_1 = __importDefault(require("./gift-card-invitation"));
|
|
9
|
+
exports.default = utils_1.model.define({ tableName: "loyalty_gift_card", name: "GiftCard" }, {
|
|
10
|
+
id: utils_1.model.id({ prefix: "gcard" }).primaryKey(),
|
|
11
|
+
status: utils_1.model.enum(types_1.GiftCardStatus).default(types_1.GiftCardStatus.PENDING),
|
|
12
|
+
value: utils_1.model.bigNumber(),
|
|
13
|
+
code: utils_1.model.text().searchable().unique(),
|
|
14
|
+
currency_code: utils_1.model.text().searchable(),
|
|
15
|
+
expires_at: utils_1.model.dateTime().nullable(),
|
|
16
|
+
reference_id: utils_1.model.text().nullable(),
|
|
17
|
+
reference: utils_1.model.text().nullable(),
|
|
18
|
+
line_item_id: utils_1.model.text(),
|
|
19
|
+
customer_id: utils_1.model.text(),
|
|
20
|
+
note: utils_1.model.text().nullable(),
|
|
21
|
+
metadata: utils_1.model.json().nullable(),
|
|
22
|
+
invitation: utils_1.model
|
|
23
|
+
.hasOne(() => gift_card_invitation_1.default, {
|
|
24
|
+
mappedBy: "gift_card",
|
|
25
|
+
})
|
|
26
|
+
.nullable(),
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2lmdC1jYXJkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21vZHVsZXMvbG95YWx0eS9tb2RlbHMvZ2lmdC1jYXJkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEscURBQWtEO0FBQ2xELDBDQUFnRDtBQUNoRCxrRkFBd0Q7QUFFeEQsa0JBQWUsYUFBSyxDQUFDLE1BQU0sQ0FDekIsRUFBRSxTQUFTLEVBQUUsbUJBQW1CLEVBQUUsSUFBSSxFQUFFLFVBQVUsRUFBRSxFQUNwRDtJQUNFLEVBQUUsRUFBRSxhQUFLLENBQUMsRUFBRSxDQUFDLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxDQUFDLENBQUMsVUFBVSxFQUFFO0lBQzlDLE1BQU0sRUFBRSxhQUFLLENBQUMsSUFBSSxDQUFDLHNCQUFjLENBQUMsQ0FBQyxPQUFPLENBQUMsc0JBQWMsQ0FBQyxPQUFPLENBQUM7SUFDbEUsS0FBSyxFQUFFLGFBQUssQ0FBQyxTQUFTLEVBQUU7SUFDeEIsSUFBSSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxVQUFVLEVBQUUsQ0FBQyxNQUFNLEVBQUU7SUFDeEMsYUFBYSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxVQUFVLEVBQUU7SUFDeEMsVUFBVSxFQUFFLGFBQUssQ0FBQyxRQUFRLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDdkMsWUFBWSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDckMsU0FBUyxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDbEMsWUFBWSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUU7SUFDMUIsV0FBVyxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUU7SUFDekIsSUFBSSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFDN0IsUUFBUSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7SUFFakMsVUFBVSxFQUFFLGFBQUs7U0FDZCxNQUFNLENBQUMsR0FBRyxFQUFFLENBQUMsOEJBQWtCLEVBQUU7UUFDaEMsUUFBUSxFQUFFLFdBQVc7S0FDdEIsQ0FBQztTQUNELFFBQVEsRUFBRTtDQUNkLENBQ0YsQ0FBQyJ9
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
7
|
+
const gift_card_1 = __importDefault(require("./models/gift-card"));
|
|
8
|
+
const gift_card_invitation_1 = __importDefault(require("./models/gift-card-invitation"));
|
|
9
|
+
class LoyaltyModuleService extends (0, utils_1.MedusaService)({
|
|
10
|
+
GiftCard: gift_card_1.default,
|
|
11
|
+
GiftCardInvitation: gift_card_invitation_1.default,
|
|
12
|
+
}) {
|
|
13
|
+
}
|
|
14
|
+
exports.default = LoyaltyModuleService;
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9tb2R1bGVzL2xveWFsdHkvc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHFEQUEwRDtBQUMxRCxtRUFBMEM7QUFDMUMseUZBQStEO0FBRS9ELE1BQU0sb0JBQXFCLFNBQVEsSUFBQSxxQkFBYSxFQUFDO0lBQy9DLFFBQVEsRUFBUixtQkFBUTtJQUNSLGtCQUFrQixFQUFsQiw4QkFBa0I7Q0FDbkIsQ0FBQztDQUFHO0FBRUwsa0JBQWUsb0JBQW9CLENBQUMifQ==
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
7
|
+
const types_1 = require("../../types");
|
|
8
|
+
const service_1 = __importDefault(require("./service"));
|
|
9
|
+
exports.default = (0, utils_1.Module)(types_1.PluginModule.STORE_CREDIT, {
|
|
10
|
+
service: service_1.default,
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9zdG9yZS1jcmVkaXQvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxxREFBbUQ7QUFDbkQsdUNBQTJDO0FBQzNDLHdEQUEyQztBQUUzQyxrQkFBZSxJQUFBLGNBQU0sRUFBQyxvQkFBWSxDQUFDLFlBQVksRUFBRTtJQUMvQyxPQUFPLEVBQUUsaUJBQWtCO0NBQzVCLENBQUMsQ0FBQyJ9
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20250129115518 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20250129115518 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql('create table if not exists "store_credit_account" ("id" text not null, "currency_code" text not null, "customer_id" text not null, "metadata" jsonb null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "store_credit_account_pkey" primary key ("id"));');
|
|
8
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_store_credit_account_deleted_at" ON "store_credit_account" (deleted_at) WHERE deleted_at IS NULL;');
|
|
9
|
+
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_id_currency_code" ON "store_credit_account" (customer_id, currency_code) WHERE deleted_at IS NULL;');
|
|
10
|
+
}
|
|
11
|
+
async down() {
|
|
12
|
+
this.addSql('drop table if exists "store_credit_account" cascade;');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.Migration20250129115518 = Migration20250129115518;
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTAxMjkxMTU1MTguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9zdG9yZS1jcmVkaXQvbWlncmF0aW9ucy9NaWdyYXRpb24yMDI1MDEyOTExNTUxOC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxzREFBa0Q7QUFFbEQsTUFBYSx1QkFBd0IsU0FBUSxzQkFBUztJQUNwRCxLQUFLLENBQUMsRUFBRTtRQUNOLElBQUksQ0FBQyxNQUFNLENBQ1Qsd1ZBQXdWLENBQ3pWLENBQUM7UUFFRixJQUFJLENBQUMsTUFBTSxDQUNULG1JQUFtSSxDQUNwSSxDQUFDO1FBRUYsSUFBSSxDQUFDLE1BQU0sQ0FDVCxvSkFBb0osQ0FDckosQ0FBQztJQUNKLENBQUM7SUFFRCxLQUFLLENBQUMsSUFBSTtRQUNSLElBQUksQ0FBQyxNQUFNLENBQUMsc0RBQXNELENBQUMsQ0FBQztJQUN0RSxDQUFDO0NBQ0Y7QUFsQkQsMERBa0JDIn0=
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20250130213237 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20250130213237 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql('create table if not exists "store_credit_transaction_group" ("id" text not null, "code" text not null, "account_id" text not null, "metadata" jsonb null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "store_credit_transaction_group_pkey" primary key ("id"));');
|
|
8
|
+
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_store_credit_transaction_group_code_unique" ON "store_credit_transaction_group" (code) WHERE deleted_at IS NULL;');
|
|
9
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_store_credit_transaction_group_account_id" ON "store_credit_transaction_group" (account_id) WHERE deleted_at IS NULL;');
|
|
10
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_store_credit_transaction_group_deleted_at" ON "store_credit_transaction_group" (deleted_at) WHERE deleted_at IS NULL;');
|
|
11
|
+
this.addSql('alter table if exists "store_credit_transaction_group" add constraint "store_credit_transaction_group_account_id_foreign" foreign key ("account_id") references "store_credit_account" ("id") on update cascade;');
|
|
12
|
+
}
|
|
13
|
+
async down() {
|
|
14
|
+
this.addSql('drop table if exists "store_credit_transaction_group" cascade;');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.Migration20250130213237 = Migration20250130213237;
|
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTAxMzAyMTMyMzcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9zdG9yZS1jcmVkaXQvbWlncmF0aW9ucy9NaWdyYXRpb24yMDI1MDEzMDIxMzIzNy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxzREFBa0Q7QUFFbEQsTUFBYSx1QkFBd0IsU0FBUSxzQkFBUztJQUNwRCxLQUFLLENBQUMsRUFBRTtRQUNOLElBQUksQ0FBQyxNQUFNLENBQ1Qsa1dBQWtXLENBQ25XLENBQUM7UUFFRixJQUFJLENBQUMsTUFBTSxDQUNULHlKQUF5SixDQUMxSixDQUFDO1FBRUYsSUFBSSxDQUFDLE1BQU0sQ0FDVCx1SkFBdUosQ0FDeEosQ0FBQztRQUVGLElBQUksQ0FBQyxNQUFNLENBQ1QsdUpBQXVKLENBQ3hKLENBQUM7UUFFRixJQUFJLENBQUMsTUFBTSxDQUNULGtOQUFrTixDQUNuTixDQUFDO0lBQ0osQ0FBQztJQUVELEtBQUssQ0FBQyxJQUFJO1FBQ1IsSUFBSSxDQUFDLE1BQU0sQ0FDVCxnRUFBZ0UsQ0FDakUsQ0FBQztJQUNKLENBQUM7Q0FDRjtBQTVCRCwwREE0QkMifQ==
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20250130220640 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20250130220640 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql('create table if not exists "store_credit_account_transaction" ("id" text not null, "amount" numeric not null, "type" text check ("type" in (\'credit\', \'debit\')) not null, "reference" text not null, "reference_id" text not null, "note" text null, "account_id" text not null, "transaction_group_id" text null, "metadata" jsonb null, "raw_amount" jsonb not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "store_credit_account_transaction_pkey" primary key ("id"));');
|
|
8
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_store_credit_account_transaction_account_id" ON "store_credit_account_transaction" (account_id) WHERE deleted_at IS NULL;');
|
|
9
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_store_credit_account_transaction_transaction_group_id" ON "store_credit_account_transaction" (transaction_group_id) WHERE deleted_at IS NULL;');
|
|
10
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_store_credit_account_transaction_deleted_at" ON "store_credit_account_transaction" (deleted_at) WHERE deleted_at IS NULL;');
|
|
11
|
+
this.addSql('alter table if exists "store_credit_account_transaction" add constraint "store_credit_account_transaction_account_id_foreign" foreign key ("account_id") references "store_credit_account" ("id") on update cascade;');
|
|
12
|
+
this.addSql('alter table if exists "store_credit_account_transaction" add constraint "store_credit_account_transaction_transaction_group_id_foreign" foreign key ("transaction_group_id") references "store_credit_transaction_group" ("id") on update cascade on delete set null;');
|
|
13
|
+
}
|
|
14
|
+
async down() {
|
|
15
|
+
this.addSql('drop table if exists "store_credit_account_transaction" cascade;');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.Migration20250130220640 = Migration20250130220640;
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTAxMzAyMjA2NDAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9zdG9yZS1jcmVkaXQvbWlncmF0aW9ucy9NaWdyYXRpb24yMDI1MDEzMDIyMDY0MC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxzREFBa0Q7QUFFbEQsTUFBYSx1QkFBd0IsU0FBUSxzQkFBUztJQUNwRCxLQUFLLENBQUMsRUFBRTtRQUNOLElBQUksQ0FBQyxNQUFNLENBQ1QscWpCQUFxakIsQ0FDdGpCLENBQUM7UUFFRixJQUFJLENBQUMsTUFBTSxDQUNULDJKQUEySixDQUM1SixDQUFDO1FBRUYsSUFBSSxDQUFDLE1BQU0sQ0FDVCwrS0FBK0ssQ0FDaEwsQ0FBQztRQUVGLElBQUksQ0FBQyxNQUFNLENBQ1QsMkpBQTJKLENBQzVKLENBQUM7UUFFRixJQUFJLENBQUMsTUFBTSxDQUNULHNOQUFzTixDQUN2TixDQUFDO1FBRUYsSUFBSSxDQUFDLE1BQU0sQ0FDVCx1UUFBdVEsQ0FDeFEsQ0FBQztJQUNKLENBQUM7SUFFRCxLQUFLLENBQUMsSUFBSTtRQUNSLElBQUksQ0FBQyxNQUFNLENBQ1Qsa0VBQWtFLENBQ25FLENBQUM7SUFDSixDQUFDO0NBQ0Y7QUFoQ0QsMERBZ0NDIn0=
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20250131205753 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20250131205753 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_account_id" ON "store_credit_transaction_group" (code, account_id) WHERE deleted_at IS NULL;');
|
|
8
|
+
}
|
|
9
|
+
async down() {
|
|
10
|
+
this.addSql('drop index if exists "IDX_account_id";');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Migration20250131205753 = Migration20250131205753;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWlncmF0aW9uMjAyNTAxMzEyMDU3NTMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9zdG9yZS1jcmVkaXQvbWlncmF0aW9ucy9NaWdyYXRpb24yMDI1MDEzMTIwNTc1My50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxzREFBa0Q7QUFFbEQsTUFBYSx1QkFBd0IsU0FBUSxzQkFBUztJQUVwRCxLQUFLLENBQUMsRUFBRTtRQUNOLElBQUksQ0FBQyxNQUFNLENBQUMscUlBQXFJLENBQUMsQ0FBQztJQUNySixDQUFDO0lBRUQsS0FBSyxDQUFDLElBQUk7UUFDUixJQUFJLENBQUMsTUFBTSxDQUFDLHdDQUF3QyxDQUFDLENBQUM7SUFDeEQsQ0FBQztDQUVGO0FBVkQsMERBVUMifQ==
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
7
|
+
const types_1 = require("../../../types");
|
|
8
|
+
const store_credit_account_1 = __importDefault(require("./store-credit-account"));
|
|
9
|
+
const transaction_group_1 = __importDefault(require("./transaction-group"));
|
|
10
|
+
exports.default = utils_1.model.define({ tableName: "store_credit_account_transaction", name: "AccountTransaction" }, {
|
|
11
|
+
id: utils_1.model.id({ prefix: "sc_trx" }).primaryKey(),
|
|
12
|
+
amount: utils_1.model.bigNumber(),
|
|
13
|
+
type: utils_1.model.enum(types_1.TransactionType),
|
|
14
|
+
reference: utils_1.model.text(),
|
|
15
|
+
reference_id: utils_1.model.text(),
|
|
16
|
+
note: utils_1.model.text().nullable(),
|
|
17
|
+
account: utils_1.model.belongsTo(() => store_credit_account_1.default, {
|
|
18
|
+
mappedBy: "transactions",
|
|
19
|
+
}),
|
|
20
|
+
transaction_group: utils_1.model
|
|
21
|
+
.belongsTo(() => transaction_group_1.default, {
|
|
22
|
+
mappedBy: "transactions",
|
|
23
|
+
})
|
|
24
|
+
.nullable(),
|
|
25
|
+
metadata: utils_1.model.json().nullable(),
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjb3VudC10cmFuc2FjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tb2R1bGVzL3N0b3JlLWNyZWRpdC9tb2RlbHMvYWNjb3VudC10cmFuc2FjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHFEQUFrRDtBQUNsRCwwQ0FBaUQ7QUFDakQsa0ZBQXdEO0FBQ3hELDRFQUFtRDtBQUVuRCxrQkFBZSxhQUFLLENBQUMsTUFBTSxDQUN6QixFQUFFLFNBQVMsRUFBRSxrQ0FBa0MsRUFBRSxJQUFJLEVBQUUsb0JBQW9CLEVBQUUsRUFDN0U7SUFDRSxFQUFFLEVBQUUsYUFBSyxDQUFDLEVBQUUsQ0FBQyxFQUFFLE1BQU0sRUFBRSxRQUFRLEVBQUUsQ0FBQyxDQUFDLFVBQVUsRUFBRTtJQUUvQyxNQUFNLEVBQUUsYUFBSyxDQUFDLFNBQVMsRUFBRTtJQUN6QixJQUFJLEVBQUUsYUFBSyxDQUFDLElBQUksQ0FBQyx1QkFBZSxDQUFDO0lBQ2pDLFNBQVMsRUFBRSxhQUFLLENBQUMsSUFBSSxFQUFFO0lBQ3ZCLFlBQVksRUFBRSxhQUFLLENBQUMsSUFBSSxFQUFFO0lBQzFCLElBQUksRUFBRSxhQUFLLENBQUMsSUFBSSxFQUFFLENBQUMsUUFBUSxFQUFFO0lBRTdCLE9BQU8sRUFBRSxhQUFLLENBQUMsU0FBUyxDQUFDLEdBQUcsRUFBRSxDQUFDLDhCQUFrQixFQUFFO1FBQ2pELFFBQVEsRUFBRSxjQUFjO0tBQ3pCLENBQUM7SUFFRixpQkFBaUIsRUFBRSxhQUFLO1NBQ3JCLFNBQVMsQ0FBQyxHQUFHLEVBQUUsQ0FBQywyQkFBZ0IsRUFBRTtRQUNqQyxRQUFRLEVBQUUsY0FBYztLQUN6QixDQUFDO1NBQ0QsUUFBUSxFQUFFO0lBRWIsUUFBUSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7Q0FDbEMsQ0FDRixDQUFDIn0=
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
7
|
+
const account_transaction_1 = __importDefault(require("./account-transaction"));
|
|
8
|
+
const transaction_group_1 = __importDefault(require("./transaction-group"));
|
|
9
|
+
exports.default = utils_1.model
|
|
10
|
+
.define({ tableName: "store_credit_account", name: "StoreCreditAccount" }, {
|
|
11
|
+
id: utils_1.model.id({ prefix: "sc_acc" }).primaryKey(),
|
|
12
|
+
currency_code: utils_1.model.text().searchable(),
|
|
13
|
+
customer_id: utils_1.model.text(),
|
|
14
|
+
transactions: utils_1.model.hasMany(() => account_transaction_1.default, {
|
|
15
|
+
mappedBy: "account",
|
|
16
|
+
}),
|
|
17
|
+
transaction_groups: utils_1.model.hasMany(() => transaction_group_1.default, {
|
|
18
|
+
mappedBy: "account",
|
|
19
|
+
}),
|
|
20
|
+
metadata: utils_1.model.json().nullable(),
|
|
21
|
+
})
|
|
22
|
+
.indexes([
|
|
23
|
+
{
|
|
24
|
+
name: "IDX_customer_id_currency_code",
|
|
25
|
+
on: ["customer_id", "currency_code"],
|
|
26
|
+
unique: true,
|
|
27
|
+
},
|
|
28
|
+
]);
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmUtY3JlZGl0LWFjY291bnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9zdG9yZS1jcmVkaXQvbW9kZWxzL3N0b3JlLWNyZWRpdC1hY2NvdW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEscURBQWtEO0FBQ2xELGdGQUF1RDtBQUN2RCw0RUFBbUQ7QUFFbkQsa0JBQWUsYUFBSztLQUNqQixNQUFNLENBQ0wsRUFBRSxTQUFTLEVBQUUsc0JBQXNCLEVBQUUsSUFBSSxFQUFFLG9CQUFvQixFQUFFLEVBQ2pFO0lBQ0UsRUFBRSxFQUFFLGFBQUssQ0FBQyxFQUFFLENBQUMsRUFBRSxNQUFNLEVBQUUsUUFBUSxFQUFFLENBQUMsQ0FBQyxVQUFVLEVBQUU7SUFDL0MsYUFBYSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxVQUFVLEVBQUU7SUFDeEMsV0FBVyxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUU7SUFFekIsWUFBWSxFQUFFLGFBQUssQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUMsNkJBQWtCLEVBQUU7UUFDcEQsUUFBUSxFQUFFLFNBQVM7S0FDcEIsQ0FBQztJQUVGLGtCQUFrQixFQUFFLGFBQUssQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUMsMkJBQWdCLEVBQUU7UUFDeEQsUUFBUSxFQUFFLFNBQVM7S0FDcEIsQ0FBQztJQUVGLFFBQVEsRUFBRSxhQUFLLENBQUMsSUFBSSxFQUFFLENBQUMsUUFBUSxFQUFFO0NBQ2xDLENBQ0Y7S0FDQSxPQUFPLENBQUM7SUFDUDtRQUNFLElBQUksRUFBRSwrQkFBK0I7UUFDckMsRUFBRSxFQUFFLENBQUMsYUFBYSxFQUFFLGVBQWUsQ0FBQztRQUNwQyxNQUFNLEVBQUUsSUFBSTtLQUNiO0NBQ0YsQ0FBQyxDQUFDIn0=
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("@medusajs/framework/utils");
|
|
7
|
+
const account_transaction_1 = __importDefault(require("./account-transaction"));
|
|
8
|
+
const store_credit_account_1 = __importDefault(require("./store-credit-account"));
|
|
9
|
+
exports.default = utils_1.model
|
|
10
|
+
.define({ tableName: "store_credit_transaction_group", name: "TransactionGroup" }, {
|
|
11
|
+
id: utils_1.model.id({ prefix: "sc_trgp" }).primaryKey(),
|
|
12
|
+
code: utils_1.model.text().searchable().unique(),
|
|
13
|
+
account: utils_1.model.belongsTo(() => store_credit_account_1.default, {
|
|
14
|
+
mappedBy: "transaction_groups",
|
|
15
|
+
}),
|
|
16
|
+
transactions: utils_1.model.hasMany(() => account_transaction_1.default, {
|
|
17
|
+
mappedBy: "transaction_group",
|
|
18
|
+
}),
|
|
19
|
+
metadata: utils_1.model.json().nullable(),
|
|
20
|
+
})
|
|
21
|
+
.indexes([
|
|
22
|
+
{
|
|
23
|
+
name: "IDX_account_id",
|
|
24
|
+
on: ["code", "account_id"],
|
|
25
|
+
unique: true,
|
|
26
|
+
},
|
|
27
|
+
]);
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNhY3Rpb24tZ3JvdXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9zdG9yZS1jcmVkaXQvbW9kZWxzL3RyYW5zYWN0aW9uLWdyb3VwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEscURBQWtEO0FBQ2xELGdGQUF1RDtBQUN2RCxrRkFBd0Q7QUFFeEQsa0JBQWUsYUFBSztLQUNqQixNQUFNLENBQ0wsRUFBRSxTQUFTLEVBQUUsZ0NBQWdDLEVBQUUsSUFBSSxFQUFFLGtCQUFrQixFQUFFLEVBQ3pFO0lBQ0UsRUFBRSxFQUFFLGFBQUssQ0FBQyxFQUFFLENBQUMsRUFBRSxNQUFNLEVBQUUsU0FBUyxFQUFFLENBQUMsQ0FBQyxVQUFVLEVBQUU7SUFDaEQsSUFBSSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxVQUFVLEVBQUUsQ0FBQyxNQUFNLEVBQUU7SUFFeEMsT0FBTyxFQUFFLGFBQUssQ0FBQyxTQUFTLENBQUMsR0FBRyxFQUFFLENBQUMsOEJBQWtCLEVBQUU7UUFDakQsUUFBUSxFQUFFLG9CQUFvQjtLQUMvQixDQUFDO0lBRUYsWUFBWSxFQUFFLGFBQUssQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUMsNkJBQWtCLEVBQUU7UUFDcEQsUUFBUSxFQUFFLG1CQUFtQjtLQUM5QixDQUFDO0lBRUYsUUFBUSxFQUFFLGFBQUssQ0FBQyxJQUFJLEVBQUUsQ0FBQyxRQUFRLEVBQUU7Q0FDbEMsQ0FDRjtLQUNBLE9BQU8sQ0FBQztJQUNQO1FBQ0UsSUFBSSxFQUFFLGdCQUFnQjtRQUN0QixFQUFFLEVBQUUsQ0FBQyxNQUFNLEVBQUUsWUFBWSxDQUFDO1FBQzFCLE1BQU0sRUFBRSxJQUFJO0tBQ2I7Q0FDRixDQUFDLENBQUMifQ==
|