@vendure/dashboard 3.2.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/README.md +13 -0
- package/dist/plugin/.vendure-dashboard-temp/dev-config.js +227 -0
- package/dist/plugin/.vendure-dashboard-temp/dev-config.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/api-extensions.js +33 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/api-extensions.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/mv.resolver.js +69 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/api/mv.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-process.js +110 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-process.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-seller-strategy.js +134 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-order-seller-strategy.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-payment-handler.js +86 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-payment-handler.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-eligibility-checker.js +49 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-eligibility-checker.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-line-assignment-strategy.js +57 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/config/mv-shipping-line-assignment-strategy.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/constants.js +20 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/constants.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/multivendor.plugin.js +151 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/multivendor.plugin.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/payment/mv-connect-sdk.js +47 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/payment/mv-connect-sdk.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/service/mv.service.js +222 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/service/mv.service.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/types.js +4 -0
- package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/package.json +3 -0
- package/dist/plugin/.vendure-dashboard-temp/schema.graphql +6378 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/api-extensions.js +103 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/api-extensions.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-entity.resolver.js +105 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-entity.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-admin.resolver.js +183 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-admin.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-entity.resolver.js +113 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-entity.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-shop.resolver.js +112 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/api/product-review-shop.resolver.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/entities/product-review.entity.js +111 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/entities/product-review.entity.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-admin-types.js +616 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-admin-types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-shop-types.js +563 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/generated-shop-types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/reviews-plugin.js +135 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/reviews-plugin.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/types.js +4 -0
- package/dist/plugin/.vendure-dashboard-temp/test-plugins/reviews/types.js.map +1 -0
- package/dist/plugin/.vendure-dashboard-temp/tsconfig.json +10 -0
- package/dist/plugin/config-loader.d.ts +27 -0
- package/dist/plugin/config-loader.js +141 -0
- package/dist/plugin/constants.d.ts +5 -0
- package/dist/plugin/constants.js +277 -0
- package/dist/plugin/index.d.ts +1 -0
- package/dist/plugin/index.js +1 -0
- package/dist/plugin/schema-generator.d.ts +5 -0
- package/dist/plugin/schema-generator.js +24 -0
- package/dist/plugin/ui-config.d.ts +3 -0
- package/dist/plugin/ui-config.js +35 -0
- package/dist/plugin/vite-plugin-admin-api-schema.d.ts +24 -0
- package/dist/plugin/vite-plugin-admin-api-schema.js +82 -0
- package/dist/plugin/vite-plugin-config-loader.d.ts +17 -0
- package/dist/plugin/vite-plugin-config-loader.js +56 -0
- package/dist/plugin/vite-plugin-config.d.ts +4 -0
- package/dist/plugin/vite-plugin-config.js +38 -0
- package/dist/plugin/vite-plugin-dashboard-metadata.d.ts +9 -0
- package/dist/plugin/vite-plugin-dashboard-metadata.js +52 -0
- package/dist/plugin/vite-plugin-gql-tada.d.ts +6 -0
- package/dist/plugin/vite-plugin-gql-tada.js +51 -0
- package/dist/plugin/vite-plugin-set-root.d.ts +4 -0
- package/dist/plugin/vite-plugin-set-root.js +15 -0
- package/dist/plugin/vite-plugin-ui-config.d.ts +15 -0
- package/dist/plugin/vite-plugin-ui-config.js +43 -0
- package/dist/plugin/vite-plugin-vendure-dashboard.d.ts +35 -0
- package/dist/plugin/vite-plugin-vendure-dashboard.js +81 -0
- package/index.html +15 -0
- package/lingui.config.js +12 -0
- package/package.json +118 -0
- package/src/app/app-providers.tsx +30 -0
- package/src/app/main.tsx +97 -0
- package/src/app/routeTree.gen.ts +1372 -0
- package/src/app/routes/__root.tsx +24 -0
- package/src/app/routes/_authenticated/_administrators/administrators.graphql.ts +79 -0
- package/src/app/routes/_authenticated/_administrators/administrators.tsx +86 -0
- package/src/app/routes/_authenticated/_administrators/administrators_.$id.tsx +155 -0
- package/src/app/routes/_authenticated/_administrators/components/role-permissions-display.tsx +133 -0
- package/src/app/routes/_authenticated/_assets/assets.tsx +19 -0
- package/src/app/routes/_authenticated/_channels/channels.graphql.ts +93 -0
- package/src/app/routes/_authenticated/_channels/channels.tsx +60 -0
- package/src/app/routes/_authenticated/_channels/channels_.$id.tsx +248 -0
- package/src/app/routes/_authenticated/_collections/collections.graphql.ts +133 -0
- package/src/app/routes/_authenticated/_collections/collections.tsx +195 -0
- package/src/app/routes/_authenticated/_collections/collections_.$id.tsx +224 -0
- package/src/app/routes/_authenticated/_collections/components/collection-contents-preview-table.tsx +127 -0
- package/src/app/routes/_authenticated/_collections/components/collection-contents-sheet.tsx +46 -0
- package/src/app/routes/_authenticated/_collections/components/collection-contents-table.tsx +82 -0
- package/src/app/routes/_authenticated/_collections/components/collection-filters-selector.tsx +91 -0
- package/src/app/routes/_authenticated/_countries/countries.graphql.ts +69 -0
- package/src/app/routes/_authenticated/_countries/countries.tsx +67 -0
- package/src/app/routes/_authenticated/_countries/countries_.$id.tsx +122 -0
- package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-sheet.tsx +44 -0
- package/src/app/routes/_authenticated/_customer-groups/components/customer-group-members-table.tsx +129 -0
- package/src/app/routes/_authenticated/_customer-groups/customer-groups.graphql.ts +71 -0
- package/src/app/routes/_authenticated/_customer-groups/customer-groups.tsx +68 -0
- package/src/app/routes/_authenticated/_customer-groups/customer-groups_.$id.tsx +111 -0
- package/src/app/routes/_authenticated/_customers/components/customer-address-card.tsx +155 -0
- package/src/app/routes/_authenticated/_customers/components/customer-address-form.tsx +344 -0
- package/src/app/routes/_authenticated/_customers/components/customer-group-controls.tsx +4 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history-container.tsx +78 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/customer-history.tsx +77 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/index.ts +3 -0
- package/src/app/routes/_authenticated/_customers/components/customer-history/use-customer-history.ts +169 -0
- package/src/app/routes/_authenticated/_customers/components/customer-order-table.tsx +88 -0
- package/src/app/routes/_authenticated/_customers/components/customer-status-badge.tsx +33 -0
- package/src/app/routes/_authenticated/_customers/customers.graphql.ts +204 -0
- package/src/app/routes/_authenticated/_customers/customers.tsx +82 -0
- package/src/app/routes/_authenticated/_customers/customers_.$id.tsx +274 -0
- package/src/app/routes/_authenticated/_facets/components/edit-facet-value.tsx +129 -0
- package/src/app/routes/_authenticated/_facets/components/facet-values-sheet.tsx +46 -0
- package/src/app/routes/_authenticated/_facets/components/facet-values-table.tsx +97 -0
- package/src/app/routes/_authenticated/_facets/facets.graphql.ts +104 -0
- package/src/app/routes/_authenticated/_facets/facets.tsx +97 -0
- package/src/app/routes/_authenticated/_facets/facets_.$id.tsx +139 -0
- package/src/app/routes/_authenticated/_global-settings/global-settings.graphql.ts +28 -0
- package/src/app/routes/_authenticated/_global-settings/global-settings.tsx +161 -0
- package/src/app/routes/_authenticated/_orders/components/order-address.tsx +58 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/index.ts +3 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/order-history-container.tsx +73 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/order-history.tsx +96 -0
- package/src/app/routes/_authenticated/_orders/components/order-history/use-order-history.ts +171 -0
- package/src/app/routes/_authenticated/_orders/components/order-table.tsx +169 -0
- package/src/app/routes/_authenticated/_orders/components/order-tax-summary.tsx +39 -0
- package/src/app/routes/_authenticated/_orders/components/payment-details.tsx +61 -0
- package/src/app/routes/_authenticated/_orders/orders.graphql.ts +325 -0
- package/src/app/routes/_authenticated/_orders/orders.tsx +120 -0
- package/src/app/routes/_authenticated/_orders/orders_.$id.tsx +133 -0
- package/src/app/routes/_authenticated/_payment-methods/components/payment-eligibility-checker-selector.tsx +104 -0
- package/src/app/routes/_authenticated/_payment-methods/components/payment-handler-selector.tsx +100 -0
- package/src/app/routes/_authenticated/_payment-methods/payment-methods.graphql.ts +83 -0
- package/src/app/routes/_authenticated/_payment-methods/payment-methods.tsx +64 -0
- package/src/app/routes/_authenticated/_payment-methods/payment-methods_.$id.tsx +183 -0
- package/src/app/routes/_authenticated/_product-variants/components/variant-price-detail.tsx +87 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants.graphql.ts +123 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants.tsx +78 -0
- package/src/app/routes/_authenticated/_product-variants/product-variants_.$id.tsx +331 -0
- package/src/app/routes/_authenticated/_products/components/create-product-variants-dialog.tsx +228 -0
- package/src/app/routes/_authenticated/_products/components/create-product-variants.tsx +462 -0
- package/src/app/routes/_authenticated/_products/components/option-value-input.tsx +96 -0
- package/src/app/routes/_authenticated/_products/components/product-variants-table.tsx +87 -0
- package/src/app/routes/_authenticated/_products/products.graphql.ts +116 -0
- package/src/app/routes/_authenticated/_products/products.tsx +48 -0
- package/src/app/routes/_authenticated/_products/products_.$id.tsx +196 -0
- package/src/app/routes/_authenticated/_profile/profile.graphql.ts +23 -0
- package/src/app/routes/_authenticated/_profile/profile.tsx +122 -0
- package/src/app/routes/_authenticated/_promotions/components/promotion-actions-selector.tsx +107 -0
- package/src/app/routes/_authenticated/_promotions/components/promotion-conditions-selector.tsx +107 -0
- package/src/app/routes/_authenticated/_promotions/promotions.graphql.ts +96 -0
- package/src/app/routes/_authenticated/_promotions/promotions.tsx +61 -0
- package/src/app/routes/_authenticated/_promotions/promotions_.$id.tsx +235 -0
- package/src/app/routes/_authenticated/_roles/components/expandable-permissions.tsx +54 -0
- package/src/app/routes/_authenticated/_roles/components/permissions-grid.tsx +116 -0
- package/src/app/routes/_authenticated/_roles/roles.graphql.ts +67 -0
- package/src/app/routes/_authenticated/_roles/roles.tsx +96 -0
- package/src/app/routes/_authenticated/_roles/roles_.$id.tsx +142 -0
- package/src/app/routes/_authenticated/_sellers/sellers.graphql.ts +61 -0
- package/src/app/routes/_authenticated/_sellers/sellers.tsx +51 -0
- package/src/app/routes/_authenticated/_sellers/sellers_.$id.tsx +111 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/fulfillment-handler-selector.tsx +56 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/shipping-calculator-selector.tsx +101 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/shipping-eligibility-checker-selector.tsx +101 -0
- package/src/app/routes/_authenticated/_shipping-methods/components/test-shipping-method-dialog.tsx +32 -0
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.graphql.ts +83 -0
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods.tsx +55 -0
- package/src/app/routes/_authenticated/_shipping-methods/shipping-methods_.$id.tsx +171 -0
- package/src/app/routes/_authenticated/_stock-locations/stock-locations.graphql.ts +62 -0
- package/src/app/routes/_authenticated/_stock-locations/stock-locations.tsx +48 -0
- package/src/app/routes/_authenticated/_stock-locations/stock-locations_.$id.tsx +115 -0
- package/src/app/routes/_authenticated/_system/components/payload-dialog.tsx +34 -0
- package/src/app/routes/_authenticated/_system/healthchecks.tsx +93 -0
- package/src/app/routes/_authenticated/_system/job-queue.graphql.ts +43 -0
- package/src/app/routes/_authenticated/_system/job-queue.tsx +161 -0
- package/src/app/routes/_authenticated/_tax-categories/tax-categories.graphql.ts +63 -0
- package/src/app/routes/_authenticated/_tax-categories/tax-categories.tsx +65 -0
- package/src/app/routes/_authenticated/_tax-categories/tax-categories_.$id.tsx +115 -0
- package/src/app/routes/_authenticated/_tax-rates/tax-rates.graphql.ts +75 -0
- package/src/app/routes/_authenticated/_tax-rates/tax-rates.tsx +108 -0
- package/src/app/routes/_authenticated/_tax-rates/tax-rates_.$id.tsx +148 -0
- package/src/app/routes/_authenticated/_zones/components/zone-countries-add.tsx +0 -0
- package/src/app/routes/_authenticated/_zones/components/zone-countries-sheet.tsx +31 -0
- package/src/app/routes/_authenticated/_zones/components/zone-countries-table.tsx +79 -0
- package/src/app/routes/_authenticated/_zones/zones.graphql.ts +96 -0
- package/src/app/routes/_authenticated/_zones/zones.tsx +57 -0
- package/src/app/routes/_authenticated/_zones/zones_.$id.tsx +103 -0
- package/src/app/routes/_authenticated/index.tsx +194 -0
- package/src/app/routes/_authenticated.tsx +25 -0
- package/src/app/routes/login.tsx +48 -0
- package/src/app/styles.css +82 -0
- package/src/app/tailwindcss-animate.css +275 -0
- package/src/i18n/locales/de.po +1579 -0
- package/src/i18n/locales/en.po +1579 -0
- package/src/lib/components/data-display/boolean.tsx +23 -0
- package/src/lib/components/data-display/date-time.tsx +13 -0
- package/src/lib/components/data-display/json.tsx +5 -0
- package/src/lib/components/data-display/money.tsx +15 -0
- package/src/lib/components/data-input/affixed-input.tsx +49 -0
- package/src/lib/components/data-input/customer-group-input.tsx +72 -0
- package/src/lib/components/data-input/datetime-input.tsx +150 -0
- package/src/lib/components/data-input/facet-value-input.tsx +68 -0
- package/src/lib/components/data-input/money-input.tsx +112 -0
- package/src/lib/components/data-input/richt-text-input.tsx +99 -0
- package/src/lib/components/data-table/data-table-column-header.tsx +73 -0
- package/src/lib/components/data-table/data-table-faceted-filter.tsx +172 -0
- package/src/lib/components/data-table/data-table-filter-dialog.tsx +73 -0
- package/src/lib/components/data-table/data-table-pagination.tsx +87 -0
- package/src/lib/components/data-table/data-table-view-options.tsx +53 -0
- package/src/lib/components/data-table/data-table.tsx +218 -0
- package/src/lib/components/layout/app-layout.tsx +42 -0
- package/src/lib/components/layout/app-sidebar.tsx +34 -0
- package/src/lib/components/layout/channel-switcher.tsx +87 -0
- package/src/lib/components/layout/content-language-selector.tsx +41 -0
- package/src/lib/components/layout/generated-breadcrumbs.tsx +82 -0
- package/src/lib/components/layout/language-dialog.tsx +104 -0
- package/src/lib/components/layout/nav-main.tsx +178 -0
- package/src/lib/components/layout/nav-projects.tsx +81 -0
- package/src/lib/components/layout/nav-user.tsx +176 -0
- package/src/lib/components/layout/prerelease-popup.tsx +38 -0
- package/src/lib/components/login/login-form.tsx +173 -0
- package/src/lib/components/shared/alerts.tsx +20 -0
- package/src/lib/components/shared/animated-number.tsx +49 -0
- package/src/lib/components/shared/asset-gallery.tsx +433 -0
- package/src/lib/components/shared/asset-picker-dialog.tsx +72 -0
- package/src/lib/components/shared/asset-preview-dialog.tsx +48 -0
- package/src/lib/components/shared/asset-preview.tsx +345 -0
- package/src/lib/components/shared/assigned-facet-values.tsx +68 -0
- package/src/lib/components/shared/channel-code-label.tsx +7 -0
- package/src/lib/components/shared/channel-selector.tsx +51 -0
- package/src/lib/components/shared/configurable-operation-arg-input.tsx +51 -0
- package/src/lib/components/shared/configurable-operation-input.tsx +133 -0
- package/src/lib/components/shared/confirmation-dialog.tsx +58 -0
- package/src/lib/components/shared/copyable-text.tsx +31 -0
- package/src/lib/components/shared/country-selector.tsx +105 -0
- package/src/lib/components/shared/currency-selector.tsx +33 -0
- package/src/lib/components/shared/custom-fields-form.tsx +86 -0
- package/src/lib/components/shared/customer-address-form.tsx +330 -0
- package/src/lib/components/shared/customer-group-chip.tsx +30 -0
- package/src/lib/components/shared/customer-group-selector.tsx +62 -0
- package/src/lib/components/shared/customer-selector.tsx +107 -0
- package/src/lib/components/shared/detail-page-button.tsx +22 -0
- package/src/lib/components/shared/entity-assets.tsx +340 -0
- package/src/lib/components/shared/error-page.tsx +31 -0
- package/src/lib/components/shared/facet-value-chip.tsx +45 -0
- package/src/lib/components/shared/facet-value-selector.tsx +306 -0
- package/src/lib/components/shared/focal-point-control.tsx +65 -0
- package/src/lib/components/shared/form-field-wrapper.tsx +37 -0
- package/src/lib/components/shared/history-timeline/history-entry.tsx +112 -0
- package/src/lib/components/shared/history-timeline/history-note-checkbox.tsx +28 -0
- package/src/lib/components/shared/history-timeline/history-note-editor.tsx +60 -0
- package/src/lib/components/shared/history-timeline/history-note-input.tsx +39 -0
- package/src/lib/components/shared/history-timeline/history-timeline.tsx +56 -0
- package/src/lib/components/shared/icon-mark.tsx +18 -0
- package/src/lib/components/shared/language-selector.tsx +48 -0
- package/src/lib/components/shared/logo-mark.tsx +24 -0
- package/src/lib/components/shared/multi-select.tsx +159 -0
- package/src/lib/components/shared/option-value-input.tsx +95 -0
- package/src/lib/components/shared/paginated-list-data-table.tsx +520 -0
- package/src/lib/components/shared/permission-guard.tsx +21 -0
- package/src/lib/components/shared/rich-text-editor.tsx +0 -0
- package/src/lib/components/shared/role-code-label.tsx +8 -0
- package/src/lib/components/shared/role-selector.tsx +56 -0
- package/src/lib/components/shared/seller-selector.tsx +107 -0
- package/src/lib/components/shared/tax-category-selector.tsx +65 -0
- package/src/lib/components/shared/translatable-form-field.tsx +74 -0
- package/src/lib/components/shared/vendure-image.tsx +159 -0
- package/src/lib/components/shared/zone-selector.tsx +66 -0
- package/src/lib/components/ui/accordion.tsx +59 -0
- package/src/lib/components/ui/alert-dialog.tsx +128 -0
- package/src/lib/components/ui/alert.tsx +60 -0
- package/src/lib/components/ui/avatar.tsx +38 -0
- package/src/lib/components/ui/badge.tsx +38 -0
- package/src/lib/components/ui/breadcrumb.tsx +102 -0
- package/src/lib/components/ui/button.tsx +51 -0
- package/src/lib/components/ui/calendar.tsx +69 -0
- package/src/lib/components/ui/card.tsx +47 -0
- package/src/lib/components/ui/checkbox.tsx +27 -0
- package/src/lib/components/ui/collapsible.tsx +33 -0
- package/src/lib/components/ui/command.tsx +133 -0
- package/src/lib/components/ui/dialog.tsx +116 -0
- package/src/lib/components/ui/dropdown-menu.tsx +220 -0
- package/src/lib/components/ui/form.tsx +141 -0
- package/src/lib/components/ui/hover-card.tsx +36 -0
- package/src/lib/components/ui/input.tsx +19 -0
- package/src/lib/components/ui/label.tsx +21 -0
- package/src/lib/components/ui/pagination.tsx +127 -0
- package/src/lib/components/ui/popover.tsx +40 -0
- package/src/lib/components/ui/scroll-area.tsx +50 -0
- package/src/lib/components/ui/select.tsx +161 -0
- package/src/lib/components/ui/separator.tsx +26 -0
- package/src/lib/components/ui/sheet.tsx +118 -0
- package/src/lib/components/ui/sidebar.tsx +696 -0
- package/src/lib/components/ui/skeleton.tsx +13 -0
- package/src/lib/components/ui/sonner.tsx +27 -0
- package/src/lib/components/ui/switch.tsx +26 -0
- package/src/lib/components/ui/table.tsx +82 -0
- package/src/lib/components/ui/tabs.tsx +48 -0
- package/src/lib/components/ui/textarea.tsx +18 -0
- package/src/lib/components/ui/tooltip.tsx +51 -0
- package/src/lib/constants.ts +326 -0
- package/src/lib/framework/component-registry/component-registry.tsx +70 -0
- package/src/lib/framework/component-registry/dynamic-component.tsx +58 -0
- package/src/lib/framework/dashboard-widget/base-widget.tsx +97 -0
- package/src/lib/framework/dashboard-widget/latest-orders-widget/index.tsx +96 -0
- package/src/lib/framework/dashboard-widget/latest-orders-widget/latest-orders-widget.graphql.ts +35 -0
- package/src/lib/framework/dashboard-widget/metrics-widget/chart.tsx +24 -0
- package/src/lib/framework/dashboard-widget/metrics-widget/index.tsx +82 -0
- package/src/lib/framework/dashboard-widget/metrics-widget/metrics-widget.graphql.ts +14 -0
- package/src/lib/framework/dashboard-widget/orders-summary/index.tsx +167 -0
- package/src/lib/framework/dashboard-widget/orders-summary/order-summary-widget.graphql.ts +14 -0
- package/src/lib/framework/dashboard-widget/types.ts +22 -0
- package/src/lib/framework/dashboard-widget/widget-extensions.tsx +19 -0
- package/src/lib/framework/defaults.ts +219 -0
- package/src/lib/framework/document-introspection/add-custom-fields.spec.ts +242 -0
- package/src/lib/framework/document-introspection/add-custom-fields.ts +246 -0
- package/src/lib/framework/document-introspection/get-document-structure.spec.ts +310 -0
- package/src/lib/framework/document-introspection/get-document-structure.ts +460 -0
- package/src/lib/framework/document-introspection/hooks.ts +10 -0
- package/src/lib/framework/extension-api/define-dashboard-extension.ts +66 -0
- package/src/lib/framework/extension-api/extension-api-types.ts +58 -0
- package/src/lib/framework/extension-api/use-dashboard-extensions.ts +26 -0
- package/src/lib/framework/form-engine/form-schema-tools.ts +98 -0
- package/src/lib/framework/form-engine/use-generated-form.tsx +116 -0
- package/src/lib/framework/layout-engine/layout-extensions.ts +30 -0
- package/src/lib/framework/layout-engine/location-wrapper.tsx +96 -0
- package/src/lib/framework/layout-engine/page-layout.tsx +272 -0
- package/src/lib/framework/nav-menu/nav-menu-extensions.ts +66 -0
- package/src/lib/framework/page/detail-page-route-loader.tsx +48 -0
- package/src/lib/framework/page/detail-page.tsx +131 -0
- package/src/lib/framework/page/list-page.tsx +166 -0
- package/src/lib/framework/page/page-api.ts +9 -0
- package/src/lib/framework/page/page-types.ts +51 -0
- package/src/lib/framework/page/use-detail-page.ts +217 -0
- package/src/lib/framework/page/use-extended-router.tsx +69 -0
- package/src/lib/framework/registry/global-registry.ts +46 -0
- package/src/lib/framework/registry/registry-types.ts +15 -0
- package/src/lib/graphql/api.ts +61 -0
- package/src/lib/graphql/fragments.tsx +54 -0
- package/src/lib/graphql/graphql-env.d.ts +499 -0
- package/src/lib/graphql/graphql.ts +15 -0
- package/src/lib/hooks/use-auth.tsx +11 -0
- package/src/lib/hooks/use-channel.ts +12 -0
- package/src/lib/hooks/use-custom-field-config.ts +10 -0
- package/src/lib/hooks/use-grouped-permissions.ts +54 -0
- package/src/lib/hooks/use-local-format.ts +119 -0
- package/src/lib/hooks/use-mobile.ts +19 -0
- package/src/lib/hooks/use-page.tsx +11 -0
- package/src/lib/hooks/use-permissions.ts +22 -0
- package/src/lib/hooks/use-server-config.ts +4 -0
- package/src/lib/hooks/use-theme.ts +10 -0
- package/src/lib/hooks/use-user-settings.tsx +12 -0
- package/src/lib/index.ts +149 -0
- package/src/lib/lib/trans.tsx +16 -0
- package/src/lib/lib/utils.ts +60 -0
- package/src/lib/providers/auth.tsx +152 -0
- package/src/lib/providers/channel-provider.tsx +121 -0
- package/src/lib/providers/i18n-provider.tsx +28 -0
- package/src/lib/providers/server-config.tsx +279 -0
- package/src/lib/providers/theme-provider.tsx +54 -0
- package/src/lib/providers/user-settings.tsx +89 -0
- package/src/lib/virtual.d.ts +12 -0
- package/vite/config-loader.ts +181 -0
- package/vite/constants.ts +280 -0
- package/vite/index.ts +1 -0
- package/vite/schema-generator.ts +40 -0
- package/vite/ui-config.ts +60 -0
- package/vite/vite-plugin-admin-api-schema.ts +141 -0
- package/vite/vite-plugin-config-loader.ts +64 -0
- package/vite/vite-plugin-config.ts +42 -0
- package/vite/vite-plugin-dashboard-metadata.ts +58 -0
- package/vite/vite-plugin-gql-tada.ts +62 -0
- package/vite/vite-plugin-theme.ts +195 -0
- package/vite/vite-plugin-ui-config.ts +60 -0
- package/vite/vite-plugin-vendure-dashboard.ts +118 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"{\"version\":3,\"sources\":[\"C:\\\\Development\\\\vendure\\\\vendure\\\\packages\\\\dev-server\\\\example-plugins\\\\multivendor-plugin\\\\config\\\\mv-order-seller-strategy.ts\"],\"sourcesContent\":[\"import {\\r\\n ChannelService,\\r\\n EntityHydrator,\\r\\n ID,\\r\\n idsAreEqual,\\r\\n Injector,\\r\\n InternalServerError,\\r\\n isGraphQlErrorResult,\\r\\n Order,\\r\\n OrderLine,\\r\\n OrderSellerStrategy,\\r\\n OrderService,\\r\\n PaymentMethod,\\r\\n PaymentMethodService,\\r\\n PaymentService,\\r\\n RequestContext,\\r\\n SplitOrderContents,\\r\\n Surcharge,\\r\\n TransactionalConnection,\\r\\n} from '@vendure/core';\\r\\n\\r\\nimport { CONNECTED_PAYMENT_METHOD_CODE, MULTIVENDOR_PLUGIN_OPTIONS } from '../constants';\\r\\nimport { MultivendorPluginOptions } from '../types';\\r\\n\\r\\ndeclare module '@vendure/core/dist/entity/custom-entity-fields' {\\r\\n interface CustomSellerFields {\\r\\n connectedAccountId: string;\\r\\n }\\r\\n}\\r\\n\\r\\nexport class MultivendorSellerStrategy implements OrderSellerStrategy {\\r\\n private entityHydrator: EntityHydrator;\\r\\n private channelService: ChannelService;\\r\\n private paymentService: PaymentService;\\r\\n private paymentMethodService: PaymentMethodService;\\r\\n private connection: TransactionalConnection;\\r\\n private orderService: OrderService;\\r\\n private options: MultivendorPluginOptions;\\r\\n\\r\\n init(injector: Injector) {\\r\\n this.entityHydrator = injector.get(EntityHydrator);\\r\\n this.channelService = injector.get(ChannelService);\\r\\n this.paymentService = injector.get(PaymentService);\\r\\n this.paymentMethodService = injector.get(PaymentMethodService);\\r\\n this.connection = injector.get(TransactionalConnection);\\r\\n this.orderService = injector.get(OrderService);\\r\\n this.options = injector.get(MULTIVENDOR_PLUGIN_OPTIONS);\\r\\n }\\r\\n\\r\\n async setOrderLineSellerChannel(ctx: RequestContext, orderLine: OrderLine) {\\r\\n await this.entityHydrator.hydrate(ctx, orderLine.productVariant, { relations: ['channels'] });\\r\\n const defaultChannel = await this.channelService.getDefaultChannel();\\r\\n\\r\\n // If a ProductVariant is assigned to exactly 2 Channels, then one is the default Channel\\r\\n // and the other is the seller's Channel.\\r\\n if (orderLine.productVariant.channels.length === 2) {\\r\\n const sellerChannel = orderLine.productVariant.channels.find(\\r\\n c => !idsAreEqual(c.id, defaultChannel.id),\\r\\n );\\r\\n if (sellerChannel) {\\r\\n return sellerChannel;\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n async splitOrder(ctx: RequestContext, order: Order): Promise<SplitOrderContents[]> {\\r\\n const partialOrders = new Map<ID, SplitOrderContents>();\\r\\n for (const line of order.lines) {\\r\\n const sellerChannelId = line.sellerChannelId;\\r\\n if (sellerChannelId) {\\r\\n let partialOrder = partialOrders.get(sellerChannelId);\\r\\n if (!partialOrder) {\\r\\n partialOrder = {\\r\\n channelId: sellerChannelId,\\r\\n shippingLines: [],\\r\\n lines: [],\\r\\n state: 'ArrangingPayment',\\r\\n };\\r\\n partialOrders.set(sellerChannelId, partialOrder);\\r\\n }\\r\\n partialOrder.lines.push(line);\\r\\n }\\r\\n }\\r\\n\\r\\n for (const partialOrder of partialOrders.values()) {\\r\\n const shippingLineIds = new Set(partialOrder.lines.map(l => l.shippingLineId));\\r\\n partialOrder.shippingLines = order.shippingLines.filter(shippingLine =>\\r\\n shippingLineIds.has(shippingLine.id),\\r\\n );\\r\\n }\\r\\n\\r\\n return [...partialOrders.values()];\\r\\n }\\r\\n\\r\\n async afterSellerOrdersCreated(ctx: RequestContext, aggregateOrder: Order, sellerOrders: Order[]) {\\r\\n const paymentMethod = await this.connection.rawConnection.getRepository(PaymentMethod).findOne({\\r\\n where: {\\r\\n code: CONNECTED_PAYMENT_METHOD_CODE,\\r\\n },\\r\\n });\\r\\n if (!paymentMethod) {\\r\\n return;\\r\\n }\\r\\n const defaultChannel = await this.channelService.getDefaultChannel();\\r\\n for (const sellerOrder of sellerOrders) {\\r\\n const sellerChannel = sellerOrder.channels.find(c => !idsAreEqual(c.id, defaultChannel.id));\\r\\n if (!sellerChannel) {\\r\\n throw new InternalServerError(\\r\\n `Could not determine Seller Channel for Order ${sellerOrder.code}`,\\r\\n );\\r\\n }\\r\\n sellerOrder.surcharges = [await this.createPlatformFeeSurcharge(ctx, sellerOrder)];\\r\\n await this.orderService.applyPriceAdjustments(ctx, sellerOrder);\\r\\n await this.entityHydrator.hydrate(ctx, sellerChannel, { relations: ['seller'] });\\r\\n const result = await this.orderService.addPaymentToOrder(ctx, sellerOrder.id, {\\r\\n method: paymentMethod.code,\\r\\n metadata: {\\r\\n transfer_group: aggregateOrder.code,\\r\\n connectedAccountId: sellerChannel.seller?.customFields.connectedAccountId,\\r\\n },\\r\\n });\\r\\n if (isGraphQlErrorResult(result)) {\\r\\n throw new InternalServerError(result.message);\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n private async createPlatformFeeSurcharge(ctx: RequestContext, sellerOrder: Order) {\\r\\n const platformFee = Math.round(sellerOrder.totalWithTax * -(this.options.platformFeePercent / 100));\\r\\n return this.connection.getRepository(ctx, Surcharge).save(\\r\\n new Surcharge({\\r\\n taxLines: [],\\r\\n sku: this.options.platformFeeSKU,\\r\\n description: 'Platform fee',\\r\\n listPrice: platformFee,\\r\\n listPriceIncludesTax: true,\\r\\n order: sellerOrder,\\r\\n }),\\r\\n );\\r\\n }\\r\\n}\\r\\n\"],\"names\":[\"MultivendorSellerStrategy\",\"init\",\"injector\",\"entityHydrator\",\"get\",\"EntityHydrator\",\"channelService\",\"ChannelService\",\"paymentService\",\"PaymentService\",\"paymentMethodService\",\"PaymentMethodService\",\"connection\",\"TransactionalConnection\",\"orderService\",\"OrderService\",\"options\",\"MULTIVENDOR_PLUGIN_OPTIONS\",\"setOrderLineSellerChannel\",\"ctx\",\"orderLine\",\"hydrate\",\"productVariant\",\"relations\",\"defaultChannel\",\"getDefaultChannel\",\"channels\",\"length\",\"sellerChannel\",\"find\",\"c\",\"idsAreEqual\",\"id\",\"splitOrder\",\"order\",\"partialOrders\",\"Map\",\"line\",\"lines\",\"sellerChannelId\",\"partialOrder\",\"channelId\",\"shippingLines\",\"state\",\"set\",\"push\",\"values\",\"shippingLineIds\",\"Set\",\"map\",\"l\",\"shippingLineId\",\"filter\",\"shippingLine\",\"has\",\"afterSellerOrdersCreated\",\"aggregateOrder\",\"sellerOrders\",\"paymentMethod\",\"rawConnection\",\"getRepository\",\"PaymentMethod\",\"findOne\",\"where\",\"code\",\"CONNECTED_PAYMENT_METHOD_CODE\",\"sellerOrder\",\"InternalServerError\",\"surcharges\",\"createPlatformFeeSurcharge\",\"applyPriceAdjustments\",\"result\",\"addPaymentToOrder\",\"method\",\"metadata\",\"transfer_group\",\"connectedAccountId\",\"seller\",\"customFields\",\"isGraphQlErrorResult\",\"message\",\"platformFee\",\"Math\",\"round\",\"totalWithTax\",\"platformFeePercent\",\"Surcharge\",\"save\",\"taxLines\",\"sku\",\"platformFeeSKU\",\"description\",\"listPrice\",\"listPriceIncludesTax\"],\"mappings\":\";;;;+BA8BaA;;;eAAAA;;;sBAXN;2BAEmE;;;;;;;;;;;;;;AASnE,MAAMA;IASTC,KAAKC,QAAkB,EAAE;QACrB,IAAI,CAACC,cAAc,GAAGD,SAASE,GAAG,CAACC,oBAAc;QACjD,IAAI,CAACC,cAAc,GAAGJ,SAASE,GAAG,CAACG,oBAAc;QACjD,IAAI,CAACC,cAAc,GAAGN,SAASE,GAAG,CAACK,oBAAc;QACjD,IAAI,CAACC,oBAAoB,GAAGR,SAASE,GAAG,CAACO,0BAAoB;QAC7D,IAAI,CAACC,UAAU,GAAGV,SAASE,GAAG,CAACS,6BAAuB;QACtD,IAAI,CAACC,YAAY,GAAGZ,SAASE,GAAG,CAACW,kBAAY;QAC7C,IAAI,CAACC,OAAO,GAAGd,SAASE,GAAG,CAACa,qCAA0B;IAC1D;IAEA,MAAMC,0BAA0BC,GAAmB,EAAEC,SAAoB,EAAE;QACvE,MAAM,IAAI,CAACjB,cAAc,CAACkB,OAAO,CAACF,KAAKC,UAAUE,cAAc,EAAE;YAAEC,WAAW;gBAAC;aAAW;QAAC;QAC3F,MAAMC,iBAAiB,MAAM,IAAI,CAAClB,cAAc,CAACmB,iBAAiB;QAElE,yFAAyF;QACzF,yCAAyC;QACzC,IAAIL,UAAUE,cAAc,CAACI,QAAQ,CAACC,MAAM,KAAK,GAAG;YAChD,MAAMC,gBAAgBR,UAAUE,cAAc,CAACI,QAAQ,CAACG,IAAI,CACxDC,CAAAA,IAAK,CAACC,IAAAA,iBAAW,EAACD,EAAEE,EAAE,EAAER,eAAeQ,EAAE;YAE7C,IAAIJ,eAAe;gBACf,OAAOA;YACX;QACJ;IACJ;IAEA,MAAMK,WAAWd,GAAmB,EAAEe,KAAY,EAAiC;QAC/E,MAAMC,gBAAgB,IAAIC;QAC1B,KAAK,MAAMC,QAAQH,MAAMI,KAAK,CAAE;YAC5B,MAAMC,kBAAkBF,KAAKE,eAAe;YAC5C,IAAIA,iBAAiB;gBACjB,IAAIC,eAAeL,cAAc/B,GAAG,CAACmC;gBACrC,IAAI,CAACC,cAAc;oBACfA,eAAe;wBACXC,WAAWF;wBACXG,eAAe,EAAE;wBACjBJ,OAAO,EAAE;wBACTK,OAAO;oBACX;oBACAR,cAAcS,GAAG,CAACL,iBAAiBC;gBACvC;gBACAA,aAAaF,KAAK,CAACO,IAAI,CAACR;YAC5B;QACJ;QAEA,KAAK,MAAMG,gBAAgBL,cAAcW,MAAM,GAAI;YAC/C,MAAMC,kBAAkB,IAAIC,IAAIR,aAAaF,KAAK,CAACW,GAAG,CAACC,CAAAA,IAAKA,EAAEC,cAAc;YAC5EX,aAAaE,aAAa,GAAGR,MAAMQ,aAAa,CAACU,MAAM,CAACC,CAAAA,eACpDN,gBAAgBO,GAAG,CAACD,aAAarB,EAAE;QAE3C;QAEA,OAAO;eAAIG,cAAcW,MAAM;SAAG;IACtC;IAEA,MAAMS,yBAAyBpC,GAAmB,EAAEqC,cAAqB,EAAEC,YAAqB,EAAE;QAC9F,MAAMC,gBAAgB,MAAM,IAAI,CAAC9C,UAAU,CAAC+C,aAAa,CAACC,aAAa,CAACC,mBAAa,EAAEC,OAAO,CAAC;YAC3FC,OAAO;gBACHC,MAAMC,wCAA6B;YACvC;QACJ;QACA,IAAI,CAACP,eAAe;YAChB;QACJ;QACA,MAAMlC,iBAAiB,MAAM,IAAI,CAAClB,cAAc,CAACmB,iBAAiB;QAClE,KAAK,MAAMyC,eAAeT,aAAc;YACpC,MAAM7B,gBAAgBsC,YAAYxC,QAAQ,CAACG,IAAI,CAACC,CAAAA,IAAK,CAACC,IAAAA,iBAAW,EAACD,EAAEE,EAAE,EAAER,eAAeQ,EAAE;YACzF,IAAI,CAACJ,eAAe;gBAChB,MAAM,IAAIuC,yBAAmB,CACzB,CAAC,6CAA6C,EAAED,YAAYF,IAAI,EAAE;YAE1E;YACAE,YAAYE,UAAU,GAAG;gBAAC,MAAM,IAAI,CAACC,0BAA0B,CAAClD,KAAK+C;aAAa;YAClF,MAAM,IAAI,CAACpD,YAAY,CAACwD,qBAAqB,CAACnD,KAAK+C;YACnD,MAAM,IAAI,CAAC/D,cAAc,CAACkB,OAAO,CAACF,KAAKS,eAAe;gBAAEL,WAAW;oBAAC;iBAAS;YAAC;YAC9E,MAAMgD,SAAS,MAAM,IAAI,CAACzD,YAAY,CAAC0D,iBAAiB,CAACrD,KAAK+C,YAAYlC,EAAE,EAAE;gBAC1EyC,QAAQf,cAAcM,IAAI;gBAC1BU,UAAU;oBACNC,gBAAgBnB,eAAeQ,IAAI;oBACnCY,oBAAoBhD,cAAciD,MAAM,EAAEC,aAAaF;gBAC3D;YACJ;YACA,IAAIG,IAAAA,0BAAoB,EAACR,SAAS;gBAC9B,MAAM,IAAIJ,yBAAmB,CAACI,OAAOS,OAAO;YAChD;QACJ;IACJ;IAEA,MAAcX,2BAA2BlD,GAAmB,EAAE+C,WAAkB,EAAE;QAC9E,MAAMe,cAAcC,KAAKC,KAAK,CAACjB,YAAYkB,YAAY,GAAG,CAAE,CAAA,IAAI,CAACpE,OAAO,CAACqE,kBAAkB,GAAG,GAAE;QAChG,OAAO,IAAI,CAACzE,UAAU,CAACgD,aAAa,CAACzC,KAAKmE,eAAS,EAAEC,IAAI,CACrD,IAAID,eAAS,CAAC;YACVE,UAAU,EAAE;YACZC,KAAK,IAAI,CAACzE,OAAO,CAAC0E,cAAc;YAChCC,aAAa;YACbC,WAAWX;YACXY,sBAAsB;YACtB3D,OAAOgC;QACX;IAER;;QA5GA,uBAAQ/D,kBAAR,KAAA;QACA,uBAAQG,kBAAR,KAAA;QACA,uBAAQE,kBAAR,KAAA;QACA,uBAAQE,wBAAR,KAAA;QACA,uBAAQE,cAAR,KAAA;QACA,uBAAQE,gBAAR,KAAA;QACA,uBAAQE,WAAR,KAAA;;AAuGJ\"}"
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "multivendorPaymentMethodHandler", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return multivendorPaymentMethodHandler;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _generatedtypes = require("@vendure/common/lib/generated-types");
|
|
12
|
+
const _core = require("@vendure/core");
|
|
13
|
+
const _mvconnectsdk = require("../payment/mv-connect-sdk");
|
|
14
|
+
const sdk = new _mvconnectsdk.MyConnectSdk({
|
|
15
|
+
apiKey: 'MY_API_KEY'
|
|
16
|
+
});
|
|
17
|
+
const multivendorPaymentMethodHandler = new _core.PaymentMethodHandler({
|
|
18
|
+
code: 'mv-connect-payment-method',
|
|
19
|
+
description: [
|
|
20
|
+
{
|
|
21
|
+
languageCode: _core.LanguageCode.en,
|
|
22
|
+
value: 'Multivendor Payment Provider'
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
args: {},
|
|
26
|
+
createPayment: async (ctx, order, amount, args, metadata)=>{
|
|
27
|
+
if (order.type === _generatedtypes.OrderType.Seller) {
|
|
28
|
+
try {
|
|
29
|
+
// Create a Transfer payment to the Seller's account
|
|
30
|
+
const result = await sdk.createTransfer({
|
|
31
|
+
amount,
|
|
32
|
+
currency: order.currencyCode,
|
|
33
|
+
connectedAccountId: metadata.connectedAccountId,
|
|
34
|
+
transfer_group: metadata.transfer_group
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
amount,
|
|
38
|
+
state: 'Settled',
|
|
39
|
+
transactionId: result.transactionId,
|
|
40
|
+
metadata
|
|
41
|
+
};
|
|
42
|
+
} catch (err) {
|
|
43
|
+
return {
|
|
44
|
+
amount,
|
|
45
|
+
state: 'Declined',
|
|
46
|
+
metadata: {
|
|
47
|
+
errorMessage: err.message
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
try {
|
|
53
|
+
// Create a payment to the platform's account,
|
|
54
|
+
// and set the `transfer_group` option to later link
|
|
55
|
+
// with the Seller transfers after the Seller orders
|
|
56
|
+
// have been created.
|
|
57
|
+
const result = await sdk.createPayment({
|
|
58
|
+
amount,
|
|
59
|
+
currency: order.currencyCode,
|
|
60
|
+
transfer_group: order.code
|
|
61
|
+
});
|
|
62
|
+
return {
|
|
63
|
+
amount,
|
|
64
|
+
state: 'Settled',
|
|
65
|
+
transactionId: result.transactionId,
|
|
66
|
+
metadata: {
|
|
67
|
+
transfer_group: order.code
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
} catch (err) {
|
|
71
|
+
return {
|
|
72
|
+
amount,
|
|
73
|
+
state: 'Declined',
|
|
74
|
+
metadata: {
|
|
75
|
+
errorMessage: err.message
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
settlePayment: async (ctx, order, payment, args)=>{
|
|
82
|
+
return {
|
|
83
|
+
success: true
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"{\"version\":3,\"sources\":[\"C:\\\\Development\\\\vendure\\\\vendure\\\\packages\\\\dev-server\\\\example-plugins\\\\multivendor-plugin\\\\config\\\\mv-payment-handler.ts\"],\"sourcesContent\":[\"import { OrderType } from '@vendure/common/lib/generated-types';\\r\\nimport {\\r\\n CreatePaymentResult,\\r\\n LanguageCode,\\r\\n PaymentMethodHandler,\\r\\n SettlePaymentErrorResult,\\r\\n SettlePaymentResult,\\r\\n} from '@vendure/core';\\r\\n\\r\\nimport { MyConnectSdk } from '../payment/mv-connect-sdk';\\r\\n\\r\\nconst sdk = new MyConnectSdk({ apiKey: 'MY_API_KEY' });\\r\\n\\r\\nexport const multivendorPaymentMethodHandler = new PaymentMethodHandler({\\r\\n code: 'mv-connect-payment-method',\\r\\n description: [\\r\\n {\\r\\n languageCode: LanguageCode.en,\\r\\n value: 'Multivendor Payment Provider',\\r\\n },\\r\\n ],\\r\\n args: {},\\r\\n createPayment: async (ctx, order, amount, args, metadata) => {\\r\\n if (order.type === OrderType.Seller) {\\r\\n try {\\r\\n // Create a Transfer payment to the Seller's account\\r\\n const result = await sdk.createTransfer({\\r\\n amount,\\r\\n currency: order.currencyCode,\\r\\n connectedAccountId: metadata.connectedAccountId,\\r\\n transfer_group: metadata.transfer_group,\\r\\n });\\r\\n return {\\r\\n amount,\\r\\n state: 'Settled' as const,\\r\\n transactionId: result.transactionId,\\r\\n metadata,\\r\\n };\\r\\n } catch (err: any) {\\r\\n return {\\r\\n amount,\\r\\n state: 'Declined' as const,\\r\\n metadata: {\\r\\n errorMessage: err.message,\\r\\n },\\r\\n };\\r\\n }\\r\\n } else {\\r\\n try {\\r\\n // Create a payment to the platform's account,\\r\\n // and set the `transfer_group` option to later link\\r\\n // with the Seller transfers after the Seller orders\\r\\n // have been created.\\r\\n const result = await sdk.createPayment({\\r\\n amount,\\r\\n currency: order.currencyCode,\\r\\n transfer_group: order.code,\\r\\n });\\r\\n return {\\r\\n amount,\\r\\n state: 'Settled' as const,\\r\\n transactionId: result.transactionId,\\r\\n metadata: {\\r\\n transfer_group: order.code,\\r\\n },\\r\\n };\\r\\n } catch (err: any) {\\r\\n return {\\r\\n amount,\\r\\n state: 'Declined' as const,\\r\\n metadata: {\\r\\n errorMessage: err.message,\\r\\n },\\r\\n };\\r\\n }\\r\\n }\\r\\n },\\r\\n settlePayment: async (ctx, order, payment, args) => {\\r\\n return { success: true };\\r\\n },\\r\\n});\\r\\n\"],\"names\":[\"multivendorPaymentMethodHandler\",\"sdk\",\"MyConnectSdk\",\"apiKey\",\"PaymentMethodHandler\",\"code\",\"description\",\"languageCode\",\"LanguageCode\",\"en\",\"value\",\"args\",\"createPayment\",\"ctx\",\"order\",\"amount\",\"metadata\",\"type\",\"OrderType\",\"Seller\",\"result\",\"createTransfer\",\"currency\",\"currencyCode\",\"connectedAccountId\",\"transfer_group\",\"state\",\"transactionId\",\"err\",\"errorMessage\",\"message\",\"settlePayment\",\"payment\",\"success\"],\"mappings\":\";;;;+BAaaA;;;eAAAA;;;gCAba;sBAOnB;8BAEsB;AAE7B,MAAMC,MAAM,IAAIC,0BAAY,CAAC;IAAEC,QAAQ;AAAa;AAE7C,MAAMH,kCAAkC,IAAII,0BAAoB,CAAC;IACpEC,MAAM;IACNC,aAAa;QACT;YACIC,cAAcC,kBAAY,CAACC,EAAE;YAC7BC,OAAO;QACX;KACH;IACDC,MAAM,CAAC;IACPC,eAAe,OAAOC,KAAKC,OAAOC,QAAQJ,MAAMK;QAC5C,IAAIF,MAAMG,IAAI,KAAKC,yBAAS,CAACC,MAAM,EAAE;YACjC,IAAI;gBACA,oDAAoD;gBACpD,MAAMC,SAAS,MAAMnB,IAAIoB,cAAc,CAAC;oBACpCN;oBACAO,UAAUR,MAAMS,YAAY;oBAC5BC,oBAAoBR,SAASQ,kBAAkB;oBAC/CC,gBAAgBT,SAASS,cAAc;gBAC3C;gBACA,OAAO;oBACHV;oBACAW,OAAO;oBACPC,eAAeP,OAAOO,aAAa;oBACnCX;gBACJ;YACJ,EAAE,OAAOY,KAAU;gBACf,OAAO;oBACHb;oBACAW,OAAO;oBACPV,UAAU;wBACNa,cAAcD,IAAIE,OAAO;oBAC7B;gBACJ;YACJ;QACJ,OAAO;YACH,IAAI;gBACA,8CAA8C;gBAC9C,oDAAoD;gBACpD,oDAAoD;gBACpD,qBAAqB;gBACrB,MAAMV,SAAS,MAAMnB,IAAIW,aAAa,CAAC;oBACnCG;oBACAO,UAAUR,MAAMS,YAAY;oBAC5BE,gBAAgBX,MAAMT,IAAI;gBAC9B;gBACA,OAAO;oBACHU;oBACAW,OAAO;oBACPC,eAAeP,OAAOO,aAAa;oBACnCX,UAAU;wBACNS,gBAAgBX,MAAMT,IAAI;oBAC9B;gBACJ;YACJ,EAAE,OAAOuB,KAAU;gBACf,OAAO;oBACHb;oBACAW,OAAO;oBACPV,UAAU;wBACNa,cAAcD,IAAIE,OAAO;oBAC7B;gBACJ;YACJ;QACJ;IACJ;IACAC,eAAe,OAAOlB,KAAKC,OAAOkB,SAASrB;QACvC,OAAO;YAAEsB,SAAS;QAAK;IAC3B;AACJ\"}"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "multivendorShippingEligibilityChecker", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return multivendorShippingEligibilityChecker;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _generatedtypes = require("@vendure/common/lib/generated-types");
|
|
12
|
+
const _sharedconstants = require("@vendure/common/lib/shared-constants");
|
|
13
|
+
const _core = require("@vendure/core");
|
|
14
|
+
let entityHydrator;
|
|
15
|
+
const multivendorShippingEligibilityChecker = new _core.ShippingEligibilityChecker({
|
|
16
|
+
code: 'multivendor-shipping-eligibility-checker',
|
|
17
|
+
description: [
|
|
18
|
+
{
|
|
19
|
+
languageCode: _generatedtypes.LanguageCode.en,
|
|
20
|
+
value: 'Multivendor Shipping Eligibility Checker'
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
args: {},
|
|
24
|
+
init (injector) {
|
|
25
|
+
entityHydrator = injector.get(_core.EntityHydrator);
|
|
26
|
+
},
|
|
27
|
+
check: async (ctx, order, args, method)=>{
|
|
28
|
+
await entityHydrator.hydrate(ctx, method, {
|
|
29
|
+
relations: [
|
|
30
|
+
'channels'
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
await entityHydrator.hydrate(ctx, order, {
|
|
34
|
+
relations: [
|
|
35
|
+
'lines.sellerChannel'
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
const sellerChannel = method.channels.find((c)=>c.code !== _sharedconstants.DEFAULT_CHANNEL_CODE);
|
|
39
|
+
if (!sellerChannel) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
for (const line of order.lines){
|
|
43
|
+
if (line.sellerChannelId && (0, _core.idsAreEqual)(line.sellerChannelId, sellerChannel.id)) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"{\"version\":3,\"sources\":[\"C:\\\\Development\\\\vendure\\\\vendure\\\\packages\\\\dev-server\\\\example-plugins\\\\multivendor-plugin\\\\config\\\\mv-shipping-eligibility-checker.ts\"],\"sourcesContent\":[\"import { LanguageCode } from '@vendure/common/lib/generated-types';\\nimport { DEFAULT_CHANNEL_CODE } from '@vendure/common/lib/shared-constants';\\nimport { EntityHydrator, idsAreEqual, ShippingEligibilityChecker } from '@vendure/core';\\n\\nlet entityHydrator: EntityHydrator;\\n\\n/**\\n * @description\\n * Shipping method is eligible if at least one OrderLine is associated with the Seller's Channel.\\n */\\nexport const multivendorShippingEligibilityChecker = new ShippingEligibilityChecker({\\n code: 'multivendor-shipping-eligibility-checker',\\n description: [{ languageCode: LanguageCode.en, value: 'Multivendor Shipping Eligibility Checker' }],\\n args: {},\\n init(injector) {\\n entityHydrator = injector.get(EntityHydrator);\\n },\\n check: async (ctx, order, args, method) => {\\n await entityHydrator.hydrate(ctx, method, { relations: ['channels'] });\\n await entityHydrator.hydrate(ctx, order, { relations: ['lines.sellerChannel'] });\\n const sellerChannel = method.channels.find(c => c.code !== DEFAULT_CHANNEL_CODE);\\n if (!sellerChannel) {\\n return false;\\n }\\n for (const line of order.lines) {\\n if (line.sellerChannelId && idsAreEqual(line.sellerChannelId, sellerChannel.id)) {\\n return true;\\n }\\n }\\n return false;\\n },\\n});\\n\"],\"names\":[\"multivendorShippingEligibilityChecker\",\"entityHydrator\",\"ShippingEligibilityChecker\",\"code\",\"description\",\"languageCode\",\"LanguageCode\",\"en\",\"value\",\"args\",\"init\",\"injector\",\"get\",\"EntityHydrator\",\"check\",\"ctx\",\"order\",\"method\",\"hydrate\",\"relations\",\"sellerChannel\",\"channels\",\"find\",\"c\",\"DEFAULT_CHANNEL_CODE\",\"line\",\"lines\",\"sellerChannelId\",\"idsAreEqual\",\"id\"],\"mappings\":\";;;;+BAUaA;;;eAAAA;;;gCAVgB;iCACQ;sBACmC;AAExE,IAAIC;AAMG,MAAMD,wCAAwC,IAAIE,gCAA0B,CAAC;IAChFC,MAAM;IACNC,aAAa;QAAC;YAAEC,cAAcC,4BAAY,CAACC,EAAE;YAAEC,OAAO;QAA2C;KAAE;IACnGC,MAAM,CAAC;IACPC,MAAKC,QAAQ;QACTV,iBAAiBU,SAASC,GAAG,CAACC,oBAAc;IAChD;IACAC,OAAO,OAAOC,KAAKC,OAAOP,MAAMQ;QAC5B,MAAMhB,eAAeiB,OAAO,CAACH,KAAKE,QAAQ;YAAEE,WAAW;gBAAC;aAAW;QAAC;QACpE,MAAMlB,eAAeiB,OAAO,CAACH,KAAKC,OAAO;YAAEG,WAAW;gBAAC;aAAsB;QAAC;QAC9E,MAAMC,gBAAgBH,OAAOI,QAAQ,CAACC,IAAI,CAACC,CAAAA,IAAKA,EAAEpB,IAAI,KAAKqB,qCAAoB;QAC/E,IAAI,CAACJ,eAAe;YAChB,OAAO;QACX;QACA,KAAK,MAAMK,QAAQT,MAAMU,KAAK,CAAE;YAC5B,IAAID,KAAKE,eAAe,IAAIC,IAAAA,iBAAW,EAACH,KAAKE,eAAe,EAAEP,cAAcS,EAAE,GAAG;gBAC7E,OAAO;YACX;QACJ;QACA,OAAO;IACX;AACJ\"}"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "MultivendorShippingLineAssignmentStrategy", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return MultivendorShippingLineAssignmentStrategy;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _core = require("@vendure/core");
|
|
12
|
+
function _define_property(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
25
|
+
class MultivendorShippingLineAssignmentStrategy {
|
|
26
|
+
init(injector) {
|
|
27
|
+
this.entityHydrator = injector.get(_core.EntityHydrator);
|
|
28
|
+
this.channelService = injector.get(_core.ChannelService);
|
|
29
|
+
}
|
|
30
|
+
async assignShippingLineToOrderLines(ctx, shippingLine, order) {
|
|
31
|
+
// First we need to ensure the required relations are available
|
|
32
|
+
// to work with.
|
|
33
|
+
const defaultChannel = await this.channelService.getDefaultChannel();
|
|
34
|
+
await this.entityHydrator.hydrate(ctx, shippingLine, {
|
|
35
|
+
relations: [
|
|
36
|
+
'shippingMethod.channels'
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
const { channels } = shippingLine.shippingMethod;
|
|
40
|
+
// We assume that, if a ShippingMethod is assigned to exactly 2 Channels,
|
|
41
|
+
// then one is the default Channel and the other is the seller's Channel.
|
|
42
|
+
if (channels.length === 2) {
|
|
43
|
+
const sellerChannel = channels.find((c)=>!(0, _core.idsAreEqual)(c.id, defaultChannel.id));
|
|
44
|
+
if (sellerChannel) {
|
|
45
|
+
// Once we have established the seller's Channel, we can filter the OrderLines
|
|
46
|
+
// that belong to that Channel. The `sellerChannelId` was previously established
|
|
47
|
+
// in the `OrderSellerStrategy.setOrderLineSellerChannel()` method.
|
|
48
|
+
return order.lines.filter((line)=>(0, _core.idsAreEqual)(line.sellerChannelId, sellerChannel.id));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return order.lines;
|
|
52
|
+
}
|
|
53
|
+
constructor(){
|
|
54
|
+
_define_property(this, "entityHydrator", void 0);
|
|
55
|
+
_define_property(this, "channelService", void 0);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"{\"version\":3,\"sources\":[\"C:\\\\Development\\\\vendure\\\\vendure\\\\packages\\\\dev-server\\\\example-plugins\\\\multivendor-plugin\\\\config\\\\mv-shipping-line-assignment-strategy.ts\"],\"sourcesContent\":[\"import {\\r\\n ChannelService,\\r\\n EntityHydrator,\\r\\n idsAreEqual,\\r\\n Injector,\\r\\n Order,\\r\\n OrderSellerStrategy,\\r\\n RequestContext,\\r\\n ShippingLine,\\r\\n ShippingLineAssignmentStrategy,\\r\\n} from '@vendure/core';\\r\\n\\r\\nexport class MultivendorShippingLineAssignmentStrategy implements ShippingLineAssignmentStrategy {\\r\\n private entityHydrator: EntityHydrator;\\r\\n private channelService: ChannelService;\\r\\n\\r\\n init(injector: Injector) {\\r\\n this.entityHydrator = injector.get(EntityHydrator);\\r\\n this.channelService = injector.get(ChannelService);\\r\\n }\\r\\n\\r\\n async assignShippingLineToOrderLines(ctx: RequestContext, shippingLine: ShippingLine, order: Order) {\\r\\n // First we need to ensure the required relations are available\\r\\n // to work with.\\r\\n const defaultChannel = await this.channelService.getDefaultChannel();\\r\\n await this.entityHydrator.hydrate(ctx, shippingLine, { relations: ['shippingMethod.channels'] });\\r\\n const { channels } = shippingLine.shippingMethod;\\r\\n\\r\\n // We assume that, if a ShippingMethod is assigned to exactly 2 Channels,\\r\\n // then one is the default Channel and the other is the seller's Channel.\\r\\n if (channels.length === 2) {\\r\\n const sellerChannel = channels.find(c => !idsAreEqual(c.id, defaultChannel.id));\\r\\n if (sellerChannel) {\\r\\n // Once we have established the seller's Channel, we can filter the OrderLines\\r\\n // that belong to that Channel. The `sellerChannelId` was previously established\\r\\n // in the `OrderSellerStrategy.setOrderLineSellerChannel()` method.\\r\\n return order.lines.filter(line => idsAreEqual(line.sellerChannelId, sellerChannel.id));\\r\\n }\\r\\n }\\r\\n return order.lines;\\r\\n }\\r\\n}\\r\\n\"],\"names\":[\"MultivendorShippingLineAssignmentStrategy\",\"init\",\"injector\",\"entityHydrator\",\"get\",\"EntityHydrator\",\"channelService\",\"ChannelService\",\"assignShippingLineToOrderLines\",\"ctx\",\"shippingLine\",\"order\",\"defaultChannel\",\"getDefaultChannel\",\"hydrate\",\"relations\",\"channels\",\"shippingMethod\",\"length\",\"sellerChannel\",\"find\",\"c\",\"idsAreEqual\",\"id\",\"lines\",\"filter\",\"line\",\"sellerChannelId\"],\"mappings\":\";;;;+BAYaA;;;eAAAA;;;sBAFN;;;;;;;;;;;;;;AAEA,MAAMA;IAITC,KAAKC,QAAkB,EAAE;QACrB,IAAI,CAACC,cAAc,GAAGD,SAASE,GAAG,CAACC,oBAAc;QACjD,IAAI,CAACC,cAAc,GAAGJ,SAASE,GAAG,CAACG,oBAAc;IACrD;IAEA,MAAMC,+BAA+BC,GAAmB,EAAEC,YAA0B,EAAEC,KAAY,EAAE;QAChG,+DAA+D;QAC/D,gBAAgB;QAChB,MAAMC,iBAAiB,MAAM,IAAI,CAACN,cAAc,CAACO,iBAAiB;QAClE,MAAM,IAAI,CAACV,cAAc,CAACW,OAAO,CAACL,KAAKC,cAAc;YAAEK,WAAW;gBAAC;aAA0B;QAAC;QAC9F,MAAM,EAAEC,QAAQ,EAAE,GAAGN,aAAaO,cAAc;QAEhD,yEAAyE;QACzE,yEAAyE;QACzE,IAAID,SAASE,MAAM,KAAK,GAAG;YACvB,MAAMC,gBAAgBH,SAASI,IAAI,CAACC,CAAAA,IAAK,CAACC,IAAAA,iBAAW,EAACD,EAAEE,EAAE,EAAEX,eAAeW,EAAE;YAC7E,IAAIJ,eAAe;gBACf,8EAA8E;gBAC9E,gFAAgF;gBAChF,mEAAmE;gBACnE,OAAOR,MAAMa,KAAK,CAACC,MAAM,CAACC,CAAAA,OAAQJ,IAAAA,iBAAW,EAACI,KAAKC,eAAe,EAAER,cAAcI,EAAE;YACxF;QACJ;QACA,OAAOZ,MAAMa,KAAK;IACtB;;QA3BA,uBAAQrB,kBAAR,KAAA;QACA,uBAAQG,kBAAR,KAAA;;AA2BJ\"}"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
CONNECTED_PAYMENT_METHOD_CODE: function() {
|
|
13
|
+
return CONNECTED_PAYMENT_METHOD_CODE;
|
|
14
|
+
},
|
|
15
|
+
MULTIVENDOR_PLUGIN_OPTIONS: function() {
|
|
16
|
+
return MULTIVENDOR_PLUGIN_OPTIONS;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const CONNECTED_PAYMENT_METHOD_CODE = 'connected-payment-method';
|
|
20
|
+
const MULTIVENDOR_PLUGIN_OPTIONS = Symbol('MULTIVENDOR_PLUGIN_OPTIONS');
|
package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/constants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"{\"version\":3,\"sources\":[\"C:\\\\Development\\\\vendure\\\\vendure\\\\packages\\\\dev-server\\\\example-plugins\\\\multivendor-plugin\\\\constants.ts\"],\"sourcesContent\":[\"export const CONNECTED_PAYMENT_METHOD_CODE = 'connected-payment-method';\\r\\nexport const MULTIVENDOR_PLUGIN_OPTIONS = Symbol('MULTIVENDOR_PLUGIN_OPTIONS');\\r\\n\"],\"names\":[\"CONNECTED_PAYMENT_METHOD_CODE\",\"MULTIVENDOR_PLUGIN_OPTIONS\",\"Symbol\"],\"mappings\":\";;;;;;;;;;;IAAaA,6BAA6B;eAA7BA;;IACAC,0BAA0B;eAA1BA;;;AADN,MAAMD,gCAAgC;AACtC,MAAMC,6BAA6BC,OAAO\"}"
|
package/dist/plugin/.vendure-dashboard-temp/example-plugins/multivendor-plugin/multivendor.plugin.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "MultivendorPlugin", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return MultivendorPlugin;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _core = require("@vendure/core");
|
|
12
|
+
const _apiextensions = require("./api/api-extensions");
|
|
13
|
+
const _mvresolver = require("./api/mv.resolver");
|
|
14
|
+
const _mvorderprocess = require("./config/mv-order-process");
|
|
15
|
+
const _mvordersellerstrategy = require("./config/mv-order-seller-strategy");
|
|
16
|
+
const _mvpaymenthandler = require("./config/mv-payment-handler");
|
|
17
|
+
const _mvshippingeligibilitychecker = require("./config/mv-shipping-eligibility-checker");
|
|
18
|
+
const _mvshippinglineassignmentstrategy = require("./config/mv-shipping-line-assignment-strategy");
|
|
19
|
+
const _constants = require("./constants");
|
|
20
|
+
const _mvservice = require("./service/mv.service");
|
|
21
|
+
function _define_property(obj, key, value) {
|
|
22
|
+
if (key in obj) {
|
|
23
|
+
Object.defineProperty(obj, key, {
|
|
24
|
+
value: value,
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
obj[key] = value;
|
|
31
|
+
}
|
|
32
|
+
return obj;
|
|
33
|
+
}
|
|
34
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
35
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
36
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
37
|
+
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;
|
|
38
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
39
|
+
}
|
|
40
|
+
function _ts_metadata(k, v) {
|
|
41
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
42
|
+
}
|
|
43
|
+
class MultivendorPlugin {
|
|
44
|
+
static init(options) {
|
|
45
|
+
MultivendorPlugin.options = options;
|
|
46
|
+
return MultivendorPlugin;
|
|
47
|
+
}
|
|
48
|
+
async onApplicationBootstrap() {
|
|
49
|
+
await this.ensureConnectedPaymentMethodExists();
|
|
50
|
+
}
|
|
51
|
+
async ensureConnectedPaymentMethodExists() {
|
|
52
|
+
const paymentMethod = await this.connection.rawConnection.getRepository(_core.PaymentMethod).findOne({
|
|
53
|
+
where: {
|
|
54
|
+
code: _constants.CONNECTED_PAYMENT_METHOD_CODE
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
if (!paymentMethod) {
|
|
58
|
+
const ctx = await this.requestContextService.create({
|
|
59
|
+
apiType: 'admin'
|
|
60
|
+
});
|
|
61
|
+
const allChannels = await this.connection.getRepository(ctx, _core.Channel).find();
|
|
62
|
+
const createdPaymentMethod = await this.paymentMethodService.create(ctx, {
|
|
63
|
+
code: _constants.CONNECTED_PAYMENT_METHOD_CODE,
|
|
64
|
+
enabled: true,
|
|
65
|
+
handler: {
|
|
66
|
+
code: _mvpaymenthandler.multivendorPaymentMethodHandler.code,
|
|
67
|
+
arguments: []
|
|
68
|
+
},
|
|
69
|
+
translations: [
|
|
70
|
+
{
|
|
71
|
+
languageCode: _core.LanguageCode.en,
|
|
72
|
+
name: 'Connected Payments'
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
await this.channelService.assignToChannels(ctx, _core.PaymentMethod, createdPaymentMethod.id, allChannels.map((c)=>c.id));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
constructor(connection, channelService, requestContextService, paymentMethodService){
|
|
80
|
+
_define_property(this, "connection", void 0);
|
|
81
|
+
_define_property(this, "channelService", void 0);
|
|
82
|
+
_define_property(this, "requestContextService", void 0);
|
|
83
|
+
_define_property(this, "paymentMethodService", void 0);
|
|
84
|
+
this.connection = connection;
|
|
85
|
+
this.channelService = channelService;
|
|
86
|
+
this.requestContextService = requestContextService;
|
|
87
|
+
this.paymentMethodService = paymentMethodService;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
_define_property(MultivendorPlugin, "options", void 0);
|
|
91
|
+
MultivendorPlugin = _ts_decorate([
|
|
92
|
+
(0, _core.VendurePlugin)({
|
|
93
|
+
imports: [
|
|
94
|
+
_core.PluginCommonModule
|
|
95
|
+
],
|
|
96
|
+
configuration: (config)=>{
|
|
97
|
+
config.customFields.Seller.push({
|
|
98
|
+
name: 'connectedAccountId',
|
|
99
|
+
label: [
|
|
100
|
+
{
|
|
101
|
+
languageCode: _core.LanguageCode.en,
|
|
102
|
+
value: 'Connected account ID'
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
description: [
|
|
106
|
+
{
|
|
107
|
+
languageCode: _core.LanguageCode.en,
|
|
108
|
+
value: 'The ID used to process connected payments'
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
type: 'string',
|
|
112
|
+
public: false
|
|
113
|
+
});
|
|
114
|
+
config.paymentOptions.paymentMethodHandlers.push(_mvpaymenthandler.multivendorPaymentMethodHandler);
|
|
115
|
+
const customDefaultOrderProcess = (0, _core.configureDefaultOrderProcess)({
|
|
116
|
+
checkFulfillmentStates: false
|
|
117
|
+
});
|
|
118
|
+
config.orderOptions.process = [
|
|
119
|
+
customDefaultOrderProcess,
|
|
120
|
+
_mvorderprocess.multivendorOrderProcess
|
|
121
|
+
];
|
|
122
|
+
config.orderOptions.orderSellerStrategy = new _mvordersellerstrategy.MultivendorSellerStrategy();
|
|
123
|
+
config.catalogOptions.productVariantPriceUpdateStrategy = new _core.DefaultProductVariantPriceUpdateStrategy({
|
|
124
|
+
syncPricesAcrossChannels: true
|
|
125
|
+
});
|
|
126
|
+
config.shippingOptions.shippingEligibilityCheckers.push(_mvshippingeligibilitychecker.multivendorShippingEligibilityChecker);
|
|
127
|
+
config.shippingOptions.shippingLineAssignmentStrategy = new _mvshippinglineassignmentstrategy.MultivendorShippingLineAssignmentStrategy();
|
|
128
|
+
return config;
|
|
129
|
+
},
|
|
130
|
+
shopApiExtensions: {
|
|
131
|
+
schema: _apiextensions.shopApiExtensions,
|
|
132
|
+
resolvers: [
|
|
133
|
+
_mvresolver.MultivendorResolver
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
providers: [
|
|
137
|
+
_mvservice.MultivendorService,
|
|
138
|
+
{
|
|
139
|
+
provide: _constants.MULTIVENDOR_PLUGIN_OPTIONS,
|
|
140
|
+
useFactory: ()=>MultivendorPlugin.options
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}),
|
|
144
|
+
_ts_metadata("design:type", Function),
|
|
145
|
+
_ts_metadata("design:paramtypes", [
|
|
146
|
+
typeof _core.TransactionalConnection === "undefined" ? Object : _core.TransactionalConnection,
|
|
147
|
+
typeof _core.ChannelService === "undefined" ? Object : _core.ChannelService,
|
|
148
|
+
typeof _core.RequestContextService === "undefined" ? Object : _core.RequestContextService,
|
|
149
|
+
typeof _core.PaymentMethodService === "undefined" ? Object : _core.PaymentMethodService
|
|
150
|
+
])
|
|
151
|
+
], MultivendorPlugin);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"{\"version\":3,\"sources\":[\"C:\\\\Development\\\\vendure\\\\vendure\\\\packages\\\\dev-server\\\\example-plugins\\\\multivendor-plugin\\\\multivendor.plugin.ts\"],\"sourcesContent\":[\"import { OnApplicationBootstrap } from '@nestjs/common';\\r\\nimport {\\r\\n Channel,\\r\\n ChannelService,\\r\\n configureDefaultOrderProcess,\\r\\n DefaultProductVariantPriceUpdateStrategy,\\r\\n LanguageCode,\\r\\n PaymentMethod,\\r\\n PaymentMethodService,\\r\\n PluginCommonModule,\\r\\n RequestContextService,\\r\\n TransactionalConnection,\\r\\n VendurePlugin,\\r\\n} from '@vendure/core';\\r\\n\\r\\nimport { shopApiExtensions } from './api/api-extensions';\\r\\nimport { MultivendorResolver } from './api/mv.resolver';\\r\\nimport { multivendorOrderProcess } from './config/mv-order-process';\\r\\nimport { MultivendorSellerStrategy } from './config/mv-order-seller-strategy';\\r\\nimport { multivendorPaymentMethodHandler } from './config/mv-payment-handler';\\r\\nimport { multivendorShippingEligibilityChecker } from './config/mv-shipping-eligibility-checker';\\r\\nimport { MultivendorShippingLineAssignmentStrategy } from './config/mv-shipping-line-assignment-strategy';\\r\\nimport { CONNECTED_PAYMENT_METHOD_CODE, MULTIVENDOR_PLUGIN_OPTIONS } from './constants';\\r\\nimport { MultivendorService } from './service/mv.service';\\r\\nimport { MultivendorPluginOptions } from './types';\\r\\n\\r\\n/**\\r\\n * @description\\r\\n * This is an example of how to implement a multivendor marketplace app using the new features introduced in\\r\\n * Vendure v2.0.\\r\\n *\\r\\n * ## Setup\\r\\n *\\r\\n * Add this plugin to your VendureConfig:\\r\\n * ```ts\\r\\n * plugins: [\\r\\n * MultivendorPlugin.init({\\r\\n * platformFeePercent: 10,\\r\\n * platformFeeSKU: 'FEE',\\r\\n * }),\\r\\n * // ...\\r\\n * ]\\r\\n * ```\\r\\n *\\r\\n * ## Create a Seller\\r\\n *\\r\\n * Now you can create new sellers with the following mutation:\\r\\n *\\r\\n * ```graphql\\r\\n * mutation RegisterSeller {\\r\\n * registerNewSeller(input: {\\r\\n * shopName: \\\"Bob's Parts\\\",\\r\\n * seller {\\r\\n * firstName: \\\"Bob\\\"\\r\\n * lastName: \\\"Dobalina\\\"\\r\\n * emailAddress: \\\"bob@bobs-parts.com\\\"\\r\\n * password: \\\"test\\\",\\r\\n * }\\r\\n * }) {\\r\\n * id\\r\\n * code\\r\\n * token\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * This mutation will:\\r\\n *\\r\\n * - Create a new Seller representing the shop \\\"Bob's Parts\\\"\\r\\n * - Create a new Channel and associate it with the new Seller\\r\\n * - Create a Role & Administrator for Bob to access his shop admin account\\r\\n * - Create a ShippingMethod for Bob's shop\\r\\n * - Create a StockLocation for Bob's shop\\r\\n *\\r\\n * Bob can then go and sign in to the Admin UI using the provided emailAddress & password credentials, and start\\r\\n * creating some products.\\r\\n *\\r\\n * Repeat this process for more Sellers.\\r\\n *\\r\\n * ## Storefront\\r\\n *\\r\\n * To create a multivendor Order, use the default Channel in the storefront and add variants to an Order from\\r\\n * various Sellers.\\r\\n *\\r\\n * ### Shipping\\r\\n *\\r\\n * When it comes to setting the shipping method, the `eligibleShippingMethods` query should just return the\\r\\n * shipping methods for the shops from which the OrderLines come. So assuming the Order contains items from 3 different\\r\\n * Sellers, there should be at least 3 eligible ShippingMethods (plus any global ones from the default Channel).\\r\\n *\\r\\n * You should now select the IDs of all the Seller-specific ShippingMethods:\\r\\n *\\r\\n * ```graphql\\r\\n * mutation {\\r\\n * setOrderShippingMethod(shippingMethodId: [\\\"3\\\", \\\"4\\\"]) {\\r\\n * ... on Order {\\r\\n * id\\r\\n * }\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * ### Payment\\r\\n *\\r\\n * This plugin automatically creates a \\\"connected payment method\\\" in the default Channel, which is a simple simulation\\r\\n * of something like Stripe Connect.\\r\\n *\\r\\n * ```graphql\\r\\n * mutation {\\r\\n * addPaymentToOrder(input: { method: \\\"connected-payment-method\\\", metadata: {} }) {\\r\\n * ... on Order { id }\\r\\n * ... on ErrorResult {\\r\\n * errorCode\\r\\n * message\\r\\n * }\\r\\n * ... on PaymentFailedError {\\r\\n * paymentErrorMessage\\r\\n * }\\r\\n * }\\r\\n * }\\r\\n * ```\\r\\n *\\r\\n * After that, you should be able to see that the Order has been split into an \\\"aggregate\\\" order in the default Channel,\\r\\n * and then one or more \\\"seller\\\" orders in each Channel from which the customer bought items.\\r\\n */\\r\\n@VendurePlugin({\\r\\n imports: [PluginCommonModule],\\r\\n configuration: config => {\\r\\n config.customFields.Seller.push({\\r\\n name: 'connectedAccountId',\\r\\n label: [{ languageCode: LanguageCode.en, value: 'Connected account ID' }],\\r\\n description: [\\r\\n { languageCode: LanguageCode.en, value: 'The ID used to process connected payments' },\\r\\n ],\\r\\n type: 'string',\\r\\n public: false,\\r\\n });\\r\\n config.paymentOptions.paymentMethodHandlers.push(multivendorPaymentMethodHandler);\\r\\n\\r\\n const customDefaultOrderProcess = configureDefaultOrderProcess({\\r\\n checkFulfillmentStates: false,\\r\\n });\\r\\n config.orderOptions.process = [customDefaultOrderProcess, multivendorOrderProcess];\\r\\n config.orderOptions.orderSellerStrategy = new MultivendorSellerStrategy();\\r\\n config.catalogOptions.productVariantPriceUpdateStrategy =\\r\\n new DefaultProductVariantPriceUpdateStrategy({\\r\\n syncPricesAcrossChannels: true,\\r\\n });\\r\\n config.shippingOptions.shippingEligibilityCheckers.push(multivendorShippingEligibilityChecker);\\r\\n config.shippingOptions.shippingLineAssignmentStrategy =\\r\\n new MultivendorShippingLineAssignmentStrategy();\\r\\n return config;\\r\\n },\\r\\n shopApiExtensions: {\\r\\n schema: shopApiExtensions,\\r\\n resolvers: [MultivendorResolver],\\r\\n },\\r\\n providers: [\\r\\n MultivendorService,\\r\\n { provide: MULTIVENDOR_PLUGIN_OPTIONS, useFactory: () => MultivendorPlugin.options },\\r\\n ],\\r\\n})\\r\\nexport class MultivendorPlugin implements OnApplicationBootstrap {\\r\\n static options: MultivendorPluginOptions;\\r\\n\\r\\n constructor(\\r\\n private connection: TransactionalConnection,\\r\\n private channelService: ChannelService,\\r\\n private requestContextService: RequestContextService,\\r\\n private paymentMethodService: PaymentMethodService,\\r\\n ) {}\\r\\n\\r\\n static init(options: MultivendorPluginOptions) {\\r\\n MultivendorPlugin.options = options;\\r\\n return MultivendorPlugin;\\r\\n }\\r\\n\\r\\n async onApplicationBootstrap() {\\r\\n await this.ensureConnectedPaymentMethodExists();\\r\\n }\\r\\n\\r\\n private async ensureConnectedPaymentMethodExists() {\\r\\n const paymentMethod = await this.connection.rawConnection.getRepository(PaymentMethod).findOne({\\r\\n where: {\\r\\n code: CONNECTED_PAYMENT_METHOD_CODE,\\r\\n },\\r\\n });\\r\\n if (!paymentMethod) {\\r\\n const ctx = await this.requestContextService.create({ apiType: 'admin' });\\r\\n const allChannels = await this.connection.getRepository(ctx, Channel).find();\\r\\n const createdPaymentMethod = await this.paymentMethodService.create(ctx, {\\r\\n code: CONNECTED_PAYMENT_METHOD_CODE,\\r\\n enabled: true,\\r\\n handler: {\\r\\n code: multivendorPaymentMethodHandler.code,\\r\\n arguments: [],\\r\\n },\\r\\n translations: [\\r\\n {\\r\\n languageCode: LanguageCode.en,\\r\\n name: 'Connected Payments',\\r\\n },\\r\\n ],\\r\\n });\\r\\n await this.channelService.assignToChannels(\\r\\n ctx,\\r\\n PaymentMethod,\\r\\n createdPaymentMethod.id,\\r\\n allChannels.map(c => c.id),\\r\\n );\\r\\n }\\r\\n }\\r\\n}\\r\\n\"],\"names\":[\"MultivendorPlugin\",\"init\",\"options\",\"onApplicationBootstrap\",\"ensureConnectedPaymentMethodExists\",\"paymentMethod\",\"connection\",\"rawConnection\",\"getRepository\",\"PaymentMethod\",\"findOne\",\"where\",\"code\",\"CONNECTED_PAYMENT_METHOD_CODE\",\"ctx\",\"requestContextService\",\"create\",\"apiType\",\"allChannels\",\"Channel\",\"find\",\"createdPaymentMethod\",\"paymentMethodService\",\"enabled\",\"handler\",\"multivendorPaymentMethodHandler\",\"arguments\",\"translations\",\"languageCode\",\"LanguageCode\",\"en\",\"name\",\"channelService\",\"assignToChannels\",\"id\",\"map\",\"c\",\"constructor\",\"imports\",\"PluginCommonModule\",\"configuration\",\"config\",\"customFields\",\"Seller\",\"push\",\"label\",\"value\",\"description\",\"type\",\"public\",\"paymentOptions\",\"paymentMethodHandlers\",\"customDefaultOrderProcess\",\"configureDefaultOrderProcess\",\"checkFulfillmentStates\",\"orderOptions\",\"process\",\"multivendorOrderProcess\",\"orderSellerStrategy\",\"MultivendorSellerStrategy\",\"catalogOptions\",\"productVariantPriceUpdateStrategy\",\"DefaultProductVariantPriceUpdateStrategy\",\"syncPricesAcrossChannels\",\"shippingOptions\",\"shippingEligibilityCheckers\",\"multivendorShippingEligibilityChecker\",\"shippingLineAssignmentStrategy\",\"MultivendorShippingLineAssignmentStrategy\",\"shopApiExtensions\",\"schema\",\"resolvers\",\"MultivendorResolver\",\"providers\",\"MultivendorService\",\"provide\",\"MULTIVENDOR_PLUGIN_OPTIONS\",\"useFactory\"],\"mappings\":\"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\"}"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* A fake payment API based loosely on the Stripe Connect multiparty payments flow
|
|
4
|
+
* described here: https://stripe.com/docs/connect/charges-transfers
|
|
5
|
+
*/ "use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
Object.defineProperty(exports, "MyConnectSdk", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return MyConnectSdk;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
function _define_property(obj, key, value) {
|
|
16
|
+
if (key in obj) {
|
|
17
|
+
Object.defineProperty(obj, key, {
|
|
18
|
+
value: value,
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true
|
|
22
|
+
});
|
|
23
|
+
} else {
|
|
24
|
+
obj[key] = value;
|
|
25
|
+
}
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
class MyConnectSdk {
|
|
29
|
+
/**
|
|
30
|
+
* Used to create a payment on the platform itself.
|
|
31
|
+
*/ async createPayment(options) {
|
|
32
|
+
return {
|
|
33
|
+
transactionId: Math.random().toString(36).substring(3)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Used to create a transfer payment to a Seller.
|
|
38
|
+
*/ async createTransfer(options) {
|
|
39
|
+
return {
|
|
40
|
+
transactionId: Math.random().toString(36).substring(3)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
constructor(options){
|
|
44
|
+
_define_property(this, "options", void 0);
|
|
45
|
+
this.options = options;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"{\"version\":3,\"sources\":[\"C:\\\\Development\\\\vendure\\\\vendure\\\\packages\\\\dev-server\\\\example-plugins\\\\multivendor-plugin\\\\payment\\\\mv-connect-sdk.ts\"],\"sourcesContent\":[\"/**\\r\\n * @description\\r\\n * A fake payment API based loosely on the Stripe Connect multiparty payments flow\\r\\n * described here: https://stripe.com/docs/connect/charges-transfers\\r\\n */\\r\\nexport class MyConnectSdk {\\r\\n constructor(private options: { apiKey: string }) {}\\r\\n\\r\\n /**\\r\\n * Used to create a payment on the platform itself.\\r\\n */\\r\\n async createPayment(options: { amount: number; currency: string; transfer_group: string }) {\\r\\n return { transactionId: Math.random().toString(36).substring(3) };\\r\\n }\\r\\n\\r\\n /**\\r\\n * Used to create a transfer payment to a Seller.\\r\\n */\\r\\n async createTransfer(options: {\\r\\n amount: number;\\r\\n currency: string;\\r\\n connectedAccountId: string;\\r\\n transfer_group: string;\\r\\n }) {\\r\\n return { transactionId: Math.random().toString(36).substring(3) };\\r\\n }\\r\\n}\\r\\n\"],\"names\":[\"MyConnectSdk\",\"createPayment\",\"options\",\"transactionId\",\"Math\",\"random\",\"toString\",\"substring\",\"createTransfer\",\"constructor\"],\"mappings\":\"AAAA;;;;CAIC;;;;+BACYA;;;eAAAA;;;;;;;;;;;;;;;;AAAN,MAAMA;IAGT;;KAEC,GACD,MAAMC,cAAcC,OAAqE,EAAE;QACvF,OAAO;YAAEC,eAAeC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC;QAAG;IACpE;IAEA;;KAEC,GACD,MAAMC,eAAeN,OAKpB,EAAE;QACC,OAAO;YAAEC,eAAeC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC;QAAG;IACpE;IAnBAE,YAAY,AAAQP,OAA2B,CAAE;;aAA7BA,UAAAA;IAA8B;AAoBtD\"}"
|