Smile.* methods were bundled with Smile UI, which allowed you to fetch and interact with customer and loyalty program data using JavaScript. These methods have been removed and replaced with a new standalone JavaScript SDK library that can be used independently of (or together with) Smile UI. This guide walks you through what’s new and how to migrate your code.
Smile.* methods bundled with Smile UI have been removed. Any code still calling them throws standard JavaScript errors (e.g. TypeError: Smile.fetchCustomer is not a function) until it’s migrated to the new JavaScript SDK.What’s new
The new JavaScript SDK, Smile.js, is a standalone library that can be used with or without Smile UI. It offers methods for fetching and interacting with customer and loyalty program data, and works with modern JavaScript tooling and frameworks. Once you’ve upgraded, you’ll be able to:- Load the SDK via a script tag or a bundler like Vite or Webpack.
- Use included TypeScript type definitions for autocomplete and type checking.
- Preload multiple resources in a single API call to reduce latency and load times.
- Log customers in and out programmatically without a full page reload.
- Access additional data such as detailed customer VIP status and program settings.
How to migrate
To migrate to the new JavaScript SDK, you need to make the following changes to your code. Each step contains instructions and examples to guide you along the way.1. Include the JavaScript SDK
- Shopify
- BigCommerce
- Custom storefront
2. Update method calls
Any call sites for the removedSmile.* methods should be updated to use the corresponding methods from the JavaScript SDK instead.
3. Update customer ready calls
TheSmileUI.customerReady() method has been removed, and the appropriate replacement depends on what you’re trying to achieve.
- To detect when it’s safe to call other
SmileUI.*methods, use theSmileUI.ready()method. This would typically be for situations where you want to programmatically open the loyalty panel or launcher. - To detect when it’s safe to call other
Smile.*methods, listen for thesmile-js-initializedevent from the JavaScript SDK. This would typically be for situations where you want to programmatically access information about the customer or loyalty program (like displaying their points balance).
- Calling SmileUI.* methods
- Calling Smile.* methods
4. Update object properties
The JavaScript SDK now returns all objects withcamelCase property names (instead of snake_case) for improved compatibility with modern JavaScript frameworks and tooling. As such, you’ll need to update any code that accesses object properties to use the new camelCase names.
5. Audit for preloading
The JavaScript SDK introduces the ability to preload resources, enabling you to retrieve multiple resources on initial page load and reduce the number of roundtrip API calls being made. This helps improve performance and reduce latency, while also providing instant access to preloaded data via new.preloaded() methods on each resource class.
Read our guide on preloading resources, and then audit your code for opportunities to switch from using .get() methods to the new .preloaded() methods instead. Often, it’s as simple as replacing a single .get() call with a single .preloaded() call, like so:
6. Preload points settings
TheSmile.formatPoints() method is now part of the JavaScript SDK and requires that the account’s points settings be preloaded before points values can be formatted.
- Shopify
- BigCommerce
- Custom storefront
Smile.formatPoints() method, you’ll need to call Smile.preload() with pointsSettings before formatting points.7. Audit manual page reloads
- With Smile UI
- Standalone JavaScript SDK
8. Check for remaining errors
After completing the migration steps above, you should no longer see any errors related to the removedSmile.* methods (e.g. TypeError: Smile.fetchCustomer is not a function) in the browser console when viewing your storefront. If you do, it means that you’re still calling one or more of the removed methods and your code requires further updates.
Where to get help
While we aren’t able to assist with updating, debugging, or reviewing custom code, our support team can help answer questions or clarify details related to the migration process or the JavaScript SDK itself. If you need assistance updating your code, our team can help connect you with an agency partner who specializes in Smile integrations.FAQ
Does this affect me if I only use the standard rewards panel and launcher?
Does this affect me if I only use the standard rewards panel and launcher?
Smile.* methods (like Smile.fetchCustomer() or Smile.createActivity()). If your storefront only uses the out-of-the-box rewards panel and launcher and hasn’t been customized with code that calls these methods, no action is required.This migration only applies if you (or your developer) wrote custom code using the removed methods — typically to embed loyalty information directly into your storefront (e.g. a customer’s points balance in the site header) or to build custom loyalty pages and experiences.How do I know if I'm using a removed method?
How do I know if I'm using a removed method?
Smile.* methods (e.g. TypeError: Smile.fetchCustomer is not a function) in the browser console. If you see any, you’ll need to update your code to use the corresponding methods from the JavaScript SDK instead.If you’ve visited every page on your website and don’t see any of these errors, try searching through your codebase for any remaining references to the removed methods.If you’ve done both and haven’t found any references to the removed methods in your codebase or seen any related errors in the browser console, no migration is required.What is the full list of methods that were removed?
What is the full list of methods that were removed?
Smile.createActivity()Smile.customerReady()Smile.fetchAllCustomerPointsProducts()Smile.fetchAllPointsProducts()Smile.fetchAllRewardFulfillments()Smile.fetchCustomer()Smile.fetchPointsProduct()Smile.formatPoints()Smile.purchasePointsProduct()Smile.ready()
What should I do if I'm using a removed method?
What should I do if I'm using a removed method?
Can Smile do the migration for me?
Can Smile do the migration for me?
What happens if I haven't migrated yet?
What happens if I haven't migrated yet?
Smile.* methods now throw standard JavaScript errors (e.g. TypeError: Smile.fetchCustomer is not a function). Any custom code still calling them doesn’t work — for example, custom points balance displays, referral URL displays, or any custom loyalty pages built using the removed methods. Following the migration steps in this guide restores that functionality.Standard Smile UI functionality (the rewards panel and launcher) is not affected and continues to work as expected.Will my customers' points balances or other loyalty data be affected by the migration?
Will my customers' points balances or other loyalty data be affected by the migration?
Will my customers experience any downtime during the migration?
Will my customers experience any downtime during the migration?
Smile.* methods stopped working when the methods were removed, and remains unavailable until you migrate that code to the JavaScript SDK. Each call site starts working again as soon as its migrated code is deployed, so you can migrate and ship incrementally.My developer or agency built our custom integration — what should I send them?
My developer or agency built our custom integration — what should I send them?
Can I run both the old Smile.* methods and the new JavaScript SDK side-by-side during migration?
Can I run both the old Smile.* methods and the new JavaScript SDK side-by-side during migration?
Smile.* methods have been removed and no longer work, so they can’t run alongside their JavaScript SDK equivalents. You can still migrate one method call at a time, test as you go, and ship changes incrementally rather than all at once — each migrated call starts working as soon as it’s deployed.How can I test the migration before deploying to production?
How can I test the migration before deploying to production?
- Shopify: Use a development store or a duplicate of your live theme to test changes before publishing.
- BigCommerce: Use a staging or preview store.
- Custom storefront: Use whatever staging or preview environment you typically deploy to before production.
Smile.* methods in the browser console, custom features functioning correctly), deploy the changes to production.Why were the Smile.* methods removed?
Why were the Smile.* methods removed?
Smile.* methods were bundled with Smile UI and were difficult to use in modern JavaScript projects. The new JavaScript SDK is a standalone library that brings several improvements:- Works with modern frameworks and bundlers (e.g. Vite, Webpack)
- Includes TypeScript type definitions for autocomplete and type checking
- Supports preloading multiple resources in a single API call to reduce latency
- Allows logging customers in and out programmatically without a full page reload
- Provides access to additional data such as detailed VIP status and program settings