react-native-my-survey-sdk 3.1.2 → 3.1.3
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/components/XeboDropdownView.d.ts.map +1 -1
- package/dist/components/XeboDropdownView.js +10 -6
- package/dist/components/XeboIntroView.d.ts.map +1 -1
- package/dist/components/XeboIntroView.js +3 -2
- package/dist/components/XeboLanguageView.d.ts +11 -0
- package/dist/components/XeboLanguageView.d.ts.map +1 -0
- package/dist/components/XeboLanguageView.js +90 -0
- package/dist/components/XeboMultiNPSView.d.ts.map +1 -1
- package/dist/components/XeboMultiNPSView.js +9 -7
- package/dist/components/XeboMultiRatingView.d.ts.map +1 -1
- package/dist/components/XeboMultiRatingView.js +9 -7
- package/dist/components/XeboMultipleChoiceView.d.ts.map +1 -1
- package/dist/components/XeboMultipleChoiceView.js +10 -8
- package/dist/components/XeboNPSView.d.ts.map +1 -1
- package/dist/components/XeboNPSView.js +15 -13
- package/dist/components/XeboRatingView.d.ts.map +1 -1
- package/dist/components/XeboRatingView.js +10 -8
- package/dist/components/XeboSingleChoiceView.d.ts.map +1 -1
- package/dist/components/XeboSingleChoiceView.js +10 -8
- package/dist/components/XeboSurveyModal.d.ts.map +1 -1
- package/dist/components/XeboSurveyModal.js +96 -18
- package/dist/components/XeboTextBoxView.d.ts.map +1 -1
- package/dist/components/XeboTextBoxView.js +10 -7
- package/dist/components/XeboThankYouView.d.ts.map +1 -1
- package/dist/components/XeboThankYouView.js +3 -2
- package/dist/core/XeboLanguageService.d.ts +28 -0
- package/dist/core/XeboLanguageService.d.ts.map +1 -0
- package/dist/core/XeboLanguageService.js +261 -0
- package/dist/core/XeboNetworkService.d.ts +12 -2
- package/dist/core/XeboNetworkService.d.ts.map +1 -1
- package/dist/core/XeboNetworkService.js +27 -11
- package/dist/core/XeboSurveyManager.d.ts +22 -1
- package/dist/core/XeboSurveyManager.d.ts.map +1 -1
- package/dist/core/XeboSurveyManager.js +140 -39
- package/dist/i18n/XeboRtl.d.ts +11 -0
- package/dist/i18n/XeboRtl.d.ts.map +1 -0
- package/dist/i18n/XeboRtl.js +21 -0
- package/dist/i18n/XeboStrings.d.ts +29 -0
- package/dist/i18n/XeboStrings.d.ts.map +1 -0
- package/dist/i18n/XeboStrings.js +59 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/models/XeboAPIModels.d.ts +10 -1
- package/dist/models/XeboAPIModels.d.ts.map +1 -1
- package/dist/models/XeboLanguageModels.d.ts +62 -0
- package/dist/models/XeboLanguageModels.d.ts.map +1 -0
- package/dist/models/XeboLanguageModels.js +3 -0
- package/dist/models/XeboModels.d.ts +7 -0
- package/dist/models/XeboModels.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -37,14 +37,18 @@ const uuidv4 = () => 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c =
|
|
|
37
37
|
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
|
|
38
38
|
});
|
|
39
39
|
const XeboNetworkService_1 = require("./XeboNetworkService");
|
|
40
|
+
const XeboLanguageService_1 = require("./XeboLanguageService");
|
|
40
41
|
const XeboOfflineQueue_1 = require("./XeboOfflineQueue");
|
|
41
42
|
const XeboTheme_1 = require("../theme/XeboTheme");
|
|
43
|
+
const XeboStrings_1 = require("../i18n/XeboStrings");
|
|
42
44
|
// ─── Event names ──────────────────────────────────────────────────────────────
|
|
43
45
|
exports.XEBO_EVENTS = {
|
|
44
46
|
SURVEY_LOADED: 'survey_loaded',
|
|
45
47
|
QUESTION_CHANGED: 'question_changed',
|
|
46
48
|
SURVEY_VISIBLE: 'survey_visible',
|
|
47
49
|
SURVEY_DISMISSED: 'survey_dismissed',
|
|
50
|
+
LANGUAGE_PAGE: 'language_page',
|
|
51
|
+
LANGUAGE_SELECTED: 'language_selected',
|
|
48
52
|
};
|
|
49
53
|
// ─── Singleton class ──────────────────────────────────────────────────────────
|
|
50
54
|
class XeboSurveyManagerClass extends SimpleEventEmitter {
|
|
@@ -70,6 +74,12 @@ class XeboSurveyManagerClass extends SimpleEventEmitter {
|
|
|
70
74
|
this.resolvedCollectorUUID = '';
|
|
71
75
|
this.resolvedCollectorMongoId = '';
|
|
72
76
|
this.surveyVisible = false;
|
|
77
|
+
// Language
|
|
78
|
+
this.rawSurveyData = null;
|
|
79
|
+
this.resolvedSurveyId = '';
|
|
80
|
+
this.languagePage = null;
|
|
81
|
+
/** Bumped on dismiss and on each pick, so a stale translation never opens the survey. */
|
|
82
|
+
this.languageLoadToken = 0;
|
|
73
83
|
// Timing / quality
|
|
74
84
|
this.surveyStartEpoch = 0;
|
|
75
85
|
this.questionStartEpoch = 0;
|
|
@@ -82,6 +92,7 @@ class XeboSurveyManagerClass extends SimpleEventEmitter {
|
|
|
82
92
|
configure(config) {
|
|
83
93
|
this.apiKey = config.apiKey;
|
|
84
94
|
this.collectorId = config.collectorId;
|
|
95
|
+
this.onLanguageSelected = config.onLanguageSelected;
|
|
85
96
|
this.resolvedZone = config.zone;
|
|
86
97
|
this.baseURL = (0, XeboNetworkService_1.buildBaseURL)(this.resolvedZone);
|
|
87
98
|
this.feedbackBaseURL = (0, XeboNetworkService_1.buildFeedbackBaseURL)(this.resolvedZone);
|
|
@@ -125,62 +136,149 @@ class XeboSurveyManagerClass extends SimpleEventEmitter {
|
|
|
125
136
|
}
|
|
126
137
|
// ─── Background pre-fetch ──────────────────────────────────────────────────
|
|
127
138
|
async _prefetchSurvey() {
|
|
139
|
+
var _a;
|
|
128
140
|
try {
|
|
129
141
|
console.log('[Xebo] Pre-fetching survey in background...');
|
|
130
|
-
await this.
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.survey = survey;
|
|
136
|
-
this.emit(exports.XEBO_EVENTS.SURVEY_LOADED, survey);
|
|
137
|
-
console.log('[Xebo] Pre-fetch done —', survey.questions.length, 'questions ready');
|
|
142
|
+
await this._loadSurveyData();
|
|
143
|
+
const survey = this.survey;
|
|
144
|
+
if (survey)
|
|
145
|
+
this.emit(exports.XEBO_EVENTS.SURVEY_LOADED, survey);
|
|
146
|
+
console.log('[Xebo] Pre-fetch done —', (_a = survey === null || survey === void 0 ? void 0 : survey.questions.length) !== null && _a !== void 0 ? _a : 0, 'questions ready');
|
|
138
147
|
}
|
|
139
148
|
catch (err) {
|
|
140
149
|
console.warn('[Xebo] Pre-fetch failed (will retry on fetchAndPresentSurvey):', err);
|
|
141
150
|
}
|
|
142
151
|
}
|
|
152
|
+
/** Resolves token + collector + raw survey JSON, and parses the primary language. */
|
|
153
|
+
async _loadSurveyData(surveyId) {
|
|
154
|
+
await this._verifyAndGetToken();
|
|
155
|
+
const collector = await (0, XeboNetworkService_1.fetchCollector)(this.baseURL, this.collectorId, this.bearerToken);
|
|
156
|
+
this.resolvedCollectorUUID = collector.uuid;
|
|
157
|
+
this.resolvedCollectorMongoId = collector.mongoId;
|
|
158
|
+
this.resolvedSurveyId = surveyId !== null && surveyId !== void 0 ? surveyId : collector.surveyId;
|
|
159
|
+
this.rawSurveyData = await (0, XeboNetworkService_1.fetchSurveyRaw)(this.baseURL, this.resolvedSurveyId, this.bearerToken);
|
|
160
|
+
(0, XeboStrings_1.resetStrings)();
|
|
161
|
+
this.survey = (0, XeboNetworkService_1.parseSurvey)(this.rawSurveyData);
|
|
162
|
+
}
|
|
143
163
|
// ─── Main flow ─────────────────────────────────────────────────────────────
|
|
144
|
-
|
|
164
|
+
/** Collector-driven flow; `language` (e.g. "ar") skips the language page. */
|
|
165
|
+
async fetchAndPresentSurvey(language) {
|
|
166
|
+
return this._present(undefined, language);
|
|
167
|
+
}
|
|
168
|
+
/** Same flow for an explicit survey, still using the configured collector to submit. */
|
|
169
|
+
async fetchAndPresentSurveyById(surveyId, language) {
|
|
170
|
+
return this._present(surveyId, language);
|
|
171
|
+
}
|
|
172
|
+
async _present(surveyId, language) {
|
|
145
173
|
try {
|
|
146
|
-
|
|
147
|
-
|
|
174
|
+
const cached = this.rawSurveyData
|
|
175
|
+
&& this.resolvedCollectorUUID
|
|
176
|
+
&& (!surveyId || surveyId === this.resolvedSurveyId);
|
|
177
|
+
if (cached) {
|
|
148
178
|
console.log('[Xebo] Survey already cached — showing instantly');
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
this.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
this.
|
|
156
|
-
this.emit(exports.XEBO_EVENTS.SURVEY_LOADED, this.survey);
|
|
157
|
-
this._setVisible(true);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
await this._loadSurveyData(surveyId);
|
|
182
|
+
}
|
|
183
|
+
const raw = this.rawSurveyData;
|
|
184
|
+
if (raw && (0, XeboLanguageService_1.shouldShowLanguagePage)(raw, language)) {
|
|
185
|
+
this._presentLanguagePage(raw);
|
|
158
186
|
return;
|
|
159
187
|
}
|
|
160
|
-
|
|
161
|
-
console.log('[Xebo] Step 0: verifyApiKey');
|
|
162
|
-
await this._verifyAndGetToken();
|
|
163
|
-
console.log('[Xebo] Step 1: fetchCollector');
|
|
164
|
-
const collector = await (0, XeboNetworkService_1.fetchCollector)(this.baseURL, this.collectorId, this.bearerToken);
|
|
165
|
-
this.resolvedCollectorUUID = collector.uuid;
|
|
166
|
-
this.resolvedCollectorMongoId = collector.mongoId;
|
|
167
|
-
console.log('[Xebo] Step 2: fetchSurvey');
|
|
168
|
-
const survey = await (0, XeboNetworkService_1.fetchSurvey)(this.baseURL, collector.surveyId, this.bearerToken);
|
|
169
|
-
this.survey = survey;
|
|
170
|
-
this.currentAnswers = [];
|
|
171
|
-
this.currentQuestionIndex = 0;
|
|
172
|
-
this.surveyStartTime = new Date().toISOString();
|
|
173
|
-
this.surveyStartEpoch = Date.now();
|
|
174
|
-
this.questionStartEpoch = Date.now();
|
|
175
|
-
this.timePerQues = {};
|
|
176
|
-
this.backTrackCount = 0;
|
|
177
|
-
this.emit(exports.XEBO_EVENTS.SURVEY_LOADED, survey);
|
|
178
|
-
this._setVisible(true);
|
|
188
|
+
await this._presentInLanguage(raw ? (0, XeboLanguageService_1.findLanguageOption)(raw, language) : undefined);
|
|
179
189
|
}
|
|
180
190
|
catch (err) {
|
|
181
191
|
console.error('[Xebo] fetchAndPresentSurvey failed:', err);
|
|
182
192
|
}
|
|
183
193
|
}
|
|
194
|
+
// ─── Language ──────────────────────────────────────────────────────────────
|
|
195
|
+
_presentLanguagePage(raw) {
|
|
196
|
+
this.languageLoadToken += 1;
|
|
197
|
+
(0, XeboStrings_1.resetStrings)();
|
|
198
|
+
this.languagePage = (0, XeboLanguageService_1.buildLanguagePage)(raw);
|
|
199
|
+
console.log('[Xebo] Showing language page —', this.languagePage.options.length, 'options');
|
|
200
|
+
this.emit(exports.XEBO_EVENTS.LANGUAGE_PAGE, this.languagePage);
|
|
201
|
+
this._setVisible(true);
|
|
202
|
+
}
|
|
203
|
+
/** Called by the language page; loads the translation then swaps in the first question. */
|
|
204
|
+
async selectLanguage(langKey) {
|
|
205
|
+
var _a;
|
|
206
|
+
const raw = this.rawSurveyData;
|
|
207
|
+
if (!raw)
|
|
208
|
+
return;
|
|
209
|
+
const option = (0, XeboLanguageService_1.findLanguageOption)(raw, langKey);
|
|
210
|
+
if (!option)
|
|
211
|
+
return;
|
|
212
|
+
this.emit(exports.XEBO_EVENTS.LANGUAGE_SELECTED, option.langKey);
|
|
213
|
+
try {
|
|
214
|
+
(_a = this.onLanguageSelected) === null || _a === void 0 ? void 0 : _a.call(this, option.langKey);
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
console.warn('[Xebo] onLanguageSelected threw:', err);
|
|
218
|
+
}
|
|
219
|
+
await this._presentInLanguage(option);
|
|
220
|
+
}
|
|
221
|
+
async _presentInLanguage(option) {
|
|
222
|
+
var _a, _b;
|
|
223
|
+
const raw = this.rawSurveyData;
|
|
224
|
+
if (!raw)
|
|
225
|
+
return;
|
|
226
|
+
this.languageLoadToken += 1;
|
|
227
|
+
const token = this.languageLoadToken;
|
|
228
|
+
if (!option || option.isPrimary) {
|
|
229
|
+
(0, XeboStrings_1.resetStrings)();
|
|
230
|
+
this.survey = (0, XeboNetworkService_1.parseSurvey)(raw, { langKey: option === null || option === void 0 ? void 0 : option.langKey, direction: option === null || option === void 0 ? void 0 : option.direction });
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
try {
|
|
234
|
+
const bundle = await (0, XeboLanguageService_1.fetchTranslation)(this.baseURL, raw.uuid, option, this.bearerToken);
|
|
235
|
+
if (token !== this.languageLoadToken) {
|
|
236
|
+
console.log('[Xebo] Language load superseded — not presenting');
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const direction = this._resolveDirection(option, (_a = bundle.script) === null || _a === void 0 ? void 0 : _a.direction);
|
|
240
|
+
(0, XeboStrings_1.configureStrings)({
|
|
241
|
+
langKey: option.langKey,
|
|
242
|
+
direction,
|
|
243
|
+
surveyEntry: (_b = bundle.textMapping[raw.uuid]) !== null && _b !== void 0 ? _b : undefined,
|
|
244
|
+
script: bundle.script,
|
|
245
|
+
});
|
|
246
|
+
this.survey = (0, XeboNetworkService_1.parseSurvey)((0, XeboLanguageService_1.applyTranslation)(raw, bundle.textMapping), {
|
|
247
|
+
localized: true,
|
|
248
|
+
langKey: option.langKey,
|
|
249
|
+
direction,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
catch (err) {
|
|
253
|
+
// A failed translation must not fail the load — fall back to the primary language.
|
|
254
|
+
console.warn('[Xebo] getLanguage failed — showing primary language:', err);
|
|
255
|
+
if (token !== this.languageLoadToken)
|
|
256
|
+
return;
|
|
257
|
+
(0, XeboStrings_1.resetStrings)();
|
|
258
|
+
this.survey = (0, XeboNetworkService_1.parseSurvey)(raw);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (token !== this.languageLoadToken)
|
|
262
|
+
return;
|
|
263
|
+
this._resetSession();
|
|
264
|
+
this.languagePage = null;
|
|
265
|
+
this.emit(exports.XEBO_EVENTS.SURVEY_LOADED, this.survey);
|
|
266
|
+
this._setVisible(true);
|
|
267
|
+
}
|
|
268
|
+
_resolveDirection(option, fromScript) {
|
|
269
|
+
if (String(fromScript !== null && fromScript !== void 0 ? fromScript : '').toLowerCase() === 'rtl')
|
|
270
|
+
return 'rtl';
|
|
271
|
+
return option.direction;
|
|
272
|
+
}
|
|
273
|
+
_resetSession() {
|
|
274
|
+
this.currentAnswers = [];
|
|
275
|
+
this.currentQuestionIndex = 0;
|
|
276
|
+
this.surveyStartTime = new Date().toISOString();
|
|
277
|
+
this.surveyStartEpoch = Date.now();
|
|
278
|
+
this.questionStartEpoch = Date.now();
|
|
279
|
+
this.timePerQues = {};
|
|
280
|
+
this.backTrackCount = 0;
|
|
281
|
+
}
|
|
184
282
|
// ─── Answer recording ──────────────────────────────────────────────────────
|
|
185
283
|
recordAnswer(answer) {
|
|
186
284
|
const idx = this.currentAnswers.findIndex(a => a.questionId === answer.questionId);
|
|
@@ -344,6 +442,9 @@ class XeboSurveyManagerClass extends SimpleEventEmitter {
|
|
|
344
442
|
this.emit(exports.XEBO_EVENTS.SURVEY_VISIBLE, visible);
|
|
345
443
|
}
|
|
346
444
|
dismissSurvey() {
|
|
445
|
+
// Bumping the token aborts a translation that is still in flight.
|
|
446
|
+
this.languageLoadToken += 1;
|
|
447
|
+
this.languagePage = null;
|
|
347
448
|
this._setVisible(false);
|
|
348
449
|
this.emit(exports.XEBO_EVENTS.SURVEY_DISMISSED);
|
|
349
450
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
export declare function isRtl(): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Mirrors text inside question views when the chosen language is RTL.
|
|
5
|
+
* The sheet already sets `direction: 'rtl'`, under which React Native swaps
|
|
6
|
+
* left/right for textAlign — so 'left' here means the start (right) edge.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rtlText(): TextStyle | undefined;
|
|
9
|
+
/** Mirrors a flex row (option rows, scale rows) for RTL. */
|
|
10
|
+
export declare function rtlRow(): ViewStyle | undefined;
|
|
11
|
+
//# sourceMappingURL=XeboRtl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XeboRtl.d.ts","sourceRoot":"","sources":["../../src/i18n/XeboRtl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpD,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED;;;;GAIG;AACH,wBAAgB,OAAO,IAAI,SAAS,GAAG,SAAS,CAE/C;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,IAAI,SAAS,GAAG,SAAS,CAE9C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRtl = isRtl;
|
|
4
|
+
exports.rtlText = rtlText;
|
|
5
|
+
exports.rtlRow = rtlRow;
|
|
6
|
+
const XeboStrings_1 = require("./XeboStrings");
|
|
7
|
+
function isRtl() {
|
|
8
|
+
return (0, XeboStrings_1.getStrings)().direction === 'rtl';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Mirrors text inside question views when the chosen language is RTL.
|
|
12
|
+
* The sheet already sets `direction: 'rtl'`, under which React Native swaps
|
|
13
|
+
* left/right for textAlign — so 'left' here means the start (right) edge.
|
|
14
|
+
*/
|
|
15
|
+
function rtlText() {
|
|
16
|
+
return isRtl() ? { textAlign: 'left', writingDirection: 'rtl' } : undefined;
|
|
17
|
+
}
|
|
18
|
+
/** Mirrors a flex row (option rows, scale rows) for RTL. */
|
|
19
|
+
function rtlRow() {
|
|
20
|
+
return isRtl() ? { flexDirection: 'row-reverse' } : undefined;
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { APILangScript } from '../models/XeboLanguageModels';
|
|
2
|
+
export interface XeboStrings {
|
|
3
|
+
next: string;
|
|
4
|
+
submit: string;
|
|
5
|
+
skip: string;
|
|
6
|
+
close: string;
|
|
7
|
+
thankYouTitle: string;
|
|
8
|
+
thankYouMessage: string;
|
|
9
|
+
/** False until a non-primary language is picked; keeps English rendering byte-identical. */
|
|
10
|
+
localized: boolean;
|
|
11
|
+
direction: 'ltr' | 'rtl';
|
|
12
|
+
}
|
|
13
|
+
export interface ConfigureStringsInput {
|
|
14
|
+
langKey: string;
|
|
15
|
+
direction: 'ltr' | 'rtl';
|
|
16
|
+
/** The survey uuid's entry from the translation textMapping. */
|
|
17
|
+
surveyEntry?: Record<string, unknown>;
|
|
18
|
+
script?: APILangScript;
|
|
19
|
+
}
|
|
20
|
+
export declare function configureStrings(input: ConfigureStringsInput): void;
|
|
21
|
+
export declare function resetStrings(): void;
|
|
22
|
+
export declare function getStrings(): XeboStrings;
|
|
23
|
+
/** The Next/Submit label every question view shows on its primary button. */
|
|
24
|
+
export declare function actionLabel(isLastQuestion: boolean): string;
|
|
25
|
+
/** A question's translated required message, falling back to the view's English text. */
|
|
26
|
+
export declare function requiredMessage(question: {
|
|
27
|
+
requiredMessage?: string;
|
|
28
|
+
}, fallback: string): string;
|
|
29
|
+
//# sourceMappingURL=XeboStrings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XeboStrings.d.ts","sourceRoot":"","sources":["../../src/i18n/XeboStrings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,4FAA4F;IAC5F,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;CAC1B;AAwBD,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;IACzB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAgBnE;AAED,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,wBAAgB,UAAU,IAAI,WAAW,CAExC;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM,CAE3D;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,QAAQ,EAAE;IAAE,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhG"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configureStrings = configureStrings;
|
|
4
|
+
exports.resetStrings = resetStrings;
|
|
5
|
+
exports.getStrings = getStrings;
|
|
6
|
+
exports.actionLabel = actionLabel;
|
|
7
|
+
exports.requiredMessage = requiredMessage;
|
|
8
|
+
const XeboLanguageService_1 = require("../core/XeboLanguageService");
|
|
9
|
+
const defaultStrings = {
|
|
10
|
+
next: 'Next',
|
|
11
|
+
submit: 'Submit',
|
|
12
|
+
skip: 'Skip',
|
|
13
|
+
close: 'Close',
|
|
14
|
+
thankYouTitle: 'Thank You!',
|
|
15
|
+
thankYouMessage: 'Your feedback is greatly appreciated.',
|
|
16
|
+
localized: false,
|
|
17
|
+
direction: 'ltr',
|
|
18
|
+
};
|
|
19
|
+
/** The API ships no skip or thank-you translation, so the SDK carries its own. */
|
|
20
|
+
const builtIn = {
|
|
21
|
+
ar: {
|
|
22
|
+
skip: 'تخطي',
|
|
23
|
+
thankYouTitle: 'شكراً لك!',
|
|
24
|
+
thankYouMessage: 'نحن نقدّر ملاحظاتك كثيراً.',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
let currentStrings = Object.assign({}, defaultStrings);
|
|
28
|
+
function configureStrings(input) {
|
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
30
|
+
const entry = (_a = input.surveyEntry) !== null && _a !== void 0 ? _a : {};
|
|
31
|
+
const slugs = (_c = (_b = input.script) === null || _b === void 0 ? void 0 : _b.textMapping) !== null && _c !== void 0 ? _c : {};
|
|
32
|
+
const fallback = (_d = builtIn[input.langKey.toLowerCase()]) !== null && _d !== void 0 ? _d : {};
|
|
33
|
+
const exit = (0, XeboLanguageService_1.translatedText)(entry.exit);
|
|
34
|
+
currentStrings = {
|
|
35
|
+
next: (_e = (0, XeboLanguageService_1.translatedText)(entry.next)) !== null && _e !== void 0 ? _e : defaultStrings.next,
|
|
36
|
+
submit: (_f = (0, XeboLanguageService_1.translatedText)(entry.submit)) !== null && _f !== void 0 ? _f : defaultStrings.submit,
|
|
37
|
+
skip: (_h = (_g = fallback.skip) !== null && _g !== void 0 ? _g : exit) !== null && _h !== void 0 ? _h : defaultStrings.skip,
|
|
38
|
+
close: (_j = (0, XeboLanguageService_1.translatedText)(slugs['close-text'])) !== null && _j !== void 0 ? _j : defaultStrings.close,
|
|
39
|
+
thankYouTitle: (_k = fallback.thankYouTitle) !== null && _k !== void 0 ? _k : defaultStrings.thankYouTitle,
|
|
40
|
+
thankYouMessage: (_l = fallback.thankYouMessage) !== null && _l !== void 0 ? _l : defaultStrings.thankYouMessage,
|
|
41
|
+
localized: true,
|
|
42
|
+
direction: input.direction,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function resetStrings() {
|
|
46
|
+
currentStrings = Object.assign({}, defaultStrings);
|
|
47
|
+
}
|
|
48
|
+
function getStrings() {
|
|
49
|
+
return currentStrings;
|
|
50
|
+
}
|
|
51
|
+
/** The Next/Submit label every question view shows on its primary button. */
|
|
52
|
+
function actionLabel(isLastQuestion) {
|
|
53
|
+
return isLastQuestion ? currentStrings.submit : currentStrings.next;
|
|
54
|
+
}
|
|
55
|
+
/** A question's translated required message, falling back to the view's English text. */
|
|
56
|
+
function requiredMessage(question, fallback) {
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = (0, XeboLanguageService_1.translatedText)(question.requiredMessage)) !== null && _a !== void 0 ? _a : fallback;
|
|
59
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { XeboSurveyManager, XEBO_EVENTS } from './core/XeboSurveyManager';
|
|
2
2
|
export { XeboSurveyModal } from './components/XeboSurveyModal';
|
|
3
|
+
export type { XeboLanguageOption, XeboLanguagePageModel, XeboLanguagePrompt, } from './models/XeboLanguageModels';
|
|
4
|
+
export type { XeboStrings } from './i18n/XeboStrings';
|
|
3
5
|
export type { XeboSurvey, XeboQuestion, XeboAnswer, XeboAnswerValue, XeboQueuedResponse, XeboConfig, XeboThemeConfig, XeboChoice, XeboNPSLabels, XeboConditionalFollowUp, XeboSurveyPage, XeboUserData, } from './models/XeboModels';
|
|
4
6
|
export { XeboQuestionType } from './models/XeboModels';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG1E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,YAAY,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,cAAc,EACd,YAAY,GACb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG1E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,YAAY,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,cAAc,EACd,YAAY,GACb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { APILangSettings, APILanguageEntry, APIPrimaryLang } from './XeboLanguageModels';
|
|
1
2
|
export interface APICollectorResponse {
|
|
2
3
|
data: {
|
|
3
4
|
_id: string;
|
|
@@ -35,6 +36,9 @@ export interface APIQuestionSettings {
|
|
|
35
36
|
colLabel?: boolean;
|
|
36
37
|
color?: string;
|
|
37
38
|
};
|
|
39
|
+
placeholder?: {
|
|
40
|
+
text?: string;
|
|
41
|
+
} | null;
|
|
38
42
|
}
|
|
39
43
|
export interface APIQuestion {
|
|
40
44
|
uuid: string;
|
|
@@ -45,6 +49,7 @@ export interface APIQuestion {
|
|
|
45
49
|
};
|
|
46
50
|
required?: {
|
|
47
51
|
enabled?: boolean;
|
|
52
|
+
errMsg?: string;
|
|
48
53
|
};
|
|
49
54
|
options?: {
|
|
50
55
|
row?: APIOptionItem[];
|
|
@@ -53,7 +58,7 @@ export interface APIQuestion {
|
|
|
53
58
|
settings?: APIQuestionSettings;
|
|
54
59
|
placeholder?: {
|
|
55
60
|
text?: string;
|
|
56
|
-
};
|
|
61
|
+
} | string | null;
|
|
57
62
|
}
|
|
58
63
|
export interface APIBlock {
|
|
59
64
|
questions: Array<{
|
|
@@ -75,6 +80,10 @@ export interface APISurveyData {
|
|
|
75
80
|
content?: string;
|
|
76
81
|
links?: string;
|
|
77
82
|
};
|
|
83
|
+
primaryLang?: APIPrimaryLang | null;
|
|
84
|
+
languages?: APILanguageEntry[] | null;
|
|
85
|
+
langSettings?: APILangSettings | null;
|
|
86
|
+
[key: string]: unknown;
|
|
78
87
|
}
|
|
79
88
|
export interface APISurveyResponse {
|
|
80
89
|
data: APISurveyData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XeboAPIModels.d.ts","sourceRoot":"","sources":["../../src/models/XeboAPIModels.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,CAAC,EAAE;QACJ,MAAM,CAAC,EAAE;YACP,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,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AU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,YAAY,CAAC,EAAE;QACb,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,WAAW,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAEtC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,CAAC;CACrB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** UI string dictionary keyed by slug, e.g. "close-text". */
|
|
2
|
+
export type XeboLangScriptStrings = Record<string, string | null>;
|
|
3
|
+
export interface APILangScript {
|
|
4
|
+
langKey?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
nativeText?: string;
|
|
7
|
+
direction?: string;
|
|
8
|
+
textMapping?: XeboLangScriptStrings | null;
|
|
9
|
+
}
|
|
10
|
+
export interface APIPrimaryLang {
|
|
11
|
+
langKey?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
nativeText?: string;
|
|
14
|
+
dir?: string;
|
|
15
|
+
langId?: string;
|
|
16
|
+
isHidden?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface APILanguageEntry {
|
|
19
|
+
langKey?: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
langId?: string;
|
|
22
|
+
translations?: string;
|
|
23
|
+
isHidden?: boolean;
|
|
24
|
+
progress?: number;
|
|
25
|
+
langScript?: APILangScript | null;
|
|
26
|
+
}
|
|
27
|
+
export interface APILangSettings {
|
|
28
|
+
allowChange?: boolean;
|
|
29
|
+
screenerText?: string;
|
|
30
|
+
screenerTextLang?: string[];
|
|
31
|
+
}
|
|
32
|
+
/** Per-uuid translation entries; values may be null or "" when untranslated. */
|
|
33
|
+
export type XeboTextMapping = Record<string, Record<string, unknown> | null>;
|
|
34
|
+
export interface APIGetLanguageResponse {
|
|
35
|
+
language?: {
|
|
36
|
+
languageTranslation?: {
|
|
37
|
+
textMapping?: XeboTextMapping | null;
|
|
38
|
+
} | null;
|
|
39
|
+
languageScript?: APILangScript | null;
|
|
40
|
+
} | null;
|
|
41
|
+
}
|
|
42
|
+
export interface XeboLanguageOption {
|
|
43
|
+
langKey: string;
|
|
44
|
+
name: string;
|
|
45
|
+
nativeText: string;
|
|
46
|
+
direction: 'ltr' | 'rtl';
|
|
47
|
+
langId?: string;
|
|
48
|
+
translationId?: string;
|
|
49
|
+
isPrimary: boolean;
|
|
50
|
+
/** UI slugs ("close-text", …) used for the language page and chrome. */
|
|
51
|
+
scriptStrings?: XeboLangScriptStrings;
|
|
52
|
+
}
|
|
53
|
+
export interface XeboLanguagePrompt {
|
|
54
|
+
langKey: string;
|
|
55
|
+
text: string;
|
|
56
|
+
direction: 'ltr' | 'rtl';
|
|
57
|
+
}
|
|
58
|
+
export interface XeboLanguagePageModel {
|
|
59
|
+
prompts: XeboLanguagePrompt[];
|
|
60
|
+
options: XeboLanguageOption[];
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=XeboLanguageModels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XeboLanguageModels.d.ts","sourceRoot":"","sources":["../../src/models/XeboLanguageModels.ts"],"names":[],"mappings":"AAEA,6DAA6D;AAC7D,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AAElE,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,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AAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,aAAa,CAAC,EAAE,qBAAqB,CAAC;CACvC;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,KAAK,GAAG,KAAK,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B"}
|
|
@@ -46,6 +46,8 @@ export interface XeboQuestion {
|
|
|
46
46
|
ratingStyle?: string;
|
|
47
47
|
showColLabels?: boolean;
|
|
48
48
|
ratingColor?: string;
|
|
49
|
+
/** Set only when a translation is applied, so English keeps the built-in messages. */
|
|
50
|
+
requiredMessage?: string;
|
|
49
51
|
}
|
|
50
52
|
export interface XeboSurveyPage {
|
|
51
53
|
enabled: boolean;
|
|
@@ -60,6 +62,9 @@ export interface XeboSurvey {
|
|
|
60
62
|
questions: XeboQuestion[];
|
|
61
63
|
introPage?: XeboSurveyPage;
|
|
62
64
|
thankYouPage?: XeboSurveyPage;
|
|
65
|
+
/** Language the survey is rendered in; absent until one is chosen. */
|
|
66
|
+
langKey?: string;
|
|
67
|
+
direction?: 'ltr' | 'rtl';
|
|
63
68
|
}
|
|
64
69
|
export interface XeboAnswerValue {
|
|
65
70
|
rowId: string;
|
|
@@ -130,6 +135,8 @@ export interface XeboConfig {
|
|
|
130
135
|
apiKey: string;
|
|
131
136
|
collectorId: string;
|
|
132
137
|
zone: string;
|
|
138
|
+
/** Fires with the langKey once the respondent picks a language. */
|
|
139
|
+
onLanguageSelected?: (langKey: string) => void;
|
|
133
140
|
}
|
|
134
141
|
export interface XeboThemeConfig {
|
|
135
142
|
primaryColor?: string;
|
|
@@ -1 +1 @@
|
|
|
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AAY,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAID,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-my-survey-sdk",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "Xebo survey collection SDK for React Native",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
|
+
"sync:app": "bash scripts/sync-to-app.sh",
|
|
12
13
|
"prepublishOnly": "npm run build",
|
|
13
|
-
"test": "
|
|
14
|
+
"test": "tsc -p tsconfig.test.json && node --test \".test-build/__tests__/*.test.js\""
|
|
14
15
|
},
|
|
15
16
|
"author": "Xebo",
|
|
16
17
|
"license": "ISC",
|