Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Salesforce Open Source Community Code of Conduct

## About the Code of Conduct

Equality is a core value at Salesforce. We believe a diverse and inclusive
community fosters innovation and creativity, and are committed to building a
culture where everyone feels included.

Salesforce open-source projects are committed to providing a friendly, safe, and
welcoming environment for all, regardless of gender identity and expression,
sexual orientation, disability, physical appearance, body size, ethnicity, nationality,
race, age, religion, level of experience, education, socioeconomic status, or
other similar personal characteristics.

The goal of this code of conduct is to specify a baseline standard of behavior so
that people with different social values and communication styles can work
together effectively, productively, and respectfully in our open source community.
It also establishes a mechanism for reporting issues and resolving conflicts.

All questions and reports of abusive, harassing, or otherwise unacceptable behavior
in a Salesforce open-source project may be reported by contacting the Salesforce
Open Source Conduct Committee at ossconduct@salesforce.com.

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of gender
identity and expression, sexual orientation, disability, physical appearance,
body size, ethnicity, nationality, race, age, religion, level of experience, education,
socioeconomic status, or other similar personal characteristics.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy toward other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Personal attacks, insulting/derogatory comments, or trolling
* Public or private harassment
* Publishing, or threatening to publish, others' private information—such as
a physical or electronic address—without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
* Advocating for or encouraging any of the above behaviors

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned with this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project email
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the Salesforce Open Source Conduct Committee
at ossconduct@salesforce.com. All complaints will be reviewed and investigated
and will result in a response that is deemed necessary and appropriate to the
circumstances. The committee is obligated to maintain confidentiality with
regard to the reporter of an incident. Further details of specific enforcement
policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership and the Salesforce Open Source Conduct
Committee.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant-home],
version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html.
It includes adaptions and additions from [Go Community Code of Conduct][golang-coc],
[CNCF Code of Conduct][cncf-coc], and [Microsoft Open Source Code of Conduct][microsoft-coc].

This Code of Conduct is licensed under the [Creative Commons Attribution 3.0 License][cc-by-3-us].

