UNPKG

@aws-amplify/xr

Version:
224 lines • 12.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 var core_1 = require("@aws-amplify/core"); var SumerianProvider_1 = require("./Providers/SumerianProvider"); var Errors_1 = require("./Errors"); var logger = new core_1.ConsoleLogger('XR'); var DEFAULT_PROVIDER_NAME = 'SumerianProvider'; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ var XRClass = /** @class */ (function () { /** * Initialize XR with AWS configurations * * @param {XROptions} options - Configuration object for XR * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ function XRClass(options) { this._options = options; logger.debug('XR Options', this._options); this._defaultProvider = DEFAULT_PROVIDER_NAME; this._pluggables = {}; // Add default provider this.addPluggable(new SumerianProvider_1.SumerianProvider()); } /** * Configure XR part with configurations * * @param {XROptions} config - Configuration for XR * @return {Object} - The current configuration * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.configure = function (options) { var _this = this; var opt = options ? options.XR || options : {}; logger.debug('configure XR', { opt: opt }); this._options = Object.assign({}, this._options, opt); Object.entries(this._pluggables).map(function (_a) { var _b = tslib_1.__read(_a, 2), name = _b[0], provider = _b[1]; if (name === _this._defaultProvider && !opt[_this._defaultProvider]) { provider.configure(_this._options); } else { provider.configure(_this._options[name]); } }); return this._options; }; /** * add plugin into XR category * @param {Object} pluggable - an instance of the plugin * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.addPluggable = function (pluggable) { return tslib_1.__awaiter(this, void 0, void 0, function () { var config; return tslib_1.__generator(this, function (_a) { if (pluggable && pluggable.getCategory() === 'XR') { this._pluggables[pluggable.getProviderName()] = pluggable; config = pluggable.configure(this._options); return [2 /*return*/, config]; } return [2 /*return*/]; }); }); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.loadScene = function (sceneName, domElementId, sceneOptions, provider) { if (sceneOptions === void 0) { sceneOptions = {}; } if (provider === void 0) { provider = this._defaultProvider; } return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return [4 /*yield*/, this._pluggables[provider].loadScene(sceneName, domElementId, sceneOptions)]; case 1: return [2 /*return*/, _a.sent()]; } }); }); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.isSceneLoaded = function (sceneName, provider) { if (provider === void 0) { provider = this._defaultProvider; } if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return this._pluggables[provider].isSceneLoaded(sceneName); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.getSceneController = function (sceneName, provider) { if (provider === void 0) { provider = this._defaultProvider; } if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return this._pluggables[provider].getSceneController(sceneName); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.isVRCapable = function (sceneName, provider) { if (provider === void 0) { provider = this._defaultProvider; } if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return this._pluggables[provider].isVRCapable(sceneName); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.isVRPresentationActive = function (sceneName, provider) { if (provider === void 0) { provider = this._defaultProvider; } if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return this._pluggables[provider].isVRPresentationActive(sceneName); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.start = function (sceneName, provider) { if (provider === void 0) { provider = this._defaultProvider; } if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return this._pluggables[provider].start(sceneName); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.enterVR = function (sceneName, provider) { if (provider === void 0) { provider = this._defaultProvider; } if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return this._pluggables[provider].enterVR(sceneName); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.exitVR = function (sceneName, provider) { if (provider === void 0) { provider = this._defaultProvider; } if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return this._pluggables[provider].exitVR(sceneName); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.isMuted = function (sceneName, provider) { if (provider === void 0) { provider = this._defaultProvider; } if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return this._pluggables[provider].isMuted(sceneName); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.setMuted = function (sceneName, muted, provider) { if (provider === void 0) { provider = this._defaultProvider; } if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return this._pluggables[provider].setMuted(sceneName, muted); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.onSceneEvent = function (sceneName, eventName, eventHandler, provider) { if (provider === void 0) { provider = this._defaultProvider; } if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return this._pluggables[provider].onSceneEvent(sceneName, eventName, eventHandler); }; /** * @deprecated The Amazon Sumerian service is no longer accepting new customers. Existing customer scenes will not be * available after February 21, 2023. The AWS Amplify XR features depend on the Amazon Sumerian service to function * and as a result, will no longer be available. */ XRClass.prototype.enableAudio = function (sceneName, provider) { if (provider === void 0) { provider = this._defaultProvider; } if (!this._pluggables[provider]) throw new Errors_1.XRProviderNotConfigured("Provider '" + provider + "' not configured"); return this._pluggables[provider].enableAudio(sceneName); }; return XRClass; }()); exports.XRClass = XRClass; exports.XR = new XRClass(null); core_1.Amplify.register(exports.XR); //# sourceMappingURL=XR.js.map