@react-pakistan/util-functions 1.25.89 → 2.0.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 +74 -315
- package/constants/api-methods.d.ts +3 -1
- package/constants/api-methods.js +1 -15
- package/constants/cache-time.d.ts +7 -5
- package/constants/cache-time.js +1 -8
- package/constants/countries-timezones.d.ts +4 -2
- package/constants/countries-timezones.js +1 -1411
- package/constants/currencies.d.ts +4 -2
- package/constants/currencies.js +1 -1076
- package/constants/dial-codes.d.ts +5 -3
- package/constants/dial-codes.js +1 -1216
- package/constants/layout-direction.d.ts +3 -1
- package/constants/layout-direction.js +1 -8
- package/constants/react-pakistan-meta.d.ts +4 -2
- package/constants/react-pakistan-meta.js +1 -35
- package/constants/react-pakistan.d.ts +5 -3
- package/constants/react-pakistan.js +12 -104
- package/constants/select-value-delimiter.d.ts +3 -1
- package/constants/select-value-delimiter.js +1 -13
- package/constants/social-media-colors.d.ts +3 -1
- package/constants/social-media-colors.js +1 -42
- package/constants/social-media-sizes.d.ts +6 -4
- package/constants/social-media-sizes.js +1 -327
- package/constants/user-roles.d.ts +3 -1
- package/constants/user-roles.js +1 -9
- package/edu-pilot-pro/types/academics.d.ts +2 -0
- package/edu-pilot-pro/types/academics.js +1 -0
- package/edu-pilot-pro/types/admission.d.ts +878 -0
- package/edu-pilot-pro/types/admission.js +1 -0
- package/edu-pilot-pro/types/communication.d.ts +2 -0
- package/edu-pilot-pro/types/communication.js +1 -0
- package/edu-pilot-pro/types/enums.d.ts +413 -0
- package/edu-pilot-pro/types/enums.js +1 -0
- package/edu-pilot-pro/types/finance.d.ts +2 -0
- package/edu-pilot-pro/types/finance.js +1 -0
- package/edu-pilot-pro/types/index.d.ts +2 -0
- package/edu-pilot-pro/types/index.js +1 -0
- package/edu-pilot-pro/types/user-management.d.ts +2 -0
- package/edu-pilot-pro/types/user-management.js +1 -0
- package/factory/generic-component-factory.d.ts +12 -9
- package/factory/generic-component-factory.js +1 -131
- package/factory/generic-module-factory.d.ts +14 -10
- package/factory/generic-module-factory.js +1 -190
- package/general/basic-get.d.ts +8 -1
- package/general/basic-get.js +1 -83
- package/general/basic-post.d.ts +8 -1
- package/general/basic-post.js +1 -70
- package/general/calculate-pages.d.ts +9 -1
- package/general/calculate-pages.js +1 -7
- package/general/camel-to-sentence-case.d.ts +3 -1
- package/general/camel-to-sentence-case.js +1 -20
- package/general/check-even-odd-length.d.ts +3 -1
- package/general/check-even-odd-length.js +1 -17
- package/general/clear-cache.d.ts +7 -2
- package/general/clear-cache.js +1 -12
- package/general/cnic-formatter.d.ts +16 -3
- package/general/cnic-formatter.js +1 -53
- package/general/convert-url-to-base64.d.ts +8 -6
- package/general/convert-url-to-base64.js +1 -231
- package/general/countries.d.ts +5 -3
- package/general/countries.js +1 -514
- package/general/create-date.d.ts +3 -1
- package/general/create-date.js +1 -22
- package/general/crypto.d.ts +4 -2
- package/general/crypto.js +1 -45
- package/general/currencies.d.ts +2 -0
- package/general/currencies.js +0 -1077
- package/general/delete-image-from-private-supabase.d.ts +10 -2
- package/general/delete-image-from-private-supabase.js +1 -66
- package/general/delete-image-from-public-supabase.d.ts +10 -2
- package/general/delete-image-from-public-supabase.js +1 -66
- package/general/download-from-url.d.ts +8 -1
- package/general/download-from-url.js +1 -82
- package/general/dynamic-page-limit.d.ts +9 -3
- package/general/dynamic-page-limit.js +1 -7
- package/general/enum-to-text.d.ts +8 -1
- package/general/enum-to-text.js +1 -11
- package/general/fetch-data.d.ts +16 -4
- package/general/fetch-data.js +1 -95
- package/general/fetch-supabase-image.d.ts +11 -2
- package/general/fetch-supabase-image.js +1 -67
- package/general/fetch-supabase-private-assets.d.ts +11 -2
- package/general/fetch-supabase-private-assets.js +1 -69
- package/general/format-date.d.ts +10 -2
- package/general/format-date.js +1 -49
- package/general/format-number.d.ts +12 -2
- package/general/format-number.js +1 -35
- package/general/format-phone-display.d.ts +9 -1
- package/general/format-phone-display.js +1 -32
- package/general/format-phone.d.ts +10 -2
- package/general/format-phone.js +1 -20
- package/general/format-pricing.d.ts +8 -1
- package/general/format-pricing.js +1 -23
- package/general/format-secs.d.ts +8 -1
- package/general/format-secs.js +1 -21
- package/general/format-time.d.ts +8 -2
- package/general/format-time.js +1 -38
- package/general/format-value.d.ts +8 -1
- package/general/format-value.js +1 -7
- package/general/full-month-range.d.ts +3 -2
- package/general/full-month-range.js +1 -24
- package/general/full-year-range.d.ts +3 -2
- package/general/full-year-range.js +1 -20
- package/general/generate-article-schema.d.ts +3 -2
- package/general/generate-article-schema.js +1 -100
- package/general/generate-blog-schema.d.ts +3 -2
- package/general/generate-blog-schema.js +1 -32
- package/general/generate-book-schema.d.ts +3 -2
- package/general/generate-book-schema.js +1 -109
- package/general/generate-breadcrumb-schema.d.ts +3 -2
- package/general/generate-breadcrumb-schema.js +1 -34
- package/general/generate-carousel-schema.d.ts +3 -2
- package/general/generate-carousel-schema.js +1 -172
- package/general/generate-course-schema.d.ts +3 -2
- package/general/generate-course-schema.js +1 -124
- package/general/generate-dataset-schema.d.ts +3 -2
- package/general/generate-dataset-schema.js +1 -156
- package/general/generate-discussion-forum-schema.d.ts +3 -2
- package/general/generate-discussion-forum-schema.js +1 -67
- package/general/generate-education-schema.d.ts +3 -2
- package/general/generate-education-schema.js +1 -137
- package/general/generate-employer-aggregate-rating-schema.d.ts +3 -2
- package/general/generate-employer-aggregate-rating-schema.js +1 -64
- package/general/generate-event-schema.d.ts +3 -2
- package/general/generate-event-schema.js +1 -214
- package/general/generate-faq-schema.d.ts +3 -2
- package/general/generate-faq-schema.js +1 -43
- package/general/generate-grid.d.ts +3 -2
- package/general/generate-grid.js +1 -55
- package/general/generate-image-metadata-schema.d.ts +3 -2
- package/general/generate-image-metadata-schema.js +1 -73
- package/general/generate-job-posting-schema.d.ts +3 -2
- package/general/generate-job-posting-schema.js +1 -120
- package/general/generate-local-business-schema.d.ts +3 -2
- package/general/generate-local-business-schema.js +1 -75
- package/general/generate-math-solver-schema.d.ts +3 -2
- package/general/generate-math-solver-schema.js +1 -83
- package/general/generate-movie-carousel-schema.d.ts +3 -2
- package/general/generate-movie-carousel-schema.js +1 -160
- package/general/generate-organization-schema.d.ts +3 -2
- package/general/generate-organization-schema.js +1 -39
- package/general/generate-profile-page-schema.d.ts +3 -2
- package/general/generate-profile-page-schema.js +1 -82
- package/general/generate-qa-page-schema.d.ts +3 -2
- package/general/generate-qa-page-schema.js +1 -67
- package/general/generate-recipe-schema.d.ts +3 -2
- package/general/generate-recipe-schema.js +1 -104
- package/general/generate-ref.d.ts +8 -2
- package/general/generate-ref.js +1 -12
- package/general/generate-review-snippet-schema.d.ts +3 -2
- package/general/generate-review-snippet-schema.js +1 -137
- package/general/generate-shopping-loyalty-program-schema.d.ts +3 -2
- package/general/generate-shopping-loyalty-program-schema.js +1 -59
- package/general/generate-shopping-merchant-listing-schema.d.ts +3 -2
- package/general/generate-shopping-merchant-listing-schema.js +1 -153
- package/general/generate-shopping-merchant-return-policy-schema.d.ts +3 -2
- package/general/generate-shopping-merchant-return-policy-schema.js +1 -68
- package/general/generate-shopping-merchant-shipping-policy-schema.d.ts +3 -2
- package/general/generate-shopping-merchant-shipping-policy-schema.js +1 -74
- package/general/generate-shopping-overview-schema.d.ts +3 -2
- package/general/generate-shopping-overview-schema.js +1 -157
- package/general/generate-shopping-product-snippet-schema.d.ts +3 -2
- package/general/generate-shopping-product-snippet-schema.js +1 -167
- package/general/generate-shopping-variants-schema.d.ts +3 -2
- package/general/generate-shopping-variants-schema.js +1 -143
- package/general/generate-software-app-schema.d.ts +3 -2
- package/general/generate-software-app-schema.js +1 -143
- package/general/generate-speakable-schema.d.ts +3 -2
- package/general/generate-speakable-schema.js +1 -139
- package/general/generate-subscription-schema.d.ts +3 -2
- package/general/generate-subscription-schema.js +1 -133
- package/general/generate-vacation-rental-schema.d.ts +3 -2
- package/general/generate-vacation-rental-schema.js +1 -135
- package/general/generate-video-schema.d.ts +3 -2
- package/general/generate-video-schema.js +1 -163
- package/general/generic-cache.d.ts +17 -15
- package/general/generic-cache.js +1 -659
- package/general/get-available-page-limit.d.ts +8 -2
- package/general/get-available-page-limit.js +1 -31
- package/general/get-calendar-current-month.d.ts +11 -3
- package/general/get-calendar-current-month.js +1 -31
- package/general/get-calendar-dates.d.ts +11 -3
- package/general/get-calendar-dates.js +1 -42
- package/general/get-calendar-next-month.d.ts +12 -3
- package/general/get-calendar-next-month.js +1 -32
- package/general/get-calendar-previous-month.d.ts +12 -3
- package/general/get-calendar-previous-month.js +1 -36
- package/general/get-current-year.d.ts +7 -1
- package/general/get-current-year.js +1 -5
- package/general/get-day-name.d.ts +5 -3
- package/general/get-day-name.js +1 -14
- package/general/get-dial-code.d.ts +8 -1
- package/general/get-dial-code.js +1 -8
- package/general/get-full-name.d.ts +9 -2
- package/general/get-full-name.js +1 -8
- package/general/get-href.d.ts +3 -1
- package/general/get-href.js +1 -13
- package/general/get-month-name.d.ts +5 -3
- package/general/get-month-name.js +1 -19
- package/general/get-month-number.d.ts +5 -3
- package/general/get-month-number.js +1 -29
- package/general/get-number-of-days-in-month.d.ts +9 -2
- package/general/get-number-of-days-in-month.js +1 -12
- package/general/get-pathname.d.ts +3 -1
- package/general/get-pathname.js +1 -16
- package/general/get-week-day.d.ts +8 -1
- package/general/get-week-day.js +1 -9
- package/general/image-url-to-base64.d.ts +3 -1
- package/general/image-url-to-base64.js +1 -80
- package/general/is-created-or-updated.d.ts +3 -1
- package/general/is-created-or-updated.js +1 -26
- package/general/is-next-button-disabled.d.ts +9 -1
- package/general/is-next-button-disabled.js +1 -5
- package/general/is-odd.d.ts +3 -1
- package/general/is-odd.js +1 -13
- package/general/is-previous-button-disabled.d.ts +8 -1
- package/general/is-previous-button-disabled.js +1 -7
- package/general/linear-gradients.d.ts +4 -2
- package/general/linear-gradients.js +1 -52
- package/general/multi-part-search.d.ts +10 -2
- package/general/multi-part-search.js +1 -16
- package/general/normalize-phone.d.ts +15 -2
- package/general/normalize-phone.js +1 -40
- package/general/parse-frontmatter.d.ts +11 -4
- package/general/parse-frontmatter.js +2 -35
- package/general/remove-data-image-prefix.d.ts +8 -1
- package/general/remove-data-image-prefix.js +1 -7
- package/general/repeat-times.d.ts +3 -1
- package/general/repeat-times.js +1 -21
- package/general/resolve-anchor-link.d.ts +3 -1
- package/general/resolve-anchor-link.js +1 -26
- package/general/resolve-current-date.d.ts +3 -1
- package/general/resolve-current-date.js +1 -22
- package/general/resolve-grid.d.ts +3 -1
- package/general/resolve-grid.js +1 -18
- package/general/resolve-initials.d.ts +3 -1
- package/general/resolve-initials.js +1 -17
- package/general/set-timezone.d.ts +11 -1
- package/general/set-timezone.js +1 -12
- package/general/slugify.d.ts +3 -1
- package/general/slugify.js +1 -24
- package/general/text-to-enum.d.ts +8 -1
- package/general/text-to-enum.js +1 -10
- package/general/text-to-sentence-case.d.ts +3 -1
- package/general/text-to-sentence-case.js +1 -16
- package/general/time-out.d.ts +3 -1
- package/general/time-out.js +1 -16
- package/general/time-zones.d.ts +3 -1
- package/general/time-zones.js +1 -437
- package/general/truncate-text.d.ts +3 -1
- package/general/truncate-text.js +1 -18
- package/general/type.d.ts +3 -1
- package/general/type.js +1 -2
- package/general/upload-blob-to-private-supabase.d.ts +14 -2
- package/general/upload-blob-to-private-supabase.js +1 -62
- package/general/upload-blob-to-public-supabase.d.ts +14 -2
- package/general/upload-blob-to-public-supabase.js +1 -62
- package/general/upload-image-to-private-supabase.d.ts +15 -3
- package/general/upload-image-to-private-supabase.js +1 -66
- package/general/upload-image-to-public-supabase.d.ts +15 -3
- package/general/upload-image-to-public-supabase.js +1 -66
- package/general/url-to-sentence-case.d.ts +3 -1
- package/general/url-to-sentence-case.js +1 -19
- package/general/validate-comment.d.ts +3 -1
- package/general/validate-comment.js +1 -21
- package/general/validate-email.d.ts +3 -1
- package/general/validate-email.js +1 -24
- package/general/validate-form.d.ts +12 -3
- package/general/validate-form.js +1 -29
- package/general/validate-name.d.ts +3 -1
- package/general/validate-name.js +1 -21
- package/hooks/use-change.d.ts +11 -2
- package/hooks/use-change.js +1 -23
- package/hooks/use-debounce.d.ts +10 -1
- package/hooks/use-debounce.js +1 -14
- package/hooks/use-fetch.d.ts +7 -5
- package/hooks/use-fetch.js +1 -239
- package/hooks/use-force-render.d.ts +6 -2
- package/hooks/use-force-render.js +1 -17
- package/hooks/use-ip-geo-location.d.ts +8 -1
- package/hooks/use-ip-geo-location.js +1 -79
- package/hooks/use-is-mobile.d.ts +8 -1
- package/hooks/use-is-mobile.js +1 -22
- package/hooks/use-module-entity-v2.d.ts +7 -4
- package/hooks/use-module-entity-v2.js +1 -188
- package/hooks/use-module-entity.d.ts +7 -4
- package/hooks/use-module-entity.js +1 -177
- package/hooks/use-phone-formatter.d.ts +10 -2
- package/hooks/use-phone-formatter.js +1 -23
- package/hooks/use-position.d.ts +6 -3
- package/hooks/use-position.js +1 -43
- package/hooks/use-rtl.d.ts +4 -2
- package/hooks/use-rtl.js +1 -84
- package/hooks/use-sticky.d.ts +3 -1
- package/hooks/use-sticky.js +1 -39
- package/hooks/use-toggle-state.d.ts +3 -2
- package/hooks/use-toggle-state.js +1 -26
- package/hooks/use-window-event-listener.d.ts +9 -1
- package/hooks/use-window-event-listener.js +1 -11
- package/hooks/with-seo.d.ts +11 -2
- package/hooks/with-seo.js +1 -37
- package/local-storage/get-storage-value.d.ts +5 -2
- package/local-storage/get-storage-value.js +1 -20
- package/local-storage/remove-storage-value.d.ts +3 -1
- package/local-storage/remove-storage-value.js +1 -14
- package/local-storage/set-storage-value.d.ts +3 -1
- package/local-storage/set-storage-value.js +1 -14
- package/local-storage/type.d.ts +3 -1
- package/local-storage/type.js +1 -2
- package/npm.d.d.ts +2 -0
- package/npm.d.js +0 -0
- package/package.json +20 -18
- package/storybook/generate-sitemap.d.ts +3 -1
- package/storybook/generate-sitemap.js +17 -26
- package/storybook/preview.d.ts +4 -2
- package/storybook/preview.js +1 -62
- package/storybook/react-design-story-script.d.ts +3 -1
- package/storybook/react-design-story-script.js +5 -27
- package/storybook/react-emoji-collection.d.ts +3 -1
- package/storybook/react-emoji-collection.js +10 -55
- package/storybook/react-emoji-story-script.d.ts +3 -1
- package/storybook/react-emoji-story-script.js +5 -31
- package/storybook/react-emoji-story-template.d.ts +3 -1
- package/storybook/react-emoji-story-template.js +45 -15
- package/storybook/react-icon-collection.d.ts +3 -1
- package/storybook/react-icon-collection.js +10 -42
- package/storybook/react-icon-story-script.d.ts +3 -1
- package/storybook/react-icon-story-script.js +5 -27
- package/storybook/react-icon-story-template.d.ts +3 -1
- package/storybook/react-icon-story-template.js +45 -14
- package/storybook/react-logo-collection.d.ts +3 -1
- package/storybook/react-logo-collection.js +10 -42
- package/storybook/react-logo-story-script.d.ts +3 -1
- package/storybook/react-logo-story-script.js +5 -27
- package/storybook/react-logo-story-template.d.ts +3 -1
- package/storybook/react-logo-story-template.js +45 -14
- package/storybook/react-pakistan-theme.d.ts +3 -1
- package/storybook/react-pakistan-theme.js +1 -31
- package/storybook/responsive-args.d.ts +11 -10
- package/storybook/responsive-args.js +1 -19
- package/storybook/responsive-component.d.ts +4 -2
- package/storybook/responsive-component.js +37 -23
- package/storybook/responsive-screens.d.ts +3 -1
- package/storybook/responsive-screens.js +1 -109
- package/storybook/theme.d.ts +17 -15
- package/storybook/theme.js +1 -1022
- package/api/stellar-solutions/app-user/index.d.ts +0 -51
- package/api/stellar-solutions/app-user/index.js +0 -210
- package/api/stellar-solutions/bank/index.d.ts +0 -59
- package/api/stellar-solutions/bank/index.js +0 -210
- package/api/stellar-solutions/branch/index.d.ts +0 -58
- package/api/stellar-solutions/branch/index.js +0 -220
- package/api/stellar-solutions/company/index.d.ts +0 -57
- package/api/stellar-solutions/company/index.js +0 -218
- package/api/stellar-solutions/company-report/index.d.ts +0 -15
- package/api/stellar-solutions/company-report/index.js +0 -74
- package/api/stellar-solutions/constants.d.ts +0 -19
- package/api/stellar-solutions/constants.js +0 -22
- package/api/stellar-solutions/contact/index.d.ts +0 -56
- package/api/stellar-solutions/contact/index.js +0 -217
- package/api/stellar-solutions/currency/index.d.ts +0 -55
- package/api/stellar-solutions/currency/index.js +0 -212
- package/api/stellar-solutions/customer/index.d.ts +0 -68
- package/api/stellar-solutions/customer/index.js +0 -249
- package/api/stellar-solutions/expense/index.d.ts +0 -58
- package/api/stellar-solutions/expense/index.js +0 -229
- package/api/stellar-solutions/expense-category/index.d.ts +0 -53
- package/api/stellar-solutions/expense-category/index.js +0 -214
- package/api/stellar-solutions/lead/index.d.ts +0 -51
- package/api/stellar-solutions/lead/index.js +0 -206
- package/api/stellar-solutions/menu-order/index.d.ts +0 -53
- package/api/stellar-solutions/menu-order/index.js +0 -202
- package/api/stellar-solutions/payment/index.d.ts +0 -65
- package/api/stellar-solutions/payment/index.js +0 -230
- package/api/stellar-solutions/payment-mode/index.d.ts +0 -53
- package/api/stellar-solutions/payment-mode/index.js +0 -191
- package/api/stellar-solutions/preference/index.d.ts +0 -25
- package/api/stellar-solutions/preference/index.js +0 -114
- package/api/stellar-solutions/product/index.d.ts +0 -64
- package/api/stellar-solutions/product/index.js +0 -235
- package/api/stellar-solutions/product-category/index.d.ts +0 -51
- package/api/stellar-solutions/product-category/index.js +0 -212
- package/api/stellar-solutions/profile/index.d.ts +0 -78
- package/api/stellar-solutions/profile/index.js +0 -234
- package/api/stellar-solutions/quote-invoice/index.d.ts +0 -97
- package/api/stellar-solutions/quote-invoice/index.js +0 -369
- package/api/stellar-solutions/quote-invoice-report/index.d.ts +0 -15
- package/api/stellar-solutions/quote-invoice-report/index.js +0 -74
- package/api/stellar-solutions/tax/index.d.ts +0 -55
- package/api/stellar-solutions/tax/index.js +0 -224
- package/api/stellar-solutions/types/common.d.ts +0 -24
- package/api/stellar-solutions/types/common.js +0 -22
- package/api/stellar-solutions/types/erp.d.ts +0 -302
- package/api/stellar-solutions/types/erp.js +0 -73
- package/api/stellar-solutions/types/index.d.ts +0 -3
- package/api/stellar-solutions/types/index.js +0 -19
- package/api/stellar-solutions/types/pos.d.ts +0 -176
- package/api/stellar-solutions/types/pos.js +0 -61
- package/constants/index.d.ts +0 -12
- package/constants/index.js +0 -28
- package/factory/index.d.ts +0 -2
- package/factory/index.js +0 -18
- package/general/index.d.ts +0 -95
- package/general/index.js +0 -111
- package/index.d.ts +0 -28
- package/index.js +0 -44
- package/local-storage/index.d.ts +0 -4
- package/local-storage/index.js +0 -20
- package/setupTests.d.ts +0 -1
- package/setupTests.js +0 -52
- package/storybook/index.d.ts +0 -17
- package/storybook/index.js +0 -33
|
@@ -34,5 +34,6 @@ interface DiscussionForumOptions {
|
|
|
34
34
|
userInteractionCount?: number;
|
|
35
35
|
}>;
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
declare const generateDiscussionForumSchema: ({ headline, articleBody, url, datePublished, dateModified, author, publisher, about, discussionUrl, interactionStatistic, }?: DiscussionForumOptions) => any;
|
|
38
|
+
|
|
39
|
+
export { generateDiscussionForumSchema as default, generateDiscussionForumSchema };
|
|
@@ -1,67 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org JSON-LD for `DiscussionForumPosting`.
|
|
4
|
-
*
|
|
5
|
-
* Formats author and publisher references, optional interaction statistics,
|
|
6
|
-
* and content fields into a compact `DiscussionForumPosting` object ready
|
|
7
|
-
* for JSON-LD embedding.
|
|
8
|
-
*
|
|
9
|
-
* See `DiscussionForumOptions` for supported inputs.
|
|
10
|
-
* @returns A JSON-LD compatible `DiscussionForumPosting` object
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.generateDiscussionForumSchema = void 0;
|
|
14
|
-
var formatPerson = function (p) {
|
|
15
|
-
if (!p)
|
|
16
|
-
return undefined;
|
|
17
|
-
if (typeof p === 'string')
|
|
18
|
-
return { '@type': 'Person', name: p };
|
|
19
|
-
var out = { '@type': 'Person' };
|
|
20
|
-
if (p.name)
|
|
21
|
-
out.name = p.name;
|
|
22
|
-
if (p.url)
|
|
23
|
-
out.url = p.url;
|
|
24
|
-
return out;
|
|
25
|
-
};
|
|
26
|
-
var formatPublisher = function (p) {
|
|
27
|
-
if (!p)
|
|
28
|
-
return undefined;
|
|
29
|
-
if (typeof p === 'string')
|
|
30
|
-
return { '@type': 'Organization', name: p };
|
|
31
|
-
var out = { '@type': 'Organization', name: p.name };
|
|
32
|
-
if (p.url)
|
|
33
|
-
out.url = p.url;
|
|
34
|
-
return out;
|
|
35
|
-
};
|
|
36
|
-
var generateDiscussionForumSchema = function (_a) {
|
|
37
|
-
var _b = _a === void 0 ? {} : _a, headline = _b.headline, articleBody = _b.articleBody, url = _b.url, datePublished = _b.datePublished, dateModified = _b.dateModified, author = _b.author, publisher = _b.publisher, about = _b.about, discussionUrl = _b.discussionUrl, interactionStatistic = _b.interactionStatistic;
|
|
38
|
-
var schema = {
|
|
39
|
-
'@context': 'https://schema.org',
|
|
40
|
-
'@type': 'DiscussionForumPosting',
|
|
41
|
-
};
|
|
42
|
-
if (headline)
|
|
43
|
-
schema.headline = headline;
|
|
44
|
-
if (articleBody)
|
|
45
|
-
schema.articleBody = articleBody;
|
|
46
|
-
if (url)
|
|
47
|
-
schema.url = url;
|
|
48
|
-
if (datePublished)
|
|
49
|
-
schema.datePublished = datePublished;
|
|
50
|
-
if (dateModified)
|
|
51
|
-
schema.dateModified = dateModified;
|
|
52
|
-
var a = formatPerson(author);
|
|
53
|
-
if (a)
|
|
54
|
-
schema.author = a;
|
|
55
|
-
var pub = formatPublisher(publisher);
|
|
56
|
-
if (pub)
|
|
57
|
-
schema.publisher = pub;
|
|
58
|
-
if (about)
|
|
59
|
-
schema.about = about;
|
|
60
|
-
if (discussionUrl)
|
|
61
|
-
schema.discussionUrl = discussionUrl;
|
|
62
|
-
if (interactionStatistic && Array.isArray(interactionStatistic))
|
|
63
|
-
schema.interactionStatistic = interactionStatistic;
|
|
64
|
-
return schema;
|
|
65
|
-
};
|
|
66
|
-
exports.generateDiscussionForumSchema = generateDiscussionForumSchema;
|
|
67
|
-
exports.default = exports.generateDiscussionForumSchema;
|
|
1
|
+
var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var b=(n,r)=>{for(var e in r)a(n,e,{get:r[e],enumerable:!0})},p=(n,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of h(r))!P.call(n,i)&&i!==e&&a(n,i,{get:()=>r[i],enumerable:!(s=d(r,i))||s.enumerable});return n};var D=n=>p(a({},"__esModule",{value:!0}),n);var A={};b(A,{default:()=>x,generateDiscussionForumSchema:()=>m});module.exports=D(A);const F=n=>{if(!n)return;if(typeof n=="string")return{"@type":"Person",name:n};const r={"@type":"Person"};return n.name&&(r.name=n.name),n.url&&(r.url=n.url),r},O=n=>{if(!n)return;if(typeof n=="string")return{"@type":"Organization",name:n};const r={"@type":"Organization",name:n.name};return n.url&&(r.url=n.url),r},m=({headline:n,articleBody:r,url:e,datePublished:s,dateModified:i,author:y,publisher:l,about:u,discussionUrl:f,interactionStatistic:o}={})=>{const t={"@context":"https://schema.org","@type":"DiscussionForumPosting"};n&&(t.headline=n),r&&(t.articleBody=r),e&&(t.url=e),s&&(t.datePublished=s),i&&(t.dateModified=i);const g=F(y);g&&(t.author=g);const c=O(l);return c&&(t.publisher=c),u&&(t.about=u),f&&(t.discussionUrl=f),o&&Array.isArray(o)&&(t.interactionStatistic=o),t};var x=m;0&&(module.exports={generateDiscussionForumSchema});
|
|
@@ -63,5 +63,6 @@ interface QuizOptions {
|
|
|
63
63
|
isAccessibleForFree?: boolean;
|
|
64
64
|
questions?: Question[];
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
declare const generateEducationSchema: ({ name, description, url, datePublished, author, publisher, difficulty, learningResourceType, educationalLevel, timeRequired, typicalAgeRange, inLanguage, keywords, learningOutcome, isAccessibleForFree, questions, }?: QuizOptions) => any;
|
|
67
|
+
|
|
68
|
+
export { generateEducationSchema as default, generateEducationSchema };
|
|
@@ -1,137 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org JSON-LD for a Quiz (Question and Answer items).
|
|
4
|
-
*
|
|
5
|
-
* Supports author and publisher metadata along with detailed `Question`
|
|
6
|
-
* and `Answer` structures (including accepted/suggested answers,
|
|
7
|
-
* feedback and scoring fields). Only provided values are emitted.
|
|
8
|
-
*
|
|
9
|
-
* See `QuizOptions`, `Question`, and `Answer` types for the available
|
|
10
|
-
* fields and formats.
|
|
11
|
-
* @returns A JSON-LD compatible `Quiz` object
|
|
12
|
-
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.generateEducationSchema = void 0;
|
|
15
|
-
var formatPerson = function (p) {
|
|
16
|
-
if (!p)
|
|
17
|
-
return undefined;
|
|
18
|
-
if (typeof p === 'string')
|
|
19
|
-
return { '@type': 'Person', name: p };
|
|
20
|
-
var out = { '@type': 'Person' };
|
|
21
|
-
if (p.name)
|
|
22
|
-
out.name = p.name;
|
|
23
|
-
if (p.url)
|
|
24
|
-
out.url = p.url;
|
|
25
|
-
return out;
|
|
26
|
-
};
|
|
27
|
-
var formatPublisher = function (p) {
|
|
28
|
-
if (!p)
|
|
29
|
-
return undefined;
|
|
30
|
-
if (typeof p === 'string')
|
|
31
|
-
return { '@type': 'Organization', name: p };
|
|
32
|
-
var out = { '@type': 'Organization', name: p.name };
|
|
33
|
-
if (p.url)
|
|
34
|
-
out.url = p.url;
|
|
35
|
-
return out;
|
|
36
|
-
};
|
|
37
|
-
var formatAnswer = function (a) {
|
|
38
|
-
var out = { '@type': 'Answer', text: a.text };
|
|
39
|
-
if (a.url)
|
|
40
|
-
out.url = a.url;
|
|
41
|
-
if (a.author)
|
|
42
|
-
out.author = formatPerson(a.author);
|
|
43
|
-
if (a.upvoteCount != null)
|
|
44
|
-
out.upvoteCount = a.upvoteCount;
|
|
45
|
-
if (a.feedback)
|
|
46
|
-
out.feedback = a.feedback;
|
|
47
|
-
return out;
|
|
48
|
-
};
|
|
49
|
-
var formatQuestion = function (q) {
|
|
50
|
-
var out = { '@type': 'Question' };
|
|
51
|
-
if (q.name)
|
|
52
|
-
out.name = q.name;
|
|
53
|
-
if (q.text)
|
|
54
|
-
out.text = q.text;
|
|
55
|
-
if (q.answerCount != null)
|
|
56
|
-
out.answerCount = q.answerCount;
|
|
57
|
-
if (q.upvoteCount != null)
|
|
58
|
-
out.upvoteCount = q.upvoteCount;
|
|
59
|
-
if (q.difficulty)
|
|
60
|
-
out.difficulty = q.difficulty;
|
|
61
|
-
if (q.points != null)
|
|
62
|
-
out.points = q.points;
|
|
63
|
-
if (q.score != null)
|
|
64
|
-
out.score = q.score;
|
|
65
|
-
if (q.timeLimit)
|
|
66
|
-
out.timeLimit = q.timeLimit;
|
|
67
|
-
if (q.attempts != null)
|
|
68
|
-
out.attempts = q.attempts;
|
|
69
|
-
if (q.tags && Array.isArray(q.tags))
|
|
70
|
-
out.tags = q.tags;
|
|
71
|
-
if (q.hints && Array.isArray(q.hints))
|
|
72
|
-
out.hints = q.hints;
|
|
73
|
-
if (q.learningObjective)
|
|
74
|
-
out.learningObjective = q.learningObjective;
|
|
75
|
-
if (q.timeRecommended)
|
|
76
|
-
out.timeRecommended = q.timeRecommended;
|
|
77
|
-
if (q.isRequired != null)
|
|
78
|
-
out.isRequired = q.isRequired;
|
|
79
|
-
if (q.acceptedAnswer) {
|
|
80
|
-
var a = Array.isArray(q.acceptedAnswer)
|
|
81
|
-
? q.acceptedAnswer.map(formatAnswer)
|
|
82
|
-
: formatAnswer(q.acceptedAnswer);
|
|
83
|
-
out.acceptedAnswer = a;
|
|
84
|
-
}
|
|
85
|
-
if (q.suggestedAnswer) {
|
|
86
|
-
var s = Array.isArray(q.suggestedAnswer)
|
|
87
|
-
? q.suggestedAnswer.map(formatAnswer)
|
|
88
|
-
: formatAnswer(q.suggestedAnswer);
|
|
89
|
-
out.suggestedAnswer = s;
|
|
90
|
-
}
|
|
91
|
-
return out;
|
|
92
|
-
};
|
|
93
|
-
var generateEducationSchema = function (_a) {
|
|
94
|
-
var _b = _a === void 0 ? {} : _a, name = _b.name, description = _b.description, url = _b.url, datePublished = _b.datePublished, author = _b.author, publisher = _b.publisher, difficulty = _b.difficulty, learningResourceType = _b.learningResourceType, educationalLevel = _b.educationalLevel, timeRequired = _b.timeRequired, typicalAgeRange = _b.typicalAgeRange, inLanguage = _b.inLanguage, keywords = _b.keywords, learningOutcome = _b.learningOutcome, isAccessibleForFree = _b.isAccessibleForFree, questions = _b.questions;
|
|
95
|
-
var schema = {
|
|
96
|
-
'@context': 'https://schema.org',
|
|
97
|
-
'@type': 'Quiz',
|
|
98
|
-
};
|
|
99
|
-
if (name)
|
|
100
|
-
schema.name = name;
|
|
101
|
-
if (description)
|
|
102
|
-
schema.description = description;
|
|
103
|
-
if (url)
|
|
104
|
-
schema.url = url;
|
|
105
|
-
if (datePublished)
|
|
106
|
-
schema.datePublished = datePublished;
|
|
107
|
-
var a = formatPerson(author);
|
|
108
|
-
if (a)
|
|
109
|
-
schema.author = a;
|
|
110
|
-
var p = formatPublisher(publisher);
|
|
111
|
-
if (p)
|
|
112
|
-
schema.publisher = p;
|
|
113
|
-
if (difficulty)
|
|
114
|
-
schema.difficulty = difficulty;
|
|
115
|
-
if (learningResourceType)
|
|
116
|
-
schema.learningResourceType = learningResourceType;
|
|
117
|
-
if (educationalLevel)
|
|
118
|
-
schema.educationalLevel = educationalLevel;
|
|
119
|
-
if (timeRequired)
|
|
120
|
-
schema.timeRequired = timeRequired;
|
|
121
|
-
if (typicalAgeRange != null)
|
|
122
|
-
schema.typicalAgeRange = typicalAgeRange;
|
|
123
|
-
if (inLanguage)
|
|
124
|
-
schema.inLanguage = inLanguage;
|
|
125
|
-
if (keywords && Array.isArray(keywords))
|
|
126
|
-
schema.keywords = keywords.join(', ');
|
|
127
|
-
if (learningOutcome)
|
|
128
|
-
schema.learningOutcome = learningOutcome;
|
|
129
|
-
if (isAccessibleForFree != null)
|
|
130
|
-
schema.isAccessibleForFree = isAccessibleForFree;
|
|
131
|
-
if (questions && Array.isArray(questions)) {
|
|
132
|
-
schema.question = questions.map(formatQuestion);
|
|
133
|
-
}
|
|
134
|
-
return schema;
|
|
135
|
-
};
|
|
136
|
-
exports.generateEducationSchema = generateEducationSchema;
|
|
137
|
-
exports.default = exports.generateEducationSchema;
|
|
1
|
+
var f=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},Q=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of P(t))!x.call(e,i)&&i!==r&&f(e,i,{get:()=>t[i],enumerable:!(s=C(t,i))||s.enumerable});return e};var L=e=>Q(f({},"__esModule",{value:!0}),e);var F={};O(F,{default:()=>k,generateEducationSchema:()=>R});module.exports=L(F);const h=e=>{if(!e)return;if(typeof e=="string")return{"@type":"Person",name:e};const t={"@type":"Person"};return e.name&&(t.name=e.name),e.url&&(t.url=e.url),t},j=e=>{if(!e)return;if(typeof e=="string")return{"@type":"Organization",name:e};const t={"@type":"Organization",name:e.name};return e.url&&(t.url=e.url),t},u=e=>{const t={"@type":"Answer",text:e.text};return e.url&&(t.url=e.url),e.author&&(t.author=h(e.author)),e.upvoteCount!=null&&(t.upvoteCount=e.upvoteCount),e.feedback&&(t.feedback=e.feedback),t},z=e=>{const t={"@type":"Question"};if(e.name&&(t.name=e.name),e.text&&(t.text=e.text),e.answerCount!=null&&(t.answerCount=e.answerCount),e.upvoteCount!=null&&(t.upvoteCount=e.upvoteCount),e.difficulty&&(t.difficulty=e.difficulty),e.points!=null&&(t.points=e.points),e.score!=null&&(t.score=e.score),e.timeLimit&&(t.timeLimit=e.timeLimit),e.attempts!=null&&(t.attempts=e.attempts),e.tags&&Array.isArray(e.tags)&&(t.tags=e.tags),e.hints&&Array.isArray(e.hints)&&(t.hints=e.hints),e.learningObjective&&(t.learningObjective=e.learningObjective),e.timeRecommended&&(t.timeRecommended=e.timeRecommended),e.isRequired!=null&&(t.isRequired=e.isRequired),e.acceptedAnswer){const r=Array.isArray(e.acceptedAnswer)?e.acceptedAnswer.map(u):u(e.acceptedAnswer);t.acceptedAnswer=r}if(e.suggestedAnswer){const r=Array.isArray(e.suggestedAnswer)?e.suggestedAnswer.map(u):u(e.suggestedAnswer);t.suggestedAnswer=r}return t},R=({name:e,description:t,url:r,datePublished:s,author:i,publisher:v,difficulty:g,learningResourceType:c,educationalLevel:m,timeRequired:l,typicalAgeRange:d,inLanguage:y,keywords:a,learningOutcome:A,isAccessibleForFree:p,questions:o}={})=>{const n={"@context":"https://schema.org","@type":"Quiz"};e&&(n.name=e),t&&(n.description=t),r&&(n.url=r),s&&(n.datePublished=s);const b=h(i);b&&(n.author=b);const w=j(v);return w&&(n.publisher=w),g&&(n.difficulty=g),c&&(n.learningResourceType=c),m&&(n.educationalLevel=m),l&&(n.timeRequired=l),d!=null&&(n.typicalAgeRange=d),y&&(n.inLanguage=y),a&&Array.isArray(a)&&(n.keywords=a.join(", ")),A&&(n.learningOutcome=A),p!=null&&(n.isAccessibleForFree=p),o&&Array.isArray(o)&&(n.question=o.map(z)),n};var k=R;0&&(module.exports={generateEducationSchema});
|
|
@@ -24,5 +24,6 @@ interface EmployerAggregateOptions {
|
|
|
24
24
|
description?: string;
|
|
25
25
|
datePublished?: string;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
declare const generateEmployerAggregateRatingSchema: ({ employer, ratingValue, ratingCount, reviewCount, bestRating, worstRating, url, description, datePublished, }: EmployerAggregateOptions) => any;
|
|
28
|
+
|
|
29
|
+
export { generateEmployerAggregateRatingSchema as default, generateEmployerAggregateRatingSchema };
|
|
@@ -1,64 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org JSON-LD for `EmployerAggregateRating` and the
|
|
4
|
-
* hosting `Organization`.
|
|
5
|
-
*
|
|
6
|
-
* The helper builds an `EmployerAggregateRating` object and nests it
|
|
7
|
-
* inside an `Organization` representation of the employer. Use the
|
|
8
|
-
* `EmployerAggregateOptions` interface for inputs.
|
|
9
|
-
* @returns A JSON-LD compatible `Organization` object with
|
|
10
|
-
* `aggregateRating` included
|
|
11
|
-
*/
|
|
12
|
-
var __assign = (this && this.__assign) || function () {
|
|
13
|
-
__assign = Object.assign || function(t) {
|
|
14
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
15
|
-
s = arguments[i];
|
|
16
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
17
|
-
t[p] = s[p];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
return __assign.apply(this, arguments);
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.generateEmployerAggregateRatingSchema = void 0;
|
|
25
|
-
var formatOrganization = function (o) {
|
|
26
|
-
if (typeof o === 'string')
|
|
27
|
-
return { '@type': 'Organization', name: o };
|
|
28
|
-
var out = { '@type': 'Organization', name: o.name };
|
|
29
|
-
if (o.url)
|
|
30
|
-
out.url = o.url;
|
|
31
|
-
if (o.sameAs)
|
|
32
|
-
out.sameAs = o.sameAs;
|
|
33
|
-
return out;
|
|
34
|
-
};
|
|
35
|
-
var generateEmployerAggregateRatingSchema = function (_a) {
|
|
36
|
-
var employer = _a.employer, ratingValue = _a.ratingValue, ratingCount = _a.ratingCount, reviewCount = _a.reviewCount, bestRating = _a.bestRating, worstRating = _a.worstRating, url = _a.url, description = _a.description, datePublished = _a.datePublished;
|
|
37
|
-
// Build the EmployerAggregateRating object
|
|
38
|
-
var rating = {
|
|
39
|
-
'@type': 'EmployerAggregateRating',
|
|
40
|
-
};
|
|
41
|
-
if (ratingValue != null)
|
|
42
|
-
rating.ratingValue = ratingValue;
|
|
43
|
-
if (ratingCount != null)
|
|
44
|
-
rating.ratingCount = ratingCount;
|
|
45
|
-
if (reviewCount != null)
|
|
46
|
-
rating.reviewCount = reviewCount;
|
|
47
|
-
if (bestRating != null)
|
|
48
|
-
rating.bestRating = bestRating;
|
|
49
|
-
if (worstRating != null)
|
|
50
|
-
rating.worstRating = worstRating;
|
|
51
|
-
if (url)
|
|
52
|
-
rating.url = url;
|
|
53
|
-
if (description)
|
|
54
|
-
rating.description = description;
|
|
55
|
-
if (datePublished)
|
|
56
|
-
rating.datePublished = datePublished;
|
|
57
|
-
// Return the Organization with aggregateRating nested
|
|
58
|
-
var org = formatOrganization(employer);
|
|
59
|
-
var schema = __assign({ '@context': 'https://schema.org', '@type': 'Organization' }, org);
|
|
60
|
-
schema.aggregateRating = rating;
|
|
61
|
-
return schema;
|
|
62
|
-
};
|
|
63
|
-
exports.generateEmployerAggregateRatingSchema = generateEmployerAggregateRatingSchema;
|
|
64
|
-
exports.default = exports.generateEmployerAggregateRatingSchema;
|
|
1
|
+
var g=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var O=(e,n)=>{for(var a in n)g(e,a,{get:n[a],enumerable:!0})},A=(e,n,a,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of y(n))!c.call(e,r)&&r!==a&&g(e,r,{get:()=>n[r],enumerable:!(i=p(n,r))||i.enumerable});return e};var R=e=>A(g({},"__esModule",{value:!0}),e);var d={};O(d,{default:()=>h,generateEmployerAggregateRatingSchema:()=>f});module.exports=R(d);const b=e=>{if(typeof e=="string")return{"@type":"Organization",name:e};const n={"@type":"Organization",name:e.name};return e.url&&(n.url=e.url),e.sameAs&&(n.sameAs=e.sameAs),n},f=({employer:e,ratingValue:n,ratingCount:a,reviewCount:i,bestRating:r,worstRating:s,url:o,description:u,datePublished:l})=>{const t={"@type":"EmployerAggregateRating"};n!=null&&(t.ratingValue=n),a!=null&&(t.ratingCount=a),i!=null&&(t.reviewCount=i),r!=null&&(t.bestRating=r),s!=null&&(t.worstRating=s),o&&(t.url=o),u&&(t.description=u),l&&(t.datePublished=l);const m={"@context":"https://schema.org","@type":"Organization",...b(e)};return m.aggregateRating=t,m};var h=f;0&&(module.exports={generateEmployerAggregateRatingSchema});
|
|
@@ -58,5 +58,6 @@ interface EventSchemaOptions {
|
|
|
58
58
|
eventAttendanceMode?: string;
|
|
59
59
|
skipInvalidCurrency?: boolean;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
declare const generateEventSchema: ({ name, startDate, endDate, description, location, url, image, organizer, performers, offers, isAccessibleForFree, eventStatus, eventAttendanceMode, skipInvalidCurrency, }: EventSchemaOptions) => any;
|
|
62
|
+
|
|
63
|
+
export { generateEventSchema };
|
|
@@ -1,214 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org `Event` JSON-LD.
|
|
4
|
-
*
|
|
5
|
-
* Supports `Place` and `VirtualLocation` types for `location`, optional
|
|
6
|
-
* `offers`, performers, organizer, and availability/status normalization.
|
|
7
|
-
* Currency values are validated with `skipInvalidCurrency` when present.
|
|
8
|
-
*
|
|
9
|
-
* See `EventSchemaOptions` below for the complete input shape.
|
|
10
|
-
* @returns A JSON-LD compatible `Event` object
|
|
11
|
-
*/
|
|
12
|
-
var __assign = (this && this.__assign) || function () {
|
|
13
|
-
__assign = Object.assign || function(t) {
|
|
14
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
15
|
-
s = arguments[i];
|
|
16
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
17
|
-
t[p] = s[p];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
return __assign.apply(this, arguments);
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.generateEventSchema = void 0;
|
|
25
|
-
var formatImage = function (image) {
|
|
26
|
-
if (!image)
|
|
27
|
-
return undefined;
|
|
28
|
-
if (typeof image === 'string')
|
|
29
|
-
return image;
|
|
30
|
-
return __assign(__assign({ '@type': 'ImageObject', url: image.url }, (image.width && { width: image.width })), (image.height && { height: image.height }));
|
|
31
|
-
};
|
|
32
|
-
var isValidCurrency = function (code) {
|
|
33
|
-
if (!code)
|
|
34
|
-
return false;
|
|
35
|
-
return /^[A-Z]{3}$/.test(code);
|
|
36
|
-
};
|
|
37
|
-
var AVAILABILITIES = [
|
|
38
|
-
'InStock',
|
|
39
|
-
'OutOfStock',
|
|
40
|
-
'PreOrder',
|
|
41
|
-
'PreSale',
|
|
42
|
-
'Discontinued',
|
|
43
|
-
'OnlineOnly',
|
|
44
|
-
'InStoreOnly',
|
|
45
|
-
'LimitedAvailability',
|
|
46
|
-
'BackOrder',
|
|
47
|
-
];
|
|
48
|
-
var normalizeAvailability = function (val) {
|
|
49
|
-
if (!val)
|
|
50
|
-
return undefined;
|
|
51
|
-
try {
|
|
52
|
-
var asUrl = String(val);
|
|
53
|
-
if (asUrl.startsWith('http')) {
|
|
54
|
-
var token = asUrl.replace(/https?:\/\/schema\.org\//i, '');
|
|
55
|
-
if (AVAILABILITIES.includes(token))
|
|
56
|
-
return "https://schema.org/".concat(token);
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
if (AVAILABILITIES.includes(asUrl))
|
|
60
|
-
return "https://schema.org/".concat(asUrl);
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
catch (_a) {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var normalizeStatusOrMode = function (val) {
|
|
68
|
-
if (!val)
|
|
69
|
-
return undefined;
|
|
70
|
-
if (val.startsWith('http'))
|
|
71
|
-
return val;
|
|
72
|
-
return "https://schema.org/".concat(val);
|
|
73
|
-
};
|
|
74
|
-
var formatLocation = function (loc) {
|
|
75
|
-
if (!loc)
|
|
76
|
-
return undefined;
|
|
77
|
-
if (typeof loc === 'string')
|
|
78
|
-
return loc;
|
|
79
|
-
if (loc.type === 'VirtualLocation') {
|
|
80
|
-
var out = { '@type': 'VirtualLocation' };
|
|
81
|
-
if (loc.url)
|
|
82
|
-
out.url = loc.url;
|
|
83
|
-
if (loc.name)
|
|
84
|
-
out.name = loc.name;
|
|
85
|
-
return out;
|
|
86
|
-
}
|
|
87
|
-
var place = { '@type': 'Place' };
|
|
88
|
-
if (loc.name)
|
|
89
|
-
place.name = loc.name;
|
|
90
|
-
if (loc.url)
|
|
91
|
-
place.url = loc.url;
|
|
92
|
-
if (loc.address) {
|
|
93
|
-
if (typeof loc.address === 'string') {
|
|
94
|
-
place.address = loc.address;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
place.address = __assign(__assign(__assign(__assign(__assign({ '@type': 'PostalAddress' }, (loc.address.streetAddress && {
|
|
98
|
-
streetAddress: loc.address.streetAddress,
|
|
99
|
-
})), (loc.address.addressLocality && {
|
|
100
|
-
addressLocality: loc.address.addressLocality,
|
|
101
|
-
})), (loc.address.postalCode && { postalCode: loc.address.postalCode })), (loc.address.addressRegion && {
|
|
102
|
-
addressRegion: loc.address.addressRegion,
|
|
103
|
-
})), (loc.address.addressCountry && {
|
|
104
|
-
addressCountry: loc.address.addressCountry,
|
|
105
|
-
}));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return place;
|
|
109
|
-
};
|
|
110
|
-
var formatOrganizer = function (org) {
|
|
111
|
-
if (!org)
|
|
112
|
-
return undefined;
|
|
113
|
-
if (typeof org === 'string') {
|
|
114
|
-
return {
|
|
115
|
-
'@type': 'Organization',
|
|
116
|
-
name: org,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
return __assign({ '@type': 'Organization', name: org.name }, (org.url && { url: org.url }));
|
|
120
|
-
};
|
|
121
|
-
var formatPerformer = function (p) {
|
|
122
|
-
if (typeof p === 'string') {
|
|
123
|
-
return {
|
|
124
|
-
'@type': 'Person',
|
|
125
|
-
name: p,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
return __assign({ '@type': p.type || 'Person', name: p.name }, (p.url && { url: p.url }));
|
|
129
|
-
};
|
|
130
|
-
var generateEventSchema = function (_a) {
|
|
131
|
-
var name = _a.name, startDate = _a.startDate, endDate = _a.endDate, description = _a.description, location = _a.location, url = _a.url, image = _a.image, organizer = _a.organizer, performers = _a.performers, offers = _a.offers, isAccessibleForFree = _a.isAccessibleForFree, eventStatus = _a.eventStatus, eventAttendanceMode = _a.eventAttendanceMode, _b = _a.skipInvalidCurrency, skipInvalidCurrency = _b === void 0 ? false : _b;
|
|
132
|
-
var schema = {
|
|
133
|
-
'@context': 'https://schema.org',
|
|
134
|
-
'@type': 'Event',
|
|
135
|
-
name: name,
|
|
136
|
-
startDate: startDate,
|
|
137
|
-
};
|
|
138
|
-
if (endDate)
|
|
139
|
-
schema.endDate = endDate;
|
|
140
|
-
if (description)
|
|
141
|
-
schema.description = description;
|
|
142
|
-
var img = formatImage(image);
|
|
143
|
-
if (img)
|
|
144
|
-
schema.image = img;
|
|
145
|
-
var loc = formatLocation(location);
|
|
146
|
-
if (loc)
|
|
147
|
-
schema.location = loc;
|
|
148
|
-
if (url) {
|
|
149
|
-
schema.mainEntityOfPage = {
|
|
150
|
-
'@type': 'WebPage',
|
|
151
|
-
'@id': url,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
var org = formatOrganizer(organizer);
|
|
155
|
-
if (org)
|
|
156
|
-
schema.organizer = org;
|
|
157
|
-
if (performers) {
|
|
158
|
-
if (Array.isArray(performers)) {
|
|
159
|
-
schema.performer = performers.map(function (p) { return formatPerformer(p); });
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
schema.performer = formatPerformer(performers);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (typeof isAccessibleForFree === 'boolean')
|
|
166
|
-
schema.isAccessibleForFree = isAccessibleForFree;
|
|
167
|
-
if (eventStatus) {
|
|
168
|
-
var norm = normalizeStatusOrMode(eventStatus);
|
|
169
|
-
if (norm)
|
|
170
|
-
schema.eventStatus = norm;
|
|
171
|
-
}
|
|
172
|
-
if (eventAttendanceMode) {
|
|
173
|
-
var norm = normalizeStatusOrMode(eventAttendanceMode);
|
|
174
|
-
if (norm)
|
|
175
|
-
schema.eventAttendanceMode = norm;
|
|
176
|
-
}
|
|
177
|
-
// offers handling (single or array)
|
|
178
|
-
if (offers) {
|
|
179
|
-
var promises = Array.isArray(offers) ? offers : [offers];
|
|
180
|
-
var mapped = promises
|
|
181
|
-
.map(function (o) {
|
|
182
|
-
if (o.priceCurrency && !isValidCurrency(o.priceCurrency)) {
|
|
183
|
-
return { __invalidCurrency: o.priceCurrency };
|
|
184
|
-
}
|
|
185
|
-
var off = { '@type': 'Offer' };
|
|
186
|
-
if (o.price != null)
|
|
187
|
-
off.price = o.price;
|
|
188
|
-
if (o.priceCurrency)
|
|
189
|
-
off.priceCurrency = o.priceCurrency;
|
|
190
|
-
if (o.url)
|
|
191
|
-
off.url = o.url;
|
|
192
|
-
if (o.priceValidUntil)
|
|
193
|
-
off.priceValidUntil = o.priceValidUntil;
|
|
194
|
-
if (o.availability) {
|
|
195
|
-
var n = normalizeAvailability(o.availability);
|
|
196
|
-
if (n)
|
|
197
|
-
off.availability = n;
|
|
198
|
-
}
|
|
199
|
-
return off;
|
|
200
|
-
})
|
|
201
|
-
.filter(function (x) { return x && !('__invalidCurrency' in x); });
|
|
202
|
-
var hadInvalid = promises.some(function (o) { return o.priceCurrency && !isValidCurrency(o.priceCurrency); });
|
|
203
|
-
if (hadInvalid && !skipInvalidCurrency) {
|
|
204
|
-
var bad = promises.find(function (o) { return o.priceCurrency && !isValidCurrency(o.priceCurrency); });
|
|
205
|
-
throw new Error("Invalid currency code: ".concat(bad === null || bad === void 0 ? void 0 : bad.priceCurrency));
|
|
206
|
-
}
|
|
207
|
-
if (mapped.length === 1)
|
|
208
|
-
schema.offers = mapped[0];
|
|
209
|
-
else if (mapped.length > 1)
|
|
210
|
-
schema.offers = mapped;
|
|
211
|
-
}
|
|
212
|
-
return schema;
|
|
213
|
-
};
|
|
214
|
-
exports.generateEventSchema = generateEventSchema;
|
|
1
|
+
var y=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var k=(r,e)=>{for(var t in e)y(r,t,{get:e[t],enumerable:!0})},U=(r,e,t,f)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of V(e))!w.call(r,d)&&d!==t&&y(r,d,{get:()=>e[d],enumerable:!(f=S(e,d))||f.enumerable});return r};var $=r=>U(y({},"__esModule",{value:!0}),r);var F={};k(F,{generateEventSchema:()=>B});module.exports=$(F);const R=r=>{if(r)return typeof r=="string"?r:{"@type":"ImageObject",url:r.url,...r.width&&{width:r.width},...r.height&&{height:r.height}}},g=r=>r?/^[A-Z]{3}$/.test(r):!1,A=["InStock","OutOfStock","PreOrder","PreSale","Discontinued","OnlineOnly","InStoreOnly","LimitedAvailability","BackOrder"],_=r=>{if(r)try{const e=String(r);if(e.startsWith("http")){const t=e.replace(/https?:\/\/schema\.org\//i,"");return A.includes(t)?`https://schema.org/${t}`:void 0}return A.includes(e)?`https://schema.org/${e}`:void 0}catch{return}},b=r=>{if(r)return r.startsWith("http")?r:`https://schema.org/${r}`},D=r=>{if(!r)return;if(typeof r=="string")return r;if(r.type==="VirtualLocation"){const t={"@type":"VirtualLocation"};return r.url&&(t.url=r.url),r.name&&(t.name=r.name),t}const e={"@type":"Place"};return r.name&&(e.name=r.name),r.url&&(e.url=r.url),r.address&&(typeof r.address=="string"?e.address=r.address:e.address={"@type":"PostalAddress",...r.address.streetAddress&&{streetAddress:r.address.streetAddress},...r.address.addressLocality&&{addressLocality:r.address.addressLocality},...r.address.postalCode&&{postalCode:r.address.postalCode},...r.address.addressRegion&&{addressRegion:r.address.addressRegion},...r.address.addressCountry&&{addressCountry:r.address.addressCountry}}),e},W=r=>{if(r)return typeof r=="string"?{"@type":"Organization",name:r}:{"@type":"Organization",name:r.name,...r.url&&{url:r.url}}},L=r=>typeof r=="string"?{"@type":"Person",name:r}:{"@type":r.type||"Person",name:r.name,...r.url&&{url:r.url}},B=({name:r,startDate:e,endDate:t,description:f,location:d,url:l,image:I,organizer:P,performers:u,offers:c,isAccessibleForFree:p,eventStatus:m,eventAttendanceMode:h,skipInvalidCurrency:z=!1})=>{const i={"@context":"https://schema.org","@type":"Event",name:r,startDate:e};t&&(i.endDate=t),f&&(i.description=f);const v=R(I);v&&(i.image=v);const E=D(d);E&&(i.location=E),l&&(i.mainEntityOfPage={"@type":"WebPage","@id":l});const C=W(P);if(C&&(i.organizer=C),u&&(Array.isArray(u)?i.performer=u.map(s=>L(s)):i.performer=L(u)),typeof p=="boolean"&&(i.isAccessibleForFree=p),m){const s=b(m);s&&(i.eventStatus=s)}if(h){const s=b(h);s&&(i.eventAttendanceMode=s)}if(c){const s=Array.isArray(c)?c:[c],o=s.map(n=>{if(n.priceCurrency&&!g(n.priceCurrency))return{__invalidCurrency:n.priceCurrency};const a={"@type":"Offer"};if(n.price!=null&&(a.price=n.price),n.priceCurrency&&(a.priceCurrency=n.priceCurrency),n.url&&(a.url=n.url),n.priceValidUntil&&(a.priceValidUntil=n.priceValidUntil),n.availability){const O=_(n.availability);O&&(a.availability=O)}return a}).filter(n=>n&&!("__invalidCurrency"in n));if(s.some(n=>n.priceCurrency&&!g(n.priceCurrency))&&!z){const n=s.find(a=>a.priceCurrency&&!g(a.priceCurrency));throw new Error(`Invalid currency code: ${n?.priceCurrency}`)}o.length===1?i.offers=o[0]:o.length>1&&(i.offers=o)}return i};0&&(module.exports={generateEventSchema});
|
|
@@ -16,7 +16,7 @@ interface FAQItem {
|
|
|
16
16
|
interface FAQProps {
|
|
17
17
|
data: FAQItem[];
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
declare const generateFAQSchema: ({ data }: FAQProps) => {
|
|
20
20
|
'@context': string;
|
|
21
21
|
'@type': string;
|
|
22
22
|
mainEntity: {
|
|
@@ -28,4 +28,5 @@ export declare const generateFAQSchema: ({ data }: FAQProps) => {
|
|
|
28
28
|
};
|
|
29
29
|
}[];
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
export { generateFAQSchema };
|
|
@@ -1,43 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate a schema.org `FAQPage` JSON-LD object.
|
|
4
|
-
*
|
|
5
|
-
* Each FAQ item becomes a `Question` with an `acceptedAnswer` of type
|
|
6
|
-
* `Answer`. Plain-text answers are wrapped in a single paragraph tag.
|
|
7
|
-
* If the provided answer already contains HTML tags it will be preserved
|
|
8
|
-
* as-is to avoid double-wrapping.
|
|
9
|
-
*
|
|
10
|
-
* @param props.data - Array of FAQ items with `question` and `answer`
|
|
11
|
-
* @returns A JSON-LD `FAQPage` object
|
|
12
|
-
*/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.generateFAQSchema = void 0;
|
|
15
|
-
var wrapAnswer = function (text) {
|
|
16
|
-
if (!text)
|
|
17
|
-
return text;
|
|
18
|
-
var trimmed = text.trim();
|
|
19
|
-
// naive HTML detection: if it contains a tag, assume it's HTML
|
|
20
|
-
if (trimmed.startsWith('<') && trimmed.includes('>'))
|
|
21
|
-
return text;
|
|
22
|
-
return "<p>".concat(text, "</p>");
|
|
23
|
-
};
|
|
24
|
-
var generateFAQSchema = function (_a) {
|
|
25
|
-
var data = _a.data;
|
|
26
|
-
var items = data.map(function (_a) {
|
|
27
|
-
var answer = _a.answer, question = _a.question;
|
|
28
|
-
return {
|
|
29
|
-
'@type': 'Question',
|
|
30
|
-
name: question,
|
|
31
|
-
acceptedAnswer: {
|
|
32
|
-
'@type': 'Answer',
|
|
33
|
-
text: wrapAnswer(answer),
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
});
|
|
37
|
-
return {
|
|
38
|
-
'@context': 'https://schema.org',
|
|
39
|
-
'@type': 'FAQPage',
|
|
40
|
-
mainEntity: items,
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
exports.generateFAQSchema = generateFAQSchema;
|
|
1
|
+
var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var r in t)i(e,r,{get:t[r],enumerable:!0})},o=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of c(t))!m.call(e,n)&&n!==r&&i(e,n,{get:()=>t[n],enumerable:!(s=a(t,n))||s.enumerable});return e};var A=e=>o(i({},"__esModule",{value:!0}),e);var g={};p(g,{generateFAQSchema:()=>Q});module.exports=A(g);const u=e=>{if(!e)return e;const t=e.trim();return t.startsWith("<")&&t.includes(">")?e:`<p>${e}</p>`},Q=({data:e})=>({"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(({answer:r,question:s})=>({"@type":"Question",name:s,acceptedAnswer:{"@type":"Answer",text:u(r)}}))});0&&(module.exports={generateFAQSchema});
|