[contributor-covenant-home]: https://www.contributor-covenant.org (https://www.contributor-covenant.org/)
[golang-coc]: https://golang.org/conduct
[cncf-coc]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md
[microsoft-coc]: https://opensource.microsoft.com/codeofconduct/
[cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/
88 changes: 88 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

# Contributing Guide For B2C Developer Tooling, B2C-CLI, B2C DX MCP, B2C Tooling SDK

This page lists the operational governance model of this project, as well as the recommendations and requirements for how to best contribute to B2C Developer Tooling. We strive to obey these as best as possible. As always, thanks for contributing – we hope these guidelines make it easier and shed some light on our approach and processes.

# Governance Model

## Salesforce Sponsored

The intent and goal of open sourcing this project is to increase the contributor and user base. However, only Salesforce employees will be given `admin` rights and will be the final arbitrars of what contributions are accepted or not.

# Getting started

Please join the community on [Salesforce Commerce Cloud Unofficial slack](https://unofficialsfcc.com/).

# Issues, requests & ideas

Use GitHub Issues page to submit issues, enhancement requests and discuss ideas.

### Bug Reports and Fixes
- If you find a bug, please search for it in the [Issues](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/issues), and if it isn't already tracked,
[create a new issue](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/issues/new). Fill out the "Bug Report" section of the issue template. Even if an Issue is closed, feel free to comment and add details, it will still
be reviewed.
- Issues that have already been identified as a bug (note: able to reproduce) will be labelled `bug`.
- If you'd like to submit a fix for a bug, [send a Pull Request](#creating_a_pull_request) and mention the Issue number.
- Include tests that isolate the bug and verifies that it was fixed.

### New Features
- If you'd like to add new functionality to this project, describe the problem you want to solve in a [new Issue](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/issues/new).
- Issues that have been identified as a feature request will be labelled `enhancement`.
- If you'd like to implement the new feature, please wait for feedback from the project
maintainers before spending too much time writing the code. In some cases, `enhancement`s may
not align well with the project objectives at the time.

### Tests, Documentation, Miscellaneous
- If you'd like to improve the tests, you want to make the documentation clearer, you have an
alternative implementation of something that may have advantages over the way its currently
done, or you have any other change, we would be happy to hear about it!
- If its a trivial change, go ahead and [send a Pull Request](#creating_a_pull_request) with the changes you have in mind.
- If not, [open an Issue](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/issues/new) to discuss the idea first.

If you're new to our project and looking for some way to make your first contribution, look for
Issues labelled `good first contribution`.

# Contribution Checklist

- [x] Clean, simple, well styled code
- [x] Commits should be atomic and messages must be descriptive. Related issues should be mentioned by Issue number.
- [x] Comments
- Module-level & function-level comments.
- Comments on complex blocks of code or algorithms (include references to sources).
- [x] Tests
- The test suite, if provided, must be complete and pass
- Increase code coverage, not versa.
- Use any of our testkits that contains a bunch of testing facilities you would need. For example: `import com.salesforce.op.test._` and borrow inspiration from existing tests.
- [x] Dependencies
- Minimize number of dependencies.
- Prefer Apache 2.0, BSD3, MIT, ISC and MPL licenses.
- [x] Reviews
- Changes must be approved via peer code review

# Creating a Pull Request

1. **Ensure the bug/feature was not already reported** by searching on GitHub under Issues. If none exists, create a new issue so that other contributors can keep track of what you are trying to add/fix and offer suggestions (or let you know if there is already an effort in progress).
3. **Clone** the forked repo to your machine.
4. **Create** a new branch to contain your work (e.g. `git br fix-issue-11`)
4. **Commit** changes to your own branch.
5. **Push** your work back up to your fork. (e.g. `git push fix-issue-11`)
6. **Submit** a Pull Request against the `main` branch and refer to the issue(s) you are fixing. Try not to pollute your pull request with unintended changes. Keep it simple and small.
7. **Sign** the Salesforce CLA (you will be prompted to do so when submitting the Pull Request)

> **NOTE**: Be sure to [sync your fork](https://help.github.com/articles/syncing-a-fork/) before making a pull request.

# Contributor License Agreement ("CLA")
In order to accept your pull request, we need you to submit a CLA. You only need
to do this once to work on any of Salesforce's open source projects.

Complete your CLA here: <https://cla.salesforce.com/sign-cla>

# Issues
We use GitHub issues to track public bugs. Please ensure your description is
clear and has sufficient instructions to be able to reproduce the issue.

# Code of Conduct
Please follow our [Code of Conduct](CODE_OF_CONDUCT.md).

# License
By contributing your code, you agree to license your contribution under the terms of our project [LICENSE](LICENSE.txt) and to sign the [Salesforce CLA](https://cla.salesforce.com/sign-cla)
7 changes: 7 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Security

Please report any security issue to [security@salesforce.com](mailto:security@salesforce.com)
as soon as it is discovered. This library limits its runtime dependencies in
order to reduce the total cost of ownership as much as can be, but all consumers
should remain vigilant and have their security stakeholders review all third-party
products (3PP) like this one and their dependencies.
39 changes: 39 additions & 0 deletions easy-setup-step-by-step.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

export SFCC_MRT_PROJECT=cli
export REALM="zzpq"
export SFCC_CLIENT_ID="a0a4deb0-5e03-477b-bfdc-e42ccfae6161"

b2c ods create -r $REALM --wait --ttl 0

# create mrt env called chuck in the cli project
b2c mrt env create chuck --name chuck \
--allow-cookies \
--proxy api=kv7kzm78.api.commercecloud.salesforce.com \
--proxy einstein=api.cquotient.com

# construct redirect-uri from ssr_external_hostname above and don't use localhost:3000
b2c slas client create \
--channels MarketStreet \
--tenant-id zzpq_014 \
--short-code kv7kzm78 \
--redirect-uri https://myproject-chuck.sfdc-8tgtt5-ecom1.exp-delivery.com/callback,http://localhost:3000/callback \
--default-scopes

# get clientId and COMMERCE_API_SLAS_SECRET from the output of the previous command and callback from the redirect-uri above
b2c mrt env var set -e chuck \
PUBLIC__app__commerce__api__clientId=5810be72-3b2f-49bc-8ca1-eb88119de2fa \
PUBLIC__app__commerce__api__organizationId=f_ecom_zzpq_014 \
PUBLIC__app__commerce__api__siteId=RefArch \
PUBLIC__app__commerce__api__shortCode= \
PUBLIC__app__commerce__api__callback=https://myproject-chuck.sfdc-8tgtt5-ecom1.exp-delivery.com/callback \
PUBLIC__app__commerce__api__privateKeyEnabled=true \
COMMERCE_API_SLAS_SECRET=sk_kasdjlkjsalkjasd

# import market street data from storefront-datasets repo
b2c job import --server zzpq-014.dx.commercecloud.salesforce.com ~/code/storefront-datasets/demo_data_marketstreet

b2c code deploy
b2c mrt push -e headertest -p cli -b ~/code/SFCC-Odyssey/packages/template-retail-rsc-app/build --ssr-only='ssr.js,ssr.mjs,chunk.mjs,server/**/*'


85 changes: 85 additions & 0 deletions easy-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/usr/bin/env bash
set -euo pipefail

# Configuration - modify these values for your setup
ENV_SLUG="demo15"
ENV_NAME="demo15"
SITE_ID="RefArch"
TENANT_ID="zzpq_013"
ORGANIZATION_ID="f_ecom_zzsa_009"
SHORT_CODE="kv7kzm78"
BUILD_PATH="${BUILD_PATH:-$HOME/code/SFCC-Odyssey/packages/template-retail-rsc-app/build}"

export SFCC_MRT_PROJECT="${SFCC_MRT_PROJECT:-cli}"

echo "=== Step 1: Creating MRT environment ==="
ENV_JSON=$(b2c mrt env create "$ENV_SLUG" --name "$ENV_NAME" --json)
echo "Environment created."

# Extract the external hostname for the callback URL
SSR_EXTERNAL_HOSTNAME=$(echo "$ENV_JSON" | jq -r '.ssr_external_hostname // empty')
if [[ -z "$SSR_EXTERNAL_HOSTNAME" ]]; then
# Fall back to hostname if external hostname not set
SSR_EXTERNAL_HOSTNAME=$(echo "$ENV_JSON" | jq -r '.hostname // empty')
fi

if [[ -z "$SSR_EXTERNAL_HOSTNAME" ]]; then
echo "Warning: Could not determine external hostname from environment. Using localhost."
CALLBACK_URL="http://localhost:3000/callback"
else
CALLBACK_URL="https://${SSR_EXTERNAL_HOSTNAME}/callback"
fi
echo "Callback URL: $CALLBACK_URL"

echo ""
echo "=== Step 2: Creating SLAS client ==="
SLAS_JSON=$(b2c slas client create --channels "$SITE_ID" \
--redirect-uri "$CALLBACK_URL" \
--default-scopes \
--tenant-id "$TENANT_ID" \
--json)
echo "SLAS client created."

# Extract client ID and secret from SLAS response
CLIENT_ID=$(echo "$SLAS_JSON" | jq -r '.clientId')
CLIENT_SECRET=$(echo "$SLAS_JSON" | jq -r '.secret // empty')

if [[ -z "$CLIENT_ID" ]]; then
echo "Error: Failed to get client ID from SLAS response"
exit 1
fi

echo "Client ID: $CLIENT_ID"
if [[ -n "$CLIENT_SECRET" ]]; then
echo "Client Secret: $CLIENT_SECRET (save this - it won't be shown again)"
fi

echo ""
echo "=== Step 3: Setting environment variables ==="
b2c mrt env var set -e "$ENV_SLUG" \
"PUBLIC__app__commerce__api__clientId=$CLIENT_ID" \
"PUBLIC__app__commerce__api__organizationId=$ORGANIZATION_ID" \
"PUBLIC__app__commerce__api__siteId=$SITE_ID" \
"PUBLIC__app__commerce__api__shortCode=$SHORT_CODE" \
"PUBLIC__app__commerce__api__proxy=/mobify/proxy/api" \
"PUBLIC__app__commerce__api__callback=$CALLBACK_URL" \
"PUBLIC__app__commerce__api__privateKeyEnabled=true" \
${CLIENT_SECRET:+"COMMERCE_API_SLAS_SECRET=$CLIENT_SECRET"}

echo ""
echo "=== Step 4: Deploying code ==="
b2c code deploy

echo ""
echo "=== Step 5: Importing job data ==="
b2c job import data/urls

echo ""
echo "=== Step 6: Pushing to MRT ==="
b2c mrt push -e "$ENV_SLUG" -b "$BUILD_PATH"

echo ""
echo "=== Setup Complete ==="
echo "Environment: $ENV_SLUG"
echo "Client ID: $CLIENT_ID"
echo "URL: https://${SSR_EXTERNAL_HOSTNAME:-localhost:3000}"
Loading