@forgerock/login-widget 1.0.0-beta.12 → 1.0.0-beta.14

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/index.js CHANGED
@@ -702,6 +702,10 @@ function closeComponent(args, shouldCloseDialog) {
702
702
  };
703
703
  });
704
704
  }
705
+ /**
706
+ * @function componentApi - this is a widget external API
707
+ * @returns {object} - the public component API
708
+ */
705
709
  const componentApi = () => {
706
710
  const { update } = componentStore;
707
711
  // Create derived store to minimize what's exposed to the dev
@@ -715,9 +719,19 @@ const componentApi = () => {
715
719
  });
716
720
  });
717
721
  return {
722
+ /**
723
+ * Close a modal
724
+ * @param {object} args - object containing the reason for closing component
725
+ * @returns {void}
726
+ */
718
727
  close: (args) => {
719
728
  closeComponent(args, true);
720
729
  },
730
+ /**
731
+ * Open a modal
732
+ * @param: void
733
+ * @returns: void
734
+ */
721
735
  open: () => {
722
736
  update((state) => {
723
737
  if (state.type === 'inline') {
@@ -739,6 +753,10 @@ const componentApi = () => {
739
753
  };
740
754
  });
741
755
  },
756
+ /**
757
+ * Subscribe to modal events
758
+ * returns the latest value from the event
759
+ */
742
760
  subscribe,
743
761
  };
744
762
  };
@@ -10873,6 +10891,11 @@ var HttpClient = /** @class */ (function (_super) {
10873
10891
  }(event_1.default));
10874
10892
  var _default$2 = httpClient.default = HttpClient;
10875
10893
 
10894
+ /**
10895
+ * @function logErrorAndThrow - Logs an error message and throws an error.
10896
+ * @param {string} type - The type of error. This will be used to determine what error message to log.
10897
+ * @throws {Error} - An error with a message that depends on the value of `type`.
10898
+ */
10876
10899
  function logErrorAndThrow(type) {
10877
10900
  if (type === 'missingStores') {
10878
10901
  const errorMessage = 'Error: missing configuration.';
@@ -14921,6 +14944,11 @@ const configSchema = z
14921
14944
  })
14922
14945
  .strict();
14923
14946
  configSchema.partial();
