@shopify/shopify-api@9.6.0
Minor Changes
-
b912ecd: Updates the Session class to handle the associated user information on the session object.
Updates the Session
fromPropertyArrayto handle all user info fields. New optional argumentreturnUserData, (defaulted tofalse), will return the user data if it is apart of the property array. This will be defaulted totruein an upcoming version.const sessionProperties = session.toPropertyArray(true); /* if sessionProperties has the following data... [ ['id', 'online_session_id'], ['shop', 'online-session-shop'], ['state', 'online-session-state'], ['isOnline', true], ['scope', 'online-session-scope'], ['accessToken', 'online-session-token'], ['expires', 1641013200000], // example = January 1, 2022, as number of milliseconds since Jan 1, 1970 ['userId', 1], ['first_name', 'online-session-first-name'], ['last_name', 'online-session-last-name'], ['email', 'online-session-email'], ['locale', 'online-session-locale'], ['email_verified', false] ['account_owner', true,] ['collaborator', false], ], */ const session = Session.fromPropertyArray(sessionProperties, true); /* ... then session will have the following data... { id: 'online_session_id', shop: 'online-session-shop', state: 'online-session-state', isOnline: true, scope: 'online-session-scope', accessToken: 'online-session-token', expires: 2022-01-01T05:00:00.000Z, // Date object onlineAccessInfo: { associated_user: { id: 1, first_name: 'online-session-first-name' last_name: 'online-session-last-name', email: 'online-session-email', locale: 'online-session-locale', email_verified: false, account_owner: true, collaborator: false, }, } } */