@meeovi/layer-shared 1.1.4 → 1.1.5
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/dist/api/global-search.d.ts +8 -0
- package/dist/api/global-search.js +1 -0
- package/dist/app/components/Gallery/__tests__/Gallery.spec.d.ts +1 -0
- package/dist/app/components/Gallery/__tests__/Gallery.spec.js +12 -0
- package/dist/app/components/Heading/__tests__/Heading.spec.d.ts +1 -0
- package/dist/app/components/Heading/__tests__/Heading.spec.js +12 -0
- package/dist/app/components/Heading/types.d.ts +5 -0
- package/dist/app/components/Heading/types.js +1 -0
- package/dist/app/components/ui/AccordionItem/__tests__/AccordionItem.spec.d.ts +1 -0
- package/dist/app/components/ui/AccordionItem/__tests__/AccordionItem.spec.js +12 -0
- package/dist/app/components/ui/AccordionItem/types.d.ts +5 -0
- package/dist/app/components/ui/AccordionItem/types.js +1 -0
- package/dist/app/components/ui/Alert/types.d.ts +5 -0
- package/dist/app/components/ui/Alert/types.js +1 -0
- package/dist/app/components/ui/Breadcrumbs/__tests__/Breadcrumbs.spec.d.ts +1 -0
- package/dist/app/components/ui/Breadcrumbs/__tests__/Breadcrumbs.spec.js +12 -0
- package/dist/app/components/ui/Breadcrumbs/types.d.ts +7 -0
- package/dist/app/components/ui/Breadcrumbs/types.js +1 -0
- package/dist/app/components/ui/CartProductCard/types.d.ts +17 -0
- package/dist/app/components/ui/CartProductCard/types.js +1 -0
- package/dist/app/components/ui/CategoryCard/types.d.ts +8 -0
- package/dist/app/components/ui/CategoryCard/types.js +1 -0
- package/dist/app/components/ui/Display/types.d.ts +12 -0
- package/dist/app/components/ui/Display/types.js +1 -0
- package/dist/app/components/ui/Divider/__tests__/Divider.spec.d.ts +1 -0
- package/dist/app/components/ui/Divider/__tests__/Divider.spec.js +8 -0
- package/dist/app/components/ui/Form/__tests__/FormHelperText.spec.d.ts +1 -0
- package/dist/app/components/ui/Form/__tests__/FormHelperText.spec.js +8 -0
- package/dist/app/components/ui/Form/__tests__/FormLabel.spec.d.ts +1 -0
- package/dist/app/components/ui/Form/__tests__/FormLabel.spec.js +8 -0
- package/dist/app/components/ui/Hero/types.d.ts +10 -0
- package/dist/app/components/ui/Hero/types.js +1 -0
- package/dist/app/components/ui/Modal/types.d.ts +7 -0
- package/dist/app/components/ui/Modal/types.js +1 -0
- package/dist/app/components/ui/Overlay/__tests__/Overlay.spec.d.ts +1 -0
- package/dist/app/components/ui/Overlay/__tests__/Overlay.spec.js +12 -0
- package/dist/app/components/ui/Overlay/types.d.ts +3 -0
- package/dist/app/components/ui/Overlay/types.js +1 -0
- package/dist/app/components/ui/Pagination/__tests__/Pagination.spec.d.ts +1 -0
- package/dist/app/components/ui/Pagination/__tests__/Pagination.spec.js +15 -0
- package/dist/app/components/ui/Pagination/types.d.ts +6 -0
- package/dist/app/components/ui/Pagination/types.js +1 -0
- package/dist/app/components/ui/ProductCard/__tests__/ProductCard.spec.d.ts +1 -0
- package/dist/app/components/ui/ProductCard/__tests__/ProductCard.spec.js +14 -0
- package/dist/app/components/ui/ProductCard/types.d.ts +12 -0
- package/dist/app/components/ui/ProductCard/types.js +1 -0
- package/dist/app/components/ui/ProductCardHorizontal/__tests__/ProductCardHorizontal.spec.d.ts +1 -0
- package/dist/app/components/ui/ProductCardHorizontal/__tests__/ProductCardHorizontal.spec.js +34 -0
- package/dist/app/components/ui/ProductCardHorizontal/types.d.ts +4 -0
- package/dist/app/components/ui/ProductCardHorizontal/types.js +1 -0
- package/dist/app/components/ui/PurchaseCard/__tests__/PurchaseCard.spec.d.ts +1 -0
- package/dist/app/components/ui/PurchaseCard/__tests__/PurchaseCard.spec.js +12 -0
- package/dist/app/components/ui/PurchaseCard/types.d.ts +4 -0
- package/dist/app/components/ui/PurchaseCard/types.js +1 -0
- package/dist/app/components/ui/QuantitySelector/__tests__/QuantitySelector.spec.d.ts +1 -0
- package/dist/app/components/ui/QuantitySelector/__tests__/QuantitySelector.spec.js +13 -0
- package/dist/app/components/ui/QuantitySelector/types.d.ts +5 -0
- package/dist/app/components/ui/QuantitySelector/types.js +1 -0
- package/dist/app/components/ui/Review/__tests__/Review.spec.d.ts +1 -0
- package/dist/app/components/ui/Review/__tests__/Review.spec.js +13 -0
- package/dist/app/components/ui/Review/types.d.ts +4 -0
- package/dist/app/components/ui/Review/types.js +1 -0
- package/dist/app/components/ui/Tag/__tests__/Tag.spec.d.ts +1 -0
- package/dist/app/components/ui/Tag/__tests__/Tag.spec.js +8 -0
- package/dist/app/components/ui/Tag/types.d.ts +14 -0
- package/dist/app/components/ui/Tag/types.js +11 -0
- package/dist/app/composables/globals/useAdminTable.d.ts +3 -0
- package/dist/app/composables/globals/useAdminTable.js +9 -0
- package/dist/app/composables/globals/useCustomFetch.d.ts +2 -0
- package/dist/app/composables/globals/useCustomFetch.js +8 -0
- package/dist/app/composables/globals/useDirectusField.d.ts +10 -0
- package/dist/app/composables/globals/useDirectusField.js +119 -0
- package/dist/app/composables/globals/useDirectusForm.d.ts +10 -0
- package/dist/app/composables/globals/useDirectusForm.js +66 -0
- package/dist/app/composables/globals/useFileManager.d.ts +14 -0
- package/dist/app/composables/globals/useFileManager.js +62 -0
- package/dist/app/composables/globals/useLivePreview.d.ts +1 -0
- package/dist/app/composables/globals/useLivePreview.js +16 -0
- package/dist/app/composables/globals/useLoading.d.ts +6 -0
- package/dist/app/composables/globals/useLoading.js +19 -0
- package/dist/app/composables/globals/useNotifications.d.ts +35 -0
- package/dist/app/composables/globals/useNotifications.js +133 -0
- package/dist/app/composables/globals/useRichText.d.ts +1 -0
- package/dist/app/composables/globals/useRichText.js +32 -0
- package/dist/app/composables/globals/useServerRootMixin.d.ts +3 -0
- package/dist/app/composables/globals/useServerRootMixin.js +15 -0
- package/dist/app/composables/globals/useVisualEditing.d.ts +17 -0
- package/dist/app/composables/globals/useVisualEditing.js +27 -0
- package/dist/app/composables/mappers/createMapper.d.ts +2 -0
- package/dist/app/composables/mappers/createMapper.js +6 -0
- package/dist/app/composables/mappers/errors.d.ts +6 -0
- package/dist/app/composables/mappers/errors.js +12 -0
- package/dist/app/composables/mappers/index.d.ts +6 -0
- package/dist/app/composables/mappers/index.js +7 -0
- package/dist/app/composables/mappers/registry.d.ts +5 -0
- package/dist/app/composables/mappers/registry.js +18 -0
- package/dist/app/composables/mappers/testHarness.d.ts +13 -0
- package/dist/app/composables/mappers/testHarness.js +98 -0
- package/dist/app/composables/mappers/types.d.ts +5 -0
- package/dist/app/composables/mappers/types.js +1 -0
- package/dist/app/composables/mappers/zodMapper.d.ts +9 -0
- package/dist/app/composables/mappers/zodMapper.js +17 -0
- package/dist/app/composables/media/useFile.d.ts +2 -0
- package/dist/app/composables/media/useFile.js +4 -0
- package/dist/app/composables/media/useMediaCenter.d.ts +29 -0
- package/dist/app/composables/media/useMediaCenter.js +321 -0
- package/dist/app/composables/media/useVideojs.d.ts +11 -0
- package/dist/app/composables/media/useVideojs.js +42 -0
- package/dist/app/composables/registry.d.ts +3 -0
- package/dist/app/composables/registry.js +10 -0
- package/dist/app/composables/schema/commerce/attributes.d.ts +7 -0
- package/dist/app/composables/schema/commerce/attributes.js +1 -0
- package/dist/app/composables/schema/commerce/blocks.d.ts +6 -0
- package/dist/app/composables/schema/commerce/blocks.js +1 -0
- package/dist/app/composables/schema/commerce/bundleProduts.d.ts +10 -0
- package/dist/app/composables/schema/commerce/bundleProduts.js +1 -0
- package/dist/app/composables/schema/commerce/cart.d.ts +29 -0
- package/dist/app/composables/schema/commerce/cart.js +1 -0
- package/dist/app/composables/schema/commerce/category.d.ts +12 -0
- package/dist/app/composables/schema/commerce/category.js +1 -0
- package/dist/app/composables/schema/commerce/checkout.d.ts +9 -0
- package/dist/app/composables/schema/commerce/checkout.js +1 -0
- package/dist/app/composables/schema/commerce/company.d.ts +7 -0
- package/dist/app/composables/schema/commerce/company.js +1 -0
- package/dist/app/composables/schema/commerce/configurableProducts.d.ts +12 -0
- package/dist/app/composables/schema/commerce/configurableProducts.js +1 -0
- package/dist/app/composables/schema/commerce/coupons.d.ts +9 -0
- package/dist/app/composables/schema/commerce/coupons.js +1 -0
- package/dist/app/composables/schema/commerce/credit-memos.d.ts +48 -0
- package/dist/app/composables/schema/commerce/credit-memos.js +1 -0
- package/dist/app/composables/schema/commerce/digitalProducts.d.ts +11 -0
- package/dist/app/composables/schema/commerce/digitalProducts.js +1 -0
- package/dist/app/composables/schema/commerce/directory.d.ts +7 -0
- package/dist/app/composables/schema/commerce/directory.js +1 -0
- package/dist/app/composables/schema/commerce/events.d.ts +27 -0
- package/dist/app/composables/schema/commerce/events.js +1 -0
- package/dist/app/composables/schema/commerce/gift-registry.d.ts +7 -0
- package/dist/app/composables/schema/commerce/gift-registry.js +1 -0
- package/dist/app/composables/schema/commerce/guest-cart.d.ts +4 -0
- package/dist/app/composables/schema/commerce/guest-cart.js +1 -0
- package/dist/app/composables/schema/commerce/inventory.d.ts +8 -0
- package/dist/app/composables/schema/commerce/inventory.js +1 -0
- package/dist/app/composables/schema/commerce/invoices.d.ts +47 -0
- package/dist/app/composables/schema/commerce/invoices.js +1 -0
- package/dist/app/composables/schema/commerce/orders.d.ts +32 -0
- package/dist/app/composables/schema/commerce/orders.js +1 -0
- package/dist/app/composables/schema/commerce/payments.d.ts +8 -0
- package/dist/app/composables/schema/commerce/payments.js +1 -0
- package/dist/app/composables/schema/commerce/price.d.ts +9 -0
- package/dist/app/composables/schema/commerce/price.js +1 -0
- package/dist/app/composables/schema/commerce/product-types.d.ts +6 -0
- package/dist/app/composables/schema/commerce/product-types.js +1 -0
- package/dist/app/composables/schema/commerce/product.d.ts +20 -0
- package/dist/app/composables/schema/commerce/product.js +1 -0
- package/dist/app/composables/schema/commerce/quotes.d.ts +13 -0
- package/dist/app/composables/schema/commerce/quotes.js +1 -0
- package/dist/app/composables/schema/commerce/requisition-lists.d.ts +9 -0
- package/dist/app/composables/schema/commerce/requisition-lists.js +1 -0
- package/dist/app/composables/schema/commerce/returns.d.ts +8 -0
- package/dist/app/composables/schema/commerce/returns.js +1 -0
- package/dist/app/composables/schema/commerce/reward.d.ts +7 -0
- package/dist/app/composables/schema/commerce/reward.js +1 -0
- package/dist/app/composables/schema/commerce/rules.d.ts +7 -0
- package/dist/app/composables/schema/commerce/rules.js +1 -0
- package/dist/app/composables/schema/commerce/shipment.d.ts +18 -0
- package/dist/app/composables/schema/commerce/shipment.js +1 -0
- package/dist/app/composables/schema/commerce/shops.d.ts +8 -0
- package/dist/app/composables/schema/commerce/shops.js +1 -0
- package/dist/app/composables/schema/commerce/stockItems.d.ts +7 -0
- package/dist/app/composables/schema/commerce/stockItems.js +1 -0
- package/dist/app/composables/schema/commerce/store.d.ts +7 -0
- package/dist/app/composables/schema/commerce/store.js +1 -0
- package/dist/app/composables/schema/commerce/subscriptons.d.ts +9 -0
- package/dist/app/composables/schema/commerce/subscriptons.js +1 -0
- package/dist/app/composables/schema/commerce/taxRates.d.ts +7 -0
- package/dist/app/composables/schema/commerce/taxRates.js +1 -0
- package/dist/app/composables/schema/commerce/taxRules.d.ts +7 -0
- package/dist/app/composables/schema/commerce/taxRules.js +1 -0
- package/dist/app/composables/schema/commerce/teams.d.ts +6 -0
- package/dist/app/composables/schema/commerce/teams.js +1 -0
- package/dist/app/composables/schema/commerce/transactions.d.ts +11 -0
- package/dist/app/composables/schema/commerce/transactions.js +1 -0
- package/dist/app/composables/schema/identity/customerGroup.d.ts +7 -0
- package/dist/app/composables/schema/identity/customerGroup.js +1 -0
- package/dist/app/composables/schema/identity/user.d.ts +45 -0
- package/dist/app/composables/schema/identity/user.js +1 -0
- package/dist/app/composables/schema/media/asset.d.ts +28 -0
- package/dist/app/composables/schema/media/asset.js +1 -0
- package/dist/app/composables/schema/social/post.d.ts +25 -0
- package/dist/app/composables/schema/social/post.js +1 -0
- package/dist/app/composables/schema/social/profile.d.ts +22 -0
- package/dist/app/composables/schema/social/profile.js +1 -0
- package/dist/app/composables/schema/social/space.d.ts +17 -0
- package/dist/app/composables/schema/social/space.js +1 -0
- package/dist/app/composables/types.d.ts +11 -0
- package/dist/app/composables/types.js +1 -0
- package/dist/app/composables/useContent.d.ts +4 -0
- package/dist/app/composables/useContent.js +10 -0
- package/dist/app/composables/useDirectusRequest.d.ts +12 -0
- package/dist/app/composables/useDirectusRequest.js +83 -0
- package/dist/app/composables/utils/assert.d.ts +1 -0
- package/dist/app/composables/utils/assert.js +5 -0
- package/dist/app/composables/utils/deepMerge.d.ts +1 -0
- package/dist/app/composables/utils/deepMerge.js +15 -0
- package/dist/app/composables/utils/index.d.ts +4 -0
- package/dist/app/composables/utils/index.js +4 -0
- package/dist/app/composables/utils/isObject.d.ts +1 -0
- package/dist/app/composables/utils/isObject.js +5 -0
- package/dist/app/composables/utils/module.d.ts +4 -0
- package/dist/app/composables/utils/module.js +14 -0
- package/dist/app/composables/utils/safeGet.d.ts +1 -0
- package/dist/app/composables/utils/safeGet.js +5 -0
- package/dist/app/stores/index.d.ts +0 -0
- package/dist/app/stores/index.js +1 -0
- package/dist/app/utils/billing-address.d.ts +2 -0
- package/dist/app/utils/billing-address.js +18 -0
- package/dist/app/utils/color.d.ts +2 -0
- package/dist/app/utils/color.js +11 -0
- package/dist/app/utils/currency.d.ts +6 -0
- package/dist/app/utils/currency.js +20 -0
- package/dist/app/utils/embed.d.ts +2 -0
- package/dist/app/utils/embed.js +52 -0
- package/dist/app/utils/errors.d.ts +5 -0
- package/dist/app/utils/errors.js +6 -0
- package/dist/app/utils/fonts.d.ts +5 -0
- package/dist/app/utils/fonts.js +18 -0
- package/dist/app/utils/formkit.d.ts +12 -0
- package/dist/app/utils/formkit.js +59 -0
- package/dist/app/utils/icons.d.ts +4 -0
- package/dist/app/utils/icons.js +36 -0
- package/dist/app/utils/links.d.ts +7 -0
- package/dist/app/utils/links.js +21 -0
- package/dist/app/utils/lodash.d.ts +2 -0
- package/dist/app/utils/lodash.js +23 -0
- package/dist/app/utils/markdown.d.ts +1 -0
- package/dist/app/utils/markdown.js +8 -0
- package/dist/app/utils/math.d.ts +6 -0
- package/dist/app/utils/math.js +21 -0
- package/dist/app/utils/navigation.d.ts +2 -0
- package/dist/app/utils/navigation.js +9 -0
- package/dist/app/utils/objects.d.ts +3 -0
- package/dist/app/utils/objects.js +11 -0
- package/dist/app/utils/paths.d.ts +21 -0
- package/dist/app/utils/paths.js +21 -0
- package/dist/app/utils/relations.d.ts +9 -0
- package/dist/app/utils/relations.js +24 -0
- package/dist/app/utils/strings.d.ts +14 -0
- package/dist/app/utils/strings.js +92 -0
- package/dist/app/utils/time.d.ts +13 -0
- package/dist/app/utils/time.js +124 -0
- package/dist/app/utils/url.d.ts +12 -0
- package/dist/app/utils/url.js +20 -0
- package/dist/app/utils/user-name.d.ts +2 -0
- package/dist/app/utils/user-name.js +15 -0
- package/dist/blocks/block-button-group.d.ts +6 -0
- package/dist/blocks/block-button-group.js +1 -0
- package/dist/blocks/block-button.d.ts +13 -0
- package/dist/blocks/block-button.js +1 -0
- package/dist/blocks/block-column.d.ts +18 -0
- package/dist/blocks/block-column.js +1 -0
- package/dist/blocks/block-cta.d.ts +11 -0
- package/dist/blocks/block-cta.js +1 -0
- package/dist/blocks/block-divider.d.ts +4 -0
- package/dist/blocks/block-divider.js +1 -0
- package/dist/blocks/block-faq.d.ts +11 -0
- package/dist/blocks/block-faq.js +1 -0
- package/dist/blocks/block-form.d.ts +7 -0
- package/dist/blocks/block-form.js +1 -0
- package/dist/blocks/block-gallery.d.ts +13 -0
- package/dist/blocks/block-gallery.js +1 -0
- package/dist/blocks/block-hero.d.ts +11 -0
- package/dist/blocks/block-hero.js +1 -0
- package/dist/blocks/block-html.d.ts +4 -0
- package/dist/blocks/block-html.js +1 -0
- package/dist/blocks/block-logocloud.d.ts +13 -0
- package/dist/blocks/block-logocloud.js +1 -0
- package/dist/blocks/block-quote.d.ts +10 -0
- package/dist/blocks/block-quote.js +1 -0
- package/dist/blocks/block-richtext.d.ts +7 -0
- package/dist/blocks/block-richtext.js +1 -0
- package/dist/blocks/block-steps.d.ts +21 -0
- package/dist/blocks/block-steps.js +1 -0
- package/dist/blocks/block-team.d.ts +6 -0
- package/dist/blocks/block-team.js +1 -0
- package/dist/blocks/block-testimonial.d.ts +13 -0
- package/dist/blocks/block-testimonial.js +1 -0
- package/dist/blocks/block-video.d.ts +9 -0
- package/dist/blocks/block-video.js +1 -0
- package/dist/blocks/block.d.ts +17 -0
- package/dist/blocks/block.js +1 -0
- package/dist/blocks/index.d.ts +18 -0
- package/dist/blocks/index.js +1 -0
- package/dist/componentMap.d.ts +6 -0
- package/dist/componentMap.js +8 -0
- package/dist/content/category.d.ts +10 -0
- package/dist/content/category.js +1 -0
- package/dist/content/form.d.ts +21 -0
- package/dist/content/form.js +1 -0
- package/dist/content/index.d.ts +6 -0
- package/dist/content/index.js +1 -0
- package/dist/content/page.d.ts +38 -0
- package/dist/content/page.js +1 -0
- package/dist/content/post.d.ts +38 -0
- package/dist/content/post.js +1 -0
- package/dist/content/team.d.ts +17 -0
- package/dist/content/team.js +1 -0
- package/dist/content/testimonial.d.ts +18 -0
- package/dist/content/testimonial.js +1 -0
- package/dist/help/index.d.ts +51 -0
- package/dist/help/index.js +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1 -0
- package/dist/meta/analytics.d.ts +21 -0
- package/dist/meta/analytics.js +1 -0
- package/dist/meta/config.d.ts +22 -0
- package/dist/meta/config.js +1 -0
- package/dist/meta/globals.d.ts +33 -0
- package/dist/meta/globals.js +1 -0
- package/dist/meta/index.d.ts +6 -0
- package/dist/meta/index.js +1 -0
- package/dist/meta/navigation.d.ts +31 -0
- package/dist/meta/navigation.js +1 -0
- package/dist/meta/redirect.d.ts +12 -0
- package/dist/meta/redirect.js +1 -0
- package/dist/meta/seo.d.ts +19 -0
- package/dist/meta/seo.js +1 -0
- package/dist/os/contact.d.ts +22 -0
- package/dist/os/contact.js +1 -0
- package/dist/os/conversation.d.ts +23 -0
- package/dist/os/conversation.js +1 -0
- package/dist/os/index.d.ts +16 -0
- package/dist/os/index.js +1 -0
- package/dist/os/organization.d.ts +51 -0
- package/dist/os/organization.js +1 -0
- package/dist/os/os-activity.d.ts +26 -0
- package/dist/os/os-activity.js +1 -0
- package/dist/os/os-deal.d.ts +42 -0
- package/dist/os/os-deal.js +1 -0
- package/dist/os/os-expense.d.ts +21 -0
- package/dist/os/os-expense.js +1 -0
- package/dist/os/os-invoice.d.ts +46 -0
- package/dist/os/os-invoice.js +1 -0
- package/dist/os/os-item.d.ts +17 -0
- package/dist/os/os-item.js +1 -0
- package/dist/os/os-payment.d.ts +27 -0
- package/dist/os/os-payment.js +1 -0
- package/dist/os/os-project.d.ts +45 -0
- package/dist/os/os-project.js +1 -0
- package/dist/os/os-proposal.d.ts +61 -0
- package/dist/os/os-proposal.js +1 -0
- package/dist/os/os-settings.d.ts +17 -0
- package/dist/os/os-settings.js +1 -0
- package/dist/os/os-subscription.d.ts +12 -0
- package/dist/os/os-subscription.js +1 -0
- package/dist/os/os-task.d.ts +32 -0
- package/dist/os/os-task.js +1 -0
- package/dist/os/os-tax-rate.d.ts +12 -0
- package/dist/os/os-tax-rate.js +1 -0
- package/dist/package.json +77 -0
- package/dist/pageComponentMap.d.ts +2 -0
- package/dist/pageComponentMap.js +7 -0
- package/dist/schema.d.ts +78 -0
- package/dist/schema.js +1 -0
- package/dist/system/file.d.ts +47 -0
- package/dist/system/file.js +1 -0
- package/dist/system/folder.d.ts +8 -0
- package/dist/system/folder.js +1 -0
- package/dist/system/index.d.ts +4 -0
- package/dist/system/index.js +1 -0
- package/dist/system/role.d.ts +20 -0
- package/dist/system/role.js +1 -0
- package/dist/system/user.d.ts +57 -0
- package/dist/system/user.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MapperNotFoundError } from './errors';
|
|
2
|
+
const registry = new Map();
|
|
3
|
+
export function registerMapper(mapper) {
|
|
4
|
+
registry.set(mapper.name, mapper);
|
|
5
|
+
}
|
|
6
|
+
export function getMapper(name) {
|
|
7
|
+
const mapper = registry.get(name);
|
|
8
|
+
if (!mapper) {
|
|
9
|
+
throw new MapperNotFoundError(name);
|
|
10
|
+
}
|
|
11
|
+
return mapper;
|
|
12
|
+
}
|
|
13
|
+
export function hasMapper(name) {
|
|
14
|
+
return registry.has(name);
|
|
15
|
+
}
|
|
16
|
+
export function listMappers() {
|
|
17
|
+
return Array.from(registry.keys());
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MapperDefinition } from './types';
|
|
2
|
+
export interface MapperTestCase<TInput, TOutput> {
|
|
3
|
+
name: string;
|
|
4
|
+
input: TInput;
|
|
5
|
+
expected: TOutput | ((output: TOutput) => void | Promise<void>);
|
|
6
|
+
snapshot?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface MapperTestOptions<TInput, TOutput> {
|
|
9
|
+
mapper: MapperDefinition<TInput, TOutput>;
|
|
10
|
+
cases: MapperTestCase<TInput, TOutput>[];
|
|
11
|
+
async?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function runMapperTests<TInput, TOutput>(options: MapperTestOptions<TInput, TOutput>): Promise<void>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { MapperError } from './errors';
|
|
2
|
+
export async function runMapperTests(options) {
|
|
3
|
+
const { mapper, cases } = options;
|
|
4
|
+
for (const testCase of cases) {
|
|
5
|
+
const { name, input, expected, snapshot } = testCase;
|
|
6
|
+
try {
|
|
7
|
+
const result = await maybeAsync(mapper.map, input);
|
|
8
|
+
// Snapshot mode (stringified)
|
|
9
|
+
if (snapshot) {
|
|
10
|
+
const snap = JSON.stringify(result, null, 2);
|
|
11
|
+
console.log(`\n📸 Snapshot for "${mapper.name}" → "${name}":\n${snap}\n`);
|
|
12
|
+
}
|
|
13
|
+
// Function-based expectation
|
|
14
|
+
if (isExpectedFunction(expected)) {
|
|
15
|
+
await expected(result);
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
// Deep equality check
|
|
19
|
+
const pass = deepEqual(result, expected);
|
|
20
|
+
if (!pass) {
|
|
21
|
+
throw new MapperError(`Mapper "${mapper.name}" test "${name}" failed.\n` +
|
|
22
|
+
diffString(expected, result));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (error instanceof Error) {
|
|
27
|
+
throw new MapperError(`Mapper "${mapper.name}" test "${name}" threw an error:\n${error.message}`);
|
|
28
|
+
}
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/* -------------------------------------------------------
|
|
34
|
+
Helpers
|
|
35
|
+
------------------------------------------------------- */
|
|
36
|
+
async function maybeAsync(fn, input) {
|
|
37
|
+
return await fn(input);
|
|
38
|
+
}
|
|
39
|
+
function isExpectedFunction(value) {
|
|
40
|
+
return typeof value === 'function';
|
|
41
|
+
}
|
|
42
|
+
function deepEqual(a, b) {
|
|
43
|
+
if (Object.is(a, b))
|
|
44
|
+
return true;
|
|
45
|
+
if (typeof a !== 'object' ||
|
|
46
|
+
typeof b !== 'object' ||
|
|
47
|
+
a === null ||
|
|
48
|
+
b === null) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const aKeys = Object.keys(a);
|
|
52
|
+
const bKeys = Object.keys(b);
|
|
53
|
+
if (aKeys.length !== bKeys.length)
|
|
54
|
+
return false;
|
|
55
|
+
for (const key of aKeys) {
|
|
56
|
+
if (!deepEqual(a[key], b[key]))
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Pretty diff output (no deps)
|
|
63
|
+
*/
|
|
64
|
+
function diffString(expected, received) {
|
|
65
|
+
const exp = JSON.stringify(expected, null, 2);
|
|
66
|
+
const rec = JSON.stringify(received, null, 2);
|
|
67
|
+
return (`\nExpected:\n${indent(exp)}\n\nReceived:\n${indent(rec)}\n` +
|
|
68
|
+
`\nDiff:\n${indent(generateDiff(exp, rec))}`);
|
|
69
|
+
}
|
|
70
|
+
function indent(str) {
|
|
71
|
+
return str
|
|
72
|
+
.split('\n')
|
|
73
|
+
.map((line) => ` ${line}`)
|
|
74
|
+
.join('\n');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Minimal diff generator (line-by-line)
|
|
78
|
+
*/
|
|
79
|
+
function generateDiff(a, b) {
|
|
80
|
+
const aLines = a.split('\n');
|
|
81
|
+
const bLines = b.split('\n');
|
|
82
|
+
const max = Math.max(aLines.length, bLines.length);
|
|
83
|
+
const diff = [];
|
|
84
|
+
for (let i = 0; i < max; i++) {
|
|
85
|
+
const left = aLines[i];
|
|
86
|
+
const right = bLines[i];
|
|
87
|
+
if (left === right) {
|
|
88
|
+
diff.push(` ${left ?? ''}`);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
if (left !== undefined)
|
|
92
|
+
diff.push(`- ${left}`);
|
|
93
|
+
if (right !== undefined)
|
|
94
|
+
diff.push(`+ ${right}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return diff.join('\n');
|
|
98
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ZodSchema } from 'zod';
|
|
2
|
+
import type { MapperDefinition, MapperFn } from './types';
|
|
3
|
+
export interface ZodMapperOptions<TInput, TOutput> {
|
|
4
|
+
name: string;
|
|
5
|
+
inputSchema: ZodSchema<TInput>;
|
|
6
|
+
outputSchema: ZodSchema<TOutput>;
|
|
7
|
+
map: MapperFn<TInput, TOutput>;
|
|
8
|
+
}
|
|
9
|
+
export declare function createZodMapper<TInput, TOutput>(options: ZodMapperOptions<TInput, TOutput>): MapperDefinition<TInput, TOutput>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createMapper } from './createMapper';
|
|
2
|
+
import { MapperError } from './errors';
|
|
3
|
+
export function createZodMapper(options) {
|
|
4
|
+
const { name, inputSchema, outputSchema, map } = options;
|
|
5
|
+
return createMapper(name, (rawInput) => {
|
|
6
|
+
const parsedInput = inputSchema.safeParse(rawInput);
|
|
7
|
+
if (!parsedInput.success) {
|
|
8
|
+
throw new MapperError(`Mapper "${name}" input validation failed: ${parsedInput.error.message}`);
|
|
9
|
+
}
|
|
10
|
+
const output = map(parsedInput.data);
|
|
11
|
+
const parsedOutput = outputSchema.safeParse(output);
|
|
12
|
+
if (!parsedOutput.success) {
|
|
13
|
+
throw new MapperError(`Mapper "${name}" output validation failed: ${parsedOutput.error.message}`);
|
|
14
|
+
}
|
|
15
|
+
return parsedOutput.data;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare function useMediaCenter(): {
|
|
2
|
+
allMedia: import("vue").Ref<any[], any[]>;
|
|
3
|
+
audioMedia: import("vue").ComputedRef<any[]>;
|
|
4
|
+
videoMedia: import("vue").ComputedRef<any[]>;
|
|
5
|
+
imageMedia: import("vue").ComputedRef<any[]>;
|
|
6
|
+
textMedia: import("vue").ComputedRef<any[]>;
|
|
7
|
+
documentMedia: import("vue").ComputedRef<any[]>;
|
|
8
|
+
folders: import("vue").Ref<any[], any[]>;
|
|
9
|
+
currentFolder: import("vue").Ref<string | null, string | null>;
|
|
10
|
+
sharedWithMe: import("vue").Ref<any[], any[]>;
|
|
11
|
+
searchResults: import("vue").Ref<any[], any[]>;
|
|
12
|
+
smartAlbums: import("vue").Ref<any[], any[]>;
|
|
13
|
+
isInitialLoading: import("vue").Ref<boolean, boolean>;
|
|
14
|
+
isLoadingMore: import("vue").Ref<boolean, boolean>;
|
|
15
|
+
hasMore: import("vue").Ref<boolean, boolean>;
|
|
16
|
+
fetchNextPage: () => Promise<void>;
|
|
17
|
+
uploadFiles: (files: File[], onProgress?: (info: {
|
|
18
|
+
index: number;
|
|
19
|
+
total: number;
|
|
20
|
+
status: "starting" | "done" | "error";
|
|
21
|
+
name?: string;
|
|
22
|
+
}) => void) => Promise<any[]>;
|
|
23
|
+
fetchFolders: () => Promise<void>;
|
|
24
|
+
createFolder: (name: string, parent?: string | null) => Promise<void>;
|
|
25
|
+
filterByFolder: (folderId: string | null) => void;
|
|
26
|
+
reorderFolders: (updated: any[]) => Promise<void>;
|
|
27
|
+
fetchSharedWithMe: () => Promise<void>;
|
|
28
|
+
searchMedia: (query: string) => Promise<void>;
|
|
29
|
+
};
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { ref, computed, unref } from 'vue';
|
|
2
|
+
import { useNuxtApp } from '#imports';
|
|
3
|
+
import useDirectusRequest from '../useDirectusRequest';
|
|
4
|
+
import { useAuth } from '~/composables/globals/useAuth';
|
|
5
|
+
export function useMediaCenter() {
|
|
6
|
+
// Prefer a BetterAuth `useAuth()` composable when available (provided by the auth layer).
|
|
7
|
+
// Fallback to null if not present so the rest of the composable degrades gracefully.
|
|
8
|
+
// `useAuth()` typically exposes `user` and `session` refs and a `fetchSession()` method.
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
const auth = globalThis.$useAuth ?? (typeof useAuth !== 'undefined' ? useAuth() : null);
|
|
11
|
+
const user = computed(() => {
|
|
12
|
+
if (!auth)
|
|
13
|
+
return null;
|
|
14
|
+
// If auth exposes `user` ref directly
|
|
15
|
+
if (typeof auth.user !== 'undefined')
|
|
16
|
+
return unref(auth.user) || null;
|
|
17
|
+
// If auth exposes `session` ref containing `{ user }`
|
|
18
|
+
if (typeof auth.session !== 'undefined')
|
|
19
|
+
return unref(auth.session)?.user || null;
|
|
20
|
+
return null;
|
|
21
|
+
});
|
|
22
|
+
const userId = computed(() => user.value?.id || null);
|
|
23
|
+
const { $directus, $readItems, $createItem, $uploadFiles, } = useNuxtApp();
|
|
24
|
+
// CORE MEDIA STATE
|
|
25
|
+
const allMedia = ref([]);
|
|
26
|
+
const isInitialLoading = ref(true);
|
|
27
|
+
const isLoadingMore = ref(false);
|
|
28
|
+
const hasMore = ref(true);
|
|
29
|
+
const limit = 24;
|
|
30
|
+
const offset = ref(0);
|
|
31
|
+
// FOLDERS
|
|
32
|
+
const folders = ref([]);
|
|
33
|
+
const currentFolder = ref(null);
|
|
34
|
+
// SHARED & SEARCH
|
|
35
|
+
const sharedWithMe = ref([]);
|
|
36
|
+
const searchResults = ref([]);
|
|
37
|
+
// SMART ALBUMS
|
|
38
|
+
const smartAlbums = ref([]);
|
|
39
|
+
/* ---------- MIME HELPERS ---------- */
|
|
40
|
+
const mime = (i) => i?.directus_files_id?.type || '';
|
|
41
|
+
const isAudio = (i) => mime(i).startsWith('audio');
|
|
42
|
+
const isVideo = (i) => mime(i).startsWith('video');
|
|
43
|
+
const isImage = (i) => mime(i).startsWith('image');
|
|
44
|
+
const isText = (i) => mime(i).startsWith('text');
|
|
45
|
+
const isDoc = (i) => [
|
|
46
|
+
'application/pdf',
|
|
47
|
+
'application/msword',
|
|
48
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
49
|
+
'application/vnd.ms-excel',
|
|
50
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
51
|
+
].includes(mime(i));
|
|
52
|
+
/* ---------- FILTERED LISTS ---------- */
|
|
53
|
+
const filteredMedia = computed(() => {
|
|
54
|
+
if (!currentFolder.value)
|
|
55
|
+
return allMedia.value;
|
|
56
|
+
return allMedia.value.filter(m => m.folder === currentFolder.value);
|
|
57
|
+
});
|
|
58
|
+
const audioMedia = computed(() => filteredMedia.value.filter(isAudio));
|
|
59
|
+
const videoMedia = computed(() => filteredMedia.value.filter(isVideo));
|
|
60
|
+
const imageMedia = computed(() => filteredMedia.value.filter(isImage));
|
|
61
|
+
const textMedia = computed(() => filteredMedia.value.filter(isText));
|
|
62
|
+
const documentMedia = computed(() => filteredMedia.value.filter(isDoc));
|
|
63
|
+
/* ---------- RESET PAGINATION ---------- */
|
|
64
|
+
function resetPagination() {
|
|
65
|
+
allMedia.value = [];
|
|
66
|
+
offset.value = 0;
|
|
67
|
+
hasMore.value = true;
|
|
68
|
+
}
|
|
69
|
+
/* ---------- FETCH USER MEDIA (PAGINATED) ---------- */
|
|
70
|
+
async function fetchNextPage() {
|
|
71
|
+
if (!userId.value) {
|
|
72
|
+
isInitialLoading.value = false;
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (!hasMore.value)
|
|
76
|
+
return;
|
|
77
|
+
isLoadingMore.value = true;
|
|
78
|
+
const filter = { user: { _eq: userId.value } };
|
|
79
|
+
if (currentFolder.value) {
|
|
80
|
+
filter.folder = { _eq: currentFolder.value };
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const items = await $readItems('media', {
|
|
84
|
+
fields: [
|
|
85
|
+
'*',
|
|
86
|
+
{ directus_files_id: ['id', 'type', 'filename_download', 'title'] },
|
|
87
|
+
],
|
|
88
|
+
filter,
|
|
89
|
+
sort: ['-date_created'],
|
|
90
|
+
limit,
|
|
91
|
+
offset: offset.value,
|
|
92
|
+
});
|
|
93
|
+
if (!items.length) {
|
|
94
|
+
hasMore.value = false;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
allMedia.value.push(...items);
|
|
98
|
+
offset.value += items.length;
|
|
99
|
+
if (items.length < limit)
|
|
100
|
+
hasMore.value = false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
isLoadingMore.value = false;
|
|
105
|
+
isInitialLoading.value = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/* ---------- UPLOAD FILES ---------- */
|
|
109
|
+
/**
|
|
110
|
+
* Upload files to Directus and create `media` entries.
|
|
111
|
+
* Uploads are performed one-by-one so callers can track progress.
|
|
112
|
+
*
|
|
113
|
+
* @param files - array of File objects
|
|
114
|
+
* @param onProgress - optional callback called with { index, total, status, name }
|
|
115
|
+
*/
|
|
116
|
+
async function uploadFiles(files, onProgress) {
|
|
117
|
+
if (!userId.value) {
|
|
118
|
+
// Try to fetch session once in case the auth state wasn't loaded yet
|
|
119
|
+
try {
|
|
120
|
+
if (auth && typeof auth.fetchSession === 'function')
|
|
121
|
+
await auth.fetchSession();
|
|
122
|
+
else if (auth && typeof auth.fetch === 'function')
|
|
123
|
+
await auth.fetch();
|
|
124
|
+
}
|
|
125
|
+
catch (_) { }
|
|
126
|
+
if (!userId.value) {
|
|
127
|
+
try {
|
|
128
|
+
const nuxt = useNuxtApp();
|
|
129
|
+
const toast = nuxt?.$toast;
|
|
130
|
+
if (toast && typeof toast.error === 'function')
|
|
131
|
+
toast.error('You must be signed in to upload files');
|
|
132
|
+
}
|
|
133
|
+
catch (_) { }
|
|
134
|
+
throw new Error('User not authenticated');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const { request } = useDirectusRequest();
|
|
138
|
+
const newItems = [];
|
|
139
|
+
for (let i = 0; i < files.length; i++) {
|
|
140
|
+
const file = files[i];
|
|
141
|
+
if (!file) {
|
|
142
|
+
onProgress && onProgress({ index: i, total: files.length, status: 'error' });
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
onProgress && onProgress({ index: i, total: files.length, status: 'starting', name: file.name });
|
|
147
|
+
const formData = new FormData();
|
|
148
|
+
formData.append('file', file);
|
|
149
|
+
const resp = await request($uploadFiles(formData));
|
|
150
|
+
const uploaded = Array.isArray(resp) ? resp : (resp ? [resp] : []);
|
|
151
|
+
for (const up of uploaded) {
|
|
152
|
+
const mediaItem = await $createItem('media', {
|
|
153
|
+
user: userId.value,
|
|
154
|
+
directus_files_id: up.id,
|
|
155
|
+
title: up.filename_download || up.title || up.id,
|
|
156
|
+
folder: currentFolder.value || null,
|
|
157
|
+
});
|
|
158
|
+
newItems.push({ ...mediaItem, directus_files_id: up });
|
|
159
|
+
}
|
|
160
|
+
onProgress && onProgress({ index: i, total: files.length, status: 'done', name: file.name });
|
|
161
|
+
}
|
|
162
|
+
catch (e) {
|
|
163
|
+
onProgress && onProgress({ index: i, total: files.length, status: 'error', name: file.name });
|
|
164
|
+
try {
|
|
165
|
+
const nuxt = useNuxtApp();
|
|
166
|
+
const toast = nuxt?.$toast;
|
|
167
|
+
if (toast && typeof toast.error === 'function')
|
|
168
|
+
toast.error(`Upload failed: ${file.name}`);
|
|
169
|
+
}
|
|
170
|
+
catch (_) { }
|
|
171
|
+
console.error('uploadFiles failed for file', file.name, e);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (newItems.length) {
|
|
175
|
+
// add newly created items to the beginning of allMedia
|
|
176
|
+
allMedia.value.unshift(...newItems);
|
|
177
|
+
try {
|
|
178
|
+
const nuxt = useNuxtApp();
|
|
179
|
+
const toast = nuxt?.$toast;
|
|
180
|
+
if (toast && typeof toast.success === 'function')
|
|
181
|
+
toast.success(`Uploaded ${newItems.length} file${newItems.length === 1 ? '' : 's'}`);
|
|
182
|
+
}
|
|
183
|
+
catch (_) { }
|
|
184
|
+
}
|
|
185
|
+
return newItems;
|
|
186
|
+
}
|
|
187
|
+
/* ---------- FOLDERS ---------- */
|
|
188
|
+
async function fetchFolders() {
|
|
189
|
+
if (!userId.value)
|
|
190
|
+
return;
|
|
191
|
+
folders.value = await $readItems('folders', {
|
|
192
|
+
filter: { user: { _eq: userId.value } },
|
|
193
|
+
sort: ['sort', 'name'],
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
async function createFolder(name, parent = null) {
|
|
197
|
+
await $createItem('folders', {
|
|
198
|
+
name,
|
|
199
|
+
user: userId.value,
|
|
200
|
+
parent_folder: parent,
|
|
201
|
+
});
|
|
202
|
+
await fetchFolders();
|
|
203
|
+
}
|
|
204
|
+
function filterByFolder(folderId) {
|
|
205
|
+
currentFolder.value = folderId;
|
|
206
|
+
resetPagination();
|
|
207
|
+
fetchNextPage();
|
|
208
|
+
}
|
|
209
|
+
async function reorderFolders(updated) {
|
|
210
|
+
// You can persist a "sort" field here if you add it to folders.
|
|
211
|
+
// Example (pseudo-batched):
|
|
212
|
+
//
|
|
213
|
+
// for (let index = 0; index < updated.length; index++) {
|
|
214
|
+
// const folder = updated[index]
|
|
215
|
+
// await $directus.request(
|
|
216
|
+
// $updateItem('folders', folder.id, { sort: index })
|
|
217
|
+
// )
|
|
218
|
+
// }
|
|
219
|
+
//
|
|
220
|
+
// For now, we just update local state:
|
|
221
|
+
folders.value = [...updated];
|
|
222
|
+
}
|
|
223
|
+
/* ---------- SHARED WITH ME ---------- */
|
|
224
|
+
async function fetchSharedWithMe() {
|
|
225
|
+
if (!userId.value)
|
|
226
|
+
return;
|
|
227
|
+
sharedWithMe.value = await $readItems('media', {
|
|
228
|
+
fields: [
|
|
229
|
+
'*',
|
|
230
|
+
{ directus_files_id: ['id', 'type', 'filename_download', 'title'] },
|
|
231
|
+
],
|
|
232
|
+
filter: { shared_with: { _contains: userId.value } },
|
|
233
|
+
sort: ['-date_created'],
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/* ---------- SEARCH ---------- */
|
|
237
|
+
async function searchMedia(query) {
|
|
238
|
+
if (!query) {
|
|
239
|
+
searchResults.value = [];
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
searchResults.value = await $readItems('media', {
|
|
243
|
+
fields: [
|
|
244
|
+
'*',
|
|
245
|
+
{ directus_files_id: ['id', 'type', 'filename_download', 'title'] },
|
|
246
|
+
],
|
|
247
|
+
filter: {
|
|
248
|
+
_or: [
|
|
249
|
+
{ title: { _icontains: query } },
|
|
250
|
+
{ tags: { _icontains: query } },
|
|
251
|
+
{
|
|
252
|
+
directus_files_id: {
|
|
253
|
+
title: { _icontains: query },
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
},
|
|
258
|
+
sort: ['-date_created'],
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/* ---------- SMART ALBUMS ---------- */
|
|
262
|
+
const smartAlbumsComputed = computed(() => {
|
|
263
|
+
const albums = [];
|
|
264
|
+
const now = new Date();
|
|
265
|
+
const todayKey = now.toISOString().slice(0, 10);
|
|
266
|
+
const buckets = {};
|
|
267
|
+
for (const item of allMedia.value) {
|
|
268
|
+
const dateKey = (item.date_created || '').slice(0, 10) || 'unknown';
|
|
269
|
+
const typeBucket = isImage(item)
|
|
270
|
+
? 'Images'
|
|
271
|
+
: isVideo(item)
|
|
272
|
+
? 'Videos'
|
|
273
|
+
: isAudio(item)
|
|
274
|
+
? 'Audio'
|
|
275
|
+
: 'Other';
|
|
276
|
+
const key = dateKey === todayKey
|
|
277
|
+
? `Today / ${typeBucket}`
|
|
278
|
+
: `${dateKey} / ${typeBucket}`;
|
|
279
|
+
if (!buckets[key])
|
|
280
|
+
buckets[key] = [];
|
|
281
|
+
buckets[key].push(item);
|
|
282
|
+
}
|
|
283
|
+
for (const key of Object.keys(buckets)) {
|
|
284
|
+
albums.push({
|
|
285
|
+
id: key,
|
|
286
|
+
label: key,
|
|
287
|
+
items: buckets[key],
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
return albums;
|
|
291
|
+
});
|
|
292
|
+
smartAlbums.value = smartAlbumsComputed.value;
|
|
293
|
+
/* ---------- RETURN API ---------- */
|
|
294
|
+
return {
|
|
295
|
+
// state
|
|
296
|
+
allMedia,
|
|
297
|
+
audioMedia,
|
|
298
|
+
videoMedia,
|
|
299
|
+
imageMedia,
|
|
300
|
+
textMedia,
|
|
301
|
+
documentMedia,
|
|
302
|
+
folders,
|
|
303
|
+
currentFolder,
|
|
304
|
+
sharedWithMe,
|
|
305
|
+
searchResults,
|
|
306
|
+
smartAlbums,
|
|
307
|
+
// flags
|
|
308
|
+
isInitialLoading,
|
|
309
|
+
isLoadingMore,
|
|
310
|
+
hasMore,
|
|
311
|
+
// actions
|
|
312
|
+
fetchNextPage,
|
|
313
|
+
uploadFiles,
|
|
314
|
+
fetchFolders,
|
|
315
|
+
createFolder,
|
|
316
|
+
filterByFolder,
|
|
317
|
+
reorderFolders,
|
|
318
|
+
fetchSharedWithMe,
|
|
319
|
+
searchMedia,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composable wrapper for the shared `videojs` Nuxt plugin.
|
|
3
|
+
* Provides access to the provided `videojs` instance and registration helpers.
|
|
4
|
+
*/
|
|
5
|
+
export default function useVideojs(): {
|
|
6
|
+
videojs: any;
|
|
7
|
+
registerVideojsPlugin: any;
|
|
8
|
+
registerVideojsPlugins: any;
|
|
9
|
+
createPlayer: (el: Element | string | null, options?: any, ready?: (this: any) => void) => any;
|
|
10
|
+
disposePlayer: (player: any) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useNuxtApp } from '#imports';
|
|
2
|
+
/**
|
|
3
|
+
* Composable wrapper for the shared `videojs` Nuxt plugin.
|
|
4
|
+
* Provides access to the provided `videojs` instance and registration helpers.
|
|
5
|
+
*/
|
|
6
|
+
export default function useVideojs() {
|
|
7
|
+
const nuxtApp = useNuxtApp();
|
|
8
|
+
// Provided by layers/shared-app/app/plugins/videojs.client.js
|
|
9
|
+
const videojs = nuxtApp.$videojs || null;
|
|
10
|
+
const registerVideojsPlugin = nuxtApp.$registerVideojsPlugin || ((name, plugin) => { });
|
|
11
|
+
const registerVideojsPlugins = nuxtApp.$registerVideojsPlugins || ((defs) => { });
|
|
12
|
+
function createPlayer(el, options, ready) {
|
|
13
|
+
if (!videojs) {
|
|
14
|
+
// fallback: try to import dynamically (client-side only)
|
|
15
|
+
// but avoid bundling here; return null instead
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
return videojs(el, options, ready);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
// eslint-disable-next-line no-console
|
|
23
|
+
console.warn('[useVideojs] createPlayer failed', e);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function disposePlayer(player) {
|
|
28
|
+
try {
|
|
29
|
+
player && typeof player.dispose === 'function' && player.dispose();
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
// ignore
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
videojs,
|
|
37
|
+
registerVideojsPlugin,
|
|
38
|
+
registerVideojsPlugins,
|
|
39
|
+
createPlayer,
|
|
40
|
+
disposePlayer,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const providers = {};
|
|
2
|
+
export function registerContentProvider(name, provider) {
|
|
3
|
+
providers[name] = provider;
|
|
4
|
+
}
|
|
5
|
+
export function getContentProvider(name) {
|
|
6
|
+
const provider = providers[name];
|
|
7
|
+
if (!provider)
|
|
8
|
+
throw new Error(`Content provider "${name}" not found`);
|
|
9
|
+
return provider;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface MeeoviCartItem {
|
|
2
|
+
id: number;
|
|
3
|
+
quantity?: number | null;
|
|
4
|
+
metadata?: Record<string, unknown> | null;
|
|
5
|
+
products?: string | null;
|
|
6
|
+
cart?: number | null;
|
|
7
|
+
product_id?: string | null;
|
|
8
|
+
price?: number | null;
|
|
9
|
+
total?: number | null;
|
|
10
|
+
variant_id?: string | null;
|
|
11
|
+
variant?: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface MeeoviCart {
|
|
14
|
+
id: number;
|
|
15
|
+
date_created?: string | null;
|
|
16
|
+
user_updated?: string | null;
|
|
17
|
+
date_updated?: string | null;
|
|
18
|
+
session_id?: string | null;
|
|
19
|
+
total_price?: number | null;
|
|
20
|
+
user?: string | null;
|
|
21
|
+
status?: string | null;
|
|
22
|
+
subtotal?: number | null;
|
|
23
|
+
tax_amount?: number | null;
|
|
24
|
+
shipping_amount?: number | null;
|
|
25
|
+
discount_amount?: number | null;
|
|
26
|
+
total?: number | null;
|
|
27
|
+
currency?: string | null;
|
|
28
|
+
coupon_code?: string | null;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|