@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
package/general/generate-grid.js
CHANGED
|
@@ -1,55 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* A util function generate CSS Grid on the length of provided array
|
|
4
|
-
* it creates n x n grid layout dynamically
|
|
5
|
-
*
|
|
6
|
-
* @param array array - array of any data type
|
|
7
|
-
* @returns IGrid - an Object that have col & row properties
|
|
8
|
-
* @author Taimoor Khan
|
|
9
|
-
* @remarks React UI Collection
|
|
10
|
-
*/
|
|
11
|
-
/** End file docs */
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.generateGrid = void 0;
|
|
14
|
-
var generateGrid = function (array) {
|
|
15
|
-
var gridMap = {
|
|
16
|
-
1: {
|
|
17
|
-
col: '1fr',
|
|
18
|
-
row: '1fr',
|
|
19
|
-
},
|
|
20
|
-
2: {
|
|
21
|
-
col: '1fr',
|
|
22
|
-
row: '1fr 1fr',
|
|
23
|
-
},
|
|
24
|
-
3: {
|
|
25
|
-
col: '1fr 1fr',
|
|
26
|
-
row: '1fr',
|
|
27
|
-
},
|
|
28
|
-
4: {
|
|
29
|
-
col: '1fr 1fr',
|
|
30
|
-
row: '1fr 1fr',
|
|
31
|
-
},
|
|
32
|
-
5: {
|
|
33
|
-
col: '1fr 1fr 1fr',
|
|
34
|
-
row: '1fr 1fr',
|
|
35
|
-
},
|
|
36
|
-
6: {
|
|
37
|
-
col: '1fr 1fr 1fr',
|
|
38
|
-
row: '1fr 1fr',
|
|
39
|
-
},
|
|
40
|
-
7: {
|
|
41
|
-
col: '1fr 1fr 1fr',
|
|
42
|
-
row: '1fr 1fr 1fr',
|
|
43
|
-
},
|
|
44
|
-
8: {
|
|
45
|
-
col: '1fr 1fr 1fr',
|
|
46
|
-
row: '1fr 1fr 1fr',
|
|
47
|
-
},
|
|
48
|
-
9: {
|
|
49
|
-
col: '1fr 1fr 1fr',
|
|
50
|
-
row: '1fr 1fr 1fr',
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
return gridMap[array.length];
|
|
54
|
-
};
|
|
55
|
-
exports.generateGrid = generateGrid;
|
|
1
|
+
var c=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var t=Object.prototype.hasOwnProperty;var w=(f,r)=>{for(var l in r)c(f,l,{get:r[l],enumerable:!0})},d=(f,r,l,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of n(r))!t.call(f,o)&&o!==l&&c(f,o,{get:()=>r[o],enumerable:!(e=i(r,o))||e.enumerable});return f};var a=f=>d(c({},"__esModule",{value:!0}),f);var G={};w(G,{generateGrid:()=>g});module.exports=a(G);const g=f=>({1:{col:"1fr",row:"1fr"},2:{col:"1fr",row:"1fr 1fr"},3:{col:"1fr 1fr",row:"1fr"},4:{col:"1fr 1fr",row:"1fr 1fr"},5:{col:"1fr 1fr 1fr",row:"1fr 1fr"},6:{col:"1fr 1fr 1fr",row:"1fr 1fr"},7:{col:"1fr 1fr 1fr",row:"1fr 1fr 1fr"},8:{col:"1fr 1fr 1fr",row:"1fr 1fr 1fr"},9:{col:"1fr 1fr 1fr",row:"1fr 1fr 1fr"}})[f.length];0&&(module.exports={generateGrid});
|
|
@@ -31,5 +31,6 @@ interface ImageMetadataOptions {
|
|
|
31
31
|
thumbnail?: string | ImageThumbnail;
|
|
32
32
|
keywords?: string[];
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
declare const generateImageMetadataSchema: ({ name, contentUrl, description, caption, uploadDate, author, copyrightHolder, license, encodingFormat, contentSize, thumbnail, keywords, }: ImageMetadataOptions) => any;
|
|
35
|
+
|
|
36
|
+
export { generateImageMetadataSchema };
|
|
@@ -1,73 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org `ImageObject` JSON-LD for image metadata.
|
|
4
|
-
*
|
|
5
|
-
* Accepts author/copyright holders, thumbnail, licenses and descriptive
|
|
6
|
-
* metadata and formats them into an `ImageObject` suitable for JSON-LD
|
|
7
|
-
* embedding. Only provided fields are emitted.
|
|
8
|
-
*
|
|
9
|
-
* See `ImageMetadataOptions` for the exact accepted fields.
|
|
10
|
-
* @returns A JSON-LD compatible `ImageObject`
|
|
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.generateImageMetadataSchema = void 0;
|
|
25
|
-
var formatPerson = function (p) {
|
|
26
|
-
if (!p)
|
|
27
|
-
return undefined;
|
|
28
|
-
if (typeof p === 'string')
|
|
29
|
-
return { '@type': 'Person', name: p };
|
|
30
|
-
return __assign({ '@type': 'Person', name: p.name }, (p.url && { url: p.url }));
|
|
31
|
-
};
|
|
32
|
-
var formatThumbnail = function (t) {
|
|
33
|
-
if (!t)
|
|
34
|
-
return undefined;
|
|
35
|
-
if (typeof t === 'string')
|
|
36
|
-
return t;
|
|
37
|
-
return __assign(__assign({ '@type': 'ImageObject', url: t.url }, (t.width && { width: t.width })), (t.height && { height: t.height }));
|
|
38
|
-
};
|
|
39
|
-
var generateImageMetadataSchema = function (_a) {
|
|
40
|
-
var name = _a.name, contentUrl = _a.contentUrl, description = _a.description, caption = _a.caption, uploadDate = _a.uploadDate, author = _a.author, copyrightHolder = _a.copyrightHolder, license = _a.license, encodingFormat = _a.encodingFormat, contentSize = _a.contentSize, thumbnail = _a.thumbnail, keywords = _a.keywords;
|
|
41
|
-
var schema = {
|
|
42
|
-
'@context': 'https://schema.org',
|
|
43
|
-
'@type': 'ImageObject',
|
|
44
|
-
contentUrl: contentUrl,
|
|
45
|
-
};
|
|
46
|
-
if (name)
|
|
47
|
-
schema.name = name;
|
|
48
|
-
if (description)
|
|
49
|
-
schema.description = description;
|
|
50
|
-
if (caption)
|
|
51
|
-
schema.caption = caption;
|
|
52
|
-
if (uploadDate)
|
|
53
|
-
schema.uploadDate = uploadDate;
|
|
54
|
-
var a = formatPerson(author);
|
|
55
|
-
if (a)
|
|
56
|
-
schema.author = a;
|
|
57
|
-
var ch = formatPerson(copyrightHolder);
|
|
58
|
-
if (ch)
|
|
59
|
-
schema.copyrightHolder = ch;
|
|
60
|
-
if (license)
|
|
61
|
-
schema.license = license;
|
|
62
|
-
if (encodingFormat)
|
|
63
|
-
schema.encodingFormat = encodingFormat;
|
|
64
|
-
if (contentSize)
|
|
65
|
-
schema.contentSize = contentSize;
|
|
66
|
-
var thumb = formatThumbnail(thumbnail);
|
|
67
|
-
if (thumb)
|
|
68
|
-
schema.thumbnail = thumb;
|
|
69
|
-
if (keywords && keywords.length > 0)
|
|
70
|
-
schema.keywords = keywords.join(', ');
|
|
71
|
-
return schema;
|
|
72
|
-
};
|
|
73
|
-
exports.generateImageMetadataSchema = generateImageMetadataSchema;
|
|
1
|
+
var g=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var S=(n,t)=>{for(var r in t)g(n,r,{get:t[r],enumerable:!0})},w=(n,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of I(t))!P.call(n,i)&&i!==r&&g(n,i,{get:()=>t[i],enumerable:!(a=b(t,i))||a.enumerable});return n};var O=n=>w(g({},"__esModule",{value:!0}),n);var M={};S(M,{generateImageMetadataSchema:()=>j});module.exports=O(M);const l=n=>{if(n)return typeof n=="string"?{"@type":"Person",name:n}:{"@type":"Person",name:n.name,...n.url&&{url:n.url}}},T=n=>{if(n)return typeof n=="string"?n:{"@type":"ImageObject",url:n.url,...n.width&&{width:n.width},...n.height&&{height:n.height}}},j=({name:n,contentUrl:t,description:r,caption:a,uploadDate:i,author:d,copyrightHolder:p,license:o,encodingFormat:m,contentSize:h,thumbnail:y,keywords:s})=>{const e={"@context":"https://schema.org","@type":"ImageObject",contentUrl:t};n&&(e.name=n),r&&(e.description=r),a&&(e.caption=a),i&&(e.uploadDate=i);const u=l(d);u&&(e.author=u);const c=l(p);c&&(e.copyrightHolder=c),o&&(e.license=o),m&&(e.encodingFormat=m),h&&(e.contentSize=h);const f=T(y);return f&&(e.thumbnail=f),s&&s.length>0&&(e.keywords=s.join(", ")),e};0&&(module.exports={generateImageMetadataSchema});
|
|
@@ -44,5 +44,6 @@ interface JobPostingOptions {
|
|
|
44
44
|
url?: string;
|
|
45
45
|
skipInvalidCurrency?: boolean;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
declare const generateJobPostingSchema: ({ title, description, datePosted, validThrough, employmentType, hiringOrganization, jobLocation, baseSalary, qualifications, skills, identifier, url, skipInvalidCurrency, }: JobPostingOptions) => any;
|
|
48
|
+
|
|
49
|
+
export { generateJobPostingSchema };
|
|
@@ -1,120 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org `JobPosting` JSON-LD.
|
|
4
|
-
*
|
|
5
|
-
* Supports structured `hiringOrganization`, `jobLocation`, and `baseSalary`
|
|
6
|
-
* representations. Currency validation is available via
|
|
7
|
-
* `skipInvalidCurrency` to catch malformed currency codes.
|
|
8
|
-
*
|
|
9
|
-
* See `JobPostingOptions` for the supported inputs.
|
|
10
|
-
* @returns A JSON-LD compatible `JobPosting` 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.generateJobPostingSchema = void 0;
|
|
25
|
-
var formatOrganization = function (org) {
|
|
26
|
-
if (!org)
|
|
27
|
-
return undefined;
|
|
28
|
-
if (typeof org === 'string')
|
|
29
|
-
return { '@type': 'Organization', name: org };
|
|
30
|
-
var out = { '@type': 'Organization', name: org.name };
|
|
31
|
-
if (org.url)
|
|
32
|
-
out.url = org.url;
|
|
33
|
-
if (org.logo)
|
|
34
|
-
out.logo = { '@type': 'ImageObject', url: org.logo };
|
|
35
|
-
return out;
|
|
36
|
-
};
|
|
37
|
-
var formatJobLocation = function (loc) {
|
|
38
|
-
if (!loc)
|
|
39
|
-
return undefined;
|
|
40
|
-
if (typeof loc === 'string')
|
|
41
|
-
return loc;
|
|
42
|
-
var out = { '@type': 'Place' };
|
|
43
|
-
if (loc.name)
|
|
44
|
-
out.name = loc.name;
|
|
45
|
-
if (loc.address) {
|
|
46
|
-
if (typeof loc.address === 'string')
|
|
47
|
-
out.address = loc.address;
|
|
48
|
-
else
|
|
49
|
-
out.address = __assign(__assign(__assign(__assign(__assign({ '@type': 'PostalAddress' }, (loc.address.streetAddress && {
|
|
50
|
-
streetAddress: loc.address.streetAddress,
|
|
51
|
-
})), (loc.address.addressLocality && {
|
|
52
|
-
addressLocality: loc.address.addressLocality,
|
|
53
|
-
})), (loc.address.postalCode && { postalCode: loc.address.postalCode })), (loc.address.addressRegion && {
|
|
54
|
-
addressRegion: loc.address.addressRegion,
|
|
55
|
-
})), (loc.address.addressCountry && {
|
|
56
|
-
addressCountry: loc.address.addressCountry,
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
return out;
|
|
60
|
-
};
|
|
61
|
-
var isValidCurrency = function (code) {
|
|
62
|
-
if (!code)
|
|
63
|
-
return false;
|
|
64
|
-
return /^[A-Z]{3}$/.test(code);
|
|
65
|
-
};
|
|
66
|
-
var generateJobPostingSchema = function (_a) {
|
|
67
|
-
var title = _a.title, description = _a.description, datePosted = _a.datePosted, validThrough = _a.validThrough, employmentType = _a.employmentType, hiringOrganization = _a.hiringOrganization, jobLocation = _a.jobLocation, baseSalary = _a.baseSalary, qualifications = _a.qualifications, skills = _a.skills, identifier = _a.identifier, url = _a.url, _b = _a.skipInvalidCurrency, skipInvalidCurrency = _b === void 0 ? false : _b;
|
|
68
|
-
var schema = {
|
|
69
|
-
'@context': 'https://schema.org',
|
|
70
|
-
'@type': 'JobPosting',
|
|
71
|
-
title: title,
|
|
72
|
-
datePosted: datePosted,
|
|
73
|
-
};
|
|
74
|
-
if (description)
|
|
75
|
-
schema.description = description;
|
|
76
|
-
if (validThrough)
|
|
77
|
-
schema.validThrough = validThrough;
|
|
78
|
-
if (employmentType)
|
|
79
|
-
schema.employmentType = employmentType;
|
|
80
|
-
var org = formatOrganization(hiringOrganization);
|
|
81
|
-
if (org)
|
|
82
|
-
schema.hiringOrganization = org;
|
|
83
|
-
var loc = formatJobLocation(jobLocation);
|
|
84
|
-
if (loc)
|
|
85
|
-
schema.jobLocation = loc;
|
|
86
|
-
if (baseSalary != null) {
|
|
87
|
-
// support simple number/string or detailed object
|
|
88
|
-
if (typeof baseSalary === 'number' || typeof baseSalary === 'string') {
|
|
89
|
-
schema.baseSalary = {
|
|
90
|
-
'@type': 'MonetaryAmount',
|
|
91
|
-
value: baseSalary,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
var bs = baseSalary;
|
|
96
|
-
if (bs.currency && !isValidCurrency(bs.currency)) {
|
|
97
|
-
if (!skipInvalidCurrency)
|
|
98
|
-
throw new Error("Invalid currency code: ".concat(bs.currency));
|
|
99
|
-
}
|
|
100
|
-
var ma = { '@type': 'MonetaryAmount' };
|
|
101
|
-
if (bs.value != null)
|
|
102
|
-
ma.value = bs.value;
|
|
103
|
-
if (bs.currency && isValidCurrency(bs.currency))
|
|
104
|
-
ma.currency = bs.currency;
|
|
105
|
-
if (bs.unitText)
|
|
106
|
-
ma.unitText = bs.unitText;
|
|
107
|
-
schema.baseSalary = ma;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (qualifications)
|
|
111
|
-
schema.qualifications = qualifications;
|
|
112
|
-
if (skills && skills.length > 0)
|
|
113
|
-
schema.skills = skills.join(', ');
|
|
114
|
-
if (identifier)
|
|
115
|
-
schema.identifier = identifier;
|
|
116
|
-
if (url)
|
|
117
|
-
schema.jobLocation = schema.jobLocation || { '@type': 'Place', name: url };
|
|
118
|
-
return schema;
|
|
119
|
-
};
|
|
120
|
-
exports.generateJobPostingSchema = generateJobPostingSchema;
|
|
1
|
+
var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var v=(e,n)=>{for(var i in n)u(e,i,{get:n[i],enumerable:!0})},z=(e,n,i,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of A(n))!C.call(e,s)&&s!==i&&u(e,s,{get:()=>n[s],enumerable:!(a=h(n,s))||a.enumerable});return e};var J=e=>z(u({},"__esModule",{value:!0}),e);var x={};v(x,{generateJobPostingSchema:()=>j});module.exports=J(x);const P=e=>{if(!e)return;if(typeof e=="string")return{"@type":"Organization",name:e};const n={"@type":"Organization",name:e.name};return e.url&&(n.url=e.url),e.logo&&(n.logo={"@type":"ImageObject",url:e.logo}),n},S=e=>{if(!e)return;if(typeof e=="string")return e;const n={"@type":"Place"};return e.name&&(n.name=e.name),e.address&&(typeof e.address=="string"?n.address=e.address:n.address={"@type":"PostalAddress",...e.address.streetAddress&&{streetAddress:e.address.streetAddress},...e.address.addressLocality&&{addressLocality:e.address.addressLocality},...e.address.postalCode&&{postalCode:e.address.postalCode},...e.address.addressRegion&&{addressRegion:e.address.addressRegion},...e.address.addressCountry&&{addressCountry:e.address.addressCountry}}),n},m=e=>e?/^[A-Z]{3}$/.test(e):!1,j=({title:e,description:n,datePosted:i,validThrough:a,employmentType:s,hiringOrganization:b,jobLocation:L,baseSalary:d,qualifications:y,skills:g,identifier:f,url:c,skipInvalidCurrency:O=!1})=>{const t={"@context":"https://schema.org","@type":"JobPosting",title:e,datePosted:i};n&&(t.description=n),a&&(t.validThrough=a),s&&(t.employmentType=s);const l=P(b);l&&(t.hiringOrganization=l);const p=S(L);if(p&&(t.jobLocation=p),d!=null)if(typeof d=="number"||typeof d=="string")t.baseSalary={"@type":"MonetaryAmount",value:d};else{const r=d;if(r.currency&&!m(r.currency)&&!O)throw new Error(`Invalid currency code: ${r.currency}`);const o={"@type":"MonetaryAmount"};r.value!=null&&(o.value=r.value),r.currency&&m(r.currency)&&(o.currency=r.currency),r.unitText&&(o.unitText=r.unitText),t.baseSalary=o}return y&&(t.qualifications=y),g&&g.length>0&&(t.skills=g.join(", ")),f&&(t.identifier=f),c&&(t.jobLocation=t.jobLocation||{"@type":"Place",name:c}),t};0&&(module.exports={generateJobPostingSchema});
|
|
@@ -37,5 +37,6 @@ interface LocalBusinessOptions {
|
|
|
37
37
|
};
|
|
38
38
|
sameAs?: string[];
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
declare const generateLocalBusinessSchema: ({ name, description, url, telephone, email, address, openingHours, geo, priceRange, image, logo, aggregateRating, sameAs, }: LocalBusinessOptions) => any;
|
|
41
|
+
|
|
42
|
+
export { generateLocalBusinessSchema };
|
|
@@ -1,75 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org `LocalBusiness` JSON-LD.
|
|
4
|
-
*
|
|
5
|
-
* Accepts common local business metadata (address, telephone, opening
|
|
6
|
-
* hours, geo coordinates, aggregateRating, etc.) and returns an object
|
|
7
|
-
* formatted for JSON-LD. Address may be provided as a simple string or a
|
|
8
|
-
* structured `SimpleAddress` object.
|
|
9
|
-
*
|
|
10
|
-
* See `LocalBusinessOptions` below for supported fields.
|
|
11
|
-
* @returns A JSON-LD compatible `LocalBusiness` object
|
|
12
|
-
*/
|
|
13
|
-
var __assign = (this && this.__assign) || function () {
|
|
14
|
-
__assign = Object.assign || function(t) {
|
|
15
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
16
|
-
s = arguments[i];
|
|
17
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
18
|
-
t[p] = s[p];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
return __assign.apply(this, arguments);
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.generateLocalBusinessSchema = void 0;
|
|
26
|
-
var formatAddress = function (a) {
|
|
27
|
-
if (!a)
|
|
28
|
-
return undefined;
|
|
29
|
-
if (typeof a === 'string')
|
|
30
|
-
return a;
|
|
31
|
-
return __assign(__assign(__assign(__assign(__assign({ '@type': 'PostalAddress' }, (a.streetAddress && { streetAddress: a.streetAddress })), (a.addressLocality && { addressLocality: a.addressLocality })), (a.postalCode && { postalCode: a.postalCode })), (a.addressRegion && { addressRegion: a.addressRegion })), (a.addressCountry && { addressCountry: a.addressCountry }));
|
|
32
|
-
};
|
|
33
|
-
var generateLocalBusinessSchema = function (_a) {
|
|
34
|
-
var name = _a.name, description = _a.description, url = _a.url, telephone = _a.telephone, email = _a.email, address = _a.address, openingHours = _a.openingHours, geo = _a.geo, priceRange = _a.priceRange, image = _a.image, logo = _a.logo, aggregateRating = _a.aggregateRating, sameAs = _a.sameAs;
|
|
35
|
-
var schema = {
|
|
36
|
-
'@context': 'https://schema.org',
|
|
37
|
-
'@type': 'LocalBusiness',
|
|
38
|
-
name: name,
|
|
39
|
-
};
|
|
40
|
-
if (description)
|
|
41
|
-
schema.description = description;
|
|
42
|
-
if (url)
|
|
43
|
-
schema.url = url;
|
|
44
|
-
if (telephone)
|
|
45
|
-
schema.telephone = telephone;
|
|
46
|
-
if (email)
|
|
47
|
-
schema.email = email;
|
|
48
|
-
var addr = formatAddress(address);
|
|
49
|
-
if (addr)
|
|
50
|
-
schema.address = addr;
|
|
51
|
-
if (openingHours && openingHours.length > 0)
|
|
52
|
-
schema.openingHours = openingHours;
|
|
53
|
-
if (geo) {
|
|
54
|
-
schema.geo = {
|
|
55
|
-
'@type': 'GeoCoordinates',
|
|
56
|
-
latitude: String(geo.latitude),
|
|
57
|
-
longitude: String(geo.longitude),
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
if (priceRange)
|
|
61
|
-
schema.priceRange = priceRange;
|
|
62
|
-
if (image)
|
|
63
|
-
schema.image = image;
|
|
64
|
-
if (logo)
|
|
65
|
-
schema.logo = { '@type': 'ImageObject', url: logo };
|
|
66
|
-
if (aggregateRating) {
|
|
67
|
-
schema.aggregateRating = __assign({ '@type': 'AggregateRating', ratingValue: aggregateRating.ratingValue }, (aggregateRating.reviewCount != null && {
|
|
68
|
-
reviewCount: aggregateRating.reviewCount,
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
if (sameAs && sameAs.length > 0)
|
|
72
|
-
schema.sameAs = sameAs;
|
|
73
|
-
return schema;
|
|
74
|
-
};
|
|
75
|
-
exports.generateLocalBusinessSchema = generateLocalBusinessSchema;
|
|
1
|
+
var l=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var L=(e,t)=>{for(var i in t)l(e,i,{get:t[i],enumerable:!0})},h=(e,t,i,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of C(t))!A.call(e,r)&&r!==i&&l(e,r,{get:()=>t[r],enumerable:!(n=m(t,r))||n.enumerable});return e};var S=e=>h(l({},"__esModule",{value:!0}),e);var v={};L(v,{generateLocalBusinessSchema:()=>R});module.exports=S(v);const b=e=>{if(e)return typeof e=="string"?e:{"@type":"PostalAddress",...e.streetAddress&&{streetAddress:e.streetAddress},...e.addressLocality&&{addressLocality:e.addressLocality},...e.postalCode&&{postalCode:e.postalCode},...e.addressRegion&&{addressRegion:e.addressRegion},...e.addressCountry&&{addressCountry:e.addressCountry}}},R=({name:e,description:t,url:i,telephone:n,email:r,address:y,openingHours:o,geo:g,priceRange:u,image:c,logo:p,aggregateRating:d,sameAs:a})=>{const s={"@context":"https://schema.org","@type":"LocalBusiness",name:e};t&&(s.description=t),i&&(s.url=i),n&&(s.telephone=n),r&&(s.email=r);const f=b(y);return f&&(s.address=f),o&&o.length>0&&(s.openingHours=o),g&&(s.geo={"@type":"GeoCoordinates",latitude:String(g.latitude),longitude:String(g.longitude)}),u&&(s.priceRange=u),c&&(s.image=c),p&&(s.logo={"@type":"ImageObject",url:p}),d&&(s.aggregateRating={"@type":"AggregateRating",ratingValue:d.ratingValue,...d.reviewCount!=null&&{reviewCount:d.reviewCount}}),a&&a.length>0&&(s.sameAs=a),s};0&&(module.exports={generateLocalBusinessSchema});
|
|
@@ -40,5 +40,6 @@ interface MathSolverOptions {
|
|
|
40
40
|
license?: string;
|
|
41
41
|
offers?: OfferSimple | OfferSimple[];
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
declare const generateMathSolverSchema: ({ name, description, url, image, author, provider, softwareVersion, applicationCategory, operatingSystem, programmingLanguage, license, offers, }: MathSolverOptions) => any;
|
|
44
|
+
|
|
45
|
+
export { generateMathSolverSchema };
|
|
@@ -1,83 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org JSON-LD for a `MathSolver` application.
|
|
4
|
-
*
|
|
5
|
-
* Accepts application metadata (author, provider, softwareVersion, offers,
|
|
6
|
-
* etc.) and formats optional fields into a minimal `MathSolver` object
|
|
7
|
-
* suitable for embedding as JSON-LD. Only provided fields are included.
|
|
8
|
-
*
|
|
9
|
-
* See `MathSolverOptions` below for the accepted input shape.
|
|
10
|
-
* @returns A JSON-LD compatible `MathSolver` 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.generateMathSolverSchema = void 0;
|
|
25
|
-
var formatPerson = function (p) {
|
|
26
|
-
if (!p)
|
|
27
|
-
return undefined;
|
|
28
|
-
if (typeof p === 'string')
|
|
29
|
-
return { '@type': 'Person', name: p };
|
|
30
|
-
return __assign({ '@type': 'Person', name: p.name }, (p.url && { url: p.url }));
|
|
31
|
-
};
|
|
32
|
-
var formatOrganization = function (o) {
|
|
33
|
-
if (!o)
|
|
34
|
-
return undefined;
|
|
35
|
-
if (typeof o === 'string')
|
|
36
|
-
return { '@type': 'Organization', name: o };
|
|
37
|
-
return __assign({ '@type': 'Organization', name: o.name }, (o.url && { url: o.url }));
|
|
38
|
-
};
|
|
39
|
-
var formatImage = function (i) {
|
|
40
|
-
if (!i)
|
|
41
|
-
return undefined;
|
|
42
|
-
if (typeof i === 'string')
|
|
43
|
-
return i;
|
|
44
|
-
return __assign(__assign({ '@type': 'ImageObject', url: i.url }, (i.width && { width: i.width })), (i.height && { height: i.height }));
|
|
45
|
-
};
|
|
46
|
-
var generateMathSolverSchema = function (_a) {
|
|
47
|
-
var name = _a.name, description = _a.description, url = _a.url, image = _a.image, author = _a.author, provider = _a.provider, softwareVersion = _a.softwareVersion, applicationCategory = _a.applicationCategory, operatingSystem = _a.operatingSystem, programmingLanguage = _a.programmingLanguage, license = _a.license, offers = _a.offers;
|
|
48
|
-
var schema = {
|
|
49
|
-
'@context': 'https://schema.org',
|
|
50
|
-
'@type': 'MathSolver',
|
|
51
|
-
name: name,
|
|
52
|
-
};
|
|
53
|
-
if (description)
|
|
54
|
-
schema.description = description;
|
|
55
|
-
if (url)
|
|
56
|
-
schema.url = url;
|
|
57
|
-
var img = formatImage(image);
|
|
58
|
-
if (img)
|
|
59
|
-
schema.image = img;
|
|
60
|
-
var a = formatPerson(author);
|
|
61
|
-
if (a)
|
|
62
|
-
schema.author = a;
|
|
63
|
-
var prov = formatOrganization(provider);
|
|
64
|
-
if (prov)
|
|
65
|
-
schema.provider = prov;
|
|
66
|
-
if (softwareVersion)
|
|
67
|
-
schema.softwareVersion = softwareVersion;
|
|
68
|
-
if (applicationCategory)
|
|
69
|
-
schema.applicationCategory = applicationCategory;
|
|
70
|
-
if (operatingSystem)
|
|
71
|
-
schema.operatingSystem = operatingSystem;
|
|
72
|
-
if (programmingLanguage)
|
|
73
|
-
schema.programmingLanguage = programmingLanguage;
|
|
74
|
-
if (license)
|
|
75
|
-
schema.license = license;
|
|
76
|
-
if (offers) {
|
|
77
|
-
var arr = Array.isArray(offers) ? offers : [offers];
|
|
78
|
-
var mapped = arr.map(function (o) { return (__assign(__assign(__assign({ '@type': 'Offer' }, (o.price != null && { price: o.price })), (o.priceCurrency && { priceCurrency: o.priceCurrency })), (o.url && { url: o.url }))); });
|
|
79
|
-
schema.offers = mapped.length === 1 ? mapped[0] : mapped;
|
|
80
|
-
}
|
|
81
|
-
return schema;
|
|
82
|
-
};
|
|
83
|
-
exports.generateMathSolverSchema = generateMathSolverSchema;
|
|
1
|
+
var p=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var P=(r,e)=>{for(var i in e)p(r,i,{get:e[i],enumerable:!0})},w=(r,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of v(e))!z.call(r,t)&&t!==i&&p(r,t,{get:()=>e[t],enumerable:!(s=O(e,t))||s.enumerable});return r};var C=r=>w(p({},"__esModule",{value:!0}),r);var A={};P(A,{generateMathSolverSchema:()=>x});module.exports=C(A);const I=r=>{if(r)return typeof r=="string"?{"@type":"Person",name:r}:{"@type":"Person",name:r.name,...r.url&&{url:r.url}}},b=r=>{if(r)return typeof r=="string"?{"@type":"Organization",name:r}:{"@type":"Organization",name:r.name,...r.url&&{url:r.url}}},M=r=>{if(r)return typeof r=="string"?r:{"@type":"ImageObject",url:r.url,...r.width&&{width:r.width},...r.height&&{height:r.height}}},x=({name:r,description:e,url:i,image:s,author:t,provider:d,softwareVersion:u,applicationCategory:f,operatingSystem:o,programmingLanguage:l,license:c,offers:g})=>{const n={"@context":"https://schema.org","@type":"MathSolver",name:r};e&&(n.description=e),i&&(n.url=i);const h=M(s);h&&(n.image=h);const y=I(t);y&&(n.author=y);const S=b(d);if(S&&(n.provider=S),u&&(n.softwareVersion=u),f&&(n.applicationCategory=f),o&&(n.operatingSystem=o),l&&(n.programmingLanguage=l),c&&(n.license=c),g){const m=(Array.isArray(g)?g:[g]).map(a=>({"@type":"Offer",...a.price!=null&&{price:a.price},...a.priceCurrency&&{priceCurrency:a.priceCurrency},...a.url&&{url:a.url}}));n.offers=m.length===1?m[0]:m}return n};0&&(module.exports={generateMathSolverSchema});
|
|
@@ -46,5 +46,6 @@ interface MovieCarouselOptions {
|
|
|
46
46
|
items: MovieItem[];
|
|
47
47
|
skipInvalidCurrency?: boolean;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
declare const generateMovieCarouselSchema: ({ name, url, items, skipInvalidCurrency, }: MovieCarouselOptions) => any;
|
|
50
|
+
|
|
51
|
+
export { generateMovieCarouselSchema };
|
|
@@ -1,160 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org `ItemList` JSON-LD for a movie carousel (list of
|
|
4
|
-
* `Movie` entries).
|
|
5
|
-
*
|
|
6
|
-
* Each movie item can include director/actor references, offers,
|
|
7
|
-
* aggregate ratings and genre metadata. Images are normalized to
|
|
8
|
-
* `ImageObject` entries.
|
|
9
|
-
*
|
|
10
|
-
* See `MovieCarouselOptions` and `MovieItem` for input details.
|
|
11
|
-
* @returns A JSON-LD compatible `ItemList` of `Movie` objects
|
|
12
|
-
*/
|
|
13
|
-
var __assign = (this && this.__assign) || function () {
|
|
14
|
-
__assign = Object.assign || function(t) {
|
|
15
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
16
|
-
s = arguments[i];
|
|
17
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
18
|
-
t[p] = s[p];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
return __assign.apply(this, arguments);
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.generateMovieCarouselSchema = void 0;
|
|
26
|
-
var formatPerson = function (p) {
|
|
27
|
-
if (typeof p === 'string')
|
|
28
|
-
return { '@type': 'Person', name: p };
|
|
29
|
-
return __assign({ '@type': 'Person', name: p.name }, (p.url && { url: p.url }));
|
|
30
|
-
};
|
|
31
|
-
var formatImage = function (image) {
|
|
32
|
-
if (!image)
|
|
33
|
-
return undefined;
|
|
34
|
-
if (typeof image === 'string')
|
|
35
|
-
return image;
|
|
36
|
-
return __assign(__assign({ '@type': 'ImageObject', url: image.url }, (image.width && { width: image.width })), (image.height && { height: image.height }));
|
|
37
|
-
};
|
|
38
|
-
var isValidCurrency = function (code) {
|
|
39
|
-
if (!code)
|
|
40
|
-
return false;
|
|
41
|
-
return /^[A-Z]{3}$/.test(code);
|
|
42
|
-
};
|
|
43
|
-
var AVAILABILITIES = [
|
|
44
|
-
'InStock',
|
|
45
|
-
'OutOfStock',
|
|
46
|
-
'PreOrder',
|
|
47
|
-
'PreSale',
|
|
48
|
-
'Discontinued',
|
|
49
|
-
'OnlineOnly',
|
|
50
|
-
'InStoreOnly',
|
|
51
|
-
'LimitedAvailability',
|
|
52
|
-
'BackOrder',
|
|
53
|
-
];
|
|
54
|
-
var normalizeAvailability = function (val) {
|
|
55
|
-
if (!val)
|
|
56
|
-
return undefined;
|
|
57
|
-
try {
|
|
58
|
-
var asUrl = String(val);
|
|
59
|
-
if (asUrl.startsWith('http')) {
|
|
60
|
-
var token = asUrl.replace(/https?:\/\/schema\.org\//i, '');
|
|
61
|
-
if (AVAILABILITIES.includes(token))
|
|
62
|
-
return "https://schema.org/".concat(token);
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
if (AVAILABILITIES.includes(asUrl))
|
|
66
|
-
return "https://schema.org/".concat(asUrl);
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
catch (_a) {
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
var generateMovieCarouselSchema = function (_a) {
|
|
74
|
-
var name = _a.name, url = _a.url, items = _a.items, _b = _a.skipInvalidCurrency, skipInvalidCurrency = _b === void 0 ? false : _b;
|
|
75
|
-
var itemList = items.map(function (it, idx) {
|
|
76
|
-
var movie = {
|
|
77
|
-
'@type': 'Movie',
|
|
78
|
-
name: it.name,
|
|
79
|
-
};
|
|
80
|
-
if (it.url)
|
|
81
|
-
movie.url = it.url;
|
|
82
|
-
if (it.id)
|
|
83
|
-
movie['@id'] = it.id;
|
|
84
|
-
var img = formatImage(it.image);
|
|
85
|
-
if (img)
|
|
86
|
-
movie.image = img;
|
|
87
|
-
if (it.description)
|
|
88
|
-
movie.description = it.description;
|
|
89
|
-
if (it.datePublished)
|
|
90
|
-
movie.datePublished = it.datePublished;
|
|
91
|
-
if (it.duration)
|
|
92
|
-
movie.duration = it.duration;
|
|
93
|
-
if (it.genre)
|
|
94
|
-
movie.genre = Array.isArray(it.genre) ? it.genre.join(', ') : it.genre;
|
|
95
|
-
if (it.director) {
|
|
96
|
-
if (Array.isArray(it.director))
|
|
97
|
-
movie.director = it.director.map(function (d) { return formatPerson(d); });
|
|
98
|
-
else
|
|
99
|
-
movie.director = formatPerson(it.director);
|
|
100
|
-
}
|
|
101
|
-
if (it.actor) {
|
|
102
|
-
if (Array.isArray(it.actor))
|
|
103
|
-
movie.actor = it.actor.map(function (a) { return formatPerson(a); });
|
|
104
|
-
else
|
|
105
|
-
movie.actor = formatPerson(it.actor);
|
|
106
|
-
}
|
|
107
|
-
if (it.aggregateRating) {
|
|
108
|
-
movie.aggregateRating = __assign({ '@type': 'AggregateRating', ratingValue: it.aggregateRating.ratingValue }, (it.aggregateRating.reviewCount != null && {
|
|
109
|
-
reviewCount: it.aggregateRating.reviewCount,
|
|
110
|
-
}));
|
|
111
|
-
}
|
|
112
|
-
if (it.offers) {
|
|
113
|
-
var offs = Array.isArray(it.offers) ? it.offers : [it.offers];
|
|
114
|
-
var mapped = offs
|
|
115
|
-
.map(function (o) {
|
|
116
|
-
if (o.priceCurrency && !isValidCurrency(o.priceCurrency))
|
|
117
|
-
return { __invalidCurrency: o.priceCurrency };
|
|
118
|
-
var of = { '@type': 'Offer' };
|
|
119
|
-
if (o.price != null)
|
|
120
|
-
of.price = o.price;
|
|
121
|
-
if (o.priceCurrency)
|
|
122
|
-
of.priceCurrency = o.priceCurrency;
|
|
123
|
-
if (o.availability) {
|
|
124
|
-
var n = normalizeAvailability(o.availability);
|
|
125
|
-
if (n)
|
|
126
|
-
of.availability = n;
|
|
127
|
-
}
|
|
128
|
-
if (o.url)
|
|
129
|
-
of.url = o.url;
|
|
130
|
-
return of;
|
|
131
|
-
})
|
|
132
|
-
.filter(function (x) { return x && !('__invalidCurrency' in x); });
|
|
133
|
-
var hadInvalid = offs.some(function (o) { return o.priceCurrency && !isValidCurrency(o.priceCurrency); });
|
|
134
|
-
if (hadInvalid && !skipInvalidCurrency) {
|
|
135
|
-
var bad = offs.find(function (o) { return o.priceCurrency && !isValidCurrency(o.priceCurrency); });
|
|
136
|
-
throw new Error("Invalid currency code: ".concat(bad === null || bad === void 0 ? void 0 : bad.priceCurrency));
|
|
137
|
-
}
|
|
138
|
-
if (mapped.length === 1)
|
|
139
|
-
movie.offers = mapped[0];
|
|
140
|
-
else if (mapped.length > 1)
|
|
141
|
-
movie.offers = mapped;
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
'@type': 'ListItem',
|
|
145
|
-
position: idx + 1,
|
|
146
|
-
item: movie,
|
|
147
|
-
};
|
|
148
|
-
});
|
|
149
|
-
var schema = {
|
|
150
|
-
'@context': 'https://schema.org',
|
|
151
|
-
'@type': 'ItemList',
|
|
152
|
-
itemListElement: itemList,
|
|
153
|
-
};
|
|
154
|
-
if (name)
|
|
155
|
-
schema.name = name;
|
|
156
|
-
if (url)
|
|
157
|
-
schema.mainEntityOfPage = { '@type': 'WebPage', '@id': url };
|
|
158
|
-
return schema;
|
|
159
|
-
};
|
|
160
|
-
exports.generateMovieCarouselSchema = generateMovieCarouselSchema;
|
|
1
|
+
var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var P=(e,i)=>{for(var a in i)d(e,a,{get:i[a],enumerable:!0})},I=(e,i,a,u)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of b(i))!A.call(e,o)&&o!==a&&d(e,o,{get:()=>i[o],enumerable:!(u=C(i,o))||u.enumerable});return e};var O=e=>I(d({},"__esModule",{value:!0}),e);var L={};P(L,{generateMovieCarouselSchema:()=>M});module.exports=O(L);const g=e=>typeof e=="string"?{"@type":"Person",name:e}:{"@type":"Person",name:e.name,...e.url&&{url:e.url}},R=e=>{if(e)return typeof e=="string"?e:{"@type":"ImageObject",url:e.url,...e.width&&{width:e.width},...e.height&&{height:e.height}}},y=e=>e?/^[A-Z]{3}$/.test(e):!1,h=["InStock","OutOfStock","PreOrder","PreSale","Discontinued","OnlineOnly","InStoreOnly","LimitedAvailability","BackOrder"],w=e=>{if(e)try{const i=String(e);if(i.startsWith("http")){const a=i.replace(/https?:\/\/schema\.org\//i,"");return h.includes(a)?`https://schema.org/${a}`:void 0}return h.includes(i)?`https://schema.org/${i}`:void 0}catch{return}},M=({name:e,url:i,items:a,skipInvalidCurrency:u=!1})=>{const l={"@context":"https://schema.org","@type":"ItemList",itemListElement:a.map((r,v)=>{const t={"@type":"Movie",name:r.name};r.url&&(t.url=r.url),r.id&&(t["@id"]=r.id);const p=R(r.image);if(p&&(t.image=p),r.description&&(t.description=r.description),r.datePublished&&(t.datePublished=r.datePublished),r.duration&&(t.duration=r.duration),r.genre&&(t.genre=Array.isArray(r.genre)?r.genre.join(", "):r.genre),r.director&&(Array.isArray(r.director)?t.director=r.director.map(c=>g(c)):t.director=g(r.director)),r.actor&&(Array.isArray(r.actor)?t.actor=r.actor.map(c=>g(c)):t.actor=g(r.actor)),r.aggregateRating&&(t.aggregateRating={"@type":"AggregateRating",ratingValue:r.aggregateRating.ratingValue,...r.aggregateRating.reviewCount!=null&&{reviewCount:r.aggregateRating.reviewCount}}),r.offers){const c=Array.isArray(r.offers)?r.offers:[r.offers],f=c.map(n=>{if(n.priceCurrency&&!y(n.priceCurrency))return{__invalidCurrency:n.priceCurrency};const s={"@type":"Offer"};if(n.price!=null&&(s.price=n.price),n.priceCurrency&&(s.priceCurrency=n.priceCurrency),n.availability){const m=w(n.availability);m&&(s.availability=m)}return n.url&&(s.url=n.url),s}).filter(n=>n&&!("__invalidCurrency"in n));if(c.some(n=>n.priceCurrency&&!y(n.priceCurrency))&&!u){const n=c.find(s=>s.priceCurrency&&!y(s.priceCurrency));throw new Error(`Invalid currency code: ${n?.priceCurrency}`)}f.length===1?t.offers=f[0]:f.length>1&&(t.offers=f)}return{"@type":"ListItem",position:v+1,item:t}})};return e&&(l.name=e),i&&(l.mainEntityOfPage={"@type":"WebPage","@id":i}),l};0&&(module.exports={generateMovieCarouselSchema});
|
|
@@ -25,7 +25,7 @@ interface Organization {
|
|
|
25
25
|
streetAddress: string;
|
|
26
26
|
telephone: string;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
declare const generateOrganizationSchema: ({ addressCountry, addressLocality, addressRegion, appName, baseUrl, description, email, image, logo, postalCode, sameAsArr, streetAddress, telephone, }: Organization) => {
|
|
29
29
|
'@context': string;
|
|
30
30
|
'@type': string;
|
|
31
31
|
image: string;
|
|
@@ -45,4 +45,5 @@ export declare const generateOrganizationSchema: ({ addressCountry, addressLocal
|
|
|
45
45
|
postalCode: string;
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
export { generateOrganizationSchema };
|