@vendure/mcp-plugin 3.8.0-minor-bootstrap.0
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/lib/api/api-extensions.d.ts +2 -0
- package/lib/api/api-extensions.js +239 -0
- package/lib/api/api-extensions.js.map +1 -0
- package/lib/api/mcp-actor.service.d.ts +19 -0
- package/lib/api/mcp-actor.service.js +52 -0
- package/lib/api/mcp-actor.service.js.map +1 -0
- package/lib/api/mcp-admin.resolver.d.ts +105 -0
- package/lib/api/mcp-admin.resolver.js +463 -0
- package/lib/api/mcp-admin.resolver.js.map +1 -0
- package/lib/api/mcp-shop.resolver.d.ts +25 -0
- package/lib/api/mcp-shop.resolver.js +74 -0
- package/lib/api/mcp-shop.resolver.js.map +1 -0
- package/lib/check-options.d.ts +7 -0
- package/lib/check-options.js +130 -0
- package/lib/check-options.js.map +1 -0
- package/lib/constants.d.ts +48 -0
- package/lib/constants.js +72 -0
- package/lib/constants.js.map +1 -0
- package/lib/delete-in-batches.d.ts +5 -0
- package/lib/delete-in-batches.js +28 -0
- package/lib/delete-in-batches.js.map +1 -0
- package/lib/entities/index.d.ts +5 -0
- package/lib/entities/index.js +22 -0
- package/lib/entities/index.js.map +1 -0
- package/lib/entities/mcp-authorization-code.entity.d.ts +33 -0
- package/lib/entities/mcp-authorization-code.entity.js +77 -0
- package/lib/entities/mcp-authorization-code.entity.js.map +1 -0
- package/lib/entities/mcp-authorization-request.entity.d.ts +31 -0
- package/lib/entities/mcp-authorization-request.entity.js +73 -0
- package/lib/entities/mcp-authorization-request.entity.js.map +1 -0
- package/lib/entities/mcp-oauth-client.entity.d.ts +56 -0
- package/lib/entities/mcp-oauth-client.entity.js +70 -0
- package/lib/entities/mcp-oauth-client.entity.js.map +1 -0
- package/lib/entities/mcp-oauth-grant.entity.d.ts +77 -0
- package/lib/entities/mcp-oauth-grant.entity.js +121 -0
- package/lib/entities/mcp-oauth-grant.entity.js.map +1 -0
- package/lib/entities/mcp-tool-call-log.entity.d.ts +50 -0
- package/lib/entities/mcp-tool-call-log.entity.js +101 -0
- package/lib/entities/mcp-tool-call-log.entity.js.map +1 -0
- package/lib/events/mcp-tool-call.event.d.ts +17 -0
- package/lib/events/mcp-tool-call.event.js +23 -0
- package/lib/events/mcp-tool-call.event.js.map +1 -0
- package/lib/get-client-ip.d.ts +2 -0
- package/lib/get-client-ip.js +10 -0
- package/lib/get-client-ip.js.map +1 -0
- package/lib/get-language-code.d.ts +3 -0
- package/lib/get-language-code.js +12 -0
- package/lib/get-language-code.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +26 -0
- package/lib/index.js.map +1 -0
- package/lib/internal-types.d.ts +27 -0
- package/lib/internal-types.js +3 -0
- package/lib/internal-types.js.map +1 -0
- package/lib/logging/mcp-tool-call-log-retention.service.d.ts +8 -0
- package/lib/logging/mcp-tool-call-log-retention.service.js +54 -0
- package/lib/logging/mcp-tool-call-log-retention.service.js.map +1 -0
- package/lib/logging/mcp-tool-call-log.service.d.ts +24 -0
- package/lib/logging/mcp-tool-call-log.service.js +128 -0
- package/lib/logging/mcp-tool-call-log.service.js.map +1 -0
- package/lib/oauth/cimd/cimd-client-resolver.service.d.ts +18 -0
- package/lib/oauth/cimd/cimd-client-resolver.service.js +109 -0
- package/lib/oauth/cimd/cimd-client-resolver.service.js.map +1 -0
- package/lib/oauth/cimd/cimd-document.d.ts +11 -0
- package/lib/oauth/cimd/cimd-document.js +66 -0
- package/lib/oauth/cimd/cimd-document.js.map +1 -0
- package/lib/oauth/cimd/cimd-fetch.d.ts +14 -0
- package/lib/oauth/cimd/cimd-fetch.js +192 -0
- package/lib/oauth/cimd/cimd-fetch.js.map +1 -0
- package/lib/oauth/cimd/cimd-url.d.ts +5 -0
- package/lib/oauth/cimd/cimd-url.js +94 -0
- package/lib/oauth/cimd/cimd-url.js.map +1 -0
- package/lib/oauth/grant-session.service.d.ts +19 -0
- package/lib/oauth/grant-session.service.js +141 -0
- package/lib/oauth/grant-session.service.js.map +1 -0
- package/lib/oauth/oauth-error.d.ts +18 -0
- package/lib/oauth/oauth-error.js +60 -0
- package/lib/oauth/oauth-error.js.map +1 -0
- package/lib/oauth/oauth-metadata.service.d.ts +34 -0
- package/lib/oauth/oauth-metadata.service.js +107 -0
- package/lib/oauth/oauth-metadata.service.js.map +1 -0
- package/lib/oauth/oauth-retention.service.d.ts +23 -0
- package/lib/oauth/oauth-retention.service.js +103 -0
- package/lib/oauth/oauth-retention.service.js.map +1 -0
- package/lib/oauth/oauth-types.d.ts +61 -0
- package/lib/oauth/oauth-types.js +32 -0
- package/lib/oauth/oauth-types.js.map +1 -0
- package/lib/oauth/oauth-utils.d.ts +20 -0
- package/lib/oauth/oauth-utils.js +111 -0
- package/lib/oauth/oauth-utils.js.map +1 -0
- package/lib/oauth/oauth.controller.d.ts +31 -0
- package/lib/oauth/oauth.controller.js +132 -0
- package/lib/oauth/oauth.controller.js.map +1 -0
- package/lib/oauth/oauth.service.d.ts +69 -0
- package/lib/oauth/oauth.service.js +650 -0
- package/lib/oauth/oauth.service.js.map +1 -0
- package/lib/oauth/token-hash.d.ts +6 -0
- package/lib/oauth/token-hash.js +21 -0
- package/lib/oauth/token-hash.js.map +1 -0
- package/lib/plugin.d.ts +54 -0
- package/lib/plugin.js +171 -0
- package/lib/plugin.js.map +1 -0
- package/lib/rate-limit/ip-bucket-key.d.ts +1 -0
- package/lib/rate-limit/ip-bucket-key.js +35 -0
- package/lib/rate-limit/ip-bucket-key.js.map +1 -0
- package/lib/rate-limit/mcp-oauth-rate-limit.guard.d.ts +20 -0
- package/lib/rate-limit/mcp-oauth-rate-limit.guard.js +63 -0
- package/lib/rate-limit/mcp-oauth-rate-limit.guard.js.map +1 -0
- package/lib/rate-limit/mcp-rate-limiter.service.d.ts +47 -0
- package/lib/rate-limit/mcp-rate-limiter.service.js +248 -0
- package/lib/rate-limit/mcp-rate-limiter.service.js.map +1 -0
- package/lib/registry/bm25.d.ts +12 -0
- package/lib/registry/bm25.js +60 -0
- package/lib/registry/bm25.js.map +1 -0
- package/lib/registry/mcp-tool-execution.service.d.ts +45 -0
- package/lib/registry/mcp-tool-execution.service.js +72 -0
- package/lib/registry/mcp-tool-execution.service.js.map +1 -0
- package/lib/registry/mcp-tool-registry.service.d.ts +89 -0
- package/lib/registry/mcp-tool-registry.service.js +668 -0
- package/lib/registry/mcp-tool-registry.service.js.map +1 -0
- package/lib/registry/mcp-tool-schema.service.d.ts +42 -0
- package/lib/registry/mcp-tool-schema.service.js +229 -0
- package/lib/registry/mcp-tool-schema.service.js.map +1 -0
- package/lib/registry/registry-types.d.ts +32 -0
- package/lib/registry/registry-types.js +3 -0
- package/lib/registry/registry-types.js.map +1 -0
- package/lib/resolve-options.d.ts +7 -0
- package/lib/resolve-options.js +85 -0
- package/lib/resolve-options.js.map +1 -0
- package/lib/shared/endpoint-paths.d.ts +8 -0
- package/lib/shared/endpoint-paths.js +12 -0
- package/lib/shared/endpoint-paths.js.map +1 -0
- package/lib/shared/loopback.d.ts +2 -0
- package/lib/shared/loopback.js +9 -0
- package/lib/shared/loopback.js.map +1 -0
- package/lib/shop-session/mcp-shop-session.service.d.ts +47 -0
- package/lib/shop-session/mcp-shop-session.service.js +132 -0
- package/lib/shop-session/mcp-shop-session.service.js.map +1 -0
- package/lib/tasks/mcp-oauth-retention.task.d.ts +9 -0
- package/lib/tasks/mcp-oauth-retention.task.js +21 -0
- package/lib/tasks/mcp-oauth-retention.task.js.map +1 -0
- package/lib/tasks/mcp-tool-call-log-retention.task.d.ts +7 -0
- package/lib/tasks/mcp-tool-call-log-retention.task.js +22 -0
- package/lib/tasks/mcp-tool-call-log-retention.task.js.map +1 -0
- package/lib/tools/built-in/active-order.service.d.ts +26 -0
- package/lib/tools/built-in/active-order.service.js +125 -0
- package/lib/tools/built-in/active-order.service.js.map +1 -0
- package/lib/tools/built-in/admin/add-customer-to-group.tool.d.ts +23 -0
- package/lib/tools/built-in/admin/add-customer-to-group.tool.js +68 -0
- package/lib/tools/built-in/admin/add-customer-to-group.tool.js.map +1 -0
- package/lib/tools/built-in/admin/add-note-to-order.tool.d.ts +104 -0
- package/lib/tools/built-in/admin/add-note-to-order.tool.js +66 -0
- package/lib/tools/built-in/admin/add-note-to-order.tool.js.map +1 -0
- package/lib/tools/built-in/admin/adjust-stock.tool.d.ts +26 -0
- package/lib/tools/built-in/admin/adjust-stock.tool.js +88 -0
- package/lib/tools/built-in/admin/adjust-stock.tool.js.map +1 -0
- package/lib/tools/built-in/admin/cancel-order.tool.d.ts +17 -0
- package/lib/tools/built-in/admin/cancel-order.tool.js +60 -0
- package/lib/tools/built-in/admin/cancel-order.tool.js.map +1 -0
- package/lib/tools/built-in/admin/channel-access.d.ts +2 -0
- package/lib/tools/built-in/admin/channel-access.js +9 -0
- package/lib/tools/built-in/admin/channel-access.js.map +1 -0
- package/lib/tools/built-in/admin/create-customer.tool.d.ts +41 -0
- package/lib/tools/built-in/admin/create-customer.tool.js +57 -0
- package/lib/tools/built-in/admin/create-customer.tool.js.map +1 -0
- package/lib/tools/built-in/admin/create-fulfillment.tool.d.ts +118 -0
- package/lib/tools/built-in/admin/create-fulfillment.tool.js +156 -0
- package/lib/tools/built-in/admin/create-fulfillment.tool.js.map +1 -0
- package/lib/tools/built-in/admin/create-product.tool.d.ts +52 -0
- package/lib/tools/built-in/admin/create-product.tool.js +61 -0
- package/lib/tools/built-in/admin/create-product.tool.js.map +1 -0
- package/lib/tools/built-in/admin/create-variant.tool.d.ts +48 -0
- package/lib/tools/built-in/admin/create-variant.tool.js +79 -0
- package/lib/tools/built-in/admin/create-variant.tool.js.map +1 -0
- package/lib/tools/built-in/admin/entity-field-schemas.d.ts +36 -0
- package/lib/tools/built-in/admin/entity-field-schemas.js +63 -0
- package/lib/tools/built-in/admin/entity-field-schemas.js.map +1 -0
- package/lib/tools/built-in/admin/get-customer.tool.d.ts +28 -0
- package/lib/tools/built-in/admin/get-customer.tool.js +55 -0
- package/lib/tools/built-in/admin/get-customer.tool.js.map +1 -0
- package/lib/tools/built-in/admin/get-order.tool.d.ts +100 -0
- package/lib/tools/built-in/admin/get-order.tool.js +68 -0
- package/lib/tools/built-in/admin/get-order.tool.js.map +1 -0
- package/lib/tools/built-in/admin/get-product.tool.d.ts +69 -0
- package/lib/tools/built-in/admin/get-product.tool.js +77 -0
- package/lib/tools/built-in/admin/get-product.tool.js.map +1 -0
- package/lib/tools/built-in/admin/get-stock-levels.tool.d.ts +23 -0
- package/lib/tools/built-in/admin/get-stock-levels.tool.js +61 -0
- package/lib/tools/built-in/admin/get-stock-levels.tool.js.map +1 -0
- package/lib/tools/built-in/admin/index.d.ts +25 -0
- package/lib/tools/built-in/admin/index.js +54 -0
- package/lib/tools/built-in/admin/index.js.map +1 -0
- package/lib/tools/built-in/admin/list-channels.tool.d.ts +24 -0
- package/lib/tools/built-in/admin/list-channels.tool.js +56 -0
- package/lib/tools/built-in/admin/list-channels.tool.js.map +1 -0
- package/lib/tools/built-in/admin/list-customer-groups.tool.d.ts +23 -0
- package/lib/tools/built-in/admin/list-customer-groups.tool.js +52 -0
- package/lib/tools/built-in/admin/list-customer-groups.tool.js.map +1 -0
- package/lib/tools/built-in/admin/list-customers.tool.d.ts +62 -0
- package/lib/tools/built-in/admin/list-customers.tool.js +66 -0
- package/lib/tools/built-in/admin/list-customers.tool.js.map +1 -0
- package/lib/tools/built-in/admin/list-orders.tool.d.ts +142 -0
- package/lib/tools/built-in/admin/list-orders.tool.js +87 -0
- package/lib/tools/built-in/admin/list-orders.tool.js.map +1 -0
- package/lib/tools/built-in/admin/list-products.tool.d.ts +63 -0
- package/lib/tools/built-in/admin/list-products.tool.js +71 -0
- package/lib/tools/built-in/admin/list-products.tool.js.map +1 -0
- package/lib/tools/built-in/admin/refund-order.tool.d.ts +38 -0
- package/lib/tools/built-in/admin/refund-order.tool.js +115 -0
- package/lib/tools/built-in/admin/refund-order.tool.js.map +1 -0
- package/lib/tools/built-in/admin/set-active-channel.tool.d.ts +22 -0
- package/lib/tools/built-in/admin/set-active-channel.tool.js +84 -0
- package/lib/tools/built-in/admin/set-active-channel.tool.js.map +1 -0
- package/lib/tools/built-in/admin/translation-schemas.d.ts +12 -0
- package/lib/tools/built-in/admin/translation-schemas.js +17 -0
- package/lib/tools/built-in/admin/translation-schemas.js.map +1 -0
- package/lib/tools/built-in/admin/update-customer.tool.d.ts +42 -0
- package/lib/tools/built-in/admin/update-customer.tool.js +59 -0
- package/lib/tools/built-in/admin/update-customer.tool.js.map +1 -0
- package/lib/tools/built-in/admin/update-order-state.tool.d.ts +16 -0
- package/lib/tools/built-in/admin/update-order-state.tool.js +58 -0
- package/lib/tools/built-in/admin/update-order-state.tool.js.map +1 -0
- package/lib/tools/built-in/admin/update-product.tool.d.ts +53 -0
- package/lib/tools/built-in/admin/update-product.tool.js +68 -0
- package/lib/tools/built-in/admin/update-product.tool.js.map +1 -0
- package/lib/tools/built-in/admin/update-variant.tool.d.ts +46 -0
- package/lib/tools/built-in/admin/update-variant.tool.js +77 -0
- package/lib/tools/built-in/admin/update-variant.tool.js.map +1 -0
- package/lib/tools/built-in/admin/upload-asset.tool.d.ts +32 -0
- package/lib/tools/built-in/admin/upload-asset.tool.js +56 -0
- package/lib/tools/built-in/admin/upload-asset.tool.js.map +1 -0
- package/lib/tools/built-in/catalog-query.service.d.ts +21 -0
- package/lib/tools/built-in/catalog-query.service.js +128 -0
- package/lib/tools/built-in/catalog-query.service.js.map +1 -0
- package/lib/tools/built-in/custom-field-input.service.d.ts +10 -0
- package/lib/tools/built-in/custom-field-input.service.js +64 -0
- package/lib/tools/built-in/custom-field-input.service.js.map +1 -0
- package/lib/tools/built-in/email-schema.d.ts +2 -0
- package/lib/tools/built-in/email-schema.js +12 -0
- package/lib/tools/built-in/email-schema.js.map +1 -0
- package/lib/tools/built-in/id-schema.d.ts +3 -0
- package/lib/tools/built-in/id-schema.js +11 -0
- package/lib/tools/built-in/id-schema.js.map +1 -0
- package/lib/tools/built-in/int32-schema.d.ts +4 -0
- package/lib/tools/built-in/int32-schema.js +8 -0
- package/lib/tools/built-in/int32-schema.js.map +1 -0
- package/lib/tools/built-in/list-helpers.d.ts +48 -0
- package/lib/tools/built-in/list-helpers.js +76 -0
- package/lib/tools/built-in/list-helpers.js.map +1 -0
- package/lib/tools/built-in/order-list-helpers.d.ts +20 -0
- package/lib/tools/built-in/order-list-helpers.js +48 -0
- package/lib/tools/built-in/order-list-helpers.js.map +1 -0
- package/lib/tools/built-in/providers.d.ts +2 -0
- package/lib/tools/built-in/providers.js +7 -0
- package/lib/tools/built-in/providers.js.map +1 -0
- package/lib/tools/built-in/remote-asset.d.ts +4 -0
- package/lib/tools/built-in/remote-asset.js +54 -0
- package/lib/tools/built-in/remote-asset.js.map +1 -0
- package/lib/tools/built-in/serializer.service.d.ts +327 -0
- package/lib/tools/built-in/serializer.service.js +413 -0
- package/lib/tools/built-in/serializer.service.js.map +1 -0
- package/lib/tools/built-in/shop/add-to-cart.tool.d.ts +21 -0
- package/lib/tools/built-in/shop/add-to-cart.tool.js +100 -0
- package/lib/tools/built-in/shop/add-to-cart.tool.js.map +1 -0
- package/lib/tools/built-in/shop/address-schema.d.ts +15 -0
- package/lib/tools/built-in/shop/address-schema.js +20 -0
- package/lib/tools/built-in/shop/address-schema.js.map +1 -0
- package/lib/tools/built-in/shop/apply-coupon-code.tool.d.ts +17 -0
- package/lib/tools/built-in/shop/apply-coupon-code.tool.js +62 -0
- package/lib/tools/built-in/shop/apply-coupon-code.tool.js.map +1 -0
- package/lib/tools/built-in/shop/collection-lookup.d.ts +15 -0
- package/lib/tools/built-in/shop/collection-lookup.js +35 -0
- package/lib/tools/built-in/shop/collection-lookup.js.map +1 -0
- package/lib/tools/built-in/shop/get-cart.tool.d.ts +94 -0
- package/lib/tools/built-in/shop/get-cart.tool.js +55 -0
- package/lib/tools/built-in/shop/get-cart.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-collection.tool.d.ts +42 -0
- package/lib/tools/built-in/shop/get-collection.tool.js +64 -0
- package/lib/tools/built-in/shop/get-collection.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-eligible-payment-methods.tool.d.ts +26 -0
- package/lib/tools/built-in/shop/get-eligible-payment-methods.tool.js +58 -0
- package/lib/tools/built-in/shop/get-eligible-payment-methods.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-eligible-shipping-methods.tool.d.ts +30 -0
- package/lib/tools/built-in/shop/get-eligible-shipping-methods.tool.js +59 -0
- package/lib/tools/built-in/shop/get-eligible-shipping-methods.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-my-account.tool.d.ts +22 -0
- package/lib/tools/built-in/shop/get-my-account.tool.js +57 -0
- package/lib/tools/built-in/shop/get-my-account.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-order.tool.d.ts +100 -0
- package/lib/tools/built-in/shop/get-order.tool.js +67 -0
- package/lib/tools/built-in/shop/get-order.tool.js.map +1 -0
- package/lib/tools/built-in/shop/get-product.tool.d.ts +57 -0
- package/lib/tools/built-in/shop/get-product.tool.js +81 -0
- package/lib/tools/built-in/shop/get-product.tool.js.map +1 -0
- package/lib/tools/built-in/shop/index.d.ts +19 -0
- package/lib/tools/built-in/shop/index.js +42 -0
- package/lib/tools/built-in/shop/index.js.map +1 -0
- package/lib/tools/built-in/shop/list-collections.tool.d.ts +42 -0
- package/lib/tools/built-in/shop/list-collections.tool.js +75 -0
- package/lib/tools/built-in/shop/list-collections.tool.js.map +1 -0
- package/lib/tools/built-in/shop/list-my-orders.tool.d.ts +100 -0
- package/lib/tools/built-in/shop/list-my-orders.tool.js +63 -0
- package/lib/tools/built-in/shop/list-my-orders.tool.js.map +1 -0
- package/lib/tools/built-in/shop/place-order.tool.d.ts +188 -0
- package/lib/tools/built-in/shop/place-order.tool.js +152 -0
- package/lib/tools/built-in/shop/place-order.tool.js.map +1 -0
- package/lib/tools/built-in/shop/product-search-query.d.ts +4 -0
- package/lib/tools/built-in/shop/product-search-query.js +34 -0
- package/lib/tools/built-in/shop/product-search-query.js.map +1 -0
- package/lib/tools/built-in/shop/remove-coupon-code.tool.d.ts +17 -0
- package/lib/tools/built-in/shop/remove-coupon-code.tool.js +63 -0
- package/lib/tools/built-in/shop/remove-coupon-code.tool.js.map +1 -0
- package/lib/tools/built-in/shop/remove-from-cart.tool.d.ts +17 -0
- package/lib/tools/built-in/shop/remove-from-cart.tool.js +58 -0
- package/lib/tools/built-in/shop/remove-from-cart.tool.js.map +1 -0
- package/lib/tools/built-in/shop/search-products.tool.d.ts +48 -0
- package/lib/tools/built-in/shop/search-products.tool.js +95 -0
- package/lib/tools/built-in/shop/search-products.tool.js.map +1 -0
- package/lib/tools/built-in/shop/set-checkout-details.tool.d.ts +56 -0
- package/lib/tools/built-in/shop/set-checkout-details.tool.js +187 -0
- package/lib/tools/built-in/shop/set-checkout-details.tool.js.map +1 -0
- package/lib/tools/built-in/shop/set-shipping-method.tool.d.ts +17 -0
- package/lib/tools/built-in/shop/set-shipping-method.tool.js +58 -0
- package/lib/tools/built-in/shop/set-shipping-method.tool.js.map +1 -0
- package/lib/tools/built-in/shop/update-cart-line.tool.d.ts +18 -0
- package/lib/tools/built-in/shop/update-cart-line.tool.js +60 -0
- package/lib/tools/built-in/shop/update-cart-line.tool.js.map +1 -0
- package/lib/tools/built-in/string-schemas.d.ts +4 -0
- package/lib/tools/built-in/string-schemas.js +13 -0
- package/lib/tools/built-in/string-schemas.js.map +1 -0
- package/lib/transport/mcp-server.factory.d.ts +13 -0
- package/lib/transport/mcp-server.factory.js +32 -0
- package/lib/transport/mcp-server.factory.js.map +1 -0
- package/lib/transport/mcp-transport.controller.d.ts +77 -0
- package/lib/transport/mcp-transport.controller.js +442 -0
- package/lib/transport/mcp-transport.controller.js.map +1 -0
- package/lib/types.d.ts +432 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/package.json +42 -0
- package/src/dashboard/components/activity-block.tsx +72 -0
- package/src/dashboard/components/actor-cell.tsx +31 -0
- package/src/dashboard/components/connection-dialog.tsx +106 -0
- package/src/dashboard/components/empty-cell.tsx +7 -0
- package/src/dashboard/components/grants-block.tsx +218 -0
- package/src/dashboard/components/stats-block.tsx +275 -0
- package/src/dashboard/components/tools-block.tsx +274 -0
- package/src/dashboard/components/tooltip-button.tsx +28 -0
- package/src/dashboard/components/use-mcp-table-state.ts +47 -0
- package/src/dashboard/i18n/ar.po +311 -0
- package/src/dashboard/i18n/bg.po +311 -0
- package/src/dashboard/i18n/cs.po +311 -0
- package/src/dashboard/i18n/de.po +311 -0
- package/src/dashboard/i18n/en.po +311 -0
- package/src/dashboard/i18n/es.po +311 -0
- package/src/dashboard/i18n/fa.po +311 -0
- package/src/dashboard/i18n/fr.po +311 -0
- package/src/dashboard/i18n/he.po +311 -0
- package/src/dashboard/i18n/hr.po +311 -0
- package/src/dashboard/i18n/hu.po +311 -0
- package/src/dashboard/i18n/it.po +311 -0
- package/src/dashboard/i18n/ja.po +311 -0
- package/src/dashboard/i18n/ko.po +311 -0
- package/src/dashboard/i18n/nb.po +311 -0
- package/src/dashboard/i18n/ne.po +311 -0
- package/src/dashboard/i18n/nl.po +311 -0
- package/src/dashboard/i18n/pl.po +311 -0
- package/src/dashboard/i18n/pt_BR.po +311 -0
- package/src/dashboard/i18n/pt_PT.po +311 -0
- package/src/dashboard/i18n/ro.po +311 -0
- package/src/dashboard/i18n/ru.po +311 -0
- package/src/dashboard/i18n/sv.po +311 -0
- package/src/dashboard/i18n/tr.po +311 -0
- package/src/dashboard/i18n/uk.po +311 -0
- package/src/dashboard/i18n/uz.po +311 -0
- package/src/dashboard/i18n/zh_Hans.po +311 -0
- package/src/dashboard/i18n/zh_Hant.po +311 -0
- package/src/dashboard/index.tsx +30 -0
- package/src/dashboard/mcp-activity-route.tsx +38 -0
- package/src/dashboard/mcp-authorize-route.tsx +369 -0
- package/src/dashboard/mcp-grants-route.tsx +38 -0
- package/src/dashboard/mcp-overview-route.tsx +46 -0
- package/src/dashboard/mcp-server-redirect-route.tsx +15 -0
- package/src/dashboard/mcp-tools-route.tsx +38 -0
- package/src/dashboard/mcp.graphql.ts +127 -0
- package/src/dashboard/published-files.spec.ts +54 -0
- package/src/dashboard/tsconfig.json +9 -0
- package/src/shared/endpoint-paths.ts +8 -0
- package/src/shared/loopback.ts +6 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { CustomerService, OrderService, RequestContext, TranslatorService } from '@vendure/core';
|
|
2
|
+
import { McpToolHandler } from '@vendure/mcp-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { McpToolSerializerService } from '../serializer.service';
|
|
5
|
+
declare const listMyOrdersInput: z.ZodObject<{
|
|
6
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
type ListMyOrdersInput = z.infer<typeof listMyOrdersInput>;
|
|
10
|
+
export declare class ListMyOrdersTool implements McpToolHandler<ListMyOrdersInput> {
|
|
11
|
+
private readonly customerService;
|
|
12
|
+
private readonly orderService;
|
|
13
|
+
private readonly translator;
|
|
14
|
+
private readonly serializer;
|
|
15
|
+
constructor(customerService: CustomerService, orderService: OrderService, translator: TranslatorService, serializer: McpToolSerializerService);
|
|
16
|
+
execute(ctx: RequestContext, input: ListMyOrdersInput): Promise<{
|
|
17
|
+
items: ({
|
|
18
|
+
id: import("@vendure/core").ID;
|
|
19
|
+
code: string;
|
|
20
|
+
state: import("@vendure/core").OrderState;
|
|
21
|
+
active: boolean;
|
|
22
|
+
total: number;
|
|
23
|
+
totalDecimal: string;
|
|
24
|
+
totalWithTax: number;
|
|
25
|
+
totalWithTaxDecimal: string;
|
|
26
|
+
currencyCode: import("@vendure/core").CurrencyCode;
|
|
27
|
+
totalQuantity: number;
|
|
28
|
+
createdAt: string | null;
|
|
29
|
+
updatedAt: string | null;
|
|
30
|
+
orderPlacedAt: string | null;
|
|
31
|
+
couponCodes: string[];
|
|
32
|
+
discounts: {
|
|
33
|
+
adjustmentSource: string;
|
|
34
|
+
type: import("@vendure/core").AdjustmentType;
|
|
35
|
+
description: string;
|
|
36
|
+
amount: number;
|
|
37
|
+
amountDecimal: string;
|
|
38
|
+
amountWithTax: number;
|
|
39
|
+
amountWithTaxDecimal: string;
|
|
40
|
+
}[];
|
|
41
|
+
lines: {
|
|
42
|
+
id: import("@vendure/core").ID;
|
|
43
|
+
quantity: number;
|
|
44
|
+
linePriceWithTax: number;
|
|
45
|
+
linePriceWithTaxDecimal: string;
|
|
46
|
+
productVariant: {
|
|
47
|
+
id: import("@vendure/core").ID;
|
|
48
|
+
name: import("@vendure/core").LocaleString;
|
|
49
|
+
sku: string;
|
|
50
|
+
} | null;
|
|
51
|
+
}[];
|
|
52
|
+
payments: {
|
|
53
|
+
id: import("@vendure/core").ID;
|
|
54
|
+
method: string;
|
|
55
|
+
amount: number;
|
|
56
|
+
amountDecimal: string;
|
|
57
|
+
state: import("@vendure/core").PaymentState;
|
|
58
|
+
transactionId: string;
|
|
59
|
+
errorMessage: string | undefined;
|
|
60
|
+
publicMetadata: any;
|
|
61
|
+
refunds: {
|
|
62
|
+
id: import("@vendure/core").ID;
|
|
63
|
+
state: import("@vendure/core").RefundState;
|
|
64
|
+
total: number;
|
|
65
|
+
totalDecimal: string;
|
|
66
|
+
reason: string;
|
|
67
|
+
}[];
|
|
68
|
+
}[] | undefined;
|
|
69
|
+
fulfillments: {
|
|
70
|
+
id: import("@vendure/core").ID;
|
|
71
|
+
state: import("@vendure/core").FulfillmentState;
|
|
72
|
+
method: string;
|
|
73
|
+
trackingCode: string;
|
|
74
|
+
lines: {
|
|
75
|
+
orderLineId: import("@vendure/core").ID;
|
|
76
|
+
quantity: number;
|
|
77
|
+
}[];
|
|
78
|
+
}[] | undefined;
|
|
79
|
+
customer: {
|
|
80
|
+
id: import("@vendure/core").ID;
|
|
81
|
+
emailAddress: string;
|
|
82
|
+
firstName: string;
|
|
83
|
+
lastName: string;
|
|
84
|
+
} | null | undefined;
|
|
85
|
+
shippingAddress: Record<string, string> | null;
|
|
86
|
+
billingAddress: Record<string, string> | null;
|
|
87
|
+
shippingWithTax: number;
|
|
88
|
+
shippingWithTaxDecimal: string;
|
|
89
|
+
shippingLines: {
|
|
90
|
+
id: import("@vendure/core").ID;
|
|
91
|
+
shippingMethodId: import("@vendure/core").ID | null;
|
|
92
|
+
priceWithTax: number;
|
|
93
|
+
priceWithTaxDecimal: string;
|
|
94
|
+
}[] | undefined;
|
|
95
|
+
} | null)[];
|
|
96
|
+
total: number;
|
|
97
|
+
hasMore: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
}
|
|
100
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ListMyOrdersTool = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const core_1 = require("@vendure/core");
|
|
15
|
+
const mcp_sdk_1 = require("@vendure/mcp-sdk");
|
|
16
|
+
const zod_1 = require("zod");
|
|
17
|
+
const list_helpers_1 = require("../list-helpers");
|
|
18
|
+
const order_list_helpers_1 = require("../order-list-helpers");
|
|
19
|
+
const serializer_service_1 = require("../serializer.service");
|
|
20
|
+
const listMyOrdersInput = zod_1.z.strictObject(Object.assign({}, (0, list_helpers_1.paginationFields)('orders')));
|
|
21
|
+
let ListMyOrdersTool = class ListMyOrdersTool {
|
|
22
|
+
constructor(customerService, orderService, translator, serializer) {
|
|
23
|
+
this.customerService = customerService;
|
|
24
|
+
this.orderService = orderService;
|
|
25
|
+
this.translator = translator;
|
|
26
|
+
this.serializer = serializer;
|
|
27
|
+
}
|
|
28
|
+
async execute(ctx, input) {
|
|
29
|
+
if (!ctx.activeUserId)
|
|
30
|
+
return (0, list_helpers_1.page)([], 0, input);
|
|
31
|
+
const customer = await this.customerService.findOneByUserId(ctx, ctx.activeUserId);
|
|
32
|
+
if (!customer)
|
|
33
|
+
return (0, list_helpers_1.page)([], 0, input);
|
|
34
|
+
const result = await this.orderService.findByCustomerId(ctx, customer.id, (0, order_list_helpers_1.orderListOptions)(input, 'createdAt'), order_list_helpers_1.ORDER_LIST_RELATIONS);
|
|
35
|
+
(0, order_list_helpers_1.translateLineVariants)(result.items, this.translator, ctx);
|
|
36
|
+
return (0, list_helpers_1.page)(result.items.map(order => this.serializer.order(order)), result.totalItems, input);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.ListMyOrdersTool = ListMyOrdersTool;
|
|
40
|
+
exports.ListMyOrdersTool = ListMyOrdersTool = __decorate([
|
|
41
|
+
(0, mcp_sdk_1.McpTool)({
|
|
42
|
+
name: 'list_my_orders',
|
|
43
|
+
toolset: 'shop',
|
|
44
|
+
description: 'List orders belonging to the authenticated customer, newest first.',
|
|
45
|
+
keywords: [
|
|
46
|
+
'my order history',
|
|
47
|
+
'my past purchases',
|
|
48
|
+
"everything I've ordered",
|
|
49
|
+
'show my previous orders',
|
|
50
|
+
'what have I bought before',
|
|
51
|
+
'my buying history',
|
|
52
|
+
],
|
|
53
|
+
permissions: [core_1.Permission.Authenticated],
|
|
54
|
+
behavior: 'readonly',
|
|
55
|
+
inputSchema: listMyOrdersInput,
|
|
56
|
+
}),
|
|
57
|
+
(0, common_1.Injectable)(),
|
|
58
|
+
__metadata("design:paramtypes", [core_1.CustomerService,
|
|
59
|
+
core_1.OrderService,
|
|
60
|
+
core_1.TranslatorService,
|
|
61
|
+
serializer_service_1.McpToolSerializerService])
|
|
62
|
+
], ListMyOrdersTool);
|
|
63
|
+
//# sourceMappingURL=list-my-orders.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-my-orders.tool.js","sourceRoot":"","sources":["../../../../src/tools/built-in/shop/list-my-orders.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wCAA6G;AAC7G,8CAA2D;AAC3D,6BAAwB;AAExB,kDAAyD;AACzD,8DAAsG;AACtG,8DAAiE;AAEjE,MAAM,iBAAiB,GAAG,OAAC,CAAC,YAAY,mBACjC,IAAA,+BAAgB,EAAC,QAAQ,CAAC,EAC/B,CAAC;AAqBI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IACzB,YACqB,eAAgC,EAChC,YAA0B,EAC1B,UAA6B,EAC7B,UAAoC;QAHpC,oBAAe,GAAf,eAAe,CAAiB;QAChC,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAAmB;QAC7B,eAAU,GAAV,UAAU,CAA0B;IACtD,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,GAAmB,EAAE,KAAwB;QACvD,IAAI,CAAC,GAAG,CAAC,YAAY;YAAE,OAAO,IAAA,mBAAI,EAAC,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QACjD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;QACnF,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAA,mBAAI,EAAC,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,gBAAgB,CACnD,GAAG,EACH,QAAQ,CAAC,EAAE,EACX,IAAA,qCAAgB,EAAC,KAAK,EAAE,WAAW,CAAC,EACpC,yCAAoB,CACvB,CAAC;QACF,IAAA,0CAAqB,EAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAC1D,OAAO,IAAA,mBAAI,EACP,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EACvD,MAAM,CAAC,UAAU,EACjB,KAAK,CACR,CAAC;IACN,CAAC;CACJ,CAAA;AAzBY,4CAAgB;2BAAhB,gBAAgB;IAjB5B,IAAA,iBAAO,EAAC;QACL,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,MAAM;QACf,WAAW,EAAE,oEAAoE;QACjF,QAAQ,EAAE;YACN,kBAAkB;YAClB,mBAAmB;YACnB,yBAAyB;YACzB,yBAAyB;YACzB,2BAA2B;YAC3B,mBAAmB;SACtB;QACD,WAAW,EAAE,CAAC,iBAAU,CAAC,aAAa,CAAC;QACvC,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,iBAAiB;KACjC,CAAC;IACD,IAAA,mBAAU,GAAE;qCAG6B,sBAAe;QAClB,mBAAY;QACd,wBAAiB;QACjB,6CAAwB;GALhD,gBAAgB,CAyB5B"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { CustomerService, ID, OrderService, RequestContext, SessionService, TransactionalConnection } from '@vendure/core';
|
|
2
|
+
import { McpToolHandler } from '@vendure/mcp-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { McpActiveOrderService } from '../active-order.service';
|
|
5
|
+
import { McpToolSerializerService } from '../serializer.service';
|
|
6
|
+
declare const placeOrderInput: z.ZodObject<{
|
|
7
|
+
paymentMethodCode: z.ZodString;
|
|
8
|
+
paymentMetadata: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
type PlaceOrderInput = z.infer<typeof placeOrderInput>;
|
|
11
|
+
export declare class PlaceOrderTool implements McpToolHandler<PlaceOrderInput> {
|
|
12
|
+
private readonly activeOrder;
|
|
13
|
+
private readonly orderService;
|
|
14
|
+
private readonly serializer;
|
|
15
|
+
private readonly connection;
|
|
16
|
+
private readonly customerService;
|
|
17
|
+
private readonly sessionService;
|
|
18
|
+
constructor(activeOrder: McpActiveOrderService, orderService: OrderService, serializer: McpToolSerializerService, connection: TransactionalConnection, customerService: CustomerService, sessionService: SessionService);
|
|
19
|
+
execute(ctx: RequestContext, input: PlaceOrderInput): Promise<Record<string, unknown> | {
|
|
20
|
+
status: "placed";
|
|
21
|
+
order: {
|
|
22
|
+
id: ID;
|
|
23
|
+
code: string;
|
|
24
|
+
state: import("@vendure/core").OrderState;
|
|
25
|
+
active: boolean;
|
|
26
|
+
total: number;
|
|
27
|
+
totalDecimal: string;
|
|
28
|
+
totalWithTax: number;
|
|
29
|
+
totalWithTaxDecimal: string;
|
|
30
|
+
currencyCode: import("@vendure/core").CurrencyCode;
|
|
31
|
+
totalQuantity: number;
|
|
32
|
+
createdAt: string | null;
|
|
33
|
+
updatedAt: string | null;
|
|
34
|
+
orderPlacedAt: string | null;
|
|
35
|
+
couponCodes: string[];
|
|
36
|
+
discounts: {
|
|
37
|
+
adjustmentSource: string;
|
|
38
|
+
type: import("@vendure/core").AdjustmentType;
|
|
39
|
+
description: string;
|
|
40
|
+
amount: number;
|
|
41
|
+
amountDecimal: string;
|
|
42
|
+
amountWithTax: number;
|
|
43
|
+
amountWithTaxDecimal: string;
|
|
44
|
+
}[];
|
|
45
|
+
lines: {
|
|
46
|
+
id: ID;
|
|
47
|
+
quantity: number;
|
|
48
|
+
linePriceWithTax: number;
|
|
49
|
+
linePriceWithTaxDecimal: string;
|
|
50
|
+
productVariant: {
|
|
51
|
+
id: ID;
|
|
52
|
+
name: import("@vendure/core").LocaleString;
|
|
53
|
+
sku: string;
|
|
54
|
+
} | null;
|
|
55
|
+
}[];
|
|
56
|
+
payments: {
|
|
57
|
+
id: ID;
|
|
58
|
+
method: string;
|
|
59
|
+
amount: number;
|
|
60
|
+
amountDecimal: string;
|
|
61
|
+
state: import("@vendure/core").PaymentState;
|
|
62
|
+
transactionId: string;
|
|
63
|
+
errorMessage: string | undefined;
|
|
64
|
+
publicMetadata: any;
|
|
65
|
+
refunds: {
|
|
66
|
+
id: ID;
|
|
67
|
+
state: import("@vendure/core").RefundState;
|
|
68
|
+
total: number;
|
|
69
|
+
totalDecimal: string;
|
|
70
|
+
reason: string;
|
|
71
|
+
}[];
|
|
72
|
+
}[] | undefined;
|
|
73
|
+
fulfillments: {
|
|
74
|
+
id: ID;
|
|
75
|
+
state: import("@vendure/core").FulfillmentState;
|
|
76
|
+
method: string;
|
|
77
|
+
trackingCode: string;
|
|
78
|
+
lines: {
|
|
79
|
+
orderLineId: ID;
|
|
80
|
+
quantity: number;
|
|
81
|
+
}[];
|
|
82
|
+
}[] | undefined;
|
|
83
|
+
customer: {
|
|
84
|
+
id: ID;
|
|
85
|
+
emailAddress: string;
|
|
86
|
+
firstName: string;
|
|
87
|
+
lastName: string;
|
|
88
|
+
} | null | undefined;
|
|
89
|
+
shippingAddress: Record<string, string> | null;
|
|
90
|
+
billingAddress: Record<string, string> | null;
|
|
91
|
+
shippingWithTax: number;
|
|
92
|
+
shippingWithTaxDecimal: string;
|
|
93
|
+
shippingLines: {
|
|
94
|
+
id: ID;
|
|
95
|
+
shippingMethodId: ID | null;
|
|
96
|
+
priceWithTax: number;
|
|
97
|
+
priceWithTaxDecimal: string;
|
|
98
|
+
}[] | undefined;
|
|
99
|
+
} | null;
|
|
100
|
+
message?: undefined;
|
|
101
|
+
} | {
|
|
102
|
+
status: "awaiting_payment";
|
|
103
|
+
order: {
|
|
104
|
+
id: ID;
|
|
105
|
+
code: string;
|
|
106
|
+
state: import("@vendure/core").OrderState;
|
|
107
|
+
active: boolean;
|
|
108
|
+
total: number;
|
|
109
|
+
totalDecimal: string;
|
|
110
|
+
totalWithTax: number;
|
|
111
|
+
totalWithTaxDecimal: string;
|
|
112
|
+
currencyCode: import("@vendure/core").CurrencyCode;
|
|
113
|
+
totalQuantity: number;
|
|
114
|
+
createdAt: string | null;
|
|
115
|
+
updatedAt: string | null;
|
|
116
|
+
orderPlacedAt: string | null;
|
|
117
|
+
couponCodes: string[];
|
|
118
|
+
discounts: {
|
|
119
|
+
adjustmentSource: string;
|
|
120
|
+
type: import("@vendure/core").AdjustmentType;
|
|
121
|
+
description: string;
|
|
122
|
+
amount: number;
|
|
123
|
+
amountDecimal: string;
|
|
124
|
+
amountWithTax: number;
|
|
125
|
+
amountWithTaxDecimal: string;
|
|
126
|
+
}[];
|
|
127
|
+
lines: {
|
|
128
|
+
id: ID;
|
|
129
|
+
quantity: number;
|
|
130
|
+
linePriceWithTax: number;
|
|
131
|
+
linePriceWithTaxDecimal: string;
|
|
132
|
+
productVariant: {
|
|
133
|
+
id: ID;
|
|
134
|
+
name: import("@vendure/core").LocaleString;
|
|
135
|
+
sku: string;
|
|
136
|
+
} | null;
|
|
137
|
+
}[];
|
|
138
|
+
payments: {
|
|
139
|
+
id: ID;
|
|
140
|
+
method: string;
|
|
141
|
+
amount: number;
|
|
142
|
+
amountDecimal: string;
|
|
143
|
+
state: import("@vendure/core").PaymentState;
|
|
144
|
+
transactionId: string;
|
|
145
|
+
errorMessage: string | undefined;
|
|
146
|
+
publicMetadata: any;
|
|
147
|
+
refunds: {
|
|
148
|
+
id: ID;
|
|
149
|
+
state: import("@vendure/core").RefundState;
|
|
150
|
+
total: number;
|
|
151
|
+
totalDecimal: string;
|
|
152
|
+
reason: string;
|
|
153
|
+
}[];
|
|
154
|
+
}[] | undefined;
|
|
155
|
+
fulfillments: {
|
|
156
|
+
id: ID;
|
|
157
|
+
state: import("@vendure/core").FulfillmentState;
|
|
158
|
+
method: string;
|
|
159
|
+
trackingCode: string;
|
|
160
|
+
lines: {
|
|
161
|
+
orderLineId: ID;
|
|
162
|
+
quantity: number;
|
|
163
|
+
}[];
|
|
164
|
+
}[] | undefined;
|
|
165
|
+
customer: {
|
|
166
|
+
id: ID;
|
|
167
|
+
emailAddress: string;
|
|
168
|
+
firstName: string;
|
|
169
|
+
lastName: string;
|
|
170
|
+
} | null | undefined;
|
|
171
|
+
shippingAddress: Record<string, string> | null;
|
|
172
|
+
billingAddress: Record<string, string> | null;
|
|
173
|
+
shippingWithTax: number;
|
|
174
|
+
shippingWithTaxDecimal: string;
|
|
175
|
+
shippingLines: {
|
|
176
|
+
id: ID;
|
|
177
|
+
shippingMethodId: ID | null;
|
|
178
|
+
priceWithTax: number;
|
|
179
|
+
priceWithTaxDecimal: string;
|
|
180
|
+
}[] | undefined;
|
|
181
|
+
} | null;
|
|
182
|
+
message: string;
|
|
183
|
+
}>;
|
|
184
|
+
private startArrangingPayment;
|
|
185
|
+
private takePayment;
|
|
186
|
+
private describeOutcome;
|
|
187
|
+
}
|
|
188
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PlaceOrderTool = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const core_1 = require("@vendure/core");
|
|
15
|
+
const mcp_sdk_1 = require("@vendure/mcp-sdk");
|
|
16
|
+
const zod_1 = require("zod");
|
|
17
|
+
const constants_1 = require("../../../constants");
|
|
18
|
+
const active_order_service_1 = require("../active-order.service");
|
|
19
|
+
const serializer_service_1 = require("../serializer.service");
|
|
20
|
+
const string_schemas_1 = require("../string-schemas");
|
|
21
|
+
const placeOrderInput = zod_1.z.strictObject({
|
|
22
|
+
paymentMethodCode: string_schemas_1.shortText.describe('Payment method code.'),
|
|
23
|
+
paymentMetadata: zod_1.z.looseObject({}).describe('Metadata passed to the payment handler.').optional(),
|
|
24
|
+
});
|
|
25
|
+
// These carry a message the caller can act on (e.g. a bad payment method or an expired cart),
|
|
26
|
+
// so they're passed on unchanged instead of being replaced with a generic error.
|
|
27
|
+
// IllegalOperationError is left out because `addPaymentToOrder` only throws it from a state
|
|
28
|
+
// change that runs after the payment provider was called.
|
|
29
|
+
const CALLER_SAFE_ERRORS = [core_1.UserInputError, core_1.EntityNotFoundError, core_1.ForbiddenError, core_1.UnauthorizedError];
|
|
30
|
+
let PlaceOrderTool = class PlaceOrderTool {
|
|
31
|
+
constructor(activeOrder, orderService, serializer, connection, customerService, sessionService) {
|
|
32
|
+
this.activeOrder = activeOrder;
|
|
33
|
+
this.orderService = orderService;
|
|
34
|
+
this.serializer = serializer;
|
|
35
|
+
this.connection = connection;
|
|
36
|
+
this.customerService = customerService;
|
|
37
|
+
this.sessionService = sessionService;
|
|
38
|
+
}
|
|
39
|
+
async execute(ctx, input) {
|
|
40
|
+
const order = await this.activeOrder.findOrThrow(ctx);
|
|
41
|
+
// Taking a payment has to run inside a database transaction: `addPaymentToOrder` refuses to
|
|
42
|
+
// run without one.
|
|
43
|
+
return this.connection.withTransaction(order.ctx, async (txCtx) => {
|
|
44
|
+
const current = await this.orderService.findOne(txCtx, order.id);
|
|
45
|
+
if (!current) {
|
|
46
|
+
// The cart was there a moment ago, so only a concurrent deletion gets here.
|
|
47
|
+
throw new core_1.EntityNotFoundError('Order', order.id);
|
|
48
|
+
}
|
|
49
|
+
const arranging = await this.startArrangingPayment(txCtx, current);
|
|
50
|
+
if (arranging.kind === 'error') {
|
|
51
|
+
return arranging.result;
|
|
52
|
+
}
|
|
53
|
+
const result = await this.takePayment(txCtx, current, input);
|
|
54
|
+
if ((0, core_1.isGraphQlErrorResult)(result)) {
|
|
55
|
+
if (arranging.movedOutOfCart) {
|
|
56
|
+
await this.orderService.transitionToState(txCtx, order.id, 'AddingItems');
|
|
57
|
+
}
|
|
58
|
+
return this.serializer.orderOrError(result);
|
|
59
|
+
}
|
|
60
|
+
result.payments = await this.orderService.getOrderPayments(txCtx, result.id);
|
|
61
|
+
return this.describeOutcome(txCtx, order.id, result);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async startArrangingPayment(txCtx, current) {
|
|
65
|
+
if (current.state !== 'AddingItems') {
|
|
66
|
+
return { kind: 'ok', movedOutOfCart: false };
|
|
67
|
+
}
|
|
68
|
+
const transition = await this.orderService.transitionToState(txCtx, current.id, 'ArrangingPayment');
|
|
69
|
+
if ((0, core_1.isGraphQlErrorResult)(transition)) {
|
|
70
|
+
if (transition.transitionError ===
|
|
71
|
+
txCtx.translate('message.cannot-transition-to-payment-without-customer', {
|
|
72
|
+
fromState: current.state,
|
|
73
|
+
toState: 'ArrangingPayment',
|
|
74
|
+
})) {
|
|
75
|
+
throw new core_1.UserInputError('This cart has no customer yet. For a guest checkout call ' +
|
|
76
|
+
'set_checkout_details with customer { emailAddress, firstName, ' +
|
|
77
|
+
'lastName } first, or sign in as a customer.');
|
|
78
|
+
}
|
|
79
|
+
return { kind: 'error', result: this.serializer.orderOrError(transition) };
|
|
80
|
+
}
|
|
81
|
+
return { kind: 'ok', movedOutOfCart: true };
|
|
82
|
+
}
|
|
83
|
+
async takePayment(txCtx, order, input) {
|
|
84
|
+
var _a;
|
|
85
|
+
const payment = {
|
|
86
|
+
method: input.paymentMethodCode,
|
|
87
|
+
metadata: (_a = input.paymentMetadata) !== null && _a !== void 0 ? _a : {},
|
|
88
|
+
};
|
|
89
|
+
try {
|
|
90
|
+
return await this.orderService.addPaymentToOrder(txCtx, order.id, payment);
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
if (CALLER_SAFE_ERRORS.some(errorType => e instanceof errorType)) {
|
|
94
|
+
throw e;
|
|
95
|
+
}
|
|
96
|
+
// The rollback removes the Payment row but cannot undo a charge the payment provider
|
|
97
|
+
// already made, so the order code is logged for the store to match against the provider.
|
|
98
|
+
core_1.Logger.error(`place_order payment failed for order ${order.code}: ${e instanceof Error ? e.message : String(e)}`, constants_1.loggerCtx, e instanceof Error ? e.stack : undefined);
|
|
99
|
+
throw new core_1.UserInputError('Taking the payment failed and nothing was saved on the order, but the payment ' +
|
|
100
|
+
'provider may already have charged the customer. Do not retry. Tell the user to ' +
|
|
101
|
+
`contact the store about order ${order.code}.`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async describeOutcome(txCtx, orderId, result) {
|
|
105
|
+
if (result.orderPlacedAt) {
|
|
106
|
+
await this.customerService.createAddressesForNewCustomer(txCtx, result);
|
|
107
|
+
if (txCtx.session && (0, core_1.idsAreEqual)(txCtx.session.activeOrderId, orderId)) {
|
|
108
|
+
await this.sessionService.unsetActiveOrder(txCtx, txCtx.session);
|
|
109
|
+
}
|
|
110
|
+
return { status: 'placed', order: this.serializer.order(result) };
|
|
111
|
+
}
|
|
112
|
+
let message = 'Payment was created, but the order is not placed yet. Look at order.payments for ' +
|
|
113
|
+
"each payment's state and any publicMetadata with the shopper's next step.";
|
|
114
|
+
if (result.state === 'ArrangingPayment') {
|
|
115
|
+
message += ' The cart cannot be edited while the order is in ArrangingPayment.';
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
status: 'awaiting_payment',
|
|
119
|
+
order: this.serializer.order(result),
|
|
120
|
+
message,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
exports.PlaceOrderTool = PlaceOrderTool;
|
|
125
|
+
exports.PlaceOrderTool = PlaceOrderTool = __decorate([
|
|
126
|
+
(0, mcp_sdk_1.McpTool)({
|
|
127
|
+
name: 'place_order',
|
|
128
|
+
toolset: 'shop',
|
|
129
|
+
description: 'Add payment to the active cart and place the order. The store order process decides which ' +
|
|
130
|
+
'checkout details are required. Returns "placed" or "awaiting_payment" with payment details.',
|
|
131
|
+
keywords: [
|
|
132
|
+
'check out',
|
|
133
|
+
'complete my purchase',
|
|
134
|
+
'pay now',
|
|
135
|
+
'finalize and submit my order',
|
|
136
|
+
'buy everything in my basket',
|
|
137
|
+
'confirm and pay',
|
|
138
|
+
],
|
|
139
|
+
permissions: [core_1.Permission.Public],
|
|
140
|
+
behavior: 'destructive',
|
|
141
|
+
usesActiveOrder: true,
|
|
142
|
+
inputSchema: placeOrderInput,
|
|
143
|
+
}),
|
|
144
|
+
(0, common_1.Injectable)(),
|
|
145
|
+
__metadata("design:paramtypes", [active_order_service_1.McpActiveOrderService,
|
|
146
|
+
core_1.OrderService,
|
|
147
|
+
serializer_service_1.McpToolSerializerService,
|
|
148
|
+
core_1.TransactionalConnection,
|
|
149
|
+
core_1.CustomerService,
|
|
150
|
+
core_1.SessionService])
|
|
151
|
+
], PlaceOrderTool);
|
|
152
|
+
//# sourceMappingURL=place-order.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"place-order.tool.js","sourceRoot":"","sources":["../../../../src/tools/built-in/shop/place-order.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,wCAgBuB;AACvB,8CAA2D;AAC3D,6BAAwB;AAExB,kDAA+C;AAC/C,kEAAgE;AAChE,8DAAiE;AACjE,sDAA8C;AAE9C,MAAM,eAAe,GAAG,O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iBAAU,CAAC,MAAM,CAAC;QAChC,QAAQ,EAAE,aAAa;QACvB,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,eAAe;KAC/B,CAAC;IACD,IAAA,mBAAU,GAAE;qCAGyB,4CAAqB;QACpB,mBAAY;QACd,6CAAwB;QACxB,8BAAuB;QAClB,sBAAe;QAChB,qBAAc;GAP1C,cAAc,CA0H1B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ListQueryOptions, Product } from '@vendure/core';
|
|
2
|
+
import { type ListInput } from '../list-helpers';
|
|
3
|
+
export declare function productSearchWords(query: string | undefined, trimPlurals?: boolean): string[];
|
|
4
|
+
export declare function publicProductListOptions(input: ListInput, words?: string[]): ListQueryOptions<Product>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.productSearchWords = productSearchWords;
|
|
4
|
+
exports.publicProductListOptions = publicProductListOptions;
|
|
5
|
+
const list_helpers_1 = require("../list-helpers");
|
|
6
|
+
// Words under four characters are left alone so short words like "gas" or "bus" aren't mangled.
|
|
7
|
+
function singular(word) {
|
|
8
|
+
if (word.length < 4) {
|
|
9
|
+
return word;
|
|
10
|
+
}
|
|
11
|
+
if (/(?:s|x|z|ch|sh)es$/i.test(word)) {
|
|
12
|
+
return word.slice(0, -2);
|
|
13
|
+
}
|
|
14
|
+
if (/[^s]s$/i.test(word)) {
|
|
15
|
+
return word.slice(0, -1);
|
|
16
|
+
}
|
|
17
|
+
return word;
|
|
18
|
+
}
|
|
19
|
+
// `trimPlurals` is used as a second attempt when the words as typed find nothing.
|
|
20
|
+
function productSearchWords(query, trimPlurals = false) {
|
|
21
|
+
const words = (query !== null && query !== void 0 ? query : '')
|
|
22
|
+
.trim()
|
|
23
|
+
.split(/\s+/)
|
|
24
|
+
.filter(word => word.length > 0);
|
|
25
|
+
return trimPlurals ? words.map(singular) : words;
|
|
26
|
+
}
|
|
27
|
+
function publicProductListOptions(input, words = []) {
|
|
28
|
+
const options = (0, list_helpers_1.listOptions)({ limit: input.limit, offset: input.offset });
|
|
29
|
+
const wordFilters = words.map(word => ({
|
|
30
|
+
_or: [{ name: { contains: word } }, { slug: { contains: word } }],
|
|
31
|
+
}));
|
|
32
|
+
return Object.assign(Object.assign({}, options), { filter: Object.assign({ enabled: { eq: true } }, (wordFilters.length ? { _and: wordFilters } : {})) });
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=product-search-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-search-query.js","sourceRoot":"","sources":["../../../../src/tools/built-in/shop/product-search-query.ts"],"names":[],"mappings":";;AAmBA,gDAMC;AAED,4DAYC;AArCD,kDAA8D;AAE9D,gGAAgG;AAChG,SAAS,QAAQ,CAAC,IAAY;IAC1B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kFAAkF;AAClF,SAAgB,kBAAkB,CAAC,KAAyB,EAAE,WAAW,GAAG,KAAK;IAC7E,MAAM,KAAK,GAAG,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,CAAC;SACtB,IAAI,EAAE;SACN,KAAK,CAAC,KAAK,CAAC;SACZ,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,OAAO,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC;AAED,SAAgB,wBAAwB,CAAC,KAAgB,EAAE,QAAkB,EAAE;IAC3E,MAAM,OAAO,GAAG,IAAA,0BAAW,EAAU,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACnF,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC;KACpE,CAAC,CAAC,CAAC;IACJ,uCACO,OAAO,KACV,MAAM,kBACF,OAAO,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAClB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAE1D;AACN,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OrderService, RequestContext } from '@vendure/core';
|
|
2
|
+
import { McpToolHandler } from '@vendure/mcp-sdk';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { McpActiveOrderService } from '../active-order.service';
|
|
5
|
+
import { McpToolSerializerService } from '../serializer.service';
|
|
6
|
+
declare const removeCouponCodeInput: z.ZodObject<{
|
|
7
|
+
code: z.ZodString;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
type RemoveCouponCodeInput = z.infer<typeof removeCouponCodeInput>;
|
|
10
|
+
export declare class RemoveCouponCodeTool implements McpToolHandler<RemoveCouponCodeInput> {
|
|
11
|
+
private readonly activeOrder;
|
|
12
|
+
private readonly orderService;
|
|
13
|
+
private readonly serializer;
|
|
14
|
+
constructor(activeOrder: McpActiveOrderService, orderService: OrderService, serializer: McpToolSerializerService);
|
|
15
|
+
execute(ctx: RequestContext, input: RemoveCouponCodeInput): Promise<Record<string, unknown>>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RemoveCouponCodeTool = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const core_1 = require("@vendure/core");
|
|
15
|
+
const mcp_sdk_1 = require("@vendure/mcp-sdk");
|
|
16
|
+
const zod_1 = require("zod");
|
|
17
|
+
const active_order_service_1 = require("../active-order.service");
|
|
18
|
+
const serializer_service_1 = require("../serializer.service");
|
|
19
|
+
const string_schemas_1 = require("../string-schemas");
|
|
20
|
+
const removeCouponCodeInput = zod_1.z.strictObject({
|
|
21
|
+
code: string_schemas_1.shortText.describe('Coupon code.'),
|
|
22
|
+
});
|
|
23
|
+
let RemoveCouponCodeTool = class RemoveCouponCodeTool {
|
|
24
|
+
constructor(activeOrder, orderService, serializer) {
|
|
25
|
+
this.activeOrder = activeOrder;
|
|
26
|
+
this.orderService = orderService;
|
|
27
|
+
this.serializer = serializer;
|
|
28
|
+
}
|
|
29
|
+
async execute(ctx, input) {
|
|
30
|
+
const order = await this.activeOrder.findEditable(ctx);
|
|
31
|
+
if ((0, core_1.isGraphQlErrorResult)(order)) {
|
|
32
|
+
return this.serializer.orderOrError(order);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
order: this.serializer.order(await this.orderService.removeCouponCode(order.ctx, order.id, input.code)),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.RemoveCouponCodeTool = RemoveCouponCodeTool;
|
|
40
|
+
exports.RemoveCouponCodeTool = RemoveCouponCodeTool = __decorate([
|
|
41
|
+
(0, mcp_sdk_1.McpTool)({
|
|
42
|
+
name: 'remove_coupon_code',
|
|
43
|
+
toolset: 'shop',
|
|
44
|
+
description: 'Remove a coupon code from the active cart.',
|
|
45
|
+
keywords: [
|
|
46
|
+
'take off the discount',
|
|
47
|
+
'cancel my promo code',
|
|
48
|
+
'remove the voucher',
|
|
49
|
+
'get rid of the coupon',
|
|
50
|
+
'undo the discount code',
|
|
51
|
+
'clear the applied promo',
|
|
52
|
+
],
|
|
53
|
+
permissions: [core_1.Permission.Public],
|
|
54
|
+
behavior: 'mutating',
|
|
55
|
+
usesActiveOrder: true,
|
|
56
|
+
inputSchema: removeCouponCodeInput,
|
|
57
|
+
}),
|
|
58
|
+
(0, common_1.Injectable)(),
|
|
59
|
+
__metadata("design:paramtypes", [active_order_service_1.McpActiveOrderService,
|
|
60
|
+
core_1.OrderService,
|
|
61
|
+
serializer_service_1.McpToolSerializerService])
|
|
62
|
+
], RemoveCouponCodeTool);
|
|
63
|
+
//# sourceMappingURL=remove-coupon-code.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-coupon-code.tool.js","sourceRoot":"","sources":["../../../../src/tools/built-in/shop/remove-coupon-code.tool.ts"],"names":[],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