An explanation of why certain Tecton capabilities may be undefined at runtime.
Sometimes, when you try to use a specific capability, you might encounter an error saying that the feature is undefined. Though rare, it's helpful to understand why this might happen.
Some features are designed exclusively for native mobile apps. Features like enrollPush, unenrollPush, shareText, and takePicture fall into this category. If you attempt to use them on a desktop or mobile browser, they won't work and will cause an error.
As Tecton evolves, new capabilities are added as their need is identified. However, if your feature is being rendered on an outdated version of the platform, you might not have access to the capabilities introduced after it was released. Using such features on outdated versions will trigger an error.
Some capabilities might not be available depending on which platform your feature is rendered within. Each platform decides how a capability should be implemented in its system. If the team managing a particular platform hasn't added a feature yet, you won't be able to use it.
In the end, it's a common best practice to make sure the capability you want to use exists before using it. One simple and shorthand way to do this is with the optional chaining operator in Javascript. With it, you can do something like the following:
tecton.actions.myCapability?.(options) ?? someFallback();