@flarehr/apollo-benefits 1.2.97 → 1.3.54109
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 +19 -0
- package/dist/assets/@splitsoftware-7d799540.js +18 -0
- package/dist/assets/all_tab_color-548783b9.svg +21 -0
- package/dist/assets/all_tab_gray-a5051313.svg +6 -0
- package/dist/assets/check-57fe1dcb.svg +15 -0
- package/dist/assets/datadog-9aa4bf28.js +5 -0
- package/dist/assets/date-fns-c5d8fbc0.js +1 -0
- package/dist/assets/default_backdrop-fdd955b8.png +0 -0
- package/dist/assets/external_link-599a0aec.svg +3 -0
- package/dist/assets/external_link_white-55111b2e.svg +3 -0
- package/dist/assets/framer-motion-bb8d6b82.js +1 -0
- package/dist/assets/index-18cd5088.js +35 -0
- package/dist/assets/index-cfa25e28.css +1 -0
- package/dist/assets/index-e4f1c441.js +5 -0
- package/dist/assets/lodash-5d893f8c.js +1 -0
- package/dist/assets/logo-a34e9b4b.png +0 -0
- package/dist/assets/oidc-client-6f6e47c2.js +101 -0
- package/dist/assets/padlock-8c081120.svg +26 -0
- package/dist/assets/suitcase-6471ad05.svg +17 -0
- package/dist/assets/vendor-2d0139ca.js +788 -0
- package/dist/assets/warning-a7f1af23.svg +14 -0
- package/dist/assets/welcome_image_mobile-dbde6c80.png +0 -0
- package/dist/assets/welcome_image_v2-869c59e4.png +0 -0
- package/dist/assets/wellbeing_banner-6903d615.png +0 -0
- package/dist/assets/workplace_link_banner_mobile-6ebaa24b.png +0 -0
- package/dist/assets/workplace_link_banner_v2-c81ed849.png +0 -0
- package/dist/config.json +14 -0
- package/dist/favicon.ico +0 -0
- package/dist/icons/android-chrome-192x192.png +0 -0
- package/dist/icons/android-chrome-512x512.png +0 -0
- package/dist/icons/apple-touch-icon.png +0 -0
- package/dist/icons/favicon-16x16.png +0 -0
- package/dist/icons/favicon-32x32.png +0 -0
- package/dist/index.html +114 -0
- package/dist/manifest.json +21 -0
- package/dist/sw-esm.js +16 -0
- package/package.json +127 -69
- package/LICENSE +0 -21
- package/dist/lib/apollo-benefits/apollo-benefits.esm.js +0 -1
- package/dist/lib/apollo-benefits/assets/Hero_Background.png +0 -0
- package/dist/lib/apollo-benefits/assets/car-placeholder.svg +0 -5
- package/dist/lib/apollo-benefits/assets/check.svg +0 -13
- package/dist/lib/apollo-benefits/common-assets/icon-info.svg +0 -4
- package/dist/lib/apollo-benefits/index.esm.js +0 -0
- package/dist/lib/apollo-benefits/p-054d1471.js +0 -1
- package/dist/lib/apollo-benefits/p-066d8e7b.js +0 -15
- package/dist/lib/apollo-benefits/p-08376428.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-1d7ab1b9.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-25a89275.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-26d363c9.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-337ce3df.js +0 -1
- package/dist/lib/apollo-benefits/p-3dc9a379.js +0 -1
- package/dist/lib/apollo-benefits/p-4376366b.js +0 -46
- package/dist/lib/apollo-benefits/p-4e2d34f4.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-50bbf713.js +0 -1
- package/dist/lib/apollo-benefits/p-53c5e861.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-556fdb43.js +0 -1
- package/dist/lib/apollo-benefits/p-57d4702d.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-58ee670f.js +0 -1
- package/dist/lib/apollo-benefits/p-6a54654f.entry.js +0 -11
- package/dist/lib/apollo-benefits/p-6bd33850.js +0 -1
- package/dist/lib/apollo-benefits/p-79c3b633.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-7f3a2f3b.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-82d42c2b.js +0 -1
- package/dist/lib/apollo-benefits/p-9b3e978e.js +0 -1
- package/dist/lib/apollo-benefits/p-a1dd0cba.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-aa379cfe.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-aaf0e527.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-b0b9425b.js +0 -1
- package/dist/lib/apollo-benefits/p-d0ef83f8.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-db4a65f0.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-dc67f942.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-e1fd79bb.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-ea120e31.js +0 -1
- package/dist/lib/apollo-benefits/p-ef5f33ca.js +0 -1
- package/dist/lib/apollo-benefits/p-f5254031.js +0 -1
- package/dist/lib/apollo-benefits/p-f63d9d89.js +0 -1
- package/dist/lib/apollo-benefits/p-fcfa5255.entry.js +0 -1
- package/dist/lib/cjs/Option-98dab0b8.js +0 -1988
- package/dist/lib/cjs/active-router-90429847.js +0 -75
- package/dist/lib/cjs/ap-ben-asset_5.cjs.entry.js +0 -1856
- package/dist/lib/cjs/ap-ben-benefit-card.cjs.entry.js +0 -45
- package/dist/lib/cjs/ap-ben-benefit-list-item.cjs.entry.js +0 -56
- package/dist/lib/cjs/ap-ben-benefit-url_27.cjs.entry.js +0 -48767
- package/dist/lib/cjs/ap-ben-benefits-list_3.cjs.entry.js +0 -55
- package/dist/lib/cjs/ap-ben-benefits-page.cjs.entry.js +0 -55
- package/dist/lib/cjs/ap-ben-choose-vehicle-section_4.cjs.entry.js +0 -2779
- package/dist/lib/cjs/ap-ben-notifications-section.cjs.entry.js +0 -243
- package/dist/lib/cjs/ap-ben-oidc-callback-page.cjs.entry.js +0 -40
- package/dist/lib/cjs/apollo-benefits.cjs.js +0 -25
- package/dist/lib/cjs/app-globals-e04ab04b.js +0 -12
- package/dist/lib/cjs/authentication.service-11c30071.js +0 -237
- package/dist/lib/cjs/benefits.api-b46ee2ea.js +0 -35
- package/dist/lib/cjs/cars-calculator-app.cjs.entry.js +0 -60
- package/dist/lib/cjs/cars-calculator.service-a8beab79.js +0 -166
- package/dist/lib/cjs/context-consumer.cjs.entry.js +0 -29
- package/dist/lib/cjs/datorama-akita-792b4d1d.js +0 -2553
- package/dist/lib/cjs/delay-e91dba76.js +0 -206
- package/dist/lib/cjs/event-tracking.service-6f723d9c.js +0 -155
- package/dist/lib/cjs/event-tracking.service-d6f9a51c.js +0 -259
- package/dist/lib/cjs/filter-c38164e6.js +0 -378
- package/dist/lib/cjs/fl-dropdown-async.cjs.entry.js +0 -422
- package/dist/lib/cjs/fl-dropdown.cjs.entry.js +0 -232
- package/dist/lib/cjs/fl-style-guide.cjs.entry.js +0 -91
- package/dist/lib/cjs/index-4f00f593.js +0 -994
- package/dist/lib/cjs/index-6e643fec.js +0 -1734
- package/dist/lib/cjs/index-889ce6c6.js +0 -27
- package/dist/lib/cjs/index.cjs.js +0 -2
- package/dist/lib/cjs/loader.cjs.js +0 -27
- package/dist/lib/cjs/scheduleArray-0ba3d6f8.js +0 -753
- package/dist/lib/cjs/stencil-async-content.cjs.entry.js +0 -32
- package/dist/lib/cjs/stencil-route-title.cjs.entry.js +0 -32
- package/dist/lib/cjs/stencil-router-prompt.cjs.entry.js +0 -59
- package/dist/lib/cjs/stencil-router-redirect.cjs.entry.js +0 -32
- package/dist/lib/cjs/view.service-ec43dea6.js +0 -21
- package/dist/lib/collection/assets/image/complete.svg +0 -122
- package/dist/lib/collection/collection-manifest.json +0 -81
- package/dist/lib/collection/components/benefits-app/apis/api-client.js +0 -16
- package/dist/lib/collection/components/benefits-app/apis/benefits-api/benefits-api.dto.js +0 -16
- package/dist/lib/collection/components/benefits-app/apis/benefits-api/benefits.api.js +0 -30
- package/dist/lib/collection/components/benefits-app/apis/event-tracking-api/event-tracking-api.dto.js +0 -1
- package/dist/lib/collection/components/benefits-app/apis/event-tracking-api/event-tracking-api.js +0 -7
- package/dist/lib/collection/components/benefits-app/apis/user-api/user-api.dto.js +0 -8
- package/dist/lib/collection/components/benefits-app/apis/user-api/user.api.js +0 -16
- package/dist/lib/collection/components/benefits-app/benefits-app.css +0 -399
- package/dist/lib/collection/components/benefits-app/benefits-app.js +0 -216
- package/dist/lib/collection/components/benefits-app/pages/benefits-page/benefits-list/benefit-list-item.css +0 -23
- package/dist/lib/collection/components/benefits-app/pages/benefits-page/benefits-list/benefits-list-item.js +0 -80
- package/dist/lib/collection/components/benefits-app/pages/benefits-page/benefits-list/benefits-list.js +0 -32
- package/dist/lib/collection/components/benefits-app/pages/benefits-page/benefits-page.js +0 -47
- package/dist/lib/collection/components/benefits-app/pages/benefits-page/hero-banner/assets/Hero_Background.png +0 -0
- package/dist/lib/collection/components/benefits-app/pages/benefits-page/hero-banner/hero-banner.css +0 -8
- package/dist/lib/collection/components/benefits-app/pages/benefits-page/hero-banner/hero-banner.js +0 -53
- package/dist/lib/collection/components/benefits-app/pages/benefits-page/promoted-benefits/benefit-card.css +0 -3
- package/dist/lib/collection/components/benefits-app/pages/benefits-page/promoted-benefits/benefit-card.js +0 -62
- package/dist/lib/collection/components/benefits-app/pages/benefits-page/promoted-benefits/promoted-benefits.js +0 -33
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/api/manage-benefits-api.dto.js +0 -36
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/api/manage-benefits.api.js +0 -23
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/confirm-dialog.js +0 -158
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/benefit-url.css +0 -8
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/benefit-url.js +0 -126
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/edit-benefit-form.js +0 -138
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-benefit-icon.css +0 -24
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-benefit-icon.js +0 -102
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-file.css +0 -18
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-file.js +0 -120
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-page.js +0 -154
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit.query.js +0 -18
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit.service.js +0 -155
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/empty-benefits.js +0 -36
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/manage-benefits-header-row.js +0 -13
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/manage-benefits-page.css +0 -3
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/manage-benefits-page.js +0 -88
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/manage-benefits-page.routes.js +0 -24
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/manage-benefits.service.js +0 -37
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/managed-benefit-item/managed-benefit-item.css +0 -10
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/managed-benefit-item/managed-benefit-item.js +0 -89
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/store/manage-benefits.query.js +0 -11
- package/dist/lib/collection/components/benefits-app/pages/manage-benefits-page/store/manage-benefits.store.js +0 -51
- package/dist/lib/collection/components/benefits-app/pages/role-management-page/api/role-management.api.js +0 -21
- package/dist/lib/collection/components/benefits-app/pages/role-management-page/role-editors-section/role-editors-section.js +0 -104
- package/dist/lib/collection/components/benefits-app/pages/role-management-page/role-management-page.js +0 -50
- package/dist/lib/collection/components/benefits-app/pages/role-management-page/role-management.service.js +0 -44
- package/dist/lib/collection/components/benefits-app/pages/role-management-page/role-owner-section/role-owner-section.js +0 -40
- package/dist/lib/collection/components/benefits-app/pages/role-management-page/store/role-management.query.js +0 -13
- package/dist/lib/collection/components/benefits-app/pages/role-management-page/store/role-management.store.js +0 -42
- package/dist/lib/collection/components/benefits-app/services/benefits-app.service.js +0 -36
- package/dist/lib/collection/components/benefits-app/services/benefits.service.js +0 -11
- package/dist/lib/collection/components/benefits-app/services/event-tracking.service.js +0 -40
- package/dist/lib/collection/components/benefits-app/services/navigation.service.js +0 -34
- package/dist/lib/collection/components/benefits-app/store/benefits-app.query.js +0 -13
- package/dist/lib/collection/components/benefits-app/store/benefits-app.store.js +0 -24
- package/dist/lib/collection/components/benefits-app-host/benefits-app-host.js +0 -48
- package/dist/lib/collection/components/benefits-app-host/loading-page.js +0 -9
- package/dist/lib/collection/components/benefits-app-host/oidc-callback-page/oidc-callback-page.js +0 -65
- package/dist/lib/collection/components/benefits-app-host/oidc-callback-page/oidc-callback-page.routes.js +0 -11
- package/dist/lib/collection/components/benefits-app-host/services/app-configuration.query.js +0 -18
- package/dist/lib/collection/components/benefits-app-host/services/app-configuration.service.js +0 -23
- package/dist/lib/collection/components/benefits-app-host/services/authentication.query.js +0 -21
- package/dist/lib/collection/components/benefits-app-host/services/authentication.service.js +0 -96
- package/dist/lib/collection/components/benefits-app-host/services/session.store.js +0 -33
- package/dist/lib/collection/components/cars-calculator-app/api/api-client.js +0 -5
- package/dist/lib/collection/components/cars-calculator-app/api/cars-calculator-events.model.js +0 -1
- package/dist/lib/collection/components/cars-calculator-app/api/cars-calculator.api.js +0 -45
- package/dist/lib/collection/components/cars-calculator-app/api/event-tracking.api.js +0 -7
- package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.css +0 -22
- package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.js +0 -97
- package/dist/lib/collection/components/cars-calculator-app/notifications-section/notifications-section.js +0 -25
- package/dist/lib/collection/components/cars-calculator-app/pages/asset.component.js +0 -27
- package/dist/lib/collection/components/cars-calculator-app/pages/assets/car-placeholder.svg +0 -5
- package/dist/lib/collection/components/cars-calculator-app/pages/assets/check.svg +0 -13
- package/dist/lib/collection/components/cars-calculator-app/pages/choose-vehicle-section.component.js +0 -234
- package/dist/lib/collection/components/cars-calculator-app/pages/common-assets/icon-info.svg +0 -4
- package/dist/lib/collection/components/cars-calculator-app/pages/complete-section.component.js +0 -38
- package/dist/lib/collection/components/cars-calculator-app/pages/cost-breakdown-section.component.js +0 -45
- package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.css +0 -34
- package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.js +0 -93
- package/dist/lib/collection/components/cars-calculator-app/pages/personal-info-section.component.js +0 -71
- package/dist/lib/collection/components/cars-calculator-app/pages/quote-result-section.component.js +0 -117
- package/dist/lib/collection/components/cars-calculator-app/pages/submit-quote-section.component.js +0 -87
- package/dist/lib/collection/components/cars-calculator-app/services/app-configuration.service.js +0 -13
- package/dist/lib/collection/components/cars-calculator-app/services/cars-calculator.service.js +0 -117
- package/dist/lib/collection/components/cars-calculator-app/services/event-tracking.service.js +0 -37
- package/dist/lib/collection/components/cars-calculator-app/services/notifications.service.js +0 -37
- package/dist/lib/collection/components/cars-calculator-app/services/notifications.store.js +0 -3
- package/dist/lib/collection/components/cars-calculator-app/services/session.query.js +0 -38
- package/dist/lib/collection/components/cars-calculator-app/services/session.store.js +0 -80
- package/dist/lib/collection/components/cars-calculator-app/services/view.service.js +0 -16
- package/dist/lib/collection/components/shared/file-icon/file-icon.css +0 -15
- package/dist/lib/collection/components/shared/file-icon/file-icon.js +0 -84
- package/dist/lib/collection/components/shared/icon.js +0 -77
- package/dist/lib/collection/components/shared/icons-library.js +0 -11
- package/dist/lib/collection/components/shared/modal-section.js +0 -138
- package/dist/lib/collection/components/shared/tooltip.css +0 -3
- package/dist/lib/collection/components/shared/tooltip.js +0 -115
- package/dist/lib/collection/components/shared/ui-container/ui-container.css +0 -39
- package/dist/lib/collection/components/shared/ui-container/ui-container.js +0 -27
- package/dist/lib/collection/global/config.js +0 -2
- package/dist/lib/collection/global/main.dev.js +0 -31
- package/dist/lib/collection/global/main.js +0 -5
- package/dist/lib/collection/index.js +0 -2
- package/dist/lib/collection/utils/config.js +0 -2
- package/dist/lib/collection/utils/index.js +0 -28
- package/dist/lib/collection/utils/lazy.js +0 -29
- package/dist/lib/collection/utils/promise.js +0 -7
- package/dist/lib/esm/Option-53ef163a.js +0 -1982
- package/dist/lib/esm/active-router-134fe07f.js +0 -73
- package/dist/lib/esm/ap-ben-asset_5.entry.js +0 -1848
- package/dist/lib/esm/ap-ben-benefit-card.entry.js +0 -41
- package/dist/lib/esm/ap-ben-benefit-list-item.entry.js +0 -52
- package/dist/lib/esm/ap-ben-benefit-url_27.entry.js +0 -48737
- package/dist/lib/esm/ap-ben-benefits-list_3.entry.js +0 -49
- package/dist/lib/esm/ap-ben-benefits-page.entry.js +0 -51
- package/dist/lib/esm/ap-ben-choose-vehicle-section_4.entry.js +0 -2772
- package/dist/lib/esm/ap-ben-notifications-section.entry.js +0 -239
- package/dist/lib/esm/ap-ben-oidc-callback-page.entry.js +0 -36
- package/dist/lib/esm/apollo-benefits.js +0 -23
- package/dist/lib/esm/app-globals-ff43b669.js +0 -10
- package/dist/lib/esm/authentication.service-4dbff8a5.js +0 -232
- package/dist/lib/esm/benefits.api-5a0c5fa7.js +0 -33
- package/dist/lib/esm/cars-calculator-app.entry.js +0 -56
- package/dist/lib/esm/cars-calculator.service-1278f563.js +0 -163
- package/dist/lib/esm/context-consumer.entry.js +0 -25
- package/dist/lib/esm/datorama-akita-e42d9911.js +0 -2547
- package/dist/lib/esm/delay-d08c267f.js +0 -200
- package/dist/lib/esm/event-tracking.service-27d79066.js +0 -253
- package/dist/lib/esm/event-tracking.service-429d997c.js +0 -146
- package/dist/lib/esm/filter-aeb65cac.js +0 -370
- package/dist/lib/esm/fl-dropdown-async.entry.js +0 -418
- package/dist/lib/esm/fl-dropdown.entry.js +0 -228
- package/dist/lib/esm/fl-style-guide.entry.js +0 -87
- package/dist/lib/esm/index-1351f893.js +0 -979
- package/dist/lib/esm/index-8676bf1e.js +0 -22
- package/dist/lib/esm/index-d4b319a7.js +0 -1702
- package/dist/lib/esm/index.js +0 -1
- package/dist/lib/esm/loader.js +0 -23
- package/dist/lib/esm/polyfills/core-js.js +0 -11
- package/dist/lib/esm/polyfills/css-shim.js +0 -1
- package/dist/lib/esm/polyfills/dom.js +0 -79
- package/dist/lib/esm/polyfills/es5-html-element.js +0 -1
- package/dist/lib/esm/polyfills/index.js +0 -34
- package/dist/lib/esm/polyfills/system.js +0 -6
- package/dist/lib/esm/scheduleArray-b9669898.js +0 -738
- package/dist/lib/esm/stencil-async-content.entry.js +0 -28
- package/dist/lib/esm/stencil-route-title.entry.js +0 -28
- package/dist/lib/esm/stencil-router-prompt.entry.js +0 -55
- package/dist/lib/esm/stencil-router-redirect.entry.js +0 -28
- package/dist/lib/esm/view.service-6adbec31.js +0 -19
- package/dist/lib/index.cjs.js +0 -1
- package/dist/lib/index.js +0 -1
- package/dist/lib/loader/cdn.js +0 -3
- package/dist/lib/loader/index.cjs.js +0 -3
- package/dist/lib/loader/index.d.ts +0 -13
- package/dist/lib/loader/index.es2017.js +0 -3
- package/dist/lib/loader/index.js +0 -4
- package/dist/lib/loader/package.json +0 -10
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/button/button.css +0 -118
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown/dropdown.css +0 -9
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown-async/dropdown-async.css +0 -9
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/loading-indicator/loading-indicator.css +0 -141
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/promise-button/promise-button.css +0 -5
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/style-guide/style-guide.css +0 -0
- package/dist/lib/node_modules/@stencil/router/dist/collection/components/route/route.css +0 -3
- package/dist/lib/types/components/benefits-app/apis/api-client.d.ts +0 -7
- package/dist/lib/types/components/benefits-app/apis/benefits-api/benefits-api.dto.d.ts +0 -44
- package/dist/lib/types/components/benefits-app/apis/benefits-api/benefits.api.d.ts +0 -9
- package/dist/lib/types/components/benefits-app/apis/event-tracking-api/event-tracking-api.d.ts +0 -6
- package/dist/lib/types/components/benefits-app/apis/event-tracking-api/event-tracking-api.dto.d.ts +0 -18
- package/dist/lib/types/components/benefits-app/apis/user-api/user-api.dto.d.ts +0 -30
- package/dist/lib/types/components/benefits-app/apis/user-api/user.api.d.ts +0 -8
- package/dist/lib/types/components/benefits-app/benefits-app.d.ts +0 -22
- package/dist/lib/types/components/benefits-app/pages/benefits-page/benefits-list/benefits-list-item.d.ts +0 -10
- package/dist/lib/types/components/benefits-app/pages/benefits-page/benefits-list/benefits-list.d.ts +0 -5
- package/dist/lib/types/components/benefits-app/pages/benefits-page/benefits-page.d.ts +0 -10
- package/dist/lib/types/components/benefits-app/pages/benefits-page/hero-banner/hero-banner.d.ts +0 -5
- package/dist/lib/types/components/benefits-app/pages/benefits-page/promoted-benefits/benefit-card.d.ts +0 -8
- package/dist/lib/types/components/benefits-app/pages/benefits-page/promoted-benefits/promoted-benefits.d.ts +0 -5
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/api/manage-benefits-api.dto.d.ts +0 -39
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/api/manage-benefits.api.d.ts +0 -9
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/confirm-dialog.d.ts +0 -16
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/benefit-url.d.ts +0 -21
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/edit-benefit-form.d.ts +0 -12
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-benefit-icon.d.ts +0 -16
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-form/upload-file.d.ts +0 -17
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit-page.d.ts +0 -24
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit.query.d.ts +0 -16
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/edit-benefit-page/edit-benefit.service.d.ts +0 -20
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/empty-benefits.d.ts +0 -5
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/manage-benefits-header-row.d.ts +0 -3
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/manage-benefits-page.d.ts +0 -16
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/manage-benefits-page.routes.d.ts +0 -6
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/manage-benefits.service.d.ts +0 -8
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/managed-benefit-item/managed-benefit-item.d.ts +0 -11
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/store/manage-benefits.query.d.ts +0 -10
- package/dist/lib/types/components/benefits-app/pages/manage-benefits-page/store/manage-benefits.store.d.ts +0 -51
- package/dist/lib/types/components/benefits-app/pages/role-management-page/api/role-management.api.d.ts +0 -7
- package/dist/lib/types/components/benefits-app/pages/role-management-page/role-editors-section/role-editors-section.d.ts +0 -15
- package/dist/lib/types/components/benefits-app/pages/role-management-page/role-management-page.d.ts +0 -9
- package/dist/lib/types/components/benefits-app/pages/role-management-page/role-management.service.d.ts +0 -11
- package/dist/lib/types/components/benefits-app/pages/role-management-page/role-owner-section/role-owner-section.d.ts +0 -5
- package/dist/lib/types/components/benefits-app/pages/role-management-page/store/role-management.query.d.ts +0 -12
- package/dist/lib/types/components/benefits-app/pages/role-management-page/store/role-management.store.d.ts +0 -17
- package/dist/lib/types/components/benefits-app/services/benefits-app.service.d.ts +0 -13
- package/dist/lib/types/components/benefits-app/services/benefits.service.d.ts +0 -8
- package/dist/lib/types/components/benefits-app/services/event-tracking.service.d.ts +0 -11
- package/dist/lib/types/components/benefits-app/services/navigation.service.d.ts +0 -14
- package/dist/lib/types/components/benefits-app/store/benefits-app.query.d.ts +0 -12
- package/dist/lib/types/components/benefits-app/store/benefits-app.store.d.ts +0 -31
- package/dist/lib/types/components/benefits-app-host/benefits-app-host.d.ts +0 -9
- package/dist/lib/types/components/benefits-app-host/loading-page.d.ts +0 -3
- package/dist/lib/types/components/benefits-app-host/oidc-callback-page/oidc-callback-page.d.ts +0 -8
- package/dist/lib/types/components/benefits-app-host/oidc-callback-page/oidc-callback-page.routes.d.ts +0 -1
- package/dist/lib/types/components/benefits-app-host/services/app-configuration.query.d.ts +0 -11
- package/dist/lib/types/components/benefits-app-host/services/app-configuration.service.d.ts +0 -9
- package/dist/lib/types/components/benefits-app-host/services/authentication.query.d.ts +0 -13
- package/dist/lib/types/components/benefits-app-host/services/authentication.service.d.ts +0 -25
- package/dist/lib/types/components/benefits-app-host/services/session.store.d.ts +0 -25
- package/dist/lib/types/components/cars-calculator-app/api/api-client.d.ts +0 -2
- package/dist/lib/types/components/cars-calculator-app/api/cars-calculator-events.model.d.ts +0 -39
- package/dist/lib/types/components/cars-calculator-app/api/cars-calculator.api.d.ts +0 -100
- package/dist/lib/types/components/cars-calculator-app/api/event-tracking.api.d.ts +0 -6
- package/dist/lib/types/components/cars-calculator-app/cars-calculator-app.d.ts +0 -18
- package/dist/lib/types/components/cars-calculator-app/notifications-section/notifications-section.d.ts +0 -5
- package/dist/lib/types/components/cars-calculator-app/pages/asset.component.d.ts +0 -4
- package/dist/lib/types/components/cars-calculator-app/pages/choose-vehicle-section.component.d.ts +0 -23
- package/dist/lib/types/components/cars-calculator-app/pages/complete-section.component.d.ts +0 -5
- package/dist/lib/types/components/cars-calculator-app/pages/cost-breakdown-section.component.d.ts +0 -6
- package/dist/lib/types/components/cars-calculator-app/pages/model-variants-section.component.d.ts +0 -12
- package/dist/lib/types/components/cars-calculator-app/pages/personal-info-section.component.d.ts +0 -10
- package/dist/lib/types/components/cars-calculator-app/pages/quote-result-section.component.d.ts +0 -16
- package/dist/lib/types/components/cars-calculator-app/pages/submit-quote-section.component.d.ts +0 -12
- package/dist/lib/types/components/cars-calculator-app/services/app-configuration.service.d.ts +0 -7
- package/dist/lib/types/components/cars-calculator-app/services/cars-calculator.service.d.ts +0 -11
- package/dist/lib/types/components/cars-calculator-app/services/event-tracking.service.d.ts +0 -13
- package/dist/lib/types/components/cars-calculator-app/services/notifications.service.d.ts +0 -15
- package/dist/lib/types/components/cars-calculator-app/services/notifications.store.d.ts +0 -14
- package/dist/lib/types/components/cars-calculator-app/services/session.query.d.ts +0 -26
- package/dist/lib/types/components/cars-calculator-app/services/session.store.d.ts +0 -78
- package/dist/lib/types/components/cars-calculator-app/services/view.service.d.ts +0 -8
- package/dist/lib/types/components/shared/file-icon/file-icon.d.ts +0 -11
- package/dist/lib/types/components/shared/icon.d.ts +0 -7
- package/dist/lib/types/components/shared/icons-library.d.ts +0 -1
- package/dist/lib/types/components/shared/modal-section.d.ts +0 -16
- package/dist/lib/types/components/shared/tooltip.d.ts +0 -13
- package/dist/lib/types/components/shared/ui-container/ui-container.d.ts +0 -5
- package/dist/lib/types/components.d.ts +0 -606
- package/dist/lib/types/global/config.d.ts +0 -2
- package/dist/lib/types/global/main.d.ts +0 -1
- package/dist/lib/types/global/main.dev.d.ts +0 -1
- package/dist/lib/types/index.d.ts +0 -2
- package/dist/lib/types/stencil-public-runtime.d.ts +0 -1555
- package/dist/lib/types/utils/config.d.ts +0 -2
- package/dist/lib/types/utils/index.d.ts +0 -10
- package/dist/lib/types/utils/lazy.d.ts +0 -12
- package/dist/lib/types/utils/promise.d.ts +0 -1
- package/readme.md +0 -1
|
@@ -1,979 +0,0 @@
|
|
|
1
|
-
// -------------------------------------------------------------------------------------
|
|
2
|
-
/**
|
|
3
|
-
* @since 2.0.0
|
|
4
|
-
*/
|
|
5
|
-
function identity(a) {
|
|
6
|
-
return a;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* @since 2.0.0
|
|
10
|
-
*/
|
|
11
|
-
function constant(a) {
|
|
12
|
-
return function () { return a; };
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A thunk that returns always `null`.
|
|
16
|
-
*
|
|
17
|
-
* @since 2.0.0
|
|
18
|
-
*/
|
|
19
|
-
var constNull =
|
|
20
|
-
/*#__PURE__*/
|
|
21
|
-
constant(null);
|
|
22
|
-
/**
|
|
23
|
-
* A thunk that returns always `undefined`.
|
|
24
|
-
*
|
|
25
|
-
* @since 2.0.0
|
|
26
|
-
*/
|
|
27
|
-
var constUndefined =
|
|
28
|
-
/*#__PURE__*/
|
|
29
|
-
constant(undefined);
|
|
30
|
-
function pipe(a, ab, bc, cd, de, ef, fg, gh, hi, ij, jk, kl, lm, mn, no, op, pq, qr, rs, st) {
|
|
31
|
-
switch (arguments.length) {
|
|
32
|
-
case 1:
|
|
33
|
-
return a;
|
|
34
|
-
case 2:
|
|
35
|
-
return ab(a);
|
|
36
|
-
case 3:
|
|
37
|
-
return bc(ab(a));
|
|
38
|
-
case 4:
|
|
39
|
-
return cd(bc(ab(a)));
|
|
40
|
-
case 5:
|
|
41
|
-
return de(cd(bc(ab(a))));
|
|
42
|
-
case 6:
|
|
43
|
-
return ef(de(cd(bc(ab(a)))));
|
|
44
|
-
case 7:
|
|
45
|
-
return fg(ef(de(cd(bc(ab(a))))));
|
|
46
|
-
case 8:
|
|
47
|
-
return gh(fg(ef(de(cd(bc(ab(a)))))));
|
|
48
|
-
case 9:
|
|
49
|
-
return hi(gh(fg(ef(de(cd(bc(ab(a))))))));
|
|
50
|
-
case 10:
|
|
51
|
-
return ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))));
|
|
52
|
-
case 11:
|
|
53
|
-
return jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))));
|
|
54
|
-
case 12:
|
|
55
|
-
return kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))));
|
|
56
|
-
case 13:
|
|
57
|
-
return lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))));
|
|
58
|
-
case 14:
|
|
59
|
-
return mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))));
|
|
60
|
-
case 15:
|
|
61
|
-
return no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))));
|
|
62
|
-
case 16:
|
|
63
|
-
return op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))));
|
|
64
|
-
case 17:
|
|
65
|
-
return pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))));
|
|
66
|
-
case 18:
|
|
67
|
-
return qr(pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))));
|
|
68
|
-
case 19:
|
|
69
|
-
return rs(qr(pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a))))))))))))))))));
|
|
70
|
-
case 20:
|
|
71
|
-
return st(rs(qr(pq(op(no(mn(lm(kl(jk(ij(hi(gh(fg(ef(de(cd(bc(ab(a)))))))))))))))))));
|
|
72
|
-
}
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// -------------------------------------------------------------------------------------
|
|
77
|
-
// Option
|
|
78
|
-
// -------------------------------------------------------------------------------------
|
|
79
|
-
/** @internal */
|
|
80
|
-
var isSome$1 = function (fa) { return fa._tag === 'Some'; };
|
|
81
|
-
|
|
82
|
-
// -------------------------------------------------------------------------------------
|
|
83
|
-
// guards
|
|
84
|
-
// -------------------------------------------------------------------------------------
|
|
85
|
-
/**
|
|
86
|
-
* Returns `true` if the option is an instance of `Some`, `false` otherwise.
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* import { some, none, isSome } from 'fp-ts/Option'
|
|
90
|
-
*
|
|
91
|
-
* assert.strictEqual(isSome(some(1)), true)
|
|
92
|
-
* assert.strictEqual(isSome(none), false)
|
|
93
|
-
*
|
|
94
|
-
* @category guards
|
|
95
|
-
* @since 2.0.0
|
|
96
|
-
*/
|
|
97
|
-
var isSome = isSome$1;
|
|
98
|
-
/**
|
|
99
|
-
* Returns `true` if the option is `None`, `false` otherwise.
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* import { some, none, isNone } from 'fp-ts/Option'
|
|
103
|
-
*
|
|
104
|
-
* assert.strictEqual(isNone(some(1)), false)
|
|
105
|
-
* assert.strictEqual(isNone(none), true)
|
|
106
|
-
*
|
|
107
|
-
* @category guards
|
|
108
|
-
* @since 2.0.0
|
|
109
|
-
*/
|
|
110
|
-
var isNone = function (fa) { return fa._tag === 'None'; };
|
|
111
|
-
// -------------------------------------------------------------------------------------
|
|
112
|
-
// constructors
|
|
113
|
-
// -------------------------------------------------------------------------------------
|
|
114
|
-
/**
|
|
115
|
-
* `None` doesn't have a constructor, instead you can use it directly as a value. Represents a missing value.
|
|
116
|
-
*
|
|
117
|
-
* @category constructors
|
|
118
|
-
* @since 2.0.0
|
|
119
|
-
*/
|
|
120
|
-
var none = { _tag: 'None' };
|
|
121
|
-
/**
|
|
122
|
-
* Constructs a `Some`. Represents an optional value that exists.
|
|
123
|
-
*
|
|
124
|
-
* @category constructors
|
|
125
|
-
* @since 2.0.0
|
|
126
|
-
*/
|
|
127
|
-
var some = function (a) { return ({ _tag: 'Some', value: a }); };
|
|
128
|
-
// -------------------------------------------------------------------------------------
|
|
129
|
-
// destructors
|
|
130
|
-
// -------------------------------------------------------------------------------------
|
|
131
|
-
/**
|
|
132
|
-
* Less strict version of [`match`](#match).
|
|
133
|
-
*
|
|
134
|
-
* @category destructors
|
|
135
|
-
* @since 2.10.0
|
|
136
|
-
*/
|
|
137
|
-
var matchW = function (onNone, onSome) { return function (ma) {
|
|
138
|
-
return isNone(ma) ? onNone() : onSome(ma.value);
|
|
139
|
-
}; };
|
|
140
|
-
/**
|
|
141
|
-
* Takes a (lazy) default value, a function, and an `Option` value, if the `Option` value is `None` the default value is
|
|
142
|
-
* returned, otherwise the function is applied to the value inside the `Some` and the result is returned.
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
* import { some, none, match } from 'fp-ts/Option'
|
|
146
|
-
* import { pipe } from 'fp-ts/function'
|
|
147
|
-
*
|
|
148
|
-
* assert.strictEqual(
|
|
149
|
-
* pipe(
|
|
150
|
-
* some(1),
|
|
151
|
-
* match(() => 'a none', a => `a some containing ${a}`)
|
|
152
|
-
* ),
|
|
153
|
-
* 'a some containing 1'
|
|
154
|
-
* )
|
|
155
|
-
*
|
|
156
|
-
* assert.strictEqual(
|
|
157
|
-
* pipe(
|
|
158
|
-
* none,
|
|
159
|
-
* match(() => 'a none', a => `a some containing ${a}`)
|
|
160
|
-
* ),
|
|
161
|
-
* 'a none'
|
|
162
|
-
* )
|
|
163
|
-
*
|
|
164
|
-
* @category destructors
|
|
165
|
-
* @since 2.10.0
|
|
166
|
-
*/
|
|
167
|
-
var match = matchW;
|
|
168
|
-
/**
|
|
169
|
-
* Alias of [`match`](#match).
|
|
170
|
-
*
|
|
171
|
-
* @category destructors
|
|
172
|
-
* @since 2.0.0
|
|
173
|
-
*/
|
|
174
|
-
var fold = match;
|
|
175
|
-
/**
|
|
176
|
-
* Less strict version of [`getOrElse`](#getOrElse).
|
|
177
|
-
*
|
|
178
|
-
* @category destructors
|
|
179
|
-
* @since 2.6.0
|
|
180
|
-
*/
|
|
181
|
-
var getOrElseW = function (onNone) { return function (ma) { return (isNone(ma) ? onNone() : ma.value); }; };
|
|
182
|
-
/**
|
|
183
|
-
* Extracts the value out of the structure, if it exists. Otherwise returns the given default value
|
|
184
|
-
*
|
|
185
|
-
* @example
|
|
186
|
-
* import { some, none, getOrElse } from 'fp-ts/Option'
|
|
187
|
-
* import { pipe } from 'fp-ts/function'
|
|
188
|
-
*
|
|
189
|
-
* assert.strictEqual(
|
|
190
|
-
* pipe(
|
|
191
|
-
* some(1),
|
|
192
|
-
* getOrElse(() => 0)
|
|
193
|
-
* ),
|
|
194
|
-
* 1
|
|
195
|
-
* )
|
|
196
|
-
* assert.strictEqual(
|
|
197
|
-
* pipe(
|
|
198
|
-
* none,
|
|
199
|
-
* getOrElse(() => 0)
|
|
200
|
-
* ),
|
|
201
|
-
* 0
|
|
202
|
-
* )
|
|
203
|
-
*
|
|
204
|
-
* @category destructors
|
|
205
|
-
* @since 2.0.0
|
|
206
|
-
*/
|
|
207
|
-
var getOrElse = getOrElseW;
|
|
208
|
-
// -------------------------------------------------------------------------------------
|
|
209
|
-
// interop
|
|
210
|
-
// -------------------------------------------------------------------------------------
|
|
211
|
-
/**
|
|
212
|
-
* Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise
|
|
213
|
-
* returns the value wrapped in a `Some`.
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* import { none, some, fromNullable } from 'fp-ts/Option'
|
|
217
|
-
*
|
|
218
|
-
* assert.deepStrictEqual(fromNullable(undefined), none)
|
|
219
|
-
* assert.deepStrictEqual(fromNullable(null), none)
|
|
220
|
-
* assert.deepStrictEqual(fromNullable(1), some(1))
|
|
221
|
-
*
|
|
222
|
-
* @category interop
|
|
223
|
-
* @since 2.0.0
|
|
224
|
-
*/
|
|
225
|
-
var fromNullable = function (a) { return (a == null ? none : some(a)); };
|
|
226
|
-
/**
|
|
227
|
-
* Extracts the value out of the structure, if it exists. Otherwise returns `null`.
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* import { some, none, toNullable } from 'fp-ts/Option'
|
|
231
|
-
* import { pipe } from 'fp-ts/function'
|
|
232
|
-
*
|
|
233
|
-
* assert.strictEqual(
|
|
234
|
-
* pipe(
|
|
235
|
-
* some(1),
|
|
236
|
-
* toNullable
|
|
237
|
-
* ),
|
|
238
|
-
* 1
|
|
239
|
-
* )
|
|
240
|
-
* assert.strictEqual(
|
|
241
|
-
* pipe(
|
|
242
|
-
* none,
|
|
243
|
-
* toNullable
|
|
244
|
-
* ),
|
|
245
|
-
* null
|
|
246
|
-
* )
|
|
247
|
-
*
|
|
248
|
-
* @category interop
|
|
249
|
-
* @since 2.0.0
|
|
250
|
-
*/
|
|
251
|
-
var toNullable =
|
|
252
|
-
/*#__PURE__*/
|
|
253
|
-
match(constNull, identity);
|
|
254
|
-
/**
|
|
255
|
-
* Extracts the value out of the structure, if it exists. Otherwise returns `undefined`.
|
|
256
|
-
*
|
|
257
|
-
* @example
|
|
258
|
-
* import { some, none, toUndefined } from 'fp-ts/Option'
|
|
259
|
-
* import { pipe } from 'fp-ts/function'
|
|
260
|
-
*
|
|
261
|
-
* assert.strictEqual(
|
|
262
|
-
* pipe(
|
|
263
|
-
* some(1),
|
|
264
|
-
* toUndefined
|
|
265
|
-
* ),
|
|
266
|
-
* 1
|
|
267
|
-
* )
|
|
268
|
-
* assert.strictEqual(
|
|
269
|
-
* pipe(
|
|
270
|
-
* none,
|
|
271
|
-
* toUndefined
|
|
272
|
-
* ),
|
|
273
|
-
* undefined
|
|
274
|
-
* )
|
|
275
|
-
*
|
|
276
|
-
* @category interop
|
|
277
|
-
* @since 2.0.0
|
|
278
|
-
*/
|
|
279
|
-
var toUndefined =
|
|
280
|
-
/*#__PURE__*/
|
|
281
|
-
match(constUndefined, identity);
|
|
282
|
-
// -------------------------------------------------------------------------------------
|
|
283
|
-
// type class members
|
|
284
|
-
// -------------------------------------------------------------------------------------
|
|
285
|
-
/**
|
|
286
|
-
* `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
|
|
287
|
-
* use the type constructor `F` to represent some computational context.
|
|
288
|
-
*
|
|
289
|
-
* @category Functor
|
|
290
|
-
* @since 2.0.0
|
|
291
|
-
*/
|
|
292
|
-
var map = function (f) { return function (fa) {
|
|
293
|
-
return isNone(fa) ? none : some(f(fa.value));
|
|
294
|
-
}; };
|
|
295
|
-
/**
|
|
296
|
-
* Composes computations in sequence, using the return value of one computation to determine the next computation.
|
|
297
|
-
*
|
|
298
|
-
* @category Monad
|
|
299
|
-
* @since 2.0.0
|
|
300
|
-
*/
|
|
301
|
-
var chain = function (f) { return function (ma) {
|
|
302
|
-
return isNone(ma) ? none : f(ma.value);
|
|
303
|
-
}; };
|
|
304
|
-
|
|
305
|
-
var __assign$1 = (undefined && undefined.__assign) || function () {
|
|
306
|
-
__assign$1 = Object.assign || function(t) {
|
|
307
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
308
|
-
s = arguments[i];
|
|
309
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
310
|
-
t[p] = s[p];
|
|
311
|
-
}
|
|
312
|
-
return t;
|
|
313
|
-
};
|
|
314
|
-
return __assign$1.apply(this, arguments);
|
|
315
|
-
};
|
|
316
|
-
var __spreadArrays$2 = (undefined && undefined.__spreadArrays) || function () {
|
|
317
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
318
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
319
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
320
|
-
r[k] = a[j];
|
|
321
|
-
return r;
|
|
322
|
-
};
|
|
323
|
-
var mix = function (one, two, mergeArrays) {
|
|
324
|
-
if (mergeArrays === void 0) { mergeArrays = false; }
|
|
325
|
-
if (!one || !two || typeof one !== "object" || typeof two !== "object")
|
|
326
|
-
return one;
|
|
327
|
-
var clone = __assign$1({}, one);
|
|
328
|
-
for (var prop in two) {
|
|
329
|
-
if (two.hasOwnProperty(prop)) {
|
|
330
|
-
if (two[prop] instanceof Array && one[prop] instanceof Array) {
|
|
331
|
-
clone[prop] = mergeArrays ? __spreadArrays$2(one[prop], two[prop]) : two[prop];
|
|
332
|
-
}
|
|
333
|
-
else if (typeof two[prop] === "object" && typeof one[prop] === "object") {
|
|
334
|
-
clone[prop] = mix(one[prop], two[prop], mergeArrays);
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
clone[prop] = two[prop];
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
return clone;
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
var __spreadArrays$1 = (undefined && undefined.__spreadArrays) || function () {
|
|
345
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
346
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
347
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
348
|
-
r[k] = a[j];
|
|
349
|
-
return r;
|
|
350
|
-
};
|
|
351
|
-
var config = {
|
|
352
|
-
// Default options
|
|
353
|
-
defaults: {},
|
|
354
|
-
// Error type
|
|
355
|
-
errorType: null,
|
|
356
|
-
// Polyfills
|
|
357
|
-
polyfills: {
|
|
358
|
-
fetch: null,
|
|
359
|
-
FormData: null,
|
|
360
|
-
URLSearchParams: null,
|
|
361
|
-
performance: null,
|
|
362
|
-
PerformanceObserver: null,
|
|
363
|
-
AbortController: null
|
|
364
|
-
},
|
|
365
|
-
polyfill: function (p, _a) {
|
|
366
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.doThrow, doThrow = _c === void 0 ? true : _c, _d = _b.instance, instance = _d === void 0 ? false : _d;
|
|
367
|
-
var args = [];
|
|
368
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
369
|
-
args[_i - 2] = arguments[_i];
|
|
370
|
-
}
|
|
371
|
-
var res = this.polyfills[p] ||
|
|
372
|
-
(typeof self !== "undefined" ? self[p] : null) ||
|
|
373
|
-
(typeof global !== "undefined" ? global[p] : null);
|
|
374
|
-
if (doThrow && !res)
|
|
375
|
-
throw new Error(p + " is not defined");
|
|
376
|
-
return instance && res ? new (res.bind.apply(res, __spreadArrays$1([void 0], args)))() : res;
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
var onMatch = function (entries, name, callback, _performance) {
|
|
381
|
-
if (!entries.getEntriesByName)
|
|
382
|
-
return false;
|
|
383
|
-
var matches = entries.getEntriesByName(name);
|
|
384
|
-
if (matches && matches.length > 0) {
|
|
385
|
-
callback(matches.reverse()[0]);
|
|
386
|
-
if (_performance.clearMeasures)
|
|
387
|
-
_performance.clearMeasures(name);
|
|
388
|
-
perfs.callbacks.delete(name);
|
|
389
|
-
if (perfs.callbacks.size < 1) {
|
|
390
|
-
perfs.observer.disconnect();
|
|
391
|
-
if (_performance.clearResourceTimings) {
|
|
392
|
-
_performance.clearResourceTimings();
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
return true;
|
|
396
|
-
}
|
|
397
|
-
return false;
|
|
398
|
-
};
|
|
399
|
-
var lazyObserver = function (_performance, _observer) {
|
|
400
|
-
if (!perfs.observer && _performance && _observer) {
|
|
401
|
-
perfs.observer = new _observer(function (entries) {
|
|
402
|
-
perfs.callbacks.forEach(function (callback, name) {
|
|
403
|
-
onMatch(entries, name, callback, _performance);
|
|
404
|
-
});
|
|
405
|
-
});
|
|
406
|
-
if (_performance.clearResourceTimings)
|
|
407
|
-
_performance.clearResourceTimings();
|
|
408
|
-
}
|
|
409
|
-
return perfs.observer;
|
|
410
|
-
};
|
|
411
|
-
var perfs = {
|
|
412
|
-
callbacks: new Map(),
|
|
413
|
-
observer: null,
|
|
414
|
-
observe: function (name, callback) {
|
|
415
|
-
if (!name || !callback)
|
|
416
|
-
return;
|
|
417
|
-
var _performance = config.polyfill("performance", { doThrow: false });
|
|
418
|
-
var _observer = config.polyfill("PerformanceObserver", { doThrow: false });
|
|
419
|
-
if (!lazyObserver(_performance, _observer))
|
|
420
|
-
return;
|
|
421
|
-
if (!onMatch(_performance, name, callback, _performance)) {
|
|
422
|
-
if (perfs.callbacks.size < 1)
|
|
423
|
-
perfs.observer.observe({ entryTypes: ["resource", "measure"] });
|
|
424
|
-
perfs.callbacks.set(name, callback);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
var middlewareHelper = function (middlewares) { return function (fetchFunction) {
|
|
430
|
-
return (middlewares.length === 0 ?
|
|
431
|
-
fetchFunction :
|
|
432
|
-
middlewares.length === 1 ?
|
|
433
|
-
middlewares[0](fetchFunction) :
|
|
434
|
-
middlewares.reduceRight(function (acc, curr, idx) {
|
|
435
|
-
return (idx === middlewares.length - 2) ? curr(acc(fetchFunction)) : curr(acc);
|
|
436
|
-
}));
|
|
437
|
-
}; };
|
|
438
|
-
|
|
439
|
-
var WretchErrorWrapper = /** @class */ (function () {
|
|
440
|
-
function WretchErrorWrapper(error) {
|
|
441
|
-
this.error = error;
|
|
442
|
-
}
|
|
443
|
-
return WretchErrorWrapper;
|
|
444
|
-
}());
|
|
445
|
-
var resolver = function (wretcher) {
|
|
446
|
-
var url = wretcher._url, _catchers = wretcher._catchers, resolvers = wretcher._resolvers, middlewares = wretcher._middlewares, opts = wretcher._options;
|
|
447
|
-
var catchers = new Map(_catchers);
|
|
448
|
-
var finalOptions = mix(config.defaults, opts);
|
|
449
|
-
var fetchController = config.polyfill("AbortController", { doThrow: false, instance: true });
|
|
450
|
-
if (!finalOptions["signal"] && fetchController) {
|
|
451
|
-
finalOptions["signal"] = fetchController.signal;
|
|
452
|
-
}
|
|
453
|
-
// Request timeout
|
|
454
|
-
var timeout = {
|
|
455
|
-
ref: null,
|
|
456
|
-
clear: function () {
|
|
457
|
-
if (timeout.ref) {
|
|
458
|
-
clearTimeout(timeout.ref);
|
|
459
|
-
timeout.ref = null;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
// The generated fetch request
|
|
464
|
-
var fetchRequest = middlewareHelper(middlewares)(config.polyfill("fetch"))(url, finalOptions);
|
|
465
|
-
// Throws on an http error
|
|
466
|
-
var throwingPromise = fetchRequest
|
|
467
|
-
.catch(function (error) {
|
|
468
|
-
throw new WretchErrorWrapper(error);
|
|
469
|
-
})
|
|
470
|
-
.then(function (response) {
|
|
471
|
-
timeout.clear();
|
|
472
|
-
if (!response.ok) {
|
|
473
|
-
return response[config.errorType || "text"]().then(function (msg) {
|
|
474
|
-
// Enhances the error object
|
|
475
|
-
var err = new Error(msg);
|
|
476
|
-
err[config.errorType || "text"] = msg;
|
|
477
|
-
err["status"] = response.status;
|
|
478
|
-
err["response"] = response;
|
|
479
|
-
throw err;
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
return response;
|
|
483
|
-
});
|
|
484
|
-
// Wraps the Promise in order to dispatch the error to a matching catcher
|
|
485
|
-
var catchersWrapper = function (promise) {
|
|
486
|
-
return promise.catch(function (err) {
|
|
487
|
-
timeout.clear();
|
|
488
|
-
var error = err instanceof WretchErrorWrapper ? err.error : err;
|
|
489
|
-
if (err instanceof WretchErrorWrapper && catchers.has("__fromFetch"))
|
|
490
|
-
return catchers.get("__fromFetch")(error, wretcher);
|
|
491
|
-
else if (catchers.has(error.status))
|
|
492
|
-
return catchers.get(error.status)(error, wretcher);
|
|
493
|
-
else if (catchers.has(error.name))
|
|
494
|
-
return catchers.get(error.name)(error, wretcher);
|
|
495
|
-
else
|
|
496
|
-
throw error;
|
|
497
|
-
});
|
|
498
|
-
};
|
|
499
|
-
var bodyParser = function (funName) { return function (cb) { return funName ?
|
|
500
|
-
// If a callback is provided, then callback with the body result otherwise return the parsed body itself.
|
|
501
|
-
catchersWrapper(throwingPromise.then(function (_) { return _ && _[funName](); }).then(function (_) { return cb ? cb(_) : _; })) :
|
|
502
|
-
// No body parsing method - return the response
|
|
503
|
-
catchersWrapper(throwingPromise.then(function (_) { return cb ? cb(_) : _; })); }; };
|
|
504
|
-
var responseChain = {
|
|
505
|
-
/**
|
|
506
|
-
* Retrieves the raw result as a promise.
|
|
507
|
-
*/
|
|
508
|
-
res: bodyParser(null),
|
|
509
|
-
/**
|
|
510
|
-
* Retrieves the result as a parsed JSON object.
|
|
511
|
-
*/
|
|
512
|
-
json: bodyParser("json"),
|
|
513
|
-
/**
|
|
514
|
-
* Retrieves the result as a Blob object.
|
|
515
|
-
*/
|
|
516
|
-
blob: bodyParser("blob"),
|
|
517
|
-
/**
|
|
518
|
-
* Retrieves the result as a FormData object.
|
|
519
|
-
*/
|
|
520
|
-
formData: bodyParser("formData"),
|
|
521
|
-
/**
|
|
522
|
-
* Retrieves the result as an ArrayBuffer object.
|
|
523
|
-
*/
|
|
524
|
-
arrayBuffer: bodyParser("arrayBuffer"),
|
|
525
|
-
/**
|
|
526
|
-
* Retrieves the result as a string.
|
|
527
|
-
*/
|
|
528
|
-
text: bodyParser("text"),
|
|
529
|
-
/**
|
|
530
|
-
* Performs a callback on the API performance timings of the request.
|
|
531
|
-
*
|
|
532
|
-
* Warning: Still experimental on browsers and node.js
|
|
533
|
-
*/
|
|
534
|
-
perfs: function (cb) {
|
|
535
|
-
fetchRequest.then(function (res) { return perfs.observe(res.url, cb); });
|
|
536
|
-
return responseChain;
|
|
537
|
-
},
|
|
538
|
-
/**
|
|
539
|
-
* Aborts the request after a fixed time.
|
|
540
|
-
*
|
|
541
|
-
* @param time Time in milliseconds
|
|
542
|
-
* @param controller A custom controller
|
|
543
|
-
*/
|
|
544
|
-
setTimeout: function (time, controller) {
|
|
545
|
-
if (controller === void 0) { controller = fetchController; }
|
|
546
|
-
timeout.clear();
|
|
547
|
-
timeout.ref = setTimeout(function () { return controller.abort(); }, time);
|
|
548
|
-
return responseChain;
|
|
549
|
-
},
|
|
550
|
-
/**
|
|
551
|
-
* Returns the automatically generated AbortController alongside the current wretch response as a pair.
|
|
552
|
-
*/
|
|
553
|
-
controller: function () { return [fetchController, responseChain]; },
|
|
554
|
-
/**
|
|
555
|
-
* Catches an http response with a specific error code or name and performs a callback.
|
|
556
|
-
*/
|
|
557
|
-
error: function (errorId, cb) {
|
|
558
|
-
catchers.set(errorId, cb);
|
|
559
|
-
return responseChain;
|
|
560
|
-
},
|
|
561
|
-
/**
|
|
562
|
-
* Catches a bad request (http code 400) and performs a callback.
|
|
563
|
-
*/
|
|
564
|
-
badRequest: function (cb) { return responseChain.error(400, cb); },
|
|
565
|
-
/**
|
|
566
|
-
* Catches an unauthorized request (http code 401) and performs a callback.
|
|
567
|
-
*/
|
|
568
|
-
unauthorized: function (cb) { return responseChain.error(401, cb); },
|
|
569
|
-
/**
|
|
570
|
-
* Catches a forbidden request (http code 403) and performs a callback.
|
|
571
|
-
*/
|
|
572
|
-
forbidden: function (cb) { return responseChain.error(403, cb); },
|
|
573
|
-
/**
|
|
574
|
-
* Catches a "not found" request (http code 404) and performs a callback.
|
|
575
|
-
*/
|
|
576
|
-
notFound: function (cb) { return responseChain.error(404, cb); },
|
|
577
|
-
/**
|
|
578
|
-
* Catches a timeout (http code 408) and performs a callback.
|
|
579
|
-
*/
|
|
580
|
-
timeout: function (cb) { return responseChain.error(408, cb); },
|
|
581
|
-
/**
|
|
582
|
-
* Catches an internal server error (http code 500) and performs a callback.
|
|
583
|
-
*/
|
|
584
|
-
internalError: function (cb) { return responseChain.error(500, cb); },
|
|
585
|
-
/**
|
|
586
|
-
* Catches errors thrown when calling the fetch function and performs a callback.
|
|
587
|
-
*/
|
|
588
|
-
fetchError: function (cb) { return responseChain.error("__fromFetch", cb); },
|
|
589
|
-
/**
|
|
590
|
-
* Catches an AbortError and performs a callback.
|
|
591
|
-
*/
|
|
592
|
-
onAbort: function (cb) { return responseChain.error("AbortError", cb); }
|
|
593
|
-
};
|
|
594
|
-
return resolvers.reduce(function (chain, r) { return r(chain, wretcher); }, responseChain);
|
|
595
|
-
};
|
|
596
|
-
|
|
597
|
-
var __assign = (undefined && undefined.__assign) || function () {
|
|
598
|
-
__assign = Object.assign || function(t) {
|
|
599
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
600
|
-
s = arguments[i];
|
|
601
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
602
|
-
t[p] = s[p];
|
|
603
|
-
}
|
|
604
|
-
return t;
|
|
605
|
-
};
|
|
606
|
-
return __assign.apply(this, arguments);
|
|
607
|
-
};
|
|
608
|
-
var __spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
609
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
610
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
611
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
612
|
-
r[k] = a[j];
|
|
613
|
-
return r;
|
|
614
|
-
};
|
|
615
|
-
var JSON_MIME = "application/json";
|
|
616
|
-
var CONTENT_TYPE_HEADER = "Content-Type";
|
|
617
|
-
/**
|
|
618
|
-
* The Wretcher class used to perform easy fetch requests.
|
|
619
|
-
*
|
|
620
|
-
* Immutability : almost every method of this class return a fresh Wretcher object.
|
|
621
|
-
*/
|
|
622
|
-
var Wretcher = /** @class */ (function () {
|
|
623
|
-
function Wretcher(_url, _options, _catchers, _resolvers, _middlewares, _deferredChain) {
|
|
624
|
-
if (_catchers === void 0) { _catchers = new Map(); }
|
|
625
|
-
if (_resolvers === void 0) { _resolvers = []; }
|
|
626
|
-
if (_middlewares === void 0) { _middlewares = []; }
|
|
627
|
-
if (_deferredChain === void 0) { _deferredChain = []; }
|
|
628
|
-
this._url = _url;
|
|
629
|
-
this._options = _options;
|
|
630
|
-
this._catchers = _catchers;
|
|
631
|
-
this._resolvers = _resolvers;
|
|
632
|
-
this._middlewares = _middlewares;
|
|
633
|
-
this._deferredChain = _deferredChain;
|
|
634
|
-
}
|
|
635
|
-
Wretcher.factory = function (url, options) {
|
|
636
|
-
if (url === void 0) { url = ""; }
|
|
637
|
-
if (options === void 0) { options = {}; }
|
|
638
|
-
return new Wretcher(url, options);
|
|
639
|
-
};
|
|
640
|
-
Wretcher.prototype.selfFactory = function (_a) {
|
|
641
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.url, url = _c === void 0 ? this._url : _c, _d = _b.options, options = _d === void 0 ? this._options : _d, _e = _b.catchers, catchers = _e === void 0 ? this._catchers : _e, _f = _b.resolvers, resolvers = _f === void 0 ? this._resolvers : _f, _g = _b.middlewares, middlewares = _g === void 0 ? this._middlewares : _g, _h = _b.deferredChain, deferredChain = _h === void 0 ? this._deferredChain : _h;
|
|
642
|
-
return new Wretcher(url, __assign({}, options), new Map(catchers), __spreadArrays(resolvers), __spreadArrays(middlewares), __spreadArrays(deferredChain));
|
|
643
|
-
};
|
|
644
|
-
/**
|
|
645
|
-
* Sets the default fetch options used for every subsequent fetch call.
|
|
646
|
-
* @param options New default options
|
|
647
|
-
* @param mixin If true, mixes in instead of replacing the existing options
|
|
648
|
-
*/
|
|
649
|
-
Wretcher.prototype.defaults = function (options, mixin) {
|
|
650
|
-
if (mixin === void 0) { mixin = false; }
|
|
651
|
-
config.defaults = mixin ? mix(config.defaults, options) : options;
|
|
652
|
-
return this;
|
|
653
|
-
};
|
|
654
|
-
/**
|
|
655
|
-
* Sets the method (text, json ...) used to parse the data contained in the response body in case of an HTTP error.
|
|
656
|
-
*
|
|
657
|
-
* Persists for every subsequent requests.
|
|
658
|
-
*
|
|
659
|
-
* Default is "text".
|
|
660
|
-
*/
|
|
661
|
-
Wretcher.prototype.errorType = function (method) {
|
|
662
|
-
config.errorType = method;
|
|
663
|
-
return this;
|
|
664
|
-
};
|
|
665
|
-
/**
|
|
666
|
-
* Sets the non-global polyfills which will be used for every subsequent calls.
|
|
667
|
-
*
|
|
668
|
-
* Needed for libraries like [fetch-ponyfill](https://github.com/qubyte/fetch-ponyfill).
|
|
669
|
-
*
|
|
670
|
-
* @param polyfills An object containing the polyfills.
|
|
671
|
-
*/
|
|
672
|
-
Wretcher.prototype.polyfills = function (polyfills) {
|
|
673
|
-
config.polyfills = __assign(__assign({}, config.polyfills), polyfills);
|
|
674
|
-
return this;
|
|
675
|
-
};
|
|
676
|
-
/**
|
|
677
|
-
* Returns a new Wretcher object with the argument url appended and the same options.
|
|
678
|
-
* @param url String url
|
|
679
|
-
* @param replace Boolean If true, replaces the current url instead of appending
|
|
680
|
-
*/
|
|
681
|
-
Wretcher.prototype.url = function (url, replace) {
|
|
682
|
-
if (replace === void 0) { replace = false; }
|
|
683
|
-
if (replace)
|
|
684
|
-
return this.selfFactory({ url: url });
|
|
685
|
-
var split = this._url.split("?");
|
|
686
|
-
return this.selfFactory({
|
|
687
|
-
url: split.length > 1 ?
|
|
688
|
-
split[0] + url + "?" + split[1] :
|
|
689
|
-
this._url + url
|
|
690
|
-
});
|
|
691
|
-
};
|
|
692
|
-
/**
|
|
693
|
-
* Returns a new Wretcher object with the same url and new options.
|
|
694
|
-
* @param options New options
|
|
695
|
-
* @param mixin If true, mixes in instead of replacing the existing options
|
|
696
|
-
*/
|
|
697
|
-
Wretcher.prototype.options = function (options, mixin) {
|
|
698
|
-
if (mixin === void 0) { mixin = true; }
|
|
699
|
-
return this.selfFactory({ options: mixin ? mix(this._options, options) : options });
|
|
700
|
-
};
|
|
701
|
-
/**
|
|
702
|
-
* Converts a javascript object to query parameters,
|
|
703
|
-
* then appends this query string to the current url.
|
|
704
|
-
*
|
|
705
|
-
* If given a string, use the string as the query verbatim.
|
|
706
|
-
*
|
|
707
|
-
* ```
|
|
708
|
-
* let w = wretch("http://example.com") // url is http://example.com
|
|
709
|
-
*
|
|
710
|
-
* // Chain query calls
|
|
711
|
-
* w = w.query({ a: 1, b : 2 }) // url is now http://example.com?a=1&b=2
|
|
712
|
-
* w = w.query("foo-bar-baz-woz") // url is now http://example.com?a=1&b=2&foo-bar-baz-woz
|
|
713
|
-
*
|
|
714
|
-
* // Pass true as the second argument to replace existing query parameters
|
|
715
|
-
* w = w.query("c=3&d=4", true) // url is now http://example.com?c=3&d=4
|
|
716
|
-
* ```
|
|
717
|
-
*
|
|
718
|
-
* @param qp An object which will be converted, or a string which will be used verbatim.
|
|
719
|
-
*/
|
|
720
|
-
Wretcher.prototype.query = function (qp, replace) {
|
|
721
|
-
if (replace === void 0) { replace = false; }
|
|
722
|
-
return this.selfFactory({ url: appendQueryParams(this._url, qp, replace) });
|
|
723
|
-
};
|
|
724
|
-
/**
|
|
725
|
-
* Set request headers.
|
|
726
|
-
* @param headerValues An object containing header keys and values
|
|
727
|
-
*/
|
|
728
|
-
Wretcher.prototype.headers = function (headerValues) {
|
|
729
|
-
return this.selfFactory({ options: mix(this._options, { headers: headerValues || {} }) });
|
|
730
|
-
};
|
|
731
|
-
/**
|
|
732
|
-
* Shortcut to set the "Accept" header.
|
|
733
|
-
* @param headerValue Header value
|
|
734
|
-
*/
|
|
735
|
-
Wretcher.prototype.accept = function (headerValue) {
|
|
736
|
-
return this.headers({ Accept: headerValue });
|
|
737
|
-
};
|
|
738
|
-
/**
|
|
739
|
-
* Shortcut to set the "Content-Type" header.
|
|
740
|
-
* @param headerValue Header value
|
|
741
|
-
*/
|
|
742
|
-
Wretcher.prototype.content = function (headerValue) {
|
|
743
|
-
var _a;
|
|
744
|
-
return this.headers((_a = {}, _a[CONTENT_TYPE_HEADER] = headerValue, _a));
|
|
745
|
-
};
|
|
746
|
-
/**
|
|
747
|
-
* Shortcut to set the "Authorization" header.
|
|
748
|
-
* @param headerValue Header value
|
|
749
|
-
*/
|
|
750
|
-
Wretcher.prototype.auth = function (headerValue) {
|
|
751
|
-
return this.headers({ Authorization: headerValue });
|
|
752
|
-
};
|
|
753
|
-
/**
|
|
754
|
-
* Adds a default catcher which will be called on every subsequent request error when the error code matches.
|
|
755
|
-
* @param errorId Error code or name
|
|
756
|
-
* @param catcher: The catcher method
|
|
757
|
-
*/
|
|
758
|
-
Wretcher.prototype.catcher = function (errorId, catcher) {
|
|
759
|
-
var newMap = new Map(this._catchers);
|
|
760
|
-
newMap.set(errorId, catcher);
|
|
761
|
-
return this.selfFactory({ catchers: newMap });
|
|
762
|
-
};
|
|
763
|
-
/**
|
|
764
|
-
* Associates a custom signal with the request.
|
|
765
|
-
* @param controller : An AbortController
|
|
766
|
-
*/
|
|
767
|
-
Wretcher.prototype.signal = function (controller) {
|
|
768
|
-
return this.selfFactory({ options: __assign(__assign({}, this._options), { signal: controller.signal }) });
|
|
769
|
-
};
|
|
770
|
-
/**
|
|
771
|
-
* Program a resolver to perform response chain tasks automatically.
|
|
772
|
-
* @param doResolve : Resolver callback
|
|
773
|
-
*/
|
|
774
|
-
Wretcher.prototype.resolve = function (doResolve, clear) {
|
|
775
|
-
if (clear === void 0) { clear = false; }
|
|
776
|
-
return this.selfFactory({ resolvers: clear ? [doResolve] : __spreadArrays(this._resolvers, [doResolve]) });
|
|
777
|
-
};
|
|
778
|
-
/**
|
|
779
|
-
* Defer wretcher methods that will be chained and called just before the request is performed.
|
|
780
|
-
*/
|
|
781
|
-
Wretcher.prototype.defer = function (callback, clear) {
|
|
782
|
-
if (clear === void 0) { clear = false; }
|
|
783
|
-
return this.selfFactory({
|
|
784
|
-
deferredChain: clear ? [callback] : __spreadArrays(this._deferredChain, [callback])
|
|
785
|
-
});
|
|
786
|
-
};
|
|
787
|
-
/**
|
|
788
|
-
* Add middlewares to intercept a request before being sent.
|
|
789
|
-
*/
|
|
790
|
-
Wretcher.prototype.middlewares = function (middlewares, clear) {
|
|
791
|
-
if (clear === void 0) { clear = false; }
|
|
792
|
-
return this.selfFactory({
|
|
793
|
-
middlewares: clear ? middlewares : __spreadArrays(this._middlewares, middlewares)
|
|
794
|
-
});
|
|
795
|
-
};
|
|
796
|
-
Wretcher.prototype.method = function (method, options, body) {
|
|
797
|
-
if (options === void 0) { options = {}; }
|
|
798
|
-
if (body === void 0) { body = null; }
|
|
799
|
-
var headers = this._options.headers;
|
|
800
|
-
var baseWretcher = !body ? this :
|
|
801
|
-
typeof body === "object" && (!headers ||
|
|
802
|
-
Object.entries(headers).every(function (_a) {
|
|
803
|
-
var k = _a[0], v = _a[1];
|
|
804
|
-
return k.toLowerCase() !== CONTENT_TYPE_HEADER.toLowerCase() ||
|
|
805
|
-
v.startsWith(JSON_MIME);
|
|
806
|
-
})) ? this.json(body) :
|
|
807
|
-
this.body(body);
|
|
808
|
-
baseWretcher = baseWretcher.options(__assign(__assign({}, options), { method: method }));
|
|
809
|
-
var deferredWretcher = baseWretcher._deferredChain.reduce(function (acc, curr) { return curr(acc, acc._url, acc._options); }, baseWretcher);
|
|
810
|
-
return resolver(deferredWretcher);
|
|
811
|
-
};
|
|
812
|
-
/**
|
|
813
|
-
* Performs a get request.
|
|
814
|
-
*/
|
|
815
|
-
Wretcher.prototype.get = function (options) {
|
|
816
|
-
return this.method("GET", options);
|
|
817
|
-
};
|
|
818
|
-
/**
|
|
819
|
-
* Performs a delete request.
|
|
820
|
-
*/
|
|
821
|
-
Wretcher.prototype.delete = function (options) {
|
|
822
|
-
return this.method("DELETE", options);
|
|
823
|
-
};
|
|
824
|
-
/**
|
|
825
|
-
* Performs a put request.
|
|
826
|
-
*/
|
|
827
|
-
Wretcher.prototype.put = function (body, options) {
|
|
828
|
-
return this.method("PUT", options, body);
|
|
829
|
-
};
|
|
830
|
-
/**
|
|
831
|
-
* Performs a post request.
|
|
832
|
-
*/
|
|
833
|
-
Wretcher.prototype.post = function (body, options) {
|
|
834
|
-
return this.method("POST", options, body);
|
|
835
|
-
};
|
|
836
|
-
/**
|
|
837
|
-
* Performs a patch request.
|
|
838
|
-
*/
|
|
839
|
-
Wretcher.prototype.patch = function (body, options) {
|
|
840
|
-
return this.method("PATCH", options, body);
|
|
841
|
-
};
|
|
842
|
-
/**
|
|
843
|
-
* Performs a head request.
|
|
844
|
-
*/
|
|
845
|
-
Wretcher.prototype.head = function (options) {
|
|
846
|
-
return this.method("HEAD", options);
|
|
847
|
-
};
|
|
848
|
-
/**
|
|
849
|
-
* Performs an options request
|
|
850
|
-
*/
|
|
851
|
-
Wretcher.prototype.opts = function (options) {
|
|
852
|
-
return this.method("OPTIONS", options);
|
|
853
|
-
};
|
|
854
|
-
/**
|
|
855
|
-
* Replay a request.
|
|
856
|
-
*/
|
|
857
|
-
Wretcher.prototype.replay = function (options) {
|
|
858
|
-
return this.method(this._options.method, options);
|
|
859
|
-
};
|
|
860
|
-
/**
|
|
861
|
-
* Sets the request body with any content.
|
|
862
|
-
* @param contents The body contents
|
|
863
|
-
*/
|
|
864
|
-
Wretcher.prototype.body = function (contents) {
|
|
865
|
-
return this.selfFactory({ options: __assign(__assign({}, this._options), { body: contents }) });
|
|
866
|
-
};
|
|
867
|
-
/**
|
|
868
|
-
* Sets the content type header, stringifies an object and sets the request body.
|
|
869
|
-
* @param jsObject An object which will be serialized into a JSON
|
|
870
|
-
*/
|
|
871
|
-
Wretcher.prototype.json = function (jsObject) {
|
|
872
|
-
var _a;
|
|
873
|
-
var preservedContentType = (_a = Object.entries(this._options.headers || {}).find(function (_a) {
|
|
874
|
-
var k = _a[0], v = _a[1];
|
|
875
|
-
return k.toLowerCase() === CONTENT_TYPE_HEADER.toLowerCase() && v.startsWith(JSON_MIME);
|
|
876
|
-
})) === null || _a === void 0 ? void 0 : _a[1];
|
|
877
|
-
return this.content(preservedContentType || JSON_MIME).body(JSON.stringify(jsObject));
|
|
878
|
-
};
|
|
879
|
-
/**
|
|
880
|
-
* Converts the javascript object to a FormData and sets the request body.
|
|
881
|
-
* @param formObject An object which will be converted to a FormData
|
|
882
|
-
* @param recursive If `true`, will recurse through all nested objects
|
|
883
|
-
* Can be set as an array of string to exclude specific keys.
|
|
884
|
-
* See https://github.com/elbywan/wretch/issues/68 for more details.
|
|
885
|
-
*/
|
|
886
|
-
Wretcher.prototype.formData = function (formObject, recursive) {
|
|
887
|
-
if (recursive === void 0) { recursive = false; }
|
|
888
|
-
return this.body(convertFormData(formObject, recursive));
|
|
889
|
-
};
|
|
890
|
-
/**
|
|
891
|
-
* Converts the input to an url encoded string and sets the content-type header and body.
|
|
892
|
-
* If the input argument is already a string, skips the conversion part.
|
|
893
|
-
*
|
|
894
|
-
* @param input An object to convert into an url encoded string or an already encoded string
|
|
895
|
-
*/
|
|
896
|
-
Wretcher.prototype.formUrl = function (input) {
|
|
897
|
-
return this
|
|
898
|
-
.body(typeof input === "string" ? input : convertFormUrl(input))
|
|
899
|
-
.content("application/x-www-form-urlencoded");
|
|
900
|
-
};
|
|
901
|
-
return Wretcher;
|
|
902
|
-
}());
|
|
903
|
-
// Internal helpers
|
|
904
|
-
var appendQueryParams = function (url, qp, replace) {
|
|
905
|
-
var queryString;
|
|
906
|
-
if (typeof qp === "string") {
|
|
907
|
-
queryString = qp;
|
|
908
|
-
}
|
|
909
|
-
else {
|
|
910
|
-
var usp = config.polyfill("URLSearchParams", { instance: true });
|
|
911
|
-
for (var key in qp) {
|
|
912
|
-
if (qp[key] instanceof Array) {
|
|
913
|
-
for (var _i = 0, _a = qp[key]; _i < _a.length; _i++) {
|
|
914
|
-
var val = _a[_i];
|
|
915
|
-
usp.append(key, val);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
else {
|
|
919
|
-
usp.append(key, qp[key]);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
queryString = usp.toString();
|
|
923
|
-
}
|
|
924
|
-
var split = url.split("?");
|
|
925
|
-
if (replace || split.length < 2)
|
|
926
|
-
return split[0] + "?" + queryString;
|
|
927
|
-
return url + "&" + queryString;
|
|
928
|
-
};
|
|
929
|
-
function convertFormData(formObject, recursive, formData, ancestors) {
|
|
930
|
-
if (recursive === void 0) { recursive = false; }
|
|
931
|
-
if (formData === void 0) { formData = config.polyfill("FormData", { instance: true }); }
|
|
932
|
-
if (ancestors === void 0) { ancestors = []; }
|
|
933
|
-
Object.entries(formObject).forEach(function (_a) {
|
|
934
|
-
var key = _a[0], value = _a[1];
|
|
935
|
-
var formKey = ancestors.reduce(function (acc, ancestor) { return (acc ? acc + "[" + ancestor + "]" : ancestor); }, null);
|
|
936
|
-
formKey = formKey ? formKey + "[" + key + "]" : key;
|
|
937
|
-
if (value instanceof Array) {
|
|
938
|
-
for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
|
|
939
|
-
var item = value_1[_i];
|
|
940
|
-
formData.append(formKey + "[]", item);
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
else if (recursive &&
|
|
944
|
-
typeof value === "object" &&
|
|
945
|
-
(!(recursive instanceof Array) ||
|
|
946
|
-
!recursive.includes(key))) {
|
|
947
|
-
if (value !== null) {
|
|
948
|
-
convertFormData(value, recursive, formData, __spreadArrays(ancestors, [key]));
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
else {
|
|
952
|
-
formData.append(formKey, value);
|
|
953
|
-
}
|
|
954
|
-
});
|
|
955
|
-
return formData;
|
|
956
|
-
}
|
|
957
|
-
function encodeQueryValue(key, value) {
|
|
958
|
-
return encodeURIComponent(key) +
|
|
959
|
-
"=" +
|
|
960
|
-
encodeURIComponent(typeof value === "object" ?
|
|
961
|
-
JSON.stringify(value) :
|
|
962
|
-
"" + value);
|
|
963
|
-
}
|
|
964
|
-
function convertFormUrl(formObject) {
|
|
965
|
-
return Object.keys(formObject)
|
|
966
|
-
.map(function (key) {
|
|
967
|
-
var value = formObject[key];
|
|
968
|
-
if (value instanceof Array) {
|
|
969
|
-
return value.map(function (v) { return encodeQueryValue(key, v); }).join("&");
|
|
970
|
-
}
|
|
971
|
-
return encodeQueryValue(key, value);
|
|
972
|
-
})
|
|
973
|
-
.join("&");
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
var factory = Wretcher.factory;
|
|
977
|
-
factory["default"] = Wretcher.factory;
|
|
978
|
-
|
|
979
|
-
export { fromNullable as a, isSome as b, chain as c, toUndefined as d, factory as e, fold as f, getOrElse as g, getOrElseW as h, isNone as i, map as m, none as n, pipe as p, some as s, toNullable as t };
|