Skip to content

Commit f29479a

Browse files
authored
Open Source OOS-legal requirements (#11)
* open source wip * Rename SDK to b2c-tooling-sdk (#10) * rename sdk package name * linting * add license headers * remove demo files * restore jdocs
1 parent 9a6d98c commit f29479a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1080
-17
lines changed

CODE_OF_CONDUCT.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Salesforce Open Source Community Code of Conduct
2+
3+
## About the Code of Conduct
4+
5+
Equality is a core value at Salesforce. We believe a diverse and inclusive
6+
community fosters innovation and creativity, and are committed to building a
7+
culture where everyone feels included.
8+
9+
Salesforce open-source projects are committed to providing a friendly, safe, and
10+
welcoming environment for all, regardless of gender identity and expression,
11+
sexual orientation, disability, physical appearance, body size, ethnicity, nationality,
12+
race, age, religion, level of experience, education, socioeconomic status, or
13+
other similar personal characteristics.
14+
15+
The goal of this code of conduct is to specify a baseline standard of behavior so
16+
that people with different social values and communication styles can work
17+
together effectively, productively, and respectfully in our open source community.
18+
It also establishes a mechanism for reporting issues and resolving conflicts.
19+
20+
All questions and reports of abusive, harassing, or otherwise unacceptable behavior
21+
in a Salesforce open-source project may be reported by contacting the Salesforce
22+
Open Source Conduct Committee at ossconduct@salesforce.com.
23+
24+
## Our Pledge
25+
26+
In the interest of fostering an open and welcoming environment, we as
27+
contributors and maintainers pledge to making participation in our project and
28+
our community a harassment-free experience for everyone, regardless of gender
29+
identity and expression, sexual orientation, disability, physical appearance,
30+
body size, ethnicity, nationality, race, age, religion, level of experience, education,
31+
socioeconomic status, or other similar personal characteristics.
32+
33+
## Our Standards
34+
35+
Examples of behavior that contributes to creating a positive environment
36+
include:
37+
38+
* Using welcoming and inclusive language
39+
* Being respectful of differing viewpoints and experiences
40+
* Gracefully accepting constructive criticism
41+
* Focusing on what is best for the community
42+
* Showing empathy toward other community members
43+
44+
Examples of unacceptable behavior by participants include:
45+
46+
* The use of sexualized language or imagery and unwelcome sexual attention or
47+
advances
48+
* Personal attacks, insulting/derogatory comments, or trolling
49+
* Public or private harassment
50+
* Publishing, or threatening to publish, others' private information—such as
51+
a physical or electronic address—without explicit permission
52+
* Other conduct which could reasonably be considered inappropriate in a
53+
professional setting
54+
* Advocating for or encouraging any of the above behaviors
55+
56+
## Our Responsibilities
57+
58+
Project maintainers are responsible for clarifying the standards of acceptable
59+
behavior and are expected to take appropriate and fair corrective action in
60+
response to any instances of unacceptable behavior.
61+
62+
Project maintainers have the right and responsibility to remove, edit, or
63+
reject comments, commits, code, wiki edits, issues, and other contributions
64+
that are not aligned with this Code of Conduct, or to ban temporarily or
65+
permanently any contributor for other behaviors that they deem inappropriate,
66+
threatening, offensive, or harmful.
67+
68+
## Scope
69+
70+
This Code of Conduct applies both within project spaces and in public spaces
71+
when an individual is representing the project or its community. Examples of
72+
representing a project or community include using an official project email
73+
address, posting via an official social media account, or acting as an appointed
74+
representative at an online or offline event. Representation of a project may be
75+
further defined and clarified by project maintainers.
76+
77+
## Enforcement
78+
79+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
80+
reported by contacting the Salesforce Open Source Conduct Committee
81+
at ossconduct@salesforce.com. All complaints will be reviewed and investigated
82+
and will result in a response that is deemed necessary and appropriate to the
83+
circumstances. The committee is obligated to maintain confidentiality with
84+
regard to the reporter of an incident. Further details of specific enforcement
85+
policies may be posted separately.
86+
87+
Project maintainers who do not follow or enforce the Code of Conduct in good
88+
faith may face temporary or permanent repercussions as determined by other
89+
members of the project's leadership and the Salesforce Open Source Conduct
90+
Committee.
91+
92+
## Attribution
93+
94+
This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant-home],
95+
version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html.
96+
It includes adaptions and additions from [Go Community Code of Conduct][golang-coc],
97+
[CNCF Code of Conduct][cncf-coc], and [Microsoft Open Source Code of Conduct][microsoft-coc].
98+
99+
This Code of Conduct is licensed under the [Creative Commons Attribution 3.0 License][cc-by-3-us].
100+
101+
[contributor-covenant-home]: https://www.contributor-covenant.org (https://www.contributor-covenant.org/)
102+
[golang-coc]: https://golang.org/conduct
103+
[cncf-coc]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md
104+
[microsoft-coc]: https://opensource.microsoft.com/codeofconduct/
105+
[cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/

CONTRIBUTING.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
2+
# Contributing Guide For B2C Developer Tooling, B2C-CLI, B2C DX MCP, B2C Tooling SDK
3+
4+
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.
5+
6+
# Governance Model
7+
8+
## Salesforce Sponsored
9+
10+
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.
11+
12+
# Getting started
13+
14+
Please join the community on [Salesforce Commerce Cloud Unofficial slack](https://unofficialsfcc.com/).
15+
16+
# Issues, requests & ideas
17+
18+
Use GitHub Issues page to submit issues, enhancement requests and discuss ideas.
19+
20+
### Bug Reports and Fixes
21+
- 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,
22+
[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
23+
be reviewed.
24+
- Issues that have already been identified as a bug (note: able to reproduce) will be labelled `bug`.
25+
- If you'd like to submit a fix for a bug, [send a Pull Request](#creating_a_pull_request) and mention the Issue number.
26+
- Include tests that isolate the bug and verifies that it was fixed.
27+
28+
### New Features
29+
- 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).
30+
- Issues that have been identified as a feature request will be labelled `enhancement`.
31+
- If you'd like to implement the new feature, please wait for feedback from the project
32+
maintainers before spending too much time writing the code. In some cases, `enhancement`s may
33+
not align well with the project objectives at the time.
34+
35+
### Tests, Documentation, Miscellaneous
36+
- If you'd like to improve the tests, you want to make the documentation clearer, you have an
37+
alternative implementation of something that may have advantages over the way its currently
38+
done, or you have any other change, we would be happy to hear about it!
39+
- If its a trivial change, go ahead and [send a Pull Request](#creating_a_pull_request) with the changes you have in mind.
40+
- If not, [open an Issue](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/issues/new) to discuss the idea first.
41+
42+
If you're new to our project and looking for some way to make your first contribution, look for
43+
Issues labelled `good first contribution`.
44+
45+
# Contribution Checklist
46+
47+
- [x] Clean, simple, well styled code
48+
- [x] Commits should be atomic and messages must be descriptive. Related issues should be mentioned by Issue number.
49+
- [x] Comments
50+
- Module-level & function-level comments.
51+
- Comments on complex blocks of code or algorithms (include references to sources).
52+
- [x] Tests
53+
- The test suite, if provided, must be complete and pass
54+
- Increase code coverage, not versa.
55+
- 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.
56+
- [x] Dependencies
57+
- Minimize number of dependencies.
58+
- Prefer Apache 2.0, BSD3, MIT, ISC and MPL licenses.
59+
- [x] Reviews
60+
- Changes must be approved via peer code review
61+
62+
# Creating a Pull Request
63+
64+
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).
65+
3. **Clone** the forked repo to your machine.
66+
4. **Create** a new branch to contain your work (e.g. `git br fix-issue-11`)
67+
4. **Commit** changes to your own branch.
68+
5. **Push** your work back up to your fork. (e.g. `git push fix-issue-11`)
69+
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.
70+
7. **Sign** the Salesforce CLA (you will be prompted to do so when submitting the Pull Request)
71+
72+
> **NOTE**: Be sure to [sync your fork](https://help.github.com/articles/syncing-a-fork/) before making a pull request.
73+
74+
# Contributor License Agreement ("CLA")
75+
In order to accept your pull request, we need you to submit a CLA. You only need
76+
to do this once to work on any of Salesforce's open source projects.
77+
78+
Complete your CLA here: <https://cla.salesforce.com/sign-cla>
79+
80+
# Issues
81+
We use GitHub issues to track public bugs. Please ensure your description is
82+
clear and has sufficient instructions to be able to reproduce the issue.
83+
84+
# Code of Conduct
85+
Please follow our [Code of Conduct](CODE_OF_CONDUCT.md).
86+
87+
# License
88+
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)

SECURITY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Security
2+
3+
Please report any security issue to [security@salesforce.com](mailto:security@salesforce.com)
4+
as soon as it is discovered. This library limits its runtime dependencies in
5+
order to reduce the total cost of ownership as much as can be, but all consumers
6+
should remain vigilant and have their security stakeholders review all third-party
7+
products (3PP) like this one and their dependencies.

easy-setup-step-by-step.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
export SFCC_MRT_PROJECT=cli
4+
export REALM="zzpq"
5+
export SFCC_CLIENT_ID="a0a4deb0-5e03-477b-bfdc-e42ccfae6161"
6+
7+
b2c ods create -r $REALM --wait --ttl 0
8+
9+
# create mrt env called chuck in the cli project
10+
b2c mrt env create chuck --name chuck \
11+
--allow-cookies \
12+
--proxy api=kv7kzm78.api.commercecloud.salesforce.com \
13+
--proxy einstein=api.cquotient.com
14+
15+
# construct redirect-uri from ssr_external_hostname above and don't use localhost:3000
16+
b2c slas client create \
17+
--channels MarketStreet \
18+
--tenant-id zzpq_014 \
19+
--short-code kv7kzm78 \
20+
--redirect-uri https://myproject-chuck.sfdc-8tgtt5-ecom1.exp-delivery.com/callback,http://localhost:3000/callback \
21+
--default-scopes
22+
23+
# get clientId and COMMERCE_API_SLAS_SECRET from the output of the previous command and callback from the redirect-uri above
24+
b2c mrt env var set -e chuck \
25+
PUBLIC__app__commerce__api__clientId=5810be72-3b2f-49bc-8ca1-eb88119de2fa \
26+
PUBLIC__app__commerce__api__organizationId=f_ecom_zzpq_014 \
27+
PUBLIC__app__commerce__api__siteId=RefArch \
28+
PUBLIC__app__commerce__api__shortCode= \
29+
PUBLIC__app__commerce__api__callback=https://myproject-chuck.sfdc-8tgtt5-ecom1.exp-delivery.com/callback \
30+
PUBLIC__app__commerce__api__privateKeyEnabled=true \
31+
COMMERCE_API_SLAS_SECRET=sk_kasdjlkjsalkjasd
32+
33+
# import market street data from storefront-datasets repo
34+
b2c job import --server zzpq-014.dx.commercecloud.salesforce.com ~/code/storefront-datasets/demo_data_marketstreet
35+
36+
b2c code deploy
37+
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/**/*'
38+
39+

easy-setup.sh

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Configuration - modify these values for your setup
5+
ENV_SLUG="demo15"
6+
ENV_NAME="demo15"
7+
SITE_ID="RefArch"
8+
TENANT_ID="zzpq_013"
9+
ORGANIZATION_ID="f_ecom_zzsa_009"
10+
SHORT_CODE="kv7kzm78"
11+
BUILD_PATH="${BUILD_PATH:-$HOME/code/SFCC-Odyssey/packages/template-retail-rsc-app/build}"
12+
13+
export SFCC_MRT_PROJECT="${SFCC_MRT_PROJECT:-cli}"
14+
15+
echo "=== Step 1: Creating MRT environment ==="
16+
ENV_JSON=$(b2c mrt env create "$ENV_SLUG" --name "$ENV_NAME" --json)
17+
echo "Environment created."
18+
19+
# Extract the external hostname for the callback URL
20+
SSR_EXTERNAL_HOSTNAME=$(echo "$ENV_JSON" | jq -r '.ssr_external_hostname // empty')
21+
if [[ -z "$SSR_EXTERNAL_HOSTNAME" ]]; then
22+
# Fall back to hostname if external hostname not set
23+
SSR_EXTERNAL_HOSTNAME=$(echo "$ENV_JSON" | jq -r '.hostname // empty')
24+
fi
25+
26+
if [[ -z "$SSR_EXTERNAL_HOSTNAME" ]]; then
27+
echo "Warning: Could not determine external hostname from environment. Using localhost."
28+
CALLBACK_URL="http://localhost:3000/callback"
29+
else
30+
CALLBACK_URL="https://${SSR_EXTERNAL_HOSTNAME}/callback"
31+
fi
32+
echo "Callback URL: $CALLBACK_URL"
33+
34+
echo ""
35+
echo "=== Step 2: Creating SLAS client ==="
36+
SLAS_JSON=$(b2c slas client create --channels "$SITE_ID" \
37+
--redirect-uri "$CALLBACK_URL" \
38+
--default-scopes \
39+
--tenant-id "$TENANT_ID" \
40+
--json)
41+
echo "SLAS client created."
42+
43+
# Extract client ID and secret from SLAS response
44+
CLIENT_ID=$(echo "$SLAS_JSON" | jq -r '.clientId')
45+
CLIENT_SECRET=$(echo "$SLAS_JSON" | jq -r '.secret // empty')
46+
47+
if [[ -z "$CLIENT_ID" ]]; then
48+
echo "Error: Failed to get client ID from SLAS response"
49+
exit 1
50+
fi
51+
52+
echo "Client ID: $CLIENT_ID"
53+
if [[ -n "$CLIENT_SECRET" ]]; then
54+
echo "Client Secret: $CLIENT_SECRET (save this - it won't be shown again)"
55+
fi
56+
57+
echo ""
58+
echo "=== Step 3: Setting environment variables ==="
59+
b2c mrt env var set -e "$ENV_SLUG" \
60+
"PUBLIC__app__commerce__api__clientId=$CLIENT_ID" \
61+
"PUBLIC__app__commerce__api__organizationId=$ORGANIZATION_ID" \
62+
"PUBLIC__app__commerce__api__siteId=$SITE_ID" \
63+
"PUBLIC__app__commerce__api__shortCode=$SHORT_CODE" \
64+
"PUBLIC__app__commerce__api__proxy=/mobify/proxy/api" \
65+
"PUBLIC__app__commerce__api__callback=$CALLBACK_URL" \
66+
"PUBLIC__app__commerce__api__privateKeyEnabled=true" \
67+
${CLIENT_SECRET:+"COMMERCE_API_SLAS_SECRET=$CLIENT_SECRET"}
68+
69+
echo ""
70+
echo "=== Step 4: Deploying code ==="
71+
b2c code deploy
72+
73+
echo ""
74+
echo "=== Step 5: Importing job data ==="
75+
b2c job import data/urls
76+
77+
echo ""
78+
echo "=== Step 6: Pushing to MRT ==="
79+
b2c mrt push -e "$ENV_SLUG" -b "$BUILD_PATH"
80+
81+
echo ""
82+
echo "=== Setup Complete ==="
83+
echo "Environment: $ENV_SLUG"
84+
echo "Client ID: $CLIENT_ID"
85+
echo "URL: https://${SSR_EXTERNAL_HOSTNAME:-localhost:3000}"

0 commit comments

Comments
 (0)