openstack-uicore-foundation 5.0.31-beta.0 → 5.0.32

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.
Files changed (99) hide show
  1. package/.claude/rules/openstack-uicore-foundation-components.md +62 -0
  2. package/.claude/rules/openstack-uicore-foundation-project.md +64 -0
  3. package/.claude/rules/openstack-uicore-foundation-security.md +39 -0
  4. package/.claude/settings.local.json +1 -7
  5. package/.codegraph/config.json +140 -0
  6. package/docs/plans/2026-04-09-showconfirmdialog-react16-compat.md +83 -0
  7. package/docs/plans/2026-04-22-dropzone-pooling-ux.md +129 -0
  8. package/docs/plans/2026-04-23-uploadv3-duplicate-file-max-reached.md +109 -0
  9. package/docs/plans/2026-04-23-uploadv3-premature-complete-on-202.md +99 -0
  10. package/lib/components/clock-context.js +2 -0
  11. package/lib/components/clock-context.js.map +1 -0
  12. package/lib/components/index.js +1 -1
  13. package/lib/components/index.js.map +1 -1
  14. package/lib/components/inputs/access-levels-input.js.map +1 -1
  15. package/lib/components/inputs/attendee-input.js.map +1 -1
  16. package/lib/components/inputs/company-input-v2.js.map +1 -1
  17. package/lib/components/inputs/company-input.js.map +1 -1
  18. package/lib/components/inputs/country-dropdown.js.map +1 -1
  19. package/lib/components/inputs/country-input.js.map +1 -1
  20. package/lib/components/inputs/event-input.js.map +1 -1
  21. package/lib/components/inputs/group-input.js.map +1 -1
  22. package/lib/components/inputs/language-input.js.map +1 -1
  23. package/lib/components/inputs/member-input.js.map +1 -1
  24. package/lib/components/inputs/organization-input.js.map +1 -1
  25. package/lib/components/inputs/promocode-input.js.map +1 -1
  26. package/lib/components/inputs/registration-company-input.js.map +1 -1
  27. package/lib/components/inputs/speaker-input.js.map +1 -1
  28. package/lib/components/inputs/sponsor-input.js.map +1 -1
  29. package/lib/components/inputs/summit-input.js.map +1 -1
  30. package/lib/components/inputs/tag-input.js.map +1 -1
  31. package/lib/components/inputs/ticket-types-input.js.map +1 -1
  32. package/lib/components/inputs/upload-input-v3.js +1 -1
  33. package/lib/components/inputs/upload-input-v3.js.map +1 -1
  34. package/lib/components/mui/download-btn.js +1 -1
  35. package/lib/components/mui/download-btn.js.map +1 -1
  36. package/lib/components/mui/dropdown.js +2 -0
  37. package/lib/components/mui/dropdown.js.map +1 -0
  38. package/lib/components/mui/editable-table.js.map +1 -1
  39. package/lib/components/mui/form-item-table.js.map +1 -1
  40. package/lib/components/mui/formik-inputs/additional-input-list.js.map +1 -1
  41. package/lib/components/mui/formik-inputs/additional-input.js.map +1 -1
  42. package/lib/components/mui/formik-inputs/async-select.js.map +1 -1
  43. package/lib/components/mui/formik-inputs/checkbox-group.js.map +1 -1
  44. package/lib/components/mui/formik-inputs/company-input.js.map +1 -1
  45. package/lib/components/mui/formik-inputs/discount-field.js.map +1 -1
  46. package/lib/components/mui/formik-inputs/file-size-field.js.map +1 -1
  47. package/lib/components/mui/formik-inputs/item-price-tiers.js.map +1 -1
  48. package/lib/components/mui/formik-inputs/price-field.js.map +1 -1
  49. package/lib/components/mui/formik-inputs/sponsor-input.js.map +1 -1
  50. package/lib/components/mui/formik-inputs/sponsorship-input.js.map +1 -1
  51. package/lib/components/mui/formik-inputs/sponsorship-summit-select.js.map +1 -1
  52. package/lib/components/mui/formik-inputs/summit-addon-select.js.map +1 -1
  53. package/lib/components/mui/formik-inputs/upload.js +1 -1
  54. package/lib/components/mui/formik-inputs/upload.js.map +1 -1
  55. package/lib/components/mui/grid-filter.js +2 -0
  56. package/lib/components/mui/grid-filter.js.map +1 -0
  57. package/lib/components/mui/infinite-table.js.map +1 -1
  58. package/lib/components/mui/info-note.js +1 -1
  59. package/lib/components/mui/info-note.js.map +1 -1
  60. package/lib/components/mui/order-summary.js.map +1 -1
  61. package/lib/components/mui/round-button.js +2 -0
  62. package/lib/components/mui/round-button.js.map +1 -0
  63. package/lib/components/mui/search-input.js.map +1 -1
  64. package/lib/components/mui/snackbar-notification.js +1 -1
  65. package/lib/components/mui/snackbar-notification.js.map +1 -1
  66. package/lib/components/mui/sortable-table.js.map +1 -1
  67. package/lib/components/mui/sponsor-addon-select.js.map +1 -1
  68. package/lib/components/mui/sponsor-order-grid.js +1 -1
  69. package/lib/components/mui/sponsor-order-grid.js.map +1 -1
  70. package/lib/components/mui/status-chip.js.map +1 -1
  71. package/lib/components/mui/stripe-payment.js.map +1 -1
  72. package/lib/components/mui/summit-addon-select.js.map +1 -1
  73. package/lib/components/mui/summits-dropdown.js.map +1 -1
  74. package/lib/components/mui/table/extra-rows.js +1 -1
  75. package/lib/components/mui/table/extra-rows.js.map +1 -1
  76. package/lib/components/mui/table.js.map +1 -1
  77. package/lib/components/mui/toggle-buttons.js +2 -0
  78. package/lib/components/mui/toggle-buttons.js.map +1 -0
  79. package/lib/components/mui/upload-btn.js +1 -1
  80. package/lib/components/mui/upload-btn.js.map +1 -1
  81. package/lib/components/mui/upload-dialog.js +1 -1
  82. package/lib/components/mui/upload-dialog.js.map +1 -1
  83. package/lib/components/sponsored-project-input.js.map +1 -1
  84. package/lib/css/components/inputs/upload-input-v3.css +1 -1
  85. package/lib/css/components/inputs/upload-input-v3.css.map +1 -1
  86. package/lib/css/components/mui/formik-inputs/upload.css +1 -1
  87. package/lib/css/components/mui/formik-inputs/upload.css.map +1 -1
  88. package/lib/css/components/mui/upload-dialog.css +1 -1
  89. package/lib/css/components/mui/upload-dialog.css.map +1 -1
  90. package/lib/i18n.js +1 -1
  91. package/lib/i18n.js.map +1 -1
  92. package/lib/utils/actions.js.map +1 -1
  93. package/lib/utils/external-store.js +2 -0
  94. package/lib/utils/external-store.js.map +1 -0
  95. package/lib/utils/money.js.map +1 -1
  96. package/lib/utils/query-actions.js.map +1 -1
  97. package/package.json +9 -6
  98. package/readme.md +4 -0
  99. package/package-lock.json +0 -22291
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils/external-store.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,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C,GAAUC,EAAAA,EAAAA,YAAWJ,GAC3B,GAAgB,OAAZG,EACA,MAAM,IAAIE,MAAM,GAAGN,8CAEvB,OAAOI,CAAO,EAqElB,MAAO,CAAEG,SAvDQA,EAAGC,eAAe,KAAMC,eACrC,MAAMC,GAAWC,EAAAA,EAAAA,QAAOH,GAClBI,GAAeD,EAAAA,EAAAA,QAAO,IAAIE,KAE1BC,GAAYC,EAAAA,EAAAA,cAAaC,IAC3BJ,EAAaK,QAAQC,IAAIF,GAClB,IAAMJ,EAAaK,QAAQE,OAAOH,KAC1C,IAEGI,GAAcL,EAAAA,EAAAA,cAAY,IAAML,EAASO,SAAS,IAElDI,GAAON,EAAAA,EAAAA,cAAanB,IACtBc,EAASO,QAAUrB,EACnBgB,EAAaK,QAAQK,SAAQC,GAAYA,KAAW,GACrD,IAEGC,GAAeC,EAAAA,EAAAA,UAAa,KAAM,CAAGX,YAAWM,iBAAgB,CAACN,EAAWM,IAElF,OACIM,IAAAA,cAACzB,EAAQM,SAAQ,CAACX,MAAO4B,GACA,mBAAbf,EAA0BA,EAASY,GAAQZ,EACpC,EAkCRkB,SAxBFA,KACb,MAAM,UAAEb,EAAS,YAAEM,GAAgBjB,IACnC,OAAOyB,EAAAA,EAAAA,sBAAqBd,EAAWM,EAAY,EAsB1BS,YAXTA,CAACC,EAASC,EAAUlC,KACpC,MAAM,UAAEiB,EAAS,YAAEM,GAAgBjB,IACnC,OAAO6B,EAAAA,EAAAA,kCACHlB,EACAM,EACAA,EACAU,EACAC,EACH,EAIT,C","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/external commonjs \"use-sync-external-store/shim\"","webpack://openstack-uicore-foundation/external commonjs \"use-sync-external-store/shim/with-selector\"","webpack://openstack-uicore-foundation/./src/utils/external-store.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","module.exports = require(\"react\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"use-sync-external-store/shim\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"use-sync-external-store/shim/with-selector\");","/**\n * Copyright 2026 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * createExternalStore - Factory for creating React-optimized external stores.\n *\n * Problem:\n * When a frequently-updating data source (clock, WebSocket, polling, etc.)\n * pushes its value into shared state (global store, lifted useState, or a\n * context value), every consuming component re-renders on every update,\n * even when they only care about a derived condition that rarely changes.\n *\n * Solution:\n * createExternalStore() returns a Provider and hooks that store the value\n * in a ref (no re-renders) and use useSyncExternalStore so components\n * can opt in to updates selectively:\n *\n * - useValue() → re-renders on every update\n * - useSelector(compute, isEqual) → re-renders only when the computed result changes\n *\n * Components that don't call either hook are never affected by updates.\n *\n * How it works:\n * 1. The Provider stores the value in a ref (writing to a ref never triggers\n * a React re-render) and keeps a Set of listener callbacks.\n * 2. When emit(value) is called, the ref is updated and all listeners are\n * notified. These listeners come from useSyncExternalStore.\n * 3. useSyncExternalStore (React 18, shimmed for 16/17) calls getSnapshot()\n * to read the ref, compares with the previous value, and only re-renders\n * the component if the value changed.\n * 4. useMemo adds a layer on top: it runs a compute function on the raw value\n * and only re-renders if the computed result changed (checked via isEqual).\n *\n * API:\n * createExternalStore(name) returns:\n *\n * - Provider Wraps your component tree. Pass children as a render function\n * to receive the emit callback: (emit) => JSX. Call emit(value)\n * each time your data source has a new value.\n *\n * - useValue() Returns the latest emitted value. The component re-renders\n * on every emit.\n *\n * - useSelector(compute, isEqual?)\n * Returns a derived value. compute(rawValue) runs on every emit,\n * but the component only re-renders when isEqual returns false\n * (default: ===). Useful when you need to derive something that\n * changes less frequently than the raw value.\n *\n * The name parameter is used in error messages. For example,\n * createExternalStore('Clock') throws \"Clock hooks must be used within\n * their Provider\" when a hook is called outside the Provider.\n *\n * For clock-specific usage:\n * A pre-built clock store is available at:\n * import { ClockProvider, useClock, useClockSelector } from 'openstack-uicore-foundation/lib/components/clock-context';\n * This wires createExternalStore to the Clock component so projects don't\n * have to repeat that boilerplate.\n *\n * Custom store example:\n * import { createExternalStore } from 'openstack-uicore-foundation/lib/utils/external-store';\n *\n * const { Provider, useValue, useSelector } = createExternalStore('WebSocket');\n *\n * const WebSocketProvider = ({ url, children }) => (\n * <Provider>\n * {(emit) => (\n * <>\n * <WebSocketSource url={url} onMessage={emit} />\n * {children}\n * </>\n * )}\n * </Provider>\n * );\n *\n * // Re-renders on every message:\n * const message = useValue();\n *\n * // Re-renders only when the derived value changes:\n * const isActive = useSelector((msg) => msg?.status === 'active');\n **/\n\nimport React, { createContext, useContext, useRef, useCallback, useMemo as reactUseMemo } from 'react';\n// Shim for React 16/17 compatibility, falls back to native in React 18+\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\n\nconst strictEqual = (a, b) => a === b;\n\n/**\n * Creates an external store with a Provider and subscription hooks.\n *\n * @param {string} name - Store name, used in error messages (e.g., \"Clock\", \"WebSocket\")\n * @returns {{ Provider, useValue, useSelector }}\n */\nexport function createExternalStore(name = 'ExternalStore') {\n const Context = createContext(null);\n\n const useStoreContext = () => {\n const context = useContext(Context);\n if (context === null) {\n throw new Error(`${name} hooks must be used within their Provider`);\n }\n return context;\n };\n\n /**\n * Provider - Wraps your component tree and provides the store.\n *\n * Pass children as a render function to receive the `emit` callback:\n * <Provider>{(emit) => <Source onUpdate={emit} />}</Provider>\n *\n * Or pass children normally if you wire emit externally.\n *\n * Pass `initialValue` to seed the store synchronously so that hooks\n * called before the first emit see a real value instead of null.\n */\n const Provider = ({ initialValue = null, children }) => {\n const valueRef = useRef(initialValue);\n const listenersRef = useRef(new Set());\n\n const subscribe = useCallback((callback) => {\n listenersRef.current.add(callback);\n return () => listenersRef.current.delete(callback);\n }, []);\n\n const getSnapshot = useCallback(() => valueRef.current, []);\n\n const emit = useCallback((value) => {\n valueRef.current = value;\n listenersRef.current.forEach(listener => listener());\n }, []);\n\n const contextValue = reactUseMemo(() => ({ subscribe, getSnapshot }), [subscribe, getSnapshot]);\n\n return (\n <Context.Provider value={contextValue}>\n {typeof children === 'function' ? children(emit) : children}\n </Context.Provider>\n );\n };\n\n /**\n * useValue - Subscribe to every update.\n * Component re-renders each time emit() is called.\n *\n * @returns {*} The current value, or null before first emit\n */\n const useValue = () => {\n const { subscribe, getSnapshot } = useStoreContext();\n return useSyncExternalStore(subscribe, getSnapshot);\n };\n\n /**\n * useSelector - Subscribe with a selector function.\n * Only re-renders when the selected/derived value changes.\n *\n * @param {Function} compute - (value) => derivedValue\n * @param {Function} isEqual - Optional equality function (default: ===)\n * @returns {*} The computed value\n */\n const useSelector = (compute, isEqual = strictEqual) => {\n const { subscribe, getSnapshot } = useStoreContext();\n return useSyncExternalStoreWithSelector(\n subscribe,\n getSnapshot,\n getSnapshot,\n compute,\n isEqual\n );\n };\n\n return { Provider, useValue, useSelector };\n}\n"],"names":["root","factory","exports","module","define","amd","this","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","strictEqual","b","createExternalStore","name","Context","createContext","useStoreContext","context","useContext","Error","Provider","initialValue","children","valueRef","useRef","listenersRef","Set","subscribe","useCallback","callback","current","add","delete","getSnapshot","emit","forEach","listener","contextValue","reactUseMemo","React","useValue","useSyncExternalStore","useSelector","compute","isEqual","useSyncExternalStoreWithSelector"],"sourceRoot":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F,EAAInE,EAAAA,GAGtB,MAAO,GAAG4C,EAAO0B,cAAcD,EAAUC,WAAWC,SAAStE,EAAAA,GAAoB,MACnF,CAOO,SAASuE,EAAwBT,EAAOU,EAAW,OACxD,GAAqB,iBAAVV,IAAuBE,OAAOS,UAAUX,GACjD,MAAM,IAAIlB,MAAM,mCAGlB,MAAMD,EAASsB,EAAgBH,GAE/B,MAAO,GADQ/B,EAAgByC,IAAa,MACzB7B,GACrB,CAOO,MAAM+B,EAAcC,IACzB,GAAmB,MAAfA,EAAqB,MAAM,IAAI/B,MAAM,2BAEzC,IAAIC,EAAIC,OAAO6B,GAAa5B,OAG5B,GAAIF,EAAEG,SAAS,KAAM,MAAM,IAAIJ,MAAM,oCAIrC,GADAC,EAAIA,EAAEI,QAAQ,WAAY,KACrBJ,EAAG,MAAM,IAAID,MAAM,mBAAmB+B,MAG3C,OAAOjC,EAAcG,EAAE,EASZ+B,EAAiBA,CAACjC,EAAQkC,IACjCA,IAASxE,EAAAA,GAAeC,OAAeiE,EAAwB5B,GAC/DkC,IAASxE,EAAAA,GAAeE,KAAgBoC,EAASvC,EAAAA,GAAZ,IAClC,G","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/utils/constants.js","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/utils/money.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","export const CENTS_FACTOR = 100n;\nexport const TWO_DECIMAL_PLACES = 2;\nexport const THREE_DECIMAL_PLACES = 3;\nexport const ONE_CENT = 1n;\nexport const ZERO_INT = 0;\nexport const BPS = 100;\n\nexport const CODE_200 = 200;\n\nexport const DEBOUNCE_WAIT_250 = 250;\nexport const DEBOUNCE_WAIT = 500;\n\nexport const NOTIFICATION_TIMEOUT = 2000;\nexport const DEFAULT_PER_PAGE = 10;\nexport const TWENTY_PER_PAGE = 20;\nexport const FIFTY_PER_PAGE = 50;\nexport const MAX_PER_PAGE = 100;\n\nexport const INT_BASE = 10;\n\nexport const ONE_HUNDRED = 100;\nexport const MILLISECONDS_IN_SECOND = 1000;\n\nexport const MILLISECONDS_TO_SECONDS = 1000;\n\nexport const BYTES_PER_MB = 1_048_576; // 1024 * 1024\n\nexport const MAX_INVENTORY_IMAGE_UPLOAD_SIZE = 512000;\nexport const MAX_INVENTORY_IMAGES_UPLOAD_QTY = 5;\nexport const ALLOWED_INVENTORY_IMAGE_FORMATS = [\"jpg\", \"jpeg\", \"png\"];\n\nexport const METAFIELD_TYPES_WITH_OPTIONS = [\n \"CheckBoxList\",\n \"ComboBox\",\n \"RadioButtonList\"\n];\n\nexport const METAFIELD_TYPES = [\n \"CheckBox\",\n ...METAFIELD_TYPES_WITH_OPTIONS,\n \"Text\",\n \"TextArea\",\n \"Quantity\",\n \"DateTime\",\n \"Time\"\n];\n\nexport const DISCOUNT_TYPES = {\n AMOUNT: \"Amount\",\n RATE: \"Rate\"\n};\n\nexport const RATE_FIELDS = {\n EARLY_BIRD: \"early_bird_rate\",\n STANDARD: \"standard_rate\",\n ONSITE: \"onsite_rate\"\n};\n\nexport const DECIMAL_DIGITS = 2;\n\nexport const FILE_UPLOAD_STATUS = {\n PENDING: \"PENDING\",\n DEADLINE_ALERT: \"DEADLINE ALERT\",\n DEADLINE_MISSED: \"DEADLINE MISSED\",\n COMPLETE: \"COMPLETE\"\n};\n\nexport const FILE_UPLOAD_STATUS_COLOR = {\n [FILE_UPLOAD_STATUS.COMPLETE]: \"success.light\",\n [FILE_UPLOAD_STATUS.DEADLINE_MISSED]: \"error\",\n [FILE_UPLOAD_STATUS.DEADLINE_ALERT]: \"warning.light\",\n [FILE_UPLOAD_STATUS.PENDING]: \"default\"\n};\n\nexport const FILE_UPLOAD_STATUS_BKGR_COLOR = {\n [FILE_UPLOAD_STATUS.COMPLETE]: \"white\",\n [FILE_UPLOAD_STATUS.DEADLINE_MISSED]: \"#D32F2F0A\",\n [FILE_UPLOAD_STATUS.DEADLINE_ALERT]: \"#EF6C000A\",\n [FILE_UPLOAD_STATUS.PENDING]: \"white\"\n};\n\nexport const DATE_FORMAT = \"MM/DD/YYYY\";\nexport const DATETIME_FORMAT = \"MM/DD/YYYY hh:mm a\";\n\nexport const SPONSOR_FORMS_METAFIELD_CLASS = {\n FORM: \"Form\",\n ITEM: \"Item\"\n};\n\nexport const SPONSOR_ORDER_GRID_ITEM_TYPES = {\n CHARGE: \"Charge\",\n PAYMENT: \"Payment\",\n REFUND: \"Refund\",\n DISCOUNT: \"Discount\",\n CANCELLED: \"Cancelled\"\n};","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * Copyright 2025 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * */\n\nimport {\n BPS,\n CENTS_FACTOR,\n DISCOUNT_TYPES,\n ONE_CENT,\n THREE_DECIMAL_PLACES,\n TWO_DECIMAL_PLACES,\n ZERO_INT\n} from \"./constants\";\n\nconst CURRENCY_SYMBOL = {\n USD: \"$\",\n EUR: \"€\",\n GBP: \"£\",\n CAD: \"C$\",\n AUD: \"A$\",\n NZD: \"NZ$\",\n CHF: \"CHF\",\n ARS: \"AR$\",\n BRL: \"R$\",\n MXN: \"MX$\",\n};\n\n/**\n * Convert a decimal money amount to integer cents safely (no floating point math).\n *\n * Why this exists:\n * - `Math.round(parseFloat(x) * 100)` can be wrong due to IEEE-754 floating point errors\n * (e.g. 1.005 * 100 may become 100.499999..., rounding down unexpectedly).\n *\n * Input:\n * - number or string (recommended: string from API/UI)\n * - Examples: \"12.34\", \"1,234.56\", \"1234,56\", 12.34\n *\n * Output:\n * - Number cents (exact), e.g. \"12.34\" -> 1234\n *\n * Rounding:\n * - Half-up to 2 decimals (>= 0.005 USD rounds up by 1 cent).\n *\n * Notes:\n * - Amounts are assumed to be NON-negative (per your requirement).\n * - Throws on invalid formats (does not silently return 0).\n */\nexport function amountToCents(amount) {\n if (amount == null) throw new Error(\"amount is required\");\n\n let s = String(amount).trim();\n\n // Normalize common separators:\n // - \"1,234.56\" => \"1234.56\" (remove thousands separators)\n // - \"1234,56\" => \"1234.56\" (convert decimal comma to dot)\n if (s.includes(\",\") && s.includes(\".\")) {\n s = s.replace(/,/g, \"\");\n } else if (s.includes(\",\") && !s.includes(\".\")) {\n s = s.replace(\",\", \".\");\n }\n\n // Validate: digits optionally followed by '.' and more digits\n if (!/^\\d+(\\.\\d+)?$/.test(s)) {\n throw new Error(`Invalid money format: \"${amount}\"`);\n }\n\n const [intPart, fracRaw = \"\"] = s.split(\".\");\n\n // Pad at least 3 fractional digits so we can:\n // - take 2 digits for cents\n // - take the 3rd digit to decide rounding\n const fracPadded = (`${fracRaw}000`);\n\n const tenths = fracPadded[0] ?? \"0\"; // 1st decimal digit\n const hundredths = fracPadded[1] ?? \"0\"; // 2nd decimal digit (cents)\n const thousandths = fracPadded[2] ?? \"0\"; // 3rd decimal digit (rounding decision)\n\n // If there are more than 3 decimals, we track if any non-zero exists after the 3rd.\n // This can matter for policies like bankers rounding; here it's mainly informational.\n const trailing =\n fracRaw.length > THREE_DECIMAL_PLACES\n ? fracRaw.slice(THREE_DECIMAL_PLACES)\n : \"\";\n const hasTrailingNonZero = /[1-9]/.test(trailing);\n\n // Build cents as integer: (dollars * 100) + (first two decimal digits)\n let cents = BigInt(intPart) * CENTS_FACTOR + BigInt(tenths + hundredths);\n\n // Half-up rounding:\n // - If the 3rd digit is >= 5, round up by 1 cent.\n // - If there are more digits beyond the 3rd, \"5xxx\" should also round up.\n const roundUp = thousandths > \"5\" || thousandths === \"5\" || (thousandths === \"5\" && hasTrailingNonZero);\n\n if (roundUp) cents += ONE_CENT;\n\n return Number(cents);\n}\n\n/**\n * Convert an amount in cents to a decimal string (e.g. 1234 -> \"12.34\") safely.\n *\n * Why:\n * - Avoids floating point math (cents / 100) which can lose precision for large integers\n * or if cents is already imprecise as a JS Number.\n *\n * Input:\n * - Accepts: bigint | number | string (digits)\n * - Assumes NON-negative cents (per your requirement).\n *\n * Output:\n * - Always returns a string with exactly 2 decimal places.\n */\nexport function amountFromCents(cents) {\n let c;\n\n // Normalize input to BigInt safely\n if (typeof cents === \"bigint\") {\n c = cents;\n } else if (typeof cents === \"number\") {\n // Ensure it's a safe integer before converting to BigInt\n if (!Number.isSafeInteger(cents)) {\n throw new Error(\"cents must be a safe integer Number (or pass BigInt/string).\");\n }\n c = BigInt(cents);\n } else if (typeof cents === \"string\") {\n const s = cents.trim();\n if (!/^\\d+$/.test(s)) {\n throw new Error(\"cents string must contain digits only (e.g., '1234').\");\n }\n c = BigInt(s);\n } else {\n throw new Error(\"cents must be a bigint, number, or numeric string.\");\n }\n\n if (c < ZERO_INT) {\n throw new Error(\"cents must be non-negative.\");\n }\n\n const amount = c / CENTS_FACTOR;\n const remainder = c % CENTS_FACTOR;\n\n // Always pad remainder to 2 digits\n return `${amount.toString()}.${remainder.toString().padStart(TWO_DECIMAL_PLACES, \"0\")}`;\n}\n\n/**\n * @param cents\n * @param currency\n * @returns {string}\n */\nexport function currencyAmountFromCents(cents, currency = \"USD\") {\n if (typeof cents !== \"number\" || !Number.isInteger(cents)) {\n throw new Error(\"cents must be an integer number\");\n }\n\n const amount = amountFromCents(cents); // \"12.34\"\n const symbol = CURRENCY_SYMBOL[currency] ?? \"$\";\n return `${symbol}${amount}`;\n}\n\n/**\n * Converts a price string into cents.\n * @param {string} priceString - The price (e.g., $0.30).\n * @returns {number} - The amount converted to cents (e.g., 30).\n */\nexport const parsePrice = (priceString) => {\n if (priceString == null) throw new Error(\"priceString is required\");\n\n let s = String(priceString).trim();\n\n // Reject negatives explicitly (per your requirement).\n if (s.includes(\"-\")) throw new Error(\"Negative amounts are not allowed\");\n\n // Keep only digits and separators. Remove currency symbols/letters/spaces.\n s = s.replace(/[^\\d.,]/g, \"\");\n if (!s) throw new Error(`Invalid price: \"${priceString}\"`);\n\n // Delegate exact cents conversion (no floats)\n return amountToCents(s); // <- your safe BigInt cents converter\n};\n\n/**\n * Formats a discount value in BPS or CENTS to string.\n * @param {number} amount - The discount in BPS or CENTS(e.g., 300 = 3%).\n * @param {string} type - The discount type: \"Amount\" or \"Rate\".\n * @returns {string} - The discount converted to string (e.g., $5).\n */\nexport const formatDiscount = (amount, type) => {\n if (type === DISCOUNT_TYPES.AMOUNT) return currencyAmountFromCents(amount);\n if (type === DISCOUNT_TYPES.RATE) return `${amount / BPS}%`; // transform from bps to percentage\n return \"\";\n};"],"names":["root","factory","exports","module","define","amd","this","CENTS_FACTOR","TWO_DECIMAL_PLACES","THREE_DECIMAL_PLACES","ONE_CENT","ZERO_INT","BPS","DISCOUNT_TYPES","AMOUNT","RATE","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","CURRENCY_SYMBOL","USD","EUR","GBP","CAD","AUD","NZD","CHF","ARS","BRL","MXN","amountToCents","amount","Error","s","String","trim","includes","replace","test","intPart","fracRaw","split","fracPadded","tenths","hundredths","thousandths","trailing","length","slice","hasTrailingNonZero","cents","BigInt","Number","amountFromCents","c","isSafeInteger","remainder","toString","padStart","currencyAmountFromCents","currency","isInteger","parsePrice","priceString","formatDiscount","type"],"sourceRoot":""}
1
+ {"version":3,"file":"utils/money.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,8BAA+B,GAAIH,GAChB,iBAAZC,QACdA,QAAQ,+BAAiCD,IAEzCD,EAAK,+BAAiCC,GACvC,CATD,CASGK,MAAM,I,iHCTF,MAAMC,EAAe,KACfC,EAAqB,EACrBC,EAAuB,EACvBC,EAAW,GACXC,EAAW,EACXC,EAAM,IA0CNC,EAAiB,CAC5BC,OAAQ,SACRC,KAAM,O,GChDJC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IA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rC,GADAC,EAAIA,EAAEI,QAAQ,WAAY,KACrBJ,EAAG,MAAM,IAAID,MAAM,mBAAmB+B,MAG3C,OAAOjC,EAAcG,EAAE,EASZ+B,EAAiBA,CAACjC,EAAQkC,IACjCA,IAASxE,EAAAA,GAAeC,OAAeiE,EAAwB5B,GAC/DkC,IAASxE,EAAAA,GAAeE,KAAgBoC,EAASvC,EAAAA,GAAZ,IAClC,G","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/utils/constants.js","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/utils/money.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","export const CENTS_FACTOR = 100n;\nexport const TWO_DECIMAL_PLACES = 2;\nexport const THREE_DECIMAL_PLACES = 3;\nexport const ONE_CENT = 1n;\nexport const ZERO_INT = 0;\nexport const BPS = 100;\n\nexport const CODE_200 = 200;\n\nexport const DEBOUNCE_WAIT_250 = 250;\nexport const DEBOUNCE_WAIT = 500;\n\nexport const NOTIFICATION_TIMEOUT = 2000;\nexport const DEFAULT_PER_PAGE = 10;\nexport const TWENTY_PER_PAGE = 20;\nexport const FIFTY_PER_PAGE = 50;\nexport const MAX_PER_PAGE = 100;\n\nexport const INT_BASE = 10;\n\nexport const ONE_HUNDRED = 100;\nexport const MILLISECONDS_IN_SECOND = 1000;\n\nexport const MILLISECONDS_TO_SECONDS = 1000;\n\nexport const BYTES_PER_MB = 1_048_576; // 1024 * 1024\n\nexport const MAX_INVENTORY_IMAGE_UPLOAD_SIZE = 512000;\nexport const MAX_INVENTORY_IMAGES_UPLOAD_QTY = 5;\nexport const ALLOWED_INVENTORY_IMAGE_FORMATS = [\"jpg\", \"jpeg\", \"png\"];\n\nexport const METAFIELD_TYPES_WITH_OPTIONS = [\n \"CheckBoxList\",\n \"ComboBox\",\n \"RadioButtonList\"\n];\n\nexport const METAFIELD_TYPES = [\n \"CheckBox\",\n ...METAFIELD_TYPES_WITH_OPTIONS,\n \"Text\",\n \"TextArea\",\n \"Quantity\",\n \"DateTime\",\n \"Time\"\n];\n\nexport const DISCOUNT_TYPES = {\n AMOUNT: \"Amount\",\n RATE: \"Rate\"\n};\n\nexport const RATE_FIELDS = {\n EARLY_BIRD: \"early_bird_rate\",\n STANDARD: \"standard_rate\",\n ONSITE: \"onsite_rate\"\n};\n\nexport const DECIMAL_DIGITS = 2;\n\nexport const FILE_UPLOAD_STATUS = {\n PENDING: \"PENDING\",\n DEADLINE_ALERT: \"DEADLINE ALERT\",\n DEADLINE_MISSED: \"DEADLINE MISSED\",\n COMPLETE: \"COMPLETE\"\n};\n\nexport const FILE_UPLOAD_STATUS_COLOR = {\n [FILE_UPLOAD_STATUS.COMPLETE]: \"success.light\",\n [FILE_UPLOAD_STATUS.DEADLINE_MISSED]: \"error\",\n [FILE_UPLOAD_STATUS.DEADLINE_ALERT]: \"warning.light\",\n [FILE_UPLOAD_STATUS.PENDING]: \"default\"\n};\n\nexport const FILE_UPLOAD_STATUS_BKGR_COLOR = {\n [FILE_UPLOAD_STATUS.COMPLETE]: \"white\",\n [FILE_UPLOAD_STATUS.DEADLINE_MISSED]: \"#D32F2F0A\",\n [FILE_UPLOAD_STATUS.DEADLINE_ALERT]: \"#EF6C000A\",\n [FILE_UPLOAD_STATUS.PENDING]: \"white\"\n};\n\nexport const DATE_FORMAT = \"MM/DD/YYYY\";\nexport const DATETIME_FORMAT = \"MM/DD/YYYY hh:mm a\";\n\nexport const SPONSOR_FORMS_METAFIELD_CLASS = {\n FORM: \"Form\",\n ITEM: \"Item\"\n};","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * Copyright 2025 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * */\n\nimport {\n BPS,\n CENTS_FACTOR,\n DISCOUNT_TYPES,\n ONE_CENT,\n THREE_DECIMAL_PLACES,\n TWO_DECIMAL_PLACES,\n ZERO_INT\n} from \"./constants\";\n\nconst CURRENCY_SYMBOL = {\n USD: \"$\",\n EUR: \"€\",\n GBP: \"£\",\n CAD: \"C$\",\n AUD: \"A$\",\n NZD: \"NZ$\",\n CHF: \"CHF\",\n ARS: \"AR$\",\n BRL: \"R$\",\n MXN: \"MX$\",\n};\n\n/**\n * Convert a decimal money amount to integer cents safely (no floating point math).\n *\n * Why this exists:\n * - `Math.round(parseFloat(x) * 100)` can be wrong due to IEEE-754 floating point errors\n * (e.g. 1.005 * 100 may become 100.499999..., rounding down unexpectedly).\n *\n * Input:\n * - number or string (recommended: string from API/UI)\n * - Examples: \"12.34\", \"1,234.56\", \"1234,56\", 12.34\n *\n * Output:\n * - Number cents (exact), e.g. \"12.34\" -> 1234\n *\n * Rounding:\n * - Half-up to 2 decimals (>= 0.005 USD rounds up by 1 cent).\n *\n * Notes:\n * - Amounts are assumed to be NON-negative (per your requirement).\n * - Throws on invalid formats (does not silently return 0).\n */\nexport function amountToCents(amount) {\n if (amount == null) throw new Error(\"amount is required\");\n\n let s = String(amount).trim();\n\n // Normalize common separators:\n // - \"1,234.56\" => \"1234.56\" (remove thousands separators)\n // - \"1234,56\" => \"1234.56\" (convert decimal comma to dot)\n if (s.includes(\",\") && s.includes(\".\")) {\n s = s.replace(/,/g, \"\");\n } else if (s.includes(\",\") && !s.includes(\".\")) {\n s = s.replace(\",\", \".\");\n }\n\n // Validate: digits optionally followed by '.' and more digits\n if (!/^\\d+(\\.\\d+)?$/.test(s)) {\n throw new Error(`Invalid money format: \"${amount}\"`);\n }\n\n const [intPart, fracRaw = \"\"] = s.split(\".\");\n\n // Pad at least 3 fractional digits so we can:\n // - take 2 digits for cents\n // - take the 3rd digit to decide rounding\n const fracPadded = (`${fracRaw}000`);\n\n const tenths = fracPadded[0] ?? \"0\"; // 1st decimal digit\n const hundredths = fracPadded[1] ?? \"0\"; // 2nd decimal digit (cents)\n const thousandths = fracPadded[2] ?? \"0\"; // 3rd decimal digit (rounding decision)\n\n // If there are more than 3 decimals, we track if any non-zero exists after the 3rd.\n // This can matter for policies like bankers rounding; here it's mainly informational.\n const trailing =\n fracRaw.length > THREE_DECIMAL_PLACES\n ? fracRaw.slice(THREE_DECIMAL_PLACES)\n : \"\";\n const hasTrailingNonZero = /[1-9]/.test(trailing);\n\n // Build cents as integer: (dollars * 100) + (first two decimal digits)\n let cents = BigInt(intPart) * CENTS_FACTOR + BigInt(tenths + hundredths);\n\n // Half-up rounding:\n // - If the 3rd digit is >= 5, round up by 1 cent.\n // - If there are more digits beyond the 3rd, \"5xxx\" should also round up.\n const roundUp = thousandths > \"5\" || thousandths === \"5\" || (thousandths === \"5\" && hasTrailingNonZero);\n\n if (roundUp) cents += ONE_CENT;\n\n return Number(cents);\n}\n\n/**\n * Convert an amount in cents to a decimal string (e.g. 1234 -> \"12.34\") safely.\n *\n * Why:\n * - Avoids floating point math (cents / 100) which can lose precision for large integers\n * or if cents is already imprecise as a JS Number.\n *\n * Input:\n * - Accepts: bigint | number | string (digits)\n * - Assumes NON-negative cents (per your requirement).\n *\n * Output:\n * - Always returns a string with exactly 2 decimal places.\n */\nexport function amountFromCents(cents) {\n let c;\n\n // Normalize input to BigInt safely\n if (typeof cents === \"bigint\") {\n c = cents;\n } else if (typeof cents === \"number\") {\n // Ensure it's a safe integer before converting to BigInt\n if (!Number.isSafeInteger(cents)) {\n throw new Error(\"cents must be a safe integer Number (or pass BigInt/string).\");\n }\n c = BigInt(cents);\n } else if (typeof cents === \"string\") {\n const s = cents.trim();\n if (!/^\\d+$/.test(s)) {\n throw new Error(\"cents string must contain digits only (e.g., '1234').\");\n }\n c = BigInt(s);\n } else {\n throw new Error(\"cents must be a bigint, number, or numeric string.\");\n }\n\n if (c < ZERO_INT) {\n throw new Error(\"cents must be non-negative.\");\n }\n\n const amount = c / CENTS_FACTOR;\n const remainder = c % CENTS_FACTOR;\n\n // Always pad remainder to 2 digits\n return `${amount.toString()}.${remainder.toString().padStart(TWO_DECIMAL_PLACES, \"0\")}`;\n}\n\n/**\n * @param cents\n * @param currency\n * @returns {string}\n */\nexport function currencyAmountFromCents(cents, currency = \"USD\") {\n if (typeof cents !== \"number\" || !Number.isInteger(cents)) {\n throw new Error(\"cents must be an integer number\");\n }\n\n const amount = amountFromCents(cents); // \"12.34\"\n const symbol = CURRENCY_SYMBOL[currency] ?? \"$\";\n return `${symbol}${amount}`;\n}\n\n/**\n * Converts a price string into cents.\n * @param {string} priceString - The price (e.g., $0.30).\n * @returns {number} - The amount converted to cents (e.g., 30).\n */\nexport const parsePrice = (priceString) => {\n if (priceString == null) throw new Error(\"priceString is required\");\n\n let s = String(priceString).trim();\n\n // Reject negatives explicitly (per your requirement).\n if (s.includes(\"-\")) throw new Error(\"Negative amounts are not allowed\");\n\n // Keep only digits and separators. Remove currency symbols/letters/spaces.\n s = s.replace(/[^\\d.,]/g, \"\");\n if (!s) throw new Error(`Invalid price: \"${priceString}\"`);\n\n // Delegate exact cents conversion (no floats)\n return amountToCents(s); // <- your safe BigInt cents converter\n};\n\n/**\n * Formats a discount value in BPS or CENTS to string.\n * @param {number} amount - The discount in BPS or CENTS(e.g., 300 = 3%).\n * @param {string} type - The discount type: \"Amount\" or \"Rate\".\n * @returns {string} - The discount converted to string (e.g., $5).\n */\nexport const formatDiscount = (amount, type) => {\n if (type === DISCOUNT_TYPES.AMOUNT) return currencyAmountFromCents(amount);\n if (type === DISCOUNT_TYPES.RATE) return `${amount / BPS}%`; // transform from bps to percentage\n return \"\";\n};"],"names":["root","factory","exports","module","define","amd","this","CENTS_FACTOR","TWO_DECIMAL_PLACES","THREE_DECIMAL_PLACES","ONE_CENT","ZERO_INT","BPS","DISCOUNT_TYPES","AMOUNT","RATE","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","CURRENCY_SYMBOL","USD","EUR","GBP","CAD","AUD","NZD","CHF","ARS","BRL","MXN","amountToCents","amount","Error","s","String","trim","includes","replace","test","intPart","fracRaw","split","fracPadded","tenths","hundredths","thousandths","trailing","length","slice","hasTrailingNonZero","cents","BigInt","Number","amountFromCents","c","isSafeInteger","remainder","toString","padStart","currencyAmountFromCents","currency","isInteger","parsePrice","priceString","formatDiscount","type"],"sourceRoot":""}