@cxpinsight/react-native 0.2.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 (253) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +131 -0
  3. package/babel.js +101 -0
  4. package/instrumented/Pressable.d.ts +2 -0
  5. package/instrumented/Pressable.js +2 -0
  6. package/instrumented/ScrollView.d.ts +2 -0
  7. package/instrumented/ScrollView.js +2 -0
  8. package/instrumented/TextInput.d.ts +2 -0
  9. package/instrumented/TextInput.js +2 -0
  10. package/instrumented/TouchableOpacity.d.ts +2 -0
  11. package/instrumented/TouchableOpacity.js +2 -0
  12. package/lib/CXPinsight.d.ts +113 -0
  13. package/lib/CXPinsight.d.ts.map +1 -0
  14. package/lib/CXPinsight.js +831 -0
  15. package/lib/CXPinsight.js.map +1 -0
  16. package/lib/CXPinsightProvider.d.ts +19 -0
  17. package/lib/CXPinsightProvider.d.ts.map +1 -0
  18. package/lib/CXPinsightProvider.js +382 -0
  19. package/lib/CXPinsightProvider.js.map +1 -0
  20. package/lib/core/autoScreenTracker.d.ts +20 -0
  21. package/lib/core/autoScreenTracker.d.ts.map +1 -0
  22. package/lib/core/autoScreenTracker.js +66 -0
  23. package/lib/core/autoScreenTracker.js.map +1 -0
  24. package/lib/core/deepLinkTracker.d.ts +17 -0
  25. package/lib/core/deepLinkTracker.d.ts.map +1 -0
  26. package/lib/core/deepLinkTracker.js +81 -0
  27. package/lib/core/deepLinkTracker.js.map +1 -0
  28. package/lib/core/deviceInfo.d.ts +14 -0
  29. package/lib/core/deviceInfo.d.ts.map +1 -0
  30. package/lib/core/deviceInfo.js +166 -0
  31. package/lib/core/deviceInfo.js.map +1 -0
  32. package/lib/core/eventQueue.d.ts +23 -0
  33. package/lib/core/eventQueue.d.ts.map +1 -0
  34. package/lib/core/eventQueue.js +240 -0
  35. package/lib/core/eventQueue.js.map +1 -0
  36. package/lib/core/lifecycle.d.ts +18 -0
  37. package/lib/core/lifecycle.d.ts.map +1 -0
  38. package/lib/core/lifecycle.js +127 -0
  39. package/lib/core/lifecycle.js.map +1 -0
  40. package/lib/core/mobileRecorder.d.ts +15 -0
  41. package/lib/core/mobileRecorder.d.ts.map +1 -0
  42. package/lib/core/mobileRecorder.js +231 -0
  43. package/lib/core/mobileRecorder.js.map +1 -0
  44. package/lib/core/network.d.ts +10 -0
  45. package/lib/core/network.d.ts.map +1 -0
  46. package/lib/core/network.js +74 -0
  47. package/lib/core/network.js.map +1 -0
  48. package/lib/core/networkCapture.d.ts +22 -0
  49. package/lib/core/networkCapture.d.ts.map +1 -0
  50. package/lib/core/networkCapture.js +100 -0
  51. package/lib/core/networkCapture.js.map +1 -0
  52. package/lib/core/scrollCapture.d.ts +48 -0
  53. package/lib/core/scrollCapture.d.ts.map +1 -0
  54. package/lib/core/scrollCapture.js +221 -0
  55. package/lib/core/scrollCapture.js.map +1 -0
  56. package/lib/core/session.d.ts +15 -0
  57. package/lib/core/session.d.ts.map +1 -0
  58. package/lib/core/session.js +157 -0
  59. package/lib/core/session.js.map +1 -0
  60. package/lib/core/storage.d.ts +11 -0
  61. package/lib/core/storage.d.ts.map +1 -0
  62. package/lib/core/storage.js +59 -0
  63. package/lib/core/storage.js.map +1 -0
  64. package/lib/core/triggerEngine.d.ts +56 -0
  65. package/lib/core/triggerEngine.d.ts.map +1 -0
  66. package/lib/core/triggerEngine.js +432 -0
  67. package/lib/core/triggerEngine.js.map +1 -0
  68. package/lib/index.d.ts +7 -0
  69. package/lib/index.d.ts.map +1 -0
  70. package/lib/index.js +11 -0
  71. package/lib/index.js.map +1 -0
  72. package/lib/instrumented/Pressable.d.ts +9 -0
  73. package/lib/instrumented/Pressable.d.ts.map +1 -0
  74. package/lib/instrumented/Pressable.js +96 -0
  75. package/lib/instrumented/Pressable.js.map +1 -0
  76. package/lib/instrumented/ScrollView.d.ts +6 -0
  77. package/lib/instrumented/ScrollView.d.ts.map +1 -0
  78. package/lib/instrumented/ScrollView.js +101 -0
  79. package/lib/instrumented/ScrollView.js.map +1 -0
  80. package/lib/instrumented/TextInput.d.ts +9 -0
  81. package/lib/instrumented/TextInput.d.ts.map +1 -0
  82. package/lib/instrumented/TextInput.js +75 -0
  83. package/lib/instrumented/TextInput.js.map +1 -0
  84. package/lib/instrumented/TouchableOpacity.d.ts +11 -0
  85. package/lib/instrumented/TouchableOpacity.d.ts.map +1 -0
  86. package/lib/instrumented/TouchableOpacity.js +96 -0
  87. package/lib/instrumented/TouchableOpacity.js.map +1 -0
  88. package/lib/instrumented/index.d.ts +19 -0
  89. package/lib/instrumented/index.d.ts.map +1 -0
  90. package/lib/instrumented/index.js +28 -0
  91. package/lib/instrumented/index.js.map +1 -0
  92. package/lib/instrumented/interactionObserver.d.ts +29 -0
  93. package/lib/instrumented/interactionObserver.d.ts.map +1 -0
  94. package/lib/instrumented/interactionObserver.js +38 -0
  95. package/lib/instrumented/interactionObserver.js.map +1 -0
  96. package/lib/setup/AccessibilityScanner.d.ts +32 -0
  97. package/lib/setup/AccessibilityScanner.d.ts.map +1 -0
  98. package/lib/setup/AccessibilityScanner.js +127 -0
  99. package/lib/setup/AccessibilityScanner.js.map +1 -0
  100. package/lib/setup/ElementIdentifier.d.ts +65 -0
  101. package/lib/setup/ElementIdentifier.d.ts.map +1 -0
  102. package/lib/setup/ElementIdentifier.js +114 -0
  103. package/lib/setup/ElementIdentifier.js.map +1 -0
  104. package/lib/setup/ElementRegistry.d.ts +22 -0
  105. package/lib/setup/ElementRegistry.d.ts.map +1 -0
  106. package/lib/setup/ElementRegistry.js +47 -0
  107. package/lib/setup/ElementRegistry.js.map +1 -0
  108. package/lib/setup/SetupCodeEntry.d.ts +15 -0
  109. package/lib/setup/SetupCodeEntry.d.ts.map +1 -0
  110. package/lib/setup/SetupCodeEntry.js +198 -0
  111. package/lib/setup/SetupCodeEntry.js.map +1 -0
  112. package/lib/setup/SetupController.d.ts +29 -0
  113. package/lib/setup/SetupController.d.ts.map +1 -0
  114. package/lib/setup/SetupController.js +189 -0
  115. package/lib/setup/SetupController.js.map +1 -0
  116. package/lib/setup/SetupOverlay.d.ts +10 -0
  117. package/lib/setup/SetupOverlay.d.ts.map +1 -0
  118. package/lib/setup/SetupOverlay.js +408 -0
  119. package/lib/setup/SetupOverlay.js.map +1 -0
  120. package/lib/setup/TapInterceptor.d.ts +19 -0
  121. package/lib/setup/TapInterceptor.d.ts.map +1 -0
  122. package/lib/setup/TapInterceptor.js +98 -0
  123. package/lib/setup/TapInterceptor.js.map +1 -0
  124. package/lib/setup/TouchObserver.d.ts +25 -0
  125. package/lib/setup/TouchObserver.d.ts.map +1 -0
  126. package/lib/setup/TouchObserver.js +88 -0
  127. package/lib/setup/TouchObserver.js.map +1 -0
  128. package/lib/setup/TouchPatcher.d.ts +27 -0
  129. package/lib/setup/TouchPatcher.d.ts.map +1 -0
  130. package/lib/setup/TouchPatcher.js +182 -0
  131. package/lib/setup/TouchPatcher.js.map +1 -0
  132. package/lib/setup/index.d.ts +13 -0
  133. package/lib/setup/index.d.ts.map +1 -0
  134. package/lib/setup/index.js +45 -0
  135. package/lib/setup/index.js.map +1 -0
  136. package/lib/setup/useCXPElement.d.ts +25 -0
  137. package/lib/setup/useCXPElement.d.ts.map +1 -0
  138. package/lib/setup/useCXPElement.js +33 -0
  139. package/lib/setup/useCXPElement.js.map +1 -0
  140. package/lib/survey/SurveyModal.d.ts +10 -0
  141. package/lib/survey/SurveyModal.d.ts.map +1 -0
  142. package/lib/survey/SurveyModal.js +1650 -0
  143. package/lib/survey/SurveyModal.js.map +1 -0
  144. package/lib/survey/expressionEval.d.ts +10 -0
  145. package/lib/survey/expressionEval.d.ts.map +1 -0
  146. package/lib/survey/expressionEval.js +287 -0
  147. package/lib/survey/expressionEval.js.map +1 -0
  148. package/lib/survey/frequencyCap.d.ts +15 -0
  149. package/lib/survey/frequencyCap.d.ts.map +1 -0
  150. package/lib/survey/frequencyCap.js +116 -0
  151. package/lib/survey/frequencyCap.js.map +1 -0
  152. package/lib/survey/handsFreeVoice.d.ts +30 -0
  153. package/lib/survey/handsFreeVoice.d.ts.map +1 -0
  154. package/lib/survey/handsFreeVoice.js +312 -0
  155. package/lib/survey/handsFreeVoice.js.map +1 -0
  156. package/lib/survey/interpolate.d.ts +6 -0
  157. package/lib/survey/interpolate.d.ts.map +1 -0
  158. package/lib/survey/interpolate.js +61 -0
  159. package/lib/survey/interpolate.js.map +1 -0
  160. package/lib/survey/pagesFromV1.d.ts +6 -0
  161. package/lib/survey/pagesFromV1.d.ts.map +1 -0
  162. package/lib/survey/pagesFromV1.js +83 -0
  163. package/lib/survey/pagesFromV1.js.map +1 -0
  164. package/lib/survey/questions/CSATQuestion.d.ts +16 -0
  165. package/lib/survey/questions/CSATQuestion.d.ts.map +1 -0
  166. package/lib/survey/questions/CSATQuestion.js +37 -0
  167. package/lib/survey/questions/CSATQuestion.js.map +1 -0
  168. package/lib/survey/questions/DateQuestion.d.ts +20 -0
  169. package/lib/survey/questions/DateQuestion.d.ts.map +1 -0
  170. package/lib/survey/questions/DateQuestion.js +103 -0
  171. package/lib/survey/questions/DateQuestion.js.map +1 -0
  172. package/lib/survey/questions/ImagePickerQuestion.d.ts +33 -0
  173. package/lib/survey/questions/ImagePickerQuestion.d.ts.map +1 -0
  174. package/lib/survey/questions/ImagePickerQuestion.js +68 -0
  175. package/lib/survey/questions/ImagePickerQuestion.js.map +1 -0
  176. package/lib/survey/questions/ImageQuestion.d.ts +26 -0
  177. package/lib/survey/questions/ImageQuestion.d.ts.map +1 -0
  178. package/lib/survey/questions/ImageQuestion.js +24 -0
  179. package/lib/survey/questions/ImageQuestion.js.map +1 -0
  180. package/lib/survey/questions/MatrixCell.d.ts +45 -0
  181. package/lib/survey/questions/MatrixCell.d.ts.map +1 -0
  182. package/lib/survey/questions/MatrixCell.js +54 -0
  183. package/lib/survey/questions/MatrixCell.js.map +1 -0
  184. package/lib/survey/questions/MatrixDropdownQuestion.d.ts +29 -0
  185. package/lib/survey/questions/MatrixDropdownQuestion.d.ts.map +1 -0
  186. package/lib/survey/questions/MatrixDropdownQuestion.js +42 -0
  187. package/lib/survey/questions/MatrixDropdownQuestion.js.map +1 -0
  188. package/lib/survey/questions/MatrixDynamicQuestion.d.ts +26 -0
  189. package/lib/survey/questions/MatrixDynamicQuestion.d.ts.map +1 -0
  190. package/lib/survey/questions/MatrixDynamicQuestion.js +52 -0
  191. package/lib/survey/questions/MatrixDynamicQuestion.js.map +1 -0
  192. package/lib/survey/questions/MatrixQuestion.d.ts +38 -0
  193. package/lib/survey/questions/MatrixQuestion.d.ts.map +1 -0
  194. package/lib/survey/questions/MatrixQuestion.js +64 -0
  195. package/lib/survey/questions/MatrixQuestion.js.map +1 -0
  196. package/lib/survey/questions/MultiTextQuestion.d.ts +19 -0
  197. package/lib/survey/questions/MultiTextQuestion.d.ts.map +1 -0
  198. package/lib/survey/questions/MultiTextQuestion.js +64 -0
  199. package/lib/survey/questions/MultiTextQuestion.js.map +1 -0
  200. package/lib/survey/questions/MultipleChoiceQuestion.d.ts +25 -0
  201. package/lib/survey/questions/MultipleChoiceQuestion.d.ts.map +1 -0
  202. package/lib/survey/questions/MultipleChoiceQuestion.js +111 -0
  203. package/lib/survey/questions/MultipleChoiceQuestion.js.map +1 -0
  204. package/lib/survey/questions/NPSQuestion.d.ts +18 -0
  205. package/lib/survey/questions/NPSQuestion.d.ts.map +1 -0
  206. package/lib/survey/questions/NPSQuestion.js +62 -0
  207. package/lib/survey/questions/NPSQuestion.js.map +1 -0
  208. package/lib/survey/questions/PanelDynamicQuestion.d.ts +50 -0
  209. package/lib/survey/questions/PanelDynamicQuestion.d.ts.map +1 -0
  210. package/lib/survey/questions/PanelDynamicQuestion.js +62 -0
  211. package/lib/survey/questions/PanelDynamicQuestion.js.map +1 -0
  212. package/lib/survey/questions/RankingQuestion.d.ts +34 -0
  213. package/lib/survey/questions/RankingQuestion.d.ts.map +1 -0
  214. package/lib/survey/questions/RankingQuestion.js +85 -0
  215. package/lib/survey/questions/RankingQuestion.js.map +1 -0
  216. package/lib/survey/questions/RatingQuestion.d.ts +20 -0
  217. package/lib/survey/questions/RatingQuestion.d.ts.map +1 -0
  218. package/lib/survey/questions/RatingQuestion.js +53 -0
  219. package/lib/survey/questions/RatingQuestion.js.map +1 -0
  220. package/lib/survey/questions/TextQuestion.d.ts +17 -0
  221. package/lib/survey/questions/TextQuestion.d.ts.map +1 -0
  222. package/lib/survey/questions/TextQuestion.js +46 -0
  223. package/lib/survey/questions/TextQuestion.js.map +1 -0
  224. package/lib/survey/styleContract.d.ts +230 -0
  225. package/lib/survey/styleContract.d.ts.map +1 -0
  226. package/lib/survey/styleContract.js +365 -0
  227. package/lib/survey/styleContract.js.map +1 -0
  228. package/lib/survey/themePalette.d.ts +56 -0
  229. package/lib/survey/themePalette.d.ts.map +1 -0
  230. package/lib/survey/themePalette.js +63 -0
  231. package/lib/survey/themePalette.js.map +1 -0
  232. package/lib/survey/translationLookup.d.ts +4 -0
  233. package/lib/survey/translationLookup.d.ts.map +1 -0
  234. package/lib/survey/translationLookup.js +62 -0
  235. package/lib/survey/translationLookup.js.map +1 -0
  236. package/lib/survey/validate.d.ts +3 -0
  237. package/lib/survey/validate.d.ts.map +1 -0
  238. package/lib/survey/validate.js +159 -0
  239. package/lib/survey/validate.js.map +1 -0
  240. package/lib/survey/variablesResolver.d.ts +10 -0
  241. package/lib/survey/variablesResolver.d.ts.map +1 -0
  242. package/lib/survey/variablesResolver.js +107 -0
  243. package/lib/survey/variablesResolver.js.map +1 -0
  244. package/lib/survey/voiceParsers.d.ts +47 -0
  245. package/lib/survey/voiceParsers.d.ts.map +1 -0
  246. package/lib/survey/voiceParsers.js +310 -0
  247. package/lib/survey/voiceParsers.js.map +1 -0
  248. package/lib/types.d.ts +349 -0
  249. package/lib/types.d.ts.map +1 -0
  250. package/lib/types.js +20 -0
  251. package/lib/types.js.map +1 -0
  252. package/metro.js +55 -0
  253. package/package.json +78 -0