14947
+ /**
14948
+ * @function - Sets the configuration for the SDK
14949
+ * @param {object} config - The configuration object
14950
+ * @returns {void}
14951
+ */
14924
14952
  function configure (config) {
14925
14953
  configSchema.parse(config);
14926
14954
  Config.set(config);
@@ -14968,6 +14996,12 @@ const fallbackJourneyConfig = Object.keys(defaultJourneys).map((key) => ({
14968
14996
  key,
14969
14997
  }));
14970
14998
  const configuredJourneysStore = writable(fallbackJourneyConfig);
14999
+ /**
15000
+ * @function initialize - Initialize the configured journeys store
15001
+ * @param {object} customJourneys - An object of custom journeys to merge with the default
15002
+ * @returns {object} - The configured journeys store
15003
+ * @example initialize({ login: { journey: 'Login', match: ['?journey=Login'] } })
15004
+ */
14971
15005
  function initialize$6(customJourneys) {
14972
15006
  if (customJourneys) {
14973
15007
  // Provide developer feedback if customized
@@ -16963,6 +16997,11 @@ stringsSchema.partial();
16963
16997
  // Ensure fallback follows schema
16964
16998
  stringsSchema.parse(fallback);
16965
16999
  const stringsStore = writable(null);
17000
+ /**
17001
+ * initialize locale information for Login Widget
17002
+ * @param: userLocale - optional locale object to override default locale
17003
+ * @returns: a schema which represents the user locale schema
17004
+ */
16966
17005
  function initialize$5(userLocale) {
16967
17006
  if (userLocale) {
16968
17007
  /**
@@ -16982,6 +17021,14 @@ function initialize$5(userLocale) {
16982
17021
  * Demo: https://regex101.com/r/Mw9vTB/1
16983
17022
  */
16984
17023
  const valueSchema = z.record(z.string().regex(/^[^<>]*$/)).optional();
17024
+ /**
17025
+ * @function interpolate - Get a translation string
17026
+ * Interpolate a string that contains variables
17027
+ *
17028
+ * @param {string} key - The key to lookup in the translation strings
17029
+ * @param {object} values - An object of values to interpolate into the string
17030
+ * @param {string} externalText - A string to use if no translation is found
17031
+ */
16985
17032
  function interpolate(key, values, externalText) {
16986
17033
  // Let's throw some errors if we're trying to use keys/locales that don't exist.
16987
17034
  // We could improve this by using Typescript and/or fallback values.
@@ -17053,6 +17100,31 @@ function interpolate(key, values, externalText) {
17053
17100
  });
17054
17101
  return messageClean;
17055
17102
  }
17103
+ /**
17104
+ * @function textToKey - Takes a human readable string and returns a key from it.
17105
+ * This key is used to look up the string in the translation files.
17106
+ *
17107
+ * If the item is a number, it will be converted to a string and then
17108
+ * processed as if it were a string.
17109
+ *
17110
+ * If the item is a string that contains word characters (`\w`) mixed with
17111
+ * non-word characters (`\W`), the non-word characters will be removed and
17112
+ * the resulting string will be converted to camelCase.
17113
+ *
17114
+ * @param {string} text - The text that will be converted to a key.
17115
+ * @returns {string} A key that is unique to the given text.
17116
+ *
17117
+ * Examples:
17118
+ * textToKey('hello world') => 'helloWorld'
17119
+ * textToKey('HELLO WORLD') => 'helloWorld'
17120
+ * textToKey('HELLO WORLD!!!') => 'helloWorld'
17121
+ * textToKey('HELLO WORLD!!!') => 'helloWorld'
17122
+ * textToKey('helloWorld') => 'helloWorld'
17123
+ * textToKey('helloWorld123') => 'helloWorld123'
17124
+ * textToKey('hello_world') => 'helloWorld'
17125
+ * textToKey('hello-world') => 'helloWorld'
17126
+ * textToKey('hello.world') => 'helloWorld'
17127
+ */
17056
17128
  function textToKey(text) {
17057
17129
  if (typeof text !== 'string' && typeof text !== 'number') {
17058
17130
  throw new Error('Parameter for textToKey function needs to be of type string or number');
@@ -17194,7 +17266,9 @@ const userInputCallbacks = [
17194
17266
  CallbackType$1.ValidatedCreatePasswordCallback,
17195
17267
  CallbackType$1.ValidatedCreateUsernameCallback,
17196
17268
  ];
17197
- // This eventually will be overridable by user of framework
17269
+ /**
17270
+ * @function forceUserInputOptionalityCallbacks - Determines if a callback should be forced to be optional
17271
+ */
17198
17272
  const forceUserInputOptionalityCallbacks = {
17199
17273
  SelectIdPCallback: (callback) => {
17200
17274
  const selectIdpCb = callback;
@@ -17203,6 +17277,11 @@ const forceUserInputOptionalityCallbacks = {
17203
17277
  .find((provider) => provider.provider === 'localAuthentication');
17204
17278
  },
17205
17279
  };
17280
+ /**
17281
+ * @function isCbReadyByDefault - Determines if a callback is ready to be submitted by default
17282
+ * @param {object} callback - Generic FRCallback from JavaScript SDK
17283
+ * @returns {boolean}
17284
+ */
17206
17285
  function isCbReadyByDefault(callback) {
17207
17286
  if (callback.getType() === CallbackType$1.ConfirmationCallback) {
17208
17287
  const cb = callback;
@@ -17212,6 +17291,11 @@ function isCbReadyByDefault(callback) {
17212
17291
  }
17213
17292
  return false;
17214
17293
  }
17294
+ /**
17295
+ * @function canForceUserInputOptionality
17296
+ * @param {object} callback - generic FRCallback from JavaScript SDK
17297
+ * @returns
17298
+ */
17215
17299
  function canForceUserInputOptionality(callback) {
17216
17300
  // See if a callback function exists within this collection
17217
17301
  const fn = forceUserInputOptionalityCallbacks[callback.getType()];
@@ -17239,9 +17323,9 @@ function isStepSelfSubmittable(callbacks, userInputOptional) {
17239
17323
  return !unsubmittableCallbacks.length;
17240
17324
  }
17241
17325
  /**
17242
- *
17326
+ * @function requiresUserInput - Determines if a callback requires user input
17243
17327
  * @param {object} callback - Generic callback provided by JavaScript SDK
17244
- * @returns
17328
+ * @returns {boolean}
17245
17329
  */
17246
17330
  function requiresUserInput(callback) {
17247
17331
  if (callback.getType() === CallbackType$1.SelectIdPCallback) {
@@ -17257,6 +17341,22 @@ function requiresUserInput(callback) {
17257
17341
  }
17258
17342
  // Notice this function can take a user provided argument function to
17259
17343
  // override behavior (this doesn't have to be well defined)
17344
+ /**
17345
+ * @function isUserInputOptional - Determines if user input is optional
17346
+ * Notice this function can take a user provided argument function to
17347
+ * override behavior (this doesn't have to be well defined)
17348
+ * @param {array} callbackMetadataArray - array of callback metadata
17349
+ * @param {number} numOfUserInputCbs - number of user input requiring callbacks
17350
+ * @param {function} fn - optional function to override default behavior
17351
+ * @returns {boolean} - true if user input is optional
17352
+ * @example isUserInputOptional(callbackMetadataArray, numOfUserInputCbs, (prev, curr) => {
17353
+ * if (curr.derived.canForceUserInputOptionality && numOfUserInputCbs > 0) {
17354
+ * prev = true;
17355
+ * }
17356
+ * return prev;
17357
+ * })
17358
+ * @example isUserInputOptional(callbackMetadataArray, numOfUserInputCbs);
17359
+ */
17260
17360
  function isUserInputOptional(callbackMetadataArray, numOfUserInputCbs, fn) {
17261
17361
  // default reducer function to check if both overriding callback exists
17262
17362
  // along with user input required callbacks
@@ -17273,7 +17373,7 @@ function isUserInputOptional(callbackMetadataArray, numOfUserInputCbs, fn) {
17273
17373
  /**
17274
17374
  * @function buildCallbackMetadata - Constructs an array of callback metadata that matches to original callback array
17275
17375
  * @param {object} step - The modified Widget step object
17276
- * @param checkValidation - function that checks if current callback is the first invalid callback
17376
+ * @param {function} checkValidation - function that checks if current callback is the first invalid callback
17277
17377
  * @returns {array}
17278
17378
  */
17279
17379
  function buildCallbackMetadata(step, checkValidation, stageJson) {
@@ -17721,6 +17821,12 @@ const linksSchema = z
17721
17821
  .strict();
17722
17822
  linksSchema.partial();
17723
17823
  const linksStore = writable();
17824
+ /**
17825
+ * @function initialize - Initialize the links store
17826
+ * @param {object} customLinks - An object of custom links to merge with the default
17827
+ * @returns {object} - The links store
17828
+ * @example initialize({ termsAndConditions: 'https://example.com/terms' });
17829
+ */
17724
17830
  function initialize$3(customLinks) {
17725
17831
  // If customLinks is provided, provide feedback for object
17726
17832
  if (customLinks) {
@@ -17743,7 +17849,19 @@ const oauthStore = writable({
17743
17849
  successful: false,
17744
17850
  response: null,
17745
17851
  });
17852
+ /**
17853
+ * @function initialize - Initializes the OAuth store with a get function and a reset function
17854
+ * @param {object} initOptions - The options to pass to the TokenManager.getTokens function
17855
+ * @returns {object} - The OAuth store
17856
+ * @example initialize({ query: { prompt: 'none' } });
17857
+ */
17746
17858
  function initialize$2(initOptions) {
17859
+ /**
17860
+ * Get tokens from the server
17861
+ * new tokens are available in the subscribe method
17862
+ * @params: getOptions?: GetTokensOptions
17863
+ * @returns: Promise<void>
17864
+ */
17747
17865
  async function get(getOptions) {
17748
17866
  /**
17749
17867
  * Create an options object with getOptions overriding anything from initOptions
@@ -17811,7 +17929,18 @@ const userStore = writable({
17811
17929
  successful: false,
17812
17930
  response: null,
17813
17931
  });
17932
+ /**
17933
+ * @function initialize - Initializes the user store with a get function and a reset function
17934
+ * @param {object} initOptions - The options to pass to the UserManager.getCurrentUser function
17935
+ * @returns {object} - The user store
17936
+ */
17814
17937
  function initialize$1(initOptions) {
17938
+ /**
17939
+ * Get user info from the server
17940
+ * New state is returned in your `userEvents.subscribe` callback function
17941
+ * @params: getOptions?: ConfigOptions
17942
+ * @returns: Promise<void>
17943
+ */
17815
17944
  async function get(getOptions) {
17816
17945
  /**
17817
17946
  * Create an options object with getOptions overriding anything from initOptions
@@ -17903,6 +18032,12 @@ const fallbackStyles = {
17903
18032
  stage: undefined,
17904
18033
  };
17905
18034
  const styleStore = writable(fallbackStyles);
18035
+ /**
18036
+ * @function initialize - Initialize the style store
18037
+ * @param {object} customStyle - An object of custom styles to merge with the default
18038
+ * @returns {object} - The style store
18039
+ * @example initialize({ checksAndRadios: 'standard' });
18040
+ */
17906
18041
  function initialize(customStyle) {
17907
18042
  if (customStyle) {
17908
18043
  styleSchema.parse(customStyle);
@@ -17914,6 +18049,17 @@ function initialize(customStyle) {
17914
18049
  return styleStore;
17915
18050
  }
17916
18051
 
18052
+ /**
18053
+ * @function widgetApiFactory - Creates the widget API
18054
+ * @param {object} componentApi - The component API
18055
+ * @returns {object} - The widget API
18056
+ * @property {object} componentApi - The component API for either inline or modal
18057
+ * @property {object} configuration - Sets the configuration for the widget
18058
+ * @property {function} getStores - Returns the stores: journeyStore, oauthStore, userStore
18059
+ * @property {object} journey - the journey API
18060
+ * @property {function} request - The HttpClient.request function from the SDK
18061
+ * @property {object} user - the user API
18062
+ */
17917
18063
  function widgetApiFactory(componentApi) {
17918
18064
  let journeyStore;
17919
18065
  let oauthStore;
@@ -17962,6 +18108,10 @@ function widgetApiFactory(componentApi) {
17962
18108
  initialize$3(options?.links);
17963
18109
  initialize(options?.style);
17964
18110
  return {
18111
+ /** Set the Login Widget's Configuration
18112
+ * @param {WidgetConfigOptions} options - The configuration options for the Login Widget
18113
+ * @returns {void}
18114
+ **/
17965
18115
  set(setOptions) {
17966
18116
  if (setOptions?.forgerock) {
17967
18117
  configure({
@@ -18083,6 +18233,11 @@ function widgetApiFactory(componentApi) {
18083
18233
  return { change, start, subscribe };
18084
18234
  };
18085
18235
  const user = {
18236
+ /**
18237
+ * User Info
18238
+ * @param: void
18239
+ * @returns: UserStore
18240
+ */
18086
18241
  info() {
18087
18242
  if (!journeyStore || !oauthStore || !userStore) {
18088
18243
  logErrorAndThrow('missingStores');
@@ -18105,6 +18260,12 @@ function widgetApiFactory(componentApi) {
18105
18260
  }
18106
18261
  return { get: wrappedGet, subscribe };
18107
18262
  },
18263
+ /**
18264
+ * Logout a user from an AM Session
18265
+ * @async
18266
+ * @param: void
18267
+ * @returns: Promise<void>
18268
+ **/
18108
18269
  async logout() {
18109
18270
  if (!journeyStore || !oauthStore || !userStore) {
18110
18271
  logErrorAndThrow('missingStores');
@@ -18133,6 +18294,11 @@ function widgetApiFactory(componentApi) {
18133
18294
  // Return undefined as there's no response information to share
18134
18295
  return;
18135
18296
  },
18297
+ /**
18298
+ * Returns the widget's Tokens object
18299
+ * @param void;
18300
+ * @returns OAuthStore
18301
+ */
18136
18302
  tokens() {
18137
18303
  if (!journeyStore || !oauthStore || !userStore) {
18138
18304
  logErrorAndThrow('missingStores');
@@ -20615,6 +20781,11 @@ function matchJourneyAndDecideAction(href, journeys, stack) {
20615
20781
  /** *********************************************
20616
20782
  * NEW "NORMALIZED" METHODS
20617
20783
  */
20784
+ /**
20785
+ * @function getInputTypeFromPolicies - Determines the type of input to use based on the policies object
20786
+ * @param {object} policies - The policies object from the callback
20787
+ * @returns {string} - The type of input to use
20788
+ */
20618
20789
  function getInputTypeFromPolicies(policies) {
20619
20790
  const value = policies?.value;
20620
20791
  if (typeof value !== 'object') {
@@ -20632,6 +20803,11 @@ function getInputTypeFromPolicies(policies) {
20632
20803
  }
20633
20804
  return 'text';
20634
20805
  }
20806
+ /**
20807
+ * @function getValidationFailureParams - Gets the validation failure params from the failed policy object
20808
+ * @param {object} failedPolicy - The failed policy object from the callback
20809
+ * @returns {array} - An array of objects containing the length, message, and rule
20810
+ */
20635
20811
  function getValidationFailureParams(failedPolicy) {
20636
20812
  if (failedPolicy?.policyRequirement === 'DICTIONARY') {
20637
20813
  const params = failedPolicy.params;
@@ -20735,6 +20911,11 @@ function getValidationFailureParams(failedPolicy) {
20735
20911
  ];
20736
20912
  }
20737
20913
  }
20914
+ /**
20915
+ * @function getValidationMessageString - Gets the validation message string from the policy object
20916
+ * @param {object} policy - The policy object from the callback
20917
+ * @returns {string} - The validation message string
20918
+ */
20738
20919
  function getValidationMessageString(policy) {
20739
20920
  switch (policy?.policyId) {
20740
20921
  case 'at-least-X-capitals': {
@@ -20818,6 +20999,12 @@ function getValidationMessageString(policy) {
20818
20999
  return '';
20819
21000
  }
20820
21001
  }
21002
+ /**
21003
+ * @function getValidationFailures - Gets the validation failures from the callback object
21004
+ * @param {object} callback - The callback object from the server
21005
+ * @param {string} label - The label of the field
21006
+ * @returns {array} - An array of failed policies
21007
+ */
20821
21008
  function getValidationFailures(callback, label) {
20822
21009
  const failedPolicies = callback.getFailedPolicies && callback.getFailedPolicies();
20823
21010
  const parsedPolicies = parseFailedPolicies(failedPolicies, label);
@@ -20829,6 +21016,11 @@ function getValidationFailures(callback, label) {
20829
21016
  };
20830
21017
  });
20831
21018
  }
21019
+ /**
21020
+ * @function getValidationPolicies - Gets the validation policies from the callback object
21021
+ * @param {object} policies - The policies object from the callback
21022
+ * @returns {array} - An array of policies
21023
+ */
20832
21024
  function getValidationPolicies(policies) {
20833
21025
  if (typeof policies !== 'object' && !policies) {
20834
21026
  return [];
@@ -20847,6 +21039,11 @@ function getValidationPolicies(policies) {
20847
21039
  })
20848
21040
  .filter((policy) => !!policy.message);
20849
21041
  }
21042
+ /**
21043
+ * @function isInputRequired - Checks if the input is required
21044
+ * @param {object} callback - The callback object from the server
21045
+ * @returns {boolean} - Whether the input is required
21046
+ */
20850
21047
  function isInputRequired(callback) {
20851
21048
  const policies = callback.getPolicies && callback.getPolicies();
20852
21049
  let isRequired = false;
@@ -20858,6 +21055,11 @@ function isInputRequired(callback) {
20858
21055
  }
20859
21056
  return isRequired;
20860
21057
  }
21058
+ /**
21059
+ * @function convertCharacterSetToRuleObj - Converts a character set to a rule object
21060
+ * @param {string} set - The character set to convert
21061
+ * @returns {object} - The rule object
21062
+ */
20861
21063
  function convertCharacterSetToRuleObj(set) {
20862
21064
  const arr = set.split(':');
20863
21065
  const num = arr[0];
@@ -20934,6 +21136,12 @@ function convertCharacterSetToRuleObj(set) {
20934
21136
  };
20935
21137
  }
20936
21138
  }
21139
+ /**
21140
+ * @function parseFailedPolicies - Parses the failed policies from the callback object
21141
+ * @param {array} policies - The policies array from the callback
21142
+ * @param {string} label - The label of the field
21143
+ * @returns {array} - An array of failed policies
21144
+ */
20937
21145
  function parseFailedPolicies(policies, label) {
20938
21146
  return policies.map((policy) => {
20939
21147
  if (typeof policy === 'string') {
@@ -20949,8 +21157,10 @@ function parseFailedPolicies(policies, label) {
20949
21157
  }
20950
21158
  });
20951
21159
  }
20952
- /** *********************************************
20953
- * OLD METHODS
21160
+ /**
21161
+ * @function getAttributeValidationFailureText - Gets the validation failure text from the callback object
21162
+ * @param {object} callback - The callback object from the server
21163
+ * @returns {string} - The validation failure text
20954
21164
  */
20955
21165
  function getAttributeValidationFailureText(callback) {
20956
21166
  // TODO: Mature this utility for better parsing and display
@@ -21949,13 +22159,6 @@ function instance$I($$self, $$props, $$invalidate) {
21949
22159
  let validationFailure;
21950
22160
 
21951
22161
  function setValue(event) {
21952
- /** ***********************************************************************
21953
- * SDK INTEGRATION POINT
21954
- * Summary: SDK callback methods for setting values
21955
- * ------------------------------------------------------------------------
21956
- * Details: Each callback is wrapped by the SDK to provide helper methods
21957
- * for writing values to the callbacks received from AM
21958
- *********************************************************************** */
21959
22162
  callback.setInputValue(event.target.checked);
21960
22163
  }
21961
22164
 
@@ -23724,7 +23927,7 @@ function create_else_block$6(ctx) {
23724
23927
  };
23725
23928
  }
23726
23929
 
23727
- // (66:0) {#if callbackMetadata?.platform?.displayType === 'radio'}
23930
+ // (52:0) {#if callbackMetadata?.platform?.displayType === 'radio'}
23728
23931
  function create_if_block$f(ctx) {
23729
23932
  let radio;
23730
23933
  let current;
@@ -23879,13 +24082,6 @@ function instance$B($$self, $$props, $$invalidate) {
23879
24082
  * @param {Object} event
23880
24083
  */
23881
24084
  function setValue(event) {
23882
- /** ***********************************************************************
23883
- * SDK INTEGRATION POINT
23884
- * Summary: SDK callback methods for setting values
23885
- * ------------------------------------------------------------------------
23886
- * Details: Each callback is wrapped by the SDK to provide helper methods
23887
- * for writing values to the callbacks received from AM
23888
- *********************************************************************** */
23889
24085
  callback.setChoiceIndex(Number(event.target.value));
23890
24086
  }
23891
24087
 
@@ -23898,13 +24094,6 @@ function instance$B($$self, $$props, $$invalidate) {
23898
24094
  $$self.$$.update = () => {
23899
24095
  if ($$self.$$.dirty & /*callback, callbackMetadata, prompt*/ 2051) {
23900
24096
  {
23901
- /** *************************************************************************
23902
- * SDK INTEGRATION POINT
23903
- * Summary: SDK callback methods for getting values
23904
- * --------------------------------------------------------------------------
23905
- * Details: Each callback is wrapped by the SDK to provide helper methods
23906
- * for accessing values from the callbacks received from AM
23907
- ************************************************************************* */
23908
24097
  $$invalidate(2, choiceOptions = callback.getChoices()?.map((text, idx) => ({
23909
24098
  /**
23910
24099
  * Since locale content keys for the choice component are built off of the
@@ -24069,7 +24258,7 @@ function get_each_context$6(ctx, list, i) {
24069
24258
  return child_ctx;
24070
24259
  }
24071
24260
 
24072
- // (95:0) {#if stepMetadata?.platform?.stageName !== 'OneTimePassword'}
24261
+ // (81:0) {#if stepMetadata?.platform?.stageName !== 'OneTimePassword'}
24073
24262
  function create_if_block$e(ctx) {
24074
24263
  let current_block_type_index;
24075
24264
  let if_block;
@@ -24139,7 +24328,7 @@ function create_if_block$e(ctx) {
24139
24328
  };
24140
24329
  }
24141
24330
 
24142
- // (117:2) {:else}
24331
+ // (103:2) {:else}
24143
24332
  function create_else_block_1(ctx) {
24144
24333
  let grid;
24145
24334
  let current;
@@ -24185,7 +24374,7 @@ function create_else_block_1(ctx) {
24185
24374
  };
24186
24375
  }
24187
24376
 
24188
- // (96:2) {#if !stepMetadata?.derived.isStepSelfSubmittable}
24377
+ // (82:2) {#if !stepMetadata?.derived.isStepSelfSubmittable}
24189
24378
  function create_if_block_1$9(ctx) {
24190
24379
  let current_block_type_index;
24191
24380
  let if_block;
@@ -24255,7 +24444,7 @@ function create_if_block_1$9(ctx) {
24255
24444
  };
24256
24445
  }
24257
24446
 
24258
- // (120:8) <Button style={options.length > 1 && defaultChoice === Number(opt.value) ? 'primary' : buttonStyle} type="button" width="auto" onClick={() => setBtnValue(Number(opt.value))} >
24447
+ // (106:8) <Button style={options.length > 1 && defaultChoice === Number(opt.value) ? 'primary' : buttonStyle} type="button" width="auto" onClick={() => setBtnValue(Number(opt.value))} >
24259
24448
  function create_default_slot_2$5(ctx) {
24260
24449
  let t0_value = /*opt*/ ctx[15].text + "";
24261
24450
  let t0;
@@ -24280,7 +24469,7 @@ function create_default_slot_2$5(ctx) {
24280
24469
  };
24281
24470
  }
24282
24471
 
24283
- // (119:6) {#each options as opt}
24472
+ // (105:6) {#each options as opt}
24284
24473
  function create_each_block$6(ctx) {
24285
24474
  let button;
24286
24475
  let current;
@@ -24341,7 +24530,7 @@ function create_each_block$6(ctx) {
24341
24530
  };
24342
24531
  }
24343
24532
 
24344
- // (118:4) <Grid num={options.length}>
24533
+ // (104:4) <Grid num={options.length}>
24345
24534
  function create_default_slot_1$a(ctx) {
24346
24535
  let each_1_anchor;
24347
24536
  let current;
@@ -24425,7 +24614,7 @@ function create_default_slot_1$a(ctx) {
24425
24614
  };
24426
24615
  }
24427
24616
 
24428
- // (106:4) {:else}
24617
+ // (92:4) {:else}
24429
24618
  function create_else_block$5(ctx) {
24430
24619
  let checkbox;
24431
24620
  let current;
@@ -24476,7 +24665,7 @@ function create_else_block$5(ctx) {
24476
24665
  };
24477
24666
  }
24478
24667
 
24479
- // (97:4) {#if options.length > 1}
24668
+ // (83:4) {#if options.length > 1}
24480
24669
  function create_if_block_2$8(ctx) {
24481
24670
  let select;
24482
24671
  let current;
@@ -24523,7 +24712,7 @@ function create_if_block_2$8(ctx) {
24523
24712
  };
24524
24713
  }
24525
24714
 
24526
- // (107:6) <Checkbox isFirstInvalidInput={callbackMetadata?.derived.isFirstInvalidInput || false} isInvalid={false} key={inputName} onChange={setCheckboxValue} value={false} >
24715
+ // (93:6) <Checkbox isFirstInvalidInput={callbackMetadata?.derived.isFirstInvalidInput || false} isInvalid={false} key={inputName} onChange={setCheckboxValue} value={false} >
24527
24716
  function create_default_slot$h(ctx) {
24528
24717
  let t_value = /*options*/ ctx[3][0].text + "";
24529
24718
  let t;
@@ -24635,13 +24824,6 @@ function instance$z($$self, $$props, $$invalidate) {
24635
24824
  * @param {Object} event
24636
24825
  */
24637
24826
  function setOptionValue(event) {
24638
- /** ***********************************************************************
24639
- * SDK INTEGRATION POINT
24640
- * Summary: SDK callback methods for setting values
24641
- * ------------------------------------------------------------------------
24642
- * Details: Each callback is wrapped by the SDK to provide helper methods
24643
- * for writing values to the callbacks received from AM
24644
- *********************************************************************** */
24645
24827
  callback.setOptionIndex(Number(event.target.value));
24646
24828
  }
24647
24829
 
@@ -24650,13 +24832,6 @@ function instance$z($$self, $$props, $$invalidate) {
24650
24832
  * @param {Object} event
24651
24833
  */
24652
24834
  function setCheckboxValue(event) {
24653
- /** ***********************************************************************
24654
- * SDK INTEGRATION POINT
24655
- * Summary: SDK callback methods for setting values
24656
- * ------------------------------------------------------------------------
24657
- * Details: Each callback is wrapped by the SDK to provide helper methods
24658
- * for writing values to the callbacks received from AM
24659
- *********************************************************************** */
24660
24835
  const value = event.target.checked;
24661
24836
 
24662
24837
  if (value) {
@@ -26668,15 +26843,7 @@ function instance$t($$self, $$props, $$invalidate) {
26668
26843
  ? Stacked_label$1
26669
26844
  : Floating_label$1;
26670
26845
 
26671
- /** *************************************************************************
26672
- * SDK INTEGRATION POINT
26673
- * Summary: SDK callback methods for getting values
26674
- * --------------------------------------------------------------------------
26675
- * Details: Each callback is wrapped by the SDK to provide helper methods
26676
- * for accessing values from the callbacks received from AM
26677
- ************************************************************************* */
26678
26846
  let customQuestionIndex = null;
26679
-
26680
26847
  let displayCustomQuestionInput = false;
26681
26848
  let inputArr;
26682
26849
  let inputName;
@@ -26704,13 +26871,6 @@ function instance$t($$self, $$props, $$invalidate) {
26704
26871
  * @param {Object} event
26705
26872
  */
26706
26873
  function setAnswer(event) {
26707
- /** ***********************************************************************
26708
- * SDK INTEGRATION POINT
26709
- * Summary: SDK callback methods for setting values
26710
- * ------------------------------------------------------------------------
26711
- * Details: Each callback is wrapped by the SDK to provide helper methods
26712
- * for writing values to the callbacks received from AM
26713
- *********************************************************************** */
26714
26874
  callback.setAnswer(event.target.value);
26715
26875
  }
26716
26876
 
@@ -26727,14 +26887,6 @@ function instance$t($$self, $$props, $$invalidate) {
26727
26887
  callback.setAnswer('');
26728
26888
  } else {
26729
26889
  $$invalidate(3, displayCustomQuestionInput = false);
26730
-
26731
- /** ***********************************************************************
26732
- * SDK INTEGRATION POINT
26733
- * Summary: SDK callback methods for setting values
26734
- * ------------------------------------------------------------------------
26735
- * Details: Each callback is wrapped by the SDK to provide helper methods
26736
- * for writing values to the callbacks received from AM
26737
- *********************************************************************** */
26738
26890
  callback.setQuestion(selectValue);
26739
26891
  }
26740
26892
  }
@@ -26745,14 +26897,6 @@ function instance$t($$self, $$props, $$invalidate) {
26745
26897
  */
26746
26898
  function setQuestion(event) {
26747
26899
  const inputValue = event.target.value;
26748
-
26749
- /** ***********************************************************************
26750
- * SDK INTEGRATION POINT
26751
- * Summary: SDK callback methods for setting values
26752
- * ------------------------------------------------------------------------
26753
- * Details: Each callback is wrapped by the SDK to provide helper methods
26754
- * for writing values to the callbacks received from AM
26755
- *********************************************************************** */
26756
26900
  callback.setQuestion(inputValue);
26757
26901
  }
26758
26902
 
@@ -29949,13 +30093,6 @@ function instance$f($$self, $$props, $$invalidate) {
29949
30093
  * @param {Object} event
29950
30094
  */
29951
30095
  function setValue(event) {
29952
- /** ***********************************************************************
29953
- * SDK INTEGRATION POINT
29954
- * Summary: SDK callback methods for setting values
29955
- * ------------------------------------------------------------------------
29956
- * Details: Each callback is wrapped by the SDK to provide helper methods
29957
- * for writing values to the callbacks received from AM
29958
- *********************************************************************** */
29959
30096
  callback.setInputValue(event.target.value);
29960
30097
  }
29961
30098
 
@@ -30144,7 +30281,7 @@ function create_else_block$3(ctx) {
30144
30281
  };
30145
30282
  }
30146
30283
 
30147
- // (41:0) {#if $linksStore?.termsAndConditions}
30284
+ // (27:0) {#if $linksStore?.termsAndConditions}
30148
30285
  function create_if_block$7(ctx) {
30149
30286
  let link;
30150
30287
  let t;
@@ -30222,7 +30359,7 @@ function create_if_block$7(ctx) {
30222
30359
  };
30223
30360
  }
30224
30361
 
30225
- // (42:2) <Link classes="tw_block tw_mb-4" href={$linksStore?.termsAndConditions} target="_blank">
30362
+ // (28:2) <Link classes="tw_block tw_mb-4" href={$linksStore?.termsAndConditions} target="_blank">
30226
30363
  function create_default_slot_1$5(ctx) {
30227
30364
  let t_value = interpolate('termsAndConditionsLinkText') + "";
30228
30365
  let t;
@@ -30241,7 +30378,7 @@ function create_default_slot_1$5(ctx) {
30241
30378
  };
30242
30379
  }
30243
30380
 
30244
- // (45:2) <Checkbox isFirstInvalidInput={callbackMetadata?.derived.isFirstInvalidInput || false} key={inputName} onChange={setValue} value={false} >
30381
+ // (31:2) <Checkbox isFirstInvalidInput={callbackMetadata?.derived.isFirstInvalidInput || false} key={inputName} onChange={setValue} value={false} >
30245
30382
  function create_default_slot$9(ctx) {
30246
30383
  let t;
30247
30384
  let current;
@@ -30349,13 +30486,6 @@ function instance$d($$self, $$props, $$invalidate) {
30349
30486
  let { callback } = $$props;
30350
30487
  let { callbackMetadata } = $$props;
30351
30488
 
30352
- /** *************************************************************************
30353
- * SDK INTEGRATION POINT
30354
- * Summary: SDK callback methods for getting values
30355
- * --------------------------------------------------------------------------
30356
- * Details: Each callback is wrapped by the SDK to provide helper methods
30357
- * for accessing values from the callbacks received from AM
30358
- ************************************************************************* */
30359
30489
  const Checkbox = style.checksAndRadios === 'standard'
30360
30490
  ? Standard$1
30361
30491
  : Animated$1;
@@ -30367,13 +30497,6 @@ function instance$d($$self, $$props, $$invalidate) {
30367
30497
  * @param {Object} event
30368
30498
  */
30369
30499
  function setValue(event) {
30370
- /** ***********************************************************************
30371
- * SDK INTEGRATION POINT
30372
- * Summary: SDK callback methods for setting values
30373
- * ------------------------------------------------------------------------
30374
- * Details: Each callback is wrapped by the SDK to provide helper methods
30375
- * for writing values to the callbacks received from AM
30376
- *********************************************************************** */
30377
30500
  callback.setAccepted(event.target.checked);
30378
30501
  }
30379
30502
 
@@ -30932,13 +31055,6 @@ function instance$9($$self, $$props, $$invalidate) {
30932
31055
  * @param {Object} event
30933
31056
  */
30934
31057
  function setValue(event) {
30935
- /** ***********************************************************************
30936
- * SDK INTEGRATION POINT
30937
- * Summary: SDK callback methods for setting values
30938
- * ------------------------------------------------------------------------
30939
- * Details: Each callback is wrapped by the SDK to provide helper methods
30940
- * for writing values to the callbacks received from AM
30941
- *********************************************************************** */
30942
31058
  callback.setInputValue(event.target.value);
30943
31059
  }
30944
31060
 
@@ -35195,14 +35311,12 @@ class Login extends SvelteComponent {
35195
35311
  }
35196
35312
  }
35197
35313
 
35314
+ /**
35315
+ * @function mapStepToStage - Maps the current step to the proper stage component.
35316
+ * @param {object} currentStep - The current step to check
35317
+ * @returns {object} - The stage Svelte component
35318
+ */
35198
35319
  function mapStepToStage(currentStep) {
35199
- /** *********************************************************************
35200
- * SDK INTEGRATION POINT
35201
- * Summary:SDK step method for getting the stage value
35202
- * ----------------------------------------------------------------------
35203
- * Details: This method is helpful in quickly identifying the stage
35204
- * when you want to provide special layout or handling of the form
35205
- ********************************************************************* */
35206
35320
  if (!currentStep || currentStep.type !== 'Step') {
35207
35321
  return Generic;
35208
35322
  }
@@ -35293,7 +35407,7 @@ function create_else_block$1(ctx) {
35293
35407
  };
35294
35408
  }
35295
35409
 
35296
- // (53:36)
35410
+ // (56:52)
35297
35411
  function create_if_block_3(ctx) {
35298
35412
  let div;
35299
35413
  let spinner;
@@ -35334,7 +35448,7 @@ function create_if_block_3(ctx) {
35334
35448
  };
35335
35449
  }
35336
35450
 
35337
- // (27:0) {#if !$journeyStore?.completed}
35451
+ // (30:0) {#if $journeyStore && !$journeyStore.completed}
35338
35452
  function create_if_block$1(ctx) {
35339
35453
  let current_block_type_index;
35340
35454
  let if_block;
@@ -35344,8 +35458,8 @@ function create_if_block$1(ctx) {
35344
35458
  const if_blocks = [];
35345
35459
 
35346
35460
  function select_block_type_1(ctx, dirty) {
35347
- if (!/*$journeyStore*/ ctx[5].step) return 0;
35348
- if (/*$journeyStore*/ ctx[5].step.type === StepType$1.Step) return 1;
35461
+ if (/*$journeyStore*/ ctx[5] && !/*$journeyStore*/ ctx[5].step) return 0;
35462
+ if (/*$journeyStore*/ ctx[5].step?.type === StepType$1.Step) return 1;
35349
35463
  return -1;
35350
35464
  }
35351
35465
 
@@ -35421,7 +35535,7 @@ function create_if_block$1(ctx) {
35421
35535
  };
35422
35536
  }
35423
35537
 
35424
- // (58:2) <Alert id="unrecoverableStepError" needsFocus={alertNeedsFocus} type="error">
35538
+ // (61:2) <Alert id="unrecoverableStepError" needsFocus={alertNeedsFocus} type="error">
35425
35539
  function create_default_slot_1(ctx) {
35426
35540
  let t;
35427
35541
  let current;
@@ -35454,7 +35568,7 @@ function create_default_slot_1(ctx) {
35454
35568
  };
35455
35569
  }
35456
35570
 
35457
- // (61:2) <Button style="secondary" onClick={tryAgain}>
35571
+ // (64:2) <Button style="secondary" onClick={tryAgain}>
35458
35572
  function create_default_slot$1(ctx) {
35459
35573
  let t;
35460
35574
  let current;
@@ -35484,7 +35598,7 @@ function create_default_slot$1(ctx) {
35484
35598
  };
35485
35599
  }
35486
35600
 
35487
- // (32:54)
35601
+ // (35:55)
35488
35602
  function create_if_block_2(ctx) {
35489
35603
  let switch_instance;
35490
35604
  let updating_formEl;
@@ -35606,7 +35720,7 @@ function create_if_block_2(ctx) {
35606
35720
  };
35607
35721
  }
35608
35722
 
35609
- // (28:2) {#if !$journeyStore.step}
35723
+ // (31:2) {#if $journeyStore && !$journeyStore.step}
35610
35724
  function create_if_block_1(ctx) {
35611
35725
  let div;
35612
35726
  let spinner;
@@ -35656,8 +35770,8 @@ function create_fragment$1(ctx) {
35656
35770
  const if_blocks = [];
35657
35771
 
35658
35772
  function select_block_type(ctx, dirty) {
35659
- if (!/*$journeyStore*/ ctx[5]?.completed) return 0;
35660
- if (/*$journeyStore*/ ctx[5]?.successful) return 1;
35773
+ if (/*$journeyStore*/ ctx[5] && !/*$journeyStore*/ ctx[5].completed) return 0;
35774
+ if (/*$journeyStore*/ ctx[5] && /*$journeyStore*/ ctx[5].successful) return 1;
35661
35775
  return 2;
35662
35776
  }
35663
35777
 
@@ -35728,6 +35842,11 @@ function instance$1($$self, $$props, $$invalidate) {
35728
35842
  let { formEl = null } = $$props;
35729
35843
  let { journeyStore } = $$props;
35730
35844
  $$subscribe_journeyStore();
35845
+
35846
+ if (!$journeyStore) {
35847
+ console.error('Widget missing configuration. Import and call `configuration()`, then use `set()` to configure.');
35848
+ }
35849
+
35731
35850
  let alertNeedsFocus = false;
35732
35851
 
35733
35852
  function submitForm() {
@@ -35741,7 +35860,7 @@ function instance$1($$self, $$props, $$invalidate) {
35741
35860
  }
35742
35861
 
35743
35862
  afterUpdate(() => {
35744
- $$invalidate(4, alertNeedsFocus = !$journeyStore.successful);
35863
+ $$invalidate(4, alertNeedsFocus = $journeyStore && !$journeyStore.successful);
35745
35864
  });
35746
35865
 
35747
35866
  function switch_instance_formEl_binding(value) {