@servicetitan/dte-unlayer 0.158.0 → 0.159.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/dist/api-core.js +22 -29
  2. package/dist/api-core.js.map +1 -1
  3. package/dist/api-custom-tools.js +23 -29
  4. package/dist/api-custom-tools.js.map +1 -1
  5. package/dist/business-calendar/BusinessCalendarDrawer.d.ts +19 -0
  6. package/dist/business-calendar/BusinessCalendarDrawer.d.ts.map +1 -0
  7. package/dist/business-calendar/BusinessCalendarDrawer.js +41 -0
  8. package/dist/business-calendar/BusinessCalendarDrawer.js.map +1 -0
  9. package/dist/business-calendar/business-calendar-requests.d.ts +25 -0
  10. package/dist/business-calendar/business-calendar-requests.d.ts.map +1 -0
  11. package/dist/business-calendar/business-calendar-requests.js +46 -0
  12. package/dist/business-calendar/business-calendar-requests.js.map +1 -0
  13. package/dist/business-calendar/business-calendar-state.d.ts +22 -0
  14. package/dist/business-calendar/business-calendar-state.d.ts.map +1 -0
  15. package/dist/business-calendar/business-calendar-state.js +74 -0
  16. package/dist/business-calendar/business-calendar-state.js.map +1 -0
  17. package/dist/business-calendar/useBusinessCalendarRequests.d.ts +15 -0
  18. package/dist/business-calendar/useBusinessCalendarRequests.d.ts.map +1 -0
  19. package/dist/business-calendar/useBusinessCalendarRequests.js +30 -0
  20. package/dist/business-calendar/useBusinessCalendarRequests.js.map +1 -0
  21. package/dist/display-conditions/ConditionGroup.js +15 -89
  22. package/dist/display-conditions/ConditionGroup.js.map +1 -1
  23. package/dist/display-conditions/ConditionGroupsSection.js +2 -70
  24. package/dist/display-conditions/ConditionGroupsSection.js.map +1 -1
  25. package/dist/display-conditions/ConditionRow.js +63 -205
  26. package/dist/display-conditions/ConditionRow.js.map +1 -1
  27. package/dist/display-conditions/DisplayConditionModal.js +40 -190
  28. package/dist/display-conditions/DisplayConditionModal.js.map +1 -1
  29. package/dist/display-conditions/LookupValueControl.js +42 -105
  30. package/dist/display-conditions/LookupValueControl.js.map +1 -1
  31. package/dist/display-conditions/SeparatorWithChip.js +1 -10
  32. package/dist/display-conditions/SeparatorWithChip.js.map +1 -1
  33. package/dist/display-conditions/constants.js +15 -20
  34. package/dist/display-conditions/constants.js.map +1 -1
  35. package/dist/display-conditions/displayConditionController.js +5 -8
  36. package/dist/display-conditions/displayConditionController.js.map +1 -1
  37. package/dist/display-conditions/lookupOptionsController.js +16 -16
  38. package/dist/display-conditions/lookupOptionsController.js.map +1 -1
  39. package/dist/display-conditions/nunjucks.js +98 -116
  40. package/dist/display-conditions/nunjucks.js.map +1 -1
  41. package/dist/display-conditions/schemaDataPoints.js +13 -11
  42. package/dist/display-conditions/schemaDataPoints.js.map +1 -1
  43. package/dist/display-conditions/types.js +23 -67
  44. package/dist/display-conditions/types.js.map +1 -1
  45. package/dist/display-conditions/useConditionForms.js +38 -56
  46. package/dist/display-conditions/useConditionForms.js.map +1 -1
  47. package/dist/display-conditions/useLookupOptions.js +24 -44
  48. package/dist/display-conditions/useLookupOptions.js.map +1 -1
  49. package/dist/e-sign-offset/ESignDateSignedOffsetModal.js +37 -150
  50. package/dist/e-sign-offset/ESignDateSignedOffsetModal.js.map +1 -1
  51. package/dist/e-sign-offset/ESignOffsetRuleRow.js +12 -73
  52. package/dist/e-sign-offset/ESignOffsetRuleRow.js.map +1 -1
  53. package/dist/e-sign-offset/eSignOffsetController.js +5 -8
  54. package/dist/e-sign-offset/eSignOffsetController.js.map +1 -1
  55. package/dist/editor-core-source.d.ts +2 -2
  56. package/dist/editor-core-source.d.ts.map +1 -1
  57. package/dist/editor-core-source.js +3 -3
  58. package/dist/editor-core-source.js.map +1 -1
  59. package/dist/editor-core.js +2 -2
  60. package/dist/editor-core.js.map +1 -1
  61. package/dist/editor.d.ts.map +1 -1
  62. package/dist/editor.js +56 -118
  63. package/dist/editor.js.map +1 -1
  64. package/dist/image-upload-error.js +3 -3
  65. package/dist/image-upload-error.js.map +1 -1
  66. package/dist/index.d.ts +1 -0
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +0 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/loadScript.js +7 -8
  71. package/dist/loadScript.js.map +1 -1
  72. package/dist/log.js +2 -3
  73. package/dist/log.js.map +1 -1
  74. package/dist/merge-tags.js +18 -17
  75. package/dist/merge-tags.js.map +1 -1
  76. package/dist/shared/configs.js +1 -2
  77. package/dist/shared/configs.js.map +1 -1
  78. package/dist/shared/const.d.ts +70 -0
  79. package/dist/shared/const.d.ts.map +1 -1
  80. package/dist/shared/const.js +13 -4
  81. package/dist/shared/const.js.map +1 -1
  82. package/dist/shared/date-calc.js +47 -38
  83. package/dist/shared/date-calc.js.map +1 -1
  84. package/dist/shared/e-sign-offset.js +46 -63
  85. package/dist/shared/e-sign-offset.js.map +1 -1
  86. package/dist/shared/edit-icon.js +0 -1
  87. package/dist/shared/edit-icon.js.map +1 -1
  88. package/dist/shared/fonts.js +16 -17
  89. package/dist/shared/fonts.js.map +1 -1
  90. package/dist/shared/forms.js +16 -38
  91. package/dist/shared/forms.js.map +1 -1
  92. package/dist/shared/instance-id.js +6 -9
  93. package/dist/shared/instance-id.js.map +1 -1
  94. package/dist/shared/nunjucks-helpers.js +2 -5
  95. package/dist/shared/nunjucks-helpers.js.map +1 -1
  96. package/dist/shared/schema.js +52 -96
  97. package/dist/shared/schema.js.map +1 -1
  98. package/dist/shared/tools.js +6 -13
  99. package/dist/shared/tools.js.map +1 -1
  100. package/dist/store.d.ts +15 -1
  101. package/dist/store.d.ts.map +1 -1
  102. package/dist/store.js +851 -548
  103. package/dist/store.js.map +1 -1
  104. package/dist/tools.js +133 -143
  105. package/dist/tools.js.map +1 -1
  106. package/dist/unlayer-interface.d.ts +15 -4
  107. package/dist/unlayer-interface.d.ts.map +1 -1
  108. package/dist/unlayer-interface.js +1 -2
  109. package/dist/unlayer-interface.js.map +1 -1
  110. package/dist/unlayer.js +86 -113
  111. package/dist/unlayer.js.map +1 -1
  112. package/dist/vendor/dte-shared/business-calendar-validation.utils.d.ts +25 -0
  113. package/dist/vendor/dte-shared/business-calendar-validation.utils.js +80 -0
  114. package/dist/vendor/dte-shared/components/business-calendar-section.d.ts +15 -0
  115. package/dist/vendor/dte-shared/components/business-calendar-section.js +14 -0
  116. package/dist/vendor/dte-shared/components/schedule-drawer.d.ts +18 -0
  117. package/dist/vendor/dte-shared/components/schedule-drawer.js +119 -0
  118. package/dist/vendor/dte-shared/components/schedule-picker.d.ts +8 -0
  119. package/dist/vendor/dte-shared/components/schedule-picker.js +88 -0
  120. package/dist/vendor/dte-shared/constants.d.ts +31 -0
  121. package/dist/vendor/dte-shared/constants.js +34 -0
  122. package/dist/vendor/dte-shared/field-schedule-editor-context.d.ts +31 -0
  123. package/dist/vendor/dte-shared/field-schedule-editor-context.js +110 -0
  124. package/dist/vendor/dte-shared/index.d.ts +8 -0
  125. package/dist/vendor/dte-shared/index.js +7 -0
  126. package/dist/vendor/dte-shared/schedule-bindings.utils.d.ts +22 -0
  127. package/dist/vendor/dte-shared/schedule-bindings.utils.js +31 -0
  128. package/dist/vendor/dte-shared/styles/schedule.css +19 -0
  129. package/dist/vendor/dte-shared/types.d.ts +129 -0
  130. package/dist/vendor/dte-shared/types.js +1 -0
  131. package/package.json +7 -1
  132. package/src/__tests__/business-calendar-drawer.test.tsx +183 -0
  133. package/src/__tests__/business-calendar-requests.test.ts +166 -0
  134. package/src/__tests__/business-calendar-state.test.tsx +142 -0
  135. package/src/__tests__/store.business-calendar.test.ts +185 -0
  136. package/src/__tests__/unlayer.e-sign-types.test.ts +30 -0
  137. package/src/business-calendar/BusinessCalendarDrawer.tsx +76 -0
  138. package/src/business-calendar/business-calendar-requests.ts +80 -0
  139. package/src/business-calendar/business-calendar-state.ts +113 -0
  140. package/src/business-calendar/useBusinessCalendarRequests.ts +49 -0
  141. package/src/editor-core-source.ts +2 -2
  142. package/src/editor.tsx +15 -0
  143. package/src/index.ts +10 -0
  144. package/src/shared/const.ts +59 -0
  145. package/src/store.ts +67 -5
  146. package/src/unlayer-interface.tsx +15 -4
  147. package/src/unlayer.tsx +5 -5