@@ -0,0 +1,365 @@
1
+ "use strict";
2
+ /**
3
+ * Survey style contract — the shared theming vocabulary.
4
+ *
5
+ * Why this exists
6
+ * ---------------
7
+ * `customCss` cannot work on React Native: RN has no CSS engine, so arbitrary
8
+ * CSS has nothing to act on. Rather than accept a permanent styling gap between
9
+ * web and mobile, theming moves to a *structured* contract that both platforms
10
+ * implement. A customer brands once; it applies everywhere.
11
+ *
12
+ * The trade, stated honestly: this is comprehensive, not arbitrary. Every
13
+ * surface the renderer draws is themeable. Author-invented selectors, cascade
14
+ * tricks and layout restructuring are not — those stay web-only via `customCss`.
15
+ *
16
+ * Relationship to `themePalette.ts`
17
+ * ---------------------------------
18
+ * `ThemePalette` (9 fields) is the shipped subset of this contract and stays
19
+ * working — `toLegacyPalette()` derives it, so existing callers and any host app
20
+ * passing `brandingPalette` are unaffected. This widens the vocabulary from 9
21
+ * fields to full coverage of the ~200 style properties the native renderer sets.
22
+ *
23
+ * Web mapping
24
+ * -----------
25
+ * The web renderer exposes the same concepts as `--vp-color-*` / `--vp-fs-*`
26
+ * custom properties. Field names here are the canonical vocabulary; the web side
27
+ * maps onto them. `CSS_VAR_MAP` at the bottom records that mapping so the two
28
+ * cannot drift silently.
29
+ */
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.CSS_VAR_MAP = exports.LIGHT_CONTRACT = exports.DARK_CONTRACT = void 0;
32
+ exports.resolveStyleContract = resolveStyleContract;
33
+ exports.toLegacyPalette = toLegacyPalette;
34
+ exports.fromAuthoredPalette = fromAuthoredPalette;
35
+ /* ------------------------------------------------------------------ defaults */
36
+ /**
37
+ * Numeric defaults are the values the native renderer SHIPS, audited from the
38
+ * StyleSheets at git HEAD — not idealised values. Changing any of them changes
39
+ * how every unstyled survey looks, so they are deliberately unlovely:
40
+ * `ratingRadius` is 12 while `npsRadius` is 8 because the two components
41
+ * genuinely differ today. Unifying them is a design decision for later, not
42
+ * something this migration should smuggle in.
43
+ */
44
+ const SHARED = {
45
+ cardRadius: 20, // SurveyModal.card
46
+ cardPadding: 24, // SurveyModal.card
47
+ // Per-side padding. Unset means "use cardPadding", which is why these carry
48
+ // no numeric default — a default here would silently win over the shorthand.
49
+ cardPaddingTop: undefined,
50
+ cardPaddingRight: undefined,
51
+ cardPaddingBottom: undefined,
52
+ cardPaddingLeft: undefined,
53
+ inputRadius: 12, // TextQuestion / DateQuestion
54
+ optionRadius: 12, // MultipleChoiceQuestion row
55
+ ratingRadius: 12, // RatingQuestion button
56
+ npsRadius: 8, // NPSQuestion button — genuinely differs from rating
57
+ buttonRadius: 12, // SurveyModal back/next
58
+ buttonPaddingY: 14, // SurveyModal back/next — the prior literal
59
+ buttonFontSize: 15, // back/next label — the prior literal
60
+ fontSizeHeading: 20,
61
+ fontSizeLabel: 15,
62
+ fontSizeInput: 15,
63
+ fontSizeDescription: 13,
64
+ fontSizeSmall: 12,
65
+ fontWeightHeading: '600',
66
+ fontWeightLabel: '500',
67
+ lineHeightBody: 1.5,
68
+ fieldGap: 8, // RatingQuestion row gap
69
+ sectionGap: 20,
70
+ topRuleHeight: 0,
71
+ };
72
+ exports.DARK_CONTRACT = {
73
+ ...SHARED,
74
+ accent: '#D6F551',
75
+ accentHover: '#C3E144',
76
+ accentText: '#030712',
77
+ ground: 'rgba(0,0,0,0.6)',
78
+ card: 'rgba(17,24,39,0.95)',
79
+ cardBorder: 'rgba(255,255,255,0.1)',
80
+ input: 'rgba(255,255,255,0.06)',
81
+ inputBorder: 'rgba(255,255,255,0.12)',
82
+ inputText: '#ffffff',
83
+ placeholder: 'rgba(255,255,255,0.3)',
84
+ inputFocusBorder: '#D6F551',
85
+ inputErrorBorder: '#f87171',
86
+ // #f87171 (Tailwind red-400) is a deliberate SDK choice, tuned to read on the
87
+ // dark card — not the web renderer's danger red. See SurveyModal:1254.
88
+ errorText: '#f87171',
89
+ headingColor: '#ffffff',
90
+ textPrimary: '#ffffff',
91
+ textSecondary: 'rgba(255,255,255,0.8)',
92
+ textMuted: 'rgba(255,255,255,0.5)',
93
+ optionBg: 'rgba(255,255,255,0.06)',
94
+ optionBorder: 'rgba(255,255,255,0.12)',
95
+ optionSelectedBg: '#D6F5511A', // accent + 1A — matches the shipped `${primaryColor}1A`
96
+ optionSelectedBorder: '#D6F551',
97
+ indicatorBorder: 'rgba(255,255,255,0.3)',
98
+ indicatorChecked: '#D6F551',
99
+ // Audited from RatingQuestion/NPSQuestion StyleSheets — these are 0.08/0.15,
100
+ // deliberately NOT the palette's 0.06/0.12. In dark theme SurveyModal passes
101
+ // `palette={isLight ? palette : undefined}`, so the StyleSheet values are what
102
+ // actually render. Matching the palette here would change dark appearance.
103
+ ratingBg: 'rgba(255,255,255,0.08)',
104
+ ratingBorder: 'rgba(255,255,255,0.15)',
105
+ ratingText: 'rgba(255,255,255,0.8)',
106
+ ratingEmpty: 'rgba(255,255,255,0.3)',
107
+ ratingFilledBg: '#D6F551',
108
+ ratingFilledBorder: '#D6F551',
109
+ ratingFilledText: '#030712',
110
+ primaryBg: '#D6F551',
111
+ primaryText: '#030712',
112
+ primaryBorder: '#D6F551',
113
+ // Audited from SurveyModal.backButton — not 'transparent'/0.2 as first drafted.
114
+ secondaryBg: 'rgba(255,255,255,0.08)',
115
+ secondaryText: 'rgba(255,255,255,0.8)',
116
+ secondaryBorder: 'rgba(255,255,255,0.12)',
117
+ closeBg: 'rgba(255,255,255,0.1)',
118
+ closeText: 'rgba(255,255,255,0.6)',
119
+ brandNameColor: 'rgba(255,255,255,0.7)',
120
+ descriptionColor: 'rgba(255,255,255,0.6)',
121
+ progressText: 'rgba(255,255,255,0.4)',
122
+ progressTrack: 'rgba(255,255,255,0.08)',
123
+ requiredMark: '#ef4444',
124
+ chipBg: 'rgba(255,255,255,0.04)',
125
+ chipBorder: 'rgba(255,255,255,0.12)',
126
+ chipText: 'rgba(255,255,255,0.7)',
127
+ hintBg: 'rgba(255,255,255,0.04)',
128
+ hintBorder: 'rgba(255,255,255,0.08)',
129
+ hintText: 'rgba(255,255,255,0.55)',
130
+ topRuleColor: '#D6F551',
131
+ };
132
+ /** Not a naive inversion — values are re-chosen to hold contrast on a pale ground. */
133
+ exports.LIGHT_CONTRACT = {
134
+ ...SHARED,
135
+ accent: '#65a30d',
136
+ accentHover: '#4d7c0f',
137
+ accentText: '#ffffff',
138
+ ground: 'rgba(0,0,0,0.4)',
139
+ card: '#ffffff',
140
+ cardBorder: 'rgba(0,0,0,0.08)',
141
+ input: 'rgba(0,0,0,0.03)',
142
+ inputBorder: 'rgba(0,0,0,0.08)',
143
+ inputText: '#111827',
144
+ placeholder: 'rgba(0,0,0,0.4)',
145
+ inputFocusBorder: '#65a30d',
146
+ inputErrorBorder: '#C22F38',
147
+ errorText: '#C22F38',
148
+ headingColor: '#0f172a',
149
+ textPrimary: '#111827',
150
+ textSecondary: 'rgba(0,0,0,0.75)',
151
+ textMuted: 'rgba(0,0,0,0.5)',
152
+ // Mirrors LIGHT's palette.input — light-theme option rows used palette.input,
153
+ // not white. Verified by the equivalence test.
154
+ optionBg: 'rgba(0,0,0,0.03)',
155
+ optionBorder: 'rgba(0,0,0,0.08)',
156
+ optionSelectedBg: '#65a30d1A', // accent + 1A
157
+ optionSelectedBorder: '#65a30d',
158
+ indicatorBorder: 'rgba(0,0,0,0.25)',
159
+ indicatorChecked: '#65a30d',
160
+ // Light theme receives the palette, so these mirror LIGHT's input/border/
161
+ // textSecondary rather than the dark StyleSheet values.
162
+ ratingBg: 'rgba(0,0,0,0.03)',
163
+ ratingBorder: 'rgba(0,0,0,0.08)',
164
+ ratingText: 'rgba(0,0,0,0.75)',
165
+ ratingEmpty: 'rgba(0,0,0,0.3)',
166
+ ratingFilledBg: '#65a30d',
167
+ ratingFilledBorder: '#65a30d',
168
+ ratingFilledText: '#ffffff',
169
+ primaryBg: '#65a30d',
170
+ primaryText: '#ffffff',
171
+ primaryBorder: '#65a30d',
172
+ secondaryBg: 'rgba(0,0,0,0.06)',
173
+ secondaryText: 'rgba(0,0,0,0.75)',
174
+ secondaryBorder: 'rgba(0,0,0,0.12)',
175
+ closeBg: 'rgba(0,0,0,0.06)',
176
+ closeText: 'rgba(0,0,0,0.6)',
177
+ brandNameColor: 'rgba(0,0,0,0.7)',
178
+ descriptionColor: 'rgba(0,0,0,0.6)',
179
+ progressText: 'rgba(0,0,0,0.4)',
180
+ progressTrack: 'rgba(0,0,0,0.08)',
181
+ requiredMark: '#C22F38',
182
+ chipBg: 'rgba(0,0,0,0.04)',
183
+ chipBorder: 'rgba(0,0,0,0.12)',
184
+ chipText: 'rgba(0,0,0,0.7)',
185
+ hintBg: 'rgba(0,0,0,0.04)',
186
+ hintBorder: 'rgba(0,0,0,0.08)',
187
+ hintText: 'rgba(0,0,0,0.55)',
188
+ topRuleColor: '#65a30d',
189
+ };
190
+ /* ------------------------------------------------------------------ resolve */
191
+ /**
192
+ * Resolve the contract for a render.
193
+ *
194
+ * Precedence, HIGHEST first — deliberately identical to the shipped
195
+ * `themePalette()` so ownership rules do not change:
196
+ * 1. `initOverride` — the host app, via CXPinsight.init({ brandingPalette })
197
+ * 2. `surveyOverride` — survey.branding.palette
198
+ * 3. `primaryColor` — convenience, fans out to every accent-derived field
199
+ * 4. theme defaults (light | dark)
200
+ *
201
+ * The host app wins because it owns the surface the survey appears on: an app in
202
+ * a dark skin must be able to stop a survey rendering light inside it. This
203
+ * matches themePalette()'s documented layering — do not invert it.
204
+ *
205
+ * Also mirrors themePalette()'s *truthy* override test: a field present but
206
+ * empty/undefined falls through rather than blanking the value, which a plain
207
+ * object spread would not do.
208
+ */
209
+ function resolveStyleContract(args) {
210
+ const base = args.theme === 'light' ? exports.LIGHT_CONTRACT : exports.DARK_CONTRACT;
211
+ // A single primaryColor should be enough for most brands, so fan it out to
212
+ // every field an accent legitimately drives.
213
+ const fromPrimary = args.primaryColor
214
+ ? {
215
+ accent: args.primaryColor,
216
+ accentHover: args.primaryColor,
217
+ primaryBg: args.primaryColor,
218
+ primaryBorder: args.primaryColor,
219
+ inputFocusBorder: args.primaryColor,
220
+ indicatorChecked: args.primaryColor,
221
+ // Shipped behaviour: the selected option tint is the accent at 1A alpha.
222
+ optionSelectedBg: `${args.primaryColor}1A`,
223
+ optionSelectedBorder: args.primaryColor,
224
+ ratingFilledBg: args.primaryColor,
225
+ ratingFilledBorder: args.primaryColor,
226
+ topRuleColor: args.primaryColor,
227
+ }
228
+ : {};
229
+ const out = { ...base, ...fromPrimary };
230
+ const so = args.surveyOverride || {};
231
+ const io = args.initOverride || {};
232
+ // Iterate the UNION of base keys and override keys, not just the base:
233
+ // optional fields (fontFamily, fontFamilyHeading) have no default, so they are
234
+ // absent from `base` and iterating it alone made them impossible to set.
235
+ const keys = new Set([
236
+ ...Object.keys(base),
237
+ ...Object.keys(so),
238
+ ...Object.keys(io),
239
+ ]);
240
+ // Presence, not truthiness. A truthy test silently discarded every ZERO an
241
+ // author set — padding 0, radius 0, a square corner — because 0 is falsy. It
242
+ // was invisible while the contract held only colours and non-zero sizes; per-
243
+ // side padding makes 0 an ordinary value, so the test has to mean what it says.
244
+ const isSet = (v) => v !== undefined && v !== null && v !== '';
245
+ keys.forEach((k) => {
246
+ if (isSet(io[k]))
247
+ out[k] = io[k];
248
+ else if (isSet(so[k]))
249
+ out[k] = so[k];
250
+ });
251
+ return out;
252
+ }
253
+ /** Existing callers of themePalette() keep the exact same shape. */
254
+ function toLegacyPalette(c) {
255
+ return {
256
+ card: c.card,
257
+ cardBorder: c.cardBorder,
258
+ input: c.input,
259
+ inputBorder: c.inputBorder,
260
+ textPrimary: c.textPrimary,
261
+ textSecondary: c.textSecondary,
262
+ textMuted: c.textMuted,
263
+ placeholder: c.placeholder,
264
+ indicatorBorder: c.indicatorBorder,
265
+ };
266
+ }
267
+ /* ------------------------------------------------------------- web alignment */
268
+ /**
269
+ * Which web custom property carries each contract field.
270
+ *
271
+ * `null` means the web renderer has no dedicated property yet — those are the
272
+ * additive gaps to fill so both platforms cover the same surface. Recording
273
+ * them here (rather than in prose) means a golden test can assert the two
274
+ * implementations haven't drifted.
275
+ */
276
+ exports.CSS_VAR_MAP = {
277
+ accent: '--vp-color-accent',
278
+ accentHover: '--vp-color-accent-dark',
279
+ accentText: null,
280
+ card: null,
281
+ cardBorder: null,
282
+ input: '--vp-color-input-bg',
283
+ inputBorder: '--vp-color-input-border',
284
+ inputText: '--vp-color-text',
285
+ placeholder: null,
286
+ textPrimary: '--vp-color-text',
287
+ textSecondary: '--vp-color-text-muted',
288
+ textMuted: '--vp-color-text-faint',
289
+ indicatorBorder: null,
290
+ fontFamily: '--vp-font-family',
291
+ fontSizeLabel: '--vp-fs-label',
292
+ fontSizeInput: '--vp-fs-input',
293
+ fontSizeDescription: '--vp-fs-desc',
294
+ fontSizeSmall: '--vp-fs-error',
295
+ cardRadius: '--vp-radius',
296
+ };
297
+ /**
298
+ * Translate an authored palette into a contract override.
299
+ *
300
+ * One author field legitimately fans out to several contract fields: `border`
301
+ * covers input, option and rating outlines, because the web renderer's single
302
+ * `--vp-color-input-border` reaches all three.
303
+ *
304
+ * ⚠ The text tiers are OFF BY ONE between the two vocabularies:
305
+ * authored `text` → contract `textPrimary`
306
+ * authored `textMuted` → contract `textSecondary` (not `textMuted`!)
307
+ * authored `textFaint` → contract `textMuted` + `placeholder`
308
+ * This mirrors the web token names exactly. Do not "simplify" it.
309
+ *
310
+ * Keys that are already contract field names pass through untouched, so a
311
+ * palette written against the SDK vocabulary still works.
312
+ */
313
+ function fromAuthoredPalette(authored) {
314
+ if (!authored)
315
+ return {};
316
+ const a = authored;
317
+ const out = {};
318
+ const set = (k, v) => {
319
+ if (v)
320
+ out[k] = v;
321
+ };
322
+ // Surface
323
+ set('ground', a.bg);
324
+ // Text tiers — note the deliberate off-by-one against the authored names.
325
+ set('textPrimary', a.text);
326
+ set('inputText', a.text);
327
+ set('headingColor', a.text);
328
+ set('textSecondary', a.textMuted);
329
+ set('ratingText', a.textMuted);
330
+ set('textMuted', a.textFaint);
331
+ set('placeholder', a.textFaint);
332
+ // Borders — one authored field, three surfaces.
333
+ set('cardBorder', a.border);
334
+ set('inputBorder', a.border);
335
+ set('optionBorder', a.border);
336
+ set('ratingBorder', a.border);
337
+ // Card-ish surfaces
338
+ set('card', a.cardBg);
339
+ set('optionBg', a.cardBg);
340
+ // Input-ish surfaces
341
+ set('input', a.inputBg);
342
+ set('ratingBg', a.inputBg);
343
+ // Touch has no hover; the nearest meaningful analogue is the selected row.
344
+ set('optionSelectedBg', a.hoverBg);
345
+ // Pass through anything already named as a contract field, so a palette
346
+ // authored against the SDK vocabulary (or a future widened editor) still works.
347
+ //
348
+ // AUTHORED_KEYS is excluded because `textMuted` exists in BOTH vocabularies
349
+ // with DIFFERENT meanings: authored `textMuted` is the SECONDARY tier, while
350
+ // contract `textMuted` is the FAINT tier. Without this exclusion the loop
351
+ // clobbers the correctly-mapped value with the wrong tier.
352
+ const AUTHORED_KEYS = new Set([
353
+ 'bg', 'text', 'textMuted', 'textFaint', 'border', 'cardBg', 'inputBg', 'hoverBg',
354
+ ]);
355
+ const contractKeys = Object.keys(exports.DARK_CONTRACT);
356
+ for (const k of contractKeys) {
357
+ if (AUTHORED_KEYS.has(k))
358
+ continue;
359
+ const v = a[k];
360
+ if (v)
361
+ out[k] = v;
362
+ }
363
+ return out;
364
+ }
365
+ //# sourceMappingURL=styleContract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styleContract.js","sourceRoot":"","sources":["../../src/survey/styleContract.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;;;;AA0IH,iFAAiF;AAEjF;;;;;;;GAOG;AACH,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,EAAE,EAAW,mBAAmB;IAC5C,WAAW,EAAE,EAAE,EAAU,mBAAmB;IAC5C,4EAA4E;IAC5E,6EAA6E;IAC7E,cAAc,EAAE,SAA8B;IAC9C,gBAAgB,EAAE,SAA8B;IAChD,iBAAiB,EAAE,SAA8B;IACjD,eAAe,EAAE,SAA8B;IAC/C,WAAW,EAAE,EAAE,EAAU,8BAA8B;IACvD,YAAY,EAAE,EAAE,EAAS,6BAA6B;IACtD,Y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AAqB;IACrB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IACxB,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAE3B,2EAA2E;IAC3E,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAEnC,wEAAwE;IACxE,gFAAgF;IAChF,EAAE;IACF,4EAA4E;IAC5E,6EAA6E;IAC7E,0EAA0E;IAC1E,2DAA2D;IAC3D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;QAC5B,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS;KACjF,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,QAAA,aAAa,CAAqC,CAAC;IACpF,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC;QAC7B,IAAI,aAAa,CAAC,GAAG,CAAC,CAAW,CAAC;YAAE,SAAS;QAC7C,MAAM,CAAC,GAAG,CAAC,CAAC,CAAW,CAAC,CAAC;QACzB,IAAI,CAAC;YAAG,GAAG,CAAC,CAAC,CAAa,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,56 @@
1
+ export type ThemeName = 'light' | 'dark';
2
+ export interface ThemePalette {
3
+ card: string;
4
+ cardBorder: string;
5
+ input: string;
6
+ inputBorder: string;
7
+ textPrimary: string;
8
+ textSecondary: string;
9
+ textMuted: string;
10
+ placeholder: string;
11
+ indicatorBorder: string;
12
+ }
13
+ /** Overrides shape accepted from either the survey's own branding or the
14
+ * host app's CXPinsight.init({ brandingPalette }). Every field optional
15
+ * so a caller can partial-override just what they care about. */
16
+ export interface PaletteOverride {
17
+ card?: string;
18
+ cardBorder?: string;
19
+ input?: string;
20
+ inputBorder?: string;
21
+ textPrimary?: string;
22
+ textSecondary?: string;
23
+ textMuted?: string;
24
+ placeholder?: string;
25
+ indicatorBorder?: string;
26
+ }
27
+ /** A platform/SDK named theme. `palette` carries per-mode overrides so a named
28
+ * theme resolves straight into themePalette()'s initOverride layer. */
29
+ export interface NamedTheme {
30
+ name: string;
31
+ label?: string;
32
+ theme?: ThemeName;
33
+ primaryColor?: string;
34
+ palette?: {
35
+ light?: PaletteOverride;
36
+ dark?: PaletteOverride;
37
+ };
38
+ }
39
+ /** Resolve init({ theme }) against the platform's named-theme library.
40
+ * Ownership (decided with the user): a platform theme of the same name
41
+ * OVERRIDES an SDK-supplied inline theme; else the SDK inline theme is used;
42
+ * else null (fall through to the survey/app default). `initTheme` is either a
43
+ * name string or an inline NamedTheme object. Pure — safe to unit-test. */
44
+ export declare function resolveNamedTheme(initTheme: string | NamedTheme | undefined | null, applicationThemes?: NamedTheme[] | null): NamedTheme | null;
45
+ /** Extract the PaletteOverride for the active mode from a resolved named theme,
46
+ * ready to pass as themePalette()'s initOverride. */
47
+ export declare function namedThemePaletteOverride(resolved: NamedTheme | null, mode: ThemeName): PaletteOverride | undefined;
48
+ /** Palette resolver with layered overrides (parity with the web widget's
49
+ * themePalette). Precedence highest → lowest:
50
+ * 1. `initOverride` — app passed to CXPinsight.init({ brandingPalette })
51
+ * 2. `surveyOverride` — survey.branding.palette on the survey definition
52
+ * 3. built-in DARK / LIGHT defaults
53
+ * Missing fields at each layer fall through — an author can override just
54
+ * `card` and leave everything else default. */
55
+ export declare function themePalette(theme: ThemeName | undefined, surveyOverride?: PaletteOverride, initOverride?: PaletteOverride): ThemePalette;
56
+ //# sourceMappingURL=themePalette.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themePalette.d.ts","sourceRoot":"","sources":["../../src/survey/themePalette.ts"],"names":[],"mappings":"AAoBA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzC,MAAM,WAAW,YAAY;IAE3B,IAAI,EAAS,MAAM,CAAC;IACpB,UAAU,EAAG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gB,YAAY,CAC1B,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,cAAc,CAAC,EAAE,eAAe,EAChC,YAAY,CAAC,EAAE,eAAe,GAC7B,YAAY,CAMd"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ // Theme palette (spec §24 branding.theme). Every surface color the
3
+ // mobile modal + question components render — bg, border, text
4
+ // variants, input backgrounds — routed through this single helper so
5
+ // the light-theme override lands in ONE place instead of duplicating
6
+ // the palette lookup at every StyleSheet site.
7
+ //
8
+ // Design decisions:
9
+ // - Dark is the SDK default. When the caller omits `theme` or
10
+ // passes anything but 'light', the palette returns the same
11
+ // values the base StyleSheets already hardcode; question
12
+ // components use `theme?.textPrimary` with a fallback so a
13
+ // missing palette silently keeps LTR/dark behavior.
14
+ // - Light-theme values match the web renderer's design tokens
15
+ // (near-black on white card, subtle grey borders, low-opacity
16
+ // muted secondary text).
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.resolveNamedTheme = resolveNamedTheme;
19
+ exports.namedThemePaletteOverride = namedThemePaletteOverride;
20
+ exports.themePalette = themePalette;
21
+ const styleContract_1 = require("./styleContract");
22
+ // Derived, not restated. styleContract.ts is the single source of truth for
23
+ // every value; these two exist so the shipped 9-field shape keeps working.
24
+ // A golden test asserts these stay byte-identical to what shipped.
25
+ const DARK = (0, styleContract_1.toLegacyPalette)(styleContract_1.DARK_CONTRACT);
26
+ const LIGHT = (0, styleContract_1.toLegacyPalette)(styleContract_1.LIGHT_CONTRACT);
27
+ /** Resolve init({ theme }) against the platform's named-theme library.
28
+ * Ownership (decided with the user): a platform theme of the same name
29
+ * OVERRIDES an SDK-supplied inline theme; else the SDK inline theme is used;
30
+ * else null (fall through to the survey/app default). `initTheme` is either a
31
+ * name string or an inline NamedTheme object. Pure — safe to unit-test. */
32
+ function resolveNamedTheme(initTheme, applicationThemes) {
33
+ if (!initTheme)
34
+ return null;
35
+ const name = typeof initTheme === 'string' ? initTheme : initTheme.name;
36
+ const lib = Array.isArray(applicationThemes) ? applicationThemes : [];
37
+ const platformMatch = name ? lib.find((t) => t && t.name === name) : undefined;
38
+ if (platformMatch)
39
+ return platformMatch; // platform overrides SDK
40
+ if (typeof initTheme === 'object')
41
+ return initTheme; // SDK inline theme
42
+ return null; // name-only, no library match
43
+ }
44
+ /** Extract the PaletteOverride for the active mode from a resolved named theme,
45
+ * ready to pass as themePalette()'s initOverride. */
46
+ function namedThemePaletteOverride(resolved, mode) {
47
+ if (!resolved || !resolved.palette)
48
+ return undefined;
49
+ return resolved.palette[mode];
50
+ }
51
+ /** Palette resolver with layered overrides (parity with the web widget's
52
+ * themePalette). Precedence highest → lowest:
53
+ * 1. `initOverride` — app passed to CXPinsight.init({ brandingPalette })
54
+ * 2. `surveyOverride` — survey.branding.palette on the survey definition
55
+ * 3. built-in DARK / LIGHT defaults
56
+ * Missing fields at each layer fall through — an author can override just
57
+ * `card` and leave everything else default. */
58
+ function themePalette(theme, surveyOverride, initOverride) {
59
+ // Delegates to the contract resolver so precedence lives in exactly one
60
+ // place. Behaviour is unchanged — see the golden test.
61
+ return (0, styleContract_1.toLegacyPalette)((0, styleContract_1.resolveStyleContract)({ theme, surveyOverride, initOverride }));
62
+ }
63
+ //# sourceMappingURL=themePalette.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themePalette.js","sourceRoot":"","sources":["../../src/survey/themePalette.ts"],"names":[],"mappings":";AAAA,mEAAmE;AACnE,+DAA+D;AAC/D,qEAAqE;AACrE,qEAAqE;AACrE,+CAA+C;AAC/C,EAAE;AACF,oBAAoB;AACpB,gEAAgE;AAChE,gEAAgE;AAChE,6DAA6D;AAC7D,+DAA+D;AAC/D,wDAAwD;AACxD,gEAAgE;AAChE,kEAAkE;AAClE,6BAA6B;;;;;AAE7B,mDAEyB;AAmBzB,4EAA4E;AAC5E,2EAA2E;AAC3E,mEAAmE;AACnE,MAAM,IAAI,GAAiB,IAAA,+BAAe,EAAC,6BAAa,CAAC,CAAC;AAE1D,MAAM,K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yText(survey: SurveyDefinition, lang: string | undefined, field: 'title' | 'description' | 'thankYouMessage', fallback: string | undefined): string | undefined;
3
+ export declare function questionText(survey: SurveyDefinition, lang: string | undefined, qId: string, field: 'text' | 'description', fallback: string | undefined): string | undefined;
4
+ //# sourceMappingURL=translationLookup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translationLookup.d.ts","sourceRoot":"","sources":["../../src/survey/translationLookup.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAmBjD,wBAAgB,UAAU,CACxB,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,iBAAiB,EAClD,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,GAAG,SAAS,CAKpB;AAKD,wBAAgB,YAAY,CAC1B,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GAAG,aAAa,EAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,GAAG,SAAS,CASpB"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ // Translation text lookup — spec §26.1 shape:
3
+ //
4
+ // translations[langCode] = {
5
+ // title?, description?, thankYouMessage?,
6
+ // questions?: { [qId]: { text?, description?, ... } },
7
+ // sections?: { [sId]: { title?, description? } },
8
+ // }
9
+ //
10
+ // Callers pass the survey definition, the currently-selected
11
+ // language code, and the field path they want localized. The lookup
12
+ // walks translations[lang] and returns the override if present,
13
+ // otherwise the caller-supplied fallback (usually the authored text
14
+ // on the base question/survey object).
15
+ //
16
+ // Defensive lookup — the translations blob is stored as
17
+ // Record<string, unknown> at the type level, so every hop is
18
+ // null-safe. A malformed translations key (e.g. `questions` as an
19
+ // array instead of a map) silently falls through to the fallback,
20
+ // matching web renderer behavior.
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.surveyText = surveyText;
23
+ exports.questionText = questionText;
24
+ // Read `translations[lang]` cheaply and safely. Returns null when
25
+ // there's no entry for this language OR when the entry isn't an
26
+ // object (older servers occasionally send an empty string).
27
+ function translationsFor(survey, lang) {
28
+ if (!lang)
29
+ return null;
30
+ const t = survey.translations?.[lang];
31
+ if (!t || typeof t !== 'object' || Array.isArray(t))
32
+ return null;
33
+ return t;
34
+ }
35
+ // Survey-level string lookup: title, description, thankYouMessage.
36
+ // Falls back to `fallback` when the translations override is absent
37
+ // or empty (empty string is treated as "no translation" per web
38
+ // renderer — otherwise a blank `title` field silently blanks the UI).
39
+ function surveyText(survey, lang, field, fallback) {
40
+ const t = translationsFor(survey, lang);
41
+ const v = t?.[field];
42
+ if (typeof v === 'string' && v.length > 0)
43
+ return v;
44
+ return fallback;
45
+ }
46
+ // Question-level string lookup — `text` or `description`.
47
+ // translations[lang].questions[qId][field] takes precedence over the
48
+ // authored field on the question object.
49
+ function questionText(survey, lang, qId, field, fallback) {
50
+ const t = translationsFor(survey, lang);
51
+ const questions = t?.questions;
52
+ if (!questions || typeof questions !== 'object' || Array.isArray(questions))
53
+ return fallback;
54
+ const q = questions[qId];
55
+ if (!q || typeof q !== 'object' || Array.isArray(q))
56
+ return fallback;
57
+ const v = q[field];
58
+ if (typeof v === 'string' && v.length > 0)
59
+ return v;
60
+ return fallback;
61
+ }
62
+ //# sourceMappingURL=translationLookup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translationLookup.js","sourceRoot":"","sources":["../../src/survey/translationLookup.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,EAAE;AACF,+BAA+B;AAC/B,8CAA8C;AAC9C,2DAA2D;AAC3D,uDAAuD;AACvD,MAAM;AACN,EAAE;AACF,6DAA6D;AAC7D,oEAAoE;AACpE,gEAAgE;AAChE,oEAAoE;AACpE,uCAAuC;AACvC,EAAE;AACF,wDAAwD;AACxD,6DAA6D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I,OAAO,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,QAAQ,CAAC;IACrE,MAAM,CAAC,GAAI,CAA6B,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IACpD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { SurveyQuestion } from '../types';
2
+ export declare function validateAnswer(question: SurveyQuestion, value: unknown): string | null;
3
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/survey/validate.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK/C,wBAAgB,cAAc,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAWtF"}