DISTRIBUTION
NOTE:
public/index.html
should be updated to reflect changes toexample/snippet.html
&example/snippet-example.html
See snippet.html for distribution snippet
TESTING A SPECIFIC VERSION
NOTE: Update the
app_id
value insnippet.html
to override the production Application
- Update snippet.html URLs to use a specific npm version
- Update
app_id
to use the Staging enviornment
app_id: '70C5B4F2-A7CF-4BD6-81C4-68841DE927CC', // Staging
https://cdn.jsdelivr.net/npm/@friendemic/catalyst-chat-widget@1.2.3-next.4/build/static/css/main.css
https://cdn.jsdelivr.net/npm/@friendemic/catalyst-chat-widget@1.2.3-next.4/build/static/js/main.js
PUBLISHING
NOTE: See root README.md
MIGRATION
From version 0.2.6 => 0.2.8
All previous active systems should remain supported
Changes were made to ratain support for previous configuration techniques
New snippet looks like this:
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/@friendemic/catalyst-chat-widget@latest/build/static/css/main.css" />
</head>
<body>
<!-- place at bottom in root of <body /> element -->
<div id="friendemic_chat_widget" data-client-id="PLACE_ULID"></div>
<script src="https://unpkg.com/@friendemic/catalyst-chat-widget@latest/build/static/js/main.js"></script>
</body>
</html>
- The
data-client-id
html attribute contains the place ulid that identifies which configuration to load. - If
window.CS_WIDGET_CONFIG
exists and the request to Glovebox fails, the window config object will be used. - If no configuration can be found, something has gone completely
✋ 🤧 🤚 wonko and the widget will be hidden.
From version 0.2.* => 0.3.0
Minor bump due to refactor
<div id="friendemic_chat_widget" data-client-id="ULID"></div>
System now uses data-client-id="ULID"
falling back to window.CS_WIDGET_CONFIG
if fetch to glovebox fails.
From version 0.2.* => 0.2.6
No action is required
Changes are set up to prepare for API, but allows for the previous systems to function
Updated the .env to state both prod and staging APP_IDs for sendbird:
REACT_APP_SENDBIRD_APP_ID_STAGING="" # applies in development enviornment
REACT_APP_SENDBIRD_APP_ID="" # applies during build for production
Added new window variables
-
CS_WIDGET_CONFIG
: Deprecated will be removed -
CS_CLIENT_ID
: Currently a noop- Used in fetch to retrieve config from non-existent API
- If this has a value, it will fail and use
CS_WIDGET_CONFIG
as a fallback
-
CS_WIDGET_MOCK
:- Mock response from faked API, default timeout of 1000ms
window.CS_WIDGET_MOCK = false;
window.CS_CLIENT_ID = '';
window.CS_WIDGET_CONFIG = {};
These options are attempted in order.
MOCK
- If
window.CS_WIDGET_MOCK
- Uses the mocked API response
FETCH
- If
window.CS_CLIENT_ID
exists, attempt to use it. - If the fetch fails, see if there's a
window.CS_WIDGET_CONFIG
- If
window.CS_WIDGET_CONFIG
does NOT exist -- don't render the widget
CONFIG
- If
window.CS_CLIENT_ID
does NOT exist - Checks for a
window.CS_WIDGET_CONFIG
- If
window.CS_WIDGET_CONFIG
does NOT exist -- don't render the widget