@@ -4,106 +4,32 @@ import PlusIcon from '@servicetitan/anvil2/assets/icons/material/round/add.svg';
4
4
  import { useCallback } from 'react';
5
5
  import { ConditionRow } from './ConditionRow';
6
6
  import { defaultCondition } from './constants';
7
- export function ConditionGroup({ dataPointOptions, formFieldOptions, forms, group, onFormSelect, onUpdate }) {
8
- const addCondition = useCallback(()=>{
7
+ export function ConditionGroup({ dataPointOptions, formFieldOptions, forms, group, onFormSelect, onUpdate, }) {
8
+ const addCondition = useCallback(() => {
9
9
  const newCondition = {
10
10
  ...defaultCondition(),
11
- logicalOperator: 'and'
11
+ logicalOperator: 'and',
12
12
  };
13
13
  onUpdate({
14
14
  ...group,
15
- conditions: [
16
- ...group.conditions,
17
- newCondition
18
- ]
15
+ conditions: [...group.conditions, newCondition],
19
16
  });
20
- }, [
21
- group,
22
- onUpdate
23
- ]);
24
- const updateCondition = useCallback((index, c)=>{
25
- const next = [
26
- ...group.conditions
27
- ];
17
+ }, [group, onUpdate]);
18
+ const updateCondition = useCallback((index, c) => {
19
+ const next = [...group.conditions];
28
20
  next[index] = c;
29
- onUpdate({
30
- ...group,
31
- conditions: next
32
- });
33
- }, [
34
- group,
35
- onUpdate
36
- ]);
37
- const removeCondition = useCallback((index)=>{
38
- let next = group.conditions.filter((_, i)=>i !== index);
21
+ onUpdate({ ...group, conditions: next });
22
+ }, [group, onUpdate]);
23
+ const removeCondition = useCallback((index) => {
24
+ let next = group.conditions.filter((_, i) => i !== index);
39
25
  if (index === 0 && next.length > 0) {
40
- next = [
41
- {
42
- ...next[0],
43
- logicalOperator: undefined
44
- },
45
- ...next.slice(1)
46
- ];
26
+ next = [{ ...next[0], logicalOperator: undefined }, ...next.slice(1)];
47
27
  }
48
28
  onUpdate({
49
29
  ...group,
50
- conditions: next.length ? next : [
51
- defaultCondition()
52
- ]
30
+ conditions: next.length ? next : [defaultCondition()],
53
31
  });
54
- }, [
55
- group,
56
- onUpdate
57
- ]);
58
- return /*#__PURE__*/ _jsx(Flex, {
59
- direction: "column",
60
- gap: "2",
61
- style: {
62
- width: '100%'
63
- },
64
- children: /*#__PURE__*/ _jsxs(Flex, {
65
- direction: "column",
66
- gap: "3",
67
- style: {
68
- width: '100%'
69
- },
70
- children: [
71
- group.conditions.map((c, i)=>/*#__PURE__*/ _jsx(Flex, {
72
- direction: "column",
73
- gap: "3",
74
- style: {
75
- padding: '8px 0'
76
- },
77
- children: /*#__PURE__*/ _jsx(ConditionRow, {
78
- canRemove: true,
79
- condition: c,
80
- dataPointOptions: dataPointOptions,
81
- forms: forms,
82
- formFieldOptions: formFieldOptions,
83
- onChange: (next)=>updateCondition(i, next),
84
- onFormSelect: onFormSelect,
85
- onRemove: ()=>removeCondition(i)
86
- })
87
- }, c.id)),
88
- /*#__PURE__*/ _jsx(Flex, {
89
- justifyContent: "center",
90
- style: {
91
- paddingTop: 8,
92
- width: '100%'
93
- },
94
- children: /*#__PURE__*/ _jsx(Button, {
95
- appearance: "secondary",
96
- icon: {
97
- before: PlusIcon
98
- },
99
- size: "small",
100
- onClick: addCondition,
101
- children: "Add Condition"
102
- })
103
- })
104
- ]
105
- })
106
- });
32
+ }, [group, onUpdate]);
33
+ return (_jsx(Flex, { direction: "column", gap: "2", style: { width: '100%' }, children: _jsxs(Flex, { direction: "column", gap: "3", style: { width: '100%' }, children: [group.conditions.map((c, i) => (_jsx(Flex, { direction: "column", gap: "3", style: { padding: '8px 0' }, children: _jsx(ConditionRow, { canRemove: true, condition: c, dataPointOptions: dataPointOptions, forms: forms, formFieldOptions: formFieldOptions, onChange: next => updateCondition(i, next), onFormSelect: onFormSelect, onRemove: () => removeCondition(i) }) }, c.id))), _jsx(Flex, { justifyContent: "center", style: { paddingTop: 8, width: '100%' }, children: _jsx(Button, { appearance: "secondary", icon: { before: PlusIcon }, size: "small", onClick: addCondition, children: "Add Condition" }) })] }) }));
107
34
  }
108
-
109
35
  //# sourceMappingURL=ConditionGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/display-conditions/ConditionGroup.tsx"],"sourcesContent":["import { Button, Flex } from '@servicetitan/anvil2';\nimport PlusIcon from '@servicetitan/anvil2/assets/icons/material/round/add.svg';\nimport { useCallback } from 'react';\nimport { FormInfo } from '../shared/forms';\nimport { ConditionRow } from './ConditionRow';\nimport { defaultCondition } from './constants';\nimport { ConditionGroup as ConditionGroupType, FormFieldOption, SingleCondition } from './types';\nimport type { DataPointOption } from './types';\n\nexport interface ConditionGroupProps {\n dataPointOptions: DataPointOption[];\n formFieldOptions: FormFieldOption[];\n forms: FormInfo[];\n group: ConditionGroupType;\n onFormSelect: (formId: number) => void;\n onUpdate: (g: ConditionGroupType) => void;\n}\n\nexport function ConditionGroup({\n dataPointOptions,\n formFieldOptions,\n forms,\n group,\n onFormSelect,\n onUpdate,\n}: Readonly<ConditionGroupProps>) {\n const addCondition = useCallback(() => {\n const newCondition: SingleCondition = {\n ...defaultCondition(),\n logicalOperator: 'and',\n };\n onUpdate({\n ...group,\n conditions: [...group.conditions, newCondition],\n });\n }, [group, onUpdate]);\n\n const updateCondition = useCallback(\n (index: number, c: SingleCondition) => {\n const next = [...group.conditions];\n next[index] = c;\n onUpdate({ ...group, conditions: next });\n },\n [group, onUpdate],\n );\n\n const removeCondition = useCallback(\n (index: number) => {\n let next = group.conditions.filter((_, i) => i !== index);\n if (index === 0 && next.length > 0) {\n next = [{ ...next[0], logicalOperator: undefined }, ...next.slice(1)];\n }\n onUpdate({\n ...group,\n conditions: next.length ? next : [defaultCondition()],\n });\n },\n [group, onUpdate],\n );\n\n return (\n <Flex direction=\"column\" gap=\"2\" style={{ width: '100%' }}>\n <Flex direction=\"column\" gap=\"3\" style={{ width: '100%' }}>\n {group.conditions.map((c, i) => (\n <Flex key={c.id} direction=\"column\" gap=\"3\" style={{ padding: '8px 0' }}>\n <ConditionRow\n canRemove\n condition={c}\n dataPointOptions={dataPointOptions}\n forms={forms}\n formFieldOptions={formFieldOptions}\n onChange={next => updateCondition(i, next)}\n onFormSelect={onFormSelect}\n onRemove={() => removeCondition(i)}\n />\n </Flex>\n ))}\n <Flex justifyContent=\"center\" style={{ paddingTop: 8, width: '100%' }}>\n <Button\n appearance=\"secondary\"\n icon={{ before: PlusIcon }}\n size=\"small\"\n onClick={addCondition}\n >\n Add Condition\n </Button>\n </Flex>\n </Flex>\n </Flex>\n );\n}\n"],"names":["Button","Flex","PlusIcon","useCallback","ConditionRow","defaultCondition","ConditionGroup","dataPointOptions","formFieldOptions","forms","group","onFormSelect","onUpdate","addCondition","newCondition","logicalOperator","conditions","updateCondition","index","c","next","removeCondition","filter","_","i","length","undefined","slice","direction","gap","style","width","map","padding","canRemove","condition","onChange","onRemove","id","justifyContent","paddingTop","appearance","icon","before","size","onClick"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,QAAQ,uBAAuB;AACpD,OAAOC,cAAc,2DAA2D;AAChF,SAASC,WAAW,QAAQ,QAAQ;AAEpC,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,gBAAgB,QAAQ,cAAc;AAa/C,OAAO,SAASC,eAAe,EAC3BC,gBAAgB,EAChBC,gBAAgB,EAChBC,KAAK,EACLC,KAAK,EACLC,YAAY,EACZC,QAAQ,EACoB;IAC5B,MAAMC,eAAeV,YAAY;QAC7B,MAAMW,eAAgC;YAClC,GAAGT,kBAAkB;YACrBU,iBAAiB;QACrB;QACAH,SAAS;YACL,GAAGF,KAAK;YACRM,YAAY;mBAAIN,MAAMM,UAAU;gBAAEF;aAAa;QACnD;IACJ,GAAG;QAACJ;QAAOE;KAAS;IAEpB,MAAMK,kBAAkBd,YACpB,CAACe,OAAeC;QACZ,MAAMC,OAAO;eAAIV,MAAMM,UAAU;SAAC;QAClCI,IAAI,CAACF,MAAM,GAAGC;QACdP,SAAS;YAAE,GAAGF,KAAK;YAAEM,YAAYI;QAAK;IAC1C,GACA;QAACV;QAAOE;KAAS;IAGrB,MAAMS,kBAAkBlB,YACpB,CAACe;QACG,IAAIE,OAAOV,MAAMM,UAAU,CAACM,MAAM,CAAC,CAACC,GAAGC,IAAMA,MAAMN;QACnD,IAAIA,UAAU,KAAKE,KAAKK,MAAM,GAAG,GAAG;YAChCL,OAAO;gBAAC;oBAAE,GAAGA,IAAI,CAAC,EAAE;oBAAEL,iBAAiBW;gBAAU;mBAAMN,KAAKO,KAAK,CAAC;aAAG;QACzE;QACAf,SAAS;YACL,GAAGF,KAAK;YACRM,YAAYI,KAAKK,MAAM,GAAGL,OAAO;gBAACf;aAAmB;QACzD;IACJ,GACA;QAACK;QAAOE;KAAS;IAGrB,qBACI,KAACX;QAAK2B,WAAU;QAASC,KAAI;QAAIC,OAAO;YAAEC,OAAO;QAAO;kBACpD,cAAA,MAAC9B;YAAK2B,WAAU;YAASC,KAAI;YAAIC,OAAO;gBAAEC,OAAO;YAAO;;gBACnDrB,MAAMM,UAAU,CAACgB,GAAG,CAAC,CAACb,GAAGK,kBACtB,KAACvB;wBAAgB2B,WAAU;wBAASC,KAAI;wBAAIC,OAAO;4BAAEG,SAAS;wBAAQ;kCAClE,cAAA,KAAC7B;4BACG8B,SAAS;4BACTC,WAAWhB;4BACXZ,kBAAkBA;4BAClBE,OAAOA;4BACPD,kBAAkBA;4BAClB4B,UAAUhB,CAAAA,OAAQH,gBAAgBO,GAAGJ;4BACrCT,cAAcA;4BACd0B,UAAU,IAAMhB,gBAAgBG;;uBAT7BL,EAAEmB,EAAE;8BAanB,KAACrC;oBAAKsC,gBAAe;oBAAST,OAAO;wBAAEU,YAAY;wBAAGT,OAAO;oBAAO;8BAChE,cAAA,KAAC/B;wBACGyC,YAAW;wBACXC,MAAM;4BAAEC,QAAQzC;wBAAS;wBACzB0C,MAAK;wBACLC,SAAShC;kCACZ;;;;;;AAOrB"}
1
+ {"version":3,"file":"ConditionGroup.js","sourceRoot":"","sources":["../../src/display-conditions/ConditionGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,M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,EAAC,QAAQ,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,YACjE,KAAC,MAAM,IACH,UAAU,EAAC,WAAW,EACtB,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EAC1B,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,YAAY,8BAGhB,GACN,IACJ,GACJ,CACV,CAAC;AACN,CAAC"}
@@ -1,79 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Chip, Flex, SegmentedControl, Text } from '@servicetitan/anvil2';
3
3
  import { ConditionGroup } from './ConditionGroup';
4
- export function ConditionGroupsSection({ behaviorSection, dataPointOptions, formFieldOptions, forms, groups, matchType, onFormSelect, onMatchTypeChange, onUpdateGroup }) {
4
+ export function ConditionGroupsSection({ behaviorSection, dataPointOptions, formFieldOptions, forms, groups, matchType, onFormSelect, onMatchTypeChange, onUpdateGroup, }) {
5
5
  const firstGroup = groups[0];
6
6
  if (!firstGroup) {
7
7
  return null;
8
8
  }
9
- return /*#__PURE__*/ _jsxs(Flex, {
10
- direction: "column",
11
- gap: "4",
12
- children: [
13
- /*#__PURE__*/ _jsxs(Flex, {
14
- direction: "row",
15
- alignItems: "center",
16
- gap: "1",
17
- style: {
18
- flexWrap: 'wrap'
19
- },
20
- children: [
21
- /*#__PURE__*/ _jsx(Text, {
22
- size: "small",
23
- variant: "body",
24
- style: {
25
- fontWeight: 'bold'
26
- },
27
- children: "When"
28
- }),
29
- /*#__PURE__*/ _jsxs(SegmentedControl, {
30
- selected: matchType,
31
- size: "small",
32
- onChange: (value)=>onMatchTypeChange(value),
33
- children: [
34
- /*#__PURE__*/ _jsx(SegmentedControl.Segment, {
35
- value: "all",
36
- children: "All"
37
- }),
38
- /*#__PURE__*/ _jsx(SegmentedControl.Segment, {
39
- value: "any",
40
- children: "Any"
41
- })
42
- ]
43
- }),
44
- /*#__PURE__*/ _jsx(Text, {
45
- size: "small",
46
- variant: "body",
47
- style: {
48
- fontWeight: 'bold'
49
- },
50
- children: "of the"
51
- }),
52
- /*#__PURE__*/ _jsx(Chip, {
53
- label: "IF",
54
- size: "small"
55
- }),
56
- /*#__PURE__*/ _jsx(Text, {
57
- size: "small",
58
- variant: "body",
59
- style: {
60
- fontWeight: 'bold'
61
- },
62
- children: "conditions are met"
63
- })
64
- ]
65
- }),
66
- behaviorSection,
67
- /*#__PURE__*/ _jsx(ConditionGroup, {
68
- dataPointOptions: dataPointOptions,
69
- formFieldOptions: formFieldOptions,
70
- forms: forms,
71
- group: firstGroup,
72
- onFormSelect: onFormSelect,
73
- onUpdate: (g)=>onUpdateGroup(0, g)
74
- })
75
- ]
76
- });
9
+ return (_jsxs(Flex, { direction: "column", gap: "4", children: [_jsxs(Flex, { direction: "row", alignItems: "center", gap: "1", style: { flexWrap: 'wrap' }, children: [_jsx(Text, { size: "small", variant: "body", style: { fontWeight: 'bold' }, children: "When" }), _jsxs(SegmentedControl, { selected: matchType, size: "small", onChange: (value) => onMatchTypeChange(value), children: [_jsx(SegmentedControl.Segment, { value: "all", children: "All" }), _jsx(SegmentedControl.Segment, { value: "any", children: "Any" })] }), _jsx(Text, { size: "small", variant: "body", style: { fontWeight: 'bold' }, children: "of the" }), _jsx(Chip, { label: "IF", size: "small" }), _jsx(Text, { size: "small", variant: "body", style: { fontWeight: 'bold' }, children: "conditions are met" })] }), behaviorSection, _jsx(ConditionGroup, { dataPointOptions: dataPointOptions, formFieldOptions: formFieldOptions, forms: forms, group: firstGroup, onFormSelect: onFormSelect, onUpdate: g => onUpdateGroup(0, g) })] }));
77
10
  }
78
-
79
11
  //# sourceMappingURL=ConditionGroupsSection.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/display-conditions/ConditionGroupsSection.tsx"],"sourcesContent":["import { Chip, Flex, SegmentedControl, Text } from '@servicetitan/anvil2';\nimport type { ReactNode } from 'react';\nimport { FormInfo } from '../shared/forms';\nimport { ConditionGroup } from './ConditionGroup';\nimport { ConditionGroup as ConditionGroupType, FormFieldOption } from './types';\nimport type { DataPointOption } from './types';\n\nexport type MatchType = 'all' | 'any';\n\nexport interface ConditionGroupsSectionProps {\n behaviorSection?: ReactNode;\n dataPointOptions: DataPointOption[];\n formFieldOptions: FormFieldOption[];\n forms: FormInfo[];\n groups: ConditionGroupType[];\n matchType: MatchType;\n onFormSelect: (formId: number) => void;\n onMatchTypeChange: (matchType: MatchType) => void;\n onUpdateGroup: (index: number, group: ConditionGroupType) => void;\n}\n\nexport function ConditionGroupsSection({\n behaviorSection,\n dataPointOptions,\n formFieldOptions,\n forms,\n groups,\n matchType,\n onFormSelect,\n onMatchTypeChange,\n onUpdateGroup,\n}: Readonly<ConditionGroupsSectionProps>) {\n const firstGroup = groups[0];\n if (!firstGroup) {\n return null;\n }\n\n return (\n <Flex direction=\"column\" gap=\"4\">\n <Flex direction=\"row\" alignItems=\"center\" gap=\"1\" style={{ flexWrap: 'wrap' }}>\n <Text size=\"small\" variant=\"body\" style={{ fontWeight: 'bold' }}>\n When\n </Text>\n <SegmentedControl\n selected={matchType}\n size=\"small\"\n onChange={(value: string) => onMatchTypeChange(value as MatchType)}\n >\n <SegmentedControl.Segment value=\"all\">All</SegmentedControl.Segment>\n <SegmentedControl.Segment value=\"any\">Any</SegmentedControl.Segment>\n </SegmentedControl>\n <Text size=\"small\" variant=\"body\" style={{ fontWeight: 'bold' }}>\n of the\n </Text>\n <Chip label=\"IF\" size=\"small\" />\n <Text size=\"small\" variant=\"body\" style={{ fontWeight: 'bold' }}>\n conditions are met\n </Text>\n </Flex>\n {behaviorSection}\n <ConditionGroup\n dataPointOptions={dataPointOptions}\n formFieldOptions={formFieldOptions}\n forms={forms}\n group={firstGroup}\n onFormSelect={onFormSelect}\n onUpdate={g => onUpdateGroup(0, g)}\n />\n </Flex>\n );\n}\n"],"names":["Chip","Flex","SegmentedControl","Text","ConditionGroup","ConditionGroupsSection","behaviorSection","dataPointOptions","formFieldOptions","forms","groups","matchType","onFormSelect","onMatchTypeChange","onUpdateGroup","firstGroup","direction","gap","alignItems","style","flexWrap","size","variant","fontWeight","selected","onChange","value","Segment","label","group","onUpdate","g"],"mappings":";AAAA,SAASA,IAAI,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,uBAAuB;AAG1E,SAASC,cAAc,QAAQ,mBAAmB;AAkBlD,OAAO,SAASC,uBAAuB,EACnCC,eAAe,EACfC,gBAAgB,EAChBC,gBAAgB,EAChBC,KAAK,EACLC,MAAM,EACNC,SAAS,EACTC,YAAY,EACZC,iBAAiB,EACjBC,aAAa,EACuB;IACpC,MAAMC,aAAaL,MAAM,CAAC,EAAE;IAC5B,IAAI,CAACK,YAAY;QACb,OAAO;IACX;IAEA,qBACI,MAACd;QAAKe,WAAU;QAASC,KAAI;;0BACzB,MAAChB;gBAAKe,WAAU;gBAAME,YAAW;gBAASD,KAAI;gBAAIE,OAAO;oBAAEC,UAAU;gBAAO;;kCACxE,KAACjB;wBAAKkB,MAAK;wBAAQC,SAAQ;wBAAOH,OAAO;4BAAEI,YAAY;wBAAO;kCAAG;;kCAGjE,MAACrB;wBACGsB,UAAUb;wBACVU,MAAK;wBACLI,UAAU,CAACC,QAAkBb,kBAAkBa;;0CAE/C,KAACxB,iBAAiByB,OAAO;gCAACD,OAAM;0CAAM;;0CACtC,KAACxB,iBAAiByB,OAAO;gCAACD,OAAM;0CAAM;;;;kCAE1C,KAACvB;wBAAKkB,MAAK;wBAAQC,SAAQ;wBAAOH,OAAO;4BAAEI,YAAY;wBAAO;kCAAG;;kCAGjE,KAACvB;wBAAK4B,OAAM;wBAAKP,MAAK;;kCACtB,KAAClB;wBAAKkB,MAAK;wBAAQC,SAAQ;wBAAOH,OAAO;4BAAEI,YAAY;wBAAO;kCAAG;;;;YAIpEjB;0BACD,KAACF;gBACGG,kBAAkBA;gBAClBC,kBAAkBA;gBAClBC,OAAOA;gBACPoB,OAAOd;gBACPH,cAAcA;gBACdkB,UAAUC,CAAAA,IAAKjB,cAAc,GAAGiB;;;;AAIhD"}
1
+ {"version":3,"file":"ConditionGroupsSection.js","sourceRoot":"","sources":["../../src/display-conditions/ConditionGroupsSection.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAG1E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBlD,MAAM,UAAU,sBAAsB,CAAC,EACnC,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,EACL,MAAM,EACN,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACuB;IACpC,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7B,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CACH,MAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,aAC5B,MAAC,IAAI,IAAC,SAAS,EAAC,KAAK,EAAC,UAAU,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,aACzE,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,qBAExD,EACP,MAAC,gBAAgB,IACb,QAAQ,EAAE,SAAS,EACnB,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,iBAAiB,CAAC,KAAkB,CAAC,aAElE,KAAC,gBAAgB,CAAC,OAAO,IAAC,KAAK,EAAC,KAAK,oBAA+B,EACpE,KAAC,gBAAgB,CAAC,OAAO,IAAC,KAAK,EAAC,KAAK,oBAA+B,IACrD,EACnB,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,uBAExD,EACP,KAAC,IAAI,IAAC,KAAK,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,GAAG,EAChC,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,mCAExD,IACJ,EACN,eAAe,EAChB,KAAC,cAAc,IACX,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,UAAU,EACjB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC,IACC,CACV,CAAC;AACN,CAAC"}
@@ -5,33 +5,23 @@ import { useEffect, useMemo, useState } from 'react';
5
5
  import { parseFormFieldKey } from '../shared/forms';
6
6
  import { LookupValueControl } from './LookupValueControl';
7
7
  import { NUMBER_OPERATORS, STRING_OPERATORS, VALUE_LESS_OPERATORS } from './types';
8
- export function ConditionRow({ canRemove, condition, dataPointOptions, formFieldOptions, forms, onChange, onFormSelect, onRemove }) {
9
- var _ref;
10
- const selectedFormFieldMeta = useMemo(()=>parseFormFieldKey(condition.dataPointKey), [
11
- condition.dataPointKey
12
- ]);
8
+ export function ConditionRow({ canRemove, condition, dataPointOptions, formFieldOptions, forms, onChange, onFormSelect, onRemove, }) {
9
+ var _a;
10
+ const selectedFormFieldMeta = useMemo(() => parseFormFieldKey(condition.dataPointKey), [condition.dataPointKey]);
13
11
  const [selectedSourceValue, setSelectedSourceValue] = useState(selectedFormFieldMeta ? `form:${selectedFormFieldMeta.formId}` : 'schema');
14
- const sourceOptions = useMemo(()=>[
15
- {
16
- label: 'Merge tags',
17
- value: 'schema'
18
- },
19
- ...forms.map((form)=>({
20
- formId: form.id,
21
- label: form.name,
22
- value: `form:${form.id}`
23
- }))
24
- ], [
25
- forms
26
- ]);
27
- const selectedSource = useMemo(()=>{
28
- var _ref, _sourceOptions_find;
29
- return (_ref = (_sourceOptions_find = sourceOptions.find((opt)=>opt.value === selectedSourceValue)) !== null && _sourceOptions_find !== void 0 ? _sourceOptions_find : sourceOptions[0]) !== null && _ref !== void 0 ? _ref : null;
30
- }, [
31
- selectedSourceValue,
32
- sourceOptions
33
- ]);
34
- useEffect(()=>{
12
+ const sourceOptions = useMemo(() => [
13
+ { label: 'Merge tags', value: 'schema' },
14
+ ...forms.map(form => ({
15
+ formId: form.id,
16
+ label: form.name,
17
+ value: `form:${form.id}`,
18
+ })),
19
+ ], [forms]);
20
+ const selectedSource = useMemo(() => {
21
+ var _a, _b;
22
+ return ((_b = (_a = sourceOptions.find(opt => opt.value === selectedSourceValue)) !== null && _a !== void 0 ? _a : sourceOptions[0]) !== null && _b !== void 0 ? _b : null);
23
+ }, [selectedSourceValue, sourceOptions]);
24
+ useEffect(() => {
35
25
  if (selectedFormFieldMeta) {
36
26
  setSelectedSourceValue(`form:${selectedFormFieldMeta.formId}`);
37
27
  return;
@@ -39,208 +29,76 @@ export function ConditionRow({ canRemove, condition, dataPointOptions, formField
39
29
  if (!condition.dataPointKey) {
40
30
  return;
41
31
  }
42
- const hasSchemaMatch = dataPointOptions.some((opt)=>opt.fullKey === condition.dataPointKey);
32
+ const hasSchemaMatch = dataPointOptions.some(opt => opt.fullKey === condition.dataPointKey);
43
33
  if (hasSchemaMatch) {
44
34
  setSelectedSourceValue('schema');
45
35
  }
46
- }, [
47
- condition.dataPointKey,
48
- dataPointOptions,
49
- selectedFormFieldMeta
50
- ]);
36
+ }, [condition.dataPointKey, dataPointOptions, selectedFormFieldMeta]);
51
37
  const currentFormId = selectedSource === null || selectedSource === void 0 ? void 0 : selectedSource.formId;
52
- const activeDataPointOptions = useMemo(()=>currentFormId ? formFieldOptions.filter((option)=>option.formId === currentFormId) : dataPointOptions, [
53
- currentFormId,
54
- dataPointOptions,
55
- formFieldOptions
56
- ]);
57
- const selectedDataPoint = useMemo(()=>{
58
- var _activeDataPointOptions_find;
59
- return (_activeDataPointOptions_find = activeDataPointOptions.find((opt)=>opt.fullKey === condition.dataPointKey)) !== null && _activeDataPointOptions_find !== void 0 ? _activeDataPointOptions_find : null;
60
- }, [
61
- activeDataPointOptions,
62
- condition.dataPointKey
63
- ]);
64
- const fieldType = (_ref = selectedDataPoint === null || selectedDataPoint === void 0 ? void 0 : selectedDataPoint.fieldType) !== null && _ref !== void 0 ? _ref : 'string';
38
+ const activeDataPointOptions = useMemo(() => currentFormId
39
+ ? formFieldOptions.filter(option => option.formId === currentFormId)
40
+ : dataPointOptions, [currentFormId, dataPointOptions, formFieldOptions]);
41
+ const selectedDataPoint = useMemo(() => { var _a; return (_a = activeDataPointOptions.find(opt => opt.fullKey === condition.dataPointKey)) !== null && _a !== void 0 ? _a : null; }, [activeDataPointOptions, condition.dataPointKey]);
42
+ const fieldType = (_a = selectedDataPoint === null || selectedDataPoint === void 0 ? void 0 : selectedDataPoint.fieldType) !== null && _a !== void 0 ? _a : 'string';
65
43
  const isValueLess = VALUE_LESS_OPERATORS.includes(condition.operator);
66
- const operatorItems = useMemo(()=>fieldType === 'number' ? [
67
- ...NUMBER_OPERATORS
68
- ] : [
69
- ...STRING_OPERATORS
70
- ], [
71
- fieldType
72
- ]);
73
- const selectedOperator = useMemo(()=>{
74
- var _operatorItems_find;
75
- return (_operatorItems_find = operatorItems.find((op)=>op.value === condition.operator)) !== null && _operatorItems_find !== void 0 ? _operatorItems_find : null;
76
- }, [
77
- operatorItems,
78
- condition.operator
79
- ]);
80
- const handleDataPointChange = (item)=>{
81
- var _ref;
44
+ const operatorItems = useMemo(() => fieldType === 'number'
45
+ ? [...NUMBER_OPERATORS]
46
+ : [...STRING_OPERATORS], [fieldType]);
47
+ const selectedOperator = useMemo(() => { var _a; return (_a = operatorItems.find(op => op.value === condition.operator)) !== null && _a !== void 0 ? _a : null; }, [operatorItems, condition.operator]);
48
+ const handleDataPointChange = (item) => {
49
+ var _a;
82
50
  const nextIsNumber = (item === null || item === void 0 ? void 0 : item.fieldType) === 'number';
83
51
  const nextOperatorItems = nextIsNumber ? NUMBER_OPERATORS : STRING_OPERATORS;
84
- const operatorReset = !nextOperatorItems.some((op)=>op.value === condition.operator);
52
+ const operatorReset = !nextOperatorItems.some(op => op.value === condition.operator);
85
53
  onChange({
86
54
  ...condition,
87
- dataPointKey: (_ref = item === null || item === void 0 ? void 0 : item.fullKey) !== null && _ref !== void 0 ? _ref : '',
88
- operator: operatorReset ? nextIsNumber ? 'num_eq' : 'is_equal_to' : condition.operator
55
+ dataPointKey: (_a = item === null || item === void 0 ? void 0 : item.fullKey) !== null && _a !== void 0 ? _a : '',
56
+ operator: operatorReset
57
+ ? nextIsNumber
58
+ ? 'num_eq'
59
+ : 'is_equal_to'
60
+ : condition.operator,
89
61
  });
90
62
  };
91
- const handleSourceChange = (item)=>{
63
+ const handleSourceChange = (item) => {
92
64
  if (!item) {
93
65
  return;
94
66
  }
95
67
  setSelectedSourceValue(item.value);
96
68
  // As in BYOD, a new source starts the condition over instead of picking a data point for it.
97
- onChange({
98
- ...condition,
99
- dataPointKey: '',
100
- operator: 'is_equal_to',
101
- value: ''
102
- });
69
+ onChange({ ...condition, dataPointKey: '', operator: 'is_equal_to', value: '' });
103
70
  if (item.formId) {
104
71
  onFormSelect(item.formId);
105
72
  }
106
73
  };
107
74
  // Same controls and layout as BYOD's condition row (`dte-pdf-editor`'s `ConditionRow`).
108
- const sourceSelectOptions = sourceOptions.map((option)=>({
109
- id: option.value,
110
- label: option.label
111
- }));
112
- const dataPointSelectOptions = activeDataPointOptions.map((option)=>({
113
- id: option.fullKey,
114
- label: option.title
115
- }));
116
- const operatorSelectOptions = operatorItems.map((option)=>({
117
- id: option.value,
118
- label: option.label
119
- }));
120
- return /*#__PURE__*/ _jsxs(Flex, {
121
- direction: "column",
122
- gap: "4",
123
- flex: 1,
124
- children: [
125
- /*#__PURE__*/ _jsx(Flex, {
126
- flex: 1,
127
- gap: "2",
128
- children: /*#__PURE__*/ _jsx(SelectFieldSync, {
129
- flex: 1,
130
- disableSearch: true,
131
- disableClearButton: true,
132
- label: "Source",
133
- placeholder: "Select source...",
134
- options: sourceSelectOptions,
135
- value: selectedSource ? {
136
- id: selectedSource.value,
137
- label: selectedSource.label
138
- } : null,
139
- onSelectedOptionChange: (option)=>{
140
- var _sourceOptions_find;
141
- return handleSourceChange((_sourceOptions_find = sourceOptions.find((o)=>o.value === (option === null || option === void 0 ? void 0 : option.id))) !== null && _sourceOptions_find !== void 0 ? _sourceOptions_find : null);
142
- }
143
- })
144
- }),
145
- /*#__PURE__*/ _jsxs(Flex, {
146
- direction: "row",
147
- alignItems: "flex-end",
148
- gap: "2",
149
- flex: 1,
150
- style: {
151
- flexWrap: 'wrap'
152
- },
153
- children: [
154
- /*#__PURE__*/ _jsx(Flex, {
155
- alignItems: "flex-end",
156
- style: {
157
- padding: '8px 12px'
158
- },
159
- children: /*#__PURE__*/ _jsx(Chip, {
160
- label: "IF",
161
- size: "medium"
162
- })
163
- }),
164
- /*#__PURE__*/ _jsx(Flex, {
165
- flex: 1,
166
- style: {
167
- minWidth: 160
168
- },
169
- children: /*#__PURE__*/ _jsx(SelectFieldSync, {
170
- flex: 1,
171
- disableSearch: true,
172
- disableClearButton: true,
173
- label: "Data point",
174
- placeholder: currentFormId ? 'Select form field...' : 'Select data point...',
175
- options: dataPointSelectOptions,
176
- value: selectedDataPoint ? {
177
- id: selectedDataPoint.fullKey,
178
- label: selectedDataPoint.title
179
- } : null,
180
- onSelectedOptionChange: (option)=>{
181
- var _activeDataPointOptions_find;
182
- return handleDataPointChange((_activeDataPointOptions_find = activeDataPointOptions.find((o)=>o.fullKey === (option === null || option === void 0 ? void 0 : option.id))) !== null && _activeDataPointOptions_find !== void 0 ? _activeDataPointOptions_find : null);
183
- }
184
- })
185
- }),
186
- /*#__PURE__*/ _jsx(Flex, {
187
- flex: 1,
188
- style: {
189
- minWidth: 160
190
- },
191
- children: /*#__PURE__*/ _jsx(SelectFieldSync, {
192
- flex: 1,
193
- disableSearch: true,
194
- disableClearButton: true,
195
- label: "Condition",
196
- placeholder: "Select...",
197
- options: operatorSelectOptions,
198
- value: selectedOperator ? {
199
- id: selectedOperator.value,
200
- label: selectedOperator.label
201
- } : null,
202
- onSelectedOptionChange: (option)=>{
203
- var _ref;
75
+ const sourceSelectOptions = sourceOptions.map(option => ({
76
+ id: option.value,
77
+ label: option.label,
78
+ }));
79
+ const dataPointSelectOptions = activeDataPointOptions.map(option => ({
80
+ id: option.fullKey,
81
+ label: option.title,
82
+ }));
83
+ const operatorSelectOptions = operatorItems.map(option => ({
84
+ id: option.value,
85
+ label: option.label,
86
+ }));
87
+ return (_jsxs(Flex, { direction: "column", gap: "4", flex: 1, children: [_jsx(Flex, { flex: 1, gap: "2", children: _jsx(SelectFieldSync, { flex: 1, disableSearch: true, disableClearButton: true, label: "Source", placeholder: "Select source...", options: sourceSelectOptions, value: selectedSource
88
+ ? { id: selectedSource.value, label: selectedSource.label }
89
+ : null, onSelectedOptionChange: (option) => { var _a; return handleSourceChange((_a = sourceOptions.find(o => o.value === (option === null || option === void 0 ? void 0 : option.id))) !== null && _a !== void 0 ? _a : null); } }) }), _jsxs(Flex, { direction: "row", alignItems: "flex-end", gap: "2", flex: 1, style: { flexWrap: 'wrap' }, children: [_jsx(Flex, { alignItems: "flex-end", style: { padding: '8px 12px' }, children: _jsx(Chip, { label: "IF", size: "medium" }) }), _jsx(Flex, { flex: 1, style: { minWidth: 160 }, children: _jsx(SelectFieldSync, { flex: 1, disableSearch: true, disableClearButton: true, label: "Data point", placeholder: currentFormId ? 'Select form field...' : 'Select data point...', options: dataPointSelectOptions, value: selectedDataPoint
90
+ ? { id: selectedDataPoint.fullKey, label: selectedDataPoint.title }
91
+ : null, onSelectedOptionChange: (option) => {
92
+ var _a;
93
+ return handleDataPointChange((_a = activeDataPointOptions.find(o => o.fullKey === (option === null || option === void 0 ? void 0 : option.id))) !== null && _a !== void 0 ? _a : null);
94
+ } }) }), _jsx(Flex, { flex: 1, style: { minWidth: 160 }, children: _jsx(SelectFieldSync, { flex: 1, disableSearch: true, disableClearButton: true, label: "Condition", placeholder: "Select...", options: operatorSelectOptions, value: selectedOperator
95
+ ? { id: selectedOperator.value, label: selectedOperator.label }
96
+ : null, onSelectedOptionChange: (option) => {
97
+ var _a;
204
98
  return onChange({
205
99
  ...condition,
206
- operator: (_ref = option === null || option === void 0 ? void 0 : option.id) !== null && _ref !== void 0 ? _ref : 'is_equal_to'
100
+ operator: ((_a = option === null || option === void 0 ? void 0 : option.id) !== null && _a !== void 0 ? _a : 'is_equal_to'),
207
101
  });
208
- }
209
- })
210
- }),
211
- !isValueLess && /*#__PURE__*/ _jsx(Flex, {
212
- flex: 1,
213
- style: {
214
- minWidth: 160
215
- },
216
- children: /*#__PURE__*/ _jsx(LookupValueControl, {
217
- value: condition.value,
218
- fieldType: fieldType,
219
- lookupSource: selectedDataPoint === null || selectedDataPoint === void 0 ? void 0 : selectedDataPoint.lookupSource,
220
- onChange: (value)=>onChange({
221
- ...condition,
222
- value
223
- })
224
- })
225
- }),
226
- canRemove && /*#__PURE__*/ _jsx(Flex, {
227
- alignItems: "flex-end",
228
- style: {
229
- padding: '6px 12px'
230
- },
231
- children: /*#__PURE__*/ _jsx(Button, {
232
- appearance: "secondary",
233
- "aria-label": "Remove condition",
234
- icon: {
235
- before: TrashIcon
236
- },
237
- onClick: onRemove
238
- })
239
- })
240
- ]
241
- })
242
- ]
243
- });
102
+ } }) }), !isValueLess && (_jsx(Flex, { flex: 1, style: { minWidth: 160 }, children: _jsx(LookupValueControl, { value: condition.value, fieldType: fieldType, lookupSource: selectedDataPoint === null || selectedDataPoint === void 0 ? void 0 : selectedDataPoint.lookupSource, onChange: value => onChange({ ...condition, value }) }) })), canRemove && (_jsx(Flex, { alignItems: "flex-end", style: { padding: '6px 12px' }, children: _jsx(Button, { appearance: "secondary", "aria-label": "Remove condition", icon: { before: TrashIcon }, onClick: onRemove }) }))] })] }));
244
103
  }
245
-
246
104
  //# sourceMappingURL=ConditionRow.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/display-conditions/ConditionRow.tsx"],"sourcesContent":["import { Button, Chip, Flex, SelectFieldSync } from '@servicetitan/anvil2';\nimport TrashIcon from '@servicetitan/anvil2/assets/icons/material/round/delete.svg';\nimport { useEffect, useMemo, useState } from 'react';\nimport { FormInfo, parseFormFieldKey } from '../shared/forms';\nimport { LookupValueControl } from './LookupValueControl';\nimport { NUMBER_OPERATORS, SingleCondition, STRING_OPERATORS, VALUE_LESS_OPERATORS } from './types';\nimport type { DataPointOption, FormFieldOption } from './types';\n\nexport interface ConditionRowProps {\n canRemove: boolean;\n condition: SingleCondition;\n dataPointOptions: DataPointOption[];\n formFieldOptions: FormFieldOption[];\n forms: FormInfo[];\n onChange: (c: SingleCondition) => void;\n onFormSelect: (formId: number) => void;\n onRemove: () => void;\n}\n\ninterface OperatorOption {\n label: string;\n value: string;\n}\n\ninterface SourceOption {\n formId?: number;\n label: string;\n value: string;\n}\n\nexport function ConditionRow({\n canRemove,\n condition,\n dataPointOptions,\n formFieldOptions,\n forms,\n onChange,\n onFormSelect,\n onRemove,\n}: Readonly<ConditionRowProps>) {\n const selectedFormFieldMeta = useMemo(\n () => parseFormFieldKey(condition.dataPointKey),\n [condition.dataPointKey],\n );\n const [selectedSourceValue, setSelectedSourceValue] = useState<string>(\n selectedFormFieldMeta ? `form:${selectedFormFieldMeta.formId}` : 'schema',\n );\n\n const sourceOptions = useMemo<SourceOption[]>(\n () => [\n { label: 'Merge tags', value: 'schema' },\n ...forms.map(form => ({\n formId: form.id,\n label: form.name,\n value: `form:${form.id}`,\n })),\n ],\n [forms],\n );\n\n const selectedSource = useMemo<SourceOption | null>(() => {\n return (\n sourceOptions.find(opt => opt.value === selectedSourceValue) ?? sourceOptions[0] ?? null\n );\n }, [selectedSourceValue, sourceOptions]);\n\n useEffect(() => {\n if (selectedFormFieldMeta) {\n setSelectedSourceValue(`form:${selectedFormFieldMeta.formId}`);\n return;\n }\n if (!condition.dataPointKey) {\n return;\n }\n const hasSchemaMatch = dataPointOptions.some(opt => opt.fullKey === condition.dataPointKey);\n if (hasSchemaMatch) {\n setSelectedSourceValue('schema');\n }\n }, [condition.dataPointKey, dataPointOptions, selectedFormFieldMeta]);\n\n const currentFormId = selectedSource?.formId;\n const activeDataPointOptions = useMemo(\n () =>\n currentFormId\n ? formFieldOptions.filter(option => option.formId === currentFormId)\n : dataPointOptions,\n [currentFormId, dataPointOptions, formFieldOptions],\n );\n\n const selectedDataPoint = useMemo(\n () => activeDataPointOptions.find(opt => opt.fullKey === condition.dataPointKey) ?? null,\n [activeDataPointOptions, condition.dataPointKey],\n );\n\n const fieldType = selectedDataPoint?.fieldType ?? 'string';\n\n const isValueLess = VALUE_LESS_OPERATORS.includes(condition.operator);\n\n const operatorItems: OperatorOption[] = useMemo(\n () =>\n fieldType === 'number'\n ? ([...NUMBER_OPERATORS] as OperatorOption[])\n : ([...STRING_OPERATORS] as OperatorOption[]),\n [fieldType],\n );\n\n const selectedOperator = useMemo(\n () => operatorItems.find(op => op.value === condition.operator) ?? null,\n [operatorItems, condition.operator],\n );\n\n const handleDataPointChange = (item: DataPointOption | null) => {\n const nextIsNumber = item?.fieldType === 'number';\n const nextOperatorItems = nextIsNumber ? NUMBER_OPERATORS : STRING_OPERATORS;\n const operatorReset = !nextOperatorItems.some(op => op.value === condition.operator);\n onChange({\n ...condition,\n dataPointKey: item?.fullKey ?? '',\n operator: operatorReset\n ? nextIsNumber\n ? 'num_eq'\n : 'is_equal_to'\n : condition.operator,\n });\n };\n\n const handleSourceChange = (item: SourceOption | null) => {\n if (!item) {\n return;\n }\n setSelectedSourceValue(item.value);\n // As in BYOD, a new source starts the condition over instead of picking a data point for it.\n onChange({ ...condition, dataPointKey: '', operator: 'is_equal_to', value: '' });\n\n if (item.formId) {\n onFormSelect(item.formId);\n }\n };\n\n // Same controls and layout as BYOD's condition row (`dte-pdf-editor`'s `ConditionRow`).\n const sourceSelectOptions = sourceOptions.map(option => ({\n id: option.value,\n label: option.label,\n }));\n const dataPointSelectOptions = activeDataPointOptions.map(option => ({\n id: option.fullKey,\n label: option.title,\n }));\n const operatorSelectOptions = operatorItems.map(option => ({\n id: option.value,\n label: option.label,\n }));\n\n return (\n <Flex direction=\"column\" gap=\"4\" flex={1}>\n <Flex flex={1} gap=\"2\">\n <SelectFieldSync\n flex={1}\n disableSearch\n disableClearButton\n label=\"Source\"\n placeholder=\"Select source...\"\n options={sourceSelectOptions}\n value={\n selectedSource\n ? { id: selectedSource.value, label: selectedSource.label }\n : null\n }\n onSelectedOptionChange={(option: { id: string; label: string } | null) =>\n handleSourceChange(sourceOptions.find(o => o.value === option?.id) ?? null)\n }\n />\n </Flex>\n <Flex\n direction=\"row\"\n alignItems=\"flex-end\"\n gap=\"2\"\n flex={1}\n style={{ flexWrap: 'wrap' }}\n >\n <Flex alignItems=\"flex-end\" style={{ padding: '8px 12px' }}>\n <Chip label=\"IF\" size=\"medium\" />\n </Flex>\n <Flex flex={1} style={{ minWidth: 160 }}>\n <SelectFieldSync\n flex={1}\n disableSearch\n disableClearButton\n label=\"Data point\"\n placeholder={\n currentFormId ? 'Select form field...' : 'Select data point...'\n }\n options={dataPointSelectOptions}\n value={\n selectedDataPoint\n ? { id: selectedDataPoint.fullKey, label: selectedDataPoint.title }\n : null\n }\n onSelectedOptionChange={(option: { id: string; label: string } | null) =>\n handleDataPointChange(\n activeDataPointOptions.find(o => o.fullKey === option?.id) ?? null,\n )\n }\n />\n </Flex>\n <Flex flex={1} style={{ minWidth: 160 }}>\n <SelectFieldSync\n flex={1}\n disableSearch\n disableClearButton\n label=\"Condition\"\n placeholder=\"Select...\"\n options={operatorSelectOptions}\n value={\n selectedOperator\n ? { id: selectedOperator.value, label: selectedOperator.label }\n : null\n }\n onSelectedOptionChange={(option: { id: string; label: string } | null) =>\n onChange({\n ...condition,\n operator: (option?.id ??\n 'is_equal_to') as SingleCondition['operator'],\n })\n }\n />\n </Flex>\n {!isValueLess && (\n <Flex flex={1} style={{ minWidth: 160 }}>\n <LookupValueControl\n value={condition.value}\n fieldType={fieldType}\n lookupSource={selectedDataPoint?.lookupSource}\n onChange={value => onChange({ ...condition, value })}\n />\n </Flex>\n )}\n {canRemove && (\n <Flex alignItems=\"flex-end\" style={{ padding: '6px 12px' }}>\n <Button\n appearance=\"secondary\"\n aria-label=\"Remove condition\"\n icon={{ before: TrashIcon }}\n onClick={onRemove}\n />\n </Flex>\n )}\n </Flex>\n </Flex>\n );\n}\n"],"names":["Button","Chip","Flex","SelectFieldSync","TrashIcon","useEffect","useMemo","useState","parseFormFieldKey","LookupValueControl","NUMBER_OPERATORS","STRING_OPERATORS","VALUE_LESS_OPERATORS","ConditionRow","canRemove","condition","dataPointOptions","formFieldOptions","forms","onChange","onFormSelect","onRemove","selectedFormFieldMeta","dataPointKey","selectedSourceValue","setSelectedSourceValue","formId","sourceOptions","label","value","map","form","id","name","selectedSource","find","opt","hasSchemaMatch","some","fullKey","currentFormId","activeDataPointOptions","filter","option","selectedDataPoint","fieldType","isValueLess","includes","operator","operatorItems","selectedOperator","op","handleDataPointChange","item","nextIsNumber","nextOperatorItems","operatorReset","handleSourceChange","sourceSelectOptions","dataPointSelectOptions","title","operatorSelectOptions","direction","gap","flex","disableSearch","disableClearButton","placeholder","options","onSelectedOptionChange","o","alignItems","style","flexWrap","padding","size","minWidth","lookupSource","appearance","aria-label","icon","before","onClick"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,eAAe,QAAQ,uBAAuB;AAC3E,OAAOC,eAAe,8DAA8D;AACpF,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACrD,SAAmBC,iBAAiB,QAAQ,kBAAkB;AAC9D,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,gBAAgB,EAAmBC,gBAAgB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