@remoteoss/remote-flows 0.4.0-alpha.23 → 0.4.0-alpha.25
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/dist/{chunk-6FUTHZBX.js → chunk-2XB53D4F.js} +2 -2
- package/dist/chunk-3M333MY5.js +2 -0
- package/dist/chunk-3M333MY5.js.map +1 -0
- package/dist/{chunk-WZWDJQGI.js → chunk-3WYWTW4W.js} +2 -2
- package/dist/chunk-44JKZZZV.js +2 -0
- package/dist/chunk-44JKZZZV.js.map +1 -0
- package/dist/{chunk-GRK5LUBM.js → chunk-567T665F.js} +2 -2
- package/dist/{chunk-5SMMQQXP.js → chunk-5B53X4DT.js} +2 -2
- package/dist/chunk-6ID67VGK.js +2 -0
- package/dist/chunk-6ID67VGK.js.map +1 -0
- package/dist/{chunk-LFIQVLFK.js → chunk-7OSCQBDL.js} +2 -2
- package/dist/{chunk-O53436KO.js → chunk-AKU36YUJ.js} +2 -2
- package/dist/{chunk-3F2RSIAI.js → chunk-EH6WUYWI.js} +2 -2
- package/dist/{chunk-CEIK7DGY.js → chunk-EMHT7AC4.js} +2 -2
- package/dist/{chunk-VNKOWY72.js → chunk-FBH65XSW.js} +2 -2
- package/dist/chunk-G42IXTZ3.js +2 -0
- package/dist/{chunk-MH6KKP6K.js.map → chunk-G42IXTZ3.js.map} +1 -1
- package/dist/{chunk-LPR2D3EY.js → chunk-GD4APSHD.js} +2 -2
- package/dist/chunk-GFLZSZAF.js +2 -0
- package/dist/chunk-GFLZSZAF.js.map +1 -0
- package/dist/chunk-IWLUIA2A.js +2 -0
- package/dist/chunk-IWLUIA2A.js.map +1 -0
- package/dist/chunk-IY36VL6X.js +2 -0
- package/dist/chunk-IY36VL6X.js.map +1 -0
- package/dist/{chunk-FCHRSRS6.js → chunk-KF5IZAQU.js} +2 -2
- package/dist/{chunk-ISOKYXYN.js → chunk-LNSNU5VV.js} +2 -2
- package/dist/{chunk-3QGKRPQ6.js → chunk-NLXC2OSJ.js} +2 -2
- package/dist/{chunk-CSU6IQX3.js → chunk-OQKQUCGJ.js} +2 -2
- package/dist/{chunk-3R33SVSF.js → chunk-Q6A3J2B2.js} +2 -2
- package/dist/{chunk-SIC7BRJ2.js → chunk-R4TFRFNH.js} +2 -2
- package/dist/{chunk-DOLJU76M.js → chunk-RUH3T5ZK.js} +2 -2
- package/dist/{chunk-GUDE6UZG.js → chunk-TDUDSH4U.js} +2 -2
- package/dist/{chunk-TNF6DNGM.js → chunk-VGRDSBNH.js} +2 -2
- package/dist/{chunk-63BYEK44.js → chunk-W4ICTAPC.js} +2 -2
- package/dist/{chunk-63BYEK44.js.map → chunk-W4ICTAPC.js.map} +1 -1
- package/dist/{chunk-7ORG2D7Q.js → chunk-Y7WTP3MZ.js} +2 -2
- package/dist/{chunk-TNN2CUZ5.js → chunk-ZBVJJCAF.js} +2 -2
- package/dist/flows/ContractAmendment/ContractAmendmentConfirmationForm.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentFlow.js +1 -1
- package/dist/flows/ContractAmendment/ContractAmendmentForm.js +1 -1
- package/dist/flows/ContractAmendment/hooks.js +1 -1
- package/dist/flows/ContractAmendment/index.js +1 -1
- package/dist/flows/ContractAmendment/utils.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorFlow.d.ts +6 -2
- package/dist/flows/CostCalculator/CostCalculatorFlow.js +1 -1
- package/dist/flows/CostCalculator/CostCalculatorForm.js +1 -1
- package/dist/flows/CostCalculator/components/SalaryField.d.ts +2 -2
- package/dist/flows/CostCalculator/components/SalaryField.js +1 -1
- package/dist/flows/CostCalculator/context.d.ts +2 -2
- package/dist/flows/CostCalculator/hooks.d.ts +4 -2
- package/dist/flows/CostCalculator/hooks.js +1 -1
- package/dist/flows/CostCalculator/index.d.ts +2 -2
- package/dist/flows/CostCalculator/index.js +1 -1
- package/dist/flows/CostCalculator/utils.d.ts +6 -3
- package/dist/flows/CostCalculator/utils.js +1 -1
- package/dist/flows/Onboarding/OnboardingFlow.d.ts +2 -2
- package/dist/flows/Onboarding/OnboardingFlow.js +1 -1
- package/dist/flows/Onboarding/api.d.ts +16 -1
- package/dist/flows/Onboarding/api.js +1 -1
- package/dist/flows/Onboarding/components/AnnualGrossSalary.d.ts +2 -2
- package/dist/flows/Onboarding/components/AnnualGrossSalary.js +1 -1
- package/dist/flows/Onboarding/components/BasicInformationStep.js +1 -1
- package/dist/flows/Onboarding/components/BenefitsStep.d.ts +2 -2
- package/dist/flows/Onboarding/components/BenefitsStep.js +1 -1
- package/dist/flows/Onboarding/components/ContractDetailsStep.js +1 -1
- package/dist/flows/Onboarding/components/OnboardingForm.d.ts +2 -2
- package/dist/flows/Onboarding/components/OnboardingForm.js +1 -1
- package/dist/flows/Onboarding/components/OnboardingInvite.js +1 -1
- package/dist/flows/Onboarding/components/SelectCountryStep.js +1 -1
- package/dist/flows/Onboarding/context.d.ts +4 -0
- package/dist/flows/Onboarding/hooks.d.ts +4 -0
- package/dist/flows/Onboarding/hooks.js +1 -1
- package/dist/flows/Onboarding/index.d.ts +3 -3
- package/dist/flows/Onboarding/index.js +1 -1
- package/dist/flows/Termination/AdditionalDetailsForm.js +1 -1
- package/dist/flows/Termination/EmployeeComunicationForm.js +1 -1
- package/dist/flows/Termination/PaidTimeOffForm.js +1 -1
- package/dist/flows/Termination/TerminationDetailsForm.js +1 -1
- package/dist/flows/Termination/TerminationFlow.js +1 -1
- package/dist/flows/Termination/TerminationForm.js +1 -1
- package/dist/flows/Termination/hooks.js +1 -1
- package/dist/flows/Termination/index.js +1 -1
- package/dist/flows/utils.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{remoteFlows-DFkKjnDe.d.ts → remoteFlows-DsgyOm1z.d.ts} +8 -2
- package/dist/types-Zg1n_9wh.d.ts +3 -0
- package/package.json +1 -1
- package/dist/chunk-3BIRQAED.js +0 -2
- package/dist/chunk-3BIRQAED.js.map +0 -1
- package/dist/chunk-B5XJZREX.js +0 -2
- package/dist/chunk-B5XJZREX.js.map +0 -1
- package/dist/chunk-FA22YPJ4.js +0 -2
- package/dist/chunk-FA22YPJ4.js.map +0 -1
- package/dist/chunk-J2Y3OXRR.js +0 -2
- package/dist/chunk-J2Y3OXRR.js.map +0 -1
- package/dist/chunk-MEIQ6TJG.js +0 -2
- package/dist/chunk-MEIQ6TJG.js.map +0 -1
- package/dist/chunk-MH6KKP6K.js +0 -2
- package/dist/chunk-Y4BVRS3T.js +0 -2
- package/dist/chunk-Y4BVRS3T.js.map +0 -1
- package/dist/types-CxSFjQw5.d.ts +0 -3
- /package/dist/{chunk-6FUTHZBX.js.map → chunk-2XB53D4F.js.map} +0 -0
- /package/dist/{chunk-WZWDJQGI.js.map → chunk-3WYWTW4W.js.map} +0 -0
- /package/dist/{chunk-GRK5LUBM.js.map → chunk-567T665F.js.map} +0 -0
- /package/dist/{chunk-5SMMQQXP.js.map → chunk-5B53X4DT.js.map} +0 -0
- /package/dist/{chunk-LFIQVLFK.js.map → chunk-7OSCQBDL.js.map} +0 -0
- /package/dist/{chunk-O53436KO.js.map → chunk-AKU36YUJ.js.map} +0 -0
- /package/dist/{chunk-3F2RSIAI.js.map → chunk-EH6WUYWI.js.map} +0 -0
- /package/dist/{chunk-CEIK7DGY.js.map → chunk-EMHT7AC4.js.map} +0 -0
- /package/dist/{chunk-VNKOWY72.js.map → chunk-FBH65XSW.js.map} +0 -0
- /package/dist/{chunk-LPR2D3EY.js.map → chunk-GD4APSHD.js.map} +0 -0
- /package/dist/{chunk-FCHRSRS6.js.map → chunk-KF5IZAQU.js.map} +0 -0
- /package/dist/{chunk-ISOKYXYN.js.map → chunk-LNSNU5VV.js.map} +0 -0
- /package/dist/{chunk-3QGKRPQ6.js.map → chunk-NLXC2OSJ.js.map} +0 -0
- /package/dist/{chunk-CSU6IQX3.js.map → chunk-OQKQUCGJ.js.map} +0 -0
- /package/dist/{chunk-3R33SVSF.js.map → chunk-Q6A3J2B2.js.map} +0 -0
- /package/dist/{chunk-SIC7BRJ2.js.map → chunk-R4TFRFNH.js.map} +0 -0
- /package/dist/{chunk-DOLJU76M.js.map → chunk-RUH3T5ZK.js.map} +0 -0
- /package/dist/{chunk-GUDE6UZG.js.map → chunk-TDUDSH4U.js.map} +0 -0
- /package/dist/{chunk-TNF6DNGM.js.map → chunk-VGRDSBNH.js.map} +0 -0
- /package/dist/{chunk-7ORG2D7Q.js.map → chunk-Y7WTP3MZ.js.map} +0 -0
- /package/dist/{chunk-TNN2CUZ5.js.map → chunk-ZBVJJCAF.js.map} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{m as D}from"./chunk-3M333MY5.js";import{a as P}from"./chunk-N6NYXAXH.js";import{b as W}from"./chunk-3ZWDIEEM.js";import{a as t,b as c,c as xe}from"./chunk-P37U34EQ.js";var k=c((Ct,_)=>{"use strict";function he(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}t(he,"isObject");_.exports=he});var H=c((xt,B)=>{"use strict";var Se=typeof global=="object"&&global&&global.Object===Object&&global;B.exports=Se});var M=c((ht,A)=>{"use strict";var je=H(),Oe=typeof self=="object"&&self&&self.Object===Object&&self,Ee=je||Oe||Function("return this")();A.exports=Ee});var J=c((St,G)=>{"use strict";var qe=M(),Fe=t(function(){return qe.Date.now()},"now");G.exports=Fe});var V=c((Ot,U)=>{"use strict";var Re=/\s/;function Ie(e){for(var n=e.length;n--&&Re.test(e.charAt(n)););return n}t(Ie,"trimmedEndIndex");U.exports=Ie});var z=c((qt,X)=>{"use strict";var Pe=V(),ke=/^\s+/;function Me(e){return e&&e.slice(0,Pe(e)+1).replace(ke,"")}t(Me,"baseTrim");X.exports=Me});var w=c((Rt,K)=>{"use strict";var we=M(),Ne=we.Symbol;K.exports=Ne});var ee=c((It,Z)=>{"use strict";var Q=w(),Y=Object.prototype,Le=Y.hasOwnProperty,$e=Y.toString,x=Q?Q.toStringTag:void 0;function We(e){var n=Le.call(e,x),o=e[x];try{e[x]=void 0;var s=!0}catch{}var a=$e.call(e);return s&&(n?e[x]=o:delete e[x]),a}t(We,"getRawTag");Z.exports=We});var ne=c((kt,te)=>{"use strict";var De=Object.prototype,_e=De.toString;function Be(e){return _e.call(e)}t(Be,"objectToString");te.exports=Be});var se=c((wt,ie)=>{"use strict";var re=w(),He=ee(),Ae=ne(),Ge="[object Null]",Je="[object Undefined]",oe=re?re.toStringTag:void 0;function Ue(e){return e==null?e===void 0?Je:Ge:oe&&oe in Object(e)?He(e):Ae(e)}t(Ue,"baseGetTag");ie.exports=Ue});var ce=c((Lt,ae)=>{"use strict";function Ve(e){return e!=null&&typeof e=="object"}t(Ve,"isObjectLike");ae.exports=Ve});var fe=c((Wt,ue)=>{"use strict";var Xe=se(),ze=ce(),Ke="[object Symbol]";function Qe(e){return typeof e=="symbol"||ze(e)&&Xe(e)==Ke}t(Qe,"isSymbol");ue.exports=Qe});var pe=c((_t,me)=>{"use strict";var Ye=z(),le=k(),Ze=fe(),de=NaN,et=/^[-+]0x[0-9a-f]+$/i,tt=/^0b[01]+$/i,nt=/^0o[0-7]+$/i,rt=parseInt;function ot(e){if(typeof e=="number")return e;if(Ze(e))return de;if(le(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=le(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Ye(e);var o=tt.test(e);return o||nt.test(e)?rt(e.slice(2),o?2:8):et.test(e)?de:+e}t(ot,"toNumber");me.exports=ot});var ve=c((Ht,be)=>{"use strict";var it=k(),N=J(),ge=pe(),st="Expected a function",at=Math.max,ct=Math.min;function ut(e,n,o){var s,a,l,u,i,m,d=0,S=!1,p=!1,b=!0;if(typeof e!="function")throw new TypeError(st);n=ge(n)||0,it(o)&&(S=!!o.leading,p="maxWait"in o,l=p?at(ge(o.maxWait)||0,n):l,b="trailing"in o?!!o.trailing:b);function y(r){var f=s,g=a;return s=a=void 0,d=r,u=e.apply(g,f),u}t(y,"invokeFunc");function j(r){return d=r,i=setTimeout(v,n),S?y(r):u}t(j,"leadingEdge");function O(r){var f=r-m,g=r-d,q=n-f;return p?ct(q,l-g):q}t(O,"remainingWait");function C(r){var f=r-m,g=r-d;return m===void 0||f>=n||f<0||p&&g>=l}t(C,"shouldInvoke");function v(){var r=N();if(C(r))return E(r);i=setTimeout(v,O(r))}t(v,"timerExpired");function E(r){return i=void 0,b&&s?y(r):(s=a=void 0,u)}t(E,"trailingEdge");function R(){i!==void 0&&clearTimeout(i),d=0,s=m=a=i=void 0}t(R,"cancel");function I(){return i===void 0?u:E(N())}t(I,"flush");function T(){var r=N(),f=C(r);if(s=arguments,a=this,m=r,f){if(i===void 0)return j(m);if(p)return clearTimeout(i),i=setTimeout(v,n),y(m)}return i===void 0&&(i=setTimeout(v,n)),u}return t(T,"debounced"),T.cancel=R,T.flush=I,T}t(ut,"debounce");be.exports=ut});import{useState as dt,useCallback as mt,useEffect as pt,useRef as gt}from"react";import{useFormContext as bt}from"react-hook-form";var Ce=xe(ve(),1);import{useCallback as ft,useEffect as lt,useRef as ye}from"react";function L(e,n){let o=ye(e);lt(()=>{o.current=e},[e]);let s=ye((0,Ce.default)(a=>{o.current(a)},n)).current;return ft(a=>{s(a)},[s])}t(L,"useDebounce");import{Fragment as yt,jsx as h,jsxs as Te}from"react/jsx-runtime";var vt=t(({description:e,showConversion:n,targetCurrency:o,className:s,onClick:a})=>{let{components:l}=W(),u=n?`Hide ${o} conversion`:`Show ${o} conversion`,i=l?.button;return Te("span",{className:s,children:[e," ",i?h(i,{className:`${s.replace("-description","-button")}`,"data-type":"inline",onClick:a,children:u}):h("button",{className:`${s.replace("-description","-button")}`,onClick:a,children:u})]})},"DescriptionWithConversion"),en=t(({sourceCurrency:e,targetCurrency:n,conversionFieldName:o,conversionProperties:s,classNamePrefix:a,description:l,...u})=>{let[i,m]=dt(!1),{setValue:d,watch:S}=bt(),p=S(u.name),b=gt(!0),y=e&&n&&e!==n,{mutateAsync:j}=D();pt(()=>{if(b.current){b.current=!1;return}d(o,"")},[e,o,d]);let O=mt(async(r,f,g,q)=>{if(r)try{let F=await j({source_currency:f,target_currency:g,amount:Number(r)});if(F.data?.data?.conversion_data?.target_amount){let $=F.data.data.conversion_data.target_amount;$&&d(q,$?.toString())}}catch(F){console.error("Error converting currency:",F)}},[j,d]),C=L(r=>O(r,e,n,o),500),v=L(r=>O(r,n,e,u.name),500),E=t(r=>{i&&C(r.target.value)},"handleMainFieldChange"),R=t(r=>{v(r.target.value)},"handleConversionFieldChange"),I=t(r=>{r.preventDefault(),m(f=>!f),!i&&p&&C(p)},"toggleConversion"),T=y?h(vt,{targetCurrency:n,description:l,showConversion:i,className:`${a}-description`,onClick:I}):l;return Te(yt,{children:[h(P,{...u,additionalProps:{currency:e},description:T,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$",onChange:E}),i&&h(P,{additionalProps:{currency:n},name:o,label:s?.label||"Conversion",description:s?.description,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$",onChange:R})]})},"CurrencyConversionField");export{en as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IWLUIA2A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/lodash/isObject.js","../node_modules/lodash/_freeGlobal.js","../node_modules/lodash/_root.js","../node_modules/lodash/now.js","../node_modules/lodash/_trimmedEndIndex.js","../node_modules/lodash/_baseTrim.js","../node_modules/lodash/_Symbol.js","../node_modules/lodash/_getRawTag.js","../node_modules/lodash/_objectToString.js","../node_modules/lodash/_baseGetTag.js","../node_modules/lodash/isObjectLike.js","../node_modules/lodash/isSymbol.js","../node_modules/lodash/toNumber.js","../node_modules/lodash/debounce.js","../src/components/form/fields/CurrencyConversionField.tsx","../src/common/hooks.ts"],"sourcesContent":["/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && baseGetTag(value) == symbolTag);\n}\n\nmodule.exports = isSymbol;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","import { ReactNode, useState, useCallback, useEffect, useRef } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { TextField } from '@/src/components/form/fields/TextField';\nimport { useConvertCurrency } from '@/src/flows/Onboarding/api';\nimport { JSFField } from '@/src/types/remoteFlows';\nimport { useFormFields } from '@/src/context';\nimport { useDebounce } from '@/src/common/hooks';\n\ntype DescriptionWithConversionProps = {\n description: ReactNode;\n showConversion: boolean;\n targetCurrency: string;\n className: string;\n onClick: (evt: React.MouseEvent<HTMLButtonElement>) => void;\n};\n\nconst DescriptionWithConversion = ({\n description,\n showConversion,\n targetCurrency,\n className,\n onClick,\n}: DescriptionWithConversionProps) => {\n const { components } = useFormFields();\n const label = showConversion\n ? `Hide ${targetCurrency} conversion`\n : `Show ${targetCurrency} conversion`;\n\n const CustomButton = components?.button;\n return (\n <span className={className}>\n {description}{' '}\n {CustomButton ? (\n <CustomButton\n className={`${className.replace('-description', '-button')}`}\n data-type=\"inline\"\n onClick={onClick}\n >\n {label}\n </CustomButton>\n ) : (\n <button\n className={`${className.replace('-description', '-button')}`}\n onClick={onClick}\n >\n {label}\n </button>\n )}\n </span>\n );\n};\n\nexport type CurrencyConversionFieldProps = JSFField & {\n sourceCurrency: string;\n targetCurrency: string;\n conversionFieldName: string;\n conversionProperties?: {\n label?: string;\n description?: string;\n };\n useProxy?: boolean;\n classNamePrefix: string;\n};\n\nexport const CurrencyConversionField = ({\n sourceCurrency,\n targetCurrency,\n conversionFieldName,\n conversionProperties,\n classNamePrefix,\n description,\n ...props\n}: CurrencyConversionFieldProps) => {\n const [showConversion, setShowConversion] = useState(false);\n const { setValue, watch } = useFormContext();\n const fieldValue = watch(props.name);\n const isFirstRender = useRef(true);\n\n const canShowConversion =\n sourceCurrency && targetCurrency && sourceCurrency !== targetCurrency;\n\n const { mutateAsync: convertCurrency } = useConvertCurrency();\n\n useEffect(() => {\n if (isFirstRender.current) {\n isFirstRender.current = false;\n return;\n }\n\n // when source currency changes, reset the conversion field\n setValue(conversionFieldName, '');\n }, [sourceCurrency, conversionFieldName, setValue]);\n\n const convertCurrencyCallback = useCallback(\n async (\n value: string,\n fromCurrency: string,\n toCurrency: string,\n targetField: string,\n ) => {\n if (!value) return;\n\n try {\n const response = await convertCurrency({\n source_currency: fromCurrency,\n target_currency: toCurrency,\n amount: Number(value),\n });\n if (response.data?.data?.conversion_data?.target_amount) {\n const amount = response.data.data.conversion_data.target_amount;\n if (amount) {\n setValue(targetField, amount?.toString());\n }\n }\n } catch (error) {\n console.error('Error converting currency:', error);\n }\n },\n [convertCurrency, setValue],\n );\n\n const debouncedConvertCurrency = useDebounce(\n (value: string) =>\n convertCurrencyCallback(\n value,\n sourceCurrency,\n targetCurrency,\n conversionFieldName,\n ),\n 500,\n );\n const debouncedConvertCurrencyReverse = useDebounce(\n (value: string) =>\n convertCurrencyCallback(\n value,\n targetCurrency,\n sourceCurrency,\n props.name,\n ),\n 500,\n );\n\n const handleMainFieldChange = (evt: React.ChangeEvent<HTMLInputElement>) => {\n if (showConversion) {\n debouncedConvertCurrency(evt.target.value);\n }\n };\n\n const handleConversionFieldChange = (\n evt: React.ChangeEvent<HTMLInputElement>,\n ) => {\n debouncedConvertCurrencyReverse(evt.target.value);\n };\n\n const toggleConversion = (evt: React.MouseEvent<HTMLButtonElement>) => {\n evt.preventDefault();\n setShowConversion((prev) => !prev);\n\n if (!showConversion && fieldValue) {\n debouncedConvertCurrency(fieldValue);\n }\n };\n\n const extraDescription = canShowConversion ? (\n <DescriptionWithConversion\n targetCurrency={targetCurrency}\n description={description}\n showConversion={showConversion}\n className={`${classNamePrefix}-description`}\n onClick={toggleConversion}\n />\n ) : (\n description\n );\n\n return (\n <>\n <TextField\n {...props}\n additionalProps={{ currency: sourceCurrency }}\n description={extraDescription}\n type=\"text\"\n inputMode=\"decimal\"\n pattern=\"^[0-9.]*$\"\n onChange={handleMainFieldChange}\n />\n {showConversion && (\n <TextField\n additionalProps={{ currency: targetCurrency }}\n name={conversionFieldName}\n label={conversionProperties?.label || 'Conversion'}\n description={conversionProperties?.description}\n type=\"text\"\n inputMode=\"decimal\"\n pattern=\"^[0-9.]*$\"\n onChange={handleConversionFieldChange}\n />\n )}\n </>\n );\n};\n","import { useCallback, useEffect, useRef } from 'react';\nimport debounce from 'lodash/debounce';\n\nexport function useDebounce(\n callback: (value: string) => Promise<void>,\n delay: number,\n) {\n const callbackRef = useRef(callback);\n\n useEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n\n const debouncedFn = useRef(\n debounce((value: string) => {\n callbackRef.current(value);\n }, delay),\n ).current;\n\n return useCallback(\n (value: string) => {\n debouncedFn(value);\n },\n [debouncedFn],\n );\n}\n"],"mappings":"+KAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAyBA,SAASC,GAASC,EAAO,CACvB,IAAIC,EAAO,OAAOD,EAClB,OAAOA,GAAS,OAASC,GAAQ,UAAYA,GAAQ,WACvD,CAHSC,EAAAH,GAAA,YAKTD,EAAO,QAAUC,KC9BjB,IAAAI,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cACA,IAAIC,GAAa,OAAO,QAAU,UAAY,QAAU,OAAO,SAAW,QAAU,OAEpFD,EAAO,QAAUC,KCHjB,IAAAC,EAAAC,EAAA,CAAAC,GAAAC,IAAA,kBAAIC,GAAa,IAGbC,GAAW,OAAO,MAAQ,UAAY,MAAQ,KAAK,SAAW,QAAU,KAGxEC,GAAOF,IAAcC,IAAY,SAAS,aAAa,EAAE,EAE7DF,EAAO,QAAUG,KCRjB,IAAAC,EAAAC,EAAA,CAAAC,GAAAC,IAAA,kBAAIC,GAAO,IAkBPC,GAAMC,EAAA,UAAW,CACnB,OAAOF,GAAK,KAAK,IAAI,CACvB,EAFU,OAIVD,EAAO,QAAUE,KCtBjB,IAAAE,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cACA,IAAIC,GAAe,KAUnB,SAASC,GAAgBC,EAAQ,CAG/B,QAFIC,EAA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B,GACrBgB,EAAyBhB,CAAU,CAEvC,EAPyB,oBASnBwB,EAAmBrB,EACvB3B,EAACE,GAAA,CACC,eAAgBI,EAChB,YAAaF,EACb,eAAgBC,EAChB,UAAW,GAAGY,CAAe,eAC7B,QAAS6B,EACX,EAEA1C,EAGF,OACEH,GAAAF,GAAA,CACE,UAAAC,EAACiD,EAAA,CACE,GAAG/B,EACJ,gBAAiB,CAAE,SAAUJ,CAAe,EAC5C,YAAakC,EACb,KAAK,OACL,UAAU,UACV,QAAQ,YACR,SAAUL,EACZ,EACCtC,GACCL,EAACiD,EAAA,CACC,gBAAiB,CAAE,SAAU3C,CAAe,EAC5C,KAAMS,EACN,MAAOC,GAAsB,OAAS,aACtC,YAAaA,GAAsB,YACnC,KAAK,OACL,UAAU,UACV,QAAQ,YACR,SAAU6B,EACZ,GAEJ,CAEJ,EAxIuC","names":["require_isObject","__commonJSMin","exports","module","isObject","value","type","__name","require_freeGlobal","__commonJSMin","exports","module","freeGlobal","require_root","__commonJSMin","exports","module","freeGlobal","freeSelf","root","require_now","__commonJSMin","exports","module","root","now","__name","require_trimmedEndIndex","__commonJSMin","exports","module","reWhitespace","trimmedEndIndex","string","index","__name","require_baseTrim","__commonJSMin","exports","module","trimmedEndIndex","reTrimStart","baseTrim","string","__name","require_Symbol","__commonJSMin","exports","module","root","Symbol","require_getRawTag","__commonJSMin","exports","module","Symbol","objectProto","hasOwnProperty","nativeObjectToString","symToStringTag","getRawTag","value","isOwn","tag","unmasked","result","__name","require_objectToString","__commonJSMin","exports","module","objectProto","nativeObjectToString","objectToString","value","__name","require_baseGetTag","__commonJSMin","exports","module","Symbol","getRawTag","objectToString","nullTag","undefinedTag","symToStringTag","baseGetTag","value","__name","require_isObjectLike","__commonJSMin","exports","module","isObjectLike","value","__name","require_isSymbol","__commonJSMin","exports","module","baseGetTag","isObjectLike","symbolTag","isSymbol","value","__name","require_toNumber","__commonJSMin","exports","module","baseTrim","isObject","isSymbol","NAN","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","toNumber","value","other","isBinary","__name","require_debounce","__commonJSMin","exports","module","isObject","now","toNumber","FUNC_ERROR_TEXT","nativeMax","nativeMin","debounce","func","wait","options","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","invokeFunc","time","args","thisArg","__name","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","timeWaiting","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","useState","useCallback","useEffect","useRef","useFormContext","import_debounce","useCallback","useEffect","useRef","useDebounce","callback","delay","callbackRef","useRef","useEffect","debouncedFn","debounce","value","useCallback","__name","Fragment","jsx","jsxs","DescriptionWithConversion","__name","description","showConversion","targetCurrency","className","onClick","components","useFormFields","label","CustomButton","CurrencyConversionField","sourceCurrency","conversionFieldName","conversionProperties","classNamePrefix","props","setShowConversion","useState","setValue","watch","useFormContext","fieldValue","isFirstRender","useRef","canShowConversion","convertCurrency","useConvertCurrency","useEffect","convertCurrencyCallback","useCallback","value","fromCurrency","toCurrency","targetField","response","amount","error","debouncedConvertCurrency","useDebounce","debouncedConvertCurrencyReverse","handleMainFieldChange","evt","handleConversionFieldChange","toggleConversion","prev","extraDescription","TextField"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as Ae}from"./chunk-XO3JWN33.js";import{a as A}from"./chunk-N6NYXAXH.js";import{a as ye,b as B}from"./chunk-GEYFQVQI.js";import{b as C}from"./chunk-3ZWDIEEM.js";import{a as Be,b as x,c as k,d as P,e as N,f as R,g as D}from"./chunk-VNSF5IOL.js";import{e as He}from"./chunk-G42IXTZ3.js";import{a as d}from"./chunk-KPHSEIR3.js";import{a as o}from"./chunk-P37U34EQ.js";import{Fragment as Xo}from"react";import*as ze from"react";import*as te from"@radix-ui/react-checkbox";import{Check as Lt}from"lucide-react";import{jsx as he}from"react/jsx-runtime";var re=ze.forwardRef(({className:e,...t},r)=>he(te.Root,{ref:r,className:d("peer h-4 w-4 shrink-0 rounded-sm border border-input ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-checkbox data-[state=checked]:text-primary",e),...t,children:he(te.Indicator,{className:d("flex items-center justify-center text-current"),children:he(Lt,{className:"h-4 w-4"})})}));re.displayName=te.Root.displayName;import{useFormContext as Mt}from"react-hook-form";import{Fragment as $t,jsx as z,jsxs as ae}from"react/jsx-runtime";function ne({name:e,defaultValue:t,description:r,label:a,onChange:s,multiple:i,options:p,component:F,...v}){let{components:c}=C(),{control:m}=Mt(),f=o((l,n,g)=>{let u=g.value?[...g.value]:[];n?u.includes(l)||g.onChange([...u,l]):g.onChange(u.filter(y=>y!==l))},"handleCheckboxChange");return z(x,{control:m,name:e,defaultValue:t,render:({field:l,fieldState:n})=>{let g=F||c?.checkbox;if(g){let u={name:e,description:r,label:a,defaultValue:t,multiple:i,options:p,...v};return z(g,{field:{...l,onChange:o(y=>{if(i){let{checked:b,value:S}=y.target;f(S,b,l),s?.(b);return}l.onChange(y),s?.(y)},"onChange")},fieldState:n,fieldData:u})}return ae(k,{"data-field":e,className:d(`RemoteFlows__CheckBoxField__Item__${e}`),children:[z(N,{children:ae($t,{children:[p&&i?z(P,{children:a}):null,p&&i?p.map(u=>ae("div",{className:"flex space-x-2",children:[z(re,{id:u.value,onCheckedChange:y=>{f(u.value,y===!0,l),s?.(y,u.value)},checked:l.value?.includes(u.value),className:"RemoteFlows__CheckBox__Input"}),z(P,{htmlFor:u.value,className:"mb-0 RemoteFlows__CheckBox__Label",children:u.label})]},u.value)):ae("div",{className:"flex space-x-2",children:[z(re,{id:e,onCheckedChange:u=>{l.onChange(u),s?.(u)},checked:l.value,className:"RemoteFlows__CheckBox__Input"}),z(P,{htmlFor:e,className:"mb-0 RemoteFlows__CheckBox__Label",children:a})]})]})}),r&&z(R,{children:r}),n.error&&z(D,{})]})}})}o(ne,"CheckBoxField");import{CalendarIcon as At}from"lucide-react";import{useFormContext as zt}from"react-hook-form";import{ChevronLeft as Et,ChevronRight as Ht}from"lucide-react";import{DayPicker as Bt}from"react-day-picker";import{jsx as _e}from"react/jsx-runtime";function Oe({className:e,classNames:t,showOutsideDays:r=!0,...a}){return _e(Bt,{showOutsideDays:r,className:d("p-3",e),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",nav_button:d(ye({variant:"outline"}),"size-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-x-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:d("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md",a.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:d(ye({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start aria-selected:bg-primary aria-selected:text-primary-foreground",day_range_end:"day-range-end aria-selected:bg-primary aria-selected:text-primary-foreground",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:o(({className:s,...i})=>_e(Et,{className:d("size-4",s),...i}),"IconLeft"),IconRight:o(({className:s,...i})=>_e(Ht,{className:d("size-4",s),...i}),"IconRight")},...a})}o(Oe,"Calendar");import*as O from"@radix-ui/react-popover";import{jsx as ie}from"react/jsx-runtime";function se({...e}){return ie(O.Root,{"data-slot":"popover",...e})}o(se,"Popover");function le({...e}){return ie(O.Trigger,{"data-slot":"popover-trigger",...e})}o(le,"PopoverTrigger");function me({className:e,align:t="center",sideOffset:r=4,...a}){return ie(O.Portal,{children:ie(O.Content,{"data-slot":"popover-content",align:t,sideOffset:r,className:d("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...a})})}o(me,"PopoverContent");import{PopoverClose as Ot}from"@radix-ui/react-popover";import{format as Ve}from"date-fns";import{Fragment as Vt,jsx as W,jsxs as Ce}from"react/jsx-runtime";function Ge({description:e,label:t,name:r,minDate:a,onChange:s,component:i,...p}){let{components:F}=C(),{control:v}=zt();return W(x,{control:v,name:r,render:({field:c,fieldState:m})=>{let f=i||F?.date;if(f){let l={description:e,label:t,name:r,minDate:a,onChange:s,...p};return W(f,{field:{...c,onChange:o(n=>{c.onChange(n),s?.(n)},"onChange")},fieldState:m,fieldData:l})}return Ce(k,{"data-field":r,className:`flex flex-col RemoteFlows__DatePickerField__Item__${r}`,children:[W(P,{className:"RemoteFlows__DatePickerField__Label",children:t}),Ce(se,{children:[W(le,{asChild:!0,children:W(N,{children:W("div",{children:Ce(B,{type:"button",variant:"outline",className:d("w-full pl-3 text-left font-normal",!c.value&&"text-muted-foreground"),"data-testid":`date-picker-button-${r}`,children:[c.value&&W(Vt,{children:Ve(c.value,"yyyy-MM-dd")}),W(At,{className:"ml-auto h-4 w-4 opacity-50"})]})})})}),W(me,{className:"w-auto p-0 RemoteFlows__DatepickerField__PopoverContent",align:"start",children:W(Oe,{mode:"single",className:"RemoteFlows__DatepickerField__Calendar",selected:c.value?new Date(c.value):void 0,onSelect:l=>{c.onChange(l?Ve(l,"yyyy-MM-dd"):null),s?.(l)},defaultMonth:a?new Date(a):void 0,components:{DayContent:o(l=>W(Ot,{children:l.date.getDate()}),"DayContent")},...a&&{disabled:o(l=>l<new Date(a),"disabled")}})})]}),e?W(R,{children:e}):null,m.error&&W(D,{className:"RemoteFlows__DatePickerField__Error"})]})}})}o(Ge,"DatePickerField");import{cva as Gt}from"class-variance-authority";import{jsx as xe}from"react/jsx-runtime";var Ut=Gt("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-card bg-warning border-warning-border [&>svg]:text-current"}},defaultVariants:{variant:"default"}});function Ue({className:e,variant:t,...r}){return xe("div",{"data-slot":"alert",role:"alert",className:d(Ut({variant:t}),e),...r})}o(Ue,"Alert");function Je({className:e,...t}){return xe("div",{"data-slot":"alert-title",className:d("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}o(Je,"AlertTitle");function qe({className:e,...t}){return xe("div",{"data-slot":"alert-description",className:d("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}o(qe,"AlertDescription");import{AlertCircle as Jt}from"lucide-react";import{jsx as ce,jsxs as qt}from"react/jsx-runtime";function de({title:e,description:t,severity:r}){let{components:a}=C();if(a?.statement){let s=a?.statement;return ce(s,{data:{title:e,description:t,severity:r}})}return qt(Ue,{variant:"warning",children:[ce(Jt,{className:"h-4 w-4"}),e&&ce(Je,{children:e}),ce(qe,{children:t})]})}o(de,"Statement");import{useFormContext as Kt}from"react-hook-form";import{useEffect as Yt,useRef as Ke}from"react";import{jsx as pe,jsxs as Ye}from"react/jsx-runtime";import{createElement as Xt}from"react";function be({label:e,name:t,fields:r,description:a,components:s,statement:i,isFlatFieldset:p}){let{watch:F,trigger:v}=Kt(),c=r.map(({name:n})=>`${t}.${n}`),m=F(c),f=Ke(m),l=Ke(null);return Yt(()=>{let n=m,g=f.current,u=!1;for(let y=0;y<n.length;y++)if(n[y]!==void 0&&g[y]!==n[y]){u=!0;break}return u&&(l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{v()},50)),f.current=[...n],()=>{l.current&&clearTimeout(l.current)}},[m,v]),Ye("fieldset",{className:d("border-1 border-input p-4 rounded-xl",`RemoteFlows__FieldSetField__${t}`),children:[pe("legend",{className:"text-sm font-semibold px-2",children:e}),a?pe("div",{className:"mb-5 RemoteFlows__FieldSetField__Description",dangerouslySetInnerHTML:{__html:a}}):null,Ye("div",{className:"grid gap-4",children:[r.map(n=>{let g=oe[n.type];if(n.isVisible===!1||n.deprecated)return null;if(n.Component){let{Component:u}=n;return pe(u,{...n},n.name)}return Xt(g,{...n,key:n.name,name:`${p?n.name:`${t}.${n.name}`}`,component:s?.[n.type]})}),i?pe(de,{...i}):null]})]})}o(be,"FieldSetField");import{useFormContext as to}from"react-hook-form";import{useState as Qt,useRef as Zt}from"react";import{Upload as jt,X as eo}from"lucide-react";import{jsx as G,jsxs as Se}from"react/jsx-runtime";function Xe({onChange:e,className:t,multiple:r}){let[a,s]=Qt([]),i=Zt(null),p=o(c=>{c.preventDefault(),i.current?.click()},"handleClick"),F=o(c=>{if(c.target.files&&c.target.files.length>0){let m=Array.from(c.target.files);s(m),e(c)}},"handleChange"),v=o(c=>{s(m=>m.filter(f=>f!==c))},"onRemoveFile");return Se("div",{className:d("flex flex-col items-start gap-4",t),children:[G("input",{type:"file",ref:i,onChange:F,className:"hidden","aria-label":"File upload",multiple:r}),Se(B,{type:"button",onClick:p,className:"gap-2",children:[G(jt,{className:"h-4 w-4"}),"Choose File"]}),a.length===0&&G("div",{className:"text-sm",children:r?G("span",{className:"font-medium",children:"No files selected. You can select multiple files"}):G("span",{className:"font-medium",children:"No file selected."})}),a.length>0&&a.map((c,m)=>Se("div",{className:"text-sm flex items-center gap-2",children:["Selected file: ",G("span",{className:"font-medium",children:c.name})," (",Math.round(c.size/1024)," KB)",G(B,{variant:"ghost",onClick:()=>v(c),children:G(eo,{})})]},m))]})}o(Xe,"FileUploader");import{jsx as U,jsxs as ro}from"react/jsx-runtime";var oo=o(e=>new Promise((t,r)=>{let a=new FileReader;a.readAsDataURL(e),a.onload=()=>t(a.result),a.onerror=s=>r(s)}),"toBase64"),Qe=o(async e=>{let t=e.target.files?Array.from(e.target.files):[];return await Promise.all(t.map(async a=>{let s=await oo(a);return{name:a.name,content:s.split(",")[1]}}))},"convertFilesToBase64");function Ze({name:e,description:t,label:r,multiple:a,onChange:s,component:i,...p}){let{components:F}=C(),{control:v}=to();return U(x,{control:v,name:e,render:({field:c,fieldState:m})=>{let f=i||F?.file;if(f){let l={name:e,description:t,label:r,multiple:a,...p};return U(f,{field:{...c,value:null,onChange:o(async n=>{let g=await Qe(n);c.onChange(g),s?.(g)},"onChange")},fieldState:m,fieldData:l})}return ro(k,{"data-field":e,className:`RemoteFlows__FileUpload__Item__${e}`,children:[U(P,{className:"RemoteFlows__FileUpload__Label",children:r}),U(N,{children:U(Xe,{onChange:async l=>{let n=await Qe(l);c.onChange(n),s?.(n)},multiple:a,className:d("RemoteFlows__FileUpload__Input")})}),t&&U("div",{className:"flex items-center justify-between",children:U(R,{className:"RemoteFlows__FileUpload__Description",children:t})}),m.error&&U(D,{className:"RemoteFlows__FileUpload__Error"})]})}})}o(Ze,"FileUploadField");import{useFormContext as ao}from"react-hook-form";import{jsx as Pe}from"react/jsx-runtime";function ke(e){let{components:t}=C(),{control:r}=ao(),a=e.component||t?.number;return a?Pe(x,{control:r,name:e.name,render:({field:s,fieldState:i})=>Pe(a,{field:{...s,onChange:o(p=>{s.onChange(p),e.onChange?.(p)},"onChange")},fieldState:i,fieldData:e})}):Pe(A,{...e,type:"text",inputMode:"decimal",pattern:"^[0-9.]*$"})}o(ke,"NumberField");import*as X from"@radix-ui/react-radio-group";import{CircleIcon as no}from"lucide-react";import{jsx as ue}from"react/jsx-runtime";function je({className:e,...t}){return ue(X.Root,{"data-slot":"radio-group",className:d("grid gap-3",e),...t})}o(je,"RadioGroup");function et({className:e,...t}){return ue(X.Item,{"data-slot":"radio-group-item",className:d("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:ue(X.Indicator,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:ue(no,{className:"fill-radio absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}o(et,"RadioGroupItem");import{useFormContext as io}from"react-hook-form";import{Fragment as so,jsx as $,jsxs as Ne}from"react/jsx-runtime";function tt({name:e,defaultValue:t,description:r,label:a,options:s,onChange:i,component:p,...F}){let{components:v}=C(),{control:c}=io();return $(x,{control:c,name:e,defaultValue:t,render:({field:m,fieldState:f})=>{let l=p||v?.radio;if(l){let n={name:e,defaultValue:t,description:r,label:a,options:s,...F};return $(l,{field:{...m,onChange:o(g=>{m.onChange(g),i?.(g)},"onChange")},fieldState:f,fieldData:n})}return Ne(k,{className:d("space-y-3",`RemoteFlows__RadioGroupField__Item__${e}`),"data-field":e,children:[$(P,{children:a}),$(N,{children:$(je,{"aria-label":a||e,onValueChange:n=>{m.onChange(n),i?.(n)},value:m.value,className:"flex flex-col space-y-3",children:s?.map(n=>$(so,{children:Ne(k,{"data-field":e,className:"flex items-start space-x-3 space-y-0 gap-0 RemoteFlows__RadioField__Item",children:[$(N,{children:$(et,{value:n.value,className:"RemoteFlows__RadioField__Input"})}),Ne("div",{children:[$(P,{className:"font-normal mb-0 RemoteFlows__RadioField__Label",children:n.label}),n.description&&$(R,{className:"mt-2",children:n.description})]})]},n.value)}))})}),r&&$(R,{children:r}),f.error&&$(D,{})]})}})}o(tt,"RadioGroupField");import*as _ from"@radix-ui/react-select";import{CheckIcon as lo,ChevronDownIcon as ot,ChevronUpIcon as mo}from"lucide-react";import{jsx as w,jsxs as Re}from"react/jsx-runtime";function rt({...e}){return w(_.Root,{"data-slot":"select",...e})}o(rt,"Select");function at({...e}){return w(_.Group,{"data-slot":"select-group",...e})}o(at,"SelectGroup");function nt({...e}){return w(_.Value,{"data-slot":"select-value",...e})}o(nt,"SelectValue");function it({className:e,children:t,...r}){return Re(_.Trigger,{"data-slot":"select-trigger",className:d("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex w-full items-center justify-between rounded-xl border bg-transparent px-4 py-7 text-sm whitespace-nowrap transition-[color] outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","focus-visible:border-focused",e),...r,children:[t,w(_.Icon,{asChild:!0,className:"absolute right-4",children:w(ot,{className:"size-4"})})]})}o(it,"SelectTrigger");function st({className:e,children:t,position:r="popper",...a}){return w(_.Portal,{children:Re(_.Content,{"data-slot":"select-content",className:d("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...a,children:[w(co,{}),w(_.Viewport,{className:d(r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),w(po,{})]})})}o(st,"SelectContent");function lt({className:e,children:t,...r}){return Re(_.Item,{"data-slot":"select-item",className:d("focus:bg-accent focus:text-accent-foreground min-h-11 justify-between [&_svg:not([class*='text-'])]:text-muted-foreground flex w-full cursor-default items-center gap-2 py-2 px-4 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[w(_.ItemText,{children:t}),w("span",{className:"flex size-3.5 items-center justify-center",children:w(_.ItemIndicator,{children:w(lo,{className:"size-4"})})})]})}o(lt,"SelectItem");function co({className:e,...t}){return w(_.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:d("flex cursor-default items-center justify-center py-1",e),...t,children:w(mo,{className:"size-4"})})}o(co,"SelectScrollUpButton");function po({className:e,...t}){return w(_.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:d("flex cursor-default items-center justify-center py-1",e),...t,children:w(ot,{className:"size-4"})})}o(po,"SelectScrollDownButton");import{useFormContext as uo}from"react-hook-form";import{jsx as L,jsxs as mt}from"react/jsx-runtime";function ct({label:e,name:t,options:r,defaultValue:a,description:s,onChange:i,component:p,...F}){let{control:v}=uo(),{components:c}=C();return L(x,{defaultValue:a,control:v,name:t,render:({field:m,fieldState:f})=>{let l=p||c?.select;if(l){let n={label:e,name:t,options:r,defaultValue:a,description:s,onChange:i,...F};return L(l,{field:{...m,onChange:o(g=>{let u=!isNaN(Number(g))&&typeof g!="boolean"?Number(g):g;m.onChange(u),i?.(u)},"onChange")},fieldState:f,fieldData:n})}return mt(k,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[L(P,{className:"RemoteFlows__SelectField__Label",children:e}),L(N,{children:L("div",{className:"relative",children:mt(rt,{value:m.value||"",onValueChange:n=>{let g=!isNaN(Number(n))&&typeof n!="boolean"?Number(n):n;m.onChange(g),i?.(g)},children:[L(it,{className:"RemoteFlows__SelectField__Trigger","aria-invalid":!!f.error,"aria-label":e,children:L("span",{className:"absolute",children:L(nt,{placeholder:e})})}),L(st,{className:"RemoteFlows__SelectField__Content",children:L(at,{className:"RemoteFlows__SelectField__Group",children:r.map(n=>L(lt,{value:n.value,className:"RemoteFlows__SelectField__SelectItem",children:n.label},n.value))})})]})})}),s&&L(R,{children:s}),f.error&&L(D,{})]})}})}o(ct,"SelectField");import{useState as xo}from"react";import{useFormContext as bo}from"react-hook-form";import{Fragment as vo,useState as yo}from"react";import{Check as ho,ChevronDownIcon as _o,X as Co}from"lucide-react";import{Command as Q}from"cmdk";import{SearchIcon as ln}from"lucide-react";import*as T from"@radix-ui/react-dialog";import{XIcon as fo}from"lucide-react";import{jsx as V,jsxs as we}from"react/jsx-runtime";function De({...e}){return V(T.Root,{"data-slot":"dialog",...e})}o(De,"Dialog");function dt({...e}){return V(T.Trigger,{"data-slot":"dialog-trigger",...e})}o(dt,"DialogTrigger");function go({...e}){return V(T.Portal,{"data-slot":"dialog-portal",...e})}o(go,"DialogPortal");function Fo({className:e,...t}){return V(T.Overlay,{"data-slot":"dialog-overlay",className:d("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}o(Fo,"DialogOverlay");function Te({className:e,children:t,...r}){return we(go,{"data-slot":"dialog-portal",children:[V(Fo,{}),we(T.Content,{"data-slot":"dialog-content",className:d("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,we(T.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 RemoteFlows__Dialog__Close",children:[V(fo,{}),V("span",{className:"sr-only",children:"Close"})]})]})]})}o(Te,"DialogContent");function Ie({className:e,...t}){return V("div",{"data-slot":"dialog-header",className:d("flex flex-col gap-2 text-center sm:text-left",e),...t})}o(Ie,"DialogHeader");function We({className:e,...t}){return V(T.Title,{"data-slot":"dialog-title",className:d("text-lg leading-none font-semibold",e),...t})}o(We,"DialogTitle");import{jsx as Z,jsxs as pn}from"react/jsx-runtime";function pt({className:e,...t}){return Z(Q,{"data-slot":"command",className:d("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}o(pt,"Command");function ut({className:e,...t}){return Z(Q.List,{"data-slot":"command-list",className:d("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}o(ut,"CommandList");function ft({...e}){return Z(Q.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}o(ft,"CommandEmpty");function gt({className:e,...t}){return Z(Q.Group,{"data-slot":"command-group",className:d("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}o(gt,"CommandGroup");function Ft({className:e,...t}){return Z(Q.Separator,{"data-slot":"command-separator",className:d("bg-border -mx-1 h-px",e),...t})}o(Ft,"CommandSeparator");function vt({className:e,...t}){return Z(Q.Item,{"data-slot":"command-item",className:d("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}o(vt,"CommandItem");import{jsx as E,jsxs as j}from"react/jsx-runtime";function fe({options:e,selected:t,onChange:r,placeholder:a,...s}){let[i,p]=yo(!1),F=o(m=>{r(t.filter(f=>f.value!==m.value))},"handleUnselect"),v=e.some(m=>m.category),c=e.reduce((m,f)=>{let l=f.category||"Uncategorized";return m[l]||(m[l]=[]),m[l].push(f),m},{});return j(se,{open:i,onOpenChange:p,...s,children:[E(le,{children:j(B,{variant:"outline",role:"combobox","aria-expanded":i,className:"w-full justify-between font-normal",type:"button",children:[E("div",{className:"flex gap-1 flex-wrap overflow-x-auto max-h-[2.5rem] items-center",children:t.length>0?t.map(m=>j(Ae,{variant:"secondary",className:"mr-1 mb-1",children:[m.label,E("div",{role:"button",tabIndex:0,"aria-label":`remove ${m.label}`,className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",onKeyDown:f=>{f.key==="Enter"&&F(m)},onMouseDown:f=>{f.preventDefault(),f.stopPropagation()},onClick:()=>F(m),children:E(Co,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},m.label)):E("span",{className:"text-foreground",children:a})}),E(_o,{className:"size-4"})]})}),E(me,{align:"start",className:"w-full p-0",children:E(pt,{children:j(ut,{children:[E(ft,{children:"No item found."}),Object.entries(c).map(([m,f],l)=>j(vo,{children:[l>0&&E(Ft,{}),E(gt,{heading:v?m:void 0,children:f.map(n=>{let g=t.some(u=>u.value===n.value);return j(vt,{onSelect:()=>{r(g?t.filter(u=>u.value!==n.value):[...t,n])},children:[E(ho,{className:d("mr-2 h-4 w-4",g?"opacity-100":"opacity-0")}),n.label]},n.label)})})]},m))]})})})]})}o(fe,"MultiSelect");import{jsx as J,jsxs as So}from"react/jsx-runtime";function yt({label:e,name:t,options:r,defaultValue:a,description:s,onChange:i,$meta:p,component:F,...v}){let{control:c}=bo(),{components:m}=C(),[f,l]=xo([]);return J(x,{defaultValue:a,control:c,name:t,render:({field:n,fieldState:g})=>{let u=F||m?.countries;if(u){let S={label:e,name:t,options:r,defaultValue:a,description:s,onChange:i,$meta:p,...v};return J(u,{field:{...n,onChange:o(M=>{n.onChange(M),i?.(M)},"onChange")},fieldState:g,fieldData:S})}let y=[...Object.entries(p?.regions||{}).map(([S,M])=>({value:M,label:S,category:"Regions"})),...Object.entries(p?.subregions||{}).map(([S,M])=>({value:M,label:S,category:"Subregions"})),...r.map(S=>({...S,value:S.value,label:S.label,category:"Countries"}))],b=o(S=>{let M=S.map(({value:Wt})=>Wt);n.onChange(M),i?.(M),l(S)},"handleChange");return So(k,{"data-field":t,className:`RemoteFlows__CountryField__Item__${t}`,children:[J(P,{className:"RemoteFlows__CountryField__Label",children:e}),J(N,{children:J(fe,{options:y,selected:f,onChange:b,...v})}),s&&J(R,{children:s}),g.error&&J(D,{})]})}})}o(yt,"CountryField");import{useFormContext as ko}from"react-hook-form";import*as ht from"react";import{jsx as Po}from"react/jsx-runtime";var Le=ht.forwardRef(({className:e,...t},r)=>Po("textarea",{className:d("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...t}));Le.displayName="Textarea";import{jsx as q,jsxs as Me}from"react/jsx-runtime";function _t({name:e,description:t,label:r,onChange:a,maxLength:s,component:i,...p}){let{components:F}=C(),{control:v}=ko();return q(x,{control:v,name:e,render:({field:c,fieldState:m})=>{let f=i||F?.textarea;if(f){let n={name:e,description:t,label:r,maxLength:s,...p};return q(f,{field:{...c,onChange:o(g=>{c.onChange(g),a?.(g)},"onChange")},fieldState:m,fieldData:n})}let l=c.value?.length??0;return Me(k,{"data-field":e,className:`RemoteFlows__TextArea__Item__${e}`,children:[q(P,{className:"RemoteFlows__TextArea__Label",children:r}),q(N,{children:q(Le,{...c,value:c.value??"",onChange:n=>{c.onChange(n),a?.(n)},className:d(m.error&&"border-red-500 focus-visible:ring-red-500","RemoteFlows__TextArea__Input"),placeholder:r})}),(t||s)&&Me("div",{className:"flex items-center justify-between",children:[t&&q(R,{className:"RemoteFlows__TextArea__Description",children:t}),s&&Me("span",{className:"text-sm ml-auto RemoteFlows__TextArea__MaxLength",children:[l,"/",s]})]}),m.error&&q(D,{className:"RemoteFlows__TextArea__Error"})]})}})}o(_t,"TextAreaField");import{useFormContext as No}from"react-hook-form";import{jsx as $e}from"react/jsx-runtime";function Ct(e){let{components:t}=C(),{control:r}=No(),a=e.component||t?.email;return a?$e(x,{control:r,name:e.name,render:({field:s,fieldState:i})=>$e(a,{field:{...s,onChange:o(p=>{s.onChange(p),e.onChange?.(p)},"onChange")},fieldState:i,fieldData:e})}):$e(A,{...e,type:"email"})}o(Ct,"EmailField");import{useFormContext as Ro}from"react-hook-form";import{jsx as xt}from"react/jsx-runtime";function bt(e){let{control:t}=Ro();return xt(x,{control:t,name:e.name,render:({field:r})=>xt("input",{...r,type:"hidden"})})}o(bt,"HiddenField");import Lo,{useEffect as Mo,useState as Rt}from"react";import{yupResolver as $o}from"@hookform/resolvers/yup";import{useForm as Eo,useFormContext as Ho,useFieldArray as Bo}from"react-hook-form";import*as I from"yup";import St from"lodash.groupby";import ee from"lodash.capitalize";var Pt=60,ge=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function wo(e){if(e<60)return`${e}m`;let t=Math.floor(e/Pt),r=e%Pt;return r>0?`${t}h${r}m`:`${t}h`}o(wo,"convertBreakDurationToHours");function kt(e){let t=e.reduce((r,a)=>a.hours+r,0);return Number(t.toFixed(2))}o(kt,"calculateTotalWorkHours");function Do(e,t){let r=t.map(({day:i})=>i.toLowerCase()),a=r.indexOf(e),s=null;for(;a<r.length&&!s;){let i=r[a],p=r[a+1],F=ge.indexOf(i)+1;ge[F]===p||(s=i),a+=1}return s}o(Do,"findLastConsecutiveDay");function To(e){return e.start_time&&e.end_time&&(typeof e.hours=="number"?e.hours:Number.parseInt(e.hours))>0}o(To,"shouldSummarizeSchedule");function Io(e){return Number.parseInt(e.break_duration_minutes)>0}o(Io,"shouldSummarizeBreaks");function Nt(e){let t=e.filter(To),r=St(t,F=>`${F.start_time}|${F.end_time}`),a=e.filter(Io),s=St(a,"break_duration_minutes"),i=Object.keys(r).map(F=>{let v=r[F],c=v[0].day,[m,f]=F.split("|"),l=`from <span>${m.replace(":","h")}</span> to <span>${f.replace(":","h")}</span>`,n=Do(c,v),u=(n?v.findIndex(y=>y.day===n):-1)===v.length-1;return v.length===1?`${ee(c)}, ${l}`:!u||!n?v.reduce((y,b,S)=>{let M=ee(b.day);return S===v.length-1?`${y}and ${M}, ${l}`:`${y}<span>${M}</span>, `},""):`<span>${ee(c)}</span> to <span>${ee(n)}</span>, ${l}`}),p=Object.keys(s).reverse().map((F,v)=>{let c=v===0,m=s[F],f=wo(parseInt(F,10));if(Object.keys(s).length===1)return`With ${f} daily breaks`;if(m.length===1){let l=`${f} break on ${ee(m[0].day)}.`;return c?`With ${l}`:l}return m.reduce((l,n,g)=>{let u=ee(n.day);return g===0?`${l} ${u}`:g===m.length-1?`${l}, and ${u}.`:`${l}, ${u}`},c?`With ${f} break on`:`${f} break on`)});return{workHoursSummary:i,breakSummary:p}}o(Nt,"buildWorkScheduleSummary");function Ee(e){let{checked:t,start_time:r,end_time:a,break_duration_minutes:s}=e;if(!t)return 0;let[i,p]=r.split(":").map(Number),[F,v]=a.split(":").map(Number),c=i*60+p,l=(F*60+v-c-Number.parseInt(s||"0"))/60;return l===Math.floor(l)?l:Number(l.toFixed(2))}o(Ee,"calculateHours");var Wo={monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat",sunday:"Sun"};function Fe(e){return Wo[e]}o(Fe,"getShortWeekday");import{jsx as h,jsxs as H}from"react/jsx-runtime";var Ao=I.object({day:I.string().required(),checked:I.boolean().required(),start_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:o(e=>e.required("Required"),"then"),otherwise:o(e=>e.optional().nullable(),"otherwise")}),end_time:I.string().matches(/^([01]\d|2[0-3]):([0-5]\d)$/,"Invalid time format (HH:mm)").when("checked",{is:!0,then:o(e=>e.required("Required"),"then"),otherwise:o(e=>e.optional().nullable(),"otherwise")}),hours:I.number().default(0),break_duration_minutes:I.string().default("0")}),zo=I.object({schedule:I.array(Ao)});function Oo({defaultSchedule:e,onSubmit:t}){let[r,a]=Rt(!1),s=ge.map(u=>{let y=e.find(b=>b.day.toLowerCase()===Fe(u).toLowerCase()||b.day.toLowerCase()===u.toLowerCase());return y?{...y,day:Fe(u),checked:!0}:{...e[0],checked:!1,day:Fe(u)}}),i=Eo({defaultValues:{schedule:s},resolver:$o(zo)}),{handleSubmit:p,watch:F,reset:v,control:c,formState:m}=i,{fields:f}=Bo({name:"schedule",control:c}),l=F("schedule");function n(u){let y=u.schedule.filter(({checked:b})=>b).map(b=>({...b,hours:Ee(b)}));t(y),a(!1)}o(n,"handleSubmitWorkingHours");function g(){v(),a(!1)}return o(g,"handleCancel"),h("div",{className:"flex items-center justify-between",children:H(De,{open:r,onOpenChange:a,children:[h(dt,{asChild:!0,children:h(B,{variant:"link",className:"flex items-center p-0 RemoteFlows__WorkScheduleSelectionForm__Trigger",children:"Edit Schedule"})}),H(Te,{className:"max-w-5xl max-h-[90vh] overflow-y-auto px-8 py-4 RemoteFlows__WorkScheduleSelectionForm__Content",children:[h(Ie,{children:h(We,{className:"RemoteFlows__WorkScheduleSelectionForm__Title",children:"Edit employee working hours"})}),h(Be,{...i,children:H("form",{className:"space-y-4 RemoteFlows__WorkScheduleSelectionForm__Form",children:[H("div",{className:"rounded-lg",children:[h("p",{className:"text-gray-600 text-sm mb-4 RemoteFlows__WorkScheduleSelectionForm__Description",children:"The times displayed are in the employee's time zone in the 24-hour format."}),H("div",{className:"grid grid-cols-12 gap-4 text-sm font-medium text-gray-500 uppercase tracking-wide RemoteFlows__WorkScheduleSelectionForm__Header",children:[h("div",{className:"col-span-2"}),h("div",{className:"col-span-3 text-center",children:"START"}),h("div",{className:"col-span-1 text-center"}),h("div",{className:"col-span-3 text-center",children:"END"}),h("div",{className:"col-span-2 text-center",children:"HOURS"})]}),h("div",{className:"RemoteFlows__WorkScheduleSelectionForm__Rows",children:f.map((u,y)=>{let b=l[y],S=Ee(b);return H(Lo.Fragment,{children:[H("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Hours",children:[h("div",{className:"col-span-2 flex items-center gap-3",children:h(ne,{label:u.day,name:`schedule.${y}.checked`})}),h("div",{className:"col-span-3",children:h(A,{name:`schedule.${y}.start_time`,includeErrorMessage:!1})}),h("div",{className:"col-span-1 text-center text-gray-500",children:"to"}),h("div",{className:"col-span-3",children:h(A,{name:`schedule.${y}.end_time`,includeErrorMessage:!1})}),h("div",{className:"col-span-2 text-center text-gray-600",children:isNaN(S)?"-":`${S} hours`})]}),H("div",{className:"grid grid-cols-12 gap-4 items-center py-2 RemoteFlows__WorkScheduleSelectionForm__Row-Break",children:[h("div",{className:"col-span-2 text-gray-500",children:"Break"}),h("div",{className:"col-span-2",children:h(A,{name:`schedule.${y}.break_duration_minutes`,includeErrorMessage:!1})}),h("div",{className:"col-span-2 text-gray-500",children:"minutes"}),h("div",{className:"col-span-4"})]})]},u.id)})})]}),Object.keys(m.errors).length>0&&h("p",{className:"text-destructive text-sm mb-0",children:"Invalid time format (HH:mm)"}),H("div",{className:"flex gap-4 pt-4",children:[h(B,{type:"button",className:"reset-button",variant:"outline",onClick:g,children:"Cancel"}),h(B,{type:"button",className:"submit-button",onClick:p(n),children:"Save Schedule"})]})]})})]})]})})}o(Oo,"WorkScheduleSelectionForm");function wt(e){let{components:t}=C(),{setValue:r,control:a,watch:s}=Ho(),i=s(e.name),[p,F]=Rt(i),{workHoursSummary:v,breakSummary:c}=Nt(p),m=kt(p);Mo(()=>{r(e.name,p)},[p,e.name,r]);function f(n){F(n)}o(f,"onSubmit");let l=e.component||t?.["work-schedule"];return l?h(x,{control:a,name:e.name,render:({field:n,fieldState:g})=>h(l,{field:{...n,onChange:o(u=>{n.onChange(u),e.onChange?.(u)},"onChange")},fieldState:g,fieldData:{...e,defaultFormattedValue:{workHoursSummary:v,breakSummary:c,totalWorkHours:m}}})}):H("div",{className:"flex flex-col gap-3 RemoteFlows__WorkScheduleField",children:[h("p",{className:"text-sm RemoteFlows__WorkScheduleField__Title",children:"Work hours"}),H("div",{className:"flex flex-col gap-1 RemoteFlows__WorkScheduleField__Summary",children:[h("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__WorkHours",dangerouslySetInnerHTML:{__html:v.join(", ")}}),h("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Break",children:c.join()}),H("p",{className:"text-sm text-gray-500 RemoteFlows__WorkScheduleField__Summary__Total",children:["Total of ",h("span",{children:m})," hours per week"]}),h(Oo,{defaultSchedule:p,onSubmit:f})]})]})}o(wt,"WorkScheduleField");import{useFormContext as Vo}from"react-hook-form";import{useState as Go}from"react";import{jsx as K,jsxs as Uo}from"react/jsx-runtime";function Dt({label:e,name:t,options:r,defaultValue:a,description:s,onChange:i,component:p,...F}){let{control:v}=Vo(),{components:c}=C(),[m,f]=Go();return K(x,{defaultValue:a,control:v,name:t,render:({field:l,fieldState:n})=>{let g=p||c?.["multi-select"];if(g){let y={label:e,name:t,options:r,defaultValue:a,description:s,onChange:i,...F};return K(g,{field:{...l,onChange:o(b=>{l.onChange(b),i?.(b)},"onChange")},fieldState:n,fieldData:y})}let u=m||r.filter(y=>l.value.includes(y.value));return Uo(k,{"data-field":t,className:`RemoteFlows__SelectField__Item__${t}`,children:[K(P,{className:"RemoteFlows__SelectField__Label",children:e}),K(N,{children:K(fe,{options:r,selected:u,onChange:y=>{let b=y.map(({value:S})=>S);l.onChange(b),i?.(b),f(y)},...F})}),s&&K(R,{children:s}),n.error&&K(D,{})]})}})}o(Dt,"MultiSelectField");var oe={checkbox:ne,text:A,email:Ct,money:ke,select:ct,"multi-select":Dt,radio:tt,number:ke,file:Ze,fieldset:be,"fieldset-flat":be,date:Ge,textarea:_t,countries:yt,hidden:bt,"work-schedule":wt};import{useEffect as Jo}from"react";import{useFormContext as qo}from"react-hook-form";import{Fragment as Ko,jsx as ve,jsxs as Yo}from"react/jsx-runtime";function Tt({name:e,value:t,description:r,statement:a}){let{setValue:s}=qo();return Jo(()=>{s(e,t)},[]),ve("div",{children:a?Yo(Ko,{children:[ve("p",{className:`text-sm RemoteFlows__ForcedValue__Title__${e}`,dangerouslySetInnerHTML:{__html:a?.title}}),ve("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:a?.description}})]}):ve("p",{className:`text-xs RemoteFlows__ForcedValue__Description__${e}`,dangerouslySetInnerHTML:{__html:r}})})}o(Tt,"ForcedValueField");import{Fragment as Zo,jsx as Y,jsxs as It}from"react/jsx-runtime";function Qo(e){return e.const!==void 0&&e.const===e.default&&e.inputType!=="checkbox"&&e.inputType!=="hidden"}o(Qo,"checkFieldHasForcedValue");var os=o(({fields:e,fieldsets:t,fieldValues:r,components:a})=>{if(!e||e.length===0)return null;let s=t&&r?He({fields:e,fieldsets:t,values:r}):e;return Y(Zo,{children:s.map(i=>{if(i.isVisible===!1||i.deprecated)return null;if(Qo(i))return Y(Tt,{name:i.name,description:i.description,value:i.const,statement:i.statement},i.name);if(i.Component){let{Component:F}=i;return Y(F,{...i},i.name)}let p=oe[i.inputType];return i.inputType==="select"&&i.multiple&&(p=oe["multi-select"]),i.inputType==="fieldset"?Y(p,{...i,components:a}):i.inputType==="fieldset-flat"?Y(p,{...i,components:a,isFlatFieldset:!0}):p?It(Xo,{children:[Y(p,{...i,component:a&&a[i.inputType]}),i.statement?Y(de,{...i.statement}):null]},i.name):It("p",{className:"error",children:["Field type ",i.inputType," not supported"]})})})},"JSONSchemaFormFields");export{os as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IY36VL6X.js.map
|