@react-pakistan/util-functions 1.25.90 → 2.0.2
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 +21 -19
- package/{api/stellar-solutions → stellar-solution}/types/common.d.ts +4 -2
- package/stellar-solution/types/common.js +1 -0
- package/{api/stellar-solutions → stellar-solution}/types/erp.d.ts +36 -33
- package/stellar-solution/types/erp.js +1 -0
- package/stellar-solution/types/index.d.ts +3 -0
- package/stellar-solution/types/index.js +1 -0
- package/{api/stellar-solutions → stellar-solution}/types/pos.d.ts +27 -24
- package/stellar-solution/types/pos.js +1 -0
- 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.js +0 -22
- 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.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,231 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* URL to Base64 Conversion Utility
|
|
4
|
-
*
|
|
5
|
-
* Functions to convert URLs to base64 encoded strings.
|
|
6
|
-
*/
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
17
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
18
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
19
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
20
|
-
function step(op) {
|
|
21
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
22
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
23
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
24
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
25
|
-
switch (op[0]) {
|
|
26
|
-
case 0: case 1: t = op; break;
|
|
27
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
28
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
29
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
30
|
-
default:
|
|
31
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
32
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
33
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
34
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
35
|
-
if (t[2]) _.ops.pop();
|
|
36
|
-
_.trys.pop(); continue;
|
|
37
|
-
}
|
|
38
|
-
op = body.call(thisArg, _);
|
|
39
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
40
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.convertUrlToBase64 = convertUrlToBase64;
|
|
45
|
-
exports.convertUrlToBase64DataUri = convertUrlToBase64DataUri;
|
|
46
|
-
exports.convertUrlsToBase64 = convertUrlsToBase64;
|
|
47
|
-
exports.convertUrlsToBase64DataUris = convertUrlsToBase64DataUris;
|
|
48
|
-
exports.isValidUrl = isValidUrl;
|
|
49
|
-
exports.convertUrlToBase64WithTimeout = convertUrlToBase64WithTimeout;
|
|
50
|
-
/**
|
|
51
|
-
* Convert a URL to base64 encoded string
|
|
52
|
-
*
|
|
53
|
-
* @param url - The URL to fetch and convert
|
|
54
|
-
* @returns Promise<string> - Base64 encoded string
|
|
55
|
-
* @throws Error if the URL cannot be fetched or converted
|
|
56
|
-
*/
|
|
57
|
-
function convertUrlToBase64(url) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
-
var response, arrayBuffer, uint8Array, binaryString, i, error_1;
|
|
60
|
-
return __generator(this, function (_a) {
|
|
61
|
-
switch (_a.label) {
|
|
62
|
-
case 0:
|
|
63
|
-
_a.trys.push([0, 3, , 4]);
|
|
64
|
-
return [4 /*yield*/, fetch(url)];
|
|
65
|
-
case 1:
|
|
66
|
-
response = _a.sent();
|
|
67
|
-
if (!response.ok) {
|
|
68
|
-
throw new Error("Failed to fetch URL: ".concat(response.status, " ").concat(response.statusText));
|
|
69
|
-
}
|
|
70
|
-
return [4 /*yield*/, response.arrayBuffer()];
|
|
71
|
-
case 2:
|
|
72
|
-
arrayBuffer = _a.sent();
|
|
73
|
-
uint8Array = new Uint8Array(arrayBuffer);
|
|
74
|
-
binaryString = '';
|
|
75
|
-
for (i = 0; i < uint8Array.length; i++) {
|
|
76
|
-
binaryString += String.fromCharCode(uint8Array[i]);
|
|
77
|
-
}
|
|
78
|
-
return [2 /*return*/, btoa(binaryString)];
|
|
79
|
-
case 3:
|
|
80
|
-
error_1 = _a.sent();
|
|
81
|
-
console.error('Error converting URL to base64:', error_1);
|
|
82
|
-
throw new Error("Failed to convert URL to base64: ".concat(error_1 instanceof Error ? error_1.message : 'Unknown error'));
|
|
83
|
-
case 4: return [2 /*return*/];
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Convert a URL to base64 data URI format
|
|
90
|
-
*
|
|
91
|
-
* @param url - The URL to fetch and convert
|
|
92
|
-
* @param mimeType - Optional MIME type (will try to detect from response if not provided)
|
|
93
|
-
* @returns Promise<string> - Base64 data URI string (e.g., "data:image/png;base64,iVBORw0KGgo...")
|
|
94
|
-
* @throws Error if the URL cannot be fetched or converted
|
|
95
|
-
*/
|
|
96
|
-
function convertUrlToBase64DataUri(url, mimeType) {
|
|
97
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
-
var response, contentType, arrayBuffer, uint8Array, binaryString, i, base64, error_2;
|
|
99
|
-
return __generator(this, function (_a) {
|
|
100
|
-
switch (_a.label) {
|
|
101
|
-
case 0:
|
|
102
|
-
_a.trys.push([0, 3, , 4]);
|
|
103
|
-
return [4 /*yield*/, fetch(url)];
|
|
104
|
-
case 1:
|
|
105
|
-
response = _a.sent();
|
|
106
|
-
if (!response.ok) {
|
|
107
|
-
throw new Error("Failed to fetch URL: ".concat(response.status, " ").concat(response.statusText));
|
|
108
|
-
}
|
|
109
|
-
contentType = mimeType ||
|
|
110
|
-
response.headers.get('content-type') ||
|
|
111
|
-
'application/octet-stream';
|
|
112
|
-
return [4 /*yield*/, response.arrayBuffer()];
|
|
113
|
-
case 2:
|
|
114
|
-
arrayBuffer = _a.sent();
|
|
115
|
-
uint8Array = new Uint8Array(arrayBuffer);
|
|
116
|
-
binaryString = '';
|
|
117
|
-
for (i = 0; i < uint8Array.length; i++) {
|
|
118
|
-
binaryString += String.fromCharCode(uint8Array[i]);
|
|
119
|
-
}
|
|
120
|
-
base64 = btoa(binaryString);
|
|
121
|
-
return [2 /*return*/, "data:".concat(contentType, ";base64,").concat(base64)];
|
|
122
|
-
case 3:
|
|
123
|
-
error_2 = _a.sent();
|
|
124
|
-
console.error('Error converting URL to base64 data URI:', error_2);
|
|
125
|
-
throw new Error("Failed to convert URL to base64 data URI: ".concat(error_2 instanceof Error ? error_2.message : 'Unknown error'));
|
|
126
|
-
case 4: return [2 /*return*/];
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Convert multiple URLs to base64 strings
|
|
133
|
-
*
|
|
134
|
-
* @param urls - Array of URLs to convert
|
|
135
|
-
* @returns Promise<string[]> - Array of base64 encoded strings
|
|
136
|
-
* @throws Error if any URL cannot be fetched or converted
|
|
137
|
-
*/
|
|
138
|
-
function convertUrlsToBase64(urls) {
|
|
139
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
-
var promises;
|
|
141
|
-
return __generator(this, function (_a) {
|
|
142
|
-
promises = urls.map(function (url) { return convertUrlToBase64(url); });
|
|
143
|
-
return [2 /*return*/, Promise.all(promises)];
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Convert multiple URLs to base64 data URIs
|
|
149
|
-
*
|
|
150
|
-
* @param urls - Array of URLs to convert
|
|
151
|
-
* @param mimeTypes - Optional array of MIME types (will try to detect if not provided)
|
|
152
|
-
* @returns Promise<string[]> - Array of base64 data URI strings
|
|
153
|
-
* @throws Error if any URL cannot be fetched or converted
|
|
154
|
-
*/
|
|
155
|
-
function convertUrlsToBase64DataUris(urls, mimeTypes) {
|
|
156
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
157
|
-
var promises;
|
|
158
|
-
return __generator(this, function (_a) {
|
|
159
|
-
promises = urls.map(function (url, index) {
|
|
160
|
-
return convertUrlToBase64DataUri(url, mimeTypes === null || mimeTypes === void 0 ? void 0 : mimeTypes[index]);
|
|
161
|
-
});
|
|
162
|
-
return [2 /*return*/, Promise.all(promises)];
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Check if a string is a valid URL
|
|
168
|
-
*
|
|
169
|
-
* @param url - The string to check
|
|
170
|
-
* @returns boolean - True if the string is a valid URL
|
|
171
|
-
*/
|
|
172
|
-
function isValidUrl(url) {
|
|
173
|
-
try {
|
|
174
|
-
new URL(url);
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
catch (_a) {
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Convert a URL to base64 with timeout
|
|
183
|
-
*
|
|
184
|
-
* @param url - The URL to fetch and convert
|
|
185
|
-
* @param timeoutMs - Timeout in milliseconds (default: 10000)
|
|
186
|
-
* @returns Promise<string> - Base64 encoded string
|
|
187
|
-
* @throws Error if the URL cannot be fetched within timeout or converted
|
|
188
|
-
*/
|
|
189
|
-
function convertUrlToBase64WithTimeout(url_1) {
|
|
190
|
-
return __awaiter(this, arguments, void 0, function (url, timeoutMs) {
|
|
191
|
-
var controller, timeoutId, response, arrayBuffer, uint8Array, binaryString, i, error_3;
|
|
192
|
-
if (timeoutMs === void 0) { timeoutMs = 10000; }
|
|
193
|
-
return __generator(this, function (_a) {
|
|
194
|
-
switch (_a.label) {
|
|
195
|
-
case 0:
|
|
196
|
-
controller = new AbortController();
|
|
197
|
-
timeoutId = setTimeout(function () { return controller.abort(); }, timeoutMs);
|
|
198
|
-
_a.label = 1;
|
|
199
|
-
case 1:
|
|
200
|
-
_a.trys.push([1, 4, , 5]);
|
|
201
|
-
return [4 /*yield*/, fetch(url, {
|
|
202
|
-
signal: controller.signal,
|
|
203
|
-
})];
|
|
204
|
-
case 2:
|
|
205
|
-
response = _a.sent();
|
|
206
|
-
clearTimeout(timeoutId);
|
|
207
|
-
if (!response.ok) {
|
|
208
|
-
throw new Error("Failed to fetch URL: ".concat(response.status, " ").concat(response.statusText));
|
|
209
|
-
}
|
|
210
|
-
return [4 /*yield*/, response.arrayBuffer()];
|
|
211
|
-
case 3:
|
|
212
|
-
arrayBuffer = _a.sent();
|
|
213
|
-
uint8Array = new Uint8Array(arrayBuffer);
|
|
214
|
-
binaryString = '';
|
|
215
|
-
for (i = 0; i < uint8Array.length; i++) {
|
|
216
|
-
binaryString += String.fromCharCode(uint8Array[i]);
|
|
217
|
-
}
|
|
218
|
-
return [2 /*return*/, btoa(binaryString)];
|
|
219
|
-
case 4:
|
|
220
|
-
error_3 = _a.sent();
|
|
221
|
-
clearTimeout(timeoutId);
|
|
222
|
-
if (error_3 instanceof Error && error_3.name === 'AbortError') {
|
|
223
|
-
throw new Error("Request timed out after ".concat(timeoutMs, "ms"));
|
|
224
|
-
}
|
|
225
|
-
console.error('Error converting URL to base64:', error_3);
|
|
226
|
-
throw new Error("Failed to convert URL to base64: ".concat(error_3 instanceof Error ? error_3.message : 'Unknown error'));
|
|
227
|
-
case 5: return [2 /*return*/];
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
}
|
|
1
|
+
var f=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var y=(o,r)=>{for(var t in r)f(o,t,{get:r[t],enumerable:!0})},U=(o,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of w(r))!m.call(o,e)&&e!==t&&f(o,e,{get:()=>r[e],enumerable:!(n=g(r,e))||n.enumerable});return o};var h=o=>U(f({},"__esModule",{value:!0}),o);var R={};y(R,{convertUrlToBase64:()=>l,convertUrlToBase64DataUri:()=>u,convertUrlToBase64WithTimeout:()=>E,convertUrlsToBase64:()=>b,convertUrlsToBase64DataUris:()=>d,isValidUrl:()=>p});module.exports=h(R);async function l(o){try{const r=await fetch(o);if(!r.ok)throw new Error(`Failed to fetch URL: ${r.status} ${r.statusText}`);const t=await r.arrayBuffer(),n=new Uint8Array(t);let e="";for(let a=0;a<n.length;a++)e+=String.fromCharCode(n[a]);return btoa(e)}catch(r){throw console.error("Error converting URL to base64:",r),new Error(`Failed to convert URL to base64: ${r instanceof Error?r.message:"Unknown error"}`)}}async function u(o,r){try{const t=await fetch(o);if(!t.ok)throw new Error(`Failed to fetch URL: ${t.status} ${t.statusText}`);const n=r||t.headers.get("content-type")||"application/octet-stream",e=await t.arrayBuffer(),a=new Uint8Array(e);let i="";for(let s=0;s<a.length;s++)i+=String.fromCharCode(a[s]);const c=btoa(i);return`data:${n};base64,${c}`}catch(t){throw console.error("Error converting URL to base64 data URI:",t),new Error(`Failed to convert URL to base64 data URI: ${t instanceof Error?t.message:"Unknown error"}`)}}async function b(o){const r=o.map(t=>l(t));return Promise.all(r)}async function d(o,r){const t=o.map((n,e)=>u(n,r?.[e]));return Promise.all(t)}function p(o){try{return new URL(o),!0}catch{return!1}}async function E(o,r=1e4){const t=new AbortController,n=setTimeout(()=>t.abort(),r);try{const e=await fetch(o,{signal:t.signal});if(clearTimeout(n),!e.ok)throw new Error(`Failed to fetch URL: ${e.status} ${e.statusText}`);const a=await e.arrayBuffer(),i=new Uint8Array(a);let c="";for(let s=0;s<i.length;s++)c+=String.fromCharCode(i[s]);return btoa(c)}catch(e){throw clearTimeout(n),e instanceof Error&&e.name==="AbortError"?new Error(`Request timed out after ${r}ms`):(console.error("Error converting URL to base64:",e),new Error(`Failed to convert URL to base64: ${e instanceof Error?e.message:"Unknown error"}`))}}0&&(module.exports={convertUrlToBase64,convertUrlToBase64DataUri,convertUrlToBase64WithTimeout,convertUrlsToBase64,convertUrlsToBase64DataUris,isValidUrl});
|
package/general/countries.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @remarks Forum App
|
|
7
7
|
*/
|
|
8
8
|
/** End file docs */
|
|
9
|
-
|
|
9
|
+
declare enum COUNTRY_CODE {
|
|
10
10
|
AF = "AF",
|
|
11
11
|
AX = "AX",
|
|
12
12
|
AL = "AL",
|
|
@@ -257,10 +257,12 @@ export declare enum COUNTRY_CODE {
|
|
|
257
257
|
ZM = "ZM",
|
|
258
258
|
ZW = "ZW"
|
|
259
259
|
}
|
|
260
|
-
|
|
260
|
+
type ICountries = {
|
|
261
261
|
[key in COUNTRY_CODE]: {
|
|
262
262
|
code: string;
|
|
263
263
|
country: string;
|
|
264
264
|
};
|
|
265
265
|
};
|
|
266
|
-
|
|
266
|
+
declare const countries: ICountries;
|
|
267
|
+
|
|
268
|
+
export { COUNTRY_CODE, type ICountries, countries };
|