react-native-smkit-ui
Version:
React Native library for SMKit UI - Advanced fitness assessments and workout programs with AI-powered motion detection and real-time performance tracking
105 lines (95 loc) • 5.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.configure = configure;
exports.setCounterPreferences = setCounterPreferences;
exports.setEndExercisePreferences = setEndExercisePreferences;
exports.setSessionLanguage = setSessionLanguage;
exports.startAssessment = startAssessment;
exports.startCustomAssessment = startCustomAssessment;
exports.startCustomWorkout = startCustomWorkout;
exports.startWorkoutProgram = startWorkoutProgram;
var _reactNative = require("react-native");
const LINKING_ERROR = `The package 'react-native-smkit-ui' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
ios: "- You have run 'pod install'\n",
default: ''
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
// Fix: Use bracket notation to access NativeModules property
const SMKitUIManager = _reactNative.NativeModules['SMKitUIManager'] ? _reactNative.NativeModules['SMKitUIManager'] : new Proxy({}, {
get() {
throw new Error(LINKING_ERROR);
}
});
/**
* This function will configure the sdk
* @param {string} key - your auth key
*/
function configure(key) {
return SMKitUIManager.configure(key);
}
/**
* start an assessment session.
*
* @param {SMWorkoutLibrary.AssessmentTypes} type - The type of assessment to start.
* @param {boolean} [showSummary=true] - Determines if the summary should be shown after assessment completion.
* @param {SMWorkoutLibrary.UserData | null} userData - User data for the assessment session, or `null` if no user data is provided.
* @param {boolean} [forceShowUserDataScreen=false] - Forces the display of the user data screen even if user data is provided.
* @param {string} customAssessmentID - A unique identifier for a custom assessment session.
* @returns {Promise<{ summary: string; didFinish: boolean }>} - A promise that resolves with an object containing the summary and a flag indicating whether the assessment finished.
*/
function startAssessment(type, showSummary = true, userData, forceShowUserDataScreen = false, customAssessmentID) {
return SMKitUIManager.startAssessment(type, showSummary, userData === null || userData === void 0 ? void 0 : userData.toJson(), forceShowUserDataScreen, customAssessmentID);
}
/**
* Starts a custom workout session.
*
* @param {SMWorkoutLibrary.SMWorkout} workout - The custom workout configuration.
* @returns {Promise<{ summary: string; didFinish: boolean }>} - A promise that resolves with an object containing the summary and a flag indicating if the workout session finished.
*/
function startCustomWorkout(workout) {
return SMKitUIManager.startCustomWorkout(workout.toJson());
}
/**
* Initiates a custom assessment session.
*
* @param {SMWorkoutLibrary.SMWorkout} assessment - The assessment configuration for the session.
* @param {SMWorkoutLibrary.UserData | null} userData - User data for the assessment, or `null` if no user data is provided.
* @param {boolean} [forceShowUserDataScreen=false] - Forces the display of the user data screen even if user data is provided.
* @param {boolean} [showSummary=true] - Determines if the summary should be shown after assessment completion.
* @returns {Promise<{ summary: string; didFinish: boolean }>} - A promise that resolves with an object containing the summary and a flag indicating if the assessment finished.
*/
function startCustomAssessment(assessment, userData, forceShowUserDataScreen = false, showSummary = true) {
return SMKitUIManager.startCustomAssessment(assessment.toJson(), userData === null || userData === void 0 ? void 0 : userData.toJson(), forceShowUserDataScreen, showSummary);
}
/**
* Starts a workout program using the provided workout configuration.
*
* @param {SMWorkoutLibrary.WorkoutConfig} workoutConfig - The configuration for the workout program.
* @returns {Promise<{ summary: string; didFinish: boolean }>} - A promise that resolves with an object containing the summary and a flag indicating if the workout program finished.
*/
function startWorkoutProgram(workoutConfig) {
return SMKitUIManager.startWorkoutProgram(workoutConfig.toJson());
}
/**
* Sets a text language for the current workout session
* @param {SMWorkoutLibrary} language - The language that you would like to set.
*/
function setSessionLanguage(language) {
SMKitUIManager.setSessionLanguage(language);
}
/**
* Sets the closure target for the workout session.
* @param {SMWorkoutLibrary.EndExercisePreferences} endExercisePreferences - The closure target to set.
*/
function setEndExercisePreferences(endExercisePreferences) {
SMKitUIManager.setEndExercisePreferences(endExercisePreferences);
}
/**
* Sets the counter preferences for the workout session.
* @param {SMWorkoutLibrary.CounterPreferences} counterPreferences - The counter preferences to set.
*/
function setCounterPreferences(counterPreferences) {
SMKitUIManager.setCounterPreferences(counterPreferences);
}
//# sourceMappingURL=index.js.map