@react-pakistan/util-functions 1.25.90 → 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 -266
- package/edu-pilot-pro/types/academics.js +1 -9
- package/edu-pilot-pro/types/admission.d.ts +803 -10
- package/edu-pilot-pro/types/admission.js +1 -7
- package/edu-pilot-pro/types/communication.d.ts +2 -165
- package/edu-pilot-pro/types/communication.js +1 -8
- package/edu-pilot-pro/types/enums.d.ts +30 -28
- package/edu-pilot-pro/types/enums.js +1 -445
- package/edu-pilot-pro/types/finance.d.ts +2 -128
- package/edu-pilot-pro/types/finance.js +1 -8
- package/edu-pilot-pro/types/index.d.ts +2 -12
- package/edu-pilot-pro/types/index.js +1 -28
- package/edu-pilot-pro/types/user-management.d.ts +2 -236
- package/edu-pilot-pro/types/user-management.js +1 -8
- 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
|
@@ -1,39 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org `Organization` JSON-LD.
|
|
4
|
-
*
|
|
5
|
-
* This helper builds a minimal `Organization` object including `address`,
|
|
6
|
-
* `logo`, `image`, `email`, and `telephone`. The input shape is an
|
|
7
|
-
* application-specific `Organization` interface defined below — the
|
|
8
|
-
* function emits only the provided properties to keep the result
|
|
9
|
-
* compact.
|
|
10
|
-
*
|
|
11
|
-
* @param options - Organization properties (see interface below)
|
|
12
|
-
* @returns A JSON-LD compatible `Organization` object
|
|
13
|
-
*/
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.generateOrganizationSchema = void 0;
|
|
16
|
-
var generateOrganizationSchema = function (_a) {
|
|
17
|
-
var addressCountry = _a.addressCountry, addressLocality = _a.addressLocality, addressRegion = _a.addressRegion, appName = _a.appName, baseUrl = _a.baseUrl, description = _a.description, email = _a.email, image = _a.image, logo = _a.logo, postalCode = _a.postalCode, sameAsArr = _a.sameAsArr, streetAddress = _a.streetAddress, telephone = _a.telephone;
|
|
18
|
-
return {
|
|
19
|
-
'@context': 'https://schema.org',
|
|
20
|
-
'@type': 'Organization',
|
|
21
|
-
image: "".concat(image),
|
|
22
|
-
url: "".concat(baseUrl),
|
|
23
|
-
sameAs: sameAsArr,
|
|
24
|
-
logo: "".concat(logo),
|
|
25
|
-
name: "".concat(appName),
|
|
26
|
-
description: "".concat(description),
|
|
27
|
-
email: "".concat(email),
|
|
28
|
-
telephone: "".concat(telephone),
|
|
29
|
-
address: {
|
|
30
|
-
'@type': 'PostalAddress',
|
|
31
|
-
streetAddress: "".concat(streetAddress),
|
|
32
|
-
addressLocality: "".concat(addressLocality),
|
|
33
|
-
addressCountry: "".concat(addressCountry),
|
|
34
|
-
addressRegion: "".concat(addressRegion),
|
|
35
|
-
postalCode: "".concat(postalCode),
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
exports.generateOrganizationSchema = generateOrganizationSchema;
|
|
1
|
+
var n=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var h=(e,s)=>{for(var t in s)n(e,t,{get:s[t],enumerable:!0})},u=(e,s,t,a)=>{if(s&&typeof s=="object"||typeof s=="function")for(let r of y(s))!A.call(e,r)&&r!==t&&n(e,r,{get:()=>s[r],enumerable:!(a=c(s,r))||a.enumerable});return e};var z=e=>u(n({},"__esModule",{value:!0}),e);var O={};h(O,{generateOrganizationSchema:()=>C});module.exports=z(O);const C=({addressCountry:e,addressLocality:s,addressRegion:t,appName:a,baseUrl:r,description:i,email:o,image:g,logo:d,postalCode:l,sameAsArr:p,streetAddress:$,telephone:m})=>({"@context":"https://schema.org","@type":"Organization",image:`${g}`,url:`${r}`,sameAs:p,logo:`${d}`,name:`${a}`,description:`${i}`,email:`${o}`,telephone:`${m}`,address:{"@type":"PostalAddress",streetAddress:`${$}`,addressLocality:`${s}`,addressCountry:`${e}`,addressRegion:`${t}`,postalCode:`${l}`}});0&&(module.exports={generateOrganizationSchema});
|
|
@@ -32,5 +32,6 @@ interface ProfilePageOptions {
|
|
|
32
32
|
author?: PersonRef | OrgRef;
|
|
33
33
|
about?: string[];
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
declare const generateProfilePageSchema: ({ name, headline, url, description, mainEntity, author, about, }: ProfilePageOptions) => any;
|
|
36
|
+
|
|
37
|
+
export { generateProfilePageSchema };
|
|
@@ -1,82 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org `ProfilePage` JSON-LD describing a person or profile.
|
|
4
|
-
*
|
|
5
|
-
* Accepts a `mainEntity` person object along with optional author or
|
|
6
|
-
* organization metadata. Images are normalized to `ImageObject` entries.
|
|
7
|
-
*
|
|
8
|
-
* See `ProfilePageOptions` and `PersonRef` for the input shape.
|
|
9
|
-
* @returns A JSON-LD compatible `ProfilePage` object
|
|
10
|
-
*/
|
|
11
|
-
var __assign = (this && this.__assign) || function () {
|
|
12
|
-
__assign = Object.assign || function(t) {
|
|
13
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
14
|
-
s = arguments[i];
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
}
|
|
18
|
-
return t;
|
|
19
|
-
};
|
|
20
|
-
return __assign.apply(this, arguments);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.generateProfilePageSchema = void 0;
|
|
24
|
-
var formatImage = function (image) {
|
|
25
|
-
if (!image)
|
|
26
|
-
return undefined;
|
|
27
|
-
if (typeof image === 'string')
|
|
28
|
-
return image;
|
|
29
|
-
return __assign(__assign({ '@type': 'ImageObject', url: image.url }, (image.width && { width: image.width })), (image.height && { height: image.height }));
|
|
30
|
-
};
|
|
31
|
-
var formatPerson = function (p) {
|
|
32
|
-
if (!p)
|
|
33
|
-
return undefined;
|
|
34
|
-
var out = { '@type': 'Person', name: p.name };
|
|
35
|
-
if (p.url)
|
|
36
|
-
out.url = p.url;
|
|
37
|
-
if (p.sameAs)
|
|
38
|
-
out.sameAs = p.sameAs;
|
|
39
|
-
if (p.jobTitle)
|
|
40
|
-
out.jobTitle = p.jobTitle;
|
|
41
|
-
var img = formatImage(p.image);
|
|
42
|
-
if (img)
|
|
43
|
-
out.image = img;
|
|
44
|
-
return out;
|
|
45
|
-
};
|
|
46
|
-
var formatAuthor = function (a) {
|
|
47
|
-
if (!a)
|
|
48
|
-
return undefined;
|
|
49
|
-
var isPerson = a.jobTitle !== undefined ||
|
|
50
|
-
a.sameAs !== undefined;
|
|
51
|
-
if (isPerson)
|
|
52
|
-
return formatPerson(a);
|
|
53
|
-
var out = { '@type': 'Organization', name: a.name };
|
|
54
|
-
if (a.url)
|
|
55
|
-
out.url = a.url;
|
|
56
|
-
return out;
|
|
57
|
-
};
|
|
58
|
-
var generateProfilePageSchema = function (_a) {
|
|
59
|
-
var name = _a.name, headline = _a.headline, url = _a.url, description = _a.description, mainEntity = _a.mainEntity, author = _a.author, about = _a.about;
|
|
60
|
-
var schema = {
|
|
61
|
-
'@context': 'https://schema.org',
|
|
62
|
-
'@type': 'ProfilePage',
|
|
63
|
-
};
|
|
64
|
-
if (name)
|
|
65
|
-
schema.name = name;
|
|
66
|
-
if (headline)
|
|
67
|
-
schema.headline = headline;
|
|
68
|
-
if (url)
|
|
69
|
-
schema.mainEntityOfPage = { '@type': 'WebPage', '@id': url };
|
|
70
|
-
if (description)
|
|
71
|
-
schema.description = description;
|
|
72
|
-
var me = formatPerson(mainEntity);
|
|
73
|
-
if (me)
|
|
74
|
-
schema.mainEntity = me;
|
|
75
|
-
var a = formatAuthor(author);
|
|
76
|
-
if (a)
|
|
77
|
-
schema.author = a;
|
|
78
|
-
if (about && about.length > 0)
|
|
79
|
-
schema.about = about;
|
|
80
|
-
return schema;
|
|
81
|
-
};
|
|
82
|
-
exports.generateProfilePageSchema = generateProfilePageSchema;
|
|
1
|
+
var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var h=(e,n)=>{for(var t in n)a(e,t,{get:n[t],enumerable:!0})},d=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of P(n))!c.call(e,i)&&i!==t&&a(e,i,{get:()=>n[i],enumerable:!(s=l(n,i))||s.enumerable});return e};var R=e=>d(a({},"__esModule",{value:!0}),e);var j={};h(j,{generateProfilePageSchema:()=>b});module.exports=R(j);const y=e=>{if(e)return typeof e=="string"?e:{"@type":"ImageObject",url:e.url,...e.width&&{width:e.width},...e.height&&{height:e.height}}},u=e=>{if(!e)return;const n={"@type":"Person",name:e.name};e.url&&(n.url=e.url),e.sameAs&&(n.sameAs=e.sameAs),e.jobTitle&&(n.jobTitle=e.jobTitle);const t=y(e.image);return t&&(n.image=t),n},O=e=>{if(!e)return;if(e.jobTitle!==void 0||e.sameAs!==void 0)return u(e);const t={"@type":"Organization",name:e.name};return e.url&&(t.url=e.url),t},b=({name:e,headline:n,url:t,description:s,mainEntity:i,author:m,about:f})=>{const r={"@context":"https://schema.org","@type":"ProfilePage"};e&&(r.name=e),n&&(r.headline=n),t&&(r.mainEntityOfPage={"@type":"WebPage","@id":t}),s&&(r.description=s);const o=u(i);o&&(r.mainEntity=o);const g=O(m);return g&&(r.author=g),f&&f.length>0&&(r.about=f),r};0&&(module.exports={generateProfilePageSchema});
|
|
@@ -29,5 +29,6 @@ interface QAPageOptions {
|
|
|
29
29
|
headline?: string;
|
|
30
30
|
mainEntity: QuestionItem;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
declare const generateQAPageSchema: ({ headline, mainEntity, }: QAPageOptions) => any;
|
|
33
|
+
|
|
34
|
+
export { generateQAPageSchema };
|
|
@@ -1,67 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org `QAPage` JSON-LD (Question + Answers).
|
|
4
|
-
*
|
|
5
|
-
* The helper formats a single `Question` and its `Answer` entries,
|
|
6
|
-
* including author references and date fields. Use `acceptedAnswer` and
|
|
7
|
-
* `suggestedAnswer` to provide preferred or additional answers.
|
|
8
|
-
*
|
|
9
|
-
* See `QAPageOptions` and related types for the input contract.
|
|
10
|
-
* @returns A JSON-LD compatible `QAPage` object
|
|
11
|
-
*/
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.generateQAPageSchema = 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', name: p.name };
|
|
20
|
-
if (p.url)
|
|
21
|
-
out.url = p.url;
|
|
22
|
-
return out;
|
|
23
|
-
};
|
|
24
|
-
var formatAnswer = function (a) {
|
|
25
|
-
var out = { '@type': 'Answer' };
|
|
26
|
-
if (a.text)
|
|
27
|
-
out.text = a.text;
|
|
28
|
-
if (a.author)
|
|
29
|
-
out.author = formatPerson(a.author);
|
|
30
|
-
if (a.datePublished)
|
|
31
|
-
out.datePublished = a.datePublished;
|
|
32
|
-
return out;
|
|
33
|
-
};
|
|
34
|
-
var generateQAPageSchema = function (_a) {
|
|
35
|
-
var headline = _a.headline, mainEntity = _a.mainEntity;
|
|
36
|
-
var question = {
|
|
37
|
-
'@type': 'Question',
|
|
38
|
-
name: mainEntity.name,
|
|
39
|
-
};
|
|
40
|
-
if (mainEntity.text)
|
|
41
|
-
question.text = mainEntity.text;
|
|
42
|
-
if (mainEntity.author)
|
|
43
|
-
question.author = formatPerson(mainEntity.author);
|
|
44
|
-
if (mainEntity.datePublished)
|
|
45
|
-
question.datePublished = mainEntity.datePublished;
|
|
46
|
-
if (mainEntity.answers && mainEntity.answers.length > 0) {
|
|
47
|
-
question.answerCount = mainEntity.answers.length;
|
|
48
|
-
question.acceptedAnswer = mainEntity.acceptedAnswer
|
|
49
|
-
? formatAnswer(mainEntity.acceptedAnswer)
|
|
50
|
-
: undefined;
|
|
51
|
-
question.suggestedAnswer = mainEntity.answers
|
|
52
|
-
.filter(function (a) {
|
|
53
|
-
return !mainEntity.acceptedAnswer ||
|
|
54
|
-
a.text !== mainEntity.acceptedAnswer.text;
|
|
55
|
-
})
|
|
56
|
-
.map(function (a) { return formatAnswer(a); });
|
|
57
|
-
}
|
|
58
|
-
var schema = {
|
|
59
|
-
'@context': 'https://schema.org',
|
|
60
|
-
'@type': 'QAPage',
|
|
61
|
-
mainEntity: question,
|
|
62
|
-
};
|
|
63
|
-
if (headline)
|
|
64
|
-
schema.headline = headline;
|
|
65
|
-
return schema;
|
|
66
|
-
};
|
|
67
|
-
exports.generateQAPageSchema = generateQAPageSchema;
|
|
1
|
+
var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var s in e)a(t,s,{get:e[s],enumerable:!0})},g=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of c(e))!f.call(t,r)&&r!==s&&a(t,r,{get:()=>e[r],enumerable:!(n=d(e,r))||n.enumerable});return t};var i=t=>g(a({},"__esModule",{value:!0}),t);var P={};h(P,{generateQAPageSchema:()=>w});module.exports=i(P);const o=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Person",name:t};const e={"@type":"Person",name:t.name};return t.url&&(e.url=t.url),e},u=t=>{const e={"@type":"Answer"};return t.text&&(e.text=t.text),t.author&&(e.author=o(t.author)),t.datePublished&&(e.datePublished=t.datePublished),e},w=({headline:t,mainEntity:e})=>{const s={"@type":"Question",name:e.name};e.text&&(s.text=e.text),e.author&&(s.author=o(e.author)),e.datePublished&&(s.datePublished=e.datePublished),e.answers&&e.answers.length>0&&(s.answerCount=e.answers.length,s.acceptedAnswer=e.acceptedAnswer?u(e.acceptedAnswer):void 0,s.suggestedAnswer=e.answers.filter(r=>!e.acceptedAnswer||r.text!==e.acceptedAnswer.text).map(r=>u(r)));const n={"@context":"https://schema.org","@type":"QAPage",mainEntity:s};return t&&(n.headline=t),n};0&&(module.exports={generateQAPageSchema});
|
|
@@ -44,5 +44,6 @@ interface RecipeOptions {
|
|
|
44
44
|
recipeInstructions?: HowToStep[];
|
|
45
45
|
aggregateRating?: AggregateRating;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
declare const generateRecipeSchema: ({ name, description, image, author, recipeYield, prepTime, cookTime, totalTime, recipeCategory, recipeCuisine, keywords, recipeIngredient, recipeInstructions, aggregateRating, }: RecipeOptions) => any;
|
|
48
|
+
|
|
49
|
+
export { generateRecipeSchema };
|
|
@@ -1,104 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org `Recipe` JSON-LD, with support for `HowToStep`
|
|
4
|
-
* instructions and `ItemList` ingredients.
|
|
5
|
-
*
|
|
6
|
-
* Accepts recipe metadata (times, yields, cuisine, ingredients, steps)
|
|
7
|
-
* and will format steps as `HowToStep` objects and images as `ImageObject`
|
|
8
|
-
* entries when provided.
|
|
9
|
-
*
|
|
10
|
-
* See `RecipeOptions` for the accepted input shape.
|
|
11
|
-
* @returns A JSON-LD compatible `Recipe` 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.generateRecipeSchema = void 0;
|
|
26
|
-
var formatImage = function (image) {
|
|
27
|
-
if (!image)
|
|
28
|
-
return undefined;
|
|
29
|
-
if (typeof image === 'string')
|
|
30
|
-
return image;
|
|
31
|
-
return __assign(__assign({ '@type': 'ImageObject', url: image.url }, (image.width && { width: image.width })), (image.height && { height: image.height }));
|
|
32
|
-
};
|
|
33
|
-
var formatPerson = function (p) {
|
|
34
|
-
if (!p)
|
|
35
|
-
return undefined;
|
|
36
|
-
if (typeof p === 'string')
|
|
37
|
-
return { '@type': 'Person', name: p };
|
|
38
|
-
var out = { '@type': 'Person', name: p.name };
|
|
39
|
-
if (p.url)
|
|
40
|
-
out.url = p.url;
|
|
41
|
-
return out;
|
|
42
|
-
};
|
|
43
|
-
var formatHowToStep = function (s) {
|
|
44
|
-
var out = { '@type': 'HowToStep' };
|
|
45
|
-
if (s.name)
|
|
46
|
-
out.name = s.name;
|
|
47
|
-
if (s.text)
|
|
48
|
-
out.text = s.text;
|
|
49
|
-
if (s.url)
|
|
50
|
-
out.url = s.url;
|
|
51
|
-
var img = formatImage(s.image);
|
|
52
|
-
if (img)
|
|
53
|
-
out.image = img;
|
|
54
|
-
return out;
|
|
55
|
-
};
|
|
56
|
-
var generateRecipeSchema = function (_a) {
|
|
57
|
-
var name = _a.name, description = _a.description, image = _a.image, author = _a.author, recipeYield = _a.recipeYield, prepTime = _a.prepTime, cookTime = _a.cookTime, totalTime = _a.totalTime, recipeCategory = _a.recipeCategory, recipeCuisine = _a.recipeCuisine, keywords = _a.keywords, recipeIngredient = _a.recipeIngredient, recipeInstructions = _a.recipeInstructions, aggregateRating = _a.aggregateRating;
|
|
58
|
-
var schema = {
|
|
59
|
-
'@context': 'https://schema.org',
|
|
60
|
-
'@type': 'Recipe',
|
|
61
|
-
name: name,
|
|
62
|
-
};
|
|
63
|
-
if (description)
|
|
64
|
-
schema.description = description;
|
|
65
|
-
var img = formatImage(image);
|
|
66
|
-
if (img)
|
|
67
|
-
schema.image = img;
|
|
68
|
-
var a = formatPerson(author);
|
|
69
|
-
if (a)
|
|
70
|
-
schema.author = a;
|
|
71
|
-
if (recipeYield)
|
|
72
|
-
schema.recipeYield = recipeYield;
|
|
73
|
-
if (prepTime)
|
|
74
|
-
schema.prepTime = prepTime;
|
|
75
|
-
if (cookTime)
|
|
76
|
-
schema.cookTime = cookTime;
|
|
77
|
-
if (totalTime)
|
|
78
|
-
schema.totalTime = totalTime;
|
|
79
|
-
if (recipeCategory)
|
|
80
|
-
schema.recipeCategory = Array.isArray(recipeCategory)
|
|
81
|
-
? recipeCategory.join(', ')
|
|
82
|
-
: recipeCategory;
|
|
83
|
-
if (recipeCuisine)
|
|
84
|
-
schema.recipeCuisine = Array.isArray(recipeCuisine)
|
|
85
|
-
? recipeCuisine.join(', ')
|
|
86
|
-
: recipeCuisine;
|
|
87
|
-
if (keywords)
|
|
88
|
-
schema.keywords = Array.isArray(keywords) ? keywords.join(', ') : keywords;
|
|
89
|
-
if (recipeIngredient && recipeIngredient.length > 0)
|
|
90
|
-
schema.recipeIngredient = recipeIngredient;
|
|
91
|
-
if (recipeInstructions && recipeInstructions.length > 0) {
|
|
92
|
-
schema.recipeInstructions = recipeInstructions.map(formatHowToStep);
|
|
93
|
-
}
|
|
94
|
-
if (aggregateRating) {
|
|
95
|
-
schema.aggregateRating = {
|
|
96
|
-
'@type': 'AggregateRating',
|
|
97
|
-
ratingValue: aggregateRating.ratingValue,
|
|
98
|
-
};
|
|
99
|
-
if (aggregateRating.reviewCount != null)
|
|
100
|
-
schema.aggregateRating.reviewCount = aggregateRating.reviewCount;
|
|
101
|
-
}
|
|
102
|
-
return schema;
|
|
103
|
-
};
|
|
104
|
-
exports.generateRecipeSchema = generateRecipeSchema;
|
|
1
|
+
var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var x=(t,e)=>{for(var r in e)c(t,r,{get:e[r],enumerable:!0})},I=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of A(e))!T.call(t,i)&&i!==r&&c(t,i,{get:()=>e[i],enumerable:!(a=d(e,i))||a.enumerable});return t};var P=t=>I(c({},"__esModule",{value:!0}),t);var j={};x(j,{generateRecipeSchema:()=>H});module.exports=P(j);const w=t=>{if(t)return typeof t=="string"?t:{"@type":"ImageObject",url:t.url,...t.width&&{width:t.width},...t.height&&{height:t.height}}},S=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Person",name:t};const e={"@type":"Person",name:t.name};return t.url&&(e.url=t.url),e},b=t=>{const e={"@type":"HowToStep"};t.name&&(e.name=t.name),t.text&&(e.text=t.text),t.url&&(e.url=t.url);const r=w(t.image);return r&&(e.image=r),e},H=({name:t,description:e,image:r,author:a,recipeYield:i,prepTime:h,cookTime:l,totalTime:p,recipeCategory:g,recipeCuisine:o,keywords:s,recipeIngredient:u,recipeInstructions:m,aggregateRating:f})=>{const n={"@context":"https://schema.org","@type":"Recipe",name:t};e&&(n.description=e);const y=w(r);y&&(n.image=y);const R=S(a);return R&&(n.author=R),i&&(n.recipeYield=i),h&&(n.prepTime=h),l&&(n.cookTime=l),p&&(n.totalTime=p),g&&(n.recipeCategory=Array.isArray(g)?g.join(", "):g),o&&(n.recipeCuisine=Array.isArray(o)?o.join(", "):o),s&&(n.keywords=Array.isArray(s)?s.join(", "):s),u&&u.length>0&&(n.recipeIngredient=u),m&&m.length>0&&(n.recipeInstructions=m.map(b)),f&&(n.aggregateRating={"@type":"AggregateRating",ratingValue:f.ratingValue},f.reviewCount!=null&&(n.aggregateRating.reviewCount=f.reviewCount)),n};0&&(module.exports={generateRecipeSchema});
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
interface Params {
|
|
2
2
|
refLength: number;
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Generates a short reference code from a UUID slice and the current 2-digit year.
|
|
6
|
+
* @param params.refLength - Length of the UUID slice (default 5).
|
|
7
|
+
* @returns The generated reference string.
|
|
8
|
+
*/
|
|
9
|
+
declare const generateRef: ({ refLength }: Params) => string;
|
|
10
|
+
|
|
11
|
+
export { generateRef };
|
package/general/generate-ref.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateRef = void 0;
|
|
4
|
-
var uuid_1 = require("uuid");
|
|
5
|
-
var constants_1 = require("../constants");
|
|
6
|
-
var generateRef = function (_a) {
|
|
7
|
-
var _b = _a.refLength, refLength = _b === void 0 ? 5 : _b;
|
|
8
|
-
var ref = (0, uuid_1.v4)().toUpperCase().slice(0, refLength);
|
|
9
|
-
var currentYear = new Date().getFullYear().toString().slice(-2);
|
|
10
|
-
return "".concat(ref).concat(constants_1.VALUE_DELIMITER.SLASH).concat(currentYear);
|
|
11
|
-
};
|
|
12
|
-
exports.generateRef = generateRef;
|
|
1
|
+
var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var u=(r,e)=>{for(var t in e)a(r,t,{get:e[t],enumerable:!0})},g=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of m(e))!f.call(r,n)&&n!==t&&a(r,n,{get:()=>e[n],enumerable:!(o=c(e,n))||o.enumerable});return r};var p=r=>g(a({},"__esModule",{value:!0}),r);var L={};u(L,{generateRef:()=>l});module.exports=p(L);var s=require("uuid"),i=require("../constants/select-value-delimiter");const l=({refLength:r=5})=>{const e=(0,s.v4)().toUpperCase().slice(0,r),t=new Date().getFullYear().toString().slice(-2);return`${e}${i.VALUE_DELIMITER.SLASH}${t}`};0&&(module.exports={generateRef});
|
|
@@ -47,5 +47,6 @@ interface ReviewSnippetOptions {
|
|
|
47
47
|
reviews?: ReviewItem[];
|
|
48
48
|
aggregateRating?: AggregateRatingOptions;
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
declare const generateReviewSnippetSchema: ({ itemReviewed, reviews, aggregateRating, }: ReviewSnippetOptions) => any;
|
|
51
|
+
|
|
52
|
+
export { generateReviewSnippetSchema as default, generateReviewSnippetSchema };
|
|
@@ -1,137 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate structured data for Review snippets and `AggregateRating`.
|
|
4
|
-
*
|
|
5
|
-
* Accepts a compact `ReviewSnippetOptions` object and returns a plain object
|
|
6
|
-
* compatible with schema.org JSON-LD for embedding in a page. The function
|
|
7
|
-
* supports formatting `Person` and `Organization` references and can produce
|
|
8
|
-
* an `AggregateRating` object either from supplied options or derived from
|
|
9
|
-
* reviews.
|
|
10
|
-
*
|
|
11
|
-
* See the TypeScript interfaces below for the exact input shape.
|
|
12
|
-
* @returns A JSON-LD compatible Review / ReviewSnippet object
|
|
13
|
-
*/
|
|
14
|
-
var __assign = (this && this.__assign) || function () {
|
|
15
|
-
__assign = Object.assign || function(t) {
|
|
16
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
-
s = arguments[i];
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
return __assign.apply(this, arguments);
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.generateReviewSnippetSchema = void 0;
|
|
27
|
-
var formatPerson = function (p) {
|
|
28
|
-
if (!p)
|
|
29
|
-
return undefined;
|
|
30
|
-
if (typeof p === 'string')
|
|
31
|
-
return { '@type': 'Person', name: p };
|
|
32
|
-
var out = { '@type': 'Person', name: p.name };
|
|
33
|
-
if (p.url)
|
|
34
|
-
out.url = p.url;
|
|
35
|
-
return out;
|
|
36
|
-
};
|
|
37
|
-
var formatOrganization = function (o) {
|
|
38
|
-
if (!o)
|
|
39
|
-
return undefined;
|
|
40
|
-
if (typeof o === 'string')
|
|
41
|
-
return { '@type': 'Organization', name: o };
|
|
42
|
-
var out = { '@type': 'Organization', name: o.name };
|
|
43
|
-
if (o.url)
|
|
44
|
-
out.url = o.url;
|
|
45
|
-
return out;
|
|
46
|
-
};
|
|
47
|
-
var formatReview = function (r) {
|
|
48
|
-
var out = { '@type': 'Review' };
|
|
49
|
-
if (r.author)
|
|
50
|
-
out.author = formatPerson(r.author);
|
|
51
|
-
if (r.datePublished)
|
|
52
|
-
out.datePublished = r.datePublished;
|
|
53
|
-
if (r.reviewBody)
|
|
54
|
-
out.reviewBody = r.reviewBody;
|
|
55
|
-
if (r.name)
|
|
56
|
-
out.name = r.name;
|
|
57
|
-
if (r.url)
|
|
58
|
-
out.url = r.url;
|
|
59
|
-
if (r.publisher)
|
|
60
|
-
out.publisher = formatOrganization(r.publisher);
|
|
61
|
-
if (r.reviewRating) {
|
|
62
|
-
out.reviewRating = __assign(__assign({ '@type': 'Rating', ratingValue: r.reviewRating.ratingValue }, (r.reviewRating.bestRating != null && {
|
|
63
|
-
bestRating: r.reviewRating.bestRating,
|
|
64
|
-
})), (r.reviewRating.worstRating != null && {
|
|
65
|
-
worstRating: r.reviewRating.worstRating,
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
return out;
|
|
69
|
-
};
|
|
70
|
-
var generateReviewSnippetSchema = function (_a) {
|
|
71
|
-
var itemReviewed = _a.itemReviewed, reviews = _a.reviews, aggregateRating = _a.aggregateRating;
|
|
72
|
-
// If an itemReviewed is provided we return that item with nested review(s)
|
|
73
|
-
var hasItem = !!itemReviewed;
|
|
74
|
-
// Map reviews if present
|
|
75
|
-
var mappedReviews = reviews && reviews.length > 0 ? reviews.map(formatReview) : undefined;
|
|
76
|
-
// Compute aggregate rating from provided aggregateRating or from reviews
|
|
77
|
-
var agg = undefined;
|
|
78
|
-
if (aggregateRating) {
|
|
79
|
-
agg = __assign(__assign(__assign(__assign({ '@type': 'AggregateRating', ratingValue: aggregateRating.ratingValue }, (aggregateRating.reviewCount != null && {
|
|
80
|
-
reviewCount: aggregateRating.reviewCount,
|
|
81
|
-
})), (aggregateRating.ratingCount != null && {
|
|
82
|
-
ratingCount: aggregateRating.ratingCount,
|
|
83
|
-
})), (aggregateRating.bestRating != null && {
|
|
84
|
-
bestRating: aggregateRating.bestRating,
|
|
85
|
-
})), (aggregateRating.worstRating != null && {
|
|
86
|
-
worstRating: aggregateRating.worstRating,
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
89
|
-
else if (reviews && reviews.length > 0) {
|
|
90
|
-
var ratings = reviews
|
|
91
|
-
.map(function (r) { return (r.reviewRating ? Number(r.reviewRating.ratingValue) : NaN); })
|
|
92
|
-
.filter(function (n) { return !Number.isNaN(n); });
|
|
93
|
-
if (ratings.length > 0) {
|
|
94
|
-
var sum = ratings.reduce(function (a, b) { return a + b; }, 0);
|
|
95
|
-
agg = {
|
|
96
|
-
'@type': 'AggregateRating',
|
|
97
|
-
ratingValue: sum / ratings.length,
|
|
98
|
-
reviewCount: reviews.length,
|
|
99
|
-
ratingCount: ratings.length,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (hasItem) {
|
|
104
|
-
var item = {
|
|
105
|
-
'@context': 'https://schema.org',
|
|
106
|
-
'@type': typeof itemReviewed === 'string'
|
|
107
|
-
? 'Thing'
|
|
108
|
-
: (itemReviewed === null || itemReviewed === void 0 ? void 0 : itemReviewed['@type']) || 'Thing',
|
|
109
|
-
name: typeof itemReviewed === 'string'
|
|
110
|
-
? itemReviewed
|
|
111
|
-
: itemReviewed.name,
|
|
112
|
-
};
|
|
113
|
-
if (mappedReviews)
|
|
114
|
-
item.review = mappedReviews;
|
|
115
|
-
if (agg)
|
|
116
|
-
item.aggregateRating = agg;
|
|
117
|
-
return item;
|
|
118
|
-
}
|
|
119
|
-
// No itemReviewed -> if single review return a Review object, else return an array wrapper
|
|
120
|
-
if (mappedReviews && mappedReviews.length === 1) {
|
|
121
|
-
var r = mappedReviews[0];
|
|
122
|
-
var schema_1 = __assign({ '@context': 'https://schema.org' }, r);
|
|
123
|
-
if (agg)
|
|
124
|
-
schema_1.aggregateRating = agg;
|
|
125
|
-
return schema_1;
|
|
126
|
-
}
|
|
127
|
-
var schema = {
|
|
128
|
-
'@context': 'https://schema.org',
|
|
129
|
-
};
|
|
130
|
-
if (mappedReviews)
|
|
131
|
-
schema.review = mappedReviews;
|
|
132
|
-
if (agg)
|
|
133
|
-
schema.aggregateRating = agg;
|
|
134
|
-
return schema;
|
|
135
|
-
};
|
|
136
|
-
exports.generateReviewSnippetSchema = generateReviewSnippetSchema;
|
|
137
|
-
exports.default = exports.generateReviewSnippetSchema;
|
|
1
|
+
var o=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var h=(t,n)=>{for(var e in n)o(t,e,{get:n[e],enumerable:!0})},w=(t,n,e,g)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of p(n))!c.call(t,i)&&i!==e&&o(t,i,{get:()=>n[i],enumerable:!(g=R(n,i))||g.enumerable});return t};var y=t=>w(o({},"__esModule",{value:!0}),t);var O={};h(O,{default:()=>C,generateReviewSnippetSchema:()=>l});module.exports=y(O);const b=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Person",name:t};const n={"@type":"Person",name:t.name};return t.url&&(n.url=t.url),n},v=t=>{if(!t)return;if(typeof t=="string")return{"@type":"Organization",name:t};const n={"@type":"Organization",name:t.name};return t.url&&(n.url=t.url),n},d=t=>{const n={"@type":"Review"};return t.author&&(n.author=b(t.author)),t.datePublished&&(n.datePublished=t.datePublished),t.reviewBody&&(n.reviewBody=t.reviewBody),t.name&&(n.name=t.name),t.url&&(n.url=t.url),t.publisher&&(n.publisher=v(t.publisher)),t.reviewRating&&(n.reviewRating={"@type":"Rating",ratingValue:t.reviewRating.ratingValue,...t.reviewRating.bestRating!=null&&{bestRating:t.reviewRating.bestRating},...t.reviewRating.worstRating!=null&&{worstRating:t.reviewRating.worstRating}}),n},l=({itemReviewed:t,reviews:n,aggregateRating:e})=>{const g=!!t,i=n&&n.length>0?n.map(d):void 0;let a;if(e)a={"@type":"AggregateRating",ratingValue:e.ratingValue,...e.reviewCount!=null&&{reviewCount:e.reviewCount},...e.ratingCount!=null&&{ratingCount:e.ratingCount},...e.bestRating!=null&&{bestRating:e.bestRating},...e.worstRating!=null&&{worstRating:e.worstRating}};else if(n&&n.length>0){const r=n.map(s=>s.reviewRating?Number(s.reviewRating.ratingValue):NaN).filter(s=>!Number.isNaN(s));r.length>0&&(a={"@type":"AggregateRating",ratingValue:r.reduce((f,m)=>f+m,0)/r.length,reviewCount:n.length,ratingCount:r.length})}if(g){const r={"@context":"https://schema.org","@type":typeof t=="string"?"Thing":t?.["@type"]||"Thing",name:typeof t=="string"?t:t.name};return i&&(r.review=i),a&&(r.aggregateRating=a),r}if(i&&i.length===1){const s={"@context":"https://schema.org",...i[0]};return a&&(s.aggregateRating=a),s}const u={"@context":"https://schema.org"};return i&&(u.review=i),a&&(u.aggregateRating=a),u};var C=l;0&&(module.exports={generateReviewSnippetSchema});
|
|
@@ -33,5 +33,6 @@ interface LoyaltyOptions {
|
|
|
33
33
|
benefits?: string[];
|
|
34
34
|
offers?: LoyaltyOffer[];
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
declare const generateShoppingLoyaltyProgramSchema: ({ programName, programUrl, programId, member, membershipNumber, enrollmentDate, pointsBalance, pointsEarned, benefits, offers, }: LoyaltyOptions) => any;
|
|
37
|
+
|
|
38
|
+
export { generateShoppingLoyaltyProgramSchema };
|
|
@@ -1,59 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* Generate schema.org structured data for a loyalty or membership program
|
|
4
|
-
* (`ProgramMembership`).
|
|
5
|
-
*
|
|
6
|
-
* The helper formats membership details, member references, points and
|
|
7
|
-
* optional offers into a `ProgramMembership` object. Only supplied fields
|
|
8
|
-
* are emitted.
|
|
9
|
-
*
|
|
10
|
-
* See `LoyaltyOptions` for the accepted input properties.
|
|
11
|
-
* @returns A JSON-LD compatible `ProgramMembership` 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.generateShoppingLoyaltyProgramSchema = void 0;
|
|
26
|
-
var formatAgent = function (a) {
|
|
27
|
-
if (!a)
|
|
28
|
-
return undefined;
|
|
29
|
-
return __assign({ name: a.name }, (a.url && { url: a.url }));
|
|
30
|
-
};
|
|
31
|
-
var generateShoppingLoyaltyProgramSchema = function (_a) {
|
|
32
|
-
var programName = _a.programName, programUrl = _a.programUrl, programId = _a.programId, member = _a.member, membershipNumber = _a.membershipNumber, enrollmentDate = _a.enrollmentDate, pointsBalance = _a.pointsBalance, pointsEarned = _a.pointsEarned, benefits = _a.benefits, offers = _a.offers;
|
|
33
|
-
var schema = {
|
|
34
|
-
'@context': 'https://schema.org',
|
|
35
|
-
'@type': 'ProgramMembership',
|
|
36
|
-
programName: programName,
|
|
37
|
-
};
|
|
38
|
-
if (programUrl)
|
|
39
|
-
schema.url = programUrl;
|
|
40
|
-
if (programId)
|
|
41
|
-
schema['@id'] = programId;
|
|
42
|
-
if (member)
|
|
43
|
-
schema.member = formatAgent(member);
|
|
44
|
-
if (membershipNumber)
|
|
45
|
-
schema.membershipNumber = membershipNumber;
|
|
46
|
-
if (enrollmentDate)
|
|
47
|
-
schema.enrollmentDate = enrollmentDate;
|
|
48
|
-
if (typeof pointsBalance === 'number')
|
|
49
|
-
schema.pointsBalance = pointsBalance;
|
|
50
|
-
if (typeof pointsEarned === 'number')
|
|
51
|
-
schema.pointsEarned = pointsEarned;
|
|
52
|
-
if (benefits && benefits.length > 0)
|
|
53
|
-
schema.benefits = benefits;
|
|
54
|
-
if (offers && offers.length > 0) {
|
|
55
|
-
schema.offers = offers.map(function (o) { return (__assign(__assign({ '@type': 'Offer' }, (o.description && { description: o.description })), (o.url && { url: o.url }))); });
|
|
56
|
-
}
|
|
57
|
-
return schema;
|
|
58
|
-
};
|
|
59
|
-
exports.generateShoppingLoyaltyProgramSchema = generateShoppingLoyaltyProgramSchema;
|
|
1
|
+
var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var b=(e,r)=>{for(var i in r)o(e,i,{get:r[i],enumerable:!0})},h=(e,r,i,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of c(r))!y.call(e,t)&&t!==i&&o(e,t,{get:()=>r[t],enumerable:!(a=u(r,t))||a.enumerable});return e};var d=e=>h(o({},"__esModule",{value:!0}),e);var L={};b(L,{generateShoppingLoyaltyProgramSchema:()=>R});module.exports=d(L);const O=e=>{if(e)return{name:e.name,...e.url&&{url:e.url}}},R=({programName:e,programUrl:r,programId:i,member:a,membershipNumber:t,enrollmentDate:g,pointsBalance:l,pointsEarned:p,benefits:s,offers:m})=>{const n={"@context":"https://schema.org","@type":"ProgramMembership",programName:e};return r&&(n.url=r),i&&(n["@id"]=i),a&&(n.member=O(a)),t&&(n.membershipNumber=t),g&&(n.enrollmentDate=g),typeof l=="number"&&(n.pointsBalance=l),typeof p=="number"&&(n.pointsEarned=p),s&&s.length>0&&(n.benefits=s),m&&m.length>0&&(n.offers=m.map(f=>({"@type":"Offer",...f.description&&{description:f.description},...f.url&&{url:f.url}}))),n};0&&(module.exports={generateShoppingLoyaltyProgramSchema});
|
|
@@ -48,5 +48,6 @@ interface MerchantListingOptions {
|
|
|
48
48
|
products: MerchantProduct[];
|
|
49
49
|
skipInvalidCurrency?: boolean;
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
declare const generateShoppingMerchantListingSchema: ({ merchant, name, url, products, skipInvalidCurrency, }: MerchantListingOptions) => any;
|
|
52
|
+
|
|
53
|
+
export { generateShoppingMerchantListingSchema };
|