@plaidev/karte-action-sdk 1.1.220 → 1.1.222
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/hydrate/index.es.d.ts +70 -1
- package/dist/hydrate/index.es.js +274 -156
- package/dist/index.es.d.ts +70 -1
- package/dist/index.es.js +274 -156
- package/package.json +10 -10
@@ -1515,6 +1515,75 @@ declare function createFog({ color, opacity, zIndex, onclick }: {
|
|
1515
1515
|
fog: HTMLDivElement;
|
1516
1516
|
close: () => void;
|
1517
1517
|
};
|
1518
|
+
type AnswerValue = {
|
1519
|
+
choices: string[];
|
1520
|
+
} | {
|
1521
|
+
free_answer: string;
|
1522
|
+
};
|
1523
|
+
/**
|
1524
|
+
* 選択式のアンケート回答を追加する
|
1525
|
+
*
|
1526
|
+
* @param questionId - 質問ID
|
1527
|
+
* @param choices - 回答内容
|
1528
|
+
*
|
1529
|
+
* @public
|
1530
|
+
*/
|
1531
|
+
declare function addChoiceAnswer(questionId: string, choices: string[], validation?: {
|
1532
|
+
isValid: boolean;
|
1533
|
+
statePath: string;
|
1534
|
+
}): void;
|
1535
|
+
/**
|
1536
|
+
* 自由記述式のアンケート回答を追加する
|
1537
|
+
*
|
1538
|
+
* @param questionId - 質問ID
|
1539
|
+
* @param freeAnswer - 回答内容
|
1540
|
+
*
|
1541
|
+
* @public
|
1542
|
+
*/
|
1543
|
+
declare function addFreeAnswer(questionId: string, freeAnswer: string, validation?: {
|
1544
|
+
isValid: boolean;
|
1545
|
+
statePath: string;
|
1546
|
+
}): void;
|
1547
|
+
/**
|
1548
|
+
* 回答済の回答を削除
|
1549
|
+
*
|
1550
|
+
* @param questionId - 質問ID
|
1551
|
+
*
|
1552
|
+
* @public
|
1553
|
+
*/
|
1554
|
+
declare function removeAnswer(questionId: string): void;
|
1555
|
+
/**
|
1556
|
+
* 回答済の回答内容を取得する
|
1557
|
+
*
|
1558
|
+
* @param questionId - 質問ID
|
1559
|
+
*
|
1560
|
+
* @returns 回答データ
|
1561
|
+
*
|
1562
|
+
* @public
|
1563
|
+
*/
|
1564
|
+
declare function getAnsweredQuestion(questionId: string): AnswerValue | undefined;
|
1565
|
+
/**
|
1566
|
+
* 回答済の回答IDのリストを取得
|
1567
|
+
*
|
1568
|
+
* @returns 回答済の質問の質問IDの配列
|
1569
|
+
*
|
1570
|
+
* @public
|
1571
|
+
*/
|
1572
|
+
declare function getAnsweredQuestionIds(): string[];
|
1573
|
+
/**
|
1574
|
+
* `sendAnswers`のエイリアス
|
1575
|
+
*
|
1576
|
+
* @public
|
1577
|
+
*/
|
1578
|
+
declare function sendAnswer(): boolean;
|
1579
|
+
/**
|
1580
|
+
* 回答済の回答をまとめてイベントとして送信する
|
1581
|
+
*
|
1582
|
+
* @returns イベント送信の成功/失敗
|
1583
|
+
*
|
1584
|
+
* @public
|
1585
|
+
*/
|
1586
|
+
declare function sendAnswers(): boolean;
|
1518
1587
|
declare namespace widget {
|
1519
1588
|
/**
|
1520
1589
|
* アクションの汎用的なタイプを定義する
|
@@ -2277,7 +2346,7 @@ declare const afterUpdate: typeof afterUpdateSvelte;
|
|
2277
2346
|
declare const tick: typeof tickSvelte;
|
2278
2347
|
// @internal
|
2279
2348
|
declare const LAYOUT_COMPONENT_NAMES: string[];
|
2280
|
-
export { ACTION_HOOK_LABEL, KARTE_MODAL_ROOT, create, destroyAction, onCreate, onDestroy, showModal, destroy, initialize, finalize, loadGlobalScript, loadGlobalStyle, applyGlobalCss, getState, setState, getStates, isOpened, getVariables, setVariables, resetVariables, getEventHandlers, setEventHandlers, resetEventHandlers, getSystem, setSetting, eventHandlers, variables, formData, state, onScroll, onTime, getLogs, getEvents, logger, listenLogger, hideOnScroll, hideOnTime, showOnScroll, showOnTime, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, Elasticities, Elasticity, ElasticityStyle, DefaultElasticity, TextDirections, TextDirection, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, RegExpProp, Image, LengthUnits, LengthUnit, Length, Color, FontWeight, SYSTEM_FONT, Fonts, Font, Justifies, Justify, Alignments, Alignment, FlexDirections, FlexDirection, ObjectFits, ObjectFit, ClipPaths, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, BoxShadow, Style, TransitState, WritingModes, WritingMode, DateTime, Icon, ListSeparatorTypes, EdgePosition, DefaultEdgePosition, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundTypes, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirections, ListDirection, ListContext, SlideButtonIcon, SlideButtonText, SlideButton, DefaultSlideButton, SlideButtonPosition, SlideNavigationButton, DefaultSlideNavigationButton, FormInputName, FormButtonColor, DefaultFormButtonColor, ModalStyle, ModalBreakPoint, DefaultModalBreakPoint, FormIdentifyTextFields, FormIdentifyTextField, FormIdentifyTextFieldValidations, FormIdentifyTextFieldPlaceholders, DefaultFormIdentifyTextField, FormIdentifyBooleanFields, FormIdentifyBooleanField, DefaultFormIdentifyBooleanField, showAction, closeAction, loadStyle, applyCss, onShow, onClose, onChangeState, getActionRoot, getCssVariables, show, close, ensureModalRoot, createApp, createFog, collection, loadActionTableRow, loadActionTableRows, loadActionTableQuery, loadActionTable, widget, onMount, onDestory, beforeUpdate, afterUpdate, tick, LAYOUT_COMPONENT_NAMES };
|
2349
|
+
export { ACTION_HOOK_LABEL, KARTE_MODAL_ROOT, create, destroyAction, onCreate, onDestroy, showModal, destroy, initialize, finalize, loadGlobalScript, loadGlobalStyle, applyGlobalCss, getState, setState, getStates, isOpened, getVariables, setVariables, resetVariables, getEventHandlers, setEventHandlers, resetEventHandlers, getSystem, setSetting, eventHandlers, variables, formData, state, onScroll, onTime, getLogs, getEvents, logger, listenLogger, hideOnScroll, hideOnTime, showOnScroll, showOnTime, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, Elasticities, Elasticity, ElasticityStyle, DefaultElasticity, TextDirections, TextDirection, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, RegExpProp, Image, LengthUnits, LengthUnit, Length, Color, FontWeight, SYSTEM_FONT, Fonts, Font, Justifies, Justify, Alignments, Alignment, FlexDirections, FlexDirection, ObjectFits, ObjectFit, ClipPaths, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, BoxShadow, Style, TransitState, WritingModes, WritingMode, DateTime, Icon, ListSeparatorTypes, EdgePosition, DefaultEdgePosition, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundTypes, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirections, ListDirection, ListContext, SlideButtonIcon, SlideButtonText, SlideButton, DefaultSlideButton, SlideButtonPosition, SlideNavigationButton, DefaultSlideNavigationButton, FormInputName, FormButtonColor, DefaultFormButtonColor, ModalStyle, ModalBreakPoint, DefaultModalBreakPoint, FormIdentifyTextFields, FormIdentifyTextField, FormIdentifyTextFieldValidations, FormIdentifyTextFieldPlaceholders, DefaultFormIdentifyTextField, FormIdentifyBooleanFields, FormIdentifyBooleanField, DefaultFormIdentifyBooleanField, showAction, closeAction, loadStyle, applyCss, onShow, onClose, onChangeState, getActionRoot, getCssVariables, show, close, ensureModalRoot, createApp, createFog, collection, loadActionTableRow, loadActionTableRows, loadActionTableQuery, loadActionTable, addChoiceAnswer, addFreeAnswer, removeAnswer, getAnsweredQuestion, getAnsweredQuestionIds, sendAnswer, sendAnswers, widget, onMount, onDestory, beforeUpdate, afterUpdate, tick, LAYOUT_COMPONENT_NAMES };
|
2281
2350
|
export type { SystemConfig, ActionVariables, ActionEventHandler, ActionProps, ActionOptions, ActionHook, ActionHookLog, ActionChangeStateHook, SendFunction, PublishFunction, OnScrollContext, OnScrollFunction, ScrollDirection, LogLevel, Log, Event, ActionCloseHook, ShowTrigger, CloseTrigger, CollectionConfig, ActionTableRowRequestConfig, ActionTableRowsRequestConfig, ActionTableQueryRequestConfig, ActionTableRequestConfig };
|
2282
2351
|
export { default as State } from './components/State.svelte';
|
2283
2352
|
export { default as StateItem } from './components/StateItem.svelte';
|
package/dist/hydrate/index.es.js
CHANGED
@@ -2255,6 +2255,247 @@ function destroy() {
|
|
2255
2255
|
dispatchDestroyEvent();
|
2256
2256
|
}
|
2257
2257
|
|
2258
|
+
const USER_ID_VARIABLE_NAME = '__karte_form_identify_user_id';
|
2259
|
+
const MAX_LENGTH_FREE_ANSWER = 2000;
|
2260
|
+
function isEmpty(value) {
|
2261
|
+
if (Array.isArray(value)) {
|
2262
|
+
return value.length === 0;
|
2263
|
+
}
|
2264
|
+
else {
|
2265
|
+
return !value;
|
2266
|
+
}
|
2267
|
+
}
|
2268
|
+
/** @internal */
|
2269
|
+
function createInputRegisterer(formData) {
|
2270
|
+
const registerInput = ({ name, statePath, validator = () => true, initialValue, }) => {
|
2271
|
+
const writableValue = {
|
2272
|
+
subscribe(run) {
|
2273
|
+
return formData.subscribe(formData => {
|
2274
|
+
run(formData[name]?.value);
|
2275
|
+
});
|
2276
|
+
},
|
2277
|
+
set(value) {
|
2278
|
+
formData.update(prev => ({
|
2279
|
+
...prev,
|
2280
|
+
[name]: {
|
2281
|
+
statePath,
|
2282
|
+
value,
|
2283
|
+
isValid: validator(value),
|
2284
|
+
},
|
2285
|
+
}));
|
2286
|
+
},
|
2287
|
+
update(updater) {
|
2288
|
+
formData.update(prev => {
|
2289
|
+
const prevValue = prev[name]?.value;
|
2290
|
+
if (prevValue === undefined)
|
2291
|
+
return prev;
|
2292
|
+
const value = updater(prevValue);
|
2293
|
+
return {
|
2294
|
+
...prev,
|
2295
|
+
[name]: {
|
2296
|
+
statePath,
|
2297
|
+
value,
|
2298
|
+
isValid: validator(value),
|
2299
|
+
},
|
2300
|
+
};
|
2301
|
+
});
|
2302
|
+
},
|
2303
|
+
};
|
2304
|
+
const readableIsValid = {
|
2305
|
+
subscribe(run) {
|
2306
|
+
return formData.subscribe(formData => {
|
2307
|
+
run(formData[name]?.isValid);
|
2308
|
+
});
|
2309
|
+
},
|
2310
|
+
};
|
2311
|
+
if (isEmpty(get(writableValue))) {
|
2312
|
+
writableValue.set(initialValue);
|
2313
|
+
}
|
2314
|
+
return {
|
2315
|
+
value: writableValue,
|
2316
|
+
isValid: readableIsValid,
|
2317
|
+
};
|
2318
|
+
};
|
2319
|
+
return registerInput;
|
2320
|
+
}
|
2321
|
+
/** @internal */
|
2322
|
+
const registerInput = createInputRegisterer(formData);
|
2323
|
+
/** @internal */
|
2324
|
+
const registerIdentifyInput = createInputRegisterer(identifyFormData);
|
2325
|
+
function validateFormData(formData, statePath) {
|
2326
|
+
return Object.entries(formData)
|
2327
|
+
.filter(([_, { statePath: s }]) => s === statePath) // eslint-disable-line @typescript-eslint/no-unused-vars
|
2328
|
+
.every(([_, { isValid }]) => isValid); // eslint-disable-line @typescript-eslint/no-unused-vars
|
2329
|
+
}
|
2330
|
+
/** @internal */
|
2331
|
+
const getValuesAreValidReadable = statePath => ({
|
2332
|
+
subscribe(callback) {
|
2333
|
+
return formData.subscribe(formData => identifyFormData.subscribe(identifyFormData => {
|
2334
|
+
const valuesAreValid = validateFormData(formData, statePath) && validateFormData(identifyFormData, statePath);
|
2335
|
+
callback(valuesAreValid);
|
2336
|
+
}));
|
2337
|
+
},
|
2338
|
+
});
|
2339
|
+
function createAnswerValue(value) {
|
2340
|
+
if (Array.isArray(value)) {
|
2341
|
+
return {
|
2342
|
+
choices: value,
|
2343
|
+
};
|
2344
|
+
}
|
2345
|
+
else if (typeof value === 'string') {
|
2346
|
+
return {
|
2347
|
+
free_answer: value,
|
2348
|
+
};
|
2349
|
+
}
|
2350
|
+
}
|
2351
|
+
function formDataToEventValues(campaignId, formData) {
|
2352
|
+
const questions = [];
|
2353
|
+
const answersMap = {};
|
2354
|
+
Object.entries(formData).forEach(([name, dataItem]) => {
|
2355
|
+
questions.push(name);
|
2356
|
+
const value = dataItem.value;
|
2357
|
+
const answerKey = `question_${name}`;
|
2358
|
+
const answerValue = createAnswerValue(value);
|
2359
|
+
answersMap[answerKey] = answerValue;
|
2360
|
+
});
|
2361
|
+
return {
|
2362
|
+
[campaignId]: {
|
2363
|
+
questions,
|
2364
|
+
...answersMap,
|
2365
|
+
},
|
2366
|
+
};
|
2367
|
+
}
|
2368
|
+
function formDataToIdentifyEventValues(formData) {
|
2369
|
+
return Object.fromEntries(Object.entries(formData).map(([name, dataItem]) => {
|
2370
|
+
const value = dataItem.value;
|
2371
|
+
return [name, value];
|
2372
|
+
}));
|
2373
|
+
}
|
2374
|
+
/** @internal */
|
2375
|
+
function submit() {
|
2376
|
+
const systemConfig = getSystem();
|
2377
|
+
const campaignId = systemConfig.campaignId;
|
2378
|
+
if (campaignId) {
|
2379
|
+
const formData$1 = get(formData);
|
2380
|
+
const identifyFormData$1 = get(identifyFormData);
|
2381
|
+
const values = formDataToEventValues(campaignId, formData$1);
|
2382
|
+
const identifyValues = formDataToIdentifyEventValues(identifyFormData$1);
|
2383
|
+
if (Object.keys(identifyValues).length > 0) {
|
2384
|
+
identifyValues['user_id'] = getVariables()?.[USER_ID_VARIABLE_NAME];
|
2385
|
+
}
|
2386
|
+
return { values, identifyValues };
|
2387
|
+
}
|
2388
|
+
return {};
|
2389
|
+
}
|
2390
|
+
/**
|
2391
|
+
* 選択式のアンケート回答を追加する
|
2392
|
+
*
|
2393
|
+
* @param questionId - 質問ID
|
2394
|
+
* @param choices - 回答内容
|
2395
|
+
*
|
2396
|
+
* @public
|
2397
|
+
*/
|
2398
|
+
function addChoiceAnswer(questionId, choices, validation) {
|
2399
|
+
formData.update(prev => ({
|
2400
|
+
...prev,
|
2401
|
+
[questionId]: {
|
2402
|
+
value: choices,
|
2403
|
+
statePath: validation?.statePath ?? '',
|
2404
|
+
isValid: validation?.isValid ?? true,
|
2405
|
+
},
|
2406
|
+
}));
|
2407
|
+
}
|
2408
|
+
/**
|
2409
|
+
* 自由記述式のアンケート回答を追加する
|
2410
|
+
*
|
2411
|
+
* @param questionId - 質問ID
|
2412
|
+
* @param freeAnswer - 回答内容
|
2413
|
+
*
|
2414
|
+
* @public
|
2415
|
+
*/
|
2416
|
+
function addFreeAnswer(questionId, freeAnswer, validation) {
|
2417
|
+
formData.update(prev => ({
|
2418
|
+
...prev,
|
2419
|
+
[questionId]: {
|
2420
|
+
value: freeAnswer.slice(0, MAX_LENGTH_FREE_ANSWER),
|
2421
|
+
statePath: validation?.statePath ?? '',
|
2422
|
+
isValid: validation?.isValid ?? true,
|
2423
|
+
},
|
2424
|
+
}));
|
2425
|
+
}
|
2426
|
+
/**
|
2427
|
+
* 回答済の回答を削除
|
2428
|
+
*
|
2429
|
+
* @param questionId - 質問ID
|
2430
|
+
*
|
2431
|
+
* @public
|
2432
|
+
*/
|
2433
|
+
function removeAnswer(questionId) {
|
2434
|
+
formData.update(prev => {
|
2435
|
+
const next = { ...prev };
|
2436
|
+
delete next[questionId];
|
2437
|
+
return next;
|
2438
|
+
});
|
2439
|
+
}
|
2440
|
+
/**
|
2441
|
+
* 回答済の回答内容を取得する
|
2442
|
+
*
|
2443
|
+
* @param questionId - 質問ID
|
2444
|
+
*
|
2445
|
+
* @returns 回答データ
|
2446
|
+
*
|
2447
|
+
* @public
|
2448
|
+
*/
|
2449
|
+
function getAnsweredQuestion(questionId) {
|
2450
|
+
const formData$1 = get(formData);
|
2451
|
+
const valueState = formData$1[questionId];
|
2452
|
+
if (valueState) {
|
2453
|
+
return createAnswerValue(valueState.value);
|
2454
|
+
}
|
2455
|
+
}
|
2456
|
+
/**
|
2457
|
+
* 回答済の回答IDのリストを取得
|
2458
|
+
*
|
2459
|
+
* @returns 回答済の質問の質問IDの配列
|
2460
|
+
*
|
2461
|
+
* @public
|
2462
|
+
*/
|
2463
|
+
function getAnsweredQuestionIds() {
|
2464
|
+
const formData$1 = get(formData);
|
2465
|
+
return Object.keys(formData$1);
|
2466
|
+
}
|
2467
|
+
/**
|
2468
|
+
* `sendAnswers`のエイリアス
|
2469
|
+
*
|
2470
|
+
* @public
|
2471
|
+
*/
|
2472
|
+
function sendAnswer() {
|
2473
|
+
return sendAnswers();
|
2474
|
+
}
|
2475
|
+
// NOTE: sendAnswers用
|
2476
|
+
let isSent = false;
|
2477
|
+
/**
|
2478
|
+
* 回答済の回答をまとめてイベントとして送信する
|
2479
|
+
*
|
2480
|
+
* @returns イベント送信の成功/失敗
|
2481
|
+
*
|
2482
|
+
* @public
|
2483
|
+
*/
|
2484
|
+
function sendAnswers() {
|
2485
|
+
const { values, identifyValues } = submit();
|
2486
|
+
if (isSent)
|
2487
|
+
return false;
|
2488
|
+
if (Object.keys(values ?? {}).length === 0 && Object.keys(identifyValues ?? {}).length === 0) {
|
2489
|
+
return false;
|
2490
|
+
}
|
2491
|
+
send_event('_answer_question', values);
|
2492
|
+
if (Object.keys(identifyValues ?? {}).length > 0) {
|
2493
|
+
send_event('identify', identifyValues);
|
2494
|
+
}
|
2495
|
+
isSent = true;
|
2496
|
+
return true;
|
2497
|
+
}
|
2498
|
+
|
2258
2499
|
/**
|
2259
2500
|
* エディタv1のWidget API 互換のインターフェース
|
2260
2501
|
*/
|
@@ -2913,134 +3154,6 @@ class StateItem extends SvelteComponent {
|
|
2913
3154
|
}
|
2914
3155
|
}
|
2915
3156
|
|
2916
|
-
const USER_ID_VARIABLE_NAME = '__karte_form_identify_user_id';
|
2917
|
-
function isEmpty(value) {
|
2918
|
-
if (Array.isArray(value)) {
|
2919
|
-
return value.length === 0;
|
2920
|
-
}
|
2921
|
-
else {
|
2922
|
-
return !value;
|
2923
|
-
}
|
2924
|
-
}
|
2925
|
-
/** @internal */
|
2926
|
-
function createInputRegisterer(formData) {
|
2927
|
-
const registerInput = ({ name, statePath, validator = () => true, initialValue, }) => {
|
2928
|
-
const writableValue = {
|
2929
|
-
subscribe(run) {
|
2930
|
-
return formData.subscribe(formData => {
|
2931
|
-
run(formData[name]?.value);
|
2932
|
-
});
|
2933
|
-
},
|
2934
|
-
set(value) {
|
2935
|
-
formData.update(prev => ({
|
2936
|
-
...prev,
|
2937
|
-
[name]: {
|
2938
|
-
statePath,
|
2939
|
-
value,
|
2940
|
-
isValid: validator(value),
|
2941
|
-
},
|
2942
|
-
}));
|
2943
|
-
},
|
2944
|
-
update(updater) {
|
2945
|
-
formData.update(prev => {
|
2946
|
-
const prevValue = prev[name]?.value;
|
2947
|
-
if (prevValue === undefined)
|
2948
|
-
return prev;
|
2949
|
-
const value = updater(prevValue);
|
2950
|
-
return {
|
2951
|
-
...prev,
|
2952
|
-
[name]: {
|
2953
|
-
statePath,
|
2954
|
-
value,
|
2955
|
-
isValid: validator(value),
|
2956
|
-
},
|
2957
|
-
};
|
2958
|
-
});
|
2959
|
-
},
|
2960
|
-
};
|
2961
|
-
const readableIsValid = {
|
2962
|
-
subscribe(run) {
|
2963
|
-
return formData.subscribe(formData => {
|
2964
|
-
run(formData[name]?.isValid);
|
2965
|
-
});
|
2966
|
-
},
|
2967
|
-
};
|
2968
|
-
if (isEmpty(get(writableValue))) {
|
2969
|
-
writableValue.set(initialValue);
|
2970
|
-
}
|
2971
|
-
return {
|
2972
|
-
value: writableValue,
|
2973
|
-
isValid: readableIsValid,
|
2974
|
-
};
|
2975
|
-
};
|
2976
|
-
return registerInput;
|
2977
|
-
}
|
2978
|
-
/** @internal */
|
2979
|
-
const registerInput = createInputRegisterer(formData);
|
2980
|
-
/** @internal */
|
2981
|
-
const registerIdentifyInput = createInputRegisterer(identifyFormData);
|
2982
|
-
function validateFormData(formData, statePath) {
|
2983
|
-
return Object.entries(formData)
|
2984
|
-
.filter(([_, { statePath: s }]) => s === statePath) // eslint-disable-line @typescript-eslint/no-unused-vars
|
2985
|
-
.every(([_, { isValid }]) => isValid); // eslint-disable-line @typescript-eslint/no-unused-vars
|
2986
|
-
}
|
2987
|
-
/** @internal */
|
2988
|
-
const getValuesAreValidReadable = statePath => ({
|
2989
|
-
subscribe(callback) {
|
2990
|
-
return formData.subscribe(formData => identifyFormData.subscribe(identifyFormData => {
|
2991
|
-
const valuesAreValid = validateFormData(formData, statePath) && validateFormData(identifyFormData, statePath);
|
2992
|
-
callback(valuesAreValid);
|
2993
|
-
}));
|
2994
|
-
},
|
2995
|
-
});
|
2996
|
-
function formDataToEventValues(campaignId, formData) {
|
2997
|
-
const questions = [];
|
2998
|
-
const answersMap = {};
|
2999
|
-
Object.entries(formData).forEach(([name, dataItem]) => {
|
3000
|
-
questions.push(name);
|
3001
|
-
const value = dataItem.value;
|
3002
|
-
const answerKey = `question_${name}`;
|
3003
|
-
if (Array.isArray(value)) {
|
3004
|
-
answersMap[answerKey] = {
|
3005
|
-
choices: value,
|
3006
|
-
};
|
3007
|
-
}
|
3008
|
-
else if (typeof value === 'string') {
|
3009
|
-
answersMap[answerKey] = {
|
3010
|
-
free_answer: value,
|
3011
|
-
};
|
3012
|
-
}
|
3013
|
-
});
|
3014
|
-
return {
|
3015
|
-
[campaignId]: {
|
3016
|
-
questions,
|
3017
|
-
...answersMap,
|
3018
|
-
},
|
3019
|
-
};
|
3020
|
-
}
|
3021
|
-
function formDataToIdentifyEventValues(formData) {
|
3022
|
-
return Object.fromEntries(Object.entries(formData).map(([name, dataItem]) => {
|
3023
|
-
const value = dataItem.value;
|
3024
|
-
return [name, value];
|
3025
|
-
}));
|
3026
|
-
}
|
3027
|
-
/** @internal */
|
3028
|
-
function submit() {
|
3029
|
-
const systemConfig = getSystem();
|
3030
|
-
const campaignId = systemConfig.campaignId;
|
3031
|
-
if (campaignId) {
|
3032
|
-
const formData$1 = get(formData);
|
3033
|
-
const identifyFormData$1 = get(identifyFormData);
|
3034
|
-
const values = formDataToEventValues(campaignId, formData$1);
|
3035
|
-
const identifyValues = formDataToIdentifyEventValues(identifyFormData$1);
|
3036
|
-
if (Object.keys(identifyValues).length > 0) {
|
3037
|
-
identifyValues['user_id'] = getVariables()?.[USER_ID_VARIABLE_NAME];
|
3038
|
-
}
|
3039
|
-
return { values, identifyValues };
|
3040
|
-
}
|
3041
|
-
return {};
|
3042
|
-
}
|
3043
|
-
|
3044
3157
|
/**
|
3045
3158
|
* モーダル(ポップアップ)のコンポーネントが利用するコードの管理
|
3046
3159
|
*/
|
@@ -8140,14 +8253,14 @@ function add_css$e(target) {
|
|
8140
8253
|
|
8141
8254
|
function get_each_context$2(ctx, list, i) {
|
8142
8255
|
const child_ctx = ctx.slice();
|
8143
|
-
child_ctx[
|
8256
|
+
child_ctx[14] = list[i];
|
8144
8257
|
return child_ctx;
|
8145
8258
|
}
|
8146
8259
|
|
8147
|
-
// (
|
8260
|
+
// (68:2) {#each [...Array(count).keys()].map(i => i + startingNumber) as i}
|
8148
8261
|
function create_each_block$2(ctx) {
|
8149
8262
|
let button;
|
8150
|
-
let t0_value = /*i*/ ctx[
|
8263
|
+
let t0_value = /*i*/ ctx[14] + "";
|
8151
8264
|
let t0;
|
8152
8265
|
let t1;
|
8153
8266
|
let button_style_value;
|
@@ -8171,7 +8284,7 @@ function create_each_block$2(ctx) {
|
|
8171
8284
|
},
|
8172
8285
|
h() {
|
8173
8286
|
attr(button, "class", "rating-button svelte-9idbf1");
|
8174
|
-
attr(button, "style", button_style_value = /*getTextButtonStyle*/ ctx[
|
8287
|
+
attr(button, "style", button_style_value = /*getTextButtonStyle*/ ctx[5](/*i*/ ctx[14] === /*_value*/ ctx[2]));
|
8175
8288
|
},
|
8176
8289
|
m(target, anchor) {
|
8177
8290
|
insert_hydration(target, button, anchor);
|
@@ -8180,7 +8293,7 @@ function create_each_block$2(ctx) {
|
|
8180
8293
|
|
8181
8294
|
if (!mounted) {
|
8182
8295
|
dispose = listen(button, "click", function () {
|
8183
|
-
if (is_function(/*handleClick*/ ctx[
|
8296
|
+
if (is_function(/*handleClick*/ ctx[4](/*i*/ ctx[14]))) /*handleClick*/ ctx[4](/*i*/ ctx[14]).apply(this, arguments);
|
8184
8297
|
});
|
8185
8298
|
|
8186
8299
|
mounted = true;
|
@@ -8188,9 +8301,9 @@ function create_each_block$2(ctx) {
|
|
8188
8301
|
},
|
8189
8302
|
p(new_ctx, dirty) {
|
8190
8303
|
ctx = new_ctx;
|
8191
|
-
if (dirty & /*count*/
|
8304
|
+
if (dirty & /*count, startingNumber*/ 3 && t0_value !== (t0_value = /*i*/ ctx[14] + "")) set_data(t0, t0_value);
|
8192
8305
|
|
8193
|
-
if (dirty & /*count, _value*/
|
8306
|
+
if (dirty & /*count, startingNumber, _value*/ 7 && button_style_value !== (button_style_value = /*getTextButtonStyle*/ ctx[5](/*i*/ ctx[14] === /*_value*/ ctx[2]))) {
|
8194
8307
|
attr(button, "style", button_style_value);
|
8195
8308
|
}
|
8196
8309
|
},
|
@@ -8204,7 +8317,7 @@ function create_each_block$2(ctx) {
|
|
8204
8317
|
|
8205
8318
|
function create_fragment$f(ctx) {
|
8206
8319
|
let div;
|
8207
|
-
let each_value = [...Array(/*count*/ ctx[0]).keys()].map(func
|
8320
|
+
let each_value = [...Array(/*count*/ ctx[0]).keys()].map(/*func*/ ctx[12]);
|
8208
8321
|
let each_blocks = [];
|
8209
8322
|
|
8210
8323
|
for (let i = 0; i < each_value.length; i += 1) {
|
@@ -8243,8 +8356,8 @@ function create_fragment$f(ctx) {
|
|
8243
8356
|
}
|
8244
8357
|
},
|
8245
8358
|
p(ctx, [dirty]) {
|
8246
|
-
if (dirty & /*getTextButtonStyle, Array, count, _value, handleClick*/
|
8247
|
-
each_value = [...Array(/*count*/ ctx[0]).keys()].map(func
|
8359
|
+
if (dirty & /*getTextButtonStyle, Array, count, startingNumber, _value, handleClick*/ 55) {
|
8360
|
+
each_value = [...Array(/*count*/ ctx[0]).keys()].map(/*func*/ ctx[12]);
|
8248
8361
|
let i;
|
8249
8362
|
|
8250
8363
|
for (i = 0; i < each_value.length; i += 1) {
|
@@ -8275,14 +8388,13 @@ function create_fragment$f(ctx) {
|
|
8275
8388
|
};
|
8276
8389
|
}
|
8277
8390
|
|
8278
|
-
const func$1 = i => i + 1;
|
8279
|
-
|
8280
8391
|
function instance$f($$self, $$props, $$invalidate) {
|
8281
8392
|
let _value;
|
8282
8393
|
let $value;
|
8283
8394
|
let { name = '' } = $$props;
|
8284
8395
|
let { required = false } = $$props;
|
8285
8396
|
let { count = 5 } = $$props;
|
8397
|
+
let { startingNumber = 1 } = $$props;
|
8286
8398
|
let { font = SYSTEM_FONT } = $$props;
|
8287
8399
|
let { buttonStyle = 'width: 32px; height: 32px; font-size: 12px; font-weight: bold; border-radius: 17px; color: #333; background-color: rgba(0, 16, 14, 0.06); box-shadow: 0px 0px 16px 0px rgba(0, 16, 14, 0);' } = $$props;
|
8288
8400
|
let { buttonActiveStyle = 'color: #333; background-color: #2aab9f; box-shadow: 0px 8px 16px 0px rgba(0, 16, 14, 0.3);' } = $$props;
|
@@ -8298,7 +8410,7 @@ function instance$f($$self, $$props, $$invalidate) {
|
|
8298
8410
|
}
|
8299
8411
|
});
|
8300
8412
|
|
8301
|
-
component_subscribe($$self, value, value => $$invalidate(
|
8413
|
+
component_subscribe($$self, value, value => $$invalidate(11, $value = value));
|
8302
8414
|
|
8303
8415
|
const handleClick = index => event => {
|
8304
8416
|
value.set([String(index)]);
|
@@ -8312,27 +8424,31 @@ function instance$f($$self, $$props, $$invalidate) {
|
|
8312
8424
|
].join(';');
|
8313
8425
|
}
|
8314
8426
|
|
8427
|
+
const func = i => i + startingNumber;
|
8428
|
+
|
8315
8429
|
$$self.$$set = $$props => {
|
8316
|
-
if ('name' in $$props) $$invalidate(
|
8317
|
-
if ('required' in $$props) $$invalidate(
|
8430
|
+
if ('name' in $$props) $$invalidate(6, name = $$props.name);
|
8431
|
+
if ('required' in $$props) $$invalidate(7, required = $$props.required);
|
8318
8432
|
if ('count' in $$props) $$invalidate(0, count = $$props.count);
|
8319
|
-
if ('
|
8320
|
-
if ('
|
8321
|
-
if ('
|
8433
|
+
if ('startingNumber' in $$props) $$invalidate(1, startingNumber = $$props.startingNumber);
|
8434
|
+
if ('font' in $$props) $$invalidate(8, font = $$props.font);
|
8435
|
+
if ('buttonStyle' in $$props) $$invalidate(9, buttonStyle = $$props.buttonStyle);
|
8436
|
+
if ('buttonActiveStyle' in $$props) $$invalidate(10, buttonActiveStyle = $$props.buttonActiveStyle);
|
8322
8437
|
};
|
8323
8438
|
|
8324
8439
|
$$self.$$.update = () => {
|
8325
|
-
if ($$self.$$.dirty & /*font*/
|
8440
|
+
if ($$self.$$.dirty & /*font*/ 256) {
|
8326
8441
|
addFont(font);
|
8327
8442
|
}
|
8328
8443
|
|
8329
|
-
if ($$self.$$.dirty & /*$value*/
|
8330
|
-
$$invalidate(
|
8444
|
+
if ($$self.$$.dirty & /*$value*/ 2048) {
|
8445
|
+
$$invalidate(2, _value = Number($value[0] ?? -1));
|
8331
8446
|
}
|
8332
8447
|
};
|
8333
8448
|
|
8334
8449
|
return [
|
8335
8450
|
count,
|
8451
|
+
startingNumber,
|
8336
8452
|
_value,
|
8337
8453
|
value,
|
8338
8454
|
handleClick,
|
@@ -8342,7 +8458,8 @@ function instance$f($$self, $$props, $$invalidate) {
|
|
8342
8458
|
font,
|
8343
8459
|
buttonStyle,
|
8344
8460
|
buttonActiveStyle,
|
8345
|
-
$value
|
8461
|
+
$value,
|
8462
|
+
func
|
8346
8463
|
];
|
8347
8464
|
}
|
8348
8465
|
|
@@ -8357,12 +8474,13 @@ class FormRatingButtonsNumber extends SvelteComponent {
|
|
8357
8474
|
create_fragment$f,
|
8358
8475
|
safe_not_equal,
|
8359
8476
|
{
|
8360
|
-
name:
|
8361
|
-
required:
|
8477
|
+
name: 6,
|
8478
|
+
required: 7,
|
8362
8479
|
count: 0,
|
8363
|
-
|
8364
|
-
|
8365
|
-
|
8480
|
+
startingNumber: 1,
|
8481
|
+
font: 8,
|
8482
|
+
buttonStyle: 9,
|
8483
|
+
buttonActiveStyle: 10
|
8366
8484
|
},
|
8367
8485
|
add_css$e
|
8368
8486
|
);
|
@@ -11746,4 +11864,4 @@ class ImageBlock extends SvelteComponent {
|
|
11746
11864
|
}
|
11747
11865
|
}
|
11748
11866
|
|
11749
|
-
export { ACTION_HOOK_LABEL, Alignments, AnimationStyles, BackgroundSizes, Box, ClipPaths, CodeElement, Countdown, Cursors, DefaultEdgePosition, DefaultElasticity, DefaultFormButtonColor, DefaultFormIdentifyBooleanField, DefaultFormIdentifyTextField, DefaultListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListSeparator, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparatorNone, DefaultModalBreakPoint, DefaultModalPlacement, DefaultSlideButton, DefaultSlideNavigationButton, Directions, Elasticities, ElasticityStyle, EmbedElement, Flex, FlexDirections, FlexItem, Fonts, FormCheckBoxes, FormIdentifyBooleanFields, FormIdentifyChoices, FormIdentifyInput, FormIdentifyTextFieldPlaceholders, FormIdentifyTextFieldValidations, FormIdentifyTextFields, FormRadioButtons, FormRatingButtonsFace, FormRatingButtonsNumber, FormSelect, FormTextarea, Grid, GridItem, GridModalState, IconElement, ImageBlock, ImageElement, Justifies, KARTE_MODAL_ROOT, LAYOUT_COMPONENT_NAMES, LengthUnits, List, ListBackgroundTypes, ListDirections, ListItem, ListSeparatorTypes, MediaQueries, Modal, ModalPositions, MovieVimeoElement, MovieYouTubeElement, ObjectFits, OnClickOperationOptions, Overflows, PropTypes, Repeats, SYSTEM_FONT, Slide, SlideItem, State, StateItem, TextBlock, TextButtonBlock, TextButtonElement, TextDirections, TextElement, WritingModes, afterUpdate, applyCss, applyGlobalCss, beforeUpdate, close, closeAction, collection$1 as collection, create, createApp, createFog, destroy, destroyAction, ensureModalRoot, eventHandlers, finalize, formData, getActionRoot, getCssVariables, getEventHandlers, getEvents, getLogs, getState$1 as getState, getStates, getSystem, getVariables, hideOnScroll, hideOnTime, initialize, isOpened, listenLogger, loadActionTable, loadActionTableQuery, loadActionTableRow, loadActionTableRows, loadGlobalScript, loadGlobalStyle, loadStyle, logger, onChangeState, onClose, onCreate, onDestory, onDestroy, onMount, onScroll, onShow, onTime, resetEventHandlers, resetVariables, setEventHandlers, setSetting, setState$1 as setState, setVariables, show, showAction, showModal, showOnScroll, showOnTime, state, tick, variables, widget };
|
11867
|
+
export { ACTION_HOOK_LABEL, Alignments, AnimationStyles, BackgroundSizes, Box, ClipPaths, CodeElement, Countdown, Cursors, DefaultEdgePosition, DefaultElasticity, DefaultFormButtonColor, DefaultFormIdentifyBooleanField, DefaultFormIdentifyTextField, DefaultListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListSeparator, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparatorNone, DefaultModalBreakPoint, DefaultModalPlacement, DefaultSlideButton, DefaultSlideNavigationButton, Directions, Elasticities, ElasticityStyle, EmbedElement, Flex, FlexDirections, FlexItem, Fonts, FormCheckBoxes, FormIdentifyBooleanFields, FormIdentifyChoices, FormIdentifyInput, FormIdentifyTextFieldPlaceholders, FormIdentifyTextFieldValidations, FormIdentifyTextFields, FormRadioButtons, FormRatingButtonsFace, FormRatingButtonsNumber, FormSelect, FormTextarea, Grid, GridItem, GridModalState, IconElement, ImageBlock, ImageElement, Justifies, KARTE_MODAL_ROOT, LAYOUT_COMPONENT_NAMES, LengthUnits, List, ListBackgroundTypes, ListDirections, ListItem, ListSeparatorTypes, MediaQueries, Modal, ModalPositions, MovieVimeoElement, MovieYouTubeElement, ObjectFits, OnClickOperationOptions, Overflows, PropTypes, Repeats, SYSTEM_FONT, Slide, SlideItem, State, StateItem, TextBlock, TextButtonBlock, TextButtonElement, TextDirections, TextElement, WritingModes, addChoiceAnswer, addFreeAnswer, afterUpdate, applyCss, applyGlobalCss, beforeUpdate, close, closeAction, collection$1 as collection, create, createApp, createFog, destroy, destroyAction, ensureModalRoot, eventHandlers, finalize, formData, getActionRoot, getAnsweredQuestion, getAnsweredQuestionIds, getCssVariables, getEventHandlers, getEvents, getLogs, getState$1 as getState, getStates, getSystem, getVariables, hideOnScroll, hideOnTime, initialize, isOpened, listenLogger, loadActionTable, loadActionTableQuery, loadActionTableRow, loadActionTableRows, loadGlobalScript, loadGlobalStyle, loadStyle, logger, onChangeState, onClose, onCreate, onDestory, onDestroy, onMount, onScroll, onShow, onTime, removeAnswer, resetEventHandlers, resetVariables, sendAnswer, sendAnswers, setEventHandlers, setSetting, setState$1 as setState, setVariables, show, showAction, showModal, showOnScroll, showOnTime, state, tick, variables, widget };
|
package/dist/index.es.d.ts
CHANGED
@@ -1515,6 +1515,75 @@ declare function createFog({ color, opacity, zIndex, onclick }: {
|
|
1515
1515
|
fog: HTMLDivElement;
|
1516
1516
|
close: () => void;
|
1517
1517
|
};
|
1518
|
+
type AnswerValue = {
|
1519
|
+
choices: string[];
|
1520
|
+
} | {
|
1521
|
+
free_answer: string;
|
1522
|
+
};
|
1523
|
+
/**
|
1524
|
+
* 選択式のアンケート回答を追加する
|
1525
|
+
*
|
1526
|
+
* @param questionId - 質問ID
|
1527
|
+
* @param choices - 回答内容
|
1528
|
+
*
|
1529
|
+
* @public
|
1530
|
+
*/
|
1531
|
+
declare function addChoiceAnswer(questionId: string, choices: string[], validation?: {
|
1532
|
+
isValid: boolean;
|
1533
|
+
statePath: string;
|
1534
|
+
}): void;
|
1535
|
+
/**
|
1536
|
+
* 自由記述式のアンケート回答を追加する
|
1537
|
+
*
|
1538
|
+
* @param questionId - 質問ID
|
1539
|
+
* @param freeAnswer - 回答内容
|
1540
|
+
*
|
1541
|
+
* @public
|
1542
|
+
*/
|
1543
|
+
declare function addFreeAnswer(questionId: string, freeAnswer: string, validation?: {
|
1544
|
+
isValid: boolean;
|
1545
|
+
statePath: string;
|
1546
|
+
}): void;
|
1547
|
+
/**
|
1548
|
+
* 回答済の回答を削除
|
1549
|
+
*
|
1550
|
+
* @param questionId - 質問ID
|
1551
|
+
*
|
1552
|
+
* @public
|
1553
|
+
*/
|
1554
|
+
declare function removeAnswer(questionId: string): void;
|
1555
|
+
/**
|
1556
|
+
* 回答済の回答内容を取得する
|
1557
|
+
*
|
1558
|
+
* @param questionId - 質問ID
|
1559
|
+
*
|
1560
|
+
* @returns 回答データ
|
1561
|
+
*
|
1562
|
+
* @public
|
1563
|
+
*/
|
1564
|
+
declare function getAnsweredQuestion(questionId: string): AnswerValue | undefined;
|
1565
|
+
/**
|
1566
|
+
* 回答済の回答IDのリストを取得
|
1567
|
+
*
|
1568
|
+
* @returns 回答済の質問の質問IDの配列
|
1569
|
+
*
|
1570
|
+
* @public
|
1571
|
+
*/
|
1572
|
+
declare function getAnsweredQuestionIds(): string[];
|
1573
|
+
/**
|
1574
|
+
* `sendAnswers`のエイリアス
|
1575
|
+
*
|
1576
|
+
* @public
|
1577
|
+
*/
|
1578
|
+
declare function sendAnswer(): boolean;
|
1579
|
+
/**
|
1580
|
+
* 回答済の回答をまとめてイベントとして送信する
|
1581
|
+
*
|
1582
|
+
* @returns イベント送信の成功/失敗
|
1583
|
+
*
|
1584
|
+
* @public
|
1585
|
+
*/
|
1586
|
+
declare function sendAnswers(): boolean;
|
1518
1587
|
declare namespace widget {
|
1519
1588
|
/**
|
1520
1589
|
* アクションの汎用的なタイプを定義する
|
@@ -2277,7 +2346,7 @@ declare const afterUpdate: typeof afterUpdateSvelte;
|
|
2277
2346
|
declare const tick: typeof tickSvelte;
|
2278
2347
|
// @internal
|
2279
2348
|
declare const LAYOUT_COMPONENT_NAMES: string[];
|
2280
|
-
export { ACTION_HOOK_LABEL, KARTE_MODAL_ROOT, create, destroyAction, onCreate, onDestroy, showModal, destroy, initialize, finalize, loadGlobalScript, loadGlobalStyle, applyGlobalCss, getState, setState, getStates, isOpened, getVariables, setVariables, resetVariables, getEventHandlers, setEventHandlers, resetEventHandlers, getSystem, setSetting, eventHandlers, variables, formData, state, onScroll, onTime, getLogs, getEvents, logger, listenLogger, hideOnScroll, hideOnTime, showOnScroll, showOnTime, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, Elasticities, Elasticity, ElasticityStyle, DefaultElasticity, TextDirections, TextDirection, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, RegExpProp, Image, LengthUnits, LengthUnit, Length, Color, FontWeight, SYSTEM_FONT, Fonts, Font, Justifies, Justify, Alignments, Alignment, FlexDirections, FlexDirection, ObjectFits, ObjectFit, ClipPaths, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, BoxShadow, Style, TransitState, WritingModes, WritingMode, DateTime, Icon, ListSeparatorTypes, EdgePosition, DefaultEdgePosition, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundTypes, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirections, ListDirection, ListContext, SlideButtonIcon, SlideButtonText, SlideButton, DefaultSlideButton, SlideButtonPosition, SlideNavigationButton, DefaultSlideNavigationButton, FormInputName, FormButtonColor, DefaultFormButtonColor, ModalStyle, ModalBreakPoint, DefaultModalBreakPoint, FormIdentifyTextFields, FormIdentifyTextField, FormIdentifyTextFieldValidations, FormIdentifyTextFieldPlaceholders, DefaultFormIdentifyTextField, FormIdentifyBooleanFields, FormIdentifyBooleanField, DefaultFormIdentifyBooleanField, showAction, closeAction, loadStyle, applyCss, onShow, onClose, onChangeState, getActionRoot, getCssVariables, show, close, ensureModalRoot, createApp, createFog, collection, loadActionTableRow, loadActionTableRows, loadActionTableQuery, loadActionTable, widget, onMount, onDestory, beforeUpdate, afterUpdate, tick, LAYOUT_COMPONENT_NAMES };
|
2349
|
+
export { ACTION_HOOK_LABEL, KARTE_MODAL_ROOT, create, destroyAction, onCreate, onDestroy, showModal, destroy, initialize, finalize, loadGlobalScript, loadGlobalStyle, applyGlobalCss, getState, setState, getStates, isOpened, getVariables, setVariables, resetVariables, getEventHandlers, setEventHandlers, resetEventHandlers, getSystem, setSetting, eventHandlers, variables, formData, state, onScroll, onTime, getLogs, getEvents, logger, listenLogger, hideOnScroll, hideOnTime, showOnScroll, showOnTime, PropTypes, PropType, Code, MediaQueries, MediaQuery, Directions, Direction, AnimationStyles, AnimationStyle, ModalPositions, ModalPosition, ModalMargin, ModalPlacement, DefaultModalPlacement, Elasticities, Elasticity, ElasticityStyle, DefaultElasticity, TextDirections, TextDirection, OperationArgumentType, Operation, OnClickOperationOptions, OnClickOperation, LongText, Url, RegExpProp, Image, LengthUnits, LengthUnit, Length, Color, FontWeight, SYSTEM_FONT, Fonts, Font, Justifies, Justify, Alignments, Alignment, FlexDirections, FlexDirection, ObjectFits, ObjectFit, ClipPaths, ClipPath, Repeats, Repeat, BackgroundSizes, BackgroundSize, Cursors, Cursor, Overflows, Overflow, Border, BorderStyle, BorderWidth, BoxShadow, Style, TransitState, WritingModes, WritingMode, DateTime, Icon, ListSeparatorTypes, EdgePosition, DefaultEdgePosition, ListSeparatorNone, ListSeparatorBorder, ListSeparatorGap, ListSeparator, DefaultListSeparatorNone, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparator, ListBackgroundTypes, ListBackgroundNone, ListBackgroundStripe, ListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListBackground, ListDirections, ListDirection, ListContext, SlideButtonIcon, SlideButtonText, SlideButton, DefaultSlideButton, SlideButtonPosition, SlideNavigationButton, DefaultSlideNavigationButton, FormInputName, FormButtonColor, DefaultFormButtonColor, ModalStyle, ModalBreakPoint, DefaultModalBreakPoint, FormIdentifyTextFields, FormIdentifyTextField, FormIdentifyTextFieldValidations, FormIdentifyTextFieldPlaceholders, DefaultFormIdentifyTextField, FormIdentifyBooleanFields, FormIdentifyBooleanField, DefaultFormIdentifyBooleanField, showAction, closeAction, loadStyle, applyCss, onShow, onClose, onChangeState, getActionRoot, getCssVariables, show, close, ensureModalRoot, createApp, createFog, collection, loadActionTableRow, loadActionTableRows, loadActionTableQuery, loadActionTable, addChoiceAnswer, addFreeAnswer, removeAnswer, getAnsweredQuestion, getAnsweredQuestionIds, sendAnswer, sendAnswers, widget, onMount, onDestory, beforeUpdate, afterUpdate, tick, LAYOUT_COMPONENT_NAMES };
|
2281
2350
|
export type { SystemConfig, ActionVariables, ActionEventHandler, ActionProps, ActionOptions, ActionHook, ActionHookLog, ActionChangeStateHook, SendFunction, PublishFunction, OnScrollContext, OnScrollFunction, ScrollDirection, LogLevel, Log, Event, ActionCloseHook, ShowTrigger, CloseTrigger, CollectionConfig, ActionTableRowRequestConfig, ActionTableRowsRequestConfig, ActionTableQueryRequestConfig, ActionTableRequestConfig };
|
2282
2351
|
export { default as State } from './components/State.svelte';
|
2283
2352
|
export { default as StateItem } from './components/StateItem.svelte';
|
package/dist/index.es.js
CHANGED
@@ -2312,6 +2312,247 @@ function destroy() {
|
|
2312
2312
|
dispatchDestroyEvent();
|
2313
2313
|
}
|
2314
2314
|
|
2315
|
+
const USER_ID_VARIABLE_NAME = '__karte_form_identify_user_id';
|
2316
|
+
const MAX_LENGTH_FREE_ANSWER = 2000;
|
2317
|
+
function isEmpty(value) {
|
2318
|
+
if (Array.isArray(value)) {
|
2319
|
+
return value.length === 0;
|
2320
|
+
}
|
2321
|
+
else {
|
2322
|
+
return !value;
|
2323
|
+
}
|
2324
|
+
}
|
2325
|
+
/** @internal */
|
2326
|
+
function createInputRegisterer(formData) {
|
2327
|
+
const registerInput = ({ name, statePath, validator = () => true, initialValue, }) => {
|
2328
|
+
const writableValue = {
|
2329
|
+
subscribe(run) {
|
2330
|
+
return formData.subscribe(formData => {
|
2331
|
+
run(formData[name]?.value);
|
2332
|
+
});
|
2333
|
+
},
|
2334
|
+
set(value) {
|
2335
|
+
formData.update(prev => ({
|
2336
|
+
...prev,
|
2337
|
+
[name]: {
|
2338
|
+
statePath,
|
2339
|
+
value,
|
2340
|
+
isValid: validator(value),
|
2341
|
+
},
|
2342
|
+
}));
|
2343
|
+
},
|
2344
|
+
update(updater) {
|
2345
|
+
formData.update(prev => {
|
2346
|
+
const prevValue = prev[name]?.value;
|
2347
|
+
if (prevValue === undefined)
|
2348
|
+
return prev;
|
2349
|
+
const value = updater(prevValue);
|
2350
|
+
return {
|
2351
|
+
...prev,
|
2352
|
+
[name]: {
|
2353
|
+
statePath,
|
2354
|
+
value,
|
2355
|
+
isValid: validator(value),
|
2356
|
+
},
|
2357
|
+
};
|
2358
|
+
});
|
2359
|
+
},
|
2360
|
+
};
|
2361
|
+
const readableIsValid = {
|
2362
|
+
subscribe(run) {
|
2363
|
+
return formData.subscribe(formData => {
|
2364
|
+
run(formData[name]?.isValid);
|
2365
|
+
});
|
2366
|
+
},
|
2367
|
+
};
|
2368
|
+
if (isEmpty(get(writableValue))) {
|
2369
|
+
writableValue.set(initialValue);
|
2370
|
+
}
|
2371
|
+
return {
|
2372
|
+
value: writableValue,
|
2373
|
+
isValid: readableIsValid,
|
2374
|
+
};
|
2375
|
+
};
|
2376
|
+
return registerInput;
|
2377
|
+
}
|
2378
|
+
/** @internal */
|
2379
|
+
const registerInput = createInputRegisterer(formData);
|
2380
|
+
/** @internal */
|
2381
|
+
const registerIdentifyInput = createInputRegisterer(identifyFormData);
|
2382
|
+
function validateFormData(formData, statePath) {
|
2383
|
+
return Object.entries(formData)
|
2384
|
+
.filter(([_, { statePath: s }]) => s === statePath) // eslint-disable-line @typescript-eslint/no-unused-vars
|
2385
|
+
.every(([_, { isValid }]) => isValid); // eslint-disable-line @typescript-eslint/no-unused-vars
|
2386
|
+
}
|
2387
|
+
/** @internal */
|
2388
|
+
const getValuesAreValidReadable = statePath => ({
|
2389
|
+
subscribe(callback) {
|
2390
|
+
return formData.subscribe(formData => identifyFormData.subscribe(identifyFormData => {
|
2391
|
+
const valuesAreValid = validateFormData(formData, statePath) && validateFormData(identifyFormData, statePath);
|
2392
|
+
callback(valuesAreValid);
|
2393
|
+
}));
|
2394
|
+
},
|
2395
|
+
});
|
2396
|
+
function createAnswerValue(value) {
|
2397
|
+
if (Array.isArray(value)) {
|
2398
|
+
return {
|
2399
|
+
choices: value,
|
2400
|
+
};
|
2401
|
+
}
|
2402
|
+
else if (typeof value === 'string') {
|
2403
|
+
return {
|
2404
|
+
free_answer: value,
|
2405
|
+
};
|
2406
|
+
}
|
2407
|
+
}
|
2408
|
+
function formDataToEventValues(campaignId, formData) {
|
2409
|
+
const questions = [];
|
2410
|
+
const answersMap = {};
|
2411
|
+
Object.entries(formData).forEach(([name, dataItem]) => {
|
2412
|
+
questions.push(name);
|
2413
|
+
const value = dataItem.value;
|
2414
|
+
const answerKey = `question_${name}`;
|
2415
|
+
const answerValue = createAnswerValue(value);
|
2416
|
+
answersMap[answerKey] = answerValue;
|
2417
|
+
});
|
2418
|
+
return {
|
2419
|
+
[campaignId]: {
|
2420
|
+
questions,
|
2421
|
+
...answersMap,
|
2422
|
+
},
|
2423
|
+
};
|
2424
|
+
}
|
2425
|
+
function formDataToIdentifyEventValues(formData) {
|
2426
|
+
return Object.fromEntries(Object.entries(formData).map(([name, dataItem]) => {
|
2427
|
+
const value = dataItem.value;
|
2428
|
+
return [name, value];
|
2429
|
+
}));
|
2430
|
+
}
|
2431
|
+
/** @internal */
|
2432
|
+
function submit() {
|
2433
|
+
const systemConfig = getSystem();
|
2434
|
+
const campaignId = systemConfig.campaignId;
|
2435
|
+
if (campaignId) {
|
2436
|
+
const formData$1 = get(formData);
|
2437
|
+
const identifyFormData$1 = get(identifyFormData);
|
2438
|
+
const values = formDataToEventValues(campaignId, formData$1);
|
2439
|
+
const identifyValues = formDataToIdentifyEventValues(identifyFormData$1);
|
2440
|
+
if (Object.keys(identifyValues).length > 0) {
|
2441
|
+
identifyValues['user_id'] = getVariables()?.[USER_ID_VARIABLE_NAME];
|
2442
|
+
}
|
2443
|
+
return { values, identifyValues };
|
2444
|
+
}
|
2445
|
+
return {};
|
2446
|
+
}
|
2447
|
+
/**
|
2448
|
+
* 選択式のアンケート回答を追加する
|
2449
|
+
*
|
2450
|
+
* @param questionId - 質問ID
|
2451
|
+
* @param choices - 回答内容
|
2452
|
+
*
|
2453
|
+
* @public
|
2454
|
+
*/
|
2455
|
+
function addChoiceAnswer(questionId, choices, validation) {
|
2456
|
+
formData.update(prev => ({
|
2457
|
+
...prev,
|
2458
|
+
[questionId]: {
|
2459
|
+
value: choices,
|
2460
|
+
statePath: validation?.statePath ?? '',
|
2461
|
+
isValid: validation?.isValid ?? true,
|
2462
|
+
},
|
2463
|
+
}));
|
2464
|
+
}
|
2465
|
+
/**
|
2466
|
+
* 自由記述式のアンケート回答を追加する
|
2467
|
+
*
|
2468
|
+
* @param questionId - 質問ID
|
2469
|
+
* @param freeAnswer - 回答内容
|
2470
|
+
*
|
2471
|
+
* @public
|
2472
|
+
*/
|
2473
|
+
function addFreeAnswer(questionId, freeAnswer, validation) {
|
2474
|
+
formData.update(prev => ({
|
2475
|
+
...prev,
|
2476
|
+
[questionId]: {
|
2477
|
+
value: freeAnswer.slice(0, MAX_LENGTH_FREE_ANSWER),
|
2478
|
+
statePath: validation?.statePath ?? '',
|
2479
|
+
isValid: validation?.isValid ?? true,
|
2480
|
+
},
|
2481
|
+
}));
|
2482
|
+
}
|
2483
|
+
/**
|
2484
|
+
* 回答済の回答を削除
|
2485
|
+
*
|
2486
|
+
* @param questionId - 質問ID
|
2487
|
+
*
|
2488
|
+
* @public
|
2489
|
+
*/
|
2490
|
+
function removeAnswer(questionId) {
|
2491
|
+
formData.update(prev => {
|
2492
|
+
const next = { ...prev };
|
2493
|
+
delete next[questionId];
|
2494
|
+
return next;
|
2495
|
+
});
|
2496
|
+
}
|
2497
|
+
/**
|
2498
|
+
* 回答済の回答内容を取得する
|
2499
|
+
*
|
2500
|
+
* @param questionId - 質問ID
|
2501
|
+
*
|
2502
|
+
* @returns 回答データ
|
2503
|
+
*
|
2504
|
+
* @public
|
2505
|
+
*/
|
2506
|
+
function getAnsweredQuestion(questionId) {
|
2507
|
+
const formData$1 = get(formData);
|
2508
|
+
const valueState = formData$1[questionId];
|
2509
|
+
if (valueState) {
|
2510
|
+
return createAnswerValue(valueState.value);
|
2511
|
+
}
|
2512
|
+
}
|
2513
|
+
/**
|
2514
|
+
* 回答済の回答IDのリストを取得
|
2515
|
+
*
|
2516
|
+
* @returns 回答済の質問の質問IDの配列
|
2517
|
+
*
|
2518
|
+
* @public
|
2519
|
+
*/
|
2520
|
+
function getAnsweredQuestionIds() {
|
2521
|
+
const formData$1 = get(formData);
|
2522
|
+
return Object.keys(formData$1);
|
2523
|
+
}
|
2524
|
+
/**
|
2525
|
+
* `sendAnswers`のエイリアス
|
2526
|
+
*
|
2527
|
+
* @public
|
2528
|
+
*/
|
2529
|
+
function sendAnswer() {
|
2530
|
+
return sendAnswers();
|
2531
|
+
}
|
2532
|
+
// NOTE: sendAnswers用
|
2533
|
+
let isSent = false;
|
2534
|
+
/**
|
2535
|
+
* 回答済の回答をまとめてイベントとして送信する
|
2536
|
+
*
|
2537
|
+
* @returns イベント送信の成功/失敗
|
2538
|
+
*
|
2539
|
+
* @public
|
2540
|
+
*/
|
2541
|
+
function sendAnswers() {
|
2542
|
+
const { values, identifyValues } = submit();
|
2543
|
+
if (isSent)
|
2544
|
+
return false;
|
2545
|
+
if (Object.keys(values ?? {}).length === 0 && Object.keys(identifyValues ?? {}).length === 0) {
|
2546
|
+
return false;
|
2547
|
+
}
|
2548
|
+
send_event('_answer_question', values);
|
2549
|
+
if (Object.keys(identifyValues ?? {}).length > 0) {
|
2550
|
+
send_event('identify', identifyValues);
|
2551
|
+
}
|
2552
|
+
isSent = true;
|
2553
|
+
return true;
|
2554
|
+
}
|
2555
|
+
|
2315
2556
|
/**
|
2316
2557
|
* エディタv1のWidget API 互換のインターフェース
|
2317
2558
|
*/
|
@@ -2937,134 +3178,6 @@ class StateItem extends SvelteComponent {
|
|
2937
3178
|
}
|
2938
3179
|
}
|
2939
3180
|
|
2940
|
-
const USER_ID_VARIABLE_NAME = '__karte_form_identify_user_id';
|
2941
|
-
function isEmpty(value) {
|
2942
|
-
if (Array.isArray(value)) {
|
2943
|
-
return value.length === 0;
|
2944
|
-
}
|
2945
|
-
else {
|
2946
|
-
return !value;
|
2947
|
-
}
|
2948
|
-
}
|
2949
|
-
/** @internal */
|
2950
|
-
function createInputRegisterer(formData) {
|
2951
|
-
const registerInput = ({ name, statePath, validator = () => true, initialValue, }) => {
|
2952
|
-
const writableValue = {
|
2953
|
-
subscribe(run) {
|
2954
|
-
return formData.subscribe(formData => {
|
2955
|
-
run(formData[name]?.value);
|
2956
|
-
});
|
2957
|
-
},
|
2958
|
-
set(value) {
|
2959
|
-
formData.update(prev => ({
|
2960
|
-
...prev,
|
2961
|
-
[name]: {
|
2962
|
-
statePath,
|
2963
|
-
value,
|
2964
|
-
isValid: validator(value),
|
2965
|
-
},
|
2966
|
-
}));
|
2967
|
-
},
|
2968
|
-
update(updater) {
|
2969
|
-
formData.update(prev => {
|
2970
|
-
const prevValue = prev[name]?.value;
|
2971
|
-
if (prevValue === undefined)
|
2972
|
-
return prev;
|
2973
|
-
const value = updater(prevValue);
|
2974
|
-
return {
|
2975
|
-
...prev,
|
2976
|
-
[name]: {
|
2977
|
-
statePath,
|
2978
|
-
value,
|
2979
|
-
isValid: validator(value),
|
2980
|
-
},
|
2981
|
-
};
|
2982
|
-
});
|
2983
|
-
},
|
2984
|
-
};
|
2985
|
-
const readableIsValid = {
|
2986
|
-
subscribe(run) {
|
2987
|
-
return formData.subscribe(formData => {
|
2988
|
-
run(formData[name]?.isValid);
|
2989
|
-
});
|
2990
|
-
},
|
2991
|
-
};
|
2992
|
-
if (isEmpty(get(writableValue))) {
|
2993
|
-
writableValue.set(initialValue);
|
2994
|
-
}
|
2995
|
-
return {
|
2996
|
-
value: writableValue,
|
2997
|
-
isValid: readableIsValid,
|
2998
|
-
};
|
2999
|
-
};
|
3000
|
-
return registerInput;
|
3001
|
-
}
|
3002
|
-
/** @internal */
|
3003
|
-
const registerInput = createInputRegisterer(formData);
|
3004
|
-
/** @internal */
|
3005
|
-
const registerIdentifyInput = createInputRegisterer(identifyFormData);
|
3006
|
-
function validateFormData(formData, statePath) {
|
3007
|
-
return Object.entries(formData)
|
3008
|
-
.filter(([_, { statePath: s }]) => s === statePath) // eslint-disable-line @typescript-eslint/no-unused-vars
|
3009
|
-
.every(([_, { isValid }]) => isValid); // eslint-disable-line @typescript-eslint/no-unused-vars
|
3010
|
-
}
|
3011
|
-
/** @internal */
|
3012
|
-
const getValuesAreValidReadable = statePath => ({
|
3013
|
-
subscribe(callback) {
|
3014
|
-
return formData.subscribe(formData => identifyFormData.subscribe(identifyFormData => {
|
3015
|
-
const valuesAreValid = validateFormData(formData, statePath) && validateFormData(identifyFormData, statePath);
|
3016
|
-
callback(valuesAreValid);
|
3017
|
-
}));
|
3018
|
-
},
|
3019
|
-
});
|
3020
|
-
function formDataToEventValues(campaignId, formData) {
|
3021
|
-
const questions = [];
|
3022
|
-
const answersMap = {};
|
3023
|
-
Object.entries(formData).forEach(([name, dataItem]) => {
|
3024
|
-
questions.push(name);
|
3025
|
-
const value = dataItem.value;
|
3026
|
-
const answerKey = `question_${name}`;
|
3027
|
-
if (Array.isArray(value)) {
|
3028
|
-
answersMap[answerKey] = {
|
3029
|
-
choices: value,
|
3030
|
-
};
|
3031
|
-
}
|
3032
|
-
else if (typeof value === 'string') {
|
3033
|
-
answersMap[answerKey] = {
|
3034
|
-
free_answer: value,
|
3035
|
-
};
|
3036
|
-
}
|
3037
|
-
});
|
3038
|
-
return {
|
3039
|
-
[campaignId]: {
|
3040
|
-
questions,
|
3041
|
-
...answersMap,
|
3042
|
-
},
|
3043
|
-
};
|
3044
|
-
}
|
3045
|
-
function formDataToIdentifyEventValues(formData) {
|
3046
|
-
return Object.fromEntries(Object.entries(formData).map(([name, dataItem]) => {
|
3047
|
-
const value = dataItem.value;
|
3048
|
-
return [name, value];
|
3049
|
-
}));
|
3050
|
-
}
|
3051
|
-
/** @internal */
|
3052
|
-
function submit() {
|
3053
|
-
const systemConfig = getSystem();
|
3054
|
-
const campaignId = systemConfig.campaignId;
|
3055
|
-
if (campaignId) {
|
3056
|
-
const formData$1 = get(formData);
|
3057
|
-
const identifyFormData$1 = get(identifyFormData);
|
3058
|
-
const values = formDataToEventValues(campaignId, formData$1);
|
3059
|
-
const identifyValues = formDataToIdentifyEventValues(identifyFormData$1);
|
3060
|
-
if (Object.keys(identifyValues).length > 0) {
|
3061
|
-
identifyValues['user_id'] = getVariables()?.[USER_ID_VARIABLE_NAME];
|
3062
|
-
}
|
3063
|
-
return { values, identifyValues };
|
3064
|
-
}
|
3065
|
-
return {};
|
3066
|
-
}
|
3067
|
-
|
3068
3181
|
/**
|
3069
3182
|
* モーダル(ポップアップ)のコンポーネントが利用するコードの管理
|
3070
3183
|
*/
|
@@ -7783,14 +7896,14 @@ function add_css$e(target) {
|
|
7783
7896
|
|
7784
7897
|
function get_each_context$2(ctx, list, i) {
|
7785
7898
|
const child_ctx = ctx.slice();
|
7786
|
-
child_ctx[
|
7899
|
+
child_ctx[14] = list[i];
|
7787
7900
|
return child_ctx;
|
7788
7901
|
}
|
7789
7902
|
|
7790
|
-
// (
|
7903
|
+
// (68:2) {#each [...Array(count).keys()].map(i => i + startingNumber) as i}
|
7791
7904
|
function create_each_block$2(ctx) {
|
7792
7905
|
let button;
|
7793
|
-
let t0_value = /*i*/ ctx[
|
7906
|
+
let t0_value = /*i*/ ctx[14] + "";
|
7794
7907
|
let t0;
|
7795
7908
|
let t1;
|
7796
7909
|
let button_style_value;
|
@@ -7803,7 +7916,7 @@ function create_each_block$2(ctx) {
|
|
7803
7916
|
t0 = text(t0_value);
|
7804
7917
|
t1 = space();
|
7805
7918
|
attr(button, "class", "rating-button svelte-9idbf1");
|
7806
|
-
attr(button, "style", button_style_value = /*getTextButtonStyle*/ ctx[
|
7919
|
+
attr(button, "style", button_style_value = /*getTextButtonStyle*/ ctx[5](/*i*/ ctx[14] === /*_value*/ ctx[2]));
|
7807
7920
|
},
|
7808
7921
|
m(target, anchor) {
|
7809
7922
|
insert(target, button, anchor);
|
@@ -7812,7 +7925,7 @@ function create_each_block$2(ctx) {
|
|
7812
7925
|
|
7813
7926
|
if (!mounted) {
|
7814
7927
|
dispose = listen(button, "click", function () {
|
7815
|
-
if (is_function(/*handleClick*/ ctx[
|
7928
|
+
if (is_function(/*handleClick*/ ctx[4](/*i*/ ctx[14]))) /*handleClick*/ ctx[4](/*i*/ ctx[14]).apply(this, arguments);
|
7816
7929
|
});
|
7817
7930
|
|
7818
7931
|
mounted = true;
|
@@ -7820,9 +7933,9 @@ function create_each_block$2(ctx) {
|
|
7820
7933
|
},
|
7821
7934
|
p(new_ctx, dirty) {
|
7822
7935
|
ctx = new_ctx;
|
7823
|
-
if (dirty & /*count*/
|
7936
|
+
if (dirty & /*count, startingNumber*/ 3 && t0_value !== (t0_value = /*i*/ ctx[14] + "")) set_data(t0, t0_value);
|
7824
7937
|
|
7825
|
-
if (dirty & /*count, _value*/
|
7938
|
+
if (dirty & /*count, startingNumber, _value*/ 7 && button_style_value !== (button_style_value = /*getTextButtonStyle*/ ctx[5](/*i*/ ctx[14] === /*_value*/ ctx[2]))) {
|
7826
7939
|
attr(button, "style", button_style_value);
|
7827
7940
|
}
|
7828
7941
|
},
|
@@ -7836,7 +7949,7 @@ function create_each_block$2(ctx) {
|
|
7836
7949
|
|
7837
7950
|
function create_fragment$f(ctx) {
|
7838
7951
|
let div;
|
7839
|
-
let each_value = [...Array(/*count*/ ctx[0]).keys()].map(func
|
7952
|
+
let each_value = [...Array(/*count*/ ctx[0]).keys()].map(/*func*/ ctx[12]);
|
7840
7953
|
let each_blocks = [];
|
7841
7954
|
|
7842
7955
|
for (let i = 0; i < each_value.length; i += 1) {
|
@@ -7861,8 +7974,8 @@ function create_fragment$f(ctx) {
|
|
7861
7974
|
}
|
7862
7975
|
},
|
7863
7976
|
p(ctx, [dirty]) {
|
7864
|
-
if (dirty & /*getTextButtonStyle, Array, count, _value, handleClick*/
|
7865
|
-
each_value = [...Array(/*count*/ ctx[0]).keys()].map(func
|
7977
|
+
if (dirty & /*getTextButtonStyle, Array, count, startingNumber, _value, handleClick*/ 55) {
|
7978
|
+
each_value = [...Array(/*count*/ ctx[0]).keys()].map(/*func*/ ctx[12]);
|
7866
7979
|
let i;
|
7867
7980
|
|
7868
7981
|
for (i = 0; i < each_value.length; i += 1) {
|
@@ -7893,14 +8006,13 @@ function create_fragment$f(ctx) {
|
|
7893
8006
|
};
|
7894
8007
|
}
|
7895
8008
|
|
7896
|
-
const func$1 = i => i + 1;
|
7897
|
-
|
7898
8009
|
function instance$f($$self, $$props, $$invalidate) {
|
7899
8010
|
let _value;
|
7900
8011
|
let $value;
|
7901
8012
|
let { name = '' } = $$props;
|
7902
8013
|
let { required = false } = $$props;
|
7903
8014
|
let { count = 5 } = $$props;
|
8015
|
+
let { startingNumber = 1 } = $$props;
|
7904
8016
|
let { font = SYSTEM_FONT } = $$props;
|
7905
8017
|
let { buttonStyle = 'width: 32px; height: 32px; font-size: 12px; font-weight: bold; border-radius: 17px; color: #333; background-color: rgba(0, 16, 14, 0.06); box-shadow: 0px 0px 16px 0px rgba(0, 16, 14, 0);' } = $$props;
|
7906
8018
|
let { buttonActiveStyle = 'color: #333; background-color: #2aab9f; box-shadow: 0px 8px 16px 0px rgba(0, 16, 14, 0.3);' } = $$props;
|
@@ -7916,7 +8028,7 @@ function instance$f($$self, $$props, $$invalidate) {
|
|
7916
8028
|
}
|
7917
8029
|
});
|
7918
8030
|
|
7919
|
-
component_subscribe($$self, value, value => $$invalidate(
|
8031
|
+
component_subscribe($$self, value, value => $$invalidate(11, $value = value));
|
7920
8032
|
|
7921
8033
|
const handleClick = index => event => {
|
7922
8034
|
value.set([String(index)]);
|
@@ -7930,27 +8042,31 @@ function instance$f($$self, $$props, $$invalidate) {
|
|
7930
8042
|
].join(';');
|
7931
8043
|
}
|
7932
8044
|
|
8045
|
+
const func = i => i + startingNumber;
|
8046
|
+
|
7933
8047
|
$$self.$$set = $$props => {
|
7934
|
-
if ('name' in $$props) $$invalidate(
|
7935
|
-
if ('required' in $$props) $$invalidate(
|
8048
|
+
if ('name' in $$props) $$invalidate(6, name = $$props.name);
|
8049
|
+
if ('required' in $$props) $$invalidate(7, required = $$props.required);
|
7936
8050
|
if ('count' in $$props) $$invalidate(0, count = $$props.count);
|
7937
|
-
if ('
|
7938
|
-
if ('
|
7939
|
-
if ('
|
8051
|
+
if ('startingNumber' in $$props) $$invalidate(1, startingNumber = $$props.startingNumber);
|
8052
|
+
if ('font' in $$props) $$invalidate(8, font = $$props.font);
|
8053
|
+
if ('buttonStyle' in $$props) $$invalidate(9, buttonStyle = $$props.buttonStyle);
|
8054
|
+
if ('buttonActiveStyle' in $$props) $$invalidate(10, buttonActiveStyle = $$props.buttonActiveStyle);
|
7940
8055
|
};
|
7941
8056
|
|
7942
8057
|
$$self.$$.update = () => {
|
7943
|
-
if ($$self.$$.dirty & /*font*/
|
8058
|
+
if ($$self.$$.dirty & /*font*/ 256) {
|
7944
8059
|
addFont(font);
|
7945
8060
|
}
|
7946
8061
|
|
7947
|
-
if ($$self.$$.dirty & /*$value*/
|
7948
|
-
$$invalidate(
|
8062
|
+
if ($$self.$$.dirty & /*$value*/ 2048) {
|
8063
|
+
$$invalidate(2, _value = Number($value[0] ?? -1));
|
7949
8064
|
}
|
7950
8065
|
};
|
7951
8066
|
|
7952
8067
|
return [
|
7953
8068
|
count,
|
8069
|
+
startingNumber,
|
7954
8070
|
_value,
|
7955
8071
|
value,
|
7956
8072
|
handleClick,
|
@@ -7960,7 +8076,8 @@ function instance$f($$self, $$props, $$invalidate) {
|
|
7960
8076
|
font,
|
7961
8077
|
buttonStyle,
|
7962
8078
|
buttonActiveStyle,
|
7963
|
-
$value
|
8079
|
+
$value,
|
8080
|
+
func
|
7964
8081
|
];
|
7965
8082
|
}
|
7966
8083
|
|
@@ -7975,12 +8092,13 @@ class FormRatingButtonsNumber extends SvelteComponent {
|
|
7975
8092
|
create_fragment$f,
|
7976
8093
|
safe_not_equal,
|
7977
8094
|
{
|
7978
|
-
name:
|
7979
|
-
required:
|
8095
|
+
name: 6,
|
8096
|
+
required: 7,
|
7980
8097
|
count: 0,
|
7981
|
-
|
7982
|
-
|
7983
|
-
|
8098
|
+
startingNumber: 1,
|
8099
|
+
font: 8,
|
8100
|
+
buttonStyle: 9,
|
8101
|
+
buttonActiveStyle: 10
|
7984
8102
|
},
|
7985
8103
|
add_css$e
|
7986
8104
|
);
|
@@ -11074,4 +11192,4 @@ class ImageBlock extends SvelteComponent {
|
|
11074
11192
|
}
|
11075
11193
|
}
|
11076
11194
|
|
11077
|
-
export { ACTION_HOOK_LABEL, Alignments, AnimationStyles, BackgroundSizes, Box, ClipPaths, CodeElement, Countdown, Cursors, DefaultEdgePosition, DefaultElasticity, DefaultFormButtonColor, DefaultFormIdentifyBooleanField, DefaultFormIdentifyTextField, DefaultListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListSeparator, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparatorNone, DefaultModalBreakPoint, DefaultModalPlacement, DefaultSlideButton, DefaultSlideNavigationButton, Directions, Elasticities, ElasticityStyle, EmbedElement, Flex, FlexDirections, FlexItem, Fonts, FormCheckBoxes, FormIdentifyBooleanFields, FormIdentifyChoices, FormIdentifyInput, FormIdentifyTextFieldPlaceholders, FormIdentifyTextFieldValidations, FormIdentifyTextFields, FormRadioButtons, FormRatingButtonsFace, FormRatingButtonsNumber, FormSelect, FormTextarea, Grid, GridItem, GridModalState, IconElement, ImageBlock, ImageElement, Justifies, KARTE_MODAL_ROOT, LAYOUT_COMPONENT_NAMES, LengthUnits, List, ListBackgroundTypes, ListDirections, ListItem, ListSeparatorTypes, MediaQueries, Modal, ModalPositions, MovieVimeoElement, MovieYouTubeElement, ObjectFits, OnClickOperationOptions, Overflows, PropTypes, Repeats, SYSTEM_FONT, Slide, SlideItem, State, StateItem, TextBlock, TextButtonBlock, TextButtonElement, TextDirections, TextElement, WritingModes, afterUpdate, applyCss, applyGlobalCss, beforeUpdate, close, closeAction, collection$1 as collection, create, createApp, createFog, destroy, destroyAction, ensureModalRoot, eventHandlers, finalize, formData, getActionRoot, getCssVariables, getEventHandlers, getEvents, getLogs, getState$1 as getState, getStates, getSystem, getVariables, hideOnScroll, hideOnTime, initialize, isOpened, listenLogger, loadActionTable, loadActionTableQuery, loadActionTableRow, loadActionTableRows, loadGlobalScript, loadGlobalStyle, loadStyle, logger, onChangeState, onClose, onCreate, onDestory, onDestroy, onMount, onScroll, onShow, onTime, resetEventHandlers, resetVariables, setEventHandlers, setSetting, setState$1 as setState, setVariables, show, showAction, showModal, showOnScroll, showOnTime, state, tick, variables, widget };
|
11195
|
+
export { ACTION_HOOK_LABEL, Alignments, AnimationStyles, BackgroundSizes, Box, ClipPaths, CodeElement, Countdown, Cursors, DefaultEdgePosition, DefaultElasticity, DefaultFormButtonColor, DefaultFormIdentifyBooleanField, DefaultFormIdentifyTextField, DefaultListBackground, DefaultListBackgroundNone, DefaultListBackgroundStripe, DefaultListSeparator, DefaultListSeparatorBorder, DefaultListSeparatorGap, DefaultListSeparatorNone, DefaultModalBreakPoint, DefaultModalPlacement, DefaultSlideButton, DefaultSlideNavigationButton, Directions, Elasticities, ElasticityStyle, EmbedElement, Flex, FlexDirections, FlexItem, Fonts, FormCheckBoxes, FormIdentifyBooleanFields, FormIdentifyChoices, FormIdentifyInput, FormIdentifyTextFieldPlaceholders, FormIdentifyTextFieldValidations, FormIdentifyTextFields, FormRadioButtons, FormRatingButtonsFace, FormRatingButtonsNumber, FormSelect, FormTextarea, Grid, GridItem, GridModalState, IconElement, ImageBlock, ImageElement, Justifies, KARTE_MODAL_ROOT, LAYOUT_COMPONENT_NAMES, LengthUnits, List, ListBackgroundTypes, ListDirections, ListItem, ListSeparatorTypes, MediaQueries, Modal, ModalPositions, MovieVimeoElement, MovieYouTubeElement, ObjectFits, OnClickOperationOptions, Overflows, PropTypes, Repeats, SYSTEM_FONT, Slide, SlideItem, State, StateItem, TextBlock, TextButtonBlock, TextButtonElement, TextDirections, TextElement, WritingModes, addChoiceAnswer, addFreeAnswer, afterUpdate, applyCss, applyGlobalCss, beforeUpdate, close, closeAction, collection$1 as collection, create, createApp, createFog, destroy, destroyAction, ensureModalRoot, eventHandlers, finalize, formData, getActionRoot, getAnsweredQuestion, getAnsweredQuestionIds, getCssVariables, getEventHandlers, getEvents, getLogs, getState$1 as getState, getStates, getSystem, getVariables, hideOnScroll, hideOnTime, initialize, isOpened, listenLogger, loadActionTable, loadActionTableQuery, loadActionTableRow, loadActionTableRows, loadGlobalScript, loadGlobalStyle, loadStyle, logger, onChangeState, onClose, onCreate, onDestory, onDestroy, onMount, onScroll, onShow, onTime, removeAnswer, resetEventHandlers, resetVariables, sendAnswer, sendAnswers, setEventHandlers, setSetting, setState$1 as setState, setVariables, show, showAction, showModal, showOnScroll, showOnTime, state, tick, variables, widget };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@plaidev/karte-action-sdk",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.222",
|
4
4
|
"author": "Plaid Inc.",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"module": "./dist/index.es.js",
|
@@ -56,6 +56,7 @@
|
|
56
56
|
"devDependencies": {
|
57
57
|
"@microsoft/api-documenter": "7.19.28",
|
58
58
|
"@microsoft/api-extractor": "7.33.8",
|
59
|
+
"@plaidev/action-compiler": "workspace:*",
|
59
60
|
"@rollup/plugin-alias": "^4.0.0",
|
60
61
|
"@rollup/plugin-commonjs": "^23.0.1",
|
61
62
|
"@rollup/plugin-json": "^5.0.0",
|
@@ -95,14 +96,7 @@
|
|
95
96
|
"tsx": "^3.12.3",
|
96
97
|
"typescript": "^4.7.4",
|
97
98
|
"vitepress": "1.0.0-alpha.30",
|
98
|
-
"vitest": "latest"
|
99
|
-
"@plaidev/action-compiler": "0.4.231"
|
100
|
-
},
|
101
|
-
"publishConfig": {
|
102
|
-
"access": "public"
|
103
|
-
},
|
104
|
-
"dependencies": {
|
105
|
-
"@rollup/plugin-image": "^3.0.2"
|
99
|
+
"vitest": "latest"
|
106
100
|
},
|
107
101
|
"scripts": {
|
108
102
|
"dev": "tsx ./scripts/preview.ts",
|
@@ -131,5 +125,11 @@
|
|
131
125
|
"test:update": "vitest -u",
|
132
126
|
"coverage": "vitest run test --coverage",
|
133
127
|
"icons:update": "tsx ./scripts/update-icons.ts && prettier -w ./src/icons.ts"
|
128
|
+
},
|
129
|
+
"publishConfig": {
|
130
|
+
"access": "public"
|
131
|
+
},
|
132
|
+
"dependencies": {
|
133
|
+
"@rollup/plugin-image": "^3.0.2"
|
134
134
|
}
|
135
|
-
}
|
135
|
+
}
|