@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,190 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Generic Module Factory - Minimal Version
|
|
3
|
-
*
|
|
4
|
-
* Provides reusable reducer and context structure for CRUD modules.
|
|
5
|
-
* API integration is handled by individual modules for maximum flexibility.
|
|
6
|
-
*/
|
|
7
|
-
'use client';
|
|
8
|
-
"use strict";
|
|
9
|
-
var __assign = (this && this.__assign) || function () {
|
|
10
|
-
__assign = Object.assign || function(t) {
|
|
11
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
12
|
-
s = arguments[i];
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
}
|
|
16
|
-
return t;
|
|
17
|
-
};
|
|
18
|
-
return __assign.apply(this, arguments);
|
|
19
|
-
};
|
|
20
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
-
}
|
|
26
|
-
Object.defineProperty(o, k2, desc);
|
|
27
|
-
}) : (function(o, m, k, k2) {
|
|
28
|
-
if (k2 === undefined) k2 = k;
|
|
29
|
-
o[k2] = m[k];
|
|
30
|
-
}));
|
|
31
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
32
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
33
|
-
}) : function(o, v) {
|
|
34
|
-
o["default"] = v;
|
|
35
|
-
});
|
|
36
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
37
|
-
var ownKeys = function(o) {
|
|
38
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
39
|
-
var ar = [];
|
|
40
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
41
|
-
return ar;
|
|
42
|
-
};
|
|
43
|
-
return ownKeys(o);
|
|
44
|
-
};
|
|
45
|
-
return function (mod) {
|
|
46
|
-
if (mod && mod.__esModule) return mod;
|
|
47
|
-
var result = {};
|
|
48
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
49
|
-
__setModuleDefault(result, mod);
|
|
50
|
-
return result;
|
|
51
|
-
};
|
|
52
|
-
})();
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.createGenericModule = exports.createGenericHandlers = exports.createGenericModuleProvider = exports.createGenericModuleHook = exports.createGenericReducer = exports.GENERIC_ACTION_TYPES = void 0;
|
|
55
|
-
var react_1 = __importStar(require("react"));
|
|
56
|
-
// ============================================================================
|
|
57
|
-
// ACTION TYPES
|
|
58
|
-
// ============================================================================
|
|
59
|
-
exports.GENERIC_ACTION_TYPES = {
|
|
60
|
-
RESET_FORM: 'RESET_FORM',
|
|
61
|
-
SET_CURRENT_PAGE: 'SET_CURRENT_PAGE',
|
|
62
|
-
SET_PAGE_LIMIT: 'SET_PAGE_LIMIT',
|
|
63
|
-
SET_SEARCH_QUERY: 'SET_SEARCH_QUERY',
|
|
64
|
-
SET_DRAWER: 'SET_DRAWER',
|
|
65
|
-
SET_ITEMS: 'SET_ITEMS',
|
|
66
|
-
SET_FORM_DATA: 'SET_FORM_DATA',
|
|
67
|
-
SET_DISABLE_SAVE_BUTTON: 'SET_DISABLE_SAVE_BUTTON',
|
|
68
|
-
SET_INPUT_FIELD: 'SET_INPUT_FIELD',
|
|
69
|
-
SET_ERRORS: 'SET_ERRORS',
|
|
70
|
-
SET_FILTERS: 'SET_FILTERS',
|
|
71
|
-
};
|
|
72
|
-
// ============================================================================
|
|
73
|
-
// GENERIC REDUCER FACTORY
|
|
74
|
-
// ============================================================================
|
|
75
|
-
var createGenericReducer = function (config) {
|
|
76
|
-
return function (state, action) {
|
|
77
|
-
var _a;
|
|
78
|
-
switch (action.type) {
|
|
79
|
-
case exports.GENERIC_ACTION_TYPES.RESET_FORM: {
|
|
80
|
-
var current = state;
|
|
81
|
-
return __assign(__assign(__assign({}, state), config.initialState), { count: current.count, currentPage: current.currentPage, items: current.items, pageLimit: current.pageLimit, searchQuery: current.searchQuery });
|
|
82
|
-
}
|
|
83
|
-
case exports.GENERIC_ACTION_TYPES.SET_CURRENT_PAGE:
|
|
84
|
-
return __assign(__assign({}, state), { currentPage: action.payload.currentPage });
|
|
85
|
-
case exports.GENERIC_ACTION_TYPES.SET_PAGE_LIMIT:
|
|
86
|
-
return __assign(__assign({}, state), { pageLimit: action.payload.pageLimit });
|
|
87
|
-
case exports.GENERIC_ACTION_TYPES.SET_SEARCH_QUERY:
|
|
88
|
-
return __assign(__assign({}, state), { searchQuery: action.payload.searchQuery });
|
|
89
|
-
case exports.GENERIC_ACTION_TYPES.SET_DRAWER:
|
|
90
|
-
return __assign(__assign({}, state), { drawer: action.payload.drawer });
|
|
91
|
-
case exports.GENERIC_ACTION_TYPES.SET_ITEMS:
|
|
92
|
-
return __assign(__assign({}, state), { items: action.payload.items, count: action.payload.count });
|
|
93
|
-
case exports.GENERIC_ACTION_TYPES.SET_FORM_DATA:
|
|
94
|
-
return __assign(__assign({}, state), action.payload.form);
|
|
95
|
-
case exports.GENERIC_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON:
|
|
96
|
-
return __assign(__assign({}, state), { disableSaveButton: action.payload.disabled });
|
|
97
|
-
case exports.GENERIC_ACTION_TYPES.SET_INPUT_FIELD:
|
|
98
|
-
return __assign(__assign({}, state), (_a = {}, _a[action.payload.key] = action.payload.value, _a));
|
|
99
|
-
case exports.GENERIC_ACTION_TYPES.SET_ERRORS:
|
|
100
|
-
return __assign(__assign({}, state), { errors: action.payload.errors });
|
|
101
|
-
case exports.GENERIC_ACTION_TYPES.SET_FILTERS:
|
|
102
|
-
return __assign(__assign({}, state), action.payload.filters);
|
|
103
|
-
default:
|
|
104
|
-
return state;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
exports.createGenericReducer = createGenericReducer;
|
|
109
|
-
// ============================================================================
|
|
110
|
-
// GENERIC MODULE HOOK FACTORY
|
|
111
|
-
// ============================================================================
|
|
112
|
-
var createGenericModuleHook = function (config) {
|
|
113
|
-
return function () {
|
|
114
|
-
var _a = (0, react_1.useReducer)((0, exports.createGenericReducer)(config), config.initialState), state = _a[0], dispatch = _a[1];
|
|
115
|
-
var handlers = (0, exports.createGenericHandlers)(dispatch);
|
|
116
|
-
return __assign({ state: state, dispatch: dispatch }, handlers);
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
exports.createGenericModuleHook = createGenericModuleHook;
|
|
120
|
-
// ============================================================================
|
|
121
|
-
// GENERIC PROVIDER FACTORY
|
|
122
|
-
// ============================================================================
|
|
123
|
-
var createGenericModuleProvider = function (config) {
|
|
124
|
-
var GenericContext = react_1.default.createContext(undefined);
|
|
125
|
-
var GenericProvider = function (_a) {
|
|
126
|
-
var children = _a.children;
|
|
127
|
-
var useGenericModule = (0, exports.createGenericModuleHook)(config);
|
|
128
|
-
var contextValue = useGenericModule();
|
|
129
|
-
return (react_1.default.createElement(GenericContext.Provider, { value: contextValue }, children));
|
|
130
|
-
};
|
|
131
|
-
var useGenericModuleContext = function () {
|
|
132
|
-
var context = react_1.default.useContext(GenericContext);
|
|
133
|
-
if (context === undefined) {
|
|
134
|
-
throw new Error("useGenericModuleContext must be used within GenericProvider for ".concat(config.name));
|
|
135
|
-
}
|
|
136
|
-
return context;
|
|
137
|
-
};
|
|
138
|
-
return {
|
|
139
|
-
Provider: GenericProvider,
|
|
140
|
-
useContext: useGenericModuleContext,
|
|
141
|
-
Context: GenericContext,
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
exports.createGenericModuleProvider = createGenericModuleProvider;
|
|
145
|
-
var createGenericHandlers = function (dispatch) {
|
|
146
|
-
return {
|
|
147
|
-
handleSearch: function (query) {
|
|
148
|
-
dispatch({
|
|
149
|
-
type: exports.GENERIC_ACTION_TYPES.SET_SEARCH_QUERY,
|
|
150
|
-
payload: { searchQuery: query },
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
handlePageChange: function (page) {
|
|
154
|
-
dispatch({
|
|
155
|
-
type: exports.GENERIC_ACTION_TYPES.SET_CURRENT_PAGE,
|
|
156
|
-
payload: { currentPage: page },
|
|
157
|
-
});
|
|
158
|
-
},
|
|
159
|
-
handlePageLimitChange: function (limit) {
|
|
160
|
-
dispatch({
|
|
161
|
-
type: exports.GENERIC_ACTION_TYPES.SET_PAGE_LIMIT,
|
|
162
|
-
payload: { pageLimit: limit },
|
|
163
|
-
});
|
|
164
|
-
},
|
|
165
|
-
handleCloseDrawer: function () {
|
|
166
|
-
dispatch({
|
|
167
|
-
type: exports.GENERIC_ACTION_TYPES.SET_DRAWER,
|
|
168
|
-
payload: { drawer: null },
|
|
169
|
-
});
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
exports.createGenericHandlers = createGenericHandlers;
|
|
174
|
-
// ============================================================================
|
|
175
|
-
// MAIN MODULE FACTORY
|
|
176
|
-
// ============================================================================
|
|
177
|
-
var createGenericModule = function (config) {
|
|
178
|
-
var reducer = (0, exports.createGenericReducer)(config);
|
|
179
|
-
var _a = (0, exports.createGenericModuleProvider)(config), Provider = _a.Provider, useContext = _a.useContext;
|
|
180
|
-
return {
|
|
181
|
-
reducer: reducer,
|
|
182
|
-
Provider: Provider,
|
|
183
|
-
useContext: useContext,
|
|
184
|
-
config: config,
|
|
185
|
-
actionTypes: exports.GENERIC_ACTION_TYPES,
|
|
186
|
-
initialState: config.initialState,
|
|
187
|
-
createHandlers: exports.createGenericHandlers,
|
|
188
|
-
};
|
|
189
|
-
};
|
|
190
|
-
exports.createGenericModule = createGenericModule;
|
|
1
|
+
"use client";var S=Object.create;var d=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var C=(r,e)=>{for(var n in e)d(r,n,{get:e[n],enumerable:!0})},E=(r,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of R(e))!p.call(r,o)&&o!==n&&d(r,o,{get:()=>e[o],enumerable:!(a=_(e,o))||a.enumerable});return r};var h=(r,e,n)=>(n=r!=null?S(y(r)):{},E(e||!r||!r.__esModule?d(n,"default",{value:r,enumerable:!0}):n,r)),m=r=>E(d({},"__esModule",{value:!0}),r);var P={};C(P,{GENERIC_ACTION_TYPES:()=>t,createGenericHandlers:()=>u,createGenericModule:()=>M,createGenericModuleHook:()=>s,createGenericModuleProvider:()=>c,createGenericReducer:()=>T});module.exports=m(P);var i=h(require("react"));const t={RESET_FORM:"RESET_FORM",SET_CURRENT_PAGE:"SET_CURRENT_PAGE",SET_PAGE_LIMIT:"SET_PAGE_LIMIT",SET_SEARCH_QUERY:"SET_SEARCH_QUERY",SET_DRAWER:"SET_DRAWER",SET_ITEMS:"SET_ITEMS",SET_FORM_DATA:"SET_FORM_DATA",SET_DISABLE_SAVE_BUTTON:"SET_DISABLE_SAVE_BUTTON",SET_INPUT_FIELD:"SET_INPUT_FIELD",SET_ERRORS:"SET_ERRORS",SET_FILTERS:"SET_FILTERS"},T=r=>(e,n)=>{switch(n.type){case t.RESET_FORM:{const a=e;return{...e,...r.initialState,count:a.count,currentPage:a.currentPage,items:a.items,pageLimit:a.pageLimit,searchQuery:a.searchQuery}}case t.SET_CURRENT_PAGE:return{...e,currentPage:n.payload.currentPage};case t.SET_PAGE_LIMIT:return{...e,pageLimit:n.payload.pageLimit};case t.SET_SEARCH_QUERY:return{...e,searchQuery:n.payload.searchQuery};case t.SET_DRAWER:return{...e,drawer:n.payload.drawer};case t.SET_ITEMS:return{...e,items:n.payload.items,count:n.payload.count};case t.SET_FORM_DATA:return{...e,...n.payload.form};case t.SET_DISABLE_SAVE_BUTTON:return{...e,disableSaveButton:n.payload.disabled};case t.SET_INPUT_FIELD:return{...e,[n.payload.key]:n.payload.value};case t.SET_ERRORS:return{...e,errors:n.payload.errors};case t.SET_FILTERS:return{...e,...n.payload.filters};default:return e}},s=r=>()=>{const[e,n]=(0,i.useReducer)(T(r),r.initialState),a=u(n);return{state:e,dispatch:n,...a}},c=r=>{const e=i.default.createContext(void 0);return{Provider:({children:o})=>{const l=s(r)();return i.default.createElement(e.Provider,{value:l},o)},useContext:()=>{const o=i.default.useContext(e);if(o===void 0)throw new Error(`useGenericModuleContext must be used within GenericProvider for ${r.name}`);return o},Context:e}},u=r=>({handleSearch:e=>{r({type:t.SET_SEARCH_QUERY,payload:{searchQuery:e}})},handlePageChange:e=>{r({type:t.SET_CURRENT_PAGE,payload:{currentPage:e}})},handlePageLimitChange:e=>{r({type:t.SET_PAGE_LIMIT,payload:{pageLimit:e}})},handleCloseDrawer:()=>{r({type:t.SET_DRAWER,payload:{drawer:null}})}}),M=r=>{const e=T(r),{Provider:n,useContext:a}=c(r);return{reducer:e,Provider:n,useContext:a,config:r,actionTypes:t,initialState:r.initialState,createHandlers:u}};0&&(module.exports={GENERIC_ACTION_TYPES,createGenericHandlers,createGenericModule,createGenericModuleHook,createGenericModuleProvider,createGenericReducer});
|
package/general/basic-get.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Creates a curried GET request to the given URL.
|
|
3
|
+
* @param url - The request URL.
|
|
4
|
+
* @returns A function that accepts fetch options and returns a JSON promise.
|
|
5
|
+
*/
|
|
6
|
+
declare const basicGet: (url: string) => any;
|
|
7
|
+
|
|
8
|
+
export { basicGet };
|
package/general/basic-get.js
CHANGED
|
@@ -1,83 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
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);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
-
if (ar || !(i in from)) {
|
|
52
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
-
ar[i] = from[i];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
-
};
|
|
58
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.basicGet = void 0;
|
|
60
|
-
var basicGet = function (url) {
|
|
61
|
-
return function () {
|
|
62
|
-
var args_1 = [];
|
|
63
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
64
|
-
args_1[_i] = arguments[_i];
|
|
65
|
-
}
|
|
66
|
-
return __awaiter(void 0, __spreadArray([], args_1, true), void 0, function (opts) {
|
|
67
|
-
var headers, response;
|
|
68
|
-
if (opts === void 0) { opts = {}; }
|
|
69
|
-
return __generator(this, function (_a) {
|
|
70
|
-
switch (_a.label) {
|
|
71
|
-
case 0:
|
|
72
|
-
headers = opts.headers ? opts.headers : {};
|
|
73
|
-
headers['Content-Type'] = 'application/json';
|
|
74
|
-
return [4 /*yield*/, fetch(url, __assign({ headers: headers, method: 'GET' }, opts))];
|
|
75
|
-
case 1:
|
|
76
|
-
response = _a.sent();
|
|
77
|
-
return [2 /*return*/, response.json()];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
exports.basicGet = basicGet;
|
|
1
|
+
var o=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var h=(n,e)=>{for(var s in e)o(n,s,{get:e[s],enumerable:!0})},d=(n,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of c(e))!i.call(n,t)&&t!==s&&o(n,t,{get:()=>e[t],enumerable:!(a=r(e,t))||a.enumerable});return n};var p=n=>d(o({},"__esModule",{value:!0}),n);var j={};h(j,{basicGet:()=>y});module.exports=p(j);const y=n=>async(e={})=>{const s=e.headers?e.headers:{};return s["Content-Type"]="application/json",(await fetch(n,{headers:s,method:"GET",...e})).json()};0&&(module.exports={basicGet});
|
package/general/basic-post.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Creates a curried POST request to the given URL with a JSON payload.
|
|
3
|
+
* @param url - The request URL.
|
|
4
|
+
* @returns A curried function accepting payload and options, returning a JSON promise.
|
|
5
|
+
*/
|
|
6
|
+
declare const basicPost: (url: string) => any;
|
|
7
|
+
|
|
8
|
+
export { basicPost };
|
package/general/basic-post.js
CHANGED
|
@@ -1,70 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
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);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.basicPost = void 0;
|
|
51
|
-
var basicPost = function (url) {
|
|
52
|
-
return function (payload, opts) {
|
|
53
|
-
if (opts === void 0) { opts = {}; }
|
|
54
|
-
return function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
-
var headers, response;
|
|
56
|
-
return __generator(this, function (_a) {
|
|
57
|
-
switch (_a.label) {
|
|
58
|
-
case 0:
|
|
59
|
-
headers = opts.headers ? opts.headers : {};
|
|
60
|
-
headers['Content-Type'] = 'application/json';
|
|
61
|
-
return [4 /*yield*/, fetch(url, __assign(__assign({ method: 'POST' }, opts), { body: JSON.stringify(payload), headers: headers }))];
|
|
62
|
-
case 1:
|
|
63
|
-
response = _a.sent();
|
|
64
|
-
return [2 /*return*/, response.json()];
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}); };
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
exports.basicPost = basicPost;
|
|
1
|
+
var t=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var s in e)t(n,s,{get:e[s],enumerable:!0})},d=(n,e,s,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of c(e))!i.call(n,a)&&a!==s&&t(n,a,{get:()=>e[a],enumerable:!(o=r(e,a))||o.enumerable});return n};var h=n=>d(t({},"__esModule",{value:!0}),n);var b={};y(b,{basicPost:()=>p});module.exports=h(b);const p=n=>(e,s={})=>async()=>{const o=s.headers?s.headers:{};return o["Content-Type"]="application/json",(await fetch(n,{method:"POST",...s,body:JSON.stringify(e),headers:o})).json()};0&&(module.exports={basicPost});
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the total number of pages given a record count and page limit.
|
|
3
|
+
* @param count - Total number of records.
|
|
4
|
+
* @param pageLimit - Number of records per page.
|
|
5
|
+
* @returns The total number of pages.
|
|
6
|
+
*/
|
|
7
|
+
declare const calculatePages: (count: number, pageLimit: number) => number;
|
|
8
|
+
|
|
9
|
+
export { calculatePages };
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculatePages = void 0;
|
|
4
|
-
var calculatePages = function (count, pageLimit) {
|
|
5
|
-
return Math.ceil(count / pageLimit);
|
|
6
|
-
};
|
|
7
|
-
exports.calculatePages = calculatePages;
|
|
1
|
+
var r=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var m=(a,e)=>{for(var n in e)r(a,n,{get:e[n],enumerable:!0})},o=(a,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of b(e))!l.call(a,c)&&c!==n&&r(a,c,{get:()=>e[c],enumerable:!(t=u(e,c))||t.enumerable});return a};var s=a=>o(r({},"__esModule",{value:!0}),a);var h={};m(h,{calculatePages:()=>g});module.exports=s(h);const g=(a,e)=>Math.ceil(a/e);0&&(module.exports={calculatePages});
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* A util function to convert camel case into sentence case
|
|
4
|
-
*
|
|
5
|
-
* @param str - string provided to convert camel case into sentence case - taimoorKhan
|
|
6
|
-
* @returns string in sentence case - Taimoor Khan
|
|
7
|
-
* @author Taimoor Khan
|
|
8
|
-
* @remarks
|
|
9
|
-
*/
|
|
10
|
-
/** End file docs */
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.camelToSentenceCase = void 0;
|
|
13
|
-
var camelToSentenceCase = function (str) {
|
|
14
|
-
var newString = str.replace(/([A-Z])/g, ' $1');
|
|
15
|
-
return newString
|
|
16
|
-
.split(' ')
|
|
17
|
-
.map(function (_str) { return _str.charAt(0).toUpperCase() + _str.slice(1); })
|
|
18
|
-
.join(' ');
|
|
19
|
-
};
|
|
20
|
-
exports.camelToSentenceCase = camelToSentenceCase;
|
|
1
|
+
var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var o=(n,e)=>{for(var t in e)i(n,t,{get:e[t],enumerable:!0})},p=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of g(e))!a.call(n,r)&&r!==t&&i(n,r,{get:()=>e[r],enumerable:!(s=c(e,r))||s.enumerable});return n};var l=n=>p(i({},"__esModule",{value:!0}),n);var m={};o(m,{camelToSentenceCase:()=>S});module.exports=l(m);const S=n=>n.replace(/([A-Z])/g," $1").split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ");0&&(module.exports={camelToSentenceCase});
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
/**
|
|
3
|
-
* A util function to check if provided array length
|
|
4
|
-
* is even or odd.
|
|
5
|
-
*
|
|
6
|
-
* @param arr - arr provided array which will be checked for its length to be either odd or even
|
|
7
|
-
* @returns even or odd number
|
|
8
|
-
* @author Taimoor Khan
|
|
9
|
-
* @remarks Taimoor Khan Resume v3
|
|
10
|
-
*/
|
|
11
|
-
/** End file docs */
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.checkEvenOddLength = void 0;
|
|
14
|
-
var checkEvenOddLength = function (arr) {
|
|
15
|
-
return arr.length % 2 === 0 ? 2 : 1;
|
|
16
|
-
};
|
|
17
|
-
exports.checkEvenOddLength = checkEvenOddLength;
|
|
1
|
+
var c=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var o=(e,n)=>{for(var t in n)c(e,t,{get:n[t],enumerable:!0})},y=(e,n,t,h)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of d(n))!g.call(e,r)&&r!==t&&c(e,r,{get:()=>n[r],enumerable:!(h=a(n,r))||h.enumerable});return e};var b=e=>y(c({},"__esModule",{value:!0}),e);var l={};o(l,{checkEvenOddLength:()=>k});module.exports=b(l);const k=e=>e.length%2===0?2:1;0&&(module.exports={checkEvenOddLength});
|
package/general/clear-cache.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
interface Params {
|
|
2
2
|
LS_KEYS: Record<string, string>;
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Clears specified localStorage entries and reloads the window.
|
|
6
|
+
* @param params.LS_KEYS - A record of localStorage keys to remove.
|
|
7
|
+
*/
|
|
8
|
+
declare const clearCache: ({ LS_KEYS }: Params) => void;
|
|
9
|
+
|
|
10
|
+
export { clearCache };
|
package/general/clear-cache.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clearCache = void 0;
|
|
4
|
-
var clearCache = function (_a) {
|
|
5
|
-
var LS_KEYS = _a.LS_KEYS;
|
|
6
|
-
Object.keys(LS_KEYS).forEach(function (key) {
|
|
7
|
-
localStorage.removeItem(LS_KEYS[key]);
|
|
8
|
-
});
|
|
9
|
-
// reload window to reflect cleared cache
|
|
10
|
-
window.location.reload();
|
|
11
|
-
};
|
|
12
|
-
exports.clearCache = clearCache;
|
|
1
|
+
var t=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var l=(a,e)=>{for(var r in e)t(a,r,{get:e[r],enumerable:!0})},f=(a,e,r,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of n(e))!i.call(a,o)&&o!==r&&t(a,o,{get:()=>e[o],enumerable:!(c=s(e,o))||c.enumerable});return a};var m=a=>f(t({},"__esModule",{value:!0}),a);var g={};l(g,{clearCache:()=>d});module.exports=m(g);const d=({LS_KEYS:a})=>{Object.keys(a).forEach(e=>{localStorage.removeItem(a[e])}),window.location.reload()};0&&(module.exports={clearCache});
|
|
@@ -2,6 +2,19 @@ interface FormatCnicOptions {
|
|
|
2
2
|
separator?: string;
|
|
3
3
|
allowLoose?: boolean;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Formats a CNIC number string into 5-7-1 digit groups with an optional separator.
|
|
7
|
+
* @param value - The CNIC value (string, number, null, or undefined).
|
|
8
|
+
* @param opts.separator - Separator between groups (default '-').
|
|
9
|
+
* @param opts.allowLoose - If true, allows formatting incomplete CNICs.
|
|
10
|
+
* @returns The formatted CNIC string, or null if invalid.
|
|
11
|
+
*/
|
|
12
|
+
declare const formatCnic: (value: string | number | null | undefined, opts?: FormatCnicOptions) => string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Checks whether a value is a valid 13-digit CNIC.
|
|
15
|
+
* @param value - The CNIC value (string, number, null, or undefined).
|
|
16
|
+
* @returns True if the value is a valid 13-digit CNIC.
|
|
17
|
+
*/
|
|
18
|
+
declare const isValidCnic: (value: string | number | null | undefined) => boolean;
|
|
19
|
+
|
|
20
|
+
export { formatCnic, isValidCnic };
|
|
@@ -1,53 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isValidCnic = exports.formatCnic = void 0;
|
|
4
|
-
var unicodeDigitMap = (function () {
|
|
5
|
-
var map = {};
|
|
6
|
-
// Arabic-Indic digits \u0660 - \u0669
|
|
7
|
-
for (var i = 0; i <= 9; i++) {
|
|
8
|
-
map[String.fromCharCode(0x660 + i)] = String(i);
|
|
9
|
-
}
|
|
10
|
-
// Eastern Arabic-Indic digits \u06F0 - \u06F9
|
|
11
|
-
for (var i = 0; i <= 9; i++) {
|
|
12
|
-
map[String.fromCharCode(0x6f0 + i)] = String(i);
|
|
13
|
-
}
|
|
14
|
-
return map;
|
|
15
|
-
})();
|
|
16
|
-
var toAsciiDigits = function (input) {
|
|
17
|
-
return input.replace(/./g, function (ch) { var _a; return (_a = unicodeDigitMap[ch]) !== null && _a !== void 0 ? _a : ch; });
|
|
18
|
-
};
|
|
19
|
-
var formatCnic = function (value, opts) {
|
|
20
|
-
var _a;
|
|
21
|
-
if (opts === void 0) { opts = {}; }
|
|
22
|
-
if (value === null || value === undefined)
|
|
23
|
-
return null;
|
|
24
|
-
var separator = (_a = opts.separator) !== null && _a !== void 0 ? _a : '-';
|
|
25
|
-
var raw = typeof value === 'number' ? String(value) : String(value);
|
|
26
|
-
raw = raw.trim();
|
|
27
|
-
if (raw.length === 0)
|
|
28
|
-
return null;
|
|
29
|
-
// Normalize unicode digits to ASCII then strip all non-digit characters
|
|
30
|
-
var ascii = toAsciiDigits(raw);
|
|
31
|
-
var digits = ascii.replace(/[^0-9]/g, '');
|
|
32
|
-
if (digits.length === 0)
|
|
33
|
-
return null;
|
|
34
|
-
// For strict mode, only accept exactly 13 digits
|
|
35
|
-
if (!opts.allowLoose && digits.length !== 13)
|
|
36
|
-
return null;
|
|
37
|
-
// Build groups: 5, 7, 1. For allowLoose, allow missing trailing groups.
|
|
38
|
-
var g1 = digits.slice(0, 5);
|
|
39
|
-
var g2 = digits.slice(5, 12);
|
|
40
|
-
var g3 = digits.slice(12);
|
|
41
|
-
var parts = [g1, g2, g3].filter(function (p) { return p && p.length > 0; });
|
|
42
|
-
return parts.join(separator);
|
|
43
|
-
};
|
|
44
|
-
exports.formatCnic = formatCnic;
|
|
45
|
-
var isValidCnic = function (value) {
|
|
46
|
-
if (value === null || value === undefined)
|
|
47
|
-
return false;
|
|
48
|
-
var raw = typeof value === 'number' ? String(value) : String(value);
|
|
49
|
-
var ascii = toAsciiDigits(raw);
|
|
50
|
-
var digits = ascii.replace(/[^0-9]/g, '');
|
|
51
|
-
return digits.length === 13;
|
|
52
|
-
};
|
|
53
|
-
exports.isValidCnic = isValidCnic;
|
|
1
|
+
var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})},C=(t,n,i,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of d(n))!p.call(t,e)&&e!==i&&s(t,e,{get:()=>n[e],enumerable:!(r=u(n,e))||r.enumerable});return t};var S=t=>C(s({},"__esModule",{value:!0}),t);var x={};m(x,{formatCnic:()=>h,isValidCnic:()=>w});module.exports=S(x);const b=(()=>{const t={};for(let n=0;n<=9;n++)t[String.fromCharCode(1632+n)]=String(n);for(let n=0;n<=9;n++)t[String.fromCharCode(1776+n)]=String(n);return t})(),c=t=>t.replace(/./g,n=>b[n]??n),h=(t,n={})=>{if(t==null)return null;const i=n.separator??"-";let r=String(t);if(r=r.trim(),r.length===0)return null;const o=c(r).replace(/[^0-9]/g,"");if(o.length===0||!n.allowLoose&&o.length!==13)return null;const l=o.slice(0,5),a=o.slice(5,12),f=o.slice(12);return[l,a,f].filter(g=>g&&g.length>0).join(i)},w=t=>{if(t==null)return!1;const n=String(t);return c(n).replace(/[^0-9]/g,"").length===13};0&&(module.exports={formatCnic,isValidCnic});
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @returns Promise<string> - Base64 encoded string
|
|
11
11
|
* @throws Error if the URL cannot be fetched or converted
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
declare function convertUrlToBase64(url: string): Promise<string>;
|
|
14
14
|
/**
|
|
15
15
|
* Convert a URL to base64 data URI format
|
|
16
16
|
*
|
|
@@ -19,7 +19,7 @@ export declare function convertUrlToBase64(url: string): Promise<string>;
|
|
|
19
19
|
* @returns Promise<string> - Base64 data URI string (e.g., "data:image/png;base64,iVBORw0KGgo...")
|
|
20
20
|
* @throws Error if the URL cannot be fetched or converted
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
declare function convertUrlToBase64DataUri(url: string, mimeType?: string): Promise<string>;
|
|
23
23
|
/**
|
|
24
24
|
* Convert multiple URLs to base64 strings
|
|
25
25
|
*
|
|
@@ -27,7 +27,7 @@ export declare function convertUrlToBase64DataUri(url: string, mimeType?: string
|
|
|
27
27
|
* @returns Promise<string[]> - Array of base64 encoded strings
|
|
28
28
|
* @throws Error if any URL cannot be fetched or converted
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
declare function convertUrlsToBase64(urls: string[]): Promise<string[]>;
|
|
31
31
|
/**
|
|
32
32
|
* Convert multiple URLs to base64 data URIs
|
|
33
33
|
*
|
|
@@ -36,14 +36,14 @@ export declare function convertUrlsToBase64(urls: string[]): Promise<string[]>;
|
|
|
36
36
|
* @returns Promise<string[]> - Array of base64 data URI strings
|
|
37
37
|
* @throws Error if any URL cannot be fetched or converted
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
declare function convertUrlsToBase64DataUris(urls: string[], mimeTypes?: (string | undefined)[]): Promise<string[]>;
|
|
40
40
|
/**
|
|
41
41
|
* Check if a string is a valid URL
|
|
42
42
|
*
|
|
43
43
|
* @param url - The string to check
|
|
44
44
|
* @returns boolean - True if the string is a valid URL
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
declare function isValidUrl(url: string): boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Convert a URL to base64 with timeout
|
|
49
49
|
*
|
|
@@ -52,4 +52,6 @@ export declare function isValidUrl(url: string): boolean;
|
|
|
52
52
|
* @returns Promise<string> - Base64 encoded string
|
|
53
53
|
* @throws Error if the URL cannot be fetched within timeout or converted
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
declare function convertUrlToBase64WithTimeout(url: string, timeoutMs?: number): Promise<string>;
|
|
56
|
+
|
|
57
|
+
export { convertUrlToBase64, convertUrlToBase64DataUri, convertUrlToBase64WithTimeout, convertUrlsToBase64, convertUrlsToBase64DataUris, isValidUrl };
|