@mxenabled/connect-widget 0.15.5 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -52,18 +52,33 @@ const App = () => {
52
52
 
53
53
  You need to pass an object containing API endpoint callbacks as the `apiValue` prop of the ApiProvider as described in the [usage](#usage) section for the widget to work. [Here](./docs/APIDOCUMENTATION.md) is a more detailed list of the API endpoint callbacks.
54
54
 
55
- ## Developing
55
+ ## Development Set Up
56
56
 
57
57
  1. Clone project
58
58
  2. Install `Node(with npm)`. See [package.json](/package.json) for current required versions
59
59
  3. Run `npm i`
60
- 4. Make your code changes
60
+ 4. Make your code changes - [Follow Conventional Commits](#commit-message-requirements)
61
61
  5. Run `npm run build` to build the project
62
62
  6. [Link Project](#linking-for-development)
63
63
  7. Test your changes
64
- 8. Update change log, translations, and documentation as needed
64
+ 8. Update translations and documentation as needed
65
65
  9. Open Pull Request
66
66
 
67
+ ## Commit Message Requirements
68
+
69
+ _To make commits that trigger a package release, use `npx cz`, it will launch easy to follow commitizen prompts._
70
+
71
+ A new _MAJOR.MINOR.PATCH_ release will be generated if at least one of the following types are used, see [Conventional Commits Documentation](https://www.conventionalcommits.org/) for more specifics.
72
+ * `fix:` -> PATCH bump
73
+ * `feat:` -> MINOR bump
74
+
75
+ Major bump (any type with a footer of `BREAKING CHANGE:`)
76
+ ```
77
+ <any_type>: <message>
78
+
79
+ BREAKING CHANGE: <description>
80
+ ```
81
+
67
82
  ## Linking for Development
68
83
 
69
84
  For developing this package locally, we suggest you use npm link to connect your local version of the package to your client app using the package.
package/dist/index.es.js CHANGED
@@ -9516,6 +9516,7 @@ const COMBO_JOB_DATA_TYPES = {
9516
9516
  };
9517
9517
 
9518
9518
  const initialState$5 = {
9519
+ _initialValues: "",
9519
9520
  is_mobile_webview: false,
9520
9521
  target_origin_referrer: null,
9521
9522
  ui_message_protocol: "post_message",
@@ -9549,12 +9550,23 @@ const configSlice = createSlice({
9549
9550
  (state, action) => {
9550
9551
  const productDetermineMode = getProductDeterminedMode(action.payload);
9551
9552
  const ui_message_version = typeof action.payload.ui_message_version === "string" ? parseInt(action.payload.ui_message_version, 10) : action.payload.ui_message_version || state.ui_message_version;
9552
- return {
9553
+ const loadedState = {
9553
9554
  ...state,
9554
9555
  ...action.payload,
9555
9556
  ui_message_version,
9556
9557
  mode: productDetermineMode !== null ? productDetermineMode : action.payload.mode || state.mode
9557
9558
  };
9559
+ const { _initialValues, ...stateWithoutInitialValues } = loadedState;
9560
+ return {
9561
+ ...stateWithoutInitialValues,
9562
+ // _initialValues is a reference to the values that were used to load the widget initially.
9563
+ // It is meant to be set, and then READ ONLY after that.
9564
+ // Example:
9565
+ // When a user dynamically changes the mode, use_cases, or data for a connection we need to
9566
+ // reset the mode, use_cases, and data to the initial state for the next connection attempt.
9567
+ // JSON is used here to deeply copy the object, use a selector to get the values.
9568
+ _initialValues: JSON.stringify(stateWithoutInitialValues)
9569
+ };
9558
9570
  }
9559
9571
  );
9560
9572
  }